@ledgerhq/live-common 23.1.0 → 24.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/env.d.ts +16 -6
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +11 -1
- package/lib/env.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/errors.d.ts +0 -3
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +2 -3
- package/lib/errors.js.map +1 -1
- package/lib/exchange/index.d.ts +5 -0
- package/lib/exchange/index.d.ts.map +1 -1
- package/lib/exchange/index.js.map +1 -1
- package/lib/exchange/swap/checkQuote.d.ts +4 -0
- package/lib/exchange/swap/checkQuote.d.ts.map +1 -0
- package/lib/{families/tezos/bridge.test.js → exchange/swap/checkQuote.js} +35 -36
- package/lib/exchange/swap/checkQuote.js.map +1 -0
- package/lib/exchange/swap/checkQuote.test.d.ts +2 -0
- package/lib/exchange/swap/checkQuote.test.d.ts.map +1 -0
- package/lib/{families/filecoin/bridge.test.js → exchange/swap/checkQuote.test.js} +53 -42
- package/lib/exchange/swap/checkQuote.test.js.map +1 -0
- package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.js +9 -9
- package/lib/exchange/swap/completeExchange.js.map +1 -1
- package/lib/exchange/swap/getExchangeRates.d.ts.map +1 -1
- package/lib/exchange/swap/getExchangeRates.js +3 -1
- package/lib/exchange/swap/getExchangeRates.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/getProviders.d.ts.map +1 -1
- package/lib/exchange/swap/getProviders.js +10 -4
- package/lib/exchange/swap/getProviders.js.map +1 -1
- package/lib/exchange/swap/getStatus.d.ts +1 -3
- package/lib/exchange/swap/getStatus.d.ts.map +1 -1
- package/lib/exchange/swap/getStatus.js +2 -30
- package/lib/exchange/swap/getStatus.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.d.ts +3 -4
- package/lib/exchange/swap/hooks/useProviderRates.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useProviderRates.js +35 -5
- package/lib/exchange/swap/hooks/useProviderRates.js.map +1 -1
- package/lib/exchange/swap/hooks/useProviderRates.test.js +107 -3
- 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/useSwapTransaction.d.ts +5 -4
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.js +6 -6
- package/lib/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.d.ts +4 -3
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.js +8 -5
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.js.map +1 -1
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.test.js +37 -7
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.test.js.map +1 -1
- package/lib/exchange/swap/index.d.ts +10 -8
- package/lib/exchange/swap/index.d.ts.map +1 -1
- package/lib/exchange/swap/index.js +43 -18
- package/lib/exchange/swap/index.js.map +1 -1
- package/lib/exchange/swap/index.test.d.ts +2 -0
- package/lib/exchange/swap/index.test.d.ts.map +1 -0
- package/lib/exchange/swap/index.test.js +30 -0
- package/lib/exchange/swap/index.test.js.map +1 -0
- package/lib/exchange/swap/initSwap.d.ts +1 -1
- package/lib/exchange/swap/initSwap.d.ts.map +1 -1
- package/lib/exchange/swap/initSwap.js +30 -25
- package/lib/exchange/swap/initSwap.js.map +1 -1
- package/lib/exchange/swap/mock.d.ts +5 -2
- package/lib/exchange/swap/mock.d.ts.map +1 -1
- package/lib/exchange/swap/mock.js +127 -6
- package/lib/exchange/swap/mock.js.map +1 -1
- package/lib/exchange/swap/postSwapState.d.ts +4 -0
- package/lib/exchange/swap/postSwapState.d.ts.map +1 -0
- package/lib/exchange/swap/postSwapState.js +121 -0
- package/lib/exchange/swap/postSwapState.js.map +1 -0
- package/lib/exchange/swap/types.d.ts +30 -2
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/exchange/swap/updateAccountSwapStatus.d.ts.map +1 -1
- package/lib/exchange/swap/updateAccountSwapStatus.js +2 -2
- package/lib/exchange/swap/updateAccountSwapStatus.js.map +1 -1
- package/lib/exchange/swap/utils/index.d.ts +19 -2
- package/lib/exchange/swap/utils/index.d.ts.map +1 -1
- package/lib/exchange/swap/utils/index.js +96 -20
- package/lib/exchange/swap/utils/index.js.map +1 -1
- package/lib/exchange/swap/utils/index.test.js +95 -48
- package/lib/exchange/swap/utils/index.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/modules/erc1155.d.ts.map +1 -1
- package/lib/families/ethereum/modules/erc1155.js +5 -1
- package/lib/families/ethereum/modules/erc1155.js.map +1 -1
- package/lib/families/ethereum/modules/erc721.d.ts.map +1 -1
- package/lib/families/ethereum/modules/erc721.js +5 -0
- package/lib/families/ethereum/modules/erc721.js.map +1 -1
- package/lib/families/ethereum/nft.unit.test.js +35 -15
- package/lib/families/ethereum/nft.unit.test.js.map +1 -1
- package/lib/families/ethereum/synchronisation.d.ts.map +1 -1
- 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/ethereum/synchronisation.js +17 -13
- package/lib/families/ethereum/synchronisation.js.map +1 -1
- 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/api/chain/account/token.d.ts +1 -1
- package/lib/families/solana/api/chain/account/vote.d.ts +12 -12
- package/lib/families/solana/api/chain/instruction/system/types.d.ts +4 -4
- 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/hw/actions/initSwap.d.ts +4 -3
- package/lib/hw/actions/initSwap.d.ts.map +1 -1
- package/lib/hw/actions/initSwap.js +7 -5
- package/lib/hw/actions/initSwap.js.map +1 -1
- 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/nft/nftOperationId.d.ts +15 -0
- package/lib/nft/nftOperationId.d.ts.map +1 -0
- package/lib/nft/nftOperationId.js +50 -0
- package/lib/nft/nftOperationId.js.map +1 -0
- package/lib/operation.d.ts +1 -1
- package/lib/operation.d.ts.map +1 -1
- package/lib/operation.js +23 -1
- package/lib/operation.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 +14 -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/env.ts +12 -2
- package/src/errors.ts +0 -1
- package/src/exchange/index.ts +7 -0
- package/src/exchange/swap/checkQuote.test.ts +53 -0
- package/src/exchange/swap/checkQuote.ts +34 -0
- package/src/exchange/swap/completeExchange.ts +9 -11
- package/src/exchange/swap/getExchangeRates.test.ts +1 -2
- package/src/exchange/swap/getExchangeRates.ts +5 -3
- package/src/exchange/swap/getProviders.ts +12 -4
- package/src/exchange/swap/getStatus.ts +2 -12
- package/src/exchange/swap/hooks/usePollKYCStatus.test.ts +1 -3
- package/src/exchange/swap/hooks/useProviderRates.test.ts +104 -3
- package/src/exchange/swap/hooks/useProviderRates.ts +57 -9
- package/src/exchange/swap/hooks/useSwapProviders.test.ts +1 -3
- package/src/exchange/swap/hooks/useSwapTransaction.ts +14 -13
- package/src/exchange/swap/hooks/useUpdateMaxAmount.test.ts +33 -7
- package/src/exchange/swap/hooks/useUpdateMaxAmount.ts +13 -7
- package/src/exchange/swap/index.test.ts +36 -0
- package/src/exchange/swap/index.ts +51 -30
- package/src/exchange/swap/initSwap.ts +54 -40
- package/src/exchange/swap/mock.ts +128 -13
- package/src/exchange/swap/postSwapState.ts +61 -0
- package/src/exchange/swap/types.ts +68 -5
- package/src/exchange/swap/updateAccountSwapStatus.ts +4 -4
- package/src/exchange/swap/utils/index.test.ts +127 -63
- package/src/exchange/swap/utils/index.ts +128 -23
- 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/modules/erc1155.ts +12 -5
- package/src/families/ethereum/modules/erc721.ts +11 -0
- package/src/families/ethereum/nft.unit.test.ts +24 -17
- package/src/families/ethereum/{synchronisation.test.ts → synchronisation.integration.test.ts} +1 -1
- package/src/families/ethereum/synchronisation.ts +22 -18
- 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/hw/actions/initSwap.ts +20 -9
- package/src/load/speculos.ts +5 -2
- package/src/nft/nftOperationId.ts +47 -0
- package/src/operation.ts +50 -1
- 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.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.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
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import "../../__tests__/test-helpers/setup";
|
|
2
|
+
import { testBridge } from "../../__tests__/test-helpers/bridge";
|
|
3
|
+
|
|
1
4
|
import invariant from "invariant";
|
|
2
5
|
import { BigNumber } from "bignumber.js";
|
|
3
6
|
import type { AccountRaw, DatasetTest } from "../../types";
|
|
@@ -11,24 +14,7 @@ import type { Transaction } from "./types";
|
|
|
11
14
|
import ethereumScanAccounts1 from "./datasets/ethereum.scanAccounts.1";
|
|
12
15
|
import ethereum_classic from "./datasets/ethereum_classic";
|
|
13
16
|
import { syncAccount } from "../../__tests__/test-helpers/bridge";
|
|
14
|
-
|
|
15
|
-
id: "js:1:ethereum:0x0E3F0bb9516F01f2C34c25E0957518b8aC9414c5:",
|
|
16
|
-
seedIdentifier: "0x0E3F0bb9516F01f2C34c25E0957518b8aC9414c5",
|
|
17
|
-
name: "Ethereum legacy xpub6Bem...JyAdpYZy",
|
|
18
|
-
derivationMode: "",
|
|
19
|
-
index: 0,
|
|
20
|
-
freshAddress: "0x0E3F0bb9516F01f2C34c25E0957518b8aC9414c5",
|
|
21
|
-
freshAddressPath: "44'/60'/0'/0/0",
|
|
22
|
-
freshAddresses: [],
|
|
23
|
-
pendingOperations: [],
|
|
24
|
-
operations: [],
|
|
25
|
-
currencyId: "ethereum",
|
|
26
|
-
unitMagnitude: 18,
|
|
27
|
-
balance: "",
|
|
28
|
-
blockHeight: 0,
|
|
29
|
-
lastSyncDate: "",
|
|
30
|
-
xpub: "",
|
|
31
|
-
};
|
|
17
|
+
import { ethereum1 } from "./datasets/ethereum1";
|
|
32
18
|
|
|
33
19
|
const expectedTokenAccount = (a) => {
|
|
34
20
|
invariant(a && a.type === "TokenAccount", "expected token account");
|
|
@@ -171,4 +157,5 @@ const dataset: DatasetTest<Transaction> = {
|
|
|
171
157
|
ethereum_classic,
|
|
172
158
|
},
|
|
173
159
|
};
|
|
174
|
-
|
|
160
|
+
|
|
161
|
+
testBridge(dataset);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AccountRaw } from "../../../types";
|
|
2
|
+
|
|
3
|
+
export const ethereum1: AccountRaw = {
|
|
4
|
+
id: "js:1:ethereum:0x0E3F0bb9516F01f2C34c25E0957518b8aC9414c5:",
|
|
5
|
+
seedIdentifier: "0x0E3F0bb9516F01f2C34c25E0957518b8aC9414c5",
|
|
6
|
+
name: "Ethereum legacy xpub6Bem...JyAdpYZy",
|
|
7
|
+
derivationMode: "",
|
|
8
|
+
index: 0,
|
|
9
|
+
freshAddress: "0x0E3F0bb9516F01f2C34c25E0957518b8aC9414c5",
|
|
10
|
+
freshAddressPath: "44'/60'/0'/0/0",
|
|
11
|
+
freshAddresses: [],
|
|
12
|
+
pendingOperations: [],
|
|
13
|
+
operations: [],
|
|
14
|
+
currencyId: "ethereum",
|
|
15
|
+
unitMagnitude: 18,
|
|
16
|
+
balance: "",
|
|
17
|
+
blockHeight: 0,
|
|
18
|
+
lastSyncDate: "",
|
|
19
|
+
xpub: "",
|
|
20
|
+
};
|
|
@@ -4,7 +4,7 @@ import { fromAccountRaw } from "../../../account";
|
|
|
4
4
|
import type { Account } from "../../../types";
|
|
5
5
|
import { getAccountBridge } from "../../../bridge";
|
|
6
6
|
import { makeBridgeCacheSystem } from "../../../bridge/cache";
|
|
7
|
-
import { ethereum1 } from "../
|
|
7
|
+
import { ethereum1 } from "../datasets/ethereum1";
|
|
8
8
|
import { setEnv } from "../../../env";
|
|
9
9
|
setEnv("COMPOUND_API", "https://status.ledger.com"); // hack to hit an endpoint that actually is going to 404
|
|
10
10
|
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
} from "@ledgerhq/errors";
|
|
9
9
|
import { validateRecipient } from "../transaction";
|
|
10
10
|
import type { ModeModule, Transaction } from "../types";
|
|
11
|
-
import type { Account } from "../../../types";
|
|
12
11
|
import { prepareTransaction } from "./erc721";
|
|
12
|
+
import { Account } from "../../../types";
|
|
13
13
|
|
|
14
14
|
const NotOwnedNft = createCustomErrorClass("NotOwnedNft");
|
|
15
15
|
const NotEnoughNftOwned = createCustomErrorClass("NotEnoughNftOwned");
|
|
@@ -124,10 +124,17 @@ const erc1155Transfer: ModeModule = {
|
|
|
124
124
|
*/
|
|
125
125
|
fillOptimisticOperation(a, t, op) {
|
|
126
126
|
op.type = "FEES";
|
|
127
|
-
op.
|
|
128
|
-
...op
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
op.nftOperations = t.tokenIds?.map((tokenId, i) => ({
|
|
128
|
+
...op,
|
|
129
|
+
id: "", // operation ID will be filled by patchOperationWithHash
|
|
130
|
+
type: "NFT_OUT",
|
|
131
|
+
senders: [eip55.encode(a.freshAddress)],
|
|
132
|
+
recipients: [eip55.encode(t.recipient)],
|
|
133
|
+
standard: "ERC1155",
|
|
134
|
+
contract: eip55.encode(t.collection ?? ""),
|
|
135
|
+
tokenId,
|
|
136
|
+
value: t.quantities?.[i] || new BigNumber(0),
|
|
137
|
+
}));
|
|
131
138
|
},
|
|
132
139
|
|
|
133
140
|
prepareTransaction,
|
|
@@ -118,6 +118,17 @@ const erc721Transfer: ModeModule = {
|
|
|
118
118
|
*/
|
|
119
119
|
fillOptimisticOperation(a, t, op) {
|
|
120
120
|
op.type = "FEES";
|
|
121
|
+
op.nftOperations = t.tokenIds?.map((tokenId, i) => ({
|
|
122
|
+
...op,
|
|
123
|
+
id: "", // operation ID will be filled by patchOperationWithHash
|
|
124
|
+
type: "NFT_OUT",
|
|
125
|
+
senders: [eip55.encode(a.freshAddress)],
|
|
126
|
+
recipients: [eip55.encode(t.recipient)],
|
|
127
|
+
standard: "ERC721",
|
|
128
|
+
contract: eip55.encode(t.collection ?? ""),
|
|
129
|
+
tokenId,
|
|
130
|
+
value: t.quantities?.[i] || new BigNumber(0),
|
|
131
|
+
}));
|
|
121
132
|
},
|
|
122
133
|
|
|
123
134
|
getResolutionConfig: () => ({ nft: true }),
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
nftsFromOperations,
|
|
14
14
|
} from "../../nft";
|
|
15
15
|
import { Transaction } from "./types";
|
|
16
|
+
import { encodeERC1155OperationId } from "../../nft/nftOperationId";
|
|
16
17
|
|
|
17
18
|
describe("nft merging", () => {
|
|
18
19
|
const makeNFT = (
|
|
@@ -92,18 +93,21 @@ describe("nft merging", () => {
|
|
|
92
93
|
describe("OpenSea lazy minting bs", () => {
|
|
93
94
|
test("should have a correct on-chain nft amount even with OpenSea lazy minting", () => {
|
|
94
95
|
const makeNftOperation = (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
dateOrder: number
|
|
96
|
+
params: [Operation["type"], number],
|
|
97
|
+
index: number
|
|
98
98
|
): Operation => {
|
|
99
|
+
const [type, value] = params;
|
|
100
|
+
|
|
99
101
|
if (!["NFT_IN", "NFT_OUT"].includes(type)) {
|
|
100
102
|
return {} as Operation;
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
const
|
|
105
|
+
const now = Date.now() + index;
|
|
106
|
+
const currencyId = "polygon";
|
|
107
|
+
const accountId = encodeAccountId({
|
|
104
108
|
type: "type",
|
|
105
|
-
currencyId: "polygon",
|
|
106
109
|
xpubOrAddress: "0xbob",
|
|
110
|
+
currencyId,
|
|
107
111
|
derivationMode: "",
|
|
108
112
|
version: "1",
|
|
109
113
|
});
|
|
@@ -112,11 +116,12 @@ describe("OpenSea lazy minting bs", () => {
|
|
|
112
116
|
const contract = "0x0000000000000000000000000000000000000000";
|
|
113
117
|
const fee = new BigNumber(0);
|
|
114
118
|
const tokenId = "42069";
|
|
115
|
-
const hash = "FaKeHasH";
|
|
116
|
-
const date = new Date(
|
|
119
|
+
const hash = "FaKeHasH" + now;
|
|
120
|
+
const date = new Date(now);
|
|
121
|
+
const nftId = encodeNftId(accountId, contract, tokenId, currencyId);
|
|
117
122
|
|
|
118
123
|
return {
|
|
119
|
-
id,
|
|
124
|
+
id: encodeERC1155OperationId(nftId, hash, type),
|
|
120
125
|
hash,
|
|
121
126
|
senders: [sender],
|
|
122
127
|
recipients: [receiver],
|
|
@@ -126,20 +131,22 @@ describe("OpenSea lazy minting bs", () => {
|
|
|
126
131
|
tokenId,
|
|
127
132
|
value: new BigNumber(value),
|
|
128
133
|
type,
|
|
129
|
-
accountId
|
|
134
|
+
accountId,
|
|
130
135
|
date,
|
|
131
136
|
} as Operation;
|
|
132
137
|
};
|
|
133
138
|
|
|
134
139
|
// scenario with bob lazy minting 10 NFTs
|
|
135
|
-
const ops =
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
const ops = (
|
|
141
|
+
[
|
|
142
|
+
["NFT_OUT", 5], // lazy mint sending 5 NFT
|
|
143
|
+
["NFT_IN", 1], // receiving 1 of them back
|
|
144
|
+
["NFT_IN", 2], // receiving 2 of them back
|
|
145
|
+
["NFT_OUT", 2], // lazy mint sending 5 NFT (transformed by OpenSea in 2 txs) 1/2 (off-chain)
|
|
146
|
+
["NFT_OUT", 3], // lazy mint sending 5 NFT (transformed by OpenSea in 2 txs) 2/2 (on-chain)
|
|
147
|
+
["NFT_IN", 1], // receiving 1 back
|
|
148
|
+
] as [Operation["type"], number][]
|
|
149
|
+
).map((params, i) => makeNftOperation(params, i));
|
|
143
150
|
|
|
144
151
|
// What happened for bob:
|
|
145
152
|
//
|
package/src/families/ethereum/{synchronisation.test.ts → synchronisation.integration.test.ts}
RENAMED
|
@@ -5,7 +5,7 @@ import { getAccountCurrency } from "../../account/helpers";
|
|
|
5
5
|
import type { Account, SubAccount } from "../../types";
|
|
6
6
|
import { getAccountBridge } from "../../bridge";
|
|
7
7
|
import { makeBridgeCacheSystem } from "../../bridge/cache";
|
|
8
|
-
import { ethereum1 } from "./
|
|
8
|
+
import { ethereum1 } from "./datasets/ethereum1";
|
|
9
9
|
|
|
10
10
|
describe("blacklistedTokenIds functionality", () => {
|
|
11
11
|
const account = fromAccountRaw(ethereum1);
|
|
@@ -20,6 +20,11 @@ import { API, apiForCurrency, Tx } from "../../api/Ethereum";
|
|
|
20
20
|
import { digestTokenAccounts, prepareTokenAccounts } from "./modules";
|
|
21
21
|
import { findTokenByAddressInCurrency } from "@ledgerhq/cryptoassets";
|
|
22
22
|
import { encodeNftId, isNFTActive, nftsFromOperations } from "../../nft";
|
|
23
|
+
import { encodeOperationId } from "../../operation";
|
|
24
|
+
import {
|
|
25
|
+
encodeERC1155OperationId,
|
|
26
|
+
encodeERC721OperationId,
|
|
27
|
+
} from "../../nft/nftOperationId";
|
|
23
28
|
|
|
24
29
|
export const getAccountShape: GetAccountShape = async (
|
|
25
30
|
infoInput,
|
|
@@ -167,7 +172,9 @@ export const getAccountShape: GetAccountShape = async (
|
|
|
167
172
|
const nfts = isNFTActive(currency)
|
|
168
173
|
? mergeNfts(
|
|
169
174
|
initialAccount?.nfts || [],
|
|
170
|
-
nftsFromOperations(
|
|
175
|
+
nftsFromOperations(
|
|
176
|
+
mergeOps(operations, initialAccount?.pendingOperations || [])
|
|
177
|
+
).filter((n) => n.amount.gt(0))
|
|
171
178
|
)
|
|
172
179
|
: undefined;
|
|
173
180
|
|
|
@@ -289,7 +296,7 @@ const txToOps =
|
|
|
289
296
|
if (sending) {
|
|
290
297
|
const type = "OUT";
|
|
291
298
|
all.push({
|
|
292
|
-
id:
|
|
299
|
+
id: encodeOperationId(accountId, hash, type),
|
|
293
300
|
hash,
|
|
294
301
|
type,
|
|
295
302
|
value,
|
|
@@ -308,7 +315,7 @@ const txToOps =
|
|
|
308
315
|
if (receiving) {
|
|
309
316
|
const type = "IN";
|
|
310
317
|
all.push({
|
|
311
|
-
id:
|
|
318
|
+
id: encodeOperationId(accountId, hash, type),
|
|
312
319
|
hash,
|
|
313
320
|
type,
|
|
314
321
|
value,
|
|
@@ -349,7 +356,7 @@ const txToOps =
|
|
|
349
356
|
if (sending) {
|
|
350
357
|
const type = "NFT_OUT";
|
|
351
358
|
all.push({
|
|
352
|
-
id:
|
|
359
|
+
id: encodeERC721OperationId(nftId, hash, type),
|
|
353
360
|
senders: [sender],
|
|
354
361
|
recipients: [receiver],
|
|
355
362
|
contract,
|
|
@@ -371,7 +378,7 @@ const txToOps =
|
|
|
371
378
|
if (receiving) {
|
|
372
379
|
const type = "NFT_IN";
|
|
373
380
|
all.push({
|
|
374
|
-
id:
|
|
381
|
+
id: encodeERC721OperationId(nftId, hash, type),
|
|
375
382
|
senders: [sender],
|
|
376
383
|
recipients: [receiver],
|
|
377
384
|
contract,
|
|
@@ -414,17 +421,12 @@ const txToOps =
|
|
|
414
421
|
event.transfers.forEach((transfer, j) => {
|
|
415
422
|
const tokenId = transfer.id;
|
|
416
423
|
const value = new BigNumber(transfer.value);
|
|
417
|
-
const nftId = encodeNftId(
|
|
418
|
-
id,
|
|
419
|
-
event.contract,
|
|
420
|
-
tokenId,
|
|
421
|
-
currency.id
|
|
422
|
-
);
|
|
424
|
+
const nftId = encodeNftId(id, contract, tokenId, currency.id);
|
|
423
425
|
|
|
424
426
|
if (sending) {
|
|
425
427
|
const type = "NFT_OUT";
|
|
426
428
|
all.push({
|
|
427
|
-
id:
|
|
429
|
+
id: encodeERC1155OperationId(nftId, hash, type, i, j),
|
|
428
430
|
senders: [sender],
|
|
429
431
|
recipients: [receiver],
|
|
430
432
|
contract,
|
|
@@ -447,7 +449,7 @@ const txToOps =
|
|
|
447
449
|
if (receiving) {
|
|
448
450
|
const type = "NFT_IN";
|
|
449
451
|
all.push({
|
|
450
|
-
id:
|
|
452
|
+
id: encodeERC1155OperationId(nftId, hash, type, i, j),
|
|
451
453
|
senders: [sender],
|
|
452
454
|
recipients: [receiver],
|
|
453
455
|
contract,
|
|
@@ -481,7 +483,7 @@ const txToOps =
|
|
|
481
483
|
if (sending) {
|
|
482
484
|
const type = value.eq(0) ? "FEES" : "OUT";
|
|
483
485
|
ops.push({
|
|
484
|
-
id:
|
|
486
|
+
id: encodeOperationId(id, hash, type),
|
|
485
487
|
hash,
|
|
486
488
|
type,
|
|
487
489
|
value: hasFailed ? new BigNumber(fee) : value.plus(fee),
|
|
@@ -502,10 +504,11 @@ const txToOps =
|
|
|
502
504
|
}
|
|
503
505
|
|
|
504
506
|
if (receiving) {
|
|
507
|
+
const type = "IN";
|
|
505
508
|
ops.push({
|
|
506
|
-
id:
|
|
509
|
+
id: encodeOperationId(id, hash, type),
|
|
507
510
|
hash: hash,
|
|
508
|
-
type
|
|
511
|
+
type,
|
|
509
512
|
value,
|
|
510
513
|
fee,
|
|
511
514
|
blockHeight,
|
|
@@ -531,10 +534,11 @@ const txToOps =
|
|
|
531
534
|
subOperations.length ||
|
|
532
535
|
nftOperations.length)
|
|
533
536
|
) {
|
|
537
|
+
const type = "NONE";
|
|
534
538
|
ops.push({
|
|
535
|
-
id:
|
|
539
|
+
id: encodeOperationId(id, hash, type),
|
|
536
540
|
hash: hash,
|
|
537
|
-
type
|
|
541
|
+
type,
|
|
538
542
|
value: new BigNumber(0),
|
|
539
543
|
fee,
|
|
540
544
|
blockHeight,
|
package/src/families/filecoin/__snapshots__/{bridge.test.ts.snap → bridge.integration.test.ts.snap}
RENAMED
|
File without changes
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import "../../__tests__/test-helpers/setup";
|
|
2
|
+
import { testBridge } from "../../__tests__/test-helpers/bridge";
|
|
3
|
+
import { getAccountBridge } from "../../bridge";
|
|
4
|
+
import {
|
|
5
|
+
decodeAccountId,
|
|
6
|
+
encodeAccountId,
|
|
7
|
+
fromAccountRaw,
|
|
8
|
+
} from "../../account";
|
|
1
9
|
import { BigNumber } from "bignumber.js";
|
|
2
10
|
import {
|
|
3
11
|
AmountRequired,
|
|
4
12
|
InvalidAddress,
|
|
5
13
|
NotEnoughBalance,
|
|
6
14
|
} from "@ledgerhq/errors";
|
|
7
|
-
|
|
8
15
|
import type { DatasetTest } from "../../types";
|
|
9
16
|
import type { Transaction } from "./types";
|
|
10
17
|
import { fromTransactionRaw } from "../filecoin/transaction";
|
|
@@ -13,7 +20,6 @@ import { CurrenciesData } from "../../types";
|
|
|
13
20
|
const SEED_IDENTIFIER = "f1p74d4mlmeyc4agflhjqsnvoyzyfdai7fmkyso2a";
|
|
14
21
|
const ACCOUNT_1 = "f1p74d4mlmeyc4agflhjqsnvoyzyfdai7fmkyso2a";
|
|
15
22
|
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
23
|
const filecoin: CurrenciesData<Transaction> = {
|
|
18
24
|
FIXME_ignoreAccountFields: [],
|
|
19
25
|
scanAccounts: [
|
|
@@ -150,4 +156,30 @@ const dataset: DatasetTest<Transaction> = {
|
|
|
150
156
|
filecoin,
|
|
151
157
|
},
|
|
152
158
|
};
|
|
153
|
-
|
|
159
|
+
|
|
160
|
+
testBridge(dataset);
|
|
161
|
+
|
|
162
|
+
describe("estimateMaxSpendable", () => {
|
|
163
|
+
test("it should failed on invalid recipient", async () => {
|
|
164
|
+
const accounts = dataset.currencies["filecoin"].accounts || [];
|
|
165
|
+
const accountData = accounts[0];
|
|
166
|
+
|
|
167
|
+
const account = fromAccountRaw({
|
|
168
|
+
...accountData.raw,
|
|
169
|
+
id: encodeAccountId({
|
|
170
|
+
...decodeAccountId(accountData.raw.id),
|
|
171
|
+
type: dataset.implementations[0],
|
|
172
|
+
}),
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
const accountBridge = getAccountBridge(account);
|
|
176
|
+
const estimate = async () => {
|
|
177
|
+
await accountBridge.estimateMaxSpendable({
|
|
178
|
+
account,
|
|
179
|
+
transaction: { recipient: "notavalidrecipient" },
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
await expect(estimate).rejects.toThrowError(new InvalidAddress());
|
|
184
|
+
});
|
|
185
|
+
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "../../__tests__/test-helpers/setup";
|
|
2
|
+
import { testBridge } from "../../__tests__/test-helpers/bridge";
|
|
1
3
|
import type { CurrenciesData, DatasetTest } from "../../types";
|
|
2
4
|
import type { Transaction } from "./types";
|
|
3
5
|
import {
|
|
@@ -88,7 +90,8 @@ const hedera: CurrenciesData<Transaction> = {
|
|
|
88
90
|
const dataset: DatasetTest<Transaction> = {
|
|
89
91
|
implementations: ["js"],
|
|
90
92
|
currencies: {
|
|
91
|
-
|
|
93
|
+
hedera,
|
|
92
94
|
},
|
|
93
95
|
};
|
|
94
|
-
|
|
96
|
+
|
|
97
|
+
testBridge(dataset);
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import "../../__tests__/test-helpers/setup";
|
|
2
|
+
import { testBridge } from "../../__tests__/test-helpers/bridge";
|
|
3
|
+
import { disconnect } from "./api";
|
|
1
4
|
import { BigNumber } from "bignumber.js";
|
|
5
|
+
import { canUnbond, MAX_UNLOCKINGS } from "./logic";
|
|
6
|
+
import type { Account } from "../../types";
|
|
2
7
|
import {
|
|
3
8
|
NotEnoughBalance,
|
|
4
9
|
RecipientRequired,
|
|
@@ -15,7 +20,7 @@ import {
|
|
|
15
20
|
PolkadotAllFundsWarning,
|
|
16
21
|
PolkadotDoMaxSendInstead,
|
|
17
22
|
} from "./errors";
|
|
18
|
-
import type { DatasetTest } from "../../types";
|
|
23
|
+
import type { DatasetTest, CurrenciesData } from "../../types";
|
|
19
24
|
import { fromTransactionRaw } from "./transaction";
|
|
20
25
|
import type { Transaction } from "./types";
|
|
21
26
|
const ACCOUNT_SAME_STASHCONTROLLER =
|
|
@@ -26,8 +31,7 @@ const ACCOUNT_EMPTY = "111111111111111111111111111111111HC1";
|
|
|
26
31
|
const ACCOUNT_WITH_NO_OPERATION =
|
|
27
32
|
"12EsPA79dvhtjp1bYvCiEWPsQmmdKGss44GzE3CT9tTo9g4Q";
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
const polkadot = {
|
|
34
|
+
const polkadot: CurrenciesData<Transaction> = {
|
|
31
35
|
FIXME_ignoreAccountFields: [
|
|
32
36
|
"polkadotResources.unlockings", // Due to completion date that change everyday (estimated time)
|
|
33
37
|
"polkadotResources.nominations", // TODO: try to only ignore status
|
|
@@ -685,7 +689,79 @@ const polkadot = {
|
|
|
685
689
|
const dataset: DatasetTest<Transaction> = {
|
|
686
690
|
implementations: ["js"],
|
|
687
691
|
currencies: {
|
|
688
|
-
|
|
692
|
+
polkadot,
|
|
689
693
|
},
|
|
690
694
|
};
|
|
691
|
-
|
|
695
|
+
|
|
696
|
+
// Disconnect all api clients that could be open.
|
|
697
|
+
afterAll(async () => {
|
|
698
|
+
await disconnect();
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
testBridge(dataset);
|
|
702
|
+
|
|
703
|
+
describe("canUnbond", () => {
|
|
704
|
+
test("can unbond", () => {
|
|
705
|
+
const account: Partial<Account> = {
|
|
706
|
+
polkadotResources: {
|
|
707
|
+
controller: "",
|
|
708
|
+
stash: "",
|
|
709
|
+
nonce: 0,
|
|
710
|
+
numSlashingSpans: 0,
|
|
711
|
+
lockedBalance: new BigNumber(10000),
|
|
712
|
+
unlockedBalance: new BigNumber(0),
|
|
713
|
+
unlockingBalance: new BigNumber(0),
|
|
714
|
+
nominations: [],
|
|
715
|
+
unlockings: [
|
|
716
|
+
...Array(MAX_UNLOCKINGS - 1).map(() => ({
|
|
717
|
+
amount: new BigNumber(Math.random()),
|
|
718
|
+
completionDate: new Date(),
|
|
719
|
+
})),
|
|
720
|
+
],
|
|
721
|
+
},
|
|
722
|
+
};
|
|
723
|
+
expect(canUnbond(account as Account)).toBeTruthy();
|
|
724
|
+
});
|
|
725
|
+
test("can't unbond because unlockings is too much", () => {
|
|
726
|
+
const account: Partial<Account> = {
|
|
727
|
+
polkadotResources: {
|
|
728
|
+
controller: "",
|
|
729
|
+
stash: "",
|
|
730
|
+
nonce: 0,
|
|
731
|
+
numSlashingSpans: 0,
|
|
732
|
+
lockedBalance: new BigNumber(1000000),
|
|
733
|
+
unlockedBalance: new BigNumber(0),
|
|
734
|
+
unlockingBalance: new BigNumber(0),
|
|
735
|
+
nominations: [],
|
|
736
|
+
unlockings: [
|
|
737
|
+
...Array(MAX_UNLOCKINGS).map(() => ({
|
|
738
|
+
amount: new BigNumber(Math.random()),
|
|
739
|
+
completionDate: new Date(),
|
|
740
|
+
})),
|
|
741
|
+
],
|
|
742
|
+
},
|
|
743
|
+
};
|
|
744
|
+
expect(canUnbond(account as Account)).toBeFalsy();
|
|
745
|
+
});
|
|
746
|
+
test("can't unbond because not enough lockedBalance", () => {
|
|
747
|
+
const account: Partial<Account> = {
|
|
748
|
+
polkadotResources: {
|
|
749
|
+
controller: "",
|
|
750
|
+
stash: "",
|
|
751
|
+
nonce: 0,
|
|
752
|
+
numSlashingSpans: 0,
|
|
753
|
+
lockedBalance: new BigNumber(100),
|
|
754
|
+
unlockedBalance: new BigNumber(0),
|
|
755
|
+
unlockingBalance: new BigNumber(100),
|
|
756
|
+
nominations: [],
|
|
757
|
+
unlockings: [
|
|
758
|
+
...Array(MAX_UNLOCKINGS).map(() => ({
|
|
759
|
+
amount: new BigNumber(Math.random()),
|
|
760
|
+
completionDate: new Date(),
|
|
761
|
+
})),
|
|
762
|
+
],
|
|
763
|
+
},
|
|
764
|
+
};
|
|
765
|
+
expect(canUnbond(account as Account)).toBeFalsy();
|
|
766
|
+
});
|
|
767
|
+
});
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import "../../__tests__/test-helpers/setup";
|
|
2
|
+
import { testBridge } from "../../__tests__/test-helpers/bridge";
|
|
3
|
+
|
|
1
4
|
// import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
2
5
|
import { BigNumber } from "bignumber.js";
|
|
3
6
|
import type { DatasetTest } from "../../types";
|
|
@@ -160,4 +163,5 @@ const dataset: DatasetTest<Transaction> = {
|
|
|
160
163
|
},
|
|
161
164
|
},
|
|
162
165
|
};
|
|
163
|
-
|
|
166
|
+
|
|
167
|
+
testBridge(dataset);
|
package/src/families/solana/__snapshots__/{bridge.test.ts.snap → bridge.integration.test.ts.snap}
RENAMED
|
File without changes
|