@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
|
@@ -5,95 +5,69 @@ import React, {
|
|
|
5
5
|
useState,
|
|
6
6
|
useEffect,
|
|
7
7
|
} from "react";
|
|
8
|
-
import {
|
|
9
|
-
import { API, apiForCurrency } from "../../api/Ethereum";
|
|
10
|
-
import { NFT, NFTMetadataResponse } from "../../types";
|
|
11
|
-
import { getNftKey } from "../helpers";
|
|
8
|
+
import { getNftCollectionKey, getNftKey } from "../helpers";
|
|
12
9
|
import {
|
|
13
|
-
Batch,
|
|
14
|
-
BatchElement,
|
|
15
10
|
NFTMetadataContextAPI,
|
|
16
11
|
NFTMetadataContextState,
|
|
17
12
|
NFTMetadataContextType,
|
|
18
13
|
NFTResource,
|
|
19
14
|
} from "./types";
|
|
20
15
|
import { isOutdated } from "./logic";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
import { getCurrencyBridge } from "../../bridge";
|
|
17
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
18
|
+
import { NFT, ProtoNFT } from "../../types";
|
|
24
19
|
|
|
25
20
|
const NftMetadataContext = createContext<NFTMetadataContextType>({
|
|
26
21
|
cache: {},
|
|
27
22
|
loadNFTMetadata: () => Promise.resolve(),
|
|
23
|
+
loadCollectionMetadata: () => Promise.resolve(),
|
|
28
24
|
clearCache: () => {},
|
|
29
25
|
});
|
|
30
26
|
|
|
31
|
-
export const metadataCallBatcher = (() => {
|
|
32
|
-
const batch: BatchElement[] = [];
|
|
33
|
-
|
|
34
|
-
let debounce;
|
|
35
|
-
const timeoutBatchCall = () => {
|
|
36
|
-
// Clear the previous scheduled call if it was existing
|
|
37
|
-
clearTimeout(debounce);
|
|
38
|
-
|
|
39
|
-
// Schedule a new call with the whole batch
|
|
40
|
-
debounce = setTimeout(() => {
|
|
41
|
-
// Seperate each batch element properties into arrays by type and index
|
|
42
|
-
const { couples, resolvers, rejecters } = batch.reduce(
|
|
43
|
-
(acc, { couple, resolve, reject }) => {
|
|
44
|
-
acc.couples.push(couple);
|
|
45
|
-
acc.resolvers.push(resolve);
|
|
46
|
-
acc.rejecters.push(reject);
|
|
47
|
-
|
|
48
|
-
return acc;
|
|
49
|
-
},
|
|
50
|
-
{ couples: [], resolvers: [], rejecters: [] } as Batch
|
|
51
|
-
);
|
|
52
|
-
// Empty the batch
|
|
53
|
-
batch.length = 0;
|
|
54
|
-
|
|
55
|
-
// Make the call with all the couples of contract and tokenId at once
|
|
56
|
-
ethApi
|
|
57
|
-
.getNFTMetadata(couples)
|
|
58
|
-
.then((res) => {
|
|
59
|
-
// Resolve each batch element with its own resolver and only its response
|
|
60
|
-
res.forEach((metadata, index) => resolvers[index](metadata));
|
|
61
|
-
})
|
|
62
|
-
.catch((err) => {
|
|
63
|
-
// Reject all batch element with the error
|
|
64
|
-
rejecters.forEach((reject) => reject(err));
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
// Load the metadata for a given couple contract + tokenId
|
|
71
|
-
load({ contract, tokenId }): Promise<NFTMetadataResponse> {
|
|
72
|
-
return new Promise((resolve, reject) => {
|
|
73
|
-
batch.push({ couple: { contract, tokenId }, resolve, reject });
|
|
74
|
-
timeoutBatchCall();
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
})();
|
|
79
|
-
|
|
80
|
-
// DEPRECATED, use useNftResource
|
|
81
27
|
export function useNftMetadata(
|
|
82
28
|
contract: string | undefined,
|
|
83
|
-
tokenId: string | undefined
|
|
29
|
+
tokenId: string | undefined,
|
|
30
|
+
currencyId: string | undefined
|
|
84
31
|
): NFTResource {
|
|
85
32
|
const { cache, loadNFTMetadata } = useContext(NftMetadataContext);
|
|
33
|
+
const key =
|
|
34
|
+
contract && tokenId && currencyId
|
|
35
|
+
? getNftKey(contract, tokenId, currencyId)
|
|
36
|
+
: "";
|
|
37
|
+
const cachedData = cache[key];
|
|
86
38
|
|
|
87
|
-
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!contract || !tokenId || !currencyId) return;
|
|
41
|
+
if (!cachedData || isOutdated(cachedData)) {
|
|
42
|
+
loadNFTMetadata(contract, tokenId, currencyId);
|
|
43
|
+
}
|
|
44
|
+
}, [contract, tokenId, cachedData, loadNFTMetadata, currencyId]);
|
|
45
|
+
|
|
46
|
+
if (cachedData) {
|
|
47
|
+
return cachedData;
|
|
48
|
+
} else {
|
|
49
|
+
return {
|
|
50
|
+
status: "queued",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function useNftCollectionMetadata(
|
|
56
|
+
contract: string | undefined,
|
|
57
|
+
currencyId: string | undefined
|
|
58
|
+
): NFTResource {
|
|
59
|
+
const { cache, loadCollectionMetadata } = useContext(NftMetadataContext);
|
|
60
|
+
const key =
|
|
61
|
+
contract && currencyId ? getNftCollectionKey(contract, currencyId) : "";
|
|
88
62
|
|
|
89
63
|
const cachedData = cache[key];
|
|
90
64
|
|
|
91
65
|
useEffect(() => {
|
|
92
|
-
if (!contract || !
|
|
66
|
+
if (!contract || !currencyId) return;
|
|
93
67
|
if (!cachedData || isOutdated(cachedData)) {
|
|
94
|
-
|
|
68
|
+
loadCollectionMetadata(contract, currencyId);
|
|
95
69
|
}
|
|
96
|
-
}, [contract,
|
|
70
|
+
}, [contract, cachedData, currencyId, loadCollectionMetadata]);
|
|
97
71
|
|
|
98
72
|
if (cachedData) {
|
|
99
73
|
return cachedData;
|
|
@@ -104,16 +78,44 @@ export function useNftMetadata(
|
|
|
104
78
|
}
|
|
105
79
|
}
|
|
106
80
|
|
|
107
|
-
|
|
108
|
-
|
|
81
|
+
type UseNFTResponse =
|
|
82
|
+
| { status: Exclude<NFTResource["status"], "loaded"> }
|
|
83
|
+
| { status: "loaded"; nft: NFT };
|
|
84
|
+
|
|
85
|
+
export function useNft(protoNft: ProtoNFT): UseNFTResponse {
|
|
86
|
+
const data = useNftMetadata(
|
|
87
|
+
protoNft.contract,
|
|
88
|
+
protoNft.tokenId,
|
|
89
|
+
protoNft.currencyId
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const { status } = data;
|
|
93
|
+
const metadata = useMemo(
|
|
94
|
+
() => (status === "loaded" ? data.metadata : null),
|
|
95
|
+
[data, status]
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const nft = useMemo(
|
|
99
|
+
() => (status === "loaded" && metadata ? { ...protoNft, metadata } : null),
|
|
100
|
+
[protoNft, metadata]
|
|
101
|
+
) as NFT | null;
|
|
102
|
+
|
|
103
|
+
return status !== "loaded"
|
|
104
|
+
? { status }
|
|
105
|
+
: {
|
|
106
|
+
status,
|
|
107
|
+
nft: nft!,
|
|
108
|
+
};
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
export function useNftAPI(): NFTMetadataContextAPI {
|
|
112
|
-
const { clearCache, loadNFTMetadata } =
|
|
112
|
+
const { clearCache, loadNFTMetadata, loadCollectionMetadata } =
|
|
113
|
+
useContext(NftMetadataContext);
|
|
113
114
|
|
|
114
115
|
return {
|
|
115
116
|
clearCache,
|
|
116
117
|
loadNFTMetadata,
|
|
118
|
+
loadCollectionMetadata,
|
|
117
119
|
};
|
|
118
120
|
}
|
|
119
121
|
|
|
@@ -128,10 +130,94 @@ export function NftMetadataProvider({
|
|
|
128
130
|
cache: {},
|
|
129
131
|
});
|
|
130
132
|
|
|
131
|
-
const api = useMemo(
|
|
133
|
+
const api: NFTMetadataContextAPI = useMemo(
|
|
132
134
|
() => ({
|
|
133
|
-
loadNFTMetadata: async (
|
|
134
|
-
|
|
135
|
+
loadNFTMetadata: async (
|
|
136
|
+
contract: string,
|
|
137
|
+
tokenId: string,
|
|
138
|
+
currencyId: string
|
|
139
|
+
) => {
|
|
140
|
+
const key = getNftKey(contract, tokenId, currencyId);
|
|
141
|
+
const currency = getCryptoCurrencyById(currencyId);
|
|
142
|
+
const currencyBridge = getCurrencyBridge(currency);
|
|
143
|
+
|
|
144
|
+
if (!currencyBridge.nftResolvers?.nftMetadata) {
|
|
145
|
+
throw new Error("Currency doesn't support NFT metadata");
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
setState((oldState) => ({
|
|
149
|
+
...oldState,
|
|
150
|
+
cache: {
|
|
151
|
+
...oldState.cache,
|
|
152
|
+
[key]: {
|
|
153
|
+
status: "loading",
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
}));
|
|
157
|
+
|
|
158
|
+
try {
|
|
159
|
+
const { status, result } =
|
|
160
|
+
await currencyBridge.nftResolvers.nftMetadata({
|
|
161
|
+
contract,
|
|
162
|
+
tokenId,
|
|
163
|
+
currencyId: currency.id,
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
switch (status) {
|
|
167
|
+
case 500:
|
|
168
|
+
throw new Error("NFT Metadata Provider failed");
|
|
169
|
+
case 404:
|
|
170
|
+
setState((oldState) => ({
|
|
171
|
+
...oldState,
|
|
172
|
+
cache: {
|
|
173
|
+
...oldState.cache,
|
|
174
|
+
[key]: {
|
|
175
|
+
status: "nodata",
|
|
176
|
+
metadata: null,
|
|
177
|
+
updatedAt: Date.now(),
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
}));
|
|
181
|
+
break;
|
|
182
|
+
case 200:
|
|
183
|
+
setState((oldState) => ({
|
|
184
|
+
...oldState,
|
|
185
|
+
cache: {
|
|
186
|
+
...oldState.cache,
|
|
187
|
+
[key]: {
|
|
188
|
+
status: "loaded",
|
|
189
|
+
metadata: result,
|
|
190
|
+
updatedAt: Date.now(),
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
}));
|
|
194
|
+
break;
|
|
195
|
+
default:
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
} catch (error) {
|
|
199
|
+
setState((oldState) => ({
|
|
200
|
+
...oldState,
|
|
201
|
+
cache: {
|
|
202
|
+
...oldState.cache,
|
|
203
|
+
[key]: {
|
|
204
|
+
status: "error",
|
|
205
|
+
error,
|
|
206
|
+
updatedAt: Date.now(),
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
loadCollectionMetadata: async (contract: string, currencyId: string) => {
|
|
214
|
+
const key = getNftCollectionKey(contract, currencyId);
|
|
215
|
+
const currency = getCryptoCurrencyById(currencyId);
|
|
216
|
+
const currencyBridge = getCurrencyBridge(currency);
|
|
217
|
+
|
|
218
|
+
if (!currencyBridge?.nftResolvers?.collectionMetadata) {
|
|
219
|
+
throw new Error("Currency doesn't support Collection Metadata");
|
|
220
|
+
}
|
|
135
221
|
|
|
136
222
|
setState((oldState) => ({
|
|
137
223
|
...oldState,
|
|
@@ -144,10 +230,11 @@ export function NftMetadataProvider({
|
|
|
144
230
|
}));
|
|
145
231
|
|
|
146
232
|
try {
|
|
147
|
-
const { status, result } =
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
233
|
+
const { status, result } =
|
|
234
|
+
await currencyBridge.nftResolvers.collectionMetadata({
|
|
235
|
+
contract,
|
|
236
|
+
currencyId: currency.id,
|
|
237
|
+
});
|
|
151
238
|
|
|
152
239
|
switch (status) {
|
|
153
240
|
case 500:
|
|
@@ -172,7 +259,7 @@ export function NftMetadataProvider({
|
|
|
172
259
|
...oldState.cache,
|
|
173
260
|
[key]: {
|
|
174
261
|
status: "loaded",
|
|
175
|
-
metadata: result
|
|
262
|
+
metadata: result,
|
|
176
263
|
updatedAt: Date.now(),
|
|
177
264
|
},
|
|
178
265
|
},
|
|
@@ -206,6 +293,7 @@ export function NftMetadataProvider({
|
|
|
206
293
|
);
|
|
207
294
|
|
|
208
295
|
const value = { ...state, ...api };
|
|
296
|
+
|
|
209
297
|
return (
|
|
210
298
|
<NftMetadataContext.Provider value={value}>
|
|
211
299
|
{children}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
NFTCollectionMetadataResponse,
|
|
3
|
+
NFTMetadataResponse,
|
|
4
|
+
} from "../../types";
|
|
2
5
|
|
|
3
6
|
export type NFTResourceQueued = {
|
|
4
7
|
status: "queued";
|
|
@@ -10,7 +13,9 @@ export type NFTResourceLoading = {
|
|
|
10
13
|
|
|
11
14
|
export type NFTResourceLoaded = {
|
|
12
15
|
status: "loaded";
|
|
13
|
-
metadata:
|
|
16
|
+
metadata:
|
|
17
|
+
| NFTMetadataResponse["result"]
|
|
18
|
+
| NFTCollectionMetadataResponse["result"];
|
|
14
19
|
updatedAt: number;
|
|
15
20
|
};
|
|
16
21
|
|
|
@@ -37,24 +42,42 @@ export type NFTMetadataContextState = {
|
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
export type NFTMetadataContextAPI = {
|
|
40
|
-
loadNFTMetadata: (
|
|
45
|
+
loadNFTMetadata: (
|
|
46
|
+
contract: string,
|
|
47
|
+
tokenId: string,
|
|
48
|
+
currencyId: string
|
|
49
|
+
) => Promise<void>;
|
|
50
|
+
loadCollectionMetadata: (
|
|
51
|
+
contract: string,
|
|
52
|
+
currencyId: string
|
|
53
|
+
) => Promise<void>;
|
|
41
54
|
clearCache: () => void;
|
|
42
55
|
};
|
|
43
56
|
|
|
44
57
|
export type NFTMetadataContextType = NFTMetadataContextState &
|
|
45
58
|
NFTMetadataContextAPI;
|
|
46
59
|
|
|
60
|
+
export type Batcher = {
|
|
61
|
+
load: (
|
|
62
|
+
element:
|
|
63
|
+
| {
|
|
64
|
+
contract: string;
|
|
65
|
+
tokenId: string;
|
|
66
|
+
}
|
|
67
|
+
| {
|
|
68
|
+
contract: string;
|
|
69
|
+
}
|
|
70
|
+
) => Promise<NFTMetadataResponse | NFTCollectionMetadataResponse>;
|
|
71
|
+
};
|
|
72
|
+
|
|
47
73
|
export type BatchElement = {
|
|
48
|
-
|
|
49
|
-
contract: string;
|
|
50
|
-
tokenId: string;
|
|
51
|
-
};
|
|
74
|
+
element: any;
|
|
52
75
|
resolve: (value: NFTMetadataResponse) => void;
|
|
53
76
|
reject: (reason?: Error) => void;
|
|
54
77
|
};
|
|
55
78
|
|
|
56
79
|
export type Batch = {
|
|
57
|
-
|
|
80
|
+
elements: Array<BatchElement["element"]>;
|
|
58
81
|
resolvers: Array<BatchElement["resolve"]>;
|
|
59
82
|
rejecters: Array<BatchElement["reject"]>;
|
|
60
83
|
};
|
package/src/nft/helpers.ts
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import eip55 from "eip55";
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
|
-
import { NFT, Operation } from "../types";
|
|
4
3
|
import { encodeNftId } from ".";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
import { decodeAccountId } from "../account";
|
|
5
|
+
|
|
6
|
+
import type { Batch, BatchElement, Batcher } from "./NftMetadataProvider/types";
|
|
7
|
+
import type {
|
|
8
|
+
NFTMetadataResponse,
|
|
9
|
+
Operation,
|
|
10
|
+
ProtoNFT,
|
|
11
|
+
NFT,
|
|
12
|
+
CryptoCurrency,
|
|
13
|
+
NFTCollectionMetadataResponse,
|
|
14
|
+
} from "../types";
|
|
15
|
+
import { API, apiForCurrency } from "../api/Ethereum";
|
|
16
|
+
|
|
17
|
+
export const nftsFromOperations = (ops: Operation[]): ProtoNFT[] => {
|
|
15
18
|
const nftsMap = ops
|
|
19
|
+
// make sure we have the operation in chronological order (older first)
|
|
20
|
+
.sort((a, b) => a.date.getTime() - b.date.getTime())
|
|
16
21
|
// if ops are Operations get the prop nftOperations, else ops are considered nftOperations already
|
|
17
22
|
.flatMap((op) => (op?.nftOperations?.length ? op.nftOperations : op))
|
|
18
|
-
.reduce((acc: Record<string,
|
|
23
|
+
.reduce((acc: Record<string, ProtoNFT>, nftOp: Operation) => {
|
|
19
24
|
let { contract } = nftOp;
|
|
20
25
|
if (!contract) {
|
|
21
26
|
return acc;
|
|
@@ -24,20 +29,37 @@ export const nftsFromOperations = (ops: Operation[]): NFT[] => {
|
|
|
24
29
|
// Creating a "token for a contract" unique key
|
|
25
30
|
contract = eip55.encode(contract);
|
|
26
31
|
const { tokenId, standard, accountId } = nftOp;
|
|
32
|
+
const { currencyId } = decodeAccountId(nftOp.accountId);
|
|
27
33
|
if (!tokenId || !standard) return acc;
|
|
28
|
-
const id = encodeNftId(accountId, contract, tokenId
|
|
34
|
+
const id = encodeNftId(accountId, contract, tokenId, currencyId);
|
|
29
35
|
|
|
30
36
|
const nft = (acc[id] || {
|
|
31
37
|
id,
|
|
32
38
|
tokenId,
|
|
33
39
|
amount: new BigNumber(0),
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
contract,
|
|
41
|
+
standard,
|
|
42
|
+
currencyId,
|
|
43
|
+
}) as ProtoNFT;
|
|
36
44
|
|
|
37
45
|
if (nftOp.type === "NFT_IN") {
|
|
38
46
|
nft.amount = nft.amount.plus(nftOp.value);
|
|
39
47
|
} else if (nftOp.type === "NFT_OUT") {
|
|
40
|
-
|
|
48
|
+
const newAmount = nft.amount.minus(nftOp.value);
|
|
49
|
+
|
|
50
|
+
// In case of OpenSea lazy minting feature (minting an NFT off-chain)
|
|
51
|
+
// OpenSea will fire a false ERC1155 event saying that you sent an NFT
|
|
52
|
+
// from your account that you never received first.
|
|
53
|
+
//
|
|
54
|
+
// E.g.: I'm creating 10 ERC1155 on OpenSea. It's not going to create anything on-chain.
|
|
55
|
+
// Then I (bob) decide to transfer 5 to someone (kvn). OpenSea is going to mint the NFT in its
|
|
56
|
+
// collection (`OpenSea Shared Storefront` / `OpenSea Collections`) and transfer it to kvn.
|
|
57
|
+
// But the event fired by the Smart Contract is going to be `bob transfered 5 NFT to kvn` which is false.
|
|
58
|
+
// It would then result in bob have -5 NFTs since he never received them first.
|
|
59
|
+
// If kvn send 2 back to bob, based on the events we would think that bob has -3 NFTs.
|
|
60
|
+
//
|
|
61
|
+
// To mitigate that we put a minimum value of 0 when an account is transferring some NFTs.
|
|
62
|
+
nft.amount = newAmount.isNegative() ? new BigNumber(0) : newAmount;
|
|
41
63
|
}
|
|
42
64
|
|
|
43
65
|
acc[id] = nft;
|
|
@@ -48,31 +70,143 @@ export const nftsFromOperations = (ops: Operation[]): NFT[] => {
|
|
|
48
70
|
return Object.values(nftsMap);
|
|
49
71
|
};
|
|
50
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Helper to group NFTs by their collection/contract.
|
|
75
|
+
*
|
|
76
|
+
* It will either return an object { [contract address]: NFT[] }
|
|
77
|
+
* or if you specify a collectionAddress it will simply filter
|
|
78
|
+
* your NFTs for this specific contract and return an NFT[].
|
|
79
|
+
*
|
|
80
|
+
* The grouping here can be done with ProtoNFT or NFT.
|
|
81
|
+
*/
|
|
51
82
|
export const nftsByCollections = (
|
|
52
|
-
nfts: NFT
|
|
83
|
+
nfts: Array<ProtoNFT | NFT> = [],
|
|
53
84
|
collectionAddress?: string
|
|
54
|
-
):
|
|
55
|
-
|
|
56
|
-
? nfts.filter((n) => n.
|
|
57
|
-
: nfts
|
|
85
|
+
): Record<string, Array<ProtoNFT | NFT>> | Array<ProtoNFT | NFT> => {
|
|
86
|
+
return collectionAddress
|
|
87
|
+
? nfts.filter((n) => n.contract === collectionAddress)
|
|
88
|
+
: nfts.reduce((acc, nft) => {
|
|
89
|
+
const { contract } = nft;
|
|
58
90
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
91
|
+
if (!acc[contract]) {
|
|
92
|
+
acc[contract] = [];
|
|
93
|
+
}
|
|
94
|
+
acc[contract].push(nft);
|
|
62
95
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
acc[collection.contract].nfts.push(nftWithoutCollection);
|
|
96
|
+
return acc;
|
|
97
|
+
}, {});
|
|
98
|
+
};
|
|
67
99
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
100
|
+
export const getNftKey = (
|
|
101
|
+
contract: string,
|
|
102
|
+
tokenId: string,
|
|
103
|
+
currencyId: string
|
|
104
|
+
): string => {
|
|
105
|
+
return `${currencyId}-${contract}-${tokenId}`;
|
|
106
|
+
};
|
|
72
107
|
|
|
73
|
-
|
|
108
|
+
export const getNftCollectionKey = (
|
|
109
|
+
contract: string,
|
|
110
|
+
currencyId: string
|
|
111
|
+
): string => {
|
|
112
|
+
return `${currencyId}-${contract}`;
|
|
74
113
|
};
|
|
75
114
|
|
|
76
|
-
|
|
77
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Factory to make a metadata API call batcher.
|
|
117
|
+
*
|
|
118
|
+
* It will wait for a complete `tick` to accumulate all the metadata requests
|
|
119
|
+
* before sending it as one call to a given API.
|
|
120
|
+
* Once the response is received, it will then spread the metadata to each request Promise,
|
|
121
|
+
* just like if each request had been made separately.
|
|
122
|
+
*/
|
|
123
|
+
const makeBatcher = (
|
|
124
|
+
call: API["getNFTMetadata"] | API["getNFTCollectionMetadata"],
|
|
125
|
+
chainId: number
|
|
126
|
+
): Batcher =>
|
|
127
|
+
(() => {
|
|
128
|
+
const queue: BatchElement[] = [];
|
|
129
|
+
|
|
130
|
+
let debounce;
|
|
131
|
+
const timeoutBatchCall = () => {
|
|
132
|
+
// Clear the previous scheduled call if it was existing
|
|
133
|
+
clearTimeout(debounce);
|
|
134
|
+
|
|
135
|
+
// Schedule a new call with the whole batch
|
|
136
|
+
debounce = setTimeout(() => {
|
|
137
|
+
// Seperate each batch element properties into arrays by type and index
|
|
138
|
+
const { elements, resolvers, rejecters } = queue.reduce(
|
|
139
|
+
(acc, { element, resolve, reject }) => {
|
|
140
|
+
acc.elements.push(element);
|
|
141
|
+
acc.resolvers.push(resolve);
|
|
142
|
+
acc.rejecters.push(reject);
|
|
143
|
+
|
|
144
|
+
return acc;
|
|
145
|
+
},
|
|
146
|
+
{ elements: [], resolvers: [], rejecters: [] } as Batch
|
|
147
|
+
);
|
|
148
|
+
// Empty the queue
|
|
149
|
+
queue.length = 0;
|
|
150
|
+
|
|
151
|
+
// Make the call with all the couples of contract and tokenId at once
|
|
152
|
+
call(elements, chainId.toString())
|
|
153
|
+
.then((res: any) => {
|
|
154
|
+
// Resolve each batch element with its own resolver and only its response
|
|
155
|
+
res.forEach((metadata, index) => resolvers[index](metadata));
|
|
156
|
+
})
|
|
157
|
+
.catch((err) => {
|
|
158
|
+
// Reject all batch element with the error
|
|
159
|
+
rejecters.forEach((reject) => reject(err));
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
// Load the metadata for a given couple contract + tokenId
|
|
166
|
+
load(
|
|
167
|
+
element:
|
|
168
|
+
| {
|
|
169
|
+
contract: string;
|
|
170
|
+
tokenId: string;
|
|
171
|
+
}
|
|
172
|
+
| { contract: string }
|
|
173
|
+
): Promise<NFTMetadataResponse | NFTCollectionMetadataResponse> {
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
queue.push({ element, resolve, reject });
|
|
176
|
+
timeoutBatchCall();
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
})();
|
|
181
|
+
|
|
182
|
+
const batchersMap = new Map();
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* In order to `instanciate`/make only 1 batcher by currency,
|
|
186
|
+
* they're `cached` in a Map and retrieved by this method
|
|
187
|
+
* This method is still EVM based for now but can be improved
|
|
188
|
+
* to implement an even more generic solution
|
|
189
|
+
*/
|
|
190
|
+
export const metadataCallBatcher = (
|
|
191
|
+
currency: CryptoCurrency
|
|
192
|
+
): { loadNft: Batcher["load"]; loadCollection: Batcher["load"] } => {
|
|
193
|
+
const api: API = apiForCurrency(currency);
|
|
194
|
+
const chainId = currency?.ethereumLikeInfo?.chainId;
|
|
195
|
+
|
|
196
|
+
if (!chainId || !api) {
|
|
197
|
+
throw new Error("Ethereum: No API or chainId for this Currency");
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (!batchersMap.has(currency.id)) {
|
|
201
|
+
batchersMap.set(currency.id, {
|
|
202
|
+
nft: makeBatcher(api.getNFTMetadata, chainId),
|
|
203
|
+
collection: makeBatcher(api.getNFTCollectionMetadata, chainId),
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const batchers = batchersMap.get(currency.id);
|
|
208
|
+
return {
|
|
209
|
+
loadNft: batchers.nft.load,
|
|
210
|
+
loadCollection: batchers.collection.load,
|
|
211
|
+
};
|
|
78
212
|
};
|
package/src/nft/nftId.ts
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
export const encodeNftId = (
|
|
2
2
|
accountId: string,
|
|
3
3
|
contract: string,
|
|
4
|
-
tokenId: string
|
|
4
|
+
tokenId: string,
|
|
5
|
+
currencyId: string
|
|
5
6
|
): string => {
|
|
6
|
-
return `${accountId}+${contract}+${tokenId
|
|
7
|
+
return `${accountId}+${contract}+${tokenId}+${currencyId}`;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
|
-
export const decodeNftId = (
|
|
10
|
-
|
|
10
|
+
export const decodeNftId = (
|
|
11
|
+
id: string
|
|
12
|
+
): {
|
|
13
|
+
accountId: string;
|
|
14
|
+
contract: string;
|
|
15
|
+
tokenId: string;
|
|
16
|
+
currencyId: string;
|
|
17
|
+
} => {
|
|
18
|
+
const [accountId, contract, tokenId, currencyId] = id.split("+");
|
|
11
19
|
|
|
12
20
|
return {
|
|
13
21
|
accountId,
|
|
14
22
|
contract,
|
|
15
23
|
tokenId,
|
|
24
|
+
currencyId,
|
|
16
25
|
};
|
|
17
26
|
};
|
package/src/nft/support.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, CryptoCurrency } from "../types";
|
|
1
|
+
import { Transaction, CryptoCurrency, ProtoNFT } from "../types";
|
|
2
2
|
import { getEnv } from "../env";
|
|
3
3
|
|
|
4
4
|
export const isNftTransaction = (transaction: Transaction): boolean => {
|
|
@@ -12,3 +12,16 @@ export const isNftTransaction = (transaction: Transaction): boolean => {
|
|
|
12
12
|
export function isNFTActive(currency: CryptoCurrency): boolean {
|
|
13
13
|
return getEnv("NFT_CURRENCIES").split(",").includes(currency.id);
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
const nftCapabilities = {
|
|
17
|
+
hasQuantity: ["ERC1155"],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const getNftCapabilities = (nft: ProtoNFT) =>
|
|
21
|
+
Object.entries(nftCapabilities).reduce(
|
|
22
|
+
(acc, [capability, standards]) => ({
|
|
23
|
+
...acc,
|
|
24
|
+
[capability]: standards.includes(nft.standard),
|
|
25
|
+
}),
|
|
26
|
+
{}
|
|
27
|
+
);
|