@solana/transactions 2.0.0-experimental.e8095b1 → 2.0.0-experimental.e9e224b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +314 -5
- package/dist/index.browser.cjs +354 -138
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +357 -140
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +767 -1031
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +355 -140
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +354 -136
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +357 -140
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +20 -17
- package/dist/types/decompile-transaction.d.ts +7 -0
- package/dist/types/durable-nonce.d.ts +2 -3
- package/dist/types/serializers/message.d.ts +4 -4
- package/dist/types/serializers/transaction.d.ts +7 -4
- package/dist/types/signatures.d.ts +1 -0
- package/dist/types/wire-transaction.d.ts +1 -1
- package/package.json +12 -11
- package/dist/types/accounts.d.ts.map +0 -1
- package/dist/types/blockhash.d.ts.map +0 -1
- package/dist/types/compile-address-table-lookups.d.ts.map +0 -1
- package/dist/types/compile-header.d.ts.map +0 -1
- package/dist/types/compile-instructions.d.ts.map +0 -1
- package/dist/types/compile-lifetime-token.d.ts.map +0 -1
- package/dist/types/compile-static-accounts.d.ts.map +0 -1
- package/dist/types/compile-transaction.d.ts.map +0 -1
- package/dist/types/create-transaction.d.ts.map +0 -1
- package/dist/types/durable-nonce.d.ts.map +0 -1
- package/dist/types/fee-payer.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/instructions.d.ts.map +0 -1
- package/dist/types/message.d.ts.map +0 -1
- package/dist/types/serializers/address-table-lookup.d.ts.map +0 -1
- package/dist/types/serializers/header.d.ts.map +0 -1
- package/dist/types/serializers/index.d.ts.map +0 -1
- package/dist/types/serializers/instruction.d.ts.map +0 -1
- package/dist/types/serializers/message.d.ts.map +0 -1
- package/dist/types/serializers/transaction-version.d.ts.map +0 -1
- package/dist/types/serializers/transaction.d.ts.map +0 -1
- package/dist/types/serializers/unimplemented.d.ts +0 -3
- package/dist/types/serializers/unimplemented.d.ts.map +0 -1
- package/dist/types/signatures.d.ts.map +0 -1
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/unsigned-transaction.d.ts.map +0 -1
- package/dist/types/wire-transaction.d.ts.map +0 -1
|
@@ -2,272 +2,201 @@ this.globalThis = this.globalThis || {};
|
|
|
2
2
|
this.globalThis.solanaWeb3 = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
// ../codecs-core/dist/index.browser.js
|
|
6
|
+
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) {
|
|
7
|
+
if (bytes.length - offset <= 0) {
|
|
8
|
+
throw new Error(`Codec [${codecDescription}] cannot decode empty byte arrays.`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) {
|
|
12
|
+
const bytesLength = bytes.length - offset;
|
|
13
|
+
if (bytesLength < expected) {
|
|
14
|
+
throw new Error(`Codec [${codecDescription}] expected ${expected} bytes, got ${bytesLength}.`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
var mergeBytes = (byteArrays) => {
|
|
18
|
+
const nonEmptyByteArrays = byteArrays.filter((arr) => arr.length);
|
|
19
|
+
if (nonEmptyByteArrays.length === 0) {
|
|
20
|
+
return byteArrays.length ? byteArrays[0] : new Uint8Array();
|
|
21
|
+
}
|
|
22
|
+
if (nonEmptyByteArrays.length === 1) {
|
|
23
|
+
return nonEmptyByteArrays[0];
|
|
24
|
+
}
|
|
25
|
+
const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0);
|
|
15
26
|
const result = new Uint8Array(totalLength);
|
|
16
27
|
let offset = 0;
|
|
17
|
-
|
|
28
|
+
nonEmptyByteArrays.forEach((arr) => {
|
|
18
29
|
result.set(arr, offset);
|
|
19
30
|
offset += arr.length;
|
|
20
31
|
});
|
|
21
32
|
return result;
|
|
22
33
|
};
|
|
23
|
-
var padBytes = (
|
|
24
|
-
if (
|
|
25
|
-
return
|
|
34
|
+
var padBytes = (bytes, length) => {
|
|
35
|
+
if (bytes.length >= length)
|
|
36
|
+
return bytes;
|
|
26
37
|
const paddedBytes = new Uint8Array(length).fill(0);
|
|
27
|
-
paddedBytes.set(
|
|
38
|
+
paddedBytes.set(bytes);
|
|
28
39
|
return paddedBytes;
|
|
29
40
|
};
|
|
30
|
-
var fixBytes = (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
__publicField(this, "name", "DeserializingEmptyBufferError");
|
|
41
|
+
var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
|
|
42
|
+
function combineCodec(encoder, decoder, description) {
|
|
43
|
+
if (encoder.fixedSize !== decoder.fixedSize) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`
|
|
46
|
+
);
|
|
37
47
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
__publicField(this, "name", "NotEnoughBytesError");
|
|
48
|
+
if (encoder.maxSize !== decoder.maxSize) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`
|
|
51
|
+
);
|
|
43
52
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
super(message);
|
|
49
|
-
__publicField(this, "name", "ExpectedFixedSizeSerializerError");
|
|
53
|
+
if (description === void 0 && encoder.description !== decoder.description) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
`Encoder and decoder must have the same description, got [${encoder.description}] and [${decoder.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`
|
|
56
|
+
);
|
|
50
57
|
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/fixSerializer.mjs
|
|
54
|
-
function fixSerializer(serializer, fixedBytes, description) {
|
|
55
58
|
return {
|
|
56
|
-
|
|
59
|
+
decode: decoder.decode,
|
|
60
|
+
description: description ?? encoder.description,
|
|
61
|
+
encode: encoder.encode,
|
|
62
|
+
fixedSize: encoder.fixedSize,
|
|
63
|
+
maxSize: encoder.maxSize
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function fixCodecHelper(data, fixedBytes, description) {
|
|
67
|
+
return {
|
|
68
|
+
description: description ?? `fixed(${fixedBytes}, ${data.description})`,
|
|
57
69
|
fixedSize: fixedBytes,
|
|
58
|
-
maxSize: fixedBytes
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
maxSize: fixedBytes
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function fixEncoder(encoder, fixedBytes, description) {
|
|
74
|
+
return {
|
|
75
|
+
...fixCodecHelper(encoder, fixedBytes, description),
|
|
76
|
+
encode: (value) => fixBytes(encoder.encode(value), fixedBytes)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function fixDecoder(decoder, fixedBytes, description) {
|
|
80
|
+
return {
|
|
81
|
+
...fixCodecHelper(decoder, fixedBytes, description),
|
|
82
|
+
decode: (bytes, offset = 0) => {
|
|
83
|
+
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset);
|
|
84
|
+
if (offset > 0 || bytes.length > fixedBytes) {
|
|
85
|
+
bytes = bytes.slice(offset, offset + fixedBytes);
|
|
64
86
|
}
|
|
65
|
-
if (
|
|
66
|
-
|
|
87
|
+
if (decoder.fixedSize !== null) {
|
|
88
|
+
bytes = fixBytes(bytes, decoder.fixedSize);
|
|
67
89
|
}
|
|
68
|
-
const [value] =
|
|
90
|
+
const [value] = decoder.decode(bytes, 0);
|
|
69
91
|
return [value, offset + fixedBytes];
|
|
70
92
|
}
|
|
71
93
|
};
|
|
72
94
|
}
|
|
73
|
-
|
|
74
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/mapSerializer.mjs
|
|
75
|
-
function mapSerializer(serializer, unmap, map) {
|
|
95
|
+
function mapEncoder(encoder, unmap) {
|
|
76
96
|
return {
|
|
77
|
-
description:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
deserialize: (buffer, offset = 0) => {
|
|
82
|
-
const [value, length] = serializer.deserialize(buffer, offset);
|
|
83
|
-
return map ? [map(value, buffer, offset), length] : [value, length];
|
|
84
|
-
}
|
|
97
|
+
description: encoder.description,
|
|
98
|
+
encode: (value) => encoder.encode(unmap(value)),
|
|
99
|
+
fixedSize: encoder.fixedSize,
|
|
100
|
+
maxSize: encoder.maxSize
|
|
85
101
|
};
|
|
86
102
|
}
|
|
87
|
-
|
|
88
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/errors.mjs
|
|
89
|
-
var InvalidBaseStringError = class extends Error {
|
|
90
|
-
constructor(value, base, cause) {
|
|
91
|
-
const message = `Expected a string of base ${base}, got [${value}].`;
|
|
92
|
-
super(message);
|
|
93
|
-
__publicField(this, "name", "InvalidBaseStringError");
|
|
94
|
-
this.cause = cause;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
|
|
99
|
-
var baseX = (alphabet) => {
|
|
100
|
-
const base = alphabet.length;
|
|
101
|
-
const baseBigInt = BigInt(base);
|
|
103
|
+
function mapDecoder(decoder, map) {
|
|
102
104
|
return {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
serialize(value) {
|
|
107
|
-
if (!value.match(new RegExp(`^[${alphabet}]*$`))) {
|
|
108
|
-
throw new InvalidBaseStringError(value, base);
|
|
109
|
-
}
|
|
110
|
-
if (value === "")
|
|
111
|
-
return new Uint8Array();
|
|
112
|
-
const chars = [...value];
|
|
113
|
-
let trailIndex = chars.findIndex((c) => c !== alphabet[0]);
|
|
114
|
-
trailIndex = trailIndex === -1 ? chars.length : trailIndex;
|
|
115
|
-
const leadingZeroes = Array(trailIndex).fill(0);
|
|
116
|
-
if (trailIndex === chars.length)
|
|
117
|
-
return Uint8Array.from(leadingZeroes);
|
|
118
|
-
const tailChars = chars.slice(trailIndex);
|
|
119
|
-
let base10Number = 0n;
|
|
120
|
-
let baseXPower = 1n;
|
|
121
|
-
for (let i = tailChars.length - 1; i >= 0; i -= 1) {
|
|
122
|
-
base10Number += baseXPower * BigInt(alphabet.indexOf(tailChars[i]));
|
|
123
|
-
baseXPower *= baseBigInt;
|
|
124
|
-
}
|
|
125
|
-
const tailBytes = [];
|
|
126
|
-
while (base10Number > 0n) {
|
|
127
|
-
tailBytes.unshift(Number(base10Number % 256n));
|
|
128
|
-
base10Number /= 256n;
|
|
129
|
-
}
|
|
130
|
-
return Uint8Array.from(leadingZeroes.concat(tailBytes));
|
|
105
|
+
decode: (bytes, offset = 0) => {
|
|
106
|
+
const [value, length] = decoder.decode(bytes, offset);
|
|
107
|
+
return [map(value, bytes, offset), length];
|
|
131
108
|
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const bytes2 = buffer.slice(offset);
|
|
136
|
-
let trailIndex = bytes2.findIndex((n) => n !== 0);
|
|
137
|
-
trailIndex = trailIndex === -1 ? bytes2.length : trailIndex;
|
|
138
|
-
const leadingZeroes = alphabet[0].repeat(trailIndex);
|
|
139
|
-
if (trailIndex === bytes2.length)
|
|
140
|
-
return [leadingZeroes, buffer.length];
|
|
141
|
-
let base10Number = bytes2.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
|
|
142
|
-
const tailChars = [];
|
|
143
|
-
while (base10Number > 0n) {
|
|
144
|
-
tailChars.unshift(alphabet[Number(base10Number % baseBigInt)]);
|
|
145
|
-
base10Number /= baseBigInt;
|
|
146
|
-
}
|
|
147
|
-
return [leadingZeroes + tailChars.join(""), buffer.length];
|
|
148
|
-
}
|
|
109
|
+
description: decoder.description,
|
|
110
|
+
fixedSize: decoder.fixedSize,
|
|
111
|
+
maxSize: decoder.maxSize
|
|
149
112
|
};
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base58.mjs
|
|
153
|
-
var base58 = baseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
|
|
154
|
-
|
|
155
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/nullCharacters.mjs
|
|
156
|
-
var removeNullCharacters = (value) => (
|
|
157
|
-
// eslint-disable-next-line no-control-regex
|
|
158
|
-
value.replace(/\u0000/g, "")
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/utf8.mjs
|
|
162
|
-
var utf8 = {
|
|
163
|
-
description: "utf8",
|
|
164
|
-
fixedSize: null,
|
|
165
|
-
maxSize: null,
|
|
166
|
-
serialize(value) {
|
|
167
|
-
return new TextEncoder().encode(value);
|
|
168
|
-
},
|
|
169
|
-
deserialize(buffer, offset = 0) {
|
|
170
|
-
const value = new TextDecoder().decode(buffer.slice(offset));
|
|
171
|
-
return [removeNullCharacters(value), buffer.length];
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/common.mjs
|
|
176
|
-
var Endian;
|
|
177
|
-
(function(Endian2) {
|
|
178
|
-
Endian2["Little"] = "le";
|
|
179
|
-
Endian2["Big"] = "be";
|
|
180
|
-
})(Endian || (Endian = {}));
|
|
113
|
+
}
|
|
181
114
|
|
|
182
|
-
//
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
115
|
+
// ../codecs-numbers/dist/index.browser.js
|
|
116
|
+
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) {
|
|
117
|
+
if (value < min || value > max) {
|
|
118
|
+
throw new Error(
|
|
119
|
+
`Codec [${codecDescription}] expected number to be in the range [${min}, ${max}], got ${value}.`
|
|
120
|
+
);
|
|
187
121
|
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/utils.mjs
|
|
191
|
-
function numberFactory(input) {
|
|
122
|
+
}
|
|
123
|
+
function sharedNumberFactory(input) {
|
|
192
124
|
let littleEndian;
|
|
193
125
|
let defaultDescription = input.name;
|
|
194
126
|
if (input.size > 1) {
|
|
195
|
-
littleEndian = !("endian" in input.options) || input.options.endian ===
|
|
127
|
+
littleEndian = !("endian" in input.options) || input.options.endian === 0;
|
|
196
128
|
defaultDescription += littleEndian ? "(le)" : "(be)";
|
|
197
129
|
}
|
|
198
130
|
return {
|
|
199
131
|
description: input.options.description ?? defaultDescription,
|
|
200
132
|
fixedSize: input.size,
|
|
201
|
-
|
|
202
|
-
|
|
133
|
+
littleEndian,
|
|
134
|
+
maxSize: input.size
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function numberEncoderFactory(input) {
|
|
138
|
+
const codecData = sharedNumberFactory(input);
|
|
139
|
+
return {
|
|
140
|
+
description: codecData.description,
|
|
141
|
+
encode(value) {
|
|
203
142
|
if (input.range) {
|
|
204
|
-
|
|
143
|
+
assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);
|
|
205
144
|
}
|
|
206
|
-
const
|
|
207
|
-
input.set(new DataView(
|
|
208
|
-
return new Uint8Array(
|
|
145
|
+
const arrayBuffer = new ArrayBuffer(input.size);
|
|
146
|
+
input.set(new DataView(arrayBuffer), value, codecData.littleEndian);
|
|
147
|
+
return new Uint8Array(arrayBuffer);
|
|
209
148
|
},
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
assertEnoughBytes("i8", slice, input.size);
|
|
213
|
-
const view = toDataView(slice);
|
|
214
|
-
return [input.get(view, littleEndian), offset + input.size];
|
|
215
|
-
}
|
|
149
|
+
fixedSize: codecData.fixedSize,
|
|
150
|
+
maxSize: codecData.maxSize
|
|
216
151
|
};
|
|
217
152
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
range: [0, Number("0xffffffff")],
|
|
239
|
-
set: (view, value, le) => view.setUint32(0, Number(value), le),
|
|
240
|
-
get: (view, le) => view.getUint32(0, le),
|
|
241
|
-
options
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/shortU16.mjs
|
|
245
|
-
var shortU16 = (options = {}) => ({
|
|
153
|
+
function numberDecoderFactory(input) {
|
|
154
|
+
const codecData = sharedNumberFactory(input);
|
|
155
|
+
return {
|
|
156
|
+
decode(bytes, offset = 0) {
|
|
157
|
+
assertByteArrayIsNotEmptyForCodec(codecData.description, bytes, offset);
|
|
158
|
+
assertByteArrayHasEnoughBytesForCodec(codecData.description, input.size, bytes, offset);
|
|
159
|
+
const view = new DataView(toArrayBuffer(bytes, offset, input.size));
|
|
160
|
+
return [input.get(view, codecData.littleEndian), offset + input.size];
|
|
161
|
+
},
|
|
162
|
+
description: codecData.description,
|
|
163
|
+
fixedSize: codecData.fixedSize,
|
|
164
|
+
maxSize: codecData.maxSize
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function toArrayBuffer(bytes, offset, length) {
|
|
168
|
+
const bytesOffset = bytes.byteOffset + (offset ?? 0);
|
|
169
|
+
const bytesLength = length ?? bytes.byteLength;
|
|
170
|
+
return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength);
|
|
171
|
+
}
|
|
172
|
+
var getShortU16Encoder = (options = {}) => ({
|
|
246
173
|
description: options.description ?? "shortU16",
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
assertRange("shortU16", 0, 65535, value);
|
|
251
|
-
const bytes2 = [0];
|
|
174
|
+
encode: (value) => {
|
|
175
|
+
assertNumberIsBetweenForCodec("shortU16", 0, 65535, value);
|
|
176
|
+
const bytes = [0];
|
|
252
177
|
for (let ii = 0; ; ii += 1) {
|
|
253
178
|
const alignedValue = value >> ii * 7;
|
|
254
179
|
if (alignedValue === 0) {
|
|
255
180
|
break;
|
|
256
181
|
}
|
|
257
182
|
const nextSevenBits = 127 & alignedValue;
|
|
258
|
-
|
|
183
|
+
bytes[ii] = nextSevenBits;
|
|
259
184
|
if (ii > 0) {
|
|
260
|
-
|
|
185
|
+
bytes[ii - 1] |= 128;
|
|
261
186
|
}
|
|
262
187
|
}
|
|
263
|
-
return new Uint8Array(
|
|
188
|
+
return new Uint8Array(bytes);
|
|
264
189
|
},
|
|
265
|
-
|
|
190
|
+
fixedSize: null,
|
|
191
|
+
maxSize: 3
|
|
192
|
+
});
|
|
193
|
+
var getShortU16Decoder = (options = {}) => ({
|
|
194
|
+
decode: (bytes, offset = 0) => {
|
|
266
195
|
let value = 0;
|
|
267
196
|
let byteCount = 0;
|
|
268
197
|
while (++byteCount) {
|
|
269
198
|
const byteIndex = byteCount - 1;
|
|
270
|
-
const currentByte =
|
|
199
|
+
const currentByte = bytes[offset + byteIndex];
|
|
271
200
|
const nextSevenBits = 127 & currentByte;
|
|
272
201
|
value |= nextSevenBits << byteIndex * 7;
|
|
273
202
|
if ((currentByte & 128) === 0) {
|
|
@@ -275,212 +204,183 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
275
204
|
}
|
|
276
205
|
}
|
|
277
206
|
return [value, offset + byteCount];
|
|
278
|
-
}
|
|
207
|
+
},
|
|
208
|
+
description: options.description ?? "shortU16",
|
|
209
|
+
fixedSize: null,
|
|
210
|
+
maxSize: 3
|
|
211
|
+
});
|
|
212
|
+
var getU32Encoder = (options = {}) => numberEncoderFactory({
|
|
213
|
+
name: "u32",
|
|
214
|
+
options,
|
|
215
|
+
range: [0, Number("0xffffffff")],
|
|
216
|
+
set: (view, value, le) => view.setUint32(0, value, le),
|
|
217
|
+
size: 4
|
|
218
|
+
});
|
|
219
|
+
var getU32Decoder = (options = {}) => numberDecoderFactory({
|
|
220
|
+
get: (view, le) => view.getUint32(0, le),
|
|
221
|
+
name: "u32",
|
|
222
|
+
options,
|
|
223
|
+
size: 4
|
|
224
|
+
});
|
|
225
|
+
var getU8Encoder = (options = {}) => numberEncoderFactory({
|
|
226
|
+
name: "u8",
|
|
227
|
+
options,
|
|
228
|
+
range: [0, Number("0xff")],
|
|
229
|
+
set: (view, value) => view.setUint8(0, value),
|
|
230
|
+
size: 1
|
|
231
|
+
});
|
|
232
|
+
var getU8Decoder = (options = {}) => numberDecoderFactory({
|
|
233
|
+
get: (view) => view.getUint8(0),
|
|
234
|
+
name: "u8",
|
|
235
|
+
options,
|
|
236
|
+
size: 1
|
|
279
237
|
});
|
|
280
238
|
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
__publicField(this, "name", "InvalidNumberOfItemsError");
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
var InvalidArrayLikeRemainderSizeError = class extends Error {
|
|
289
|
-
constructor(remainderSize, itemSize) {
|
|
290
|
-
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.`);
|
|
291
|
-
__publicField(this, "name", "InvalidArrayLikeRemainderSizeError");
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
var UnrecognizedArrayLikeSerializerSizeError = class extends Error {
|
|
295
|
-
constructor(size) {
|
|
296
|
-
super(`Unrecognized array-like serializer size: ${JSON.stringify(size)}`);
|
|
297
|
-
__publicField(this, "name", "UnrecognizedArrayLikeSerializerSizeError");
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/sumSerializerSizes.mjs
|
|
302
|
-
function sumSerializerSizes(sizes) {
|
|
303
|
-
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
|
|
307
|
-
function getResolvedSize(size, childrenSizes, bytes2, offset) {
|
|
308
|
-
if (typeof size === "number") {
|
|
309
|
-
return [size, offset];
|
|
310
|
-
}
|
|
311
|
-
if (typeof size === "object") {
|
|
312
|
-
return size.deserialize(bytes2, offset);
|
|
313
|
-
}
|
|
314
|
-
if (size === "remainder") {
|
|
315
|
-
const childrenSize = sumSerializerSizes(childrenSizes);
|
|
316
|
-
if (childrenSize === null) {
|
|
317
|
-
throw new ExpectedFixedSizeSerializerError('Serializers of "remainder" size must have fixed-size items.');
|
|
318
|
-
}
|
|
319
|
-
const remainder = bytes2.slice(offset).length;
|
|
320
|
-
if (remainder % childrenSize !== 0) {
|
|
321
|
-
throw new InvalidArrayLikeRemainderSizeError(remainder, childrenSize);
|
|
322
|
-
}
|
|
323
|
-
return [remainder / childrenSize, offset];
|
|
239
|
+
// ../codecs-strings/dist/index.browser.js
|
|
240
|
+
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
|
|
241
|
+
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
|
|
242
|
+
throw new Error(`Expected a string of base ${alphabet4.length}, got [${givenValue}].`);
|
|
324
243
|
}
|
|
325
|
-
throw new UnrecognizedArrayLikeSerializerSizeError(size);
|
|
326
|
-
}
|
|
327
|
-
function getSizeDescription(size) {
|
|
328
|
-
return typeof size === "object" ? size.description : `${size}`;
|
|
329
|
-
}
|
|
330
|
-
function getSizeFromChildren(size, childrenSizes) {
|
|
331
|
-
if (typeof size !== "number")
|
|
332
|
-
return null;
|
|
333
|
-
if (size === 0)
|
|
334
|
-
return 0;
|
|
335
|
-
const childrenSize = sumSerializerSizes(childrenSizes);
|
|
336
|
-
return childrenSize === null ? null : childrenSize * size;
|
|
337
244
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
|
|
343
|
-
function array(item, options = {}) {
|
|
344
|
-
const size = options.size ?? u32();
|
|
345
|
-
if (size === "remainder" && item.fixedSize === null) {
|
|
346
|
-
throw new ExpectedFixedSizeSerializerError('Serializers of "remainder" size must have fixed-size items.');
|
|
347
|
-
}
|
|
245
|
+
var getBaseXEncoder = (alphabet4) => {
|
|
246
|
+
const base = alphabet4.length;
|
|
247
|
+
const baseBigInt = BigInt(base);
|
|
348
248
|
return {
|
|
349
|
-
description:
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const [value, newOffset2] = item.deserialize(bytes2, offset);
|
|
367
|
-
values.push(value);
|
|
368
|
-
offset = newOffset2;
|
|
249
|
+
description: `base${base}`,
|
|
250
|
+
encode(value) {
|
|
251
|
+
assertValidBaseString(alphabet4, value);
|
|
252
|
+
if (value === "")
|
|
253
|
+
return new Uint8Array();
|
|
254
|
+
const chars = [...value];
|
|
255
|
+
let trailIndex = chars.findIndex((c) => c !== alphabet4[0]);
|
|
256
|
+
trailIndex = trailIndex === -1 ? chars.length : trailIndex;
|
|
257
|
+
const leadingZeroes = Array(trailIndex).fill(0);
|
|
258
|
+
if (trailIndex === chars.length)
|
|
259
|
+
return Uint8Array.from(leadingZeroes);
|
|
260
|
+
const tailChars = chars.slice(trailIndex);
|
|
261
|
+
let base10Number = 0n;
|
|
262
|
+
let baseXPower = 1n;
|
|
263
|
+
for (let i = tailChars.length - 1; i >= 0; i -= 1) {
|
|
264
|
+
base10Number += baseXPower * BigInt(alphabet4.indexOf(tailChars[i]));
|
|
265
|
+
baseXPower *= baseBigInt;
|
|
369
266
|
}
|
|
370
|
-
|
|
371
|
-
|
|
267
|
+
const tailBytes = [];
|
|
268
|
+
while (base10Number > 0n) {
|
|
269
|
+
tailBytes.unshift(Number(base10Number % 256n));
|
|
270
|
+
base10Number /= 256n;
|
|
271
|
+
}
|
|
272
|
+
return Uint8Array.from(leadingZeroes.concat(tailBytes));
|
|
273
|
+
},
|
|
274
|
+
fixedSize: null,
|
|
275
|
+
maxSize: null
|
|
372
276
|
};
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
277
|
+
};
|
|
278
|
+
var getBaseXDecoder = (alphabet4) => {
|
|
279
|
+
const base = alphabet4.length;
|
|
280
|
+
const baseBigInt = BigInt(base);
|
|
281
|
+
return {
|
|
282
|
+
decode(rawBytes, offset = 0) {
|
|
283
|
+
const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);
|
|
284
|
+
if (bytes.length === 0)
|
|
285
|
+
return ["", 0];
|
|
286
|
+
let trailIndex = bytes.findIndex((n) => n !== 0);
|
|
287
|
+
trailIndex = trailIndex === -1 ? bytes.length : trailIndex;
|
|
288
|
+
const leadingZeroes = alphabet4[0].repeat(trailIndex);
|
|
289
|
+
if (trailIndex === bytes.length)
|
|
290
|
+
return [leadingZeroes, rawBytes.length];
|
|
291
|
+
let base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
|
|
292
|
+
const tailChars = [];
|
|
293
|
+
while (base10Number > 0n) {
|
|
294
|
+
tailChars.unshift(alphabet4[Number(base10Number % baseBigInt)]);
|
|
295
|
+
base10Number /= baseBigInt;
|
|
296
|
+
}
|
|
297
|
+
return [leadingZeroes + tailChars.join(""), rawBytes.length];
|
|
298
|
+
},
|
|
299
|
+
description: `base${base}`,
|
|
381
300
|
fixedSize: null,
|
|
382
|
-
maxSize: null
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
301
|
+
maxSize: null
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
305
|
+
var getBase58Encoder = () => getBaseXEncoder(alphabet2);
|
|
306
|
+
var getBase58Decoder = () => getBaseXDecoder(alphabet2);
|
|
307
|
+
var removeNullCharacters = (value) => (
|
|
308
|
+
// eslint-disable-next-line no-control-regex
|
|
309
|
+
value.replace(/\u0000/g, "")
|
|
310
|
+
);
|
|
311
|
+
var e = globalThis.TextDecoder;
|
|
312
|
+
var o = globalThis.TextEncoder;
|
|
313
|
+
var getUtf8Encoder = () => {
|
|
314
|
+
let textEncoder;
|
|
315
|
+
return {
|
|
316
|
+
description: "utf8",
|
|
317
|
+
encode: (value) => new Uint8Array((textEncoder || (textEncoder = new o())).encode(value)),
|
|
318
|
+
fixedSize: null,
|
|
319
|
+
maxSize: null
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
var getUtf8Decoder = () => {
|
|
323
|
+
let textDecoder;
|
|
324
|
+
return {
|
|
325
|
+
decode(bytes, offset = 0) {
|
|
326
|
+
const value = (textDecoder || (textDecoder = new e())).decode(bytes.slice(offset));
|
|
327
|
+
return [removeNullCharacters(value), bytes.length];
|
|
328
|
+
},
|
|
329
|
+
description: "utf8",
|
|
330
|
+
fixedSize: null,
|
|
331
|
+
maxSize: null
|
|
388
332
|
};
|
|
333
|
+
};
|
|
334
|
+
var getStringEncoder = (options = {}) => {
|
|
335
|
+
const size = options.size ?? getU32Encoder();
|
|
336
|
+
const encoding = options.encoding ?? getUtf8Encoder();
|
|
337
|
+
const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
389
338
|
if (size === "variable") {
|
|
390
|
-
return
|
|
339
|
+
return { ...encoding, description };
|
|
391
340
|
}
|
|
392
341
|
if (typeof size === "number") {
|
|
393
|
-
return
|
|
342
|
+
return fixEncoder(encoding, size, description);
|
|
394
343
|
}
|
|
395
344
|
return {
|
|
396
345
|
description,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
const contentBytes = byteSerializer.serialize(value);
|
|
401
|
-
const lengthBytes = size.serialize(contentBytes.length);
|
|
346
|
+
encode: (value) => {
|
|
347
|
+
const contentBytes = encoding.encode(value);
|
|
348
|
+
const lengthBytes = size.encode(contentBytes.length);
|
|
402
349
|
return mergeBytes([lengthBytes, contentBytes]);
|
|
403
350
|
},
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
throw new DeserializingEmptyBufferError("bytes");
|
|
407
|
-
}
|
|
408
|
-
const [lengthBigInt, lengthOffset] = size.deserialize(buffer, offset);
|
|
409
|
-
const length = Number(lengthBigInt);
|
|
410
|
-
offset = lengthOffset;
|
|
411
|
-
const contentBuffer = buffer.slice(offset, offset + length);
|
|
412
|
-
if (contentBuffer.length < length) {
|
|
413
|
-
throw new NotEnoughBytesError("bytes", length, contentBuffer.length);
|
|
414
|
-
}
|
|
415
|
-
const [value, contentOffset] = byteSerializer.deserialize(contentBuffer);
|
|
416
|
-
offset += contentOffset;
|
|
417
|
-
return [value, offset];
|
|
418
|
-
}
|
|
351
|
+
fixedSize: null,
|
|
352
|
+
maxSize: null
|
|
419
353
|
};
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
const size = options.size ?? u32();
|
|
425
|
-
const encoding = options.encoding ?? utf8;
|
|
354
|
+
};
|
|
355
|
+
var getStringDecoder = (options = {}) => {
|
|
356
|
+
const size = options.size ?? getU32Decoder();
|
|
357
|
+
const encoding = options.encoding ?? getUtf8Decoder();
|
|
426
358
|
const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
427
359
|
if (size === "variable") {
|
|
428
|
-
return {
|
|
429
|
-
...encoding,
|
|
430
|
-
description
|
|
431
|
-
};
|
|
360
|
+
return { ...encoding, description };
|
|
432
361
|
}
|
|
433
362
|
if (typeof size === "number") {
|
|
434
|
-
return
|
|
363
|
+
return fixDecoder(encoding, size, description);
|
|
435
364
|
}
|
|
436
365
|
return {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
serialize: (value) => {
|
|
441
|
-
const contentBytes = encoding.serialize(value);
|
|
442
|
-
const lengthBytes = size.serialize(contentBytes.length);
|
|
443
|
-
return mergeBytes([lengthBytes, contentBytes]);
|
|
444
|
-
},
|
|
445
|
-
deserialize: (buffer, offset = 0) => {
|
|
446
|
-
if (buffer.slice(offset).length === 0) {
|
|
447
|
-
throw new DeserializingEmptyBufferError("string");
|
|
448
|
-
}
|
|
449
|
-
const [lengthBigInt, lengthOffset] = size.deserialize(buffer, offset);
|
|
366
|
+
decode: (bytes, offset = 0) => {
|
|
367
|
+
assertByteArrayIsNotEmptyForCodec("string", bytes, offset);
|
|
368
|
+
const [lengthBigInt, lengthOffset] = size.decode(bytes, offset);
|
|
450
369
|
const length = Number(lengthBigInt);
|
|
451
370
|
offset = lengthOffset;
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
const [value, contentOffset] = encoding.deserialize(contentBuffer);
|
|
371
|
+
const contentBytes = bytes.slice(offset, offset + length);
|
|
372
|
+
assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes);
|
|
373
|
+
const [value, contentOffset] = encoding.decode(contentBytes);
|
|
457
374
|
offset += contentOffset;
|
|
458
375
|
return [value, offset];
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/struct.mjs
|
|
464
|
-
function struct(fields, options = {}) {
|
|
465
|
-
const fieldDescriptions = fields.map(([name, serializer]) => `${String(name)}: ${serializer.description}`).join(", ");
|
|
466
|
-
return {
|
|
467
|
-
description: options.description ?? `struct(${fieldDescriptions})`,
|
|
468
|
-
fixedSize: sumSerializerSizes(fields.map(([, field]) => field.fixedSize)),
|
|
469
|
-
maxSize: sumSerializerSizes(fields.map(([, field]) => field.maxSize)),
|
|
470
|
-
serialize: (struct2) => {
|
|
471
|
-
const fieldBytes = fields.map(([key, serializer]) => serializer.serialize(struct2[key]));
|
|
472
|
-
return mergeBytes(fieldBytes);
|
|
473
376
|
},
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
const [value, newOffset] = serializer.deserialize(bytes2, offset);
|
|
478
|
-
offset = newOffset;
|
|
479
|
-
struct2[key] = value;
|
|
480
|
-
});
|
|
481
|
-
return [struct2, offset];
|
|
482
|
-
}
|
|
377
|
+
description,
|
|
378
|
+
fixedSize: null,
|
|
379
|
+
maxSize: null
|
|
483
380
|
};
|
|
381
|
+
};
|
|
382
|
+
function getSizeDescription(size) {
|
|
383
|
+
return typeof size === "object" ? size.description : `${size}`;
|
|
484
384
|
}
|
|
485
385
|
|
|
486
386
|
// src/unsigned-transaction.ts
|
|
@@ -498,7 +398,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
498
398
|
}
|
|
499
399
|
|
|
500
400
|
// src/blockhash.ts
|
|
401
|
+
var base58Encoder;
|
|
501
402
|
function assertIsBlockhash(putativeBlockhash) {
|
|
403
|
+
if (!base58Encoder)
|
|
404
|
+
base58Encoder = getBase58Encoder();
|
|
502
405
|
try {
|
|
503
406
|
if (
|
|
504
407
|
// Lowest value (32 bytes of zeroes)
|
|
@@ -507,8 +410,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
507
410
|
) {
|
|
508
411
|
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
509
412
|
}
|
|
510
|
-
const
|
|
511
|
-
const numBytes =
|
|
413
|
+
const bytes = base58Encoder.encode(putativeBlockhash);
|
|
414
|
+
const numBytes = bytes.byteLength;
|
|
512
415
|
if (numBytes !== 32) {
|
|
513
416
|
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
514
417
|
}
|
|
@@ -593,7 +496,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
593
496
|
instruction.accounts?.length === 3 && // First account is nonce account address
|
|
594
497
|
instruction.accounts[0].address != null && instruction.accounts[0].role === AccountRole.WRITABLE && // Second account is recent blockhashes sysvar
|
|
595
498
|
instruction.accounts[1].address === RECENT_BLOCKHASHES_SYSVAR_ADDRESS && instruction.accounts[1].role === AccountRole.READONLY && // Third account is nonce authority account
|
|
596
|
-
instruction.accounts[2].address != null && instruction.accounts[2].role
|
|
499
|
+
instruction.accounts[2].address != null && isSignerRole(instruction.accounts[2].role);
|
|
597
500
|
}
|
|
598
501
|
function isAdvanceNonceAccountInstructionData(data) {
|
|
599
502
|
return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
|
|
@@ -601,21 +504,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
601
504
|
function isDurableNonceTransaction(transaction) {
|
|
602
505
|
return "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.nonce === "string" && transaction.instructions[0] != null && isAdvanceNonceAccountInstruction(transaction.instructions[0]);
|
|
603
506
|
}
|
|
507
|
+
function isAdvanceNonceAccountInstructionForNonce(instruction, nonceAccountAddress, nonceAuthorityAddress) {
|
|
508
|
+
return instruction.accounts[0].address === nonceAccountAddress && instruction.accounts[2].address === nonceAuthorityAddress;
|
|
509
|
+
}
|
|
604
510
|
function setTransactionLifetimeUsingDurableNonce({
|
|
605
511
|
nonce,
|
|
606
512
|
nonceAccountAddress,
|
|
607
513
|
nonceAuthorityAddress
|
|
608
514
|
}, transaction) {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
515
|
+
let newInstructions;
|
|
516
|
+
const firstInstruction = transaction.instructions[0];
|
|
517
|
+
if (firstInstruction && isAdvanceNonceAccountInstruction(firstInstruction)) {
|
|
518
|
+
if (isAdvanceNonceAccountInstructionForNonce(firstInstruction, nonceAccountAddress, nonceAuthorityAddress)) {
|
|
519
|
+
if (isDurableNonceTransaction(transaction) && transaction.lifetimeConstraint.nonce === nonce) {
|
|
520
|
+
return transaction;
|
|
521
|
+
} else {
|
|
522
|
+
newInstructions = [firstInstruction, ...transaction.instructions.slice(1)];
|
|
523
|
+
}
|
|
524
|
+
} else {
|
|
525
|
+
newInstructions = [
|
|
526
|
+
createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
|
|
527
|
+
...transaction.instructions.slice(1)
|
|
528
|
+
];
|
|
529
|
+
}
|
|
530
|
+
} else {
|
|
531
|
+
newInstructions = [
|
|
532
|
+
createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
|
|
533
|
+
...transaction.instructions
|
|
534
|
+
];
|
|
612
535
|
}
|
|
613
536
|
const out = {
|
|
614
537
|
...getUnsignedTransaction(transaction),
|
|
615
|
-
instructions:
|
|
616
|
-
createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
|
|
617
|
-
...isAlreadyDurableNonceTransaction ? transaction.instructions.slice(1) : transaction.instructions
|
|
618
|
-
],
|
|
538
|
+
instructions: newInstructions,
|
|
619
539
|
lifetimeConstraint: {
|
|
620
540
|
nonce
|
|
621
541
|
}
|
|
@@ -655,386 +575,182 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
655
575
|
return out;
|
|
656
576
|
}
|
|
657
577
|
|
|
658
|
-
// ../codecs-
|
|
659
|
-
function
|
|
660
|
-
|
|
661
|
-
throw new Error(`Codec [${codecDescription}] cannot decode empty byte arrays.`);
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes2, offset = 0) {
|
|
665
|
-
const bytesLength = bytes2.length - offset;
|
|
666
|
-
if (bytesLength < expected) {
|
|
667
|
-
throw new Error(`Codec [${codecDescription}] expected ${expected} bytes, got ${bytesLength}.`);
|
|
668
|
-
}
|
|
578
|
+
// ../codecs-data-structures/dist/index.browser.js
|
|
579
|
+
function sumCodecSizes(sizes) {
|
|
580
|
+
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
|
|
669
581
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
return byteArrays.length ? byteArrays[0] : new Uint8Array();
|
|
674
|
-
}
|
|
675
|
-
if (nonEmptyByteArrays.length === 1) {
|
|
676
|
-
return nonEmptyByteArrays[0];
|
|
677
|
-
}
|
|
678
|
-
const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0);
|
|
679
|
-
const result = new Uint8Array(totalLength);
|
|
680
|
-
let offset = 0;
|
|
681
|
-
nonEmptyByteArrays.forEach((arr) => {
|
|
682
|
-
result.set(arr, offset);
|
|
683
|
-
offset += arr.length;
|
|
684
|
-
});
|
|
685
|
-
return result;
|
|
686
|
-
};
|
|
687
|
-
var padBytes2 = (bytes2, length) => {
|
|
688
|
-
if (bytes2.length >= length)
|
|
689
|
-
return bytes2;
|
|
690
|
-
const paddedBytes = new Uint8Array(length).fill(0);
|
|
691
|
-
paddedBytes.set(bytes2);
|
|
692
|
-
return paddedBytes;
|
|
693
|
-
};
|
|
694
|
-
var fixBytes2 = (bytes2, length) => padBytes2(bytes2.length <= length ? bytes2 : bytes2.slice(0, length), length);
|
|
695
|
-
function combineCodec(encoder, decoder, description) {
|
|
696
|
-
if (encoder.fixedSize !== decoder.fixedSize) {
|
|
697
|
-
throw new Error(
|
|
698
|
-
`Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`
|
|
699
|
-
);
|
|
582
|
+
function decodeArrayLikeCodecSize(size, childrenSizes, bytes, offset) {
|
|
583
|
+
if (typeof size === "number") {
|
|
584
|
+
return [size, offset];
|
|
700
585
|
}
|
|
701
|
-
if (
|
|
702
|
-
|
|
703
|
-
`Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`
|
|
704
|
-
);
|
|
586
|
+
if (typeof size === "object") {
|
|
587
|
+
return size.decode(bytes, offset);
|
|
705
588
|
}
|
|
706
|
-
if (
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
589
|
+
if (size === "remainder") {
|
|
590
|
+
const childrenSize = sumCodecSizes(childrenSizes);
|
|
591
|
+
if (childrenSize === null) {
|
|
592
|
+
throw new Error('Codecs of "remainder" size must have fixed-size items.');
|
|
593
|
+
}
|
|
594
|
+
const remainder = bytes.slice(offset).length;
|
|
595
|
+
if (remainder % childrenSize !== 0) {
|
|
596
|
+
throw new Error(
|
|
597
|
+
`The remainder of the byte array (${remainder} bytes) cannot be split into chunks of ${childrenSize} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${remainder} modulo ${childrenSize} should be equal to zero.`
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
return [remainder / childrenSize, offset];
|
|
710
601
|
}
|
|
711
|
-
|
|
712
|
-
decode: decoder.decode,
|
|
713
|
-
description: description ?? encoder.description,
|
|
714
|
-
encode: encoder.encode,
|
|
715
|
-
fixedSize: encoder.fixedSize,
|
|
716
|
-
maxSize: encoder.maxSize
|
|
717
|
-
};
|
|
602
|
+
throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(size)}`);
|
|
718
603
|
}
|
|
719
|
-
function
|
|
720
|
-
return {
|
|
721
|
-
description: description ?? `fixed(${fixedBytes}, ${data.description})`,
|
|
722
|
-
fixedSize: fixedBytes,
|
|
723
|
-
maxSize: fixedBytes
|
|
724
|
-
};
|
|
604
|
+
function getArrayLikeCodecSizeDescription(size) {
|
|
605
|
+
return typeof size === "object" ? size.description : `${size}`;
|
|
725
606
|
}
|
|
726
|
-
function
|
|
607
|
+
function getArrayLikeCodecSizeFromChildren(size, childrenSizes) {
|
|
608
|
+
if (typeof size !== "number")
|
|
609
|
+
return null;
|
|
610
|
+
if (size === 0)
|
|
611
|
+
return 0;
|
|
612
|
+
const childrenSize = sumCodecSizes(childrenSizes);
|
|
613
|
+
return childrenSize === null ? null : childrenSize * size;
|
|
614
|
+
}
|
|
615
|
+
function getArrayLikeCodecSizePrefix(size, realSize) {
|
|
616
|
+
return typeof size === "object" ? size.encode(realSize) : new Uint8Array();
|
|
617
|
+
}
|
|
618
|
+
function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
|
|
619
|
+
if (expected !== actual) {
|
|
620
|
+
throw new Error(`Expected [${codecDescription}] to have ${expected} items, got ${actual}.`);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function arrayCodecHelper(item, size, description) {
|
|
624
|
+
if (size === "remainder" && item.fixedSize === null) {
|
|
625
|
+
throw new Error('Codecs of "remainder" size must have fixed-size items.');
|
|
626
|
+
}
|
|
727
627
|
return {
|
|
728
|
-
|
|
729
|
-
|
|
628
|
+
description: description ?? `array(${item.description}; ${getArrayLikeCodecSizeDescription(size)})`,
|
|
629
|
+
fixedSize: getArrayLikeCodecSizeFromChildren(size, [item.fixedSize]),
|
|
630
|
+
maxSize: getArrayLikeCodecSizeFromChildren(size, [item.maxSize])
|
|
730
631
|
};
|
|
731
632
|
}
|
|
732
|
-
function
|
|
633
|
+
function getArrayEncoder(item, options = {}) {
|
|
634
|
+
const size = options.size ?? getU32Encoder();
|
|
733
635
|
return {
|
|
734
|
-
...
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
bytes2 = bytes2.slice(offset, offset + fixedBytes);
|
|
739
|
-
}
|
|
740
|
-
if (decoder.fixedSize !== null) {
|
|
741
|
-
bytes2 = fixBytes2(bytes2, decoder.fixedSize);
|
|
636
|
+
...arrayCodecHelper(item, size, options.description),
|
|
637
|
+
encode: (value) => {
|
|
638
|
+
if (typeof size === "number") {
|
|
639
|
+
assertValidNumberOfItemsForCodec("array", size, value.length);
|
|
742
640
|
}
|
|
743
|
-
|
|
744
|
-
return [value, offset + fixedBytes];
|
|
641
|
+
return mergeBytes([getArrayLikeCodecSizePrefix(size, value.length), ...value.map((v) => item.encode(v))]);
|
|
745
642
|
}
|
|
746
643
|
};
|
|
747
644
|
}
|
|
748
|
-
function
|
|
645
|
+
function getArrayDecoder(item, options = {}) {
|
|
646
|
+
const size = options.size ?? getU32Decoder();
|
|
749
647
|
return {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
};
|
|
755
|
-
}
|
|
756
|
-
function mapDecoder(decoder, map) {
|
|
757
|
-
return {
|
|
758
|
-
decode: (bytes2, offset = 0) => {
|
|
759
|
-
const [value, length] = decoder.decode(bytes2, offset);
|
|
760
|
-
return [map(value, bytes2, offset), length];
|
|
761
|
-
},
|
|
762
|
-
description: decoder.description,
|
|
763
|
-
fixedSize: decoder.fixedSize,
|
|
764
|
-
maxSize: decoder.maxSize
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
// ../codecs-numbers/dist/index.browser.js
|
|
769
|
-
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) {
|
|
770
|
-
if (value < min || value > max) {
|
|
771
|
-
throw new Error(
|
|
772
|
-
`Codec [${codecDescription}] expected number to be in the range [${min}, ${max}], got ${value}.`
|
|
773
|
-
);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
function sharedNumberFactory(input) {
|
|
777
|
-
let littleEndian;
|
|
778
|
-
let defaultDescription = input.name;
|
|
779
|
-
if (input.size > 1) {
|
|
780
|
-
littleEndian = !("endian" in input.options) || input.options.endian === 0;
|
|
781
|
-
defaultDescription += littleEndian ? "(le)" : "(be)";
|
|
782
|
-
}
|
|
783
|
-
return {
|
|
784
|
-
description: input.options.description ?? defaultDescription,
|
|
785
|
-
fixedSize: input.size,
|
|
786
|
-
littleEndian,
|
|
787
|
-
maxSize: input.size
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
function numberEncoderFactory(input) {
|
|
791
|
-
const codecData = sharedNumberFactory(input);
|
|
792
|
-
return {
|
|
793
|
-
description: codecData.description,
|
|
794
|
-
encode(value) {
|
|
795
|
-
if (input.range) {
|
|
796
|
-
assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);
|
|
797
|
-
}
|
|
798
|
-
const arrayBuffer = new ArrayBuffer(input.size);
|
|
799
|
-
input.set(new DataView(arrayBuffer), value, codecData.littleEndian);
|
|
800
|
-
return new Uint8Array(arrayBuffer);
|
|
801
|
-
},
|
|
802
|
-
fixedSize: codecData.fixedSize,
|
|
803
|
-
maxSize: codecData.maxSize
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
|
-
function numberDecoderFactory(input) {
|
|
807
|
-
const codecData = sharedNumberFactory(input);
|
|
808
|
-
return {
|
|
809
|
-
decode(bytes2, offset = 0) {
|
|
810
|
-
assertByteArrayIsNotEmptyForCodec(codecData.description, bytes2, offset);
|
|
811
|
-
assertByteArrayHasEnoughBytesForCodec(codecData.description, input.size, bytes2, offset);
|
|
812
|
-
const view = new DataView(toArrayBuffer2(bytes2, offset, input.size));
|
|
813
|
-
return [input.get(view, codecData.littleEndian), offset + input.size];
|
|
814
|
-
},
|
|
815
|
-
description: codecData.description,
|
|
816
|
-
fixedSize: codecData.fixedSize,
|
|
817
|
-
maxSize: codecData.maxSize
|
|
818
|
-
};
|
|
819
|
-
}
|
|
820
|
-
function toArrayBuffer2(bytes2, offset, length) {
|
|
821
|
-
const bytesOffset = bytes2.byteOffset + (offset ?? 0);
|
|
822
|
-
const bytesLength = length ?? bytes2.byteLength;
|
|
823
|
-
return bytes2.buffer.slice(bytesOffset, bytesOffset + bytesLength);
|
|
824
|
-
}
|
|
825
|
-
var getShortU16Encoder = (options = {}) => ({
|
|
826
|
-
description: options.description ?? "shortU16",
|
|
827
|
-
encode: (value) => {
|
|
828
|
-
assertNumberIsBetweenForCodec("shortU16", 0, 65535, value);
|
|
829
|
-
const bytes2 = [0];
|
|
830
|
-
for (let ii = 0; ; ii += 1) {
|
|
831
|
-
const alignedValue = value >> ii * 7;
|
|
832
|
-
if (alignedValue === 0) {
|
|
833
|
-
break;
|
|
834
|
-
}
|
|
835
|
-
const nextSevenBits = 127 & alignedValue;
|
|
836
|
-
bytes2[ii] = nextSevenBits;
|
|
837
|
-
if (ii > 0) {
|
|
838
|
-
bytes2[ii - 1] |= 128;
|
|
648
|
+
...arrayCodecHelper(item, size, options.description),
|
|
649
|
+
decode: (bytes, offset = 0) => {
|
|
650
|
+
if (typeof size === "object" && bytes.slice(offset).length === 0) {
|
|
651
|
+
return [[], offset];
|
|
839
652
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
decode: (bytes2, offset = 0) => {
|
|
848
|
-
let value = 0;
|
|
849
|
-
let byteCount = 0;
|
|
850
|
-
while (++byteCount) {
|
|
851
|
-
const byteIndex = byteCount - 1;
|
|
852
|
-
const currentByte = bytes2[offset + byteIndex];
|
|
853
|
-
const nextSevenBits = 127 & currentByte;
|
|
854
|
-
value |= nextSevenBits << byteIndex * 7;
|
|
855
|
-
if ((currentByte & 128) === 0) {
|
|
856
|
-
break;
|
|
653
|
+
const [resolvedSize, newOffset] = decodeArrayLikeCodecSize(size, [item.fixedSize], bytes, offset);
|
|
654
|
+
offset = newOffset;
|
|
655
|
+
const values = [];
|
|
656
|
+
for (let i = 0; i < resolvedSize; i += 1) {
|
|
657
|
+
const [value, newOffset2] = item.decode(bytes, offset);
|
|
658
|
+
values.push(value);
|
|
659
|
+
offset = newOffset2;
|
|
857
660
|
}
|
|
661
|
+
return [values, offset];
|
|
858
662
|
}
|
|
859
|
-
return [value, offset + byteCount];
|
|
860
|
-
},
|
|
861
|
-
description: options.description ?? "shortU16",
|
|
862
|
-
fixedSize: null,
|
|
863
|
-
maxSize: 3
|
|
864
|
-
});
|
|
865
|
-
var getU32Encoder = (options = {}) => numberEncoderFactory({
|
|
866
|
-
name: "u32",
|
|
867
|
-
options,
|
|
868
|
-
range: [0, Number("0xffffffff")],
|
|
869
|
-
set: (view, value, le) => view.setUint32(0, value, le),
|
|
870
|
-
size: 4
|
|
871
|
-
});
|
|
872
|
-
var getU32Decoder = (options = {}) => numberDecoderFactory({
|
|
873
|
-
get: (view, le) => view.getUint32(0, le),
|
|
874
|
-
name: "u32",
|
|
875
|
-
options,
|
|
876
|
-
size: 4
|
|
877
|
-
});
|
|
878
|
-
var getU8Encoder = (options = {}) => numberEncoderFactory({
|
|
879
|
-
name: "u8",
|
|
880
|
-
options,
|
|
881
|
-
range: [0, Number("0xff")],
|
|
882
|
-
set: (view, value) => view.setUint8(0, value),
|
|
883
|
-
size: 1
|
|
884
|
-
});
|
|
885
|
-
var getU8Decoder = (options = {}) => numberDecoderFactory({
|
|
886
|
-
get: (view) => view.getUint8(0),
|
|
887
|
-
name: "u8",
|
|
888
|
-
options,
|
|
889
|
-
size: 1
|
|
890
|
-
});
|
|
891
|
-
var getU8Codec = (options = {}) => combineCodec(getU8Encoder(options), getU8Decoder(options));
|
|
892
|
-
|
|
893
|
-
// ../codecs-strings/dist/index.browser.js
|
|
894
|
-
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
|
|
895
|
-
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
|
|
896
|
-
throw new Error(`Expected a string of base ${alphabet4.length}, got [${givenValue}].`);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
var getBaseXEncoder = (alphabet4) => {
|
|
900
|
-
const base = alphabet4.length;
|
|
901
|
-
const baseBigInt = BigInt(base);
|
|
902
|
-
return {
|
|
903
|
-
description: `base${base}`,
|
|
904
|
-
encode(value) {
|
|
905
|
-
assertValidBaseString(alphabet4, value);
|
|
906
|
-
if (value === "")
|
|
907
|
-
return new Uint8Array();
|
|
908
|
-
const chars = [...value];
|
|
909
|
-
let trailIndex = chars.findIndex((c) => c !== alphabet4[0]);
|
|
910
|
-
trailIndex = trailIndex === -1 ? chars.length : trailIndex;
|
|
911
|
-
const leadingZeroes = Array(trailIndex).fill(0);
|
|
912
|
-
if (trailIndex === chars.length)
|
|
913
|
-
return Uint8Array.from(leadingZeroes);
|
|
914
|
-
const tailChars = chars.slice(trailIndex);
|
|
915
|
-
let base10Number = 0n;
|
|
916
|
-
let baseXPower = 1n;
|
|
917
|
-
for (let i = tailChars.length - 1; i >= 0; i -= 1) {
|
|
918
|
-
base10Number += baseXPower * BigInt(alphabet4.indexOf(tailChars[i]));
|
|
919
|
-
baseXPower *= baseBigInt;
|
|
920
|
-
}
|
|
921
|
-
const tailBytes = [];
|
|
922
|
-
while (base10Number > 0n) {
|
|
923
|
-
tailBytes.unshift(Number(base10Number % 256n));
|
|
924
|
-
base10Number /= 256n;
|
|
925
|
-
}
|
|
926
|
-
return Uint8Array.from(leadingZeroes.concat(tailBytes));
|
|
927
|
-
},
|
|
928
|
-
fixedSize: null,
|
|
929
|
-
maxSize: null
|
|
930
663
|
};
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
const
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
return ["", 0];
|
|
940
|
-
let trailIndex = bytes2.findIndex((n) => n !== 0);
|
|
941
|
-
trailIndex = trailIndex === -1 ? bytes2.length : trailIndex;
|
|
942
|
-
const leadingZeroes = alphabet4[0].repeat(trailIndex);
|
|
943
|
-
if (trailIndex === bytes2.length)
|
|
944
|
-
return [leadingZeroes, rawBytes.length];
|
|
945
|
-
let base10Number = bytes2.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
|
|
946
|
-
const tailChars = [];
|
|
947
|
-
while (base10Number > 0n) {
|
|
948
|
-
tailChars.unshift(alphabet4[Number(base10Number % baseBigInt)]);
|
|
949
|
-
base10Number /= baseBigInt;
|
|
950
|
-
}
|
|
951
|
-
return [leadingZeroes + tailChars.join(""), rawBytes.length];
|
|
952
|
-
},
|
|
953
|
-
description: `base${base}`,
|
|
954
|
-
fixedSize: null,
|
|
955
|
-
maxSize: null
|
|
956
|
-
};
|
|
957
|
-
};
|
|
958
|
-
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
959
|
-
var getBase58Encoder = () => getBaseXEncoder(alphabet2);
|
|
960
|
-
var getBase58Decoder = () => getBaseXDecoder(alphabet2);
|
|
961
|
-
var removeNullCharacters2 = (value) => (
|
|
962
|
-
// eslint-disable-next-line no-control-regex
|
|
963
|
-
value.replace(/\u0000/g, "")
|
|
964
|
-
);
|
|
965
|
-
var e = globalThis.TextDecoder;
|
|
966
|
-
var o = globalThis.TextEncoder;
|
|
967
|
-
var getUtf8Encoder = () => {
|
|
968
|
-
let textEncoder;
|
|
969
|
-
return {
|
|
970
|
-
description: "utf8",
|
|
971
|
-
encode: (value) => new Uint8Array((textEncoder || (textEncoder = new o())).encode(value)),
|
|
972
|
-
fixedSize: null,
|
|
973
|
-
maxSize: null
|
|
974
|
-
};
|
|
975
|
-
};
|
|
976
|
-
var getUtf8Decoder = () => {
|
|
977
|
-
let textDecoder;
|
|
978
|
-
return {
|
|
979
|
-
decode(bytes2, offset = 0) {
|
|
980
|
-
const value = (textDecoder || (textDecoder = new e())).decode(bytes2.slice(offset));
|
|
981
|
-
return [removeNullCharacters2(value), bytes2.length];
|
|
982
|
-
},
|
|
983
|
-
description: "utf8",
|
|
664
|
+
}
|
|
665
|
+
function getBytesEncoder(options = {}) {
|
|
666
|
+
const size = options.size ?? "variable";
|
|
667
|
+
const sizeDescription = typeof size === "object" ? size.description : `${size}`;
|
|
668
|
+
const description = options.description ?? `bytes(${sizeDescription})`;
|
|
669
|
+
const byteEncoder = {
|
|
670
|
+
description,
|
|
671
|
+
encode: (value) => value,
|
|
984
672
|
fixedSize: null,
|
|
985
673
|
maxSize: null
|
|
986
674
|
};
|
|
987
|
-
};
|
|
988
|
-
var getStringEncoder = (options = {}) => {
|
|
989
|
-
const size = options.size ?? getU32Encoder();
|
|
990
|
-
const encoding = options.encoding ?? getUtf8Encoder();
|
|
991
|
-
const description = options.description ?? `string(${encoding.description}; ${getSizeDescription2(size)})`;
|
|
992
675
|
if (size === "variable") {
|
|
993
|
-
return
|
|
676
|
+
return byteEncoder;
|
|
994
677
|
}
|
|
995
678
|
if (typeof size === "number") {
|
|
996
|
-
return fixEncoder(
|
|
679
|
+
return fixEncoder(byteEncoder, size, description);
|
|
997
680
|
}
|
|
998
681
|
return {
|
|
999
|
-
|
|
682
|
+
...byteEncoder,
|
|
1000
683
|
encode: (value) => {
|
|
1001
|
-
const contentBytes =
|
|
684
|
+
const contentBytes = byteEncoder.encode(value);
|
|
1002
685
|
const lengthBytes = size.encode(contentBytes.length);
|
|
1003
|
-
return
|
|
686
|
+
return mergeBytes([lengthBytes, contentBytes]);
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
function getBytesDecoder(options = {}) {
|
|
691
|
+
const size = options.size ?? "variable";
|
|
692
|
+
const sizeDescription = typeof size === "object" ? size.description : `${size}`;
|
|
693
|
+
const description = options.description ?? `bytes(${sizeDescription})`;
|
|
694
|
+
const byteDecoder = {
|
|
695
|
+
decode: (bytes, offset = 0) => {
|
|
696
|
+
const slice = bytes.slice(offset);
|
|
697
|
+
return [slice, offset + slice.length];
|
|
1004
698
|
},
|
|
699
|
+
description,
|
|
1005
700
|
fixedSize: null,
|
|
1006
701
|
maxSize: null
|
|
1007
702
|
};
|
|
1008
|
-
};
|
|
1009
|
-
var getStringDecoder = (options = {}) => {
|
|
1010
|
-
const size = options.size ?? getU32Decoder();
|
|
1011
|
-
const encoding = options.encoding ?? getUtf8Decoder();
|
|
1012
|
-
const description = options.description ?? `string(${encoding.description}; ${getSizeDescription2(size)})`;
|
|
1013
703
|
if (size === "variable") {
|
|
1014
|
-
return
|
|
704
|
+
return byteDecoder;
|
|
1015
705
|
}
|
|
1016
706
|
if (typeof size === "number") {
|
|
1017
|
-
return fixDecoder(
|
|
707
|
+
return fixDecoder(byteDecoder, size, description);
|
|
1018
708
|
}
|
|
1019
709
|
return {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
710
|
+
...byteDecoder,
|
|
711
|
+
decode: (bytes, offset = 0) => {
|
|
712
|
+
assertByteArrayIsNotEmptyForCodec("bytes", bytes, offset);
|
|
713
|
+
const [lengthBigInt, lengthOffset] = size.decode(bytes, offset);
|
|
1023
714
|
const length = Number(lengthBigInt);
|
|
1024
715
|
offset = lengthOffset;
|
|
1025
|
-
const contentBytes =
|
|
1026
|
-
assertByteArrayHasEnoughBytesForCodec("
|
|
1027
|
-
const [value, contentOffset] =
|
|
716
|
+
const contentBytes = bytes.slice(offset, offset + length);
|
|
717
|
+
assertByteArrayHasEnoughBytesForCodec("bytes", length, contentBytes);
|
|
718
|
+
const [value, contentOffset] = byteDecoder.decode(contentBytes);
|
|
1028
719
|
offset += contentOffset;
|
|
1029
720
|
return [value, offset];
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
function structCodecHelper(fields, description) {
|
|
725
|
+
const fieldDescriptions = fields.map(([name, codec]) => `${String(name)}: ${codec.description}`).join(", ");
|
|
726
|
+
return {
|
|
727
|
+
description: description ?? `struct(${fieldDescriptions})`,
|
|
728
|
+
fixedSize: sumCodecSizes(fields.map(([, field]) => field.fixedSize)),
|
|
729
|
+
maxSize: sumCodecSizes(fields.map(([, field]) => field.maxSize))
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
function getStructEncoder(fields, options = {}) {
|
|
733
|
+
return {
|
|
734
|
+
...structCodecHelper(fields, options.description),
|
|
735
|
+
encode: (struct) => {
|
|
736
|
+
const fieldBytes = fields.map(([key, codec]) => codec.encode(struct[key]));
|
|
737
|
+
return mergeBytes(fieldBytes);
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
function getStructDecoder(fields, options = {}) {
|
|
742
|
+
return {
|
|
743
|
+
...structCodecHelper(fields, options.description),
|
|
744
|
+
decode: (bytes, offset = 0) => {
|
|
745
|
+
const struct = {};
|
|
746
|
+
fields.forEach(([key, codec]) => {
|
|
747
|
+
const [value, newOffset] = codec.decode(bytes, offset);
|
|
748
|
+
offset = newOffset;
|
|
749
|
+
struct[key] = value;
|
|
750
|
+
});
|
|
751
|
+
return [struct, offset];
|
|
752
|
+
}
|
|
1034
753
|
};
|
|
1035
|
-
};
|
|
1036
|
-
function getSizeDescription2(size) {
|
|
1037
|
-
return typeof size === "object" ? size.description : `${size}`;
|
|
1038
754
|
}
|
|
1039
755
|
|
|
1040
756
|
// ../assertions/dist/index.browser.js
|
|
@@ -1080,9 +796,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1080
796
|
) {
|
|
1081
797
|
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
1082
798
|
}
|
|
1083
|
-
const
|
|
1084
|
-
const
|
|
1085
|
-
const numBytes =
|
|
799
|
+
const base58Encoder3 = getMemoizedBase58Encoder();
|
|
800
|
+
const bytes = base58Encoder3.encode(putativeBase58EncodedAddress);
|
|
801
|
+
const numBytes = bytes.byteLength;
|
|
1086
802
|
if (numBytes !== 32) {
|
|
1087
803
|
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
1088
804
|
}
|
|
@@ -1113,9 +829,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1113
829
|
size: 32
|
|
1114
830
|
});
|
|
1115
831
|
}
|
|
1116
|
-
function getAddressCodec(config) {
|
|
1117
|
-
return combineCodec(getAddressEncoder(config), getAddressDecoder(config));
|
|
1118
|
-
}
|
|
1119
832
|
function getAddressComparator() {
|
|
1120
833
|
return new Intl.Collator("en", {
|
|
1121
834
|
caseFirst: "lower",
|
|
@@ -1424,185 +1137,121 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1424
1137
|
};
|
|
1425
1138
|
}
|
|
1426
1139
|
|
|
1427
|
-
// ../
|
|
1428
|
-
function
|
|
1429
|
-
return
|
|
1140
|
+
// ../functional/dist/index.browser.js
|
|
1141
|
+
function pipe(init, ...fns) {
|
|
1142
|
+
return fns.reduce((acc, fn) => fn(acc), init);
|
|
1430
1143
|
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1144
|
+
|
|
1145
|
+
// src/decompile-transaction.ts
|
|
1146
|
+
function getAccountMetas(message) {
|
|
1147
|
+
const { header } = message;
|
|
1148
|
+
const numWritableSignerAccounts = header.numSignerAccounts - header.numReadonlySignerAccounts;
|
|
1149
|
+
const numWritableNonSignerAccounts = message.staticAccounts.length - header.numSignerAccounts - header.numReadonlyNonSignerAccounts;
|
|
1150
|
+
const accountMetas = [];
|
|
1151
|
+
let accountIndex = 0;
|
|
1152
|
+
for (let i = 0; i < numWritableSignerAccounts; i++) {
|
|
1153
|
+
accountMetas.push({
|
|
1154
|
+
address: message.staticAccounts[accountIndex],
|
|
1155
|
+
role: AccountRole.WRITABLE_SIGNER
|
|
1156
|
+
});
|
|
1157
|
+
accountIndex++;
|
|
1437
1158
|
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
if (remainder % childrenSize !== 0) {
|
|
1445
|
-
throw new Error(
|
|
1446
|
-
`The remainder of the byte array (${remainder} bytes) cannot be split into chunks of ${childrenSize} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${remainder} modulo ${childrenSize} should be equal to zero.`
|
|
1447
|
-
);
|
|
1448
|
-
}
|
|
1449
|
-
return [remainder / childrenSize, offset];
|
|
1159
|
+
for (let i = 0; i < header.numReadonlySignerAccounts; i++) {
|
|
1160
|
+
accountMetas.push({
|
|
1161
|
+
address: message.staticAccounts[accountIndex],
|
|
1162
|
+
role: AccountRole.READONLY_SIGNER
|
|
1163
|
+
});
|
|
1164
|
+
accountIndex++;
|
|
1450
1165
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
if (typeof size !== "number")
|
|
1458
|
-
return null;
|
|
1459
|
-
if (size === 0)
|
|
1460
|
-
return 0;
|
|
1461
|
-
const childrenSize = sumCodecSizes(childrenSizes);
|
|
1462
|
-
return childrenSize === null ? null : childrenSize * size;
|
|
1463
|
-
}
|
|
1464
|
-
function getArrayLikeCodecSizePrefix(size, realSize) {
|
|
1465
|
-
return typeof size === "object" ? size.encode(realSize) : new Uint8Array();
|
|
1466
|
-
}
|
|
1467
|
-
function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
|
|
1468
|
-
if (expected !== actual) {
|
|
1469
|
-
throw new Error(`Expected [${codecDescription}] to have ${expected} items, got ${actual}.`);
|
|
1166
|
+
for (let i = 0; i < numWritableNonSignerAccounts; i++) {
|
|
1167
|
+
accountMetas.push({
|
|
1168
|
+
address: message.staticAccounts[accountIndex],
|
|
1169
|
+
role: AccountRole.WRITABLE
|
|
1170
|
+
});
|
|
1171
|
+
accountIndex++;
|
|
1470
1172
|
}
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1173
|
+
for (let i = 0; i < header.numReadonlyNonSignerAccounts; i++) {
|
|
1174
|
+
accountMetas.push({
|
|
1175
|
+
address: message.staticAccounts[accountIndex],
|
|
1176
|
+
role: AccountRole.READONLY
|
|
1177
|
+
});
|
|
1178
|
+
accountIndex++;
|
|
1475
1179
|
}
|
|
1476
|
-
return
|
|
1477
|
-
description: description ?? `array(${item.description}; ${getArrayLikeCodecSizeDescription(size)})`,
|
|
1478
|
-
fixedSize: getArrayLikeCodecSizeFromChildren(size, [item.fixedSize]),
|
|
1479
|
-
maxSize: getArrayLikeCodecSizeFromChildren(size, [item.maxSize])
|
|
1480
|
-
};
|
|
1481
|
-
}
|
|
1482
|
-
function getArrayEncoder(item, options = {}) {
|
|
1483
|
-
const size = options.size ?? getU32Encoder();
|
|
1484
|
-
return {
|
|
1485
|
-
...arrayCodecHelper(item, size, options.description),
|
|
1486
|
-
encode: (value) => {
|
|
1487
|
-
if (typeof size === "number") {
|
|
1488
|
-
assertValidNumberOfItemsForCodec("array", size, value.length);
|
|
1489
|
-
}
|
|
1490
|
-
return mergeBytes2([getArrayLikeCodecSizePrefix(size, value.length), ...value.map((v) => item.encode(v))]);
|
|
1491
|
-
}
|
|
1492
|
-
};
|
|
1493
|
-
}
|
|
1494
|
-
function getArrayDecoder(item, options = {}) {
|
|
1495
|
-
const size = options.size ?? getU32Decoder();
|
|
1496
|
-
return {
|
|
1497
|
-
...arrayCodecHelper(item, size, options.description),
|
|
1498
|
-
decode: (bytes2, offset = 0) => {
|
|
1499
|
-
if (typeof size === "object" && bytes2.slice(offset).length === 0) {
|
|
1500
|
-
return [[], offset];
|
|
1501
|
-
}
|
|
1502
|
-
const [resolvedSize, newOffset] = decodeArrayLikeCodecSize(size, [item.fixedSize], bytes2, offset);
|
|
1503
|
-
offset = newOffset;
|
|
1504
|
-
const values = [];
|
|
1505
|
-
for (let i = 0; i < resolvedSize; i += 1) {
|
|
1506
|
-
const [value, newOffset2] = item.decode(bytes2, offset);
|
|
1507
|
-
values.push(value);
|
|
1508
|
-
offset = newOffset2;
|
|
1509
|
-
}
|
|
1510
|
-
return [values, offset];
|
|
1511
|
-
}
|
|
1512
|
-
};
|
|
1180
|
+
return accountMetas;
|
|
1513
1181
|
}
|
|
1514
|
-
function
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
const byteEncoder = {
|
|
1519
|
-
description,
|
|
1520
|
-
encode: (value) => value,
|
|
1521
|
-
fixedSize: null,
|
|
1522
|
-
maxSize: null
|
|
1523
|
-
};
|
|
1524
|
-
if (size === "variable") {
|
|
1525
|
-
return byteEncoder;
|
|
1526
|
-
}
|
|
1527
|
-
if (typeof size === "number") {
|
|
1528
|
-
return fixEncoder(byteEncoder, size, description);
|
|
1182
|
+
function convertInstruction(instruction, accountMetas) {
|
|
1183
|
+
const programAddress = accountMetas[instruction.programAddressIndex]?.address;
|
|
1184
|
+
if (!programAddress) {
|
|
1185
|
+
throw new Error(`Could not find program address at index ${instruction.programAddressIndex}`);
|
|
1529
1186
|
}
|
|
1187
|
+
const accounts = instruction.accountIndices?.map((accountIndex) => accountMetas[accountIndex]);
|
|
1188
|
+
const { data } = instruction;
|
|
1530
1189
|
return {
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
const lengthBytes = size.encode(contentBytes.length);
|
|
1535
|
-
return mergeBytes2([lengthBytes, contentBytes]);
|
|
1536
|
-
}
|
|
1190
|
+
programAddress,
|
|
1191
|
+
...accounts && accounts.length ? { accounts } : {},
|
|
1192
|
+
...data && data.length ? { data } : {}
|
|
1537
1193
|
};
|
|
1538
1194
|
}
|
|
1539
|
-
function
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
return fixDecoder(byteDecoder, size, description);
|
|
1195
|
+
function getLifetimeConstraint(messageLifetimeToken, firstInstruction, lastValidBlockHeight) {
|
|
1196
|
+
if (!firstInstruction || !isAdvanceNonceAccountInstruction(firstInstruction)) {
|
|
1197
|
+
return {
|
|
1198
|
+
blockhash: messageLifetimeToken,
|
|
1199
|
+
lastValidBlockHeight: lastValidBlockHeight ?? 2n ** 64n - 1n
|
|
1200
|
+
// U64 MAX
|
|
1201
|
+
};
|
|
1202
|
+
} else {
|
|
1203
|
+
const nonceAccountAddress = firstInstruction.accounts[0].address;
|
|
1204
|
+
assertIsAddress(nonceAccountAddress);
|
|
1205
|
+
const nonceAuthorityAddress = firstInstruction.accounts[2].address;
|
|
1206
|
+
assertIsAddress(nonceAuthorityAddress);
|
|
1207
|
+
return {
|
|
1208
|
+
nonce: messageLifetimeToken,
|
|
1209
|
+
nonceAccountAddress,
|
|
1210
|
+
nonceAuthorityAddress
|
|
1211
|
+
};
|
|
1557
1212
|
}
|
|
1558
|
-
return {
|
|
1559
|
-
...byteDecoder,
|
|
1560
|
-
decode: (bytes2, offset = 0) => {
|
|
1561
|
-
assertByteArrayIsNotEmptyForCodec("bytes", bytes2, offset);
|
|
1562
|
-
const [lengthBigInt, lengthOffset] = size.decode(bytes2, offset);
|
|
1563
|
-
const length = Number(lengthBigInt);
|
|
1564
|
-
offset = lengthOffset;
|
|
1565
|
-
const contentBytes = bytes2.slice(offset, offset + length);
|
|
1566
|
-
assertByteArrayHasEnoughBytesForCodec("bytes", length, contentBytes);
|
|
1567
|
-
const [value, contentOffset] = byteDecoder.decode(contentBytes);
|
|
1568
|
-
offset += contentOffset;
|
|
1569
|
-
return [value, offset];
|
|
1570
|
-
}
|
|
1571
|
-
};
|
|
1572
|
-
}
|
|
1573
|
-
function structCodecHelper(fields, description) {
|
|
1574
|
-
const fieldDescriptions = fields.map(([name, codec]) => `${String(name)}: ${codec.description}`).join(", ");
|
|
1575
|
-
return {
|
|
1576
|
-
description: description ?? `struct(${fieldDescriptions})`,
|
|
1577
|
-
fixedSize: sumCodecSizes(fields.map(([, field]) => field.fixedSize)),
|
|
1578
|
-
maxSize: sumCodecSizes(fields.map(([, field]) => field.maxSize))
|
|
1579
|
-
};
|
|
1580
|
-
}
|
|
1581
|
-
function getStructEncoder(fields, options = {}) {
|
|
1582
|
-
return {
|
|
1583
|
-
...structCodecHelper(fields, options.description),
|
|
1584
|
-
encode: (struct2) => {
|
|
1585
|
-
const fieldBytes = fields.map(([key, codec]) => codec.encode(struct2[key]));
|
|
1586
|
-
return mergeBytes2(fieldBytes);
|
|
1587
|
-
}
|
|
1588
|
-
};
|
|
1589
|
-
}
|
|
1590
|
-
function getStructDecoder(fields, options = {}) {
|
|
1591
|
-
return {
|
|
1592
|
-
...structCodecHelper(fields, options.description),
|
|
1593
|
-
decode: (bytes2, offset = 0) => {
|
|
1594
|
-
const struct2 = {};
|
|
1595
|
-
fields.forEach(([key, codec]) => {
|
|
1596
|
-
const [value, newOffset] = codec.decode(bytes2, offset);
|
|
1597
|
-
offset = newOffset;
|
|
1598
|
-
struct2[key] = value;
|
|
1599
|
-
});
|
|
1600
|
-
return [struct2, offset];
|
|
1601
|
-
}
|
|
1602
|
-
};
|
|
1603
1213
|
}
|
|
1604
|
-
function
|
|
1605
|
-
|
|
1214
|
+
function convertSignatures(compiledTransaction) {
|
|
1215
|
+
const {
|
|
1216
|
+
compiledMessage: { staticAccounts },
|
|
1217
|
+
signatures
|
|
1218
|
+
} = compiledTransaction;
|
|
1219
|
+
return signatures.reduce((acc, sig, index) => {
|
|
1220
|
+
const allZeros = sig.every((byte) => byte === 0);
|
|
1221
|
+
if (allZeros)
|
|
1222
|
+
return acc;
|
|
1223
|
+
const address2 = staticAccounts[index];
|
|
1224
|
+
return { ...acc, [address2]: sig };
|
|
1225
|
+
}, {});
|
|
1226
|
+
}
|
|
1227
|
+
function decompileTransaction(compiledTransaction, lastValidBlockHeight) {
|
|
1228
|
+
const { compiledMessage } = compiledTransaction;
|
|
1229
|
+
if ("addressTableLookups" in compiledMessage && compiledMessage.addressTableLookups.length > 0) {
|
|
1230
|
+
throw new Error("Cannot convert transaction with addressTableLookups");
|
|
1231
|
+
}
|
|
1232
|
+
const feePayer = compiledMessage.staticAccounts[0];
|
|
1233
|
+
if (!feePayer)
|
|
1234
|
+
throw new Error("No fee payer set in CompiledTransaction");
|
|
1235
|
+
const accountMetas = getAccountMetas(compiledMessage);
|
|
1236
|
+
const instructions = compiledMessage.instructions.map(
|
|
1237
|
+
(compiledInstruction) => convertInstruction(compiledInstruction, accountMetas)
|
|
1238
|
+
);
|
|
1239
|
+
const firstInstruction = instructions[0];
|
|
1240
|
+
const lifetimeConstraint = getLifetimeConstraint(
|
|
1241
|
+
compiledMessage.lifetimeToken,
|
|
1242
|
+
firstInstruction,
|
|
1243
|
+
lastValidBlockHeight
|
|
1244
|
+
);
|
|
1245
|
+
const signatures = convertSignatures(compiledTransaction);
|
|
1246
|
+
return pipe(
|
|
1247
|
+
createTransaction({ version: compiledMessage.version }),
|
|
1248
|
+
(tx) => setTransactionFeePayer(feePayer, tx),
|
|
1249
|
+
(tx) => instructions.reduce((acc, instruction) => {
|
|
1250
|
+
return appendTransactionInstruction(instruction, acc);
|
|
1251
|
+
}, tx),
|
|
1252
|
+
(tx) => "blockhash" in lifetimeConstraint ? setTransactionLifetimeUsingBlockhash(lifetimeConstraint, tx) : setTransactionLifetimeUsingDurableNonce(lifetimeConstraint, tx),
|
|
1253
|
+
(tx) => compiledTransaction.signatures.length ? { ...tx, signatures } : tx
|
|
1254
|
+
);
|
|
1606
1255
|
}
|
|
1607
1256
|
|
|
1608
1257
|
// src/serializers/address-table-lookup.ts
|
|
@@ -1662,34 +1311,56 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1662
1311
|
}
|
|
1663
1312
|
return memoizedAddressTableLookupDecoder;
|
|
1664
1313
|
}
|
|
1665
|
-
function getAddressTableLookupCodec() {
|
|
1666
|
-
return combineCodec(getAddressTableLookupEncoder(), getAddressTableLookupDecoder());
|
|
1667
|
-
}
|
|
1668
1314
|
|
|
1669
1315
|
// src/serializers/header.ts
|
|
1670
|
-
var
|
|
1671
|
-
function
|
|
1672
|
-
if (!
|
|
1673
|
-
|
|
1674
|
-
return
|
|
1675
|
-
}
|
|
1676
|
-
function
|
|
1677
|
-
const
|
|
1316
|
+
var memoizedU8Encoder;
|
|
1317
|
+
function getMemoizedU8Encoder() {
|
|
1318
|
+
if (!memoizedU8Encoder)
|
|
1319
|
+
memoizedU8Encoder = getU8Encoder();
|
|
1320
|
+
return memoizedU8Encoder;
|
|
1321
|
+
}
|
|
1322
|
+
function getMemoizedU8EncoderDescription(description) {
|
|
1323
|
+
const encoder = getMemoizedU8Encoder();
|
|
1324
|
+
return {
|
|
1325
|
+
...encoder,
|
|
1326
|
+
description: description ?? encoder.description
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
var memoizedU8Decoder;
|
|
1330
|
+
function getMemoizedU8Decoder() {
|
|
1331
|
+
if (!memoizedU8Decoder)
|
|
1332
|
+
memoizedU8Decoder = getU8Decoder();
|
|
1333
|
+
return memoizedU8Decoder;
|
|
1334
|
+
}
|
|
1335
|
+
function getMemoizedU8DecoderDescription(description) {
|
|
1336
|
+
const decoder = getMemoizedU8Decoder();
|
|
1678
1337
|
return {
|
|
1679
|
-
...
|
|
1680
|
-
description: description ??
|
|
1338
|
+
...decoder,
|
|
1339
|
+
description: description ?? decoder.description
|
|
1681
1340
|
};
|
|
1682
1341
|
}
|
|
1683
1342
|
var numSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction" ;
|
|
1684
1343
|
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" ;
|
|
1685
1344
|
var numReadonlyNonSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable" ;
|
|
1686
1345
|
var messageHeaderDescription = "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses" ;
|
|
1687
|
-
function
|
|
1688
|
-
return
|
|
1346
|
+
function getMessageHeaderEncoder() {
|
|
1347
|
+
return getStructEncoder(
|
|
1348
|
+
[
|
|
1349
|
+
["numSignerAccounts", getMemoizedU8EncoderDescription(numSignerAccountsDescription)],
|
|
1350
|
+
["numReadonlySignerAccounts", getMemoizedU8EncoderDescription(numReadonlySignerAccountsDescription)],
|
|
1351
|
+
["numReadonlyNonSignerAccounts", getMemoizedU8EncoderDescription(numReadonlyNonSignerAccountsDescription)]
|
|
1352
|
+
],
|
|
1353
|
+
{
|
|
1354
|
+
description: messageHeaderDescription
|
|
1355
|
+
}
|
|
1356
|
+
);
|
|
1357
|
+
}
|
|
1358
|
+
function getMessageHeaderDecoder() {
|
|
1359
|
+
return getStructDecoder(
|
|
1689
1360
|
[
|
|
1690
|
-
["numSignerAccounts",
|
|
1691
|
-
["numReadonlySignerAccounts",
|
|
1692
|
-
["numReadonlyNonSignerAccounts",
|
|
1361
|
+
["numSignerAccounts", getMemoizedU8DecoderDescription(numSignerAccountsDescription)],
|
|
1362
|
+
["numReadonlySignerAccounts", getMemoizedU8DecoderDescription(numReadonlySignerAccountsDescription)],
|
|
1363
|
+
["numReadonlyNonSignerAccounts", getMemoizedU8DecoderDescription(numReadonlyNonSignerAccountsDescription)]
|
|
1693
1364
|
],
|
|
1694
1365
|
{
|
|
1695
1366
|
description: messageHeaderDescription
|
|
@@ -1763,9 +1434,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1763
1434
|
}
|
|
1764
1435
|
return memoizedGetInstructionDecoder;
|
|
1765
1436
|
}
|
|
1766
|
-
function getInstructionCodec() {
|
|
1767
|
-
return combineCodec(getInstructionEncoder(), getInstructionDecoder());
|
|
1768
|
-
}
|
|
1769
1437
|
|
|
1770
1438
|
// src/serializers/transaction-version.ts
|
|
1771
1439
|
var VERSION_FLAG_MASK = 128;
|
|
@@ -1774,8 +1442,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1774
1442
|
fixedSize: null,
|
|
1775
1443
|
maxSize: 1
|
|
1776
1444
|
};
|
|
1777
|
-
function decode(
|
|
1778
|
-
const firstByte =
|
|
1445
|
+
function decode(bytes, offset = 0) {
|
|
1446
|
+
const firstByte = bytes[offset];
|
|
1779
1447
|
if ((firstByte & VERSION_FLAG_MASK) === 0) {
|
|
1780
1448
|
return ["legacy", offset];
|
|
1781
1449
|
} else {
|
|
@@ -1804,126 +1472,181 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1804
1472
|
encode
|
|
1805
1473
|
};
|
|
1806
1474
|
}
|
|
1807
|
-
function getTransactionVersionCodec() {
|
|
1808
|
-
return combineCodec(getTransactionVersionEncoder(), getTransactionVersionDecoder());
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
// src/serializers/unimplemented.ts
|
|
1812
|
-
function getError(type, name) {
|
|
1813
|
-
const functionSuffix = name + type[0].toUpperCase() + type.slice(1);
|
|
1814
|
-
return new Error(
|
|
1815
|
-
`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}`
|
|
1816
|
-
);
|
|
1817
|
-
}
|
|
1818
|
-
function getUnimplementedDecoder(name) {
|
|
1819
|
-
return () => {
|
|
1820
|
-
throw getError("decoder", name);
|
|
1821
|
-
};
|
|
1822
|
-
}
|
|
1823
1475
|
|
|
1824
1476
|
// src/serializers/message.ts
|
|
1825
|
-
var
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
(value)
|
|
1840
|
-
|
|
1841
|
-
return value;
|
|
1842
|
-
}
|
|
1843
|
-
return {
|
|
1844
|
-
...value,
|
|
1845
|
-
addressTableLookups: value.addressTableLookups ?? []
|
|
1846
|
-
};
|
|
1477
|
+
var staticAccountsDescription = "A compact-array of static account addresses belonging to this transaction" ;
|
|
1478
|
+
var lifetimeTokenDescription = "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" ;
|
|
1479
|
+
var instructionsDescription = "A compact-array of instructions belonging to this transaction" ;
|
|
1480
|
+
var addressTableLookupsDescription = "A compact array of address table lookups belonging to this transaction" ;
|
|
1481
|
+
function getCompiledMessageLegacyEncoder() {
|
|
1482
|
+
return getStructEncoder(getPreludeStructEncoderTuple());
|
|
1483
|
+
}
|
|
1484
|
+
function getCompiledMessageVersionedEncoder() {
|
|
1485
|
+
return mapEncoder(
|
|
1486
|
+
getStructEncoder([
|
|
1487
|
+
...getPreludeStructEncoderTuple(),
|
|
1488
|
+
["addressTableLookups", getAddressTableLookupArrayEncoder()]
|
|
1489
|
+
]),
|
|
1490
|
+
(value) => {
|
|
1491
|
+
if (value.version === "legacy") {
|
|
1492
|
+
return value;
|
|
1847
1493
|
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
deserialize: codec.decode,
|
|
1855
|
-
fixedSize: codec.fixedSize,
|
|
1856
|
-
maxSize: codec.maxSize,
|
|
1857
|
-
serialize: codec.encode
|
|
1858
|
-
};
|
|
1494
|
+
return {
|
|
1495
|
+
...value,
|
|
1496
|
+
addressTableLookups: value.addressTableLookups ?? []
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1499
|
+
);
|
|
1859
1500
|
}
|
|
1860
|
-
function
|
|
1501
|
+
function getPreludeStructEncoderTuple() {
|
|
1861
1502
|
return [
|
|
1862
|
-
["version",
|
|
1863
|
-
["header",
|
|
1503
|
+
["version", getTransactionVersionEncoder()],
|
|
1504
|
+
["header", getMessageHeaderEncoder()],
|
|
1864
1505
|
[
|
|
1865
1506
|
"staticAccounts",
|
|
1866
|
-
|
|
1867
|
-
description:
|
|
1868
|
-
size:
|
|
1507
|
+
getArrayEncoder(getAddressEncoder(), {
|
|
1508
|
+
description: staticAccountsDescription,
|
|
1509
|
+
size: getShortU16Encoder()
|
|
1869
1510
|
})
|
|
1870
1511
|
],
|
|
1871
1512
|
[
|
|
1872
1513
|
"lifetimeToken",
|
|
1873
|
-
|
|
1874
|
-
description:
|
|
1875
|
-
encoding:
|
|
1514
|
+
getStringEncoder({
|
|
1515
|
+
description: lifetimeTokenDescription,
|
|
1516
|
+
encoding: getBase58Encoder(),
|
|
1876
1517
|
size: 32
|
|
1877
1518
|
})
|
|
1878
1519
|
],
|
|
1879
1520
|
[
|
|
1880
1521
|
"instructions",
|
|
1881
|
-
|
|
1882
|
-
description:
|
|
1883
|
-
size:
|
|
1522
|
+
getArrayEncoder(getInstructionEncoder(), {
|
|
1523
|
+
description: instructionsDescription,
|
|
1524
|
+
size: getShortU16Encoder()
|
|
1884
1525
|
})
|
|
1885
1526
|
]
|
|
1886
1527
|
];
|
|
1887
1528
|
}
|
|
1888
|
-
function
|
|
1889
|
-
return
|
|
1890
|
-
|
|
1891
|
-
|
|
1529
|
+
function getPreludeStructDecoderTuple() {
|
|
1530
|
+
return [
|
|
1531
|
+
["version", getTransactionVersionDecoder()],
|
|
1532
|
+
["header", getMessageHeaderDecoder()],
|
|
1533
|
+
[
|
|
1534
|
+
"staticAccounts",
|
|
1535
|
+
getArrayDecoder(getAddressDecoder(), {
|
|
1536
|
+
description: staticAccountsDescription,
|
|
1537
|
+
size: getShortU16Decoder()
|
|
1538
|
+
})
|
|
1539
|
+
],
|
|
1540
|
+
[
|
|
1541
|
+
"lifetimeToken",
|
|
1542
|
+
getStringDecoder({
|
|
1543
|
+
description: lifetimeTokenDescription,
|
|
1544
|
+
encoding: getBase58Decoder(),
|
|
1545
|
+
size: 32
|
|
1546
|
+
})
|
|
1547
|
+
],
|
|
1548
|
+
[
|
|
1549
|
+
"instructions",
|
|
1550
|
+
getArrayDecoder(getInstructionDecoder(), {
|
|
1551
|
+
description: instructionsDescription,
|
|
1552
|
+
size: getShortU16Decoder()
|
|
1553
|
+
})
|
|
1554
|
+
],
|
|
1555
|
+
["addressTableLookups", getAddressTableLookupArrayDecoder()]
|
|
1556
|
+
];
|
|
1557
|
+
}
|
|
1558
|
+
function getAddressTableLookupArrayEncoder() {
|
|
1559
|
+
return getArrayEncoder(getAddressTableLookupEncoder(), {
|
|
1560
|
+
description: addressTableLookupsDescription,
|
|
1561
|
+
size: getShortU16Encoder()
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
function getAddressTableLookupArrayDecoder() {
|
|
1565
|
+
return getArrayDecoder(getAddressTableLookupDecoder(), {
|
|
1566
|
+
description: addressTableLookupsDescription,
|
|
1567
|
+
size: getShortU16Decoder()
|
|
1892
1568
|
});
|
|
1893
1569
|
}
|
|
1570
|
+
var messageDescription = "The wire format of a Solana transaction message" ;
|
|
1894
1571
|
function getCompiledMessageEncoder() {
|
|
1895
1572
|
return {
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1573
|
+
description: messageDescription,
|
|
1574
|
+
encode: (compiledMessage) => {
|
|
1575
|
+
if (compiledMessage.version === "legacy") {
|
|
1576
|
+
return getCompiledMessageLegacyEncoder().encode(compiledMessage);
|
|
1577
|
+
} else {
|
|
1578
|
+
return getCompiledMessageVersionedEncoder().encode(compiledMessage);
|
|
1579
|
+
}
|
|
1580
|
+
},
|
|
1581
|
+
fixedSize: null,
|
|
1582
|
+
maxSize: null
|
|
1899
1583
|
};
|
|
1900
1584
|
}
|
|
1585
|
+
function getCompiledMessageDecoder() {
|
|
1586
|
+
return mapDecoder(
|
|
1587
|
+
getStructDecoder(getPreludeStructDecoderTuple(), {
|
|
1588
|
+
description: messageDescription
|
|
1589
|
+
}),
|
|
1590
|
+
({ addressTableLookups, ...restOfMessage }) => {
|
|
1591
|
+
if (restOfMessage.version === "legacy" || !addressTableLookups?.length) {
|
|
1592
|
+
return restOfMessage;
|
|
1593
|
+
}
|
|
1594
|
+
return { ...restOfMessage, addressTableLookups };
|
|
1595
|
+
}
|
|
1596
|
+
);
|
|
1597
|
+
}
|
|
1901
1598
|
|
|
1902
1599
|
// src/serializers/transaction.ts
|
|
1903
|
-
var
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
};
|
|
1908
|
-
function serialize2(transaction) {
|
|
1909
|
-
const compiledTransaction = getCompiledTransaction(transaction);
|
|
1910
|
-
return struct([
|
|
1600
|
+
var signaturesDescription = "A compact array of 64-byte, base-64 encoded Ed25519 signatures" ;
|
|
1601
|
+
var transactionDescription = "The wire format of a Solana transaction" ;
|
|
1602
|
+
function getCompiledTransactionEncoder() {
|
|
1603
|
+
return getStructEncoder(
|
|
1911
1604
|
[
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1605
|
+
[
|
|
1606
|
+
"signatures",
|
|
1607
|
+
getArrayEncoder(getBytesEncoder({ size: 64 }), {
|
|
1608
|
+
description: signaturesDescription,
|
|
1609
|
+
size: getShortU16Encoder()
|
|
1610
|
+
})
|
|
1611
|
+
],
|
|
1612
|
+
["compiledMessage", getCompiledMessageEncoder()]
|
|
1613
|
+
],
|
|
1614
|
+
{
|
|
1615
|
+
description: transactionDescription
|
|
1616
|
+
}
|
|
1617
|
+
);
|
|
1618
|
+
}
|
|
1619
|
+
function getSignatureDecoder() {
|
|
1620
|
+
return mapDecoder(getBytesDecoder({ size: 64 }), (bytes) => bytes);
|
|
1621
|
+
}
|
|
1622
|
+
function getCompiledTransactionDecoder() {
|
|
1623
|
+
return getStructDecoder(
|
|
1624
|
+
[
|
|
1625
|
+
[
|
|
1626
|
+
"signatures",
|
|
1627
|
+
getArrayDecoder(getSignatureDecoder(), {
|
|
1628
|
+
description: signaturesDescription,
|
|
1629
|
+
size: getShortU16Decoder()
|
|
1630
|
+
})
|
|
1631
|
+
],
|
|
1632
|
+
["compiledMessage", getCompiledMessageDecoder()]
|
|
1917
1633
|
],
|
|
1918
|
-
|
|
1919
|
-
|
|
1634
|
+
{
|
|
1635
|
+
description: transactionDescription
|
|
1636
|
+
}
|
|
1637
|
+
);
|
|
1920
1638
|
}
|
|
1921
1639
|
function getTransactionEncoder() {
|
|
1922
|
-
return
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1640
|
+
return mapEncoder(getCompiledTransactionEncoder(), getCompiledTransaction);
|
|
1641
|
+
}
|
|
1642
|
+
function getTransactionDecoder(lastValidBlockHeight) {
|
|
1643
|
+
return mapDecoder(
|
|
1644
|
+
getCompiledTransactionDecoder(),
|
|
1645
|
+
(compiledTransaction) => decompileTransaction(compiledTransaction, lastValidBlockHeight)
|
|
1646
|
+
);
|
|
1647
|
+
}
|
|
1648
|
+
function getTransactionCodec(lastValidBlockHeight) {
|
|
1649
|
+
return combineCodec(getTransactionEncoder(), getTransactionDecoder(lastValidBlockHeight));
|
|
1927
1650
|
}
|
|
1928
1651
|
|
|
1929
1652
|
// ../keys/dist/index.browser.js
|
|
@@ -1934,7 +1657,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1934
1657
|
}
|
|
1935
1658
|
|
|
1936
1659
|
// src/signatures.ts
|
|
1660
|
+
var base58Encoder2;
|
|
1661
|
+
var base58Decoder;
|
|
1937
1662
|
function assertIsTransactionSignature(putativeTransactionSignature) {
|
|
1663
|
+
if (!base58Encoder2)
|
|
1664
|
+
base58Encoder2 = getBase58Encoder();
|
|
1938
1665
|
try {
|
|
1939
1666
|
if (
|
|
1940
1667
|
// Lowest value (64 bytes of zeroes)
|
|
@@ -1943,8 +1670,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1943
1670
|
) {
|
|
1944
1671
|
throw new Error("Expected input string to decode to a byte array of length 64.");
|
|
1945
1672
|
}
|
|
1946
|
-
const
|
|
1947
|
-
const numBytes =
|
|
1673
|
+
const bytes = base58Encoder2.encode(putativeTransactionSignature);
|
|
1674
|
+
const numBytes = bytes.byteLength;
|
|
1948
1675
|
if (numBytes !== 64) {
|
|
1949
1676
|
throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
|
|
1950
1677
|
}
|
|
@@ -1955,6 +1682,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1955
1682
|
}
|
|
1956
1683
|
}
|
|
1957
1684
|
function isTransactionSignature(putativeTransactionSignature) {
|
|
1685
|
+
if (!base58Encoder2)
|
|
1686
|
+
base58Encoder2 = getBase58Encoder();
|
|
1958
1687
|
if (
|
|
1959
1688
|
// Lowest value (64 bytes of zeroes)
|
|
1960
1689
|
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
|
|
@@ -1962,37 +1691,32 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1962
1691
|
) {
|
|
1963
1692
|
return false;
|
|
1964
1693
|
}
|
|
1965
|
-
const
|
|
1966
|
-
const numBytes =
|
|
1694
|
+
const bytes = base58Encoder2.encode(putativeTransactionSignature);
|
|
1695
|
+
const numBytes = bytes.byteLength;
|
|
1967
1696
|
if (numBytes !== 64) {
|
|
1968
1697
|
return false;
|
|
1969
1698
|
}
|
|
1970
1699
|
return true;
|
|
1971
1700
|
}
|
|
1972
|
-
async function getCompiledMessageSignature(message, secretKey) {
|
|
1973
|
-
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
|
|
1974
|
-
const signature = await signBytes(secretKey, wireMessageBytes);
|
|
1975
|
-
return signature;
|
|
1976
|
-
}
|
|
1977
1701
|
function getSignatureFromTransaction(transaction) {
|
|
1702
|
+
if (!base58Decoder)
|
|
1703
|
+
base58Decoder = getBase58Decoder();
|
|
1978
1704
|
const signatureBytes = transaction.signatures[transaction.feePayer];
|
|
1979
1705
|
if (!signatureBytes) {
|
|
1980
1706
|
throw new Error(
|
|
1981
1707
|
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
|
|
1982
1708
|
);
|
|
1983
1709
|
}
|
|
1984
|
-
const transactionSignature2 =
|
|
1710
|
+
const transactionSignature2 = base58Decoder.decode(signatureBytes)[0];
|
|
1985
1711
|
return transactionSignature2;
|
|
1986
1712
|
}
|
|
1987
1713
|
async function signTransaction(keyPairs, transaction) {
|
|
1988
1714
|
const compiledMessage = compileMessage(transaction);
|
|
1989
1715
|
const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
|
|
1716
|
+
const wireMessageBytes = getCompiledMessageEncoder().encode(compiledMessage);
|
|
1990
1717
|
const publicKeySignaturePairs = await Promise.all(
|
|
1991
1718
|
keyPairs.map(
|
|
1992
|
-
(keyPair) => Promise.all([
|
|
1993
|
-
getAddressFromPublicKey(keyPair.publicKey),
|
|
1994
|
-
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
|
|
1995
|
-
])
|
|
1719
|
+
(keyPair) => Promise.all([getAddressFromPublicKey(keyPair.publicKey), signBytes(keyPair.privateKey, wireMessageBytes)])
|
|
1996
1720
|
)
|
|
1997
1721
|
);
|
|
1998
1722
|
for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
|
|
@@ -2009,10 +1733,19 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2009
1733
|
assertIsTransactionSignature(putativeTransactionSignature);
|
|
2010
1734
|
return putativeTransactionSignature;
|
|
2011
1735
|
}
|
|
1736
|
+
function assertTransactionIsFullySigned(transaction) {
|
|
1737
|
+
const signerAddressesFromInstructions = transaction.instructions.flatMap((i) => i.accounts?.filter((a) => isSignerRole(a.role)) ?? []).map((a) => a.address);
|
|
1738
|
+
const requiredSigners = /* @__PURE__ */ new Set([transaction.feePayer, ...signerAddressesFromInstructions]);
|
|
1739
|
+
requiredSigners.forEach((address2) => {
|
|
1740
|
+
if (!transaction.signatures[address2]) {
|
|
1741
|
+
throw new Error(`Transaction is missing signature for address \`${address2}\``);
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
2012
1745
|
|
|
2013
1746
|
// src/wire-transaction.ts
|
|
2014
1747
|
function getBase64EncodedWireTransaction(transaction) {
|
|
2015
|
-
const wireTransactionBytes = getTransactionEncoder().
|
|
1748
|
+
const wireTransactionBytes = getTransactionEncoder().encode(transaction);
|
|
2016
1749
|
{
|
|
2017
1750
|
return btoa(String.fromCharCode(...wireTransactionBytes));
|
|
2018
1751
|
}
|
|
@@ -2022,9 +1755,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2022
1755
|
exports.assertIsBlockhash = assertIsBlockhash;
|
|
2023
1756
|
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
2024
1757
|
exports.assertIsTransactionSignature = assertIsTransactionSignature;
|
|
1758
|
+
exports.assertTransactionIsFullySigned = assertTransactionIsFullySigned;
|
|
2025
1759
|
exports.createTransaction = createTransaction;
|
|
2026
1760
|
exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
|
|
2027
1761
|
exports.getSignatureFromTransaction = getSignatureFromTransaction;
|
|
1762
|
+
exports.getTransactionCodec = getTransactionCodec;
|
|
1763
|
+
exports.getTransactionDecoder = getTransactionDecoder;
|
|
2028
1764
|
exports.getTransactionEncoder = getTransactionEncoder;
|
|
2029
1765
|
exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
|
|
2030
1766
|
exports.isTransactionSignature = isTransactionSignature;
|