carbon-js-sdk 0.3.51 → 0.3.53-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/CarbonSDK.js +1 -1
- package/lib/clients/ETHClient.d.ts +11 -4
- package/lib/clients/ETHClient.js +20 -6
- package/lib/clients/HydrogenClient.d.ts +16 -7
- package/lib/clients/HydrogenClient.js +55 -9
- package/lib/clients/NEOClient.d.ts +1 -1
- package/lib/clients/NEOClient.js +9 -4
- package/lib/clients/TokenClient.d.ts +17 -4
- package/lib/clients/TokenClient.js +121 -8
- package/lib/clients/ZILClient.d.ts +1 -1
- package/lib/clients/ZILClient.js +9 -4
- package/lib/codec/cosmos/app/module/v1alpha1/module.d.ts +18 -0
- package/lib/codec/cosmos/app/module/v1alpha1/module.js +46 -0
- package/lib/codec/cosmos/app/v1alpha1/config.d.ts +57 -0
- package/lib/codec/cosmos/app/v1alpha1/config.js +125 -0
- package/lib/codec/cosmos/app/v1alpha1/export.d.ts +3 -0
- package/lib/codec/cosmos/app/v1alpha1/export.js +13 -0
- package/lib/codec/cosmos/app/v1alpha1/module.d.ts +109 -0
- package/lib/codec/cosmos/app/v1alpha1/module.js +192 -0
- package/lib/codec/cosmos/app/v1alpha1/query.d.ts +44 -0
- package/lib/codec/cosmos/app/v1alpha1/query.js +107 -0
- package/lib/codec/cosmos/authz/v1beta1/export.d.ts +4 -0
- package/lib/codec/cosmos/authz/v1beta1/export.js +25 -0
- package/lib/codec/cosmos/base/node/v1beta1/query.d.ts +42 -0
- package/lib/codec/cosmos/base/node/v1beta1/query.js +104 -0
- package/lib/codec/cosmos/base/tendermint/v1beta1/types.d.ts +67 -0
- package/lib/codec/cosmos/base/tendermint/v1beta1/types.js +423 -0
- package/lib/codec/cosmos/capability/v1beta1/export.d.ts +2 -0
- package/lib/codec/cosmos/capability/v1beta1/export.js +9 -0
- package/lib/codec/cosmos/crisis/v1beta1/export.d.ts +1 -0
- package/lib/codec/cosmos/crisis/v1beta1/export.js +6 -0
- package/lib/codec/cosmos/crypto/hd/v1/hd.d.ts +32 -0
- package/lib/codec/cosmos/crypto/hd/v1/hd.js +114 -0
- package/lib/codec/cosmos/crypto/keyring/v1/record.d.ts +78 -0
- package/lib/codec/cosmos/crypto/keyring/v1/record.js +309 -0
- package/lib/codec/cosmos/evidence/v1beta1/export.d.ts +3 -0
- package/lib/codec/cosmos/evidence/v1beta1/export.js +13 -0
- package/lib/codec/cosmos/feegrant/v1beta1/export.d.ts +3 -0
- package/lib/codec/cosmos/feegrant/v1beta1/export.js +20 -0
- package/lib/codec/cosmos/gov/v1/export.d.ts +3 -0
- package/lib/codec/cosmos/gov/v1/export.js +46 -0
- package/lib/codec/cosmos/gov/v1/genesis.d.ts +34 -0
- package/lib/codec/cosmos/gov/v1/genesis.js +166 -0
- package/lib/codec/cosmos/gov/v1/gov.d.ts +198 -0
- package/lib/codec/cosmos/gov/v1/gov.js +855 -0
- package/lib/codec/cosmos/gov/v1/query.d.ts +264 -0
- package/lib/codec/cosmos/gov/v1/query.js +1045 -0
- package/lib/codec/cosmos/gov/v1/tx.d.ts +167 -0
- package/lib/codec/cosmos/gov/v1/tx.js +639 -0
- package/lib/codec/cosmos/group/v1/events.d.ts +124 -0
- package/lib/codec/cosmos/group/v1/events.js +480 -0
- package/lib/codec/cosmos/group/v1/export.d.ts +4 -0
- package/lib/codec/cosmos/group/v1/export.js +94 -0
- package/lib/codec/cosmos/group/v1/genesis.d.ts +45 -0
- package/lib/codec/cosmos/group/v1/genesis.js +176 -0
- package/lib/codec/cosmos/group/v1/query.d.ts +412 -0
- package/lib/codec/cosmos/group/v1/query.js +1648 -0
- package/lib/codec/cosmos/group/v1/tx.d.ts +483 -0
- package/lib/codec/cosmos/group/v1/tx.js +1840 -0
- package/lib/codec/cosmos/group/v1/types.d.ts +356 -0
- package/lib/codec/cosmos/group/v1/types.js +1306 -0
- package/lib/codec/cosmos/msg/v1/msg.d.ts +1 -0
- package/lib/codec/cosmos/msg/v1/msg.js +14 -0
- package/lib/codec/cosmos/nft/v1beta1/event.d.ts +48 -0
- package/lib/codec/cosmos/nft/v1beta1/event.js +227 -0
- package/lib/codec/cosmos/nft/v1beta1/export.d.ts +5 -0
- package/lib/codec/cosmos/nft/v1beta1/export.js +30 -0
- package/lib/codec/cosmos/nft/v1beta1/genesis.d.ts +36 -0
- package/lib/codec/cosmos/nft/v1beta1/genesis.js +140 -0
- package/lib/codec/cosmos/nft/v1beta1/nft.d.ts +53 -0
- package/lib/codec/cosmos/nft/v1beta1/nft.js +233 -0
- package/lib/codec/cosmos/nft/v1beta1/query.d.ts +206 -0
- package/lib/codec/cosmos/nft/v1beta1/query.js +817 -0
- package/lib/codec/cosmos/nft/v1beta1/tx.d.ts +49 -0
- package/lib/codec/cosmos/nft/v1beta1/tx.js +137 -0
- package/lib/codec/cosmos/orm/module/v1alpha1/module.d.ts +22 -0
- package/lib/codec/cosmos/orm/module/v1alpha1/module.js +46 -0
- package/lib/codec/cosmos/orm/v1/export.d.ts +1 -0
- package/lib/codec/cosmos/orm/v1/export.js +8 -0
- package/lib/codec/cosmos/orm/v1/orm.d.ts +123 -0
- package/lib/codec/cosmos/orm/v1/orm.js +263 -0
- package/lib/codec/cosmos/orm/v1alpha1/export.d.ts +1 -0
- package/lib/codec/cosmos/orm/v1alpha1/export.js +9 -0
- package/lib/codec/cosmos/orm/v1alpha1/schema.d.ts +96 -0
- package/lib/codec/cosmos/orm/v1alpha1/schema.js +265 -0
- package/lib/codec/cosmos/upgrade/v1beta1/export.d.ts +3 -0
- package/lib/codec/cosmos/upgrade/v1beta1/export.js +24 -0
- package/lib/codec/cosmos/upgrade/v1beta1/tx.d.ts +97 -0
- package/lib/codec/cosmos/upgrade/v1beta1/tx.js +203 -0
- package/lib/codec/ibc/applications/fee/v1/ack.d.ts +24 -0
- package/lib/codec/ibc/applications/fee/v1/ack.js +125 -0
- package/lib/codec/ibc/applications/fee/v1/export.d.ts +6 -0
- package/lib/codec/ibc/applications/fee/v1/export.js +47 -0
- package/lib/codec/ibc/applications/fee/v1/fee.d.ts +68 -0
- package/lib/codec/ibc/applications/fee/v1/fee.js +289 -0
- package/lib/codec/ibc/applications/fee/v1/genesis.d.ts +93 -0
- package/lib/codec/ibc/applications/fee/v1/genesis.js +390 -0
- package/lib/codec/ibc/applications/fee/v1/metadata.d.ts +25 -0
- package/lib/codec/ibc/applications/fee/v1/metadata.js +71 -0
- package/lib/codec/ibc/applications/fee/v1/query.d.ts +312 -0
- package/lib/codec/ibc/applications/fee/v1/query.js +1187 -0
- package/lib/codec/ibc/applications/fee/v1/tx.d.ts +171 -0
- package/lib/codec/ibc/applications/fee/v1/tx.js +524 -0
- package/lib/codec/ibc/applications/interchain_accounts/controller/v1/tx.d.ts +78 -0
- package/lib/codec/ibc/applications/interchain_accounts/controller/v1/tx.js +296 -0
- package/lib/codec/ibc/applications/interchain_accounts/genesis/v1/genesis.d.ts +80 -0
- package/lib/codec/ibc/applications/interchain_accounts/genesis/v1/genesis.js +439 -0
- package/lib/hydrogen/transfer.d.ts +5 -5
- package/lib/insights/competition.d.ts +2 -0
- package/lib/provider/metamask/MetaMask.d.ts +5 -5
- package/lib/provider/metamask/MetaMask.js +35 -35
- package/lib/util/blockchain.d.ts +9 -0
- package/lib/util/blockchain.js +143 -1
- package/lib/util/ibc.d.ts +4 -4
- package/lib/util/ibc.js +17 -18
- package/package.json +1 -1
|
@@ -35,35 +35,35 @@ const blockchain_1 = require("../../util/blockchain");
|
|
|
35
35
|
const ethers_1 = require("ethers");
|
|
36
36
|
const ethSignUtils = __importStar(require("eth-sig-util"));
|
|
37
37
|
const CONTRACT_HASH = {
|
|
38
|
-
|
|
38
|
+
Ethereum: {
|
|
39
39
|
// use same rinkeby contract for all non-mainnet uses
|
|
40
40
|
[constant_1.Network.TestNet]: "0x086e1b5f67c0f7ca8eb202d35553e27e964899e2",
|
|
41
41
|
[constant_1.Network.DevNet]: "0x086e1b5f67c0f7ca8eb202d35553e27e964899e2",
|
|
42
42
|
[constant_1.Network.LocalHost]: "0x086e1b5f67c0f7ca8eb202d35553e27e964899e2",
|
|
43
43
|
[constant_1.Network.MainNet]: "0xf4552877A40c1527D38970F170993660084D4541",
|
|
44
44
|
},
|
|
45
|
-
[
|
|
45
|
+
['Binance Smart Chain']: {
|
|
46
46
|
// use same testnet contract for all non-mainnet uses
|
|
47
47
|
[constant_1.Network.TestNet]: "0x06E949ec2d6737ff57859CdcE426C5b5CA2Fc085",
|
|
48
48
|
[constant_1.Network.DevNet]: "0x06E949ec2d6737ff57859CdcE426C5b5CA2Fc085",
|
|
49
49
|
[constant_1.Network.LocalHost]: "0x06E949ec2d6737ff57859CdcE426C5b5CA2Fc085",
|
|
50
50
|
[constant_1.Network.MainNet]: "0x3786d94AC6B15FE2eaC72c3CA78cB82578Fc66f4",
|
|
51
51
|
},
|
|
52
|
-
|
|
52
|
+
Arbitrum: {
|
|
53
53
|
// use same testnet contract for all non-mainnet uses
|
|
54
54
|
[constant_1.Network.TestNet]: "",
|
|
55
55
|
[constant_1.Network.DevNet]: "",
|
|
56
56
|
[constant_1.Network.LocalHost]: "",
|
|
57
57
|
[constant_1.Network.MainNet]: "0x43138036d1283413035b8eca403559737e8f7980",
|
|
58
58
|
},
|
|
59
|
-
|
|
59
|
+
Polygon: {
|
|
60
60
|
// use same testnet contract for all non-mainnet uses
|
|
61
61
|
[constant_1.Network.TestNet]: "",
|
|
62
62
|
[constant_1.Network.DevNet]: "",
|
|
63
63
|
[constant_1.Network.LocalHost]: "",
|
|
64
64
|
[constant_1.Network.MainNet]: "0x61B9503Fe023E1F1Dd0ab7417923cB0A41DD9E0c",
|
|
65
65
|
},
|
|
66
|
-
|
|
66
|
+
OKC: {
|
|
67
67
|
// use same testnet contract for all non-mainnet uses
|
|
68
68
|
[constant_1.Network.TestNet]: "",
|
|
69
69
|
[constant_1.Network.DevNet]: "",
|
|
@@ -207,18 +207,18 @@ const OKC_TESTNET = {
|
|
|
207
207
|
class MetaMask {
|
|
208
208
|
constructor(network) {
|
|
209
209
|
this.network = network;
|
|
210
|
-
this.blockchain =
|
|
210
|
+
this.blockchain = 'Ethereum';
|
|
211
211
|
}
|
|
212
|
-
static getNetworkParams(network, blockchain =
|
|
212
|
+
static getNetworkParams(network, blockchain = 'Ethereum') {
|
|
213
213
|
if (network === constant_1.Network.MainNet) {
|
|
214
214
|
switch (blockchain) {
|
|
215
|
-
case
|
|
215
|
+
case 'Binance Smart Chain':
|
|
216
216
|
return BSC_MAINNET;
|
|
217
|
-
case
|
|
217
|
+
case 'Arbitrum':
|
|
218
218
|
return ARBITRUM_MAINNET;
|
|
219
|
-
case
|
|
219
|
+
case 'Polygon':
|
|
220
220
|
return POLYGON_MAINNET;
|
|
221
|
-
case
|
|
221
|
+
case 'OKC':
|
|
222
222
|
return OKC_MAINNET;
|
|
223
223
|
default:
|
|
224
224
|
// metamask should come with Ethereum configs
|
|
@@ -226,42 +226,42 @@ class MetaMask {
|
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
switch (blockchain) {
|
|
229
|
-
case
|
|
229
|
+
case 'Binance Smart Chain':
|
|
230
230
|
return BSC_TESTNET;
|
|
231
|
-
case
|
|
231
|
+
case 'Arbitrum':
|
|
232
232
|
return ARBITRUM_TESTNET;
|
|
233
|
-
case
|
|
233
|
+
case 'Polygon':
|
|
234
234
|
return POLYGON_TESTNET;
|
|
235
|
-
case
|
|
235
|
+
case 'OKC':
|
|
236
236
|
return OKC_TESTNET;
|
|
237
237
|
default:
|
|
238
238
|
// metamask should come with Ethereum configs
|
|
239
239
|
return ETH_TESTNET;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
static getRequiredChainId(network, blockchain =
|
|
242
|
+
static getRequiredChainId(network, blockchain = 'Ethereum') {
|
|
243
243
|
if (network === constant_1.Network.MainNet) {
|
|
244
244
|
switch (blockchain) {
|
|
245
|
-
case
|
|
245
|
+
case 'Binance Smart Chain':
|
|
246
246
|
return 56;
|
|
247
|
-
case
|
|
247
|
+
case 'Arbitrum':
|
|
248
248
|
return 42161;
|
|
249
|
-
case
|
|
249
|
+
case 'Polygon':
|
|
250
250
|
return 137;
|
|
251
|
-
case
|
|
251
|
+
case 'OKC':
|
|
252
252
|
return 66;
|
|
253
253
|
default:
|
|
254
254
|
return 1;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
switch (blockchain) {
|
|
258
|
-
case
|
|
258
|
+
case 'Binance Smart Chain':
|
|
259
259
|
return 97;
|
|
260
|
-
case
|
|
260
|
+
case 'Arbitrum':
|
|
261
261
|
return 421611;
|
|
262
|
-
case
|
|
262
|
+
case 'Polygon':
|
|
263
263
|
return 80001;
|
|
264
|
-
case
|
|
264
|
+
case 'OKC':
|
|
265
265
|
return 65;
|
|
266
266
|
default:
|
|
267
267
|
return 5;
|
|
@@ -284,7 +284,7 @@ class MetaMask {
|
|
|
284
284
|
return __awaiter(this, void 0, void 0, function* () {
|
|
285
285
|
const chainIdHex = (yield ((_a = this.getAPI()) === null || _a === void 0 ? void 0 : _a.request({ method: "eth_chainId" })));
|
|
286
286
|
const chainId = !!chainIdHex ? parseInt(chainIdHex, 16) : undefined;
|
|
287
|
-
const blockchain = blockchain_1.
|
|
287
|
+
const blockchain = blockchain_1.getBlockchainFromChainV2(chainId);
|
|
288
288
|
this.blockchain = blockchain;
|
|
289
289
|
return { chainId, blockchain };
|
|
290
290
|
});
|
|
@@ -426,45 +426,45 @@ class MetaMask {
|
|
|
426
426
|
// set correct blockchain given the chain ID
|
|
427
427
|
if (network === constant_1.Network.MainNet) {
|
|
428
428
|
if (currentChainId === 1) {
|
|
429
|
-
this.blockchain =
|
|
429
|
+
this.blockchain = 'Ethereum';
|
|
430
430
|
return currentChainId;
|
|
431
431
|
}
|
|
432
432
|
if (currentChainId === 56) {
|
|
433
|
-
this.blockchain =
|
|
433
|
+
this.blockchain = 'Binance Smart Chain';
|
|
434
434
|
return currentChainId;
|
|
435
435
|
}
|
|
436
436
|
if (currentChainId === 42161) {
|
|
437
|
-
this.blockchain =
|
|
437
|
+
this.blockchain = 'Arbitrum';
|
|
438
438
|
return currentChainId;
|
|
439
439
|
}
|
|
440
440
|
if (currentChainId === 137) {
|
|
441
|
-
this.blockchain =
|
|
441
|
+
this.blockchain = 'Polygon';
|
|
442
442
|
return currentChainId;
|
|
443
443
|
}
|
|
444
444
|
if (currentChainId === 66) {
|
|
445
|
-
this.blockchain =
|
|
445
|
+
this.blockchain = 'OKC';
|
|
446
446
|
return currentChainId;
|
|
447
447
|
}
|
|
448
448
|
return 1;
|
|
449
449
|
}
|
|
450
450
|
if (currentChainId === 5) {
|
|
451
|
-
this.blockchain =
|
|
451
|
+
this.blockchain = 'Ethereum';
|
|
452
452
|
return currentChainId;
|
|
453
453
|
}
|
|
454
454
|
if (currentChainId === 97) {
|
|
455
|
-
this.blockchain =
|
|
455
|
+
this.blockchain = 'Binance Smart Chain';
|
|
456
456
|
return currentChainId;
|
|
457
457
|
}
|
|
458
458
|
if (currentChainId === 421611) {
|
|
459
|
-
this.blockchain =
|
|
459
|
+
this.blockchain = 'Arbitrum';
|
|
460
460
|
return currentChainId;
|
|
461
461
|
}
|
|
462
462
|
if (currentChainId === 80001) {
|
|
463
|
-
this.blockchain =
|
|
463
|
+
this.blockchain = 'Polygon';
|
|
464
464
|
return currentChainId;
|
|
465
465
|
}
|
|
466
466
|
if (currentChainId === 65) {
|
|
467
|
-
this.blockchain =
|
|
467
|
+
this.blockchain = 'OKC';
|
|
468
468
|
return currentChainId;
|
|
469
469
|
}
|
|
470
470
|
// Deal with cases where users are logging in to devnet using mainnet chains
|
package/lib/util/blockchain.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TokenClient } from '../clients';
|
|
2
|
+
import { Bridge } from '../codec';
|
|
1
3
|
import { Network } from "../constant/network";
|
|
2
4
|
import { SimpleMap } from "./type";
|
|
3
5
|
export declare enum Blockchain {
|
|
@@ -34,10 +36,15 @@ export declare enum Blockchain {
|
|
|
34
36
|
OmniFlixHub = "omniflixhub",
|
|
35
37
|
Agoric = "agoric"
|
|
36
38
|
}
|
|
39
|
+
export declare type BlockchainV2 = ReturnType<TokenClient['getAllBlockchainNames']>[number] | "Native" | "Carbon" | "Tradehub" | "Ibc" | "Polynetwork";
|
|
37
40
|
export declare const BRIDGE_IDS: {
|
|
38
41
|
polynetwork: number;
|
|
39
42
|
ibc: number;
|
|
40
43
|
};
|
|
44
|
+
export interface BridgeMap {
|
|
45
|
+
polynetwork: Bridge[];
|
|
46
|
+
ibc: Bridge[];
|
|
47
|
+
}
|
|
41
48
|
export declare type ChainIds = SimpleMap<number>;
|
|
42
49
|
export declare const ChainNames: {
|
|
43
50
|
readonly 1: "MainNet";
|
|
@@ -63,3 +70,5 @@ export declare function parseBlockchain(value: string | null): Blockchain | null
|
|
|
63
70
|
export declare function getChainFromID(id: number): string | undefined;
|
|
64
71
|
export declare const getBlockchainFromChain: (chainId?: number | undefined) => Blockchain.Ethereum | Blockchain.BinanceSmartChain | Blockchain.Zilliqa | Blockchain.Arbitrum | Blockchain.Polygon | Blockchain.Okc | undefined;
|
|
65
72
|
export declare const blockchainForChainId: (chainId?: number | undefined, network?: Network) => Blockchain | undefined;
|
|
73
|
+
export declare const getBlockchainFromChainV2: (chainId?: number | undefined) => "Binance Smart Chain" | "Ethereum" | "Arbitrum" | "Polygon" | "Okc" | "Zilliqa" | undefined;
|
|
74
|
+
export declare const blockchainForChainIdV2: (chainId?: number | undefined, network?: Network) => Blockchain | BlockchainV2 | undefined;
|
package/lib/util/blockchain.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.blockchainForChainId = exports.getBlockchainFromChain = exports.getChainFromID = exports.parseBlockchain = exports.chainIdsByBlockchain = exports.CHAIN_IDS_TEST = exports.CHAIN_IDS_DEV = exports.CHAIN_IDS = exports.ChainNames = exports.BRIDGE_IDS = exports.Blockchain = void 0;
|
|
3
|
+
exports.blockchainForChainIdV2 = exports.getBlockchainFromChainV2 = exports.blockchainForChainId = exports.getBlockchainFromChain = exports.getChainFromID = exports.parseBlockchain = exports.chainIdsByBlockchain = exports.CHAIN_IDS_TEST = exports.CHAIN_IDS_DEV = exports.CHAIN_IDS = exports.ChainNames = exports.BRIDGE_IDS = exports.Blockchain = void 0;
|
|
4
4
|
const network_1 = require("../constant/network");
|
|
5
5
|
var Blockchain;
|
|
6
6
|
(function (Blockchain) {
|
|
@@ -259,3 +259,145 @@ const blockchainForChainId = (chainId, network = network_1.Network.MainNet) => {
|
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
261
|
exports.blockchainForChainId = blockchainForChainId;
|
|
262
|
+
const getBlockchainFromChainV2 = (chainId) => {
|
|
263
|
+
switch (chainId) {
|
|
264
|
+
case 1:
|
|
265
|
+
case 3:
|
|
266
|
+
case 4:
|
|
267
|
+
case 5:
|
|
268
|
+
return 'Ethereum';
|
|
269
|
+
case 56:
|
|
270
|
+
case 97:
|
|
271
|
+
return 'Binance Smart Chain';
|
|
272
|
+
case 65:
|
|
273
|
+
case 66:
|
|
274
|
+
return 'Okc';
|
|
275
|
+
case 137:
|
|
276
|
+
case 80001:
|
|
277
|
+
return 'Polygon';
|
|
278
|
+
case 110:
|
|
279
|
+
case 111:
|
|
280
|
+
return 'Zilliqa';
|
|
281
|
+
case 42161:
|
|
282
|
+
case 421611:
|
|
283
|
+
return 'Arbitrum';
|
|
284
|
+
}
|
|
285
|
+
return undefined;
|
|
286
|
+
};
|
|
287
|
+
exports.getBlockchainFromChainV2 = getBlockchainFromChainV2;
|
|
288
|
+
const blockchainForChainIdV2 = (chainId, network = network_1.Network.MainNet) => {
|
|
289
|
+
switch (network) {
|
|
290
|
+
case network_1.Network.MainNet:
|
|
291
|
+
switch (chainId) {
|
|
292
|
+
case 0:
|
|
293
|
+
return "Native";
|
|
294
|
+
case 1:
|
|
295
|
+
return "Bitcoin";
|
|
296
|
+
case 2:
|
|
297
|
+
return "Ethereum";
|
|
298
|
+
case 4:
|
|
299
|
+
return "Neo";
|
|
300
|
+
case 6:
|
|
301
|
+
return "Binance Smart Chain";
|
|
302
|
+
case 14:
|
|
303
|
+
return "Neo3";
|
|
304
|
+
case 9: /* FALLTHROUGH */
|
|
305
|
+
case 18:
|
|
306
|
+
return "Zilliqa";
|
|
307
|
+
case 12: /* FALLTHROUGH */
|
|
308
|
+
case 66:
|
|
309
|
+
return 'Okc';
|
|
310
|
+
case 17: /* FALLTHROUGH */
|
|
311
|
+
case 137:
|
|
312
|
+
return 'Polygon';
|
|
313
|
+
case 244:
|
|
314
|
+
return "Osmosis";
|
|
315
|
+
case 13: /* FALLTHROUGH */
|
|
316
|
+
case 245:
|
|
317
|
+
return "Terra Classic";
|
|
318
|
+
case 246:
|
|
319
|
+
return "Cosmos Hub";
|
|
320
|
+
case 5: /* FALLTHROUGH */
|
|
321
|
+
case 247:
|
|
322
|
+
return "Juno";
|
|
323
|
+
case 7: /* FALLTHROUGH */
|
|
324
|
+
case 248:
|
|
325
|
+
return "Evmos";
|
|
326
|
+
case 8: /* FALLTHROUGH */
|
|
327
|
+
case 249:
|
|
328
|
+
return "Axelar";
|
|
329
|
+
case 313:
|
|
330
|
+
return "Stride";
|
|
331
|
+
case 314:
|
|
332
|
+
return "Kujira";
|
|
333
|
+
case 315:
|
|
334
|
+
return "Terra";
|
|
335
|
+
case 316:
|
|
336
|
+
return "Quicksilver";
|
|
337
|
+
case 12: /* FALLTHROUGH */
|
|
338
|
+
case 317:
|
|
339
|
+
return "Comdex";
|
|
340
|
+
case 318:
|
|
341
|
+
return "Stafihub";
|
|
342
|
+
case 15: /* FALLTHROUGH */
|
|
343
|
+
case 319:
|
|
344
|
+
return "Persistence Core";
|
|
345
|
+
case 16: /* FALLTHROUGH */
|
|
346
|
+
case 320:
|
|
347
|
+
return "Stargaze";
|
|
348
|
+
case 321:
|
|
349
|
+
return "Canto";
|
|
350
|
+
case 322:
|
|
351
|
+
return "OmniFlix Hub";
|
|
352
|
+
case 323:
|
|
353
|
+
return "Agoric";
|
|
354
|
+
case 19: /* FALLTHROUGH */
|
|
355
|
+
case 42161:
|
|
356
|
+
return "Arbitrum";
|
|
357
|
+
default:
|
|
358
|
+
return undefined;
|
|
359
|
+
}
|
|
360
|
+
case network_1.Network.TestNet:
|
|
361
|
+
switch (chainId) {
|
|
362
|
+
case 1:
|
|
363
|
+
return "Bitcoin";
|
|
364
|
+
case 0:
|
|
365
|
+
case 5:
|
|
366
|
+
return "Carbon";
|
|
367
|
+
case 79:
|
|
368
|
+
return "Binance Smart Chain";
|
|
369
|
+
case 88:
|
|
370
|
+
return "Neo3";
|
|
371
|
+
case 111:
|
|
372
|
+
return "Zilliqa";
|
|
373
|
+
case 2: /* FALLTHROUGH */
|
|
374
|
+
case 502:
|
|
375
|
+
return "Ethereum";
|
|
376
|
+
default:
|
|
377
|
+
return undefined;
|
|
378
|
+
}
|
|
379
|
+
case network_1.Network.DevNet:
|
|
380
|
+
switch (chainId) {
|
|
381
|
+
case 0:
|
|
382
|
+
return 'Carbon';
|
|
383
|
+
case 1:
|
|
384
|
+
return 'Bitcoin';
|
|
385
|
+
case 2:
|
|
386
|
+
case 350:
|
|
387
|
+
return "Ethereum";
|
|
388
|
+
case 5:
|
|
389
|
+
return "Neo";
|
|
390
|
+
case 79:
|
|
391
|
+
return "Binance Smart Chain";
|
|
392
|
+
case 111:
|
|
393
|
+
return 'Zilliqa';
|
|
394
|
+
default:
|
|
395
|
+
return undefined;
|
|
396
|
+
}
|
|
397
|
+
case network_1.Network.LocalHost:
|
|
398
|
+
return undefined;
|
|
399
|
+
default:
|
|
400
|
+
return undefined;
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
exports.blockchainForChainIdV2 = blockchainForChainIdV2;
|
package/lib/util/ibc.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ChainInfoExplorerTmRpc, ChainIds, GasPriceStep, AssetListObj } from "../constant";
|
|
2
2
|
import { AppCurrency } from "@keplr-wallet/types";
|
|
3
|
-
import {
|
|
3
|
+
import { BlockchainV2 } from "./blockchain";
|
|
4
4
|
import { SimpleMap } from "./type";
|
|
5
5
|
export declare function makeIBCMinimalDenom(sourceChannelId: string, coinMinimalDenom: string): string;
|
|
6
6
|
export declare const EmbedChainInfos: SimpleMap<ChainInfoExplorerTmRpc>;
|
|
7
7
|
export declare const totalAssetObj: AssetListObj;
|
|
8
|
-
export declare const ChainIdBlockchainMap: SimpleMap<
|
|
9
|
-
export declare const getIbcChainFromBlockchain: (blockchain:
|
|
10
|
-
export declare const BlockchainMap: SimpleMap<
|
|
8
|
+
export declare const ChainIdBlockchainMap: SimpleMap<BlockchainV2>;
|
|
9
|
+
export declare const getIbcChainFromBlockchain: (blockchain: BlockchainV2 | undefined) => ChainIds | undefined;
|
|
10
|
+
export declare const BlockchainMap: SimpleMap<string | undefined>;
|
|
11
11
|
export interface ChainIdOutput {
|
|
12
12
|
identifier: string;
|
|
13
13
|
version: number;
|
package/lib/util/ibc.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.isCw20Token = exports.calculateMaxFee = exports.parseChainId = exports.B
|
|
|
4
4
|
const constant_1 = require("../constant");
|
|
5
5
|
const provider_1 = require("../provider");
|
|
6
6
|
const crypto_1 = require("@keplr-wallet/crypto");
|
|
7
|
-
const blockchain_1 = require("./blockchain");
|
|
8
7
|
// Create IBC minimal denom
|
|
9
8
|
function makeIBCMinimalDenom(sourceChannelId, coinMinimalDenom) {
|
|
10
9
|
const sourceChannelIdProcess = sourceChannelId.indexOf("transfer/") === 0 ? sourceChannelId.split("/").splice(1).join("/") : sourceChannelId;
|
|
@@ -47,23 +46,23 @@ exports.totalAssetObj = Object.values(exports.EmbedChainInfos).reduce((prev, cha
|
|
|
47
46
|
return newAssetObj;
|
|
48
47
|
}, {});
|
|
49
48
|
exports.ChainIdBlockchainMap = {
|
|
50
|
-
[constant_1.ChainIds.Osmosis]:
|
|
51
|
-
[constant_1.ChainIds.Terra]:
|
|
52
|
-
[constant_1.ChainIds.CosmosHub]:
|
|
53
|
-
[constant_1.ChainIds.Juno]:
|
|
54
|
-
[constant_1.ChainIds.Evmos]:
|
|
55
|
-
[constant_1.ChainIds.Axelar]:
|
|
56
|
-
[constant_1.ChainIds.Stride]:
|
|
57
|
-
[constant_1.ChainIds.Kujira]:
|
|
58
|
-
[constant_1.ChainIds.Terra2]:
|
|
59
|
-
[constant_1.ChainIds.Quicksilver]:
|
|
60
|
-
[constant_1.ChainIds.Comdex]:
|
|
61
|
-
[constant_1.ChainIds.StafiHub]:
|
|
62
|
-
[constant_1.ChainIds.Persistence]:
|
|
63
|
-
[constant_1.ChainIds.Stargaze]:
|
|
64
|
-
[constant_1.ChainIds.Canto]:
|
|
65
|
-
[constant_1.ChainIds.OmniFlixHub]:
|
|
66
|
-
[constant_1.ChainIds.Agoric]:
|
|
49
|
+
[constant_1.ChainIds.Osmosis]: "Osmosis",
|
|
50
|
+
[constant_1.ChainIds.Terra]: "Terra",
|
|
51
|
+
[constant_1.ChainIds.CosmosHub]: "Cosmos Hub",
|
|
52
|
+
[constant_1.ChainIds.Juno]: "Juno",
|
|
53
|
+
[constant_1.ChainIds.Evmos]: "Evmos",
|
|
54
|
+
[constant_1.ChainIds.Axelar]: "Axelar",
|
|
55
|
+
[constant_1.ChainIds.Stride]: "Stride",
|
|
56
|
+
[constant_1.ChainIds.Kujira]: "Kujira",
|
|
57
|
+
[constant_1.ChainIds.Terra2]: "Terra (CW20)",
|
|
58
|
+
[constant_1.ChainIds.Quicksilver]: "Quicksilver",
|
|
59
|
+
[constant_1.ChainIds.Comdex]: "Comdex",
|
|
60
|
+
[constant_1.ChainIds.StafiHub]: "Stafihub",
|
|
61
|
+
[constant_1.ChainIds.Persistence]: "Persistence Core",
|
|
62
|
+
[constant_1.ChainIds.Stargaze]: "Stargaze",
|
|
63
|
+
[constant_1.ChainIds.Canto]: "Canto",
|
|
64
|
+
[constant_1.ChainIds.OmniFlixHub]: "Omniflix Hub",
|
|
65
|
+
[constant_1.ChainIds.Agoric]: "Agoric",
|
|
67
66
|
};
|
|
68
67
|
const getIbcChainFromBlockchain = (blockchain) => {
|
|
69
68
|
let ibcChain = undefined;
|