@ledgerhq/live-common 27.0.0 → 27.0.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.js +2 -2
- package/lib/__tests__/test-helpers/environment.d.ts +2 -0
- package/lib/__tests__/test-helpers/environment.d.ts.map +1 -0
- package/lib/__tests__/test-helpers/environment.js +107 -0
- package/lib/__tests__/test-helpers/environment.js.map +1 -0
- package/lib/__tests__/test-helpers/setup.d.ts +1 -1
- package/lib/__tests__/test-helpers/setup.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/setup.js +1 -101
- package/lib/__tests__/test-helpers/setup.js.map +1 -1
- package/lib/account/serialization.d.ts.map +1 -1
- package/lib/account/serialization.js +83 -40
- package/lib/account/serialization.js.map +1 -1
- package/lib/bot/bot-test-context.d.ts +3 -0
- package/lib/bot/bot-test-context.d.ts.map +1 -0
- package/lib/bot/bot-test-context.js +26 -0
- package/lib/bot/bot-test-context.js.map +1 -0
- package/lib/bot/bot-test-context.test.d.ts +2 -0
- package/lib/bot/bot-test-context.test.d.ts.map +1 -0
- package/lib/bot/bot-test-context.test.js +41 -0
- package/lib/bot/bot-test-context.test.js.map +1 -0
- package/lib/bot/cli.d.ts +2 -0
- package/lib/bot/cli.d.ts.map +1 -0
- package/lib/bot/cli.js +14 -0
- package/lib/bot/cli.js.map +1 -0
- package/lib/bot/engine.d.ts +5 -5
- package/lib/bot/engine.d.ts.map +1 -1
- package/lib/bot/engine.js +161 -112
- package/lib/bot/engine.js.map +1 -1
- package/lib/bot/formatters.d.ts +2 -2
- package/lib/bot/formatters.d.ts.map +1 -1
- package/lib/bot/formatters.js +41 -15
- package/lib/bot/formatters.js.map +1 -1
- package/lib/bot/index.d.ts +1 -1
- package/lib/bot/index.d.ts.map +1 -1
- package/lib/bot/index.js +90 -15
- package/lib/bot/index.js.map +1 -1
- package/lib/bot/specs.d.ts +2 -1
- package/lib/bot/specs.d.ts.map +1 -1
- package/lib/bot/specs.js +13 -9
- package/lib/bot/specs.js.map +1 -1
- package/lib/bot/types.d.ts +5 -2
- package/lib/bot/types.d.ts.map +1 -1
- package/lib/countervalues/logic.integration.test.js +65 -0
- package/lib/countervalues/logic.integration.test.js.map +1 -1
- package/lib/countervalues/modules/weth.d.ts.map +1 -1
- package/lib/countervalues/modules/weth.js +5 -10
- package/lib/countervalues/modules/weth.js.map +1 -1
- package/lib/currencies/sortByMarketcap.d.ts +0 -2
- package/lib/currencies/sortByMarketcap.d.ts.map +1 -1
- package/lib/currencies/sortByMarketcap.js +3 -17
- package/lib/currencies/sortByMarketcap.js.map +1 -1
- package/lib/currencies/sortByMarketcap.test.js +0 -5
- package/lib/currencies/sortByMarketcap.test.js.map +1 -1
- package/lib/env.js +1 -1
- package/lib/families/algorand/specs.d.ts.map +1 -1
- package/lib/families/algorand/specs.js +18 -10
- package/lib/families/algorand/specs.js.map +1 -1
- package/lib/families/algorand/speculos-deviceActions.d.ts +1 -4
- package/lib/families/algorand/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/algorand/speculos-deviceActions.js +25 -8
- package/lib/families/algorand/speculos-deviceActions.js.map +1 -1
- package/lib/families/bitcoin/bridge/mock.d.ts.map +1 -1
- package/lib/families/bitcoin/bridge/mock.js +6 -1
- package/lib/families/bitcoin/bridge/mock.js.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin_cash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin_cash.js +1 -1
- package/lib/families/bitcoin/datasets/bitcoin_cash.js.map +1 -1
- package/lib/families/bitcoin/datasets/dash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/dash.js +1 -1
- package/lib/families/bitcoin/datasets/dash.js.map +1 -1
- package/lib/families/bitcoin/datasets/decred.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/decred.js +1 -1
- package/lib/families/bitcoin/datasets/decred.js.map +1 -1
- package/lib/families/bitcoin/datasets/digibyte.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/digibyte.js +8 -2
- package/lib/families/bitcoin/datasets/digibyte.js.map +1 -1
- package/lib/families/bitcoin/datasets/dogecoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/dogecoin.js +1 -1
- package/lib/families/bitcoin/datasets/dogecoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/komodo.js +1 -1
- package/lib/families/bitcoin/datasets/komodo.js.map +1 -1
- package/lib/families/bitcoin/datasets/litecoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/litecoin.js +8 -2
- package/lib/families/bitcoin/datasets/litecoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/peercoin.js +1 -1
- package/lib/families/bitcoin/datasets/peercoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/pivx.js +1 -1
- package/lib/families/bitcoin/datasets/pivx.js.map +1 -1
- package/lib/families/bitcoin/datasets/qtum.js +1 -1
- package/lib/families/bitcoin/datasets/qtum.js.map +1 -1
- package/lib/families/bitcoin/datasets/stakenet.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/stakenet.js +1 -1
- package/lib/families/bitcoin/datasets/stakenet.js.map +1 -1
- package/lib/families/bitcoin/datasets/vertcoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/vertcoin.js +1 -1
- package/lib/families/bitcoin/datasets/vertcoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/viacoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/viacoin.js +1 -1
- package/lib/families/bitcoin/datasets/viacoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/zcash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/zcash.js +1 -1
- package/lib/families/bitcoin/datasets/zcash.js.map +1 -1
- package/lib/families/bitcoin/datasets/zencash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/zencash.js +1 -1
- package/lib/families/bitcoin/datasets/zencash.js.map +1 -1
- package/lib/families/bitcoin/platformAdapter.test.d.ts +2 -0
- package/lib/families/bitcoin/platformAdapter.test.d.ts.map +1 -0
- package/lib/families/bitcoin/platformAdapter.test.js +48 -0
- package/lib/families/bitcoin/platformAdapter.test.js.map +1 -0
- package/lib/families/bitcoin/specs.d.ts.map +1 -1
- package/lib/families/bitcoin/specs.js +62 -24
- package/lib/families/bitcoin/specs.js.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.d.ts +1 -4
- package/lib/families/bitcoin/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.js +2 -4
- package/lib/families/bitcoin/speculos-deviceActions.js.map +1 -1
- package/lib/families/cardano/js-estimateMaxSpendable.js +1 -1
- package/lib/families/cardano/js-estimateMaxSpendable.js.map +1 -1
- package/lib/families/cardano/specs.d.ts.map +1 -1
- package/lib/families/cardano/specs.js +19 -8
- package/lib/families/cardano/specs.js.map +1 -1
- package/lib/families/cardano/speculos-deviceActions.d.ts +1 -4
- package/lib/families/cardano/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/cardano/speculos-deviceActions.js +2 -2
- package/lib/families/cardano/speculos-deviceActions.js.map +1 -1
- package/lib/families/celo/specs.d.ts.map +1 -1
- package/lib/families/celo/specs.js +2 -0
- package/lib/families/celo/specs.js.map +1 -1
- package/lib/families/celo/speculos-deviceActions.d.ts +1 -4
- package/lib/families/celo/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/celo/speculos-deviceActions.js +2 -4
- package/lib/families/celo/speculos-deviceActions.js.map +1 -1
- package/lib/families/cosmos/specs.d.ts.map +1 -1
- package/lib/families/cosmos/specs.js +41 -25
- package/lib/families/cosmos/specs.js.map +1 -1
- package/lib/families/cosmos/speculos-deviceActions.d.ts +1 -4
- package/lib/families/cosmos/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/cosmos/speculos-deviceActions.js +2 -4
- package/lib/families/cosmos/speculos-deviceActions.js.map +1 -1
- package/lib/families/crypto_org/specs.d.ts.map +1 -1
- package/lib/families/crypto_org/specs.js +3 -0
- package/lib/families/crypto_org/specs.js.map +1 -1
- package/lib/families/crypto_org/speculos-deviceActions.d.ts +1 -4
- package/lib/families/crypto_org/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/crypto_org/speculos-deviceActions.js +2 -2
- package/lib/families/crypto_org/speculos-deviceActions.js.map +1 -1
- package/lib/families/elrond/specs.d.ts.map +1 -1
- package/lib/families/elrond/specs.js +15 -2
- package/lib/families/elrond/specs.js.map +1 -1
- package/lib/families/elrond/speculos-deviceActions.d.ts +1 -4
- package/lib/families/elrond/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/elrond/speculos-deviceActions.js +2 -4
- package/lib/families/elrond/speculos-deviceActions.js.map +1 -1
- package/lib/families/ethereum/platformAdapter.test.d.ts +2 -0
- package/lib/families/ethereum/platformAdapter.test.d.ts.map +1 -0
- package/lib/families/ethereum/platformAdapter.test.js +88 -0
- package/lib/families/ethereum/platformAdapter.test.js.map +1 -0
- package/lib/families/ethereum/specs.d.ts.map +1 -1
- package/lib/families/ethereum/specs.js +36 -12
- package/lib/families/ethereum/specs.js.map +1 -1
- package/lib/families/ethereum/speculos-deviceActions.d.ts +1 -4
- package/lib/families/ethereum/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/ethereum/speculos-deviceActions.js +2 -4
- package/lib/families/ethereum/speculos-deviceActions.js.map +1 -1
- package/lib/families/filecoin/specs.d.ts.map +1 -1
- package/lib/families/filecoin/specs.js +2 -0
- package/lib/families/filecoin/specs.js.map +1 -1
- package/lib/families/filecoin/speculos-deviceActions.d.ts +1 -4
- package/lib/families/filecoin/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/filecoin/speculos-deviceActions.js +2 -2
- package/lib/families/filecoin/speculos-deviceActions.js.map +1 -1
- package/lib/families/hedera/specs.d.ts.map +1 -1
- package/lib/families/hedera/specs.js +11 -3
- package/lib/families/hedera/specs.js.map +1 -1
- package/lib/families/hedera/speculos-deviceActions.d.ts +1 -4
- package/lib/families/hedera/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/hedera/speculos-deviceActions.js +4 -4
- package/lib/families/hedera/speculos-deviceActions.js.map +1 -1
- package/lib/families/osmosis/specs.d.ts.map +1 -1
- package/lib/families/osmosis/specs.js +13 -5
- package/lib/families/osmosis/specs.js.map +1 -1
- package/lib/families/osmosis/speculos-deviceActions.d.ts +1 -4
- package/lib/families/osmosis/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/osmosis/speculos-deviceActions.js +2 -4
- package/lib/families/osmosis/speculos-deviceActions.js.map +1 -1
- package/lib/families/polkadot/platformAdapter.test.d.ts +2 -0
- package/lib/families/polkadot/platformAdapter.test.d.ts.map +1 -0
- package/lib/families/polkadot/platformAdapter.test.js +51 -0
- package/lib/families/polkadot/platformAdapter.test.js.map +1 -0
- package/lib/families/polkadot/specs.d.ts.map +1 -1
- package/lib/families/polkadot/specs.js +12 -1
- package/lib/families/polkadot/specs.js.map +1 -1
- package/lib/families/polkadot/speculos-deviceActions.d.ts +1 -4
- package/lib/families/polkadot/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/polkadot/speculos-deviceActions.js +2 -4
- package/lib/families/polkadot/speculos-deviceActions.js.map +1 -1
- package/lib/families/ripple/platformAdapter.test.d.ts +2 -0
- package/lib/families/ripple/platformAdapter.test.d.ts.map +1 -0
- package/lib/families/ripple/platformAdapter.test.js +51 -0
- package/lib/families/ripple/platformAdapter.test.js.map +1 -0
- package/lib/families/ripple/specs.d.ts.map +1 -1
- package/lib/families/ripple/specs.js +9 -4
- package/lib/families/ripple/specs.js.map +1 -1
- package/lib/families/ripple/speculos-deviceActions.d.ts +1 -4
- package/lib/families/ripple/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/ripple/speculos-deviceActions.js +2 -4
- package/lib/families/ripple/speculos-deviceActions.js.map +1 -1
- package/lib/families/solana/specs.d.ts.map +1 -1
- package/lib/families/solana/specs.js +29 -11
- package/lib/families/solana/specs.js.map +1 -1
- package/lib/families/solana/speculos-deviceActions.d.ts +0 -5
- package/lib/families/solana/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/solana/speculos-deviceActions.js +0 -4
- package/lib/families/solana/speculos-deviceActions.js.map +1 -1
- package/lib/families/stellar/api/horizon.d.ts.map +1 -1
- package/lib/families/stellar/api/horizon.js +15 -10
- package/lib/families/stellar/api/horizon.js.map +1 -1
- package/lib/families/stellar/specs.d.ts.map +1 -1
- package/lib/families/stellar/specs.js +30 -12
- package/lib/families/stellar/specs.js.map +1 -1
- package/lib/families/stellar/speculos-deviceActions.d.ts +1 -4
- package/lib/families/stellar/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/stellar/speculos-deviceActions.js +2 -4
- package/lib/families/stellar/speculos-deviceActions.js.map +1 -1
- package/lib/families/tezos/bakers.whitelist-default.d.ts.map +1 -1
- package/lib/families/tezos/bakers.whitelist-default.js +1 -1
- package/lib/families/tezos/bakers.whitelist-default.js.map +1 -1
- package/lib/families/tezos/specs.d.ts.map +1 -1
- package/lib/families/tezos/specs.js +2 -0
- package/lib/families/tezos/specs.js.map +1 -1
- package/lib/families/tezos/speculos-deviceActions.d.ts +1 -4
- package/lib/families/tezos/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/tezos/speculos-deviceActions.js +2 -2
- package/lib/families/tezos/speculos-deviceActions.js.map +1 -1
- package/lib/families/tron/specs.d.ts.map +1 -1
- package/lib/families/tron/specs.js +49 -17
- package/lib/families/tron/specs.js.map +1 -1
- package/lib/families/tron/speculos-deviceActions.d.ts +1 -4
- package/lib/families/tron/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/tron/speculos-deviceActions.js +2 -4
- package/lib/families/tron/speculos-deviceActions.js.map +1 -1
- package/lib/hw/getGenuineCheckFromDeviceId.d.ts +22 -0
- package/lib/hw/getGenuineCheckFromDeviceId.d.ts.map +1 -0
- package/lib/hw/getGenuineCheckFromDeviceId.js +49 -0
- package/lib/hw/getGenuineCheckFromDeviceId.js.map +1 -0
- package/lib/hw/getGenuineCheckFromDeviceId.test.d.ts +2 -0
- package/lib/hw/getGenuineCheckFromDeviceId.test.d.ts.map +1 -0
- package/lib/hw/getGenuineCheckFromDeviceId.test.js +84 -0
- package/lib/hw/getGenuineCheckFromDeviceId.test.js.map +1 -0
- package/lib/hw/getLatestAvailableFirmwareFromDeviceId.d.ts +17 -0
- package/lib/hw/getLatestAvailableFirmwareFromDeviceId.d.ts.map +1 -0
- package/lib/hw/getLatestAvailableFirmwareFromDeviceId.js +27 -0
- package/lib/hw/getLatestAvailableFirmwareFromDeviceId.js.map +1 -0
- package/lib/hw/hooks/useGenuineCheck.d.ts +34 -0
- package/lib/hw/hooks/useGenuineCheck.d.ts.map +1 -0
- package/lib/hw/hooks/useGenuineCheck.js +115 -0
- package/lib/hw/hooks/useGenuineCheck.js.map +1 -0
- package/lib/hw/hooks/useGenuineCheck.test.d.ts +2 -0
- package/lib/hw/hooks/useGenuineCheck.test.d.ts.map +1 -0
- package/lib/hw/hooks/useGenuineCheck.test.js +316 -0
- package/lib/hw/hooks/useGenuineCheck.test.js.map +1 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.d.ts +29 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.d.ts.map +1 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.js +72 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.js.map +1 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.test.d.ts +2 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.test.d.ts.map +1 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.test.js +155 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.test.js.map +1 -0
- package/lib/load/speculos.d.ts +1 -0
- package/lib/load/speculos.d.ts.map +1 -1
- package/lib/load/speculos.js +2 -1
- package/lib/load/speculos.js.map +1 -1
- package/lib/mock/fixtures/cryptoCurrencies.d.ts +5 -0
- package/lib/mock/fixtures/cryptoCurrencies.d.ts.map +1 -0
- package/lib/mock/fixtures/cryptoCurrencies.js +91 -0
- package/lib/mock/fixtures/cryptoCurrencies.js.map +1 -0
- package/lib/platform/converters.test.js +44 -218
- package/lib/platform/converters.test.js.map +1 -1
- package/lib/platform/logic.d.ts +44 -0
- package/lib/platform/logic.d.ts.map +1 -1
- package/lib/platform/logic.js +147 -1
- package/lib/platform/logic.js.map +1 -1
- package/lib/platform/logic.test.d.ts +2 -0
- package/lib/platform/logic.test.d.ts.map +1 -0
- package/lib/platform/logic.test.js +903 -0
- package/lib/platform/logic.test.js.map +1 -0
- package/lib/platform/react.d.ts +6 -0
- package/lib/platform/react.d.ts.map +1 -1
- package/lib/platform/react.js +6 -0
- package/lib/platform/react.js.map +1 -1
- package/lib/platform/tracking.d.ts +1 -1
- package/lib/platform/tracking.d.ts.map +1 -1
- package/lib/platform/tracking.test.js +14 -41
- package/lib/platform/tracking.test.js.map +1 -1
- package/lib/reconciliation.d.ts.map +1 -1
- package/lib/reconciliation.js +28 -10
- package/lib/reconciliation.js.map +1 -1
- package/package.json +5 -6
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.ts +2 -2
- package/src/__tests__/test-helpers/environment.ts +91 -0
- package/src/__tests__/test-helpers/setup.ts +2 -91
- package/src/account/serialization.ts +103 -64
- package/src/bot/bot-test-context.test.ts +37 -0
- package/src/bot/bot-test-context.ts +24 -0
- package/src/bot/cli.ts +18 -0
- package/src/bot/engine.ts +109 -73
- package/src/bot/formatters.ts +40 -14
- package/src/bot/index.ts +124 -18
- package/src/bot/specs.ts +10 -5
- package/src/bot/types.ts +7 -3
- package/src/countervalues/logic.integration.test.ts +50 -0
- package/src/countervalues/modules/weth.ts +9 -12
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +59 -1
- package/src/currencies/sortByMarketcap.test.ts +1 -12
- package/src/currencies/sortByMarketcap.ts +2 -22
- package/src/env.ts +1 -1
- package/src/families/algorand/__snapshots__/bridge.integration.test.ts.snap +733 -8
- package/src/families/algorand/specs.ts +26 -16
- package/src/families/algorand/speculos-deviceActions.ts +31 -10
- package/src/families/bitcoin/__snapshots__/bridge.integration.test.ts.snap +43309 -7957
- package/src/families/bitcoin/bridge/mock.ts +7 -1
- package/src/families/bitcoin/datasets/bitcoin_cash.ts +73 -13
- package/src/families/bitcoin/datasets/dash.ts +29 -17
- package/src/families/bitcoin/datasets/decred.ts +42 -12
- package/src/families/bitcoin/datasets/digibyte.ts +9 -3
- package/src/families/bitcoin/datasets/dogecoin.ts +29 -17
- package/src/families/bitcoin/datasets/komodo.ts +22 -22
- package/src/families/bitcoin/datasets/litecoin.ts +9 -3
- package/src/families/bitcoin/datasets/peercoin.ts +17 -17
- package/src/families/bitcoin/datasets/pivx.ts +17 -17
- package/src/families/bitcoin/datasets/qtum.ts +40 -40
- package/src/families/bitcoin/datasets/stakenet.ts +56 -26
- package/src/families/bitcoin/datasets/vertcoin.ts +43 -55
- package/src/families/bitcoin/datasets/viacoin.ts +35 -23
- package/src/families/bitcoin/datasets/zcash.ts +78 -12
- package/src/families/bitcoin/datasets/zencash.ts +56 -10
- package/src/families/bitcoin/platformAdapter.test.ts +58 -0
- package/src/families/bitcoin/specs.ts +81 -41
- package/src/families/bitcoin/speculos-deviceActions.ts +68 -69
- package/src/families/cardano/js-estimateMaxSpendable.ts +1 -1
- package/src/families/cardano/specs.ts +28 -11
- package/src/families/cardano/speculos-deviceActions.ts +65 -66
- package/src/families/celo/specs.ts +2 -0
- package/src/families/celo/speculos-deviceActions.ts +42 -43
- package/src/families/cosmos/__snapshots__/bridge.integration.test.ts.snap +246 -5
- package/src/families/cosmos/specs.ts +44 -28
- package/src/families/cosmos/speculos-deviceActions.ts +82 -83
- package/src/families/crypto_org/specs.ts +3 -0
- package/src/families/crypto_org/speculos-deviceActions.ts +58 -59
- package/src/families/elrond/specs.ts +21 -4
- package/src/families/elrond/speculos-deviceActions.ts +41 -42
- package/src/families/ethereum/__snapshots__/bridge.integration.test.ts.snap +90 -90
- package/src/families/ethereum/platformAdapter.test.ts +112 -0
- package/src/families/ethereum/specs.ts +47 -23
- package/src/families/ethereum/speculos-deviceActions.ts +93 -95
- package/src/families/filecoin/specs.ts +2 -1
- package/src/families/filecoin/speculos-deviceActions.ts +61 -62
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +57 -2
- package/src/families/hedera/specs.ts +13 -5
- package/src/families/hedera/speculos-deviceActions.ts +59 -60
- package/src/families/osmosis/specs.ts +15 -7
- package/src/families/osmosis/speculos-deviceActions.ts +82 -83
- package/src/families/polkadot/platformAdapter.test.ts +61 -0
- package/src/families/polkadot/specs.ts +20 -2
- package/src/families/polkadot/speculos-deviceActions.ts +83 -82
- package/src/families/ripple/platformAdapter.test.ts +54 -0
- package/src/families/ripple/specs.ts +14 -7
- package/src/families/ripple/speculos-deviceActions.ts +72 -73
- package/src/families/solana/specs.ts +33 -14
- package/src/families/solana/speculos-deviceActions.ts +0 -5
- package/src/families/stellar/api/horizon.ts +10 -6
- package/src/families/stellar/specs.ts +37 -19
- package/src/families/stellar/speculos-deviceActions.ts +85 -87
- package/src/families/tezos/bakers.whitelist-default.ts +0 -1
- package/src/families/tezos/specs.ts +2 -0
- package/src/families/tezos/speculos-deviceActions.ts +76 -77
- package/src/families/tron/specs.ts +67 -30
- package/src/families/tron/speculos-deviceActions.ts +81 -84
- package/src/hw/getGenuineCheckFromDeviceId.test.ts +98 -0
- package/src/hw/getGenuineCheckFromDeviceId.ts +61 -0
- package/src/hw/getLatestAvailableFirmwareFromDeviceId.ts +37 -0
- package/src/hw/hooks/useGenuineCheck.test.ts +232 -0
- package/src/hw/hooks/useGenuineCheck.ts +138 -0
- package/src/hw/hooks/useGetLatestAvailableFirmware.test.ts +111 -0
- package/src/hw/hooks/useGetLatestAvailableFirmware.ts +90 -0
- package/src/load/speculos.ts +2 -0
- package/src/mock/fixtures/cryptoCurrencies.ts +88 -0
- package/src/platform/converters.test.ts +49 -282
- package/src/platform/logic.test.ts +756 -0
- package/src/platform/logic.ts +285 -0
- package/src/platform/react.ts +6 -0
- package/src/platform/tracking.test.ts +6 -7
- package/src/platform/tracking.ts +1 -1
- package/src/reconciliation.ts +66 -43
- package/lib/bot/test.bot.d.ts +0 -2
- package/lib/bot/test.bot.d.ts.map +0 -1
- package/lib/bot/test.bot.js +0 -62
- package/lib/bot/test.bot.js.map +0 -1
- package/lib/generated/speculos-deviceActions.d.ts +0 -56
- package/lib/generated/speculos-deviceActions.d.ts.map +0 -1
- package/lib/generated/speculos-deviceActions.js +0 -42
- package/lib/generated/speculos-deviceActions.js.map +0 -1
- package/src/bot/test.bot.ts +0 -21
- package/src/generated/speculos-deviceActions.ts +0 -37
|
@@ -2,88 +2,89 @@ import type { DeviceAction } from "../../bot/types";
|
|
|
2
2
|
import type { PolkadotAccount, Transaction } from "./types";
|
|
3
3
|
import { deviceActionFlow } from "../../bot/specs";
|
|
4
4
|
import { formatCurrencyUnit } from "../../currencies";
|
|
5
|
-
const acceptTransaction: DeviceAction<Transaction, any> = deviceActionFlow({
|
|
6
|
-
steps: [
|
|
7
|
-
{
|
|
8
|
-
title: "Staking",
|
|
9
|
-
button: "Rr",
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
title: "Balances",
|
|
13
|
-
button: "Rr",
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
title: "Dest",
|
|
17
|
-
button: "Rr",
|
|
18
|
-
expectedValue: ({ transaction }) => transaction.recipient,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
title: "Amount",
|
|
22
|
-
button: "Rr",
|
|
23
|
-
expectedValue: ({ account, transaction }) => {
|
|
24
|
-
const formattedValue =
|
|
25
|
-
"DOT " +
|
|
26
|
-
formatCurrencyUnit(account.unit, transaction.amount, {
|
|
27
|
-
disableRounding: true,
|
|
28
|
-
});
|
|
29
5
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
6
|
+
export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
7
|
+
deviceActionFlow({
|
|
8
|
+
steps: [
|
|
9
|
+
{
|
|
10
|
+
title: "Staking",
|
|
11
|
+
button: "Rr",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
title: "Balances",
|
|
15
|
+
button: "Rr",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: "Dest",
|
|
19
|
+
button: "Rr",
|
|
20
|
+
expectedValue: ({ transaction }) => transaction.recipient,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: "Amount",
|
|
24
|
+
button: "Rr",
|
|
25
|
+
expectedValue: ({ account, transaction }) => {
|
|
26
|
+
const formattedValue =
|
|
27
|
+
"DOT " +
|
|
28
|
+
formatCurrencyUnit(account.unit, transaction.amount, {
|
|
29
|
+
disableRounding: true,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (!formattedValue.includes(".")) {
|
|
33
|
+
// if the value is pure integer, in the app it will automatically add an .0
|
|
34
|
+
return formattedValue + ".0";
|
|
35
|
+
}
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
return formattedValue;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
title: "Chain",
|
|
42
|
+
button: "Rr",
|
|
43
|
+
expectedValue: () => "Polkadot",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: "Nonce",
|
|
47
|
+
button: "Rr",
|
|
48
|
+
expectedValue: ({ account }) =>
|
|
49
|
+
(
|
|
50
|
+
(account as PolkadotAccount).polkadotResources?.nonce || 0
|
|
51
|
+
).toString(),
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
title: "Tip",
|
|
55
|
+
button: "Rr",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: "Controller",
|
|
59
|
+
button: "Rr",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: "Payee",
|
|
63
|
+
button: "Rr",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: "Max additional",
|
|
67
|
+
button: "Rr",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: "Targets",
|
|
71
|
+
button: "Rr",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
title: "Era Phase",
|
|
75
|
+
button: "Rr",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: "Era Period",
|
|
79
|
+
button: "Rr",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
title: "Block",
|
|
83
|
+
button: "Rr",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
title: "APPROVE",
|
|
87
|
+
button: "LRlr",
|
|
36
88
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
title: "Chain",
|
|
40
|
-
button: "Rr",
|
|
41
|
-
expectedValue: () => "Polkadot",
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
title: "Nonce",
|
|
45
|
-
button: "Rr",
|
|
46
|
-
expectedValue: ({ account }) =>
|
|
47
|
-
((account as PolkadotAccount).polkadotResources?.nonce || 0).toString(),
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
title: "Tip",
|
|
51
|
-
button: "Rr",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
title: "Controller",
|
|
55
|
-
button: "Rr",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
title: "Payee",
|
|
59
|
-
button: "Rr",
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
title: "Max additional",
|
|
63
|
-
button: "Rr",
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
title: "Targets",
|
|
67
|
-
button: "Rr",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
title: "Era Phase",
|
|
71
|
-
button: "Rr",
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
title: "Era Period",
|
|
75
|
-
button: "Rr",
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
title: "Block",
|
|
79
|
-
button: "Rr",
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
title: "APPROVE",
|
|
83
|
-
button: "LRlr",
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
});
|
|
87
|
-
export default {
|
|
88
|
-
acceptTransaction,
|
|
89
|
-
};
|
|
89
|
+
],
|
|
90
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import xrp from "./platformAdapter";
|
|
2
|
+
import { RippleTransaction as PlatformTransaction } from "@ledgerhq/live-app-sdk";
|
|
3
|
+
import { FAMILIES } from "@ledgerhq/live-app-sdk";
|
|
4
|
+
import BigNumber from "bignumber.js";
|
|
5
|
+
import { Transaction } from "./types";
|
|
6
|
+
|
|
7
|
+
describe("getPlatformTransactionSignFlowInfos", () => {
|
|
8
|
+
describe("should properly get infos for XRP platform tx", () => {
|
|
9
|
+
it("without fees provided", () => {
|
|
10
|
+
const xrpPlatformTx: PlatformTransaction = {
|
|
11
|
+
family: FAMILIES.RIPPLE,
|
|
12
|
+
amount: new BigNumber(100000),
|
|
13
|
+
recipient: "0xABCDEF",
|
|
14
|
+
tag: 1,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const expectedLiveTx: Partial<Transaction> = {
|
|
18
|
+
...xrpPlatformTx,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const { canEditFees, hasFeesProvided, liveTx } =
|
|
22
|
+
xrp.getPlatformTransactionSignFlowInfos(xrpPlatformTx);
|
|
23
|
+
|
|
24
|
+
expect(canEditFees).toBe(true);
|
|
25
|
+
|
|
26
|
+
expect(hasFeesProvided).toBe(false);
|
|
27
|
+
|
|
28
|
+
expect(liveTx).toEqual(expectedLiveTx);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("with fees provided", () => {
|
|
32
|
+
const xrpPlatformTx: PlatformTransaction = {
|
|
33
|
+
family: FAMILIES.RIPPLE,
|
|
34
|
+
amount: new BigNumber(100000),
|
|
35
|
+
recipient: "0xABCDEF",
|
|
36
|
+
fee: new BigNumber(300),
|
|
37
|
+
tag: 1,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const expectedLiveTx: Partial<Transaction> = {
|
|
41
|
+
...xrpPlatformTx,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const { canEditFees, hasFeesProvided, liveTx } =
|
|
45
|
+
xrp.getPlatformTransactionSignFlowInfos(xrpPlatformTx);
|
|
46
|
+
|
|
47
|
+
expect(canEditFees).toBe(true);
|
|
48
|
+
|
|
49
|
+
expect(hasFeesProvided).toBe(true);
|
|
50
|
+
|
|
51
|
+
expect(liveTx).toEqual(expectedLiveTx);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -2,12 +2,15 @@ import expect from "expect";
|
|
|
2
2
|
import invariant from "invariant";
|
|
3
3
|
import type { Transaction } from "./types";
|
|
4
4
|
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
|
|
5
|
-
import { pickSiblings } from "../../bot/specs";
|
|
5
|
+
import { botTest, pickSiblings } from "../../bot/specs";
|
|
6
6
|
import type { AppSpec } from "../../bot/types";
|
|
7
7
|
import { DeviceModelId } from "@ledgerhq/devices";
|
|
8
|
+
import { acceptTransaction } from "./speculos-deviceActions";
|
|
9
|
+
|
|
8
10
|
const currency = getCryptoCurrencyById("ripple");
|
|
9
11
|
const minAmountCutoff = parseCurrencyUnit(currency.units[0], "0.1");
|
|
10
12
|
const reserve = parseCurrencyUnit(currency.units[0], "20");
|
|
13
|
+
|
|
11
14
|
const ripple: AppSpec<Transaction> = {
|
|
12
15
|
name: "XRP",
|
|
13
16
|
currency,
|
|
@@ -15,6 +18,7 @@ const ripple: AppSpec<Transaction> = {
|
|
|
15
18
|
model: DeviceModelId.nanoS,
|
|
16
19
|
appName: "XRP",
|
|
17
20
|
},
|
|
21
|
+
genericDeviceAction: acceptTransaction,
|
|
18
22
|
mutations: [
|
|
19
23
|
{
|
|
20
24
|
name: "move ~50%",
|
|
@@ -53,14 +57,17 @@ const ripple: AppSpec<Transaction> = {
|
|
|
53
57
|
},
|
|
54
58
|
test: ({ account, transaction, accountBeforeTransaction, operation }) => {
|
|
55
59
|
if (transaction.tag) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
botTest("operation tag matches (in extra)", () =>
|
|
61
|
+
expect(operation.extra).toMatchObject({
|
|
62
|
+
tag: transaction.tag,
|
|
63
|
+
})
|
|
64
|
+
);
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
botTest("account balance moved with operation.value", () =>
|
|
68
|
+
expect(account.balance.toString()).toBe(
|
|
69
|
+
accountBeforeTransaction.balance.minus(operation.value).toString()
|
|
70
|
+
)
|
|
64
71
|
);
|
|
65
72
|
},
|
|
66
73
|
},
|
|
@@ -2,76 +2,75 @@ import type { DeviceAction } from "../../bot/types";
|
|
|
2
2
|
import type { Transaction } from "./types";
|
|
3
3
|
import { formatCurrencyUnit } from "../../currencies";
|
|
4
4
|
import { deviceActionFlow } from "../../bot/specs";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
5
|
+
|
|
6
|
+
export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
7
|
+
deviceActionFlow({
|
|
8
|
+
steps: [
|
|
9
|
+
{
|
|
10
|
+
title: "Transaction Type",
|
|
11
|
+
button: "Rr",
|
|
12
|
+
expectedValue: () => "Payment",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
title: "Amount",
|
|
16
|
+
button: "Rr",
|
|
17
|
+
expectedValue: ({ account, status }) =>
|
|
18
|
+
formatCurrencyUnit(
|
|
19
|
+
{
|
|
20
|
+
...account.unit,
|
|
21
|
+
code: account.currency.deviceTicker || account.unit.code,
|
|
22
|
+
prefixCode: true,
|
|
23
|
+
},
|
|
24
|
+
status.amount,
|
|
25
|
+
{
|
|
26
|
+
showCode: true,
|
|
27
|
+
disableRounding: true,
|
|
28
|
+
joinFragmentsSeparator: " ",
|
|
29
|
+
}
|
|
30
|
+
).replace(/\s/g, " "),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
title: "Fee",
|
|
34
|
+
button: "Rr",
|
|
35
|
+
expectedValue: ({ account, status }) =>
|
|
36
|
+
formatCurrencyUnit(
|
|
37
|
+
{
|
|
38
|
+
...account.unit,
|
|
39
|
+
code: account.currency.deviceTicker || account.unit.code,
|
|
40
|
+
prefixCode: true,
|
|
41
|
+
},
|
|
42
|
+
status.estimatedFees,
|
|
43
|
+
{
|
|
44
|
+
showCode: true,
|
|
45
|
+
disableRounding: true,
|
|
46
|
+
joinFragmentsSeparator: " ",
|
|
47
|
+
}
|
|
48
|
+
).replace(/\s/g, " "),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
title: "Destination Tag",
|
|
52
|
+
button: "Rr",
|
|
53
|
+
expectedValue: ({ transaction }) => String(transaction.tag),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
title: "Destination",
|
|
57
|
+
button: "Rr",
|
|
58
|
+
trimValue: true,
|
|
59
|
+
expectedValue: ({ transaction }) => transaction.recipient,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: "Account",
|
|
63
|
+
button: "Rr",
|
|
64
|
+
trimValue: true,
|
|
65
|
+
expectedValue: ({ account }) => account.freshAddress,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: "Accept",
|
|
69
|
+
button: "LRlr",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: "Sign transaction",
|
|
73
|
+
button: "LRlr",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
});
|
|
@@ -2,7 +2,7 @@ import invariant from "invariant";
|
|
|
2
2
|
import expect from "expect";
|
|
3
3
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
4
4
|
import { DeviceModelId } from "@ledgerhq/devices";
|
|
5
|
-
import { pickSiblings } from "../../bot/specs";
|
|
5
|
+
import { botTest, pickSiblings } from "../../bot/specs";
|
|
6
6
|
import { AppSpec, TransactionTestInput } from "../../bot/types";
|
|
7
7
|
import { SolanaAccount, Transaction } from "./types";
|
|
8
8
|
import {
|
|
@@ -25,6 +25,7 @@ const solana: AppSpec<Transaction> = {
|
|
|
25
25
|
appVersion: "1.2.0",
|
|
26
26
|
appName: "solana",
|
|
27
27
|
},
|
|
28
|
+
genericDeviceAction: acceptTransferTransaction,
|
|
28
29
|
testTimeout: 2 * 60 * 1000,
|
|
29
30
|
currency: getCryptoCurrencyById("solana"),
|
|
30
31
|
mutations: [
|
|
@@ -66,7 +67,9 @@ const solana: AppSpec<Transaction> = {
|
|
|
66
67
|
},
|
|
67
68
|
test: (input) => {
|
|
68
69
|
const { account } = input;
|
|
69
|
-
|
|
70
|
+
botTest("account balance should be zero", () =>
|
|
71
|
+
expect(account.spendableBalance.toNumber()).toBe(0)
|
|
72
|
+
);
|
|
70
73
|
expectCorrectBalanceChange(input);
|
|
71
74
|
expectCorrectMemo(input);
|
|
72
75
|
},
|
|
@@ -142,7 +145,9 @@ const solana: AppSpec<Transaction> = {
|
|
|
142
145
|
throw new Error("expected delegation not found in account resources");
|
|
143
146
|
}
|
|
144
147
|
|
|
145
|
-
|
|
148
|
+
botTest("transaction amount is the stake amount", () =>
|
|
149
|
+
expect(transaction.amount.toNumber()).toBe(stake.delegation?.stake)
|
|
150
|
+
);
|
|
146
151
|
},
|
|
147
152
|
},
|
|
148
153
|
{
|
|
@@ -204,7 +209,9 @@ const solana: AppSpec<Transaction> = {
|
|
|
204
209
|
throw new Error("expected stake not found in account resources");
|
|
205
210
|
}
|
|
206
211
|
|
|
207
|
-
|
|
212
|
+
botTest("activation state", () =>
|
|
213
|
+
expect(stake.activation.state).toBe("inactive")
|
|
214
|
+
);
|
|
208
215
|
},
|
|
209
216
|
},
|
|
210
217
|
{
|
|
@@ -265,8 +272,9 @@ const solana: AppSpec<Transaction> = {
|
|
|
265
272
|
if (stake === undefined) {
|
|
266
273
|
throw new Error("expected stake not found in account resources");
|
|
267
274
|
}
|
|
268
|
-
|
|
269
|
-
|
|
275
|
+
botTest("activation state", () =>
|
|
276
|
+
expect(stake.activation.state).toBe("deactivating")
|
|
277
|
+
);
|
|
270
278
|
},
|
|
271
279
|
},
|
|
272
280
|
{
|
|
@@ -335,7 +343,9 @@ const solana: AppSpec<Transaction> = {
|
|
|
335
343
|
throw new Error("expected stake not found in account resources");
|
|
336
344
|
}
|
|
337
345
|
|
|
338
|
-
|
|
346
|
+
botTest("activation state", () =>
|
|
347
|
+
expect(stake.activation.state).toBe("active")
|
|
348
|
+
);
|
|
339
349
|
},
|
|
340
350
|
},
|
|
341
351
|
{
|
|
@@ -403,8 +413,9 @@ const solana: AppSpec<Transaction> = {
|
|
|
403
413
|
if (stake === undefined) {
|
|
404
414
|
throw new Error("expected stake not found in account resources");
|
|
405
415
|
}
|
|
406
|
-
|
|
407
|
-
|
|
416
|
+
botTest("activation state", () =>
|
|
417
|
+
expect(stake.activation.state).toBe("activating")
|
|
418
|
+
);
|
|
408
419
|
},
|
|
409
420
|
},
|
|
410
421
|
{
|
|
@@ -462,7 +473,9 @@ const solana: AppSpec<Transaction> = {
|
|
|
462
473
|
(s) => s.stakeAccAddr === stakeAccAddrUsedInTx
|
|
463
474
|
);
|
|
464
475
|
|
|
465
|
-
|
|
476
|
+
botTest("delegation exists", () =>
|
|
477
|
+
expect(delegationExists).toBe(false)
|
|
478
|
+
);
|
|
466
479
|
},
|
|
467
480
|
},
|
|
468
481
|
],
|
|
@@ -485,9 +498,13 @@ function expectCorrectMemo(input: TransactionTestInput<Transaction>) {
|
|
|
485
498
|
const { transaction, operation } = input;
|
|
486
499
|
switch (transaction.model.kind) {
|
|
487
500
|
case "transfer":
|
|
488
|
-
case "token.transfer":
|
|
489
|
-
|
|
501
|
+
case "token.transfer": {
|
|
502
|
+
const memo = transaction.model.uiState.memo;
|
|
503
|
+
botTest("memo matches in op extra", () =>
|
|
504
|
+
expect(operation.extra.memo).toBe(memo)
|
|
505
|
+
);
|
|
490
506
|
break;
|
|
507
|
+
}
|
|
491
508
|
case "token.createATA":
|
|
492
509
|
case "stake.createAccount":
|
|
493
510
|
case "stake.delegate":
|
|
@@ -502,8 +519,10 @@ function expectCorrectMemo(input: TransactionTestInput<Transaction>) {
|
|
|
502
519
|
|
|
503
520
|
function expectCorrectBalanceChange(input: TransactionTestInput<Transaction>) {
|
|
504
521
|
const { account, operation, accountBeforeTransaction } = input;
|
|
505
|
-
|
|
506
|
-
|
|
522
|
+
botTest("account balance decreased with operation value", () =>
|
|
523
|
+
expect(account.balance.toNumber()).toBe(
|
|
524
|
+
accountBeforeTransaction.balance.minus(operation.value).toNumber()
|
|
525
|
+
)
|
|
507
526
|
);
|
|
508
527
|
}
|
|
509
528
|
|
|
@@ -230,8 +230,3 @@ export const acceptStakeWithdrawTransaction: DeviceAction<Transaction, any> =
|
|
|
230
230
|
function throwUnexpectedTransaction(): never {
|
|
231
231
|
throw new Error("unexpected or unprepared transaction");
|
|
232
232
|
}
|
|
233
|
-
|
|
234
|
-
export default {
|
|
235
|
-
acceptTransferTransaction,
|
|
236
|
-
acceptStakeCreateAccountTransaction,
|
|
237
|
-
};
|
|
@@ -3,7 +3,7 @@ import StellarSdk, {
|
|
|
3
3
|
// @ts-expect-error stellar-sdk ts definition missing?
|
|
4
4
|
AccountRecord,
|
|
5
5
|
NotFoundError,
|
|
6
|
-
NetworkError,
|
|
6
|
+
NetworkError as StellarSdkNetworkError,
|
|
7
7
|
} from "stellar-sdk";
|
|
8
8
|
import { getEnv } from "../../../env";
|
|
9
9
|
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../../currencies";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
rawOperationsToOperations,
|
|
15
15
|
getReservedBalance,
|
|
16
16
|
} from "../logic";
|
|
17
|
-
import {
|
|
17
|
+
import { LedgerAPI4xx, LedgerAPI5xx, NetworkError } from "@ledgerhq/errors";
|
|
18
18
|
import { requestInterceptor, responseInterceptor } from "../../../network";
|
|
19
19
|
import type { BalanceAsset } from "../types";
|
|
20
20
|
import { NetworkCongestionLevel, Signer } from "../types";
|
|
@@ -127,8 +127,12 @@ export const fetchAccount = async (
|
|
|
127
127
|
assets = account.balances?.filter((balance) => {
|
|
128
128
|
return balance.asset_type !== "native";
|
|
129
129
|
});
|
|
130
|
-
} catch (e) {
|
|
131
|
-
|
|
130
|
+
} catch (e: any) {
|
|
131
|
+
if (e instanceof NotFoundError || e?.response?.status === 400) {
|
|
132
|
+
balance.balance = "0";
|
|
133
|
+
} else {
|
|
134
|
+
throw new NetworkError();
|
|
135
|
+
}
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
const formattedBalance = parseCurrencyUnit(
|
|
@@ -205,11 +209,11 @@ export const fetchOperations = async ({
|
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
if (
|
|
208
|
-
e instanceof
|
|
212
|
+
e instanceof StellarSdkNetworkError ||
|
|
209
213
|
errorMsg.match(/ECONNRESET|ECONNREFUSED|ENOTFOUND|EPIPE|ETIMEDOUT/) ||
|
|
210
214
|
errorMsg.match(/undefined is not an object/)
|
|
211
215
|
) {
|
|
212
|
-
throw new
|
|
216
|
+
throw new NetworkError();
|
|
213
217
|
}
|
|
214
218
|
|
|
215
219
|
throw e;
|