@solana/transactions 2.0.0-experimental.7b76300 → 2.0.0-experimental.7da1908
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 +67 -9
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +63 -11
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +88 -32
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +63 -11
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +65 -11
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +63 -13
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +14 -10
- package/dist/types/accounts.d.ts +1 -1
- package/dist/types/accounts.d.ts.map +1 -1
- package/dist/types/blockhash.d.ts +1 -1
- package/dist/types/blockhash.d.ts.map +1 -1
- package/dist/types/durable-nonce.d.ts +4 -3
- package/dist/types/durable-nonce.d.ts.map +1 -1
- package/dist/types/fee-payer.d.ts +2 -1
- package/dist/types/fee-payer.d.ts.map +1 -1
- package/dist/types/serializers/message.d.ts.map +1 -1
- package/dist/types/signatures.d.ts +10 -2
- package/dist/types/signatures.d.ts.map +1 -1
- package/dist/types/types.d.ts +7 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/wire-transaction.d.ts +1 -1
- package/dist/types/wire-transaction.d.ts.map +1 -1
- package/package.json +14 -12
|
@@ -9,7 +9,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
9
9
|
return value;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.
|
|
12
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/bytes.mjs
|
|
13
13
|
var mergeBytes = (bytesArr) => {
|
|
14
14
|
const totalLength = bytesArr.reduce((total, arr) => total + arr.length, 0);
|
|
15
15
|
const result = new Uint8Array(totalLength);
|
|
@@ -29,7 +29,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
29
29
|
};
|
|
30
30
|
var fixBytes = (bytes2, length) => padBytes(bytes2.slice(0, length), length);
|
|
31
31
|
|
|
32
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.
|
|
32
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/errors.mjs
|
|
33
33
|
var DeserializingEmptyBufferError = class extends Error {
|
|
34
34
|
constructor(serializer) {
|
|
35
35
|
super(`Serializer [${serializer}] cannot deserialize empty buffers.`);
|
|
@@ -50,7 +50,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.
|
|
53
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/fixSerializer.mjs
|
|
54
54
|
function fixSerializer(serializer, fixedBytes, description) {
|
|
55
55
|
return {
|
|
56
56
|
description: description ?? `fixed(${fixedBytes}, ${serializer.description})`,
|
|
@@ -71,7 +71,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.
|
|
74
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.9/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/mapSerializer.mjs
|
|
75
75
|
function mapSerializer(serializer, unmap, map) {
|
|
76
76
|
return {
|
|
77
77
|
description: serializer.description,
|
|
@@ -85,7 +85,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
88
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/errors.mjs
|
|
89
89
|
var InvalidBaseStringError = class extends Error {
|
|
90
90
|
constructor(value, base, cause) {
|
|
91
91
|
const message = `Expected a string of base ${base}, got [${value}].`;
|
|
@@ -95,7 +95,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
98
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
|
|
99
99
|
var baseX = (alphabet) => {
|
|
100
100
|
const base = alphabet.length;
|
|
101
101
|
const baseBigInt = BigInt(base);
|
|
@@ -149,16 +149,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
152
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base58.mjs
|
|
153
153
|
var base58 = baseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
|
|
154
154
|
|
|
155
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
155
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/nullCharacters.mjs
|
|
156
156
|
var removeNullCharacters = (value) => (
|
|
157
157
|
// eslint-disable-next-line no-control-regex
|
|
158
158
|
value.replace(/\u0000/g, "")
|
|
159
159
|
);
|
|
160
160
|
|
|
161
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.
|
|
161
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.9/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/utf8.mjs
|
|
162
162
|
var utf8 = {
|
|
163
163
|
description: "utf8",
|
|
164
164
|
fixedSize: null,
|
|
@@ -172,14 +172,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
175
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/common.mjs
|
|
176
176
|
var Endian;
|
|
177
177
|
(function(Endian2) {
|
|
178
178
|
Endian2["Little"] = "le";
|
|
179
179
|
Endian2["Big"] = "be";
|
|
180
180
|
})(Endian || (Endian = {}));
|
|
181
181
|
|
|
182
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
182
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/errors.mjs
|
|
183
183
|
var NumberOutOfRangeError = class extends RangeError {
|
|
184
184
|
constructor(serializer, min, max, actual) {
|
|
185
185
|
super(`Serializer [${serializer}] expected number to be between ${min} and ${max}, got ${actual}.`);
|
|
@@ -187,7 +187,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
190
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/utils.mjs
|
|
191
191
|
function numberFactory(input) {
|
|
192
192
|
let littleEndian;
|
|
193
193
|
let defaultDescription = input.name;
|
|
@@ -231,7 +231,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
|
|
234
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
234
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u8.mjs
|
|
235
235
|
var u8 = (options = {}) => numberFactory({
|
|
236
236
|
name: "u8",
|
|
237
237
|
size: 1,
|
|
@@ -241,7 +241,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
241
241
|
options
|
|
242
242
|
});
|
|
243
243
|
|
|
244
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
244
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u32.mjs
|
|
245
245
|
var u32 = (options = {}) => numberFactory({
|
|
246
246
|
name: "u32",
|
|
247
247
|
size: 4,
|
|
@@ -251,7 +251,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
251
251
|
options
|
|
252
252
|
});
|
|
253
253
|
|
|
254
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.
|
|
254
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.9/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/shortU16.mjs
|
|
255
255
|
var shortU16 = (options = {}) => ({
|
|
256
256
|
description: options.description ?? "shortU16",
|
|
257
257
|
fixedSize: null,
|
|
@@ -288,7 +288,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
288
288
|
}
|
|
289
289
|
});
|
|
290
290
|
|
|
291
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
291
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/errors.mjs
|
|
292
292
|
var InvalidNumberOfItemsError = class extends Error {
|
|
293
293
|
constructor(serializer, expected, actual) {
|
|
294
294
|
super(`Expected [${serializer}] to have ${expected} items, got ${actual}.`);
|
|
@@ -308,12 +308,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
308
308
|
}
|
|
309
309
|
};
|
|
310
310
|
|
|
311
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
311
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/sumSerializerSizes.mjs
|
|
312
312
|
function sumSerializerSizes(sizes) {
|
|
313
313
|
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
316
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
|
|
317
317
|
function getResolvedSize(size, childrenSizes, bytes2, offset) {
|
|
318
318
|
if (typeof size === "number") {
|
|
319
319
|
return [size, offset];
|
|
@@ -349,7 +349,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
349
349
|
return typeof size === "object" ? size.serialize(realSize) : new Uint8Array();
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
352
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
|
|
353
353
|
function array(item, options = {}) {
|
|
354
354
|
const size = options.size ?? u32();
|
|
355
355
|
if (size === "remainder" && item.fixedSize === null) {
|
|
@@ -382,7 +382,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
385
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/bytes.mjs
|
|
386
386
|
function bytes(options = {}) {
|
|
387
387
|
const size = options.size ?? "variable";
|
|
388
388
|
const description = options.description ?? `bytes(${getSizeDescription(size)})`;
|
|
@@ -429,7 +429,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
432
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/string.mjs
|
|
433
433
|
function string(options = {}) {
|
|
434
434
|
const size = options.size ?? u32();
|
|
435
435
|
const encoding = options.encoding ?? utf8;
|
|
@@ -470,7 +470,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
470
470
|
};
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.
|
|
473
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.9/node_modules/@metaplex-foundation/umi-serializers/dist/esm/struct.mjs
|
|
474
474
|
function struct(fields, options = {}) {
|
|
475
475
|
const fieldDescriptions = fields.map(([name, serializer]) => `${String(name)}: ${serializer.description}`).join(", ");
|
|
476
476
|
return {
|
|
@@ -702,7 +702,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
702
702
|
usage: "sort"
|
|
703
703
|
}).compare;
|
|
704
704
|
}
|
|
705
|
-
async function
|
|
705
|
+
async function getAddressFromPublicKey(publicKey) {
|
|
706
706
|
await assertKeyExporterIsAvailable();
|
|
707
707
|
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
708
708
|
throw new Error("The `CryptoKey` must be an `Ed25519` public key");
|
|
@@ -1233,21 +1233,69 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1233
1233
|
}
|
|
1234
1234
|
|
|
1235
1235
|
// src/signatures.ts
|
|
1236
|
+
function assertIsTransactionSignature(putativeTransactionSignature) {
|
|
1237
|
+
try {
|
|
1238
|
+
if (
|
|
1239
|
+
// Lowest value (64 bytes of zeroes)
|
|
1240
|
+
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
|
|
1241
|
+
putativeTransactionSignature.length > 88
|
|
1242
|
+
) {
|
|
1243
|
+
throw new Error("Expected input string to decode to a byte array of length 64.");
|
|
1244
|
+
}
|
|
1245
|
+
const bytes2 = base58.serialize(putativeTransactionSignature);
|
|
1246
|
+
const numBytes = bytes2.byteLength;
|
|
1247
|
+
if (numBytes !== 64) {
|
|
1248
|
+
throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
|
|
1249
|
+
}
|
|
1250
|
+
} catch (e) {
|
|
1251
|
+
throw new Error(`\`${putativeTransactionSignature}\` is not a transaction signature`, {
|
|
1252
|
+
cause: e
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
function isTransactionSignature(putativeTransactionSignature) {
|
|
1257
|
+
if (
|
|
1258
|
+
// Lowest value (64 bytes of zeroes)
|
|
1259
|
+
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
|
|
1260
|
+
putativeTransactionSignature.length > 88
|
|
1261
|
+
) {
|
|
1262
|
+
return false;
|
|
1263
|
+
}
|
|
1264
|
+
const bytes2 = base58.serialize(putativeTransactionSignature);
|
|
1265
|
+
const numBytes = bytes2.byteLength;
|
|
1266
|
+
if (numBytes !== 64) {
|
|
1267
|
+
return false;
|
|
1268
|
+
}
|
|
1269
|
+
return true;
|
|
1270
|
+
}
|
|
1236
1271
|
async function getCompiledMessageSignature(message, secretKey) {
|
|
1237
1272
|
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
|
|
1238
1273
|
const signature = await signBytes(secretKey, wireMessageBytes);
|
|
1239
1274
|
return signature;
|
|
1240
1275
|
}
|
|
1241
|
-
|
|
1276
|
+
function getSignatureFromTransaction(transaction) {
|
|
1277
|
+
const signature = transaction.signatures[transaction.feePayer];
|
|
1278
|
+
if (!signature) {
|
|
1279
|
+
throw new Error(
|
|
1280
|
+
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
|
|
1281
|
+
);
|
|
1282
|
+
}
|
|
1283
|
+
return signature;
|
|
1284
|
+
}
|
|
1285
|
+
async function signTransaction(keyPairs, transaction) {
|
|
1242
1286
|
const compiledMessage = compileMessage(transaction);
|
|
1243
|
-
const
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1287
|
+
const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
|
|
1288
|
+
const publicKeySignaturePairs = await Promise.all(
|
|
1289
|
+
keyPairs.map(
|
|
1290
|
+
(keyPair) => Promise.all([
|
|
1291
|
+
getAddressFromPublicKey(keyPair.publicKey),
|
|
1292
|
+
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
|
|
1293
|
+
])
|
|
1294
|
+
)
|
|
1295
|
+
);
|
|
1296
|
+
for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
|
|
1297
|
+
nextSignatures[signerPublicKey] = signature;
|
|
1298
|
+
}
|
|
1251
1299
|
const out = {
|
|
1252
1300
|
...transaction,
|
|
1253
1301
|
signatures: nextSignatures
|
|
@@ -1255,6 +1303,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1255
1303
|
Object.freeze(out);
|
|
1256
1304
|
return out;
|
|
1257
1305
|
}
|
|
1306
|
+
function transactionSignature(putativeTransactionSignature) {
|
|
1307
|
+
assertIsTransactionSignature(putativeTransactionSignature);
|
|
1308
|
+
return putativeTransactionSignature;
|
|
1309
|
+
}
|
|
1258
1310
|
|
|
1259
1311
|
// src/compile-transaction.ts
|
|
1260
1312
|
function getCompiledTransaction(transaction) {
|
|
@@ -1312,13 +1364,17 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1312
1364
|
exports.appendTransactionInstruction = appendTransactionInstruction;
|
|
1313
1365
|
exports.assertIsBlockhash = assertIsBlockhash;
|
|
1314
1366
|
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
1367
|
+
exports.assertIsTransactionSignature = assertIsTransactionSignature;
|
|
1315
1368
|
exports.createTransaction = createTransaction;
|
|
1316
1369
|
exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
|
|
1370
|
+
exports.getSignatureFromTransaction = getSignatureFromTransaction;
|
|
1371
|
+
exports.isTransactionSignature = isTransactionSignature;
|
|
1317
1372
|
exports.prependTransactionInstruction = prependTransactionInstruction;
|
|
1318
1373
|
exports.setTransactionFeePayer = setTransactionFeePayer;
|
|
1319
1374
|
exports.setTransactionLifetimeUsingBlockhash = setTransactionLifetimeUsingBlockhash;
|
|
1320
1375
|
exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
|
|
1321
1376
|
exports.signTransaction = signTransaction;
|
|
1377
|
+
exports.transactionSignature = transactionSignature;
|
|
1322
1378
|
|
|
1323
1379
|
return exports;
|
|
1324
1380
|
|