Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solana/transactions

Package Overview
Dependencies
Maintainers
14
Versions
1256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/transactions - npm Package Compare versions

Comparing version 2.0.0-experimental.777610f to 2.0.0-experimental.782d1ea

dist/types/accounts.d.ts.map

148

dist/index.browser.js
import { base58, struct, array, bytes, shortU16, mapSerializer, string, u8 } from '@metaplex-foundation/umi-serializers';
import { getAddressFromPublicKey, getBase58EncodedAddressComparator, getBase58EncodedAddressCodec } from '@solana/addresses';
import { getAddressFromPublicKey, getAddressComparator, getAddressCodec } from '@solana/addresses';
import { signBytes } from '@solana/keys';

@@ -231,3 +231,3 @@

entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
(addressComparator || (addressComparator = getBase58EncodedAddressComparator()))(
(addressComparator || (addressComparator = getAddressComparator()))(
accountMeta.lookupTableAddress,

@@ -338,3 +338,3 @@ entry.lookupTableAddress

}
addressComparator || (addressComparator = getBase58EncodedAddressComparator());
addressComparator || (addressComparator = getAddressComparator());
if (leftEntry[TYPE] === 1 /* LOOKUP_TABLE */ && rightEntry[TYPE] === 1 /* LOOKUP_TABLE */ && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {

@@ -368,3 +368,3 @@ return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);

}
return Object.keys(index).sort(getBase58EncodedAddressComparator()).map((lookupTableAddress) => ({
return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({
lookupTableAddress,

@@ -448,2 +448,20 @@ ...index[lookupTableAddress]

}
// src/compile-transaction.ts
function getCompiledTransaction(transaction) {
const compiledMessage = compileMessage(transaction);
let signatures;
if ("signatures" in transaction) {
signatures = [];
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
}
} else {
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
}
return {
compiledMessage,
signatures
};
}
function getAddressTableLookupCodec() {

@@ -454,3 +472,3 @@ return struct(

"lookupTableAddress",
getBase58EncodedAddressCodec(
getAddressCodec(
__DEV__ ? {

@@ -652,3 +670,3 @@ description: "The address of the address lookup table account from which instruction addresses should be looked up"

"staticAccounts",
array(getBase58EncodedAddressCodec(), {
array(getAddressCodec(), {
description: __DEV__ ? "A compact-array of static account addresses belonging to this transaction" : "",

@@ -689,44 +707,2 @@ size: shortU16()

// src/signatures.ts
async function getCompiledMessageSignature(message, secretKey) {
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
const signature = await signBytes(secretKey, wireMessageBytes);
return signature;
}
async function signTransaction(keyPair, transaction) {
const compiledMessage = compileMessage(transaction);
const [signerPublicKey, signature] = await Promise.all([
getAddressFromPublicKey(keyPair.publicKey),
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
]);
const nextSignatures = {
..."signatures" in transaction ? transaction.signatures : null,
...{ [signerPublicKey]: signature }
};
const out = {
...transaction,
signatures: nextSignatures
};
Object.freeze(out);
return out;
}
// src/compile-transaction.ts
function getCompiledTransaction(transaction) {
const compiledMessage = compileMessage(transaction);
let signatures;
if ("signatures" in transaction) {
signatures = [];
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
}
} else {
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
}
return {
compiledMessage,
signatures
};
}
// src/serializers/transaction.ts

@@ -758,2 +734,76 @@ var BASE_CONFIG3 = {

}
function assertIsTransactionSignature(putativeTransactionSignature) {
try {
if (
// Lowest value (64 bytes of zeroes)
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
putativeTransactionSignature.length > 88
) {
throw new Error("Expected input string to decode to a byte array of length 64.");
}
const bytes3 = base58.serialize(putativeTransactionSignature);
const numBytes = bytes3.byteLength;
if (numBytes !== 64) {
throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
}
} catch (e) {
throw new Error(`\`${putativeTransactionSignature}\` is not a transaction signature`, {
cause: e
});
}
}
function isTransactionSignature(putativeTransactionSignature) {
if (
// Lowest value (64 bytes of zeroes)
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
putativeTransactionSignature.length > 88
) {
return false;
}
const bytes3 = base58.serialize(putativeTransactionSignature);
const numBytes = bytes3.byteLength;
if (numBytes !== 64) {
return false;
}
return true;
}
async function getCompiledMessageSignature(message, secretKey) {
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
const signature = await signBytes(secretKey, wireMessageBytes);
return signature;
}
function getSignatureFromTransaction(transaction) {
const signature = transaction.signatures[transaction.feePayer];
if (!signature) {
throw new Error(
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
);
}
return signature;
}
async function signTransaction(keyPairs, transaction) {
const compiledMessage = compileMessage(transaction);
const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
const publicKeySignaturePairs = await Promise.all(
keyPairs.map(
(keyPair) => Promise.all([
getAddressFromPublicKey(keyPair.publicKey),
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
])
)
);
for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
nextSignatures[signerPublicKey] = signature;
}
const out = {
...transaction,
signatures: nextSignatures
};
Object.freeze(out);
return out;
}
function transactionSignature(putativeTransactionSignature) {
assertIsTransactionSignature(putativeTransactionSignature);
return putativeTransactionSignature;
}

@@ -768,4 +818,4 @@ // src/wire-transaction.ts

export { appendTransactionInstruction, assertIsBlockhash, assertIsDurableNonceTransaction, createTransaction, getBase64EncodedWireTransaction, prependTransactionInstruction, setTransactionFeePayer, setTransactionLifetimeUsingBlockhash, setTransactionLifetimeUsingDurableNonce, signTransaction };
export { appendTransactionInstruction, assertIsBlockhash, assertIsDurableNonceTransaction, assertIsTransactionSignature, createTransaction, getBase64EncodedWireTransaction, getSignatureFromTransaction, getTransactionEncoder, isTransactionSignature, prependTransactionInstruction, setTransactionFeePayer, setTransactionLifetimeUsingBlockhash, setTransactionLifetimeUsingDurableNonce, signTransaction, transactionSignature };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.browser.js.map

@@ -688,3 +688,3 @@ this.globalThis = this.globalThis || {};

}
function getBase58EncodedAddressCodec(config) {
function getAddressCodec(config) {
return string({

@@ -696,3 +696,3 @@ description: config?.description ?? ("A 32-byte account address" ),

}
function getBase58EncodedAddressComparator() {
function getAddressComparator() {
return new Intl.Collator("en", {

@@ -713,13 +713,6 @@ caseFirst: "lower",

const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));
const [base58EncodedAddress] = getAddressCodec().deserialize(new Uint8Array(publicKeyBytes));
return base58EncodedAddress;
}
// ../keys/dist/index.browser.js
async function signBytes(key, data) {
await assertSigningCapabilityIsAvailable();
const signedData = await crypto.subtle.sign("Ed25519", key, data);
return new Uint8Array(signedData);
}
// src/accounts.ts

@@ -778,3 +771,3 @@ function upsert(addressMap, address, update) {

entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
(addressComparator || (addressComparator = getBase58EncodedAddressComparator()))(
(addressComparator || (addressComparator = getAddressComparator()))(
accountMeta.lookupTableAddress,

@@ -885,3 +878,3 @@ entry.lookupTableAddress

}
addressComparator || (addressComparator = getBase58EncodedAddressComparator());
addressComparator || (addressComparator = getAddressComparator());
if (leftEntry[TYPE] === 1 /* LOOKUP_TABLE */ && rightEntry[TYPE] === 1 /* LOOKUP_TABLE */ && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {

@@ -917,3 +910,3 @@ return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);

}
return Object.keys(index).sort(getBase58EncodedAddressComparator()).map((lookupTableAddress) => ({
return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({
lookupTableAddress,

@@ -998,2 +991,20 @@ ...index[lookupTableAddress]

// src/compile-transaction.ts
function getCompiledTransaction(transaction) {
const compiledMessage = compileMessage(transaction);
let signatures;
if ("signatures" in transaction) {
signatures = [];
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
}
} else {
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
}
return {
compiledMessage,
signatures
};
}
// src/serializers/address-table-lookup.ts

@@ -1005,3 +1016,3 @@ function getAddressTableLookupCodec() {

"lookupTableAddress",
getBase58EncodedAddressCodec(
getAddressCodec(
{

@@ -1207,3 +1218,3 @@ description: "The address of the address lookup table account from which instruction addresses should be looked up"

"staticAccounts",
array(getBase58EncodedAddressCodec(), {
array(getAddressCodec(), {
description: "A compact-array of static account addresses belonging to this transaction" ,

@@ -1244,44 +1255,2 @@ size: shortU16()

// src/signatures.ts
async function getCompiledMessageSignature(message, secretKey) {
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
const signature = await signBytes(secretKey, wireMessageBytes);
return signature;
}
async function signTransaction(keyPair, transaction) {
const compiledMessage = compileMessage(transaction);
const [signerPublicKey, signature] = await Promise.all([
getAddressFromPublicKey(keyPair.publicKey),
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
]);
const nextSignatures = {
..."signatures" in transaction ? transaction.signatures : null,
...{ [signerPublicKey]: signature }
};
const out = {
...transaction,
signatures: nextSignatures
};
Object.freeze(out);
return out;
}
// src/compile-transaction.ts
function getCompiledTransaction(transaction) {
const compiledMessage = compileMessage(transaction);
let signatures;
if ("signatures" in transaction) {
signatures = [];
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
}
} else {
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
}
return {
compiledMessage,
signatures
};
}
// src/serializers/transaction.ts

@@ -1314,2 +1283,85 @@ var BASE_CONFIG3 = {

// ../keys/dist/index.browser.js
async function signBytes(key, data) {
await assertSigningCapabilityIsAvailable();
const signedData = await crypto.subtle.sign("Ed25519", key, data);
return new Uint8Array(signedData);
}
// src/signatures.ts
function assertIsTransactionSignature(putativeTransactionSignature) {
try {
if (
// Lowest value (64 bytes of zeroes)
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
putativeTransactionSignature.length > 88
) {
throw new Error("Expected input string to decode to a byte array of length 64.");
}
const bytes2 = base58.serialize(putativeTransactionSignature);
const numBytes = bytes2.byteLength;
if (numBytes !== 64) {
throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
}
} catch (e) {
throw new Error(`\`${putativeTransactionSignature}\` is not a transaction signature`, {
cause: e
});
}
}
function isTransactionSignature(putativeTransactionSignature) {
if (
// Lowest value (64 bytes of zeroes)
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
putativeTransactionSignature.length > 88
) {
return false;
}
const bytes2 = base58.serialize(putativeTransactionSignature);
const numBytes = bytes2.byteLength;
if (numBytes !== 64) {
return false;
}
return true;
}
async function getCompiledMessageSignature(message, secretKey) {
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
const signature = await signBytes(secretKey, wireMessageBytes);
return signature;
}
function getSignatureFromTransaction(transaction) {
const signature = transaction.signatures[transaction.feePayer];
if (!signature) {
throw new Error(
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
);
}
return signature;
}
async function signTransaction(keyPairs, transaction) {
const compiledMessage = compileMessage(transaction);
const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
const publicKeySignaturePairs = await Promise.all(
keyPairs.map(
(keyPair) => Promise.all([
getAddressFromPublicKey(keyPair.publicKey),
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
])
)
);
for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
nextSignatures[signerPublicKey] = signature;
}
const out = {
...transaction,
signatures: nextSignatures
};
Object.freeze(out);
return out;
}
function transactionSignature(putativeTransactionSignature) {
assertIsTransactionSignature(putativeTransactionSignature);
return putativeTransactionSignature;
}
// src/wire-transaction.ts

@@ -1326,4 +1378,8 @@ function getBase64EncodedWireTransaction(transaction) {

exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
exports.assertIsTransactionSignature = assertIsTransactionSignature;
exports.createTransaction = createTransaction;
exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
exports.getSignatureFromTransaction = getSignatureFromTransaction;
exports.getTransactionEncoder = getTransactionEncoder;
exports.isTransactionSignature = isTransactionSignature;
exports.prependTransactionInstruction = prependTransactionInstruction;

@@ -1334,2 +1390,3 @@ exports.setTransactionFeePayer = setTransactionFeePayer;

exports.signTransaction = signTransaction;
exports.transactionSignature = transactionSignature;

@@ -1336,0 +1393,0 @@ return exports;

import { base58, struct, array, bytes, shortU16, mapSerializer, string, u8 } from '@metaplex-foundation/umi-serializers';
import { getAddressFromPublicKey, getBase58EncodedAddressComparator, getBase58EncodedAddressCodec } from '@solana/addresses';
import { getAddressFromPublicKey, getAddressComparator, getAddressCodec } from '@solana/addresses';
import { signBytes } from '@solana/keys';

@@ -231,3 +231,3 @@

entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
(addressComparator || (addressComparator = getBase58EncodedAddressComparator()))(
(addressComparator || (addressComparator = getAddressComparator()))(
accountMeta.lookupTableAddress,

@@ -338,3 +338,3 @@ entry.lookupTableAddress

}
addressComparator || (addressComparator = getBase58EncodedAddressComparator());
addressComparator || (addressComparator = getAddressComparator());
if (leftEntry[TYPE] === 1 /* LOOKUP_TABLE */ && rightEntry[TYPE] === 1 /* LOOKUP_TABLE */ && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {

@@ -368,3 +368,3 @@ return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);

}
return Object.keys(index).sort(getBase58EncodedAddressComparator()).map((lookupTableAddress) => ({
return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({
lookupTableAddress,

@@ -448,2 +448,20 @@ ...index[lookupTableAddress]

}
// src/compile-transaction.ts
function getCompiledTransaction(transaction) {
const compiledMessage = compileMessage(transaction);
let signatures;
if ("signatures" in transaction) {
signatures = [];
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
}
} else {
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
}
return {
compiledMessage,
signatures
};
}
function getAddressTableLookupCodec() {

@@ -454,3 +472,3 @@ return struct(

"lookupTableAddress",
getBase58EncodedAddressCodec(
getAddressCodec(
__DEV__ ? {

@@ -652,3 +670,3 @@ description: "The address of the address lookup table account from which instruction addresses should be looked up"

"staticAccounts",
array(getBase58EncodedAddressCodec(), {
array(getAddressCodec(), {
description: __DEV__ ? "A compact-array of static account addresses belonging to this transaction" : "",

@@ -689,44 +707,2 @@ size: shortU16()

// src/signatures.ts
async function getCompiledMessageSignature(message, secretKey) {
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
const signature = await signBytes(secretKey, wireMessageBytes);
return signature;
}
async function signTransaction(keyPair, transaction) {
const compiledMessage = compileMessage(transaction);
const [signerPublicKey, signature] = await Promise.all([
getAddressFromPublicKey(keyPair.publicKey),
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
]);
const nextSignatures = {
..."signatures" in transaction ? transaction.signatures : null,
...{ [signerPublicKey]: signature }
};
const out = {
...transaction,
signatures: nextSignatures
};
Object.freeze(out);
return out;
}
// src/compile-transaction.ts
function getCompiledTransaction(transaction) {
const compiledMessage = compileMessage(transaction);
let signatures;
if ("signatures" in transaction) {
signatures = [];
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
}
} else {
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
}
return {
compiledMessage,
signatures
};
}
// src/serializers/transaction.ts

@@ -758,2 +734,76 @@ var BASE_CONFIG3 = {

}
function assertIsTransactionSignature(putativeTransactionSignature) {
try {
if (
// Lowest value (64 bytes of zeroes)
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
putativeTransactionSignature.length > 88
) {
throw new Error("Expected input string to decode to a byte array of length 64.");
}
const bytes3 = base58.serialize(putativeTransactionSignature);
const numBytes = bytes3.byteLength;
if (numBytes !== 64) {
throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
}
} catch (e) {
throw new Error(`\`${putativeTransactionSignature}\` is not a transaction signature`, {
cause: e
});
}
}
function isTransactionSignature(putativeTransactionSignature) {
if (
// Lowest value (64 bytes of zeroes)
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
putativeTransactionSignature.length > 88
) {
return false;
}
const bytes3 = base58.serialize(putativeTransactionSignature);
const numBytes = bytes3.byteLength;
if (numBytes !== 64) {
return false;
}
return true;
}
async function getCompiledMessageSignature(message, secretKey) {
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
const signature = await signBytes(secretKey, wireMessageBytes);
return signature;
}
function getSignatureFromTransaction(transaction) {
const signature = transaction.signatures[transaction.feePayer];
if (!signature) {
throw new Error(
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
);
}
return signature;
}
async function signTransaction(keyPairs, transaction) {
const compiledMessage = compileMessage(transaction);
const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
const publicKeySignaturePairs = await Promise.all(
keyPairs.map(
(keyPair) => Promise.all([
getAddressFromPublicKey(keyPair.publicKey),
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
])
)
);
for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
nextSignatures[signerPublicKey] = signature;
}
const out = {
...transaction,
signatures: nextSignatures
};
Object.freeze(out);
return out;
}
function transactionSignature(putativeTransactionSignature) {
assertIsTransactionSignature(putativeTransactionSignature);
return putativeTransactionSignature;
}

@@ -768,4 +818,4 @@ // src/wire-transaction.ts

export { appendTransactionInstruction, assertIsBlockhash, assertIsDurableNonceTransaction, createTransaction, getBase64EncodedWireTransaction, prependTransactionInstruction, setTransactionFeePayer, setTransactionLifetimeUsingBlockhash, setTransactionLifetimeUsingDurableNonce, signTransaction };
export { appendTransactionInstruction, assertIsBlockhash, assertIsDurableNonceTransaction, assertIsTransactionSignature, createTransaction, getBase64EncodedWireTransaction, getSignatureFromTransaction, getTransactionEncoder, isTransactionSignature, prependTransactionInstruction, setTransactionFeePayer, setTransactionLifetimeUsingBlockhash, setTransactionLifetimeUsingDurableNonce, signTransaction, transactionSignature };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.native.js.map
import { base58, struct, array, bytes, shortU16, mapSerializer, string, u8 } from '@metaplex-foundation/umi-serializers';
import { getAddressFromPublicKey, getBase58EncodedAddressComparator, getBase58EncodedAddressCodec } from '@solana/addresses';
import { getAddressFromPublicKey, getAddressComparator, getAddressCodec } from '@solana/addresses';
import { signBytes } from '@solana/keys';

@@ -231,3 +231,3 @@

entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
(addressComparator || (addressComparator = getBase58EncodedAddressComparator()))(
(addressComparator || (addressComparator = getAddressComparator()))(
accountMeta.lookupTableAddress,

@@ -338,3 +338,3 @@ entry.lookupTableAddress

}
addressComparator || (addressComparator = getBase58EncodedAddressComparator());
addressComparator || (addressComparator = getAddressComparator());
if (leftEntry[TYPE] === 1 /* LOOKUP_TABLE */ && rightEntry[TYPE] === 1 /* LOOKUP_TABLE */ && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {

@@ -368,3 +368,3 @@ return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);

}
return Object.keys(index).sort(getBase58EncodedAddressComparator()).map((lookupTableAddress) => ({
return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({
lookupTableAddress,

@@ -448,2 +448,20 @@ ...index[lookupTableAddress]

}
// src/compile-transaction.ts
function getCompiledTransaction(transaction) {
const compiledMessage = compileMessage(transaction);
let signatures;
if ("signatures" in transaction) {
signatures = [];
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
}
} else {
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
}
return {
compiledMessage,
signatures
};
}
function getAddressTableLookupCodec() {

@@ -454,3 +472,3 @@ return struct(

"lookupTableAddress",
getBase58EncodedAddressCodec(
getAddressCodec(
__DEV__ ? {

@@ -652,3 +670,3 @@ description: "The address of the address lookup table account from which instruction addresses should be looked up"

"staticAccounts",
array(getBase58EncodedAddressCodec(), {
array(getAddressCodec(), {
description: __DEV__ ? "A compact-array of static account addresses belonging to this transaction" : "",

@@ -689,44 +707,2 @@ size: shortU16()

// src/signatures.ts
async function getCompiledMessageSignature(message, secretKey) {
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
const signature = await signBytes(secretKey, wireMessageBytes);
return signature;
}
async function signTransaction(keyPair, transaction) {
const compiledMessage = compileMessage(transaction);
const [signerPublicKey, signature] = await Promise.all([
getAddressFromPublicKey(keyPair.publicKey),
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
]);
const nextSignatures = {
..."signatures" in transaction ? transaction.signatures : null,
...{ [signerPublicKey]: signature }
};
const out = {
...transaction,
signatures: nextSignatures
};
Object.freeze(out);
return out;
}
// src/compile-transaction.ts
function getCompiledTransaction(transaction) {
const compiledMessage = compileMessage(transaction);
let signatures;
if ("signatures" in transaction) {
signatures = [];
for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
}
} else {
signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
}
return {
compiledMessage,
signatures
};
}
// src/serializers/transaction.ts

@@ -758,2 +734,76 @@ var BASE_CONFIG3 = {

}
function assertIsTransactionSignature(putativeTransactionSignature) {
try {
if (
// Lowest value (64 bytes of zeroes)
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
putativeTransactionSignature.length > 88
) {
throw new Error("Expected input string to decode to a byte array of length 64.");
}
const bytes3 = base58.serialize(putativeTransactionSignature);
const numBytes = bytes3.byteLength;
if (numBytes !== 64) {
throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
}
} catch (e) {
throw new Error(`\`${putativeTransactionSignature}\` is not a transaction signature`, {
cause: e
});
}
}
function isTransactionSignature(putativeTransactionSignature) {
if (
// Lowest value (64 bytes of zeroes)
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
putativeTransactionSignature.length > 88
) {
return false;
}
const bytes3 = base58.serialize(putativeTransactionSignature);
const numBytes = bytes3.byteLength;
if (numBytes !== 64) {
return false;
}
return true;
}
async function getCompiledMessageSignature(message, secretKey) {
const wireMessageBytes = getCompiledMessageEncoder().serialize(message);
const signature = await signBytes(secretKey, wireMessageBytes);
return signature;
}
function getSignatureFromTransaction(transaction) {
const signature = transaction.signatures[transaction.feePayer];
if (!signature) {
throw new Error(
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
);
}
return signature;
}
async function signTransaction(keyPairs, transaction) {
const compiledMessage = compileMessage(transaction);
const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
const publicKeySignaturePairs = await Promise.all(
keyPairs.map(
(keyPair) => Promise.all([
getAddressFromPublicKey(keyPair.publicKey),
getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
])
)
);
for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
nextSignatures[signerPublicKey] = signature;
}
const out = {
...transaction,
signatures: nextSignatures
};
Object.freeze(out);
return out;
}
function transactionSignature(putativeTransactionSignature) {
assertIsTransactionSignature(putativeTransactionSignature);
return putativeTransactionSignature;
}

@@ -768,4 +818,4 @@ // src/wire-transaction.ts

export { appendTransactionInstruction, assertIsBlockhash, assertIsDurableNonceTransaction, createTransaction, getBase64EncodedWireTransaction, prependTransactionInstruction, setTransactionFeePayer, setTransactionLifetimeUsingBlockhash, setTransactionLifetimeUsingDurableNonce, signTransaction };
export { appendTransactionInstruction, assertIsBlockhash, assertIsDurableNonceTransaction, assertIsTransactionSignature, createTransaction, getBase64EncodedWireTransaction, getSignatureFromTransaction, getTransactionEncoder, isTransactionSignature, prependTransactionInstruction, setTransactionFeePayer, setTransactionLifetimeUsingBlockhash, setTransactionLifetimeUsingDurableNonce, signTransaction, transactionSignature };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.node.js.map

@@ -5,14 +5,19 @@ this.globalThis = this.globalThis || {};

var Be=Object.defineProperty;var Ce=(e,r,n)=>r in e?Be(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var T=(e,r,n)=>(Ce(e,typeof r!="symbol"?r+"":r,n),n);var E=e=>{let r=e.reduce((o,s)=>o+s.length,0),n=new Uint8Array(r),t=0;return e.forEach(o=>{n.set(o,t),t+=o.length;}),n},Q=(e,r)=>{if(e.length>=r)return e;let n=new Uint8Array(r).fill(0);return n.set(e),n},O=(e,r)=>Q(e.slice(0,r),r);var x=class extends Error{constructor(n){super(`Serializer [${n}] cannot deserialize empty buffers.`);T(this,"name","DeserializingEmptyBufferError");}},h=class extends Error{constructor(n,t,o){super(`Serializer [${n}] expected ${t} bytes, got ${o}.`);T(this,"name","NotEnoughBytesError");}},I=class extends Error{constructor(n){n??(n="Expected a fixed-size serializer, got a variable-size one.");super(n);T(this,"name","ExpectedFixedSizeSerializerError");}};function N(e,r,n){return {description:n??`fixed(${r}, ${e.description})`,fixedSize:r,maxSize:r,serialize:t=>O(e.serialize(t),r),deserialize:(t,o=0)=>{if(t=t.slice(o,o+r),t.length<r)throw new h("fixSerializer",r,t.length);e.fixedSize!==null&&(t=O(t,e.fixedSize));let[s]=e.deserialize(t,0);return [s,o+r]}}}function R(e,r,n){return {description:e.description,fixedSize:e.fixedSize,maxSize:e.maxSize,serialize:t=>e.serialize(r(t)),deserialize:(t,o=0)=>{let[s,i]=e.deserialize(t,o);return n?[n(s,t,o),i]:[s,i]}}}var P=class extends Error{constructor(n,t,o){let s=`Expected a string of base ${t}, got [${n}].`;super(s);T(this,"name","InvalidBaseStringError");this.cause=o;}};var ee=e=>{let r=e.length,n=BigInt(r);return {description:`base${r}`,fixedSize:null,maxSize:null,serialize(t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new P(t,r);if(t==="")return new Uint8Array;let o=[...t],s=o.findIndex(g=>g!==e[0]);s=s===-1?o.length:s;let i=Array(s).fill(0);if(s===o.length)return Uint8Array.from(i);let c=o.slice(s),l=0n,d=1n;for(let g=c.length-1;g>=0;g-=1)l+=d*BigInt(e.indexOf(c[g])),d*=n;let u=[];for(;l>0n;)u.unshift(Number(l%256n)),l/=256n;return Uint8Array.from(i.concat(u))},deserialize(t,o=0){if(t.length===0)return ["",0];let s=t.slice(o),i=s.findIndex(u=>u!==0);i=i===-1?s.length:i;let c=e[0].repeat(i);if(i===s.length)return [c,t.length];let l=s.slice(i).reduce((u,g)=>u*256n+BigInt(g),0n),d=[];for(;l>0n;)d.unshift(e[Number(l%n)]),l/=n;return [c+d.join(""),t.length]}}};var z=ee("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var re=e=>e.replace(/\u0000/g,"");var G={description:"utf8",fixedSize:null,maxSize:null,serialize(e){return new TextEncoder().encode(e)},deserialize(e,r=0){let n=new TextDecoder().decode(e.slice(r));return [re(n),e.length]}};var W;(function(e){e.Little="le",e.Big="be";})(W||(W={}));var V=class extends RangeError{constructor(n,t,o,s){super(`Serializer [${n}] expected number to be between ${t} and ${o}, got ${s}.`);T(this,"name","NumberOutOfRangeError");}};function U(e){let r,n=e.name;return e.size>1&&(r=!("endian"in e.options)||e.options.endian===W.Little,n+=r?"(le)":"(be)"),{description:e.options.description??n,fixedSize:e.size,maxSize:e.size,serialize(t){e.range&&q(e.name,e.range[0],e.range[1],t);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,r),new Uint8Array(o)},deserialize(t,o=0){let s=t.slice(o,o+e.size);Re("i8",s,e.size);let i=Ne(s);return [e.get(i,r),o+e.size]}}}var _e=e=>e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset),Ne=e=>new DataView(_e(e)),q=(e,r,n,t)=>{if(t<r||t>n)throw new V(e,r,n,t)},Re=(e,r,n)=>{if(r.length===0)throw new x(e);if(r.length<n)throw new h(e,n,r.length)};var b=(e={})=>U({name:"u8",size:1,range:[0,+"0xff"],set:(r,n)=>r.setUint8(0,Number(n)),get:r=>r.getUint8(0),options:e});var k=(e={})=>U({name:"u32",size:4,range:[0,+"0xffffffff"],set:(r,n,t)=>r.setUint32(0,Number(n),t),get:(r,n)=>r.getUint32(0,n),options:e});var f=(e={})=>({description:e.description??"shortU16",fixedSize:null,maxSize:3,serialize:r=>{q("shortU16",0,65535,r);let n=[0];for(let t=0;;t+=1){let o=r>>t*7;if(o===0)break;let s=127&o;n[t]=s,t>0&&(n[t-1]|=128);}return new Uint8Array(n)},deserialize:(r,n=0)=>{let t=0,o=0;for(;++o;){let s=o-1,i=r[n+s],c=127&i;if(t|=c<<s*7,!(i&128))break}return [t,n+o]}});var $=class extends Error{constructor(n,t,o){super(`Expected [${n}] to have ${t} items, got ${o}.`);T(this,"name","InvalidNumberOfItemsError");}},F=class extends Error{constructor(n,t){super(`The remainder of the buffer (${n} bytes) cannot be split into chunks of ${t} bytes. Serializers of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${n} modulo ${t} should be equal to zero.`);T(this,"name","InvalidArrayLikeRemainderSizeError");}},K=class extends Error{constructor(n){super(`Unrecognized array-like serializer size: ${JSON.stringify(n)}`);T(this,"name","UnrecognizedArrayLikeSerializerSizeError");}};function C(e){return e.reduce((r,n)=>r===null||n===null?null:r+n,0)}function ne(e,r,n,t){if(typeof e=="number")return [e,t];if(typeof e=="object")return e.deserialize(n,t);if(e==="remainder"){let o=C(r);if(o===null)throw new I('Serializers of "remainder" size must have fixed-size items.');let s=n.slice(t).length;if(s%o!==0)throw new F(s,o);return [s/o,t]}throw new K(e)}function _(e){return typeof e=="object"?e.description:`${e}`}function X(e,r){if(typeof e!="number")return null;if(e===0)return 0;let n=C(r);return n===null?null:n*e}function te(e,r){return typeof e=="object"?e.serialize(r):new Uint8Array}function y(e,r={}){let n=r.size??k();if(n==="remainder"&&e.fixedSize===null)throw new I('Serializers of "remainder" size must have fixed-size items.');return {description:r.description??`array(${e.description}; ${_(n)})`,fixedSize:X(n,[e.fixedSize]),maxSize:X(n,[e.maxSize]),serialize:t=>{if(typeof n=="number"&&t.length!==n)throw new $("array",n,t.length);return E([te(n,t.length),...t.map(o=>e.serialize(o))])},deserialize:(t,o=0)=>{if(typeof n=="object"&&t.slice(o).length===0)return [[],o];let[s,i]=ne(n,[e.fixedSize],t,o);o=i;let c=[];for(let l=0;l<s;l+=1){let[d,u]=e.deserialize(t,o);c.push(d),o=u;}return [c,o]}}}function L(e={}){let r=e.size??"variable",n=e.description??`bytes(${_(r)})`,t={description:n,fixedSize:null,maxSize:null,serialize:o=>new Uint8Array(o),deserialize:(o,s=0)=>{let i=o.slice(s);return [i,s+i.length]}};return r==="variable"?t:typeof r=="number"?N(t,r,n):{description:n,fixedSize:null,maxSize:null,serialize:o=>{let s=t.serialize(o),i=r.serialize(s.length);return E([i,s])},deserialize:(o,s=0)=>{if(o.slice(s).length===0)throw new x("bytes");let[i,c]=r.deserialize(o,s),l=Number(i);s=c;let d=o.slice(s,s+l);if(d.length<l)throw new h("bytes",l,d.length);let[u,g]=t.deserialize(d);return s+=g,[u,s]}}}function M(e={}){let r=e.size??k(),n=e.encoding??G,t=e.description??`string(${n.description}; ${_(r)})`;return r==="variable"?{...n,description:t}:typeof r=="number"?N(n,r,t):{description:t,fixedSize:null,maxSize:null,serialize:o=>{let s=n.serialize(o),i=r.serialize(s.length);return E([i,s])},deserialize:(o,s=0)=>{if(o.slice(s).length===0)throw new x("string");let[i,c]=r.deserialize(o,s),l=Number(i);s=c;let d=o.slice(s,s+l);if(d.length<l)throw new h("string",l,d.length);let[u,g]=n.deserialize(d);return s+=g,[u,s]}}}function A(e,r={}){let n=e.map(([t,o])=>`${String(t)}: ${o.description}`).join(", ");return {description:r.description??`struct(${n})`,fixedSize:C(e.map(([,t])=>t.fixedSize)),maxSize:C(e.map(([,t])=>t.maxSize)),serialize:t=>{let o=e.map(([s,i])=>i.serialize(t[s]));return E(o)},deserialize:(t,o=0)=>{let s={};return e.forEach(([i,c])=>{let[l,d]=c.deserialize(t,o);o=d,s[i]=l;}),[s,o]}}}function S(e){if("signatures"in e){let{signatures:r,...n}=e;return n}else return e}function Yn(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let n=z.serialize(e).byteLength;if(n!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${n}`)}catch(r){throw new Error(`\`${e}\` is not a blockhash`,{cause:r})}}function Hn(e,r){if("lifetimeConstraint"in r&&r.lifetimeConstraint.blockhash===e.blockhash&&r.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return r;let n={...S(r),lifetimeConstraint:e};return Object.freeze(n),n}function qn({version:e}){let r={instructions:[],version:e};return Object.freeze(r),r}var m=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(m||{});var ke=1;function w(e){return e>=2}function B(e){return (e&ke)!==0}function J(e,r){return e|r}var oe="SysvarRecentB1ockHashes11111111111111111111",se="11111111111111111111111111111111";function st(e){if(!ie(e))throw new Error("Transaction is not a durable nonce transaction")}function Le(e,r){return {accounts:[{address:e,role:m.WRITABLE},{address:oe,role:m.READONLY},{address:r,role:m.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:se}}function Me(e){return e.programAddress===se&&e.data!=null&&De(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===m.WRITABLE&&e.accounts[1].address===oe&&e.accounts[1].role===m.READONLY&&e.accounts[2].address!=null&&e.accounts[2].role===m.READONLY_SIGNER}function De(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function ie(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&Me(e.instructions[0])}function it({nonce:e,nonceAccountAddress:r,nonceAuthorityAddress:n},t){let o=ie(t);if(o&&t.lifetimeConstraint.nonce===e&&t.instructions[0].accounts[0].address===r&&t.instructions[0].accounts[2].address===n)return t;let s={...S(t),instructions:[Le(r,n),...o?t.instructions.slice(1):t.instructions],lifetimeConstraint:{nonce:e}};return Object.freeze(s),s}function lt(e,r){if("feePayer"in r&&e===r.feePayer)return r;let n={...S(r),feePayer:e};return Object.freeze(n),n}function ft(e,r){let n={...S(r),instructions:[...r.instructions,e]};return Object.freeze(n),n}function gt(e,r){let n={...S(r),instructions:[e,...r.instructions]};return Object.freeze(n),n}function ae(){if(!globalThis.isSecureContext)throw new Error("Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts")}async function ce(){if(ae(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function de(){if(ae(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}function D(e){return M({description:e?.description??(""),encoding:z,size:32})}function v(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}async function le(e){if(await ce(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let r=await crypto.subtle.exportKey("raw",e),[n]=D().deserialize(new Uint8Array(r));return n}async function ue(e,r){await de();let n=await crypto.subtle.sign("Ed25519",e,r);return new Uint8Array(n)}function pe(e,r,n){e[r]=n(e[r]??{role:m.READONLY});}var p=Symbol("AddressMapTypeProperty");function me(e,r){let n={[e]:{[p]:0,role:m.WRITABLE_SIGNER}},t=new Set;for(let o of r){pe(n,o.programAddress,i=>{if(t.add(o.programAddress),p in i){if(B(i.role))switch(i[p]){case 0:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and set as the fee payer. Program addresses may not pay fees.`);default:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(i[p]===2)return i}return {[p]:2,role:m.READONLY}});let s;if(o.accounts)for(let i of o.accounts)pe(n,i.address,c=>{let{address:l,...d}=i;if(p in c)switch(c[p]){case 0:return c;case 1:{let u=J(c.role,d.role);if("lookupTableAddress"in d){if(c.lookupTableAddress!==d.lookupTableAddress&&(s||(s=v()))(d.lookupTableAddress,c.lookupTableAddress)<0)return {[p]:1,...d,role:u}}else if(w(d.role))return {[p]:2,role:u};return c.role!==u?{...c,role:u}:c}case 2:{let u=J(c.role,d.role);if(t.has(i.address)){if(B(d.role))throw new Error(`This transaction includes an address (\`${i.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`);return c.role!==u?{...c,role:u}:c}else return "lookupTableAddress"in d&&!w(c.role)?{...d,[p]:1,role:u}:c.role!==u?{...c,role:u}:c}}return "lookupTableAddress"in d?{...d,[p]:1}:{...d,[p]:2}});}return n}function fe(e){let r;return Object.entries(e).sort(([t,o],[s,i])=>{if(o[p]!==i[p]){if(o[p]===0)return -1;if(i[p]===0)return 1;if(o[p]===2)return -1;if(i[p]===2)return 1}let c=w(o.role);if(c!==w(i.role))return c?-1:1;let l=B(o.role);return l!==B(i.role)?l?-1:1:(r||(r=v()),o[p]===1&&i[p]===1&&o.lookupTableAddress!==i.lookupTableAddress?r(o.lookupTableAddress,i.lookupTableAddress):r(t,s))}).map(([t,o])=>({address:t,...o}))}function ge(e){var n;let r={};for(let t of e){if(!("lookupTableAddress"in t))continue;let o=r[n=t.lookupTableAddress]||(r[n]={readableIndices:[],writableIndices:[]});t.role===m.WRITABLE?o.writableIndices.push(t.addressIndex):o.readableIndices.push(t.addressIndex);}return Object.keys(r).sort(v()).map(t=>({lookupTableAddress:t,...r[t]}))}function Te(e){let r=0,n=0,t=0;for(let o of e){if("lookupTableAddress"in o)break;let s=B(o.role);w(o.role)?(t++,s||n++):s||r++;}return {numReadonlyNonSignerAccounts:r,numReadonlySignerAccounts:n,numSignerAccounts:t}}function Oe(e){let r={};for(let[n,t]of e.entries())r[t.address]=n;return r}function ye(e,r){let n=Oe(r);return e.map(({accounts:t,data:o,programAddress:s})=>({programAddressIndex:n[s],...t?{accountIndices:t.map(({address:i})=>n[i])}:null,...o?{data:o}:null}))}function Ae(e){return "nonce"in e?e.nonce:e.blockhash}function he(e){let r=e.findIndex(t=>"lookupTableAddress"in t);return (r===-1?e:e.slice(0,r)).map(({address:t})=>t)}function Y(e){let r=me(e.feePayer,e.instructions),n=fe(r);return {...e.version!=="legacy"?{addressTableLookups:ge(n)}:null,header:Te(n),instructions:ye(e.instructions,n),lifetimeToken:Ae(e.lifetimeConstraint),staticAccounts:he(n),version:e.version}}function be(){return A([["lookupTableAddress",D(void 0)],["writableIndices",y(b(),{size:f()})],["readableIndices",y(b(),{size:f()})]],void 0)}function Ee(){return A([["numSignerAccounts",b(void 0)],["numReadonlySignerAccounts",b(void 0)],["numReadonlyNonSignerAccounts",b(void 0)]],void 0)}function xe(){return R(A([["programAddressIndex",b(void 0)],["accountIndices",y(b({description:""}),{description:"",size:f()})],["data",L({description:"",size:f()})]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)},e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:r,data:n,...t}=e;return {...t,...r.length?{accountIndices:r}:null,...n.byteLength?{data:n}:null}})}function Pe(e,r){let n=r+e[0].toUpperCase()+e.slice(1);return new Error(`No ${e} exists for ${r}. Use \`get${n}()\` if you need a ${e}, and \`get${r}Codec()\` if you need to both encode and decode ${r}`)}function H(e){return ()=>{throw Pe("decoder",e)}}var Z=128,We={description:"",fixedSize:null,maxSize:1};function Ve(e,r=0){let n=e[r];return n&Z?[n^Z,r+1]:["legacy",r]}function Ue(e){if(e==="legacy")return new Uint8Array;if(e<0||e>127)throw new Error(`Transaction version must be in the range [0, 127]. \`${e}\` given.`);return new Uint8Array([e|Z])}function Se(){return {...We,deserialize:Ve,serialize:Ue}}var $e={description:"",fixedSize:null,maxSize:null};function Fe(e){return e.version==="legacy"?A(Ie()).serialize(e):R(A([...Ie(),["addressTableLookups",Ke()]]),r=>r.version==="legacy"?r:{...r,addressTableLookups:r.addressTableLookups??[]}).serialize(e)}function Ie(){return [["version",Se()],["header",Ee()],["staticAccounts",y(D(),{description:"",size:f()})],["lifetimeToken",M({description:"",encoding:z,size:32})],["instructions",y(xe(),{description:"",size:f()})]]}function Ke(){return y(be(),{size:f()})}function j(){return {...$e,deserialize:H("CompiledMessage"),serialize:Fe}}async function Ye(e,r){let n=j().serialize(e);return await ue(r,n)}async function Xo(e,r){let n=Y(r),[t,o]=await Promise.all([le(e.publicKey),Ye(n,e.privateKey)]),s={..."signatures"in r?r.signatures:null,[t]:o},i={...r,signatures:s};return Object.freeze(i),i}function ze(e){let r=Y(e),n;if("signatures"in e){n=[];for(let t=0;t<r.header.numSignerAccounts;t++)n[t]=e.signatures[r.staticAccounts[t]]??new Uint8Array(Array(64).fill(0));}else n=Array(r.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));return {compiledMessage:r,signatures:n}}var He={description:"",fixedSize:null,maxSize:null};function je(e){let r=ze(e);return A([["signatures",y(L({size:64}),{size:f()})],["compiledMessage",j()]]).serialize(r)}function we(){return {...He,deserialize:H("CompiledMessage"),serialize:je}}function us(e){let r=we().serialize(e);return btoa(String.fromCharCode(...r))}
var Be=Object.defineProperty;var _e=(e,r,t)=>r in e?Be(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var T=(e,r,t)=>(_e(e,typeof r!="symbol"?r+"":r,t),t);var E=e=>{let r=e.reduce((o,s)=>o+s.length,0),t=new Uint8Array(r),n=0;return e.forEach(o=>{t.set(o,n),n+=o.length;}),t},Q=(e,r)=>{if(e.length>=r)return e;let t=new Uint8Array(r).fill(0);return t.set(e),t},P=(e,r)=>Q(e.slice(0,r),r);var S=class extends Error{constructor(t){super(`Serializer [${t}] cannot deserialize empty buffers.`);T(this,"name","DeserializingEmptyBufferError");}},A=class extends Error{constructor(t,n,o){super(`Serializer [${t}] expected ${n} bytes, got ${o}.`);T(this,"name","NotEnoughBytesError");}},z=class extends Error{constructor(t){t??(t="Expected a fixed-size serializer, got a variable-size one.");super(t);T(this,"name","ExpectedFixedSizeSerializerError");}};function N(e,r,t){return {description:t??`fixed(${r}, ${e.description})`,fixedSize:r,maxSize:r,serialize:n=>P(e.serialize(n),r),deserialize:(n,o=0)=>{if(n=n.slice(o,o+r),n.length<r)throw new A("fixSerializer",r,n.length);e.fixedSize!==null&&(n=P(n,e.fixedSize));let[s]=e.deserialize(n,0);return [s,o+r]}}}function k(e,r,t){return {description:e.description,fixedSize:e.fixedSize,maxSize:e.maxSize,serialize:n=>e.serialize(r(n)),deserialize:(n,o=0)=>{let[s,i]=e.deserialize(n,o);return t?[t(s,n,o),i]:[s,i]}}}var v=class extends Error{constructor(t,n,o){let s=`Expected a string of base ${n}, got [${t}].`;super(s);T(this,"name","InvalidBaseStringError");this.cause=o;}};var ee=e=>{let r=e.length,t=BigInt(r);return {description:`base${r}`,fixedSize:null,maxSize:null,serialize(n){if(!n.match(new RegExp(`^[${e}]*$`)))throw new v(n,r);if(n==="")return new Uint8Array;let o=[...n],s=o.findIndex(g=>g!==e[0]);s=s===-1?o.length:s;let i=Array(s).fill(0);if(s===o.length)return Uint8Array.from(i);let c=o.slice(s),u=0n,d=1n;for(let g=c.length-1;g>=0;g-=1)u+=d*BigInt(e.indexOf(c[g])),d*=t;let l=[];for(;u>0n;)l.unshift(Number(u%256n)),u/=256n;return Uint8Array.from(i.concat(l))},deserialize(n,o=0){if(n.length===0)return ["",0];let s=n.slice(o),i=s.findIndex(l=>l!==0);i=i===-1?s.length:i;let c=e[0].repeat(i);if(i===s.length)return [c,n.length];let u=s.slice(i).reduce((l,g)=>l*256n+BigInt(g),0n),d=[];for(;u>0n;)d.unshift(e[Number(u%t)]),u/=t;return [c+d.join(""),n.length]}}};var x=ee("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var re=e=>e.replace(/\u0000/g,"");var G={description:"utf8",fixedSize:null,maxSize:null,serialize(e){return new TextEncoder().encode(e)},deserialize(e,r=0){let t=new TextDecoder().decode(e.slice(r));return [re(t),e.length]}};var W;(function(e){e.Little="le",e.Big="be";})(W||(W={}));var V=class extends RangeError{constructor(t,n,o,s){super(`Serializer [${t}] expected number to be between ${n} and ${o}, got ${s}.`);T(this,"name","NumberOutOfRangeError");}};function U(e){let r,t=e.name;return e.size>1&&(r=!("endian"in e.options)||e.options.endian===W.Little,t+=r?"(le)":"(be)"),{description:e.options.description??t,fixedSize:e.size,maxSize:e.size,serialize(n){e.range&&q(e.name,e.range[0],e.range[1],n);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),n,r),new Uint8Array(o)},deserialize(n,o=0){let s=n.slice(o,o+e.size);ke("i8",s,e.size);let i=Ne(s);return [e.get(i,r),o+e.size]}}}var Ce=e=>e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset),Ne=e=>new DataView(Ce(e)),q=(e,r,t,n)=>{if(n<r||n>t)throw new V(e,r,t,n)},ke=(e,r,t)=>{if(r.length===0)throw new S(e);if(r.length<t)throw new A(e,t,r.length)};var b=(e={})=>U({name:"u8",size:1,range:[0,+"0xff"],set:(r,t)=>r.setUint8(0,Number(t)),get:r=>r.getUint8(0),options:e});var R=(e={})=>U({name:"u32",size:4,range:[0,+"0xffffffff"],set:(r,t,n)=>r.setUint32(0,Number(t),n),get:(r,t)=>r.getUint32(0,t),options:e});var f=(e={})=>({description:e.description??"shortU16",fixedSize:null,maxSize:3,serialize:r=>{q("shortU16",0,65535,r);let t=[0];for(let n=0;;n+=1){let o=r>>n*7;if(o===0)break;let s=127&o;t[n]=s,n>0&&(t[n-1]|=128);}return new Uint8Array(t)},deserialize:(r,t=0)=>{let n=0,o=0;for(;++o;){let s=o-1,i=r[t+s],c=127&i;if(n|=c<<s*7,!(i&128))break}return [n,t+o]}});var $=class extends Error{constructor(t,n,o){super(`Expected [${t}] to have ${n} items, got ${o}.`);T(this,"name","InvalidNumberOfItemsError");}},F=class extends Error{constructor(t,n){super(`The remainder of the buffer (${t} bytes) cannot be split into chunks of ${n} bytes. Serializers of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${t} modulo ${n} should be equal to zero.`);T(this,"name","InvalidArrayLikeRemainderSizeError");}},K=class extends Error{constructor(t){super(`Unrecognized array-like serializer size: ${JSON.stringify(t)}`);T(this,"name","UnrecognizedArrayLikeSerializerSizeError");}};function _(e){return e.reduce((r,t)=>r===null||t===null?null:r+t,0)}function te(e,r,t,n){if(typeof e=="number")return [e,n];if(typeof e=="object")return e.deserialize(t,n);if(e==="remainder"){let o=_(r);if(o===null)throw new z('Serializers of "remainder" size must have fixed-size items.');let s=t.slice(n).length;if(s%o!==0)throw new F(s,o);return [s/o,n]}throw new K(e)}function C(e){return typeof e=="object"?e.description:`${e}`}function X(e,r){if(typeof e!="number")return null;if(e===0)return 0;let t=_(r);return t===null?null:t*e}function ne(e,r){return typeof e=="object"?e.serialize(r):new Uint8Array}function y(e,r={}){let t=r.size??R();if(t==="remainder"&&e.fixedSize===null)throw new z('Serializers of "remainder" size must have fixed-size items.');return {description:r.description??`array(${e.description}; ${C(t)})`,fixedSize:X(t,[e.fixedSize]),maxSize:X(t,[e.maxSize]),serialize:n=>{if(typeof t=="number"&&n.length!==t)throw new $("array",t,n.length);return E([ne(t,n.length),...n.map(o=>e.serialize(o))])},deserialize:(n,o=0)=>{if(typeof t=="object"&&n.slice(o).length===0)return [[],o];let[s,i]=te(t,[e.fixedSize],n,o);o=i;let c=[];for(let u=0;u<s;u+=1){let[d,l]=e.deserialize(n,o);c.push(d),o=l;}return [c,o]}}}function L(e={}){let r=e.size??"variable",t=e.description??`bytes(${C(r)})`,n={description:t,fixedSize:null,maxSize:null,serialize:o=>new Uint8Array(o),deserialize:(o,s=0)=>{let i=o.slice(s);return [i,s+i.length]}};return r==="variable"?n:typeof r=="number"?N(n,r,t):{description:t,fixedSize:null,maxSize:null,serialize:o=>{let s=n.serialize(o),i=r.serialize(s.length);return E([i,s])},deserialize:(o,s=0)=>{if(o.slice(s).length===0)throw new S("bytes");let[i,c]=r.deserialize(o,s),u=Number(i);s=c;let d=o.slice(s,s+u);if(d.length<u)throw new A("bytes",u,d.length);let[l,g]=n.deserialize(d);return s+=g,[l,s]}}}function M(e={}){let r=e.size??R(),t=e.encoding??G,n=e.description??`string(${t.description}; ${C(r)})`;return r==="variable"?{...t,description:n}:typeof r=="number"?N(t,r,n):{description:n,fixedSize:null,maxSize:null,serialize:o=>{let s=t.serialize(o),i=r.serialize(s.length);return E([i,s])},deserialize:(o,s=0)=>{if(o.slice(s).length===0)throw new S("string");let[i,c]=r.deserialize(o,s),u=Number(i);s=c;let d=o.slice(s,s+u);if(d.length<u)throw new A("string",u,d.length);let[l,g]=t.deserialize(d);return s+=g,[l,s]}}}function h(e,r={}){let t=e.map(([n,o])=>`${String(n)}: ${o.description}`).join(", ");return {description:r.description??`struct(${t})`,fixedSize:_(e.map(([,n])=>n.fixedSize)),maxSize:_(e.map(([,n])=>n.maxSize)),serialize:n=>{let o=e.map(([s,i])=>i.serialize(n[s]));return E(o)},deserialize:(n,o=0)=>{let s={};return e.forEach(([i,c])=>{let[u,d]=c.deserialize(n,o);o=d,s[i]=u;}),[s,o]}}}function I(e){if("signatures"in e){let{signatures:r,...t}=e;return t}else return e}function Yt(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let t=x.serialize(e).byteLength;if(t!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${t}`)}catch(r){throw new Error(`\`${e}\` is not a blockhash`,{cause:r})}}function Ht(e,r){if("lifetimeConstraint"in r&&r.lifetimeConstraint.blockhash===e.blockhash&&r.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return r;let t={...I(r),lifetimeConstraint:e};return Object.freeze(t),t}function qt({version:e}){let r={instructions:[],version:e};return Object.freeze(r),r}var m=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(m||{});var Re=1;function w(e){return e>=2}function B(e){return (e&Re)!==0}function J(e,r){return e|r}var oe="SysvarRecentB1ockHashes11111111111111111111",se="11111111111111111111111111111111";function sn(e){if(!ie(e))throw new Error("Transaction is not a durable nonce transaction")}function Le(e,r){return {accounts:[{address:e,role:m.WRITABLE},{address:oe,role:m.READONLY},{address:r,role:m.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:se}}function Me(e){return e.programAddress===se&&e.data!=null&&De(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===m.WRITABLE&&e.accounts[1].address===oe&&e.accounts[1].role===m.READONLY&&e.accounts[2].address!=null&&e.accounts[2].role===m.READONLY_SIGNER}function De(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function ie(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&Me(e.instructions[0])}function an({nonce:e,nonceAccountAddress:r,nonceAuthorityAddress:t},n){let o=ie(n);if(o&&n.lifetimeConstraint.nonce===e&&n.instructions[0].accounts[0].address===r&&n.instructions[0].accounts[2].address===t)return n;let s={...I(n),instructions:[Le(r,t),...o?n.instructions.slice(1):n.instructions],lifetimeConstraint:{nonce:e}};return Object.freeze(s),s}function ln(e,r){if("feePayer"in r&&e===r.feePayer)return r;let t={...I(r),feePayer:e};return Object.freeze(t),t}function gn(e,r){let t={...I(r),instructions:[...r.instructions,e]};return Object.freeze(t),t}function Tn(e,r){let t={...I(r),instructions:[e,...r.instructions]};return Object.freeze(t),t}function ae(){if(!globalThis.isSecureContext)throw new Error("Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts")}async function ce(){if(ae(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function de(){if(ae(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}function D(e){return M({description:e?.description??(""),encoding:x,size:32})}function O(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}async function ue(e){if(await ce(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let r=await crypto.subtle.exportKey("raw",e),[t]=D().deserialize(new Uint8Array(r));return t}function le(e,r,t){e[r]=t(e[r]??{role:m.READONLY});}var p=Symbol("AddressMapTypeProperty");function pe(e,r){let t={[e]:{[p]:0,role:m.WRITABLE_SIGNER}},n=new Set;for(let o of r){le(t,o.programAddress,i=>{if(n.add(o.programAddress),p in i){if(B(i.role))switch(i[p]){case 0:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and set as the fee payer. Program addresses may not pay fees.`);default:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(i[p]===2)return i}return {[p]:2,role:m.READONLY}});let s;if(o.accounts)for(let i of o.accounts)le(t,i.address,c=>{let{address:u,...d}=i;if(p in c)switch(c[p]){case 0:return c;case 1:{let l=J(c.role,d.role);if("lookupTableAddress"in d){if(c.lookupTableAddress!==d.lookupTableAddress&&(s||(s=O()))(d.lookupTableAddress,c.lookupTableAddress)<0)return {[p]:1,...d,role:l}}else if(w(d.role))return {[p]:2,role:l};return c.role!==l?{...c,role:l}:c}case 2:{let l=J(c.role,d.role);if(n.has(i.address)){if(B(d.role))throw new Error(`This transaction includes an address (\`${i.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`);return c.role!==l?{...c,role:l}:c}else return "lookupTableAddress"in d&&!w(c.role)?{...d,[p]:1,role:l}:c.role!==l?{...c,role:l}:c}}return "lookupTableAddress"in d?{...d,[p]:1}:{...d,[p]:2}});}return t}function me(e){let r;return Object.entries(e).sort(([n,o],[s,i])=>{if(o[p]!==i[p]){if(o[p]===0)return -1;if(i[p]===0)return 1;if(o[p]===2)return -1;if(i[p]===2)return 1}let c=w(o.role);if(c!==w(i.role))return c?-1:1;let u=B(o.role);return u!==B(i.role)?u?-1:1:(r||(r=O()),o[p]===1&&i[p]===1&&o.lookupTableAddress!==i.lookupTableAddress?r(o.lookupTableAddress,i.lookupTableAddress):r(n,s))}).map(([n,o])=>({address:n,...o}))}function fe(e){var t;let r={};for(let n of e){if(!("lookupTableAddress"in n))continue;let o=r[t=n.lookupTableAddress]||(r[t]={readableIndices:[],writableIndices:[]});n.role===m.WRITABLE?o.writableIndices.push(n.addressIndex):o.readableIndices.push(n.addressIndex);}return Object.keys(r).sort(O()).map(n=>({lookupTableAddress:n,...r[n]}))}function ge(e){let r=0,t=0,n=0;for(let o of e){if("lookupTableAddress"in o)break;let s=B(o.role);w(o.role)?(n++,s||t++):s||r++;}return {numReadonlyNonSignerAccounts:r,numReadonlySignerAccounts:t,numSignerAccounts:n}}function Pe(e){let r={};for(let[t,n]of e.entries())r[n.address]=t;return r}function Te(e,r){let t=Pe(r);return e.map(({accounts:n,data:o,programAddress:s})=>({programAddressIndex:t[s],...n?{accountIndices:n.map(({address:i})=>t[i])}:null,...o?{data:o}:null}))}function ye(e){return "nonce"in e?e.nonce:e.blockhash}function he(e){let r=e.findIndex(n=>"lookupTableAddress"in n);return (r===-1?e:e.slice(0,r)).map(({address:n})=>n)}function Y(e){let r=pe(e.feePayer,e.instructions),t=me(r);return {...e.version!=="legacy"?{addressTableLookups:fe(t)}:null,header:ge(t),instructions:Te(e.instructions,t),lifetimeToken:ye(e.lifetimeConstraint),staticAccounts:he(t),version:e.version}}function Ae(e){let r=Y(e),t;if("signatures"in e){t=[];for(let n=0;n<r.header.numSignerAccounts;n++)t[n]=e.signatures[r.staticAccounts[n]]??new Uint8Array(Array(64).fill(0));}else t=Array(r.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));return {compiledMessage:r,signatures:t}}function be(){return h([["lookupTableAddress",D(void 0)],["writableIndices",y(b(),{size:f()})],["readableIndices",y(b(),{size:f()})]],void 0)}function xe(){return h([["numSignerAccounts",b(void 0)],["numReadonlySignerAccounts",b(void 0)],["numReadonlyNonSignerAccounts",b(void 0)]],void 0)}function Ee(){return k(h([["programAddressIndex",b(void 0)],["accountIndices",y(b({description:""}),{description:"",size:f()})],["data",L({description:"",size:f()})]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)},e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:r,data:t,...n}=e;return {...n,...r.length?{accountIndices:r}:null,...t.byteLength?{data:t}:null}})}function ve(e,r){let t=r+e[0].toUpperCase()+e.slice(1);return new Error(`No ${e} exists for ${r}. Use \`get${t}()\` if you need a ${e}, and \`get${r}Codec()\` if you need to both encode and decode ${r}`)}function H(e){return ()=>{throw ve("decoder",e)}}var Z=128,We={description:"",fixedSize:null,maxSize:1};function Ve(e,r=0){let t=e[r];return t&Z?[t^Z,r+1]:["legacy",r]}function Ue(e){if(e==="legacy")return new Uint8Array;if(e<0||e>127)throw new Error(`Transaction version must be in the range [0, 127]. \`${e}\` given.`);return new Uint8Array([e|Z])}function Se(){return {...We,deserialize:Ve,serialize:Ue}}var $e={description:"",fixedSize:null,maxSize:null};function Fe(e){return e.version==="legacy"?h(Ie()).serialize(e):k(h([...Ie(),["addressTableLookups",Ke()]]),r=>r.version==="legacy"?r:{...r,addressTableLookups:r.addressTableLookups??[]}).serialize(e)}function Ie(){return [["version",Se()],["header",xe()],["staticAccounts",y(D(),{description:"",size:f()})],["lifetimeToken",M({description:"",encoding:x,size:32})],["instructions",y(Ee(),{description:"",size:f()})]]}function Ke(){return y(be(),{size:f()})}function j(){return {...$e,deserialize:H("CompiledMessage"),serialize:Fe}}var Ye={description:"",fixedSize:null,maxSize:null};function He(e){let r=Ae(e);return h([["signatures",y(L({size:64}),{size:f()})],["compiledMessage",j()]]).serialize(r)}function ze(){return {...Ye,deserialize:H("CompiledMessage"),serialize:He}}async function we(e,r){await de();let t=await crypto.subtle.sign("Ed25519",e,r);return new Uint8Array(t)}function je(e){try{if(e.length<64||e.length>88)throw new Error("Expected input string to decode to a byte array of length 64.");let t=x.serialize(e).byteLength;if(t!==64)throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${t}`)}catch(r){throw new Error(`\`${e}\` is not a transaction signature`,{cause:r})}}function ds(e){return !(e.length<64||e.length>88||x.serialize(e).byteLength!==64)}async function Ge(e,r){let t=j().serialize(e);return await we(r,t)}function us(e){let r=e.signatures[e.feePayer];if(!r)throw new Error("Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.");return r}async function ls(e,r){let t=Y(r),n="signatures"in r?{...r.signatures}:{},o=await Promise.all(e.map(i=>Promise.all([ue(i.publicKey),Ge(t,i.privateKey)])));for(let[i,c]of o)n[i]=c;let s={...r,signatures:n};return Object.freeze(s),s}function ps(e){return je(e),e}function Ts(e){let r=ze().serialize(e);return btoa(String.fromCharCode(...r))}
exports.appendTransactionInstruction = ft;
exports.assertIsBlockhash = Yn;
exports.assertIsDurableNonceTransaction = st;
exports.createTransaction = qn;
exports.getBase64EncodedWireTransaction = us;
exports.prependTransactionInstruction = gt;
exports.setTransactionFeePayer = lt;
exports.setTransactionLifetimeUsingBlockhash = Hn;
exports.setTransactionLifetimeUsingDurableNonce = it;
exports.signTransaction = Xo;
exports.appendTransactionInstruction = gn;
exports.assertIsBlockhash = Yt;
exports.assertIsDurableNonceTransaction = sn;
exports.assertIsTransactionSignature = je;
exports.createTransaction = qt;
exports.getBase64EncodedWireTransaction = Ts;
exports.getSignatureFromTransaction = us;
exports.getTransactionEncoder = ze;
exports.isTransactionSignature = ds;
exports.prependTransactionInstruction = Tn;
exports.setTransactionFeePayer = ln;
exports.setTransactionLifetimeUsingBlockhash = Ht;
exports.setTransactionLifetimeUsingDurableNonce = an;
exports.signTransaction = ls;
exports.transactionSignature = ps;

@@ -19,0 +24,0 @@ return exports;

import { Base58EncodedAddress } from '@solana/addresses';
import { IInstruction, IInstructionWithAccounts, IInstructionWithData } from '@solana/instructions';
import { ReadonlyAccount, ReadonlySignerAccount, WritableAccount } from '@solana/instructions/dist/types/accounts';
import { ITransactionWithSignatures } from './signatures';
import { BaseTransaction } from './types';

@@ -32,4 +33,4 @@ type AdvanceNonceAccountInstruction<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string> = IInstruction<'11111111111111111111111111111111'> & IInstructionWithAccounts<readonly [

export declare function assertIsDurableNonceTransaction(transaction: BaseTransaction | (BaseTransaction & IDurableNonceTransaction)): asserts transaction is BaseTransaction & IDurableNonceTransaction;
export declare function setTransactionLifetimeUsingDurableNonce<TTransaction extends BaseTransaction, TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string>({ nonce, nonceAccountAddress, nonceAuthorityAddress, }: DurableNonceConfig<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>, transaction: TTransaction | (TTransaction & IDurableNonceTransaction)): TTransaction & IDurableNonceTransaction<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>;
export declare function setTransactionLifetimeUsingDurableNonce<TTransaction extends BaseTransaction, TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string>({ nonce, nonceAccountAddress, nonceAuthorityAddress, }: DurableNonceConfig<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>, transaction: TTransaction | (TTransaction & IDurableNonceTransaction)): Omit<TTransaction, keyof ITransactionWithSignatures> & IDurableNonceTransaction<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>;
export {};
//# sourceMappingURL=durable-nonce.d.ts.map

@@ -7,4 +7,4 @@ import { Base58EncodedAddress } from '@solana/addresses';

}
export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Base58EncodedAddress<TFeePayerAddress>, transaction: (TTransaction & ITransactionWithSignatures) | (TTransaction & ITransactionWithFeePayer<TFeePayerAddress> & ITransactionWithSignatures)): Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithFeePayer<TFeePayerAddress>;
export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Base58EncodedAddress<TFeePayerAddress>, transaction: TTransaction | (TTransaction & ITransactionWithFeePayer<TFeePayerAddress>)): TTransaction & ITransactionWithFeePayer<TFeePayerAddress>;
export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Base58EncodedAddress<TFeePayerAddress>, transaction: (TTransaction & ITransactionWithSignatures) | (TTransaction & ITransactionWithFeePayer<string> & ITransactionWithSignatures)): Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithFeePayer<TFeePayerAddress>;
export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Base58EncodedAddress<TFeePayerAddress>, transaction: TTransaction | (TTransaction & ITransactionWithFeePayer<string>)): TTransaction & ITransactionWithFeePayer<TFeePayerAddress>;
//# sourceMappingURL=fee-payer.d.ts.map

@@ -6,2 +6,3 @@ export * from './blockhash';

export * from './instructions';
export * from './serializers';
export * from './signatures';

@@ -8,0 +9,0 @@ export * from './types';

import { Base58EncodedAddress } from '@solana/addresses';
import { Ed25519Signature } from '@solana/keys';
import { ITransactionWithFeePayer } from './fee-payer';
import { compileMessage } from './message';

@@ -10,3 +11,10 @@ export interface IFullySignedTransaction extends ITransactionWithSignatures {

}
export declare function signTransaction<TTransaction extends Parameters<typeof compileMessage>[0]>(keyPair: CryptoKeyPair, transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Promise<TTransaction & ITransactionWithSignatures>;
export type TransactionSignature = string & {
readonly __brand: unique symbol;
};
export declare function assertIsTransactionSignature(putativeTransactionSignature: string): asserts putativeTransactionSignature is TransactionSignature;
export declare function isTransactionSignature(putativeTransactionSignature: string): putativeTransactionSignature is TransactionSignature;
export declare function getSignatureFromTransaction(transaction: ITransactionWithFeePayer & ITransactionWithSignatures): TransactionSignature;
export declare function signTransaction<TTransaction extends Parameters<typeof compileMessage>[0]>(keyPairs: CryptoKeyPair[], transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Promise<TTransaction & ITransactionWithSignatures>;
export declare function transactionSignature(putativeTransactionSignature: string): TransactionSignature;
//# sourceMappingURL=signatures.d.ts.map
{
"name": "@solana/transactions",
"version": "2.0.0-experimental.777610f",
"version": "2.0.0-experimental.782d1ea",
"description": "Helpers for creating and serializing transactions",

@@ -50,4 +50,4 @@ "exports": {

"@metaplex-foundation/umi-serializers": "^0.8.9",
"@solana/addresses": "2.0.0-experimental.777610f",
"@solana/keys": "2.0.0-experimental.777610f"
"@solana/addresses": "2.0.0-experimental.782d1ea",
"@solana/keys": "2.0.0-experimental.782d1ea"
},

@@ -71,3 +71,3 @@ "devDependencies": {

"version-from-git": "^1.1.1",
"@solana/instructions": "2.0.0-experimental.777610f",
"@solana/instructions": "2.0.0-experimental.782d1ea",
"build-scripts": "0.0.0",

@@ -95,4 +95,4 @@ "test-config": "0.0.0",

"test:treeshakability:browser": "agadoo dist/index.browser.js",
"test:treeshakability:native": "agadoo dist/index.node.js",
"test:treeshakability:node": "agadoo dist/index.native.js",
"test:treeshakability:native": "agadoo dist/index.native.js",
"test:treeshakability:node": "agadoo dist/index.node.js",
"test:typecheck": "tsc --noEmit",

@@ -99,0 +99,0 @@ "test:unit:browser": "jest -c node_modules/test-config/jest-unit.config.browser.ts --rootDir . --silent",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc