@zoguxprotocol/proto 0.1.6 → 0.1.7

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.
@@ -1,12 +1,15 @@
1
- import { MsgDepositToSubaccount, MsgWithdrawFromSubaccount, MsgSendFromModuleToAccount } from "./transfer";
1
+ import { MsgCreateTransferSpot, MsgDepositToSubaccount, MsgWithdrawFromSubaccount, MsgSendFromModuleToAccount, MsgDepositToSpot, MsgWithdrawFromSpot, MsgTransferSpotToPerp, MsgTransferPerpToSpot } from "./transfer";
2
2
  import { Rpc } from "../../helpers";
3
3
  import * as _m0 from "protobufjs/minimal";
4
- import { MsgCreateTransfer, MsgCreateTransferResponse, MsgDepositToSubaccountResponse, MsgWithdrawFromSubaccountResponse, MsgSendFromModuleToAccountResponse } from "./tx";
4
+ import { MsgCreateTransfer, MsgCreateTransferResponse, MsgCreateTransferSpotResponse, MsgDepositToSubaccountResponse, MsgWithdrawFromSubaccountResponse, MsgSendFromModuleToAccountResponse, MsgDepositToSpotResponse, MsgWithdrawFromSpotResponse, MsgTransferSpotToPerpResponse, MsgTransferPerpToSpotResponse } from "./tx";
5
5
  /** Msg defines the Msg service. */
6
6
 
7
7
  export interface Msg {
8
8
  /** CreateTransfer initiates a new transfer between subaccounts. */
9
9
  createTransfer(request: MsgCreateTransfer): Promise<MsgCreateTransferResponse>;
10
+ /** CreateTransferSpot initiates a new transfer of spot assets between subaccounts. */
11
+
12
+ createTransferSpot(request: MsgCreateTransferSpot): Promise<MsgCreateTransferSpotResponse>;
10
13
  /**
11
14
  * DepositToSubaccount initiates a new transfer from an `x/bank` account
12
15
  * to an `x/subaccounts` subaccount.
@@ -25,6 +28,30 @@ export interface Msg {
25
28
  */
26
29
 
27
30
  sendFromModuleToAccount(request: MsgSendFromModuleToAccount): Promise<MsgSendFromModuleToAccountResponse>;
31
+ /**
32
+ * DepositToSpot initiates a new transfer from an `x/bank` account
33
+ * to an `x/subaccounts` subaccount's spot balance.
34
+ */
35
+
36
+ depositToSpot(request: MsgDepositToSpot): Promise<MsgDepositToSpotResponse>;
37
+ /**
38
+ * WithdrawFromSpot initiates a new transfer from an `x/subaccounts`
39
+ * subaccount's spot balance to an `x/bank` account.
40
+ */
41
+
42
+ withdrawFromSpot(request: MsgWithdrawFromSpot): Promise<MsgWithdrawFromSpotResponse>;
43
+ /**
44
+ * TransferSpotToPerp transfers funds from spot balance to perpetual
45
+ * collateral within the same subaccount.
46
+ */
47
+
48
+ transferSpotToPerp(request: MsgTransferSpotToPerp): Promise<MsgTransferSpotToPerpResponse>;
49
+ /**
50
+ * TransferPerpToSpot transfers funds from perpetual collateral to
51
+ * spot balance. Can transfer within the same subaccount or between different subaccounts.
52
+ */
53
+
54
+ transferPerpToSpot(request: MsgTransferPerpToSpot): Promise<MsgTransferPerpToSpotResponse>;
28
55
  }
