carbon-js-sdk 0.3.38-beta.2 → 0.3.39

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.
Files changed (78) hide show
  1. package/lib/clients/CarbonQueryClient.js +2 -2
  2. package/lib/clients/ETHClient.js +19 -20
  3. package/lib/clients/HydrogenClient.js +1 -1
  4. package/lib/clients/NEOClient.js +7 -7
  5. package/lib/clients/TokenClient.js +3 -6
  6. package/lib/clients/ZILClient.js +20 -21
  7. package/lib/codec/cdp/asset_params.d.ts +0 -1
  8. package/lib/codec/cdp/tx.d.ts +1 -23
  9. package/lib/codec/cdp/tx.js +1 -100
  10. package/lib/codec/coin/event.d.ts +0 -81
  11. package/lib/codec/coin/event.js +1 -486
  12. package/lib/codec/coin/genesis.d.ts +1 -3
  13. package/lib/codec/coin/genesis.js +2 -18
  14. package/lib/codec/coin/query.d.ts +0 -85
  15. package/lib/codec/coin/query.js +1 -422
  16. package/lib/codec/coin/tx.d.ts +2 -197
  17. package/lib/codec/coin/tx.js +17 -1050
  18. package/lib/codec/cosmos/gov/v1beta1/query.js +2 -2
  19. package/lib/codec/cosmos/gov/v1beta1/tx.js +2 -2
  20. package/lib/codec/cosmos/tx/v1beta1/tx.js +2 -2
  21. package/lib/codec/index.d.ts +5 -24
  22. package/lib/codec/index.js +11 -86
  23. package/lib/codec/pricing/pricing.d.ts +0 -1
  24. package/lib/codec/pricing/pricing.js +2 -14
  25. package/lib/codec/pricing/tx.d.ts +0 -23
  26. package/lib/codec/pricing/tx.js +1 -112
  27. package/lib/constant/generic.js +1 -1
  28. package/lib/constant/ibc.js +5 -0
  29. package/lib/constant/network.js +1 -1
  30. package/lib/modules/admin.d.ts +0 -32
  31. package/lib/modules/admin.js +0 -76
  32. package/lib/modules/cdp.js +43 -43
  33. package/lib/modules/coin.d.ts +0 -12
  34. package/lib/modules/coin.js +0 -44
  35. package/lib/modules/gov.js +14 -14
  36. package/lib/modules/liquiditypool.js +1 -1
  37. package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +1 -1
  38. package/lib/provider/account/NeoLedgerAccount/N3Ledger/ErrorCode.js +1 -1
  39. package/lib/provider/account/NeoLedgerAccount/N3Ledger/main.js +8 -8
  40. package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +3 -3
  41. package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -1
  42. package/lib/provider/amino/types/admin.js +30 -30
  43. package/lib/provider/amino/types/bank.js +1 -1
  44. package/lib/provider/amino/types/broker.js +1 -1
  45. package/lib/provider/amino/types/cdp.js +22 -22
  46. package/lib/provider/amino/types/coin.js +2 -14
  47. package/lib/provider/amino/types/gov.js +4 -75
  48. package/lib/provider/amino/types/ibc.js +1 -1
  49. package/lib/provider/amino/types/leverage.js +1 -1
  50. package/lib/provider/amino/types/liquidityPool.js +7 -7
  51. package/lib/provider/amino/types/market.js +1 -1
  52. package/lib/provider/amino/types/oracle.js +1 -1
  53. package/lib/provider/amino/types/order.js +4 -4
  54. package/lib/provider/amino/types/position.js +1 -1
  55. package/lib/provider/amino/types/profile.js +1 -1
  56. package/lib/provider/amino/types/staking.js +4 -4
  57. package/lib/provider/amino/types/subaccount.js +3 -3
  58. package/lib/provider/amino/utils.d.ts +1 -1
  59. package/lib/provider/amino/utils.js +11 -11
  60. package/lib/provider/ledger/ledger.js +2 -2
  61. package/lib/provider/metamask/MetaMask.d.ts +1 -1
  62. package/lib/provider/metamask/MetaMask.js +9 -9
  63. package/lib/provider/o3/O3Wallet.js +2 -2
  64. package/lib/util/address.js +13 -13
  65. package/lib/util/api.js +4 -4
  66. package/lib/util/blockchain.d.ts +1 -3
  67. package/lib/util/blockchain.js +62 -97
  68. package/lib/util/fetch.js +1 -1
  69. package/lib/util/generic.js +3 -3
  70. package/lib/util/gov.d.ts +1 -8
  71. package/lib/util/gov.js +0 -7
  72. package/lib/util/number.js +5 -5
  73. package/lib/util/tx.d.ts +0 -18
  74. package/lib/wallet/CarbonSigner.js +2 -2
  75. package/lib/wallet/CarbonSigningClient.js +8 -8
  76. package/lib/wallet/CarbonWallet.js +6 -6
  77. package/lib/websocket/connector.js +3 -3
  78. package/package.json +1 -1
