@ledgerhq/live-common 34.45.0 → 34.45.1-nightly.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/test-helpers/bridge.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/bridge.js +3 -1
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.js +4 -2
- package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +4 -4
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +10 -10
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib/bridge/generic-alpaca/broadcast.d.ts +1 -1
- package/lib/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts +17 -0
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/buildSubAccounts.js +75 -0
- package/lib/bridge/generic-alpaca/buildSubAccounts.js.map +1 -0
- package/lib/bridge/generic-alpaca/createTransaction.d.ts +17 -9
- package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.js +36 -10
- package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +9 -0
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +66 -37
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +27 -15
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts +5 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +28 -5
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +68 -13
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.d.ts +1 -1
- package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.js +38 -5
- package/lib/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts +2 -0
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.js +8 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/types.d.ts +3 -0
- package/lib/bridge/generic-alpaca/signer/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +70 -46
- package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/signOperation.test.js +25 -22
- package/lib/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/utils.test.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/{utils.test.js → tests/utils.test.js} +1 -1
- package/lib/bridge/generic-alpaca/tests/utils.test.js.map +1 -0
- package/lib/bridge/generic-alpaca/utils.d.ts +36 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +130 -14
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +5 -4
- package/lib/bridge/impl.js.map +1 -1
- package/lib/e2e/enum/Account.js +4 -4
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +1 -1
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +1 -1
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +3 -1
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +102 -42
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/DeviceLabels.d.ts +3 -2
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +2 -1
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +34 -0
- package/lib/e2e/enum/Network.d.ts.map +1 -0
- package/lib/e2e/enum/Network.js +38 -0
- package/lib/e2e/enum/Network.js.map +1 -0
- package/lib/e2e/families/solana.d.ts.map +1 -1
- package/lib/e2e/families/solana.js +4 -4
- package/lib/e2e/families/solana.js.map +1 -1
- package/lib/e2e/speculos.js +3 -3
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/index.d.ts.map +1 -1
- package/lib/exchange/index.js +1 -0
- package/lib/exchange/index.js.map +1 -1
- package/lib/families/evm/config.js +1 -1
- package/lib/families/evm/config.js.map +1 -1
- package/lib/families/stellar/bridge/logic.d.ts +1 -1
- package/lib/families/stellar/bridge/logic.d.ts.map +1 -1
- package/lib/families/stellar/bridge/logic.js +1 -1
- package/lib/families/stellar/bridge/logic.js.map +1 -1
- package/lib/families/stellar/bridge/mock.js +2 -2
- package/lib/families/stellar/bridge/mock.js.map +1 -1
- package/lib/families/stellar/setup.d.ts +3 -6
- package/lib/families/stellar/setup.d.ts.map +1 -1
- package/lib/families/stellar/setup.js +3 -12
- package/lib/families/stellar/setup.js.map +1 -1
- package/lib/families/xrp/bridge/mock.js +2 -2
- package/lib/families/xrp/bridge/mock.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +4 -2
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/generated/bridge/js.d.ts +0 -1
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +12 -14
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/transaction.d.ts +1 -1
- package/lib/modularDrawer/__test__/useModularDrawerVisibility.test.js +229 -14
- package/lib/modularDrawer/__test__/useModularDrawerVisibility.test.js.map +1 -1
- package/lib/modularDrawer/enums.d.ts +0 -1
- package/lib/modularDrawer/enums.d.ts.map +1 -1
- package/lib/modularDrawer/enums.js +0 -1
- package/lib/modularDrawer/enums.js.map +1 -1
- package/lib/modularDrawer/useModularDrawerVisibility.d.ts +7 -1
- package/lib/modularDrawer/useModularDrawerVisibility.d.ts.map +1 -1
- package/lib/modularDrawer/useModularDrawerVisibility.js +18 -2
- package/lib/modularDrawer/useModularDrawerVisibility.js.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.d.ts.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.js +3 -1
- package/lib-es/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.js +4 -2
- package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +4 -4
- 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 +10 -10
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts +17 -0
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +65 -0
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js.map +1 -0
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts +17 -9
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.js +35 -9
- package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +9 -0
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +66 -37
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +27 -15
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts +5 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +26 -4
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +65 -13
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.js +39 -6
- package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts +2 -0
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js +6 -0
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/types.d.ts +3 -0
- package/lib-es/bridge/generic-alpaca/signer/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +70 -46
- package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js +25 -22
- package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/utils.test.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/{utils.test.js → tests/utils.test.js} +1 -1
- package/lib-es/bridge/generic-alpaca/tests/utils.test.js.map +1 -0
- package/lib-es/bridge/generic-alpaca/utils.d.ts +36 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +130 -14
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/impl.d.ts.map +1 -1
- package/lib-es/bridge/impl.js +5 -4
- package/lib-es/bridge/impl.js.map +1 -1
- package/lib-es/e2e/enum/Account.js +4 -4
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +1 -1
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +3 -1
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +102 -42
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts +3 -2
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +2 -1
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +34 -0
- package/lib-es/e2e/enum/Network.d.ts.map +1 -0
- package/lib-es/e2e/enum/Network.js +35 -0
- package/lib-es/e2e/enum/Network.js.map +1 -0
- package/lib-es/e2e/families/solana.d.ts.map +1 -1
- package/lib-es/e2e/families/solana.js +4 -4
- package/lib-es/e2e/families/solana.js.map +1 -1
- package/lib-es/e2e/speculos.js +3 -3
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/index.d.ts.map +1 -1
- package/lib-es/exchange/index.js +1 -0
- package/lib-es/exchange/index.js.map +1 -1
- package/lib-es/families/evm/config.js +1 -1
- package/lib-es/families/evm/config.js.map +1 -1
- package/lib-es/families/stellar/bridge/logic.d.ts +1 -1
- package/lib-es/families/stellar/bridge/logic.d.ts.map +1 -1
- package/lib-es/families/stellar/bridge/logic.js +1 -1
- package/lib-es/families/stellar/bridge/logic.js.map +1 -1
- package/lib-es/families/stellar/bridge/mock.js +2 -2
- package/lib-es/families/stellar/bridge/mock.js.map +1 -1
- package/lib-es/families/stellar/setup.d.ts +3 -6
- package/lib-es/families/stellar/setup.d.ts.map +1 -1
- package/lib-es/families/stellar/setup.js +2 -10
- package/lib-es/families/stellar/setup.js.map +1 -1
- package/lib-es/families/xrp/bridge/mock.js +2 -2
- package/lib-es/families/xrp/bridge/mock.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +4 -2
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/generated/bridge/js.d.ts +0 -1
- package/lib-es/generated/bridge/js.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.js +0 -2
- package/lib-es/generated/bridge/js.js.map +1 -1
- package/lib-es/generated/transaction.d.ts +1 -1
- package/lib-es/modularDrawer/__test__/useModularDrawerVisibility.test.js +229 -14
- package/lib-es/modularDrawer/__test__/useModularDrawerVisibility.test.js.map +1 -1
- package/lib-es/modularDrawer/enums.d.ts +0 -1
- package/lib-es/modularDrawer/enums.d.ts.map +1 -1
- package/lib-es/modularDrawer/enums.js +0 -1
- package/lib-es/modularDrawer/enums.js.map +1 -1
- package/lib-es/modularDrawer/useModularDrawerVisibility.d.ts +7 -1
- package/lib-es/modularDrawer/useModularDrawerVisibility.d.ts.map +1 -1
- package/lib-es/modularDrawer/useModularDrawerVisibility.js +18 -2
- package/lib-es/modularDrawer/useModularDrawerVisibility.js.map +1 -1
- package/package.json +7 -5
- package/src/__tests__/test-helpers/bridge.ts +3 -1
- package/src/bridge/generic-alpaca/accountBridge.ts +1 -4
- package/src/bridge/generic-alpaca/alpaca/index.ts +7 -2
- package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +17 -22
- package/src/bridge/generic-alpaca/broadcast.ts +1 -4
- package/src/bridge/generic-alpaca/buildSubAccounts.ts +110 -0
- package/src/bridge/generic-alpaca/createTransaction.ts +48 -18
- package/src/bridge/generic-alpaca/currencyBridge.ts +1 -1
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +13 -4
- package/src/bridge/generic-alpaca/getAccountShape.ts +84 -46
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +46 -22
- package/src/bridge/generic-alpaca/prepareTransaction.ts +41 -7
- package/src/bridge/generic-alpaca/signOperation.ts +88 -18
- package/src/bridge/generic-alpaca/signer/index.ts +43 -7
- package/src/bridge/generic-alpaca/signer/signTransaction.ts +11 -0
- package/src/bridge/generic-alpaca/signer/types.ts +1 -0
- package/src/bridge/generic-alpaca/tests/estimateMaxSpendable.test.ts +72 -47
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +1 -1
- package/src/bridge/generic-alpaca/tests/signOperation.test.ts +28 -26
- package/src/bridge/generic-alpaca/{utils.test.ts → tests/utils.test.ts} +1 -1
- package/src/bridge/generic-alpaca/utils.ts +158 -18
- package/src/bridge/impl.ts +5 -4
- package/src/e2e/enum/Account.ts +4 -4
- package/src/e2e/enum/AppInfos.ts +1 -1
- package/src/e2e/enum/Currency.ts +102 -40
- package/src/e2e/enum/DeviceLabels.ts +2 -1
- package/src/e2e/enum/Network.ts +33 -0
- package/src/e2e/families/solana.ts +7 -4
- package/src/e2e/speculos.ts +3 -3
- package/src/exchange/index.ts +1 -0
- package/src/families/evm/config.ts +1 -1
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +184 -1887
- package/src/families/stellar/bridge/logic.ts +1 -1
- package/src/families/stellar/bridge/mock.ts +2 -2
- package/src/families/stellar/setup.ts +2 -22
- package/src/families/xrp/bridge/mock.ts +2 -2
- package/src/featureFlags/defaultFeatures.ts +4 -2
- package/src/generated/bridge/js.ts +0 -2
- package/src/modularDrawer/__test__/useModularDrawerVisibility.test.ts +345 -14
- package/src/modularDrawer/enums.ts +0 -1
- package/src/modularDrawer/useModularDrawerVisibility.ts +26 -2
- package/lib/bridge/generic-alpaca/utils.test.d.ts.map +0 -1
- package/lib/bridge/generic-alpaca/utils.test.js.map +0 -1
- package/lib/families/canton/bridge.integration.test.d.ts +0 -2
- package/lib/families/canton/bridge.integration.test.d.ts.map +0 -1
- package/lib/families/canton/bridge.integration.test.js +0 -7
- package/lib/families/canton/bridge.integration.test.js.map +0 -1
- package/lib-es/bridge/generic-alpaca/utils.test.d.ts.map +0 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js.map +0 -1
- package/lib-es/families/canton/bridge.integration.test.d.ts +0 -2
- package/lib-es/families/canton/bridge.integration.test.d.ts.map +0 -1
- package/lib-es/families/canton/bridge.integration.test.js +0 -5
- package/lib-es/families/canton/bridge.integration.test.js.map +0 -1
- package/src/families/canton/bridge.integration.test.ts +0 -6
- /package/lib/bridge/generic-alpaca/{utils.test.d.ts → tests/utils.test.d.ts} +0 -0
- /package/lib-es/bridge/generic-alpaca/{utils.test.d.ts → tests/utils.test.d.ts} +0 -0
@@ -3,59 +3,97 @@ import { GetAccountShape, mergeOps } from "@ledgerhq/coin-framework/bridge/jsHel
|
|
3
3
|
import BigNumber from "bignumber.js";
|
4
4
|
import { getAlpacaApi } from "./alpaca";
|
5
5
|
import { adaptCoreOperationToLiveOperation, extractBalance } from "./utils";
|
6
|
+
import { inferSubOperations } from "@ledgerhq/coin-framework/serialization";
|
7
|
+
import { findToken } from "./buildSubAccounts";
|
8
|
+
import { buildSubAccounts, OperationCommon } from "./buildSubAccounts";
|
6
9
|
|
7
|
-
export function genericGetAccountShape(network: string, kind:
|
8
|
-
return async info => {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
derivationMode,
|
17
|
-
});
|
18
|
-
|
19
|
-
const blockInfo = await getAlpacaApi(network, kind).lastBlock();
|
20
|
-
|
21
|
-
const balances = await getAlpacaApi(network, kind).getBalance(address);
|
22
|
-
const nativeBalance = extractBalance(balances, "native");
|
23
|
-
const balance = BigNumber(nativeBalance.value.toString());
|
24
|
-
|
25
|
-
let spendableBalance: BigNumber;
|
26
|
-
if (nativeBalance.locked) {
|
27
|
-
spendableBalance = BigNumber.max(
|
28
|
-
balance.minus(BigNumber(nativeBalance.locked.toString())),
|
29
|
-
BigNumber(0),
|
30
|
-
);
|
31
|
-
} else {
|
32
|
-
spendableBalance = initialAccount?.spendableBalance || balance;
|
10
|
+
export function genericGetAccountShape(network: string, kind: string): GetAccountShape {
|
11
|
+
return async (info, syncConfig) => {
|
12
|
+
const { address, initialAccount, currency, derivationMode } = info;
|
13
|
+
const alpacaApi = getAlpacaApi(network, kind);
|
14
|
+
|
15
|
+
if (alpacaApi.getChainSpecificRules) {
|
16
|
+
const chainSpecificValidation = alpacaApi.getChainSpecificRules();
|
17
|
+
if (chainSpecificValidation.getAccountShape) {
|
18
|
+
chainSpecificValidation.getAccountShape(address);
|
33
19
|
}
|
34
|
-
|
20
|
+
}
|
21
|
+
|
22
|
+
const accountId = encodeAccountId({
|
23
|
+
type: "js",
|
24
|
+
version: "2",
|
25
|
+
currencyId: currency.id,
|
26
|
+
xpubOrAddress: address,
|
27
|
+
derivationMode,
|
28
|
+
});
|
29
|
+
|
30
|
+
const blockInfo = await alpacaApi.lastBlock();
|
31
|
+
const balanceRes = await alpacaApi.getBalance(address);
|
32
|
+
const nativeAsset = extractBalance(balanceRes, "native");
|
33
|
+
|
34
|
+
const assetsBalance = balanceRes
|
35
|
+
.filter(b => b.asset.type !== "native")
|
36
|
+
.filter(b => findToken(currency, b));
|
37
|
+
|
38
|
+
const nativeBalance = BigInt(nativeAsset?.value ?? "0");
|
39
|
+
|
40
|
+
const spendableBalance = BigInt(nativeBalance - BigInt(nativeAsset?.locked ?? "0"));
|
35
41
|
|
36
|
-
|
42
|
+
const oldOps = (initialAccount?.operations || []) as OperationCommon[];
|
43
|
+
const lastPagingToken = oldOps[0]?.extra?.pagingToken || "";
|
37
44
|
|
38
|
-
|
39
|
-
|
40
|
-
|
45
|
+
const blockHeight = oldOps.length ? (oldOps[0].blockHeight ?? 0) + 1 : 0;
|
46
|
+
const paginationParams: any = { minHeight: blockHeight };
|
47
|
+
if (lastPagingToken) {
|
48
|
+
paginationParams.lastPagingToken = lastPagingToken;
|
49
|
+
}
|
50
|
+
|
51
|
+
const [newCoreOps] = await alpacaApi.listOperations(address, paginationParams);
|
52
|
+
const newOps = newCoreOps.map(op =>
|
53
|
+
adaptCoreOperationToLiveOperation(accountId, op),
|
54
|
+
) as OperationCommon[];
|
55
|
+
const mergedOps = mergeOps(oldOps, newOps) as OperationCommon[];
|
56
|
+
|
57
|
+
const assetOperations: OperationCommon[] = [];
|
58
|
+
mergedOps.forEach(operation => {
|
59
|
+
if (
|
60
|
+
operation?.extra?.assetReference &&
|
61
|
+
operation?.extra?.assetOwner &&
|
62
|
+
!["OPT_IN", "OPT_OUT"].includes(operation.type)
|
63
|
+
) {
|
64
|
+
assetOperations.push(operation);
|
65
|
+
}
|
66
|
+
});
|
41
67
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
68
|
+
const subAccounts =
|
69
|
+
buildSubAccounts({
|
70
|
+
currency,
|
71
|
+
accountId,
|
72
|
+
assetsBalance,
|
73
|
+
syncConfig,
|
74
|
+
operations: assetOperations,
|
75
|
+
}) || [];
|
76
|
+
|
77
|
+
const operationsWithSubs = mergedOps.map(op => {
|
78
|
+
const subOperations = inferSubOperations(op.hash, subAccounts);
|
46
79
|
|
47
80
|
return {
|
48
|
-
|
49
|
-
|
50
|
-
blockHeight: operations.length === 0 ? 0 : blockInfo.height || initialAccount?.blockHeight,
|
51
|
-
balance,
|
52
|
-
spendableBalance,
|
53
|
-
operations,
|
54
|
-
operationsCount: operations.length,
|
81
|
+
...op,
|
82
|
+
subOperations,
|
55
83
|
};
|
56
|
-
}
|
57
|
-
|
58
|
-
|
59
|
-
|
84
|
+
});
|
85
|
+
|
86
|
+
const res = {
|
87
|
+
id: accountId,
|
88
|
+
xpub: address,
|
89
|
+
blockHeight:
|
90
|
+
operationsWithSubs.length === 0 ? 0 : blockInfo.height || initialAccount?.blockHeight,
|
91
|
+
balance: new BigNumber(nativeBalance.toString()),
|
92
|
+
spendableBalance: new BigNumber(spendableBalance.toString()),
|
93
|
+
operations: operationsWithSubs,
|
94
|
+
subAccounts,
|
95
|
+
operationsCount: operationsWithSubs.length,
|
96
|
+
};
|
97
|
+
return res;
|
60
98
|
};
|
61
99
|
}
|
@@ -1,38 +1,62 @@
|
|
1
1
|
import { AccountBridge, TransactionCommon } from "@ledgerhq/types-live";
|
2
|
+
import { AccountAwaitingSendPendingOperations } from "@ledgerhq/errors";
|
2
3
|
import BigNumber from "bignumber.js";
|
3
4
|
import { getAlpacaApi } from "./alpaca";
|
5
|
+
import { transactionToIntent } from "./utils";
|
4
6
|
|
5
7
|
// => alpaca validateIntent
|
6
8
|
export function genericGetTransactionStatus(
|
7
|
-
network
|
8
|
-
kind
|
9
|
+
network,
|
10
|
+
kind,
|
9
11
|
): AccountBridge<any>["getTransactionStatus"] {
|
10
|
-
return async (
|
11
|
-
|
12
|
+
return async (
|
13
|
+
account,
|
14
|
+
transaction: TransactionCommon & {
|
15
|
+
fees: BigNumber | null | undefined;
|
16
|
+
assetReference?: string;
|
17
|
+
assetOwner?: string;
|
18
|
+
mode?: string;
|
19
|
+
subAccountId?: string;
|
20
|
+
memoType?: string;
|
21
|
+
memoValue?: string;
|
22
|
+
},
|
23
|
+
) => {
|
12
24
|
const alpacaApi = getAlpacaApi(network, kind);
|
13
|
-
const
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
)
|
25
|
+
const draftTransaction = {
|
26
|
+
mode: transaction?.mode,
|
27
|
+
recipient: transaction.recipient,
|
28
|
+
amount: transaction.amount ?? new BigNumber(0),
|
29
|
+
fees: transaction.fees ? BigInt(transaction.fees.toString()) : 0n,
|
30
|
+
useAllAmount: !!transaction.useAllAmount,
|
31
|
+
assetReference: transaction.assetReference || "",
|
32
|
+
assetOwner: transaction.assetOwner || "",
|
33
|
+
subAccountId: transaction.subAccountId || "",
|
34
|
+
memoType: transaction.memoType || "",
|
35
|
+
memoValue: transaction.memoValue || "",
|
36
|
+
};
|
37
|
+
|
38
|
+
if (alpacaApi.getChainSpecificRules) {
|
39
|
+
const chainSpecificValidation = alpacaApi.getChainSpecificRules();
|
40
|
+
if (chainSpecificValidation.getTransactionStatus.throwIfPendingOperation) {
|
41
|
+
if (account.pendingOperations.length > 0) {
|
42
|
+
throw new AccountAwaitingSendPendingOperations();
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
27
46
|
|
28
|
-
const estimatedFees
|
47
|
+
const { errors, warnings, estimatedFees, amount, totalSpent } = await alpacaApi.validateIntent(
|
48
|
+
transactionToIntent(account, draftTransaction),
|
49
|
+
);
|
29
50
|
|
30
51
|
return Promise.resolve({
|
31
52
|
errors,
|
32
53
|
warnings,
|
33
|
-
estimatedFees
|
34
|
-
|
35
|
-
|
54
|
+
estimatedFees:
|
55
|
+
!transaction.fees || transaction.fees.isZero()
|
56
|
+
? new BigNumber(estimatedFees.toString())
|
57
|
+
: transaction.fees,
|
58
|
+
amount: transaction.amount.eq(0) ? new BigNumber(amount.toString()) : transaction.amount,
|
59
|
+
totalSpent: new BigNumber(totalSpent.toString()),
|
36
60
|
});
|
37
61
|
};
|
38
62
|
}
|
@@ -2,6 +2,7 @@ import { Account, AccountBridge, TransactionCommon } from "@ledgerhq/types-live"
|
|
2
2
|
import { getAlpacaApi } from "./alpaca";
|
3
3
|
import { transactionToIntent } from "./utils";
|
4
4
|
import BigNumber from "bignumber.js";
|
5
|
+
import { NetworkInfo } from "./createTransaction";
|
5
6
|
|
6
7
|
function bnEq(a: BigNumber | null | undefined, b: BigNumber | null | undefined): boolean {
|
7
8
|
return !a && !b ? true : !a || !b ? false : a.eq(b);
|
@@ -9,18 +10,51 @@ function bnEq(a: BigNumber | null | undefined, b: BigNumber | null | undefined):
|
|
9
10
|
|
10
11
|
export function genericPrepareTransaction(
|
11
12
|
network: string,
|
12
|
-
kind
|
13
|
+
kind,
|
13
14
|
): AccountBridge<TransactionCommon, Account, any, any>["prepareTransaction"] {
|
14
|
-
return async (
|
15
|
+
return async (
|
16
|
+
account,
|
17
|
+
transaction: TransactionCommon & {
|
18
|
+
fees: BigNumber | null | undefined;
|
19
|
+
assetReference?: string;
|
20
|
+
assetOwner?: string;
|
21
|
+
subAccountId?: string;
|
22
|
+
networkInfo?: NetworkInfo | null;
|
23
|
+
},
|
24
|
+
) => {
|
25
|
+
const [assetReference, assetOwner] = getAssetInfos(transaction);
|
15
26
|
const fees = await getAlpacaApi(network, kind).estimateFees(
|
16
|
-
transactionToIntent(account,
|
27
|
+
transactionToIntent(account, {
|
28
|
+
...transaction,
|
29
|
+
fees: transaction.fees ? BigInt(transaction.fees.toString()) : 0n,
|
30
|
+
}),
|
17
31
|
);
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
32
|
+
// NOTE: this is problematic, we should maybe have a method / object that lists what field warrant an update per chain
|
33
|
+
// for reference, stellar checked this:
|
34
|
+
// transaction.networkInfo !== networkInfo ||
|
35
|
+
// transaction.baseReserve !== baseReserve
|
36
|
+
if (!bnEq(transaction.fees, new BigNumber(fees.value.toString()))) {
|
37
|
+
return {
|
38
|
+
...transaction,
|
39
|
+
fees: new BigNumber(fees.value.toString()),
|
40
|
+
assetReference,
|
41
|
+
assetOwner,
|
42
|
+
networkInfo: {
|
43
|
+
fees: new BigNumber(fees.value.toString()),
|
44
|
+
},
|
45
|
+
};
|
22
46
|
}
|
23
47
|
|
24
48
|
return transaction;
|
25
49
|
};
|
26
50
|
}
|
51
|
+
|
52
|
+
export function getAssetInfos(
|
53
|
+
tr: TransactionCommon & { assetReference?: string; assetOwner?: string },
|
54
|
+
): string[] {
|
55
|
+
if (tr.subAccountId) {
|
56
|
+
const assetString = tr.subAccountId.split("+")[1];
|
57
|
+
return assetString.split(":");
|
58
|
+
}
|
59
|
+
return [tr.assetReference || "", tr.assetOwner || ""];
|
60
|
+
}
|
@@ -12,12 +12,70 @@ import { buildOptimisticOperation, transactionToIntent } from "./utils";
|
|
12
12
|
import { FeeNotLoaded } from "@ledgerhq/errors";
|
13
13
|
import { Result } from "@ledgerhq/coin-framework/derivation";
|
14
14
|
import { MapMemo, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
|
15
|
+
import { StellarMemo } from "@ledgerhq/coin-stellar/types/bridge";
|
16
|
+
import { log } from "@ledgerhq/logs";
|
17
|
+
import BigNumber from "bignumber.js";
|
15
18
|
|
19
|
+
/**
|
20
|
+
* Applies memo information to transaction intent
|
21
|
+
* Handles both destination tags (XRP-like) and Stellar-style memos
|
22
|
+
*/
|
23
|
+
function applyMemoToIntent(
|
24
|
+
transactionIntent: TransactionIntent<any>,
|
25
|
+
transaction: TransactionCommon,
|
26
|
+
): TransactionIntent<any> {
|
27
|
+
// Handle destination tag memo (for XRP-like chains)
|
28
|
+
if (transaction["tag"]) {
|
29
|
+
const txWithMemoTag = transactionIntent as TransactionIntent<MapMemo<string, string>>;
|
30
|
+
const txMemo = String(transaction["tag"]);
|
31
|
+
|
32
|
+
txWithMemoTag.memo = {
|
33
|
+
type: "map",
|
34
|
+
memos: new Map(),
|
35
|
+
};
|
36
|
+
txWithMemoTag.memo.memos.set("destinationTag", txMemo);
|
37
|
+
|
38
|
+
return txWithMemoTag;
|
39
|
+
}
|
40
|
+
|
41
|
+
// Handle Stellar-style memo
|
42
|
+
if (transaction["memoType"] && transaction["memoValue"]) {
|
43
|
+
const txWithMemo = transactionIntent as TransactionIntent<StellarMemo>;
|
44
|
+
const txMemoType = String(transaction["memoType"]);
|
45
|
+
const txMemoValue = String(transaction["memoValue"]);
|
46
|
+
|
47
|
+
txWithMemo.memo = {
|
48
|
+
type: txMemoType as "NO_MEMO" | "MEMO_TEXT" | "MEMO_ID" | "MEMO_HASH" | "MEMO_RETURN",
|
49
|
+
value: txMemoValue,
|
50
|
+
};
|
51
|
+
|
52
|
+
return txWithMemo;
|
53
|
+
}
|
54
|
+
|
55
|
+
return transactionIntent;
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Enriches transaction intent with memo and asset information
|
60
|
+
*/
|
61
|
+
function enrichTransactionIntent(
|
62
|
+
transactionIntent: TransactionIntent<any>,
|
63
|
+
transaction: TransactionCommon,
|
64
|
+
publicKey: string,
|
65
|
+
): TransactionIntent<any> {
|
66
|
+
// Set sender public key
|
67
|
+
transactionIntent.senderPublicKey = publicKey;
|
68
|
+
|
69
|
+
// Apply memo information
|
70
|
+
transactionIntent = applyMemoToIntent(transactionIntent, transaction);
|
71
|
+
|
72
|
+
return transactionIntent;
|
73
|
+
}
|
16
74
|
/**
|
17
75
|
* Sign Transaction with Ledger hardware
|
18
76
|
*/
|
19
77
|
export const genericSignOperation =
|
20
|
-
(network
|
78
|
+
(network, kind) =>
|
21
79
|
(signerContext: SignerContext<any>): AccountBridge<TransactionCommon>["signOperation"] =>
|
22
80
|
({
|
23
81
|
account,
|
@@ -30,30 +88,40 @@ export const genericSignOperation =
|
|
30
88
|
}): Observable<SignOperationEvent> =>
|
31
89
|
new Observable(o => {
|
32
90
|
async function main() {
|
91
|
+
// NOTE: checking field that's not inside TransactionCommon, improve
|
33
92
|
if (!transaction["fees"]) throw new FeeNotLoaded();
|
34
|
-
|
93
|
+
const fees = BigInt(transaction["fees"]?.toString() || "0");
|
94
|
+
if (transaction["useAllAmount"]) {
|
95
|
+
const draftTransaction = {
|
96
|
+
recipient: transaction.recipient,
|
97
|
+
amount: transaction.amount ?? 0,
|
98
|
+
fees: fees,
|
99
|
+
useAllAmount: !!transaction.useAllAmount,
|
100
|
+
assetReference: transaction?.["assetReference"] || "",
|
101
|
+
assetOwner: transaction?.["assetOwner"] || "",
|
102
|
+
subAccountId: transaction.subAccountId || "",
|
103
|
+
};
|
104
|
+
const { amount } = await getAlpacaApi(network, kind).validateIntent(
|
105
|
+
transactionToIntent(account, draftTransaction),
|
106
|
+
);
|
107
|
+
transaction.amount = new BigNumber(amount.toString());
|
108
|
+
}
|
35
109
|
const signedInfo = await signerContext(deviceId, async signer => {
|
36
110
|
const derivationPath = account.freshAddressPath;
|
37
|
-
|
38
111
|
const { publicKey } = (await signer.getAddress(derivationPath)) as Result;
|
39
112
|
|
40
|
-
|
113
|
+
let transactionIntent = transactionToIntent(account, { ...transaction, fees });
|
41
114
|
transactionIntent.senderPublicKey = publicKey;
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
memos: new Map(),
|
49
|
-
};
|
50
|
-
txWithMemo.memo.memos.set("destinationTag", txMemo);
|
51
|
-
}
|
52
|
-
|
53
|
-
const accountInfo = await getAlpacaApi(network, kind).getAccountInfo(
|
115
|
+
|
116
|
+
// Enrich with memo and asset information
|
117
|
+
transactionIntent = enrichTransactionIntent(transactionIntent, transaction, publicKey);
|
118
|
+
|
119
|
+
// TODO: should compute it and pass it down to craftTransaction (duplicate call right now)
|
120
|
+
const sequenceNumber = await getAlpacaApi(network, kind).getSequence(
|
54
121
|
transactionIntent.sender,
|
55
122
|
);
|
56
|
-
transactionIntent.sequence =
|
123
|
+
transactionIntent.sequence = sequenceNumber;
|
124
|
+
|
57
125
|
/* Craft unsigned blob via Alpaca */
|
58
126
|
const unsigned: string = await getAlpacaApi(network, kind).craftTransaction(
|
59
127
|
transactionIntent,
|
@@ -76,8 +144,10 @@ export const genericSignOperation =
|
|
76
144
|
signedInfo.txnSig,
|
77
145
|
signedInfo.publicKey,
|
78
146
|
);
|
79
|
-
|
80
147
|
const operation = buildOptimisticOperation(account, transaction, signedInfo.sequence);
|
148
|
+
if (!operation.id) {
|
149
|
+
log("Generic alpaca", "buildOptimisticOperation", operation);
|
150
|
+
}
|
81
151
|
// NOTE: we set the transactionSequenceNumber before on the operation
|
82
152
|
// now that we create it in craftTransaction, we might need to return it back from craftTransaction also
|
83
153
|
o.next({
|
@@ -1,12 +1,15 @@
|
|
1
1
|
import { GetAddressFn } from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
|
2
2
|
import xrpGetAddress from "@ledgerhq/coin-xrp/signer/getAddress";
|
3
|
+
import stellarGetAddress from "@ledgerhq/coin-stellar/signer/getAddress";
|
3
4
|
import { CreateSigner, executeWithSigner } from "../../setup";
|
4
5
|
import Xrp from "@ledgerhq/hw-app-xrp";
|
6
|
+
import Stellar from "@ledgerhq/hw-app-str";
|
5
7
|
|
6
8
|
import Transport from "@ledgerhq/hw-transport";
|
7
|
-
import { signTransaction } from "./signTransaction";
|
9
|
+
import { signTransaction, stellarSignTransaction } from "./signTransaction";
|
8
10
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
9
11
|
import { SignTransactionOptions } from "./types";
|
12
|
+
import { StrKey } from "@stellar/stellar-sdk";
|
10
13
|
|
11
14
|
export type AlpacaSigner = {
|
12
15
|
getAddress: GetAddressFn;
|
@@ -15,17 +18,50 @@ export type AlpacaSigner = {
|
|
15
18
|
context: SignerContext<any>;
|
16
19
|
};
|
17
20
|
|
18
|
-
|
21
|
+
const createSignerXrp: CreateSigner<Xrp> = (transport: Transport) => {
|
22
|
+
return new Xrp(transport);
|
23
|
+
};
|
24
|
+
const signerContextXrp = executeWithSigner(createSignerXrp);
|
25
|
+
|
26
|
+
const createSignerStellar: CreateSigner<Stellar> = (transport: Transport) => {
|
27
|
+
const stellar = new Stellar(transport);
|
28
|
+
const originalSignTransaction = stellar.signTransaction;
|
29
|
+
// Return the original Stellar instance with overridden methods
|
30
|
+
return Object.assign(stellar, {
|
31
|
+
signTransaction: async (path: string, transaction: string) => {
|
32
|
+
const unsignedPayload: Buffer = Buffer.from(transaction, "base64");
|
33
|
+
const { signature } = await originalSignTransaction(path, unsignedPayload);
|
34
|
+
return signature.toString("base64");
|
35
|
+
},
|
36
|
+
getAddress: async (path: string, verify?: boolean) => {
|
37
|
+
const { rawPublicKey } = await stellar.getPublicKey(path, verify);
|
38
|
+
const publicKey = StrKey.encodeEd25519PublicKey(rawPublicKey);
|
39
|
+
return {
|
40
|
+
path,
|
41
|
+
address: publicKey,
|
42
|
+
publicKey: publicKey,
|
43
|
+
};
|
44
|
+
},
|
45
|
+
});
|
46
|
+
};
|
47
|
+
|
48
|
+
const signerContextStellar = executeWithSigner(createSignerStellar);
|
49
|
+
|
50
|
+
export function getSigner(network): AlpacaSigner {
|
19
51
|
switch (network) {
|
20
52
|
case "ripple":
|
21
53
|
case "xrp": {
|
22
|
-
|
23
|
-
|
54
|
+
return {
|
55
|
+
getAddress: xrpGetAddress(signerContextXrp),
|
56
|
+
signTransaction: signTransaction(signerContextXrp),
|
57
|
+
context: signerContextXrp,
|
24
58
|
};
|
59
|
+
}
|
60
|
+
case "stellar": {
|
25
61
|
return {
|
26
|
-
getAddress:
|
27
|
-
signTransaction:
|
28
|
-
context:
|
62
|
+
getAddress: stellarGetAddress(signerContextStellar),
|
63
|
+
signTransaction: stellarSignTransaction(signerContextStellar),
|
64
|
+
context: signerContextStellar,
|
29
65
|
};
|
30
66
|
}
|
31
67
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
2
2
|
import { XrpSigner } from "@ledgerhq/coin-xrp/index";
|
3
3
|
import { SignTransactionOptions } from "./types";
|
4
|
+
import { StellarSigner } from "@ledgerhq/coin-stellar/types/signer";
|
4
5
|
|
5
6
|
export const signTransaction = (signerContext: SignerContext<XrpSigner>) => {
|
6
7
|
return async (deviceId: string, { path, rawTxHex }: SignTransactionOptions) => {
|
@@ -11,3 +12,13 @@ export const signTransaction = (signerContext: SignerContext<XrpSigner>) => {
|
|
11
12
|
return signedTx;
|
12
13
|
};
|
13
14
|
};
|
15
|
+
|
16
|
+
export const stellarSignTransaction = (signerContext: SignerContext<StellarSigner>) => {
|
17
|
+
return async (deviceId: string, { path, transaction }: SignTransactionOptions) => {
|
18
|
+
const signedTx = await signerContext(deviceId, signer =>
|
19
|
+
signer.signTransaction(path, transaction),
|
20
|
+
);
|
21
|
+
|
22
|
+
return signedTx.signature.toString("base64"); // It should return a Buffer
|
23
|
+
};
|
24
|
+
};
|