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

@solana/transaction-messages

Package Overview
Dependencies
Maintainers
15
Versions
728
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/transaction-messages - npm Package Compare versions

Comparing version 2.0.0-preview.1.20240404170520.31916ae5d4fb29f239c63252a59745e33a6979ea to 2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd

dist/types/compile/accounts.d.ts

211

dist/index.browser.js

@@ -1,16 +0,7 @@

import { SolanaError, SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME, SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME } from '@solana/errors';
import { SolanaError, SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME, SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME, SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES } from '@solana/errors';
import { assertIsBlockhash } from '@solana/rpc-types';
import { AccountRole, isSignerRole } from '@solana/instructions';
import { getAddressComparator } from '@solana/addresses';
import { AccountRole, isSignerRole, isWritableRole, mergeRoles } from '@solana/instructions';
// src/create-transaction-message.ts
function createTransactionMessage({
version
}) {
const out = {
instructions: [],
version
};
Object.freeze(out);
return out;
}
// src/blockhash.ts
function isTransactionMessageWithBlockhashLifetime(transaction) {

@@ -43,2 +34,194 @@ const lifetimeConstraintShapeMatches = "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.blockhash === "string" && typeof transaction.lifetimeConstraint.lastValidBlockHeight === "bigint";

}
var AddressMapEntryType = /* @__PURE__ */ ((AddressMapEntryType2) => {
AddressMapEntryType2[AddressMapEntryType2["FEE_PAYER"] = 0] = "FEE_PAYER";
AddressMapEntryType2[AddressMapEntryType2["LOOKUP_TABLE"] = 1] = "LOOKUP_TABLE";
AddressMapEntryType2[AddressMapEntryType2["STATIC"] = 2] = "STATIC";
return AddressMapEntryType2;
})(AddressMapEntryType || {});
function upsert(addressMap, address, update) {
addressMap[address] = update(addressMap[address] ?? { role: AccountRole.READONLY });
}
var TYPE = Symbol("AddressMapTypeProperty");
var ADDRESS_MAP_TYPE_PROPERTY = TYPE;
function getAddressMapFromInstructions(feePayer, instructions) {
const addressMap = {
[feePayer]: { [TYPE]: 0 /* FEE_PAYER */, role: AccountRole.WRITABLE_SIGNER }
};
const addressesOfInvokedPrograms = /* @__PURE__ */ new Set();
for (const instruction of instructions) {
upsert(addressMap, instruction.programAddress, (entry) => {
addressesOfInvokedPrograms.add(instruction.programAddress);
if (TYPE in entry) {
if (isWritableRole(entry.role)) {
switch (entry[TYPE]) {
case 0 /* FEE_PAYER */:
throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES, {
programAddress: instruction.programAddress
});
default:
throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, {
programAddress: instruction.programAddress
});
}
}
if (entry[TYPE] === 2 /* STATIC */) {
return entry;
}
}
return { [TYPE]: 2 /* STATIC */, role: AccountRole.READONLY };
});
let addressComparator;
if (!instruction.accounts) {
continue;
}
for (const account of instruction.accounts) {
upsert(addressMap, account.address, (entry) => {
const {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
address: _,
...accountMeta
} = account;
if (TYPE in entry) {
switch (entry[TYPE]) {
case 0 /* FEE_PAYER */:
return entry;
case 1 /* LOOKUP_TABLE */: {
const nextRole = mergeRoles(entry.role, accountMeta.role);
if ("lookupTableAddress" in accountMeta) {
const shouldReplaceEntry = (
// Consider using the new LOOKUP_TABLE if its address is different...
entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
(addressComparator ||= getAddressComparator())(
accountMeta.lookupTableAddress,
entry.lookupTableAddress
) < 0
);
if (shouldReplaceEntry) {
return {
[TYPE]: 1 /* LOOKUP_TABLE */,
...accountMeta,
role: nextRole
};
}
} else if (isSignerRole(accountMeta.role)) {
return {
[TYPE]: 2 /* STATIC */,
role: nextRole
};
}
if (entry.role !== nextRole) {
return {
...entry,
role: nextRole
};
} else {
return entry;
}
}
case 2 /* STATIC */: {
const nextRole = mergeRoles(entry.role, accountMeta.role);
if (
// Check to see if this address represents a program that is invoked
// in this transaction.
addressesOfInvokedPrograms.has(account.address)
) {
if (isWritableRole(accountMeta.role)) {
throw new SolanaError(
SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,
{
programAddress: account.address
}
);
}
if (entry.role !== nextRole) {
return {
...entry,
role: nextRole
};
} else {
return entry;
}
} else if ("lookupTableAddress" in accountMeta && // Static accounts can be 'upgraded' to lookup table accounts as
// long as they are not require to sign the transaction.
!isSignerRole(entry.role)) {
return {
...accountMeta,
[TYPE]: 1 /* LOOKUP_TABLE */,
role: nextRole
};
} else {
if (entry.role !== nextRole) {
return {
...entry,
role: nextRole
};
} else {
return entry;
}
}
}
}
}
if ("lookupTableAddress" in accountMeta) {
return {
...accountMeta,
[TYPE]: 1 /* LOOKUP_TABLE */
};
} else {
return {
...accountMeta,
[TYPE]: 2 /* STATIC */
};
}
});
}
}
return addressMap;
}
function getOrderedAccountsFromAddressMap(addressMap) {
let addressComparator;
const orderedAccounts = Object.entries(addressMap).sort(([leftAddress, leftEntry], [rightAddress, rightEntry]) => {
if (leftEntry[TYPE] !== rightEntry[TYPE]) {
if (leftEntry[TYPE] === 0 /* FEE_PAYER */) {
return -1;
} else if (rightEntry[TYPE] === 0 /* FEE_PAYER */) {
return 1;
} else if (leftEntry[TYPE] === 2 /* STATIC */) {
return -1;
} else if (rightEntry[TYPE] === 2 /* STATIC */) {
return 1;
}
}
const leftIsSigner = isSignerRole(leftEntry.role);
if (leftIsSigner !== isSignerRole(rightEntry.role)) {
return leftIsSigner ? -1 : 1;
}
const leftIsWritable = isWritableRole(leftEntry.role);
if (leftIsWritable !== isWritableRole(rightEntry.role)) {
return leftIsWritable ? -1 : 1;
}
addressComparator ||= getAddressComparator();
if (leftEntry[TYPE] === 1 /* LOOKUP_TABLE */ && rightEntry[TYPE] === 1 /* LOOKUP_TABLE */ && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {
return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);
} else {
return addressComparator(leftAddress, rightAddress);
}
}).map(([address, addressMeta]) => ({
address,
...addressMeta
}));
return orderedAccounts;
}
// src/create-transaction-message.ts
function createTransactionMessage({
version
}) {
const out = {
instructions: [],
version
};
Object.freeze(out);
return out;
}
var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";

@@ -156,4 +339,4 @@ var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";

export { appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce };
export { ADDRESS_MAP_TYPE_PROPERTY, AddressMapEntryType, appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, getAddressMapFromInstructions, getOrderedAccountsFromAddressMap, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.browser.js.map

@@ -1,16 +0,7 @@

import { SolanaError, SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME, SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME } from '@solana/errors';
import { SolanaError, SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME, SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME, SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES } from '@solana/errors';
import { assertIsBlockhash } from '@solana/rpc-types';
import { AccountRole, isSignerRole } from '@solana/instructions';
import { getAddressComparator } from '@solana/addresses';
import { AccountRole, isSignerRole, isWritableRole, mergeRoles } from '@solana/instructions';
// src/create-transaction-message.ts
function createTransactionMessage({
version
}) {
const out = {
instructions: [],
version
};
Object.freeze(out);
return out;
}
// src/blockhash.ts
function isTransactionMessageWithBlockhashLifetime(transaction) {

@@ -43,2 +34,194 @@ const lifetimeConstraintShapeMatches = "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.blockhash === "string" && typeof transaction.lifetimeConstraint.lastValidBlockHeight === "bigint";

}
var AddressMapEntryType = /* @__PURE__ */ ((AddressMapEntryType2) => {
AddressMapEntryType2[AddressMapEntryType2["FEE_PAYER"] = 0] = "FEE_PAYER";
AddressMapEntryType2[AddressMapEntryType2["LOOKUP_TABLE"] = 1] = "LOOKUP_TABLE";
AddressMapEntryType2[AddressMapEntryType2["STATIC"] = 2] = "STATIC";
return AddressMapEntryType2;
})(AddressMapEntryType || {});
function upsert(addressMap, address, update) {
addressMap[address] = update(addressMap[address] ?? { role: AccountRole.READONLY });
}
var TYPE = Symbol("AddressMapTypeProperty");
var ADDRESS_MAP_TYPE_PROPERTY = TYPE;
function getAddressMapFromInstructions(feePayer, instructions) {
const addressMap = {
[feePayer]: { [TYPE]: 0 /* FEE_PAYER */, role: AccountRole.WRITABLE_SIGNER }
};
const addressesOfInvokedPrograms = /* @__PURE__ */ new Set();
for (const instruction of instructions) {
upsert(addressMap, instruction.programAddress, (entry) => {
addressesOfInvokedPrograms.add(instruction.programAddress);
if (TYPE in entry) {
if (isWritableRole(entry.role)) {
switch (entry[TYPE]) {
case 0 /* FEE_PAYER */:
throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES, {
programAddress: instruction.programAddress
});
default:
throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, {
programAddress: instruction.programAddress
});
}
}
if (entry[TYPE] === 2 /* STATIC */) {
return entry;
}
}
return { [TYPE]: 2 /* STATIC */, role: AccountRole.READONLY };
});
let addressComparator;
if (!instruction.accounts) {
continue;
}
for (const account of instruction.accounts) {
upsert(addressMap, account.address, (entry) => {
const {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
address: _,
...accountMeta
} = account;
if (TYPE in entry) {
switch (entry[TYPE]) {
case 0 /* FEE_PAYER */:
return entry;
case 1 /* LOOKUP_TABLE */: {
const nextRole = mergeRoles(entry.role, accountMeta.role);
if ("lookupTableAddress" in accountMeta) {
const shouldReplaceEntry = (
// Consider using the new LOOKUP_TABLE if its address is different...
entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
(addressComparator ||= getAddressComparator())(
accountMeta.lookupTableAddress,
entry.lookupTableAddress
) < 0
);
if (shouldReplaceEntry) {
return {
[TYPE]: 1 /* LOOKUP_TABLE */,
...accountMeta,
role: nextRole
};
}
} else if (isSignerRole(accountMeta.role)) {
return {
[TYPE]: 2 /* STATIC */,
role: nextRole
};
}
if (entry.role !== nextRole) {
return {
...entry,
role: nextRole
};
} else {
return entry;
}
}
case 2 /* STATIC */: {
const nextRole = mergeRoles(entry.role, accountMeta.role);
if (
// Check to see if this address represents a program that is invoked
// in this transaction.
addressesOfInvokedPrograms.has(account.address)
) {
if (isWritableRole(accountMeta.role)) {
throw new SolanaError(
SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,
{
programAddress: account.address
}
);
}
if (entry.role !== nextRole) {
return {
...entry,
role: nextRole
};
} else {
return entry;
}
} else if ("lookupTableAddress" in accountMeta && // Static accounts can be 'upgraded' to lookup table accounts as
// long as they are not require to sign the transaction.
!isSignerRole(entry.role)) {
return {
...accountMeta,
[TYPE]: 1 /* LOOKUP_TABLE */,
role: nextRole
};
} else {
if (entry.role !== nextRole) {
return {
...entry,
role: nextRole
};
} else {
return entry;
}
}
}
}
}
if ("lookupTableAddress" in accountMeta) {
return {
...accountMeta,
[TYPE]: 1 /* LOOKUP_TABLE */
};
} else {
return {
...accountMeta,
[TYPE]: 2 /* STATIC */
};
}
});
}
}
return addressMap;
}
function getOrderedAccountsFromAddressMap(addressMap) {
let addressComparator;
const orderedAccounts = Object.entries(addressMap).sort(([leftAddress, leftEntry], [rightAddress, rightEntry]) => {
if (leftEntry[TYPE] !== rightEntry[TYPE]) {
if (leftEntry[TYPE] === 0 /* FEE_PAYER */) {
return -1;
} else if (rightEntry[TYPE] === 0 /* FEE_PAYER */) {
return 1;
} else if (leftEntry[TYPE] === 2 /* STATIC */) {
return -1;
} else if (rightEntry[TYPE] === 2 /* STATIC */) {
return 1;
}
}
const leftIsSigner = isSignerRole(leftEntry.role);
if (leftIsSigner !== isSignerRole(rightEntry.role)) {
return leftIsSigner ? -1 : 1;
}
const leftIsWritable = isWritableRole(leftEntry.role);
if (leftIsWritable !== isWritableRole(rightEntry.role)) {
return leftIsWritable ? -1 : 1;
}
addressComparator ||= getAddressComparator();
if (leftEntry[TYPE] === 1 /* LOOKUP_TABLE */ && rightEntry[TYPE] === 1 /* LOOKUP_TABLE */ && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {
return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);
} else {
return addressComparator(leftAddress, rightAddress);
}
}).map(([address, addressMeta]) => ({
address,
...addressMeta
}));
return orderedAccounts;
}
// src/create-transaction-message.ts
function createTransactionMessage({
version
}) {
const out = {
instructions: [],
version
};
Object.freeze(out);
return out;
}
var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";

@@ -156,4 +339,4 @@ var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";

export { appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce };
export { ADDRESS_MAP_TYPE_PROPERTY, AddressMapEntryType, appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, getAddressMapFromInstructions, getOrderedAccountsFromAddressMap, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.native.js.map

@@ -1,16 +0,7 @@

import { SolanaError, SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME, SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME } from '@solana/errors';
import { SolanaError, SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME, SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME, SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES } from '@solana/errors';
import { assertIsBlockhash } from '@solana/rpc-types';
import { AccountRole, isSignerRole } from '@solana/instructions';
import { getAddressComparator } from '@solana/addresses';
import { AccountRole, isSignerRole, isWritableRole, mergeRoles } from '@solana/instructions';
// src/create-transaction-message.ts
function createTransactionMessage({
version
}) {
const out = {
instructions: [],
version
};
Object.freeze(out);
return out;
}
// src/blockhash.ts
function isTransactionMessageWithBlockhashLifetime(transaction) {

@@ -43,2 +34,194 @@ const lifetimeConstraintShapeMatches = "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.blockhash === "string" && typeof transaction.lifetimeConstraint.lastValidBlockHeight === "bigint";

}
var AddressMapEntryType = /* @__PURE__ */ ((AddressMapEntryType2) => {
AddressMapEntryType2[AddressMapEntryType2["FEE_PAYER"] = 0] = "FEE_PAYER";
AddressMapEntryType2[AddressMapEntryType2["LOOKUP_TABLE"] = 1] = "LOOKUP_TABLE";
AddressMapEntryType2[AddressMapEntryType2["STATIC"] = 2] = "STATIC";
return AddressMapEntryType2;
})(AddressMapEntryType || {});
function upsert(addressMap, address, update) {
addressMap[address] = update(addressMap[address] ?? { role: AccountRole.READONLY });
}
var TYPE = Symbol("AddressMapTypeProperty");
var ADDRESS_MAP_TYPE_PROPERTY = TYPE;
function getAddressMapFromInstructions(feePayer, instructions) {
const addressMap = {
[feePayer]: { [TYPE]: 0 /* FEE_PAYER */, role: AccountRole.WRITABLE_SIGNER }
};
const addressesOfInvokedPrograms = /* @__PURE__ */ new Set();
for (const instruction of instructions) {
upsert(addressMap, instruction.programAddress, (entry) => {
addressesOfInvokedPrograms.add(instruction.programAddress);
if (TYPE in entry) {
if (isWritableRole(entry.role)) {
switch (entry[TYPE]) {
case 0 /* FEE_PAYER */:
throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES, {
programAddress: instruction.programAddress
});
default:
throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, {
programAddress: instruction.programAddress
});
}
}
if (entry[TYPE] === 2 /* STATIC */) {
return entry;
}
}
return { [TYPE]: 2 /* STATIC */, role: AccountRole.READONLY };
});
let addressComparator;
if (!instruction.accounts) {
continue;
}
for (const account of instruction.accounts) {
upsert(addressMap, account.address, (entry) => {
const {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
address: _,
...accountMeta
} = account;
if (TYPE in entry) {
switch (entry[TYPE]) {
case 0 /* FEE_PAYER */:
return entry;
case 1 /* LOOKUP_TABLE */: {
const nextRole = mergeRoles(entry.role, accountMeta.role);
if ("lookupTableAddress" in accountMeta) {
const shouldReplaceEntry = (
// Consider using the new LOOKUP_TABLE if its address is different...
entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
(addressComparator ||= getAddressComparator())(
accountMeta.lookupTableAddress,
entry.lookupTableAddress
) < 0
);
if (shouldReplaceEntry) {
return {
[TYPE]: 1 /* LOOKUP_TABLE */,
...accountMeta,
role: nextRole
};
}
} else if (isSignerRole(accountMeta.role)) {
return {
[TYPE]: 2 /* STATIC */,
role: nextRole
};
}
if (entry.role !== nextRole) {
return {
...entry,
role: nextRole
};
} else {
return entry;
}
}
case 2 /* STATIC */: {
const nextRole = mergeRoles(entry.role, accountMeta.role);
if (
// Check to see if this address represents a program that is invoked
// in this transaction.
addressesOfInvokedPrograms.has(account.address)
) {
if (isWritableRole(accountMeta.role)) {
throw new SolanaError(
SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,
{
programAddress: account.address
}
);
}
if (entry.role !== nextRole) {
return {
...entry,
role: nextRole
};
} else {
return entry;
}
} else if ("lookupTableAddress" in accountMeta && // Static accounts can be 'upgraded' to lookup table accounts as
// long as they are not require to sign the transaction.
!isSignerRole(entry.role)) {
return {
...accountMeta,
[TYPE]: 1 /* LOOKUP_TABLE */,
role: nextRole
};
} else {
if (entry.role !== nextRole) {
return {
...entry,
role: nextRole
};
} else {
return entry;
}
}
}
}
}
if ("lookupTableAddress" in accountMeta) {
return {
...accountMeta,
[TYPE]: 1 /* LOOKUP_TABLE */
};
} else {
return {
...accountMeta,
[TYPE]: 2 /* STATIC */
};
}
});
}
}
return addressMap;
}
function getOrderedAccountsFromAddressMap(addressMap) {
let addressComparator;
const orderedAccounts = Object.entries(addressMap).sort(([leftAddress, leftEntry], [rightAddress, rightEntry]) => {
if (leftEntry[TYPE] !== rightEntry[TYPE]) {
if (leftEntry[TYPE] === 0 /* FEE_PAYER */) {
return -1;
} else if (rightEntry[TYPE] === 0 /* FEE_PAYER */) {
return 1;
} else if (leftEntry[TYPE] === 2 /* STATIC */) {
return -1;
} else if (rightEntry[TYPE] === 2 /* STATIC */) {
return 1;
}
}
const leftIsSigner = isSignerRole(leftEntry.role);
if (leftIsSigner !== isSignerRole(rightEntry.role)) {
return leftIsSigner ? -1 : 1;
}
const leftIsWritable = isWritableRole(leftEntry.role);
if (leftIsWritable !== isWritableRole(rightEntry.role)) {
return leftIsWritable ? -1 : 1;
}
addressComparator ||= getAddressComparator();
if (leftEntry[TYPE] === 1 /* LOOKUP_TABLE */ && rightEntry[TYPE] === 1 /* LOOKUP_TABLE */ && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {
return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);
} else {
return addressComparator(leftAddress, rightAddress);
}
}).map(([address, addressMeta]) => ({
address,
...addressMeta
}));
return orderedAccounts;
}
// src/create-transaction-message.ts
function createTransactionMessage({
version
}) {
const out = {
instructions: [],
version
};
Object.freeze(out);
return out;
}
var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";

