carbon-js-sdk 0.3.43-dev.3 → 0.3.44

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 (41) hide show
  1. package/lib/CarbonSDK.js +2 -2
  2. package/lib/codec/broker/amm.d.ts +1 -1
  3. package/lib/codec/broker/amm.js +18 -16
  4. package/lib/codec/index.d.ts +12 -15
  5. package/lib/codec/index.js +37 -56
  6. package/lib/codec/liquiditypool/event.d.ts +0 -14
  7. package/lib/codec/liquiditypool/event.js +1 -107
  8. package/lib/codec/liquiditypool/genesis.d.ts +1 -2
  9. package/lib/codec/liquiditypool/genesis.js +2 -17
  10. package/lib/codec/liquiditypool/liquiditypool.d.ts +0 -40
  11. package/lib/codec/liquiditypool/liquiditypool.js +2 -320
  12. package/lib/codec/liquiditypool/proposal.d.ts +25 -37
  13. package/lib/codec/liquiditypool/proposal.js +61 -139
  14. package/lib/codec/liquiditypool/query.d.ts +24 -85
  15. package/lib/codec/liquiditypool/query.js +23 -338
  16. package/lib/codec/liquiditypool/tx.d.ts +67 -101
  17. package/lib/codec/liquiditypool/tx.js +597 -817
  18. package/lib/codec/order/order.d.ts +0 -1
  19. package/lib/codec/order/order.js +1 -45
  20. package/lib/modules/admin.d.ts +2 -0
  21. package/lib/modules/admin.js +26 -0
  22. package/lib/modules/coin.d.ts +0 -19
  23. package/lib/modules/coin.js +0 -39
  24. package/lib/modules/gov.js +14 -0
  25. package/lib/modules/liquiditypool.d.ts +2 -11
  26. package/lib/modules/liquiditypool.js +2 -33
  27. package/lib/modules/market.d.ts +0 -11
  28. package/lib/modules/market.js +0 -19
  29. package/lib/provider/amino/types/admin.js +4 -0
  30. package/lib/provider/amino/types/coin.js +2 -2
  31. package/lib/provider/amino/types/gov.js +36 -0
  32. package/lib/provider/amino/types/liquidityPool.js +2 -0
  33. package/lib/provider/keplr/KeplrAccount.d.ts +2 -0
  34. package/lib/provider/keplr/KeplrAccount.js +37 -8
  35. package/lib/util/blockchain.js +10 -0
  36. package/lib/util/gov.d.ts +2 -0
  37. package/lib/util/gov.js +6 -0
  38. package/lib/util/tx.d.ts +6 -9
  39. package/lib/wallet/CarbonWallet.js +2 -2
  40. package/lib/websocket/models.d.ts +2 -7
  41. package/package.json +1 -1
@@ -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.SwapEvent = exports.CommitmentEvent = exports.CommitmentCurveEvent = exports.RewardsWeightChangeEvent = exports.TotalCommitmentChangeEvent = exports.PoolEvent = exports.protobufPackage = void 0;
6
+ exports.CommitmentEvent = exports.CommitmentCurveEvent = exports.RewardsWeightChangeEvent = exports.TotalCommitmentChangeEvent = exports.PoolEvent = 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"));
@@ -392,112 +392,6 @@ exports.CommitmentEvent = {
392
392
  return message;
393
393
  },
394
394
  };
