carbon-js-sdk 0.4.3-dev.2 → 0.4.4
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 +4 -11
- package/lib/clients/ETHClient.js +6 -20
- package/lib/clients/HydrogenClient.d.ts +7 -16
- package/lib/clients/HydrogenClient.js +9 -55
- package/lib/clients/NEOClient.d.ts +1 -1
- package/lib/clients/NEOClient.js +4 -9
- package/lib/clients/TokenClient.d.ts +5 -29
- package/lib/clients/TokenClient.js +52 -257
- package/lib/clients/ZILClient.d.ts +1 -1
- package/lib/clients/ZILClient.js +4 -9
- package/lib/constant/ibc.d.ts +0 -7
- package/lib/constant/ibc.js +1 -4
- package/lib/constant/network.d.ts +0 -2
- package/lib/constant/network.js +1 -5
- package/lib/hydrogen/transfer.d.ts +5 -5
- package/lib/modules/ibc.d.ts +17 -5
- package/lib/modules/ibc.js +20 -75
- package/lib/provider/keplr/KeplrStore.d.ts +1 -1
- package/lib/provider/keplr/KeplrStore.js +5 -2
- package/lib/provider/metamask/MetaMask.d.ts +5 -5
- package/lib/provider/metamask/MetaMask.js +37 -37
- package/lib/util/blockchain.d.ts +0 -26
- package/lib/util/blockchain.js +1 -160
- package/lib/util/ibc.d.ts +3 -5
- package/lib/util/ibc.js +1 -26
- package/package.json +1 -1
package/lib/CarbonSDK.js
CHANGED
|
@@ -68,8 +68,8 @@ class CarbonSDK {
|
|
|
68
68
|
this.chainId = (_d = (_c = opts.chainId) !== null && _c !== void 0 ? _c : constant_1.CarbonChainIDs[this.network]) !== null && _d !== void 0 ? _d : constant_1.CarbonChainIDs[constant_1.Network.MainNet];
|
|
69
69
|
this.query = new clients_1.CarbonQueryClient(opts.tmClient);
|
|
70
70
|
this.insights = new clients_1.InsightsQueryClient(this.networkConfig);
|
|
71
|
+
this.hydrogen = new clients_1.HydrogenClient(this.networkConfig);
|
|
71
72
|
this.token = (_e = opts.token) !== null && _e !== void 0 ? _e : clients_1.TokenClient.instance(this.query, this);
|
|
72
|
-
this.hydrogen = clients_1.HydrogenClient.instance(this.networkConfig, this.token);
|
|
73
73
|
this.admin = new modules_1.AdminModule(this);
|
|
74
74
|
this.order = new modules_1.OrderModule(this);
|
|
75
75
|
this.lp = new modules_1.LiquidityPoolModule(this);
|
|
@@ -9,7 +9,7 @@ import TokenClient from "./TokenClient";
|
|
|
9
9
|
export interface ETHClientOpts {
|
|
10
10
|
configProvider: NetworkConfigProvider;
|
|
11
11
|
tokenClient: TokenClient;
|
|
12
|
-
blockchain:
|
|
12
|
+
blockchain: Blockchain;
|
|
13
13
|
}
|
|
14
14
|
interface ETHTxParams {
|
|
15
15
|
gasPriceGwei: BigNumber;
|
|
@@ -47,9 +47,9 @@ export interface EthersTransactionResponse extends ethers.Transaction {
|
|
|
47
47
|
export declare const FEE_MULTIPLIER: ethers.BigNumber;
|
|
48
48
|
export declare class ETHClient {
|
|
49
49
|
readonly configProvider: NetworkConfigProvider;
|
|
50
|
-
readonly blockchain:
|
|
50
|
+
readonly blockchain: Blockchain;
|
|
51
51
|
readonly tokenClient: TokenClient;
|
|
52
|
-
static SUPPORTED_BLOCKCHAINS:
|
|
52
|
+
static SUPPORTED_BLOCKCHAINS: Blockchain[];
|
|
53
53
|
static BLOCKCHAIN_KEY: {
|
|
54
54
|
bsc: string;
|
|
55
55
|
eth: string;
|
|
@@ -57,16 +57,9 @@ export declare class ETHClient {
|
|
|
57
57
|
polygon: string;
|
|
58
58
|
okc: string;
|
|
59
59
|
};
|
|
60
|
-
static BLOCKCHAINV2_MAPPING: {
|
|
61
|
-
bsc: string;
|
|
62
|
-
eth: string;
|
|
63
|
-
arbitrum: string;
|
|
64
|
-
polygon: string;
|
|
65
|
-
okc: string;
|
|
66
|
-
};
|
|
67
60
|
private constructor();
|
|
68
61
|
static instance(opts: ETHClientOpts): CarbonSDK.ETHClient;
|
|
69
|
-
getExternalBalances(api: CarbonSDK, address: string, whitelistDenoms?: string[]
|
|
62
|
+
getExternalBalances(api: CarbonSDK, address: string, whitelistDenoms?: string[]): Promise<TokensWithExternalBalance[]>;
|
|
70
63
|
approveERC20(params: ApproveERC20Params): Promise<EthersTransactionResponse>;
|
|
71
64
|
checkAllowanceERC20(token: Models.Token, owner: string, spender: string): Promise<BigNumber>;
|
|
72
65
|
bridgeTokens(params: BridgeParams): Promise<EthersTransactionResponse>;
|
package/lib/clients/ETHClient.js
CHANGED
|
@@ -35,22 +35,15 @@ class ETHClient {
|
|
|
35
35
|
throw new Error(`unsupported blockchain - ${blockchain}`);
|
|
36
36
|
return new ETHClient(configProvider, blockchain, tokenClient);
|
|
37
37
|
}
|
|
38
|
-
getExternalBalances(api, address, whitelistDenoms
|
|
38
|
+
getExternalBalances(api, address, whitelistDenoms) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
40
|
const tokenQueryResults = yield api.token.getAllTokens();
|
|
41
41
|
const lockProxyAddress = this.getLockProxyAddress().toLowerCase();
|
|
42
|
-
const tokens = tokenQueryResults.filter((token) =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(0, blockchain_1.blockchainForChainId)(token.chainId.toNumber(), api.network) == this.blockchain;
|
|
48
|
-
return isCorrectBlockchain &&
|
|
49
|
-
token.tokenAddress.length == 40 &&
|
|
50
|
-
token.bridgeAddress.toLowerCase() == (0, generic_1.stripHexPrefix)(lockProxyAddress) &&
|
|
51
|
-
(!whitelistDenoms || whitelistDenoms.includes(token.denom)) &&
|
|
52
|
-
this.verifyChecksum((0, generic_1.appendHexPrefix)(token.tokenAddress));
|
|
53
|
-
});
|
|
42
|
+
const tokens = tokenQueryResults.filter((token) => (0, blockchain_1.blockchainForChainId)(token.chainId.toNumber(), api.network) == this.blockchain &&
|
|
43
|
+
token.tokenAddress.length == 40 &&
|
|
44
|
+
token.bridgeAddress.toLowerCase() == (0, generic_1.stripHexPrefix)(lockProxyAddress) &&
|
|
45
|
+
(!whitelistDenoms || whitelistDenoms.includes(token.denom)) &&
|
|
46
|
+
this.verifyChecksum((0, generic_1.appendHexPrefix)(token.tokenAddress)));
|
|
54
47
|
const assetIds = tokens.map((token) => {
|
|
55
48
|
return this.verifyChecksum((0, generic_1.appendHexPrefix)(token.tokenAddress));
|
|
56
49
|
});
|
|
@@ -365,11 +358,4 @@ ETHClient.BLOCKCHAIN_KEY = {
|
|
|
365
358
|
[blockchain_1.Blockchain.Polygon]: "polygon",
|
|
366
359
|
[blockchain_1.Blockchain.Okc]: "okc",
|
|
367
360
|
};
|
|
368
|
-
ETHClient.BLOCKCHAINV2_MAPPING = {
|
|
369
|
-
[blockchain_1.Blockchain.BinanceSmartChain]: "Binance Smart Chain",
|
|
370
|
-
[blockchain_1.Blockchain.Ethereum]: "Ethereum",
|
|
371
|
-
[blockchain_1.Blockchain.Arbitrum]: "Arbitrum",
|
|
372
|
-
[blockchain_1.Blockchain.Polygon]: "Polygon",
|
|
373
|
-
[blockchain_1.Blockchain.Okc]: "Okc",
|
|
374
|
-
};
|
|
375
361
|
exports.default = ETHClient;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { NetworkConfig } from "../constant";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { FeeQuote, GetFeeQuoteRequest, GetFeeQuoteResponse } from "../hydrogen/feeQuote";
|
|
5
|
-
import TokenClient from './TokenClient';
|
|
2
|
+
import { GetDetailedTransfersResponse, GetRelaysRequest, GetRelaysResponse, GetStatsResponse, GetTransfersRequest, GetTransfersResponse } from "../hydrogen";
|
|
3
|
+
import { GetFeeQuoteRequest, GetFeeQuoteResponse } from "../hydrogen/feeQuote";
|
|
6
4
|
export declare const HydrogenEndpoints: {
|
|
7
5
|
stats: string;
|
|
8
6
|
transfer_payloads: string;
|
|
@@ -12,19 +10,12 @@ export declare const HydrogenEndpoints: {
|
|
|
12
10
|
declare class HydrogenClient {
|
|
13
11
|
private config;
|
|
14
12
|
private readonly apiManager;
|
|
15
|
-
|
|
16
|
-
constructor(config: NetworkConfig, tokenClient: TokenClient);
|
|
17
|
-
static instance(config: NetworkConfig, tokenClient: TokenClient): HydrogenClient;
|
|
13
|
+
constructor(config: NetworkConfig);
|
|
18
14
|
checkState(): void;
|
|
19
|
-
formatCrossChainTransferV2: (value: any) => CrossChainTransfer;
|
|
20
|
-
formatCrossChainTransferDetailedV2: (value: any) => CrossChainTransferDetailed;
|
|
21
|
-
formatRelaysTransfersV2: (value: any) => RelaysResponse;
|
|
22
|
-
formatChainEventV2: (value: any, blockchain: BlockchainUtils.BlockchainV2) => ChainTransaction | null;
|
|
23
|
-
formatFeeQuoteV2: (value: any, blockchain: BlockchainUtils.BlockchainV2) => FeeQuote;
|
|
24
15
|
getStats(): Promise<GetStatsResponse>;
|
|
25
|
-
getTransfers(req: GetTransfersRequest
|
|
26
|
-
getDetailedTransfers(req: GetTransfersRequest
|
|
27
|
-
getRelaysTransfers(req: GetRelaysRequest
|
|
28
|
-
getFeeQuote(req: GetFeeQuoteRequest
|
|
16
|
+
getTransfers(req: GetTransfersRequest): Promise<GetTransfersResponse>;
|
|
17
|
+
getDetailedTransfers(req: GetTransfersRequest): Promise<GetDetailedTransfersResponse>;
|
|
18
|
+
getRelaysTransfers(req: GetRelaysRequest): Promise<GetRelaysResponse>;
|
|
19
|
+
getFeeQuote(req: GetFeeQuoteRequest): Promise<GetFeeQuoteResponse>;
|
|
29
20
|
}
|
|
30
21
|
export default HydrogenClient;
|
|
@@ -67,56 +67,10 @@ const formatFeeQuote = (value) => {
|
|
|
67
67
|
return value;
|
|
68
68
|
return Object.assign(Object.assign({}, value), { blockchain: parseHydrogenBlockchain(value.blockchain), created_at: formatDateField((_a = value.created_at) === null || _a === void 0 ? void 0 : _a.toString()), expires_at: formatDateField((_b = value.expires_at) === null || _b === void 0 ? void 0 : _b.toString()) });
|
|
69
69
|
};
|
|
70
|
-
const getBridgeBlockchainFromId = (bridgeId) => {
|
|
71
|
-
switch (bridgeId) {
|
|
72
|
-
case 1:
|
|
73
|
-
return 'Polynetwork';
|
|
74
|
-
case 2:
|
|
75
|
-
return 'Ibc';
|
|
76
|
-
default:
|
|
77
|
-
return 'Polynetwork';
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
70
|
class HydrogenClient {
|
|
81
|
-
constructor(config
|
|
71
|
+
constructor(config) {
|
|
82
72
|
this.config = config;
|
|
83
|
-
this.formatCrossChainTransferV2 = (value) => {
|
|
84
|
-
var _a, _b;
|
|
85
|
-
if (typeof value !== "object")
|
|
86
|
-
return value;
|
|
87
|
-
return Object.assign(Object.assign({}, value), { created_at: formatDateField((_a = value.created_at) === null || _a === void 0 ? void 0 : _a.toString()), updated_at: formatDateField((_b = value.updated_at) === null || _b === void 0 ? void 0 : _b.toString()), source_blockchain: this.tokenClient.getBlockchainV2FromIDs(value.from_chain_id, value.bridge_id), bridging_blockchain: getBridgeBlockchainFromId(value.bridge_id), destination_blockchain: this.tokenClient.getBlockchainV2FromIDs(value.to_chain_id, value.bridge_id) });
|
|
88
|
-
};
|
|
89
|
-
this.formatCrossChainTransferDetailedV2 = (value) => {
|
|
90
|
-
if (!value || typeof value !== "object")
|
|
91
|
-
return value;
|
|
92
|
-
const source_blockchain = this.tokenClient.getBlockchainV2FromIDs(value.from_chain_id, value.bridge_id);
|
|
93
|
-
const destination_blockchain = this.tokenClient.getBlockchainV2FromIDs(value.to_chain_id, value.bridge_id);
|
|
94
|
-
const bridging_blockchain = getBridgeBlockchainFromId(value.bridge_id);
|
|
95
|
-
return Object.assign(Object.assign({}, this.formatCrossChainTransferV2(value)), { source_event: this.formatChainEventV2(value.source_event, source_blockchain !== null && source_blockchain !== void 0 ? source_blockchain : ''), bridging_event: this.formatChainEventV2(value.bridging_event, bridging_blockchain), destination_event: this.formatChainEventV2(value.destination_event, destination_blockchain !== null && destination_blockchain !== void 0 ? destination_blockchain : '') });
|
|
96
|
-
};
|
|
97
|
-
this.formatRelaysTransfersV2 = (value) => {
|
|
98
|
-
var _a, _b;
|
|
99
|
-
if (!value || typeof value !== "object")
|
|
100
|
-
return value;
|
|
101
|
-
return Object.assign(Object.assign({}, value), { created_at: formatDateField((_a = value.created_at) === null || _a === void 0 ? void 0 : _a.toString()), updated_at: formatDateField((_b = value.updated_at) === null || _b === void 0 ? void 0 : _b.toString()), source_blockchain: this.tokenClient.getBlockchainV2FromIDs(value.from_chain_id, value.bridge_id), bridging_blockchain: getBridgeBlockchainFromId(value.bridge_id), destination_blockchain: this.tokenClient.getBlockchainV2FromIDs(value.to_chain_id, value.bridge_id) });
|
|
102
|
-
};
|
|
103
|
-
this.formatChainEventV2 = (value, blockchain) => {
|
|
104
|
-
var _a, _b, _c;
|
|
105
|
-
if (!value || typeof value !== "object")
|
|
106
|
-
return value;
|
|
107
|
-
return Object.assign(Object.assign({}, value), { confirmed_at: formatDateField((_a = value.confirmed_at) === null || _a === void 0 ? void 0 : _a.toString()), created_at: formatDateField((_b = value.created_at) === null || _b === void 0 ? void 0 : _b.toString()), updated_at: formatDateField((_c = value.updated_at) === null || _c === void 0 ? void 0 : _c.toString()), blockchain });
|
|
108
|
-
};
|
|
109
|
-
this.formatFeeQuoteV2 = (value, blockchain) => {
|
|
110
|
-
var _a, _b;
|
|
111
|
-
if (typeof value !== "object")
|
|
112
|
-
return value;
|
|
113
|
-
return Object.assign(Object.assign({}, value), { blockchain, created_at: formatDateField((_a = value.created_at) === null || _a === void 0 ? void 0 : _a.toString()), expires_at: formatDateField((_b = value.expires_at) === null || _b === void 0 ? void 0 : _b.toString()) });
|
|
114
|
-
};
|
|
115
73
|
this.apiManager = new util_1.APIUtils.APIManager(config.hydrogenUrl, exports.HydrogenEndpoints);
|
|
116
|
-
this.tokenClient = tokenClient;
|
|
117
|
-
}
|
|
118
|
-
static instance(config, tokenClient) {
|
|
119
|
-
return new HydrogenClient(config, tokenClient);
|
|
120
74
|
}
|
|
121
75
|
checkState() {
|
|
122
76
|
var _a;
|
|
@@ -135,40 +89,40 @@ class HydrogenClient {
|
|
|
135
89
|
return response.data;
|
|
136
90
|
});
|
|
137
91
|
}
|
|
138
|
-
getTransfers(req
|
|
92
|
+
getTransfers(req) {
|
|
139
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
140
94
|
this.checkState();
|
|
141
95
|
const request = this.apiManager.path("transfer_payloads", {}, Object.assign(Object.assign({}, req), { include_tx: false }));
|
|
142
96
|
const response = yield request.get();
|
|
143
97
|
const result = response.data;
|
|
144
|
-
return Object.assign(Object.assign({}, result), { data: result.data.map(
|
|
98
|
+
return Object.assign(Object.assign({}, result), { data: result.data.map(formatCrossChainTransfer) });
|
|
145
99
|
});
|
|
146
100
|
}
|
|
147
|
-
getDetailedTransfers(req
|
|
101
|
+
getDetailedTransfers(req) {
|
|
148
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
103
|
this.checkState();
|
|
150
104
|
const request = this.apiManager.path("transfer_payloads", {}, Object.assign(Object.assign({}, req), { include_tx: true }));
|
|
151
105
|
const response = yield request.get();
|
|
152
106
|
const result = response.data;
|
|
153
|
-
return Object.assign(Object.assign({}, result), { data: result.data.map(
|
|
107
|
+
return Object.assign(Object.assign({}, result), { data: result.data.map(formatCrossChainTransferDetailed) });
|
|
154
108
|
});
|
|
155
109
|
}
|
|
156
|
-
getRelaysTransfers(req
|
|
110
|
+
getRelaysTransfers(req) {
|
|
157
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
112
|
this.checkState();
|
|
159
113
|
const request = this.apiManager.path("relays", {}, Object.assign(Object.assign({}, req), { include_tx: true }));
|
|
160
114
|
const response = yield request.get();
|
|
161
115
|
const result = response.data;
|
|
162
|
-
return Object.assign(Object.assign({}, result), { data: result.data.map(
|
|
116
|
+
return Object.assign(Object.assign({}, result), { data: result.data.map(formatRelaysTransfers) });
|
|
163
117
|
});
|
|
164
118
|
}
|
|
165
|
-
getFeeQuote(req
|
|
119
|
+
getFeeQuote(req) {
|
|
166
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
121
|
this.checkState();
|
|
168
122
|
const request = this.apiManager.path("fee_quote", {}, Object.assign({}, req));
|
|
169
123
|
const response = yield request.get();
|
|
170
124
|
const result = response.data;
|
|
171
|
-
return
|
|
125
|
+
return formatFeeQuote(result);
|
|
172
126
|
});
|
|
173
127
|
}
|
|
174
128
|
}
|
|
@@ -36,7 +36,7 @@ export declare class NEOClient {
|
|
|
36
36
|
private constructor();
|
|
37
37
|
static instance(opts: NEOClientOpts): CarbonSDK.NEOClient;
|
|
38
38
|
static parseHexNum(hex: string, exp?: number): string;
|
|
39
|
-
getExternalBalances(sdk: CarbonSDK, address: string, url: string, whitelistDenoms?: string[]
|
|
39
|
+
getExternalBalances(sdk: CarbonSDK, address: string, url: string, whitelistDenoms?: string[]): Promise<TokensWithExternalBalance[]>;
|
|
40
40
|
lockDeposit(token: TokensWithExternalBalance, feeAmountInput: string, swthAddress: string, neoPrivateKey: string): Promise<false | import("@cityofzion/neon-api/lib/funcs/types").DoInvokeConfig>;
|
|
41
41
|
lockO3Deposit(params: LockO3DepositParams): Promise<any>;
|
|
42
42
|
lockLedgerDeposit(params: LockLedgerDepositParams): Promise<any>;
|
package/lib/clients/NEOClient.js
CHANGED
|
@@ -60,18 +60,13 @@ class NEOClient {
|
|
|
60
60
|
const res = hex.length % 2 !== 0 ? `0${hex}` : hex;
|
|
61
61
|
return new bignumber_js_1.default(res ? Neon.u.reverseHex(res) : "00", 16).shiftedBy(-exp).toString();
|
|
62
62
|
}
|
|
63
|
-
getExternalBalances(sdk, address, url, whitelistDenoms
|
|
63
|
+
getExternalBalances(sdk, address, url, whitelistDenoms) {
|
|
64
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
65
|
const tokenQueryResults = yield sdk.token.getAllTokens();
|
|
66
66
|
const account = new Neon.wallet.Account(address);
|
|
67
|
-
const tokens = tokenQueryResults.filter((token) =>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
!!sdk.token.getBlockchainV2(token.denom) && (blockchain_1.BLOCKCHAIN_V2_TO_V1_MAPPING[sdk.token.getBlockchainV2(token.denom)] == this.blockchain)
|
|
71
|
-
:
|
|
72
|
-
(0, blockchain_1.blockchainForChainId)(token.chainId.toNumber(), sdk.network) == this.blockchain;
|
|
73
|
-
return isCorrectBlockchain && token.tokenAddress.length == 40 && token.bridgeAddress.length == 40;
|
|
74
|
-
});
|
|
67
|
+
const tokens = tokenQueryResults.filter((token) => (0, blockchain_1.blockchainForChainId)(token.chainId.toNumber(), sdk.network) == this.blockchain &&
|
|
68
|
+
token.tokenAddress.length == 40 &&
|
|
69
|
+
token.bridgeAddress.length == 40);
|
|
75
70
|
const client = new Neon.rpc.RPCClient(url, "2.5.2"); // TODO: should we change the RPC version??
|
|
76
71
|
// NOTE: fetching of tokens is chunked in sets of 15 as we may hit
|
|
77
72
|
// the gas limit on the RPC node and error out otherwise
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DenomTrace } from "../codec/ibc/applications/transfer/v1/transfer";
|
|
1
|
+
import { Token, TokenPrice } from "../codec";
|
|
3
2
|
import { NetworkConfigProvider } from "../constant";
|
|
4
3
|
import { FeeQuote } from "../hydrogen/feeQuote";
|
|
5
4
|
import { BlockchainUtils, TypeUtils } from "../util";
|
|
6
|
-
import { BlockchainV2, BridgeMap, IbcBridge } from '../util/blockchain';
|
|
7
5
|
import BigNumber from "bignumber.js";
|
|
8
6
|
import CarbonQueryClient from "./CarbonQueryClient";
|
|
9
|
-
export interface DenomTraceExtended extends DenomTrace {
|
|
10
|
-
token?: Token;
|
|
11
|
-
}
|
|
12
7
|
declare class TokenClient {
|
|
13
8
|
readonly query: CarbonQueryClient;
|
|
14
9
|
readonly configProvider: NetworkConfigProvider;
|
|
@@ -17,12 +12,10 @@ declare class TokenClient {
|
|
|
17
12
|
readonly wrapperMap: TypeUtils.SimpleMap<string>;
|
|
18
13
|
readonly poolTokens: TypeUtils.SimpleMap<Token>;
|
|
19
14
|
readonly cdpTokens: TypeUtils.SimpleMap<Token>;
|
|
20
|
-
readonly bridges: BridgeMap;
|
|
21
15
|
readonly symbols: TypeUtils.SimpleMap<string>;
|
|
22
16
|
readonly usdValues: TypeUtils.SimpleMap<BigNumber>;
|
|
23
17
|
readonly commonAssetNames: TypeUtils.SimpleMap<string>;
|
|
24
18
|
readonly geckoTokenNames: TypeUtils.SimpleMap<string>;
|
|
25
|
-
readonly denomTraces: TypeUtils.SimpleMap<DenomTraceExtended>;
|
|
26
19
|
private additionalGeckoDenoms;
|
|
27
20
|
private constructor();
|
|
28
21
|
static instance(query: CarbonQueryClient, configProvider: NetworkConfigProvider): TokenClient;
|
|
@@ -30,8 +23,7 @@ declare class TokenClient {
|
|
|
30
23
|
registerGeckoIdMap(map: TypeUtils.SimpleMap<string>): void;
|
|
31
24
|
getCommonDenom(denom: string): string;
|
|
32
25
|
getDecimals(denom: string): number | undefined;
|
|
33
|
-
getBlockchain(denom: string): BlockchainUtils.Blockchain |
|
|
34
|
-
getBlockchainV2(denom: string | undefined): BlockchainUtils.BlockchainV2 | undefined;
|
|
26
|
+
getBlockchain(denom: string): BlockchainUtils.Blockchain | undefined;
|
|
35
27
|
getSymbol(denom: string): string;
|
|
36
28
|
getUSDValue(denom: string): BigNumber | undefined;
|
|
37
29
|
toHuman(denom: string, unitlessAmt: BigNumber): BigNumber;
|
|
@@ -50,32 +42,16 @@ declare class TokenClient {
|
|
|
50
42
|
isWrappedToken(denom?: string): boolean;
|
|
51
43
|
hasWrappedToken(denom?: string): boolean;
|
|
52
44
|
getWrappedTokens(denom: string): Token[];
|
|
53
|
-
getWrappedToken(denom: string, blockchain?: BlockchainUtils.Blockchain
|
|
45
|
+
getWrappedToken(denom: string, blockchain?: BlockchainUtils.Blockchain): Token | null;
|
|
54
46
|
getSourceToken(denom: string): Token | null;
|
|
55
47
|
getNativeToken(): Token | undefined;
|
|
56
48
|
getNativeStablecoin(): Token | undefined;
|
|
57
49
|
isNativeToken(denom: string): boolean;
|
|
58
50
|
isNativeStablecoin(denom: string): boolean;
|
|
59
|
-
|
|
60
|
-
isCarbonToken(token?: Token | null): boolean;
|
|
61
|
-
getDepositTokenFor(tokenDenom: string, chain: BlockchainUtils.Blockchain | BlockchainUtils.BlockchainV2, version?: string): Token | undefined;
|
|
51
|
+
getDepositTokenFor(tokenDenom: string, chain: BlockchainUtils.Blockchain): Token | undefined;
|
|
62
52
|
getAllTokens(): Promise<Token[]>;
|
|
63
53
|
reloadTokens(): Promise<TypeUtils.SimpleMap<Token>>;
|
|
64
|
-
|
|
65
|
-
getDenomTraceData(denom: string): DenomTrace | undefined;
|
|
66
|
-
getBridges(): Promise<BridgeMap>;
|
|
67
|
-
matchChainsWithDifferentChainIds(bridges: Bridge[]): Promise<IbcBridge[]>;
|
|
68
|
-
getIbcBlockchainNames(): string[];
|
|
69
|
-
getIbcChainFromBlockchainV2: (blockchain: BlockchainV2 | undefined) => string | undefined;
|
|
70
|
-
getPolynetworkBlockchainNames(): string[];
|
|
71
|
-
getAllBlockchainNames(): string[];
|
|
72
|
-
getBridgesFromBridgeId(bridgeId: number): Bridge[] | IbcBridge[];
|
|
73
|
-
getIbcTokens(): TypeUtils.SimpleMap<Token>;
|
|
74
|
-
getPolyNetworkTokens(): TypeUtils.SimpleMap<Token>;
|
|
75
|
-
getBlockchainV2FromIDs(chainId: string, bridgeId: string): BlockchainV2 | undefined;
|
|
76
|
-
getBridgeFromToken(token: Token | null): Bridge | IbcBridge | undefined;
|
|
77
|
-
getIbcChainIdFromToken(token: Token | null): string | undefined;
|
|
78
|
-
getCarbonDenomTraces(): Promise<TypeUtils.SimpleMap<DenomTrace>>;
|
|
54
|
+
getCarbonIbcTokens(): Token[];
|
|
79
55
|
getCdpUnderlyingToken(cdpDenom: string): Token | undefined;
|
|
80
56
|
reloadWrapperMap(): Promise<TypeUtils.SimpleMap<string>>;
|
|
81
57
|
reloadDenomGeckoMap(): Promise<void>;
|