@ledgerhq/live-common 23.1.0 → 24.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/mocks/account.js +3 -3
- package/lib/__tests__/mocks/account.js.map +1 -1
- package/lib/__tests__/test-helpers/bridge.d.ts +1 -4
- package/lib/__tests__/test-helpers/bridge.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/bridge.js +1 -28
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/__tests__/test-helpers/setup.js +51 -0
- package/lib/__tests__/test-helpers/setup.js.map +1 -1
- package/lib/api/Ripple.d.ts.map +1 -1
- package/lib/api/Ripple.js +113 -68
- package/lib/api/Ripple.js.map +1 -1
- package/lib/apps/support.d.ts.map +1 -1
- package/lib/apps/support.js +6 -2
- package/lib/apps/support.js.map +1 -1
- package/lib/bot/index.d.ts.map +1 -1
- package/lib/bot/index.js +13 -19
- package/lib/bot/index.js.map +1 -1
- package/lib/bot/test.bot.d.ts +1 -1
- package/lib/bot/test.bot.d.ts.map +1 -1
- package/lib/bot/test.bot.js +1 -2
- package/lib/bot/test.bot.js.map +1 -1
- package/lib/countervalues/logic.integration.test.d.ts +2 -0
- package/lib/countervalues/logic.integration.test.d.ts.map +1 -0
- package/lib/countervalues/{logic.test.js → logic.integration.test.js} +1 -1
- package/lib/countervalues/logic.integration.test.js.map +1 -0
- package/lib/countervalues/react.d.ts +1 -21
- package/lib/countervalues/react.d.ts.map +1 -1
- package/lib/countervalues/react.js +1 -77
- package/lib/countervalues/react.js.map +1 -1
- package/lib/derivation.d.ts +1 -0
- package/lib/derivation.d.ts.map +1 -1
- package/lib/derivation.js +3 -2
- package/lib/derivation.js.map +1 -1
- package/lib/exchange/swap/getExchangeRates.test.js +1 -2
- package/lib/exchange/swap/getExchangeRates.test.js.map +1 -1
- package/lib/exchange/swap/hooks/usePollKYCStatus.test.js +4 -5
- package/lib/exchange/swap/hooks/usePollKYCStatus.test.js.map +1 -1
- package/lib/exchange/swap/hooks/useProviderRates.test.js +1 -2
- package/lib/exchange/swap/hooks/useProviderRates.test.js.map +1 -1
- package/lib/exchange/swap/hooks/useSwapProviders.test.js +1 -2
- package/lib/exchange/swap/hooks/useSwapProviders.test.js.map +1 -1
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.test.js +2 -3
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.test.js.map +1 -1
- package/lib/families/algorand/bridge.integration.test.d.ts +2 -0
- package/lib/families/algorand/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/algorand/{test-dataset.js → bridge.integration.test.js} +12 -11
- package/lib/families/algorand/bridge.integration.test.js.map +1 -0
- package/lib/families/bitcoin/bridge.integration.test.d.ts +2 -0
- package/lib/families/bitcoin/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/bitcoin/{test-dataset.js → bridge.integration.test.js} +17 -14
- package/lib/families/bitcoin/bridge.integration.test.js.map +1 -0
- package/lib/families/bitcoin/descriptor.d.ts.map +1 -1
- package/lib/families/bitcoin/descriptor.js +2 -1
- package/lib/families/bitcoin/descriptor.js.map +1 -1
- package/lib/families/bitcoin/satstack.d.ts.map +1 -1
- package/lib/families/bitcoin/satstack.js +5 -6
- package/lib/families/bitcoin/satstack.js.map +1 -1
- package/lib/families/bitcoin/satstack.test.js +4 -1
- package/lib/families/bitcoin/satstack.test.js.map +1 -1
- package/lib/families/bitcoin/specs.d.ts.map +1 -1
- package/lib/families/bitcoin/specs.js +1 -2
- package/lib/families/bitcoin/specs.js.map +1 -1
- package/lib/families/cardano/bridge.integration.test.d.ts +2 -0
- package/lib/families/cardano/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/cardano/{test-dataset.js → bridge.integration.test.js} +4 -2
- package/lib/families/cardano/bridge.integration.test.js.map +1 -0
- package/lib/families/celo/bridge.integration.test.d.ts +2 -0
- package/lib/families/celo/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/celo/bridge.integration.test.js +16 -0
- package/lib/families/celo/bridge.integration.test.js.map +1 -0
- package/lib/families/cosmos/bridge.integration.test.d.ts +2 -0
- package/lib/families/cosmos/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/cosmos/{test-dataset.js → bridge.integration.test.js} +5 -4
- package/lib/families/cosmos/bridge.integration.test.js.map +1 -0
- package/lib/families/cosmos/speculos-deviceActions.js +2 -2
- package/lib/families/crypto_org/bridge.integration.test.d.ts +2 -0
- package/lib/families/crypto_org/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/crypto_org/bridge.integration.test.js +16 -0
- package/lib/families/crypto_org/bridge.integration.test.js.map +1 -0
- package/lib/families/elrond/bridge.integration.test.d.ts +2 -0
- package/lib/families/elrond/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/elrond/{test-dataset.js → bridge.integration.test.js} +5 -5
- package/lib/families/elrond/bridge.integration.test.js.map +1 -0
- package/lib/families/ethereum/bridge.integration.test.d.ts +2 -0
- package/lib/families/ethereum/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/ethereum/{test-dataset.js → bridge.integration.test.js} +8 -24
- package/lib/families/ethereum/bridge.integration.test.js.map +1 -0
- package/lib/families/ethereum/datasets/ethereum1.d.ts +3 -0
- package/lib/families/ethereum/datasets/ethereum1.d.ts.map +1 -0
- package/lib/families/ethereum/datasets/ethereum1.js +22 -0
- package/lib/families/ethereum/datasets/ethereum1.js.map +1 -0
- package/lib/families/ethereum/modules/compound.resilience.integration.test.d.ts +2 -0
- package/lib/families/ethereum/modules/compound.resilience.integration.test.d.ts.map +1 -0
- package/lib/families/ethereum/modules/{compound.resilience.test.js → compound.resilience.integration.test.js} +3 -3
- package/lib/families/ethereum/modules/compound.resilience.integration.test.js.map +1 -0
- package/lib/families/ethereum/synchronisation.integration.test.d.ts +2 -0
- package/lib/families/ethereum/synchronisation.integration.test.d.ts.map +1 -0
- package/lib/families/ethereum/{synchronisation.test.js → synchronisation.integration.test.js} +4 -4
- package/lib/families/ethereum/synchronisation.integration.test.js.map +1 -0
- package/lib/families/filecoin/bridge.integration.test.d.ts +2 -0
- package/lib/families/filecoin/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/filecoin/{test-dataset.js → bridge.integration.test.js} +84 -3
- package/lib/families/filecoin/bridge.integration.test.js.map +1 -0
- package/lib/families/hedera/bridge.integration.test.d.ts +2 -0
- package/lib/families/hedera/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/hedera/{test-dataset.js → bridge.integration.test.js} +5 -3
- package/lib/families/hedera/bridge.integration.test.js.map +1 -0
- package/lib/families/polkadot/bridge.integration.test.d.ts +2 -0
- package/lib/families/polkadot/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/polkadot/{test-dataset.js → bridge.integration.test.js} +138 -4
- package/lib/families/polkadot/bridge.integration.test.js.map +1 -0
- package/lib/families/ripple/bridge.integration.test.d.ts +2 -0
- package/lib/families/ripple/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/ripple/{test-dataset.js → bridge.integration.test.js} +4 -2
- package/lib/families/ripple/bridge.integration.test.js.map +1 -0
- package/lib/families/solana/bridge.integration.test.d.ts +2 -0
- package/lib/families/solana/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/solana/{test-dataset.js → bridge.integration.test.js} +289 -73
- package/lib/families/solana/bridge.integration.test.js.map +1 -0
- package/lib/families/stellar/bridge.integration.test.d.ts +2 -0
- package/lib/families/stellar/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/stellar/{test-dataset.js → bridge.integration.test.js} +9 -8
- package/lib/families/stellar/bridge.integration.test.js.map +1 -0
- package/lib/families/stellar/js-estimateMaxSpendable.d.ts.map +1 -1
- package/lib/families/stellar/js-estimateMaxSpendable.js +2 -2
- package/lib/families/stellar/js-estimateMaxSpendable.js.map +1 -1
- package/lib/families/tezos/{test-dataset.d.ts → bridge.integration.test.d.ts} +2 -5
- package/lib/families/tezos/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/tezos/{test-dataset.js → bridge.integration.test.js} +73 -2
- package/lib/families/tezos/bridge.integration.test.js.map +1 -0
- package/lib/families/tezos/synchronisation.js +2 -2
- package/lib/families/tezos/synchronisation.js.map +1 -1
- package/lib/families/tron/bridge.integration.test.d.ts +2 -0
- package/lib/families/tron/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/tron/{test-dataset.js → bridge.integration.test.js} +5 -4
- package/lib/families/tron/bridge.integration.test.js.map +1 -0
- package/lib/load/speculos.d.ts.map +1 -1
- package/lib/load/speculos.js +5 -2
- package/lib/load/speculos.js.map +1 -1
- package/lib/portfolio/v2/index.d.ts +6 -1
- package/lib/portfolio/v2/index.d.ts.map +1 -1
- package/lib/portfolio/v2/index.js +7 -3
- package/lib/portfolio/v2/index.js.map +1 -1
- package/lib/portfolio/v2/range.d.ts +7 -1
- package/lib/portfolio/v2/range.d.ts.map +1 -1
- package/lib/portfolio/v2/range.js +37 -18
- package/lib/portfolio/v2/range.js.map +1 -1
- package/lib/portfolio/v2/range.test.d.ts +2 -0
- package/lib/portfolio/v2/range.test.d.ts.map +1 -0
- package/lib/portfolio/v2/range.test.js +51 -0
- package/lib/portfolio/v2/range.test.js.map +1 -0
- package/package.json +11 -10
- package/src/__tests__/mocks/account.ts +3 -3
- package/src/__tests__/test-helpers/bridge.ts +2 -35
- package/src/__tests__/test-helpers/setup.ts +39 -0
- package/src/api/Ripple.ts +97 -52
- package/src/apps/support.ts +6 -2
- package/src/bot/index.ts +26 -24
- package/src/bot/test.bot.ts +2 -2
- package/src/countervalues/{logic.test.ts → logic.integration.test.ts} +0 -0
- package/src/countervalues/react.tsx +2 -131
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +15 -1
- package/src/derivation.ts +2 -1
- package/src/exchange/swap/getExchangeRates.test.ts +1 -2
- package/src/exchange/swap/hooks/usePollKYCStatus.test.ts +1 -3
- package/src/exchange/swap/hooks/useProviderRates.test.ts +1 -2
- package/src/exchange/swap/hooks/useSwapProviders.test.ts +1 -3
- package/src/exchange/swap/hooks/useUpdateMaxAmount.test.ts +2 -3
- package/src/families/algorand/{test-dataset.ts → bridge.integration.test.ts} +13 -10
- package/src/families/bitcoin/__snapshots__/bridge.integration.test.ts.snap +27607 -0
- package/src/families/bitcoin/{test-dataset.ts → bridge.integration.test.ts} +18 -13
- package/src/families/bitcoin/descriptor.ts +1 -0
- package/src/families/bitcoin/satstack.test.ts +4 -1
- package/src/families/bitcoin/satstack.ts +9 -5
- package/src/families/bitcoin/specs.ts +0 -1
- package/src/families/cardano/__snapshots__/{bridge.test.ts.snap → bridge.integration.test.ts.snap} +0 -0
- package/src/families/cardano/{test-dataset.ts → bridge.integration.test.ts} +3 -1
- package/src/families/celo/bridge.integration.test.ts +14 -0
- package/src/families/cosmos/__snapshots__/{bridge.test.ts.snap → bridge.integration.test.ts.snap} +0 -0
- package/src/families/cosmos/{test-dataset.ts → bridge.integration.test.ts} +17 -15
- package/src/families/cosmos/speculos-deviceActions.ts +2 -2
- package/src/families/crypto_org/__snapshots__/bridge.integration.test.ts.snap +2968 -0
- package/src/families/crypto_org/bridge.integration.test.ts +14 -0
- package/src/families/elrond/__snapshots__/bridge.integration.test.ts.snap +207 -0
- package/src/families/elrond/{test-dataset.ts → bridge.integration.test.ts} +6 -4
- package/src/families/ethereum/__snapshots__/bridge.integration.test.ts.snap +3263 -0
- package/src/families/ethereum/{test-dataset.ts → bridge.integration.test.ts} +6 -19
- package/src/families/ethereum/datasets/ethereum1.ts +20 -0
- package/src/families/ethereum/modules/{compound.resilience.test.ts → compound.resilience.integration.test.ts} +1 -1
- package/src/families/ethereum/{synchronisation.test.ts → synchronisation.integration.test.ts} +1 -1
- package/src/families/filecoin/__snapshots__/{bridge.test.ts.snap → bridge.integration.test.ts.snap} +0 -0
- package/src/families/filecoin/{test-dataset.ts → bridge.integration.test.ts} +35 -3
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +5 -0
- package/src/families/hedera/{test-dataset.ts → bridge.integration.test.ts} +5 -2
- package/src/families/polkadot/{test-dataset.ts → bridge.integration.test.ts} +81 -5
- package/src/families/ripple/{test-dataset.ts → bridge.integration.test.ts} +5 -1
- package/src/families/solana/__snapshots__/{bridge.test.ts.snap → bridge.integration.test.ts.snap} +0 -0
- package/src/families/solana/{test-dataset.ts → bridge.integration.test.ts} +170 -5
- package/src/families/stellar/__snapshots__/{bridge.test.ts.snap → bridge.integration.test.ts.snap} +0 -0
- package/src/families/stellar/{test-dataset.ts → bridge.integration.test.ts} +5 -3
- package/src/families/stellar/js-estimateMaxSpendable.ts +3 -1
- package/src/families/tezos/{test-dataset.ts → bridge.integration.test.ts} +22 -1
- package/src/families/tezos/synchronisation.ts +1 -1
- package/src/families/tron/{test-dataset.ts → bridge.integration.test.ts} +6 -5
- package/src/load/speculos.ts +5 -2
- package/src/portfolio/v2/index.ts +7 -2
- package/src/portfolio/v2/range.test.ts +66 -0
- package/src/portfolio/v2/range.ts +22 -8
- package/lib/__tests__/portfolio.d.ts +0 -2
- package/lib/__tests__/portfolio.d.ts.map +0 -1
- package/lib/__tests__/portfolio.js +0 -297
- package/lib/__tests__/portfolio.js.map +0 -1
- package/lib/__tests__/test-helpers/libcore-setup.d.ts +0 -3
- package/lib/__tests__/test-helpers/libcore-setup.d.ts.map +0 -1
- package/lib/__tests__/test-helpers/libcore-setup.js +0 -68
- package/lib/__tests__/test-helpers/libcore-setup.js.map +0 -1
- package/lib/__tests__/test-helpers/libcore-setup.native.d.ts +0 -10
- package/lib/__tests__/test-helpers/libcore-setup.native.d.ts.map +0 -1
- package/lib/__tests__/test-helpers/libcore-setup.native.js +0 -16
- package/lib/__tests__/test-helpers/libcore-setup.native.js.map +0 -1
- package/lib/countervalues/logic.test.d.ts +0 -2
- package/lib/countervalues/logic.test.d.ts.map +0 -1
- package/lib/countervalues/logic.test.js.map +0 -1
- package/lib/families/algorand/test-dataset.d.ts +0 -5
- package/lib/families/algorand/test-dataset.d.ts.map +0 -1
- package/lib/families/algorand/test-dataset.js.map +0 -1
- package/lib/families/bitcoin/test-dataset.d.ts +0 -5
- package/lib/families/bitcoin/test-dataset.d.ts.map +0 -1
- package/lib/families/bitcoin/test-dataset.js.map +0 -1
- package/lib/families/cardano/bridge.test.d.ts +0 -2
- package/lib/families/cardano/bridge.test.d.ts.map +0 -1
- package/lib/families/cardano/bridge.test.js +0 -11
- package/lib/families/cardano/bridge.test.js.map +0 -1
- package/lib/families/cardano/test-dataset.d.ts +0 -5
- package/lib/families/cardano/test-dataset.d.ts.map +0 -1
- package/lib/families/cardano/test-dataset.js.map +0 -1
- package/lib/families/cosmos/bridge.test.d.ts +0 -2
- package/lib/families/cosmos/bridge.test.d.ts.map +0 -1
- package/lib/families/cosmos/bridge.test.js +0 -11
- package/lib/families/cosmos/bridge.test.js.map +0 -1
- package/lib/families/cosmos/test-dataset.d.ts +0 -5
- package/lib/families/cosmos/test-dataset.d.ts.map +0 -1
- package/lib/families/cosmos/test-dataset.js.map +0 -1
- package/lib/families/crypto_org/test-dataset.d.ts +0 -5
- package/lib/families/crypto_org/test-dataset.d.ts.map +0 -1
- package/lib/families/crypto_org/test-dataset.js +0 -12
- package/lib/families/crypto_org/test-dataset.js.map +0 -1
- package/lib/families/elrond/test-dataset.d.ts +0 -5
- package/lib/families/elrond/test-dataset.d.ts.map +0 -1
- package/lib/families/elrond/test-dataset.js.map +0 -1
- package/lib/families/ethereum/modules/compound.resilience.test.d.ts +0 -2
- package/lib/families/ethereum/modules/compound.resilience.test.d.ts.map +0 -1
- package/lib/families/ethereum/modules/compound.resilience.test.js.map +0 -1
- package/lib/families/ethereum/synchronisation.test.d.ts +0 -2
- package/lib/families/ethereum/synchronisation.test.d.ts.map +0 -1
- package/lib/families/ethereum/synchronisation.test.js.map +0 -1
- package/lib/families/ethereum/test-dataset.d.ts +0 -6
- package/lib/families/ethereum/test-dataset.d.ts.map +0 -1
- package/lib/families/ethereum/test-dataset.js.map +0 -1
- package/lib/families/filecoin/bridge.test.d.ts +0 -2
- package/lib/families/filecoin/bridge.test.d.ts.map +0 -1
- package/lib/families/filecoin/bridge.test.js +0 -92
- package/lib/families/filecoin/bridge.test.js.map +0 -1
- package/lib/families/filecoin/test-dataset.d.ts +0 -5
- package/lib/families/filecoin/test-dataset.d.ts.map +0 -1
- package/lib/families/filecoin/test-dataset.js.map +0 -1
- package/lib/families/hedera/test-dataset.d.ts +0 -5
- package/lib/families/hedera/test-dataset.d.ts.map +0 -1
- package/lib/families/hedera/test-dataset.js.map +0 -1
- package/lib/families/polkadot/bridge.test.d.ts +0 -2
- package/lib/families/polkadot/bridge.test.d.ts.map +0 -1
- package/lib/families/polkadot/bridge.test.js +0 -145
- package/lib/families/polkadot/bridge.test.js.map +0 -1
- package/lib/families/polkadot/test-dataset.d.ts +0 -5
- package/lib/families/polkadot/test-dataset.d.ts.map +0 -1
- package/lib/families/polkadot/test-dataset.js.map +0 -1
- package/lib/families/ripple/bridge.test.d.ts +0 -2
- package/lib/families/ripple/bridge.test.d.ts.map +0 -1
- package/lib/families/ripple/bridge.test.js +0 -11
- package/lib/families/ripple/bridge.test.js.map +0 -1
- package/lib/families/ripple/test-dataset.d.ts +0 -5
- package/lib/families/ripple/test-dataset.d.ts.map +0 -1
- package/lib/families/ripple/test-dataset.js.map +0 -1
- package/lib/families/solana/bridge.test.d.ts +0 -2
- package/lib/families/solana/bridge.test.d.ts.map +0 -1
- package/lib/families/solana/bridge.test.js +0 -11
- package/lib/families/solana/bridge.test.js.map +0 -1
- package/lib/families/solana/test-dataset.d.ts +0 -23
- package/lib/families/solana/test-dataset.d.ts.map +0 -1
- package/lib/families/solana/test-dataset.js.map +0 -1
- package/lib/families/solana/test-specifics.d.ts +0 -9
- package/lib/families/solana/test-specifics.d.ts.map +0 -1
- package/lib/families/solana/test-specifics.js +0 -237
- package/lib/families/solana/test-specifics.js.map +0 -1
- package/lib/families/stellar/bridge.test.d.ts +0 -2
- package/lib/families/stellar/bridge.test.d.ts.map +0 -1
- package/lib/families/stellar/bridge.test.js +0 -11
- package/lib/families/stellar/bridge.test.js.map +0 -1
- package/lib/families/stellar/test-dataset.d.ts +0 -7
- package/lib/families/stellar/test-dataset.d.ts.map +0 -1
- package/lib/families/stellar/test-dataset.js.map +0 -1
- package/lib/families/tezos/bridge.test.d.ts +0 -2
- package/lib/families/tezos/bridge.test.d.ts.map +0 -1
- package/lib/families/tezos/bridge.test.js +0 -81
- package/lib/families/tezos/bridge.test.js.map +0 -1
- package/lib/families/tezos/test-dataset.d.ts.map +0 -1
- package/lib/families/tezos/test-dataset.js.map +0 -1
- package/lib/families/tron/test-dataset.d.ts +0 -5
- package/lib/families/tron/test-dataset.d.ts.map +0 -1
- package/lib/families/tron/test-dataset.js.map +0 -1
- package/lib/generated/test-dataset.d.ts +0 -19
- package/lib/generated/test-dataset.d.ts.map +0 -1
- package/lib/generated/test-dataset.js +0 -38
- package/lib/generated/test-dataset.js.map +0 -1
- package/lib/portfolio/index.d.ts +0 -30
- package/lib/portfolio/index.d.ts.map +0 -1
- package/lib/portfolio/index.js +0 -399
- package/lib/portfolio/index.js.map +0 -1
- package/lib/portfolio/range.d.ts +0 -12
- package/lib/portfolio/range.d.ts.map +0 -1
- package/lib/portfolio/range.js +0 -73
- package/lib/portfolio/range.js.map +0 -1
- package/src/__tests__/__snapshots__/portfolio.ts.snap +0 -2770
- package/src/__tests__/portfolio.ts +0 -360
- package/src/__tests__/test-helpers/libcore-setup.native.ts +0 -19
- package/src/__tests__/test-helpers/libcore-setup.ts +0 -51
- package/src/families/bitcoin/bridge.test.ts.bak +0 -6
- package/src/families/cardano/bridge.test.ts +0 -6
- package/src/families/cosmos/bridge.test.ts +0 -6
- package/src/families/crypto_org/test-dataset.ts +0 -13
- package/src/families/ethereum/bridge.test.ts.bak +0 -8
- package/src/families/filecoin/bridge.test.ts +0 -39
- package/src/families/polkadot/bridge.test.ts +0 -81
- package/src/families/ripple/bridge.test.ts +0 -6
- package/src/families/solana/bridge.test.ts +0 -6
- package/src/families/solana/test-specifics.ts +0 -170
- package/src/families/stellar/bridge.test.ts +0 -6
- package/src/families/tezos/bridge.test.ts +0 -24
- package/src/generated/test-dataset.ts +0 -48
- package/src/portfolio/index.ts +0 -505
- package/src/portfolio/range.ts +0 -71
package/src/bot/index.ts
CHANGED
|
@@ -22,11 +22,10 @@ import { runWithAppSpec } from "./engine";
|
|
|
22
22
|
import { formatReportForConsole, formatError } from "./formatters";
|
|
23
23
|
import {
|
|
24
24
|
initialState,
|
|
25
|
-
calculate,
|
|
26
25
|
loadCountervalues,
|
|
27
26
|
inferTrackingPairForAccounts,
|
|
28
27
|
} from "../countervalues/logic";
|
|
29
|
-
import { getPortfolio } from "../portfolio";
|
|
28
|
+
import { getPortfolio } from "../portfolio/v2";
|
|
30
29
|
type Arg = Partial<{
|
|
31
30
|
currency: string;
|
|
32
31
|
family: string;
|
|
@@ -119,23 +118,15 @@ export async function bot({ currency, family, mutation }: Arg = {}) {
|
|
|
119
118
|
});
|
|
120
119
|
const period = "month";
|
|
121
120
|
|
|
122
|
-
const
|
|
123
|
-
countervaluesState
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
date,
|
|
127
|
-
value: v.toNumber(),
|
|
128
|
-
from: c,
|
|
129
|
-
to: usd,
|
|
130
|
-
}) || 0
|
|
131
|
-
)
|
|
132
|
-
: new BigNumber(0);
|
|
133
|
-
|
|
134
|
-
const portfolio = getPortfolio(allAccountsAfter, period, calc);
|
|
135
|
-
const totalUSD = countervaluesState
|
|
121
|
+
const portfolio = countervaluesState
|
|
122
|
+
? getPortfolio(allAccountsAfter, period, countervaluesState, usd)
|
|
123
|
+
: null;
|
|
124
|
+
const totalUSD = portfolio
|
|
136
125
|
? formatCurrencyUnit(
|
|
137
126
|
usd.units[0],
|
|
138
|
-
|
|
127
|
+
new BigNumber(
|
|
128
|
+
portfolio.balanceHistory[portfolio.balanceHistory.length - 1].value
|
|
129
|
+
),
|
|
139
130
|
{
|
|
140
131
|
showCode: true,
|
|
141
132
|
}
|
|
@@ -378,14 +369,25 @@ export async function bot({ currency, family, mutation }: Arg = {}) {
|
|
|
378
369
|
}
|
|
379
370
|
|
|
380
371
|
if (countervaluesState && r.accountsAfter) {
|
|
381
|
-
const portfolio = getPortfolio(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
showCode: true,
|
|
387
|
-
}
|
|
372
|
+
const portfolio = getPortfolio(
|
|
373
|
+
r.accountsAfter,
|
|
374
|
+
period,
|
|
375
|
+
countervaluesState,
|
|
376
|
+
usd
|
|
388
377
|
);
|
|
378
|
+
const totalUSD = portfolio
|
|
379
|
+
? formatCurrencyUnit(
|
|
380
|
+
usd.units[0],
|
|
381
|
+
new BigNumber(
|
|
382
|
+
portfolio.balanceHistory[
|
|
383
|
+
portfolio.balanceHistory.length - 1
|
|
384
|
+
].value
|
|
385
|
+
),
|
|
386
|
+
{
|
|
387
|
+
showCode: true,
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
: "";
|
|
389
391
|
balance += " (" + totalUSD + ")";
|
|
390
392
|
}
|
|
391
393
|
|
package/src/bot/test.bot.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../__tests__/test-helpers/setup";
|
|
2
2
|
import { bot } from ".";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
jest.setTimeout(110 * 60 * 1000);
|
|
5
5
|
const { BOT_FILTER_CURRENCY, BOT_FILTER_FAMILY } = process.env;
|
|
6
6
|
test("bot", async () => {
|
|
File without changes
|
|
@@ -10,30 +10,8 @@ import React, {
|
|
|
10
10
|
useCallback,
|
|
11
11
|
ReactElement,
|
|
12
12
|
} from "react";
|
|
13
|
-
import type {
|
|
14
|
-
|
|
15
|
-
AccountLike,
|
|
16
|
-
PortfolioRange,
|
|
17
|
-
Currency,
|
|
18
|
-
CryptoCurrency,
|
|
19
|
-
TokenCurrency,
|
|
20
|
-
AccountPortfolio,
|
|
21
|
-
Portfolio,
|
|
22
|
-
CurrencyPortfolio,
|
|
23
|
-
AssetsDistribution,
|
|
24
|
-
Unit,
|
|
25
|
-
} from "../types";
|
|
26
|
-
import {
|
|
27
|
-
getBalanceHistoryWithCountervalue,
|
|
28
|
-
getPortfolio,
|
|
29
|
-
getCurrencyPortfolio,
|
|
30
|
-
getAssetsDistribution,
|
|
31
|
-
} from "../portfolio";
|
|
32
|
-
import {
|
|
33
|
-
getAccountCurrency,
|
|
34
|
-
flattenAccounts,
|
|
35
|
-
getAccountUnit,
|
|
36
|
-
} from "../account/helpers";
|
|
13
|
+
import type { Account, AccountLike, Currency, Unit } from "../types";
|
|
14
|
+
import { getAccountCurrency, getAccountUnit } from "../account/helpers";
|
|
37
15
|
import {
|
|
38
16
|
initialState,
|
|
39
17
|
calculate,
|
|
@@ -304,113 +282,6 @@ export function useCalculateMany(
|
|
|
304
282
|
// TODO how to approach perf for this? hash function of the datapoints? responsability on user land?
|
|
305
283
|
return calculateMany(state, dataPoints, query);
|
|
306
284
|
}
|
|
307
|
-
// TODO perf of the useCalculate*, does it even worth worrying?
|
|
308
|
-
// TODO move to portfolio module (I couldn't make useCountervaluesState to work there)
|
|
309
|
-
export function useBalanceHistoryWithCountervalue({
|
|
310
|
-
account,
|
|
311
|
-
range,
|
|
312
|
-
to,
|
|
313
|
-
}: {
|
|
314
|
-
account: AccountLike;
|
|
315
|
-
range: PortfolioRange;
|
|
316
|
-
to: Currency;
|
|
317
|
-
}): AccountPortfolio {
|
|
318
|
-
const from = getAccountCurrency(account);
|
|
319
|
-
const state = useCountervaluesState();
|
|
320
|
-
return useMemo(
|
|
321
|
-
() =>
|
|
322
|
-
getBalanceHistoryWithCountervalue(account, range, (_, value, date) => {
|
|
323
|
-
const countervalue = calculate(state, {
|
|
324
|
-
value: value.toNumber(),
|
|
325
|
-
from,
|
|
326
|
-
to,
|
|
327
|
-
disableRounding: true,
|
|
328
|
-
date,
|
|
329
|
-
});
|
|
330
|
-
return typeof countervalue === "number"
|
|
331
|
-
? new BigNumber(countervalue)
|
|
332
|
-
: countervalue;
|
|
333
|
-
}),
|
|
334
|
-
[account, from, to, range, state]
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
export function usePortfolio({
|
|
338
|
-
accounts,
|
|
339
|
-
range,
|
|
340
|
-
to,
|
|
341
|
-
}: {
|
|
342
|
-
accounts: Account[];
|
|
343
|
-
range: PortfolioRange;
|
|
344
|
-
to: Currency;
|
|
345
|
-
}): Portfolio {
|
|
346
|
-
const state = useCountervaluesState();
|
|
347
|
-
return useMemo(
|
|
348
|
-
() =>
|
|
349
|
-
getPortfolio(accounts, range, (from, value, date) => {
|
|
350
|
-
const countervalue = calculate(state, {
|
|
351
|
-
value: value.toNumber(),
|
|
352
|
-
from,
|
|
353
|
-
to,
|
|
354
|
-
disableRounding: true,
|
|
355
|
-
date,
|
|
356
|
-
});
|
|
357
|
-
return typeof countervalue === "number"
|
|
358
|
-
? new BigNumber(countervalue)
|
|
359
|
-
: countervalue;
|
|
360
|
-
}),
|
|
361
|
-
[accounts, range, state, to]
|
|
362
|
-
);
|
|
363
|
-
}
|
|
364
|
-
export function useCurrencyPortfolio({
|
|
365
|
-
accounts: rawAccounts,
|
|
366
|
-
range,
|
|
367
|
-
to,
|
|
368
|
-
currency,
|
|
369
|
-
}: {
|
|
370
|
-
accounts: Account[];
|
|
371
|
-
range: PortfolioRange;
|
|
372
|
-
to: Currency;
|
|
373
|
-
currency: CryptoCurrency | TokenCurrency;
|
|
374
|
-
}): CurrencyPortfolio {
|
|
375
|
-
const accounts = flattenAccounts(rawAccounts).filter(
|
|
376
|
-
(a) => getAccountCurrency(a) === currency
|
|
377
|
-
);
|
|
378
|
-
const state = useCountervaluesState();
|
|
379
|
-
return useMemo(
|
|
380
|
-
() =>
|
|
381
|
-
getCurrencyPortfolio(accounts, range, (from, value, date) => {
|
|
382
|
-
const countervalue = calculate(state, {
|
|
383
|
-
value: value.toNumber(),
|
|
384
|
-
from,
|
|
385
|
-
to,
|
|
386
|
-
disableRounding: true,
|
|
387
|
-
date,
|
|
388
|
-
});
|
|
389
|
-
return typeof countervalue === "number"
|
|
390
|
-
? new BigNumber(countervalue)
|
|
391
|
-
: countervalue;
|
|
392
|
-
}),
|
|
393
|
-
[accounts, range, state, to]
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
export function useDistribution({
|
|
397
|
-
accounts,
|
|
398
|
-
to,
|
|
399
|
-
}: {
|
|
400
|
-
accounts: Account[];
|
|
401
|
-
to: Currency;
|
|
402
|
-
}): AssetsDistribution {
|
|
403
|
-
const calc = useCalculateCountervalueCallback({
|
|
404
|
-
to,
|
|
405
|
-
});
|
|
406
|
-
return useMemo(() => {
|
|
407
|
-
return getAssetsDistribution(accounts, calc, {
|
|
408
|
-
minShowFirst: 6,
|
|
409
|
-
maxShowFirst: 6,
|
|
410
|
-
showFirstThreshold: 0.95,
|
|
411
|
-
});
|
|
412
|
-
}, [accounts, calc]);
|
|
413
|
-
}
|
|
414
285
|
|
|
415
286
|
export function useCalculateCountervalueCallback({
|
|
416
287
|
to,
|
|
@@ -118,7 +118,6 @@ Array [
|
|
|
118
118
|
"ethereum/erc20/thorchain_eth_rune",
|
|
119
119
|
"ethereum/erc20/acuteanglecoin",
|
|
120
120
|
"pivx",
|
|
121
|
-
"ethereum/erc20/constellation_token",
|
|
122
121
|
"ethereum/erc20/reserve_rights",
|
|
123
122
|
"ethereum/erc20/wcoin",
|
|
124
123
|
"ethereum/erc20/shipchain",
|
|
@@ -1747,6 +1746,7 @@ Array [
|
|
|
1747
1746
|
"ethereum/erc20/bavala",
|
|
1748
1747
|
"ethereum/erc20/bayc_history_-the_great_floor_sweep",
|
|
1749
1748
|
"ethereum/erc20/baz_token",
|
|
1749
|
+
"ethereum/erc20/bb_verse",
|
|
1750
1750
|
"ethereum/erc20/bbn",
|
|
1751
1751
|
"ethereum/erc20/bcap",
|
|
1752
1752
|
"ethereum/erc20/bcat",
|
|
@@ -2751,6 +2751,7 @@ Array [
|
|
|
2751
2751
|
"ethereum/erc20/eub_chain",
|
|
2752
2752
|
"ethereum/erc20/eur_tether__erc20_",
|
|
2753
2753
|
"ethereum/erc20/eurbase_stablecoin",
|
|
2754
|
+
"ethereum/erc20/euro_coin",
|
|
2754
2755
|
"ethereum/erc20/euro_stable_token",
|
|
2755
2756
|
"ethereum/erc20/europechain",
|
|
2756
2757
|
"ethereum/erc20/eurxb",
|
|
@@ -2868,6 +2869,7 @@ Array [
|
|
|
2868
2869
|
"ethereum/erc20/floki_wife",
|
|
2869
2870
|
"ethereum/erc20/flow_protocol",
|
|
2870
2871
|
"ethereum/erc20/flux",
|
|
2872
|
+
"ethereum/erc20/flux_(zel)",
|
|
2871
2873
|
"ethereum/erc20/flux_protocol",
|
|
2872
2874
|
"ethereum/erc20/fluz_fluz_global",
|
|
2873
2875
|
"ethereum/erc20/flynnjamm",
|
|
@@ -3412,6 +3414,7 @@ Array [
|
|
|
3412
3414
|
"ethereum/erc20/konomi",
|
|
3413
3415
|
"ethereum/erc20/korea_medical_tba",
|
|
3414
3416
|
"ethereum/erc20/koris",
|
|
3417
|
+
"ethereum/erc20/kounotori",
|
|
3415
3418
|
"ethereum/erc20/kper_network",
|
|
3416
3419
|
"ethereum/erc20/kpop",
|
|
3417
3420
|
"ethereum/erc20/kprcoin",
|
|
@@ -4678,6 +4681,7 @@ Array [
|
|
|
4678
4681
|
"ethereum/erc20/strikex",
|
|
4679
4682
|
"ethereum/erc20/strips_token",
|
|
4680
4683
|
"ethereum/erc20/strong",
|
|
4684
|
+
"ethereum/erc20/stronger",
|
|
4681
4685
|
"ethereum/erc20/stronghold",
|
|
4682
4686
|
"ethereum/erc20/strudel_finance",
|
|
4683
4687
|
"ethereum/erc20/successlife",
|
|
@@ -4899,6 +4903,7 @@ Array [
|
|
|
4899
4903
|
"ethereum/erc20/toka",
|
|
4900
4904
|
"ethereum/erc20/tokamak_network_token",
|
|
4901
4905
|
"ethereum/erc20/tokemak",
|
|
4906
|
+
"ethereum/erc20/tokemaksushilppool",
|
|
4902
4907
|
"ethereum/erc20/tokemon",
|
|
4903
4908
|
"ethereum/erc20/token_1337",
|
|
4904
4909
|
"ethereum/erc20/token_play",
|
|
@@ -5600,6 +5605,7 @@ Array [
|
|
|
5600
5605
|
"polygon/erc20/cerby_token",
|
|
5601
5606
|
"polygon/erc20/chainlink_token",
|
|
5602
5607
|
"polygon/erc20/chiliz",
|
|
5608
|
+
"polygon/erc20/city_of_block",
|
|
5603
5609
|
"polygon/erc20/clintex",
|
|
5604
5610
|
"polygon/erc20/clocks_token",
|
|
5605
5611
|
"polygon/erc20/conch_coin",
|
|
@@ -5872,6 +5878,7 @@ Array [
|
|
|
5872
5878
|
"bsc/bep20/bakerytoken",
|
|
5873
5879
|
"bsc/bep20/bat_true_dollar",
|
|
5874
5880
|
"bsc/bep20/bat_true_share",
|
|
5881
|
+
"bsc/bep20/bb_verse",
|
|
5875
5882
|
"bsc/bep20/bdollar",
|
|
5876
5883
|
"bsc/bep20/bdollar_share",
|
|
5877
5884
|
"bsc/bep20/bearn.fi",
|
|
@@ -5962,6 +5969,7 @@ Array [
|
|
|
5962
5969
|
"bsc/bep20/canyacoin",
|
|
5963
5970
|
"bsc/bep20/car",
|
|
5964
5971
|
"bsc/bep20/cartesi_token",
|
|
5972
|
+
"bsc/bep20/catcoin",
|
|
5965
5973
|
"bsc/bep20/catecoin",
|
|
5966
5974
|
"bsc/bep20/catecoin_old",
|
|
5967
5975
|
"bsc/bep20/ceek",
|
|
@@ -6051,6 +6059,7 @@ Array [
|
|
|
6051
6059
|
"bsc/bep20/floki_rocket",
|
|
6052
6060
|
"bsc/bep20/flokimooni",
|
|
6053
6061
|
"bsc/bep20/formation_finance",
|
|
6062
|
+
"bsc/bep20/foxfinancev2",
|
|
6054
6063
|
"bsc/bep20/free_coin_bsc",
|
|
6055
6064
|
"bsc/bep20/frmx_token",
|
|
6056
6065
|
"bsc/bep20/frog_inu",
|
|
@@ -6077,6 +6086,7 @@ Array [
|
|
|
6077
6086
|
"bsc/bep20/hacken_token",
|
|
6078
6087
|
"bsc/bep20/hakka_finance_on_xdai_on_bsc",
|
|
6079
6088
|
"bsc/bep20/happinesstoken",
|
|
6089
|
+
"bsc/bep20/happy_4th_of_july",
|
|
6080
6090
|
"bsc/bep20/hard",
|
|
6081
6091
|
"bsc/bep20/harmony_one",
|
|
6082
6092
|
"bsc/bep20/hedge_token",
|
|
@@ -6100,6 +6110,7 @@ Array [
|
|
|
6100
6110
|
"bsc/bep20/juggernaut_defi",
|
|
6101
6111
|
"bsc/bep20/julswap",
|
|
6102
6112
|
"bsc/bep20/jumptoken",
|
|
6113
|
+
"bsc/bep20/jupyter",
|
|
6103
6114
|
"bsc/bep20/jurassic_token",
|
|
6104
6115
|
"bsc/bep20/kaby_arena",
|
|
6105
6116
|
"bsc/bep20/kalmar_token",
|
|
@@ -6139,6 +6150,7 @@ Array [
|
|
|
6139
6150
|
"bsc/bep20/mobox",
|
|
6140
6151
|
"bsc/bep20/moeda_loyalty_points",
|
|
6141
6152
|
"bsc/bep20/moeda_seeds",
|
|
6153
|
+
"bsc/bep20/moneu_token",
|
|
6142
6154
|
"bsc/bep20/monsta_infinite_token",
|
|
6143
6155
|
"bsc/bep20/moomonster_token",
|
|
6144
6156
|
"bsc/bep20/moonienft_token",
|
|
@@ -6240,6 +6252,7 @@ Array [
|
|
|
6240
6252
|
"bsc/bep20/shambala",
|
|
6241
6253
|
"bsc/bep20/shard",
|
|
6242
6254
|
"bsc/bep20/shiba_inu",
|
|
6255
|
+
"bsc/bep20/shibnobi",
|
|
6243
6256
|
"bsc/bep20/shield_protocol",
|
|
6244
6257
|
"bsc/bep20/shill",
|
|
6245
6258
|
"bsc/bep20/shirtum",
|
|
@@ -6338,6 +6351,7 @@ Array [
|
|
|
6338
6351
|
"bsc/bep20/waultswap",
|
|
6339
6352
|
"bsc/bep20/wazirx_token",
|
|
6340
6353
|
"bsc/bep20/weather",
|
|
6354
|
+
"bsc/bep20/weed_inu",
|
|
6341
6355
|
"bsc/bep20/weetwo",
|
|
6342
6356
|
"bsc/bep20/weyu",
|
|
6343
6357
|
"bsc/bep20/wink",
|
package/src/derivation.ts
CHANGED
|
@@ -157,12 +157,13 @@ const modes = Object.freeze({
|
|
|
157
157
|
// glif legacy derivation
|
|
158
158
|
gliflegacy: {
|
|
159
159
|
overridesDerivation: "44'/1'/0'/0/<account>",
|
|
160
|
-
tag: "legacy",
|
|
160
|
+
tag: "glif-legacy",
|
|
161
161
|
},
|
|
162
162
|
// glif normal derivation
|
|
163
163
|
glif: {
|
|
164
164
|
overridesDerivation: "44'/461'/0'/0/<account>",
|
|
165
165
|
startsAt: 1,
|
|
166
|
+
tag: "glif",
|
|
166
167
|
},
|
|
167
168
|
solanaMain: {
|
|
168
169
|
isNonIterable: true,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
2
2
|
import axios from "axios";
|
|
3
3
|
import BigNumber from "bignumber.js";
|
|
4
|
-
import { mocked } from "ts-jest/utils";
|
|
5
4
|
import { Account, Transaction } from "../../types";
|
|
6
5
|
import getExchangeRates from "./getExchangeRates";
|
|
7
6
|
import { Exchange, ExchangeRate } from "./types";
|
|
8
7
|
|
|
9
8
|
jest.mock("axios");
|
|
10
|
-
const mockedAxios = mocked(axios);
|
|
9
|
+
const mockedAxios = jest.mocked(axios);
|
|
11
10
|
|
|
12
11
|
const bitcoinCurrency = getCryptoCurrencyById("bitcoin");
|
|
13
12
|
const ethereumCurrency = getCryptoCurrencyById("ethereum");
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { renderHook } from "@testing-library/react-hooks";
|
|
2
|
-
import { mocked } from "ts-jest/utils";
|
|
3
|
-
|
|
4
2
|
import {
|
|
5
3
|
usePollKYCStatus,
|
|
6
4
|
KYC_STATUS_POLLING_INTERVAL,
|
|
@@ -12,7 +10,7 @@ import { KYCStatus } from "../types";
|
|
|
12
10
|
|
|
13
11
|
// mock getKYCStatus
|
|
14
12
|
jest.mock("..");
|
|
15
|
-
const mockedGetKYCStatus = mocked(getKYCStatus, true);
|
|
13
|
+
const mockedGetKYCStatus = jest.mocked(getKYCStatus, true);
|
|
16
14
|
|
|
17
15
|
describe("usePollKYCStatus", () => {
|
|
18
16
|
const defaultInput: UsePollKYCStatusProps = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { renderHook, act } from "@testing-library/react-hooks";
|
|
2
2
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
3
3
|
import BigNumber from "bignumber.js";
|
|
4
|
-
import { mocked } from "ts-jest/utils";
|
|
5
4
|
import { useProviderRates } from ".";
|
|
6
5
|
import { getExchangeRates } from "..";
|
|
7
6
|
import { genAccount } from "../../../mock/account";
|
|
@@ -15,7 +14,7 @@ const fromAccount = genAccount("from-account", {
|
|
|
15
14
|
currency: ETH,
|
|
16
15
|
});
|
|
17
16
|
|
|
18
|
-
const mockedGetExchangeRates = mocked(getExchangeRates, true);
|
|
17
|
+
const mockedGetExchangeRates = jest.mocked(getExchangeRates, true);
|
|
19
18
|
const mockedRatesPromise = mockGetExchangeRates(
|
|
20
19
|
{ fromAccount } as any,
|
|
21
20
|
{ amount: new BigNumber(1) } as any,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { renderHook } from "@testing-library/react-hooks";
|
|
2
|
-
import { mocked } from "ts-jest/utils";
|
|
3
|
-
|
|
4
2
|
import { useSwapProviders } from "./useSwapProviders";
|
|
5
3
|
import { getProviders } from "..";
|
|
6
4
|
|
|
7
5
|
jest.mock("..");
|
|
8
6
|
|
|
9
|
-
const mockedGetProviders = mocked(getProviders);
|
|
7
|
+
const mockedGetProviders = jest.mocked(getProviders);
|
|
10
8
|
|
|
11
9
|
describe("useSwapProviders", () => {
|
|
12
10
|
const OLD_ENV = process.env;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { renderHook, act } from "@testing-library/react-hooks";
|
|
2
2
|
import { getCryptoCurrencyById, getTokenById } from "@ledgerhq/cryptoassets";
|
|
3
|
-
import { mocked } from "ts-jest/utils";
|
|
4
3
|
import { useUpdateMaxAmount, ZERO } from "./useUpdateMaxAmount";
|
|
5
4
|
import { genAccount, genTokenAccount } from "../../../mock/account";
|
|
6
5
|
import BigNumber from "bignumber.js";
|
|
@@ -9,10 +8,10 @@ import { checkAccountSupported } from "../../../account/support";
|
|
|
9
8
|
|
|
10
9
|
// Needs to be mocked since userSupportedCurrencies is initially empty.
|
|
11
10
|
jest.mock("../../../account/support");
|
|
12
|
-
const mockedCheckAccount = mocked(checkAccountSupported);
|
|
11
|
+
const mockedCheckAccount = jest.mocked(checkAccountSupported);
|
|
13
12
|
// Mock to use a custom estimate value and test the result.
|
|
14
13
|
jest.mock("../../../families/ethereum/bridge/mock");
|
|
15
|
-
const mockedEstimateMaxSpendable = mocked(
|
|
14
|
+
const mockedEstimateMaxSpendable = jest.mocked(
|
|
16
15
|
ethBridge.accountBridge.estimateMaxSpendable,
|
|
17
16
|
true
|
|
18
17
|
);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
|
2
|
+
import "../../__tests__/test-helpers/setup";
|
|
3
|
+
import { testBridge } from "../../__tests__/test-helpers/bridge";
|
|
2
4
|
import type { DatasetTest } from "../../types";
|
|
3
5
|
import {
|
|
4
6
|
InvalidAddressBecauseDestinationIsAlsoSource,
|
|
@@ -9,10 +11,10 @@ import { AlgorandASANotOptInInRecipient } from "../../errors";
|
|
|
9
11
|
import type { AlgorandTransaction } from "./types";
|
|
10
12
|
// const notCreatedAlgorandAddress =
|
|
11
13
|
// "ZBILW5BPM7AQU54YQZICSGS4J7KJ2XV6OC3DFUQ7BB4DVLYKKUEVWDDBGM";
|
|
14
|
+
|
|
12
15
|
const dataset: DatasetTest<AlgorandTransaction> = {
|
|
13
|
-
implementations: ["
|
|
14
|
-
|
|
15
|
-
currencies: {} || {
|
|
16
|
+
implementations: ["js"],
|
|
17
|
+
currencies: {
|
|
16
18
|
algorand: {
|
|
17
19
|
FIXME_ignoreAccountFields: [
|
|
18
20
|
"algorandResources.rewards", // We cant keep track of this since it's always moving
|
|
@@ -43,7 +45,7 @@ const dataset: DatasetTest<AlgorandTransaction> = {
|
|
|
43
45
|
FIXME_tests: ["balance is sum of ops"],
|
|
44
46
|
// Rewards issues
|
|
45
47
|
raw: {
|
|
46
|
-
id: "
|
|
48
|
+
id: "js:1:algorand:c8b672d16c497bb097a48f09a9cccf0c4c7d6391acb7a4e7cd3f236fadbef9c4:",
|
|
47
49
|
seedIdentifier:
|
|
48
50
|
"c8b672d16c497bb097a48f09a9cccf0c4c7d6391acb7a4e7cd3f236fadbef9c4",
|
|
49
51
|
name: "Algorand 1",
|
|
@@ -165,7 +167,7 @@ const dataset: DatasetTest<AlgorandTransaction> = {
|
|
|
165
167
|
transaction: (t) => ({
|
|
166
168
|
...t,
|
|
167
169
|
subAccountId:
|
|
168
|
-
"
|
|
170
|
+
"js:1:algorand:c8b672d16c497bb097a48f09a9cccf0c4c7d6391acb7a4e7cd3f236fadbef9c4:+312769",
|
|
169
171
|
amount: new BigNumber("1000"),
|
|
170
172
|
recipient:
|
|
171
173
|
"ZQVVJ2S4XWS542KXBBVIINOEHIDOEZKZWK725PWFNN2I5RNCUBI53RT2EY",
|
|
@@ -182,7 +184,7 @@ const dataset: DatasetTest<AlgorandTransaction> = {
|
|
|
182
184
|
transaction: (t) => ({
|
|
183
185
|
...t,
|
|
184
186
|
subAccountId:
|
|
185
|
-
"
|
|
187
|
+
"js:1:algorand:c8b672d16c497bb097a48f09a9cccf0c4c7d6391acb7a4e7cd3f236fadbef9c4:+312769",
|
|
186
188
|
amount: new BigNumber("1000"),
|
|
187
189
|
recipient:
|
|
188
190
|
"MECOWMKPKH2NWVZTS5V5RQDGFFYBT25KNLOPHG2KUMMNKU6FOHGJT24WBI",
|
|
@@ -198,7 +200,7 @@ const dataset: DatasetTest<AlgorandTransaction> = {
|
|
|
198
200
|
transaction: (t) => ({
|
|
199
201
|
...t,
|
|
200
202
|
subAccountId:
|
|
201
|
-
"
|
|
203
|
+
"js:1:algorand:c8b672d16c497bb097a48f09a9cccf0c4c7d6391acb7a4e7cd3f236fadbef9c4:+312769",
|
|
202
204
|
amount: new BigNumber("100000000000"),
|
|
203
205
|
recipient:
|
|
204
206
|
"MECOWMKPKH2NWVZTS5V5RQDGFFYBT25KNLOPHG2KUMMNKU6FOHGJT24WBI",
|
|
@@ -214,7 +216,7 @@ const dataset: DatasetTest<AlgorandTransaction> = {
|
|
|
214
216
|
},
|
|
215
217
|
{
|
|
216
218
|
raw: {
|
|
217
|
-
id: "
|
|
219
|
+
id: "js:1:algorand:6104eb314f51f4db5733976bd8c066297019ebaa6adcf39b4aa318d553c571cc:",
|
|
218
220
|
seedIdentifier:
|
|
219
221
|
"c8b672d16c497bb097a48f09a9cccf0c4c7d6391acb7a4e7cd3f236fadbef9c4",
|
|
220
222
|
xpub: "6104eb314f51f4db5733976bd8c066297019ebaa6adcf39b4aa318d553c571cc",
|
|
@@ -276,7 +278,7 @@ const dataset: DatasetTest<AlgorandTransaction> = {
|
|
|
276
278
|
transaction: (t) => ({
|
|
277
279
|
...t,
|
|
278
280
|
subAccountId:
|
|
279
|
-
"
|
|
281
|
+
"js:1:algorand:fef9cf3252121f000324dd819b2c1d76910413924acaf6779b30e1fa1874d7af:+312769",
|
|
280
282
|
amount: new BigNumber("1000"),
|
|
281
283
|
recipient:
|
|
282
284
|
"YWZPDCL5XQPCPGBXKB7KAG7YF2QGCGEX37YTSM55CPEPHKNE2ZSKRAXNQ4",
|
|
@@ -294,4 +296,5 @@ const dataset: DatasetTest<AlgorandTransaction> = {
|
|
|
294
296
|
},
|
|
295
297
|
},
|
|
296
298
|
};
|
|
297
|
-
|
|
299
|
+
|
|
300
|
+
testBridge(dataset);
|