@solana/web3.js 2.0.0-development → 2.0.0-experimental.0108bc7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs +16 -2
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +2 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +1359 -116
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +2 -0
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +16 -2
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +2 -0
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +33 -16
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/rpc-default-config.d.ts.map +1 -0
- package/dist/types/rpc-integer-overflow-error.d.ts.map +1 -0
- package/dist/types/rpc-request-coalescer.d.ts.map +1 -0
- package/dist/types/rpc-request-deduplication.d.ts.map +1 -0
- package/dist/types/rpc-transport.d.ts.map +1 -0
- package/dist/types/rpc.d.ts.map +1 -0
- package/package.json +13 -15
|
@@ -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,47 +122,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
122
122
|
// src/index.ts
|
|
123
123
|
init_env_shim();
|
|
124
124
|
|
|
125
|
-
// ../
|
|
126
|
-
init_env_shim();
|
|
127
|
-
var AccountRole = /* @__PURE__ */ ((AccountRole2) => {
|
|
128
|
-
AccountRole2[AccountRole2["WRITABLE_SIGNER"] = /* 3 */
|
|
129
|
-
3] = "WRITABLE_SIGNER";
|
|
130
|
-
AccountRole2[AccountRole2["READONLY_SIGNER"] = /* 2 */
|
|
131
|
-
2] = "READONLY_SIGNER";
|
|
132
|
-
AccountRole2[AccountRole2["WRITABLE"] = /* 1 */
|
|
133
|
-
1] = "WRITABLE";
|
|
134
|
-
AccountRole2[AccountRole2["READONLY"] = /* 0 */
|
|
135
|
-
0] = "READONLY";
|
|
136
|
-
return AccountRole2;
|
|
137
|
-
})(AccountRole || {});
|
|
138
|
-
var IS_SIGNER_BITMASK = 2;
|
|
139
|
-
var IS_WRITABLE_BITMASK = 1;
|
|
140
|
-
function downgradeRoleToNonSigner(role) {
|
|
141
|
-
return role & ~IS_SIGNER_BITMASK;
|
|
142
|
-
}
|
|
143
|
-
function downgradeRoleToReadonly(role) {
|
|
144
|
-
return role & ~IS_WRITABLE_BITMASK;
|
|
145
|
-
}
|
|
146
|
-
function isSignerRole(role) {
|
|
147
|
-
return role >= 2;
|
|
148
|
-
}
|
|
149
|
-
function isWritableRole(role) {
|
|
150
|
-
return (role & IS_WRITABLE_BITMASK) !== 0;
|
|
151
|
-
}
|
|
152
|
-
function mergeRoles(roleA, roleB) {
|
|
153
|
-
return roleA | roleB;
|
|
154
|
-
}
|
|
155
|
-
function upgradeRoleToSigner(role) {
|
|
156
|
-
return role | IS_SIGNER_BITMASK;
|
|
157
|
-
}
|
|
158
|
-
function upgradeRoleToWritable(role) {
|
|
159
|
-
return role | IS_WRITABLE_BITMASK;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// ../keys/dist/index.browser.js
|
|
125
|
+
// ../addresses/dist/index.browser.js
|
|
163
126
|
init_env_shim();
|
|
164
127
|
|
|
165
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
128
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/index.mjs
|
|
166
129
|
init_env_shim();
|
|
167
130
|
|
|
168
131
|
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/index.mjs
|
|
@@ -180,14 +143,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
180
143
|
});
|
|
181
144
|
return result;
|
|
182
145
|
};
|
|
183
|
-
var padBytes = (
|
|
184
|
-
if (
|
|
185
|
-
return
|
|
146
|
+
var padBytes = (bytes2, length) => {
|
|
147
|
+
if (bytes2.length >= length)
|
|
148
|
+
return bytes2;
|
|
186
149
|
const paddedBytes = new Uint8Array(length).fill(0);
|
|
187
|
-
paddedBytes.set(
|
|
150
|
+
paddedBytes.set(bytes2);
|
|
188
151
|
return paddedBytes;
|
|
189
152
|
};
|
|
190
|
-
var fixBytes = (
|
|
153
|
+
var fixBytes = (bytes2, length) => padBytes(bytes2.slice(0, length), length);
|
|
191
154
|
|
|
192
155
|
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/errors.mjs
|
|
193
156
|
init_env_shim();
|
|
@@ -203,6 +166,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
203
166
|
__publicField(this, "name", "NotEnoughBytesError");
|
|
204
167
|
}
|
|
205
168
|
};
|
|
169
|
+
var ExpectedFixedSizeSerializerError = class extends Error {
|
|
170
|
+
constructor(message) {
|
|
171
|
+
message ?? (message = "Expected a fixed-size serializer, got a variable-size one.");
|
|
172
|
+
super(message);
|
|
173
|
+
__publicField(this, "name", "ExpectedFixedSizeSerializerError");
|
|
174
|
+
}
|
|
175
|
+
};
|
|
206
176
|
|
|
207
177
|
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/fixSerializer.mjs
|
|
208
178
|
init_env_shim();
|
|
@@ -226,6 +196,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
226
196
|
};
|
|
227
197
|
}
|
|
228
198
|
|
|
199
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/mapSerializer.mjs
|
|
200
|
+
init_env_shim();
|
|
201
|
+
function mapSerializer(serializer, unmap, map) {
|
|
202
|
+
return {
|
|
203
|
+
description: serializer.description,
|
|
204
|
+
fixedSize: serializer.fixedSize,
|
|
205
|
+
maxSize: serializer.maxSize,
|
|
206
|
+
serialize: (value) => serializer.serialize(unmap(value)),
|
|
207
|
+
deserialize: (buffer, offset = 0) => {
|
|
208
|
+
const [value, length] = serializer.deserialize(buffer, offset);
|
|
209
|
+
return map ? [map(value, buffer, offset), length] : [value, length];
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
229
214
|
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/index.mjs
|
|
230
215
|
init_env_shim();
|
|
231
216
|
|
|
@@ -280,13 +265,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
280
265
|
deserialize(buffer, offset = 0) {
|
|
281
266
|
if (buffer.length === 0)
|
|
282
267
|
return ["", 0];
|
|
283
|
-
const
|
|
284
|
-
let trailIndex =
|
|
285
|
-
trailIndex = trailIndex === -1 ?
|
|
268
|
+
const bytes2 = buffer.slice(offset);
|
|
269
|
+
let trailIndex = bytes2.findIndex((n) => n !== 0);
|
|
270
|
+
trailIndex = trailIndex === -1 ? bytes2.length : trailIndex;
|
|
286
271
|
const leadingZeroes = alphabet[0].repeat(trailIndex);
|
|
287
|
-
if (trailIndex ===
|
|
272
|
+
if (trailIndex === bytes2.length)
|
|
288
273
|
return [leadingZeroes, buffer.length];
|
|
289
|
-
let base10Number =
|
|
274
|
+
let base10Number = bytes2.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
|
|
290
275
|
const tailChars = [];
|
|
291
276
|
while (base10Number > 0n) {
|
|
292
277
|
tailChars.unshift(alphabet[Number(base10Number % baseBigInt)]);
|
|
@@ -364,30 +349,41 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
364
349
|
input.set(new DataView(buffer), value, littleEndian);
|
|
365
350
|
return new Uint8Array(buffer);
|
|
366
351
|
},
|
|
367
|
-
deserialize(
|
|
368
|
-
const slice =
|
|
352
|
+
deserialize(bytes2, offset = 0) {
|
|
353
|
+
const slice = bytes2.slice(offset, offset + input.size);
|
|
369
354
|
assertEnoughBytes("i8", slice, input.size);
|
|
370
355
|
const view = toDataView(slice);
|
|
371
356
|
return [input.get(view, littleEndian), offset + input.size];
|
|
372
357
|
}
|
|
373
358
|
};
|
|
374
359
|
}
|
|
375
|
-
var toArrayBuffer = (
|
|
376
|
-
var toDataView = (
|
|
360
|
+
var toArrayBuffer = (array2) => array2.buffer.slice(array2.byteOffset, array2.byteLength + array2.byteOffset);
|
|
361
|
+
var toDataView = (array2) => new DataView(toArrayBuffer(array2));
|
|
377
362
|
var assertRange = (serializer, min, max, value) => {
|
|
378
363
|
if (value < min || value > max) {
|
|
379
364
|
throw new NumberOutOfRangeError(serializer, min, max, value);
|
|
380
365
|
}
|
|
381
366
|
};
|
|
382
|
-
var assertEnoughBytes = (serializer,
|
|
383
|
-
if (
|
|
367
|
+
var assertEnoughBytes = (serializer, bytes2, expected) => {
|
|
368
|
+
if (bytes2.length === 0) {
|
|
384
369
|
throw new DeserializingEmptyBufferError(serializer);
|
|
385
370
|
}
|
|
386
|
-
if (
|
|
387
|
-
throw new NotEnoughBytesError(serializer, expected,
|
|
371
|
+
if (bytes2.length < expected) {
|
|
372
|
+
throw new NotEnoughBytesError(serializer, expected, bytes2.length);
|
|
388
373
|
}
|
|
389
374
|
};
|
|
390
375
|
|
|
376
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u8.mjs
|
|
377
|
+
init_env_shim();
|
|
378
|
+
var u8 = (options = {}) => numberFactory({
|
|
379
|
+
name: "u8",
|
|
380
|
+
size: 1,
|
|
381
|
+
range: [0, Number("0xff")],
|
|
382
|
+
set: (view, value) => view.setUint8(0, Number(value)),
|
|
383
|
+
get: (view) => view.getUint8(0),
|
|
384
|
+
options
|
|
385
|
+
});
|
|
386
|
+
|
|
391
387
|
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u32.mjs
|
|
392
388
|
init_env_shim();
|
|
393
389
|
var u32 = (options = {}) => numberFactory({
|
|
@@ -399,13 +395,195 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
399
395
|
options
|
|
400
396
|
});
|
|
401
397
|
|
|
402
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/
|
|
398
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/shortU16.mjs
|
|
399
|
+
init_env_shim();
|
|
400
|
+
var shortU16 = (options = {}) => ({
|
|
401
|
+
description: options.description ?? "shortU16",
|
|
402
|
+
fixedSize: null,
|
|
403
|
+
maxSize: 3,
|
|
404
|
+
serialize: (value) => {
|
|
405
|
+
assertRange("shortU16", 0, 65535, value);
|
|
406
|
+
const bytes2 = [0];
|
|
407
|
+
for (let ii = 0; ; ii += 1) {
|
|
408
|
+
const alignedValue = value >> ii * 7;
|
|
409
|
+
if (alignedValue === 0) {
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
const nextSevenBits = 127 & alignedValue;
|
|
413
|
+
bytes2[ii] = nextSevenBits;
|
|
414
|
+
if (ii > 0) {
|
|
415
|
+
bytes2[ii - 1] |= 128;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return new Uint8Array(bytes2);
|
|
419
|
+
},
|
|
420
|
+
deserialize: (bytes2, offset = 0) => {
|
|
421
|
+
let value = 0;
|
|
422
|
+
let byteCount = 0;
|
|
423
|
+
while (++byteCount) {
|
|
424
|
+
const byteIndex = byteCount - 1;
|
|
425
|
+
const currentByte = bytes2[offset + byteIndex];
|
|
426
|
+
const nextSevenBits = 127 & currentByte;
|
|
427
|
+
value |= nextSevenBits << byteIndex * 7;
|
|
428
|
+
if ((currentByte & 128) === 0) {
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return [value, offset + byteCount];
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
|
|
437
|
+
init_env_shim();
|
|
438
|
+
|
|
439
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/errors.mjs
|
|
440
|
+
init_env_shim();
|
|
441
|
+
var InvalidNumberOfItemsError = class extends Error {
|
|
442
|
+
constructor(serializer, expected, actual) {
|
|
443
|
+
super(`Expected [${serializer}] to have ${expected} items, got ${actual}.`);
|
|
444
|
+
__publicField(this, "name", "InvalidNumberOfItemsError");
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
var InvalidArrayLikeRemainderSizeError = class extends Error {
|
|
448
|
+
constructor(remainderSize, itemSize) {
|
|
449
|
+
super(`The remainder of the buffer (${remainderSize} bytes) cannot be split into chunks of ${itemSize} bytes. Serializers of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${remainderSize} modulo ${itemSize} should be equal to zero.`);
|
|
450
|
+
__publicField(this, "name", "InvalidArrayLikeRemainderSizeError");
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
var UnrecognizedArrayLikeSerializerSizeError = class extends Error {
|
|
454
|
+
constructor(size) {
|
|
455
|
+
super(`Unrecognized array-like serializer size: ${JSON.stringify(size)}`);
|
|
456
|
+
__publicField(this, "name", "UnrecognizedArrayLikeSerializerSizeError");
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
|
|
403
461
|
init_env_shim();
|
|
462
|
+
|
|
463
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/sumSerializerSizes.mjs
|
|
464
|
+
init_env_shim();
|
|
465
|
+
function sumSerializerSizes(sizes) {
|
|
466
|
+
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
|
|
470
|
+
function getResolvedSize(size, childrenSizes, bytes2, offset) {
|
|
471
|
+
if (typeof size === "number") {
|
|
472
|
+
return [size, offset];
|
|
473
|
+
}
|
|
474
|
+
if (typeof size === "object") {
|
|
475
|
+
return size.deserialize(bytes2, offset);
|
|
476
|
+
}
|
|
477
|
+
if (size === "remainder") {
|
|
478
|
+
const childrenSize = sumSerializerSizes(childrenSizes);
|
|
479
|
+
if (childrenSize === null) {
|
|
480
|
+
throw new ExpectedFixedSizeSerializerError('Serializers of "remainder" size must have fixed-size items.');
|
|
481
|
+
}
|
|
482
|
+
const remainder = bytes2.slice(offset).length;
|
|
483
|
+
if (remainder % childrenSize !== 0) {
|
|
484
|
+
throw new InvalidArrayLikeRemainderSizeError(remainder, childrenSize);
|
|
485
|
+
}
|
|
486
|
+
return [remainder / childrenSize, offset];
|
|
487
|
+
}
|
|
488
|
+
throw new UnrecognizedArrayLikeSerializerSizeError(size);
|
|
489
|
+
}
|
|
404
490
|
function getSizeDescription(size) {
|
|
405
491
|
return typeof size === "object" ? size.description : `${size}`;
|
|
406
492
|
}
|
|
493
|
+
function getSizeFromChildren(size, childrenSizes) {
|
|
494
|
+
if (typeof size !== "number")
|
|
495
|
+
return null;
|
|
496
|
+
if (size === 0)
|
|
497
|
+
return 0;
|
|
498
|
+
const childrenSize = sumSerializerSizes(childrenSizes);
|
|
499
|
+
return childrenSize === null ? null : childrenSize * size;
|
|
500
|
+
}
|
|
501
|
+
function getSizePrefix(size, realSize) {
|
|
502
|
+
return typeof size === "object" ? size.serialize(realSize) : new Uint8Array();
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
|
|
506
|
+
function array(item, options = {}) {
|
|
507
|
+
const size = options.size ?? u32();
|
|
508
|
+
if (size === "remainder" && item.fixedSize === null) {
|
|
509
|
+
throw new ExpectedFixedSizeSerializerError('Serializers of "remainder" size must have fixed-size items.');
|
|
510
|
+
}
|
|
511
|
+
return {
|
|
512
|
+
description: options.description ?? `array(${item.description}; ${getSizeDescription(size)})`,
|
|
513
|
+
fixedSize: getSizeFromChildren(size, [item.fixedSize]),
|
|
514
|
+
maxSize: getSizeFromChildren(size, [item.maxSize]),
|
|
515
|
+
serialize: (value) => {
|
|
516
|
+
if (typeof size === "number" && value.length !== size) {
|
|
517
|
+
throw new InvalidNumberOfItemsError("array", size, value.length);
|
|
518
|
+
}
|
|
519
|
+
return mergeBytes([getSizePrefix(size, value.length), ...value.map((v) => item.serialize(v))]);
|
|
520
|
+
},
|
|
521
|
+
deserialize: (bytes2, offset = 0) => {
|
|
522
|
+
if (typeof size === "object" && bytes2.slice(offset).length === 0) {
|
|
523
|
+
return [[], offset];
|
|
524
|
+
}
|
|
525
|
+
const [resolvedSize, newOffset] = getResolvedSize(size, [item.fixedSize], bytes2, offset);
|
|
526
|
+
offset = newOffset;
|
|
527
|
+
const values = [];
|
|
528
|
+
for (let i = 0; i < resolvedSize; i += 1) {
|
|
529
|
+
const [value, newOffset2] = item.deserialize(bytes2, offset);
|
|
530
|
+
values.push(value);
|
|
531
|
+
offset = newOffset2;
|
|
532
|
+
}
|
|
533
|
+
return [values, offset];
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/bytes.mjs
|
|
539
|
+
init_env_shim();
|
|
540
|
+
function bytes(options = {}) {
|
|
541
|
+
const size = options.size ?? "variable";
|
|
542
|
+
const description = options.description ?? `bytes(${getSizeDescription(size)})`;
|
|
543
|
+
const byteSerializer = {
|
|
544
|
+
description,
|
|
545
|
+
fixedSize: null,
|
|
546
|
+
maxSize: null,
|
|
547
|
+
serialize: (value) => new Uint8Array(value),
|
|
548
|
+
deserialize: (bytes2, offset = 0) => {
|
|
549
|
+
const slice = bytes2.slice(offset);
|
|
550
|
+
return [slice, offset + slice.length];
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
if (size === "variable") {
|
|
554
|
+
return byteSerializer;
|
|
555
|
+
}
|
|
556
|
+
if (typeof size === "number") {
|
|
557
|
+
return fixSerializer(byteSerializer, size, description);
|
|
558
|
+
}
|
|
559
|
+
return {
|
|
560
|
+
description,
|
|
561
|
+
fixedSize: null,
|
|
562
|
+
maxSize: null,
|
|
563
|
+
serialize: (value) => {
|
|
564
|
+
const contentBytes = byteSerializer.serialize(value);
|
|
565
|
+
const lengthBytes = size.serialize(contentBytes.length);
|
|
566
|
+
return mergeBytes([lengthBytes, contentBytes]);
|
|
567
|
+
},
|
|
568
|
+
deserialize: (buffer, offset = 0) => {
|
|
569
|
+
if (buffer.slice(offset).length === 0) {
|
|
570
|
+
throw new DeserializingEmptyBufferError("bytes");
|
|
571
|
+
}
|
|
572
|
+
const [lengthBigInt, lengthOffset] = size.deserialize(buffer, offset);
|
|
573
|
+
const length = Number(lengthBigInt);
|
|
574
|
+
offset = lengthOffset;
|
|
575
|
+
const contentBuffer = buffer.slice(offset, offset + length);
|
|
576
|
+
if (contentBuffer.length < length) {
|
|
577
|
+
throw new NotEnoughBytesError("bytes", length, contentBuffer.length);
|
|
578
|
+
}
|
|
579
|
+
const [value, contentOffset] = byteSerializer.deserialize(contentBuffer);
|
|
580
|
+
offset += contentOffset;
|
|
581
|
+
return [value, offset];
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
}
|
|
407
585
|
|
|
408
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
586
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/string.mjs
|
|
409
587
|
init_env_shim();
|
|
410
588
|
function string(options = {}) {
|
|
411
589
|
const size = options.size ?? u32();
|
|
@@ -446,43 +624,33 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
446
624
|
}
|
|
447
625
|
};
|
|
448
626
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
627
|
+
|
|
628
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/struct.mjs
|
|
629
|
+
init_env_shim();
|
|
630
|
+
function struct(fields, options = {}) {
|
|
631
|
+
const fieldDescriptions = fields.map(([name, serializer]) => `${String(name)}: ${serializer.description}`).join(", ");
|
|
632
|
+
return {
|
|
633
|
+
description: options.description ?? `struct(${fieldDescriptions})`,
|
|
634
|
+
fixedSize: sumSerializerSizes(fields.map(([, field]) => field.fixedSize)),
|
|
635
|
+
maxSize: sumSerializerSizes(fields.map(([, field]) => field.maxSize)),
|
|
636
|
+
serialize: (struct2) => {
|
|
637
|
+
const fieldBytes = fields.map(([key, serializer]) => serializer.serialize(struct2[key]));
|
|
638
|
+
return mergeBytes(fieldBytes);
|
|
639
|
+
},
|
|
640
|
+
deserialize: (bytes2, offset = 0) => {
|
|
641
|
+
const struct2 = {};
|
|
642
|
+
fields.forEach(([key, serializer]) => {
|
|
643
|
+
const [value, newOffset] = serializer.deserialize(bytes2, offset);
|
|
644
|
+
offset = newOffset;
|
|
645
|
+
struct2[key] = value;
|
|
646
|
+
});
|
|
647
|
+
return [struct2, offset];
|
|
462
648
|
}
|
|
463
|
-
}
|
|
464
|
-
throw new Error(`\`${putativeBase58EncodedAddress}\` is not a base-58 encoded address`, {
|
|
465
|
-
cause: e2
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
function getBase58EncodedAddressCodec(config) {
|
|
470
|
-
return string({
|
|
471
|
-
description: config?.description ?? ("A 32-byte account address" ),
|
|
472
|
-
encoding: base58,
|
|
473
|
-
size: 32
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
function getBase58EncodedAddressComparator() {
|
|
477
|
-
return new Intl.Collator("en", {
|
|
478
|
-
caseFirst: "lower",
|
|
479
|
-
ignorePunctuation: false,
|
|
480
|
-
localeMatcher: "best fit",
|
|
481
|
-
numeric: false,
|
|
482
|
-
sensitivity: "variant",
|
|
483
|
-
usage: "sort"
|
|
484
|
-
}).compare;
|
|
649
|
+
};
|
|
485
650
|
}
|
|
651
|
+
|
|
652
|
+
// ../assertions/dist/index.browser.js
|
|
653
|
+
init_env_shim();
|
|
486
654
|
function assertIsSecureContext() {
|
|
487
655
|
if (!globalThis.isSecureContext) {
|
|
488
656
|
throw new Error(
|
|
@@ -512,13 +680,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
512
680
|
return await cachedEd25519Decision;
|
|
513
681
|
}
|
|
514
682
|
}
|
|
683
|
+
async function assertDigestCapabilityIsAvailable() {
|
|
684
|
+
assertIsSecureContext();
|
|
685
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.digest !== "function") {
|
|
686
|
+
throw new Error("No digest implementation could be found");
|
|
687
|
+
}
|
|
688
|
+
}
|
|
515
689
|
async function assertKeyGenerationIsAvailable() {
|
|
516
690
|
assertIsSecureContext();
|
|
517
691
|
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.generateKey !== "function") {
|
|
518
692
|
throw new Error("No key generation implementation could be found");
|
|
519
693
|
}
|
|
520
694
|
if (!await isEd25519CurveSupported(globalThis.crypto.subtle)) {
|
|
521
|
-
throw new Error(
|
|
695
|
+
throw new Error(
|
|
696
|
+
"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"
|
|
697
|
+
);
|
|
522
698
|
}
|
|
523
699
|
}
|
|
524
700
|
async function assertKeyExporterIsAvailable() {
|
|
@@ -527,19 +703,215 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
527
703
|
throw new Error("No key export implementation could be found");
|
|
528
704
|
}
|
|
529
705
|
}
|
|
530
|
-
async function
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
706
|
+
async function assertSigningCapabilityIsAvailable() {
|
|
707
|
+
assertIsSecureContext();
|
|
708
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.sign !== "function") {
|
|
709
|
+
throw new Error("No signing implementation could be found");
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
async function assertVerificationCapabilityIsAvailable() {
|
|
713
|
+
assertIsSecureContext();
|
|
714
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.verify !== "function") {
|
|
715
|
+
throw new Error("No signature verification implementation could be found");
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
function assertIsBase58EncodedAddress(putativeBase58EncodedAddress) {
|
|
719
|
+
try {
|
|
720
|
+
if (
|
|
721
|
+
// Lowest address (32 bytes of zeroes)
|
|
722
|
+
putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
723
|
+
putativeBase58EncodedAddress.length > 44
|
|
724
|
+
) {
|
|
725
|
+
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
726
|
+
}
|
|
727
|
+
const bytes2 = base58.serialize(putativeBase58EncodedAddress);
|
|
728
|
+
const numBytes = bytes2.byteLength;
|
|
729
|
+
if (numBytes !== 32) {
|
|
730
|
+
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
731
|
+
}
|
|
732
|
+
} catch (e2) {
|
|
733
|
+
throw new Error(`\`${putativeBase58EncodedAddress}\` is not a base-58 encoded address`, {
|
|
734
|
+
cause: e2
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
function getBase58EncodedAddressCodec(config) {
|
|
739
|
+
return string({
|
|
740
|
+
description: config?.description ?? ("A 32-byte account address" ),
|
|
741
|
+
encoding: base58,
|
|
742
|
+
size: 32
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
function getBase58EncodedAddressComparator() {
|
|
746
|
+
return new Intl.Collator("en", {
|
|
747
|
+
caseFirst: "lower",
|
|
748
|
+
ignorePunctuation: false,
|
|
749
|
+
localeMatcher: "best fit",
|
|
750
|
+
numeric: false,
|
|
751
|
+
sensitivity: "variant",
|
|
752
|
+
usage: "sort"
|
|
753
|
+
}).compare;
|
|
754
|
+
}
|
|
755
|
+
var D = 37095705934669439343138083508754565189542113879843219016388785533085940283555n;
|
|
756
|
+
var P = 57896044618658097711785492504343953926634992332820282019728792003956564819949n;
|
|
757
|
+
var RM1 = 19681161376707505956807079304988542015446066515923890162744021073123829784752n;
|
|
758
|
+
function mod(a) {
|
|
759
|
+
const r = a % P;
|
|
760
|
+
return r >= 0n ? r : P + r;
|
|
761
|
+
}
|
|
762
|
+
function pow2(x, power) {
|
|
763
|
+
let r = x;
|
|
764
|
+
while (power-- > 0n) {
|
|
765
|
+
r *= r;
|
|
766
|
+
r %= P;
|
|
767
|
+
}
|
|
768
|
+
return r;
|
|
769
|
+
}
|
|
770
|
+
function pow_2_252_3(x) {
|
|
771
|
+
const x2 = x * x % P;
|
|
772
|
+
const b2 = x2 * x % P;
|
|
773
|
+
const b4 = pow2(b2, 2n) * b2 % P;
|
|
774
|
+
const b5 = pow2(b4, 1n) * x % P;
|
|
775
|
+
const b10 = pow2(b5, 5n) * b5 % P;
|
|
776
|
+
const b20 = pow2(b10, 10n) * b10 % P;
|
|
777
|
+
const b40 = pow2(b20, 20n) * b20 % P;
|
|
778
|
+
const b80 = pow2(b40, 40n) * b40 % P;
|
|
779
|
+
const b160 = pow2(b80, 80n) * b80 % P;
|
|
780
|
+
const b240 = pow2(b160, 80n) * b80 % P;
|
|
781
|
+
const b250 = pow2(b240, 10n) * b10 % P;
|
|
782
|
+
const pow_p_5_8 = pow2(b250, 2n) * x % P;
|
|
783
|
+
return pow_p_5_8;
|
|
784
|
+
}
|
|
785
|
+
function uvRatio(u, v) {
|
|
786
|
+
const v3 = mod(v * v * v);
|
|
787
|
+
const v7 = mod(v3 * v3 * v);
|
|
788
|
+
const pow = pow_2_252_3(u * v7);
|
|
789
|
+
let x = mod(u * v3 * pow);
|
|
790
|
+
const vx2 = mod(v * x * x);
|
|
791
|
+
const root1 = x;
|
|
792
|
+
const root2 = mod(x * RM1);
|
|
793
|
+
const useRoot1 = vx2 === u;
|
|
794
|
+
const useRoot2 = vx2 === mod(-u);
|
|
795
|
+
const noRoot = vx2 === mod(-u * RM1);
|
|
796
|
+
if (useRoot1)
|
|
797
|
+
x = root1;
|
|
798
|
+
if (useRoot2 || noRoot)
|
|
799
|
+
x = root2;
|
|
800
|
+
if ((mod(x) & 1n) === 1n)
|
|
801
|
+
x = mod(-x);
|
|
802
|
+
if (!useRoot1 && !useRoot2) {
|
|
803
|
+
return null;
|
|
804
|
+
}
|
|
805
|
+
return x;
|
|
806
|
+
}
|
|
807
|
+
function pointIsOnCurve(y, lastByte) {
|
|
808
|
+
const y2 = mod(y * y);
|
|
809
|
+
const u = mod(y2 - 1n);
|
|
810
|
+
const v = mod(D * y2 + 1n);
|
|
811
|
+
const x = uvRatio(u, v);
|
|
812
|
+
if (x === null) {
|
|
813
|
+
return false;
|
|
814
|
+
}
|
|
815
|
+
const isLastByteOdd = (lastByte & 128) !== 0;
|
|
816
|
+
if (x === 0n && isLastByteOdd) {
|
|
817
|
+
return false;
|
|
818
|
+
}
|
|
819
|
+
return true;
|
|
820
|
+
}
|
|
821
|
+
function byteToHex(byte) {
|
|
822
|
+
const hexString = byte.toString(16);
|
|
823
|
+
if (hexString.length === 1) {
|
|
824
|
+
return `0${hexString}`;
|
|
825
|
+
} else {
|
|
826
|
+
return hexString;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
function decompressPointBytes(bytes2) {
|
|
830
|
+
const hexString = bytes2.reduce((acc, byte, ii) => `${byteToHex(ii === 31 ? byte & ~128 : byte)}${acc}`, "");
|
|
831
|
+
const integerLiteralString = `0x${hexString}`;
|
|
832
|
+
return BigInt(integerLiteralString);
|
|
833
|
+
}
|
|
834
|
+
async function compressedPointBytesAreOnCurve(bytes2) {
|
|
835
|
+
if (bytes2.byteLength !== 32) {
|
|
836
|
+
return false;
|
|
837
|
+
}
|
|
838
|
+
const y = decompressPointBytes(bytes2);
|
|
839
|
+
return pointIsOnCurve(y, bytes2[31]);
|
|
840
|
+
}
|
|
841
|
+
var MAX_SEED_LENGTH = 32;
|
|
842
|
+
var MAX_SEEDS = 16;
|
|
843
|
+
var PDA_MARKER_BYTES = [
|
|
844
|
+
// The string 'ProgramDerivedAddress'
|
|
845
|
+
80,
|
|
846
|
+
114,
|
|
847
|
+
111,
|
|
848
|
+
103,
|
|
849
|
+
114,
|
|
850
|
+
97,
|
|
851
|
+
109,
|
|
852
|
+
68,
|
|
853
|
+
101,
|
|
854
|
+
114,
|
|
855
|
+
105,
|
|
856
|
+
118,
|
|
857
|
+
101,
|
|
858
|
+
100,
|
|
859
|
+
65,
|
|
860
|
+
100,
|
|
861
|
+
100,
|
|
862
|
+
114,
|
|
863
|
+
101,
|
|
864
|
+
115,
|
|
865
|
+
115
|
|
866
|
+
];
|
|
867
|
+
var PointOnCurveError = class extends Error {
|
|
868
|
+
};
|
|
869
|
+
async function createProgramDerivedAddress({ programAddress, seeds }) {
|
|
870
|
+
await assertDigestCapabilityIsAvailable();
|
|
871
|
+
if (seeds.length > MAX_SEEDS) {
|
|
872
|
+
throw new Error(`A maximum of ${MAX_SEEDS} seeds may be supplied when creating an address`);
|
|
873
|
+
}
|
|
874
|
+
let textEncoder;
|
|
875
|
+
const seedBytes = seeds.reduce((acc, seed, ii) => {
|
|
876
|
+
const bytes2 = typeof seed === "string" ? (textEncoder || (textEncoder = new TextEncoder())).encode(seed) : seed;
|
|
877
|
+
if (bytes2.byteLength > MAX_SEED_LENGTH) {
|
|
878
|
+
throw new Error(`The seed at index ${ii} exceeds the maximum length of 32 bytes`);
|
|
879
|
+
}
|
|
880
|
+
acc.push(...bytes2);
|
|
881
|
+
return acc;
|
|
882
|
+
}, []);
|
|
883
|
+
const base58EncodedAddressCodec = getBase58EncodedAddressCodec();
|
|
884
|
+
const programAddressBytes = base58EncodedAddressCodec.serialize(programAddress);
|
|
885
|
+
const addressBytesBuffer = await crypto.subtle.digest(
|
|
886
|
+
"SHA-256",
|
|
887
|
+
new Uint8Array([...seedBytes, ...programAddressBytes, ...PDA_MARKER_BYTES])
|
|
541
888
|
);
|
|
542
|
-
|
|
889
|
+
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
890
|
+
if (await compressedPointBytesAreOnCurve(addressBytes)) {
|
|
891
|
+
throw new PointOnCurveError("Invalid seeds; point must fall off the Ed25519 curve");
|
|
892
|
+
}
|
|
893
|
+
return base58EncodedAddressCodec.deserialize(addressBytes)[0];
|
|
894
|
+
}
|
|
895
|
+
async function getProgramDerivedAddress({ programAddress, seeds }) {
|
|
896
|
+
let bumpSeed = 255;
|
|
897
|
+
while (bumpSeed > 0) {
|
|
898
|
+
try {
|
|
899
|
+
return {
|
|
900
|
+
bumpSeed,
|
|
901
|
+
pda: await createProgramDerivedAddress({
|
|
902
|
+
programAddress,
|
|
903
|
+
seeds: [...seeds, new Uint8Array([bumpSeed])]
|
|
904
|
+
})
|
|
905
|
+
};
|
|
906
|
+
} catch (e2) {
|
|
907
|
+
if (e2 instanceof PointOnCurveError) {
|
|
908
|
+
bumpSeed--;
|
|
909
|
+
} else {
|
|
910
|
+
throw e2;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
throw new Error("Unable to find a viable program address bump seed");
|
|
543
915
|
}
|
|
544
916
|
async function getBase58EncodedAddressFromPublicKey(publicKey) {
|
|
545
917
|
await assertKeyExporterIsAvailable();
|
|
@@ -551,10 +923,792 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
551
923
|
return base58EncodedAddress;
|
|
552
924
|
}
|
|
553
925
|
|
|
554
|
-
//
|
|
555
|
-
init_env_shim();
|
|
556
|
-
|
|
557
|
-
|
|
926
|
+
// ../instructions/dist/index.browser.js
|
|
927
|
+
init_env_shim();
|
|
928
|
+
var AccountRole = /* @__PURE__ */ ((AccountRole22) => {
|
|
929
|
+
AccountRole22[AccountRole22["WRITABLE_SIGNER"] = /* 3 */
|
|
930
|
+
3] = "WRITABLE_SIGNER";
|
|
931
|
+
AccountRole22[AccountRole22["READONLY_SIGNER"] = /* 2 */
|
|
932
|
+
2] = "READONLY_SIGNER";
|
|
933
|
+
AccountRole22[AccountRole22["WRITABLE"] = /* 1 */
|
|
934
|
+
1] = "WRITABLE";
|
|
935
|
+
AccountRole22[AccountRole22["READONLY"] = /* 0 */
|
|
936
|
+
0] = "READONLY";
|
|
937
|
+
return AccountRole22;
|
|
938
|
+
})(AccountRole || {});
|
|
939
|
+
var IS_SIGNER_BITMASK = 2;
|
|
940
|
+
var IS_WRITABLE_BITMASK = 1;
|
|
941
|
+
function downgradeRoleToNonSigner(role) {
|
|
942
|
+
return role & ~IS_SIGNER_BITMASK;
|
|
943
|
+
}
|
|
944
|
+
function downgradeRoleToReadonly(role) {
|
|
945
|
+
return role & ~IS_WRITABLE_BITMASK;
|
|
946
|
+
}
|
|
947
|
+
function isSignerRole(role) {
|
|
948
|
+
return role >= 2;
|
|
949
|
+
}
|
|
950
|
+
function isWritableRole(role) {
|
|
951
|
+
return (role & IS_WRITABLE_BITMASK) !== 0;
|
|
952
|
+
}
|
|
953
|
+
function mergeRoles(roleA, roleB) {
|
|
954
|
+
return roleA | roleB;
|
|
955
|
+
}
|
|
956
|
+
function upgradeRoleToSigner(role) {
|
|
957
|
+
return role | IS_SIGNER_BITMASK;
|
|
958
|
+
}
|
|
959
|
+
function upgradeRoleToWritable(role) {
|
|
960
|
+
return role | IS_WRITABLE_BITMASK;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// ../keys/dist/index.browser.js
|
|
964
|
+
init_env_shim();
|
|
965
|
+
async function generateKeyPair() {
|
|
966
|
+
await assertKeyGenerationIsAvailable();
|
|
967
|
+
const keyPair = await crypto.subtle.generateKey(
|
|
968
|
+
/* algorithm */
|
|
969
|
+
"Ed25519",
|
|
970
|
+
// Native implementation status: https://github.com/WICG/webcrypto-secure-curves/issues/20
|
|
971
|
+
/* extractable */
|
|
972
|
+
false,
|
|
973
|
+
// Prevents the bytes of the private key from being visible to JS.
|
|
974
|
+
/* allowed uses */
|
|
975
|
+
["sign", "verify"]
|
|
976
|
+
);
|
|
977
|
+
return keyPair;
|
|
978
|
+
}
|
|
979
|
+
async function signBytes(key, data) {
|
|
980
|
+
await assertSigningCapabilityIsAvailable();
|
|
981
|
+
const signedData = await crypto.subtle.sign("Ed25519", key, data);
|
|
982
|
+
return new Uint8Array(signedData);
|
|
983
|
+
}
|
|
984
|
+
async function verifySignature(key, signature, data) {
|
|
985
|
+
await assertVerificationCapabilityIsAvailable();
|
|
986
|
+
return await crypto.subtle.verify("Ed25519", key, signature, data);
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
// ../transactions/dist/index.browser.js
|
|
990
|
+
init_env_shim();
|
|
991
|
+
function getUnsignedTransaction(transaction) {
|
|
992
|
+
if ("signatures" in transaction) {
|
|
993
|
+
const {
|
|
994
|
+
signatures: _,
|
|
995
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
996
|
+
...unsignedTransaction
|
|
997
|
+
} = transaction;
|
|
998
|
+
return unsignedTransaction;
|
|
999
|
+
} else {
|
|
1000
|
+
return transaction;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
function assertIsBlockhash(putativeBlockhash) {
|
|
1004
|
+
try {
|
|
1005
|
+
if (
|
|
1006
|
+
// Lowest value (32 bytes of zeroes)
|
|
1007
|
+
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255)
|
|
1008
|
+
putativeBlockhash.length > 44
|
|
1009
|
+
) {
|
|
1010
|
+
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
1011
|
+
}
|
|
1012
|
+
const bytes3 = base58.serialize(putativeBlockhash);
|
|
1013
|
+
const numBytes = bytes3.byteLength;
|
|
1014
|
+
if (numBytes !== 32) {
|
|
1015
|
+
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
1016
|
+
}
|
|
1017
|
+
} catch (e2) {
|
|
1018
|
+
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
|
|
1019
|
+
cause: e2
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
|
|
1024
|
+
if ("lifetimeConstraint" in transaction && transaction.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash && transaction.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight) {
|
|
1025
|
+
return transaction;
|
|
1026
|
+
}
|
|
1027
|
+
const out = {
|
|
1028
|
+
...getUnsignedTransaction(transaction),
|
|
1029
|
+
lifetimeConstraint: blockhashLifetimeConstraint
|
|
1030
|
+
};
|
|
1031
|
+
Object.freeze(out);
|
|
1032
|
+
return out;
|
|
1033
|
+
}
|
|
1034
|
+
function createTransaction({
|
|
1035
|
+
version
|
|
1036
|
+
}) {
|
|
1037
|
+
const out = {
|
|
1038
|
+
instructions: [],
|
|
1039
|
+
version
|
|
1040
|
+
};
|
|
1041
|
+
Object.freeze(out);
|
|
1042
|
+
return out;
|
|
1043
|
+
}
|
|
1044
|
+
var AccountRole2 = /* @__PURE__ */ ((AccountRole22) => {
|
|
1045
|
+
AccountRole22[AccountRole22["WRITABLE_SIGNER"] = /* 3 */
|
|
1046
|
+
3] = "WRITABLE_SIGNER";
|
|
1047
|
+
AccountRole22[AccountRole22["READONLY_SIGNER"] = /* 2 */
|
|
1048
|
+
2] = "READONLY_SIGNER";
|
|
1049
|
+
AccountRole22[AccountRole22["WRITABLE"] = /* 1 */
|
|
1050
|
+
1] = "WRITABLE";
|
|
1051
|
+
AccountRole22[AccountRole22["READONLY"] = /* 0 */
|
|
1052
|
+
0] = "READONLY";
|
|
1053
|
+
return AccountRole22;
|
|
1054
|
+
})(AccountRole2 || {});
|
|
1055
|
+
var IS_WRITABLE_BITMASK2 = 1;
|
|
1056
|
+
function isSignerRole2(role) {
|
|
1057
|
+
return role >= 2;
|
|
1058
|
+
}
|
|
1059
|
+
function isWritableRole2(role) {
|
|
1060
|
+
return (role & IS_WRITABLE_BITMASK2) !== 0;
|
|
1061
|
+
}
|
|
1062
|
+
function mergeRoles2(roleA, roleB) {
|
|
1063
|
+
return roleA | roleB;
|
|
1064
|
+
}
|
|
1065
|
+
var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";
|
|
1066
|
+
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
1067
|
+
function assertIsDurableNonceTransaction(transaction) {
|
|
1068
|
+
if (!isDurableNonceTransaction(transaction)) {
|
|
1069
|
+
throw new Error("Transaction is not a durable nonce transaction");
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
function createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress) {
|
|
1073
|
+
return {
|
|
1074
|
+
accounts: [
|
|
1075
|
+
{ address: nonceAccountAddress, role: AccountRole2.WRITABLE },
|
|
1076
|
+
{
|
|
1077
|
+
address: RECENT_BLOCKHASHES_SYSVAR_ADDRESS,
|
|
1078
|
+
role: AccountRole2.READONLY
|
|
1079
|
+
},
|
|
1080
|
+
{ address: nonceAuthorityAddress, role: AccountRole2.READONLY_SIGNER }
|
|
1081
|
+
],
|
|
1082
|
+
data: new Uint8Array([4, 0, 0, 0]),
|
|
1083
|
+
programAddress: SYSTEM_PROGRAM_ADDRESS
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
function isAdvanceNonceAccountInstruction(instruction) {
|
|
1087
|
+
return instruction.programAddress === SYSTEM_PROGRAM_ADDRESS && // Test for `AdvanceNonceAccount` instruction data
|
|
1088
|
+
instruction.data != null && isAdvanceNonceAccountInstructionData(instruction.data) && // Test for exactly 3 accounts
|
|
1089
|
+
instruction.accounts?.length === 3 && // First account is nonce account address
|
|
1090
|
+
instruction.accounts[0].address != null && instruction.accounts[0].role === AccountRole2.WRITABLE && // Second account is recent blockhashes sysvar
|
|
1091
|
+
instruction.accounts[1].address === RECENT_BLOCKHASHES_SYSVAR_ADDRESS && instruction.accounts[1].role === AccountRole2.READONLY && // Third account is nonce authority account
|
|
1092
|
+
instruction.accounts[2].address != null && instruction.accounts[2].role === AccountRole2.READONLY_SIGNER;
|
|
1093
|
+
}
|
|
1094
|
+
function isAdvanceNonceAccountInstructionData(data) {
|
|
1095
|
+
return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
|
|
1096
|
+
}
|
|
1097
|
+
function isDurableNonceTransaction(transaction) {
|
|
1098
|
+
return "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.nonce === "string" && transaction.instructions[0] != null && isAdvanceNonceAccountInstruction(transaction.instructions[0]);
|
|
1099
|
+
}
|
|
1100
|
+
function setTransactionLifetimeUsingDurableNonce({
|
|
1101
|
+
nonce,
|
|
1102
|
+
nonceAccountAddress,
|
|
1103
|
+
nonceAuthorityAddress
|
|
1104
|
+
}, transaction) {
|
|
1105
|
+
const isAlreadyDurableNonceTransaction = isDurableNonceTransaction(transaction);
|
|
1106
|
+
if (isAlreadyDurableNonceTransaction && transaction.lifetimeConstraint.nonce === nonce && transaction.instructions[0].accounts[0].address === nonceAccountAddress && transaction.instructions[0].accounts[2].address === nonceAuthorityAddress) {
|
|
1107
|
+
return transaction;
|
|
1108
|
+
}
|
|
1109
|
+
const out = {
|
|
1110
|
+
...getUnsignedTransaction(transaction),
|
|
1111
|
+
instructions: [
|
|
1112
|
+
createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
|
|
1113
|
+
...isAlreadyDurableNonceTransaction ? transaction.instructions.slice(1) : transaction.instructions
|
|
1114
|
+
],
|
|
1115
|
+
lifetimeConstraint: {
|
|
1116
|
+
nonce
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
Object.freeze(out);
|
|
1120
|
+
return out;
|
|
1121
|
+
}
|
|
1122
|
+
function setTransactionFeePayer(feePayer, transaction) {
|
|
1123
|
+
if ("feePayer" in transaction && feePayer === transaction.feePayer) {
|
|
1124
|
+
return transaction;
|
|
1125
|
+
}
|
|
1126
|
+
const out = {
|
|
1127
|
+
...getUnsignedTransaction(transaction),
|
|
1128
|
+
feePayer
|
|
1129
|
+
};
|
|
1130
|
+
Object.freeze(out);
|
|
1131
|
+
return out;
|
|
1132
|
+
}
|
|
1133
|
+
function appendTransactionInstruction(instruction, transaction) {
|
|
1134
|
+
const out = {
|
|
1135
|
+
...getUnsignedTransaction(transaction),
|
|
1136
|
+
instructions: [...transaction.instructions, instruction]
|
|
1137
|
+
};
|
|
1138
|
+
Object.freeze(out);
|
|
1139
|
+
return out;
|
|
1140
|
+
}
|
|
1141
|
+
function prependTransactionInstruction(instruction, transaction) {
|
|
1142
|
+
const out = {
|
|
1143
|
+
...getUnsignedTransaction(transaction),
|
|
1144
|
+
instructions: [instruction, ...transaction.instructions]
|
|
1145
|
+
};
|
|
1146
|
+
Object.freeze(out);
|
|
1147
|
+
return out;
|
|
1148
|
+
}
|
|
1149
|
+
function upsert(addressMap, address, update) {
|
|
1150
|
+
addressMap[address] = update(addressMap[address] ?? { role: AccountRole2.READONLY });
|
|
1151
|
+
}
|
|
1152
|
+
var TYPE = Symbol("AddressMapTypeProperty");
|
|
1153
|
+
function getAddressMapFromInstructions(feePayer, instructions) {
|
|
1154
|
+
const addressMap = {
|
|
1155
|
+
[feePayer]: { [TYPE]: 0, role: AccountRole2.WRITABLE_SIGNER }
|
|
1156
|
+
};
|
|
1157
|
+
const addressesOfInvokedPrograms = /* @__PURE__ */ new Set();
|
|
1158
|
+
for (const instruction of instructions) {
|
|
1159
|
+
upsert(addressMap, instruction.programAddress, (entry) => {
|
|
1160
|
+
addressesOfInvokedPrograms.add(instruction.programAddress);
|
|
1161
|
+
if (TYPE in entry) {
|
|
1162
|
+
if (isWritableRole2(entry.role)) {
|
|
1163
|
+
switch (entry[TYPE]) {
|
|
1164
|
+
case 0:
|
|
1165
|
+
throw new Error(
|
|
1166
|
+
`This transaction includes an address (\`${instruction.programAddress}\`) which is both invoked and set as the fee payer. Program addresses may not pay fees.`
|
|
1167
|
+
);
|
|
1168
|
+
default:
|
|
1169
|
+
throw new Error(
|
|
1170
|
+
`This transaction includes an address (\`${instruction.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`
|
|
1171
|
+
);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
if (entry[TYPE] === 2) {
|
|
1175
|
+
return entry;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
return { [TYPE]: 2, role: AccountRole2.READONLY };
|
|
1179
|
+
});
|
|
1180
|
+
let addressComparator;
|
|
1181
|
+
if (!instruction.accounts) {
|
|
1182
|
+
continue;
|
|
1183
|
+
}
|
|
1184
|
+
for (const account of instruction.accounts) {
|
|
1185
|
+
upsert(addressMap, account.address, (entry) => {
|
|
1186
|
+
const {
|
|
1187
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1188
|
+
address: _,
|
|
1189
|
+
...accountMeta
|
|
1190
|
+
} = account;
|
|
1191
|
+
if (TYPE in entry) {
|
|
1192
|
+
switch (entry[TYPE]) {
|
|
1193
|
+
case 0:
|
|
1194
|
+
return entry;
|
|
1195
|
+
case 1: {
|
|
1196
|
+
const nextRole = mergeRoles2(entry.role, accountMeta.role);
|
|
1197
|
+
if ("lookupTableAddress" in accountMeta) {
|
|
1198
|
+
const shouldReplaceEntry = (
|
|
1199
|
+
// Consider using the new LOOKUP_TABLE if its address is different...
|
|
1200
|
+
entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
|
|
1201
|
+
(addressComparator || (addressComparator = getBase58EncodedAddressComparator()))(
|
|
1202
|
+
accountMeta.lookupTableAddress,
|
|
1203
|
+
entry.lookupTableAddress
|
|
1204
|
+
) < 0
|
|
1205
|
+
);
|
|
1206
|
+
if (shouldReplaceEntry) {
|
|
1207
|
+
return {
|
|
1208
|
+
[TYPE]: 1,
|
|
1209
|
+
...accountMeta,
|
|
1210
|
+
role: nextRole
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1213
|
+
} else if (isSignerRole2(accountMeta.role)) {
|
|
1214
|
+
return {
|
|
1215
|
+
[TYPE]: 2,
|
|
1216
|
+
role: nextRole
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
if (entry.role !== nextRole) {
|
|
1220
|
+
return {
|
|
1221
|
+
...entry,
|
|
1222
|
+
role: nextRole
|
|
1223
|
+
};
|
|
1224
|
+
} else {
|
|
1225
|
+
return entry;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
case 2: {
|
|
1229
|
+
const nextRole = mergeRoles2(entry.role, accountMeta.role);
|
|
1230
|
+
if (
|
|
1231
|
+
// Check to see if this address represents a program that is invoked
|
|
1232
|
+
// in this transaction.
|
|
1233
|
+
addressesOfInvokedPrograms.has(account.address)
|
|
1234
|
+
) {
|
|
1235
|
+
if (isWritableRole2(accountMeta.role)) {
|
|
1236
|
+
throw new Error(
|
|
1237
|
+
`This transaction includes an address (\`${account.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`
|
|
1238
|
+
);
|
|
1239
|
+
}
|
|
1240
|
+
if (entry.role !== nextRole) {
|
|
1241
|
+
return {
|
|
1242
|
+
...entry,
|
|
1243
|
+
role: nextRole
|
|
1244
|
+
};
|
|
1245
|
+
} else {
|
|
1246
|
+
return entry;
|
|
1247
|
+
}
|
|
1248
|
+
} else if ("lookupTableAddress" in accountMeta && // Static accounts can be 'upgraded' to lookup table accounts as
|
|
1249
|
+
// long as they are not require to sign the transaction.
|
|
1250
|
+
!isSignerRole2(entry.role)) {
|
|
1251
|
+
return {
|
|
1252
|
+
...accountMeta,
|
|
1253
|
+
[TYPE]: 1,
|
|
1254
|
+
role: nextRole
|
|
1255
|
+
};
|
|
1256
|
+
} else {
|
|
1257
|
+
if (entry.role !== nextRole) {
|
|
1258
|
+
return {
|
|
1259
|
+
...entry,
|
|
1260
|
+
role: nextRole
|
|
1261
|
+
};
|
|
1262
|
+
} else {
|
|
1263
|
+
return entry;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
if ("lookupTableAddress" in accountMeta) {
|
|
1270
|
+
return {
|
|
1271
|
+
...accountMeta,
|
|
1272
|
+
[TYPE]: 1
|
|
1273
|
+
/* LOOKUP_TABLE */
|
|
1274
|
+
};
|
|
1275
|
+
} else {
|
|
1276
|
+
return {
|
|
1277
|
+
...accountMeta,
|
|
1278
|
+
[TYPE]: 2
|
|
1279
|
+
/* STATIC */
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
return addressMap;
|
|
1286
|
+
}
|
|
1287
|
+
function getOrderedAccountsFromAddressMap(addressMap) {
|
|
1288
|
+
let addressComparator;
|
|
1289
|
+
const orderedAccounts = Object.entries(addressMap).sort(([leftAddress, leftEntry], [rightAddress, rightEntry]) => {
|
|
1290
|
+
if (leftEntry[TYPE] !== rightEntry[TYPE]) {
|
|
1291
|
+
if (leftEntry[TYPE] === 0) {
|
|
1292
|
+
return -1;
|
|
1293
|
+
} else if (rightEntry[TYPE] === 0) {
|
|
1294
|
+
return 1;
|
|
1295
|
+
} else if (leftEntry[TYPE] === 2) {
|
|
1296
|
+
return -1;
|
|
1297
|
+
} else if (rightEntry[TYPE] === 2) {
|
|
1298
|
+
return 1;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
const leftIsSigner = isSignerRole2(leftEntry.role);
|
|
1302
|
+
if (leftIsSigner !== isSignerRole2(rightEntry.role)) {
|
|
1303
|
+
return leftIsSigner ? -1 : 1;
|
|
1304
|
+
}
|
|
1305
|
+
const leftIsWritable = isWritableRole2(leftEntry.role);
|
|
1306
|
+
if (leftIsWritable !== isWritableRole2(rightEntry.role)) {
|
|
1307
|
+
return leftIsWritable ? -1 : 1;
|
|
1308
|
+
}
|
|
1309
|
+
addressComparator || (addressComparator = getBase58EncodedAddressComparator());
|
|
1310
|
+
if (leftEntry[TYPE] === 1 && rightEntry[TYPE] === 1 && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {
|
|
1311
|
+
return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);
|
|
1312
|
+
} else {
|
|
1313
|
+
return addressComparator(leftAddress, rightAddress);
|
|
1314
|
+
}
|
|
1315
|
+
}).map(([address, addressMeta]) => ({
|
|
1316
|
+
address,
|
|
1317
|
+
...addressMeta
|
|
1318
|
+
}));
|
|
1319
|
+
return orderedAccounts;
|
|
1320
|
+
}
|
|
1321
|
+
function getCompiledAddressTableLookups(orderedAccounts) {
|
|
1322
|
+
var _a;
|
|
1323
|
+
const index = {};
|
|
1324
|
+
for (const account of orderedAccounts) {
|
|
1325
|
+
if (!("lookupTableAddress" in account)) {
|
|
1326
|
+
continue;
|
|
1327
|
+
}
|
|
1328
|
+
const entry = index[_a = account.lookupTableAddress] || (index[_a] = {
|
|
1329
|
+
readableIndices: [],
|
|
1330
|
+
writableIndices: []
|
|
1331
|
+
});
|
|
1332
|
+
if (account.role === AccountRole2.WRITABLE) {
|
|
1333
|
+
entry.writableIndices.push(account.addressIndex);
|
|
1334
|
+
} else {
|
|
1335
|
+
entry.readableIndices.push(account.addressIndex);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
return Object.keys(index).sort(getBase58EncodedAddressComparator()).map((lookupTableAddress) => ({
|
|
1339
|
+
lookupTableAddress,
|
|
1340
|
+
...index[lookupTableAddress]
|
|
1341
|
+
}));
|
|
1342
|
+
}
|
|
1343
|
+
function getCompiledMessageHeader(orderedAccounts) {
|
|
1344
|
+
let numReadonlyNonSignerAccounts = 0;
|
|
1345
|
+
let numReadonlySignerAccounts = 0;
|
|
1346
|
+
let numSignerAccounts = 0;
|
|
1347
|
+
for (const account of orderedAccounts) {
|
|
1348
|
+
if ("lookupTableAddress" in account) {
|
|
1349
|
+
break;
|
|
1350
|
+
}
|
|
1351
|
+
const accountIsWritable = isWritableRole2(account.role);
|
|
1352
|
+
if (isSignerRole2(account.role)) {
|
|
1353
|
+
numSignerAccounts++;
|
|
1354
|
+
if (!accountIsWritable) {
|
|
1355
|
+
numReadonlySignerAccounts++;
|
|
1356
|
+
}
|
|
1357
|
+
} else if (!accountIsWritable) {
|
|
1358
|
+
numReadonlyNonSignerAccounts++;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
return {
|
|
1362
|
+
numReadonlyNonSignerAccounts,
|
|
1363
|
+
numReadonlySignerAccounts,
|
|
1364
|
+
numSignerAccounts
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
function getAccountIndex(orderedAccounts) {
|
|
1368
|
+
const out = {};
|
|
1369
|
+
for (const [index, account] of orderedAccounts.entries()) {
|
|
1370
|
+
out[account.address] = index;
|
|
1371
|
+
}
|
|
1372
|
+
return out;
|
|
1373
|
+
}
|
|
1374
|
+
function getCompiledInstructions(instructions, orderedAccounts) {
|
|
1375
|
+
const accountIndex = getAccountIndex(orderedAccounts);
|
|
1376
|
+
return instructions.map(({ accounts, data, programAddress }) => {
|
|
1377
|
+
return {
|
|
1378
|
+
programAddressIndex: accountIndex[programAddress],
|
|
1379
|
+
...accounts ? { accountIndices: accounts.map(({ address }) => accountIndex[address]) } : null,
|
|
1380
|
+
...data ? { data } : null
|
|
1381
|
+
};
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
function getCompiledLifetimeToken(lifetimeConstraint) {
|
|
1385
|
+
if ("nonce" in lifetimeConstraint) {
|
|
1386
|
+
return lifetimeConstraint.nonce;
|
|
1387
|
+
}
|
|
1388
|
+
return lifetimeConstraint.blockhash;
|
|
1389
|
+
}
|
|
1390
|
+
function getCompiledStaticAccounts(orderedAccounts) {
|
|
1391
|
+
const firstLookupTableAccountIndex = orderedAccounts.findIndex((account) => "lookupTableAddress" in account);
|
|
1392
|
+
const orderedStaticAccounts = firstLookupTableAccountIndex === -1 ? orderedAccounts : orderedAccounts.slice(0, firstLookupTableAccountIndex);
|
|
1393
|
+
return orderedStaticAccounts.map(({ address }) => address);
|
|
1394
|
+
}
|
|
1395
|
+
function compileMessage(transaction) {
|
|
1396
|
+
const addressMap = getAddressMapFromInstructions(transaction.feePayer, transaction.instructions);
|
|
1397
|
+
const orderedAccounts = getOrderedAccountsFromAddressMap(addressMap);
|
|
1398
|
+
return {
|
|
1399
|
+
...transaction.version !== "legacy" ? { addressTableLookups: getCompiledAddressTableLookups(orderedAccounts) } : null,
|
|
1400
|
+
header: getCompiledMessageHeader(orderedAccounts),
|
|
1401
|
+
instructions: getCompiledInstructions(transaction.instructions, orderedAccounts),
|
|
1402
|
+
lifetimeToken: getCompiledLifetimeToken(transaction.lifetimeConstraint),
|
|
1403
|
+
staticAccounts: getCompiledStaticAccounts(orderedAccounts),
|
|
1404
|
+
version: transaction.version
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
function getAddressTableLookupCodec() {
|
|
1408
|
+
return struct(
|
|
1409
|
+
[
|
|
1410
|
+
[
|
|
1411
|
+
"lookupTableAddress",
|
|
1412
|
+
getBase58EncodedAddressCodec(
|
|
1413
|
+
{
|
|
1414
|
+
description: "The address of the address lookup table account from which instruction addresses should be looked up"
|
|
1415
|
+
}
|
|
1416
|
+
)
|
|
1417
|
+
],
|
|
1418
|
+
[
|
|
1419
|
+
"writableIndices",
|
|
1420
|
+
array(u8(), {
|
|
1421
|
+
...{
|
|
1422
|
+
description: "The indices of the accounts in the lookup table that should be loaded as writeable"
|
|
1423
|
+
} ,
|
|
1424
|
+
size: shortU16()
|
|
1425
|
+
})
|
|
1426
|
+
],
|
|
1427
|
+
[
|
|
1428
|
+
"readableIndices",
|
|
1429
|
+
array(u8(), {
|
|
1430
|
+
...{
|
|
1431
|
+
description: "The indices of the accounts in the lookup table that should be loaded as read-only"
|
|
1432
|
+
} ,
|
|
1433
|
+
size: shortU16()
|
|
1434
|
+
})
|
|
1435
|
+
]
|
|
1436
|
+
],
|
|
1437
|
+
{
|
|
1438
|
+
description: "A pointer to the address of an address lookup table, along with the readonly/writeable indices of the addresses that should be loaded from it"
|
|
1439
|
+
}
|
|
1440
|
+
);
|
|
1441
|
+
}
|
|
1442
|
+
function getMessageHeaderCodec() {
|
|
1443
|
+
return struct(
|
|
1444
|
+
[
|
|
1445
|
+
[
|
|
1446
|
+
"numSignerAccounts",
|
|
1447
|
+
u8(
|
|
1448
|
+
{
|
|
1449
|
+
description: "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction"
|
|
1450
|
+
}
|
|
1451
|
+
)
|
|
1452
|
+
],
|
|
1453
|
+
[
|
|
1454
|
+
"numReadonlySignerAccounts",
|
|
1455
|
+
u8(
|
|
1456
|
+
{
|
|
1457
|
+
description: "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction, but may not be writable"
|
|
1458
|
+
}
|
|
1459
|
+
)
|
|
1460
|
+
],
|
|
1461
|
+
[
|
|
1462
|
+
"numReadonlyNonSignerAccounts",
|
|
1463
|
+
u8(
|
|
1464
|
+
{
|
|
1465
|
+
description: "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable"
|
|
1466
|
+
}
|
|
1467
|
+
)
|
|
1468
|
+
]
|
|
1469
|
+
],
|
|
1470
|
+
{
|
|
1471
|
+
description: "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses"
|
|
1472
|
+
}
|
|
1473
|
+
);
|
|
1474
|
+
}
|
|
1475
|
+
function getInstructionCodec() {
|
|
1476
|
+
return mapSerializer(
|
|
1477
|
+
struct([
|
|
1478
|
+
[
|
|
1479
|
+
"programAddressIndex",
|
|
1480
|
+
u8(
|
|
1481
|
+
{
|
|
1482
|
+
description: "The index of the program being called, according to the well-ordered accounts list for this transaction"
|
|
1483
|
+
}
|
|
1484
|
+
)
|
|
1485
|
+
],
|
|
1486
|
+
[
|
|
1487
|
+
"accountIndices",
|
|
1488
|
+
array(
|
|
1489
|
+
u8({
|
|
1490
|
+
description: "The index of an account, according to the well-ordered accounts list for this transaction"
|
|
1491
|
+
}),
|
|
1492
|
+
{
|
|
1493
|
+
description: "An optional list of account indices, according to the well-ordered accounts list for this transaction, in the order in which the program being called expects them" ,
|
|
1494
|
+
size: shortU16()
|
|
1495
|
+
}
|
|
1496
|
+
)
|
|
1497
|
+
],
|
|
1498
|
+
[
|
|
1499
|
+
"data",
|
|
1500
|
+
bytes({
|
|
1501
|
+
description: "An optional buffer of data passed to the instruction" ,
|
|
1502
|
+
size: shortU16()
|
|
1503
|
+
})
|
|
1504
|
+
]
|
|
1505
|
+
]),
|
|
1506
|
+
(value) => {
|
|
1507
|
+
if (value.accountIndices !== void 0 && value.data !== void 0) {
|
|
1508
|
+
return value;
|
|
1509
|
+
}
|
|
1510
|
+
return {
|
|
1511
|
+
...value,
|
|
1512
|
+
accountIndices: value.accountIndices ?? [],
|
|
1513
|
+
data: value.data ?? new Uint8Array(0)
|
|
1514
|
+
};
|
|
1515
|
+
},
|
|
1516
|
+
(value) => {
|
|
1517
|
+
if (value.accountIndices.length && value.data.byteLength) {
|
|
1518
|
+
return value;
|
|
1519
|
+
}
|
|
1520
|
+
const { accountIndices, data, ...rest } = value;
|
|
1521
|
+
return {
|
|
1522
|
+
...rest,
|
|
1523
|
+
...accountIndices.length ? { accountIndices } : null,
|
|
1524
|
+
...data.byteLength ? { data } : null
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
);
|
|
1528
|
+
}
|
|
1529
|
+
function getError(type, name) {
|
|
1530
|
+
const functionSuffix = name + type[0].toUpperCase() + type.slice(1);
|
|
1531
|
+
return new Error(
|
|
1532
|
+
`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}`
|
|
1533
|
+
);
|
|
1534
|
+
}
|
|
1535
|
+
function getUnimplementedDecoder(name) {
|
|
1536
|
+
return () => {
|
|
1537
|
+
throw getError("decoder", name);
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
var VERSION_FLAG_MASK = 128;
|
|
1541
|
+
var BASE_CONFIG = {
|
|
1542
|
+
description: "A single byte that encodes the version of the transaction" ,
|
|
1543
|
+
fixedSize: null,
|
|
1544
|
+
maxSize: 1
|
|
1545
|
+
};
|
|
1546
|
+
function deserialize(bytes3, offset = 0) {
|
|
1547
|
+
const firstByte = bytes3[offset];
|
|
1548
|
+
if ((firstByte & VERSION_FLAG_MASK) === 0) {
|
|
1549
|
+
return ["legacy", offset];
|
|
1550
|
+
} else {
|
|
1551
|
+
const version = firstByte ^ VERSION_FLAG_MASK;
|
|
1552
|
+
return [version, offset + 1];
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
function serialize(value) {
|
|
1556
|
+
if (value === "legacy") {
|
|
1557
|
+
return new Uint8Array();
|
|
1558
|
+
}
|
|
1559
|
+
if (value < 0 || value > 127) {
|
|
1560
|
+
throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
|
|
1561
|
+
}
|
|
1562
|
+
return new Uint8Array([value | VERSION_FLAG_MASK]);
|
|
1563
|
+
}
|
|
1564
|
+
function getTransactionVersionCodec() {
|
|
1565
|
+
return {
|
|
1566
|
+
...BASE_CONFIG,
|
|
1567
|
+
deserialize,
|
|
1568
|
+
serialize
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
var BASE_CONFIG2 = {
|
|
1572
|
+
description: "The wire format of a Solana transaction message" ,
|
|
1573
|
+
fixedSize: null,
|
|
1574
|
+
maxSize: null
|
|
1575
|
+
};
|
|
1576
|
+
function serialize2(compiledMessage) {
|
|
1577
|
+
if (compiledMessage.version === "legacy") {
|
|
1578
|
+
return struct(getPreludeStructSerializerTuple()).serialize(compiledMessage);
|
|
1579
|
+
} else {
|
|
1580
|
+
return mapSerializer(
|
|
1581
|
+
struct([
|
|
1582
|
+
...getPreludeStructSerializerTuple(),
|
|
1583
|
+
["addressTableLookups", getAddressTableLookupsSerializer()]
|
|
1584
|
+
]),
|
|
1585
|
+
(value) => {
|
|
1586
|
+
if (value.version === "legacy") {
|
|
1587
|
+
return value;
|
|
1588
|
+
}
|
|
1589
|
+
return {
|
|
1590
|
+
...value,
|
|
1591
|
+
addressTableLookups: value.addressTableLookups ?? []
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
).serialize(compiledMessage);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
function getPreludeStructSerializerTuple() {
|
|
1598
|
+
return [
|
|
1599
|
+
["version", getTransactionVersionCodec()],
|
|
1600
|
+
["header", getMessageHeaderCodec()],
|
|
1601
|
+
[
|
|
1602
|
+
"staticAccounts",
|
|
1603
|
+
array(getBase58EncodedAddressCodec(), {
|
|
1604
|
+
description: "A compact-array of static account addresses belonging to this transaction" ,
|
|
1605
|
+
size: shortU16()
|
|
1606
|
+
})
|
|
1607
|
+
],
|
|
1608
|
+
[
|
|
1609
|
+
"lifetimeToken",
|
|
1610
|
+
string({
|
|
1611
|
+
description: "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" ,
|
|
1612
|
+
encoding: base58,
|
|
1613
|
+
size: 32
|
|
1614
|
+
})
|
|
1615
|
+
],
|
|
1616
|
+
[
|
|
1617
|
+
"instructions",
|
|
1618
|
+
array(getInstructionCodec(), {
|
|
1619
|
+
description: "A compact-array of instructions belonging to this transaction" ,
|
|
1620
|
+
size: shortU16()
|
|
1621
|
+
})
|
|
1622
|
+
]
|
|
1623
|
+
];
|
|
1624
|
+
}
|
|
1625
|
+
function getAddressTableLookupsSerializer() {
|
|
1626
|
+
return array(getAddressTableLookupCodec(), {
|
|
1627
|
+
...{ description: "A compact array of address table lookups belonging to this transaction" } ,
|
|
1628
|
+
size: shortU16()
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
function getCompiledMessageEncoder() {
|
|
1632
|
+
return {
|
|
1633
|
+
...BASE_CONFIG2,
|
|
1634
|
+
deserialize: getUnimplementedDecoder("CompiledMessage"),
|
|
1635
|
+
serialize: serialize2
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
async function getCompiledMessageSignature(message, secretKey) {
|
|
1639
|
+
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
|
|
1640
|
+
const signature = await signBytes(secretKey, wireMessageBytes);
|
|
1641
|
+
return signature;
|
|
1642
|
+
}
|
|
1643
|
+
async function signTransaction(keyPair, transaction) {
|
|
1644
|
+
const compiledMessage = compileMessage(transaction);
|
|
1645
|
+
const [signerPublicKey, signature] = await Promise.all([
|
|
1646
|
+
getBase58EncodedAddressFromPublicKey(keyPair.publicKey),
|
|
1647
|
+
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
|
|
1648
|
+
]);
|
|
1649
|
+
const nextSignatures = {
|
|
1650
|
+
..."signatures" in transaction ? transaction.signatures : null,
|
|
1651
|
+
...{ [signerPublicKey]: signature }
|
|
1652
|
+
};
|
|
1653
|
+
const out = {
|
|
1654
|
+
...transaction,
|
|
1655
|
+
signatures: nextSignatures
|
|
1656
|
+
};
|
|
1657
|
+
Object.freeze(out);
|
|
1658
|
+
return out;
|
|
1659
|
+
}
|
|
1660
|
+
function getCompiledTransaction(transaction) {
|
|
1661
|
+
const compiledMessage = compileMessage(transaction);
|
|
1662
|
+
let signatures;
|
|
1663
|
+
if ("signatures" in transaction) {
|
|
1664
|
+
signatures = [];
|
|
1665
|
+
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
|
|
1666
|
+
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
|
|
1667
|
+
}
|
|
1668
|
+
} else {
|
|
1669
|
+
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
|
|
1670
|
+
}
|
|
1671
|
+
return {
|
|
1672
|
+
compiledMessage,
|
|
1673
|
+
signatures
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
var BASE_CONFIG3 = {
|
|
1677
|
+
description: "The wire format of a Solana transaction" ,
|
|
1678
|
+
fixedSize: null,
|
|
1679
|
+
maxSize: null
|
|
1680
|
+
};
|
|
1681
|
+
function serialize3(transaction) {
|
|
1682
|
+
const compiledTransaction = getCompiledTransaction(transaction);
|
|
1683
|
+
return struct([
|
|
1684
|
+
[
|
|
1685
|
+
"signatures",
|
|
1686
|
+
array(bytes({ size: 64 }), {
|
|
1687
|
+
...{ description: "A compact array of 64-byte, base-64 encoded Ed25519 signatures" } ,
|
|
1688
|
+
size: shortU16()
|
|
1689
|
+
})
|
|
1690
|
+
],
|
|
1691
|
+
["compiledMessage", getCompiledMessageEncoder()]
|
|
1692
|
+
]).serialize(compiledTransaction);
|
|
1693
|
+
}
|
|
1694
|
+
function getTransactionEncoder() {
|
|
1695
|
+
return {
|
|
1696
|
+
...BASE_CONFIG3,
|
|
1697
|
+
deserialize: getUnimplementedDecoder("CompiledMessage"),
|
|
1698
|
+
serialize: serialize3
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
1701
|
+
function getBase64EncodedWireTransaction(transaction) {
|
|
1702
|
+
const wireTransactionBytes = getTransactionEncoder().serialize(transaction);
|
|
1703
|
+
{
|
|
1704
|
+
return btoa(String.fromCharCode(...wireTransactionBytes));
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
// src/rpc.ts
|
|
1709
|
+
init_env_shim();
|
|
1710
|
+
|
|
1711
|
+
// ../rpc-core/dist/index.browser.js
|
|
558
1712
|
init_env_shim();
|
|
559
1713
|
function visitNode(value, keyPath, onIntegerOverflow) {
|
|
560
1714
|
if (Array.isArray(value)) {
|
|
@@ -633,12 +1787,87 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
633
1787
|
["value", "data", "parsed", "info", "votes", KEYPATH_WILDCARD, "confirmationCount"]
|
|
634
1788
|
],
|
|
635
1789
|
getBlockTime: [[]],
|
|
1790
|
+
getClusterNodes: [
|
|
1791
|
+
[KEYPATH_WILDCARD, "featureSet"],
|
|
1792
|
+
[KEYPATH_WILDCARD, "shredVersion"]
|
|
1793
|
+
],
|
|
1794
|
+
getInflationGovernor: [["initial"], ["foundation"], ["foundationTerm"], ["taper"], ["terminal"]],
|
|
1795
|
+
getInflationRate: [["foundation"], ["total"], ["validator"]],
|
|
636
1796
|
getInflationReward: [[KEYPATH_WILDCARD, "commission"]],
|
|
1797
|
+
getMultipleAccounts: [
|
|
1798
|
+
// parsed AddressTableLookup account
|
|
1799
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "lastExtendedSlotStartIndex"],
|
|
1800
|
+
// parsed Config account
|
|
1801
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "slashPenalty"],
|
|
1802
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "warmupCooldownRate"],
|
|
1803
|
+
// parsed Token/Token22 token account
|
|
1804
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "tokenAmount", "decimals"],
|
|
1805
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "tokenAmount", "uiAmount"],
|
|
1806
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "rentExemptReserve", "decimals"],
|
|
1807
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "delegatedAmount", "decimals"],
|
|
1808
|
+
[
|
|
1809
|
+
"value",
|
|
1810
|
+
KEYPATH_WILDCARD,
|
|
1811
|
+
"data",
|
|
1812
|
+
"parsed",
|
|
1813
|
+
"info",
|
|
1814
|
+
"extensions",
|
|
1815
|
+
KEYPATH_WILDCARD,
|
|
1816
|
+
"state",
|
|
1817
|
+
"olderTransferFee",
|
|
1818
|
+
"transferFeeBasisPoints"
|
|
1819
|
+
],
|
|
1820
|
+
[
|
|
1821
|
+
"value",
|
|
1822
|
+
KEYPATH_WILDCARD,
|
|
1823
|
+
"data",
|
|
1824
|
+
"parsed",
|
|
1825
|
+
"info",
|
|
1826
|
+
"extensions",
|
|
1827
|
+
KEYPATH_WILDCARD,
|
|
1828
|
+
"state",
|
|
1829
|
+
"newerTransferFee",
|
|
1830
|
+
"transferFeeBasisPoints"
|
|
1831
|
+
],
|
|
1832
|
+
[
|
|
1833
|
+
"value",
|
|
1834
|
+
KEYPATH_WILDCARD,
|
|
1835
|
+
"data",
|
|
1836
|
+
"parsed",
|
|
1837
|
+
"info",
|
|
1838
|
+
"extensions",
|
|
1839
|
+
KEYPATH_WILDCARD,
|
|
1840
|
+
"state",
|
|
1841
|
+
"preUpdateAverageRate"
|
|
1842
|
+
],
|
|
1843
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "currentRate"],
|
|
1844
|
+
// parsed Token/Token22 mint account
|
|
1845
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "decimals"],
|
|
1846
|
+
// parsed Token/Token22 multisig account
|
|
1847
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "numRequiredSigners"],
|
|
1848
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "numValidSigners"],
|
|
1849
|
+
// parsed Stake account
|
|
1850
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "stake", "delegation", "warmupCooldownRate"],
|
|
1851
|
+
// parsed Sysvar rent account
|
|
1852
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "exemptionThreshold"],
|
|
1853
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "burnPercent"],
|
|
1854
|
+
// parsed Vote account
|
|
1855
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "commission"],
|
|
1856
|
+
["value", KEYPATH_WILDCARD, "data", "parsed", "info", "votes", KEYPATH_WILDCARD, "confirmationCount"]
|
|
1857
|
+
],
|
|
637
1858
|
getRecentPerformanceSamples: [[KEYPATH_WILDCARD, "samplePeriodSecs"]],
|
|
1859
|
+
getTokenAccountBalance: [
|
|
1860
|
+
["value", "decimals"],
|
|
1861
|
+
["value", "uiAmount"]
|
|
1862
|
+
],
|
|
638
1863
|
getTokenLargestAccounts: [
|
|
639
1864
|
["value", KEYPATH_WILDCARD, "decimals"],
|
|
640
1865
|
["value", KEYPATH_WILDCARD, "uiAmount"]
|
|
641
1866
|
],
|
|
1867
|
+
getTokenSupply: [
|
|
1868
|
+
["value", "decimals"],
|
|
1869
|
+
["value", "uiAmount"]
|
|
1870
|
+
],
|
|
642
1871
|
getTransaction: [
|
|
643
1872
|
["meta", "preTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
|
|
644
1873
|
["meta", "preTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"],
|
|
@@ -656,6 +1885,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
656
1885
|
["transaction", "message", "header", "numReadonlyUnsignedAccounts"],
|
|
657
1886
|
["transaction", "message", "header", "numRequiredSignatures"]
|
|
658
1887
|
],
|
|
1888
|
+
getVersion: [["feature-set"]],
|
|
659
1889
|
getVoteAccounts: [
|
|
660
1890
|
["current", KEYPATH_WILDCARD, "commission"],
|
|
661
1891
|
["delinquent", KEYPATH_WILDCARD, "commission"]
|
|
@@ -1022,20 +2252,33 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1022
2252
|
}
|
|
1023
2253
|
|
|
1024
2254
|
exports.AccountRole = AccountRole;
|
|
2255
|
+
exports.appendTransactionInstruction = appendTransactionInstruction;
|
|
1025
2256
|
exports.assertIsBase58EncodedAddress = assertIsBase58EncodedAddress;
|
|
2257
|
+
exports.assertIsBlockhash = assertIsBlockhash;
|
|
2258
|
+
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
1026
2259
|
exports.createDefaultRpcTransport = createDefaultRpcTransport;
|
|
1027
2260
|
exports.createSolanaRpc = createSolanaRpc;
|
|
2261
|
+
exports.createTransaction = createTransaction;
|
|
1028
2262
|
exports.downgradeRoleToNonSigner = downgradeRoleToNonSigner;
|
|
1029
2263
|
exports.downgradeRoleToReadonly = downgradeRoleToReadonly;
|
|
1030
2264
|
exports.generateKeyPair = generateKeyPair;
|
|
1031
2265
|
exports.getBase58EncodedAddressCodec = getBase58EncodedAddressCodec;
|
|
1032
2266
|
exports.getBase58EncodedAddressComparator = getBase58EncodedAddressComparator;
|
|
1033
2267
|
exports.getBase58EncodedAddressFromPublicKey = getBase58EncodedAddressFromPublicKey;
|
|
2268
|
+
exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
|
|
2269
|
+
exports.getProgramDerivedAddress = getProgramDerivedAddress;
|
|
1034
2270
|
exports.isSignerRole = isSignerRole;
|
|
1035
2271
|
exports.isWritableRole = isWritableRole;
|
|
1036
2272
|
exports.mergeRoles = mergeRoles;
|
|
2273
|
+
exports.prependTransactionInstruction = prependTransactionInstruction;
|
|
2274
|
+
exports.setTransactionFeePayer = setTransactionFeePayer;
|
|
2275
|
+
exports.setTransactionLifetimeUsingBlockhash = setTransactionLifetimeUsingBlockhash;
|
|
2276
|
+
exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
|
|
2277
|
+
exports.signBytes = signBytes;
|
|
2278
|
+
exports.signTransaction = signTransaction;
|
|
1037
2279
|
exports.upgradeRoleToSigner = upgradeRoleToSigner;
|
|
1038
2280
|
exports.upgradeRoleToWritable = upgradeRoleToWritable;
|
|
2281
|
+
exports.verifySignature = verifySignature;
|
|
1039
2282
|
|
|
1040
2283
|
return exports;
|
|
1041
2284
|
|