@solana/web3.js 2.0.0-experimental.b927e84 → 2.0.0-experimental.ba21818
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/LICENSE +1 -1
- package/README.md +4 -4
- package/dist/index.browser.cjs +540 -13
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +525 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +2336 -429
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +514 -11
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +529 -13
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +514 -11
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +52 -29
- package/dist/types/cached-abortable-iterable.d.ts +11 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/rpc-subscription-coalescer.d.ts +10 -0
- package/dist/types/rpc-websocket-autopinger.d.ts +8 -0
- package/dist/types/rpc-websocket-connection-sharding.d.ts +13 -0
- package/dist/types/rpc-websocket-transport.d.ts +13 -0
- package/dist/types/rpc.d.ts +5 -3
- package/dist/types/transaction-confirmation-strategy-blockheight.d.ts +10 -0
- package/dist/types/transaction-confirmation-strategy-nonce.d.ts +15 -0
- package/dist/types/transaction-confirmation-strategy-signature.d.ts +13 -0
- package/dist/types/transaction-confirmation.d.ts +39 -0
- package/package.json +21 -21
|
@@ -12,8 +12,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
12
12
|
var __esm = (fn, res) => function __init() {
|
|
13
13
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
14
14
|
};
|
|
15
|
-
var __commonJS = (cb,
|
|
16
|
-
return
|
|
15
|
+
var __commonJS = (cb, mod2) => function __require() {
|
|
16
|
+
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
|
|
17
17
|
};
|
|
18
18
|
var __copyProps = (to, from, except, desc) => {
|
|
19
19
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -23,13 +23,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
23
23
|
}
|
|
24
24
|
return to;
|
|
25
25
|
};
|
|
26
|
-
var __toESM = (
|
|
26
|
+
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
27
27
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
28
|
// file that has been converted to a CommonJS file using a Babel-
|
|
29
29
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
30
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
-
isNodeMode || !
|
|
32
|
-
|
|
31
|
+
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
32
|
+
mod2
|
|
33
33
|
));
|
|
34
34
|
var __publicField = (obj, key, value) => {
|
|
35
35
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -122,6 +122,693 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
122
122
|
// src/index.ts
|
|
123
123
|
init_env_shim();
|
|
124
124
|
|
|
125
|
+
// ../addresses/dist/index.browser.js
|
|
126
|
+
init_env_shim();
|
|
127
|
+
|
|
128
|
+
// ../codecs-core/dist/index.browser.js
|
|
129
|
+
init_env_shim();
|
|
130
|
+
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes2, offset = 0) {
|
|
131
|
+
if (bytes2.length - offset <= 0) {
|
|
132
|
+
throw new Error(`Codec [${codecDescription}] cannot decode empty byte arrays.`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes2, offset = 0) {
|
|
136
|
+
const bytesLength = bytes2.length - offset;
|
|
137
|
+
if (bytesLength < expected) {
|
|
138
|
+
throw new Error(`Codec [${codecDescription}] expected ${expected} bytes, got ${bytesLength}.`);
|
|
139
|
+
}
|
|
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
|
+
var padBytes = (bytes2, length) => {
|
|
159
|
+
if (bytes2.length >= length)
|
|
160
|
+
return bytes2;
|
|
161
|
+
const paddedBytes = new Uint8Array(length).fill(0);
|
|
162
|
+
paddedBytes.set(bytes2);
|
|
163
|
+
return paddedBytes;
|
|
164
|
+
};
|
|
165
|
+
var fixBytes = (bytes2, length) => padBytes(bytes2.length <= length ? bytes2 : bytes2.slice(0, length), length);
|
|
166
|
+
function combineCodec(encoder, decoder, description) {
|
|
167
|
+
if (encoder.fixedSize !== decoder.fixedSize) {
|
|
168
|
+
throw new Error(
|
|
169
|
+
`Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
if (encoder.maxSize !== decoder.maxSize) {
|
|
173
|
+
throw new Error(
|
|
174
|
+
`Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
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
|
+
return {
|
|
183
|
+
decode: decoder.decode,
|
|
184
|
+
description: description ?? encoder.description,
|
|
185
|
+
encode: encoder.encode,
|
|
186
|
+
fixedSize: encoder.fixedSize,
|
|
187
|
+
maxSize: encoder.maxSize
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function fixCodecHelper(data, fixedBytes, description) {
|
|
191
|
+
return {
|
|
192
|
+
description: description ?? `fixed(${fixedBytes}, ${data.description})`,
|
|
193
|
+
fixedSize: fixedBytes,
|
|
194
|
+
maxSize: fixedBytes
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function fixEncoder(encoder, fixedBytes, description) {
|
|
198
|
+
return {
|
|
199
|
+
...fixCodecHelper(encoder, fixedBytes, description),
|
|
200
|
+
encode: (value) => fixBytes(encoder.encode(value), fixedBytes)
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function fixDecoder(decoder, fixedBytes, description) {
|
|
204
|
+
return {
|
|
205
|
+
...fixCodecHelper(decoder, fixedBytes, description),
|
|
206
|
+
decode: (bytes2, offset = 0) => {
|
|
207
|
+
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes2, offset);
|
|
208
|
+
if (offset > 0 || bytes2.length > fixedBytes) {
|
|
209
|
+
bytes2 = bytes2.slice(offset, offset + fixedBytes);
|
|
210
|
+
}
|
|
211
|
+
if (decoder.fixedSize !== null) {
|
|
212
|
+
bytes2 = fixBytes(bytes2, decoder.fixedSize);
|
|
213
|
+
}
|
|
214
|
+
const [value] = decoder.decode(bytes2, 0);
|
|
215
|
+
return [value, offset + fixedBytes];
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function mapEncoder(encoder, unmap) {
|
|
220
|
+
return {
|
|
221
|
+
description: encoder.description,
|
|
222
|
+
encode: (value) => encoder.encode(unmap(value)),
|
|
223
|
+
fixedSize: encoder.fixedSize,
|
|
224
|
+
maxSize: encoder.maxSize
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// ../codecs-strings/dist/index.browser.js
|
|
229
|
+
init_env_shim();
|
|
230
|
+
|
|
231
|
+
// ../codecs-numbers/dist/index.browser.js
|
|
232
|
+
init_env_shim();
|
|
233
|
+
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) {
|
|
234
|
+
if (value < min || value > max) {
|
|
235
|
+
throw new Error(
|
|
236
|
+
`Codec [${codecDescription}] expected number to be in the range [${min}, ${max}], got ${value}.`
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function sharedNumberFactory(input) {
|
|
241
|
+
let littleEndian;
|
|
242
|
+
let defaultDescription = input.name;
|
|
243
|
+
if (input.size > 1) {
|
|
244
|
+
littleEndian = !("endian" in input.options) || input.options.endian === 0;
|
|
245
|
+
defaultDescription += littleEndian ? "(le)" : "(be)";
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
description: input.options.description ?? defaultDescription,
|
|
249
|
+
fixedSize: input.size,
|
|
250
|
+
littleEndian,
|
|
251
|
+
maxSize: input.size
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function numberEncoderFactory(input) {
|
|
255
|
+
const codecData = sharedNumberFactory(input);
|
|
256
|
+
return {
|
|
257
|
+
description: codecData.description,
|
|
258
|
+
encode(value) {
|
|
259
|
+
if (input.range) {
|
|
260
|
+
assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);
|
|
261
|
+
}
|
|
262
|
+
const arrayBuffer = new ArrayBuffer(input.size);
|
|
263
|
+
input.set(new DataView(arrayBuffer), value, codecData.littleEndian);
|
|
264
|
+
return new Uint8Array(arrayBuffer);
|
|
265
|
+
},
|
|
266
|
+
fixedSize: codecData.fixedSize,
|
|
267
|
+
maxSize: codecData.maxSize
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function numberDecoderFactory(input) {
|
|
271
|
+
const codecData = sharedNumberFactory(input);
|
|
272
|
+
return {
|
|
273
|
+
decode(bytes2, offset = 0) {
|
|
274
|
+
assertByteArrayIsNotEmptyForCodec(codecData.description, bytes2, offset);
|
|
275
|
+
assertByteArrayHasEnoughBytesForCodec(codecData.description, input.size, bytes2, offset);
|
|
276
|
+
const view = new DataView(toArrayBuffer(bytes2, offset, input.size));
|
|
277
|
+
return [input.get(view, codecData.littleEndian), offset + input.size];
|
|
278
|
+
},
|
|
279
|
+
description: codecData.description,
|
|
280
|
+
fixedSize: codecData.fixedSize,
|
|
281
|
+
maxSize: codecData.maxSize
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function toArrayBuffer(bytes2, offset, length) {
|
|
285
|
+
const bytesOffset = bytes2.byteOffset + (offset ?? 0);
|
|
286
|
+
const bytesLength = length ?? bytes2.byteLength;
|
|
287
|
+
return bytes2.buffer.slice(bytesOffset, bytesOffset + bytesLength);
|
|
288
|
+
}
|
|
289
|
+
var getU32Encoder = (options = {}) => numberEncoderFactory({
|
|
290
|
+
name: "u32",
|
|
291
|
+
options,
|
|
292
|
+
range: [0, Number("0xffffffff")],
|
|
293
|
+
set: (view, value, le) => view.setUint32(0, value, le),
|
|
294
|
+
size: 4
|
|
295
|
+
});
|
|
296
|
+
var getU32Decoder = (options = {}) => numberDecoderFactory({
|
|
297
|
+
get: (view, le) => view.getUint32(0, le),
|
|
298
|
+
name: "u32",
|
|
299
|
+
options,
|
|
300
|
+
size: 4
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// ../codecs-strings/dist/index.browser.js
|
|
304
|
+
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
|
|
305
|
+
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
|
|
306
|
+
throw new Error(`Expected a string of base ${alphabet4.length}, got [${givenValue}].`);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
var getBaseXEncoder = (alphabet4) => {
|
|
310
|
+
const base = alphabet4.length;
|
|
311
|
+
const baseBigInt = BigInt(base);
|
|
312
|
+
return {
|
|
313
|
+
description: `base${base}`,
|
|
314
|
+
encode(value) {
|
|
315
|
+
assertValidBaseString(alphabet4, value);
|
|
316
|
+
if (value === "")
|
|
317
|
+
return new Uint8Array();
|
|
318
|
+
const chars = [...value];
|
|
319
|
+
let trailIndex = chars.findIndex((c) => c !== alphabet4[0]);
|
|
320
|
+
trailIndex = trailIndex === -1 ? chars.length : trailIndex;
|
|
321
|
+
const leadingZeroes = Array(trailIndex).fill(0);
|
|
322
|
+
if (trailIndex === chars.length)
|
|
323
|
+
return Uint8Array.from(leadingZeroes);
|
|
324
|
+
const tailChars = chars.slice(trailIndex);
|
|
325
|
+
let base10Number = 0n;
|
|
326
|
+
let baseXPower = 1n;
|
|
327
|
+
for (let i = tailChars.length - 1; i >= 0; i -= 1) {
|
|
328
|
+
base10Number += baseXPower * BigInt(alphabet4.indexOf(tailChars[i]));
|
|
329
|
+
baseXPower *= baseBigInt;
|
|
330
|
+
}
|
|
331
|
+
const tailBytes = [];
|
|
332
|
+
while (base10Number > 0n) {
|
|
333
|
+
tailBytes.unshift(Number(base10Number % 256n));
|
|
334
|
+
base10Number /= 256n;
|
|
335
|
+
}
|
|
336
|
+
return Uint8Array.from(leadingZeroes.concat(tailBytes));
|
|
337
|
+
},
|
|
338
|
+
fixedSize: null,
|
|
339
|
+
maxSize: null
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
var getBaseXDecoder = (alphabet4) => {
|
|
343
|
+
const base = alphabet4.length;
|
|
344
|
+
const baseBigInt = BigInt(base);
|
|
345
|
+
return {
|
|
346
|
+
decode(rawBytes, offset = 0) {
|
|
347
|
+
const bytes2 = offset === 0 ? rawBytes : rawBytes.slice(offset);
|
|
348
|
+
if (bytes2.length === 0)
|
|
349
|
+
return ["", 0];
|
|
350
|
+
let trailIndex = bytes2.findIndex((n) => n !== 0);
|
|
351
|
+
trailIndex = trailIndex === -1 ? bytes2.length : trailIndex;
|
|
352
|
+
const leadingZeroes = alphabet4[0].repeat(trailIndex);
|
|
353
|
+
if (trailIndex === bytes2.length)
|
|
354
|
+
return [leadingZeroes, rawBytes.length];
|
|
355
|
+
let base10Number = bytes2.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
|
|
356
|
+
const tailChars = [];
|
|
357
|
+
while (base10Number > 0n) {
|
|
358
|
+
tailChars.unshift(alphabet4[Number(base10Number % baseBigInt)]);
|
|
359
|
+
base10Number /= baseBigInt;
|
|
360
|
+
}
|
|
361
|
+
return [leadingZeroes + tailChars.join(""), rawBytes.length];
|
|
362
|
+
},
|
|
363
|
+
description: `base${base}`,
|
|
364
|
+
fixedSize: null,
|
|
365
|
+
maxSize: null
|
|
366
|
+
};
|
|
367
|
+
};
|
|
368
|
+
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
369
|
+
var getBase58Encoder = () => getBaseXEncoder(alphabet2);
|
|
370
|
+
var getBase58Decoder = () => getBaseXDecoder(alphabet2);
|
|
371
|
+
var removeNullCharacters = (value) => (
|
|
372
|
+
// eslint-disable-next-line no-control-regex
|
|
373
|
+
value.replace(/\u0000/g, "")
|
|
374
|
+
);
|
|
375
|
+
var e = globalThis.TextDecoder;
|
|
376
|
+
var o = globalThis.TextEncoder;
|
|
377
|
+
var getUtf8Encoder = () => {
|
|
378
|
+
let textEncoder;
|
|
379
|
+
return {
|
|
380
|
+
description: "utf8",
|
|
381
|
+
encode: (value) => new Uint8Array((textEncoder || (textEncoder = new o())).encode(value)),
|
|
382
|
+
fixedSize: null,
|
|
383
|
+
maxSize: null
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
var getUtf8Decoder = () => {
|
|
387
|
+
let textDecoder;
|
|
388
|
+
return {
|
|
389
|
+
decode(bytes2, offset = 0) {
|
|
390
|
+
const value = (textDecoder || (textDecoder = new e())).decode(bytes2.slice(offset));
|
|
391
|
+
return [removeNullCharacters(value), bytes2.length];
|
|
392
|
+
},
|
|
393
|
+
description: "utf8",
|
|
394
|
+
fixedSize: null,
|
|
395
|
+
maxSize: null
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
var getStringEncoder = (options = {}) => {
|
|
399
|
+
const size = options.size ?? getU32Encoder();
|
|
400
|
+
const encoding = options.encoding ?? getUtf8Encoder();
|
|
401
|
+
const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
402
|
+
if (size === "variable") {
|
|
403
|
+
return { ...encoding, description };
|
|
404
|
+
}
|
|
405
|
+
if (typeof size === "number") {
|
|
406
|
+
return fixEncoder(encoding, size, description);
|
|
407
|
+
}
|
|
408
|
+
return {
|
|
409
|
+
description,
|
|
410
|
+
encode: (value) => {
|
|
411
|
+
const contentBytes = encoding.encode(value);
|
|
412
|
+
const lengthBytes = size.encode(contentBytes.length);
|
|
413
|
+
return mergeBytes([lengthBytes, contentBytes]);
|
|
414
|
+
},
|
|
415
|
+
fixedSize: null,
|
|
416
|
+
maxSize: null
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
var getStringDecoder = (options = {}) => {
|
|
420
|
+
const size = options.size ?? getU32Decoder();
|
|
421
|
+
const encoding = options.encoding ?? getUtf8Decoder();
|
|
422
|
+
const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
423
|
+
if (size === "variable") {
|
|
424
|
+
return { ...encoding, description };
|
|
425
|
+
}
|
|
426
|
+
if (typeof size === "number") {
|
|
427
|
+
return fixDecoder(encoding, size, description);
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
decode: (bytes2, offset = 0) => {
|
|
431
|
+
assertByteArrayIsNotEmptyForCodec("string", bytes2, offset);
|
|
432
|
+
const [lengthBigInt, lengthOffset] = size.decode(bytes2, offset);
|
|
433
|
+
const length = Number(lengthBigInt);
|
|
434
|
+
offset = lengthOffset;
|
|
435
|
+
const contentBytes = bytes2.slice(offset, offset + length);
|
|
436
|
+
assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes);
|
|
437
|
+
const [value, contentOffset] = encoding.decode(contentBytes);
|
|
438
|
+
offset += contentOffset;
|
|
439
|
+
return [value, offset];
|
|
440
|
+
},
|
|
441
|
+
description,
|
|
442
|
+
fixedSize: null,
|
|
443
|
+
maxSize: null
|
|
444
|
+
};
|
|
445
|
+
};
|
|
446
|
+
function getSizeDescription(size) {
|
|
447
|
+
return typeof size === "object" ? size.description : `${size}`;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// ../assertions/dist/index.browser.js
|
|
451
|
+
init_env_shim();
|
|
452
|
+
function assertIsSecureContext() {
|
|
453
|
+
if (!globalThis.isSecureContext) {
|
|
454
|
+
throw new Error(
|
|
455
|
+
"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts"
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
var cachedEd25519Decision;
|
|
460
|
+
async function isEd25519CurveSupported(subtle) {
|
|
461
|
+
if (cachedEd25519Decision === void 0) {
|
|
462
|
+
cachedEd25519Decision = new Promise((resolve) => {
|
|
463
|
+
subtle.generateKey(
|
|
464
|
+
"Ed25519",
|
|
465
|
+
/* extractable */
|
|
466
|
+
false,
|
|
467
|
+
["sign", "verify"]
|
|
468
|
+
).catch(() => {
|
|
469
|
+
resolve(cachedEd25519Decision = false);
|
|
470
|
+
}).then(() => {
|
|
471
|
+
resolve(cachedEd25519Decision = true);
|
|
472
|
+
});
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
if (typeof cachedEd25519Decision === "boolean") {
|
|
476
|
+
return cachedEd25519Decision;
|
|
477
|
+
} else {
|
|
478
|
+
return await cachedEd25519Decision;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
async function assertDigestCapabilityIsAvailable() {
|
|
482
|
+
assertIsSecureContext();
|
|
483
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.digest !== "function") {
|
|
484
|
+
throw new Error("No digest implementation could be found");
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
async function assertKeyGenerationIsAvailable() {
|
|
488
|
+
assertIsSecureContext();
|
|
489
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.generateKey !== "function") {
|
|
490
|
+
throw new Error("No key generation implementation could be found");
|
|
491
|
+
}
|
|
492
|
+
if (!await isEd25519CurveSupported(globalThis.crypto.subtle)) {
|
|
493
|
+
throw new Error(
|
|
494
|
+
"This runtime does not support the generation of Ed25519 key pairs.\n\nInstall and import `@solana/webcrypto-ed25519-polyfill` before generating keys in environments that do not support Ed25519.\n\nFor a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20"
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
async function assertKeyExporterIsAvailable() {
|
|
499
|
+
assertIsSecureContext();
|
|
500
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.exportKey !== "function") {
|
|
501
|
+
throw new Error("No key export implementation could be found");
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
async function assertSigningCapabilityIsAvailable() {
|
|
505
|
+
assertIsSecureContext();
|
|
506
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.sign !== "function") {
|
|
507
|
+
throw new Error("No signing implementation could be found");
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
async function assertVerificationCapabilityIsAvailable() {
|
|
511
|
+
assertIsSecureContext();
|
|
512
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.verify !== "function") {
|
|
513
|
+
throw new Error("No signature verification implementation could be found");
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// ../addresses/dist/index.browser.js
|
|
518
|
+
var memoizedBase58Encoder;
|
|
519
|
+
var memoizedBase58Decoder;
|
|
520
|
+
function getMemoizedBase58Encoder() {
|
|
521
|
+
if (!memoizedBase58Encoder)
|
|
522
|
+
memoizedBase58Encoder = getBase58Encoder();
|
|
523
|
+
return memoizedBase58Encoder;
|
|
524
|
+
}
|
|
525
|
+
function getMemoizedBase58Decoder() {
|
|
526
|
+
if (!memoizedBase58Decoder)
|
|
527
|
+
memoizedBase58Decoder = getBase58Decoder();
|
|
528
|
+
return memoizedBase58Decoder;
|
|
529
|
+
}
|
|
530
|
+
function isAddress(putativeBase58EncodedAddress) {
|
|
531
|
+
if (
|
|
532
|
+
// Lowest address (32 bytes of zeroes)
|
|
533
|
+
putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
534
|
+
putativeBase58EncodedAddress.length > 44
|
|
535
|
+
) {
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
538
|
+
const base58Encoder = getMemoizedBase58Encoder();
|
|
539
|
+
const bytes2 = base58Encoder.encode(putativeBase58EncodedAddress);
|
|
540
|
+
const numBytes = bytes2.byteLength;
|
|
541
|
+
if (numBytes !== 32) {
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
return true;
|
|
545
|
+
}
|
|
546
|
+
function assertIsAddress(putativeBase58EncodedAddress) {
|
|
547
|
+
try {
|
|
548
|
+
if (
|
|
549
|
+
// Lowest address (32 bytes of zeroes)
|
|
550
|
+
putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
551
|
+
putativeBase58EncodedAddress.length > 44
|
|
552
|
+
) {
|
|
553
|
+
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
554
|
+
}
|
|
555
|
+
const base58Encoder = getMemoizedBase58Encoder();
|
|
556
|
+
const bytes2 = base58Encoder.encode(putativeBase58EncodedAddress);
|
|
557
|
+
const numBytes = bytes2.byteLength;
|
|
558
|
+
if (numBytes !== 32) {
|
|
559
|
+
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
560
|
+
}
|
|
561
|
+
} catch (e3) {
|
|
562
|
+
throw new Error(`\`${putativeBase58EncodedAddress}\` is not a base-58 encoded address`, {
|
|
563
|
+
cause: e3
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function address(putativeBase58EncodedAddress) {
|
|
568
|
+
assertIsAddress(putativeBase58EncodedAddress);
|
|
569
|
+
return putativeBase58EncodedAddress;
|
|
570
|
+
}
|
|
571
|
+
function getAddressEncoder(config) {
|
|
572
|
+
return mapEncoder(
|
|
573
|
+
getStringEncoder({
|
|
574
|
+
description: config?.description ?? "Base58EncodedAddress",
|
|
575
|
+
encoding: getMemoizedBase58Encoder(),
|
|
576
|
+
size: 32
|
|
577
|
+
}),
|
|
578
|
+
(putativeAddress) => address(putativeAddress)
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
function getAddressDecoder(config) {
|
|
582
|
+
return getStringDecoder({
|
|
583
|
+
description: config?.description ?? "Base58EncodedAddress",
|
|
584
|
+
encoding: getMemoizedBase58Decoder(),
|
|
585
|
+
size: 32
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
function getAddressCodec(config) {
|
|
589
|
+
return combineCodec(getAddressEncoder(config), getAddressDecoder(config));
|
|
590
|
+
}
|
|
591
|
+
function getAddressComparator() {
|
|
592
|
+
return new Intl.Collator("en", {
|
|
593
|
+
caseFirst: "lower",
|
|
594
|
+
ignorePunctuation: false,
|
|
595
|
+
localeMatcher: "best fit",
|
|
596
|
+
numeric: false,
|
|
597
|
+
sensitivity: "variant",
|
|
598
|
+
usage: "sort"
|
|
599
|
+
}).compare;
|
|
600
|
+
}
|
|
601
|
+
var D = 37095705934669439343138083508754565189542113879843219016388785533085940283555n;
|
|
602
|
+
var P = 57896044618658097711785492504343953926634992332820282019728792003956564819949n;
|
|
603
|
+
var RM1 = 19681161376707505956807079304988542015446066515923890162744021073123829784752n;
|
|
604
|
+
function mod(a) {
|
|
605
|
+
const r = a % P;
|
|
606
|
+
return r >= 0n ? r : P + r;
|
|
607
|
+
}
|
|
608
|
+
function pow2(x, power) {
|
|
609
|
+
let r = x;
|
|
610
|
+
while (power-- > 0n) {
|
|
611
|
+
r *= r;
|
|
612
|
+
r %= P;
|
|
613
|
+
}
|
|
614
|
+
return r;
|
|
615
|
+
}
|
|
616
|
+
function pow_2_252_3(x) {
|
|
617
|
+
const x2 = x * x % P;
|
|
618
|
+
const b2 = x2 * x % P;
|
|
619
|
+
const b4 = pow2(b2, 2n) * b2 % P;
|
|
620
|
+
const b5 = pow2(b4, 1n) * x % P;
|
|
621
|
+
const b10 = pow2(b5, 5n) * b5 % P;
|
|
622
|
+
const b20 = pow2(b10, 10n) * b10 % P;
|
|
623
|
+
const b40 = pow2(b20, 20n) * b20 % P;
|
|
624
|
+
const b80 = pow2(b40, 40n) * b40 % P;
|
|
625
|
+
const b160 = pow2(b80, 80n) * b80 % P;
|
|
626
|
+
const b240 = pow2(b160, 80n) * b80 % P;
|
|
627
|
+
const b250 = pow2(b240, 10n) * b10 % P;
|
|
628
|
+
const pow_p_5_8 = pow2(b250, 2n) * x % P;
|
|
629
|
+
return pow_p_5_8;
|
|
630
|
+
}
|
|
631
|
+
function uvRatio(u, v) {
|
|
632
|
+
const v3 = mod(v * v * v);
|
|
633
|
+
const v7 = mod(v3 * v3 * v);
|
|
634
|
+
const pow = pow_2_252_3(u * v7);
|
|
635
|
+
let x = mod(u * v3 * pow);
|
|
636
|
+
const vx2 = mod(v * x * x);
|
|
637
|
+
const root1 = x;
|
|
638
|
+
const root2 = mod(x * RM1);
|
|
639
|
+
const useRoot1 = vx2 === u;
|
|
640
|
+
const useRoot2 = vx2 === mod(-u);
|
|
641
|
+
const noRoot = vx2 === mod(-u * RM1);
|
|
642
|
+
if (useRoot1)
|
|
643
|
+
x = root1;
|
|
644
|
+
if (useRoot2 || noRoot)
|
|
645
|
+
x = root2;
|
|
646
|
+
if ((mod(x) & 1n) === 1n)
|
|
647
|
+
x = mod(-x);
|
|
648
|
+
if (!useRoot1 && !useRoot2) {
|
|
649
|
+
return null;
|
|
650
|
+
}
|
|
651
|
+
return x;
|
|
652
|
+
}
|
|
653
|
+
function pointIsOnCurve(y, lastByte) {
|
|
654
|
+
const y2 = mod(y * y);
|
|
655
|
+
const u = mod(y2 - 1n);
|
|
656
|
+
const v = mod(D * y2 + 1n);
|
|
657
|
+
const x = uvRatio(u, v);
|
|
658
|
+
if (x === null) {
|
|
659
|
+
return false;
|
|
660
|
+
}
|
|
661
|
+
const isLastByteOdd = (lastByte & 128) !== 0;
|
|
662
|
+
if (x === 0n && isLastByteOdd) {
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
return true;
|
|
666
|
+
}
|
|
667
|
+
function byteToHex(byte) {
|
|
668
|
+
const hexString = byte.toString(16);
|
|
669
|
+
if (hexString.length === 1) {
|
|
670
|
+
return `0${hexString}`;
|
|
671
|
+
} else {
|
|
672
|
+
return hexString;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
function decompressPointBytes(bytes2) {
|
|
676
|
+
const hexString = bytes2.reduce((acc, byte, ii) => `${byteToHex(ii === 31 ? byte & ~128 : byte)}${acc}`, "");
|
|
677
|
+
const integerLiteralString = `0x${hexString}`;
|
|
678
|
+
return BigInt(integerLiteralString);
|
|
679
|
+
}
|
|
680
|
+
async function compressedPointBytesAreOnCurve(bytes2) {
|
|
681
|
+
if (bytes2.byteLength !== 32) {
|
|
682
|
+
return false;
|
|
683
|
+
}
|
|
684
|
+
const y = decompressPointBytes(bytes2);
|
|
685
|
+
return pointIsOnCurve(y, bytes2[31]);
|
|
686
|
+
}
|
|
687
|
+
function isProgramDerivedAddress(value) {
|
|
688
|
+
return Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "number" && value[1] >= 0 && value[1] <= 255 && isAddress(value[0]);
|
|
689
|
+
}
|
|
690
|
+
function assertIsProgramDerivedAddress(value) {
|
|
691
|
+
const validFormat = Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "number";
|
|
692
|
+
if (!validFormat) {
|
|
693
|
+
throw new Error(
|
|
694
|
+
`Expected given program derived address to have the following format: [Base58EncodedAddress, ProgramDerivedAddressBump].`
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
if (value[1] < 0 || value[1] > 255) {
|
|
698
|
+
throw new Error(`Expected program derived address bump to be in the range [0, 255], got: ${value[1]}.`);
|
|
699
|
+
}
|
|
700
|
+
assertIsAddress(value[0]);
|
|
701
|
+
}
|
|
702
|
+
var MAX_SEED_LENGTH = 32;
|
|
703
|
+
var MAX_SEEDS = 16;
|
|
704
|
+
var PDA_MARKER_BYTES = [
|
|
705
|
+
// The string 'ProgramDerivedAddress'
|
|
706
|
+
80,
|
|
707
|
+
114,
|
|
708
|
+
111,
|
|
709
|
+
103,
|
|
710
|
+
114,
|
|
711
|
+
97,
|
|
712
|
+
109,
|
|
713
|
+
68,
|
|
714
|
+
101,
|
|
715
|
+
114,
|
|
716
|
+
105,
|
|
717
|
+
118,
|
|
718
|
+
101,
|
|
719
|
+
100,
|
|
720
|
+
65,
|
|
721
|
+
100,
|
|
722
|
+
100,
|
|
723
|
+
114,
|
|
724
|
+
101,
|
|
725
|
+
115,
|
|
726
|
+
115
|
|
727
|
+
];
|
|
728
|
+
var PointOnCurveError = class extends Error {
|
|
729
|
+
};
|
|
730
|
+
async function createProgramDerivedAddress({
|
|
731
|
+
programAddress,
|
|
732
|
+
seeds
|
|
733
|
+
}) {
|
|
734
|
+
await assertDigestCapabilityIsAvailable();
|
|
735
|
+
if (seeds.length > MAX_SEEDS) {
|
|
736
|
+
throw new Error(`A maximum of ${MAX_SEEDS} seeds may be supplied when creating an address`);
|
|
737
|
+
}
|
|
738
|
+
let textEncoder;
|
|
739
|
+
const seedBytes = seeds.reduce((acc, seed, ii) => {
|
|
740
|
+
const bytes2 = typeof seed === "string" ? (textEncoder || (textEncoder = new TextEncoder())).encode(seed) : seed;
|
|
741
|
+
if (bytes2.byteLength > MAX_SEED_LENGTH) {
|
|
742
|
+
throw new Error(`The seed at index ${ii} exceeds the maximum length of 32 bytes`);
|
|
743
|
+
}
|
|
744
|
+
acc.push(...bytes2);
|
|
745
|
+
return acc;
|
|
746
|
+
}, []);
|
|
747
|
+
const base58EncodedAddressCodec = getAddressCodec();
|
|
748
|
+
const programAddressBytes = base58EncodedAddressCodec.encode(programAddress);
|
|
749
|
+
const addressBytesBuffer = await crypto.subtle.digest(
|
|
750
|
+
"SHA-256",
|
|
751
|
+
new Uint8Array([...seedBytes, ...programAddressBytes, ...PDA_MARKER_BYTES])
|
|
752
|
+
);
|
|
753
|
+
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
754
|
+
if (await compressedPointBytesAreOnCurve(addressBytes)) {
|
|
755
|
+
throw new PointOnCurveError("Invalid seeds; point must fall off the Ed25519 curve");
|
|
756
|
+
}
|
|
757
|
+
return base58EncodedAddressCodec.decode(addressBytes)[0];
|
|
758
|
+
}
|
|
759
|
+
async function getProgramDerivedAddress({
|
|
760
|
+
programAddress,
|
|
761
|
+
seeds
|
|
762
|
+
}) {
|
|
763
|
+
let bumpSeed = 255;
|
|
764
|
+
while (bumpSeed > 0) {
|
|
765
|
+
try {
|
|
766
|
+
const address2 = await createProgramDerivedAddress({
|
|
767
|
+
programAddress,
|
|
768
|
+
seeds: [...seeds, new Uint8Array([bumpSeed])]
|
|
769
|
+
});
|
|
770
|
+
return [address2, bumpSeed];
|
|
771
|
+
} catch (e3) {
|
|
772
|
+
if (e3 instanceof PointOnCurveError) {
|
|
773
|
+
bumpSeed--;
|
|
774
|
+
} else {
|
|
775
|
+
throw e3;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
throw new Error("Unable to find a viable program address bump seed");
|
|
780
|
+
}
|
|
781
|
+
async function createAddressWithSeed({
|
|
782
|
+
baseAddress,
|
|
783
|
+
programAddress,
|
|
784
|
+
seed
|
|
785
|
+
}) {
|
|
786
|
+
const { encode: encode2, decode: decode2 } = getAddressCodec();
|
|
787
|
+
const seedBytes = typeof seed === "string" ? new TextEncoder().encode(seed) : seed;
|
|
788
|
+
if (seedBytes.byteLength > MAX_SEED_LENGTH) {
|
|
789
|
+
throw new Error(`The seed exceeds the maximum length of 32 bytes`);
|
|
790
|
+
}
|
|
791
|
+
const programAddressBytes = encode2(programAddress);
|
|
792
|
+
if (programAddressBytes.length >= PDA_MARKER_BYTES.length && programAddressBytes.slice(-PDA_MARKER_BYTES.length).every((byte, index) => byte === PDA_MARKER_BYTES[index])) {
|
|
793
|
+
throw new Error(`programAddress cannot end with the PDA marker`);
|
|
794
|
+
}
|
|
795
|
+
const addressBytesBuffer = await crypto.subtle.digest(
|
|
796
|
+
"SHA-256",
|
|
797
|
+
new Uint8Array([...encode2(baseAddress), ...seedBytes, ...programAddressBytes])
|
|
798
|
+
);
|
|
799
|
+
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
800
|
+
return decode2(addressBytes)[0];
|
|
801
|
+
}
|
|
802
|
+
async function getAddressFromPublicKey(publicKey) {
|
|
803
|
+
await assertKeyExporterIsAvailable();
|
|
804
|
+
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
805
|
+
throw new Error("The `CryptoKey` must be an `Ed25519` public key");
|
|
806
|
+
}
|
|
807
|
+
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
808
|
+
const [base58EncodedAddress] = getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
|
|
809
|
+
return base58EncodedAddress;
|
|
810
|
+
}
|
|
811
|
+
|
|
125
812
|
// ../instructions/dist/index.browser.js
|
|
126
813
|
init_env_shim();
|
|
127
814
|
var AccountRole = /* @__PURE__ */ ((AccountRole22) => {
|
|
@@ -161,16 +848,42 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
161
848
|
|
|
162
849
|
// ../keys/dist/index.browser.js
|
|
163
850
|
init_env_shim();
|
|
851
|
+
async function generateKeyPair() {
|
|
852
|
+
await assertKeyGenerationIsAvailable();
|
|
853
|
+
const keyPair = await crypto.subtle.generateKey(
|
|
854
|
+
/* algorithm */
|
|
855
|
+
"Ed25519",
|
|
856
|
+
// Native implementation status: https://github.com/WICG/webcrypto-secure-curves/issues/20
|
|
857
|
+
/* extractable */
|
|
858
|
+
false,
|
|
859
|
+
// Prevents the bytes of the private key from being visible to JS.
|
|
860
|
+
/* allowed uses */
|
|
861
|
+
["sign", "verify"]
|
|
862
|
+
);
|
|
863
|
+
return keyPair;
|
|
864
|
+
}
|
|
865
|
+
async function signBytes(key, data) {
|
|
866
|
+
await assertSigningCapabilityIsAvailable();
|
|
867
|
+
const signedData = await crypto.subtle.sign("Ed25519", key, data);
|
|
868
|
+
return new Uint8Array(signedData);
|
|
869
|
+
}
|
|
870
|
+
async function verifySignature(key, signature, data) {
|
|
871
|
+
await assertVerificationCapabilityIsAvailable();
|
|
872
|
+
return await crypto.subtle.verify("Ed25519", key, signature, data);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
// ../transactions/dist/index.browser.js
|
|
876
|
+
init_env_shim();
|
|
164
877
|
|
|
165
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
878
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/index.mjs
|
|
166
879
|
init_env_shim();
|
|
167
880
|
|
|
168
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.
|
|
881
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/index.mjs
|
|
169
882
|
init_env_shim();
|
|
170
883
|
|
|
171
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.
|
|
884
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/bytes.mjs
|
|
172
885
|
init_env_shim();
|
|
173
|
-
var
|
|
886
|
+
var mergeBytes2 = (bytesArr) => {
|
|
174
887
|
const totalLength = bytesArr.reduce((total, arr) => total + arr.length, 0);
|
|
175
888
|
const result = new Uint8Array(totalLength);
|
|
176
889
|
let offset = 0;
|
|
@@ -180,16 +893,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
180
893
|
});
|
|
181
894
|
return result;
|
|
182
895
|
};
|
|
183
|
-
var
|
|
896
|
+
var padBytes2 = (bytes2, length) => {
|
|
184
897
|
if (bytes2.length >= length)
|
|
185
898
|
return bytes2;
|
|
186
899
|
const paddedBytes = new Uint8Array(length).fill(0);
|
|
187
900
|
paddedBytes.set(bytes2);
|
|
188
901
|
return paddedBytes;
|
|
189
902
|
};
|
|
190
|
-
var
|
|
903
|
+
var fixBytes2 = (bytes2, length) => padBytes2(bytes2.slice(0, length), length);
|
|
191
904
|
|
|
192
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.
|
|
905
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/errors.mjs
|
|
193
906
|
init_env_shim();
|
|
194
907
|
var DeserializingEmptyBufferError = class extends Error {
|
|
195
908
|
constructor(serializer) {
|
|
@@ -211,21 +924,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
211
924
|
}
|
|
212
925
|
};
|
|
213
926
|
|
|
214
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.
|
|
927
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/fixSerializer.mjs
|
|
215
928
|
init_env_shim();
|
|
216
929
|
function fixSerializer(serializer, fixedBytes, description) {
|
|
217
930
|
return {
|
|
218
931
|
description: description ?? `fixed(${fixedBytes}, ${serializer.description})`,
|
|
219
932
|
fixedSize: fixedBytes,
|
|
220
933
|
maxSize: fixedBytes,
|
|
221
|
-
serialize: (value) =>
|
|
934
|
+
serialize: (value) => fixBytes2(serializer.serialize(value), fixedBytes),
|
|
222
935
|
deserialize: (buffer, offset = 0) => {
|
|
223
936
|
buffer = buffer.slice(offset, offset + fixedBytes);
|
|
224
937
|
if (buffer.length < fixedBytes) {
|
|
225
938
|
throw new NotEnoughBytesError("fixSerializer", fixedBytes, buffer.length);
|
|
226
939
|
}
|
|
227
940
|
if (serializer.fixedSize !== null) {
|
|
228
|
-
buffer =
|
|
941
|
+
buffer = fixBytes2(buffer, serializer.fixedSize);
|
|
229
942
|
}
|
|
230
943
|
const [value] = serializer.deserialize(buffer, 0);
|
|
231
944
|
return [value, offset + fixedBytes];
|
|
@@ -233,7 +946,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
233
946
|
};
|
|
234
947
|
}
|
|
235
948
|
|
|
236
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.
|
|
949
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/mapSerializer.mjs
|
|
237
950
|
init_env_shim();
|
|
238
951
|
function mapSerializer(serializer, unmap, map) {
|
|
239
952
|
return {
|
|
@@ -248,13 +961,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
248
961
|
};
|
|
249
962
|
}
|
|
250
963
|
|
|
251
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
964
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/index.mjs
|
|
252
965
|
init_env_shim();
|
|
253
966
|
|
|
254
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
967
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
|
|
255
968
|
init_env_shim();
|
|
256
969
|
|
|
257
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
970
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/errors.mjs
|
|
258
971
|
init_env_shim();
|
|
259
972
|
var InvalidBaseStringError = class extends Error {
|
|
260
973
|
constructor(value, base, cause) {
|
|
@@ -265,7 +978,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
265
978
|
}
|
|
266
979
|
};
|
|
267
980
|
|
|
268
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
981
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
|
|
269
982
|
var baseX = (alphabet) => {
|
|
270
983
|
const base = alphabet.length;
|
|
271
984
|
const baseBigInt = BigInt(base);
|
|
@@ -319,18 +1032,70 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
319
1032
|
};
|
|
320
1033
|
};
|
|
321
1034
|
|
|
322
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
1035
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base58.mjs
|
|
323
1036
|
init_env_shim();
|
|
324
1037
|
var base58 = baseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
|
|
325
1038
|
|
|
326
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
1039
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base64.mjs
|
|
327
1040
|
init_env_shim();
|
|
328
|
-
|
|
1041
|
+
|
|
1042
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseXReslice.mjs
|
|
1043
|
+
init_env_shim();
|
|
1044
|
+
var baseXReslice = (alphabet, bits) => {
|
|
1045
|
+
const base = alphabet.length;
|
|
1046
|
+
const reslice = (input, inputBits, outputBits, useRemainder) => {
|
|
1047
|
+
const output = [];
|
|
1048
|
+
let accumulator = 0;
|
|
1049
|
+
let bitsInAccumulator = 0;
|
|
1050
|
+
const mask = (1 << outputBits) - 1;
|
|
1051
|
+
for (const value of input) {
|
|
1052
|
+
accumulator = accumulator << inputBits | value;
|
|
1053
|
+
bitsInAccumulator += inputBits;
|
|
1054
|
+
while (bitsInAccumulator >= outputBits) {
|
|
1055
|
+
bitsInAccumulator -= outputBits;
|
|
1056
|
+
output.push(accumulator >> bitsInAccumulator & mask);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
if (useRemainder && bitsInAccumulator > 0) {
|
|
1060
|
+
output.push(accumulator << outputBits - bitsInAccumulator & mask);
|
|
1061
|
+
}
|
|
1062
|
+
return output;
|
|
1063
|
+
};
|
|
1064
|
+
return {
|
|
1065
|
+
description: `base${base}`,
|
|
1066
|
+
fixedSize: null,
|
|
1067
|
+
maxSize: null,
|
|
1068
|
+
serialize(value) {
|
|
1069
|
+
if (!value.match(new RegExp(`^[${alphabet}]*$`))) {
|
|
1070
|
+
throw new InvalidBaseStringError(value, base);
|
|
1071
|
+
}
|
|
1072
|
+
if (value === "")
|
|
1073
|
+
return new Uint8Array();
|
|
1074
|
+
const charIndices = [...value].map((c) => alphabet.indexOf(c));
|
|
1075
|
+
const bytes2 = reslice(charIndices, bits, 8, false);
|
|
1076
|
+
return Uint8Array.from(bytes2);
|
|
1077
|
+
},
|
|
1078
|
+
deserialize(buffer, offset = 0) {
|
|
1079
|
+
if (buffer.length === 0)
|
|
1080
|
+
return ["", 0];
|
|
1081
|
+
const bytes2 = [...buffer.slice(offset)];
|
|
1082
|
+
const charIndices = reslice(bytes2, 8, bits, true);
|
|
1083
|
+
return [charIndices.map((i) => alphabet[i]).join(""), buffer.length];
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base64.mjs
|
|
1089
|
+
var base64 = mapSerializer(baseXReslice("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 6), (value) => value.replace(/=/g, ""), (value) => value.padEnd(Math.ceil(value.length / 4) * 4, "="));
|
|
1090
|
+
|
|
1091
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/nullCharacters.mjs
|
|
1092
|
+
init_env_shim();
|
|
1093
|
+
var removeNullCharacters2 = (value) => (
|
|
329
1094
|
// eslint-disable-next-line no-control-regex
|
|
330
1095
|
value.replace(/\u0000/g, "")
|
|
331
1096
|
);
|
|
332
1097
|
|
|
333
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
1098
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/utf8.mjs
|
|
334
1099
|
init_env_shim();
|
|
335
1100
|
var utf8 = {
|
|
336
1101
|
description: "utf8",
|
|
@@ -341,14 +1106,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
341
1106
|
},
|
|
342
1107
|
deserialize(buffer, offset = 0) {
|
|
343
1108
|
const value = new TextDecoder().decode(buffer.slice(offset));
|
|
344
|
-
return [
|
|
1109
|
+
return [removeNullCharacters2(value), buffer.length];
|
|
345
1110
|
}
|
|
346
1111
|
};
|
|
347
1112
|
|
|
348
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
1113
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/index.mjs
|
|
349
1114
|
init_env_shim();
|
|
350
1115
|
|
|
351
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
1116
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/common.mjs
|
|
352
1117
|
init_env_shim();
|
|
353
1118
|
var Endian;
|
|
354
1119
|
(function(Endian2) {
|
|
@@ -356,7 +1121,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
356
1121
|
Endian2["Big"] = "be";
|
|
357
1122
|
})(Endian || (Endian = {}));
|
|
358
1123
|
|
|
359
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
1124
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/errors.mjs
|
|
360
1125
|
init_env_shim();
|
|
361
1126
|
var NumberOutOfRangeError = class extends RangeError {
|
|
362
1127
|
constructor(serializer, min, max, actual) {
|
|
@@ -365,7 +1130,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
365
1130
|
}
|
|
366
1131
|
};
|
|
367
1132
|
|
|
368
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
1133
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/utils.mjs
|
|
369
1134
|
init_env_shim();
|
|
370
1135
|
function numberFactory(input) {
|
|
371
1136
|
let littleEndian;
|
|
@@ -394,8 +1159,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
394
1159
|
}
|
|
395
1160
|
};
|
|
396
1161
|
}
|
|
397
|
-
var
|
|
398
|
-
var toDataView = (array2) => new DataView(
|
|
1162
|
+
var toArrayBuffer2 = (array2) => array2.buffer.slice(array2.byteOffset, array2.byteLength + array2.byteOffset);
|
|
1163
|
+
var toDataView = (array2) => new DataView(toArrayBuffer2(array2));
|
|
399
1164
|
var assertRange = (serializer, min, max, value) => {
|
|
400
1165
|
if (value < min || value > max) {
|
|
401
1166
|
throw new NumberOutOfRangeError(serializer, min, max, value);
|
|
@@ -410,7 +1175,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
410
1175
|
}
|
|
411
1176
|
};
|
|
412
1177
|
|
|
413
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
1178
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u8.mjs
|
|
414
1179
|
init_env_shim();
|
|
415
1180
|
var u8 = (options = {}) => numberFactory({
|
|
416
1181
|
name: "u8",
|
|
@@ -421,7 +1186,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
421
1186
|
options
|
|
422
1187
|
});
|
|
423
1188
|
|
|
424
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
1189
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u32.mjs
|
|
425
1190
|
init_env_shim();
|
|
426
1191
|
var u32 = (options = {}) => numberFactory({
|
|
427
1192
|
name: "u32",
|
|
@@ -432,7 +1197,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
432
1197
|
options
|
|
433
1198
|
});
|
|
434
1199
|
|
|
435
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
1200
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/shortU16.mjs
|
|
436
1201
|
init_env_shim();
|
|
437
1202
|
var shortU16 = (options = {}) => ({
|
|
438
1203
|
description: options.description ?? "shortU16",
|
|
@@ -470,10 +1235,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
470
1235
|
}
|
|
471
1236
|
});
|
|
472
1237
|
|
|
473
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
1238
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
|
|
474
1239
|
init_env_shim();
|
|
475
1240
|
|
|
476
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
1241
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/errors.mjs
|
|
477
1242
|
init_env_shim();
|
|
478
1243
|
var InvalidNumberOfItemsError = class extends Error {
|
|
479
1244
|
constructor(serializer, expected, actual) {
|
|
@@ -494,16 +1259,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
494
1259
|
}
|
|
495
1260
|
};
|
|
496
1261
|
|
|
497
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
1262
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
|
|
498
1263
|
init_env_shim();
|
|
499
1264
|
|
|
500
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
1265
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/sumSerializerSizes.mjs
|
|
501
1266
|
init_env_shim();
|
|
502
1267
|
function sumSerializerSizes(sizes) {
|
|
503
1268
|
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
|
|
504
1269
|
}
|
|
505
1270
|
|
|
506
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
1271
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
|
|
507
1272
|
function getResolvedSize(size, childrenSizes, bytes2, offset) {
|
|
508
1273
|
if (typeof size === "number") {
|
|
509
1274
|
return [size, offset];
|
|
@@ -524,7 +1289,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
524
1289
|
}
|
|
525
1290
|
throw new UnrecognizedArrayLikeSerializerSizeError(size);
|
|
526
1291
|
}
|
|
527
|
-
function
|
|
1292
|
+
function getSizeDescription2(size) {
|
|
528
1293
|
return typeof size === "object" ? size.description : `${size}`;
|
|
529
1294
|
}
|
|
530
1295
|
function getSizeFromChildren(size, childrenSizes) {
|
|
@@ -539,21 +1304,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
539
1304
|
return typeof size === "object" ? size.serialize(realSize) : new Uint8Array();
|
|
540
1305
|
}
|
|
541
1306
|
|
|
542
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
1307
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
|
|
543
1308
|
function array(item, options = {}) {
|
|
544
1309
|
const size = options.size ?? u32();
|
|
545
1310
|
if (size === "remainder" && item.fixedSize === null) {
|
|
546
1311
|
throw new ExpectedFixedSizeSerializerError('Serializers of "remainder" size must have fixed-size items.');
|
|
547
1312
|
}
|
|
548
1313
|
return {
|
|
549
|
-
description: options.description ?? `array(${item.description}; ${
|
|
1314
|
+
description: options.description ?? `array(${item.description}; ${getSizeDescription2(size)})`,
|
|
550
1315
|
fixedSize: getSizeFromChildren(size, [item.fixedSize]),
|
|
551
1316
|
maxSize: getSizeFromChildren(size, [item.maxSize]),
|
|
552
1317
|
serialize: (value) => {
|
|
553
1318
|
if (typeof size === "number" && value.length !== size) {
|
|
554
1319
|
throw new InvalidNumberOfItemsError("array", size, value.length);
|
|
555
1320
|
}
|
|
556
|
-
return
|
|
1321
|
+
return mergeBytes2([getSizePrefix(size, value.length), ...value.map((v) => item.serialize(v))]);
|
|
557
1322
|
},
|
|
558
1323
|
deserialize: (bytes2, offset = 0) => {
|
|
559
1324
|
if (typeof size === "object" && bytes2.slice(offset).length === 0) {
|
|
@@ -572,11 +1337,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
572
1337
|
};
|
|
573
1338
|
}
|
|
574
1339
|
|
|
575
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
1340
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/bytes.mjs
|
|
576
1341
|
init_env_shim();
|
|
577
1342
|
function bytes(options = {}) {
|
|
578
1343
|
const size = options.size ?? "variable";
|
|
579
|
-
const description = options.description ?? `bytes(${
|
|
1344
|
+
const description = options.description ?? `bytes(${getSizeDescription2(size)})`;
|
|
580
1345
|
const byteSerializer = {
|
|
581
1346
|
description,
|
|
582
1347
|
fixedSize: null,
|
|
@@ -599,222 +1364,92 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
599
1364
|
maxSize: null,
|
|
600
1365
|
serialize: (value) => {
|
|
601
1366
|
const contentBytes = byteSerializer.serialize(value);
|
|
602
|
-
const lengthBytes = size.serialize(contentBytes.length);
|
|
603
|
-
return
|
|
604
|
-
},
|
|
605
|
-
deserialize: (buffer, offset = 0) => {
|
|
606
|
-
if (buffer.slice(offset).length === 0) {
|
|
607
|
-
throw new DeserializingEmptyBufferError("bytes");
|
|
608
|
-
}
|
|
609
|
-
const [lengthBigInt, lengthOffset] = size.deserialize(buffer, offset);
|
|
610
|
-
const length = Number(lengthBigInt);
|
|
611
|
-
offset = lengthOffset;
|
|
612
|
-
const contentBuffer = buffer.slice(offset, offset + length);
|
|
613
|
-
if (contentBuffer.length < length) {
|
|
614
|
-
throw new NotEnoughBytesError("bytes", length, contentBuffer.length);
|
|
615
|
-
}
|
|
616
|
-
const [value, contentOffset] = byteSerializer.deserialize(contentBuffer);
|
|
617
|
-
offset += contentOffset;
|
|
618
|
-
return [value, offset];
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/string.mjs
|
|
624
|
-
init_env_shim();
|
|
625
|
-
function string(options = {}) {
|
|
626
|
-
const size = options.size ?? u32();
|
|
627
|
-
const encoding = options.encoding ?? utf8;
|
|
628
|
-
const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
629
|
-
if (size === "variable") {
|
|
630
|
-
return {
|
|
631
|
-
...encoding,
|
|
632
|
-
description
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
|
-
if (typeof size === "number") {
|
|
636
|
-
return fixSerializer(encoding, size, description);
|
|
637
|
-
}
|
|
638
|
-
return {
|
|
639
|
-
description,
|
|
640
|
-
fixedSize: null,
|
|
641
|
-
maxSize: null,
|
|
642
|
-
serialize: (value) => {
|
|
643
|
-
const contentBytes = encoding.serialize(value);
|
|
644
|
-
const lengthBytes = size.serialize(contentBytes.length);
|
|
645
|
-
return mergeBytes([lengthBytes, contentBytes]);
|
|
646
|
-
},
|
|
647
|
-
deserialize: (buffer, offset = 0) => {
|
|
648
|
-
if (buffer.slice(offset).length === 0) {
|
|
649
|
-
throw new DeserializingEmptyBufferError("string");
|
|
650
|
-
}
|
|
651
|
-
const [lengthBigInt, lengthOffset] = size.deserialize(buffer, offset);
|
|
652
|
-
const length = Number(lengthBigInt);
|
|
653
|
-
offset = lengthOffset;
|
|
654
|
-
const contentBuffer = buffer.slice(offset, offset + length);
|
|
655
|
-
if (contentBuffer.length < length) {
|
|
656
|
-
throw new NotEnoughBytesError("string", length, contentBuffer.length);
|
|
657
|
-
}
|
|
658
|
-
const [value, contentOffset] = encoding.deserialize(contentBuffer);
|
|
659
|
-
offset += contentOffset;
|
|
660
|
-
return [value, offset];
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/struct.mjs
|
|
666
|
-
init_env_shim();
|
|
667
|
-
function struct(fields, options = {}) {
|
|
668
|
-
const fieldDescriptions = fields.map(([name, serializer]) => `${String(name)}: ${serializer.description}`).join(", ");
|
|
669
|
-
return {
|
|
670
|
-
description: options.description ?? `struct(${fieldDescriptions})`,
|
|
671
|
-
fixedSize: sumSerializerSizes(fields.map(([, field]) => field.fixedSize)),
|
|
672
|
-
maxSize: sumSerializerSizes(fields.map(([, field]) => field.maxSize)),
|
|
673
|
-
serialize: (struct2) => {
|
|
674
|
-
const fieldBytes = fields.map(([key, serializer]) => serializer.serialize(struct2[key]));
|
|
675
|
-
return mergeBytes(fieldBytes);
|
|
676
|
-
},
|
|
677
|
-
deserialize: (bytes2, offset = 0) => {
|
|
678
|
-
const struct2 = {};
|
|
679
|
-
fields.forEach(([key, serializer]) => {
|
|
680
|
-
const [value, newOffset] = serializer.deserialize(bytes2, offset);
|
|
681
|
-
offset = newOffset;
|
|
682
|
-
struct2[key] = value;
|
|
683
|
-
});
|
|
684
|
-
return [struct2, offset];
|
|
685
|
-
}
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
function assertIsBase58EncodedAddress(putativeBase58EncodedAddress) {
|
|
689
|
-
try {
|
|
690
|
-
if (
|
|
691
|
-
// Lowest address (32 bytes of zeroes)
|
|
692
|
-
putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
693
|
-
putativeBase58EncodedAddress.length > 44
|
|
694
|
-
) {
|
|
695
|
-
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
696
|
-
}
|
|
697
|
-
const bytes2 = base58.serialize(putativeBase58EncodedAddress);
|
|
698
|
-
const numBytes = bytes2.byteLength;
|
|
699
|
-
if (numBytes !== 32) {
|
|
700
|
-
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
701
|
-
}
|
|
702
|
-
} catch (e2) {
|
|
703
|
-
throw new Error(`\`${putativeBase58EncodedAddress}\` is not a base-58 encoded address`, {
|
|
704
|
-
cause: e2
|
|
705
|
-
});
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
function getBase58EncodedAddressCodec(config) {
|
|
709
|
-
return string({
|
|
710
|
-
description: config?.description ?? ("A 32-byte account address" ),
|
|
711
|
-
encoding: base58,
|
|
712
|
-
size: 32
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
function getBase58EncodedAddressComparator() {
|
|
716
|
-
return new Intl.Collator("en", {
|
|
717
|
-
caseFirst: "lower",
|
|
718
|
-
ignorePunctuation: false,
|
|
719
|
-
localeMatcher: "best fit",
|
|
720
|
-
numeric: false,
|
|
721
|
-
sensitivity: "variant",
|
|
722
|
-
usage: "sort"
|
|
723
|
-
}).compare;
|
|
724
|
-
}
|
|
725
|
-
function assertIsSecureContext() {
|
|
726
|
-
if (!globalThis.isSecureContext) {
|
|
727
|
-
throw new Error(
|
|
728
|
-
"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts"
|
|
729
|
-
);
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
var cachedEd25519Decision;
|
|
733
|
-
async function isEd25519CurveSupported(subtle) {
|
|
734
|
-
if (cachedEd25519Decision === void 0) {
|
|
735
|
-
cachedEd25519Decision = new Promise((resolve) => {
|
|
736
|
-
subtle.generateKey(
|
|
737
|
-
"Ed25519",
|
|
738
|
-
/* extractable */
|
|
739
|
-
false,
|
|
740
|
-
["sign", "verify"]
|
|
741
|
-
).catch(() => {
|
|
742
|
-
resolve(cachedEd25519Decision = false);
|
|
743
|
-
}).then(() => {
|
|
744
|
-
resolve(cachedEd25519Decision = true);
|
|
745
|
-
});
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
if (typeof cachedEd25519Decision === "boolean") {
|
|
749
|
-
return cachedEd25519Decision;
|
|
750
|
-
} else {
|
|
751
|
-
return await cachedEd25519Decision;
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
async function assertKeyGenerationIsAvailable() {
|
|
755
|
-
assertIsSecureContext();
|
|
756
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.generateKey !== "function") {
|
|
757
|
-
throw new Error("No key generation implementation could be found");
|
|
758
|
-
}
|
|
759
|
-
if (!await isEd25519CurveSupported(globalThis.crypto.subtle)) {
|
|
760
|
-
throw new Error(
|
|
761
|
-
"This runtime does not support the generation of Ed25519 key pairs.\n\nInstall and import `@solana/webcrypto-ed25519-polyfill` before generating keys in environments that do not support Ed25519.\n\nFor a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20"
|
|
762
|
-
);
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
async function assertKeyExporterIsAvailable() {
|
|
766
|
-
assertIsSecureContext();
|
|
767
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.exportKey !== "function") {
|
|
768
|
-
throw new Error("No key export implementation could be found");
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
async function assertSigningCapabilityIsAvailable() {
|
|
772
|
-
assertIsSecureContext();
|
|
773
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.sign !== "function") {
|
|
774
|
-
throw new Error("No signing implementation could be found");
|
|
775
|
-
}
|
|
1367
|
+
const lengthBytes = size.serialize(contentBytes.length);
|
|
1368
|
+
return mergeBytes2([lengthBytes, contentBytes]);
|
|
1369
|
+
},
|
|
1370
|
+
deserialize: (buffer, offset = 0) => {
|
|
1371
|
+
if (buffer.slice(offset).length === 0) {
|
|
1372
|
+
throw new DeserializingEmptyBufferError("bytes");
|
|
1373
|
+
}
|
|
1374
|
+
const [lengthBigInt, lengthOffset] = size.deserialize(buffer, offset);
|
|
1375
|
+
const length = Number(lengthBigInt);
|
|
1376
|
+
offset = lengthOffset;
|
|
1377
|
+
const contentBuffer = buffer.slice(offset, offset + length);
|
|
1378
|
+
if (contentBuffer.length < length) {
|
|
1379
|
+
throw new NotEnoughBytesError("bytes", length, contentBuffer.length);
|
|
1380
|
+
}
|
|
1381
|
+
const [value, contentOffset] = byteSerializer.deserialize(contentBuffer);
|
|
1382
|
+
offset += contentOffset;
|
|
1383
|
+
return [value, offset];
|
|
1384
|
+
}
|
|
1385
|
+
};
|
|
776
1386
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
1387
|
+
|
|
1388
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/string.mjs
|
|
1389
|
+
init_env_shim();
|
|
1390
|
+
function string(options = {}) {
|
|
1391
|
+
const size = options.size ?? u32();
|
|
1392
|
+
const encoding = options.encoding ?? utf8;
|
|
1393
|
+
const description = options.description ?? `string(${encoding.description}; ${getSizeDescription2(size)})`;
|
|
1394
|
+
if (size === "variable") {
|
|
1395
|
+
return {
|
|
1396
|
+
...encoding,
|
|
1397
|
+
description
|
|
1398
|
+
};
|
|
781
1399
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
await assertKeyGenerationIsAvailable();
|
|
785
|
-
const keyPair = await crypto.subtle.generateKey(
|
|
786
|
-
/* algorithm */
|
|
787
|
-
"Ed25519",
|
|
788
|
-
// Native implementation status: https://github.com/WICG/webcrypto-secure-curves/issues/20
|
|
789
|
-
/* extractable */
|
|
790
|
-
false,
|
|
791
|
-
// Prevents the bytes of the private key from being visible to JS.
|
|
792
|
-
/* allowed uses */
|
|
793
|
-
["sign", "verify"]
|
|
794
|
-
);
|
|
795
|
-
return keyPair;
|
|
796
|
-
}
|
|
797
|
-
async function getBase58EncodedAddressFromPublicKey(publicKey) {
|
|
798
|
-
await assertKeyExporterIsAvailable();
|
|
799
|
-
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
800
|
-
throw new Error("The `CryptoKey` must be an `Ed25519` public key");
|
|
1400
|
+
if (typeof size === "number") {
|
|
1401
|
+
return fixSerializer(encoding, size, description);
|
|
801
1402
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1403
|
+
return {
|
|
1404
|
+
description,
|
|
1405
|
+
fixedSize: null,
|
|
1406
|
+
maxSize: null,
|
|
1407
|
+
serialize: (value) => {
|
|
1408
|
+
const contentBytes = encoding.serialize(value);
|
|
1409
|
+
const lengthBytes = size.serialize(contentBytes.length);
|
|
1410
|
+
return mergeBytes2([lengthBytes, contentBytes]);
|
|
1411
|
+
},
|
|
1412
|
+
deserialize: (buffer, offset = 0) => {
|
|
1413
|
+
if (buffer.slice(offset).length === 0) {
|
|
1414
|
+
throw new DeserializingEmptyBufferError("string");
|
|
1415
|
+
}
|
|
1416
|
+
const [lengthBigInt, lengthOffset] = size.deserialize(buffer, offset);
|
|
1417
|
+
const length = Number(lengthBigInt);
|
|
1418
|
+
offset = lengthOffset;
|
|
1419
|
+
const contentBuffer = buffer.slice(offset, offset + length);
|
|
1420
|
+
if (contentBuffer.length < length) {
|
|
1421
|
+
throw new NotEnoughBytesError("string", length, contentBuffer.length);
|
|
1422
|
+
}
|
|
1423
|
+
const [value, contentOffset] = encoding.deserialize(contentBuffer);
|
|
1424
|
+
offset += contentOffset;
|
|
1425
|
+
return [value, offset];
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
814
1428
|
}
|
|
815
1429
|
|
|
816
|
-
//
|
|
1430
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/struct.mjs
|
|
817
1431
|
init_env_shim();
|
|
1432
|
+
function struct(fields, options = {}) {
|
|
1433
|
+
const fieldDescriptions = fields.map(([name, serializer]) => `${String(name)}: ${serializer.description}`).join(", ");
|
|
1434
|
+
return {
|
|
1435
|
+
description: options.description ?? `struct(${fieldDescriptions})`,
|
|
1436
|
+
fixedSize: sumSerializerSizes(fields.map(([, field]) => field.fixedSize)),
|
|
1437
|
+
maxSize: sumSerializerSizes(fields.map(([, field]) => field.maxSize)),
|
|
1438
|
+
serialize: (struct2) => {
|
|
1439
|
+
const fieldBytes = fields.map(([key, serializer]) => serializer.serialize(struct2[key]));
|
|
1440
|
+
return mergeBytes2(fieldBytes);
|
|
1441
|
+
},
|
|
1442
|
+
deserialize: (bytes2, offset = 0) => {
|
|
1443
|
+
const struct2 = {};
|
|
1444
|
+
fields.forEach(([key, serializer]) => {
|
|
1445
|
+
const [value, newOffset] = serializer.deserialize(bytes2, offset);
|
|
1446
|
+
offset = newOffset;
|
|
1447
|
+
struct2[key] = value;
|
|
1448
|
+
});
|
|
1449
|
+
return [struct2, offset];
|
|
1450
|
+
}
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
818
1453
|
function getUnsignedTransaction(transaction) {
|
|
819
1454
|
if ("signatures" in transaction) {
|
|
820
1455
|
const {
|
|
@@ -841,9 +1476,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
841
1476
|
if (numBytes !== 32) {
|
|
842
1477
|
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
843
1478
|
}
|
|
844
|
-
} catch (
|
|
1479
|
+
} catch (e3) {
|
|
845
1480
|
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
|
|
846
|
-
cause:
|
|
1481
|
+
cause: e3
|
|
847
1482
|
});
|
|
848
1483
|
}
|
|
849
1484
|
}
|
|
@@ -973,8 +1608,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
973
1608
|
Object.freeze(out);
|
|
974
1609
|
return out;
|
|
975
1610
|
}
|
|
976
|
-
function upsert(addressMap,
|
|
977
|
-
addressMap[
|
|
1611
|
+
function upsert(addressMap, address2, update) {
|
|
1612
|
+
addressMap[address2] = update(addressMap[address2] ?? { role: AccountRole2.READONLY });
|
|
978
1613
|
}
|
|
979
1614
|
var TYPE = Symbol("AddressMapTypeProperty");
|
|
980
1615
|
function getAddressMapFromInstructions(feePayer, instructions) {
|
|
@@ -1025,7 +1660,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1025
1660
|
const shouldReplaceEntry = (
|
|
1026
1661
|
// Consider using the new LOOKUP_TABLE if its address is different...
|
|
1027
1662
|
entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
|
|
1028
|
-
(addressComparator || (addressComparator =
|
|
1663
|
+
(addressComparator || (addressComparator = getAddressComparator()))(
|
|
1029
1664
|
accountMeta.lookupTableAddress,
|
|
1030
1665
|
entry.lookupTableAddress
|
|
1031
1666
|
) < 0
|
|
@@ -1133,14 +1768,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1133
1768
|
if (leftIsWritable !== isWritableRole2(rightEntry.role)) {
|
|
1134
1769
|
return leftIsWritable ? -1 : 1;
|
|
1135
1770
|
}
|
|
1136
|
-
addressComparator || (addressComparator =
|
|
1771
|
+
addressComparator || (addressComparator = getAddressComparator());
|
|
1137
1772
|
if (leftEntry[TYPE] === 1 && rightEntry[TYPE] === 1 && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {
|
|
1138
1773
|
return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);
|
|
1139
1774
|
} else {
|
|
1140
1775
|
return addressComparator(leftAddress, rightAddress);
|
|
1141
1776
|
}
|
|
1142
|
-
}).map(([
|
|
1143
|
-
address,
|
|
1777
|
+
}).map(([address2, addressMeta]) => ({
|
|
1778
|
+
address: address2,
|
|
1144
1779
|
...addressMeta
|
|
1145
1780
|
}));
|
|
1146
1781
|
return orderedAccounts;
|
|
@@ -1162,7 +1797,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1162
1797
|
entry.readableIndices.push(account.addressIndex);
|
|
1163
1798
|
}
|
|
1164
1799
|
}
|
|
1165
|
-
return Object.keys(index).sort(
|
|
1800
|
+
return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({
|
|
1166
1801
|
lookupTableAddress,
|
|
1167
1802
|
...index[lookupTableAddress]
|
|
1168
1803
|
}));
|
|
@@ -1203,7 +1838,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1203
1838
|
return instructions.map(({ accounts, data, programAddress }) => {
|
|
1204
1839
|
return {
|
|
1205
1840
|
programAddressIndex: accountIndex[programAddress],
|
|
1206
|
-
...accounts ? { accountIndices: accounts.map(({ address }) => accountIndex[
|
|
1841
|
+
...accounts ? { accountIndices: accounts.map(({ address: address2 }) => accountIndex[address2]) } : null,
|
|
1207
1842
|
...data ? { data } : null
|
|
1208
1843
|
};
|
|
1209
1844
|
});
|
|
@@ -1217,7 +1852,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1217
1852
|
function getCompiledStaticAccounts(orderedAccounts) {
|
|
1218
1853
|
const firstLookupTableAccountIndex = orderedAccounts.findIndex((account) => "lookupTableAddress" in account);
|
|
1219
1854
|
const orderedStaticAccounts = firstLookupTableAccountIndex === -1 ? orderedAccounts : orderedAccounts.slice(0, firstLookupTableAccountIndex);
|
|
1220
|
-
return orderedStaticAccounts.map(({ address }) =>
|
|
1855
|
+
return orderedStaticAccounts.map(({ address: address2 }) => address2);
|
|
1221
1856
|
}
|
|
1222
1857
|
function compileMessage(transaction) {
|
|
1223
1858
|
const addressMap = getAddressMapFromInstructions(transaction.feePayer, transaction.instructions);
|
|
@@ -1231,12 +1866,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1231
1866
|
version: transaction.version
|
|
1232
1867
|
};
|
|
1233
1868
|
}
|
|
1869
|
+
function getCompiledTransaction(transaction) {
|
|
1870
|
+
const compiledMessage = compileMessage(transaction);
|
|
1871
|
+
let signatures;
|
|
1872
|
+
if ("signatures" in transaction) {
|
|
1873
|
+
signatures = [];
|
|
1874
|
+
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
|
|
1875
|
+
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
|
|
1876
|
+
}
|
|
1877
|
+
} else {
|
|
1878
|
+
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
|
|
1879
|
+
}
|
|
1880
|
+
return {
|
|
1881
|
+
compiledMessage,
|
|
1882
|
+
signatures
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
function addressSerializerCompat(compat) {
|
|
1886
|
+
const codec = getAddressCodec();
|
|
1887
|
+
return {
|
|
1888
|
+
description: compat?.description ?? codec.description,
|
|
1889
|
+
deserialize: codec.decode,
|
|
1890
|
+
fixedSize: codec.fixedSize,
|
|
1891
|
+
maxSize: codec.maxSize,
|
|
1892
|
+
serialize: codec.encode
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1234
1895
|
function getAddressTableLookupCodec() {
|
|
1235
1896
|
return struct(
|
|
1236
1897
|
[
|
|
1237
1898
|
[
|
|
1238
1899
|
"lookupTableAddress",
|
|
1239
|
-
|
|
1900
|
+
addressSerializerCompat(
|
|
1240
1901
|
{
|
|
1241
1902
|
description: "The address of the address lookup table account from which instruction addresses should be looked up"
|
|
1242
1903
|
}
|
|
@@ -1311,7 +1972,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1311
1972
|
)
|
|
1312
1973
|
],
|
|
1313
1974
|
[
|
|
1314
|
-
"
|
|
1975
|
+
"accountIndices",
|
|
1315
1976
|
array(
|
|
1316
1977
|
u8({
|
|
1317
1978
|
description: "The index of an account, according to the well-ordered accounts list for this transaction"
|
|
@@ -1331,46 +1992,35 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1331
1992
|
]
|
|
1332
1993
|
]),
|
|
1333
1994
|
(value) => {
|
|
1334
|
-
if (value.
|
|
1995
|
+
if (value.accountIndices !== void 0 && value.data !== void 0) {
|
|
1335
1996
|
return value;
|
|
1336
1997
|
}
|
|
1337
1998
|
return {
|
|
1338
1999
|
...value,
|
|
1339
|
-
|
|
2000
|
+
accountIndices: value.accountIndices ?? [],
|
|
1340
2001
|
data: value.data ?? new Uint8Array(0)
|
|
1341
2002
|
};
|
|
1342
2003
|
},
|
|
1343
2004
|
(value) => {
|
|
1344
|
-
if (value.
|
|
2005
|
+
if (value.accountIndices.length && value.data.byteLength) {
|
|
1345
2006
|
return value;
|
|
1346
2007
|
}
|
|
1347
|
-
const {
|
|
2008
|
+
const { accountIndices, data, ...rest } = value;
|
|
1348
2009
|
return {
|
|
1349
2010
|
...rest,
|
|
1350
|
-
...
|
|
2011
|
+
...accountIndices.length ? { accountIndices } : null,
|
|
1351
2012
|
...data.byteLength ? { data } : null
|
|
1352
2013
|
};
|
|
1353
2014
|
}
|
|
1354
2015
|
);
|
|
1355
2016
|
}
|
|
1356
|
-
function getError(type, name) {
|
|
1357
|
-
const functionSuffix = name + type[0].toUpperCase() + type.slice(1);
|
|
1358
|
-
return new Error(
|
|
1359
|
-
`No ${type} exists for ${name}. Use \`get${functionSuffix}()\` if you need a ${type}, and \`get${name}Codec()\` if you need to both encode and decode ${name}`
|
|
1360
|
-
);
|
|
1361
|
-
}
|
|
1362
|
-
function getUnimplementedDecoder(name) {
|
|
1363
|
-
return () => {
|
|
1364
|
-
throw getError("decoder", name);
|
|
1365
|
-
};
|
|
1366
|
-
}
|
|
1367
2017
|
var VERSION_FLAG_MASK = 128;
|
|
1368
2018
|
var BASE_CONFIG = {
|
|
1369
2019
|
description: "A single byte that encodes the version of the transaction" ,
|
|
1370
2020
|
fixedSize: null,
|
|
1371
2021
|
maxSize: 1
|
|
1372
2022
|
};
|
|
1373
|
-
function
|
|
2023
|
+
function decode(bytes3, offset = 0) {
|
|
1374
2024
|
const firstByte = bytes3[offset];
|
|
1375
2025
|
if ((firstByte & VERSION_FLAG_MASK) === 0) {
|
|
1376
2026
|
return ["legacy", offset];
|
|
@@ -1379,7 +2029,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1379
2029
|
return [version, offset + 1];
|
|
1380
2030
|
}
|
|
1381
2031
|
}
|
|
1382
|
-
function
|
|
2032
|
+
function encode(value) {
|
|
1383
2033
|
if (value === "legacy") {
|
|
1384
2034
|
return new Uint8Array();
|
|
1385
2035
|
}
|
|
@@ -1388,11 +2038,30 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1388
2038
|
}
|
|
1389
2039
|
return new Uint8Array([value | VERSION_FLAG_MASK]);
|
|
1390
2040
|
}
|
|
1391
|
-
function
|
|
2041
|
+
function getTransactionVersionDecoder() {
|
|
1392
2042
|
return {
|
|
1393
2043
|
...BASE_CONFIG,
|
|
1394
|
-
|
|
1395
|
-
|
|
2044
|
+
decode
|
|
2045
|
+
};
|
|
2046
|
+
}
|
|
2047
|
+
function getTransactionVersionEncoder() {
|
|
2048
|
+
return {
|
|
2049
|
+
...BASE_CONFIG,
|
|
2050
|
+
encode
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
function getTransactionVersionCodec() {
|
|
2054
|
+
return combineCodec(getTransactionVersionEncoder(), getTransactionVersionDecoder());
|
|
2055
|
+
}
|
|
2056
|
+
function getError(type, name) {
|
|
2057
|
+
const functionSuffix = name + type[0].toUpperCase() + type.slice(1);
|
|
2058
|
+
return new Error(
|
|
2059
|
+
`No ${type} exists for ${name}. Use \`get${functionSuffix}()\` if you need a ${type}, and \`get${name}Codec()\` if you need to both encode and decode ${name}`
|
|
2060
|
+
);
|
|
2061
|
+
}
|
|
2062
|
+
function getUnimplementedDecoder(name) {
|
|
2063
|
+
return () => {
|
|
2064
|
+
throw getError("decoder", name);
|
|
1396
2065
|
};
|
|
1397
2066
|
}
|
|
1398
2067
|
var BASE_CONFIG2 = {
|
|
@@ -1400,7 +2069,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1400
2069
|
fixedSize: null,
|
|
1401
2070
|
maxSize: null
|
|
1402
2071
|
};
|
|
1403
|
-
function
|
|
2072
|
+
function serialize(compiledMessage) {
|
|
1404
2073
|
if (compiledMessage.version === "legacy") {
|
|
1405
2074
|
return struct(getPreludeStructSerializerTuple()).serialize(compiledMessage);
|
|
1406
2075
|
} else {
|
|
@@ -1421,13 +2090,33 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1421
2090
|
).serialize(compiledMessage);
|
|
1422
2091
|
}
|
|
1423
2092
|
}
|
|
2093
|
+
function addressSerializerCompat2() {
|
|
2094
|
+
const codec = getAddressCodec();
|
|
2095
|
+
return {
|
|
2096
|
+
description: codec.description,
|
|
2097
|
+
deserialize: codec.decode,
|
|
2098
|
+
fixedSize: codec.fixedSize,
|
|
2099
|
+
maxSize: codec.maxSize,
|
|
2100
|
+
serialize: codec.encode
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2103
|
+
function transactionVersionSerializerCompat() {
|
|
2104
|
+
const codec = getTransactionVersionCodec();
|
|
2105
|
+
return {
|
|
2106
|
+
description: codec.description,
|
|
2107
|
+
deserialize: codec.decode,
|
|
2108
|
+
fixedSize: codec.fixedSize,
|
|
2109
|
+
maxSize: codec.maxSize,
|
|
2110
|
+
serialize: codec.encode
|
|
2111
|
+
};
|
|
2112
|
+
}
|
|
1424
2113
|
function getPreludeStructSerializerTuple() {
|
|
1425
2114
|
return [
|
|
1426
|
-
["version",
|
|
2115
|
+
["version", transactionVersionSerializerCompat()],
|
|
1427
2116
|
["header", getMessageHeaderCodec()],
|
|
1428
2117
|
[
|
|
1429
2118
|
"staticAccounts",
|
|
1430
|
-
array(
|
|
2119
|
+
array(addressSerializerCompat2(), {
|
|
1431
2120
|
description: "A compact-array of static account addresses belonging to this transaction" ,
|
|
1432
2121
|
size: shortU16()
|
|
1433
2122
|
})
|
|
@@ -1459,45 +2148,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1459
2148
|
return {
|
|
1460
2149
|
...BASE_CONFIG2,
|
|
1461
2150
|
deserialize: getUnimplementedDecoder("CompiledMessage"),
|
|
1462
|
-
serialize
|
|
1463
|
-
};
|
|
1464
|
-
}
|
|
1465
|
-
async function getCompiledMessageSignature(message, secretKey) {
|
|
1466
|
-
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
|
|
1467
|
-
const signature = await signBytes(secretKey, wireMessageBytes);
|
|
1468
|
-
return signature;
|
|
1469
|
-
}
|
|
1470
|
-
async function signTransaction(keyPair, transaction) {
|
|
1471
|
-
const compiledMessage = compileMessage(transaction);
|
|
1472
|
-
const [signerPublicKey, signature] = await Promise.all([
|
|
1473
|
-
getBase58EncodedAddressFromPublicKey(keyPair.publicKey),
|
|
1474
|
-
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
|
|
1475
|
-
]);
|
|
1476
|
-
const nextSignatures = {
|
|
1477
|
-
..."signatures" in transaction ? transaction.signatures : null,
|
|
1478
|
-
...{ [signerPublicKey]: signature }
|
|
1479
|
-
};
|
|
1480
|
-
const out = {
|
|
1481
|
-
...transaction,
|
|
1482
|
-
signatures: nextSignatures
|
|
1483
|
-
};
|
|
1484
|
-
Object.freeze(out);
|
|
1485
|
-
return out;
|
|
1486
|
-
}
|
|
1487
|
-
function getCompiledTransaction(transaction) {
|
|
1488
|
-
const compiledMessage = compileMessage(transaction);
|
|
1489
|
-
let signatures;
|
|
1490
|
-
if ("signatures" in transaction) {
|
|
1491
|
-
signatures = [];
|
|
1492
|
-
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
|
|
1493
|
-
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
|
|
1494
|
-
}
|
|
1495
|
-
} else {
|
|
1496
|
-
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
|
|
1497
|
-
}
|
|
1498
|
-
return {
|
|
1499
|
-
compiledMessage,
|
|
1500
|
-
signatures
|
|
2151
|
+
serialize
|
|
1501
2152
|
};
|
|
1502
2153
|
}
|
|
1503
2154
|
var BASE_CONFIG3 = {
|
|
@@ -1505,7 +2156,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1505
2156
|
fixedSize: null,
|
|
1506
2157
|
maxSize: null
|
|
1507
2158
|
};
|
|
1508
|
-
function
|
|
2159
|
+
function serialize2(transaction) {
|
|
1509
2160
|
const compiledTransaction = getCompiledTransaction(transaction);
|
|
1510
2161
|
return struct([
|
|
1511
2162
|
[
|
|
@@ -1522,8 +2173,82 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1522
2173
|
return {
|
|
1523
2174
|
...BASE_CONFIG3,
|
|
1524
2175
|
deserialize: getUnimplementedDecoder("CompiledMessage"),
|
|
1525
|
-
serialize:
|
|
2176
|
+
serialize: serialize2
|
|
2177
|
+
};
|
|
2178
|
+
}
|
|
2179
|
+
function assertIsTransactionSignature(putativeTransactionSignature) {
|
|
2180
|
+
try {
|
|
2181
|
+
if (
|
|
2182
|
+
// Lowest value (64 bytes of zeroes)
|
|
2183
|
+
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
|
|
2184
|
+
putativeTransactionSignature.length > 88
|
|
2185
|
+
) {
|
|
2186
|
+
throw new Error("Expected input string to decode to a byte array of length 64.");
|
|
2187
|
+
}
|
|
2188
|
+
const bytes3 = base58.serialize(putativeTransactionSignature);
|
|
2189
|
+
const numBytes = bytes3.byteLength;
|
|
2190
|
+
if (numBytes !== 64) {
|
|
2191
|
+
throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
|
|
2192
|
+
}
|
|
2193
|
+
} catch (e3) {
|
|
2194
|
+
throw new Error(`\`${putativeTransactionSignature}\` is not a transaction signature`, {
|
|
2195
|
+
cause: e3
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
function isTransactionSignature(putativeTransactionSignature) {
|
|
2200
|
+
if (
|
|
2201
|
+
// Lowest value (64 bytes of zeroes)
|
|
2202
|
+
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
|
|
2203
|
+
putativeTransactionSignature.length > 88
|
|
2204
|
+
) {
|
|
2205
|
+
return false;
|
|
2206
|
+
}
|
|
2207
|
+
const bytes3 = base58.serialize(putativeTransactionSignature);
|
|
2208
|
+
const numBytes = bytes3.byteLength;
|
|
2209
|
+
if (numBytes !== 64) {
|
|
2210
|
+
return false;
|
|
2211
|
+
}
|
|
2212
|
+
return true;
|
|
2213
|
+
}
|
|
2214
|
+
async function getCompiledMessageSignature(message, secretKey) {
|
|
2215
|
+
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
|
|
2216
|
+
const signature = await signBytes(secretKey, wireMessageBytes);
|
|
2217
|
+
return signature;
|
|
2218
|
+
}
|
|
2219
|
+
function getSignatureFromTransaction(transaction) {
|
|
2220
|
+
const signature = transaction.signatures[transaction.feePayer];
|
|
2221
|
+
if (!signature) {
|
|
2222
|
+
throw new Error(
|
|
2223
|
+
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
|
|
2224
|
+
);
|
|
2225
|
+
}
|
|
2226
|
+
return signature;
|
|
2227
|
+
}
|
|
2228
|
+
async function signTransaction(keyPairs, transaction) {
|
|
2229
|
+
const compiledMessage = compileMessage(transaction);
|
|
2230
|
+
const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
|
|
2231
|
+
const publicKeySignaturePairs = await Promise.all(
|
|
2232
|
+
keyPairs.map(
|
|
2233
|
+
(keyPair) => Promise.all([
|
|
2234
|
+
getAddressFromPublicKey(keyPair.publicKey),
|
|
2235
|
+
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
|
|
2236
|
+
])
|
|
2237
|
+
)
|
|
2238
|
+
);
|
|
2239
|
+
for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
|
|
2240
|
+
nextSignatures[signerPublicKey] = signature;
|
|
2241
|
+
}
|
|
2242
|
+
const out = {
|
|
2243
|
+
...transaction,
|
|
2244
|
+
signatures: nextSignatures
|
|
1526
2245
|
};
|
|
2246
|
+
Object.freeze(out);
|
|
2247
|
+
return out;
|
|
2248
|
+
}
|
|
2249
|
+
function transactionSignature(putativeTransactionSignature) {
|
|
2250
|
+
assertIsTransactionSignature(putativeTransactionSignature);
|
|
2251
|
+
return putativeTransactionSignature;
|
|
1527
2252
|
}
|
|
1528
2253
|
function getBase64EncodedWireTransaction(transaction) {
|
|
1529
2254
|
const wireTransactionBytes = getTransactionEncoder().serialize(transaction);
|
|
@@ -1535,8 +2260,34 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1535
2260
|
// src/rpc.ts
|
|
1536
2261
|
init_env_shim();
|
|
1537
2262
|
|
|
2263
|
+
// ../functional/dist/index.browser.js
|
|
2264
|
+
init_env_shim();
|
|
2265
|
+
function pipe(init, ...fns) {
|
|
2266
|
+
return fns.reduce((acc, fn) => fn(acc), init);
|
|
2267
|
+
}
|
|
2268
|
+
|
|
1538
2269
|
// ../rpc-core/dist/index.browser.js
|
|
1539
2270
|
init_env_shim();
|
|
2271
|
+
function getCommitmentScore(commitment) {
|
|
2272
|
+
switch (commitment) {
|
|
2273
|
+
case "finalized":
|
|
2274
|
+
return 2;
|
|
2275
|
+
case "confirmed":
|
|
2276
|
+
return 1;
|
|
2277
|
+
case "processed":
|
|
2278
|
+
return 0;
|
|
2279
|
+
default:
|
|
2280
|
+
return ((_) => {
|
|
2281
|
+
throw new Error(`Unrecognized commitment \`${commitment}\`.`);
|
|
2282
|
+
})();
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
function commitmentComparator(a, b) {
|
|
2286
|
+
if (a === b) {
|
|
2287
|
+
return 0;
|
|
2288
|
+
}
|
|
2289
|
+
return getCommitmentScore(a) < getCommitmentScore(b) ? -1 : 1;
|
|
2290
|
+
}
|
|
1540
2291
|
function visitNode(value, keyPath, onIntegerOverflow) {
|
|
1541
2292
|
if (Array.isArray(value)) {
|
|
1542
2293
|
return value.map(
|
|
@@ -1563,85 +2314,393 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1563
2314
|
return visitNode(params, [], onIntegerOverflow);
|
|
1564
2315
|
}
|
|
1565
2316
|
var KEYPATH_WILDCARD = {};
|
|
1566
|
-
var
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
2317
|
+
var jsonParsedTokenAccountsConfigs = [
|
|
2318
|
+
// parsed Token/Token22 token account
|
|
2319
|
+
["data", "parsed", "info", "tokenAmount", "decimals"],
|
|
2320
|
+
["data", "parsed", "info", "tokenAmount", "uiAmount"],
|
|
2321
|
+
["data", "parsed", "info", "rentExemptReserve", "decimals"],
|
|
2322
|
+
["data", "parsed", "info", "rentExemptReserve", "uiAmount"],
|
|
2323
|
+
["data", "parsed", "info", "delegatedAmount", "decimals"],
|
|
2324
|
+
["data", "parsed", "info", "delegatedAmount", "uiAmount"],
|
|
2325
|
+
["data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "olderTransferFee", "transferFeeBasisPoints"],
|
|
2326
|
+
["data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "newerTransferFee", "transferFeeBasisPoints"],
|
|
2327
|
+
["data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "preUpdateAverageRate"],
|
|
2328
|
+
["data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "currentRate"]
|
|
2329
|
+
];
|
|
2330
|
+
var jsonParsedAccountsConfigs = [
|
|
2331
|
+
...jsonParsedTokenAccountsConfigs,
|
|
2332
|
+
// parsed AddressTableLookup account
|
|
2333
|
+
["data", "parsed", "info", "lastExtendedSlotStartIndex"],
|
|
2334
|
+
// parsed Config account
|
|
2335
|
+
["data", "parsed", "info", "slashPenalty"],
|
|
2336
|
+
["data", "parsed", "info", "warmupCooldownRate"],
|
|
2337
|
+
// parsed Token/Token22 mint account
|
|
2338
|
+
["data", "parsed", "info", "decimals"],
|
|
2339
|
+
// parsed Token/Token22 multisig account
|
|
2340
|
+
["data", "parsed", "info", "numRequiredSigners"],
|
|
2341
|
+
["data", "parsed", "info", "numValidSigners"],
|
|
2342
|
+
// parsed Stake account
|
|
2343
|
+
["data", "parsed", "info", "stake", "delegation", "warmupCooldownRate"],
|
|
2344
|
+
// parsed Sysvar rent account
|
|
2345
|
+
["data", "parsed", "info", "exemptionThreshold"],
|
|
2346
|
+
["data", "parsed", "info", "burnPercent"],
|
|
2347
|
+
// parsed Vote account
|
|
2348
|
+
["data", "parsed", "info", "commission"],
|
|
2349
|
+
["data", "parsed", "info", "votes", KEYPATH_WILDCARD, "confirmationCount"]
|
|
2350
|
+
];
|
|
2351
|
+
var memoizedNotificationKeypaths;
|
|
2352
|
+
var memoizedResponseKeypaths;
|
|
2353
|
+
function getAllowedNumericKeypathsForNotification() {
|
|
2354
|
+
if (!memoizedNotificationKeypaths) {
|
|
2355
|
+
memoizedNotificationKeypaths = {
|
|
2356
|
+
accountNotifications: jsonParsedAccountsConfigs.map((c) => ["value", ...c]),
|
|
2357
|
+
blockNotifications: [
|
|
2358
|
+
["value", "block", "blockTime"],
|
|
2359
|
+
[
|
|
2360
|
+
"value",
|
|
2361
|
+
"block",
|
|
2362
|
+
"transactions",
|
|
2363
|
+
KEYPATH_WILDCARD,
|
|
2364
|
+
"meta",
|
|
2365
|
+
"preTokenBalances",
|
|
2366
|
+
KEYPATH_WILDCARD,
|
|
2367
|
+
"accountIndex"
|
|
2368
|
+
],
|
|
2369
|
+
[
|
|
2370
|
+
"value",
|
|
2371
|
+
"block",
|
|
2372
|
+
"transactions",
|
|
2373
|
+
KEYPATH_WILDCARD,
|
|
2374
|
+
"meta",
|
|
2375
|
+
"preTokenBalances",
|
|
2376
|
+
KEYPATH_WILDCARD,
|
|
2377
|
+
"uiTokenAmount",
|
|
2378
|
+
"decimals"
|
|
2379
|
+
],
|
|
2380
|
+
[
|
|
2381
|
+
"value",
|
|
2382
|
+
"block",
|
|
2383
|
+
"transactions",
|
|
2384
|
+
KEYPATH_WILDCARD,
|
|
2385
|
+
"meta",
|
|
2386
|
+
"postTokenBalances",
|
|
2387
|
+
KEYPATH_WILDCARD,
|
|
2388
|
+
"accountIndex"
|
|
2389
|
+
],
|
|
2390
|
+
[
|
|
2391
|
+
"value",
|
|
2392
|
+
"block",
|
|
2393
|
+
"transactions",
|
|
2394
|
+
KEYPATH_WILDCARD,
|
|
2395
|
+
"meta",
|
|
2396
|
+
"postTokenBalances",
|
|
2397
|
+
KEYPATH_WILDCARD,
|
|
2398
|
+
"uiTokenAmount",
|
|
2399
|
+
"decimals"
|
|
2400
|
+
],
|
|
2401
|
+
["value", "block", "transactions", KEYPATH_WILDCARD, "meta", "rewards", KEYPATH_WILDCARD, "commission"],
|
|
2402
|
+
[
|
|
2403
|
+
"value",
|
|
2404
|
+
"block",
|
|
2405
|
+
"transactions",
|
|
2406
|
+
KEYPATH_WILDCARD,
|
|
2407
|
+
"meta",
|
|
2408
|
+
"innerInstructions",
|
|
2409
|
+
KEYPATH_WILDCARD,
|
|
2410
|
+
"index"
|
|
2411
|
+
],
|
|
2412
|
+
[
|
|
2413
|
+
"value",
|
|
2414
|
+
"block",
|
|
2415
|
+
"transactions",
|
|
2416
|
+
KEYPATH_WILDCARD,
|
|
2417
|
+
"meta",
|
|
2418
|
+
"innerInstructions",
|
|
2419
|
+
KEYPATH_WILDCARD,
|
|
2420
|
+
"instructions",
|
|
2421
|
+
KEYPATH_WILDCARD,
|
|
2422
|
+
"programIdIndex"
|
|
2423
|
+
],
|
|
2424
|
+
[
|
|
2425
|
+
"value",
|
|
2426
|
+
"block",
|
|
2427
|
+
"transactions",
|
|
2428
|
+
KEYPATH_WILDCARD,
|
|
2429
|
+
"meta",
|
|
2430
|
+
"innerInstructions",
|
|
2431
|
+
KEYPATH_WILDCARD,
|
|
2432
|
+
"instructions",
|
|
2433
|
+
KEYPATH_WILDCARD,
|
|
2434
|
+
"accounts",
|
|
2435
|
+
KEYPATH_WILDCARD
|
|
2436
|
+
],
|
|
2437
|
+
[
|
|
2438
|
+
"value",
|
|
2439
|
+
"block",
|
|
2440
|
+
"transactions",
|
|
2441
|
+
KEYPATH_WILDCARD,
|
|
2442
|
+
"transaction",
|
|
2443
|
+
"message",
|
|
2444
|
+
"addressTableLookups",
|
|
2445
|
+
KEYPATH_WILDCARD,
|
|
2446
|
+
"writableIndexes",
|
|
2447
|
+
KEYPATH_WILDCARD
|
|
2448
|
+
],
|
|
2449
|
+
[
|
|
2450
|
+
"value",
|
|
2451
|
+
"block",
|
|
2452
|
+
"transactions",
|
|
2453
|
+
KEYPATH_WILDCARD,
|
|
2454
|
+
"transaction",
|
|
2455
|
+
"message",
|
|
2456
|
+
"addressTableLookups",
|
|
2457
|
+
KEYPATH_WILDCARD,
|
|
2458
|
+
"readonlyIndexes",
|
|
2459
|
+
KEYPATH_WILDCARD
|
|
2460
|
+
],
|
|
2461
|
+
[
|
|
2462
|
+
"value",
|
|
2463
|
+
"block",
|
|
2464
|
+
"transactions",
|
|
2465
|
+
KEYPATH_WILDCARD,
|
|
2466
|
+
"transaction",
|
|
2467
|
+
"message",
|
|
2468
|
+
"instructions",
|
|
2469
|
+
KEYPATH_WILDCARD,
|
|
2470
|
+
"programIdIndex"
|
|
2471
|
+
],
|
|
2472
|
+
[
|
|
2473
|
+
"value",
|
|
2474
|
+
"block",
|
|
2475
|
+
"transactions",
|
|
2476
|
+
KEYPATH_WILDCARD,
|
|
2477
|
+
"transaction",
|
|
2478
|
+
"message",
|
|
2479
|
+
"instructions",
|
|
2480
|
+
KEYPATH_WILDCARD,
|
|
2481
|
+
"accounts",
|
|
2482
|
+
KEYPATH_WILDCARD
|
|
2483
|
+
],
|
|
2484
|
+
[
|
|
2485
|
+
"value",
|
|
2486
|
+
"block",
|
|
2487
|
+
"transactions",
|
|
2488
|
+
KEYPATH_WILDCARD,
|
|
2489
|
+
"transaction",
|
|
2490
|
+
"message",
|
|
2491
|
+
"header",
|
|
2492
|
+
"numReadonlySignedAccounts"
|
|
2493
|
+
],
|
|
2494
|
+
[
|
|
2495
|
+
"value",
|
|
2496
|
+
"block",
|
|
2497
|
+
"transactions",
|
|
2498
|
+
KEYPATH_WILDCARD,
|
|
2499
|
+
"transaction",
|
|
2500
|
+
"message",
|
|
2501
|
+
"header",
|
|
2502
|
+
"numReadonlyUnsignedAccounts"
|
|
2503
|
+
],
|
|
2504
|
+
[
|
|
2505
|
+
"value",
|
|
2506
|
+
"block",
|
|
2507
|
+
"transactions",
|
|
2508
|
+
KEYPATH_WILDCARD,
|
|
2509
|
+
"transaction",
|
|
2510
|
+
"message",
|
|
2511
|
+
"header",
|
|
2512
|
+
"numRequiredSignatures"
|
|
2513
|
+
],
|
|
2514
|
+
["value", "block", "rewards", KEYPATH_WILDCARD, "commission"]
|
|
2515
|
+
],
|
|
2516
|
+
programNotifications: jsonParsedAccountsConfigs.flatMap((c) => [
|
|
2517
|
+
["value", KEYPATH_WILDCARD, "account", ...c],
|
|
2518
|
+
[KEYPATH_WILDCARD, "account", ...c]
|
|
2519
|
+
])
|
|
2520
|
+
};
|
|
2521
|
+
}
|
|
2522
|
+
return memoizedNotificationKeypaths;
|
|
2523
|
+
}
|
|
2524
|
+
function getAllowedNumericKeypathsForResponse() {
|
|
2525
|
+
if (!memoizedResponseKeypaths) {
|
|
2526
|
+
memoizedResponseKeypaths = {
|
|
2527
|
+
getAccountInfo: jsonParsedAccountsConfigs.map((c) => ["value", ...c]),
|
|
2528
|
+
getBlock: [
|
|
2529
|
+
["blockTime"],
|
|
2530
|
+
["transactions", KEYPATH_WILDCARD, "meta", "preTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
|
|
2531
|
+
[
|
|
2532
|
+
"transactions",
|
|
2533
|
+
KEYPATH_WILDCARD,
|
|
2534
|
+
"meta",
|
|
2535
|
+
"preTokenBalances",
|
|
2536
|
+
KEYPATH_WILDCARD,
|
|
2537
|
+
"uiTokenAmount",
|
|
2538
|
+
"decimals"
|
|
2539
|
+
],
|
|
2540
|
+
["transactions", KEYPATH_WILDCARD, "meta", "postTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
|
|
2541
|
+
[
|
|
2542
|
+
"transactions",
|
|
2543
|
+
KEYPATH_WILDCARD,
|
|
2544
|
+
"meta",
|
|
2545
|
+
"postTokenBalances",
|
|
2546
|
+
KEYPATH_WILDCARD,
|
|
2547
|
+
"uiTokenAmount",
|
|
2548
|
+
"decimals"
|
|
2549
|
+
],
|
|
2550
|
+
["transactions", KEYPATH_WILDCARD, "meta", "rewards", KEYPATH_WILDCARD, "commission"],
|
|
2551
|
+
["transactions", KEYPATH_WILDCARD, "meta", "innerInstructions", KEYPATH_WILDCARD, "index"],
|
|
2552
|
+
[
|
|
2553
|
+
"transactions",
|
|
2554
|
+
KEYPATH_WILDCARD,
|
|
2555
|
+
"meta",
|
|
2556
|
+
"innerInstructions",
|
|
2557
|
+
KEYPATH_WILDCARD,
|
|
2558
|
+
"instructions",
|
|
2559
|
+
KEYPATH_WILDCARD,
|
|
2560
|
+
"programIdIndex"
|
|
2561
|
+
],
|
|
2562
|
+
[
|
|
2563
|
+
"transactions",
|
|
2564
|
+
KEYPATH_WILDCARD,
|
|
2565
|
+
"meta",
|
|
2566
|
+
"innerInstructions",
|
|
2567
|
+
KEYPATH_WILDCARD,
|
|
2568
|
+
"instructions",
|
|
2569
|
+
KEYPATH_WILDCARD,
|
|
2570
|
+
"accounts",
|
|
2571
|
+
KEYPATH_WILDCARD
|
|
2572
|
+
],
|
|
2573
|
+
[
|
|
2574
|
+
"transactions",
|
|
2575
|
+
KEYPATH_WILDCARD,
|
|
2576
|
+
"transaction",
|
|
2577
|
+
"message",
|
|
2578
|
+
"addressTableLookups",
|
|
2579
|
+
KEYPATH_WILDCARD,
|
|
2580
|
+
"writableIndexes",
|
|
2581
|
+
KEYPATH_WILDCARD
|
|
2582
|
+
],
|
|
2583
|
+
[
|
|
2584
|
+
"transactions",
|
|
2585
|
+
KEYPATH_WILDCARD,
|
|
2586
|
+
"transaction",
|
|
2587
|
+
"message",
|
|
2588
|
+
"addressTableLookups",
|
|
2589
|
+
KEYPATH_WILDCARD,
|
|
2590
|
+
"readonlyIndexes",
|
|
2591
|
+
KEYPATH_WILDCARD
|
|
2592
|
+
],
|
|
2593
|
+
[
|
|
2594
|
+
"transactions",
|
|
2595
|
+
KEYPATH_WILDCARD,
|
|
2596
|
+
"transaction",
|
|
2597
|
+
"message",
|
|
2598
|
+
"instructions",
|
|
2599
|
+
KEYPATH_WILDCARD,
|
|
2600
|
+
"programIdIndex"
|
|
2601
|
+
],
|
|
2602
|
+
[
|
|
2603
|
+
"transactions",
|
|
2604
|
+
KEYPATH_WILDCARD,
|
|
2605
|
+
"transaction",
|
|
2606
|
+
"message",
|
|
2607
|
+
"instructions",
|
|
2608
|
+
KEYPATH_WILDCARD,
|
|
2609
|
+
"accounts",
|
|
2610
|
+
KEYPATH_WILDCARD
|
|
2611
|
+
],
|
|
2612
|
+
["transactions", KEYPATH_WILDCARD, "transaction", "message", "header", "numReadonlySignedAccounts"],
|
|
2613
|
+
["transactions", KEYPATH_WILDCARD, "transaction", "message", "header", "numReadonlyUnsignedAccounts"],
|
|
2614
|
+
["transactions", KEYPATH_WILDCARD, "transaction", "message", "header", "numRequiredSignatures"],
|
|
2615
|
+
["rewards", KEYPATH_WILDCARD, "commission"]
|
|
2616
|
+
],
|
|
2617
|
+
getBlockTime: [[]],
|
|
2618
|
+
getClusterNodes: [
|
|
2619
|
+
[KEYPATH_WILDCARD, "featureSet"],
|
|
2620
|
+
[KEYPATH_WILDCARD, "shredVersion"]
|
|
2621
|
+
],
|
|
2622
|
+
getInflationGovernor: [["initial"], ["foundation"], ["foundationTerm"], ["taper"], ["terminal"]],
|
|
2623
|
+
getInflationRate: [["foundation"], ["total"], ["validator"]],
|
|
2624
|
+
getInflationReward: [[KEYPATH_WILDCARD, "commission"]],
|
|
2625
|
+
getMultipleAccounts: jsonParsedAccountsConfigs.map((c) => ["value", KEYPATH_WILDCARD, ...c]),
|
|
2626
|
+
getProgramAccounts: jsonParsedAccountsConfigs.flatMap((c) => [
|
|
2627
|
+
["value", KEYPATH_WILDCARD, "account", ...c],
|
|
2628
|
+
[KEYPATH_WILDCARD, "account", ...c]
|
|
2629
|
+
]),
|
|
2630
|
+
getRecentPerformanceSamples: [[KEYPATH_WILDCARD, "samplePeriodSecs"]],
|
|
2631
|
+
getTokenAccountBalance: [
|
|
2632
|
+
["value", "decimals"],
|
|
2633
|
+
["value", "uiAmount"]
|
|
2634
|
+
],
|
|
2635
|
+
getTokenAccountsByDelegate: jsonParsedTokenAccountsConfigs.map((c) => [
|
|
2636
|
+
"value",
|
|
2637
|
+
KEYPATH_WILDCARD,
|
|
2638
|
+
"account",
|
|
2639
|
+
...c
|
|
2640
|
+
]),
|
|
2641
|
+
getTokenAccountsByOwner: jsonParsedTokenAccountsConfigs.map((c) => [
|
|
2642
|
+
"value",
|
|
2643
|
+
KEYPATH_WILDCARD,
|
|
2644
|
+
"account",
|
|
2645
|
+
...c
|
|
2646
|
+
]),
|
|
2647
|
+
getTokenLargestAccounts: [
|
|
2648
|
+
["value", KEYPATH_WILDCARD, "decimals"],
|
|
2649
|
+
["value", KEYPATH_WILDCARD, "uiAmount"]
|
|
2650
|
+
],
|
|
2651
|
+
getTokenSupply: [
|
|
2652
|
+
["value", "decimals"],
|
|
2653
|
+
["value", "uiAmount"]
|
|
2654
|
+
],
|
|
2655
|
+
getTransaction: [
|
|
2656
|
+
["meta", "preTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
|
|
2657
|
+
["meta", "preTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"],
|
|
2658
|
+
["meta", "postTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
|
|
2659
|
+
["meta", "postTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"],
|
|
2660
|
+
["meta", "rewards", KEYPATH_WILDCARD, "commission"],
|
|
2661
|
+
["meta", "innerInstructions", KEYPATH_WILDCARD, "index"],
|
|
2662
|
+
["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "programIdIndex"],
|
|
2663
|
+
[
|
|
2664
|
+
"meta",
|
|
2665
|
+
"innerInstructions",
|
|
2666
|
+
KEYPATH_WILDCARD,
|
|
2667
|
+
"instructions",
|
|
2668
|
+
KEYPATH_WILDCARD,
|
|
2669
|
+
"accounts",
|
|
2670
|
+
KEYPATH_WILDCARD
|
|
2671
|
+
],
|
|
2672
|
+
[
|
|
2673
|
+
"transaction",
|
|
2674
|
+
"message",
|
|
2675
|
+
"addressTableLookups",
|
|
2676
|
+
KEYPATH_WILDCARD,
|
|
2677
|
+
"writableIndexes",
|
|
2678
|
+
KEYPATH_WILDCARD
|
|
2679
|
+
],
|
|
2680
|
+
[
|
|
2681
|
+
"transaction",
|
|
2682
|
+
"message",
|
|
2683
|
+
"addressTableLookups",
|
|
2684
|
+
KEYPATH_WILDCARD,
|
|
2685
|
+
"readonlyIndexes",
|
|
2686
|
+
KEYPATH_WILDCARD
|
|
2687
|
+
],
|
|
2688
|
+
["transaction", "message", "instructions", KEYPATH_WILDCARD, "programIdIndex"],
|
|
2689
|
+
["transaction", "message", "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD],
|
|
2690
|
+
["transaction", "message", "header", "numReadonlySignedAccounts"],
|
|
2691
|
+
["transaction", "message", "header", "numReadonlyUnsignedAccounts"],
|
|
2692
|
+
["transaction", "message", "header", "numRequiredSignatures"]
|
|
2693
|
+
],
|
|
2694
|
+
getVersion: [["feature-set"]],
|
|
2695
|
+
getVoteAccounts: [
|
|
2696
|
+
["current", KEYPATH_WILDCARD, "commission"],
|
|
2697
|
+
["delinquent", KEYPATH_WILDCARD, "commission"]
|
|
2698
|
+
],
|
|
2699
|
+
simulateTransaction: jsonParsedAccountsConfigs.map((c) => ["value", "accounts", KEYPATH_WILDCARD, ...c])
|
|
2700
|
+
};
|
|
2701
|
+
}
|
|
2702
|
+
return memoizedResponseKeypaths;
|
|
2703
|
+
}
|
|
1645
2704
|
function getNextAllowedKeypaths(keyPaths, property) {
|
|
1646
2705
|
return keyPaths.filter((keyPath) => keyPath[0] === KEYPATH_WILDCARD && typeof property === "number" || keyPath[0] === property).map((keyPath) => keyPath.slice(1));
|
|
1647
2706
|
}
|
|
@@ -1668,7 +2727,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1668
2727
|
}
|
|
1669
2728
|
}
|
|
1670
2729
|
function patchResponseForSolanaLabsRpc(rawResponse, methodName) {
|
|
1671
|
-
const allowedKeypaths = methodName ?
|
|
2730
|
+
const allowedKeypaths = methodName ? getAllowedNumericKeypathsForResponse()[methodName] : void 0;
|
|
2731
|
+
return visitNode2(rawResponse, allowedKeypaths ?? []);
|
|
2732
|
+
}
|
|
2733
|
+
function patchResponseForSolanaLabsRpcSubscriptions(rawResponse, methodName) {
|
|
2734
|
+
const allowedKeypaths = methodName ? getAllowedNumericKeypathsForNotification()[methodName] : void 0;
|
|
1672
2735
|
return visitNode2(rawResponse, allowedKeypaths ?? []);
|
|
1673
2736
|
}
|
|
1674
2737
|
function createSolanaRpcApi(config) {
|
|
@@ -1697,6 +2760,36 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1697
2760
|
}
|
|
1698
2761
|
});
|
|
1699
2762
|
}
|
|
2763
|
+
function createSolanaRpcSubscriptionsApi(config) {
|
|
2764
|
+
return new Proxy({}, {
|
|
2765
|
+
defineProperty() {
|
|
2766
|
+
return false;
|
|
2767
|
+
},
|
|
2768
|
+
deleteProperty() {
|
|
2769
|
+
return false;
|
|
2770
|
+
},
|
|
2771
|
+
get(...args) {
|
|
2772
|
+
const [_, p] = args;
|
|
2773
|
+
const notificationName = p.toString();
|
|
2774
|
+
return function(...rawParams) {
|
|
2775
|
+
const handleIntegerOverflow = config?.onIntegerOverflow;
|
|
2776
|
+
const params = patchParamsForSolanaLabsRpc(
|
|
2777
|
+
rawParams,
|
|
2778
|
+
handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(notificationName, keyPath, value) : void 0
|
|
2779
|
+
);
|
|
2780
|
+
return {
|
|
2781
|
+
params,
|
|
2782
|
+
responseProcessor: (rawResponse) => patchResponseForSolanaLabsRpcSubscriptions(rawResponse, notificationName),
|
|
2783
|
+
subscribeMethodName: notificationName.replace(/Notifications$/, "Subscribe"),
|
|
2784
|
+
unsubscribeMethodName: notificationName.replace(/Notifications$/, "Unsubscribe")
|
|
2785
|
+
};
|
|
2786
|
+
};
|
|
2787
|
+
}
|
|
2788
|
+
});
|
|
2789
|
+
}
|
|
2790
|
+
function createSolanaRpcSubscriptionsApi_UNSTABLE(config) {
|
|
2791
|
+
return createSolanaRpcSubscriptionsApi(config);
|
|
2792
|
+
}
|
|
1700
2793
|
|
|
1701
2794
|
// ../rpc-transport/dist/index.browser.js
|
|
1702
2795
|
init_env_shim();
|
|
@@ -1763,7 +2856,101 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1763
2856
|
function createJsonRpc(rpcConfig) {
|
|
1764
2857
|
return makeProxy(rpcConfig);
|
|
1765
2858
|
}
|
|
1766
|
-
|
|
2859
|
+
function registerIterableCleanup(iterable, cleanupFn) {
|
|
2860
|
+
(async () => {
|
|
2861
|
+
try {
|
|
2862
|
+
for await (const _ of iterable)
|
|
2863
|
+
;
|
|
2864
|
+
} catch {
|
|
2865
|
+
} finally {
|
|
2866
|
+
cleanupFn();
|
|
2867
|
+
}
|
|
2868
|
+
})();
|
|
2869
|
+
}
|
|
2870
|
+
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName, responseProcessor }) {
|
|
2871
|
+
return {
|
|
2872
|
+
async subscribe({ abortSignal }) {
|
|
2873
|
+
abortSignal.throwIfAborted();
|
|
2874
|
+
let subscriptionId;
|
|
2875
|
+
function handleCleanup() {
|
|
2876
|
+
if (subscriptionId !== void 0) {
|
|
2877
|
+
const payload = createJsonRpcMessage(unsubscribeMethodName, [subscriptionId]);
|
|
2878
|
+
connection.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(payload).finally(() => {
|
|
2879
|
+
connectionAbortController.abort();
|
|
2880
|
+
});
|
|
2881
|
+
} else {
|
|
2882
|
+
connectionAbortController.abort();
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
abortSignal.addEventListener("abort", handleCleanup);
|
|
2886
|
+
const connectionAbortController = new AbortController();
|
|
2887
|
+
const subscribeMessage = createJsonRpcMessage(subscribeMethodName, params);
|
|
2888
|
+
const connection = await rpcConfig.transport({
|
|
2889
|
+
payload: subscribeMessage,
|
|
2890
|
+
signal: connectionAbortController.signal
|
|
2891
|
+
});
|
|
2892
|
+
function handleConnectionCleanup() {
|
|
2893
|
+
abortSignal.removeEventListener("abort", handleCleanup);
|
|
2894
|
+
}
|
|
2895
|
+
registerIterableCleanup(connection, handleConnectionCleanup);
|
|
2896
|
+
for await (const message of connection) {
|
|
2897
|
+
if ("id" in message && message.id === subscribeMessage.id) {
|
|
2898
|
+
if ("error" in message) {
|
|
2899
|
+
throw new SolanaJsonRpcError(message.error);
|
|
2900
|
+
} else {
|
|
2901
|
+
subscriptionId = message.result;
|
|
2902
|
+
break;
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2906
|
+
if (subscriptionId == null) {
|
|
2907
|
+
throw new Error("Failed to obtain a subscription id from the server");
|
|
2908
|
+
}
|
|
2909
|
+
return {
|
|
2910
|
+
async *[Symbol.asyncIterator]() {
|
|
2911
|
+
for await (const message of connection) {
|
|
2912
|
+
if (!("params" in message) || message.params.subscription !== subscriptionId) {
|
|
2913
|
+
continue;
|
|
2914
|
+
}
|
|
2915
|
+
const notification = message.params.result;
|
|
2916
|
+
yield responseProcessor ? responseProcessor(notification) : notification;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
};
|
|
2920
|
+
}
|
|
2921
|
+
};
|
|
2922
|
+
}
|
|
2923
|
+
function makeProxy2(rpcConfig) {
|
|
2924
|
+
return new Proxy(rpcConfig.api, {
|
|
2925
|
+
defineProperty() {
|
|
2926
|
+
return false;
|
|
2927
|
+
},
|
|
2928
|
+
deleteProperty() {
|
|
2929
|
+
return false;
|
|
2930
|
+
},
|
|
2931
|
+
get(target, p, receiver) {
|
|
2932
|
+
return function(...rawParams) {
|
|
2933
|
+
const methodName = p.toString();
|
|
2934
|
+
const createRpcSubscription = Reflect.get(target, methodName, receiver);
|
|
2935
|
+
if (p.toString().endsWith("Notifications") === false && !createRpcSubscription) {
|
|
2936
|
+
throw new Error(
|
|
2937
|
+
"Either the notification name must end in 'Notifications' or the API must supply a subscription creator function to map between the notification name and the subscribe/unsubscribe method names."
|
|
2938
|
+
);
|
|
2939
|
+
}
|
|
2940
|
+
const newRequest = createRpcSubscription ? createRpcSubscription(...rawParams) : {
|
|
2941
|
+
params: rawParams,
|
|
2942
|
+
subscribeMethodName: methodName.replace(/Notifications$/, "Subscribe"),
|
|
2943
|
+
unsubscribeMethodName: methodName.replace(/Notifications$/, "Unsubscribe")
|
|
2944
|
+
};
|
|
2945
|
+
return createPendingRpcSubscription(rpcConfig, newRequest);
|
|
2946
|
+
};
|
|
2947
|
+
}
|
|
2948
|
+
});
|
|
2949
|
+
}
|
|
2950
|
+
function createJsonSubscriptionRpc(rpcConfig) {
|
|
2951
|
+
return makeProxy2(rpcConfig);
|
|
2952
|
+
}
|
|
2953
|
+
var e2 = globalThis.fetch;
|
|
1767
2954
|
var SolanaHttpError = class extends Error {
|
|
1768
2955
|
constructor(details) {
|
|
1769
2956
|
super(`HTTP error (${details.statusCode}): ${details.message}`);
|
|
@@ -1851,7 +3038,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1851
3038
|
method: "POST",
|
|
1852
3039
|
signal
|
|
1853
3040
|
};
|
|
1854
|
-
const response = await
|
|
3041
|
+
const response = await e2(url, requestInfo);
|
|
1855
3042
|
if (!response.ok) {
|
|
1856
3043
|
throw new SolanaHttpError({
|
|
1857
3044
|
message: response.statusText,
|
|
@@ -1861,6 +3048,175 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1861
3048
|
return await response.json();
|
|
1862
3049
|
};
|
|
1863
3050
|
}
|
|
3051
|
+
var e22 = globalThis.WebSocket;
|
|
3052
|
+
var EXPLICIT_ABORT_TOKEN = Symbol(
|
|
3053
|
+
"This symbol is thrown from a socket's iterator when the connection is explicity aborted by the user"
|
|
3054
|
+
);
|
|
3055
|
+
async function createWebSocketConnection({
|
|
3056
|
+
sendBufferHighWatermark,
|
|
3057
|
+
signal,
|
|
3058
|
+
url
|
|
3059
|
+
}) {
|
|
3060
|
+
return new Promise((resolve, reject) => {
|
|
3061
|
+
signal.addEventListener("abort", handleAbort, { once: true });
|
|
3062
|
+
const iteratorState = /* @__PURE__ */ new Map();
|
|
3063
|
+
function errorAndClearAllIteratorStates(reason) {
|
|
3064
|
+
const errorCallbacks = [...iteratorState.values()].filter((state) => state.__hasPolled).map(({ onError }) => onError);
|
|
3065
|
+
iteratorState.clear();
|
|
3066
|
+
errorCallbacks.forEach((cb) => {
|
|
3067
|
+
try {
|
|
3068
|
+
cb(reason);
|
|
3069
|
+
} catch {
|
|
3070
|
+
}
|
|
3071
|
+
});
|
|
3072
|
+
}
|
|
3073
|
+
function handleAbort() {
|
|
3074
|
+
errorAndClearAllIteratorStates(EXPLICIT_ABORT_TOKEN);
|
|
3075
|
+
if (webSocket.readyState !== e22.CLOSED && webSocket.readyState !== e22.CLOSING) {
|
|
3076
|
+
webSocket.close(1e3);
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
function handleClose(ev) {
|
|
3080
|
+
bufferDrainWatcher?.onCancel();
|
|
3081
|
+
signal.removeEventListener("abort", handleAbort);
|
|
3082
|
+
webSocket.removeEventListener("close", handleClose);
|
|
3083
|
+
webSocket.removeEventListener("error", handleError);
|
|
3084
|
+
webSocket.removeEventListener("open", handleOpen);
|
|
3085
|
+
webSocket.removeEventListener("message", handleMessage);
|
|
3086
|
+
errorAndClearAllIteratorStates(ev);
|
|
3087
|
+
}
|
|
3088
|
+
function handleError(ev) {
|
|
3089
|
+
if (!hasConnected) {
|
|
3090
|
+
reject(
|
|
3091
|
+
// TODO: Coded error
|
|
3092
|
+
new Error("WebSocket failed to connect", { cause: ev })
|
|
3093
|
+
);
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
let hasConnected = false;
|
|
3097
|
+
let bufferDrainWatcher;
|
|
3098
|
+
function handleOpen() {
|
|
3099
|
+
hasConnected = true;
|
|
3100
|
+
resolve({
|
|
3101
|
+
async send(payload) {
|
|
3102
|
+
const message = JSON.stringify(payload);
|
|
3103
|
+
if (!bufferDrainWatcher && webSocket.readyState === e22.OPEN && webSocket.bufferedAmount > sendBufferHighWatermark) {
|
|
3104
|
+
let onCancel;
|
|
3105
|
+
const promise = new Promise((resolve2, reject2) => {
|
|
3106
|
+
const intervalId = setInterval(() => {
|
|
3107
|
+
if (webSocket.readyState !== e22.OPEN || !(webSocket.bufferedAmount > sendBufferHighWatermark)) {
|
|
3108
|
+
clearInterval(intervalId);
|
|
3109
|
+
bufferDrainWatcher = void 0;
|
|
3110
|
+
resolve2();
|
|
3111
|
+
}
|
|
3112
|
+
}, 16);
|
|
3113
|
+
onCancel = () => {
|
|
3114
|
+
bufferDrainWatcher = void 0;
|
|
3115
|
+
clearInterval(intervalId);
|
|
3116
|
+
reject2(
|
|
3117
|
+
// TODO: Coded error
|
|
3118
|
+
new Error("WebSocket was closed before payload could be sent")
|
|
3119
|
+
);
|
|
3120
|
+
};
|
|
3121
|
+
});
|
|
3122
|
+
bufferDrainWatcher = {
|
|
3123
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3124
|
+
// @ts-ignore
|
|
3125
|
+
onCancel,
|
|
3126
|
+
promise
|
|
3127
|
+
};
|
|
3128
|
+
}
|
|
3129
|
+
if (bufferDrainWatcher) {
|
|
3130
|
+
await bufferDrainWatcher.promise;
|
|
3131
|
+
}
|
|
3132
|
+
webSocket.send(message);
|
|
3133
|
+
},
|
|
3134
|
+
async *[Symbol.asyncIterator]() {
|
|
3135
|
+
const iteratorKey = Symbol();
|
|
3136
|
+
iteratorState.set(iteratorKey, { __hasPolled: false, queuedMessages: [] });
|
|
3137
|
+
try {
|
|
3138
|
+
while (true) {
|
|
3139
|
+
const state = iteratorState.get(iteratorKey);
|
|
3140
|
+
if (!state) {
|
|
3141
|
+
throw new Error("Invariant: WebSocket message iterator is missing state storage");
|
|
3142
|
+
}
|
|
3143
|
+
if (state.__hasPolled) {
|
|
3144
|
+
throw new Error(
|
|
3145
|
+
"Invariant: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise"
|
|
3146
|
+
);
|
|
3147
|
+
}
|
|
3148
|
+
const queuedMessages = state.queuedMessages;
|
|
3149
|
+
if (queuedMessages.length) {
|
|
3150
|
+
state.queuedMessages = [];
|
|
3151
|
+
yield* queuedMessages;
|
|
3152
|
+
} else {
|
|
3153
|
+
try {
|
|
3154
|
+
yield await new Promise((resolve2, reject2) => {
|
|
3155
|
+
iteratorState.set(iteratorKey, {
|
|
3156
|
+
__hasPolled: true,
|
|
3157
|
+
onError: reject2,
|
|
3158
|
+
onMessage: resolve2
|
|
3159
|
+
});
|
|
3160
|
+
});
|
|
3161
|
+
} catch (e3) {
|
|
3162
|
+
if (e3 === EXPLICIT_ABORT_TOKEN) {
|
|
3163
|
+
return;
|
|
3164
|
+
} else {
|
|
3165
|
+
throw new Error("WebSocket connection closed", { cause: e3 });
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
} finally {
|
|
3171
|
+
iteratorState.delete(iteratorKey);
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
});
|
|
3175
|
+
}
|
|
3176
|
+
function handleMessage({ data }) {
|
|
3177
|
+
const message = JSON.parse(data);
|
|
3178
|
+
iteratorState.forEach((state, iteratorKey) => {
|
|
3179
|
+
if (state.__hasPolled) {
|
|
3180
|
+
const { onMessage } = state;
|
|
3181
|
+
iteratorState.set(iteratorKey, { __hasPolled: false, queuedMessages: [] });
|
|
3182
|
+
onMessage(message);
|
|
3183
|
+
} else {
|
|
3184
|
+
state.queuedMessages.push(message);
|
|
3185
|
+
}
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3188
|
+
const webSocket = new e22(url);
|
|
3189
|
+
webSocket.addEventListener("close", handleClose);
|
|
3190
|
+
webSocket.addEventListener("error", handleError);
|
|
3191
|
+
webSocket.addEventListener("open", handleOpen);
|
|
3192
|
+
webSocket.addEventListener("message", handleMessage);
|
|
3193
|
+
});
|
|
3194
|
+
}
|
|
3195
|
+
function createWebSocketTransport({ sendBufferHighWatermark, url }) {
|
|
3196
|
+
if (/^wss?:/i.test(url) === false) {
|
|
3197
|
+
const protocolMatch = url.match(/^([^:]+):/);
|
|
3198
|
+
throw new DOMException(
|
|
3199
|
+
protocolMatch ? `Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. '${protocolMatch[1]}:' is not allowed.` : `Failed to construct 'WebSocket': The URL '${url}' is invalid.`
|
|
3200
|
+
);
|
|
3201
|
+
}
|
|
3202
|
+
return async function sendWebSocketMessage({ payload, signal }) {
|
|
3203
|
+
signal?.throwIfAborted();
|
|
3204
|
+
const connection = await createWebSocketConnection({
|
|
3205
|
+
sendBufferHighWatermark,
|
|
3206
|
+
signal,
|
|
3207
|
+
url
|
|
3208
|
+
});
|
|
3209
|
+
signal?.throwIfAborted();
|
|
3210
|
+
await connection.send(payload);
|
|
3211
|
+
return {
|
|
3212
|
+
[Symbol.asyncIterator]: connection[Symbol.asyncIterator].bind(connection),
|
|
3213
|
+
send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: connection.send.bind(connection)
|
|
3214
|
+
};
|
|
3215
|
+
};
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3218
|
+
// src/rpc.ts
|
|
3219
|
+
var import_fast_stable_stringify = __toESM(require_fast_stable_stringify(), 1);
|
|
1864
3220
|
|
|
1865
3221
|
// src/rpc-default-config.ts
|
|
1866
3222
|
init_env_shim();
|
|
@@ -1902,6 +3258,197 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1902
3258
|
}
|
|
1903
3259
|
};
|
|
1904
3260
|
|
|
3261
|
+
// src/rpc-subscription-coalescer.ts
|
|
3262
|
+
init_env_shim();
|
|
3263
|
+
|
|
3264
|
+
// src/cached-abortable-iterable.ts
|
|
3265
|
+
init_env_shim();
|
|
3266
|
+
function registerIterableCleanup2(iterable, cleanupFn) {
|
|
3267
|
+
(async () => {
|
|
3268
|
+
try {
|
|
3269
|
+
for await (const _ of iterable)
|
|
3270
|
+
;
|
|
3271
|
+
} catch {
|
|
3272
|
+
} finally {
|
|
3273
|
+
cleanupFn();
|
|
3274
|
+
}
|
|
3275
|
+
})();
|
|
3276
|
+
}
|
|
3277
|
+
function getCachedAbortableIterableFactory({
|
|
3278
|
+
getAbortSignalFromInputArgs,
|
|
3279
|
+
getCacheEntryMissingError,
|
|
3280
|
+
getCacheKeyFromInputArgs,
|
|
3281
|
+
onCacheHit,
|
|
3282
|
+
onCreateIterable
|
|
3283
|
+
}) {
|
|
3284
|
+
const cache = /* @__PURE__ */ new Map();
|
|
3285
|
+
function getCacheEntryOrThrow(cacheKey) {
|
|
3286
|
+
const currentCacheEntry = cache.get(cacheKey);
|
|
3287
|
+
if (!currentCacheEntry) {
|
|
3288
|
+
throw getCacheEntryMissingError(cacheKey);
|
|
3289
|
+
}
|
|
3290
|
+
return currentCacheEntry;
|
|
3291
|
+
}
|
|
3292
|
+
return async (...args) => {
|
|
3293
|
+
const cacheKey = getCacheKeyFromInputArgs(...args);
|
|
3294
|
+
const signal = getAbortSignalFromInputArgs(...args);
|
|
3295
|
+
if (cacheKey === void 0) {
|
|
3296
|
+
return await onCreateIterable(signal, ...args);
|
|
3297
|
+
}
|
|
3298
|
+
const cleanup = () => {
|
|
3299
|
+
cache.delete(cacheKey);
|
|
3300
|
+
signal.removeEventListener("abort", handleAbort);
|
|
3301
|
+
};
|
|
3302
|
+
const handleAbort = () => {
|
|
3303
|
+
const cacheEntry = getCacheEntryOrThrow(cacheKey);
|
|
3304
|
+
if (cacheEntry.purgeScheduled !== true) {
|
|
3305
|
+
cacheEntry.purgeScheduled = true;
|
|
3306
|
+
globalThis.queueMicrotask(() => {
|
|
3307
|
+
cacheEntry.purgeScheduled = false;
|
|
3308
|
+
if (cacheEntry.referenceCount === 0) {
|
|
3309
|
+
cacheEntry.abortController.abort();
|
|
3310
|
+
cleanup();
|
|
3311
|
+
}
|
|
3312
|
+
});
|
|
3313
|
+
}
|
|
3314
|
+
cacheEntry.referenceCount--;
|
|
3315
|
+
};
|
|
3316
|
+
signal.addEventListener("abort", handleAbort);
|
|
3317
|
+
try {
|
|
3318
|
+
const cacheEntry = cache.get(cacheKey);
|
|
3319
|
+
if (!cacheEntry) {
|
|
3320
|
+
const singletonAbortController = new AbortController();
|
|
3321
|
+
const newIterablePromise = onCreateIterable(singletonAbortController.signal, ...args);
|
|
3322
|
+
const newCacheEntry = {
|
|
3323
|
+
abortController: singletonAbortController,
|
|
3324
|
+
iterable: newIterablePromise,
|
|
3325
|
+
purgeScheduled: false,
|
|
3326
|
+
referenceCount: 1
|
|
3327
|
+
};
|
|
3328
|
+
cache.set(cacheKey, newCacheEntry);
|
|
3329
|
+
const newIterable = await newIterablePromise;
|
|
3330
|
+
registerIterableCleanup2(newIterable, cleanup);
|
|
3331
|
+
newCacheEntry.iterable = newIterable;
|
|
3332
|
+
return newIterable;
|
|
3333
|
+
} else {
|
|
3334
|
+
cacheEntry.referenceCount++;
|
|
3335
|
+
const iterableOrIterablePromise = cacheEntry.iterable;
|
|
3336
|
+
const cachedIterable = "then" in iterableOrIterablePromise ? await iterableOrIterablePromise : iterableOrIterablePromise;
|
|
3337
|
+
await onCacheHit(cachedIterable, ...args);
|
|
3338
|
+
return cachedIterable;
|
|
3339
|
+
}
|
|
3340
|
+
} catch (e3) {
|
|
3341
|
+
cleanup();
|
|
3342
|
+
throw e3;
|
|
3343
|
+
}
|
|
3344
|
+
};
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
// src/rpc-subscription-coalescer.ts
|
|
3348
|
+
var EXPLICIT_ABORT_TOKEN2 = Symbol(
|
|
3349
|
+
"This symbol is thrown from a subscription's iterator when the subscription is explicitly aborted by the user"
|
|
3350
|
+
);
|
|
3351
|
+
function registerIterableCleanup3(iterable, cleanupFn) {
|
|
3352
|
+
(async () => {
|
|
3353
|
+
try {
|
|
3354
|
+
for await (const _ of iterable)
|
|
3355
|
+
;
|
|
3356
|
+
} catch {
|
|
3357
|
+
} finally {
|
|
3358
|
+
cleanupFn();
|
|
3359
|
+
}
|
|
3360
|
+
})();
|
|
3361
|
+
}
|
|
3362
|
+
function getRpcSubscriptionsWithSubscriptionCoalescing({
|
|
3363
|
+
getDeduplicationKey,
|
|
3364
|
+
rpcSubscriptions
|
|
3365
|
+
}) {
|
|
3366
|
+
const cache = /* @__PURE__ */ new Map();
|
|
3367
|
+
return new Proxy(rpcSubscriptions, {
|
|
3368
|
+
defineProperty() {
|
|
3369
|
+
return false;
|
|
3370
|
+
},
|
|
3371
|
+
deleteProperty() {
|
|
3372
|
+
return false;
|
|
3373
|
+
},
|
|
3374
|
+
get(target, p, receiver) {
|
|
3375
|
+
const subscriptionMethod = Reflect.get(target, p, receiver);
|
|
3376
|
+
if (typeof subscriptionMethod !== "function") {
|
|
3377
|
+
return subscriptionMethod;
|
|
3378
|
+
}
|
|
3379
|
+
return function(...rawParams) {
|
|
3380
|
+
const deduplicationKey = getDeduplicationKey(p, rawParams);
|
|
3381
|
+
if (deduplicationKey === void 0) {
|
|
3382
|
+
return subscriptionMethod(...rawParams);
|
|
3383
|
+
}
|
|
3384
|
+
if (cache.has(deduplicationKey)) {
|
|
3385
|
+
return cache.get(deduplicationKey);
|
|
3386
|
+
}
|
|
3387
|
+
const iterableFactory = getCachedAbortableIterableFactory({
|
|
3388
|
+
getAbortSignalFromInputArgs: ({ abortSignal }) => abortSignal,
|
|
3389
|
+
getCacheEntryMissingError(deduplicationKey2) {
|
|
3390
|
+
return new Error(
|
|
3391
|
+
`Found no cache entry for subscription with deduplication key \`${deduplicationKey2?.toString()}\``
|
|
3392
|
+
);
|
|
3393
|
+
},
|
|
3394
|
+
getCacheKeyFromInputArgs: () => deduplicationKey,
|
|
3395
|
+
async onCacheHit(_iterable, _config) {
|
|
3396
|
+
},
|
|
3397
|
+
async onCreateIterable(abortSignal, config) {
|
|
3398
|
+
const pendingSubscription2 = subscriptionMethod(
|
|
3399
|
+
...rawParams
|
|
3400
|
+
);
|
|
3401
|
+
const iterable = await pendingSubscription2.subscribe({
|
|
3402
|
+
...config,
|
|
3403
|
+
abortSignal
|
|
3404
|
+
});
|
|
3405
|
+
registerIterableCleanup3(iterable, () => {
|
|
3406
|
+
cache.delete(deduplicationKey);
|
|
3407
|
+
});
|
|
3408
|
+
return iterable;
|
|
3409
|
+
}
|
|
3410
|
+
});
|
|
3411
|
+
const pendingSubscription = {
|
|
3412
|
+
async subscribe(...args) {
|
|
3413
|
+
const iterable = await iterableFactory(...args);
|
|
3414
|
+
const { abortSignal } = args[0];
|
|
3415
|
+
let abortPromise;
|
|
3416
|
+
return {
|
|
3417
|
+
...iterable,
|
|
3418
|
+
async *[Symbol.asyncIterator]() {
|
|
3419
|
+
abortPromise || (abortPromise = abortSignal.aborted ? Promise.reject(EXPLICIT_ABORT_TOKEN2) : new Promise((_, reject) => {
|
|
3420
|
+
abortSignal.addEventListener("abort", () => {
|
|
3421
|
+
reject(EXPLICIT_ABORT_TOKEN2);
|
|
3422
|
+
});
|
|
3423
|
+
}));
|
|
3424
|
+
try {
|
|
3425
|
+
const iterator = iterable[Symbol.asyncIterator]();
|
|
3426
|
+
while (true) {
|
|
3427
|
+
const iteratorResult = await Promise.race([iterator.next(), abortPromise]);
|
|
3428
|
+
if (iteratorResult.done) {
|
|
3429
|
+
return;
|
|
3430
|
+
} else {
|
|
3431
|
+
yield iteratorResult.value;
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
} catch (e3) {
|
|
3435
|
+
if (e3 === EXPLICIT_ABORT_TOKEN2) {
|
|
3436
|
+
return;
|
|
3437
|
+
}
|
|
3438
|
+
cache.delete(deduplicationKey);
|
|
3439
|
+
throw e3;
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
};
|
|
3443
|
+
}
|
|
3444
|
+
};
|
|
3445
|
+
cache.set(deduplicationKey, pendingSubscription);
|
|
3446
|
+
return pendingSubscription;
|
|
3447
|
+
};
|
|
3448
|
+
}
|
|
3449
|
+
});
|
|
3450
|
+
}
|
|
3451
|
+
|
|
1905
3452
|
// src/rpc.ts
|
|
1906
3453
|
function createSolanaRpc(config) {
|
|
1907
3454
|
return createJsonRpc({
|
|
@@ -1909,6 +3456,24 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1909
3456
|
api: createSolanaRpcApi(DEFAULT_RPC_CONFIG)
|
|
1910
3457
|
});
|
|
1911
3458
|
}
|
|
3459
|
+
function createSolanaRpcSubscriptions(config) {
|
|
3460
|
+
return pipe(
|
|
3461
|
+
createJsonSubscriptionRpc({
|
|
3462
|
+
...config,
|
|
3463
|
+
api: createSolanaRpcSubscriptionsApi(DEFAULT_RPC_CONFIG)
|
|
3464
|
+
}),
|
|
3465
|
+
(rpcSubscriptions) => getRpcSubscriptionsWithSubscriptionCoalescing({
|
|
3466
|
+
getDeduplicationKey: (...args) => (0, import_fast_stable_stringify.default)(args),
|
|
3467
|
+
rpcSubscriptions
|
|
3468
|
+
})
|
|
3469
|
+
);
|
|
3470
|
+
}
|
|
3471
|
+
function createSolanaRpcSubscriptions_UNSTABLE(config) {
|
|
3472
|
+
return createJsonSubscriptionRpc({
|
|
3473
|
+
...config,
|
|
3474
|
+
api: createSolanaRpcSubscriptionsApi_UNSTABLE(DEFAULT_RPC_CONFIG)
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
1912
3477
|
|
|
1913
3478
|
// src/rpc-transport.ts
|
|
1914
3479
|
init_env_shim();
|
|
@@ -1945,14 +3510,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1945
3510
|
if (signal) {
|
|
1946
3511
|
const responsePromise = coalescedRequest.responsePromise;
|
|
1947
3512
|
return await new Promise((resolve, reject) => {
|
|
1948
|
-
const handleAbort = (
|
|
3513
|
+
const handleAbort = (e3) => {
|
|
1949
3514
|
signal.removeEventListener("abort", handleAbort);
|
|
1950
3515
|
coalescedRequest.numConsumers -= 1;
|
|
1951
3516
|
if (coalescedRequest.numConsumers === 0) {
|
|
1952
3517
|
const abortController = coalescedRequest.abortController;
|
|
1953
3518
|
abortController.abort();
|
|
1954
3519
|
}
|
|
1955
|
-
const abortError = new DOMException(
|
|
3520
|
+
const abortError = new DOMException(e3.target.reason, "AbortError");
|
|
1956
3521
|
reject(abortError);
|
|
1957
3522
|
};
|
|
1958
3523
|
signal.addEventListener("abort", handleAbort);
|
|
@@ -1968,14 +3533,15 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1968
3533
|
|
|
1969
3534
|
// src/rpc-request-deduplication.ts
|
|
1970
3535
|
init_env_shim();
|
|
1971
|
-
var
|
|
1972
|
-
function
|
|
3536
|
+
var import_fast_stable_stringify2 = __toESM(require_fast_stable_stringify(), 1);
|
|
3537
|
+
function isJsonRpcPayload(payload) {
|
|
1973
3538
|
if (payload == null || typeof payload !== "object" || Array.isArray(payload)) {
|
|
1974
|
-
return;
|
|
1975
|
-
}
|
|
1976
|
-
if ("jsonrpc" in payload && payload.jsonrpc === "2.0" && "method" in payload && "params" in payload) {
|
|
1977
|
-
return (0, import_fast_stable_stringify.default)([payload.method, payload.params]);
|
|
3539
|
+
return false;
|
|
1978
3540
|
}
|
|
3541
|
+
return "jsonrpc" in payload && payload.jsonrpc === "2.0" && "method" in payload && typeof payload.method === "string" && "params" in payload;
|
|
3542
|
+
}
|
|
3543
|
+
function getSolanaRpcPayloadDeduplicationKey(payload) {
|
|
3544
|
+
return isJsonRpcPayload(payload) ? (0, import_fast_stable_stringify2.default)([payload.method, payload.params]) : void 0;
|
|
1979
3545
|
}
|
|
1980
3546
|
|
|
1981
3547
|
// src/rpc-transport.ts
|
|
@@ -1987,7 +3553,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1987
3553
|
return out;
|
|
1988
3554
|
}
|
|
1989
3555
|
function createDefaultRpcTransport(config) {
|
|
1990
|
-
return
|
|
3556
|
+
return pipe(
|
|
1991
3557
|
createHttpTransport({
|
|
1992
3558
|
...config,
|
|
1993
3559
|
headers: {
|
|
@@ -1998,26 +3564,364 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1998
3564
|
}
|
|
1999
3565
|
}
|
|
2000
3566
|
}),
|
|
2001
|
-
getSolanaRpcPayloadDeduplicationKey
|
|
3567
|
+
(transport) => getRpcTransportWithRequestCoalescing(transport, getSolanaRpcPayloadDeduplicationKey)
|
|
3568
|
+
);
|
|
3569
|
+
}
|
|
3570
|
+
|
|
3571
|
+
// src/rpc-websocket-transport.ts
|
|
3572
|
+
init_env_shim();
|
|
3573
|
+
|
|
3574
|
+
// src/rpc-websocket-autopinger.ts
|
|
3575
|
+
init_env_shim();
|
|
3576
|
+
var PING_PAYLOAD = {
|
|
3577
|
+
jsonrpc: "2.0",
|
|
3578
|
+
method: "ping"
|
|
3579
|
+
};
|
|
3580
|
+
function getWebSocketTransportWithAutoping({ intervalMs, transport }) {
|
|
3581
|
+
const pingableConnections = /* @__PURE__ */ new Map();
|
|
3582
|
+
return async (...args) => {
|
|
3583
|
+
const connection = await transport(...args);
|
|
3584
|
+
let intervalId;
|
|
3585
|
+
function sendPing() {
|
|
3586
|
+
connection.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(PING_PAYLOAD);
|
|
3587
|
+
}
|
|
3588
|
+
function restartPingTimer() {
|
|
3589
|
+
clearInterval(intervalId);
|
|
3590
|
+
intervalId = setInterval(sendPing, intervalMs);
|
|
3591
|
+
}
|
|
3592
|
+
if (pingableConnections.has(connection) === false) {
|
|
3593
|
+
pingableConnections.set(connection, {
|
|
3594
|
+
[Symbol.asyncIterator]: connection[Symbol.asyncIterator].bind(connection),
|
|
3595
|
+
send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: (...args2) => {
|
|
3596
|
+
restartPingTimer();
|
|
3597
|
+
return connection.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(...args2);
|
|
3598
|
+
}
|
|
3599
|
+
});
|
|
3600
|
+
(async () => {
|
|
3601
|
+
try {
|
|
3602
|
+
for await (const _ of connection) {
|
|
3603
|
+
restartPingTimer();
|
|
3604
|
+
}
|
|
3605
|
+
} catch {
|
|
3606
|
+
} finally {
|
|
3607
|
+
pingableConnections.delete(connection);
|
|
3608
|
+
clearInterval(intervalId);
|
|
3609
|
+
if (handleOffline) {
|
|
3610
|
+
globalThis.window.removeEventListener("offline", handleOffline);
|
|
3611
|
+
}
|
|
3612
|
+
if (handleOnline) {
|
|
3613
|
+
globalThis.window.removeEventListener("online", handleOnline);
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
})();
|
|
3617
|
+
if (globalThis.navigator.onLine) {
|
|
3618
|
+
restartPingTimer();
|
|
3619
|
+
}
|
|
3620
|
+
let handleOffline;
|
|
3621
|
+
let handleOnline;
|
|
3622
|
+
{
|
|
3623
|
+
handleOffline = () => {
|
|
3624
|
+
clearInterval(intervalId);
|
|
3625
|
+
};
|
|
3626
|
+
handleOnline = () => {
|
|
3627
|
+
sendPing();
|
|
3628
|
+
restartPingTimer();
|
|
3629
|
+
};
|
|
3630
|
+
globalThis.window.addEventListener("offline", handleOffline);
|
|
3631
|
+
globalThis.window.addEventListener("online", handleOnline);
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
return pingableConnections.get(connection);
|
|
3635
|
+
};
|
|
3636
|
+
}
|
|
3637
|
+
|
|
3638
|
+
// src/rpc-websocket-connection-sharding.ts
|
|
3639
|
+
init_env_shim();
|
|
3640
|
+
var NULL_SHARD_CACHE_KEY = Symbol(
|
|
3641
|
+
"Cache key to use when there is no connection sharding strategy"
|
|
3642
|
+
);
|
|
3643
|
+
function getWebSocketTransportWithConnectionSharding({ getShard, transport }) {
|
|
3644
|
+
return getCachedAbortableIterableFactory({
|
|
3645
|
+
getAbortSignalFromInputArgs: ({ signal }) => signal,
|
|
3646
|
+
getCacheEntryMissingError(shardKey) {
|
|
3647
|
+
return new Error(`Found no cache entry for connection with shard key \`${shardKey?.toString()}\``);
|
|
3648
|
+
},
|
|
3649
|
+
getCacheKeyFromInputArgs: ({ payload }) => getShard ? getShard(payload) : NULL_SHARD_CACHE_KEY,
|
|
3650
|
+
onCacheHit: (connection, { payload }) => connection.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(payload),
|
|
3651
|
+
onCreateIterable: (abortSignal, config) => transport({
|
|
3652
|
+
...config,
|
|
3653
|
+
signal: abortSignal
|
|
3654
|
+
})
|
|
3655
|
+
});
|
|
3656
|
+
}
|
|
3657
|
+
|
|
3658
|
+
// src/rpc-websocket-transport.ts
|
|
3659
|
+
function createDefaultRpcSubscriptionsTransport(config) {
|
|
3660
|
+
const { getShard, intervalMs, ...rest } = config;
|
|
3661
|
+
return pipe(
|
|
3662
|
+
createWebSocketTransport({
|
|
3663
|
+
...rest,
|
|
3664
|
+
sendBufferHighWatermark: config.sendBufferHighWatermark ?? // Let 128KB of data into the WebSocket buffer before buffering it in the app.
|
|
3665
|
+
131072
|
|
3666
|
+
}),
|
|
3667
|
+
(transport) => getWebSocketTransportWithAutoping({
|
|
3668
|
+
intervalMs: intervalMs ?? 5e3,
|
|
3669
|
+
transport
|
|
3670
|
+
}),
|
|
3671
|
+
(transport) => getWebSocketTransportWithConnectionSharding({
|
|
3672
|
+
getShard,
|
|
3673
|
+
transport
|
|
3674
|
+
})
|
|
3675
|
+
);
|
|
3676
|
+
}
|
|
3677
|
+
|
|
3678
|
+
// src/transaction-confirmation.ts
|
|
3679
|
+
init_env_shim();
|
|
3680
|
+
|
|
3681
|
+
// src/transaction-confirmation-strategy-blockheight.ts
|
|
3682
|
+
init_env_shim();
|
|
3683
|
+
function createBlockHeightExceedencePromiseFactory(rpcSubscriptions) {
|
|
3684
|
+
return async function getBlockHeightExceedencePromise({ abortSignal: callerAbortSignal, lastValidBlockHeight }) {
|
|
3685
|
+
const abortController = new AbortController();
|
|
3686
|
+
function handleAbort() {
|
|
3687
|
+
abortController.abort();
|
|
3688
|
+
}
|
|
3689
|
+
callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
|
|
3690
|
+
const slotNotifications = await rpcSubscriptions.slotNotifications().subscribe({ abortSignal: abortController.signal });
|
|
3691
|
+
try {
|
|
3692
|
+
for await (const slotNotification of slotNotifications) {
|
|
3693
|
+
if (slotNotification.slot > lastValidBlockHeight) {
|
|
3694
|
+
throw new Error(
|
|
3695
|
+
"The network has progressed past the last block for which this transaction could have committed."
|
|
3696
|
+
);
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
} finally {
|
|
3700
|
+
abortController.abort();
|
|
3701
|
+
}
|
|
3702
|
+
};
|
|
3703
|
+
}
|
|
3704
|
+
|
|
3705
|
+
// src/transaction-confirmation-strategy-nonce.ts
|
|
3706
|
+
init_env_shim();
|
|
3707
|
+
var NONCE_VALUE_OFFSET = 4 + // version(u32)
|
|
3708
|
+
4 + // state(u32)
|
|
3709
|
+
32;
|
|
3710
|
+
function createNonceInvalidationPromiseFactory(rpc, rpcSubscriptions) {
|
|
3711
|
+
return async function getNonceInvalidationPromise({
|
|
3712
|
+
abortSignal: callerAbortSignal,
|
|
3713
|
+
commitment,
|
|
3714
|
+
currentNonceValue,
|
|
3715
|
+
nonceAccountAddress
|
|
3716
|
+
}) {
|
|
3717
|
+
const abortController = new AbortController();
|
|
3718
|
+
function handleAbort() {
|
|
3719
|
+
abortController.abort();
|
|
3720
|
+
}
|
|
3721
|
+
callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
|
|
3722
|
+
const accountNotifications = await rpcSubscriptions.accountNotifications(nonceAccountAddress, { commitment, encoding: "base64" }).subscribe({ abortSignal: abortController.signal });
|
|
3723
|
+
function getNonceFromAccountData([base64EncodedBytes]) {
|
|
3724
|
+
const data = base64.serialize(base64EncodedBytes);
|
|
3725
|
+
const nonceValueBytes = data.slice(NONCE_VALUE_OFFSET, NONCE_VALUE_OFFSET + 32);
|
|
3726
|
+
return base58.deserialize(nonceValueBytes)[0];
|
|
3727
|
+
}
|
|
3728
|
+
const nonceAccountDidAdvancePromise = (async () => {
|
|
3729
|
+
for await (const accountNotification of accountNotifications) {
|
|
3730
|
+
const nonceValue = getNonceFromAccountData(accountNotification.value.data);
|
|
3731
|
+
if (nonceValue !== currentNonceValue) {
|
|
3732
|
+
throw new Error(
|
|
3733
|
+
`The nonce \`${currentNonceValue}\` is no longer valid. It has advanced to \`${nonceValue}\`.`
|
|
3734
|
+
);
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
})();
|
|
3738
|
+
const nonceIsAlreadyInvalidPromise = (async () => {
|
|
3739
|
+
const { value: nonceAccount } = await rpc.getAccountInfo(nonceAccountAddress, {
|
|
3740
|
+
commitment,
|
|
3741
|
+
dataSlice: { length: 32, offset: NONCE_VALUE_OFFSET },
|
|
3742
|
+
encoding: "base58"
|
|
3743
|
+
}).send({ abortSignal: abortController.signal });
|
|
3744
|
+
if (!nonceAccount) {
|
|
3745
|
+
throw new Error(`No nonce account could be found at address \`${nonceAccountAddress}\`.`);
|
|
3746
|
+
}
|
|
3747
|
+
const nonceValue = (
|
|
3748
|
+
// This works because we asked for the exact slice of data representing the nonce
|
|
3749
|
+
// value, and furthermore asked for it in `base58` encoding.
|
|
3750
|
+
nonceAccount.data[0]
|
|
3751
|
+
);
|
|
3752
|
+
if (nonceValue !== currentNonceValue) {
|
|
3753
|
+
throw new Error(
|
|
3754
|
+
`The nonce \`${currentNonceValue}\` is no longer valid. It has advanced to \`${nonceValue}\`.`
|
|
3755
|
+
);
|
|
3756
|
+
} else {
|
|
3757
|
+
await new Promise(() => {
|
|
3758
|
+
});
|
|
3759
|
+
}
|
|
3760
|
+
})();
|
|
3761
|
+
try {
|
|
3762
|
+
return await Promise.race([nonceAccountDidAdvancePromise, nonceIsAlreadyInvalidPromise]);
|
|
3763
|
+
} finally {
|
|
3764
|
+
abortController.abort();
|
|
3765
|
+
}
|
|
3766
|
+
};
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
// src/transaction-confirmation-strategy-signature.ts
|
|
3770
|
+
init_env_shim();
|
|
3771
|
+
function createSignatureConfirmationPromiseFactory(rpc, rpcSubscriptions) {
|
|
3772
|
+
return async function getSignatureConfirmationPromise({ abortSignal: callerAbortSignal, commitment, signature }) {
|
|
3773
|
+
const abortController = new AbortController();
|
|
3774
|
+
function handleAbort() {
|
|
3775
|
+
abortController.abort();
|
|
3776
|
+
}
|
|
3777
|
+
callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
|
|
3778
|
+
const signatureStatusNotifications = await rpcSubscriptions.signatureNotifications(signature, { commitment }).subscribe({ abortSignal: abortController.signal });
|
|
3779
|
+
const signatureDidCommitPromise = (async () => {
|
|
3780
|
+
for await (const signatureStatusNotification of signatureStatusNotifications) {
|
|
3781
|
+
if (signatureStatusNotification.value.err) {
|
|
3782
|
+
throw new Error(`The transaction with signature \`${signature}\` failed.`, {
|
|
3783
|
+
cause: signatureStatusNotification.value.err
|
|
3784
|
+
});
|
|
3785
|
+
} else {
|
|
3786
|
+
return;
|
|
3787
|
+
}
|
|
3788
|
+
}
|
|
3789
|
+
})();
|
|
3790
|
+
const signatureStatusLookupPromise = (async () => {
|
|
3791
|
+
const { value: signatureStatusResults } = await rpc.getSignatureStatuses([signature]).send({ abortSignal: abortController.signal });
|
|
3792
|
+
const signatureStatus = signatureStatusResults[0];
|
|
3793
|
+
if (signatureStatus && signatureStatus.confirmationStatus && commitmentComparator(signatureStatus.confirmationStatus, commitment) >= 0) {
|
|
3794
|
+
return;
|
|
3795
|
+
} else {
|
|
3796
|
+
await new Promise(() => {
|
|
3797
|
+
});
|
|
3798
|
+
}
|
|
3799
|
+
})();
|
|
3800
|
+
try {
|
|
3801
|
+
return await Promise.race([signatureDidCommitPromise, signatureStatusLookupPromise]);
|
|
3802
|
+
} finally {
|
|
3803
|
+
abortController.abort();
|
|
3804
|
+
}
|
|
3805
|
+
};
|
|
3806
|
+
}
|
|
3807
|
+
|
|
3808
|
+
// src/transaction-confirmation.ts
|
|
3809
|
+
async function raceStrategies(config, getSpecificStrategiesForRace) {
|
|
3810
|
+
const { abortSignal: callerAbortSignal, commitment, getSignatureConfirmationPromise, transaction } = config;
|
|
3811
|
+
callerAbortSignal.throwIfAborted();
|
|
3812
|
+
const signature = getSignatureFromTransaction(transaction);
|
|
3813
|
+
const abortController = new AbortController();
|
|
3814
|
+
function handleAbort() {
|
|
3815
|
+
abortController.abort();
|
|
3816
|
+
}
|
|
3817
|
+
callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
|
|
3818
|
+
try {
|
|
3819
|
+
const specificStrategies = getSpecificStrategiesForRace({
|
|
3820
|
+
...config,
|
|
3821
|
+
abortSignal: abortController.signal
|
|
3822
|
+
});
|
|
3823
|
+
return await Promise.race([
|
|
3824
|
+
getSignatureConfirmationPromise({
|
|
3825
|
+
abortSignal: abortController.signal,
|
|
3826
|
+
commitment,
|
|
3827
|
+
signature
|
|
3828
|
+
}),
|
|
3829
|
+
...specificStrategies
|
|
3830
|
+
]);
|
|
3831
|
+
} finally {
|
|
3832
|
+
abortController.abort();
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
function createDefaultDurableNonceTransactionConfirmer({
|
|
3836
|
+
rpc,
|
|
3837
|
+
rpcSubscriptions
|
|
3838
|
+
}) {
|
|
3839
|
+
const getNonceInvalidationPromise = createNonceInvalidationPromiseFactory(rpc, rpcSubscriptions);
|
|
3840
|
+
const getSignatureConfirmationPromise = createSignatureConfirmationPromiseFactory(rpc, rpcSubscriptions);
|
|
3841
|
+
return async function confirmTransaction(config) {
|
|
3842
|
+
await waitForDurableNonceTransactionConfirmation({
|
|
3843
|
+
...config,
|
|
3844
|
+
getNonceInvalidationPromise,
|
|
3845
|
+
getSignatureConfirmationPromise
|
|
3846
|
+
});
|
|
3847
|
+
};
|
|
3848
|
+
}
|
|
3849
|
+
function createDefaultTransactionConfirmer({ rpc, rpcSubscriptions }) {
|
|
3850
|
+
const getBlockHeightExceedencePromise = createBlockHeightExceedencePromiseFactory(rpcSubscriptions);
|
|
3851
|
+
const getSignatureConfirmationPromise = createSignatureConfirmationPromiseFactory(rpc, rpcSubscriptions);
|
|
3852
|
+
return async function confirmTransaction(config) {
|
|
3853
|
+
await waitForTransactionConfirmation({
|
|
3854
|
+
...config,
|
|
3855
|
+
getBlockHeightExceedencePromise,
|
|
3856
|
+
getSignatureConfirmationPromise
|
|
3857
|
+
});
|
|
3858
|
+
};
|
|
3859
|
+
}
|
|
3860
|
+
async function waitForDurableNonceTransactionConfirmation(config) {
|
|
3861
|
+
await raceStrategies(
|
|
3862
|
+
config,
|
|
3863
|
+
function getSpecificStrategiesForRace({ abortSignal, commitment, getNonceInvalidationPromise, transaction }) {
|
|
3864
|
+
return [
|
|
3865
|
+
getNonceInvalidationPromise({
|
|
3866
|
+
abortSignal,
|
|
3867
|
+
commitment,
|
|
3868
|
+
currentNonceValue: transaction.lifetimeConstraint.nonce,
|
|
3869
|
+
nonceAccountAddress: transaction.instructions[0].accounts[0].address
|
|
3870
|
+
})
|
|
3871
|
+
];
|
|
3872
|
+
}
|
|
3873
|
+
);
|
|
3874
|
+
}
|
|
3875
|
+
async function waitForTransactionConfirmation(config) {
|
|
3876
|
+
await raceStrategies(
|
|
3877
|
+
config,
|
|
3878
|
+
function getSpecificStrategiesForRace({ abortSignal, getBlockHeightExceedencePromise, transaction }) {
|
|
3879
|
+
return [
|
|
3880
|
+
getBlockHeightExceedencePromise({
|
|
3881
|
+
abortSignal,
|
|
3882
|
+
lastValidBlockHeight: transaction.lifetimeConstraint.lastValidBlockHeight
|
|
3883
|
+
})
|
|
3884
|
+
];
|
|
3885
|
+
}
|
|
2002
3886
|
);
|
|
2003
3887
|
}
|
|
2004
3888
|
|
|
2005
3889
|
exports.AccountRole = AccountRole;
|
|
3890
|
+
exports.address = address;
|
|
2006
3891
|
exports.appendTransactionInstruction = appendTransactionInstruction;
|
|
2007
|
-
exports.
|
|
3892
|
+
exports.assertIsAddress = assertIsAddress;
|
|
2008
3893
|
exports.assertIsBlockhash = assertIsBlockhash;
|
|
2009
3894
|
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
3895
|
+
exports.assertIsProgramDerivedAddress = assertIsProgramDerivedAddress;
|
|
3896
|
+
exports.assertIsTransactionSignature = assertIsTransactionSignature;
|
|
3897
|
+
exports.createAddressWithSeed = createAddressWithSeed;
|
|
3898
|
+
exports.createBlockHeightExceedencePromiseFactory = createBlockHeightExceedencePromiseFactory;
|
|
3899
|
+
exports.createDefaultDurableNonceTransactionConfirmer = createDefaultDurableNonceTransactionConfirmer;
|
|
3900
|
+
exports.createDefaultRpcSubscriptionsTransport = createDefaultRpcSubscriptionsTransport;
|
|
2010
3901
|
exports.createDefaultRpcTransport = createDefaultRpcTransport;
|
|
3902
|
+
exports.createDefaultTransactionConfirmer = createDefaultTransactionConfirmer;
|
|
3903
|
+
exports.createNonceInvalidationPromiseFactory = createNonceInvalidationPromiseFactory;
|
|
3904
|
+
exports.createSignatureConfirmationPromiseFactory = createSignatureConfirmationPromiseFactory;
|
|
2011
3905
|
exports.createSolanaRpc = createSolanaRpc;
|
|
3906
|
+
exports.createSolanaRpcSubscriptions = createSolanaRpcSubscriptions;
|
|
3907
|
+
exports.createSolanaRpcSubscriptions_UNSTABLE = createSolanaRpcSubscriptions_UNSTABLE;
|
|
2012
3908
|
exports.createTransaction = createTransaction;
|
|
2013
3909
|
exports.downgradeRoleToNonSigner = downgradeRoleToNonSigner;
|
|
2014
3910
|
exports.downgradeRoleToReadonly = downgradeRoleToReadonly;
|
|
2015
3911
|
exports.generateKeyPair = generateKeyPair;
|
|
2016
|
-
exports.
|
|
2017
|
-
exports.
|
|
2018
|
-
exports.
|
|
3912
|
+
exports.getAddressCodec = getAddressCodec;
|
|
3913
|
+
exports.getAddressComparator = getAddressComparator;
|
|
3914
|
+
exports.getAddressDecoder = getAddressDecoder;
|
|
3915
|
+
exports.getAddressEncoder = getAddressEncoder;
|
|
3916
|
+
exports.getAddressFromPublicKey = getAddressFromPublicKey;
|
|
2019
3917
|
exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
|
|
3918
|
+
exports.getProgramDerivedAddress = getProgramDerivedAddress;
|
|
3919
|
+
exports.getSignatureFromTransaction = getSignatureFromTransaction;
|
|
3920
|
+
exports.getTransactionEncoder = getTransactionEncoder;
|
|
3921
|
+
exports.isAddress = isAddress;
|
|
3922
|
+
exports.isProgramDerivedAddress = isProgramDerivedAddress;
|
|
2020
3923
|
exports.isSignerRole = isSignerRole;
|
|
3924
|
+
exports.isTransactionSignature = isTransactionSignature;
|
|
2021
3925
|
exports.isWritableRole = isWritableRole;
|
|
2022
3926
|
exports.mergeRoles = mergeRoles;
|
|
2023
3927
|
exports.prependTransactionInstruction = prependTransactionInstruction;
|
|
@@ -2026,9 +3930,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2026
3930
|
exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
|
|
2027
3931
|
exports.signBytes = signBytes;
|
|
2028
3932
|
exports.signTransaction = signTransaction;
|
|
3933
|
+
exports.transactionSignature = transactionSignature;
|
|
2029
3934
|
exports.upgradeRoleToSigner = upgradeRoleToSigner;
|
|
2030
3935
|
exports.upgradeRoleToWritable = upgradeRoleToWritable;
|
|
2031
3936
|
exports.verifySignature = verifySignature;
|
|
3937
|
+
exports.waitForDurableNonceTransactionConfirmation = waitForDurableNonceTransactionConfirmation;
|
|
3938
|
+
exports.waitForTransactionConfirmation = waitForTransactionConfirmation;
|
|
2032
3939
|
|
|
2033
3940
|
return exports;
|
|
2034
3941
|
|