flash-sdk 2.46.4 → 2.46.5-alpha.0
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/OraclePrice.d.ts +0 -1
- package/dist/OrderAccount.d.ts +0 -1
- package/dist/PerpetualsClient.d.ts +2 -3
- package/dist/PerpetualsClient.js +646 -471
- package/dist/PoolAccount.d.ts +0 -1
- package/dist/PoolDataClient.d.ts +0 -1
- package/dist/PositionAccount.d.ts +0 -1
- package/dist/TokenVaultAccount.d.ts +0 -1
- package/dist/TradingAccount.d.ts +0 -1
- package/dist/ViewHelper.js +2 -2
- package/dist/backupOracle.js +7 -7
- package/dist/constants/index.d.ts +0 -1
- package/dist/idl/perpetuals.d.ts +374 -0
- package/dist/idl/perpetuals.js +374 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +3 -3
- package/dist/utils/IdlCoder.js +17 -7
- package/dist/utils/alt.js +5 -6
- package/dist/utils/anchorCpiEvents.d.ts +0 -1
- package/dist/utils/anchorCpiEvents.js +4 -4
- package/dist/utils/index.js +6 -6
- package/dist/utils/rpc.js +59 -59
- package/package.json +8 -5
package/dist/utils/rpc.js
CHANGED
@@ -24,8 +24,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
24
24
|
});
|
25
25
|
};
|
26
26
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
28
|
-
return g =
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
28
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
29
29
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
30
30
|
function step(op) {
|
31
31
|
if (f) throw new TypeError("Generator is already executing.");
|
@@ -63,28 +63,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
63
63
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
64
64
|
};
|
65
65
|
Object.defineProperty(exports, "__esModule", { value: true });
|
66
|
-
exports.TransactionFailError = exports.createComputeBudgetIx =
|
66
|
+
exports.TransactionFailError = exports.createComputeBudgetIx = void 0;
|
67
|
+
exports.sendTransaction = sendTransaction;
|
68
|
+
exports.confirmTransaction = confirmTransaction;
|
69
|
+
exports.sendTransactionV2 = sendTransactionV2;
|
70
|
+
exports.confirmTransactionV2 = confirmTransactionV2;
|
71
|
+
exports.sendTransactionV3 = sendTransactionV3;
|
72
|
+
exports.confirmTransactionV3 = confirmTransactionV3;
|
67
73
|
var nodewallet_1 = __importDefault(require("@coral-xyz/anchor/dist/cjs/nodewallet"));
|
68
74
|
var bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
|
69
75
|
var web3_js_1 = require("@solana/web3.js");
|
70
|
-
function sendTransaction(
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
76
|
+
function sendTransaction(provider_1, ixs_1) {
|
77
|
+
return __awaiter(this, arguments, void 0, function (provider, ixs, opts) {
|
78
|
+
var connection, latestBlockhash, _a, payer, message, vtx, signature;
|
79
|
+
var _b, _c, _d, _e;
|
80
|
+
if (opts === void 0) { opts = {}; }
|
75
81
|
return __generator(this, function (_f) {
|
76
82
|
switch (_f.label) {
|
77
83
|
case 0:
|
78
84
|
connection = provider.connection;
|
79
|
-
if (!((
|
80
|
-
|
85
|
+
if (!((_b = opts.latestBlockhash) !== null && _b !== void 0)) return [3, 1];
|
86
|
+
_a = _b;
|
81
87
|
return [3, 3];
|
82
|
-
case 1: return [4, connection.getLatestBlockhash((
|
88
|
+
case 1: return [4, connection.getLatestBlockhash((_d = (_c = opts.preflightCommitment) !== null && _c !== void 0 ? _c : provider.opts.preflightCommitment) !== null && _d !== void 0 ? _d : 'finalized')];
|
83
89
|
case 2:
|
84
|
-
|
90
|
+
_a = (_f.sent());
|
85
91
|
_f.label = 3;
|
86
92
|
case 3:
|
87
|
-
latestBlockhash =
|
93
|
+
latestBlockhash = _a;
|
88
94
|
payer = provider.wallet;
|
89
95
|
if (opts.prioritizationFee) {
|
90
96
|
ixs = __spreadArray(__spreadArray([], ixs, true), [(0, exports.createComputeBudgetIx)(opts.prioritizationFee)], false);
|
@@ -96,7 +102,7 @@ function sendTransaction(provider, ixs, opts) {
|
|
96
102
|
addressLookupTableAccounts: opts.alts,
|
97
103
|
});
|
98
104
|
vtx = new web3_js_1.VersionedTransaction(message);
|
99
|
-
if ((
|
105
|
+
if ((_e = opts === null || opts === void 0 ? void 0 : opts.additionalSigners) === null || _e === void 0 ? void 0 : _e.length) {
|
100
106
|
vtx.sign(__spreadArray([], opts === null || opts === void 0 ? void 0 : opts.additionalSigners, true));
|
101
107
|
}
|
102
108
|
if (!(typeof payer.signTransaction === 'function' &&
|
@@ -118,26 +124,25 @@ function sendTransaction(provider, ixs, opts) {
|
|
118
124
|
});
|
119
125
|
});
|
120
126
|
}
|
121
|
-
|
122
|
-
function
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
var connection, latestBlockhash, _e, txConfirmationCommitment, status;
|
127
|
+
function confirmTransaction(provider_1, signature_1) {
|
128
|
+
return __awaiter(this, arguments, void 0, function (provider, signature, opts) {
|
129
|
+
var connection, latestBlockhash, _a, txConfirmationCommitment, status;
|
130
|
+
var _b, _c, _d, _e;
|
131
|
+
if (opts === void 0) { opts = {}; }
|
127
132
|
return __generator(this, function (_f) {
|
128
133
|
switch (_f.label) {
|
129
134
|
case 0:
|
130
135
|
connection = provider.connection;
|
131
|
-
if (!((
|
132
|
-
|
136
|
+
if (!((_b = opts.latestBlockhash) !== null && _b !== void 0)) return [3, 1];
|
137
|
+
_a = _b;
|
133
138
|
return [3, 3];
|
134
|
-
case 1: return [4, connection.getLatestBlockhash((
|
139
|
+
case 1: return [4, connection.getLatestBlockhash((_d = (_c = opts.preflightCommitment) !== null && _c !== void 0 ? _c : provider.opts.preflightCommitment) !== null && _d !== void 0 ? _d : 'finalized')];
|
135
140
|
case 2:
|
136
|
-
|
141
|
+
_a = (_f.sent());
|
137
142
|
_f.label = 3;
|
138
143
|
case 3:
|
139
|
-
latestBlockhash =
|
140
|
-
txConfirmationCommitment = (
|
144
|
+
latestBlockhash = _a;
|
145
|
+
txConfirmationCommitment = (_e = opts.txConfirmationCommitment) !== null && _e !== void 0 ? _e : 'processed';
|
141
146
|
if (!(latestBlockhash.blockhash != null &&
|
142
147
|
latestBlockhash.lastValidBlockHeight != null)) return [3, 5];
|
143
148
|
return [4, connection.confirmTransaction({
|
@@ -165,25 +170,24 @@ function confirmTransaction(provider, signature, opts) {
|
|
165
170
|
});
|
166
171
|
});
|
167
172
|
}
|
168
|
-
|
169
|
-
function
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
var connection, latestBlockhash, _e, payer, message, vtx, signature;
|
173
|
+
function sendTransactionV2(provider_1, ixs_1) {
|
174
|
+
return __awaiter(this, arguments, void 0, function (provider, ixs, opts) {
|
175
|
+
var connection, latestBlockhash, _a, payer, message, vtx, signature;
|
176
|
+
var _b, _c, _d, _e;
|
177
|
+
if (opts === void 0) { opts = {}; }
|
174
178
|
return __generator(this, function (_f) {
|
175
179
|
switch (_f.label) {
|
176
180
|
case 0:
|
177
181
|
connection = provider.connection;
|
178
|
-
if (!((
|
179
|
-
|
182
|
+
if (!((_b = opts.latestBlockhash) !== null && _b !== void 0)) return [3, 1];
|
183
|
+
_a = _b;
|
180
184
|
return [3, 3];
|
181
|
-
case 1: return [4, connection.getLatestBlockhash((
|
185
|
+
case 1: return [4, connection.getLatestBlockhash((_d = (_c = opts.preflightCommitment) !== null && _c !== void 0 ? _c : provider.opts.preflightCommitment) !== null && _d !== void 0 ? _d : 'finalized')];
|
182
186
|
case 2:
|
183
|
-
|
187
|
+
_a = (_f.sent());
|
184
188
|
_f.label = 3;
|
185
189
|
case 3:
|
186
|
-
latestBlockhash =
|
190
|
+
latestBlockhash = _a;
|
187
191
|
payer = provider.wallet;
|
188
192
|
if (opts.prioritizationFee) {
|
189
193
|
ixs = __spreadArray(__spreadArray([], ixs, true), [(0, exports.createComputeBudgetIx)(opts.prioritizationFee)], false);
|
@@ -195,7 +199,7 @@ function sendTransactionV2(provider, ixs, opts) {
|
|
195
199
|
addressLookupTableAccounts: opts.alts,
|
196
200
|
});
|
197
201
|
vtx = new web3_js_1.VersionedTransaction(message);
|
198
|
-
if ((
|
202
|
+
if ((_e = opts === null || opts === void 0 ? void 0 : opts.additionalSigners) === null || _e === void 0 ? void 0 : _e.length) {
|
199
203
|
vtx.sign(__spreadArray([], opts === null || opts === void 0 ? void 0 : opts.additionalSigners, true));
|
200
204
|
}
|
201
205
|
if (!(typeof payer.signTransaction === 'function' &&
|
@@ -217,12 +221,11 @@ function sendTransactionV2(provider, ixs, opts) {
|
|
217
221
|
});
|
218
222
|
});
|
219
223
|
}
|
220
|
-
exports.sendTransactionV2 = sendTransactionV2;
|
221
224
|
var sleep = function (ms) { return new Promise(function (r) { return setTimeout(r, ms); }); };
|
222
|
-
function confirmTransactionV2(
|
223
|
-
|
224
|
-
return __awaiter(this, void 0, void 0, function () {
|
225
|
+
function confirmTransactionV2(provider_1, versionedTransaction_1, signature_1) {
|
226
|
+
return __awaiter(this, arguments, void 0, function (provider, versionedTransaction, signature, opts) {
|
225
227
|
var connection, status, done, blockhashResponse, lastValidBlockHeight, blockheight, signatureStatuses, result, x;
|
228
|
+
if (opts === void 0) { opts = {}; }
|
226
229
|
return __generator(this, function (_a) {
|
227
230
|
switch (_a.label) {
|
228
231
|
case 0:
|
@@ -279,25 +282,24 @@ function confirmTransactionV2(provider, versionedTransaction, signature, opts) {
|
|
279
282
|
});
|
280
283
|
});
|
281
284
|
}
|
282
|
-
|
283
|
-
function
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
var connection, latestBlockhash, _e, payer, message, vtx, tx, signature;
|
285
|
+
function sendTransactionV3(provider_1, ixs_1) {
|
286
|
+
return __awaiter(this, arguments, void 0, function (provider, ixs, opts) {
|
287
|
+
var connection, latestBlockhash, _a, payer, message, vtx, tx, signature;
|
288
|
+
var _b, _c, _d, _e;
|
289
|
+
if (opts === void 0) { opts = {}; }
|
288
290
|
return __generator(this, function (_f) {
|
289
291
|
switch (_f.label) {
|
290
292
|
case 0:
|
291
293
|
connection = provider.connection;
|
292
|
-
if (!((
|
293
|
-
|
294
|
+
if (!((_b = opts.latestBlockhash) !== null && _b !== void 0)) return [3, 1];
|
295
|
+
_a = _b;
|
294
296
|
return [3, 3];
|
295
|
-
case 1: return [4, connection.getLatestBlockhash((
|
297
|
+
case 1: return [4, connection.getLatestBlockhash((_d = (_c = opts.preflightCommitment) !== null && _c !== void 0 ? _c : provider.opts.preflightCommitment) !== null && _d !== void 0 ? _d : 'finalized')];
|
296
298
|
case 2:
|
297
|
-
|
299
|
+
_a = (_f.sent());
|
298
300
|
_f.label = 3;
|
299
301
|
case 3:
|
300
|
-
latestBlockhash =
|
302
|
+
latestBlockhash = _a;
|
301
303
|
payer = provider.wallet;
|
302
304
|
message = web3_js_1.MessageV0.compile({
|
303
305
|
payerKey: provider.wallet.publicKey,
|
@@ -306,7 +308,7 @@ function sendTransactionV3(provider, ixs, opts) {
|
|
306
308
|
addressLookupTableAccounts: opts.alts,
|
307
309
|
});
|
308
310
|
vtx = new web3_js_1.VersionedTransaction(message);
|
309
|
-
if ((
|
311
|
+
if ((_e = opts === null || opts === void 0 ? void 0 : opts.additionalSigners) === null || _e === void 0 ? void 0 : _e.length) {
|
310
312
|
vtx.sign(__spreadArray([], opts === null || opts === void 0 ? void 0 : opts.additionalSigners, true));
|
311
313
|
}
|
312
314
|
if (!(typeof payer.signTransaction === 'function' &&
|
@@ -332,11 +334,10 @@ function sendTransactionV3(provider, ixs, opts) {
|
|
332
334
|
});
|
333
335
|
});
|
334
336
|
}
|
335
|
-
|
336
|
-
function
|
337
|
-
if (opts === void 0) { opts = {}; }
|
338
|
-
return __awaiter(this, void 0, void 0, function () {
|
337
|
+
function confirmTransactionV3(provider_1, versionedTransaction_1, signature_1) {
|
338
|
+
return __awaiter(this, arguments, void 0, function (provider, versionedTransaction, signature, opts) {
|
339
339
|
var connection, status, blockhashResponse, lastValidBlockHeight, blockheight, signatureStatuses, result, x;
|
340
|
+
if (opts === void 0) { opts = {}; }
|
340
341
|
return __generator(this, function (_a) {
|
341
342
|
switch (_a.label) {
|
342
343
|
case 0:
|
@@ -399,7 +400,6 @@ function confirmTransactionV3(provider, versionedTransaction, signature, opts) {
|
|
399
400
|
});
|
400
401
|
});
|
401
402
|
}
|
402
|
-
exports.confirmTransactionV3 = confirmTransactionV3;
|
403
403
|
var createComputeBudgetIx = function (microLamports) {
|
404
404
|
var computeBudgetIx = web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
|
405
405
|
microLamports: microLamports,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "flash-sdk",
|
3
|
-
"version": "2.46.
|
3
|
+
"version": "2.46.5-alpha.0",
|
4
4
|
"main": "dist/index.js",
|
5
5
|
"types": "dist/index.d.ts",
|
6
6
|
"files": [
|
@@ -21,11 +21,11 @@
|
|
21
21
|
"doc": "yarn typedoc --out docs src"
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
|
-
"@coral-xyz/anchor": "
|
24
|
+
"@coral-xyz/anchor": "=0.27.0",
|
25
25
|
"@pythnetwork/client": "^2.19.0",
|
26
26
|
"@pythnetwork/price-service-client": "^1.8.2",
|
27
|
-
"@solana/spl-token": "^0.
|
28
|
-
"@solana/web3.js": "=1.
|
27
|
+
"@solana/spl-token": "^0.4.13",
|
28
|
+
"@solana/web3.js": "=1.98.2",
|
29
29
|
"@types/node": "^20.0.0",
|
30
30
|
"bignumber.js": "^9.1.2",
|
31
31
|
"bs58": "^5.0.0",
|
@@ -38,11 +38,14 @@
|
|
38
38
|
"ts-node": "^10.9.1",
|
39
39
|
"tweetnacl": "^1.0.3"
|
40
40
|
},
|
41
|
+
"resolutions": {
|
42
|
+
"@solana/web3.js": "1.98.2"
|
43
|
+
},
|
41
44
|
"devDependencies": {
|
42
45
|
"@types/bn.js": "^5.1.1",
|
43
46
|
"prettier": "^2.8.1",
|
44
47
|
"ts-node": "^10.9.1",
|
45
48
|
"typedoc": "^0.25.13",
|
46
|
-
"typescript": "^
|
49
|
+
"typescript": "^5.3.3"
|
47
50
|
}
|
48
51
|
}
|