29
56
  export class MsgClientImpl implements Msg {
30
57
  private readonly rpc: Rpc;
@@ -32,9 +59,14 @@ export class MsgClientImpl implements Msg {
32
59
  constructor(rpc: Rpc) {
33
60
  this.rpc = rpc;
34
61
  this.createTransfer = this.createTransfer.bind(this);
62
+ this.createTransferSpot = this.createTransferSpot.bind(this);
35
63
  this.depositToSubaccount = this.depositToSubaccount.bind(this);
36
64
  this.withdrawFromSubaccount = this.withdrawFromSubaccount.bind(this);
37
65
  this.sendFromModuleToAccount = this.sendFromModuleToAccount.bind(this);
66
+ this.depositToSpot = this.depositToSpot.bind(this);
67
+ this.withdrawFromSpot = this.withdrawFromSpot.bind(this);
68
+ this.transferSpotToPerp = this.transferSpotToPerp.bind(this);
69
+ this.transferPerpToSpot = this.transferPerpToSpot.bind(this);
38
70
  }
39
71
 
40
72
  createTransfer(request: MsgCreateTransfer): Promise<MsgCreateTransferResponse> {
@@ -43,6 +75,12 @@ export class MsgClientImpl implements Msg {
43
75
  return promise.then(data => MsgCreateTransferResponse.decode(new _m0.Reader(data)));
44
76
  }
45
77
 
78
+ createTransferSpot(request: MsgCreateTransferSpot): Promise<MsgCreateTransferSpotResponse> {
79
+ const data = MsgCreateTransferSpot.encode(request).finish();
80
+ const promise = this.rpc.request("zogux.sending.Msg", "CreateTransferSpot", data);
81
+ return promise.then(data => MsgCreateTransferSpotResponse.decode(new _m0.Reader(data)));
82
+ }
83
+
46
84
  depositToSubaccount(request: MsgDepositToSubaccount): Promise<MsgDepositToSubaccountResponse> {
47
85
  const data = MsgDepositToSubaccount.encode(request).finish();
48
86
  const promise = this.rpc.request("zogux.sending.Msg", "DepositToSubaccount", data);
@@ -61,4 +99,28 @@ export class MsgClientImpl implements Msg {
61
99
  return promise.then(data => MsgSendFromModuleToAccountResponse.decode(new _m0.Reader(data)));
62
100
  }
63
101
 
102
+ depositToSpot(request: MsgDepositToSpot): Promise<MsgDepositToSpotResponse> {
103
+ const data = MsgDepositToSpot.encode(request).finish();
104
+ const promise = this.rpc.request("zogux.sending.Msg", "DepositToSpot", data);
105
+ return promise.then(data => MsgDepositToSpotResponse.decode(new _m0.Reader(data)));
106
+ }
107
+
108
+ withdrawFromSpot(request: MsgWithdrawFromSpot): Promise<MsgWithdrawFromSpotResponse> {
109
+ const data = MsgWithdrawFromSpot.encode(request).finish();
110
+ const promise = this.rpc.request("zogux.sending.Msg", "WithdrawFromSpot", data);
111
+ return promise.then(data => MsgWithdrawFromSpotResponse.decode(new _m0.Reader(data)));
112
+ }
113
+
114
+ transferSpotToPerp(request: MsgTransferSpotToPerp): Promise<MsgTransferSpotToPerpResponse> {
115
+ const data = MsgTransferSpotToPerp.encode(request).finish();
116
+ const promise = this.rpc.request("zogux.sending.Msg", "TransferSpotToPerp", data);
117
+ return promise.then(data => MsgTransferSpotToPerpResponse.decode(new _m0.Reader(data)));
118
+ }
119
+
120
+ transferPerpToSpot(request: MsgTransferPerpToSpot): Promise<MsgTransferPerpToSpotResponse> {
121
+ const data = MsgTransferPerpToSpot.encode(request).finish();
122
+ const promise = this.rpc.request("zogux.sending.Msg", "TransferPerpToSpot", data);
123
+ return promise.then(data => MsgTransferPerpToSpotResponse.decode(new _m0.Reader(data)));
124
+ }
125
+
64
126
  }
@@ -18,6 +18,12 @@ export interface MsgCreateTransferResponse {}
18
18
  /** MsgCreateTransferResponse is a response type used for new transfers. */
19
19
 
20
20
  export interface MsgCreateTransferResponseSDKType {}
21
+ /** MsgCreateTransferSpotResponse is a response type used for new spot transfers. */
22
+
23
+ export interface MsgCreateTransferSpotResponse {}
24
+ /** MsgCreateTransferSpotResponse is a response type used for new spot transfers. */
25
+
26
+ export interface MsgCreateTransferSpotResponseSDKType {}
21
27
  /**
22
28
  * MsgDepositToSubaccountResponse is a response type used for new
23
29
  * account-to-subaccount transfers.
@@ -54,6 +60,54 @@ export interface MsgSendFromModuleToAccountResponse {}
54
60
  */
55
61
 
56
62
  export interface MsgSendFromModuleToAccountResponseSDKType {}
63
+ /**
64
+ * MsgDepositToSpotResponse is a response type used for new
65
+ * account-to-spot transfers.
66
+ */
67
+
68
+ export interface MsgDepositToSpotResponse {}
69
+ /**
70
+ * MsgDepositToSpotResponse is a response type used for new
71
+ * account-to-spot transfers.
72
+ */
73
+
74
+ export interface MsgDepositToSpotResponseSDKType {}
75
+ /**
76
+ * MsgWithdrawFromSpotResponse is a response type used for new
77
+ * spot-to-account transfers.
78
+ */
79
+
80
+ export interface MsgWithdrawFromSpotResponse {}
81
+ /**
82
+ * MsgWithdrawFromSpotResponse is a response type used for new
83
+ * spot-to-account transfers.
84
+ */
85
+
86
+ export interface MsgWithdrawFromSpotResponseSDKType {}
87
+ /**
88
+ * MsgTransferSpotToPerpResponse is a response type used for
89
+ * spot-to-perp transfers within a subaccount.
90
+ */
91
+
92
+ export interface MsgTransferSpotToPerpResponse {}
93
+ /**
94
+ * MsgTransferSpotToPerpResponse is a response type used for
95
+ * spot-to-perp transfers within a subaccount.
96
+ */
97
+
98
+ export interface MsgTransferSpotToPerpResponseSDKType {}
99
+ /**
100
+ * MsgTransferPerpToSpotResponse is a response type used for
101
+ * perp-to-spot transfers (same or different subaccounts).
102
+ */
103
+
104
+ export interface MsgTransferPerpToSpotResponse {}
105
+ /**
106
+ * MsgTransferPerpToSpotResponse is a response type used for
107
+ * perp-to-spot transfers (same or different subaccounts).
108
+ */
109
+
110
+ export interface MsgTransferPerpToSpotResponseSDKType {}
57
111
 
58
112
  function createBaseMsgCreateTransfer(): MsgCreateTransfer {
59
113
  return {
@@ -134,6 +188,40 @@ export const MsgCreateTransferResponse = {
134
188
 
135
189
  };
136
190
 
191
+ function createBaseMsgCreateTransferSpotResponse(): MsgCreateTransferSpotResponse {
192
+ return {};
193
+ }
194
+
195
+ export const MsgCreateTransferSpotResponse = {
196
+ encode(_: MsgCreateTransferSpotResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
197
+ return writer;
198
+ },
199
+
200
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateTransferSpotResponse {
201
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
202
+ let end = length === undefined ? reader.len : reader.pos + length;
203
+ const message = createBaseMsgCreateTransferSpotResponse();
204
+
205
+ while (reader.pos < end) {
206
+ const tag = reader.uint32();
207
+
208
+ switch (tag >>> 3) {
209
+ default:
210
+ reader.skipType(tag & 7);
211
+ break;
212
+ }
213
+ }
214
+
215
+ return message;
216
+ },
217
+
218
+ fromPartial(_: DeepPartial<MsgCreateTransferSpotResponse>): MsgCreateTransferSpotResponse {
219
+ const message = createBaseMsgCreateTransferSpotResponse();
220
+ return message;
221
+ }
222
+
223
+ };
224
+
137
225
  function createBaseMsgDepositToSubaccountResponse(): MsgDepositToSubaccountResponse {
138
226
  return {};
139
227
  }
@@ -234,4 +322,140 @@ export const MsgSendFromModuleToAccountResponse = {
234
322
  return message;
235
323
  }
236
324
 
325
+ };
326
+
327
+ function createBaseMsgDepositToSpotResponse(): MsgDepositToSpotResponse {
328
+ return {};
329
+ }
330
+
331
+ export const MsgDepositToSpotResponse = {
332
+ encode(_: MsgDepositToSpotResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
333
+ return writer;
334
+ },
335
+
336
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositToSpotResponse {
337
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
338
+ let end = length === undefined ? reader.len : reader.pos + length;
339
+ const message = createBaseMsgDepositToSpotResponse();
340
+
341
+ while (reader.pos < end) {
342
+ const tag = reader.uint32();
343
+
344
+ switch (tag >>> 3) {
345
+ default:
346
+ reader.skipType(tag & 7);
347
+ break;
348
+ }
349
+ }
350
+
351
+ return message;
352
+ },
353
+
354
+ fromPartial(_: DeepPartial<MsgDepositToSpotResponse>): MsgDepositToSpotResponse {
355
+ const message = createBaseMsgDepositToSpotResponse();
356
+ return message;
357
+ }
358
+
359
+ };
360
+
361
+ function createBaseMsgWithdrawFromSpotResponse(): MsgWithdrawFromSpotResponse {
362
+ return {};
363
+ }
364
+
365
+ export const MsgWithdrawFromSpotResponse = {
366
+ encode(_: MsgWithdrawFromSpotResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
367
+ return writer;
368
+ },
369
+
370
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawFromSpotResponse {
371
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
372
+ let end = length === undefined ? reader.len : reader.pos + length;
373
+ const message = createBaseMsgWithdrawFromSpotResponse();
374
+
375
+ while (reader.pos < end) {
376
+ const tag = reader.uint32();
377
+
378
+ switch (tag >>> 3) {
379
+ default:
380
+ reader.skipType(tag & 7);
381
+ break;
382
+ }
383
+ }
384
+
385
+ return message;
386
+ },
387
+
388
+ fromPartial(_: DeepPartial<MsgWithdrawFromSpotResponse>): MsgWithdrawFromSpotResponse {
389
+ const message = createBaseMsgWithdrawFromSpotResponse();
390
+ return message;
391
+ }
392
+
393
+ };
394
+
395
+ function createBaseMsgTransferSpotToPerpResponse(): MsgTransferSpotToPerpResponse {
396
+ return {};
397
+ }
398
+
399
+ export const MsgTransferSpotToPerpResponse = {
400
+ encode(_: MsgTransferSpotToPerpResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
401
+ return writer;
402
+ },
403
+
404
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgTransferSpotToPerpResponse {
405
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
406
+ let end = length === undefined ? reader.len : reader.pos + length;
407
+ const message = createBaseMsgTransferSpotToPerpResponse();
408
+
409
+ while (reader.pos < end) {
410
+ const tag = reader.uint32();
411
+
412
+ switch (tag >>> 3) {
413
+ default:
414
+ reader.skipType(tag & 7);
415
+ break;
416
+ }
417
+ }
418
+
419
+ return message;
420
+ },
421
+
422
+ fromPartial(_: DeepPartial<MsgTransferSpotToPerpResponse>): MsgTransferSpotToPerpResponse {
423
+ const message = createBaseMsgTransferSpotToPerpResponse();
424
+ return message;
425
+ }
426
+
427
+ };
428
+
429
+ function createBaseMsgTransferPerpToSpotResponse(): MsgTransferPerpToSpotResponse {
430
+ return {};
431
+ }
432
+
433
+ export const MsgTransferPerpToSpotResponse = {
434
+ encode(_: MsgTransferPerpToSpotResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
435
+ return writer;
436
+ },
437
+
438
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgTransferPerpToSpotResponse {
439
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
440
+ let end = length === undefined ? reader.len : reader.pos + length;
441
+ const message = createBaseMsgTransferPerpToSpotResponse();
442
+
443
+ while (reader.pos < end) {
444
+ const tag = reader.uint32();
445
+
446
+ switch (tag >>> 3) {
447
+ default:
448
+ reader.skipType(tag & 7);
449
+ break;
450
+ }
451
+ }
452
+
453
+ return message;
454
+ },
455
+
456
+ fromPartial(_: DeepPartial<MsgTransferPerpToSpotResponse>): MsgTransferPerpToSpotResponse {
457
+ const message = createBaseMsgTransferPerpToSpotResponse();
458
+ return message;
459
+ }
460
+
237
461
  };
@@ -0,0 +1,82 @@
1
+ import * as _m0 from "protobufjs/minimal";
2
+ import { DeepPartial } from "../../helpers";
3
+ /**
4
+ * SpotAssetLocked tracks locked funds for pending spot orders for a specific asset.
5
+ * This is used to ensure users have sufficient balance when placing limit orders.
6
+ */
7
+
8
+ export interface SpotAssetLocked {
9
+ /** The Id of the Asset being locked (e.g., USDC = 0, BTC = 1). */
10
+ assetId: number;
11
+ /**
12
+ * Quantums of this asset locked for pending spot orders.
13
+ * For BUY orders: quote asset (e.g., USDC) is locked.
14
+ * For SELL orders: base asset (e.g., BTC) is locked.
15
+ */
16
+
17
+ quantumsLocked: Uint8Array;
18
+ }
19
+ /**
20
+ * SpotAssetLocked tracks locked funds for pending spot orders for a specific asset.
21
+ * This is used to ensure users have sufficient balance when placing limit orders.
22
+ */
23
+
24
+ export interface SpotAssetLockedSDKType {
25
+ asset_id: number;
26
+ quantums_locked: Uint8Array;
27
+ }
28
+
29
+ function createBaseSpotAssetLocked(): SpotAssetLocked {
30
+ return {
31
+ assetId: 0,
32
+ quantumsLocked: new Uint8Array()
33
+ };
34
+ }
35
+
36
+ export const SpotAssetLocked = {
37
+ encode(message: SpotAssetLocked, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
38
+ if (message.assetId !== 0) {
39
+ writer.uint32(8).uint32(message.assetId);
40
+ }
41
+
42
+ if (message.quantumsLocked.length !== 0) {
43
+ writer.uint32(18).bytes(message.quantumsLocked);
44
+ }
45
+
46
+ return writer;
47
+ },
48
+
49
+ decode(input: _m0.Reader | Uint8Array, length?: number): SpotAssetLocked {
50
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
51
+ let end = length === undefined ? reader.len : reader.pos + length;
52
+ const message = createBaseSpotAssetLocked();
53
+
54
+ while (reader.pos < end) {
55
+ const tag = reader.uint32();
56
+
57
+ switch (tag >>> 3) {
58
+ case 1:
59
+ message.assetId = reader.uint32();
60
+ break;
61
+
62
+ case 2:
63
+ message.quantumsLocked = reader.bytes();
64
+ break;
65
+
66
+ default:
67
+ reader.skipType(tag & 7);
68
+ break;
69
+ }
70
+ }
71
+
72
+ return message;
73
+ },
74
+
75
+ fromPartial(object: DeepPartial<SpotAssetLocked>): SpotAssetLocked {
76
+ const message = createBaseSpotAssetLocked();
77
+ message.assetId = object.assetId ?? 0;
78
+ message.quantumsLocked = object.quantumsLocked ?? new Uint8Array();
79
+ return message;
80
+ }
81
+
82
+ };
@@ -1,5 +1,6 @@
1
1
  import { AssetPosition, AssetPositionSDKType } from "./asset_position";
2
2
  import { PerpetualPosition, PerpetualPositionSDKType } from "./perpetual_position";
3
+ import { SpotAssetLocked, SpotAssetLockedSDKType } from "./spot_position";
3
4
  import * as _m0 from "protobufjs/minimal";
4
5
  import { DeepPartial } from "../../helpers";
5
6
  /** SubaccountId defines a unique identifier for a Subaccount. */
@@ -29,7 +30,8 @@ export interface Subaccount {
29
30
  /** The Id of the Subaccount */
30
31
  id?: SubaccountId;
31
32
  /**
32
- * All `AssetPosition`s associated with this subaccount.
33
+ * All `AssetPosition`s associated with this subaccount for perpetual trading.
34
+ * This is the collateral/margin for perpetual positions.
33
35
  * Always sorted ascending by `asset_id`.
34
36
  */
35
37
 
@@ -46,6 +48,19 @@ export interface Subaccount {
46
48
  */
47
49
 
48
50
  marginEnabled: boolean;
51
+ /**
52
+ * All `AssetPosition`s for spot trading balances.
53
+ * This is separate from perpetual collateral to isolate risk.
54
+ * Always sorted ascending by `asset_id`.
55
+ */
56
+
57
+ spotAssetPositions: AssetPosition[];
58
+ /**
59
+ * All locked funds for pending spot orders.
60
+ * Always sorted ascending by `asset_id`.
61
+ */
62
+
63
+ spotLockedBalances: SpotAssetLocked[];
49
64
  }
50
65
  /**
51
66
  * Subaccount defines a single sub-account for a given address.
@@ -57,6 +72,8 @@ export interface SubaccountSDKType {
57
72
  asset_positions: AssetPositionSDKType[];
58
73
  perpetual_positions: PerpetualPositionSDKType[];
59
74
  margin_enabled: boolean;
75
+ spot_asset_positions: AssetPositionSDKType[];
76
+ spot_locked_balances: SpotAssetLockedSDKType[];
60
77
  }
61
78
 
62
79
  function createBaseSubaccountId(): SubaccountId {
@@ -119,7 +136,9 @@ function createBaseSubaccount(): Subaccount {
119
136
  id: undefined,
120
137
  assetPositions: [],
121
138
  perpetualPositions: [],
122
- marginEnabled: false
139
+ marginEnabled: false,
140
+ spotAssetPositions: [],
141
+ spotLockedBalances: []
123
142
  };
124
143
  }
125
144
 
@@ -141,6 +160,14 @@ export const Subaccount = {
141
160
  writer.uint32(32).bool(message.marginEnabled);
142
161
  }
143
162
 
163
+ for (const v of message.spotAssetPositions) {
164
+ AssetPosition.encode(v!, writer.uint32(42).fork()).ldelim();
165
+ }
166
+
167
+ for (const v of message.spotLockedBalances) {
168
+ SpotAssetLocked.encode(v!, writer.uint32(50).fork()).ldelim();
169
+ }
170
+
144
171
  return writer;
145
172
  },
146
173
 
@@ -169,6 +196,14 @@ export const Subaccount = {
169
196
  message.marginEnabled = reader.bool();
170
197
  break;
171
198
 
199
+ case 5:
200
+ message.spotAssetPositions.push(AssetPosition.decode(reader, reader.uint32()));
201
+ break;
202
+
203
+ case 6:
204
+ message.spotLockedBalances.push(SpotAssetLocked.decode(reader, reader.uint32()));
205
+ break;
206
+
172
207
  default:
173
208
  reader.skipType(tag & 7);
174
209
  break;
@@ -184,6 +219,8 @@ export const Subaccount = {
184
219
  message.assetPositions = object.assetPositions?.map(e => AssetPosition.fromPartial(e)) || [];
185
220
  message.perpetualPositions = object.perpetualPositions?.map(e => PerpetualPosition.fromPartial(e)) || [];
186
221
  message.marginEnabled = object.marginEnabled ?? false;
222
+ message.spotAssetPositions = object.spotAssetPositions?.map(e => AssetPosition.fromPartial(e)) || [];
223
+ message.spotLockedBalances = object.spotLockedBalances?.map(e => SpotAssetLocked.fromPartial(e)) || [];
187
224
  return message;
188
225
  }
189
226
 
@@ -0,0 +1,27 @@
1
+ import { Rpc } from "../../helpers";
2
+ import * as _m0 from "protobufjs/minimal";
3
+ import { MsgRecoverySpotBalance, MsgRecoverySpotBalanceResponse } from "./tx";
4
+ /** Msg defines the subaccounts Msg service. */
5
+
6
+ export interface Msg {
7
+ /**
8
+ * RecoverySpotBalance is an admin function to recover spot balance discrepancies.
9
+ * This should only be called by authorized admin/governance addresses.
10
+ */
11
+ recoverySpotBalance(request: MsgRecoverySpotBalance): Promise<MsgRecoverySpotBalanceResponse>;
12
+ }
13
+ export class MsgClientImpl implements Msg {
14
+ private readonly rpc: Rpc;
15
+
16
+ constructor(rpc: Rpc) {
17
+ this.rpc = rpc;
18
+ this.recoverySpotBalance = this.recoverySpotBalance.bind(this);
19
+ }
20
+
21
+ recoverySpotBalance(request: MsgRecoverySpotBalance): Promise<MsgRecoverySpotBalanceResponse> {
22
+ const data = MsgRecoverySpotBalance.encode(request).finish();
23
+ const promise = this.rpc.request("zogux.subaccounts.Msg", "RecoverySpotBalance", data);
24
+ return promise.then(data => MsgRecoverySpotBalanceResponse.decode(new _m0.Reader(data)));
25
+ }
26
+
27
+ }
@@ -0,0 +1,144 @@
1
+ import { SubaccountId, SubaccountIdSDKType } from "./subaccount";
2
+ import * as _m0 from "protobufjs/minimal";
3
+ import { DeepPartial } from "../../helpers";
4
+ /** MsgRecoverySpotBalance is the request type for recovering spot balance discrepancies. */
5
+
6
+ export interface MsgRecoverySpotBalance {
7
+ /** Authority is the address authorized to execute this message (typically governance). */
8
+ authority: string;
9
+ /** SubaccountId identifies the subaccount to recover. */
10
+
11
+ subaccountId?: SubaccountId;
12
+ /** AssetId is the asset ID to recover balance for. */
13
+
14
+ assetId: number;
15
+ /**
16
+ * DeltaAmount is the amount to add (positive) or subtract (negative) to recover the balance.
17
+ * This is a string representation of a big.Int.
18
+ */
19
+
20
+ deltaAmount: string;
21
+ }
22
+ /** MsgRecoverySpotBalance is the request type for recovering spot balance discrepancies. */
23
+
24
+ export interface MsgRecoverySpotBalanceSDKType {
25
+ authority: string;
26
+ subaccount_id?: SubaccountIdSDKType;
27
+ asset_id: number;
28
+ delta_amount: string;
29
+ }
30
+ /** MsgRecoverySpotBalanceResponse is the response type for MsgRecoverySpotBalance. */
31
+
32
+ export interface MsgRecoverySpotBalanceResponse {}
33
+ /** MsgRecoverySpotBalanceResponse is the response type for MsgRecoverySpotBalance. */
34
+
35
+ export interface MsgRecoverySpotBalanceResponseSDKType {}
36
+
37
+ function createBaseMsgRecoverySpotBalance(): MsgRecoverySpotBalance {
38
+ return {
39
+ authority: "",
40
+ subaccountId: undefined,
41
+ assetId: 0,
42
+ deltaAmount: ""
43
+ };
44
+ }
45
+
46
+ export const MsgRecoverySpotBalance = {
47
+ encode(message: MsgRecoverySpotBalance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
48
+ if (message.authority !== "") {
49
+ writer.uint32(10).string(message.authority);
50
+ }
51
+
52
+ if (message.subaccountId !== undefined) {
53
+ SubaccountId.encode(message.subaccountId, writer.uint32(18).fork()).ldelim();
54
+ }
55
+
56
+ if (message.assetId !== 0) {
57
+ writer.uint32(24).uint32(message.assetId);
58
+ }
59
+
60
+ if (message.deltaAmount !== "") {
61
+ writer.uint32(34).string(message.deltaAmount);
62
+ }
63
+
64
+ return writer;
65
+ },
66
+
67
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgRecoverySpotBalance {
68
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
69
+ let end = length === undefined ? reader.len : reader.pos + length;
70
+ const message = createBaseMsgRecoverySpotBalance();
71
+
72
+ while (reader.pos < end) {
73
+ const tag = reader.uint32();
74
+
75
+ switch (tag >>> 3) {
76
+ case 1:
77
+ message.authority = reader.string();
78
+ break;
79
+
80
+ case 2:
81
+ message.subaccountId = SubaccountId.decode(reader, reader.uint32());
82
+ break;
83
+
84
+ case 3:
85
+ message.assetId = reader.uint32();
86
+ break;
87
+
88
+ case 4:
89
+ message.deltaAmount = reader.string();
90
+ break;
91
+
92
+ default:
93
+ reader.skipType(tag & 7);
94
+ break;
95
+ }
96
+ }
97
+
98
+ return message;
99
+ },
100
+
101
+ fromPartial(object: DeepPartial<MsgRecoverySpotBalance>): MsgRecoverySpotBalance {
102
+ const message = createBaseMsgRecoverySpotBalance();
103
+ message.authority = object.authority ?? "";
104
+ message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined;
105
+ message.assetId = object.assetId ?? 0;
106
+ message.deltaAmount = object.deltaAmount ?? "";
107
+ return message;
108
+ }
109
+
110
+ };
111
+
112
+ function createBaseMsgRecoverySpotBalanceResponse(): MsgRecoverySpotBalanceResponse {
113
+ return {};
114
+ }
115
+
116
+ export const MsgRecoverySpotBalanceResponse = {
117
+ encode(_: MsgRecoverySpotBalanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
118
+ return writer;
119
+ },
120
+
121
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgRecoverySpotBalanceResponse {
122
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
123
+ let end = length === undefined ? reader.len : reader.pos + length;
124
+ const message = createBaseMsgRecoverySpotBalanceResponse();
125
+
126
+ while (reader.pos < end) {
127
+ const tag = reader.uint32();
128
+
129
+ switch (tag >>> 3) {
130
+ default:
131
+ reader.skipType(tag & 7);
132
+ break;
133
+ }
134
+ }
135
+
136
+ return message;
137
+ },
138
+
139
+ fromPartial(_: DeepPartial<MsgRecoverySpotBalanceResponse>): MsgRecoverySpotBalanceResponse {
140
+ const message = createBaseMsgRecoverySpotBalanceResponse();
141
+ return message;
142
+ }
143
+
144
+ };