carbon-js-sdk 0.2.16 → 0.2.17

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.
@@ -65,10 +65,9 @@ class N3Client {
65
65
  continue;
66
66
  if (whitelistDenoms && !whitelistDenoms.includes(token.denom))
67
67
  continue;
68
- const tokenScriptHash = neon_core_next_1.u.reverseHex(token.tokenAddress);
69
- if (!balances[tokenScriptHash])
68
+ if (!balances[token.tokenAddress])
70
69
  continue;
71
- tokensWithBalance.push(Object.assign(Object.assign({}, token), { externalBalance: balances[tokenScriptHash] }));
70
+ tokensWithBalance.push(Object.assign(Object.assign({}, token), { externalBalance: balances[token.tokenAddress] }));
72
71
  }
73
72
  return tokensWithBalance;
74
73
  });
@@ -8,7 +8,7 @@ export interface AssetParams {
8
8
  allowRepayStablecoinInterestDebt: boolean;
9
9
  loanToValue: string;
10
10
  liquidationThreshold: string;
11
- liquidationBonus: string;
11
+ liquidationDiscount: string;
12
12
  supplyCap: string;
13
13
  borrowCap: string;
14
14
  }
@@ -15,7 +15,7 @@ const baseAssetParams = {
15
15
  allowRepayStablecoinInterestDebt: false,
16
16
  loanToValue: "",
17
17
  liquidationThreshold: "",
18
- liquidationBonus: "",
18
+ liquidationDiscount: "",
19
19
  supplyCap: "",
20
20
  borrowCap: "",
21
21
  };
