carbon-js-sdk 0.2.10 → 0.2.11-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/clients/CarbonQueryClient.js +1 -1
- package/lib/clients/ETHClient.js +15 -15
- package/lib/clients/HydrogenClient.js +1 -1
- package/lib/clients/InsightsQueryClient.d.ts +3 -1
- package/lib/clients/InsightsQueryClient.js +17 -6
- package/lib/clients/NEOClient.js +7 -7
- package/lib/clients/TokenClient.d.ts +4 -0
- package/lib/clients/TokenClient.js +23 -7
- package/lib/clients/ZILClient.js +16 -16
- package/lib/codec/book/genesis.d.ts +1 -1
- package/lib/codec/book/genesis.js +1 -1
- package/lib/codec/book/query.d.ts +1 -1
- package/lib/codec/book/query.js +1 -1
- package/lib/codec/broker/genesis.d.ts +1 -1
- package/lib/codec/broker/genesis.js +1 -1
- package/lib/codec/broker/query.d.ts +3 -3
- package/lib/codec/broker/query.js +3 -3
- package/lib/codec/btcx/denom_cross_chain_info.d.ts +1 -1
- package/lib/codec/btcx/denom_cross_chain_info.js +1 -1
- package/lib/codec/btcx/query.d.ts +1 -1
- package/lib/codec/btcx/query.js +1 -1
- package/lib/codec/ccm/genesis.d.ts +1 -1
- package/lib/codec/ccm/genesis.js +1 -1
- package/lib/codec/cdp/asset_params.d.ts +1 -0
- package/lib/codec/cdp/asset_params.js +31 -15
- package/lib/codec/cdp/event.d.ts +226 -22
- package/lib/codec/cdp/event.js +1414 -80
- package/lib/codec/cdp/genesis.d.ts +57 -4
- package/lib/codec/cdp/genesis.js +417 -22
- package/lib/codec/cdp/query.d.ts +328 -94
- package/lib/codec/cdp/query.js +1300 -236
- package/lib/codec/cdp/tx.d.ts +466 -96
- package/lib/codec/cdp/tx.js +1961 -181
- package/lib/codec/coin/event.d.ts +1 -1
- package/lib/codec/coin/event.js +1 -1
- package/lib/codec/coin/genesis.d.ts +2 -2
- package/lib/codec/coin/genesis.js +2 -2
- package/lib/codec/coin/proposal.d.ts +1 -1
- package/lib/codec/coin/proposal.js +1 -1
- package/lib/codec/coin/query.d.ts +2 -5
- package/lib/codec/coin/query.js +2 -8
- package/lib/codec/coin/token.d.ts +11 -0
- package/lib/codec/coin/token.js +65 -1
- package/lib/codec/coin/tx.d.ts +1 -1
- package/lib/codec/coin/tx.js +1 -1
- package/lib/codec/cosmos/auth/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/auth/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/auth/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/auth/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/authz/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/authz/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/authz/v1beta1/tx.d.ts +1 -1
- package/lib/codec/cosmos/authz/v1beta1/tx.js +1 -1
- package/lib/codec/cosmos/bank/v1beta1/authz.d.ts +1 -1
- package/lib/codec/cosmos/bank/v1beta1/authz.js +1 -1
- package/lib/codec/cosmos/bank/v1beta1/bank.d.ts +1 -1
- package/lib/codec/cosmos/bank/v1beta1/bank.js +1 -1
- package/lib/codec/cosmos/bank/v1beta1/genesis.d.ts +2 -2
- package/lib/codec/cosmos/bank/v1beta1/genesis.js +2 -2
- package/lib/codec/cosmos/bank/v1beta1/query.d.ts +3 -3
- package/lib/codec/cosmos/bank/v1beta1/query.js +3 -3
- package/lib/codec/cosmos/bank/v1beta1/tx.d.ts +2 -2
- package/lib/codec/cosmos/bank/v1beta1/tx.js +2 -2
- package/lib/codec/cosmos/base/tendermint/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/base/tendermint/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/capability/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/capability/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/crisis/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/crisis/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/distribution/v1beta1/distribution.d.ts +1 -1
- package/lib/codec/cosmos/distribution/v1beta1/distribution.js +1 -1
- package/lib/codec/cosmos/distribution/v1beta1/genesis.d.ts +2 -2
- package/lib/codec/cosmos/distribution/v1beta1/genesis.js +2 -2
- package/lib/codec/cosmos/distribution/v1beta1/query.d.ts +3 -3
- package/lib/codec/cosmos/distribution/v1beta1/query.js +3 -3
- package/lib/codec/cosmos/distribution/v1beta1/tx.d.ts +1 -1
- package/lib/codec/cosmos/distribution/v1beta1/tx.js +1 -1
- package/lib/codec/cosmos/evidence/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/evidence/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/feegrant/v1beta1/feegrant.d.ts +1 -1
- package/lib/codec/cosmos/feegrant/v1beta1/feegrant.js +1 -1
- package/lib/codec/cosmos/feegrant/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/feegrant/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/feegrant/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/feegrant/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/gov/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/gov/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/gov/v1beta1/gov.d.ts +1 -1
- package/lib/codec/cosmos/gov/v1beta1/gov.js +1 -1
- package/lib/codec/cosmos/gov/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/gov/v1beta1/query.js +4 -4
- package/lib/codec/cosmos/gov/v1beta1/tx.d.ts +2 -2
- package/lib/codec/cosmos/gov/v1beta1/tx.js +4 -4
- package/lib/codec/cosmos/mint/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/mint/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/mint/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/mint/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/params/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/params/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/slashing/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/slashing/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/slashing/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/slashing/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/staking/v1beta1/authz.d.ts +1 -1
- package/lib/codec/cosmos/staking/v1beta1/authz.js +1 -1
- package/lib/codec/cosmos/staking/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/staking/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/staking/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/staking/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/staking/v1beta1/staking.d.ts +1 -1
- package/lib/codec/cosmos/staking/v1beta1/staking.js +1 -1
- package/lib/codec/cosmos/staking/v1beta1/tx.d.ts +2 -2
- package/lib/codec/cosmos/staking/v1beta1/tx.js +2 -2
- package/lib/codec/cosmos/tx/signing/v1beta1/signing.d.ts +1 -1
- package/lib/codec/cosmos/tx/signing/v1beta1/signing.js +1 -1
- package/lib/codec/cosmos/tx/v1beta1/service.d.ts +3 -3
- package/lib/codec/cosmos/tx/v1beta1/service.js +3 -3
- package/lib/codec/cosmos/tx/v1beta1/tx.d.ts +3 -3
- package/lib/codec/cosmos/tx/v1beta1/tx.js +5 -5
- package/lib/codec/cosmos/upgrade/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/upgrade/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/vesting/v1beta1/tx.d.ts +1 -1
- package/lib/codec/cosmos/vesting/v1beta1/tx.js +1 -1
- package/lib/codec/cosmos/vesting/v1beta1/vesting.d.ts +2 -2
- package/lib/codec/cosmos/vesting/v1beta1/vesting.js +2 -2
- package/lib/codec/fee/genesis.d.ts +1 -1
- package/lib/codec/fee/genesis.js +1 -1
- package/lib/codec/fee/proposal.d.ts +1 -1
- package/lib/codec/fee/proposal.js +1 -1
- package/lib/codec/fee/query.d.ts +1 -1
- package/lib/codec/fee/query.js +1 -1
- package/lib/codec/fee/tx.d.ts +1 -1
- package/lib/codec/fee/tx.js +1 -1
- package/lib/codec/headersync/genesis.d.ts +1 -1
- package/lib/codec/headersync/genesis.js +1 -1
- package/lib/codec/headersync/query.d.ts +1 -1
- package/lib/codec/headersync/query.js +1 -1
- package/lib/codec/index.d.ts +53 -22
- package/lib/codec/index.js +514 -384
- package/lib/codec/inflation/genesis.d.ts +1 -1
- package/lib/codec/inflation/genesis.js +1 -1
- package/lib/codec/inflation/query.d.ts +1 -1
- package/lib/codec/inflation/query.js +1 -1
- package/lib/codec/insurance/genesis.d.ts +1 -1
- package/lib/codec/insurance/genesis.js +1 -1
- package/lib/codec/leverage/genesis.d.ts +1 -1
- package/lib/codec/leverage/genesis.js +1 -1
- package/lib/codec/leverage/query.d.ts +1 -1
- package/lib/codec/leverage/query.js +1 -1
- package/lib/codec/liquidation/genesis.d.ts +1 -1
- package/lib/codec/liquidation/genesis.js +1 -1
- package/lib/codec/liquidation/query.d.ts +1 -1
- package/lib/codec/liquidation/query.js +1 -1
- package/lib/codec/liquidation/quote_changes.d.ts +1 -1
- package/lib/codec/liquidation/quote_changes.js +1 -1
- package/lib/codec/liquiditypool/event.d.ts +2 -2
- package/lib/codec/liquiditypool/event.js +2 -2
- package/lib/codec/liquiditypool/genesis.d.ts +2 -2
- package/lib/codec/liquiditypool/genesis.js +2 -2
- package/lib/codec/liquiditypool/proposal.d.ts +1 -1
- package/lib/codec/liquiditypool/proposal.js +1 -1
- package/lib/codec/liquiditypool/query.d.ts +2 -2
- package/lib/codec/liquiditypool/query.js +2 -2
- package/lib/codec/liquiditypool/tx.d.ts +1 -1
- package/lib/codec/liquiditypool/tx.js +1 -1
- package/lib/codec/lockproxy/genesis.d.ts +1 -1
- package/lib/codec/lockproxy/genesis.js +1 -1
- package/lib/codec/lockproxy/query.d.ts +1 -1
- package/lib/codec/lockproxy/query.js +1 -1
- package/lib/codec/market/event.d.ts +1 -1
- package/lib/codec/market/event.js +1 -1
- package/lib/codec/market/genesis.d.ts +2 -1
- package/lib/codec/market/genesis.js +20 -2
- package/lib/codec/market/proposal.d.ts +1 -1
- package/lib/codec/market/proposal.js +1 -1
- package/lib/codec/market/query.d.ts +1 -1
- package/lib/codec/market/query.js +1 -1
- package/lib/codec/market/tx.d.ts +1 -1
- package/lib/codec/market/tx.js +1 -1
- package/lib/codec/marketstats/genesis.d.ts +1 -1
- package/lib/codec/marketstats/genesis.js +1 -1
- package/lib/codec/marketstats/query.d.ts +2 -2
- package/lib/codec/marketstats/query.js +2 -2
- package/lib/codec/misc/message.d.ts +1 -1
- package/lib/codec/misc/message.js +1 -1
- package/lib/codec/misc/query.d.ts +3 -3
- package/lib/codec/misc/query.js +3 -3
- package/lib/codec/misc/trade.d.ts +1 -0
- package/lib/codec/misc/trade.js +17 -0
- package/lib/codec/misc/transaction.d.ts +1 -1
- package/lib/codec/misc/transaction.js +1 -1
- package/lib/codec/oracle/event.d.ts +1 -1
- package/lib/codec/oracle/event.js +1 -1
- package/lib/codec/oracle/genesis.d.ts +1 -1
- package/lib/codec/oracle/genesis.js +1 -1
- package/lib/codec/oracle/proposal.d.ts +1 -1
- package/lib/codec/oracle/proposal.js +1 -1
- package/lib/codec/oracle/query.d.ts +2 -2
- package/lib/codec/oracle/query.js +2 -2
- package/lib/codec/order/event.d.ts +1 -1
- package/lib/codec/order/event.js +1 -1
- package/lib/codec/order/genesis.d.ts +1 -1
- package/lib/codec/order/genesis.js +1 -1
- package/lib/codec/order/query.d.ts +1 -1
- package/lib/codec/order/query.js +1 -1
- package/lib/codec/position/event.d.ts +1 -1
- package/lib/codec/position/event.js +1 -1
- package/lib/codec/position/genesis.d.ts +1 -1
- package/lib/codec/position/genesis.js +1 -1
- package/lib/codec/position/query.d.ts +1 -1
- package/lib/codec/position/query.js +1 -1
- package/lib/codec/pricing/event.d.ts +11 -1
- package/lib/codec/pricing/event.js +52 -2
- package/lib/codec/pricing/genesis.d.ts +2 -1
- package/lib/codec/pricing/genesis.js +20 -5
- package/lib/codec/pricing/pricing.d.ts +13 -0
- package/lib/codec/pricing/pricing.js +83 -1
- package/lib/codec/pricing/query.d.ts +1 -1
- package/lib/codec/pricing/query.js +1 -1
- package/lib/codec/profile/event.d.ts +1 -1
- package/lib/codec/profile/event.js +1 -1
- package/lib/codec/profile/genesis.d.ts +1 -1
- package/lib/codec/profile/genesis.js +1 -1
- package/lib/codec/profile/query.d.ts +1 -1
- package/lib/codec/profile/query.js +1 -1
- package/lib/codec/subaccount/genesis.d.ts +1 -1
- package/lib/codec/subaccount/genesis.js +1 -1
- package/lib/codec/subaccount/query.d.ts +1 -1
- package/lib/codec/subaccount/query.js +1 -1
- package/lib/codec/tendermint/abci/types.d.ts +4 -4
- package/lib/codec/tendermint/abci/types.js +4 -4
- package/lib/codec/tendermint/types/block.d.ts +2 -2
- package/lib/codec/tendermint/types/block.js +2 -2
- package/lib/codec/tendermint/types/evidence.d.ts +2 -2
- package/lib/codec/tendermint/types/evidence.js +2 -2
- package/lib/codec/tendermint/types/types.d.ts +3 -3
- package/lib/codec/tendermint/types/types.js +3 -3
- package/lib/codec/tendermint/types/validator.d.ts +1 -1
- package/lib/codec/tendermint/types/validator.js +1 -1
- package/lib/constant/generic.js +1 -1
- package/lib/insights/common.d.ts +2 -0
- package/lib/insights/common.js +2 -0
- package/lib/insights/competition.d.ts +49 -7
- package/lib/modules/admin.d.ts +61 -1
- package/lib/modules/admin.js +193 -42
- package/lib/modules/cdp.d.ts +55 -12
- package/lib/modules/cdp.js +134 -20
- 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 +67 -26
- 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 +72 -32
- 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/util/tx.d.ts +42 -14
- package/lib/wallet/CarbonSigner.js +2 -2
- package/lib/wallet/CarbonSigningClient.js +8 -8
- package/lib/wallet/CarbonWallet.js +6 -6
- package/lib/websocket/channel.js +26 -0
- package/lib/websocket/connector.js +3 -3
- package/lib/websocket/models.d.ts +63 -0
- package/lib/websocket/types.d.ts +38 -3
- package/lib/websocket/types.js +16 -0
- package/package.json +2 -1
package/lib/util/tx.d.ts
CHANGED
|
@@ -57,16 +57,48 @@ export declare const Types: {
|
|
|
57
57
|
MsgCancelOrderResponse: string;
|
|
58
58
|
MsgCancelAll: string;
|
|
59
59
|
MsgCancelAllResponse: string;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
MsgAddRateStrategy: string;
|
|
61
|
+
MsgAddRateStrategyResponse: string;
|
|
62
|
+
MsgUpdateRateStrategy: string;
|
|
63
|
+
MsgUpdateRateStrategyResponse: string;
|
|
64
|
+
MsgRemoveRateStrategy: string;
|
|
65
|
+
MsgRemoveRateStrategyResponse: string;
|
|
66
|
+
MsgAddAsset: string;
|
|
67
|
+
MsgAddAssetResponse: string;
|
|
68
|
+
MsgUpdateAsset: string;
|
|
69
|
+
MsgUpdateAssetResponse: string;
|
|
70
|
+
MsgSupplyAsset: string;
|
|
71
|
+
MsgSupplyAssetResponse: string;
|
|
72
|
+
MsgWithdrawAsset: string;
|
|
73
|
+
MsgWithdrawAssetResponse: string;
|
|
74
|
+
MsgLockCollateral: string;
|
|
75
|
+
MsgLockCollateralResponse: string;
|
|
76
|
+
MsgUnlockCollateral: string;
|
|
77
|
+
MsgUnlockCollateralResponse: string;
|
|
78
|
+
MsgBorrowAsset: string;
|
|
79
|
+
MsgBorrowAssetResponse: string;
|
|
80
|
+
MsgRepayAsset: string;
|
|
81
|
+
MsgRepayAssetResponse: string;
|
|
82
|
+
MsgSupplyAssetAndLockCollateral: string;
|
|
83
|
+
MsgSupplyAssetAndLockCollateralResponse: string;
|
|
84
|
+
MsgUnlockCollateralAndWithdrawAsset: string;
|
|
85
|
+
MsgUnlockCollateralAndWithdrawAssetResponse: string;
|
|
86
|
+
MsgLiquidateCollateral: string;
|
|
87
|
+
MsgLiquidateCollateralResponse: string;
|
|
88
|
+
MsgSetLiquidationFee: string;
|
|
89
|
+
MsgSetLiquidationFeeResponse: string;
|
|
90
|
+
MsgSetInterestFee: string;
|
|
91
|
+
MsgSetInterestFeeResponse: string;
|
|
92
|
+
MsgRepayAssetWithCdpTokens: string;
|
|
93
|
+
MsgRepayAssetWithCdpTokensResponse: string;
|
|
94
|
+
MsgRepayAssetWithCollateral: string;
|
|
95
|
+
MsgRepayAssetWithCollateralResponse: string;
|
|
96
|
+
MsgSetStablecoinInterestRate: string;
|
|
97
|
+
MsgSetStablecoinInterestRateResponse: string;
|
|
98
|
+
MsgMintStablecoin: string;
|
|
99
|
+
MsgMintStablecoinResponse: string;
|
|
100
|
+
MsgReturnStablecoin: string;
|
|
101
|
+
MsgReturnStablecoinResponse: string;
|
|
70
102
|
MsgSyncGenesis: string;
|
|
71
103
|
MsgSyncGenesisResponse: string;
|
|
72
104
|
MsgSyncHeaders: string;
|
|
@@ -85,10 +117,6 @@ export declare const Types: {
|
|
|
85
117
|
SetMinGasPriceProposal: string;
|
|
86
118
|
RemoveMsgGasCostProposal: string;
|
|
87
119
|
RemoveMinGasPriceProposal: string;
|
|
88
|
-
MsgEnableSend: string;
|
|
89
|
-
MsgEnableSendResponse: string;
|
|
90
|
-
MsgDisableSend: string;
|
|
91
|
-
MsgDisableSendResponse: string;
|
|
92
120
|
MsgCreate: string;
|
|
93
121
|
MsgCreateResponse: string;
|
|
94
122
|
MsgBind: string;
|
|
@@ -93,9 +93,9 @@ class CarbonLedgerSigner {
|
|
|
93
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
94
|
const account = yield this.retrieveAccount();
|
|
95
95
|
const { pubkey } = account;
|
|
96
|
-
const msg = JSON.stringify(generic_1.sortObject(doc));
|
|
96
|
+
const msg = JSON.stringify((0, generic_1.sortObject)(doc));
|
|
97
97
|
const signBytes = yield this.ledger.sign(msg);
|
|
98
|
-
const signature = amino_1.encodeSecp256k1Signature(pubkey, signBytes);
|
|
98
|
+
const signature = (0, amino_1.encodeSecp256k1Signature)(pubkey, signBytes);
|
|
99
99
|
return {
|
|
100
100
|
signed: doc,
|
|
101
101
|
signature,
|
|
@@ -62,7 +62,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
62
62
|
*/
|
|
63
63
|
sign(signerAddress, messages, fee, memo, signerData) {
|
|
64
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
return proto_signing_1.isOfflineDirectSigner(this.signer)
|
|
65
|
+
return (0, proto_signing_1.isOfflineDirectSigner)(this.signer)
|
|
66
66
|
? this.signDirect(signerAddress, messages, fee, memo, signerData)
|
|
67
67
|
: this.signAmino(signerAddress, messages, fee, memo, signerData);
|
|
68
68
|
});
|
|
@@ -74,7 +74,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
74
74
|
if (!accountFromSigner) {
|
|
75
75
|
throw new Error("Failed to retrieve account from signer");
|
|
76
76
|
}
|
|
77
|
-
const pubkey = proto_signing_1.encodePubkey(amino_1.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
|
|
77
|
+
const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
|
|
78
78
|
const txBodyEncodeObject = {
|
|
79
79
|
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
80
80
|
value: Object.assign({ messages: messages, memo: memo }, timeoutHeight && {
|
|
@@ -83,13 +83,13 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
83
83
|
};
|
|
84
84
|
const txBodyBytes = this.registry.encode(txBodyEncodeObject);
|
|
85
85
|
const gasLimit = math_1.Int53.fromString(fee.gas).toNumber();
|
|
86
|
-
const authInfoBytes = proto_signing_1.makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit);
|
|
87
|
-
const signDoc = proto_signing_1.makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
|
86
|
+
const authInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence }], fee.amount, gasLimit);
|
|
87
|
+
const signDoc = (0, proto_signing_1.makeSignDoc)(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
|
88
88
|
const { signature, signed } = yield signer.signDirect(signerAddress, signDoc);
|
|
89
89
|
return tx_1.TxRaw.fromPartial({
|
|
90
90
|
bodyBytes: signed.bodyBytes,
|
|
91
91
|
authInfoBytes: signed.authInfoBytes,
|
|
92
|
-
signatures: [encoding_1.fromBase64(signature.signature)],
|
|
92
|
+
signatures: [(0, encoding_1.fromBase64)(signature.signature)],
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
}
|
|
@@ -100,7 +100,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
100
100
|
if (!accountFromSigner) {
|
|
101
101
|
throw new Error("Failed to retrieve account from signer");
|
|
102
102
|
}
|
|
103
|
-
const pubkey = proto_signing_1.encodePubkey(amino_1.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
|
|
103
|
+
const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
|
|
104
104
|
const signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
|
|
105
105
|
const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
|
|
106
106
|
const signDoc = makeSignDocAmino(msgs, fee, chainId, memo, accountNumber, sequence, timeoutHeight !== null && timeoutHeight !== void 0 ? timeoutHeight : 0);
|
|
@@ -115,11 +115,11 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
115
115
|
const signedTxBodyBytes = this.registry.encode(signedTxBodyEncodeObject);
|
|
116
116
|
const signedGasLimit = math_1.Int53.fromString(signed.fee.gas).toNumber();
|
|
117
117
|
const signedSequence = math_1.Int53.fromString(signed.sequence).toNumber();
|
|
118
|
-
const signedAuthInfoBytes = proto_signing_1.makeAuthInfoBytes([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode);
|
|
118
|
+
const signedAuthInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode);
|
|
119
119
|
return tx_1.TxRaw.fromPartial({
|
|
120
120
|
bodyBytes: signedTxBodyBytes,
|
|
121
121
|
authInfoBytes: signedAuthInfoBytes,
|
|
122
|
-
signatures: [encoding_1.fromBase64(signature.signature)],
|
|
122
|
+
signatures: [(0, encoding_1.fromBase64)(signature.signature)],
|
|
123
123
|
});
|
|
124
124
|
});
|
|
125
125
|
}
|
|
@@ -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 = amino_1.encodeSecp256k1Signature(account.pubkey, txRaw.signatures[0]);
|
|
151
|
+
signature = (0, 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 (stargate_1.isDeliverTxFailure(response)) {
|
|
169
|
+
if ((0, stargate_1.isDeliverTxFailure)(response)) {
|
|
170
170
|
// tx failed
|
|
171
171
|
console.error(response);
|
|
172
172
|
throw new Error(`[${response.code}] ${response.rawLog}`);
|
|
@@ -206,9 +206,9 @@ class CarbonWallet {
|
|
|
206
206
|
try {
|
|
207
207
|
if (!this.accountInfo || this.sequenceInvalidated)
|
|
208
208
|
yield this.reloadAccountSequence();
|
|
209
|
-
const heightResponse = yield fetch_1.fetch(`${this.networkConfig.tmRpcUrl}/blockchain?cache=${new Date().getTime()}`);
|
|
209
|
+
const heightResponse = yield (0, fetch_1.fetch)(`${this.networkConfig.tmRpcUrl}/blockchain?cache=${new Date().getTime()}`);
|
|
210
210
|
const heightRes = yield heightResponse.json();
|
|
211
|
-
const height = number_1.bnOrZero((_a = heightRes.result) === null || _a === void 0 ? void 0 : _a.last_height);
|
|
211
|
+
const height = (0, number_1.bnOrZero)((_a = heightRes.result) === null || _a === void 0 ? void 0 : _a.last_height);
|
|
212
212
|
const timeoutHeight = height.isZero() ? undefined : height.toNumber() + this.defaultTimeoutBlocks;
|
|
213
213
|
const sequence = this.accountInfo.sequence;
|
|
214
214
|
this.accountInfo = Object.assign(Object.assign({}, this.accountInfo), { sequence: sequence + 1 });
|
|
@@ -342,12 +342,12 @@ class CarbonWallet {
|
|
|
342
342
|
const queryClient = this.getQueryClient();
|
|
343
343
|
const { msgGasCosts } = yield queryClient.fee.MsgGasCostAll({});
|
|
344
344
|
this.txGasCosts = msgGasCosts.reduce((result, item) => {
|
|
345
|
-
result[item.msgType] = number_1.bnOrZero(item.gasCost);
|
|
345
|
+
result[item.msgType] = (0, number_1.bnOrZero)(item.gasCost);
|
|
346
346
|
return result;
|
|
347
347
|
}, {});
|
|
348
348
|
const { minGasPrices } = yield queryClient.fee.MinGasPriceAll({});
|
|
349
349
|
this.txGasPrices = minGasPrices.reduce((result, item) => {
|
|
350
|
-
result[item.denom] = number_1.bnOrZero(item.gasPrice).shiftedBy(-18); // sdk.Dec shifting
|
|
350
|
+
result[item.denom] = (0, number_1.bnOrZero)(item.gasPrice).shiftedBy(-18); // sdk.Dec shifting
|
|
351
351
|
return result;
|
|
352
352
|
}, {});
|
|
353
353
|
if (!this.txGasPrices[this.defaultFeeDenom]) {
|
package/lib/websocket/channel.js
CHANGED
|
@@ -72,6 +72,18 @@ const generateChannelId = (params) => {
|
|
|
72
72
|
const { channel, address } = params;
|
|
73
73
|
return [channel, address].join(':');
|
|
74
74
|
}
|
|
75
|
+
case types_1.WSChannel.cdp_borrows: {
|
|
76
|
+
const { channel, address } = params;
|
|
77
|
+
return [channel, address].join(':');
|
|
78
|
+
}
|
|
79
|
+
case types_1.WSChannel.cdp_collaterals: {
|
|
80
|
+
const { channel, address } = params;
|
|
81
|
+
return [channel, address].join(':');
|
|
82
|
+
}
|
|
83
|
+
case types_1.WSChannel.cdp_liquidate_collaterals: {
|
|
84
|
+
const { channel } = params;
|
|
85
|
+
return [channel].join(':');
|
|
86
|
+
}
|
|
75
87
|
default:
|
|
76
88
|
throw new Error(`invalid subscription channel: ${params.channel}`);
|
|
77
89
|
}
|
|
@@ -168,6 +180,20 @@ const parseChannelId = (rawChannelId) => {
|
|
|
168
180
|
channel,
|
|
169
181
|
address,
|
|
170
182
|
};
|
|
183
|
+
case types_1.WSChannel.cdp_borrows:
|
|
184
|
+
return {
|
|
185
|
+
channel,
|
|
186
|
+
address,
|
|
187
|
+
};
|
|
188
|
+
case types_1.WSChannel.cdp_collaterals:
|
|
189
|
+
return {
|
|
190
|
+
channel,
|
|
191
|
+
address,
|
|
192
|
+
};
|
|
193
|
+
case types_1.WSChannel.cdp_liquidate_collaterals:
|
|
194
|
+
return {
|
|
195
|
+
channel,
|
|
196
|
+
};
|
|
171
197
|
default:
|
|
172
198
|
throw new Error('Error parsing channelId');
|
|
173
199
|
}
|
|
@@ -171,7 +171,7 @@ class WSConnector {
|
|
|
171
171
|
params = [params]; // eslint-disable-line no-param-reassign
|
|
172
172
|
}
|
|
173
173
|
for (const param of params) {
|
|
174
|
-
const channelId = channel_1.generateChannelId(param);
|
|
174
|
+
const channelId = (0, channel_1.generateChannelId)(param);
|
|
175
175
|
const shouldSubscribe = this.channelHandlers[channelId] === undefined;
|
|
176
176
|
this.channelHandlers[channelId] = handler;
|
|
177
177
|
if (shouldSubscribe) {
|
|
@@ -193,7 +193,7 @@ class WSConnector {
|
|
|
193
193
|
}
|
|
194
194
|
const channelIds = [];
|
|
195
195
|
for (const param of params) {
|
|
196
|
-
const channelId = channel_1.generateChannelId(param);
|
|
196
|
+
const channelId = (0, channel_1.generateChannelId)(param);
|
|
197
197
|
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 = channel_1.parseChannelId(message.channel);
|
|
282
|
+
const params = (0, channel_1.parseChannelId)(message.channel);
|
|
283
283
|
this.unsubscribe({ channel: params.channel });
|
|
284
284
|
}
|
|
285
285
|
catch (error) {
|
|
@@ -144,3 +144,66 @@ export interface Commitment {
|
|
|
144
144
|
commitment_power: string;
|
|
145
145
|
boost_factor: string;
|
|
146
146
|
}
|
|
147
|
+
export interface CDPParams {
|
|
148
|
+
interest_fee: string;
|
|
149
|
+
liquidation_fee: string;
|
|
150
|
+
stable_coin_interest_rate: string;
|
|
151
|
+
}
|
|
152
|
+
export interface RateStrategy {
|
|
153
|
+
name: string;
|
|
154
|
+
optimal_usage: string;
|
|
155
|
+
base_variable_borrow_rate: string;
|
|
156
|
+
variable_rate_slope_1: string;
|
|
157
|
+
variable_rate_slope_2: string;
|
|
158
|
+
base_stable_borrow_rate: string;
|
|
159
|
+
stable_rate_slope_1: string;
|
|
160
|
+
stable_rate_slope_2: string;
|
|
161
|
+
optimal_stable_to_total_debt_ratio: string;
|
|
162
|
+
}
|
|
163
|
+
export interface Asset {
|
|
164
|
+
asset_params: {
|
|
165
|
+
denom: string;
|
|
166
|
+
oracle_id: string;
|
|
167
|
+
rate_strategy_name: string;
|
|
168
|
+
loan_to_value: string;
|
|
169
|
+
liquidation_threshold: string;
|
|
170
|
+
liquidation_bonus: string;
|
|
171
|
+
supply_cap: string;
|
|
172
|
+
borrow_cap: string;
|
|
173
|
+
};
|
|
174
|
+
asset_utilization: {
|
|
175
|
+
denom: string;
|
|
176
|
+
total_borrowed: string;
|
|
177
|
+
total_amount: string;
|
|
178
|
+
utilizationRate: string;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
export interface Collateral {
|
|
182
|
+
cdp_denom: string;
|
|
183
|
+
denom: string;
|
|
184
|
+
cdp_to_actual_ratio: string;
|
|
185
|
+
amount: string;
|
|
186
|
+
value_in_usd: string;
|
|
187
|
+
}
|
|
188
|
+
export interface Debt {
|
|
189
|
+
denom: string;
|
|
190
|
+
amount: string;
|
|
191
|
+
value_in_usd: string;
|
|
192
|
+
}
|
|
193
|
+
export interface AccountData {
|
|
194
|
+
total_collaterals_usd: string;
|
|
195
|
+
total_debts_usd: string;
|
|
196
|
+
available_borrows_usd: string;
|
|
197
|
+
curr_liquidation_threshold: string;
|
|
198
|
+
health_factor: string;
|
|
199
|
+
}
|
|
200
|
+
export interface CDPBorrow {
|
|
201
|
+
address: string;
|
|
202
|
+
amount: string;
|
|
203
|
+
denom: string;
|
|
204
|
+
}
|
|
205
|
+
export interface CDPCollaterals {
|
|
206
|
+
address: string;
|
|
207
|
+
amount: string;
|
|
208
|
+
denom: string;
|
|
209
|
+
}
|
package/lib/websocket/types.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ export declare enum WSChannel {
|
|
|
15
15
|
positions_by_market = "positions_by_market",
|
|
16
16
|
pools = "pools",
|
|
17
17
|
pools_by_id = "pools_by_id",
|
|
18
|
-
commitments = "commitments"
|
|
18
|
+
commitments = "commitments",
|
|
19
|
+
cdp_borrows = "cdp_borrows",
|
|
20
|
+
cdp_collaterals = "cdp_collaterals",
|
|
21
|
+
cdp_liquidate_collaterals = "cdp_liquidate_collaterals"
|
|
19
22
|
}
|
|
20
23
|
export declare enum WSRequest {
|
|
21
24
|
MarketStats = "get_market_stats",
|
|
@@ -31,7 +34,20 @@ export declare enum WSRequest {
|
|
|
31
34
|
Balances = "get_balances",
|
|
32
35
|
OrderBook = "get_orderbook",
|
|
33
36
|
Pools = "get_pools",
|
|
34
|
-
Commitments = "get_commitments"
|
|
37
|
+
Commitments = "get_commitments",
|
|
38
|
+
CDPAllAssets = "get_cdp_all_assets",
|
|
39
|
+
CDPAssets = "get_cdp_assets",
|
|
40
|
+
CDPAccountCollaterals = "get_cdp_account_collaterals",
|
|
41
|
+
CDPAccountDebts = "get_cdp_account_debts",
|
|
42
|
+
CDPAccountData = "get_cdp_account_data",
|
|
43
|
+
CDPParams = "get_cdp_params",
|
|
44
|
+
CDPAllRateStrategies = "get_cdp_all_rate_strategies",
|
|
45
|
+
CDPRateStrategies = "get_cdp_rate_strategies",
|
|
46
|
+
CDPBorrows = "get_cdp_borrows",
|
|
47
|
+
CDPTotalBorrows = "get_cdp_total_borrows",
|
|
48
|
+
CDPCollaterals = "get_cdp_collaterals",
|
|
49
|
+
CDPTotalCollaterals = "get_cdp_total_collaterals",
|
|
50
|
+
CDPLiquidateCollateral = "get_cdp_liquidate_collateral"
|
|
35
51
|
}
|
|
36
52
|
export interface WsGetRecentTradesParams {
|
|
37
53
|
market: string;
|
|
@@ -75,6 +91,17 @@ export interface WsGetPositionsParams {
|
|
|
75
91
|
export interface WsGetCommitmentsParams {
|
|
76
92
|
address: string;
|
|
77
93
|
}
|
|
94
|
+
export interface WsGetCDPParams {
|
|
95
|
+
}
|
|
96
|
+
export interface WsGetCDPAssetParams {
|
|
97
|
+
denom: string;
|
|
98
|
+
}
|
|
99
|
+
export interface WsGetCDPAccountParams {
|
|
100
|
+
address: string;
|
|
101
|
+
}
|
|
102
|
+
export interface WsGetCDPRateStrategiesParams {
|
|
103
|
+
name: string;
|
|
104
|
+
}
|
|
78
105
|
export interface WsSubscribeParams {
|
|
79
106
|
channel: WSChannel;
|
|
80
107
|
}
|
|
@@ -137,4 +164,12 @@ export interface WsUnsubscribeCandlesticksParams extends WsSubscribeParams {
|
|
|
137
164
|
market: string;
|
|
138
165
|
resolution: string;
|
|
139
166
|
}
|
|
140
|
-
export
|
|
167
|
+
export interface WsSubscribeCDPBorrows extends WsSubscribeParams {
|
|
168
|
+
address: string;
|
|
169
|
+
}
|
|
170
|
+
export interface WsSubscribeCDPCollaterals extends WsSubscribeParams {
|
|
171
|
+
address: string;
|
|
172
|
+
}
|
|
173
|
+
export interface WsSubscribeCDPLiquidateCollaterals extends WsSubscribeParams {
|
|
174
|
+
}
|
|
175
|
+
export declare type WsSubscriptionParams = WsSubscribeCandlesticksParams | WsSubscribeBooksParams | WsSubscribeRecentTradesParams | WsSubscribeOrdersAllParams | WsSubscribeOrdersByMarketParams | WsSubscribeWalletBalanceParams | WsSubscribeAccountTradesAllParams | WsSubscribeAccountTradesByMarketParams | WsSubscribeMarketStatsAllParams | WsSubscribeMarketStatsByMarketParams | WsSubscribeLeveragesAllParams | WsSubscribeLeveragesByMarketParams | WsSubscribePositionsAllParams | WsSubscribePositionsByMarketParams | WsSubscribePoolsAllParams | WsSubscribePoolsByIdParams | WsSubscribeCommitmentParams | WsUnsubscribeCandlesticksParams | WsSubscribeCDPBorrows | WsSubscribeCDPCollaterals | WsSubscribeCDPLiquidateCollaterals;
|
package/lib/websocket/types.js
CHANGED
|
@@ -20,6 +20,9 @@ var WSChannel;
|
|
|
20
20
|
WSChannel["pools"] = "pools";
|
|
21
21
|
WSChannel["pools_by_id"] = "pools_by_id";
|
|
22
22
|
WSChannel["commitments"] = "commitments";
|
|
23
|
+
WSChannel["cdp_borrows"] = "cdp_borrows";
|
|
24
|
+
WSChannel["cdp_collaterals"] = "cdp_collaterals";
|
|
25
|
+
WSChannel["cdp_liquidate_collaterals"] = "cdp_liquidate_collaterals";
|
|
23
26
|
})(WSChannel = exports.WSChannel || (exports.WSChannel = {}));
|
|
24
27
|
var WSRequest;
|
|
25
28
|
(function (WSRequest) {
|
|
@@ -37,4 +40,17 @@ var WSRequest;
|
|
|
37
40
|
WSRequest["OrderBook"] = "get_orderbook";
|
|
38
41
|
WSRequest["Pools"] = "get_pools";
|
|
39
42
|
WSRequest["Commitments"] = "get_commitments";
|
|
43
|
+
WSRequest["CDPAllAssets"] = "get_cdp_all_assets";
|
|
44
|
+
WSRequest["CDPAssets"] = "get_cdp_assets";
|
|
45
|
+
WSRequest["CDPAccountCollaterals"] = "get_cdp_account_collaterals";
|
|
46
|
+
WSRequest["CDPAccountDebts"] = "get_cdp_account_debts";
|
|
47
|
+
WSRequest["CDPAccountData"] = "get_cdp_account_data";
|
|
48
|
+
WSRequest["CDPParams"] = "get_cdp_params";
|
|
49
|
+
WSRequest["CDPAllRateStrategies"] = "get_cdp_all_rate_strategies";
|
|
50
|
+
WSRequest["CDPRateStrategies"] = "get_cdp_rate_strategies";
|
|
51
|
+
WSRequest["CDPBorrows"] = "get_cdp_borrows";
|
|
52
|
+
WSRequest["CDPTotalBorrows"] = "get_cdp_total_borrows";
|
|
53
|
+
WSRequest["CDPCollaterals"] = "get_cdp_collaterals";
|
|
54
|
+
WSRequest["CDPTotalCollaterals"] = "get_cdp_total_collaterals";
|
|
55
|
+
WSRequest["CDPLiquidateCollateral"] = "get_cdp_liquidate_collateral";
|
|
40
56
|
})(WSRequest = exports.WSRequest || (exports.WSRequest = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-js-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11-dev.2",
|
|
4
4
|
"description": "TypeScript SDK for Carbon blockchain",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@cityofzion/neon-core": "^4.9.0",
|
|
41
41
|
"@cityofzion/neon-js": "^4.9.0",
|
|
42
42
|
"@cityofzion/neon-core-next": "npm:@cityofzion/neon-core@^5.0.0",
|
|
43
|
+
"@cityofzion/neon-js": "^4.9.0",
|
|
43
44
|
"@cosmjs/proto-signing": "^0.28.10",
|
|
44
45
|
"@cosmjs/stargate": "^0.28.10",
|
|
45
46
|
"@grpc/grpc-js": "^1.3.2",
|