@solana/sysvars
Advanced tools
Comparing version 2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22 to 2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e
import { fetchEncodedAccount, fetchJsonParsedAccount, assertAccountExists, decodeAccount } from '@solana/accounts'; | ||
import { getStructEncoder, getU64Encoder, getI64Encoder, getStructDecoder, getU64Decoder, getI64Decoder, combineCodec, getBooleanEncoder, getBooleanDecoder, getArrayEncoder, getArrayDecoder, getF64Encoder, getU8Encoder, getF64Decoder, getU8Decoder, createEncoder as createEncoder$1, createDecoder as createDecoder$1, getArrayCodec, getU64Codec } from '@solana/codecs'; | ||
import { SolanaError, SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE, SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS, SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH, SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE, SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE } from '@solana/errors'; | ||
import { getStructEncoder, getU64Encoder, getI64Encoder, getStructDecoder, getU64Decoder, getI64Decoder, combineCodec, getBooleanEncoder, getBooleanDecoder, getArrayEncoder, getArrayDecoder, getF64Encoder, getU8Encoder, getF64Decoder, getU8Decoder, createEncoder, createDecoder, getArrayCodec, getU64Codec } from '@solana/codecs'; | ||
import { getLamportsEncoder, getLamportsDecoder, getBlockhashEncoder, getBlockhashDecoder } from '@solana/rpc-types'; | ||
import { SolanaError, SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE, SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS } from '@solana/errors'; | ||
@@ -102,414 +103,2 @@ // src/clock.ts | ||
} | ||
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) { | ||
if (bytes.length - offset <= 0) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, { | ||
codecDescription | ||
}); | ||
} | ||
} | ||
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) { | ||
const bytesLength = bytes.length - offset; | ||
if (bytesLength < expected) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, { | ||
bytesLength, | ||
codecDescription, | ||
expected | ||
}); | ||
} | ||
} | ||
var padBytes = (bytes, length) => { | ||
if (bytes.length >= length) | ||
return bytes; | ||
const paddedBytes = new Uint8Array(length).fill(0); | ||
paddedBytes.set(bytes); | ||
return paddedBytes; | ||
}; | ||
var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length); | ||
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 fixEncoder(encoder, fixedBytes) { | ||
return createEncoder({ | ||
fixedSize: 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 fixDecoder(decoder, fixedBytes) { | ||
return createDecoder({ | ||
fixedSize: fixedBytes, | ||
read: (bytes, offset) => { | ||
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset); | ||
if (offset > 0 || bytes.length > fixedBytes) { | ||
bytes = bytes.slice(offset, offset + fixedBytes); | ||
} | ||
if (isFixedSize(decoder)) { | ||
bytes = fixBytes(bytes, decoder.fixedSize); | ||
} | ||
const [value] = decoder.read(bytes, 0); | ||
return [value, offset + fixedBytes]; | ||
} | ||
}); | ||
} | ||
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) { | ||
if (value < min || value > max) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, { | ||
codecDescription, | ||
max, | ||
min, | ||
value | ||
}); | ||
} | ||
} | ||
function isLittleEndian(config) { | ||
return config?.endian === 1 ? false : true; | ||
} | ||
function numberEncoderFactory(input) { | ||
return createEncoder({ | ||
fixedSize: input.size, | ||
write(value, bytes, offset) { | ||
if (input.range) { | ||
assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value); | ||
} | ||
const arrayBuffer = new ArrayBuffer(input.size); | ||
input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config)); | ||
bytes.set(new Uint8Array(arrayBuffer), offset); | ||
return offset + input.size; | ||
} | ||
}); | ||
} | ||
function numberDecoderFactory(input) { | ||
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, isLittleEndian(input.config)), offset + input.size]; | ||
} | ||
}); | ||
} | ||
function toArrayBuffer(bytes, offset, length) { | ||
const bytesOffset = bytes.byteOffset + (offset ?? 0); | ||
const bytesLength = length ?? bytes.byteLength; | ||
return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength); | ||
} | ||
var getU32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u32", | ||
range: [0, Number("0xffffffff")], | ||
set: (view, value, le) => view.setUint32(0, value, le), | ||
size: 4 | ||
}); | ||
var getU32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint32(0, le), | ||
name: "u32", | ||
size: 4 | ||
}); | ||
var getU64Encoder4 = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u64", | ||
range: [0n, BigInt("0xffffffffffffffff")], | ||
set: (view, value, le) => view.setBigUint64(0, BigInt(value), le), | ||
size: 8 | ||
}); | ||
var getU64Decoder4 = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigUint64(0, le), | ||
name: "u64", | ||
size: 8 | ||
}); | ||
// ../codecs-strings/dist/index.browser.js | ||
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) { | ||
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, { | ||
alphabet: alphabet4, | ||
base: alphabet4.length, | ||
value: givenValue | ||
}); | ||
} | ||
} | ||
var getBaseXEncoder = (alphabet4) => { | ||
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 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 = []; | ||
while (base10Number > 0n) { | ||
tailBytes.unshift(Number(base10Number % 256n)); | ||
base10Number /= 256n; | ||
} | ||
const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes]; | ||
bytes.set(bytesToAdd, offset); | ||
return offset + bytesToAdd.length; | ||
} | ||
}); | ||
}; | ||
var getBaseXDecoder = (alphabet4) => { | ||
return createDecoder({ | ||
read(rawBytes, offset) { | ||
const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset); | ||
if (bytes.length === 0) | ||
return ["", 0]; | ||
let trailIndex = bytes.findIndex((n) => n !== 0); | ||
trailIndex = trailIndex === -1 ? bytes.length : trailIndex; | ||
const leadingZeroes = alphabet4[0].repeat(trailIndex); | ||
if (trailIndex === bytes.length) | ||
return [leadingZeroes, rawBytes.length]; | ||
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 [leadingZeros, tailChars] = value.split(new RegExp(`((?!${zeroCharacter}).*)`)); | ||
return [leadingZeros, tailChars]; | ||
} | ||
function getBigIntFromBaseX(value, alphabet4) { | ||
const base = BigInt(alphabet4.length); | ||
let sum = 0n; | ||
for (const char of value) { | ||
sum *= base; | ||
sum += BigInt(alphabet4.indexOf(char)); | ||
} | ||
return sum; | ||
} | ||
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"; | ||
var getBase58Encoder = () => getBaseXEncoder(alphabet2); | ||
var getBase58Decoder = () => getBaseXDecoder(alphabet2); | ||
var removeNullCharacters = (value) => ( | ||
// eslint-disable-next-line no-control-regex | ||
value.replace(/\u0000/g, "") | ||
); | ||
var e = globalThis.TextDecoder; | ||
var o = globalThis.TextEncoder; | ||
var getUtf8Encoder = () => { | ||
let textEncoder; | ||
return createEncoder({ | ||
getSizeFromValue: (value) => (textEncoder ||= new o()).encode(value).length, | ||
write: (value, bytes, offset) => { | ||
const bytesToAdd = (textEncoder ||= new o()).encode(value); | ||
bytes.set(bytesToAdd, offset); | ||
return offset + bytesToAdd.length; | ||
} | ||
}); | ||
}; | ||
var getUtf8Decoder = () => { | ||
let textDecoder; | ||
return createDecoder({ | ||
read(bytes, offset) { | ||
const value = (textDecoder ||= new e()).decode(bytes.slice(offset)); | ||
return [removeNullCharacters(value), bytes.length]; | ||
} | ||
}); | ||
}; | ||
function getStringEncoder(config = {}) { | ||
const size = config.size ?? getU32Encoder(); | ||
const encoding = config.encoding ?? getUtf8Encoder(); | ||
if (size === "variable") { | ||
return encoding; | ||
} | ||
if (typeof size === "number") { | ||
return fixEncoder(encoding, size); | ||
} | ||
return createEncoder({ | ||
getSizeFromValue: (value) => { | ||
const contentSize = getEncodedSize(value, encoding); | ||
return getEncodedSize(contentSize, size) + contentSize; | ||
}, | ||
write: (value, bytes, offset) => { | ||
const contentSize = getEncodedSize(value, encoding); | ||
offset = size.write(contentSize, bytes, offset); | ||
return encoding.write(value, bytes, offset); | ||
} | ||
}); | ||
} | ||
function getStringDecoder(config = {}) { | ||
const size = config.size ?? getU32Decoder(); | ||
const encoding = config.encoding ?? getUtf8Decoder(); | ||
if (size === "variable") { | ||
return encoding; | ||
} | ||
if (typeof size === "number") { | ||
return fixDecoder(encoding, size); | ||
} | ||
return createDecoder({ | ||
read: (bytes, offset = 0) => { | ||
assertByteArrayIsNotEmptyForCodec("string", bytes, offset); | ||
const [lengthBigInt, lengthOffset] = size.read(bytes, offset); | ||
const length = Number(lengthBigInt); | ||
offset = lengthOffset; | ||
const contentBytes = bytes.slice(offset, offset + length); | ||
assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes); | ||
const [value, contentOffset] = encoding.read(contentBytes, 0); | ||
offset += contentOffset; | ||
return [value, offset]; | ||
} | ||
}); | ||
} | ||
// ../rpc-types/dist/index.browser.js | ||
function getEncodedSize2(value, encoder) { | ||
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value); | ||
} | ||
function createEncoder2(encoder) { | ||
return Object.freeze({ | ||
...encoder, | ||
encode: (value) => { | ||
const bytes = new Uint8Array(getEncodedSize2(value, encoder)); | ||
encoder.write(value, bytes, 0); | ||
return bytes; | ||
} | ||
}); | ||
} | ||
function createDecoder2(decoder) { | ||
return Object.freeze({ | ||
...decoder, | ||
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0] | ||
}); | ||
} | ||
function isFixedSize2(codec) { | ||
return "fixedSize" in codec && typeof codec.fixedSize === "number"; | ||
} | ||
function isVariableSize(codec) { | ||
return !isFixedSize2(codec); | ||
} | ||
function mapEncoder(encoder, unmap) { | ||
return createEncoder2({ | ||
...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder, | ||
write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset) | ||
}); | ||
} | ||
function mapDecoder(decoder, map) { | ||
return createDecoder2({ | ||
...decoder, | ||
read: (bytes, offset) => { | ||
const [value, newOffset] = decoder.read(bytes, offset); | ||
return [map(value, bytes, offset), newOffset]; | ||
} | ||
}); | ||
} | ||
var memoizedBase58Encoder; | ||
var memoizedBase58Decoder; | ||
function getMemoizedBase58Encoder() { | ||
if (!memoizedBase58Encoder) | ||
memoizedBase58Encoder = getBase58Encoder(); | ||
return memoizedBase58Encoder; | ||
} | ||
function getMemoizedBase58Decoder() { | ||
if (!memoizedBase58Decoder) | ||
memoizedBase58Decoder = getBase58Decoder(); | ||
return memoizedBase58Decoder; | ||
} | ||
function assertIsBlockhash(putativeBlockhash) { | ||
if ( | ||
// Lowest value (32 bytes of zeroes) | ||
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255) | ||
putativeBlockhash.length > 44 | ||
) { | ||
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, { | ||
actualLength: putativeBlockhash.length | ||
}); | ||
} | ||
const base58Encoder = getMemoizedBase58Encoder(); | ||
const bytes = base58Encoder.encode(putativeBlockhash); | ||
const numBytes = bytes.byteLength; | ||
if (numBytes !== 32) { | ||
throw new SolanaError(SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH, { | ||
actualLength: numBytes | ||
}); | ||
} | ||
} | ||
function blockhash(putativeBlockhash) { | ||
assertIsBlockhash(putativeBlockhash); | ||
return putativeBlockhash; | ||
} | ||
function getBlockhashEncoder() { | ||
return mapEncoder( | ||
getStringEncoder({ encoding: getMemoizedBase58Encoder(), size: 32 }), | ||
(putativeBlockhash) => blockhash(putativeBlockhash) | ||
); | ||
} | ||
function getBlockhashDecoder() { | ||
return getStringDecoder({ encoding: getMemoizedBase58Decoder(), size: 32 }); | ||
} | ||
var maxU64Value = 18446744073709551615n; | ||
var memoizedU64Encoder; | ||
var memoizedU64Decoder; | ||
function getMemoizedU64Encoder() { | ||
if (!memoizedU64Encoder) | ||
memoizedU64Encoder = getU64Encoder4(); | ||
return memoizedU64Encoder; | ||
} | ||
function getMemoizedU64Decoder() { | ||
if (!memoizedU64Decoder) | ||
memoizedU64Decoder = getU64Decoder4(); | ||
return memoizedU64Decoder; | ||
} | ||
function assertIsLamports(putativeLamports) { | ||
if (putativeLamports < 0 || putativeLamports > maxU64Value) { | ||
throw new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE); | ||
} | ||
} | ||
function lamports(putativeLamports) { | ||
assertIsLamports(putativeLamports); | ||
return putativeLamports; | ||
} | ||
function getLamportsEncoder() { | ||
return getMemoizedU64Encoder(); | ||
} | ||
function getLamportsDecoder() { | ||
return mapDecoder(getMemoizedU64Decoder(), lamports); | ||
} | ||
// src/fees.ts | ||
function getSysvarFeesEncoder() { | ||
@@ -629,15 +218,15 @@ return getStructEncoder([ | ||
8; | ||
var memoizedU64Encoder2; | ||
var memoizedU64Decoder2; | ||
var memoizedU64Encoder; | ||
var memoizedU64Decoder; | ||
var memoizedU64ArrayEncoder; | ||
var memoizedU64ArrayDecoder; | ||
function getMemoizedU64Encoder2() { | ||
if (!memoizedU64Encoder2) | ||
memoizedU64Encoder2 = getU64Encoder(); | ||
return memoizedU64Encoder2; | ||
function getMemoizedU64Encoder() { | ||
if (!memoizedU64Encoder) | ||
memoizedU64Encoder = getU64Encoder(); | ||
return memoizedU64Encoder; | ||
} | ||
function getMemoizedU64Decoder2() { | ||
if (!memoizedU64Decoder2) | ||
memoizedU64Decoder2 = getU64Decoder(); | ||
return memoizedU64Decoder2; | ||
function getMemoizedU64Decoder() { | ||
if (!memoizedU64Decoder) | ||
memoizedU64Decoder = getU64Decoder(); | ||
return memoizedU64Decoder; | ||
} | ||
@@ -655,3 +244,3 @@ function getMemoizedU64ArrayEncoder() { | ||
function getSysvarSlotHistoryEncoder() { | ||
return createEncoder$1({ | ||
return createEncoder({ | ||
fixedSize: SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE, | ||
@@ -661,9 +250,9 @@ write: (value, bytes, offset) => { | ||
offset += 1; | ||
getMemoizedU64Encoder2().write(BigInt(BITVEC_LENGTH), bytes, offset); | ||
getMemoizedU64Encoder().write(BigInt(BITVEC_LENGTH), bytes, offset); | ||
offset += 8; | ||
getMemoizedU64ArrayEncoder().write(value.bits, bytes, offset); | ||
offset += BITVEC_LENGTH * 8; | ||
getMemoizedU64Encoder2().write(BigInt(BITVEC_NUM_BITS), bytes, offset); | ||
getMemoizedU64Encoder().write(BigInt(BITVEC_NUM_BITS), bytes, offset); | ||
offset += 8; | ||
getMemoizedU64Encoder2().write(value.nextSlot, bytes, offset); | ||
getMemoizedU64Encoder().write(value.nextSlot, bytes, offset); | ||
offset += 8; | ||
@@ -675,3 +264,3 @@ return offset; | ||
function getSysvarSlotHistoryDecoder() { | ||
return createDecoder$1({ | ||
return createDecoder({ | ||
fixedSize: SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE, | ||
@@ -693,3 +282,3 @@ read: (bytes, offset) => { | ||
} | ||
const bitVecLength = getMemoizedU64Decoder2().read(bytes, offset)[0]; | ||
const bitVecLength = getMemoizedU64Decoder().read(bytes, offset)[0]; | ||
offset += 8; | ||
@@ -705,3 +294,3 @@ if (bitVecLength !== BigInt(BITVEC_LENGTH)) { | ||
offset += BITVEC_LENGTH * 8; | ||
const numBits = getMemoizedU64Decoder2().read(bytes, offset)[0]; | ||
const numBits = getMemoizedU64Decoder().read(bytes, offset)[0]; | ||
offset += 8; | ||
@@ -715,3 +304,3 @@ if (numBits !== BigInt(BITVEC_NUM_BITS)) { | ||
} | ||
const nextSlot = getMemoizedU64Decoder2().read(bytes, offset)[0]; | ||
const nextSlot = getMemoizedU64Decoder().read(bytes, offset)[0]; | ||
offset += 8; | ||
@@ -718,0 +307,0 @@ return [ |
import { fetchEncodedAccount, fetchJsonParsedAccount, assertAccountExists, decodeAccount } from '@solana/accounts'; | ||
import { getStructEncoder, getU64Encoder, getI64Encoder, getStructDecoder, getU64Decoder, getI64Decoder, combineCodec, getBooleanEncoder, getBooleanDecoder, getArrayEncoder, getArrayDecoder, getF64Encoder, getU8Encoder, getF64Decoder, getU8Decoder, createEncoder as createEncoder$1, createDecoder as createDecoder$1, getArrayCodec, getU64Codec } from '@solana/codecs'; | ||
import { SolanaError, SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE, SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS, SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH, SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE, SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE } from '@solana/errors'; | ||
import { getStructEncoder, getU64Encoder, getI64Encoder, getStructDecoder, getU64Decoder, getI64Decoder, combineCodec, getBooleanEncoder, getBooleanDecoder, getArrayEncoder, getArrayDecoder, getF64Encoder, getU8Encoder, getF64Decoder, getU8Decoder, createEncoder, createDecoder, getArrayCodec, getU64Codec } from '@solana/codecs'; | ||
import { getLamportsEncoder, getLamportsDecoder, getBlockhashEncoder, getBlockhashDecoder } from '@solana/rpc-types'; | ||
import { SolanaError, SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE, SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS } from '@solana/errors'; | ||
@@ -102,414 +103,2 @@ // src/clock.ts | ||
} | ||
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) { | ||
if (bytes.length - offset <= 0) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, { | ||
codecDescription | ||
}); | ||
} | ||
} | ||
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) { | ||
const bytesLength = bytes.length - offset; | ||
if (bytesLength < expected) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, { | ||
bytesLength, | ||
codecDescription, | ||
expected | ||
}); | ||
} | ||
} | ||
var padBytes = (bytes, length) => { | ||
if (bytes.length >= length) | ||
return bytes; | ||
const paddedBytes = new Uint8Array(length).fill(0); | ||
paddedBytes.set(bytes); | ||
return paddedBytes; | ||
}; | ||
var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length); | ||
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 fixEncoder(encoder, fixedBytes) { | ||
return createEncoder({ | ||
fixedSize: 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 fixDecoder(decoder, fixedBytes) { | ||
return createDecoder({ | ||
fixedSize: fixedBytes, | ||
read: (bytes, offset) => { | ||
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset); | ||
if (offset > 0 || bytes.length > fixedBytes) { | ||
bytes = bytes.slice(offset, offset + fixedBytes); | ||
} | ||
if (isFixedSize(decoder)) { | ||
bytes = fixBytes(bytes, decoder.fixedSize); | ||
} | ||
const [value] = decoder.read(bytes, 0); | ||
return [value, offset + fixedBytes]; | ||
} | ||
}); | ||
} | ||
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) { | ||
if (value < min || value > max) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, { | ||
codecDescription, | ||
max, | ||
min, | ||
value | ||
}); | ||
} | ||
} | ||
function isLittleEndian(config) { | ||
return config?.endian === 1 ? false : true; | ||
} | ||
function numberEncoderFactory(input) { | ||
return createEncoder({ | ||
fixedSize: input.size, | ||
write(value, bytes, offset) { | ||
if (input.range) { | ||
assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value); | ||
} | ||
const arrayBuffer = new ArrayBuffer(input.size); | ||
input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config)); | ||
bytes.set(new Uint8Array(arrayBuffer), offset); | ||
return offset + input.size; | ||
} | ||
}); | ||
} | ||
function numberDecoderFactory(input) { | ||
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, isLittleEndian(input.config)), offset + input.size]; | ||
} | ||
}); | ||
} | ||
function toArrayBuffer(bytes, offset, length) { | ||
const bytesOffset = bytes.byteOffset + (offset ?? 0); | ||
const bytesLength = length ?? bytes.byteLength; | ||
return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength); | ||
} | ||
var getU32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u32", | ||
range: [0, Number("0xffffffff")], | ||
set: (view, value, le) => view.setUint32(0, value, le), | ||
size: 4 | ||
}); | ||
var getU32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint32(0, le), | ||
name: "u32", | ||
size: 4 | ||
}); | ||
var getU64Encoder4 = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u64", | ||
range: [0n, BigInt("0xffffffffffffffff")], | ||
set: (view, value, le) => view.setBigUint64(0, BigInt(value), le), | ||
size: 8 | ||
}); | ||
var getU64Decoder4 = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigUint64(0, le), | ||
name: "u64", | ||
size: 8 | ||
}); | ||
// ../codecs-strings/dist/index.browser.js | ||
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) { | ||
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, { | ||
alphabet: alphabet4, | ||
base: alphabet4.length, | ||
value: givenValue | ||
}); | ||
} | ||
} | ||
var getBaseXEncoder = (alphabet4) => { | ||
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 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 = []; | ||
while (base10Number > 0n) { | ||
tailBytes.unshift(Number(base10Number % 256n)); | ||
base10Number /= 256n; | ||
} | ||
const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes]; | ||
bytes.set(bytesToAdd, offset); | ||
return offset + bytesToAdd.length; | ||
} | ||
}); | ||
}; | ||
var getBaseXDecoder = (alphabet4) => { | ||
return createDecoder({ | ||
read(rawBytes, offset) { | ||
const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset); | ||
if (bytes.length === 0) | ||
return ["", 0]; | ||
let trailIndex = bytes.findIndex((n) => n !== 0); | ||
trailIndex = trailIndex === -1 ? bytes.length : trailIndex; | ||
const leadingZeroes = alphabet4[0].repeat(trailIndex); | ||
if (trailIndex === bytes.length) | ||
return [leadingZeroes, rawBytes.length]; | ||
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 [leadingZeros, tailChars] = value.split(new RegExp(`((?!${zeroCharacter}).*)`)); | ||
return [leadingZeros, tailChars]; | ||
} | ||
function getBigIntFromBaseX(value, alphabet4) { | ||
const base = BigInt(alphabet4.length); | ||
let sum = 0n; | ||
for (const char of value) { | ||
sum *= base; | ||
sum += BigInt(alphabet4.indexOf(char)); | ||
} | ||
return sum; | ||
} | ||
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"; | ||
var getBase58Encoder = () => getBaseXEncoder(alphabet2); | ||
var getBase58Decoder = () => getBaseXDecoder(alphabet2); | ||
var removeNullCharacters = (value) => ( | ||
// eslint-disable-next-line no-control-regex | ||
value.replace(/\u0000/g, "") | ||
); | ||
var e = globalThis.TextDecoder; | ||
var o = globalThis.TextEncoder; | ||
var getUtf8Encoder = () => { | ||
let textEncoder; | ||
return createEncoder({ | ||
getSizeFromValue: (value) => (textEncoder ||= new o()).encode(value).length, | ||
write: (value, bytes, offset) => { | ||
const bytesToAdd = (textEncoder ||= new o()).encode(value); | ||
bytes.set(bytesToAdd, offset); | ||
return offset + bytesToAdd.length; | ||
} | ||
}); | ||
}; | ||
var getUtf8Decoder = () => { | ||
let textDecoder; | ||
return createDecoder({ | ||
read(bytes, offset) { | ||
const value = (textDecoder ||= new e()).decode(bytes.slice(offset)); | ||
return [removeNullCharacters(value), bytes.length]; | ||
} | ||
}); | ||
}; | ||
function getStringEncoder(config = {}) { | ||
const size = config.size ?? getU32Encoder(); | ||
const encoding = config.encoding ?? getUtf8Encoder(); | ||
if (size === "variable") { | ||
return encoding; | ||
} | ||
if (typeof size === "number") { | ||
return fixEncoder(encoding, size); | ||
} | ||
return createEncoder({ | ||
getSizeFromValue: (value) => { | ||
const contentSize = getEncodedSize(value, encoding); | ||
return getEncodedSize(contentSize, size) + contentSize; | ||
}, | ||
write: (value, bytes, offset) => { | ||
const contentSize = getEncodedSize(value, encoding); | ||
offset = size.write(contentSize, bytes, offset); | ||
return encoding.write(value, bytes, offset); | ||
} | ||
}); | ||
} | ||
function getStringDecoder(config = {}) { | ||
const size = config.size ?? getU32Decoder(); | ||
const encoding = config.encoding ?? getUtf8Decoder(); | ||
if (size === "variable") { | ||
return encoding; | ||
} | ||
if (typeof size === "number") { | ||
return fixDecoder(encoding, size); | ||
} | ||
return createDecoder({ | ||
read: (bytes, offset = 0) => { | ||
assertByteArrayIsNotEmptyForCodec("string", bytes, offset); | ||
const [lengthBigInt, lengthOffset] = size.read(bytes, offset); | ||
const length = Number(lengthBigInt); | ||
offset = lengthOffset; | ||
const contentBytes = bytes.slice(offset, offset + length); | ||
assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes); | ||
const [value, contentOffset] = encoding.read(contentBytes, 0); | ||
offset += contentOffset; | ||
return [value, offset]; | ||
} | ||
}); | ||
} | ||
// ../rpc-types/dist/index.browser.js | ||
function getEncodedSize2(value, encoder) { | ||
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value); | ||
} | ||
function createEncoder2(encoder) { | ||
return Object.freeze({ | ||
...encoder, | ||
encode: (value) => { | ||
const bytes = new Uint8Array(getEncodedSize2(value, encoder)); | ||
encoder.write(value, bytes, 0); | ||
return bytes; | ||
} | ||
}); | ||
} | ||
function createDecoder2(decoder) { | ||
return Object.freeze({ | ||
...decoder, | ||
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0] | ||
}); | ||
} | ||
function isFixedSize2(codec) { | ||
return "fixedSize" in codec && typeof codec.fixedSize === "number"; | ||
} | ||
function isVariableSize(codec) { | ||
return !isFixedSize2(codec); | ||
} | ||
function mapEncoder(encoder, unmap) { | ||
return createEncoder2({ | ||
...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder, | ||
write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset) | ||
}); | ||
} | ||
function mapDecoder(decoder, map) { | ||
return createDecoder2({ | ||
...decoder, | ||
read: (bytes, offset) => { | ||
const [value, newOffset] = decoder.read(bytes, offset); | ||
return [map(value, bytes, offset), newOffset]; | ||
} | ||
}); | ||
} | ||
var memoizedBase58Encoder; | ||
var memoizedBase58Decoder; | ||
function getMemoizedBase58Encoder() { | ||
if (!memoizedBase58Encoder) | ||
memoizedBase58Encoder = getBase58Encoder(); | ||
return memoizedBase58Encoder; | ||
} | ||
function getMemoizedBase58Decoder() { | ||
if (!memoizedBase58Decoder) | ||
memoizedBase58Decoder = getBase58Decoder(); | ||
return memoizedBase58Decoder; | ||
} | ||
function assertIsBlockhash(putativeBlockhash) { | ||
if ( | ||
// Lowest value (32 bytes of zeroes) | ||
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255) | ||
putativeBlockhash.length > 44 | ||
) { | ||
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, { | ||
actualLength: putativeBlockhash.length | ||
}); | ||
} | ||
const base58Encoder = getMemoizedBase58Encoder(); | ||
const bytes = base58Encoder.encode(putativeBlockhash); | ||
const numBytes = bytes.byteLength; | ||
if (numBytes !== 32) { | ||
throw new SolanaError(SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH, { | ||
actualLength: numBytes | ||
}); | ||
} | ||
} | ||
function blockhash(putativeBlockhash) { | ||
assertIsBlockhash(putativeBlockhash); | ||
return putativeBlockhash; | ||
} | ||
function getBlockhashEncoder() { | ||
return mapEncoder( | ||
getStringEncoder({ encoding: getMemoizedBase58Encoder(), size: 32 }), | ||
(putativeBlockhash) => blockhash(putativeBlockhash) | ||
); | ||
} | ||
function getBlockhashDecoder() { | ||
return getStringDecoder({ encoding: getMemoizedBase58Decoder(), size: 32 }); | ||
} | ||
var maxU64Value = 18446744073709551615n; | ||
var memoizedU64Encoder; | ||
var memoizedU64Decoder; | ||
function getMemoizedU64Encoder() { | ||
if (!memoizedU64Encoder) | ||
memoizedU64Encoder = getU64Encoder4(); | ||
return memoizedU64Encoder; | ||
} | ||
function getMemoizedU64Decoder() { | ||
if (!memoizedU64Decoder) | ||
memoizedU64Decoder = getU64Decoder4(); | ||
return memoizedU64Decoder; | ||
} | ||
function assertIsLamports(putativeLamports) { | ||
if (putativeLamports < 0 || putativeLamports > maxU64Value) { | ||
throw new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE); | ||
} | ||
} | ||
function lamports(putativeLamports) { | ||
assertIsLamports(putativeLamports); | ||
return putativeLamports; | ||
} | ||
function getLamportsEncoder() { | ||
return getMemoizedU64Encoder(); | ||
} | ||
function getLamportsDecoder() { | ||
return mapDecoder(getMemoizedU64Decoder(), lamports); | ||
} | ||
// src/fees.ts | ||
function getSysvarFeesEncoder() { | ||
@@ -629,15 +218,15 @@ return getStructEncoder([ | ||
8; | ||
var memoizedU64Encoder2; | ||
var memoizedU64Decoder2; | ||
var memoizedU64Encoder; | ||
var memoizedU64Decoder; | ||
var memoizedU64ArrayEncoder; | ||
var memoizedU64ArrayDecoder; | ||
function getMemoizedU64Encoder2() { | ||
if (!memoizedU64Encoder2) | ||
memoizedU64Encoder2 = getU64Encoder(); | ||
return memoizedU64Encoder2; | ||
function getMemoizedU64Encoder() { | ||
if (!memoizedU64Encoder) | ||
memoizedU64Encoder = getU64Encoder(); | ||
return memoizedU64Encoder; | ||
} | ||
function getMemoizedU64Decoder2() { | ||
if (!memoizedU64Decoder2) | ||
memoizedU64Decoder2 = getU64Decoder(); | ||
return memoizedU64Decoder2; | ||
function getMemoizedU64Decoder() { | ||
if (!memoizedU64Decoder) | ||
memoizedU64Decoder = getU64Decoder(); | ||
return memoizedU64Decoder; | ||
} | ||
@@ -655,3 +244,3 @@ function getMemoizedU64ArrayEncoder() { | ||
function getSysvarSlotHistoryEncoder() { | ||
return createEncoder$1({ | ||
return createEncoder({ | ||
fixedSize: SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE, | ||
@@ -661,9 +250,9 @@ write: (value, bytes, offset) => { | ||
offset += 1; | ||
getMemoizedU64Encoder2().write(BigInt(BITVEC_LENGTH), bytes, offset); | ||
getMemoizedU64Encoder().write(BigInt(BITVEC_LENGTH), bytes, offset); | ||
offset += 8; | ||
getMemoizedU64ArrayEncoder().write(value.bits, bytes, offset); | ||
offset += BITVEC_LENGTH * 8; | ||
getMemoizedU64Encoder2().write(BigInt(BITVEC_NUM_BITS), bytes, offset); | ||
getMemoizedU64Encoder().write(BigInt(BITVEC_NUM_BITS), bytes, offset); | ||
offset += 8; | ||
getMemoizedU64Encoder2().write(value.nextSlot, bytes, offset); | ||
getMemoizedU64Encoder().write(value.nextSlot, bytes, offset); | ||
offset += 8; | ||
@@ -675,3 +264,3 @@ return offset; | ||
function getSysvarSlotHistoryDecoder() { | ||
return createDecoder$1({ | ||
return createDecoder({ | ||
fixedSize: SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE, | ||
@@ -693,3 +282,3 @@ read: (bytes, offset) => { | ||
} | ||
const bitVecLength = getMemoizedU64Decoder2().read(bytes, offset)[0]; | ||
const bitVecLength = getMemoizedU64Decoder().read(bytes, offset)[0]; | ||
offset += 8; | ||
@@ -705,3 +294,3 @@ if (bitVecLength !== BigInt(BITVEC_LENGTH)) { | ||
offset += BITVEC_LENGTH * 8; | ||
const numBits = getMemoizedU64Decoder2().read(bytes, offset)[0]; | ||
const numBits = getMemoizedU64Decoder().read(bytes, offset)[0]; | ||
offset += 8; | ||
@@ -715,3 +304,3 @@ if (numBits !== BigInt(BITVEC_NUM_BITS)) { | ||
} | ||
const nextSlot = getMemoizedU64Decoder2().read(bytes, offset)[0]; | ||
const nextSlot = getMemoizedU64Decoder().read(bytes, offset)[0]; | ||
offset += 8; | ||
@@ -718,0 +307,0 @@ return [ |
import { fetchEncodedAccount, fetchJsonParsedAccount, assertAccountExists, decodeAccount } from '@solana/accounts'; | ||
import { getStructEncoder, getU64Encoder, getI64Encoder, getStructDecoder, getU64Decoder, getI64Decoder, combineCodec, getBooleanEncoder, getBooleanDecoder, getArrayEncoder, getArrayDecoder, getF64Encoder, getU8Encoder, getF64Decoder, getU8Decoder, createEncoder as createEncoder$1, createDecoder as createDecoder$1, getArrayCodec, getU64Codec } from '@solana/codecs'; | ||
import { SolanaError, SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE, SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS, SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH, SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE, SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE } from '@solana/errors'; | ||
import { getStructEncoder, getU64Encoder, getI64Encoder, getStructDecoder, getU64Decoder, getI64Decoder, combineCodec, getBooleanEncoder, getBooleanDecoder, getArrayEncoder, getArrayDecoder, getF64Encoder, getU8Encoder, getF64Decoder, getU8Decoder, createEncoder, createDecoder, getArrayCodec, getU64Codec } from '@solana/codecs'; | ||
import { getLamportsEncoder, getLamportsDecoder, getBlockhashEncoder, getBlockhashDecoder } from '@solana/rpc-types'; | ||
import { SolanaError, SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE, SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS } from '@solana/errors'; | ||
@@ -102,414 +103,2 @@ // src/clock.ts | ||
} | ||
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) { | ||
if (bytes.length - offset <= 0) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, { | ||
codecDescription | ||
}); | ||
} | ||
} | ||
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) { | ||
const bytesLength = bytes.length - offset; | ||
if (bytesLength < expected) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, { | ||
bytesLength, | ||
codecDescription, | ||
expected | ||
}); | ||
} | ||
} | ||
var padBytes = (bytes, length) => { | ||
if (bytes.length >= length) | ||
return bytes; | ||
const paddedBytes = new Uint8Array(length).fill(0); | ||
paddedBytes.set(bytes); | ||
return paddedBytes; | ||
}; | ||
var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length); | ||
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 fixEncoder(encoder, fixedBytes) { | ||
return createEncoder({ | ||
fixedSize: 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 fixDecoder(decoder, fixedBytes) { | ||
return createDecoder({ | ||
fixedSize: fixedBytes, | ||
read: (bytes, offset) => { | ||
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset); | ||
if (offset > 0 || bytes.length > fixedBytes) { | ||
bytes = bytes.slice(offset, offset + fixedBytes); | ||
} | ||
if (isFixedSize(decoder)) { | ||
bytes = fixBytes(bytes, decoder.fixedSize); | ||
} | ||
const [value] = decoder.read(bytes, 0); | ||
return [value, offset + fixedBytes]; | ||
} | ||
}); | ||
} | ||
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) { | ||
if (value < min || value > max) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, { | ||
codecDescription, | ||
max, | ||
min, | ||
value | ||
}); | ||
} | ||
} | ||
function isLittleEndian(config) { | ||
return config?.endian === 1 ? false : true; | ||
} | ||
function numberEncoderFactory(input) { | ||
return createEncoder({ | ||
fixedSize: input.size, | ||
write(value, bytes, offset) { | ||
if (input.range) { | ||
assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value); | ||
} | ||
const arrayBuffer = new ArrayBuffer(input.size); | ||
input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config)); | ||
bytes.set(new Uint8Array(arrayBuffer), offset); | ||
return offset + input.size; | ||
} | ||
}); | ||
} | ||
function numberDecoderFactory(input) { | ||
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, isLittleEndian(input.config)), offset + input.size]; | ||
} | ||
}); | ||
} | ||
function toArrayBuffer(bytes, offset, length) { | ||
const bytesOffset = bytes.byteOffset + (offset ?? 0); | ||
const bytesLength = length ?? bytes.byteLength; | ||
return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength); | ||
} | ||
var getU32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u32", | ||
range: [0, Number("0xffffffff")], | ||
set: (view, value, le) => view.setUint32(0, value, le), | ||
size: 4 | ||
}); | ||
var getU32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint32(0, le), | ||
name: "u32", | ||
size: 4 | ||
}); | ||
var getU64Encoder4 = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u64", | ||
range: [0n, BigInt("0xffffffffffffffff")], | ||
set: (view, value, le) => view.setBigUint64(0, BigInt(value), le), | ||
size: 8 | ||
}); | ||
var getU64Decoder4 = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigUint64(0, le), | ||
name: "u64", | ||
size: 8 | ||
}); | ||
// ../codecs-strings/dist/index.node.js | ||
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) { | ||
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) { | ||
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, { | ||
alphabet: alphabet4, | ||
base: alphabet4.length, | ||
value: givenValue | ||
}); | ||
} | ||
} | ||
var getBaseXEncoder = (alphabet4) => { | ||
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 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 = []; | ||
while (base10Number > 0n) { | ||
tailBytes.unshift(Number(base10Number % 256n)); | ||
base10Number /= 256n; | ||
} | ||
const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes]; | ||
bytes.set(bytesToAdd, offset); | ||
return offset + bytesToAdd.length; | ||
} | ||
}); | ||
}; | ||
var getBaseXDecoder = (alphabet4) => { | ||
return createDecoder({ | ||
read(rawBytes, offset) { | ||
const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset); | ||
if (bytes.length === 0) | ||
return ["", 0]; | ||
let trailIndex = bytes.findIndex((n) => n !== 0); | ||
trailIndex = trailIndex === -1 ? bytes.length : trailIndex; | ||
const leadingZeroes = alphabet4[0].repeat(trailIndex); | ||
if (trailIndex === bytes.length) | ||
return [leadingZeroes, rawBytes.length]; | ||
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 [leadingZeros, tailChars] = value.split(new RegExp(`((?!${zeroCharacter}).*)`)); | ||
return [leadingZeros, tailChars]; | ||
} | ||
function getBigIntFromBaseX(value, alphabet4) { | ||
const base = BigInt(alphabet4.length); | ||
let sum = 0n; | ||
for (const char of value) { | ||
sum *= base; | ||
sum += BigInt(alphabet4.indexOf(char)); | ||
} | ||
return sum; | ||
} | ||
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"; | ||
var getBase58Encoder = () => getBaseXEncoder(alphabet2); | ||
var getBase58Decoder = () => getBaseXDecoder(alphabet2); | ||
var removeNullCharacters = (value) => ( | ||
// eslint-disable-next-line no-control-regex | ||
value.replace(/\u0000/g, "") | ||
); | ||
var e = globalThis.TextDecoder; | ||
var o = globalThis.TextEncoder; | ||
var getUtf8Encoder = () => { | ||
let textEncoder; | ||
return createEncoder({ | ||
getSizeFromValue: (value) => (textEncoder ||= new o()).encode(value).length, | ||
write: (value, bytes, offset) => { | ||
const bytesToAdd = (textEncoder ||= new o()).encode(value); | ||
bytes.set(bytesToAdd, offset); | ||
return offset + bytesToAdd.length; | ||
} | ||
}); | ||
}; | ||
var getUtf8Decoder = () => { | ||
let textDecoder; | ||
return createDecoder({ | ||
read(bytes, offset) { | ||
const value = (textDecoder ||= new e()).decode(bytes.slice(offset)); | ||
return [removeNullCharacters(value), bytes.length]; | ||
} | ||
}); | ||
}; | ||
function getStringEncoder(config = {}) { | ||
const size = config.size ?? getU32Encoder(); | ||
const encoding = config.encoding ?? getUtf8Encoder(); | ||
if (size === "variable") { | ||
return encoding; | ||
} | ||
if (typeof size === "number") { | ||
return fixEncoder(encoding, size); | ||
} | ||
return createEncoder({ | ||
getSizeFromValue: (value) => { | ||
const contentSize = getEncodedSize(value, encoding); | ||
return getEncodedSize(contentSize, size) + contentSize; | ||
}, | ||
write: (value, bytes, offset) => { | ||
const contentSize = getEncodedSize(value, encoding); | ||
offset = size.write(contentSize, bytes, offset); | ||
return encoding.write(value, bytes, offset); | ||
} | ||
}); | ||
} | ||
function getStringDecoder(config = {}) { | ||
const size = config.size ?? getU32Decoder(); | ||
const encoding = config.encoding ?? getUtf8Decoder(); | ||
if (size === "variable") { | ||
return encoding; | ||
} | ||
if (typeof size === "number") { | ||
return fixDecoder(encoding, size); | ||
} | ||
return createDecoder({ | ||
read: (bytes, offset = 0) => { | ||
assertByteArrayIsNotEmptyForCodec("string", bytes, offset); | ||
const [lengthBigInt, lengthOffset] = size.read(bytes, offset); | ||
const length = Number(lengthBigInt); | ||
offset = lengthOffset; | ||
const contentBytes = bytes.slice(offset, offset + length); | ||
assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes); | ||
const [value, contentOffset] = encoding.read(contentBytes, 0); | ||
offset += contentOffset; | ||
return [value, offset]; | ||
} | ||
}); | ||
} | ||
// ../rpc-types/dist/index.node.js | ||
function getEncodedSize2(value, encoder) { | ||
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value); | ||
} | ||
function createEncoder2(encoder) { | ||
return Object.freeze({ | ||
...encoder, | ||
encode: (value) => { | ||
const bytes = new Uint8Array(getEncodedSize2(value, encoder)); | ||
encoder.write(value, bytes, 0); | ||
return bytes; | ||
} | ||
}); | ||
} | ||
function createDecoder2(decoder) { | ||
return Object.freeze({ | ||
...decoder, | ||
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0] | ||
}); | ||
} | ||
function isFixedSize2(codec) { | ||
return "fixedSize" in codec && typeof codec.fixedSize === "number"; | ||
} | ||
function isVariableSize(codec) { | ||
return !isFixedSize2(codec); | ||
} | ||
function mapEncoder(encoder, unmap) { | ||
return createEncoder2({ | ||
...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder, | ||
write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset) | ||
}); | ||
} | ||
function mapDecoder(decoder, map) { | ||
return createDecoder2({ | ||
...decoder, | ||
read: (bytes, offset) => { | ||
const [value, newOffset] = decoder.read(bytes, offset); | ||
return [map(value, bytes, offset), newOffset]; | ||
} | ||
}); | ||
} | ||
var memoizedBase58Encoder; | ||
var memoizedBase58Decoder; | ||
function getMemoizedBase58Encoder() { | ||
if (!memoizedBase58Encoder) | ||
memoizedBase58Encoder = getBase58Encoder(); | ||
return memoizedBase58Encoder; | ||
} | ||
function getMemoizedBase58Decoder() { | ||
if (!memoizedBase58Decoder) | ||
memoizedBase58Decoder = getBase58Decoder(); | ||
return memoizedBase58Decoder; | ||
} | ||
function assertIsBlockhash(putativeBlockhash) { | ||
if ( | ||
// Lowest value (32 bytes of zeroes) | ||
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255) | ||
putativeBlockhash.length > 44 | ||
) { | ||
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, { | ||
actualLength: putativeBlockhash.length | ||
}); | ||
} | ||
const base58Encoder = getMemoizedBase58Encoder(); | ||
const bytes = base58Encoder.encode(putativeBlockhash); | ||
const numBytes = bytes.byteLength; | ||
if (numBytes !== 32) { | ||
throw new SolanaError(SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH, { | ||
actualLength: numBytes | ||
}); | ||
} | ||
} | ||
function blockhash(putativeBlockhash) { | ||
assertIsBlockhash(putativeBlockhash); | ||
return putativeBlockhash; | ||
} | ||
function getBlockhashEncoder() { | ||
return mapEncoder( | ||
getStringEncoder({ encoding: getMemoizedBase58Encoder(), size: 32 }), | ||
(putativeBlockhash) => blockhash(putativeBlockhash) | ||
); | ||
} | ||
function getBlockhashDecoder() { | ||
return getStringDecoder({ encoding: getMemoizedBase58Decoder(), size: 32 }); | ||
} | ||
var maxU64Value = 18446744073709551615n; | ||
var memoizedU64Encoder; | ||
var memoizedU64Decoder; | ||
function getMemoizedU64Encoder() { | ||
if (!memoizedU64Encoder) | ||
memoizedU64Encoder = getU64Encoder4(); | ||
return memoizedU64Encoder; | ||
} | ||
function getMemoizedU64Decoder() { | ||
if (!memoizedU64Decoder) | ||
memoizedU64Decoder = getU64Decoder4(); | ||
return memoizedU64Decoder; | ||
} | ||
function assertIsLamports(putativeLamports) { | ||
if (putativeLamports < 0 || putativeLamports > maxU64Value) { | ||
throw new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE); | ||
} | ||
} | ||
function lamports(putativeLamports) { | ||
assertIsLamports(putativeLamports); | ||
return putativeLamports; | ||
} | ||
function getLamportsEncoder() { | ||
return getMemoizedU64Encoder(); | ||
} | ||
function getLamportsDecoder() { | ||
return mapDecoder(getMemoizedU64Decoder(), lamports); | ||
} | ||
// src/fees.ts | ||
function getSysvarFeesEncoder() { | ||
@@ -629,15 +218,15 @@ return getStructEncoder([ | ||
8; | ||
var memoizedU64Encoder2; | ||
var memoizedU64Decoder2; | ||
var memoizedU64Encoder; | ||
var memoizedU64Decoder; | ||
var memoizedU64ArrayEncoder; | ||
var memoizedU64ArrayDecoder; | ||
function getMemoizedU64Encoder2() { | ||
if (!memoizedU64Encoder2) | ||
memoizedU64Encoder2 = getU64Encoder(); | ||
return memoizedU64Encoder2; | ||
function getMemoizedU64Encoder() { | ||
if (!memoizedU64Encoder) | ||
memoizedU64Encoder = getU64Encoder(); | ||
return memoizedU64Encoder; | ||
} | ||
function getMemoizedU64Decoder2() { | ||
if (!memoizedU64Decoder2) | ||
memoizedU64Decoder2 = getU64Decoder(); | ||
return memoizedU64Decoder2; | ||
function getMemoizedU64Decoder() { | ||
if (!memoizedU64Decoder) | ||
memoizedU64Decoder = getU64Decoder(); | ||
return memoizedU64Decoder; | ||
} | ||
@@ -655,3 +244,3 @@ function getMemoizedU64ArrayEncoder() { | ||
function getSysvarSlotHistoryEncoder() { | ||
return createEncoder$1({ | ||
return createEncoder({ | ||
fixedSize: SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE, | ||
@@ -661,9 +250,9 @@ write: (value, bytes, offset) => { | ||
offset += 1; | ||
getMemoizedU64Encoder2().write(BigInt(BITVEC_LENGTH), bytes, offset); | ||
getMemoizedU64Encoder().write(BigInt(BITVEC_LENGTH), bytes, offset); | ||
offset += 8; | ||
getMemoizedU64ArrayEncoder().write(value.bits, bytes, offset); | ||
offset += BITVEC_LENGTH * 8; | ||
getMemoizedU64Encoder2().write(BigInt(BITVEC_NUM_BITS), bytes, offset); | ||
getMemoizedU64Encoder().write(BigInt(BITVEC_NUM_BITS), bytes, offset); | ||
offset += 8; | ||
getMemoizedU64Encoder2().write(value.nextSlot, bytes, offset); | ||
getMemoizedU64Encoder().write(value.nextSlot, bytes, offset); | ||
offset += 8; | ||
@@ -675,3 +264,3 @@ return offset; | ||
function getSysvarSlotHistoryDecoder() { | ||
return createDecoder$1({ | ||
return createDecoder({ | ||
fixedSize: SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE, | ||
@@ -693,3 +282,3 @@ read: (bytes, offset) => { | ||
} | ||
const bitVecLength = getMemoizedU64Decoder2().read(bytes, offset)[0]; | ||
const bitVecLength = getMemoizedU64Decoder().read(bytes, offset)[0]; | ||
offset += 8; | ||
@@ -705,3 +294,3 @@ if (bitVecLength !== BigInt(BITVEC_LENGTH)) { | ||
offset += BITVEC_LENGTH * 8; | ||
const numBits = getMemoizedU64Decoder2().read(bytes, offset)[0]; | ||
const numBits = getMemoizedU64Decoder().read(bytes, offset)[0]; | ||
offset += 8; | ||
@@ -715,3 +304,3 @@ if (numBits !== BigInt(BITVEC_NUM_BITS)) { | ||
} | ||
const nextSlot = getMemoizedU64Decoder2().read(bytes, offset)[0]; | ||
const nextSlot = getMemoizedU64Decoder().read(bytes, offset)[0]; | ||
offset += 8; | ||
@@ -718,0 +307,0 @@ return [ |
{ | ||
"name": "@solana/sysvars", | ||
"version": "2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22", | ||
"version": "2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e", | ||
"description": "An abstraction layer over signing messages and transactions in Solana", | ||
@@ -52,5 +52,6 @@ "exports": { | ||
"dependencies": { | ||
"@solana/accounts": "2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22", | ||
"@solana/codecs": "2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22", | ||
"@solana/errors": "2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22" | ||
"@solana/accounts": "2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e", | ||
"@solana/codecs": "2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e", | ||
"@solana/errors": "2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e", | ||
"@solana/rpc-types": "2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e" | ||
}, | ||
@@ -57,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
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
328291
4
2176
+ Added@solana/rpc-types@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e
+ Added@solana/accounts@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/addresses@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/assertions@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/codecs@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/codecs-core@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/codecs-data-structures@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/codecs-numbers@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/codecs-strings@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/errors@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/options@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/rpc-spec@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/rpc-spec-types@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
+ Added@solana/rpc-types@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e(transitive)
- Removed@solana/accounts@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/addresses@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/assertions@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/codecs@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/codecs-core@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/codecs-data-structures@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/codecs-numbers@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/codecs-strings@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/errors@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/options@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/rpc-spec@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/rpc-spec-types@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
- Removed@solana/rpc-types@2.0.0-preview.1.20240322203334.65f262cbb9e37c350bb1fcbbea693d75e1147a22(transitive)
Updated@solana/accounts@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e
Updated@solana/codecs@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e
Updated@solana/errors@2.0.0-preview.1.20240323014038.94f2053250ed5d78cd55951bdec72ef7795e528e