carbon-js-sdk 0.3.37-dev.1 → 0.3.37-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/codec/coin/tx.d.ts +7 -6
- package/lib/codec/coin/tx.js +80 -58
- package/lib/modules/admin.d.ts +32 -0
- package/lib/modules/admin.js +76 -0
- package/lib/modules/coin.d.ts +3 -2
- package/lib/modules/coin.js +7 -11
- package/lib/provider/amino/types/coin.js +12 -0
- package/lib/provider/amino/types/gov.js +71 -0
- package/lib/provider/amino/utils.d.ts +1 -1
- package/lib/util/gov.d.ts +8 -1
- package/lib/util/gov.js +7 -0
- package/package.json +1 -1
package/lib/codec/coin/tx.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import Long from "long";
|
|
|
2
2
|
import _m0 from "protobufjs/minimal";
|
|
3
3
|
import { Bridge } from "./bridge";
|
|
4
4
|
import { TokenGroup, GroupedTokenConfig } from "./group";
|
|
5
|
+
import { Coin } from "../cosmos/base/v1beta1/coin";
|
|
5
6
|
export declare const protobufPackage = "Switcheo.carbon.coin";
|
|
6
7
|
/** this line is used by starport scaffolding # proto/tx/message */
|
|
7
8
|
export interface MsgCreateToken {
|
|
@@ -174,22 +175,22 @@ export interface MsgDeregisterFromGroupResponse {
|
|
|
174
175
|
export interface MsgDepositToGroup {
|
|
175
176
|
creator: string;
|
|
176
177
|
/** the token and amount to deposit into it's group */
|
|
177
|
-
depositCoin
|
|
178
|
+
depositCoin?: Coin;
|
|
178
179
|
}
|
|
179
180
|
export interface MsgDepositToGroupResponse {
|
|
180
181
|
groupId: Long;
|
|
181
|
-
tokensDeposited
|
|
182
|
-
tokensMinted
|
|
182
|
+
tokensDeposited?: Coin;
|
|
183
|
+
tokensMinted?: Coin;
|
|
183
184
|
}
|
|
184
185
|
export interface MsgWithdrawFromGroup {
|
|
185
186
|
creator: string;
|
|
186
187
|
/** the amount and denom to withdraw into */
|
|
187
|
-
sourceCoin
|
|
188
|
+
sourceCoin?: Coin;
|
|
188
189
|
}
|
|
189
190
|
export interface MsgWithdrawFromGroupResponse {
|
|
190
191
|
groupId: Long;
|
|
191
|
-
tokensBurnt
|
|
192
|
-
tokensWithdrawn
|
|
192
|
+
tokensBurnt?: Coin;
|
|
193
|
+
tokensWithdrawn?: Coin;
|
|
193
194
|
}
|
|
194
195
|
export interface MsgUpdateGroupedTokenConfig {
|
|
195
196
|
creator: string;
|
package/lib/codec/coin/tx.js
CHANGED
|
@@ -9,6 +9,7 @@ const long_1 = __importDefault(require("long"));
|
|
|
9
9
|
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
10
|
const bridge_1 = require("./bridge");
|
|
11
11
|
const group_1 = require("./group");
|
|
12
|
+
const coin_1 = require("../cosmos/base/v1beta1/coin");
|
|
12
13
|
const wrappers_1 = require("../google/protobuf/wrappers");
|
|
13
14
|
exports.protobufPackage = "Switcheo.carbon.coin";
|
|
14
15
|
const baseMsgCreateToken = { creator: "" };
|
|
@@ -2509,14 +2510,14 @@ exports.MsgDeregisterFromGroupResponse = {
|
|
|
2509
2510
|
return message;
|
|
2510
2511
|
},
|
|
2511
2512
|
};
|
|
2512
|
-
const baseMsgDepositToGroup = { creator: ""
|
|
2513
|
+
const baseMsgDepositToGroup = { creator: "" };
|
|
2513
2514
|
exports.MsgDepositToGroup = {
|
|
2514
2515
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
2515
2516
|
if (message.creator !== "") {
|
|
2516
2517
|
writer.uint32(10).string(message.creator);
|
|
2517
2518
|
}
|
|
2518
|
-
if (message.depositCoin !==
|
|
2519
|
-
writer.uint32(18).
|
|
2519
|
+
if (message.depositCoin !== undefined) {
|
|
2520
|
+
coin_1.Coin.encode(message.depositCoin, writer.uint32(18).fork()).ldelim();
|
|
2520
2521
|
}
|
|
2521
2522
|
return writer;
|
|
2522
2523
|
},
|
|
@@ -2531,7 +2532,7 @@ exports.MsgDepositToGroup = {
|
|
|
2531
2532
|
message.creator = reader.string();
|
|
2532
2533
|
break;
|
|
2533
2534
|
case 2:
|
|
2534
|
-
message.depositCoin = reader.
|
|
2535
|
+
message.depositCoin = coin_1.Coin.decode(reader, reader.uint32());
|
|
2535
2536
|
break;
|
|
2536
2537
|
default:
|
|
2537
2538
|
reader.skipType(tag & 7);
|
|
@@ -2548,40 +2549,41 @@ exports.MsgDepositToGroup = {
|
|
|
2548
2549
|
: "";
|
|
2549
2550
|
message.depositCoin =
|
|
2550
2551
|
object.depositCoin !== undefined && object.depositCoin !== null
|
|
2551
|
-
?
|
|
2552
|
-
:
|
|
2552
|
+
? coin_1.Coin.fromJSON(object.depositCoin)
|
|
2553
|
+
: undefined;
|
|
2553
2554
|
return message;
|
|
2554
2555
|
},
|
|
2555
2556
|
toJSON(message) {
|
|
2556
2557
|
const obj = {};
|
|
2557
2558
|
message.creator !== undefined && (obj.creator = message.creator);
|
|
2558
2559
|
message.depositCoin !== undefined &&
|
|
2559
|
-
(obj.depositCoin = message.depositCoin
|
|
2560
|
+
(obj.depositCoin = message.depositCoin
|
|
2561
|
+
? coin_1.Coin.toJSON(message.depositCoin)
|
|
2562
|
+
: undefined);
|
|
2560
2563
|
return obj;
|
|
2561
2564
|
},
|
|
2562
2565
|
fromPartial(object) {
|
|
2563
|
-
var _a
|
|
2566
|
+
var _a;
|
|
2564
2567
|
const message = Object.assign({}, baseMsgDepositToGroup);
|
|
2565
2568
|
message.creator = (_a = object.creator) !== null && _a !== void 0 ? _a : "";
|
|
2566
|
-
message.depositCoin =
|
|
2569
|
+
message.depositCoin =
|
|
2570
|
+
object.depositCoin !== undefined && object.depositCoin !== null
|
|
2571
|
+
? coin_1.Coin.fromPartial(object.depositCoin)
|
|
2572
|
+
: undefined;
|
|
2567
2573
|
return message;
|
|
2568
2574
|
},
|
|
2569
2575
|
};
|
|
2570
|
-
const baseMsgDepositToGroupResponse = {
|
|
2571
|
-
groupId: long_1.default.UZERO,
|
|
2572
|
-
tokensDeposited: "",
|
|
2573
|
-
tokensMinted: "",
|
|
2574
|
-
};
|
|
2576
|
+
const baseMsgDepositToGroupResponse = { groupId: long_1.default.UZERO };
|
|
2575
2577
|
exports.MsgDepositToGroupResponse = {
|
|
2576
2578
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
2577
2579
|
if (!message.groupId.isZero()) {
|
|
2578
2580
|
writer.uint32(8).uint64(message.groupId);
|
|
2579
2581
|
}
|
|
2580
|
-
if (message.tokensDeposited !==
|
|
2581
|
-
writer.uint32(18).
|
|
2582
|
+
if (message.tokensDeposited !== undefined) {
|
|
2583
|
+
coin_1.Coin.encode(message.tokensDeposited, writer.uint32(18).fork()).ldelim();
|
|
2582
2584
|
}
|
|
2583
|
-
if (message.tokensMinted !==
|
|
2584
|
-
writer.uint32(26).
|
|
2585
|
+
if (message.tokensMinted !== undefined) {
|
|
2586
|
+
coin_1.Coin.encode(message.tokensMinted, writer.uint32(26).fork()).ldelim();
|
|
2585
2587
|
}
|
|
2586
2588
|
return writer;
|
|
2587
2589
|
},
|
|
@@ -2596,10 +2598,10 @@ exports.MsgDepositToGroupResponse = {
|
|
|
2596
2598
|
message.groupId = reader.uint64();
|
|
2597
2599
|
break;
|
|
2598
2600
|
case 2:
|
|
2599
|
-
message.tokensDeposited = reader.
|
|
2601
|
+
message.tokensDeposited = coin_1.Coin.decode(reader, reader.uint32());
|
|
2600
2602
|
break;
|
|
2601
2603
|
case 3:
|
|
2602
|
-
message.tokensMinted = reader.
|
|
2604
|
+
message.tokensMinted = coin_1.Coin.decode(reader, reader.uint32());
|
|
2603
2605
|
break;
|
|
2604
2606
|
default:
|
|
2605
2607
|
reader.skipType(tag & 7);
|
|
@@ -2616,12 +2618,12 @@ exports.MsgDepositToGroupResponse = {
|
|
|
2616
2618
|
: long_1.default.UZERO;
|
|
2617
2619
|
message.tokensDeposited =
|
|
2618
2620
|
object.tokensDeposited !== undefined && object.tokensDeposited !== null
|
|
2619
|
-
?
|
|
2620
|
-
:
|
|
2621
|
+
? coin_1.Coin.fromJSON(object.tokensDeposited)
|
|
2622
|
+
: undefined;
|
|
2621
2623
|
message.tokensMinted =
|
|
2622
2624
|
object.tokensMinted !== undefined && object.tokensMinted !== null
|
|
2623
|
-
?
|
|
2624
|
-
:
|
|
2625
|
+
? coin_1.Coin.fromJSON(object.tokensMinted)
|
|
2626
|
+
: undefined;
|
|
2625
2627
|
return message;
|
|
2626
2628
|
},
|
|
2627
2629
|
toJSON(message) {
|
|
@@ -2629,31 +2631,40 @@ exports.MsgDepositToGroupResponse = {
|
|
|
2629
2631
|
message.groupId !== undefined &&
|
|
2630
2632
|
(obj.groupId = (message.groupId || long_1.default.UZERO).toString());
|
|
2631
2633
|
message.tokensDeposited !== undefined &&
|
|
2632
|
-
(obj.tokensDeposited = message.tokensDeposited
|
|
2634
|
+
(obj.tokensDeposited = message.tokensDeposited
|
|
2635
|
+
? coin_1.Coin.toJSON(message.tokensDeposited)
|
|
2636
|
+
: undefined);
|
|
2633
2637
|
message.tokensMinted !== undefined &&
|
|
2634
|
-
(obj.tokensMinted = message.tokensMinted
|
|
2638
|
+
(obj.tokensMinted = message.tokensMinted
|
|
2639
|
+
? coin_1.Coin.toJSON(message.tokensMinted)
|
|
2640
|
+
: undefined);
|
|
2635
2641
|
return obj;
|
|
2636
2642
|
},
|
|
2637
2643
|
fromPartial(object) {
|
|
2638
|
-
var _a, _b;
|
|
2639
2644
|
const message = Object.assign({}, baseMsgDepositToGroupResponse);
|
|
2640
2645
|
message.groupId =
|
|
2641
2646
|
object.groupId !== undefined && object.groupId !== null
|
|
2642
2647
|
? long_1.default.fromValue(object.groupId)
|
|
2643
2648
|
: long_1.default.UZERO;
|
|
2644
|
-
message.tokensDeposited =
|
|
2645
|
-
|
|
2649
|
+
message.tokensDeposited =
|
|
2650
|
+
object.tokensDeposited !== undefined && object.tokensDeposited !== null
|
|
2651
|
+
? coin_1.Coin.fromPartial(object.tokensDeposited)
|
|
2652
|
+
: undefined;
|
|
2653
|
+
message.tokensMinted =
|
|
2654
|
+
object.tokensMinted !== undefined && object.tokensMinted !== null
|
|
2655
|
+
? coin_1.Coin.fromPartial(object.tokensMinted)
|
|
2656
|
+
: undefined;
|
|
2646
2657
|
return message;
|
|
2647
2658
|
},
|
|
2648
2659
|
};
|
|
2649
|
-
const baseMsgWithdrawFromGroup = { creator: ""
|
|
2660
|
+
const baseMsgWithdrawFromGroup = { creator: "" };
|
|
2650
2661
|
exports.MsgWithdrawFromGroup = {
|
|
2651
2662
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
2652
2663
|
if (message.creator !== "") {
|
|
2653
2664
|
writer.uint32(10).string(message.creator);
|
|
2654
2665
|
}
|
|
2655
|
-
if (message.sourceCoin !==
|
|
2656
|
-
writer.uint32(18).
|
|
2666
|
+
if (message.sourceCoin !== undefined) {
|
|
2667
|
+
coin_1.Coin.encode(message.sourceCoin, writer.uint32(18).fork()).ldelim();
|
|
2657
2668
|
}
|
|
2658
2669
|
return writer;
|
|
2659
2670
|
},
|
|
@@ -2668,7 +2679,7 @@ exports.MsgWithdrawFromGroup = {
|
|
|
2668
2679
|
message.creator = reader.string();
|
|
2669
2680
|
break;
|
|
2670
2681
|
case 2:
|
|
2671
|
-
message.sourceCoin = reader.
|
|
2682
|
+
message.sourceCoin = coin_1.Coin.decode(reader, reader.uint32());
|
|
2672
2683
|
break;
|
|
2673
2684
|
default:
|
|
2674
2685
|
reader.skipType(tag & 7);
|
|
@@ -2685,39 +2696,41 @@ exports.MsgWithdrawFromGroup = {
|
|
|
2685
2696
|
: "";
|
|
2686
2697
|
message.sourceCoin =
|
|
2687
2698
|
object.sourceCoin !== undefined && object.sourceCoin !== null
|
|
2688
|
-
?
|
|
2689
|
-
:
|
|
2699
|
+
? coin_1.Coin.fromJSON(object.sourceCoin)
|
|
2700
|
+
: undefined;
|
|
2690
2701
|
return message;
|
|
2691
2702
|
},
|
|
2692
2703
|
toJSON(message) {
|
|
2693
2704
|
const obj = {};
|
|
2694
2705
|
message.creator !== undefined && (obj.creator = message.creator);
|
|
2695
|
-
message.sourceCoin !== undefined &&
|
|
2706
|
+
message.sourceCoin !== undefined &&
|
|
2707
|
+
(obj.sourceCoin = message.sourceCoin
|
|
2708
|
+
? coin_1.Coin.toJSON(message.sourceCoin)
|
|
2709
|
+
: undefined);
|
|
2696
2710
|
return obj;
|
|
2697
2711
|
},
|
|
2698
2712
|
fromPartial(object) {
|
|
2699
|
-
var _a
|
|
2713
|
+
var _a;
|
|
2700
2714
|
const message = Object.assign({}, baseMsgWithdrawFromGroup);
|
|
2701
2715
|
message.creator = (_a = object.creator) !== null && _a !== void 0 ? _a : "";
|
|
2702
|
-
message.sourceCoin =
|
|
2716
|
+
message.sourceCoin =
|
|
2717
|
+
object.sourceCoin !== undefined && object.sourceCoin !== null
|
|
2718
|
+
? coin_1.Coin.fromPartial(object.sourceCoin)
|
|
2719
|
+
: undefined;
|
|
2703
2720
|
return message;
|
|
2704
2721
|
},
|
|
2705
2722
|
};
|
|
2706
|
-
const baseMsgWithdrawFromGroupResponse = {
|
|
2707
|
-
groupId: long_1.default.UZERO,
|
|
2708
|
-
tokensBurnt: "",
|
|
2709
|
-
tokensWithdrawn: "",
|
|
2710
|
-
};
|
|
2723
|
+
const baseMsgWithdrawFromGroupResponse = { groupId: long_1.default.UZERO };
|
|
2711
2724
|
exports.MsgWithdrawFromGroupResponse = {
|
|
2712
2725
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
2713
2726
|
if (!message.groupId.isZero()) {
|
|
2714
2727
|
writer.uint32(8).uint64(message.groupId);
|
|
2715
2728
|
}
|
|
2716
|
-
if (message.tokensBurnt !==
|
|
2717
|
-
writer.uint32(18).
|
|
2729
|
+
if (message.tokensBurnt !== undefined) {
|
|
2730
|
+
coin_1.Coin.encode(message.tokensBurnt, writer.uint32(18).fork()).ldelim();
|
|
2718
2731
|
}
|
|
2719
|
-
if (message.tokensWithdrawn !==
|
|
2720
|
-
writer.uint32(26).
|
|
2732
|
+
if (message.tokensWithdrawn !== undefined) {
|
|
2733
|
+
coin_1.Coin.encode(message.tokensWithdrawn, writer.uint32(26).fork()).ldelim();
|
|
2721
2734
|
}
|
|
2722
2735
|
return writer;
|
|
2723
2736
|
},
|
|
@@ -2732,10 +2745,10 @@ exports.MsgWithdrawFromGroupResponse = {
|
|
|
2732
2745
|
message.groupId = reader.uint64();
|
|
2733
2746
|
break;
|
|
2734
2747
|
case 2:
|
|
2735
|
-
message.tokensBurnt = reader.
|
|
2748
|
+
message.tokensBurnt = coin_1.Coin.decode(reader, reader.uint32());
|
|
2736
2749
|
break;
|
|
2737
2750
|
case 3:
|
|
2738
|
-
message.tokensWithdrawn = reader.
|
|
2751
|
+
message.tokensWithdrawn = coin_1.Coin.decode(reader, reader.uint32());
|
|
2739
2752
|
break;
|
|
2740
2753
|
default:
|
|
2741
2754
|
reader.skipType(tag & 7);
|
|
@@ -2752,12 +2765,12 @@ exports.MsgWithdrawFromGroupResponse = {
|
|
|
2752
2765
|
: long_1.default.UZERO;
|
|
2753
2766
|
message.tokensBurnt =
|
|
2754
2767
|
object.tokensBurnt !== undefined && object.tokensBurnt !== null
|
|
2755
|
-
?
|
|
2756
|
-
:
|
|
2768
|
+
? coin_1.Coin.fromJSON(object.tokensBurnt)
|
|
2769
|
+
: undefined;
|
|
2757
2770
|
message.tokensWithdrawn =
|
|
2758
2771
|
object.tokensWithdrawn !== undefined && object.tokensWithdrawn !== null
|
|
2759
|
-
?
|
|
2760
|
-
:
|
|
2772
|
+
? coin_1.Coin.fromJSON(object.tokensWithdrawn)
|
|
2773
|
+
: undefined;
|
|
2761
2774
|
return message;
|
|
2762
2775
|
},
|
|
2763
2776
|
toJSON(message) {
|
|
@@ -2765,20 +2778,29 @@ exports.MsgWithdrawFromGroupResponse = {
|
|
|
2765
2778
|
message.groupId !== undefined &&
|
|
2766
2779
|
(obj.groupId = (message.groupId || long_1.default.UZERO).toString());
|
|
2767
2780
|
message.tokensBurnt !== undefined &&
|
|
2768
|
-
(obj.tokensBurnt = message.tokensBurnt
|
|
2781
|
+
(obj.tokensBurnt = message.tokensBurnt
|
|
2782
|
+
? coin_1.Coin.toJSON(message.tokensBurnt)
|
|
2783
|
+
: undefined);
|
|
2769
2784
|
message.tokensWithdrawn !== undefined &&
|
|
2770
|
-
(obj.tokensWithdrawn = message.tokensWithdrawn
|
|
2785
|
+
(obj.tokensWithdrawn = message.tokensWithdrawn
|
|
2786
|
+
? coin_1.Coin.toJSON(message.tokensWithdrawn)
|
|
2787
|
+
: undefined);
|
|
2771
2788
|
return obj;
|
|
2772
2789
|
},
|
|
2773
2790
|
fromPartial(object) {
|
|
2774
|
-
var _a, _b;
|
|
2775
2791
|
const message = Object.assign({}, baseMsgWithdrawFromGroupResponse);
|
|
2776
2792
|
message.groupId =
|
|
2777
2793
|
object.groupId !== undefined && object.groupId !== null
|
|
2778
2794
|
? long_1.default.fromValue(object.groupId)
|
|
2779
2795
|
: long_1.default.UZERO;
|
|
2780
|
-
message.tokensBurnt =
|
|
2781
|
-
|
|
2796
|
+
message.tokensBurnt =
|
|
2797
|
+
object.tokensBurnt !== undefined && object.tokensBurnt !== null
|
|
2798
|
+
? coin_1.Coin.fromPartial(object.tokensBurnt)
|
|
2799
|
+
: undefined;
|
|
2800
|
+
message.tokensWithdrawn =
|
|
2801
|
+
object.tokensWithdrawn !== undefined && object.tokensWithdrawn !== null
|
|
2802
|
+
? coin_1.Coin.fromPartial(object.tokensWithdrawn)
|
|
2803
|
+
: undefined;
|
|
2782
2804
|
return message;
|
|
2783
2805
|
},
|
|
2784
2806
|
};
|
package/lib/modules/admin.d.ts
CHANGED
|
@@ -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;
|
package/lib/modules/admin.js
CHANGED
|
@@ -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) {
|
package/lib/modules/coin.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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";
|
|
@@ -24,10 +25,10 @@ export declare namespace CoinModule {
|
|
|
24
25
|
}
|
|
25
26
|
interface DepositToGroupParams {
|
|
26
27
|
creator?: string;
|
|
27
|
-
depositCoin:
|
|
28
|
+
depositCoin: Coin;
|
|
28
29
|
}
|
|
29
30
|
interface WithdrawFromGroupParams {
|
|
30
31
|
creator?: string;
|
|
31
|
-
sourceCoin:
|
|
32
|
+
sourceCoin: Coin;
|
|
32
33
|
}
|
|
33
34
|
}
|
package/lib/modules/coin.js
CHANGED
|
@@ -50,7 +50,6 @@ class CoinModule extends base_1.default {
|
|
|
50
50
|
}, opts);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
/// call
|
|
54
53
|
depositToGroup(params, opts) {
|
|
55
54
|
var _a;
|
|
56
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -68,18 +67,15 @@ class CoinModule extends base_1.default {
|
|
|
68
67
|
convertToGroup(params, opts) {
|
|
69
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
69
|
const wallet = this.getWallet();
|
|
71
|
-
const messages =
|
|
72
|
-
params.forEach((param) => {
|
|
70
|
+
const messages = params.map(param => {
|
|
73
71
|
var _a;
|
|
74
|
-
|
|
75
|
-
creator: (_a = param.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
|
|
76
|
-
depositCoin: param.depositCoin
|
|
77
|
-
});
|
|
78
|
-
const message = {
|
|
72
|
+
return ({
|
|
79
73
|
typeUrl: util_1.CarbonTx.Types.MsgDepositToGroup,
|
|
80
|
-
value
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
value: tx_1.MsgDepositToGroup.fromPartial({
|
|
75
|
+
creator: (_a = param.creator) !== null && _a !== void 0 ? _a : wallet.bech32Address,
|
|
76
|
+
depositCoin: param.depositCoin,
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
83
79
|
});
|
|
84
80
|
return yield wallet.sendTxs(messages, opts);
|
|
85
81
|
});
|
|
@@ -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]: (0, utils_1.generateAminoType)(MsgWithdraw),
|
|
38
48
|
[CarbonTx.Types.MsgMintToken]: (0, utils_1.generateAminoType)(MsgMintToken),
|
|
49
|
+
[CarbonTx.Types.MsgDepositToGroup]: (0, utils_1.generateAminoType)(MsgDepositToGroup),
|
|
50
|
+
[CarbonTx.Types.MsgWithdrawFromGroup]: (0, 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;
|
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: "",
|