@solana/sysvars 2.0.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +17 -0
- package/dist/index.browser.cjs +813 -0
- package/dist/index.browser.cjs.map +1 -0
- package/dist/index.browser.js +759 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.native.js +759 -0
- package/dist/index.native.js.map +1 -0
- package/dist/index.node.cjs +813 -0
- package/dist/index.node.cjs.map +1 -0
- package/dist/index.node.js +759 -0
- package/dist/index.node.js.map +1 -0
- package/dist/types/clock.d.ts +30 -0
- package/dist/types/clock.d.ts.map +1 -0
- package/dist/types/epoch-rewards.d.ts +42 -0
- package/dist/types/epoch-rewards.d.ts.map +1 -0
- package/dist/types/epoch-schedule.d.ts +29 -0
- package/dist/types/epoch-schedule.d.ts.map +1 -0
- package/dist/types/fees.d.ts +28 -0
- package/dist/types/fees.d.ts.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/last-restart-slot.d.ts +33 -0
- package/dist/types/last-restart-slot.d.ts.map +1 -0
- package/dist/types/recent-blockhashes.d.ts +29 -0
- package/dist/types/recent-blockhashes.d.ts.map +1 -0
- package/dist/types/rent.d.ts +27 -0
- package/dist/types/rent.d.ts.map +1 -0
- package/dist/types/slot-hashes.d.ts +26 -0
- package/dist/types/slot-hashes.d.ts.map +1 -0
- package/dist/types/slot-history.d.ts +27 -0
- package/dist/types/slot-history.d.ts.map +1 -0
- package/dist/types/stake-history.d.ts +27 -0
- package/dist/types/stake-history.d.ts.map +1 -0
- package/dist/types/sysvar.d.ts +33 -0
- package/dist/types/sysvar.d.ts.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/clock.ts","../src/sysvar.ts","../src/epoch-rewards.ts","../src/epoch-schedule.ts","../src/fees.ts","../../codecs-core/src/assertions.ts","../../codecs-core/src/bytes.ts","../../codecs-core/src/codec.ts","../../codecs-core/src/combine-codec.ts","../../codecs-core/src/fix-codec.ts","../../codecs-numbers/src/assertions.ts","../../codecs-numbers/src/f32.ts","../../codecs-numbers/src/utils.ts","../../codecs-numbers/src/u128.ts","../../codecs-numbers/src/u16.ts","../../codecs-strings/src/assertions.ts","../../codecs-strings/src/baseX.ts","../../codecs-strings/src/base16.ts","../../codecs-strings/src/baseX-reslice.ts","../../codecs-strings/src/base64.ts","../../codecs-strings/src/null-characters.ts","../../codecs-strings/src/string.ts","../../rpc-types/src/blockhash.ts","../../rpc-types/src/commitment.ts","../../rpc-types/src/lamports.ts","../src/last-restart-slot.ts","../src/recent-blockhashes.ts","../src/rent.ts","../src/slot-hashes.ts","../src/slot-history.ts","../src/stake-history.ts"],"names":["assertAccountExists","decodeAccount","combineCodec","getStructDecoder","getStructEncoder","getU64Decoder","getU64Encoder","SolanaError","alphabet","createDecoder","createEncoder","getEncodedSize","isFixedSize","getArrayDecoder","getArrayEncoder","SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH","memoizedU64Encoder","memoizedU64Decoder","getMemoizedU64Encoder","getMemoizedU64Decoder"],"mappings":";AAAA,SAAS,qBAAqB,qBAA8C;AAC5E;AAAA,EACI;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;;;ACZP;AAAA,EAEI;AAAA,EACA;AAAA,OAGG;AAMA,IAAM,uBACT;AACG,IAAM,+BACT;AACG,IAAM,gCACT;AACG,IAAM,sBACT;AACG,IAAM,8BACT;AACG,IAAM,mCACT;AACG,IAAM,oCACT;AACG,IAAM,sBACT;AACG,IAAM,6BACT;AACG,IAAM,8BACT;AACG,IAAM,+BACT;AAqBJ,eAAsB,0BAClB,KACA,SACA,QACsC;AACtC,SAAO,oBAA8B,KAAK,SAAS,MAAM;AAC7D;AAQA,eAAsB,6BAClB,KACA,SACA,QACwF;AACxF,SAAO,uBAA0D,KA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ccount, type FetchAccountConfig } from '@solana/accounts';\nimport {\n combineCodec,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n getI64Decoder,\n getI64Encoder,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n} from '@solana/codecs';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { Rpc } from '@solana/rpc-spec';\nimport type { Epoch, Slot } from '@solana/rpc-types';\n\nimport { fetchEncodedSysvarAccount, SYSVAR_CLOCK_ADDRESS } from './sysvar';\n\ntype UnixTimestamp = bigint;\n\ntype SysvarClockSize = 40;\n\n/**\n * The `Clock` sysvar.\n *\n * Information about the network’s clock, ticks, slots, etc.\n */\nexport type SysvarClock = Readonly<{\n epoch: Epoch;\n epochStartTimestamp: UnixTimestamp;\n leaderScheduleEpoch: Epoch;\n slot: Slot;\n unixTimestamp: UnixTimestamp;\n}>;\n\nexport function getSysvarClockEncoder(): FixedSizeEncoder<SysvarClock, SysvarClockSize> {\n return getStructEncoder([\n ['slot', getU64Encoder()],\n ['epochStartTimestamp', getI64Encoder()],\n ['epoch', getU64Encoder()],\n ['leaderScheduleEpoch', getU64Encoder()],\n ['unixTimestamp', getI64Encoder()],\n ]) as FixedSizeEncoder<SysvarClock, SysvarClockSize>;\n}\n\nexport function getSysvarClockDecoder(): FixedSizeDecoder<SysvarClock, SysvarClockSize> {\n return getStructDecoder([\n ['slot', getU64Decoder()],\n ['epochStartTimestamp', getI64Decoder()],\n ['epoch', getU64Decoder()],\n ['leaderScheduleEpoch', getU64Decoder()],\n ['unixTimestamp', getI64Decoder()],\n ]) as FixedSizeDecoder<SysvarClock, SysvarClockSize>;\n}\n\nexport function getSysvarClockCodec(): FixedSizeCodec<SysvarClock, SysvarClock, SysvarClockSize> {\n return combineCodec(getSysvarClockEncoder(), getSysvarClockDecoder());\n}\n\n/**\n * Fetch the `Clock` sysvar.\n *\n * Information about the network’s clock, ticks, slots, etc.\n */\nexport async function fetchSysvarClock(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarClock> {\n const account = await fetchEncodedSysvarAccount(rpc, SYSVAR_CLOCK_ADDRESS, config);\n assertAccountExists(account);\n const decoded = decodeAccount(account, getSysvarClockDecoder());\n return decoded.data;\n}\n","import {\n type FetchAccountConfig,\n fetchEncodedAccount,\n fetchJsonParsedAccount,\n type MaybeAccount,\n type MaybeEncodedAccount,\n} from '@solana/accounts';\nimport type { Address } from '@solana/addresses';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { JsonParsedSysvarAccount } from '@solana/rpc-parsed-types';\nimport type { Rpc } from '@solana/rpc-spec';\n\nexport const SYSVAR_CLOCK_ADDRESS =\n 'SysvarC1ock11111111111111111111111111111111' as Address<'SysvarC1ock11111111111111111111111111111111'>;\nexport const SYSVAR_EPOCH_REWARDS_ADDRESS =\n 'SysvarEpochRewards1111111111111111111111111' as Address<'SysvarEpochRewards1111111111111111111111111'>;\nexport const SYSVAR_EPOCH_SCHEDULE_ADDRESS =\n 'SysvarEpochSchedu1e111111111111111111111111' as Address<'SysvarEpochSchedu1e111111111111111111111111'>;\nexport const SYSVAR_FEES_ADDRESS =\n 'SysvarFees111111111111111111111111111111111' as Address<'SysvarFees111111111111111111111111111111111'>;\nexport const SYSVAR_INSTRUCTIONS_ADDRESS =\n 'Sysvar1nstructions1111111111111111111111111' as Address<'Sysvar1nstructions1111111111111111111111111'>;\nexport const SYSVAR_LAST_RESTART_SLOT_ADDRESS =\n 'SysvarLastRestartS1ot1111111111111111111111' as Address<'SysvarLastRestartS1ot1111111111111111111111'>;\nexport const SYSVAR_RECENT_BLOCKHASHES_ADDRESS =\n 'SysvarRecentB1ockHashes11111111111111111111' as Address<'SysvarRecentB1ockHashes11111111111111111111'>;\nexport const SYSVAR_RENT_ADDRESS =\n 'SysvarRent111111111111111111111111111111111' as Address<'SysvarRent111111111111111111111111111111111'>;\nexport const SYSVAR_SLOT_HASHES_ADDRESS =\n 'SysvarS1otHashes111111111111111111111111111' as Address<'SysvarS1otHashes111111111111111111111111111'>;\nexport const SYSVAR_SLOT_HISTORY_ADDRESS =\n 'SysvarS1otHistory11111111111111111111111111' as Address<'SysvarS1otHistory11111111111111111111111111'>;\nexport const SYSVAR_STAKE_HISTORY_ADDRESS =\n 'SysvarStakeHistory1111111111111111111111111' as Address<'SysvarStakeHistory1111111111111111111111111'>;\n\ntype SysvarAddress =\n | typeof SYSVAR_CLOCK_ADDRESS\n | typeof SYSVAR_EPOCH_REWARDS_ADDRESS\n | typeof SYSVAR_EPOCH_SCHEDULE_ADDRESS\n | typeof SYSVAR_FEES_ADDRESS\n | typeof SYSVAR_INSTRUCTIONS_ADDRESS\n | typeof SYSVAR_LAST_RESTART_SLOT_ADDRESS\n | typeof SYSVAR_RECENT_BLOCKHASHES_ADDRESS\n | typeof SYSVAR_RENT_ADDRESS\n | typeof SYSVAR_SLOT_HASHES_ADDRESS\n | typeof SYSVAR_SLOT_HISTORY_ADDRESS\n | typeof SYSVAR_STAKE_HISTORY_ADDRESS;\n\n/**\n * Fetch an encoded sysvar account.\n *\n * Sysvars are special accounts that contain dynamically-updated data about the\n * network cluster, the blockchain history, and the executing transaction.\n */\nexport async function fetchEncodedSysvarAccount<TAddress extends SysvarAddress>(\n rpc: Rpc<GetAccountInfoApi>,\n address: TAddress,\n config?: FetchAccountConfig,\n): Promise<MaybeEncodedAccount<TAddress>> {\n return fetchEncodedAccount<TAddress>(rpc, address, config);\n}\n\n/**\n * Fetch a JSON-parsed sysvar account.\n *\n * Sysvars are special accounts that contain dynamically-updated data about the\n * network cluster, the blockchain history, and the executing transaction.\n */\nexport async function fetchJsonParsedSysvarAccount<TAddress extends SysvarAddress>(\n rpc: Rpc<GetAccountInfoApi>,\n address: TAddress,\n config?: FetchAccountConfig,\n): Promise<MaybeAccount<JsonParsedSysvarAccount, TAddress> | MaybeEncodedAccount<TAddress>> {\n return fetchJsonParsedAccount<JsonParsedSysvarAccount, TAddress>(rpc, address, config);\n}\n","import { assertAccountExists, decodeAccount, type FetchAccountConfig } from '@solana/accounts';\nimport {\n combineCodec,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n} from '@solana/codecs';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { Rpc } from '@solana/rpc-spec';\n\nimport { fetchEncodedSysvarAccount, SYSVAR_EPOCH_REWARDS_ADDRESS } from './sysvar';\n\ntype SysvarEpochRewardsSize = 24;\n\n/**\n * The `EpochRewards` sysvar.\n *\n * Tracks the progress of epoch rewards distribution. It includes:\n * - Total rewards for the current epoch, in lamports.\n * - Rewards for the current epoch distributed so far, in lamports.\n * - Distribution completed block height, i.e. distribution of all staking rewards for the current\n * epoch will be completed at this block height.\n *\n * Note that `EpochRewards` only lasts for a handful of blocks at the start of\n * an epoch. When all rewards have been distributed, the sysvar is deleted.\n * See https://github.com/solana-labs/solana/blob/e0203f22dc83cb792fa97f91dbe6e924cbd08af1/docs/src/runtime/sysvars.md?plain=1#L155-L168\n */\nexport type SysvarEpochRewards = Readonly<{\n distributedRewards: bigint;\n distributionCompleteBlockHeight: bigint;\n totalRewards: bigint;\n}>;\n\nexport function getSysvarEpochRewardsEncoder(): FixedSizeEncoder<SysvarEpochRewards, SysvarEpochRewardsSize> {\n return getStructEncoder([\n ['distributionCompleteBlockHeight', getU64Encoder()],\n ['distributedRewards', getU64Encoder()],\n ['totalRewards', getU64Encoder()],\n ]) as FixedSizeEncoder<SysvarEpochRewards, SysvarEpochRewardsSize>;\n}\n\nexport function getSysvarEpochRewardsDecoder(): FixedSizeDecoder<SysvarEpochRewards, SysvarEpochRewardsSize> {\n return getStructDecoder([\n ['distributionCompleteBlockHeight', getU64Decoder()],\n ['distributedRewards', getU64Decoder()],\n ['totalRewards', getU64Decoder()],\n ]) as FixedSizeDecoder<SysvarEpochRewards, SysvarEpochRewardsSize>;\n}\n\nexport function getSysvarEpochRewardsCodec(): FixedSizeCodec<\n SysvarEpochRewards,\n SysvarEpochRewards,\n SysvarEpochRewardsSize\n> {\n return combineCodec(getSysvarEpochRewardsEncoder(), getSysvarEpochRewardsDecoder());\n}\n\n/**\n * Fetch the `EpochRewards` sysvar.\n *\n * Tracks the progress of epoch rewards distribution. It includes:\n * - Total rewards for the current epoch, in lamports.\n * - Rewards for the current epoch distributed so far, in lamports.\n * - Distribution completed block height, i.e. distribution of all staking rewards for the current\n * epoch will be completed at this block height.\n *\n * Note that `EpochRewards` only lasts for a handful of blocks at the start of\n * an epoch. When all rewards have been distributed, the sysvar is deleted.\n * See https://github.com/solana-labs/solana/blob/e0203f22dc83cb792fa97f91dbe6e924cbd08af1/docs/src/runtime/sysvars.md?plain=1#L155-L168\n */\nexport async function fetchSysvarEpochRewards(\n rpc: Rpc<GetAccountInfoApi>,\n config?: FetchAccountConfig,\n): Promise<SysvarEpochRewards> {\n const account = await fetchEncodedSysvarAccount(rpc, SYSVAR_EPOCH_REWARDS_ADDRESS, config);\n assertAccountExists(account);\n const decoded = decodeAccount(account, getSysvarEpochRewardsDecoder());\n return decoded.data;\n}\n","import { assertAccountExists, decodeAccount, type FetchAccountConfig } from '@solana/accounts';\nimport {\n combineCodec,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n getBooleanDecoder,\n getBooleanEncoder,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n} from '@solana/codecs';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { Rpc } from '@solana/rpc-spec';\nimport type { Epoch, Slot } from '@solana/rpc-types';\n\nimport { fetchEncodedSysvarAccount, SYSVAR_EPOCH_SCHEDULE_ADDRESS } from './sysvar';\n\ntype SysvarEpochScheduleSize = 33;\n\n/**\n * The `EpochSchedule` sysvar.\n *\n * Information about epoch duration.\n */\nexport type SysvarEpochSchedule = Readonly<{\n firstNormalEpoch: Epoch;\n firstNormalSlot: Slot;\n leaderScheduleSlotOffset: bigint;\n slotsPerEpoch: bigint;\n warmup: boolean;\n}>;\n\nexport function getSysvarEpochScheduleEncoder(): FixedSizeEncoder<SysvarEpochSchedule, SysvarEpochScheduleSize> {\n return getStructEncoder([\n ['slotsPerEpoch', getU64Encoder()],\n ['leaderScheduleSlotOffset', getU64Encoder()],\n ['warmup', getBooleanEncoder()],\n ['firstNormalEpoch', getU64Encoder()],\n ['firstNormalSlot', getU64Encoder()],\n ]) as FixedSizeEncoder<SysvarEpochSchedule, SysvarEpochScheduleSize>;\n}\n\nexport function getSysvarEpochScheduleDecoder(): FixedSizeDecoder<SysvarEpochSchedule, SysvarEpochScheduleSize> {\n return getStructDecoder([\n ['slotsPerEpoch', getU64Decoder()],\n ['leaderScheduleSlotOffset', getU64Decoder()],\n ['warmup', getBooleanDecoder()],\n ['firstNormalEpoch', getU64Decoder()],\n ['firstNormalSlot', getU64Decoder()],\n ]) as FixedSizeDecoder<SysvarEpochSchedule, SysvarEpochScheduleSize>;\n}\n\nexport function getSysvarEpochScheduleCodec(): FixedSizeCodec<\n SysvarEpochSchedule,\n SysvarEpochSchedule,\n SysvarEpochScheduleSize\n> {\n return combineCodec(getSysvarEpochScheduleEncoder(), getSysvarEpochScheduleDecoder());\n}\n\n/**\n * Fetch the `EpochSchedule` sysvar.\n *\n * Information about epoch duration.\n */\nexport async function fetchSysvarEpochSchedule(\n rpc: Rpc<GetAccountInfoApi>,\n config?: FetchAccountConfig,\n): Promise<SysvarEpochSchedule> {\n const account = await fetchEncodedSysvarAccount(rpc, SYSVAR_EPOCH_SCHEDULE_ADDRESS, config);\n assertAccountExists(account);\n const decoded = decodeAccount(account, getSysvarEpochScheduleDecoder());\n return decoded.data;\n}\n","import { assertAccountExists, decodeAccount, type FetchAccountConfig } from '@solana/accounts';\nimport {\n combineCodec,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n getStructDecoder,\n getStructEncoder,\n} from '@solana/codecs';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { Rpc } from '@solana/rpc-spec';\nimport { getLamportsDecoder, getLamportsEncoder, LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types';\n\nimport { fetchEncodedSysvarAccount, SYSVAR_FEES_ADDRESS } from './sysvar';\n\ntype FeeCalculator = Readonly<{\n lamportsPerSignature: LamportsUnsafeBeyond2Pow53Minus1;\n}>;\n\ntype SysvarFeesSize = 8;\n\n/**\n * The `Fees` sysvar.\n *\n * Current cluster fees.\n */\nexport type SysvarFees = Readonly<{\n feeCalculator: FeeCalculator;\n}>;\n\nexport function getSysvarFeesEncoder(): FixedSizeEncoder<SysvarFees, SysvarFeesSize> {\n return getStructEncoder([\n ['feeCalculator', getStructEncoder([['lamportsPerSignature', getLamportsEncoder()]])],\n ]) as FixedSizeEncoder<SysvarFees, SysvarFeesSize>;\n}\n\nexport function getSysvarFeesDecoder(): FixedSizeDecoder<SysvarFees, SysvarFeesSize> {\n return getStructDecoder([\n ['feeCalculator', getStructDecoder([['lamportsPerSignature', getLamportsDecoder()]])],\n ]) as FixedSizeDecoder<SysvarFees, SysvarFeesSize>;\n}\n\nexport function getSysvarFeesCodec(): FixedSizeCodec<SysvarFees, SysvarFees, SysvarFeesSize> {\n return combineCodec(getSysvarFeesEncoder(), getSysvarFeesDecoder());\n}\n\n/**\n * Fetch the `Fees` sysvar.\n *\n * Current cluster fees.\n */\nexport async function fetchSysvarFees(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarFees> {\n const account = await fetchEncodedSysvarAccount(rpc, SYSVAR_FEES_ADDRESS, config);\n assertAccountExists(account);\n const decoded = decodeAccount(account, getSysvarFeesDecoder());\n return decoded.data;\n}\n","import {\n SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY,\n SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH,\n SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE,\n SolanaError,\n} from '@solana/errors';\n\n/**\n * Asserts that a given byte array is not empty.\n */\nexport function assertByteArrayIsNotEmptyForCodec(codecDescription: string, bytes: Uint8Array, offset = 0) {\n if (bytes.length - offset <= 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, {\n codecDescription,\n });\n }\n}\n\n/**\n * Asserts that a given byte array has enough bytes to decode.\n */\nexport function assertByteArrayHasEnoughBytesForCodec(\n codecDescription: string,\n expected: number,\n bytes: Uint8Array,\n offset = 0,\n) {\n const bytesLength = bytes.length - offset;\n if (bytesLength < expected) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, {\n bytesLength,\n codecDescription,\n expected,\n });\n }\n}\n\n/**\n * Asserts that a given offset is within the byte array bounds.\n * This range is between 0 and the byte array length and is inclusive.\n * An offset equals to the byte array length is considered a valid offset\n * as it allows the post-offset of codecs to signal the end of the byte array.\n */\nexport function assertByteArrayOffsetIsNotOutOfRange(codecDescription: string, offset: number, bytesLength: number) {\n if (offset < 0 || offset > bytesLength) {\n throw new SolanaError(SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE, {\n bytesLength,\n codecDescription,\n offset,\n });\n }\n}\n","/**\n * Concatenates an array of `Uint8Array`s into a single `Uint8Array`.\n * Reuses the original byte array when applicable.\n */\nexport const mergeBytes = (byteArrays: Uint8Array[]): Uint8Array => {\n const nonEmptyByteArrays = byteArrays.filter(arr => arr.length);\n if (nonEmptyByteArrays.length === 0) {\n return byteArrays.length ? byteArrays[0] : new Uint8Array();\n }\n\n if (nonEmptyByteArrays.length === 1) {\n return nonEmptyByteArrays[0];\n }\n\n const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0);\n const result = new Uint8Array(totalLength);\n let offset = 0;\n nonEmptyByteArrays.forEach(arr => {\n result.set(arr, offset);\n offset += arr.length;\n });\n return result;\n};\n\n/**\n * Pads a `Uint8Array` with zeroes to the specified length.\n * If the array is longer than the specified length, it is returned as-is.\n */\nexport const padBytes = (bytes: Uint8Array, length: number): Uint8Array => {\n if (bytes.length >= length) return bytes;\n const paddedBytes = new Uint8Array(length).fill(0);\n paddedBytes.set(bytes);\n return paddedBytes;\n};\n\n/**\n * Fixes a `Uint8Array` to the specified length.\n * If the array is longer than the specified length, it is truncated.\n * If the array is shorter than the specified length, it is padded with zeroes.\n */\nexport const fixBytes = (bytes: Uint8Array, length: number): Uint8Array =>\n padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);\n","import {\n SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH,\n SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH,\n SolanaError,\n} from '@solana/errors';\n\n/**\n * Defines an offset in bytes.\n */\nexport type Offset = number;\n\ntype BaseEncoder<TFrom> = {\n /** Encode the provided value and return the encoded bytes directly. */\n readonly encode: (value: TFrom) => Uint8Array;\n /**\n * Writes the encoded value into the provided byte array at the given offset.\n * Returns the offset of the next byte after the encoded value.\n */\n readonly write: (value: TFrom, bytes: Uint8Array, offset: Offset) => Offset;\n};\n\nexport type FixedSizeEncoder<TFrom, TSize extends number = number> = BaseEncoder<TFrom> & {\n /** The fixed size of the encoded value in bytes. */\n readonly fixedSize: TSize;\n};\n\nexport type VariableSizeEncoder<TFrom> = BaseEncoder<TFrom> & {\n /** The total size of the encoded value in bytes. */\n readonly getSizeFromValue: (value: TFrom) => number;\n /** The maximum size an encoded value can be in bytes, if applicable. */\n readonly maxSize?: number;\n};\n\n/**\n * An object that can encode a value to a `Uint8Array`.\n */\nexport type Encoder<TFrom> = FixedSizeEncoder<TFrom> | VariableSizeEncoder<TFrom>;\n\ntype BaseDecoder<TTo> = {\n /** Decodes the provided byte array at the given offset (or zero) and returns the value directly. */\n readonly decode: (bytes: Uint8Array, offset?: Offset) => TTo;\n /**\n * Reads the encoded value from the provided byte array at the given offset.\n * Returns the decoded value and the offset of the next byte after the encoded value.\n */\n readonly read: (bytes: Uint8Array, offset: Offset) => [TTo, Offset];\n};\n\nexport type FixedSizeDecoder<TTo, TSize extends number = number> = BaseDecoder<TTo> & {\n /** The fixed size of the encoded value in bytes. */\n readonly fixedSize: TSize;\n};\n\nexport type VariableSizeDecoder<TTo> = BaseDecoder<TTo> & {\n /** The maximum size an encoded value can be in bytes, if applicable. */\n readonly maxSize?: number;\n};\n\n/**\n * An object that can decode a value from a `Uint8Array`.\n */\nexport type Decoder<TTo> = FixedSizeDecoder<TTo> | VariableSizeDecoder<TTo>;\n\nexport type FixedSizeCodec<TFrom, TTo extends TFrom = TFrom, TSize extends number = number> = FixedSizeDecoder<\n TTo,\n TSize\n> &\n FixedSizeEncoder<TFrom, TSize>;\n\nexport type VariableSizeCodec<TFrom, TTo extends TFrom = TFrom> = VariableSizeDecoder<TTo> & VariableSizeEncoder<TFrom>;\n\n/**\n * An object that can encode and decode a value to and from a `Uint8Array`.\n * It supports encoding looser types than it decodes for convenience.\n * For example, a `bigint` encoder will always decode to a `bigint`\n * but can be used to encode a `number`.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value. Defaults to `TFrom`.\n */\nexport type Codec<TFrom, TTo extends TFrom = TFrom> = FixedSizeCodec<TFrom, TTo> | VariableSizeCodec<TFrom, TTo>;\n\n/**\n * Get the encoded size of a given value in bytes.\n */\nexport function getEncodedSize<TFrom>(\n value: TFrom,\n encoder: { fixedSize: number } | { getSizeFromValue: (value: TFrom) => number },\n): number {\n return 'fixedSize' in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);\n}\n\n/** Fills the missing `encode` function using the existing `write` function. */\nexport function createEncoder<TFrom, TSize extends number>(\n encoder: Omit<FixedSizeEncoder<TFrom, TSize>, 'encode'>,\n): FixedSizeEncoder<TFrom, TSize>;\nexport function createEncoder<TFrom>(encoder: Omit<VariableSizeEncoder<TFrom>, 'encode'>): VariableSizeEncoder<TFrom>;\nexport function createEncoder<TFrom>(\n encoder: Omit<FixedSizeEncoder<TFrom>, 'encode'> | Omit<VariableSizeEncoder<TFrom>, 'encode'>,\n): Encoder<TFrom>;\nexport function createEncoder<TFrom>(\n encoder: Omit<FixedSizeEncoder<TFrom>, 'encode'> | Omit<VariableSizeEncoder<TFrom>, 'encode'>,\n): Encoder<TFrom> {\n return Object.freeze({\n ...encoder,\n encode: value => {\n const bytes = new Uint8Array(getEncodedSize(value, encoder));\n encoder.write(value, bytes, 0);\n return bytes;\n },\n });\n}\n\n/** Fills the missing `decode` function using the existing `read` function. */\nexport function createDecoder<TTo, TSize extends number>(\n decoder: Omit<FixedSizeDecoder<TTo, TSize>, 'decode'>,\n): FixedSizeDecoder<TTo, TSize>;\nexport function createDecoder<TTo>(decoder: Omit<VariableSizeDecoder<TTo>, 'decode'>): VariableSizeDecoder<TTo>;\nexport function createDecoder<TTo>(\n decoder: Omit<FixedSizeDecoder<TTo>, 'decode'> | Omit<VariableSizeDecoder<TTo>, 'decode'>,\n): Decoder<TTo>;\nexport function createDecoder<TTo>(\n decoder: Omit<FixedSizeDecoder<TTo>, 'decode'> | Omit<VariableSizeDecoder<TTo>, 'decode'>,\n): Decoder<TTo> {\n return Object.freeze({\n ...decoder,\n decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0],\n });\n}\n\n/** Fills the missing `encode` and `decode` function using the existing `write` and `read` functions. */\nexport function createCodec<TFrom, TTo extends TFrom = TFrom, TSize extends number = number>(\n codec: Omit<FixedSizeCodec<TFrom, TTo, TSize>, 'decode' | 'encode'>,\n): FixedSizeCodec<TFrom, TTo, TSize>;\nexport function createCodec<TFrom, TTo extends TFrom = TFrom>(\n codec: Omit<VariableSizeCodec<TFrom, TTo>, 'decode' | 'encode'>,\n): VariableSizeCodec<TFrom, TTo>;\nexport function createCodec<TFrom, TTo extends TFrom = TFrom>(\n codec:\n | Omit<FixedSizeCodec<TFrom, TTo>, 'decode' | 'encode'>\n | Omit<VariableSizeCodec<TFrom, TTo>, 'decode' | 'encode'>,\n): Codec<TFrom, TTo>;\nexport function createCodec<TFrom, TTo extends TFrom = TFrom>(\n codec:\n | Omit<FixedSizeCodec<TFrom, TTo>, 'decode' | 'encode'>\n | Omit<VariableSizeCodec<TFrom, TTo>, 'decode' | 'encode'>,\n): Codec<TFrom, TTo> {\n return Object.freeze({\n ...codec,\n decode: (bytes, offset = 0) => codec.read(bytes, offset)[0],\n encode: value => {\n const bytes = new Uint8Array(getEncodedSize(value, codec));\n codec.write(value, bytes, 0);\n return bytes;\n },\n });\n}\n\nexport function isFixedSize<TFrom, TSize extends number>(\n encoder: FixedSizeEncoder<TFrom, TSize> | VariableSizeEncoder<TFrom>,\n): encoder is FixedSizeEncoder<TFrom, TSize>;\nexport function isFixedSize<TTo, TSize extends number>(\n decoder: FixedSizeDecoder<TTo, TSize> | VariableSizeDecoder<TTo>,\n): decoder is FixedSizeDecoder<TTo, TSize>;\nexport function isFixedSize<TFrom, TTo extends TFrom, TSize extends number>(\n codec: FixedSizeCodec<TFrom, TTo, TSize> | VariableSizeCodec<TFrom, TTo>,\n): codec is FixedSizeCodec<TFrom, TTo, TSize>;\nexport function isFixedSize<TSize extends number>(\n codec: { fixedSize: TSize } | { maxSize?: number },\n): codec is { fixedSize: TSize };\nexport function isFixedSize(codec: { fixedSize: number } | { maxSize?: number }): codec is { fixedSize: number } {\n return 'fixedSize' in codec && typeof codec.fixedSize === 'number';\n}\n\nexport function assertIsFixedSize<TFrom, TSize extends number>(\n encoder: FixedSizeEncoder<TFrom, TSize> | VariableSizeEncoder<TFrom>,\n): asserts encoder is FixedSizeEncoder<TFrom, TSize>;\nexport function assertIsFixedSize<TTo, TSize extends number>(\n decoder: FixedSizeDecoder<TTo, TSize> | VariableSizeDecoder<TTo>,\n): asserts decoder is FixedSizeDecoder<TTo, TSize>;\nexport function assertIsFixedSize<TFrom, TTo extends TFrom, TSize extends number>(\n codec: FixedSizeCodec<TFrom, TTo, TSize> | VariableSizeCodec<TFrom, TTo>,\n): asserts codec is FixedSizeCodec<TFrom, TTo, TSize>;\nexport function assertIsFixedSize<TSize extends number>(\n codec: { fixedSize: TSize } | { maxSize?: number },\n): asserts codec is { fixedSize: TSize };\nexport function assertIsFixedSize(\n codec: { fixedSize: number } | { maxSize?: number },\n): asserts codec is { fixedSize: number } {\n if (!isFixedSize(codec)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH);\n }\n}\n\nexport function isVariableSize<TFrom>(encoder: Encoder<TFrom>): encoder is VariableSizeEncoder<TFrom>;\nexport function isVariableSize<TTo>(decoder: Decoder<TTo>): decoder is VariableSizeDecoder<TTo>;\nexport function isVariableSize<TFrom, TTo extends TFrom>(\n codec: Codec<TFrom, TTo>,\n): codec is VariableSizeCodec<TFrom, TTo>;\nexport function isVariableSize(codec: { fixedSize: number } | { maxSize?: number }): codec is { maxSize?: number };\nexport function isVariableSize(codec: { fixedSize: number } | { maxSize?: number }): codec is { maxSize?: number } {\n return !isFixedSize(codec);\n}\n\nexport function assertIsVariableSize<T>(encoder: Encoder<T>): asserts encoder is VariableSizeEncoder<T>;\nexport function assertIsVariableSize<T>(decoder: Decoder<T>): asserts decoder is VariableSizeDecoder<T>;\nexport function assertIsVariableSize<TFrom, TTo extends TFrom>(\n codec: Codec<TFrom, TTo>,\n): asserts codec is VariableSizeCodec<TFrom, TTo>;\nexport function assertIsVariableSize(\n codec: { fixedSize: number } | { maxSize?: number },\n): asserts codec is { maxSize?: number };\nexport function assertIsVariableSize(\n codec: { fixedSize: number } | { maxSize?: number },\n): asserts codec is { maxSize?: number } {\n if (!isVariableSize(codec)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH);\n }\n}\n","import {\n SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH,\n SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH,\n SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH,\n SolanaError,\n} from '@solana/errors';\n\nimport {\n Codec,\n Decoder,\n Encoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n isFixedSize,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from './codec';\n\n/**\n * Combines an encoder and a decoder into a codec.\n * The encoder and decoder must have the same fixed size, max size and description.\n * If a description is provided, it will override the encoder and decoder descriptions.\n */\nexport function combineCodec<TFrom, TTo extends TFrom, TSize extends number>(\n encoder: FixedSizeEncoder<TFrom, TSize>,\n decoder: FixedSizeDecoder<TTo, TSize>,\n): FixedSizeCodec<TFrom, TTo, TSize>;\nexport function combineCodec<TFrom, TTo extends TFrom>(\n encoder: VariableSizeEncoder<TFrom>,\n decoder: VariableSizeDecoder<TTo>,\n): VariableSizeCodec<TFrom, TTo>;\nexport function combineCodec<TFrom, TTo extends TFrom>(\n encoder: Encoder<TFrom>,\n decoder: Decoder<TTo>,\n): Codec<TFrom, TTo>;\nexport function combineCodec<TFrom, TTo extends TFrom>(\n encoder: Encoder<TFrom>,\n decoder: Decoder<TTo>,\n): Codec<TFrom, TTo> {\n if (isFixedSize(encoder) !== isFixedSize(decoder)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH);\n }\n\n if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH, {\n decoderFixedSize: decoder.fixedSize,\n encoderFixedSize: encoder.fixedSize,\n });\n }\n\n if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH, {\n decoderMaxSize: decoder.maxSize,\n encoderMaxSize: encoder.maxSize,\n });\n }\n\n return {\n ...decoder,\n ...encoder,\n decode: decoder.decode,\n encode: encoder.encode,\n read: decoder.read,\n write: encoder.write,\n };\n}\n","import { assertByteArrayHasEnoughBytesForCodec } from './assertions';\nimport { fixBytes } from './bytes';\nimport {\n Codec,\n createDecoder,\n createEncoder,\n Decoder,\n Encoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n isFixedSize,\n Offset,\n} from './codec';\nimport { combineCodec } from './combine-codec';\n\n/**\n * Creates a fixed-size encoder from a given encoder.\n *\n * @param encoder - The encoder to wrap into a fixed-size encoder.\n * @param fixedBytes - The fixed number of bytes to write.\n */\nexport function fixEncoder<TFrom, TSize extends number>(\n encoder: Encoder<TFrom>,\n fixedBytes: TSize,\n): FixedSizeEncoder<TFrom, TSize> {\n return createEncoder({\n fixedSize: fixedBytes,\n write: (value: TFrom, bytes: Uint8Array, offset: Offset) => {\n // Here we exceptionally use the `encode` function instead of the `write`\n // function as using the nested `write` function on a fixed-sized byte\n // array may result in a out-of-bounds error on the nested encoder.\n const variableByteArray = encoder.encode(value);\n const fixedByteArray =\n variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;\n bytes.set(fixedByteArray, offset);\n return offset + fixedBytes;\n },\n });\n}\n\n/**\n * Creates a fixed-size decoder from a given decoder.\n *\n * @param decoder - The decoder to wrap into a fixed-size decoder.\n * @param fixedBytes - The fixed number of bytes to read.\n */\nexport function fixDecoder<TTo, TSize extends number>(\n decoder: Decoder<TTo>,\n fixedBytes: TSize,\n): FixedSizeDecoder<TTo, TSize> {\n return createDecoder({\n fixedSize: fixedBytes,\n read: (bytes: Uint8Array, offset: Offset) => {\n assertByteArrayHasEnoughBytesForCodec('fixCodec', fixedBytes, bytes, offset);\n // Slice the byte array to the fixed size if necessary.\n if (offset > 0 || bytes.length > fixedBytes) {\n bytes = bytes.slice(offset, offset + fixedBytes);\n }\n // If the nested decoder is fixed-size, pad and truncate the byte array accordingly.\n if (isFixedSize(decoder)) {\n bytes = fixBytes(bytes, decoder.fixedSize);\n }\n // Decode the value using the nested decoder.\n const [value] = decoder.read(bytes, 0);\n return [value, offset + fixedBytes];\n },\n });\n}\n\n/**\n * Creates a fixed-size codec from a given codec.\n *\n * @param codec - The codec to wrap into a fixed-size codec.\n * @param fixedBytes - The fixed number of bytes to read/write.\n */\nexport function fixCodec<TFrom, TTo extends TFrom, TSize extends number>(\n codec: Codec<TFrom, TTo>,\n fixedBytes: TSize,\n): FixedSizeCodec<TFrom, TTo, TSize> {\n return combineCodec(fixEncoder(codec, fixedBytes), fixDecoder(codec, fixedBytes));\n}\n","import { SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, SolanaError } from '@solana/errors';\n\n/**\n * Asserts that a given number is between a given range.\n */\nexport function assertNumberIsBetweenForCodec(\n codecDescription: string,\n min: bigint | number,\n max: bigint | number,\n value: bigint | number,\n) {\n if (value < min || value > max) {\n throw new SolanaError(SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, {\n codecDescription,\n max,\n min,\n value,\n });\n }\n}\n","import { combineCodec, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from '@solana/codecs-core';\n\nimport { NumberCodecConfig } from './common';\nimport { numberDecoderFactory, numberEncoderFactory } from './utils';\n\nexport const getF32Encoder = (config: NumberCodecConfig = {}): FixedSizeEncoder<number, 4> =>\n numberEncoderFactory({\n config,\n name: 'f32',\n set: (view, value, le) => view.setFloat32(0, value, le),\n size: 4,\n });\n\nexport const getF32Decoder = (config: NumberCodecConfig = {}): FixedSizeDecoder<number, 4> =>\n numberDecoderFactory({\n config,\n get: (view, le) => view.getFloat32(0, le),\n name: 'f32',\n size: 4,\n });\n\nexport const getF32Codec = (config: NumberCodecConfig = {}): FixedSizeCodec<number, number, 4> =>\n combineCodec(getF32Encoder(config), getF32Decoder(config));\n","import {\n assertByteArrayHasEnoughBytesForCodec,\n assertByteArrayIsNotEmptyForCodec,\n createDecoder,\n createEncoder,\n FixedSizeDecoder,\n FixedSizeEncoder,\n Offset,\n} from '@solana/codecs-core';\n\nimport { assertNumberIsBetweenForCodec } from './assertions';\nimport { Endian, NumberCodecConfig } from './common';\n\ntype NumberFactorySharedInput<TSize extends number> = {\n config?: NumberCodecConfig;\n name: string;\n size: TSize;\n};\n\ntype NumberFactoryEncoderInput<TFrom, TSize extends number> = NumberFactorySharedInput<TSize> & {\n range?: [bigint | number, bigint | number];\n set: (view: DataView, value: TFrom, littleEndian?: boolean) => void;\n};\n\ntype NumberFactoryDecoderInput<TTo, TSize extends number> = NumberFactorySharedInput<TSize> & {\n get: (view: DataView, littleEndian?: boolean) => TTo;\n};\n\nfunction isLittleEndian(config?: NumberCodecConfig): boolean {\n return config?.endian === Endian.BIG ? false : true;\n}\n\nexport function numberEncoderFactory<TFrom extends bigint | number, TSize extends number>(\n input: NumberFactoryEncoderInput<TFrom, TSize>,\n): FixedSizeEncoder<TFrom, TSize> {\n return createEncoder({\n fixedSize: input.size,\n write(value: TFrom, bytes: Uint8Array, offset: Offset): Offset {\n if (input.range) {\n assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);\n }\n const arrayBuffer = new ArrayBuffer(input.size);\n input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config));\n bytes.set(new Uint8Array(arrayBuffer), offset);\n return offset + input.size;\n },\n });\n}\n\nexport function numberDecoderFactory<TTo extends bigint | number, TSize extends number>(\n input: NumberFactoryDecoderInput<TTo, TSize>,\n): FixedSizeDecoder<TTo, TSize> {\n return createDecoder({\n fixedSize: input.size,\n read(bytes, offset = 0): [TTo, number] {\n assertByteArrayIsNotEmptyForCodec(input.name, bytes, offset);\n assertByteArrayHasEnoughBytesForCodec(input.name, input.size, bytes, offset);\n const view = new DataView(toArrayBuffer(bytes, offset, input.size));\n return [input.get(view, isLittleEndian(input.config)), offset + input.size];\n },\n });\n}\n\n/**\n * Helper function to ensure that the ArrayBuffer is converted properly from a Uint8Array\n * Source: https://stackoverflow.com/questions/37228285/uint8array-to-arraybuffer\n */\nfunction toArrayBuffer(bytes: Uint8Array, offset?: number, length?: number): ArrayBuffer {\n const bytesOffset = bytes.byteOffset + (offset ?? 0);\n const bytesLength = length ?? bytes.byteLength;\n return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength);\n}\n","import { combineCodec, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from '@solana/codecs-core';\n\nimport { NumberCodecConfig } from './common';\nimport { numberDecoderFactory, numberEncoderFactory } from './utils';\n\nexport const getU128Encoder = (config: NumberCodecConfig = {}): FixedSizeEncoder<bigint | number, 16> =>\n numberEncoderFactory({\n config,\n name: 'u128',\n range: [0n, BigInt('0xffffffffffffffffffffffffffffffff')],\n set: (view, value, le) => {\n const leftOffset = le ? 8 : 0;\n const rightOffset = le ? 0 : 8;\n const rightMask = 0xffffffffffffffffn;\n view.setBigUint64(leftOffset, BigInt(value) >> 64n, le);\n view.setBigUint64(rightOffset, BigInt(value) & rightMask, le);\n },\n size: 16,\n });\n\nexport const getU128Decoder = (config: NumberCodecConfig = {}): FixedSizeDecoder<bigint, 16> =>\n numberDecoderFactory({\n config,\n get: (view, le) => {\n const leftOffset = le ? 8 : 0;\n const rightOffset = le ? 0 : 8;\n const left = view.getBigUint64(leftOffset, le);\n const right = view.getBigUint64(rightOffset, le);\n return (left << 64n) + right;\n },\n name: 'u128',\n size: 16,\n });\n\nexport const getU128Codec = (config: NumberCodecConfig = {}): FixedSizeCodec<bigint | number, bigint, 16> =>\n combineCodec(getU128Encoder(config), getU128Decoder(config));\n","import { combineCodec, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from '@solana/codecs-core';\n\nimport { NumberCodecConfig } from './common';\nimport { numberDecoderFactory, numberEncoderFactory } from './utils';\n\nexport const getU16Encoder = (config: NumberCodecConfig = {}): FixedSizeEncoder<number, 2> =>\n numberEncoderFactory({\n config,\n name: 'u16',\n range: [0, Number('0xffff')],\n set: (view, value, le) => view.setUint16(0, value, le),\n size: 2,\n });\n\nexport const getU16Decoder = (config: NumberCodecConfig = {}): FixedSizeDecoder<number, 2> =>\n numberDecoderFactory({\n config,\n get: (view, le) => view.getUint16(0, le),\n name: 'u16',\n size: 2,\n });\n\nexport const getU16Codec = (config: NumberCodecConfig = {}): FixedSizeCodec<number, number, 2> =>\n combineCodec(getU16Encoder(config), getU16Decoder(config));\n","import { SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, SolanaError } from '@solana/errors';\n\n/**\n * Asserts that a given string matches a given alphabet.\n */\nexport function assertValidBaseString(alphabet: string, testValue: string, givenValue = testValue) {\n if (!testValue.match(new RegExp(`^[${alphabet}]*$`))) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {\n alphabet,\n base: alphabet.length,\n value: givenValue,\n });\n }\n}\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\n\nimport { assertValidBaseString } from './assertions';\n\n/**\n * Encodes a string using a custom alphabet by dividing\n * by the base and handling leading zeroes.\n * @see {@link getBaseXCodec} for a more detailed description.\n */\nexport const getBaseXEncoder = (alphabet: string): VariableSizeEncoder<string> => {\n return createEncoder({\n getSizeFromValue: (value: string): number => {\n const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet[0]);\n if (!tailChars) return value.length;\n\n const base10Number = getBigIntFromBaseX(tailChars, alphabet);\n return leadingZeroes.length + Math.ceil(base10Number.toString(16).length / 2);\n },\n write(value: string, bytes, offset) {\n // Check if the value is valid.\n assertValidBaseString(alphabet, value);\n if (value === '') return offset;\n\n // Handle leading zeroes.\n const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet[0]);\n if (!tailChars) {\n bytes.set(new Uint8Array(leadingZeroes.length).fill(0), offset);\n return offset + leadingZeroes.length;\n }\n\n // From baseX to base10.\n let base10Number = getBigIntFromBaseX(tailChars, alphabet);\n\n // From base10 to bytes.\n const tailBytes: number[] = [];\n while (base10Number > 0n) {\n tailBytes.unshift(Number(base10Number % 256n));\n base10Number /= 256n;\n }\n\n const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes];\n bytes.set(bytesToAdd, offset);\n return offset + bytesToAdd.length;\n },\n });\n};\n\n/**\n * Decodes a string using a custom alphabet by dividing\n * by the base and handling leading zeroes.\n * @see {@link getBaseXCodec} for a more detailed description.\n */\nexport const getBaseXDecoder = (alphabet: string): VariableSizeDecoder<string> => {\n return createDecoder({\n read(rawBytes, offset): [string, number] {\n const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);\n if (bytes.length === 0) return ['', 0];\n\n // Handle leading zeroes.\n let trailIndex = bytes.findIndex(n => n !== 0);\n trailIndex = trailIndex === -1 ? bytes.length : trailIndex;\n const leadingZeroes = alphabet[0].repeat(trailIndex);\n if (trailIndex === bytes.length) return [leadingZeroes, rawBytes.length];\n\n // From bytes to base10.\n const base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);\n\n // From base10 to baseX.\n const tailChars = getBaseXFromBigInt(base10Number, alphabet);\n\n return [leadingZeroes + tailChars, rawBytes.length];\n },\n });\n};\n\n/**\n * A string codec that requires a custom alphabet and uses\n * the length of that alphabet as the base. It then divides\n * the input by the base as many times as necessary to get\n * the output. It also supports leading zeroes by using the\n * first character of the alphabet as the zero character.\n *\n * This can be used to create codecs such as base10 or base58.\n */\nexport const getBaseXCodec = (alphabet: string): VariableSizeCodec<string> =>\n combineCodec(getBaseXEncoder(alphabet), getBaseXDecoder(alphabet));\n\nfunction partitionLeadingZeroes(\n value: string,\n zeroCharacter: string,\n): [leadingZeros: string, tailChars: string | undefined] {\n const [leadingZeros, tailChars] = value.split(new RegExp(`((?!${zeroCharacter}).*)`));\n return [leadingZeros, tailChars];\n}\n\nfunction getBigIntFromBaseX(value: string, alphabet: string): bigint {\n const base = BigInt(alphabet.length);\n let sum = 0n;\n for (const char of value) {\n sum *= base;\n sum += BigInt(alphabet.indexOf(char));\n }\n return sum;\n}\n\nfunction getBaseXFromBigInt(value: bigint, alphabet: string): string {\n const base = BigInt(alphabet.length);\n const tailChars = [];\n while (value > 0n) {\n tailChars.unshift(alphabet[Number(value % base)]);\n value /= base;\n }\n return tailChars.join('');\n}\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\n\nimport { assertValidBaseString } from './assertions';\n\n/** Encodes strings in base16. */\nexport const getBase16Encoder = (): VariableSizeEncoder<string> =>\n createEncoder({\n getSizeFromValue: (value: string) => Math.ceil(value.length / 2),\n write(value: string, bytes, offset) {\n const lowercaseValue = value.toLowerCase();\n assertValidBaseString('0123456789abcdef', lowercaseValue, value);\n const matches = lowercaseValue.match(/.{1,2}/g);\n const hexBytes = matches ? matches.map((byte: string) => parseInt(byte, 16)) : [];\n bytes.set(hexBytes, offset);\n return hexBytes.length + offset;\n },\n });\n\n/** Decodes strings in base16. */\nexport const getBase16Decoder = (): VariableSizeDecoder<string> =>\n createDecoder({\n read(bytes, offset) {\n const value = bytes.slice(offset).reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');\n return [value, bytes.length];\n },\n });\n\n/** Encodes and decodes strings in base16. */\nexport const getBase16Codec = (): VariableSizeCodec<string> => combineCodec(getBase16Encoder(), getBase16Decoder());\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\n\nimport { assertValidBaseString } from './assertions';\n\n/**\n * Encodes a string using a custom alphabet by reslicing the bits of the byte array.\n * @see {@link getBaseXResliceCodec} for a more detailed description.\n */\nexport const getBaseXResliceEncoder = (alphabet: string, bits: number): VariableSizeEncoder<string> =>\n createEncoder({\n getSizeFromValue: (value: string) => Math.floor((value.length * bits) / 8),\n write(value: string, bytes, offset) {\n assertValidBaseString(alphabet, value);\n if (value === '') return offset;\n const charIndices = [...value].map(c => alphabet.indexOf(c));\n const reslicedBytes = reslice(charIndices, bits, 8, false);\n bytes.set(reslicedBytes, offset);\n return reslicedBytes.length + offset;\n },\n });\n\n/**\n * Decodes a string using a custom alphabet by reslicing the bits of the byte array.\n * @see {@link getBaseXResliceCodec} for a more detailed description.\n */\nexport const getBaseXResliceDecoder = (alphabet: string, bits: number): VariableSizeDecoder<string> =>\n createDecoder({\n read(rawBytes, offset = 0): [string, number] {\n const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);\n if (bytes.length === 0) return ['', rawBytes.length];\n const charIndices = reslice([...bytes], 8, bits, true);\n return [charIndices.map(i => alphabet[i]).join(''), rawBytes.length];\n },\n });\n\n/**\n * A string serializer that reslices bytes into custom chunks\n * of bits that are then mapped to a custom alphabet.\n *\n * This can be used to create serializers whose alphabet\n * is a power of 2 such as base16 or base64.\n */\nexport const getBaseXResliceCodec = (alphabet: string, bits: number): VariableSizeCodec<string> =>\n combineCodec(getBaseXResliceEncoder(alphabet, bits), getBaseXResliceDecoder(alphabet, bits));\n\n/** Helper function to reslice the bits inside bytes. */\nfunction reslice(input: number[], inputBits: number, outputBits: number, useRemainder: boolean): number[] {\n const output = [];\n let accumulator = 0;\n let bitsInAccumulator = 0;\n const mask = (1 << outputBits) - 1;\n for (const value of input) {\n accumulator = (accumulator << inputBits) | value;\n bitsInAccumulator += inputBits;\n while (bitsInAccumulator >= outputBits) {\n bitsInAccumulator -= outputBits;\n output.push((accumulator >> bitsInAccumulator) & mask);\n }\n }\n if (useRemainder && bitsInAccumulator > 0) {\n output.push((accumulator << (outputBits - bitsInAccumulator)) & mask);\n }\n return output;\n}\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n mapDecoder,\n mapEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\nimport { SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, SolanaError } from '@solana/errors';\n\nimport { assertValidBaseString } from './assertions';\nimport { getBaseXResliceDecoder, getBaseXResliceEncoder } from './baseX-reslice';\n\nconst alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n/** Encodes strings in base64. */\nexport const getBase64Encoder = (): VariableSizeEncoder<string> => {\n if (__BROWSER__) {\n return createEncoder({\n getSizeFromValue: (value: string) => {\n try {\n return (atob as Window['atob'])(value).length;\n } catch (e) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {\n alphabet,\n base: 64,\n value,\n });\n }\n },\n write(value: string, bytes, offset) {\n try {\n const bytesToAdd = (atob as Window['atob'])(value)\n .split('')\n .map(c => c.charCodeAt(0));\n bytes.set(bytesToAdd, offset);\n return bytesToAdd.length + offset;\n } catch (e) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {\n alphabet,\n base: 64,\n value,\n });\n }\n },\n });\n }\n\n if (__NODEJS__) {\n return createEncoder({\n getSizeFromValue: (value: string) => Buffer.from(value, 'base64').length,\n write(value: string, bytes, offset) {\n assertValidBaseString(alphabet, value.replace(/=/g, ''));\n const buffer = Buffer.from(value, 'base64');\n bytes.set(buffer, offset);\n return buffer.length + offset;\n },\n });\n }\n\n return mapEncoder(getBaseXResliceEncoder(alphabet, 6), (value: string): string => value.replace(/=/g, ''));\n};\n\n/** Decodes strings in base64. */\nexport const getBase64Decoder = (): VariableSizeDecoder<string> => {\n if (__BROWSER__) {\n return createDecoder({\n read(bytes, offset = 0) {\n const slice = bytes.slice(offset);\n const value = (btoa as Window['btoa'])(String.fromCharCode(...slice));\n return [value, bytes.length];\n },\n });\n }\n\n if (__NODEJS__) {\n return createDecoder({\n read: (bytes, offset = 0) => [Buffer.from(bytes, offset).toString('base64'), bytes.length],\n });\n }\n\n return mapDecoder(getBaseXResliceDecoder(alphabet, 6), (value: string): string =>\n value.padEnd(Math.ceil(value.length / 4) * 4, '='),\n );\n};\n\n/** Encodes and decodes strings in base64. */\nexport const getBase64Codec = (): VariableSizeCodec<string> => combineCodec(getBase64Encoder(), getBase64Decoder());\n","/**Removes null characters from a string. */\nexport const removeNullCharacters = (value: string) =>\n // eslint-disable-next-line no-control-regex\n value.replace(/\\u0000/g, '');\n\n/** Pads a string with null characters at the end. */\nexport const padNullCharacters = (value: string, chars: number) => value.padEnd(chars, '\\u0000');\n","import {\n assertByteArrayHasEnoughBytesForCodec,\n assertByteArrayIsNotEmptyForCodec,\n Codec,\n combineCodec,\n createDecoder,\n createEncoder,\n Decoder,\n Encoder,\n fixDecoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n fixEncoder,\n getEncodedSize,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\nimport { getU32Decoder, getU32Encoder, NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';\n\nimport { getUtf8Decoder, getUtf8Encoder } from './utf8';\n\n/** Defines the config for string codecs. */\nexport type StringCodecConfig<\n TPrefix extends NumberCodec | NumberDecoder | NumberEncoder,\n TEncoding extends Codec<string> | Decoder<string> | Encoder<string>,\n> = {\n /**\n * The codec to use for encoding and decoding the content.\n * @defaultValue UTF-8 encoding.\n */\n encoding?: TEncoding;\n\n /**\n * The size of the string. It can be one of the following:\n * - a {@link NumberCodec} that prefixes the string with its size.\n * - a fixed number of bytes.\n * - or `'variable'` to use the rest of the byte array.\n * @defaultValue u32 prefix.\n */\n size?: TPrefix | number | 'variable';\n};\n\n/** Encodes strings from a given encoding and size strategy. */\nexport function getStringEncoder<TSize extends number>(\n config: StringCodecConfig<NumberEncoder, Encoder<string>> & { size: TSize },\n): FixedSizeEncoder<string, TSize>;\nexport function getStringEncoder<TSize extends number>(\n config: StringCodecConfig<NumberEncoder, Encoder<string>> & {\n encoding: FixedSizeEncoder<string, TSize>;\n size: 'variable';\n },\n): FixedSizeEncoder<string, TSize>;\nexport function getStringEncoder(\n config?: StringCodecConfig<NumberEncoder, Encoder<string>>,\n): VariableSizeEncoder<string>;\nexport function getStringEncoder(config: StringCodecConfig<NumberEncoder, Encoder<string>> = {}): Encoder<string> {\n const size = config.size ?? getU32Encoder();\n const encoding = config.encoding ?? getUtf8Encoder();\n\n if (size === 'variable') {\n return encoding;\n }\n\n if (typeof size === 'number') {\n return fixEncoder(encoding, size);\n }\n\n return createEncoder({\n getSizeFromValue: (value: string) => {\n const contentSize = getEncodedSize(value, encoding);\n return getEncodedSize(contentSize, size) + contentSize;\n },\n write: (value: string, bytes, offset) => {\n const contentSize = getEncodedSize(value, encoding);\n offset = size.write(contentSize, bytes, offset);\n return encoding.write(value, bytes, offset);\n },\n });\n}\n\n/** Decodes strings from a given encoding and size strategy. */\nexport function getStringDecoder<TSize extends number>(\n config: StringCodecConfig<NumberDecoder, Decoder<string>> & { size: TSize },\n): FixedSizeDecoder<string, TSize>;\nexport function getStringDecoder<TSize extends number>(\n config: StringCodecConfig<NumberDecoder, Decoder<string>> & {\n encoding: FixedSizeDecoder<string, TSize>;\n size: 'variable';\n },\n): FixedSizeDecoder<string, TSize>;\nexport function getStringDecoder(\n config?: StringCodecConfig<NumberDecoder, Decoder<string>>,\n): VariableSizeDecoder<string>;\nexport function getStringDecoder(config: StringCodecConfig<NumberDecoder, Decoder<string>> = {}): Decoder<string> {\n const size = config.size ?? getU32Decoder();\n const encoding = config.encoding ?? getUtf8Decoder();\n\n if (size === 'variable') {\n return encoding;\n }\n\n if (typeof size === 'number') {\n return fixDecoder(encoding, size);\n }\n\n return createDecoder({\n read: (bytes: Uint8Array, offset = 0) => {\n assertByteArrayIsNotEmptyForCodec('string', bytes, offset);\n const [lengthBigInt, lengthOffset] = size.read(bytes, offset);\n const length = Number(lengthBigInt);\n offset = lengthOffset;\n const contentBytes = bytes.slice(offset, offset + length);\n assertByteArrayHasEnoughBytesForCodec('string', length, contentBytes);\n const [value, contentOffset] = encoding.read(contentBytes, 0);\n offset += contentOffset;\n return [value, offset];\n },\n });\n}\n\n/** Encodes and decodes strings from a given encoding and size strategy. */\nexport function getStringCodec<TSize extends number>(\n config: StringCodecConfig<NumberCodec, Codec<string>> & { size: TSize },\n): FixedSizeCodec<string, string, TSize>;\nexport function getStringCodec<TSize extends number>(\n config: StringCodecConfig<NumberCodec, Codec<string>> & {\n encoding: FixedSizeCodec<string, string, TSize>;\n size: 'variable';\n },\n): FixedSizeCodec<string, string, TSize>;\nexport function getStringCodec(config?: StringCodecConfig<NumberCodec, Codec<string>>): VariableSizeCodec<string>;\nexport function getStringCodec(config: StringCodecConfig<NumberCodec, Codec<string>> = {}): Codec<string> {\n return combineCodec(getStringEncoder(config), getStringDecoder(config));\n}\n","import {\n combineCodec,\n Decoder,\n Encoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n mapEncoder,\n} from '@solana/codecs-core';\nimport { getBase58Decoder, getBase58Encoder, getStringDecoder, getStringEncoder } from '@solana/codecs-strings';\nimport {\n SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE,\n SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH,\n SolanaError,\n} from '@solana/errors';\n\nexport type Blockhash = string & { readonly __brand: unique symbol };\n\nlet memoizedBase58Encoder: Encoder<string> | undefined;\nlet memoizedBase58Decoder: Decoder<string> | undefined;\n\nfunction getMemoizedBase58Encoder(): Encoder<string> {\n if (!memoizedBase58Encoder) memoizedBase58Encoder = getBase58Encoder();\n return memoizedBase58Encoder;\n}\n\nfunction getMemoizedBase58Decoder(): Decoder<string> {\n if (!memoizedBase58Decoder) memoizedBase58Decoder = getBase58Decoder();\n return memoizedBase58Decoder;\n}\n\nexport function isBlockhash(putativeBlockhash: string): putativeBlockhash is Blockhash {\n // Fast-path; see if the input string is of an acceptable length.\n if (\n // Lowest value (32 bytes of zeroes)\n putativeBlockhash.length < 32 ||\n // Highest value (32 bytes of 255)\n putativeBlockhash.length > 44\n ) {\n return false;\n }\n // Slow-path; actually attempt to decode the input string.\n const base58Encoder = getMemoizedBase58Encoder();\n const bytes = base58Encoder.encode(putativeBlockhash);\n const numBytes = bytes.byteLength;\n if (numBytes !== 32) {\n return false;\n }\n return true;\n}\n\nexport function assertIsBlockhash(putativeBlockhash: string): asserts putativeBlockhash is Blockhash {\n // Fast-path; see if the input string is of an acceptable length.\n if (\n // Lowest value (32 bytes of zeroes)\n putativeBlockhash.length < 32 ||\n // Highest value (32 bytes of 255)\n putativeBlockhash.length > 44\n ) {\n throw new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, {\n actualLength: putativeBlockhash.length,\n });\n }\n // Slow-path; actually attempt to decode the input string.\n const base58Encoder = getMemoizedBase58Encoder();\n const bytes = base58Encoder.encode(putativeBlockhash);\n const numBytes = bytes.byteLength;\n if (numBytes !== 32) {\n throw new SolanaError(SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH, {\n actualLength: numBytes,\n });\n }\n}\n\nexport function blockhash(putativeBlockhash: string): Blockhash {\n assertIsBlockhash(putativeBlockhash);\n return putativeBlockhash as Blockhash;\n}\n\nexport function getBlockhashEncoder(): FixedSizeEncoder<Blockhash, 32> {\n return mapEncoder(getStringEncoder({ encoding: getMemoizedBase58Encoder(), size: 32 }), putativeBlockhash =>\n blockhash(putativeBlockhash),\n );\n}\n\nexport function getBlockhashDecoder(): FixedSizeDecoder<Blockhash, 32> {\n return getStringDecoder({ encoding: getMemoizedBase58Decoder(), size: 32 }) as FixedSizeDecoder<Blockhash, 32>;\n}\n\nexport function getBlockhashCodec(): FixedSizeCodec<Blockhash, Blockhash, 32> {\n return combineCodec(getBlockhashEncoder(), getBlockhashDecoder());\n}\n\nexport function getBlockhashComparator(): (x: string, y: string) => number {\n return new Intl.Collator('en', {\n caseFirst: 'lower',\n ignorePunctuation: false,\n localeMatcher: 'best fit',\n numeric: false,\n sensitivity: 'variant',\n usage: 'sort',\n }).compare;\n}\n","import { SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE, SolanaError } from '@solana/errors';\n\nexport type Commitment = 'confirmed' | 'finalized' | 'processed';\n\nfunction getCommitmentScore(commitment: Commitment): number {\n switch (commitment) {\n case 'finalized':\n return 2;\n case 'confirmed':\n return 1;\n case 'processed':\n return 0;\n default:\n throw new SolanaError(SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE, {\n unexpectedValue: commitment satisfies never,\n });\n }\n}\n\nexport function commitmentComparator(a: Commitment, b: Commitment): -1 | 0 | 1 {\n if (a === b) {\n return 0;\n }\n return getCommitmentScore(a) < getCommitmentScore(b) ? -1 : 1;\n}\n","import { combineCodec, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, mapDecoder } from '@solana/codecs-core';\nimport { getU64Decoder, getU64Encoder } from '@solana/codecs-numbers';\nimport { SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE, SolanaError } from '@solana/errors';\n\n// FIXME(solana-labs/solana/issues/30341) Beware that any value above 9007199254740991 may be\n// truncated or rounded because of a downcast to JavaScript `number` between your calling code and\n// the JSON-RPC transport.\nexport type LamportsUnsafeBeyond2Pow53Minus1 = bigint & { readonly __brand: unique symbol };\n\n// Largest possible value to be represented by a u64\nconst maxU64Value = 18446744073709551615n; // 2n ** 64n - 1n\n\nlet memoizedU64Encoder: FixedSizeEncoder<bigint, 8> | undefined;\nlet memoizedU64Decoder: FixedSizeDecoder<bigint, 8> | undefined;\n\nfunction getMemoizedU64Encoder(): FixedSizeEncoder<bigint, 8> {\n if (!memoizedU64Encoder) memoizedU64Encoder = getU64Encoder();\n return memoizedU64Encoder;\n}\n\nfunction getMemoizedU64Decoder(): FixedSizeDecoder<bigint, 8> {\n if (!memoizedU64Decoder) memoizedU64Decoder = getU64Decoder();\n return memoizedU64Decoder;\n}\n\nexport function isLamports(putativeLamports: bigint): putativeLamports is LamportsUnsafeBeyond2Pow53Minus1 {\n return putativeLamports >= 0 && putativeLamports <= maxU64Value;\n}\n\nexport function assertIsLamports(\n putativeLamports: bigint,\n): asserts putativeLamports is LamportsUnsafeBeyond2Pow53Minus1 {\n if (putativeLamports < 0 || putativeLamports > maxU64Value) {\n throw new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE);\n }\n}\n\nexport function lamports(putativeLamports: bigint): LamportsUnsafeBeyond2Pow53Minus1 {\n assertIsLamports(putativeLamports);\n return putativeLamports;\n}\n\nexport function getLamportsEncoder(): FixedSizeEncoder<LamportsUnsafeBeyond2Pow53Minus1, 8> {\n return getMemoizedU64Encoder();\n}\n\nexport function getLamportsDecoder(): FixedSizeDecoder<LamportsUnsafeBeyond2Pow53Minus1, 8> {\n return mapDecoder(getMemoizedU64Decoder(), lamports);\n}\n\nexport function getLamportsCodec(): FixedSizeCodec<\n LamportsUnsafeBeyond2Pow53Minus1,\n LamportsUnsafeBeyond2Pow53Minus1,\n 8\n> {\n return combineCodec(getLamportsEncoder(), getLamportsDecoder());\n}\n","import { assertAccountExists, decodeAccount, type FetchAccountConfig } from '@solana/accounts';\nimport {\n combineCodec,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n} from '@solana/codecs';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { Rpc } from '@solana/rpc-spec';\nimport type { Slot } from '@solana/rpc-types';\n\nimport { fetchEncodedSysvarAccount, SYSVAR_LAST_RESTART_SLOT_ADDRESS } from './sysvar';\n\ntype SysvarLastRestartSlotSize = 8;\n\n/**\n * The `LastRestartSlot` sysvar.\n *\n * Information about the last restart slot (hard fork).\n *\n * The `LastRestartSlot` sysvar provides access to the last restart slot kept in the\n * bank fork for the slot on the fork that executes the current transaction.\n * In case there was no fork it returns `0`.\n */\nexport type SysvarLastRestartSlot = Readonly<{\n lastRestartSlot: Slot;\n}>;\n\nexport function getSysvarLastRestartSlotEncoder(): FixedSizeEncoder<SysvarLastRestartSlot, SysvarLastRestartSlotSize> {\n return getStructEncoder([['lastRestartSlot', getU64Encoder()]]) as FixedSizeEncoder<\n SysvarLastRestartSlot,\n SysvarLastRestartSlotSize\n >;\n}\n\nexport function getSysvarLastRestartSlotDecoder(): FixedSizeDecoder<SysvarLastRestartSlot, SysvarLastRestartSlotSize> {\n return getStructDecoder([['lastRestartSlot', getU64Decoder()]]) as FixedSizeDecoder<\n SysvarLastRestartSlot,\n SysvarLastRestartSlotSize\n >;\n}\n\nexport function getSysvarLastRestartSlotCodec(): FixedSizeCodec<\n SysvarLastRestartSlot,\n SysvarLastRestartSlot,\n SysvarLastRestartSlotSize\n> {\n return combineCodec(getSysvarLastRestartSlotEncoder(), getSysvarLastRestartSlotDecoder());\n}\n\n/**\n * Fetch the `LastRestartSlot` sysvar.\n *\n * Information about the last restart slot (hard fork).\n *\n * The `LastRestartSlot` sysvar provides access to the last restart slot kept in the\n * bank fork for the slot on the fork that executes the current transaction.\n * In case there was no fork it returns `0`.\n */\nexport async function fetchSysvarLastRestartSlot(\n rpc: Rpc<GetAccountInfoApi>,\n config?: FetchAccountConfig,\n): Promise<SysvarLastRestartSlot> {\n const account = await fetchEncodedSysvarAccount(rpc, SYSVAR_LAST_RESTART_SLOT_ADDRESS, config);\n assertAccountExists(account);\n const decoded = decodeAccount(account, getSysvarLastRestartSlotDecoder());\n return decoded.data;\n}\n","import { assertAccountExists, decodeAccount, type FetchAccountConfig } from '@solana/accounts';\nimport {\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n type VariableSizeCodec,\n type VariableSizeDecoder,\n type VariableSizeEncoder,\n} from '@solana/codecs';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { Rpc } from '@solana/rpc-spec';\nimport {\n type Blockhash,\n getBlockhashDecoder,\n getBlockhashEncoder,\n getLamportsDecoder,\n getLamportsEncoder,\n type LamportsUnsafeBeyond2Pow53Minus1,\n} from '@solana/rpc-types';\n\nimport { fetchEncodedSysvarAccount, SYSVAR_RECENT_BLOCKHASHES_ADDRESS } from './sysvar';\n\ntype FeeCalculator = Readonly<{\n lamportsPerSignature: LamportsUnsafeBeyond2Pow53Minus1;\n}>;\ntype Entry = Readonly<{\n blockhash: Blockhash;\n feeCalculator: FeeCalculator;\n}>;\n\n/**\n * The `RecentBlockhashes` sysvar.\n *\n * Information about recent blocks and their fee calculators.\n */\nexport type SysvarRecentBlockhashes = Entry[];\n\nexport function getSysvarRecentBlockhashesEncoder(): VariableSizeEncoder<SysvarRecentBlockhashes> {\n return getArrayEncoder(\n getStructEncoder([\n ['blockhash', getBlockhashEncoder()],\n ['feeCalculator', getStructEncoder([['lamportsPerSignature', getLamportsEncoder()]])],\n ]),\n );\n}\n\nexport function getSysvarRecentBlockhashesDecoder(): VariableSizeDecoder<SysvarRecentBlockhashes> {\n return getArrayDecoder(\n getStructDecoder([\n ['blockhash', getBlockhashDecoder()],\n ['feeCalculator', getStructDecoder([['lamportsPerSignature', getLamportsDecoder()]])],\n ]),\n );\n}\n\nexport function getSysvarRecentBlockhashesCodec(): VariableSizeCodec<SysvarRecentBlockhashes> {\n return combineCodec(getSysvarRecentBlockhashesEncoder(), getSysvarRecentBlockhashesDecoder());\n}\n\n/**\n * Fetch the `RecentBlockhashes` sysvar.\n *\n * Information about recent blocks and their fee calculators.\n */\nexport async function fetchSysvarRecentBlockhashes(\n rpc: Rpc<GetAccountInfoApi>,\n config?: FetchAccountConfig,\n): Promise<SysvarRecentBlockhashes> {\n const account = await fetchEncodedSysvarAccount(rpc, SYSVAR_RECENT_BLOCKHASHES_ADDRESS, config);\n assertAccountExists(account);\n const decoded = decodeAccount(account, getSysvarRecentBlockhashesDecoder());\n return decoded.data;\n}\n","import { assertAccountExists, decodeAccount, type FetchAccountConfig } from '@solana/accounts';\nimport {\n combineCodec,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n getF64Decoder,\n getF64Encoder,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n} from '@solana/codecs';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { Rpc } from '@solana/rpc-spec';\nimport { getLamportsDecoder, getLamportsEncoder, type LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types';\n\nimport { fetchEncodedSysvarAccount, SYSVAR_RENT_ADDRESS } from './sysvar';\n\ntype SysvarRentSize = 17;\n\n/**\n * The `Rent` sysvar.\n *\n * Configuration for network rent.\n */\nexport type SysvarRent = Readonly<{\n burnPercent: number;\n exemptionThreshold: number;\n lamportsPerByteYear: LamportsUnsafeBeyond2Pow53Minus1;\n}>;\n\nexport function getSysvarRentEncoder(): FixedSizeEncoder<SysvarRent, SysvarRentSize> {\n return getStructEncoder([\n ['lamportsPerByteYear', getLamportsEncoder()],\n ['exemptionThreshold', getF64Encoder()],\n ['burnPercent', getU8Encoder()],\n ]) as FixedSizeEncoder<SysvarRent, SysvarRentSize>;\n}\n\nexport function getSysvarRentDecoder(): FixedSizeDecoder<SysvarRent, SysvarRentSize> {\n return getStructDecoder([\n ['lamportsPerByteYear', getLamportsDecoder()],\n ['exemptionThreshold', getF64Decoder()],\n ['burnPercent', getU8Decoder()],\n ]) as FixedSizeDecoder<SysvarRent, SysvarRentSize>;\n}\n\nexport function getSysvarRentCodec(): FixedSizeCodec<SysvarRent, SysvarRent, SysvarRentSize> {\n return combineCodec(getSysvarRentEncoder(), getSysvarRentDecoder());\n}\n\n/**\n * Fetch the `Rent` sysvar.\n *\n * Configuration for network rent.\n */\nexport async function fetchSysvarRent(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarRent> {\n const account = await fetchEncodedSysvarAccount(rpc, SYSVAR_RENT_ADDRESS, config);\n assertAccountExists(account);\n const decoded = decodeAccount(account, getSysvarRentDecoder());\n return decoded.data;\n}\n","import { assertAccountExists, decodeAccount, type FetchAccountConfig } from '@solana/accounts';\nimport {\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n type VariableSizeCodec,\n type VariableSizeDecoder,\n type VariableSizeEncoder,\n} from '@solana/codecs';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { Rpc } from '@solana/rpc-spec';\nimport { type Blockhash, getBlockhashDecoder, getBlockhashEncoder, type Slot } from '@solana/rpc-types';\n\nimport { fetchEncodedSysvarAccount, SYSVAR_SLOT_HASHES_ADDRESS } from './sysvar';\n\ntype Entry = Readonly<{\n hash: Blockhash;\n slot: Slot;\n}>;\n\n/**\n * The `SlotHashes` sysvar.\n *\n * The most recent hashes of a slot's parent banks.\n */\nexport type SysvarSlotHashes = Entry[];\n\nexport function getSysvarSlotHashesEncoder(): VariableSizeEncoder<SysvarSlotHashes> {\n return getArrayEncoder(\n getStructEncoder([\n ['slot', getU64Encoder()],\n ['hash', getBlockhashEncoder()],\n ]),\n );\n}\n\nexport function getSysvarSlotHashesDecoder(): VariableSizeDecoder<SysvarSlotHashes> {\n return getArrayDecoder(\n getStructDecoder([\n ['slot', getU64Decoder()],\n ['hash', getBlockhashDecoder()],\n ]),\n );\n}\n\nexport function getSysvarSlotHashesCodec(): VariableSizeCodec<SysvarSlotHashes> {\n return combineCodec(getSysvarSlotHashesEncoder(), getSysvarSlotHashesDecoder());\n}\n\n/**\n * Fetch the `SlotHashes` sysvar.\n *\n * The most recent hashes of a slot's parent banks.\n */\nexport async function fetchSysvarSlotHashes(\n rpc: Rpc<GetAccountInfoApi>,\n config?: FetchAccountConfig,\n): Promise<SysvarSlotHashes> {\n const account = await fetchEncodedSysvarAccount(rpc, SYSVAR_SLOT_HASHES_ADDRESS, config);\n assertAccountExists(account);\n const decoded = decodeAccount(account, getSysvarSlotHashesDecoder());\n return decoded.data;\n}\n","import { assertAccountExists, decodeAccount, type FetchAccountConfig } from '@solana/accounts';\nimport {\n combineCodec,\n createDecoder,\n createEncoder,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n getArrayCodec,\n getU64Codec,\n getU64Decoder,\n getU64Encoder,\n} from '@solana/codecs';\nimport {\n SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH,\n SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS,\n SolanaError,\n} from '@solana/errors';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { Rpc } from '@solana/rpc-spec';\nimport type { Slot } from '@solana/rpc-types';\n\nimport { fetchEncodedSysvarAccount, SYSVAR_SLOT_HISTORY_ADDRESS } from './sysvar';\n\nconst BITVEC_DISCRIMINATOR = 1;\n// Max number of bits in the bitvector.\n// The Solana SDK defines a constant `MAX_ENTRIES` representing the maximum\n// number of bits that can be represented by the bitvector in the `SlotHistory`\n// sysvar. This value is 1024 * 1024 = 1_048_576.\n// See https://github.com/solana-labs/solana/blob/e0203f22dc83cb792fa97f91dbe6e924cbd08af1/sdk/program/src/slot_history.rs#L43\nconst BITVEC_NUM_BITS = 1024 * 1024;\n// The length of the bitvector in blocks.\n// At 64 bits per block, this is 1024 * 1024 / 64 = 16_384.\nconst BITVEC_LENGTH = BITVEC_NUM_BITS / 64;\n\nconst SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE =\n 1 + // Discriminator\n 8 + // bitvector length (u64)\n BITVEC_LENGTH * 8 +\n 8 + // Number of bits (u64)\n 8; // Next slot (u64)\n\nlet memoizedU64Encoder: FixedSizeEncoder<bigint, 8> | undefined;\nlet memoizedU64Decoder: FixedSizeDecoder<bigint, 8> | undefined;\nlet memoizedU64ArrayEncoder: FixedSizeEncoder<bigint[]> | undefined;\nlet memoizedU64ArrayDecoder: FixedSizeDecoder<bigint[]> | undefined;\n\nfunction getMemoizedU64Encoder(): FixedSizeEncoder<bigint, 8> {\n if (!memoizedU64Encoder) memoizedU64Encoder = getU64Encoder();\n return memoizedU64Encoder;\n}\nfunction getMemoizedU64Decoder(): FixedSizeDecoder<bigint, 8> {\n if (!memoizedU64Decoder) memoizedU64Decoder = getU64Decoder();\n return memoizedU64Decoder;\n}\nfunction getMemoizedU64ArrayEncoder(): FixedSizeEncoder<bigint[], typeof BITVEC_LENGTH> {\n if (!memoizedU64ArrayEncoder) memoizedU64ArrayEncoder = getArrayCodec(getU64Codec(), { size: BITVEC_LENGTH });\n return memoizedU64ArrayEncoder;\n}\nfunction getMemoizedU64ArrayDecoder(): FixedSizeDecoder<bigint[], typeof BITVEC_LENGTH> {\n if (!memoizedU64ArrayDecoder) memoizedU64ArrayDecoder = getArrayCodec(getU64Codec(), { size: BITVEC_LENGTH });\n return memoizedU64ArrayDecoder;\n}\n\ntype SysvarSlotHistorySize = typeof SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE;\n\n/**\n * The `SlotHistory` sysvar.\n *\n * A bitvector of slots present over the last epoch.\n */\nexport type SysvarSlotHistory = {\n bits: bigint[];\n nextSlot: Slot;\n};\n\nexport function getSysvarSlotHistoryEncoder(): FixedSizeEncoder<SysvarSlotHistory, SysvarSlotHistorySize> {\n return createEncoder({\n fixedSize: SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE,\n write: (value: SysvarSlotHistory, bytes, offset) => {\n // First byte is the bitvector discriminator.\n bytes.set([BITVEC_DISCRIMINATOR], offset);\n offset += 1;\n // Next 8 bytes are the bitvector length.\n getMemoizedU64Encoder().write(BigInt(BITVEC_LENGTH), bytes, offset);\n offset += 8;\n // Next `BITVEC_LENGTH` bytes are the bitvector.\n // Any missing bits are assumed to be 0.\n getMemoizedU64ArrayEncoder().write(value.bits, bytes, offset);\n offset += BITVEC_LENGTH * 8;\n // Next 8 bytes are the number of bits.\n getMemoizedU64Encoder().write(BigInt(BITVEC_NUM_BITS), bytes, offset);\n offset += 8;\n // Next 8 bytes are the next slot.\n getMemoizedU64Encoder().write(value.nextSlot, bytes, offset);\n offset += 8;\n return offset;\n },\n });\n}\n\nexport function getSysvarSlotHistoryDecoder(): FixedSizeDecoder<SysvarSlotHistory, SysvarSlotHistorySize> {\n return createDecoder({\n fixedSize: SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE,\n read: (bytes: Uint8Array, offset) => {\n // Byte length should be exact.\n if (bytes.length != SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, {\n actual: bytes.length,\n expected: SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE,\n });\n }\n // First byte is the bitvector discriminator.\n const discriminator = bytes[offset];\n offset += 1;\n if (discriminator !== BITVEC_DISCRIMINATOR) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE, {\n actual: discriminator,\n expected: BITVEC_DISCRIMINATOR,\n });\n }\n // Next 8 bytes are the bitvector length.\n const bitVecLength = getMemoizedU64Decoder().read(bytes, offset)[0];\n offset += 8;\n if (bitVecLength !== BigInt(BITVEC_LENGTH)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS, {\n actual: bitVecLength,\n codecDescription: 'SysvarSlotHistoryCodec',\n expected: BITVEC_LENGTH,\n });\n }\n // Next `BITVEC_LENGTH` bytes are the bitvector.\n const bits = getMemoizedU64ArrayDecoder().read(bytes, offset)[0];\n offset += BITVEC_LENGTH * 8;\n // Next 8 bytes are the number of bits.\n const numBits = getMemoizedU64Decoder().read(bytes, offset)[0];\n offset += 8;\n if (numBits !== BigInt(BITVEC_NUM_BITS)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS, {\n actual: numBits,\n codecDescription: 'SysvarSlotHistoryCodec',\n expected: BITVEC_NUM_BITS,\n });\n }\n // Next 8 bytes are the next slot.\n const nextSlot = getMemoizedU64Decoder().read(bytes, offset)[0];\n offset += 8;\n return [\n {\n bits,\n nextSlot,\n },\n offset,\n ];\n },\n });\n}\n\nexport function getSysvarSlotHistoryCodec(): FixedSizeCodec<\n SysvarSlotHistory,\n SysvarSlotHistory,\n SysvarSlotHistorySize\n> {\n return combineCodec(getSysvarSlotHistoryEncoder(), getSysvarSlotHistoryDecoder());\n}\n\n/**\n * Fetch the `SlotHistory` sysvar.\n *\n * A bitvector of slots present over the last epoch.\n */\nexport async function fetchSysvarSlotHistory(\n rpc: Rpc<GetAccountInfoApi>,\n config?: FetchAccountConfig,\n): Promise<SysvarSlotHistory> {\n const account = await fetchEncodedSysvarAccount(rpc, SYSVAR_SLOT_HISTORY_ADDRESS, config);\n assertAccountExists(account);\n const decoded = decodeAccount(account, getSysvarSlotHistoryDecoder());\n return decoded.data;\n}\n","import { assertAccountExists, decodeAccount, type FetchAccountConfig } from '@solana/accounts';\nimport {\n combineCodec,\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n type VariableSizeCodec,\n type VariableSizeDecoder,\n type VariableSizeEncoder,\n} from '@solana/codecs';\nimport type { GetAccountInfoApi } from '@solana/rpc-api';\nimport type { Rpc } from '@solana/rpc-spec';\nimport { getLamportsDecoder, getLamportsEncoder, type LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types';\n\nimport { fetchEncodedSysvarAccount, SYSVAR_STAKE_HISTORY_ADDRESS } from './sysvar';\n\ntype Entry = Readonly<{\n activating: LamportsUnsafeBeyond2Pow53Minus1;\n deactivating: LamportsUnsafeBeyond2Pow53Minus1;\n effective: LamportsUnsafeBeyond2Pow53Minus1;\n}>;\n\n/**\n * The `StakeHistory` sysvar.\n *\n * History of stake activations and de-activations.\n */\nexport type SysvarStakeHistory = Entry[];\n\nexport function getSysvarStakeHistoryEncoder(): VariableSizeEncoder<SysvarStakeHistory> {\n return getArrayEncoder(\n getStructEncoder([\n ['effective', getLamportsEncoder()],\n ['activating', getLamportsEncoder()],\n ['deactivating', getLamportsEncoder()],\n ]),\n );\n}\n\nexport function getSysvarStakeHistoryDecoder(): VariableSizeDecoder<SysvarStakeHistory> {\n return getArrayDecoder(\n getStructDecoder([\n ['effective', getLamportsDecoder()],\n ['activating', getLamportsDecoder()],\n ['deactivating', getLamportsDecoder()],\n ]),\n );\n}\n\nexport function getSysvarStakeHistoryCodec(): VariableSizeCodec<SysvarStakeHistory> {\n return combineCodec(getSysvarStakeHistoryEncoder(), getSysvarStakeHistoryDecoder());\n}\n\n/**\n * Fetch the `StakeHistory` sysvar.\n *\n * History of stake activations and de-activations.\n */\nexport async function fetchSysvarStakeHistory(\n rpc: Rpc<GetAccountInfoApi>,\n config?: FetchAccountConfig,\n): Promise<SysvarStakeHistory> {\n const account = await fetchEncodedSysvarAccount(rpc, SYSVAR_STAKE_HISTORY_ADDRESS, config);\n assertAccountExists(account);\n const decoded = decodeAccount(account, getSysvarStakeHistoryDecoder());\n return decoded.data;\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type FetchAccountConfig } from '@solana/accounts';
|
|
2
|
+
import { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/codecs';
|
|
3
|
+
import type { GetAccountInfoApi } from '@solana/rpc-api';
|
|
4
|
+
import type { Rpc } from '@solana/rpc-spec';
|
|
5
|
+
import type { Epoch, Slot } from '@solana/rpc-types';
|
|
6
|
+
type UnixTimestamp = bigint;
|
|
7
|
+
type SysvarClockSize = 40;
|
|
8
|
+
/**
|
|
9
|
+
* The `Clock` sysvar.
|
|
10
|
+
*
|
|
11
|
+
* Information about the network’s clock, ticks, slots, etc.
|
|
12
|
+
*/
|
|
13
|
+
export type SysvarClock = Readonly<{
|
|
14
|
+
epoch: Epoch;
|
|
15
|
+
epochStartTimestamp: UnixTimestamp;
|
|
16
|
+
leaderScheduleEpoch: Epoch;
|
|
17
|
+
slot: Slot;
|
|
18
|
+
unixTimestamp: UnixTimestamp;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function getSysvarClockEncoder(): FixedSizeEncoder<SysvarClock, SysvarClockSize>;
|
|
21
|
+
export declare function getSysvarClockDecoder(): FixedSizeDecoder<SysvarClock, SysvarClockSize>;
|
|
22
|
+
export declare function getSysvarClockCodec(): FixedSizeCodec<SysvarClock, SysvarClock, SysvarClockSize>;
|
|
23
|
+
/**
|
|
24
|
+
* Fetch the `Clock` sysvar.
|
|
25
|
+
*
|
|
26
|
+
* Information about the network’s clock, ticks, slots, etc.
|
|
27
|
+
*/
|
|
28
|
+
export declare function fetchSysvarClock(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarClock>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/clock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAEH,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAOxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIrD,KAAK,aAAa,GAAG,MAAM,CAAC;AAE5B,KAAK,eAAe,GAAG,EAAE,CAAC;AAE1B;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,mBAAmB,EAAE,aAAa,CAAC;IACnC,mBAAmB,EAAE,KAAK,CAAC;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,aAAa,EAAE,aAAa,CAAC;CAChC,CAAC,CAAC;AAEH,wBAAgB,qBAAqB,IAAI,gBAAgB,CAAC,WAAW,EAAE,eAAe,CAAC,CAQtF;AAED,wBAAgB,qBAAqB,IAAI,gBAAgB,CAAC,WAAW,EAAE,eAAe,CAAC,CAQtF;AAED,wBAAgB,mBAAmB,IAAI,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,CAAC,CAE/F;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAKrH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type FetchAccountConfig } from '@solana/accounts';
|
|
2
|
+
import { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/codecs';
|
|
3
|
+
import type { GetAccountInfoApi } from '@solana/rpc-api';
|
|
4
|
+
import type { Rpc } from '@solana/rpc-spec';
|
|
5
|
+
type SysvarEpochRewardsSize = 24;
|
|
6
|
+
/**
|
|
7
|
+
* The `EpochRewards` sysvar.
|
|
8
|
+
*
|
|
9
|
+
* Tracks the progress of epoch rewards distribution. It includes:
|
|
10
|
+
* - Total rewards for the current epoch, in lamports.
|
|
11
|
+
* - Rewards for the current epoch distributed so far, in lamports.
|
|
12
|
+
* - Distribution completed block height, i.e. distribution of all staking rewards for the current
|
|
13
|
+
* epoch will be completed at this block height.
|
|
14
|
+
*
|
|
15
|
+
* Note that `EpochRewards` only lasts for a handful of blocks at the start of
|
|
16
|
+
* an epoch. When all rewards have been distributed, the sysvar is deleted.
|
|
17
|
+
* See https://github.com/solana-labs/solana/blob/e0203f22dc83cb792fa97f91dbe6e924cbd08af1/docs/src/runtime/sysvars.md?plain=1#L155-L168
|
|
18
|
+
*/
|
|
19
|
+
export type SysvarEpochRewards = Readonly<{
|
|
20
|
+
distributedRewards: bigint;
|
|
21
|
+
distributionCompleteBlockHeight: bigint;
|
|
22
|
+
totalRewards: bigint;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function getSysvarEpochRewardsEncoder(): FixedSizeEncoder<SysvarEpochRewards, SysvarEpochRewardsSize>;
|
|
25
|
+
export declare function getSysvarEpochRewardsDecoder(): FixedSizeDecoder<SysvarEpochRewards, SysvarEpochRewardsSize>;
|
|
26
|
+
export declare function getSysvarEpochRewardsCodec(): FixedSizeCodec<SysvarEpochRewards, SysvarEpochRewards, SysvarEpochRewardsSize>;
|
|
27
|
+
/**
|
|
28
|
+
* Fetch the `EpochRewards` sysvar.
|
|
29
|
+
*
|
|
30
|
+
* Tracks the progress of epoch rewards distribution. It includes:
|
|
31
|
+
* - Total rewards for the current epoch, in lamports.
|
|
32
|
+
* - Rewards for the current epoch distributed so far, in lamports.
|
|
33
|
+
* - Distribution completed block height, i.e. distribution of all staking rewards for the current
|
|
34
|
+
* epoch will be completed at this block height.
|
|
35
|
+
*
|
|
36
|
+
* Note that `EpochRewards` only lasts for a handful of blocks at the start of
|
|
37
|
+
* an epoch. When all rewards have been distributed, the sysvar is deleted.
|
|
38
|
+
* See https://github.com/solana-labs/solana/blob/e0203f22dc83cb792fa97f91dbe6e924cbd08af1/docs/src/runtime/sysvars.md?plain=1#L155-L168
|
|
39
|
+
*/
|
|
40
|
+
export declare function fetchSysvarEpochRewards(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarEpochRewards>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=epoch-rewards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epoch-rewards.d.ts","sourceRoot":"","sources":["../../src/epoch-rewards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAEH,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAKxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAI5C,KAAK,sBAAsB,GAAG,EAAE,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACtC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,+BAA+B,EAAE,MAAM,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC,CAAC;AAEH,wBAAgB,4BAA4B,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAM3G;AAED,wBAAgB,4BAA4B,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAM3G;AAED,wBAAgB,0BAA0B,IAAI,cAAc,CACxD,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,CACzB,CAEA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CACzC,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAC3B,MAAM,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,kBAAkB,CAAC,CAK7B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type FetchAccountConfig } from '@solana/accounts';
|
|
2
|
+
import { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/codecs';
|
|
3
|
+
import type { GetAccountInfoApi } from '@solana/rpc-api';
|
|
4
|
+
import type { Rpc } from '@solana/rpc-spec';
|
|
5
|
+
import type { Epoch, Slot } from '@solana/rpc-types';
|
|
6
|
+
type SysvarEpochScheduleSize = 33;
|
|
7
|
+
/**
|
|
8
|
+
* The `EpochSchedule` sysvar.
|
|
9
|
+
*
|
|
10
|
+
* Information about epoch duration.
|
|
11
|
+
*/
|
|
12
|
+
export type SysvarEpochSchedule = Readonly<{
|
|
13
|
+
firstNormalEpoch: Epoch;
|
|
14
|
+
firstNormalSlot: Slot;
|
|
15
|
+
leaderScheduleSlotOffset: bigint;
|
|
16
|
+
slotsPerEpoch: bigint;
|
|
17
|
+
warmup: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function getSysvarEpochScheduleEncoder(): FixedSizeEncoder<SysvarEpochSchedule, SysvarEpochScheduleSize>;
|
|
20
|
+
export declare function getSysvarEpochScheduleDecoder(): FixedSizeDecoder<SysvarEpochSchedule, SysvarEpochScheduleSize>;
|
|
21
|
+
export declare function getSysvarEpochScheduleCodec(): FixedSizeCodec<SysvarEpochSchedule, SysvarEpochSchedule, SysvarEpochScheduleSize>;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch the `EpochSchedule` sysvar.
|
|
24
|
+
*
|
|
25
|
+
* Information about epoch duration.
|
|
26
|
+
*/
|
|
27
|
+
export declare function fetchSysvarEpochSchedule(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarEpochSchedule>;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=epoch-schedule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epoch-schedule.d.ts","sourceRoot":"","sources":["../../src/epoch-schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAEH,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAOxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIrD,KAAK,uBAAuB,GAAG,EAAE,CAAC;AAElC;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACvC,gBAAgB,EAAE,KAAK,CAAC;IACxB,eAAe,EAAE,IAAI,CAAC;IACtB,wBAAwB,EAAE,MAAM,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH,wBAAgB,6BAA6B,IAAI,gBAAgB,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAQ9G;AAED,wBAAgB,6BAA6B,IAAI,gBAAgB,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAQ9G;AAED,wBAAgB,2BAA2B,IAAI,cAAc,CACzD,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,CAC1B,CAEA;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC1C,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAC3B,MAAM,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CAK9B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type FetchAccountConfig } from '@solana/accounts';
|
|
2
|
+
import { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/codecs';
|
|
3
|
+
import type { GetAccountInfoApi } from '@solana/rpc-api';
|
|
4
|
+
import type { Rpc } from '@solana/rpc-spec';
|
|
5
|
+
import { LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types';
|
|
6
|
+
type FeeCalculator = Readonly<{
|
|
7
|
+
lamportsPerSignature: LamportsUnsafeBeyond2Pow53Minus1;
|
|
8
|
+
}>;
|
|
9
|
+
type SysvarFeesSize = 8;
|
|
10
|
+
/**
|
|
11
|
+
* The `Fees` sysvar.
|
|
12
|
+
*
|
|
13
|
+
* Current cluster fees.
|
|
14
|
+
*/
|
|
15
|
+
export type SysvarFees = Readonly<{
|
|
16
|
+
feeCalculator: FeeCalculator;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function getSysvarFeesEncoder(): FixedSizeEncoder<SysvarFees, SysvarFeesSize>;
|
|
19
|
+
export declare function getSysvarFeesDecoder(): FixedSizeDecoder<SysvarFees, SysvarFeesSize>;
|
|
20
|
+
export declare function getSysvarFeesCodec(): FixedSizeCodec<SysvarFees, SysvarFees, SysvarFeesSize>;
|
|
21
|
+
/**
|
|
22
|
+
* Fetch the `Fees` sysvar.
|
|
23
|
+
*
|
|
24
|
+
* Current cluster fees.
|
|
25
|
+
*/
|
|
26
|
+
export declare function fetchSysvarFees(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarFees>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=fees.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fees.d.ts","sourceRoot":"","sources":["../../src/fees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAEH,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAGxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAA0C,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAI7G,KAAK,aAAa,GAAG,QAAQ,CAAC;IAC1B,oBAAoB,EAAE,gCAAgC,CAAC;CAC1D,CAAC,CAAC;AAEH,KAAK,cAAc,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAC9B,aAAa,EAAE,aAAa,CAAC;CAChC,CAAC,CAAC;AAEH,wBAAgB,oBAAoB,IAAI,gBAAgB,CAAC,UAAU,EAAE,cAAc,CAAC,CAInF;AAED,wBAAgB,oBAAoB,IAAI,gBAAgB,CAAC,UAAU,EAAE,cAAc,CAAC,CAInF;AAED,wBAAgB,kBAAkB,IAAI,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,CAE3F;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAKnH"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './clock.js';
|
|
2
|
+
export * from './epoch-rewards.js';
|
|
3
|
+
export * from './epoch-schedule.js';
|
|
4
|
+
export * from './fees.js';
|
|
5
|
+
export * from './last-restart-slot.js';
|
|
6
|
+
export * from './recent-blockhashes.js';
|
|
7
|
+
export * from './rent.js';
|
|
8
|
+
export * from './slot-hashes.js';
|
|
9
|
+
export * from './slot-history.js';
|
|
10
|
+
export * from './stake-history.js';
|
|
11
|
+
export * from './sysvar.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type FetchAccountConfig } from '@solana/accounts';
|
|
2
|
+
import { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/codecs';
|
|
3
|
+
import type { GetAccountInfoApi } from '@solana/rpc-api';
|
|
4
|
+
import type { Rpc } from '@solana/rpc-spec';
|
|
5
|
+
import type { Slot } from '@solana/rpc-types';
|
|
6
|
+
type SysvarLastRestartSlotSize = 8;
|
|
7
|
+
/**
|
|
8
|
+
* The `LastRestartSlot` sysvar.
|
|
9
|
+
*
|
|
10
|
+
* Information about the last restart slot (hard fork).
|
|
11
|
+
*
|
|
12
|
+
* The `LastRestartSlot` sysvar provides access to the last restart slot kept in the
|
|
13
|
+
* bank fork for the slot on the fork that executes the current transaction.
|
|
14
|
+
* In case there was no fork it returns `0`.
|
|
15
|
+
*/
|
|
16
|
+
export type SysvarLastRestartSlot = Readonly<{
|
|
17
|
+
lastRestartSlot: Slot;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function getSysvarLastRestartSlotEncoder(): FixedSizeEncoder<SysvarLastRestartSlot, SysvarLastRestartSlotSize>;
|
|
20
|
+
export declare function getSysvarLastRestartSlotDecoder(): FixedSizeDecoder<SysvarLastRestartSlot, SysvarLastRestartSlotSize>;
|
|
21
|
+
export declare function getSysvarLastRestartSlotCodec(): FixedSizeCodec<SysvarLastRestartSlot, SysvarLastRestartSlot, SysvarLastRestartSlotSize>;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch the `LastRestartSlot` sysvar.
|
|
24
|
+
*
|
|
25
|
+
* Information about the last restart slot (hard fork).
|
|
26
|
+
*
|
|
27
|
+
* The `LastRestartSlot` sysvar provides access to the last restart slot kept in the
|
|
28
|
+
* bank fork for the slot on the fork that executes the current transaction.
|
|
29
|
+
* In case there was no fork it returns `0`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function fetchSysvarLastRestartSlot(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarLastRestartSlot>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=last-restart-slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"last-restart-slot.d.ts","sourceRoot":"","sources":["../../src/last-restart-slot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAEH,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAKxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAI9C,KAAK,yBAAyB,GAAG,CAAC,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IACzC,eAAe,EAAE,IAAI,CAAC;CACzB,CAAC,CAAC;AAEH,wBAAgB,+BAA+B,IAAI,gBAAgB,CAAC,qBAAqB,EAAE,yBAAyB,CAAC,CAKpH;AAED,wBAAgB,+BAA+B,IAAI,gBAAgB,CAAC,qBAAqB,EAAE,yBAAyB,CAAC,CAKpH;AAED,wBAAgB,6BAA6B,IAAI,cAAc,CAC3D,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,CAC5B,CAEA;AAED;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC5C,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAC3B,MAAM,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAKhC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type FetchAccountConfig } from '@solana/accounts';
|
|
2
|
+
import { type VariableSizeCodec, type VariableSizeDecoder, type VariableSizeEncoder } from '@solana/codecs';
|
|
3
|
+
import type { GetAccountInfoApi } from '@solana/rpc-api';
|
|
4
|
+
import type { Rpc } from '@solana/rpc-spec';
|
|
5
|
+
import { type Blockhash, type LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types';
|
|
6
|
+
type FeeCalculator = Readonly<{
|
|
7
|
+
lamportsPerSignature: LamportsUnsafeBeyond2Pow53Minus1;
|
|
8
|
+
}>;
|
|
9
|
+
type Entry = Readonly<{
|
|
10
|
+
blockhash: Blockhash;
|
|
11
|
+
feeCalculator: FeeCalculator;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* The `RecentBlockhashes` sysvar.
|
|
15
|
+
*
|
|
16
|
+
* Information about recent blocks and their fee calculators.
|
|
17
|
+
*/
|
|
18
|
+
export type SysvarRecentBlockhashes = Entry[];
|
|
19
|
+
export declare function getSysvarRecentBlockhashesEncoder(): VariableSizeEncoder<SysvarRecentBlockhashes>;
|
|
20
|
+
export declare function getSysvarRecentBlockhashesDecoder(): VariableSizeDecoder<SysvarRecentBlockhashes>;
|
|
21
|
+
export declare function getSysvarRecentBlockhashesCodec(): VariableSizeCodec<SysvarRecentBlockhashes>;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch the `RecentBlockhashes` sysvar.
|
|
24
|
+
*
|
|
25
|
+
* Information about recent blocks and their fee calculators.
|
|
26
|
+
*/
|
|
27
|
+
export declare function fetchSysvarRecentBlockhashes(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarRecentBlockhashes>;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=recent-blockhashes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recent-blockhashes.d.ts","sourceRoot":"","sources":["../../src/recent-blockhashes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAMH,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACH,KAAK,SAAS,EAKd,KAAK,gCAAgC,EACxC,MAAM,mBAAmB,CAAC;AAI3B,KAAK,aAAa,GAAG,QAAQ,CAAC;IAC1B,oBAAoB,EAAE,gCAAgC,CAAC;CAC1D,CAAC,CAAC;AACH,KAAK,KAAK,GAAG,QAAQ,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,aAAa,CAAC;CAChC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,EAAE,CAAC;AAE9C,wBAAgB,iCAAiC,IAAI,mBAAmB,CAAC,uBAAuB,CAAC,CAOhG;AAED,wBAAgB,iCAAiC,IAAI,mBAAmB,CAAC,uBAAuB,CAAC,CAOhG;AAED,wBAAgB,+BAA+B,IAAI,iBAAiB,CAAC,uBAAuB,CAAC,CAE5F;AAED;;;;GAIG;AACH,wBAAsB,4BAA4B,CAC9C,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAC3B,MAAM,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,uBAAuB,CAAC,CAKlC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type FetchAccountConfig } from '@solana/accounts';
|
|
2
|
+
import { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/codecs';
|
|
3
|
+
import type { GetAccountInfoApi } from '@solana/rpc-api';
|
|
4
|
+
import type { Rpc } from '@solana/rpc-spec';
|
|
5
|
+
import { type LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types';
|
|
6
|
+
type SysvarRentSize = 17;
|
|
7
|
+
/**
|
|
8
|
+
* The `Rent` sysvar.
|
|
9
|
+
*
|
|
10
|
+
* Configuration for network rent.
|
|
11
|
+
*/
|
|
12
|
+
export type SysvarRent = Readonly<{
|
|
13
|
+
burnPercent: number;
|
|
14
|
+
exemptionThreshold: number;
|
|
15
|
+
lamportsPerByteYear: LamportsUnsafeBeyond2Pow53Minus1;
|
|
16
|
+
}>;
|
|
17
|
+
export declare function getSysvarRentEncoder(): FixedSizeEncoder<SysvarRent, SysvarRentSize>;
|
|
18
|
+
export declare function getSysvarRentDecoder(): FixedSizeDecoder<SysvarRent, SysvarRentSize>;
|
|
19
|
+
export declare function getSysvarRentCodec(): FixedSizeCodec<SysvarRent, SysvarRent, SysvarRentSize>;
|
|
20
|
+
/**
|
|
21
|
+
* Fetch the `Rent` sysvar.
|
|
22
|
+
*
|
|
23
|
+
* Configuration for network rent.
|
|
24
|
+
*/
|
|
25
|
+
export declare function fetchSysvarRent(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarRent>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=rent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rent.d.ts","sourceRoot":"","sources":["../../src/rent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAEH,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAOxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAA0C,KAAK,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAIlH,KAAK,cAAc,GAAG,EAAE,CAAC;AAEzB;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,gCAAgC,CAAC;CACzD,CAAC,CAAC;AAEH,wBAAgB,oBAAoB,IAAI,gBAAgB,CAAC,UAAU,EAAE,cAAc,CAAC,CAMnF;AAED,wBAAgB,oBAAoB,IAAI,gBAAgB,CAAC,UAAU,EAAE,cAAc,CAAC,CAMnF;AAED,wBAAgB,kBAAkB,IAAI,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,CAE3F;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAKnH"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type FetchAccountConfig } from '@solana/accounts';
|
|
2
|
+
import { type VariableSizeCodec, type VariableSizeDecoder, type VariableSizeEncoder } from '@solana/codecs';
|
|
3
|
+
import type { GetAccountInfoApi } from '@solana/rpc-api';
|
|
4
|
+
import type { Rpc } from '@solana/rpc-spec';
|
|
5
|
+
import { type Blockhash, type Slot } from '@solana/rpc-types';
|
|
6
|
+
type Entry = Readonly<{
|
|
7
|
+
hash: Blockhash;
|
|
8
|
+
slot: Slot;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* The `SlotHashes` sysvar.
|
|
12
|
+
*
|
|
13
|
+
* The most recent hashes of a slot's parent banks.
|
|
14
|
+
*/
|
|
15
|
+
export type SysvarSlotHashes = Entry[];
|
|
16
|
+
export declare function getSysvarSlotHashesEncoder(): VariableSizeEncoder<SysvarSlotHashes>;
|
|
17
|
+
export declare function getSysvarSlotHashesDecoder(): VariableSizeDecoder<SysvarSlotHashes>;
|
|
18
|
+
export declare function getSysvarSlotHashesCodec(): VariableSizeCodec<SysvarSlotHashes>;
|
|
19
|
+
/**
|
|
20
|
+
* Fetch the `SlotHashes` sysvar.
|
|
21
|
+
*
|
|
22
|
+
* The most recent hashes of a slot's parent banks.
|
|
23
|
+
*/
|
|
24
|
+
export declare function fetchSysvarSlotHashes(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarSlotHashes>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=slot-hashes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-hashes.d.ts","sourceRoot":"","sources":["../../src/slot-hashes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAQH,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,SAAS,EAA4C,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIxG,KAAK,KAAK,GAAG,QAAQ,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;CACd,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,EAAE,CAAC;AAEvC,wBAAgB,0BAA0B,IAAI,mBAAmB,CAAC,gBAAgB,CAAC,CAOlF;AAED,wBAAgB,0BAA0B,IAAI,mBAAmB,CAAC,gBAAgB,CAAC,CAOlF;AAED,wBAAgB,wBAAwB,IAAI,iBAAiB,CAAC,gBAAgB,CAAC,CAE9E;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CACvC,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAC3B,MAAM,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAK3B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type FetchAccountConfig } from '@solana/accounts';
|
|
2
|
+
import { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/codecs';
|
|
3
|
+
import type { GetAccountInfoApi } from '@solana/rpc-api';
|
|
4
|
+
import type { Rpc } from '@solana/rpc-spec';
|
|
5
|
+
import type { Slot } from '@solana/rpc-types';
|
|
6
|
+
declare const SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE: number;
|
|
7
|
+
type SysvarSlotHistorySize = typeof SLOT_HISTORY_ACCOUNT_DATA_STATIC_SIZE;
|
|
8
|
+
/**
|
|
9
|
+
* The `SlotHistory` sysvar.
|
|
10
|
+
*
|
|
11
|
+
* A bitvector of slots present over the last epoch.
|
|
12
|
+
*/
|
|
13
|
+
export type SysvarSlotHistory = {
|
|
14
|
+
bits: bigint[];
|
|
15
|
+
nextSlot: Slot;
|
|
16
|
+
};
|
|
17
|
+
export declare function getSysvarSlotHistoryEncoder(): FixedSizeEncoder<SysvarSlotHistory, SysvarSlotHistorySize>;
|
|
18
|
+
export declare function getSysvarSlotHistoryDecoder(): FixedSizeDecoder<SysvarSlotHistory, SysvarSlotHistorySize>;
|
|
19
|
+
export declare function getSysvarSlotHistoryCodec(): FixedSizeCodec<SysvarSlotHistory, SysvarSlotHistory, SysvarSlotHistorySize>;
|
|
20
|
+
/**
|
|
21
|
+
* Fetch the `SlotHistory` sysvar.
|
|
22
|
+
*
|
|
23
|
+
* A bitvector of slots present over the last epoch.
|
|
24
|
+
*/
|
|
25
|
+
export declare function fetchSysvarSlotHistory(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarSlotHistory>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=slot-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-history.d.ts","sourceRoot":"","sources":["../../src/slot-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAIH,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAKxB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAe9C,QAAA,MAAM,qCAAqC,QAKtC,CAAC;AAwBN,KAAK,qBAAqB,GAAG,OAAO,qCAAqC,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,wBAAgB,2BAA2B,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAuBxG;AAED,wBAAgB,2BAA2B,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAuDxG;AAED,wBAAgB,yBAAyB,IAAI,cAAc,CACvD,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,CACxB,CAEA;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CACxC,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAC3B,MAAM,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,iBAAiB,CAAC,CAK5B"}
|