@@ -44,23 +44,23 @@ const mapEachIndiv = (mapItem, valueKey, toAmino = false) => {
44
44
  if (typeof keyMap !== "object") {
45
45
  // Check if this is a Long/BigNumber/Buffer/Date/Duration obj or a non-object/array
46
46
  if (typeCheck(mapItem[key]) || typeof mapItem[key] !== "object") {
47
- directMap[altKey] = (0, exports.paramConverter)(mapItem[key], keyMap, toAmino);
47
+ directMap[altKey] = exports.paramConverter(mapItem[key], keyMap, toAmino);
48
48
  return;
49
49
  }
50
50
  }
51
51
  if (mapItem[key].length && typeof mapItem[key] === "object") {
52
52
  // If value is an array of objects, iterate through objects and call mapToObj function
53
53
  directMap[altKey] = mapItem[key].map((newMap) => {
54
- return (0, exports.mapEachIndiv)(newMap, valueKey, toAmino);
54
+ return exports.mapEachIndiv(newMap, valueKey, toAmino);
55
55
  });
56
56
  return;
57
57
  }
58
58
  else {
59
59
  if (util_1.TypeUtils.isDurationType(mapItem[key])) {
60
- directMap[altKey] = (0, exports.paramConverter)(mapItem[key], keyMap, toAmino);
60
+ directMap[altKey] = exports.paramConverter(mapItem[key], keyMap, toAmino);
61
61
  return;
62
62
  }
63
- directMap[altKey] = (0, exports.mapEachIndiv)(mapItem[key], keyMap, toAmino);
63
+ directMap[altKey] = exports.mapEachIndiv(mapItem[key], keyMap, toAmino);
64
64
  }
65
65
  });
66
66
  return directMap;
@@ -137,18 +137,18 @@ const generateAminoType = (amino, aminoProcess = {}) => {
137
137
  if (!newInput[key])
138
138
  return;
139
139
  if (typeCheck(newInput[key])) {
140
- aminoObj[snakeKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[key], true);
140
+ aminoObj[snakeKey] = exports.paramConverter(newInput[key], newAminoMap[key], true);
141
141
  return;
142
142
  }
143
143
  if (typeof newInput[key] !== "object" && typeof newAminoMap[key] !== "object") {
144
- aminoObj[snakeKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[key], true);
144
+ aminoObj[snakeKey] = exports.paramConverter(newInput[key], newAminoMap[key], true);
145
145
  }
146
146
  else {
147
147
  if (((_a = newInput[key]) === null || _a === void 0 ? void 0 : _a.length) && typeof newInput[key] === "object") {
148
- aminoObj[snakeKey] = newInput[key].map((newItem) => (0, exports.mapEachIndiv)(newItem, newAminoMap[key], true));
148
+ aminoObj[snakeKey] = newInput[key].map((newItem) => exports.mapEachIndiv(newItem, newAminoMap[key], true));
149
149
  return;
150
150
  }
151
- aminoObj[snakeKey] = (0, exports.mapEachIndiv)(newInput[key], newAminoMap[key], true);
151
+ aminoObj[snakeKey] = exports.mapEachIndiv(newInput[key], newAminoMap[key], true);
152
152
  }
153
153
  });
154
154
  return aminoObj;
@@ -162,14 +162,14 @@ const generateAminoType = (amino, aminoProcess = {}) => {
162
162
  var _a;
163
163
  const camelKey = util_1.TypeUtils.snakeToCamel(key);
164
164
  if (typeof newInput[key] !== "object" && typeof newAminoMap[key] !== "object") {
165
- aminoObj[camelKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[camelKey], false);
165
+ aminoObj[camelKey] = exports.paramConverter(newInput[key], newAminoMap[camelKey], false);
166
166
  }
167
167
  else {
168
168
  if (((_a = newInput[key]) === null || _a === void 0 ? void 0 : _a.length) && typeof newInput[key] === "object") {
169
- aminoObj[camelKey] = newInput[key].map((newItem) => (0, exports.mapEachIndiv)(newItem, newAminoMap[camelKey], false));
169
+ aminoObj[camelKey] = newInput[key].map((newItem) => exports.mapEachIndiv(newItem, newAminoMap[camelKey], false));
170
170
  return;
171
171
  }
172
- aminoObj[camelKey] = (0, exports.mapEachIndiv)(newInput[key], newAminoMap[camelKey], false);
172
+ aminoObj[camelKey] = exports.mapEachIndiv(newInput[key], newAminoMap[camelKey], false);
173
173
  }
174
174
  });
