@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
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { ApolloClient } from "@apollo/client";
|
|
2
|
-
import { AccountAddress, Aptos, Ed25519PublicKey, RawTransaction,
|
|
2
|
+
import { AccountAddress, Aptos, Ed25519PublicKey, Hex, RawTransaction, postAptosFullNode, TransactionResponseType, } from "@aptos-labs/ts-sdk";
|
|
3
3
|
import network from "@ledgerhq/live-network";
|
|
4
4
|
import BigNumber from "bignumber.js";
|
|
5
5
|
import { AptosAPI } from "../../network";
|
|
6
|
+
import { APTOS_ASSET_ID } from "../../constants";
|
|
6
7
|
jest.mock("@aptos-labs/ts-sdk");
|
|
7
8
|
jest.mock("@apollo/client");
|
|
8
9
|
let mockedAptos;
|
|
9
10
|
let mockedApolloClient;
|
|
10
11
|
let mockedPost = jest.fn();
|
|
12
|
+
let mockedHex;
|
|
11
13
|
jest.mock("@ledgerhq/live-network/network");
|
|
12
14
|
const mockedNetwork = jest.mocked(network);
|
|
15
|
+
jest.mock("@ledgerhq/cryptoassets/tokens", () => ({
|
|
16
|
+
findTokenByAddressInCurrency: jest.fn().mockReturnValue("token-name"),
|
|
17
|
+
}));
|
|
13
18
|
describe("Aptos API", () => {
|
|
14
19
|
beforeEach(() => {
|
|
15
20
|
mockedAptos = jest.mocked(Aptos);
|
|
21
|
+
mockedHex = jest.mocked(Hex);
|
|
16
22
|
mockedApolloClient = jest.mocked(ApolloClient);
|
|
17
|
-
mockedPost = jest.mocked(
|
|
23
|
+
mockedPost = jest.mocked(postAptosFullNode);
|
|
18
24
|
});
|
|
19
25
|
afterEach(() => jest.clearAllMocks());
|
|
20
26
|
it("builds the client properly for mainnet", () => {
|
|
@@ -453,32 +459,36 @@ describe("Aptos API", () => {
|
|
|
453
459
|
describe("broadcast", () => {
|
|
454
460
|
it("broadcasts the transaction", async () => {
|
|
455
461
|
mockedPost.mockImplementation(async () => ({ data: { hash: "ok" } }));
|
|
456
|
-
const mockedPostSpy = jest.spyOn({
|
|
462
|
+
const mockedPostSpy = jest.spyOn({ postAptosFullNode: mockedPost }, "postAptosFullNode");
|
|
463
|
+
// const txBytes = Hex.fromHexString(tx).toUint8Array();
|
|
457
464
|
mockedAptos.mockImplementation(() => ({
|
|
458
465
|
config: "config",
|
|
459
466
|
}));
|
|
467
|
+
mockedHex.fromHexString = jest.fn().mockReturnValue({ toUint8Array: () => "123" });
|
|
460
468
|
const api = new AptosAPI("aptos");
|
|
461
|
-
await api.broadcast("
|
|
469
|
+
await api.broadcast("signed transaction");
|
|
462
470
|
expect(mockedPostSpy).toHaveBeenCalledWith({
|
|
463
|
-
contentType: "application/x.aptos.signed_transaction+bcs",
|
|
464
471
|
aptosConfig: "config",
|
|
465
|
-
body:
|
|
472
|
+
body: "123",
|
|
466
473
|
path: "transactions",
|
|
467
|
-
type: "Fullnode",
|
|
468
474
|
originMethod: "",
|
|
475
|
+
contentType: "application/x.aptos.signed_transaction+bcs",
|
|
469
476
|
});
|
|
470
477
|
});
|
|
471
478
|
});
|
|
472
479
|
describe("estimateFees", () => {
|
|
473
|
-
it("estimates the fees", async () => {
|
|
480
|
+
it("estimates the fees for native asset", async () => {
|
|
474
481
|
const gasEstimation = { gas_estimate: 100 };
|
|
482
|
+
const buildSimple = jest.fn().mockResolvedValue({ rawTransaction: {} });
|
|
483
|
+
const time = new Date("2025-05-29");
|
|
484
|
+
jest.useFakeTimers().setSystemTime(time);
|
|
475
485
|
mockedAptos.mockImplementation(() => ({
|
|
476
486
|
getLedgerInfo: jest.fn().mockResolvedValue({
|
|
477
|
-
ledger_timestamp:
|
|
487
|
+
ledger_timestamp: time,
|
|
478
488
|
}),
|
|
479
489
|
transaction: {
|
|
480
490
|
build: {
|
|
481
|
-
simple:
|
|
491
|
+
simple: buildSimple,
|
|
482
492
|
},
|
|
483
493
|
simulate: {
|
|
484
494
|
simple: jest.fn().mockResolvedValue([
|
|
@@ -508,8 +518,602 @@ describe("Aptos API", () => {
|
|
|
508
518
|
recipient,
|
|
509
519
|
};
|
|
510
520
|
const fees = await api.estimateFees(transactionIntent);
|
|
521
|
+
expect(buildSimple.mock.calls[0][0]).toEqual({
|
|
522
|
+
sender: "address1",
|
|
523
|
+
data: {
|
|
524
|
+
function: "0x1::aptos_account::transfer_coins",
|
|
525
|
+
typeArguments: ["0x1::aptos_coin::AptosCoin"],
|
|
526
|
+
functionArguments: ["address2", 100n],
|
|
527
|
+
},
|
|
528
|
+
options: {
|
|
529
|
+
maxGasAmount: 200,
|
|
530
|
+
gasUnitPrice: 100,
|
|
531
|
+
expireTimestamp: Number(Math.ceil(+time / 1_000_000 + 2 * 60)),
|
|
532
|
+
},
|
|
533
|
+
});
|
|
511
534
|
expect(fees.value.toString()).toEqual("40");
|
|
512
535
|
});
|
|
536
|
+
it("estimates the fees for token coin", async () => {
|
|
537
|
+
const gasEstimation = { gas_estimate: 100 };
|
|
538
|
+
const buildSimple = jest.fn().mockResolvedValue({ rawTransaction: {} });
|
|
539
|
+
const time = new Date("2025-05-29");
|
|
540
|
+
jest.useFakeTimers().setSystemTime(time);
|
|
541
|
+
mockedAptos.mockImplementation(() => ({
|
|
542
|
+
getLedgerInfo: jest.fn().mockResolvedValue({
|
|
543
|
+
ledger_timestamp: time,
|
|
544
|
+
}),
|
|
545
|
+
transaction: {
|
|
546
|
+
build: {
|
|
547
|
+
simple: buildSimple,
|
|
548
|
+
},
|
|
549
|
+
simulate: {
|
|
550
|
+
simple: jest.fn().mockResolvedValue([
|
|
551
|
+
{
|
|
552
|
+
gas_used: 10,
|
|
553
|
+
gas_unit_price: 2,
|
|
554
|
+
},
|
|
555
|
+
]),
|
|
556
|
+
},
|
|
557
|
+
},
|
|
558
|
+
getGasPriceEstimation: jest.fn().mockReturnValue(gasEstimation),
|
|
559
|
+
}));
|
|
560
|
+
const amount = BigInt(100);
|
|
561
|
+
const sender = {
|
|
562
|
+
xpub: "xpub",
|
|
563
|
+
freshAddress: "address1",
|
|
564
|
+
};
|
|
565
|
+
const recipient = "address2";
|
|
566
|
+
const api = new AptosAPI("aptos");
|
|
567
|
+
const transactionIntent = {
|
|
568
|
+
asset: {
|
|
569
|
+
type: "token",
|
|
570
|
+
standard: "coin",
|
|
571
|
+
contractAddress: "0x111",
|
|
572
|
+
},
|
|
573
|
+
type: "send",
|
|
574
|
+
sender,
|
|
575
|
+
amount,
|
|
576
|
+
recipient,
|
|
577
|
+
};
|
|
578
|
+
const fees = await api.estimateFees(transactionIntent);
|
|
579
|
+
expect(buildSimple.mock.calls[0][0]).toEqual({
|
|
580
|
+
sender: "address1",
|
|
581
|
+
data: {
|
|
582
|
+
function: "0x1::aptos_account::transfer_coins",
|
|
583
|
+
typeArguments: ["0x111"],
|
|
584
|
+
functionArguments: ["address2", 100n],
|
|
585
|
+
},
|
|
586
|
+
options: {
|
|
587
|
+
maxGasAmount: 200,
|
|
588
|
+
gasUnitPrice: 100,
|
|
589
|
+
expireTimestamp: Number(Math.ceil(+time / 1_000_000 + 2 * 60)),
|
|
590
|
+
},
|
|
591
|
+
});
|
|
592
|
+
expect(fees.value.toString()).toEqual("20");
|
|
593
|
+
});
|
|
594
|
+
it("estimates the fees for token FA", async () => {
|
|
595
|
+
const gasEstimation = { gas_estimate: 100 };
|
|
596
|
+
const buildSimple = jest.fn().mockResolvedValue({ rawTransaction: {} });
|
|
597
|
+
const time = new Date("2025-05-29");
|
|
598
|
+
jest.useFakeTimers().setSystemTime(time);
|
|
599
|
+
mockedAptos.mockImplementation(() => ({
|
|
600
|
+
getLedgerInfo: jest.fn().mockResolvedValue({
|
|
601
|
+
ledger_timestamp: time,
|
|
602
|
+
}),
|
|
603
|
+
transaction: {
|
|
604
|
+
build: {
|
|
605
|
+
simple: buildSimple,
|
|
606
|
+
},
|
|
607
|
+
simulate: {
|
|
608
|
+
simple: jest.fn().mockResolvedValue([
|
|
609
|
+
{
|
|
610
|
+
gas_used: 10,
|
|
611
|
+
gas_unit_price: 3,
|
|
612
|
+
},
|
|
613
|
+
]),
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
getGasPriceEstimation: jest.fn().mockReturnValue(gasEstimation),
|
|
617
|
+
}));
|
|
618
|
+
const amount = BigInt(100);
|
|
619
|
+
const sender = {
|
|
620
|
+
xpub: "xpub",
|
|
621
|
+
freshAddress: "address1",
|
|
622
|
+
};
|
|
623
|
+
const recipient = "address2";
|
|
624
|
+
const api = new AptosAPI("aptos");
|
|
625
|
+
const transactionIntent = {
|
|
626
|
+
asset: {
|
|
627
|
+
type: "token",
|
|
628
|
+
standard: "fungible_asset",
|
|
629
|
+
contractAddress: "0x111",
|
|
630
|
+
},
|
|
631
|
+
type: "send",
|
|
632
|
+
sender,
|
|
633
|
+
amount,
|
|
634
|
+
recipient,
|
|
635
|
+
};
|
|
636
|
+
const fees = await api.estimateFees(transactionIntent);
|
|
637
|
+
expect(buildSimple.mock.calls[0][0]).toEqual({
|
|
638
|
+
sender: "address1",
|
|
639
|
+
data: {
|
|
640
|
+
function: "0x1::primary_fungible_store::transfer",
|
|
641
|
+
typeArguments: ["0x1::fungible_asset::Metadata"],
|
|
642
|
+
functionArguments: ["0x111", "address2", 100n],
|
|
643
|
+
},
|
|
644
|
+
options: {
|
|
645
|
+
maxGasAmount: 200,
|
|
646
|
+
gasUnitPrice: 100,
|
|
647
|
+
expireTimestamp: Number(Math.ceil(+time / 1_000_000 + 2 * 60)),
|
|
648
|
+
},
|
|
649
|
+
});
|
|
650
|
+
expect(fees.value.toString()).toEqual("30");
|
|
651
|
+
});
|
|
652
|
+
});
|
|
653
|
+
describe("getBalances", () => {
|
|
654
|
+
it("returns an array of AptosBalances objects", async () => {
|
|
655
|
+
const assets = [{ asset_type: APTOS_ASSET_ID, amount: 200 }];
|
|
656
|
+
const mockGetCurrentFungibleAssetBalances = jest.fn().mockResolvedValue(assets);
|
|
657
|
+
mockedAptos.mockImplementation(() => ({
|
|
658
|
+
getCurrentFungibleAssetBalances: mockGetCurrentFungibleAssetBalances,
|
|
659
|
+
}));
|
|
660
|
+
const address = "0x42";
|
|
661
|
+
const api = new AptosAPI("aptos");
|
|
662
|
+
const balances = await api.getBalances(address);
|
|
663
|
+
expect(mockGetCurrentFungibleAssetBalances).toHaveBeenCalledWith({
|
|
664
|
+
options: {
|
|
665
|
+
offset: 0,
|
|
666
|
+
limit: 1000,
|
|
667
|
+
where: {
|
|
668
|
+
asset_type: { _eq: APTOS_ASSET_ID },
|
|
669
|
+
owner_address: { _eq: address },
|
|
670
|
+
},
|
|
671
|
+
},
|
|
672
|
+
});
|
|
673
|
+
expect(balances).toHaveLength(1);
|
|
674
|
+
expect(balances[0].contractAddress).toBe(assets[0].asset_type);
|
|
675
|
+
expect(balances[0].amount).toStrictEqual(BigNumber(assets[0].amount));
|
|
676
|
+
});
|
|
677
|
+
});
|
|
678
|
+
describe("listOperations", () => {
|
|
679
|
+
it("list of operations", async () => {
|
|
680
|
+
const api = new AptosAPI("aptos");
|
|
681
|
+
const address = "0x12345";
|
|
682
|
+
const pagination = { minHeight: 0 };
|
|
683
|
+
const txs = [
|
|
684
|
+
{
|
|
685
|
+
version: "2532591427",
|
|
686
|
+
hash: "0x3f35",
|
|
687
|
+
state_change_hash: "0xb480",
|
|
688
|
+
event_root_hash: "0x3fa1",
|
|
689
|
+
state_checkpoint_hash: null,
|
|
690
|
+
gas_used: "12",
|
|
691
|
+
success: true,
|
|
692
|
+
vm_status: "Executed successfully",
|
|
693
|
+
accumulator_root_hash: "0x319f",
|
|
694
|
+
changes: [
|
|
695
|
+
{
|
|
696
|
+
address: "0x4e5e",
|
|
697
|
+
state_key_hash: "0x3c0c",
|
|
698
|
+
data: {
|
|
699
|
+
type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
|
|
700
|
+
data: {
|
|
701
|
+
coin: {
|
|
702
|
+
value: "4000000",
|
|
703
|
+
},
|
|
704
|
+
deposit_events: {
|
|
705
|
+
counter: "9",
|
|
706
|
+
guid: {
|
|
707
|
+
id: {
|
|
708
|
+
addr: "0x4e5e",
|
|
709
|
+
creation_num: "4",
|
|
710
|
+
},
|
|
711
|
+
},
|
|
712
|
+
},
|
|
713
|
+
frozen: false,
|
|
714
|
+
withdraw_events: {
|
|
715
|
+
counter: "6",
|
|
716
|
+
guid: {
|
|
717
|
+
id: {
|
|
718
|
+
addr: "0x4e5e",
|
|
719
|
+
creation_num: "5",
|
|
720
|
+
},
|
|
721
|
+
},
|
|
722
|
+
},
|
|
723
|
+
},
|
|
724
|
+
},
|
|
725
|
+
type: "write_resource",
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
address: address,
|
|
729
|
+
state_key_hash: "0x1709",
|
|
730
|
+
data: {
|
|
731
|
+
type: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
|
|
732
|
+
data: {
|
|
733
|
+
coin: {
|
|
734
|
+
value: "68254118",
|
|
735
|
+
},
|
|
736
|
+
deposit_events: {
|
|
737
|
+
counter: "46",
|
|
738
|
+
guid: {
|
|
739
|
+
id: {
|
|
740
|
+
addr: address,
|
|
741
|
+
creation_num: "2",
|
|
742
|
+
},
|
|
743
|
+
},
|
|
744
|
+
},
|
|
745
|
+
frozen: false,
|
|
746
|
+
withdraw_events: {
|
|
747
|
+
counter: "89",
|
|
748
|
+
guid: {
|
|
749
|
+
id: {
|
|
750
|
+
addr: address,
|
|
751
|
+
creation_num: "3",
|
|
752
|
+
},
|
|
753
|
+
},
|
|
754
|
+
},
|
|
755
|
+
},
|
|
756
|
+
},
|
|
757
|
+
type: "write_resource",
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
address: address,
|
|
761
|
+
state_key_hash: "0x5520",
|
|
762
|
+
data: {
|
|
763
|
+
type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
|
|
764
|
+
data: {
|
|
765
|
+
coin: {
|
|
766
|
+
value: "1000000",
|
|
767
|
+
},
|
|
768
|
+
deposit_events: {
|
|
769
|
+
counter: "7",
|
|
770
|
+
guid: {
|
|
771
|
+
id: {
|
|
772
|
+
addr: address,
|
|
773
|
+
creation_num: "10",
|
|
774
|
+
},
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
frozen: false,
|
|
778
|
+
withdraw_events: {
|
|
779
|
+
counter: "13",
|
|
780
|
+
guid: {
|
|
781
|
+
id: {
|
|
782
|
+
addr: address,
|
|
783
|
+
creation_num: "11",
|
|
784
|
+
},
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
},
|
|
788
|
+
},
|
|
789
|
+
type: "write_resource",
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
address: address,
|
|
793
|
+
state_key_hash: "0x6f1e",
|
|
794
|
+
data: {
|
|
795
|
+
type: "0x1::account::Account",
|
|
796
|
+
data: {
|
|
797
|
+
authentication_key: address,
|
|
798
|
+
coin_register_events: {
|
|
799
|
+
counter: "5",
|
|
800
|
+
guid: {
|
|
801
|
+
id: {
|
|
802
|
+
addr: address,
|
|
803
|
+
creation_num: "0",
|
|
804
|
+
},
|
|
805
|
+
},
|
|
806
|
+
},
|
|
807
|
+
guid_creation_num: "12",
|
|
808
|
+
key_rotation_events: {
|
|
809
|
+
counter: "0",
|
|
810
|
+
guid: {
|
|
811
|
+
id: {
|
|
812
|
+
addr: address,
|
|
813
|
+
creation_num: "1",
|
|
814
|
+
},
|
|
815
|
+
},
|
|
816
|
+
},
|
|
817
|
+
rotation_capability_offer: {
|
|
818
|
+
for: {
|
|
819
|
+
vec: [],
|
|
820
|
+
},
|
|
821
|
+
},
|
|
822
|
+
sequence_number: "122",
|
|
823
|
+
signer_capability_offer: {
|
|
824
|
+
for: {
|
|
825
|
+
vec: [],
|
|
826
|
+
},
|
|
827
|
+
},
|
|
828
|
+
},
|
|
829
|
+
},
|
|
830
|
+
type: "write_resource",
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
state_key_hash: "0x6e4b",
|
|
834
|
+
handle: "0x1b85",
|
|
835
|
+
key: "0x0619",
|
|
836
|
+
value: "0x1ddaf8da3b1497010000000000000000",
|
|
837
|
+
type: "write_table_item",
|
|
838
|
+
},
|
|
839
|
+
],
|
|
840
|
+
sender: address,
|
|
841
|
+
sequence_number: "121",
|
|
842
|
+
max_gas_amount: "12",
|
|
843
|
+
gas_unit_price: "100",
|
|
844
|
+
expiration_timestamp_secs: "1743177404",
|
|
845
|
+
payload: {
|
|
846
|
+
function: "0x1::aptos_account::transfer_coins",
|
|
847
|
+
type_arguments: ["0xd111::staked_coin::StakedAptos"],
|
|
848
|
+
arguments: ["0x4e5e", "1500000"],
|
|
849
|
+
type: "entry_function_payload",
|
|
850
|
+
},
|
|
851
|
+
events: [
|
|
852
|
+
{
|
|
853
|
+
guid: {
|
|
854
|
+
creation_number: "11",
|
|
855
|
+
account_address: address,
|
|
856
|
+
},
|
|
857
|
+
sequence_number: "12",
|
|
858
|
+
type: "0x1::coin::WithdrawEvent",
|
|
859
|
+
data: {
|
|
860
|
+
amount: "1500000",
|
|
861
|
+
},
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
guid: {
|
|
865
|
+
creation_number: "4",
|
|
866
|
+
account_address: "0x4e5e",
|
|
867
|
+
},
|
|
868
|
+
sequence_number: "8",
|
|
869
|
+
type: "0x1::coin::DepositEvent",
|
|
870
|
+
data: {
|
|
871
|
+
amount: "1500000",
|
|
872
|
+
},
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
guid: {
|
|
876
|
+
creation_number: "0",
|
|
877
|
+
account_address: "0x0",
|
|
878
|
+
},
|
|
879
|
+
sequence_number: "0",
|
|
880
|
+
type: "0x1::transaction_fee::FeeStatement",
|
|
881
|
+
data: {
|
|
882
|
+
execution_gas_units: "6",
|
|
883
|
+
io_gas_units: "6",
|
|
884
|
+
storage_fee_octas: "0",
|
|
885
|
+
storage_fee_refund_octas: "0",
|
|
886
|
+
total_charge_gas_units: "12",
|
|
887
|
+
},
|
|
888
|
+
},
|
|
889
|
+
],
|
|
890
|
+
timestamp: "1743177360481259",
|
|
891
|
+
type: TransactionResponseType.User,
|
|
892
|
+
block: {
|
|
893
|
+
height: 311948147,
|
|
894
|
+
hash: "0x6d02",
|
|
895
|
+
},
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
version: "2532549325",
|
|
899
|
+
hash: "0x9a6b",
|
|
900
|
+
state_change_hash: "0xa424",
|
|
901
|
+
event_root_hash: "0x0321",
|
|
902
|
+
state_checkpoint_hash: null,
|
|
903
|
+
gas_used: "12",
|
|
904
|
+
success: true,
|
|
905
|
+
vm_status: "Executed successfully",
|
|
906
|
+
accumulator_root_hash: "0xede9",
|
|
907
|
+
changes: [
|
|
908
|
+
{
|
|
909
|
+
address: "0x4e5e",
|
|
910
|
+
state_key_hash: "0x3c0c",
|
|
911
|
+
data: {
|
|
912
|
+
type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
|
|
913
|
+
data: {
|
|
914
|
+
coin: {
|
|
915
|
+
value: "2500000",
|
|
916
|
+
},
|
|
917
|
+
deposit_events: {
|
|
918
|
+
counter: "8",
|
|
919
|
+
guid: {
|
|
920
|
+
id: {
|
|
921
|
+
addr: "0x4e5e",
|
|
922
|
+
creation_num: "4",
|
|
923
|
+
},
|
|
924
|
+
},
|
|
925
|
+
},
|
|
926
|
+
frozen: false,
|
|
927
|
+
withdraw_events: {
|
|
928
|
+
counter: "6",
|
|
929
|
+
guid: {
|
|
930
|
+
id: {
|
|
931
|
+
addr: "0x4e5e",
|
|
932
|
+
creation_num: "5",
|
|
933
|
+
},
|
|
934
|
+
},
|
|
935
|
+
},
|
|
936
|
+
},
|
|
937
|
+
},
|
|
938
|
+
type: "write_resource",
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
address: address,
|
|
942
|
+
state_key_hash: "0x1709",
|
|
943
|
+
data: {
|
|
944
|
+
type: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
|
|
945
|
+
data: {
|
|
946
|
+
coin: {
|
|
947
|
+
value: "68255318",
|
|
948
|
+
},
|
|
949
|
+
deposit_events: {
|
|
950
|
+
counter: "46",
|
|
951
|
+
guid: {
|
|
952
|
+
id: {
|
|
953
|
+
addr: address,
|
|
954
|
+
creation_num: "2",
|
|
955
|
+
},
|
|
956
|
+
},
|
|
957
|
+
},
|
|
958
|
+
frozen: false,
|
|
959
|
+
withdraw_events: {
|
|
960
|
+
counter: "89",
|
|
961
|
+
guid: {
|
|
962
|
+
id: {
|
|
963
|
+
addr: address,
|
|
964
|
+
creation_num: "3",
|
|
965
|
+
},
|
|
966
|
+
},
|
|
967
|
+
},
|
|
968
|
+
},
|
|
969
|
+
},
|
|
970
|
+
type: "write_resource",
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
address: address,
|
|
974
|
+
state_key_hash: "0x5520",
|
|
975
|
+
data: {
|
|
976
|
+
type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
|
|
977
|
+
data: {
|
|
978
|
+
coin: {
|
|
979
|
+
value: "2500000",
|
|
980
|
+
},
|
|
981
|
+
deposit_events: {
|
|
982
|
+
counter: "7",
|
|
983
|
+
guid: {
|
|
984
|
+
id: {
|
|
985
|
+
addr: address,
|
|
986
|
+
creation_num: "10",
|
|
987
|
+
},
|
|
988
|
+
},
|
|
989
|
+
},
|
|
990
|
+
frozen: false,
|
|
991
|
+
withdraw_events: {
|
|
992
|
+
counter: "12",
|
|
993
|
+
guid: {
|
|
994
|
+
id: {
|
|
995
|
+
addr: address,
|
|
996
|
+
creation_num: "11",
|
|
997
|
+
},
|
|
998
|
+
},
|
|
999
|
+
},
|
|
1000
|
+
},
|
|
1001
|
+
},
|
|
1002
|
+
type: "write_resource",
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
address: address,
|
|
1006
|
+
state_key_hash: "0x6f1e",
|
|
1007
|
+
data: {
|
|
1008
|
+
type: "0x1::account::Account",
|
|
1009
|
+
data: {
|
|
1010
|
+
authentication_key: address,
|
|
1011
|
+
coin_register_events: {
|
|
1012
|
+
counter: "5",
|
|
1013
|
+
guid: {
|
|
1014
|
+
id: {
|
|
1015
|
+
addr: address,
|
|
1016
|
+
creation_num: "0",
|
|
1017
|
+
},
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
guid_creation_num: "12",
|
|
1021
|
+
key_rotation_events: {
|
|
1022
|
+
counter: "0",
|
|
1023
|
+
guid: {
|
|
1024
|
+
id: {
|
|
1025
|
+
addr: address,
|
|
1026
|
+
creation_num: "1",
|
|
1027
|
+
},
|
|
1028
|
+
},
|
|
1029
|
+
},
|
|
1030
|
+
rotation_capability_offer: {
|
|
1031
|
+
for: {
|
|
1032
|
+
vec: [],
|
|
1033
|
+
},
|
|
1034
|
+
},
|
|
1035
|
+
sequence_number: "121",
|
|
1036
|
+
signer_capability_offer: {
|
|
1037
|
+
for: {
|
|
1038
|
+
vec: [],
|
|
1039
|
+
},
|
|
1040
|
+
},
|
|
1041
|
+
},
|
|
1042
|
+
},
|
|
1043
|
+
type: "write_resource",
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
state_key_hash: "0x6e4b",
|
|
1047
|
+
handle: "0x1b85",
|
|
1048
|
+
key: "0x0619",
|
|
1049
|
+
value: "0xe86e0039581497010000000000000000",
|
|
1050
|
+
type: "write_table_item",
|
|
1051
|
+
},
|
|
1052
|
+
],
|
|
1053
|
+
sender: address,
|
|
1054
|
+
sequence_number: "120",
|
|
1055
|
+
max_gas_amount: "12",
|
|
1056
|
+
gas_unit_price: "100",
|
|
1057
|
+
expiration_timestamp_secs: "1743176706",
|
|
1058
|
+
payload: {
|
|
1059
|
+
function: "0x1::aptos_account::transfer_coins",
|
|
1060
|
+
type_arguments: ["0xd111::staked_coin::StakedAptos"],
|
|
1061
|
+
arguments: ["0x4e5e", "2500000"],
|
|
1062
|
+
type: "entry_function_payload",
|
|
1063
|
+
},
|
|
1064
|
+
events: [
|
|
1065
|
+
{
|
|
1066
|
+
guid: {
|
|
1067
|
+
creation_number: "11",
|
|
1068
|
+
account_address: address,
|
|
1069
|
+
},
|
|
1070
|
+
sequence_number: "11",
|
|
1071
|
+
type: "0x1::coin::WithdrawEvent",
|
|
1072
|
+
data: {
|
|
1073
|
+
amount: "2500000",
|
|
1074
|
+
},
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
guid: {
|
|
1078
|
+
creation_number: "4",
|
|
1079
|
+
account_address: "0x4e5e",
|
|
1080
|
+
},
|
|
1081
|
+
sequence_number: "7",
|
|
1082
|
+
type: "0x1::coin::DepositEvent",
|
|
1083
|
+
data: {
|
|
1084
|
+
amount: "2500000",
|
|
1085
|
+
},
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
guid: {
|
|
1089
|
+
creation_number: "0",
|
|
1090
|
+
account_address: "0x0",
|
|
1091
|
+
},
|
|
1092
|
+
sequence_number: "0",
|
|
1093
|
+
type: "0x1::transaction_fee::FeeStatement",
|
|
1094
|
+
data: {
|
|
1095
|
+
execution_gas_units: "6",
|
|
1096
|
+
io_gas_units: "6",
|
|
1097
|
+
storage_fee_octas: "0",
|
|
1098
|
+
storage_fee_refund_octas: "0",
|
|
1099
|
+
total_charge_gas_units: "12",
|
|
1100
|
+
},
|
|
1101
|
+
},
|
|
1102
|
+
],
|
|
1103
|
+
timestamp: "1743176594693251",
|
|
1104
|
+
type: TransactionResponseType.User,
|
|
1105
|
+
block: {
|
|
1106
|
+
height: 311942427,
|
|
1107
|
+
hash: "0x8655",
|
|
1108
|
+
},
|
|
1109
|
+
},
|
|
1110
|
+
];
|
|
1111
|
+
const transactions = txs;
|
|
1112
|
+
api.getAccountInfo = jest.fn().mockResolvedValue({ transactions });
|
|
1113
|
+
const ops = await api.listOperations(address, pagination);
|
|
1114
|
+
expect(ops[0]).toHaveLength(2);
|
|
1115
|
+
expect(ops[1]).toBe("");
|
|
1116
|
+
});
|
|
513
1117
|
});
|
|
514
1118
|
});
|
|
515
1119
|
//# sourceMappingURL=client.test.js.map
|