@ledgerhq/coin-aptos 2.0.0 → 2.1.0-nightly.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/CHANGELOG.md +14 -0
- package/lib/__tests__/api/craftTransaction.unit.test.d.ts +2 -0
- package/lib/__tests__/api/craftTransaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/api/craftTransaction.unit.test.js +187 -0
- package/lib/__tests__/api/craftTransaction.unit.test.js.map +1 -0
- package/lib/__tests__/api/getBalance.unit.test.d.ts +2 -0
- package/lib/__tests__/api/getBalance.unit.test.d.ts.map +1 -0
- package/lib/__tests__/api/getBalance.unit.test.js +41 -0
- package/lib/__tests__/api/getBalance.unit.test.js.map +1 -0
- package/lib/__tests__/api/index.integ.test.js +276 -9
- package/lib/__tests__/api/index.integ.test.js.map +1 -1
- package/lib/__tests__/api/index.test.js +1 -1
- package/lib/__tests__/api/index.test.js.map +1 -1
- package/lib/__tests__/bridge/logic.test.js +8 -558
- package/lib/__tests__/bridge/logic.test.js.map +1 -1
- package/lib/__tests__/bridge/signOperation.test.js +7 -11
- package/lib/__tests__/bridge/signOperation.test.js.map +1 -1
- package/lib/__tests__/index.test.js +1 -1
- package/lib/__tests__/index.test.js.map +1 -1
- package/lib/__tests__/logic/buildTransaction.test.d.ts.map +1 -0
- package/lib/__tests__/{bridge → logic}/buildTransaction.test.js +14 -8
- package/lib/__tests__/logic/buildTransaction.test.js.map +1 -0
- package/lib/__tests__/logic/calculateAmount.unit.test.d.ts +2 -0
- package/lib/__tests__/logic/calculateAmount.unit.test.d.ts.map +1 -0
- package/lib/__tests__/logic/calculateAmount.unit.test.js +45 -0
- package/lib/__tests__/logic/calculateAmount.unit.test.js.map +1 -0
- package/lib/__tests__/logic/combine.unit.test.d.ts +2 -0
- package/lib/__tests__/logic/combine.unit.test.d.ts.map +1 -0
- package/lib/__tests__/logic/combine.unit.test.js +47 -0
- package/lib/__tests__/logic/combine.unit.test.js.map +1 -0
- package/lib/__tests__/logic/compareAddress.unit.test.d.ts +2 -0
- package/lib/__tests__/logic/compareAddress.unit.test.d.ts.map +1 -0
- package/lib/__tests__/logic/compareAddress.unit.test.js +26 -0
- package/lib/__tests__/logic/compareAddress.unit.test.js.map +1 -0
- package/lib/__tests__/logic/createTransaction.test.d.ts.map +1 -0
- package/lib/__tests__/{bridge → logic}/createTransaction.test.js +1 -1
- package/lib/__tests__/logic/createTransaction.test.js.map +1 -0
- package/lib/__tests__/logic/getCoinAndAmounts.unit.test.d.ts +2 -0
- package/lib/__tests__/logic/getCoinAndAmounts.unit.test.d.ts.map +1 -0
- package/lib/__tests__/logic/getCoinAndAmounts.unit.test.js +186 -0
- package/lib/__tests__/logic/getCoinAndAmounts.unit.test.js.map +1 -0
- package/lib/__tests__/logic/getFunctionAddress.unit.test.d.ts +2 -0
- package/lib/__tests__/logic/getFunctionAddress.unit.test.d.ts.map +1 -0
- package/lib/__tests__/logic/getFunctionAddress.unit.test.js +29 -0
- package/lib/__tests__/logic/getFunctionAddress.unit.test.js.map +1 -0
- package/lib/__tests__/logic/getResourceAddress.unit.test.d.ts +2 -0
- package/lib/__tests__/logic/getResourceAddress.unit.test.d.ts.map +1 -0
- package/lib/__tests__/logic/getResourceAddress.unit.test.js +218 -0
- package/lib/__tests__/logic/getResourceAddress.unit.test.js.map +1 -0
- package/lib/__tests__/logic/isTestnet.unit.test.d.ts +2 -0
- package/lib/__tests__/logic/isTestnet.unit.test.d.ts.map +1 -0
- package/lib/__tests__/logic/isTestnet.unit.test.js +12 -0
- package/lib/__tests__/logic/isTestnet.unit.test.js.map +1 -0
- package/lib/__tests__/logic/normalizeAddress.unit.test.d.ts +2 -0
- package/lib/__tests__/logic/normalizeAddress.unit.test.d.ts.map +1 -0
- package/lib/__tests__/logic/normalizeAddress.unit.test.js +12 -0
- package/lib/__tests__/logic/normalizeAddress.unit.test.js.map +1 -0
- package/lib/__tests__/logic/processRecipients.unit.test.d.ts +2 -0
- package/lib/__tests__/logic/processRecipients.unit.test.d.ts.map +1 -0
- package/lib/__tests__/logic/processRecipients.unit.test.js +79 -0
- package/lib/__tests__/logic/processRecipients.unit.test.js.map +1 -0
- package/lib/__tests__/network/client.test.js +613 -9
- package/lib/__tests__/network/client.test.js.map +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +7 -12
- package/lib/api/index.js.map +1 -1
- package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/getFeesForTransaction.d.ts.map +1 -1
- package/lib/bridge/getFeesForTransaction.js +1 -1
- package/lib/bridge/getFeesForTransaction.js.map +1 -1
- package/lib/bridge/index.js +1 -1
- package/lib/bridge/index.js.map +1 -1
- package/lib/bridge/logic.d.ts +1 -17
- package/lib/bridge/logic.d.ts.map +1 -1
- package/lib/bridge/logic.js +12 -204
- package/lib/bridge/logic.js.map +1 -1
- package/lib/bridge/prepareTransaction.js +1 -1
- package/lib/bridge/prepareTransaction.js.map +1 -1
- package/lib/bridge/signOperation.d.ts.map +1 -1
- package/lib/bridge/signOperation.js +1 -1
- package/lib/bridge/signOperation.js.map +1 -1
- package/lib/config.d.ts +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/constants.d.ts +7 -4
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +8 -4
- package/lib/constants.js.map +1 -1
- package/lib/logic/buildTransaction.d.ts +9 -0
- package/lib/logic/buildTransaction.d.ts.map +1 -0
- package/lib/logic/buildTransaction.js +47 -0
- package/lib/logic/buildTransaction.js.map +1 -0
- package/lib/logic/calculateAmount.d.ts +3 -0
- package/lib/logic/calculateAmount.d.ts.map +1 -0
- package/lib/logic/calculateAmount.js +13 -0
- package/lib/logic/calculateAmount.js.map +1 -0
- package/lib/logic/combine.d.ts +4 -0
- package/lib/logic/combine.d.ts.map +1 -0
- package/lib/logic/combine.js +34 -0
- package/lib/logic/combine.js.map +1 -0
- package/lib/logic/craftTransaction.d.ts +5 -0
- package/lib/logic/craftTransaction.d.ts.map +1 -0
- package/lib/logic/craftTransaction.js +68 -0
- package/lib/logic/craftTransaction.js.map +1 -0
- package/lib/logic/createTransaction.d.ts.map +1 -0
- package/lib/logic/createTransaction.js.map +1 -0
- package/lib/logic/getBalance.d.ts +5 -0
- package/lib/logic/getBalance.d.ts.map +1 -0
- package/lib/logic/getBalance.js +12 -0
- package/lib/logic/getBalance.js.map +1 -0
- package/lib/logic/getCoinAndAmounts.d.ts +13 -0
- package/lib/logic/getCoinAndAmounts.d.ts.map +1 -0
- package/lib/logic/getCoinAndAmounts.js +112 -0
- package/lib/logic/getCoinAndAmounts.js.map +1 -0
- package/lib/logic/getFunctionAddress.d.ts +3 -0
- package/lib/logic/getFunctionAddress.d.ts.map +1 -0
- package/lib/logic/getFunctionAddress.js +12 -0
- package/lib/logic/getFunctionAddress.js.map +1 -0
- package/lib/logic/getResourceAddress.d.ts +4 -0
- package/lib/logic/getResourceAddress.d.ts.map +1 -0
- package/lib/logic/getResourceAddress.js +17 -0
- package/lib/logic/getResourceAddress.js.map +1 -0
- package/lib/logic/isTestnet.d.ts +2 -0
- package/lib/logic/isTestnet.d.ts.map +1 -0
- package/lib/logic/isTestnet.js +9 -0
- package/lib/logic/isTestnet.js.map +1 -0
- package/lib/logic/isWriteSetChangeWriteResource.d.ts +3 -0
- package/lib/logic/isWriteSetChangeWriteResource.d.ts.map +1 -0
- package/lib/logic/isWriteSetChangeWriteResource.js +8 -0
- package/lib/logic/isWriteSetChangeWriteResource.js.map +1 -0
- package/lib/logic/normalizeAddress.d.ts +2 -0
- package/lib/logic/normalizeAddress.d.ts.map +1 -0
- package/lib/logic/normalizeAddress.js +12 -0
- package/lib/logic/normalizeAddress.js.map +1 -0
- package/lib/logic/normalizeTransactionOptions.d.ts +3 -0
- package/lib/logic/normalizeTransactionOptions.d.ts.map +1 -0
- package/lib/logic/normalizeTransactionOptions.js +21 -0
- package/lib/logic/normalizeTransactionOptions.js.map +1 -0
- package/lib/logic/processRecipients.d.ts +6 -0
- package/lib/logic/processRecipients.d.ts.map +1 -0
- package/lib/logic/processRecipients.js +58 -0
- package/lib/logic/processRecipients.js.map +1 -0
- package/lib/logic/transactionsToOperations.d.ts +7 -0
- package/lib/logic/transactionsToOperations.d.ts.map +1 -0
- package/lib/logic/transactionsToOperations.js +89 -0
- package/lib/logic/transactionsToOperations.js.map +1 -0
- package/lib/network/client.d.ts +6 -4
- package/lib/network/client.d.ts.map +1 -1
- package/lib/network/client.js +50 -14
- package/lib/network/client.js.map +1 -1
- package/lib/network/index.d.ts.map +1 -1
- package/lib/network/index.js +4 -7
- package/lib/network/index.js.map +1 -1
- package/lib/types/assets.d.ts +5 -1
- package/lib/types/assets.d.ts.map +1 -1
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib-es/__tests__/api/craftTransaction.unit.test.d.ts +2 -0
- package/lib-es/__tests__/api/craftTransaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/api/craftTransaction.unit.test.js +185 -0
- package/lib-es/__tests__/api/craftTransaction.unit.test.js.map +1 -0
- package/lib-es/__tests__/api/getBalance.unit.test.d.ts +2 -0
- package/lib-es/__tests__/api/getBalance.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/api/getBalance.unit.test.js +36 -0
- package/lib-es/__tests__/api/getBalance.unit.test.js.map +1 -0
- package/lib-es/__tests__/api/index.integ.test.js +277 -10
- package/lib-es/__tests__/api/index.integ.test.js.map +1 -1
- package/lib-es/__tests__/api/index.test.js +1 -1
- package/lib-es/__tests__/api/index.test.js.map +1 -1
- package/lib-es/__tests__/bridge/logic.test.js +8 -558
- package/lib-es/__tests__/bridge/logic.test.js.map +1 -1
- package/lib-es/__tests__/bridge/signOperation.test.js +7 -11
- package/lib-es/__tests__/bridge/signOperation.test.js.map +1 -1
- package/lib-es/__tests__/index.test.js +1 -1
- package/lib-es/__tests__/index.test.js.map +1 -1
- package/lib-es/__tests__/logic/buildTransaction.test.d.ts.map +1 -0
- package/lib-es/__tests__/{bridge → logic}/buildTransaction.test.js +11 -5
- package/lib-es/__tests__/logic/buildTransaction.test.js.map +1 -0
- package/lib-es/__tests__/logic/calculateAmount.unit.test.d.ts +2 -0
- package/lib-es/__tests__/logic/calculateAmount.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/logic/calculateAmount.unit.test.js +40 -0
- package/lib-es/__tests__/logic/calculateAmount.unit.test.js.map +1 -0
- package/lib-es/__tests__/logic/combine.unit.test.d.ts +2 -0
- package/lib-es/__tests__/logic/combine.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/logic/combine.unit.test.js +45 -0
- package/lib-es/__tests__/logic/combine.unit.test.js.map +1 -0
- package/lib-es/__tests__/logic/compareAddress.unit.test.d.ts +2 -0
- package/lib-es/__tests__/logic/compareAddress.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/logic/compareAddress.unit.test.js +24 -0
- package/lib-es/__tests__/logic/compareAddress.unit.test.js.map +1 -0
- package/lib-es/__tests__/logic/createTransaction.test.d.ts.map +1 -0
- package/lib-es/__tests__/{bridge → logic}/createTransaction.test.js +1 -1
- package/lib-es/__tests__/logic/createTransaction.test.js.map +1 -0
- package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.d.ts +2 -0
- package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.js +181 -0
- package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.js.map +1 -0
- package/lib-es/__tests__/logic/getFunctionAddress.unit.test.d.ts +2 -0
- package/lib-es/__tests__/logic/getFunctionAddress.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/logic/getFunctionAddress.unit.test.js +27 -0
- package/lib-es/__tests__/logic/getFunctionAddress.unit.test.js.map +1 -0
- package/lib-es/__tests__/logic/getResourceAddress.unit.test.d.ts +2 -0
- package/lib-es/__tests__/logic/getResourceAddress.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/logic/getResourceAddress.unit.test.js +216 -0
- package/lib-es/__tests__/logic/getResourceAddress.unit.test.js.map +1 -0
- package/lib-es/__tests__/logic/isTestnet.unit.test.d.ts +2 -0
- package/lib-es/__tests__/logic/isTestnet.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/logic/isTestnet.unit.test.js +10 -0
- package/lib-es/__tests__/logic/isTestnet.unit.test.js.map +1 -0
- package/lib-es/__tests__/logic/normalizeAddress.unit.test.d.ts +2 -0
- package/lib-es/__tests__/logic/normalizeAddress.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/logic/normalizeAddress.unit.test.js +10 -0
- package/lib-es/__tests__/logic/normalizeAddress.unit.test.js.map +1 -0
- package/lib-es/__tests__/logic/processRecipients.unit.test.d.ts +2 -0
- package/lib-es/__tests__/logic/processRecipients.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/logic/processRecipients.unit.test.js +74 -0
- package/lib-es/__tests__/logic/processRecipients.unit.test.js.map +1 -0
- package/lib-es/__tests__/network/client.test.js +614 -10
- package/lib-es/__tests__/network/client.test.js.map +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +7 -12
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/getFeesForTransaction.d.ts.map +1 -1
- package/lib-es/bridge/getFeesForTransaction.js +1 -1
- package/lib-es/bridge/getFeesForTransaction.js.map +1 -1
- package/lib-es/bridge/index.js +1 -1
- package/lib-es/bridge/index.js.map +1 -1
- package/lib-es/bridge/logic.d.ts +1 -17
- package/lib-es/bridge/logic.d.ts.map +1 -1
- package/lib-es/bridge/logic.js +6 -187
- package/lib-es/bridge/logic.js.map +1 -1
- package/lib-es/bridge/prepareTransaction.js +1 -1
- package/lib-es/bridge/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/signOperation.js +1 -1
- package/lib-es/bridge/signOperation.js.map +1 -1
- package/lib-es/config.d.ts +1 -1
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/constants.d.ts +7 -4
- package/lib-es/constants.d.ts.map +1 -1
- package/lib-es/constants.js +7 -3
- package/lib-es/constants.js.map +1 -1
- package/lib-es/logic/buildTransaction.d.ts +9 -0
- package/lib-es/logic/buildTransaction.d.ts.map +1 -0
- package/lib-es/logic/buildTransaction.js +43 -0
- package/lib-es/logic/buildTransaction.js.map +1 -0
- package/lib-es/logic/calculateAmount.d.ts +3 -0
- package/lib-es/logic/calculateAmount.d.ts.map +1 -0
- package/lib-es/logic/calculateAmount.js +9 -0
- package/lib-es/logic/calculateAmount.js.map +1 -0
- package/lib-es/logic/combine.d.ts +4 -0
- package/lib-es/logic/combine.d.ts.map +1 -0
- package/lib-es/logic/combine.js +29 -0
- package/lib-es/logic/combine.js.map +1 -0
- package/lib-es/logic/craftTransaction.d.ts +5 -0
- package/lib-es/logic/craftTransaction.d.ts.map +1 -0
- package/lib-es/logic/craftTransaction.js +38 -0
- package/lib-es/logic/craftTransaction.js.map +1 -0
- package/lib-es/logic/createTransaction.d.ts.map +1 -0
- package/lib-es/logic/createTransaction.js.map +1 -0
- package/lib-es/logic/getBalance.d.ts +5 -0
- package/lib-es/logic/getBalance.d.ts.map +1 -0
- package/lib-es/logic/getBalance.js +8 -0
- package/lib-es/logic/getBalance.js.map +1 -0
- package/lib-es/logic/getCoinAndAmounts.d.ts +13 -0
- package/lib-es/logic/getCoinAndAmounts.d.ts.map +1 -0
- package/lib-es/logic/getCoinAndAmounts.js +101 -0
- package/lib-es/logic/getCoinAndAmounts.js.map +1 -0
- package/lib-es/logic/getFunctionAddress.d.ts +3 -0
- package/lib-es/logic/getFunctionAddress.d.ts.map +1 -0
- package/lib-es/logic/getFunctionAddress.js +8 -0
- package/lib-es/logic/getFunctionAddress.js.map +1 -0
- package/lib-es/logic/getResourceAddress.d.ts +4 -0
- package/lib-es/logic/getResourceAddress.d.ts.map +1 -0
- package/lib-es/logic/getResourceAddress.js +13 -0
- package/lib-es/logic/getResourceAddress.js.map +1 -0
- package/lib-es/logic/isTestnet.d.ts +2 -0
- package/lib-es/logic/isTestnet.d.ts.map +1 -0
- package/lib-es/logic/isTestnet.js +5 -0
- package/lib-es/logic/isTestnet.js.map +1 -0
- package/lib-es/logic/isWriteSetChangeWriteResource.d.ts +3 -0
- package/lib-es/logic/isWriteSetChangeWriteResource.d.ts.map +1 -0
- package/lib-es/logic/isWriteSetChangeWriteResource.js +4 -0
- package/lib-es/logic/isWriteSetChangeWriteResource.js.map +1 -0
- package/lib-es/logic/normalizeAddress.d.ts +2 -0
- package/lib-es/logic/normalizeAddress.d.ts.map +1 -0
- package/lib-es/logic/normalizeAddress.js +8 -0
- package/lib-es/logic/normalizeAddress.js.map +1 -0
- package/lib-es/logic/normalizeTransactionOptions.d.ts +3 -0
- package/lib-es/logic/normalizeTransactionOptions.d.ts.map +1 -0
- package/lib-es/logic/normalizeTransactionOptions.js +17 -0
- package/lib-es/logic/normalizeTransactionOptions.js.map +1 -0
- package/lib-es/logic/processRecipients.d.ts +6 -0
- package/lib-es/logic/processRecipients.d.ts.map +1 -0
- package/lib-es/logic/processRecipients.js +54 -0
- package/lib-es/logic/processRecipients.js.map +1 -0
- package/lib-es/logic/transactionsToOperations.d.ts +7 -0
- package/lib-es/logic/transactionsToOperations.d.ts.map +1 -0
- package/lib-es/logic/transactionsToOperations.js +81 -0
- package/lib-es/logic/transactionsToOperations.js.map +1 -0
- package/lib-es/network/client.d.ts +6 -4
- package/lib-es/network/client.d.ts.map +1 -1
- package/lib-es/network/client.js +50 -14
- package/lib-es/network/client.js.map +1 -1
- package/lib-es/network/index.d.ts.map +1 -1
- package/lib-es/network/index.js +5 -8
- package/lib-es/network/index.js.map +1 -1
- package/lib-es/types/assets.d.ts +5 -1
- package/lib-es/types/assets.d.ts.map +1 -1
- package/lib-es/types/index.d.ts +4 -0
- package/lib-es/types/index.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/__tests__/api/craftTransaction.unit.test.ts +243 -0
- package/src/__tests__/api/getBalance.unit.test.ts +44 -0
- package/src/__tests__/api/index.integ.test.ts +355 -12
- package/src/__tests__/api/index.test.ts +1 -1
- package/src/__tests__/bridge/logic.test.ts +9 -654
- package/src/__tests__/bridge/signOperation.test.ts +7 -11
- package/src/__tests__/index.test.ts +1 -1
- package/src/__tests__/{bridge → logic}/buildTransaction.test.ts +14 -7
- package/src/__tests__/logic/calculateAmount.unit.test.ts +51 -0
- package/src/__tests__/logic/combine.unit.test.ts +65 -0
- package/src/__tests__/logic/compareAddress.unit.test.ts +27 -0
- package/src/__tests__/{bridge → logic}/createTransaction.test.ts +1 -1
- package/src/__tests__/logic/getCoinAndAmounts.unit.test.ts +195 -0
- package/src/__tests__/logic/getFunctionAddress.unit.test.ts +33 -0
- package/src/__tests__/logic/getResourceAddress.unit.test.ts +241 -0
- package/src/__tests__/logic/isTestnet.unit.test.ts +11 -0
- package/src/__tests__/logic/normalizeAddress.unit.test.ts +15 -0
- package/src/__tests__/logic/processRecipients.unit.test.ts +95 -0
- package/src/__tests__/network/client.test.ts +650 -11
- package/src/api/index.ts +10 -13
- package/src/bridge/estimateMaxSpendable.ts +1 -1
- package/src/bridge/getFeesForTransaction.ts +1 -1
- package/src/bridge/index.ts +1 -1
- package/src/bridge/logic.ts +8 -279
- package/src/bridge/prepareTransaction.ts +1 -1
- package/src/bridge/signOperation.ts +1 -1
- package/src/config.ts +1 -1
- package/src/constants.ts +8 -4
- package/src/logic/buildTransaction.ts +70 -0
- package/src/logic/calculateAmount.ts +15 -0
- package/src/logic/combine.ts +51 -0
- package/src/logic/craftTransaction.ts +65 -0
- package/src/logic/getBalance.ts +15 -0
- package/src/logic/getCoinAndAmounts.ts +141 -0
- package/src/logic/getFunctionAddress.ts +9 -0
- package/src/logic/getResourceAddress.ts +24 -0
- package/src/logic/isTestnet.ts +5 -0
- package/src/logic/isWriteSetChangeWriteResource.ts +7 -0
- package/src/logic/normalizeAddress.ts +8 -0
- package/src/logic/normalizeTransactionOptions.ts +18 -0
- package/src/logic/processRecipients.ts +88 -0
- package/src/logic/transactionsToOperations.ts +106 -0
- package/src/network/client.ts +88 -29
- package/src/network/index.ts +4 -13
- package/src/types/assets.ts +6 -1
- package/src/types/index.ts +5 -0
- package/lib/__tests__/bridge/buildTransaction.test.d.ts.map +0 -1
- package/lib/__tests__/bridge/buildTransaction.test.js.map +0 -1
- package/lib/__tests__/bridge/createTransaction.test.d.ts.map +0 -1
- package/lib/__tests__/bridge/createTransaction.test.js.map +0 -1
- package/lib/bridge/buildTransaction.d.ts +0 -7
- package/lib/bridge/buildTransaction.d.ts.map +0 -1
- package/lib/bridge/buildTransaction.js +0 -45
- package/lib/bridge/buildTransaction.js.map +0 -1
- package/lib/bridge/createTransaction.d.ts.map +0 -1
- package/lib/bridge/createTransaction.js.map +0 -1
- package/lib-es/__tests__/bridge/buildTransaction.test.d.ts.map +0 -1
- package/lib-es/__tests__/bridge/buildTransaction.test.js.map +0 -1
- package/lib-es/__tests__/bridge/createTransaction.test.d.ts.map +0 -1
- package/lib-es/__tests__/bridge/createTransaction.test.js.map +0 -1
- package/lib-es/bridge/buildTransaction.d.ts +0 -7
- package/lib-es/bridge/buildTransaction.d.ts.map +0 -1
- package/lib-es/bridge/buildTransaction.js +0 -43
- package/lib-es/bridge/buildTransaction.js.map +0 -1
- package/lib-es/bridge/createTransaction.d.ts.map +0 -1
- package/lib-es/bridge/createTransaction.js.map +0 -1
- package/src/bridge/buildTransaction.ts +0 -62
- /package/lib/__tests__/{bridge → logic}/buildTransaction.test.d.ts +0 -0
- /package/lib/__tests__/{bridge → logic}/createTransaction.test.d.ts +0 -0
- /package/lib/{bridge → logic}/createTransaction.d.ts +0 -0
- /package/lib/{bridge → logic}/createTransaction.js +0 -0
- /package/lib-es/__tests__/{bridge → logic}/buildTransaction.test.d.ts +0 -0
- /package/lib-es/__tests__/{bridge → logic}/createTransaction.test.d.ts +0 -0
- /package/lib-es/{bridge → logic}/createTransaction.d.ts +0 -0
- /package/lib-es/{bridge → logic}/createTransaction.js +0 -0
- /package/src/{bridge → logic}/createTransaction.ts +0 -0
|
@@ -4,32 +4,42 @@ import {
|
|
|
4
4
|
Aptos,
|
|
5
5
|
ChainId,
|
|
6
6
|
Ed25519PublicKey,
|
|
7
|
+
Hex,
|
|
7
8
|
InputEntryFunctionData,
|
|
8
9
|
RawTransaction,
|
|
9
10
|
Serializable,
|
|
10
|
-
|
|
11
|
+
postAptosFullNode,
|
|
12
|
+
TransactionResponseType,
|
|
11
13
|
} from "@aptos-labs/ts-sdk";
|
|
12
14
|
import network from "@ledgerhq/live-network";
|
|
13
15
|
import BigNumber from "bignumber.js";
|
|
14
16
|
import { AptosAPI } from "../../network";
|
|
15
17
|
import { AptosAsset, AptosExtra, AptosSender } from "../../types/assets";
|
|
16
|
-
import { TransactionIntent } from "@ledgerhq/coin-framework/api/types";
|
|
18
|
+
import { Pagination, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
|
|
17
19
|
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
20
|
+
import { APTOS_ASSET_ID } from "../../constants";
|
|
21
|
+
import { AptosTransaction } from "../../types";
|
|
18
22
|
|
|
19
23
|
jest.mock("@aptos-labs/ts-sdk");
|
|
20
24
|
jest.mock("@apollo/client");
|
|
21
25
|
let mockedAptos: jest.Mocked<any>;
|
|
22
26
|
let mockedApolloClient: jest.Mocked<any>;
|
|
23
27
|
let mockedPost = jest.fn();
|
|
28
|
+
let mockedHex: jest.Mocked<any>;
|
|
24
29
|
|
|
25
30
|
jest.mock("@ledgerhq/live-network/network");
|
|
26
31
|
const mockedNetwork = jest.mocked(network);
|
|
27
32
|
|
|
33
|
+
jest.mock("@ledgerhq/cryptoassets/tokens", () => ({
|
|
34
|
+
findTokenByAddressInCurrency: jest.fn().mockReturnValue("token-name"),
|
|
35
|
+
}));
|
|
36
|
+
|
|
28
37
|
describe("Aptos API", () => {
|
|
29
38
|
beforeEach(() => {
|
|
30
39
|
mockedAptos = jest.mocked(Aptos);
|
|
40
|
+
mockedHex = jest.mocked(Hex);
|
|
31
41
|
mockedApolloClient = jest.mocked(ApolloClient);
|
|
32
|
-
mockedPost = jest.mocked(
|
|
42
|
+
mockedPost = jest.mocked(postAptosFullNode);
|
|
33
43
|
});
|
|
34
44
|
|
|
35
45
|
afterEach(() => jest.clearAllMocks());
|
|
@@ -546,39 +556,48 @@ describe("Aptos API", () => {
|
|
|
546
556
|
});
|
|
547
557
|
});
|
|
548
558
|
});
|
|
559
|
+
|
|
549
560
|
describe("broadcast", () => {
|
|
550
561
|
it("broadcasts the transaction", async () => {
|
|
551
562
|
mockedPost.mockImplementation(async () => ({ data: { hash: "ok" } }));
|
|
552
|
-
const mockedPostSpy = jest.spyOn({
|
|
563
|
+
const mockedPostSpy = jest.spyOn({ postAptosFullNode: mockedPost }, "postAptosFullNode");
|
|
553
564
|
|
|
565
|
+
// const txBytes = Hex.fromHexString(tx).toUint8Array();
|
|
554
566
|
mockedAptos.mockImplementation(() => ({
|
|
555
567
|
config: "config",
|
|
556
568
|
}));
|
|
557
569
|
|
|
570
|
+
mockedHex.fromHexString = jest.fn().mockReturnValue({ toUint8Array: () => "123" });
|
|
571
|
+
|
|
558
572
|
const api = new AptosAPI("aptos");
|
|
559
|
-
|
|
573
|
+
|
|
574
|
+
await api.broadcast("signed transaction");
|
|
560
575
|
|
|
561
576
|
expect(mockedPostSpy).toHaveBeenCalledWith({
|
|
562
|
-
contentType: "application/x.aptos.signed_transaction+bcs",
|
|
563
577
|
aptosConfig: "config",
|
|
564
|
-
body:
|
|
578
|
+
body: "123",
|
|
565
579
|
path: "transactions",
|
|
566
|
-
type: "Fullnode",
|
|
567
580
|
originMethod: "",
|
|
581
|
+
contentType: "application/x.aptos.signed_transaction+bcs",
|
|
568
582
|
});
|
|
569
583
|
});
|
|
570
584
|
});
|
|
571
585
|
|
|
572
586
|
describe("estimateFees", () => {
|
|
573
|
-
it("estimates the fees", async () => {
|
|
587
|
+
it("estimates the fees for native asset", async () => {
|
|
574
588
|
const gasEstimation = { gas_estimate: 100 };
|
|
589
|
+
const buildSimple = jest.fn().mockResolvedValue({ rawTransaction: {} });
|
|
590
|
+
|
|
591
|
+
const time = new Date("2025-05-29");
|
|
592
|
+
jest.useFakeTimers().setSystemTime(time);
|
|
593
|
+
|
|
575
594
|
mockedAptos.mockImplementation(() => ({
|
|
576
595
|
getLedgerInfo: jest.fn().mockResolvedValue({
|
|
577
|
-
ledger_timestamp:
|
|
596
|
+
ledger_timestamp: time,
|
|
578
597
|
}),
|
|
579
598
|
transaction: {
|
|
580
599
|
build: {
|
|
581
|
-
simple:
|
|
600
|
+
simple: buildSimple,
|
|
582
601
|
},
|
|
583
602
|
simulate: {
|
|
584
603
|
simple: jest.fn().mockResolvedValue([
|
|
@@ -612,7 +631,627 @@ describe("Aptos API", () => {
|
|
|
612
631
|
|
|
613
632
|
const fees = await api.estimateFees(transactionIntent);
|
|
614
633
|
|
|
634
|
+
expect(buildSimple.mock.calls[0][0]).toEqual({
|
|
635
|
+
sender: "address1",
|
|
636
|
+
data: {
|
|
637
|
+
function: "0x1::aptos_account::transfer_coins",
|
|
638
|
+
typeArguments: ["0x1::aptos_coin::AptosCoin"],
|
|
639
|
+
functionArguments: ["address2", 100n],
|
|
640
|
+
},
|
|
641
|
+
options: {
|
|
642
|
+
maxGasAmount: 200,
|
|
643
|
+
gasUnitPrice: 100,
|
|
644
|
+
expireTimestamp: Number(Math.ceil(+time / 1_000_000 + 2 * 60)),
|
|
645
|
+
},
|
|
646
|
+
});
|
|
647
|
+
|
|
615
648
|
expect(fees.value.toString()).toEqual("40");
|
|
616
649
|
});
|
|
650
|
+
|
|
651
|
+
it("estimates the fees for token coin", async () => {
|
|
652
|
+
const gasEstimation = { gas_estimate: 100 };
|
|
653
|
+
const buildSimple = jest.fn().mockResolvedValue({ rawTransaction: {} });
|
|
654
|
+
|
|
655
|
+
const time = new Date("2025-05-29");
|
|
656
|
+
jest.useFakeTimers().setSystemTime(time);
|
|
657
|
+
|
|
658
|
+
mockedAptos.mockImplementation(() => ({
|
|
659
|
+
getLedgerInfo: jest.fn().mockResolvedValue({
|
|
660
|
+
ledger_timestamp: time,
|
|
661
|
+
}),
|
|
662
|
+
transaction: {
|
|
663
|
+
build: {
|
|
664
|
+
simple: buildSimple,
|
|
665
|
+
},
|
|
666
|
+
simulate: {
|
|
667
|
+
simple: jest.fn().mockResolvedValue([
|
|
668
|
+
{
|
|
669
|
+
gas_used: 10,
|
|
670
|
+
gas_unit_price: 2,
|
|
671
|
+
},
|
|
672
|
+
]),
|
|
673
|
+
},
|
|
674
|
+
},
|
|
675
|
+
getGasPriceEstimation: jest.fn().mockReturnValue(gasEstimation),
|
|
676
|
+
}));
|
|
677
|
+
|
|
678
|
+
const amount = BigInt(100);
|
|
679
|
+
const sender: AptosSender = {
|
|
680
|
+
xpub: "xpub",
|
|
681
|
+
freshAddress: "address1",
|
|
682
|
+
};
|
|
683
|
+
const recipient = "address2";
|
|
684
|
+
|
|
685
|
+
const api = new AptosAPI("aptos");
|
|
686
|
+
const transactionIntent: TransactionIntent<AptosAsset, AptosExtra, AptosSender> = {
|
|
687
|
+
asset: {
|
|
688
|
+
type: "token",
|
|
689
|
+
standard: "coin",
|
|
690
|
+
contractAddress: "0x111",
|
|
691
|
+
},
|
|
692
|
+
type: "send",
|
|
693
|
+
sender,
|
|
694
|
+
amount,
|
|
695
|
+
recipient,
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
const fees = await api.estimateFees(transactionIntent);
|
|
699
|
+
|
|
700
|
+
expect(buildSimple.mock.calls[0][0]).toEqual({
|
|
701
|
+
sender: "address1",
|
|
702
|
+
data: {
|
|
703
|
+
function: "0x1::aptos_account::transfer_coins",
|
|
704
|
+
typeArguments: ["0x111"],
|
|
705
|
+
functionArguments: ["address2", 100n],
|
|
706
|
+
},
|
|
707
|
+
options: {
|
|
708
|
+
maxGasAmount: 200,
|
|
709
|
+
gasUnitPrice: 100,
|
|
710
|
+
expireTimestamp: Number(Math.ceil(+time / 1_000_000 + 2 * 60)),
|
|
711
|
+
},
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
expect(fees.value.toString()).toEqual("20");
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
it("estimates the fees for token FA", async () => {
|
|
718
|
+
const gasEstimation = { gas_estimate: 100 };
|
|
719
|
+
const buildSimple = jest.fn().mockResolvedValue({ rawTransaction: {} });
|
|
720
|
+
const time = new Date("2025-05-29");
|
|
721
|
+
jest.useFakeTimers().setSystemTime(time);
|
|
722
|
+
|
|
723
|
+
mockedAptos.mockImplementation(() => ({
|
|
724
|
+
getLedgerInfo: jest.fn().mockResolvedValue({
|
|
725
|
+
ledger_timestamp: time,
|
|
726
|
+
}),
|
|
727
|
+
transaction: {
|
|
728
|
+
build: {
|
|
729
|
+
simple: buildSimple,
|
|
730
|
+
},
|
|
731
|
+
simulate: {
|
|
732
|
+
simple: jest.fn().mockResolvedValue([
|
|
733
|
+
{
|
|
734
|
+
gas_used: 10,
|
|
735
|
+
gas_unit_price: 3,
|
|
736
|
+
},
|
|
737
|
+
]),
|
|
738
|
+
},
|
|
739
|
+
},
|
|
740
|
+
getGasPriceEstimation: jest.fn().mockReturnValue(gasEstimation),
|
|
741
|
+
}));
|
|
742
|
+
|
|
743
|
+
const amount = BigInt(100);
|
|
744
|
+
const sender: AptosSender = {
|
|
745
|
+
xpub: "xpub",
|
|
746
|
+
freshAddress: "address1",
|
|
747
|
+
};
|
|
748
|
+
const recipient = "address2";
|
|
749
|
+
|
|
750
|
+
const api = new AptosAPI("aptos");
|
|
751
|
+
const transactionIntent: TransactionIntent<AptosAsset, AptosExtra, AptosSender> = {
|
|
752
|
+
asset: {
|
|
753
|
+
type: "token",
|
|
754
|
+
standard: "fungible_asset",
|
|
755
|
+
contractAddress: "0x111",
|
|
756
|
+
},
|
|
757
|
+
type: "send",
|
|
758
|
+
sender,
|
|
759
|
+
amount,
|
|
760
|
+
recipient,
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
const fees = await api.estimateFees(transactionIntent);
|
|
764
|
+
|
|
765
|
+
expect(buildSimple.mock.calls[0][0]).toEqual({
|
|
766
|
+
sender: "address1",
|
|
767
|
+
data: {
|
|
768
|
+
function: "0x1::primary_fungible_store::transfer",
|
|
769
|
+
typeArguments: ["0x1::fungible_asset::Metadata"],
|
|
770
|
+
functionArguments: ["0x111", "address2", 100n],
|
|
771
|
+
},
|
|
772
|
+
options: {
|
|
773
|
+
maxGasAmount: 200,
|
|
774
|
+
gasUnitPrice: 100,
|
|
775
|
+
expireTimestamp: Number(Math.ceil(+time / 1_000_000 + 2 * 60)),
|
|
776
|
+
},
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
expect(fees.value.toString()).toEqual("30");
|
|
780
|
+
});
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
describe("getBalances", () => {
|
|
784
|
+
it("returns an array of AptosBalances objects", async () => {
|
|
785
|
+
const assets = [{ asset_type: APTOS_ASSET_ID, amount: 200 }];
|
|
786
|
+
const mockGetCurrentFungibleAssetBalances = jest.fn().mockResolvedValue(assets);
|
|
787
|
+
mockedAptos.mockImplementation(() => ({
|
|
788
|
+
getCurrentFungibleAssetBalances: mockGetCurrentFungibleAssetBalances,
|
|
789
|
+
}));
|
|
790
|
+
|
|
791
|
+
const address = "0x42";
|
|
792
|
+
|
|
793
|
+
const api = new AptosAPI("aptos");
|
|
794
|
+
const balances = await api.getBalances(address);
|
|
795
|
+
|
|
796
|
+
expect(mockGetCurrentFungibleAssetBalances).toHaveBeenCalledWith({
|
|
797
|
+
options: {
|
|
798
|
+
offset: 0,
|
|
799
|
+
limit: 1000,
|
|
800
|
+
where: {
|
|
801
|
+
asset_type: { _eq: APTOS_ASSET_ID },
|
|
802
|
+
owner_address: { _eq: address },
|
|
803
|
+
},
|
|
804
|
+
},
|
|
805
|
+
});
|
|
806
|
+
expect(balances).toHaveLength(1);
|
|
807
|
+
expect(balances[0].contractAddress).toBe(assets[0].asset_type);
|
|
808
|
+
expect(balances[0].amount).toStrictEqual(BigNumber(assets[0].amount));
|
|
809
|
+
});
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
describe("listOperations", () => {
|
|
813
|
+
it("list of operations", async () => {
|
|
814
|
+
const api = new AptosAPI("aptos");
|
|
815
|
+
const address = "0x12345";
|
|
816
|
+
const pagination: Pagination = { minHeight: 0 };
|
|
817
|
+
|
|
818
|
+
const txs: AptosTransaction[] = [
|
|
819
|
+
{
|
|
820
|
+
version: "2532591427",
|
|
821
|
+
hash: "0x3f35",
|
|
822
|
+
state_change_hash: "0xb480",
|
|
823
|
+
event_root_hash: "0x3fa1",
|
|
824
|
+
state_checkpoint_hash: null,
|
|
825
|
+
gas_used: "12",
|
|
826
|
+
success: true,
|
|
827
|
+
vm_status: "Executed successfully",
|
|
828
|
+
accumulator_root_hash: "0x319f",
|
|
829
|
+
changes: [
|
|
830
|
+
{
|
|
831
|
+
address: "0x4e5e",
|
|
832
|
+
state_key_hash: "0x3c0c",
|
|
833
|
+
data: {
|
|
834
|
+
type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
|
|
835
|
+
data: {
|
|
836
|
+
coin: {
|
|
837
|
+
value: "4000000",
|
|
838
|
+
},
|
|
839
|
+
deposit_events: {
|
|
840
|
+
counter: "9",
|
|
841
|
+
guid: {
|
|
842
|
+
id: {
|
|
843
|
+
addr: "0x4e5e",
|
|
844
|
+
creation_num: "4",
|
|
845
|
+
},
|
|
846
|
+
},
|
|
847
|
+
},
|
|
848
|
+
frozen: false,
|
|
849
|
+
withdraw_events: {
|
|
850
|
+
counter: "6",
|
|
851
|
+
guid: {
|
|
852
|
+
id: {
|
|
853
|
+
addr: "0x4e5e",
|
|
854
|
+
creation_num: "5",
|
|
855
|
+
},
|
|
856
|
+
},
|
|
857
|
+
},
|
|
858
|
+
},
|
|
859
|
+
},
|
|
860
|
+
type: "write_resource",
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
address: address,
|
|
864
|
+
state_key_hash: "0x1709",
|
|
865
|
+
data: {
|
|
866
|
+
type: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
|
|
867
|
+
data: {
|
|
868
|
+
coin: {
|
|
869
|
+
value: "68254118",
|
|
870
|
+
},
|
|
871
|
+
deposit_events: {
|
|
872
|
+
counter: "46",
|
|
873
|
+
guid: {
|
|
874
|
+
id: {
|
|
875
|
+
addr: address,
|
|
876
|
+
creation_num: "2",
|
|
877
|
+
},
|
|
878
|
+
},
|
|
879
|
+
},
|
|
880
|
+
frozen: false,
|
|
881
|
+
withdraw_events: {
|
|
882
|
+
counter: "89",
|
|
883
|
+
guid: {
|
|
884
|
+
id: {
|
|
885
|
+
addr: address,
|
|
886
|
+
creation_num: "3",
|
|
887
|
+
},
|
|
888
|
+
},
|
|
889
|
+
},
|
|
890
|
+
},
|
|
891
|
+
},
|
|
892
|
+
type: "write_resource",
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
address: address,
|
|
896
|
+
state_key_hash: "0x5520",
|
|
897
|
+
data: {
|
|
898
|
+
type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
|
|
899
|
+
data: {
|
|
900
|
+
coin: {
|
|
901
|
+
value: "1000000",
|
|
902
|
+
},
|
|
903
|
+
deposit_events: {
|
|
904
|
+
counter: "7",
|
|
905
|
+
guid: {
|
|
906
|
+
id: {
|
|
907
|
+
addr: address,
|
|
908
|
+
creation_num: "10",
|
|
909
|
+
},
|
|
910
|
+
},
|
|
911
|
+
},
|
|
912
|
+
frozen: false,
|
|
913
|
+
withdraw_events: {
|
|
914
|
+
counter: "13",
|
|
915
|
+
guid: {
|
|
916
|
+
id: {
|
|
917
|
+
addr: address,
|
|
918
|
+
creation_num: "11",
|
|
919
|
+
},
|
|
920
|
+
},
|
|
921
|
+
},
|
|
922
|
+
},
|
|
923
|
+
},
|
|
924
|
+
type: "write_resource",
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
address: address,
|
|
928
|
+
state_key_hash: "0x6f1e",
|
|
929
|
+
data: {
|
|
930
|
+
type: "0x1::account::Account",
|
|
931
|
+
data: {
|
|
932
|
+
authentication_key: address,
|
|
933
|
+
coin_register_events: {
|
|
934
|
+
counter: "5",
|
|
935
|
+
guid: {
|
|
936
|
+
id: {
|
|
937
|
+
addr: address,
|
|
938
|
+
creation_num: "0",
|
|
939
|
+
},
|
|
940
|
+
},
|
|
941
|
+
},
|
|
942
|
+
guid_creation_num: "12",
|
|
943
|
+
key_rotation_events: {
|
|
944
|
+
counter: "0",
|
|
945
|
+
guid: {
|
|
946
|
+
id: {
|
|
947
|
+
addr: address,
|
|
948
|
+
creation_num: "1",
|
|
949
|
+
},
|
|
950
|
+
},
|
|
951
|
+
},
|
|
952
|
+
rotation_capability_offer: {
|
|
953
|
+
for: {
|
|
954
|
+
vec: [],
|
|
955
|
+
},
|
|
956
|
+
},
|
|
957
|
+
sequence_number: "122",
|
|
958
|
+
signer_capability_offer: {
|
|
959
|
+
for: {
|
|
960
|
+
vec: [],
|
|
961
|
+
},
|
|
962
|
+
},
|
|
963
|
+
},
|
|
964
|
+
},
|
|
965
|
+
type: "write_resource",
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
state_key_hash: "0x6e4b",
|
|
969
|
+
handle: "0x1b85",
|
|
970
|
+
key: "0x0619",
|
|
971
|
+
value: "0x1ddaf8da3b1497010000000000000000",
|
|
972
|
+
type: "write_table_item",
|
|
973
|
+
},
|
|
974
|
+
],
|
|
975
|
+
sender: address,
|
|
976
|
+
sequence_number: "121",
|
|
977
|
+
max_gas_amount: "12",
|
|
978
|
+
gas_unit_price: "100",
|
|
979
|
+
expiration_timestamp_secs: "1743177404",
|
|
980
|
+
payload: {
|
|
981
|
+
function: "0x1::aptos_account::transfer_coins",
|
|
982
|
+
type_arguments: ["0xd111::staked_coin::StakedAptos"],
|
|
983
|
+
arguments: ["0x4e5e", "1500000"],
|
|
984
|
+
type: "entry_function_payload",
|
|
985
|
+
},
|
|
986
|
+
events: [
|
|
987
|
+
{
|
|
988
|
+
guid: {
|
|
989
|
+
creation_number: "11",
|
|
990
|
+
account_address: address,
|
|
991
|
+
},
|
|
992
|
+
sequence_number: "12",
|
|
993
|
+
type: "0x1::coin::WithdrawEvent",
|
|
994
|
+
data: {
|
|
995
|
+
amount: "1500000",
|
|
996
|
+
},
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
guid: {
|
|
1000
|
+
creation_number: "4",
|
|
1001
|
+
account_address: "0x4e5e",
|
|
1002
|
+
},
|
|
1003
|
+
sequence_number: "8",
|
|
1004
|
+
type: "0x1::coin::DepositEvent",
|
|
1005
|
+
data: {
|
|
1006
|
+
amount: "1500000",
|
|
1007
|
+
},
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
guid: {
|
|
1011
|
+
creation_number: "0",
|
|
1012
|
+
account_address: "0x0",
|
|
1013
|
+
},
|
|
1014
|
+
sequence_number: "0",
|
|
1015
|
+
type: "0x1::transaction_fee::FeeStatement",
|
|
1016
|
+
data: {
|
|
1017
|
+
execution_gas_units: "6",
|
|
1018
|
+
io_gas_units: "6",
|
|
1019
|
+
storage_fee_octas: "0",
|
|
1020
|
+
storage_fee_refund_octas: "0",
|
|
1021
|
+
total_charge_gas_units: "12",
|
|
1022
|
+
},
|
|
1023
|
+
},
|
|
1024
|
+
],
|
|
1025
|
+
timestamp: "1743177360481259",
|
|
1026
|
+
type: TransactionResponseType.User,
|
|
1027
|
+
block: {
|
|
1028
|
+
height: 311948147,
|
|
1029
|
+
hash: "0x6d02",
|
|
1030
|
+
},
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
version: "2532549325",
|
|
1034
|
+
hash: "0x9a6b",
|
|
1035
|
+
state_change_hash: "0xa424",
|
|
1036
|
+
event_root_hash: "0x0321",
|
|
1037
|
+
state_checkpoint_hash: null,
|
|
1038
|
+
gas_used: "12",
|
|
1039
|
+
success: true,
|
|
1040
|
+
vm_status: "Executed successfully",
|
|
1041
|
+
accumulator_root_hash: "0xede9",
|
|
1042
|
+
changes: [
|
|
1043
|
+
{
|
|
1044
|
+
address: "0x4e5e",
|
|
1045
|
+
state_key_hash: "0x3c0c",
|
|
1046
|
+
data: {
|
|
1047
|
+
type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
|
|
1048
|
+
data: {
|
|
1049
|
+
coin: {
|
|
1050
|
+
value: "2500000",
|
|
1051
|
+
},
|
|
1052
|
+
deposit_events: {
|
|
1053
|
+
counter: "8",
|
|
1054
|
+
guid: {
|
|
1055
|
+
id: {
|
|
1056
|
+
addr: "0x4e5e",
|
|
1057
|
+
creation_num: "4",
|
|
1058
|
+
},
|
|
1059
|
+
},
|
|
1060
|
+
},
|
|
1061
|
+
frozen: false,
|
|
1062
|
+
withdraw_events: {
|
|
1063
|
+
counter: "6",
|
|
1064
|
+
guid: {
|
|
1065
|
+
id: {
|
|
1066
|
+
addr: "0x4e5e",
|
|
1067
|
+
creation_num: "5",
|
|
1068
|
+
},
|
|
1069
|
+
},
|
|
1070
|
+
},
|
|
1071
|
+
},
|
|
1072
|
+
},
|
|
1073
|
+
type: "write_resource",
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
address: address,
|
|
1077
|
+
state_key_hash: "0x1709",
|
|
1078
|
+
data: {
|
|
1079
|
+
type: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
|
|
1080
|
+
data: {
|
|
1081
|
+
coin: {
|
|
1082
|
+
value: "68255318",
|
|
1083
|
+
},
|
|
1084
|
+
deposit_events: {
|
|
1085
|
+
counter: "46",
|
|
1086
|
+
guid: {
|
|
1087
|
+
id: {
|
|
1088
|
+
addr: address,
|
|
1089
|
+
creation_num: "2",
|
|
1090
|
+
},
|
|
1091
|
+
},
|
|
1092
|
+
},
|
|
1093
|
+
frozen: false,
|
|
1094
|
+
withdraw_events: {
|
|
1095
|
+
counter: "89",
|
|
1096
|
+
guid: {
|
|
1097
|
+
id: {
|
|
1098
|
+
addr: address,
|
|
1099
|
+
creation_num: "3",
|
|
1100
|
+
},
|
|
1101
|
+
},
|
|
1102
|
+
},
|
|
1103
|
+
},
|
|
1104
|
+
},
|
|
1105
|
+
type: "write_resource",
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
address: address,
|
|
1109
|
+
state_key_hash: "0x5520",
|
|
1110
|
+
data: {
|
|
1111
|
+
type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
|
|
1112
|
+
data: {
|
|
1113
|
+
coin: {
|
|
1114
|
+
value: "2500000",
|
|
1115
|
+
},
|
|
1116
|
+
deposit_events: {
|
|
1117
|
+
counter: "7",
|
|
1118
|
+
guid: {
|
|
1119
|
+
id: {
|
|
1120
|
+
addr: address,
|
|
1121
|
+
creation_num: "10",
|
|
1122
|
+
},
|
|
1123
|
+
},
|
|
1124
|
+
},
|
|
1125
|
+
frozen: false,
|
|
1126
|
+
withdraw_events: {
|
|
1127
|
+
counter: "12",
|
|
1128
|
+
guid: {
|
|
1129
|
+
id: {
|
|
1130
|
+
addr: address,
|
|
1131
|
+
creation_num: "11",
|
|
1132
|
+
},
|
|
1133
|
+
},
|
|
1134
|
+
},
|
|
1135
|
+
},
|
|
1136
|
+
},
|
|
1137
|
+
type: "write_resource",
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
address: address,
|
|
1141
|
+
state_key_hash: "0x6f1e",
|
|
1142
|
+
data: {
|
|
1143
|
+
type: "0x1::account::Account",
|
|
1144
|
+
data: {
|
|
1145
|
+
authentication_key: address,
|
|
1146
|
+
coin_register_events: {
|
|
1147
|
+
counter: "5",
|
|
1148
|
+
guid: {
|
|
1149
|
+
id: {
|
|
1150
|
+
addr: address,
|
|
1151
|
+
creation_num: "0",
|
|
1152
|
+
},
|
|
1153
|
+
},
|
|
1154
|
+
},
|
|
1155
|
+
guid_creation_num: "12",
|
|
1156
|
+
key_rotation_events: {
|
|
1157
|
+
counter: "0",
|
|
1158
|
+
guid: {
|
|
1159
|
+
id: {
|
|
1160
|
+
addr: address,
|
|
1161
|
+
creation_num: "1",
|
|
1162
|
+
},
|
|
1163
|
+
},
|
|
1164
|
+
},
|
|
1165
|
+
rotation_capability_offer: {
|
|
1166
|
+
for: {
|
|
1167
|
+
vec: [],
|
|
1168
|
+
},
|
|
1169
|
+
},
|
|
1170
|
+
sequence_number: "121",
|
|
1171
|
+
signer_capability_offer: {
|
|
1172
|
+
for: {
|
|
1173
|
+
vec: [],
|
|
1174
|
+
},
|
|
1175
|
+
},
|
|
1176
|
+
},
|
|
1177
|
+
},
|
|
1178
|
+
type: "write_resource",
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
state_key_hash: "0x6e4b",
|
|
1182
|
+
handle: "0x1b85",
|
|
1183
|
+
key: "0x0619",
|
|
1184
|
+
value: "0xe86e0039581497010000000000000000",
|
|
1185
|
+
type: "write_table_item",
|
|
1186
|
+
},
|
|
1187
|
+
],
|
|
1188
|
+
sender: address,
|
|
1189
|
+
sequence_number: "120",
|
|
1190
|
+
max_gas_amount: "12",
|
|
1191
|
+
gas_unit_price: "100",
|
|
1192
|
+
expiration_timestamp_secs: "1743176706",
|
|
1193
|
+
payload: {
|
|
1194
|
+
function: "0x1::aptos_account::transfer_coins",
|
|
1195
|
+
type_arguments: ["0xd111::staked_coin::StakedAptos"],
|
|
1196
|
+
arguments: ["0x4e5e", "2500000"],
|
|
1197
|
+
type: "entry_function_payload",
|
|
1198
|
+
},
|
|
1199
|
+
events: [
|
|
1200
|
+
{
|
|
1201
|
+
guid: {
|
|
1202
|
+
creation_number: "11",
|
|
1203
|
+
account_address: address,
|
|
1204
|
+
},
|
|
1205
|
+
sequence_number: "11",
|
|
1206
|
+
type: "0x1::coin::WithdrawEvent",
|
|
1207
|
+
data: {
|
|
1208
|
+
amount: "2500000",
|
|
1209
|
+
},
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
guid: {
|
|
1213
|
+
creation_number: "4",
|
|
1214
|
+
account_address: "0x4e5e",
|
|
1215
|
+
},
|
|
1216
|
+
sequence_number: "7",
|
|
1217
|
+
type: "0x1::coin::DepositEvent",
|
|
1218
|
+
data: {
|
|
1219
|
+
amount: "2500000",
|
|
1220
|
+
},
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
guid: {
|
|
1224
|
+
creation_number: "0",
|
|
1225
|
+
account_address: "0x0",
|
|
1226
|
+
},
|
|
1227
|
+
sequence_number: "0",
|
|
1228
|
+
type: "0x1::transaction_fee::FeeStatement",
|
|
1229
|
+
data: {
|
|
1230
|
+
execution_gas_units: "6",
|
|
1231
|
+
io_gas_units: "6",
|
|
1232
|
+
storage_fee_octas: "0",
|
|
1233
|
+
storage_fee_refund_octas: "0",
|
|
1234
|
+
total_charge_gas_units: "12",
|
|
1235
|
+
},
|
|
1236
|
+
},
|
|
1237
|
+
],
|
|
1238
|
+
timestamp: "1743176594693251",
|
|
1239
|
+
type: TransactionResponseType.User,
|
|
1240
|
+
block: {
|
|
1241
|
+
height: 311942427,
|
|
1242
|
+
hash: "0x8655",
|
|
1243
|
+
},
|
|
1244
|
+
},
|
|
1245
|
+
];
|
|
1246
|
+
|
|
1247
|
+
const transactions: AptosTransaction[] = txs;
|
|
1248
|
+
|
|
1249
|
+
api.getAccountInfo = jest.fn().mockResolvedValue({ transactions });
|
|
1250
|
+
|
|
1251
|
+
const ops = await api.listOperations(address, pagination);
|
|
1252
|
+
|
|
1253
|
+
expect(ops[0]).toHaveLength(2);
|
|
1254
|
+
expect(ops[1]).toBe("");
|
|
1255
|
+
});
|
|
617
1256
|
});
|
|
618
1257
|
});
|