@ledgerhq/live-common 21.36.3 → 22.0.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/README.md +1 -3
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.js +5 -5
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.js.map +1 -1
- package/lib/__tests__/test-helpers/bridge.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/bridge.js +11 -9
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/__tests__/test-helpers/libcore-setup.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/libcore-setup.js +0 -6
- package/lib/__tests__/test-helpers/libcore-setup.js.map +1 -1
- package/lib/__tests__/test-helpers/libcore-setup.native.d.ts +0 -1
- package/lib/__tests__/test-helpers/libcore-setup.native.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/libcore-setup.native.js +0 -1
- package/lib/__tests__/test-helpers/libcore-setup.native.js.map +1 -1
- package/lib/__tests__/test-helpers/setup.js +2 -1
- package/lib/__tests__/test-helpers/setup.js.map +1 -1
- package/lib/account/formatters.d.ts.map +1 -1
- package/lib/account/formatters.js +22 -7
- package/lib/account/formatters.js.map +1 -1
- package/lib/account/pending.d.ts +2 -1
- package/lib/account/pending.d.ts.map +1 -1
- package/lib/account/serialization.d.ts +6 -4
- package/lib/account/serialization.d.ts.map +1 -1
- package/lib/account/serialization.js +22 -7
- package/lib/account/serialization.js.map +1 -1
- package/lib/account/support.d.ts +0 -2
- package/lib/account/support.d.ts.map +1 -1
- package/lib/account/support.js +1 -22
- package/lib/account/support.js.map +1 -1
- package/lib/api/Ethereum.d.ts +6 -2
- package/lib/api/Ethereum.d.ts.map +1 -1
- package/lib/api/Ethereum.js +19 -3
- package/lib/api/Ethereum.js.map +1 -1
- package/lib/api/Ledger.d.ts.map +1 -1
- package/lib/api/Ledger.js +0 -9
- package/lib/api/Ledger.js.map +1 -1
- package/lib/api/explorerConfig/index.d.ts.map +1 -1
- package/lib/api/explorerConfig/index.js +7 -0
- package/lib/api/explorerConfig/index.js.map +1 -1
- package/lib/appSupportsQuitApp.d.ts +1 -0
- package/lib/appSupportsQuitApp.d.ts.map +1 -1
- package/lib/appSupportsQuitApp.js +1 -0
- package/lib/appSupportsQuitApp.js.map +1 -1
- package/lib/apps/support.d.ts.map +1 -1
- package/lib/apps/support.js +2 -1
- package/lib/apps/support.js.map +1 -1
- package/lib/bot/index.d.ts.map +1 -1
- package/lib/bot/index.js +16 -23
- package/lib/bot/index.js.map +1 -1
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +3 -13
- package/lib/bridge/impl.js.map +1 -1
- package/lib/bridge/jsHelpers.d.ts +2 -2
- package/lib/bridge/jsHelpers.d.ts.map +1 -1
- package/lib/bridge/jsHelpers.js.map +1 -1
- package/lib/cross.d.ts.map +1 -1
- package/lib/cross.js +6 -7
- package/lib/cross.js.map +1 -1
- package/lib/derivation.d.ts +0 -39
- package/lib/derivation.d.ts.map +1 -1
- package/lib/derivation.js +5 -86
- package/lib/derivation.js.map +1 -1
- package/lib/env.d.ts +15 -25
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +12 -23
- 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/families/algorand/types.d.ts +0 -78
- package/lib/families/algorand/types.d.ts.map +1 -1
- package/lib/families/algorand/types.js +1 -154
- package/lib/families/algorand/types.js.map +1 -1
- package/lib/families/bitcoin/account.d.ts.map +1 -1
- package/lib/families/bitcoin/account.js +0 -1
- package/lib/families/bitcoin/account.js.map +1 -1
- package/lib/families/bitcoin/bridge.test.d.ts +2 -0
- package/lib/families/bitcoin/bridge.test.d.ts.map +1 -0
- package/lib/families/bitcoin/bridge.test.js +11 -0
- package/lib/families/bitcoin/bridge.test.js.map +1 -0
- package/lib/families/bitcoin/js-signOperation.d.ts.map +1 -1
- package/lib/families/bitcoin/js-signOperation.js.map +1 -1
- package/lib/families/bitcoin/js-synchronisation.d.ts.map +1 -1
- package/lib/families/bitcoin/js-synchronisation.js +6 -7
- package/lib/families/bitcoin/js-synchronisation.js.map +1 -1
- package/lib/families/bitcoin/logic.d.ts +2 -5
- package/lib/families/bitcoin/logic.d.ts.map +1 -1
- package/lib/families/bitcoin/logic.js +4 -123
- package/lib/families/bitcoin/logic.js.map +1 -1
- package/lib/families/bitcoin/networks.js +1 -1
- package/lib/families/bitcoin/networks.js.map +1 -1
- package/lib/families/bitcoin/serialization.d.ts +2 -2
- package/lib/families/bitcoin/serialization.d.ts.map +1 -1
- package/lib/families/bitcoin/serialization.js +2 -4
- package/lib/families/bitcoin/serialization.js.map +1 -1
- package/lib/families/bitcoin/specs.d.ts.map +1 -1
- package/lib/families/bitcoin/specs.js +8 -7
- package/lib/families/bitcoin/specs.js.map +1 -1
- package/lib/families/bitcoin/transaction.d.ts +1 -26
- package/lib/families/bitcoin/transaction.d.ts.map +1 -1
- package/lib/families/bitcoin/transaction.js +1 -239
- package/lib/families/bitcoin/transaction.js.map +1 -1
- package/lib/families/bitcoin/types.d.ts +0 -82
- package/lib/families/bitcoin/types.d.ts.map +1 -1
- package/lib/families/bitcoin/types.js +1 -118
- package/lib/families/bitcoin/types.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/explorer/index.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/explorer/index.js +12 -5
- package/lib/families/bitcoin/wallet-btc/explorer/index.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/index.d.ts +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/index.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/index.js +6 -7
- package/lib/families/bitcoin/wallet-btc/storage/index.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/types.d.ts +2 -2
- package/lib/families/bitcoin/wallet-btc/storage/types.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/utils.js +1 -1
- package/lib/families/bitcoin/wallet-btc/utils.js.map +1 -1
- package/lib/families/celo/js-getTransactionStatus.d.ts.map +1 -1
- package/lib/families/celo/js-getTransactionStatus.js +2 -0
- package/lib/families/celo/js-getTransactionStatus.js.map +1 -1
- package/lib/families/celo/types.d.ts +0 -5
- package/lib/families/celo/types.d.ts.map +1 -1
- package/lib/families/celo/types.js +0 -3
- package/lib/families/celo/types.js.map +1 -1
- package/lib/families/cosmos/api/Cosmos.js +1 -1
- package/lib/families/cosmos/api/Cosmos.js.map +1 -1
- package/lib/families/cosmos/bridge.test.d.ts +2 -0
- package/lib/families/cosmos/bridge.test.d.ts.map +1 -0
- package/lib/families/cosmos/bridge.test.js +11 -0
- package/lib/families/cosmos/bridge.test.js.map +1 -0
- package/lib/families/cosmos/js-signOperation.d.ts.map +1 -1
- package/lib/families/cosmos/js-signOperation.js.map +1 -1
- package/lib/families/cosmos/js-synchronisation.d.ts.map +1 -1
- package/lib/families/cosmos/js-synchronisation.js +2 -1
- package/lib/families/cosmos/js-synchronisation.js.map +1 -1
- package/lib/families/cosmos/logic.d.ts +0 -9
- package/lib/families/cosmos/logic.d.ts.map +1 -1
- package/lib/families/cosmos/logic.js +5 -20
- package/lib/families/cosmos/logic.js.map +1 -1
- package/lib/families/cosmos/types.d.ts +0 -190
- package/lib/families/cosmos/types.d.ts.map +1 -1
- package/lib/families/cosmos/types.js +0 -370
- package/lib/families/cosmos/types.js.map +1 -1
- package/lib/families/crypto_org/js-buildTransaction.js +1 -1
- package/lib/families/crypto_org/js-buildTransaction.js.map +1 -1
- package/lib/families/crypto_org/js-signOperation.d.ts.map +1 -1
- package/lib/families/crypto_org/js-signOperation.js +3 -4
- package/lib/families/crypto_org/js-signOperation.js.map +1 -1
- package/lib/families/crypto_org/types.d.ts +0 -5
- package/lib/families/crypto_org/types.d.ts.map +1 -1
- package/lib/families/crypto_org/types.js +0 -3
- package/lib/families/crypto_org/types.js.map +1 -1
- package/lib/families/elrond/types.d.ts +1 -6
- package/lib/families/elrond/types.d.ts.map +1 -1
- package/lib/families/elrond/types.js +0 -3
- package/lib/families/elrond/types.js.map +1 -1
- package/lib/families/ethereum/bridge/js.d.ts.map +1 -1
- package/lib/families/ethereum/bridge/js.js +6 -1
- package/lib/families/ethereum/bridge/js.js.map +1 -1
- package/lib/families/ethereum/bridge.test.d.ts +2 -0
- package/lib/families/ethereum/bridge.test.d.ts.map +1 -0
- package/lib/families/ethereum/bridge.test.js +11 -0
- package/lib/families/ethereum/bridge.test.js.map +1 -0
- package/lib/families/ethereum/modules/erc1155.js +9 -9
- 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 +12 -16
- package/lib/families/ethereum/modules/erc721.js.map +1 -1
- package/lib/families/ethereum/nft.unit.test.d.ts +2 -0
- package/lib/families/ethereum/nft.unit.test.d.ts.map +1 -0
- package/lib/families/ethereum/{nft.merging.unit.test.js → nft.unit.test.js} +61 -6
- package/lib/families/ethereum/nft.unit.test.js.map +1 -0
- package/lib/families/ethereum/nftResolvers.d.ts +19 -0
- package/lib/families/ethereum/nftResolvers.d.ts.map +1 -0
- package/lib/families/ethereum/nftResolvers.js +121 -0
- package/lib/families/ethereum/nftResolvers.js.map +1 -0
- package/lib/families/ethereum/synchronisation.js +2 -2
- package/lib/families/ethereum/synchronisation.js.map +1 -1
- package/lib/families/ethereum/types.d.ts +0 -5
- package/lib/families/ethereum/types.d.ts.map +1 -1
- package/lib/families/ethereum/types.js +0 -3
- package/lib/families/ethereum/types.js.map +1 -1
- package/lib/families/filecoin/types.d.ts +0 -5
- package/lib/families/filecoin/types.d.ts.map +1 -1
- package/lib/families/filecoin/types.js +0 -3
- package/lib/families/filecoin/types.js.map +1 -1
- package/lib/families/neo/types.d.ts +0 -5
- package/lib/families/neo/types.d.ts.map +1 -1
- package/lib/families/neo/types.js +0 -3
- package/lib/families/neo/types.js.map +1 -1
- package/lib/families/polkadot/bridge.test.d.ts +2 -0
- package/lib/families/polkadot/bridge.test.d.ts.map +1 -0
- package/lib/families/polkadot/bridge.test.js +145 -0
- package/lib/families/polkadot/bridge.test.js.map +1 -0
- package/lib/families/polkadot/types.d.ts +0 -5
- package/lib/families/polkadot/types.d.ts.map +1 -1
- package/lib/families/polkadot/types.js +0 -3
- package/lib/families/polkadot/types.js.map +1 -1
- package/lib/families/ripple/bridge.test.d.ts +2 -0
- package/lib/families/ripple/bridge.test.d.ts.map +1 -0
- package/lib/{libcore/buildAccount/buildSubAccounts.js → families/ripple/bridge.test.js} +17 -20
- package/lib/families/ripple/bridge.test.js.map +1 -0
- package/lib/families/ripple/types.d.ts +0 -59
- package/lib/families/ripple/types.d.ts.map +1 -1
- package/lib/families/ripple/types.js +0 -87
- package/lib/families/ripple/types.js.map +1 -1
- package/lib/families/solana/api/cached.d.ts.map +1 -1
- package/lib/families/solana/api/cached.js +10 -0
- package/lib/families/solana/api/cached.js.map +1 -1
- package/lib/families/solana/api/chain/account/index.d.ts +1 -1
- package/lib/families/solana/api/chain/account/index.d.ts.map +1 -1
- package/lib/families/solana/api/chain/account/index.js +2 -1
- package/lib/families/solana/api/chain/account/index.js.map +1 -1
- package/lib/families/solana/api/chain/account/parser.d.ts +5 -0
- package/lib/families/solana/api/chain/account/parser.d.ts.map +1 -1
- package/lib/families/solana/api/chain/account/parser.js +24 -1
- package/lib/families/solana/api/chain/account/parser.js.map +1 -1
- package/lib/families/solana/api/chain/account/stake.d.ts +5 -5
- package/lib/families/solana/api/chain/account/token.d.ts +5 -5
- package/lib/families/solana/api/chain/account/vote.d.ts +252 -0
- package/lib/families/solana/api/chain/account/vote.d.ts.map +1 -0
- package/lib/families/solana/api/chain/account/vote.js +44 -0
- package/lib/families/solana/api/chain/account/vote.js.map +1 -0
- package/lib/families/solana/api/chain/index.d.ts +7 -0
- package/lib/families/solana/api/chain/index.d.ts.map +1 -1
- package/lib/families/solana/api/chain/index.js +35 -0
- package/lib/families/solana/api/chain/index.js.map +1 -1
- package/lib/families/solana/api/chain/instruction/stake/types.d.ts +7 -7
- package/lib/families/solana/api/chain/instruction/system/index.d.ts +15 -0
- package/lib/families/solana/api/chain/instruction/system/index.d.ts.map +1 -0
- package/lib/families/solana/api/chain/instruction/system/index.js +20 -0
- package/lib/families/solana/api/chain/instruction/system/index.js.map +1 -0
- package/lib/families/solana/api/chain/instruction/system/types.d.ts +298 -0
- package/lib/families/solana/api/chain/instruction/system/types.d.ts.map +1 -0
- package/lib/families/solana/api/chain/instruction/system/types.js +117 -0
- package/lib/families/solana/api/chain/instruction/system/types.js.map +1 -0
- package/lib/families/solana/api/chain/program/parser.d.ts +5 -0
- package/lib/families/solana/api/chain/program/parser.d.ts.map +1 -1
- package/lib/families/solana/api/chain/program/parser.js +7 -0
- package/lib/families/solana/api/chain/program/parser.js.map +1 -1
- package/lib/families/solana/api/chain/web3.d.ts +20 -1
- package/lib/families/solana/api/chain/web3.d.ts.map +1 -1
- package/lib/families/solana/api/chain/web3.js +122 -1
- package/lib/families/solana/api/chain/web3.js.map +1 -1
- package/lib/families/solana/api/logged.d.ts.map +1 -1
- package/lib/families/solana/api/logged.js +5 -0
- package/lib/families/solana/api/logged.js.map +1 -1
- package/lib/families/solana/bridge/bridge.d.ts.map +1 -1
- package/lib/families/solana/bridge/bridge.js +16 -7
- package/lib/families/solana/bridge/bridge.js.map +1 -1
- package/lib/families/solana/bridge/mock-data.d.ts +116 -11
- package/lib/families/solana/bridge/mock-data.d.ts.map +1 -1
- package/lib/families/solana/bridge/mock-data.js +19 -493
- package/lib/families/solana/bridge/mock-data.js.map +1 -1
- package/lib/families/solana/bridge/mock.d.ts.map +1 -1
- package/lib/families/solana/bridge/mock.js +1 -0
- package/lib/families/solana/bridge/mock.js.map +1 -1
- package/lib/families/solana/bridge.test.d.ts +2 -0
- package/lib/families/solana/bridge.test.d.ts.map +1 -0
- package/lib/families/solana/bridge.test.js +11 -0
- package/lib/families/solana/bridge.test.js.map +1 -0
- package/lib/families/solana/cli-transaction.d.ts +5 -1
- package/lib/families/solana/cli-transaction.d.ts.map +1 -1
- package/lib/families/solana/cli-transaction.js +72 -4
- package/lib/families/solana/cli-transaction.js.map +1 -1
- package/lib/families/solana/deviceTransactionConfig.d.ts +3 -3
- package/lib/families/solana/deviceTransactionConfig.d.ts.map +1 -1
- package/lib/families/solana/deviceTransactionConfig.js +128 -20
- package/lib/families/solana/deviceTransactionConfig.js.map +1 -1
- package/lib/families/solana/errors.d.ts +30 -0
- package/lib/families/solana/errors.d.ts.map +1 -1
- package/lib/families/solana/errors.js +11 -1
- package/lib/families/solana/errors.js.map +1 -1
- package/lib/families/solana/js-buildTransaction.d.ts.map +1 -1
- package/lib/families/solana/js-buildTransaction.js +13 -7
- package/lib/families/solana/js-buildTransaction.js.map +1 -1
- package/lib/families/solana/js-estimateMaxSpendable.d.ts.map +1 -1
- package/lib/families/solana/js-estimateMaxSpendable.js +26 -17
- package/lib/families/solana/js-estimateMaxSpendable.js.map +1 -1
- package/lib/families/solana/js-getTransactionStatus.d.ts +1 -1
- package/lib/families/solana/js-getTransactionStatus.d.ts.map +1 -1
- package/lib/families/solana/js-getTransactionStatus.js +36 -79
- package/lib/families/solana/js-getTransactionStatus.js.map +1 -1
- package/lib/families/solana/js-preload-data.d.ts +7 -0
- package/lib/families/solana/js-preload-data.d.ts.map +1 -0
- package/lib/families/solana/js-preload-data.js +45 -0
- package/lib/families/solana/js-preload-data.js.map +1 -0
- package/lib/families/solana/js-preload.d.ts +6 -0
- package/lib/families/solana/js-preload.d.ts.map +1 -0
- package/lib/{libcore/buildBigNumber.js → families/solana/js-preload.js} +60 -28
- package/lib/families/solana/js-preload.js.map +1 -0
- package/lib/families/solana/js-prepareTransaction.d.ts.map +1 -1
- package/lib/families/solana/js-prepareTransaction.js +453 -142
- package/lib/families/solana/js-prepareTransaction.js.map +1 -1
- package/lib/families/solana/js-signOperation.d.ts.map +1 -1
- package/lib/families/solana/js-signOperation.js +90 -68
- package/lib/families/solana/js-signOperation.js.map +1 -1
- package/lib/families/solana/js-synchronization.d.ts.map +1 -1
- package/lib/families/solana/js-synchronization.js +159 -57
- package/lib/families/solana/js-synchronization.js.map +1 -1
- package/lib/families/solana/logic.d.ts +16 -0
- package/lib/families/solana/logic.d.ts.map +1 -1
- package/lib/families/solana/logic.js +59 -1
- package/lib/families/solana/logic.js.map +1 -1
- package/lib/families/solana/react.d.ts +7 -0
- package/lib/families/solana/react.d.ts.map +1 -0
- package/lib/families/solana/react.js +56 -0
- package/lib/families/solana/react.js.map +1 -0
- package/lib/families/solana/serialization.d.ts +4 -0
- package/lib/families/solana/serialization.d.ts.map +1 -0
- package/lib/families/solana/serialization.js +16 -0
- package/lib/families/solana/serialization.js.map +1 -0
- package/lib/families/solana/specs.d.ts.map +1 -1
- package/lib/families/solana/specs.js +320 -0
- package/lib/families/solana/specs.js.map +1 -1
- package/lib/families/solana/speculos-deviceActions.d.ts +5 -0
- package/lib/families/solana/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/solana/speculos-deviceActions.js +189 -14
- package/lib/families/solana/speculos-deviceActions.js.map +1 -1
- package/lib/families/solana/test-dataset.d.ts +18 -0
- package/lib/families/solana/test-dataset.d.ts.map +1 -1
- package/lib/families/solana/test-dataset.js +694 -202
- package/lib/families/solana/test-dataset.js.map +1 -1
- package/lib/families/solana/test-specifics.d.ts +9 -0
- package/lib/families/solana/test-specifics.d.ts.map +1 -0
- package/lib/families/solana/test-specifics.js +238 -0
- package/lib/families/solana/test-specifics.js.map +1 -0
- package/lib/families/solana/transaction.d.ts.map +1 -1
- package/lib/families/solana/transaction.js +69 -13
- package/lib/families/solana/transaction.js.map +1 -1
- package/lib/families/solana/types.d.ts +129 -21
- package/lib/families/solana/types.d.ts.map +1 -1
- package/lib/families/solana/types.js +0 -3
- package/lib/families/solana/types.js.map +1 -1
- package/lib/families/solana/utils.d.ts +6 -0
- package/lib/families/solana/utils.d.ts.map +1 -1
- package/lib/families/solana/utils.js +76 -4
- package/lib/families/solana/utils.js.map +1 -1
- package/lib/families/solana/validator-app/index.d.ts +22 -0
- package/lib/families/solana/validator-app/index.d.ts.map +1 -0
- package/lib/families/{algorand/libcore-getFeesForTransaction.js → solana/validator-app/index.js} +45 -28
- package/lib/families/solana/validator-app/index.js.map +1 -0
- package/lib/families/stellar/api/horizon.d.ts +2 -1
- package/lib/families/stellar/api/horizon.d.ts.map +1 -1
- package/lib/families/stellar/api/horizon.js.map +1 -1
- package/lib/families/stellar/bridge.test.d.ts +2 -0
- package/lib/families/stellar/bridge.test.d.ts.map +1 -0
- package/lib/families/stellar/bridge.test.js +11 -0
- package/lib/families/stellar/bridge.test.js.map +1 -0
- package/lib/families/stellar/test-dataset.d.ts.map +1 -1
- package/lib/families/stellar/test-dataset.js +2 -4
- package/lib/families/stellar/test-dataset.js.map +1 -1
- package/lib/families/stellar/types.d.ts +0 -5
- package/lib/families/stellar/types.d.ts.map +1 -1
- package/lib/families/stellar/types.js +1 -3
- package/lib/families/stellar/types.js.map +1 -1
- package/lib/families/tezos/bridge/js.d.ts.map +1 -1
- package/lib/families/tezos/bridge/js.js +16 -3
- package/lib/families/tezos/bridge/js.js.map +1 -1
- package/lib/families/tezos/bridge.test.d.ts +2 -0
- package/lib/families/tezos/bridge.test.d.ts.map +1 -0
- package/lib/families/tezos/{test-specifics.js → bridge.test.js} +36 -33
- package/lib/families/tezos/bridge.test.js.map +1 -0
- package/lib/families/tezos/types.d.ts +0 -86
- package/lib/families/tezos/types.d.ts.map +1 -1
- package/lib/families/tezos/types.js +0 -138
- package/lib/families/tezos/types.js.map +1 -1
- package/lib/families/tron/types.d.ts +0 -6
- package/lib/families/tron/types.d.ts.map +1 -1
- package/lib/families/tron/types.js +0 -4
- package/lib/families/tron/types.js.map +1 -1
- package/lib/generated/cli-transaction.d.ts +5 -1
- package/lib/generated/cli-transaction.d.ts.map +1 -1
- package/lib/generated/customAddressValidation.d.ts +1 -10
- package/lib/generated/customAddressValidation.d.ts.map +1 -1
- package/lib/generated/customAddressValidation.js +1 -9
- package/lib/generated/customAddressValidation.js.map +1 -1
- package/lib/generated/speculos-deviceActions.d.ts +1 -0
- package/lib/generated/speculos-deviceActions.d.ts.map +1 -1
- package/lib/generated/types.d.ts +0 -92
- package/lib/generated/types.d.ts.map +1 -1
- package/lib/generated/types.js +0 -34
- package/lib/generated/types.js.map +1 -1
- package/lib/mock/account.d.ts.map +1 -1
- package/lib/mock/account.js +7 -1
- package/lib/mock/account.js.map +1 -1
- package/lib/nft/NftMetadataProvider/index.d.ts +9 -8
- package/lib/nft/NftMetadataProvider/index.d.ts.map +1 -1
- package/lib/nft/NftMetadataProvider/index.js +135 -69
- package/lib/nft/NftMetadataProvider/index.js.map +1 -1
- package/lib/nft/NftMetadataProvider/types.d.ts +13 -7
- package/lib/nft/NftMetadataProvider/types.d.ts.map +1 -1
- package/lib/nft/helpers.d.ts +24 -8
- package/lib/nft/helpers.d.ts.map +1 -1
- package/lib/nft/helpers.js +125 -40
- package/lib/nft/helpers.js.map +1 -1
- package/lib/nft/nftId.d.ts +7 -2
- package/lib/nft/nftId.d.ts.map +1 -1
- package/lib/nft/nftId.js +5 -4
- package/lib/nft/nftId.js.map +1 -1
- package/lib/nft/support.d.ts +2 -1
- package/lib/nft/support.d.ts.map +1 -1
- package/lib/nft/support.js +39 -1
- package/lib/nft/support.js.map +1 -1
- package/lib/reconciliation.d.ts.map +1 -1
- package/lib/reconciliation.js +8 -5
- package/lib/reconciliation.js.map +1 -1
- package/lib/types/account.d.ts +7 -3
- package/lib/types/account.d.ts.map +1 -1
- package/lib/types/bridge.d.ts +16 -1
- package/lib/types/bridge.d.ts.map +1 -1
- package/lib/types/nft.d.ts +28 -6
- package/lib/types/nft.d.ts.map +1 -1
- package/lib/walletconnect/index.d.ts.map +1 -1
- package/lib/walletconnect/index.js +7 -6
- package/lib/walletconnect/index.js.map +1 -1
- package/package.json +3 -4
- package/src/.DS_Store +0 -0
- package/src/{data/flags → __tests__}/.DS_Store +0 -0
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.ts +5 -5
- package/src/__tests__/test-helpers/bridge.ts +11 -7
- package/src/__tests__/test-helpers/libcore-setup.native.ts +0 -1
- package/src/__tests__/test-helpers/libcore-setup.ts +1 -7
- package/src/__tests__/test-helpers/setup.ts +2 -1
- package/src/account/formatters.ts +6 -8
- package/src/account/serialization.ts +46 -6
- package/src/account/support.ts +2 -19
- package/src/api/Ethereum.ts +36 -6
- package/src/api/Ledger.ts +1 -12
- package/src/api/explorerConfig/index.ts +8 -0
- package/src/appSupportsQuitApp.ts +1 -0
- package/src/apps/support.ts +1 -0
- package/src/bot/index.ts +1 -6
- package/src/bridge/impl.ts +5 -17
- package/src/bridge/jsHelpers.ts +6 -3
- package/src/cross.ts +2 -4
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +6290 -0
- package/src/derivation.ts +1 -85
- package/src/env.ts +12 -23
- package/src/families/algorand/types.ts +2 -255
- package/src/{__tests__/__snapshots__/all.libcore.ts.snap → families/bitcoin/__snapshots__/bridge.test.ts.snap} +7085 -14082
- package/src/families/bitcoin/account.ts +0 -1
- package/src/families/bitcoin/bridge.test.ts +6 -0
- package/src/families/bitcoin/js-signOperation.ts +0 -5
- package/src/families/bitcoin/js-synchronisation.ts +5 -6
- package/src/families/bitcoin/logic.ts +2 -77
- package/src/families/bitcoin/networks.ts +1 -1
- package/src/families/bitcoin/serialization.ts +0 -4
- package/src/families/bitcoin/specs.ts +14 -7
- package/src/families/bitcoin/transaction.ts +0 -191
- package/src/families/bitcoin/types.ts +0 -225
- package/src/families/bitcoin/wallet-btc/explorer/index.ts +23 -23
- package/src/families/bitcoin/wallet-btc/storage/index.ts +6 -9
- package/src/families/bitcoin/wallet-btc/storage/types.ts +2 -2
- package/src/families/bitcoin/wallet-btc/utils.ts +1 -1
- package/src/families/celo/js-getTransactionStatus.ts +3 -1
- package/src/families/celo/types.ts +0 -6
- package/src/families/cosmos/__snapshots__/bridge.test.ts.snap +1156 -0
- package/src/families/cosmos/api/Cosmos.ts +1 -1
- package/src/families/cosmos/bridge.test.ts +6 -0
- package/src/families/cosmos/js-signOperation.ts +8 -0
- package/src/families/cosmos/js-synchronisation.ts +3 -1
- package/src/families/cosmos/logic.ts +4 -37
- package/src/families/cosmos/types.ts +1 -619
- package/src/families/crypto_org/js-buildTransaction.ts +1 -1
- package/src/families/crypto_org/js-signOperation.ts +2 -3
- package/src/families/crypto_org/types.ts +1 -5
- package/src/families/elrond/types.ts +2 -6
- package/src/families/ethereum/__snapshots__/bridge.test.ts.snap +3263 -0
- package/src/families/ethereum/bridge/js.ts +5 -0
- package/src/families/ethereum/bridge.test.ts +6 -0
- package/src/families/ethereum/modules/erc1155.ts +9 -9
- package/src/families/ethereum/modules/erc721.ts +11 -11
- package/src/families/ethereum/nft.unit.test.ts +147 -0
- package/src/families/ethereum/nftResolvers.ts +79 -0
- package/src/families/ethereum/synchronisation.ts +7 -2
- package/src/families/ethereum/types.ts +1 -6
- package/src/families/filecoin/types.ts +0 -6
- package/src/families/neo/types.ts +1 -5
- package/src/families/polkadot/bridge.test.ts +81 -0
- package/src/families/polkadot/types.ts +1 -5
- package/src/families/ripple/bridge.test.ts +12 -0
- package/src/families/ripple/types.ts +0 -143
- package/src/families/solana/__snapshots__/bridge.test.ts.snap +116 -0
- package/src/families/solana/api/cached.ts +40 -0
- package/src/families/solana/api/chain/account/index.ts +5 -1
- package/src/families/solana/api/chain/account/parser.ts +28 -0
- package/src/families/solana/api/chain/account/vote.ts +63 -0
- package/src/families/solana/api/chain/index.ts +63 -0
- package/src/families/solana/api/chain/instruction/system/index.ts +30 -0
- package/src/families/solana/api/chain/instruction/system/types.ts +141 -0
- package/src/families/solana/api/chain/program/parser.ts +18 -0
- package/src/families/solana/api/chain/web3.ts +173 -1
- package/src/families/solana/api/logged.ts +5 -0
- package/src/families/solana/bridge/bridge.ts +27 -4
- package/src/families/solana/bridge/mock-data.ts +19 -588
- package/src/families/solana/bridge/mock.ts +1 -0
- package/src/families/solana/bridge.test.ts +6 -0
- package/src/families/solana/cli-transaction.ts +87 -3
- package/src/families/solana/deviceTransactionConfig.ts +180 -24
- package/src/families/solana/errors.ts +40 -0
- package/src/families/solana/js-buildTransaction.ts +19 -8
- package/src/families/solana/js-estimateMaxSpendable.ts +20 -7
- package/src/families/solana/js-getTransactionStatus.ts +34 -93
- package/src/families/solana/js-preload-data.ts +53 -0
- package/src/families/solana/js-preload.ts +66 -0
- package/src/families/solana/js-prepareTransaction.ts +471 -148
- package/src/families/solana/js-signOperation.ts +177 -74
- package/src/families/solana/js-synchronization.ts +195 -54
- package/src/families/solana/logic.ts +80 -0
- package/src/families/solana/react.ts +81 -0
- package/src/families/solana/serialization.ts +17 -0
- package/src/families/solana/specs.ts +411 -1
- package/src/families/solana/speculos-deviceActions.ts +192 -15
- package/src/families/solana/test-dataset.ts +707 -327
- package/src/families/solana/test-specifics.ts +171 -0
- package/src/families/solana/transaction.ts +93 -16
- package/src/families/solana/types.ts +158 -27
- package/src/families/solana/utils.ts +52 -1
- package/src/families/solana/validator-app/index.ts +106 -0
- package/src/families/stellar/__snapshots__/bridge.test.ts.snap +2570 -0
- package/src/families/stellar/api/horizon.ts +2 -1
- package/src/families/stellar/bridge.test.ts +6 -0
- package/src/families/stellar/test-dataset.ts +2 -4
- package/src/families/stellar/types.ts +0 -5
- package/src/families/tezos/bridge/js.ts +16 -1
- package/src/families/tezos/bridge.test.ts +24 -0
- package/src/families/tezos/types.ts +0 -224
- package/src/families/tron/types.ts +1 -6
- package/src/generated/customAddressValidation.ts +0 -6
- package/src/generated/types.ts +0 -202
- package/src/mock/account.ts +7 -1
- package/src/nft/NftMetadataProvider/index.tsx +163 -75
- package/src/nft/NftMetadataProvider/types.ts +31 -8
- package/src/nft/helpers.ts +169 -35
- package/src/nft/nftId.ts +13 -4
- package/src/nft/support.ts +14 -1
- package/src/reconciliation.ts +10 -5
- package/src/types/account.ts +7 -3
- package/src/types/bridge.ts +20 -0
- package/src/types/nft.ts +32 -9
- package/src/walletconnect/index.ts +3 -1
- package/lib/__tests__/all.libcore.d.ts +0 -2
- package/lib/__tests__/all.libcore.d.ts.map +0 -1
- package/lib/__tests__/all.libcore.js +0 -203
- package/lib/__tests__/all.libcore.js.map +0 -1
- package/lib/__tests__/test-helpers/implement-react-native-libcore/index.d.ts +0 -2
- package/lib/__tests__/test-helpers/implement-react-native-libcore/index.d.ts.map +0 -1
- package/lib/__tests__/test-helpers/implement-react-native-libcore/index.js +0 -12
- package/lib/__tests__/test-helpers/implement-react-native-libcore/index.js.map +0 -1
- package/lib/__tests__/test-helpers/implement-react-native-libcore/specific.android.d.ts +0 -2
- package/lib/__tests__/test-helpers/implement-react-native-libcore/specific.android.d.ts.map +0 -1
- package/lib/__tests__/test-helpers/implement-react-native-libcore/specific.android.js +0 -10
- package/lib/__tests__/test-helpers/implement-react-native-libcore/specific.android.js.map +0 -1
- package/lib/__tests__/test-helpers/implement-react-native-libcore/specific.ios.d.ts +0 -2
- package/lib/__tests__/test-helpers/implement-react-native-libcore/specific.ios.d.ts.map +0 -1
- package/lib/__tests__/test-helpers/implement-react-native-libcore/specific.ios.js +0 -10
- package/lib/__tests__/test-helpers/implement-react-native-libcore/specific.ios.js.map +0 -1
- package/lib/bridge/shared.d.ts +0 -6
- package/lib/bridge/shared.d.ts.map +0 -1
- package/lib/bridge/shared.js +0 -78
- package/lib/bridge/shared.js.map +0 -1
- package/lib/families/algorand/bridge/libcore.d.ts +0 -17
- package/lib/families/algorand/bridge/libcore.d.ts.map +0 -1
- package/lib/families/algorand/bridge/libcore.js +0 -404
- package/lib/families/algorand/bridge/libcore.js.map +0 -1
- package/lib/families/algorand/buildASAOperation.d.ts +0 -8
- package/lib/families/algorand/buildASAOperation.d.ts.map +0 -1
- package/lib/families/algorand/buildASAOperation.js +0 -140
- package/lib/families/algorand/buildASAOperation.js.map +0 -1
- package/lib/families/algorand/libcore-broadcast.d.ts +0 -3
- package/lib/families/algorand/libcore-broadcast.d.ts.map +0 -1
- package/lib/families/algorand/libcore-broadcast.js +0 -63
- package/lib/families/algorand/libcore-broadcast.js.map +0 -1
- package/lib/families/algorand/libcore-buildOperation.d.ts +0 -7
- package/lib/families/algorand/libcore-buildOperation.d.ts.map +0 -1
- package/lib/families/algorand/libcore-buildOperation.js +0 -131
- package/lib/families/algorand/libcore-buildOperation.js.map +0 -1
- package/lib/families/algorand/libcore-buildSubAccounts.d.ts +0 -11
- package/lib/families/algorand/libcore-buildSubAccounts.d.ts.map +0 -1
- package/lib/families/algorand/libcore-buildSubAccounts.js +0 -221
- package/lib/families/algorand/libcore-buildSubAccounts.js.map +0 -1
- package/lib/families/algorand/libcore-buildTransaction.d.ts +0 -13
- package/lib/families/algorand/libcore-buildTransaction.d.ts.map +0 -1
- package/lib/families/algorand/libcore-buildTransaction.js +0 -144
- package/lib/families/algorand/libcore-buildTransaction.js.map +0 -1
- package/lib/families/algorand/libcore-getFeesForTransaction.d.ts +0 -17
- package/lib/families/algorand/libcore-getFeesForTransaction.d.ts.map +0 -1
- package/lib/families/algorand/libcore-getFeesForTransaction.js.map +0 -1
- package/lib/families/algorand/libcore-postBuildAccount.d.ts +0 -8
- package/lib/families/algorand/libcore-postBuildAccount.d.ts.map +0 -1
- package/lib/families/algorand/libcore-postBuildAccount.js +0 -99
- package/lib/families/algorand/libcore-postBuildAccount.js.map +0 -1
- package/lib/families/algorand/libcore-signOperation.d.ts +0 -4
- package/lib/families/algorand/libcore-signOperation.d.ts.map +0 -1
- package/lib/families/algorand/libcore-signOperation.js +0 -146
- package/lib/families/algorand/libcore-signOperation.js.map +0 -1
- package/lib/families/bitcoin/bridge/libcore.d.ts +0 -8
- package/lib/families/bitcoin/bridge/libcore.d.ts.map +0 -1
- package/lib/families/bitcoin/bridge/libcore.js +0 -333
- package/lib/families/bitcoin/bridge/libcore.js.map +0 -1
- package/lib/families/bitcoin/customAddressValidation.d.ts +0 -8
- package/lib/families/bitcoin/customAddressValidation.d.ts.map +0 -1
- package/lib/families/bitcoin/customAddressValidation.js +0 -67
- package/lib/families/bitcoin/customAddressValidation.js.map +0 -1
- package/lib/families/bitcoin/libcore-broadcast.d.ts +0 -3
- package/lib/families/bitcoin/libcore-broadcast.d.ts.map +0 -1
- package/lib/families/bitcoin/libcore-broadcast.js +0 -61
- package/lib/families/bitcoin/libcore-broadcast.js.map +0 -1
- package/lib/families/bitcoin/libcore-buildOperation.d.ts +0 -9
- package/lib/families/bitcoin/libcore-buildOperation.d.ts.map +0 -1
- package/lib/families/bitcoin/libcore-buildOperation.js +0 -74
- package/lib/families/bitcoin/libcore-buildOperation.js.map +0 -1
- package/lib/families/bitcoin/libcore-buildTransaction.d.ts +0 -14
- package/lib/families/bitcoin/libcore-buildTransaction.d.ts.map +0 -1
- package/lib/families/bitcoin/libcore-buildTransaction.js +0 -199
- package/lib/families/bitcoin/libcore-buildTransaction.js.map +0 -1
- package/lib/families/bitcoin/libcore-getAccountNetworkInfo.d.ts +0 -12
- package/lib/families/bitcoin/libcore-getAccountNetworkInfo.d.ts.map +0 -1
- package/lib/families/bitcoin/libcore-getAccountNetworkInfo.js +0 -87
- package/lib/families/bitcoin/libcore-getAccountNetworkInfo.js.map +0 -1
- package/lib/families/bitcoin/libcore-getAccountNetworkInfo.test.d.ts +0 -2
- package/lib/families/bitcoin/libcore-getAccountNetworkInfo.test.d.ts.map +0 -1
- package/lib/families/bitcoin/libcore-getAccountNetworkInfo.test.js +0 -71
- package/lib/families/bitcoin/libcore-getAccountNetworkInfo.test.js.map +0 -1
- package/lib/families/bitcoin/libcore-getFeesForTransaction.d.ts +0 -10
- package/lib/families/bitcoin/libcore-getFeesForTransaction.d.ts.map +0 -1
- package/lib/families/bitcoin/libcore-getFeesForTransaction.js +0 -110
- package/lib/families/bitcoin/libcore-getFeesForTransaction.js.map +0 -1
- package/lib/families/bitcoin/libcore-postBuildAccount.d.ts +0 -8
- package/lib/families/bitcoin/libcore-postBuildAccount.d.ts.map +0 -1
- package/lib/families/bitcoin/libcore-postBuildAccount.js +0 -108
- package/lib/families/bitcoin/libcore-postBuildAccount.js.map +0 -1
- package/lib/families/bitcoin/libcore-signOperation.d.ts +0 -4
- package/lib/families/bitcoin/libcore-signOperation.d.ts.map +0 -1
- package/lib/families/bitcoin/libcore-signOperation.js +0 -328
- package/lib/families/bitcoin/libcore-signOperation.js.map +0 -1
- package/lib/families/cosmos/bridge/libcore.d.ts +0 -8
- package/lib/families/cosmos/bridge/libcore.d.ts.map +0 -1
- package/lib/families/cosmos/bridge/libcore.js +0 -216
- package/lib/families/cosmos/bridge/libcore.js.map +0 -1
- package/lib/families/cosmos/libcore-broadcast.d.ts +0 -3
- package/lib/families/cosmos/libcore-broadcast.d.ts.map +0 -1
- package/lib/families/cosmos/libcore-broadcast.js +0 -66
- package/lib/families/cosmos/libcore-broadcast.js.map +0 -1
- package/lib/families/cosmos/libcore-buildOperation.d.ts +0 -8
- package/lib/families/cosmos/libcore-buildOperation.d.ts.map +0 -1
- package/lib/families/cosmos/libcore-buildOperation.js +0 -217
- package/lib/families/cosmos/libcore-buildOperation.js.map +0 -1
- package/lib/families/cosmos/libcore-buildTransaction.d.ts +0 -14
- package/lib/families/cosmos/libcore-buildTransaction.d.ts.map +0 -1
- package/lib/families/cosmos/libcore-buildTransaction.js +0 -275
- package/lib/families/cosmos/libcore-buildTransaction.js.map +0 -1
- package/lib/families/cosmos/libcore-getFeesForTransaction.d.ts +0 -18
- package/lib/families/cosmos/libcore-getFeesForTransaction.d.ts.map +0 -1
- package/lib/families/cosmos/libcore-getFeesForTransaction.js +0 -84
- package/lib/families/cosmos/libcore-getFeesForTransaction.js.map +0 -1
- package/lib/families/cosmos/libcore-getTransactionStatus.d.ts +0 -5
- package/lib/families/cosmos/libcore-getTransactionStatus.d.ts.map +0 -1
- package/lib/families/cosmos/libcore-getTransactionStatus.js +0 -272
- package/lib/families/cosmos/libcore-getTransactionStatus.js.map +0 -1
- package/lib/families/cosmos/libcore-mergeOperations.d.ts +0 -4
- package/lib/families/cosmos/libcore-mergeOperations.d.ts.map +0 -1
- package/lib/families/cosmos/libcore-mergeOperations.js +0 -49
- package/lib/families/cosmos/libcore-mergeOperations.js.map +0 -1
- package/lib/families/cosmos/libcore-postBuildAccount.d.ts +0 -8
- package/lib/families/cosmos/libcore-postBuildAccount.d.ts.map +0 -1
- package/lib/families/cosmos/libcore-postBuildAccount.js +0 -313
- package/lib/families/cosmos/libcore-postBuildAccount.js.map +0 -1
- package/lib/families/cosmos/libcore-signOperation.d.ts +0 -4
- package/lib/families/cosmos/libcore-signOperation.d.ts.map +0 -1
- package/lib/families/cosmos/libcore-signOperation.js +0 -142
- package/lib/families/cosmos/libcore-signOperation.js.map +0 -1
- package/lib/families/cosmos/message.d.ts +0 -5
- package/lib/families/cosmos/message.d.ts.map +0 -1
- package/lib/families/cosmos/message.js +0 -233
- package/lib/families/cosmos/message.js.map +0 -1
- package/lib/families/cosmos/test-specifics.d.ts +0 -3
- package/lib/families/cosmos/test-specifics.d.ts.map +0 -1
- package/lib/families/cosmos/test-specifics.js +0 -307
- package/lib/families/cosmos/test-specifics.js.map +0 -1
- package/lib/families/ethereum/nft.merging.unit.test.d.ts +0 -2
- package/lib/families/ethereum/nft.merging.unit.test.d.ts.map +0 -1
- package/lib/families/ethereum/nft.merging.unit.test.js.map +0 -1
- package/lib/families/filecoin/customAddressValidation.d.ts +0 -8
- package/lib/families/filecoin/customAddressValidation.d.ts.map +0 -1
- package/lib/families/filecoin/customAddressValidation.js +0 -50
- package/lib/families/filecoin/customAddressValidation.js.map +0 -1
- package/lib/families/polkadot/test-specifics.d.ts +0 -3
- package/lib/families/polkadot/test-specifics.d.ts.map +0 -1
- package/lib/families/polkadot/test-specifics.js +0 -91
- package/lib/families/polkadot/test-specifics.js.map +0 -1
- package/lib/families/tezos/bridge/libcore.d.ts +0 -14
- package/lib/families/tezos/bridge/libcore.d.ts.map +0 -1
- package/lib/families/tezos/bridge/libcore.js +0 -336
- package/lib/families/tezos/bridge/libcore.js.map +0 -1
- package/lib/families/tezos/libcore-broadcast.d.ts +0 -3
- package/lib/families/tezos/libcore-broadcast.d.ts.map +0 -1
- package/lib/families/tezos/libcore-broadcast.js +0 -61
- package/lib/families/tezos/libcore-broadcast.js.map +0 -1
- package/lib/families/tezos/libcore-buildOperation.d.ts +0 -7
- package/lib/families/tezos/libcore-buildOperation.d.ts.map +0 -1
- package/lib/families/tezos/libcore-buildOperation.js +0 -93
- package/lib/families/tezos/libcore-buildOperation.js.map +0 -1
- package/lib/families/tezos/libcore-buildSubAccounts.d.ts +0 -11
- package/lib/families/tezos/libcore-buildSubAccounts.d.ts.map +0 -1
- package/lib/families/tezos/libcore-buildSubAccounts.js +0 -214
- package/lib/families/tezos/libcore-buildSubAccounts.js.map +0 -1
- package/lib/families/tezos/libcore-buildTransaction.d.ts +0 -14
- package/lib/families/tezos/libcore-buildTransaction.d.ts.map +0 -1
- package/lib/families/tezos/libcore-buildTransaction.js +0 -225
- package/lib/families/tezos/libcore-buildTransaction.js.map +0 -1
- package/lib/families/tezos/libcore-getAccountNetworkInfo.d.ts +0 -11
- package/lib/families/tezos/libcore-getAccountNetworkInfo.d.ts.map +0 -1
- package/lib/families/tezos/libcore-getAccountNetworkInfo.js +0 -66
- package/lib/families/tezos/libcore-getAccountNetworkInfo.js.map +0 -1
- package/lib/families/tezos/libcore-getFeesForTransaction.d.ts +0 -18
- package/lib/families/tezos/libcore-getFeesForTransaction.d.ts.map +0 -1
- package/lib/families/tezos/libcore-getFeesForTransaction.js +0 -73
- package/lib/families/tezos/libcore-getFeesForTransaction.js.map +0 -1
- package/lib/families/tezos/libcore-signOperation.d.ts +0 -4
- package/lib/families/tezos/libcore-signOperation.d.ts.map +0 -1
- package/lib/families/tezos/libcore-signOperation.js +0 -187
- package/lib/families/tezos/libcore-signOperation.js.map +0 -1
- package/lib/families/tezos/test-specifics.d.ts +0 -3
- package/lib/families/tezos/test-specifics.d.ts.map +0 -1
- package/lib/families/tezos/test-specifics.js.map +0 -1
- package/lib/families/tron/test-specifics.d.ts +0 -3
- package/lib/families/tron/test-specifics.d.ts.map +0 -1
- package/lib/families/tron/test-specifics.js +0 -205
- package/lib/families/tron/test-specifics.js.map +0 -1
- package/lib/generated/bridge/libcore.d.ts +0 -20
- package/lib/generated/bridge/libcore.d.ts.map +0 -1
- package/lib/generated/bridge/libcore.js +0 -16
- package/lib/generated/bridge/libcore.js.map +0 -1
- package/lib/generated/libcore-buildOperation.d.ts +0 -12
- package/lib/generated/libcore-buildOperation.d.ts.map +0 -1
- package/lib/generated/libcore-buildOperation.js +0 -16
- package/lib/generated/libcore-buildOperation.js.map +0 -1
- package/lib/generated/libcore-buildSubAccounts.d.ts +0 -8
- package/lib/generated/libcore-buildSubAccounts.d.ts.map +0 -1
- package/lib/generated/libcore-buildSubAccounts.js +0 -12
- package/lib/generated/libcore-buildSubAccounts.js.map +0 -1
- package/lib/generated/libcore-getAccountNetworkInfo.d.ts +0 -8
- package/lib/generated/libcore-getAccountNetworkInfo.d.ts.map +0 -1
- package/lib/generated/libcore-getAccountNetworkInfo.js +0 -12
- package/lib/generated/libcore-getAccountNetworkInfo.js.map +0 -1
- package/lib/generated/libcore-getFeesForTransaction.d.ts +0 -12
- package/lib/generated/libcore-getFeesForTransaction.d.ts.map +0 -1
- package/lib/generated/libcore-getFeesForTransaction.js +0 -16
- package/lib/generated/libcore-getFeesForTransaction.js.map +0 -1
- package/lib/generated/libcore-mergeOperations.d.ts +0 -5
- package/lib/generated/libcore-mergeOperations.d.ts.map +0 -1
- package/lib/generated/libcore-mergeOperations.js +0 -10
- package/lib/generated/libcore-mergeOperations.js.map +0 -1
- package/lib/generated/libcore-postBuildAccount.d.ts +0 -16
- package/lib/generated/libcore-postBuildAccount.d.ts.map +0 -1
- package/lib/generated/libcore-postBuildAccount.js +0 -14
- package/lib/generated/libcore-postBuildAccount.js.map +0 -1
- package/lib/generated/libcore-postSyncPatch.d.ts +0 -3
- package/lib/generated/libcore-postSyncPatch.d.ts.map +0 -1
- package/lib/generated/libcore-postSyncPatch.js +0 -4
- package/lib/generated/libcore-postSyncPatch.js.map +0 -1
- package/lib/generated/test-specifics.d.ts +0 -8
- package/lib/generated/test-specifics.d.ts.map +0 -1
- package/lib/generated/test-specifics.js +0 -16
- package/lib/generated/test-specifics.js.map +0 -1
- package/lib/libcore/access.d.ts +0 -11
- package/lib/libcore/access.d.ts.map +0 -1
- package/lib/libcore/access.js +0 -229
- package/lib/libcore/access.js.map +0 -1
- package/lib/libcore/broadcast.d.ts +0 -14
- package/lib/libcore/broadcast.d.ts.map +0 -1
- package/lib/libcore/broadcast.js +0 -68
- package/lib/libcore/broadcast.js.map +0 -1
- package/lib/libcore/buildAccount/buildOperation.d.ts +0 -15
- package/lib/libcore/buildAccount/buildOperation.d.ts.map +0 -1
- package/lib/libcore/buildAccount/buildOperation.js +0 -162
- package/lib/libcore/buildAccount/buildOperation.js.map +0 -1
- package/lib/libcore/buildAccount/buildSubAccounts.d.ts +0 -12
- package/lib/libcore/buildAccount/buildSubAccounts.d.ts.map +0 -1
- package/lib/libcore/buildAccount/buildSubAccounts.js.map +0 -1
- package/lib/libcore/buildAccount/index.d.ts +0 -15
- package/lib/libcore/buildAccount/index.d.ts.map +0 -1
- package/lib/libcore/buildAccount/index.js +0 -339
- package/lib/libcore/buildAccount/index.js.map +0 -1
- package/lib/libcore/buildBigNumber.d.ts +0 -7
- package/lib/libcore/buildBigNumber.d.ts.map +0 -1
- package/lib/libcore/buildBigNumber.js.map +0 -1
- package/lib/libcore/createAccountFromDevice.d.ts +0 -23
- package/lib/libcore/createAccountFromDevice.d.ts.map +0 -1
- package/lib/libcore/createAccountFromDevice.js +0 -143
- package/lib/libcore/createAccountFromDevice.js.map +0 -1
- package/lib/libcore/errors.d.ts +0 -6
- package/lib/libcore/errors.d.ts.map +0 -1
- package/lib/libcore/errors.js +0 -27
- package/lib/libcore/errors.js.map +0 -1
- package/lib/libcore/getAccountBalanceHistory.d.ts +0 -5
- package/lib/libcore/getAccountBalanceHistory.d.ts.map +0 -1
- package/lib/libcore/getAccountBalanceHistory.js +0 -87
- package/lib/libcore/getAccountBalanceHistory.js.map +0 -1
- package/lib/libcore/getAccountNetworkInfo.d.ts +0 -6
- package/lib/libcore/getAccountNetworkInfo.d.ts.map +0 -1
- package/lib/libcore/getAccountNetworkInfo.js +0 -91
- package/lib/libcore/getAccountNetworkInfo.js.map +0 -1
- package/lib/libcore/getCoreAccount.d.ts +0 -8
- package/lib/libcore/getCoreAccount.d.ts.map +0 -1
- package/lib/libcore/getCoreAccount.js +0 -78
- package/lib/libcore/getCoreAccount.js.map +0 -1
- package/lib/libcore/getFeesForTransaction.d.ts +0 -17
- package/lib/libcore/getFeesForTransaction.d.ts.map +0 -1
- package/lib/libcore/getFeesForTransaction.js +0 -87
- package/lib/libcore/getFeesForTransaction.js.map +0 -1
- package/lib/libcore/getOrCreateAccount.d.ts +0 -11
- package/lib/libcore/getOrCreateAccount.d.ts.map +0 -1
- package/lib/libcore/getOrCreateAccount.js +0 -142
- package/lib/libcore/getOrCreateAccount.js.map +0 -1
- package/lib/libcore/getOrCreateWallet.d.ts +0 -12
- package/lib/libcore/getOrCreateWallet.d.ts.map +0 -1
- package/lib/libcore/getOrCreateWallet.js +0 -138
- package/lib/libcore/getOrCreateWallet.js.map +0 -1
- package/lib/libcore/isValidRecipient.d.ts +0 -8
- package/lib/libcore/isValidRecipient.d.ts.map +0 -1
- package/lib/libcore/isValidRecipient.js +0 -78
- package/lib/libcore/isValidRecipient.js.map +0 -1
- package/lib/libcore/nativeSegwitAppsVersionsMap.d.ts +0 -6
- package/lib/libcore/nativeSegwitAppsVersionsMap.d.ts.map +0 -1
- package/lib/libcore/nativeSegwitAppsVersionsMap.js +0 -7
- package/lib/libcore/nativeSegwitAppsVersionsMap.js.map +0 -1
- package/lib/libcore/platforms/nodejs.d.ts +0 -7
- package/lib/libcore/platforms/nodejs.d.ts.map +0 -1
- package/lib/libcore/platforms/nodejs.js +0 -613
- package/lib/libcore/platforms/nodejs.js.map +0 -1
- package/lib/libcore/platforms/react-native.d.ts +0 -5
- package/lib/libcore/platforms/react-native.d.ts.map +0 -1
- package/lib/libcore/platforms/react-native.js +0 -286
- package/lib/libcore/platforms/react-native.js.map +0 -1
- package/lib/libcore/scanAccounts.d.ts +0 -12
- package/lib/libcore/scanAccounts.d.ts.map +0 -1
- package/lib/libcore/scanAccounts.js +0 -285
- package/lib/libcore/scanAccounts.js.map +0 -1
- package/lib/libcore/signOperation.d.ts +0 -38
- package/lib/libcore/signOperation.d.ts.map +0 -1
- package/lib/libcore/signOperation.js +0 -149
- package/lib/libcore/signOperation.js.map +0 -1
- package/lib/libcore/syncAccount.d.ts +0 -18
- package/lib/libcore/syncAccount.d.ts.map +0 -1
- package/lib/libcore/syncAccount.js +0 -165
- package/lib/libcore/syncAccount.js.map +0 -1
- package/lib/libcore/types/index.d.ts +0 -185
- package/lib/libcore/types/index.d.ts.map +0 -1
- package/lib/libcore/types/index.js +0 -359
- package/lib/libcore/types/index.js.map +0 -1
- package/src/__tests__/all.libcore.ts +0 -90
- package/src/__tests__/test-helpers/implement-react-native-libcore/index.ts +0 -6
- package/src/__tests__/test-helpers/implement-react-native-libcore/specific.android.ts +0 -4
- package/src/__tests__/test-helpers/implement-react-native-libcore/specific.ios.ts +0 -4
- package/src/bridge/shared.ts +0 -38
- package/src/families/algorand/bridge/libcore.ts +0 -345
- package/src/families/algorand/buildASAOperation.ts +0 -66
- package/src/families/algorand/libcore-broadcast.ts +0 -18
- package/src/families/algorand/libcore-buildOperation.ts +0 -69
- package/src/families/algorand/libcore-buildSubAccounts.ts +0 -132
- package/src/families/algorand/libcore-buildTransaction.ts +0 -115
- package/src/families/algorand/libcore-getFeesForTransaction.ts +0 -25
- package/src/families/algorand/libcore-postBuildAccount.ts +0 -42
- package/src/families/algorand/libcore-signOperation.ts +0 -104
- package/src/families/bitcoin/bridge/libcore.ts +0 -297
- package/src/families/bitcoin/customAddressValidation.ts +0 -30
- package/src/families/bitcoin/libcore-broadcast.ts +0 -15
- package/src/families/bitcoin/libcore-buildOperation.ts +0 -38
- package/src/families/bitcoin/libcore-buildTransaction.ts +0 -118
- package/src/families/bitcoin/libcore-getAccountNetworkInfo.test.ts +0 -27
- package/src/families/bitcoin/libcore-getAccountNetworkInfo.ts +0 -50
- package/src/families/bitcoin/libcore-getFeesForTransaction.ts +0 -67
- package/src/families/bitcoin/libcore-postBuildAccount.ts +0 -70
- package/src/families/bitcoin/libcore-signOperation.ts +0 -227
- package/src/families/cosmos/bridge/libcore.ts +0 -177
- package/src/families/cosmos/libcore-broadcast.ts +0 -24
- package/src/families/cosmos/libcore-buildOperation.ts +0 -121
- package/src/families/cosmos/libcore-buildTransaction.ts +0 -212
- package/src/families/cosmos/libcore-getFeesForTransaction.ts +0 -27
- package/src/families/cosmos/libcore-getTransactionStatus.ts +0 -299
- package/src/families/cosmos/libcore-mergeOperations.ts +0 -43
- package/src/families/cosmos/libcore-postBuildAccount.ts +0 -177
- package/src/families/cosmos/libcore-signOperation.ts +0 -96
- package/src/families/cosmos/message.ts +0 -155
- package/src/families/cosmos/test-specifics.ts +0 -225
- package/src/families/ethereum/nft.merging.unit.test.ts +0 -78
- package/src/families/filecoin/customAddressValidation.ts +0 -19
- package/src/families/polkadot/test-specifics.ts +0 -70
- package/src/families/tezos/bridge/libcore.ts +0 -312
- package/src/families/tezos/libcore-broadcast.ts +0 -16
- package/src/families/tezos/libcore-buildOperation.ts +0 -52
- package/src/families/tezos/libcore-buildSubAccounts.ts +0 -137
- package/src/families/tezos/libcore-buildTransaction.ts +0 -154
- package/src/families/tezos/libcore-getAccountNetworkInfo.ts +0 -25
- package/src/families/tezos/libcore-getFeesForTransaction.ts +0 -27
- package/src/families/tezos/libcore-signOperation.ts +0 -122
- package/src/families/tezos/test-specifics.ts +0 -19
- package/src/families/tron/test-specifics.ts +0 -137
- package/src/generated/bridge/libcore.ts +0 -15
- package/src/generated/libcore-buildOperation.ts +0 -15
- package/src/generated/libcore-buildSubAccounts.ts +0 -9
- package/src/generated/libcore-getAccountNetworkInfo.ts +0 -9
- package/src/generated/libcore-getFeesForTransaction.ts +0 -15
- package/src/generated/libcore-mergeOperations.ts +0 -6
- package/src/generated/libcore-postBuildAccount.ts +0 -12
- package/src/generated/libcore-postSyncPatch.ts +0 -3
- package/src/generated/test-specifics.ts +0 -15
- package/src/libcore/access.ts +0 -135
- package/src/libcore/broadcast.ts +0 -34
- package/src/libcore/buildAccount/buildOperation.ts +0 -96
- package/src/libcore/buildAccount/buildSubAccounts.ts +0 -24
- package/src/libcore/buildAccount/index.ts +0 -259
- package/src/libcore/buildBigNumber.ts +0 -28
- package/src/libcore/createAccountFromDevice.ts +0 -108
- package/src/libcore/errors.ts +0 -20
- package/src/libcore/getAccountBalanceHistory.ts +0 -56
- package/src/libcore/getAccountNetworkInfo.ts +0 -46
- package/src/libcore/getCoreAccount.ts +0 -37
- package/src/libcore/getFeesForTransaction.ts +0 -46
- package/src/libcore/getOrCreateAccount.ts +0 -93
- package/src/libcore/getOrCreateWallet.ts +0 -91
- package/src/libcore/isValidRecipient.ts +0 -36
- package/src/libcore/nativeSegwitAppsVersionsMap.ts +0 -4
- package/src/libcore/platforms/nodejs.ts +0 -627
- package/src/libcore/platforms/react-native.ts +0 -242
- package/src/libcore/scanAccounts.ts +0 -280
- package/src/libcore/signOperation.ts +0 -141
- package/src/libcore/syncAccount.ts +0 -152
- package/src/libcore/types/index.ts +0 -645
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import invariant from "invariant";
|
|
2
|
-
import { BigNumber } from "bignumber.js";
|
|
3
|
-
import {
|
|
4
|
-
AmountRequired,
|
|
5
|
-
NotEnoughBalance,
|
|
6
|
-
NotEnoughBalanceToDelegate,
|
|
7
|
-
NotEnoughBalanceInParentAccount,
|
|
8
|
-
FeeNotLoaded,
|
|
9
|
-
FeeTooHigh,
|
|
10
|
-
NotSupportedLegacyAddress,
|
|
11
|
-
InvalidAddressBecauseDestinationIsAlsoSource,
|
|
12
|
-
RecommendSubAccountsToEmpty,
|
|
13
|
-
RecommendUndelegation,
|
|
14
|
-
} from "@ledgerhq/errors";
|
|
15
|
-
import { validateRecipient } from "../../../bridge/shared";
|
|
16
|
-
import type { Account, AccountBridge, CurrencyBridge } from "../../../types";
|
|
17
|
-
import type { Transaction } from "../types";
|
|
18
|
-
import { scanAccounts } from "../../../libcore/scanAccounts";
|
|
19
|
-
import { getAccountNetworkInfo } from "../../../libcore/getAccountNetworkInfo";
|
|
20
|
-
import { sync } from "../../../libcore/syncAccount";
|
|
21
|
-
import { getFeesForTransaction } from "../../../libcore/getFeesForTransaction";
|
|
22
|
-
import broadcast from "../libcore-broadcast";
|
|
23
|
-
import signOperation from "../libcore-signOperation";
|
|
24
|
-
import { makeLRUCache } from "../../../cache";
|
|
25
|
-
import { isAccountBalanceSignificant, getMainAccount } from "../../../account";
|
|
26
|
-
import { withLibcore } from "../../../libcore/access";
|
|
27
|
-
import { libcoreBigIntToBigNumber } from "../../../libcore/buildBigNumber";
|
|
28
|
-
import { getCoreAccount } from "../../../libcore/getCoreAccount";
|
|
29
|
-
import { fetchAllBakers, hydrateBakers, isAccountDelegating } from "../bakers";
|
|
30
|
-
import { getEnv } from "../../../env";
|
|
31
|
-
import { makeAccountBridgeReceive } from "../../../bridge/jsHelpers";
|
|
32
|
-
|
|
33
|
-
const receive = makeAccountBridgeReceive();
|
|
34
|
-
|
|
35
|
-
type EstimateGasLimitAndStorage = (
|
|
36
|
-
arg0: Account,
|
|
37
|
-
arg1: string
|
|
38
|
-
) => Promise<{
|
|
39
|
-
gasLimit: BigNumber;
|
|
40
|
-
storage: BigNumber;
|
|
41
|
-
}>;
|
|
42
|
-
|
|
43
|
-
export const estimateGasLimitAndStorage: EstimateGasLimitAndStorage =
|
|
44
|
-
makeLRUCache(
|
|
45
|
-
(account, addr) =>
|
|
46
|
-
withLibcore(async (core) => {
|
|
47
|
-
const { coreAccount } = await getCoreAccount(core, account);
|
|
48
|
-
const tezosLikeAccount = await coreAccount.asTezosLikeAccount();
|
|
49
|
-
const gasLimit = await libcoreBigIntToBigNumber(
|
|
50
|
-
await tezosLikeAccount.getEstimatedGasLimit(addr)
|
|
51
|
-
);
|
|
52
|
-
// for babylon network 257 is the current cost of sending to new account.
|
|
53
|
-
const storage = new BigNumber(257);
|
|
54
|
-
|
|
55
|
-
/*
|
|
56
|
-
const storage = await libcoreBigIntToBigNumber(
|
|
57
|
-
await tezosLikeAccount.getStorage(addr)
|
|
58
|
-
);
|
|
59
|
-
*/
|
|
60
|
-
return {
|
|
61
|
-
gasLimit,
|
|
62
|
-
storage,
|
|
63
|
-
};
|
|
64
|
-
}),
|
|
65
|
-
(a, addr) => a.id + "|" + addr
|
|
66
|
-
);
|
|
67
|
-
const calculateFees = makeLRUCache(
|
|
68
|
-
async (a, t) => {
|
|
69
|
-
return getFeesForTransaction({
|
|
70
|
-
account: a,
|
|
71
|
-
transaction: t,
|
|
72
|
-
});
|
|
73
|
-
},
|
|
74
|
-
(a, t) =>
|
|
75
|
-
`${a.id}_${t.amount.toString()}_${t.recipient}_${
|
|
76
|
-
t.gasLimit ? t.gasLimit.toString() : ""
|
|
77
|
-
}_${t.fees ? t.fees.toString() : ""}_${
|
|
78
|
-
t.storageLimit ? t.storageLimit.toString() : ""
|
|
79
|
-
}_${String(t.useAllAmount)}_${String(t.subAccountId)}`
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const createTransaction = (): Transaction => ({
|
|
83
|
-
family: "tezos",
|
|
84
|
-
mode: "send",
|
|
85
|
-
amount: new BigNumber(0),
|
|
86
|
-
fees: null,
|
|
87
|
-
gasLimit: null,
|
|
88
|
-
storageLimit: null,
|
|
89
|
-
recipient: "",
|
|
90
|
-
networkInfo: null,
|
|
91
|
-
useAllAmount: false,
|
|
92
|
-
taquitoError: null,
|
|
93
|
-
estimatedFees: null,
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const updateTransaction = (t, patch) => ({ ...t, ...patch });
|
|
97
|
-
|
|
98
|
-
const getTransactionStatus = async (a, t) => {
|
|
99
|
-
const errors: {
|
|
100
|
-
recipient?: Error;
|
|
101
|
-
amount?: Error;
|
|
102
|
-
fees?: Error;
|
|
103
|
-
} = {};
|
|
104
|
-
const warnings: {
|
|
105
|
-
amount?: Error;
|
|
106
|
-
feeTooHigh?: Error;
|
|
107
|
-
recipient?: Error;
|
|
108
|
-
} = {};
|
|
109
|
-
const subAcc = !t.subAccountId
|
|
110
|
-
? null
|
|
111
|
-
: a.subAccounts && a.subAccounts.find((ta) => ta.id === t.subAccountId);
|
|
112
|
-
invariant(
|
|
113
|
-
t.mode === "send" || !subAcc,
|
|
114
|
-
"delegation features not supported for sub accounts"
|
|
115
|
-
);
|
|
116
|
-
const account = subAcc || a;
|
|
117
|
-
|
|
118
|
-
if (t.mode !== "undelegate") {
|
|
119
|
-
if (account.freshAddress === t.recipient) {
|
|
120
|
-
errors.recipient = new InvalidAddressBecauseDestinationIsAlsoSource();
|
|
121
|
-
} else {
|
|
122
|
-
const { recipientError, recipientWarning } = await validateRecipient(
|
|
123
|
-
a.currency,
|
|
124
|
-
t.recipient
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
if (recipientError) {
|
|
128
|
-
errors.recipient = recipientError;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (recipientWarning) {
|
|
132
|
-
warnings.recipient = recipientWarning;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (
|
|
138
|
-
!getEnv("LEGACY_KT_SUPPORT_TO_YOUR_OWN_RISK") &&
|
|
139
|
-
t.recipient.startsWith("KT") &&
|
|
140
|
-
!errors.recipient
|
|
141
|
-
) {
|
|
142
|
-
errors.recipient = new NotSupportedLegacyAddress();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
let estimatedFees = new BigNumber(0);
|
|
146
|
-
let amount = t.amount;
|
|
147
|
-
|
|
148
|
-
if (!t.fees) {
|
|
149
|
-
errors.fees = new FeeNotLoaded();
|
|
150
|
-
} else if (!errors.recipient) {
|
|
151
|
-
await calculateFees(a, t).then(
|
|
152
|
-
(res) => {
|
|
153
|
-
estimatedFees = res.estimatedFees;
|
|
154
|
-
amount = res.value;
|
|
155
|
-
},
|
|
156
|
-
(error) => {
|
|
157
|
-
if (error.name === "NotEnoughBalance") {
|
|
158
|
-
errors.amount = error;
|
|
159
|
-
} else {
|
|
160
|
-
throw error;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (!errors.amount && subAcc && estimatedFees.gt(a.balance)) {
|
|
167
|
-
errors.amount = new NotEnoughBalanceInParentAccount();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
let totalSpent = !t.useAllAmount
|
|
171
|
-
? t.amount.plus(estimatedFees)
|
|
172
|
-
: account.balance;
|
|
173
|
-
|
|
174
|
-
if (
|
|
175
|
-
!errors.recipient &&
|
|
176
|
-
!errors.amount &&
|
|
177
|
-
(amount.lt(0) || totalSpent.gt(account.balance))
|
|
178
|
-
) {
|
|
179
|
-
errors.amount = new NotEnoughBalance();
|
|
180
|
-
totalSpent = new BigNumber(0);
|
|
181
|
-
amount = new BigNumber(0);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (t.mode === "send") {
|
|
185
|
-
if (!errors.amount && amount.eq(0)) {
|
|
186
|
-
errors.amount = new AmountRequired();
|
|
187
|
-
} else if (amount.gt(0) && estimatedFees.times(10).gt(amount)) {
|
|
188
|
-
warnings.feeTooHigh = new FeeTooHigh();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const thresholdWarning = 0.5 * 10 ** a.currency.units[0].magnitude;
|
|
192
|
-
|
|
193
|
-
if (
|
|
194
|
-
!subAcc &&
|
|
195
|
-
!errors.amount &&
|
|
196
|
-
account.balance.minus(totalSpent).lt(thresholdWarning)
|
|
197
|
-
) {
|
|
198
|
-
if (isAccountDelegating(account)) {
|
|
199
|
-
warnings.amount = new RecommendUndelegation();
|
|
200
|
-
} else if ((a.subAccounts || []).some(isAccountBalanceSignificant)) {
|
|
201
|
-
warnings.amount = new RecommendSubAccountsToEmpty();
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
// delegation case, we remap NotEnoughBalance to a more precise error
|
|
206
|
-
if (errors.amount instanceof NotEnoughBalance) {
|
|
207
|
-
errors.amount = new NotEnoughBalanceToDelegate();
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return Promise.resolve({
|
|
212
|
-
errors,
|
|
213
|
-
warnings,
|
|
214
|
-
estimatedFees,
|
|
215
|
-
amount,
|
|
216
|
-
totalSpent,
|
|
217
|
-
});
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
const prepareTransaction = async (a, t) => {
|
|
221
|
-
let networkInfo = t.networkInfo;
|
|
222
|
-
|
|
223
|
-
if (!networkInfo) {
|
|
224
|
-
const ni = await getAccountNetworkInfo(a);
|
|
225
|
-
invariant(ni.family === "tezos", "tezos networkInfo expected");
|
|
226
|
-
networkInfo = ni;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
let gasLimit = t.gasLimit;
|
|
230
|
-
let storageLimit = t.storageLimit;
|
|
231
|
-
|
|
232
|
-
if (!gasLimit || !storageLimit) {
|
|
233
|
-
const { recipientError } =
|
|
234
|
-
t.mode === "undelegate"
|
|
235
|
-
? { recipientError: undefined }
|
|
236
|
-
: await validateRecipient(a.currency, t.recipient);
|
|
237
|
-
|
|
238
|
-
if (!recipientError) {
|
|
239
|
-
const r = await estimateGasLimitAndStorage(a, t.recipient);
|
|
240
|
-
gasLimit = r.gasLimit;
|
|
241
|
-
storageLimit = r.storage;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const fees = t.fees || networkInfo.fees;
|
|
246
|
-
|
|
247
|
-
if (
|
|
248
|
-
t.networkInfo !== networkInfo ||
|
|
249
|
-
t.gasLimit !== gasLimit ||
|
|
250
|
-
t.storageLimit !== storageLimit ||
|
|
251
|
-
t.fees !== fees
|
|
252
|
-
) {
|
|
253
|
-
return { ...t, networkInfo, storageLimit, gasLimit, fees };
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
return t;
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
const estimateMaxSpendable = async ({
|
|
260
|
-
account,
|
|
261
|
-
parentAccount,
|
|
262
|
-
transaction,
|
|
263
|
-
}) => {
|
|
264
|
-
const mainAccount = getMainAccount(account, parentAccount);
|
|
265
|
-
const t = await prepareTransaction(mainAccount, {
|
|
266
|
-
...createTransaction(),
|
|
267
|
-
subAccountId: account.type === "Account" ? null : account.id,
|
|
268
|
-
...transaction,
|
|
269
|
-
// this seed is empty (worse case scenario is to send to new). addr from: 1. eyebrow 2. odor 3. rice 4. attack 5. loyal 6. tray 7. letter 8. harbor 9. resemble 10. sphere 11. system 12. forward 13. onion 14. buffalo 15. crumble
|
|
270
|
-
recipient: transaction?.recipient || "tz1VJitLYB31fEC82efFkLRU4AQUH9QgH3q6",
|
|
271
|
-
useAllAmount: true,
|
|
272
|
-
});
|
|
273
|
-
const s = await getTransactionStatus(mainAccount, t);
|
|
274
|
-
return s.amount;
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const preload = async () => {
|
|
278
|
-
const bakers = await fetchAllBakers();
|
|
279
|
-
return {
|
|
280
|
-
bakers,
|
|
281
|
-
};
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
const hydrate = (data: any) => {
|
|
285
|
-
if (!data || typeof data !== "object") return;
|
|
286
|
-
const { bakers } = data;
|
|
287
|
-
if (!bakers || typeof bakers !== "object" || !Array.isArray(bakers)) return;
|
|
288
|
-
hydrateBakers(bakers);
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
const currencyBridge: CurrencyBridge = {
|
|
292
|
-
preload,
|
|
293
|
-
hydrate,
|
|
294
|
-
scanAccounts,
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
const accountBridge: AccountBridge<Transaction> = {
|
|
298
|
-
createTransaction,
|
|
299
|
-
updateTransaction,
|
|
300
|
-
prepareTransaction,
|
|
301
|
-
getTransactionStatus,
|
|
302
|
-
estimateMaxSpendable,
|
|
303
|
-
sync,
|
|
304
|
-
receive,
|
|
305
|
-
signOperation,
|
|
306
|
-
broadcast,
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
export default {
|
|
310
|
-
currencyBridge,
|
|
311
|
-
accountBridge,
|
|
312
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Operation } from "../../types";
|
|
2
|
-
import { makeBroadcast } from "../../libcore/broadcast";
|
|
3
|
-
import { patchOperationWithHash } from "../../operation";
|
|
4
|
-
|
|
5
|
-
async function broadcast({
|
|
6
|
-
coreAccount,
|
|
7
|
-
signedOperation: { operation, signature },
|
|
8
|
-
}): Promise<Operation> {
|
|
9
|
-
const tezosLikeAccount = await coreAccount.asTezosLikeAccount();
|
|
10
|
-
const hash = await tezosLikeAccount.broadcastRawTransaction(signature);
|
|
11
|
-
return patchOperationWithHash(operation, hash);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default makeBroadcast({
|
|
15
|
-
broadcast,
|
|
16
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Operation, OperationType } from "../../types";
|
|
2
|
-
import type { CoreOperation } from "../../libcore/types";
|
|
3
|
-
import { tezosOperationTag } from "./types";
|
|
4
|
-
const opTagToType = {
|
|
5
|
-
[tezosOperationTag.OPERATION_TAG_REVEAL]: "REVEAL",
|
|
6
|
-
[tezosOperationTag.OPERATION_TAG_ORIGINATION]: "CREATE",
|
|
7
|
-
[tezosOperationTag.OPERATION_TAG_DELEGATION]: "DELEGATE",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
async function tezosBuildOperation(
|
|
11
|
-
{
|
|
12
|
-
coreOperation,
|
|
13
|
-
}: {
|
|
14
|
-
coreOperation: CoreOperation;
|
|
15
|
-
},
|
|
16
|
-
partialOp: Partial<Operation>
|
|
17
|
-
) {
|
|
18
|
-
const tezosLikeOperation = await coreOperation.asTezosLikeOperation();
|
|
19
|
-
const tezosLikeTransaction = await tezosLikeOperation.getTransaction();
|
|
20
|
-
const status = await tezosLikeTransaction.getStatus();
|
|
21
|
-
const tezosType = await tezosLikeTransaction.getType();
|
|
22
|
-
const hash = await tezosLikeTransaction.getHash();
|
|
23
|
-
const out: Partial<Operation> = {
|
|
24
|
-
hash,
|
|
25
|
-
};
|
|
26
|
-
let maybeCustomType = opTagToType[tezosType];
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
maybeCustomType === "DELEGATE" &&
|
|
30
|
-
partialOp &&
|
|
31
|
-
partialOp.recipients &&
|
|
32
|
-
!partialOp.recipients[0]
|
|
33
|
-
) {
|
|
34
|
-
maybeCustomType = "UNDELEGATE";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (maybeCustomType === "IN" && partialOp?.value?.eq(0)) {
|
|
38
|
-
maybeCustomType = "NONE";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (maybeCustomType) {
|
|
42
|
-
out.type = maybeCustomType as OperationType;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (status === 0) {
|
|
46
|
-
out.hasFailed = true;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return out;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default tezosBuildOperation;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CryptoCurrency,
|
|
3
|
-
ChildAccount,
|
|
4
|
-
Account,
|
|
5
|
-
BalanceHistoryCache,
|
|
6
|
-
} from "../../types";
|
|
7
|
-
import type { CoreAccount, Core } from "../../libcore/types";
|
|
8
|
-
import type {
|
|
9
|
-
CoreTezosLikeOriginatedAccount,
|
|
10
|
-
CoreTezosLikeAccount,
|
|
11
|
-
} from "./types";
|
|
12
|
-
import { libcoreAmountToBigNumber } from "../../libcore/buildBigNumber";
|
|
13
|
-
import { buildOperation } from "../../libcore/buildAccount/buildOperation";
|
|
14
|
-
import { minimalOperationsBuilder } from "../../reconciliation";
|
|
15
|
-
import {
|
|
16
|
-
shortAddressPreview,
|
|
17
|
-
generateHistoryFromOperations,
|
|
18
|
-
} from "../../account";
|
|
19
|
-
const OperationOrderKey = {
|
|
20
|
-
date: 0,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
async function buildOriginatedAccount({
|
|
24
|
-
core,
|
|
25
|
-
parentAccountId,
|
|
26
|
-
currency,
|
|
27
|
-
coreOriginatedAccount,
|
|
28
|
-
existingOriginatedAccount,
|
|
29
|
-
}: {
|
|
30
|
-
core: Core;
|
|
31
|
-
parentAccountId: string;
|
|
32
|
-
currency: CryptoCurrency;
|
|
33
|
-
coreOriginatedAccount: CoreTezosLikeOriginatedAccount;
|
|
34
|
-
existingOriginatedAccount: ChildAccount;
|
|
35
|
-
}) {
|
|
36
|
-
const balance = await libcoreAmountToBigNumber(
|
|
37
|
-
await coreOriginatedAccount.getBalance()
|
|
38
|
-
);
|
|
39
|
-
const address = await coreOriginatedAccount.getAddress();
|
|
40
|
-
const query = await coreOriginatedAccount.queryOperations();
|
|
41
|
-
await query.complete();
|
|
42
|
-
await query.addOrder(OperationOrderKey.date, false);
|
|
43
|
-
const coreOperations = await query.execute();
|
|
44
|
-
const id = `${parentAccountId}+${address}`;
|
|
45
|
-
const operations = await minimalOperationsBuilder(
|
|
46
|
-
(existingOriginatedAccount && existingOriginatedAccount.operations) || [],
|
|
47
|
-
coreOperations,
|
|
48
|
-
(coreOperation) =>
|
|
49
|
-
buildOperation({
|
|
50
|
-
core,
|
|
51
|
-
coreOperation,
|
|
52
|
-
accountId: id,
|
|
53
|
-
currency,
|
|
54
|
-
existingAccount: existingOriginatedAccount,
|
|
55
|
-
})
|
|
56
|
-
);
|
|
57
|
-
const swapHistory = existingOriginatedAccount?.swapHistory || [];
|
|
58
|
-
const originatedAccount: ChildAccount = {
|
|
59
|
-
type: "ChildAccount",
|
|
60
|
-
id,
|
|
61
|
-
name: shortAddressPreview(address),
|
|
62
|
-
starred: false,
|
|
63
|
-
parentId: parentAccountId,
|
|
64
|
-
currency,
|
|
65
|
-
address,
|
|
66
|
-
balance,
|
|
67
|
-
operationsCount: operations.length,
|
|
68
|
-
operations,
|
|
69
|
-
pendingOperations: [],
|
|
70
|
-
creationDate:
|
|
71
|
-
operations.length > 0
|
|
72
|
-
? operations[operations.length - 1].date
|
|
73
|
-
: new Date(),
|
|
74
|
-
swapHistory,
|
|
75
|
-
balanceHistoryCache: {} as BalanceHistoryCache,
|
|
76
|
-
};
|
|
77
|
-
originatedAccount.balanceHistoryCache =
|
|
78
|
-
generateHistoryFromOperations(originatedAccount);
|
|
79
|
-
return originatedAccount;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async function tezosBuildOriginatedAccount({
|
|
83
|
-
core,
|
|
84
|
-
currency,
|
|
85
|
-
coreAccount,
|
|
86
|
-
accountId,
|
|
87
|
-
existingAccount,
|
|
88
|
-
}: {
|
|
89
|
-
core: Core;
|
|
90
|
-
currency: CryptoCurrency;
|
|
91
|
-
coreAccount: CoreAccount;
|
|
92
|
-
accountId: string;
|
|
93
|
-
existingAccount: Account | null | undefined;
|
|
94
|
-
}): Promise<ChildAccount[] | null | undefined> {
|
|
95
|
-
const originatedAccounts: ChildAccount[] = [];
|
|
96
|
-
const xtzAccount: CoreTezosLikeAccount =
|
|
97
|
-
await coreAccount.asTezosLikeAccount();
|
|
98
|
-
const coreOAS: CoreTezosLikeOriginatedAccount[] =
|
|
99
|
-
await xtzAccount.getOriginatedAccounts();
|
|
100
|
-
const existingAccountByAddress = {};
|
|
101
|
-
const existingAccountAddresses: string[] = [];
|
|
102
|
-
|
|
103
|
-
if (existingAccount && existingAccount.subAccounts) {
|
|
104
|
-
for (const existingSubAccount of existingAccount.subAccounts) {
|
|
105
|
-
if (existingSubAccount.type === "ChildAccount") {
|
|
106
|
-
const { address } = existingSubAccount;
|
|
107
|
-
existingAccountAddresses.push(address);
|
|
108
|
-
existingAccountByAddress[address] = existingSubAccount;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
for (const coreOA of coreOAS) {
|
|
114
|
-
const address = await coreOA.getAddress();
|
|
115
|
-
const existingOriginatedAccount = existingAccountByAddress[address];
|
|
116
|
-
const originatedAccount = await buildOriginatedAccount({
|
|
117
|
-
core,
|
|
118
|
-
parentAccountId: accountId,
|
|
119
|
-
currency,
|
|
120
|
-
coreOriginatedAccount: coreOA,
|
|
121
|
-
existingOriginatedAccount,
|
|
122
|
-
});
|
|
123
|
-
if (originatedAccount) originatedAccounts.push(originatedAccount);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
originatedAccounts.sort((a: any, b: any) => {
|
|
127
|
-
const i = existingAccountAddresses.indexOf(a.address);
|
|
128
|
-
const j = existingAccountAddresses.indexOf(b.address);
|
|
129
|
-
if (i === j) return 0;
|
|
130
|
-
if (i < 0) return 1;
|
|
131
|
-
if (j < 0) return -1;
|
|
132
|
-
return i - j;
|
|
133
|
-
});
|
|
134
|
-
return originatedAccounts;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export default tezosBuildOriginatedAccount;
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import invariant from "invariant";
|
|
2
|
-
import { BigNumber } from "bignumber.js";
|
|
3
|
-
import { FeeNotLoaded } from "@ledgerhq/errors";
|
|
4
|
-
import type { Account } from "../../types";
|
|
5
|
-
import { isValidRecipient } from "../../libcore/isValidRecipient";
|
|
6
|
-
import {
|
|
7
|
-
bigNumberToLibcoreAmount,
|
|
8
|
-
bigNumberToLibcoreBigInt,
|
|
9
|
-
} from "../../libcore/buildBigNumber";
|
|
10
|
-
import type { Core, CoreCurrency, CoreAccount } from "../../libcore/types";
|
|
11
|
-
import type {
|
|
12
|
-
CoreTezosLikeOriginatedAccount,
|
|
13
|
-
CoreTezosLikeAccount,
|
|
14
|
-
CoreTezosLikeTransaction,
|
|
15
|
-
Transaction,
|
|
16
|
-
} from "./types";
|
|
17
|
-
import { tezosOperationTag } from "./types";
|
|
18
|
-
import { upperModulo } from "../../modulo";
|
|
19
|
-
|
|
20
|
-
export async function tezosBuildTransaction({
|
|
21
|
-
account,
|
|
22
|
-
core,
|
|
23
|
-
coreAccount,
|
|
24
|
-
coreCurrency,
|
|
25
|
-
transaction,
|
|
26
|
-
isCancelled,
|
|
27
|
-
}: {
|
|
28
|
-
account: Account;
|
|
29
|
-
core: Core;
|
|
30
|
-
coreAccount: CoreAccount;
|
|
31
|
-
coreCurrency: CoreCurrency;
|
|
32
|
-
transaction: Transaction;
|
|
33
|
-
isPartial: boolean;
|
|
34
|
-
isCancelled: () => boolean;
|
|
35
|
-
}): Promise<CoreTezosLikeTransaction | null | undefined> {
|
|
36
|
-
const { currency } = account;
|
|
37
|
-
const { recipient, fees, gasLimit, storageLimit, subAccountId } = transaction;
|
|
38
|
-
const subAccount = subAccountId
|
|
39
|
-
? account.subAccounts &&
|
|
40
|
-
account.subAccounts.find((t) => t.id === subAccountId)
|
|
41
|
-
: null;
|
|
42
|
-
let tezosAccount:
|
|
43
|
-
| (CoreTezosLikeAccount | null | undefined)
|
|
44
|
-
| (CoreTezosLikeOriginatedAccount | null | undefined);
|
|
45
|
-
const tezosLikeAccount = await coreAccount.asTezosLikeAccount();
|
|
46
|
-
if (isCancelled()) return;
|
|
47
|
-
|
|
48
|
-
if (subAccount && subAccount.type === "ChildAccount") {
|
|
49
|
-
const accounts = await tezosLikeAccount.getOriginatedAccounts();
|
|
50
|
-
|
|
51
|
-
for (const a of accounts) {
|
|
52
|
-
const addr = await a.getAddress();
|
|
53
|
-
|
|
54
|
-
if (addr === subAccount.address) {
|
|
55
|
-
tezosAccount = a;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
invariant(tezosAccount, "sub account not found " + subAccount.id);
|
|
61
|
-
} else {
|
|
62
|
-
tezosAccount = tezosLikeAccount;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (transaction.mode !== "undelegate") {
|
|
66
|
-
await isValidRecipient({
|
|
67
|
-
currency,
|
|
68
|
-
recipient,
|
|
69
|
-
});
|
|
70
|
-
if (isCancelled()) return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (!fees || !gasLimit || !storageLimit) {
|
|
74
|
-
throw new FeeNotLoaded();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const feesAmount = await bigNumberToLibcoreAmount(core, coreCurrency, fees);
|
|
78
|
-
if (isCancelled()) return;
|
|
79
|
-
let gasLimitRounded = gasLimit;
|
|
80
|
-
|
|
81
|
-
if (["delegate", "undelegate"].includes(transaction.mode)) {
|
|
82
|
-
gasLimitRounded = upperModulo(
|
|
83
|
-
gasLimit,
|
|
84
|
-
new BigNumber(136),
|
|
85
|
-
new BigNumber(1000)
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const gasLimitAmount = await bigNumberToLibcoreAmount(
|
|
90
|
-
core,
|
|
91
|
-
coreCurrency,
|
|
92
|
-
gasLimitRounded
|
|
93
|
-
);
|
|
94
|
-
if (isCancelled()) return;
|
|
95
|
-
const storageBigInt = await bigNumberToLibcoreBigInt(core, storageLimit);
|
|
96
|
-
if (isCancelled()) return;
|
|
97
|
-
const transactionBuilder = await (
|
|
98
|
-
tezosAccount as CoreTezosLikeAccount
|
|
99
|
-
).buildTransaction();
|
|
100
|
-
if (isCancelled()) return;
|
|
101
|
-
let type;
|
|
102
|
-
|
|
103
|
-
switch (transaction.mode) {
|
|
104
|
-
case "send":
|
|
105
|
-
type = tezosOperationTag.OPERATION_TAG_TRANSACTION;
|
|
106
|
-
break;
|
|
107
|
-
|
|
108
|
-
case "delegate":
|
|
109
|
-
case "undelegate":
|
|
110
|
-
invariant(
|
|
111
|
-
!transaction.useAllAmount,
|
|
112
|
-
"send max can't be used in delegation context"
|
|
113
|
-
);
|
|
114
|
-
invariant(
|
|
115
|
-
transaction.amount.isZero(),
|
|
116
|
-
"amount must be ZERO in delegation context"
|
|
117
|
-
);
|
|
118
|
-
type = tezosOperationTag.OPERATION_TAG_DELEGATION;
|
|
119
|
-
break;
|
|
120
|
-
|
|
121
|
-
default:
|
|
122
|
-
throw new Error("Unsupported transaction.mode = " + transaction.mode);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
await transactionBuilder.setType(type);
|
|
126
|
-
if (isCancelled()) return;
|
|
127
|
-
|
|
128
|
-
if (transaction.useAllAmount) {
|
|
129
|
-
await transactionBuilder.wipeToAddress(recipient);
|
|
130
|
-
if (isCancelled()) return;
|
|
131
|
-
} else {
|
|
132
|
-
if (!transaction.amount) throw new Error("amount is missing");
|
|
133
|
-
const amount = await bigNumberToLibcoreAmount(
|
|
134
|
-
core,
|
|
135
|
-
coreCurrency,
|
|
136
|
-
new BigNumber(transaction.amount)
|
|
137
|
-
);
|
|
138
|
-
if (isCancelled()) return;
|
|
139
|
-
await transactionBuilder.sendToAddress(amount, recipient);
|
|
140
|
-
if (isCancelled()) return;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
await transactionBuilder.setGasLimit(gasLimitAmount);
|
|
144
|
-
if (isCancelled()) return;
|
|
145
|
-
await transactionBuilder.setFees(feesAmount);
|
|
146
|
-
if (isCancelled()) return;
|
|
147
|
-
await transactionBuilder.setStorageLimit(storageBigInt);
|
|
148
|
-
if (isCancelled()) return;
|
|
149
|
-
const builded = await transactionBuilder.build();
|
|
150
|
-
if (isCancelled()) return;
|
|
151
|
-
return builded;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export default tezosBuildTransaction;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { BigNumber } from "bignumber.js";
|
|
2
|
-
import type { Account } from "../../types";
|
|
3
|
-
import type { NetworkInfo, CoreTezosLikeAccount } from "./types";
|
|
4
|
-
import type { CoreAccount } from "../../libcore/types";
|
|
5
|
-
import { libcoreBigIntToBigNumber } from "../../libcore/buildBigNumber";
|
|
6
|
-
type Input = {
|
|
7
|
-
coreAccount: CoreAccount;
|
|
8
|
-
account: Account;
|
|
9
|
-
};
|
|
10
|
-
type Output = NetworkInfo;
|
|
11
|
-
|
|
12
|
-
async function tezos({ coreAccount }: Input): Promise<Output> {
|
|
13
|
-
const tezosLikeAccount: CoreTezosLikeAccount =
|
|
14
|
-
await coreAccount.asTezosLikeAccount();
|
|
15
|
-
const bigInt = await tezosLikeAccount.getFees();
|
|
16
|
-
const networkFees = await libcoreBigIntToBigNumber(bigInt);
|
|
17
|
-
// workaround of a bug on server side. set some boundaries.
|
|
18
|
-
const fees = BigNumber.min(BigNumber.max(2500, networkFees), 30000);
|
|
19
|
-
return {
|
|
20
|
-
family: "tezos",
|
|
21
|
-
fees,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default tezos;
|