carbon-js-sdk 0.3.38-beta.2 → 0.3.39
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.js +2 -2
- package/lib/clients/ETHClient.js +19 -20
- package/lib/clients/HydrogenClient.js +1 -1
- package/lib/clients/NEOClient.js +7 -7
- package/lib/clients/TokenClient.js +3 -6
- package/lib/clients/ZILClient.js +20 -21
- package/lib/codec/cdp/asset_params.d.ts +0 -1
- package/lib/codec/cdp/tx.d.ts +1 -23
- package/lib/codec/cdp/tx.js +1 -100
- package/lib/codec/coin/event.d.ts +0 -81
- package/lib/codec/coin/event.js +1 -486
- package/lib/codec/coin/genesis.d.ts +1 -3
- package/lib/codec/coin/genesis.js +2 -18
- package/lib/codec/coin/query.d.ts +0 -85
- package/lib/codec/coin/query.js +1 -422
- package/lib/codec/coin/tx.d.ts +2 -197
- package/lib/codec/coin/tx.js +17 -1050
- 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/index.d.ts +5 -24
- package/lib/codec/index.js +11 -86
- package/lib/codec/pricing/pricing.d.ts +0 -1
- package/lib/codec/pricing/pricing.js +2 -14
- package/lib/codec/pricing/tx.d.ts +0 -23
- package/lib/codec/pricing/tx.js +1 -112
- package/lib/constant/generic.js +1 -1
- package/lib/constant/ibc.js +5 -0
- package/lib/constant/network.js +1 -1
- package/lib/modules/admin.d.ts +0 -32
- package/lib/modules/admin.js +0 -76
- package/lib/modules/cdp.js +43 -43
- package/lib/modules/coin.d.ts +0 -12
- package/lib/modules/coin.js +0 -44
- package/lib/modules/gov.js +14 -14
- package/lib/modules/liquiditypool.js +1 -1
- 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 +30 -30
- 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 +2 -14
- package/lib/provider/amino/types/gov.js +4 -75
- 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 -7
- 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.d.ts +1 -1
- package/lib/provider/amino/utils.js +11 -11
- package/lib/provider/ledger/ledger.js +2 -2
- package/lib/provider/metamask/MetaMask.d.ts +1 -1
- package/lib/provider/metamask/MetaMask.js +9 -9
- 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 +1 -3
- package/lib/util/blockchain.js +62 -97
- package/lib/util/fetch.js +1 -1
- package/lib/util/generic.js +3 -3
- package/lib/util/gov.d.ts +1 -8
- package/lib/util/gov.js +0 -7
- package/lib/util/number.js +5 -5
- package/lib/util/tx.d.ts +0 -18
- 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/package.json +1 -1
|
@@ -44,7 +44,7 @@ class CarbonQueryClient {
|
|
|
44
44
|
constructor(tmClient) {
|
|
45
45
|
this.tmClient = tmClient;
|
|
46
46
|
this.baseClient = new stargate_1.QueryClient(this.tmClient);
|
|
47
|
-
const rpcClient =
|
|
47
|
+
const rpcClient = stargate_1.createProtobufRpcClient(this.baseClient);
|
|
48
48
|
this.chain = BlockchainClient_1.default.connectWithTm(this.tmClient);
|
|
49
49
|
this.adl = new query_1.QueryClientImpl(rpcClient);
|
|
50
50
|
this.book = new query_2.QueryClientImpl(rpcClient);
|
|
@@ -85,7 +85,7 @@ class CarbonQueryClient {
|
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
getProtobufRpcClient() {
|
|
88
|
-
return
|
|
88
|
+
return stargate_1.createProtobufRpcClient(this.baseClient);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
exports.default = CarbonQueryClient;
|
package/lib/clients/ETHClient.js
CHANGED
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ETHClient = exports.FEE_MULTIPLIER = void 0;
|
|
16
|
+
const CarbonSDK_1 = __importDefault(require("../CarbonSDK"));
|
|
16
17
|
const constant_1 = require("../constant");
|
|
17
18
|
const eth_1 = require("../eth");
|
|
18
19
|
const util_1 = require("../util");
|
|
@@ -39,13 +40,13 @@ class ETHClient {
|
|
|
39
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
41
|
const tokenQueryResults = yield api.token.getAllTokens();
|
|
41
42
|
const lockProxyAddress = this.getLockProxyAddress().toLowerCase();
|
|
42
|
-
const tokens = tokenQueryResults.filter((token) =>
|
|
43
|
+
const tokens = tokenQueryResults.filter((token) => blockchain_1.blockchainForChainId(token.chainId.toNumber()) == this.blockchain &&
|
|
43
44
|
token.tokenAddress.length == 40 &&
|
|
44
|
-
token.bridgeAddress.toLowerCase() ==
|
|
45
|
+
token.bridgeAddress.toLowerCase() == generic_1.stripHexPrefix(lockProxyAddress) &&
|
|
45
46
|
(!whitelistDenoms || whitelistDenoms.includes(token.denom)) &&
|
|
46
|
-
this.verifyChecksum(
|
|
47
|
+
this.verifyChecksum(generic_1.appendHexPrefix(token.tokenAddress)));
|
|
47
48
|
const assetIds = tokens.map((token) => {
|
|
48
|
-
return this.verifyChecksum(
|
|
49
|
+
return this.verifyChecksum(generic_1.appendHexPrefix(token.tokenAddress));
|
|
49
50
|
});
|
|
50
51
|
const provider = this.getProvider();
|
|
51
52
|
const contractAddress = this.getBalanceReaderAddress();
|
|
@@ -90,22 +91,20 @@ class ETHClient {
|
|
|
90
91
|
const { fromToken, toToken, amount, toAddress, fromAddress, recoveryAddress, signer, gasPriceGwei, gasLimit, feeAmount, signCompleteCallback, } = params;
|
|
91
92
|
const networkConfig = this.getNetworkConfig();
|
|
92
93
|
const rpcProvider = this.getProvider();
|
|
93
|
-
|
|
94
|
-
if (!recoveryAddress.match(recoveryAddrRegex)) {
|
|
94
|
+
if (!recoveryAddress.match(/^swth[a-z0-9]{39}$/)) {
|
|
95
95
|
throw new Error("Invalid recovery address");
|
|
96
96
|
}
|
|
97
|
-
const carbonNetwork = networkConfig.network;
|
|
98
97
|
const fromTokenId = fromToken.id;
|
|
99
|
-
const fromTokenAddress =
|
|
98
|
+
const fromTokenAddress = generic_1.appendHexPrefix(fromToken.tokenAddress);
|
|
100
99
|
const toTokenDenom = toToken.denom;
|
|
101
|
-
const recoveryAddressHex = ethers_1.ethers.utils.hexlify(util_1.AddressUtils.SWTHAddress.getAddressBytes(recoveryAddress,
|
|
100
|
+
const recoveryAddressHex = ethers_1.ethers.utils.hexlify(util_1.AddressUtils.SWTHAddress.getAddressBytes(recoveryAddress, CarbonSDK_1.default.Network.MainNet));
|
|
102
101
|
const fromAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(fromTokenId));
|
|
103
102
|
const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(toTokenDenom));
|
|
104
103
|
const nonce = yield rpcProvider.getTransactionCount(fromAddress);
|
|
105
104
|
const contract = new ethers_1.ethers.Contract(this.getBridgeEntranceAddr(), eth_1.ABIs.bridgeEntrance, rpcProvider);
|
|
106
|
-
const feeAddress =
|
|
105
|
+
const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
|
|
107
106
|
const tokenCreator = fromToken.creator;
|
|
108
|
-
const targetAddressBytes = util_1.AddressUtils.SWTHAddress.getAddressBytes(tokenCreator,
|
|
107
|
+
const targetAddressBytes = util_1.AddressUtils.SWTHAddress.getAddressBytes(tokenCreator, CarbonSDK_1.default.Network.MainNet);
|
|
109
108
|
const targetProxyHash = ethers_1.ethers.utils.hexlify(targetAddressBytes);
|
|
110
109
|
const ethAmount = fromToken.tokenAddress === constant_1.NativeTokenHash ? amount : number_1.BN_ZERO;
|
|
111
110
|
const bridgeResultTx = yield contract.connect(signer).lock(fromTokenAddress, // the asset to deposit (from) (0x00 if eth)
|
|
@@ -138,9 +137,9 @@ class ETHClient {
|
|
|
138
137
|
throw new Error("Minimum gas required: 150,000");
|
|
139
138
|
}
|
|
140
139
|
const networkConfig = this.getNetworkConfig();
|
|
141
|
-
const assetId =
|
|
142
|
-
const targetProxyHash =
|
|
143
|
-
const feeAddress =
|
|
140
|
+
const assetId = generic_1.appendHexPrefix(token.tokenAddress);
|
|
141
|
+
const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(token));
|
|
142
|
+
const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
|
|
144
143
|
const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(token.id));
|
|
145
144
|
const swthAddress = ethers_1.ethers.utils.hexlify(address);
|
|
146
145
|
const contractAddress = this.getLockProxyAddress();
|
|
@@ -191,16 +190,16 @@ class ETHClient {
|
|
|
191
190
|
return "insufficient balance";
|
|
192
191
|
}
|
|
193
192
|
const networkConfig = this.getNetworkConfig();
|
|
194
|
-
const assetId =
|
|
195
|
-
const targetProxyHash =
|
|
196
|
-
const feeAddress =
|
|
193
|
+
const assetId = generic_1.appendHexPrefix(tokenWithExternalBalances.tokenAddress);
|
|
194
|
+
const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(tokenWithExternalBalances));
|
|
195
|
+
const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
|
|
197
196
|
const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(tokenWithExternalBalances.id));
|
|
198
197
|
const nonce = Math.floor(Math.random() * 1000000000); // random nonce to prevent replay attacks
|
|
199
198
|
const message = ethers_1.ethers.utils.solidityKeccak256(["string", "address", "bytes", "bytes", "bytes", "uint256", "uint256", "uint256"], ["sendTokens", assetId, targetProxyHash, toAssetHash, feeAddress, amount, feeAmount, nonce]);
|
|
200
199
|
// logger("sendDeposit message", message)
|
|
201
200
|
let signatureResult;
|
|
202
201
|
const { address, signature } = yield getSignatureCallback(message);
|
|
203
|
-
const signatureBytes = ethers_1.ethers.utils.arrayify(
|
|
202
|
+
const signatureBytes = ethers_1.ethers.utils.arrayify(generic_1.appendHexPrefix(signature));
|
|
204
203
|
const rsv = ethers_1.ethers.utils.splitSignature(signatureBytes);
|
|
205
204
|
// logger("sign result", address, signature)
|
|
206
205
|
signatureResult = {
|
|
@@ -239,7 +238,7 @@ class ETHClient {
|
|
|
239
238
|
if (!feeInfo.deposit_fee) {
|
|
240
239
|
throw new Error("unsupported token");
|
|
241
240
|
}
|
|
242
|
-
if (
|
|
241
|
+
if (blockchain_1.blockchainForChainId(token.chainId.toNumber()) !== this.blockchain) {
|
|
243
242
|
throw new Error("unsupported token");
|
|
244
243
|
}
|
|
245
244
|
let feeAmount = ethers_1.ethers.BigNumber.from(feeInfo.deposit_fee);
|
|
@@ -305,7 +304,7 @@ class ETHClient {
|
|
|
305
304
|
getTargetProxyHash(token) {
|
|
306
305
|
const networkConfig = this.getNetworkConfig();
|
|
307
306
|
const addressBytes = address_1.SWTHAddress.getAddressBytes(token.creator, networkConfig.network);
|
|
308
|
-
const addressHex =
|
|
307
|
+
const addressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
|
|
309
308
|
return addressHex;
|
|
310
309
|
}
|
|
311
310
|
getProvider() {
|
|
@@ -29,7 +29,7 @@ exports.HydrogenEndpoints = {
|
|
|
29
29
|
const formatDateField = (value) => {
|
|
30
30
|
if (typeof value !== "string")
|
|
31
31
|
return null;
|
|
32
|
-
return
|
|
32
|
+
return dayjs_1.default(value);
|
|
33
33
|
};
|
|
34
34
|
const formatCrossChainTransfer = (value) => {
|
|
35
35
|
var _a, _b;
|
package/lib/clients/NEOClient.js
CHANGED
|
@@ -64,13 +64,13 @@ class NEOClient {
|
|
|
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) =>
|
|
67
|
+
const tokens = tokenQueryResults.filter((token) => blockchain_1.blockchainForChainId(token.chainId.toNumber()) == this.blockchain &&
|
|
68
68
|
token.tokenAddress.length == 40 &&
|
|
69
69
|
token.bridgeAddress.length == 40);
|
|
70
70
|
const client = new Neon.rpc.RPCClient(url, "2.5.2"); // TODO: should we change the RPC version??
|
|
71
71
|
// NOTE: fetching of tokens is chunked in sets of 15 as we may hit
|
|
72
72
|
// the gas limit on the RPC node and error out otherwise
|
|
73
|
-
const promises =
|
|
73
|
+
const promises = lodash_1.chunk(tokens, 75).map((partition) => __awaiter(this, void 0, void 0, function* () {
|
|
74
74
|
var _a, _b, _c;
|
|
75
75
|
let acc = {};
|
|
76
76
|
for (const token of partition) {
|
|
@@ -112,8 +112,8 @@ class NEOClient {
|
|
|
112
112
|
const targetProxyHash = this.getTargetProxyHash(token);
|
|
113
113
|
const toAssetHash = Neon.u.str2hexstring(token.id);
|
|
114
114
|
const addressBytes = address_1.SWTHAddress.getAddressBytes(swthAddress, networkConfig.network);
|
|
115
|
-
const toAddress =
|
|
116
|
-
const zeroAddressHex =
|
|
115
|
+
const toAddress = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
|
|
116
|
+
const zeroAddressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(constant_1.ZeroAddress));
|
|
117
117
|
const amount = ethers_1.ethers.BigNumber.from(token.externalBalance);
|
|
118
118
|
const feeAmount = ethers_1.ethers.BigNumber.from(feeAmountInput !== null && feeAmountInput !== void 0 ? feeAmountInput : "100000000");
|
|
119
119
|
const feeAddress = feeAmount.isZero() ? zeroAddressHex : networkConfig.feeAddress;
|
|
@@ -160,7 +160,7 @@ class NEOClient {
|
|
|
160
160
|
const fromAddress = util_1.AddressUtils.NEOAddress.publicKeyToAddress(publicKeyOutput.publicKey);
|
|
161
161
|
const targetProxyHash = this.getTargetProxyHash(token);
|
|
162
162
|
const toAssetHash = Neon.u.str2hexstring(token.id);
|
|
163
|
-
const toAddress =
|
|
163
|
+
const toAddress = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(address));
|
|
164
164
|
const nonce = Math.floor(Math.random() * 1000000);
|
|
165
165
|
if (amount.lt(feeAmount)) {
|
|
166
166
|
throw new Error("Invalid amount");
|
|
@@ -196,7 +196,7 @@ class NEOClient {
|
|
|
196
196
|
const fromAddress = ledger.scriptHash;
|
|
197
197
|
const targetProxyHash = this.getTargetProxyHash(token);
|
|
198
198
|
const toAssetHash = Neon.u.str2hexstring(token.id);
|
|
199
|
-
const toAddress =
|
|
199
|
+
const toAddress = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(address));
|
|
200
200
|
const feeAddress = networkConfig.feeAddress;
|
|
201
201
|
const nonce = Math.floor(Math.random() * 1000000);
|
|
202
202
|
if (amount.lt(feeAmount)) {
|
|
@@ -316,7 +316,7 @@ class NEOClient {
|
|
|
316
316
|
getTargetProxyHash(token) {
|
|
317
317
|
const networkConfig = this.getNetworkConfig();
|
|
318
318
|
const addressBytes = address_1.SWTHAddress.getAddressBytes(token.creator, networkConfig.network);
|
|
319
|
-
const addressHex =
|
|
319
|
+
const addressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
|
|
320
320
|
return addressHex;
|
|
321
321
|
}
|
|
322
322
|
getNetworkConfig() {
|
|
@@ -81,7 +81,6 @@ class TokenClient {
|
|
|
81
81
|
}
|
|
82
82
|
getBlockchain(denom) {
|
|
83
83
|
var _a, _b, _c;
|
|
84
|
-
const networkConfig = this.configProvider.getConfig();
|
|
85
84
|
// chainId defaults to 3 so that blockchain will be undefined
|
|
86
85
|
let chainId = (_c = (_b = (_a = this.tokens[denom]) === null || _a === void 0 ? void 0 : _a.chainId) === null || _b === void 0 ? void 0 : _b.toNumber()) !== null && _c !== void 0 ? _c : 3;
|
|
87
86
|
if (this.isNativeToken(denom) || this.isNativeStablecoin(denom) || TokenClient.isPoolToken(denom) || TokenClient.isCdpToken(denom)) {
|
|
@@ -92,7 +91,7 @@ class TokenClient {
|
|
|
92
91
|
if (TokenClient.isIBCDenom(denom)) {
|
|
93
92
|
return util_1.IBCUtils.BlockchainMap[denom];
|
|
94
93
|
}
|
|
95
|
-
const blockchain = util_1.BlockchainUtils.blockchainForChainId(chainId
|
|
94
|
+
const blockchain = util_1.BlockchainUtils.blockchainForChainId(chainId);
|
|
96
95
|
return blockchain;
|
|
97
96
|
}
|
|
98
97
|
getSymbol(denom) {
|
|
@@ -230,7 +229,6 @@ class TokenClient {
|
|
|
230
229
|
return result;
|
|
231
230
|
}
|
|
232
231
|
getWrappedToken(denom, blockchain) {
|
|
233
|
-
const networkConfig = this.configProvider.getConfig();
|
|
234
232
|
// if denom is already a wrapped denom or no blockchain was specified,
|
|
235
233
|
// just return the input denom.
|
|
236
234
|
if (this.wrapperMap[denom] || !blockchain) {
|
|
@@ -245,7 +243,7 @@ class TokenClient {
|
|
|
245
243
|
}
|
|
246
244
|
// check if wrapped denom is of correct blockchain
|
|
247
245
|
const token = this.tokens[wrappedDenom];
|
|
248
|
-
let tokenChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber()
|
|
246
|
+
let tokenChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber());
|
|
249
247
|
if (TokenClient.isIBCDenom(wrappedDenom)) {
|
|
250
248
|
tokenChain = util_1.IBCUtils.BlockchainMap[wrappedDenom];
|
|
251
249
|
}
|
|
@@ -284,14 +282,13 @@ class TokenClient {
|
|
|
284
282
|
return denom === "usc";
|
|
285
283
|
}
|
|
286
284
|
getDepositTokenFor(tokenDenom, chain) {
|
|
287
|
-
const networkConfig = this.configProvider.getConfig();
|
|
288
285
|
const token = this.tokenForDenom(tokenDenom);
|
|
289
286
|
if (!token) {
|
|
290
287
|
console.error("getDepositTokenFor token not found for", tokenDenom);
|
|
291
288
|
return;
|
|
292
289
|
}
|
|
293
290
|
// check if selected token is a source token
|
|
294
|
-
let targetChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber()
|
|
291
|
+
let targetChain = util_1.BlockchainUtils.blockchainForChainId(token.chainId.toNumber());
|
|
295
292
|
if (TokenClient.isIBCDenom(token.denom)) {
|
|
296
293
|
targetChain = util_1.IBCUtils.BlockchainMap[token.denom];
|
|
297
294
|
}
|
package/lib/clients/ZILClient.js
CHANGED
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ZILClient = exports.balanceBatchRequest = exports.tokenBalanceBatchRequest = exports.BatchRequestType = void 0;
|
|
16
|
+
const CarbonSDK_1 = __importDefault(require("../CarbonSDK"));
|
|
16
17
|
const index_1 = require("../index");
|
|
17
18
|
const address_1 = require("../util/address");
|
|
18
19
|
const blockchain_1 = require("../util/blockchain");
|
|
@@ -72,12 +73,12 @@ class ZILClient {
|
|
|
72
73
|
getExternalBalances(sdk, address, whitelistDenoms) {
|
|
73
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
75
|
const tokenQueryResults = yield sdk.token.getAllTokens();
|
|
75
|
-
const tokens = tokenQueryResults.filter((token) =>
|
|
76
|
+
const tokens = tokenQueryResults.filter((token) => blockchain_1.blockchainForChainId(token.chainId.toNumber()) == this.blockchain &&
|
|
76
77
|
token.tokenAddress.length == 40 &&
|
|
77
78
|
(!whitelistDenoms || whitelistDenoms.includes(token.denom)));
|
|
78
79
|
const requests = tokens.map((token) => token.tokenAddress === zeroAddress
|
|
79
|
-
?
|
|
80
|
-
:
|
|
80
|
+
? exports.balanceBatchRequest(address.replace(/^0x/i, ""))
|
|
81
|
+
: exports.tokenBalanceBatchRequest(token.tokenAddress, address));
|
|
81
82
|
const response = yield fetch(this.getProviderUrl(), {
|
|
82
83
|
method: "post",
|
|
83
84
|
headers: { "content-type": "application/json" },
|
|
@@ -102,7 +103,7 @@ class ZILClient {
|
|
|
102
103
|
// if (!isValidAddress) {
|
|
103
104
|
// throw new Error("invalid address")
|
|
104
105
|
// }
|
|
105
|
-
return
|
|
106
|
+
return zilliqa_1.fromBech32Address(bech32Address).toLowerCase().substr(2);
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
// see examplesV2/zil_client.ts on how to confirm the transactions
|
|
@@ -148,7 +149,7 @@ class ZILClient {
|
|
|
148
149
|
zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
|
|
149
150
|
}
|
|
150
151
|
const deployedContract = (this.walletProvider || zilliqa).contracts.at(contractAddress);
|
|
151
|
-
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(
|
|
152
|
+
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(generic_1.stripHexPrefix(zilAddress));
|
|
152
153
|
if (balanceAndNonceResp.error !== undefined) {
|
|
153
154
|
throw new Error(balanceAndNonceResp.error.message);
|
|
154
155
|
}
|
|
@@ -166,7 +167,7 @@ class ZILClient {
|
|
|
166
167
|
vname: "spender",
|
|
167
168
|
type: "ByStr20",
|
|
168
169
|
// TODO: Check if bridgeAddress corresponds to carbon token lock_proxy_hash
|
|
169
|
-
value: spenderAddress !== null && spenderAddress !== void 0 ? spenderAddress :
|
|
170
|
+
value: spenderAddress !== null && spenderAddress !== void 0 ? spenderAddress : generic_1.appendHexPrefix(token.bridgeAddress),
|
|
170
171
|
},
|
|
171
172
|
{
|
|
172
173
|
vname: "amount",
|
|
@@ -184,7 +185,7 @@ class ZILClient {
|
|
|
184
185
|
}
|
|
185
186
|
checkAllowanceZRC2(token, owner, spender) {
|
|
186
187
|
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
-
const contractAddress =
|
|
188
|
+
const contractAddress = generic_1.appendHexPrefix(token.tokenAddress);
|
|
188
189
|
const zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
|
|
189
190
|
const resp = yield zilliqa.blockchain.getSmartContractSubState(contractAddress, "allowances", [owner, spender]);
|
|
190
191
|
if (resp.error !== undefined) {
|
|
@@ -200,19 +201,17 @@ class ZILClient {
|
|
|
200
201
|
return __awaiter(this, void 0, void 0, function* () {
|
|
201
202
|
const { fromToken, toToken, amount, fromAddress, recoveryAddress, toAddress, signer, gasPrice, gasLimit, feeAmount, signCompleteCallback, } = params;
|
|
202
203
|
const networkConfig = this.getNetworkConfig();
|
|
203
|
-
|
|
204
|
-
if (!recoveryAddress.match(recoveryAddrRegex)) {
|
|
204
|
+
if (!recoveryAddress.match(/^swth[a-z0-9]{39}$/)) {
|
|
205
205
|
throw new Error("Invalid recovery address");
|
|
206
206
|
}
|
|
207
|
-
const carbonNetwork = networkConfig.network;
|
|
208
207
|
const fromTokenId = fromToken.id;
|
|
209
|
-
const fromTokenAddr =
|
|
208
|
+
const fromTokenAddr = generic_1.appendHexPrefix(fromToken.tokenAddress);
|
|
210
209
|
const toTokenDenom = toToken.denom;
|
|
211
|
-
const targetProxyHash =
|
|
212
|
-
const recoveryAddressHex = ethers_1.ethers.utils.hexlify(index_1.AddressUtils.SWTHAddress.getAddressBytes(recoveryAddress,
|
|
210
|
+
const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(fromToken));
|
|
211
|
+
const recoveryAddressHex = ethers_1.ethers.utils.hexlify(index_1.AddressUtils.SWTHAddress.getAddressBytes(recoveryAddress, CarbonSDK_1.default.Network.MainNet));
|
|
213
212
|
const fromAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(fromTokenId));
|
|
214
213
|
const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(toTokenDenom));
|
|
215
|
-
const feeAddress =
|
|
214
|
+
const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
|
|
216
215
|
const contractAddress = this.getBridgeEntranceAddr();
|
|
217
216
|
let zilliqa;
|
|
218
217
|
if (typeof signer === "string") {
|
|
@@ -227,7 +226,7 @@ class ZILClient {
|
|
|
227
226
|
zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
|
|
228
227
|
}
|
|
229
228
|
const deployedContract = (this.walletProvider || zilliqa).contracts.at(contractAddress);
|
|
230
|
-
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(
|
|
229
|
+
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(generic_1.stripHexPrefix(fromAddress));
|
|
231
230
|
if (balanceAndNonceResp.error !== undefined) {
|
|
232
231
|
throw new Error(balanceAndNonceResp.error.message);
|
|
233
232
|
}
|
|
@@ -304,13 +303,13 @@ class ZILClient {
|
|
|
304
303
|
return __awaiter(this, void 0, void 0, function* () {
|
|
305
304
|
const { address, amount, token, gasPrice, gasLimit, zilAddress, signer } = params;
|
|
306
305
|
const networkConfig = this.getNetworkConfig();
|
|
307
|
-
const assetId =
|
|
308
|
-
const targetProxyHash =
|
|
309
|
-
const feeAddress =
|
|
306
|
+
const assetId = generic_1.appendHexPrefix(token.tokenAddress);
|
|
307
|
+
const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(token));
|
|
308
|
+
const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
|
|
310
309
|
const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(token.id));
|
|
311
310
|
const swthAddress = ethers_1.ethers.utils.hexlify(address);
|
|
312
311
|
// TODO: Check if bridgeAddress corresponds to carbon token lock_proxy_hash
|
|
313
|
-
const contractAddress =
|
|
312
|
+
const contractAddress = generic_1.appendHexPrefix(token.bridgeAddress);
|
|
314
313
|
let zilliqa;
|
|
315
314
|
if (typeof signer === "string") {
|
|
316
315
|
zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
|
|
@@ -324,7 +323,7 @@ class ZILClient {
|
|
|
324
323
|
zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
|
|
325
324
|
}
|
|
326
325
|
const deployedContract = (this.walletProvider || zilliqa).contracts.at(contractAddress);
|
|
327
|
-
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(
|
|
326
|
+
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(generic_1.stripHexPrefix(zilAddress));
|
|
328
327
|
if (balanceAndNonceResp.error !== undefined) {
|
|
329
328
|
throw new Error(balanceAndNonceResp.error.message);
|
|
330
329
|
}
|
|
@@ -409,7 +408,7 @@ class ZILClient {
|
|
|
409
408
|
getTargetProxyHash(token) {
|
|
410
409
|
const networkConfig = this.getNetworkConfig();
|
|
411
410
|
const addressBytes = address_1.SWTHAddress.getAddressBytes(token.creator, networkConfig.network);
|
|
412
|
-
const addressHex =
|
|
411
|
+
const addressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
|
|
413
412
|
return addressHex;
|
|
414
413
|
}
|
|
415
414
|
getNetworkConfig() {
|
|
@@ -3,7 +3,6 @@ import _m0 from "protobufjs/minimal";
|
|
|
3
3
|
export declare const protobufPackage = "Switcheo.carbon.cdp";
|
|
4
4
|
export interface AssetParams {
|
|
5
5
|
denom: string;
|
|
6
|
-
/** deprecated: oracle_id is now on pricing */
|
|
7
6
|
oracleId: string;
|
|
8
7
|
rateStrategyName: string;
|
|
9
8
|
allowRepayStablecoinInterestDebt: boolean;
|
package/lib/codec/cdp/tx.d.ts
CHANGED
|
@@ -290,12 +290,6 @@ export interface MsgLiquidateCollateralWithStablecoinAndInterestInCollateral {
|
|
|
290
290
|
}
|
|
291
291
|
export interface MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse {
|
|
292
292
|
}
|
|
293
|
-
export interface MsgConvertTokenInCdpToGroupTokens {
|
|
294
|
-
creator: string;
|
|
295
|
-
denom: string;
|
|
296
|
-
}
|
|
297
|
-
export interface MsgConvertTokenInCdpToGroupTokensResponse {
|
|
298
|
-
}
|
|
299
293
|
export declare const MsgAddRateStrategy: {
|
|
300
294
|
encode(message: MsgAddRateStrategy, writer?: _m0.Writer): _m0.Writer;
|
|
301
295
|
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): MsgAddRateStrategy;
|
|
@@ -814,20 +808,6 @@ export declare const MsgLiquidateCollateralWithStablecoinAndInterestInCollateral
|
|
|
814
808
|
toJSON(_: MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse): unknown;
|
|
815
809
|
fromPartial(_: DeepPartial<MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse>): MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse;
|
|
816
810
|
};
|
|
817
|
-
export declare const MsgConvertTokenInCdpToGroupTokens: {
|
|
818
|
-
encode(message: MsgConvertTokenInCdpToGroupTokens, writer?: _m0.Writer): _m0.Writer;
|
|
819
|
-
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): MsgConvertTokenInCdpToGroupTokens;
|
|
820
|
-
fromJSON(object: any): MsgConvertTokenInCdpToGroupTokens;
|
|
821
|
-
toJSON(message: MsgConvertTokenInCdpToGroupTokens): unknown;
|
|
822
|
-
fromPartial(object: DeepPartial<MsgConvertTokenInCdpToGroupTokens>): MsgConvertTokenInCdpToGroupTokens;
|
|
823
|
-
};
|
|
824
|
-
export declare const MsgConvertTokenInCdpToGroupTokensResponse: {
|
|
825
|
-
encode(_: MsgConvertTokenInCdpToGroupTokensResponse, writer?: _m0.Writer): _m0.Writer;
|
|
826
|
-
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): MsgConvertTokenInCdpToGroupTokensResponse;
|
|
827
|
-
fromJSON(_: any): MsgConvertTokenInCdpToGroupTokensResponse;
|
|
828
|
-
toJSON(_: MsgConvertTokenInCdpToGroupTokensResponse): unknown;
|
|
829
|
-
fromPartial(_: DeepPartial<MsgConvertTokenInCdpToGroupTokensResponse>): MsgConvertTokenInCdpToGroupTokensResponse;
|
|
830
|
-
};
|
|
831
811
|
/** Msg defines the Msg service. */
|
|
832
812
|
export interface Msg {
|
|
833
813
|
AddRateStrategy(request: MsgAddRateStrategy): Promise<MsgAddRateStrategyResponse>;
|
|
@@ -866,9 +846,8 @@ export interface Msg {
|
|
|
866
846
|
ReturnStablecoinWithInterestInCdpTokens(request: MsgReturnStablecoinWithInterestInCdpTokens): Promise<MsgReturnStablecoinWithInterestInCdpTokensResponse>;
|
|
867
847
|
ReturnStablecoinWithInterestInCollateral(request: MsgReturnStablecoinWithInterestInCollateral): Promise<MsgReturnStablecoinWithInterestInCollateralResponse>;
|
|
868
848
|
LiquidateCollateralWithStablecoinAndInterestInCdpTokens(request: MsgLiquidateCollateralWithStablecoinAndInterestInCdpTokens): Promise<MsgLiquidateCollateralWithStablecoinAndInterestInCdpTokensResponse>;
|
|
869
|
-
LiquidateCollateralWithStablecoinAndInterestInCollateral(request: MsgLiquidateCollateralWithStablecoinAndInterestInCollateral): Promise<MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse>;
|
|
870
849
|
/** this line is used by starport scaffolding # proto/tx/rpc */
|
|
871
|
-
|
|
850
|
+
LiquidateCollateralWithStablecoinAndInterestInCollateral(request: MsgLiquidateCollateralWithStablecoinAndInterestInCollateral): Promise<MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse>;
|
|
872
851
|
}
|
|
873
852
|
export declare class MsgClientImpl implements Msg {
|
|
874
853
|
private readonly rpc;
|
|
@@ -910,7 +889,6 @@ export declare class MsgClientImpl implements Msg {
|
|
|
910
889
|
ReturnStablecoinWithInterestInCollateral(request: MsgReturnStablecoinWithInterestInCollateral): Promise<MsgReturnStablecoinWithInterestInCollateralResponse>;
|
|
911
890
|
LiquidateCollateralWithStablecoinAndInterestInCdpTokens(request: MsgLiquidateCollateralWithStablecoinAndInterestInCdpTokens): Promise<MsgLiquidateCollateralWithStablecoinAndInterestInCdpTokensResponse>;
|
|
912
891
|
LiquidateCollateralWithStablecoinAndInterestInCollateral(request: MsgLiquidateCollateralWithStablecoinAndInterestInCollateral): Promise<MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse>;
|
|
913
|
-
ConvertTokenInCdpToGroupTokens(request: MsgConvertTokenInCdpToGroupTokens): Promise<MsgConvertTokenInCdpToGroupTokensResponse>;
|
|
914
892
|
}
|
|
915
893
|
interface Rpc {
|
|
916
894
|
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
package/lib/codec/cdp/tx.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MsgSetSmallLiquidationSize = exports.MsgSetMinimumCloseFactorResponse = exports.MsgSetMinimumCloseFactor = exports.MsgSetCompleteLiquidationThresholdResponse = exports.MsgSetCompleteLiquidationThreshold = exports.MsgReturnStablecoinResponse = exports.MsgReturnStablecoin = exports.MsgMintStablecoinResponse = exports.MsgMintStablecoin = exports.MsgSetStablecoinMintCapResponse = exports.MsgSetStablecoinMintCap = exports.MsgSetStablecoinInterestRateResponse = exports.MsgSetStablecoinInterestRate = exports.MsgRepayAssetWithCollateralResponse = exports.MsgRepayAssetWithCollateral = exports.MsgRepayAssetWithCdpTokensResponse = exports.MsgRepayAssetWithCdpTokens = exports.MsgSetInterestFeeResponse = exports.MsgSetInterestFee = exports.MsgSetLiquidationFeeResponse = exports.MsgSetLiquidationFee = exports.MsgLiquidateCollateralResponse = exports.MsgLiquidateCollateral = exports.MsgUnlockCollateralAndWithdrawAssetResponse = exports.MsgUnlockCollateralAndWithdrawAsset = exports.MsgSupplyAssetAndLockCollateralResponse = exports.MsgSupplyAssetAndLockCollateral = exports.MsgRepayAssetResponse = exports.MsgRepayAsset = exports.MsgBorrowAssetResponse = exports.MsgBorrowAsset = exports.MsgUnlockCollateralResponse = exports.MsgUnlockCollateral = exports.MsgLockCollateralResponse = exports.MsgLockCollateral = exports.MsgWithdrawAssetResponse = exports.MsgWithdrawAsset = exports.MsgSupplyAssetResponse = exports.MsgSupplyAsset = exports.MsgUpdateAssetResponse = exports.MsgUpdateAsset = exports.MsgAddAssetResponse = exports.MsgAddAsset = exports.MsgRemoveRateStrategyResponse = exports.MsgRemoveRateStrategy = exports.MsgUpdateRateStrategyResponse = exports.MsgUpdateRateStrategy = exports.MsgAddRateStrategyResponse = exports.MsgAddRateStrategy = exports.protobufPackage = void 0;
|
|
7
|
-
exports.MsgClientImpl = exports.
|
|
7
|
+
exports.MsgClientImpl = exports.MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse = exports.MsgLiquidateCollateralWithStablecoinAndInterestInCollateral = exports.MsgLiquidateCollateralWithStablecoinAndInterestInCdpTokensResponse = exports.MsgLiquidateCollateralWithStablecoinAndInterestInCdpTokens = exports.MsgReturnStablecoinWithInterestInCdpTokensResponse = exports.MsgReturnStablecoinWithInterestInCdpTokens = exports.MsgReturnStablecoinWithInterestInCollateralResponse = exports.MsgReturnStablecoinWithInterestInCollateral = exports.MsgSetCdpPausedResponse = exports.MsgSetCdpPaused = exports.MsgSetStalePriceGracePeriodResponse = exports.MsgSetStalePriceGracePeriod = exports.MsgClaimRewardsResponse = exports.MsgClaimRewards = exports.MsgUpdateRewardSchemeResponse = exports.MsgUpdateRewardScheme = exports.MsgCreateRewardSchemeResponse = exports.MsgCreateRewardScheme = exports.MsgLiquidateCollateralWithStablecoinResponse = exports.MsgLiquidateCollateralWithStablecoin = exports.MsgLiquidateCollateralWithCollateralResponse = exports.MsgLiquidateCollateralWithCollateral = exports.MsgLiquidateCollateralWithCdpTokensResponse = exports.MsgLiquidateCollateralWithCdpTokens = exports.MsgSetSmallLiquidationSizeResponse = void 0;
|
|
8
8
|
/* eslint-disable */
|
|
9
9
|
const long_1 = __importDefault(require("long"));
|
|
10
10
|
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
@@ -4328,98 +4328,6 @@ exports.MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse = {
|
|
|
4328
4328
|
return message;
|
|
4329
4329
|
},
|
|
4330
4330
|
};
|
|
4331
|
-
const baseMsgConvertTokenInCdpToGroupTokens = {
|
|
4332
|
-
creator: "",
|
|
4333
|
-
denom: "",
|
|
4334
|
-
};
|
|
4335
|
-
exports.MsgConvertTokenInCdpToGroupTokens = {
|
|
4336
|
-
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
4337
|
-
if (message.creator !== "") {
|
|
4338
|
-
writer.uint32(10).string(message.creator);
|
|
4339
|
-
}
|
|
4340
|
-
if (message.denom !== "") {
|
|
4341
|
-
writer.uint32(18).string(message.denom);
|
|
4342
|
-
}
|
|
4343
|
-
return writer;
|
|
4344
|
-
},
|
|
4345
|
-
decode(input, length) {
|
|
4346
|
-
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
4347
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4348
|
-
const message = Object.assign({}, baseMsgConvertTokenInCdpToGroupTokens);
|
|
4349
|
-
while (reader.pos < end) {
|
|
4350
|
-
const tag = reader.uint32();
|
|
4351
|
-
switch (tag >>> 3) {
|
|
4352
|
-
case 1:
|
|
4353
|
-
message.creator = reader.string();
|
|
4354
|
-
break;
|
|
4355
|
-
case 2:
|
|
4356
|
-
message.denom = reader.string();
|
|
4357
|
-
break;
|
|
4358
|
-
default:
|
|
4359
|
-
reader.skipType(tag & 7);
|
|
4360
|
-
break;
|
|
4361
|
-
}
|
|
4362
|
-
}
|
|
4363
|
-
return message;
|
|
4364
|
-
},
|
|
4365
|
-
fromJSON(object) {
|
|
4366
|
-
const message = Object.assign({}, baseMsgConvertTokenInCdpToGroupTokens);
|
|
4367
|
-
message.creator =
|
|
4368
|
-
object.creator !== undefined && object.creator !== null
|
|
4369
|
-
? String(object.creator)
|
|
4370
|
-
: "";
|
|
4371
|
-
message.denom =
|
|
4372
|
-
object.denom !== undefined && object.denom !== null
|
|
4373
|
-
? String(object.denom)
|
|
4374
|
-
: "";
|
|
4375
|
-
return message;
|
|
4376
|
-
},
|
|
4377
|
-
toJSON(message) {
|
|
4378
|
-
const obj = {};
|
|
4379
|
-
message.creator !== undefined && (obj.creator = message.creator);
|
|
4380
|
-
message.denom !== undefined && (obj.denom = message.denom);
|
|
4381
|
-
return obj;
|
|
4382
|
-
},
|
|
4383
|
-
fromPartial(object) {
|
|
4384
|
-
var _a, _b;
|
|
4385
|
-
const message = Object.assign({}, baseMsgConvertTokenInCdpToGroupTokens);
|
|
4386
|
-
message.creator = (_a = object.creator) !== null && _a !== void 0 ? _a : "";
|
|
4387
|
-
message.denom = (_b = object.denom) !== null && _b !== void 0 ? _b : "";
|
|
4388
|
-
return message;
|
|
4389
|
-
},
|
|
4390
|
-
};
|
|
4391
|
-
const baseMsgConvertTokenInCdpToGroupTokensResponse = {};
|
|
4392
|
-
exports.MsgConvertTokenInCdpToGroupTokensResponse = {
|
|
4393
|
-
encode(_, writer = minimal_1.default.Writer.create()) {
|
|
4394
|
-
return writer;
|
|
4395
|
-
},
|
|
4396
|
-
decode(input, length) {
|
|
4397
|
-
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
4398
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4399
|
-
const message = Object.assign({}, baseMsgConvertTokenInCdpToGroupTokensResponse);
|
|
4400
|
-
while (reader.pos < end) {
|
|
4401
|
-
const tag = reader.uint32();
|
|
4402
|
-
switch (tag >>> 3) {
|
|
4403
|
-
default:
|
|
4404
|
-
reader.skipType(tag & 7);
|
|
4405
|
-
break;
|
|
4406
|
-
}
|
|
4407
|
-
}
|
|
4408
|
-
return message;
|
|
4409
|
-
},
|
|
4410
|
-
fromJSON(_) {
|
|
4411
|
-
const message = Object.assign({}, baseMsgConvertTokenInCdpToGroupTokensResponse);
|
|
4412
|
-
return message;
|
|
4413
|
-
},
|
|
4414
|
-
toJSON(_) {
|
|
4415
|
-
const obj = {};
|
|
4416
|
-
return obj;
|
|
4417
|
-
},
|
|
4418
|
-
fromPartial(_) {
|
|
4419
|
-
const message = Object.assign({}, baseMsgConvertTokenInCdpToGroupTokensResponse);
|
|
4420
|
-
return message;
|
|
4421
|
-
},
|
|
4422
|
-
};
|
|
4423
4331
|
class MsgClientImpl {
|
|
4424
4332
|
constructor(rpc) {
|
|
4425
4333
|
this.rpc = rpc;
|
|
@@ -4470,8 +4378,6 @@ class MsgClientImpl {
|
|
|
4470
4378
|
this.LiquidateCollateralWithStablecoinAndInterestInCdpTokens.bind(this);
|
|
4471
4379
|
this.LiquidateCollateralWithStablecoinAndInterestInCollateral =
|
|
4472
4380
|
this.LiquidateCollateralWithStablecoinAndInterestInCollateral.bind(this);
|
|
4473
|
-
this.ConvertTokenInCdpToGroupTokens =
|
|
4474
|
-
this.ConvertTokenInCdpToGroupTokens.bind(this);
|
|
4475
4381
|
}
|
|
4476
4382
|
AddRateStrategy(request) {
|
|
4477
4383
|
const data = exports.MsgAddRateStrategy.encode(request).finish();
|
|
@@ -4658,11 +4564,6 @@ class MsgClientImpl {
|
|
|
4658
4564
|
const promise = this.rpc.request("Switcheo.carbon.cdp.Msg", "LiquidateCollateralWithStablecoinAndInterestInCollateral", data);
|
|
4659
4565
|
return promise.then((data) => exports.MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse.decode(new minimal_1.default.Reader(data)));
|
|
4660
4566
|
}
|
|
4661
|
-
ConvertTokenInCdpToGroupTokens(request) {
|
|
4662
|
-
const data = exports.MsgConvertTokenInCdpToGroupTokens.encode(request).finish();
|
|
4663
|
-
const promise = this.rpc.request("Switcheo.carbon.cdp.Msg", "ConvertTokenInCdpToGroupTokens", data);
|
|
4664
|
-
return promise.then((data) => exports.MsgConvertTokenInCdpToGroupTokensResponse.decode(new minimal_1.default.Reader(data)));
|
|
4665
|
-
}
|
|
4666
4567
|
}
|
|
4667
4568
|
exports.MsgClientImpl = MsgClientImpl;
|
|
4668
4569
|
if (minimal_1.default.util.Long !== long_1.default) {
|