@ledgerhq/live-common 34.49.0-nightly.6 → 34.50.0-nightly.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/test-helpers/bridge.js +1 -1
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/__tests__/test-helpers/environment.js +2 -0
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.js +3 -0
- package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.js +11 -0
- package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +2 -3
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +11 -3
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +6 -4
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +32 -4
- 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 +4 -2
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.js +37 -0
- 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/tests/estimateMaxSpendable.test.js +15 -1
- 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 +2 -2
- package/lib/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/types.d.ts +7 -1
- package/lib/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts +7 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +31 -29
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.test.js +32 -0
- package/lib/bridge/generic-alpaca/utils.test.js.map +1 -1
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +1 -0
- package/lib/bridge/impl.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +1 -0
- 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/index.d.ts +4 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock.js +1 -0
- package/lib/families/canton/bridge/mock.js.map +1 -1
- package/lib/families/canton/config.d.ts.map +1 -1
- package/lib/families/canton/config.js +2 -0
- package/lib/families/canton/config.js.map +1 -1
- package/lib/families/evm/config.d.ts.map +1 -1
- package/lib/families/evm/config.js +26 -0
- package/lib/families/evm/config.js.map +1 -1
- package/lib/families/kaspa/bridge.integration.test.js +1 -4
- package/lib/families/kaspa/bridge.integration.test.js.map +1 -1
- package/lib/families/tezos/react.d.ts +2 -1
- package/lib/families/tezos/react.d.ts.map +1 -1
- package/lib/families/tezos/react.js +19 -1
- package/lib/families/tezos/react.js.map +1 -1
- package/lib/families/tezos/setup.d.ts +1 -4
- package/lib/families/tezos/setup.d.ts.map +1 -1
- package/lib/families/tezos/setup.js +3 -11
- package/lib/families/tezos/setup.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts +2 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +2 -0
- 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 +10 -12
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +5 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js +11 -14
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +2 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +3 -3
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
- package/lib/modularDrawer/modules/createAssetConfiguration.js +1 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.d.ts +7 -0
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.d.ts.map +1 -0
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.js +21 -0
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.js.map +1 -0
- package/lib/modularDrawer/utils/index.d.ts +2 -1
- 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/type.d.ts +18 -0
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.js +1 -1
- package/lib-es/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib-es/__tests__/test-helpers/environment.js +2 -0
- package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.js +3 -0
- package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.js +11 -0
- package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +2 -3
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +11 -3
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +6 -4
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +32 -4
- 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 +4 -2
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.js +38 -1
- 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/tests/estimateMaxSpendable.test.js +15 -1
- 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 +2 -2
- package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts +7 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts +7 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +31 -29
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js +33 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -1
- package/lib-es/bridge/impl.d.ts.map +1 -1
- package/lib-es/bridge/impl.js +1 -0
- package/lib-es/bridge/impl.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +1 -0
- 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/index.d.ts +4 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock.js +1 -0
- package/lib-es/families/canton/bridge/mock.js.map +1 -1
- package/lib-es/families/canton/config.d.ts.map +1 -1
- package/lib-es/families/canton/config.js +2 -0
- package/lib-es/families/canton/config.js.map +1 -1
- package/lib-es/families/evm/config.d.ts.map +1 -1
- package/lib-es/families/evm/config.js +26 -0
- package/lib-es/families/evm/config.js.map +1 -1
- package/lib-es/families/kaspa/bridge.integration.test.js +1 -4
- package/lib-es/families/kaspa/bridge.integration.test.js.map +1 -1
- package/lib-es/families/tezos/react.d.ts +2 -1
- package/lib-es/families/tezos/react.d.ts.map +1 -1
- package/lib-es/families/tezos/react.js +17 -0
- package/lib-es/families/tezos/react.js.map +1 -1
- package/lib-es/families/tezos/setup.d.ts +1 -4
- package/lib-es/families/tezos/setup.d.ts.map +1 -1
- package/lib-es/families/tezos/setup.js +2 -9
- package/lib-es/families/tezos/setup.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts +2 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +2 -0
- 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/modularDrawer/hooks/useRightBalanceAsset.d.ts +5 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +11 -14
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +2 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +3 -3
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js +1 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
- package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.d.ts +7 -0
- package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.js +17 -0
- package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.js.map +1 -0
- package/lib-es/modularDrawer/utils/index.d.ts +2 -1
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +2 -1
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/utils/type.d.ts +18 -0
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/package.json +68 -68
- package/src/__tests__/test-helpers/bridge.ts +1 -1
- package/src/__tests__/test-helpers/environment.ts +2 -0
- package/src/bridge/generic-alpaca/alpaca/index.ts +4 -0
- package/src/bridge/generic-alpaca/createTransaction.ts +11 -0
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +6 -3
- package/src/bridge/generic-alpaca/getAccountShape.ts +13 -3
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +6 -4
- package/src/bridge/generic-alpaca/prepareTransaction.ts +59 -6
- package/src/bridge/generic-alpaca/signOperation.ts +8 -2
- package/src/bridge/generic-alpaca/signer/index.ts +44 -1
- package/src/bridge/generic-alpaca/signer/signTransaction.ts +10 -0
- package/src/bridge/generic-alpaca/tests/estimateMaxSpendable.test.ts +15 -1
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +1 -0
- package/src/bridge/generic-alpaca/tests/signOperation.test.ts +2 -2
- package/src/bridge/generic-alpaca/types.ts +13 -2
- package/src/bridge/generic-alpaca/utils.test.ts +65 -0
- package/src/bridge/generic-alpaca/utils.ts +42 -30
- package/src/bridge/impl.ts +1 -0
- package/src/e2e/enum/Network.ts +1 -0
- package/src/families/canton/bridge/mock.ts +1 -0
- package/src/families/canton/config.ts +2 -0
- package/src/families/evm/config.ts +26 -0
- package/src/families/kaspa/__snapshots__/bridge.integration.test.ts.snap +66 -0
- package/src/families/kaspa/bridge.integration.test.ts +1 -4
- package/src/families/tezos/react.ts +20 -1
- package/src/families/tezos/setup.ts +3 -22
- package/src/featureFlags/defaultFeatures.ts +2 -0
- package/src/generated/bridge/js.ts +0 -2
- package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +26 -21
- package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +4 -2
- package/src/modularDrawer/modules/createAssetConfiguration.ts +1 -0
- package/src/modularDrawer/utils/groupCurrenciesByProvider.ts +27 -0
- package/src/modularDrawer/utils/index.ts +2 -0
- package/src/modularDrawer/utils/type.ts +19 -0
@@ -96,9 +96,11 @@ export const genericSignOperation =
|
|
96
96
|
assetOwner: transaction?.assetOwner || "",
|
97
97
|
subAccountId: transaction.subAccountId || "",
|
98
98
|
family: transaction.family,
|
99
|
+
feesStrategy: transaction.feesStrategy,
|
100
|
+
data: transaction.data,
|
99
101
|
};
|
100
102
|
const { amount } = await alpacaApi.validateIntent(
|
101
|
-
transactionToIntent(account, draftTransaction),
|
103
|
+
transactionToIntent(account, draftTransaction, alpacaApi.computeIntentType),
|
102
104
|
{ value: fees },
|
103
105
|
);
|
104
106
|
transaction.amount = new BigNumber(amount.toString());
|
@@ -107,7 +109,11 @@ export const genericSignOperation =
|
|
107
109
|
const derivationPath = account.freshAddressPath;
|
108
110
|
const { publicKey } = (await signer.getAddress(derivationPath)) as Result;
|
109
111
|
|
110
|
-
let transactionIntent = transactionToIntent(
|
112
|
+
let transactionIntent = transactionToIntent(
|
113
|
+
account,
|
114
|
+
{ ...transaction },
|
115
|
+
alpacaApi.computeIntentType,
|
116
|
+
);
|
111
117
|
transactionIntent.senderPublicKey = publicKey;
|
112
118
|
|
113
119
|
// Enrich with memo and asset information
|
@@ -1,12 +1,15 @@
|
|
1
1
|
import xrpGetAddress from "@ledgerhq/coin-xrp/signer/getAddress";
|
2
2
|
import stellarGetAddress from "@ledgerhq/coin-stellar/signer/getAddress";
|
3
3
|
import Stellar from "@ledgerhq/hw-app-str";
|
4
|
-
import { signTransaction, stellarSignTransaction } from "./signTransaction";
|
4
|
+
import { signTransaction, stellarSignTransaction, tezosSignTransaction } from "./signTransaction";
|
5
5
|
import { StrKey } from "@stellar/stellar-sdk";
|
6
6
|
import { CreateSigner, executeWithSigner } from "../../setup";
|
7
7
|
import Xrp from "@ledgerhq/hw-app-xrp";
|
8
8
|
import Transport from "@ledgerhq/hw-transport";
|
9
9
|
import { AlpacaSigner } from "./types";
|
10
|
+
import { DerivationType, LedgerSigner as TaquitoLedgerSigner } from "@taquito/ledger-signer";
|
11
|
+
import tezosGetAddress from "@ledgerhq/coin-tezos/signer/getAddress";
|
12
|
+
import Tezos from "@ledgerhq/hw-app-tezos";
|
10
13
|
|
11
14
|
const createSignerXrp: CreateSigner<Xrp> = (transport: Transport) => {
|
12
15
|
return new Xrp(transport);
|
@@ -37,6 +40,39 @@ const createSignerStellar: CreateSigner<Stellar> = (transport: Transport) => {
|
|
37
40
|
|
38
41
|
const signerContextStellar = executeWithSigner(createSignerStellar);
|
39
42
|
|
43
|
+
const createSignerTezos: CreateSigner<
|
44
|
+
Tezos & { createLedgerSigner: (path: string, prompt: boolean, derivationType: number) => any }
|
45
|
+
> = (transport: Transport) => {
|
46
|
+
const tezos = new Tezos(transport);
|
47
|
+
// align with genericSignOperation that calls signer.signTransaction
|
48
|
+
return Object.assign(tezos, {
|
49
|
+
async signTransaction(path: string, rawTxHex: string) {
|
50
|
+
const { signature } = await tezos.signOperation(path, rawTxHex, {});
|
51
|
+
return signature;
|
52
|
+
},
|
53
|
+
async getAddress(path: string, { verify }: { verify?: boolean } = {}) {
|
54
|
+
// Use Taquito LedgerSigner to retrieve base58 public key and matching pkh (like oldbridge)
|
55
|
+
const ledgerSigner = new TaquitoLedgerSigner(
|
56
|
+
transport,
|
57
|
+
path,
|
58
|
+
!!verify,
|
59
|
+
DerivationType.ED25519,
|
60
|
+
);
|
61
|
+
const address = await ledgerSigner.publicKeyHash();
|
62
|
+
const publicKey = await ledgerSigner.publicKey();
|
63
|
+
return { path, address, publicKey };
|
64
|
+
},
|
65
|
+
createLedgerSigner(path: string, prompt: boolean, derivationType: number) {
|
66
|
+
// Map 0 -> ED25519, 1 -> SECP256K1, 2 -> P256 by convention
|
67
|
+
let dt: DerivationType = DerivationType.ED25519;
|
68
|
+
if (derivationType === 1) dt = DerivationType.SECP256K1;
|
69
|
+
else if (derivationType === 2) dt = DerivationType.P256;
|
70
|
+
return new TaquitoLedgerSigner(transport, path, prompt, dt);
|
71
|
+
},
|
72
|
+
});
|
73
|
+
};
|
74
|
+
const signerContextTezos = executeWithSigner(createSignerTezos);
|
75
|
+
|
40
76
|
export function getSigner(network: string): AlpacaSigner {
|
41
77
|
switch (network) {
|
42
78
|
case "ripple":
|
@@ -54,6 +90,13 @@ export function getSigner(network: string): AlpacaSigner {
|
|
54
90
|
context: signerContextStellar,
|
55
91
|
};
|
56
92
|
}
|
93
|
+
case "tezos": {
|
94
|
+
return {
|
95
|
+
getAddress: tezosGetAddress(signerContextTezos),
|
96
|
+
signTransaction: tezosSignTransaction(executeWithSigner(createSignerTezos)),
|
97
|
+
context: signerContextTezos,
|
98
|
+
};
|
99
|
+
}
|
57
100
|
}
|
58
101
|
throw new Error(`signer for ${network} not implemented`);
|
59
102
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
2
2
|
import { StellarSigner } from "@ledgerhq/coin-stellar/types/signer";
|
3
|
+
import { TezosSigner } from "@ledgerhq/coin-tezos/types/signer";
|
3
4
|
import { LegacySigner, SignTransactionOptions } from "./types";
|
4
5
|
|
5
6
|
export const signTransaction = <Signer extends LegacySigner>(
|
@@ -23,3 +24,12 @@ export const stellarSignTransaction = (signerContext: SignerContext<StellarSigne
|
|
23
24
|
return signedTx.signature.toString("base64"); // It should return a Buffer
|
24
25
|
};
|
25
26
|
};
|
27
|
+
|
28
|
+
export const tezosSignTransaction = (signerContext: SignerContext<TezosSigner>) => {
|
29
|
+
return async (deviceId: string, { path, rawTxHex }: SignTransactionOptions) => {
|
30
|
+
const signed = await signerContext(deviceId, signer =>
|
31
|
+
signer.signOperation(path, rawTxHex, {}),
|
32
|
+
);
|
33
|
+
return signed.signature;
|
34
|
+
};
|
35
|
+
};
|
@@ -35,9 +35,23 @@ const dummyAccounts = [
|
|
35
35
|
freshAddress: "s123",
|
36
36
|
pendingOperations: [],
|
37
37
|
},
|
38
|
+
{
|
39
|
+
id: "js:2:tezos:t123",
|
40
|
+
type: "Account",
|
41
|
+
spendableBalance: new BigNumber(50000000),
|
42
|
+
balance: new BigNumber(60000000),
|
43
|
+
currency: {
|
44
|
+
id: "tezos",
|
45
|
+
family: "tezos",
|
46
|
+
name: "Tezos",
|
47
|
+
units: [{ name: "XTZ", magnitude: 6 }],
|
48
|
+
},
|
49
|
+
freshAddress: "t123",
|
50
|
+
pendingOperations: [],
|
51
|
+
},
|
38
52
|
] as unknown as Account[];
|
39
53
|
|
40
|
-
["xrp", "stellar"].forEach((currencyName, idx) => {
|
54
|
+
["xrp", "stellar", "tezos"].forEach((currencyName, idx) => {
|
41
55
|
describe(`genericEstimateMaxSpendable for ${currencyName}`, () => {
|
42
56
|
const dummyAccount = dummyAccounts[idx];
|
43
57
|
|
@@ -14,7 +14,7 @@ jest.mock("../utils", () => ({
|
|
14
14
|
transactionToIntent: jest.fn(),
|
15
15
|
}));
|
16
16
|
describe("genericSignOperation", () => {
|
17
|
-
const networks = ["xrp", "stellar"];
|
17
|
+
const networks = ["xrp", "stellar", "tezos"];
|
18
18
|
const kind = "local";
|
19
19
|
|
20
20
|
const mockSignerContext = jest.fn();
|
@@ -83,7 +83,7 @@ describe("genericSignOperation", () => {
|
|
83
83
|
},
|
84
84
|
});
|
85
85
|
|
86
|
-
expect(transactionToIntent).toHaveBeenCalledWith(account, transaction);
|
86
|
+
expect(transactionToIntent).toHaveBeenCalledWith(account, transaction, undefined);
|
87
87
|
expect(txIntent.memo.memos.get("destinationTag")).toBe("1234");
|
88
88
|
});
|
89
89
|
|
@@ -9,14 +9,25 @@ type NetworkInfo = {
|
|
9
9
|
export type GenericTransaction = TransactionCommon & {
|
10
10
|
family: string;
|
11
11
|
fees?: BigNumber | null;
|
12
|
+
storageLimit?: BigNumber | null;
|
12
13
|
customFees?: {
|
13
|
-
parameters: { fees?: BigNumber | null };
|
14
|
+
parameters: { fees?: BigNumber | null; storageLimit?: BigNumber | null };
|
14
15
|
};
|
15
16
|
tag?: number | null | undefined;
|
16
17
|
feeCustomUnit?: Unit | null | undefined;
|
17
18
|
memoType?: string | null;
|
18
19
|
memoValue?: string | null;
|
19
|
-
|
20
|
+
data?: Buffer;
|
21
|
+
mode?:
|
22
|
+
| "send"
|
23
|
+
| "changeTrust"
|
24
|
+
| "send-legacy"
|
25
|
+
| "send-eip1559"
|
26
|
+
| "delegate"
|
27
|
+
| "stake"
|
28
|
+
| "undelegate"
|
29
|
+
| "unstake";
|
30
|
+
type?: number;
|
20
31
|
assetReference?: string;
|
21
32
|
assetOwner?: string;
|
22
33
|
networkInfo?: NetworkInfo | null;
|
@@ -2,11 +2,76 @@ import {
|
|
2
2
|
adaptCoreOperationToLiveOperation,
|
3
3
|
extractBalance,
|
4
4
|
findCryptoCurrencyByNetwork,
|
5
|
+
transactionToIntent,
|
5
6
|
} from "./utils";
|
6
7
|
import BigNumber from "bignumber.js";
|
7
8
|
import { Operation as CoreOperation } from "@ledgerhq/coin-framework/api/types";
|
9
|
+
import { Account } from "@ledgerhq/types-live";
|
10
|
+
import { GenericTransaction } from "./types";
|
8
11
|
|
9
12
|
describe("Alpaca utils", () => {
|
13
|
+
describe("transactionToIntent", () => {
|
14
|
+
describe("type", () => {
|
15
|
+
it("fallbacks to 'Payment' without a transaction mode", () => {
|
16
|
+
expect(
|
17
|
+
transactionToIntent(
|
18
|
+
{ currency: { name: "ethereum", units: [{}] } } as Account,
|
19
|
+
{ mode: undefined } as GenericTransaction,
|
20
|
+
),
|
21
|
+
).toMatchObject({
|
22
|
+
type: "Payment",
|
23
|
+
});
|
24
|
+
});
|
25
|
+
|
26
|
+
it.each([
|
27
|
+
["changeTrust", "changeTrust"],
|
28
|
+
["send", "send"],
|
29
|
+
["send-legacy", "send-legacy"],
|
30
|
+
["send-eip1559", "send-eip1559"],
|
31
|
+
["stake", "stake"],
|
32
|
+
["unstake", "unstake"],
|
33
|
+
["delegate", "stake"],
|
34
|
+
["undelegate", "unstake"],
|
35
|
+
])(
|
36
|
+
"by default, associates '%s' transaction mode to '%s' intent type",
|
37
|
+
(mode, expectedType) => {
|
38
|
+
expect(
|
39
|
+
transactionToIntent(
|
40
|
+
{ currency: { name: "ethereum", units: [{}] } } as Account,
|
41
|
+
{ mode } as GenericTransaction,
|
42
|
+
),
|
43
|
+
).toMatchObject({
|
44
|
+
type: expectedType,
|
45
|
+
});
|
46
|
+
},
|
47
|
+
);
|
48
|
+
|
49
|
+
it("rejects other modes", () => {
|
50
|
+
expect(() =>
|
51
|
+
transactionToIntent(
|
52
|
+
{ currency: { name: "ethereum", units: [{}] } } as Account,
|
53
|
+
{ mode: "any" as unknown } as GenericTransaction,
|
54
|
+
),
|
55
|
+
).toThrow("Unsupported transaction mode: any");
|
56
|
+
});
|
57
|
+
|
58
|
+
it("supersedes the logic with a custom function", () => {
|
59
|
+
const computeIntentType = (transaction: GenericTransaction) =>
|
60
|
+
transaction.mode === "send" && transaction.type === 2 ? "send-eip1559" : "send-legacy";
|
61
|
+
|
62
|
+
expect(
|
63
|
+
transactionToIntent(
|
64
|
+
{ currency: { name: "ethereum", units: [{}] } } as Account,
|
65
|
+
{ mode: "send", type: 2 } as GenericTransaction,
|
66
|
+
computeIntentType,
|
67
|
+
),
|
68
|
+
).toMatchObject({
|
69
|
+
type: "send-eip1559",
|
70
|
+
});
|
71
|
+
});
|
72
|
+
});
|
73
|
+
});
|
74
|
+
|
10
75
|
describe("findCryptoCurrencyByNetwork", () => {
|
11
76
|
it("finds a crypto currency by id", () => {
|
12
77
|
expect(findCryptoCurrencyByNetwork("ethereum")).toMatchObject({
|
@@ -78,6 +78,25 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
78
78
|
return res;
|
79
79
|
}
|
80
80
|
|
81
|
+
/**
|
82
|
+
* Default implementation of `computeIntentType` is a simple whitelist
|
83
|
+
* with a fallback to "Payment"
|
84
|
+
*/
|
85
|
+
function defaultComputeIntentType(transaction: GenericTransaction): string {
|
86
|
+
if (!transaction.mode) return "Payment"; // NOTE: assuming payment by default here, can be changed based on transaction.mode
|
87
|
+
|
88
|
+
const modeRemap = {
|
89
|
+
delegate: "stake",
|
90
|
+
undelegate: "unstake",
|
91
|
+
};
|
92
|
+
const mode = modeRemap[transaction.mode] ?? transaction.mode;
|
93
|
+
|
94
|
+
if (["changeTrust", "send", "send-legacy", "send-eip1559", "stake", "unstake"].includes(mode))
|
95
|
+
return mode;
|
96
|
+
|
97
|
+
throw new Error(`Unsupported transaction mode: ${transaction.mode}`);
|
98
|
+
}
|
99
|
+
|
81
100
|
/**
|
82
101
|
* Converts a transaction object into a `TransactionIntent` object, which is used to represent
|
83
102
|
* the intent of a transaction in a standardized format.
|
@@ -92,6 +111,7 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
92
111
|
* - `fees` (optional): The fees associated with the transaction.
|
93
112
|
* - `memoType` (optional): The type of memo to attach to the transaction.
|
94
113
|
* - `memoValue` (optional): The value of the memo to attach to the transaction.
|
114
|
+
* @param computeIntentType - An optional function to compute the intent type that supersedes the default implementation if present
|
95
115
|
*
|
96
116
|
* @returns A `TransactionIntent` object containing the standardized representation of the transaction.
|
97
117
|
* - Includes details such as type, sender, recipient, amount, fees, asset, and an optional memo.
|
@@ -103,41 +123,34 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
103
123
|
export function transactionToIntent(
|
104
124
|
account: Account,
|
105
125
|
transaction: GenericTransaction,
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
break;
|
119
|
-
case "send-eip1559":
|
120
|
-
transactionType = "send-eip1559";
|
121
|
-
break;
|
122
|
-
default:
|
123
|
-
throw new Error(`Unsupported transaction mode: ${transaction.mode}`);
|
124
|
-
}
|
125
|
-
}
|
126
|
-
const res: TransactionIntent & { memo?: { type: string; value?: string } } = {
|
127
|
-
type: transactionType,
|
126
|
+
computeIntentType?: (transaction: GenericTransaction) => string,
|
127
|
+
): TransactionIntent & { memo?: { type: string; value?: string } } & {
|
128
|
+
data?: { type: string; value?: unknown };
|
129
|
+
} {
|
130
|
+
const intentType = (computeIntentType ?? defaultComputeIntentType)(transaction);
|
131
|
+
const isStaking = ["stake", "unstake"].includes(intentType);
|
132
|
+
const amount = isStaking ? 0n : fromBigNumberToBigInt(transaction.amount, 0n);
|
133
|
+
const useAllAmount = isStaking || !!transaction.useAllAmount;
|
134
|
+
const res: TransactionIntent & { memo?: { type: string; value?: string } } & {
|
135
|
+
data?: { type: string; value?: unknown };
|
136
|
+
} = {
|
137
|
+
type: intentType,
|
128
138
|
sender: account.freshAddress,
|
129
139
|
recipient: transaction.recipient,
|
130
|
-
amount
|
140
|
+
amount,
|
131
141
|
asset: { type: "native", name: account.currency.name, unit: account.currency.units[0] },
|
132
|
-
useAllAmount
|
142
|
+
useAllAmount,
|
143
|
+
feesStrategy:
|
144
|
+
transaction.feesStrategy === "custom" ? undefined : transaction.feesStrategy ?? undefined,
|
145
|
+
data: Buffer.isBuffer(transaction.data)
|
146
|
+
? { type: "buffer", value: transaction.data }
|
147
|
+
: { type: "none" },
|
133
148
|
};
|
134
149
|
if (transaction.assetReference && transaction.assetOwner) {
|
135
150
|
const { subAccountId } = transaction;
|
136
151
|
const { subAccounts } = account;
|
137
152
|
|
138
|
-
const tokenAccount =
|
139
|
-
? null
|
140
|
-
: subAccounts && subAccounts.find(ta => ta.id === subAccountId);
|
153
|
+
const tokenAccount = subAccountId ? subAccounts?.find(ta => ta.id === subAccountId) : null;
|
141
154
|
|
142
155
|
res.asset = {
|
143
156
|
type: tokenAccount?.token.tokenType ?? "token",
|
@@ -155,6 +168,7 @@ export function transactionToIntent(
|
|
155
168
|
} else {
|
156
169
|
res.memo = { type: "NO_MEMO" };
|
157
170
|
}
|
171
|
+
|
158
172
|
return res;
|
159
173
|
}
|
160
174
|
|
@@ -188,9 +202,7 @@ export const buildOptimisticOperation = (
|
|
188
202
|
},
|
189
203
|
};
|
190
204
|
|
191
|
-
const tokenAccount =
|
192
|
-
? null
|
193
|
-
: subAccounts && subAccounts.find(ta => ta.id === subAccountId);
|
205
|
+
const tokenAccount = subAccountId ? subAccounts?.find(ta => ta.id === subAccountId) : null;
|
194
206
|
if (tokenAccount && subAccountId) {
|
195
207
|
operation.subOperations = [
|
196
208
|
{
|
package/src/bridge/impl.ts
CHANGED
package/src/e2e/enum/Network.ts
CHANGED
@@ -13,6 +13,7 @@ export const cantonConfig: Record<string, ConfigInfo> = {
|
|
13
13
|
minReserve: 0,
|
14
14
|
useGateway: true,
|
15
15
|
networkType: "mainnet",
|
16
|
+
nativeInstrumentId: "Amulet",
|
16
17
|
},
|
17
18
|
},
|
18
19
|
config_currency_canton_network_devnet: {
|
@@ -42,6 +43,7 @@ export const cantonConfig: Record<string, ConfigInfo> = {
|
|
42
43
|
minReserve: 0,
|
43
44
|
useGateway: false,
|
44
45
|
networkType: "localnet",
|
46
|
+
nativeInstrumentId: "Amulet",
|
45
47
|
},
|
46
48
|
},
|
47
49
|
};
|
@@ -348,6 +348,22 @@ const evmConfig: CurrencyLiveConfigDefinition = {
|
|
348
348
|
showNfts: false,
|
349
349
|
},
|
350
350
|
},
|
351
|
+
config_currency_core: {
|
352
|
+
type: "object",
|
353
|
+
default: {
|
354
|
+
status: {
|
355
|
+
type: "active",
|
356
|
+
},
|
357
|
+
node: {
|
358
|
+
type: "external",
|
359
|
+
uri: "https://rpc.ankr.com/core",
|
360
|
+
},
|
361
|
+
explorer: {
|
362
|
+
type: "none",
|
363
|
+
},
|
364
|
+
showNfts: false,
|
365
|
+
},
|
366
|
+
},
|
351
367
|
config_currency_fantom: {
|
352
368
|
type: "object",
|
353
369
|
default: {
|
@@ -786,6 +802,16 @@ const evmConfig: CurrencyLiveConfigDefinition = {
|
|
786
802
|
showNfts: false,
|
787
803
|
},
|
788
804
|
},
|
805
|
+
config_currency_ethereum_hoodi: {
|
806
|
+
type: "object",
|
807
|
+
default: {
|
808
|
+
status: { type: "active" },
|
809
|
+
node: { type: "ledger", explorerId: "eth_hoodi" },
|
810
|
+
explorer: { type: "ledger", explorerId: "eth_hoodi" },
|
811
|
+
gasTracker: { type: "ledger", explorerId: "eth_hoodi" },
|
812
|
+
showNfts: false,
|
813
|
+
},
|
814
|
+
},
|
789
815
|
config_currency_arbitrum_sepolia: {
|
790
816
|
type: "object",
|
791
817
|
default: {
|
@@ -0,0 +1,66 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`kaspa currency bridge scanAccounts kaspa seed 1 1`] = `
|
4
|
+
[
|
5
|
+
{
|
6
|
+
"balance": "13370000",
|
7
|
+
"currencyId": "kaspa",
|
8
|
+
"derivationMode": "",
|
9
|
+
"freshAddress": "kaspa:qz49rpg0q6ywewxkwl76757ya79v6j556hcmrcy7mk9d36ewgp80cdrwlct2h",
|
10
|
+
"freshAddressPath": "44'/111111'/0'/0/1",
|
11
|
+
"id": "js:2:kaspa:41049d8002c08041d975ab58491c09cf8ced7b388a114ab2f5df73f2534d4d74d17ab8913b3cb3056bad63141cb63fb92e44401b691dee069dbdb2119861c18cc01b204340fcc305ab72e752cd347f4b6271ffe21da098d4f2a4749826857dda7a5576:",
|
12
|
+
"index": 0,
|
13
|
+
"operationsCount": 1,
|
14
|
+
"pendingOperations": [],
|
15
|
+
"seedIdentifier": "41049d8002c08041d975ab58491c09cf8ced7b388a114ab2f5df73f2534d4d74d17ab8913b3cb3056bad63141cb63fb92e44401b691dee069dbdb2119861c18cc01b204340fcc305ab72e752cd347f4b6271ffe21da098d4f2a4749826857dda7a5576",
|
16
|
+
"spendableBalance": "13370000",
|
17
|
+
"swapHistory": [],
|
18
|
+
"syncHash": undefined,
|
19
|
+
"used": true,
|
20
|
+
"xpub": "41049d8002c08041d975ab58491c09cf8ced7b388a114ab2f5df73f2534d4d74d17ab8913b3cb3056bad63141cb63fb92e44401b691dee069dbdb2119861c18cc01b204340fcc305ab72e752cd347f4b6271ffe21da098d4f2a4749826857dda7a5576",
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"balance": "0",
|
24
|
+
"currencyId": "kaspa",
|
25
|
+
"derivationMode": "",
|
26
|
+
"freshAddress": "kaspa:qpncmme6ues25uk9umkqju4rtwtt33ud9lcrp7qn8jwv62m53m26jpjhar48j",
|
27
|
+
"freshAddressPath": "44'/111111'/1'/0/0",
|
28
|
+
"id": "js:2:kaspa:4104751b5ebd4a9d2a0a25d5c37cab4814a95335b8945cfcaa6a4138de418f581bb1d0d02f22081b3cda223a51e18a63ebdffd64803e0988b68a91802738a5a9f901206d4a2b989a82b5fb160f0151ea5d046451a291a0748f3038ecdc63d637cce00b:",
|
29
|
+
"index": 1,
|
30
|
+
"operationsCount": 0,
|
31
|
+
"pendingOperations": [],
|
32
|
+
"seedIdentifier": "41049d8002c08041d975ab58491c09cf8ced7b388a114ab2f5df73f2534d4d74d17ab8913b3cb3056bad63141cb63fb92e44401b691dee069dbdb2119861c18cc01b204340fcc305ab72e752cd347f4b6271ffe21da098d4f2a4749826857dda7a5576",
|
33
|
+
"spendableBalance": "0",
|
34
|
+
"swapHistory": [],
|
35
|
+
"syncHash": undefined,
|
36
|
+
"used": false,
|
37
|
+
"xpub": "4104751b5ebd4a9d2a0a25d5c37cab4814a95335b8945cfcaa6a4138de418f581bb1d0d02f22081b3cda223a51e18a63ebdffd64803e0988b68a91802738a5a9f901206d4a2b989a82b5fb160f0151ea5d046451a291a0748f3038ecdc63d637cce00b",
|
38
|
+
},
|
39
|
+
]
|
40
|
+
`;
|
41
|
+
|
42
|
+
exports[`kaspa currency bridge scanAccounts kaspa seed 1 2`] = `
|
43
|
+
[
|
44
|
+
[
|
45
|
+
{
|
46
|
+
"accountId": "js:2:kaspa:41049d8002c08041d975ab58491c09cf8ced7b388a114ab2f5df73f2534d4d74d17ab8913b3cb3056bad63141cb63fb92e44401b691dee069dbdb2119861c18cc01b204340fcc305ab72e752cd347f4b6271ffe21da098d4f2a4749826857dda7a5576:",
|
47
|
+
"blockHash": "c11f5877fc777b59a180de2da6bd02046e19219a9bda714c304ada1d3af7144b",
|
48
|
+
"blockHeight": 194187672,
|
49
|
+
"extra": {},
|
50
|
+
"fee": "2069",
|
51
|
+
"hash": "ed6dc5422558c3480e6a7809bf166e6ba1f2931ef39f24fe9b3bcf48253e4752",
|
52
|
+
"id": "ed6dc5422558c3480e6a7809bf166e6ba1f2931ef39f24fe9b3bcf48253e4752",
|
53
|
+
"recipients": [
|
54
|
+
"kaspa:qzavrhr9eg0k7pgr8mysfej34alfy8uj6vc9r84kgqfkqd8rtgxm5t0jvah73",
|
55
|
+
"kaspa:qqt874j85r5ga5av0q6tthj2tu89dfpchjmvjuvx5tyn2vpjjrhk7tcpsx2vu",
|
56
|
+
],
|
57
|
+
"senders": [
|
58
|
+
"kaspa:qqt874j85r5ga5av0q6tthj2tu89dfpchjmvjuvx5tyn2vpjjrhk7tcpsx2vu",
|
59
|
+
],
|
60
|
+
"type": "IN",
|
61
|
+
"value": "13370000",
|
62
|
+
},
|
63
|
+
],
|
64
|
+
[],
|
65
|
+
]
|
66
|
+
`;
|
@@ -2,7 +2,4 @@ import "../../__tests__/test-helpers/setup";
|
|
2
2
|
import { testBridge } from "../../__tests__/test-helpers/bridge";
|
3
3
|
import { dataset } from "@ledgerhq/coin-kaspa/test/index";
|
4
4
|
|
5
|
-
|
6
|
-
describe.skip("kaspa integration", () => {
|
7
|
-
testBridge(dataset);
|
8
|
-
});
|
5
|
+
testBridge(dataset);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { AccountLike } from "@ledgerhq/types-live";
|
2
2
|
import { useEffect, useMemo, useState } from "react";
|
3
|
-
import { Baker, Delegation } from "@ledgerhq/coin-tezos/types/index";
|
3
|
+
import { Baker, Delegation, StakingPosition } from "@ledgerhq/coin-tezos/types/index";
|
4
4
|
import { bakers } from "@ledgerhq/coin-tezos/network/index";
|
5
5
|
|
6
6
|
export function useBakers(whitelistAddresses: string[]): Baker[] {
|
@@ -55,3 +55,22 @@ export function useRandomBaker(bakers: Baker[]): Baker {
|
|
55
55
|
}, [bakers.length]);
|
56
56
|
return bakers[randomBakerIndex];
|
57
57
|
}
|
58
|
+
|
59
|
+
export function useStakingPositions(account: AccountLike): StakingPosition[] {
|
60
|
+
const delegation = useDelegation(account);
|
61
|
+
|
62
|
+
return useMemo(() => {
|
63
|
+
if (account.type !== "Account" || !delegation?.address) return [];
|
64
|
+
|
65
|
+
return [
|
66
|
+
{
|
67
|
+
uid: account.freshAddress,
|
68
|
+
address: account.freshAddress,
|
69
|
+
delegate: delegation.address,
|
70
|
+
state: "active" as const,
|
71
|
+
asset: { type: "native" as const },
|
72
|
+
amount: BigInt(account.balance.toString()),
|
73
|
+
},
|
74
|
+
];
|
75
|
+
}, [account, delegation]);
|
76
|
+
}
|
@@ -1,24 +1,14 @@
|
|
1
1
|
// Goal of this file is to inject all necessary device/signer dependency to coin-modules
|
2
2
|
|
3
3
|
import { DerivationType, LedgerSigner } from "@taquito/ledger-signer";
|
4
|
-
import {
|
5
|
-
import { TezosCoinConfig } from "@ledgerhq/coin-tezos/config";
|
6
|
-
import { createBridges } from "@ledgerhq/coin-tezos/bridge/index";
|
7
|
-
import type {
|
8
|
-
Transaction,
|
9
|
-
TezosSigner,
|
10
|
-
TransactionStatus,
|
11
|
-
TezosAccount,
|
12
|
-
} from "@ledgerhq/coin-tezos/types/index";
|
4
|
+
import type { TezosSigner } from "@ledgerhq/coin-tezos/types/index";
|
13
5
|
import makeCliTools from "@ledgerhq/coin-tezos/test/cli";
|
14
6
|
import type { CliTools } from "@ledgerhq/coin-tezos/test/cli";
|
15
7
|
import tezosResolver from "@ledgerhq/coin-tezos/signer/index";
|
16
8
|
import Xtz, { Curve } from "@ledgerhq/hw-app-tezos";
|
17
9
|
import Transport from "@ledgerhq/hw-transport";
|
18
|
-
import
|
19
|
-
import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
|
10
|
+
import { createResolver, CreateSigner } from "../../bridge/setup";
|
20
11
|
import { Resolver } from "../../hw/getAddress/types";
|
21
|
-
import { getCurrencyConfiguration } from "../../config";
|
22
12
|
|
23
13
|
const createSigner: CreateSigner<TezosSigner> = (transport: Transport) => {
|
24
14
|
const xtz = new Xtz(transport);
|
@@ -46,17 +36,8 @@ const createSigner: CreateSigner<TezosSigner> = (transport: Transport) => {
|
|
46
36
|
};
|
47
37
|
};
|
48
38
|
|
49
|
-
const getCurrencyConfig = (): TezosCoinConfig => {
|
50
|
-
return getCurrencyConfiguration(getCryptoCurrencyById("tezos"));
|
51
|
-
};
|
52
|
-
|
53
|
-
const bridge: Bridge<Transaction, TezosAccount, TransactionStatus> = createBridges(
|
54
|
-
executeWithSigner(createSigner),
|
55
|
-
getCurrencyConfig,
|
56
|
-
);
|
57
|
-
|
58
39
|
const resolver: Resolver = createResolver(createSigner, tezosResolver);
|
59
40
|
|
60
41
|
const cliTools: CliTools = makeCliTools();
|
61
42
|
|
62
|
-
export {
|
43
|
+
export { cliTools, resolver };
|
@@ -17,7 +17,6 @@ import { bridge as near } from "../../families/near/setup";
|
|
17
17
|
import { bridge as polkadot } from "../../families/polkadot/setup";
|
18
18
|
import { bridge as solana } from "../../families/solana/setup";
|
19
19
|
import { bridge as stacks } from "../../families/stacks/setup";
|
20
|
-
import { bridge as tezos } from "../../families/tezos/setup";
|
21
20
|
import { bridge as ton } from "../../families/ton/setup";
|
22
21
|
import { bridge as tron } from "../../families/tron/setup";
|
23
22
|
import { bridge as vechain } from "../../families/vechain/setup";
|
@@ -44,7 +43,6 @@ export default {
|
|
44
43
|
polkadot,
|
45
44
|
solana,
|
46
45
|
stacks,
|
47
|
-
tezos,
|
48
46
|
ton,
|
49
47
|
tron,
|
50
48
|
vechain,
|