@solana/signers 2.0.0-experimental.d3af599 → 2.0.0-experimental.e1ca396
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 +8 -5
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +8 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +309 -384
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +10 -5
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +8 -5
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +8 -5
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +29 -29
- package/package.json +6 -6
|
@@ -72,23 +72,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
72
72
|
throw new Error(`Codec [${codecDescription}] expected ${expected} bytes, got ${bytesLength}.`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
var mergeBytes = (byteArrays) => {
|
|
76
|
-
const nonEmptyByteArrays = byteArrays.filter((arr) => arr.length);
|
|
77
|
-
if (nonEmptyByteArrays.length === 0) {
|
|
78
|
-
return byteArrays.length ? byteArrays[0] : new Uint8Array();
|
|
79
|
-
}
|
|
80
|
-
if (nonEmptyByteArrays.length === 1) {
|
|
81
|
-
return nonEmptyByteArrays[0];
|
|
82
|
-
}
|
|
83
|
-
const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0);
|
|
84
|
-
const result = new Uint8Array(totalLength);
|
|
85
|
-
let offset = 0;
|
|
86
|
-
nonEmptyByteArrays.forEach((arr) => {
|
|
87
|
-
result.set(arr, offset);
|
|
88
|
-
offset += arr.length;
|
|
89
|
-
});
|
|
90
|
-
return result;
|
|
91
|
-
};
|
|
92
75
|
var padBytes = (bytes, length) => {
|
|
93
76
|
if (bytes.length >= length)
|
|
94
77
|
return bytes;
|
|
@@ -97,42 +80,68 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
97
80
|
return paddedBytes;
|
|
98
81
|
};
|
|
99
82
|
var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
|
|
100
|
-
function
|
|
101
|
-
return
|
|
102
|
-
description: description != null ? description : `fixed(${fixedBytes}, ${data.description})`,
|
|
103
|
-
fixedSize: fixedBytes,
|
|
104
|
-
maxSize: fixedBytes
|
|
105
|
-
};
|
|
83
|
+
function getEncodedSize(value, encoder) {
|
|
84
|
+
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);
|
|
106
85
|
}
|
|
107
|
-
function
|
|
108
|
-
return {
|
|
109
|
-
...
|
|
110
|
-
encode: (value) =>
|
|
111
|
-
|
|
86
|
+
function createEncoder(encoder) {
|
|
87
|
+
return Object.freeze({
|
|
88
|
+
...encoder,
|
|
89
|
+
encode: (value) => {
|
|
90
|
+
const bytes = new Uint8Array(getEncodedSize(value, encoder));
|
|
91
|
+
encoder.write(value, bytes, 0);
|
|
92
|
+
return bytes;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
112
95
|
}
|
|
113
|
-
function
|
|
114
|
-
return {
|
|
115
|
-
...
|
|
116
|
-
decode: (bytes, offset = 0) =>
|
|
96
|
+
function createDecoder(decoder) {
|
|
97
|
+
return Object.freeze({
|
|
98
|
+
...decoder,
|
|
99
|
+
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function isFixedSize(codec) {
|
|
103
|
+
return "fixedSize" in codec && typeof codec.fixedSize === "number";
|
|
104
|
+
}
|
|
105
|
+
function assertIsFixedSize(codec, message) {
|
|
106
|
+
if (!isFixedSize(codec)) {
|
|
107
|
+
throw new Error(message != null ? message : "Expected a fixed-size codec, got a variable-size one.");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function isVariableSize(codec) {
|
|
111
|
+
return !isFixedSize(codec);
|
|
112
|
+
}
|
|
113
|
+
function fixEncoder(encoder, fixedBytes) {
|
|
114
|
+
return createEncoder({
|
|
115
|
+
fixedSize: fixedBytes,
|
|
116
|
+
write: (value, bytes, offset) => {
|
|
117
|
+
const variableByteArray = encoder.encode(value);
|
|
118
|
+
const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;
|
|
119
|
+
bytes.set(fixedByteArray, offset);
|
|
120
|
+
return offset + fixedBytes;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function fixDecoder(decoder, fixedBytes) {
|
|
125
|
+
return createDecoder({
|
|
126
|
+
fixedSize: fixedBytes,
|
|
127
|
+
read: (bytes, offset) => {
|
|
117
128
|
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset);
|
|
118
129
|
if (offset > 0 || bytes.length > fixedBytes) {
|
|
119
130
|
bytes = bytes.slice(offset, offset + fixedBytes);
|
|
120
131
|
}
|
|
121
|
-
if (decoder
|
|
132
|
+
if (isFixedSize(decoder)) {
|
|
122
133
|
bytes = fixBytes(bytes, decoder.fixedSize);
|
|
123
134
|
}
|
|
124
|
-
const [value] = decoder.
|
|
135
|
+
const [value] = decoder.read(bytes, 0);
|
|
125
136
|
return [value, offset + fixedBytes];
|
|
126
137
|
}
|
|
127
|
-
};
|
|
138
|
+
});
|
|
128
139
|
}
|
|
129
140
|
function mapEncoder(encoder, unmap) {
|
|
130
|
-
return {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
maxSize: encoder.maxSize
|
|
135
|
-
};
|
|
141
|
+
return createEncoder({
|
|
142
|
+
...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder,
|
|
143
|
+
write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset)
|
|
144
|
+
});
|
|
136
145
|
}
|
|
137
146
|
|
|
138
147
|
// ../codecs-numbers/dist/index.browser.js
|
|
@@ -143,80 +152,66 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
143
152
|
);
|
|
144
153
|
}
|
|
145
154
|
}
|
|
146
|
-
function
|
|
147
|
-
|
|
148
|
-
let littleEndian;
|
|
149
|
-
let defaultDescription = input.name;
|
|
150
|
-
if (input.size > 1) {
|
|
151
|
-
littleEndian = !("endian" in input.config) || input.config.endian === 0;
|
|
152
|
-
defaultDescription += littleEndian ? "(le)" : "(be)";
|
|
153
|
-
}
|
|
154
|
-
return {
|
|
155
|
-
description: (_a = input.config.description) != null ? _a : defaultDescription,
|
|
156
|
-
fixedSize: input.size,
|
|
157
|
-
littleEndian,
|
|
158
|
-
maxSize: input.size
|
|
159
|
-
};
|
|
155
|
+
function isLittleEndian(config) {
|
|
156
|
+
return (config == null ? void 0 : config.endian) === 1 ? false : true;
|
|
160
157
|
}
|
|
161
158
|
function numberEncoderFactory(input) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
encode(value) {
|
|
159
|
+
return createEncoder({
|
|
160
|
+
fixedSize: input.size,
|
|
161
|
+
write(value, bytes, offset) {
|
|
166
162
|
if (input.range) {
|
|
167
163
|
assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);
|
|
168
164
|
}
|
|
169
165
|
const arrayBuffer = new ArrayBuffer(input.size);
|
|
170
|
-
input.set(new DataView(arrayBuffer), value,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
};
|
|
166
|
+
input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config));
|
|
167
|
+
bytes.set(new Uint8Array(arrayBuffer), offset);
|
|
168
|
+
return offset + input.size;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
176
171
|
}
|
|
177
172
|
function numberDecoderFactory(input) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
assertByteArrayIsNotEmptyForCodec(
|
|
182
|
-
assertByteArrayHasEnoughBytesForCodec(
|
|
173
|
+
return createDecoder({
|
|
174
|
+
fixedSize: input.size,
|
|
175
|
+
read(bytes, offset = 0) {
|
|
176
|
+
assertByteArrayIsNotEmptyForCodec(input.name, bytes, offset);
|
|
177
|
+
assertByteArrayHasEnoughBytesForCodec(input.name, input.size, bytes, offset);
|
|
183
178
|
const view = new DataView(toArrayBuffer(bytes, offset, input.size));
|
|
184
|
-
return [input.get(view,
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
fixedSize: codecData.fixedSize,
|
|
188
|
-
maxSize: codecData.maxSize
|
|
189
|
-
};
|
|
179
|
+
return [input.get(view, isLittleEndian(input.config)), offset + input.size];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
190
182
|
}
|
|
191
183
|
function toArrayBuffer(bytes, offset, length) {
|
|
192
184
|
const bytesOffset = bytes.byteOffset + (offset != null ? offset : 0);
|
|
193
185
|
const bytesLength = length != null ? length : bytes.byteLength;
|
|
194
186
|
return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength);
|
|
195
187
|
}
|
|
196
|
-
var getShortU16Encoder = (
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
188
|
+
var getShortU16Encoder = () => createEncoder({
|
|
189
|
+
getSizeFromValue: (value) => {
|
|
190
|
+
if (value <= 127)
|
|
191
|
+
return 1;
|
|
192
|
+
if (value <= 16383)
|
|
193
|
+
return 2;
|
|
194
|
+
return 3;
|
|
195
|
+
},
|
|
196
|
+
maxSize: 3,
|
|
197
|
+
write: (value, bytes, offset) => {
|
|
198
|
+
assertNumberIsBetweenForCodec("shortU16", 0, 65535, value);
|
|
199
|
+
const shortU16Bytes = [0];
|
|
200
|
+
for (let ii = 0; ; ii += 1) {
|
|
201
|
+
const alignedValue = value >> ii * 7;
|
|
202
|
+
if (alignedValue === 0) {
|
|
203
|
+
break;
|
|
213
204
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
205
|
+
const nextSevenBits = 127 & alignedValue;
|
|
206
|
+
shortU16Bytes[ii] = nextSevenBits;
|
|
207
|
+
if (ii > 0) {
|
|
208
|
+
shortU16Bytes[ii - 1] |= 128;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
bytes.set(shortU16Bytes, offset);
|
|
212
|
+
return offset + shortU16Bytes.length;
|
|
213
|
+
}
|
|
214
|
+
});
|
|
220
215
|
var getU32Encoder = (config = {}) => numberEncoderFactory({
|
|
221
216
|
config,
|
|
222
217
|
name: "u32",
|
|
@@ -230,8 +225,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
230
225
|
name: "u32",
|
|
231
226
|
size: 4
|
|
232
227
|
});
|
|
233
|
-
var getU8Encoder = (
|
|
234
|
-
config,
|
|
228
|
+
var getU8Encoder = () => numberEncoderFactory({
|
|
235
229
|
name: "u8",
|
|
236
230
|
range: [0, Number("0xff")],
|
|
237
231
|
set: (view, value) => view.setUint8(0, value),
|
|
@@ -245,43 +239,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
245
239
|
}
|
|
246
240
|
}
|
|
247
241
|
var getBaseXEncoder = (alphabet4) => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
242
|
+
return createEncoder({
|
|
243
|
+
getSizeFromValue: (value) => {
|
|
244
|
+
const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]);
|
|
245
|
+
if (tailChars === "")
|
|
246
|
+
return value.length;
|
|
247
|
+
const base10Number = getBigIntFromBaseX(tailChars, alphabet4);
|
|
248
|
+
return leadingZeroes.length + Math.ceil(base10Number.toString(16).length / 2);
|
|
249
|
+
},
|
|
250
|
+
write(value, bytes, offset) {
|
|
253
251
|
assertValidBaseString(alphabet4, value);
|
|
254
252
|
if (value === "")
|
|
255
|
-
return
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (trailIndex === chars.length)
|
|
261
|
-
return Uint8Array.from(leadingZeroes);
|
|
262
|
-
const tailChars = chars.slice(trailIndex);
|
|
263
|
-
let base10Number = 0n;
|
|
264
|
-
let baseXPower = 1n;
|
|
265
|
-
for (let i = tailChars.length - 1; i >= 0; i -= 1) {
|
|
266
|
-
base10Number += baseXPower * BigInt(alphabet4.indexOf(tailChars[i]));
|
|
267
|
-
baseXPower *= baseBigInt;
|
|
253
|
+
return offset;
|
|
254
|
+
const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]);
|
|
255
|
+
if (tailChars === "") {
|
|
256
|
+
bytes.set(new Uint8Array(leadingZeroes.length).fill(0), offset);
|
|
257
|
+
return offset + leadingZeroes.length;
|
|
268
258
|
}
|
|
259
|
+
let base10Number = getBigIntFromBaseX(tailChars, alphabet4);
|
|
269
260
|
const tailBytes = [];
|
|
270
261
|
while (base10Number > 0n) {
|
|
271
262
|
tailBytes.unshift(Number(base10Number % 256n));
|
|
272
263
|
base10Number /= 256n;
|
|
273
264
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
};
|
|
265
|
+
const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes];
|
|
266
|
+
bytes.set(bytesToAdd, offset);
|
|
267
|
+
return offset + bytesToAdd.length;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
279
270
|
};
|
|
280
271
|
var getBaseXDecoder = (alphabet4) => {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return {
|
|
284
|
-
decode(rawBytes, offset = 0) {
|
|
272
|
+
return createDecoder({
|
|
273
|
+
read(rawBytes, offset) {
|
|
285
274
|
const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);
|
|
286
275
|
if (bytes.length === 0)
|
|
287
276
|
return ["", 0];
|
|
@@ -290,19 +279,29 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
290
279
|
const leadingZeroes = alphabet4[0].repeat(trailIndex);
|
|
291
280
|
if (trailIndex === bytes.length)
|
|
292
281
|
return [leadingZeroes, rawBytes.length];
|
|
293
|
-
|
|
294
|
-
const tailChars =
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
return [leadingZeroes + tailChars.join(""), rawBytes.length];
|
|
300
|
-
},
|
|
301
|
-
description: `base${base}`,
|
|
302
|
-
fixedSize: null,
|
|
303
|
-
maxSize: null
|
|
304
|
-
};
|
|
282
|
+
const base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
|
|
283
|
+
const tailChars = getBaseXFromBigInt(base10Number, alphabet4);
|
|
284
|
+
return [leadingZeroes + tailChars, rawBytes.length];
|
|
285
|
+
}
|
|
286
|
+
});
|
|
305
287
|
};
|
|
288
|
+
function partitionLeadingZeroes(value, zeroCharacter) {
|
|
289
|
+
const leadingZeroIndex = [...value].findIndex((c) => c !== zeroCharacter);
|
|
290
|
+
return leadingZeroIndex === -1 ? [value, ""] : [value.slice(0, leadingZeroIndex), value.slice(leadingZeroIndex)];
|
|
291
|
+
}
|
|
292
|
+
function getBigIntFromBaseX(value, alphabet4) {
|
|
293
|
+
const base = BigInt(alphabet4.length);
|
|
294
|
+
return [...value].reduce((sum, char) => sum * base + BigInt(alphabet4.indexOf(char)), 0n);
|
|
295
|
+
}
|
|
296
|
+
function getBaseXFromBigInt(value, alphabet4) {
|
|
297
|
+
const base = BigInt(alphabet4.length);
|
|
298
|
+
const tailChars = [];
|
|
299
|
+
while (value > 0n) {
|
|
300
|
+
tailChars.unshift(alphabet4[Number(value % base)]);
|
|
301
|
+
value /= base;
|
|
302
|
+
}
|
|
303
|
+
return tailChars.join("");
|
|
304
|
+
}
|
|
306
305
|
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
307
306
|
var getBase58Encoder = () => getBaseXEncoder(alphabet2);
|
|
308
307
|
var getBase58Decoder = () => getBaseXDecoder(alphabet2);
|
|
@@ -314,77 +313,69 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
314
313
|
var o = globalThis.TextEncoder;
|
|
315
314
|
var getUtf8Encoder = () => {
|
|
316
315
|
let textEncoder;
|
|
317
|
-
return {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
316
|
+
return createEncoder({
|
|
317
|
+
getSizeFromValue: (value) => (textEncoder || (textEncoder = new o())).encode(value).length,
|
|
318
|
+
write: (value, bytes, offset) => {
|
|
319
|
+
const bytesToAdd = (textEncoder || (textEncoder = new o())).encode(value);
|
|
320
|
+
bytes.set(bytesToAdd, offset);
|
|
321
|
+
return offset + bytesToAdd.length;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
323
324
|
};
|
|
324
325
|
var getUtf8Decoder = () => {
|
|
325
326
|
let textDecoder;
|
|
326
|
-
return {
|
|
327
|
-
|
|
327
|
+
return createDecoder({
|
|
328
|
+
read(bytes, offset) {
|
|
328
329
|
const value = (textDecoder || (textDecoder = new e())).decode(bytes.slice(offset));
|
|
329
330
|
return [removeNullCharacters(value), bytes.length];
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
fixedSize: null,
|
|
333
|
-
maxSize: null
|
|
334
|
-
};
|
|
331
|
+
}
|
|
332
|
+
});
|
|
335
333
|
};
|
|
336
|
-
|
|
337
|
-
var _a, _b
|
|
334
|
+
function getStringEncoder(config = {}) {
|
|
335
|
+
var _a, _b;
|
|
338
336
|
const size = (_a = config.size) != null ? _a : getU32Encoder();
|
|
339
337
|
const encoding = (_b = config.encoding) != null ? _b : getUtf8Encoder();
|
|
340
|
-
const description = (_c = config.description) != null ? _c : `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
341
338
|
if (size === "variable") {
|
|
342
|
-
return
|
|
339
|
+
return encoding;
|
|
343
340
|
}
|
|
344
341
|
if (typeof size === "number") {
|
|
345
|
-
return fixEncoder(encoding, size
|
|
342
|
+
return fixEncoder(encoding, size);
|
|
346
343
|
}
|
|
347
|
-
return {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
const lengthBytes = size.encode(contentBytes.length);
|
|
352
|
-
return mergeBytes([lengthBytes, contentBytes]);
|
|
344
|
+
return createEncoder({
|
|
345
|
+
getSizeFromValue: (value) => {
|
|
346
|
+
const contentSize = getEncodedSize(value, encoding);
|
|
347
|
+
return getEncodedSize(contentSize, size) + contentSize;
|
|
353
348
|
},
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
349
|
+
write: (value, bytes, offset) => {
|
|
350
|
+
const contentSize = getEncodedSize(value, encoding);
|
|
351
|
+
offset = size.write(contentSize, bytes, offset);
|
|
352
|
+
return encoding.write(value, bytes, offset);
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
function getStringDecoder(config = {}) {
|
|
357
|
+
var _a, _b;
|
|
360
358
|
const size = (_a = config.size) != null ? _a : getU32Decoder();
|
|
361
359
|
const encoding = (_b = config.encoding) != null ? _b : getUtf8Decoder();
|
|
362
|
-
const description = (_c = config.description) != null ? _c : `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
363
360
|
if (size === "variable") {
|
|
364
|
-
return
|
|
361
|
+
return encoding;
|
|
365
362
|
}
|
|
366
363
|
if (typeof size === "number") {
|
|
367
|
-
return fixDecoder(encoding, size
|
|
364
|
+
return fixDecoder(encoding, size);
|
|
368
365
|
}
|
|
369
|
-
return {
|
|
370
|
-
|
|
366
|
+
return createDecoder({
|
|
367
|
+
read: (bytes, offset = 0) => {
|
|
371
368
|
assertByteArrayIsNotEmptyForCodec("string", bytes, offset);
|
|
372
|
-
const [lengthBigInt, lengthOffset] = size.
|
|
369
|
+
const [lengthBigInt, lengthOffset] = size.read(bytes, offset);
|
|
373
370
|
const length = Number(lengthBigInt);
|
|
374
371
|
offset = lengthOffset;
|
|
375
372
|
const contentBytes = bytes.slice(offset, offset + length);
|
|
376
373
|
assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes);
|
|
377
|
-
const [value, contentOffset] = encoding.
|
|
374
|
+
const [value, contentOffset] = encoding.read(contentBytes, 0);
|
|
378
375
|
offset += contentOffset;
|
|
379
376
|
return [value, offset];
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
fixedSize: null,
|
|
383
|
-
maxSize: null
|
|
384
|
-
};
|
|
385
|
-
};
|
|
386
|
-
function getSizeDescription(size) {
|
|
387
|
-
return typeof size === "object" ? size.description : `${size}`;
|
|
377
|
+
}
|
|
378
|
+
});
|
|
388
379
|
}
|
|
389
380
|
|
|
390
381
|
// ../assertions/dist/index.browser.js
|
|
@@ -498,24 +489,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
498
489
|
assertIsAddress(putativeAddress);
|
|
499
490
|
return putativeAddress;
|
|
500
491
|
}
|
|
501
|
-
function getAddressEncoder(
|
|
502
|
-
var _a;
|
|
492
|
+
function getAddressEncoder() {
|
|
503
493
|
return mapEncoder(
|
|
504
|
-
getStringEncoder({
|
|
505
|
-
description: (_a = config == null ? void 0 : config.description) != null ? _a : "Address",
|
|
506
|
-
encoding: getMemoizedBase58Encoder(),
|
|
507
|
-
size: 32
|
|
508
|
-
}),
|
|
494
|
+
getStringEncoder({ encoding: getMemoizedBase58Encoder(), size: 32 }),
|
|
509
495
|
(putativeAddress) => address(putativeAddress)
|
|
510
496
|
);
|
|
511
497
|
}
|
|
512
|
-
function getAddressDecoder(
|
|
513
|
-
|
|
514
|
-
return getStringDecoder({
|
|
515
|
-
description: (_a = config == null ? void 0 : config.description) != null ? _a : "Address",
|
|
516
|
-
encoding: getMemoizedBase58Decoder(),
|
|
517
|
-
size: 32
|
|
518
|
-
});
|
|
498
|
+
function getAddressDecoder() {
|
|
499
|
+
return getStringDecoder({ encoding: getMemoizedBase58Decoder(), size: 32 });
|
|
519
500
|
}
|
|
520
501
|
function getAddressComparator() {
|
|
521
502
|
return new Intl.Collator("en", {
|
|
@@ -533,8 +514,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
533
514
|
throw new Error("The `CryptoKey` must be an `Ed25519` public key");
|
|
534
515
|
}
|
|
535
516
|
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
536
|
-
|
|
537
|
-
return base58EncodedAddress;
|
|
517
|
+
return getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
|
|
538
518
|
}
|
|
539
519
|
|
|
540
520
|
// ../keys/dist/index.browser.js
|
|
@@ -559,94 +539,102 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
559
539
|
}
|
|
560
540
|
|
|
561
541
|
// ../codecs-data-structures/dist/index.browser.js
|
|
562
|
-
function sumCodecSizes(sizes) {
|
|
563
|
-
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
|
|
564
|
-
}
|
|
565
|
-
function getArrayLikeCodecSizeDescription(size) {
|
|
566
|
-
return typeof size === "object" ? size.description : `${size}`;
|
|
567
|
-
}
|
|
568
|
-
function getArrayLikeCodecSizeFromChildren(size, childrenSizes) {
|
|
569
|
-
if (typeof size !== "number")
|
|
570
|
-
return null;
|
|
571
|
-
if (size === 0)
|
|
572
|
-
return 0;
|
|
573
|
-
const childrenSize = sumCodecSizes(childrenSizes);
|
|
574
|
-
return childrenSize === null ? null : childrenSize * size;
|
|
575
|
-
}
|
|
576
|
-
function getArrayLikeCodecSizePrefix(size, realSize) {
|
|
577
|
-
return typeof size === "object" ? size.encode(realSize) : new Uint8Array();
|
|
578
|
-
}
|
|
579
542
|
function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
|
|
580
543
|
if (expected !== actual) {
|
|
581
544
|
throw new Error(`Expected [${codecDescription}] to have ${expected} items, got ${actual}.`);
|
|
582
545
|
}
|
|
583
546
|
}
|
|
584
|
-
function
|
|
585
|
-
|
|
586
|
-
throw new Error('Codecs of "remainder" size must have fixed-size items.');
|
|
587
|
-
}
|
|
588
|
-
return {
|
|
589
|
-
description: description != null ? description : `array(${item.description}; ${getArrayLikeCodecSizeDescription(size)})`,
|
|
590
|
-
fixedSize: getArrayLikeCodecSizeFromChildren(size, [item.fixedSize]),
|
|
591
|
-
maxSize: getArrayLikeCodecSizeFromChildren(size, [item.maxSize])
|
|
592
|
-
};
|
|
547
|
+
function sumCodecSizes(sizes) {
|
|
548
|
+
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
|
|
593
549
|
}
|
|
594
|
-
function
|
|
550
|
+
function getFixedSize(codec) {
|
|
551
|
+
return isFixedSize(codec) ? codec.fixedSize : null;
|
|
552
|
+
}
|
|
553
|
+
function getMaxSize(codec) {
|
|
595
554
|
var _a;
|
|
555
|
+
return isFixedSize(codec) ? codec.fixedSize : (_a = codec.maxSize) != null ? _a : null;
|
|
556
|
+
}
|
|
557
|
+
function getArrayEncoder(item, config = {}) {
|
|
558
|
+
var _a, _b;
|
|
596
559
|
const size = (_a = config.size) != null ? _a : getU32Encoder();
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
560
|
+
if (size === "remainder") {
|
|
561
|
+
assertIsFixedSize(item, 'Codecs of "remainder" size must have fixed-size items.');
|
|
562
|
+
}
|
|
563
|
+
const fixedSize = computeArrayLikeCodecSize(size, getFixedSize(item));
|
|
564
|
+
const maxSize = (_b = computeArrayLikeCodecSize(size, getMaxSize(item))) != null ? _b : void 0;
|
|
565
|
+
return createEncoder({
|
|
566
|
+
...fixedSize !== null ? { fixedSize } : {
|
|
567
|
+
getSizeFromValue: (array) => {
|
|
568
|
+
const prefixSize = typeof size === "object" ? getEncodedSize(array.length, size) : 0;
|
|
569
|
+
return prefixSize + [...array].reduce((all, value) => all + getEncodedSize(value, item), 0);
|
|
570
|
+
},
|
|
571
|
+
maxSize
|
|
572
|
+
},
|
|
573
|
+
write: (array, bytes, offset) => {
|
|
600
574
|
if (typeof size === "number") {
|
|
601
|
-
assertValidNumberOfItemsForCodec("array", size,
|
|
575
|
+
assertValidNumberOfItemsForCodec("array", size, array.length);
|
|
576
|
+
}
|
|
577
|
+
if (typeof size === "object") {
|
|
578
|
+
offset = size.write(array.length, bytes, offset);
|
|
602
579
|
}
|
|
603
|
-
|
|
580
|
+
array.forEach((value) => {
|
|
581
|
+
offset = item.write(value, bytes, offset);
|
|
582
|
+
});
|
|
583
|
+
return offset;
|
|
604
584
|
}
|
|
605
|
-
};
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
function computeArrayLikeCodecSize(size, itemSize) {
|
|
588
|
+
if (typeof size !== "number")
|
|
589
|
+
return null;
|
|
590
|
+
if (size === 0)
|
|
591
|
+
return 0;
|
|
592
|
+
return itemSize === null ? null : itemSize * size;
|
|
606
593
|
}
|
|
607
594
|
function getBytesEncoder(config = {}) {
|
|
608
|
-
var _a
|
|
595
|
+
var _a;
|
|
609
596
|
const size = (_a = config.size) != null ? _a : "variable";
|
|
610
|
-
const
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
};
|
|
597
|
+
const byteEncoder = createEncoder({
|
|
598
|
+
getSizeFromValue: (value) => value.length,
|
|
599
|
+
write: (value, bytes, offset) => {
|
|
600
|
+
bytes.set(value, offset);
|
|
601
|
+
return offset + value.length;
|
|
602
|
+
}
|
|
603
|
+
});
|
|
618
604
|
if (size === "variable") {
|
|
619
605
|
return byteEncoder;
|
|
620
606
|
}
|
|
621
607
|
if (typeof size === "number") {
|
|
622
|
-
return fixEncoder(byteEncoder, size
|
|
608
|
+
return fixEncoder(byteEncoder, size);
|
|
623
609
|
}
|
|
624
|
-
return {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
return mergeBytes([lengthBytes, contentBytes]);
|
|
610
|
+
return createEncoder({
|
|
611
|
+
getSizeFromValue: (value) => getEncodedSize(value.length, size) + value.length,
|
|
612
|
+
write: (value, bytes, offset) => {
|
|
613
|
+
offset = size.write(value.length, bytes, offset);
|
|
614
|
+
return byteEncoder.write(value, bytes, offset);
|
|
630
615
|
}
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
function structCodecHelper(fields, description) {
|
|
634
|
-
const fieldDescriptions = fields.map(([name, codec]) => `${String(name)}: ${codec.description}`).join(", ");
|
|
635
|
-
return {
|
|
636
|
-
description: description != null ? description : `struct(${fieldDescriptions})`,
|
|
637
|
-
fixedSize: sumCodecSizes(fields.map(([, field]) => field.fixedSize)),
|
|
638
|
-
maxSize: sumCodecSizes(fields.map(([, field]) => field.maxSize))
|
|
639
|
-
};
|
|
616
|
+
});
|
|
640
617
|
}
|
|
641
|
-
function getStructEncoder(fields
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
618
|
+
function getStructEncoder(fields) {
|
|
619
|
+
var _a;
|
|
620
|
+
const fieldCodecs = fields.map(([, codec]) => codec);
|
|
621
|
+
const fixedSize = sumCodecSizes(fieldCodecs.map(getFixedSize));
|
|
622
|
+
const maxSize = (_a = sumCodecSizes(fieldCodecs.map(getMaxSize))) != null ? _a : void 0;
|
|
623
|
+
return createEncoder({
|
|
624
|
+
...fixedSize === null ? {
|
|
625
|
+
getSizeFromValue: (value) => fields.map(([key, codec]) => getEncodedSize(value[key], codec)).reduce((all, one) => all + one, 0),
|
|
626
|
+
maxSize
|
|
627
|
+
} : { fixedSize },
|
|
628
|
+
write: (struct, bytes, offset) => {
|
|
629
|
+
fields.forEach(([key, codec]) => {
|
|
630
|
+
offset = codec.write(struct[key], bytes, offset);
|
|
631
|
+
});
|
|
632
|
+
return offset;
|
|
647
633
|
}
|
|
648
|
-
};
|
|
634
|
+
});
|
|
649
635
|
}
|
|
636
|
+
|
|
637
|
+
// ../transactions/dist/index.browser.js
|
|
650
638
|
var AccountRole = /* @__PURE__ */ ((AccountRole2) => {
|
|
651
639
|
AccountRole2[AccountRole2["WRITABLE_SIGNER"] = /* 3 */
|
|
652
640
|
3] = "WRITABLE_SIGNER";
|
|
@@ -927,33 +915,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
927
915
|
version: transaction.version
|
|
928
916
|
};
|
|
929
917
|
}
|
|
930
|
-
var lookupTableAddressDescription = "The address of the address lookup table account from which instruction addresses should be looked up" ;
|
|
931
|
-
var writableIndicesDescription = "The indices of the accounts in the lookup table that should be loaded as writeable" ;
|
|
932
|
-
var readableIndicesDescription = "The indices of the accounts in the lookup table that should be loaded as read-only" ;
|
|
933
|
-
var addressTableLookupDescription = "A pointer to the address of an address lookup table, along with the readonly/writeable indices of the addresses that should be loaded from it" ;
|
|
934
918
|
var memoizedAddressTableLookupEncoder;
|
|
935
919
|
function getAddressTableLookupEncoder() {
|
|
936
920
|
if (!memoizedAddressTableLookupEncoder) {
|
|
937
|
-
memoizedAddressTableLookupEncoder = getStructEncoder(
|
|
921
|
+
memoizedAddressTableLookupEncoder = getStructEncoder([
|
|
922
|
+
["lookupTableAddress", getAddressEncoder()],
|
|
938
923
|
[
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
"writableIndices",
|
|
942
|
-
getArrayEncoder(getU8Encoder(), {
|
|
943
|
-
description: writableIndicesDescription,
|
|
944
|
-
size: getShortU16Encoder()
|
|
945
|
-
})
|
|
946
|
-
],
|
|
947
|
-
[
|
|
948
|
-
"readableIndices",
|
|
949
|
-
getArrayEncoder(getU8Encoder(), {
|
|
950
|
-
description: readableIndicesDescription,
|
|
951
|
-
size: getShortU16Encoder()
|
|
952
|
-
})
|
|
953
|
-
]
|
|
924
|
+
"writableIndices",
|
|
925
|
+
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })
|
|
954
926
|
],
|
|
955
|
-
|
|
956
|
-
|
|
927
|
+
[
|
|
928
|
+
"readableIndices",
|
|
929
|
+
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })
|
|
930
|
+
]
|
|
931
|
+
]);
|
|
957
932
|
}
|
|
958
933
|
return memoizedAddressTableLookupEncoder;
|
|
959
934
|
}
|
|
@@ -963,47 +938,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
963
938
|
memoizedU8Encoder = getU8Encoder();
|
|
964
939
|
return memoizedU8Encoder;
|
|
965
940
|
}
|
|
966
|
-
function getMemoizedU8EncoderDescription(description) {
|
|
967
|
-
const encoder = getMemoizedU8Encoder();
|
|
968
|
-
return {
|
|
969
|
-
...encoder,
|
|
970
|
-
description: description != null ? description : encoder.description
|
|
971
|
-
};
|
|
972
|
-
}
|
|
973
|
-
var numSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction" ;
|
|
974
|
-
var numReadonlySignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction, but may not be writable" ;
|
|
975
|
-
var numReadonlyNonSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable" ;
|
|
976
|
-
var messageHeaderDescription = "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses" ;
|
|
977
941
|
function getMessageHeaderEncoder() {
|
|
978
|
-
return getStructEncoder(
|
|
979
|
-
[
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
],
|
|
984
|
-
{
|
|
985
|
-
description: messageHeaderDescription
|
|
986
|
-
}
|
|
987
|
-
);
|
|
942
|
+
return getStructEncoder([
|
|
943
|
+
["numSignerAccounts", getMemoizedU8Encoder()],
|
|
944
|
+
["numReadonlySignerAccounts", getMemoizedU8Encoder()],
|
|
945
|
+
["numReadonlyNonSignerAccounts", getMemoizedU8Encoder()]
|
|
946
|
+
]);
|
|
988
947
|
}
|
|
989
|
-
var programAddressIndexDescription = "The index of the program being called, according to the well-ordered accounts list for this transaction" ;
|
|
990
|
-
var accountIndexDescription = "The index of an account, according to the well-ordered accounts list for this transaction" ;
|
|
991
|
-
var accountIndicesDescription = "An optional list of account indices, according to the well-ordered accounts list for this transaction, in the order in which the program being called expects them" ;
|
|
992
|
-
var dataDescription = "An optional buffer of data passed to the instruction" ;
|
|
993
948
|
var memoizedGetInstructionEncoder;
|
|
994
949
|
function getInstructionEncoder() {
|
|
995
950
|
if (!memoizedGetInstructionEncoder) {
|
|
996
951
|
memoizedGetInstructionEncoder = mapEncoder(
|
|
997
952
|
getStructEncoder([
|
|
998
|
-
["programAddressIndex", getU8Encoder(
|
|
999
|
-
[
|
|
1000
|
-
|
|
1001
|
-
getArrayEncoder(getU8Encoder({ description: accountIndexDescription }), {
|
|
1002
|
-
description: accountIndicesDescription,
|
|
1003
|
-
size: getShortU16Encoder()
|
|
1004
|
-
})
|
|
1005
|
-
],
|
|
1006
|
-
["data", getBytesEncoder({ description: dataDescription, size: getShortU16Encoder() })]
|
|
953
|
+
["programAddressIndex", getU8Encoder()],
|
|
954
|
+
["accountIndices", getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })],
|
|
955
|
+
["data", getBytesEncoder({ size: getShortU16Encoder() })]
|
|
1007
956
|
]),
|
|
1008
957
|
// Convert an instruction to have all fields defined
|
|
1009
958
|
(instruction) => {
|
|
@@ -1022,30 +971,22 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1022
971
|
return memoizedGetInstructionEncoder;
|
|
1023
972
|
}
|
|
1024
973
|
var VERSION_FLAG_MASK = 128;
|
|
1025
|
-
var BASE_CONFIG = {
|
|
1026
|
-
description: "A single byte that encodes the version of the transaction" ,
|
|
1027
|
-
fixedSize: null,
|
|
1028
|
-
maxSize: 1
|
|
1029
|
-
};
|
|
1030
|
-
function encode(value) {
|
|
1031
|
-
if (value === "legacy") {
|
|
1032
|
-
return new Uint8Array();
|
|
1033
|
-
}
|
|
1034
|
-
if (value < 0 || value > 127) {
|
|
1035
|
-
throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
|
|
1036
|
-
}
|
|
1037
|
-
return new Uint8Array([value | VERSION_FLAG_MASK]);
|
|
1038
|
-
}
|
|
1039
974
|
function getTransactionVersionEncoder() {
|
|
1040
|
-
return {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
975
|
+
return createEncoder({
|
|
976
|
+
getSizeFromValue: (value) => value === "legacy" ? 0 : 1,
|
|
977
|
+
maxSize: 1,
|
|
978
|
+
write: (value, bytes, offset) => {
|
|
979
|
+
if (value === "legacy") {
|
|
980
|
+
return offset;
|
|
981
|
+
}
|
|
982
|
+
if (value < 0 || value > 127) {
|
|
983
|
+
throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
|
|
984
|
+
}
|
|
985
|
+
bytes.set([value | VERSION_FLAG_MASK], offset);
|
|
986
|
+
return offset + 1;
|
|
987
|
+
}
|
|
988
|
+
});
|
|
1044
989
|
}
|
|
1045
|
-
var staticAccountsDescription = "A compact-array of static account addresses belonging to this transaction" ;
|
|
1046
|
-
var lifetimeTokenDescription = "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" ;
|
|
1047
|
-
var instructionsDescription = "A compact-array of instructions belonging to this transaction" ;
|
|
1048
|
-
var addressTableLookupsDescription = "A compact array of address table lookups belonging to this transaction" ;
|
|
1049
990
|
function getCompiledMessageLegacyEncoder() {
|
|
1050
991
|
return getStructEncoder(getPreludeStructEncoderTuple());
|
|
1051
992
|
}
|
|
@@ -1071,50 +1012,31 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1071
1012
|
return [
|
|
1072
1013
|
["version", getTransactionVersionEncoder()],
|
|
1073
1014
|
["header", getMessageHeaderEncoder()],
|
|
1074
|
-
[
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
description: staticAccountsDescription,
|
|
1078
|
-
size: getShortU16Encoder()
|
|
1079
|
-
})
|
|
1080
|
-
],
|
|
1081
|
-
[
|
|
1082
|
-
"lifetimeToken",
|
|
1083
|
-
getStringEncoder({
|
|
1084
|
-
description: lifetimeTokenDescription,
|
|
1085
|
-
encoding: getBase58Encoder(),
|
|
1086
|
-
size: 32
|
|
1087
|
-
})
|
|
1088
|
-
],
|
|
1089
|
-
[
|
|
1090
|
-
"instructions",
|
|
1091
|
-
getArrayEncoder(getInstructionEncoder(), {
|
|
1092
|
-
description: instructionsDescription,
|
|
1093
|
-
size: getShortU16Encoder()
|
|
1094
|
-
})
|
|
1095
|
-
]
|
|
1015
|
+
["staticAccounts", getArrayEncoder(getAddressEncoder(), { size: getShortU16Encoder() })],
|
|
1016
|
+
["lifetimeToken", getStringEncoder({ encoding: getBase58Encoder(), size: 32 })],
|
|
1017
|
+
["instructions", getArrayEncoder(getInstructionEncoder(), { size: getShortU16Encoder() })]
|
|
1096
1018
|
];
|
|
1097
1019
|
}
|
|
1098
1020
|
function getAddressTableLookupArrayEncoder() {
|
|
1099
|
-
return getArrayEncoder(getAddressTableLookupEncoder(), {
|
|
1100
|
-
description: addressTableLookupsDescription,
|
|
1101
|
-
size: getShortU16Encoder()
|
|
1102
|
-
});
|
|
1021
|
+
return getArrayEncoder(getAddressTableLookupEncoder(), { size: getShortU16Encoder() });
|
|
1103
1022
|
}
|
|
1104
|
-
var messageDescription = "The wire format of a Solana transaction message" ;
|
|
1105
1023
|
function getCompiledMessageEncoder() {
|
|
1106
|
-
return {
|
|
1107
|
-
|
|
1108
|
-
encode: (compiledMessage) => {
|
|
1024
|
+
return createEncoder({
|
|
1025
|
+
getSizeFromValue: (compiledMessage) => {
|
|
1109
1026
|
if (compiledMessage.version === "legacy") {
|
|
1110
|
-
return getCompiledMessageLegacyEncoder().
|
|
1027
|
+
return getCompiledMessageLegacyEncoder().getSizeFromValue(compiledMessage);
|
|
1111
1028
|
} else {
|
|
1112
|
-
return getCompiledMessageVersionedEncoder().
|
|
1029
|
+
return getCompiledMessageVersionedEncoder().getSizeFromValue(compiledMessage);
|
|
1113
1030
|
}
|
|
1114
1031
|
},
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1032
|
+
write: (compiledMessage, bytes, offset) => {
|
|
1033
|
+
if (compiledMessage.version === "legacy") {
|
|
1034
|
+
return getCompiledMessageLegacyEncoder().write(compiledMessage, bytes, offset);
|
|
1035
|
+
} else {
|
|
1036
|
+
return getCompiledMessageVersionedEncoder().write(compiledMessage, bytes, offset);
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1118
1040
|
}
|
|
1119
1041
|
async function partiallySignTransaction(keyPairs, transaction) {
|
|
1120
1042
|
const compiledMessage = compileMessage(transaction);
|
|
@@ -1329,11 +1251,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1329
1251
|
}
|
|
1330
1252
|
async function signModifyingAndPartialTransactionSigners(transaction, modifyingSigners = [], partialSigners = [], abortSignal) {
|
|
1331
1253
|
var _a;
|
|
1332
|
-
const modifiedTransaction = await modifyingSigners.reduce(
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1254
|
+
const modifiedTransaction = await modifyingSigners.reduce(
|
|
1255
|
+
async (transaction2, modifyingSigner) => {
|
|
1256
|
+
abortSignal == null ? void 0 : abortSignal.throwIfAborted();
|
|
1257
|
+
const [tx] = await modifyingSigner.modifyAndSignTransactions([await transaction2], { abortSignal });
|
|
1258
|
+
return Object.freeze(tx);
|
|
1259
|
+
},
|
|
1260
|
+
Promise.resolve(transaction)
|
|
1261
|
+
);
|
|
1337
1262
|
abortSignal == null ? void 0 : abortSignal.throwIfAborted();
|
|
1338
1263
|
const signatureDictionaries = await Promise.all(
|
|
1339
1264
|
partialSigners.map(async (partialSigner) => {
|