carbon-js-sdk 0.5.12-rc2 → 0.5.13
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/BatchQueryClient.js +4 -4
- package/lib/clients/CarbonQueryClient.js +2 -2
- package/lib/clients/ETHClient.js +15 -15
- package/lib/clients/GrpcQueryClient.d.ts +1 -1
- package/lib/clients/GrpcQueryClient.js +1 -1
- package/lib/clients/HydrogenClient.js +1 -1
- package/lib/clients/NEOClient.js +7 -7
- package/lib/clients/TokenClient.d.ts +4 -0
- package/lib/clients/TokenClient.js +58 -2
- package/lib/clients/ZILClient.js +17 -17
- package/lib/codec/alliance/query.d.ts +24 -3
- package/lib/codec/book/book.d.ts +1 -0
- package/lib/codec/book/book.js +14 -2
- package/lib/codec/cosmos/gov/v1/query.js +2 -2
- package/lib/codec/cosmos/gov/v1/tx.js +2 -2
- package/lib/codec/cosmos/gov/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/gov/v1beta1/tx.js +2 -2
- package/lib/codec/cosmos/group/v1/events.js +2 -2
- package/lib/codec/cosmos/group/v1/tx.js +4 -4
- package/lib/codec/cosmos/tx/v1beta1/tx.js +4 -4
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.js +7 -50
- package/lib/codec/insurance/genesis.d.ts +4 -11
- package/lib/codec/insurance/genesis.js +4 -37
- package/lib/codec/insurance/query.d.ts +0 -48
- package/lib/codec/insurance/query.js +1 -217
- package/lib/constant/generic.js +1 -1
- package/lib/constant/network.d.ts +2 -0
- package/lib/constant/network.js +5 -1
- package/lib/modules/cdp.js +44 -44
- package/lib/modules/cosmwasm.js +1 -1
- package/lib/modules/evm.js +5 -5
- package/lib/modules/gov.js +12 -12
- package/lib/modules/ibc.d.ts +2 -2
- package/lib/modules/ibc.js +37 -22
- package/lib/modules/liquiditypool.js +1 -1
- package/lib/modules/order.js +2 -2
- 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 +27 -27
- 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 +25 -25
- package/lib/provider/amino/types/coin.js +4 -4
- package/lib/provider/amino/types/erc20.js +2 -2
- package/lib/provider/amino/types/evm.js +2 -2
- package/lib/provider/amino/types/evmmerge.js +1 -1
- package/lib/provider/amino/types/feemarket.js +1 -1
- package/lib/provider/amino/types/gov.js +5 -5
- 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 +6 -6
- package/lib/provider/amino/types/oracle.js +2 -2
- package/lib/provider/amino/types/order.js +4 -4
- package/lib/provider/amino/types/perpsliquidity.js +6 -6
- 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/keplr/KeplrAccount.js +2 -2
- package/lib/provider/ledger/ledger.js +2 -2
- package/lib/provider/metamask/MetaMask.js +10 -10
- package/lib/provider/o3/O3Wallet.js +2 -2
- package/lib/util/address.js +14 -14
- package/lib/util/api.js +4 -4
- package/lib/util/blockchain.js +4 -4
- package/lib/util/eip712.js +3 -3
- package/lib/util/fetch.js +1 -1
- package/lib/util/generic.js +3 -3
- package/lib/util/legacyEIP712.js +2 -2
- package/lib/util/number.js +5 -5
- package/lib/wallet/CarbonSigner.js +2 -2
- package/lib/wallet/CarbonSigningClient.js +15 -15
- package/lib/wallet/CarbonWallet.js +9 -9
- package/lib/websocket/connector.js +3 -3
- package/package.json +1 -1
- package/lib/clients/GrpcNodeQueryClient.d.ts +0 -12
- package/lib/clients/GrpcNodeQueryClient.js +0 -53
- package/lib/clients/GrpcWebQueryClient.d.ts +0 -22
- package/lib/clients/GrpcWebQueryClient.js +0 -56
- package/lib/codec/ibc/applications/interchain_accounts/v1/genesis.d.ts +0 -76
- package/lib/codec/ibc/applications/interchain_accounts/v1/genesis.js +0 -424
|
@@ -29,7 +29,7 @@ class BatchQueryClient {
|
|
|
29
29
|
};
|
|
30
30
|
if (typeof endpoint === "string") {
|
|
31
31
|
// accept host.name:port and assume http protocol
|
|
32
|
-
this.url =
|
|
32
|
+
this.url = rpcclient_1.hasProtocol(endpoint) ? endpoint : "http://" + endpoint;
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
this.url = endpoint.url;
|
|
@@ -71,7 +71,7 @@ class BatchQueryClient {
|
|
|
71
71
|
return;
|
|
72
72
|
const requests = batch.map((s) => s.request);
|
|
73
73
|
const requestIds = requests.map((request) => request.id);
|
|
74
|
-
|
|
74
|
+
http_1.http("POST", this.url, this.headers, requests).then((raw) => {
|
|
75
75
|
// Requests with a single entry return as an object
|
|
76
76
|
const arr = Array.isArray(raw) ? raw : [raw];
|
|
77
77
|
arr.forEach((el, i) => {
|
|
@@ -79,8 +79,8 @@ class BatchQueryClient {
|
|
|
79
79
|
if (!req)
|
|
80
80
|
return;
|
|
81
81
|
const { reject, resolve } = req;
|
|
82
|
-
const response =
|
|
83
|
-
if (
|
|
82
|
+
const response = json_rpc_1.parseJsonRpcResponse(el);
|
|
83
|
+
if (json_rpc_1.isJsonRpcErrorResponse(response)) {
|
|
84
84
|
reject(new Error(JSON.stringify(response.error)));
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
@@ -53,7 +53,7 @@ class CarbonQueryClient {
|
|
|
53
53
|
constructor(tmClient) {
|
|
54
54
|
this.tmClient = tmClient;
|
|
55
55
|
this.baseClient = new stargate_1.QueryClient(this.tmClient);
|
|
56
|
-
const rpcClient =
|
|
56
|
+
const rpcClient = stargate_1.createProtobufRpcClient(this.baseClient);
|
|
57
57
|
this.chain = BlockchainClient_1.default.connectWithTm(this.tmClient);
|
|
58
58
|
this.adl = new query_1.QueryClientImpl(rpcClient);
|
|
59
59
|
this.alliance = new query_44.QueryClientImpl(rpcClient);
|
|
@@ -106,7 +106,7 @@ class CarbonQueryClient {
|
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
getProtobufRpcClient() {
|
|
109
|
-
return
|
|
109
|
+
return stargate_1.createProtobufRpcClient(this.baseClient);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
exports.default = CarbonQueryClient;
|
package/lib/clients/ETHClient.js
CHANGED
|
@@ -44,15 +44,15 @@ class ETHClient {
|
|
|
44
44
|
?
|
|
45
45
|
this.tokenClient.getBlockchainV2(token.denom) == ETHClient.BLOCKCHAINV2_MAPPING[this.blockchain]
|
|
46
46
|
:
|
|
47
|
-
|
|
47
|
+
blockchain_1.blockchainForChainId(token.chainId.toNumber(), api.network) == this.blockchain;
|
|
48
48
|
return isCorrectBlockchain &&
|
|
49
49
|
token.tokenAddress.length == 40 &&
|
|
50
|
-
token.bridgeAddress.toLowerCase() ==
|
|
50
|
+
token.bridgeAddress.toLowerCase() == generic_1.stripHexPrefix(lockProxyAddress) &&
|
|
51
51
|
(!whitelistDenoms || whitelistDenoms.includes(token.denom)) &&
|
|
52
|
-
this.verifyChecksum(
|
|
52
|
+
this.verifyChecksum(generic_1.appendHexPrefix(token.tokenAddress));
|
|
53
53
|
});
|
|
54
54
|
const assetIds = tokens.map((token) => {
|
|
55
|
-
return this.verifyChecksum(
|
|
55
|
+
return this.verifyChecksum(generic_1.appendHexPrefix(token.tokenAddress));
|
|
56
56
|
});
|
|
57
57
|
const provider = this.getProvider();
|
|
58
58
|
const contractAddress = this.getBalanceReaderAddress();
|
|
@@ -99,14 +99,14 @@ class ETHClient {
|
|
|
99
99
|
}
|
|
100
100
|
const carbonNetwork = networkConfig.network;
|
|
101
101
|
const fromTokenId = fromToken.id;
|
|
102
|
-
const fromTokenAddress =
|
|
102
|
+
const fromTokenAddress = generic_1.appendHexPrefix(fromToken.tokenAddress);
|
|
103
103
|
const toTokenDenom = toToken.denom;
|
|
104
104
|
const recoveryAddressHex = ethers_1.ethers.utils.hexlify(util_1.AddressUtils.SWTHAddress.getAddressBytes(recoveryAddress, carbonNetwork));
|
|
105
105
|
const fromAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(fromTokenId));
|
|
106
106
|
const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(toTokenDenom));
|
|
107
107
|
const nonce = yield this.getTxNonce(fromAddress, params.nonce, rpcProvider);
|
|
108
108
|
const contract = new ethers_1.ethers.Contract(this.getBridgeEntranceAddr(), eth_1.ABIs.bridgeEntrance, rpcProvider);
|
|
109
|
-
const feeAddress =
|
|
109
|
+
const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
|
|
110
110
|
const tokenCreator = fromToken.creator;
|
|
111
111
|
const targetAddressBytes = util_1.AddressUtils.SWTHAddress.getAddressBytes(tokenCreator, carbonNetwork);
|
|
112
112
|
const targetProxyHash = ethers_1.ethers.utils.hexlify(targetAddressBytes);
|
|
@@ -135,9 +135,9 @@ class ETHClient {
|
|
|
135
135
|
throw new Error("Minimum gas required: 150,000");
|
|
136
136
|
}
|
|
137
137
|
const networkConfig = this.getNetworkConfig();
|
|
138
|
-
const assetId =
|
|
139
|
-
const targetProxyHash =
|
|
140
|
-
const feeAddress =
|
|
138
|
+
const assetId = generic_1.appendHexPrefix(token.tokenAddress);
|
|
139
|
+
const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(token));
|
|
140
|
+
const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
|
|
141
141
|
const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(token.id));
|
|
142
142
|
const swthAddress = ethers_1.ethers.utils.hexlify(address);
|
|
143
143
|
const contractAddress = this.getLockProxyAddress();
|
|
@@ -188,16 +188,16 @@ class ETHClient {
|
|
|
188
188
|
return "insufficient balance";
|
|
189
189
|
}
|
|
190
190
|
const networkConfig = this.getNetworkConfig();
|
|
191
|
-
const assetId =
|
|
192
|
-
const targetProxyHash =
|
|
193
|
-
const feeAddress =
|
|
191
|
+
const assetId = generic_1.appendHexPrefix(tokenWithExternalBalances.tokenAddress);
|
|
192
|
+
const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(tokenWithExternalBalances));
|
|
193
|
+
const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
|
|
194
194
|
const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(tokenWithExternalBalances.id));
|
|
195
195
|
const nonce = Math.floor(Math.random() * 1000000000); // random nonce to prevent replay attacks
|
|
196
196
|
const message = ethers_1.ethers.utils.solidityKeccak256(["string", "address", "bytes", "bytes", "bytes", "uint256", "uint256", "uint256"], ["sendTokens", assetId, targetProxyHash, toAssetHash, feeAddress, amount, feeAmount, nonce]);
|
|
197
197
|
// logger("sendDeposit message", message)
|
|
198
198
|
let signatureResult;
|
|
199
199
|
const { address, signature } = yield getSignatureCallback(message);
|
|
200
|
-
const signatureBytes = ethers_1.ethers.utils.arrayify(
|
|
200
|
+
const signatureBytes = ethers_1.ethers.utils.arrayify(generic_1.appendHexPrefix(signature));
|
|
201
201
|
const rsv = ethers_1.ethers.utils.splitSignature(signatureBytes);
|
|
202
202
|
// logger("sign result", address, signature)
|
|
203
203
|
signatureResult = {
|
|
@@ -236,7 +236,7 @@ class ETHClient {
|
|
|
236
236
|
if (!feeInfo.deposit_fee) {
|
|
237
237
|
throw new Error("unsupported token");
|
|
238
238
|
}
|
|
239
|
-
if (
|
|
239
|
+
if (blockchain_1.blockchainForChainId(token.chainId.toNumber(), this.configProvider.getConfig().network) !== this.blockchain) {
|
|
240
240
|
throw new Error("unsupported token");
|
|
241
241
|
}
|
|
242
242
|
let feeAmount = ethers_1.ethers.BigNumber.from(feeInfo.deposit_fee);
|
|
@@ -302,7 +302,7 @@ class ETHClient {
|
|
|
302
302
|
getTargetProxyHash(token) {
|
|
303
303
|
const networkConfig = this.getNetworkConfig();
|
|
304
304
|
const addressBytes = address_1.SWTHAddress.getAddressBytes(token.creator, networkConfig.network);
|
|
305
|
-
const addressHex =
|
|
305
|
+
const addressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
|
|
306
306
|
return addressHex;
|
|
307
307
|
}
|
|
308
308
|
getProvider() {
|
|
@@ -7,7 +7,7 @@ export declare class GrpcWebError extends Error {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Uses grpc-web module on cosmos-sdk to simulate gRPC queries
|
|
10
|
-
*
|
|
10
|
+
* throught HTTP/1.1.
|
|
11
11
|
* see https://github.com/cosmos/cosmos-sdk/issues/7345
|
|
12
12
|
*/
|
|
13
13
|
export declare class GrpcQueryClient implements ProtobufRpcClient {
|
|
@@ -12,7 +12,7 @@ class GrpcWebError extends Error {
|
|
|
12
12
|
exports.GrpcWebError = GrpcWebError;
|
|
13
13
|
/**
|
|
14
14
|
* Uses grpc-web module on cosmos-sdk to simulate gRPC queries
|
|
15
|
-
*
|
|
15
|
+
* throught HTTP/1.1.
|
|
16
16
|
* see https://github.com/cosmos/cosmos-sdk/issues/7345
|
|
17
17
|
*/
|
|
18
18
|
class GrpcQueryClient {
|
|
@@ -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
|
// temporary function to parse okt/okc blockchain
|
|
35
35
|
// to remove when automatic deposit/withdraw feature is deployed
|
package/lib/clients/NEOClient.js
CHANGED
|
@@ -69,13 +69,13 @@ class NEOClient {
|
|
|
69
69
|
?
|
|
70
70
|
!!sdk.token.getBlockchainV2(token.denom) && (blockchain_1.BLOCKCHAIN_V2_TO_V1_MAPPING[sdk.token.getBlockchainV2(token.denom)] == this.blockchain)
|
|
71
71
|
:
|
|
72
|
-
|
|
72
|
+
blockchain_1.blockchainForChainId(token.chainId.toNumber(), sdk.network) == this.blockchain;
|
|
73
73
|
return (isCorrectBlockchain || token.denom === "swth") && token.tokenAddress.length == 40 && token.bridgeAddress.length == 40;
|
|
74
74
|
});
|
|
75
75
|
const client = new Neon.rpc.RPCClient(url, "2.5.2"); // TODO: should we change the RPC version??
|
|
76
76
|
// NOTE: fetching of tokens is chunked in sets of 15 as we may hit
|
|
77
77
|
// the gas limit on the RPC node and error out otherwise
|
|
78
|
-
const promises =
|
|
78
|
+
const promises = lodash_1.chunk(tokens, 75).map((partition) => __awaiter(this, void 0, void 0, function* () {
|
|
79
79
|
var _a, _b, _c;
|
|
80
80
|
let acc = {};
|
|
81
81
|
for (const token of partition) {
|
|
@@ -117,8 +117,8 @@ class NEOClient {
|
|
|
117
117
|
const targetProxyHash = this.getTargetProxyHash(token);
|
|
118
118
|
const toAssetHash = Neon.u.str2hexstring(token.id);
|
|
119
119
|
const addressBytes = address_1.SWTHAddress.getAddressBytes(swthAddress, networkConfig.network);
|
|
120
|
-
const toAddress =
|
|
121
|
-
const zeroAddressHex =
|
|
120
|
+
const toAddress = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
|
|
121
|
+
const zeroAddressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(constant_1.ZeroAddress));
|
|
122
122
|
const amount = ethers_1.ethers.BigNumber.from(token.externalBalance);
|
|
123
123
|
const feeAmount = ethers_1.ethers.BigNumber.from(feeAmountInput !== null && feeAmountInput !== void 0 ? feeAmountInput : "100000000");
|
|
124
124
|
const feeAddress = feeAmount.isZero() ? zeroAddressHex : networkConfig.feeAddress;
|
|
@@ -165,7 +165,7 @@ class NEOClient {
|
|
|
165
165
|
const fromAddress = util_1.AddressUtils.NEOAddress.publicKeyToAddress(publicKeyOutput.publicKey);
|
|
166
166
|
const targetProxyHash = this.getTargetProxyHash(token);
|
|
167
167
|
const toAssetHash = Neon.u.str2hexstring(token.id);
|
|
168
|
-
const toAddress =
|
|
168
|
+
const toAddress = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(address));
|
|
169
169
|
const nonce = Math.floor(Math.random() * 1000000);
|
|
170
170
|
if (amount.lt(feeAmount)) {
|
|
171
171
|
throw new Error("Invalid amount");
|
|
@@ -201,7 +201,7 @@ class NEOClient {
|
|
|
201
201
|
const fromAddress = ledger.scriptHash;
|
|
202
202
|
const targetProxyHash = this.getTargetProxyHash(token);
|
|
203
203
|
const toAssetHash = Neon.u.str2hexstring(token.id);
|
|
204
|
-
const toAddress =
|
|
204
|
+
const toAddress = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(address));
|
|
205
205
|
const feeAddress = networkConfig.feeAddress;
|
|
206
206
|
const nonce = Math.floor(Math.random() * 1000000);
|
|
207
207
|
if (amount.lt(feeAmount)) {
|
|
@@ -321,7 +321,7 @@ class NEOClient {
|
|
|
321
321
|
getTargetProxyHash(token) {
|
|
322
322
|
const networkConfig = this.getNetworkConfig();
|
|
323
323
|
const addressBytes = address_1.SWTHAddress.getAddressBytes(token.creator, networkConfig.network);
|
|
324
|
-
const addressHex =
|
|
324
|
+
const addressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
|
|
325
325
|
return addressHex;
|
|
326
326
|
}
|
|
327
327
|
getNetworkConfig() {
|
|
@@ -22,6 +22,7 @@ declare class TokenClient {
|
|
|
22
22
|
readonly usdValues: TypeUtils.SimpleMap<BigNumber>;
|
|
23
23
|
readonly commonAssetNames: TypeUtils.SimpleMap<string>;
|
|
24
24
|
readonly geckoTokenNames: TypeUtils.SimpleMap<string>;
|
|
25
|
+
readonly denomTraces: TypeUtils.SimpleMap<DenomTraceExtended>;
|
|
25
26
|
private additionalGeckoDenoms;
|
|
26
27
|
private constructor();
|
|
27
28
|
static instance(query: CarbonQueryClient, configProvider: NetworkConfigProvider): TokenClient;
|
|
@@ -60,6 +61,8 @@ declare class TokenClient {
|
|
|
60
61
|
getDepositTokenFor(tokenDenom: string, chain: BlockchainUtils.Blockchain | BlockchainUtils.BlockchainV2, version?: string): Token | undefined;
|
|
61
62
|
getAllTokens(): Promise<Token[]>;
|
|
62
63
|
reloadTokens(): Promise<TypeUtils.SimpleMap<Token>>;
|
|
64
|
+
reloadDenomTraces(): Promise<TypeUtils.SimpleMap<DenomTraceExtended>>;
|
|
65
|
+
getDenomTraceData(denom: string): DenomTrace | undefined;
|
|
63
66
|
getBridges(): Promise<BridgeMap>;
|
|
64
67
|
matchChainsWithDifferentChainIds(bridges: Bridge[]): Promise<IbcBridge[]>;
|
|
65
68
|
getIbcBlockchainNames(): string[];
|
|
@@ -72,6 +75,7 @@ declare class TokenClient {
|
|
|
72
75
|
getBlockchainV2FromIDs(chainId: string, bridgeId: string): BlockchainV2 | undefined;
|
|
73
76
|
getBridgeFromToken(token: Token | null): Bridge | IbcBridge | undefined;
|
|
74
77
|
getIbcChainIdFromToken(token: Token | null): string | undefined;
|
|
78
|
+
getCarbonDenomTraces(): Promise<TypeUtils.SimpleMap<DenomTrace>>;
|
|
75
79
|
getCdpUnderlyingToken(cdpDenom: string): Token | undefined;
|
|
76
80
|
reloadWrapperMap(): Promise<TypeUtils.SimpleMap<string>>;
|
|
77
81
|
reloadDenomGeckoMap(): Promise<void>;
|
|
@@ -16,9 +16,13 @@ const pagination_1 = require("../codec/cosmos/base/query/v1beta1/pagination");
|
|
|
16
16
|
const tendermint_1 = require("../codec/ibc/lightclients/tendermint/v1/tendermint");
|
|
17
17
|
const constant_1 = require("../constant");
|
|
18
18
|
const ibc_1 = require("../constant/ibc");
|
|
19
|
+
const network_1 = require("../constant/network");
|
|
19
20
|
const util_1 = require("../util");
|
|
20
21
|
const blockchain_1 = require("../util/blockchain");
|
|
21
22
|
const number_1 = require("../util/number");
|
|
23
|
+
const query_1 = require("../codec/ibc/applications/transfer/v1/query");
|
|
24
|
+
const stargate_1 = require("@cosmjs/stargate");
|
|
25
|
+
const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
|
|
22
26
|
const long_1 = __importDefault(require("long"));
|
|
23
27
|
const InsightsQueryClient_1 = __importDefault(require("./InsightsQueryClient"));
|
|
24
28
|
const SYMBOL_OVERRIDE = {
|
|
@@ -49,6 +53,8 @@ class TokenClient {
|
|
|
49
53
|
this.usdValues = {};
|
|
50
54
|
this.commonAssetNames = constant_1.CommonAssetName;
|
|
51
55
|
this.geckoTokenNames = constant_1.CoinGeckoTokenNames;
|
|
56
|
+
// ibc apis
|
|
57
|
+
this.denomTraces = {};
|
|
52
58
|
this.additionalGeckoDenoms = {};
|
|
53
59
|
this.getIbcChainFromBlockchainV2 = (blockchain) => {
|
|
54
60
|
const ibcBridge = this.bridges.ibc.find(bridge => (bridge.chainName === blockchain || bridge.chainName.toLowerCase() === blockchain));
|
|
@@ -73,6 +79,7 @@ class TokenClient {
|
|
|
73
79
|
try {
|
|
74
80
|
this.reloadDenomGeckoMap().finally(() => {
|
|
75
81
|
this.reloadUSDValues();
|
|
82
|
+
this.reloadDenomTraces();
|
|
76
83
|
});
|
|
77
84
|
}
|
|
78
85
|
catch (error) {
|
|
@@ -404,6 +411,29 @@ class TokenClient {
|
|
|
404
411
|
return this.tokens;
|
|
405
412
|
});
|
|
406
413
|
}
|
|
414
|
+
reloadDenomTraces() {
|
|
415
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
416
|
+
const result = yield this.query.ibc.transfer.DenomTraces({
|
|
417
|
+
pagination: {
|
|
418
|
+
limit: new long_1.default(1000000),
|
|
419
|
+
offset: long_1.default.UZERO,
|
|
420
|
+
key: new Uint8Array(),
|
|
421
|
+
countTotal: false,
|
|
422
|
+
reverse: false,
|
|
423
|
+
},
|
|
424
|
+
});
|
|
425
|
+
result.denomTraces.forEach((denomTrace) => {
|
|
426
|
+
const ibcDenom = util_1.IBCUtils.makeIBCMinimalDenom(denomTrace.path, denomTrace.baseDenom);
|
|
427
|
+
const token = this.tokenForDenom(ibcDenom);
|
|
428
|
+
this.denomTraces[ibcDenom] = Object.assign(Object.assign({}, denomTrace), { token });
|
|
429
|
+
});
|
|
430
|
+
const swthTraces = yield this.getCarbonDenomTraces();
|
|
431
|
+
return Object.assign(Object.assign({}, this.denomTraces), swthTraces);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
getDenomTraceData(denom) {
|
|
435
|
+
return this.denomTraces[denom];
|
|
436
|
+
}
|
|
407
437
|
getBridges() {
|
|
408
438
|
return __awaiter(this, void 0, void 0, function* () {
|
|
409
439
|
const allBridges = yield this.query.coin.BridgeAll({
|
|
@@ -546,10 +576,36 @@ class TokenClient {
|
|
|
546
576
|
if (!token)
|
|
547
577
|
return undefined;
|
|
548
578
|
const bridge = this.getBridgeFromToken(token);
|
|
549
|
-
if (!bridge || !
|
|
579
|
+
if (!bridge || !blockchain_1.isIbcBridge(bridge))
|
|
550
580
|
return undefined;
|
|
551
581
|
return bridge.chain_id_name;
|
|
552
582
|
}
|
|
583
|
+
getCarbonDenomTraces() {
|
|
584
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
585
|
+
// get swth on osmosis
|
|
586
|
+
const osmoTmClient = yield tendermint_rpc_1.Tendermint34Client.connect(network_1.publicRpcNodes.Osmosis);
|
|
587
|
+
const osmoClient = new stargate_1.QueryClient(osmoTmClient);
|
|
588
|
+
const osmosRpcClient = stargate_1.createProtobufRpcClient(osmoClient);
|
|
589
|
+
const osmoIbcClient = new query_1.QueryClientImpl(osmosRpcClient);
|
|
590
|
+
const osmoDenomTraces = yield osmoIbcClient.DenomTraces({
|
|
591
|
+
pagination: pagination_1.PageRequest.fromPartial({
|
|
592
|
+
limit: new long_1.default(1000000),
|
|
593
|
+
}),
|
|
594
|
+
});
|
|
595
|
+
const osmoSwthDenomTrace = osmoDenomTraces.denomTraces.filter((trace) => {
|
|
596
|
+
return trace.baseDenom === "swth";
|
|
597
|
+
});
|
|
598
|
+
return osmoSwthDenomTrace.reduce((prev, trace) => {
|
|
599
|
+
var _a;
|
|
600
|
+
const coinMinimalDenom = util_1.IBCUtils.makeIBCMinimalDenom(trace.path, trace.baseDenom);
|
|
601
|
+
const token = (_a = this.tokenForDenom(coinMinimalDenom)) !== null && _a !== void 0 ? _a : this.tokenForDenom(trace.baseDenom);
|
|
602
|
+
const traceExtended = Object.assign(Object.assign({}, trace), { token });
|
|
603
|
+
this.denomTraces[coinMinimalDenom] = traceExtended;
|
|
604
|
+
prev[coinMinimalDenom] = traceExtended;
|
|
605
|
+
return prev;
|
|
606
|
+
}, {});
|
|
607
|
+
});
|
|
608
|
+
}
|
|
553
609
|
getCdpUnderlyingToken(cdpDenom) {
|
|
554
610
|
if (!this.cdpTokens[cdpDenom]) {
|
|
555
611
|
console.error("not a CDP denom");
|
|
@@ -622,7 +678,7 @@ class TokenClient {
|
|
|
622
678
|
processTokenPrices(tokenPrices) {
|
|
623
679
|
return tokenPrices.reduce((prevPrices, price) => {
|
|
624
680
|
const newPrev = prevPrices;
|
|
625
|
-
newPrev[price.denom] =
|
|
681
|
+
newPrev[price.denom] = number_1.bnOrZero(price.twap).shiftedBy(-constant_1.decTypeDecimals);
|
|
626
682
|
return newPrev;
|
|
627
683
|
}, {});
|
|
628
684
|
}
|
package/lib/clients/ZILClient.js
CHANGED
|
@@ -77,12 +77,12 @@ class ZILClient {
|
|
|
77
77
|
?
|
|
78
78
|
!!sdk.token.getBlockchainV2(token.denom) && (blockchain_1.BLOCKCHAIN_V2_TO_V1_MAPPING[sdk.token.getBlockchainV2(token.denom)] == this.blockchain)
|
|
79
79
|
:
|
|
80
|
-
|
|
80
|
+
blockchain_1.blockchainForChainId(token.chainId.toNumber(), sdk.network) == this.blockchain;
|
|
81
81
|
return isCorrectBlockchain && token.tokenAddress.length == 40 && (!whitelistDenoms || whitelistDenoms.includes(token.denom));
|
|
82
82
|
});
|
|
83
83
|
const requests = tokens.map((token) => token.tokenAddress === zeroAddress
|
|
84
|
-
?
|
|
85
|
-
:
|
|
84
|
+
? exports.balanceBatchRequest(address.replace(/^0x/i, ""))
|
|
85
|
+
: exports.tokenBalanceBatchRequest(token.tokenAddress, address));
|
|
86
86
|
const response = yield fetch(this.getProviderUrl(), {
|
|
87
87
|
method: "post",
|
|
88
88
|
headers: { "content-type": "application/json" },
|
|
@@ -107,7 +107,7 @@ class ZILClient {
|
|
|
107
107
|
// if (!isValidAddress) {
|
|
108
108
|
// throw new Error("invalid address")
|
|
109
109
|
// }
|
|
110
|
-
return
|
|
110
|
+
return zilliqa_1.fromBech32Address(bech32Address).toLowerCase().substr(2);
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
// see examplesV2/zil_client.ts on how to confirm the transactions
|
|
@@ -153,7 +153,7 @@ class ZILClient {
|
|
|
153
153
|
zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
|
|
154
154
|
}
|
|
155
155
|
const deployedContract = (this.walletProvider || zilliqa).contracts.at(contractAddress);
|
|
156
|
-
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(
|
|
156
|
+
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(generic_1.stripHexPrefix(zilAddress));
|
|
157
157
|
if (balanceAndNonceResp.error !== undefined) {
|
|
158
158
|
throw new Error(balanceAndNonceResp.error.message);
|
|
159
159
|
}
|
|
@@ -171,7 +171,7 @@ class ZILClient {
|
|
|
171
171
|
vname: "spender",
|
|
172
172
|
type: "ByStr20",
|
|
173
173
|
// TODO: Check if bridgeAddress corresponds to carbon token lock_proxy_hash
|
|
174
|
-
value: spenderAddress !== null && spenderAddress !== void 0 ? spenderAddress :
|
|
174
|
+
value: spenderAddress !== null && spenderAddress !== void 0 ? spenderAddress : generic_1.appendHexPrefix(token.bridgeAddress),
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
177
|
vname: "amount",
|
|
@@ -189,7 +189,7 @@ class ZILClient {
|
|
|
189
189
|
}
|
|
190
190
|
checkAllowanceZRC2(token, owner, spender) {
|
|
191
191
|
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
-
const contractAddress =
|
|
192
|
+
const contractAddress = generic_1.appendHexPrefix(token.tokenAddress);
|
|
193
193
|
const zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
|
|
194
194
|
const resp = yield zilliqa.blockchain.getSmartContractSubState(contractAddress, "allowances", [owner, spender]);
|
|
195
195
|
if (resp.error !== undefined) {
|
|
@@ -211,13 +211,13 @@ class ZILClient {
|
|
|
211
211
|
}
|
|
212
212
|
const carbonNetwork = networkConfig.network;
|
|
213
213
|
const fromTokenId = fromToken.id;
|
|
214
|
-
const fromTokenAddr =
|
|
214
|
+
const fromTokenAddr = generic_1.appendHexPrefix(fromToken.tokenAddress);
|
|
215
215
|
const toTokenDenom = toToken.denom;
|
|
216
|
-
const targetProxyHash =
|
|
216
|
+
const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(fromToken));
|
|
217
217
|
const recoveryAddressHex = ethers_1.ethers.utils.hexlify(index_1.AddressUtils.SWTHAddress.getAddressBytes(recoveryAddress, carbonNetwork));
|
|
218
218
|
const fromAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(fromTokenId));
|
|
219
219
|
const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(toTokenDenom));
|
|
220
|
-
const feeAddress =
|
|
220
|
+
const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
|
|
221
221
|
const contractAddress = this.getBridgeEntranceAddr();
|
|
222
222
|
let zilliqa;
|
|
223
223
|
if (typeof signer === "string") {
|
|
@@ -232,7 +232,7 @@ class ZILClient {
|
|
|
232
232
|
zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
|
|
233
233
|
}
|
|
234
234
|
const deployedContract = (this.walletProvider || zilliqa).contracts.at(contractAddress);
|
|
235
|
-
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(
|
|
235
|
+
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(generic_1.stripHexPrefix(fromAddress));
|
|
236
236
|
if (balanceAndNonceResp.error !== undefined) {
|
|
237
237
|
throw new Error(balanceAndNonceResp.error.message);
|
|
238
238
|
}
|
|
@@ -309,13 +309,13 @@ class ZILClient {
|
|
|
309
309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
310
310
|
const { address, amount, token, gasPrice, gasLimit, zilAddress, signer } = params;
|
|
311
311
|
const networkConfig = this.getNetworkConfig();
|
|
312
|
-
const assetId =
|
|
313
|
-
const targetProxyHash =
|
|
314
|
-
const feeAddress =
|
|
312
|
+
const assetId = generic_1.appendHexPrefix(token.tokenAddress);
|
|
313
|
+
const targetProxyHash = generic_1.appendHexPrefix(this.getTargetProxyHash(token));
|
|
314
|
+
const feeAddress = generic_1.appendHexPrefix(networkConfig.feeAddress);
|
|
315
315
|
const toAssetHash = ethers_1.ethers.utils.hexlify(ethers_1.ethers.utils.toUtf8Bytes(token.id));
|
|
316
316
|
const swthAddress = ethers_1.ethers.utils.hexlify(address);
|
|
317
317
|
// TODO: Check if bridgeAddress corresponds to carbon token lock_proxy_hash
|
|
318
|
-
const contractAddress =
|
|
318
|
+
const contractAddress = generic_1.appendHexPrefix(token.bridgeAddress);
|
|
319
319
|
let zilliqa;
|
|
320
320
|
if (typeof signer === "string") {
|
|
321
321
|
zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
|
|
@@ -329,7 +329,7 @@ class ZILClient {
|
|
|
329
329
|
zilliqa = new zilliqa_1.Zilliqa(this.getProviderUrl());
|
|
330
330
|
}
|
|
331
331
|
const deployedContract = (this.walletProvider || zilliqa).contracts.at(contractAddress);
|
|
332
|
-
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(
|
|
332
|
+
const balanceAndNonceResp = yield zilliqa.blockchain.getBalance(generic_1.stripHexPrefix(zilAddress));
|
|
333
333
|
if (balanceAndNonceResp.error !== undefined) {
|
|
334
334
|
throw new Error(balanceAndNonceResp.error.message);
|
|
335
335
|
}
|
|
@@ -414,7 +414,7 @@ class ZILClient {
|
|
|
414
414
|
getTargetProxyHash(token) {
|
|
415
415
|
const networkConfig = this.getNetworkConfig();
|
|
416
416
|
const addressBytes = address_1.SWTHAddress.getAddressBytes(token.creator, networkConfig.network);
|
|
417
|
-
const addressHex =
|
|
417
|
+
const addressHex = generic_1.stripHexPrefix(ethers_1.ethers.utils.hexlify(addressBytes));
|
|
418
418
|
return addressHex;
|
|
419
419
|
}
|
|
420
420
|
getNetworkConfig() {
|
|
@@ -27,6 +27,7 @@ export interface QueryAllianceRequest {
|
|
|
27
27
|
export interface QueryAllianceResponse {
|
|
28
28
|
alliance?: AllianceAsset;
|
|
29
29
|
}
|
|
30
|
+
/** @deprecated */
|
|
30
31
|
export interface QueryIBCAllianceRequest {
|
|
31
32
|
hash: string;
|
|
32
33
|
}
|
|
@@ -69,6 +70,7 @@ export interface QueryAllianceDelegationRequest {
|
|
|
69
70
|
denom: string;
|
|
70
71
|
pagination?: PageRequest;
|
|
71
72
|
}
|
|
73
|
+
/** @deprecated */
|
|
72
74
|
export interface QueryIBCAllianceDelegationRequest {
|
|
73
75
|
delegatorAddr: string;
|
|
74
76
|
validatorAddr: string;
|
|
@@ -85,6 +87,7 @@ export interface QueryAllianceDelegationRewardsRequest {
|
|
|
85
87
|
denom: string;
|
|
86
88
|
pagination?: PageRequest;
|
|
87
89
|
}
|
|
90
|
+
/** @deprecated */
|
|
88
91
|
export interface QueryIBCAllianceDelegationRewardsRequest {
|
|
89
92
|
delegatorAddr: string;
|
|
90
93
|
validatorAddr: string;
|
|
@@ -262,7 +265,13 @@ export interface Query {
|
|
|
262
265
|
Params(request: QueryParamsRequest): Promise<QueryParamsResponse>;
|
|
263
266
|
/** Query paginated alliances */
|
|
264
267
|
Alliances(request: QueryAlliancesRequest): Promise<QueryAlliancesResponse>;
|
|
265
|
-
/**
|
|
268
|
+
/**
|
|
269
|
+
* Query a specific alliance by ibc hash
|
|
270
|
+
* @deprecated: this endpoint will be replaced for by the encoded version
|
|
271
|
+
* of the denom e.g.: GET:/terra/alliances/ibc%2Falliance
|
|
272
|
+
*
|
|
273
|
+
* @deprecated
|
|
274
|
+
*/
|
|
266
275
|
IBCAlliance(request: QueryIBCAllianceRequest): Promise<QueryAllianceResponse>;
|
|
267
276
|
/** Query all paginated alliance delegations */
|
|
268
277
|
AllAlliancesDelegations(request: QueryAllAlliancesDelegationsRequest): Promise<QueryAlliancesDelegationsResponse>;
|
|
@@ -276,11 +285,23 @@ export interface Query {
|
|
|
276
285
|
AlliancesDelegationByValidator(request: QueryAlliancesDelegationByValidatorRequest): Promise<QueryAlliancesDelegationsResponse>;
|
|
277
286
|
/** Query a delegation to an alliance by delegator addr, validator_addr and denom */
|
|
278
287
|
AllianceDelegation(request: QueryAllianceDelegationRequest): Promise<QueryAllianceDelegationResponse>;
|
|
279
|
-
/**
|
|
288
|
+
/**
|
|
289
|
+
* Query a delegation to an alliance by delegator addr, validator_addr and denom
|
|
290
|
+
* @deprecated: this endpoint will be replaced for by the encoded version
|
|
291
|
+
* of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance
|
|
292
|
+
*
|
|
293
|
+
* @deprecated
|
|
294
|
+
*/
|
|
280
295
|
IBCAllianceDelegation(request: QueryIBCAllianceDelegationRequest): Promise<QueryAllianceDelegationResponse>;
|
|
281
296
|
/** Query for rewards by delegator addr, validator_addr and denom */
|
|
282
297
|
AllianceDelegationRewards(request: QueryAllianceDelegationRewardsRequest): Promise<QueryAllianceDelegationRewardsResponse>;
|
|
283
|
-
/**
|
|
298
|
+
/**
|
|
299
|
+
* Query for rewards by delegator addr, validator_addr and denom
|
|
300
|
+
* @deprecated: this endpoint will be replaced for by the encoded version
|
|
301
|
+
* of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance
|
|
302
|
+
*
|
|
303
|
+
* @deprecated
|
|
304
|
+
*/
|
|
284
305
|
IBCAllianceDelegationRewards(request: QueryIBCAllianceDelegationRewardsRequest): Promise<QueryAllianceDelegationRewardsResponse>;
|
|
285
306
|
/** Query a specific alliance by denom */
|
|
286
307
|
Alliance(request: QueryAllianceRequest): Promise<QueryAllianceResponse>;
|
package/lib/codec/book/book.d.ts
CHANGED
package/lib/codec/book/book.js
CHANGED
|
@@ -158,7 +158,7 @@ exports.OrderBook = {
|
|
|
158
158
|
return message;
|
|
159
159
|
},
|
|
160
160
|
};
|
|
161
|
-
const baseStopBook = { market: "", asks: "", bids: "" };
|
|
161
|
+
const baseStopBook = { market: "", asks: "", bids: "", trigger: "" };
|
|
162
162
|
exports.StopBook = {
|
|
163
163
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
164
164
|
if (message.market !== "") {
|
|
@@ -170,6 +170,9 @@ exports.StopBook = {
|
|
|
170
170
|
for (const v of message.bids) {
|
|
171
171
|
writer.uint32(26).string(v);
|
|
172
172
|
}
|
|
173
|
+
if (message.trigger !== "") {
|
|
174
|
+
writer.uint32(34).string(message.trigger);
|
|
175
|
+
}
|
|
173
176
|
return writer;
|
|
174
177
|
},
|
|
175
178
|
decode(input, length) {
|
|
@@ -190,6 +193,9 @@ exports.StopBook = {
|
|
|
190
193
|
case 3:
|
|
191
194
|
message.bids.push(reader.string());
|
|
192
195
|
break;
|
|
196
|
+
case 4:
|
|
197
|
+
message.trigger = reader.string();
|
|
198
|
+
break;
|
|
193
199
|
default:
|
|
194
200
|
reader.skipType(tag & 7);
|
|
195
201
|
break;
|
|
@@ -206,6 +212,10 @@ exports.StopBook = {
|
|
|
206
212
|
: "";
|
|
207
213
|
message.asks = ((_a = object.asks) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
|
|
208
214
|
message.bids = ((_b = object.bids) !== null && _b !== void 0 ? _b : []).map((e) => String(e));
|
|
215
|
+
message.trigger =
|
|
216
|
+
object.trigger !== undefined && object.trigger !== null
|
|
217
|
+
? String(object.trigger)
|
|
218
|
+
: "";
|
|
209
219
|
return message;
|
|
210
220
|
},
|
|
211
221
|
toJSON(message) {
|
|
@@ -223,14 +233,16 @@ exports.StopBook = {
|
|
|
223
233
|
else {
|
|
224
234
|
obj.bids = [];
|
|
225
235
|
}
|
|
236
|
+
message.trigger !== undefined && (obj.trigger = message.trigger);
|
|
226
237
|
return obj;
|
|
227
238
|
},
|
|
228
239
|
fromPartial(object) {
|
|
229
|
-
var _a, _b, _c;
|
|
240
|
+
var _a, _b, _c, _d;
|
|
230
241
|
const message = Object.assign({}, baseStopBook);
|
|
231
242
|
message.market = (_a = object.market) !== null && _a !== void 0 ? _a : "";
|
|
232
243
|
message.asks = ((_b = object.asks) !== null && _b !== void 0 ? _b : []).map((e) => e);
|
|
233
244
|
message.bids = ((_c = object.bids) !== null && _c !== void 0 ? _c : []).map((e) => e);
|
|
245
|
+
message.trigger = (_d = object.trigger) !== null && _d !== void 0 ? _d : "";
|
|
234
246
|
return message;
|
|
235
247
|
},
|
|
236
248
|
};
|
|
@@ -159,7 +159,7 @@ exports.QueryProposalsRequest = {
|
|
|
159
159
|
const message = Object.assign({}, baseQueryProposalsRequest);
|
|
160
160
|
message.proposalStatus =
|
|
161
161
|
object.proposalStatus !== undefined && object.proposalStatus !== null
|
|
162
|
-
?
|
|
162
|
+
? gov_1.proposalStatusFromJSON(object.proposalStatus)
|
|
163
163
|
: 0;
|
|
164
164
|
message.voter =
|
|
165
165
|
object.voter !== undefined && object.voter !== null
|
|
@@ -178,7 +178,7 @@ exports.QueryProposalsRequest = {
|
|
|
178
178
|
toJSON(message) {
|
|
179
179
|
const obj = {};
|
|
180
180
|
message.proposalStatus !== undefined &&
|
|
181
|
-
(obj.proposalStatus =
|
|
181
|
+
(obj.proposalStatus = gov_1.proposalStatusToJSON(message.proposalStatus));
|
|
182
182
|
message.voter !== undefined && (obj.voter = message.voter);
|
|
183
183
|
message.depositor !== undefined && (obj.depositor = message.depositor);
|
|
184
184
|
message.pagination !== undefined &&
|
|
@@ -300,7 +300,7 @@ exports.MsgVote = {
|
|
|
300
300
|
: "";
|
|
301
301
|
message.option =
|
|
302
302
|
object.option !== undefined && object.option !== null
|
|
303
|
-
?
|
|
303
|
+
? gov_1.voteOptionFromJSON(object.option)
|
|
304
304
|
: 0;
|
|
305
305
|
message.metadata =
|
|
306
306
|
object.metadata !== undefined && object.metadata !== null
|
|
@@ -314,7 +314,7 @@ exports.MsgVote = {
|
|
|
314
314
|
(obj.proposalId = (message.proposalId || long_1.default.UZERO).toString());
|
|
315
315
|
message.voter !== undefined && (obj.voter = message.voter);
|
|
316
316
|
message.option !== undefined &&
|
|
317
|
-
(obj.option =
|
|
317
|
+
(obj.option = gov_1.voteOptionToJSON(message.option));
|
|
318
318
|
message.metadata !== undefined && (obj.metadata = message.metadata);
|
|
319
319
|
return obj;
|
|
320
320
|
},
|