carbon-js-sdk 0.3.40 → 0.3.42

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 (38) hide show
  1. package/lib/clients/ETHClient.js +5 -4
  2. package/lib/clients/TokenClient.js +6 -3
  3. package/lib/clients/ZILClient.js +4 -3
  4. package/lib/codec/cdp/asset_params.d.ts +1 -0
  5. package/lib/codec/cdp/query.d.ts +3 -0
  6. package/lib/codec/cdp/query.js +44 -3
  7. package/lib/codec/cdp/tx.d.ts +23 -1
  8. package/lib/codec/cdp/tx.js +100 -1
  9. package/lib/codec/coin/event.d.ts +81 -0
  10. package/lib/codec/coin/event.js +486 -1
  11. package/lib/codec/coin/genesis.d.ts +3 -1
  12. package/lib/codec/coin/genesis.js +18 -2
  13. package/lib/codec/coin/query.d.ts +85 -0
  14. package/lib/codec/coin/query.js +422 -1
  15. package/lib/codec/coin/tx.d.ts +197 -2
  16. package/lib/codec/coin/tx.js +1137 -104
  17. package/lib/codec/index.d.ts +24 -5
  18. package/lib/codec/index.js +86 -11
  19. package/lib/codec/pricing/pricing.d.ts +1 -0
  20. package/lib/codec/pricing/pricing.js +14 -2
  21. package/lib/codec/pricing/tx.d.ts +23 -0
  22. package/lib/codec/pricing/tx.js +112 -1
  23. package/lib/constant/network.js +1 -1
  24. package/lib/modules/admin.d.ts +32 -0
  25. package/lib/modules/admin.js +76 -0
  26. package/lib/modules/coin.d.ts +12 -0
  27. package/lib/modules/coin.js +44 -0
  28. package/lib/provider/amino/types/coin.js +12 -0
  29. package/lib/provider/amino/types/gov.js +71 -0
  30. package/lib/provider/amino/utils.d.ts +1 -1
  31. package/lib/provider/metamask/MetaMask.d.ts +1 -1
  32. package/lib/provider/metamask/MetaMask.js +8 -8
  33. package/lib/util/blockchain.d.ts +3 -1
  34. package/lib/util/blockchain.js +97 -62
  35. package/lib/util/gov.d.ts +8 -1
  36. package/lib/util/gov.js +7 -0
  37. package/lib/util/tx.d.ts +18 -0
  38. package/package.json +1 -1
@@ -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: "https://dev-api.zilliqa.com",
129
129
  lockProxyAddr: "0xe7bef341044f1b8d5ab1a25172e2678a1e75479a",
130
130
  bridgeEntranceAddr: "0xccf798e633d6fb6505b494fc010903f9be3bc99b",
131
131
  chainId: 111,
