@deriverse/kit 1.0.21 → 1.0.23
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/README.md +2 -4
- package/dist/instruction_models.js +28 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,11 +37,9 @@ Based on [`@solana/kit`](https://www.npmjs.com/package/@solana/kit)
|
|
|
37
37
|
npm install @deriverse/kit
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
## Documentation
|
|
41
|
-
TODO
|
|
42
|
-
|
|
43
40
|
## Examples
|
|
44
|
-
|
|
41
|
+
|
|
42
|
+
We prepared a comprehensive example that is available here: https://github.com/deriverse/kit-example
|
|
45
43
|
|
|
46
44
|
## Development
|
|
47
45
|
|
|
@@ -26,8 +26,8 @@ function newSpotOrderData(tag, ioc, orderType, side, instrId, price, amount) {
|
|
|
26
26
|
buf.writeUint8(orderType, 2);
|
|
27
27
|
buf.writeUint8(side, 3);
|
|
28
28
|
buf.writeUint32LE(instrId, 4);
|
|
29
|
-
buf.writeBigInt64LE(BigInt(price), 8);
|
|
30
|
-
buf.writeBigInt64LE(BigInt(amount), 16);
|
|
29
|
+
buf.writeBigInt64LE(BigInt(Math.round(price)), 8);
|
|
30
|
+
buf.writeBigInt64LE(BigInt(Math.round(amount)), 16);
|
|
31
31
|
return buf;
|
|
32
32
|
}
|
|
33
33
|
exports.newSpotOrderData = newSpotOrderData;
|
|
@@ -42,8 +42,8 @@ function newPerpOrderData(tag, ioc, leverage, orderType, side, instrId, price, a
|
|
|
42
42
|
buf.writeUint16LE(0, 6);
|
|
43
43
|
buf.writeUint32LE(0, 8);
|
|
44
44
|
buf.writeUint32LE(instrId, 12);
|
|
45
|
-
buf.writeBigInt64LE(BigInt(price), 16);
|
|
46
|
-
buf.writeBigInt64LE(BigInt(amount), 24);
|
|
45
|
+
buf.writeBigInt64LE(BigInt(Math.round(price)), 16);
|
|
46
|
+
buf.writeBigInt64LE(BigInt(Math.round(amount)), 24);
|
|
47
47
|
return buf;
|
|
48
48
|
}
|
|
49
49
|
exports.newPerpOrderData = newPerpOrderData;
|
|
@@ -71,7 +71,7 @@ function spotOrderCancelData(tag, side, instrId, orderId) {
|
|
|
71
71
|
buf.writeUint8(side, 1);
|
|
72
72
|
buf.writeUint16LE(0, 2);
|
|
73
73
|
buf.writeUint32LE(instrId, 4);
|
|
74
|
-
buf.writeBigInt64LE(BigInt(orderId), 8);
|
|
74
|
+
buf.writeBigInt64LE(BigInt(Math.round(orderId)), 8);
|
|
75
75
|
return buf;
|
|
76
76
|
}
|
|
77
77
|
exports.spotOrderCancelData = spotOrderCancelData;
|
|
@@ -90,7 +90,7 @@ function spotLpData(tag, side, instrId, amount) {
|
|
|
90
90
|
buf.writeUint8(side, 1);
|
|
91
91
|
buf.writeUint16LE(0, 2);
|
|
92
92
|
buf.writeUint32LE(instrId, 4);
|
|
93
|
-
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
93
|
+
buf.writeBigInt64LE(BigInt(Math.round(amount)), 8);
|
|
94
94
|
return buf;
|
|
95
95
|
}
|
|
96
96
|
exports.spotLpData = spotLpData;
|
|
@@ -102,7 +102,7 @@ function newInstrumentData(tag, crncyTokenId, lutSlot, price) {
|
|
|
102
102
|
buf.writeUint32LE(0, 4);
|
|
103
103
|
buf.writeUint32LE(crncyTokenId, 8);
|
|
104
104
|
buf.writeUint32LE(lutSlot, 12);
|
|
105
|
-
buf.writeBigInt64LE(BigInt(price), 16);
|
|
105
|
+
buf.writeBigInt64LE(BigInt(Math.round(price)), 16);
|
|
106
106
|
return buf;
|
|
107
107
|
}
|
|
108
108
|
exports.newInstrumentData = newInstrumentData;
|
|
@@ -112,7 +112,7 @@ function depositData(tag, tokenId, amount, lutSlot, refId, allFunds) {
|
|
|
112
112
|
buf.writeUint8(0, 1);
|
|
113
113
|
buf.writeUint16LE(allFunds ? 1 : 0, 2);
|
|
114
114
|
buf.writeUint32LE(tokenId, 4);
|
|
115
|
-
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
115
|
+
buf.writeBigInt64LE(BigInt(Math.round(amount)), 8);
|
|
116
116
|
buf.writeUint32LE(lutSlot, 16);
|
|
117
117
|
buf.writeUint32LE(refId, 20);
|
|
118
118
|
return buf;
|
|
@@ -124,7 +124,7 @@ function feesDepositData(tag, tokenId, amount) {
|
|
|
124
124
|
buf.writeUint8(0, 1);
|
|
125
125
|
buf.writeUint16LE(0, 2);
|
|
126
126
|
buf.writeUint32LE(tokenId, 4);
|
|
127
|
-
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
127
|
+
buf.writeBigInt64LE(BigInt(Math.round(amount)), 8);
|
|
128
128
|
return buf;
|
|
129
129
|
}
|
|
130
130
|
exports.feesDepositData = feesDepositData;
|
|
@@ -134,7 +134,7 @@ function feesWithdrawData(tag, tokenId, amount) {
|
|
|
134
134
|
buf.writeUint8(0, 1);
|
|
135
135
|
buf.writeUint16LE(0, 2);
|
|
136
136
|
buf.writeUint32LE(tokenId, 4);
|
|
137
|
-
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
137
|
+
buf.writeBigInt64LE(BigInt(Math.round(amount)), 8);
|
|
138
138
|
return buf;
|
|
139
139
|
}
|
|
140
140
|
exports.feesWithdrawData = feesWithdrawData;
|
|
@@ -144,7 +144,7 @@ function perpDepositData(tag, instrId, amount) {
|
|
|
144
144
|
buf.writeUint8(0, 1);
|
|
145
145
|
buf.writeUint16LE(0, 2);
|
|
146
146
|
buf.writeUint32LE(instrId, 4);
|
|
147
|
-
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
147
|
+
buf.writeBigInt64LE(BigInt(Math.round(amount)), 8);
|
|
148
148
|
return buf;
|
|
149
149
|
}
|
|
150
150
|
exports.perpDepositData = perpDepositData;
|
|
@@ -163,7 +163,7 @@ function perpWithdrawData(tag, instrId, amount) {
|
|
|
163
163
|
buf.writeUint8(0, 1);
|
|
164
164
|
buf.writeUint16LE(0, 2);
|
|
165
165
|
buf.writeUint32LE(instrId, 4);
|
|
166
|
-
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
166
|
+
buf.writeBigInt64LE(BigInt(Math.round(amount)), 8);
|
|
167
167
|
return buf;
|
|
168
168
|
}
|
|
169
169
|
exports.perpWithdrawData = perpWithdrawData;
|
|
@@ -173,7 +173,7 @@ function withdrawData(tag, tokenId, amount) {
|
|
|
173
173
|
buf.writeUint8(0, 1);
|
|
174
174
|
buf.writeUint16LE(0, 2);
|
|
175
175
|
buf.writeUint32LE(tokenId, 4);
|
|
176
|
-
buf.writeBigInt64LE(BigInt(amount), 8);
|
|
176
|
+
buf.writeBigInt64LE(BigInt(Math.round(amount)), 8);
|
|
177
177
|
return buf;
|
|
178
178
|
}
|
|
179
179
|
exports.withdrawData = withdrawData;
|
|
@@ -183,8 +183,8 @@ function swapData(tag, side, instrId, price, amount) {
|
|
|
183
183
|
buf.writeUint8(side, 1);
|
|
184
184
|
buf.writeUint16LE(0, 2);
|
|
185
185
|
buf.writeUint32LE(instrId, 4);
|
|
186
|
-
buf.writeBigInt64LE(BigInt(price), 8);
|
|
187
|
-
buf.writeBigInt64LE(BigInt(amount), 16);
|
|
186
|
+
buf.writeBigInt64LE(BigInt(Math.round(price)), 8);
|
|
187
|
+
buf.writeBigInt64LE(BigInt(Math.round(amount)), 16);
|
|
188
188
|
return buf;
|
|
189
189
|
}
|
|
190
190
|
exports.swapData = swapData;
|
|
@@ -194,12 +194,12 @@ function spotQuotesReplaceData(tag, instrId, newBidPrice, newBidQty, oldBidOrder
|
|
|
194
194
|
buf.writeUint8(0, 1);
|
|
195
195
|
buf.writeUint16LE(0, 2);
|
|
196
196
|
buf.writeUint32LE(instrId, 4);
|
|
197
|
-
buf.writeBigInt64LE(BigInt(newBidPrice), 8);
|
|
198
|
-
buf.writeBigInt64LE(BigInt(newBidQty), 16);
|
|
199
|
-
buf.writeBigInt64LE(BigInt(oldBidOrderId), 24);
|
|
200
|
-
buf.writeBigInt64LE(BigInt(newAskPrice), 32);
|
|
201
|
-
buf.writeBigInt64LE(BigInt(newAskQty), 40);
|
|
202
|
-
buf.writeBigInt64LE(BigInt(oldAskOrderId), 48);
|
|
197
|
+
buf.writeBigInt64LE(BigInt(Math.round(newBidPrice)), 8);
|
|
198
|
+
buf.writeBigInt64LE(BigInt(Math.round(newBidQty)), 16);
|
|
199
|
+
buf.writeBigInt64LE(BigInt(Math.round(oldBidOrderId)), 24);
|
|
200
|
+
buf.writeBigInt64LE(BigInt(Math.round(newAskPrice)), 32);
|
|
201
|
+
buf.writeBigInt64LE(BigInt(Math.round(newAskQty)), 40);
|
|
202
|
+
buf.writeBigInt64LE(BigInt(Math.round(oldAskOrderId)), 48);
|
|
203
203
|
return buf;
|
|
204
204
|
}
|
|
205
205
|
exports.spotQuotesReplaceData = spotQuotesReplaceData;
|
|
@@ -209,12 +209,12 @@ function perpQuotesReplaceData(tag, instrId, newBidPrice, newBidQty, oldBidOrder
|
|
|
209
209
|
buf.writeUint8(0, 1);
|
|
210
210
|
buf.writeUint16LE(0, 2);
|
|
211
211
|
buf.writeUint32LE(instrId, 4);
|
|
212
|
-
buf.writeBigInt64LE(BigInt(newBidPrice), 8);
|
|
213
|
-
buf.writeBigInt64LE(BigInt(newBidQty), 16);
|
|
214
|
-
buf.writeBigInt64LE(BigInt(oldBidOrderId), 24);
|
|
215
|
-
buf.writeBigInt64LE(BigInt(newAskPrice), 32);
|
|
216
|
-
buf.writeBigInt64LE(BigInt(newAskQty), 40);
|
|
217
|
-
buf.writeBigInt64LE(BigInt(oldAskOrderId), 48);
|
|
212
|
+
buf.writeBigInt64LE(BigInt(Math.round(newBidPrice)), 8);
|
|
213
|
+
buf.writeBigInt64LE(BigInt(Math.round(newBidQty)), 16);
|
|
214
|
+
buf.writeBigInt64LE(BigInt(Math.round(oldBidOrderId)), 24);
|
|
215
|
+
buf.writeBigInt64LE(BigInt(Math.round(newAskPrice)), 32);
|
|
216
|
+
buf.writeBigInt64LE(BigInt(Math.round(newAskQty)), 40);
|
|
217
|
+
buf.writeBigInt64LE(BigInt(Math.round(oldAskOrderId)), 48);
|
|
218
218
|
return buf;
|
|
219
219
|
}
|
|
220
220
|
exports.perpQuotesReplaceData = perpQuotesReplaceData;
|
|
@@ -278,7 +278,7 @@ function perpOrderCancelData(tag, side, instrId, orderId) {
|
|
|
278
278
|
buf.writeUint8(side, 1);
|
|
279
279
|
buf.writeUint16LE(0, 2);
|
|
280
280
|
buf.writeUint32LE(instrId, 4);
|
|
281
|
-
buf.writeBigInt64LE(BigInt(orderId), 8);
|
|
281
|
+
buf.writeBigInt64LE(BigInt(Math.round(orderId)), 8);
|
|
282
282
|
return buf;
|
|
283
283
|
}
|
|
284
284
|
exports.perpOrderCancelData = perpOrderCancelData;
|