{"_id":"@57block/stellar-autoaction-sdk","_rev":"2-9ef865187b95aa552cf8402702face67","name":"@57block/stellar-autoaction-sdk","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@57block/stellar-autoaction-sdk","version":"0.0.1","keywords":[],"author":{"name":"Jimmy Zhao","email":"jimmy@57blocks.com"},"license":"MIT","_id":"@57block/stellar-autoaction-sdk@0.0.1","maintainers":[{"name":"jimmyzhao57blocks","email":"jimmy@57blocks.com"},{"name":"57b","email":"npm@57blocks.com"}],"homepage":"https://github.com/57blocks/Stellar-AutoAction-sdk#readme","bugs":{"url":"https://github.com/57blocks/Stellar-AutoAction-sdk/issues"},"dist":{"shasum":"d7e0980446939fefe1d0cd69ca446a739eceb3c6","tarball":"https://registry.npmjs.org/@57block/stellar-autoaction-sdk/-/stellar-autoaction-sdk-0.0.1.tgz","fileCount":7,"integrity":"sha512-DM4i2Y43dc4d5O4u25lW/6v0LLTQfrxkUGjKD46BWR+W9o9mTFteVFwb6zeMXkJz1PwnDbuaTG1NWv2TZc3a2w==","signatures":[{"sig":"MEQCIGxGqNIYzpDHfCfUuC3vUtYjbmPP2Sfm6XvQ51gTmNOvAiBmUxBVFvnhnfU/BorjDTzgnY3h3VDm+QDTHM8EXhJ2nQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9370},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"d1f326fdfd2cb979304e1397eaf794c8b4f9134d","scripts":{"dev":"unbuild --stub","lint":"eslint .","test":"vitest","build":"unbuild","start":"esno src/index.ts","prepare":"simple-git-hooks","release":"bumpp && npm publish","typecheck":"tsc --noEmit","prepublishOnly":"nr build"},"_npmUser":{"name":"jimmyzhao57blocks","email":"jimmy@57blocks.com"},"repository":{"url":"git+https://github.com/57blocks/Stellar-AutoAction-sdk.git","type":"git"},"_npmVersion":"10.7.0","description":"stellar autoaction sdk","directories":{},"lint-staged":{"*":"eslint --fix"},"sideEffects":false,"_nodeVersion":"18.20.4","dependencies":{"@aws-sdk/client-secrets-manager":"^3.645.0"},"publishConfig":{"access":"public"},"typesVersions":{"*":{"*":["./dist/*","./dist/index.d.ts"]}},"_hasShrinkwrap":false,"packageManager":"pnpm@9.5.0","devDependencies":{"esno":"^4.7.0","pnpm":"^9.5.0","vite":"^5.3.4","bumpp":"^9.4.1","eslint":"^9.7.0","vitest":"^2.0.3","unbuild":"^2.0.0","@antfu/ni":"^0.22.0","typescript":"^5.5.3","@types/node":"^20.14.11","lint-staged":"^15.2.7","@antfu/utils":"^0.7.10","simple-git-hooks":"^2.11.1","@antfu/eslint-config":"^2.23.0"},"simple-git-hooks":{"pre-commit":"pnpm lint-staged"},"_npmOperationalInternal":{"tmp":"tmp/stellar-autoaction-sdk_0.0.1_1728611972521_0.08593578886518927","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@57block/stellar-autoaction-sdk","version":"0.0.2","keywords":[],"author":{"name":"Jimmy Zhao","email":"jimmy@57blocks.com"},"license":"MIT","_id":"@57block/stellar-autoaction-sdk@0.0.2","maintainers":[{"name":"jimmyzhao57blocks","email":"jimmy@57blocks.com"},{"name":"57b","email":"npm@57blocks.com"}],"homepage":"https://github.com/57blocks/Stellar-AutoAction-sdk#readme","bugs":{"url":"https://github.com/57blocks/Stellar-AutoAction-sdk/issues"},"dist":{"shasum":"e967010be4126dcaeba7d4436f656b47cc441a49","tarball":"https://registry.npmjs.org/@57block/stellar-autoaction-sdk/-/stellar-autoaction-sdk-0.0.2.tgz","fileCount":7,"integrity":"sha512-V7NQmGpD+FFgIhUJHpX0UC26xr1ENjiaabOCYlSbJoitVbNKR9/arBQa0UDf4xmMFeB1DbQ78P2Ve/+PP4uxiQ==","signatures":[{"sig":"MEQCIBdcMrddzlK8qah4ksWvDjQ3sHnA2ftfhThcAKqkgD8ZAiBEGA3xj/I41d17XvGLT8leKGmmSpnRDRfYjvmhqlkR9g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9631},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"0d060368342680dec8e566dceec0b00c16629ad5","scripts":{"dev":"unbuild --stub","lint":"eslint .","test":"vitest","build":"unbuild","start":"esno src/index.ts","prepare":"simple-git-hooks","release":"bumpp && npm publish","typecheck":"tsc --noEmit","prepublishOnly":"nr build"},"_npmUser":{"name":"jimmyzhao57blocks","email":"jimmy@57blocks.com"},"repository":{"url":"git+https://github.com/57blocks/Stellar-AutoAction-sdk.git","type":"git"},"_npmVersion":"10.7.0","description":"stellar autoaction sdk","directories":{},"lint-staged":{"*":"eslint --fix"},"sideEffects":false,"_nodeVersion":"18.20.4","dependencies":{"@aws-sdk/client-secrets-manager":"^3.645.0"},"publishConfig":{"access":"public"},"typesVersions":{"*":{"*":["./dist/*","./dist/index.d.ts"]}},"_hasShrinkwrap":false,"packageManager":"pnpm@9.5.0","devDependencies":{"esno":"^4.7.0","pnpm":"^9.5.0","vite":"^5.3.4","bumpp":"^9.4.1","eslint":"^9.7.0","vitest":"^2.0.3","unbuild":"^2.0.0","@antfu/ni":"^0.22.0","typescript":"^5.5.3","@types/node":"^20.14.11","lint-staged":"^15.2.7","@antfu/utils":"^0.7.10","simple-git-hooks":"^2.11.1","@antfu/eslint-config":"^2.23.0"},"simple-git-hooks":{"pre-commit":"pnpm lint-staged"},"_npmOperationalInternal":{"tmp":"tmp/stellar-autoaction-sdk_0.0.2_1728984395893_0.6789756080700735","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-10-11T01:59:32.420Z","modified":"2025-01-06T08:09:56.656Z","0.0.1":"2024-10-11T01:59:32.713Z","0.0.2":"2024-10-15T09:26:36.068Z"},"bugs":{"url":"https://github.com/57blocks/Stellar-AutoAction-sdk/issues"},"author":{"name":"Jimmy Zhao","email":"jimmy@57blocks.com"},"license":"MIT","homepage":"https://github.com/57blocks/Stellar-AutoAction-sdk#readme","keywords":[],"repository":{"url":"git+https://github.com/57blocks/Stellar-AutoAction-sdk.git","type":"git"},"description":"stellar autoaction sdk","maintainers":[{"email":"jimmy@57blocks.com","name":"jimmyzhao57blocks"},{"email":"npm@57blocks.com","name":"57b"},{"email":"song@57blocks.com","name":"sunny_bai"}],"readme":"# Stellar-AutoAction-sdk\n\nProvides a sign transaction function for users to replace the sign function of the steller SDK.\n\n## Install\n\n```bash\nnpm install @57block/stellar-autoaction-sdk\n```\n\n## Usage\n\nThe following example demonstrates signing a transaction using the stellar autoaction-sdk on the [Stellar](https://stellar.org/) blockchain.\n\n```js\nconst {\n  Horizon,\n  Networks,\n  Asset,\n  Operation,\n  TransactionBuilder,\n  Keypair,\n  xdr,\n} = require(\"@stellar/stellar-sdk\");\nconst { sign } = require(\"@57block/stellar-autoaction-sdk\");\n\nconst submitTx = async (\n  sourcePublicKey,\n  destinationPublicKey,\n  account,\n  org\n) => {\n  // Configure the server to the Horizon instance hosted by Stellar.org\n  // To use the live network, set the hostname to 'horizon.stellar.org'\n  const server = new Horizon.Server('https://horizon-testnet.stellar.org');\n\n  console.log(\"Building transaction...\");\n  // Transactions require a valid sequence number that is specific to this account.\n  // We can fetch the current sequence number for the source account from Horizon.\n  const sourceAccount = await server.loadAccount(sourcePublicKey);\n  // Right now, there's one function that fetches the base fee.\n  const fee = await server.fetchBaseFee();\n  const tx = new TransactionBuilder(sourceAccount, {\n    fee,\n    // Uncomment the following line to build transactions for the live network. Be\n    // sure to also change the horizon hostname.\n    // networkPassphrase: StellarSdk.Networks.PUBLIC,\n    networkPassphrase: Networks.TESTNET\n  })\n  // Add a payment operation to the transaction\n  .addOperation(Operation.payment({\n    destination: destinationPublicKey,\n    // The term native asset refers to lumens\n    asset: Asset.native(),\n    amount: '10',\n  }))\n  // Make this transaction valid for the next 30 seconds only\n  .setTimeout(30)\n  // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/)\n  // .addMemo(Memo.text('Hello world!'))\n  .build();\n\n  console.log(\"Signing transaction...\");\n  // get the signature from sdk sign server\n  const signature = await sign({\n    txHash: tx.hash().toString('base64'),\n    sourcePublicKey,\n    account,\n    org,\n  });\n  // use the signature to sign the transaction\n  tx.addDecoratedSignature(\n    new xdr.DecoratedSignature({\n      signature,\n      hint: Keypair.fromPublicKey(sourcePublicKey).signatureHint(),\n    })\n  );\n  console.log(\"Submiting transaction...\");\n  // Submit the transaction to the Horizon server. The Horizon server will then\n  // submit the transaction into the network for us.\n  const transactionResult = await server.submitTransaction(tx);\n  console.log(`Transaction successful! Tx hash: ${transactionResult.hash}`);\n};\n```","readmeFilename":"README.md"}