{"_id":"@0xbigboss/pocketjs-transaction-builder","_rev":"3-cde39c66200fcd706c27d6df21726cec","name":"@0xbigboss/pocketjs-transaction-builder","dist-tags":{"latest":"2.1.1"},"versions":{"2.1.0":{"name":"@0xbigboss/pocketjs-transaction-builder","version":"2.1.0","keywords":[],"license":"MIT","_id":"@0xbigboss/pocketjs-transaction-builder@2.1.0","maintainers":[{"name":"0xbigboss","email":"0xbigboss@proton.me"}],"dist":{"shasum":"46a16262c6a9e0c3e7077d37135747f72ad72641","tarball":"https://registry.npmjs.org/@0xbigboss/pocketjs-transaction-builder/-/pocketjs-transaction-builder-2.1.0.tgz","fileCount":101,"integrity":"sha512-0kAeE303VtxDCerEr8051PUbS2BuUg5NfqhjoxefTkafcLKr/ixE+3rxrSACKRM1i0oUq8rBqu4uphBSW4xTlA==","signatures":[{"sig":"MEYCIQDPhBWkYTboKDGYq33CWnIROb5Na+y7DCZQx8hbJi0bPgIhANNZbtSNCqCUtNRgN2u8k/1bhi6nrVu8VqLse7NcangZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":496278,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjORLyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLbg//aGowCO4Wu6zBwbPGvHK5CD5Hby1vnihScfimm1N9s9/tlIQE\r\nadUSpYrMAmSZXHCs9c6bX9ZfAcXxL7v6nwebl6CMqACB9sdh6rS6abuSxnAU\r\nZD74bz6t9OasR5kFCTLqMJkxx+yr3cRh79bDtXyTATYAkxjxNGt3iXoqLCCg\r\nA4duoSZ5GSRs59C/mB20znmbEbAO1Sek9pNFY/E91lrtXtGxXV9HOC3CxiDW\r\nZrm4oQYItyPnPcpAAGetG6OgO2PpTTVANpOp0ZJUQwqTeLh+eOpy/OVILmuL\r\naBpm6Sb5OtPRyfiAsxw7jrub6uHfpsCgAKZ0dmigxL0Rx3d8bL8w8l75V6+K\r\nIO2A8+ZtcYQhcb8/n6UoLL6xQHIWj0TfGhDuy8uc8LNX99z80ozjSVvYT25f\r\nAHjkQPVCni9869oEqjHAzkV51QziPeWV4CyMj3NmRH0f8FX0XYlrikjZ0Ow6\r\ntDSs7pcqy2/q7+VzG9JcM8OmbvQMWdO64inuMh03UGha0/4+pqAYgzVir0cs\r\ngNMk/XCiAn+VEsMNasxraK3ek+hAJMqyWlYhsyqcFqdmRwvHIv6Zu3M6fPKS\r\nmDgMIqQ/K9K7n860zDR7K/VgIpKYG7VJ1j+kgbilgC87sgk+sCqX9qMBnEpD\r\nThHzbMiXhu/zfr31g1xF3eCdWJxeQ6JxFY0=\r\n=MCoq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.cjs","type":"module","_from":"file:0xbigboss-pocketjs-transaction-builder-2.1.0.tgz","types":"dist/src/index.d.ts","unpkg":"./dist/index.umd.js","module":"./dist/index.js","source":"src/index.ts","authors":["BigBoss <0xbigboss@proton.me>"],"exports":{"default":"./dist/index.js","require":"./dist/index.cjs"},"scripts":{"dev":"microbundle watch","test":"pnpm jest","build":"microbundle"},"_npmUser":{"name":"0xbigboss","email":"0xbigboss@proton.me"},"_resolved":"/private/var/folders/9b/khhz0hwd07z_p9n1wh5mqg_80000gn/T/9f233a8067cf54bab052b2dac41ac2b2/0xbigboss-pocketjs-transaction-builder-2.1.0.tgz","_integrity":"sha512-0kAeE303VtxDCerEr8051PUbS2BuUg5NfqhjoxefTkafcLKr/ixE+3rxrSACKRM1i0oUq8rBqu4uphBSW4xTlA==","_npmVersion":"8.15.0","description":"Transaction manager and utilties for the Pocket Network protocol","directories":{},"_nodeVersion":"16.17.0","dependencies":{"long":"^5.2.0","buffer":"^6.0.3","varint":"^6.0.0","ts-proto":"^1.110.4","protobufjs":"6.8.8","@tendermint/belt":"^0.3.0","@pokt-network/amino-js":"^0.7.5-alpha.1","@0xbigboss/pocketjs-types":"2.1.0","@0xbigboss/pocketjs-utils":"2.1.0","@0xbigboss/pocketjs-signer":"2.1.0","@0xbigboss/pocketjs-abstract-provider":"2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.4.7","eslint":"7.32.0","ts-jest":"^27.1.3","prettier":"^2.5.1","@types/jest":"^27.4.0","microbundle":"^0.14.2","prettier-eslint":"^13.0.0","@typescript-eslint/parser":"^5.10.2","@0xbigboss/pocketjs-provider":"2.1.0","@typescript-eslint/eslint-plugin":"^5.10.2"},"_npmOperationalInternal":{"tmp":"tmp/pocketjs-transaction-builder_2.1.0_1664684786738_0.8688074346560137","host":"s3://npm-registry-packages"}},"2.1.1":{"name":"@0xbigboss/pocketjs-transaction-builder","version":"2.1.1","keywords":[],"author":"","license":"MIT","_id":"@0xbigboss/pocketjs-transaction-builder@2.1.1","maintainers":[{"name":"0xbigboss","email":"0xbigboss@proton.me"}],"dist":{"shasum":"ccf2bde83b5be91791511b7697ae44486a0e64d9","tarball":"https://registry.npmjs.org/@0xbigboss/pocketjs-transaction-builder/-/pocketjs-transaction-builder-2.1.1.tgz","fileCount":101,"integrity":"sha512-hyKj+gZ1uQsSnf/uEclXLmwLNXlE5rWopHPIG8PixlMwNQFYmhoG0EupT8pqHqFQy46Eb4UItkDdCW/M1K1sIg==","signatures":[{"sig":"MEUCIGSjwR9FEHsfSvfK89GkEb2JLxl7HA1ulsVYi7DEwVAPAiEAsU5AKRBGI6wqsCbN9p0MdmYKDdus+JfhKLzTjYJMt4Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":499140,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjXwYGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqj+xAAl6oeDVv3CFABh6L4Luca4yFFW1zjJLw6iqH7iYkKBCdAjbQy\r\nKED+gnGh1mfn+TlBdmaioVPAR0mHdG955ghSqGnkxuoAhuX+JdWO1GdmMNuj\r\nBI3n0Blg1Bzm/5FayWy/7z857GYLEe7IsZVhdUaSM4xK/9xnyuY+Y7fui4Wz\r\ncseUfVkJFdcwv2z9uysKV5tEO8xCFVsispr6R/oDZj5ygogzDYCK3oG1nuGp\r\n5cEpANDy7ZficQ76mR/0bNj/Z91rCt5ePJlJq+v/5RjhxXyf6vF7DnxSq2oO\r\n8EhKXs0yVUWINNKTc2fn/tjxA/TgwbhX6KXC5pLJ8thcTGSoJRj9ffDiPFp8\r\nfpTwSlmkJcuZVjVJe+j1WbjCg4yvQfs4iYK0hOlQMQawxIxUkxVKb3CqOSO8\r\nN4Oc91xVIXI56+nClzxVXn3F6rGhf6Gys3+e+vlcv5pYfu+q2NgQ9au5HhD3\r\nPI0klp0rHfevrXpHrTCpXskbWaX8kBnmpQ7QgS2isk6aLd9uNTA5xvFrPvMZ\r\n2EPJcxEZeqi9IX+A71RFiQ3FfN20lVKlse241XNDnA9KFO35Uz33dZSrRK82\r\ndLSZLAmSq2HvC4DRWNVskXfEL37YIH1M6YZw8eVfIrTURZF8/429b0wLpuDb\r\nnExVU3BFOxS3pqGlw8cQZTRmKq2ffy1SKPw=\r\n=/L4k\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.cjs","type":"module","_from":"file:0xbigboss-pocketjs-transaction-builder-2.1.1.tgz","types":"dist/src/index.d.ts","unpkg":"./dist/index.umd.js","module":"./dist/index.js","source":"src/index.ts","exports":{"default":"./dist/index.js","require":"./dist/index.cjs"},"scripts":{"dev":"microbundle watch","test":"pnpm jest","build":"microbundle"},"_npmUser":{"name":"0xbigboss","email":"0xbigboss@proton.me"},"_resolved":"/private/var/folders/9b/khhz0hwd07z_p9n1wh5mqg_80000gn/T/d540b0db9fb7fab7e3a9aeedbcb647dc/0xbigboss-pocketjs-transaction-builder-2.1.1.tgz","_integrity":"sha512-hyKj+gZ1uQsSnf/uEclXLmwLNXlE5rWopHPIG8PixlMwNQFYmhoG0EupT8pqHqFQy46Eb4UItkDdCW/M1K1sIg==","_npmVersion":"8.19.2","description":"Transaction manager and utilties for the Pocket Network protocol","directories":{},"_nodeVersion":"18.12.0","dependencies":{"long":"^5.2.0","buffer":"^6.0.3","varint":"^6.0.0","ts-proto":"^1.110.4","protobufjs":"6.8.8","@tendermint/belt":"^0.3.0","@pokt-network/amino-js":"^0.7.5-alpha.1","@0xbigboss/pocketjs-types":"2.1.1","@0xbigboss/pocketjs-utils":"2.1.1","@0xbigboss/pocketjs-signer":"2.1.1","@0xbigboss/pocketjs-abstract-provider":"2.1.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.4.7","eslint":"7.32.0","ts-jest":"^27.1.3","prettier":"^2.5.1","@types/jest":"^27.4.0","@types/node":"^18.11.8","microbundle":"^0.14.2","prettier-eslint":"^13.0.0","@typescript-eslint/parser":"^5.10.2","@0xbigboss/pocketjs-provider":"2.1.1","@typescript-eslint/eslint-plugin":"^5.10.2"},"_npmOperationalInternal":{"tmp":"tmp/pocketjs-transaction-builder_2.1.1_1667171846007_0.15390932253419942","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-10-02T04:26:26.673Z","modified":"2026-06-24T17:39:15.029Z","2.1.0":"2022-10-02T04:26:26.929Z","2.1.1":"2022-10-30T23:17:26.244Z"},"license":"MIT","keywords":[],"description":"Transaction manager and utilties for the Pocket Network protocol","maintainers":[{"email":"0xbigboss@proton.me","name":"alleneubank"}],"readme":"# TransactionBuilder\n\nThis package houses the TransactionBuilder, which lets you build a transaction to then send into the network.\n\n## Installation\nInstall through your package manager of choice:\n```\npnpm install @pokt-foundation/pocketjs-transaction-builder\n```\n\n## Usage\n\n```js \nimport { TransactionBuilder } from '@pokt-foundation/pocketjs-transaction-builder'\n\n// Initializing the TransactionBuilder is simple:\n// 1. Instanciate a provider\nexport const provider = new JsonRpcProvider({\n  rpcUrl: MAINNET_RPC_URL,\n})\n\n// 2. Instanciate a signer\nexport const signer = await KeyManager.fromPrivateKey(process.env.PRIVATE_KEY)\n\n// 3. Instanciate the TransactionBuilder\nexport const builder = new TransactionBuilder({\n  signer,\n  provider,\n});\n\n// Create a new `Send` Message which is used to send funds over the network.\nconst sendMsg = transactionBuilder.send(\n  signer.getAddress(), \n  \"07a6fca4dea9f01e4c19f301df0d0afac128561b\",\n  // Amount in uPOKT (1 POKT = 1*10^6 uPOKT)\n  \"1000000\"\n)\n// Send it over the network!\nconst txresponse = await transactionBuilder.submit({\n  memo: \"POKT Payment\",\n  txMsg: sendMsg,\n})\n```\n\n## TransactionBuilder API\n\n### Constructor\n#### signer\n- type: `KeyManager`\nThe KeyManager instance that holds the staked app in the blockchain.\n\n#### provider\n- type: `JsonRpcProvider` | `IsomorphicProvider`\nThe provider instance with available dispatchers to talk to the network.\n\n#### chainID (optional)\n- type: `mainnet` | `localnet` | `testnet`\nChainID to send the transactions to. The provider endpoint must be connected to that chain ID.\n\n### Methods\n#### getChainID(): ChainID\nGets the current chain ID this transaction builder has been initialized for.\n\nReturns `ChainID`: 'mainnet', 'localnet', or 'testnet'.\n\n#### setChainID(id): void\nSets the chainID to one of the supported networks.\n\n| Param       | Type      | Description                                                                     |\n|-------------|-----------|---------------------------------------------------------------------------------|\n| id          | `string`  | The chain to send transactions to. The provider must be connected to that chain |\n\n#### createTransaction({ fee, memo, txMsg }): Promise<RawTxRequest>\nSigns and creates a transaction object that can be submitted to the network given the parameters and called upon Msgs.\n\nReturns `Promise<RawTxRequest>`: The raw transaction request which can be sent over the network.\n\n| Param | Type     | Description                                                                                 |\n|-------|----------|---------------------------------------------------------------------------------------------|\n| fee   | `string` | The amount to pay as a fee for executing this transaction, in uPOKT (1 POKT = 1*10^6 uPOKT) |\n| memo  | `string` | Memo field for this transaction.                                                            |\n| txMsg | `TxMsg`  | Transaction message generated with one of the available methods.                            |\n\n#### submit({ fee, memo, txMsg }): Promise<TransactionResponse>\nSubmit receives a valid transaction message, creates a Raw Transaction Request and sends it over the network.\n\nReturns `Promise<TransactionResponse`: The transaction response from the network, containing the transaction hash.\n\n| Param | Type     | Description                                                                                 |\n|-------|----------|---------------------------------------------------------------------------------------------|\n| fee   | `string` | The amount to pay as a fee for executing this transaction, in uPOKT (1 POKT = 1*10^6 uPOKT) |\n| memo  | `string` | Memo field for this transaction.                                                            |\n| txMsg | `TxMsg`  | Transaction message generated with one of the available methods.                            |\n\n#### submitRawTransaction(tx): Promise<TransactionResponse>\nSubmit receives an already made Raw Transaction Request and sends it over the network.\n\nReturns `Promise<TransactionResponse`: The transaction response from the network, containing the transaction hash.\n\n| Param | Type           | Description                                                    |\n|-------|----------------|----------------------------------------------------------------|\n| tx    | `RawTxRequest` | The raw transaction request, created with `createTransaction`. |\n\n#### send({ fromAddress, toAddress, amount }): MsgProtoSend\nAdds a MsgSend TxMsg for this transaction.\n\nReturns a `MsgProtoSend`: An unsigned Send transaction message.\n\n| Param       | Type     | Description                                                 |\n|-------------|----------|-------------------------------------------------------------|\n| fromAddress | `string` | Origin address, which is the address that the signer holds. |\n| toAddress   | `string` | Destination address                                         |\n| amount      | `string` | Amount of uPOKT to send.                                    |\n\n#### appStake({ appPubKey, chains, amount }): MsgProtoAppStake\nAdds a MsgAppStake TxMsg for this transaction.\n\nReturns a `MsgProtoAppStake`: The unsigned App Stake message.\n\n| Param     | Type       | Description                                                                                                  |\n|-----------|------------|--------------------------------------------------------------------------------------------------------------|\n| appPubKey | `string`   | Application Public Key                                                                                       |\n| chains    | `string[]` | Chains that the apps wants access to by staking POKT. Throughput will be equally divided through all chains. |\n| amount    | `string`   | Amount of uPOKT to stake.                                                                                    |\n\n#### appUnstake(address): MsgProtoAppUnstake\nAdds a MsgProtoAppUnstake TxMsg for this transaction.\n\nReturns `MsgProtoAppUnstake`: The unsigned app unstake message.\n\n| Param   | Type     | Description             |\n|---------|----------|-------------------------|\n| address | `string` | Address of the account. |\n\n#### nodeStake({ nodePubKey, chains, amount, serviceURL }): MsgProtoNodeStakeTx\nAdds a NodeStake TxMsg for this transaction.\n\nReturns a `MsgProtoNodeStakeTx`: The unsigned node stake message.\n\n| Param      | Type       | Description                                                  |\n|------------|------------|--------------------------------------------------------------|\n| nodePubKey | `string`   | Node Public Key                                              |\n| chains     | `string[]` | Chains that the node wants to service to by staking POKT.    |\n| amount     | `string`   | Amount of uPOKT to stake.                                    |\n| serviceURL | `URL`      | Node service URL that will be used to send requests through. |\n\n#### nodeUnstake(address): MsgProtoNodeUnstake\nAdds a MsgProtoNodeUnstake for this transaction.\n\nReturns `MsgProtoNodeUnstake`: The unsigned node unstake message.\n\n| Param   | Type     | Description             |\n|---------|----------|-------------------------|\n| address | `string` | Address of the account. |\n\n#### nodeUnjail(address): MsgAProtoNodeUnjail\nAdds a MsgUnjail for this transaction.\n\nReturns a `MsgProtoNodeUnstake`: The unsigned node unjail message.\n\n| Param   | Type     | Description             |\n|---------|----------|-------------------------|\n| address | `string` | Address of the account. |\n","readmeFilename":"README.md"}