395
- const baseSwapEvent = {
396
- poolId: long_1.default.UZERO,
397
- inputDenom: "",
398
- inputAmount: "",
399
- outputDenom: "",
400
- outputAmount: "",
401
- };
402
- exports.SwapEvent = {
403
- encode(message, writer = minimal_1.default.Writer.create()) {
404
- if (!message.poolId.isZero()) {
405
- writer.uint32(8).uint64(message.poolId);
406
- }
407
- if (message.inputDenom !== "") {
408
- writer.uint32(18).string(message.inputDenom);
409
- }
410
- if (message.inputAmount !== "") {
411
- writer.uint32(26).string(message.inputAmount);
412
- }
413
- if (message.outputDenom !== "") {
414
- writer.uint32(34).string(message.outputDenom);
415
- }
416
- if (message.outputAmount !== "") {
417
- writer.uint32(42).string(message.outputAmount);
418
- }
419
- return writer;
420
- },
421
- decode(input, length) {
422
- const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
423
- let end = length === undefined ? reader.len : reader.pos + length;
424
- const message = Object.assign({}, baseSwapEvent);
425
- while (reader.pos < end) {
426
- const tag = reader.uint32();
427
- switch (tag >>> 3) {
428
- case 1:
429
- message.poolId = reader.uint64();
430
- break;
431
- case 2:
432
- message.inputDenom = reader.string();
433
- break;
434
- case 3:
435
- message.inputAmount = reader.string();
436
- break;
437
- case 4:
438
- message.outputDenom = reader.string();
439
- break;
440
- case 5:
441
- message.outputAmount = reader.string();
442
- break;
443
- default:
444
- reader.skipType(tag & 7);
445
- break;
446
- }
447
- }
448
- return message;
449
- },
450
- fromJSON(object) {
451
- const message = Object.assign({}, baseSwapEvent);
452
- message.poolId =
453
- object.poolId !== undefined && object.poolId !== null
454
- ? long_1.default.fromString(object.poolId)
455
- : long_1.default.UZERO;
456
- message.inputDenom =
457
- object.inputDenom !== undefined && object.inputDenom !== null
458
- ? String(object.inputDenom)
459
- : "";
460
- message.inputAmount =
461
- object.inputAmount !== undefined && object.inputAmount !== null
462
- ? String(object.inputAmount)
463
- : "";
464
- message.outputDenom =
465
- object.outputDenom !== undefined && object.outputDenom !== null
466
- ? String(object.outputDenom)
467
- : "";
468
- message.outputAmount =
469
- object.outputAmount !== undefined && object.outputAmount !== null
470
- ? String(object.outputAmount)
471
- : "";
472
- return message;
473
- },
474
- toJSON(message) {
475
- const obj = {};
476
- message.poolId !== undefined &&
477
- (obj.poolId = (message.poolId || long_1.default.UZERO).toString());
478
- message.inputDenom !== undefined && (obj.inputDenom = message.inputDenom);
479
- message.inputAmount !== undefined &&
480
- (obj.inputAmount = message.inputAmount);
481
- message.outputDenom !== undefined &&
482
- (obj.outputDenom = message.outputDenom);
483
- message.outputAmount !== undefined &&
484
- (obj.outputAmount = message.outputAmount);
485
- return obj;
486
- },
487
- fromPartial(object) {
488
- var _a, _b, _c, _d;
489
- const message = Object.assign({}, baseSwapEvent);
490
- message.poolId =
491
- object.poolId !== undefined && object.poolId !== null
492
- ? long_1.default.fromValue(object.poolId)
493
- : long_1.default.UZERO;
494
- message.inputDenom = (_a = object.inputDenom) !== null && _a !== void 0 ? _a : "";
495
- message.inputAmount = (_b = object.inputAmount) !== null && _b !== void 0 ? _b : "";
496
- message.outputDenom = (_c = object.outputDenom) !== null && _c !== void 0 ? _c : "";
497
- message.outputAmount = (_d = object.outputAmount) !== null && _d !== void 0 ? _d : "";
498
- return message;
499
- },
500
- };
501
395
  if (minimal_1.default.util.Long !== long_1.default) {
502
396
  minimal_1.default.util.Long = long_1.default;
503
397
  minimal_1.default.configure();
@@ -1,7 +1,7 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
3
  import { RewardCurve, CommitmentCurve, RewardWeights, AllocatedRewards, CommitmentRecord, TotalCommitmentRecord, CommitmentExpiriesRecord, RewardHistoryRecord, LastClaimRecord } from "./reward";
4
- import { Params, Pool, PoolRoute } from "./liquiditypool";
4
+ import { Params, Pool } from "./liquiditypool";
5
5
  export declare const protobufPackage = "Switcheo.carbon.liquiditypool";
6
6
  /** GenesisState defines the liquiditypool module's genesis state. */
7
7
  export interface GenesisState {
@@ -17,7 +17,6 @@ export interface GenesisState {
17
17
  allocatedRewards?: AllocatedRewards;
18
18
  /** params defines all the paramaters of the module. */
19
19
  params?: Params;
20
- poolRoutes: PoolRoute[];
21
20
  }
22
21
  export declare const GenesisState: {
23
22
  encode(message: GenesisState, writer?: _m0.Writer): _m0.Writer;
@@ -46,9 +46,6 @@ exports.GenesisState = {
46
46
  if (message.params !== undefined) {
47
47
  liquiditypool_1.Params.encode(message.params, writer.uint32(90).fork()).ldelim();
48
48
  }
49
- for (const v of message.poolRoutes) {
50
- liquiditypool_1.PoolRoute.encode(v, writer.uint32(98).fork()).ldelim();
51
- }
52
49
  return writer;
53
50
  },
54
51
  decode(input, length) {
@@ -61,7 +58,6 @@ exports.GenesisState = {
61
58
  message.commitmentExpiries = [];
62
59
  message.rewardHistories = [];
63
60
  message.lastClaims = [];
64
- message.poolRoutes = [];
65
61
  while (reader.pos < end) {
66
62
  const tag = reader.uint32();
67
63
  switch (tag >>> 3) {
@@ -98,9 +94,6 @@ exports.GenesisState = {
98
94
  case 11:
99
95
  message.params = liquiditypool_1.Params.decode(reader, reader.uint32());
100
96
  break;
101
- case 12:
102
- message.poolRoutes.push(liquiditypool_1.PoolRoute.decode(reader, reader.uint32()));
103
- break;
104
97
  default:
105
98
  reader.skipType(tag & 7);
106
99
  break;
@@ -109,7 +102,7 @@ exports.GenesisState = {
109
102
  return message;
110
103
  },
111
104
  fromJSON(object) {
112
- var _a, _b, _c, _d, _e, _f, _g;
105
+ var _a, _b, _c, _d, _e, _f;
113
106
  const message = Object.assign({}, baseGenesisState);
114
107
  message.pools = ((_a = object.pools) !== null && _a !== void 0 ? _a : []).map((e) => liquiditypool_1.Pool.fromJSON(e));
115
108
  message.rewardCurve =
@@ -137,7 +130,6 @@ exports.GenesisState = {
137
130
  object.params !== undefined && object.params !== null
138
131
  ? liquiditypool_1.Params.fromJSON(object.params)
139
132
  : undefined;
140
- message.poolRoutes = ((_g = object.poolRoutes) !== null && _g !== void 0 ? _g : []).map((e) => liquiditypool_1.PoolRoute.fromJSON(e));
141
133
  return message;
142
134
  },
143
135
  toJSON(message) {
@@ -196,16 +188,10 @@ exports.GenesisState = {
196
188
  : undefined);
197
189
  message.params !== undefined &&
198
190
  (obj.params = message.params ? liquiditypool_1.Params.toJSON(message.params) : undefined);
199
- if (message.poolRoutes) {
200
- obj.poolRoutes = message.poolRoutes.map((e) => e ? liquiditypool_1.PoolRoute.toJSON(e) : undefined);
201
- }
202
- else {
203
- obj.poolRoutes = [];
204
- }
205
191
  return obj;
206
192
  },
207
193
  fromPartial(object) {
208
- var _a, _b, _c, _d, _e, _f, _g;
194
+ var _a, _b, _c, _d, _e, _f;
209
195
  const message = Object.assign({}, baseGenesisState);
210
196
  message.pools = ((_a = object.pools) !== null && _a !== void 0 ? _a : []).map((e) => liquiditypool_1.Pool.fromPartial(e));
211
197
  message.rewardCurve =
@@ -233,7 +219,6 @@ exports.GenesisState = {
233
219
  object.params !== undefined && object.params !== null
234
220
  ? liquiditypool_1.Params.fromPartial(object.params)
235
221
  : undefined;
236
- message.poolRoutes = ((_g = object.poolRoutes) !== null && _g !== void 0 ? _g : []).map((e) => liquiditypool_1.PoolRoute.fromPartial(e));
237
222
  return message;
238
223
  },
239
224
  };
@@ -4,7 +4,6 @@ export declare const protobufPackage = "Switcheo.carbon.liquiditypool";
4
4
  /** Params defines the parameters for the liquiditypool module. */
5
5
  export interface Params {
6
6
  rewardReductionThreshold: Long;
7
- numQuotes: Long;
8
7
  }
9
8
  export interface Pool {
10
9
  creator: string;
@@ -20,7 +19,6 @@ export interface Pool {
20
19
  swapFee: string;
21
20
  numQuotes: Long;
22
21
  sharesAmount: string;
23
- /** deprecated to use pool routes */
24
22
  market: string;
25
23
  ampBps: Long;
26
24
  vAmountA: string;
@@ -29,11 +27,6 @@ export interface Pool {
29
27
  export interface Pools {
30
28
  pools: Pool[];
31
29
  }
32
- export interface PoolRoute {
33
- market: string;
34
- poolIds: Long[];
35
- numQuotes: Long;
36
- }
37
30
  export interface AddLiquidity {
38
31
  creator: string;
39
32
  id: Long;
@@ -52,18 +45,6 @@ export interface RemoveLiquidity {
52
45
  export interface RemoveLiquidities {
53
46
  removeLiquidities: RemoveLiquidity[];
54
47
  }
55
- export interface RemovePoolRoutes {
56
- removePoolRoutes: Uint8Array[];
57
- }
58
- export interface PoolReserve {
59
- id: Long;
60
- amountA: string;
61
- weightA: string;
62
- amountB: string;
63
- weightB: string;
64
- vAmountA: string;
65
- vAmountB: string;
66
- }
67
48
  export declare const Params: {
68
49
  encode(message: Params, writer?: _m0.Writer): _m0.Writer;
69
50
  decode(input: _m0.Reader | Uint8Array, length?: number | undefined): Params;
@@ -85,13 +66,6 @@ export declare const Pools: {
85
66
  toJSON(message: Pools): unknown;
86
67
  fromPartial(object: DeepPartial<Pools>): Pools;
87
68
  };
88
- export declare const PoolRoute: {
89
- encode(message: PoolRoute, writer?: _m0.Writer): _m0.Writer;
90
- decode(input: _m0.Reader | Uint8Array, length?: number | undefined): PoolRoute;
91
- fromJSON(object: any): PoolRoute;
92
- toJSON(message: PoolRoute): unknown;
93
- fromPartial(object: DeepPartial<PoolRoute>): PoolRoute;
94
- };
95
69
  export declare const AddLiquidity: {
96
70
  encode(message: AddLiquidity, writer?: _m0.Writer): _m0.Writer;
97
71
  decode(input: _m0.Reader | Uint8Array, length?: number | undefined): AddLiquidity;
@@ -120,20 +94,6 @@ export declare const RemoveLiquidities: {
120
94
  toJSON(message: RemoveLiquidities): unknown;
121
95
  fromPartial(object: DeepPartial<RemoveLiquidities>): RemoveLiquidities;
122
96
  };
123
- export declare const RemovePoolRoutes: {
124
- encode(message: RemovePoolRoutes, writer?: _m0.Writer): _m0.Writer;
125
- decode(input: _m0.Reader | Uint8Array, length?: number | undefined): RemovePoolRoutes;
126
- fromJSON(object: any): RemovePoolRoutes;
127
- toJSON(message: RemovePoolRoutes): unknown;
128
- fromPartial(object: DeepPartial<RemovePoolRoutes>): RemovePoolRoutes;
129
- };
130
- export declare const PoolReserve: {
131
- encode(message: PoolReserve, writer?: _m0.Writer): _m0.Writer;
132
- decode(input: _m0.Reader | Uint8Array, length?: number | undefined): PoolReserve;
133
- fromJSON(object: any): PoolReserve;
134
- toJSON(message: PoolReserve): unknown;
135
- fromPartial(object: DeepPartial<PoolReserve>): PoolReserve;
136
- };
137
97
  declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
138
98
  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 {} ? {
139
99
  [K in keyof T]?: DeepPartial<T[K]>;
@@ -3,23 +3,17 @@ 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.PoolReserve = exports.RemovePoolRoutes = exports.RemoveLiquidities = exports.RemoveLiquidity = exports.AddLiquidities = exports.AddLiquidity = exports.PoolRoute = exports.Pools = exports.Pool = exports.Params = exports.protobufPackage = void 0;
6
+ exports.RemoveLiquidities = exports.RemoveLiquidity = exports.AddLiquidities = exports.AddLiquidity = exports.Pools = exports.Pool = exports.Params = 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"));
10
10
  exports.protobufPackage = "Switcheo.carbon.liquiditypool";
11
- const baseParams = {
12
- rewardReductionThreshold: long_1.default.UZERO,
13
- numQuotes: long_1.default.UZERO,
14
- };
11
+ const baseParams = { rewardReductionThreshold: long_1.default.UZERO };
15
12
  exports.Params = {
16
13
  encode(message, writer = minimal_1.default.Writer.create()) {
17
14
  if (!message.rewardReductionThreshold.isZero()) {
18
15
  writer.uint32(8).uint64(message.rewardReductionThreshold);
19
16
  }
20
- if (!message.numQuotes.isZero()) {
21
- writer.uint32(16).uint64(message.numQuotes);
22
- }
23
17
  return writer;
24
18
  },
25
19
  decode(input, length) {
@@ -32,9 +26,6 @@ exports.Params = {
32
26
  case 1:
33
27
  message.rewardReductionThreshold = reader.uint64();
34
28
  break;
35
- case 2:
36
- message.numQuotes = reader.uint64();
37
- break;
38
29
  default:
39
30
  reader.skipType(tag & 7);
40
31
  break;
@@ -49,18 +40,12 @@ exports.Params = {
49
40
  object.rewardReductionThreshold !== null
50
41
  ? long_1.default.fromString(object.rewardReductionThreshold)
51
42
  : long_1.default.UZERO;
52
- message.numQuotes =
53
- object.numQuotes !== undefined && object.numQuotes !== null
54
- ? long_1.default.fromString(object.numQuotes)
55
- : long_1.default.UZERO;
56
43
  return message;
57
44
  },
58
45
  toJSON(message) {
59
46
  const obj = {};
60
47
  message.rewardReductionThreshold !== undefined &&
61
48
  (obj.rewardReductionThreshold = (message.rewardReductionThreshold || long_1.default.UZERO).toString());
62
- message.numQuotes !== undefined &&
63
- (obj.numQuotes = (message.numQuotes || long_1.default.UZERO).toString());
64
49
  return obj;
65
50
  },
66
51
  fromPartial(object) {
@@ -70,10 +55,6 @@ exports.Params = {
70
55
  object.rewardReductionThreshold !== null
71
56
  ? long_1.default.fromValue(object.rewardReductionThreshold)
72
57
  : long_1.default.UZERO;
73
- message.numQuotes =
74
- object.numQuotes !== undefined && object.numQuotes !== null
75
- ? long_1.default.fromValue(object.numQuotes)
76
- : long_1.default.UZERO;
77
58
  return message;
78
59
  },
79
60
  };
@@ -394,97 +375,6 @@ exports.Pools = {
394
375
  return message;
395
376
  },
396
377
  };
397
- const basePoolRoute = {
398
- market: "",
399
- poolIds: long_1.default.UZERO,
400
- numQuotes: long_1.default.ZERO,
401
- };
402
- exports.PoolRoute = {
403
- encode(message, writer = minimal_1.default.Writer.create()) {
404
- if (message.market !== "") {
405
- writer.uint32(10).string(message.market);
406
- }
407
- writer.uint32(18).fork();
408
- for (const v of message.poolIds) {
409
- writer.uint64(v);
410
- }
411
- writer.ldelim();
412
- if (!message.numQuotes.isZero()) {
413
- writer.uint32(24).int64(message.numQuotes);
414
- }
415
- return writer;
416
- },
417
- decode(input, length) {
418
- const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
419
- let end = length === undefined ? reader.len : reader.pos + length;
420
- const message = Object.assign({}, basePoolRoute);
421
- message.poolIds = [];
422
- while (reader.pos < end) {
423
- const tag = reader.uint32();
424
- switch (tag >>> 3) {
425
- case 1:
426
- message.market = reader.string();
427
- break;
428
- case 2:
429
- if ((tag & 7) === 2) {
430
- const end2 = reader.uint32() + reader.pos;
431
- while (reader.pos < end2) {
432
- message.poolIds.push(reader.uint64());
433
- }
434
- }
435
- else {
436
- message.poolIds.push(reader.uint64());
437
- }
438
- break;
439
- case 3:
440
- message.numQuotes = reader.int64();
441
- break;
442
- default:
443
- reader.skipType(tag & 7);
444
- break;
445
- }
446
- }
447
- return message;
448
- },
449
- fromJSON(object) {
450
- var _a;
451
- const message = Object.assign({}, basePoolRoute);
452
- message.market =
453
- object.market !== undefined && object.market !== null
454
- ? String(object.market)
455
- : "";
456
- message.poolIds = ((_a = object.poolIds) !== null && _a !== void 0 ? _a : []).map((e) => long_1.default.fromString(e));
457
- message.numQuotes =
458
- object.numQuotes !== undefined && object.numQuotes !== null
459
- ? long_1.default.fromString(object.numQuotes)
460
- : long_1.default.ZERO;
461
- return message;
462
- },
463
- toJSON(message) {
464
- const obj = {};
465
- message.market !== undefined && (obj.market = message.market);
466
- if (message.poolIds) {
467
- obj.poolIds = message.poolIds.map((e) => (e || long_1.default.UZERO).toString());
468
- }
469
- else {
470
- obj.poolIds = [];
471
- }
472
- message.numQuotes !== undefined &&
473
- (obj.numQuotes = (message.numQuotes || long_1.default.ZERO).toString());
474
- return obj;
475
- },
476
- fromPartial(object) {
477
- var _a, _b;
478
- const message = Object.assign({}, basePoolRoute);
479
- message.market = (_a = object.market) !== null && _a !== void 0 ? _a : "";
480
- message.poolIds = ((_b = object.poolIds) !== null && _b !== void 0 ? _b : []).map((e) => long_1.default.fromValue(e));
481
- message.numQuotes =
482
- object.numQuotes !== undefined && object.numQuotes !== null
483
- ? long_1.default.fromValue(object.numQuotes)
484
- : long_1.default.ZERO;
485
- return message;
486
- },
487
- };
488
378
  const baseAddLiquidity = {
489
379
  creator: "",
490
380
  id: long_1.default.UZERO,
@@ -759,214 +649,6 @@ exports.RemoveLiquidities = {
759
649
  return message;
760
650
  },
761
651
  };
762
- const baseRemovePoolRoutes = {};
763
- exports.RemovePoolRoutes = {
764
- encode(message, writer = minimal_1.default.Writer.create()) {
765
- for (const v of message.removePoolRoutes) {
766
- writer.uint32(10).bytes(v);
767
- }
768
- return writer;
769
- },
770
- decode(input, length) {
771
- const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
772
- let end = length === undefined ? reader.len : reader.pos + length;
773
- const message = Object.assign({}, baseRemovePoolRoutes);
774
- message.removePoolRoutes = [];
775
- while (reader.pos < end) {
776
- const tag = reader.uint32();
777
- switch (tag >>> 3) {
778
- case 1:
779
- message.removePoolRoutes.push(reader.bytes());
780
- break;
781
- default:
782
- reader.skipType(tag & 7);
783
- break;
784
- }
785
- }
786
- return message;
787
- },
788
- fromJSON(object) {
789
- var _a;
790
- const message = Object.assign({}, baseRemovePoolRoutes);
791
- message.removePoolRoutes = ((_a = object.removePoolRoutes) !== null && _a !== void 0 ? _a : []).map((e) => bytesFromBase64(e));
792
- return message;
793
- },
794
- toJSON(message) {
795
- const obj = {};
796
- if (message.removePoolRoutes) {
797
- obj.removePoolRoutes = message.removePoolRoutes.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array()));
798
- }
799
- else {
800
- obj.removePoolRoutes = [];
801
- }
802
- return obj;
803
- },
804
- fromPartial(object) {
805
- var _a;
806
- const message = Object.assign({}, baseRemovePoolRoutes);
807
- message.removePoolRoutes = ((_a = object.removePoolRoutes) !== null && _a !== void 0 ? _a : []).map((e) => e);
808
- return message;
809
- },
810
- };
811
- const basePoolReserve = {
812
- id: long_1.default.UZERO,
813
- amountA: "",
814
- weightA: "",
815
- amountB: "",
816
- weightB: "",
817
- vAmountA: "",
818
- vAmountB: "",
819
- };
820
- exports.PoolReserve = {
821
- encode(message, writer = minimal_1.default.Writer.create()) {
822
- if (!message.id.isZero()) {
823
- writer.uint32(8).uint64(message.id);
824
- }
825
- if (message.amountA !== "") {
826
- writer.uint32(18).string(message.amountA);
827
- }
828
- if (message.weightA !== "") {
829
- writer.uint32(26).string(message.weightA);
830
- }
831
- if (message.amountB !== "") {
832
- writer.uint32(34).string(message.amountB);
833
- }
834
- if (message.weightB !== "") {
835
- writer.uint32(42).string(message.weightB);
836
- }
837
- if (message.vAmountA !== "") {
838
- writer.uint32(50).string(message.vAmountA);
839
- }
840
- if (message.vAmountB !== "") {
841
- writer.uint32(58).string(message.vAmountB);
842
- }
843
- return writer;
844
- },
845
- decode(input, length) {
846
- const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
847
- let end = length === undefined ? reader.len : reader.pos + length;
848
- const message = Object.assign({}, basePoolReserve);
849
- while (reader.pos < end) {
850
- const tag = reader.uint32();
851
- switch (tag >>> 3) {
852
- case 1:
853
- message.id = reader.uint64();
854
- break;
855
- case 2:
856
- message.amountA = reader.string();
857
- break;
858
- case 3:
859
- message.weightA = reader.string();
860
- break;
861
- case 4:
862
- message.amountB = reader.string();
863
- break;
864
- case 5:
865
- message.weightB = reader.string();
866
- break;
867
- case 6:
868
- message.vAmountA = reader.string();
869
- break;
870
- case 7:
871
- message.vAmountB = reader.string();
872
- break;
873
- default:
874
- reader.skipType(tag & 7);
875
- break;
876
- }
877
- }
878
- return message;
879
- },
880
- fromJSON(object) {
881
- const message = Object.assign({}, basePoolReserve);
882
- message.id =
883
- object.id !== undefined && object.id !== null
884
- ? long_1.default.fromString(object.id)
885
- : long_1.default.UZERO;
886
- message.amountA =
887
- object.amountA !== undefined && object.amountA !== null
888
- ? String(object.amountA)
889
- : "";
890
- message.weightA =
891
- object.weightA !== undefined && object.weightA !== null
892
- ? String(object.weightA)
893
- : "";
894
- message.amountB =
895
- object.amountB !== undefined && object.amountB !== null
896
- ? String(object.amountB)
897
- : "";
898
- message.weightB =
899
- object.weightB !== undefined && object.weightB !== null
900
- ? String(object.weightB)
901
- : "";
902
- message.vAmountA =
903
- object.vAmountA !== undefined && object.vAmountA !== null
904
- ? String(object.vAmountA)
905
- : "";
906
- message.vAmountB =
907
- object.vAmountB !== undefined && object.vAmountB !== null
908
- ? String(object.vAmountB)
909
- : "";
910
- return message;
911
- },
912
- toJSON(message) {
913
- const obj = {};
914
- message.id !== undefined &&
915
- (obj.id = (message.id || long_1.default.UZERO).toString());
916
- message.amountA !== undefined && (obj.amountA = message.amountA);
917
- message.weightA !== undefined && (obj.weightA = message.weightA);
918
- message.amountB !== undefined && (obj.amountB = message.amountB);
919
- message.weightB !== undefined && (obj.weightB = message.weightB);
920
- message.vAmountA !== undefined && (obj.vAmountA = message.vAmountA);
921
- message.vAmountB !== undefined && (obj.vAmountB = message.vAmountB);
922
- return obj;
923
- },
924
- fromPartial(object) {
925
- var _a, _b, _c, _d, _e, _f;
926
- const message = Object.assign({}, basePoolReserve);
927
- message.id =
928
- object.id !== undefined && object.id !== null
929
- ? long_1.default.fromValue(object.id)
930
- : long_1.default.UZERO;
931
- message.amountA = (_a = object.amountA) !== null && _a !== void 0 ? _a : "";
932
- message.weightA = (_b = object.weightA) !== null && _b !== void 0 ? _b : "";
933
- message.amountB = (_c = object.amountB) !== null && _c !== void 0 ? _c : "";
934
- message.weightB = (_d = object.weightB) !== null && _d !== void 0 ? _d : "";
935
- message.vAmountA = (_e = object.vAmountA) !== null && _e !== void 0 ? _e : "";
936
- message.vAmountB = (_f = object.vAmountB) !== null && _f !== void 0 ? _f : "";
937
- return message;
938
- },
939
- };
940
- var globalThis = (() => {
941
- if (typeof globalThis !== "undefined")
942
- return globalThis;
943
- if (typeof self !== "undefined")
944
- return self;
945
- if (typeof window !== "undefined")
946
- return window;
947
- if (typeof global !== "undefined")
948
- return global;
949
- throw "Unable to locate global object";
950
- })();
951
- const atob = globalThis.atob ||
952
- ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
953
- function bytesFromBase64(b64) {
954
- const bin = atob(b64);
955
- const arr = new Uint8Array(bin.length);
956
- for (let i = 0; i < bin.length; ++i) {
957
- arr[i] = bin.charCodeAt(i);
958
- }
959
- return arr;
960
- }
961
- const btoa = globalThis.btoa ||
962
- ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
963
- function base64FromBytes(arr) {
964
- const bin = [];
965
- for (const byte of arr) {
966
- bin.push(String.fromCharCode(byte));
967
- }
968
- return btoa(bin.join(""));
969
- }
970
652
  if (minimal_1.default.util.Long !== long_1.default) {
971
653
  minimal_1.default.util.Long = long_1.default;
972
654
  minimal_1.default.configure();