carbon-js-sdk 0.3.53-dev.1 → 0.3.53-dev.2
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/clients/CarbonQueryClient.d.ts +6 -0
- package/lib/clients/CarbonQueryClient.js +36 -30
- package/lib/clients/ETHClient.js +15 -15
- package/lib/clients/HydrogenClient.js +1 -1
- package/lib/clients/NEOClient.js +7 -7
- package/lib/clients/TokenClient.d.ts +4 -2
- package/lib/clients/TokenClient.js +68 -4
- package/lib/clients/ZILClient.js +17 -17
- package/lib/codec/broker/amm.d.ts +1 -0
- package/lib/codec/broker/amm.js +15 -1
- package/lib/codec/cosmos/gov/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/gov/v1beta1/tx.js +2 -2
- package/lib/codec/cosmos/tx/v1beta1/tx.js +2 -2
- package/lib/codec/ethermint/crypto/v1/ethsecp256k1/keys.d.ts +39 -0
- package/lib/codec/ethermint/crypto/v1/ethsecp256k1/keys.js +138 -0
- package/lib/codec/ethermint/evm/v1/events.d.ts +72 -0
- package/lib/codec/ethermint/evm/v1/events.js +303 -0
- package/lib/codec/ethermint/evm/v1/evm.d.ts +239 -0
- package/lib/codec/ethermint/evm/v1/evm.js +1140 -0
- package/lib/codec/ethermint/evm/v1/genesis.d.ts +43 -0
- package/lib/codec/ethermint/evm/v1/genesis.js +153 -0
- package/lib/codec/ethermint/evm/v1/query.d.ts +424 -0
- package/lib/codec/ethermint/evm/v1/query.js +1637 -0
- package/lib/codec/ethermint/evm/v1/tx.d.ts +219 -0
- package/lib/codec/ethermint/evm/v1/tx.js +935 -0
- package/lib/codec/ethermint/feemarket/v1/events.d.ts +34 -0
- package/lib/codec/ethermint/feemarket/v1/events.js +116 -0
- package/lib/codec/ethermint/feemarket/v1/feemarket.d.ts +51 -0
- package/lib/codec/ethermint/feemarket/v1/feemarket.js +176 -0
- package/lib/codec/ethermint/feemarket/v1/genesis.d.ts +26 -0
- package/lib/codec/ethermint/feemarket/v1/genesis.js +79 -0
- package/lib/codec/ethermint/feemarket/v1/query.d.ts +100 -0
- package/lib/codec/ethermint/feemarket/v1/query.js +276 -0
- package/lib/codec/ethermint/feemarket/v1/tx.d.ts +55 -0
- package/lib/codec/ethermint/feemarket/v1/tx.js +120 -0
- package/lib/codec/ethermint/types/v1/account.d.ts +26 -0
- package/lib/codec/ethermint/types/v1/account.js +78 -0
- package/lib/codec/ethermint/types/v1/dynamic_fee.d.ts +20 -0
- package/lib/codec/ethermint/types/v1/dynamic_fee.js +60 -0
- package/lib/codec/ethermint/types/v1/indexer.d.ts +41 -0
- package/lib/codec/ethermint/types/v1/indexer.js +153 -0
- package/lib/codec/ethermint/types/v1/web3.d.ts +36 -0
- package/lib/codec/ethermint/types/v1/web3.js +124 -0
- package/lib/codec/evmbank/genesis.d.ts +32 -0
- package/lib/codec/evmbank/genesis.js +152 -0
- package/lib/codec/evmbank/query.d.ts +40 -0
- package/lib/codec/evmbank/query.js +116 -0
- package/lib/codec/evmmerge/event.d.ts +20 -0
- package/lib/codec/evmmerge/event.js +90 -0
- package/lib/codec/evmmerge/genesis.d.ts +48 -0
- package/lib/codec/evmmerge/genesis.js +216 -0
- package/lib/codec/evmmerge/offchain.d.ts +22 -0
- package/lib/codec/evmmerge/offchain.js +105 -0
- package/lib/codec/evmmerge/query.d.ts +43 -0
- package/lib/codec/evmmerge/query.js +117 -0
- package/lib/codec/evmmerge/tx.d.ts +45 -0
- package/lib/codec/evmmerge/tx.js +128 -0
- package/lib/codec/index.d.ts +14 -10
- package/lib/codec/index.js +52 -27
- package/lib/codec/liquiditypool/event.d.ts +12 -0
- package/lib/codec/liquiditypool/event.js +74 -1
- package/lib/codec/liquiditypool/genesis.d.ts +2 -1
- package/lib/codec/liquiditypool/genesis.js +17 -2
- package/lib/codec/liquiditypool/liquiditypool.d.ts +40 -0
- package/lib/codec/liquiditypool/liquiditypool.js +320 -2
- package/lib/codec/liquiditypool/proposal.d.ts +37 -1
- package/lib/codec/liquiditypool/proposal.js +229 -1
- package/lib/codec/liquiditypool/query.d.ts +85 -24
- package/lib/codec/liquiditypool/query.js +338 -23
- package/lib/codec/liquiditypool/tx.d.ts +101 -46
- package/lib/codec/liquiditypool/tx.js +638 -309
- package/lib/codec/order/order.d.ts +1 -0
- package/lib/codec/order/order.js +45 -1
- package/lib/constant/generic.js +1 -1
- package/lib/modules/admin.d.ts +0 -2
- package/lib/modules/admin.js +0 -26
- package/lib/modules/cdp.js +43 -43
- package/lib/modules/coin.d.ts +19 -0
- package/lib/modules/coin.js +39 -0
- package/lib/modules/cosmwasm.js +1 -1
- package/lib/modules/gov.js +12 -26
- package/lib/modules/liquiditypool.d.ts +11 -2
- package/lib/modules/liquiditypool.js +34 -3
- package/lib/modules/market.d.ts +11 -0
- package/lib/modules/market.js +19 -0
- package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +1 -1
- package/lib/provider/account/NeoLedgerAccount/N3Ledger/ErrorCode.js +1 -1
- package/lib/provider/account/NeoLedgerAccount/N3Ledger/main.js +8 -8
- package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +3 -3
- package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -1
- package/lib/provider/amino/types/admin.js +28 -32
- package/lib/provider/amino/types/bank.js +1 -1
- package/lib/provider/amino/types/broker.js +1 -1
- package/lib/provider/amino/types/cdp.js +22 -22
- package/lib/provider/amino/types/coin.js +4 -4
- package/lib/provider/amino/types/gov.js +4 -40
- package/lib/provider/amino/types/ibc.js +1 -1
- package/lib/provider/amino/types/leverage.js +1 -1
- package/lib/provider/amino/types/liquidityPool.js +7 -9
- package/lib/provider/amino/types/market.js +1 -1
- package/lib/provider/amino/types/oracle.js +1 -1
- package/lib/provider/amino/types/order.js +4 -4
- package/lib/provider/amino/types/position.js +1 -1
- package/lib/provider/amino/types/profile.js +1 -1
- package/lib/provider/amino/types/staking.js +4 -4
- package/lib/provider/amino/types/subaccount.js +3 -3
- package/lib/provider/amino/utils.js +11 -11
- package/lib/provider/ledger/ledger.js +2 -2
- package/lib/provider/metamask/MetaMask.js +1 -1
- package/lib/provider/o3/O3Wallet.js +2 -2
- package/lib/util/address.js +13 -13
- package/lib/util/api.js +4 -4
- package/lib/util/blockchain.d.ts +4 -1
- package/lib/util/fetch.js +1 -1
- package/lib/util/generic.js +3 -3
- package/lib/util/gov.d.ts +0 -2
- package/lib/util/gov.js +0 -6
- package/lib/util/number.js +5 -5
- package/lib/util/tx.d.ts +9 -4
- package/lib/wallet/CarbonSigner.js +2 -2
- package/lib/wallet/CarbonSigningClient.js +8 -8
- package/lib/wallet/CarbonWallet.js +6 -6
- package/lib/websocket/connector.js +3 -3
- package/lib/websocket/models.d.ts +7 -2
- package/package.json +1 -1
|
@@ -44,23 +44,23 @@ const mapEachIndiv = (mapItem, valueKey, toAmino = false) => {
|
|
|
44
44
|
if (typeof keyMap !== "object") {
|
|
45
45
|
// Check if this is a Long/BigNumber/Buffer/Date/Duration obj or a non-object/array
|
|
46
46
|
if (typeCheck(mapItem[key]) || typeof mapItem[key] !== "object") {
|
|
47
|
-
directMap[altKey] = exports.paramConverter(mapItem[key], keyMap, toAmino);
|
|
47
|
+
directMap[altKey] = (0, exports.paramConverter)(mapItem[key], keyMap, toAmino);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
if (mapItem[key].length && typeof mapItem[key] === "object") {
|
|
52
52
|
// If value is an array of objects, iterate through objects and call mapToObj function
|
|
53
53
|
directMap[altKey] = mapItem[key].map((newMap) => {
|
|
54
|
-
return exports.mapEachIndiv(newMap, valueKey, toAmino);
|
|
54
|
+
return (0, exports.mapEachIndiv)(newMap, valueKey, toAmino);
|
|
55
55
|
});
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
59
|
if (util_1.TypeUtils.isDurationType(mapItem[key])) {
|
|
60
|
-
directMap[altKey] = exports.paramConverter(mapItem[key], keyMap, toAmino);
|
|
60
|
+
directMap[altKey] = (0, exports.paramConverter)(mapItem[key], keyMap, toAmino);
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
directMap[altKey] = exports.mapEachIndiv(mapItem[key], keyMap, toAmino);
|
|
63
|
+
directMap[altKey] = (0, exports.mapEachIndiv)(mapItem[key], keyMap, toAmino);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
return directMap;
|
|
@@ -137,18 +137,18 @@ const generateAminoType = (amino, aminoProcess = {}) => {
|
|
|
137
137
|
if (!newInput[key])
|
|
138
138
|
return;
|
|
139
139
|
if (typeCheck(newInput[key])) {
|
|
140
|
-
aminoObj[snakeKey] = exports.paramConverter(newInput[key], newAminoMap[key], true);
|
|
140
|
+
aminoObj[snakeKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[key], true);
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
if (typeof newInput[key] !== "object" && typeof newAminoMap[key] !== "object") {
|
|
144
|
-
aminoObj[snakeKey] = exports.paramConverter(newInput[key], newAminoMap[key], true);
|
|
144
|
+
aminoObj[snakeKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[key], true);
|
|
145
145
|
}
|
|
146
146
|
else {
|
|
147
147
|
if (((_a = newInput[key]) === null || _a === void 0 ? void 0 : _a.length) && typeof newInput[key] === "object") {
|
|
148
|
-
aminoObj[snakeKey] = newInput[key].map((newItem) => exports.mapEachIndiv(newItem, newAminoMap[key], true));
|
|
148
|
+
aminoObj[snakeKey] = newInput[key].map((newItem) => (0, exports.mapEachIndiv)(newItem, newAminoMap[key], true));
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
aminoObj[snakeKey] = exports.mapEachIndiv(newInput[key], newAminoMap[key], true);
|
|
151
|
+
aminoObj[snakeKey] = (0, exports.mapEachIndiv)(newInput[key], newAminoMap[key], true);
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
return aminoObj;
|
|
@@ -162,14 +162,14 @@ const generateAminoType = (amino, aminoProcess = {}) => {
|
|
|
162
162
|
var _a;
|
|
163
163
|
const camelKey = util_1.TypeUtils.snakeToCamel(key);
|
|
164
164
|
if (typeof newInput[key] !== "object" && typeof newAminoMap[key] !== "object") {
|
|
165
|
-
aminoObj[camelKey] = exports.paramConverter(newInput[key], newAminoMap[camelKey], false);
|
|
165
|
+
aminoObj[camelKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[camelKey], false);
|
|
166
166
|
}
|
|
167
167
|
else {
|
|
168
168
|
if (((_a = newInput[key]) === null || _a === void 0 ? void 0 : _a.length) && typeof newInput[key] === "object") {
|
|
169
|
-
aminoObj[camelKey] = newInput[key].map((newItem) => exports.mapEachIndiv(newItem, newAminoMap[camelKey], false));
|
|
169
|
+
aminoObj[camelKey] = newInput[key].map((newItem) => (0, exports.mapEachIndiv)(newItem, newAminoMap[camelKey], false));
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
|
-
aminoObj[camelKey] = exports.mapEachIndiv(newInput[key], newAminoMap[camelKey], false);
|
|
172
|
+
aminoObj[camelKey] = (0, exports.mapEachIndiv)(newInput[key], newAminoMap[camelKey], false);
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
175
|
return aminoObj;
|
|
@@ -147,7 +147,7 @@ class CosmosLedger {
|
|
|
147
147
|
const response = yield this.cosmosApp.getVersion();
|
|
148
148
|
this.checkLedgerErrors(response);
|
|
149
149
|
const { major, minor, patch, test_mode } = response;
|
|
150
|
-
exports.checkAppMode(this.testModeAllowed, test_mode);
|
|
150
|
+
(0, exports.checkAppMode)(this.testModeAllowed, test_mode);
|
|
151
151
|
const version = versionString({ major, minor, patch });
|
|
152
152
|
return version;
|
|
153
153
|
});
|
|
@@ -238,7 +238,7 @@ class CosmosLedger {
|
|
|
238
238
|
const response = yield this.cosmosApp.sign(this.hdPath, signMessage);
|
|
239
239
|
this.checkLedgerErrors(response);
|
|
240
240
|
// we have to parse the signature from Ledger as it's in DER format
|
|
241
|
-
const parsedSignature = secp256k1_1.signatureImport(response.signature);
|
|
241
|
+
const parsedSignature = (0, secp256k1_1.signatureImport)(response.signature);
|
|
242
242
|
return parsedSignature;
|
|
243
243
|
});
|
|
244
244
|
}
|
|
@@ -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.getBlockchainFromChainV2(chainId);
|
|
287
|
+
const blockchain = (0, blockchain_1.getBlockchainFromChainV2)(chainId);
|
|
288
288
|
this.blockchain = blockchain;
|
|
289
289
|
return { chainId, blockchain };
|
|
290
290
|
});
|
|
@@ -60,9 +60,9 @@ class O3Wallet {
|
|
|
60
60
|
return {
|
|
61
61
|
type: index_1.CarbonSignerTypes.BrowserInjected,
|
|
62
62
|
signAmino: (_, doc) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const msg = JSON.stringify(generic_1.sortObject(doc));
|
|
63
|
+
const msg = JSON.stringify((0, generic_1.sortObject)(doc));
|
|
64
64
|
const signBytes = yield dapi.signMessage(msg);
|
|
65
|
-
const signature = amino_1.encodeSecp256k1Signature(pubKey, signBytes);
|
|
65
|
+
const signature = (0, amino_1.encodeSecp256k1Signature)(pubKey, signBytes);
|
|
66
66
|
return {
|
|
67
67
|
signed: doc,
|
|
68
68
|
signature,
|
package/lib/util/address.js
CHANGED
|
@@ -94,13 +94,13 @@ const randomMnemonic = () => {
|
|
|
94
94
|
};
|
|
95
95
|
exports.randomMnemonic = randomMnemonic;
|
|
96
96
|
const wifEncodePrivateKey = (privateKey, iter = 128) => {
|
|
97
|
-
const privateKeyBuf = exports.stringOrBufferToBuffer(privateKey);
|
|
97
|
+
const privateKeyBuf = (0, exports.stringOrBufferToBuffer)(privateKey);
|
|
98
98
|
return wif.encode(iter, privateKeyBuf, true);
|
|
99
99
|
};
|
|
100
100
|
exports.wifEncodePrivateKey = wifEncodePrivateKey;
|
|
101
101
|
exports.SWTHAddress = {
|
|
102
102
|
newMnemonic: () => {
|
|
103
|
-
return exports.randomMnemonic();
|
|
103
|
+
return (0, exports.randomMnemonic)();
|
|
104
104
|
},
|
|
105
105
|
coinType: () => {
|
|
106
106
|
return SWTH_COIN_TYPE;
|
|
@@ -110,10 +110,10 @@ exports.SWTHAddress = {
|
|
|
110
110
|
return new BIP44Path(BIP44_PURPOSE, coinType).update(index, change, account).toArray();
|
|
111
111
|
},
|
|
112
112
|
publicKeyToScriptHash: (publicKey) => {
|
|
113
|
-
const pubKeyBuffer = exports.stringOrBufferToBuffer(publicKey);
|
|
113
|
+
const pubKeyBuffer = (0, exports.stringOrBufferToBuffer)(publicKey);
|
|
114
114
|
const sha256Hash = ethers_1.ethers.utils.sha256(pubKeyBuffer);
|
|
115
115
|
const ripemdHash = ethers_1.ethers.utils.ripemd160(sha256Hash);
|
|
116
|
-
return generic_1.stripHexPrefix(ripemdHash);
|
|
116
|
+
return (0, generic_1.stripHexPrefix)(ripemdHash);
|
|
117
117
|
},
|
|
118
118
|
publicKeyToAddress: (publicKey, opts) => {
|
|
119
119
|
const scriptHash = exports.SWTHAddress.publicKeyToScriptHash(publicKey);
|
|
@@ -135,7 +135,7 @@ exports.SWTHAddress = {
|
|
|
135
135
|
return privateKey;
|
|
136
136
|
},
|
|
137
137
|
privateToPublicKey: (privateKey) => {
|
|
138
|
-
const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
|
|
138
|
+
const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
|
|
139
139
|
const publicKeyUint8Array = secp256k1.publicKeyCreate(privateKeyBuff, true);
|
|
140
140
|
const publicKey = Buffer.from(publicKeyUint8Array);
|
|
141
141
|
return publicKey;
|
|
@@ -146,7 +146,7 @@ exports.SWTHAddress = {
|
|
|
146
146
|
return address;
|
|
147
147
|
},
|
|
148
148
|
encode: (hash, opts) => {
|
|
149
|
-
const hashBuff = exports.stringOrBufferToBuffer(hash, "hex");
|
|
149
|
+
const hashBuff = (0, exports.stringOrBufferToBuffer)(hash, "hex");
|
|
150
150
|
const words = bech32.toWords(hashBuff.slice(0, 20));
|
|
151
151
|
const addressPrefix = exports.SWTHAddress.getBech32Prefix(opts === null || opts === void 0 ? void 0 : opts.network, opts === null || opts === void 0 ? void 0 : opts.bech32Prefix, opts === null || opts === void 0 ? void 0 : opts.type);
|
|
152
152
|
const address = bech32.encode(addressPrefix, words);
|
|
@@ -205,7 +205,7 @@ exports.NEOAddress = {
|
|
|
205
205
|
]);
|
|
206
206
|
const sha256Hash = ethers_1.ethers.utils.sha256(addressScript);
|
|
207
207
|
const ripemdHash = ethers_1.ethers.utils.ripemd160(sha256Hash);
|
|
208
|
-
return generic_1.stripHexPrefix(ripemdHash);
|
|
208
|
+
return (0, generic_1.stripHexPrefix)(ripemdHash);
|
|
209
209
|
},
|
|
210
210
|
publicKeyToAddress: (publicKey) => {
|
|
211
211
|
const addressScript = exports.NEOAddress.publicKeyToScriptHash(publicKey);
|
|
@@ -213,7 +213,7 @@ exports.NEOAddress = {
|
|
|
213
213
|
return address;
|
|
214
214
|
},
|
|
215
215
|
encodePublicKey: (unencodedPublicKey) => {
|
|
216
|
-
const unencPubKeyBuf = exports.stringOrBufferToBuffer(unencodedPublicKey);
|
|
216
|
+
const unencPubKeyBuf = (0, exports.stringOrBufferToBuffer)(unencodedPublicKey);
|
|
217
217
|
if (unencPubKeyBuf.length <= 33) {
|
|
218
218
|
// length indicates already encoded
|
|
219
219
|
return unencPubKeyBuf;
|
|
@@ -238,7 +238,7 @@ exports.NEOAddress = {
|
|
|
238
238
|
return privateKey;
|
|
239
239
|
},
|
|
240
240
|
privateToPublicKey: (privateKey) => {
|
|
241
|
-
const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
|
|
241
|
+
const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
|
|
242
242
|
const publicKeyUint8Array = secp256r1.publicKeyCreate(privateKeyBuff, true);
|
|
243
243
|
return Buffer.from(publicKeyUint8Array);
|
|
244
244
|
},
|
|
@@ -256,7 +256,7 @@ exports.NEOAddress = {
|
|
|
256
256
|
},
|
|
257
257
|
};
|
|
258
258
|
exports.N3Address = Object.assign(Object.assign({}, exports.NEOAddress), { publicKeyToScriptHash: (publicKey) => {
|
|
259
|
-
const publicKeyHex = exports.stringOrBufferToBuffer(publicKey).toString("hex");
|
|
259
|
+
const publicKeyHex = (0, exports.stringOrBufferToBuffer)(publicKey).toString("hex");
|
|
260
260
|
return neon_core_next_1.wallet.getScriptHashFromPublicKey(publicKeyHex);
|
|
261
261
|
}, publicKeyToAddress: (publicKey) => {
|
|
262
262
|
const addressScript = exports.N3Address.publicKeyToScriptHash(publicKey);
|
|
@@ -282,11 +282,11 @@ exports.ETHAddress = {
|
|
|
282
282
|
return ethers_1.ethers.utils.keccak256(encodedPublicKey);
|
|
283
283
|
},
|
|
284
284
|
publicKeyToAddress: (publicKey) => {
|
|
285
|
-
const publicKeyBuff = exports.stringOrBufferToBuffer(publicKey);
|
|
285
|
+
const publicKeyBuff = (0, exports.stringOrBufferToBuffer)(publicKey);
|
|
286
286
|
return ethers_1.ethers.utils.computeAddress(publicKeyBuff);
|
|
287
287
|
},
|
|
288
288
|
encodePublicKey: (unencodedPublicKey) => {
|
|
289
|
-
const unencodedPublicKeyBuff = exports.stringOrBufferToBuffer(unencodedPublicKey);
|
|
289
|
+
const unencodedPublicKeyBuff = (0, exports.stringOrBufferToBuffer)(unencodedPublicKey);
|
|
290
290
|
const publicKey = ethers_1.ethers.utils.computePublicKey(unencodedPublicKeyBuff, true);
|
|
291
291
|
return Buffer.from(publicKey, "hex");
|
|
292
292
|
},
|
|
@@ -298,7 +298,7 @@ exports.ETHAddress = {
|
|
|
298
298
|
return Buffer.from((_a = wallet.privateKey) === null || _a === void 0 ? void 0 : _a.replace(/^0x/, ""), "hex");
|
|
299
299
|
},
|
|
300
300
|
privateToPublicKey: (privateKey) => {
|
|
301
|
-
const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
|
|
301
|
+
const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
|
|
302
302
|
return Buffer.from(ethers_1.ethers.utils.computePublicKey(privateKeyBuff).replace(/^0x/, ""), "hex");
|
|
303
303
|
},
|
|
304
304
|
privateKeyToAddress: (privateKey) => {
|
package/lib/util/api.js
CHANGED
|
@@ -84,7 +84,7 @@ class HTTP {
|
|
|
84
84
|
* Executes HTTP GET request with fetch
|
|
85
85
|
*/
|
|
86
86
|
this.get = ({ url, headers }) => {
|
|
87
|
-
return fetch_1.fetch(url, {
|
|
87
|
+
return (0, fetch_1.fetch)(url, {
|
|
88
88
|
method: "GET",
|
|
89
89
|
headers,
|
|
90
90
|
});
|
|
@@ -93,7 +93,7 @@ class HTTP {
|
|
|
93
93
|
* Executes HTTP POST request with fetch
|
|
94
94
|
*/
|
|
95
95
|
this.post = (options) => {
|
|
96
|
-
return fetch_1.fetch(options.url, {
|
|
96
|
+
return (0, fetch_1.fetch)(options.url, {
|
|
97
97
|
method: "POST",
|
|
98
98
|
headers: Object.assign({ "Content-Type": options.content_type || "application/json" }, options.headers),
|
|
99
99
|
body: JSON.stringify(options.body),
|
|
@@ -103,7 +103,7 @@ class HTTP {
|
|
|
103
103
|
* Executes HTTP DELETE request with fetch
|
|
104
104
|
*/
|
|
105
105
|
this.del = (options) => {
|
|
106
|
-
return fetch_1.fetch(options.url, {
|
|
106
|
+
return (0, fetch_1.fetch)(options.url, {
|
|
107
107
|
method: "DELETE",
|
|
108
108
|
headers: Object.assign({ "Content-Type": options.content_type || "application/json" }, options.headers),
|
|
109
109
|
body: JSON.stringify(options.body),
|
|
@@ -114,7 +114,7 @@ class HTTP {
|
|
|
114
114
|
*/
|
|
115
115
|
this.raw = (options) => {
|
|
116
116
|
const { url } = options, otherOpts = __rest(options, ["url"]);
|
|
117
|
-
return fetch_1.fetch(url, otherOpts);
|
|
117
|
+
return (0, fetch_1.fetch)(url, otherOpts);
|
|
118
118
|
};
|
|
119
119
|
this.apiPrefix = apiPrefix;
|
|
120
120
|
this.apiEndpoints = apiEndpoints;
|
package/lib/util/blockchain.d.ts
CHANGED
|
@@ -41,9 +41,12 @@ export declare const BRIDGE_IDS: {
|
|
|
41
41
|
polynetwork: number;
|
|
42
42
|
ibc: number;
|
|
43
43
|
};
|
|
44
|
+
export declare type ChainIdName = {
|
|
45
|
+
chain_id_name: string;
|
|
46
|
+
};
|
|
44
47
|
export interface BridgeMap {
|
|
45
48
|
polynetwork: Bridge[];
|
|
46
|
-
ibc: Bridge[];
|
|
49
|
+
ibc: (Bridge & ChainIdName)[];
|
|
47
50
|
}
|
|
48
51
|
export declare type ChainIds = SimpleMap<number>;
|
|
49
52
|
export declare const ChainNames: {
|
package/lib/util/fetch.js
CHANGED
package/lib/util/generic.js
CHANGED
|
@@ -22,7 +22,7 @@ const overrideConfig = (defaults, override) => {
|
|
|
22
22
|
continue;
|
|
23
23
|
if (typeof member === "object") {
|
|
24
24
|
// @ts-ignore
|
|
25
|
-
result[key] = exports.overrideConfig(result[key], member);
|
|
25
|
+
result[key] = (0, exports.overrideConfig)(result[key], member);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
// @ts-ignore
|
|
@@ -41,7 +41,7 @@ const sortObject = (input) => {
|
|
|
41
41
|
Object.keys(input)
|
|
42
42
|
.sort()
|
|
43
43
|
// @ts-ignore noImplicitAny
|
|
44
|
-
.forEach((key) => (output[key] = exports.sortObject(input[key])));
|
|
44
|
+
.forEach((key) => (output[key] = (0, exports.sortObject)(input[key])));
|
|
45
45
|
return output;
|
|
46
46
|
};
|
|
47
47
|
exports.sortObject = sortObject;
|
|
@@ -56,7 +56,7 @@ exports.appendHexPrefix = appendHexPrefix;
|
|
|
56
56
|
const computeTxHash = (bytes) => {
|
|
57
57
|
if (!bytes)
|
|
58
58
|
return bytes;
|
|
59
|
-
return exports.toTxHash(crypto_1.sha256(bytes));
|
|
59
|
+
return (0, exports.toTxHash)((0, crypto_1.sha256)(bytes));
|
|
60
60
|
};
|
|
61
61
|
exports.computeTxHash = computeTxHash;
|
|
62
62
|
const toTxHash = (bytes) => {
|
package/lib/util/gov.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ export declare enum ProposalTypes {
|
|
|
11
11
|
RemoveMinGasPrice = "/Switcheo.carbon.fee.RemoveMinGasPriceProposal",
|
|
12
12
|
CreateToken = "/Switcheo.carbon.coin.CreateTokenProposal",
|
|
13
13
|
CreateOracle = "/Switcheo.carbon.oracle.CreateOracleProposal",
|
|
14
|
-
LinkPool = "/Switcheo.carbon.liquiditypool.LinkPoolProposal",
|
|
15
|
-
UnlinkPool = "/Switcheo.carbon.liquiditypool.UnlinkPoolProposal",
|
|
16
14
|
UpdatePool = "/Switcheo.carbon.liquiditypool.UpdatePoolProposal",
|
|
17
15
|
SetRewardCurve = "/Switcheo.carbon.liquiditypool.SetRewardCurveProposal",
|
|
18
16
|
SetRewardsWeights = "/Switcheo.carbon.liquiditypool.SetRewardsWeightsProposal",
|
package/lib/util/gov.js
CHANGED
|
@@ -19,8 +19,6 @@ var ProposalTypes;
|
|
|
19
19
|
ProposalTypes["RemoveMinGasPrice"] = "/Switcheo.carbon.fee.RemoveMinGasPriceProposal";
|
|
20
20
|
ProposalTypes["CreateToken"] = "/Switcheo.carbon.coin.CreateTokenProposal";
|
|
21
21
|
ProposalTypes["CreateOracle"] = "/Switcheo.carbon.oracle.CreateOracleProposal";
|
|
22
|
-
ProposalTypes["LinkPool"] = "/Switcheo.carbon.liquiditypool.LinkPoolProposal";
|
|
23
|
-
ProposalTypes["UnlinkPool"] = "/Switcheo.carbon.liquiditypool.UnlinkPoolProposal";
|
|
24
22
|
ProposalTypes["UpdatePool"] = "/Switcheo.carbon.liquiditypool.UpdatePoolProposal";
|
|
25
23
|
ProposalTypes["SetRewardCurve"] = "/Switcheo.carbon.liquiditypool.SetRewardCurveProposal";
|
|
26
24
|
ProposalTypes["SetRewardsWeights"] = "/Switcheo.carbon.liquiditypool.SetRewardsWeightsProposal";
|
|
@@ -60,8 +58,6 @@ const decodeContent = (content) => {
|
|
|
60
58
|
return Object.assign(Object.assign({}, content), { value: codec_1.CreateOracleProposal.decode(content.value) });
|
|
61
59
|
case ProposalTypes.CreateToken:
|
|
62
60
|
return Object.assign(Object.assign({}, content), { value: codec_1.CreateTokenProposal.decode(content.value) });
|
|
63
|
-
case ProposalTypes.LinkPool:
|
|
64
|
-
return Object.assign(Object.assign({}, content), { value: codec_1.LinkPoolProposal.decode(content.value) });
|
|
65
61
|
case ProposalTypes.SetCommitmentCurve:
|
|
66
62
|
return Object.assign(Object.assign({}, content), { value: codec_1.SetCommitmentCurveProposal.decode(content.value) });
|
|
67
63
|
case ProposalTypes.SetMsgGasCost:
|
|
@@ -78,8 +74,6 @@ const decodeContent = (content) => {
|
|
|
78
74
|
return Object.assign(Object.assign({}, content), { value: codec_1.SetRewardsWeightsProposal.decode(content.value) });
|
|
79
75
|
case ProposalTypes.SettlementPrice:
|
|
80
76
|
return Object.assign(Object.assign({}, content), { value: codec_1.SettlementPriceProposal.decode(content.value) });
|
|
81
|
-
case ProposalTypes.UnlinkPool:
|
|
82
|
-
return Object.assign(Object.assign({}, content), { value: codec_1.UnlinkPoolProposal.decode(content.value) });
|
|
83
77
|
case ProposalTypes.UpdateMarket:
|
|
84
78
|
return Object.assign(Object.assign({}, content), { value: codec_1.UpdateMarketProposal.decode(content.value) });
|
|
85
79
|
default:
|
package/lib/util/number.js
CHANGED
|
@@ -18,26 +18,26 @@ const parseBN = (input, defaultValue) => {
|
|
|
18
18
|
};
|
|
19
19
|
exports.parseBN = parseBN;
|
|
20
20
|
const bnOrZero = (input, defaultValue = exports.BN_ZERO) => {
|
|
21
|
-
return exports.parseBN(input, defaultValue);
|
|
21
|
+
return (0, exports.parseBN)(input, defaultValue);
|
|
22
22
|
};
|
|
23
23
|
exports.bnOrZero = bnOrZero;
|
|
24
24
|
const toHuman = (value, decimals) => {
|
|
25
25
|
if (value === undefined || value === null)
|
|
26
26
|
return undefined;
|
|
27
|
-
const valueBN = exports.bnOrZero(value);
|
|
27
|
+
const valueBN = (0, exports.bnOrZero)(value);
|
|
28
28
|
if (!decimals)
|
|
29
29
|
return valueBN; // decimals = 0 or nullish
|
|
30
|
-
const decimalsBN = exports.bnOrZero(decimals);
|
|
30
|
+
const decimalsBN = (0, exports.bnOrZero)(decimals);
|
|
31
31
|
return valueBN.shiftedBy(decimalsBN.negated().toNumber());
|
|
32
32
|
};
|
|
33
33
|
exports.toHuman = toHuman;
|
|
34
34
|
const toUnitless = (value, decimals) => {
|
|
35
35
|
if (value === undefined || value === null)
|
|
36
36
|
return undefined;
|
|
37
|
-
const valueBN = exports.bnOrZero(value);
|
|
37
|
+
const valueBN = (0, exports.bnOrZero)(value);
|
|
38
38
|
if (!decimals)
|
|
39
39
|
return valueBN; // decimals = 0 or nullish
|
|
40
|
-
const decimalsBN = exports.bnOrZero(decimals);
|
|
40
|
+
const decimalsBN = (0, exports.bnOrZero)(decimals);
|
|
41
41
|
return valueBN.shiftedBy(decimalsBN.toNumber());
|
|
42
42
|
};
|
|
43
43
|
exports.toUnitless = toUnitless;
|
package/lib/util/tx.d.ts
CHANGED
|
@@ -348,10 +348,6 @@ export declare const Types: {
|
|
|
348
348
|
MsgAddLiquidityResponse: string;
|
|
349
349
|
MsgRemoveLiquidity: string;
|
|
350
350
|
MsgRemoveLiquidityResponse: string;
|
|
351
|
-
MsgLinkPool: string;
|
|
352
|
-
MsgLinkPoolResponse: string;
|
|
353
|
-
MsgUnlinkPool: string;
|
|
354
|
-
MsgUnlinkPoolResponse: string;
|
|
355
351
|
MsgSetRewardsWeights: string;
|
|
356
352
|
MsgSetRewardsWeightsResponse: string;
|
|
357
353
|
MsgStakePoolToken: string;
|
|
@@ -366,12 +362,21 @@ export declare const Types: {
|
|
|
366
362
|
MsgSetCommitmentCurveResponse: string;
|
|
367
363
|
MsgUpdatePool: string;
|
|
368
364
|
MsgUpdatePoolResponse: string;
|
|
365
|
+
MsgCreatePoolRoute: string;
|
|
366
|
+
MsgCreatePoolRouteResponse: string;
|
|
367
|
+
MsgRemovePoolRoute: string;
|
|
368
|
+
MsgRemovePoolRouteResponse: string;
|
|
369
|
+
MsgUpdatePoolRoute: string;
|
|
370
|
+
MsgUpdatePoolRouteResponse: string;
|
|
369
371
|
LinkPoolProposal: string;
|
|
370
372
|
UnlinkPoolProposal: string;
|
|
371
373
|
SetRewardCurveProposal: string;
|
|
372
374
|
SetCommitmentCurveProposal: string;
|
|
373
375
|
SetRewardsWeightsProposal: string;
|
|
374
376
|
UpdatePoolProposal: string;
|
|
377
|
+
CreatePoolRouteProposal: string;
|
|
378
|
+
RemovePoolRouteProposal: string;
|
|
379
|
+
UpdatePoolRouteProposal: string;
|
|
375
380
|
MsgSetBackfillTimeInterval: string;
|
|
376
381
|
MsgSetBackfillTimeIntervalResponse: string;
|
|
377
382
|
MsgSetSmoothenBand: string;
|
|
@@ -106,9 +106,9 @@ class CarbonLedgerSigner {
|
|
|
106
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
107
|
const account = yield this.retrieveAccount();
|
|
108
108
|
const { pubkey } = account;
|
|
109
|
-
const msg = JSON.stringify(generic_1.sortObject(doc));
|
|
109
|
+
const msg = JSON.stringify((0, generic_1.sortObject)(doc));
|
|
110
110
|
const signBytes = yield this.ledger.sign(msg);
|
|
111
|
-
const signature = amino_1.encodeSecp256k1Signature(pubkey, signBytes);
|
|
111
|
+
const signature = (0, amino_1.encodeSecp256k1Signature)(pubkey, signBytes);
|
|
112
112
|
return {
|
|
113
113
|
signed: doc,
|
|
114
114
|
signature,
|
|
@@ -87,7 +87,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
87
87
|
*/
|
|
88
88
|
sign(signerAddress, messages, fee, memo, signerData) {
|
|
89
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
return proto_signing_1.isOfflineDirectSigner(this.signer)
|
|
90
|
+
return (0, proto_signing_1.isOfflineDirectSigner)(this.signer)
|
|
91
91
|
? this.signDirect(signerAddress, messages, fee, memo, signerData)
|
|
92
92
|
: this.signAmino(signerAddress, messages, fee, memo, signerData);
|
|
93
93
|
});
|
|
@@ -99,7 +99,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
99
99
|
if (!accountFromSigner) {
|
|
100
100
|
throw new Error("Failed to retrieve account from signer");
|
|
101
101
|
}
|
|
102
|
-
const pubkey = proto_signing_1.encodePubkey(amino_1.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
|
|
102
|
+
const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
|
|
103
103
|
const txBodyEncodeObject = {
|
|
104
104
|
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
105
105
|
value: Object.assign({ messages: messages, memo: memo }, (timeoutHeight && {
|
|
@@ -108,13 +108,13 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
108
108
|
};
|
|
109
109
|
const txBodyBytes = this.registry.encode(txBodyEncodeObject);
|
|
110
110
|
const gasLimit = math_1.Int53.fromString(fee.gas).toNumber();
|
|
111
|
-
const authInfoBytes = proto_signing_1.makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit);
|
|
112
|
-
const signDoc = proto_signing_1.makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
|
111
|
+
const authInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence }], fee.amount, gasLimit);
|
|
112
|
+
const signDoc = (0, proto_signing_1.makeSignDoc)(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
|
113
113
|
const { signature, signed } = yield signer.signDirect(signerAddress, signDoc);
|
|
114
114
|
return tx_1.TxRaw.fromPartial({
|
|
115
115
|
bodyBytes: signed.bodyBytes,
|
|
116
116
|
authInfoBytes: signed.authInfoBytes,
|
|
117
|
-
signatures: [encoding_1.fromBase64(signature.signature)],
|
|
117
|
+
signatures: [(0, encoding_1.fromBase64)(signature.signature)],
|
|
118
118
|
});
|
|
119
119
|
});
|
|
120
120
|
}
|
|
@@ -125,7 +125,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
125
125
|
if (!accountFromSigner) {
|
|
126
126
|
throw new Error("Failed to retrieve account from signer");
|
|
127
127
|
}
|
|
128
|
-
const pubkey = proto_signing_1.encodePubkey(amino_1.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
|
|
128
|
+
const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
|
|
129
129
|
const signMode = SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
|
|
130
130
|
const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
|
|
131
131
|
const signDoc = makeSignDocAmino(msgs, fee, chainId, memo, accountNumber, sequence, timeoutHeight !== null && timeoutHeight !== void 0 ? timeoutHeight : 0);
|
|
@@ -140,11 +140,11 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
140
140
|
const signedTxBodyBytes = this.registry.encode(signedTxBodyEncodeObject);
|
|
141
141
|
const signedGasLimit = math_1.Int53.fromString(signed.fee.gas).toNumber();
|
|
142
142
|
const signedSequence = math_1.Int53.fromString(signed.sequence).toNumber();
|
|
143
|
-
const signedAuthInfoBytes = proto_signing_1.makeAuthInfoBytes([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode);
|
|
143
|
+
const signedAuthInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode);
|
|
144
144
|
return tx_1.TxRaw.fromPartial({
|
|
145
145
|
bodyBytes: signedTxBodyBytes,
|
|
146
146
|
authInfoBytes: signedAuthInfoBytes,
|
|
147
|
-
signatures: [encoding_1.fromBase64(signature.signature)],
|
|
147
|
+
signatures: [(0, encoding_1.fromBase64)(signature.signature)],
|
|
148
148
|
});
|
|
149
149
|
});
|
|
150
150
|
}
|
|
@@ -150,7 +150,7 @@ class CarbonWallet {
|
|
|
150
150
|
const signerData = Object.assign({ accountNumber: this.accountInfo.accountNumber, chainId: this.getChainId(), sequence }, explicitSignerData);
|
|
151
151
|
const fee = (_a = opts === null || opts === void 0 ? void 0 : opts.fee) !== null && _a !== void 0 ? _a : this.estimateTxFee(messages, feeDenom);
|
|
152
152
|
const txRaw = yield signingClient.sign(signerAddress, messages, fee, memo, signerData);
|
|
153
|
-
signature = amino_1.encodeSecp256k1Signature(account.pubkey, txRaw.signatures[0]);
|
|
153
|
+
signature = (0, amino_1.encodeSecp256k1Signature)(account.pubkey, txRaw.signatures[0]);
|
|
154
154
|
return txRaw;
|
|
155
155
|
}
|
|
156
156
|
finally {
|
|
@@ -168,7 +168,7 @@ class CarbonWallet {
|
|
|
168
168
|
const tx = CarbonWallet.TxRaw.encode(txRaw).finish();
|
|
169
169
|
const carbonClient = this.getSigningClient();
|
|
170
170
|
const response = yield carbonClient.broadcastTx(tx, timeoutMs, pollIntervalMs);
|
|
171
|
-
if (stargate_1.isDeliverTxFailure(response)) {
|
|
171
|
+
if ((0, stargate_1.isDeliverTxFailure)(response)) {
|
|
172
172
|
// tx failed
|
|
173
173
|
throw new tx_1.CarbonTxError(`[${response.code}] ${response.rawLog}`, response);
|
|
174
174
|
}
|
|
@@ -207,9 +207,9 @@ class CarbonWallet {
|
|
|
207
207
|
try {
|
|
208
208
|
if (!this.accountInfo || this.sequenceInvalidated)
|
|
209
209
|
yield this.reloadAccountSequence();
|
|
210
|
-
const heightResponse = yield fetch_1.fetch(`${this.networkConfig.tmRpcUrl}/blockchain?cache=${new Date().getTime()}`);
|
|
210
|
+
const heightResponse = yield (0, fetch_1.fetch)(`${this.networkConfig.tmRpcUrl}/blockchain?cache=${new Date().getTime()}`);
|
|
211
211
|
const heightRes = yield heightResponse.json();
|
|
212
|
-
const height = number_1.bnOrZero((_a = heightRes.result) === null || _a === void 0 ? void 0 : _a.last_height);
|
|
212
|
+
const height = (0, number_1.bnOrZero)((_a = heightRes.result) === null || _a === void 0 ? void 0 : _a.last_height);
|
|
213
213
|
const timeoutHeight = height.isZero() ? undefined : height.toNumber() + this.defaultTimeoutBlocks;
|
|
214
214
|
const sequence = this.accountInfo.sequence;
|
|
215
215
|
this.accountInfo = Object.assign(Object.assign({}, this.accountInfo), { sequence: sequence + 1 });
|
|
@@ -343,12 +343,12 @@ class CarbonWallet {
|
|
|
343
343
|
const queryClient = this.getQueryClient();
|
|
344
344
|
const { msgGasCosts } = yield queryClient.fee.MsgGasCostAll({});
|
|
345
345
|
this.txGasCosts = msgGasCosts.reduce((result, item) => {
|
|
346
|
-
result[item.msgType] = number_1.bnOrZero(item.gasCost);
|
|
346
|
+
result[item.msgType] = (0, number_1.bnOrZero)(item.gasCost);
|
|
347
347
|
return result;
|
|
348
348
|
}, {});
|
|
349
349
|
const { minGasPrices } = yield queryClient.fee.MinGasPriceAll({});
|
|
350
350
|
this.txGasPrices = minGasPrices.reduce((result, item) => {
|
|
351
|
-
result[item.denom] = number_1.bnOrZero(item.gasPrice).shiftedBy(-18); // sdk.Dec shifting
|
|
351
|
+
result[item.denom] = (0, number_1.bnOrZero)(item.gasPrice).shiftedBy(-18); // sdk.Dec shifting
|
|
352
352
|
return result;
|
|
353
353
|
}, {});
|
|
354
354
|
if (!this.txGasPrices[this.defaultFeeDenom]) {
|
|
@@ -171,7 +171,7 @@ class WSConnector {
|
|
|
171
171
|
params = [params]; // eslint-disable-line no-param-reassign
|
|
172
172
|
}
|
|
173
173
|
for (const param of params) {
|
|
174
|
-
const channelId = channel_1.generateChannelId(param);
|
|
174
|
+
const channelId = (0, channel_1.generateChannelId)(param);
|
|
175
175
|
const shouldSubscribe = this.channelHandlers[channelId] === undefined;
|
|
176
176
|
this.channelHandlers[channelId] = handler;
|
|
177
177
|
if (shouldSubscribe) {
|
|
@@ -193,7 +193,7 @@ class WSConnector {
|
|
|
193
193
|
}
|
|
194
194
|
const channelIds = [];
|
|
195
195
|
for (const param of params) {
|
|
196
|
-
const channelId = channel_1.generateChannelId(param);
|
|
196
|
+
const channelId = (0, channel_1.generateChannelId)(param);
|
|
197
197
|
const shouldUnsubscribe = this.channelHandlers[channelId] !== undefined;
|
|
198
198
|
delete this.channelHandlers[channelId];
|
|
199
199
|
if (shouldUnsubscribe) {
|
|
@@ -283,7 +283,7 @@ class WSConnector {
|
|
|
283
283
|
if (!channelHandler) {
|
|
284
284
|
this.debugLog(`handler not found for channel: ${message.channel}`);
|
|
285
285
|
try {
|
|
286
|
-
const params = channel_1.parseChannelId(message.channel);
|
|
286
|
+
const params = (0, channel_1.parseChannelId)(message.channel);
|
|
287
287
|
this.unsubscribe({ channel: params.channel });
|
|
288
288
|
}
|
|
289
289
|
catch (error) {
|
|
@@ -157,12 +157,17 @@ export interface Pool {
|
|
|
157
157
|
amount_b: string;
|
|
158
158
|
weight_b: string;
|
|
159
159
|
swap_fee: string;
|
|
160
|
-
num_quotes: number;
|
|
161
160
|
shares_amount: string;
|
|
162
|
-
market: string;
|
|
163
161
|
amp_bps: string;
|
|
164
162
|
v_amount_a: string;
|
|
165
163
|
v_amount_b: string;
|
|
164
|
+
/**
|
|
165
|
+
* @deprecated num_quotes and market fields have been removed in websocket data
|
|
166
|
+
* Use Pool Routes API to retrieve numQuotes value for market, as well as the attached pool ids
|
|
167
|
+
* i.e. sdk.query.liquiditypool.PoolRoutesAll({})
|
|
168
|
+
**/
|
|
169
|
+
num_quotes?: number;
|
|
170
|
+
market?: string;
|
|
166
171
|
};
|
|
167
172
|
rewards_weight: string;
|
|
168
173
|
total_commitment: string;
|