@@ -39,8 +39,8 @@ exports.AssetParams = {
39
39
  if (message.liquidationThreshold !== "") {
40
40
  writer.uint32(50).string(message.liquidationThreshold);
41
41
  }
42
- if (message.liquidationBonus !== "") {
43
- writer.uint32(58).string(message.liquidationBonus);
42
+ if (message.liquidationDiscount !== "") {
43
+ writer.uint32(58).string(message.liquidationDiscount);
44
44
  }
45
45
  if (message.supplyCap !== "") {
46
46
  writer.uint32(66).string(message.supplyCap);
@@ -76,7 +76,7 @@ exports.AssetParams = {
76
76
  message.liquidationThreshold = reader.string();
77
77
  break;
78
78
  case 7:
79
- message.liquidationBonus = reader.string();
79
+ message.liquidationDiscount = reader.string();
80
80
  break;
81
81
  case 8:
82
82
  message.supplyCap = reader.string();
@@ -119,9 +119,10 @@ exports.AssetParams = {
119
119
  object.liquidationThreshold !== null
120
120
  ? String(object.liquidationThreshold)
121
121
  : "";
122
- message.liquidationBonus =
123
- object.liquidationBonus !== undefined && object.liquidationBonus !== null
124
- ? String(object.liquidationBonus)
122
+ message.liquidationDiscount =
123
+ object.liquidationDiscount !== undefined &&
124
+ object.liquidationDiscount !== null
125
+ ? String(object.liquidationDiscount)
125
126
  : "";
126
127
  message.supplyCap =
127
128
  object.supplyCap !== undefined && object.supplyCap !== null
@@ -146,8 +147,8 @@ exports.AssetParams = {
146
147
  (obj.loanToValue = message.loanToValue);
147
148
  message.liquidationThreshold !== undefined &&
148
149
  (obj.liquidationThreshold = message.liquidationThreshold);
149
- message.liquidationBonus !== undefined &&
150
- (obj.liquidationBonus = message.liquidationBonus);
150
+ message.liquidationDiscount !== undefined &&
151
+ (obj.liquidationDiscount = message.liquidationDiscount);
151
152
  message.supplyCap !== undefined && (obj.supplyCap = message.supplyCap);
152
153
  message.borrowCap !== undefined && (obj.borrowCap = message.borrowCap);
153
154
  return obj;
@@ -162,7 +163,7 @@ exports.AssetParams = {
162
163
  (_d = object.allowRepayStablecoinInterestDebt) !== null && _d !== void 0 ? _d : false;
163
164
  message.loanToValue = (_e = object.loanToValue) !== null && _e !== void 0 ? _e : "";
164
165
  message.liquidationThreshold = (_f = object.liquidationThreshold) !== null && _f !== void 0 ? _f : "";
165
- message.liquidationBonus = (_g = object.liquidationBonus) !== null && _g !== void 0 ? _g : "";
166
+ message.liquidationDiscount = (_g = object.liquidationDiscount) !== null && _g !== void 0 ? _g : "";
166
167
  message.supplyCap = (_h = object.supplyCap) !== null && _h !== void 0 ? _h : "";
167
168
  message.borrowCap = (_j = object.borrowCap) !== null && _j !== void 0 ? _j : "";
168
169
  return message;
@@ -6,6 +6,7 @@ export interface Params {
6
6
  interestFee: string;
7
7
  liquidationFee: string;
8
8
  stablecoinInterestRate: string;
9
+ stablecoinMintCap: string;
9
10
  /**
10
11
  * Complete Liquidation Threshold determines how far between
11
12
  * liquidation_threshold (LT) and collateral_value (CV) a borrower's
@@ -41,6 +42,13 @@ export interface Params {
41
42
  * dynamic close factor.
42
43
  */
43
44
  smallLiquidationSize: string;
45
+ /**
46
+ * stale_price_grace_period determines the grace period in seconds before an oracle price is regarded as stale.
47
+ * This would cause certain actions like borrowing to be paused
48
+ */
49
+ stalePriceGracePeriod: string;
50
+ /** cdp_paused if true, causes all supply, locking, lending, borrowing and liquidations to be paused */
51
+ cdpPaused: boolean;
44
52
  }
45
53
  export declare const Params: {
46
54
  encode(message: Params, writer?: _m0.Writer): _m0.Writer;
@@ -12,9 +12,12 @@ const baseParams = {
12
12
  interestFee: "",
13
13
  liquidationFee: "",
14
14
  stablecoinInterestRate: "",
15
+ stablecoinMintCap: "",
15
16
  completeLiquidationThreshold: "",
16
17
  minimumCloseFactor: "",
17
18
  smallLiquidationSize: "",
19
+ stalePriceGracePeriod: "",
20
+ cdpPaused: false,
18
21
  };
19
22
  exports.Params = {
20
23
  encode(message, writer = minimal_1.default.Writer.create()) {
@@ -27,14 +30,23 @@ exports.Params = {
27
30
  if (message.stablecoinInterestRate !== "") {
28
31
  writer.uint32(26).string(message.stablecoinInterestRate);
29
32
  }
33
+ if (message.stablecoinMintCap !== "") {
34
+ writer.uint32(34).string(message.stablecoinMintCap);
35
+ }
30
36
  if (message.completeLiquidationThreshold !== "") {
31
- writer.uint32(34).string(message.completeLiquidationThreshold);
37
+ writer.uint32(42).string(message.completeLiquidationThreshold);
32
38
  }
33
39
  if (message.minimumCloseFactor !== "") {
34
- writer.uint32(42).string(message.minimumCloseFactor);
40
+ writer.uint32(50).string(message.minimumCloseFactor);
35
41
  }
36
42
  if (message.smallLiquidationSize !== "") {
37
- writer.uint32(50).string(message.smallLiquidationSize);
43
+ writer.uint32(58).string(message.smallLiquidationSize);
44
+ }
45
+ if (message.stalePriceGracePeriod !== "") {
46
+ writer.uint32(66).string(message.stalePriceGracePeriod);
47
+ }
48
+ if (message.cdpPaused === true) {
49
+ writer.uint32(72).bool(message.cdpPaused);
38
50
  }
39
51
  return writer;
40
52
  },
@@ -55,14 +67,23 @@ exports.Params = {
55
67
  message.stablecoinInterestRate = reader.string();
56
68
  break;
57
69
  case 4:
58
- message.completeLiquidationThreshold = reader.string();
70
+ message.stablecoinMintCap = reader.string();
59
71
  break;
60
72
  case 5:
61
- message.minimumCloseFactor = reader.string();
73
+ message.completeLiquidationThreshold = reader.string();
62
74
  break;
63
75
  case 6:
76
+ message.minimumCloseFactor = reader.string();
77
+ break;
78
+ case 7:
64
79
  message.smallLiquidationSize = reader.string();
65
80
  break;
81
+ case 8:
82
+ message.stalePriceGracePeriod = reader.string();
83
+ break;
84
+ case 9:
85
+ message.cdpPaused = reader.bool();
86
+ break;
66
87
  default:
67
88
  reader.skipType(tag & 7);
68
89
  break;
@@ -85,6 +106,11 @@ exports.Params = {
85
106
  object.stablecoinInterestRate !== null
86
107
  ? String(object.stablecoinInterestRate)
87
108
  : "";
109
+ message.stablecoinMintCap =
110
+ object.stablecoinMintCap !== undefined &&
111
+ object.stablecoinMintCap !== null
112
+ ? String(object.stablecoinMintCap)
113
+ : "";
88
114
  message.completeLiquidationThreshold =
89
115
  object.completeLiquidationThreshold !== undefined &&
90
116
  object.completeLiquidationThreshold !== null
@@ -100,6 +126,15 @@ exports.Params = {
100
126
  object.smallLiquidationSize !== null
101
127
  ? String(object.smallLiquidationSize)
102
128
  : "";
129
+ message.stalePriceGracePeriod =
130
+ object.stalePriceGracePeriod !== undefined &&
131
+ object.stalePriceGracePeriod !== null
132
+ ? String(object.stalePriceGracePeriod)
133
+ : "";
134
+ message.cdpPaused =
135
+ object.cdpPaused !== undefined && object.cdpPaused !== null
136
+ ? Boolean(object.cdpPaused)
137
+ : false;
103
138
  return message;
104
139
  },
105
140
  toJSON(message) {
@@ -110,24 +145,32 @@ exports.Params = {
110
145
  (obj.liquidationFee = message.liquidationFee);
111
146
  message.stablecoinInterestRate !== undefined &&
112
147
  (obj.stablecoinInterestRate = message.stablecoinInterestRate);
148
+ message.stablecoinMintCap !== undefined &&
149
+ (obj.stablecoinMintCap = message.stablecoinMintCap);
113
150
  message.completeLiquidationThreshold !== undefined &&
114
151
  (obj.completeLiquidationThreshold = message.completeLiquidationThreshold);
115
152
  message.minimumCloseFactor !== undefined &&
116
153
  (obj.minimumCloseFactor = message.minimumCloseFactor);
117
154
  message.smallLiquidationSize !== undefined &&
118
155
  (obj.smallLiquidationSize = message.smallLiquidationSize);
156
+ message.stalePriceGracePeriod !== undefined &&
157
+ (obj.stalePriceGracePeriod = message.stalePriceGracePeriod);
158
+ message.cdpPaused !== undefined && (obj.cdpPaused = message.cdpPaused);
119
159
  return obj;
120
160
  },
121
161
  fromPartial(object) {
122
- var _a, _b, _c, _d, _e, _f;
162
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
123
163
  const message = Object.assign({}, baseParams);
124
164
  message.interestFee = (_a = object.interestFee) !== null && _a !== void 0 ? _a : "";
125
165
  message.liquidationFee = (_b = object.liquidationFee) !== null && _b !== void 0 ? _b : "";
126
166
  message.stablecoinInterestRate = (_c = object.stablecoinInterestRate) !== null && _c !== void 0 ? _c : "";
167
+ message.stablecoinMintCap = (_d = object.stablecoinMintCap) !== null && _d !== void 0 ? _d : "";
127
168
  message.completeLiquidationThreshold =
128
- (_d = object.completeLiquidationThreshold) !== null && _d !== void 0 ? _d : "";
129
- message.minimumCloseFactor = (_e = object.minimumCloseFactor) !== null && _e !== void 0 ? _e : "";
130
- message.smallLiquidationSize = (_f = object.smallLiquidationSize) !== null && _f !== void 0 ? _f : "";
169
+ (_e = object.completeLiquidationThreshold) !== null && _e !== void 0 ? _e : "";
170
+ message.minimumCloseFactor = (_f = object.minimumCloseFactor) !== null && _f !== void 0 ? _f : "";
171
+ message.smallLiquidationSize = (_g = object.smallLiquidationSize) !== null && _g !== void 0 ? _g : "";
172
+ message.stalePriceGracePeriod = (_h = object.stalePriceGracePeriod) !== null && _h !== void 0 ? _h : "";
173
+ message.cdpPaused = (_j = object.cdpPaused) !== null && _j !== void 0 ? _j : false;
131
174
  return message;
132
175
  },
133
176
  };
@@ -30,16 +30,11 @@ export interface UpdateRewardSchemeParams {
30
30
  startTime?: Date;
31
31
  endTime?: Date;
32
32
  }
33
- export interface AddReservesParams {
34
- creator: string;
35
- rewardSchemeId: Long;
36
- amount: string;
37
- denom: string;
38
- }
39
33
  export interface RewardDebt {
40
34
  userAddress: string;
41
35
  rewardSchemeId: Long;
42
36
  rewardDebt: string;
37
+ lastUpdatedAt?: Date;
43
38
  }
44
39
  export declare const RewardScheme: {
45
40
  encode(message: RewardScheme, writer?: _m0.Writer): _m0.Writer;
@@ -62,13 +57,6 @@ export declare const UpdateRewardSchemeParams: {
62
57
  toJSON(message: UpdateRewardSchemeParams): unknown;
63
58
  fromPartial(object: DeepPartial<UpdateRewardSchemeParams>): UpdateRewardSchemeParams;
64
59
  };
65
- export declare const AddReservesParams: {
66
- encode(message: AddReservesParams, writer?: _m0.Writer): _m0.Writer;
67
- decode(input: _m0.Reader | Uint8Array, length?: number | undefined): AddReservesParams;
68
- fromJSON(object: any): AddReservesParams;
69
- toJSON(message: AddReservesParams): unknown;
70
- fromPartial(object: DeepPartial<AddReservesParams>): AddReservesParams;
71
- };
72
60
  export declare const RewardDebt: {
73
61
  encode(message: RewardDebt, writer?: _m0.Writer): _m0.Writer;
74
62
  decode(input: _m0.Reader | Uint8Array, length?: number | undefined): RewardDebt;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.RewardDebt = exports.AddReservesParams = exports.UpdateRewardSchemeParams = exports.CreateRewardSchemeParams = exports.RewardScheme = exports.protobufPackage = void 0;
6
+ exports.RewardDebt = exports.UpdateRewardSchemeParams = exports.CreateRewardSchemeParams = exports.RewardScheme = exports.protobufPackage = void 0;
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
@@ -429,96 +429,6 @@ exports.UpdateRewardSchemeParams = {
429
429
  return message;
430
430
  },
431
431
  };
432
- const baseAddReservesParams = {
433
- creator: "",
434
- rewardSchemeId: long_1.default.UZERO,
435
- amount: "",
436
- denom: "",
437
- };
438
- exports.AddReservesParams = {
439
- encode(message, writer = minimal_1.default.Writer.create()) {
440
- if (message.creator !== "") {
441
- writer.uint32(10).string(message.creator);
442
- }
443
- if (!message.rewardSchemeId.isZero()) {
444
- writer.uint32(16).uint64(message.rewardSchemeId);
445
- }
446
- if (message.amount !== "") {
447
- writer.uint32(26).string(message.amount);
448
- }
449
- if (message.denom !== "") {
450
- writer.uint32(34).string(message.denom);
451
- }
452
- return writer;
453
- },
454
- decode(input, length) {
455
- const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
456
- let end = length === undefined ? reader.len : reader.pos + length;
457
- const message = Object.assign({}, baseAddReservesParams);
458
- while (reader.pos < end) {
459
- const tag = reader.uint32();
460
- switch (tag >>> 3) {
461
- case 1:
462
- message.creator = reader.string();
463
- break;
464
- case 2:
465
- message.rewardSchemeId = reader.uint64();
466
- break;
467
- case 3:
468
- message.amount = reader.string();
469
- break;
470
- case 4:
471
- message.denom = reader.string();
472
- break;
473
- default:
474
- reader.skipType(tag & 7);
475
- break;
476
- }
477
- }
478
- return message;
479
- },
480
- fromJSON(object) {
481
- const message = Object.assign({}, baseAddReservesParams);
482
- message.creator =
483
- object.creator !== undefined && object.creator !== null
484
- ? String(object.creator)
485
- : "";
486
- message.rewardSchemeId =
487
- object.rewardSchemeId !== undefined && object.rewardSchemeId !== null
488
- ? long_1.default.fromString(object.rewardSchemeId)
489
- : long_1.default.UZERO;
490
- message.amount =
491
- object.amount !== undefined && object.amount !== null
492
- ? String(object.amount)
493
- : "";
494
- message.denom =
495
- object.denom !== undefined && object.denom !== null
496
- ? String(object.denom)
497
- : "";
498
- return message;
499
- },
500
- toJSON(message) {
501
- const obj = {};
502
- message.creator !== undefined && (obj.creator = message.creator);
503
- message.rewardSchemeId !== undefined &&
504
- (obj.rewardSchemeId = (message.rewardSchemeId || long_1.default.UZERO).toString());
505
- message.amount !== undefined && (obj.amount = message.amount);
506
- message.denom !== undefined && (obj.denom = message.denom);
507
- return obj;
508
- },
509
- fromPartial(object) {
510
- var _a, _b, _c;
511
- const message = Object.assign({}, baseAddReservesParams);
512
- message.creator = (_a = object.creator) !== null && _a !== void 0 ? _a : "";
513
- message.rewardSchemeId =
514
- object.rewardSchemeId !== undefined && object.rewardSchemeId !== null
515
- ? long_1.default.fromValue(object.rewardSchemeId)
516
- : long_1.default.UZERO;
517
- message.amount = (_b = object.amount) !== null && _b !== void 0 ? _b : "";
518
- message.denom = (_c = object.denom) !== null && _c !== void 0 ? _c : "";
519
- return message;
520
- },
521
- };
522
432
  const baseRewardDebt = {
523
433
  userAddress: "",
524
434
  rewardSchemeId: long_1.default.UZERO,
@@ -535,6 +445,9 @@ exports.RewardDebt = {
535
445
  if (message.rewardDebt !== "") {
536
446
  writer.uint32(26).string(message.rewardDebt);
537
447
  }
448
+ if (message.lastUpdatedAt !== undefined) {
449
+ timestamp_1.Timestamp.encode(toTimestamp(message.lastUpdatedAt), writer.uint32(34).fork()).ldelim();
450
+ }
538
451
  return writer;
539
452
  },
540
453
  decode(input, length) {
@@ -553,6 +466,9 @@ exports.RewardDebt = {
553
466
  case 3:
554
467
  message.rewardDebt = reader.string();
555
468
  break;
469
+ case 4:
470
+ message.lastUpdatedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
471
+ break;
556
472
  default:
557
473
  reader.skipType(tag & 7);
558
474
  break;
@@ -574,6 +490,10 @@ exports.RewardDebt = {
574
490
  object.rewardDebt !== undefined && object.rewardDebt !== null
575
491
  ? String(object.rewardDebt)
576
492
  : "";
493
+ message.lastUpdatedAt =
494
+ object.lastUpdatedAt !== undefined && object.lastUpdatedAt !== null
495
+ ? fromJsonTimestamp(object.lastUpdatedAt)
496
+ : undefined;
577
497
  return message;
578
498
  },
579
499
  toJSON(message) {
@@ -583,10 +503,12 @@ exports.RewardDebt = {
583
503
  message.rewardSchemeId !== undefined &&
584
504
  (obj.rewardSchemeId = (message.rewardSchemeId || long_1.default.UZERO).toString());
585
505
  message.rewardDebt !== undefined && (obj.rewardDebt = message.rewardDebt);
506
+ message.lastUpdatedAt !== undefined &&
507
+ (obj.lastUpdatedAt = message.lastUpdatedAt.toISOString());
586
508
  return obj;
587
509
  },
588
510
  fromPartial(object) {
589
- var _a, _b;
511
+ var _a, _b, _c;
590
512
  const message = Object.assign({}, baseRewardDebt);
591
513
  message.userAddress = (_a = object.userAddress) !== null && _a !== void 0 ? _a : "";
592
514
  message.rewardSchemeId =
@@ -594,6 +516,7 @@ exports.RewardDebt = {
594
516
  ? long_1.default.fromValue(object.rewardSchemeId)
595
517
  : long_1.default.UZERO;
596
518
  message.rewardDebt = (_b = object.rewardDebt) !== null && _b !== void 0 ? _b : "";
519
+ message.lastUpdatedAt = (_c = object.lastUpdatedAt) !== null && _c !== void 0 ? _c : undefined;
597
520
  return message;
598
521
  },
599
522
  };
@@ -0,0 +1,22 @@
1
+ import Long from "long";
2
+ import _m0 from "protobufjs/minimal";
3
+ import { Duration } from "../google/protobuf/duration";
4
+ export declare const protobufPackage = "Switcheo.carbon.pricing";
5
+ /** Legacy Params from v.2.13.0. */
6
+ export interface ParamsV2130 {
7
+ smoothenBand: number;
8
+ impactBand: number;
9
+ staleIndexAllowance?: Duration;
10
+ }
11
+ export declare const ParamsV2130: {
12
+ encode(message: ParamsV2130, writer?: _m0.Writer): _m0.Writer;
13
+ decode(input: _m0.Reader | Uint8Array, length?: number | undefined): ParamsV2130;
14
+ fromJSON(object: any): ParamsV2130;
15
+ toJSON(message: ParamsV2130): unknown;
16
+ fromPartial(object: DeepPartial<ParamsV2130>): ParamsV2130;
17
+ };
18
+ declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
19
+ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
20
+ [K in keyof T]?: DeepPartial<T[K]>;
21
+ } : Partial<T>;
22
+ export {};
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ParamsV2130 = exports.protobufPackage = void 0;
7
+ /* eslint-disable */
8
+ const long_1 = __importDefault(require("long"));
9
+ const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
+ const duration_1 = require("../google/protobuf/duration");
11
+ exports.protobufPackage = "Switcheo.carbon.pricing";
12
+ const baseParamsV2130 = { smoothenBand: 0, impactBand: 0 };
13
+ exports.ParamsV2130 = {
14
+ encode(message, writer = minimal_1.default.Writer.create()) {
15
+ if (message.smoothenBand !== 0) {
16
+ writer.uint32(8).uint32(message.smoothenBand);
17
+ }
18
+ if (message.impactBand !== 0) {
19
+ writer.uint32(16).uint32(message.impactBand);
20
+ }
21
+ if (message.staleIndexAllowance !== undefined) {
22
+ duration_1.Duration.encode(message.staleIndexAllowance, writer.uint32(26).fork()).ldelim();
23
+ }
24
+ return writer;
25
+ },
26
+ decode(input, length) {
27
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
28
+ let end = length === undefined ? reader.len : reader.pos + length;
29
+ const message = Object.assign({}, baseParamsV2130);
30
+ while (reader.pos < end) {
31
+ const tag = reader.uint32();
32
+ switch (tag >>> 3) {
33
+ case 1:
34
+ message.smoothenBand = reader.uint32();
35
+ break;
36
+ case 2:
37
+ message.impactBand = reader.uint32();
38
+ break;
39
+ case 3:
40
+ message.staleIndexAllowance = duration_1.Duration.decode(reader, reader.uint32());
41
+ break;
42
+ default:
43
+ reader.skipType(tag & 7);
44
+ break;
45
+ }
46
+ }
47
+ return message;
48
+ },
49
+ fromJSON(object) {
50
+ const message = Object.assign({}, baseParamsV2130);
51
+ message.smoothenBand =
52
+ object.smoothenBand !== undefined && object.smoothenBand !== null
53
+ ? Number(object.smoothenBand)
54
+ : 0;
55
+ message.impactBand =
56
+ object.impactBand !== undefined && object.impactBand !== null
57
+ ? Number(object.impactBand)
58
+ : 0;
59
+ message.staleIndexAllowance =
60
+ object.staleIndexAllowance !== undefined &&
61
+ object.staleIndexAllowance !== null
62
+ ? duration_1.Duration.fromJSON(object.staleIndexAllowance)
63
+ : undefined;
64
+ return message;
65
+ },
66
+ toJSON(message) {
67
+ const obj = {};
68
+ message.smoothenBand !== undefined &&
69
+ (obj.smoothenBand = message.smoothenBand);
70
+ message.impactBand !== undefined && (obj.impactBand = message.impactBand);
71
+ message.staleIndexAllowance !== undefined &&
72
+ (obj.staleIndexAllowance = message.staleIndexAllowance
73
+ ? duration_1.Duration.toJSON(message.staleIndexAllowance)
74
+ : undefined);
75
+ return obj;
76
+ },
77
+ fromPartial(object) {
78
+ var _a, _b;
79
+ const message = Object.assign({}, baseParamsV2130);
80
+ message.smoothenBand = (_a = object.smoothenBand) !== null && _a !== void 0 ? _a : 0;
81
+ message.impactBand = (_b = object.impactBand) !== null && _b !== void 0 ? _b : 0;
82
+ message.staleIndexAllowance =
83
+ object.staleIndexAllowance !== undefined &&
84
+ object.staleIndexAllowance !== null
85
+ ? duration_1.Duration.fromPartial(object.staleIndexAllowance)
86
+ : undefined;
87
+ return message;
88
+ },
89
+ };
90
+ if (minimal_1.default.util.Long !== long_1.default) {
91
+ minimal_1.default.util.Long = long_1.default;
92
+ minimal_1.default.configure();
93
+ }
@@ -24,6 +24,10 @@ class KeplrAccount {
24
24
  const signOpts = { preferNoSetFee: true };
25
25
  return yield keplr.signDirect(chainInfo.chainId, signerAddress, doc, signOpts);
26
26
  });
27
+ const signAmino = (signerAddress, doc) => __awaiter(this, void 0, void 0, function* () {
28
+ const signOpts = { preferNoSetFee: true };
29
+ return yield keplr.signAmino(chainInfo.chainId, signerAddress, doc, signOpts);
30
+ });
27
31
  const getAccounts = () => __awaiter(this, void 0, void 0, function* () {
28
32
  return [{
29
33
  algo: 'secp256k1',
@@ -34,6 +38,7 @@ class KeplrAccount {
34
38
  return {
35
39
  type: wallet_1.CarbonSignerTypes.BrowserInjected,
36
40
  signDirect,
41
+ signAmino,
37
42
  getAccounts,
38
43
  };
39
44
  }
package/lib/util/tx.d.ts CHANGED
@@ -3,6 +3,7 @@ import * as CosmosModels from "../codec/cosmos-models";
3
3
  import { StdFee } from "@cosmjs/amino";
4
4
  import { SignerData } from "@cosmjs/stargate";
5
5
  import { SWTHAddressOptions } from "./address";
6
+ export { StdSignDoc } from "@cosmjs/amino";
6
7
  export interface TxBody extends Omit<CosmosModels.Tx.TxBody, "messages"> {
7
8
  messages: unknown[];
8
9
  }
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { SignDoc } from '../codec/cosmos/tx/v1beta1/tx';
3
3
  import { CosmosLedger } from '../provider';
4
- import { AminoSignResponse, OfflineAminoSigner, StdSignDoc } from "@cosmjs/amino";
4
+ import { AminoSignResponse, OfflineAminoSigner, Secp256k1Wallet, StdSignDoc } from "@cosmjs/amino";
5
5
  import { AccountData, DirectSecp256k1Wallet, DirectSignResponse, OfflineDirectSigner } from '@cosmjs/proto-signing';
6
6
  export declare enum CarbonSignerTypes {
7
7
  Ledger = 0,
@@ -16,14 +16,17 @@ export declare type DirectCarbonSigner = OfflineDirectSigner & {
16
16
  export declare type AminoCarbonSigner = OfflineAminoSigner & {
17
17
  type: CarbonSignerTypes;
18
18
  };
19
- export declare class CarbonPrivateKeySigner implements DirectCarbonSigner {
19
+ export declare class CarbonPrivateKeySigner implements DirectCarbonSigner, AminoCarbonSigner {
20
20
  readonly privateKey: Buffer;
21
21
  readonly prefix: string;
22
22
  type: CarbonSignerTypes;
23
23
  wallet?: DirectSecp256k1Wallet;
24
+ aminoWallet?: Secp256k1Wallet;
24
25
  constructor(privateKey: Buffer, prefix: string);
25
26
  initWallet(): Promise<DirectSecp256k1Wallet>;
27
+ initAminoWallet(): Promise<Secp256k1Wallet>;
26
28
  getAccounts(): Promise<readonly AccountData[]>;
29
+ signAmino(signerAddress: string, signDoc: StdSignDoc): Promise<AminoSignResponse>;
27
30
  signDirect(signerAddress: string, signDoc: SignDoc): Promise<DirectSignResponse>;
28
31
  }
29
32
  export declare class CarbonNonSigner implements DirectCarbonSigner {
@@ -33,12 +33,25 @@ class CarbonPrivateKeySigner {
33
33
  return this.wallet;
34
34
  });
35
35
  }
36
+ initAminoWallet() {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ if (!this.aminoWallet)
39
+ this.aminoWallet = yield amino_1.Secp256k1Wallet.fromKey(this.privateKey, this.prefix);
40
+ return this.aminoWallet;
41
+ });
42
+ }
36
43
  getAccounts() {
37
44
  return __awaiter(this, void 0, void 0, function* () {
38
45
  const wallet = yield this.initWallet();
39
46
  return wallet.getAccounts();
40
47
  });
41
48
  }
49
+ signAmino(signerAddress, signDoc) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const aminoWallet = yield this.initAminoWallet();
52
+ return yield aminoWallet.signAmino(signerAddress, signDoc);
53
+ });
54
+ }
42
55
  signDirect(signerAddress, signDoc) {
43
56
  return __awaiter(this, void 0, void 0, function* () {
44
57
  const wallet = yield this.initWallet();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",