@@ -43,6 +43,11 @@ export declare class AdminModule extends BaseModule {
43
43
  setCompleteLiquidationThreshold(params: AdminModule.SetCompleteLiquidationThresholdParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
44
44
  setMinimumCloseFactor(params: AdminModule.SetMinimumCloseFactorParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
45
45
  setSmallLiquidationSize(params: AdminModule.SetSmallLiquidationSizeParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
46
+ createNewGroup(params: AdminModule.CreateNewGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
47
+ updateGroup(params: AdminModule.UpdateGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
48
+ registerToGroup(params: AdminModule.RegisterDeregisterToGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
49
+ deregisterFromGroup(params: AdminModule.RegisterDeregisterToGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
50
+ updateGroupConfig(params: AdminModule.UpdateGroupConfigParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
46
51
  }
47
52
  export declare namespace AdminModule {
48
53
  interface AuthorizeBridgeParams {
@@ -268,6 +273,33 @@ export declare namespace AdminModule {
268
273
  amount: BigNumber;
269
274
  denom: string;
270
275
  }
276
+ interface CreateNewGroupParams {
277
+ creator?: string;
278
+ name: string;
279
+ chequeTokenSymbol: string;
280
+ oracleId: string;
281
+ }
282
+ interface UpdateGroupParams {
283
+ creator?: string;
284
+ groupId?: string;
285
+ updateGroupParams?: GroupName;
286
+ }
287
+ interface GroupName {
288
+ name: string;
289
+ }
290
+ interface RegisterDeregisterToGroupParams {
291
+ creator?: string;
292
+ groupId: string;
293
+ denom: string;
294
+ }
295
+ interface UpdateGroupConfigParams {
296
+ creator?: string;
297
+ denom: string;
298
+ updateGroupedTokenConfigParams: IsGroupActive;
299
+ }
300
+ interface IsGroupActive {
301
+ isActive: boolean;
302
+ }
271
303
  }
272
304
  export declare function transfromCreateOracleParams(msg: AdminModule.CreateOracleParams, address: string): {
273
305
  creator: string;
@@ -563,6 +563,82 @@ class AdminModule extends base_1.default {
563
563
  }, opts);
564
564
  });
565
565
  }
566
+ createNewGroup(params, opts) {
567
+ var _a;
568
+ return __awaiter(this, void 0, void 0, function* () {
569
+ const wallet = this.getWallet();
570
+ const value = tx_1.MsgCreateGroup.fromPartial({
571
+ creator: (_a = params.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
572
+ name: params.name,
573
+ chequeTokenSymbol: params.chequeTokenSymbol,
574
+ oracleId: params.oracleId,
575
+ });
576
+ return yield wallet.sendTx({
577
+ typeUrl: util_1.CarbonTx.Types.MsgCreateGroup,
578
+ value,
579
+ }, opts);
580
+ });
581
+ }
582
+ updateGroup(params, opts) {
583
+ var _a;
584
+ return __awaiter(this, void 0, void 0, function* () {
585
+ const wallet = this.getWallet();
586
+ const value = tx_1.MsgUpdateGroup.fromPartial({
587
+ creator: (_a = params.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
588
+ groupId: params.groupId,
589
+ updateGroupParams: params.updateGroupParams
590
+ });
591
+ return yield wallet.sendTx({
592
+ typeUrl: util_1.CarbonTx.Types.MsgUpdateGroup,
593
+ value,
594
+ }, opts);
595
+ });
596
+ }
597
+ registerToGroup(params, opts) {
598
+ var _a;
599
+ return __awaiter(this, void 0, void 0, function* () {
600
+ const wallet = this.getWallet();
601
+ const value = tx_1.MsgRegisterToGroup.fromPartial({
602
+ creator: (_a = params.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
603
+ groupId: params.groupId,
604
+ denom: params.denom,
605
+ });
606
+ return yield wallet.sendTx({
607
+ typeUrl: util_1.CarbonTx.Types.MsgRegisterToGroup,
608
+ value,
609
+ }, opts);
610
+ });
611
+ }
612
+ deregisterFromGroup(params, opts) {
613
+ var _a;
614
+ return __awaiter(this, void 0, void 0, function* () {
615
+ const wallet = this.getWallet();
616
+ const value = tx_1.MsgDeregisterFromGroup.fromPartial({
617
+ creator: (_a = params.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
618
+ groupId: params.groupId,
619
+ denom: params.denom,
620
+ });
621
+ return yield wallet.sendTx({
622
+ typeUrl: util_1.CarbonTx.Types.MsgDeregisterFromGroup,
623
+ value,
624
+ }, opts);
625
+ });
626
+ }
627
+ updateGroupConfig(params, opts) {
628
+ var _a;
629
+ return __awaiter(this, void 0, void 0, function* () {
630
+ const wallet = this.getWallet();
631
+ const value = tx_1.MsgUpdateGroupedTokenConfig.fromPartial({
632
+ creator: (_a = params.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
633
+ denom: params.denom,
634
+ updateGroupedTokenConfigParams: params.updateGroupedTokenConfigParams,
635
+ });
636
+ return yield wallet.sendTx({
637
+ typeUrl: util_1.CarbonTx.Types.MsgUpdateGroupedTokenConfig,
638
+ value,
639
+ }, opts);
640
+ });
641
+ }
566
642
  }
567
643
  exports.AdminModule = AdminModule;
568
644
  function transfromCreateOracleParams(msg, address) {
@@ -1,9 +1,13 @@
1
+ import { Coin } from "../codec/cosmos/base/v1beta1/coin";
1
2
  import { CarbonTx } from "../util";
2
3
  import BigNumber from "bignumber.js";
3
4
  import BaseModule from "./base";
4
5
  export declare class CoinModule extends BaseModule {
5
6
  createWithdrawal(params: CoinModule.CreateWithdrawalParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
6
7
  mintToken(params: CoinModule.MintTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
8
+ depositToGroup(params: CoinModule.DepositToGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
9
+ convertToGroup(params: CoinModule.DepositToGroupParams[], opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
10
+ withdrawFromGroup(params: CoinModule.WithdrawFromGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
7
11
  }
8
12
  export declare namespace CoinModule {
9
13
  interface CreateWithdrawalParams {
@@ -19,4 +23,12 @@ export declare namespace CoinModule {
19
23
  amount: BigNumber;
20
24
  to?: string;
21
25
  }
26
+ interface DepositToGroupParams {
27
+ creator?: string;
28
+ depositCoin: Coin;
29
+ }
30
+ interface WithdrawFromGroupParams {
31
+ creator?: string;
32
+ sourceCoin: Coin;
33
+ }
22
34
  }
@@ -50,5 +50,49 @@ class CoinModule extends base_1.default {
50
50
  }, opts);
51
51
  });
52
52
  }
53
+ depositToGroup(params, opts) {
54
+ var _a;
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const wallet = this.getWallet();
57
+ const value = tx_1.MsgDepositToGroup.fromPartial({
58
+ creator: (_a = params.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
59
+ depositCoin: params.depositCoin
60
+ });
61
+ return yield wallet.sendTx({
62
+ typeUrl: util_1.CarbonTx.Types.MsgDepositToGroup,
63
+ value,
64
+ }, opts);
65
+ });
66
+ }
67
+ convertToGroup(params, opts) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const wallet = this.getWallet();
70
+ const messages = params.map(param => {
71
+ var _a;
72
+ return ({
73
+ typeUrl: util_1.CarbonTx.Types.MsgDepositToGroup,
74
+ value: tx_1.MsgDepositToGroup.fromPartial({
75
+ creator: (_a = param.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
76
+ depositCoin: param.depositCoin,
77
+ }),
78
+ });
79
+ });
80
+ return yield wallet.sendTxs(messages, opts);
81
+ });
82
+ }
83
+ withdrawFromGroup(params, opts) {
84
+ var _a;
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ const wallet = this.getWallet();
87
+ const value = tx_1.MsgWithdrawFromGroup.fromPartial({
88
+ creator: (_a = params.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
89
+ sourceCoin: params.sourceCoin
90
+ });
91
+ return yield wallet.sendTx({
92
+ typeUrl: util_1.CarbonTx.Types.MsgWithdrawFromGroup,
93
+ value,
94
+ }, opts);
95
+ });
96
+ }
53
97
  }
54
98
  exports.CoinModule = CoinModule;
@@ -24,6 +24,8 @@ const utils_1 = require("../utils");
24
24
  const TxTypes = {
25
25
  MintToken: "carbon/MsgMintToken",
26
26
  Withdraw: "carbon/MsgWithdraw",
27
+ DepositToGroup: "carbon/MsgDepositToGroup",
28
+ WithdrawFromGroup: "carbon/MsgWithdrawFromGroup",
27
29
  };
28
30
  const MsgWithdraw = {
29
31
  aminoType: TxTypes.Withdraw,
@@ -33,8 +35,18 @@ const MsgMintToken = {
33
35
  aminoType: TxTypes.MintToken,
34
36
  valueMap: {},
35
37
  };
38
+ const MsgDepositToGroup = {
39
+ aminoType: TxTypes.DepositToGroup,
40
+ valueMap: {},
41
+ };
42
+ const MsgWithdrawFromGroup = {
43
+ aminoType: TxTypes.WithdrawFromGroup,
44
+ valueMap: {},
45
+ };
36
46
  const CoinAmino = {
37
47
  [CarbonTx.Types.MsgWithdraw]: utils_1.generateAminoType(MsgWithdraw),
38
48
  [CarbonTx.Types.MsgMintToken]: utils_1.generateAminoType(MsgMintToken),
49
+ [CarbonTx.Types.MsgDepositToGroup]: utils_1.generateAminoType(MsgDepositToGroup),
50
+ [CarbonTx.Types.MsgWithdrawFromGroup]: utils_1.generateAminoType(MsgWithdrawFromGroup),
39
51
  };
40
52
  exports.default = CoinAmino;
@@ -43,6 +43,12 @@ const ContentTypes = {
43
43
  [util_1.GovUtils.ProposalTypes.UpdateMarket]: "market/UpdateMarketProposal",
44
44
  [util_1.GovUtils.ProposalTypes.CreateOracle]: "oracle/CreateOracleProposal",
45
45
  [util_1.GovUtils.ProposalTypes.SettlementPrice]: "pricing/SettlementPriceProposal",
46
+ [util_1.GovUtils.ProposalTypes.CreateGroup]: "coin/CreateGroupProposal",
47
+ [util_1.GovUtils.ProposalTypes.UpdateGroup]: "coin.UpdateGroupProposal",
48
+ [util_1.GovUtils.ProposalTypes.RegisterToGroup]: "coin/RegisterToGroupProposal",
49
+ [util_1.GovUtils.ProposalTypes.DeregisterFromGroup]: "coin.DeregisterFromGroupProposal",
50
+ [util_1.GovUtils.ProposalTypes.WithdrawFromGroup]: "coin/WithdrawFromGroupProposal",
51
+ [util_1.GovUtils.ProposalTypes.UpdateGroupTokenConfig]: "coin.UpdateGroupTokenConfigProposal",
46
52
  };
47
53
  const SubmitProposalMsg = {
48
54
  aminoType: TxTypes.SubmitProposal,
@@ -88,6 +94,56 @@ const CreateToken = {
88
94
  },
89
95
  },
90
96
  };
97
+ const CreateGroup = {
98
+ value: {
99
+ msg: {
100
+ creator: utils_1.ConvertEncType.Long,
101
+ name: utils_1.ConvertEncType.Long,
102
+ chequeTokenSymbol: utils_1.ConvertEncType.Long,
103
+ oraclieId: utils_1.ConvertEncType.Long,
104
+ }
105
+ }
106
+ };
107
+ const UpdateGroup = {
108
+ value: {
109
+ msg: {
110
+ creator: utils_1.ConvertEncType.Long,
111
+ groupId: utils_1.ConvertEncType.Long,
112
+ updateGroupParams: {
113
+ name: utils_1.ConvertEncType.Long,
114
+ },
115
+ }
116
+ }
117
+ };
118
+ const RegisterToGroup = {
119
+ value: {
120
+ msg: {
121
+ creator: utils_1.ConvertEncType.Long,
122
+ groupId: utils_1.ConvertEncType.Long,
123
+ denom: utils_1.ConvertEncType.Long,
124
+ }
125
+ }
126
+ };
127
+ const DeregisterFromGroup = {
128
+ value: {
129
+ msg: {
130
+ creator: utils_1.ConvertEncType.Long,
131
+ groupId: utils_1.ConvertEncType.Long,
132
+ denom: utils_1.ConvertEncType.Long,
133
+ }
134
+ }
135
+ };
136
+ const UpdateGroupConfig = {
137
+ value: {
138
+ msg: {
139
+ creator: utils_1.ConvertEncType.Long,
140
+ denom: utils_1.ConvertEncType.Long,
141
+ updatedGroupedTokenConfigParams: {
142
+ isActive: utils_1.ConvertEncType.Long,
143
+ }
144
+ }
145
+ }
146
+ };
91
147
  const ChangeNumQuotes = {
92
148
  value: {
93
149
  msg: {
@@ -187,6 +243,21 @@ const checkDecodeProposal = (content, amino) => {
187
243
  case util_1.GovUtils.ProposalTypes.CreateToken:
188
244
  newAmino.content = Object.assign({}, CreateToken);
189
245
  break;
246
+ case util_1.GovUtils.ProposalTypes.CreateGroup:
247
+ newAmino.content = Object.assign({}, CreateGroup);
248
+ break;
249
+ case util_1.GovUtils.ProposalTypes.UpdateGroup:
250
+ newAmino.content = Object.assign({}, UpdateGroup);
251
+ break;
252
+ case util_1.GovUtils.ProposalTypes.RegisterToGroup:
253
+ newAmino.content = Object.assign({}, RegisterToGroup);
254
+ break;
255
+ case util_1.GovUtils.ProposalTypes.DeregisterFromGroup:
256
+ newAmino.content = Object.assign({}, DeregisterFromGroup);
257
+ break;
258
+ case util_1.GovUtils.ProposalTypes.UpdateGroupTokenConfig:
259
+ newAmino.content = Object.assign({}, UpdateGroupConfig);
260
+ break;
190
261
  case util_1.GovUtils.ProposalTypes.SetCommitmentCurve:
191
262
  newAmino.content = Object.assign({}, SetCommitmentCurve);
192
263
  break;
@@ -11,7 +11,7 @@ export declare enum ConvertEncType {
11
11
  DateToNum = "date-number",
12
12
  Duration = "duration"
13
13
  }
14
- export declare type AminoValueMap = SimpleMap<ConvertEncType> | SimpleMap<SimpleMap<ConvertEncType>> | SimpleMap<SimpleMap<SimpleMap<ConvertEncType>>> | SimpleMap<SimpleMap<SimpleMap<SimpleMap<ConvertEncType>>>> | SimpleMap<SimpleMap<SimpleMap<SimpleMap<SimpleMap<ConvertEncType>>>>> | SimpleMap<SimpleMap<ConvertEncType> | ConvertEncType>;
14
+ export declare type AminoValueMap = SimpleMap<ConvertEncType> | SimpleMap<SimpleMap<ConvertEncType>> | SimpleMap<SimpleMap<SimpleMap<ConvertEncType>>> | SimpleMap<SimpleMap<SimpleMap<SimpleMap<ConvertEncType>>>> | SimpleMap<SimpleMap<SimpleMap<SimpleMap<SimpleMap<ConvertEncType>>>>> | SimpleMap<SimpleMap<ConvertEncType> | ConvertEncType> | SimpleMap<SimpleMap<SimpleMap<SimpleMap<ConvertEncType> | ConvertEncType>>> | SimpleMap<SimpleMap<SimpleMap<SimpleMap<SimpleMap<ConvertEncType> | ConvertEncType>>>>;
15
15
  export interface AminoInit {
16
16
  aminoType: string;
17
17
  valueMap: AminoValueMap;
@@ -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 | 4 | 56 | 97 | 42161 | 421611;
41
+ static getRequiredChainId(network: Network, blockchain?: Blockchain): 1 | 5 | 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]: "0xec8BC20687FfA944F57EB1aAa6F98FEDA30bcA65",
41
- [constant_1.Network.DevNet]: "0xec8BC20687FfA944F57EB1aAa6F98FEDA30bcA65",
42
- [constant_1.Network.LocalHost]: "0xec8BC20687FfA944F57EB1aAa6F98FEDA30bcA65",
40
+ [constant_1.Network.TestNet]: "0x086e1b5f67c0f7ca8eb202d35553e27e964899e2",
41
+ [constant_1.Network.DevNet]: "0x086e1b5f67c0f7ca8eb202d35553e27e964899e2",
42
+ [constant_1.Network.LocalHost]: "0x086e1b5f67c0f7ca8eb202d35553e27e964899e2",
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: "0x4",
122
- rpcUrls: ["https://rinkeby.infura.io/v3/"],
121
+ chainId: "0x5",
122
+ rpcUrls: ["https://goerli.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 4;
193
+ return 5;
194
194
  }
195
195
  }
196
196
  checkProvider(blockchain = this.blockchain) {
@@ -365,7 +365,7 @@ class MetaMask {
365
365
  }
366
366
  return 1;
367
367
  }
368
- if (currentChainId === 4) {
368
+ if (currentChainId === 5) {
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 4;
384
+ return 5;
385
385
  }
386
386
  getContractHash(blockchain = this.blockchain) {
387
387
  const contractHash = CONTRACT_HASH[blockchain][this.network];
@@ -1,3 +1,4 @@
1
+ import { Network } from "../constant/network";
1
2
  import { SimpleMap } from "./type";
2
3
  export declare enum Blockchain {
3
4
  Neo = "neo",
@@ -40,6 +41,7 @@ export declare const ChainNames: {
40
41
  readonly 1: "MainNet";
41
42
  readonly 3: "Ropsten";
42
43
  readonly 4: "Rinkeby";
44
+ readonly 5: "Goerli";
43
45
  readonly 56: "BSC MainNet";
44
46
  readonly 97: "BSC TestNet";
45
47
  readonly 110: "ZIL DevNet";
@@ -54,4 +56,4 @@ export declare const chainIdsByBlockchain: SimpleMap<ChainIds>;
54
56
  export declare function parseBlockchain(value: string | null): Blockchain | null;
55
57
  export declare function getChainFromID(id: number): string | undefined;
56
58
  export declare const getBlockchainFromChain: (chainId?: number | undefined) => Blockchain.Ethereum | Blockchain.BinanceSmartChain | Blockchain.Zilliqa | Blockchain.Arbitrum | undefined;
57
- export declare const blockchainForChainId: (chainId?: number | undefined) => Blockchain | undefined;
59
+ export declare const blockchainForChainId: (chainId?: number | undefined, network?: Network) => Blockchain | undefined;
@@ -43,6 +43,7 @@ exports.ChainNames = {
43
43
  1: "MainNet",
44
44
  3: "Ropsten",
45
45
  4: "Rinkeby",
46
+ 5: "Goerli",
46
47
  56: "BSC MainNet",
47
48
  97: "BSC TestNet",
48
49
  110: "ZIL DevNet",
@@ -113,6 +114,7 @@ const getBlockchainFromChain = (chainId) => {
113
114
  case 1:
114
115
  case 3:
115
116
  case 4:
117
+ case 5:
116
118
  return Blockchain.Ethereum;
117
119
  case 56:
118
120
  case 97:
@@ -127,68 +129,101 @@ const getBlockchainFromChain = (chainId) => {
127
129
  return undefined;
128
130
  };
129
131
  exports.getBlockchainFromChain = getBlockchainFromChain;
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;
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;
192
227
  default:
193
228
  return undefined;
194
229
  }
package/lib/util/gov.d.ts CHANGED
@@ -18,7 +18,14 @@ 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"
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"
22
29
  }
23
30
  export interface PropDecoded {
24
31
  typeUrl: string;
package/lib/util/gov.js CHANGED
@@ -27,6 +27,13 @@ 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";
30
37
  })(ProposalTypes = exports.ProposalTypes || (exports.ProposalTypes = {}));
31
38
  exports.emptyProposal = {
32
39
  typeUrl: "",