@deriverse/kit 1.0.24 → 1.0.26
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/dist/index.js +59 -44
- package/dist/instruction_models.d.ts +6 -4
- package/dist/instruction_models.js +61 -39
- package/dist/logs_models.d.ts +33 -1
- package/dist/logs_models.js +47 -1
- package/dist/structure_models.d.ts +151 -124
- package/dist/structure_models.js +155 -128
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -660,11 +660,11 @@ class Engine {
|
|
|
660
660
|
instrAccounts.forEach((response) => {
|
|
661
661
|
const buffer = buffer_1.Buffer.from((0, kit_1.getBase64Encoder)().encode(response.account.data[0]));
|
|
662
662
|
let instrAccountHeaderModel = new structure_models_1.InstrAccountHeaderModel();
|
|
663
|
-
instrAccountHeaderModel.
|
|
663
|
+
instrAccountHeaderModel.instrId = buffer.readUint32LE(0);
|
|
664
664
|
instrAccountHeaderModel.assetTokenId = buffer.readUint32LE(4);
|
|
665
665
|
instrAccountHeaderModel.crncyTokenId = buffer.readUint32LE(8);
|
|
666
666
|
instrAccountHeaderModel.mask = buffer.readUint32LE(12);
|
|
667
|
-
this.instruments.set(instrAccountHeaderModel.
|
|
667
|
+
this.instruments.set(instrAccountHeaderModel.instrId, {
|
|
668
668
|
address: response.pubkey,
|
|
669
669
|
header: instrAccountHeaderModel,
|
|
670
670
|
spotBids: [],
|
|
@@ -704,12 +704,12 @@ class Engine {
|
|
|
704
704
|
throw new Error("Add Instrument Failed: getAccountInfo");
|
|
705
705
|
}
|
|
706
706
|
const instrAccountHeaderModel = structure_models_1.InstrAccountHeaderModel.fromBuffer(info.value.data);
|
|
707
|
-
if (instrAccountHeaderModel.
|
|
707
|
+
if (instrAccountHeaderModel.instrId > this.rootStateModel.instrCount ||
|
|
708
708
|
instrAccountHeaderModel.tag != types_1.AccountType.INSTR ||
|
|
709
709
|
instrAccountHeaderModel.version != this.version) {
|
|
710
710
|
throw new Error("Invalid Instrument Account");
|
|
711
711
|
}
|
|
712
|
-
this.instruments.set(instrAccountHeaderModel.
|
|
712
|
+
this.instruments.set(instrAccountHeaderModel.instrId, {
|
|
713
713
|
address: instrAccount,
|
|
714
714
|
header: instrAccountHeaderModel,
|
|
715
715
|
spotBids: [],
|
|
@@ -854,14 +854,16 @@ class Engine {
|
|
|
854
854
|
}),
|
|
855
855
|
role: kit_1.AccountRole.WRITABLE
|
|
856
856
|
},
|
|
857
|
+
/*
|
|
857
858
|
{
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
859
|
+
address: await this.getInstrAccountByTag({
|
|
860
|
+
assetTokenId: instrAccountHeaderModel.assetTokenId,
|
|
861
|
+
crncyTokenId: instrAccountHeaderModel.crncyTokenId,
|
|
862
|
+
tag: AccountType.SPOT_CLIENT_ACCOUNTS
|
|
863
|
+
}),
|
|
864
|
+
role: AccountRole.WRITABLE
|
|
864
865
|
},
|
|
866
|
+
*/
|
|
865
867
|
];
|
|
866
868
|
});
|
|
867
869
|
}
|
|
@@ -960,14 +962,16 @@ class Engine {
|
|
|
960
962
|
}),
|
|
961
963
|
role: kit_1.AccountRole.WRITABLE
|
|
962
964
|
},
|
|
965
|
+
/*
|
|
963
966
|
{
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
967
|
+
address: await this.getInstrAccountByTag({
|
|
968
|
+
assetTokenId: instrAccountHeaderModel.assetTokenId,
|
|
969
|
+
crncyTokenId: instrAccountHeaderModel.crncyTokenId,
|
|
970
|
+
tag: AccountType.PERP_CLIENT_ACCOUNTS
|
|
971
|
+
}),
|
|
972
|
+
role: AccountRole.WRITABLE
|
|
970
973
|
},
|
|
974
|
+
*/
|
|
971
975
|
{
|
|
972
976
|
address: yield this.getInstrAccountByTag({
|
|
973
977
|
assetTokenId: instrAccountHeaderModel.assetTokenId,
|
|
@@ -992,14 +996,16 @@ class Engine {
|
|
|
992
996
|
}),
|
|
993
997
|
role: kit_1.AccountRole.WRITABLE
|
|
994
998
|
},
|
|
999
|
+
/*
|
|
995
1000
|
{
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1001
|
+
address: await this.getInstrAccountByTag({
|
|
1002
|
+
assetTokenId: instrAccountHeaderModel.assetTokenId,
|
|
1003
|
+
crncyTokenId: instrAccountHeaderModel.crncyTokenId,
|
|
1004
|
+
tag: AccountType.PERP_PRIORITY_TREE
|
|
1005
|
+
}),
|
|
1006
|
+
role: AccountRole.WRITABLE
|
|
1002
1007
|
},
|
|
1008
|
+
*/
|
|
1003
1009
|
];
|
|
1004
1010
|
});
|
|
1005
1011
|
}
|
|
@@ -1079,7 +1085,7 @@ class Engine {
|
|
|
1079
1085
|
crncyTokenId: args.crncyTokenId,
|
|
1080
1086
|
tag: types_1.AccountType.INSTR
|
|
1081
1087
|
});
|
|
1082
|
-
let info = yield this.rpc.getAccountInfo(instrAddress, { commitment: this.commitment, encoding: 'base64', dataSlice: { offset: structure_models_1.InstrAccountHeaderModel.
|
|
1088
|
+
let info = yield this.rpc.getAccountInfo(instrAddress, { commitment: this.commitment, encoding: 'base64', dataSlice: { offset: structure_models_1.InstrAccountHeaderModel.OFFSET_INSTR_ID, length: 4 } }).send();
|
|
1083
1089
|
if (info.value == null) {
|
|
1084
1090
|
return null;
|
|
1085
1091
|
}
|
|
@@ -1730,7 +1736,7 @@ class Engine {
|
|
|
1730
1736
|
header.fixingPx /= dec;
|
|
1731
1737
|
header.perpLastClose /= dec;
|
|
1732
1738
|
header.perpLastPx /= dec;
|
|
1733
|
-
header.lastHourPx /= dec;
|
|
1739
|
+
//header.lastHourPx /= dec;
|
|
1734
1740
|
header.perpSpotPriceForWithdrowal /= dec;
|
|
1735
1741
|
header.poolFees /= crncyTokenDec;
|
|
1736
1742
|
let spotBids = [];
|
|
@@ -1786,7 +1792,7 @@ class Engine {
|
|
|
1786
1792
|
programAddress: this.programId,
|
|
1787
1793
|
seeds: [pattern, (0, kit_1.getAddressEncoder)().encode(this.drvsAuthority)]
|
|
1788
1794
|
}))[0];
|
|
1789
|
-
this.instruments.set(header.
|
|
1795
|
+
this.instruments.set(header.instrId, {
|
|
1790
1796
|
address: instrAddress,
|
|
1791
1797
|
header: header,
|
|
1792
1798
|
spotBids: spotBids,
|
|
@@ -1827,13 +1833,13 @@ class Engine {
|
|
|
1827
1833
|
*/
|
|
1828
1834
|
depositInstruction(args) {
|
|
1829
1835
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1830
|
-
var _a
|
|
1836
|
+
var _a;
|
|
1831
1837
|
const exists = yield this.checkClient();
|
|
1832
1838
|
if (this.signer == null) {
|
|
1833
1839
|
throw new Error("Wallet is not connected");
|
|
1834
1840
|
}
|
|
1835
1841
|
const amount = (_a = args.amount) !== null && _a !== void 0 ? _a : 0;
|
|
1836
|
-
const allFunds =
|
|
1842
|
+
const allFunds = args.all_funds ? 1 : 0;
|
|
1837
1843
|
const token = this.tokens.get(args.tokenId);
|
|
1838
1844
|
const tokenProgramId = (token.mask & 0x80000000) != 0 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID;
|
|
1839
1845
|
const clientTokenAccount = yield findAssociatedTokenAddress(this.signer, tokenProgramId, token.address);
|
|
@@ -1856,7 +1862,7 @@ class Engine {
|
|
|
1856
1862
|
return {
|
|
1857
1863
|
accounts: keys,
|
|
1858
1864
|
programAddress: this.programId,
|
|
1859
|
-
data: (0, instruction_models_1.depositData)(7, args.tokenId, amount * this.tokenDec(args.tokenId), 0, 0
|
|
1865
|
+
data: (0, instruction_models_1.depositData)(7, 0, allFunds, args.tokenId, amount * this.tokenDec(args.tokenId), 0, 0)
|
|
1860
1866
|
};
|
|
1861
1867
|
}
|
|
1862
1868
|
else {
|
|
@@ -1886,7 +1892,7 @@ class Engine {
|
|
|
1886
1892
|
return {
|
|
1887
1893
|
accounts: keys,
|
|
1888
1894
|
programAddress: this.programId,
|
|
1889
|
-
data: (0, instruction_models_1.depositData)(7, args.tokenId, amount * this.tokenDec(args.tokenId), slot, refId
|
|
1895
|
+
data: (0, instruction_models_1.depositData)(7, 0, allFunds, args.tokenId, amount * this.tokenDec(args.tokenId), slot, refId)
|
|
1890
1896
|
};
|
|
1891
1897
|
}
|
|
1892
1898
|
});
|
|
@@ -2248,13 +2254,16 @@ class Engine {
|
|
|
2248
2254
|
tag: types_1.AccountType.PERP_CLIENT_INFOS5
|
|
2249
2255
|
}), role: kit_1.AccountRole.WRITABLE
|
|
2250
2256
|
},
|
|
2257
|
+
/*
|
|
2251
2258
|
{
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2259
|
+
address: await this.getInstrAccountByTag(
|
|
2260
|
+
{
|
|
2261
|
+
assetTokenId: instr.header.assetTokenId,
|
|
2262
|
+
crncyTokenId: instr.header.crncyTokenId,
|
|
2263
|
+
tag: AccountType.PERP_CLIENT_ACCOUNTS
|
|
2264
|
+
}), role: AccountRole.WRITABLE
|
|
2257
2265
|
},
|
|
2266
|
+
*/
|
|
2258
2267
|
{
|
|
2259
2268
|
address: yield this.getInstrAccountByTag({
|
|
2260
2269
|
assetTokenId: instr.header.assetTokenId,
|
|
@@ -2276,13 +2285,16 @@ class Engine {
|
|
|
2276
2285
|
tag: types_1.AccountType.PERP_REBALANCE_TIME_TREE
|
|
2277
2286
|
}), role: kit_1.AccountRole.WRITABLE
|
|
2278
2287
|
},
|
|
2288
|
+
/*
|
|
2279
2289
|
{
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2290
|
+
address: await this.getInstrAccountByTag(
|
|
2291
|
+
{
|
|
2292
|
+
assetTokenId: instr.header.assetTokenId,
|
|
2293
|
+
crncyTokenId: instr.header.crncyTokenId,
|
|
2294
|
+
tag: AccountType.PERP_PRIORITY_TREE
|
|
2295
|
+
}), role: AccountRole.WRITABLE
|
|
2285
2296
|
},
|
|
2297
|
+
*/
|
|
2286
2298
|
];
|
|
2287
2299
|
const upgradeIx = {
|
|
2288
2300
|
accounts: keys,
|
|
@@ -2653,13 +2665,16 @@ class Engine {
|
|
|
2653
2665
|
tag: types_1.AccountType.SPOT_CLIENT_INFOS2
|
|
2654
2666
|
}), role: kit_1.AccountRole.WRITABLE
|
|
2655
2667
|
},
|
|
2668
|
+
/*
|
|
2656
2669
|
{
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2670
|
+
address: await this.getInstrAccountByTag(
|
|
2671
|
+
{
|
|
2672
|
+
assetTokenId: assetTokenId,
|
|
2673
|
+
crncyTokenId: crncyTokenId,
|
|
2674
|
+
tag: AccountType.SPOT_CLIENT_ACCOUNTS
|
|
2675
|
+
}), role: AccountRole.WRITABLE
|
|
2662
2676
|
},
|
|
2677
|
+
*/
|
|
2663
2678
|
{
|
|
2664
2679
|
address: yield this.getInstrAccountByTag({
|
|
2665
2680
|
assetTokenId: assetTokenId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
export declare function newOperatorData(tag: number, version: number): Buffer;
|
|
4
|
-
export declare function newRootAccountData(tag: number, lutSlot: number): Buffer;
|
|
4
|
+
export declare function newRootAccountData(tag: number, version: number, lutSlot: number): Buffer;
|
|
5
5
|
export declare function newSpotOrderData(tag: number, ioc: number, orderType: number, side: number, instrId: number, price: number, amount: number): Buffer;
|
|
6
6
|
export declare function newPerpOrderData(tag: number, ioc: number, leverage: number, orderType: number, side: number, instrId: number, price: number, amount: number): Buffer;
|
|
7
7
|
export declare function perpChangeLeverageData(tag: number, leverage: number, instrId: number): Buffer;
|
|
@@ -10,7 +10,7 @@ export declare function spotOrderCancelData(tag: number, side: number, instrId:
|
|
|
10
10
|
export declare function spotMassCancelData(tag: number, instrId: number): Buffer;
|
|
11
11
|
export declare function spotLpData(tag: number, side: number, instrId: number, amount: number): Buffer;
|
|
12
12
|
export declare function newInstrumentData(tag: number, crncyTokenId: number, lutSlot: number, price: number): Buffer;
|
|
13
|
-
export declare function depositData(tag: number, tokenId: number, amount: number, lutSlot: number, refId: number
|
|
13
|
+
export declare function depositData(tag: number, competitionId: number, depositAll: number, tokenId: number, amount: number, lutSlot: number, refId: number): Buffer;
|
|
14
14
|
export declare function feesDepositData(tag: number, tokenId: number, amount: number): Buffer;
|
|
15
15
|
export declare function feesWithdrawData(tag: number, tokenId: number, amount: number): Buffer;
|
|
16
16
|
export declare function perpDepositData(tag: number, instrId: number, amount: number): Buffer;
|
|
@@ -23,10 +23,12 @@ export declare function perpQuotesReplaceData(tag: number, instrId: number, newB
|
|
|
23
23
|
export declare function votingData(tag: number, choice: number, votingCounter: number): Buffer;
|
|
24
24
|
export declare function airdropData(tag: number, ratio: number): Buffer;
|
|
25
25
|
export declare function upgradeToPerpData(tag: number, instrId: number): Buffer;
|
|
26
|
-
export declare function setInstrOracleFeedData(tag: number, instrId: number): Buffer;
|
|
26
|
+
export declare function setInstrOracleFeedData(tag: number, instrId: number, variance: number): Buffer;
|
|
27
27
|
export declare function setInstrReadyForPerpUpgradeData(tag: number, instrId: number): Buffer;
|
|
28
|
-
export declare function newTokenData(tag: number, crncy: number): Buffer;
|
|
28
|
+
export declare function newTokenData(tag: number, crncy: number, needInitialization: number): Buffer;
|
|
29
29
|
export declare function perpOrderCancelData(tag: number, side: number, instrId: number, orderId: number): Buffer;
|
|
30
30
|
export declare function perpMassCancelData(tag: number, instrId: number): Buffer;
|
|
31
31
|
export declare function perpForcedCloseData(tag: number, instrId: number): Buffer;
|
|
32
32
|
export declare function changeRefProgramData(tag: number, refProgramDuration: number, refLinkDuration: number, refDiscount: number, refRatio: number): Buffer;
|
|
33
|
+
export declare function buyMarketSeatData(tag: number, instrId: number, amount: number): Buffer;
|
|
34
|
+
export declare function sellMarketSeatData(tag: number, instrId: number): Buffer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.changeRefProgramData = exports.perpForcedCloseData = exports.perpMassCancelData = exports.perpOrderCancelData = exports.newTokenData = exports.setInstrReadyForPerpUpgradeData = exports.setInstrOracleFeedData = exports.upgradeToPerpData = exports.airdropData = exports.votingData = exports.perpQuotesReplaceData = exports.spotQuotesReplaceData = exports.swapData = exports.withdrawData = exports.perpWithdrawData = exports.moveSpotAvailFundsData = exports.perpDepositData = exports.feesWithdrawData = exports.feesDepositData = exports.depositData = exports.newInstrumentData = exports.spotLpData = exports.spotMassCancelData = exports.spotOrderCancelData = exports.perpStatisticsResetData = exports.perpChangeLeverageData = exports.newPerpOrderData = exports.newSpotOrderData = exports.newRootAccountData = exports.newOperatorData = void 0;
|
|
3
|
+
exports.sellMarketSeatData = exports.buyMarketSeatData = exports.changeRefProgramData = exports.perpForcedCloseData = exports.perpMassCancelData = exports.perpOrderCancelData = exports.newTokenData = exports.setInstrReadyForPerpUpgradeData = exports.setInstrOracleFeedData = exports.upgradeToPerpData = exports.airdropData = exports.votingData = exports.perpQuotesReplaceData = exports.spotQuotesReplaceData = exports.swapData = exports.withdrawData = exports.perpWithdrawData = exports.moveSpotAvailFundsData = exports.perpDepositData = exports.feesWithdrawData = exports.feesDepositData = exports.depositData = exports.newInstrumentData = exports.spotLpData = exports.spotMassCancelData = exports.spotOrderCancelData = exports.perpStatisticsResetData = exports.perpChangeLeverageData = exports.newPerpOrderData = exports.newSpotOrderData = exports.newRootAccountData = exports.newOperatorData = void 0;
|
|
4
4
|
function newOperatorData(tag, version) {
|
|
5
5
|
let buf = Buffer.alloc(8);
|
|
6
6
|
buf.writeUint8(tag, 0);
|
|
@@ -10,12 +10,13 @@ function newOperatorData(tag, version) {
|
|
|
10
10
|
return buf;
|
|
11
11
|
}
|
|
12
12
|
exports.newOperatorData = newOperatorData;
|
|
13
|
-
function newRootAccountData(tag, lutSlot) {
|
|
14
|
-
let buf = Buffer.alloc(
|
|
13
|
+
function newRootAccountData(tag, version, lutSlot) {
|
|
14
|
+
let buf = Buffer.alloc(12);
|
|
15
15
|
buf.writeUint8(tag, 0);
|
|
16
16
|
buf.writeUint8(0, 1);
|
|
17
17
|
buf.writeUint16LE(0, 2);
|
|
18
|
-
buf.writeUint32LE(
|
|
18
|
+
buf.writeUint32LE(version, 4);
|
|
19
|
+
buf.writeUint32LE(lutSlot, 8);
|
|
19
20
|
return buf;
|
|
20
21
|
}
|
|
21
22
|
exports.newRootAccountData = newRootAccountData;
|
|
@@ -26,8 +27,8 @@ function newSpotOrderData(tag, ioc, orderType, side, instrId, price, amount) {
|
|
|
26
27
|
buf.writeUint8(orderType, 2);
|
|
27
28
|
buf.writeUint8(side, 3);
|
|
28
29
|
buf.writeUint32LE(instrId, 4);
|
|
29
|
-
buf.writeBigInt64LE(BigInt(
|
|
30
|
-
buf.writeBigInt64LE(BigInt(
|
|
30
|
+
buf.writeBigInt64LE(BigInt(price), 8);
|
|
31
|
+
buf.writeBigInt64LE(BigInt(amount), 16);
|
|
31
32
|
return buf;
|
|
32
33
|
}
|
|
33
34
|
exports.newSpotOrderData = newSpotOrderData;
|
|
@@ -42,8 +43,8 @@ function newPerpOrderData(tag, ioc, leverage, orderType, side, instrId, price, a
|
|
|
42
43
|
buf.writeUint16LE(0, 6);
|
|
43
44
|
buf.writeUint32LE(0, 8);
|
|
44
45
|
buf.writeUint32LE(instrId, 12);
|
|
45
|
-
buf.writeBigInt64LE(BigInt(
|
|
46
|
-
buf.writeBigInt64LE(BigInt(
|
|
46
|
+
buf.writeBigInt64LE(BigInt(price), 16);
|
|
47
|
+
buf.writeBigInt64LE(BigInt(amount), 24);
|
|
47
48
|
return buf;
|
|
48
49
|
}
|
|
49
50
|
exports.newPerpOrderData = newPerpOrderData;
|
|
@@ -71,7 +72,7 @@ function spotOrderCancelData(tag, side, instrId, orderId) {
|
|
|
71
72
|
buf.writeUint8(side, 1);
|
|
72
73
|
buf.writeUint16LE(0, 2);
|
|
73
74
|
buf.writeUint32LE(instrId, 4);
|
|
74
|
-
buf.writeBigInt64LE(BigInt(
|
|
75
|
+
buf.writeBigInt64LE(BigInt(orderId), 8);
|
|
75
76
|
return buf;
|
|
76
77
|
}
|
|
77
78
|
exports.spotOrderCancelData = spotOrderCancelData;
|
|
@@ -90,7 +91,7 @@ function spotLpData(tag, side, instrId, amount) {
|
|
|
90
91
|
buf.writeUint8(side, 1);
|
|
91
92
|
buf.writeUint16LE(0, 2);
|
|
92
93
|
buf.writeUint32LE(instrId, 4);
|
|
93
|
-
buf.writeBigInt64LE(BigInt(
|
|
94
|
+
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
94
95
|
return buf;
|
|
95
96
|
}
|
|
96
97
|
exports.spotLpData = spotLpData;
|
|
@@ -102,17 +103,18 @@ function newInstrumentData(tag, crncyTokenId, lutSlot, price) {
|
|
|
102
103
|
buf.writeUint32LE(0, 4);
|
|
103
104
|
buf.writeUint32LE(crncyTokenId, 8);
|
|
104
105
|
buf.writeUint32LE(lutSlot, 12);
|
|
105
|
-
buf.writeBigInt64LE(BigInt(
|
|
106
|
+
buf.writeBigInt64LE(BigInt(price), 16);
|
|
106
107
|
return buf;
|
|
107
108
|
}
|
|
108
109
|
exports.newInstrumentData = newInstrumentData;
|
|
109
|
-
function depositData(tag, tokenId, amount, lutSlot, refId
|
|
110
|
+
function depositData(tag, competitionId, depositAll, tokenId, amount, lutSlot, refId) {
|
|
110
111
|
let buf = Buffer.alloc(24);
|
|
111
112
|
buf.writeUint8(tag, 0);
|
|
112
|
-
buf.writeUint8(
|
|
113
|
-
buf.
|
|
113
|
+
buf.writeUint8(competitionId, 1);
|
|
114
|
+
buf.writeUint8(depositAll, 2);
|
|
115
|
+
buf.writeUint8(0, 3);
|
|
114
116
|
buf.writeUint32LE(tokenId, 4);
|
|
115
|
-
buf.writeBigInt64LE(BigInt(
|
|
117
|
+
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
116
118
|
buf.writeUint32LE(lutSlot, 16);
|
|
117
119
|
buf.writeUint32LE(refId, 20);
|
|
118
120
|
return buf;
|
|
@@ -124,7 +126,7 @@ function feesDepositData(tag, tokenId, amount) {
|
|
|
124
126
|
buf.writeUint8(0, 1);
|
|
125
127
|
buf.writeUint16LE(0, 2);
|
|
126
128
|
buf.writeUint32LE(tokenId, 4);
|
|
127
|
-
buf.writeBigInt64LE(BigInt(
|
|
129
|
+
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
128
130
|
return buf;
|
|
129
131
|
}
|
|
130
132
|
exports.feesDepositData = feesDepositData;
|
|
@@ -134,7 +136,7 @@ function feesWithdrawData(tag, tokenId, amount) {
|
|
|
134
136
|
buf.writeUint8(0, 1);
|
|
135
137
|
buf.writeUint16LE(0, 2);
|
|
136
138
|
buf.writeUint32LE(tokenId, 4);
|
|
137
|
-
buf.writeBigInt64LE(BigInt(
|
|
139
|
+
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
138
140
|
return buf;
|
|
139
141
|
}
|
|
140
142
|
exports.feesWithdrawData = feesWithdrawData;
|
|
@@ -144,7 +146,7 @@ function perpDepositData(tag, instrId, amount) {
|
|
|
144
146
|
buf.writeUint8(0, 1);
|
|
145
147
|
buf.writeUint16LE(0, 2);
|
|
146
148
|
buf.writeUint32LE(instrId, 4);
|
|
147
|
-
buf.writeBigInt64LE(BigInt(
|
|
149
|
+
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
148
150
|
return buf;
|
|
149
151
|
}
|
|
150
152
|
exports.perpDepositData = perpDepositData;
|
|
@@ -163,7 +165,7 @@ function perpWithdrawData(tag, instrId, amount) {
|
|
|
163
165
|
buf.writeUint8(0, 1);
|
|
164
166
|
buf.writeUint16LE(0, 2);
|
|
165
167
|
buf.writeUint32LE(instrId, 4);
|
|
166
|
-
buf.writeBigInt64LE(BigInt(
|
|
168
|
+
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
167
169
|
return buf;
|
|
168
170
|
}
|
|
169
171
|
exports.perpWithdrawData = perpWithdrawData;
|
|
@@ -173,7 +175,7 @@ function withdrawData(tag, tokenId, amount) {
|
|
|
173
175
|
buf.writeUint8(0, 1);
|
|
174
176
|
buf.writeUint16LE(0, 2);
|
|
175
177
|
buf.writeUint32LE(tokenId, 4);
|
|
176
|
-
buf.writeBigInt64LE(BigInt(
|
|
178
|
+
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
177
179
|
return buf;
|
|
178
180
|
}
|
|
179
181
|
exports.withdrawData = withdrawData;
|
|
@@ -183,8 +185,8 @@ function swapData(tag, side, instrId, price, amount) {
|
|
|
183
185
|
buf.writeUint8(side, 1);
|
|
184
186
|
buf.writeUint16LE(0, 2);
|
|
185
187
|
buf.writeUint32LE(instrId, 4);
|
|
186
|
-
buf.writeBigInt64LE(BigInt(
|
|
187
|
-
buf.writeBigInt64LE(BigInt(
|
|
188
|
+
buf.writeBigInt64LE(BigInt(price), 8);
|
|
189
|
+
buf.writeBigInt64LE(BigInt(amount), 16);
|
|
188
190
|
return buf;
|
|
189
191
|
}
|
|
190
192
|
exports.swapData = swapData;
|
|
@@ -194,12 +196,12 @@ function spotQuotesReplaceData(tag, instrId, newBidPrice, newBidQty, oldBidOrder
|
|
|
194
196
|
buf.writeUint8(0, 1);
|
|
195
197
|
buf.writeUint16LE(0, 2);
|
|
196
198
|
buf.writeUint32LE(instrId, 4);
|
|
197
|
-
buf.writeBigInt64LE(BigInt(
|
|
198
|
-
buf.writeBigInt64LE(BigInt(
|
|
199
|
-
buf.writeBigInt64LE(BigInt(
|
|
200
|
-
buf.writeBigInt64LE(BigInt(
|
|
201
|
-
buf.writeBigInt64LE(BigInt(
|
|
202
|
-
buf.writeBigInt64LE(BigInt(
|
|
199
|
+
buf.writeBigInt64LE(BigInt(newBidPrice), 8);
|
|
200
|
+
buf.writeBigInt64LE(BigInt(newBidQty), 16);
|
|
201
|
+
buf.writeBigInt64LE(BigInt(oldBidOrderId), 24);
|
|
202
|
+
buf.writeBigInt64LE(BigInt(newAskPrice), 32);
|
|
203
|
+
buf.writeBigInt64LE(BigInt(newAskQty), 40);
|
|
204
|
+
buf.writeBigInt64LE(BigInt(oldAskOrderId), 48);
|
|
203
205
|
return buf;
|
|
204
206
|
}
|
|
205
207
|
exports.spotQuotesReplaceData = spotQuotesReplaceData;
|
|
@@ -209,12 +211,12 @@ function perpQuotesReplaceData(tag, instrId, newBidPrice, newBidQty, oldBidOrder
|
|
|
209
211
|
buf.writeUint8(0, 1);
|
|
210
212
|
buf.writeUint16LE(0, 2);
|
|
211
213
|
buf.writeUint32LE(instrId, 4);
|
|
212
|
-
buf.writeBigInt64LE(BigInt(
|
|
213
|
-
buf.writeBigInt64LE(BigInt(
|
|
214
|
-
buf.writeBigInt64LE(BigInt(
|
|
215
|
-
buf.writeBigInt64LE(BigInt(
|
|
216
|
-
buf.writeBigInt64LE(BigInt(
|
|
217
|
-
buf.writeBigInt64LE(BigInt(
|
|
214
|
+
buf.writeBigInt64LE(BigInt(newBidPrice), 8);
|
|
215
|
+
buf.writeBigInt64LE(BigInt(newBidQty), 16);
|
|
216
|
+
buf.writeBigInt64LE(BigInt(oldBidOrderId), 24);
|
|
217
|
+
buf.writeBigInt64LE(BigInt(newAskPrice), 32);
|
|
218
|
+
buf.writeBigInt64LE(BigInt(newAskQty), 40);
|
|
219
|
+
buf.writeBigInt64LE(BigInt(oldAskOrderId), 48);
|
|
218
220
|
return buf;
|
|
219
221
|
}
|
|
220
222
|
exports.perpQuotesReplaceData = perpQuotesReplaceData;
|
|
@@ -245,8 +247,8 @@ function upgradeToPerpData(tag, instrId) {
|
|
|
245
247
|
return buf;
|
|
246
248
|
}
|
|
247
249
|
exports.upgradeToPerpData = upgradeToPerpData;
|
|
248
|
-
function setInstrOracleFeedData(tag, instrId) {
|
|
249
|
-
let buf = Buffer.alloc(
|
|
250
|
+
function setInstrOracleFeedData(tag, instrId, variance) {
|
|
251
|
+
let buf = Buffer.alloc(16);
|
|
250
252
|
buf.writeUint8(tag, 0);
|
|
251
253
|
buf.writeUint8(0, 1);
|
|
252
254
|
buf.writeUint16LE(0, 2);
|
|
@@ -263,11 +265,12 @@ function setInstrReadyForPerpUpgradeData(tag, instrId) {
|
|
|
263
265
|
return buf;
|
|
264
266
|
}
|
|
265
267
|
exports.setInstrReadyForPerpUpgradeData = setInstrReadyForPerpUpgradeData;
|
|
266
|
-
function newTokenData(tag, crncy) {
|
|
268
|
+
function newTokenData(tag, crncy, needInitialization) {
|
|
267
269
|
let buf = Buffer.alloc(8);
|
|
268
270
|
buf.writeUint8(tag, 0);
|
|
269
271
|
buf.writeUint8(crncy, 1);
|
|
270
|
-
buf.
|
|
272
|
+
buf.writeUint8(needInitialization, 2);
|
|
273
|
+
buf.writeUint8(0, 3);
|
|
271
274
|
buf.writeUint32LE(0, 4);
|
|
272
275
|
return buf;
|
|
273
276
|
}
|
|
@@ -278,7 +281,7 @@ function perpOrderCancelData(tag, side, instrId, orderId) {
|
|
|
278
281
|
buf.writeUint8(side, 1);
|
|
279
282
|
buf.writeUint16LE(0, 2);
|
|
280
283
|
buf.writeUint32LE(instrId, 4);
|
|
281
|
-
buf.writeBigInt64LE(BigInt(
|
|
284
|
+
buf.writeBigInt64LE(BigInt(orderId), 8);
|
|
282
285
|
return buf;
|
|
283
286
|
}
|
|
284
287
|
exports.perpOrderCancelData = perpOrderCancelData;
|
|
@@ -311,3 +314,22 @@ function changeRefProgramData(tag, refProgramDuration, refLinkDuration, refDisco
|
|
|
311
314
|
return buf;
|
|
312
315
|
}
|
|
313
316
|
exports.changeRefProgramData = changeRefProgramData;
|
|
317
|
+
function buyMarketSeatData(tag, instrId, amount) {
|
|
318
|
+
let buf = Buffer.alloc(16);
|
|
319
|
+
buf.writeUint8(tag, 0);
|
|
320
|
+
buf.writeUint8(0, 1);
|
|
321
|
+
buf.writeUint16LE(0, 2);
|
|
322
|
+
buf.writeUint32LE(instrId, 4);
|
|
323
|
+
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
324
|
+
return buf;
|
|
325
|
+
}
|
|
326
|
+
exports.buyMarketSeatData = buyMarketSeatData;
|
|
327
|
+
function sellMarketSeatData(tag, instrId) {
|
|
328
|
+
let buf = Buffer.alloc(8);
|
|
329
|
+
buf.writeUint8(tag, 0);
|
|
330
|
+
buf.writeUint8(0, 1);
|
|
331
|
+
buf.writeUint16LE(0, 2);
|
|
332
|
+
buf.writeUint32LE(instrId, 4);
|
|
333
|
+
return buf;
|
|
334
|
+
}
|
|
335
|
+
exports.sellMarketSeatData = sellMarketSeatData;
|
package/dist/logs_models.d.ts
CHANGED
|
@@ -28,7 +28,9 @@ export declare enum LogType {
|
|
|
28
28
|
perpPlaceMassCancel = 25,
|
|
29
29
|
perpMassCancel = 26,
|
|
30
30
|
perpSocLoss = 27,
|
|
31
|
-
perpChangeLeverage = 28
|
|
31
|
+
perpChangeLeverage = 28,
|
|
32
|
+
buyMarketSeat = 29,
|
|
33
|
+
sellMarketSeat = 30
|
|
32
34
|
}
|
|
33
35
|
export declare class PerpChangeLeverageReportModel {
|
|
34
36
|
static readonly LENGTH: number;
|
|
@@ -126,6 +128,36 @@ export declare class PerpDepositReportModel {
|
|
|
126
128
|
amount: number;
|
|
127
129
|
static fromBuffer(buffer: Buffer, offset?: number): PerpDepositReportModel;
|
|
128
130
|
}
|
|
131
|
+
export declare class BuyMarketSeatReportModel {
|
|
132
|
+
static readonly LENGTH: number;
|
|
133
|
+
static readonly OFFSET_TAG = 0;
|
|
134
|
+
static readonly OFFSET_CLIENT_ID = 4;
|
|
135
|
+
static readonly OFFSET_INSTR_ID = 8;
|
|
136
|
+
static readonly OFFSET_TIME = 12;
|
|
137
|
+
static readonly OFFSET_AMOUNT = 16;
|
|
138
|
+
static readonly OFFSET_SEAT_PRICE = 24;
|
|
139
|
+
tag: number;
|
|
140
|
+
clientId: number;
|
|
141
|
+
instrId: number;
|
|
142
|
+
time: number;
|
|
143
|
+
amount: number;
|
|
144
|
+
seatPrice: number;
|
|
145
|
+
static fromBuffer(buffer: Buffer, offset?: number): BuyMarketSeatReportModel;
|
|
146
|
+
}
|
|
147
|
+
export declare class SellMarketSeatReportModel {
|
|
148
|
+
static readonly LENGTH: number;
|
|
149
|
+
static readonly OFFSET_TAG = 0;
|
|
150
|
+
static readonly OFFSET_CLIENT_ID = 4;
|
|
151
|
+
static readonly OFFSET_INSTR_ID = 8;
|
|
152
|
+
static readonly OFFSET_TIME = 12;
|
|
153
|
+
static readonly OFFSET_SEAT_PRICE = 16;
|
|
154
|
+
tag: number;
|
|
155
|
+
clientId: number;
|
|
156
|
+
instrId: number;
|
|
157
|
+
time: number;
|
|
158
|
+
seatPrice: number;
|
|
159
|
+
static fromBuffer(buffer: Buffer, offset?: number): SellMarketSeatReportModel;
|
|
160
|
+
}
|
|
129
161
|
export declare class WithdrawReportModel {
|
|
130
162
|
static readonly LENGTH: number;
|
|
131
163
|
static readonly OFFSET_TAG = 0;
|
package/dist/logs_models.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SpotOrderRevokeReportModel = exports.PerpOrderRevokeReportModel = exports.SpotOrderCancelReportModel = exports.PerpOrderCancelReportModel = exports.SpotNewOrderReportModel = exports.PerpNewOrderReportModel = exports.PerpSocLossReportModel = exports.PerpFundingReportModel = exports.SpotFeesReportModel = exports.PerpFeesReportModel = exports.SpotMassCancelReportModel = exports.PerpMassCancelReportModel = exports.SpotPlaceMassCancelReportModel = exports.PerpPlaceMassCancelReportModel = exports.SpotPlaceOrderReportModel = exports.PerpPlaceOrderReportModel = exports.SpotFillOrderReportModel = exports.PerpFillOrderReportModel = exports.SpotlpTradeReportModel = exports.PerpWithdrawReportModel = exports.WithdrawReportModel = exports.PerpDepositReportModel = exports.FeesWithdrawReportModel = exports.FeesDepositReportModel = exports.DepositReportModel = exports.EarningsReportModel = exports.DrvsAirdropReportModel = exports.PerpChangeLeverageReportModel = exports.LogType = void 0;
|
|
3
|
+
exports.SpotOrderRevokeReportModel = exports.PerpOrderRevokeReportModel = exports.SpotOrderCancelReportModel = exports.PerpOrderCancelReportModel = exports.SpotNewOrderReportModel = exports.PerpNewOrderReportModel = exports.PerpSocLossReportModel = exports.PerpFundingReportModel = exports.SpotFeesReportModel = exports.PerpFeesReportModel = exports.SpotMassCancelReportModel = exports.PerpMassCancelReportModel = exports.SpotPlaceMassCancelReportModel = exports.PerpPlaceMassCancelReportModel = exports.SpotPlaceOrderReportModel = exports.PerpPlaceOrderReportModel = exports.SpotFillOrderReportModel = exports.PerpFillOrderReportModel = exports.SpotlpTradeReportModel = exports.PerpWithdrawReportModel = exports.WithdrawReportModel = exports.SellMarketSeatReportModel = exports.BuyMarketSeatReportModel = exports.PerpDepositReportModel = exports.FeesWithdrawReportModel = exports.FeesDepositReportModel = exports.DepositReportModel = exports.EarningsReportModel = exports.DrvsAirdropReportModel = exports.PerpChangeLeverageReportModel = exports.LogType = void 0;
|
|
4
4
|
const auto_buffer_1 = require("./auto_buffer");
|
|
5
5
|
var LogType;
|
|
6
6
|
(function (LogType) {
|
|
@@ -32,6 +32,8 @@ var LogType;
|
|
|
32
32
|
LogType[LogType["perpMassCancel"] = 26] = "perpMassCancel";
|
|
33
33
|
LogType[LogType["perpSocLoss"] = 27] = "perpSocLoss";
|
|
34
34
|
LogType[LogType["perpChangeLeverage"] = 28] = "perpChangeLeverage";
|
|
35
|
+
LogType[LogType["buyMarketSeat"] = 29] = "buyMarketSeat";
|
|
36
|
+
LogType[LogType["sellMarketSeat"] = 30] = "sellMarketSeat";
|
|
35
37
|
})(LogType || (exports.LogType = LogType = {}));
|
|
36
38
|
class PerpChangeLeverageReportModel {
|
|
37
39
|
static fromBuffer(buffer, offset) {
|
|
@@ -178,6 +180,50 @@ PerpDepositReportModel.OFFSET_CLIENT_ID = 4;
|
|
|
178
180
|
PerpDepositReportModel.OFFSET_INSTR_ID = 8;
|
|
179
181
|
PerpDepositReportModel.OFFSET_TIME = 12;
|
|
180
182
|
PerpDepositReportModel.OFFSET_AMOUNT = 16;
|
|
183
|
+
class BuyMarketSeatReportModel {
|
|
184
|
+
static fromBuffer(buffer, offset) {
|
|
185
|
+
const result = new BuyMarketSeatReportModel();
|
|
186
|
+
let autoBuffer = new auto_buffer_1.AutoBuffer(buffer, offset);
|
|
187
|
+
result.tag = autoBuffer.readU8();
|
|
188
|
+
autoBuffer.readU8();
|
|
189
|
+
autoBuffer.readU16();
|
|
190
|
+
result.clientId = autoBuffer.readU32();
|
|
191
|
+
result.instrId = autoBuffer.readU32();
|
|
192
|
+
result.time = autoBuffer.readU32();
|
|
193
|
+
result.amount = autoBuffer.readI64();
|
|
194
|
+
result.seatPrice = autoBuffer.readI64();
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
exports.BuyMarketSeatReportModel = BuyMarketSeatReportModel;
|
|
199
|
+
BuyMarketSeatReportModel.LENGTH = 2 * 1 + 1 * 2 + 3 * 4 + 2 * 8; // 32 bytes
|
|
200
|
+
BuyMarketSeatReportModel.OFFSET_TAG = 0;
|
|
201
|
+
BuyMarketSeatReportModel.OFFSET_CLIENT_ID = 4;
|
|
202
|
+
BuyMarketSeatReportModel.OFFSET_INSTR_ID = 8;
|
|
203
|
+
BuyMarketSeatReportModel.OFFSET_TIME = 12;
|
|
204
|
+
BuyMarketSeatReportModel.OFFSET_AMOUNT = 16;
|
|
205
|
+
BuyMarketSeatReportModel.OFFSET_SEAT_PRICE = 24;
|
|
206
|
+
class SellMarketSeatReportModel {
|
|
207
|
+
static fromBuffer(buffer, offset) {
|
|
208
|
+
const result = new SellMarketSeatReportModel();
|
|
209
|
+
let autoBuffer = new auto_buffer_1.AutoBuffer(buffer, offset);
|
|
210
|
+
result.tag = autoBuffer.readU8();
|
|
211
|
+
autoBuffer.readU8();
|
|
212
|
+
autoBuffer.readU16();
|
|
213
|
+
result.clientId = autoBuffer.readU32();
|
|
214
|
+
result.instrId = autoBuffer.readU32();
|
|
215
|
+
result.time = autoBuffer.readU32();
|
|
216
|
+
result.seatPrice = autoBuffer.readI64();
|
|
217
|
+
return result;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
exports.SellMarketSeatReportModel = SellMarketSeatReportModel;
|
|
221
|
+
SellMarketSeatReportModel.LENGTH = 2 * 1 + 1 * 2 + 3 * 4 + 1 * 8; // 24 bytes
|
|
222
|
+
SellMarketSeatReportModel.OFFSET_TAG = 0;
|
|
223
|
+
SellMarketSeatReportModel.OFFSET_CLIENT_ID = 4;
|
|
224
|
+
SellMarketSeatReportModel.OFFSET_INSTR_ID = 8;
|
|
225
|
+
SellMarketSeatReportModel.OFFSET_TIME = 12;
|
|
226
|
+
SellMarketSeatReportModel.OFFSET_SEAT_PRICE = 16;
|
|
181
227
|
class WithdrawReportModel {
|
|
182
228
|
static fromBuffer(buffer, offset) {
|
|
183
229
|
const result = new WithdrawReportModel();
|