@solana/signers
Advanced tools
Comparing version 2.0.0-experimental.c156b67 to 2.0.0-experimental.c9bd7fa
@@ -75,19 +75,2 @@ this.globalThis = this.globalThis || {}; | ||
} | ||
var mergeBytes = (byteArrays) => { | ||
const nonEmptyByteArrays = byteArrays.filter((arr) => arr.length); | ||
if (nonEmptyByteArrays.length === 0) { | ||
return byteArrays.length ? byteArrays[0] : new Uint8Array(); | ||
} | ||
if (nonEmptyByteArrays.length === 1) { | ||
return nonEmptyByteArrays[0]; | ||
} | ||
const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0); | ||
const result = new Uint8Array(totalLength); | ||
let offset = 0; | ||
nonEmptyByteArrays.forEach((arr) => { | ||
result.set(arr, offset); | ||
offset += arr.length; | ||
}); | ||
return result; | ||
}; | ||
var padBytes = (bytes, length) => { | ||
@@ -101,19 +84,47 @@ if (bytes.length >= length) | ||
var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length); | ||
function fixCodecHelper(data, fixedBytes, description) { | ||
return { | ||
description: description != null ? description : `fixed(${fixedBytes}, ${data.description})`, | ||
function getEncodedSize(value, encoder) { | ||
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value); | ||
} | ||
function createEncoder(encoder) { | ||
return Object.freeze({ | ||
...encoder, | ||
encode: (value) => { | ||
const bytes = new Uint8Array(getEncodedSize(value, encoder)); | ||
encoder.write(value, bytes, 0); | ||
return bytes; | ||
} | ||
}); | ||
} | ||
function createDecoder(decoder) { | ||
return Object.freeze({ | ||
...decoder, | ||
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0] | ||
}); | ||
} | ||
function isFixedSize(codec) { | ||
return "fixedSize" in codec && typeof codec.fixedSize === "number"; | ||
} | ||
function assertIsFixedSize(codec, message) { | ||
if (!isFixedSize(codec)) { | ||
throw new Error(message != null ? message : "Expected a fixed-size codec, got a variable-size one."); | ||
} | ||
} | ||
function isVariableSize(codec) { | ||
return !isFixedSize(codec); | ||
} | ||
function fixEncoder(encoder, fixedBytes) { | ||
return createEncoder({ | ||
fixedSize: fixedBytes, | ||
maxSize: fixedBytes | ||
}; | ||
write: (value, bytes, offset) => { | ||
const variableByteArray = encoder.encode(value); | ||
const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray; | ||
bytes.set(fixedByteArray, offset); | ||
return offset + fixedBytes; | ||
} | ||
}); | ||
} | ||
function fixEncoder(encoder, fixedBytes, description) { | ||
return { | ||
...fixCodecHelper(encoder, fixedBytes, description), | ||
encode: (value) => fixBytes(encoder.encode(value), fixedBytes) | ||
}; | ||
} | ||
function fixDecoder(decoder, fixedBytes, description) { | ||
return { | ||
...fixCodecHelper(decoder, fixedBytes, description), | ||
decode: (bytes, offset = 0) => { | ||
function fixDecoder(decoder, fixedBytes) { | ||
return createDecoder({ | ||
fixedSize: fixedBytes, | ||
read: (bytes, offset) => { | ||
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset); | ||
@@ -123,17 +134,15 @@ if (offset > 0 || bytes.length > fixedBytes) { | ||
} | ||
if (decoder.fixedSize !== null) { | ||
if (isFixedSize(decoder)) { | ||
bytes = fixBytes(bytes, decoder.fixedSize); | ||
} | ||
const [value] = decoder.decode(bytes, 0); | ||
const [value] = decoder.read(bytes, 0); | ||
return [value, offset + fixedBytes]; | ||
} | ||
}; | ||
}); | ||
} | ||
function mapEncoder(encoder, unmap) { | ||
return { | ||
description: encoder.description, | ||
encode: (value) => encoder.encode(unmap(value)), | ||
fixedSize: encoder.fixedSize, | ||
maxSize: encoder.maxSize | ||
}; | ||
return createEncoder({ | ||
...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder, | ||
write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset) | ||
}); | ||
} | ||
@@ -149,22 +158,9 @@ | ||
} | ||
function sharedNumberFactory(input) { | ||
var _a; | ||
let littleEndian; | ||
let defaultDescription = input.name; | ||
if (input.size > 1) { | ||
littleEndian = !("endian" in input.config) || input.config.endian === 0; | ||
defaultDescription += littleEndian ? "(le)" : "(be)"; | ||
} | ||
return { | ||
description: (_a = input.config.description) != null ? _a : defaultDescription, | ||
fixedSize: input.size, | ||
littleEndian, | ||
maxSize: input.size | ||
}; | ||
function isLittleEndian(config) { | ||
return (config == null ? void 0 : config.endian) === 1 ? false : true; | ||
} | ||
function numberEncoderFactory(input) { | ||
const codecData = sharedNumberFactory(input); | ||
return { | ||
description: codecData.description, | ||
encode(value) { | ||
return createEncoder({ | ||
fixedSize: input.size, | ||
write(value, bytes, offset) { | ||
if (input.range) { | ||
@@ -174,22 +170,18 @@ assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value); | ||
const arrayBuffer = new ArrayBuffer(input.size); | ||
input.set(new DataView(arrayBuffer), value, codecData.littleEndian); | ||
return new Uint8Array(arrayBuffer); | ||
}, | ||
fixedSize: codecData.fixedSize, | ||
maxSize: codecData.maxSize | ||
}; | ||
input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config)); | ||
bytes.set(new Uint8Array(arrayBuffer), offset); | ||
return offset + input.size; | ||
} | ||
}); | ||
} | ||
function numberDecoderFactory(input) { | ||
const codecData = sharedNumberFactory(input); | ||
return { | ||
decode(bytes, offset = 0) { | ||
assertByteArrayIsNotEmptyForCodec(codecData.description, bytes, offset); | ||
assertByteArrayHasEnoughBytesForCodec(codecData.description, input.size, bytes, offset); | ||
return createDecoder({ | ||
fixedSize: input.size, | ||
read(bytes, offset = 0) { | ||
assertByteArrayIsNotEmptyForCodec(input.name, bytes, offset); | ||
assertByteArrayHasEnoughBytesForCodec(input.name, input.size, bytes, offset); | ||
const view = new DataView(toArrayBuffer(bytes, offset, input.size)); | ||
return [input.get(view, codecData.littleEndian), offset + input.size]; | ||
}, | ||
description: codecData.description, | ||
fixedSize: codecData.fixedSize, | ||
maxSize: codecData.maxSize | ||
}; | ||
return [input.get(view, isLittleEndian(input.config)), offset + input.size]; | ||
} | ||
}); | ||
} | ||
@@ -201,26 +193,29 @@ function toArrayBuffer(bytes, offset, length) { | ||
} | ||
var getShortU16Encoder = (config = {}) => { | ||
var _a; | ||
return { | ||
description: (_a = config.description) != null ? _a : "shortU16", | ||
encode: (value) => { | ||
assertNumberIsBetweenForCodec("shortU16", 0, 65535, value); | ||
const bytes = [0]; | ||
for (let ii = 0; ; ii += 1) { | ||
const alignedValue = value >> ii * 7; | ||
if (alignedValue === 0) { | ||
break; | ||
} | ||
const nextSevenBits = 127 & alignedValue; | ||
bytes[ii] = nextSevenBits; | ||
if (ii > 0) { | ||
bytes[ii - 1] |= 128; | ||
} | ||
var getShortU16Encoder = () => createEncoder({ | ||
getSizeFromValue: (value) => { | ||
if (value <= 127) | ||
return 1; | ||
if (value <= 16383) | ||
return 2; | ||
return 3; | ||
}, | ||
maxSize: 3, | ||
write: (value, bytes, offset) => { | ||
assertNumberIsBetweenForCodec("shortU16", 0, 65535, value); | ||
const shortU16Bytes = [0]; | ||
for (let ii = 0; ; ii += 1) { | ||
const alignedValue = value >> ii * 7; | ||
if (alignedValue === 0) { | ||
break; | ||
} | ||
return new Uint8Array(bytes); | ||
}, | ||
fixedSize: null, | ||
maxSize: 3 | ||
}; | ||
}; | ||
const nextSevenBits = 127 & alignedValue; | ||
shortU16Bytes[ii] = nextSevenBits; | ||
if (ii > 0) { | ||
shortU16Bytes[ii - 1] |= 128; | ||
} | ||
} | ||
bytes.set(shortU16Bytes, offset); | ||
return offset + shortU16Bytes.length; | ||
} | ||
}); | ||
var getU32Encoder = (config = {}) => numberEncoderFactory({ | ||
@@ -239,4 +234,3 @@ config, | ||
}); | ||
var getU8Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
var getU8Encoder = () => numberEncoderFactory({ | ||
name: "u8", | ||
@@ -255,23 +249,20 @@ range: [0, Number("0xff")], | ||
var getBaseXEncoder = (alphabet4) => { | ||
const base = alphabet4.length; | ||
const baseBigInt = BigInt(base); | ||
return { | ||
description: `base${base}`, | ||
encode(value) { | ||
return createEncoder({ | ||
getSizeFromValue: (value) => { | ||
const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]); | ||
if (tailChars === "") | ||
return value.length; | ||
const base10Number = getBigIntFromBaseX(tailChars, alphabet4); | ||
return leadingZeroes.length + Math.ceil(base10Number.toString(16).length / 2); | ||
}, | ||
write(value, bytes, offset) { | ||
assertValidBaseString(alphabet4, value); | ||
if (value === "") | ||
return new Uint8Array(); | ||
const chars = [...value]; | ||
let trailIndex = chars.findIndex((c) => c !== alphabet4[0]); | ||
trailIndex = trailIndex === -1 ? chars.length : trailIndex; | ||
const leadingZeroes = Array(trailIndex).fill(0); | ||
if (trailIndex === chars.length) | ||
return Uint8Array.from(leadingZeroes); | ||
const tailChars = chars.slice(trailIndex); | ||
let base10Number = 0n; | ||
let baseXPower = 1n; | ||
for (let i = tailChars.length - 1; i >= 0; i -= 1) { | ||
base10Number += baseXPower * BigInt(alphabet4.indexOf(tailChars[i])); | ||
baseXPower *= baseBigInt; | ||
return offset; | ||
const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]); | ||
if (tailChars === "") { | ||
bytes.set(new Uint8Array(leadingZeroes.length).fill(0), offset); | ||
return offset + leadingZeroes.length; | ||
} | ||
let base10Number = getBigIntFromBaseX(tailChars, alphabet4); | ||
const tailBytes = []; | ||
@@ -282,13 +273,11 @@ while (base10Number > 0n) { | ||
} | ||
return Uint8Array.from(leadingZeroes.concat(tailBytes)); | ||
}, | ||
fixedSize: null, | ||
maxSize: null | ||
}; | ||
const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes]; | ||
bytes.set(bytesToAdd, offset); | ||
return offset + bytesToAdd.length; | ||
} | ||
}); | ||
}; | ||
var getBaseXDecoder = (alphabet4) => { | ||
const base = alphabet4.length; | ||
const baseBigInt = BigInt(base); | ||
return { | ||
decode(rawBytes, offset = 0) { | ||
return createDecoder({ | ||
read(rawBytes, offset) { | ||
const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset); | ||
@@ -302,15 +291,25 @@ if (bytes.length === 0) | ||
return [leadingZeroes, rawBytes.length]; | ||
let base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n); | ||
const tailChars = []; | ||
while (base10Number > 0n) { | ||
tailChars.unshift(alphabet4[Number(base10Number % baseBigInt)]); | ||
base10Number /= baseBigInt; | ||
} | ||
return [leadingZeroes + tailChars.join(""), rawBytes.length]; | ||
}, | ||
description: `base${base}`, | ||
fixedSize: null, | ||
maxSize: null | ||
}; | ||
const base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n); | ||
const tailChars = getBaseXFromBigInt(base10Number, alphabet4); | ||
return [leadingZeroes + tailChars, rawBytes.length]; | ||
} | ||
}); | ||
}; | ||
function partitionLeadingZeroes(value, zeroCharacter) { | ||
const leadingZeroIndex = [...value].findIndex((c) => c !== zeroCharacter); | ||
return leadingZeroIndex === -1 ? [value, ""] : [value.slice(0, leadingZeroIndex), value.slice(leadingZeroIndex)]; | ||
} | ||
function getBigIntFromBaseX(value, alphabet4) { | ||
const base = BigInt(alphabet4.length); | ||
return [...value].reduce((sum, char) => sum * base + BigInt(alphabet4.indexOf(char)), 0n); | ||
} | ||
function getBaseXFromBigInt(value, alphabet4) { | ||
const base = BigInt(alphabet4.length); | ||
const tailChars = []; | ||
while (value > 0n) { | ||
tailChars.unshift(alphabet4[Number(value % base)]); | ||
value /= base; | ||
} | ||
return tailChars.join(""); | ||
} | ||
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; | ||
@@ -327,58 +326,56 @@ var getBase58Encoder = () => getBaseXEncoder(alphabet2); | ||
let textEncoder; | ||
return { | ||
description: "utf8", | ||
encode: (value) => new Uint8Array((textEncoder || (textEncoder = new o())).encode(value)), | ||
fixedSize: null, | ||
maxSize: null | ||
}; | ||
return createEncoder({ | ||
getSizeFromValue: (value) => (textEncoder || (textEncoder = new o())).encode(value).length, | ||
write: (value, bytes, offset) => { | ||
const bytesToAdd = (textEncoder || (textEncoder = new o())).encode(value); | ||
bytes.set(bytesToAdd, offset); | ||
return offset + bytesToAdd.length; | ||
} | ||
}); | ||
}; | ||
var getUtf8Decoder = () => { | ||
let textDecoder; | ||
return { | ||
decode(bytes, offset = 0) { | ||
return createDecoder({ | ||
read(bytes, offset) { | ||
const value = (textDecoder || (textDecoder = new e())).decode(bytes.slice(offset)); | ||
return [removeNullCharacters(value), bytes.length]; | ||
}, | ||
description: "utf8", | ||
fixedSize: null, | ||
maxSize: null | ||
}; | ||
} | ||
}); | ||
}; | ||
var getStringEncoder = (config = {}) => { | ||
var _a, _b, _c; | ||
function getStringEncoder(config = {}) { | ||
var _a, _b; | ||
const size = (_a = config.size) != null ? _a : getU32Encoder(); | ||
const encoding = (_b = config.encoding) != null ? _b : getUtf8Encoder(); | ||
const description = (_c = config.description) != null ? _c : `string(${encoding.description}; ${getSizeDescription(size)})`; | ||
if (size === "variable") { | ||
return { ...encoding, description }; | ||
return encoding; | ||
} | ||
if (typeof size === "number") { | ||
return fixEncoder(encoding, size, description); | ||
return fixEncoder(encoding, size); | ||
} | ||
return { | ||
description, | ||
encode: (value) => { | ||
const contentBytes = encoding.encode(value); | ||
const lengthBytes = size.encode(contentBytes.length); | ||
return mergeBytes([lengthBytes, contentBytes]); | ||
return createEncoder({ | ||
getSizeFromValue: (value) => { | ||
const contentSize = getEncodedSize(value, encoding); | ||
return getEncodedSize(contentSize, size) + contentSize; | ||
}, | ||
fixedSize: null, | ||
maxSize: null | ||
}; | ||
}; | ||
var getStringDecoder = (config = {}) => { | ||
var _a, _b, _c; | ||
write: (value, bytes, offset) => { | ||
const contentSize = getEncodedSize(value, encoding); | ||
offset = size.write(contentSize, bytes, offset); | ||
return encoding.write(value, bytes, offset); | ||
} | ||
}); | ||
} | ||
function getStringDecoder(config = {}) { | ||
var _a, _b; | ||
const size = (_a = config.size) != null ? _a : getU32Decoder(); | ||
const encoding = (_b = config.encoding) != null ? _b : getUtf8Decoder(); | ||
const description = (_c = config.description) != null ? _c : `string(${encoding.description}; ${getSizeDescription(size)})`; | ||
if (size === "variable") { | ||
return { ...encoding, description }; | ||
return encoding; | ||
} | ||
if (typeof size === "number") { | ||
return fixDecoder(encoding, size, description); | ||
return fixDecoder(encoding, size); | ||
} | ||
return { | ||
decode: (bytes, offset = 0) => { | ||
return createDecoder({ | ||
read: (bytes, offset = 0) => { | ||
assertByteArrayIsNotEmptyForCodec("string", bytes, offset); | ||
const [lengthBigInt, lengthOffset] = size.decode(bytes, offset); | ||
const [lengthBigInt, lengthOffset] = size.read(bytes, offset); | ||
const length = Number(lengthBigInt); | ||
@@ -388,13 +385,7 @@ offset = lengthOffset; | ||
assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes); | ||
const [value, contentOffset] = encoding.decode(contentBytes); | ||
const [value, contentOffset] = encoding.read(contentBytes, 0); | ||
offset += contentOffset; | ||
return [value, offset]; | ||
}, | ||
description, | ||
fixedSize: null, | ||
maxSize: null | ||
}; | ||
}; | ||
function getSizeDescription(size) { | ||
return typeof size === "object" ? size.description : `${size}`; | ||
} | ||
}); | ||
} | ||
@@ -513,20 +504,10 @@ | ||
} | ||
function getAddressEncoder(config) { | ||
var _a; | ||
function getAddressEncoder() { | ||
return mapEncoder( | ||
getStringEncoder({ | ||
description: (_a = config == null ? void 0 : config.description) != null ? _a : "Address", | ||
encoding: getMemoizedBase58Encoder(), | ||
size: 32 | ||
}), | ||
getStringEncoder({ encoding: getMemoizedBase58Encoder(), size: 32 }), | ||
(putativeAddress) => address(putativeAddress) | ||
); | ||
} | ||
function getAddressDecoder(config) { | ||
var _a; | ||
return getStringDecoder({ | ||
description: (_a = config == null ? void 0 : config.description) != null ? _a : "Address", | ||
encoding: getMemoizedBase58Decoder(), | ||
size: 32 | ||
}); | ||
function getAddressDecoder() { | ||
return getStringDecoder({ encoding: getMemoizedBase58Decoder(), size: 32 }); | ||
} | ||
@@ -549,4 +530,3 @@ function getAddressComparator() { | ||
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey); | ||
const [base58EncodedAddress] = getAddressDecoder().decode(new Uint8Array(publicKeyBytes)); | ||
return base58EncodedAddress; | ||
return getAddressDecoder().decode(new Uint8Array(publicKeyBytes)); | ||
} | ||
@@ -576,19 +556,2 @@ | ||
// ../codecs-data-structures/dist/index.browser.js | ||
function sumCodecSizes(sizes) { | ||
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0); | ||
} | ||
function getArrayLikeCodecSizeDescription(size) { | ||
return typeof size === "object" ? size.description : `${size}`; | ||
} | ||
function getArrayLikeCodecSizeFromChildren(size, childrenSizes) { | ||
if (typeof size !== "number") | ||
return null; | ||
if (size === 0) | ||
return 0; | ||
const childrenSize = sumCodecSizes(childrenSizes); | ||
return childrenSize === null ? null : childrenSize * size; | ||
} | ||
function getArrayLikeCodecSizePrefix(size, realSize) { | ||
return typeof size === "object" ? size.encode(realSize) : new Uint8Array(); | ||
} | ||
function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) { | ||
@@ -599,36 +562,59 @@ if (expected !== actual) { | ||
} | ||
function arrayCodecHelper(item, size, description) { | ||
if (size === "remainder" && item.fixedSize === null) { | ||
throw new Error('Codecs of "remainder" size must have fixed-size items.'); | ||
} | ||
return { | ||
description: description != null ? description : `array(${item.description}; ${getArrayLikeCodecSizeDescription(size)})`, | ||
fixedSize: getArrayLikeCodecSizeFromChildren(size, [item.fixedSize]), | ||
maxSize: getArrayLikeCodecSizeFromChildren(size, [item.maxSize]) | ||
}; | ||
function sumCodecSizes(sizes) { | ||
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0); | ||
} | ||
function getFixedSize(codec) { | ||
return isFixedSize(codec) ? codec.fixedSize : null; | ||
} | ||
function getMaxSize(codec) { | ||
var _a; | ||
return isFixedSize(codec) ? codec.fixedSize : (_a = codec.maxSize) != null ? _a : null; | ||
} | ||
function getArrayEncoder(item, config = {}) { | ||
var _a; | ||
var _a, _b; | ||
const size = (_a = config.size) != null ? _a : getU32Encoder(); | ||
return { | ||
...arrayCodecHelper(item, size, config.description), | ||
encode: (value) => { | ||
if (size === "remainder") { | ||
assertIsFixedSize(item, 'Codecs of "remainder" size must have fixed-size items.'); | ||
} | ||
const fixedSize = computeArrayLikeCodecSize(size, getFixedSize(item)); | ||
const maxSize = (_b = computeArrayLikeCodecSize(size, getMaxSize(item))) != null ? _b : void 0; | ||
return createEncoder({ | ||
...fixedSize !== null ? { fixedSize } : { | ||
getSizeFromValue: (array) => { | ||
const prefixSize = typeof size === "object" ? getEncodedSize(array.length, size) : 0; | ||
return prefixSize + [...array].reduce((all, value) => all + getEncodedSize(value, item), 0); | ||
}, | ||
maxSize | ||
}, | ||
write: (array, bytes, offset) => { | ||
if (typeof size === "number") { | ||
assertValidNumberOfItemsForCodec("array", size, value.length); | ||
assertValidNumberOfItemsForCodec("array", size, array.length); | ||
} | ||
return mergeBytes([getArrayLikeCodecSizePrefix(size, value.length), ...value.map((v) => item.encode(v))]); | ||
if (typeof size === "object") { | ||
offset = size.write(array.length, bytes, offset); | ||
} | ||
array.forEach((value) => { | ||
offset = item.write(value, bytes, offset); | ||
}); | ||
return offset; | ||
} | ||
}; | ||
}); | ||
} | ||
function computeArrayLikeCodecSize(size, itemSize) { | ||
if (typeof size !== "number") | ||
return null; | ||
if (size === 0) | ||
return 0; | ||
return itemSize === null ? null : itemSize * size; | ||
} | ||
function getBytesEncoder(config = {}) { | ||
var _a, _b; | ||
var _a; | ||
const size = (_a = config.size) != null ? _a : "variable"; | ||
const sizeDescription = typeof size === "object" ? size.description : `${size}`; | ||
const description = (_b = config.description) != null ? _b : `bytes(${sizeDescription})`; | ||
const byteEncoder = { | ||
description, | ||
encode: (value) => value, | ||
fixedSize: null, | ||
maxSize: null | ||
}; | ||
const byteEncoder = createEncoder({ | ||
getSizeFromValue: (value) => value.length, | ||
write: (value, bytes, offset) => { | ||
bytes.set(value, offset); | ||
return offset + value.length; | ||
} | ||
}); | ||
if (size === "variable") { | ||
@@ -638,30 +624,32 @@ return byteEncoder; | ||
if (typeof size === "number") { | ||
return fixEncoder(byteEncoder, size, description); | ||
return fixEncoder(byteEncoder, size); | ||
} | ||
return { | ||
...byteEncoder, | ||
encode: (value) => { | ||
const contentBytes = byteEncoder.encode(value); | ||
const lengthBytes = size.encode(contentBytes.length); | ||
return mergeBytes([lengthBytes, contentBytes]); | ||
return createEncoder({ | ||
getSizeFromValue: (value) => getEncodedSize(value.length, size) + value.length, | ||
write: (value, bytes, offset) => { | ||
offset = size.write(value.length, bytes, offset); | ||
return byteEncoder.write(value, bytes, offset); | ||
} | ||
}; | ||
}); | ||
} | ||
function structCodecHelper(fields, description) { | ||
const fieldDescriptions = fields.map(([name, codec]) => `${String(name)}: ${codec.description}`).join(", "); | ||
return { | ||
description: description != null ? description : `struct(${fieldDescriptions})`, | ||
fixedSize: sumCodecSizes(fields.map(([, field]) => field.fixedSize)), | ||
maxSize: sumCodecSizes(fields.map(([, field]) => field.maxSize)) | ||
}; | ||
} | ||
function getStructEncoder(fields, config = {}) { | ||
return { | ||
...structCodecHelper(fields, config.description), | ||
encode: (struct) => { | ||
const fieldBytes = fields.map(([key, codec]) => codec.encode(struct[key])); | ||
return mergeBytes(fieldBytes); | ||
function getStructEncoder(fields) { | ||
var _a; | ||
const fieldCodecs = fields.map(([, codec]) => codec); | ||
const fixedSize = sumCodecSizes(fieldCodecs.map(getFixedSize)); | ||
const maxSize = (_a = sumCodecSizes(fieldCodecs.map(getMaxSize))) != null ? _a : void 0; | ||
return createEncoder({ | ||
...fixedSize === null ? { | ||
getSizeFromValue: (value) => fields.map(([key, codec]) => getEncodedSize(value[key], codec)).reduce((all, one) => all + one, 0), | ||
maxSize | ||
} : { fixedSize }, | ||
write: (struct, bytes, offset) => { | ||
fields.forEach(([key, codec]) => { | ||
offset = codec.write(struct[key], bytes, offset); | ||
}); | ||
return offset; | ||
} | ||
}; | ||
}); | ||
} | ||
// ../transactions/dist/index.browser.js | ||
var AccountRole = /* @__PURE__ */ ((AccountRole2) => { | ||
@@ -947,29 +935,16 @@ AccountRole2[AccountRole2["WRITABLE_SIGNER"] = /* 3 */ | ||
} | ||
var lookupTableAddressDescription = "The address of the address lookup table account from which instruction addresses should be looked up" ; | ||
var writableIndicesDescription = "The indices of the accounts in the lookup table that should be loaded as writeable" ; | ||
var readableIndicesDescription = "The indices of the accounts in the lookup table that should be loaded as read-only" ; | ||
var addressTableLookupDescription = "A pointer to the address of an address lookup table, along with the readonly/writeable indices of the addresses that should be loaded from it" ; | ||
var memoizedAddressTableLookupEncoder; | ||
function getAddressTableLookupEncoder() { | ||
if (!memoizedAddressTableLookupEncoder) { | ||
memoizedAddressTableLookupEncoder = getStructEncoder( | ||
memoizedAddressTableLookupEncoder = getStructEncoder([ | ||
["lookupTableAddress", getAddressEncoder()], | ||
[ | ||
["lookupTableAddress", getAddressEncoder({ description: lookupTableAddressDescription })], | ||
[ | ||
"writableIndices", | ||
getArrayEncoder(getU8Encoder(), { | ||
description: writableIndicesDescription, | ||
size: getShortU16Encoder() | ||
}) | ||
], | ||
[ | ||
"readableIndices", | ||
getArrayEncoder(getU8Encoder(), { | ||
description: readableIndicesDescription, | ||
size: getShortU16Encoder() | ||
}) | ||
] | ||
"writableIndices", | ||
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() }) | ||
], | ||
{ description: addressTableLookupDescription } | ||
); | ||
[ | ||
"readableIndices", | ||
getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() }) | ||
] | ||
]); | ||
} | ||
@@ -984,29 +959,9 @@ return memoizedAddressTableLookupEncoder; | ||
} | ||
function getMemoizedU8EncoderDescription(description) { | ||
const encoder = getMemoizedU8Encoder(); | ||
return { | ||
...encoder, | ||
description: description != null ? description : encoder.description | ||
}; | ||
} | ||
var numSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction" ; | ||
var numReadonlySignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction, but may not be writable" ; | ||
var numReadonlyNonSignerAccountsDescription = "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable" ; | ||
var messageHeaderDescription = "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses" ; | ||
function getMessageHeaderEncoder() { | ||
return getStructEncoder( | ||
[ | ||
["numSignerAccounts", getMemoizedU8EncoderDescription(numSignerAccountsDescription)], | ||
["numReadonlySignerAccounts", getMemoizedU8EncoderDescription(numReadonlySignerAccountsDescription)], | ||
["numReadonlyNonSignerAccounts", getMemoizedU8EncoderDescription(numReadonlyNonSignerAccountsDescription)] | ||
], | ||
{ | ||
description: messageHeaderDescription | ||
} | ||
); | ||
return getStructEncoder([ | ||
["numSignerAccounts", getMemoizedU8Encoder()], | ||
["numReadonlySignerAccounts", getMemoizedU8Encoder()], | ||
["numReadonlyNonSignerAccounts", getMemoizedU8Encoder()] | ||
]); | ||
} | ||
var programAddressIndexDescription = "The index of the program being called, according to the well-ordered accounts list for this transaction" ; | ||
var accountIndexDescription = "The index of an account, according to the well-ordered accounts list for this transaction" ; | ||
var accountIndicesDescription = "An optional list of account indices, according to the well-ordered accounts list for this transaction, in the order in which the program being called expects them" ; | ||
var dataDescription = "An optional buffer of data passed to the instruction" ; | ||
var memoizedGetInstructionEncoder; | ||
@@ -1017,11 +972,5 @@ function getInstructionEncoder() { | ||
getStructEncoder([ | ||
["programAddressIndex", getU8Encoder({ description: programAddressIndexDescription })], | ||
[ | ||
"accountIndices", | ||
getArrayEncoder(getU8Encoder({ description: accountIndexDescription }), { | ||
description: accountIndicesDescription, | ||
size: getShortU16Encoder() | ||
}) | ||
], | ||
["data", getBytesEncoder({ description: dataDescription, size: getShortU16Encoder() })] | ||
["programAddressIndex", getU8Encoder()], | ||
["accountIndices", getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })], | ||
["data", getBytesEncoder({ size: getShortU16Encoder() })] | ||
]), | ||
@@ -1045,26 +994,18 @@ // Convert an instruction to have all fields defined | ||
var VERSION_FLAG_MASK = 128; | ||
var BASE_CONFIG = { | ||
description: "A single byte that encodes the version of the transaction" , | ||
fixedSize: null, | ||
maxSize: 1 | ||
}; | ||
function encode(value) { | ||
if (value === "legacy") { | ||
return new Uint8Array(); | ||
} | ||
if (value < 0 || value > 127) { | ||
throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`); | ||
} | ||
return new Uint8Array([value | VERSION_FLAG_MASK]); | ||
} | ||
function getTransactionVersionEncoder() { | ||
return { | ||
...BASE_CONFIG, | ||
encode | ||
}; | ||
return createEncoder({ | ||
getSizeFromValue: (value) => value === "legacy" ? 0 : 1, | ||
maxSize: 1, | ||
write: (value, bytes, offset) => { | ||
if (value === "legacy") { | ||
return offset; | ||
} | ||
if (value < 0 || value > 127) { | ||
throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`); | ||
} | ||
bytes.set([value | VERSION_FLAG_MASK], offset); | ||
return offset + 1; | ||
} | ||
}); | ||
} | ||
var staticAccountsDescription = "A compact-array of static account addresses belonging to this transaction" ; | ||
var lifetimeTokenDescription = "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" ; | ||
var instructionsDescription = "A compact-array of instructions belonging to this transaction" ; | ||
var addressTableLookupsDescription = "A compact array of address table lookups belonging to this transaction" ; | ||
function getCompiledMessageLegacyEncoder() { | ||
@@ -1095,46 +1036,27 @@ return getStructEncoder(getPreludeStructEncoderTuple()); | ||
["header", getMessageHeaderEncoder()], | ||
[ | ||
"staticAccounts", | ||
getArrayEncoder(getAddressEncoder(), { | ||
description: staticAccountsDescription, | ||
size: getShortU16Encoder() | ||
}) | ||
], | ||
[ | ||
"lifetimeToken", | ||
getStringEncoder({ | ||
description: lifetimeTokenDescription, | ||
encoding: getBase58Encoder(), | ||
size: 32 | ||
}) | ||
], | ||
[ | ||
"instructions", | ||
getArrayEncoder(getInstructionEncoder(), { | ||
description: instructionsDescription, | ||
size: getShortU16Encoder() | ||
}) | ||
] | ||
["staticAccounts", getArrayEncoder(getAddressEncoder(), { size: getShortU16Encoder() })], | ||
["lifetimeToken", getStringEncoder({ encoding: getBase58Encoder(), size: 32 })], | ||
["instructions", getArrayEncoder(getInstructionEncoder(), { size: getShortU16Encoder() })] | ||
]; | ||
} | ||
function getAddressTableLookupArrayEncoder() { | ||
return getArrayEncoder(getAddressTableLookupEncoder(), { | ||
description: addressTableLookupsDescription, | ||
size: getShortU16Encoder() | ||
}); | ||
return getArrayEncoder(getAddressTableLookupEncoder(), { size: getShortU16Encoder() }); | ||
} | ||
var messageDescription = "The wire format of a Solana transaction message" ; | ||
function getCompiledMessageEncoder() { | ||
return { | ||
description: messageDescription, | ||
encode: (compiledMessage) => { | ||
return createEncoder({ | ||
getSizeFromValue: (compiledMessage) => { | ||
if (compiledMessage.version === "legacy") { | ||
return getCompiledMessageLegacyEncoder().encode(compiledMessage); | ||
return getCompiledMessageLegacyEncoder().getSizeFromValue(compiledMessage); | ||
} else { | ||
return getCompiledMessageVersionedEncoder().encode(compiledMessage); | ||
return getCompiledMessageVersionedEncoder().getSizeFromValue(compiledMessage); | ||
} | ||
}, | ||
fixedSize: null, | ||
maxSize: null | ||
}; | ||
write: (compiledMessage, bytes, offset) => { | ||
if (compiledMessage.version === "legacy") { | ||
return getCompiledMessageLegacyEncoder().write(compiledMessage, bytes, offset); | ||
} else { | ||
return getCompiledMessageVersionedEncoder().write(compiledMessage, bytes, offset); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -1141,0 +1063,0 @@ async function partiallySignTransaction(keyPairs, transaction) { |
@@ -296,3 +296,1 @@ import { isSignerRole } from '@solana/instructions'; | ||
export { addSignersToInstruction, addSignersToTransaction, assertIsKeyPairSigner, assertIsMessageModifyingSigner, assertIsMessagePartialSigner, assertIsMessageSigner, assertIsTransactionModifyingSigner, assertIsTransactionPartialSigner, assertIsTransactionSendingSigner, assertIsTransactionSigner, assertIsTransactionWithSingleSendingSigner, createNoopSigner, createSignableMessage, createSignerFromKeyPair, generateKeyPairSigner, getSignersFromInstruction, getSignersFromTransaction, isKeyPairSigner, isMessageModifyingSigner, isMessagePartialSigner, isMessageSigner, isTransactionModifyingSigner, isTransactionPartialSigner, isTransactionSendingSigner, isTransactionSigner, isTransactionWithSingleSendingSigner, partiallySignTransactionWithSigners, signAndSendTransactionWithSigners, signTransactionWithSigners }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.node.js.map |
@@ -5,37 +5,37 @@ this.globalThis = this.globalThis || {}; | ||
function T(e){let n={};return e.forEach(r=>{if(!n[r.address])n[r.address]=r;else if(n[r.address]!==r)throw new Error(`Multiple distinct signers were identified for address "${r.address}". Please ensure that you are using the same signer instance for each address.`)}),Object.values(n)}function Me(e){var n;return T(((n=e.accounts)!=null?n:[]).flatMap(r=>"signer"in r?r.signer:[]))}function v(e){return T(e.instructions.flatMap(Me))}function oe(e){return e>=2}function ke(e,n){if(!n.accounts||n.accounts.length===0)return n;let r=new Map(T(e).map(t=>[t.address,t]));return Object.freeze({...n,accounts:n.accounts.map(t=>{let i=r.get(t.address);return !oe(t.role)||"signer"in t||!i?t:Object.freeze({...t,signer:i})})})}function tr(e,n){return n.instructions.length===0?n:Object.freeze({...n,instructions:n.instructions.map(r=>ke(e,r))})}function C(e,n,r=0){if(n.length-r<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function w(e,n,r,t=0){let i=r.length-t;if(i<n)throw new Error(`Codec [${e}] expected ${n} bytes, got ${i}.`)}var z=e=>{let n=e.filter(o=>o.length);if(n.length===0)return e.length?e[0]:new Uint8Array;if(n.length===1)return n[0];let r=n.reduce((o,s)=>o+s.length,0),t=new Uint8Array(r),i=0;return n.forEach(o=>{t.set(o,i),i+=o.length;}),t},Pe=(e,n)=>{if(e.length>=n)return e;let r=new Uint8Array(n).fill(0);return r.set(e),r},F=(e,n)=>Pe(e.length<=n?e:e.slice(0,n),n);function se(e,n,r){return {description:r!=null?r:`fixed(${n}, ${e.description})`,fixedSize:n,maxSize:n}}function P(e,n,r){return {...se(e,n,r),encode:t=>F(e.encode(t),n)}}function j(e,n,r){return {...se(e,n,r),decode:(t,i=0)=>{w("fixCodec",n,t,i),(i>0||t.length>n)&&(t=t.slice(i,i+n)),e.fixedSize!==null&&(t=F(t,e.fixedSize));let[o]=e.decode(t,0);return [o,i+n]}}}function B(e,n){return {description:e.description,encode:r=>e.encode(n(r)),fixedSize:e.fixedSize,maxSize:e.maxSize}}function ae(e,n,r,t){if(t<n||t>r)throw new Error(`Codec [${e}] expected number to be in the range [${n}, ${r}], got ${t}.`)}function ce(e){var t;let n,r=e.name;return e.size>1&&(n=!("endian"in e.config)||e.config.endian===0,r+=n?"(le)":"(be)"),{description:(t=e.config.description)!=null?t:r,fixedSize:e.size,littleEndian:n,maxSize:e.size}}function de(e){let n=ce(e);return {description:n.description,encode(r){e.range&&ae(e.name,e.range[0],e.range[1],r);let t=new ArrayBuffer(e.size);return e.set(new DataView(t),r,n.littleEndian),new Uint8Array(t)},fixedSize:n.fixedSize,maxSize:n.maxSize}}function Ne(e){let n=ce(e);return {decode(r,t=0){C(n.description,r,t),w(n.description,e.size,r,t);let i=new DataView(Re(r,t,e.size));return [e.get(i,n.littleEndian),t+e.size]},description:n.description,fixedSize:n.fixedSize,maxSize:n.maxSize}}function Re(e,n,r){let t=e.byteOffset+(n!=null?n:0),i=r!=null?r:e.byteLength;return e.buffer.slice(t,t+i)}var h=(e={})=>{var n;return {description:(n=e.description)!=null?n:"shortU16",encode:r=>{ae("shortU16",0,65535,r);let t=[0];for(let i=0;;i+=1){let o=r>>i*7;if(o===0)break;let s=127&o;t[i]=s,i>0&&(t[i-1]|=128);}return new Uint8Array(t)},fixedSize:null,maxSize:3}};var R=(e={})=>de({config:e,name:"u32",range:[0,+"0xffffffff"],set:(n,r,t)=>n.setUint32(0,r,t),size:4}),K=(e={})=>Ne({config:e,get:(n,r)=>n.getUint32(0,r),name:"u32",size:4});var y=(e={})=>de({config:e,name:"u8",range:[0,+"0xff"],set:(n,r)=>n.setUint8(0,r),size:1});function $e(e,n,r=n){if(!n.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${r}].`)}var Ue=e=>{let n=e.length,r=BigInt(n);return {description:`base${n}`,encode(t){if($e(e,t),t==="")return new Uint8Array;let i=[...t],o=i.findIndex(p=>p!==e[0]);o=o===-1?i.length:o;let s=Array(o).fill(0);if(o===i.length)return Uint8Array.from(s);let a=i.slice(o),c=0n,d=1n;for(let p=a.length-1;p>=0;p-=1)c+=d*BigInt(e.indexOf(a[p])),d*=r;let g=[];for(;c>0n;)g.unshift(Number(c%256n)),c/=256n;return Uint8Array.from(s.concat(g))},fixedSize:null,maxSize:null}},Oe=e=>{let n=e.length,r=BigInt(n);return {decode(t,i=0){let o=i===0?t:t.slice(i);if(o.length===0)return ["",0];let s=o.findIndex(g=>g!==0);s=s===-1?o.length:s;let a=e[0].repeat(s);if(s===o.length)return [a,t.length];let c=o.slice(s).reduce((g,p)=>g*256n+BigInt(p),0n),d=[];for(;c>0n;)d.unshift(e[Number(c%r)]),c/=r;return [a+d.join(""),t.length]},description:`base${n}`,fixedSize:null,maxSize:null}};var ue="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",$=()=>Ue(ue),V=()=>Oe(ue);var We=e=>e.replace(/\u0000/g,"");var Le=globalThis.TextDecoder,_e=globalThis.TextEncoder,Fe=()=>{let e;return {description:"utf8",encode:n=>new Uint8Array((e||(e=new _e)).encode(n)),fixedSize:null,maxSize:null}},je=()=>{let e;return {decode(n,r=0){let t=(e||(e=new Le)).decode(n.slice(r));return [We(t),n.length]},description:"utf8",fixedSize:null,maxSize:null}};var U=(e={})=>{var i,o,s;let n=(i=e.size)!=null?i:R(),r=(o=e.encoding)!=null?o:Fe(),t=(s=e.description)!=null?s:`string(${r.description}; ${ge(n)})`;return n==="variable"?{...r,description:t}:typeof n=="number"?P(r,n,t):{description:t,encode:a=>{let c=r.encode(a),d=n.encode(c.length);return z([d,c])},fixedSize:null,maxSize:null}},G=(e={})=>{var i,o,s;let n=(i=e.size)!=null?i:K(),r=(o=e.encoding)!=null?o:je(),t=(s=e.description)!=null?s:`string(${r.description}; ${ge(n)})`;return n==="variable"?{...r,description:t}:typeof n=="number"?j(r,n,t):{decode:(a,c=0)=>{C("string",a,c);let[d,g]=n.decode(a,c),p=Number(d);c=g;let ie=a.slice(c,c+p);w("string",p,ie);let[Be,De]=r.decode(ie);return c+=De,[Be,c]},description:t,fixedSize:null,maxSize:null}};function ge(e){return typeof e=="object"?e.description:`${e}`}function H(){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")}var x;async function Ke(e){return x===void 0&&(x=new Promise(n=>{e.generateKey("Ed25519",!1,["sign","verify"]).catch(()=>{n(x=!1);}).then(()=>{n(x=!0);});})),typeof x=="boolean"?x:await x}async function fe(){var e;if(H(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.generateKey)!="function")throw new Error("No key generation implementation could be found");if(!await Ke(globalThis.crypto.subtle))throw new Error(`This runtime does not support the generation of Ed25519 key pairs. | ||
function y(e){let n={};return e.forEach(r=>{if(!n[r.address])n[r.address]=r;else if(n[r.address]!==r)throw new Error(`Multiple distinct signers were identified for address "${r.address}". Please ensure that you are using the same signer instance for each address.`)}),Object.values(n)}function Oe(e){var n;return y(((n=e.accounts)!=null?n:[]).flatMap(r=>"signer"in r?r.signer:[]))}function B(e){return y(e.instructions.flatMap(Oe))}function ie(e){return e>=2}function We(e,n){if(!n.accounts||n.accounts.length===0)return n;let r=new Map(y(e).map(t=>[t.address,t]));return Object.freeze({...n,accounts:n.accounts.map(t=>{let i=r.get(t.address);return !ie(t.role)||"signer"in t||!i?t:Object.freeze({...t,signer:i})})})}function Fn(e,n){return n.instructions.length===0?n:Object.freeze({...n,instructions:n.instructions.map(r=>We(e,r))})}function M(e,n,r=0){if(n.length-r<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function E(e,n,r,t=0){let i=r.length-t;if(i<n)throw new Error(`Codec [${e}] expected ${n} bytes, got ${i}.`)}var Ue=(e,n)=>{if(e.length>=n)return e;let r=new Uint8Array(n).fill(0);return r.set(e),r},Fe=(e,n)=>Ue(e.length<=n?e:e.slice(0,n),n);function S(e,n){return "fixedSize"in n?n.fixedSize:n.getSizeFromValue(e)}function l(e){return Object.freeze({...e,encode:n=>{let r=new Uint8Array(S(n,e));return e.write(n,r,0),r}})}function p(e){return Object.freeze({...e,decode:(n,r=0)=>e.read(n,r)[0]})}function I(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function se(e,n){if(!I(e))throw new Error(n!=null?n:"Expected a fixed-size codec, got a variable-size one.")}function Le(e){return !I(e)}function N(e,n){return l({fixedSize:n,write:(r,t,i)=>{let o=e.encode(r),s=o.length>n?o.slice(0,n):o;return t.set(s,i),i+n}})}function V(e,n){return p({fixedSize:n,read:(r,t)=>{E("fixCodec",n,r,t),(t>0||r.length>n)&&(r=r.slice(t,t+n)),I(e)&&(r=Fe(r,e.fixedSize));let[i]=e.read(r,0);return [i,t+n]}})}function z(e,n){return l({...Le(e)?{...e,getSizeFromValue:r=>e.getSizeFromValue(n(r))}:e,write:(r,t,i)=>e.write(n(r),t,i)})}function oe(e,n,r,t){if(t<n||t>r)throw new Error(`Codec [${e}] expected number to be in the range [${n}, ${r}], got ${t}.`)}function ae(e){return (e==null?void 0:e.endian)!==1}function ce(e){return l({fixedSize:e.size,write(n,r,t){e.range&&oe(e.name,e.range[0],e.range[1],n);let i=new ArrayBuffer(e.size);return e.set(new DataView(i),n,ae(e.config)),r.set(new Uint8Array(i),t),t+e.size}})}function _e(e){return p({fixedSize:e.size,read(n,r=0){M(e.name,n,r),E(e.name,e.size,n,r);let t=new DataView($e(n,r,e.size));return [e.get(t,ae(e.config)),r+e.size]}})}function $e(e,n,r){let t=e.byteOffset+(n!=null?n:0),i=r!=null?r:e.byteLength;return e.buffer.slice(t,t+i)}var h=()=>l({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,n,r)=>{oe("shortU16",0,65535,e);let t=[0];for(let i=0;;i+=1){let o=e>>i*7;if(o===0)break;let s=127&o;t[i]=s,i>0&&(t[i-1]|=128);}return n.set(t,r),r+t.length}});var O=(e={})=>ce({config:e,name:"u32",range:[0,+"0xffffffff"],set:(n,r,t)=>n.setUint32(0,r,t),size:4}),K=(e={})=>_e({config:e,get:(n,r)=>n.getUint32(0,r),name:"u32",size:4});var A=()=>ce({name:"u8",range:[0,+"0xff"],set:(e,n)=>e.setUint8(0,n),size:1});function Ve(e,n,r=n){if(!n.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${r}].`)}var Ke=e=>l({getSizeFromValue:n=>{let[r,t]=de(n,e[0]);if(t==="")return n.length;let i=ge(t,e);return r.length+Math.ceil(i.toString(16).length/2)},write(n,r,t){if(Ve(e,n),n==="")return t;let[i,o]=de(n,e[0]);if(o==="")return r.set(new Uint8Array(i.length).fill(0),t),t+i.length;let s=ge(o,e),a=[];for(;s>0n;)a.unshift(Number(s%256n)),s/=256n;let c=[...Array(i.length).fill(0),...a];return r.set(c,t),t+c.length}}),je=e=>p({read(n,r){let t=r===0?n:n.slice(r);if(t.length===0)return ["",0];let i=t.findIndex(c=>c!==0);i=i===-1?t.length:i;let o=e[0].repeat(i);if(i===t.length)return [o,n.length];let s=t.slice(i).reduce((c,d)=>c*256n+BigInt(d),0n),a=Ge(s,e);return [o+a,n.length]}});function de(e,n){let r=[...e].findIndex(t=>t!==n);return r===-1?[e,""]:[e.slice(0,r),e.slice(r)]}function ge(e,n){let r=BigInt(n.length);return [...e].reduce((t,i)=>t*r+BigInt(n.indexOf(i)),0n)}function Ge(e,n){let r=BigInt(n.length),t=[];for(;e>0n;)t.unshift(n[Number(e%r)]),e/=r;return t.join("")}var fe="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",W=()=>Ke(fe),j=()=>je(fe);var Ye=e=>e.replace(/\u0000/g,"");var He=globalThis.TextDecoder,ue=globalThis.TextEncoder,Xe=()=>{let e;return l({getSizeFromValue:n=>(e||(e=new ue)).encode(n).length,write:(n,r,t)=>{let i=(e||(e=new ue)).encode(n);return r.set(i,t),t+i.length}})},Ze=()=>{let e;return p({read(n,r){let t=(e||(e=new He)).decode(n.slice(r));return [Ye(t),n.length]}})};function U(e={}){var t,i;let n=(t=e.size)!=null?t:O(),r=(i=e.encoding)!=null?i:Xe();return n==="variable"?r:typeof n=="number"?N(r,n):l({getSizeFromValue:o=>{let s=S(o,r);return S(s,n)+s},write:(o,s,a)=>{let c=S(o,r);return a=n.write(c,s,a),r.write(o,s,a)}})}function G(e={}){var t,i;let n=(t=e.size)!=null?t:K(),r=(i=e.encoding)!=null?i:Ze();return n==="variable"?r:typeof n=="number"?V(r,n):p({read:(o,s=0)=>{M("string",o,s);let[a,c]=n.read(o,s),d=Number(a);s=c;let f=o.slice(s,s+d);E("string",d,f);let[te,Re]=r.read(f,0);return s+=Re,[te,s]}})}function Y(){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")}var b;async function qe(e){return b===void 0&&(b=new Promise(n=>{e.generateKey("Ed25519",!1,["sign","verify"]).catch(()=>{n(b=!1);}).then(()=>{n(b=!0);});})),typeof b=="boolean"?b:await b}async function le(){var e;if(Y(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.generateKey)!="function")throw new Error("No key generation implementation could be found");if(!await qe(globalThis.crypto.subtle))throw new Error(`This runtime does not support the generation of Ed25519 key pairs. | ||
Install and import \`@solana/webcrypto-ed25519-polyfill\` before generating keys in environments that do not support Ed25519. | ||
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20`)}async function le(){var e;if(H(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.exportKey)!="function")throw new Error("No key export implementation could be found")}async function me(){var e;if(H(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.sign)!="function")throw new Error("No signing implementation could be found")}var Y,X;function q(){return Y||(Y=$()),Y}function Ve(){return X||(X=V()),X}function pe(e){return !(e.length<32||e.length>44||q().encode(e).byteLength!==32)}function Se(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=q().encode(e).byteLength;if(t!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${t}`)}catch(n){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:n})}}function Ge(e){return Se(e),e}function Z(e){var n;return B(U({description:(n=e==null?void 0:e.description)!=null?n:"Address",encoding:q(),size:32}),r=>Ge(r))}function Te(e){var n;return G({description:(n=e==null?void 0:e.description)!=null?n:"Address",encoding:Ve(),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 W(e){if(await le(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let n=await crypto.subtle.exportKey("raw",e),[r]=Te().decode(new Uint8Array(n));return r}async function he(){return await fe(),await crypto.subtle.generateKey("Ed25519",!1,["sign","verify"])}async function L(e,n){await me();let r=await crypto.subtle.sign("Ed25519",e,n);return new Uint8Array(r)}function J(e){return e.reduce((n,r)=>n===null||r===null?null:n+r,0)}function Ye(e){return typeof e=="object"?e.description:`${e}`}function ye(e,n){if(typeof e!="number")return null;if(e===0)return 0;let r=J(n);return r===null?null:r*e}function Xe(e,n){return typeof e=="object"?e.encode(n):new Uint8Array}function qe(e,n,r){if(n!==r)throw new Error(`Expected [${e}] to have ${n} items, got ${r}.`)}function Ze(e,n,r){if(n==="remainder"&&e.fixedSize===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');return {description:r!=null?r:`array(${e.description}; ${Ye(n)})`,fixedSize:ye(n,[e.fixedSize]),maxSize:ye(n,[e.maxSize])}}function A(e,n={}){var t;let r=(t=n.size)!=null?t:R();return {...Ze(e,r,n.description),encode:i=>(typeof r=="number"&&qe("array",r,i.length),z([Xe(r,i.length),...i.map(o=>e.encode(o))]))}}function xe(e={}){var o,s;let n=(o=e.size)!=null?o:"variable",r=typeof n=="object"?n.description:`${n}`,t=(s=e.description)!=null?s:`bytes(${r})`,i={description:t,encode:a=>a,fixedSize:null,maxSize:null};return n==="variable"?i:typeof n=="number"?P(i,n,t):{...i,encode:a=>{let c=i.encode(a),d=n.encode(c.length);return z([d,c])}}}function Je(e,n){let r=e.map(([t,i])=>`${String(t)}: ${i.description}`).join(", ");return {description:n!=null?n:`struct(${r})`,fixedSize:J(e.map(([,t])=>t.fixedSize)),maxSize:J(e.map(([,t])=>t.maxSize))}}function E(e,n={}){return {...Je(e,n.description),encode:r=>{let t=e.map(([i,o])=>o.encode(r[i]));return z(t)}}}var D=(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))(D||{}),Qe=1;function I(e){return e>=2}function M(e){return (e&Qe)!==0}function Ae(e,n){return e|n}function be(e,n,r){var t;e[n]=r((t=e[n])!=null?t:{role:D.READONLY});}var f=Symbol("AddressMapTypeProperty");function en(e,n){let r={[e]:{[f]:0,role:D.WRITABLE_SIGNER}},t=new Set;for(let i of n){be(r,i.programAddress,s=>{if(t.add(i.programAddress),f in s){if(M(s.role))switch(s[f]){case 0:throw new Error(`This transaction includes an address (\`${i.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 (\`${i.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(s[f]===2)return s}return {[f]:2,role:D.READONLY}});let o;if(i.accounts)for(let s of i.accounts)be(r,s.address,a=>{let{address:c,...d}=s;if(f in a)switch(a[f]){case 0:return a;case 1:{let g=Ae(a.role,d.role);if("lookupTableAddress"in d){if(a.lookupTableAddress!==d.lookupTableAddress&&(o||(o=O()))(d.lookupTableAddress,a.lookupTableAddress)<0)return {[f]:1,...d,role:g}}else if(I(d.role))return {[f]:2,role:g};return a.role!==g?{...a,role:g}:a}case 2:{let g=Ae(a.role,d.role);if(t.has(s.address)){if(M(d.role))throw new Error(`This transaction includes an address (\`${s.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`);return a.role!==g?{...a,role:g}:a}else return "lookupTableAddress"in d&&!I(a.role)?{...d,[f]:1,role:g}:a.role!==g?{...a,role:g}:a}}return "lookupTableAddress"in d?{...d,[f]:1}:{...d,[f]:2}});}return r}function nn(e){let n;return Object.entries(e).sort(([t,i],[o,s])=>{if(i[f]!==s[f]){if(i[f]===0)return -1;if(s[f]===0)return 1;if(i[f]===2)return -1;if(s[f]===2)return 1}let a=I(i.role);if(a!==I(s.role))return a?-1:1;let c=M(i.role);return c!==M(s.role)?c?-1:1:(n||(n=O()),i[f]===1&&s[f]===1&&i.lookupTableAddress!==s.lookupTableAddress?n(i.lookupTableAddress,s.lookupTableAddress):n(t,o))}).map(([t,i])=>({address:t,...i}))}function rn(e){var r;let n={};for(let t of e){if(!("lookupTableAddress"in t))continue;let i=n[r=t.lookupTableAddress]||(n[r]={readableIndices:[],writableIndices:[]});t.role===D.WRITABLE?i.writableIndices.push(t.addressIndex):i.readableIndices.push(t.addressIndex);}return Object.keys(n).sort(O()).map(t=>({lookupTableAddress:t,...n[t]}))}function tn(e){let n=0,r=0,t=0;for(let i of e){if("lookupTableAddress"in i)break;let o=M(i.role);I(i.role)?(t++,o||r++):o||n++;}return {numReadonlyNonSignerAccounts:n,numReadonlySignerAccounts:r,numSignerAccounts:t}}function on(e){let n={};for(let[r,t]of e.entries())n[t.address]=r;return n}function sn(e,n){let r=on(n);return e.map(({accounts:t,data:i,programAddress:o})=>({programAddressIndex:r[o],...t?{accountIndices:t.map(({address:s})=>r[s])}:null,...i?{data:i}:null}))}function an(e){return "nonce"in e?e.nonce:e.blockhash}function cn(e){let n=e.findIndex(t=>"lookupTableAddress"in t);return (n===-1?e:e.slice(0,n)).map(({address:t})=>t)}function dn(e){let n=en(e.feePayer,e.instructions),r=nn(n);return {...e.version!=="legacy"?{addressTableLookups:rn(r)}:null,header:tn(r),instructions:sn(e.instructions,r),lifetimeToken:an(e.lifetimeConstraint),staticAccounts:cn(r),version:e.version}}var un="lookupTableAddress",gn="writableIndices",fn="readableIndices",ln="addressTableLookup",Q;function mn(){return Q||(Q=E([["lookupTableAddress",Z({description:un})],["writableIndices",A(y(),{description:gn,size:h()})],["readableIndices",A(y(),{description:fn,size:h()})]],{description:ln})),Q}var ee;function pn(){return ee||(ee=y()),ee}function ne(e){let n=pn();return {...n,description:e!=null?e:n.description}}var Sn=void 0,Tn=void 0,hn=void 0,yn=void 0;function xn(){return E([["numSignerAccounts",ne(Sn)],["numReadonlySignerAccounts",ne(Tn)],["numReadonlyNonSignerAccounts",ne(hn)]],{description:yn})}var An="programAddressIndex",bn=void 0,wn="accountIndices",zn="data",re;function En(){return re||(re=B(E([["programAddressIndex",y({description:An})],["accountIndices",A(y({description:bn}),{description:wn,size:h()})],["data",xe({description:zn,size:h()})]]),e=>{var n,r;return e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:(n=e.accountIndices)!=null?n:[],data:(r=e.data)!=null?r:new Uint8Array(0)}})),re}var In=128,vn={description:"",fixedSize:null,maxSize:1};function Cn(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|In])}function Bn(){return {...vn,encode:Cn}}var Dn="staticAccounts",Mn="lifetimeToken",kn="instructions",Pn="addressTableLookups";function Nn(){return E(we())}function Rn(){return B(E([...we(),["addressTableLookups",$n()]]),e=>{var n;return e.version==="legacy"?e:{...e,addressTableLookups:(n=e.addressTableLookups)!=null?n:[]}})}function we(){return [["version",Bn()],["header",xn()],["staticAccounts",A(Z(),{description:Dn,size:h()})],["lifetimeToken",U({description:Mn,encoding:$(),size:32})],["instructions",A(En(),{description:kn,size:h()})]]}function $n(){return A(mn(),{description:Pn,size:h()})}var Un="message";function On(){return {description:Un,encode:e=>e.version==="legacy"?Nn().encode(e):Rn().encode(e),fixedSize:null,maxSize:null}}async function ze(e,n){let r=dn(n),t="signatures"in n?{...n.signatures}:{},i=On().encode(r),o=await Promise.all(e.map(a=>Promise.all([W(a.publicKey),L(a.privateKey,i)])));for(let[a,c]of o)t[a]=c;let s={...n,signatures:t};return Object.freeze(s),s}function Ee(e){let n=e.instructions.flatMap(t=>{var i,o;return (o=(i=t.accounts)==null?void 0:i.filter(s=>I(s.role)))!=null?o:[]}).map(t=>t.address);new Set([e.feePayer,...n]).forEach(t=>{if(!e.signatures[t])throw new Error(`Transaction is missing signature for address \`${t}\``)});}function k(e){return "signMessages"in e&&typeof e.signMessages=="function"}function Gr(e){if(!k(e))throw new Error("The provided value does not implement the MessagePartialSigner interface")}function m(e){return "signTransactions"in e&&typeof e.signTransactions=="function"}function Xr(e){if(!m(e))throw new Error("The provided value does not implement the TransactionPartialSigner interface")}function Wn(e){return "keyPair"in e&&typeof e.keyPair=="object"&&k(e)&&m(e)}function st(e){if(!Wn(e))throw new Error("The provided value does not implement the KeyPairSigner interface")}async function Ln(e){let n=await W(e.publicKey);return Object.freeze({address:n,keyPair:e,signMessages:t=>Promise.all(t.map(async i=>Object.freeze({[n]:await L(e.privateKey,i.content)}))),signTransactions:t=>Promise.all(t.map(async i=>{let o=await ze([e],i);return Object.freeze({[n]:o.signatures[n]})}))})}async function at(){return Ln(await he())}function te(e){return pe(e.address)&&"modifyAndSignMessages"in e&&typeof e.modifyAndSignMessages=="function"}function ft(e){if(!te(e))throw new Error("The provided value does not implement the MessageModifyingSigner interface")}function _n(e){return k(e)||te(e)}function yt(e){if(!_n(e))throw new Error("The provided value does not implement any of the MessageSigner interfaces")}function bt(e){return Object.freeze({address:e,signMessages:async r=>r.map(()=>Object.freeze({})),signTransactions:async r=>r.map(()=>Object.freeze({}))})}function S(e){return "modifyAndSignTransactions"in e&&typeof e.modifyAndSignTransactions=="function"}function Et(e){if(!S(e))throw new Error("The provided value does not implement the TransactionModifyingSigner interface")}function b(e){return "signAndSendTransactions"in e&&typeof e.signAndSendTransactions=="function"}function Ct(e){if(!b(e))throw new Error("The provided value does not implement the TransactionSendingSigner interface")}function _(e){return m(e)||S(e)||b(e)}function Ut(e){if(!_(e))throw new Error("The provided value does not implement any of the TransactionSigner interfaces")}async function Fn(e,n={}){let{partialSigners:r,modifyingSigners:t}=Ie(T(v(e).filter(_)),{identifySendingSigner:!1});return ve(e,t,r,n.abortSignal)}async function ni(e,n={}){let r=await Fn(e,n);return Ee(r),r}async function ri(e,n={}){let r=n.abortSignal,{partialSigners:t,modifyingSigners:i,sendingSigner:o}=Ie(T(v(e).filter(_)));r==null||r.throwIfAborted();let s=await ve(e,i,t,r);if(!o)throw new Error("No `TransactionSendingSigner` was identified. Please provide a valid `ITransactionWithSingleSendingSigner` transaction.");r==null||r.throwIfAborted();let[a]=await o.signAndSendTransactions([s],{abortSignal:r});return r==null||r.throwIfAborted(),a}function Ie(e,n={}){var a;let t=((a=n.identifySendingSigner)!=null?a:!0)?jn(e):null,i=e.filter(c=>c!==t&&(S(c)||m(c))),o=Kn(i),s=i.filter(m).filter(c=>!o.includes(c));return Object.freeze({modifyingSigners:o,partialSigners:s,sendingSigner:t})}function jn(e){let n=e.filter(b);if(n.length===0)return null;let r=n.filter(t=>!S(t)&&!m(t));return r.length>0?r[0]:n[0]}function Kn(e){let n=e.filter(S);if(n.length===0)return [];let r=n.filter(t=>!m(t));return r.length>0?r:[n[0]]}async function ve(e,n=[],r=[],t){var a;let i=await n.reduce(async(c,d)=>{t==null||t.throwIfAborted();let[g]=await d.modifyAndSignTransactions([await c],{abortSignal:t});return Object.freeze(g)},Promise.resolve(e));t==null||t.throwIfAborted();let o=await Promise.all(r.map(async c=>{let[d]=await c.signTransactions([i],{abortSignal:t});return d})),s={...i,signatures:Object.freeze(o.reduce((c,d)=>({...c,...d}),(a=i.signatures)!=null?a:{}))};return Object.freeze(s)}var Ce=globalThis.TextEncoder;function di(e,n={}){return Object.freeze({content:typeof e=="string"?new Ce().encode(e):e,signatures:Object.freeze({...n})})}function Ti(e){try{return Vn(e),!0}catch{return !1}}function Vn(e){let r=v(e).filter(b);if(r.length===0){let i=new Error("No `TransactionSendingSigner` was identified.");throw i.name="MissingTransactionSendingSignerError",i}if(r.filter(i=>!m(i)&&!S(i)).length>1){let i=new Error("More than one `TransactionSendingSigner` was identified.");throw i.name="MultipleTransactionSendingSignersError",i}} | ||
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20`)}async function me(){var e;if(Y(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.exportKey)!="function")throw new Error("No key export implementation could be found")}async function Se(){var e;if(Y(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.sign)!="function")throw new Error("No signing implementation could be found")}var H,X;function Z(){return H||(H=W()),H}function Je(){return X||(X=j()),X}function pe(e){return !(e.length<32||e.length>44||Z().encode(e).byteLength!==32)}function Te(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=Z().encode(e).byteLength;if(t!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${t}`)}catch(n){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:n})}}function Qe(e){return Te(e),e}function q(){return z(U({encoding:Z(),size:32}),e=>Qe(e))}function ye(){return G({encoding:Je(),size:32})}function F(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}async function L(e){if(await me(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let n=await crypto.subtle.exportKey("raw",e);return ye().decode(new Uint8Array(n))}async function he(){return await le(),await crypto.subtle.generateKey("Ed25519",!1,["sign","verify"])}async function _(e,n){await Se();let r=await crypto.subtle.sign("Ed25519",e,n);return new Uint8Array(r)}function rn(e,n,r){if(n!==r)throw new Error(`Expected [${e}] to have ${n} items, got ${r}.`)}function Ae(e){return e.reduce((n,r)=>n===null||r===null?null:n+r,0)}function we(e){return I(e)?e.fixedSize:null}function xe(e){var n;return I(e)?e.fixedSize:(n=e.maxSize)!=null?n:null}function w(e,n={}){var o,s;let r=(o=n.size)!=null?o:O();r==="remainder"&&se(e,'Codecs of "remainder" size must have fixed-size items.');let t=be(r,we(e)),i=(s=be(r,xe(e)))!=null?s:void 0;return l({...t!==null?{fixedSize:t}:{getSizeFromValue:a=>(typeof r=="object"?S(a.length,r):0)+[...a].reduce((d,f)=>d+S(f,e),0),maxSize:i},write:(a,c,d)=>(typeof r=="number"&&rn("array",r,a.length),typeof r=="object"&&(d=r.write(a.length,c,d)),a.forEach(f=>{d=e.write(f,c,d);}),d)})}function be(e,n){return typeof e!="number"?null:e===0?0:n===null?null:n*e}function Ee(e={}){var t;let n=(t=e.size)!=null?t:"variable",r=l({getSizeFromValue:i=>i.length,write:(i,o,s)=>(o.set(i,s),s+i.length)});return n==="variable"?r:typeof n=="number"?N(r,n):l({getSizeFromValue:i=>S(i.length,n)+i.length,write:(i,o,s)=>(s=n.write(i.length,o,s),r.write(i,o,s))})}function v(e){var i;let n=e.map(([,o])=>o),r=Ae(n.map(we)),t=(i=Ae(n.map(xe)))!=null?i:void 0;return l({...r===null?{getSizeFromValue:o=>e.map(([s,a])=>S(o[s],a)).reduce((s,a)=>s+a,0),maxSize:t}:{fixedSize:r},write:(o,s,a)=>(e.forEach(([c,d])=>{a=d.write(o[c],s,a);}),a)})}var D=(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))(D||{}),tn=1;function C(e){return e>=2}function P(e){return (e&tn)!==0}function Ie(e,n){return e|n}function ze(e,n,r){var t;e[n]=r((t=e[n])!=null?t:{role:D.READONLY});}var u=Symbol("AddressMapTypeProperty");function sn(e,n){let r={[e]:{[u]:0,role:D.WRITABLE_SIGNER}},t=new Set;for(let i of n){ze(r,i.programAddress,s=>{if(t.add(i.programAddress),u in s){if(P(s.role))switch(s[u]){case 0:throw new Error(`This transaction includes an address (\`${i.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 (\`${i.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(s[u]===2)return s}return {[u]:2,role:D.READONLY}});let o;if(i.accounts)for(let s of i.accounts)ze(r,s.address,a=>{let{address:c,...d}=s;if(u in a)switch(a[u]){case 0:return a;case 1:{let f=Ie(a.role,d.role);if("lookupTableAddress"in d){if(a.lookupTableAddress!==d.lookupTableAddress&&(o||(o=F()))(d.lookupTableAddress,a.lookupTableAddress)<0)return {[u]:1,...d,role:f}}else if(C(d.role))return {[u]:2,role:f};return a.role!==f?{...a,role:f}:a}case 2:{let f=Ie(a.role,d.role);if(t.has(s.address)){if(P(d.role))throw new Error(`This transaction includes an address (\`${s.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`);return a.role!==f?{...a,role:f}:a}else return "lookupTableAddress"in d&&!C(a.role)?{...d,[u]:1,role:f}:a.role!==f?{...a,role:f}:a}}return "lookupTableAddress"in d?{...d,[u]:1}:{...d,[u]:2}});}return r}function on(e){let n;return Object.entries(e).sort(([t,i],[o,s])=>{if(i[u]!==s[u]){if(i[u]===0)return -1;if(s[u]===0)return 1;if(i[u]===2)return -1;if(s[u]===2)return 1}let a=C(i.role);if(a!==C(s.role))return a?-1:1;let c=P(i.role);return c!==P(s.role)?c?-1:1:(n||(n=F()),i[u]===1&&s[u]===1&&i.lookupTableAddress!==s.lookupTableAddress?n(i.lookupTableAddress,s.lookupTableAddress):n(t,o))}).map(([t,i])=>({address:t,...i}))}function an(e){var r;let n={};for(let t of e){if(!("lookupTableAddress"in t))continue;let i=n[r=t.lookupTableAddress]||(n[r]={readableIndices:[],writableIndices:[]});t.role===D.WRITABLE?i.writableIndices.push(t.addressIndex):i.readableIndices.push(t.addressIndex);}return Object.keys(n).sort(F()).map(t=>({lookupTableAddress:t,...n[t]}))}function cn(e){let n=0,r=0,t=0;for(let i of e){if("lookupTableAddress"in i)break;let o=P(i.role);C(i.role)?(t++,o||r++):o||n++;}return {numReadonlyNonSignerAccounts:n,numReadonlySignerAccounts:r,numSignerAccounts:t}}function dn(e){let n={};for(let[r,t]of e.entries())n[t.address]=r;return n}function gn(e,n){let r=dn(n);return e.map(({accounts:t,data:i,programAddress:o})=>({programAddressIndex:r[o],...t?{accountIndices:t.map(({address:s})=>r[s])}:null,...i?{data:i}:null}))}function un(e){return "nonce"in e?e.nonce:e.blockhash}function fn(e){let n=e.findIndex(t=>"lookupTableAddress"in t);return (n===-1?e:e.slice(0,n)).map(({address:t})=>t)}function ln(e){let n=sn(e.feePayer,e.instructions),r=on(n);return {...e.version!=="legacy"?{addressTableLookups:an(r)}:null,header:cn(r),instructions:gn(e.instructions,r),lifetimeToken:un(e.lifetimeConstraint),staticAccounts:fn(r),version:e.version}}var J;function mn(){return J||(J=v([["lookupTableAddress",q()],["writableIndices",w(A(),{size:h()})],["readableIndices",w(A(),{size:h()})]])),J}var Q;function ee(){return Q||(Q=A()),Q}function Sn(){return v([["numSignerAccounts",ee()],["numReadonlySignerAccounts",ee()],["numReadonlyNonSignerAccounts",ee()]])}var ne;function pn(){return ne||(ne=z(v([["programAddressIndex",A()],["accountIndices",w(A(),{size:h()})],["data",Ee({size:h()})]]),e=>{var n,r;return e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:(n=e.accountIndices)!=null?n:[],data:(r=e.data)!=null?r:new Uint8Array(0)}})),ne}var Tn=128;function yn(){return l({getSizeFromValue:e=>e==="legacy"?0:1,maxSize:1,write:(e,n,r)=>{if(e==="legacy")return r;if(e<0||e>127)throw new Error(`Transaction version must be in the range [0, 127]. \`${e}\` given.`);return n.set([e|Tn],r),r+1}})}function ve(){return v(Be())}function Ce(){return z(v([...Be(),["addressTableLookups",hn()]]),e=>{var n;return e.version==="legacy"?e:{...e,addressTableLookups:(n=e.addressTableLookups)!=null?n:[]}})}function Be(){return [["version",yn()],["header",Sn()],["staticAccounts",w(q(),{size:h()})],["lifetimeToken",U({encoding:W(),size:32})],["instructions",w(pn(),{size:h()})]]}function hn(){return w(mn(),{size:h()})}function An(){return l({getSizeFromValue:e=>e.version==="legacy"?ve().getSizeFromValue(e):Ce().getSizeFromValue(e),write:(e,n,r)=>e.version==="legacy"?ve().write(e,n,r):Ce().write(e,n,r)})}async function Me(e,n){let r=ln(n),t="signatures"in n?{...n.signatures}:{},i=An().encode(r),o=await Promise.all(e.map(a=>Promise.all([L(a.publicKey),_(a.privateKey,i)])));for(let[a,c]of o)t[a]=c;let s={...n,signatures:t};return Object.freeze(s),s}function De(e){let n=e.instructions.flatMap(t=>{var i,o;return (o=(i=t.accounts)==null?void 0:i.filter(s=>C(s.role)))!=null?o:[]}).map(t=>t.address);new Set([e.feePayer,...n]).forEach(t=>{if(!e.signatures[t])throw new Error(`Transaction is missing signature for address \`${t}\``)});}function k(e){return "signMessages"in e&&typeof e.signMessages=="function"}function zr(e){if(!k(e))throw new Error("The provided value does not implement the MessagePartialSigner interface")}function m(e){return "signTransactions"in e&&typeof e.signTransactions=="function"}function Br(e){if(!m(e))throw new Error("The provided value does not implement the TransactionPartialSigner interface")}function bn(e){return "keyPair"in e&&typeof e.keyPair=="object"&&k(e)&&m(e)}function Lr(e){if(!bn(e))throw new Error("The provided value does not implement the KeyPairSigner interface")}async function wn(e){let n=await L(e.publicKey);return Object.freeze({address:n,keyPair:e,signMessages:t=>Promise.all(t.map(async i=>Object.freeze({[n]:await _(e.privateKey,i.content)}))),signTransactions:t=>Promise.all(t.map(async i=>{let o=await Me([e],i);return Object.freeze({[n]:o.signatures[n]})}))})}async function _r(){return wn(await he())}function re(e){return pe(e.address)&&"modifyAndSignMessages"in e&&typeof e.modifyAndSignMessages=="function"}function Gr(e){if(!re(e))throw new Error("The provided value does not implement the MessageModifyingSigner interface")}function xn(e){return k(e)||re(e)}function Qr(e){if(!xn(e))throw new Error("The provided value does not implement any of the MessageSigner interfaces")}function rt(e){return Object.freeze({address:e,signMessages:async r=>r.map(()=>Object.freeze({})),signTransactions:async r=>r.map(()=>Object.freeze({}))})}function T(e){return "modifyAndSignTransactions"in e&&typeof e.modifyAndSignTransactions=="function"}function st(e){if(!T(e))throw new Error("The provided value does not implement the TransactionModifyingSigner interface")}function x(e){return "signAndSendTransactions"in e&&typeof e.signAndSendTransactions=="function"}function ct(e){if(!x(e))throw new Error("The provided value does not implement the TransactionSendingSigner interface")}function $(e){return m(e)||T(e)||x(e)}function Tt(e){if(!$(e))throw new Error("The provided value does not implement any of the TransactionSigner interfaces")}async function En(e,n={}){let{partialSigners:r,modifyingSigners:t}=Pe(y(B(e).filter($)),{identifySendingSigner:!1});return ke(e,t,r,n.abortSignal)}async function Rt(e,n={}){let r=await En(e,n);return De(r),r}async function Ot(e,n={}){let r=n.abortSignal,{partialSigners:t,modifyingSigners:i,sendingSigner:o}=Pe(y(B(e).filter($)));r==null||r.throwIfAborted();let s=await ke(e,i,t,r);if(!o)throw new Error("No `TransactionSendingSigner` was identified. Please provide a valid `ITransactionWithSingleSendingSigner` transaction.");r==null||r.throwIfAborted();let[a]=await o.signAndSendTransactions([s],{abortSignal:r});return r==null||r.throwIfAborted(),a}function Pe(e,n={}){var a;let t=((a=n.identifySendingSigner)!=null?a:!0)?In(e):null,i=e.filter(c=>c!==t&&(T(c)||m(c))),o=zn(i),s=i.filter(m).filter(c=>!o.includes(c));return Object.freeze({modifyingSigners:o,partialSigners:s,sendingSigner:t})}function In(e){let n=e.filter(x);if(n.length===0)return null;let r=n.filter(t=>!T(t)&&!m(t));return r.length>0?r[0]:n[0]}function zn(e){let n=e.filter(T);if(n.length===0)return [];let r=n.filter(t=>!m(t));return r.length>0?r:[n[0]]}async function ke(e,n=[],r=[],t){var a;let i=await n.reduce(async(c,d)=>{t==null||t.throwIfAborted();let[f]=await d.modifyAndSignTransactions([await c],{abortSignal:t});return Object.freeze(f)},Promise.resolve(e));t==null||t.throwIfAborted();let o=await Promise.all(r.map(async c=>{let[d]=await c.signTransactions([i],{abortSignal:t});return d})),s={...i,signatures:Object.freeze(o.reduce((c,d)=>({...c,...d}),(a=i.signatures)!=null?a:{}))};return Object.freeze(s)}var Ne=globalThis.TextEncoder;function Vt(e,n={}){return Object.freeze({content:typeof e=="string"?new Ne().encode(e):e,signatures:Object.freeze({...n})})}function qt(e){try{return vn(e),!0}catch{return !1}}function vn(e){let r=B(e).filter(x);if(r.length===0){let i=new Error("No `TransactionSendingSigner` was identified.");throw i.name="MissingTransactionSendingSignerError",i}if(r.filter(i=>!m(i)&&!T(i)).length>1){let i=new Error("More than one `TransactionSendingSigner` was identified.");throw i.name="MultipleTransactionSendingSignersError",i}} | ||
exports.addSignersToInstruction = ke; | ||
exports.addSignersToTransaction = tr; | ||
exports.assertIsKeyPairSigner = st; | ||
exports.assertIsMessageModifyingSigner = ft; | ||
exports.assertIsMessagePartialSigner = Gr; | ||
exports.assertIsMessageSigner = yt; | ||
exports.assertIsTransactionModifyingSigner = Et; | ||
exports.assertIsTransactionPartialSigner = Xr; | ||
exports.assertIsTransactionSendingSigner = Ct; | ||
exports.assertIsTransactionSigner = Ut; | ||
exports.assertIsTransactionWithSingleSendingSigner = Vn; | ||
exports.createNoopSigner = bt; | ||
exports.createSignableMessage = di; | ||
exports.createSignerFromKeyPair = Ln; | ||
exports.generateKeyPairSigner = at; | ||
exports.getSignersFromInstruction = Me; | ||
exports.getSignersFromTransaction = v; | ||
exports.isKeyPairSigner = Wn; | ||
exports.isMessageModifyingSigner = te; | ||
exports.addSignersToInstruction = We; | ||
exports.addSignersToTransaction = Fn; | ||
exports.assertIsKeyPairSigner = Lr; | ||
exports.assertIsMessageModifyingSigner = Gr; | ||
exports.assertIsMessagePartialSigner = zr; | ||
exports.assertIsMessageSigner = Qr; | ||
exports.assertIsTransactionModifyingSigner = st; | ||
exports.assertIsTransactionPartialSigner = Br; | ||
exports.assertIsTransactionSendingSigner = ct; | ||
exports.assertIsTransactionSigner = Tt; | ||
exports.assertIsTransactionWithSingleSendingSigner = vn; | ||
exports.createNoopSigner = rt; | ||
exports.createSignableMessage = Vt; | ||
exports.createSignerFromKeyPair = wn; | ||
exports.generateKeyPairSigner = _r; | ||
exports.getSignersFromInstruction = Oe; | ||
exports.getSignersFromTransaction = B; | ||
exports.isKeyPairSigner = bn; | ||
exports.isMessageModifyingSigner = re; | ||
exports.isMessagePartialSigner = k; | ||
exports.isMessageSigner = _n; | ||
exports.isTransactionModifyingSigner = S; | ||
exports.isMessageSigner = xn; | ||
exports.isTransactionModifyingSigner = T; | ||
exports.isTransactionPartialSigner = m; | ||
exports.isTransactionSendingSigner = b; | ||
exports.isTransactionSigner = _; | ||
exports.isTransactionWithSingleSendingSigner = Ti; | ||
exports.partiallySignTransactionWithSigners = Fn; | ||
exports.signAndSendTransactionWithSigners = ri; | ||
exports.signTransactionWithSigners = ni; | ||
exports.isTransactionSendingSigner = x; | ||
exports.isTransactionSigner = $; | ||
exports.isTransactionWithSingleSendingSigner = qt; | ||
exports.partiallySignTransactionWithSigners = En; | ||
exports.signAndSendTransactionWithSigners = Ot; | ||
exports.signTransactionWithSigners = Rt; | ||
@@ -42,0 +42,0 @@ return exports; |
import { AccountRole, IAccountLookupMeta, IAccountMeta, IInstruction } from '@solana/instructions'; | ||
import { BaseTransaction, TransactionVersion } from '@solana/transactions'; | ||
import { TransactionSigner } from './transaction-signer'; | ||
import { TransactionSigner } from './transaction-signer.js'; | ||
/** An extension of the IAccountMeta type that keeps track of its transaction signer. */ | ||
@@ -5,0 +5,0 @@ export interface IAccountSignerMeta<TAddress extends string = string, TSigner extends TransactionSigner = TransactionSigner> extends IAccountMeta<TAddress> { |
import { IInstruction } from '@solana/instructions'; | ||
import { BaseTransaction } from '@solana/transactions'; | ||
import { IInstructionWithSigners, ITransactionWithSigners } from './account-signer-meta'; | ||
import { TransactionSigner } from './transaction-signer'; | ||
import { IInstructionWithSigners, ITransactionWithSigners } from './account-signer-meta.js'; | ||
import { TransactionSigner } from './transaction-signer.js'; | ||
/** Attaches the provided signers to the account metas of an instruction when applicable. */ | ||
@@ -6,0 +6,0 @@ export declare function addSignersToInstruction<TInstruction extends IInstruction>(signers: TransactionSigner[], instruction: TInstruction | (TInstruction & IInstructionWithSigners)): TInstruction & IInstructionWithSigners; |
@@ -1,5 +0,5 @@ | ||
import { MessageSigner } from './message-signer'; | ||
import { TransactionSigner } from './transaction-signer'; | ||
import { MessageSigner } from './message-signer.js'; | ||
import { TransactionSigner } from './transaction-signer.js'; | ||
/** Removes all duplicated signers from a provided array by comparing their addresses. */ | ||
export declare function deduplicateSigners<TSigner extends MessageSigner | TransactionSigner>(signers: readonly TSigner[]): readonly TSigner[]; | ||
//# sourceMappingURL=deduplicate-signers.d.ts.map |
@@ -1,16 +0,16 @@ | ||
export * from './account-signer-meta'; | ||
export * from './add-signers'; | ||
export * from './keypair-signer'; | ||
export * from './message-modifying-signer'; | ||
export * from './message-partial-signer'; | ||
export * from './message-signer'; | ||
export * from './noop-signer'; | ||
export * from './sign-transaction'; | ||
export * from './signable-message'; | ||
export * from './transaction-modifying-signer'; | ||
export * from './transaction-partial-signer'; | ||
export * from './transaction-sending-signer'; | ||
export * from './transaction-signer'; | ||
export * from './transaction-with-single-sending-signer'; | ||
export * from './types'; | ||
export * from './account-signer-meta.js'; | ||
export * from './add-signers.js'; | ||
export * from './keypair-signer.js'; | ||
export * from './message-modifying-signer.js'; | ||
export * from './message-partial-signer.js'; | ||
export * from './message-signer.js'; | ||
export * from './noop-signer.js'; | ||
export * from './sign-transaction.js'; | ||
export * from './signable-message.js'; | ||
export * from './transaction-modifying-signer.js'; | ||
export * from './transaction-partial-signer.js'; | ||
export * from './transaction-sending-signer.js'; | ||
export * from './transaction-signer.js'; | ||
export * from './transaction-with-single-sending-signer.js'; | ||
export * from './types.js'; | ||
//# sourceMappingURL=index.d.ts.map |
import { Address } from '@solana/addresses'; | ||
import { MessagePartialSigner } from './message-partial-signer'; | ||
import { TransactionPartialSigner } from './transaction-partial-signer'; | ||
import { MessagePartialSigner } from './message-partial-signer.js'; | ||
import { TransactionPartialSigner } from './transaction-partial-signer.js'; | ||
/** Defines a signer capable of signing messages and transactions using a CryptoKeyPair. */ | ||
@@ -5,0 +5,0 @@ export type KeyPairSigner<TAddress extends string = string> = MessagePartialSigner<TAddress> & TransactionPartialSigner<TAddress> & { |
import { Address } from '@solana/addresses'; | ||
import { SignableMessage } from './signable-message'; | ||
import { BaseSignerConfig } from './types'; | ||
import { SignableMessage } from './signable-message.js'; | ||
import { BaseSignerConfig } from './types.js'; | ||
export type MessageModifyingSignerConfig = BaseSignerConfig; | ||
@@ -5,0 +5,0 @@ /** Defines a signer capable of signing messages. */ |
import { Address } from '@solana/addresses'; | ||
import { SignableMessage } from './signable-message'; | ||
import { BaseSignerConfig, SignatureDictionary } from './types'; | ||
import { SignableMessage } from './signable-message.js'; | ||
import { BaseSignerConfig, SignatureDictionary } from './types.js'; | ||
export type MessagePartialSignerConfig = BaseSignerConfig; | ||
@@ -5,0 +5,0 @@ /** Defines a signer capable of signing messages. */ |
import { Address } from '@solana/addresses'; | ||
import { MessageModifyingSigner } from './message-modifying-signer'; | ||
import { MessagePartialSigner } from './message-partial-signer'; | ||
import { MessageModifyingSigner } from './message-modifying-signer.js'; | ||
import { MessagePartialSigner } from './message-partial-signer.js'; | ||
/** Defines a signer capable of signing messages. */ | ||
@@ -5,0 +5,0 @@ export type MessageSigner<TAddress extends string = string> = MessagePartialSigner<TAddress> | MessageModifyingSigner<TAddress>; |
import { Address } from '@solana/addresses'; | ||
import { MessagePartialSigner } from './message-partial-signer'; | ||
import { TransactionPartialSigner } from './transaction-partial-signer'; | ||
import { MessagePartialSigner } from './message-partial-signer.js'; | ||
import { TransactionPartialSigner } from './transaction-partial-signer.js'; | ||
/** Defines a no-operation signer that pretends to partially sign messages and transactions. */ | ||
@@ -5,0 +5,0 @@ export type NoopSigner<TAddress extends string = string> = MessagePartialSigner<TAddress> & TransactionPartialSigner<TAddress>; |
import { SignatureBytes } from '@solana/keys'; | ||
import { CompilableTransaction, IFullySignedTransaction, ITransactionWithSignatures } from '@solana/transactions'; | ||
import { ITransactionWithSigners } from './account-signer-meta'; | ||
import { ITransactionWithSingleSendingSigner } from './transaction-with-single-sending-signer'; | ||
import { ITransactionWithSigners } from './account-signer-meta.js'; | ||
import { ITransactionWithSingleSendingSigner } from './transaction-with-single-sending-signer.js'; | ||
type CompilableTransactionWithSigners = CompilableTransaction & ITransactionWithSigners & Partial<ITransactionWithSignatures>; | ||
@@ -6,0 +6,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { SignatureDictionary } from './types'; | ||
import { SignatureDictionary } from './types.js'; | ||
/** Defines a message that needs signing and its current set of signatures if any. */ | ||
@@ -3,0 +3,0 @@ export type SignableMessage = Readonly<{ |
import { Address } from '@solana/addresses'; | ||
import { CompilableTransaction } from '@solana/transactions'; | ||
import { BaseSignerConfig } from './types'; | ||
import { BaseSignerConfig } from './types.js'; | ||
export type TransactionModifyingSignerConfig = BaseSignerConfig; | ||
@@ -5,0 +5,0 @@ /** Defines a signer capable of signing transactions. */ |
import { Address } from '@solana/addresses'; | ||
import { CompilableTransaction } from '@solana/transactions'; | ||
import { BaseSignerConfig, SignatureDictionary } from './types'; | ||
import { BaseSignerConfig, SignatureDictionary } from './types.js'; | ||
export type TransactionPartialSignerConfig = BaseSignerConfig; | ||
@@ -5,0 +5,0 @@ /** Defines a signer capable of signing transactions. */ |
import { Address } from '@solana/addresses'; | ||
import { SignatureBytes } from '@solana/keys'; | ||
import { CompilableTransaction } from '@solana/transactions'; | ||
import { BaseSignerConfig } from './types'; | ||
import { BaseSignerConfig } from './types.js'; | ||
export type TransactionSendingSignerConfig = BaseSignerConfig; | ||
@@ -6,0 +6,0 @@ /** Defines a signer capable of signing and sending transactions simultaneously. */ |
import { Address } from '@solana/addresses'; | ||
import { TransactionModifyingSigner } from './transaction-modifying-signer'; | ||
import { TransactionPartialSigner } from './transaction-partial-signer'; | ||
import { TransactionSendingSigner } from './transaction-sending-signer'; | ||
import { TransactionModifyingSigner } from './transaction-modifying-signer.js'; | ||
import { TransactionPartialSigner } from './transaction-partial-signer.js'; | ||
import { TransactionSendingSigner } from './transaction-sending-signer.js'; | ||
/** Defines a signer capable of signing transactions. */ | ||
@@ -6,0 +6,0 @@ export type TransactionSigner<TAddress extends string = string> = TransactionPartialSigner<TAddress> | TransactionModifyingSigner<TAddress> | TransactionSendingSigner<TAddress>; |
import { CompilableTransaction } from '@solana/transactions'; | ||
import { ITransactionWithSigners } from './account-signer-meta'; | ||
import { ITransactionWithSigners } from './account-signer-meta.js'; | ||
/** Defines a transaction with exactly one {@link TransactionSendingSigner}. */ | ||
@@ -4,0 +4,0 @@ export type ITransactionWithSingleSendingSigner = ITransactionWithSigners & { |
{ | ||
"name": "@solana/signers", | ||
"version": "2.0.0-experimental.c156b67", | ||
"version": "2.0.0-experimental.c9bd7fa", | ||
"description": "An abstraction layer over signing messages and transactions in Solana", | ||
@@ -52,6 +52,6 @@ "exports": { | ||
"dependencies": { | ||
"@solana/addresses": "2.0.0-experimental.c156b67", | ||
"@solana/instructions": "2.0.0-experimental.c156b67", | ||
"@solana/keys": "2.0.0-experimental.c156b67", | ||
"@solana/transactions": "2.0.0-experimental.c156b67" | ||
"@solana/addresses": "2.0.0-experimental.c9bd7fa", | ||
"@solana/instructions": "2.0.0-experimental.c9bd7fa", | ||
"@solana/keys": "2.0.0-experimental.c9bd7fa", | ||
"@solana/transactions": "2.0.0-experimental.c9bd7fa" | ||
}, | ||
@@ -61,4 +61,4 @@ "devDependencies": { | ||
"@swc/jest": "^0.2.29", | ||
"@types/jest": "^29.5.6", | ||
"@typescript-eslint/eslint-plugin": "^6.7.0", | ||
"@types/jest": "^29.5.11", | ||
"@typescript-eslint/eslint-plugin": "^6.13.2", | ||
"@typescript-eslint/parser": "^6.3.0", | ||
@@ -93,3 +93,3 @@ "agadoo": "^3.0.0", | ||
"compile:js": "tsup --config build-scripts/tsup.config.library.ts", | ||
"compile:typedefs": "tsc -p ./tsconfig.declarations.json", | ||
"compile:typedefs": "tsc -p ./tsconfig.declarations.json && node node_modules/build-scripts/add-js-extension-to-types.mjs", | ||
"dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch", | ||
@@ -96,0 +96,0 @@ "publish-packages": "pnpm publish --tag experimental --access public --no-git-checks", |
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
609855
3475
21
+ Added@solana/addresses@2.0.0-experimental.c9bd7fa(transitive)
+ Added@solana/assertions@2.0.0-experimental.c9bd7fa(transitive)
+ Added@solana/codecs-core@2.0.0-experimental.c9bd7fa(transitive)
+ Added@solana/codecs-data-structures@2.0.0-experimental.c9bd7fa(transitive)
+ Added@solana/codecs-numbers@2.0.0-experimental.c9bd7fa(transitive)
+ Added@solana/codecs-strings@2.0.0-experimental.c9bd7fa(transitive)
+ Added@solana/functional@2.0.0-experimental.c9bd7fa(transitive)
+ Added@solana/instructions@2.0.0-experimental.c9bd7fa(transitive)
+ Added@solana/keys@2.0.0-experimental.c9bd7fa(transitive)
+ Added@solana/transactions@2.0.0-experimental.c9bd7fa(transitive)
- Removed@solana/addresses@2.0.0-experimental.c156b67(transitive)
- Removed@solana/assertions@2.0.0-experimental.c156b67(transitive)
- Removed@solana/codecs-core@2.0.0-experimental.c156b67(transitive)
- Removed@solana/codecs-data-structures@2.0.0-experimental.c156b67(transitive)
- Removed@solana/codecs-numbers@2.0.0-experimental.c156b67(transitive)
- Removed@solana/codecs-strings@2.0.0-experimental.c156b67(transitive)
- Removed@solana/functional@2.0.0-experimental.c156b67(transitive)
- Removed@solana/instructions@2.0.0-experimental.c156b67(transitive)
- Removed@solana/keys@2.0.0-experimental.c156b67(transitive)
- Removed@solana/transactions@2.0.0-experimental.c156b67(transitive)