@solana/web3.js 2.0.0-experimental.d085c72 → 2.0.0-experimental.d148156
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 +19 -23
- package/dist/index.browser.cjs +76 -26
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +73 -26
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +875 -761
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +73 -26
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +78 -26
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +73 -26
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +83 -80
- package/dist/types/airdrop-confirmer.d.ts +4 -5
- package/dist/types/airdrop-confirmer.d.ts.map +1 -0
- package/dist/types/airdrop.d.ts +3 -5
- package/dist/types/airdrop.d.ts.map +1 -0
- package/dist/types/cached-abortable-iterable.d.ts.map +1 -0
- package/dist/types/index.d.ts +10 -9
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/rpc-default-config.d.ts.map +1 -0
- package/dist/types/rpc-integer-overflow-error.d.ts +3 -2
- package/dist/types/rpc-integer-overflow-error.d.ts.map +1 -0
- package/dist/types/rpc-request-coalescer.d.ts +1 -1
- package/dist/types/rpc-request-coalescer.d.ts.map +1 -0
- package/dist/types/rpc-request-deduplication.d.ts.map +1 -0
- package/dist/types/rpc-subscription-coalescer.d.ts +1 -1
- package/dist/types/rpc-subscription-coalescer.d.ts.map +1 -0
- package/dist/types/rpc-transport.d.ts +1 -2
- package/dist/types/rpc-transport.d.ts.map +1 -0
- package/dist/types/rpc-websocket-autopinger.d.ts +1 -1
- package/dist/types/rpc-websocket-autopinger.d.ts.map +1 -0
- package/dist/types/rpc-websocket-connection-sharding.d.ts +1 -1
- package/dist/types/rpc-websocket-connection-sharding.d.ts.map +1 -0
- package/dist/types/rpc-websocket-transport.d.ts +1 -2
- package/dist/types/rpc-websocket-transport.d.ts.map +1 -0
- package/dist/types/rpc.d.ts +1 -2
- package/dist/types/rpc.d.ts.map +1 -0
- package/dist/types/send-transaction.d.ts +3 -3
- package/dist/types/send-transaction.d.ts.map +1 -0
- package/dist/types/transaction-confirmation-strategy-blockheight.d.ts +9 -5
- package/dist/types/transaction-confirmation-strategy-blockheight.d.ts.map +1 -0
- package/dist/types/transaction-confirmation-strategy-nonce.d.ts +2 -3
- package/dist/types/transaction-confirmation-strategy-nonce.d.ts.map +1 -0
- package/dist/types/transaction-confirmation-strategy-racer.d.ts +1 -1
- package/dist/types/transaction-confirmation-strategy-racer.d.ts.map +1 -0
- package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts +2 -3
- package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts.map +1 -0
- package/dist/types/transaction-confirmation-strategy-timeout.d.ts.map +1 -0
- package/dist/types/transaction-confirmation.d.ts +6 -11
- package/dist/types/transaction-confirmation.d.ts.map +1 -0
- package/package.json +14 -14
|
@@ -138,23 +138,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
138
138
|
throw new Error(`Codec [${codecDescription}] expected ${expected} bytes, got ${bytesLength}.`);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
var mergeBytes = (byteArrays) => {
|
|
142
|
-
const nonEmptyByteArrays = byteArrays.filter((arr) => arr.length);
|
|
143
|
-
if (nonEmptyByteArrays.length === 0) {
|
|
144
|
-
return byteArrays.length ? byteArrays[0] : new Uint8Array();
|
|
145
|
-
}
|
|
146
|
-
if (nonEmptyByteArrays.length === 1) {
|
|
147
|
-
return nonEmptyByteArrays[0];
|
|
148
|
-
}
|
|
149
|
-
const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0);
|
|
150
|
-
const result = new Uint8Array(totalLength);
|
|
151
|
-
let offset = 0;
|
|
152
|
-
nonEmptyByteArrays.forEach((arr) => {
|
|
153
|
-
result.set(arr, offset);
|
|
154
|
-
offset += arr.length;
|
|
155
|
-
});
|
|
156
|
-
return result;
|
|
157
|
-
};
|
|
158
141
|
var padBytes = (bytes, length) => {
|
|
159
142
|
if (bytes.length >= length)
|
|
160
143
|
return bytes;
|
|
@@ -163,77 +146,100 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
163
146
|
return paddedBytes;
|
|
164
147
|
};
|
|
165
148
|
var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
|
|
166
|
-
function
|
|
167
|
-
|
|
149
|
+
function getEncodedSize(value, encoder) {
|
|
150
|
+
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);
|
|
151
|
+
}
|
|
152
|
+
function createEncoder(encoder) {
|
|
153
|
+
return Object.freeze({
|
|
154
|
+
...encoder,
|
|
155
|
+
encode: (value) => {
|
|
156
|
+
const bytes = new Uint8Array(getEncodedSize(value, encoder));
|
|
157
|
+
encoder.write(value, bytes, 0);
|
|
158
|
+
return bytes;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function createDecoder(decoder) {
|
|
163
|
+
return Object.freeze({
|
|
164
|
+
...decoder,
|
|
165
|
+
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function isFixedSize(codec) {
|
|
169
|
+
return "fixedSize" in codec && typeof codec.fixedSize === "number";
|
|
170
|
+
}
|
|
171
|
+
function assertIsFixedSize(codec, message) {
|
|
172
|
+
if (!isFixedSize(codec)) {
|
|
173
|
+
throw new Error(message != null ? message : "Expected a fixed-size codec, got a variable-size one.");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function isVariableSize(codec) {
|
|
177
|
+
return !isFixedSize(codec);
|
|
178
|
+
}
|
|
179
|
+
function combineCodec(encoder, decoder) {
|
|
180
|
+
if (isFixedSize(encoder) !== isFixedSize(decoder)) {
|
|
181
|
+
throw new Error(`Encoder and decoder must either both be fixed-size or variable-size.`);
|
|
182
|
+
}
|
|
183
|
+
if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
|
|
168
184
|
throw new Error(
|
|
169
185
|
`Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`
|
|
170
186
|
);
|
|
171
187
|
}
|
|
172
|
-
if (encoder.maxSize !== decoder.maxSize) {
|
|
188
|
+
if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
|
|
173
189
|
throw new Error(
|
|
174
190
|
`Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`
|
|
175
191
|
);
|
|
176
192
|
}
|
|
177
|
-
if (description === void 0 && encoder.description !== decoder.description) {
|
|
178
|
-
throw new Error(
|
|
179
|
-
`Encoder and decoder must have the same description, got [${encoder.description}] and [${decoder.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
193
|
return {
|
|
194
|
+
...decoder,
|
|
195
|
+
...encoder,
|
|
183
196
|
decode: decoder.decode,
|
|
184
|
-
description: description != null ? description : encoder.description,
|
|
185
197
|
encode: encoder.encode,
|
|
186
|
-
|
|
187
|
-
|
|
198
|
+
read: decoder.read,
|
|
199
|
+
write: encoder.write
|
|
188
200
|
};
|
|
189
201
|
}
|
|
190
|
-
function
|
|
191
|
-
return {
|
|
192
|
-
description: description != null ? description : `fixed(${fixedBytes}, ${data.description})`,
|
|
202
|
+
function fixEncoder(encoder, fixedBytes) {
|
|
203
|
+
return createEncoder({
|
|
193
204
|
fixedSize: fixedBytes,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
};
|
|
205
|
+
write: (value, bytes, offset) => {
|
|
206
|
+
const variableByteArray = encoder.encode(value);
|
|
207
|
+
const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;
|
|
208
|
+
bytes.set(fixedByteArray, offset);
|
|
209
|
+
return offset + fixedBytes;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
202
212
|
}
|
|
203
|
-
function fixDecoder(decoder, fixedBytes
|
|
204
|
-
return {
|
|
205
|
-
|
|
206
|
-
|
|
213
|
+
function fixDecoder(decoder, fixedBytes) {
|
|
214
|
+
return createDecoder({
|
|
215
|
+
fixedSize: fixedBytes,
|
|
216
|
+
read: (bytes, offset) => {
|
|
207
217
|
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset);
|
|
208
218
|
if (offset > 0 || bytes.length > fixedBytes) {
|
|
209
219
|
bytes = bytes.slice(offset, offset + fixedBytes);
|
|
210
220
|
}
|
|
211
|
-
if (decoder
|
|
221
|
+
if (isFixedSize(decoder)) {
|
|
212
222
|
bytes = fixBytes(bytes, decoder.fixedSize);
|
|
213
223
|
}
|
|
214
|
-
const [value] = decoder.
|
|
224
|
+
const [value] = decoder.read(bytes, 0);
|
|
215
225
|
return [value, offset + fixedBytes];
|
|
216
226
|
}
|
|
217
|
-
};
|
|
227
|
+
});
|
|
218
228
|
}
|
|
219
229
|
function mapEncoder(encoder, unmap) {
|
|
220
|
-
return {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
maxSize: encoder.maxSize
|
|
225
|
-
};
|
|
230
|
+
return createEncoder({
|
|
231
|
+
...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder,
|
|
232
|
+
write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset)
|
|
233
|
+
});
|
|
226
234
|
}
|
|
227
235
|
function mapDecoder(decoder, map) {
|
|
228
|
-
return {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
maxSize: decoder.maxSize
|
|
236
|
-
};
|
|
236
|
+
return createDecoder({
|
|
237
|
+
...decoder,
|
|
238
|
+
read: (bytes, offset) => {
|
|
239
|
+
const [value, newOffset] = decoder.read(bytes, offset);
|
|
240
|
+
return [map(value, bytes, offset), newOffset];
|
|
241
|
+
}
|
|
242
|
+
});
|
|
237
243
|
}
|
|
238
244
|
|
|
239
245
|
// ../codecs-strings/dist/index.browser.js
|
|
@@ -248,102 +254,83 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
248
254
|
);
|
|
249
255
|
}
|
|
250
256
|
}
|
|
251
|
-
function
|
|
252
|
-
|
|
253
|
-
let littleEndian;
|
|
254
|
-
let defaultDescription = input.name;
|
|
255
|
-
if (input.size > 1) {
|
|
256
|
-
littleEndian = !("endian" in input.config) || input.config.endian === 0;
|
|
257
|
-
defaultDescription += littleEndian ? "(le)" : "(be)";
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
description: (_a = input.config.description) != null ? _a : defaultDescription,
|
|
261
|
-
fixedSize: input.size,
|
|
262
|
-
littleEndian,
|
|
263
|
-
maxSize: input.size
|
|
264
|
-
};
|
|
257
|
+
function isLittleEndian(config) {
|
|
258
|
+
return (config == null ? void 0 : config.endian) === 1 ? false : true;
|
|
265
259
|
}
|
|
266
260
|
function numberEncoderFactory(input) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
encode(value) {
|
|
261
|
+
return createEncoder({
|
|
262
|
+
fixedSize: input.size,
|
|
263
|
+
write(value, bytes, offset) {
|
|
271
264
|
if (input.range) {
|
|
272
265
|
assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);
|
|
273
266
|
}
|
|
274
267
|
const arrayBuffer = new ArrayBuffer(input.size);
|
|
275
|
-
input.set(new DataView(arrayBuffer), value,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
};
|
|
268
|
+
input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config));
|
|
269
|
+
bytes.set(new Uint8Array(arrayBuffer), offset);
|
|
270
|
+
return offset + input.size;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
281
273
|
}
|
|
282
274
|
function numberDecoderFactory(input) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
assertByteArrayIsNotEmptyForCodec(
|
|
287
|
-
assertByteArrayHasEnoughBytesForCodec(
|
|
275
|
+
return createDecoder({
|
|
276
|
+
fixedSize: input.size,
|
|
277
|
+
read(bytes, offset = 0) {
|
|
278
|
+
assertByteArrayIsNotEmptyForCodec(input.name, bytes, offset);
|
|
279
|
+
assertByteArrayHasEnoughBytesForCodec(input.name, input.size, bytes, offset);
|
|
288
280
|
const view = new DataView(toArrayBuffer(bytes, offset, input.size));
|
|
289
|
-
return [input.get(view,
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
fixedSize: codecData.fixedSize,
|
|
293
|
-
maxSize: codecData.maxSize
|
|
294
|
-
};
|
|
281
|
+
return [input.get(view, isLittleEndian(input.config)), offset + input.size];
|
|
282
|
+
}
|
|
283
|
+
});
|
|
295
284
|
}
|
|
296
285
|
function toArrayBuffer(bytes, offset, length) {
|
|
297
286
|
const bytesOffset = bytes.byteOffset + (offset != null ? offset : 0);
|
|
298
287
|
const bytesLength = length != null ? length : bytes.byteLength;
|
|
299
288
|
return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength);
|
|
300
289
|
}
|
|
301
|
-
var getShortU16Encoder = (
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
290
|
+
var getShortU16Encoder = () => createEncoder({
|
|
291
|
+
getSizeFromValue: (value) => {
|
|
292
|
+
if (value <= 127)
|
|
293
|
+
return 1;
|
|
294
|
+
if (value <= 16383)
|
|
295
|
+
return 2;
|
|
296
|
+
return 3;
|
|
297
|
+
},
|
|
298
|
+
maxSize: 3,
|
|
299
|
+
write: (value, bytes, offset) => {
|
|
300
|
+
assertNumberIsBetweenForCodec("shortU16", 0, 65535, value);
|
|
301
|
+
const shortU16Bytes = [0];
|
|
302
|
+
for (let ii = 0; ; ii += 1) {
|
|
303
|
+
const alignedValue = value >> ii * 7;
|
|
304
|
+
if (alignedValue === 0) {
|
|
305
|
+
break;
|
|
318
306
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
};
|
|
324
|
-
};
|
|
325
|
-
var getShortU16Decoder = (config = {}) => {
|
|
326
|
-
var _a;
|
|
327
|
-
return {
|
|
328
|
-
decode: (bytes, offset = 0) => {
|
|
329
|
-
let value = 0;
|
|
330
|
-
let byteCount = 0;
|
|
331
|
-
while (++byteCount) {
|
|
332
|
-
const byteIndex = byteCount - 1;
|
|
333
|
-
const currentByte = bytes[offset + byteIndex];
|
|
334
|
-
const nextSevenBits = 127 & currentByte;
|
|
335
|
-
value |= nextSevenBits << byteIndex * 7;
|
|
336
|
-
if ((currentByte & 128) === 0) {
|
|
337
|
-
break;
|
|
338
|
-
}
|
|
307
|
+
const nextSevenBits = 127 & alignedValue;
|
|
308
|
+
shortU16Bytes[ii] = nextSevenBits;
|
|
309
|
+
if (ii > 0) {
|
|
310
|
+
shortU16Bytes[ii - 1] |= 128;
|
|
339
311
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
312
|
+
}
|
|
313
|
+
bytes.set(shortU16Bytes, offset);
|
|
314
|
+
return offset + shortU16Bytes.length;
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
var getShortU16Decoder = () => createDecoder({
|
|
318
|
+
maxSize: 3,
|
|
319
|
+
read: (bytes, offset) => {
|
|
320
|
+
let value = 0;
|
|
321
|
+
let byteCount = 0;
|
|
322
|
+
while (++byteCount) {
|
|
323
|
+
const byteIndex = byteCount - 1;
|
|
324
|
+
const currentByte = bytes[offset + byteIndex];
|
|
325
|
+
const nextSevenBits = 127 & currentByte;
|
|
326
|
+
value |= nextSevenBits << byteIndex * 7;
|
|
327
|
+
if ((currentByte & 128) === 0) {
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return [value, offset + byteCount];
|
|
332
|
+
}
|
|
333
|
+
});
|
|
347
334
|
var getU32Encoder = (config = {}) => numberEncoderFactory({
|
|
348
335
|
config,
|
|
349
336
|
name: "u32",
|
|
@@ -357,15 +344,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
357
344
|
name: "u32",
|
|
358
345
|
size: 4
|
|
359
346
|
});
|
|
360
|
-
var getU8Encoder = (
|
|
361
|
-
config,
|
|
347
|
+
var getU8Encoder = () => numberEncoderFactory({
|
|
362
348
|
name: "u8",
|
|
363
349
|
range: [0, Number("0xff")],
|
|
364
350
|
set: (view, value) => view.setUint8(0, value),
|
|
365
351
|
size: 1
|
|
366
352
|
});
|
|
367
|
-
var getU8Decoder = (
|
|
368
|
-
config,
|
|
353
|
+
var getU8Decoder = () => numberDecoderFactory({
|
|
369
354
|
get: (view) => view.getUint8(0),
|
|
370
355
|
name: "u8",
|
|
371
356
|
size: 1
|
|
@@ -378,43 +363,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
378
363
|
}
|
|
379
364
|
}
|
|
380
365
|
var getBaseXEncoder = (alphabet4) => {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
366
|
+
return createEncoder({
|
|
367
|
+
getSizeFromValue: (value) => {
|
|
368
|
+
const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]);
|
|
369
|
+
if (tailChars === "")
|
|
370
|
+
return value.length;
|
|
371
|
+
const base10Number = getBigIntFromBaseX(tailChars, alphabet4);
|
|
372
|
+
return leadingZeroes.length + Math.ceil(base10Number.toString(16).length / 2);
|
|
373
|
+
},
|
|
374
|
+
write(value, bytes, offset) {
|
|
386
375
|
assertValidBaseString(alphabet4, value);
|
|
387
376
|
if (value === "")
|
|
388
|
-
return
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (trailIndex === chars.length)
|
|
394
|
-
return Uint8Array.from(leadingZeroes);
|
|
395
|
-
const tailChars = chars.slice(trailIndex);
|
|
396
|
-
let base10Number = 0n;
|
|
397
|
-
let baseXPower = 1n;
|
|
398
|
-
for (let i = tailChars.length - 1; i >= 0; i -= 1) {
|
|
399
|
-
base10Number += baseXPower * BigInt(alphabet4.indexOf(tailChars[i]));
|
|
400
|
-
baseXPower *= baseBigInt;
|
|
377
|
+
return offset;
|
|
378
|
+
const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]);
|
|
379
|
+
if (tailChars === "") {
|
|
380
|
+
bytes.set(new Uint8Array(leadingZeroes.length).fill(0), offset);
|
|
381
|
+
return offset + leadingZeroes.length;
|
|
401
382
|
}
|
|
383
|
+
let base10Number = getBigIntFromBaseX(tailChars, alphabet4);
|
|
402
384
|
const tailBytes = [];
|
|
403
385
|
while (base10Number > 0n) {
|
|
404
386
|
tailBytes.unshift(Number(base10Number % 256n));
|
|
405
387
|
base10Number /= 256n;
|
|
406
388
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
};
|
|
389
|
+
const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes];
|
|
390
|
+
bytes.set(bytesToAdd, offset);
|
|
391
|
+
return offset + bytesToAdd.length;
|
|
392
|
+
}
|
|
393
|
+
});
|
|
412
394
|
};
|
|
413
395
|
var getBaseXDecoder = (alphabet4) => {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
return {
|
|
417
|
-
decode(rawBytes, offset = 0) {
|
|
396
|
+
return createDecoder({
|
|
397
|
+
read(rawBytes, offset) {
|
|
418
398
|
const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);
|
|
419
399
|
if (bytes.length === 0)
|
|
420
400
|
return ["", 0];
|
|
@@ -423,51 +403,63 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
423
403
|
const leadingZeroes = alphabet4[0].repeat(trailIndex);
|
|
424
404
|
if (trailIndex === bytes.length)
|
|
425
405
|
return [leadingZeroes, rawBytes.length];
|
|
426
|
-
|
|
427
|
-
const tailChars =
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
return [leadingZeroes + tailChars.join(""), rawBytes.length];
|
|
433
|
-
},
|
|
434
|
-
description: `base${base}`,
|
|
435
|
-
fixedSize: null,
|
|
436
|
-
maxSize: null
|
|
437
|
-
};
|
|
406
|
+
const base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
|
|
407
|
+
const tailChars = getBaseXFromBigInt(base10Number, alphabet4);
|
|
408
|
+
return [leadingZeroes + tailChars, rawBytes.length];
|
|
409
|
+
}
|
|
410
|
+
});
|
|
438
411
|
};
|
|
412
|
+
function partitionLeadingZeroes(value, zeroCharacter) {
|
|
413
|
+
const leadingZeroIndex = [...value].findIndex((c) => c !== zeroCharacter);
|
|
414
|
+
return leadingZeroIndex === -1 ? [value, ""] : [value.slice(0, leadingZeroIndex), value.slice(leadingZeroIndex)];
|
|
415
|
+
}
|
|
416
|
+
function getBigIntFromBaseX(value, alphabet4) {
|
|
417
|
+
const base = BigInt(alphabet4.length);
|
|
418
|
+
return [...value].reduce((sum, char) => sum * base + BigInt(alphabet4.indexOf(char)), 0n);
|
|
419
|
+
}
|
|
420
|
+
function getBaseXFromBigInt(value, alphabet4) {
|
|
421
|
+
const base = BigInt(alphabet4.length);
|
|
422
|
+
const tailChars = [];
|
|
423
|
+
while (value > 0n) {
|
|
424
|
+
tailChars.unshift(alphabet4[Number(value % base)]);
|
|
425
|
+
value /= base;
|
|
426
|
+
}
|
|
427
|
+
return tailChars.join("");
|
|
428
|
+
}
|
|
439
429
|
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
440
430
|
var getBase58Encoder = () => getBaseXEncoder(alphabet2);
|
|
441
431
|
var getBase58Decoder = () => getBaseXDecoder(alphabet2);
|
|
442
432
|
var getBase64Encoder = () => {
|
|
443
433
|
{
|
|
444
|
-
return {
|
|
445
|
-
|
|
446
|
-
encode(value) {
|
|
434
|
+
return createEncoder({
|
|
435
|
+
getSizeFromValue: (value) => {
|
|
447
436
|
try {
|
|
448
|
-
|
|
449
|
-
return new Uint8Array(bytes);
|
|
437
|
+
return atob(value).length;
|
|
450
438
|
} catch (e23) {
|
|
451
439
|
throw new Error(`Expected a string of base 64, got [${value}].`);
|
|
452
440
|
}
|
|
453
441
|
},
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
442
|
+
write(value, bytes, offset) {
|
|
443
|
+
try {
|
|
444
|
+
const bytesToAdd = atob(value).split("").map((c) => c.charCodeAt(0));
|
|
445
|
+
bytes.set(bytesToAdd, offset);
|
|
446
|
+
return bytesToAdd.length + offset;
|
|
447
|
+
} catch (e23) {
|
|
448
|
+
throw new Error(`Expected a string of base 64, got [${value}].`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
});
|
|
457
452
|
}
|
|
458
453
|
};
|
|
459
454
|
var getBase64Decoder = () => {
|
|
460
455
|
{
|
|
461
|
-
return {
|
|
462
|
-
|
|
456
|
+
return createDecoder({
|
|
457
|
+
read(bytes, offset = 0) {
|
|
463
458
|
const slice = bytes.slice(offset);
|
|
464
459
|
const value = btoa(String.fromCharCode(...slice));
|
|
465
460
|
return [value, bytes.length];
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
fixedSize: null,
|
|
469
|
-
maxSize: null
|
|
470
|
-
};
|
|
461
|
+
}
|
|
462
|
+
});
|
|
471
463
|
}
|
|
472
464
|
};
|
|
473
465
|
var removeNullCharacters = (value) => (
|
|
@@ -478,77 +470,69 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
478
470
|
var o = globalThis.TextEncoder;
|
|
479
471
|
var getUtf8Encoder = () => {
|
|
480
472
|
let textEncoder;
|
|
481
|
-
return {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
473
|
+
return createEncoder({
|
|
474
|
+
getSizeFromValue: (value) => (textEncoder || (textEncoder = new o())).encode(value).length,
|
|
475
|
+
write: (value, bytes, offset) => {
|
|
476
|
+
const bytesToAdd = (textEncoder || (textEncoder = new o())).encode(value);
|
|
477
|
+
bytes.set(bytesToAdd, offset);
|
|
478
|
+
return offset + bytesToAdd.length;
|
|
479
|
+
}
|
|
480
|
+
});
|
|
487
481
|
};
|
|
488
482
|
var getUtf8Decoder = () => {
|
|
489
483
|
let textDecoder;
|
|
490
|
-
return {
|
|
491
|
-
|
|
484
|
+
return createDecoder({
|
|
485
|
+
read(bytes, offset) {
|
|
492
486
|
const value = (textDecoder || (textDecoder = new e())).decode(bytes.slice(offset));
|
|
493
487
|
return [removeNullCharacters(value), bytes.length];
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
fixedSize: null,
|
|
497
|
-
maxSize: null
|
|
498
|
-
};
|
|
488
|
+
}
|
|
489
|
+
});
|
|
499
490
|
};
|
|
500
|
-
|
|
501
|
-
var _a, _b
|
|
491
|
+
function getStringEncoder(config = {}) {
|
|
492
|
+
var _a, _b;
|
|
502
493
|
const size = (_a = config.size) != null ? _a : getU32Encoder();
|
|
503
494
|
const encoding = (_b = config.encoding) != null ? _b : getUtf8Encoder();
|
|
504
|
-
const description = (_c = config.description) != null ? _c : `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
505
495
|
if (size === "variable") {
|
|
506
|
-
return
|
|
496
|
+
return encoding;
|
|
507
497
|
}
|
|
508
498
|
if (typeof size === "number") {
|
|
509
|
-
return fixEncoder(encoding, size
|
|
499
|
+
return fixEncoder(encoding, size);
|
|
510
500
|
}
|
|
511
|
-
return {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
const lengthBytes = size.encode(contentBytes.length);
|
|
516
|
-
return mergeBytes([lengthBytes, contentBytes]);
|
|
501
|
+
return createEncoder({
|
|
502
|
+
getSizeFromValue: (value) => {
|
|
503
|
+
const contentSize = getEncodedSize(value, encoding);
|
|
504
|
+
return getEncodedSize(contentSize, size) + contentSize;
|
|
517
505
|
},
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
506
|
+
write: (value, bytes, offset) => {
|
|
507
|
+
const contentSize = getEncodedSize(value, encoding);
|
|
508
|
+
offset = size.write(contentSize, bytes, offset);
|
|
509
|
+
return encoding.write(value, bytes, offset);
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
function getStringDecoder(config = {}) {
|
|
514
|
+
var _a, _b;
|
|
524
515
|
const size = (_a = config.size) != null ? _a : getU32Decoder();
|
|
525
516
|
const encoding = (_b = config.encoding) != null ? _b : getUtf8Decoder();
|
|
526
|
-
const description = (_c = config.description) != null ? _c : `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
527
517
|
if (size === "variable") {
|
|
528
|
-
return
|
|
518
|
+
return encoding;
|
|
529
519
|
}
|
|
530
520
|
if (typeof size === "number") {
|
|
531
|
-
return fixDecoder(encoding, size
|
|
521
|
+
return fixDecoder(encoding, size);
|
|
532
522
|
}
|
|
533
|
-
return {
|
|
534
|
-
|
|
523
|
+
return createDecoder({
|
|
524
|
+
read: (bytes, offset = 0) => {
|
|
535
525
|
assertByteArrayIsNotEmptyForCodec("string", bytes, offset);
|
|
536
|
-
const [lengthBigInt, lengthOffset] = size.
|
|
526
|
+
const [lengthBigInt, lengthOffset] = size.read(bytes, offset);
|
|
537
527
|
const length = Number(lengthBigInt);
|
|
538
528
|
offset = lengthOffset;
|
|
539
529
|
const contentBytes = bytes.slice(offset, offset + length);
|
|
540
530
|
assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes);
|
|
541
|
-
const [value, contentOffset] = encoding.
|
|
531
|
+
const [value, contentOffset] = encoding.read(contentBytes, 0);
|
|
542
532
|
offset += contentOffset;
|
|
543
533
|
return [value, offset];
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
fixedSize: null,
|
|
547
|
-
maxSize: null
|
|
548
|
-
};
|
|
549
|
-
};
|
|
550
|
-
function getSizeDescription(size) {
|
|
551
|
-
return typeof size === "object" ? size.description : `${size}`;
|
|
534
|
+
}
|
|
535
|
+
});
|
|
552
536
|
}
|
|
553
537
|
|
|
554
538
|
// ../assertions/dist/index.browser.js
|
|
@@ -677,27 +661,17 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
677
661
|
assertIsAddress(putativeAddress);
|
|
678
662
|
return putativeAddress;
|
|
679
663
|
}
|
|
680
|
-
function getAddressEncoder(
|
|
681
|
-
var _a;
|
|
664
|
+
function getAddressEncoder() {
|
|
682
665
|
return mapEncoder(
|
|
683
|
-
getStringEncoder({
|
|
684
|
-
description: (_a = config == null ? void 0 : config.description) != null ? _a : "Address",
|
|
685
|
-
encoding: getMemoizedBase58Encoder(),
|
|
686
|
-
size: 32
|
|
687
|
-
}),
|
|
666
|
+
getStringEncoder({ encoding: getMemoizedBase58Encoder(), size: 32 }),
|
|
688
667
|
(putativeAddress) => address(putativeAddress)
|
|
689
668
|
);
|
|
690
669
|
}
|
|
691
|
-
function getAddressDecoder(
|
|
692
|
-
|
|
693
|
-
return getStringDecoder({
|
|
694
|
-
description: (_a = config == null ? void 0 : config.description) != null ? _a : "Address",
|
|
695
|
-
encoding: getMemoizedBase58Decoder(),
|
|
696
|
-
size: 32
|
|
697
|
-
});
|
|
670
|
+
function getAddressDecoder() {
|
|
671
|
+
return getStringDecoder({ encoding: getMemoizedBase58Decoder(), size: 32 });
|
|
698
672
|
}
|
|
699
|
-
function getAddressCodec(
|
|
700
|
-
return combineCodec(getAddressEncoder(
|
|
673
|
+
function getAddressCodec() {
|
|
674
|
+
return combineCodec(getAddressEncoder(), getAddressDecoder());
|
|
701
675
|
}
|
|
702
676
|
function getAddressComparator() {
|
|
703
677
|
return new Intl.Collator("en", {
|
|
@@ -862,7 +836,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
862
836
|
if (await compressedPointBytesAreOnCurve(addressBytes)) {
|
|
863
837
|
throw new PointOnCurveError("Invalid seeds; point must fall off the Ed25519 curve");
|
|
864
838
|
}
|
|
865
|
-
return base58EncodedAddressCodec.decode(addressBytes)
|
|
839
|
+
return base58EncodedAddressCodec.decode(addressBytes);
|
|
866
840
|
}
|
|
867
841
|
async function getProgramDerivedAddress({
|
|
868
842
|
programAddress,
|
|
@@ -887,21 +861,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
887
861
|
throw new Error("Unable to find a viable program address bump seed");
|
|
888
862
|
}
|
|
889
863
|
async function createAddressWithSeed({ baseAddress, programAddress, seed }) {
|
|
890
|
-
const { encode
|
|
864
|
+
const { encode, decode } = getAddressCodec();
|
|
891
865
|
const seedBytes = typeof seed === "string" ? new TextEncoder().encode(seed) : seed;
|
|
892
866
|
if (seedBytes.byteLength > MAX_SEED_LENGTH) {
|
|
893
867
|
throw new Error(`The seed exceeds the maximum length of 32 bytes`);
|
|
894
868
|
}
|
|
895
|
-
const programAddressBytes =
|
|
869
|
+
const programAddressBytes = encode(programAddress);
|
|
896
870
|
if (programAddressBytes.length >= PDA_MARKER_BYTES.length && programAddressBytes.slice(-PDA_MARKER_BYTES.length).every((byte, index) => byte === PDA_MARKER_BYTES[index])) {
|
|
897
871
|
throw new Error(`programAddress cannot end with the PDA marker`);
|
|
898
872
|
}
|
|
899
873
|
const addressBytesBuffer = await crypto.subtle.digest(
|
|
900
874
|
"SHA-256",
|
|
901
|
-
new Uint8Array([...
|
|
875
|
+
new Uint8Array([...encode(baseAddress), ...seedBytes, ...programAddressBytes])
|
|
902
876
|
);
|
|
903
877
|
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
904
|
-
return
|
|
878
|
+
return decode(addressBytes);
|
|
905
879
|
}
|
|
906
880
|
async function getAddressFromPublicKey(publicKey) {
|
|
907
881
|
await assertKeyExporterIsAvailable();
|
|
@@ -909,8 +883,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
909
883
|
throw new Error("The `CryptoKey` must be an `Ed25519` public key");
|
|
910
884
|
}
|
|
911
885
|
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
912
|
-
|
|
913
|
-
|
|
886
|
+
return getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
// ../functional/dist/index.browser.js
|
|
890
|
+
init_env_shim();
|
|
891
|
+
function pipe(init, ...fns) {
|
|
892
|
+
return fns.reduce((acc, fn) => fn(acc), init);
|
|
914
893
|
}
|
|
915
894
|
|
|
916
895
|
// ../instructions/dist/index.browser.js
|
|
@@ -966,6 +945,59 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
966
945
|
);
|
|
967
946
|
return keyPair;
|
|
968
947
|
}
|
|
948
|
+
function addPkcs8Header(bytes) {
|
|
949
|
+
return new Uint8Array([
|
|
950
|
+
/**
|
|
951
|
+
* PKCS#8 header
|
|
952
|
+
*/
|
|
953
|
+
48,
|
|
954
|
+
// ASN.1 sequence tag
|
|
955
|
+
46,
|
|
956
|
+
// Length of sequence (46 more bytes)
|
|
957
|
+
2,
|
|
958
|
+
// ASN.1 integer tag
|
|
959
|
+
1,
|
|
960
|
+
// Length of integer
|
|
961
|
+
0,
|
|
962
|
+
// Version number
|
|
963
|
+
48,
|
|
964
|
+
// ASN.1 sequence tag
|
|
965
|
+
5,
|
|
966
|
+
// Length of sequence
|
|
967
|
+
6,
|
|
968
|
+
// ASN.1 object identifier tag
|
|
969
|
+
3,
|
|
970
|
+
// Length of object identifier
|
|
971
|
+
// Edwards curve algorithms identifier https://oid-rep.orange-labs.fr/get/1.3.101.112
|
|
972
|
+
43,
|
|
973
|
+
// iso(1) / identified-organization(3) (The first node is multiplied by the decimal 40 and the result is added to the value of the second node)
|
|
974
|
+
101,
|
|
975
|
+
// thawte(101)
|
|
976
|
+
// Ed25519 identifier
|
|
977
|
+
112,
|
|
978
|
+
// id-Ed25519(112)
|
|
979
|
+
/**
|
|
980
|
+
* Private key payload
|
|
981
|
+
*/
|
|
982
|
+
4,
|
|
983
|
+
// ASN.1 octet string tag
|
|
984
|
+
34,
|
|
985
|
+
// String length (34 more bytes)
|
|
986
|
+
// Private key bytes as octet string
|
|
987
|
+
4,
|
|
988
|
+
// ASN.1 octet string tag
|
|
989
|
+
32,
|
|
990
|
+
// String length (32 bytes)
|
|
991
|
+
...bytes
|
|
992
|
+
]);
|
|
993
|
+
}
|
|
994
|
+
async function createPrivateKeyFromBytes(bytes, extractable) {
|
|
995
|
+
if (bytes.byteLength !== 32) {
|
|
996
|
+
throw new Error("Private key bytes must be of length 32");
|
|
997
|
+
}
|
|
998
|
+
const privateKeyBytesPkcs8 = addPkcs8Header(bytes);
|
|
999
|
+
return await crypto.subtle.importKey("pkcs8", privateKeyBytesPkcs8, "Ed25519", extractable != null ? extractable : false, ["sign"]);
|
|
1000
|
+
}
|
|
969
1001
|
var base58Encoder;
|
|
970
1002
|
function assertIsSignature(putativeSignature) {
|
|
971
1003
|
if (!base58Encoder)
|
|
@@ -1118,192 +1150,197 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1118
1150
|
|
|
1119
1151
|
// ../codecs-data-structures/dist/index.browser.js
|
|
1120
1152
|
init_env_shim();
|
|
1121
|
-
function sumCodecSizes(sizes) {
|
|
1122
|
-
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
|
|
1123
|
-
}
|
|
1124
|
-
function decodeArrayLikeCodecSize(size, childrenSizes, bytes, offset) {
|
|
1125
|
-
if (typeof size === "number") {
|
|
1126
|
-
return [size, offset];
|
|
1127
|
-
}
|
|
1128
|
-
if (typeof size === "object") {
|
|
1129
|
-
return size.decode(bytes, offset);
|
|
1130
|
-
}
|
|
1131
|
-
if (size === "remainder") {
|
|
1132
|
-
const childrenSize = sumCodecSizes(childrenSizes);
|
|
1133
|
-
if (childrenSize === null) {
|
|
1134
|
-
throw new Error('Codecs of "remainder" size must have fixed-size items.');
|
|
1135
|
-
}
|
|
1136
|
-
const remainder = bytes.slice(offset).length;
|
|
1137
|
-
if (remainder % childrenSize !== 0) {
|
|
1138
|
-
throw new Error(
|
|
1139
|
-
`The remainder of the byte array (${remainder} bytes) cannot be split into chunks of ${childrenSize} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${remainder} modulo ${childrenSize} should be equal to zero.`
|
|
1140
|
-
);
|
|
1141
|
-
}
|
|
1142
|
-
return [remainder / childrenSize, offset];
|
|
1143
|
-
}
|
|
1144
|
-
throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(size)}`);
|
|
1145
|
-
}
|
|
1146
|
-
function getArrayLikeCodecSizeDescription(size) {
|
|
1147
|
-
return typeof size === "object" ? size.description : `${size}`;
|
|
1148
|
-
}
|
|
1149
|
-
function getArrayLikeCodecSizeFromChildren(size, childrenSizes) {
|
|
1150
|
-
if (typeof size !== "number")
|
|
1151
|
-
return null;
|
|
1152
|
-
if (size === 0)
|
|
1153
|
-
return 0;
|
|
1154
|
-
const childrenSize = sumCodecSizes(childrenSizes);
|
|
1155
|
-
return childrenSize === null ? null : childrenSize * size;
|
|
1156
|
-
}
|
|
1157
|
-
function getArrayLikeCodecSizePrefix(size, realSize) {
|
|
1158
|
-
return typeof size === "object" ? size.encode(realSize) : new Uint8Array();
|
|
1159
|
-
}
|
|
1160
1153
|
function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
|
|
1161
1154
|
if (expected !== actual) {
|
|
1162
1155
|
throw new Error(`Expected [${codecDescription}] to have ${expected} items, got ${actual}.`);
|
|
1163
1156
|
}
|
|
1164
1157
|
}
|
|
1165
|
-
function
|
|
1166
|
-
|
|
1167
|
-
throw new Error('Codecs of "remainder" size must have fixed-size items.');
|
|
1168
|
-
}
|
|
1169
|
-
return {
|
|
1170
|
-
description: description != null ? description : `array(${item.description}; ${getArrayLikeCodecSizeDescription(size)})`,
|
|
1171
|
-
fixedSize: getArrayLikeCodecSizeFromChildren(size, [item.fixedSize]),
|
|
1172
|
-
maxSize: getArrayLikeCodecSizeFromChildren(size, [item.maxSize])
|
|
1173
|
-
};
|
|
1158
|
+
function sumCodecSizes(sizes) {
|
|
1159
|
+
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
|
|
1174
1160
|
}
|
|
1175
|
-
function
|
|
1161
|
+
function getFixedSize(codec) {
|
|
1162
|
+
return isFixedSize(codec) ? codec.fixedSize : null;
|
|
1163
|
+
}
|
|
1164
|
+
function getMaxSize(codec) {
|
|
1176
1165
|
var _a;
|
|
1166
|
+
return isFixedSize(codec) ? codec.fixedSize : (_a = codec.maxSize) != null ? _a : null;
|
|
1167
|
+
}
|
|
1168
|
+
function getArrayEncoder(item, config = {}) {
|
|
1169
|
+
var _a, _b;
|
|
1177
1170
|
const size = (_a = config.size) != null ? _a : getU32Encoder();
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1171
|
+
if (size === "remainder") {
|
|
1172
|
+
assertIsFixedSize(item, 'Codecs of "remainder" size must have fixed-size items.');
|
|
1173
|
+
}
|
|
1174
|
+
const fixedSize = computeArrayLikeCodecSize(size, getFixedSize(item));
|
|
1175
|
+
const maxSize = (_b = computeArrayLikeCodecSize(size, getMaxSize(item))) != null ? _b : void 0;
|
|
1176
|
+
return createEncoder({
|
|
1177
|
+
...fixedSize !== null ? { fixedSize } : {
|
|
1178
|
+
getSizeFromValue: (array) => {
|
|
1179
|
+
const prefixSize = typeof size === "object" ? getEncodedSize(array.length, size) : 0;
|
|
1180
|
+
return prefixSize + [...array].reduce((all, value) => all + getEncodedSize(value, item), 0);
|
|
1181
|
+
},
|
|
1182
|
+
maxSize
|
|
1183
|
+
},
|
|
1184
|
+
write: (array, bytes, offset) => {
|
|
1181
1185
|
if (typeof size === "number") {
|
|
1182
|
-
assertValidNumberOfItemsForCodec("array", size,
|
|
1186
|
+
assertValidNumberOfItemsForCodec("array", size, array.length);
|
|
1187
|
+
}
|
|
1188
|
+
if (typeof size === "object") {
|
|
1189
|
+
offset = size.write(array.length, bytes, offset);
|
|
1183
1190
|
}
|
|
1184
|
-
|
|
1191
|
+
array.forEach((value) => {
|
|
1192
|
+
offset = item.write(value, bytes, offset);
|
|
1193
|
+
});
|
|
1194
|
+
return offset;
|
|
1185
1195
|
}
|
|
1186
|
-
};
|
|
1196
|
+
});
|
|
1187
1197
|
}
|
|
1188
1198
|
function getArrayDecoder(item, config = {}) {
|
|
1189
|
-
var _a;
|
|
1199
|
+
var _a, _b;
|
|
1190
1200
|
const size = (_a = config.size) != null ? _a : getU32Decoder();
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1201
|
+
if (size === "remainder") {
|
|
1202
|
+
assertIsFixedSize(item, 'Codecs of "remainder" size must have fixed-size items.');
|
|
1203
|
+
}
|
|
1204
|
+
const itemSize = getFixedSize(item);
|
|
1205
|
+
const fixedSize = computeArrayLikeCodecSize(size, itemSize);
|
|
1206
|
+
const maxSize = (_b = computeArrayLikeCodecSize(size, getMaxSize(item))) != null ? _b : void 0;
|
|
1207
|
+
return createDecoder({
|
|
1208
|
+
...fixedSize !== null ? { fixedSize } : { maxSize },
|
|
1209
|
+
read: (bytes, offset) => {
|
|
1210
|
+
const array = [];
|
|
1194
1211
|
if (typeof size === "object" && bytes.slice(offset).length === 0) {
|
|
1195
|
-
return [
|
|
1212
|
+
return [array, offset];
|
|
1196
1213
|
}
|
|
1197
|
-
const [resolvedSize, newOffset] =
|
|
1214
|
+
const [resolvedSize, newOffset] = readArrayLikeCodecSize(size, itemSize, bytes, offset);
|
|
1198
1215
|
offset = newOffset;
|
|
1199
|
-
const values = [];
|
|
1200
1216
|
for (let i = 0; i < resolvedSize; i += 1) {
|
|
1201
|
-
const [value, newOffset2] = item.
|
|
1202
|
-
values.push(value);
|
|
1217
|
+
const [value, newOffset2] = item.read(bytes, offset);
|
|
1203
1218
|
offset = newOffset2;
|
|
1219
|
+
array.push(value);
|
|
1204
1220
|
}
|
|
1205
|
-
return [
|
|
1221
|
+
return [array, offset];
|
|
1206
1222
|
}
|
|
1207
|
-
};
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
function readArrayLikeCodecSize(size, itemSize, bytes, offset) {
|
|
1226
|
+
if (typeof size === "number") {
|
|
1227
|
+
return [size, offset];
|
|
1228
|
+
}
|
|
1229
|
+
if (typeof size === "object") {
|
|
1230
|
+
return size.read(bytes, offset);
|
|
1231
|
+
}
|
|
1232
|
+
if (size === "remainder") {
|
|
1233
|
+
if (itemSize === null) {
|
|
1234
|
+
throw new Error('Codecs of "remainder" size must have fixed-size items.');
|
|
1235
|
+
}
|
|
1236
|
+
const remainder = Math.max(0, bytes.length - offset);
|
|
1237
|
+
if (remainder % itemSize !== 0) {
|
|
1238
|
+
throw new Error(
|
|
1239
|
+
`The remainder of the byte array (${remainder} bytes) cannot be split into chunks of ${itemSize} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${remainder} modulo ${itemSize} should be equal to zero.`
|
|
1240
|
+
);
|
|
1241
|
+
}
|
|
1242
|
+
return [remainder / itemSize, offset];
|
|
1243
|
+
}
|
|
1244
|
+
throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(size)}`);
|
|
1245
|
+
}
|
|
1246
|
+
function computeArrayLikeCodecSize(size, itemSize) {
|
|
1247
|
+
if (typeof size !== "number")
|
|
1248
|
+
return null;
|
|
1249
|
+
if (size === 0)
|
|
1250
|
+
return 0;
|
|
1251
|
+
return itemSize === null ? null : itemSize * size;
|
|
1208
1252
|
}
|
|
1209
1253
|
function getBytesEncoder(config = {}) {
|
|
1210
|
-
var _a
|
|
1254
|
+
var _a;
|
|
1211
1255
|
const size = (_a = config.size) != null ? _a : "variable";
|
|
1212
|
-
const
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
};
|
|
1256
|
+
const byteEncoder = createEncoder({
|
|
1257
|
+
getSizeFromValue: (value) => value.length,
|
|
1258
|
+
write: (value, bytes, offset) => {
|
|
1259
|
+
bytes.set(value, offset);
|
|
1260
|
+
return offset + value.length;
|
|
1261
|
+
}
|
|
1262
|
+
});
|
|
1220
1263
|
if (size === "variable") {
|
|
1221
1264
|
return byteEncoder;
|
|
1222
1265
|
}
|
|
1223
1266
|
if (typeof size === "number") {
|
|
1224
|
-
return fixEncoder(byteEncoder, size
|
|
1267
|
+
return fixEncoder(byteEncoder, size);
|
|
1225
1268
|
}
|
|
1226
|
-
return {
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
return mergeBytes([lengthBytes, contentBytes]);
|
|
1269
|
+
return createEncoder({
|
|
1270
|
+
getSizeFromValue: (value) => getEncodedSize(value.length, size) + value.length,
|
|
1271
|
+
write: (value, bytes, offset) => {
|
|
1272
|
+
offset = size.write(value.length, bytes, offset);
|
|
1273
|
+
return byteEncoder.write(value, bytes, offset);
|
|
1232
1274
|
}
|
|
1233
|
-
};
|
|
1275
|
+
});
|
|
1234
1276
|
}
|
|
1235
1277
|
function getBytesDecoder(config = {}) {
|
|
1236
|
-
var _a
|
|
1278
|
+
var _a;
|
|
1237
1279
|
const size = (_a = config.size) != null ? _a : "variable";
|
|
1238
|
-
const
|
|
1239
|
-
|
|
1240
|
-
const byteDecoder = {
|
|
1241
|
-
decode: (bytes, offset = 0) => {
|
|
1280
|
+
const byteDecoder = createDecoder({
|
|
1281
|
+
read: (bytes, offset) => {
|
|
1242
1282
|
const slice = bytes.slice(offset);
|
|
1243
1283
|
return [slice, offset + slice.length];
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
fixedSize: null,
|
|
1247
|
-
maxSize: null
|
|
1248
|
-
};
|
|
1284
|
+
}
|
|
1285
|
+
});
|
|
1249
1286
|
if (size === "variable") {
|
|
1250
1287
|
return byteDecoder;
|
|
1251
1288
|
}
|
|
1252
1289
|
if (typeof size === "number") {
|
|
1253
|
-
return fixDecoder(byteDecoder, size
|
|
1290
|
+
return fixDecoder(byteDecoder, size);
|
|
1254
1291
|
}
|
|
1255
|
-
return {
|
|
1256
|
-
|
|
1257
|
-
decode: (bytes, offset = 0) => {
|
|
1292
|
+
return createDecoder({
|
|
1293
|
+
read: (bytes, offset) => {
|
|
1258
1294
|
assertByteArrayIsNotEmptyForCodec("bytes", bytes, offset);
|
|
1259
|
-
const [lengthBigInt, lengthOffset] = size.
|
|
1295
|
+
const [lengthBigInt, lengthOffset] = size.read(bytes, offset);
|
|
1260
1296
|
const length = Number(lengthBigInt);
|
|
1261
1297
|
offset = lengthOffset;
|
|
1262
1298
|
const contentBytes = bytes.slice(offset, offset + length);
|
|
1263
1299
|
assertByteArrayHasEnoughBytesForCodec("bytes", length, contentBytes);
|
|
1264
|
-
const [value, contentOffset] = byteDecoder.
|
|
1300
|
+
const [value, contentOffset] = byteDecoder.read(contentBytes, 0);
|
|
1265
1301
|
offset += contentOffset;
|
|
1266
1302
|
return [value, offset];
|
|
1267
1303
|
}
|
|
1268
|
-
};
|
|
1269
|
-
}
|
|
1270
|
-
function structCodecHelper(fields, description) {
|
|
1271
|
-
const fieldDescriptions = fields.map(([name, codec]) => `${String(name)}: ${codec.description}`).join(", ");
|
|
1272
|
-
return {
|
|
1273
|
-
description: description != null ? description : `struct(${fieldDescriptions})`,
|
|
1274
|
-
fixedSize: sumCodecSizes(fields.map(([, field]) => field.fixedSize)),
|
|
1275
|
-
maxSize: sumCodecSizes(fields.map(([, field]) => field.maxSize))
|
|
1276
|
-
};
|
|
1304
|
+
});
|
|
1277
1305
|
}
|
|
1278
|
-
function getStructEncoder(fields
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1306
|
+
function getStructEncoder(fields) {
|
|
1307
|
+
var _a;
|
|
1308
|
+
const fieldCodecs = fields.map(([, codec]) => codec);
|
|
1309
|
+
const fixedSize = sumCodecSizes(fieldCodecs.map(getFixedSize));
|
|
1310
|
+
const maxSize = (_a = sumCodecSizes(fieldCodecs.map(getMaxSize))) != null ? _a : void 0;
|
|
1311
|
+
return createEncoder({
|
|
1312
|
+
...fixedSize === null ? {
|
|
1313
|
+
getSizeFromValue: (value) => fields.map(([key, codec]) => getEncodedSize(value[key], codec)).reduce((all, one) => all + one, 0),
|
|
1314
|
+
maxSize
|
|
1315
|
+
} : { fixedSize },
|
|
1316
|
+
write: (struct, bytes, offset) => {
|
|
1317
|
+
fields.forEach(([key, codec]) => {
|
|
1318
|
+
offset = codec.write(struct[key], bytes, offset);
|
|
1319
|
+
});
|
|
1320
|
+
return offset;
|
|
1284
1321
|
}
|
|
1285
|
-
};
|
|
1322
|
+
});
|
|
1286
1323
|
}
|
|
1287
|
-
function getStructDecoder(fields
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1324
|
+
function getStructDecoder(fields) {
|
|
1325
|
+
var _a;
|
|
1326
|
+
const fieldCodecs = fields.map(([, codec]) => codec);
|
|
1327
|
+
const fixedSize = sumCodecSizes(fieldCodecs.map(getFixedSize));
|
|
1328
|
+
const maxSize = (_a = sumCodecSizes(fieldCodecs.map(getMaxSize))) != null ? _a : void 0;
|
|
1329
|
+
return createDecoder({
|
|
1330
|
+
...fixedSize === null ? { maxSize } : { fixedSize },
|
|
1331
|
+
read: (bytes, offset) => {
|
|
1291
1332
|
const struct = {};
|
|
1292
1333
|
fields.forEach(([key, codec]) => {
|
|
1293
|
-
const [value, newOffset] = codec.
|
|
1334
|
+
const [value, newOffset] = codec.read(bytes, offset);
|
|
1294
1335
|
offset = newOffset;
|
|
1295
1336
|
struct[key] = value;
|
|
1296
1337
|
});
|
|
1297
1338
|
return [struct, offset];
|
|
1298
1339
|
}
|
|
1299
|
-
};
|
|
1340
|
+
});
|
|
1300
1341
|
}
|
|
1301
1342
|
|
|
1302
|
-
// ../
|
|
1303
|
-
init_env_shim();
|
|
1304
|
-
function pipe(init, ...fns) {
|
|
1305
|
-
return fns.reduce((acc, fn) => fn(acc), init);
|
|
1306
|
-
}
|
|
1343
|
+
// ../transactions/dist/index.browser.js
|
|
1307
1344
|
function getUnsignedTransaction(transaction) {
|
|
1308
1345
|
if ("signatures" in transaction) {
|
|
1309
1346
|
const {
|
|
@@ -1339,6 +1376,22 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1339
1376
|
});
|
|
1340
1377
|
}
|
|
1341
1378
|
}
|
|
1379
|
+
function isTransactionWithBlockhashLifetime(transaction) {
|
|
1380
|
+
const lifetimeConstraintShapeMatches = "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.blockhash === "string" && typeof transaction.lifetimeConstraint.lastValidBlockHeight === "bigint";
|
|
1381
|
+
if (!lifetimeConstraintShapeMatches)
|
|
1382
|
+
return false;
|
|
1383
|
+
try {
|
|
1384
|
+
assertIsBlockhash(transaction.lifetimeConstraint.blockhash);
|
|
1385
|
+
return true;
|
|
1386
|
+
} catch {
|
|
1387
|
+
return false;
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
function assertIsTransactionWithBlockhashLifetime(transaction) {
|
|
1391
|
+
if (!isTransactionWithBlockhashLifetime(transaction)) {
|
|
1392
|
+
throw new Error("Transaction does not have a blockhash lifetime");
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1342
1395
|
function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
|
|
1343
1396
|
if ("lifetimeConstraint" in transaction && transaction.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash && transaction.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight) {
|
|
1344
1397
|
return transaction;
|
|
@@ -1742,59 +1795,31 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1742
1795
|
version: transaction.version
|
|
1743
1796
|
};
|
|
1744
1797
|
}
|
|
1745
|
-
var lookupTableAddressDescription = "The address of the address lookup table account from which instruction addresses should be looked up" ;
|
|
1746
|
-
var writableIndicesDescription = "The indices of the accounts in the lookup table that should be loaded as writeable" ;
|
|
1747
|
-
var readableIndicesDescription = "The indices of the accounts in the lookup table that should be loaded as read-only" ;
|
|
1748
|
-
var addressTableLookupDescription = "A pointer to the address of an address lookup table, along with the readonly/writeable indices of the addresses that should be loaded from it" ;
|
|
1749
1798
|
var memoizedAddressTableLookupEncoder;
|
|
1750
1799
|
function getAddressTableLookupEncoder() {
|
|
1751
1800
|
if (!memoizedAddressTableLookupEncoder) {
|
|
1752
|
-
memoizedAddressTableLookupEncoder = getStructEncoder(
|
|
1801
|
+
memoizedAddressTableLookupEncoder = getStructEncoder([
|
|
1802
|
+
["lookupTableAddress", getAddressEncoder()],
|
|
1753
1803
|
[
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
"writableIndices",
|
|
1757
|
-
getArrayEncoder(getU8Encoder(), {
|
|
1758
|
-
description: writableIndicesDescription,
|
|
1759
|
-
size: getShortU16Encoder()
|
|
1760
|
-
})
|
|
1761
|
-
],
|
|
1762
|
-
[
|
|
1763
|
-
"readableIndices",
|
|
1764
|
-
getArrayEncoder(getU8Encoder(), {
|
|
1765
|
-
description: readableIndicesDescription,
|
|
1766
|
-
size: getShortU16Encoder()
|
|
1767
|
-
})
|
|
1768
|
-
]
|
|
1804
|
+
"writableIndices",
|
|
1805
|
+
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })
|
|
1769
1806
|
],
|
|
1770
|
-
|
|
1771
|
-
|
|
1807
|
+
[
|
|
1808
|
+
"readableIndices",
|
|
1809
|
+
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })
|
|
1810
|
+
]
|
|
1811
|
+
]);
|
|
1772
1812
|
}
|
|
1773
1813
|
return memoizedAddressTableLookupEncoder;
|
|
1774
1814
|
}
|
|
1775
1815
|
var memoizedAddressTableLookupDecoder;
|
|
1776
1816
|
function getAddressTableLookupDecoder() {
|
|
1777
1817
|
if (!memoizedAddressTableLookupDecoder) {
|
|
1778
|
-
memoizedAddressTableLookupDecoder = getStructDecoder(
|
|
1779
|
-
[
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
getArrayDecoder(getU8Decoder(), {
|
|
1784
|
-
description: writableIndicesDescription,
|
|
1785
|
-
size: getShortU16Decoder()
|
|
1786
|
-
})
|
|
1787
|
-
],
|
|
1788
|
-
[
|
|
1789
|
-
"readableIndices",
|
|
1790
|
-
getArrayDecoder(getU8Decoder(), {
|
|
1791
|
-
description: readableIndicesDescription,
|
|
1792
|
-
size: getShortU16Decoder()
|
|
1793
|
-
})
|
|
1794
|
-
]
|
|
1795
|
-
],
|
|
1796
|
-
{ description: addressTableLookupDescription }
|
|
1797
|
-
);
|
|
1818
|
+
memoizedAddressTableLookupDecoder = getStructDecoder([
|
|
1819
|
+
["lookupTableAddress", getAddressDecoder()],
|
|
1820
|
+
["writableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })],
|
|
1821
|
+
["readableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })]
|
|
1822
|
+
]);
|
|
1798
1823
|
}
|
|
1799
1824
|
return memoizedAddressTableLookupDecoder;
|
|
1800
1825
|
}
|
|
@@ -1804,72 +1829,34 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1804
1829
|
memoizedU8Encoder = getU8Encoder();
|
|
1805
1830
|
return memoizedU8Encoder;
|
|
1806
1831
|
}
|
|
1807
|
-
function getMemoizedU8EncoderDescription(description) {
|
|
1808
|
-
const encoder = getMemoizedU8Encoder();
|
|
1809
|
-
return {
|
|
1810
|
-
...encoder,
|
|
1811
|
-
description: description != null ? description : encoder.description
|
|
1812
|
-
};
|
|
1813
|
-
}
|
|
1814
1832
|
var memoizedU8Decoder;
|
|
1815
1833
|
function getMemoizedU8Decoder() {
|
|
1816
1834
|
if (!memoizedU8Decoder)
|
|
1817
1835
|
memoizedU8Decoder = getU8Decoder();
|
|
1818
1836
|
return memoizedU8Decoder;
|
|
1819
1837
|
}
|
|
1820
|
-
function getMemoizedU8DecoderDescription(description) {
|
|
1821
|
-
const decoder = getMemoizedU8Decoder();
|
|
1822
|
-
return {
|
|
1823
|
-
...decoder,
|
|
1824
|
-
description: description != null ? description : decoder.description
|
|
1825
|
-
};
|
|
1826
|
-
}
|
|
1827
|
-
var numSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction" ;
|
|
1828
|
-
var numReadonlySignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction, but may not be writable" ;
|
|
1829
|
-
var numReadonlyNonSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable" ;
|
|
1830
|
-
var messageHeaderDescription = "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses" ;
|
|
1831
1838
|
function getMessageHeaderEncoder() {
|
|
1832
|
-
return getStructEncoder(
|
|
1833
|
-
[
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
],
|
|
1838
|
-
{
|
|
1839
|
-
description: messageHeaderDescription
|
|
1840
|
-
}
|
|
1841
|
-
);
|
|
1839
|
+
return getStructEncoder([
|
|
1840
|
+
["numSignerAccounts", getMemoizedU8Encoder()],
|
|
1841
|
+
["numReadonlySignerAccounts", getMemoizedU8Encoder()],
|
|
1842
|
+
["numReadonlyNonSignerAccounts", getMemoizedU8Encoder()]
|
|
1843
|
+
]);
|
|
1842
1844
|
}
|
|
1843
1845
|
function getMessageHeaderDecoder() {
|
|
1844
|
-
return getStructDecoder(
|
|
1845
|
-
[
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
],
|
|
1850
|
-
{
|
|
1851
|
-
description: messageHeaderDescription
|
|
1852
|
-
}
|
|
1853
|
-
);
|
|
1846
|
+
return getStructDecoder([
|
|
1847
|
+
["numSignerAccounts", getMemoizedU8Decoder()],
|
|
1848
|
+
["numReadonlySignerAccounts", getMemoizedU8Decoder()],
|
|
1849
|
+
["numReadonlyNonSignerAccounts", getMemoizedU8Decoder()]
|
|
1850
|
+
]);
|
|
1854
1851
|
}
|
|
1855
|
-
var programAddressIndexDescription = "The index of the program being called, according to the well-ordered accounts list for this transaction" ;
|
|
1856
|
-
var accountIndexDescription = "The index of an account, according to the well-ordered accounts list for this transaction" ;
|
|
1857
|
-
var accountIndicesDescription = "An optional list of account indices, according to the well-ordered accounts list for this transaction, in the order in which the program being called expects them" ;
|
|
1858
|
-
var dataDescription = "An optional buffer of data passed to the instruction" ;
|
|
1859
1852
|
var memoizedGetInstructionEncoder;
|
|
1860
1853
|
function getInstructionEncoder() {
|
|
1861
1854
|
if (!memoizedGetInstructionEncoder) {
|
|
1862
1855
|
memoizedGetInstructionEncoder = mapEncoder(
|
|
1863
1856
|
getStructEncoder([
|
|
1864
|
-
["programAddressIndex", getU8Encoder(
|
|
1865
|
-
[
|
|
1866
|
-
|
|
1867
|
-
getArrayEncoder(getU8Encoder({ description: accountIndexDescription }), {
|
|
1868
|
-
description: accountIndicesDescription,
|
|
1869
|
-
size: getShortU16Encoder()
|
|
1870
|
-
})
|
|
1871
|
-
],
|
|
1872
|
-
["data", getBytesEncoder({ description: dataDescription, size: getShortU16Encoder() })]
|
|
1857
|
+
["programAddressIndex", getU8Encoder()],
|
|
1858
|
+
["accountIndices", getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })],
|
|
1859
|
+
["data", getBytesEncoder({ size: getShortU16Encoder() })]
|
|
1873
1860
|
]),
|
|
1874
1861
|
// Convert an instruction to have all fields defined
|
|
1875
1862
|
(instruction) => {
|
|
@@ -1892,15 +1879,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1892
1879
|
if (!memoizedGetInstructionDecoder) {
|
|
1893
1880
|
memoizedGetInstructionDecoder = mapDecoder(
|
|
1894
1881
|
getStructDecoder([
|
|
1895
|
-
["programAddressIndex", getU8Decoder(
|
|
1896
|
-
[
|
|
1897
|
-
|
|
1898
|
-
getArrayDecoder(getU8Decoder({ description: accountIndexDescription }), {
|
|
1899
|
-
description: accountIndicesDescription,
|
|
1900
|
-
size: getShortU16Decoder()
|
|
1901
|
-
})
|
|
1902
|
-
],
|
|
1903
|
-
["data", getBytesDecoder({ description: dataDescription, size: getShortU16Decoder() })]
|
|
1882
|
+
["programAddressIndex", getU8Decoder()],
|
|
1883
|
+
["accountIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })],
|
|
1884
|
+
["data", getBytesDecoder({ size: getShortU16Decoder() })]
|
|
1904
1885
|
]),
|
|
1905
1886
|
// Convert an instruction to exclude optional fields if they are empty
|
|
1906
1887
|
(instruction) => {
|
|
@@ -1919,45 +1900,36 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1919
1900
|
return memoizedGetInstructionDecoder;
|
|
1920
1901
|
}
|
|
1921
1902
|
var VERSION_FLAG_MASK = 128;
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
if (value === "legacy") {
|
|
1938
|
-
return new Uint8Array();
|
|
1939
|
-
}
|
|
1940
|
-
if (value < 0 || value > 127) {
|
|
1941
|
-
throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
|
|
1942
|
-
}
|
|
1943
|
-
return new Uint8Array([value | VERSION_FLAG_MASK]);
|
|
1903
|
+
function getTransactionVersionEncoder() {
|
|
1904
|
+
return createEncoder({
|
|
1905
|
+
getSizeFromValue: (value) => value === "legacy" ? 0 : 1,
|
|
1906
|
+
maxSize: 1,
|
|
1907
|
+
write: (value, bytes, offset) => {
|
|
1908
|
+
if (value === "legacy") {
|
|
1909
|
+
return offset;
|
|
1910
|
+
}
|
|
1911
|
+
if (value < 0 || value > 127) {
|
|
1912
|
+
throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
|
|
1913
|
+
}
|
|
1914
|
+
bytes.set([value | VERSION_FLAG_MASK], offset);
|
|
1915
|
+
return offset + 1;
|
|
1916
|
+
}
|
|
1917
|
+
});
|
|
1944
1918
|
}
|
|
1945
1919
|
function getTransactionVersionDecoder() {
|
|
1946
|
-
return {
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1920
|
+
return createDecoder({
|
|
1921
|
+
maxSize: 1,
|
|
1922
|
+
read: (bytes, offset) => {
|
|
1923
|
+
const firstByte = bytes[offset];
|
|
1924
|
+
if ((firstByte & VERSION_FLAG_MASK) === 0) {
|
|
1925
|
+
return ["legacy", offset];
|
|
1926
|
+
} else {
|
|
1927
|
+
const version = firstByte ^ VERSION_FLAG_MASK;
|
|
1928
|
+
return [version, offset + 1];
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
});
|
|
1956
1932
|
}
|
|
1957
|
-
var staticAccountsDescription = "A compact-array of static account addresses belonging to this transaction" ;
|
|
1958
|
-
var lifetimeTokenDescription = "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" ;
|
|
1959
|
-
var instructionsDescription = "A compact-array of instructions belonging to this transaction" ;
|
|
1960
|
-
var addressTableLookupsDescription = "A compact array of address table lookups belonging to this transaction" ;
|
|
1961
1933
|
function getCompiledMessageLegacyEncoder() {
|
|
1962
1934
|
return getStructEncoder(getPreludeStructEncoderTuple());
|
|
1963
1935
|
}
|
|
@@ -1983,98 +1955,52 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1983
1955
|
return [
|
|
1984
1956
|
["version", getTransactionVersionEncoder()],
|
|
1985
1957
|
["header", getMessageHeaderEncoder()],
|
|
1986
|
-
[
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
description: staticAccountsDescription,
|
|
1990
|
-
size: getShortU16Encoder()
|
|
1991
|
-
})
|
|
1992
|
-
],
|
|
1993
|
-
[
|
|
1994
|
-
"lifetimeToken",
|
|
1995
|
-
getStringEncoder({
|
|
1996
|
-
description: lifetimeTokenDescription,
|
|
1997
|
-
encoding: getBase58Encoder(),
|
|
1998
|
-
size: 32
|
|
1999
|
-
})
|
|
2000
|
-
],
|
|
2001
|
-
[
|
|
2002
|
-
"instructions",
|
|
2003
|
-
getArrayEncoder(getInstructionEncoder(), {
|
|
2004
|
-
description: instructionsDescription,
|
|
2005
|
-
size: getShortU16Encoder()
|
|
2006
|
-
})
|
|
2007
|
-
]
|
|
1958
|
+
["staticAccounts", getArrayEncoder(getAddressEncoder(), { size: getShortU16Encoder() })],
|
|
1959
|
+
["lifetimeToken", getStringEncoder({ encoding: getBase58Encoder(), size: 32 })],
|
|
1960
|
+
["instructions", getArrayEncoder(getInstructionEncoder(), { size: getShortU16Encoder() })]
|
|
2008
1961
|
];
|
|
2009
1962
|
}
|
|
2010
1963
|
function getPreludeStructDecoderTuple() {
|
|
2011
1964
|
return [
|
|
2012
1965
|
["version", getTransactionVersionDecoder()],
|
|
2013
1966
|
["header", getMessageHeaderDecoder()],
|
|
2014
|
-
[
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
description: staticAccountsDescription,
|
|
2018
|
-
size: getShortU16Decoder()
|
|
2019
|
-
})
|
|
2020
|
-
],
|
|
2021
|
-
[
|
|
2022
|
-
"lifetimeToken",
|
|
2023
|
-
getStringDecoder({
|
|
2024
|
-
description: lifetimeTokenDescription,
|
|
2025
|
-
encoding: getBase58Decoder(),
|
|
2026
|
-
size: 32
|
|
2027
|
-
})
|
|
2028
|
-
],
|
|
2029
|
-
[
|
|
2030
|
-
"instructions",
|
|
2031
|
-
getArrayDecoder(getInstructionDecoder(), {
|
|
2032
|
-
description: instructionsDescription,
|
|
2033
|
-
size: getShortU16Decoder()
|
|
2034
|
-
})
|
|
2035
|
-
],
|
|
1967
|
+
["staticAccounts", getArrayDecoder(getAddressDecoder(), { size: getShortU16Decoder() })],
|
|
1968
|
+
["lifetimeToken", getStringDecoder({ encoding: getBase58Decoder(), size: 32 })],
|
|
1969
|
+
["instructions", getArrayDecoder(getInstructionDecoder(), { size: getShortU16Decoder() })],
|
|
2036
1970
|
["addressTableLookups", getAddressTableLookupArrayDecoder()]
|
|
2037
1971
|
];
|
|
2038
1972
|
}
|
|
2039
1973
|
function getAddressTableLookupArrayEncoder() {
|
|
2040
|
-
return getArrayEncoder(getAddressTableLookupEncoder(), {
|
|
2041
|
-
description: addressTableLookupsDescription,
|
|
2042
|
-
size: getShortU16Encoder()
|
|
2043
|
-
});
|
|
1974
|
+
return getArrayEncoder(getAddressTableLookupEncoder(), { size: getShortU16Encoder() });
|
|
2044
1975
|
}
|
|
2045
1976
|
function getAddressTableLookupArrayDecoder() {
|
|
2046
|
-
return getArrayDecoder(getAddressTableLookupDecoder(), {
|
|
2047
|
-
description: addressTableLookupsDescription,
|
|
2048
|
-
size: getShortU16Decoder()
|
|
2049
|
-
});
|
|
1977
|
+
return getArrayDecoder(getAddressTableLookupDecoder(), { size: getShortU16Decoder() });
|
|
2050
1978
|
}
|
|
2051
|
-
var messageDescription = "The wire format of a Solana transaction message" ;
|
|
2052
1979
|
function getCompiledMessageEncoder() {
|
|
2053
|
-
return {
|
|
2054
|
-
|
|
2055
|
-
encode: (compiledMessage) => {
|
|
1980
|
+
return createEncoder({
|
|
1981
|
+
getSizeFromValue: (compiledMessage) => {
|
|
2056
1982
|
if (compiledMessage.version === "legacy") {
|
|
2057
|
-
return getCompiledMessageLegacyEncoder().
|
|
1983
|
+
return getCompiledMessageLegacyEncoder().getSizeFromValue(compiledMessage);
|
|
2058
1984
|
} else {
|
|
2059
|
-
return getCompiledMessageVersionedEncoder().
|
|
1985
|
+
return getCompiledMessageVersionedEncoder().getSizeFromValue(compiledMessage);
|
|
2060
1986
|
}
|
|
2061
1987
|
},
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
1988
|
+
write: (compiledMessage, bytes, offset) => {
|
|
1989
|
+
if (compiledMessage.version === "legacy") {
|
|
1990
|
+
return getCompiledMessageLegacyEncoder().write(compiledMessage, bytes, offset);
|
|
1991
|
+
} else {
|
|
1992
|
+
return getCompiledMessageVersionedEncoder().write(compiledMessage, bytes, offset);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
});
|
|
2065
1996
|
}
|
|
2066
1997
|
function getCompiledMessageDecoder() {
|
|
2067
|
-
return mapDecoder(
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
}),
|
|
2071
|
-
({ addressTableLookups, ...restOfMessage }) => {
|
|
2072
|
-
if (restOfMessage.version === "legacy" || !(addressTableLookups == null ? void 0 : addressTableLookups.length)) {
|
|
2073
|
-
return restOfMessage;
|
|
2074
|
-
}
|
|
2075
|
-
return { ...restOfMessage, addressTableLookups };
|
|
1998
|
+
return mapDecoder(getStructDecoder(getPreludeStructDecoderTuple()), ({ addressTableLookups, ...restOfMessage }) => {
|
|
1999
|
+
if (restOfMessage.version === "legacy" || !(addressTableLookups == null ? void 0 : addressTableLookups.length)) {
|
|
2000
|
+
return restOfMessage;
|
|
2076
2001
|
}
|
|
2077
|
-
|
|
2002
|
+
return { ...restOfMessage, addressTableLookups };
|
|
2003
|
+
});
|
|
2078
2004
|
}
|
|
2079
2005
|
function getCompiledMessageCodec() {
|
|
2080
2006
|
return combineCodec(getCompiledMessageEncoder(), getCompiledMessageDecoder());
|
|
@@ -2207,44 +2133,22 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2207
2133
|
(tx) => compiledTransaction.signatures.length ? { ...tx, signatures } : tx
|
|
2208
2134
|
);
|
|
2209
2135
|
}
|
|
2210
|
-
var signaturesDescription = "A compact array of 64-byte, base-64 encoded Ed25519 signatures" ;
|
|
2211
|
-
var transactionDescription = "The wire format of a Solana transaction" ;
|
|
2212
2136
|
function getCompiledTransactionEncoder() {
|
|
2213
|
-
return getStructEncoder(
|
|
2214
|
-
[
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
getArrayEncoder(getBytesEncoder({ size: 64 }), {
|
|
2218
|
-
description: signaturesDescription,
|
|
2219
|
-
size: getShortU16Encoder()
|
|
2220
|
-
})
|
|
2221
|
-
],
|
|
2222
|
-
["compiledMessage", getCompiledMessageEncoder()]
|
|
2223
|
-
],
|
|
2224
|
-
{
|
|
2225
|
-
description: transactionDescription
|
|
2226
|
-
}
|
|
2227
|
-
);
|
|
2228
|
-
}
|
|
2229
|
-
function getSignatureDecoder() {
|
|
2230
|
-
return mapDecoder(getBytesDecoder({ size: 64 }), (bytes) => bytes);
|
|
2137
|
+
return getStructEncoder([
|
|
2138
|
+
["signatures", getArrayEncoder(getBytesEncoder({ size: 64 }), { size: getShortU16Encoder() })],
|
|
2139
|
+
["compiledMessage", getCompiledMessageEncoder()]
|
|
2140
|
+
]);
|
|
2231
2141
|
}
|
|
2232
2142
|
function getCompiledTransactionDecoder() {
|
|
2233
|
-
return getStructDecoder(
|
|
2143
|
+
return getStructDecoder([
|
|
2234
2144
|
[
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
size: getShortU16Decoder()
|
|
2240
|
-
})
|
|
2241
|
-
],
|
|
2242
|
-
["compiledMessage", getCompiledMessageDecoder()]
|
|
2145
|
+
"signatures",
|
|
2146
|
+
getArrayDecoder(getBytesDecoder({ size: 64 }), {
|
|
2147
|
+
size: getShortU16Decoder()
|
|
2148
|
+
})
|
|
2243
2149
|
],
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
}
|
|
2247
|
-
);
|
|
2150
|
+
["compiledMessage", getCompiledMessageDecoder()]
|
|
2151
|
+
]);
|
|
2248
2152
|
}
|
|
2249
2153
|
function getTransactionEncoder() {
|
|
2250
2154
|
return mapEncoder(getCompiledTransactionEncoder(), getCompiledTransaction);
|
|
@@ -2268,7 +2172,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2268
2172
|
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
|
|
2269
2173
|
);
|
|
2270
2174
|
}
|
|
2271
|
-
const transactionSignature = base58Decoder.decode(signatureBytes)
|
|
2175
|
+
const transactionSignature = base58Decoder.decode(signatureBytes);
|
|
2272
2176
|
return transactionSignature;
|
|
2273
2177
|
}
|
|
2274
2178
|
async function partiallySignTransaction(keyPairs, transaction) {
|
|
@@ -2310,7 +2214,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2310
2214
|
}
|
|
2311
2215
|
function getBase64EncodedWireTransaction(transaction) {
|
|
2312
2216
|
const wireTransactionBytes = getTransactionEncoder().encode(transaction);
|
|
2313
|
-
return getBase64Decoder().decode(wireTransactionBytes)
|
|
2217
|
+
return getBase64Decoder().decode(wireTransactionBytes);
|
|
2314
2218
|
}
|
|
2315
2219
|
|
|
2316
2220
|
// src/airdrop.ts
|
|
@@ -2484,32 +2388,224 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2484
2388
|
|
|
2485
2389
|
// ../rpc-core/dist/index.browser.js
|
|
2486
2390
|
init_env_shim();
|
|
2487
|
-
function
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2391
|
+
function createJsonRpcApi(config) {
|
|
2392
|
+
return new Proxy({}, {
|
|
2393
|
+
defineProperty() {
|
|
2394
|
+
return false;
|
|
2395
|
+
},
|
|
2396
|
+
deleteProperty() {
|
|
2397
|
+
return false;
|
|
2398
|
+
},
|
|
2399
|
+
get(...args) {
|
|
2400
|
+
const [_, p] = args;
|
|
2401
|
+
const methodName = p.toString();
|
|
2402
|
+
return function(...rawParams) {
|
|
2403
|
+
const params = (config == null ? void 0 : config.parametersTransformer) ? config == null ? void 0 : config.parametersTransformer(rawParams, methodName) : rawParams;
|
|
2404
|
+
const responseTransformer = (config == null ? void 0 : config.responseTransformer) ? config == null ? void 0 : config.responseTransformer : (rawResponse) => rawResponse;
|
|
2405
|
+
return {
|
|
2406
|
+
methodName,
|
|
2407
|
+
params,
|
|
2408
|
+
responseTransformer
|
|
2409
|
+
};
|
|
2410
|
+
};
|
|
2411
|
+
}
|
|
2412
|
+
});
|
|
2413
|
+
}
|
|
2414
|
+
function createJsonRpcSubscriptionsApi(config) {
|
|
2415
|
+
return new Proxy({}, {
|
|
2416
|
+
defineProperty() {
|
|
2417
|
+
return false;
|
|
2418
|
+
},
|
|
2419
|
+
deleteProperty() {
|
|
2420
|
+
return false;
|
|
2421
|
+
},
|
|
2422
|
+
get(...args) {
|
|
2423
|
+
const [_, p] = args;
|
|
2424
|
+
const notificationName = p.toString();
|
|
2425
|
+
return function(...rawParams) {
|
|
2426
|
+
const params = (config == null ? void 0 : config.parametersTransformer) ? config == null ? void 0 : config.parametersTransformer(rawParams, notificationName) : rawParams;
|
|
2427
|
+
const responseTransformer = (config == null ? void 0 : config.responseTransformer) ? config == null ? void 0 : config.responseTransformer : (rawResponse) => rawResponse;
|
|
2428
|
+
const subscribeMethodName = (config == null ? void 0 : config.subscribeNotificationNameTransformer) ? config == null ? void 0 : config.subscribeNotificationNameTransformer(notificationName) : notificationName;
|
|
2429
|
+
const unsubscribeMethodName = (config == null ? void 0 : config.unsubscribeNotificationNameTransformer) ? config == null ? void 0 : config.unsubscribeNotificationNameTransformer(notificationName) : notificationName;
|
|
2430
|
+
return {
|
|
2431
|
+
params,
|
|
2432
|
+
responseTransformer,
|
|
2433
|
+
subscribeMethodName,
|
|
2434
|
+
unsubscribeMethodName
|
|
2435
|
+
};
|
|
2436
|
+
};
|
|
2437
|
+
}
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
function applyDefaultCommitment({
|
|
2441
|
+
commitmentPropertyName,
|
|
2442
|
+
params,
|
|
2443
|
+
optionsObjectPositionInParams,
|
|
2444
|
+
overrideCommitment
|
|
2445
|
+
}) {
|
|
2446
|
+
const paramInTargetPosition = params[optionsObjectPositionInParams];
|
|
2447
|
+
if (
|
|
2448
|
+
// There's no config.
|
|
2449
|
+
paramInTargetPosition === void 0 || // There is a config object.
|
|
2450
|
+
paramInTargetPosition && typeof paramInTargetPosition === "object" && !Array.isArray(paramInTargetPosition)
|
|
2451
|
+
) {
|
|
2452
|
+
if (
|
|
2453
|
+
// The config object already has a commitment set.
|
|
2454
|
+
paramInTargetPosition && commitmentPropertyName in paramInTargetPosition
|
|
2455
|
+
) {
|
|
2456
|
+
if (!paramInTargetPosition[commitmentPropertyName] || paramInTargetPosition[commitmentPropertyName] === "finalized") {
|
|
2457
|
+
const nextParams = [...params];
|
|
2458
|
+
const {
|
|
2459
|
+
[commitmentPropertyName]: _,
|
|
2460
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2461
|
+
...rest
|
|
2462
|
+
} = paramInTargetPosition;
|
|
2463
|
+
if (Object.keys(rest).length > 0) {
|
|
2464
|
+
nextParams[optionsObjectPositionInParams] = rest;
|
|
2465
|
+
} else {
|
|
2466
|
+
if (optionsObjectPositionInParams === nextParams.length - 1) {
|
|
2467
|
+
nextParams.length--;
|
|
2468
|
+
} else {
|
|
2469
|
+
nextParams[optionsObjectPositionInParams] = void 0;
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
return nextParams;
|
|
2497
2473
|
}
|
|
2474
|
+
} else if (overrideCommitment !== "finalized") {
|
|
2475
|
+
const nextParams = [...params];
|
|
2476
|
+
nextParams[optionsObjectPositionInParams] = {
|
|
2477
|
+
...paramInTargetPosition,
|
|
2478
|
+
[commitmentPropertyName]: overrideCommitment
|
|
2479
|
+
};
|
|
2480
|
+
return nextParams;
|
|
2498
2481
|
}
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2482
|
+
}
|
|
2483
|
+
return params;
|
|
2484
|
+
}
|
|
2485
|
+
function downcastNodeToNumberIfBigint(value) {
|
|
2486
|
+
return typeof value === "bigint" ? (
|
|
2487
|
+
// FIXME(solana-labs/solana/issues/30341) Create a data type to represent u64 in the Solana
|
|
2488
|
+
// JSON RPC implementation so that we can throw away this entire patcher instead of unsafely
|
|
2489
|
+
// downcasting `bigints` to `numbers`.
|
|
2490
|
+
Number(value)
|
|
2491
|
+
) : value;
|
|
2492
|
+
}
|
|
2493
|
+
function getIntegerOverflowNodeVisitor(onIntegerOverflow) {
|
|
2494
|
+
return (value, { keyPath }) => {
|
|
2495
|
+
if (typeof value === "bigint") {
|
|
2496
|
+
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) {
|
|
2497
|
+
onIntegerOverflow(keyPath, value);
|
|
2498
|
+
}
|
|
2503
2499
|
}
|
|
2504
|
-
return Number(value);
|
|
2505
|
-
} else {
|
|
2506
2500
|
return value;
|
|
2507
|
-
}
|
|
2508
|
-
}
|
|
2509
|
-
function patchParamsForSolanaLabsRpc(params, onIntegerOverflow) {
|
|
2510
|
-
return visitNode(params, [], onIntegerOverflow);
|
|
2501
|
+
};
|
|
2511
2502
|
}
|
|
2503
|
+
var OPTIONS_OBJECT_POSITION_BY_METHOD = {
|
|
2504
|
+
accountNotifications: 1,
|
|
2505
|
+
blockNotifications: 1,
|
|
2506
|
+
getAccountInfo: 1,
|
|
2507
|
+
getBalance: 1,
|
|
2508
|
+
getBlock: 1,
|
|
2509
|
+
getBlockHeight: 0,
|
|
2510
|
+
getBlockProduction: 0,
|
|
2511
|
+
getBlocks: 2,
|
|
2512
|
+
getBlocksWithLimit: 2,
|
|
2513
|
+
getConfirmedBlock: 1,
|
|
2514
|
+
getConfirmedBlocks: 1,
|
|
2515
|
+
getConfirmedBlocksWithLimit: 2,
|
|
2516
|
+
getConfirmedSignaturesForAddress2: 1,
|
|
2517
|
+
getConfirmedTransaction: 1,
|
|
2518
|
+
getEpochInfo: 0,
|
|
2519
|
+
getFeeCalculatorForBlockhash: 1,
|
|
2520
|
+
getFeeForMessage: 1,
|
|
2521
|
+
getFees: 1,
|
|
2522
|
+
getInflationGovernor: 0,
|
|
2523
|
+
getInflationReward: 1,
|
|
2524
|
+
getLargestAccounts: 0,
|
|
2525
|
+
getLatestBlockhash: 0,
|
|
2526
|
+
getLeaderSchedule: 1,
|
|
2527
|
+
getMinimumBalanceForRentExemption: 1,
|
|
2528
|
+
getMultipleAccounts: 1,
|
|
2529
|
+
getProgramAccounts: 1,
|
|
2530
|
+
getRecentBlockhash: 1,
|
|
2531
|
+
getSignaturesForAddress: 1,
|
|
2532
|
+
getSlot: 0,
|
|
2533
|
+
getSlotLeader: 0,
|
|
2534
|
+
getStakeActivation: 1,
|
|
2535
|
+
getStakeMinimumDelegation: 0,
|
|
2536
|
+
getSupply: 0,
|
|
2537
|
+
getTokenAccountBalance: 1,
|
|
2538
|
+
getTokenAccountsByDelegate: 2,
|
|
2539
|
+
getTokenAccountsByOwner: 2,
|
|
2540
|
+
getTokenLargestAccounts: 1,
|
|
2541
|
+
getTokenSupply: 1,
|
|
2542
|
+
getTransaction: 1,
|
|
2543
|
+
getTransactionCount: 0,
|
|
2544
|
+
getVoteAccounts: 0,
|
|
2545
|
+
isBlockhashValid: 1,
|
|
2546
|
+
logsNotifications: 1,
|
|
2547
|
+
programNotifications: 1,
|
|
2548
|
+
requestAirdrop: 2,
|
|
2549
|
+
sendTransaction: 1,
|
|
2550
|
+
signatureNotifications: 1,
|
|
2551
|
+
simulateTransaction: 1
|
|
2552
|
+
};
|
|
2512
2553
|
var KEYPATH_WILDCARD = {};
|
|
2554
|
+
function getTreeWalker(visitors) {
|
|
2555
|
+
return function traverse(node, state) {
|
|
2556
|
+
if (Array.isArray(node)) {
|
|
2557
|
+
return node.map((element, ii) => {
|
|
2558
|
+
const nextState = {
|
|
2559
|
+
...state,
|
|
2560
|
+
keyPath: [...state.keyPath, ii]
|
|
2561
|
+
};
|
|
2562
|
+
return traverse(element, nextState);
|
|
2563
|
+
});
|
|
2564
|
+
} else if (typeof node === "object" && node !== null) {
|
|
2565
|
+
const out = {};
|
|
2566
|
+
for (const propName in node) {
|
|
2567
|
+
if (!Object.prototype.hasOwnProperty.call(node, propName)) {
|
|
2568
|
+
continue;
|
|
2569
|
+
}
|
|
2570
|
+
const nextState = {
|
|
2571
|
+
...state,
|
|
2572
|
+
keyPath: [...state.keyPath, propName]
|
|
2573
|
+
};
|
|
2574
|
+
out[propName] = traverse(node[propName], nextState);
|
|
2575
|
+
}
|
|
2576
|
+
return out;
|
|
2577
|
+
} else {
|
|
2578
|
+
return visitors.reduce((acc, visitNode) => visitNode(acc, state), node);
|
|
2579
|
+
}
|
|
2580
|
+
};
|
|
2581
|
+
}
|
|
2582
|
+
function getParamsPatcherForSolanaLabsRpc(config) {
|
|
2583
|
+
const defaultCommitment = config == null ? void 0 : config.defaultCommitment;
|
|
2584
|
+
const handleIntegerOverflow = config == null ? void 0 : config.onIntegerOverflow;
|
|
2585
|
+
return (rawParams, methodName) => {
|
|
2586
|
+
const traverse = getTreeWalker([
|
|
2587
|
+
...handleIntegerOverflow ? [getIntegerOverflowNodeVisitor((...args) => handleIntegerOverflow(methodName, ...args))] : [],
|
|
2588
|
+
downcastNodeToNumberIfBigint
|
|
2589
|
+
]);
|
|
2590
|
+
const initialState = {
|
|
2591
|
+
keyPath: []
|
|
2592
|
+
};
|
|
2593
|
+
const patchedParams = traverse(rawParams, initialState);
|
|
2594
|
+
if (!Array.isArray(patchedParams)) {
|
|
2595
|
+
return patchedParams;
|
|
2596
|
+
}
|
|
2597
|
+
const optionsObjectPositionInParams = OPTIONS_OBJECT_POSITION_BY_METHOD[methodName];
|
|
2598
|
+
if (optionsObjectPositionInParams == null) {
|
|
2599
|
+
return patchedParams;
|
|
2600
|
+
}
|
|
2601
|
+
return applyDefaultCommitment({
|
|
2602
|
+
commitmentPropertyName: methodName === "sendTransaction" ? "preflightCommitment" : "commitment",
|
|
2603
|
+
optionsObjectPositionInParams,
|
|
2604
|
+
overrideCommitment: defaultCommitment,
|
|
2605
|
+
params: patchedParams
|
|
2606
|
+
});
|
|
2607
|
+
};
|
|
2608
|
+
}
|
|
2513
2609
|
var jsonParsedTokenAccountsConfigs = [
|
|
2514
2610
|
// parsed Token/Token22 token account
|
|
2515
2611
|
["data", "parsed", "info", "tokenAmount", "decimals"],
|
|
@@ -2897,94 +2993,65 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2897
2993
|
}
|
|
2898
2994
|
return memoizedResponseKeypaths;
|
|
2899
2995
|
}
|
|
2900
|
-
function
|
|
2901
|
-
return
|
|
2996
|
+
function keyPathIsAllowedToBeNumeric(keyPath, allowedNumericKeyPaths) {
|
|
2997
|
+
return allowedNumericKeyPaths.some((prohibitedKeyPath) => {
|
|
2998
|
+
if (prohibitedKeyPath.length !== keyPath.length) {
|
|
2999
|
+
return false;
|
|
3000
|
+
}
|
|
3001
|
+
for (let ii = keyPath.length - 1; ii >= 0; ii--) {
|
|
3002
|
+
const keyPathPart = keyPath[ii];
|
|
3003
|
+
const prohibitedKeyPathPart = prohibitedKeyPath[ii];
|
|
3004
|
+
if (prohibitedKeyPathPart !== keyPathPart && (prohibitedKeyPathPart !== KEYPATH_WILDCARD || typeof keyPathPart !== "number")) {
|
|
3005
|
+
return false;
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
return true;
|
|
3009
|
+
});
|
|
2902
3010
|
}
|
|
2903
|
-
function
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
} else if (typeof value === "object" && value !== null) {
|
|
2910
|
-
const out = {};
|
|
2911
|
-
for (const [propName, innerValue] of Object.entries(value)) {
|
|
2912
|
-
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, propName);
|
|
2913
|
-
out[propName] = visitNode2(innerValue, nextAllowedKeypaths);
|
|
3011
|
+
function getBigIntUpcastVisitor(allowedNumericKeyPaths) {
|
|
3012
|
+
return function upcastNodeToBigIntIfNumber(value, { keyPath }) {
|
|
3013
|
+
if (typeof value === "number" && Number.isInteger(value) && !keyPathIsAllowedToBeNumeric(keyPath, allowedNumericKeyPaths)) {
|
|
3014
|
+
return BigInt(value);
|
|
3015
|
+
} else {
|
|
3016
|
+
return value;
|
|
2914
3017
|
}
|
|
2915
|
-
|
|
2916
|
-
} else if (typeof value === "number" && // The presence of an allowed keypath on the route to this value implies it's allowlisted;
|
|
2917
|
-
// Upcast the value to `bigint` unless an allowed keypath is present.
|
|
2918
|
-
allowedKeypaths.length === 0 && // Only try to upcast an Integer to `bigint`
|
|
2919
|
-
Number.isInteger(value)) {
|
|
2920
|
-
return BigInt(value);
|
|
2921
|
-
} else {
|
|
2922
|
-
return value;
|
|
2923
|
-
}
|
|
3018
|
+
};
|
|
2924
3019
|
}
|
|
2925
3020
|
function patchResponseForSolanaLabsRpc(rawResponse, methodName) {
|
|
2926
|
-
const
|
|
2927
|
-
|
|
3021
|
+
const allowedNumericKeyPaths = methodName ? getAllowedNumericKeypathsForResponse()[methodName] : void 0;
|
|
3022
|
+
const traverse = getTreeWalker([getBigIntUpcastVisitor(allowedNumericKeyPaths != null ? allowedNumericKeyPaths : [])]);
|
|
3023
|
+
const initialState = {
|
|
3024
|
+
keyPath: []
|
|
3025
|
+
};
|
|
3026
|
+
return traverse(rawResponse, initialState);
|
|
2928
3027
|
}
|
|
2929
|
-
function patchResponseForSolanaLabsRpcSubscriptions(rawResponse,
|
|
2930
|
-
const
|
|
2931
|
-
|
|
3028
|
+
function patchResponseForSolanaLabsRpcSubscriptions(rawResponse, notificationName) {
|
|
3029
|
+
const allowedNumericKeyPaths = notificationName ? getAllowedNumericKeypathsForNotification()[notificationName] : void 0;
|
|
3030
|
+
const traverse = getTreeWalker([getBigIntUpcastVisitor(allowedNumericKeyPaths != null ? allowedNumericKeyPaths : [])]);
|
|
3031
|
+
const initialState = {
|
|
3032
|
+
keyPath: []
|
|
3033
|
+
};
|
|
3034
|
+
return traverse(rawResponse, initialState);
|
|
2932
3035
|
}
|
|
2933
3036
|
function createSolanaRpcApi(config) {
|
|
2934
|
-
return
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
},
|
|
2938
|
-
deleteProperty() {
|
|
2939
|
-
return false;
|
|
2940
|
-
},
|
|
2941
|
-
get(...args) {
|
|
2942
|
-
const [_, p] = args;
|
|
2943
|
-
const methodName = p.toString();
|
|
2944
|
-
return function(...rawParams) {
|
|
2945
|
-
const handleIntegerOverflow = config == null ? void 0 : config.onIntegerOverflow;
|
|
2946
|
-
const params = patchParamsForSolanaLabsRpc(
|
|
2947
|
-
rawParams,
|
|
2948
|
-
handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(methodName, keyPath, value) : void 0
|
|
2949
|
-
);
|
|
2950
|
-
return {
|
|
2951
|
-
methodName,
|
|
2952
|
-
params,
|
|
2953
|
-
responseProcessor: (rawResponse) => patchResponseForSolanaLabsRpc(rawResponse, methodName)
|
|
2954
|
-
};
|
|
2955
|
-
};
|
|
2956
|
-
}
|
|
3037
|
+
return createJsonRpcApi({
|
|
3038
|
+
parametersTransformer: getParamsPatcherForSolanaLabsRpc(config),
|
|
3039
|
+
responseTransformer: patchResponseForSolanaLabsRpc
|
|
2957
3040
|
});
|
|
2958
3041
|
}
|
|
2959
|
-
function
|
|
2960
|
-
return
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
return false;
|
|
2966
|
-
},
|
|
2967
|
-
get(...args) {
|
|
2968
|
-
const [_, p] = args;
|
|
2969
|
-
const notificationName = p.toString();
|
|
2970
|
-
return function(...rawParams) {
|
|
2971
|
-
const handleIntegerOverflow = config == null ? void 0 : config.onIntegerOverflow;
|
|
2972
|
-
const params = patchParamsForSolanaLabsRpc(
|
|
2973
|
-
rawParams,
|
|
2974
|
-
handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(notificationName, keyPath, value) : void 0
|
|
2975
|
-
);
|
|
2976
|
-
return {
|
|
2977
|
-
params,
|
|
2978
|
-
responseProcessor: (rawResponse) => patchResponseForSolanaLabsRpcSubscriptions(rawResponse, notificationName),
|
|
2979
|
-
subscribeMethodName: notificationName.replace(/Notifications$/, "Subscribe"),
|
|
2980
|
-
unsubscribeMethodName: notificationName.replace(/Notifications$/, "Unsubscribe")
|
|
2981
|
-
};
|
|
2982
|
-
};
|
|
2983
|
-
}
|
|
3042
|
+
function createSolanaRpcSubscriptionsApi_INTERNAL(config) {
|
|
3043
|
+
return createJsonRpcSubscriptionsApi({
|
|
3044
|
+
parametersTransformer: getParamsPatcherForSolanaLabsRpc(config),
|
|
3045
|
+
responseTransformer: patchResponseForSolanaLabsRpcSubscriptions,
|
|
3046
|
+
subscribeNotificationNameTransformer: (notificationName) => notificationName.replace(/Notifications$/, "Subscribe"),
|
|
3047
|
+
unsubscribeNotificationNameTransformer: (notificationName) => notificationName.replace(/Notifications$/, "Unsubscribe")
|
|
2984
3048
|
});
|
|
2985
3049
|
}
|
|
3050
|
+
function createSolanaRpcSubscriptionsApi(config) {
|
|
3051
|
+
return createSolanaRpcSubscriptionsApi_INTERNAL(config);
|
|
3052
|
+
}
|
|
2986
3053
|
function createSolanaRpcSubscriptionsApi_UNSTABLE(config) {
|
|
2987
|
-
return
|
|
3054
|
+
return createSolanaRpcSubscriptionsApi_INTERNAL(config);
|
|
2988
3055
|
}
|
|
2989
3056
|
|
|
2990
3057
|
// ../rpc-transport/dist/index.browser.js
|
|
@@ -3019,7 +3086,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3019
3086
|
function createPendingRpcRequest(rpcConfig, pendingRequest) {
|
|
3020
3087
|
return {
|
|
3021
3088
|
async send(options) {
|
|
3022
|
-
const { methodName, params,
|
|
3089
|
+
const { methodName, params, responseTransformer } = pendingRequest;
|
|
3023
3090
|
const payload = createJsonRpcMessage(methodName, params);
|
|
3024
3091
|
const response = await rpcConfig.transport({
|
|
3025
3092
|
payload,
|
|
@@ -3028,7 +3095,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3028
3095
|
if ("error" in response) {
|
|
3029
3096
|
throw new SolanaJsonRpcError(response.error);
|
|
3030
3097
|
} else {
|
|
3031
|
-
return
|
|
3098
|
+
return responseTransformer ? responseTransformer(response.result, methodName) : response.result;
|
|
3032
3099
|
}
|
|
3033
3100
|
}
|
|
3034
3101
|
};
|
|
@@ -3065,7 +3132,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3065
3132
|
}
|
|
3066
3133
|
})();
|
|
3067
3134
|
}
|
|
3068
|
-
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName,
|
|
3135
|
+
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName, responseTransformer }) {
|
|
3069
3136
|
return {
|
|
3070
3137
|
async subscribe({ abortSignal }) {
|
|
3071
3138
|
abortSignal.throwIfAborted();
|
|
@@ -3111,7 +3178,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3111
3178
|
continue;
|
|
3112
3179
|
}
|
|
3113
3180
|
const notification = message.params.result;
|
|
3114
|
-
yield
|
|
3181
|
+
yield responseTransformer ? responseTransformer(notification, subscribeMethodName) : notification;
|
|
3115
3182
|
}
|
|
3116
3183
|
}
|
|
3117
3184
|
};
|
|
@@ -3417,22 +3484,26 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3417
3484
|
init_env_shim();
|
|
3418
3485
|
var SolanaJsonRpcIntegerOverflowError = class extends Error {
|
|
3419
3486
|
constructor(methodName, keyPath, value) {
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3487
|
+
let argumentLabel = "";
|
|
3488
|
+
if (typeof keyPath[0] === "number") {
|
|
3489
|
+
const argPosition = keyPath[0] + 1;
|
|
3490
|
+
const lastDigit = argPosition % 10;
|
|
3491
|
+
const lastTwoDigits = argPosition % 100;
|
|
3492
|
+
if (lastDigit == 1 && lastTwoDigits != 11) {
|
|
3493
|
+
argumentLabel = argPosition + "st";
|
|
3494
|
+
} else if (lastDigit == 2 && lastTwoDigits != 12) {
|
|
3495
|
+
argumentLabel = argPosition + "nd";
|
|
3496
|
+
} else if (lastDigit == 3 && lastTwoDigits != 13) {
|
|
3497
|
+
argumentLabel = argPosition + "rd";
|
|
3498
|
+
} else {
|
|
3499
|
+
argumentLabel = argPosition + "th";
|
|
3500
|
+
}
|
|
3430
3501
|
} else {
|
|
3431
|
-
|
|
3502
|
+
argumentLabel = `\`${keyPath[0].toString()}\``;
|
|
3432
3503
|
}
|
|
3433
3504
|
const path = keyPath.length > 1 ? keyPath.slice(1).map((pathPart) => typeof pathPart === "number" ? `[${pathPart}]` : pathPart).join(".") : null;
|
|
3434
3505
|
super(
|
|
3435
|
-
`The ${
|
|
3506
|
+
`The ${argumentLabel} argument to the \`${methodName}\` RPC method${path ? ` at path \`${path}\`` : ""} was \`${value}\`. This number is unsafe for use with the Solana JSON-RPC because it exceeds \`Number.MAX_SAFE_INTEGER\`.`
|
|
3436
3507
|
);
|
|
3437
3508
|
__publicField(this, "methodName");
|
|
3438
3509
|
__publicField(this, "keyPath");
|
|
@@ -3448,6 +3519,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3448
3519
|
|
|
3449
3520
|
// src/rpc-default-config.ts
|
|
3450
3521
|
var DEFAULT_RPC_CONFIG = {
|
|
3522
|
+
defaultCommitment: "confirmed",
|
|
3451
3523
|
onIntegerOverflow(methodName, keyPath, value) {
|
|
3452
3524
|
throw new SolanaJsonRpcIntegerOverflowError(methodName, keyPath, value);
|
|
3453
3525
|
}
|
|
@@ -3882,22 +3954,52 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3882
3954
|
|
|
3883
3955
|
// src/transaction-confirmation-strategy-blockheight.ts
|
|
3884
3956
|
init_env_shim();
|
|
3885
|
-
function createBlockHeightExceedencePromiseFactory(
|
|
3886
|
-
|
|
3957
|
+
function createBlockHeightExceedencePromiseFactory({
|
|
3958
|
+
rpc,
|
|
3959
|
+
rpcSubscriptions
|
|
3960
|
+
}) {
|
|
3961
|
+
return async function getBlockHeightExceedencePromise({
|
|
3962
|
+
abortSignal: callerAbortSignal,
|
|
3963
|
+
commitment,
|
|
3964
|
+
lastValidBlockHeight
|
|
3965
|
+
}) {
|
|
3887
3966
|
const abortController = new AbortController();
|
|
3888
|
-
|
|
3967
|
+
const handleAbort = () => {
|
|
3889
3968
|
abortController.abort();
|
|
3890
|
-
}
|
|
3969
|
+
};
|
|
3891
3970
|
callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
|
|
3892
|
-
|
|
3971
|
+
async function getBlockHeightAndDifferenceBetweenSlotHeightAndBlockHeight() {
|
|
3972
|
+
const { absoluteSlot, blockHeight } = await rpc.getEpochInfo({ commitment }).send({ abortSignal: abortController.signal });
|
|
3973
|
+
return {
|
|
3974
|
+
blockHeight,
|
|
3975
|
+
differenceBetweenSlotHeightAndBlockHeight: absoluteSlot - blockHeight
|
|
3976
|
+
};
|
|
3977
|
+
}
|
|
3893
3978
|
try {
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3979
|
+
const [slotNotifications, { blockHeight, differenceBetweenSlotHeightAndBlockHeight }] = await Promise.all([
|
|
3980
|
+
rpcSubscriptions.slotNotifications().subscribe({ abortSignal: abortController.signal }),
|
|
3981
|
+
getBlockHeightAndDifferenceBetweenSlotHeightAndBlockHeight()
|
|
3982
|
+
]);
|
|
3983
|
+
if (blockHeight <= lastValidBlockHeight) {
|
|
3984
|
+
let lastKnownDifferenceBetweenSlotHeightAndBlockHeight = differenceBetweenSlotHeightAndBlockHeight;
|
|
3985
|
+
for await (const slotNotification of slotNotifications) {
|
|
3986
|
+
const { slot } = slotNotification;
|
|
3987
|
+
if (slot - lastKnownDifferenceBetweenSlotHeightAndBlockHeight > lastValidBlockHeight) {
|
|
3988
|
+
const {
|
|
3989
|
+
blockHeight: currentBlockHeight,
|
|
3990
|
+
differenceBetweenSlotHeightAndBlockHeight: currentDifferenceBetweenSlotHeightAndBlockHeight
|
|
3991
|
+
} = await getBlockHeightAndDifferenceBetweenSlotHeightAndBlockHeight();
|
|
3992
|
+
if (currentBlockHeight > lastValidBlockHeight) {
|
|
3993
|
+
break;
|
|
3994
|
+
} else {
|
|
3995
|
+
lastKnownDifferenceBetweenSlotHeightAndBlockHeight = currentDifferenceBetweenSlotHeightAndBlockHeight;
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3899
3998
|
}
|
|
3900
3999
|
}
|
|
4000
|
+
throw new Error(
|
|
4001
|
+
"The network has progressed past the last block for which this transaction could have been committed."
|
|
4002
|
+
);
|
|
3901
4003
|
} finally {
|
|
3902
4004
|
abortController.abort();
|
|
3903
4005
|
}
|
|
@@ -3927,7 +4029,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3927
4029
|
function getNonceFromAccountData([base64EncodedBytes]) {
|
|
3928
4030
|
const data = base64Encoder.encode(base64EncodedBytes);
|
|
3929
4031
|
const nonceValueBytes = data.slice(NONCE_VALUE_OFFSET, NONCE_VALUE_OFFSET + 32);
|
|
3930
|
-
return base58Decoder2.decode(nonceValueBytes)
|
|
4032
|
+
return base58Decoder2.decode(nonceValueBytes);
|
|
3931
4033
|
}
|
|
3932
4034
|
const nonceAccountDidAdvancePromise = (async () => {
|
|
3933
4035
|
for await (const accountNotification of accountNotifications) {
|
|
@@ -3992,7 +4094,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3992
4094
|
rpc,
|
|
3993
4095
|
rpcSubscriptions
|
|
3994
4096
|
}) {
|
|
3995
|
-
const getBlockHeightExceedencePromise = createBlockHeightExceedencePromiseFactory(
|
|
4097
|
+
const getBlockHeightExceedencePromise = createBlockHeightExceedencePromiseFactory({
|
|
4098
|
+
rpc,
|
|
4099
|
+
rpcSubscriptions
|
|
4100
|
+
});
|
|
3996
4101
|
const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory(
|
|
3997
4102
|
rpc,
|
|
3998
4103
|
rpcSubscriptions
|
|
@@ -4025,10 +4130,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4025
4130
|
await raceStrategies(
|
|
4026
4131
|
getSignatureFromTransaction(config.transaction),
|
|
4027
4132
|
config,
|
|
4028
|
-
function getSpecificStrategiesForRace({
|
|
4133
|
+
function getSpecificStrategiesForRace({
|
|
4134
|
+
abortSignal,
|
|
4135
|
+
commitment,
|
|
4136
|
+
getBlockHeightExceedencePromise,
|
|
4137
|
+
transaction
|
|
4138
|
+
}) {
|
|
4029
4139
|
return [
|
|
4030
4140
|
getBlockHeightExceedencePromise({
|
|
4031
4141
|
abortSignal,
|
|
4142
|
+
commitment,
|
|
4032
4143
|
lastValidBlockHeight: transaction.lifetimeConstraint.lastValidBlockHeight
|
|
4033
4144
|
})
|
|
4034
4145
|
];
|
|
@@ -4161,6 +4272,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4161
4272
|
exports.assertIsSignature = assertIsSignature;
|
|
4162
4273
|
exports.assertIsStringifiedBigInt = assertIsStringifiedBigInt;
|
|
4163
4274
|
exports.assertIsStringifiedNumber = assertIsStringifiedNumber;
|
|
4275
|
+
exports.assertIsTransactionWithBlockhashLifetime = assertIsTransactionWithBlockhashLifetime;
|
|
4164
4276
|
exports.assertIsUnixTimestamp = assertIsUnixTimestamp;
|
|
4165
4277
|
exports.assertTransactionIsFullySigned = assertTransactionIsFullySigned;
|
|
4166
4278
|
exports.commitmentComparator = commitmentComparator;
|
|
@@ -4175,6 +4287,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4175
4287
|
exports.createDefaultRpcTransport = createDefaultRpcTransport;
|
|
4176
4288
|
exports.createDefaultTransactionSender = createDefaultTransactionSender;
|
|
4177
4289
|
exports.createNonceInvalidationPromiseFactory = createNonceInvalidationPromiseFactory;
|
|
4290
|
+
exports.createPrivateKeyFromBytes = createPrivateKeyFromBytes;
|
|
4178
4291
|
exports.createRecentSignatureConfirmationPromiseFactory = createRecentSignatureConfirmationPromiseFactory;
|
|
4179
4292
|
exports.createSolanaRpc = createSolanaRpc;
|
|
4180
4293
|
exports.createSolanaRpcSubscriptions = createSolanaRpcSubscriptions;
|
|
@@ -4210,6 +4323,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4210
4323
|
exports.lamports = lamports;
|
|
4211
4324
|
exports.mergeRoles = mergeRoles;
|
|
4212
4325
|
exports.partiallySignTransaction = partiallySignTransaction;
|
|
4326
|
+
exports.pipe = pipe;
|
|
4213
4327
|
exports.prependTransactionInstruction = prependTransactionInstruction;
|
|
4214
4328
|
exports.requestAndConfirmAirdrop = requestAndConfirmAirdrop;
|
|
4215
4329
|
exports.sendAndConfirmDurableNonceTransaction = sendAndConfirmDurableNonceTransaction;
|