@swapkit/wallets 4.3.10 → 4.6.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/dist/LICENSE +246 -0
- package/dist/chunk-1m30h0t9.js +4 -0
- package/dist/{chunk-vb4wtm2w.js.map → chunk-1m30h0t9.js.map} +1 -1
- package/dist/chunk-5jj4jvy9.js +5 -0
- package/dist/{chunk-78m70510.js.map → chunk-5jj4jvy9.js.map} +1 -1
- package/dist/chunk-ae6bkfs5.js +3 -0
- package/dist/chunk-ae6bkfs5.js.map +9 -0
- package/dist/chunk-dx5r3mz1.js +5 -0
- package/dist/chunk-dx5r3mz1.js.map +10 -0
- package/dist/chunk-ewwx4745.js +4 -0
- package/dist/chunk-ewwx4745.js.map +9 -0
- package/dist/chunk-qv7snmdv.js +5 -0
- package/dist/chunk-qv7snmdv.js.map +10 -0
- package/dist/chunk-ttryb513.js +4 -0
- package/dist/chunk-ttryb513.js.map +10 -0
- package/dist/chunk-zrqsb6ng.js +4 -0
- package/dist/chunk-zrqsb6ng.js.map +10 -0
- package/dist/src/coinbase/index.cjs +2 -2
- package/dist/src/coinbase/index.cjs.map +4 -4
- package/dist/src/coinbase/index.js +2 -2
- package/dist/src/coinbase/index.js.map +4 -4
- package/dist/src/index.cjs +2 -2
- package/dist/src/index.cjs.map +4 -5
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +4 -5
- package/dist/src/keystore.cjs +2 -2
- package/dist/src/keystore.cjs.map +5 -4
- package/dist/src/keystore.js +2 -2
- package/dist/src/keystore.js.map +5 -4
- package/dist/src/near-wallet-selector/index.cjs +2 -2
- package/dist/src/near-wallet-selector/index.cjs.map +3 -3
- package/dist/src/near-wallet-selector/index.js +2 -2
- package/dist/src/near-wallet-selector/index.js.map +3 -3
- package/dist/src/passkeys/index.cjs +2 -2
- package/dist/src/passkeys/index.cjs.map +3 -3
- package/dist/src/passkeys/index.js +2 -2
- package/dist/src/passkeys/index.js.map +3 -3
- 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/walletconnect/index.cjs +2 -2
- package/dist/src/walletconnect/index.cjs.map +4 -4
- package/dist/src/walletconnect/index.js +2 -2
- package/dist/src/walletconnect/index.js.map +4 -4
- package/dist/src/xaman/index.cjs +2 -2
- package/dist/src/xaman/index.cjs.map +5 -5
- package/dist/src/xaman/index.js +2 -2
- package/dist/src/xaman/index.js.map +5 -5
- package/dist/types/coinbase/signer.d.ts +58 -23
- package/dist/types/coinbase/signer.d.ts.map +1 -1
- package/dist/types/core.d.ts +18 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/keystore-helpers.d.ts +42 -0
- package/dist/types/keystore-helpers.d.ts.map +1 -0
- package/dist/types/keystore.d.ts +66 -1
- package/dist/types/keystore.d.ts.map +1 -1
- package/dist/types/passkeys/index.d.ts +2 -2
- package/dist/types/passkeys/index.d.ts.map +1 -1
- package/dist/types/radix/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +6 -4
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/walletconnect/constants.d.ts +2 -1
- package/dist/types/walletconnect/constants.d.ts.map +1 -1
- package/dist/types/walletconnect/evmSigner.d.ts +2 -2
- package/dist/types/walletconnect/evmSigner.d.ts.map +1 -1
- package/dist/types/walletconnect/index.d.ts +2 -2
- package/dist/types/walletconnect/index.d.ts.map +1 -1
- package/dist/types/xaman/helpers.d.ts +22 -20
- package/dist/types/xaman/helpers.d.ts.map +1 -1
- package/dist/types/xaman/index.d.ts +1 -1
- package/dist/types/xaman/index.d.ts.map +1 -1
- package/dist/types/xaman/types.d.ts +8 -0
- package/dist/types/xaman/types.d.ts.map +1 -1
- package/dist/types/xaman/walletMethods.d.ts +14 -2
- package/dist/types/xaman/walletMethods.d.ts.map +1 -1
- package/package.json +26 -16
- package/dist/chunk-78m70510.js +0 -5
- package/dist/chunk-7jmqkkhs.js +0 -4
- package/dist/chunk-7jmqkkhs.js.map +0 -10
- package/dist/chunk-9acqzpjy.js +0 -5
- package/dist/chunk-9acqzpjy.js.map +0 -10
- package/dist/chunk-vb4wtm2w.js +0 -4
- package/src/bitget.ts +0 -1
- package/src/coinbase/index.ts +0 -44
- package/src/coinbase/signer.ts +0 -77
- package/src/cosmostation.ts +0 -1
- package/src/ctrl.ts +0 -1
- package/src/evm-extensions.ts +0 -1
- package/src/index.ts +0 -3
- package/src/keepkey-bex.ts +0 -1
- package/src/keepkey.ts +0 -1
- package/src/keplr.ts +0 -1
- package/src/keystore.ts +0 -1
- package/src/ledger.ts +0 -1
- package/src/near-wallet-selector/index.ts +0 -115
- package/src/okx.ts +0 -1
- package/src/onekey.ts +0 -1
- package/src/passkeys/index.ts +0 -183
- package/src/phantom.ts +0 -1
- package/src/polkadotjs.ts +0 -1
- package/src/radix/index.ts +0 -194
- package/src/talisman.ts +0 -1
- package/src/trezor.ts +0 -1
- package/src/tronlink.ts +0 -1
- package/src/types.ts +0 -94
- package/src/utils.ts +0 -59
- package/src/vultisig.ts +0 -1
- package/src/walletconnect/constants.ts +0 -103
- package/src/walletconnect/evmSigner.ts +0 -125
- package/src/walletconnect/helpers.ts +0 -73
- package/src/walletconnect/index.ts +0 -392
- package/src/walletconnect/namespaces.ts +0 -80
- package/src/walletconnect/types.ts +0 -6
- package/src/xaman/helpers.ts +0 -54
- package/src/xaman/index.ts +0 -62
- package/src/xaman/types.ts +0 -26
- package/src/xaman/walletMethods.ts +0 -110
package/src/radix/index.ts
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
FungibleResourcesCollectionItem,
|
|
3
|
-
GatewayApiClient,
|
|
4
|
-
StateEntityDetailsVaultResponseItem,
|
|
5
|
-
StateEntityFungiblesPageRequest,
|
|
6
|
-
StateEntityFungiblesPageResponse,
|
|
7
|
-
} from "@radixdlt/babylon-gateway-api-sdk";
|
|
8
|
-
import { AssetValue, Chain, filterSupportedChains, SKConfig, SwapKitError, WalletOption } from "@swapkit/helpers";
|
|
9
|
-
import { createWallet, getWalletSupportedChains } from "@swapkit/wallet-core";
|
|
10
|
-
|
|
11
|
-
export const radixWallet = createWallet({
|
|
12
|
-
connect: ({ addChain, supportedChains, walletType }) =>
|
|
13
|
-
async function connectRadixWallet(chains: Chain[]) {
|
|
14
|
-
const filteredChains = filterSupportedChains({ chains, supportedChains, walletType });
|
|
15
|
-
const radixConfig = SKConfig.get("integrations").radix;
|
|
16
|
-
|
|
17
|
-
if (!radixConfig) {
|
|
18
|
-
throw new SwapKitError("wallet_radix_not_found");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
await Promise.all(
|
|
22
|
-
filteredChains.map(async (chain) => {
|
|
23
|
-
const walletMethods = await getWalletMethods();
|
|
24
|
-
|
|
25
|
-
addChain({ ...walletMethods, chain, walletType });
|
|
26
|
-
}),
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
return true;
|
|
30
|
-
},
|
|
31
|
-
name: "connectRadixWallet",
|
|
32
|
-
supportedChains: [Chain.Radix],
|
|
33
|
-
walletType: WalletOption.RADIX_WALLET,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
export const RADIX_SUPPORTED_CHAINS = getWalletSupportedChains(radixWallet);
|
|
37
|
-
|
|
38
|
-
async function fetchFungibleResources(address: string): Promise<FungibleResourcesCollectionItem[]> {
|
|
39
|
-
const { GatewayApiClient } = await import("@radixdlt/babylon-gateway-api-sdk");
|
|
40
|
-
const { applicationName } = SKConfig.get("integrations").radix;
|
|
41
|
-
const networkApi = GatewayApiClient.initialize({ applicationName, networkId: 1 });
|
|
42
|
-
|
|
43
|
-
let hasNextPage = true;
|
|
44
|
-
let nextCursor: string | undefined;
|
|
45
|
-
let fungibleResources: FungibleResourcesCollectionItem[] = [];
|
|
46
|
-
|
|
47
|
-
const stateVersion = await currentStateVersion(networkApi);
|
|
48
|
-
|
|
49
|
-
while (hasNextPage) {
|
|
50
|
-
const stateEntityFungiblesPageRequest: StateEntityFungiblesPageRequest = {
|
|
51
|
-
address: address,
|
|
52
|
-
at_ledger_state: { state_version: stateVersion },
|
|
53
|
-
cursor: nextCursor,
|
|
54
|
-
limit_per_page: 100,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const stateEntityFungiblesPageResponse: StateEntityFungiblesPageResponse =
|
|
58
|
-
await networkApi.state.innerClient.entityFungiblesPage({
|
|
59
|
-
stateEntityFungiblesPageRequest: stateEntityFungiblesPageRequest,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
fungibleResources = fungibleResources.concat(stateEntityFungiblesPageResponse.items);
|
|
63
|
-
|
|
64
|
-
if (stateEntityFungiblesPageResponse.next_cursor) {
|
|
65
|
-
nextCursor = stateEntityFungiblesPageResponse.next_cursor;
|
|
66
|
-
} else {
|
|
67
|
-
hasNextPage = false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return fungibleResources;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function currentStateVersion(networkApi: GatewayApiClient) {
|
|
74
|
-
return networkApi.status.getCurrent().then((status) => status.ledger_state.state_version);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// TODO - @Towan: is that still needed with SwapKitApi.getChainBalance()?
|
|
78
|
-
async function getBalance(address: string): Promise<AssetValue[]> {
|
|
79
|
-
const { GatewayApiClient } = await import("@radixdlt/babylon-gateway-api-sdk");
|
|
80
|
-
const resources = await fetchFungibleResources(address);
|
|
81
|
-
const { applicationName } = SKConfig.get("integrations").radix;
|
|
82
|
-
const networkApi = GatewayApiClient.initialize({ applicationName, networkId: 1 });
|
|
83
|
-
|
|
84
|
-
const balances: AssetValue[] = [];
|
|
85
|
-
const BATCH_SIZE = 50;
|
|
86
|
-
|
|
87
|
-
// Split resources into batches of up to 50 items
|
|
88
|
-
const resourceBatches: FungibleResourcesCollectionItem[][] = [];
|
|
89
|
-
for (let i = 0; i < resources.length; i += BATCH_SIZE) {
|
|
90
|
-
resourceBatches.push(resources.slice(i, i + BATCH_SIZE));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
for (const batch of resourceBatches) {
|
|
94
|
-
const addresses = batch.map((item) => item.resource_address);
|
|
95
|
-
const response: StateEntityDetailsVaultResponseItem[] =
|
|
96
|
-
await networkApi.state.getEntityDetailsVaultAggregated(addresses);
|
|
97
|
-
|
|
98
|
-
const divisibilities = new Map<string, { decimals: number; symbol: string }>();
|
|
99
|
-
|
|
100
|
-
for (const result of response) {
|
|
101
|
-
if (result.details !== undefined) {
|
|
102
|
-
const metaDataSymbol = result.metadata?.items.find((item) => item.key === "symbol");
|
|
103
|
-
const symbol = metaDataSymbol?.value.typed.type === "String" ? metaDataSymbol.value.typed.value : "?";
|
|
104
|
-
|
|
105
|
-
if (result.details.type === "FungibleResource") {
|
|
106
|
-
divisibilities.set(result.address, { decimals: result.details.divisibility, symbol });
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
for (const item of batch) {
|
|
112
|
-
if (item.aggregation_level === "Global") {
|
|
113
|
-
const assetInfo = divisibilities.get(item.resource_address) || { decimals: 0, symbol: "?" };
|
|
114
|
-
|
|
115
|
-
const balance = AssetValue.from({
|
|
116
|
-
asset:
|
|
117
|
-
assetInfo.symbol !== Chain.Radix
|
|
118
|
-
? `${Chain.Radix}.${assetInfo.symbol}-${item.resource_address}`
|
|
119
|
-
: "XRD.XRD",
|
|
120
|
-
value: item.amount,
|
|
121
|
-
});
|
|
122
|
-
balances.push(balance);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const hasNativeAsset = balances.some((asset) => asset.isGasAsset);
|
|
128
|
-
if (!hasNativeAsset) {
|
|
129
|
-
return [AssetValue.from({ chain: Chain.Radix }), ...balances];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return balances;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
async function getWalletMethods() {
|
|
136
|
-
const { RadixDappToolkit } = await import("@radixdlt/radix-dapp-toolkit");
|
|
137
|
-
const dappConfig = SKConfig.get("integrations").radix;
|
|
138
|
-
const rdt = RadixDappToolkit({ ...dappConfig, networkId: dappConfig.network.networkId });
|
|
139
|
-
|
|
140
|
-
function delay(ms: number) {
|
|
141
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// TODO: @Towan - Wat is dat?
|
|
145
|
-
await delay(400);
|
|
146
|
-
|
|
147
|
-
function getAddress() {
|
|
148
|
-
const existingWalletData = rdt.walletApi.getWalletData();
|
|
149
|
-
const account = existingWalletData?.accounts?.[0];
|
|
150
|
-
|
|
151
|
-
return account?.address;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const getNewAddress = async () => {
|
|
155
|
-
const { DataRequestBuilder } = await import("@radixdlt/radix-dapp-toolkit");
|
|
156
|
-
rdt.walletApi.setRequestData(DataRequestBuilder.accounts().exactly(1));
|
|
157
|
-
const res = await rdt.walletApi.sendRequest();
|
|
158
|
-
|
|
159
|
-
if (!res) {
|
|
160
|
-
throw new SwapKitError("wallet_radix_no_account");
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const newAddress = res.unwrapOr(null)?.accounts[0]?.address;
|
|
164
|
-
|
|
165
|
-
if (!newAddress) {
|
|
166
|
-
throw new SwapKitError("wallet_radix_no_account");
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return newAddress;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const address = getAddress() || (await getNewAddress());
|
|
173
|
-
|
|
174
|
-
return {
|
|
175
|
-
address,
|
|
176
|
-
getAddress,
|
|
177
|
-
getBalance: () => getBalance(address),
|
|
178
|
-
radixDappToolkit: rdt,
|
|
179
|
-
signAndBroadcast: async ({ manifest, message }: { manifest: string; message: string }) => {
|
|
180
|
-
const tx = await rdt.walletApi.sendTransaction({ message, transactionManifest: manifest });
|
|
181
|
-
|
|
182
|
-
const txResult = tx.unwrapOr(null)?.transactionIntentHash;
|
|
183
|
-
|
|
184
|
-
if (!txResult) {
|
|
185
|
-
throw new SwapKitError("wallet_radix_transaction_failed");
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return txResult;
|
|
189
|
-
},
|
|
190
|
-
transfer: (_params: { assetValue: AssetValue; recipient: string; from: string }) => {
|
|
191
|
-
throw new SwapKitError("wallet_radix_method_not_supported", { method: "transfer" });
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
}
|
package/src/talisman.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@swapkit/wallet-extensions/talisman";
|
package/src/trezor.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@swapkit/wallet-hardware/trezor";
|
package/src/tronlink.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@swapkit/wallet-extensions/tronlink";
|
package/src/types.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { WalletOption } from "@swapkit/helpers";
|
|
2
|
-
import type { bitgetWallet } from "@swapkit/wallet-extensions/bitget";
|
|
3
|
-
import type { cosmostationWallet } from "@swapkit/wallet-extensions/cosmostation";
|
|
4
|
-
import type { ctrlWallet } from "@swapkit/wallet-extensions/ctrl";
|
|
5
|
-
import type { evmWallet } from "@swapkit/wallet-extensions/evm-extensions";
|
|
6
|
-
import type { keepkeyBexWallet } from "@swapkit/wallet-extensions/keepkey-bex";
|
|
7
|
-
import type { keplrWallet } from "@swapkit/wallet-extensions/keplr";
|
|
8
|
-
import type { okxWallet } from "@swapkit/wallet-extensions/okx";
|
|
9
|
-
import type { onekeyWallet } from "@swapkit/wallet-extensions/onekey";
|
|
10
|
-
import type { phantomWallet } from "@swapkit/wallet-extensions/phantom";
|
|
11
|
-
import type { polkadotWallet } from "@swapkit/wallet-extensions/polkadotjs";
|
|
12
|
-
import type { talismanWallet } from "@swapkit/wallet-extensions/talisman";
|
|
13
|
-
import type { tronlinkWallet } from "@swapkit/wallet-extensions/tronlink";
|
|
14
|
-
import type { vultisigWallet } from "@swapkit/wallet-extensions/vultisig";
|
|
15
|
-
import type { keepkeyWallet } from "@swapkit/wallet-hardware/keepkey";
|
|
16
|
-
import type { ledgerWallet } from "@swapkit/wallet-hardware/ledger";
|
|
17
|
-
import type { trezorWallet } from "@swapkit/wallet-hardware/trezor";
|
|
18
|
-
import type { coinbaseWallet } from "./coinbase";
|
|
19
|
-
import type { keystoreWallet } from "./keystore";
|
|
20
|
-
import type { walletSelectorWallet } from "./near-wallet-selector";
|
|
21
|
-
import type { passkeysWallet } from "./passkeys";
|
|
22
|
-
import type { radixWallet } from "./radix";
|
|
23
|
-
import type { walletconnectWallet } from "./walletconnect";
|
|
24
|
-
import type { xamanWallet } from "./xaman";
|
|
25
|
-
|
|
26
|
-
export type SKWallets = {
|
|
27
|
-
[WalletOption.BITGET]: typeof bitgetWallet;
|
|
28
|
-
[WalletOption.BRAVE]: typeof evmWallet;
|
|
29
|
-
[WalletOption.COINBASE_MOBILE]: typeof coinbaseWallet;
|
|
30
|
-
[WalletOption.COINBASE_WEB]: typeof evmWallet;
|
|
31
|
-
[WalletOption.COSMOSTATION]: typeof cosmostationWallet;
|
|
32
|
-
[WalletOption.CTRL]: typeof ctrlWallet;
|
|
33
|
-
[WalletOption.EIP6963]: typeof evmWallet;
|
|
34
|
-
[WalletOption.EXODUS]: typeof passkeysWallet;
|
|
35
|
-
[WalletOption.KEEPKEY]: typeof keepkeyWallet;
|
|
36
|
-
[WalletOption.KEEPKEY_BEX]: typeof keepkeyBexWallet;
|
|
37
|
-
[WalletOption.KEPLR]: typeof keplrWallet;
|
|
38
|
-
[WalletOption.KEYSTORE]: typeof keystoreWallet;
|
|
39
|
-
[WalletOption.LEAP]: typeof keplrWallet;
|
|
40
|
-
[WalletOption.LEDGER]: typeof ledgerWallet;
|
|
41
|
-
[WalletOption.LEDGER_LIVE]: typeof ledgerWallet;
|
|
42
|
-
[WalletOption.METAMASK]: typeof evmWallet;
|
|
43
|
-
[WalletOption.OKX]: typeof okxWallet;
|
|
44
|
-
[WalletOption.OKX_MOBILE]: typeof evmWallet;
|
|
45
|
-
[WalletOption.ONEKEY]: typeof onekeyWallet;
|
|
46
|
-
[WalletOption.PASSKEYS]: typeof passkeysWallet;
|
|
47
|
-
[WalletOption.PHANTOM]: typeof phantomWallet;
|
|
48
|
-
[WalletOption.POLKADOT_JS]: typeof polkadotWallet;
|
|
49
|
-
[WalletOption.RADIX_WALLET]: typeof radixWallet;
|
|
50
|
-
[WalletOption.TALISMAN]: typeof talismanWallet;
|
|
51
|
-
[WalletOption.TREZOR]: typeof trezorWallet;
|
|
52
|
-
[WalletOption.TRONLINK]: typeof tronlinkWallet;
|
|
53
|
-
[WalletOption.TRUSTWALLET_WEB]: typeof evmWallet;
|
|
54
|
-
[WalletOption.VULTISIG]: typeof vultisigWallet;
|
|
55
|
-
[WalletOption.WALLETCONNECT]: typeof walletconnectWallet;
|
|
56
|
-
[WalletOption.WALLET_SELECTOR]: typeof walletSelectorWallet;
|
|
57
|
-
[WalletOption.XAMAN]: typeof xamanWallet;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export type SKConnectWallets = SKWallets[keyof SKWallets];
|
|
61
|
-
|
|
62
|
-
export type SKWalletsSupportedChains = {
|
|
63
|
-
[WalletOption.BITGET]: typeof bitgetWallet.connectBitget.supportedChains;
|
|
64
|
-
[WalletOption.BRAVE]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
65
|
-
[WalletOption.COINBASE_MOBILE]: typeof coinbaseWallet.connectCoinbaseWallet.supportedChains;
|
|
66
|
-
[WalletOption.COINBASE_WEB]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
67
|
-
[WalletOption.COSMOSTATION]: typeof cosmostationWallet.connectCosmostation.supportedChains;
|
|
68
|
-
[WalletOption.CTRL]: typeof ctrlWallet.connectCtrl.supportedChains;
|
|
69
|
-
[WalletOption.EIP6963]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
70
|
-
[WalletOption.EXODUS]: typeof passkeysWallet.connectPasskeys.supportedChains;
|
|
71
|
-
[WalletOption.KEEPKEY]: typeof keepkeyWallet.connectKeepkey.supportedChains;
|
|
72
|
-
[WalletOption.KEEPKEY_BEX]: typeof keepkeyBexWallet.connectKeepkeyBex.supportedChains;
|
|
73
|
-
[WalletOption.KEPLR]: typeof keplrWallet.connectKeplr.supportedChains;
|
|
74
|
-
[WalletOption.KEYSTORE]: typeof keystoreWallet.connectKeystore.supportedChains;
|
|
75
|
-
[WalletOption.LEAP]: typeof keplrWallet.connectKeplr.supportedChains;
|
|
76
|
-
[WalletOption.LEDGER]: typeof ledgerWallet.connectLedger.supportedChains;
|
|
77
|
-
[WalletOption.LEDGER_LIVE]: typeof ledgerWallet.connectLedger.supportedChains;
|
|
78
|
-
[WalletOption.METAMASK]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
79
|
-
[WalletOption.OKX]: typeof okxWallet.connectOkx.supportedChains;
|
|
80
|
-
[WalletOption.OKX_MOBILE]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
81
|
-
[WalletOption.ONEKEY]: typeof onekeyWallet.connectOnekeyWallet.supportedChains;
|
|
82
|
-
[WalletOption.PASSKEYS]: typeof passkeysWallet.connectPasskeys.supportedChains;
|
|
83
|
-
[WalletOption.PHANTOM]: typeof phantomWallet.connectPhantom.supportedChains;
|
|
84
|
-
[WalletOption.POLKADOT_JS]: typeof polkadotWallet.connectPolkadotJs.supportedChains;
|
|
85
|
-
[WalletOption.RADIX_WALLET]: typeof radixWallet.connectRadixWallet.supportedChains;
|
|
86
|
-
[WalletOption.TALISMAN]: typeof talismanWallet.connectTalisman.supportedChains;
|
|
87
|
-
[WalletOption.TREZOR]: typeof trezorWallet.connectTrezor.supportedChains;
|
|
88
|
-
[WalletOption.TRONLINK]: typeof tronlinkWallet.connectTronLink.supportedChains;
|
|
89
|
-
[WalletOption.TRUSTWALLET_WEB]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
90
|
-
[WalletOption.VULTISIG]: typeof vultisigWallet.connectVultisig.supportedChains;
|
|
91
|
-
[WalletOption.WALLETCONNECT]: typeof walletconnectWallet.connectWalletconnect.supportedChains;
|
|
92
|
-
[WalletOption.WALLET_SELECTOR]: typeof walletSelectorWallet.connectWalletSelector.supportedChains;
|
|
93
|
-
[WalletOption.XAMAN]: typeof xamanWallet.connectXaman.supportedChains;
|
|
94
|
-
};
|
package/src/utils.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { WalletOption } from "@swapkit/helpers";
|
|
2
|
-
import type { SKWallets } from "./types";
|
|
3
|
-
|
|
4
|
-
export async function loadWallet<W extends WalletOption>(walletOption: W): Promise<SKWallets[W]> {
|
|
5
|
-
const { match } = await import("ts-pattern");
|
|
6
|
-
|
|
7
|
-
const wallet = await match(walletOption as WalletOption)
|
|
8
|
-
.with(WalletOption.COINBASE_MOBILE, async () => (await import("./coinbase")).coinbaseWallet)
|
|
9
|
-
.with(WalletOption.BITGET, async () => (await import("@swapkit/wallet-extensions/bitget")).bitgetWallet)
|
|
10
|
-
.with(WalletOption.CTRL, async () => (await import("@swapkit/wallet-extensions/ctrl")).ctrlWallet)
|
|
11
|
-
.with(WalletOption.VULTISIG, async () => (await import("@swapkit/wallet-extensions/vultisig")).vultisigWallet)
|
|
12
|
-
.with(WalletOption.OKX, async () => (await import("@swapkit/wallet-extensions/okx")).okxWallet)
|
|
13
|
-
.with(WalletOption.ONEKEY, async () => (await import("@swapkit/wallet-extensions/onekey")).onekeyWallet)
|
|
14
|
-
.with(WalletOption.EXODUS, async () => (await import("./passkeys")).passkeysWallet)
|
|
15
|
-
.with(WalletOption.KEEPKEY, async () => (await import("@swapkit/wallet-hardware/keepkey")).keepkeyWallet)
|
|
16
|
-
.with(
|
|
17
|
-
WalletOption.KEEPKEY_BEX,
|
|
18
|
-
async () => (await import("@swapkit/wallet-extensions/keepkey-bex")).keepkeyBexWallet,
|
|
19
|
-
)
|
|
20
|
-
.with(WalletOption.WALLETCONNECT, async () => (await import("./walletconnect")).walletconnectWallet)
|
|
21
|
-
.with(
|
|
22
|
-
WalletOption.KEPLR,
|
|
23
|
-
WalletOption.LEAP,
|
|
24
|
-
async () => (await import("@swapkit/wallet-extensions/keplr")).keplrWallet,
|
|
25
|
-
)
|
|
26
|
-
.with(
|
|
27
|
-
WalletOption.COSMOSTATION,
|
|
28
|
-
async () => (await import("@swapkit/wallet-extensions/cosmostation")).cosmostationWallet,
|
|
29
|
-
)
|
|
30
|
-
.with(
|
|
31
|
-
WalletOption.BRAVE,
|
|
32
|
-
WalletOption.COINBASE_WEB,
|
|
33
|
-
WalletOption.EIP6963,
|
|
34
|
-
WalletOption.METAMASK,
|
|
35
|
-
WalletOption.OKX_MOBILE,
|
|
36
|
-
WalletOption.TRUSTWALLET_WEB,
|
|
37
|
-
async () => (await import("@swapkit/wallet-extensions/evm-extensions")).evmWallet,
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
.with(WalletOption.KEYSTORE, async () => (await import("@swapkit/wallet-keystore")).keystoreWallet)
|
|
41
|
-
.with(WalletOption.TREZOR, async () => (await import("@swapkit/wallet-hardware/trezor")).trezorWallet)
|
|
42
|
-
.with(
|
|
43
|
-
WalletOption.LEDGER,
|
|
44
|
-
// TODO: Remove
|
|
45
|
-
WalletOption.LEDGER_LIVE,
|
|
46
|
-
async () => (await import("@swapkit/wallet-hardware/ledger")).ledgerWallet,
|
|
47
|
-
)
|
|
48
|
-
.with(WalletOption.PASSKEYS, async () => (await import("./passkeys")).passkeysWallet)
|
|
49
|
-
.with(WalletOption.PHANTOM, async () => (await import("@swapkit/wallet-extensions/phantom")).phantomWallet)
|
|
50
|
-
.with(WalletOption.POLKADOT_JS, async () => (await import("@swapkit/wallet-extensions/polkadotjs")).polkadotWallet)
|
|
51
|
-
.with(WalletOption.RADIX_WALLET, async () => (await import("./radix")).radixWallet)
|
|
52
|
-
.with(WalletOption.TALISMAN, async () => (await import("@swapkit/wallet-extensions/talisman")).talismanWallet)
|
|
53
|
-
.with(WalletOption.TRONLINK, async () => (await import("@swapkit/wallet-extensions/tronlink")).tronlinkWallet)
|
|
54
|
-
.with(WalletOption.WALLET_SELECTOR, async () => (await import("./near-wallet-selector")).walletSelectorWallet)
|
|
55
|
-
.with(WalletOption.XAMAN, async () => (await import("./xaman")).xamanWallet)
|
|
56
|
-
.exhaustive();
|
|
57
|
-
|
|
58
|
-
return wallet as SKWallets[W];
|
|
59
|
-
}
|
package/src/vultisig.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@swapkit/wallet-extensions/vultisig";
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import type { ClientMetadata } from "./types";
|
|
2
|
-
|
|
3
|
-
export const DEFAULT_RELAY_URL = "wss://relay.walletconnect.com";
|
|
4
|
-
|
|
5
|
-
export const ETHEREUM_MAINNET_ID = "eip155:1";
|
|
6
|
-
export const BSC_MAINNET_ID = "eip155:56";
|
|
7
|
-
export const AVALANCHE_MAINNET_ID = "eip155:43114";
|
|
8
|
-
export const THORCHAIN_MAINNET_ID = "cosmos:thorchain";
|
|
9
|
-
export const COSMOS_HUB_MAINNET_ID = "cosmos:cosmoshub-4";
|
|
10
|
-
export const KUJIRA_MAINNET_ID = "cosmos:kaiyo-1";
|
|
11
|
-
export const MAYACHAIN_MAINNET_ID = "cosmos:mayachain-mainnet-v1";
|
|
12
|
-
export const ARBITRUM_ONE_MAINNET_ID = "eip155:42161";
|
|
13
|
-
export const OPTIMISM_MAINNET_ID = "eip155:10";
|
|
14
|
-
export const POLYGON_MAINNET_ID = "eip155:137";
|
|
15
|
-
export const BASE_MAINNET_ID = "eip155:8453";
|
|
16
|
-
export const NEAR_MAINNET_ID = "near:mainnet";
|
|
17
|
-
export const NEAR_TESTNET_ID = "near:testnet";
|
|
18
|
-
export const TRON_MAINNET_ID = "tron:0x2b6653dc";
|
|
19
|
-
export const AURORA_MAINNET_ID = "eip155:1313161554";
|
|
20
|
-
export const BERACHAIN_MAINNET_ID = "eip155:80094";
|
|
21
|
-
export const MONAD_MAINNET_ID = "eip155:143";
|
|
22
|
-
|
|
23
|
-
export const DEFAULT_LOGGER = "debug";
|
|
24
|
-
|
|
25
|
-
export const DEFAULT_APP_METADATA: ClientMetadata = {
|
|
26
|
-
description: "SwapKit cross-chain SDK",
|
|
27
|
-
icons: ["https://raw.githubusercontent.com/swapkit/SwapKit/refs/heads/develop/docs/src/assets/logo-black.png"],
|
|
28
|
-
name: "SwapKit",
|
|
29
|
-
url: "https://swapkit.dev/",
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* EIP155
|
|
34
|
-
*/
|
|
35
|
-
export enum DEFAULT_EIP155_METHODS {
|
|
36
|
-
ETH_SEND_TRANSACTION = "eth_sendTransaction",
|
|
37
|
-
// not supported by most WC wallets
|
|
38
|
-
// ETH_SIGN_TRANSACTION = 'eth_signTransaction',
|
|
39
|
-
ETH_SIGN = "eth_sign",
|
|
40
|
-
PERSONAL_SIGN = "personal_sign",
|
|
41
|
-
ETH_SIGN_TYPED_DATA = "eth_signTypedData",
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export enum DEFAULT_EIP_155_EVENTS {
|
|
45
|
-
ETH_CHAIN_CHANGED = "chainChanged",
|
|
46
|
-
ETH_ACCOUNTS_CHANGED = "accountsChanged",
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* COSMOS
|
|
51
|
-
*/
|
|
52
|
-
export enum DEFAULT_COSMOS_METHODS {
|
|
53
|
-
COSMOS_SIGN_DIRECT = "cosmos_signDirect",
|
|
54
|
-
COSMOS_SIGN_AMINO = "cosmos_signAmino",
|
|
55
|
-
COSMOS_GET_ACCOUNTS = "cosmos_getAccounts",
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export enum DEFAULT_COSMOS_EVENTS {}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* SOLANA
|
|
62
|
-
*/
|
|
63
|
-
export enum DEFAULT_SOLANA_METHODS {
|
|
64
|
-
SOL_SIGN_TRANSACTION = "solana_signTransaction",
|
|
65
|
-
SOL_SIGN_MESSAGE = "solana_signMessage",
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export enum DEFAULT_SOLANA_EVENTS {}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* POLKADOT
|
|
72
|
-
*/
|
|
73
|
-
export enum DEFAULT_POLKADOT_METHODS {
|
|
74
|
-
POLKADOT_SIGN_TRANSACTION = "polkadot_signTransaction",
|
|
75
|
-
POLKADOT_SIGN_MESSAGE = "polkadot_signMessage",
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export enum DEFAULT_POLKADOT_EVENTS {}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* NEAR
|
|
82
|
-
*/
|
|
83
|
-
export enum DEFAULT_NEAR_METHODS {
|
|
84
|
-
NEAR_SIGN_IN = "near_signIn",
|
|
85
|
-
NEAR_SIGN_OUT = "near_signOut",
|
|
86
|
-
NEAR_GET_ACCOUNTS = "near_getAccounts",
|
|
87
|
-
NEAR_SIGN_AND_SEND_TRANSACTION = "near_signAndSendTransaction",
|
|
88
|
-
NEAR_SIGN_AND_SEND_TRANSACTIONS = "near_signAndSendTransactions",
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export enum DEFAULT_NEAR_EVENTS {}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* TRON
|
|
95
|
-
*/
|
|
96
|
-
export enum DEFAULT_TRON_METHODS {
|
|
97
|
-
TRON_SIGN_MESSAGE = "tron_signMessage",
|
|
98
|
-
TRON_SIGN_TRANSACTION = "tron_signTransaction",
|
|
99
|
-
TRON_SEND_TRANSACTION = "tron_sendTransaction",
|
|
100
|
-
TRON_GET_ACCOUNTS = "tron_getAccounts",
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export enum DEFAULT_TRON_EVENTS {}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { type EVMChain, SwapKitError, WalletOption } from "@swapkit/helpers";
|
|
2
|
-
import type { JsonRpcProvider, Provider, TransactionRequest, TransactionResponse } from "ethers";
|
|
3
|
-
import { AbstractSigner } from "ethers";
|
|
4
|
-
|
|
5
|
-
import { DEFAULT_EIP155_METHODS } from "./constants";
|
|
6
|
-
import { chainToChainId, getAddressByChain } from "./helpers";
|
|
7
|
-
import type { Walletconnect } from "./index";
|
|
8
|
-
|
|
9
|
-
interface WalletconnectEVMSignerParams {
|
|
10
|
-
chain: EVMChain;
|
|
11
|
-
walletconnect: Walletconnect;
|
|
12
|
-
provider: Provider | JsonRpcProvider;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
class WalletconnectSigner extends AbstractSigner {
|
|
16
|
-
address: string;
|
|
17
|
-
|
|
18
|
-
private chain: EVMChain;
|
|
19
|
-
private walletconnect: Walletconnect;
|
|
20
|
-
readonly provider: Provider | JsonRpcProvider;
|
|
21
|
-
|
|
22
|
-
constructor({ chain, provider, walletconnect }: WalletconnectEVMSignerParams) {
|
|
23
|
-
super(provider);
|
|
24
|
-
this.chain = chain;
|
|
25
|
-
this.walletconnect = walletconnect;
|
|
26
|
-
this.provider = provider;
|
|
27
|
-
this.address = "";
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// biome-ignore lint/suspicious/useAwait: fulfil implementation type
|
|
31
|
-
getAddress = async () => {
|
|
32
|
-
if (!this.walletconnect) {
|
|
33
|
-
throw new SwapKitError("wallet_walletconnect_connection_not_established");
|
|
34
|
-
}
|
|
35
|
-
if (!this.address) {
|
|
36
|
-
this.address = getAddressByChain(this.chain, this.walletconnect.accounts || []);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return this.address;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
signMessage = async (message: string) => {
|
|
43
|
-
// this is probably broken
|
|
44
|
-
const txHash = (await this.walletconnect?.client.request({
|
|
45
|
-
chainId: chainToChainId(this.chain),
|
|
46
|
-
request: { method: DEFAULT_EIP155_METHODS.ETH_SIGN, params: [message] },
|
|
47
|
-
topic: this.walletconnect.session.topic || "",
|
|
48
|
-
})) as string;
|
|
49
|
-
|
|
50
|
-
return txHash.startsWith("0x") ? txHash : `0x${txHash}`;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
signTransaction = () => {
|
|
54
|
-
throw new SwapKitError("wallet_walletconnect_method_not_supported", { method: "signTransaction" });
|
|
55
|
-
|
|
56
|
-
// const baseTx = {
|
|
57
|
-
// from,
|
|
58
|
-
// to,
|
|
59
|
-
// value: BigNumber.from(value || 0).toHexString(),
|
|
60
|
-
// data,
|
|
61
|
-
// };
|
|
62
|
-
|
|
63
|
-
// const txHash = (await this.walletconnect?.client.request({
|
|
64
|
-
// chainId: chainToChainId(this.chain),
|
|
65
|
-
// topic: this.walletconnect.session.topic,
|
|
66
|
-
// request: {
|
|
67
|
-
// method: DEFAULT_EIP155_METHODS.ETH_SIGN_TRANSACTION,
|
|
68
|
-
// params: [baseTx],
|
|
69
|
-
// },
|
|
70
|
-
// })) as string;
|
|
71
|
-
|
|
72
|
-
// return txHash.startsWith('0x') ? txHash : `0x${txHash}`;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// ANCHOR (@Towan) - Implement in future
|
|
76
|
-
signTypedData = () => {
|
|
77
|
-
throw new SwapKitError("wallet_walletconnect_method_not_supported", { method: "signTypedData" });
|
|
78
|
-
|
|
79
|
-
// const { toHexString } = await import('@swapkit/toolboxes/evm');
|
|
80
|
-
|
|
81
|
-
// const baseTx = {
|
|
82
|
-
// from,
|
|
83
|
-
// to,
|
|
84
|
-
// value: toHexString(value || 0n),
|
|
85
|
-
// data,
|
|
86
|
-
// };
|
|
87
|
-
|
|
88
|
-
// const txHash = (await this.walletconnect?.client.request({
|
|
89
|
-
// chainId: chainToChainId(this.chain),
|
|
90
|
-
// topic: this.walletconnect.session.topic,
|
|
91
|
-
// request: {
|
|
92
|
-
// method: DEFAULT_EIP155_METHODS.ETH_SIGN_TYPED_DATA,
|
|
93
|
-
// params: [baseTx],
|
|
94
|
-
// },
|
|
95
|
-
// })) as string;
|
|
96
|
-
|
|
97
|
-
// return txHash.startsWith('0x') ? txHash : `0x${txHash}`;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
sendTransaction = async ({ from, to, value, data }: TransactionRequest) => {
|
|
101
|
-
const { toHexString } = await import("@swapkit/toolboxes/evm");
|
|
102
|
-
|
|
103
|
-
const baseTx = { data, from, to, value: toHexString(BigInt(value || 0)) };
|
|
104
|
-
const response = await this.walletconnect?.client.request({
|
|
105
|
-
chainId: chainToChainId(this.chain),
|
|
106
|
-
request: { method: DEFAULT_EIP155_METHODS.ETH_SEND_TRANSACTION, params: [baseTx] },
|
|
107
|
-
topic: this.walletconnect.session.topic,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
return response as TransactionResponse;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
connect = (provider: Provider | null) => {
|
|
114
|
-
if (!provider) {
|
|
115
|
-
throw new SwapKitError({
|
|
116
|
-
errorKey: "wallet_provider_not_found",
|
|
117
|
-
info: { chain: this.chain, wallet: WalletOption.WALLETCONNECT },
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return new WalletconnectSigner({ chain: this.chain, provider, walletconnect: this.walletconnect });
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
export const getEVMSigner = async ({ chain, walletconnect, provider }: WalletconnectEVMSignerParams) =>
|
|
125
|
-
new WalletconnectSigner({ chain, provider, walletconnect });
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Chain, type CosmosChain, type EVMChain, SKConfig } from "@swapkit/helpers";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ARBITRUM_ONE_MAINNET_ID,
|
|
5
|
-
AURORA_MAINNET_ID,
|
|
6
|
-
AVALANCHE_MAINNET_ID,
|
|
7
|
-
BASE_MAINNET_ID,
|
|
8
|
-
BERACHAIN_MAINNET_ID,
|
|
9
|
-
BSC_MAINNET_ID,
|
|
10
|
-
COSMOS_HUB_MAINNET_ID,
|
|
11
|
-
ETHEREUM_MAINNET_ID,
|
|
12
|
-
KUJIRA_MAINNET_ID,
|
|
13
|
-
MAYACHAIN_MAINNET_ID,
|
|
14
|
-
MONAD_MAINNET_ID,
|
|
15
|
-
NEAR_MAINNET_ID,
|
|
16
|
-
NEAR_TESTNET_ID,
|
|
17
|
-
OPTIMISM_MAINNET_ID,
|
|
18
|
-
POLYGON_MAINNET_ID,
|
|
19
|
-
THORCHAIN_MAINNET_ID,
|
|
20
|
-
TRON_MAINNET_ID,
|
|
21
|
-
} from "./constants";
|
|
22
|
-
|
|
23
|
-
export const getAddressByChain = (
|
|
24
|
-
chain: EVMChain | Exclude<CosmosChain, typeof Chain.Noble> | typeof Chain.Near | typeof Chain.Tron,
|
|
25
|
-
accounts: string[],
|
|
26
|
-
) => {
|
|
27
|
-
const account = accounts.find((account) => account.startsWith(chainToChainId(chain))) || "";
|
|
28
|
-
const address = account?.split(":")?.[2];
|
|
29
|
-
|
|
30
|
-
return address || "";
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const chainToChainId = (chain: Chain) => {
|
|
34
|
-
switch (chain) {
|
|
35
|
-
case Chain.Avalanche:
|
|
36
|
-
return AVALANCHE_MAINNET_ID;
|
|
37
|
-
case Chain.Aurora:
|
|
38
|
-
return AURORA_MAINNET_ID;
|
|
39
|
-
case Chain.Base:
|
|
40
|
-
return BASE_MAINNET_ID;
|
|
41
|
-
case Chain.BinanceSmartChain:
|
|
42
|
-
return BSC_MAINNET_ID;
|
|
43
|
-
case Chain.Berachain:
|
|
44
|
-
return BERACHAIN_MAINNET_ID;
|
|
45
|
-
case Chain.Monad:
|
|
46
|
-
return MONAD_MAINNET_ID;
|
|
47
|
-
case Chain.Ethereum:
|
|
48
|
-
return ETHEREUM_MAINNET_ID;
|
|
49
|
-
case Chain.THORChain:
|
|
50
|
-
return THORCHAIN_MAINNET_ID;
|
|
51
|
-
case Chain.Arbitrum:
|
|
52
|
-
return ARBITRUM_ONE_MAINNET_ID;
|
|
53
|
-
case Chain.Optimism:
|
|
54
|
-
return OPTIMISM_MAINNET_ID;
|
|
55
|
-
case Chain.Polygon:
|
|
56
|
-
return POLYGON_MAINNET_ID;
|
|
57
|
-
case Chain.Maya:
|
|
58
|
-
return MAYACHAIN_MAINNET_ID;
|
|
59
|
-
case Chain.Cosmos:
|
|
60
|
-
return COSMOS_HUB_MAINNET_ID;
|
|
61
|
-
case Chain.Kujira:
|
|
62
|
-
return KUJIRA_MAINNET_ID;
|
|
63
|
-
case Chain.Near: {
|
|
64
|
-
// Use testnet if stagenet is enabled
|
|
65
|
-
const { isStagenet } = SKConfig.get("envs");
|
|
66
|
-
return isStagenet ? NEAR_TESTNET_ID : NEAR_MAINNET_ID;
|
|
67
|
-
}
|
|
68
|
-
case Chain.Tron:
|
|
69
|
-
return TRON_MAINNET_ID;
|
|
70
|
-
default:
|
|
71
|
-
return "";
|
|
72
|
-
}
|
|
73
|
-
};
|