carbon-js-sdk 0.2.16-dev.3 → 0.2.16-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/clients/CarbonQueryClient.js +2 -2
- package/lib/clients/ETHClient.js +15 -15
- package/lib/clients/HydrogenClient.js +1 -1
- package/lib/clients/NEOClient.js +6 -6
- package/lib/clients/ZILClient.js +16 -16
- package/lib/codec/bank/tx.d.ts +64 -0
- package/lib/codec/bank/tx.js +236 -0
- 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/constant/generic.js +1 -1
- package/lib/modules/cdp.js +52 -48
- 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 -2
- package/lib/provider/amino/types/gov.js +4 -4
- 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.js +11 -11
- package/lib/provider/keplr/KeplrStore.js +1 -1
- 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/fetch.js +1 -1
- package/lib/util/generic.js +3 -3
- package/lib/util/number.js +5 -5
- 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
|
@@ -148,7 +148,7 @@ class CarbonWallet {
|
|
|
148
148
|
const signerData = Object.assign({ accountNumber: this.accountInfo.accountNumber, chainId: this.getChainId(), sequence }, explicitSignerData);
|
|
149
149
|
const fee = (_a = opts === null || opts === void 0 ? void 0 : opts.fee) !== null && _a !== void 0 ? _a : this.estimateTxFee(messages, feeDenom);
|
|
150
150
|
const txRaw = yield signingClient.sign(signerAddress, messages, fee, memo, signerData);
|
|
151
|
-
signature =
|
|
151
|
+
signature = amino_1.encodeSecp256k1Signature(account.pubkey, txRaw.signatures[0]);
|
|
152
152
|
return txRaw;
|
|
153
153
|
}
|
|
154
154
|
finally {
|
|
@@ -166,7 +166,7 @@ class CarbonWallet {
|
|
|
166
166
|
const tx = CarbonWallet.TxRaw.encode(txRaw).finish();
|
|
167
167
|
const carbonClient = this.getSigningClient();
|
|
168
168
|
const response = yield carbonClient.broadcastTx(tx, timeoutMs, pollIntervalMs);
|
|
169
|
-
if (
|
|
169
|
+
if (stargate_1.isDeliverTxFailure(response)) {
|
|
170
170
|
// tx failed
|
|
171
171
|
throw new Error(`[${response.code}] ${response.rawLog}`);
|
|
172
172
|
}
|
|
@@ -205,9 +205,9 @@ class CarbonWallet {
|
|
|
205
205
|
try {
|
|
206
206
|
if (!this.accountInfo || this.sequenceInvalidated)
|
|
207
207
|
yield this.reloadAccountSequence();
|
|
208
|
-
const heightResponse = yield
|
|
208
|
+
const heightResponse = yield fetch_1.fetch(`${this.networkConfig.tmRpcUrl}/blockchain?cache=${new Date().getTime()}`);
|
|
209
209
|
const heightRes = yield heightResponse.json();
|
|
210
|
-
const height =
|
|
210
|
+
const height = number_1.bnOrZero((_a = heightRes.result) === null || _a === void 0 ? void 0 : _a.last_height);
|
|
211
211
|
const timeoutHeight = height.isZero() ? undefined : height.toNumber() + this.defaultTimeoutBlocks;
|
|
212
212
|
const sequence = this.accountInfo.sequence;
|
|
213
213
|
this.accountInfo = Object.assign(Object.assign({}, this.accountInfo), { sequence: sequence + 1 });
|
|
@@ -341,12 +341,12 @@ class CarbonWallet {
|
|
|
341
341
|
const queryClient = this.getQueryClient();
|
|
342
342
|
const { msgGasCosts } = yield queryClient.fee.MsgGasCostAll({});
|
|
343
343
|
this.txGasCosts = msgGasCosts.reduce((result, item) => {
|
|
344
|
-
result[item.msgType] =
|
|
344
|
+
result[item.msgType] = number_1.bnOrZero(item.gasCost);
|
|
345
345
|
return result;
|
|
346
346
|
}, {});
|
|
347
347
|
const { minGasPrices } = yield queryClient.fee.MinGasPriceAll({});
|
|
348
348
|
this.txGasPrices = minGasPrices.reduce((result, item) => {
|
|
349
|
-
result[item.denom] =
|
|
349
|
+
result[item.denom] = number_1.bnOrZero(item.gasPrice).shiftedBy(-18); // sdk.Dec shifting
|
|
350
350
|
return result;
|
|
351
351
|
}, {});
|
|
352
352
|
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 =
|
|
174
|
+
const channelId = 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 =
|
|
196
|
+
const channelId = channel_1.generateChannelId(param);
|
|
197
197
|
delete this.channelHandlers[channelId];
|
|
198
198
|
}
|
|
199
199
|
this.send('unsubscribe', {
|
|
@@ -279,7 +279,7 @@ class WSConnector {
|
|
|
279
279
|
if (!channelHandler) {
|
|
280
280
|
this.debugLog(`handler not found for channel: ${message.channel}`);
|
|
281
281
|
try {
|
|
282
|
-
const params =
|
|
282
|
+
const params = channel_1.parseChannelId(message.channel);
|
|
283
283
|
this.unsubscribe({ channel: params.channel });
|
|
284
284
|
}
|
|
285
285
|
catch (error) {
|