carbon-js-sdk 0.3.53-beta.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/CarbonSDK.js +1 -1
- package/lib/clients/CarbonQueryClient.d.ts +6 -0
- package/lib/clients/CarbonQueryClient.js +36 -30
- package/lib/clients/ETHClient.d.ts +11 -4
- package/lib/clients/ETHClient.js +32 -18
- package/lib/clients/HydrogenClient.d.ts +16 -7
- package/lib/clients/HydrogenClient.js +56 -10
- package/lib/clients/NEOClient.d.ts +1 -1
- package/lib/clients/NEOClient.js +15 -10
- package/lib/clients/TokenClient.d.ts +19 -4
- package/lib/clients/TokenClient.js +187 -10
- package/lib/clients/ZILClient.d.ts +1 -1
- package/lib/clients/ZILClient.js +25 -20
- 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/constant/generic.js +1 -1
- package/lib/hydrogen/transfer.d.ts +5 -5
- package/lib/modules/cdp.js +43 -43
- package/lib/modules/cosmwasm.js +1 -1
- package/lib/modules/gov.js +12 -12
- 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 +28 -28
- 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 -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/ledger/ledger.js +2 -2
- package/lib/provider/metamask/MetaMask.d.ts +5 -5
- package/lib/provider/metamask/MetaMask.js +35 -35
- 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 +12 -0
- package/lib/util/blockchain.js +143 -1
- package/lib/util/fetch.js +1 -1
- package/lib/util/generic.js +3 -3
- package/lib/util/ibc.d.ts +4 -4
- package/lib/util/ibc.js +17 -18
- 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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
export declare const protobufPackage = "Switcheo.carbon.evmmerge";
|
|
4
|
+
export interface MsgMergeAccount {
|
|
5
|
+
/** bech32 ETH address if coming from EIP-712, bech32 cosmos address if coming from typical cosmos tx */
|
|
6
|
+
creator: string;
|
|
7
|
+
/** Compressed Public key in hex eg 034a1e1f95ebb49bc59b3c2d60afbb4c2fb2b77cd1f1e2322123fdacaa3d12f7a9 */
|
|
8
|
+
pubKey: string;
|
|
9
|
+
/** hex representation of the pub key signature */
|
|
10
|
+
pubKeySig?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MsgMergeAccountResponse {
|
|
13
|
+
}
|
|
14
|
+
export declare const MsgMergeAccount: {
|
|
15
|
+
encode(message: MsgMergeAccount, writer?: _m0.Writer): _m0.Writer;
|
|
16
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): MsgMergeAccount;
|
|
17
|
+
fromJSON(object: any): MsgMergeAccount;
|
|
18
|
+
toJSON(message: MsgMergeAccount): unknown;
|
|
19
|
+
fromPartial(object: DeepPartial<MsgMergeAccount>): MsgMergeAccount;
|
|
20
|
+
};
|
|
21
|
+
export declare const MsgMergeAccountResponse: {
|
|
22
|
+
encode(_: MsgMergeAccountResponse, writer?: _m0.Writer): _m0.Writer;
|
|
23
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): MsgMergeAccountResponse;
|
|
24
|
+
fromJSON(_: any): MsgMergeAccountResponse;
|
|
25
|
+
toJSON(_: MsgMergeAccountResponse): unknown;
|
|
26
|
+
fromPartial(_: DeepPartial<MsgMergeAccountResponse>): MsgMergeAccountResponse;
|
|
27
|
+
};
|
|
28
|
+
/** Msg defines the Msg service. */
|
|
29
|
+
export interface Msg {
|
|
30
|
+
/** this line is used by starport scaffolding # proto/tx/rpc */
|
|
31
|
+
MergeAccount(request: MsgMergeAccount): Promise<MsgMergeAccountResponse>;
|
|
32
|
+
}
|
|
33
|
+
export declare class MsgClientImpl implements Msg {
|
|
34
|
+
private readonly rpc;
|
|
35
|
+
constructor(rpc: Rpc);
|
|
36
|
+
MergeAccount(request: MsgMergeAccount): Promise<MsgMergeAccountResponse>;
|
|
37
|
+
}
|
|
38
|
+
interface Rpc {
|
|
39
|
+
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
40
|
+
}
|
|
41
|
+
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
42
|
+
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
43
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
44
|
+
} : Partial<T>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MsgClientImpl = exports.MsgMergeAccountResponse = exports.MsgMergeAccount = exports.protobufPackage = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const long_1 = __importDefault(require("long"));
|
|
9
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
|
+
const wrappers_1 = require("../google/protobuf/wrappers");
|
|
11
|
+
exports.protobufPackage = "Switcheo.carbon.evmmerge";
|
|
12
|
+
const baseMsgMergeAccount = { creator: "", pubKey: "" };
|
|
13
|
+
exports.MsgMergeAccount = {
|
|
14
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
15
|
+
if (message.creator !== "") {
|
|
16
|
+
writer.uint32(10).string(message.creator);
|
|
17
|
+
}
|
|
18
|
+
if (message.pubKey !== "") {
|
|
19
|
+
writer.uint32(18).string(message.pubKey);
|
|
20
|
+
}
|
|
21
|
+
if (message.pubKeySig !== undefined) {
|
|
22
|
+
wrappers_1.StringValue.encode({ value: message.pubKeySig }, writer.uint32(34).fork()).ldelim();
|
|
23
|
+
}
|
|
24
|
+
return writer;
|
|
25
|
+
},
|
|
26
|
+
decode(input, length) {
|
|
27
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
28
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
29
|
+
const message = Object.assign({}, baseMsgMergeAccount);
|
|
30
|
+
while (reader.pos < end) {
|
|
31
|
+
const tag = reader.uint32();
|
|
32
|
+
switch (tag >>> 3) {
|
|
33
|
+
case 1:
|
|
34
|
+
message.creator = reader.string();
|
|
35
|
+
break;
|
|
36
|
+
case 2:
|
|
37
|
+
message.pubKey = reader.string();
|
|
38
|
+
break;
|
|
39
|
+
case 4:
|
|
40
|
+
message.pubKeySig = wrappers_1.StringValue.decode(reader, reader.uint32()).value;
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
reader.skipType(tag & 7);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return message;
|
|
48
|
+
},
|
|
49
|
+
fromJSON(object) {
|
|
50
|
+
const message = Object.assign({}, baseMsgMergeAccount);
|
|
51
|
+
message.creator =
|
|
52
|
+
object.creator !== undefined && object.creator !== null
|
|
53
|
+
? String(object.creator)
|
|
54
|
+
: "";
|
|
55
|
+
message.pubKey =
|
|
56
|
+
object.pubKey !== undefined && object.pubKey !== null
|
|
57
|
+
? String(object.pubKey)
|
|
58
|
+
: "";
|
|
59
|
+
message.pubKeySig =
|
|
60
|
+
object.pubKeySig !== undefined && object.pubKeySig !== null
|
|
61
|
+
? String(object.pubKeySig)
|
|
62
|
+
: undefined;
|
|
63
|
+
return message;
|
|
64
|
+
},
|
|
65
|
+
toJSON(message) {
|
|
66
|
+
const obj = {};
|
|
67
|
+
message.creator !== undefined && (obj.creator = message.creator);
|
|
68
|
+
message.pubKey !== undefined && (obj.pubKey = message.pubKey);
|
|
69
|
+
message.pubKeySig !== undefined && (obj.pubKeySig = message.pubKeySig);
|
|
70
|
+
return obj;
|
|
71
|
+
},
|
|
72
|
+
fromPartial(object) {
|
|
73
|
+
var _a, _b, _c;
|
|
74
|
+
const message = Object.assign({}, baseMsgMergeAccount);
|
|
75
|
+
message.creator = (_a = object.creator) !== null && _a !== void 0 ? _a : "";
|
|
76
|
+
message.pubKey = (_b = object.pubKey) !== null && _b !== void 0 ? _b : "";
|
|
77
|
+
message.pubKeySig = (_c = object.pubKeySig) !== null && _c !== void 0 ? _c : undefined;
|
|
78
|
+
return message;
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
const baseMsgMergeAccountResponse = {};
|
|
82
|
+
exports.MsgMergeAccountResponse = {
|
|
83
|
+
encode(_, writer = minimal_1.default.Writer.create()) {
|
|
84
|
+
return writer;
|
|
85
|
+
},
|
|
86
|
+
decode(input, length) {
|
|
87
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
88
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
89
|
+
const message = Object.assign({}, baseMsgMergeAccountResponse);
|
|
90
|
+
while (reader.pos < end) {
|
|
91
|
+
const tag = reader.uint32();
|
|
92
|
+
switch (tag >>> 3) {
|
|
93
|
+
default:
|
|
94
|
+
reader.skipType(tag & 7);
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return message;
|
|
99
|
+
},
|
|
100
|
+
fromJSON(_) {
|
|
101
|
+
const message = Object.assign({}, baseMsgMergeAccountResponse);
|
|
102
|
+
return message;
|
|
103
|
+
},
|
|
104
|
+
toJSON(_) {
|
|
105
|
+
const obj = {};
|
|
106
|
+
return obj;
|
|
107
|
+
},
|
|
108
|
+
fromPartial(_) {
|
|
109
|
+
const message = Object.assign({}, baseMsgMergeAccountResponse);
|
|
110
|
+
return message;
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
class MsgClientImpl {
|
|
114
|
+
constructor(rpc) {
|
|
115
|
+
this.rpc = rpc;
|
|
116
|
+
this.MergeAccount = this.MergeAccount.bind(this);
|
|
117
|
+
}
|
|
118
|
+
MergeAccount(request) {
|
|
119
|
+
const data = exports.MsgMergeAccount.encode(request).finish();
|
|
120
|
+
const promise = this.rpc.request("Switcheo.carbon.evmmerge.Msg", "MergeAccount", data);
|
|
121
|
+
return promise.then((data) => exports.MsgMergeAccountResponse.decode(new minimal_1.default.Reader(data)));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.MsgClientImpl = MsgClientImpl;
|
|
125
|
+
if (minimal_1.default.util.Long !== long_1.default) {
|
|
126
|
+
minimal_1.default.util.Long = long_1.default;
|
|
127
|
+
minimal_1.default.configure();
|
|
128
|
+
}
|
package/lib/constant/generic.js
CHANGED
|
@@ -12,7 +12,7 @@ exports.DEFAULT_FEE_DENOM = "swth";
|
|
|
12
12
|
exports.DEFAULT_GAS_PRICE = new bignumber_js_1.default(10);
|
|
13
13
|
exports.DEFAULT_GAS = new bignumber_js_1.default(10000000);
|
|
14
14
|
exports.DEFAULT_FEE = {
|
|
15
|
-
amount: proto_signing_1.coins(exports.DEFAULT_GAS_PRICE.times(exports.DEFAULT_GAS).dp(0).toString(), "swth"),
|
|
15
|
+
amount: (0, proto_signing_1.coins)(exports.DEFAULT_GAS_PRICE.times(exports.DEFAULT_GAS).dp(0).toString(), "swth"),
|
|
16
16
|
gas: exports.DEFAULT_GAS.toString(10),
|
|
17
17
|
};
|
|
18
18
|
exports.CARBON_GAS_PRICE = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Blockchain } from "../util/blockchain";
|
|
1
|
+
import { Blockchain, BlockchainV2 } from "../util/blockchain";
|
|
2
2
|
export interface GetTransfersRequest {
|
|
3
3
|
bridging_blockchain?: string;
|
|
4
4
|
source_blockchain?: string;
|
|
@@ -53,9 +53,9 @@ export interface CrossChainTransfer {
|
|
|
53
53
|
nonce: string;
|
|
54
54
|
created_at: Date;
|
|
55
55
|
updated_at: Date;
|
|
56
|
-
source_blockchain: Blockchain | null;
|
|
57
|
-
bridging_blockchain: Blockchain | null;
|
|
58
|
-
destination_blockchain: Blockchain | null;
|
|
56
|
+
source_blockchain: Blockchain | BlockchainV2 | null;
|
|
57
|
+
bridging_blockchain: Blockchain | BlockchainV2 | null;
|
|
58
|
+
destination_blockchain: Blockchain | BlockchainV2 | null;
|
|
59
59
|
status: CrossChainFlowStatus;
|
|
60
60
|
carbon_token_id: string;
|
|
61
61
|
recovery_address_hash: string;
|
|
@@ -68,7 +68,7 @@ export interface CrossChainTransferDetailed extends CrossChainTransfer {
|
|
|
68
68
|
}
|
|
69
69
|
export interface ChainTransaction {
|
|
70
70
|
id: string;
|
|
71
|
-
blockchain: Blockchain;
|
|
71
|
+
blockchain: Blockchain | BlockchainV2;
|
|
72
72
|
contract: string;
|
|
73
73
|
block_height: number;
|
|
74
74
|
tx_hash: string;
|
package/lib/modules/cdp.js
CHANGED
|
@@ -458,7 +458,7 @@ class CDPModule extends base_1.default {
|
|
|
458
458
|
let availableBorrowsUsd = number_1.BN_ZERO;
|
|
459
459
|
let currLiquidationThreshold = number_1.BN_ZERO;
|
|
460
460
|
for (let i = 0; i < collaterals.length; i++) {
|
|
461
|
-
const amount = number_1.bnOrZero(collaterals[i].collateralAmount);
|
|
461
|
+
const amount = (0, number_1.bnOrZero)(collaterals[i].collateralAmount);
|
|
462
462
|
if (amount.isZero()) {
|
|
463
463
|
continue; // no collateral for denom
|
|
464
464
|
}
|
|
@@ -475,9 +475,9 @@ class CDPModule extends base_1.default {
|
|
|
475
475
|
if (!assetParam) {
|
|
476
476
|
continue;
|
|
477
477
|
}
|
|
478
|
-
const ltv = number_1.bnOrZero(assetParam.loanToValue).div(number_1.BN_10000);
|
|
478
|
+
const ltv = (0, number_1.bnOrZero)(assetParam.loanToValue).div(number_1.BN_10000);
|
|
479
479
|
const availableBorrowUsd = collateralUsdVal.times(ltv);
|
|
480
|
-
const liquidationThreshold = number_1.bnOrZero(assetParam.liquidationThreshold).div(number_1.BN_10000);
|
|
480
|
+
const liquidationThreshold = (0, number_1.bnOrZero)(assetParam.liquidationThreshold).div(number_1.BN_10000);
|
|
481
481
|
const liquidationThresholdVal = collateralUsdVal.times(liquidationThreshold);
|
|
482
482
|
totalCollateralsUsd = totalCollateralsUsd.plus(collateralUsdVal);
|
|
483
483
|
availableBorrowsUsd = availableBorrowsUsd.plus(availableBorrowUsd);
|
|
@@ -488,7 +488,7 @@ class CDPModule extends base_1.default {
|
|
|
488
488
|
const debts = debtsRsp.debts;
|
|
489
489
|
let totalDebtsUsd = number_1.BN_ZERO;
|
|
490
490
|
for (let i = 0; i < debts.length; i++) {
|
|
491
|
-
const amount = number_1.bnOrZero(debts[i].principalDebt);
|
|
491
|
+
const amount = (0, number_1.bnOrZero)(debts[i].principalDebt);
|
|
492
492
|
const denom = debts[i].denom;
|
|
493
493
|
if (amount.isZero()) {
|
|
494
494
|
continue;
|
|
@@ -510,7 +510,7 @@ class CDPModule extends base_1.default {
|
|
|
510
510
|
if (stablecoinDebtInfo) {
|
|
511
511
|
const accountStablecoin = yield sdk.query.cdp.AccountStablecoin({ address: account });
|
|
512
512
|
const stablecoinDecimals = (_a = (yield this.sdkProvider.getTokenClient().getDecimals(stablecoinDebtInfo.denom))) !== null && _a !== void 0 ? _a : number_1.BN_ZERO;
|
|
513
|
-
const stablecoinDebtAmount = number_1.bnOrZero(accountStablecoin.principalDebt).plus(number_1.bnOrZero(accountStablecoin.interestDebt));
|
|
513
|
+
const stablecoinDebtAmount = (0, number_1.bnOrZero)(accountStablecoin.principalDebt).plus((0, number_1.bnOrZero)(accountStablecoin.interestDebt));
|
|
514
514
|
stablecoinDebtUsd = stablecoinDebtAmount.shiftedBy(-stablecoinDecimals);
|
|
515
515
|
totalDebtsUsd = totalDebtsUsd.plus(stablecoinDebtUsd);
|
|
516
516
|
}
|
|
@@ -531,7 +531,7 @@ class CDPModule extends base_1.default {
|
|
|
531
531
|
const sdk = this.sdkProvider;
|
|
532
532
|
const cdpAddress = this.getCdpModuleAddress();
|
|
533
533
|
const balanceRsp = yield sdk.query.bank.Balance(query_2.QueryBalanceRequest.fromPartial({ address: cdpAddress, denom }));
|
|
534
|
-
return number_1.bnOrZero((_a = balanceRsp.balance) === null || _a === void 0 ? void 0 : _a.amount);
|
|
534
|
+
return (0, number_1.bnOrZero)((_a = balanceRsp.balance) === null || _a === void 0 ? void 0 : _a.amount);
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
537
|
getCdpToActualRatio(cdpDenom) {
|
|
@@ -542,13 +542,13 @@ class CDPModule extends base_1.default {
|
|
|
542
542
|
const cdpAmountRsp = supplyRsp.amount;
|
|
543
543
|
if (!cdpAmountRsp)
|
|
544
544
|
throw new Error("unable to retrieve cdp token supply");
|
|
545
|
-
const cdpAmount = number_1.bnOrZero(cdpAmountRsp.amount);
|
|
545
|
+
const cdpAmount = (0, number_1.bnOrZero)(cdpAmountRsp.amount);
|
|
546
546
|
const cdpAddress = this.getCdpModuleAddress();
|
|
547
547
|
const balanceRsp = yield sdk.query.bank.Balance(query_2.QueryBalanceRequest.fromPartial({ address: cdpAddress, denom }));
|
|
548
548
|
if (!balanceRsp.balance)
|
|
549
549
|
throw new Error("unable to retrieve cdp module balance");
|
|
550
550
|
const owedAmount = yield this.getTotalTokenDebt(denom);
|
|
551
|
-
const actualAmount = number_1.bnOrZero(balanceRsp.balance.amount).plus(owedAmount);
|
|
551
|
+
const actualAmount = (0, number_1.bnOrZero)(balanceRsp.balance.amount).plus(owedAmount);
|
|
552
552
|
if (!owedAmount)
|
|
553
553
|
throw new Error("unable to retrieve total token debt");
|
|
554
554
|
return cdpAmount.div(actualAmount);
|
|
@@ -570,8 +570,8 @@ class CDPModule extends base_1.default {
|
|
|
570
570
|
const allDebts = allDebtsRes.debtInfosAll;
|
|
571
571
|
for (let i = 0; i < allDebts.length; i++) {
|
|
572
572
|
const denom = allDebts[i].denom;
|
|
573
|
-
const interest = number_1.bnOrZero(allDebts[i].totalAccumulatedInterest);
|
|
574
|
-
const principal = number_1.bnOrZero(allDebts[i].totalPrincipal);
|
|
573
|
+
const interest = (0, number_1.bnOrZero)(allDebts[i].totalAccumulatedInterest);
|
|
574
|
+
const principal = (0, number_1.bnOrZero)(allDebts[i].totalPrincipal);
|
|
575
575
|
const debtAmt = interest.plus(principal);
|
|
576
576
|
const debtUsdVal = yield this.getTokenUsdVal(denom, debtAmt);
|
|
577
577
|
if (!debtUsdVal) {
|
|
@@ -583,7 +583,7 @@ class CDPModule extends base_1.default {
|
|
|
583
583
|
const stablecoinDebtRes = yield this.sdkProvider.query.cdp.StablecoinDebt({});
|
|
584
584
|
if (stablecoinDebtRes.stablecoinDebtInfo) {
|
|
585
585
|
const debtInfo = stablecoinDebtRes.stablecoinDebtInfo;
|
|
586
|
-
const debtAmt = number_1.bnOrZero(debtInfo.totalPrincipal).plus(number_1.bnOrZero(debtInfo.totalAccumulatedInterest));
|
|
586
|
+
const debtAmt = (0, number_1.bnOrZero)(debtInfo.totalPrincipal).plus((0, number_1.bnOrZero)(debtInfo.totalAccumulatedInterest));
|
|
587
587
|
const stablecoinDecimals = (_a = (yield sdk.getTokenClient().getDecimals(debtInfo.denom))) !== null && _a !== void 0 ? _a : 0;
|
|
588
588
|
const debtUsdVal = debtAmt.shiftedBy(-stablecoinDecimals);
|
|
589
589
|
totalDebt = totalDebt.plus(debtUsdVal);
|
|
@@ -601,7 +601,7 @@ class CDPModule extends base_1.default {
|
|
|
601
601
|
if (!TokenClient_1.default.isCdpToken(balance.denom)) {
|
|
602
602
|
continue;
|
|
603
603
|
}
|
|
604
|
-
const amount = number_1.bnOrZero(balance.amount);
|
|
604
|
+
const amount = (0, number_1.bnOrZero)(balance.amount);
|
|
605
605
|
const collateralUsdValue = yield this.getCdpTokenUsdVal(balance.denom, amount);
|
|
606
606
|
allCollateralsUsdValue = allCollateralsUsdValue.plus(collateralUsdValue);
|
|
607
607
|
}
|
|
@@ -625,7 +625,7 @@ class CDPModule extends base_1.default {
|
|
|
625
625
|
const priceResult = yield sdk.query.pricing.TokenPrice(codec_1.QueryTokenPriceRequest.fromPartial({ denom }));
|
|
626
626
|
if (!priceResult.tokenPrice)
|
|
627
627
|
throw new Error("unable to retrieve token price for " + denom);
|
|
628
|
-
const twap = number_1.bnOrZero(priceResult.tokenPrice.twap).shiftedBy(-18);
|
|
628
|
+
const twap = (0, number_1.bnOrZero)(priceResult.tokenPrice.twap).shiftedBy(-18);
|
|
629
629
|
return amount.multipliedBy(twap).shiftedBy(-decimals);
|
|
630
630
|
});
|
|
631
631
|
}
|
|
@@ -640,11 +640,11 @@ class CDPModule extends base_1.default {
|
|
|
640
640
|
throw new Error("unable to retrieve debt info");
|
|
641
641
|
const cimRsp = yield this.recalculateCIM(denom, debtInfo);
|
|
642
642
|
const newInterestRate = cimRsp.interest;
|
|
643
|
-
const principal = number_1.bnOrZero(debtInfo.totalPrincipal);
|
|
644
|
-
const accumInterest = number_1.bnOrZero(debtInfo.totalAccumulatedInterest);
|
|
643
|
+
const principal = (0, number_1.bnOrZero)(debtInfo.totalPrincipal);
|
|
644
|
+
const accumInterest = (0, number_1.bnOrZero)(debtInfo.totalAccumulatedInterest);
|
|
645
645
|
const newInterest = principal.times(newInterestRate).plus(accumInterest.times(number_1.BN_ONE.plus(newInterestRate)));
|
|
646
646
|
const cdpParamsRsp = yield this.sdkProvider.query.cdp.Params(query_1.QueryParamsRequest.fromPartial({}));
|
|
647
|
-
const interestFee = number_1.bnOrZero((_a = cdpParamsRsp.params) === null || _a === void 0 ? void 0 : _a.interestFee);
|
|
647
|
+
const interestFee = (0, number_1.bnOrZero)((_a = cdpParamsRsp.params) === null || _a === void 0 ? void 0 : _a.interestFee);
|
|
648
648
|
const interest = newInterest.times(number_1.BN_10000.minus(interestFee)).dividedToIntegerBy(number_1.BN_10000);
|
|
649
649
|
return principal.plus(interest);
|
|
650
650
|
});
|
|
@@ -662,8 +662,8 @@ class CDPModule extends base_1.default {
|
|
|
662
662
|
const debtRes = yield sdk.query.cdp.AccountDebt({ address: account, denom: denom });
|
|
663
663
|
debt = debtRes.debt;
|
|
664
664
|
}
|
|
665
|
-
const principalAmount = number_1.bnOrZero(debt === null || debt === void 0 ? void 0 : debt.principalDebt);
|
|
666
|
-
const initialCIM = number_1.bnOrZero(debt === null || debt === void 0 ? void 0 : debt.initialCumulativeInterestMultiplier);
|
|
665
|
+
const principalAmount = (0, number_1.bnOrZero)(debt === null || debt === void 0 ? void 0 : debt.principalDebt);
|
|
666
|
+
const initialCIM = (0, number_1.bnOrZero)(debt === null || debt === void 0 ? void 0 : debt.initialCumulativeInterestMultiplier);
|
|
667
667
|
if (principalAmount.isZero() || initialCIM.isZero())
|
|
668
668
|
return number_1.BN_ZERO;
|
|
669
669
|
const cimRsp = yield this.recalculateCIM(denom, debtInfo);
|
|
@@ -689,8 +689,8 @@ class CDPModule extends base_1.default {
|
|
|
689
689
|
const debtResp = yield sdk.query.cdp.AccountStablecoin(query_1.QueryAccountStablecoinRequest.fromPartial({ address: account }));
|
|
690
690
|
debt = debtResp;
|
|
691
691
|
}
|
|
692
|
-
principalAmount = number_1.bnOrZero(debt.principalDebt);
|
|
693
|
-
const initialCIM = number_1.bnOrZero(debt.initialCumulativeInterestMultiplier);
|
|
692
|
+
principalAmount = (0, number_1.bnOrZero)(debt.principalDebt);
|
|
693
|
+
const initialCIM = (0, number_1.bnOrZero)(debt.initialCumulativeInterestMultiplier);
|
|
694
694
|
const cim = yield this.recalculateStablecoinCIM(debtInfo);
|
|
695
695
|
if (!cim)
|
|
696
696
|
throw new Error("unable to retrieve account debt");
|
|
@@ -731,7 +731,7 @@ class CDPModule extends base_1.default {
|
|
|
731
731
|
return number_1.BN_ZERO;
|
|
732
732
|
}
|
|
733
733
|
const diffSeconds = new bignumber_js_1.BigNumber(diffMs).shiftedBy(-3).dp(0, bignumber_js_1.BigNumber.ROUND_CEIL);
|
|
734
|
-
const secondsAYear = number_1.bnOrZero(31536000);
|
|
734
|
+
const secondsAYear = (0, number_1.bnOrZero)(31536000);
|
|
735
735
|
const numPeriods = secondsAYear.div(diffSeconds).dp(18);
|
|
736
736
|
return apy.div(numPeriods).dp(18); // carbon backend sdk.dec max 18 dp
|
|
737
737
|
}
|
|
@@ -755,8 +755,8 @@ class CDPModule extends base_1.default {
|
|
|
755
755
|
throw new Error("unable to retrieve cdp params for " + denom);
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
-
const interestFeeRate = number_1.bnOrZero(params.interestFee).div(number_1.BN_10000);
|
|
759
|
-
const utilizationRate = number_1.bnOrZero(debtInfo.utilizationRate).shiftedBy(-18);
|
|
758
|
+
const interestFeeRate = (0, number_1.bnOrZero)(params.interestFee).div(number_1.BN_10000);
|
|
759
|
+
const utilizationRate = (0, number_1.bnOrZero)(debtInfo.utilizationRate).shiftedBy(-18);
|
|
760
760
|
return borrowInterest.times(utilizationRate).times(number_1.BN_ONE.minus(interestFeeRate));
|
|
761
761
|
});
|
|
762
762
|
}
|
|
@@ -771,7 +771,7 @@ class CDPModule extends base_1.default {
|
|
|
771
771
|
return { cim: number_1.BN_ZERO, interest: number_1.BN_ZERO };
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
|
-
const cim = number_1.bnOrZero(debtInfo.cumulativeInterestMultiplier);
|
|
774
|
+
const cim = (0, number_1.bnOrZero)(debtInfo.cumulativeInterestMultiplier);
|
|
775
775
|
const apy = yield this.calculateAPY(denom, debtInfo);
|
|
776
776
|
const newInterest = CDPModule.calculateInterestForTimePeriod(apy, (_a = debtInfo.lastUpdatedTime) !== null && _a !== void 0 ? _a : new Date(0), new Date());
|
|
777
777
|
const newCIM = cim.times(newInterest.plus(1));
|
|
@@ -790,8 +790,8 @@ class CDPModule extends base_1.default {
|
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
const paramsResponse = yield sdk.query.cdp.Params(codec_1.QueryCdpParamsRequest.fromPartial({}));
|
|
793
|
-
const cim = number_1.bnOrZero(debtInfo.cumulativeInterestMultiplier);
|
|
794
|
-
const apy = number_1.bnOrZero((_a = paramsResponse.params) === null || _a === void 0 ? void 0 : _a.stablecoinInterestRate);
|
|
793
|
+
const cim = (0, number_1.bnOrZero)(debtInfo.cumulativeInterestMultiplier);
|
|
794
|
+
const apy = (0, number_1.bnOrZero)((_a = paramsResponse.params) === null || _a === void 0 ? void 0 : _a.stablecoinInterestRate);
|
|
795
795
|
if (!apy) {
|
|
796
796
|
return number_1.BN_ZERO;
|
|
797
797
|
}
|
|
@@ -817,7 +817,7 @@ class CDPModule extends base_1.default {
|
|
|
817
817
|
const availableBorrowsUsd = accountData.AvailableBorrowsUsd.minus(accountData.TotalDebtsUsd);
|
|
818
818
|
const unlockableUsd = availableBorrowsUsd.multipliedBy(number_1.BN_10000).div(unlockRatio);
|
|
819
819
|
const tokenPrice = yield sdk.query.pricing.TokenPrice({ denom });
|
|
820
|
-
const tokenTwap = number_1.bnOrZero((_b = tokenPrice.tokenPrice) === null || _b === void 0 ? void 0 : _b.twap);
|
|
820
|
+
const tokenTwap = (0, number_1.bnOrZero)((_b = tokenPrice.tokenPrice) === null || _b === void 0 ? void 0 : _b.twap);
|
|
821
821
|
if (tokenTwap.isZero())
|
|
822
822
|
throw new Error("unable to retrieve token price for " + denom);
|
|
823
823
|
const tokenAmt = unlockableUsd.div(tokenTwap.shiftedBy(-18)).shiftedBy(tokenDecimals);
|
|
@@ -828,7 +828,7 @@ class CDPModule extends base_1.default {
|
|
|
828
828
|
address: account,
|
|
829
829
|
cdpDenom: cdpDenom,
|
|
830
830
|
});
|
|
831
|
-
const lockedAmount = number_1.bnOrZero((_e = (_d = accountCollateral.collateral) === null || _d === void 0 ? void 0 : _d.collateralAmount) !== null && _e !== void 0 ? _e : "0");
|
|
831
|
+
const lockedAmount = (0, number_1.bnOrZero)((_e = (_d = accountCollateral.collateral) === null || _d === void 0 ? void 0 : _d.collateralAmount) !== null && _e !== void 0 ? _e : "0");
|
|
832
832
|
return lockedAmount.lt(cdpTokenAmt) ? lockedAmount : cdpTokenAmt;
|
|
833
833
|
});
|
|
834
834
|
}
|
|
@@ -846,7 +846,7 @@ class CDPModule extends base_1.default {
|
|
|
846
846
|
const denom = this.getUnderlyingDenom(cdpDenom);
|
|
847
847
|
const cdpToActualRatio = (_a = (yield this.getCdpToActualRatio(cdpDenom))) !== null && _a !== void 0 ? _a : number_1.BN_ZERO;
|
|
848
848
|
const tokenPrice = yield sdk.query.pricing.TokenPrice({ denom: denom });
|
|
849
|
-
const tokenTwap = number_1.bnOrZero((_b = tokenPrice.tokenPrice) === null || _b === void 0 ? void 0 : _b.twap).shiftedBy(-18);
|
|
849
|
+
const tokenTwap = (0, number_1.bnOrZero)((_b = tokenPrice.tokenPrice) === null || _b === void 0 ? void 0 : _b.twap).shiftedBy(-18);
|
|
850
850
|
return tokenTwap.multipliedBy(cdpToActualRatio);
|
|
851
851
|
});
|
|
852
852
|
}
|
|
@@ -867,26 +867,26 @@ class CDPModule extends base_1.default {
|
|
|
867
867
|
});
|
|
868
868
|
if (!asset.assetParams)
|
|
869
869
|
throw new Error("unable to retrieve asset param for " + cdpActualDenom);
|
|
870
|
-
const bonus = number_1.bnOrZero(asset.assetParams.liquidationDiscount).div(number_1.BN_10000);
|
|
870
|
+
const bonus = (0, number_1.bnOrZero)(asset.assetParams.liquidationDiscount).div(number_1.BN_10000);
|
|
871
871
|
const cdpTokenPrice = yield this.getCdpTokenPrice(cdpDenom);
|
|
872
872
|
const cdpTokenDiscountedPrice = cdpTokenPrice.multipliedBy(number_1.BN_ONE.minus(bonus));
|
|
873
873
|
// get close factor
|
|
874
874
|
const debtorAccountData = yield sdk.query.cdp.AccountData({
|
|
875
875
|
address: debtor,
|
|
876
876
|
});
|
|
877
|
-
const debtorTotalCollateralVal = number_1.bnOrZero(debtorAccountData.totalCollateralsUsd);
|
|
878
|
-
const debtorTotalDebtVal = number_1.bnOrZero(debtorAccountData.totalDebtsUsd);
|
|
879
|
-
const currentLiqThreshold = number_1.bnOrZero(debtorAccountData.currLiquidationThreshold);
|
|
877
|
+
const debtorTotalCollateralVal = (0, number_1.bnOrZero)(debtorAccountData.totalCollateralsUsd);
|
|
878
|
+
const debtorTotalDebtVal = (0, number_1.bnOrZero)(debtorAccountData.totalDebtsUsd);
|
|
879
|
+
const currentLiqThreshold = (0, number_1.bnOrZero)(debtorAccountData.currLiquidationThreshold);
|
|
880
880
|
const params = yield sdk.query.cdp.Params({});
|
|
881
881
|
if (!params.params) {
|
|
882
882
|
throw new Error("unable to retrieve cdp params");
|
|
883
883
|
}
|
|
884
|
-
const smallLiqSize = number_1.bnOrZero(params.params.smallLiquidationSize);
|
|
885
|
-
const minCloseFactor = number_1.bnOrZero(params.params.minimumCloseFactor);
|
|
886
|
-
const completeLiqThreshold = number_1.bnOrZero(params.params.completeLiquidationThreshold);
|
|
884
|
+
const smallLiqSize = (0, number_1.bnOrZero)(params.params.smallLiquidationSize);
|
|
885
|
+
const minCloseFactor = (0, number_1.bnOrZero)(params.params.minimumCloseFactor);
|
|
886
|
+
const completeLiqThreshold = (0, number_1.bnOrZero)(params.params.completeLiquidationThreshold);
|
|
887
887
|
const closeFactor = this.computeCloseFactor(debtorTotalDebtVal, debtorTotalCollateralVal, currentLiqThreshold, smallLiqSize, minCloseFactor, completeLiqThreshold);
|
|
888
888
|
// get max repayable amount given the debtor's debt and how much liquidator wants to repay
|
|
889
|
-
const debtDecimals = number_1.bnOrZero(yield sdk.getTokenClient().getDecimals(debtDenom));
|
|
889
|
+
const debtDecimals = (0, number_1.bnOrZero)(yield sdk.getTokenClient().getDecimals(debtDenom));
|
|
890
890
|
const maxRepayableValue = debtorTotalDebtVal.multipliedBy(closeFactor);
|
|
891
891
|
const maxRepayableAmt = maxRepayableValue.shiftedBy(debtDecimals.toNumber());
|
|
892
892
|
if (debtRepaymentAmount.isGreaterThan(maxRepayableAmt)) {
|
|
@@ -894,7 +894,7 @@ class CDPModule extends base_1.default {
|
|
|
894
894
|
}
|
|
895
895
|
// calculate collateral amount that can be obtained given that debt amount and debtor's collateral balance
|
|
896
896
|
// AND, recalculate debt repay amount if needed
|
|
897
|
-
const cdpTokenDecimals = number_1.bnOrZero(yield sdk.getTokenClient().getDecimals(cdpActualDenom));
|
|
897
|
+
const cdpTokenDecimals = (0, number_1.bnOrZero)(yield sdk.getTokenClient().getDecimals(cdpActualDenom));
|
|
898
898
|
let collateralAmtToLiquidate = this.calculateCollateralRequiredForDebt(number_1.BN_ONE, // assumes USC is $1
|
|
899
899
|
cdpTokenDiscountedPrice, debtRepaymentAmount, cdpTokenDecimals, debtDecimals);
|
|
900
900
|
const debtorAccountCollateral = yield sdk.query.cdp.AccountCollateral({
|
|
@@ -966,11 +966,11 @@ class CDPModule extends base_1.default {
|
|
|
966
966
|
}
|
|
967
967
|
exports.CDPModule = CDPModule;
|
|
968
968
|
CDPModule.calculateInterestAPY = (debtInfo, rateStrategy) => {
|
|
969
|
-
const utilizationRate = number_1.bnOrZero(debtInfo.utilizationRate).shiftedBy(-18);
|
|
970
|
-
const optimalUsage = number_1.bnOrZero(rateStrategy.optimalUsage).shiftedBy(-4);
|
|
971
|
-
const variableRate1 = number_1.bnOrZero(rateStrategy.variableRateSlope1).shiftedBy(-4);
|
|
972
|
-
const variableRate2 = number_1.bnOrZero(rateStrategy.variableRateSlope2).shiftedBy(-4);
|
|
973
|
-
const baseVariableBorrowRate = number_1.bnOrZero(rateStrategy.baseVariableBorrowRate).shiftedBy(-4);
|
|
969
|
+
const utilizationRate = (0, number_1.bnOrZero)(debtInfo.utilizationRate).shiftedBy(-18);
|
|
970
|
+
const optimalUsage = (0, number_1.bnOrZero)(rateStrategy.optimalUsage).shiftedBy(-4);
|
|
971
|
+
const variableRate1 = (0, number_1.bnOrZero)(rateStrategy.variableRateSlope1).shiftedBy(-4);
|
|
972
|
+
const variableRate2 = (0, number_1.bnOrZero)(rateStrategy.variableRateSlope2).shiftedBy(-4);
|
|
973
|
+
const baseVariableBorrowRate = (0, number_1.bnOrZero)(rateStrategy.baseVariableBorrowRate).shiftedBy(-4);
|
|
974
974
|
if (utilizationRate.lte(optimalUsage)) {
|
|
975
975
|
const vRate = utilizationRate.times(variableRate1).div(optimalUsage).dp(4, bignumber_js_1.BigNumber.ROUND_CEIL);
|
|
976
976
|
return vRate.plus(baseVariableBorrowRate);
|
package/lib/modules/cosmwasm.js
CHANGED
|
@@ -27,7 +27,7 @@ class CosmWasmModule extends base_1.default {
|
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
28
|
const tmClient = util_1.GenericUtils.modifyTmClient(yield tendermint_rpc_1.Tendermint34Client.connect(tmRpcUrl));
|
|
29
29
|
const baseClient = new stargate_1.QueryClient(tmClient);
|
|
30
|
-
const rpcClient = stargate_1.createProtobufRpcClient(baseClient);
|
|
30
|
+
const rpcClient = (0, stargate_1.createProtobufRpcClient)(baseClient);
|
|
31
31
|
const cosmWasmClient = new query_1.QueryClientImpl(rpcClient);
|
|
32
32
|
return new CosmWasmModule(cosmWasmClient, sdkProvider);
|
|
33
33
|
});
|
package/lib/modules/gov.js
CHANGED
|
@@ -48,7 +48,7 @@ class GovModule extends base_1.default {
|
|
|
48
48
|
const value = tx_1.MsgDeposit.fromPartial({
|
|
49
49
|
proposalId: new long_1.default(params.proposalId),
|
|
50
50
|
depositor: wallet.bech32Address,
|
|
51
|
-
amount: amino_1.coins(params.amount, params.denom),
|
|
51
|
+
amount: (0, amino_1.coins)(params.amount, params.denom),
|
|
52
52
|
});
|
|
53
53
|
return yield wallet.sendTx({
|
|
54
54
|
typeUrl: util_1.CarbonTx.Types.MsgDeposit,
|
|
@@ -78,21 +78,21 @@ class GovModule extends base_1.default {
|
|
|
78
78
|
const createTokenMsg = {
|
|
79
79
|
title: title,
|
|
80
80
|
description: description,
|
|
81
|
-
msg: admin_1.transfromCreateTokenParams(msg, wallet.bech32Address),
|
|
81
|
+
msg: (0, admin_1.transfromCreateTokenParams)(msg, wallet.bech32Address),
|
|
82
82
|
};
|
|
83
83
|
return proposal_1.CreateTokenProposal.encode(createTokenMsg).finish();
|
|
84
84
|
case "SetMsgGasCostProposal":
|
|
85
85
|
const setMsgGasCostMsg = {
|
|
86
86
|
title: title,
|
|
87
87
|
description: description,
|
|
88
|
-
msg: admin_1.transfromSetMsgGasCostParams(msg),
|
|
88
|
+
msg: (0, admin_1.transfromSetMsgGasCostParams)(msg),
|
|
89
89
|
};
|
|
90
90
|
return proposal_2.SetMsgGasCostProposal.encode(setMsgGasCostMsg).finish();
|
|
91
91
|
case "SetMinGasPriceProposal":
|
|
92
92
|
const setMinGasPriceMsg = {
|
|
93
93
|
title: title,
|
|
94
94
|
description: description,
|
|
95
|
-
msg: admin_1.transfromSetMinGasPriceParams(msg),
|
|
95
|
+
msg: (0, admin_1.transfromSetMinGasPriceParams)(msg),
|
|
96
96
|
};
|
|
97
97
|
return proposal_2.SetMinGasPriceProposal.encode(setMinGasPriceMsg).finish();
|
|
98
98
|
case "RemoveMsgGasCostProposal":
|
|
@@ -113,49 +113,49 @@ class GovModule extends base_1.default {
|
|
|
113
113
|
const setRewardCurveMsg = {
|
|
114
114
|
title: title,
|
|
115
115
|
description: description,
|
|
116
|
-
msg: admin_1.transfromSetRewardCurveParams(msg),
|
|
116
|
+
msg: (0, admin_1.transfromSetRewardCurveParams)(msg),
|
|
117
117
|
};
|
|
118
118
|
return proposal_3.SetRewardCurveProposal.encode(setRewardCurveMsg).finish();
|
|
119
119
|
case "SetCommitmentCurveProposal":
|
|
120
120
|
const setCommitmentCurveMsg = {
|
|
121
121
|
title: title,
|
|
122
122
|
description: description,
|
|
123
|
-
msg: admin_1.transfromSetCommitmentCurveParams(msg),
|
|
123
|
+
msg: (0, admin_1.transfromSetCommitmentCurveParams)(msg),
|
|
124
124
|
};
|
|
125
125
|
return proposal_3.SetCommitmentCurveProposal.encode(setCommitmentCurveMsg).finish();
|
|
126
126
|
case "SetRewardsWeightsProposal":
|
|
127
127
|
const setRewardsWeightsMsg = {
|
|
128
128
|
title: title,
|
|
129
129
|
description: description,
|
|
130
|
-
msg: admin_1.transfromSetRewardsWeightsParams(msg),
|
|
130
|
+
msg: (0, admin_1.transfromSetRewardsWeightsParams)(msg),
|
|
131
131
|
};
|
|
132
132
|
return proposal_3.SetRewardsWeightsProposal.encode(setRewardsWeightsMsg).finish();
|
|
133
133
|
case "UpdatePoolProposal":
|
|
134
134
|
const updatePoolProposalMsg = {
|
|
135
135
|
title: title,
|
|
136
136
|
description: description,
|
|
137
|
-
msg: admin_1.transfromUpdatePoolParams(msg),
|
|
137
|
+
msg: (0, admin_1.transfromUpdatePoolParams)(msg),
|
|
138
138
|
};
|
|
139
139
|
return proposal_3.UpdatePoolProposal.encode(updatePoolProposalMsg).finish();
|
|
140
140
|
case "UpdateMarketProposal":
|
|
141
141
|
const updateMarketProposalMsg = {
|
|
142
142
|
title: title,
|
|
143
143
|
description: description,
|
|
144
|
-
msg: market_1.transfromUpdateMarketParams(msg),
|
|
144
|
+
msg: (0, market_1.transfromUpdateMarketParams)(msg),
|
|
145
145
|
};
|
|
146
146
|
return proposal_4.UpdateMarketProposal.encode(updateMarketProposalMsg).finish();
|
|
147
147
|
case "CreateOracleProposal":
|
|
148
148
|
const createOracleProposalMsg = {
|
|
149
149
|
title: title,
|
|
150
150
|
description: description,
|
|
151
|
-
msg: admin_1.transfromCreateOracleParams(msg, wallet.bech32Address),
|
|
151
|
+
msg: (0, admin_1.transfromCreateOracleParams)(msg, wallet.bech32Address),
|
|
152
152
|
};
|
|
153
153
|
return proposal_5.CreateOracleProposal.encode(createOracleProposalMsg).finish();
|
|
154
154
|
case "SettlementPriceProposal":
|
|
155
155
|
const settlementPriceProposalMsg = {
|
|
156
156
|
title: title,
|
|
157
157
|
description: description,
|
|
158
|
-
msg: admin_1.transformSetSettlementPriceParams(msg),
|
|
158
|
+
msg: (0, admin_1.transformSetSettlementPriceParams)(msg),
|
|
159
159
|
};
|
|
160
160
|
return proposal_6.SettlementPriceProposal.encode(settlementPriceProposalMsg).finish();
|
|
161
161
|
case "ParameterChangeProposal":
|
|
@@ -177,7 +177,7 @@ class GovModule extends base_1.default {
|
|
|
177
177
|
title: title,
|
|
178
178
|
description: description,
|
|
179
179
|
recipient: proposalMsg.recipient,
|
|
180
|
-
amount: admin_1.transformCommunityPoolSpendAmount(proposalMsg.amount),
|
|
180
|
+
amount: (0, admin_1.transformCommunityPoolSpendAmount)(proposalMsg.amount),
|
|
181
181
|
};
|
|
182
182
|
return distribution_1.CommunityPoolSpendProposal.encode(communityPoolSpendProposalMsg).finish();
|
|
183
183
|
case "CancelSoftwareUpgradeProposal":
|
|
@@ -145,7 +145,7 @@ class LiquidityPoolModule extends base_1.default {
|
|
|
145
145
|
const SECONDS_IN_A_WEEK = new bignumber_js_1.BigNumber(604800);
|
|
146
146
|
const mintDataResponse = yield this.sdkProvider.query.inflation.MintData({});
|
|
147
147
|
const mintData = mintDataResponse.mintData;
|
|
148
|
-
const nowTime = new bignumber_js_1.BigNumber(dayjs_1.default().unix());
|
|
148
|
+
const nowTime = new bignumber_js_1.BigNumber((0, dayjs_1.default)().unix());
|
|
149
149
|
const firstBlockTime = (_a = mintData === null || mintData === void 0 ? void 0 : mintData.firstBlockTime.toNumber()) !== null && _a !== void 0 ? _a : 0;
|
|
150
150
|
const difference = nowTime.minus(firstBlockTime);
|
|
151
151
|
const currentWeek = difference.div(SECONDS_IN_A_WEEK).dp(0, bignumber_js_1.BigNumber.ROUND_DOWN);
|
|
@@ -87,7 +87,7 @@ class EthLedgerAccount {
|
|
|
87
87
|
static tryConnect() {
|
|
88
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
89
|
try {
|
|
90
|
-
const transport = yield ledger_1.getLedgerTransport();
|
|
90
|
+
const transport = yield (0, ledger_1.getLedgerTransport)();
|
|
91
91
|
// get public key to assert that NEO app is open
|
|
92
92
|
const ethApp = new hw_app_eth_1.default(transport);
|
|
93
93
|
const bipString = EthLedgerAccount.getETHBIP44String();
|
|
@@ -39,7 +39,7 @@ exports.looksLikeTransportStatusError = looksLikeTransportStatusError;
|
|
|
39
39
|
* @returns error with modified message if found.
|
|
40
40
|
*/
|
|
41
41
|
function evalTransportError(err) {
|
|
42
|
-
const transportErr = lodash_1.cloneDeep(err);
|
|
42
|
+
const transportErr = (0, lodash_1.cloneDeep)(err);
|
|
43
43
|
switch (transportErr.statusCode) {
|
|
44
44
|
case StatusWord.APP_CLOSED:
|
|
45
45
|
transportErr.message = "Your NEO app is closed! Please login.";
|