@ledgerhq/live-common 34.51.0-nightly.1 → 34.51.0-nightly.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib/bridge/crypto-assets/index.js +0 -2
- package/lib/bridge/crypto-assets/index.js.map +1 -1
- package/lib/bridge/crypto-assets/index.test.js +0 -4
- package/lib/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.js +2 -0
- package/lib/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +1 -0
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +3 -0
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +37 -45
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +0 -20
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/signRawOperation.d.ts +8 -0
- package/lib/bridge/generic-alpaca/signRawOperation.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/signRawOperation.js +55 -0
- package/lib/bridge/generic-alpaca/signRawOperation.js.map +1 -0
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js +1 -0
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +186 -88
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +1 -0
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/mockHelpers.d.ts +1 -0
- package/lib/bridge/mockHelpers.d.ts.map +1 -1
- package/lib/bridge/mockHelpers.js +53 -1
- package/lib/bridge/mockHelpers.js.map +1 -1
- package/lib/bridge/react/BridgeSync.d.ts +1 -0
- package/lib/bridge/react/BridgeSync.d.ts.map +1 -1
- package/lib/bridge/react/BridgeSync.js +19 -16
- package/lib/bridge/react/BridgeSync.js.map +1 -1
- package/lib/bridge/react/BridgeSync.test.js +403 -66
- package/lib/bridge/react/BridgeSync.test.js.map +1 -1
- package/lib/currencies/index.d.ts +1 -1
- package/lib/currencies/index.d.ts.map +1 -1
- package/lib/currencies/index.js +2 -3
- package/lib/currencies/index.js.map +1 -1
- package/lib/currencies/sortByMarketcap.test.js +1 -3
- package/lib/currencies/sortByMarketcap.test.js.map +1 -1
- package/lib/dada-client/entities/index.d.ts +1 -1
- package/lib/dada-client/entities/index.d.ts.map +1 -1
- package/lib/e2e/enum/Account.d.ts +4 -0
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +4 -0
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +1 -0
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +1 -0
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +2 -0
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +2 -0
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +2 -1
- package/lib/e2e/enum/Network.d.ts.map +1 -1
- package/lib/e2e/enum/Network.js +1 -0
- package/lib/e2e/enum/Network.js.map +1 -1
- package/lib/e2e/enum/TokenType.d.ts +2 -1
- package/lib/e2e/enum/TokenType.d.ts.map +1 -1
- package/lib/e2e/enum/TokenType.js +1 -0
- package/lib/e2e/enum/TokenType.js.map +1 -1
- package/lib/e2e/enum/TransactionStatus.d.ts +4 -1
- package/lib/e2e/enum/TransactionStatus.d.ts.map +1 -1
- package/lib/e2e/enum/TransactionStatus.js +3 -0
- package/lib/e2e/enum/TransactionStatus.js.map +1 -1
- package/lib/e2e/families/sui.d.ts +2 -0
- package/lib/e2e/families/sui.d.ts.map +1 -0
- package/lib/e2e/families/sui.js +11 -0
- package/lib/e2e/families/sui.js.map +1 -0
- package/lib/e2e/index.d.ts +11 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +1 -0
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +23 -1
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/exchange/providers/swap.js +4 -4
- package/lib/exchange/providers/swap.js.map +1 -1
- package/lib/exchange/swap/api/v5/__mocks__/fetchRates.mocks.d.ts.map +1 -1
- package/lib/exchange/swap/api/v5/__mocks__/fetchRates.mocks.js +1 -1
- package/lib/exchange/swap/api/v5/__mocks__/fetchRates.mocks.js.map +1 -1
- package/lib/exchange/swap/mock.js +1 -1
- package/lib/exchange/swap/mock.js.map +1 -1
- package/lib/families/algorand/bridge/mock.d.ts.map +1 -1
- package/lib/families/algorand/bridge/mock.js +1 -0
- package/lib/families/algorand/bridge/mock.js.map +1 -1
- package/lib/families/bitcoin/bridge/mock.d.ts.map +1 -1
- package/lib/families/bitcoin/bridge/mock.js +1 -0
- package/lib/families/bitcoin/bridge/mock.js.map +1 -1
- package/lib/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock.js +3 -0
- package/lib/families/canton/bridge/mock.js.map +1 -1
- package/lib/families/cardano/bridge/mock.d.ts.map +1 -1
- package/lib/families/cardano/bridge/mock.js +1 -0
- package/lib/families/cardano/bridge/mock.js.map +1 -1
- package/lib/families/casper/bridge/mock.d.ts.map +1 -1
- package/lib/families/casper/bridge/mock.js +1 -0
- package/lib/families/casper/bridge/mock.js.map +1 -1
- package/lib/families/cosmos/bridge/mock.d.ts.map +1 -1
- package/lib/families/cosmos/bridge/mock.js +1 -0
- package/lib/families/cosmos/bridge/mock.js.map +1 -1
- package/lib/families/evm/bridge/mock.d.ts.map +1 -1
- package/lib/families/evm/bridge/mock.js +1 -0
- package/lib/families/evm/bridge/mock.js.map +1 -1
- package/lib/families/icon/bridge/mock.d.ts.map +1 -1
- package/lib/families/icon/bridge/mock.js +1 -0
- package/lib/families/icon/bridge/mock.js.map +1 -1
- package/lib/families/multiversx/bridge/mock.d.ts.map +1 -1
- package/lib/families/multiversx/bridge/mock.js +1 -0
- package/lib/families/multiversx/bridge/mock.js.map +1 -1
- package/lib/families/polkadot/bridge/mock.d.ts.map +1 -1
- package/lib/families/polkadot/bridge/mock.js +1 -0
- package/lib/families/polkadot/bridge/mock.js.map +1 -1
- package/lib/families/polkadot/config.d.ts.map +1 -1
- package/lib/families/polkadot/config.js +84 -0
- package/lib/families/polkadot/config.js.map +1 -1
- package/lib/families/polkadot/setup.d.ts.map +1 -1
- package/lib/families/polkadot/setup.js +5 -4
- package/lib/families/polkadot/setup.js.map +1 -1
- package/lib/families/solana/bridge/mock.d.ts +1 -0
- package/lib/families/solana/bridge/mock.d.ts.map +1 -1
- package/lib/families/stellar/bridge/mock.d.ts.map +1 -1
- package/lib/families/stellar/bridge/mock.js +1 -0
- package/lib/families/stellar/bridge/mock.js.map +1 -1
- package/lib/families/tezos/bridge/mock.d.ts.map +1 -1
- package/lib/families/tezos/bridge/mock.js +1 -0
- package/lib/families/tezos/bridge/mock.js.map +1 -1
- package/lib/families/tron/bridge/mock.d.ts.map +1 -1
- package/lib/families/tron/bridge/mock.js +1 -0
- package/lib/families/tron/bridge/mock.js.map +1 -1
- package/lib/families/xrp/bridge/mock.d.ts.map +1 -1
- package/lib/families/xrp/bridge/mock.js +1 -0
- package/lib/families/xrp/bridge/mock.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +14 -1
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/generated/bridge/mock.d.ts +1 -0
- package/lib/generated/bridge/mock.d.ts.map +1 -1
- package/lib/hooks/useManifestWithSessionId.d.ts +12 -0
- package/lib/hooks/useManifestWithSessionId.d.ts.map +1 -0
- package/lib/hooks/useManifestWithSessionId.js +67 -0
- package/lib/hooks/useManifestWithSessionId.js.map +1 -0
- package/lib/hooks/useManifestWithSessionId.test.d.ts +2 -0
- package/lib/hooks/useManifestWithSessionId.test.d.ts.map +1 -0
- package/lib/hooks/useManifestWithSessionId.test.js +71 -0
- package/lib/hooks/useManifestWithSessionId.test.js.map +1 -0
- package/lib/hw/actions/rawTransaction.d.ts +37 -0
- package/lib/hw/actions/rawTransaction.d.ts.map +1 -0
- package/lib/hw/actions/rawTransaction.js +107 -0
- package/lib/hw/actions/rawTransaction.js.map +1 -0
- package/lib/market/utils/index.d.ts +1 -0
- package/lib/market/utils/index.d.ts.map +1 -1
- package/lib/market/utils/index.js +16 -0
- package/lib/market/utils/index.js.map +1 -1
- package/lib/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.d.ts +2 -0
- package/lib/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.js +350 -0
- package/lib/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.js.map +1 -0
- package/lib/modularDrawer/hooks/index.d.ts +2 -0
- package/lib/modularDrawer/hooks/index.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/index.js +6 -0
- package/lib/modularDrawer/hooks/index.js.map +1 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +9 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib/modularDrawer/hooks/useDetailedAccountsCore.d.ts +14 -0
- package/lib/modularDrawer/hooks/useDetailedAccountsCore.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useDetailedAccountsCore.js +119 -0
- package/lib/modularDrawer/hooks/useDetailedAccountsCore.js.map +1 -0
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js +9 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +6 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +12 -4
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib/modularDrawer/index.d.ts +4 -0
- package/lib/modularDrawer/index.d.ts.map +1 -0
- package/lib/modularDrawer/index.js +20 -0
- package/lib/modularDrawer/index.js.map +1 -0
- package/lib/modularDrawer/types/detailedAccount.d.ts +46 -0
- package/lib/modularDrawer/types/detailedAccount.d.ts.map +1 -0
- package/lib/modularDrawer/types/detailedAccount.js +3 -0
- package/lib/modularDrawer/types/detailedAccount.js.map +1 -0
- package/lib/modularDrawer/types/index.d.ts +2 -0
- package/lib/modularDrawer/types/index.d.ts.map +1 -0
- package/lib/modularDrawer/types/index.js +18 -0
- package/lib/modularDrawer/types/index.js.map +1 -0
- package/lib/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.js +106 -0
- package/lib/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.js.map +1 -0
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +3 -4
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +7 -0
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -1
- package/lib/modularDrawer/utils/index.d.ts +1 -0
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +3 -1
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/modularDrawer/utils/sortAccountsByFiatValue.d.ts +8 -0
- package/lib/modularDrawer/utils/sortAccountsByFiatValue.d.ts.map +1 -0
- package/lib/modularDrawer/utils/sortAccountsByFiatValue.js +17 -0
- package/lib/modularDrawer/utils/sortAccountsByFiatValue.js.map +1 -0
- package/lib/modularDrawer/utils/type.d.ts +2 -2
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib/platform/providers/RemoteLiveAppProvider/api/mock.json +3 -3
- package/lib/wallet-api/logic.d.ts +1 -0
- package/lib/wallet-api/logic.d.ts.map +1 -1
- package/lib/wallet-api/logic.js +21 -1
- package/lib/wallet-api/logic.js.map +1 -1
- package/lib/wallet-api/react.d.ts +9 -1
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +60 -2
- package/lib/wallet-api/react.js.map +1 -1
- package/lib/wallet-api/tracking.d.ts +3 -0
- package/lib/wallet-api/tracking.d.ts.map +1 -1
- package/lib/wallet-api/tracking.js +12 -0
- package/lib/wallet-api/tracking.js.map +1 -1
- package/lib/wallet-api/useDappLogic.js +1 -1
- package/lib/wallet-api/useDappLogic.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib-es/bridge/crypto-assets/index.js +0 -2
- package/lib-es/bridge/crypto-assets/index.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.test.js +0 -4
- package/lib-es/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.js +2 -0
- package/lib-es/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +1 -0
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +3 -0
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +37 -45
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +0 -17
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signRawOperation.d.ts +8 -0
- package/lib-es/bridge/generic-alpaca/signRawOperation.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/signRawOperation.js +48 -0
- package/lib-es/bridge/generic-alpaca/signRawOperation.js.map +1 -0
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js +1 -0
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +163 -88
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +1 -0
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/mockHelpers.d.ts +1 -0
- package/lib-es/bridge/mockHelpers.d.ts.map +1 -1
- package/lib-es/bridge/mockHelpers.js +51 -0
- package/lib-es/bridge/mockHelpers.js.map +1 -1
- package/lib-es/bridge/react/BridgeSync.d.ts +1 -0
- package/lib-es/bridge/react/BridgeSync.d.ts.map +1 -1
- package/lib-es/bridge/react/BridgeSync.js +17 -15
- package/lib-es/bridge/react/BridgeSync.js.map +1 -1
- package/lib-es/bridge/react/BridgeSync.test.js +382 -65
- package/lib-es/bridge/react/BridgeSync.test.js.map +1 -1
- package/lib-es/currencies/index.d.ts +1 -1
- package/lib-es/currencies/index.d.ts.map +1 -1
- package/lib-es/currencies/index.js +1 -1
- package/lib-es/currencies/index.js.map +1 -1
- package/lib-es/currencies/sortByMarketcap.test.js +1 -3
- package/lib-es/currencies/sortByMarketcap.test.js.map +1 -1
- package/lib-es/dada-client/entities/index.d.ts +1 -1
- package/lib-es/dada-client/entities/index.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +4 -0
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +4 -0
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +1 -0
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +1 -0
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +2 -0
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +2 -0
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +2 -1
- package/lib-es/e2e/enum/Network.d.ts.map +1 -1
- package/lib-es/e2e/enum/Network.js +1 -0
- package/lib-es/e2e/enum/Network.js.map +1 -1
- package/lib-es/e2e/enum/TokenType.d.ts +2 -1
- package/lib-es/e2e/enum/TokenType.d.ts.map +1 -1
- package/lib-es/e2e/enum/TokenType.js +1 -0
- package/lib-es/e2e/enum/TokenType.js.map +1 -1
- package/lib-es/e2e/enum/TransactionStatus.d.ts +4 -1
- package/lib-es/e2e/enum/TransactionStatus.d.ts.map +1 -1
- package/lib-es/e2e/enum/TransactionStatus.js +3 -0
- package/lib-es/e2e/enum/TransactionStatus.js.map +1 -1
- package/lib-es/e2e/families/sui.d.ts +2 -0
- package/lib-es/e2e/families/sui.d.ts.map +1 -0
- package/lib-es/e2e/families/sui.js +7 -0
- package/lib-es/e2e/families/sui.js.map +1 -0
- package/lib-es/e2e/index.d.ts +11 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +1 -0
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +21 -0
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/env.react.d.ts +1 -1
- package/lib-es/env.react.d.ts.map +1 -1
- package/lib-es/exchange/providers/swap.js +4 -4
- package/lib-es/exchange/providers/swap.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/__mocks__/fetchRates.mocks.d.ts.map +1 -1
- package/lib-es/exchange/swap/api/v5/__mocks__/fetchRates.mocks.js +1 -1
- package/lib-es/exchange/swap/api/v5/__mocks__/fetchRates.mocks.js.map +1 -1
- package/lib-es/exchange/swap/mock.js +1 -1
- package/lib-es/exchange/swap/mock.js.map +1 -1
- package/lib-es/families/algorand/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/algorand/bridge/mock.js +2 -1
- package/lib-es/families/algorand/bridge/mock.js.map +1 -1
- package/lib-es/families/bitcoin/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/bitcoin/bridge/mock.js +2 -1
- package/lib-es/families/bitcoin/bridge/mock.js.map +1 -1
- package/lib-es/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock.js +3 -0
- package/lib-es/families/canton/bridge/mock.js.map +1 -1
- package/lib-es/families/cardano/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/cardano/bridge/mock.js +2 -1
- package/lib-es/families/cardano/bridge/mock.js.map +1 -1
- package/lib-es/families/casper/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/casper/bridge/mock.js +2 -1
- package/lib-es/families/casper/bridge/mock.js.map +1 -1
- package/lib-es/families/cosmos/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/cosmos/bridge/mock.js +2 -1
- package/lib-es/families/cosmos/bridge/mock.js.map +1 -1
- package/lib-es/families/evm/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/evm/bridge/mock.js +2 -1
- package/lib-es/families/evm/bridge/mock.js.map +1 -1
- package/lib-es/families/icon/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/icon/bridge/mock.js +2 -1
- package/lib-es/families/icon/bridge/mock.js.map +1 -1
- package/lib-es/families/multiversx/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/multiversx/bridge/mock.js +2 -1
- package/lib-es/families/multiversx/bridge/mock.js.map +1 -1
- package/lib-es/families/polkadot/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/polkadot/bridge/mock.js +2 -1
- package/lib-es/families/polkadot/bridge/mock.js.map +1 -1
- package/lib-es/families/polkadot/config.d.ts.map +1 -1
- package/lib-es/families/polkadot/config.js +84 -0
- package/lib-es/families/polkadot/config.js.map +1 -1
- package/lib-es/families/polkadot/setup.d.ts.map +1 -1
- package/lib-es/families/polkadot/setup.js +5 -4
- package/lib-es/families/polkadot/setup.js.map +1 -1
- package/lib-es/families/solana/bridge/mock.d.ts +1 -0
- package/lib-es/families/solana/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/stellar/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/stellar/bridge/mock.js +2 -1
- package/lib-es/families/stellar/bridge/mock.js.map +1 -1
- package/lib-es/families/tezos/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/tezos/bridge/mock.js +2 -1
- package/lib-es/families/tezos/bridge/mock.js.map +1 -1
- package/lib-es/families/tron/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/tron/bridge/mock.js +2 -1
- package/lib-es/families/tron/bridge/mock.js.map +1 -1
- package/lib-es/families/xrp/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/xrp/bridge/mock.js +2 -1
- package/lib-es/families/xrp/bridge/mock.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +14 -1
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/generated/bridge/mock.d.ts +1 -0
- package/lib-es/generated/bridge/mock.d.ts.map +1 -1
- package/lib-es/hooks/useManifestWithSessionId.d.ts +12 -0
- package/lib-es/hooks/useManifestWithSessionId.d.ts.map +1 -0
- package/lib-es/hooks/useManifestWithSessionId.js +60 -0
- package/lib-es/hooks/useManifestWithSessionId.js.map +1 -0
- package/lib-es/hooks/useManifestWithSessionId.test.d.ts +2 -0
- package/lib-es/hooks/useManifestWithSessionId.test.d.ts.map +1 -0
- package/lib-es/hooks/useManifestWithSessionId.test.js +69 -0
- package/lib-es/hooks/useManifestWithSessionId.test.js.map +1 -0
- package/lib-es/hw/actions/rawTransaction.d.ts +37 -0
- package/lib-es/hw/actions/rawTransaction.d.ts.map +1 -0
- package/lib-es/hw/actions/rawTransaction.js +103 -0
- package/lib-es/hw/actions/rawTransaction.js.map +1 -0
- package/lib-es/market/utils/index.d.ts +1 -0
- package/lib-es/market/utils/index.d.ts.map +1 -1
- package/lib-es/market/utils/index.js +2 -0
- package/lib-es/market/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.d.ts +2 -0
- package/lib-es/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.js +345 -0
- package/lib-es/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.js.map +1 -0
- package/lib-es/modularDrawer/hooks/index.d.ts +2 -0
- package/lib-es/modularDrawer/hooks/index.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/index.js +2 -0
- package/lib-es/modularDrawer/hooks/index.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +9 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useDetailedAccountsCore.d.ts +14 -0
- package/lib-es/modularDrawer/hooks/useDetailedAccountsCore.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useDetailedAccountsCore.js +115 -0
- package/lib-es/modularDrawer/hooks/useDetailedAccountsCore.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +6 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +6 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +9 -4
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib-es/modularDrawer/index.d.ts +4 -0
- package/lib-es/modularDrawer/index.d.ts.map +1 -0
- package/lib-es/modularDrawer/index.js +4 -0
- package/lib-es/modularDrawer/index.js.map +1 -0
- package/lib-es/modularDrawer/types/detailedAccount.d.ts +46 -0
- package/lib-es/modularDrawer/types/detailedAccount.d.ts.map +1 -0
- package/lib-es/modularDrawer/types/detailedAccount.js +2 -0
- package/lib-es/modularDrawer/types/detailedAccount.js.map +1 -0
- package/lib-es/modularDrawer/types/index.d.ts +2 -0
- package/lib-es/modularDrawer/types/index.d.ts.map +1 -0
- package/lib-es/modularDrawer/types/index.js +2 -0
- package/lib-es/modularDrawer/types/index.js.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.js +101 -0
- package/lib-es/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +3 -4
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +4 -0
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -1
- package/lib-es/modularDrawer/utils/index.d.ts +1 -0
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +1 -0
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/utils/sortAccountsByFiatValue.d.ts +8 -0
- package/lib-es/modularDrawer/utils/sortAccountsByFiatValue.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/sortAccountsByFiatValue.js +13 -0
- package/lib-es/modularDrawer/utils/sortAccountsByFiatValue.js.map +1 -0
- package/lib-es/modularDrawer/utils/type.d.ts +2 -2
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/platform/providers/RemoteLiveAppProvider/api/mock.json +3 -3
- package/lib-es/wallet-api/logic.d.ts +1 -0
- package/lib-es/wallet-api/logic.d.ts.map +1 -1
- package/lib-es/wallet-api/logic.js +19 -0
- package/lib-es/wallet-api/logic.js.map +1 -1
- package/lib-es/wallet-api/react.d.ts +9 -1
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +61 -3
- package/lib-es/wallet-api/react.js.map +1 -1
- package/lib-es/wallet-api/tracking.d.ts +3 -0
- package/lib-es/wallet-api/tracking.d.ts.map +1 -1
- package/lib-es/wallet-api/tracking.js +12 -0
- package/lib-es/wallet-api/tracking.js.map +1 -1
- package/lib-es/wallet-api/useDappLogic.js +2 -2
- package/lib-es/wallet-api/useDappLogic.js.map +1 -1
- package/package.json +59 -59
- package/src/bridge/crypto-assets/index.test.ts +0 -4
- package/src/bridge/crypto-assets/index.ts +0 -2
- package/src/bridge/generic-alpaca/accountBridge.ts +2 -0
- package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +8 -0
- package/src/bridge/generic-alpaca/prepareTransaction.ts +46 -69
- package/src/bridge/generic-alpaca/signOperation.ts +0 -20
- package/src/bridge/generic-alpaca/signRawOperation.ts +86 -0
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +1 -0
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +191 -109
- package/src/bridge/generic-alpaca/utils.ts +1 -0
- package/src/bridge/mockHelpers.ts +57 -0
- package/src/bridge/react/BridgeSync.test.tsx +513 -82
- package/src/bridge/react/BridgeSync.tsx +18 -17
- package/src/currencies/index.ts +1 -2
- package/src/currencies/sortByMarketcap.test.ts +1 -3
- package/src/dada-client/MIGRATION_GUIDE.md +215 -0
- package/src/dada-client/entities/index.ts +1 -1
- package/src/e2e/enum/Account.ts +31 -0
- package/src/e2e/enum/AppInfos.ts +2 -0
- package/src/e2e/enum/Currency.ts +11 -0
- package/src/e2e/enum/Network.ts +1 -0
- package/src/e2e/enum/TokenType.ts +1 -0
- package/src/e2e/enum/TransactionStatus.ts +3 -0
- package/src/e2e/families/sui.ts +7 -0
- package/src/e2e/speculos.ts +23 -0
- package/src/exchange/providers/swap.ts +4 -4
- package/src/exchange/swap/api/v5/__mocks__/fetchRates.mocks.ts +1 -2
- package/src/exchange/swap/mock.ts +1 -1
- package/src/families/algorand/bridge/mock.ts +2 -0
- package/src/families/bitcoin/bridge/mock.ts +2 -0
- package/src/families/canton/bridge/mock.ts +3 -0
- package/src/families/cardano/bridge/mock.ts +2 -0
- package/src/families/casper/bridge/mock.ts +2 -0
- package/src/families/cosmos/bridge/mock.ts +2 -0
- package/src/families/evm/bridge/mock.ts +2 -0
- package/src/families/icon/bridge/mock.ts +2 -0
- package/src/families/multiversx/bridge/mock.ts +2 -0
- package/src/families/polkadot/bridge/mock.ts +2 -0
- package/src/families/polkadot/config.ts +84 -0
- package/src/families/polkadot/setup.ts +6 -4
- package/src/families/stellar/bridge/mock.ts +2 -0
- package/src/families/tezos/bridge/mock.ts +2 -0
- package/src/families/tron/bridge/mock.ts +2 -0
- package/src/families/xrp/bridge/mock.ts +2 -0
- package/src/featureFlags/defaultFeatures.ts +15 -1
- package/src/hooks/useManifestWithSessionId.test.ts +105 -0
- package/src/hooks/useManifestWithSessionId.ts +83 -0
- package/src/hw/actions/rawTransaction.ts +190 -0
- package/src/market/utils/index.ts +3 -0
- package/src/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.ts +472 -0
- package/src/modularDrawer/hooks/index.ts +1 -0
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +9 -0
- package/src/modularDrawer/hooks/useDetailedAccountsCore.ts +146 -0
- package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +5 -1
- package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +10 -4
- package/src/modularDrawer/index.ts +3 -0
- package/src/modularDrawer/types/detailedAccount.ts +49 -0
- package/src/modularDrawer/types/index.ts +1 -0
- package/src/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.ts +117 -0
- package/src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts +6 -3
- package/src/modularDrawer/utils/index.ts +1 -0
- package/src/modularDrawer/utils/sortAccountsByFiatValue.ts +14 -0
- package/src/modularDrawer/utils/type.ts +3 -2
- package/src/platform/providers/RemoteLiveAppProvider/api/mock.json +3 -3
- package/src/wallet-api/logic.ts +35 -0
- package/src/wallet-api/react.ts +87 -1
- package/src/wallet-api/tracking.ts +15 -0
- package/src/wallet-api/useDappLogic.ts +3 -3
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
3
|
+
import type { Account, DeviceId, SignOperationEvent, AccountBridge } from "@ledgerhq/types-live";
|
|
4
|
+
import { getAlpacaApi } from "./alpaca";
|
|
5
|
+
import { buildOptimisticOperation } from "./utils";
|
|
6
|
+
import { Result } from "@ledgerhq/coin-framework/derivation";
|
|
7
|
+
import { log } from "@ledgerhq/logs";
|
|
8
|
+
import BigNumber from "bignumber.js";
|
|
9
|
+
import { GenericTransaction } from "./types";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Sign Transaction with Ledger hardware
|
|
13
|
+
*/
|
|
14
|
+
export const genericSignRawOperation =
|
|
15
|
+
(network, kind) =>
|
|
16
|
+
(signerContext: SignerContext<any>): AccountBridge<GenericTransaction>["signRawOperation"] =>
|
|
17
|
+
({
|
|
18
|
+
account,
|
|
19
|
+
transaction,
|
|
20
|
+
deviceId,
|
|
21
|
+
}: {
|
|
22
|
+
account: Account;
|
|
23
|
+
transaction: string;
|
|
24
|
+
deviceId: DeviceId;
|
|
25
|
+
}): Observable<SignOperationEvent> =>
|
|
26
|
+
new Observable(o => {
|
|
27
|
+
async function main() {
|
|
28
|
+
const alpacaApi = getAlpacaApi(account.currency.id, kind);
|
|
29
|
+
const signedInfo = await signerContext(deviceId, async signer => {
|
|
30
|
+
const derivationPath = account.freshAddressPath;
|
|
31
|
+
const { publicKey } = (await signer.getAddress(derivationPath)) as Result;
|
|
32
|
+
|
|
33
|
+
const sender = account.freshAddress;
|
|
34
|
+
|
|
35
|
+
// TODO: should compute it and pass it down to craftTransaction (duplicate call right now)
|
|
36
|
+
const sequenceNumber = await alpacaApi.getSequence(sender);
|
|
37
|
+
|
|
38
|
+
/* Craft unsigned blob via Alpaca */
|
|
39
|
+
const { transaction: unsigned } = await alpacaApi.craftRawTransaction(
|
|
40
|
+
transaction,
|
|
41
|
+
sender,
|
|
42
|
+
publicKey,
|
|
43
|
+
sequenceNumber,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
/* Notify UI that the device is now showing the tx */
|
|
47
|
+
o.next({ type: "device-signature-requested" });
|
|
48
|
+
/* Sign on Ledger device */
|
|
49
|
+
const txnSig = await signer.signTransaction(derivationPath, unsigned);
|
|
50
|
+
return { unsigned, txnSig, publicKey, sequence: sequenceNumber };
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/* If the user cancelled inside signerContext */
|
|
54
|
+
if (!signedInfo) return;
|
|
55
|
+
o.next({ type: "device-signature-granted" });
|
|
56
|
+
|
|
57
|
+
/* Combine payload + signature for broadcast */
|
|
58
|
+
const combined = await alpacaApi.combine(
|
|
59
|
+
signedInfo.unsigned,
|
|
60
|
+
signedInfo.txnSig,
|
|
61
|
+
signedInfo.publicKey,
|
|
62
|
+
);
|
|
63
|
+
const operation = buildOptimisticOperation(
|
|
64
|
+
account,
|
|
65
|
+
{ family: account.currency.family, amount: new BigNumber(0), recipient: "" },
|
|
66
|
+
signedInfo.sequence,
|
|
67
|
+
);
|
|
68
|
+
if (!operation.id) {
|
|
69
|
+
log("Generic alpaca", "buildOptimisticOperation", operation);
|
|
70
|
+
}
|
|
71
|
+
// NOTE: we set the transactionSequenceNumber before on the operation
|
|
72
|
+
// now that we create it in craftTransaction, we might need to return it back from craftTransaction also
|
|
73
|
+
o.next({
|
|
74
|
+
type: "signed",
|
|
75
|
+
signedOperation: {
|
|
76
|
+
operation,
|
|
77
|
+
signature: combined,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
main().then(
|
|
83
|
+
() => o.complete(),
|
|
84
|
+
e => o.error(e),
|
|
85
|
+
);
|
|
86
|
+
});
|
|
@@ -48,6 +48,7 @@ jest.mock("../buildSubAccounts", () => ({
|
|
|
48
48
|
const chains = [
|
|
49
49
|
{ currency: { id: "stellar", name: "Stellar" }, network: "testnet" },
|
|
50
50
|
{ currency: { id: "ripple", name: "XRP" }, network: "mainnet" },
|
|
51
|
+
{ currency: { id: "tezos", name: "Tezos" }, network: "mainnet" },
|
|
51
52
|
];
|
|
52
53
|
|
|
53
54
|
describe("genericGetAccountShape (stellar & xrp)", () => {
|
|
@@ -1,172 +1,254 @@
|
|
|
1
1
|
import { genericPrepareTransaction } from "../prepareTransaction";
|
|
2
2
|
import { getAlpacaApi } from "../alpaca";
|
|
3
|
-
import { transactionToIntent } from "../utils";
|
|
4
3
|
import BigNumber from "bignumber.js";
|
|
4
|
+
import * as accountModule from "@ledgerhq/coin-framework/account/index";
|
|
5
|
+
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
6
|
+
import { Account } from "@ledgerhq/types-live";
|
|
5
7
|
|
|
6
8
|
jest.mock("../alpaca", () => ({
|
|
7
9
|
getAlpacaApi: jest.fn(),
|
|
8
10
|
}));
|
|
9
11
|
|
|
10
|
-
jest.mock("../utils", () => ({
|
|
11
|
-
transactionToIntent: jest.fn(),
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
12
|
describe("genericPrepareTransaction", () => {
|
|
15
13
|
const network = "testnet";
|
|
16
14
|
const kind = "local";
|
|
17
15
|
|
|
18
|
-
const account = {
|
|
19
|
-
id: "test-account",
|
|
20
|
-
address: "0xabc",
|
|
21
|
-
currency: { id: "ethereum" },
|
|
22
|
-
} as any;
|
|
23
|
-
|
|
24
|
-
const baseTransaction = {
|
|
25
|
-
amount: new BigNumber(100_000),
|
|
26
|
-
fees: new BigNumber(500),
|
|
27
|
-
recipient: "0xrecipient",
|
|
28
|
-
family: "family",
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const txIntent = { mock: "intent" };
|
|
32
|
-
|
|
33
16
|
beforeEach(() => {
|
|
34
17
|
jest.clearAllMocks();
|
|
35
|
-
(transactionToIntent as jest.Mock).mockReturnValue(txIntent);
|
|
36
18
|
});
|
|
37
19
|
|
|
38
|
-
it("
|
|
39
|
-
const newFee = new BigNumber(700);
|
|
40
|
-
|
|
20
|
+
it("embeds assets info, if existing", async () => {
|
|
41
21
|
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
42
|
-
estimateFees: jest.fn().mockResolvedValue({ value:
|
|
22
|
+
estimateFees: jest.fn().mockResolvedValue({ value: 500n }),
|
|
23
|
+
getAssetFromToken: jest.fn().mockImplementation((token, owner) => {
|
|
24
|
+
return {
|
|
25
|
+
assetOwner: owner,
|
|
26
|
+
assetReference: token.contractAddress,
|
|
27
|
+
};
|
|
28
|
+
}),
|
|
43
29
|
});
|
|
30
|
+
jest.spyOn(accountModule, "decodeTokenAccountId").mockImplementation(accountId => {
|
|
31
|
+
const token =
|
|
32
|
+
accountId === "ethereum_usdc_sub_account"
|
|
33
|
+
? ({ contractAddress: "usdc_contract" } as TokenCurrency)
|
|
34
|
+
: undefined;
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
return { accountId, token };
|
|
37
|
+
});
|
|
47
38
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
40
|
+
const resultUsdcToken = await prepareTransaction(
|
|
41
|
+
{ currency: { id: "ethereum", units: [{}] }, freshAddress: "0xabc" } as Account,
|
|
42
|
+
{
|
|
43
|
+
amount: new BigNumber(100_000),
|
|
44
|
+
fees: new BigNumber(500),
|
|
45
|
+
recipient: "0xrecipient",
|
|
46
|
+
family: "family",
|
|
47
|
+
subAccountId: "ethereum_usdc_sub_account",
|
|
48
|
+
},
|
|
53
49
|
);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("returns original transaction if fees are the same", async () => {
|
|
57
|
-
const sameFee = baseTransaction.fees;
|
|
58
50
|
|
|
59
|
-
(
|
|
60
|
-
|
|
51
|
+
expect(resultUsdcToken).toEqual({
|
|
52
|
+
amount: new BigNumber(100_000),
|
|
53
|
+
fees: new BigNumber(500),
|
|
54
|
+
recipient: "0xrecipient",
|
|
55
|
+
family: "family",
|
|
56
|
+
assetReference: "usdc_contract",
|
|
57
|
+
assetOwner: "0xabc",
|
|
58
|
+
subAccountId: "ethereum_usdc_sub_account",
|
|
61
59
|
});
|
|
62
60
|
|
|
63
|
-
const
|
|
64
|
-
|
|
61
|
+
const resultUnknownToken = await prepareTransaction(
|
|
62
|
+
{ currency: { id: "ethereum", units: [{}] } } as Account,
|
|
63
|
+
{
|
|
64
|
+
amount: new BigNumber(100_000),
|
|
65
|
+
fees: new BigNumber(500),
|
|
66
|
+
recipient: "0xrecipient",
|
|
67
|
+
family: "family",
|
|
68
|
+
subAccountId: "ethereum_unknown_sub_account",
|
|
69
|
+
},
|
|
70
|
+
);
|
|
65
71
|
|
|
66
|
-
expect(
|
|
72
|
+
expect(resultUnknownToken).toEqual({
|
|
73
|
+
amount: new BigNumber(100_000),
|
|
74
|
+
fees: new BigNumber(500),
|
|
75
|
+
recipient: "0xrecipient",
|
|
76
|
+
family: "family",
|
|
77
|
+
assetReference: "",
|
|
78
|
+
assetOwner: "",
|
|
79
|
+
subAccountId: "ethereum_unknown_sub_account",
|
|
80
|
+
});
|
|
67
81
|
});
|
|
68
82
|
|
|
69
|
-
it(
|
|
70
|
-
|
|
83
|
+
it.each([
|
|
84
|
+
["all native amount", { useAllAmount: true }, new BigNumber(42)],
|
|
85
|
+
["all native amount on staking scenarios", { mode: "stake" }, new BigNumber(42)],
|
|
86
|
+
["all native amount on unstaking scenarios", { mode: "unstake" }, new BigNumber(42)],
|
|
87
|
+
[
|
|
88
|
+
"all token amount",
|
|
89
|
+
{ subAccountId: "ethereum_usdc_sub_account", useAllAmount: true },
|
|
90
|
+
new BigNumber(5),
|
|
91
|
+
],
|
|
92
|
+
[
|
|
93
|
+
"all token amount on staking scenarios",
|
|
94
|
+
{ subAccountId: "ethereum_usdc_sub_account", mode: "stake" },
|
|
95
|
+
new BigNumber(5),
|
|
96
|
+
],
|
|
97
|
+
[
|
|
98
|
+
"all token amount on unstaking scenarios",
|
|
99
|
+
{ subAccountId: "ethereum_usdc_sub_account", mode: "unstake" },
|
|
100
|
+
new BigNumber(5),
|
|
101
|
+
],
|
|
102
|
+
] as const)("uses %s, updating the amount", async (_s, partialTransaction, expectedAmount) => {
|
|
71
103
|
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
72
|
-
estimateFees: jest.fn().mockResolvedValue({ value:
|
|
104
|
+
estimateFees: jest.fn().mockResolvedValue({ value: 8n }),
|
|
105
|
+
getAssetFromToken: jest.fn().mockImplementation((token, owner) => {
|
|
106
|
+
return {
|
|
107
|
+
assetOwner: owner,
|
|
108
|
+
assetReference: token.contractAddress,
|
|
109
|
+
};
|
|
110
|
+
}),
|
|
111
|
+
});
|
|
112
|
+
jest.spyOn(accountModule, "decodeTokenAccountId").mockImplementation(accountId => {
|
|
113
|
+
const token =
|
|
114
|
+
accountId === "ethereum_usdc_sub_account"
|
|
115
|
+
? ({ contractAddress: "usdc_contract" } as TokenCurrency)
|
|
116
|
+
: undefined;
|
|
117
|
+
|
|
118
|
+
return { accountId, token };
|
|
73
119
|
});
|
|
74
120
|
|
|
75
|
-
const txWithoutFees = { ...baseTransaction, fees: undefined as any };
|
|
76
121
|
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
77
|
-
const result = await prepareTransaction(
|
|
122
|
+
const result = await prepareTransaction(
|
|
123
|
+
{
|
|
124
|
+
currency: { id: "ethereum", units: [{}] },
|
|
125
|
+
spendableBalance: new BigNumber(50),
|
|
126
|
+
subAccounts: [{ id: "ethereum_usdc_sub_account", spendableBalance: new BigNumber(5) }],
|
|
127
|
+
} as Account,
|
|
128
|
+
{
|
|
129
|
+
amount: new BigNumber(0),
|
|
130
|
+
recipient: "0xrecipient",
|
|
131
|
+
family: "family",
|
|
132
|
+
...partialTransaction,
|
|
133
|
+
},
|
|
134
|
+
);
|
|
78
135
|
|
|
79
|
-
expect(
|
|
80
|
-
|
|
136
|
+
expect(result).toMatchObject({
|
|
137
|
+
amount: expectedAmount,
|
|
138
|
+
fees: new BigNumber(8),
|
|
139
|
+
recipient: "0xrecipient",
|
|
140
|
+
family: "family",
|
|
141
|
+
});
|
|
81
142
|
});
|
|
82
143
|
|
|
83
|
-
it("
|
|
84
|
-
const sameValue = new BigNumber(baseTransaction.fees.toString()); // different instance
|
|
144
|
+
it("updates fees from the estimation", async () => {
|
|
85
145
|
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
86
|
-
estimateFees: jest.fn().mockResolvedValue({ value:
|
|
146
|
+
estimateFees: jest.fn().mockResolvedValue({ value: 700n }),
|
|
87
147
|
});
|
|
88
148
|
|
|
89
149
|
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
90
|
-
const result = await prepareTransaction(
|
|
150
|
+
const result = await prepareTransaction(
|
|
151
|
+
{ currency: { id: "ethereum", units: [{}] } } as Account,
|
|
152
|
+
{
|
|
153
|
+
amount: new BigNumber(100_000),
|
|
154
|
+
fees: new BigNumber(500),
|
|
155
|
+
recipient: "0xrecipient",
|
|
156
|
+
family: "family",
|
|
157
|
+
},
|
|
158
|
+
);
|
|
91
159
|
|
|
92
|
-
expect(result).
|
|
160
|
+
expect(result).toEqual({
|
|
161
|
+
amount: new BigNumber(100_000),
|
|
162
|
+
fees: new BigNumber(700),
|
|
163
|
+
recipient: "0xrecipient",
|
|
164
|
+
family: "family",
|
|
165
|
+
assetReference: "",
|
|
166
|
+
assetOwner: "",
|
|
167
|
+
});
|
|
93
168
|
});
|
|
94
169
|
|
|
95
|
-
it("
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const estimateFeesFirstCall = jest.fn().mockResolvedValue({
|
|
99
|
-
value: estimatedFee,
|
|
100
|
-
parameters: { storageLimit: 300 },
|
|
170
|
+
it("updates fees from the existing custom", async () => {
|
|
171
|
+
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
172
|
+
estimateFees: jest.fn().mockResolvedValue({ value: 700n }),
|
|
101
173
|
});
|
|
102
174
|
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
175
|
+
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
176
|
+
const result = await prepareTransaction(
|
|
177
|
+
{ currency: { id: "ethereum", units: [{}] } } as Account,
|
|
178
|
+
{
|
|
179
|
+
amount: new BigNumber(100_000),
|
|
180
|
+
fees: new BigNumber(500),
|
|
181
|
+
recipient: "0xrecipient",
|
|
182
|
+
family: "family",
|
|
183
|
+
customFees: { parameters: { fees: new BigNumber(600) } },
|
|
184
|
+
},
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
expect(result).toEqual({
|
|
188
|
+
amount: new BigNumber(100_000),
|
|
189
|
+
fees: new BigNumber(600),
|
|
190
|
+
customFees: { parameters: { fees: new BigNumber(600) } },
|
|
191
|
+
recipient: "0xrecipient",
|
|
192
|
+
family: "family",
|
|
193
|
+
assetReference: "",
|
|
194
|
+
assetOwner: "",
|
|
106
195
|
});
|
|
196
|
+
});
|
|
107
197
|
|
|
198
|
+
it("propagates estimated 'storageLimit'", async () => {
|
|
108
199
|
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
109
200
|
estimateFees: jest
|
|
110
201
|
.fn()
|
|
111
|
-
.
|
|
112
|
-
.mockImplementationOnce(() => estimateFeesSecondCall()),
|
|
202
|
+
.mockResolvedValue({ value: 700n, parameters: { storageLimit: 277n } }),
|
|
113
203
|
});
|
|
114
204
|
|
|
115
|
-
const txWithoutCustomFees = { ...baseTransaction, customFees: undefined };
|
|
116
205
|
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
117
|
-
const result = await prepareTransaction(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
fees:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
fees: undefined,
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
}),
|
|
206
|
+
const result = await prepareTransaction(
|
|
207
|
+
{ currency: { id: "ethereum", units: [{}] } } as Account,
|
|
208
|
+
{
|
|
209
|
+
amount: new BigNumber(100_000),
|
|
210
|
+
fees: new BigNumber(500),
|
|
211
|
+
recipient: "0xrecipient",
|
|
212
|
+
family: "family",
|
|
213
|
+
},
|
|
129
214
|
);
|
|
130
215
|
|
|
131
|
-
expect(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
parameters: { storageLimit: 300 },
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
const estimateFeesSecondCall = jest.fn().mockResolvedValue({
|
|
143
|
-
value: estimatedFee,
|
|
144
|
-
parameters: { storageLimit: 277 },
|
|
216
|
+
expect(result).toEqual({
|
|
217
|
+
amount: new BigNumber(100_000),
|
|
218
|
+
fees: new BigNumber(700),
|
|
219
|
+
storageLimit: new BigNumber(277),
|
|
220
|
+
recipient: "0xrecipient",
|
|
221
|
+
family: "family",
|
|
222
|
+
assetReference: "",
|
|
223
|
+
assetOwner: "",
|
|
145
224
|
});
|
|
225
|
+
});
|
|
146
226
|
|
|
227
|
+
it("keeps the amount used during the estimation when using all native amount", async () => {
|
|
147
228
|
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
148
|
-
estimateFees: jest
|
|
149
|
-
.fn()
|
|
150
|
-
.mockImplementationOnce(() => estimateFeesFirstCall())
|
|
151
|
-
.mockImplementationOnce(() => estimateFeesSecondCall()),
|
|
229
|
+
estimateFees: jest.fn().mockResolvedValue({ value: 700n, parameters: { amount: 1000n } }),
|
|
152
230
|
});
|
|
153
231
|
|
|
154
|
-
const txWithoutCustomFees = { ...baseTransaction, customFees: undefined };
|
|
155
232
|
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
156
|
-
const result = await prepareTransaction(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
fees:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
}),
|
|
233
|
+
const result = await prepareTransaction(
|
|
234
|
+
{ currency: { id: "ethereum", units: [{}] } } as Account,
|
|
235
|
+
{
|
|
236
|
+
amount: new BigNumber(0),
|
|
237
|
+
fees: new BigNumber(500),
|
|
238
|
+
recipient: "0xrecipient",
|
|
239
|
+
family: "family",
|
|
240
|
+
useAllAmount: true,
|
|
241
|
+
},
|
|
168
242
|
);
|
|
169
243
|
|
|
170
|
-
expect(
|
|
244
|
+
expect(result).toEqual({
|
|
245
|
+
amount: new BigNumber(1000),
|
|
246
|
+
fees: new BigNumber(700),
|
|
247
|
+
recipient: "0xrecipient",
|
|
248
|
+
family: "family",
|
|
249
|
+
assetReference: "",
|
|
250
|
+
assetOwner: "",
|
|
251
|
+
useAllAmount: true,
|
|
252
|
+
});
|
|
171
253
|
});
|
|
172
254
|
});
|
|
@@ -134,6 +134,7 @@ export function transactionToIntent(
|
|
|
134
134
|
const res: TransactionIntent & { memo?: { type: string; value?: string } } & {
|
|
135
135
|
data?: { type: string; value?: unknown };
|
|
136
136
|
} = {
|
|
137
|
+
intentType: isStaking ? "staking" : "transaction",
|
|
137
138
|
type: intentType,
|
|
138
139
|
sender: account.freshAddress,
|
|
139
140
|
recipient: transaction.recipient,
|
|
@@ -183,3 +183,60 @@ export const makeAccountBridgeReceive: () => (
|
|
|
183
183
|
path: account.freshAddressPath,
|
|
184
184
|
publicKey: "mockPublickKey", // We could probably keep the publicKey in `account.freshPublicKey`
|
|
185
185
|
});
|
|
186
|
+
|
|
187
|
+
export const signRawOperation: AccountBridge<any>["signRawOperation"] = ({ account }) =>
|
|
188
|
+
new Observable(o => {
|
|
189
|
+
let cancelled = false;
|
|
190
|
+
|
|
191
|
+
async function main() {
|
|
192
|
+
await delay(1000);
|
|
193
|
+
if (cancelled) return;
|
|
194
|
+
|
|
195
|
+
for (let i = 0; i <= 1; i += 0.1) {
|
|
196
|
+
o.next({
|
|
197
|
+
type: "device-streaming",
|
|
198
|
+
progress: i,
|
|
199
|
+
index: i,
|
|
200
|
+
total: 10,
|
|
201
|
+
});
|
|
202
|
+
await delay(300);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
o.next({
|
|
206
|
+
type: "device-signature-requested",
|
|
207
|
+
});
|
|
208
|
+
await delay(2000);
|
|
209
|
+
if (cancelled) return;
|
|
210
|
+
o.next({
|
|
211
|
+
type: "device-signature-granted",
|
|
212
|
+
});
|
|
213
|
+
const rng = new Prando("");
|
|
214
|
+
const op = genOperation(account, account, account.operations, rng);
|
|
215
|
+
op.type = "OUT";
|
|
216
|
+
op.value = new BigNumber(0);
|
|
217
|
+
op.blockHash = null;
|
|
218
|
+
op.blockHeight = null;
|
|
219
|
+
op.senders = [account.freshAddress];
|
|
220
|
+
op.recipients = [];
|
|
221
|
+
op.blockHeight = account.blockHeight;
|
|
222
|
+
op.date = new Date();
|
|
223
|
+
await delay(1000);
|
|
224
|
+
if (cancelled) return;
|
|
225
|
+
broadcasted[account.id] = (broadcasted[account.id] || []).concat(op);
|
|
226
|
+
o.next({
|
|
227
|
+
type: "signed",
|
|
228
|
+
signedOperation: {
|
|
229
|
+
operation: { ...op },
|
|
230
|
+
signature: "",
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
main().then(
|
|
236
|
+
() => o.complete(),
|
|
237
|
+
e => o.error(e),
|
|
238
|
+
);
|
|
239
|
+
return () => {
|
|
240
|
+
cancelled = true;
|
|
241
|
+
};
|
|
242
|
+
});
|