@solana/transaction-messages
Advanced tools
Comparing version 2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd to 2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890
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 { getAddressComparator } from '@solana/addresses'; | ||
import { getAddressEncoder, getAddressDecoder, getAddressComparator } from '@solana/addresses'; | ||
import { combineCodec } from '@solana/codecs-core'; | ||
import { getStructEncoder, getArrayEncoder, getStructDecoder, getArrayDecoder } from '@solana/codecs-data-structures'; | ||
import { getU8Encoder, getShortU16Encoder, getU8Decoder, getShortU16Decoder } from '@solana/codecs-numbers'; | ||
import { AccountRole, isSignerRole, isWritableRole, mergeRoles } from '@solana/instructions'; | ||
@@ -34,2 +37,33 @@ | ||
} | ||
var memoizedAddressTableLookupEncoder; | ||
function getAddressTableLookupEncoder() { | ||
if (!memoizedAddressTableLookupEncoder) { | ||
memoizedAddressTableLookupEncoder = getStructEncoder([ | ||
["lookupTableAddress", getAddressEncoder()], | ||
[ | ||
"writableIndices", | ||
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() }) | ||
], | ||
[ | ||
"readableIndices", | ||
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() }) | ||
] | ||
]); | ||
} | ||
return memoizedAddressTableLookupEncoder; | ||
} | ||
var memoizedAddressTableLookupDecoder; | ||
function getAddressTableLookupDecoder() { | ||
if (!memoizedAddressTableLookupDecoder) { | ||
memoizedAddressTableLookupDecoder = getStructDecoder([ | ||
["lookupTableAddress", getAddressDecoder()], | ||
["writableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })], | ||
["readableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })] | ||
]); | ||
} | ||
return memoizedAddressTableLookupDecoder; | ||
} | ||
function getAddressTableLookupCodec() { | ||
return combineCodec(getAddressTableLookupEncoder(), getAddressTableLookupDecoder()); | ||
} | ||
var AddressMapEntryType = /* @__PURE__ */ ((AddressMapEntryType2) => { | ||
@@ -215,2 +249,23 @@ AddressMapEntryType2[AddressMapEntryType2["FEE_PAYER"] = 0] = "FEE_PAYER"; | ||
} | ||
function getCompiledAddressTableLookups(orderedAccounts) { | ||
const index = {}; | ||
for (const account of orderedAccounts) { | ||
if (!("lookupTableAddress" in account)) { | ||
continue; | ||
} | ||
const entry = index[account.lookupTableAddress] ||= { | ||
readableIndices: [], | ||
writableIndices: [] | ||
}; | ||
if (account.role === AccountRole.WRITABLE) { | ||
entry.writableIndices.push(account.addressIndex); | ||
} else { | ||
entry.readableIndices.push(account.addressIndex); | ||
} | ||
} | ||
return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({ | ||
lookupTableAddress, | ||
...index[lookupTableAddress] | ||
})); | ||
} | ||
@@ -340,4 +395,4 @@ // src/create-transaction-message.ts | ||
export { ADDRESS_MAP_TYPE_PROPERTY, AddressMapEntryType, appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, getAddressMapFromInstructions, getOrderedAccountsFromAddressMap, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce }; | ||
export { ADDRESS_MAP_TYPE_PROPERTY, AddressMapEntryType, appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, getAddressMapFromInstructions, getAddressTableLookupCodec, getAddressTableLookupDecoder, getAddressTableLookupEncoder, getCompiledAddressTableLookups, getOrderedAccountsFromAddressMap, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.browser.js.map |
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 { getAddressComparator } from '@solana/addresses'; | ||
import { getAddressEncoder, getAddressDecoder, getAddressComparator } from '@solana/addresses'; | ||
import { combineCodec } from '@solana/codecs-core'; | ||
import { getStructEncoder, getArrayEncoder, getStructDecoder, getArrayDecoder } from '@solana/codecs-data-structures'; | ||
import { getU8Encoder, getShortU16Encoder, getU8Decoder, getShortU16Decoder } from '@solana/codecs-numbers'; | ||
import { AccountRole, isSignerRole, isWritableRole, mergeRoles } from '@solana/instructions'; | ||
@@ -34,2 +37,33 @@ | ||
} | ||
var memoizedAddressTableLookupEncoder; | ||
function getAddressTableLookupEncoder() { | ||
if (!memoizedAddressTableLookupEncoder) { | ||
memoizedAddressTableLookupEncoder = getStructEncoder([ | ||
["lookupTableAddress", getAddressEncoder()], | ||
[ | ||
"writableIndices", | ||
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() }) | ||
], | ||
[ | ||
"readableIndices", | ||
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() }) | ||
] | ||
]); | ||
} | ||
return memoizedAddressTableLookupEncoder; | ||
} | ||
var memoizedAddressTableLookupDecoder; | ||
function getAddressTableLookupDecoder() { | ||
if (!memoizedAddressTableLookupDecoder) { | ||
memoizedAddressTableLookupDecoder = getStructDecoder([ | ||
["lookupTableAddress", getAddressDecoder()], | ||
["writableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })], | ||
["readableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })] | ||
]); | ||
} | ||
return memoizedAddressTableLookupDecoder; | ||
} | ||
function getAddressTableLookupCodec() { | ||
return combineCodec(getAddressTableLookupEncoder(), getAddressTableLookupDecoder()); | ||
} | ||
var AddressMapEntryType = /* @__PURE__ */ ((AddressMapEntryType2) => { | ||
@@ -215,2 +249,23 @@ AddressMapEntryType2[AddressMapEntryType2["FEE_PAYER"] = 0] = "FEE_PAYER"; | ||
} | ||
function getCompiledAddressTableLookups(orderedAccounts) { | ||
const index = {}; | ||
for (const account of orderedAccounts) { | ||
if (!("lookupTableAddress" in account)) { | ||
continue; | ||
} | ||
const entry = index[account.lookupTableAddress] ||= { | ||
readableIndices: [], | ||
writableIndices: [] | ||
}; | ||
if (account.role === AccountRole.WRITABLE) { | ||
entry.writableIndices.push(account.addressIndex); | ||
} else { | ||
entry.readableIndices.push(account.addressIndex); | ||
} | ||
} | ||
return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({ | ||
lookupTableAddress, | ||
...index[lookupTableAddress] | ||
})); | ||
} | ||
@@ -340,4 +395,4 @@ // src/create-transaction-message.ts | ||
export { ADDRESS_MAP_TYPE_PROPERTY, AddressMapEntryType, appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, getAddressMapFromInstructions, getOrderedAccountsFromAddressMap, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce }; | ||
export { ADDRESS_MAP_TYPE_PROPERTY, AddressMapEntryType, appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, getAddressMapFromInstructions, getAddressTableLookupCodec, getAddressTableLookupDecoder, getAddressTableLookupEncoder, getCompiledAddressTableLookups, getOrderedAccountsFromAddressMap, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.native.js.map |
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 { getAddressComparator } from '@solana/addresses'; | ||
import { getAddressEncoder, getAddressDecoder, getAddressComparator } from '@solana/addresses'; | ||
import { combineCodec } from '@solana/codecs-core'; | ||
import { getStructEncoder, getArrayEncoder, getStructDecoder, getArrayDecoder } from '@solana/codecs-data-structures'; | ||
import { getU8Encoder, getShortU16Encoder, getU8Decoder, getShortU16Decoder } from '@solana/codecs-numbers'; | ||
import { AccountRole, isSignerRole, isWritableRole, mergeRoles } from '@solana/instructions'; | ||
@@ -34,2 +37,33 @@ | ||
} | ||
var memoizedAddressTableLookupEncoder; | ||
function getAddressTableLookupEncoder() { | ||
if (!memoizedAddressTableLookupEncoder) { | ||
memoizedAddressTableLookupEncoder = getStructEncoder([ | ||
["lookupTableAddress", getAddressEncoder()], | ||
[ | ||
"writableIndices", | ||
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() }) | ||
], | ||
[ | ||
"readableIndices", | ||
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() }) | ||
] | ||
]); | ||
} | ||
return memoizedAddressTableLookupEncoder; | ||
} | ||
var memoizedAddressTableLookupDecoder; | ||
function getAddressTableLookupDecoder() { | ||
if (!memoizedAddressTableLookupDecoder) { | ||
memoizedAddressTableLookupDecoder = getStructDecoder([ | ||
["lookupTableAddress", getAddressDecoder()], | ||
["writableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })], | ||
["readableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })] | ||
]); | ||
} | ||
return memoizedAddressTableLookupDecoder; | ||
} | ||
function getAddressTableLookupCodec() { | ||
return combineCodec(getAddressTableLookupEncoder(), getAddressTableLookupDecoder()); | ||
} | ||
var AddressMapEntryType = /* @__PURE__ */ ((AddressMapEntryType2) => { | ||
@@ -215,2 +249,23 @@ AddressMapEntryType2[AddressMapEntryType2["FEE_PAYER"] = 0] = "FEE_PAYER"; | ||
} | ||
function getCompiledAddressTableLookups(orderedAccounts) { | ||
const index = {}; | ||
for (const account of orderedAccounts) { | ||
if (!("lookupTableAddress" in account)) { | ||
continue; | ||
} | ||
const entry = index[account.lookupTableAddress] ||= { | ||
readableIndices: [], | ||
writableIndices: [] | ||
}; | ||
if (account.role === AccountRole.WRITABLE) { | ||
entry.writableIndices.push(account.addressIndex); | ||
} else { | ||
entry.readableIndices.push(account.addressIndex); | ||
} | ||
} | ||
return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({ | ||
lookupTableAddress, | ||
...index[lookupTableAddress] | ||
})); | ||
} | ||
@@ -340,4 +395,4 @@ // src/create-transaction-message.ts | ||
export { ADDRESS_MAP_TYPE_PROPERTY, AddressMapEntryType, appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, getAddressMapFromInstructions, getOrderedAccountsFromAddressMap, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce }; | ||
export { ADDRESS_MAP_TYPE_PROPERTY, AddressMapEntryType, appendTransactionMessageInstruction, appendTransactionMessageInstructions, assertIsDurableNonceTransactionMessage, assertIsTransactionMessageWithBlockhashLifetime, createTransactionMessage, getAddressMapFromInstructions, getAddressTableLookupCodec, getAddressTableLookupDecoder, getAddressTableLookupEncoder, getCompiledAddressTableLookups, getOrderedAccountsFromAddressMap, newIsAdvanceNonceAccountInstruction, prependTransactionMessageInstruction, prependTransactionMessageInstructions, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, setTransactionMessageLifetimeUsingDurableNonce }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.node.js.map |
export * from './accounts.js'; | ||
export * from './address-table-lookups.js'; | ||
//# sourceMappingURL=index.d.ts.map |
export * from './blockhash.js'; | ||
export * from './codecs/index.js'; | ||
export * from './compile/index.js'; | ||
@@ -3,0 +4,0 @@ export * from './create-transaction-message.js'; |
{ | ||
"name": "@solana/transaction-messages", | ||
"version": "2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd", | ||
"version": "2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890", | ||
"description": "Helpers for creating transaction messages", | ||
@@ -49,6 +49,9 @@ "exports": { | ||
"dependencies": { | ||
"@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" | ||
"@solana/addresses": "2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890", | ||
"@solana/codecs-core": "2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890", | ||
"@solana/codecs-data-structures": "2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890", | ||
"@solana/codecs-numbers": "2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890", | ||
"@solana/errors": "2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890", | ||
"@solana/instructions": "2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890", | ||
"@solana/rpc-types": "2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890" | ||
}, | ||
@@ -55,0 +58,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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
298311
37
2128
7
+ Added@solana/codecs-core@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890
+ Added@solana/codecs-numbers@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890
+ Added@solana/addresses@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890(transitive)
+ Added@solana/assertions@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890(transitive)
+ Added@solana/codecs-core@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890(transitive)
+ Added@solana/codecs-data-structures@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890(transitive)
+ Added@solana/codecs-numbers@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890(transitive)
+ Added@solana/codecs-strings@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890(transitive)
+ Added@solana/errors@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890(transitive)
+ Added@solana/instructions@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890(transitive)
+ Added@solana/rpc-types@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890(transitive)
- Removed@solana/addresses@2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd(transitive)
- Removed@solana/assertions@2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd(transitive)
- Removed@solana/codecs-core@2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd(transitive)
- Removed@solana/codecs-numbers@2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd(transitive)
- Removed@solana/codecs-strings@2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd(transitive)
- Removed@solana/errors@2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd(transitive)
- Removed@solana/instructions@2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd(transitive)
- Removed@solana/rpc-types@2.0.0-preview.1.20240408101831.4c6dbbcef41ae3f2a185994915ce187b71a174fd(transitive)
Updated@solana/addresses@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890
Updated@solana/errors@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890
Updated@solana/instructions@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890
Updated@solana/rpc-types@2.0.0-preview.1.20240408102000.ab044e4b4f8458f4c1d833ef9dd87900017be890