@ledgerhq/coin-vechain 2.9.1-nightly.0 → 2.10.0-nightly.2
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 +16 -4
- package/CHANGELOG.md +24 -0
- package/lib/bridge/broadcast.d.ts.map +1 -1
- package/lib/bridge/broadcast.js +2 -3
- package/lib/bridge/broadcast.js.map +1 -1
- package/lib/bridge/broadcast.test.d.ts +2 -0
- package/lib/bridge/broadcast.test.d.ts.map +1 -0
- package/lib/bridge/broadcast.test.js +188 -0
- package/lib/bridge/broadcast.test.js.map +1 -0
- package/lib/bridge/buildOptimisticOperatioin.test.d.ts +2 -0
- package/lib/bridge/buildOptimisticOperatioin.test.d.ts.map +1 -0
- package/lib/bridge/buildOptimisticOperatioin.test.js +286 -0
- package/lib/bridge/buildOptimisticOperatioin.test.js.map +1 -0
- package/lib/bridge/createTransaction.d.ts.map +1 -1
- package/lib/bridge/createTransaction.js +2 -1
- package/lib/bridge/createTransaction.js.map +1 -1
- package/lib/bridge/createTransaction.test.d.ts +2 -0
- package/lib/bridge/createTransaction.test.d.ts.map +1 -0
- package/lib/bridge/createTransaction.test.js +167 -0
- package/lib/bridge/createTransaction.test.js.map +1 -0
- package/lib/bridge/estimateMaxSpendable.test.d.ts +2 -0
- package/lib/bridge/estimateMaxSpendable.test.d.ts.map +1 -0
- package/lib/bridge/estimateMaxSpendable.test.js +269 -0
- package/lib/bridge/estimateMaxSpendable.test.js.map +1 -0
- package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/getTransactionStatus.js +3 -1
- package/lib/bridge/getTransactionStatus.js.map +1 -1
- package/lib/bridge/getTransactionStatus.test.d.ts +2 -0
- package/lib/bridge/getTransactionStatus.test.d.ts.map +1 -0
- package/lib/bridge/getTransactionStatus.test.js +282 -0
- package/lib/bridge/getTransactionStatus.test.js.map +1 -0
- package/lib/bridge/helpers.test.d.ts +2 -0
- package/lib/bridge/helpers.test.d.ts.map +1 -0
- package/lib/bridge/helpers.test.js +298 -0
- package/lib/bridge/helpers.test.js.map +1 -0
- package/lib/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/prepareTransaction.js +10 -3
- package/lib/bridge/prepareTransaction.js.map +1 -1
- package/lib/bridge/prepareTransaction.test.d.ts +2 -0
- package/lib/bridge/prepareTransaction.test.d.ts.map +1 -0
- package/lib/bridge/prepareTransaction.test.js +277 -0
- package/lib/bridge/prepareTransaction.test.js.map +1 -0
- package/lib/bridge/signOperation.d.ts.map +1 -1
- package/lib/bridge/signOperation.js +3 -3
- package/lib/bridge/signOperation.js.map +1 -1
- package/lib/bridge/signOperation.test.d.ts +2 -0
- package/lib/bridge/signOperation.test.d.ts.map +1 -0
- package/lib/bridge/signOperation.test.js +295 -0
- package/lib/bridge/signOperation.test.js.map +1 -0
- package/lib/bridge/synchronisation.d.ts.map +1 -1
- package/lib/bridge/synchronisation.js +2 -2
- package/lib/bridge/synchronisation.js.map +1 -1
- package/lib/bridge/transaction.test.d.ts +2 -0
- package/lib/bridge/transaction.test.d.ts.map +1 -0
- package/lib/bridge/transaction.test.js +353 -0
- package/lib/bridge/transaction.test.js.map +1 -0
- package/lib/common-logic/calculateClauses.d.ts +5 -0
- package/lib/common-logic/calculateClauses.d.ts.map +1 -0
- package/lib/common-logic/{logic.js → calculateClauses.js} +7 -10
- package/lib/common-logic/calculateClauses.js.map +1 -0
- package/lib/common-logic/calculateClauses.test.d.ts +2 -0
- package/lib/common-logic/calculateClauses.test.d.ts.map +1 -0
- package/lib/common-logic/calculateClauses.test.js +156 -0
- package/lib/common-logic/calculateClauses.test.js.map +1 -0
- package/lib/common-logic/calculateGasFees.d.ts +9 -0
- package/lib/common-logic/calculateGasFees.d.ts.map +1 -0
- package/lib/common-logic/calculateGasFees.js +39 -0
- package/lib/common-logic/calculateGasFees.js.map +1 -0
- package/lib/common-logic/calculateGasFees.test.d.ts +2 -0
- package/lib/common-logic/calculateGasFees.test.d.ts.map +1 -0
- package/lib/common-logic/calculateGasFees.test.js +279 -0
- package/lib/common-logic/calculateGasFees.test.js.map +1 -0
- package/lib/common-logic/calculateTransactionInfo.d.ts +10 -0
- package/lib/common-logic/calculateTransactionInfo.d.ts.map +1 -0
- package/lib/common-logic/calculateTransactionInfo.js +81 -0
- package/lib/common-logic/calculateTransactionInfo.js.map +1 -0
- package/lib/common-logic/calculateTransactionInfo.test.d.ts +2 -0
- package/lib/common-logic/calculateTransactionInfo.test.d.ts.map +1 -0
- package/lib/common-logic/calculateTransactionInfo.test.js +314 -0
- package/lib/common-logic/calculateTransactionInfo.test.js.map +1 -0
- package/lib/common-logic/estimateGas.d.ts +10 -0
- package/lib/common-logic/estimateGas.d.ts.map +1 -0
- package/lib/common-logic/estimateGas.js +17 -0
- package/lib/common-logic/estimateGas.js.map +1 -0
- package/lib/common-logic/estimateGas.test.d.ts +2 -0
- package/lib/common-logic/estimateGas.test.d.ts.map +1 -0
- package/lib/common-logic/estimateGas.test.js +129 -0
- package/lib/common-logic/estimateGas.test.js.map +1 -0
- package/lib/common-logic/fixPrefixCase.d.ts +2 -0
- package/lib/common-logic/fixPrefixCase.d.ts.map +1 -0
- package/lib/common-logic/fixPrefixCase.js +9 -0
- package/lib/common-logic/fixPrefixCase.js.map +1 -0
- package/lib/common-logic/fixPrefixCase.test.d.ts +2 -0
- package/lib/common-logic/fixPrefixCase.test.d.ts.map +1 -0
- package/lib/common-logic/fixPrefixCase.test.js +46 -0
- package/lib/common-logic/fixPrefixCase.test.js.map +1 -0
- package/lib/common-logic/generateNonce.d.ts +6 -0
- package/lib/common-logic/generateNonce.d.ts.map +1 -0
- package/lib/common-logic/generateNonce.js +13 -0
- package/lib/common-logic/generateNonce.js.map +1 -0
- package/lib/common-logic/generateNonce.test.d.ts +2 -0
- package/lib/common-logic/generateNonce.test.d.ts.map +1 -0
- package/lib/common-logic/generateNonce.test.js +59 -0
- package/lib/common-logic/generateNonce.test.js.map +1 -0
- package/lib/common-logic/getThorClient.d.ts +7 -0
- package/lib/common-logic/getThorClient.d.ts.map +1 -0
- package/lib/common-logic/getThorClient.js +14 -0
- package/lib/common-logic/getThorClient.js.map +1 -0
- package/lib/common-logic/getThorClient.test.d.ts +2 -0
- package/lib/common-logic/getThorClient.test.d.ts.map +1 -0
- package/lib/common-logic/getThorClient.test.js +53 -0
- package/lib/common-logic/getThorClient.test.js.map +1 -0
- package/lib/common-logic/index.d.ts +8 -6
- package/lib/common-logic/index.d.ts.map +1 -1
- package/lib/common-logic/index.js +8 -6
- package/lib/common-logic/index.js.map +1 -1
- package/lib/common-logic/{mapping-utils.d.ts → mapTransfersToOperations.d.ts} +2 -2
- package/lib/common-logic/mapTransfersToOperations.d.ts.map +1 -0
- package/lib/common-logic/{mapping-utils.js → mapTransfersToOperations.js} +26 -19
- package/lib/common-logic/mapTransfersToOperations.js.map +1 -0
- package/lib/common-logic/mapTransfersToOperations.test.d.ts +2 -0
- package/lib/common-logic/mapTransfersToOperations.test.d.ts.map +1 -0
- package/lib/common-logic/mapTransfersToOperations.test.js +274 -0
- package/lib/common-logic/mapTransfersToOperations.test.js.map +1 -0
- package/lib/common-logic/{pad-address.d.ts → padAddress.d.ts} +1 -1
- package/lib/common-logic/padAddress.d.ts.map +1 -0
- package/lib/common-logic/{pad-address.js → padAddress.js} +1 -1
- package/lib/common-logic/padAddress.js.map +1 -0
- package/lib/common-logic/padAddress.test.d.ts +2 -0
- package/lib/common-logic/padAddress.test.d.ts.map +1 -0
- package/lib/common-logic/padAddress.test.js +59 -0
- package/lib/common-logic/padAddress.test.js.map +1 -0
- package/lib/common-logic/parseAddress.d.ts +7 -0
- package/lib/common-logic/parseAddress.d.ts.map +1 -0
- package/lib/common-logic/parseAddress.js +15 -0
- package/lib/common-logic/parseAddress.js.map +1 -0
- package/lib/common-logic/parseAddress.test.d.ts +2 -0
- package/lib/common-logic/parseAddress.test.d.ts.map +1 -0
- package/lib/common-logic/parseAddress.test.js +97 -0
- package/lib/common-logic/parseAddress.test.js.map +1 -0
- package/lib/constants/env.d.ts +2 -0
- package/lib/constants/env.d.ts.map +1 -0
- package/lib/constants/env.js +6 -0
- package/lib/constants/env.js.map +1 -0
- package/lib/constants/index.d.ts +2 -0
- package/lib/constants/index.d.ts.map +1 -0
- package/lib/constants/index.js +18 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/network/sdk.d.ts +3 -10
- package/lib/network/sdk.d.ts.map +1 -1
- package/lib/network/sdk.js +15 -30
- package/lib/network/sdk.js.map +1 -1
- package/lib/signer/getAddress.test.d.ts +2 -0
- package/lib/signer/getAddress.test.d.ts.map +1 -0
- package/lib/signer/getAddress.test.js +357 -0
- package/lib/signer/getAddress.test.js.map +1 -0
- package/lib/signer/signMessage.d.ts.map +1 -1
- package/lib/signer/signMessage.js +3 -3
- package/lib/signer/signMessage.js.map +1 -1
- package/lib/signer/signMessage.test.d.ts +2 -0
- package/lib/signer/signMessage.test.d.ts.map +1 -0
- package/lib/signer/signMessage.test.js +242 -0
- package/lib/signer/signMessage.test.js.map +1 -0
- package/lib/test/bridgeDatasetTest.d.ts.map +1 -1
- package/lib/test/bridgeDatasetTest.js +79 -53
- package/lib/test/bridgeDatasetTest.js.map +1 -1
- package/lib/test/cli.d.ts.map +1 -1
- package/lib/test/cli.js +5 -4
- package/lib/test/cli.js.map +1 -1
- package/lib/types/bridge.d.ts +11 -3
- package/lib/types/bridge.d.ts.map +1 -1
- package/lib/types/bridge.js +3 -0
- package/lib/types/bridge.js.map +1 -1
- package/lib/types/constants.d.ts +0 -3
- package/lib/types/constants.d.ts.map +1 -1
- package/lib/types/constants.js +1 -4
- package/lib/types/constants.js.map +1 -1
- package/lib/types/signer.d.ts +0 -2
- package/lib/types/signer.d.ts.map +1 -1
- package/lib-es/bridge/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/broadcast.js +2 -3
- package/lib-es/bridge/broadcast.js.map +1 -1
- package/lib-es/bridge/broadcast.test.d.ts +2 -0
- package/lib-es/bridge/broadcast.test.d.ts.map +1 -0
- package/lib-es/bridge/broadcast.test.js +183 -0
- package/lib-es/bridge/broadcast.test.js.map +1 -0
- package/lib-es/bridge/buildOptimisticOperatioin.test.d.ts +2 -0
- package/lib-es/bridge/buildOptimisticOperatioin.test.d.ts.map +1 -0
- package/lib-es/bridge/buildOptimisticOperatioin.test.js +281 -0
- package/lib-es/bridge/buildOptimisticOperatioin.test.js.map +1 -0
- package/lib-es/bridge/createTransaction.d.ts.map +1 -1
- package/lib-es/bridge/createTransaction.js +3 -2
- package/lib-es/bridge/createTransaction.js.map +1 -1
- package/lib-es/bridge/createTransaction.test.d.ts +2 -0
- package/lib-es/bridge/createTransaction.test.d.ts.map +1 -0
- package/lib-es/bridge/createTransaction.test.js +162 -0
- package/lib-es/bridge/createTransaction.test.js.map +1 -0
- package/lib-es/bridge/estimateMaxSpendable.test.d.ts +2 -0
- package/lib-es/bridge/estimateMaxSpendable.test.d.ts.map +1 -0
- package/lib-es/bridge/estimateMaxSpendable.test.js +264 -0
- package/lib-es/bridge/estimateMaxSpendable.test.js.map +1 -0
- package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/getTransactionStatus.js +4 -2
- package/lib-es/bridge/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/getTransactionStatus.test.d.ts +2 -0
- package/lib-es/bridge/getTransactionStatus.test.d.ts.map +1 -0
- package/lib-es/bridge/getTransactionStatus.test.js +277 -0
- package/lib-es/bridge/getTransactionStatus.test.js.map +1 -0
- package/lib-es/bridge/helpers.test.d.ts +2 -0
- package/lib-es/bridge/helpers.test.d.ts.map +1 -0
- package/lib-es/bridge/helpers.test.js +293 -0
- package/lib-es/bridge/helpers.test.js.map +1 -0
- package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/prepareTransaction.js +11 -4
- package/lib-es/bridge/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/prepareTransaction.test.d.ts +2 -0
- package/lib-es/bridge/prepareTransaction.test.d.ts.map +1 -0
- package/lib-es/bridge/prepareTransaction.test.js +272 -0
- package/lib-es/bridge/prepareTransaction.test.js.map +1 -0
- package/lib-es/bridge/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/signOperation.js +3 -3
- package/lib-es/bridge/signOperation.js.map +1 -1
- package/lib-es/bridge/signOperation.test.d.ts +2 -0
- package/lib-es/bridge/signOperation.test.d.ts.map +1 -0
- package/lib-es/bridge/signOperation.test.js +290 -0
- package/lib-es/bridge/signOperation.test.js.map +1 -0
- package/lib-es/bridge/synchronisation.d.ts.map +1 -1
- package/lib-es/bridge/synchronisation.js +1 -1
- package/lib-es/bridge/synchronisation.js.map +1 -1
- package/lib-es/bridge/transaction.test.d.ts +2 -0
- package/lib-es/bridge/transaction.test.d.ts.map +1 -0
- package/lib-es/bridge/transaction.test.js +347 -0
- package/lib-es/bridge/transaction.test.js.map +1 -0
- package/lib-es/common-logic/calculateClauses.d.ts +5 -0
- package/lib-es/common-logic/calculateClauses.d.ts.map +1 -0
- package/lib-es/common-logic/{logic.js → calculateClauses.js} +6 -6
- package/lib-es/common-logic/calculateClauses.js.map +1 -0
- package/lib-es/common-logic/calculateClauses.test.d.ts +2 -0
- package/lib-es/common-logic/calculateClauses.test.d.ts.map +1 -0
- package/lib-es/common-logic/calculateClauses.test.js +151 -0
- package/lib-es/common-logic/calculateClauses.test.js.map +1 -0
- package/lib-es/common-logic/calculateGasFees.d.ts +9 -0
- package/lib-es/common-logic/calculateGasFees.d.ts.map +1 -0
- package/lib-es/common-logic/calculateGasFees.js +32 -0
- package/lib-es/common-logic/calculateGasFees.js.map +1 -0
- package/lib-es/common-logic/calculateGasFees.test.d.ts +2 -0
- package/lib-es/common-logic/calculateGasFees.test.d.ts.map +1 -0
- package/lib-es/common-logic/calculateGasFees.test.js +274 -0
- package/lib-es/common-logic/calculateGasFees.test.js.map +1 -0
- package/lib-es/common-logic/calculateTransactionInfo.d.ts +10 -0
- package/lib-es/common-logic/calculateTransactionInfo.d.ts.map +1 -0
- package/lib-es/common-logic/calculateTransactionInfo.js +74 -0
- package/lib-es/common-logic/calculateTransactionInfo.js.map +1 -0
- package/lib-es/common-logic/calculateTransactionInfo.test.d.ts +2 -0
- package/lib-es/common-logic/calculateTransactionInfo.test.d.ts.map +1 -0
- package/lib-es/common-logic/calculateTransactionInfo.test.js +309 -0
- package/lib-es/common-logic/calculateTransactionInfo.test.js.map +1 -0
- package/lib-es/common-logic/estimateGas.d.ts +10 -0
- package/lib-es/common-logic/estimateGas.d.ts.map +1 -0
- package/lib-es/common-logic/estimateGas.js +13 -0
- package/lib-es/common-logic/estimateGas.js.map +1 -0
- package/lib-es/common-logic/estimateGas.test.d.ts +2 -0
- package/lib-es/common-logic/estimateGas.test.d.ts.map +1 -0
- package/lib-es/common-logic/estimateGas.test.js +127 -0
- package/lib-es/common-logic/estimateGas.test.js.map +1 -0
- package/lib-es/common-logic/fixPrefixCase.d.ts +2 -0
- package/lib-es/common-logic/fixPrefixCase.d.ts.map +1 -0
- package/lib-es/common-logic/fixPrefixCase.js +5 -0
- package/lib-es/common-logic/fixPrefixCase.js.map +1 -0
- package/lib-es/common-logic/fixPrefixCase.test.d.ts +2 -0
- package/lib-es/common-logic/fixPrefixCase.test.d.ts.map +1 -0
- package/lib-es/common-logic/fixPrefixCase.test.js +44 -0
- package/lib-es/common-logic/fixPrefixCase.test.js.map +1 -0
- package/lib-es/common-logic/generateNonce.d.ts +6 -0
- package/lib-es/common-logic/generateNonce.d.ts.map +1 -0
- package/lib-es/common-logic/generateNonce.js +9 -0
- package/lib-es/common-logic/generateNonce.js.map +1 -0
- package/lib-es/common-logic/generateNonce.test.d.ts +2 -0
- package/lib-es/common-logic/generateNonce.test.d.ts.map +1 -0
- package/lib-es/common-logic/generateNonce.test.js +57 -0
- package/lib-es/common-logic/generateNonce.test.js.map +1 -0
- package/lib-es/common-logic/getThorClient.d.ts +7 -0
- package/lib-es/common-logic/getThorClient.d.ts.map +1 -0
- package/lib-es/common-logic/getThorClient.js +10 -0
- package/lib-es/common-logic/getThorClient.js.map +1 -0
- package/lib-es/common-logic/getThorClient.test.d.ts +2 -0
- package/lib-es/common-logic/getThorClient.test.d.ts.map +1 -0
- package/lib-es/common-logic/getThorClient.test.js +51 -0
- package/lib-es/common-logic/getThorClient.test.js.map +1 -0
- package/lib-es/common-logic/index.d.ts +8 -6
- package/lib-es/common-logic/index.d.ts.map +1 -1
- package/lib-es/common-logic/index.js +8 -6
- package/lib-es/common-logic/index.js.map +1 -1
- package/lib-es/common-logic/{mapping-utils.d.ts → mapTransfersToOperations.d.ts} +2 -2
- package/lib-es/common-logic/mapTransfersToOperations.d.ts.map +1 -0
- package/lib-es/common-logic/mapTransfersToOperations.js +51 -0
- package/lib-es/common-logic/mapTransfersToOperations.js.map +1 -0
- package/lib-es/common-logic/mapTransfersToOperations.test.d.ts +2 -0
- package/lib-es/common-logic/mapTransfersToOperations.test.d.ts.map +1 -0
- package/lib-es/common-logic/mapTransfersToOperations.test.js +269 -0
- package/lib-es/common-logic/mapTransfersToOperations.test.js.map +1 -0
- package/lib-es/common-logic/{pad-address.d.ts → padAddress.d.ts} +1 -1
- package/lib-es/common-logic/padAddress.d.ts.map +1 -0
- package/lib-es/common-logic/{pad-address.js → padAddress.js} +1 -1
- package/lib-es/common-logic/padAddress.js.map +1 -0
- package/lib-es/common-logic/padAddress.test.d.ts +2 -0
- package/lib-es/common-logic/padAddress.test.d.ts.map +1 -0
- package/lib-es/common-logic/padAddress.test.js +57 -0
- package/lib-es/common-logic/padAddress.test.js.map +1 -0
- package/lib-es/common-logic/parseAddress.d.ts +7 -0
- package/lib-es/common-logic/parseAddress.d.ts.map +1 -0
- package/lib-es/common-logic/parseAddress.js +11 -0
- package/lib-es/common-logic/parseAddress.js.map +1 -0
- package/lib-es/common-logic/parseAddress.test.d.ts +2 -0
- package/lib-es/common-logic/parseAddress.test.d.ts.map +1 -0
- package/lib-es/common-logic/parseAddress.test.js +95 -0
- package/lib-es/common-logic/parseAddress.test.js.map +1 -0
- package/lib-es/constants/env.d.ts +2 -0
- package/lib-es/constants/env.d.ts.map +1 -0
- package/lib-es/constants/env.js +3 -0
- package/lib-es/constants/env.js.map +1 -0
- package/lib-es/constants/index.d.ts +2 -0
- package/lib-es/constants/index.d.ts.map +1 -0
- package/lib-es/constants/index.js +2 -0
- package/lib-es/constants/index.js.map +1 -0
- package/lib-es/network/sdk.d.ts +3 -10
- package/lib-es/network/sdk.d.ts.map +1 -1
- package/lib-es/network/sdk.js +5 -19
- package/lib-es/network/sdk.js.map +1 -1
- package/lib-es/signer/getAddress.test.d.ts +2 -0
- package/lib-es/signer/getAddress.test.d.ts.map +1 -0
- package/lib-es/signer/getAddress.test.js +352 -0
- package/lib-es/signer/getAddress.test.js.map +1 -0
- package/lib-es/signer/signMessage.d.ts.map +1 -1
- package/lib-es/signer/signMessage.js +3 -3
- package/lib-es/signer/signMessage.js.map +1 -1
- package/lib-es/signer/signMessage.test.d.ts +2 -0
- package/lib-es/signer/signMessage.test.d.ts.map +1 -0
- package/lib-es/signer/signMessage.test.js +240 -0
- package/lib-es/signer/signMessage.test.js.map +1 -0
- package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -1
- package/lib-es/test/bridgeDatasetTest.js +80 -54
- package/lib-es/test/bridgeDatasetTest.js.map +1 -1
- package/lib-es/test/cli.d.ts.map +1 -1
- package/lib-es/test/cli.js +4 -3
- package/lib-es/test/cli.js.map +1 -1
- package/lib-es/types/bridge.d.ts +11 -3
- package/lib-es/types/bridge.d.ts.map +1 -1
- package/lib-es/types/bridge.js +6 -1
- package/lib-es/types/bridge.js.map +1 -1
- package/lib-es/types/constants.d.ts +0 -3
- package/lib-es/types/constants.d.ts.map +1 -1
- package/lib-es/types/constants.js +0 -3
- package/lib-es/types/constants.js.map +1 -1
- package/lib-es/types/signer.d.ts +0 -2
- package/lib-es/types/signer.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/bridge/broadcast.test.ts +236 -0
- package/src/bridge/broadcast.ts +4 -5
- package/src/bridge/buildOptimisticOperatioin.test.ts +364 -0
- package/src/bridge/createTransaction.test.ts +201 -0
- package/src/bridge/createTransaction.ts +3 -2
- package/src/bridge/estimateMaxSpendable.test.ts +319 -0
- package/src/bridge/getTransactionStatus.test.ts +353 -0
- package/src/bridge/getTransactionStatus.ts +4 -2
- package/src/bridge/helpers.test.ts +356 -0
- package/src/bridge/prepareTransaction.test.ts +345 -0
- package/src/bridge/prepareTransaction.ts +20 -10
- package/src/bridge/signOperation.test.ts +354 -0
- package/src/bridge/signOperation.ts +6 -3
- package/src/bridge/synchronisation.ts +1 -1
- package/src/bridge/transaction.test.ts +440 -0
- package/src/common-logic/calculateClauses.test.ts +186 -0
- package/src/common-logic/calculateClauses.ts +44 -0
- package/src/common-logic/calculateGasFees.test.ts +363 -0
- package/src/common-logic/calculateGasFees.ts +45 -0
- package/src/common-logic/calculateTransactionInfo.test.ts +396 -0
- package/src/common-logic/calculateTransactionInfo.ts +96 -0
- package/src/common-logic/estimateGas.test.ts +162 -0
- package/src/common-logic/estimateGas.ts +18 -0
- package/src/common-logic/fixPrefixCase.test.ts +51 -0
- package/src/common-logic/fixPrefixCase.ts +5 -0
- package/src/common-logic/generateNonce.test.ts +72 -0
- package/src/common-logic/generateNonce.ts +9 -0
- package/src/common-logic/getThorClient.test.ts +66 -0
- package/src/common-logic/getThorClient.ts +10 -0
- package/src/common-logic/index.ts +8 -6
- package/src/common-logic/mapTransfersToOperations.test.ts +342 -0
- package/src/common-logic/mapTransfersToOperations.ts +77 -0
- package/src/common-logic/padAddress.test.ts +65 -0
- package/src/common-logic/parseAddress.test.ts +130 -0
- package/src/common-logic/parseAddress.ts +11 -0
- package/src/constants/env.ts +3 -0
- package/src/constants/index.ts +1 -0
- package/src/network/sdk.ts +22 -30
- package/src/signer/getAddress.test.ts +454 -0
- package/src/signer/signMessage.test.ts +329 -0
- package/src/signer/signMessage.ts +4 -5
- package/src/test/bridgeDatasetTest.ts +86 -58
- package/src/test/cli.ts +4 -3
- package/src/types/bridge.ts +16 -3
- package/src/types/constants.ts +0 -3
- package/lib/common-logic/address-utils.d.ts +0 -2
- package/lib/common-logic/address-utils.d.ts.map +0 -1
- package/lib/common-logic/address-utils.js +0 -19
- package/lib/common-logic/address-utils.js.map +0 -1
- package/lib/common-logic/hex-utils.d.ts +0 -8
- package/lib/common-logic/hex-utils.d.ts.map +0 -1
- package/lib/common-logic/hex-utils.js +0 -52
- package/lib/common-logic/hex-utils.js.map +0 -1
- package/lib/common-logic/logic.d.ts +0 -5
- package/lib/common-logic/logic.d.ts.map +0 -1
- package/lib/common-logic/logic.js.map +0 -1
- package/lib/common-logic/mapping-utils.d.ts.map +0 -1
- package/lib/common-logic/mapping-utils.js.map +0 -1
- package/lib/common-logic/pad-address.d.ts.map +0 -1
- package/lib/common-logic/pad-address.js.map +0 -1
- package/lib/common-logic/transaction-utils.d.ts +0 -30
- package/lib/common-logic/transaction-utils.d.ts.map +0 -1
- package/lib/common-logic/transaction-utils.js +0 -161
- package/lib/common-logic/transaction-utils.js.map +0 -1
- package/lib/contracts/abis/VIP180.d.ts +0 -17
- package/lib/contracts/abis/VIP180.d.ts.map +0 -1
- package/lib/contracts/abis/VIP180.js +0 -265
- package/lib/contracts/abis/VIP180.js.map +0 -1
- package/lib/contracts/abis/params.d.ts +0 -8
- package/lib/contracts/abis/params.d.ts.map +0 -1
- package/lib/contracts/abis/params.js +0 -69
- package/lib/contracts/abis/params.js.map +0 -1
- package/lib/contracts/constants.d.ts +0 -6
- package/lib/contracts/constants.d.ts.map +0 -1
- package/lib/contracts/constants.js +0 -10
- package/lib/contracts/constants.js.map +0 -1
- package/lib-es/common-logic/address-utils.d.ts +0 -2
- package/lib-es/common-logic/address-utils.d.ts.map +0 -1
- package/lib-es/common-logic/address-utils.js +0 -12
- package/lib-es/common-logic/address-utils.js.map +0 -1
- package/lib-es/common-logic/hex-utils.d.ts +0 -8
- package/lib-es/common-logic/hex-utils.d.ts.map +0 -1
- package/lib-es/common-logic/hex-utils.js +0 -50
- package/lib-es/common-logic/hex-utils.js.map +0 -1
- package/lib-es/common-logic/logic.d.ts +0 -5
- package/lib-es/common-logic/logic.d.ts.map +0 -1
- package/lib-es/common-logic/logic.js.map +0 -1
- package/lib-es/common-logic/mapping-utils.d.ts.map +0 -1
- package/lib-es/common-logic/mapping-utils.js +0 -44
- package/lib-es/common-logic/mapping-utils.js.map +0 -1
- package/lib-es/common-logic/pad-address.d.ts.map +0 -1
- package/lib-es/common-logic/pad-address.js.map +0 -1
- package/lib-es/common-logic/transaction-utils.d.ts +0 -30
- package/lib-es/common-logic/transaction-utils.d.ts.map +0 -1
- package/lib-es/common-logic/transaction-utils.js +0 -150
- package/lib-es/common-logic/transaction-utils.js.map +0 -1
- package/lib-es/contracts/abis/VIP180.d.ts +0 -17
- package/lib-es/contracts/abis/VIP180.d.ts.map +0 -1
- package/lib-es/contracts/abis/VIP180.js +0 -263
- package/lib-es/contracts/abis/VIP180.js.map +0 -1
- package/lib-es/contracts/abis/params.d.ts +0 -8
- package/lib-es/contracts/abis/params.d.ts.map +0 -1
- package/lib-es/contracts/abis/params.js +0 -67
- package/lib-es/contracts/abis/params.js.map +0 -1
- package/lib-es/contracts/constants.d.ts +0 -6
- package/lib-es/contracts/constants.d.ts.map +0 -1
- package/lib-es/contracts/constants.js +0 -7
- package/lib-es/contracts/constants.js.map +0 -1
- package/src/common-logic/address-utils.ts +0 -11
- package/src/common-logic/hex-utils.ts +0 -53
- package/src/common-logic/logic.ts +0 -44
- package/src/common-logic/mapping-utils.ts +0 -67
- package/src/common-logic/transaction-utils.ts +0 -190
- package/src/contracts/abis/VIP180.ts +0 -265
- package/src/contracts/abis/params.ts +0 -70
- package/src/contracts/constants.ts +0 -11
- /package/src/common-logic/{pad-address.ts → padAddress.ts} +0 -0
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import BigNumber from "bignumber.js";
|
|
2
|
-
import vip180 from "../contracts/abis/VIP180";
|
|
3
|
-
import { Operation } from "@ledgerhq/types-live";
|
|
4
|
-
import { EventLog, TransferLog } from "../types";
|
|
5
|
-
import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
|
|
6
|
-
import { getFees } from "../network";
|
|
7
|
-
|
|
8
|
-
export const mapVetTransfersToOperations = async (
|
|
9
|
-
txs: TransferLog[],
|
|
10
|
-
accountId: string,
|
|
11
|
-
addr: string,
|
|
12
|
-
): Promise<Operation[]> => {
|
|
13
|
-
return Promise.all(
|
|
14
|
-
txs.map(async tx => {
|
|
15
|
-
const fees = await getFees(tx.meta.txID);
|
|
16
|
-
return {
|
|
17
|
-
id: encodeOperationId(
|
|
18
|
-
accountId,
|
|
19
|
-
tx.meta.txID,
|
|
20
|
-
tx.recipient === addr.toLowerCase() ? "IN" : "OUT",
|
|
21
|
-
),
|
|
22
|
-
hash: tx.meta.txID,
|
|
23
|
-
type: tx.recipient === addr.toLowerCase() ? "IN" : "OUT",
|
|
24
|
-
value: new BigNumber(tx.amount),
|
|
25
|
-
fee: new BigNumber(fees),
|
|
26
|
-
senders: [tx.sender],
|
|
27
|
-
recipients: [tx.recipient],
|
|
28
|
-
blockHeight: tx.meta.blockNumber,
|
|
29
|
-
blockHash: tx.meta.blockID,
|
|
30
|
-
accountId,
|
|
31
|
-
date: new Date(tx.meta.blockTimestamp * 1000),
|
|
32
|
-
extra: {},
|
|
33
|
-
};
|
|
34
|
-
}),
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const mapTokenTransfersToOperations = async (
|
|
39
|
-
evnts: EventLog[],
|
|
40
|
-
accountId: string,
|
|
41
|
-
addr: string,
|
|
42
|
-
): Promise<Operation[]> => {
|
|
43
|
-
return Promise.all(
|
|
44
|
-
evnts.map(async evnt => {
|
|
45
|
-
const decoded = vip180.TransferEvent.decode(evnt.data, evnt.topics);
|
|
46
|
-
const fees = await getFees(evnt.meta.txID);
|
|
47
|
-
return {
|
|
48
|
-
id: encodeOperationId(
|
|
49
|
-
accountId,
|
|
50
|
-
evnt.meta.txID,
|
|
51
|
-
decoded.to === addr.toLowerCase() ? "IN" : "OUT",
|
|
52
|
-
),
|
|
53
|
-
hash: evnt.meta.txID,
|
|
54
|
-
type: decoded.to === addr.toLowerCase() ? "IN" : "OUT",
|
|
55
|
-
value: new BigNumber(decoded.value),
|
|
56
|
-
fee: fees,
|
|
57
|
-
senders: [decoded.from],
|
|
58
|
-
recipients: [decoded.to],
|
|
59
|
-
blockHeight: evnt.meta.blockNumber,
|
|
60
|
-
blockHash: evnt.meta.blockID,
|
|
61
|
-
accountId,
|
|
62
|
-
date: new Date(evnt.meta.blockTimestamp * 1000),
|
|
63
|
-
extra: {},
|
|
64
|
-
};
|
|
65
|
-
}),
|
|
66
|
-
);
|
|
67
|
-
};
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import BigNumber from "bignumber.js";
|
|
2
|
-
import { DEFAULT_GAS_COEFFICIENT, HEX_PREFIX } from "../types";
|
|
3
|
-
import crypto from "crypto";
|
|
4
|
-
import { Transaction as ThorTransaction } from "thor-devkit";
|
|
5
|
-
import params from "../contracts/abis/params";
|
|
6
|
-
import { BASE_GAS_PRICE_KEY, PARAMS_ADDRESS } from "../contracts/constants";
|
|
7
|
-
import { query } from "../network";
|
|
8
|
-
import { Account, TokenAccount } from "@ledgerhq/types-live";
|
|
9
|
-
import { Transaction, TransactionInfo, Query } from "../types";
|
|
10
|
-
import { isValid } from "./address-utils";
|
|
11
|
-
import { calculateClausesVet, calculateClausesVtho } from "./logic";
|
|
12
|
-
import { ImpossibleToCalculateAmountAndFees } from "../errors";
|
|
13
|
-
|
|
14
|
-
const GAS_COEFFICIENT = 15000;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Generate a Unique ID to be used as a nonce
|
|
18
|
-
* @returns a unique string
|
|
19
|
-
*/
|
|
20
|
-
export const generateNonce = (): string => {
|
|
21
|
-
const randBuffer = crypto.randomBytes(Math.ceil(4));
|
|
22
|
-
if (!randBuffer) throw Error("Failed to generate random hex");
|
|
23
|
-
return `${HEX_PREFIX}${randBuffer.toString("hex").substring(0, 8)}`;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Estimate the gas that will be used by the transaction.
|
|
28
|
-
* @param transaction - The transaction to estimate the gas for
|
|
29
|
-
* @returns an estimate of the gas usage
|
|
30
|
-
*/
|
|
31
|
-
export const estimateGas = async (t: Transaction): Promise<number> => {
|
|
32
|
-
const intrinsicGas = ThorTransaction.intrinsicGas(t.body.clauses);
|
|
33
|
-
|
|
34
|
-
const queryData: Query[] = [];
|
|
35
|
-
|
|
36
|
-
t.body.clauses.forEach(c => {
|
|
37
|
-
if (c.to) {
|
|
38
|
-
queryData.push({
|
|
39
|
-
to: c.to,
|
|
40
|
-
data: c.data,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const response = await query(queryData);
|
|
46
|
-
|
|
47
|
-
const execGas = response.reduce((sum, out) => sum + out.gasUsed, 0);
|
|
48
|
-
|
|
49
|
-
return intrinsicGas + (execGas ? execGas + GAS_COEFFICIENT : 0);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const getBaseGasPrice = async (): Promise<string> => {
|
|
53
|
-
const queryData: Query = {
|
|
54
|
-
to: PARAMS_ADDRESS,
|
|
55
|
-
data: params.get.encode(BASE_GAS_PRICE_KEY),
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const response = await query([queryData]);
|
|
59
|
-
|
|
60
|
-
// Expect 1 value
|
|
61
|
-
if (response && response.length !== 1) throw Error("Unexpected response received for query");
|
|
62
|
-
|
|
63
|
-
return response[0].data;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Calculate the fee in VTHO
|
|
68
|
-
* @param gas - the gas used
|
|
69
|
-
* @param gasPriceCoef - the gas price coefficient
|
|
70
|
-
* @returns the fee in VTHO
|
|
71
|
-
*/
|
|
72
|
-
export const calculateFee = async (gas: BigNumber, gasPriceCoef: number): Promise<BigNumber> => {
|
|
73
|
-
const baseGasPrice = await getBaseGasPrice();
|
|
74
|
-
return new BigNumber(baseGasPrice).times(gasPriceCoef).idiv(255).plus(baseGasPrice).times(gas);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// Here there is a circular dependency between values, that is why we need the do-while loop
|
|
78
|
-
// dependencies are:
|
|
79
|
-
// useAllAmount: USER
|
|
80
|
-
// amount: useAllAmount & spendableBalance
|
|
81
|
-
// fees: amount
|
|
82
|
-
// spendableBalance: fees & balance
|
|
83
|
-
// balance: USER
|
|
84
|
-
// circular dependency is:
|
|
85
|
-
// amount -> spendableBalance -> fees -> amount
|
|
86
|
-
|
|
87
|
-
export const calculateTransactionInfo = async (
|
|
88
|
-
account: Account,
|
|
89
|
-
transaction: Transaction,
|
|
90
|
-
fixedMaxTokenFees?: {
|
|
91
|
-
estimatedGas: number;
|
|
92
|
-
estimatedGasFees: BigNumber;
|
|
93
|
-
},
|
|
94
|
-
): Promise<TransactionInfo> => {
|
|
95
|
-
const { subAccounts } = account;
|
|
96
|
-
const { amount: oldAmount, subAccountId, useAllAmount } = transaction;
|
|
97
|
-
|
|
98
|
-
const tokenAccount =
|
|
99
|
-
subAccountId && subAccounts
|
|
100
|
-
? (subAccounts.find(subAccount => {
|
|
101
|
-
return subAccount.id === subAccountId;
|
|
102
|
-
}) as TokenAccount)
|
|
103
|
-
: undefined;
|
|
104
|
-
const isTokenAccount = !!tokenAccount;
|
|
105
|
-
|
|
106
|
-
let amount = oldAmount;
|
|
107
|
-
let amountBackup;
|
|
108
|
-
let tempTransaction = { ...transaction, amount };
|
|
109
|
-
let balance = account.balance;
|
|
110
|
-
let spendableBalance = account.balance;
|
|
111
|
-
let maxEstimatedGasFees = new BigNumber(0);
|
|
112
|
-
let maxEstimatedGas = 0;
|
|
113
|
-
|
|
114
|
-
if (!amount.isNaN()) {
|
|
115
|
-
const MAX_ITERATIONS = 5; // it should never reach more than 2 iterations, but just in case
|
|
116
|
-
let iterations = 0;
|
|
117
|
-
do {
|
|
118
|
-
amountBackup = amount;
|
|
119
|
-
|
|
120
|
-
const estimatedGasAndFees =
|
|
121
|
-
fixedMaxTokenFees || (await calculateGasFees(tempTransaction, isTokenAccount));
|
|
122
|
-
|
|
123
|
-
maxEstimatedGasFees = estimatedGasAndFees.estimatedGasFees;
|
|
124
|
-
maxEstimatedGas = estimatedGasAndFees.estimatedGas;
|
|
125
|
-
|
|
126
|
-
if (isTokenAccount && tokenAccount) {
|
|
127
|
-
balance = tokenAccount.balance;
|
|
128
|
-
spendableBalance = tokenAccount.balance.minus(maxEstimatedGasFees).gt(0)
|
|
129
|
-
? tokenAccount.balance.minus(maxEstimatedGasFees)
|
|
130
|
-
: new BigNumber(0);
|
|
131
|
-
} else {
|
|
132
|
-
balance = account.balance;
|
|
133
|
-
spendableBalance = account.balance;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
amount = useAllAmount ? spendableBalance : oldAmount;
|
|
137
|
-
|
|
138
|
-
tempTransaction = {
|
|
139
|
-
...tempTransaction,
|
|
140
|
-
amount,
|
|
141
|
-
};
|
|
142
|
-
iterations++;
|
|
143
|
-
} while (!amountBackup.isEqualTo(amount) && iterations < MAX_ITERATIONS);
|
|
144
|
-
if (iterations === MAX_ITERATIONS) {
|
|
145
|
-
throw new ImpossibleToCalculateAmountAndFees();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return {
|
|
150
|
-
isTokenAccount,
|
|
151
|
-
amount,
|
|
152
|
-
spendableBalance,
|
|
153
|
-
balance,
|
|
154
|
-
tokenAccount,
|
|
155
|
-
estimatedFees: maxEstimatedGasFees.toString(),
|
|
156
|
-
estimatedGas: maxEstimatedGas,
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export const calculateGasFees = async (
|
|
161
|
-
transaction: Transaction,
|
|
162
|
-
isTokenAccount: boolean,
|
|
163
|
-
): Promise<{
|
|
164
|
-
estimatedGas: number;
|
|
165
|
-
estimatedGasFees: BigNumber;
|
|
166
|
-
}> => {
|
|
167
|
-
if (transaction.recipient && isValid(transaction.recipient)) {
|
|
168
|
-
let clauses;
|
|
169
|
-
if (isTokenAccount) {
|
|
170
|
-
clauses = await calculateClausesVtho(transaction.recipient, transaction.amount);
|
|
171
|
-
} else {
|
|
172
|
-
clauses = await calculateClausesVet(transaction.recipient, transaction.amount);
|
|
173
|
-
}
|
|
174
|
-
const gas = await estimateGas({
|
|
175
|
-
...transaction,
|
|
176
|
-
body: { ...transaction.body, clauses: clauses },
|
|
177
|
-
});
|
|
178
|
-
return {
|
|
179
|
-
estimatedGas: gas,
|
|
180
|
-
estimatedGasFees: await calculateFee(
|
|
181
|
-
new BigNumber(gas),
|
|
182
|
-
transaction.body.gasPriceCoef || DEFAULT_GAS_COEFFICIENT,
|
|
183
|
-
),
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
return {
|
|
187
|
-
estimatedGas: 0,
|
|
188
|
-
estimatedGasFees: new BigNumber(0),
|
|
189
|
-
};
|
|
190
|
-
};
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { abi } from "thor-devkit";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* EVENTS
|
|
5
|
-
*/
|
|
6
|
-
const ApprovalEvent: abi.Event.Definition = {
|
|
7
|
-
anonymous: false,
|
|
8
|
-
inputs: [
|
|
9
|
-
{
|
|
10
|
-
indexed: true,
|
|
11
|
-
internalType: "address",
|
|
12
|
-
name: "owner",
|
|
13
|
-
type: "address",
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
indexed: true,
|
|
17
|
-
internalType: "address",
|
|
18
|
-
name: "spender",
|
|
19
|
-
type: "address",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
indexed: false,
|
|
23
|
-
internalType: "uint256",
|
|
24
|
-
name: "value",
|
|
25
|
-
type: "uint256",
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
name: "Approval",
|
|
29
|
-
type: "event",
|
|
30
|
-
};
|
|
31
|
-
const TransferEvent: abi.Event.Definition = {
|
|
32
|
-
anonymous: false,
|
|
33
|
-
inputs: [
|
|
34
|
-
{
|
|
35
|
-
indexed: true,
|
|
36
|
-
internalType: "address",
|
|
37
|
-
name: "from",
|
|
38
|
-
type: "address",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
indexed: true,
|
|
42
|
-
internalType: "address",
|
|
43
|
-
name: "to",
|
|
44
|
-
type: "address",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
indexed: false,
|
|
48
|
-
internalType: "uint256",
|
|
49
|
-
name: "value",
|
|
50
|
-
type: "uint256",
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
name: "Transfer",
|
|
54
|
-
type: "event",
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* FUNCTIONS
|
|
59
|
-
*/
|
|
60
|
-
const allowance: abi.Function.Definition = {
|
|
61
|
-
inputs: [
|
|
62
|
-
{
|
|
63
|
-
internalType: "address",
|
|
64
|
-
name: "owner",
|
|
65
|
-
type: "address",
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
internalType: "address",
|
|
69
|
-
name: "spender",
|
|
70
|
-
type: "address",
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
name: "allowance",
|
|
74
|
-
outputs: [
|
|
75
|
-
{
|
|
76
|
-
internalType: "uint256",
|
|
77
|
-
name: "",
|
|
78
|
-
type: "uint256",
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
stateMutability: "view",
|
|
82
|
-
type: "function",
|
|
83
|
-
};
|
|
84
|
-
const approve: abi.Function.Definition = {
|
|
85
|
-
inputs: [
|
|
86
|
-
{
|
|
87
|
-
internalType: "address",
|
|
88
|
-
name: "spender",
|
|
89
|
-
type: "address",
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
internalType: "uint256",
|
|
93
|
-
name: "amount",
|
|
94
|
-
type: "uint256",
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
name: "approve",
|
|
98
|
-
outputs: [
|
|
99
|
-
{
|
|
100
|
-
internalType: "bool",
|
|
101
|
-
name: "",
|
|
102
|
-
type: "bool",
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
stateMutability: "nonpayable",
|
|
106
|
-
type: "function",
|
|
107
|
-
};
|
|
108
|
-
const balanceOf: abi.Function.Definition = {
|
|
109
|
-
inputs: [
|
|
110
|
-
{
|
|
111
|
-
internalType: "address",
|
|
112
|
-
name: "account",
|
|
113
|
-
type: "address",
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
name: "balanceOf",
|
|
117
|
-
outputs: [
|
|
118
|
-
{
|
|
119
|
-
internalType: "uint256",
|
|
120
|
-
name: "",
|
|
121
|
-
type: "uint256",
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
stateMutability: "view",
|
|
125
|
-
type: "function",
|
|
126
|
-
};
|
|
127
|
-
const decimals: abi.Function.Definition = {
|
|
128
|
-
inputs: [],
|
|
129
|
-
name: "decimals",
|
|
130
|
-
outputs: [
|
|
131
|
-
{
|
|
132
|
-
internalType: "uint8",
|
|
133
|
-
name: "",
|
|
134
|
-
type: "uint8",
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
stateMutability: "view",
|
|
138
|
-
type: "function",
|
|
139
|
-
};
|
|
140
|
-
const name: abi.Function.Definition = {
|
|
141
|
-
inputs: [],
|
|
142
|
-
name: "name",
|
|
143
|
-
outputs: [
|
|
144
|
-
{
|
|
145
|
-
internalType: "string",
|
|
146
|
-
name: "",
|
|
147
|
-
type: "string",
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
stateMutability: "view",
|
|
151
|
-
type: "function",
|
|
152
|
-
};
|
|
153
|
-
const supportsInterface: abi.Function.Definition = {
|
|
154
|
-
inputs: [
|
|
155
|
-
{
|
|
156
|
-
internalType: "bytes4",
|
|
157
|
-
name: "interfaceId",
|
|
158
|
-
type: "bytes4",
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
name: "supportsInterface",
|
|
162
|
-
outputs: [
|
|
163
|
-
{
|
|
164
|
-
internalType: "bool",
|
|
165
|
-
name: "",
|
|
166
|
-
type: "bool",
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
stateMutability: "view",
|
|
170
|
-
type: "function",
|
|
171
|
-
};
|
|
172
|
-
const symbol: abi.Function.Definition = {
|
|
173
|
-
inputs: [],
|
|
174
|
-
name: "symbol",
|
|
175
|
-
outputs: [
|
|
176
|
-
{
|
|
177
|
-
internalType: "string",
|
|
178
|
-
name: "",
|
|
179
|
-
type: "string",
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
stateMutability: "view",
|
|
183
|
-
type: "function",
|
|
184
|
-
};
|
|
185
|
-
const totalSupply: abi.Function.Definition = {
|
|
186
|
-
inputs: [],
|
|
187
|
-
name: "totalSupply",
|
|
188
|
-
outputs: [
|
|
189
|
-
{
|
|
190
|
-
internalType: "uint256",
|
|
191
|
-
name: "",
|
|
192
|
-
type: "uint256",
|
|
193
|
-
},
|
|
194
|
-
],
|
|
195
|
-
stateMutability: "view",
|
|
196
|
-
type: "function",
|
|
197
|
-
};
|
|
198
|
-
const transfer: abi.Function.Definition = {
|
|
199
|
-
inputs: [
|
|
200
|
-
{
|
|
201
|
-
internalType: "address",
|
|
202
|
-
name: "to",
|
|
203
|
-
type: "address",
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
internalType: "uint256",
|
|
207
|
-
name: "amount",
|
|
208
|
-
type: "uint256",
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
name: "transfer",
|
|
212
|
-
outputs: [
|
|
213
|
-
{
|
|
214
|
-
internalType: "bool",
|
|
215
|
-
name: "",
|
|
216
|
-
type: "bool",
|
|
217
|
-
},
|
|
218
|
-
],
|
|
219
|
-
stateMutability: "nonpayable",
|
|
220
|
-
type: "function",
|
|
221
|
-
};
|
|
222
|
-
const transferFrom: abi.Function.Definition = {
|
|
223
|
-
inputs: [
|
|
224
|
-
{
|
|
225
|
-
internalType: "address",
|
|
226
|
-
name: "from",
|
|
227
|
-
type: "address",
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
internalType: "address",
|
|
231
|
-
name: "to",
|
|
232
|
-
type: "address",
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
internalType: "uint256",
|
|
236
|
-
name: "amount",
|
|
237
|
-
type: "uint256",
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
name: "transferFrom",
|
|
241
|
-
outputs: [
|
|
242
|
-
{
|
|
243
|
-
internalType: "bool",
|
|
244
|
-
name: "",
|
|
245
|
-
type: "bool",
|
|
246
|
-
},
|
|
247
|
-
],
|
|
248
|
-
stateMutability: "nonpayable",
|
|
249
|
-
type: "function",
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
export default {
|
|
253
|
-
ApprovalEvent: new abi.Event(ApprovalEvent),
|
|
254
|
-
TransferEvent: new abi.Event(TransferEvent),
|
|
255
|
-
allowance: new abi.Function(allowance),
|
|
256
|
-
approve: new abi.Function(approve),
|
|
257
|
-
balanceOf: new abi.Function(balanceOf),
|
|
258
|
-
decimals: new abi.Function(decimals),
|
|
259
|
-
name: new abi.Function(name),
|
|
260
|
-
supportsInterface: new abi.Function(supportsInterface),
|
|
261
|
-
symbol: new abi.Function(symbol),
|
|
262
|
-
totalSupply: new abi.Function(totalSupply),
|
|
263
|
-
transfer: new abi.Function(transfer),
|
|
264
|
-
transferFrom: new abi.Function(transferFrom),
|
|
265
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { abi } from "thor-devkit";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* FUNCTIONS
|
|
5
|
-
*/
|
|
6
|
-
const set: abi.Function.Definition = {
|
|
7
|
-
constant: false,
|
|
8
|
-
inputs: [
|
|
9
|
-
{
|
|
10
|
-
name: "_key",
|
|
11
|
-
type: "bytes32",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: "_value",
|
|
15
|
-
type: "uint256",
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
name: "set",
|
|
19
|
-
outputs: [],
|
|
20
|
-
payable: false,
|
|
21
|
-
stateMutability: "nonpayable",
|
|
22
|
-
type: "function",
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const get: abi.Function.Definition = {
|
|
26
|
-
constant: true,
|
|
27
|
-
inputs: [
|
|
28
|
-
{
|
|
29
|
-
name: "_key",
|
|
30
|
-
type: "bytes32",
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
name: "get",
|
|
34
|
-
outputs: [
|
|
35
|
-
{
|
|
36
|
-
name: "",
|
|
37
|
-
type: "uint256",
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
payable: false,
|
|
41
|
-
stateMutability: "view",
|
|
42
|
-
type: "function",
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* EVENTS
|
|
47
|
-
*/
|
|
48
|
-
const Set: abi.Event.Definition = {
|
|
49
|
-
anonymous: false,
|
|
50
|
-
inputs: [
|
|
51
|
-
{
|
|
52
|
-
indexed: true,
|
|
53
|
-
name: "key",
|
|
54
|
-
type: "bytes32",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
indexed: false,
|
|
58
|
-
name: "value",
|
|
59
|
-
type: "uint256",
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
name: "Set",
|
|
63
|
-
type: "event",
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export default {
|
|
67
|
-
set: new abi.Function(set),
|
|
68
|
-
get: new abi.Function(get),
|
|
69
|
-
Set: new abi.Event(Set),
|
|
70
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const TransferEventSignature =
|
|
2
|
-
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef";
|
|
3
|
-
|
|
4
|
-
export const VTHO_ADDRESS = "0x0000000000000000000000000000456e65726779";
|
|
5
|
-
|
|
6
|
-
// params.sol - builtin contract (https://www.vechain.org/whitepaper/#bit_v48i3)
|
|
7
|
-
export const PARAMS_ADDRESS = "0x0000000000000000000000000000506172616d73";
|
|
8
|
-
export const REWARD_RATIO_KEY =
|
|
9
|
-
"0x00000000000000000000000000000000000000007265776172642d726174696f";
|
|
10
|
-
export const BASE_GAS_PRICE_KEY =
|
|
11
|
-
"0x000000000000000000000000000000000000626173652d6761732d7072696365";
|
|
File without changes
|