@ledgerhq/coin-solana 0.7.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +20 -0
- package/.turbo/turbo-build.log +4 -0
- package/.unimportedrc.json +16 -0
- package/CHANGELOG.md +27 -0
- package/LICENSE.txt +21 -0
- package/jest.config.js +8 -0
- package/lib/api/cached.d.ts +3 -0
- package/lib/api/cached.d.ts.map +1 -0
- package/lib/api/cached.js +41 -0
- package/lib/api/cached.js.map +1 -0
- package/lib/api/chain/account/index.d.ts +2 -0
- package/lib/api/chain/account/index.d.ts.map +1 -0
- package/lib/api/chain/account/index.js +8 -0
- package/lib/api/chain/account/index.js.map +1 -0
- package/lib/api/chain/account/parser.d.ts +10 -0
- package/lib/api/chain/account/parser.d.ts.map +1 -0
- package/lib/api/chain/account/parser.js +56 -0
- package/lib/api/chain/account/parser.js.map +1 -0
- package/lib/api/chain/account/stake.d.ts +237 -0
- package/lib/api/chain/account/stake.d.ts.map +1 -0
- package/lib/api/chain/account/stake.js +38 -0
- package/lib/api/chain/account/stake.js.map +1 -0
- package/lib/api/chain/account/token.d.ts +116 -0
- package/lib/api/chain/account/token.d.ts.map +1 -0
- package/lib/api/chain/account/token.js +42 -0
- package/lib/api/chain/account/token.js.map +1 -0
- package/lib/api/chain/account/vote.d.ts +252 -0
- package/lib/api/chain/account/vote.d.ts.map +1 -0
- package/lib/api/chain/account/vote.js +44 -0
- package/lib/api/chain/account/vote.js.map +1 -0
- package/lib/api/chain/index.d.ts +29 -0
- package/lib/api/chain/index.d.ts.map +1 -0
- package/lib/api/chain/index.js +96 -0
- package/lib/api/chain/index.js.map +1 -0
- package/lib/api/chain/instruction/associated-token-account/index.d.ts +15 -0
- package/lib/api/chain/instruction/associated-token-account/index.d.ts.map +1 -0
- package/lib/api/chain/instruction/associated-token-account/index.js +21 -0
- package/lib/api/chain/instruction/associated-token-account/index.js.map +1 -0
- package/lib/api/chain/instruction/associated-token-account/types.d.ts +30 -0
- package/lib/api/chain/instruction/associated-token-account/types.d.ts.map +1 -0
- package/lib/api/chain/instruction/associated-token-account/types.js +19 -0
- package/lib/api/chain/instruction/associated-token-account/types.js.map +1 -0
- package/lib/api/chain/instruction/memo/index.d.ts +15 -0
- package/lib/api/chain/instruction/memo/index.d.ts.map +1 -0
- package/lib/api/chain/instruction/memo/index.js +14 -0
- package/lib/api/chain/instruction/memo/index.js.map +1 -0
- package/lib/api/chain/instruction/memo/types.d.ts +21 -0
- package/lib/api/chain/instruction/memo/types.d.ts.map +1 -0
- package/lib/api/chain/instruction/memo/types.js +16 -0
- package/lib/api/chain/instruction/memo/types.js.map +1 -0
- package/lib/api/chain/instruction/stake/index.d.ts +15 -0
- package/lib/api/chain/instruction/stake/index.d.ts.map +1 -0
- package/lib/api/chain/instruction/stake/index.js +20 -0
- package/lib/api/chain/instruction/stake/index.js.map +1 -0
- package/lib/api/chain/instruction/stake/types.d.ts +215 -0
- package/lib/api/chain/instruction/stake/types.d.ts.map +1 -0
- package/lib/api/chain/instruction/stake/types.js +80 -0
- package/lib/api/chain/instruction/stake/types.js.map +1 -0
- package/lib/api/chain/instruction/system/index.d.ts +15 -0
- package/lib/api/chain/instruction/system/index.d.ts.map +1 -0
- package/lib/api/chain/instruction/system/index.js +20 -0
- package/lib/api/chain/instruction/system/index.js.map +1 -0
- package/lib/api/chain/instruction/system/types.d.ts +298 -0
- package/lib/api/chain/instruction/system/types.d.ts.map +1 -0
- package/lib/api/chain/instruction/system/types.js +117 -0
- package/lib/api/chain/instruction/system/types.js.map +1 -0
- package/lib/api/chain/instruction/token/index.d.ts +15 -0
- package/lib/api/chain/instruction/token/index.d.ts.map +1 -0
- package/lib/api/chain/instruction/token/index.js +20 -0
- package/lib/api/chain/instruction/token/index.js.map +1 -0
- package/lib/api/chain/instruction/token/types.d.ts +497 -0
- package/lib/api/chain/instruction/token/types.d.ts.map +1 -0
- package/lib/api/chain/instruction/token/types.js +200 -0
- package/lib/api/chain/instruction/token/types.js.map +1 -0
- package/lib/api/chain/program/constants.d.ts +11 -0
- package/lib/api/chain/program/constants.d.ts.map +1 -0
- package/lib/api/chain/program/constants.js +14 -0
- package/lib/api/chain/program/constants.js.map +1 -0
- package/lib/api/chain/program/index.d.ts +2 -0
- package/lib/api/chain/program/index.d.ts.map +1 -0
- package/lib/api/chain/program/index.js +7 -0
- package/lib/api/chain/program/index.js.map +1 -0
- package/lib/api/chain/program/parser.d.ts +35 -0
- package/lib/api/chain/program/parser.d.ts.map +1 -0
- package/lib/api/chain/program/parser.js +66 -0
- package/lib/api/chain/program/parser.js.map +1 -0
- package/lib/api/chain/validators/bignum.d.ts +3 -0
- package/lib/api/chain/validators/bignum.d.ts.map +1 -0
- package/lib/api/chain/validators/bignum.js +11 -0
- package/lib/api/chain/validators/bignum.js.map +1 -0
- package/lib/api/chain/validators/index.d.ts +10 -0
- package/lib/api/chain/validators/index.d.ts.map +1 -0
- package/lib/api/chain/validators/index.js +10 -0
- package/lib/api/chain/validators/index.js.map +1 -0
- package/lib/api/chain/validators/pubkey.d.ts +3 -0
- package/lib/api/chain/validators/pubkey.d.ts.map +1 -0
- package/lib/api/chain/validators/pubkey.js +7 -0
- package/lib/api/chain/validators/pubkey.js.map +1 -0
- package/lib/api/chain/web3.d.ts +43 -0
- package/lib/api/chain/web3.d.ts.map +1 -0
- package/lib/api/chain/web3.js +272 -0
- package/lib/api/chain/web3.js.map +1 -0
- package/lib/api/index.d.ts +5 -0
- package/lib/api/index.d.ts.map +1 -0
- package/lib/api/index.js +25 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/logged.d.ts +3 -0
- package/lib/api/logged.d.ts.map +1 -0
- package/lib/api/logged.js +69 -0
- package/lib/api/logged.js.map +1 -0
- package/lib/api/queued.d.ts +3 -0
- package/lib/api/queued.d.ts.map +1 -0
- package/lib/api/queued.js +27 -0
- package/lib/api/queued.js.map +1 -0
- package/lib/api/traced.d.ts +3 -0
- package/lib/api/traced.d.ts.map +1 -0
- package/lib/api/traced.js +80 -0
- package/lib/api/traced.js.map +1 -0
- package/lib/bridge/bridge.d.ts +15 -0
- package/lib/bridge/bridge.d.ts.map +1 -0
- package/lib/bridge/bridge.js +134 -0
- package/lib/bridge/bridge.js.map +1 -0
- package/lib/bridge/js.d.ts +7 -0
- package/lib/bridge/js.d.ts.map +1 -0
- package/lib/bridge/js.js +28 -0
- package/lib/bridge/js.js.map +1 -0
- package/lib/bridge.integration.test.d.ts +4 -0
- package/lib/bridge.integration.test.d.ts.map +1 -0
- package/lib/bridge.integration.test.js +988 -0
- package/lib/bridge.integration.test.js.map +1 -0
- package/lib/broadcast.d.ts +7 -0
- package/lib/broadcast.d.ts.map +1 -0
- package/lib/broadcast.js +37 -0
- package/lib/broadcast.js.map +1 -0
- package/lib/buildTransaction.d.ts +5 -0
- package/lib/buildTransaction.d.ts.map +1 -0
- package/lib/buildTransaction.js +67 -0
- package/lib/buildTransaction.js.map +1 -0
- package/lib/cli-transaction.d.ts +19 -0
- package/lib/cli-transaction.d.ts.map +1 -0
- package/lib/cli-transaction.js +196 -0
- package/lib/cli-transaction.js.map +1 -0
- package/lib/createTransaction.d.ts +5 -0
- package/lib/createTransaction.d.ts.map +1 -0
- package/lib/createTransaction.js +19 -0
- package/lib/createTransaction.js.map +1 -0
- package/lib/datasets/solana.scanAccounts.1.d.ts +6 -0
- package/lib/datasets/solana.scanAccounts.1.d.ts.map +1 -0
- package/lib/datasets/solana.scanAccounts.1.js +12 -0
- package/lib/datasets/solana.scanAccounts.1.js.map +1 -0
- package/lib/deviceTransactionConfig.d.ts +10 -0
- package/lib/deviceTransactionConfig.d.ts.map +1 -0
- package/lib/deviceTransactionConfig.js +228 -0
- package/lib/deviceTransactionConfig.js.map +1 -0
- package/lib/errors.d.ts +61 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +25 -0
- package/lib/errors.js.map +1 -0
- package/lib/estimateMaxSpendable.d.ts +11 -0
- package/lib/estimateMaxSpendable.d.ts.map +1 -0
- package/lib/estimateMaxSpendable.js +63 -0
- package/lib/estimateMaxSpendable.js.map +1 -0
- package/lib/getTransactionStatus.d.ts +5 -0
- package/lib/getTransactionStatus.d.ts.map +1 -0
- package/lib/getTransactionStatus.js +73 -0
- package/lib/getTransactionStatus.js.map +1 -0
- package/lib/hw-getAddress.d.ts +6 -0
- package/lib/hw-getAddress.d.ts.map +1 -0
- package/lib/hw-getAddress.js +28 -0
- package/lib/hw-getAddress.js.map +1 -0
- package/lib/logic.d.ts +29 -0
- package/lib/logic.d.ts.map +1 -0
- package/lib/logic.js +102 -0
- package/lib/logic.js.map +1 -0
- package/lib/preload-data.d.ts +7 -0
- package/lib/preload-data.d.ts.map +1 -0
- package/lib/preload-data.js +45 -0
- package/lib/preload-data.js.map +1 -0
- package/lib/preload.d.ts +7 -0
- package/lib/preload.d.ts.map +1 -0
- package/lib/preload.js +67 -0
- package/lib/preload.js.map +1 -0
- package/lib/preload.test.d.ts +2 -0
- package/lib/preload.test.d.ts.map +1 -0
- package/lib/preload.test.js +9 -0
- package/lib/preload.test.js.map +1 -0
- package/lib/prepareTransaction.d.ts +5 -0
- package/lib/prepareTransaction.d.ts.map +1 -0
- package/lib/prepareTransaction.js +500 -0
- package/lib/prepareTransaction.js.map +1 -0
- package/lib/serialization.d.ts +9 -0
- package/lib/serialization.d.ts.map +1 -0
- package/lib/serialization.js +69 -0
- package/lib/serialization.js.map +1 -0
- package/lib/signOperation.d.ts +7 -0
- package/lib/signOperation.d.ts.map +1 -0
- package/lib/signOperation.js +153 -0
- package/lib/signOperation.js.map +1 -0
- package/lib/signer.d.ts +11 -0
- package/lib/signer.d.ts.map +1 -0
- package/lib/signer.js +3 -0
- package/lib/signer.js.map +1 -0
- package/lib/specs.d.ts +7 -0
- package/lib/specs.d.ts.map +1 -0
- package/lib/specs.js +409 -0
- package/lib/specs.js.map +1 -0
- package/lib/speculos-deviceActions.d.ts +8 -0
- package/lib/speculos-deviceActions.d.ts.map +1 -0
- package/lib/speculos-deviceActions.js +217 -0
- package/lib/speculos-deviceActions.js.map +1 -0
- package/lib/synchronization.d.ts +5 -0
- package/lib/synchronization.d.ts.map +1 -0
- package/lib/synchronization.js +463 -0
- package/lib/synchronization.js.map +1 -0
- package/lib/transaction.d.ts +15 -0
- package/lib/transaction.d.ts.map +1 -0
- package/lib/transaction.js +154 -0
- package/lib/transaction.js.map +1 -0
- package/lib/tx-fees.d.ts +4 -0
- package/lib/tx-fees.d.ts.map +1 -0
- package/lib/tx-fees.js +167 -0
- package/lib/tx-fees.js.map +1 -0
- package/lib/types.d.ts +225 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/utils.d.ts +24 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +172 -0
- package/lib/utils.js.map +1 -0
- package/lib/validator-app/index.d.ts +22 -0
- package/lib/validator-app/index.d.ts.map +1 -0
- package/lib/validator-app/index.js +62 -0
- package/lib/validator-app/index.js.map +1 -0
- package/lib-es/api/cached.d.ts +3 -0
- package/lib-es/api/cached.d.ts.map +1 -0
- package/lib-es/api/cached.js +34 -0
- package/lib-es/api/cached.js.map +1 -0
- package/lib-es/api/chain/account/index.d.ts +2 -0
- package/lib-es/api/chain/account/index.d.ts.map +1 -0
- package/lib-es/api/chain/account/index.js +2 -0
- package/lib-es/api/chain/account/index.js.map +1 -0
- package/lib-es/api/chain/account/parser.d.ts +10 -0
- package/lib-es/api/chain/account/parser.d.ts.map +1 -0
- package/lib-es/api/chain/account/parser.js +48 -0
- package/lib-es/api/chain/account/parser.js.map +1 -0
- package/lib-es/api/chain/account/stake.d.ts +237 -0
- package/lib-es/api/chain/account/stake.d.ts.map +1 -0
- package/lib-es/api/chain/account/stake.js +35 -0
- package/lib-es/api/chain/account/stake.js.map +1 -0
- package/lib-es/api/chain/account/token.d.ts +116 -0
- package/lib-es/api/chain/account/token.d.ts.map +1 -0
- package/lib-es/api/chain/account/token.js +39 -0
- package/lib-es/api/chain/account/token.js.map +1 -0
- package/lib-es/api/chain/account/vote.d.ts +252 -0
- package/lib-es/api/chain/account/vote.d.ts.map +1 -0
- package/lib-es/api/chain/account/vote.js +41 -0
- package/lib-es/api/chain/account/vote.js.map +1 -0
- package/lib-es/api/chain/index.d.ts +29 -0
- package/lib-es/api/chain/index.d.ts.map +1 -0
- package/lib-es/api/chain/index.js +92 -0
- package/lib-es/api/chain/index.js.map +1 -0
- package/lib-es/api/chain/instruction/associated-token-account/index.d.ts +15 -0
- package/lib-es/api/chain/instruction/associated-token-account/index.d.ts.map +1 -0
- package/lib-es/api/chain/instruction/associated-token-account/index.js +17 -0
- package/lib-es/api/chain/instruction/associated-token-account/index.js.map +1 -0
- package/lib-es/api/chain/instruction/associated-token-account/types.d.ts +30 -0
- package/lib-es/api/chain/instruction/associated-token-account/types.d.ts.map +1 -0
- package/lib-es/api/chain/instruction/associated-token-account/types.js +16 -0
- package/lib-es/api/chain/instruction/associated-token-account/types.js.map +1 -0
- package/lib-es/api/chain/instruction/memo/index.d.ts +15 -0
- package/lib-es/api/chain/instruction/memo/index.d.ts.map +1 -0
- package/lib-es/api/chain/instruction/memo/index.js +10 -0
- package/lib-es/api/chain/instruction/memo/index.js.map +1 -0
- package/lib-es/api/chain/instruction/memo/types.d.ts +21 -0
- package/lib-es/api/chain/instruction/memo/types.d.ts.map +1 -0
- package/lib-es/api/chain/instruction/memo/types.js +13 -0
- package/lib-es/api/chain/instruction/memo/types.js.map +1 -0
- package/lib-es/api/chain/instruction/stake/index.d.ts +15 -0
- package/lib-es/api/chain/instruction/stake/index.d.ts.map +1 -0
- package/lib-es/api/chain/instruction/stake/index.js +16 -0
- package/lib-es/api/chain/instruction/stake/index.js.map +1 -0
- package/lib-es/api/chain/instruction/stake/types.d.ts +215 -0
- package/lib-es/api/chain/instruction/stake/types.d.ts.map +1 -0
- package/lib-es/api/chain/instruction/stake/types.js +77 -0
- package/lib-es/api/chain/instruction/stake/types.js.map +1 -0
- package/lib-es/api/chain/instruction/system/index.d.ts +15 -0
- package/lib-es/api/chain/instruction/system/index.d.ts.map +1 -0
- package/lib-es/api/chain/instruction/system/index.js +16 -0
- package/lib-es/api/chain/instruction/system/index.js.map +1 -0
- package/lib-es/api/chain/instruction/system/types.d.ts +298 -0
- package/lib-es/api/chain/instruction/system/types.d.ts.map +1 -0
- package/lib-es/api/chain/instruction/system/types.js +114 -0
- package/lib-es/api/chain/instruction/system/types.js.map +1 -0
- package/lib-es/api/chain/instruction/token/index.d.ts +15 -0
- package/lib-es/api/chain/instruction/token/index.d.ts.map +1 -0
- package/lib-es/api/chain/instruction/token/index.js +16 -0
- package/lib-es/api/chain/instruction/token/index.js.map +1 -0
- package/lib-es/api/chain/instruction/token/types.d.ts +497 -0
- package/lib-es/api/chain/instruction/token/types.d.ts.map +1 -0
- package/lib-es/api/chain/instruction/token/types.js +197 -0
- package/lib-es/api/chain/instruction/token/types.js.map +1 -0
- package/lib-es/api/chain/program/constants.d.ts +11 -0
- package/lib-es/api/chain/program/constants.d.ts.map +1 -0
- package/lib-es/api/chain/program/constants.js +11 -0
- package/lib-es/api/chain/program/constants.js.map +1 -0
- package/lib-es/api/chain/program/index.d.ts +2 -0
- package/lib-es/api/chain/program/index.d.ts.map +1 -0
- package/lib-es/api/chain/program/index.js +2 -0
- package/lib-es/api/chain/program/index.js.map +1 -0
- package/lib-es/api/chain/program/parser.d.ts +35 -0
- package/lib-es/api/chain/program/parser.d.ts.map +1 -0
- package/lib-es/api/chain/program/parser.js +61 -0
- package/lib-es/api/chain/program/parser.js.map +1 -0
- package/lib-es/api/chain/validators/bignum.d.ts +3 -0
- package/lib-es/api/chain/validators/bignum.d.ts.map +1 -0
- package/lib-es/api/chain/validators/bignum.js +8 -0
- package/lib-es/api/chain/validators/bignum.js.map +1 -0
- package/lib-es/api/chain/validators/index.d.ts +10 -0
- package/lib-es/api/chain/validators/index.d.ts.map +1 -0
- package/lib-es/api/chain/validators/index.js +7 -0
- package/lib-es/api/chain/validators/index.js.map +1 -0
- package/lib-es/api/chain/validators/pubkey.d.ts +3 -0
- package/lib-es/api/chain/validators/pubkey.d.ts.map +1 -0
- package/lib-es/api/chain/validators/pubkey.js +4 -0
- package/lib-es/api/chain/validators/pubkey.js.map +1 -0
- package/lib-es/api/chain/web3.d.ts +43 -0
- package/lib-es/api/chain/web3.d.ts.map +1 -0
- package/lib-es/api/chain/web3.js +249 -0
- package/lib-es/api/chain/web3.js.map +1 -0
- package/lib-es/api/index.d.ts +5 -0
- package/lib-es/api/index.d.ts.map +1 -0
- package/lib-es/api/index.js +5 -0
- package/lib-es/api/index.js.map +1 -0
- package/lib-es/api/logged.d.ts +3 -0
- package/lib-es/api/logged.d.ts.map +1 -0
- package/lib-es/api/logged.js +65 -0
- package/lib-es/api/logged.js.map +1 -0
- package/lib-es/api/queued.d.ts +3 -0
- package/lib-es/api/queued.d.ts.map +1 -0
- package/lib-es/api/queued.js +23 -0
- package/lib-es/api/queued.js.map +1 -0
- package/lib-es/api/traced.d.ts +3 -0
- package/lib-es/api/traced.d.ts.map +1 -0
- package/lib-es/api/traced.js +76 -0
- package/lib-es/api/traced.js.map +1 -0
- package/lib-es/bridge/bridge.d.ts +15 -0
- package/lib-es/bridge/bridge.d.ts.map +1 -0
- package/lib-es/bridge/bridge.js +127 -0
- package/lib-es/bridge/bridge.js.map +1 -0
- package/lib-es/bridge/js.d.ts +7 -0
- package/lib-es/bridge/js.d.ts.map +1 -0
- package/lib-es/bridge/js.js +24 -0
- package/lib-es/bridge/js.js.map +1 -0
- package/lib-es/bridge.integration.test.d.ts +4 -0
- package/lib-es/bridge.integration.test.d.ts.map +1 -0
- package/lib-es/bridge.integration.test.js +986 -0
- package/lib-es/bridge.integration.test.js.map +1 -0
- package/lib-es/broadcast.d.ts +7 -0
- package/lib-es/broadcast.d.ts.map +1 -0
- package/lib-es/broadcast.js +33 -0
- package/lib-es/broadcast.js.map +1 -0
- package/lib-es/buildTransaction.d.ts +5 -0
- package/lib-es/buildTransaction.d.ts.map +1 -0
- package/lib-es/buildTransaction.js +63 -0
- package/lib-es/buildTransaction.js.map +1 -0
- package/lib-es/cli-transaction.d.ts +19 -0
- package/lib-es/cli-transaction.d.ts.map +1 -0
- package/lib-es/cli-transaction.js +190 -0
- package/lib-es/cli-transaction.js.map +1 -0
- package/lib-es/createTransaction.d.ts +5 -0
- package/lib-es/createTransaction.d.ts.map +1 -0
- package/lib-es/createTransaction.js +15 -0
- package/lib-es/createTransaction.js.map +1 -0
- package/lib-es/datasets/solana.scanAccounts.1.d.ts +6 -0
- package/lib-es/datasets/solana.scanAccounts.1.d.ts.map +1 -0
- package/lib-es/datasets/solana.scanAccounts.1.js +10 -0
- package/lib-es/datasets/solana.scanAccounts.1.js.map +1 -0
- package/lib-es/deviceTransactionConfig.d.ts +10 -0
- package/lib-es/deviceTransactionConfig.d.ts.map +1 -0
- package/lib-es/deviceTransactionConfig.js +223 -0
- package/lib-es/deviceTransactionConfig.js.map +1 -0
- package/lib-es/errors.d.ts +61 -0
- package/lib-es/errors.d.ts.map +1 -0
- package/lib-es/errors.js +22 -0
- package/lib-es/errors.js.map +1 -0
- package/lib-es/estimateMaxSpendable.d.ts +11 -0
- package/lib-es/estimateMaxSpendable.d.ts.map +1 -0
- package/lib-es/estimateMaxSpendable.js +55 -0
- package/lib-es/estimateMaxSpendable.js.map +1 -0
- package/lib-es/getTransactionStatus.d.ts +5 -0
- package/lib-es/getTransactionStatus.d.ts.map +1 -0
- package/lib-es/getTransactionStatus.js +69 -0
- package/lib-es/getTransactionStatus.js.map +1 -0
- package/lib-es/hw-getAddress.d.ts +6 -0
- package/lib-es/hw-getAddress.d.ts.map +1 -0
- package/lib-es/hw-getAddress.js +23 -0
- package/lib-es/hw-getAddress.js.map +1 -0
- package/lib-es/logic.d.ts +29 -0
- package/lib-es/logic.d.ts.map +1 -0
- package/lib-es/logic.js +87 -0
- package/lib-es/logic.js.map +1 -0
- package/lib-es/preload-data.d.ts +7 -0
- package/lib-es/preload-data.d.ts.map +1 -0
- package/lib-es/preload-data.js +39 -0
- package/lib-es/preload-data.js.map +1 -0
- package/lib-es/preload.d.ts +7 -0
- package/lib-es/preload.d.ts.map +1 -0
- package/lib-es/preload.js +62 -0
- package/lib-es/preload.js.map +1 -0
- package/lib-es/preload.test.d.ts +2 -0
- package/lib-es/preload.test.d.ts.map +1 -0
- package/lib-es/preload.test.js +7 -0
- package/lib-es/preload.test.js.map +1 -0
- package/lib-es/prepareTransaction.d.ts +5 -0
- package/lib-es/prepareTransaction.d.ts.map +1 -0
- package/lib-es/prepareTransaction.js +497 -0
- package/lib-es/prepareTransaction.js.map +1 -0
- package/lib-es/serialization.d.ts +9 -0
- package/lib-es/serialization.d.ts.map +1 -0
- package/lib-es/serialization.js +60 -0
- package/lib-es/serialization.js.map +1 -0
- package/lib-es/signOperation.d.ts +7 -0
- package/lib-es/signOperation.d.ts.map +1 -0
- package/lib-es/signOperation.js +146 -0
- package/lib-es/signOperation.js.map +1 -0
- package/lib-es/signer.d.ts +11 -0
- package/lib-es/signer.d.ts.map +1 -0
- package/lib-es/signer.js +2 -0
- package/lib-es/signer.js.map +1 -0
- package/lib-es/specs.d.ts +7 -0
- package/lib-es/specs.d.ts.map +1 -0
- package/lib-es/specs.js +404 -0
- package/lib-es/specs.js.map +1 -0
- package/lib-es/speculos-deviceActions.d.ts +8 -0
- package/lib-es/speculos-deviceActions.d.ts.map +1 -0
- package/lib-es/speculos-deviceActions.js +211 -0
- package/lib-es/speculos-deviceActions.js.map +1 -0
- package/lib-es/synchronization.d.ts +5 -0
- package/lib-es/synchronization.d.ts.map +1 -0
- package/lib-es/synchronization.js +456 -0
- package/lib-es/synchronization.js.map +1 -0
- package/lib-es/transaction.d.ts +15 -0
- package/lib-es/transaction.d.ts.map +1 -0
- package/lib-es/transaction.js +148 -0
- package/lib-es/transaction.js.map +1 -0
- package/lib-es/tx-fees.d.ts +4 -0
- package/lib-es/tx-fees.d.ts.map +1 -0
- package/lib-es/tx-fees.js +160 -0
- package/lib-es/tx-fees.js.map +1 -0
- package/lib-es/types.d.ts +225 -0
- package/lib-es/types.d.ts.map +1 -0
- package/lib-es/types.js +2 -0
- package/lib-es/types.js.map +1 -0
- package/lib-es/utils.d.ts +24 -0
- package/lib-es/utils.d.ts.map +1 -0
- package/lib-es/utils.js +157 -0
- package/lib-es/utils.js.map +1 -0
- package/lib-es/validator-app/index.d.ts +22 -0
- package/lib-es/validator-app/index.d.ts.map +1 -0
- package/lib-es/validator-app/index.js +55 -0
- package/lib-es/validator-app/index.js.map +1 -0
- package/package.json +90 -0
- package/src/api/cached.ts +79 -0
- package/src/api/chain/account/index.ts +1 -0
- package/src/api/chain/account/parser.ts +63 -0
- package/src/api/chain/account/stake.ts +45 -0
- package/src/api/chain/account/token.ts +63 -0
- package/src/api/chain/account/vote.ts +55 -0
- package/src/api/chain/index.ts +212 -0
- package/src/api/chain/instruction/associated-token-account/index.ts +33 -0
- package/src/api/chain/instruction/associated-token-account/types.ts +23 -0
- package/src/api/chain/instruction/memo/index.ts +24 -0
- package/src/api/chain/instruction/memo/types.ts +18 -0
- package/src/api/chain/instruction/stake/index.ts +29 -0
- package/src/api/chain/instruction/stake/types.ts +95 -0
- package/src/api/chain/instruction/system/index.ts +30 -0
- package/src/api/chain/instruction/system/types.ts +141 -0
- package/src/api/chain/instruction/token/index.ts +30 -0
- package/src/api/chain/instruction/token/types.ts +222 -0
- package/src/api/chain/program/constants.ts +10 -0
- package/src/api/chain/program/index.ts +1 -0
- package/src/api/chain/program/parser.ts +120 -0
- package/src/api/chain/validators/bignum.ts +7 -0
- package/src/api/chain/validators/index.ts +9 -0
- package/src/api/chain/validators/pubkey.ts +8 -0
- package/src/api/chain/web3.ts +399 -0
- package/src/api/index.ts +4 -0
- package/src/api/logged.ts +70 -0
- package/src/api/queued.ts +25 -0
- package/src/api/traced.ts +89 -0
- package/src/bridge/bridge.ts +192 -0
- package/src/bridge/js.ts +42 -0
- package/src/bridge.integration.test.ts +1104 -0
- package/src/broadcast.ts +38 -0
- package/src/buildTransaction.ts +81 -0
- package/src/cli-transaction.ts +246 -0
- package/src/createTransaction.ts +18 -0
- package/src/datasets/solana.scanAccounts.1.ts +9 -0
- package/src/deviceTransactionConfig.ts +302 -0
- package/src/errors.ts +61 -0
- package/src/estimateMaxSpendable.ts +72 -0
- package/src/getTransactionStatus.ts +79 -0
- package/src/hw-getAddress.ts +22 -0
- package/src/logic.ts +123 -0
- package/src/preload-data.ts +46 -0
- package/src/preload.test.ts +14 -0
- package/src/preload.ts +74 -0
- package/src/prepareTransaction.ts +686 -0
- package/src/serialization.ts +81 -0
- package/src/signOperation.ts +315 -0
- package/src/signer.ts +10 -0
- package/src/specs.ts +514 -0
- package/src/speculos-deviceActions.ts +229 -0
- package/src/synchronization.ts +729 -0
- package/src/transaction.ts +199 -0
- package/src/tx-fees.ts +206 -0
- package/src/types.ts +291 -0
- package/src/utils.ts +176 -0
- package/src/validator-app/index.ts +79 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ParsedInfo } from "../../validators";
|
|
2
|
+
import { create, Infer } from "superstruct";
|
|
3
|
+
import { ParsedInstruction } from "@solana/web3.js";
|
|
4
|
+
import { AssociatedTokenAccountInstructionType, IX_STRUCTS, IX_TITLES } from "./types";
|
|
5
|
+
|
|
6
|
+
import { PARSED_PROGRAMS } from "../../program/constants";
|
|
7
|
+
|
|
8
|
+
export function parseAssociatedTokenAccountInstruction(
|
|
9
|
+
ix: ParsedInstruction & {
|
|
10
|
+
program: typeof PARSED_PROGRAMS.SPL_ASSOCIATED_TOKEN_ACCOUNT;
|
|
11
|
+
},
|
|
12
|
+
): AssociatedTokenAccountInstructionDescriptor {
|
|
13
|
+
// TODO: check this
|
|
14
|
+
const parsed = create(ix.parsed, ParsedInfo);
|
|
15
|
+
//const { type: rawType, info } = parsed;
|
|
16
|
+
const type: AssociatedTokenAccountInstructionType = "associate";
|
|
17
|
+
const title = IX_TITLES[type];
|
|
18
|
+
const struct = IX_STRUCTS[type];
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
type: "associate",
|
|
22
|
+
title: title,
|
|
23
|
+
info: create(parsed.info, struct as any) as any,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type AssociatedTokenAccountInstructionDescriptor = {
|
|
28
|
+
[K in AssociatedTokenAccountInstructionType]: {
|
|
29
|
+
title: (typeof IX_TITLES)[K];
|
|
30
|
+
type: K;
|
|
31
|
+
info: Infer<(typeof IX_STRUCTS)[K]>;
|
|
32
|
+
};
|
|
33
|
+
}[AssociatedTokenAccountInstructionType];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { enums, type, Infer } from "superstruct";
|
|
2
|
+
import { PublicKeyFromString } from "../../validators/pubkey";
|
|
3
|
+
|
|
4
|
+
type AssociateInfo = Infer<typeof AssociateInfo>;
|
|
5
|
+
export const AssociateInfo = type({
|
|
6
|
+
account: PublicKeyFromString,
|
|
7
|
+
mint: PublicKeyFromString,
|
|
8
|
+
wallet: PublicKeyFromString,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type AssociatedTokenAccountInstructionType = Infer<
|
|
12
|
+
typeof AssociatedTokenAccountInstructionType
|
|
13
|
+
>;
|
|
14
|
+
// not a real instruction type, added for structure
|
|
15
|
+
export const AssociatedTokenAccountInstructionType = enums(["associate"]);
|
|
16
|
+
|
|
17
|
+
export const IX_STRUCTS = {
|
|
18
|
+
associate: AssociateInfo,
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
export const IX_TITLES = {
|
|
22
|
+
associate: "Associate",
|
|
23
|
+
} as const;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ParsedInstruction } from "@solana/web3.js";
|
|
2
|
+
import { IX_STRUCTS, IX_TITLES, MemoInstructionType } from "./types";
|
|
3
|
+
import { Infer } from "superstruct";
|
|
4
|
+
import { PARSED_PROGRAMS } from "../../program/constants";
|
|
5
|
+
|
|
6
|
+
export function parseSplMemoInstruction(
|
|
7
|
+
ix: ParsedInstruction & { program: typeof PARSED_PROGRAMS.SPL_MEMO },
|
|
8
|
+
): MemoInstructionDescriptor {
|
|
9
|
+
return {
|
|
10
|
+
title: "Save",
|
|
11
|
+
type: "save",
|
|
12
|
+
info: {
|
|
13
|
+
data: ix.parsed,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type MemoInstructionDescriptor = {
|
|
19
|
+
[K in MemoInstructionType]: {
|
|
20
|
+
title: (typeof IX_TITLES)[K];
|
|
21
|
+
type: K;
|
|
22
|
+
info: Infer<(typeof IX_STRUCTS)[K]>;
|
|
23
|
+
};
|
|
24
|
+
}[MemoInstructionType];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { enums, type, string, Infer } from "superstruct";
|
|
2
|
+
|
|
3
|
+
type SaveInfo = Infer<typeof SaveInfo>;
|
|
4
|
+
export const SaveInfo = type({
|
|
5
|
+
data: string(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export type MemoInstructionType = Infer<typeof MemoInstructionType>;
|
|
9
|
+
// not a real instruction type, added for structure
|
|
10
|
+
export const MemoInstructionType = enums(["save"]);
|
|
11
|
+
|
|
12
|
+
export const IX_STRUCTS = {
|
|
13
|
+
save: SaveInfo,
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export const IX_TITLES = {
|
|
17
|
+
save: "Save",
|
|
18
|
+
} as const;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ParsedInfo } from "../../validators";
|
|
2
|
+
import { create, Infer } from "superstruct";
|
|
3
|
+
import { ParsedInstruction } from "@solana/web3.js";
|
|
4
|
+
import { StakeInstructionType, IX_STRUCTS, IX_TITLES } from "./types";
|
|
5
|
+
import { PARSED_PROGRAMS } from "../../program/constants";
|
|
6
|
+
|
|
7
|
+
export function parseStakeInstruction(
|
|
8
|
+
ix: ParsedInstruction & { program: typeof PARSED_PROGRAMS.STAKE },
|
|
9
|
+
): StakeInstructionDescriptor {
|
|
10
|
+
const parsed = create(ix.parsed, ParsedInfo);
|
|
11
|
+
const { type: rawType, info } = parsed;
|
|
12
|
+
const type = create(rawType, StakeInstructionType);
|
|
13
|
+
const title = IX_TITLES[type];
|
|
14
|
+
const struct = IX_STRUCTS[type];
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
type,
|
|
18
|
+
title: title as any,
|
|
19
|
+
info: create(info, struct as any) as any,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type StakeInstructionDescriptor = {
|
|
24
|
+
[K in StakeInstructionType]: {
|
|
25
|
+
title: (typeof IX_TITLES)[K];
|
|
26
|
+
type: K;
|
|
27
|
+
info: Infer<(typeof IX_STRUCTS)[K]>;
|
|
28
|
+
};
|
|
29
|
+
}[StakeInstructionType];
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-redeclare */
|
|
2
|
+
|
|
3
|
+
import { enums, number, type, string, Infer } from "superstruct";
|
|
4
|
+
import { PublicKeyFromString } from "../../validators/pubkey";
|
|
5
|
+
|
|
6
|
+
export type InitializeInfo = Infer<typeof InitializeInfo>;
|
|
7
|
+
export const InitializeInfo = type({
|
|
8
|
+
stakeAccount: PublicKeyFromString,
|
|
9
|
+
authorized: type({
|
|
10
|
+
staker: PublicKeyFromString,
|
|
11
|
+
withdrawer: PublicKeyFromString,
|
|
12
|
+
}),
|
|
13
|
+
lockup: type({
|
|
14
|
+
unixTimestamp: number(),
|
|
15
|
+
epoch: number(),
|
|
16
|
+
custodian: PublicKeyFromString,
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type DelegateInfo = Infer<typeof DelegateInfo>;
|
|
21
|
+
export const DelegateInfo = type({
|
|
22
|
+
stakeAccount: PublicKeyFromString,
|
|
23
|
+
voteAccount: PublicKeyFromString,
|
|
24
|
+
stakeAuthority: PublicKeyFromString,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type AuthorizeInfo = Infer<typeof AuthorizeInfo>;
|
|
28
|
+
export const AuthorizeInfo = type({
|
|
29
|
+
authorityType: string(),
|
|
30
|
+
stakeAccount: PublicKeyFromString,
|
|
31
|
+
authority: PublicKeyFromString,
|
|
32
|
+
newAuthority: PublicKeyFromString,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type SplitInfo = Infer<typeof SplitInfo>;
|
|
36
|
+
export const SplitInfo = type({
|
|
37
|
+
stakeAccount: PublicKeyFromString,
|
|
38
|
+
stakeAuthority: PublicKeyFromString,
|
|
39
|
+
newSplitAccount: PublicKeyFromString,
|
|
40
|
+
lamports: number(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export type WithdrawInfo = Infer<typeof WithdrawInfo>;
|
|
44
|
+
export const WithdrawInfo = type({
|
|
45
|
+
stakeAccount: PublicKeyFromString,
|
|
46
|
+
withdrawAuthority: PublicKeyFromString,
|
|
47
|
+
destination: PublicKeyFromString,
|
|
48
|
+
lamports: number(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export type DeactivateInfo = Infer<typeof DeactivateInfo>;
|
|
52
|
+
export const DeactivateInfo = type({
|
|
53
|
+
stakeAccount: PublicKeyFromString,
|
|
54
|
+
stakeAuthority: PublicKeyFromString,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export type MergeInfo = Infer<typeof MergeInfo>;
|
|
58
|
+
export const MergeInfo = type({
|
|
59
|
+
source: PublicKeyFromString,
|
|
60
|
+
destination: PublicKeyFromString,
|
|
61
|
+
stakeAuthority: PublicKeyFromString,
|
|
62
|
+
stakeHistorySysvar: PublicKeyFromString,
|
|
63
|
+
clockSysvar: PublicKeyFromString,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export type StakeInstructionType = Infer<typeof StakeInstructionType>;
|
|
67
|
+
export const StakeInstructionType = enums([
|
|
68
|
+
"initialize",
|
|
69
|
+
"delegate",
|
|
70
|
+
"authorize",
|
|
71
|
+
"split",
|
|
72
|
+
"withdraw",
|
|
73
|
+
"deactivate",
|
|
74
|
+
"merge",
|
|
75
|
+
]);
|
|
76
|
+
|
|
77
|
+
export const IX_STRUCTS = {
|
|
78
|
+
initialize: InitializeInfo,
|
|
79
|
+
delegate: DelegateInfo,
|
|
80
|
+
authorize: AuthorizeInfo,
|
|
81
|
+
split: SplitInfo,
|
|
82
|
+
withdraw: WithdrawInfo,
|
|
83
|
+
deactivate: DeactivateInfo,
|
|
84
|
+
merge: MergeInfo,
|
|
85
|
+
} as const;
|
|
86
|
+
|
|
87
|
+
export const IX_TITLES = {
|
|
88
|
+
initialize: "Initialize",
|
|
89
|
+
delegate: "Delegate",
|
|
90
|
+
authorize: "Authorize",
|
|
91
|
+
split: "Split",
|
|
92
|
+
withdraw: "Withdraw",
|
|
93
|
+
deactivate: "Deactive",
|
|
94
|
+
merge: "Merge",
|
|
95
|
+
} as const;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ParsedInstruction } from "@solana/web3.js";
|
|
2
|
+
import { IX_STRUCTS, IX_TITLES, SystemInstructionType } from "./types";
|
|
3
|
+
|
|
4
|
+
import { ParsedInfo } from "../../validators";
|
|
5
|
+
import { create, Infer } from "superstruct";
|
|
6
|
+
import { PARSED_PROGRAMS } from "../../program/constants";
|
|
7
|
+
|
|
8
|
+
export function parseSystemInstruction(
|
|
9
|
+
ix: ParsedInstruction & { program: typeof PARSED_PROGRAMS.SYSTEM },
|
|
10
|
+
): SystemInstructionDescriptor {
|
|
11
|
+
const parsed = create(ix.parsed, ParsedInfo);
|
|
12
|
+
const { type: rawType, info } = parsed;
|
|
13
|
+
const type = create(rawType, SystemInstructionType);
|
|
14
|
+
const title = IX_TITLES[type];
|
|
15
|
+
const struct = IX_STRUCTS[type];
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
type,
|
|
19
|
+
title: title as any,
|
|
20
|
+
info: create(info, struct as any) as any,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type SystemInstructionDescriptor = {
|
|
25
|
+
[K in SystemInstructionType]: {
|
|
26
|
+
title: (typeof IX_TITLES)[K];
|
|
27
|
+
type: K;
|
|
28
|
+
info: Infer<(typeof IX_STRUCTS)[K]>;
|
|
29
|
+
};
|
|
30
|
+
}[SystemInstructionType];
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { enums, number, type, string, Infer } from "superstruct";
|
|
2
|
+
import { PublicKeyFromString } from "../../validators/pubkey";
|
|
3
|
+
|
|
4
|
+
export type CreateAccountInfo = Infer<typeof CreateAccountInfo>;
|
|
5
|
+
export const CreateAccountInfo = type({
|
|
6
|
+
source: PublicKeyFromString,
|
|
7
|
+
newAccount: PublicKeyFromString,
|
|
8
|
+
lamports: number(),
|
|
9
|
+
space: number(),
|
|
10
|
+
owner: PublicKeyFromString,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type AssignInfo = Infer<typeof AssignInfo>;
|
|
14
|
+
export const AssignInfo = type({
|
|
15
|
+
account: PublicKeyFromString,
|
|
16
|
+
owner: PublicKeyFromString,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type TransferInfo = Infer<typeof TransferInfo>;
|
|
20
|
+
export const TransferInfo = type({
|
|
21
|
+
source: PublicKeyFromString,
|
|
22
|
+
destination: PublicKeyFromString,
|
|
23
|
+
lamports: number(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export type CreateAccountWithSeedInfo = Infer<typeof CreateAccountWithSeedInfo>;
|
|
27
|
+
export const CreateAccountWithSeedInfo = type({
|
|
28
|
+
source: PublicKeyFromString,
|
|
29
|
+
newAccount: PublicKeyFromString,
|
|
30
|
+
base: PublicKeyFromString,
|
|
31
|
+
seed: string(),
|
|
32
|
+
lamports: number(),
|
|
33
|
+
space: number(),
|
|
34
|
+
owner: PublicKeyFromString,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export type AdvanceNonceInfo = Infer<typeof AdvanceNonceInfo>;
|
|
38
|
+
export const AdvanceNonceInfo = type({
|
|
39
|
+
nonceAccount: PublicKeyFromString,
|
|
40
|
+
nonceAuthority: PublicKeyFromString,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export type WithdrawNonceInfo = Infer<typeof WithdrawNonceInfo>;
|
|
44
|
+
export const WithdrawNonceInfo = type({
|
|
45
|
+
nonceAccount: PublicKeyFromString,
|
|
46
|
+
destination: PublicKeyFromString,
|
|
47
|
+
nonceAuthority: PublicKeyFromString,
|
|
48
|
+
lamports: number(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export type InitializeNonceInfo = Infer<typeof InitializeNonceInfo>;
|
|
52
|
+
export const InitializeNonceInfo = type({
|
|
53
|
+
nonceAccount: PublicKeyFromString,
|
|
54
|
+
nonceAuthority: PublicKeyFromString,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export type AuthorizeNonceInfo = Infer<typeof AuthorizeNonceInfo>;
|
|
58
|
+
export const AuthorizeNonceInfo = type({
|
|
59
|
+
nonceAccount: PublicKeyFromString,
|
|
60
|
+
nonceAuthority: PublicKeyFromString,
|
|
61
|
+
newAuthorized: PublicKeyFromString,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export type AllocateInfo = Infer<typeof AllocateInfo>;
|
|
65
|
+
export const AllocateInfo = type({
|
|
66
|
+
account: PublicKeyFromString,
|
|
67
|
+
space: number(),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export type AllocateWithSeedInfo = Infer<typeof AllocateWithSeedInfo>;
|
|
71
|
+
export const AllocateWithSeedInfo = type({
|
|
72
|
+
account: PublicKeyFromString,
|
|
73
|
+
base: PublicKeyFromString,
|
|
74
|
+
seed: string(),
|
|
75
|
+
space: number(),
|
|
76
|
+
owner: PublicKeyFromString,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export type AssignWithSeedInfo = Infer<typeof AssignWithSeedInfo>;
|
|
80
|
+
export const AssignWithSeedInfo = type({
|
|
81
|
+
account: PublicKeyFromString,
|
|
82
|
+
base: PublicKeyFromString,
|
|
83
|
+
seed: string(),
|
|
84
|
+
owner: PublicKeyFromString,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export type TransferWithSeedInfo = Infer<typeof TransferWithSeedInfo>;
|
|
88
|
+
export const TransferWithSeedInfo = type({
|
|
89
|
+
source: PublicKeyFromString,
|
|
90
|
+
sourceBase: PublicKeyFromString,
|
|
91
|
+
destination: PublicKeyFromString,
|
|
92
|
+
lamports: number(),
|
|
93
|
+
sourceSeed: string(),
|
|
94
|
+
sourceOwner: PublicKeyFromString,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export type SystemInstructionType = Infer<typeof SystemInstructionType>;
|
|
98
|
+
export const SystemInstructionType = enums([
|
|
99
|
+
"createAccount",
|
|
100
|
+
"createAccountWithSeed",
|
|
101
|
+
"allocate",
|
|
102
|
+
"allocateWithSeed",
|
|
103
|
+
"assign",
|
|
104
|
+
"assignWithSeed",
|
|
105
|
+
"transfer",
|
|
106
|
+
"advanceNonce",
|
|
107
|
+
"withdrawNonce",
|
|
108
|
+
"authorizeNonce",
|
|
109
|
+
"initializeNonce",
|
|
110
|
+
"transferWithSeed",
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
export const IX_STRUCTS = {
|
|
114
|
+
createAccount: CreateAccountInfo,
|
|
115
|
+
createAccountWithSeed: CreateAccountWithSeedInfo,
|
|
116
|
+
allocate: AllocateInfo,
|
|
117
|
+
allocateWithSeed: AllocateWithSeedInfo,
|
|
118
|
+
assign: AssignInfo,
|
|
119
|
+
assignWithSeed: AssignWithSeedInfo,
|
|
120
|
+
transfer: TransferInfo,
|
|
121
|
+
advanceNonce: AdvanceNonceInfo,
|
|
122
|
+
withdrawNonce: WithdrawNonceInfo,
|
|
123
|
+
authorizeNonce: AuthorizeNonceInfo,
|
|
124
|
+
initializeNonce: InitializeNonceInfo,
|
|
125
|
+
transferWithSeed: TransferWithSeedInfo,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const IX_TITLES = {
|
|
129
|
+
createAccount: "Create Account",
|
|
130
|
+
createAccountWithSeed: "Create Account With Seed",
|
|
131
|
+
allocate: "Allocate",
|
|
132
|
+
allocateWithSeed: "Allocate With Seed",
|
|
133
|
+
assign: "Assign",
|
|
134
|
+
assignWithSeed: "Assign With Seed",
|
|
135
|
+
transfer: "Transfer",
|
|
136
|
+
advanceNonce: "Advance Nonce",
|
|
137
|
+
withdrawNonce: "Withdraw Nonce",
|
|
138
|
+
authorizeNonce: "Authorize Nonce",
|
|
139
|
+
initializeNonce: "Initialize Nonce",
|
|
140
|
+
transferWithSeed: "Transfer With Seed",
|
|
141
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ParsedInstruction } from "@solana/web3.js";
|
|
2
|
+
import { IX_STRUCTS, IX_TITLES, TokenInstructionType } from "./types";
|
|
3
|
+
|
|
4
|
+
import { ParsedInfo } from "../../validators";
|
|
5
|
+
import { create, Infer } from "superstruct";
|
|
6
|
+
import { PARSED_PROGRAMS } from "../../program/constants";
|
|
7
|
+
|
|
8
|
+
export function parseSplTokenInstruction(
|
|
9
|
+
ix: ParsedInstruction & { program: typeof PARSED_PROGRAMS.SPL_TOKEN },
|
|
10
|
+
): TokenInstructionDescriptor {
|
|
11
|
+
const parsed = create(ix.parsed, ParsedInfo);
|
|
12
|
+
const { type: rawType, info } = parsed;
|
|
13
|
+
const type = create(rawType, TokenInstructionType);
|
|
14
|
+
const title = IX_TITLES[type];
|
|
15
|
+
const struct = IX_STRUCTS[type];
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
type,
|
|
19
|
+
title: title as any,
|
|
20
|
+
info: create(info, struct as any) as any,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type TokenInstructionDescriptor = {
|
|
25
|
+
[K in TokenInstructionType]: {
|
|
26
|
+
title: (typeof IX_TITLES)[K];
|
|
27
|
+
type: K;
|
|
28
|
+
info: Infer<(typeof IX_STRUCTS)[K]>;
|
|
29
|
+
};
|
|
30
|
+
}[TokenInstructionType];
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-redeclare */
|
|
2
|
+
|
|
3
|
+
import { enums, type, Infer, number, string, optional, array, nullable, union } from "superstruct";
|
|
4
|
+
import { PublicKeyFromString } from "../../validators/pubkey";
|
|
5
|
+
|
|
6
|
+
export type TokenAmountUi = Infer<typeof TokenAmountUi>;
|
|
7
|
+
export const TokenAmountUi = type({
|
|
8
|
+
amount: string(),
|
|
9
|
+
decimals: number(),
|
|
10
|
+
uiAmountString: string(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const InitializeMint = type({
|
|
14
|
+
mint: PublicKeyFromString,
|
|
15
|
+
decimals: number(),
|
|
16
|
+
mintAuthority: PublicKeyFromString,
|
|
17
|
+
rentSysvar: PublicKeyFromString,
|
|
18
|
+
freezeAuthority: optional(PublicKeyFromString),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const InitializeAccount = type({
|
|
22
|
+
account: PublicKeyFromString,
|
|
23
|
+
mint: PublicKeyFromString,
|
|
24
|
+
owner: PublicKeyFromString,
|
|
25
|
+
rentSysvar: PublicKeyFromString,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const InitializeMultisig = type({
|
|
29
|
+
multisig: PublicKeyFromString,
|
|
30
|
+
rentSysvar: PublicKeyFromString,
|
|
31
|
+
signers: array(PublicKeyFromString),
|
|
32
|
+
m: number(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type Transfer = Infer<typeof Transfer>;
|
|
36
|
+
export const Transfer = type({
|
|
37
|
+
source: PublicKeyFromString,
|
|
38
|
+
destination: PublicKeyFromString,
|
|
39
|
+
amount: union([string(), number()]),
|
|
40
|
+
authority: optional(PublicKeyFromString),
|
|
41
|
+
multisigAuthority: optional(PublicKeyFromString),
|
|
42
|
+
signers: optional(array(PublicKeyFromString)),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const Approve = type({
|
|
46
|
+
source: PublicKeyFromString,
|
|
47
|
+
delegate: PublicKeyFromString,
|
|
48
|
+
amount: union([string(), number()]),
|
|
49
|
+
owner: optional(PublicKeyFromString),
|
|
50
|
+
multisigOwner: optional(PublicKeyFromString),
|
|
51
|
+
signers: optional(array(PublicKeyFromString)),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const Revoke = type({
|
|
55
|
+
source: PublicKeyFromString,
|
|
56
|
+
owner: optional(PublicKeyFromString),
|
|
57
|
+
multisigOwner: optional(PublicKeyFromString),
|
|
58
|
+
signers: optional(array(PublicKeyFromString)),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const AuthorityType = enums(["mintTokens", "freezeAccount", "accountOwner", "closeAccount"]);
|
|
62
|
+
|
|
63
|
+
const SetAuthority = type({
|
|
64
|
+
mint: optional(PublicKeyFromString),
|
|
65
|
+
account: optional(PublicKeyFromString),
|
|
66
|
+
authorityType: AuthorityType,
|
|
67
|
+
newAuthority: nullable(PublicKeyFromString),
|
|
68
|
+
authority: optional(PublicKeyFromString),
|
|
69
|
+
multisigAuthority: optional(PublicKeyFromString),
|
|
70
|
+
signers: optional(array(PublicKeyFromString)),
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const MintTo = type({
|
|
74
|
+
mint: PublicKeyFromString,
|
|
75
|
+
account: PublicKeyFromString,
|
|
76
|
+
amount: union([string(), number()]),
|
|
77
|
+
mintAuthority: optional(PublicKeyFromString),
|
|
78
|
+
multisigMintAuthority: optional(PublicKeyFromString),
|
|
79
|
+
signers: optional(array(PublicKeyFromString)),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const Burn = type({
|
|
83
|
+
account: PublicKeyFromString,
|
|
84
|
+
mint: PublicKeyFromString,
|
|
85
|
+
amount: union([string(), number()]),
|
|
86
|
+
authority: optional(PublicKeyFromString),
|
|
87
|
+
multisigAuthority: optional(PublicKeyFromString),
|
|
88
|
+
signers: optional(array(PublicKeyFromString)),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const CloseAccount = type({
|
|
92
|
+
account: PublicKeyFromString,
|
|
93
|
+
destination: PublicKeyFromString,
|
|
94
|
+
owner: optional(PublicKeyFromString),
|
|
95
|
+
multisigOwner: optional(PublicKeyFromString),
|
|
96
|
+
signers: optional(array(PublicKeyFromString)),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const FreezeAccount = type({
|
|
100
|
+
account: PublicKeyFromString,
|
|
101
|
+
mint: PublicKeyFromString,
|
|
102
|
+
freezeAuthority: optional(PublicKeyFromString),
|
|
103
|
+
multisigFreezeAuthority: optional(PublicKeyFromString),
|
|
104
|
+
signers: optional(array(PublicKeyFromString)),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const ThawAccount = type({
|
|
108
|
+
account: PublicKeyFromString,
|
|
109
|
+
mint: PublicKeyFromString,
|
|
110
|
+
freezeAuthority: optional(PublicKeyFromString),
|
|
111
|
+
multisigFreezeAuthority: optional(PublicKeyFromString),
|
|
112
|
+
signers: optional(array(PublicKeyFromString)),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export type TransferChecked = Infer<typeof TransferChecked>;
|
|
116
|
+
export const TransferChecked = type({
|
|
117
|
+
source: PublicKeyFromString,
|
|
118
|
+
mint: PublicKeyFromString,
|
|
119
|
+
destination: PublicKeyFromString,
|
|
120
|
+
authority: optional(PublicKeyFromString),
|
|
121
|
+
multisigAuthority: optional(PublicKeyFromString),
|
|
122
|
+
signers: optional(array(PublicKeyFromString)),
|
|
123
|
+
tokenAmount: TokenAmountUi,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const ApproveChecked = type({
|
|
127
|
+
source: PublicKeyFromString,
|
|
128
|
+
mint: PublicKeyFromString,
|
|
129
|
+
delegate: PublicKeyFromString,
|
|
130
|
+
owner: optional(PublicKeyFromString),
|
|
131
|
+
multisigOwner: optional(PublicKeyFromString),
|
|
132
|
+
signers: optional(array(PublicKeyFromString)),
|
|
133
|
+
tokenAmount: TokenAmountUi,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const MintToChecked = type({
|
|
137
|
+
account: PublicKeyFromString,
|
|
138
|
+
mint: PublicKeyFromString,
|
|
139
|
+
mintAuthority: optional(PublicKeyFromString),
|
|
140
|
+
multisigMintAuthority: optional(PublicKeyFromString),
|
|
141
|
+
signers: optional(array(PublicKeyFromString)),
|
|
142
|
+
tokenAmount: TokenAmountUi,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const BurnChecked = type({
|
|
146
|
+
account: PublicKeyFromString,
|
|
147
|
+
mint: PublicKeyFromString,
|
|
148
|
+
authority: optional(PublicKeyFromString),
|
|
149
|
+
multisigAuthority: optional(PublicKeyFromString),
|
|
150
|
+
signers: optional(array(PublicKeyFromString)),
|
|
151
|
+
tokenAmount: TokenAmountUi,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
export type TokenInstructionType = Infer<typeof TokenInstructionType>;
|
|
155
|
+
export const TokenInstructionType = enums([
|
|
156
|
+
"initializeMint",
|
|
157
|
+
"initializeAccount",
|
|
158
|
+
"initializeMultisig",
|
|
159
|
+
"transfer",
|
|
160
|
+
"approve",
|
|
161
|
+
"revoke",
|
|
162
|
+
"setAuthority",
|
|
163
|
+
"mintTo",
|
|
164
|
+
"burn",
|
|
165
|
+
"closeAccount",
|
|
166
|
+
"freezeAccount",
|
|
167
|
+
"thawAccount",
|
|
168
|
+
"transfer2",
|
|
169
|
+
"approve2",
|
|
170
|
+
"mintTo2",
|
|
171
|
+
"burn2",
|
|
172
|
+
"transferChecked",
|
|
173
|
+
"approveChecked",
|
|
174
|
+
"mintToChecked",
|
|
175
|
+
"burnChecked",
|
|
176
|
+
]);
|
|
177
|
+
|
|
178
|
+
export const IX_STRUCTS = {
|
|
179
|
+
initializeMint: InitializeMint,
|
|
180
|
+
initializeAccount: InitializeAccount,
|
|
181
|
+
initializeMultisig: InitializeMultisig,
|
|
182
|
+
transfer: Transfer,
|
|
183
|
+
approve: Approve,
|
|
184
|
+
revoke: Revoke,
|
|
185
|
+
setAuthority: SetAuthority,
|
|
186
|
+
mintTo: MintTo,
|
|
187
|
+
burn: Burn,
|
|
188
|
+
closeAccount: CloseAccount,
|
|
189
|
+
freezeAccount: FreezeAccount,
|
|
190
|
+
thawAccount: ThawAccount,
|
|
191
|
+
transfer2: TransferChecked,
|
|
192
|
+
approve2: ApproveChecked,
|
|
193
|
+
mintTo2: MintToChecked,
|
|
194
|
+
burn2: BurnChecked,
|
|
195
|
+
transferChecked: TransferChecked,
|
|
196
|
+
approveChecked: ApproveChecked,
|
|
197
|
+
mintToChecked: MintToChecked,
|
|
198
|
+
burnChecked: BurnChecked,
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const IX_TITLES = {
|
|
202
|
+
initializeMint: "Initialize Mint",
|
|
203
|
+
initializeAccount: "Initialize Account",
|
|
204
|
+
initializeMultisig: "Initialize Multisig",
|
|
205
|
+
transfer: "Transfer",
|
|
206
|
+
approve: "Approve",
|
|
207
|
+
revoke: "Revoke",
|
|
208
|
+
setAuthority: "Set Authority",
|
|
209
|
+
mintTo: "Mint To",
|
|
210
|
+
burn: "Burn",
|
|
211
|
+
closeAccount: "Close Account",
|
|
212
|
+
freezeAccount: "Freeze Account",
|
|
213
|
+
thawAccount: "Thaw Account",
|
|
214
|
+
transfer2: "Transfer (Checked)",
|
|
215
|
+
approve2: "Approve (Checked)",
|
|
216
|
+
mintTo2: "Mint To (Checked)",
|
|
217
|
+
burn2: "Burn (Checked)",
|
|
218
|
+
transferChecked: "Transfer (Checked)",
|
|
219
|
+
approveChecked: "Approve (Checked)",
|
|
220
|
+
mintToChecked: "Mint To (Checked)",
|
|
221
|
+
burnChecked: "Burn (Checked)",
|
|
222
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const PARSED_PROGRAMS = {
|
|
2
|
+
SPL_ASSOCIATED_TOKEN_ACCOUNT: "spl-associated-token-account",
|
|
3
|
+
BPF_LOADER: "bpf-loader",
|
|
4
|
+
BPF_UPGRADEABLE_LOADER: "bpf-upgradeable-loader",
|
|
5
|
+
SPL_MEMO: "spl-memo",
|
|
6
|
+
STAKE: "stake",
|
|
7
|
+
SYSTEM: "system",
|
|
8
|
+
SPL_TOKEN: "spl-token",
|
|
9
|
+
VOTE: "vote",
|
|
10
|
+
} as const;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parse, parseQuiet } from "./parser";
|