@ledgerhq/coin-concordium 0.2.0-nightly.20251209140356
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/.env.integ.test.example +2 -0
- package/.eslintrc.js +37 -0
- package/.turbo/turbo-build.log +4 -0
- package/.unimportedrc.json +29 -0
- package/CHANGELOG.md +18 -0
- package/LICENSE.txt +21 -0
- package/jest.config.js +21 -0
- package/jest.integ.config.js +8 -0
- package/lib/api/index.d.ts +4 -0
- package/lib/api/index.d.ts.map +1 -0
- package/lib/api/index.js +56 -0
- package/lib/api/index.js.map +1 -0
- package/lib/bridge/broadcast.d.ts +4 -0
- package/lib/bridge/broadcast.d.ts.map +1 -0
- package/lib/bridge/broadcast.js +11 -0
- package/lib/bridge/broadcast.js.map +1 -0
- package/lib/bridge/createTransaction.d.ts +4 -0
- package/lib/bridge/createTransaction.d.ts.map +1 -0
- package/lib/bridge/createTransaction.js +19 -0
- package/lib/bridge/createTransaction.js.map +1 -0
- package/lib/bridge/deviceTransactionConfig.d.ts +11 -0
- package/lib/bridge/deviceTransactionConfig.d.ts.map +1 -0
- package/lib/bridge/deviceTransactionConfig.js +21 -0
- package/lib/bridge/deviceTransactionConfig.js.map +1 -0
- package/lib/bridge/estimateMaxSpendable.d.ts +4 -0
- package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -0
- package/lib/bridge/estimateMaxSpendable.js +26 -0
- package/lib/bridge/estimateMaxSpendable.js.map +1 -0
- package/lib/bridge/getTransactionStatus.d.ts +4 -0
- package/lib/bridge/getTransactionStatus.d.ts.map +1 -0
- package/lib/bridge/getTransactionStatus.js +78 -0
- package/lib/bridge/getTransactionStatus.js.map +1 -0
- package/lib/bridge/index.d.ts +11 -0
- package/lib/bridge/index.d.ts.map +1 -0
- package/lib/bridge/index.js +54 -0
- package/lib/bridge/index.js.map +1 -0
- package/lib/bridge/prepareTransaction.d.ts +4 -0
- package/lib/bridge/prepareTransaction.d.ts.map +1 -0
- package/lib/bridge/prepareTransaction.js +20 -0
- package/lib/bridge/prepareTransaction.js.map +1 -0
- package/lib/bridge/signOperation.d.ts +5 -0
- package/lib/bridge/signOperation.d.ts.map +1 -0
- package/lib/bridge/signOperation.js +75 -0
- package/lib/bridge/signOperation.js.map +1 -0
- package/lib/bridge/sync.d.ts +3 -0
- package/lib/bridge/sync.d.ts.map +1 -0
- package/lib/bridge/sync.js +86 -0
- package/lib/bridge/sync.js.map +1 -0
- package/lib/bridge/transaction.d.ts +15 -0
- package/lib/bridge/transaction.d.ts.map +1 -0
- package/lib/bridge/transaction.js +50 -0
- package/lib/bridge/transaction.js.map +1 -0
- package/lib/bridge/updateTransaction.d.ts +4 -0
- package/lib/bridge/updateTransaction.d.ts.map +1 -0
- package/lib/bridge/updateTransaction.js +17 -0
- package/lib/bridge/updateTransaction.js.map +1 -0
- package/lib/common-logic/account/getBalance.d.ts +3 -0
- package/lib/common-logic/account/getBalance.d.ts.map +1 -0
- package/lib/common-logic/account/getBalance.js +10 -0
- package/lib/common-logic/account/getBalance.js.map +1 -0
- package/lib/common-logic/account/getNextSequence.d.ts +2 -0
- package/lib/common-logic/account/getNextSequence.d.ts.map +1 -0
- package/lib/common-logic/account/getNextSequence.js +9 -0
- package/lib/common-logic/account/getNextSequence.js.map +1 -0
- package/lib/common-logic/common.d.ts +3 -0
- package/lib/common-logic/common.d.ts.map +1 -0
- package/lib/common-logic/common.js +11 -0
- package/lib/common-logic/common.js.map +1 -0
- package/lib/common-logic/history/lastBlock.d.ts +3 -0
- package/lib/common-logic/history/lastBlock.d.ts.map +1 -0
- package/lib/common-logic/history/lastBlock.js +13 -0
- package/lib/common-logic/history/lastBlock.js.map +1 -0
- package/lib/common-logic/history/listOperations.d.ts +11 -0
- package/lib/common-logic/history/listOperations.d.ts.map +1 -0
- package/lib/common-logic/history/listOperations.js +53 -0
- package/lib/common-logic/history/listOperations.js.map +1 -0
- package/lib/common-logic/index.d.ts +11 -0
- package/lib/common-logic/index.d.ts.map +1 -0
- package/lib/common-logic/index.js +24 -0
- package/lib/common-logic/index.js.map +1 -0
- package/lib/common-logic/transaction/broadcast.d.ts +2 -0
- package/lib/common-logic/transaction/broadcast.d.ts.map +1 -0
- package/lib/common-logic/transaction/broadcast.js +9 -0
- package/lib/common-logic/transaction/broadcast.js.map +1 -0
- package/lib/common-logic/transaction/combine.d.ts +2 -0
- package/lib/common-logic/transaction/combine.d.ts.map +1 -0
- package/lib/common-logic/transaction/combine.js +9 -0
- package/lib/common-logic/transaction/combine.js.map +1 -0
- package/lib/common-logic/transaction/craftTransaction.d.ts +15 -0
- package/lib/common-logic/transaction/craftTransaction.d.ts.map +1 -0
- package/lib/common-logic/transaction/craftTransaction.js +20 -0
- package/lib/common-logic/transaction/craftTransaction.js.map +1 -0
- package/lib/common-logic/transaction/estimateFees.d.ts +2 -0
- package/lib/common-logic/transaction/estimateFees.d.ts.map +1 -0
- package/lib/common-logic/transaction/estimateFees.js +21 -0
- package/lib/common-logic/transaction/estimateFees.js.map +1 -0
- package/lib/common-logic/utils.d.ts +6 -0
- package/lib/common-logic/utils.d.ts.map +1 -0
- package/lib/common-logic/utils.js +22 -0
- package/lib/common-logic/utils.js.map +1 -0
- package/lib/config.d.ts +12 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +9 -0
- package/lib/config.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/lib/network/indexer.d.ts +6 -0
- package/lib/network/indexer.d.ts.map +1 -0
- package/lib/network/indexer.js +19 -0
- package/lib/network/indexer.js.map +1 -0
- package/lib/network/mock-network.d.ts +5 -0
- package/lib/network/mock-network.d.ts.map +1 -0
- package/lib/network/mock-network.js +29 -0
- package/lib/network/mock-network.js.map +1 -0
- package/lib/network/node.d.ts +12 -0
- package/lib/network/node.d.ts.map +1 -0
- package/lib/network/node.js +92 -0
- package/lib/network/node.js.map +1 -0
- package/lib/network/types.d.ts +47 -0
- package/lib/network/types.d.ts.map +1 -0
- package/lib/network/types.js +7 -0
- package/lib/network/types.js.map +1 -0
- package/lib/signer/getAddress.d.ts +6 -0
- package/lib/signer/getAddress.d.ts.map +1 -0
- package/lib/signer/getAddress.js +14 -0
- package/lib/signer/getAddress.js.map +1 -0
- package/lib/signer/index.d.ts +6 -0
- package/lib/signer/index.d.ts.map +1 -0
- package/lib/signer/index.js +11 -0
- package/lib/signer/index.js.map +1 -0
- package/lib/test/bot-deviceActions.d.ts +4 -0
- package/lib/test/bot-deviceActions.d.ts.map +1 -0
- package/lib/test/bot-deviceActions.js +44 -0
- package/lib/test/bot-deviceActions.js.map +1 -0
- package/lib/test/bot-specs.d.ts +2 -0
- package/lib/test/bot-specs.d.ts.map +1 -0
- package/lib/test/bot-specs.js +79 -0
- package/lib/test/bot-specs.js.map +1 -0
- package/lib/test/bridgeDatasetTest.d.ts +5 -0
- package/lib/test/bridgeDatasetTest.d.ts.map +1 -0
- package/lib/test/bridgeDatasetTest.js +148 -0
- package/lib/test/bridgeDatasetTest.js.map +1 -0
- package/lib/test/cli.d.ts +26 -0
- package/lib/test/cli.d.ts.map +1 -0
- package/lib/test/cli.js +36 -0
- package/lib/test/cli.js.map +1 -0
- package/lib/test/index.d.ts +5 -0
- package/lib/test/index.d.ts.map +1 -0
- package/lib/test/index.js +26 -0
- package/lib/test/index.js.map +1 -0
- package/lib/types/assets.d.ts +3 -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/bridge.d.ts +23 -0
- package/lib/types/bridge.d.ts.map +1 -0
- package/lib/types/bridge.js +3 -0
- package/lib/types/bridge.js.map +1 -0
- package/lib/types/errors.d.ts +4 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/errors.js +6 -0
- package/lib/types/errors.js.map +1 -0
- package/lib/types/index.d.ts +13 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +19 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/signer.d.ts +10 -0
- package/lib/types/signer.d.ts.map +1 -0
- package/lib/types/signer.js +3 -0
- package/lib/types/signer.js.map +1 -0
- package/lib-es/api/index.d.ts +4 -0
- package/lib-es/api/index.d.ts.map +1 -0
- package/lib-es/api/index.js +50 -0
- package/lib-es/api/index.js.map +1 -0
- package/lib-es/bridge/broadcast.d.ts +4 -0
- package/lib-es/bridge/broadcast.d.ts.map +1 -0
- package/lib-es/bridge/broadcast.js +7 -0
- package/lib-es/bridge/broadcast.js.map +1 -0
- package/lib-es/bridge/createTransaction.d.ts +4 -0
- package/lib-es/bridge/createTransaction.d.ts.map +1 -0
- package/lib-es/bridge/createTransaction.js +12 -0
- package/lib-es/bridge/createTransaction.js.map +1 -0
- package/lib-es/bridge/deviceTransactionConfig.d.ts +11 -0
- package/lib-es/bridge/deviceTransactionConfig.d.ts.map +1 -0
- package/lib-es/bridge/deviceTransactionConfig.js +19 -0
- package/lib-es/bridge/deviceTransactionConfig.js.map +1 -0
- package/lib-es/bridge/estimateMaxSpendable.d.ts +4 -0
- package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -0
- package/lib-es/bridge/estimateMaxSpendable.js +19 -0
- package/lib-es/bridge/estimateMaxSpendable.js.map +1 -0
- package/lib-es/bridge/getTransactionStatus.d.ts +4 -0
- package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -0
- package/lib-es/bridge/getTransactionStatus.js +71 -0
- package/lib-es/bridge/getTransactionStatus.js.map +1 -0
- package/lib-es/bridge/index.d.ts +11 -0
- package/lib-es/bridge/index.d.ts.map +1 -0
- package/lib-es/bridge/index.js +48 -0
- package/lib-es/bridge/index.js.map +1 -0
- package/lib-es/bridge/prepareTransaction.d.ts +4 -0
- package/lib-es/bridge/prepareTransaction.d.ts.map +1 -0
- package/lib-es/bridge/prepareTransaction.js +13 -0
- package/lib-es/bridge/prepareTransaction.js.map +1 -0
- package/lib-es/bridge/signOperation.d.ts +5 -0
- package/lib-es/bridge/signOperation.d.ts.map +1 -0
- package/lib-es/bridge/signOperation.js +68 -0
- package/lib-es/bridge/signOperation.js.map +1 -0
- package/lib-es/bridge/sync.d.ts +3 -0
- package/lib-es/bridge/sync.d.ts.map +1 -0
- package/lib-es/bridge/sync.js +79 -0
- package/lib-es/bridge/sync.js.map +1 -0
- package/lib-es/bridge/transaction.d.ts +15 -0
- package/lib-es/bridge/transaction.d.ts.map +1 -0
- package/lib-es/bridge/transaction.js +44 -0
- package/lib-es/bridge/transaction.js.map +1 -0
- package/lib-es/bridge/updateTransaction.d.ts +4 -0
- package/lib-es/bridge/updateTransaction.d.ts.map +1 -0
- package/lib-es/bridge/updateTransaction.js +13 -0
- package/lib-es/bridge/updateTransaction.js.map +1 -0
- package/lib-es/common-logic/account/getBalance.d.ts +3 -0
- package/lib-es/common-logic/account/getBalance.d.ts.map +1 -0
- package/lib-es/common-logic/account/getBalance.js +7 -0
- package/lib-es/common-logic/account/getBalance.js.map +1 -0
- package/lib-es/common-logic/account/getNextSequence.d.ts +2 -0
- package/lib-es/common-logic/account/getNextSequence.d.ts.map +1 -0
- package/lib-es/common-logic/account/getNextSequence.js +6 -0
- package/lib-es/common-logic/account/getNextSequence.js.map +1 -0
- package/lib-es/common-logic/common.d.ts +3 -0
- package/lib-es/common-logic/common.d.ts.map +1 -0
- package/lib-es/common-logic/common.js +7 -0
- package/lib-es/common-logic/common.js.map +1 -0
- package/lib-es/common-logic/history/lastBlock.d.ts +3 -0
- package/lib-es/common-logic/history/lastBlock.d.ts.map +1 -0
- package/lib-es/common-logic/history/lastBlock.js +10 -0
- package/lib-es/common-logic/history/lastBlock.js.map +1 -0
- package/lib-es/common-logic/history/listOperations.d.ts +11 -0
- package/lib-es/common-logic/history/listOperations.d.ts.map +1 -0
- package/lib-es/common-logic/history/listOperations.js +50 -0
- package/lib-es/common-logic/history/listOperations.js.map +1 -0
- package/lib-es/common-logic/index.d.ts +11 -0
- package/lib-es/common-logic/index.d.ts.map +1 -0
- package/lib-es/common-logic/index.js +11 -0
- package/lib-es/common-logic/index.js.map +1 -0
- package/lib-es/common-logic/transaction/broadcast.d.ts +2 -0
- package/lib-es/common-logic/transaction/broadcast.d.ts.map +1 -0
- package/lib-es/common-logic/transaction/broadcast.js +6 -0
- package/lib-es/common-logic/transaction/broadcast.js.map +1 -0
- package/lib-es/common-logic/transaction/combine.d.ts +2 -0
- package/lib-es/common-logic/transaction/combine.d.ts.map +1 -0
- package/lib-es/common-logic/transaction/combine.js +6 -0
- package/lib-es/common-logic/transaction/combine.js.map +1 -0
- package/lib-es/common-logic/transaction/craftTransaction.d.ts +15 -0
- package/lib-es/common-logic/transaction/craftTransaction.d.ts.map +1 -0
- package/lib-es/common-logic/transaction/craftTransaction.js +17 -0
- package/lib-es/common-logic/transaction/craftTransaction.js.map +1 -0
- package/lib-es/common-logic/transaction/estimateFees.d.ts +2 -0
- package/lib-es/common-logic/transaction/estimateFees.d.ts.map +1 -0
- package/lib-es/common-logic/transaction/estimateFees.js +18 -0
- package/lib-es/common-logic/transaction/estimateFees.js.map +1 -0
- package/lib-es/common-logic/utils.d.ts +6 -0
- package/lib-es/common-logic/utils.d.ts.map +1 -0
- package/lib-es/common-logic/utils.js +13 -0
- package/lib-es/common-logic/utils.js.map +1 -0
- package/lib-es/config.d.ts +12 -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/index.d.ts +4 -0
- package/lib-es/index.d.ts.map +1 -0
- package/lib-es/index.js +3 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/network/indexer.d.ts +6 -0
- package/lib-es/network/indexer.d.ts.map +1 -0
- package/lib-es/network/indexer.js +12 -0
- package/lib-es/network/indexer.js.map +1 -0
- package/lib-es/network/mock-network.d.ts +5 -0
- package/lib-es/network/mock-network.d.ts.map +1 -0
- package/lib-es/network/mock-network.js +25 -0
- package/lib-es/network/mock-network.js.map +1 -0
- package/lib-es/network/node.d.ts +12 -0
- package/lib-es/network/node.d.ts.map +1 -0
- package/lib-es/network/node.js +80 -0
- package/lib-es/network/node.js.map +1 -0
- package/lib-es/network/types.d.ts +47 -0
- package/lib-es/network/types.d.ts.map +1 -0
- package/lib-es/network/types.js +4 -0
- package/lib-es/network/types.js.map +1 -0
- package/lib-es/signer/getAddress.d.ts +6 -0
- package/lib-es/signer/getAddress.d.ts.map +1 -0
- package/lib-es/signer/getAddress.js +12 -0
- package/lib-es/signer/getAddress.js.map +1 -0
- package/lib-es/signer/index.d.ts +6 -0
- package/lib-es/signer/index.d.ts.map +1 -0
- package/lib-es/signer/index.js +6 -0
- package/lib-es/signer/index.js.map +1 -0
- package/lib-es/test/bot-deviceActions.d.ts +4 -0
- package/lib-es/test/bot-deviceActions.d.ts.map +1 -0
- package/lib-es/test/bot-deviceActions.js +41 -0
- package/lib-es/test/bot-deviceActions.js.map +1 -0
- package/lib-es/test/bot-specs.d.ts +1 -0
- package/lib-es/test/bot-specs.d.ts.map +1 -0
- package/lib-es/test/bot-specs.js +78 -0
- package/lib-es/test/bot-specs.js.map +1 -0
- package/lib-es/test/bridgeDatasetTest.d.ts +5 -0
- package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -0
- package/lib-es/test/bridgeDatasetTest.js +142 -0
- package/lib-es/test/bridgeDatasetTest.js.map +1 -0
- package/lib-es/test/cli.d.ts +26 -0
- package/lib-es/test/cli.d.ts.map +1 -0
- package/lib-es/test/cli.js +30 -0
- package/lib-es/test/cli.js.map +1 -0
- package/lib-es/test/index.d.ts +5 -0
- package/lib-es/test/index.d.ts.map +1 -0
- package/lib-es/test/index.js +6 -0
- package/lib-es/test/index.js.map +1 -0
- package/lib-es/types/assets.d.ts +3 -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/bridge.d.ts +23 -0
- package/lib-es/types/bridge.d.ts.map +1 -0
- package/lib-es/types/bridge.js +2 -0
- package/lib-es/types/bridge.js.map +1 -0
- package/lib-es/types/errors.d.ts +4 -0
- package/lib-es/types/errors.d.ts.map +1 -0
- package/lib-es/types/errors.js +3 -0
- package/lib-es/types/errors.js.map +1 -0
- package/lib-es/types/index.d.ts +13 -0
- package/lib-es/types/index.d.ts.map +1 -0
- package/lib-es/types/index.js +3 -0
- package/lib-es/types/index.js.map +1 -0
- package/lib-es/types/signer.d.ts +10 -0
- package/lib-es/types/signer.d.ts.map +1 -0
- package/lib-es/types/signer.js +2 -0
- package/lib-es/types/signer.js.map +1 -0
- package/package.json +137 -0
- package/src/api/index.test.ts +22 -0
- package/src/api/index.ts +88 -0
- package/src/bridge/broadcast.test.ts +36 -0
- package/src/bridge/broadcast.ts +11 -0
- package/src/bridge/createTransaction.test.ts +12 -0
- package/src/bridge/createTransaction.ts +14 -0
- package/src/bridge/deviceTransactionConfig.test.ts +20 -0
- package/src/bridge/deviceTransactionConfig.ts +34 -0
- package/src/bridge/estimateMaxSpendable.ts +25 -0
- package/src/bridge/getTransactionStatus.ts +88 -0
- package/src/bridge/index.test.ts +26 -0
- package/src/bridge/index.ts +65 -0
- package/src/bridge/prepareTransaction.test.ts +29 -0
- package/src/bridge/prepareTransaction.ts +25 -0
- package/src/bridge/signOperation.ts +94 -0
- package/src/bridge/sync.ts +106 -0
- package/src/bridge/transaction.ts +61 -0
- package/src/bridge/updateTransaction.ts +17 -0
- package/src/common-logic/account/getBalance.ts +8 -0
- package/src/common-logic/account/getNextSequence.ts +6 -0
- package/src/common-logic/common.ts +8 -0
- package/src/common-logic/history/lastBlock.ts +11 -0
- package/src/common-logic/history/listOperations.ts +65 -0
- package/src/common-logic/index.ts +11 -0
- package/src/common-logic/transaction/broadcast.ts +6 -0
- package/src/common-logic/transaction/combine.ts +6 -0
- package/src/common-logic/transaction/craftTransaction.ts +36 -0
- package/src/common-logic/transaction/estimateFees.ts +16 -0
- package/src/common-logic/utils.ts +18 -0
- package/src/config.ts +12 -0
- package/src/index.ts +4 -0
- package/src/network/indexer.ts +17 -0
- package/src/network/mock-network.ts +25 -0
- package/src/network/node.ts +94 -0
- package/src/network/types.ts +51 -0
- package/src/signer/getAddress.ts +20 -0
- package/src/signer/index.ts +7 -0
- package/src/test/bot-deviceActions.ts +48 -0
- package/src/test/bot-specs.ts +76 -0
- package/src/test/bridgeDatasetTest.ts +147 -0
- package/src/test/cli.ts +44 -0
- package/src/test/index.ts +6 -0
- package/src/types/assets.ts +3 -0
- package/src/types/bridge.ts +33 -0
- package/src/types/errors.ts +3 -0
- package/src/types/index.ts +13 -0
- package/src/types/signer.ts +11 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
import invariant from "invariant";
|
|
4
|
+
import expect from "expect";
|
|
5
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
6
|
+
import type { AppSpec } from "@ledgerhq/coin-framework/bot/types";
|
|
7
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
|
8
|
+
import { parseCurrencyUnit } from "@ledgerhq/coin-framework/currencies/index";
|
|
9
|
+
import { botTest, genericTestDestination, pickSiblings } from "@ledgerhq/coin-framework/bot/specs";
|
|
10
|
+
import { acceptTransaction } from "./bot-deviceActions";
|
|
11
|
+
import type { Transaction } from "../types";
|
|
12
|
+
|
|
13
|
+
const currency = getCryptoCurrencyById("concordium");
|
|
14
|
+
const minAmountCutoff = parseCurrencyUnit(currency.units[0], "0.1");
|
|
15
|
+
const reserve = parseCurrencyUnit(currency.units[0], "20");
|
|
16
|
+
|
|
17
|
+
const concordiumSpec: AppSpec<Transaction> = {
|
|
18
|
+
name: "BOILERPLATE",
|
|
19
|
+
currency,
|
|
20
|
+
appQuery: {
|
|
21
|
+
model: DeviceModelId.nanoS,
|
|
22
|
+
appName: "BOILERPLATE_APP_NAME",
|
|
23
|
+
},
|
|
24
|
+
genericDeviceAction: acceptTransaction,
|
|
25
|
+
minViableAmount: minAmountCutoff,
|
|
26
|
+
mutations: [
|
|
27
|
+
{
|
|
28
|
+
name: "move ~50%",
|
|
29
|
+
maxRun: 2,
|
|
30
|
+
testDestination: genericTestDestination,
|
|
31
|
+
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
32
|
+
invariant(maxSpendable.gt(minAmountCutoff), "balance is too low");
|
|
33
|
+
const transaction = bridge.createTransaction(account);
|
|
34
|
+
const sibling = pickSiblings(siblings, 3);
|
|
35
|
+
const recipient = sibling.freshAddress;
|
|
36
|
+
let amount = maxSpendable.div(1.9 + 0.2 * Math.random()).integerValue();
|
|
37
|
+
|
|
38
|
+
if (!sibling.used && amount.lt(reserve)) {
|
|
39
|
+
invariant(
|
|
40
|
+
maxSpendable.gt(reserve.plus(minAmountCutoff)),
|
|
41
|
+
"not enough funds to send to new account",
|
|
42
|
+
);
|
|
43
|
+
amount = reserve;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
transaction,
|
|
48
|
+
updates: [
|
|
49
|
+
{
|
|
50
|
+
amount,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
recipient,
|
|
54
|
+
},
|
|
55
|
+
Math.random() > 0.5
|
|
56
|
+
? {
|
|
57
|
+
tag: 123,
|
|
58
|
+
}
|
|
59
|
+
: null,
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
test: ({ account, accountBeforeTransaction, operation }) => {
|
|
64
|
+
botTest("account balance moved with operation.value", () =>
|
|
65
|
+
expect(account.balance.toString()).toBe(
|
|
66
|
+
accountBeforeTransaction.balance.minus(operation.value).toString(),
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
export default {
|
|
74
|
+
concordiumSpec,
|
|
75
|
+
};
|
|
76
|
+
*/
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
|
+
import { DatasetTest } from "@ledgerhq/types-live";
|
|
3
|
+
import { InvalidAddressBecauseDestinationIsAlsoSource } from "@ledgerhq/errors";
|
|
4
|
+
import { fromTransactionRaw } from "../bridge/transaction";
|
|
5
|
+
import { Transaction } from "../types";
|
|
6
|
+
|
|
7
|
+
export const newAddress1 = "rZvBc5e2YR1A9otS3r9DyGh3NDP8XLLp4";
|
|
8
|
+
|
|
9
|
+
export const dataset: DatasetTest<Transaction> = {
|
|
10
|
+
implementations: ["mock", "ripplejs"],
|
|
11
|
+
currencies: {
|
|
12
|
+
ripple: {
|
|
13
|
+
scanAccounts: [
|
|
14
|
+
{
|
|
15
|
+
name: "ripple seed 1",
|
|
16
|
+
unstableAccounts: true,
|
|
17
|
+
// our account is getting spammed...
|
|
18
|
+
apdus: `
|
|
19
|
+
=> e00200400d038000002c8000009080000000
|
|
20
|
+
<= 2103c73f64083463fa923e1530af6f558204853873c6a45cbfb1f2f1e2ac2a5d989c2272734a4675764165634c333153513750594864504b6b3335625a456f78446d5231789000
|
|
21
|
+
=> e002004015058000002c80000090800000000000000000000000
|
|
22
|
+
<= 2103d1adcff3e0cf1232b1416a75cd6f23b49dd6a25c69bc291a1f6783ec6825ec062272616765584842365134566276765764547a4b414e776a65435434485846434b58379000
|
|
23
|
+
=> e002004015058000002c80000090800000010000000000000000
|
|
24
|
+
<= 21036da109ee84825eab0f55fb57bcf9ef0b05621e71fb0400266fb42d6f68f9487c2272425065393169766d67384347573450414e6f657555555173756d337470786a55469000
|
|
25
|
+
=> e002004015058000002c80000090800000020000000000000000
|
|
26
|
+
<= 2102df9a55b79fb3668dac70fee7372806195841cd713ab8da9fba82240f9db8a23921725a76426335653259523141396f745333723944794768334e445038584c4c70349000
|
|
27
|
+
`,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
accounts: [
|
|
31
|
+
{
|
|
32
|
+
transactions: [
|
|
33
|
+
// FIXME
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
{
|
|
37
|
+
name: "not enough spendable balance with base reserve",
|
|
38
|
+
transaction: fromTransactionRaw({
|
|
39
|
+
family: "xrp",
|
|
40
|
+
recipient: "rB6pwovsyrFWhPYUsjj9V3CHck985QjiXi",
|
|
41
|
+
amount: "15000000",
|
|
42
|
+
tag: null,
|
|
43
|
+
fee: "1",
|
|
44
|
+
feeCustomUnit: null,
|
|
45
|
+
networkInfo: null,
|
|
46
|
+
}),
|
|
47
|
+
expectedStatus: {
|
|
48
|
+
amount: BigNumber("15000000"),
|
|
49
|
+
estimatedFees: BigNumber("1"),
|
|
50
|
+
errors: {
|
|
51
|
+
amount: new NotEnoughSpendableBalance(null, {
|
|
52
|
+
minimumAmount: formatCurrencyUnit(
|
|
53
|
+
rippleUnit,
|
|
54
|
+
BigNumber("20"),
|
|
55
|
+
{
|
|
56
|
+
disableRounding: true,
|
|
57
|
+
useGrouping: false,
|
|
58
|
+
showCode: true,
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
warnings: {},
|
|
64
|
+
totalSpent: BigNumber("15000001"),
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
*/
|
|
68
|
+
// FIXME
|
|
69
|
+
|
|
70
|
+
/*
|
|
71
|
+
{
|
|
72
|
+
name: "operation amount to low to create the recipient account",
|
|
73
|
+
transaction: fromTransactionRaw({
|
|
74
|
+
family: "xrp",
|
|
75
|
+
recipient: newAddress1,
|
|
76
|
+
amount: "10000000",
|
|
77
|
+
tag: null,
|
|
78
|
+
fee: "1",
|
|
79
|
+
feeCustomUnit: null,
|
|
80
|
+
networkInfo: null
|
|
81
|
+
}),
|
|
82
|
+
expectedStatus: {
|
|
83
|
+
amount: BigNumber("10000000"),
|
|
84
|
+
estimatedFees: BigNumber("1"),
|
|
85
|
+
errors: {
|
|
86
|
+
amount: new NotEnoughBalanceBecauseDestinationNotCreated()
|
|
87
|
+
},
|
|
88
|
+
warnings: {},
|
|
89
|
+
totalSpent: BigNumber("10000001")
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
*/
|
|
93
|
+
{
|
|
94
|
+
name: "recipient and sender must not be the same",
|
|
95
|
+
transaction: fromTransactionRaw({
|
|
96
|
+
family: "concordium",
|
|
97
|
+
recipient: "rageXHB6Q4VbvvWdTzKANwjeCT4HXFCKX7",
|
|
98
|
+
amount: "10000000",
|
|
99
|
+
fee: "1",
|
|
100
|
+
}),
|
|
101
|
+
expectedStatus: {
|
|
102
|
+
amount: new BigNumber("10000000"),
|
|
103
|
+
estimatedFees: new BigNumber("1"),
|
|
104
|
+
errors: {
|
|
105
|
+
recipient: new InvalidAddressBecauseDestinationIsAlsoSource(),
|
|
106
|
+
},
|
|
107
|
+
warnings: {},
|
|
108
|
+
totalSpent: new BigNumber("10000001"),
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "Operation with tag succeed",
|
|
113
|
+
transaction: fromTransactionRaw({
|
|
114
|
+
family: "concordium",
|
|
115
|
+
recipient: "rB6pwovsyrFWhPYUsjj9V3CHck985QjiXi",
|
|
116
|
+
amount: "10000000",
|
|
117
|
+
fee: "1",
|
|
118
|
+
}),
|
|
119
|
+
expectedStatus: {
|
|
120
|
+
amount: new BigNumber("10000000"),
|
|
121
|
+
estimatedFees: new BigNumber("1"),
|
|
122
|
+
errors: {},
|
|
123
|
+
warnings: {},
|
|
124
|
+
totalSpent: new BigNumber("10000001"),
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
raw: {
|
|
129
|
+
id: "ripplejs:2:ripple:rageXHB6Q4VbvvWdTzKANwjeCT4HXFCKX7:",
|
|
130
|
+
seedIdentifier: "rageXHB6Q4VbvvWdTzKANwjeCT4HXFCKX7",
|
|
131
|
+
name: "XRP 1",
|
|
132
|
+
derivationMode: "",
|
|
133
|
+
index: 0,
|
|
134
|
+
freshAddress: "rageXHB6Q4VbvvWdTzKANwjeCT4HXFCKX7",
|
|
135
|
+
freshAddressPath: "44'/144'/0'/0/0",
|
|
136
|
+
blockHeight: 0,
|
|
137
|
+
operations: [],
|
|
138
|
+
pendingOperations: [],
|
|
139
|
+
currencyId: "ripple",
|
|
140
|
+
lastSyncDate: "",
|
|
141
|
+
balance: "21000310",
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
package/src/test/cli.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import type { AccountLike } from "@ledgerhq/types-live";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
import type { Transaction } from "../types";
|
|
5
|
+
|
|
6
|
+
const options = [
|
|
7
|
+
{
|
|
8
|
+
name: "fee",
|
|
9
|
+
type: String,
|
|
10
|
+
desc: "how much fee",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "tag",
|
|
14
|
+
type: Number,
|
|
15
|
+
desc: "ripple tag",
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
function inferTransactions(
|
|
20
|
+
transactions: Array<{
|
|
21
|
+
account: AccountLike;
|
|
22
|
+
transaction: Transaction;
|
|
23
|
+
}>,
|
|
24
|
+
opts: { tag?: number | null | undefined; fee?: string },
|
|
25
|
+
{
|
|
26
|
+
inferAmount,
|
|
27
|
+
}: { inferAmount: (account: AccountLike, fee?: string) => BigNumber | null | undefined },
|
|
28
|
+
): Transaction[] {
|
|
29
|
+
return transactions.flatMap(({ transaction, account }) => {
|
|
30
|
+
invariant(transaction.family === "concordium", "Concordium family");
|
|
31
|
+
return {
|
|
32
|
+
...transaction,
|
|
33
|
+
fee: inferAmount(account, opts.fee || "0.001brp"),
|
|
34
|
+
tag: opts.tag,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default function makeCliTools() {
|
|
40
|
+
return {
|
|
41
|
+
options,
|
|
42
|
+
inferTransactions,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { BigNumber } from "bignumber.js";
|
|
2
|
+
import type { Unit } from "@ledgerhq/types-cryptoassets";
|
|
3
|
+
import type {
|
|
4
|
+
TransactionCommon,
|
|
5
|
+
TransactionCommonRaw,
|
|
6
|
+
TransactionStatusCommon,
|
|
7
|
+
TransactionStatusCommonRaw,
|
|
8
|
+
} from "@ledgerhq/types-live";
|
|
9
|
+
|
|
10
|
+
export type NetworkInfo = {
|
|
11
|
+
family: "concordium";
|
|
12
|
+
serverFee: BigNumber;
|
|
13
|
+
baseReserve: BigNumber;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type NetworkInfoRaw = {
|
|
17
|
+
family: "concordium";
|
|
18
|
+
serverFee: string;
|
|
19
|
+
baseReserve: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type Transaction = TransactionCommon & {
|
|
23
|
+
family: "concordium";
|
|
24
|
+
fee: BigNumber | null | undefined;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type TransactionRaw = TransactionCommonRaw & {
|
|
28
|
+
family: "concordium";
|
|
29
|
+
fee: string | null | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type TransactionStatus = TransactionStatusCommon;
|
|
33
|
+
export type TransactionStatusRaw = TransactionStatusCommonRaw;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./bridge";
|
|
2
|
+
export * from "./signer";
|
|
3
|
+
|
|
4
|
+
export type ConcordiumNativeTransaction = {
|
|
5
|
+
TransactionType: "Payment";
|
|
6
|
+
Account: string;
|
|
7
|
+
Amount: string;
|
|
8
|
+
Destination: string;
|
|
9
|
+
Fee: string;
|
|
10
|
+
Sequence: number;
|
|
11
|
+
SigningPubKey?: string;
|
|
12
|
+
TxnSignature?: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ConcordiumAddress = {
|
|
2
|
+
publicKey: string;
|
|
3
|
+
address: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export type ConcordiumSignature = string; // `0x${string}`
|
|
7
|
+
|
|
8
|
+
export interface ConcordiumSigner {
|
|
9
|
+
getAddress(path: string): Promise<ConcordiumAddress>;
|
|
10
|
+
signTransaction(path: string, rawTx: string): Promise<ConcordiumSignature>;
|
|
11
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"declarationMap": true,
|
|
6
|
+
"downlevelIteration": true,
|
|
7
|
+
"lib": ["es2020", "dom"],
|
|
8
|
+
"outDir": "lib",
|
|
9
|
+
"exactOptionalPropertyTypes": true
|
|
10
|
+
},
|
|
11
|
+
"include": ["src/**/*"]
|
|
12
|
+
}
|