@@ -156,4 +339,4 @@ var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";

export { appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce };
export { ADDRESS_MAP_TYPE_PROPERTY, AddressMapEntryType, appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, getAddressMapFromInstructions, getOrderedAccountsFromAddressMap, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.node.js.map

5

dist/types/index.d.ts

@@ -0,7 +1,8 @@

export * from './blockhash.js';
export * from './compile/index.js';
export * from './create-transaction-message.js';
export * from './transaction-message.js';
export * from './blockhash.js';
export * from './durable-nonce.js';
export * from './fee-payer.js';
export * from './instructions.js';
export * from './transaction-message.js';
//# sourceMappingURL=index.d.ts.map
{
"name": "@solana/transaction-messages",
"version": "2.0.0-preview.1.20240404170520.31916ae5d4fb29f239c63252a59745e33a6979ea",
"version": "2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd",
"description": "Helpers for creating transaction messages",

@@ -49,6 +49,6 @@ "exports": {

"dependencies": {
"@solana/addresses": "2.0.0-preview.1.20240404170520.31916ae5d4fb29f239c63252a59745e33a6979ea",
"@solana/errors": "2.0.0-preview.1.20240404170520.31916ae5d4fb29f239c63252a59745e33a6979ea",
"@solana/instructions": "2.0.0-preview.1.20240404170520.31916ae5d4fb29f239c63252a59745e33a6979ea",
"@solana/rpc-types": "2.0.0-preview.1.20240404170520.31916ae5d4fb29f239c63252a59745e33a6979ea"
"@solana/addresses": "2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd",
"@solana/errors": "2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd",
"@solana/instructions": "2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd",
"@solana/rpc-types": "2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd"
},

@@ -55,0 +55,0 @@ "bundlewatch": {

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