175
175
  return aminoObj;
@@ -147,7 +147,7 @@ class CosmosLedger {
147
147
  const response = yield this.cosmosApp.getVersion();
148
148
  this.checkLedgerErrors(response);
149
149
  const { major, minor, patch, test_mode } = response;
150
- (0, exports.checkAppMode)(this.testModeAllowed, test_mode);
150
+ exports.checkAppMode(this.testModeAllowed, test_mode);
151
151
  const version = versionString({ major, minor, patch });
152
152
  return version;
153
153
  });
@@ -238,7 +238,7 @@ class CosmosLedger {
238
238
  const response = yield this.cosmosApp.sign(this.hdPath, signMessage);
239
239
  this.checkLedgerErrors(response);
240
240
  // we have to parse the signature from Ledger as it's in DER format
241
- const parsedSignature = (0, secp256k1_1.signatureImport)(response.signature);
241
+ const parsedSignature = secp256k1_1.signatureImport(response.signature);
242
242
  return parsedSignature;
243
243
  });
244
244
  }
@@ -38,7 +38,7 @@ export declare class MetaMask {
38
38
  readonly network: Network;
39
39
  private blockchain;
40
40
  static getNetworkParams(network: Network, blockchain?: EVMChain): MetaMaskChangeNetworkParam;
41
- static getRequiredChainId(network: Network, blockchain?: Blockchain): 1 | 5 | 56 | 97 | 42161 | 421611;
41
+ static getRequiredChainId(network: Network, blockchain?: Blockchain): 1 | 4 | 56 | 97 | 42161 | 421611;
42
42
  constructor(network: Network);
43
43
  private checkProvider;
44
44
  getBlockchain(): Blockchain;
@@ -37,9 +37,9 @@ const ethSignUtils = __importStar(require("eth-sig-util"));
37
37
  const CONTRACT_HASH = {
38
38
  [blockchain_1.Blockchain.Ethereum]: {
39
39
  // use same rinkeby contract for all non-mainnet uses
40
- [constant_1.Network.TestNet]: "0x086e1b5f67c0f7ca8eb202d35553e27e964899e2",
41
- [constant_1.Network.DevNet]: "0x086e1b5f67c0f7ca8eb202d35553e27e964899e2",
42
- [constant_1.Network.LocalHost]: "0x086e1b5f67c0f7ca8eb202d35553e27e964899e2",
40
+ [constant_1.Network.TestNet]: "0xec8BC20687FfA944F57EB1aAa6F98FEDA30bcA65",
41
+ [constant_1.Network.DevNet]: "0xec8BC20687FfA944F57EB1aAa6F98FEDA30bcA65",
42
+ [constant_1.Network.LocalHost]: "0xec8BC20687FfA944F57EB1aAa6F98FEDA30bcA65",
43
43
  [constant_1.Network.MainNet]: "0xf4552877A40c1527D38970F170993660084D4541",
44
44
  },
45
45
  [blockchain_1.Blockchain.BinanceSmartChain]: {
@@ -118,8 +118,8 @@ const ETH_MAINNET = {
118
118
  rpcUrls: ["https://mainnet.infura.io/v3/"],
119
119
  };
120
120
  const ETH_TESTNET = {
121
- chainId: "0x5",
122
- rpcUrls: ["https://goerli.infura.io/v3/"],
121
+ chainId: "0x4",
122
+ rpcUrls: ["https://rinkeby.infura.io/v3/"],
123
123
  };
124
124
  const ARBITRUM_MAINNET = {
125
125
  chainId: "0xA4B1",
@@ -190,7 +190,7 @@ class MetaMask {
190
190
  case blockchain_1.Blockchain.Arbitrum:
191
191
  return 421611;
192
192
  default:
193
- return 5;
193
+ return 4;
194
194
  }
195
195
  }
196
196
  checkProvider(blockchain = this.blockchain) {
@@ -210,7 +210,7 @@ class MetaMask {
210
210
  return __awaiter(this, void 0, void 0, function* () {
211
211
  const chainIdHex = (yield ((_a = this.getAPI()) === null || _a === void 0 ? void 0 : _a.request({ method: "eth_chainId" })));
212
212
  const chainId = !!chainIdHex ? parseInt(chainIdHex, 16) : undefined;
213
- const blockchain = (0, blockchain_1.getBlockchainFromChain)(chainId);
213
+ const blockchain = blockchain_1.getBlockchainFromChain(chainId);
214
214
  this.blockchain = blockchain;
215
215
  return { chainId, blockchain };
216
216
  });
@@ -365,7 +365,7 @@ class MetaMask {
365
365
  }
366
366
  return 1;
367
367
  }
368
- if (currentChainId === 5) {
368
+ if (currentChainId === 4) {
369
369
  this.blockchain = blockchain_1.Blockchain.Ethereum;
370
370
  return currentChainId;
371
371
  }
@@ -381,7 +381,7 @@ class MetaMask {
381
381
  if (currentChainId === 56) {
382
382
  return 97;
383
383
  }
384
- return 5;
384
+ return 4;
385
385
  }
386
386
  getContractHash(blockchain = this.blockchain) {
387
387
  const contractHash = CONTRACT_HASH[blockchain][this.network];
@@ -60,9 +60,9 @@ class O3Wallet {
60
60
  return {
61
61
  type: index_1.CarbonSignerTypes.BrowserInjected,
62
62
  signAmino: (_, doc) => __awaiter(this, void 0, void 0, function* () {
63
- const msg = JSON.stringify((0, generic_1.sortObject)(doc));
63
+ const msg = JSON.stringify(generic_1.sortObject(doc));
64
64
  const signBytes = yield dapi.signMessage(msg);
65
- const signature = (0, amino_1.encodeSecp256k1Signature)(pubKey, signBytes);
65
+ const signature = amino_1.encodeSecp256k1Signature(pubKey, signBytes);
66
66
  return {
67
67
  signed: doc,
68
68
  signature,
@@ -94,13 +94,13 @@ const randomMnemonic = () => {
94
94
  };
95
95
  exports.randomMnemonic = randomMnemonic;
96
96
  const wifEncodePrivateKey = (privateKey, iter = 128) => {
97
- const privateKeyBuf = (0, exports.stringOrBufferToBuffer)(privateKey);
97
+ const privateKeyBuf = exports.stringOrBufferToBuffer(privateKey);
98
98
  return wif.encode(iter, privateKeyBuf, true);
99
99
  };
100
100
  exports.wifEncodePrivateKey = wifEncodePrivateKey;
101
101
  exports.SWTHAddress = {
102
102
  newMnemonic: () => {
103
- return (0, exports.randomMnemonic)();
103
+ return exports.randomMnemonic();
104
104
  },
105
105
  coinType: () => {
106
106
  return SWTH_COIN_TYPE;
@@ -110,10 +110,10 @@ exports.SWTHAddress = {
110
110
  return new BIP44Path(BIP44_PURPOSE, coinType).update(index, change, account).toArray();
111
111
  },
112
112
  publicKeyToScriptHash: (publicKey) => {
113
- const pubKeyBuffer = (0, exports.stringOrBufferToBuffer)(publicKey);
113
+ const pubKeyBuffer = exports.stringOrBufferToBuffer(publicKey);
114
114
  const sha256Hash = ethers_1.ethers.utils.sha256(pubKeyBuffer);
115
115
  const ripemdHash = ethers_1.ethers.utils.ripemd160(sha256Hash);
116
- return (0, generic_1.stripHexPrefix)(ripemdHash);
116
+ return generic_1.stripHexPrefix(ripemdHash);
117
117
  },
118
118
  publicKeyToAddress: (publicKey, opts) => {
119
119
  const scriptHash = exports.SWTHAddress.publicKeyToScriptHash(publicKey);
@@ -135,7 +135,7 @@ exports.SWTHAddress = {
135
135
  return privateKey;
136
136
  },
137
137
  privateToPublicKey: (privateKey) => {
138
- const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
138
+ const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
139
139
  const publicKeyUint8Array = secp256k1.publicKeyCreate(privateKeyBuff, true);
140
140
  const publicKey = Buffer.from(publicKeyUint8Array);
141
141
  return publicKey;
@@ -146,7 +146,7 @@ exports.SWTHAddress = {
146
146
  return address;
147
147
  },
148
148
  encode: (hash, opts) => {
149
- const hashBuff = (0, exports.stringOrBufferToBuffer)(hash, "hex");
149
+ const hashBuff = exports.stringOrBufferToBuffer(hash, "hex");
150
150
  const words = bech32.toWords(hashBuff.slice(0, 20));
151
151
  const addressPrefix = exports.SWTHAddress.getBech32Prefix(opts === null || opts === void 0 ? void 0 : opts.network, opts === null || opts === void 0 ? void 0 : opts.bech32Prefix, opts === null || opts === void 0 ? void 0 : opts.type);
152
152
  const address = bech32.encode(addressPrefix, words);
@@ -205,7 +205,7 @@ exports.NEOAddress = {
205
205
  ]);
206
206
  const sha256Hash = ethers_1.ethers.utils.sha256(addressScript);
207
207
  const ripemdHash = ethers_1.ethers.utils.ripemd160(sha256Hash);
208
- return (0, generic_1.stripHexPrefix)(ripemdHash);
208
+ return generic_1.stripHexPrefix(ripemdHash);
209
209
  },
210
210
  publicKeyToAddress: (publicKey) => {
211
211
  const addressScript = exports.NEOAddress.publicKeyToScriptHash(publicKey);
@@ -213,7 +213,7 @@ exports.NEOAddress = {
213
213
  return address;
214
214
  },
215
215
  encodePublicKey: (unencodedPublicKey) => {
216
- const unencPubKeyBuf = (0, exports.stringOrBufferToBuffer)(unencodedPublicKey);
216
+ const unencPubKeyBuf = exports.stringOrBufferToBuffer(unencodedPublicKey);
217
217
  if (unencPubKeyBuf.length <= 33) {
218
218
  // length indicates already encoded
219
219
  return unencPubKeyBuf;
@@ -238,7 +238,7 @@ exports.NEOAddress = {
238
238
  return privateKey;
239
239
  },
240
240
  privateToPublicKey: (privateKey) => {
241
- const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
241
+ const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
242
242
  const publicKeyUint8Array = secp256r1.publicKeyCreate(privateKeyBuff, true);
243
243
  return Buffer.from(publicKeyUint8Array);
244
244
  },
@@ -256,7 +256,7 @@ exports.NEOAddress = {
256
256
  },
257
257
  };
258
258
  exports.N3Address = Object.assign(Object.assign({}, exports.NEOAddress), { publicKeyToScriptHash: (publicKey) => {
259
- const publicKeyHex = (0, exports.stringOrBufferToBuffer)(publicKey).toString("hex");
259
+ const publicKeyHex = exports.stringOrBufferToBuffer(publicKey).toString("hex");
260
260
  return neon_core_next_1.wallet.getScriptHashFromPublicKey(publicKeyHex);
261
261
  }, publicKeyToAddress: (publicKey) => {
262
262
  const addressScript = exports.N3Address.publicKeyToScriptHash(publicKey);
@@ -282,11 +282,11 @@ exports.ETHAddress = {
282
282
  return ethers_1.ethers.utils.keccak256(encodedPublicKey);
283
283
  },
284
284
  publicKeyToAddress: (publicKey) => {
285
- const publicKeyBuff = (0, exports.stringOrBufferToBuffer)(publicKey);
285
+ const publicKeyBuff = exports.stringOrBufferToBuffer(publicKey);
286
286
  return ethers_1.ethers.utils.computeAddress(publicKeyBuff);
287
287
  },
288
288
  encodePublicKey: (unencodedPublicKey) => {
289
- const unencodedPublicKeyBuff = (0, exports.stringOrBufferToBuffer)(unencodedPublicKey);
289
+ const unencodedPublicKeyBuff = exports.stringOrBufferToBuffer(unencodedPublicKey);
290
290
  const publicKey = ethers_1.ethers.utils.computePublicKey(unencodedPublicKeyBuff, true);
291
291
  return Buffer.from(publicKey, "hex");
292
292
  },
@@ -298,7 +298,7 @@ exports.ETHAddress = {
298
298
  return Buffer.from((_a = wallet.privateKey) === null || _a === void 0 ? void 0 : _a.replace(/^0x/, ""), "hex");
299
299
  },
300
300
  privateToPublicKey: (privateKey) => {
301
- const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
301
+ const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
302
302
  return Buffer.from(ethers_1.ethers.utils.computePublicKey(privateKeyBuff).replace(/^0x/, ""), "hex");
303
303
  },
304
304
  privateKeyToAddress: (privateKey) => {
package/lib/util/api.js CHANGED
@@ -84,7 +84,7 @@ class HTTP {
84
84
  * Executes HTTP GET request with fetch
85
85
  */
86
86
  this.get = ({ url, headers }) => {
87
- return (0, fetch_1.fetch)(url, {
87
+ return fetch_1.fetch(url, {
88
88
  method: "GET",
89
89
  headers,
90
90
  });
@@ -93,7 +93,7 @@ class HTTP {
93
93
  * Executes HTTP POST request with fetch
94
94
  */
95
95
  this.post = (options) => {
96
- return (0, fetch_1.fetch)(options.url, {
96
+ return fetch_1.fetch(options.url, {
97
97
  method: "POST",
98
98
  headers: Object.assign({ "Content-Type": options.content_type || "application/json" }, options.headers),
99
99
  body: JSON.stringify(options.body),
@@ -103,7 +103,7 @@ class HTTP {
103
103
  * Executes HTTP DELETE request with fetch
104
104
  */
105
105
  this.del = (options) => {
106
- return (0, fetch_1.fetch)(options.url, {
106
+ return fetch_1.fetch(options.url, {
107
107
  method: "DELETE",
108
108
  headers: Object.assign({ "Content-Type": options.content_type || "application/json" }, options.headers),
109
109
  body: JSON.stringify(options.body),
@@ -114,7 +114,7 @@ class HTTP {
114
114
  */
115
115
  this.raw = (options) => {
116
116
  const { url } = options, otherOpts = __rest(options, ["url"]);
117
- return (0, fetch_1.fetch)(url, otherOpts);
117
+ return fetch_1.fetch(url, otherOpts);
118
118
  };
119
119
  this.apiPrefix = apiPrefix;
120
120
  this.apiEndpoints = apiEndpoints;
@@ -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",
@@ -41,7 +40,6 @@ export declare const ChainNames: {
41
40
  readonly 1: "MainNet";
42
41
  readonly 3: "Ropsten";
43
42
  readonly 4: "Rinkeby";
44
- readonly 5: "Goerli";
45
43
  readonly 56: "BSC MainNet";
46
44
  readonly 97: "BSC TestNet";
47
45
  readonly 110: "ZIL DevNet";
@@ -56,4 +54,4 @@ export declare const chainIdsByBlockchain: SimpleMap<ChainIds>;
56
54
  export declare function parseBlockchain(value: string | null): Blockchain | null;
57
55
  export declare function getChainFromID(id: number): string | undefined;
58
56
  export declare const getBlockchainFromChain: (chainId?: number | undefined) => Blockchain.Ethereum | Blockchain.BinanceSmartChain | Blockchain.Zilliqa | Blockchain.Arbitrum | undefined;
59
- export declare const blockchainForChainId: (chainId?: number | undefined, network?: Network) => Blockchain | undefined;
57
+ export declare const blockchainForChainId: (chainId?: number | undefined) => Blockchain | undefined;
@@ -43,7 +43,6 @@ exports.ChainNames = {
43
43
  1: "MainNet",
44
44
  3: "Ropsten",
45
45
  4: "Rinkeby",
46
- 5: "Goerli",
47
46
  56: "BSC MainNet",
48
47
  97: "BSC TestNet",
49
48
  110: "ZIL DevNet",
@@ -114,7 +113,6 @@ const getBlockchainFromChain = (chainId) => {
114
113
  case 1:
115
114
  case 3:
116
115
  case 4:
117
- case 5:
118
116
  return Blockchain.Ethereum;
119
117
  case 56:
120
118
  case 97:
@@ -129,101 +127,68 @@ const getBlockchainFromChain = (chainId) => {
129
127
  return undefined;
130
128
  };
131
129
  exports.getBlockchainFromChain = getBlockchainFromChain;
132
- const blockchainForChainId = (chainId, network = network_1.Network.MainNet) => {
133
- switch (network) {
134
- case network_1.Network.MainNet:
135
- switch (chainId) {
136
- case 0:
137
- return Blockchain.Native;
138
- case 1:
139
- return Blockchain.Btc;
140
- case 2:
141
- return Blockchain.Ethereum;
142
- case 4:
143
- return Blockchain.Neo;
144
- case 6:
145
- return Blockchain.BinanceSmartChain;
146
- case 14:
147
- return Blockchain.Neo3;
148
- case 9: /* FALLTHROUGH */
149
- case 18:
150
- return Blockchain.Zilliqa;
151
- case 244:
152
- return Blockchain.Osmosis;
153
- case 13: /* FALLTHROUGH */
154
- case 245:
155
- return Blockchain.Terra;
156
- case 246:
157
- return Blockchain.CosmosHub;
158
- case 5: /* FALLTHROUGH */
159
- case 247:
160
- return Blockchain.Juno;
161
- case 7: /* FALLTHROUGH */
162
- case 248:
163
- return Blockchain.Evmos;
164
- case 8: /* FALLTHROUGH */
165
- case 249:
166
- return Blockchain.Axelar;
167
- case 313:
168
- return Blockchain.Stride;
169
- case 314:
170
- return Blockchain.Kujira;
171
- case 315:
172
- return Blockchain.Terra2;
173
- case 316:
174
- return Blockchain.Quicksilver;
175
- case 12: /* FALLTHROUGH */
176
- case 317:
177
- return Blockchain.Comdex;
178
- case 318:
179
- return Blockchain.StafiHub;
180
- case 15: /* FALLTHROUGH */
181
- case 319:
182
- return Blockchain.Persistence;
183
- case 16: /* FALLTHROUGH */
184
- case 320:
185
- return Blockchain.Stargaze;
186
- case 321:
187
- return Blockchain.Canto;
188
- case 322:
189
- return Blockchain.OmniFlixHub;
190
- case 323:
191
- return Blockchain.Agoric;
192
- case 19: /* FALLTHROUGH */
193
- case 42161:
194
- return Blockchain.Arbitrum;
195
- default:
196
- return undefined;
197
- }
198
- case network_1.Network.TestNet:
199
- switch (chainId) {
200
- case 1:
201
- return Blockchain.Btc;
202
- case 5:
203
- return Blockchain.Carbon;
204
- case 79:
205
- return Blockchain.BinanceSmartChain;
206
- case 88:
207
- return Blockchain.Neo3;
208
- case 111:
209
- return Blockchain.Zilliqa;
210
- case 2: /* FALLTHROUGH */
211
- case 502:
212
- return Blockchain.Ethereum;
213
- default:
214
- return undefined;
215
- }
216
- case network_1.Network.DevNet:
217
- switch (chainId) {
218
- case 350:
219
- return Blockchain.Ethereum;
220
- case 5:
221
- return Blockchain.Neo;
222
- case 79:
223
- return Blockchain.BinanceSmartChain;
224
- }
225
- case network_1.Network.LocalHost:
226
- 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;
227
192
  default:
228
193
  return undefined;
229
194
  }
package/lib/util/fetch.js CHANGED
@@ -10,7 +10,7 @@ function fetch(url, init) {
10
10
  return window.fetch(url, Object.assign({}, init));
11
11
  }
12
12
  else {
13
- return (0, node_fetch_1.default)(url, init);
13
+ return node_fetch_1.default(url, init);
14
14
  }
15
15
  }
16
16
  exports.fetch = fetch;
@@ -22,7 +22,7 @@ const overrideConfig = (defaults, override) => {
22
22
  continue;
23
23
  if (typeof member === "object") {
24
24
  // @ts-ignore
25
- result[key] = (0, exports.overrideConfig)(result[key], member);
25
+ result[key] = exports.overrideConfig(result[key], member);
26
26
  }
27
27
  else {
28
28
  // @ts-ignore
@@ -41,7 +41,7 @@ const sortObject = (input) => {
41
41
  Object.keys(input)
42
42
  .sort()
43
43
  // @ts-ignore noImplicitAny
44
- .forEach((key) => (output[key] = (0, exports.sortObject)(input[key])));
44
+ .forEach((key) => (output[key] = exports.sortObject(input[key])));
45
45
  return output;
46
46
  };
47
47
  exports.sortObject = sortObject;
@@ -56,7 +56,7 @@ exports.appendHexPrefix = appendHexPrefix;
56
56
  const computeTxHash = (bytes) => {
57
57
  if (!bytes)
58
58
  return bytes;
59
- return (0, exports.toTxHash)((0, crypto_1.sha256)(bytes));
59
+ return exports.toTxHash(crypto_1.sha256(bytes));
60
60
  };
61
61
  exports.computeTxHash = computeTxHash;
62
62
  const toTxHash = (bytes) => {
package/lib/util/gov.d.ts CHANGED
@@ -18,14 +18,7 @@ export declare enum ProposalTypes {
18
18
  SetRewardsWeights = "/Switcheo.carbon.liquiditypool.SetRewardsWeightsProposal",
19
19
  SetCommitmentCurve = "/Switcheo.carbon.liquiditypool.SetCommitmentCurveProposal",
20
20
  UpdateMarket = "/Switcheo.carbon.market.UpdateMarketProposal",
21
- SettlementPrice = "/Switcheo.carbon.pricing.SettlementPriceProposal",
22
- CreateGroup = "/Switcheo.carbon.coin.CreateGroupProposal",
23
- UpdateGroup = "/Switcheo.carbon.coin.UpdateGroupProposal",
24
- RegisterToGroup = "/Switcheo.carbon.coin.RegisterToGroupProposal",
25
- DeregisterFromGroup = "/Switcheo.carbon.coin.DeregisterFromGroupProposal",
26
- DepositToGroup = "/Switcheo.carbon.coin.DepositToGroupProposal",
27
- WithdrawFromGroup = "/Switcheo.carbon.coin.WithdrawFromGroupProposal",
28
- UpdateGroupTokenConfig = "/Switcheo.carbon.coin.UpdateGroupTokenConfigProposal"
21
+ SettlementPrice = "/Switcheo.carbon.pricing.SettlementPriceProposal"
29
22
  }
30
23
  export interface PropDecoded {
31
24
  typeUrl: string;
package/lib/util/gov.js CHANGED
@@ -27,13 +27,6 @@ var ProposalTypes;
27
27
  ProposalTypes["SetCommitmentCurve"] = "/Switcheo.carbon.liquiditypool.SetCommitmentCurveProposal";
28
28
  ProposalTypes["UpdateMarket"] = "/Switcheo.carbon.market.UpdateMarketProposal";
29
29
  ProposalTypes["SettlementPrice"] = "/Switcheo.carbon.pricing.SettlementPriceProposal";
30
- ProposalTypes["CreateGroup"] = "/Switcheo.carbon.coin.CreateGroupProposal";
31
- ProposalTypes["UpdateGroup"] = "/Switcheo.carbon.coin.UpdateGroupProposal";
32
- ProposalTypes["RegisterToGroup"] = "/Switcheo.carbon.coin.RegisterToGroupProposal";
33
- ProposalTypes["DeregisterFromGroup"] = "/Switcheo.carbon.coin.DeregisterFromGroupProposal";
34
- ProposalTypes["DepositToGroup"] = "/Switcheo.carbon.coin.DepositToGroupProposal";
35
- ProposalTypes["WithdrawFromGroup"] = "/Switcheo.carbon.coin.WithdrawFromGroupProposal";
36
- ProposalTypes["UpdateGroupTokenConfig"] = "/Switcheo.carbon.coin.UpdateGroupTokenConfigProposal";
37
30
  })(ProposalTypes = exports.ProposalTypes || (exports.ProposalTypes = {}));
38
31
  exports.emptyProposal = {
39
32
  typeUrl: "",
@@ -18,26 +18,26 @@ const parseBN = (input, defaultValue) => {
18
18
  };
19
19
  exports.parseBN = parseBN;
20
20
  const bnOrZero = (input, defaultValue = exports.BN_ZERO) => {
21
- return (0, exports.parseBN)(input, defaultValue);
21
+ return exports.parseBN(input, defaultValue);
22
22
  };
23
23
  exports.bnOrZero = bnOrZero;
24
24
  const toHuman = (value, decimals) => {
25
25
  if (value === undefined || value === null)
26
26
  return undefined;
27
- const valueBN = (0, exports.bnOrZero)(value);
27
+ const valueBN = exports.bnOrZero(value);
28
28
  if (!decimals)
29
29
  return valueBN; // decimals = 0 or nullish
30
- const decimalsBN = (0, exports.bnOrZero)(decimals);
30
+ const decimalsBN = exports.bnOrZero(decimals);
31
31
  return valueBN.shiftedBy(decimalsBN.negated().toNumber());
32
32
  };
33
33
  exports.toHuman = toHuman;
34
34
  const toUnitless = (value, decimals) => {
35
35
  if (value === undefined || value === null)
36
36
  return undefined;
37
- const valueBN = (0, exports.bnOrZero)(value);
37
+ const valueBN = exports.bnOrZero(value);
38
38
  if (!decimals)
39
39
  return valueBN; // decimals = 0 or nullish
40
- const decimalsBN = (0, exports.bnOrZero)(decimals);
40
+ const decimalsBN = exports.bnOrZero(decimals);
41
41
  return valueBN.shiftedBy(decimalsBN.toNumber());
42
42
  };
43
43
  exports.toUnitless = toUnitless;
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;