@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
|
@@ -10,6 +10,42 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
13
49
|
var __read = (this && this.__read) || function (o, n) {
|
|
14
50
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
51
|
if (!m) return o;
|
|
@@ -35,11 +71,23 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
35
71
|
}
|
|
36
72
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
73
|
};
|
|
74
|
+
var __values = (this && this.__values) || function(o) {
|
|
75
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
76
|
+
if (m) return m.call(o);
|
|
77
|
+
if (o && typeof o.length === "number") return {
|
|
78
|
+
next: function () {
|
|
79
|
+
if (o && i >= o.length) o = void 0;
|
|
80
|
+
return { value: o && o[i++], done: !o };
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
84
|
+
};
|
|
38
85
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
86
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
87
|
};
|
|
41
88
|
exports.__esModule = true;
|
|
42
|
-
|
|
89
|
+
require("../../__tests__/test-helpers/setup");
|
|
90
|
+
var bridge_1 = require("../../__tests__/test-helpers/bridge");
|
|
43
91
|
var bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
44
92
|
var types_1 = require("../../types");
|
|
45
93
|
var solana_scanAccounts_1_1 = __importDefault(require("./datasets/solana.scanAccounts.1"));
|
|
@@ -50,8 +98,11 @@ var js_createTransaction_1 = __importDefault(require("./js-createTransaction"));
|
|
|
50
98
|
var fp_1 = require("lodash/fp");
|
|
51
99
|
var utils_1 = require("./utils");
|
|
52
100
|
var env_1 = require("../../env");
|
|
101
|
+
var errors_3 = require("./errors");
|
|
102
|
+
var js_getTransactionStatus_1 = __importDefault(require("./js-getTransactionStatus"));
|
|
103
|
+
var js_prepareTransaction_1 = require("./js-prepareTransaction");
|
|
53
104
|
// do not change real properties or the test will break
|
|
54
|
-
|
|
105
|
+
var testOnChainData = {
|
|
55
106
|
// --- real props ---
|
|
56
107
|
unfundedAddress: "7b6Q3ap8qRzfyvDw1Qce3fUV8C7WgFNzJQwYNTJm3KQo",
|
|
57
108
|
// 0/0
|
|
@@ -78,13 +129,13 @@ var mainAccId = (0, types_1.encodeAccountId)({
|
|
|
78
129
|
type: "js",
|
|
79
130
|
version: "2",
|
|
80
131
|
currencyId: "solana",
|
|
81
|
-
xpubOrAddress:
|
|
132
|
+
xpubOrAddress: testOnChainData.fundedSenderAddress,
|
|
82
133
|
derivationMode: "solanaMain"
|
|
83
134
|
});
|
|
84
135
|
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
85
|
-
var wSolSubAccId = (0, logic_1.encodeAccountIdWithTokenAccountAddress)(mainAccId,
|
|
136
|
+
var wSolSubAccId = (0, logic_1.encodeAccountIdWithTokenAccountAddress)(mainAccId, testOnChainData.wSolSenderAssocTokenAccAddress);
|
|
86
137
|
var fees = function (signatureCount) {
|
|
87
|
-
return new bignumber_js_1["default"](signatureCount *
|
|
138
|
+
return new bignumber_js_1["default"](signatureCount * testOnChainData.fees.lamportsPerSignature);
|
|
88
139
|
};
|
|
89
140
|
var zero = new bignumber_js_1["default"](0);
|
|
90
141
|
var solana = {
|
|
@@ -94,7 +145,7 @@ var solana = {
|
|
|
94
145
|
FIXME_ignorePreloadFields: ["validators"],
|
|
95
146
|
accounts: [
|
|
96
147
|
{
|
|
97
|
-
raw: makeAccount(
|
|
148
|
+
raw: makeAccount(testOnChainData.fundedSenderAddress),
|
|
98
149
|
/*
|
|
99
150
|
Solana integration is written in such a way that requires
|
|
100
151
|
prepareTransaction to be called before any meaningfull status
|
|
@@ -196,7 +247,7 @@ function recipientNotValid() {
|
|
|
196
247
|
}
|
|
197
248
|
function recipientIsSameAsSender() {
|
|
198
249
|
return recipientRequired().map(function (spec) {
|
|
199
|
-
return __assign(__assign({}, spec), { transaction: __assign(__assign({}, spec.transaction), { recipient:
|
|
250
|
+
return __assign(__assign({}, spec), { transaction: __assign(__assign({}, spec.transaction), { recipient: testOnChainData.fundedSenderAddress }), expectedStatus: __assign(__assign({}, spec.expectedStatus), { errors: {
|
|
200
251
|
recipient: new errors_1.InvalidAddressBecauseDestinationIsAlsoSource()
|
|
201
252
|
} }) });
|
|
202
253
|
});
|
|
@@ -208,7 +259,7 @@ function memoIsTooLong() {
|
|
|
208
259
|
case "transfer":
|
|
209
260
|
case "token.transfer":
|
|
210
261
|
tx.model.uiState.memo = "c".repeat(logic_1.MAX_MEMO_LENGTH + 1);
|
|
211
|
-
return __assign(__assign({}, spec), { transaction: __assign(__assign({}, spec.transaction), { recipient:
|
|
262
|
+
return __assign(__assign({}, spec), { transaction: __assign(__assign({}, spec.transaction), { recipient: testOnChainData.fundedAddress }), expectedStatus: __assign(__assign({}, spec.expectedStatus), { errors: {
|
|
212
263
|
memo: new errors_2.SolanaMemoIsTooLong()
|
|
213
264
|
} }) });
|
|
214
265
|
case "token.createATA":
|
|
@@ -232,16 +283,16 @@ function transferTests() {
|
|
|
232
283
|
kind: "transfer",
|
|
233
284
|
uiState: {}
|
|
234
285
|
},
|
|
235
|
-
amount:
|
|
236
|
-
recipient:
|
|
286
|
+
amount: testOnChainData.fundedSenderBalance.dividedBy(2),
|
|
287
|
+
recipient: testOnChainData.fundedAddress,
|
|
237
288
|
family: "solana"
|
|
238
289
|
},
|
|
239
290
|
expectedStatus: {
|
|
240
291
|
errors: {},
|
|
241
292
|
warnings: {},
|
|
242
293
|
estimatedFees: fees(1),
|
|
243
|
-
amount:
|
|
244
|
-
totalSpent:
|
|
294
|
+
amount: testOnChainData.fundedSenderBalance.dividedBy(2),
|
|
295
|
+
totalSpent: testOnChainData.fundedSenderBalance
|
|
245
296
|
.dividedBy(2)
|
|
246
297
|
.plus(fees(1))
|
|
247
298
|
}
|
|
@@ -255,15 +306,15 @@ function transferTests() {
|
|
|
255
306
|
},
|
|
256
307
|
useAllAmount: true,
|
|
257
308
|
amount: zero,
|
|
258
|
-
recipient:
|
|
309
|
+
recipient: testOnChainData.fundedAddress,
|
|
259
310
|
family: "solana"
|
|
260
311
|
},
|
|
261
312
|
expectedStatus: {
|
|
262
313
|
errors: {},
|
|
263
314
|
warnings: {},
|
|
264
315
|
estimatedFees: fees(1),
|
|
265
|
-
amount:
|
|
266
|
-
totalSpent:
|
|
316
|
+
amount: testOnChainData.fundedSenderBalance.minus(fees(1)),
|
|
317
|
+
totalSpent: testOnChainData.fundedSenderBalance
|
|
267
318
|
}
|
|
268
319
|
},
|
|
269
320
|
{
|
|
@@ -273,8 +324,8 @@ function transferTests() {
|
|
|
273
324
|
kind: "transfer",
|
|
274
325
|
uiState: {}
|
|
275
326
|
},
|
|
276
|
-
amount:
|
|
277
|
-
recipient:
|
|
327
|
+
amount: testOnChainData.fundedSenderBalance,
|
|
328
|
+
recipient: testOnChainData.fundedAddress,
|
|
278
329
|
family: "solana"
|
|
279
330
|
},
|
|
280
331
|
expectedStatus: {
|
|
@@ -283,8 +334,8 @@ function transferTests() {
|
|
|
283
334
|
},
|
|
284
335
|
warnings: {},
|
|
285
336
|
estimatedFees: fees(1),
|
|
286
|
-
amount:
|
|
287
|
-
totalSpent:
|
|
337
|
+
amount: testOnChainData.fundedSenderBalance,
|
|
338
|
+
totalSpent: testOnChainData.fundedSenderBalance.plus(fees(1))
|
|
288
339
|
}
|
|
289
340
|
},
|
|
290
341
|
{
|
|
@@ -295,7 +346,7 @@ function transferTests() {
|
|
|
295
346
|
uiState: {}
|
|
296
347
|
},
|
|
297
348
|
amount: zero,
|
|
298
|
-
recipient:
|
|
349
|
+
recipient: testOnChainData.fundedAddress,
|
|
299
350
|
family: "solana"
|
|
300
351
|
},
|
|
301
352
|
expectedStatus: {
|
|
@@ -316,7 +367,7 @@ function transferTests() {
|
|
|
316
367
|
uiState: {}
|
|
317
368
|
},
|
|
318
369
|
amount: new bignumber_js_1["default"](-1),
|
|
319
|
-
recipient:
|
|
370
|
+
recipient: testOnChainData.fundedAddress,
|
|
320
371
|
family: "solana"
|
|
321
372
|
},
|
|
322
373
|
expectedStatus: {
|
|
@@ -337,7 +388,7 @@ function transferTests() {
|
|
|
337
388
|
uiState: {}
|
|
338
389
|
},
|
|
339
390
|
amount: new bignumber_js_1["default"](1),
|
|
340
|
-
recipient:
|
|
391
|
+
recipient: testOnChainData.unfundedAddress,
|
|
341
392
|
family: "solana"
|
|
342
393
|
},
|
|
343
394
|
expectedStatus: {
|
|
@@ -358,7 +409,7 @@ function transferTests() {
|
|
|
358
409
|
uiState: {}
|
|
359
410
|
},
|
|
360
411
|
amount: new bignumber_js_1["default"](1),
|
|
361
|
-
recipient:
|
|
412
|
+
recipient: testOnChainData.offEd25519Address,
|
|
362
413
|
family: "solana"
|
|
363
414
|
},
|
|
364
415
|
expectedStatus: {
|
|
@@ -387,16 +438,16 @@ function tokenTests() {
|
|
|
387
438
|
subAccountId: wSolSubAccId
|
|
388
439
|
}
|
|
389
440
|
},
|
|
390
|
-
amount:
|
|
391
|
-
recipient:
|
|
441
|
+
amount: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
442
|
+
recipient: testOnChainData.fundedAddress,
|
|
392
443
|
family: "solana"
|
|
393
444
|
},
|
|
394
445
|
expectedStatus: {
|
|
395
446
|
errors: {},
|
|
396
447
|
warnings: {},
|
|
397
448
|
estimatedFees: fees(1),
|
|
398
|
-
amount:
|
|
399
|
-
totalSpent:
|
|
449
|
+
amount: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
450
|
+
totalSpent: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2)
|
|
400
451
|
}
|
|
401
452
|
},
|
|
402
453
|
{
|
|
@@ -408,16 +459,16 @@ function tokenTests() {
|
|
|
408
459
|
subAccountId: wSolSubAccId
|
|
409
460
|
}
|
|
410
461
|
},
|
|
411
|
-
amount:
|
|
412
|
-
recipient:
|
|
462
|
+
amount: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
463
|
+
recipient: testOnChainData.wSolFundedAccountAssocTokenAccAddress,
|
|
413
464
|
family: "solana"
|
|
414
465
|
},
|
|
415
466
|
expectedStatus: {
|
|
416
467
|
errors: {},
|
|
417
468
|
warnings: {},
|
|
418
469
|
estimatedFees: fees(1),
|
|
419
|
-
amount:
|
|
420
|
-
totalSpent:
|
|
470
|
+
amount: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
471
|
+
totalSpent: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2)
|
|
421
472
|
}
|
|
422
473
|
},
|
|
423
474
|
{
|
|
@@ -429,8 +480,8 @@ function tokenTests() {
|
|
|
429
480
|
subAccountId: wSolSubAccId
|
|
430
481
|
}
|
|
431
482
|
},
|
|
432
|
-
amount:
|
|
433
|
-
recipient:
|
|
483
|
+
amount: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
484
|
+
recipient: testOnChainData.notWSolTokenAccAddress,
|
|
434
485
|
family: "solana"
|
|
435
486
|
},
|
|
436
487
|
expectedStatus: {
|
|
@@ -439,7 +490,7 @@ function tokenTests() {
|
|
|
439
490
|
},
|
|
440
491
|
warnings: {},
|
|
441
492
|
estimatedFees: fees(1),
|
|
442
|
-
amount:
|
|
493
|
+
amount: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
443
494
|
totalSpent: zero
|
|
444
495
|
}
|
|
445
496
|
},
|
|
@@ -452,8 +503,8 @@ function tokenTests() {
|
|
|
452
503
|
subAccountId: wSolSubAccId
|
|
453
504
|
}
|
|
454
505
|
},
|
|
455
|
-
amount:
|
|
456
|
-
recipient:
|
|
506
|
+
amount: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
507
|
+
recipient: testOnChainData.offEd25519Address,
|
|
457
508
|
family: "solana"
|
|
458
509
|
},
|
|
459
510
|
expectedStatus: {
|
|
@@ -462,7 +513,7 @@ function tokenTests() {
|
|
|
462
513
|
},
|
|
463
514
|
warnings: {},
|
|
464
515
|
estimatedFees: fees(1),
|
|
465
|
-
amount:
|
|
516
|
+
amount: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
466
517
|
totalSpent: zero
|
|
467
518
|
}
|
|
468
519
|
},
|
|
@@ -475,8 +526,8 @@ function tokenTests() {
|
|
|
475
526
|
subAccountId: wSolSubAccId
|
|
476
527
|
}
|
|
477
528
|
},
|
|
478
|
-
amount:
|
|
479
|
-
recipient:
|
|
529
|
+
amount: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
530
|
+
recipient: testOnChainData.unfundedAddress,
|
|
480
531
|
family: "solana"
|
|
481
532
|
},
|
|
482
533
|
expectedStatus: {
|
|
@@ -487,8 +538,8 @@ function tokenTests() {
|
|
|
487
538
|
},
|
|
488
539
|
// this fee is dynamic, skip
|
|
489
540
|
//estimatedFees: new BigNumber(2044280),
|
|
490
|
-
amount:
|
|
491
|
-
totalSpent:
|
|
541
|
+
amount: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
542
|
+
totalSpent: testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2)
|
|
492
543
|
}
|
|
493
544
|
},
|
|
494
545
|
];
|
|
@@ -502,7 +553,7 @@ function stakingTests() {
|
|
|
502
553
|
model: {
|
|
503
554
|
kind: "stake.createAccount",
|
|
504
555
|
uiState: {
|
|
505
|
-
delegate: { voteAccAddress:
|
|
556
|
+
delegate: { voteAccAddress: testOnChainData.validatorAddress }
|
|
506
557
|
}
|
|
507
558
|
},
|
|
508
559
|
recipient: "",
|
|
@@ -510,7 +561,7 @@ function stakingTests() {
|
|
|
510
561
|
},
|
|
511
562
|
expectedStatus: {
|
|
512
563
|
amount: new bignumber_js_1["default"](-1),
|
|
513
|
-
estimatedFees: fees(1).plus(
|
|
564
|
+
estimatedFees: fees(1).plus(testOnChainData.fees.stakeAccountRentExempt),
|
|
514
565
|
totalSpent: zero,
|
|
515
566
|
errors: {
|
|
516
567
|
amount: new errors_1.AmountRequired()
|
|
@@ -524,7 +575,7 @@ function stakingTests() {
|
|
|
524
575
|
model: {
|
|
525
576
|
kind: "stake.createAccount",
|
|
526
577
|
uiState: {
|
|
527
|
-
delegate: { voteAccAddress:
|
|
578
|
+
delegate: { voteAccAddress: testOnChainData.validatorAddress }
|
|
528
579
|
}
|
|
529
580
|
},
|
|
530
581
|
recipient: "",
|
|
@@ -532,8 +583,8 @@ function stakingTests() {
|
|
|
532
583
|
},
|
|
533
584
|
expectedStatus: {
|
|
534
585
|
amount: zero,
|
|
535
|
-
estimatedFees: fees(1).plus(
|
|
536
|
-
totalSpent: fees(1).plus(
|
|
586
|
+
estimatedFees: fees(1).plus(testOnChainData.fees.stakeAccountRentExempt),
|
|
587
|
+
totalSpent: fees(1).plus(testOnChainData.fees.stakeAccountRentExempt),
|
|
537
588
|
errors: {
|
|
538
589
|
amount: new errors_1.AmountRequired()
|
|
539
590
|
}
|
|
@@ -546,18 +597,18 @@ function stakingTests() {
|
|
|
546
597
|
model: {
|
|
547
598
|
kind: "stake.createAccount",
|
|
548
599
|
uiState: {
|
|
549
|
-
delegate: { voteAccAddress:
|
|
600
|
+
delegate: { voteAccAddress: testOnChainData.validatorAddress }
|
|
550
601
|
}
|
|
551
602
|
},
|
|
552
603
|
recipient: "",
|
|
553
|
-
amount:
|
|
604
|
+
amount: testOnChainData.fundedSenderBalance
|
|
554
605
|
},
|
|
555
606
|
expectedStatus: {
|
|
556
|
-
amount:
|
|
557
|
-
estimatedFees: fees(1).plus(
|
|
607
|
+
amount: testOnChainData.fundedSenderBalance,
|
|
608
|
+
estimatedFees: fees(1).plus(testOnChainData.fees.stakeAccountRentExempt),
|
|
558
609
|
totalSpent: fees(1)
|
|
559
|
-
.plus(
|
|
560
|
-
.plus(
|
|
610
|
+
.plus(testOnChainData.fees.stakeAccountRentExempt)
|
|
611
|
+
.plus(testOnChainData.fundedSenderBalance),
|
|
561
612
|
errors: {
|
|
562
613
|
amount: new errors_1.NotEnoughBalance()
|
|
563
614
|
}
|
|
@@ -578,9 +629,9 @@ function stakingTests() {
|
|
|
578
629
|
},
|
|
579
630
|
expectedStatus: {
|
|
580
631
|
amount: new bignumber_js_1["default"](1),
|
|
581
|
-
estimatedFees: fees(1).plus(
|
|
632
|
+
estimatedFees: fees(1).plus(testOnChainData.fees.stakeAccountRentExempt),
|
|
582
633
|
totalSpent: fees(1)
|
|
583
|
-
.plus(
|
|
634
|
+
.plus(testOnChainData.fees.stakeAccountRentExempt)
|
|
584
635
|
.plus(1),
|
|
585
636
|
errors: {
|
|
586
637
|
voteAccAddr: new errors_2.SolanaValidatorRequired()
|
|
@@ -602,9 +653,9 @@ function stakingTests() {
|
|
|
602
653
|
},
|
|
603
654
|
expectedStatus: {
|
|
604
655
|
amount: new bignumber_js_1["default"](1),
|
|
605
|
-
estimatedFees: fees(1).plus(
|
|
656
|
+
estimatedFees: fees(1).plus(testOnChainData.fees.stakeAccountRentExempt),
|
|
606
657
|
totalSpent: fees(1)
|
|
607
|
-
.plus(
|
|
658
|
+
.plus(testOnChainData.fees.stakeAccountRentExempt)
|
|
608
659
|
.plus(1),
|
|
609
660
|
errors: {
|
|
610
661
|
voteAccAddr: new errors_1.InvalidAddress()
|
|
@@ -618,7 +669,7 @@ function stakingTests() {
|
|
|
618
669
|
model: {
|
|
619
670
|
kind: "stake.createAccount",
|
|
620
671
|
uiState: {
|
|
621
|
-
delegate: { voteAccAddress:
|
|
672
|
+
delegate: { voteAccAddress: testOnChainData.fundedSenderAddress }
|
|
622
673
|
}
|
|
623
674
|
},
|
|
624
675
|
recipient: "",
|
|
@@ -626,9 +677,9 @@ function stakingTests() {
|
|
|
626
677
|
},
|
|
627
678
|
expectedStatus: {
|
|
628
679
|
amount: new bignumber_js_1["default"](1),
|
|
629
|
-
estimatedFees: fees(1).plus(
|
|
680
|
+
estimatedFees: fees(1).plus(testOnChainData.fees.stakeAccountRentExempt),
|
|
630
681
|
totalSpent: fees(1)
|
|
631
|
-
.plus(
|
|
682
|
+
.plus(testOnChainData.fees.stakeAccountRentExempt)
|
|
632
683
|
.plus(1),
|
|
633
684
|
errors: {
|
|
634
685
|
voteAccAddr: new errors_2.SolanaInvalidValidator()
|
|
@@ -642,7 +693,7 @@ function stakingTests() {
|
|
|
642
693
|
model: {
|
|
643
694
|
kind: "stake.createAccount",
|
|
644
695
|
uiState: {
|
|
645
|
-
delegate: { voteAccAddress:
|
|
696
|
+
delegate: { voteAccAddress: testOnChainData.validatorAddress }
|
|
646
697
|
}
|
|
647
698
|
},
|
|
648
699
|
recipient: "",
|
|
@@ -650,9 +701,9 @@ function stakingTests() {
|
|
|
650
701
|
},
|
|
651
702
|
expectedStatus: {
|
|
652
703
|
amount: new bignumber_js_1["default"](1),
|
|
653
|
-
estimatedFees: fees(1).plus(
|
|
704
|
+
estimatedFees: fees(1).plus(testOnChainData.fees.stakeAccountRentExempt),
|
|
654
705
|
totalSpent: fees(1)
|
|
655
|
-
.plus(
|
|
706
|
+
.plus(testOnChainData.fees.stakeAccountRentExempt)
|
|
656
707
|
.plus(1),
|
|
657
708
|
errors: {}
|
|
658
709
|
}
|
|
@@ -664,7 +715,7 @@ function stakingTests() {
|
|
|
664
715
|
model: {
|
|
665
716
|
kind: "stake.createAccount",
|
|
666
717
|
uiState: {
|
|
667
|
-
delegate: { voteAccAddress:
|
|
718
|
+
delegate: { voteAccAddress: testOnChainData.validatorAddress }
|
|
668
719
|
}
|
|
669
720
|
},
|
|
670
721
|
recipient: "",
|
|
@@ -672,11 +723,11 @@ function stakingTests() {
|
|
|
672
723
|
amount: zero
|
|
673
724
|
},
|
|
674
725
|
expectedStatus: {
|
|
675
|
-
amount:
|
|
726
|
+
amount: testOnChainData.fundedSenderBalance
|
|
676
727
|
.minus(fees(1))
|
|
677
|
-
.minus(
|
|
678
|
-
estimatedFees: fees(1).plus(
|
|
679
|
-
totalSpent:
|
|
728
|
+
.minus(testOnChainData.fees.stakeAccountRentExempt),
|
|
729
|
+
estimatedFees: fees(1).plus(testOnChainData.fees.stakeAccountRentExempt),
|
|
730
|
+
totalSpent: testOnChainData.fundedSenderBalance,
|
|
680
731
|
errors: {}
|
|
681
732
|
}
|
|
682
733
|
},
|
|
@@ -735,8 +786,8 @@ function stakingTests() {
|
|
|
735
786
|
model: {
|
|
736
787
|
kind: "stake.delegate",
|
|
737
788
|
uiState: {
|
|
738
|
-
stakeAccAddr:
|
|
739
|
-
voteAccAddr:
|
|
789
|
+
stakeAccAddr: testOnChainData.unfundedAddress,
|
|
790
|
+
voteAccAddr: testOnChainData.validatorAddress
|
|
740
791
|
}
|
|
741
792
|
},
|
|
742
793
|
recipient: "",
|
|
@@ -802,7 +853,7 @@ function stakingTests() {
|
|
|
802
853
|
model: {
|
|
803
854
|
kind: "stake.undelegate",
|
|
804
855
|
uiState: {
|
|
805
|
-
stakeAccAddr:
|
|
856
|
+
stakeAccAddr: testOnChainData.unfundedAddress
|
|
806
857
|
}
|
|
807
858
|
},
|
|
808
859
|
recipient: "",
|
|
@@ -868,7 +919,7 @@ function stakingTests() {
|
|
|
868
919
|
model: {
|
|
869
920
|
kind: "stake.withdraw",
|
|
870
921
|
uiState: {
|
|
871
|
-
stakeAccAddr:
|
|
922
|
+
stakeAccAddr: testOnChainData.unfundedAddress
|
|
872
923
|
}
|
|
873
924
|
},
|
|
874
925
|
recipient: "",
|
|
@@ -885,5 +936,170 @@ function stakingTests() {
|
|
|
885
936
|
},
|
|
886
937
|
];
|
|
887
938
|
}
|
|
888
|
-
|
|
889
|
-
|
|
939
|
+
(0, bridge_1.testBridge)(dataset);
|
|
940
|
+
var baseAccount = {
|
|
941
|
+
balance: new bignumber_js_1["default"](0),
|
|
942
|
+
spendableBalance: new bignumber_js_1["default"](0)
|
|
943
|
+
};
|
|
944
|
+
var baseTx = {
|
|
945
|
+
family: "solana",
|
|
946
|
+
recipient: "",
|
|
947
|
+
amount: new bignumber_js_1["default"](0)
|
|
948
|
+
};
|
|
949
|
+
var baseAPI = {
|
|
950
|
+
getFeeForMessage: function (_msg) {
|
|
951
|
+
return Promise.resolve(testOnChainData.fees.lamportsPerSignature);
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
/**
|
|
955
|
+
* Some business logic can not be described in terms of transactions and expected status
|
|
956
|
+
* in the test datasets, like stake activation/deactivation, because stake activation is
|
|
957
|
+
* not determenistic and changes with time. Hence the tests here to mock data
|
|
958
|
+
* to be determenistic.
|
|
959
|
+
*/
|
|
960
|
+
describe("solana staking", function () {
|
|
961
|
+
test("stake.delegate :: status is error: stake account is not delegatable", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
962
|
+
var stakeDelegateModel, stakeTests, stakeTests_1, stakeTests_1_1, stakeTest, e_1_1;
|
|
963
|
+
var e_1, _a;
|
|
964
|
+
return __generator(this, function (_b) {
|
|
965
|
+
switch (_b.label) {
|
|
966
|
+
case 0:
|
|
967
|
+
stakeDelegateModel = {
|
|
968
|
+
kind: "stake.delegate",
|
|
969
|
+
uiState: {
|
|
970
|
+
stakeAccAddr: testOnChainData.unfundedAddress,
|
|
971
|
+
voteAccAddr: testOnChainData.validatorAddress
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
stakeTests = [
|
|
975
|
+
{
|
|
976
|
+
activationState: "activating",
|
|
977
|
+
txModel: stakeDelegateModel,
|
|
978
|
+
expectedErrors: {
|
|
979
|
+
fee: new errors_1.NotEnoughBalance(),
|
|
980
|
+
stakeAccAddr: new errors_3.SolanaStakeAccountIsNotDelegatable()
|
|
981
|
+
}
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
activationState: "active",
|
|
985
|
+
txModel: stakeDelegateModel,
|
|
986
|
+
expectedErrors: {
|
|
987
|
+
fee: new errors_1.NotEnoughBalance(),
|
|
988
|
+
stakeAccAddr: new errors_3.SolanaStakeAccountIsNotDelegatable()
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
activationState: "deactivating",
|
|
993
|
+
txModel: __assign(__assign({}, stakeDelegateModel), { uiState: __assign(__assign({}, stakeDelegateModel.uiState), { voteAccAddr: testOnChainData.unfundedAddress }) }),
|
|
994
|
+
expectedErrors: {
|
|
995
|
+
fee: new errors_1.NotEnoughBalance(),
|
|
996
|
+
stakeAccAddr: new errors_3.SolanaStakeAccountValidatorIsUnchangeable()
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
];
|
|
1000
|
+
_b.label = 1;
|
|
1001
|
+
case 1:
|
|
1002
|
+
_b.trys.push([1, 6, 7, 8]);
|
|
1003
|
+
stakeTests_1 = __values(stakeTests), stakeTests_1_1 = stakeTests_1.next();
|
|
1004
|
+
_b.label = 2;
|
|
1005
|
+
case 2:
|
|
1006
|
+
if (!!stakeTests_1_1.done) return [3 /*break*/, 5];
|
|
1007
|
+
stakeTest = stakeTests_1_1.value;
|
|
1008
|
+
return [4 /*yield*/, runStakeTest(stakeTest)];
|
|
1009
|
+
case 3:
|
|
1010
|
+
_b.sent();
|
|
1011
|
+
_b.label = 4;
|
|
1012
|
+
case 4:
|
|
1013
|
+
stakeTests_1_1 = stakeTests_1.next();
|
|
1014
|
+
return [3 /*break*/, 2];
|
|
1015
|
+
case 5: return [3 /*break*/, 8];
|
|
1016
|
+
case 6:
|
|
1017
|
+
e_1_1 = _b.sent();
|
|
1018
|
+
e_1 = { error: e_1_1 };
|
|
1019
|
+
return [3 /*break*/, 8];
|
|
1020
|
+
case 7:
|
|
1021
|
+
try {
|
|
1022
|
+
if (stakeTests_1_1 && !stakeTests_1_1.done && (_a = stakeTests_1["return"])) _a.call(stakeTests_1);
|
|
1023
|
+
}
|
|
1024
|
+
finally { if (e_1) throw e_1.error; }
|
|
1025
|
+
return [7 /*endfinally*/];
|
|
1026
|
+
case 8: return [2 /*return*/];
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
}); });
|
|
1030
|
+
});
|
|
1031
|
+
function runStakeTest(stakeTestSpec) {
|
|
1032
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1033
|
+
var api, account, tx, preparedTx, status, expectedStatus;
|
|
1034
|
+
return __generator(this, function (_a) {
|
|
1035
|
+
switch (_a.label) {
|
|
1036
|
+
case 0:
|
|
1037
|
+
api = __assign(__assign({}, baseAPI), { getMinimumBalanceForRentExemption: function () {
|
|
1038
|
+
return Promise.resolve(testOnChainData.fees.stakeAccountRentExempt);
|
|
1039
|
+
}, getAccountInfo: function () {
|
|
1040
|
+
return Promise.resolve({ data: mockedVoteAccount });
|
|
1041
|
+
} });
|
|
1042
|
+
account = __assign(__assign({}, baseAccount), { solanaResources: {
|
|
1043
|
+
stakes: [
|
|
1044
|
+
{
|
|
1045
|
+
stakeAccAddr: testOnChainData.unfundedAddress,
|
|
1046
|
+
delegation: {
|
|
1047
|
+
stake: 1,
|
|
1048
|
+
voteAccAddr: testOnChainData.validatorAddress
|
|
1049
|
+
},
|
|
1050
|
+
activation: {
|
|
1051
|
+
state: stakeTestSpec.activationState
|
|
1052
|
+
}
|
|
1053
|
+
},
|
|
1054
|
+
]
|
|
1055
|
+
} });
|
|
1056
|
+
tx = __assign(__assign({}, baseTx), { model: stakeTestSpec.txModel });
|
|
1057
|
+
return [4 /*yield*/, (0, js_prepareTransaction_1.prepareTransaction)(account, tx, api)];
|
|
1058
|
+
case 1:
|
|
1059
|
+
preparedTx = _a.sent();
|
|
1060
|
+
return [4 /*yield*/, (0, js_getTransactionStatus_1["default"])(account, preparedTx)];
|
|
1061
|
+
case 2:
|
|
1062
|
+
status = _a.sent();
|
|
1063
|
+
expectedStatus = {
|
|
1064
|
+
amount: new bignumber_js_1["default"](0),
|
|
1065
|
+
estimatedFees: new bignumber_js_1["default"](testOnChainData.fees.lamportsPerSignature),
|
|
1066
|
+
totalSpent: new bignumber_js_1["default"](testOnChainData.fees.lamportsPerSignature),
|
|
1067
|
+
errors: stakeTestSpec.expectedErrors,
|
|
1068
|
+
warnings: {}
|
|
1069
|
+
};
|
|
1070
|
+
expect(status).toEqual(expectedStatus);
|
|
1071
|
+
return [2 /*return*/];
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
var mockedVoteAccount = {
|
|
1077
|
+
parsed: {
|
|
1078
|
+
info: {
|
|
1079
|
+
authorizedVoters: [
|
|
1080
|
+
{
|
|
1081
|
+
authorizedVoter: "EvnRmnMrd69kFdbLMxWkTn1icZ7DCceRhvmb2SJXqDo4",
|
|
1082
|
+
epoch: 283
|
|
1083
|
+
},
|
|
1084
|
+
],
|
|
1085
|
+
authorizedWithdrawer: "EvnRmnMrd69kFdbLMxWkTn1icZ7DCceRhvmb2SJXqDo4",
|
|
1086
|
+
commission: 7,
|
|
1087
|
+
epochCredits: [
|
|
1088
|
+
{
|
|
1089
|
+
credits: "98854605",
|
|
1090
|
+
epoch: 283,
|
|
1091
|
+
previousCredits: "98728105"
|
|
1092
|
+
},
|
|
1093
|
+
],
|
|
1094
|
+
lastTimestamp: { slot: 122422797, timestamp: 1645796249 },
|
|
1095
|
+
nodePubkey: "EvnRmnMrd69kFdbLMxWkTn1icZ7DCceRhvmb2SJXqDo4",
|
|
1096
|
+
priorVoters: [],
|
|
1097
|
+
rootSlot: 122422766,
|
|
1098
|
+
votes: [{ confirmationCount: 1, slot: 122422797 }]
|
|
1099
|
+
},
|
|
1100
|
+
type: "vote"
|
|
1101
|
+
},
|
|
1102
|
+
program: "vote",
|
|
1103
|
+
space: 3731
|
|
1104
|
+
};
|
|
1105
|
+
//# sourceMappingURL=bridge.integration.test.js.map
|