@ledgerhq/live-common 34.54.0-nightly.20251204135727 → 34.54.0-nightly.20251205023918
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/generic-alpaca/broadcast.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/broadcast.js +3 -3
- package/lib/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.js +1 -3
- package/lib/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +2 -1
- 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 +16 -7
- 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 +16 -1
- 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 +38 -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 +18 -2
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts +2 -0
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/Eth.js +8 -1
- package/lib/bridge/generic-alpaca/signer/Eth.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.js +7 -0
- package/lib/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/types.d.ts +4 -0
- package/lib/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +11 -3
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +14 -3
- package/lib/bridge/impl.js.map +1 -1
- package/lib/families/canton/config.d.ts.map +1 -1
- package/lib/families/canton/config.js +4 -4
- package/lib/families/canton/config.js.map +1 -1
- package/lib/families/celo/setup.d.ts.map +1 -1
- package/lib/families/celo/setup.js +11 -0
- package/lib/families/celo/setup.js.map +1 -1
- package/lib/families/evm/bridge/mock.d.ts +1 -0
- package/lib/families/evm/bridge/mock.d.ts.map +1 -1
- package/lib/families/evm/bridge/mock.js +12 -0
- package/lib/families/evm/bridge/mock.js.map +1 -1
- package/lib/families/evm/setup.d.ts +1 -4
- package/lib/families/evm/setup.d.ts.map +1 -1
- package/lib/families/evm/setup.js +1 -8
- package/lib/families/evm/setup.js.map +1 -1
- package/lib/families/evm/walletApiAdapter.d.ts +7 -0
- package/lib/families/evm/walletApiAdapter.d.ts.map +1 -1
- package/lib/families/evm/walletApiAdapter.js +36 -2
- package/lib/families/evm/walletApiAdapter.js.map +1 -1
- package/lib/families/stacks/constants.d.ts +1 -1
- package/lib/families/stacks/constants.d.ts.map +1 -1
- package/lib/families/stacks/constants.js +1 -1
- package/lib/families/stacks/constants.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 +30 -32
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/bridge/mock.d.ts +1 -0
- package/lib/generated/bridge/mock.d.ts.map +1 -1
- package/lib/operation.d.ts.map +1 -1
- package/lib/operation.js +7 -2
- package/lib/operation.js.map +1 -1
- package/lib/wallet-api/constants.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.js +3 -3
- package/lib-es/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.js +1 -3
- package/lib-es/bridge/generic-alpaca/currencyBridge.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 -1
- 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 +16 -7
- 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 +16 -1
- 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 +38 -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 +18 -2
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts +2 -0
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.js +4 -0
- package/lib-es/bridge/generic-alpaca/signer/Eth.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 +7 -0
- package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts +4 -0
- package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +11 -3
- 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 +14 -3
- package/lib-es/bridge/impl.js.map +1 -1
- package/lib-es/families/canton/config.d.ts.map +1 -1
- package/lib-es/families/canton/config.js +4 -4
- package/lib-es/families/canton/config.js.map +1 -1
- package/lib-es/families/celo/setup.d.ts.map +1 -1
- package/lib-es/families/celo/setup.js +11 -0
- package/lib-es/families/celo/setup.js.map +1 -1
- package/lib-es/families/evm/bridge/mock.d.ts +1 -0
- package/lib-es/families/evm/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/evm/bridge/mock.js +12 -0
- package/lib-es/families/evm/bridge/mock.js.map +1 -1
- package/lib-es/families/evm/setup.d.ts +1 -4
- package/lib-es/families/evm/setup.d.ts.map +1 -1
- package/lib-es/families/evm/setup.js +2 -8
- package/lib-es/families/evm/setup.js.map +1 -1
- package/lib-es/families/evm/walletApiAdapter.d.ts +7 -0
- package/lib-es/families/evm/walletApiAdapter.d.ts.map +1 -1
- package/lib-es/families/evm/walletApiAdapter.js +30 -1
- package/lib-es/families/evm/walletApiAdapter.js.map +1 -1
- package/lib-es/families/stacks/constants.d.ts +1 -1
- package/lib-es/families/stacks/constants.d.ts.map +1 -1
- package/lib-es/families/stacks/constants.js +1 -1
- package/lib-es/families/stacks/constants.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/bridge/mock.d.ts +1 -0
- package/lib-es/generated/bridge/mock.d.ts.map +1 -1
- package/lib-es/operation.d.ts.map +1 -1
- package/lib-es/operation.js +7 -2
- package/lib-es/operation.js.map +1 -1
- package/lib-es/wallet-api/constants.d.ts +1 -1
- package/package.json +56 -56
- package/src/bridge/generic-alpaca/broadcast.ts +6 -3
- package/src/bridge/generic-alpaca/currencyBridge.ts +1 -3
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +2 -1
- package/src/bridge/generic-alpaca/getAccountShape.ts +24 -12
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +16 -1
- package/src/bridge/generic-alpaca/prepareTransaction.ts +44 -10
- package/src/bridge/generic-alpaca/signOperation.ts +18 -2
- package/src/bridge/generic-alpaca/signer/Eth.ts +5 -1
- package/src/bridge/generic-alpaca/signer/index.ts +7 -0
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +2 -2
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +32 -0
- package/src/bridge/generic-alpaca/types.ts +4 -0
- package/src/bridge/generic-alpaca/utils.test.ts +1 -0
- package/src/bridge/generic-alpaca/utils.ts +14 -3
- package/src/bridge/impl.ts +16 -3
- package/src/families/canton/config.ts +5 -4
- package/src/families/celo/setup.ts +12 -0
- package/src/families/evm/bridge/mock.ts +14 -0
- package/src/families/evm/setup.ts +3 -22
- package/src/families/evm/walletApiAdapter.ts +33 -1
- package/src/families/stacks/__snapshots__/bridge.integration.test.ts.snap +1537 -18
- package/src/families/stacks/__tests__/sync.integration.test.ts +2 -2
- package/src/families/stacks/constants.ts +1 -1
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +9 -9
- package/src/generated/bridge/js.ts +0 -2
- package/src/operation.ts +10 -2
package/src/bridge/impl.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { AddressesSanctionedError } from "@ledgerhq/coin-framework/sanction/erro
|
|
|
23
23
|
// Removed: stores are now managed globally by @ledgerhq/cryptoassets/cal-client/store
|
|
24
24
|
|
|
25
25
|
const alpacaized = {
|
|
26
|
+
evm: true,
|
|
26
27
|
xrp: true,
|
|
27
28
|
stellar: true,
|
|
28
29
|
tezos: true,
|
|
@@ -35,7 +36,13 @@ const currencyBridgeCache: Record<string, CurrencyBridge> = {};
|
|
|
35
36
|
export const getCurrencyBridge = (currency: CryptoCurrency): CurrencyBridge => {
|
|
36
37
|
if (getEnv("MOCK")) {
|
|
37
38
|
const mockBridge = mockBridges[currency.family];
|
|
38
|
-
|
|
39
|
+
// TODO Remove once we delete mock bridges tests
|
|
40
|
+
if (mockBridge) {
|
|
41
|
+
if (typeof mockBridge.loadCoinConfig === "function") {
|
|
42
|
+
mockBridge.loadCoinConfig();
|
|
43
|
+
}
|
|
44
|
+
return mockBridge.currencyBridge;
|
|
45
|
+
}
|
|
39
46
|
throw new CurrencyNotSupported("no mock implementation available for currency " + currency.id, {
|
|
40
47
|
currencyName: currency.id,
|
|
41
48
|
});
|
|
@@ -85,13 +92,19 @@ export function getAccountBridgeByFamily(family: string, accountId?: string): Ac
|
|
|
85
92
|
|
|
86
93
|
if (type === "mock") {
|
|
87
94
|
const mockBridge = mockBridges[family];
|
|
88
|
-
|
|
95
|
+
// TODO Remove once we delete mock bridges tests
|
|
96
|
+
if (mockBridge) {
|
|
97
|
+
if (typeof mockBridge.loadCoinConfig === "function") {
|
|
98
|
+
mockBridge.loadCoinConfig();
|
|
99
|
+
}
|
|
100
|
+
return wrapAccountBridge(mockBridge.accountBridge);
|
|
101
|
+
}
|
|
89
102
|
}
|
|
90
103
|
}
|
|
91
104
|
|
|
92
105
|
if (alpacaized[family]) {
|
|
93
106
|
if (!bridgeCache[family]) {
|
|
94
|
-
bridgeCache[family] = getAlpacaAccountBridge(family, "local");
|
|
107
|
+
bridgeCache[family] = wrapAccountBridge(getAlpacaAccountBridge(family, "local"));
|
|
95
108
|
}
|
|
96
109
|
return bridgeCache[family];
|
|
97
110
|
}
|
|
@@ -23,9 +23,9 @@ export const cantonConfig: Record<string, ConfigInfo> = {
|
|
|
23
23
|
status: {
|
|
24
24
|
type: "active",
|
|
25
25
|
},
|
|
26
|
-
nodeUrl: "https://canton-gateway.api.live.ledger.com/v1/node/ledger-live-devnet",
|
|
26
|
+
nodeUrl: "https://canton-gateway-devnet.api.live.ledger-test.com/v1/node/ledger-live-devnet",
|
|
27
27
|
nodeId: "ledger-live-devnet",
|
|
28
|
-
gatewayUrl: "https://canton-gateway.api.live.ledger-test.com",
|
|
28
|
+
gatewayUrl: "https://canton-gateway-devnet.api.live.ledger-test.com",
|
|
29
29
|
minReserve: 0,
|
|
30
30
|
useGateway: true,
|
|
31
31
|
networkType: "devnet",
|
|
@@ -39,9 +39,10 @@ export const cantonConfig: Record<string, ConfigInfo> = {
|
|
|
39
39
|
status: {
|
|
40
40
|
type: "active",
|
|
41
41
|
},
|
|
42
|
-
nodeUrl:
|
|
42
|
+
nodeUrl:
|
|
43
|
+
"https://canton-gateway-testnet.api.live.ledger-test.com/v1/node/ledger-live-testnet",
|
|
43
44
|
nodeId: "ledger-live-testnet",
|
|
44
|
-
gatewayUrl: "https://canton-gateway.api.live.ledger-test.com",
|
|
45
|
+
gatewayUrl: "https://canton-gateway-testnet.api.live.ledger-test.com",
|
|
45
46
|
minReserve: 0,
|
|
46
47
|
nativeInstrumentId: "Amulet",
|
|
47
48
|
useGateway: true,
|
|
@@ -10,9 +10,21 @@ import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/se
|
|
|
10
10
|
import type { Resolver } from "../../hw/getAddress/types";
|
|
11
11
|
import { Transaction, CeloAccount } from "./types";
|
|
12
12
|
import { CeloSigner } from "@ledgerhq/coin-celo/signer";
|
|
13
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
14
|
+
import { createApi as createEvmApi } from "@ledgerhq/coin-evm/api/index";
|
|
15
|
+
import { getCurrencyConfiguration } from "../../config";
|
|
16
|
+
import type { EvmConfigInfo } from "@ledgerhq/coin-evm/config";
|
|
13
17
|
|
|
14
18
|
const createSigner: CreateSigner<CeloSigner> = (transport: Transport) => new Celo(transport);
|
|
15
19
|
|
|
20
|
+
// NOTE Create an unused instance of EVM API with Celo configuration.
|
|
21
|
+
// It has the side effect of initializing the EVM coin config as well as injecting
|
|
22
|
+
// the input Celo config.
|
|
23
|
+
// TODO Remove this hack while deleting the Celo bridge
|
|
24
|
+
const getCurrencyConfig = () => {
|
|
25
|
+
return { info: getCurrencyConfiguration<EvmConfigInfo>(getCryptoCurrencyById("celo")) };
|
|
26
|
+
};
|
|
27
|
+
createEvmApi(getCurrencyConfig, "celo");
|
|
16
28
|
const bridge: Bridge<Transaction, CeloAccount> = createBridges(executeWithSigner(createSigner));
|
|
17
29
|
|
|
18
30
|
const resolver: Resolver = createResolver(createSigner, CeloResolver);
|
|
@@ -17,6 +17,9 @@ import {
|
|
|
17
17
|
} from "@ledgerhq/coin-framework/bridge/jsHelpers";
|
|
18
18
|
import { getGasLimit } from "@ledgerhq/coin-evm/utils";
|
|
19
19
|
import { getTypedTransaction } from "@ledgerhq/coin-evm/transaction";
|
|
20
|
+
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
21
|
+
import { getCurrencyConfiguration } from "../../../config";
|
|
22
|
+
import { EvmConfigInfo, setCoinConfig } from "@ledgerhq/coin-evm/config";
|
|
20
23
|
const receive = makeAccountBridgeReceive();
|
|
21
24
|
const defaultGetFees = (_a, t: any) => (t.gasPrice || new BigNumber(0)).times(getGasLimit(t));
|
|
22
25
|
|
|
@@ -110,6 +113,16 @@ const prepareTransaction = async (_a, t) => {
|
|
|
110
113
|
return typedTransaction;
|
|
111
114
|
};
|
|
112
115
|
|
|
116
|
+
let isConfigLoaded = false;
|
|
117
|
+
const loadCoinConfig = () => {
|
|
118
|
+
if (!isConfigLoaded) {
|
|
119
|
+
setCoinConfig((currency: CryptoCurrency) => {
|
|
120
|
+
isConfigLoaded = true;
|
|
121
|
+
return { info: getCurrencyConfiguration<EvmConfigInfo>(currency) };
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
113
126
|
const accountBridge: AccountBridge<Transaction> = {
|
|
114
127
|
createTransaction,
|
|
115
128
|
updateTransaction,
|
|
@@ -131,4 +144,5 @@ const currencyBridge: CurrencyBridge = {
|
|
|
131
144
|
export default {
|
|
132
145
|
currencyBridge,
|
|
133
146
|
accountBridge,
|
|
147
|
+
loadCoinConfig,
|
|
134
148
|
};
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
// Goal of this file is to inject all necessary device/signer dependency to coin-modules
|
|
2
2
|
|
|
3
|
-
import { createBridges } from "@ledgerhq/coin-evm/bridge/js";
|
|
4
3
|
import makeCliTools from "@ledgerhq/coin-evm/cli-transaction";
|
|
5
4
|
import evmResolver from "@ledgerhq/coin-evm/hw-getAddress";
|
|
6
5
|
import { prepareMessageToSign, signMessage } from "@ledgerhq/coin-evm/hw-signMessage";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
CreateSigner,
|
|
10
|
-
createMessageSigner,
|
|
11
|
-
createResolver,
|
|
12
|
-
executeWithSigner,
|
|
13
|
-
} from "../../bridge/setup";
|
|
6
|
+
import { CreateSigner, createMessageSigner, createResolver } from "../../bridge/setup";
|
|
14
7
|
import { Resolver } from "../../hw/getAddress/types";
|
|
15
8
|
import Transport from "@ledgerhq/hw-transport";
|
|
16
|
-
import type { Bridge } from "@ledgerhq/types-live";
|
|
17
|
-
import { getCurrencyConfiguration } from "../../config";
|
|
18
|
-
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
19
|
-
import { EvmConfigInfo } from "@ledgerhq/coin-evm/config";
|
|
20
9
|
import { type DeviceManagementKit } from "@ledgerhq/device-management-kit";
|
|
21
10
|
import { DmkSignerEth, LegacySignerEth } from "@ledgerhq/live-signer-evm";
|
|
22
11
|
import { EvmSigner } from "@ledgerhq/coin-evm/types/signer";
|
|
12
|
+
|
|
23
13
|
const createSigner: CreateSigner<EvmSigner> = (transport: Transport) => {
|
|
24
14
|
if (isDmkTransport(transport)) {
|
|
25
15
|
return new DmkSignerEth(transport.dmk, transport.sessionId);
|
|
@@ -39,15 +29,6 @@ const isDmkTransport = (
|
|
|
39
29
|
);
|
|
40
30
|
};
|
|
41
31
|
|
|
42
|
-
const getCurrencyConfig = (currency: CryptoCurrency) => {
|
|
43
|
-
return { info: getCurrencyConfiguration<EvmConfigInfo>(currency) };
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const bridge: Bridge<EvmTransaction> = createBridges(
|
|
47
|
-
executeWithSigner(createSigner),
|
|
48
|
-
getCurrencyConfig,
|
|
49
|
-
);
|
|
50
|
-
|
|
51
32
|
const messageSigner = {
|
|
52
33
|
prepareMessageToSign,
|
|
53
34
|
signMessage: createMessageSigner(createSigner, signMessage),
|
|
@@ -57,4 +38,4 @@ const resolver: Resolver = createResolver(createSigner, evmResolver);
|
|
|
57
38
|
|
|
58
39
|
const cliTools = makeCliTools();
|
|
59
40
|
|
|
60
|
-
export {
|
|
41
|
+
export { cliTools, resolver, messageSigner };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createTransaction } from "@ledgerhq/coin-evm/bridge/createTransaction";
|
|
2
1
|
import { Transaction } from "@ledgerhq/coin-evm/types/index";
|
|
3
2
|
import { EthereumTransaction as WalletAPIEthereumTransaction } from "@ledgerhq/wallet-api-core";
|
|
4
3
|
import {
|
|
@@ -6,9 +5,42 @@ import {
|
|
|
6
5
|
ConvertToLiveTransaction,
|
|
7
6
|
GetWalletAPITransactionSignFlowInfos,
|
|
8
7
|
} from "../../wallet-api/types";
|
|
8
|
+
import BigNumber from "bignumber.js";
|
|
9
|
+
import { AccountLike } from "@ledgerhq/types-live";
|
|
10
|
+
import { DEFAULT_GAS_LIMIT, DEFAULT_NONCE } from "@ledgerhq/coin-evm/utils";
|
|
9
11
|
|
|
10
12
|
const CAN_EDIT_FEES = true;
|
|
11
13
|
|
|
14
|
+
const getChainId = (account: AccountLike): number => {
|
|
15
|
+
if (account.type === "Account") {
|
|
16
|
+
return account.currency.ethereumLikeInfo?.chainId || 0;
|
|
17
|
+
}
|
|
18
|
+
if (account.type === "TokenAccount") {
|
|
19
|
+
return account.token.parentCurrency.ethereumLikeInfo?.chainId || 0;
|
|
20
|
+
}
|
|
21
|
+
return 0;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* EVM Transaction factory.
|
|
26
|
+
* By default the transaction is an EIP-1559 transaction.
|
|
27
|
+
* @see prepareTransaction that will make sure it's compatible or not
|
|
28
|
+
*/
|
|
29
|
+
export const createTransaction: (account: AccountLike) => Transaction = account => ({
|
|
30
|
+
family: "evm",
|
|
31
|
+
mode: "send",
|
|
32
|
+
amount: new BigNumber(0),
|
|
33
|
+
useAllAmount: false,
|
|
34
|
+
recipient: "",
|
|
35
|
+
maxFeePerGas: new BigNumber(0),
|
|
36
|
+
maxPriorityFeePerGas: new BigNumber(0),
|
|
37
|
+
gasLimit: DEFAULT_GAS_LIMIT,
|
|
38
|
+
nonce: DEFAULT_NONCE,
|
|
39
|
+
chainId: getChainId(account),
|
|
40
|
+
feesStrategy: "medium",
|
|
41
|
+
type: 2,
|
|
42
|
+
});
|
|
43
|
+
|
|
12
44
|
const areFeesProvided: AreFeesProvided<WalletAPIEthereumTransaction> = tx =>
|
|
13
45
|
!!((tx.gasLimit && tx.gasPrice) || (tx.gasLimit && tx.maxFeePerGas && tx.maxPriorityFeePerGas));
|
|
14
46
|
|