@swapkit/wallets 3.0.0-beta.9 → 4.0.0-beta.38
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/dist/chunk-0qaxr89s.js +3 -0
- package/dist/chunk-0qaxr89s.js.map +10 -0
- package/dist/chunk-2aa1w78q.js +3 -0
- package/dist/chunk-2aa1w78q.js.map +10 -0
- package/dist/chunk-bexr8da2.js +4 -0
- package/dist/chunk-bexr8da2.js.map +10 -0
- package/dist/chunk-dcj9twam.js +3 -0
- package/dist/chunk-dcj9twam.js.map +10 -0
- package/dist/{chunk-p1kdg37m.js → chunk-qwd1kp32.js} +2 -2
- package/dist/{chunk-p1kdg37m.js.map → chunk-qwd1kp32.js.map} +1 -1
- package/dist/chunk-sn6pgje5.js +3 -0
- package/dist/chunk-sn6pgje5.js.map +10 -0
- package/dist/chunk-th8ggrmx.js +4 -0
- package/dist/{chunk-6ndrbmhg.js.map → chunk-th8ggrmx.js.map} +3 -3
- package/dist/chunk-wfattb4a.js +3 -0
- package/dist/chunk-wfattb4a.js.map +10 -0
- package/dist/chunk-yah6cf33.js +3 -0
- package/dist/{chunk-hxt2nqa8.js.map → chunk-yah6cf33.js.map} +3 -3
- package/dist/src/bitget/index.cjs +2 -2
- package/dist/src/bitget/index.cjs.map +3 -3
- package/dist/src/bitget/index.js +2 -2
- package/dist/src/bitget/index.js.map +3 -3
- package/dist/src/coinbase/index.cjs +2 -2
- package/dist/src/coinbase/index.cjs.map +3 -3
- package/dist/src/coinbase/index.js +2 -2
- package/dist/src/coinbase/index.js.map +3 -3
- package/dist/src/cosmostation/index.cjs +3 -0
- package/dist/src/cosmostation/index.cjs.map +10 -0
- package/dist/src/cosmostation/index.js +3 -0
- package/dist/src/cosmostation/index.js.map +10 -0
- package/dist/src/ctrl/index.cjs +2 -2
- package/dist/src/ctrl/index.cjs.map +4 -4
- package/dist/src/ctrl/index.js +2 -2
- package/dist/src/ctrl/index.js.map +4 -4
- package/dist/src/evm-extensions/index.cjs +2 -2
- package/dist/src/evm-extensions/index.cjs.map +3 -3
- package/dist/src/evm-extensions/index.js +2 -2
- package/dist/src/evm-extensions/index.js.map +3 -3
- package/dist/src/exodus/index.cjs +2 -2
- package/dist/src/exodus/index.cjs.map +3 -3
- package/dist/src/exodus/index.js +2 -2
- package/dist/src/exodus/index.js.map +3 -3
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/keepkey/index.cjs +2 -2
- package/dist/src/keepkey/index.cjs.map +9 -9
- package/dist/src/keepkey/index.js +2 -2
- package/dist/src/keepkey/index.js.map +9 -9
- package/dist/src/keepkey-bex/index.cjs +2 -2
- package/dist/src/keepkey-bex/index.cjs.map +4 -4
- package/dist/src/keepkey-bex/index.js +2 -2
- package/dist/src/keepkey-bex/index.js.map +4 -4
- package/dist/src/keplr/index.cjs +2 -2
- package/dist/src/keplr/index.cjs.map +3 -3
- package/dist/src/keplr/index.js +2 -2
- package/dist/src/keplr/index.js.map +3 -3
- package/dist/src/keystore/index.cjs +2 -2
- package/dist/src/keystore/index.cjs.map +4 -4
- package/dist/src/keystore/index.js +2 -2
- package/dist/src/keystore/index.js.map +4 -4
- package/dist/src/ledger/index.cjs +3 -3
- package/dist/src/ledger/index.cjs.map +17 -15
- package/dist/src/ledger/index.js +3 -3
- package/dist/src/ledger/index.js.map +17 -15
- package/dist/src/okx/index.cjs +2 -2
- package/dist/src/okx/index.cjs.map +4 -4
- package/dist/src/okx/index.js +2 -2
- package/dist/src/okx/index.js.map +4 -4
- package/dist/src/onekey/index.cjs +2 -2
- package/dist/src/onekey/index.cjs.map +3 -3
- package/dist/src/onekey/index.js +2 -2
- package/dist/src/onekey/index.js.map +3 -3
- package/dist/src/phantom/index.js +2 -2
- package/dist/src/phantom/index.js.map +2 -2
- package/dist/src/polkadotjs/index.js +2 -2
- package/dist/src/polkadotjs/index.js.map +1 -1
- package/dist/src/radix/index.cjs +2 -2
- package/dist/src/radix/index.cjs.map +3 -3
- package/dist/src/radix/index.js +2 -2
- package/dist/src/radix/index.js.map +3 -3
- package/dist/src/talisman/index.js +2 -2
- package/dist/src/talisman/index.js.map +1 -1
- package/dist/src/trezor/index.cjs +2 -2
- package/dist/src/trezor/index.cjs.map +3 -3
- package/dist/src/trezor/index.js +2 -2
- package/dist/src/trezor/index.js.map +3 -3
- package/dist/src/walletconnect/index.cjs +2 -2
- package/dist/src/walletconnect/index.cjs.map +6 -7
- package/dist/src/walletconnect/index.js +2 -2
- package/dist/src/walletconnect/index.js.map +6 -7
- package/package.json +73 -28
- package/src/bitget/helpers.ts +4 -4
- package/src/coinbase/signer.ts +4 -4
- package/src/cosmostation/index.ts +142 -0
- package/src/ctrl/index.ts +83 -0
- package/src/ctrl/walletHelpers.ts +98 -70
- package/src/evm-extensions/index.ts +4 -3
- package/src/exodus/index.ts +8 -9
- package/src/helpers/near-browser-provider.d.ts +286 -0
- package/src/helpers/near.ts +206 -0
- package/src/keepkey/chains/cosmos.ts +44 -50
- package/src/keepkey/chains/evm.ts +16 -8
- package/src/keepkey/chains/mayachain.ts +3 -2
- package/src/keepkey/chains/thorchain.ts +3 -2
- package/src/keepkey/chains/utxo.ts +14 -3
- package/src/keepkey/coins.ts +10 -4
- package/src/keepkey/index.ts +15 -7
- package/src/keepkey-bex/index.ts +9 -14
- package/src/keepkey-bex/walletHelpers.ts +1 -1
- package/src/keplr/index.ts +4 -3
- package/src/keystore/helpers.ts +2 -4
- package/src/keystore/index.ts +2 -0
- package/src/ledger/clients/cosmos.ts +5 -4
- package/src/ledger/clients/evm.ts +7 -6
- package/src/ledger/clients/near.ts +86 -0
- package/src/ledger/clients/thorchain/helpers.ts +9 -4
- package/src/ledger/clients/thorchain/index.ts +3 -3
- package/src/ledger/clients/thorchain/lib.ts +3 -2
- package/src/ledger/clients/thorchain/utils.ts +20 -9
- package/src/ledger/clients/utxo.ts +3 -5
- package/src/ledger/clients/xrp.ts +66 -0
- package/src/ledger/cosmosTypes.ts +14 -10
- package/src/ledger/helpers/getLedgerAddress.ts +17 -3
- package/src/ledger/helpers/getLedgerClient.ts +63 -45
- package/src/ledger/helpers/getLedgerTransport.ts +5 -3
- package/src/ledger/index.ts +28 -7
- package/src/ledger/interfaces/CosmosLedgerInterface.ts +1 -2
- package/src/okx/helpers.ts +27 -9
- package/src/okx/index.ts +1 -0
- package/src/onekey/index.ts +3 -7
- package/src/radix/index.ts +4 -4
- package/src/trezor/evmSigner.ts +4 -4
- package/src/trezor/index.ts +14 -4
- package/src/types.ts +14 -0
- package/src/utils.ts +4 -0
- package/src/walletconnect/constants.ts +2 -0
- package/src/walletconnect/evmSigner.ts +8 -4
- package/src/walletconnect/helpers.ts +9 -2
- package/src/walletconnect/index.ts +134 -24
- package/dist/chunk-6ndrbmhg.js +0 -4
- package/dist/chunk-bhfpfqc3.js +0 -3
- package/dist/chunk-bhfpfqc3.js.map +0 -10
- package/dist/chunk-hxt2nqa8.js +0 -3
- package/dist/chunk-q81hzyra.js +0 -3
- package/dist/chunk-q81hzyra.js.map +0 -10
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Chain,
|
|
3
|
+
type DerivationPathArray,
|
|
4
|
+
type EVMChain,
|
|
5
|
+
SwapKitError,
|
|
6
|
+
WalletOption,
|
|
7
|
+
} from "@swapkit/helpers";
|
|
2
8
|
|
|
3
9
|
import { CosmosLedger } from "../clients/cosmos";
|
|
4
10
|
import {
|
|
@@ -10,6 +16,7 @@ import {
|
|
|
10
16
|
OptimismLedger,
|
|
11
17
|
PolygonLedger,
|
|
12
18
|
} from "../clients/evm";
|
|
19
|
+
import { getNearLedgerClient } from "../clients/near";
|
|
13
20
|
import { THORChainLedger } from "../clients/thorchain";
|
|
14
21
|
import {
|
|
15
22
|
BitcoinCashLedger,
|
|
@@ -18,6 +25,8 @@ import {
|
|
|
18
25
|
DogecoinLedger,
|
|
19
26
|
LitecoinLedger,
|
|
20
27
|
} from "../clients/utxo";
|
|
28
|
+
import { XRPLedger } from "../clients/xrp";
|
|
29
|
+
import { getLedgerTransport } from "./getLedgerTransport";
|
|
21
30
|
|
|
22
31
|
type LedgerSignerMap = {
|
|
23
32
|
[Chain.Arbitrum]: ReturnType<typeof ArbitrumLedger>;
|
|
@@ -31,8 +40,10 @@ type LedgerSignerMap = {
|
|
|
31
40
|
[Chain.Dogecoin]: ReturnType<typeof DogecoinLedger>;
|
|
32
41
|
[Chain.Ethereum]: ReturnType<typeof EthereumLedger>;
|
|
33
42
|
[Chain.Litecoin]: ReturnType<typeof LitecoinLedger>;
|
|
43
|
+
[Chain.Near]: Awaited<ReturnType<typeof getNearLedgerClient>>;
|
|
34
44
|
[Chain.Optimism]: ReturnType<typeof OptimismLedger>;
|
|
35
45
|
[Chain.Polygon]: ReturnType<typeof PolygonLedger>;
|
|
46
|
+
[Chain.Ripple]: ReturnType<typeof XRPLedger>;
|
|
36
47
|
[Chain.THORChain]: THORChainLedger;
|
|
37
48
|
};
|
|
38
49
|
|
|
@@ -45,51 +56,58 @@ export const getLedgerClient = async <T extends LedgerSupportedChain>({
|
|
|
45
56
|
chain: T;
|
|
46
57
|
derivationPath?: DerivationPathArray;
|
|
47
58
|
}): Promise<LedgerSignerMap[T]> => {
|
|
48
|
-
|
|
49
|
-
case Chain.THORChain:
|
|
50
|
-
return new THORChainLedger(derivationPath) as LedgerSignerMap[T];
|
|
51
|
-
case Chain.Cosmos:
|
|
52
|
-
return new CosmosLedger(derivationPath) as LedgerSignerMap[T];
|
|
53
|
-
case Chain.Bitcoin:
|
|
54
|
-
return BitcoinLedger(derivationPath) as LedgerSignerMap[T];
|
|
55
|
-
case Chain.BitcoinCash:
|
|
56
|
-
return BitcoinCashLedger(derivationPath) as LedgerSignerMap[T];
|
|
57
|
-
case Chain.Dash:
|
|
58
|
-
return DashLedger(derivationPath) as LedgerSignerMap[T];
|
|
59
|
-
case Chain.Dogecoin:
|
|
60
|
-
return DogecoinLedger(derivationPath) as LedgerSignerMap[T];
|
|
61
|
-
case Chain.Litecoin:
|
|
62
|
-
return LitecoinLedger(derivationPath) as LedgerSignerMap[T];
|
|
63
|
-
|
|
64
|
-
case Chain.Arbitrum:
|
|
65
|
-
case Chain.Avalanche:
|
|
66
|
-
case Chain.BinanceSmartChain:
|
|
67
|
-
case Chain.Ethereum:
|
|
68
|
-
case Chain.Optimism:
|
|
69
|
-
case Chain.Polygon:
|
|
70
|
-
case Chain.Base: {
|
|
71
|
-
const { getProvider } = await import("@swapkit/toolboxes/evm");
|
|
72
|
-
const params = { provider: await getProvider(chain), derivationPath };
|
|
59
|
+
const { match } = await import("ts-pattern");
|
|
73
60
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
61
|
+
return match(chain as LedgerSupportedChain)
|
|
62
|
+
.returnType<Promise<LedgerSignerMap[T]>>()
|
|
63
|
+
.with(Chain.THORChain, () =>
|
|
64
|
+
Promise.resolve(new THORChainLedger(derivationPath) as LedgerSignerMap[T]),
|
|
65
|
+
)
|
|
66
|
+
.with(Chain.Cosmos, () =>
|
|
67
|
+
Promise.resolve(new CosmosLedger(derivationPath) as LedgerSignerMap[T]),
|
|
68
|
+
)
|
|
69
|
+
.with(Chain.Bitcoin, () => Promise.resolve(BitcoinLedger(derivationPath) as LedgerSignerMap[T]))
|
|
70
|
+
.with(Chain.BitcoinCash, () =>
|
|
71
|
+
Promise.resolve(BitcoinCashLedger(derivationPath) as LedgerSignerMap[T]),
|
|
72
|
+
)
|
|
73
|
+
.with(Chain.Dash, () => Promise.resolve(DashLedger(derivationPath) as LedgerSignerMap[T]))
|
|
74
|
+
.with(Chain.Dogecoin, () =>
|
|
75
|
+
Promise.resolve(DogecoinLedger(derivationPath) as LedgerSignerMap[T]),
|
|
76
|
+
)
|
|
77
|
+
.with(Chain.Litecoin, () =>
|
|
78
|
+
Promise.resolve(LitecoinLedger(derivationPath) as LedgerSignerMap[T]),
|
|
79
|
+
)
|
|
80
|
+
.with(Chain.Ripple, () => Promise.resolve(XRPLedger(derivationPath) as LedgerSignerMap[T]))
|
|
81
|
+
.with(Chain.Near, async () => {
|
|
82
|
+
const transport = await getLedgerTransport();
|
|
83
|
+
return getNearLedgerClient(transport, derivationPath) as unknown as LedgerSignerMap[T];
|
|
84
|
+
})
|
|
85
|
+
.with(
|
|
86
|
+
Chain.Arbitrum,
|
|
87
|
+
Chain.Avalanche,
|
|
88
|
+
Chain.BinanceSmartChain,
|
|
89
|
+
Chain.Ethereum,
|
|
90
|
+
Chain.Optimism,
|
|
91
|
+
Chain.Polygon,
|
|
92
|
+
Chain.Base,
|
|
93
|
+
async () => {
|
|
94
|
+
const { getProvider } = await import("@swapkit/toolboxes/evm");
|
|
95
|
+
const params = { provider: await getProvider(chain as EVMChain), derivationPath };
|
|
91
96
|
|
|
92
|
-
|
|
97
|
+
return match(chain as Chain)
|
|
98
|
+
.with(
|
|
99
|
+
Chain.BinanceSmartChain,
|
|
100
|
+
() => BinanceSmartChainLedger(params) as LedgerSignerMap[T],
|
|
101
|
+
)
|
|
102
|
+
.with(Chain.Avalanche, () => AvalancheLedger(params) as LedgerSignerMap[T])
|
|
103
|
+
.with(Chain.Arbitrum, () => ArbitrumLedger(params) as LedgerSignerMap[T])
|
|
104
|
+
.with(Chain.Optimism, () => OptimismLedger(params) as LedgerSignerMap[T])
|
|
105
|
+
.with(Chain.Polygon, () => PolygonLedger(params) as LedgerSignerMap[T])
|
|
106
|
+
.with(Chain.Base, () => BaseLedger(params) as LedgerSignerMap[T])
|
|
107
|
+
.otherwise(() => EthereumLedger(params) as LedgerSignerMap[T]);
|
|
108
|
+
},
|
|
109
|
+
)
|
|
110
|
+
.otherwise(() => {
|
|
93
111
|
throw new SwapKitError("wallet_chain_not_supported", { wallet: WalletOption.LEDGER, chain });
|
|
94
|
-
|
|
112
|
+
});
|
|
95
113
|
};
|
|
@@ -20,7 +20,9 @@ const getLedgerDevices = async () => {
|
|
|
20
20
|
const existingDevices = devices.filter((d) => d.vendorId === ledgerUSBVendorId);
|
|
21
21
|
if (existingDevices.length > 0) return existingDevices[0];
|
|
22
22
|
|
|
23
|
-
return navigatorUsb?.requestDevice({
|
|
23
|
+
return navigatorUsb?.requestDevice({
|
|
24
|
+
filters: [{ vendorId: ledgerUSBVendorId }],
|
|
25
|
+
});
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
export const getLedgerTransport = async () => {
|
|
@@ -57,9 +59,9 @@ export const getLedgerTransport = async () => {
|
|
|
57
59
|
throw new SwapKitError("wallet_ledger_connection_claimed", error);
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
const
|
|
62
|
+
const Transport = (await import("@ledgerhq/hw-transport-webusb")).default;
|
|
61
63
|
const isSupported = await Transport.isSupported();
|
|
62
|
-
if (!isSupported) throw new
|
|
64
|
+
if (!isSupported) throw new SwapKitError("wallet_ledger_webusb_not_supported");
|
|
63
65
|
|
|
64
66
|
const { DisconnectedDevice } = await import("@ledgerhq/errors");
|
|
65
67
|
|
package/src/ledger/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type GenericTransferParams,
|
|
7
7
|
SKConfig,
|
|
8
8
|
StagenetChain,
|
|
9
|
+
SwapKitError,
|
|
9
10
|
WalletOption,
|
|
10
11
|
createWallet,
|
|
11
12
|
filterSupportedChains,
|
|
@@ -30,8 +31,10 @@ export const ledgerWallet = createWallet({
|
|
|
30
31
|
Chain.Dogecoin,
|
|
31
32
|
Chain.Ethereum,
|
|
32
33
|
Chain.Litecoin,
|
|
34
|
+
Chain.Near,
|
|
33
35
|
Chain.Optimism,
|
|
34
36
|
Chain.Polygon,
|
|
37
|
+
Chain.Ripple,
|
|
35
38
|
Chain.THORChain,
|
|
36
39
|
],
|
|
37
40
|
walletType: WalletOption.LEDGER,
|
|
@@ -148,7 +151,7 @@ async function getWalletMethods({
|
|
|
148
151
|
const address = await getLedgerAddress({ chain, ledgerClient: signer });
|
|
149
152
|
|
|
150
153
|
const transfer = async ({ assetValue, recipient, memo }: GenericTransferParams) => {
|
|
151
|
-
if (!assetValue) throw new
|
|
154
|
+
if (!assetValue) throw new SwapKitError("wallet_ledger_invalid_asset");
|
|
152
155
|
|
|
153
156
|
const sendCoinsMessage = {
|
|
154
157
|
amount: [
|
|
@@ -183,7 +186,7 @@ async function getWalletMethods({
|
|
|
183
186
|
case Chain.THORChain: {
|
|
184
187
|
const { SignMode } = await import("cosmjs-types/cosmos/tx/signing/v1beta1/signing.js");
|
|
185
188
|
const { TxRaw } = await import("cosmjs-types/cosmos/tx/v1beta1/tx.js");
|
|
186
|
-
const { encodePubkey, makeAuthInfoBytes } = await import("@cosmjs/proto-signing");
|
|
189
|
+
const { encodePubkey, makeAuthInfoBytes } = (await import("@cosmjs/proto-signing")).default;
|
|
187
190
|
const {
|
|
188
191
|
createStargateClient,
|
|
189
192
|
buildEncodedTxBody,
|
|
@@ -208,9 +211,9 @@ async function getWalletMethods({
|
|
|
208
211
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Refactor to reduce complexity
|
|
209
212
|
}: GenericTransferParams | ThorchainDepositParams) => {
|
|
210
213
|
const account = await toolbox.getAccount(address);
|
|
211
|
-
if (!account) throw new
|
|
212
|
-
if (!assetValue) throw new
|
|
213
|
-
if (!value) throw new
|
|
214
|
+
if (!account) throw new SwapKitError("wallet_ledger_invalid_account");
|
|
215
|
+
if (!assetValue) throw new SwapKitError("wallet_ledger_invalid_asset");
|
|
216
|
+
if (!value) throw new SwapKitError("wallet_ledger_pubkey_not_found");
|
|
214
217
|
|
|
215
218
|
const { accountNumber, sequence: sequenceNumber } = account;
|
|
216
219
|
const sequence = (sequenceNumber || 0).toString();
|
|
@@ -230,7 +233,7 @@ async function getWalletMethods({
|
|
|
230
233
|
});
|
|
231
234
|
|
|
232
235
|
const signatures = await signTransaction(rawSendTx, sequence);
|
|
233
|
-
if (!signatures) throw new
|
|
236
|
+
if (!signatures) throw new SwapKitError("wallet_ledger_signing_error");
|
|
234
237
|
|
|
235
238
|
const pubkey = encodePubkey({ type: "tendermint/PubKeySecp256k1", value });
|
|
236
239
|
const msgs = orderedMessages.map(parseAminoMessageForDirectSigning);
|
|
@@ -267,7 +270,25 @@ async function getWalletMethods({
|
|
|
267
270
|
return { ...toolbox, address, deposit, transfer, signMessage };
|
|
268
271
|
}
|
|
269
272
|
|
|
273
|
+
case Chain.Near: {
|
|
274
|
+
const { getNearToolbox } = await import("@swapkit/toolboxes/near");
|
|
275
|
+
const signer = await getLedgerClient({ chain, derivationPath });
|
|
276
|
+
const accountId = await signer.getAddress();
|
|
277
|
+
const toolbox = await getNearToolbox({ signer });
|
|
278
|
+
|
|
279
|
+
return { ...toolbox, address: accountId };
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
case Chain.Ripple: {
|
|
283
|
+
const { getRippleToolbox } = await import("@swapkit/toolboxes/ripple");
|
|
284
|
+
const signer = await getLedgerClient({ chain, derivationPath });
|
|
285
|
+
const address = signer.address;
|
|
286
|
+
const toolbox = await getRippleToolbox({ signer });
|
|
287
|
+
|
|
288
|
+
return { ...toolbox, address };
|
|
289
|
+
}
|
|
290
|
+
|
|
270
291
|
default:
|
|
271
|
-
throw new
|
|
292
|
+
throw new SwapKitError("wallet_ledger_chain_not_supported", { chain });
|
|
272
293
|
}
|
|
273
294
|
}
|
|
@@ -32,7 +32,7 @@ export abstract class CosmosLedgerInterface {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
case "cosmos": {
|
|
35
|
-
const
|
|
35
|
+
const CosmosApp = (await import("@ledgerhq/hw-app-cosmos")).default;
|
|
36
36
|
this.ledgerApp =
|
|
37
37
|
forceReconnect || !this.ledgerApp ? new CosmosApp(this.transport) : this.ledgerApp;
|
|
38
38
|
}
|
|
@@ -58,7 +58,6 @@ export abstract class CosmosLedgerInterface {
|
|
|
58
58
|
throw new SwapKitError("wallet_ledger_device_not_found");
|
|
59
59
|
|
|
60
60
|
default: {
|
|
61
|
-
console.error(`Ledger error: ${errorCode} ${message}`);
|
|
62
61
|
break;
|
|
63
62
|
}
|
|
64
63
|
}
|
package/src/okx/helpers.ts
CHANGED
|
@@ -3,16 +3,18 @@ import {
|
|
|
3
3
|
ChainId,
|
|
4
4
|
type EVMChain,
|
|
5
5
|
SKConfig,
|
|
6
|
+
SwapKitError,
|
|
6
7
|
prepareNetworkSwitch,
|
|
7
8
|
switchEVMWalletNetwork,
|
|
8
9
|
} from "@swapkit/helpers";
|
|
10
|
+
import { Psbt } from "bitcoinjs-lib";
|
|
9
11
|
import type { Eip1193Provider } from "ethers";
|
|
10
12
|
|
|
11
13
|
const cosmosTransfer =
|
|
12
14
|
() =>
|
|
13
15
|
async ({ from, recipient, amount, asset, memo }: any) => {
|
|
14
16
|
if (!(window.okxwallet && "keplr" in window.okxwallet)) {
|
|
15
|
-
throw new
|
|
17
|
+
throw new SwapKitError("wallet_okx_not_found", { chain: Chain.Cosmos });
|
|
16
18
|
}
|
|
17
19
|
const { createSigningStargateClient } = await import("@swapkit/toolboxes/cosmos");
|
|
18
20
|
|
|
@@ -38,7 +40,7 @@ async function getWeb3WalletMethods({
|
|
|
38
40
|
}: { walletProvider: Eip1193Provider | undefined; chain: EVMChain }) {
|
|
39
41
|
const { getEvmToolbox } = await import("@swapkit/toolboxes/evm");
|
|
40
42
|
const { BrowserProvider } = await import("ethers");
|
|
41
|
-
if (!walletProvider) throw new
|
|
43
|
+
if (!walletProvider) throw new SwapKitError("wallet_okx_not_found");
|
|
42
44
|
|
|
43
45
|
const provider = new BrowserProvider(walletProvider, "any");
|
|
44
46
|
const signer = await provider.getSigner();
|
|
@@ -49,7 +51,7 @@ async function getWeb3WalletMethods({
|
|
|
49
51
|
await switchEVMWalletNetwork(provider, chain, toolbox.getNetworkParams());
|
|
50
52
|
}
|
|
51
53
|
} catch (_error) {
|
|
52
|
-
throw new
|
|
54
|
+
throw new SwapKitError("wallet_okx_failed_to_switch_network", { chain });
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
return prepareNetworkSwitch({ toolbox, provider, chain });
|
|
@@ -65,7 +67,7 @@ export async function getWalletMethods(chain: Chain) {
|
|
|
65
67
|
case Chain.Polygon:
|
|
66
68
|
case Chain.BinanceSmartChain: {
|
|
67
69
|
if (!(window.okxwallet && "send" in window.okxwallet)) {
|
|
68
|
-
throw new
|
|
70
|
+
throw new SwapKitError("wallet_okx_not_found", { chain });
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
const evmWallet = await getWeb3WalletMethods({
|
|
@@ -79,9 +81,9 @@ export async function getWalletMethods(chain: Chain) {
|
|
|
79
81
|
|
|
80
82
|
case Chain.Bitcoin: {
|
|
81
83
|
if (!(window.okxwallet && "bitcoin" in window.okxwallet)) {
|
|
82
|
-
throw new
|
|
84
|
+
throw new SwapKitError("wallet_okx_not_found", { chain: Chain.Bitcoin });
|
|
83
85
|
}
|
|
84
|
-
|
|
86
|
+
|
|
85
87
|
const { getUtxoToolbox } = await import("@swapkit/toolboxes/utxo");
|
|
86
88
|
|
|
87
89
|
const { bitcoin: wallet } = window.okxwallet;
|
|
@@ -106,13 +108,13 @@ export async function getWalletMethods(chain: Chain) {
|
|
|
106
108
|
|
|
107
109
|
case Chain.Cosmos: {
|
|
108
110
|
if (!(window.okxwallet && "keplr" in window.okxwallet)) {
|
|
109
|
-
throw new
|
|
111
|
+
throw new SwapKitError("wallet_okx_not_found", { chain: Chain.Cosmos });
|
|
110
112
|
}
|
|
111
113
|
const { keplr: wallet } = window.okxwallet;
|
|
112
114
|
|
|
113
115
|
await wallet.enable(ChainId.Cosmos);
|
|
114
116
|
const accounts = await wallet.getOfflineSignerOnlyAmino(ChainId.Cosmos).getAccounts();
|
|
115
|
-
if (!accounts?.[0]) throw new
|
|
117
|
+
if (!accounts?.[0]) throw new SwapKitError("wallet_okx_no_accounts", { chain: Chain.Cosmos });
|
|
116
118
|
|
|
117
119
|
const { getCosmosToolbox } = await import("@swapkit/toolboxes/cosmos");
|
|
118
120
|
const [{ address }] = accounts;
|
|
@@ -121,7 +123,23 @@ export async function getWalletMethods(chain: Chain) {
|
|
|
121
123
|
return { ...toolbox, address, transfer: cosmosTransfer() };
|
|
122
124
|
}
|
|
123
125
|
|
|
126
|
+
case Chain.Near: {
|
|
127
|
+
if (!(window.okxwallet && "near" in window.okxwallet)) {
|
|
128
|
+
throw new SwapKitError("wallet_okx_not_found", { chain: Chain.Near });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const { createNearSignerFromProvider } = await import("../helpers/near");
|
|
132
|
+
const { getNearToolbox } = await import("@swapkit/toolboxes/near");
|
|
133
|
+
|
|
134
|
+
const provider = window.okxwallet.near;
|
|
135
|
+
const signer = await createNearSignerFromProvider(provider, "OKX");
|
|
136
|
+
const accountId = await signer.getAddress();
|
|
137
|
+
const toolbox = await getNearToolbox({ signer });
|
|
138
|
+
|
|
139
|
+
return { ...toolbox, address: accountId };
|
|
140
|
+
}
|
|
141
|
+
|
|
124
142
|
default:
|
|
125
|
-
throw new
|
|
143
|
+
throw new SwapKitError("wallet_okx_chain_not_supported", { chain });
|
|
126
144
|
}
|
|
127
145
|
}
|
package/src/okx/index.ts
CHANGED
package/src/onekey/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
filterSupportedChains,
|
|
10
10
|
prepareNetworkSwitch,
|
|
11
11
|
} from "@swapkit/helpers";
|
|
12
|
+
import { Psbt } from "bitcoinjs-lib";
|
|
12
13
|
import type {
|
|
13
14
|
BitcoinProvider,
|
|
14
15
|
GetAddressOptions,
|
|
@@ -21,13 +22,9 @@ async function getWalletMethodsForExtension(chain: Chain) {
|
|
|
21
22
|
switch (chain) {
|
|
22
23
|
case Chain.Bitcoin: {
|
|
23
24
|
if (!window.$onekey?.btc) {
|
|
24
|
-
throw new SwapKitError({
|
|
25
|
-
errorKey: "wallet_onekey_not_found",
|
|
26
|
-
info: { chain },
|
|
27
|
-
});
|
|
25
|
+
throw new SwapKitError({ errorKey: "wallet_onekey_not_found", info: { chain } });
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
const { Psbt } = await import("bitcoinjs-lib");
|
|
31
28
|
const { getUtxoToolbox } = await import("@swapkit/toolboxes/utxo");
|
|
32
29
|
const {
|
|
33
30
|
signTransaction: satsSignTransaction,
|
|
@@ -38,8 +35,7 @@ async function getWalletMethodsForExtension(chain: Chain) {
|
|
|
38
35
|
|
|
39
36
|
let address = "";
|
|
40
37
|
|
|
41
|
-
const getProvider
|
|
42
|
-
new Promise((res) => res(window.$onekey?.btc as BitcoinProvider));
|
|
38
|
+
const getProvider = () => new Promise<BitcoinProvider>((res) => res(window.$onekey?.btc));
|
|
43
39
|
|
|
44
40
|
const getAddressOptions: GetAddressOptions = {
|
|
45
41
|
getProvider,
|
package/src/radix/index.ts
CHANGED
|
@@ -162,13 +162,13 @@ async function getWalletMethods() {
|
|
|
162
162
|
const res = await rdt.walletApi.sendRequest();
|
|
163
163
|
|
|
164
164
|
if (!res) {
|
|
165
|
-
throw new
|
|
165
|
+
throw new SwapKitError("wallet_radix_no_account");
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
const newAddress = res.unwrapOr(null)?.accounts[0]?.address;
|
|
169
169
|
|
|
170
170
|
if (!newAddress) {
|
|
171
|
-
throw new
|
|
171
|
+
throw new SwapKitError("wallet_radix_no_account");
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
return newAddress;
|
|
@@ -182,7 +182,7 @@ async function getWalletMethods() {
|
|
|
182
182
|
getAddress,
|
|
183
183
|
getBalance: () => getBalance(address),
|
|
184
184
|
transfer: (_params: { assetValue: AssetValue; recipient: string; from: string }) => {
|
|
185
|
-
throw new
|
|
185
|
+
throw new SwapKitError("wallet_radix_method_not_supported", { method: "transfer" });
|
|
186
186
|
},
|
|
187
187
|
signAndBroadcast: async ({ manifest, message }: { manifest: string; message: string }) => {
|
|
188
188
|
const tx = await rdt.walletApi.sendTransaction({
|
|
@@ -193,7 +193,7 @@ async function getWalletMethods() {
|
|
|
193
193
|
const txResult = tx.unwrapOr(null)?.transactionIntentHash;
|
|
194
194
|
|
|
195
195
|
if (!txResult) {
|
|
196
|
-
throw new
|
|
196
|
+
throw new SwapKitError("wallet_radix_transaction_failed");
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
return txResult;
|
package/src/trezor/evmSigner.ts
CHANGED
|
@@ -35,7 +35,7 @@ export async function getEVMSigner({ chain, derivationPath, provider }: TrezorEV
|
|
|
35
35
|
|
|
36
36
|
getAddress = async () => {
|
|
37
37
|
if (!this.address) {
|
|
38
|
-
const
|
|
38
|
+
const TrezorConnect = (await import("@trezor/connect-web")).default;
|
|
39
39
|
|
|
40
40
|
const result = await TrezorConnect.ethereumGetAddress({
|
|
41
41
|
path: derivationPathToString(this.derivationPath),
|
|
@@ -56,7 +56,7 @@ export async function getEVMSigner({ chain, derivationPath, provider }: TrezorEV
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
signMessage = async (message: string) => {
|
|
59
|
-
const
|
|
59
|
+
const TrezorConnect = (await import("@trezor/connect-web")).default;
|
|
60
60
|
|
|
61
61
|
const result = await TrezorConnect.ethereumSignMessage({
|
|
62
62
|
path: derivationPathToString(this.derivationPath),
|
|
@@ -74,7 +74,7 @@ export async function getEVMSigner({ chain, derivationPath, provider }: TrezorEV
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
signTypedData(): Promise<string> {
|
|
77
|
-
throw new
|
|
77
|
+
throw new SwapKitError("wallet_trezor_method_not_supported", { method: "signTypedData" });
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
signTransaction = async ({
|
|
@@ -107,7 +107,7 @@ export async function getEVMSigner({ chain, derivationPath, provider }: TrezorEV
|
|
|
107
107
|
throw new SwapKitError({ errorKey: "wallet_missing_params", info: { gasPrice } });
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
const
|
|
110
|
+
const TrezorConnect = (await import("@trezor/connect-web")).default;
|
|
111
111
|
const { toHexString } = await import("@swapkit/toolboxes/evm");
|
|
112
112
|
const { Transaction } = await import("ethers");
|
|
113
113
|
|
package/src/trezor/index.ts
CHANGED
|
@@ -68,7 +68,7 @@ async function getTrezorWallet<T extends Chain>({
|
|
|
68
68
|
const coin = chain.toLowerCase();
|
|
69
69
|
|
|
70
70
|
const getAddress = async (path: DerivationPathArray = derivationPath) => {
|
|
71
|
-
const
|
|
71
|
+
const TrezorConnect = (await import("@trezor/connect-web")).default;
|
|
72
72
|
const { success, payload } = await TrezorConnect.getAddress({
|
|
73
73
|
path: derivationPathToString(path),
|
|
74
74
|
coin,
|
|
@@ -95,7 +95,7 @@ async function getTrezorWallet<T extends Chain>({
|
|
|
95
95
|
const address = await getAddress();
|
|
96
96
|
|
|
97
97
|
const signTransaction = async (psbt: Psbt, inputs: UTXOType[], memo = "") => {
|
|
98
|
-
const
|
|
98
|
+
const TrezorConnect = (await import("@trezor/connect-web")).default;
|
|
99
99
|
const address_n = derivationPath.map((pathElement, index) =>
|
|
100
100
|
index < 3 ? ((pathElement as number) | 0x80000000) >>> 0 : (pathElement as number),
|
|
101
101
|
);
|
|
@@ -229,11 +229,21 @@ export const trezorWallet = createWallet({
|
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
const
|
|
232
|
+
const TrezorConnect = (await import("@trezor/connect-web")).default;
|
|
233
233
|
const { success } = await TrezorConnect.getDeviceState();
|
|
234
234
|
|
|
235
235
|
if (!success) {
|
|
236
|
-
const
|
|
236
|
+
const trezorConfig = SKConfig.get("integrations").trezor;
|
|
237
|
+
const manifest = trezorConfig
|
|
238
|
+
? {
|
|
239
|
+
...trezorConfig,
|
|
240
|
+
appName: (trezorConfig as any).appName || "SwapKit",
|
|
241
|
+
}
|
|
242
|
+
: {
|
|
243
|
+
appUrl: "",
|
|
244
|
+
email: "",
|
|
245
|
+
appName: "SwapKit",
|
|
246
|
+
};
|
|
237
247
|
TrezorConnect.init({ lazyLoad: true, manifest });
|
|
238
248
|
}
|
|
239
249
|
|
package/src/types.ts
CHANGED
|
@@ -12,9 +12,11 @@ import type { BrowserProvider, Eip1193Provider } from "ethers";
|
|
|
12
12
|
import type { SubstrateInjectedExtension } from "@swapkit/toolboxes/substrate";
|
|
13
13
|
import type { bitgetWallet } from "./bitget";
|
|
14
14
|
import type { coinbaseWallet } from "./coinbase";
|
|
15
|
+
import type { cosmostationWallet } from "./cosmostation";
|
|
15
16
|
import type { ctrlWallet } from "./ctrl";
|
|
16
17
|
import type { evmWallet } from "./evm-extensions";
|
|
17
18
|
import type { exodusWallet } from "./exodus";
|
|
19
|
+
import type { NearBrowserWalletProvider } from "./helpers/near";
|
|
18
20
|
import type { keepkeyWallet } from "./keepkey";
|
|
19
21
|
import type { keepkeyBexWallet } from "./keepkey-bex";
|
|
20
22
|
import type { keplrWallet } from "./keplr";
|
|
@@ -34,6 +36,7 @@ export type SKWallets = {
|
|
|
34
36
|
[WalletOption.BRAVE]: typeof evmWallet;
|
|
35
37
|
[WalletOption.COINBASE_MOBILE]: typeof coinbaseWallet;
|
|
36
38
|
[WalletOption.COINBASE_WEB]: typeof evmWallet;
|
|
39
|
+
[WalletOption.COSMOSTATION]: typeof cosmostationWallet;
|
|
37
40
|
[WalletOption.CTRL]: typeof ctrlWallet;
|
|
38
41
|
[WalletOption.EIP6963]: typeof evmWallet;
|
|
39
42
|
[WalletOption.EXODUS]: typeof exodusWallet;
|
|
@@ -64,6 +67,7 @@ export type SKWalletsSupportedChains = {
|
|
|
64
67
|
[WalletOption.BRAVE]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
65
68
|
[WalletOption.COINBASE_MOBILE]: typeof coinbaseWallet.connectCoinbaseWallet.supportedChains;
|
|
66
69
|
[WalletOption.COINBASE_WEB]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
70
|
+
[WalletOption.COSMOSTATION]: typeof cosmostationWallet.connectCosmostation.supportedChains;
|
|
67
71
|
[WalletOption.CTRL]: typeof ctrlWallet.connectCtrl.supportedChains;
|
|
68
72
|
[WalletOption.EIP6963]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
69
73
|
[WalletOption.EXODUS]: typeof exodusWallet.connectExodusWallet.supportedChains;
|
|
@@ -119,6 +123,7 @@ declare global {
|
|
|
119
123
|
thorchain: Eip1193Provider;
|
|
120
124
|
mayachain: Eip1193Provider;
|
|
121
125
|
solana: SolanaProvider & { isXDEFI: boolean };
|
|
126
|
+
near: NearBrowserWalletProvider;
|
|
122
127
|
};
|
|
123
128
|
|
|
124
129
|
bitkeep?: {
|
|
@@ -193,6 +198,15 @@ declare global {
|
|
|
193
198
|
) => Promise<boolean>;
|
|
194
199
|
getOfflineSignerOnlyAmino: (chainId: string) => OfflineAminoSigner;
|
|
195
200
|
};
|
|
201
|
+
near: NearBrowserWalletProvider & {
|
|
202
|
+
requestSignIn: (params?: {
|
|
203
|
+
contractId?: string;
|
|
204
|
+
methodNames?: string[];
|
|
205
|
+
}) => Promise<{ accountId: string; accessKey?: any }>;
|
|
206
|
+
requestSignTransactions: (params: {
|
|
207
|
+
transactions: any[];
|
|
208
|
+
}) => Promise<any>;
|
|
209
|
+
};
|
|
196
210
|
}
|
|
197
211
|
| EthereumWindowProvider;
|
|
198
212
|
}
|
package/src/utils.ts
CHANGED
|
@@ -25,6 +25,10 @@ export async function loadWallet<W extends WalletOption>(walletOption: W): Promi
|
|
|
25
25
|
async () => (await import("./walletconnect")).walletconnectWallet,
|
|
26
26
|
)
|
|
27
27
|
.with(WalletOption.KEPLR, WalletOption.LEAP, async () => (await import("./keplr")).keplrWallet)
|
|
28
|
+
.with(
|
|
29
|
+
WalletOption.COSMOSTATION,
|
|
30
|
+
async () => (await import("./cosmostation")).cosmostationWallet,
|
|
31
|
+
)
|
|
28
32
|
.with(
|
|
29
33
|
WalletOption.BRAVE,
|
|
30
34
|
WalletOption.COINBASE_WEB,
|
|
@@ -13,6 +13,8 @@ export const ARBITRUM_ONE_MAINNET_ID = "eip155:42161";
|
|
|
13
13
|
export const OPTIMISM_MAINNET_ID = "eip155:10";
|
|
14
14
|
export const POLYGON_MAINNET_ID = "eip155:137";
|
|
15
15
|
export const BASE_MAINNET_ID = "eip155:8453";
|
|
16
|
+
export const NEAR_MAINNET_ID = "near:mainnet";
|
|
17
|
+
export const NEAR_TESTNET_ID = "near:testnet";
|
|
16
18
|
|
|
17
19
|
export const DEFAULT_LOGGER = "debug";
|
|
18
20
|
|
|
@@ -33,7 +33,7 @@ class WalletconnectSigner extends AbstractSigner {
|
|
|
33
33
|
throw new SwapKitError("wallet_walletconnect_connection_not_established");
|
|
34
34
|
}
|
|
35
35
|
if (!this.address) {
|
|
36
|
-
this.address = getAddressByChain(this.chain, this.walletconnect.accounts);
|
|
36
|
+
this.address = getAddressByChain(this.chain, this.walletconnect.accounts || []);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
return this.address;
|
|
@@ -43,7 +43,7 @@ class WalletconnectSigner extends AbstractSigner {
|
|
|
43
43
|
// this is probably broken
|
|
44
44
|
const txHash = (await this.walletconnect?.client.request({
|
|
45
45
|
chainId: chainToChainId(this.chain),
|
|
46
|
-
topic: this.walletconnect.session.topic,
|
|
46
|
+
topic: this.walletconnect.session.topic || "",
|
|
47
47
|
request: {
|
|
48
48
|
method: DEFAULT_EIP155_METHODS.ETH_SIGN,
|
|
49
49
|
params: [message],
|
|
@@ -54,7 +54,9 @@ class WalletconnectSigner extends AbstractSigner {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
signTransaction = () => {
|
|
57
|
-
throw new
|
|
57
|
+
throw new SwapKitError("wallet_walletconnect_method_not_supported", {
|
|
58
|
+
method: "signTransaction",
|
|
59
|
+
});
|
|
58
60
|
|
|
59
61
|
// const baseTx = {
|
|
60
62
|
// from,
|
|
@@ -77,7 +79,9 @@ class WalletconnectSigner extends AbstractSigner {
|
|
|
77
79
|
|
|
78
80
|
// ANCHOR (@Towan) - Implement in future
|
|
79
81
|
signTypedData = () => {
|
|
80
|
-
throw new
|
|
82
|
+
throw new SwapKitError("wallet_walletconnect_method_not_supported", {
|
|
83
|
+
method: "signTypedData",
|
|
84
|
+
});
|
|
81
85
|
|
|
82
86
|
// const { toHexString } = await import('@swapkit/toolboxes/evm');
|
|
83
87
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Chain, type EVMChain } from "@swapkit/helpers";
|
|
1
|
+
import { Chain, type EVMChain, SKConfig } from "@swapkit/helpers";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
ARBITRUM_ONE_MAINNET_ID,
|
|
@@ -9,13 +9,15 @@ import {
|
|
|
9
9
|
ETHEREUM_MAINNET_ID,
|
|
10
10
|
KUJIRA_MAINNET_ID,
|
|
11
11
|
MAYACHAIN_MAINNET_ID,
|
|
12
|
+
NEAR_MAINNET_ID,
|
|
13
|
+
NEAR_TESTNET_ID,
|
|
12
14
|
OPTIMISM_MAINNET_ID,
|
|
13
15
|
POLYGON_MAINNET_ID,
|
|
14
16
|
THORCHAIN_MAINNET_ID,
|
|
15
17
|
} from "./constants";
|
|
16
18
|
|
|
17
19
|
export const getAddressByChain = (
|
|
18
|
-
chain: EVMChain | Chain.THORChain | Chain.Maya | Chain.Kujira | Chain.Cosmos,
|
|
20
|
+
chain: EVMChain | Chain.THORChain | Chain.Maya | Chain.Kujira | Chain.Cosmos | Chain.Near,
|
|
19
21
|
accounts: string[],
|
|
20
22
|
) => {
|
|
21
23
|
const account = accounts.find((account) => account.startsWith(chainToChainId(chain))) || "";
|
|
@@ -48,6 +50,11 @@ export const chainToChainId = (chain: Chain) => {
|
|
|
48
50
|
return COSMOS_HUB_MAINNET_ID;
|
|
49
51
|
case Chain.Kujira:
|
|
50
52
|
return KUJIRA_MAINNET_ID;
|
|
53
|
+
case Chain.Near: {
|
|
54
|
+
// Use testnet if stagenet is enabled
|
|
55
|
+
const { isStagenet } = SKConfig.get("envs");
|
|
56
|
+
return isStagenet ? NEAR_TESTNET_ID : NEAR_MAINNET_ID;
|
|
57
|
+
}
|
|
51
58
|
default:
|
|
52
59
|
return "";
|
|
53
60
|
}
|