@solana/signers 2.0.0-experimental.40c54bd → 2.0.0-experimental.699bde0
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.
|
@@ -41,7 +41,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
41
41
|
var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
|
|
42
42
|
function fixCodecHelper(data, fixedBytes, description) {
|
|
43
43
|
return {
|
|
44
|
-
description: description
|
|
44
|
+
description: description != null ? description : `fixed(${fixedBytes}, ${data.description})`,
|
|
45
45
|
fixedSize: fixedBytes,
|
|
46
46
|
maxSize: fixedBytes
|
|
47
47
|
};
|
|
@@ -86,6 +86,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
function sharedNumberFactory(input) {
|
|
89
|
+
var _a;
|
|
89
90
|
let littleEndian;
|
|
90
91
|
let defaultDescription = input.name;
|
|
91
92
|
if (input.size > 1) {
|
|
@@ -93,7 +94,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
93
94
|
defaultDescription += littleEndian ? "(le)" : "(be)";
|
|
94
95
|
}
|
|
95
96
|
return {
|
|
96
|
-
description: input.config.description
|
|
97
|
+
description: (_a = input.config.description) != null ? _a : defaultDescription,
|
|
97
98
|
fixedSize: input.size,
|
|
98
99
|
littleEndian,
|
|
99
100
|
maxSize: input.size
|
|
@@ -130,31 +131,34 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
133
|
function toArrayBuffer(bytes, offset, length) {
|
|
133
|
-
const bytesOffset = bytes.byteOffset + (offset
|
|
134
|
-
const bytesLength = length
|
|
134
|
+
const bytesOffset = bytes.byteOffset + (offset != null ? offset : 0);
|
|
135
|
+
const bytesLength = length != null ? length : bytes.byteLength;
|
|
135
136
|
return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength);
|
|
136
137
|
}
|
|
137
|
-
var getShortU16Encoder = (config = {}) =>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
bytes[ii
|
|
138
|
+
var getShortU16Encoder = (config = {}) => {
|
|
139
|
+
var _a;
|
|
140
|
+
return {
|
|
141
|
+
description: (_a = config.description) != null ? _a : "shortU16",
|
|
142
|
+
encode: (value) => {
|
|
143
|
+
assertNumberIsBetweenForCodec("shortU16", 0, 65535, value);
|
|
144
|
+
const bytes = [0];
|
|
145
|
+
for (let ii = 0; ; ii += 1) {
|
|
146
|
+
const alignedValue = value >> ii * 7;
|
|
147
|
+
if (alignedValue === 0) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
const nextSevenBits = 127 & alignedValue;
|
|
151
|
+
bytes[ii] = nextSevenBits;
|
|
152
|
+
if (ii > 0) {
|
|
153
|
+
bytes[ii - 1] |= 128;
|
|
154
|
+
}
|
|
151
155
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
156
|
+
return new Uint8Array(bytes);
|
|
157
|
+
},
|
|
158
|
+
fixedSize: null,
|
|
159
|
+
maxSize: 3
|
|
160
|
+
};
|
|
161
|
+
};
|
|
158
162
|
var getU32Encoder = (config = {}) => numberEncoderFactory({
|
|
159
163
|
config,
|
|
160
164
|
name: "u32",
|
|
@@ -272,9 +276,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
272
276
|
};
|
|
273
277
|
};
|
|
274
278
|
var getStringEncoder = (config = {}) => {
|
|
275
|
-
|
|
276
|
-
const
|
|
277
|
-
const
|
|
279
|
+
var _a, _b, _c;
|
|
280
|
+
const size = (_a = config.size) != null ? _a : getU32Encoder();
|
|
281
|
+
const encoding = (_b = config.encoding) != null ? _b : getUtf8Encoder();
|
|
282
|
+
const description = (_c = config.description) != null ? _c : `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
278
283
|
if (size === "variable") {
|
|
279
284
|
return { ...encoding, description };
|
|
280
285
|
}
|
|
@@ -293,9 +298,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
293
298
|
};
|
|
294
299
|
};
|
|
295
300
|
var getStringDecoder = (config = {}) => {
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
const
|
|
301
|
+
var _a, _b, _c;
|
|
302
|
+
const size = (_a = config.size) != null ? _a : getU32Decoder();
|
|
303
|
+
const encoding = (_b = config.encoding) != null ? _b : getUtf8Decoder();
|
|
304
|
+
const description = (_c = config.description) != null ? _c : `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
299
305
|
if (size === "variable") {
|
|
300
306
|
return { ...encoding, description };
|
|
301
307
|
}
|
|
@@ -354,8 +360,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
354
360
|
}
|
|
355
361
|
}
|
|
356
362
|
async function assertKeyGenerationIsAvailable() {
|
|
363
|
+
var _a;
|
|
357
364
|
assertIsSecureContext();
|
|
358
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle
|
|
365
|
+
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.generateKey) !== "function") {
|
|
359
366
|
throw new Error("No key generation implementation could be found");
|
|
360
367
|
}
|
|
361
368
|
if (!await isEd25519CurveSupported(globalThis.crypto.subtle)) {
|
|
@@ -365,14 +372,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
365
372
|
}
|
|
366
373
|
}
|
|
367
374
|
async function assertKeyExporterIsAvailable() {
|
|
375
|
+
var _a;
|
|
368
376
|
assertIsSecureContext();
|
|
369
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle
|
|
377
|
+
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.exportKey) !== "function") {
|
|
370
378
|
throw new Error("No key export implementation could be found");
|
|
371
379
|
}
|
|
372
380
|
}
|
|
373
381
|
async function assertSigningCapabilityIsAvailable() {
|
|
382
|
+
var _a;
|
|
374
383
|
assertIsSecureContext();
|
|
375
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle
|
|
384
|
+
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.sign) !== "function") {
|
|
376
385
|
throw new Error("No signing implementation could be found");
|
|
377
386
|
}
|
|
378
387
|
}
|
|
@@ -432,9 +441,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
432
441
|
return putativeAddress;
|
|
433
442
|
}
|
|
434
443
|
function getAddressEncoder(config) {
|
|
444
|
+
var _a;
|
|
435
445
|
return mapEncoder(
|
|
436
446
|
getStringEncoder({
|
|
437
|
-
description: config
|
|
447
|
+
description: (_a = config == null ? void 0 : config.description) != null ? _a : "Address",
|
|
438
448
|
encoding: getMemoizedBase58Encoder(),
|
|
439
449
|
size: 32
|
|
440
450
|
}),
|
|
@@ -442,8 +452,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
442
452
|
);
|
|
443
453
|
}
|
|
444
454
|
function getAddressDecoder(config) {
|
|
455
|
+
var _a;
|
|
445
456
|
return getStringDecoder({
|
|
446
|
-
description: config
|
|
457
|
+
description: (_a = config == null ? void 0 : config.description) != null ? _a : "Address",
|
|
447
458
|
encoding: getMemoizedBase58Decoder(),
|
|
448
459
|
size: 32
|
|
449
460
|
});
|
|
@@ -517,13 +528,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
517
528
|
throw new Error('Codecs of "remainder" size must have fixed-size items.');
|
|
518
529
|
}
|
|
519
530
|
return {
|
|
520
|
-
description: description
|
|
531
|
+
description: description != null ? description : `array(${item.description}; ${getArrayLikeCodecSizeDescription(size)})`,
|
|
521
532
|
fixedSize: getArrayLikeCodecSizeFromChildren(size, [item.fixedSize]),
|
|
522
533
|
maxSize: getArrayLikeCodecSizeFromChildren(size, [item.maxSize])
|
|
523
534
|
};
|
|
524
535
|
}
|
|
525
536
|
function getArrayEncoder(item, config = {}) {
|
|
526
|
-
|
|
537
|
+
var _a;
|
|
538
|
+
const size = (_a = config.size) != null ? _a : getU32Encoder();
|
|
527
539
|
return {
|
|
528
540
|
...arrayCodecHelper(item, size, config.description),
|
|
529
541
|
encode: (value) => {
|
|
@@ -535,9 +547,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
535
547
|
};
|
|
536
548
|
}
|
|
537
549
|
function getBytesEncoder(config = {}) {
|
|
538
|
-
|
|
550
|
+
var _a, _b;
|
|
551
|
+
const size = (_a = config.size) != null ? _a : "variable";
|
|
539
552
|
const sizeDescription = typeof size === "object" ? size.description : `${size}`;
|
|
540
|
-
const description = config.description
|
|
553
|
+
const description = (_b = config.description) != null ? _b : `bytes(${sizeDescription})`;
|
|
541
554
|
const byteEncoder = {
|
|
542
555
|
description,
|
|
543
556
|
encode: (value) => value,
|
|
@@ -562,7 +575,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
562
575
|
function structCodecHelper(fields, description) {
|
|
563
576
|
const fieldDescriptions = fields.map(([name, codec]) => `${String(name)}: ${codec.description}`).join(", ");
|
|
564
577
|
return {
|
|
565
|
-
description: description
|
|
578
|
+
description: description != null ? description : `struct(${fieldDescriptions})`,
|
|
566
579
|
fixedSize: sumCodecSizes(fields.map(([, field]) => field.fixedSize)),
|
|
567
580
|
maxSize: sumCodecSizes(fields.map(([, field]) => field.maxSize))
|
|
568
581
|
};
|
|
@@ -598,7 +611,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
598
611
|
return roleA | roleB;
|
|
599
612
|
}
|
|
600
613
|
function upsert(addressMap, address2, update) {
|
|
601
|
-
|
|
614
|
+
var _a;
|
|
615
|
+
addressMap[address2] = update((_a = addressMap[address2]) != null ? _a : { role: AccountRole.READONLY });
|
|
602
616
|
}
|
|
603
617
|
var TYPE = Symbol("AddressMapTypeProperty");
|
|
604
618
|
function getAddressMapFromInstructions(feePayer, instructions) {
|
|
@@ -895,7 +909,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
895
909
|
const encoder = getMemoizedU8Encoder();
|
|
896
910
|
return {
|
|
897
911
|
...encoder,
|
|
898
|
-
description: description
|
|
912
|
+
description: description != null ? description : encoder.description
|
|
899
913
|
};
|
|
900
914
|
}
|
|
901
915
|
var numSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction" ;
|
|
@@ -935,13 +949,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
935
949
|
]),
|
|
936
950
|
// Convert an instruction to have all fields defined
|
|
937
951
|
(instruction) => {
|
|
952
|
+
var _a, _b;
|
|
938
953
|
if (instruction.accountIndices !== void 0 && instruction.data !== void 0) {
|
|
939
954
|
return instruction;
|
|
940
955
|
}
|
|
941
956
|
return {
|
|
942
957
|
...instruction,
|
|
943
|
-
accountIndices: instruction.accountIndices
|
|
944
|
-
data: instruction.data
|
|
958
|
+
accountIndices: (_a = instruction.accountIndices) != null ? _a : [],
|
|
959
|
+
data: (_b = instruction.data) != null ? _b : new Uint8Array(0)
|
|
945
960
|
};
|
|
946
961
|
}
|
|
947
962
|
);
|
|
@@ -983,12 +998,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
983
998
|
["addressTableLookups", getAddressTableLookupArrayEncoder()]
|
|
984
999
|
]),
|
|
985
1000
|
(value) => {
|
|
1001
|
+
var _a;
|
|
986
1002
|
if (value.version === "legacy") {
|
|
987
1003
|
return value;
|
|
988
1004
|
}
|
|
989
1005
|
return {
|
|
990
1006
|
...value,
|
|
991
|
-
addressTableLookups: value.addressTableLookups
|
|
1007
|
+
addressTableLookups: (_a = value.addressTableLookups) != null ? _a : []
|
|
992
1008
|
};
|
|
993
1009
|
}
|
|
994
1010
|
);
|