@zoguxprotocol/proto 0.1.6 → 0.1.8
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/package.json +1 -1
- package/src/codegen/cosmos/bundle.ts +126 -126
- package/src/codegen/zogux/bridge/events.ts +12 -6
- package/src/codegen/zogux/bridge/params.ts +6 -4
- package/src/codegen/zogux/bundle.ts +167 -161
- package/src/codegen/zogux/indexer/events/events.ts +59 -4
- package/src/codegen/zogux/indexer/protocol/v1/subaccount.ts +82 -0
- package/src/codegen/zogux/rpc.tx.ts +1 -0
- package/src/codegen/zogux/sending/transfer.ts +570 -0
- package/src/codegen/zogux/sending/tx.rpc.msg.ts +68 -2
- package/src/codegen/zogux/sending/tx.ts +224 -0
- package/src/codegen/zogux/spots/tx.rpc.msg.ts +11 -1
- package/src/codegen/zogux/spots/tx.ts +110 -0
- package/src/codegen/zogux/subaccounts/spot_position.ts +84 -0
- package/src/codegen/zogux/subaccounts/subaccount.ts +39 -2
- package/src/codegen/zogux/subaccounts/tx.rpc.msg.ts +28 -0
- package/src/codegen/zogux/subaccounts/tx.ts +159 -0
|
@@ -1,12 +1,18 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* CreateTransferSpot initiates a new transfer of spot assets between
|
|
12
|
+
* subaccounts.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
createTransferSpot(request: MsgCreateTransferSpot): Promise<MsgCreateTransferSpotResponse>;
|
|
10
16
|
/**
|
|
11
17
|
* DepositToSubaccount initiates a new transfer from an `x/bank` account
|
|
12
18
|
* to an `x/subaccounts` subaccount.
|
|
@@ -25,6 +31,31 @@ export interface Msg {
|
|
|
25
31
|
*/
|
|
26
32
|
|
|
27
33
|
sendFromModuleToAccount(request: MsgSendFromModuleToAccount): Promise<MsgSendFromModuleToAccountResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* DepositToSpot initiates a new transfer from an `x/bank` account
|
|
36
|
+
* to an `x/subaccounts` subaccount's spot balance.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
depositToSpot(request: MsgDepositToSpot): Promise<MsgDepositToSpotResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* WithdrawFromSpot initiates a new transfer from an `x/subaccounts`
|
|
42
|
+
* subaccount's spot balance to an `x/bank` account.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
withdrawFromSpot(request: MsgWithdrawFromSpot): Promise<MsgWithdrawFromSpotResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* TransferSpotToPerp transfers funds from spot balance to perpetual
|
|
48
|
+
* collateral within the same subaccount.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
transferSpotToPerp(request: MsgTransferSpotToPerp): Promise<MsgTransferSpotToPerpResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* TransferPerpToSpot transfers funds from perpetual collateral to
|
|
54
|
+
* spot balance. Can transfer within the same subaccount or between different
|
|
55
|
+
* subaccounts.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
transferPerpToSpot(request: MsgTransferPerpToSpot): Promise<MsgTransferPerpToSpotResponse>;
|
|
28
59
|
}
|
|
29
60
|
export class MsgClientImpl implements Msg {
|
|
30
61
|
private readonly rpc: Rpc;
|
|
@@ -32,9 +63,14 @@ export class MsgClientImpl implements Msg {
|
|
|
32
63
|
constructor(rpc: Rpc) {
|
|
33
64
|
this.rpc = rpc;
|
|
34
65
|
this.createTransfer = this.createTransfer.bind(this);
|
|
66
|
+
this.createTransferSpot = this.createTransferSpot.bind(this);
|
|
35
67
|
this.depositToSubaccount = this.depositToSubaccount.bind(this);
|
|
36
68
|
this.withdrawFromSubaccount = this.withdrawFromSubaccount.bind(this);
|
|
37
69
|
this.sendFromModuleToAccount = this.sendFromModuleToAccount.bind(this);
|
|
70
|
+
this.depositToSpot = this.depositToSpot.bind(this);
|
|
71
|
+
this.withdrawFromSpot = this.withdrawFromSpot.bind(this);
|
|
72
|
+
this.transferSpotToPerp = this.transferSpotToPerp.bind(this);
|
|
73
|
+
this.transferPerpToSpot = this.transferPerpToSpot.bind(this);
|
|
38
74
|
}
|
|
39
75
|
|
|
40
76
|
createTransfer(request: MsgCreateTransfer): Promise<MsgCreateTransferResponse> {
|
|
@@ -43,6 +79,12 @@ export class MsgClientImpl implements Msg {
|
|
|
43
79
|
return promise.then(data => MsgCreateTransferResponse.decode(new _m0.Reader(data)));
|
|
44
80
|
}
|
|
45
81
|
|
|
82
|
+
createTransferSpot(request: MsgCreateTransferSpot): Promise<MsgCreateTransferSpotResponse> {
|
|
83
|
+
const data = MsgCreateTransferSpot.encode(request).finish();
|
|
84
|
+
const promise = this.rpc.request("zogux.sending.Msg", "CreateTransferSpot", data);
|
|
85
|
+
return promise.then(data => MsgCreateTransferSpotResponse.decode(new _m0.Reader(data)));
|
|
86
|
+
}
|
|
87
|
+
|
|
46
88
|
depositToSubaccount(request: MsgDepositToSubaccount): Promise<MsgDepositToSubaccountResponse> {
|
|
47
89
|
const data = MsgDepositToSubaccount.encode(request).finish();
|
|
48
90
|
const promise = this.rpc.request("zogux.sending.Msg", "DepositToSubaccount", data);
|
|
@@ -61,4 +103,28 @@ export class MsgClientImpl implements Msg {
|
|
|
61
103
|
return promise.then(data => MsgSendFromModuleToAccountResponse.decode(new _m0.Reader(data)));
|
|
62
104
|
}
|
|
63
105
|
|
|
106
|
+
depositToSpot(request: MsgDepositToSpot): Promise<MsgDepositToSpotResponse> {
|
|
107
|
+
const data = MsgDepositToSpot.encode(request).finish();
|
|
108
|
+
const promise = this.rpc.request("zogux.sending.Msg", "DepositToSpot", data);
|
|
109
|
+
return promise.then(data => MsgDepositToSpotResponse.decode(new _m0.Reader(data)));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
withdrawFromSpot(request: MsgWithdrawFromSpot): Promise<MsgWithdrawFromSpotResponse> {
|
|
113
|
+
const data = MsgWithdrawFromSpot.encode(request).finish();
|
|
114
|
+
const promise = this.rpc.request("zogux.sending.Msg", "WithdrawFromSpot", data);
|
|
115
|
+
return promise.then(data => MsgWithdrawFromSpotResponse.decode(new _m0.Reader(data)));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
transferSpotToPerp(request: MsgTransferSpotToPerp): Promise<MsgTransferSpotToPerpResponse> {
|
|
119
|
+
const data = MsgTransferSpotToPerp.encode(request).finish();
|
|
120
|
+
const promise = this.rpc.request("zogux.sending.Msg", "TransferSpotToPerp", data);
|
|
121
|
+
return promise.then(data => MsgTransferSpotToPerpResponse.decode(new _m0.Reader(data)));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
transferPerpToSpot(request: MsgTransferPerpToSpot): Promise<MsgTransferPerpToSpotResponse> {
|
|
125
|
+
const data = MsgTransferPerpToSpot.encode(request).finish();
|
|
126
|
+
const promise = this.rpc.request("zogux.sending.Msg", "TransferPerpToSpot", data);
|
|
127
|
+
return promise.then(data => MsgTransferPerpToSpotResponse.decode(new _m0.Reader(data)));
|
|
128
|
+
}
|
|
129
|
+
|
|
64
130
|
}
|
|
@@ -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
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Rpc } from "../../helpers";
|
|
2
2
|
import * as _m0 from "protobufjs/minimal";
|
|
3
|
-
import { MsgUpdateSpotFeeTiers, MsgUpdateSpotFeeTiersResponse } from "./tx";
|
|
3
|
+
import { MsgUpdateSpotFeeTiers, MsgUpdateSpotFeeTiersResponse, MsgCreateSpotMarket, MsgCreateSpotMarketResponse } from "./tx";
|
|
4
4
|
/** Msg defines the Msg service. */
|
|
5
5
|
|
|
6
6
|
export interface Msg {
|
|
7
7
|
/** UpdateSpotFeeTiers updates the SpotFeeTiers in state. */
|
|
8
8
|
updateSpotFeeTiers(request: MsgUpdateSpotFeeTiers): Promise<MsgUpdateSpotFeeTiersResponse>;
|
|
9
|
+
/** CreateSpotMarket creates a new spot market via governance. */
|
|
10
|
+
|
|
11
|
+
createSpotMarket(request: MsgCreateSpotMarket): Promise<MsgCreateSpotMarketResponse>;
|
|
9
12
|
}
|
|
10
13
|
export class MsgClientImpl implements Msg {
|
|
11
14
|
private readonly rpc: Rpc;
|
|
@@ -13,6 +16,7 @@ export class MsgClientImpl implements Msg {
|
|
|
13
16
|
constructor(rpc: Rpc) {
|
|
14
17
|
this.rpc = rpc;
|
|
15
18
|
this.updateSpotFeeTiers = this.updateSpotFeeTiers.bind(this);
|
|
19
|
+
this.createSpotMarket = this.createSpotMarket.bind(this);
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
updateSpotFeeTiers(request: MsgUpdateSpotFeeTiers): Promise<MsgUpdateSpotFeeTiersResponse> {
|
|
@@ -21,4 +25,10 @@ export class MsgClientImpl implements Msg {
|
|
|
21
25
|
return promise.then(data => MsgUpdateSpotFeeTiersResponse.decode(new _m0.Reader(data)));
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
createSpotMarket(request: MsgCreateSpotMarket): Promise<MsgCreateSpotMarketResponse> {
|
|
29
|
+
const data = MsgCreateSpotMarket.encode(request).finish();
|
|
30
|
+
const promise = this.rpc.request("zogux.spots.Msg", "CreateSpotMarket", data);
|
|
31
|
+
return promise.then(data => MsgCreateSpotMarketResponse.decode(new _m0.Reader(data)));
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SpotFeeTier, SpotFeeTierSDKType } from "./fee_tier";
|
|
2
|
+
import { SpotMarketParams, SpotMarketParamsSDKType } from "./market";
|
|
2
3
|
import * as _m0 from "protobufjs/minimal";
|
|
3
4
|
import { DeepPartial } from "../../helpers";
|
|
4
5
|
/** MsgUpdateSpotFeeTiers is the Msg/UpdateSpotFeeTiers request type. */
|
|
@@ -27,6 +28,26 @@ export interface MsgUpdateSpotFeeTiersResponse {}
|
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
30
|
export interface MsgUpdateSpotFeeTiersResponseSDKType {}
|
|
31
|
+
/** MsgCreateSpotMarket is a message used by x/gov to create a new spot market. */
|
|
32
|
+
|
|
33
|
+
export interface MsgCreateSpotMarket {
|
|
34
|
+
authority: string;
|
|
35
|
+
/** Parameters for the new spot market. */
|
|
36
|
+
|
|
37
|
+
params?: SpotMarketParams;
|
|
38
|
+
}
|
|
39
|
+
/** MsgCreateSpotMarket is a message used by x/gov to create a new spot market. */
|
|
40
|
+
|
|
41
|
+
export interface MsgCreateSpotMarketSDKType {
|
|
42
|
+
authority: string;
|
|
43
|
+
params?: SpotMarketParamsSDKType;
|
|
44
|
+
}
|
|
45
|
+
/** MsgCreateSpotMarketResponse defines the CreateSpotMarket response type. */
|
|
46
|
+
|
|
47
|
+
export interface MsgCreateSpotMarketResponse {}
|
|
48
|
+
/** MsgCreateSpotMarketResponse defines the CreateSpotMarket response type. */
|
|
49
|
+
|
|
50
|
+
export interface MsgCreateSpotMarketResponseSDKType {}
|
|
30
51
|
|
|
31
52
|
function createBaseMsgUpdateSpotFeeTiers(): MsgUpdateSpotFeeTiers {
|
|
32
53
|
return {
|
|
@@ -115,4 +136,93 @@ export const MsgUpdateSpotFeeTiersResponse = {
|
|
|
115
136
|
return message;
|
|
116
137
|
}
|
|
117
138
|
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
function createBaseMsgCreateSpotMarket(): MsgCreateSpotMarket {
|
|
142
|
+
return {
|
|
143
|
+
authority: "",
|
|
144
|
+
params: undefined
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export const MsgCreateSpotMarket = {
|
|
149
|
+
encode(message: MsgCreateSpotMarket, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
150
|
+
if (message.authority !== "") {
|
|
151
|
+
writer.uint32(10).string(message.authority);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (message.params !== undefined) {
|
|
155
|
+
SpotMarketParams.encode(message.params, writer.uint32(18).fork()).ldelim();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return writer;
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateSpotMarket {
|
|
162
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
163
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
164
|
+
const message = createBaseMsgCreateSpotMarket();
|
|
165
|
+
|
|
166
|
+
while (reader.pos < end) {
|
|
167
|
+
const tag = reader.uint32();
|
|
168
|
+
|
|
169
|
+
switch (tag >>> 3) {
|
|
170
|
+
case 1:
|
|
171
|
+
message.authority = reader.string();
|
|
172
|
+
break;
|
|
173
|
+
|
|
174
|
+
case 2:
|
|
175
|
+
message.params = SpotMarketParams.decode(reader, reader.uint32());
|
|
176
|
+
break;
|
|
177
|
+
|
|
178
|
+
default:
|
|
179
|
+
reader.skipType(tag & 7);
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return message;
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
fromPartial(object: DeepPartial<MsgCreateSpotMarket>): MsgCreateSpotMarket {
|
|
188
|
+
const message = createBaseMsgCreateSpotMarket();
|
|
189
|
+
message.authority = object.authority ?? "";
|
|
190
|
+
message.params = object.params !== undefined && object.params !== null ? SpotMarketParams.fromPartial(object.params) : undefined;
|
|
191
|
+
return message;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
function createBaseMsgCreateSpotMarketResponse(): MsgCreateSpotMarketResponse {
|
|
197
|
+
return {};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export const MsgCreateSpotMarketResponse = {
|
|
201
|
+
encode(_: MsgCreateSpotMarketResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
202
|
+
return writer;
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateSpotMarketResponse {
|
|
206
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
207
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
208
|
+
const message = createBaseMsgCreateSpotMarketResponse();
|
|
209
|
+
|
|
210
|
+
while (reader.pos < end) {
|
|
211
|
+
const tag = reader.uint32();
|
|
212
|
+
|
|
213
|
+
switch (tag >>> 3) {
|
|
214
|
+
default:
|
|
215
|
+
reader.skipType(tag & 7);
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return message;
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
fromPartial(_: DeepPartial<MsgCreateSpotMarketResponse>): MsgCreateSpotMarketResponse {
|
|
224
|
+
const message = createBaseMsgCreateSpotMarketResponse();
|
|
225
|
+
return message;
|
|
226
|
+
}
|
|
227
|
+
|
|
118
228
|
};
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
|
5
|
+
* asset. This is used to ensure users have sufficient balance when placing
|
|
6
|
+
* limit orders.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface SpotAssetLocked {
|
|
10
|
+
/** The Id of the Asset being locked (e.g., USDC = 0, BTC = 1). */
|
|
11
|
+
assetId: number;
|
|
12
|
+
/**
|
|
13
|
+
* Quantums of this asset locked for pending spot orders.
|
|
14
|
+
* For BUY orders: quote asset (e.g., USDC) is locked.
|
|
15
|
+
* For SELL orders: base asset (e.g., BTC) is locked.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
quantumsLocked: Uint8Array;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* SpotAssetLocked tracks locked funds for pending spot orders for a specific
|
|
22
|
+
* asset. This is used to ensure users have sufficient balance when placing
|
|
23
|
+
* limit orders.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export interface SpotAssetLockedSDKType {
|
|
27
|
+
asset_id: number;
|
|
28
|
+
quantums_locked: Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function createBaseSpotAssetLocked(): SpotAssetLocked {
|
|
32
|
+
return {
|
|
33
|
+
assetId: 0,
|
|
34
|
+
quantumsLocked: new Uint8Array()
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const SpotAssetLocked = {
|
|
39
|
+
encode(message: SpotAssetLocked, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
40
|
+
if (message.assetId !== 0) {
|
|
41
|
+
writer.uint32(8).uint32(message.assetId);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (message.quantumsLocked.length !== 0) {
|
|
45
|
+
writer.uint32(18).bytes(message.quantumsLocked);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return writer;
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): SpotAssetLocked {
|
|
52
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
53
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
54
|
+
const message = createBaseSpotAssetLocked();
|
|
55
|
+
|
|
56
|
+
while (reader.pos < end) {
|
|
57
|
+
const tag = reader.uint32();
|
|
58
|
+
|
|
59
|
+
switch (tag >>> 3) {
|
|
60
|
+
case 1:
|
|
61
|
+
message.assetId = reader.uint32();
|
|
62
|
+
break;
|
|
63
|
+
|
|
64
|
+
case 2:
|
|
65
|
+
message.quantumsLocked = reader.bytes();
|
|
66
|
+
break;
|
|
67
|
+
|
|
68
|
+
default:
|
|
69
|
+
reader.skipType(tag & 7);
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return message;
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
fromPartial(object: DeepPartial<SpotAssetLocked>): SpotAssetLocked {
|
|
78
|
+
const message = createBaseSpotAssetLocked();
|
|
79
|
+
message.assetId = object.assetId ?? 0;
|
|
80
|
+
message.quantumsLocked = object.quantumsLocked ?? new Uint8Array();
|
|
81
|
+
return message;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
};
|
|
@@ -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
|
|