carbon-js-sdk 0.3.37-dev.1 → 0.3.38
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/ETHClient.js +4 -5
- package/lib/clients/TokenClient.js +1 -1
- package/lib/clients/ZILClient.js +3 -4
- package/lib/codec/cdp/asset_params.d.ts +0 -1
- package/lib/codec/cdp/tx.d.ts +1 -23
- package/lib/codec/cdp/tx.js +1 -100
- package/lib/codec/coin/event.d.ts +0 -81
- package/lib/codec/coin/event.js +1 -486
- package/lib/codec/coin/genesis.d.ts +1 -3
- package/lib/codec/coin/genesis.js +2 -18
- package/lib/codec/coin/query.d.ts +0 -85
- package/lib/codec/coin/query.js +1 -422
- package/lib/codec/coin/tx.d.ts +2 -196
- package/lib/codec/coin/tx.js +17 -1028
- package/lib/codec/index.d.ts +5 -24
- package/lib/codec/index.js +11 -86
- package/lib/codec/pricing/pricing.d.ts +0 -1
- package/lib/codec/pricing/pricing.js +2 -14
- package/lib/codec/pricing/tx.d.ts +0 -23
- package/lib/codec/pricing/tx.js +1 -112
- package/lib/constant/network.js +1 -1
- package/lib/modules/coin.d.ts +0 -11
- package/lib/modules/coin.js +0 -48
- package/lib/util/blockchain.d.ts +1 -2
- package/lib/util/blockchain.js +62 -95
- package/lib/util/tx.d.ts +0 -18
- package/package.json +1 -1
package/lib/constant/network.js
CHANGED
|
@@ -125,7 +125,7 @@ exports.NetworkConfigs = {
|
|
|
125
125
|
networkMagic: neon_core_next_1.CONST.MAGIC_NUMBER.TestNet,
|
|
126
126
|
},
|
|
127
127
|
zil: {
|
|
128
|
-
rpcURL: "
|
|
128
|
+
rpcURL: "",
|
|
129
129
|
lockProxyAddr: "0xe7bef341044f1b8d5ab1a25172e2678a1e75479a",
|
|
130
130
|
bridgeEntranceAddr: "0xccf798e633d6fb6505b494fc010903f9be3bc99b",
|
|
131
131
|
chainId: 111,
|
package/lib/modules/coin.d.ts
CHANGED
|
@@ -4,9 +4,6 @@ import BaseModule from "./base";
|
|
|
4
4
|
export declare class CoinModule extends BaseModule {
|
|
5
5
|
createWithdrawal(params: CoinModule.CreateWithdrawalParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
6
6
|
mintToken(params: CoinModule.MintTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
7
|
-
depositToGroup(params: CoinModule.DepositToGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
8
|
-
convertToGroup(params: CoinModule.DepositToGroupParams[], opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
9
|
-
withdrawFromGroup(params: CoinModule.WithdrawFromGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
10
7
|
}
|
|
11
8
|
export declare namespace CoinModule {
|
|
12
9
|
interface CreateWithdrawalParams {
|
|
@@ -22,12 +19,4 @@ export declare namespace CoinModule {
|
|
|
22
19
|
amount: BigNumber;
|
|
23
20
|
to?: string;
|
|
24
21
|
}
|
|
25
|
-
interface DepositToGroupParams {
|
|
26
|
-
creator?: string;
|
|
27
|
-
depositCoin: string;
|
|
28
|
-
}
|
|
29
|
-
interface WithdrawFromGroupParams {
|
|
30
|
-
creator?: string;
|
|
31
|
-
sourceCoin: string;
|
|
32
|
-
}
|
|
33
22
|
}
|
package/lib/modules/coin.js
CHANGED
|
@@ -50,53 +50,5 @@ class CoinModule extends base_1.default {
|
|
|
50
50
|
}, opts);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
/// call
|
|
54
|
-
depositToGroup(params, opts) {
|
|
55
|
-
var _a;
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
const wallet = this.getWallet();
|
|
58
|
-
const value = tx_1.MsgDepositToGroup.fromPartial({
|
|
59
|
-
creator: (_a = params.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
|
|
60
|
-
depositCoin: params.depositCoin
|
|
61
|
-
});
|
|
62
|
-
return yield wallet.sendTx({
|
|
63
|
-
typeUrl: util_1.CarbonTx.Types.MsgDepositToGroup,
|
|
64
|
-
value,
|
|
65
|
-
}, opts);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
convertToGroup(params, opts) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const wallet = this.getWallet();
|
|
71
|
-
const messages = [];
|
|
72
|
-
params.forEach((param) => {
|
|
73
|
-
var _a;
|
|
74
|
-
const value = tx_1.MsgDepositToGroup.fromPartial({
|
|
75
|
-
creator: (_a = param.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
|
|
76
|
-
depositCoin: param.depositCoin
|
|
77
|
-
});
|
|
78
|
-
const message = {
|
|
79
|
-
typeUrl: util_1.CarbonTx.Types.MsgDepositToGroup,
|
|
80
|
-
value
|
|
81
|
-
};
|
|
82
|
-
messages.push(message);
|
|
83
|
-
});
|
|
84
|
-
return yield wallet.sendTxs(messages, opts);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
withdrawFromGroup(params, opts) {
|
|
88
|
-
var _a;
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
const wallet = this.getWallet();
|
|
91
|
-
const value = tx_1.MsgWithdrawFromGroup.fromPartial({
|
|
92
|
-
creator: (_a = params.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
|
|
93
|
-
sourceCoin: params.sourceCoin
|
|
94
|
-
});
|
|
95
|
-
return yield wallet.sendTx({
|
|
96
|
-
typeUrl: util_1.CarbonTx.Types.MsgWithdrawFromGroup,
|
|
97
|
-
value,
|
|
98
|
-
}, opts);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
53
|
}
|
|
102
54
|
exports.CoinModule = CoinModule;
|
package/lib/util/blockchain.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Network } from "../constant/network";
|
|
2
1
|
import { SimpleMap } from "./type";
|
|
3
2
|
export declare enum Blockchain {
|
|
4
3
|
Neo = "neo",
|
|
@@ -55,4 +54,4 @@ export declare const chainIdsByBlockchain: SimpleMap<ChainIds>;
|
|
|
55
54
|
export declare function parseBlockchain(value: string | null): Blockchain | null;
|
|
56
55
|
export declare function getChainFromID(id: number): string | undefined;
|
|
57
56
|
export declare const getBlockchainFromChain: (chainId?: number | undefined) => Blockchain.Ethereum | Blockchain.BinanceSmartChain | Blockchain.Zilliqa | Blockchain.Arbitrum | undefined;
|
|
58
|
-
export declare const blockchainForChainId: (chainId?: number | undefined
|
|
57
|
+
export declare const blockchainForChainId: (chainId?: number | undefined) => Blockchain | undefined;
|
package/lib/util/blockchain.js
CHANGED
|
@@ -127,101 +127,68 @@ const getBlockchainFromChain = (chainId) => {
|
|
|
127
127
|
return undefined;
|
|
128
128
|
};
|
|
129
129
|
exports.getBlockchainFromChain = getBlockchainFromChain;
|
|
130
|
-
const blockchainForChainId = (chainId
|
|
131
|
-
switch (
|
|
132
|
-
case
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return Blockchain.Arbitrum;
|
|
193
|
-
default:
|
|
194
|
-
return undefined;
|
|
195
|
-
}
|
|
196
|
-
case network_1.Network.TestNet:
|
|
197
|
-
switch (chainId) {
|
|
198
|
-
case 1:
|
|
199
|
-
return Blockchain.Btc;
|
|
200
|
-
case 5:
|
|
201
|
-
return Blockchain.Carbon;
|
|
202
|
-
case 79:
|
|
203
|
-
return Blockchain.BinanceSmartChain;
|
|
204
|
-
case 88:
|
|
205
|
-
return Blockchain.Neo3;
|
|
206
|
-
case 111:
|
|
207
|
-
return Blockchain.Zilliqa;
|
|
208
|
-
case 2: /* FALLTHROUGH */
|
|
209
|
-
case 502:
|
|
210
|
-
return Blockchain.Ethereum;
|
|
211
|
-
default:
|
|
212
|
-
return undefined;
|
|
213
|
-
}
|
|
214
|
-
case network_1.Network.DevNet:
|
|
215
|
-
switch (chainId) {
|
|
216
|
-
case 350:
|
|
217
|
-
return Blockchain.Ethereum;
|
|
218
|
-
case 5:
|
|
219
|
-
return Blockchain.Neo;
|
|
220
|
-
case 79:
|
|
221
|
-
return Blockchain.BinanceSmartChain;
|
|
222
|
-
}
|
|
223
|
-
case network_1.Network.LocalHost:
|
|
224
|
-
return undefined;
|
|
130
|
+
const blockchainForChainId = (chainId) => {
|
|
131
|
+
switch (chainId) {
|
|
132
|
+
case 0:
|
|
133
|
+
return Blockchain.Native;
|
|
134
|
+
case 1:
|
|
135
|
+
return Blockchain.Btc;
|
|
136
|
+
case 2:
|
|
137
|
+
case 350: // devnet
|
|
138
|
+
return Blockchain.Ethereum;
|
|
139
|
+
case 4:
|
|
140
|
+
case 5: // devnet
|
|
141
|
+
return Blockchain.Neo;
|
|
142
|
+
case 6:
|
|
143
|
+
case 79: // devnet
|
|
144
|
+
return Blockchain.BinanceSmartChain;
|
|
145
|
+
case 9: // mainnet
|
|
146
|
+
case 10:
|
|
147
|
+
case 18:
|
|
148
|
+
case 110: // testnet
|
|
149
|
+
case 111:
|
|
150
|
+
return Blockchain.Zilliqa;
|
|
151
|
+
case 14: // mainnet
|
|
152
|
+
case 88: // testnet
|
|
153
|
+
return Blockchain.Neo3;
|
|
154
|
+
case 19: // mainnet
|
|
155
|
+
return Blockchain.Arbitrum;
|
|
156
|
+
case 244: // mainnet
|
|
157
|
+
return Blockchain.Osmosis;
|
|
158
|
+
case 245: // mainnet
|
|
159
|
+
return Blockchain.Terra;
|
|
160
|
+
case 246: // mainnet
|
|
161
|
+
return Blockchain.CosmosHub;
|
|
162
|
+
case 247: // mainnet
|
|
163
|
+
return Blockchain.Juno;
|
|
164
|
+
case 248: // mainnet
|
|
165
|
+
return Blockchain.Evmos;
|
|
166
|
+
case 249: // mainnet
|
|
167
|
+
return Blockchain.Axelar;
|
|
168
|
+
case 313: // mainnet
|
|
169
|
+
return Blockchain.Stride;
|
|
170
|
+
case 314: // mainnnet
|
|
171
|
+
return Blockchain.Kujira;
|
|
172
|
+
case 315: // mainnnet
|
|
173
|
+
return Blockchain.Terra2;
|
|
174
|
+
case 316: // mainnnet
|
|
175
|
+
return Blockchain.Quicksilver;
|
|
176
|
+
case 317: // mainnnet
|
|
177
|
+
return Blockchain.Comdex;
|
|
178
|
+
case 318: // mainnnet
|
|
179
|
+
return Blockchain.StafiHub;
|
|
180
|
+
case 319: // mainnnet
|
|
181
|
+
return Blockchain.Persistence;
|
|
182
|
+
case 320: // mainnnet
|
|
183
|
+
return Blockchain.Stargaze;
|
|
184
|
+
case 321: // mainnnet
|
|
185
|
+
return Blockchain.Canto;
|
|
186
|
+
case 322: // mainnnet
|
|
187
|
+
return Blockchain.OmniFlixHub;
|
|
188
|
+
case 323: // mainnnet
|
|
189
|
+
return Blockchain.Agoric;
|
|
190
|
+
case 42161: // mainnnet
|
|
191
|
+
return Blockchain.Arbitrum;
|
|
225
192
|
default:
|
|
226
193
|
return undefined;
|
|
227
194
|
}
|
package/lib/util/tx.d.ts
CHANGED
|
@@ -136,8 +136,6 @@ export declare const Types: {
|
|
|
136
136
|
MsgLiquidateCollateralWithStablecoinAndInterestInCdpTokensResponse: string;
|
|
137
137
|
MsgLiquidateCollateralWithStablecoinAndInterestInCollateral: string;
|
|
138
138
|
MsgLiquidateCollateralWithStablecoinAndInterestInCollateralResponse: string;
|
|
139
|
-
MsgConvertTokenInCdpToGroupTokens: string;
|
|
140
|
-
MsgConvertTokenInCdpToGroupTokensResponse: string;
|
|
141
139
|
MsgSyncGenesis: string;
|
|
142
140
|
MsgSyncGenesisResponse: string;
|
|
143
141
|
MsgSyncHeaders: string;
|
|
@@ -304,20 +302,6 @@ export declare const Types: {
|
|
|
304
302
|
MsgAddBridgeAddressResponse: string;
|
|
305
303
|
MsgRemoveBridgeAddress: string;
|
|
306
304
|
MsgRemoveBridgeAddressResponse: string;
|
|
307
|
-
MsgCreateGroup: string;
|
|
308
|
-
MsgCreateGroupResponse: string;
|
|
309
|
-
MsgUpdateGroup: string;
|
|
310
|
-
MsgUpdateGroupResponse: string;
|
|
311
|
-
MsgRegisterToGroup: string;
|
|
312
|
-
MsgRegisterToGroupResponse: string;
|
|
313
|
-
MsgDeregisterFromGroup: string;
|
|
314
|
-
MsgDeregisterFromGroupResponse: string;
|
|
315
|
-
MsgDepositToGroup: string;
|
|
316
|
-
MsgDepositToGroupResponse: string;
|
|
317
|
-
MsgWithdrawFromGroup: string;
|
|
318
|
-
MsgWithdrawFromGroupResponse: string;
|
|
319
|
-
MsgUpdateGroupedTokenConfig: string;
|
|
320
|
-
MsgUpdateGroupedTokenConfigResponse: string;
|
|
321
305
|
CreateTokenProposal: string;
|
|
322
306
|
MsgSetLeverage: string;
|
|
323
307
|
MsgSetLeverageResponse: string;
|
|
@@ -380,8 +364,6 @@ export declare const Types: {
|
|
|
380
364
|
MsgSetImpactBandResponse: string;
|
|
381
365
|
MsgSetStaleIndexAllowance: string;
|
|
382
366
|
MsgSetStaleIndexAllowanceResponse: string;
|
|
383
|
-
MsgUpdateTokenPriceOracle: string;
|
|
384
|
-
MsgUpdateTokenPriceOracleResponse: string;
|
|
385
367
|
SettlementPriceProposal: string;
|
|
386
368
|
MsgSetWrapperMapping: string;
|
|
387
369
|
MsgSetWrapperMappingResponse: string;
|