@ledgerhq/coin-aptos 2.0.0-nightly.5 → 2.1.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/.turbo/turbo-build.log +1 -1
- package/.unimportedrc.json +18 -6
- package/CHANGELOG.md +178 -34
- package/jest.config.js +2 -1
- package/jest.integ.config.js +8 -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.d.ts +2 -0
- package/lib/__tests__/api/index.integ.test.d.ts.map +1 -0
- package/lib/__tests__/api/index.integ.test.js +319 -0
- package/lib/__tests__/api/index.integ.test.js.map +1 -0
- package/lib/__tests__/api/index.test.js +48 -404
- package/lib/__tests__/api/index.test.js.map +1 -1
- package/lib/__tests__/bridge/broadcast.test.js +5 -5
- package/lib/__tests__/bridge/broadcast.test.js.map +1 -1
- package/lib/__tests__/bridge/getFeesForTransaction.test.js +115 -14
- package/lib/__tests__/bridge/getFeesForTransaction.test.js.map +1 -1
- package/lib/__tests__/bridge/getTransactionStatus.test.js +175 -37
- package/lib/__tests__/bridge/getTransactionStatus.test.js.map +1 -1
- package/lib/__tests__/bridge/logic.test.js +703 -479
- package/lib/__tests__/bridge/logic.test.js.map +1 -1
- package/lib/__tests__/bridge/prepareTransaction.test.js +3 -3
- package/lib/__tests__/bridge/prepareTransaction.test.js.map +1 -1
- package/lib/__tests__/bridge/signOperation.test.js +137 -14
- package/lib/__tests__/bridge/signOperation.test.js.map +1 -1
- package/lib/__tests__/bridge/synchronisation.test.js +1215 -68
- package/lib/__tests__/bridge/synchronisation.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__/logic/buildTransaction.test.js +114 -0
- 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 +2 -2
- 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.d.ts +2 -0
- package/lib/__tests__/network/client.test.d.ts.map +1 -0
- package/lib/__tests__/network/client.test.js +1124 -0
- package/lib/__tests__/network/client.test.js.map +1 -0
- package/lib/api/index.d.ts +4 -30
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +19 -170
- package/lib/api/index.js.map +1 -1
- package/lib/bridge/bridge.fixture.d.ts +2 -0
- package/lib/bridge/bridge.fixture.d.ts.map +1 -1
- package/lib/bridge/bridge.fixture.js +85 -13
- package/lib/bridge/bridge.fixture.js.map +1 -1
- package/lib/bridge/broadcast.d.ts +3 -2
- package/lib/bridge/broadcast.d.ts.map +1 -1
- package/lib/bridge/broadcast.js +4 -3
- package/lib/bridge/broadcast.js.map +1 -1
- package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/estimateMaxSpendable.js +6 -5
- package/lib/bridge/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/getFeesForTransaction.d.ts +1 -1
- package/lib/bridge/getFeesForTransaction.d.ts.map +1 -1
- package/lib/bridge/getFeesForTransaction.js +20 -14
- package/lib/bridge/getFeesForTransaction.js.map +1 -1
- package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/getTransactionStatus.js +28 -14
- package/lib/bridge/getTransactionStatus.js.map +1 -1
- package/lib/bridge/index.d.ts +1 -1
- package/lib/bridge/index.d.ts.map +1 -1
- package/lib/bridge/index.js +1 -1
- package/lib/bridge/index.js.map +1 -1
- package/lib/bridge/logic.d.ts +5 -19
- package/lib/bridge/logic.d.ts.map +1 -1
- package/lib/bridge/logic.js +50 -147
- package/lib/bridge/logic.js.map +1 -1
- package/lib/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/prepareTransaction.js +5 -4
- package/lib/bridge/prepareTransaction.js.map +1 -1
- package/lib/bridge/signOperation.d.ts.map +1 -1
- package/lib/bridge/signOperation.js +21 -7
- package/lib/bridge/signOperation.js.map +1 -1
- package/lib/bridge/synchronisation.d.ts +15 -0
- package/lib/bridge/synchronisation.d.ts.map +1 -1
- package/lib/bridge/synchronisation.js +129 -6
- package/lib/bridge/synchronisation.js.map +1 -1
- package/lib/config.d.ts +13 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +9 -0
- package/lib/config.js.map +1 -0
- package/lib/constants.d.ts +13 -2
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +17 -2
- 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/{bridge → logic}/createTransaction.js +3 -3
- 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 +38 -0
- package/lib/network/client.d.ts.map +1 -0
- package/lib/network/client.js +283 -0
- package/lib/network/client.js.map +1 -0
- package/lib/network/graphql/queries.d.ts.map +1 -0
- package/lib/{api → network}/graphql/queries.js +6 -6
- package/lib/network/graphql/queries.js.map +1 -0
- package/lib/{api → network}/graphql/types.d.ts +9 -9
- package/lib/network/graphql/types.d.ts.map +1 -0
- package/lib/{api → network}/graphql/types.js.map +1 -1
- package/lib/network/index.d.ts +2 -1
- package/lib/network/index.d.ts.map +1 -1
- package/lib/network/index.js +19 -7
- package/lib/network/index.js.map +1 -1
- package/lib/test/bot-specs.d.ts.map +1 -1
- package/lib/test/bot-specs.js +40 -1
- package/lib/test/bot-specs.js.map +1 -1
- package/lib/test/bridgeDatasetTest.d.ts.map +1 -1
- package/lib/test/bridgeDatasetTest.js +44 -62
- package/lib/test/bridgeDatasetTest.js.map +1 -1
- package/lib/test/speculos-deviceActions.d.ts +1 -0
- package/lib/test/speculos-deviceActions.d.ts.map +1 -1
- package/lib/test/speculos-deviceActions.js +37 -5
- package/lib/test/speculos-deviceActions.js.map +1 -1
- package/lib/types/assets.d.ts +16 -0
- package/lib/types/assets.d.ts.map +1 -0
- package/lib/types/assets.js +3 -0
- package/lib/types/assets.js.map +1 -0
- package/lib/types/index.d.ts +22 -7
- 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.d.ts +2 -0
- package/lib-es/__tests__/api/index.integ.test.d.ts.map +1 -0
- package/lib-es/__tests__/api/index.integ.test.js +317 -0
- package/lib-es/__tests__/api/index.integ.test.js.map +1 -0
- package/lib-es/__tests__/api/index.test.js +52 -408
- package/lib-es/__tests__/api/index.test.js.map +1 -1
- package/lib-es/__tests__/bridge/broadcast.test.js +2 -2
- package/lib-es/__tests__/bridge/broadcast.test.js.map +1 -1
- package/lib-es/__tests__/bridge/getFeesForTransaction.test.js +112 -11
- package/lib-es/__tests__/bridge/getFeesForTransaction.test.js.map +1 -1
- package/lib-es/__tests__/bridge/getTransactionStatus.test.js +177 -39
- package/lib-es/__tests__/bridge/getTransactionStatus.test.js.map +1 -1
- package/lib-es/__tests__/bridge/logic.test.js +703 -479
- package/lib-es/__tests__/bridge/logic.test.js.map +1 -1
- package/lib-es/__tests__/bridge/prepareTransaction.test.js +2 -2
- package/lib-es/__tests__/bridge/prepareTransaction.test.js.map +1 -1
- package/lib-es/__tests__/bridge/signOperation.test.js +137 -14
- package/lib-es/__tests__/bridge/signOperation.test.js.map +1 -1
- package/lib-es/__tests__/bridge/synchronisation.test.js +1213 -69
- package/lib-es/__tests__/bridge/synchronisation.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__/logic/buildTransaction.test.js +109 -0
- 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 +2 -2
- 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.d.ts +2 -0
- package/lib-es/__tests__/network/client.test.d.ts.map +1 -0
- package/lib-es/__tests__/network/client.test.js +1119 -0
- package/lib-es/__tests__/network/client.test.js.map +1 -0
- package/lib-es/api/index.d.ts +4 -30
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +17 -168
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/bridge/bridge.fixture.d.ts +2 -0
- package/lib-es/bridge/bridge.fixture.d.ts.map +1 -1
- package/lib-es/bridge/bridge.fixture.js +82 -12
- package/lib-es/bridge/bridge.fixture.js.map +1 -1
- package/lib-es/bridge/broadcast.d.ts +3 -2
- package/lib-es/bridge/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/broadcast.js +4 -3
- package/lib-es/bridge/broadcast.js.map +1 -1
- package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/estimateMaxSpendable.js +4 -3
- package/lib-es/bridge/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/getFeesForTransaction.d.ts +1 -1
- package/lib-es/bridge/getFeesForTransaction.d.ts.map +1 -1
- package/lib-es/bridge/getFeesForTransaction.js +15 -9
- package/lib-es/bridge/getFeesForTransaction.js.map +1 -1
- package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/getTransactionStatus.js +28 -14
- package/lib-es/bridge/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/index.d.ts +1 -1
- package/lib-es/bridge/index.d.ts.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 +5 -19
- package/lib-es/bridge/logic.d.ts.map +1 -1
- package/lib-es/bridge/logic.js +44 -134
- package/lib-es/bridge/logic.js.map +1 -1
- package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/prepareTransaction.js +5 -4
- 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 +19 -5
- package/lib-es/bridge/signOperation.js.map +1 -1
- package/lib-es/bridge/synchronisation.d.ts +15 -0
- package/lib-es/bridge/synchronisation.d.ts.map +1 -1
- package/lib-es/bridge/synchronisation.js +124 -4
- package/lib-es/bridge/synchronisation.js.map +1 -1
- package/lib-es/config.d.ts +13 -0
- package/lib-es/config.d.ts.map +1 -0
- package/lib-es/config.js +4 -0
- package/lib-es/config.js.map +1 -0
- package/lib-es/constants.d.ts +13 -2
- package/lib-es/constants.d.ts.map +1 -1
- package/lib-es/constants.js +13 -1
- 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/{bridge → logic}/createTransaction.js +1 -1
- 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 +38 -0
- package/lib-es/network/client.d.ts.map +1 -0
- package/lib-es/network/client.js +276 -0
- package/lib-es/network/client.js.map +1 -0
- package/lib-es/network/graphql/queries.d.ts.map +1 -0
- package/lib-es/{api → network}/graphql/queries.js +6 -6
- package/lib-es/network/graphql/queries.js.map +1 -0
- package/lib-es/{api → network}/graphql/types.d.ts +9 -9
- package/lib-es/network/graphql/types.d.ts.map +1 -0
- package/lib-es/{api → network}/graphql/types.js.map +1 -1
- package/lib-es/network/index.d.ts +2 -1
- package/lib-es/network/index.d.ts.map +1 -1
- package/lib-es/network/index.js +6 -8
- package/lib-es/network/index.js.map +1 -1
- package/lib-es/test/bot-specs.d.ts.map +1 -1
- package/lib-es/test/bot-specs.js +41 -2
- package/lib-es/test/bot-specs.js.map +1 -1
- package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -1
- package/lib-es/test/bridgeDatasetTest.js +44 -59
- package/lib-es/test/bridgeDatasetTest.js.map +1 -1
- package/lib-es/test/speculos-deviceActions.d.ts +1 -0
- package/lib-es/test/speculos-deviceActions.d.ts.map +1 -1
- package/lib-es/test/speculos-deviceActions.js +36 -4
- package/lib-es/test/speculos-deviceActions.js.map +1 -1
- package/lib-es/types/assets.d.ts +16 -0
- package/lib-es/types/assets.d.ts.map +1 -0
- package/lib-es/types/assets.js +2 -0
- package/lib-es/types/assets.js.map +1 -0
- package/lib-es/types/index.d.ts +22 -7
- package/lib-es/types/index.d.ts.map +1 -1
- package/package.json +16 -13
- 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 +401 -0
- package/src/__tests__/api/index.test.ts +60 -477
- package/src/__tests__/bridge/broadcast.test.ts +2 -2
- package/src/__tests__/bridge/getFeesForTransaction.test.ts +146 -11
- package/src/__tests__/bridge/getTransactionStatus.test.ts +217 -38
- package/src/__tests__/bridge/logic.test.ts +728 -569
- package/src/__tests__/bridge/prepareTransaction.test.ts +2 -2
- package/src/__tests__/bridge/signOperation.test.ts +153 -15
- package/src/__tests__/bridge/synchronisation.test.ts +1265 -71
- package/src/__tests__/index.test.ts +1 -1
- package/src/__tests__/logic/buildTransaction.test.ts +150 -0
- 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 +2 -2
- 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 +1257 -0
- package/src/api/index.ts +29 -224
- package/src/bridge/bridge.fixture.ts +91 -12
- package/src/bridge/broadcast.ts +7 -7
- package/src/bridge/estimateMaxSpendable.ts +4 -3
- package/src/bridge/getFeesForTransaction.ts +17 -11
- package/src/bridge/getTransactionStatus.ts +35 -13
- package/src/bridge/index.ts +2 -2
- package/src/bridge/logic.ts +58 -194
- package/src/bridge/prepareTransaction.ts +7 -4
- package/src/bridge/signOperation.ts +21 -5
- package/src/bridge/synchronisation.ts +171 -4
- package/src/config.ts +19 -0
- package/src/constants.ts +22 -2
- 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/{bridge → logic}/createTransaction.ts +1 -1
- 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 +374 -0
- package/src/{api → network}/graphql/queries.ts +6 -6
- package/src/{api → network}/graphql/types.ts +9 -9
- package/src/network/index.ts +6 -14
- package/src/test/bot-specs.ts +63 -3
- package/src/test/bridgeDatasetTest.ts +46 -59
- package/src/test/speculos-deviceActions.ts +40 -4
- package/src/types/assets.ts +20 -0
- package/src/types/index.ts +20 -1
- package/lib/__tests__/bridge/buildTransaction.test.d.ts.map +0 -1
- package/lib/__tests__/bridge/buildTransaction.test.js +0 -53
- 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/api/graphql/queries.d.ts.map +0 -1
- package/lib/api/graphql/queries.js.map +0 -1
- package/lib/api/graphql/types.d.ts.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 -19
- 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 +0 -48
- 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/api/graphql/queries.d.ts.map +0 -1
- package/lib-es/api/graphql/queries.js.map +0 -1
- package/lib-es/api/graphql/types.d.ts.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 -17
- 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/__tests__/bridge/buildTransaction.test.ts +0 -61
- package/src/bridge/buildTransaction.ts +0 -29
- /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/{api → network}/graphql/queries.d.ts +0 -0
- /package/lib/{api → network}/graphql/types.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/{api → network}/graphql/queries.d.ts +0 -0
- /package/lib-es/{api → network}/graphql/types.js +0 -0
package/src/bridge/logic.ts
CHANGED
|
@@ -1,61 +1,40 @@
|
|
|
1
|
+
import { EntryFunctionPayloadResponse } from "@aptos-labs/ts-sdk";
|
|
2
|
+
import type { Account, Operation, OperationType, TokenAccount } from "@ledgerhq/types-live";
|
|
1
3
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "@aptos-labs/ts-sdk";
|
|
8
|
-
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
|
9
|
-
import type { Operation, OperationType } from "@ledgerhq/types-live";
|
|
4
|
+
decodeTokenAccountId,
|
|
5
|
+
encodeTokenAccountId,
|
|
6
|
+
findSubAccountById,
|
|
7
|
+
isTokenAccount,
|
|
8
|
+
} from "@ledgerhq/coin-framework/account/index";
|
|
10
9
|
import BigNumber from "bignumber.js";
|
|
11
10
|
import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "../
|
|
20
|
-
import type { AptosMoveResource, AptosTransaction, TransactionOptions } from "../types";
|
|
21
|
-
|
|
22
|
-
export const DEFAULT_GAS = new BigNumber(200);
|
|
23
|
-
export const DEFAULT_GAS_PRICE = new BigNumber(100);
|
|
24
|
-
export const ESTIMATE_GAS_MUL = new BigNumber(1.0); // define buffer for gas estimation change here, if needed
|
|
25
|
-
|
|
26
|
-
const CLEAN_HEX_REGEXP = /^0x0*|^0+/;
|
|
27
|
-
|
|
28
|
-
export function isTestnet(currencyId: string): boolean {
|
|
29
|
-
return getCryptoCurrencyById(currencyId).isTestnetFor ? true : false;
|
|
30
|
-
}
|
|
11
|
+
import { APTOS_ASSET_ID, DIRECTION } from "../constants";
|
|
12
|
+
import type { AptosTransaction, Transaction } from "../types";
|
|
13
|
+
import { findTokenByAddressInCurrency } from "@ledgerhq/cryptoassets";
|
|
14
|
+
import { convertFunctionPayloadResponseToInputEntryFunctionData } from "../logic/transactionsToOperations";
|
|
15
|
+
import { compareAddress, getCoinAndAmounts } from "../logic/getCoinAndAmounts";
|
|
16
|
+
import { calculateAmount } from "../logic/calculateAmount";
|
|
17
|
+
import { processRecipients } from "../logic/processRecipients";
|
|
18
|
+
import { getFunctionAddress } from "../logic/getFunctionAddress";
|
|
31
19
|
|
|
32
20
|
export const getMaxSendBalance = (
|
|
33
|
-
amount: BigNumber,
|
|
34
21
|
gas: BigNumber,
|
|
35
22
|
gasPrice: BigNumber,
|
|
23
|
+
account: Account,
|
|
24
|
+
transaction?: Transaction,
|
|
36
25
|
): BigNumber => {
|
|
26
|
+
const tokenAccount = findSubAccountById(account, transaction?.subAccountId ?? "");
|
|
27
|
+
const fromTokenAccount = tokenAccount && isTokenAccount(tokenAccount);
|
|
28
|
+
|
|
37
29
|
const totalGas = gas.multipliedBy(gasPrice);
|
|
38
30
|
|
|
39
|
-
return
|
|
31
|
+
return fromTokenAccount
|
|
32
|
+
? tokenAccount.spendableBalance
|
|
33
|
+
: account.spendableBalance.gt(totalGas)
|
|
34
|
+
? account.spendableBalance.minus(totalGas)
|
|
35
|
+
: new BigNumber(0);
|
|
40
36
|
};
|
|
41
37
|
|
|
42
|
-
export function normalizeTransactionOptions(options: TransactionOptions): TransactionOptions {
|
|
43
|
-
// FIXME: this is wrong. TransactionOptions is
|
|
44
|
-
// {
|
|
45
|
-
// maxGasAmount: string;
|
|
46
|
-
// gasUnitPrice: string;
|
|
47
|
-
// sequenceNumber?: string;
|
|
48
|
-
// expirationTimestampSecs?: string;
|
|
49
|
-
// }
|
|
50
|
-
// meaning we can't return undefined in check method.
|
|
51
|
-
// This method is useless, not deleting as it breaks code and this iteration is coin modularisation.
|
|
52
|
-
const check = (v: any) => ((v ?? "").toString().trim() ? v : undefined);
|
|
53
|
-
return {
|
|
54
|
-
maxGasAmount: check(options.maxGasAmount),
|
|
55
|
-
gasUnitPrice: check(options.gasUnitPrice),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
38
|
export const getBlankOperation = (
|
|
60
39
|
tx: AptosTransaction,
|
|
61
40
|
id: string,
|
|
@@ -76,21 +55,14 @@ export const getBlankOperation = (
|
|
|
76
55
|
hasFailed: false,
|
|
77
56
|
});
|
|
78
57
|
|
|
79
|
-
const convertFunctionPayloadResponseToInputEntryFunctionData = (
|
|
80
|
-
payload: EntryFunctionPayloadResponse,
|
|
81
|
-
): InputEntryFunctionData => ({
|
|
82
|
-
function: payload.function,
|
|
83
|
-
typeArguments: payload.type_arguments,
|
|
84
|
-
functionArguments: payload.arguments,
|
|
85
|
-
});
|
|
86
|
-
|
|
87
58
|
export const txsToOps = (
|
|
88
59
|
info: { address: string },
|
|
89
60
|
id: string,
|
|
90
61
|
txs: (AptosTransaction | null)[],
|
|
91
|
-
): Operation[] => {
|
|
62
|
+
): [Operation[], Operation[]] => {
|
|
92
63
|
const { address } = info;
|
|
93
64
|
const ops: Operation[] = [];
|
|
65
|
+
const opsTokens: Operation[] = [];
|
|
94
66
|
|
|
95
67
|
txs.forEach(tx => {
|
|
96
68
|
if (tx !== null) {
|
|
@@ -107,10 +79,12 @@ export const txsToOps = (
|
|
|
107
79
|
return; // skip transaction without functions in payload
|
|
108
80
|
}
|
|
109
81
|
|
|
110
|
-
const { amount_in, amount_out } =
|
|
111
|
-
op.value = calculateAmount(tx.sender, address,
|
|
82
|
+
const { coin_id, amount_in, amount_out } = getCoinAndAmounts(tx, address);
|
|
83
|
+
op.value = calculateAmount(tx.sender, address, amount_in, amount_out);
|
|
112
84
|
op.type = compareAddress(tx.sender, address) ? DIRECTION.OUT : DIRECTION.IN;
|
|
113
85
|
op.senders.push(tx.sender);
|
|
86
|
+
op.hasFailed = !tx.success;
|
|
87
|
+
op.id = encodeOperationId(op.accountId, tx.hash, op.type);
|
|
114
88
|
|
|
115
89
|
processRecipients(payload, address, op, function_address);
|
|
116
90
|
|
|
@@ -119,147 +93,37 @@ export const txsToOps = (
|
|
|
119
93
|
op.type = DIRECTION.UNKNOWN;
|
|
120
94
|
}
|
|
121
95
|
|
|
122
|
-
op.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const parts = payload.function.split("::");
|
|
141
|
-
return parts.length === 3 && parts[0].length ? parts[0] : undefined;
|
|
142
|
-
}
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export function processRecipients(
|
|
147
|
-
payload: InputEntryFunctionData,
|
|
148
|
-
address: string,
|
|
149
|
-
op: Operation,
|
|
150
|
-
function_address: string,
|
|
151
|
-
): void {
|
|
152
|
-
// get recipients buy 3 groups
|
|
153
|
-
if (
|
|
154
|
-
(TRANSFER_TYPES.includes(payload.function) ||
|
|
155
|
-
DELEGATION_POOL_TYPES.includes(payload.function)) &&
|
|
156
|
-
payload.functionArguments &&
|
|
157
|
-
payload.functionArguments.length > 0 &&
|
|
158
|
-
typeof payload.functionArguments[0] === "string"
|
|
159
|
-
) {
|
|
160
|
-
// 1. Transfer like functions (includes some delegation pool functions)
|
|
161
|
-
op.recipients.push(payload.functionArguments[0].toString());
|
|
162
|
-
} else if (
|
|
163
|
-
BATCH_TRANSFER_TYPES.includes(payload.function) &&
|
|
164
|
-
payload.functionArguments &&
|
|
165
|
-
payload.functionArguments.length > 0 &&
|
|
166
|
-
Array.isArray(payload.functionArguments[0])
|
|
167
|
-
) {
|
|
168
|
-
// 2. Batch function, to validate we are in the recipients list
|
|
169
|
-
if (!compareAddress(op.senders[0], address)) {
|
|
170
|
-
for (const recipient of payload.functionArguments[0]) {
|
|
171
|
-
if (recipient && compareAddress(recipient.toString(), address)) {
|
|
172
|
-
op.recipients.push(recipient.toString());
|
|
96
|
+
if (op.type !== DIRECTION.UNKNOWN && coin_id !== null) {
|
|
97
|
+
if (coin_id === APTOS_ASSET_ID) {
|
|
98
|
+
ops.push(op);
|
|
99
|
+
} else {
|
|
100
|
+
const token = findTokenByAddressInCurrency(coin_id.toLowerCase(), "aptos");
|
|
101
|
+
if (token !== undefined) {
|
|
102
|
+
op.accountId = encodeTokenAccountId(id, token);
|
|
103
|
+
opsTokens.push(op);
|
|
104
|
+
|
|
105
|
+
if (op.type === DIRECTION.OUT) {
|
|
106
|
+
ops.push({
|
|
107
|
+
...op,
|
|
108
|
+
accountId: decodeTokenAccountId(op.accountId).accountId,
|
|
109
|
+
value: op.fee,
|
|
110
|
+
type: "FEES",
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
173
114
|
}
|
|
174
115
|
}
|
|
175
116
|
}
|
|
176
|
-
} else {
|
|
177
|
-
// 3. other smart contracts, in this case smart contract will be treated as a recipient
|
|
178
|
-
op.recipients.push(function_address);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function checkWriteSets(tx: AptosTransaction, event: Event, event_name: string): boolean {
|
|
183
|
-
return tx.changes.some(change => {
|
|
184
|
-
return isChangeOfAptos(change, event, event_name);
|
|
185
117
|
});
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export function isChangeOfAptos(
|
|
189
|
-
writeSetChange: WriteSetChange,
|
|
190
|
-
event: Event,
|
|
191
|
-
event_name: string,
|
|
192
|
-
): boolean {
|
|
193
|
-
// to validate the event is related to Aptos Tokens we need to find change of type "write_resource"
|
|
194
|
-
// with the same guid as event
|
|
195
|
-
if (writeSetChange.type !== WRITE_RESOURCE) {
|
|
196
|
-
return false;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (!("data" in writeSetChange)) {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const change_data = writeSetChange.data;
|
|
204
|
-
|
|
205
|
-
if (!("type" in change_data)) {
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const mr = change_data as MoveResource<AptosMoveResource>;
|
|
210
|
-
|
|
211
|
-
if (mr.type !== APTOS_COIN_CHANGE) {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const change_event_data = mr.data[event_name];
|
|
216
118
|
|
|
217
|
-
return
|
|
218
|
-
|
|
219
|
-
change_event_data.guid.id.creation_num === event.guid.creation_number
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export function getAptosAmounts(
|
|
224
|
-
tx: AptosTransaction,
|
|
225
|
-
address: string,
|
|
226
|
-
): { amount_in: BigNumber; amount_out: BigNumber } {
|
|
227
|
-
let amount_in = new BigNumber(0);
|
|
228
|
-
let amount_out = new BigNumber(0);
|
|
229
|
-
// collect all events related to the address and calculate the overall amounts
|
|
230
|
-
tx.events.forEach(event => {
|
|
231
|
-
if (compareAddress(event.guid.account_address, address)) {
|
|
232
|
-
switch (event.type) {
|
|
233
|
-
case "0x1::coin::WithdrawEvent":
|
|
234
|
-
if (checkWriteSets(tx, event, "withdraw_events")) {
|
|
235
|
-
amount_out = amount_out.plus(event.data.amount);
|
|
236
|
-
}
|
|
237
|
-
break;
|
|
238
|
-
case "0x1::coin::DepositEvent":
|
|
239
|
-
if (checkWriteSets(tx, event, "deposit_events")) {
|
|
240
|
-
amount_in = amount_in.plus(event.data.amount);
|
|
241
|
-
}
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
return { amount_in, amount_out };
|
|
247
|
-
}
|
|
119
|
+
return [ops, opsTokens];
|
|
120
|
+
};
|
|
248
121
|
|
|
249
|
-
export function
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const is_sender: boolean = compareAddress(sender, address);
|
|
257
|
-
// Include fees if our address is the sender
|
|
258
|
-
if (is_sender) {
|
|
259
|
-
amount_out = amount_out.plus(fee);
|
|
260
|
-
}
|
|
261
|
-
// LL negates the amount for SEND transactions
|
|
262
|
-
// to show positive amount on the send transaction (ex: in "cancel" tx, when amount will be returned to our account)
|
|
263
|
-
// we need to make it negative
|
|
264
|
-
return is_sender ? amount_out.minus(amount_in) : amount_in.minus(amount_out);
|
|
122
|
+
export function getTokenAccount(
|
|
123
|
+
account: Account,
|
|
124
|
+
transaction: Transaction,
|
|
125
|
+
): TokenAccount | undefined {
|
|
126
|
+
const tokenAccount = findSubAccountById(account, transaction.subAccountId ?? "");
|
|
127
|
+
const fromTokenAccount = tokenAccount && isTokenAccount(tokenAccount);
|
|
128
|
+
return fromTokenAccount ? tokenAccount : undefined;
|
|
265
129
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Account } from "@ledgerhq/types-live";
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
3
|
|
|
4
|
-
import { AptosAPI } from "../
|
|
4
|
+
import { AptosAPI } from "../network";
|
|
5
5
|
import { getEstimatedGas } from "./getFeesForTransaction";
|
|
6
6
|
import type { Transaction } from "../types";
|
|
7
|
-
import {
|
|
7
|
+
import { getMaxSendBalance } from "./logic";
|
|
8
|
+
import { DEFAULT_GAS, DEFAULT_GAS_PRICE } from "../constants";
|
|
8
9
|
|
|
9
10
|
const prepareTransaction = async (
|
|
10
11
|
account: Account,
|
|
@@ -28,9 +29,10 @@ const prepareTransaction = async (
|
|
|
28
29
|
if (transaction.useAllAmount) {
|
|
29
30
|
// we will use this amount in simulation, to estimate gas
|
|
30
31
|
transaction.amount = getMaxSendBalance(
|
|
31
|
-
account.spendableBalance,
|
|
32
32
|
new BigNumber(DEFAULT_GAS),
|
|
33
33
|
new BigNumber(DEFAULT_GAS_PRICE),
|
|
34
|
+
account,
|
|
35
|
+
transaction,
|
|
34
36
|
);
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -39,9 +41,10 @@ const prepareTransaction = async (
|
|
|
39
41
|
if (transaction.useAllAmount) {
|
|
40
42
|
// correct the transaction amount according to estimated fees
|
|
41
43
|
transaction.amount = getMaxSendBalance(
|
|
42
|
-
account.spendableBalance,
|
|
43
44
|
BigNumber(estimate.maxGasAmount),
|
|
44
45
|
BigNumber(estimate.gasUnitPrice),
|
|
46
|
+
account,
|
|
47
|
+
transaction,
|
|
45
48
|
);
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { AptosAccount, Transaction } from "../types";
|
|
2
2
|
import { Observable } from "rxjs";
|
|
3
3
|
import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
|
|
4
|
-
import buildTransaction from "./buildTransaction";
|
|
5
4
|
import BigNumber from "bignumber.js";
|
|
6
5
|
import type { Account, AccountBridge, Operation, OperationType } from "@ledgerhq/types-live";
|
|
7
|
-
import { AptosAPI } from "../
|
|
6
|
+
import { AptosAPI } from "../network";
|
|
8
7
|
|
|
9
8
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
10
9
|
import { AptosSigner } from "../types";
|
|
11
10
|
import { signTransaction } from "../network";
|
|
11
|
+
import { findSubAccountById } from "@ledgerhq/coin-framework/account/helpers";
|
|
12
|
+
import buildTransaction from "../logic/buildTransaction";
|
|
12
13
|
|
|
13
14
|
export const getAddress = (a: Account) => ({
|
|
14
15
|
address: a.freshAddress,
|
|
@@ -45,14 +46,15 @@ const buildSignOperation =
|
|
|
45
46
|
recipients.push(transaction.recipient);
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
const subAccount =
|
|
50
|
+
!!transaction.subAccountId && findSubAccountById(account, transaction.subAccountId);
|
|
51
|
+
|
|
48
52
|
// build optimistic operation
|
|
49
53
|
const operation: Operation = {
|
|
50
54
|
id: encodeOperationId(accountId, hash, type),
|
|
51
55
|
hash,
|
|
52
56
|
type,
|
|
53
|
-
value: transaction.
|
|
54
|
-
? account.balance.minus(fee)
|
|
55
|
-
: transaction.amount.plus(fee),
|
|
57
|
+
value: subAccount ? fee : transaction.amount.plus(fee),
|
|
56
58
|
fee,
|
|
57
59
|
extra,
|
|
58
60
|
blockHash: null,
|
|
@@ -62,6 +64,20 @@ const buildSignOperation =
|
|
|
62
64
|
accountId,
|
|
63
65
|
date: new Date(),
|
|
64
66
|
transactionSequenceNumber: Number(rawTx.sequence_number),
|
|
67
|
+
subOperations: subAccount
|
|
68
|
+
? [
|
|
69
|
+
{
|
|
70
|
+
id: encodeOperationId(subAccount.id, "", "OUT"),
|
|
71
|
+
type: "OUT",
|
|
72
|
+
accountId: transaction.subAccountId,
|
|
73
|
+
senders: [account.freshAddress],
|
|
74
|
+
recipients: [transaction.recipient],
|
|
75
|
+
value: transaction.amount,
|
|
76
|
+
fee,
|
|
77
|
+
date: new Date(),
|
|
78
|
+
} as Operation,
|
|
79
|
+
]
|
|
80
|
+
: [],
|
|
65
81
|
};
|
|
66
82
|
|
|
67
83
|
o.next({
|
|
@@ -1,9 +1,160 @@
|
|
|
1
|
+
import { inferSubOperations } from "@ledgerhq/coin-framework/serialization/index";
|
|
1
2
|
import { decodeAccountId, encodeAccountId } from "@ledgerhq/coin-framework/account";
|
|
2
3
|
import type { GetAccountShape } from "@ledgerhq/coin-framework/bridge/jsHelpers";
|
|
3
4
|
import { mergeOps } from "@ledgerhq/coin-framework/bridge/jsHelpers";
|
|
4
|
-
import { AptosAPI } from "../
|
|
5
|
+
import { AptosAPI } from "../network";
|
|
5
6
|
import { txsToOps } from "./logic";
|
|
6
7
|
import type { AptosAccount } from "../types";
|
|
8
|
+
import { Account, Operation, TokenAccount } from "@ledgerhq/types-live";
|
|
9
|
+
import { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
10
|
+
import {
|
|
11
|
+
decodeTokenAccountId,
|
|
12
|
+
emptyHistoryCache,
|
|
13
|
+
encodeTokenAccountId,
|
|
14
|
+
} from "@ledgerhq/coin-framework/account/index";
|
|
15
|
+
import { AccountShapeInfo } from "@ledgerhq/coin-framework/bridge/jsHelpers";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* List of properties of a sub account that can be updated when 2 "identical" accounts are found
|
|
19
|
+
*/
|
|
20
|
+
const updatableSubAccountProperties: { name: string; isOps: boolean }[] = [
|
|
21
|
+
{ name: "balance", isOps: false },
|
|
22
|
+
{ name: "spendableBalance", isOps: false },
|
|
23
|
+
{ name: "balanceHistoryCache", isOps: false },
|
|
24
|
+
{ name: "operations", isOps: true },
|
|
25
|
+
{ name: "pendingOperations", isOps: true },
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* In charge of smartly merging sub accounts while maintaining references as much as possible
|
|
29
|
+
*/
|
|
30
|
+
export const mergeSubAccounts = (
|
|
31
|
+
initialAccount: Account | undefined,
|
|
32
|
+
newSubAccounts: TokenAccount[],
|
|
33
|
+
): Array<TokenAccount> => {
|
|
34
|
+
const oldSubAccounts: Array<TokenAccount> | undefined = initialAccount?.subAccounts;
|
|
35
|
+
if (!oldSubAccounts) {
|
|
36
|
+
return newSubAccounts;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Creating a map of already existing sub accounts by id
|
|
40
|
+
const oldSubAccountsById: { [key: string]: TokenAccount } = {};
|
|
41
|
+
for (const oldSubAccount of oldSubAccounts) {
|
|
42
|
+
oldSubAccountsById[oldSubAccount.id!] = oldSubAccount;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Looping on new sub accounts to compare them with already existing ones
|
|
46
|
+
// Already existing will be updated if necessary (see `updatableSubAccountProperties`)
|
|
47
|
+
// Fresh new sub accounts will be added/pushed after already existing
|
|
48
|
+
const newSubAccountsToAdd: TokenAccount[] = [];
|
|
49
|
+
for (const newSubAccount of newSubAccounts) {
|
|
50
|
+
const duplicatedAccount: TokenAccount | undefined = oldSubAccountsById[newSubAccount.id!];
|
|
51
|
+
|
|
52
|
+
// If this sub account was not already in the initialAccount
|
|
53
|
+
if (!duplicatedAccount) {
|
|
54
|
+
// We'll add it later
|
|
55
|
+
newSubAccountsToAdd.push(newSubAccount);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const updates: Partial<TokenAccount> & { [key: string]: any } = {};
|
|
60
|
+
for (const { name, isOps } of updatableSubAccountProperties) {
|
|
61
|
+
if (!isOps) {
|
|
62
|
+
if (
|
|
63
|
+
newSubAccount[name as keyof TokenAccount] !==
|
|
64
|
+
duplicatedAccount[name as keyof TokenAccount]
|
|
65
|
+
) {
|
|
66
|
+
updates[name] = newSubAccount[name as keyof TokenAccount];
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
updates[name] =
|
|
70
|
+
mergeOps(
|
|
71
|
+
duplicatedAccount[name as keyof TokenAccount] as Operation[],
|
|
72
|
+
newSubAccount[name as keyof TokenAccount] as Operation[],
|
|
73
|
+
) || [];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Updating the operationsCount in case the mergeOps changed it
|
|
78
|
+
updates.operationsCount =
|
|
79
|
+
updates.operations?.length || duplicatedAccount?.operations?.length || 0;
|
|
80
|
+
|
|
81
|
+
// Modifying the Map with the updated sub account with a new ref
|
|
82
|
+
oldSubAccountsById[newSubAccount.id!] = {
|
|
83
|
+
...duplicatedAccount,
|
|
84
|
+
...updates,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const updatedSubAccounts = Object.values(oldSubAccountsById);
|
|
88
|
+
return [...updatedSubAccounts, ...newSubAccountsToAdd];
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Fetch the balance for a token and creates a TokenAccount based on this and the provided operations
|
|
93
|
+
*/
|
|
94
|
+
export const getSubAccountShape = async (
|
|
95
|
+
currency: CryptoCurrency,
|
|
96
|
+
address: string,
|
|
97
|
+
parentId: string,
|
|
98
|
+
token: TokenCurrency,
|
|
99
|
+
operations: Operation[],
|
|
100
|
+
): Promise<TokenAccount> => {
|
|
101
|
+
const aptosClient = new AptosAPI(currency.id);
|
|
102
|
+
const tokenAccountId = encodeTokenAccountId(parentId, token);
|
|
103
|
+
const balance = await aptosClient.getBalance(address, token);
|
|
104
|
+
const firstOperation = operations
|
|
105
|
+
.sort((a, b) => b.date.getTime() - a.date.getTime())
|
|
106
|
+
.at(operations.length - 1);
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
type: "TokenAccount",
|
|
110
|
+
id: tokenAccountId,
|
|
111
|
+
parentId,
|
|
112
|
+
token,
|
|
113
|
+
balance,
|
|
114
|
+
spendableBalance: balance,
|
|
115
|
+
creationDate: firstOperation?.date || new Date(0),
|
|
116
|
+
operations,
|
|
117
|
+
operationsCount: operations.length,
|
|
118
|
+
pendingOperations: [],
|
|
119
|
+
balanceHistoryCache: emptyHistoryCache,
|
|
120
|
+
swapHistory: [],
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Getting all token related operations in order to provide TokenAccounts
|
|
126
|
+
*/
|
|
127
|
+
export const getSubAccounts = async (
|
|
128
|
+
infos: AccountShapeInfo<Account>,
|
|
129
|
+
address: string,
|
|
130
|
+
accountId: string,
|
|
131
|
+
lastTokenOperations: Operation[],
|
|
132
|
+
): Promise<TokenAccount[]> => {
|
|
133
|
+
const { currency } = infos;
|
|
134
|
+
|
|
135
|
+
// Creating a Map of Operations by TokenCurrencies in order to know which TokenAccounts should be synced as well
|
|
136
|
+
const operationsByToken = lastTokenOperations.reduce<Map<TokenCurrency, Operation[]>>(
|
|
137
|
+
(acc, operation) => {
|
|
138
|
+
const { token } = decodeTokenAccountId(operation.accountId);
|
|
139
|
+
if (!token) return acc; // TODO: do we need to check blacklistedTokenIds
|
|
140
|
+
|
|
141
|
+
if (!acc.has(token)) {
|
|
142
|
+
acc.set(token, []);
|
|
143
|
+
}
|
|
144
|
+
acc.get(token)?.push(operation);
|
|
145
|
+
return acc;
|
|
146
|
+
},
|
|
147
|
+
new Map<TokenCurrency, Operation[]>(),
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
// Fetching all TokenAccounts possible and providing already filtered operations
|
|
151
|
+
const subAccountsPromises: Promise<TokenAccount>[] = [];
|
|
152
|
+
for (const [token, ops] of operationsByToken.entries()) {
|
|
153
|
+
subAccountsPromises.push(getSubAccountShape(currency, address, accountId, token, ops));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return Promise.all(subAccountsPromises);
|
|
157
|
+
};
|
|
7
158
|
|
|
8
159
|
export const getAccountShape: GetAccountShape = async info => {
|
|
9
160
|
const { address, initialAccount, currency, derivationMode, rest } = info;
|
|
@@ -26,14 +177,29 @@ export const getAccountShape: GetAccountShape = async info => {
|
|
|
26
177
|
const xpub = initialAccount?.xpub || publicKey || "";
|
|
27
178
|
|
|
28
179
|
const oldOperations = initialAccount?.operations || [];
|
|
29
|
-
const startAt = (oldOperations[0]?.extra as any)?.version;
|
|
30
180
|
|
|
31
181
|
const aptosClient = new AptosAPI(currency.id);
|
|
32
|
-
const { balance, transactions, blockHeight } = await aptosClient.getAccountInfo(address
|
|
182
|
+
const { balance, transactions, blockHeight } = await aptosClient.getAccountInfo(address);
|
|
33
183
|
|
|
34
|
-
const newOperations = txsToOps(
|
|
184
|
+
const [newOperations, tokenOperations]: [Operation[], Operation[]] = txsToOps(
|
|
185
|
+
info,
|
|
186
|
+
accountId,
|
|
187
|
+
transactions,
|
|
188
|
+
);
|
|
35
189
|
const operations = mergeOps(oldOperations, newOperations);
|
|
36
190
|
|
|
191
|
+
const newSubAccounts = await getSubAccounts(info, address, accountId, tokenOperations);
|
|
192
|
+
const shouldSyncFromScratch = initialAccount === undefined;
|
|
193
|
+
const subAccounts = shouldSyncFromScratch
|
|
194
|
+
? newSubAccounts
|
|
195
|
+
: mergeSubAccounts(initialAccount, newSubAccounts);
|
|
196
|
+
|
|
197
|
+
operations.forEach(op => {
|
|
198
|
+
const subOperations = inferSubOperations(op.hash, subAccounts);
|
|
199
|
+
op.subOperations =
|
|
200
|
+
subOperations.length === 1 ? subOperations : subOperations.filter(op => !!op.blockHash);
|
|
201
|
+
});
|
|
202
|
+
|
|
37
203
|
const shape: Partial<AptosAccount> = {
|
|
38
204
|
type: "Account",
|
|
39
205
|
id: accountId,
|
|
@@ -44,6 +210,7 @@ export const getAccountShape: GetAccountShape = async info => {
|
|
|
44
210
|
operationsCount: operations.length,
|
|
45
211
|
blockHeight,
|
|
46
212
|
lastSyncDate: new Date(),
|
|
213
|
+
subAccounts,
|
|
47
214
|
};
|
|
48
215
|
|
|
49
216
|
return shape;
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AptosSettings } from "@aptos-labs/ts-sdk";
|
|
2
|
+
import buildCoinConfig, {
|
|
3
|
+
type CoinConfig,
|
|
4
|
+
type CurrencyConfig,
|
|
5
|
+
} from "@ledgerhq/coin-framework/config";
|
|
6
|
+
import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
7
|
+
|
|
8
|
+
export type AptosConfig = {
|
|
9
|
+
aptosSettings: AptosSettings;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type AptosCoinConfig = CurrencyConfig & AptosConfig;
|
|
13
|
+
|
|
14
|
+
const coinConfig: {
|
|
15
|
+
setCoinConfig: (config: CoinConfig<AptosCoinConfig>) => void;
|
|
16
|
+
getCoinConfig: (currency?: CryptoCurrency) => AptosCoinConfig;
|
|
17
|
+
} = buildCoinConfig<AptosCoinConfig>();
|
|
18
|
+
|
|
19
|
+
export default coinConfig;
|
package/src/constants.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { MoveStructId } from "@aptos-labs/ts-sdk";
|
|
1
|
+
import type { MoveStructId } from "@aptos-labs/ts-sdk";
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
|
+
|
|
4
|
+
export const ESTIMATE_GAS_MUL = new BigNumber(1.0); // define buffer for gas estimation change here, if needed
|
|
2
5
|
|
|
3
6
|
export const LOAD_LIMIT = 10;
|
|
4
7
|
|
|
@@ -10,25 +13,42 @@ export enum TX_STATUS {
|
|
|
10
13
|
|
|
11
14
|
export const WRITE_RESOURCE = "write_resource";
|
|
12
15
|
|
|
13
|
-
export const
|
|
16
|
+
export const COIN_TRANSFER_TYPES: MoveStructId[] = [
|
|
14
17
|
"0x1::aptos_account::transfer",
|
|
15
18
|
"0x1::aptos_account::transfer_coins",
|
|
16
19
|
"0x1::coin::transfer",
|
|
17
20
|
];
|
|
21
|
+
|
|
22
|
+
export const FA_TRANSFER_TYPES: MoveStructId[] = ["0x1::primary_fungible_store::transfer"];
|
|
23
|
+
|
|
18
24
|
export const BATCH_TRANSFER_TYPES: MoveStructId[] = [
|
|
19
25
|
"0x1::aptos_account::batch_transfer",
|
|
20
26
|
"0x1::aptos_account::batch_transfer_coins",
|
|
21
27
|
];
|
|
28
|
+
|
|
22
29
|
export const DELEGATION_POOL_TYPES: MoveStructId[] = [
|
|
23
30
|
"0x1::delegation_pool::add_stake",
|
|
24
31
|
"0x1::delegation_pool::withdraw",
|
|
25
32
|
];
|
|
26
33
|
|
|
27
34
|
export const APTOS_ASSET_ID: MoveStructId = "0x1::aptos_coin::AptosCoin";
|
|
35
|
+
|
|
28
36
|
export const APTOS_COIN_CHANGE: MoveStructId = `0x1::coin::CoinStore<${APTOS_ASSET_ID}>`;
|
|
29
37
|
|
|
38
|
+
export const APTOS_FUNGIBLE_STORE: MoveStructId = "0x1::fungible_asset::FungibleStore";
|
|
39
|
+
|
|
40
|
+
export const APTOS_OBJECT_CORE: MoveStructId = "0x1::object::ObjectCore";
|
|
41
|
+
|
|
30
42
|
export enum DIRECTION {
|
|
31
43
|
IN = "IN",
|
|
32
44
|
OUT = "OUT",
|
|
33
45
|
UNKNOWN = "UNKNOWN",
|
|
34
46
|
}
|
|
47
|
+
|
|
48
|
+
export enum TOKEN_TYPE {
|
|
49
|
+
COIN = "coin",
|
|
50
|
+
FUNGIBLE_ASSET = "fungible_asset",
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const DEFAULT_GAS = new BigNumber(200);
|
|
54
|
+
export const DEFAULT_GAS_PRICE = new BigNumber(100);
|