flash-sdk 2.46.8 → 2.47.0-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/PerpetualsClient.d.ts +1 -1
- package/dist/PerpetualsClient.js +375 -515
- package/dist/PoolConfig.json +11 -0
- package/dist/ViewHelper.js +3 -3
- package/dist/backupOracle.js +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/alt.d.ts +1 -0
- package/dist/utils/rpc.js +50 -50
- package/package.json +1 -1
package/dist/utils/rpc.js
CHANGED
@@ -67,24 +67,24 @@ exports.TransactionFailError = exports.createComputeBudgetIx = exports.confirmTr
|
|
67
67
|
var nodewallet_1 = __importDefault(require("@coral-xyz/anchor/dist/cjs/nodewallet"));
|
68
68
|
var bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
|
69
69
|
var web3_js_1 = require("@solana/web3.js");
|
70
|
-
function sendTransaction(
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
function sendTransaction(provider, ixs, opts) {
|
71
|
+
var _a, _b, _c, _d;
|
72
|
+
if (opts === void 0) { opts = {}; }
|
73
|
+
return __awaiter(this, void 0, void 0, function () {
|
74
|
+
var connection, latestBlockhash, _e, payer, message, vtx, signature;
|
75
75
|
return __generator(this, function (_f) {
|
76
76
|
switch (_f.label) {
|
77
77
|
case 0:
|
78
78
|
connection = provider.connection;
|
79
|
-
if (!((
|
80
|
-
|
79
|
+
if (!((_a = opts.latestBlockhash) !== null && _a !== void 0)) return [3, 1];
|
80
|
+
_e = _a;
|
81
81
|
return [3, 3];
|
82
|
-
case 1: return [4, connection.getLatestBlockhash((
|
82
|
+
case 1: return [4, connection.getLatestBlockhash((_c = (_b = opts.preflightCommitment) !== null && _b !== void 0 ? _b : provider.opts.preflightCommitment) !== null && _c !== void 0 ? _c : 'finalized')];
|
83
83
|
case 2:
|
84
|
-
|
84
|
+
_e = (_f.sent());
|
85
85
|
_f.label = 3;
|
86
86
|
case 3:
|
87
|
-
latestBlockhash =
|
87
|
+
latestBlockhash = _e;
|
88
88
|
payer = provider.wallet;
|
89
89
|
if (opts.prioritizationFee) {
|
90
90
|
ixs = __spreadArray(__spreadArray([], ixs, true), [(0, exports.createComputeBudgetIx)(opts.prioritizationFee)], false);
|
@@ -96,7 +96,7 @@ function sendTransaction(provider_1, ixs_1) {
|
|
96
96
|
addressLookupTableAccounts: opts.alts,
|
97
97
|
});
|
98
98
|
vtx = new web3_js_1.VersionedTransaction(message);
|
99
|
-
if ((
|
99
|
+
if ((_d = opts === null || opts === void 0 ? void 0 : opts.additionalSigners) === null || _d === void 0 ? void 0 : _d.length) {
|
100
100
|
vtx.sign(__spreadArray([], opts === null || opts === void 0 ? void 0 : opts.additionalSigners, true));
|
101
101
|
}
|
102
102
|
if (!(typeof payer.signTransaction === 'function' &&
|
@@ -119,25 +119,25 @@ function sendTransaction(provider_1, ixs_1) {
|
|
119
119
|
});
|
120
120
|
}
|
121
121
|
exports.sendTransaction = sendTransaction;
|
122
|
-
function confirmTransaction(
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
122
|
+
function confirmTransaction(provider, signature, opts) {
|
123
|
+
var _a, _b, _c, _d;
|
124
|
+
if (opts === void 0) { opts = {}; }
|
125
|
+
return __awaiter(this, void 0, void 0, function () {
|
126
|
+
var connection, latestBlockhash, _e, txConfirmationCommitment, status;
|
127
127
|
return __generator(this, function (_f) {
|
128
128
|
switch (_f.label) {
|
129
129
|
case 0:
|
130
130
|
connection = provider.connection;
|
131
|
-
if (!((
|
132
|
-
|
131
|
+
if (!((_a = opts.latestBlockhash) !== null && _a !== void 0)) return [3, 1];
|
132
|
+
_e = _a;
|
133
133
|
return [3, 3];
|
134
|
-
case 1: return [4, connection.getLatestBlockhash((
|
134
|
+
case 1: return [4, connection.getLatestBlockhash((_c = (_b = opts.preflightCommitment) !== null && _b !== void 0 ? _b : provider.opts.preflightCommitment) !== null && _c !== void 0 ? _c : 'finalized')];
|
135
135
|
case 2:
|
136
|
-
|
136
|
+
_e = (_f.sent());
|
137
137
|
_f.label = 3;
|
138
138
|
case 3:
|
139
|
-
latestBlockhash =
|
140
|
-
txConfirmationCommitment = (
|
139
|
+
latestBlockhash = _e;
|
140
|
+
txConfirmationCommitment = (_d = opts.txConfirmationCommitment) !== null && _d !== void 0 ? _d : 'processed';
|
141
141
|
if (!(latestBlockhash.blockhash != null &&
|
142
142
|
latestBlockhash.lastValidBlockHeight != null)) return [3, 5];
|
143
143
|
return [4, connection.confirmTransaction({
|
@@ -166,24 +166,24 @@ function confirmTransaction(provider_1, signature_1) {
|
|
166
166
|
});
|
167
167
|
}
|
168
168
|
exports.confirmTransaction = confirmTransaction;
|
169
|
-
function sendTransactionV2(
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
169
|
+
function sendTransactionV2(provider, ixs, opts) {
|
170
|
+
var _a, _b, _c, _d;
|
171
|
+
if (opts === void 0) { opts = {}; }
|
172
|
+
return __awaiter(this, void 0, void 0, function () {
|
173
|
+
var connection, latestBlockhash, _e, payer, message, vtx, signature;
|
174
174
|
return __generator(this, function (_f) {
|
175
175
|
switch (_f.label) {
|
176
176
|
case 0:
|
177
177
|
connection = provider.connection;
|
178
|
-
if (!((
|
179
|
-
|
178
|
+
if (!((_a = opts.latestBlockhash) !== null && _a !== void 0)) return [3, 1];
|
179
|
+
_e = _a;
|
180
180
|
return [3, 3];
|
181
|
-
case 1: return [4, connection.getLatestBlockhash((
|
181
|
+
case 1: return [4, connection.getLatestBlockhash((_c = (_b = opts.preflightCommitment) !== null && _b !== void 0 ? _b : provider.opts.preflightCommitment) !== null && _c !== void 0 ? _c : 'finalized')];
|
182
182
|
case 2:
|
183
|
-
|
183
|
+
_e = (_f.sent());
|
184
184
|
_f.label = 3;
|
185
185
|
case 3:
|
186
|
-
latestBlockhash =
|
186
|
+
latestBlockhash = _e;
|
187
187
|
payer = provider.wallet;
|
188
188
|
if (opts.prioritizationFee) {
|
189
189
|
ixs = __spreadArray(__spreadArray([], ixs, true), [(0, exports.createComputeBudgetIx)(opts.prioritizationFee)], false);
|
@@ -195,7 +195,7 @@ function sendTransactionV2(provider_1, ixs_1) {
|
|
195
195
|
addressLookupTableAccounts: opts.alts,
|
196
196
|
});
|
197
197
|
vtx = new web3_js_1.VersionedTransaction(message);
|
198
|
-
if ((
|
198
|
+
if ((_d = opts === null || opts === void 0 ? void 0 : opts.additionalSigners) === null || _d === void 0 ? void 0 : _d.length) {
|
199
199
|
vtx.sign(__spreadArray([], opts === null || opts === void 0 ? void 0 : opts.additionalSigners, true));
|
200
200
|
}
|
201
201
|
if (!(typeof payer.signTransaction === 'function' &&
|
@@ -219,10 +219,10 @@ function sendTransactionV2(provider_1, ixs_1) {
|
|
219
219
|
}
|
220
220
|
exports.sendTransactionV2 = sendTransactionV2;
|
221
221
|
var sleep = function (ms) { return new Promise(function (r) { return setTimeout(r, ms); }); };
|
222
|
-
function confirmTransactionV2(
|
223
|
-
|
222
|
+
function confirmTransactionV2(provider, versionedTransaction, signature, opts) {
|
223
|
+
if (opts === void 0) { opts = {}; }
|
224
|
+
return __awaiter(this, void 0, void 0, function () {
|
224
225
|
var connection, status, done, blockhashResponse, lastValidBlockHeight, blockheight, signatureStatuses, result, x;
|
225
|
-
if (opts === void 0) { opts = {}; }
|
226
226
|
return __generator(this, function (_a) {
|
227
227
|
switch (_a.label) {
|
228
228
|
case 0:
|
@@ -280,24 +280,24 @@ function confirmTransactionV2(provider_1, versionedTransaction_1, signature_1) {
|
|
280
280
|
});
|
281
281
|
}
|
282
282
|
exports.confirmTransactionV2 = confirmTransactionV2;
|
283
|
-
function sendTransactionV3(
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
283
|
+
function sendTransactionV3(provider, ixs, opts) {
|
284
|
+
var _a, _b, _c, _d;
|
285
|
+
if (opts === void 0) { opts = {}; }
|
286
|
+
return __awaiter(this, void 0, void 0, function () {
|
287
|
+
var connection, latestBlockhash, _e, payer, message, vtx, tx, signature;
|
288
288
|
return __generator(this, function (_f) {
|
289
289
|
switch (_f.label) {
|
290
290
|
case 0:
|
291
291
|
connection = provider.connection;
|
292
|
-
if (!((
|
293
|
-
|
292
|
+
if (!((_a = opts.latestBlockhash) !== null && _a !== void 0)) return [3, 1];
|
293
|
+
_e = _a;
|
294
294
|
return [3, 3];
|
295
|
-
case 1: return [4, connection.getLatestBlockhash((
|
295
|
+
case 1: return [4, connection.getLatestBlockhash((_c = (_b = opts.preflightCommitment) !== null && _b !== void 0 ? _b : provider.opts.preflightCommitment) !== null && _c !== void 0 ? _c : 'finalized')];
|
296
296
|
case 2:
|
297
|
-
|
297
|
+
_e = (_f.sent());
|
298
298
|
_f.label = 3;
|
299
299
|
case 3:
|
300
|
-
latestBlockhash =
|
300
|
+
latestBlockhash = _e;
|
301
301
|
payer = provider.wallet;
|
302
302
|
message = web3_js_1.MessageV0.compile({
|
303
303
|
payerKey: provider.wallet.publicKey,
|
@@ -306,7 +306,7 @@ function sendTransactionV3(provider_1, ixs_1) {
|
|
306
306
|
addressLookupTableAccounts: opts.alts,
|
307
307
|
});
|
308
308
|
vtx = new web3_js_1.VersionedTransaction(message);
|
309
|
-
if ((
|
309
|
+
if ((_d = opts === null || opts === void 0 ? void 0 : opts.additionalSigners) === null || _d === void 0 ? void 0 : _d.length) {
|
310
310
|
vtx.sign(__spreadArray([], opts === null || opts === void 0 ? void 0 : opts.additionalSigners, true));
|
311
311
|
}
|
312
312
|
if (!(typeof payer.signTransaction === 'function' &&
|
@@ -333,10 +333,10 @@ function sendTransactionV3(provider_1, ixs_1) {
|
|
333
333
|
});
|
334
334
|
}
|
335
335
|
exports.sendTransactionV3 = sendTransactionV3;
|
336
|
-
function confirmTransactionV3(
|
337
|
-
|
336
|
+
function confirmTransactionV3(provider, versionedTransaction, signature, opts) {
|
337
|
+
if (opts === void 0) { opts = {}; }
|
338
|
+
return __awaiter(this, void 0, void 0, function () {
|
338
339
|
var connection, status, blockhashResponse, lastValidBlockHeight, blockheight, signatureStatuses, result, x;
|
339
|
-
if (opts === void 0) { opts = {}; }
|
340
340
|
return __generator(this, function (_a) {
|
341
341
|
switch (_a.label) {
|
342
342
|
case 0:
|