@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
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es6: true,
|
|
5
|
+
},
|
|
6
|
+
extends: ["plugin:import/typescript"],
|
|
7
|
+
plugins: ["import"],
|
|
8
|
+
overrides: [
|
|
9
|
+
{
|
|
10
|
+
files: ["src/**/*.test.{ts,tsx}"],
|
|
11
|
+
env: {
|
|
12
|
+
"jest/globals": true,
|
|
13
|
+
},
|
|
14
|
+
plugins: ["jest"],
|
|
15
|
+
rules: {
|
|
16
|
+
"jest/no-restricted-matchers": [
|
|
17
|
+
"error",
|
|
18
|
+
{
|
|
19
|
+
toBeFalsy: null,
|
|
20
|
+
toBeTruthy: null,
|
|
21
|
+
toBeDefined: null,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
rules: {
|
|
28
|
+
eqeqeq: ["error"],
|
|
29
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
30
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
31
|
+
"no-empty-pattern": "off",
|
|
32
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
33
|
+
"@typescript-eslint/no-unused-vars": "warn",
|
|
34
|
+
"import/no-cycle": ["error"],
|
|
35
|
+
"import/order": ["error"],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entry": [
|
|
3
|
+
"src/api/index.ts",
|
|
4
|
+
"src/bridge/index.ts",
|
|
5
|
+
"src/bridge/deviceTransactionConfig.ts",
|
|
6
|
+
"src/signer/index.ts",
|
|
7
|
+
"src/test/index.ts",
|
|
8
|
+
"src/index.ts"
|
|
9
|
+
],
|
|
10
|
+
"ignorePatterns": [
|
|
11
|
+
"**/node_modules/**",
|
|
12
|
+
"**/*.fixture.ts",
|
|
13
|
+
"**/*.mock.ts",
|
|
14
|
+
"**/*.test.{js,jsx,ts,tsx}"
|
|
15
|
+
],
|
|
16
|
+
"ignoreUnresolved": [
|
|
17
|
+
"jest-get-type",
|
|
18
|
+
"jest-matcher-utils",
|
|
19
|
+
"jest-message-util"
|
|
20
|
+
],
|
|
21
|
+
"ignoreUnimported": [
|
|
22
|
+
"src/network/mock-network.ts",
|
|
23
|
+
"src/test/bot-specs.ts",
|
|
24
|
+
"src/types/assets.ts"
|
|
25
|
+
],
|
|
26
|
+
"ignoreUnused": [
|
|
27
|
+
"@ledgerhq/devices"
|
|
28
|
+
]
|
|
29
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @ledgerhq/coin-concordium
|
|
2
|
+
|
|
3
|
+
## 0.2.0-nightly.20251209140356
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#13167](https://github.com/LedgerHQ/ledger-live/pull/13167) [`e44d216`](https://github.com/LedgerHQ/ledger-live/commit/e44d216d516df87e13f033ed64fedc1ce96380f4) Thanks [@lysyi3m](https://github.com/lysyi3m)! - Concordium module init
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`50aeea1`](https://github.com/LedgerHQ/ledger-live/commit/50aeea1233056e9abff9568eb928927f39e76cff), [`fd031d7`](https://github.com/LedgerHQ/ledger-live/commit/fd031d77ca7ed011ec492700fd4d7bc86c518907), [`480a08a`](https://github.com/LedgerHQ/ledger-live/commit/480a08ae190119829910b46ecc6d2a9fb11bb7c2), [`19a54fd`](https://github.com/LedgerHQ/ledger-live/commit/19a54fd89a2d3c7481aebc28817870875f9d44dc), [`a2ecb55`](https://github.com/LedgerHQ/ledger-live/commit/a2ecb55df9d383dc282f5fe489cb14386208215e), [`7ae71b6`](https://github.com/LedgerHQ/ledger-live/commit/7ae71b64161424b398b63f77da5127085143fcdc), [`5fa83e4`](https://github.com/LedgerHQ/ledger-live/commit/5fa83e49c5fb103da7ecf0777b7e75bb35d5ed61), [`c5da2ce`](https://github.com/LedgerHQ/ledger-live/commit/c5da2cef7cded2b53c1af9aa3174cd27e5c92e0a), [`fe81926`](https://github.com/LedgerHQ/ledger-live/commit/fe81926afeb2df8e917e6bd1e4cbab13f09647fd), [`67137eb`](https://github.com/LedgerHQ/ledger-live/commit/67137eb5d7f04dd5f3610fdaa4e463d292654105), [`49ef24c`](https://github.com/LedgerHQ/ledger-live/commit/49ef24cbd1948bfd146af0b20f2128951b2dc170), [`30be235`](https://github.com/LedgerHQ/ledger-live/commit/30be2354822b3497c69322294ff1dab43375be50), [`bdacedf`](https://github.com/LedgerHQ/ledger-live/commit/bdacedfe32bea8ffce96ab675a44c0d7cf395143), [`b4a4e16`](https://github.com/LedgerHQ/ledger-live/commit/b4a4e160aae6fd64f944ab25633f6931dc4358d3), [`927ae64`](https://github.com/LedgerHQ/ledger-live/commit/927ae64db0bb04af54e25623655a001a68e0f2d3), [`903ea9c`](https://github.com/LedgerHQ/ledger-live/commit/903ea9cdacf704a0119de2803a4f409b775391a5), [`768718d`](https://github.com/LedgerHQ/ledger-live/commit/768718df029bc8799b88c0299925dc56302b0c53), [`9251b77`](https://github.com/LedgerHQ/ledger-live/commit/9251b77fcb01709723842f19220a2a41a6fc8f3b), [`a5ad7d4`](https://github.com/LedgerHQ/ledger-live/commit/a5ad7d4578c06db3e40f260451b644c27e20cb62), [`02ef98f`](https://github.com/LedgerHQ/ledger-live/commit/02ef98faeb13c182ef255e06a43c39abeb55ecc7), [`3e70677`](https://github.com/LedgerHQ/ledger-live/commit/3e706774f8c4e9b768ab18b67abc3471cf61b6b6), [`6d0c6b2`](https://github.com/LedgerHQ/ledger-live/commit/6d0c6b2eda60049d8eebda5de2c54e8f0be7d009), [`aadb3d5`](https://github.com/LedgerHQ/ledger-live/commit/aadb3d57f5719cc2cc397975eafec8094b160afe), [`e44d216`](https://github.com/LedgerHQ/ledger-live/commit/e44d216d516df87e13f033ed64fedc1ce96380f4), [`d4bad44`](https://github.com/LedgerHQ/ledger-live/commit/d4bad4433c3fb083d95820d2927a9e8beeaf244f), [`8d8e1b7`](https://github.com/LedgerHQ/ledger-live/commit/8d8e1b7bb26305af326ea21710248223d1e8653b), [`38d5880`](https://github.com/LedgerHQ/ledger-live/commit/38d5880ca6c3cc8808182e9d0f046b204914d34a), [`0d33751`](https://github.com/LedgerHQ/ledger-live/commit/0d33751bb2ae599d0d26ce6a8efdbe01757f12fb), [`07de7a8`](https://github.com/LedgerHQ/ledger-live/commit/07de7a87415ae4d1126e751d6a4d521ced3065e3), [`d37fa4b`](https://github.com/LedgerHQ/ledger-live/commit/d37fa4baf4534161bffe5033ce44fc7780c79d89), [`5e0556a`](https://github.com/LedgerHQ/ledger-live/commit/5e0556a3bd0ea60277462eed10c997b17b09d299), [`aadcec6`](https://github.com/LedgerHQ/ledger-live/commit/aadcec66847b800f79452ba1df09149e0a1cb9e8), [`bce6610`](https://github.com/LedgerHQ/ledger-live/commit/bce6610ca8554a85f8f17b6014e921fdecd3fa4f), [`2a60165`](https://github.com/LedgerHQ/ledger-live/commit/2a601656b7a23a424a29f006ec53090648fdae4f), [`b113920`](https://github.com/LedgerHQ/ledger-live/commit/b11392056bc334fc1813c473569ad3ae7be08045), [`ed8532b`](https://github.com/LedgerHQ/ledger-live/commit/ed8532bad754ca2b5f1788c6e92f4646b775ec79), [`88a5018`](https://github.com/LedgerHQ/ledger-live/commit/88a501871d58c980f18495b5b32012a3eaa9ab2c), [`c56ab86`](https://github.com/LedgerHQ/ledger-live/commit/c56ab86ab65597caf87a09b7596faa54f3104bd4), [`9659a34`](https://github.com/LedgerHQ/ledger-live/commit/9659a34d9998d5c4dff8618bf6cef7d16403680d)]:
|
|
12
|
+
- @ledgerhq/cryptoassets@13.34.0-nightly.20251209140356
|
|
13
|
+
- @ledgerhq/types-live@6.90.0-nightly.20251209140356
|
|
14
|
+
- @ledgerhq/coin-framework@6.10.0-nightly.20251209140356
|
|
15
|
+
- @ledgerhq/live-env@2.22.0-nightly.20251209140356
|
|
16
|
+
- @ledgerhq/errors@6.28.0-nightly.20251209140356
|
|
17
|
+
- @ledgerhq/devices@8.8.0-nightly.20251209140356
|
|
18
|
+
- @ledgerhq/live-network@2.1.2-nightly.20251209140356
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017-present Ledger https://www.ledger.com/
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
|
|
2
|
+
// `workerThreads: true` is required for validating object with `bigint` values
|
|
3
|
+
module.exports = {
|
|
4
|
+
preset: "ts-jest",
|
|
5
|
+
testEnvironment: "node",
|
|
6
|
+
passWithNoTests: true,
|
|
7
|
+
setupFilesAfterEnv: ["@ledgerhq/disable-network-setup"],
|
|
8
|
+
collectCoverageFrom: [
|
|
9
|
+
"src/**/*.ts",
|
|
10
|
+
"!src/**/*.test.ts",
|
|
11
|
+
"!src/**/*.spec.ts",
|
|
12
|
+
"!src/test/**/*.ts",
|
|
13
|
+
],
|
|
14
|
+
coverageReporters: ["json", ["lcov", { file: "lcov.info", projectRoot: "../../../" }], "text"],
|
|
15
|
+
testPathIgnorePatterns: ["lib/", "lib-es/", ".*\\.integ\\.test\\.[tj]s"],
|
|
16
|
+
workerThreads: true,
|
|
17
|
+
reporters: [
|
|
18
|
+
"default",
|
|
19
|
+
["jest-sonar", { outputName: "sonar-executionTests-report.xml", reportedFilePath: "absolute" }],
|
|
20
|
+
],
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAWV,MAAM,oCAAoC,CAAC;AAE5C,OAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAY9D,wBAAgB,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAmC7D"}
|
package/lib/api/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createApi = createApi;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const config_1 = __importDefault(require("../config"));
|
|
9
|
+
const common_logic_1 = require("../common-logic");
|
|
10
|
+
function createApi(config) {
|
|
11
|
+
config_1.default.setCoinConfig(() => ({ ...config, status: { type: "active" } }));
|
|
12
|
+
return {
|
|
13
|
+
broadcast: common_logic_1.broadcast,
|
|
14
|
+
combine: common_logic_1.combine,
|
|
15
|
+
craftTransaction: craft,
|
|
16
|
+
craftRawTransaction: (_transaction, _sender, _publicKey, _sequence) => {
|
|
17
|
+
throw new Error("craftRawTransaction is not supported");
|
|
18
|
+
},
|
|
19
|
+
estimateFees: estimate,
|
|
20
|
+
getBalance: common_logic_1.getBalance,
|
|
21
|
+
lastBlock: common_logic_1.lastBlock,
|
|
22
|
+
listOperations: common_logic_1.listOperations,
|
|
23
|
+
getBlock(_height) {
|
|
24
|
+
throw new Error("getBlock is not supported");
|
|
25
|
+
},
|
|
26
|
+
getBlockInfo(_height) {
|
|
27
|
+
throw new Error("getBlockInfo is not supported");
|
|
28
|
+
},
|
|
29
|
+
getStakes(_address, _cursor) {
|
|
30
|
+
throw new Error("getStakes is not supported");
|
|
31
|
+
},
|
|
32
|
+
getRewards(_address, _cursor) {
|
|
33
|
+
throw new Error("getRewards is not supported");
|
|
34
|
+
},
|
|
35
|
+
getValidators(_cursor) {
|
|
36
|
+
throw new Error("getValidators is not supported");
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
async function craft(transactionIntent) {
|
|
41
|
+
const nextSequenceNumber = await (0, common_logic_1.getNextValidSequence)(transactionIntent.sender);
|
|
42
|
+
const tx = await (0, common_logic_1.craftTransaction)({ address: transactionIntent.sender, nextSequenceNumber }, {
|
|
43
|
+
recipient: transactionIntent.recipient,
|
|
44
|
+
amount: new bignumber_js_1.default(transactionIntent.amount.toString()),
|
|
45
|
+
});
|
|
46
|
+
return { transaction: tx.serializedTransaction };
|
|
47
|
+
}
|
|
48
|
+
async function estimate(transactionIntent) {
|
|
49
|
+
const { serializedTransaction } = await (0, common_logic_1.craftTransaction)({ address: transactionIntent.sender }, {
|
|
50
|
+
recipient: transactionIntent.recipient,
|
|
51
|
+
amount: new bignumber_js_1.default(transactionIntent.amount.toString()),
|
|
52
|
+
});
|
|
53
|
+
const value = await (0, common_logic_1.estimateFees)(serializedTransaction);
|
|
54
|
+
return { value };
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;AA0BA,8BAmCC;AAhDD,gEAAqC;AACrC,uDAA8D;AAC9D,kDASyB;AAEzB,SAAgB,SAAS,CAAC,MAAwB;IAChD,gBAAU,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAE5E,OAAO;QACL,SAAS,EAAT,wBAAS;QACT,OAAO,EAAP,sBAAO;QACP,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,CACnB,YAAoB,EACpB,OAAe,EACf,UAAkB,EAClB,SAAiB,EACY,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC;QACD,YAAY,EAAE,QAAQ;QACtB,UAAU,EAAV,yBAAU;QACV,SAAS,EAAT,wBAAS;QACT,cAAc,EAAd,6BAAc;QACd,QAAQ,CAAC,OAAO;YACd,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QACD,YAAY,CAAC,OAAe;YAC1B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QACD,SAAS,CAAC,QAAgB,EAAE,OAAgB;YAC1C,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QACD,UAAU,CAAC,QAAgB,EAAE,OAAgB;YAC3C,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,aAAa,CAAC,OAAgB;YAC5B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,KAAK,CAAC,iBAAoC;IACvD,MAAM,kBAAkB,GAAG,MAAM,IAAA,mCAAoB,EAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAChF,MAAM,EAAE,GAAG,MAAM,IAAA,+BAAgB,EAC/B,EAAE,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,EACzD;QACE,SAAS,EAAE,iBAAiB,CAAC,SAAS;QACtC,MAAM,EAAE,IAAI,sBAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;KAC3D,CACF,CAAC;IACF,OAAO,EAAE,WAAW,EAAE,EAAE,CAAC,qBAAqB,EAAE,CAAC;AACnD,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,iBAAoC;IAC1D,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,IAAA,+BAAgB,EACtD,EAAE,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,EACrC;QACE,SAAS,EAAE,iBAAiB,CAAC,SAAS;QACtC,MAAM,EAAE,IAAI,sBAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;KAC3D,CACF,CAAC;IAEF,MAAM,KAAK,GAAG,MAAM,IAAA,2BAAY,EAAC,qBAAqB,CAAC,CAAC;IAExD,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../src/bridge/broadcast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,CAK7D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.broadcast = void 0;
|
|
4
|
+
const operation_1 = require("@ledgerhq/coin-framework/operation");
|
|
5
|
+
const common_logic_1 = require("../common-logic");
|
|
6
|
+
const broadcast = async ({ signedOperation: { signature, operation }, }) => {
|
|
7
|
+
const hash = await (0, common_logic_1.broadcast)(signature);
|
|
8
|
+
return (0, operation_1.patchOperationWithHash)(operation, hash);
|
|
9
|
+
};
|
|
10
|
+
exports.broadcast = broadcast;
|
|
11
|
+
//# sourceMappingURL=broadcast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../src/bridge/broadcast.ts"],"names":[],"mappings":";;;AACA,kEAA4E;AAC5E,kDAA8D;AAGvD,MAAM,SAAS,GAA4C,KAAK,EAAE,EACvE,eAAe,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,GAC1C,EAAE,EAAE;IACH,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAc,EAAC,SAAS,CAAC,CAAC;IAC7C,OAAO,IAAA,kCAAsB,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC,CAAC;AALW,QAAA,SAAS,aAKpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTransaction.d.ts","sourceRoot":"","sources":["../../src/bridge/createTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,mBAAmB,CAQ5E,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createTransaction = void 0;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
// We create an empty transaction that will be filled later
|
|
9
|
+
const createTransaction = () => ({
|
|
10
|
+
family: "concordium",
|
|
11
|
+
amount: new bignumber_js_1.default(0),
|
|
12
|
+
recipient: "",
|
|
13
|
+
fee: null,
|
|
14
|
+
memo: undefined,
|
|
15
|
+
networkInfo: null,
|
|
16
|
+
feeCustomUnit: null,
|
|
17
|
+
});
|
|
18
|
+
exports.createTransaction = createTransaction;
|
|
19
|
+
//# sourceMappingURL=createTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTransaction.js","sourceRoot":"","sources":["../../src/bridge/createTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAIrC,2DAA2D;AACpD,MAAM,iBAAiB,GAAoD,GAAG,EAAE,CAAC,CAAC;IACvF,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;IACxB,SAAS,EAAE,EAAE;IACb,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC;AARU,QAAA,iBAAiB,qBAQ3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AccountLike, Account } from "@ledgerhq/types-live";
|
|
2
|
+
import type { CommonDeviceTransactionField } from "@ledgerhq/coin-framework/transaction/common";
|
|
3
|
+
import type { Transaction, TransactionStatus } from "../types";
|
|
4
|
+
declare function getDeviceTransactionConfig({ transaction: {}, status: { amount, estimatedFees }, }: {
|
|
5
|
+
account: AccountLike;
|
|
6
|
+
parentAccount: Account | null | undefined;
|
|
7
|
+
transaction: Transaction;
|
|
8
|
+
status: TransactionStatus;
|
|
9
|
+
}): Promise<Array<CommonDeviceTransactionField>>;
|
|
10
|
+
export default getDeviceTransactionConfig;
|
|
11
|
+
//# sourceMappingURL=deviceTransactionConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceTransactionConfig.d.ts","sourceRoot":"","sources":["../../src/bridge/deviceTransactionConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG/D,iBAAe,0BAA0B,CAAC,EACxC,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,GAClC,EAAE;IACD,OAAO,EAAE,WAAW,CAAC;IACrB,aAAa,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,iBAAiB,CAAC;CAC3B,GAAG,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAkB/C;AAED,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// This method adds additional fields that need to be reviewed when signing a transaction on the device.
|
|
4
|
+
async function getDeviceTransactionConfig({ transaction: {}, status: { amount, estimatedFees }, }) {
|
|
5
|
+
const fields = [];
|
|
6
|
+
if (!amount.isZero()) {
|
|
7
|
+
fields.push({
|
|
8
|
+
type: "amount",
|
|
9
|
+
label: "Amount",
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
if (!estimatedFees.isZero()) {
|
|
13
|
+
fields.push({
|
|
14
|
+
type: "fees",
|
|
15
|
+
label: "Fees",
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return fields;
|
|
19
|
+
}
|
|
20
|
+
exports.default = getDeviceTransactionConfig;
|
|
21
|
+
//# sourceMappingURL=deviceTransactionConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceTransactionConfig.js","sourceRoot":"","sources":["../../src/bridge/deviceTransactionConfig.ts"],"names":[],"mappings":";;AAIA,wGAAwG;AACxG,KAAK,UAAU,0BAA0B,CAAC,EACxC,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,GAMlC;IACC,MAAM,MAAM,GAAwC,EAAE,CAAC;IAEvD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kBAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimateMaxSpendable.d.ts","sourceRoot":"","sources":["../../src/bridge/estimateMaxSpendable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKvC,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,sBAAsB,CAenF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.estimateMaxSpendable = void 0;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const index_1 = require("@ledgerhq/coin-framework/account/index");
|
|
9
|
+
const abandonseed_1 = require("@ledgerhq/cryptoassets/abandonseed");
|
|
10
|
+
const getTransactionStatus_1 = require("./getTransactionStatus");
|
|
11
|
+
const prepareTransaction_1 = require("./prepareTransaction");
|
|
12
|
+
const createTransaction_1 = require("./createTransaction");
|
|
13
|
+
const estimateMaxSpendable = async ({ account, parentAccount, transaction, }) => {
|
|
14
|
+
const mainAccount = (0, index_1.getMainAccount)(account, parentAccount);
|
|
15
|
+
const newTransaction = await (0, prepareTransaction_1.prepareTransaction)(mainAccount, {
|
|
16
|
+
...(0, createTransaction_1.createTransaction)(account),
|
|
17
|
+
...transaction,
|
|
18
|
+
// fee estimation might require a recipient to work, in that case, we use a dummy one
|
|
19
|
+
recipient: transaction?.recipient || (0, abandonseed_1.getAbandonSeedAddress)("concordium"),
|
|
20
|
+
amount: new bignumber_js_1.default(0),
|
|
21
|
+
});
|
|
22
|
+
const status = await (0, getTransactionStatus_1.getTransactionStatus)(mainAccount, newTransaction);
|
|
23
|
+
return bignumber_js_1.default.max(0, account.spendableBalance.minus(status.estimatedFees));
|
|
24
|
+
};
|
|
25
|
+
exports.estimateMaxSpendable = estimateMaxSpendable;
|
|
26
|
+
//# sourceMappingURL=estimateMaxSpendable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimateMaxSpendable.js","sourceRoot":"","sources":["../../src/bridge/estimateMaxSpendable.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAErC,kEAAwE;AACxE,oEAA2E;AAE3E,iEAA8D;AAC9D,6DAA0D;AAC1D,2DAAwD;AAEjD,MAAM,oBAAoB,GAAuD,KAAK,EAAE,EAC7F,OAAO,EACP,aAAa,EACb,WAAW,GACZ,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,MAAM,IAAA,uCAAkB,EAAC,WAAW,EAAE;QAC3D,GAAG,IAAA,qCAAiB,EAAC,OAAO,CAAC;QAC7B,GAAG,WAAW;QACd,qFAAqF;QACrF,SAAS,EAAE,WAAW,EAAE,SAAS,IAAI,IAAA,mCAAqB,EAAC,YAAY,CAAC;QACxE,MAAM,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;KACzB,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,IAAA,2CAAoB,EAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACvE,OAAO,sBAAS,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC;AAfW,QAAA,oBAAoB,wBAe/B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Account, AccountBridge } from "@ledgerhq/types-live";
|
|
2
|
+
import { Transaction, TransactionStatus } from "../types";
|
|
3
|
+
export declare const getTransactionStatus: AccountBridge<Transaction, Account, TransactionStatus>["getTransactionStatus"];
|
|
4
|
+
//# sourceMappingURL=getTransactionStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTransactionStatus.d.ts","sourceRoot":"","sources":["../../src/bridge/getTransactionStatus.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI1D,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAC9C,WAAW,EACX,OAAO,EACP,iBAAiB,CAClB,CAAC,sBAAsB,CAiEvB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getTransactionStatus = void 0;
|
|
7
|
+
const errors_1 = require("@ledgerhq/errors");
|
|
8
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
|
+
const index_1 = require("@ledgerhq/coin-framework/currencies/index");
|
|
10
|
+
const utils_1 = require("../common-logic/utils");
|
|
11
|
+
const config_1 = __importDefault(require("../config"));
|
|
12
|
+
const getTransactionStatus = async (account, transaction) => {
|
|
13
|
+
const errors = {};
|
|
14
|
+
const warnings = {};
|
|
15
|
+
// reserveAmount is the minimum amount of currency that an account must hold in order to stay activated
|
|
16
|
+
const reserveAmount = new bignumber_js_1.default(config_1.default.getCoinConfig().minReserve);
|
|
17
|
+
const estimatedFees = new bignumber_js_1.default(transaction.fee || 0);
|
|
18
|
+
const totalSpent = new bignumber_js_1.default(transaction.amount).plus(estimatedFees);
|
|
19
|
+
const amount = new bignumber_js_1.default(transaction.amount);
|
|
20
|
+
if (amount.gt(0) && estimatedFees.times(10).gt(amount)) {
|
|
21
|
+
// if the fee is more than 10 times the amount, we warn the user that fee is high compared to what he is sending
|
|
22
|
+
warnings.feeTooHigh = new errors_1.FeeTooHigh();
|
|
23
|
+
}
|
|
24
|
+
if (!transaction.fee) {
|
|
25
|
+
// if the fee is not loaded, we can't do much
|
|
26
|
+
errors.fee = new errors_1.FeeNotLoaded();
|
|
27
|
+
}
|
|
28
|
+
else if (transaction.fee.eq(0)) {
|
|
29
|
+
// On some chains, 0 fee could still work so this is optional
|
|
30
|
+
errors.fee = new errors_1.FeeRequired();
|
|
31
|
+
}
|
|
32
|
+
else if (totalSpent.gt(account.balance.minus(reserveAmount))) {
|
|
33
|
+
// if the total spent is greater than the balance minus the reserve amount, tx is invalid
|
|
34
|
+
errors.amount = new errors_1.NotEnoughSpendableBalance("", {
|
|
35
|
+
minimumAmount: (0, index_1.formatCurrencyUnit)(account.currency.units[0], reserveAmount, {
|
|
36
|
+
disableRounding: true,
|
|
37
|
+
useGrouping: false,
|
|
38
|
+
showCode: true,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
else if (transaction.recipient && transaction.amount.lt(reserveAmount)) {
|
|
43
|
+
// if we send an amount lower than reserve amount AND target account is new, we need to warn the user that the target account will not be activated
|
|
44
|
+
errors.amount = new errors_1.NotEnoughBalanceBecauseDestinationNotCreated("", {
|
|
45
|
+
minimalAmount: (0, index_1.formatCurrencyUnit)(account.currency.units[0], reserveAmount, {
|
|
46
|
+
disableRounding: true,
|
|
47
|
+
useGrouping: false,
|
|
48
|
+
showCode: true,
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (!transaction.recipient) {
|
|
53
|
+
errors.recipient = new errors_1.RecipientRequired("");
|
|
54
|
+
}
|
|
55
|
+
else if (account.freshAddress === transaction.recipient) {
|
|
56
|
+
// we want to prevent user from sending to themselves (even if it's technically feasible)
|
|
57
|
+
errors.recipient = new errors_1.InvalidAddressBecauseDestinationIsAlsoSource();
|
|
58
|
+
}
|
|
59
|
+
else if (!(0, utils_1.isRecipientValid)(transaction.recipient)) {
|
|
60
|
+
// We want to prevent user from sending to an invalid address
|
|
61
|
+
errors.recipient = new errors_1.InvalidAddress("", {
|
|
62
|
+
currencyName: account.currency.name,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (!errors.amount && amount.eq(0)) {
|
|
66
|
+
// if the amount is 0, we prevent the user from sending the tx (even if it's technically feasible)
|
|
67
|
+
errors.amount = new errors_1.AmountRequired();
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
errors,
|
|
71
|
+
warnings,
|
|
72
|
+
estimatedFees,
|
|
73
|
+
amount,
|
|
74
|
+
totalSpent,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
exports.getTransactionStatus = getTransactionStatus;
|
|
78
|
+
//# sourceMappingURL=getTransactionStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTransactionStatus.js","sourceRoot":"","sources":["../../src/bridge/getTransactionStatus.ts"],"names":[],"mappings":";;;;;;AAAA,6CAU0B;AAC1B,gEAAqC;AAErC,qEAA+E;AAE/E,iDAAyD;AACzD,uDAAmC;AAE5B,MAAM,oBAAoB,GAIL,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE;IACzD,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,MAAM,QAAQ,GAA0B,EAAE,CAAC;IAE3C,uGAAuG;IACvG,MAAM,aAAa,GAAG,IAAI,sBAAS,CAAC,gBAAU,CAAC,aAAa,EAAE,CAAC,UAAU,CAAC,CAAC;IAC3E,MAAM,aAAa,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACzE,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAEjD,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;QACvD,gHAAgH;QAChH,QAAQ,CAAC,UAAU,GAAG,IAAI,mBAAU,EAAE,CAAC;IACzC,CAAC;IAED,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;QACrB,6CAA6C;QAC7C,MAAM,CAAC,GAAG,GAAG,IAAI,qBAAY,EAAE,CAAC;IAClC,CAAC;SAAM,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,6DAA6D;QAC7D,MAAM,CAAC,GAAG,GAAG,IAAI,oBAAW,EAAE,CAAC;IACjC,CAAC;SAAM,IAAI,UAAU,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;QAC/D,yFAAyF;QACzF,MAAM,CAAC,MAAM,GAAG,IAAI,kCAAyB,CAAC,EAAE,EAAE;YAChD,aAAa,EAAE,IAAA,0BAAkB,EAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE;gBAC1E,eAAe,EAAE,IAAI;gBACrB,WAAW,EAAE,KAAK;gBAClB,QAAQ,EAAE,IAAI;aACf,CAAC;SACH,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;QACzE,mJAAmJ;QACnJ,MAAM,CAAC,MAAM,GAAG,IAAI,qDAA4C,CAAC,EAAE,EAAE;YACnE,aAAa,EAAE,IAAA,0BAAkB,EAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE;gBAC1E,eAAe,EAAE,IAAI;gBACrB,WAAW,EAAE,KAAK;gBAClB,QAAQ,EAAE,IAAI;aACf,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;QAC3B,MAAM,CAAC,SAAS,GAAG,IAAI,0BAAiB,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;SAAM,IAAI,OAAO,CAAC,YAAY,KAAK,WAAW,CAAC,SAAS,EAAE,CAAC;QAC1D,yFAAyF;QACzF,MAAM,CAAC,SAAS,GAAG,IAAI,qDAA4C,EAAE,CAAC;IACxE,CAAC;SAAM,IAAI,CAAC,IAAA,wBAAgB,EAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,6DAA6D;QAC7D,MAAM,CAAC,SAAS,GAAG,IAAI,uBAAc,CAAC,EAAE,EAAE;YACxC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;SACpC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,kGAAkG;QAClG,MAAM,CAAC,MAAM,GAAG,IAAI,uBAAc,EAAE,CAAC;IACvC,CAAC;IAED,OAAO;QACL,MAAM;QACN,QAAQ;QACR,aAAa;QACb,MAAM;QACN,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AArEW,QAAA,oBAAoB,wBAqE/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CoinConfig } from "@ledgerhq/coin-framework/config";
|
|
2
|
+
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
3
|
+
import type { AccountBridge, CurrencyBridge } from "@ledgerhq/types-live";
|
|
4
|
+
import { type ConcordiumCoinConfig } from "../config";
|
|
5
|
+
import { ConcordiumSigner } from "../types";
|
|
6
|
+
import type { Transaction } from "../types";
|
|
7
|
+
export declare function createBridges(signerContext: SignerContext<ConcordiumSigner>, coinConfig: CoinConfig<ConcordiumCoinConfig>): {
|
|
8
|
+
currencyBridge: CurrencyBridge;
|
|
9
|
+
accountBridge: AccountBridge<Transaction>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAA6B,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAU5C,wBAAgB,aAAa,CAC3B,aAAa,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC9C,UAAU,EAAE,UAAU,CAAC,oBAAoB,CAAC;;;EAuC7C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createBridges = createBridges;
|
|
7
|
+
const getAddressWrapper_1 = __importDefault(require("@ledgerhq/coin-framework/bridge/getAddressWrapper"));
|
|
8
|
+
const jsHelpers_1 = require("@ledgerhq/coin-framework/bridge/jsHelpers");
|
|
9
|
+
const config_1 = __importDefault(require("../config"));
|
|
10
|
+
const signer_1 = __importDefault(require("../signer"));
|
|
11
|
+
const broadcast_1 = require("./broadcast");
|
|
12
|
+
const createTransaction_1 = require("./createTransaction");
|
|
13
|
+
const estimateMaxSpendable_1 = require("./estimateMaxSpendable");
|
|
14
|
+
const getTransactionStatus_1 = require("./getTransactionStatus");
|
|
15
|
+
const prepareTransaction_1 = require("./prepareTransaction");
|
|
16
|
+
const signOperation_1 = require("./signOperation");
|
|
17
|
+
const sync_1 = require("./sync");
|
|
18
|
+
const updateTransaction_1 = require("./updateTransaction");
|
|
19
|
+
function createBridges(signerContext, coinConfig) {
|
|
20
|
+
config_1.default.setCoinConfig(coinConfig);
|
|
21
|
+
const getAddress = (0, signer_1.default)(signerContext);
|
|
22
|
+
const receive = (0, jsHelpers_1.makeAccountBridgeReceive)((0, getAddressWrapper_1.default)(getAddress));
|
|
23
|
+
const scanAccounts = (0, jsHelpers_1.makeScanAccounts)({ getAccountShape: sync_1.getAccountShape, getAddressFn: getAddress });
|
|
24
|
+
const currencyBridge = {
|
|
25
|
+
preload: () => Promise.resolve({}),
|
|
26
|
+
hydrate: () => { },
|
|
27
|
+
scanAccounts,
|
|
28
|
+
};
|
|
29
|
+
const signOperation = (0, signOperation_1.buildSignOperation)(signerContext);
|
|
30
|
+
const sync = (0, jsHelpers_1.makeSync)({ getAccountShape: sync_1.getAccountShape });
|
|
31
|
+
// we want one method per file
|
|
32
|
+
const accountBridge = {
|
|
33
|
+
broadcast: broadcast_1.broadcast,
|
|
34
|
+
createTransaction: createTransaction_1.createTransaction,
|
|
35
|
+
updateTransaction: updateTransaction_1.updateTransaction,
|
|
36
|
+
// NOTE: use updateTransaction: defaultUpdateTransaction<Transaction>,
|
|
37
|
+
// if you don't need to update the transaction patch object
|
|
38
|
+
prepareTransaction: prepareTransaction_1.prepareTransaction,
|
|
39
|
+
getTransactionStatus: getTransactionStatus_1.getTransactionStatus,
|
|
40
|
+
estimateMaxSpendable: estimateMaxSpendable_1.estimateMaxSpendable,
|
|
41
|
+
sync,
|
|
42
|
+
receive,
|
|
43
|
+
signOperation,
|
|
44
|
+
signRawOperation: () => {
|
|
45
|
+
throw new Error("signRawOperation is not supported");
|
|
46
|
+
},
|
|
47
|
+
getSerializedAddressParameters: jsHelpers_1.getSerializedAddressParameters,
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
currencyBridge,
|
|
51
|
+
accountBridge,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":";;;;;AAuBA,sCAyCC;AAhED,0GAAkF;AAClF,yEAKmD;AAInD,uDAA4E;AAC5E,uDAAiC;AAGjC,2CAAwC;AACxC,2DAAwD;AACxD,iEAA8D;AAC9D,iEAA8D;AAC9D,6DAA0D;AAC1D,mDAAqD;AACrD,iCAAyC;AACzC,2DAAwD;AAExD,SAAgB,aAAa,CAC3B,aAA8C,EAC9C,UAA4C;IAE5C,gBAAoB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAE/C,MAAM,UAAU,GAAG,IAAA,gBAAQ,EAAC,aAAa,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAA,oCAAwB,EAAC,IAAA,2BAAiB,EAAC,UAAU,CAAC,CAAC,CAAC;IAExE,MAAM,YAAY,GAAG,IAAA,4BAAgB,EAAC,EAAE,eAAe,EAAf,sBAAe,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC;IACrF,MAAM,cAAc,GAAmB;QACrC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,YAAY;KACb,CAAC;IAEF,MAAM,aAAa,GAAG,IAAA,kCAAkB,EAAC,aAAa,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,IAAA,oBAAQ,EAAC,EAAE,eAAe,EAAf,sBAAe,EAAE,CAAC,CAAC;IAC3C,8BAA8B;IAC9B,MAAM,aAAa,GAA+B;QAChD,SAAS,EAAT,qBAAS;QACT,iBAAiB,EAAjB,qCAAiB;QACjB,iBAAiB,EAAjB,qCAAiB;QACjB,sEAAsE;QACtE,2DAA2D;QAC3D,kBAAkB,EAAlB,uCAAkB;QAClB,oBAAoB,EAApB,2CAAoB;QACpB,oBAAoB,EAApB,2CAAoB;QACpB,IAAI;QACJ,OAAO;QACP,aAAa;QACb,gBAAgB,EAAE,GAAG,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QACD,8BAA8B,EAA9B,0CAA8B;KAC/B,CAAC;IAEF,OAAO;QACL,cAAc;QACd,aAAa;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareTransaction.d.ts","sourceRoot":"","sources":["../../src/bridge/prepareTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAkB/E,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.prepareTransaction = void 0;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const common_logic_1 = require("../common-logic");
|
|
9
|
+
const node_1 = require("../network/node");
|
|
10
|
+
const prepareTransaction = async (account, transaction) => {
|
|
11
|
+
const seq = await (0, node_1.getNextSequence)(account.freshAddress);
|
|
12
|
+
const craftedTransaction = await (0, common_logic_1.craftTransaction)({ address: account.freshAddress, nextSequenceNumber: seq }, { amount: transaction.amount, recipient: transaction.recipient });
|
|
13
|
+
const fee = await (0, common_logic_1.estimateFees)(craftedTransaction.serializedTransaction);
|
|
14
|
+
if (transaction.fee !== new bignumber_js_1.default(fee.toString())) {
|
|
15
|
+
return { ...transaction, fee: new bignumber_js_1.default(fee.toString()) };
|
|
16
|
+
}
|
|
17
|
+
return transaction;
|
|
18
|
+
};
|
|
19
|
+
exports.prepareTransaction = prepareTransaction;
|
|
20
|
+
//# sourceMappingURL=prepareTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareTransaction.js","sourceRoot":"","sources":["../../src/bridge/prepareTransaction.ts"],"names":[],"mappings":";;;;;;AACA,gEAAqC;AAErC,kDAAiE;AACjE,0CAAkD;AAE3C,MAAM,kBAAkB,GAAqD,KAAK,EACvF,OAAO,EACP,WAAW,EACX,EAAE;IACF,MAAM,GAAG,GAAG,MAAM,IAAA,sBAAe,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAExD,MAAM,kBAAkB,GAAG,MAAM,IAAA,+BAAgB,EAC/C,EAAE,OAAO,EAAE,OAAO,CAAC,YAAY,EAAE,kBAAkB,EAAE,GAAG,EAAE,EAC1D,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,SAAS,EAAE,CACjE,CAAC;IAEF,MAAM,GAAG,GAAG,MAAM,IAAA,2BAAY,EAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;IAEzE,IAAI,WAAW,CAAC,GAAG,KAAK,IAAI,sBAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;QACtD,OAAO,EAAE,GAAG,WAAW,EAAE,GAAG,EAAE,IAAI,sBAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAlBW,QAAA,kBAAkB,sBAkB7B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AccountBridge } from "@ledgerhq/types-live";
|
|
2
|
+
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
3
|
+
import { Transaction, ConcordiumSigner } from "../types";
|
|
4
|
+
export declare const buildSignOperation: (signerContext: SignerContext<ConcordiumSigner>) => AccountBridge<Transaction>["signOperation"];
|
|
5
|
+
//# sourceMappingURL=signOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signOperation.d.ts","sourceRoot":"","sources":["../../src/bridge/signOperation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAa,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAIhE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAA+B,MAAM,UAAU,CAAC;AAEtF,eAAO,MAAM,kBAAkB,kBACb,aAAa,CAAC,gBAAgB,CAAC,KAAG,aAAa,CAAC,WAAW,CAAC,CAAC,eAAe,CAmFxF,CAAC"}
|