@algorandfoundation/algokit-utils 10.0.0-alpha.14 → 10.0.0-alpha.16
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/package.json +1 -1
- package/packages/algod_client/src/models/block.d.ts +1 -1
- package/packages/algod_client/src/models/block.js.map +1 -1
- package/packages/algod_client/src/models/block.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +121 -121
- package/types/algorand-client-transaction-sender.d.ts +123 -123
- package/types/app-client.d.ts +311 -311
- package/types/app-factory.d.ts +126 -126
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"**"
|
|
7
7
|
],
|
|
8
8
|
"name": "@algorandfoundation/algokit-utils",
|
|
9
|
-
"version": "10.0.0-alpha.
|
|
9
|
+
"version": "10.0.0-alpha.16",
|
|
10
10
|
"private": false,
|
|
11
11
|
"description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
|
|
12
12
|
"author": "Algorand Foundation",
|
|
@@ -144,7 +144,7 @@ type BlockHeader = {
|
|
|
144
144
|
/** Protocol upgrade state. */
|
|
145
145
|
upgradeState: UpgradeState;
|
|
146
146
|
/** Protocol upgrade vote parameters. */
|
|
147
|
-
upgradeVote
|
|
147
|
+
upgradeVote?: UpgradeVote;
|
|
148
148
|
/** [tc] Transaction counter. */
|
|
149
149
|
txnCounter?: bigint;
|
|
150
150
|
/** [spt] State proof tracking data keyed by state proof type. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.js","names":["BlockEvalDeltaMeta: ObjectModelMetadata<BlockEvalDelta>","numberCodec","bytesCodec","bigIntCodec","BlockAppEvalDeltaMeta: ObjectModelMetadata<BlockAppEvalDelta>","MapCodec","ObjectModelCodec","ArrayCodec","addressArrayCodec","bytesArrayCodec","BlockStateProofTrackingDataMeta: ObjectModelMetadata<BlockStateProofTrackingData>","ApplyDataMeta: ObjectModelMetadata<ApplyData>","SignedTxnWithADMeta: ObjectModelMetadata<SignedTxnWithAD>","SignedTransactionMeta","SignedTxnInBlockMeta: ObjectModelMetadata<SignedTxnInBlock>","booleanCodec","ParticipationUpdatesMeta: ObjectModelMetadata<ParticipationUpdates>","TxnCommitmentsMeta: ObjectModelMetadata<TxnCommitments>","fixedBytes32Codec","fixedBytes64Codec","RewardStateMeta: ObjectModelMetadata<RewardState>","addressCodec","UpgradeStateMeta: ObjectModelMetadata<UpgradeState>","stringCodec","UpgradeVoteMeta: ObjectModelMetadata<UpgradeVote>","BlockMeta: ObjectModelMetadata<Block>"],"sources":["../../../../../packages/algod_client/src/models/block.ts"],"sourcesContent":["import {\n Address,\n ArrayCodec,\n MapCodec,\n ObjectModelCodec,\n type EncodingFormat,\n type ObjectModelMetadata,\n type WireObject,\n addressArrayCodec,\n addressCodec,\n bigIntCodec,\n booleanCodec,\n bytesArrayCodec,\n bytesCodec,\n fixedBytes32Codec,\n fixedBytes64Codec,\n numberCodec,\n stringCodec,\n} from '@algorandfoundation/algokit-common'\nimport { type SignedTransaction, SignedTransactionMeta } from '@algorandfoundation/algokit-transact'\n\n/** BlockEvalDelta represents a TEAL value delta (block/msgpack wire keys). */\nexport type BlockEvalDelta = {\n /** [at] delta action. */\n action: number\n /** [bs] bytes value. */\n bytes?: Uint8Array\n /** [ui] uint value. */\n uint?: bigint\n}\n\nconst BlockEvalDeltaMeta: ObjectModelMetadata<BlockEvalDelta> = {\n name: 'BlockEvalDelta',\n kind: 'object',\n fields: [\n { name: 'action', wireKey: 'at', optional: false, codec: numberCodec },\n { name: 'bytes', wireKey: 'bs', optional: true, codec: bytesCodec },\n { name: 'uint', wireKey: 'ui', optional: true, codec: bigIntCodec },\n ],\n}\n\n/**\n * State changes from application execution, including inner transactions and logs.\n */\nexport type BlockAppEvalDelta = {\n /** [gd] Global state delta for the application. */\n globalDelta?: Map<Uint8Array, BlockEvalDelta>\n /** [ld] Local state deltas keyed by address index. */\n localDeltas?: Map<number, Map<Uint8Array, BlockEvalDelta>>\n /** [itx] Inner transactions produced by this application execution. */\n innerTxns?: SignedTxnWithAD[]\n /** [sa] Shared accounts referenced by local deltas. */\n sharedAccounts?: Address[]\n /** [lg] Application log outputs. */\n logs?: Uint8Array[]\n}\n\nconst BlockAppEvalDeltaMeta: ObjectModelMetadata<BlockAppEvalDelta> = {\n name: 'BlockAppEvalDelta',\n kind: 'object',\n fields: [\n {\n name: 'globalDelta',\n wireKey: 'gd',\n optional: true,\n codec: new MapCodec(bytesCodec, new ObjectModelCodec(BlockEvalDeltaMeta)),\n },\n {\n name: 'localDeltas',\n wireKey: 'ld',\n optional: true,\n codec: new MapCodec(numberCodec, new MapCodec(bytesCodec, new ObjectModelCodec(BlockEvalDeltaMeta))),\n },\n {\n name: 'innerTxns',\n wireKey: 'itx',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(() => SignedTxnWithADMeta)),\n },\n {\n name: 'sharedAccounts',\n wireKey: 'sa',\n optional: true,\n codec: addressArrayCodec,\n },\n { name: 'logs', wireKey: 'lg', optional: true, codec: bytesArrayCodec },\n ],\n}\n\n/** Tracking metadata for a specific StateProofType. */\nexport type BlockStateProofTrackingData = {\n /** [v] Vector commitment root of state proof voters. */\n stateProofVotersCommitment?: Uint8Array\n /** [t] Online total weight during state proof round. */\n stateProofOnlineTotalWeight?: bigint\n /** [n] Next round for which state proofs are accepted. */\n stateProofNextRound?: bigint\n}\n\nconst BlockStateProofTrackingDataMeta: ObjectModelMetadata<BlockStateProofTrackingData> = {\n name: 'BlockStateProofTrackingData',\n kind: 'object',\n fields: [\n { name: 'stateProofVotersCommitment', wireKey: 'v', optional: true, codec: bytesCodec },\n { name: 'stateProofOnlineTotalWeight', wireKey: 't', optional: true, codec: bigIntCodec },\n { name: 'stateProofNextRound', wireKey: 'n', optional: true, codec: bigIntCodec },\n ],\n}\n\nexport type ApplyData = {\n closingAmount?: bigint\n assetClosingAmount?: bigint\n senderRewards?: bigint\n receiverRewards?: bigint\n closeRewards?: bigint\n evalDelta?: BlockAppEvalDelta\n configAsset?: bigint\n applicationId?: bigint\n}\n\nconst ApplyDataMeta: ObjectModelMetadata<ApplyData> = {\n name: 'SignedTxnInBlock',\n kind: 'object',\n fields: [\n { name: 'closingAmount', wireKey: 'ca', optional: true, codec: bigIntCodec },\n { name: 'assetClosingAmount', wireKey: 'aca', optional: true, codec: bigIntCodec },\n { name: 'senderRewards', wireKey: 'rs', optional: true, codec: bigIntCodec },\n { name: 'receiverRewards', wireKey: 'rr', optional: true, codec: bigIntCodec },\n { name: 'closeRewards', wireKey: 'rc', optional: true, codec: bigIntCodec },\n { name: 'evalDelta', wireKey: 'dt', optional: true, codec: new ObjectModelCodec(BlockAppEvalDeltaMeta) },\n { name: 'configAsset', wireKey: 'caid', optional: true, codec: bigIntCodec },\n { name: 'applicationId', wireKey: 'apid', optional: true, codec: bigIntCodec },\n ],\n}\n\n/**\n * SignedTxnWithAD is a SignedTransaction with additional ApplyData.\n */\nexport type SignedTxnWithAD = {\n /** The signed transaction. */\n signedTxn: SignedTransaction\n /** Apply data containing transaction execution information. */\n applyData?: ApplyData\n}\n\nconst SignedTxnWithADMeta: ObjectModelMetadata<SignedTxnWithAD> = {\n name: 'SignedTxnWithAD',\n kind: 'object',\n fields: [\n {\n name: 'signedTxn',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(SignedTransactionMeta),\n },\n {\n name: 'applyData',\n flattened: true,\n optional: true,\n codec: new ObjectModelCodec(ApplyDataMeta),\n },\n ],\n}\n\n/**\n * SignedTxnInBlock is a SignedTransaction with additional ApplyData and block-specific metadata.\n */\nexport type SignedTxnInBlock = {\n signedTxn: SignedTxnWithAD\n hasGenesisId?: boolean\n hasGenesisHash?: boolean\n}\n\nconst SignedTxnInBlockMeta: ObjectModelMetadata<SignedTxnInBlock> = {\n name: 'SignedTxnInBlock',\n kind: 'object',\n fields: [\n {\n name: 'signedTxn',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(SignedTxnWithADMeta),\n },\n { name: 'hasGenesisId', wireKey: 'hgi', optional: true, codec: booleanCodec },\n { name: 'hasGenesisHash', wireKey: 'hgh', optional: true, codec: booleanCodec },\n ],\n}\n\nexport type ParticipationUpdates = {\n /** [partupdrmv] Expired participation accounts. */\n expiredParticipationAccounts: string[]\n /** [partupdabs] Absent participation accounts. */\n absentParticipationAccounts: string[]\n}\n\nconst ParticipationUpdatesMeta: ObjectModelMetadata<ParticipationUpdates> = {\n name: 'ParticipationUpdates',\n kind: 'object',\n fields: [\n {\n name: 'expiredParticipationAccounts',\n wireKey: 'partupdrmv',\n optional: false,\n codec: addressArrayCodec,\n },\n {\n name: 'absentParticipationAccounts',\n wireKey: 'partupdabs',\n optional: false,\n codec: addressArrayCodec,\n },\n ],\n}\n\n/** Transaction commitment hashes for the block. */\nexport type TxnCommitments = {\n /** [txn] Root of transaction merkle tree using SHA512_256. */\n nativeSha512_256Commitment: Uint8Array\n /** [txn256] Root of transaction vector commitment using SHA256. */\n sha256Commitment?: Uint8Array\n /** [txn512] Root of transaction vector commitment using SHA512. */\n sha512Commitment?: Uint8Array\n}\n\nconst TxnCommitmentsMeta: ObjectModelMetadata<TxnCommitments> = {\n name: 'TxnCommitments',\n kind: 'object',\n fields: [\n { name: 'nativeSha512_256Commitment', wireKey: 'txn', optional: false, codec: fixedBytes32Codec },\n { name: 'sha256Commitment', wireKey: 'txn256', optional: true, codec: fixedBytes32Codec },\n { name: 'sha512Commitment', wireKey: 'txn512', optional: true, codec: fixedBytes64Codec },\n ],\n}\n\n/** Reward distribution state for the block. */\nexport type RewardState = {\n /** [fees] FeeSink address. */\n feeSink: Address\n /** [rwd] RewardsPool address. */\n rewardsPool: Address\n /** [earn] Rewards level. */\n rewardsLevel: bigint\n /** [rate] Rewards rate. */\n rewardsRate: bigint\n /** [frac] Rewards residue. */\n rewardsResidue: bigint\n /** [rwcalr] Rewards recalculation round. */\n rewardsRecalculationRound: bigint\n}\n\nconst RewardStateMeta: ObjectModelMetadata<RewardState> = {\n name: 'RewardState',\n kind: 'object',\n fields: [\n { name: 'feeSink', wireKey: 'fees', optional: false, codec: addressCodec },\n { name: 'rewardsPool', wireKey: 'rwd', optional: false, codec: addressCodec },\n { name: 'rewardsLevel', wireKey: 'earn', optional: false, codec: bigIntCodec },\n { name: 'rewardsRate', wireKey: 'rate', optional: false, codec: bigIntCodec },\n { name: 'rewardsResidue', wireKey: 'frac', optional: false, codec: bigIntCodec },\n { name: 'rewardsRecalculationRound', wireKey: 'rwcalr', optional: false, codec: bigIntCodec },\n ],\n}\n\n/** Protocol upgrade state for the block. */\nexport type UpgradeState = {\n /** [proto] Current consensus protocol. */\n currentProtocol: string\n /** [nextproto] Next proposed protocol. */\n nextProtocol?: string\n /** [nextyes] Next protocol approvals. */\n nextProtocolApprovals?: bigint\n /** [nextbefore] Next protocol vote deadline. */\n nextProtocolVoteBefore?: bigint\n /** [nextswitch] Next protocol switch round. */\n nextProtocolSwitchOn?: bigint\n}\n\nconst UpgradeStateMeta: ObjectModelMetadata<UpgradeState> = {\n name: 'UpgradeState',\n kind: 'object',\n fields: [\n { name: 'currentProtocol', wireKey: 'proto', optional: false, codec: stringCodec },\n { name: 'nextProtocol', wireKey: 'nextproto', optional: true, codec: stringCodec },\n { name: 'nextProtocolApprovals', wireKey: 'nextyes', optional: true, codec: bigIntCodec },\n { name: 'nextProtocolVoteBefore', wireKey: 'nextbefore', optional: true, codec: bigIntCodec },\n { name: 'nextProtocolSwitchOn', wireKey: 'nextswitch', optional: true, codec: bigIntCodec },\n ],\n}\n\n/** Protocol upgrade vote parameters for the block. */\nexport type UpgradeVote = {\n /** [upgradeprop] Upgrade proposal. */\n upgradePropose?: string\n /** [upgradedelay] Upgrade delay in rounds. */\n upgradeDelay?: bigint\n /** [upgradeyes] Upgrade approval flag. */\n upgradeApprove?: boolean\n}\n\nconst UpgradeVoteMeta: ObjectModelMetadata<UpgradeVote> = {\n name: 'UpgradeVote',\n kind: 'object',\n fields: [\n { name: 'upgradePropose', wireKey: 'upgradeprop', optional: true, codec: stringCodec },\n { name: 'upgradeDelay', wireKey: 'upgradedelay', optional: true, codec: bigIntCodec },\n { name: 'upgradeApprove', wireKey: 'upgradeyes', optional: true, codec: booleanCodec },\n ],\n}\n\nexport type BlockHeader = {\n /** [rnd] Round number. */\n round: bigint\n /** [prev] Previous block hash. */\n previousBlockHash: Uint8Array\n /** [prev512] Previous block hash using SHA-512. */\n previousBlockHash512?: Uint8Array\n /** [seed] Sortition seed. */\n seed: Uint8Array\n /** Authenticates the set of transactions appearing in the block. */\n txnCommitments: TxnCommitments\n /** [ts] Block timestamp in seconds since epoch. */\n timestamp: bigint\n /** [gen] Genesis ID. */\n genesisId: string\n /** [gh] Genesis hash. */\n genesisHash: Uint8Array\n /** [prp] Proposer address. */\n proposer?: Address\n /** [fc] Fees collected in this block. */\n feesCollected?: bigint\n /** [bi] Bonus incentive for block proposal. */\n bonus?: bigint\n /** [pp] Proposer payout. */\n proposerPayout?: bigint\n /** Reward distribution state. */\n rewardState: RewardState\n /** Protocol upgrade state. */\n upgradeState: UpgradeState\n /** Protocol upgrade vote parameters. */\n upgradeVote: UpgradeVote\n /** [tc] Transaction counter. */\n txnCounter?: bigint\n /** [spt] State proof tracking data keyed by state proof type. */\n stateProofTracking?: Map<number, BlockStateProofTrackingData>\n /** Represents participation account data that needs to be checked/acted on by the network */\n participationUpdates: ParticipationUpdates\n}\n\nconst BlockHeaderMeta: ObjectModelMetadata<BlockHeader> = {\n name: 'BlockHeader',\n kind: 'object',\n fields: [\n { name: 'round', wireKey: 'rnd', optional: false, codec: bigIntCodec },\n { name: 'previousBlockHash', wireKey: 'prev', optional: false, codec: fixedBytes32Codec },\n { name: 'previousBlockHash512', wireKey: 'prev512', optional: true, codec: fixedBytes64Codec },\n { name: 'seed', wireKey: 'seed', optional: false, codec: bytesCodec },\n {\n name: 'txnCommitments',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(TxnCommitmentsMeta),\n },\n { name: 'timestamp', wireKey: 'ts', optional: false, codec: bigIntCodec },\n { name: 'genesisId', wireKey: 'gen', optional: false, codec: stringCodec },\n { name: 'genesisHash', wireKey: 'gh', optional: false, codec: fixedBytes32Codec },\n { name: 'proposer', wireKey: 'prp', optional: true, codec: addressCodec },\n { name: 'feesCollected', wireKey: 'fc', optional: true, codec: bigIntCodec },\n { name: 'bonus', wireKey: 'bi', optional: true, codec: bigIntCodec },\n { name: 'proposerPayout', wireKey: 'pp', optional: true, codec: bigIntCodec },\n {\n name: 'rewardState',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(RewardStateMeta),\n },\n {\n name: 'upgradeState',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(UpgradeStateMeta),\n },\n {\n name: 'upgradeVote',\n flattened: true,\n optional: true,\n codec: new ObjectModelCodec(UpgradeVoteMeta),\n },\n { name: 'txnCounter', wireKey: 'tc', optional: true, codec: bigIntCodec },\n {\n name: 'stateProofTracking',\n wireKey: 'spt',\n optional: true,\n codec: new MapCodec(numberCodec, new ObjectModelCodec(BlockStateProofTrackingDataMeta)),\n },\n {\n name: 'participationUpdates',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(ParticipationUpdatesMeta),\n },\n ],\n}\n\n/**\n * Block contains the BlockHeader and the list of transactions (Payset).\n */\nexport type Block = {\n /** The block information (Header) */\n header: BlockHeader\n\n /** [txns] Block transactions (Payset). */\n payset: SignedTxnInBlock[]\n}\n\nconst BlockMeta: ObjectModelMetadata<Block> = {\n name: 'Block',\n kind: 'object',\n fields: [\n { name: 'header', flattened: true, optional: false, codec: new ObjectModelCodec(BlockHeaderMeta) },\n {\n name: 'payset',\n wireKey: 'txns',\n optional: false,\n codec: new ArrayCodec(new ObjectModelCodec(SignedTxnInBlockMeta)),\n },\n ],\n}\n\n/**\n * Custom codec for Block that populates genesis information on transactions after decoding.\n *\n * When blocks are returned from algod, transactions may not include the genesisId\n * and genesisHash fields even though they are required for correct transaction ID calculation.\n * The block contains `hasGenesisId` and `hasGenesisHash` flags that indicate whether these\n * fields should be populated from the block header.\n *\n * This codec automatically populates these fields after decoding to ensure transaction IDs\n * can be calculated correctly.\n */\nclass BlockCodec extends ObjectModelCodec<Block> {\n constructor() {\n super(BlockMeta)\n }\n\n protected fromEncoded(value: WireObject, format: EncodingFormat): Block {\n const block = super.fromEncoded(value, format)\n\n // Populate genesis id and hash on transactions if required to ensure tx id's are correct\n const genesisId = block.header.genesisId\n const genesisHash = block.header.genesisHash\n\n for (const txnInBlock of block.payset ?? []) {\n const txn = txnInBlock.signedTxn.signedTxn.txn\n\n if (txnInBlock.hasGenesisId && txn.genesisId === undefined) {\n txn.genesisId = genesisId\n }\n\n // The following assumes that Consensus.RequireGenesisHash is true\n // so assigns genesis hash unless explicitly set to false\n if (txnInBlock.hasGenesisHash !== false && txn.genesisHash === undefined) {\n txn.genesisHash = genesisHash\n }\n }\n\n return block\n }\n}\n\nexport const blockCodec = new BlockCodec()\n"],"mappings":";;;;;;;;;;;;;AA+BA,MAAMA,qBAA0D;CAC9D,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GAAE,MAAM;GAAU,SAAS;GAAM,UAAU;GAAO,OAAOC;GAAa;EACtE;GAAE,MAAM;GAAS,SAAS;GAAM,UAAU;GAAM,OAAOC;GAAY;EACnE;GAAE,MAAM;GAAQ,SAAS;GAAM,UAAU;GAAM,OAAOC;GAAa;EACpE;CACF;AAkBD,MAAMC,wBAAgE;CACpE,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIC,qBAASH,0BAAY,IAAII,sCAAiB,mBAAmB,CAAC;GAC1E;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAID,qBAASJ,4BAAa,IAAII,qBAASH,0BAAY,IAAII,sCAAiB,mBAAmB,CAAC,CAAC;GACrG;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIC,yBAAW,IAAID,4CAAuB,oBAAoB,CAAC;G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B,OAAI,WAAW,mBAAmB,SAAS,IAAI,gBAAgB,OAC7D,KAAI,cAAc;;AAItB,SAAO;;;AAIX,MAAa,aAAa,IAAI,YAAY"}
|
|
1
|
+
{"version":3,"file":"block.js","names":["BlockEvalDeltaMeta: ObjectModelMetadata<BlockEvalDelta>","numberCodec","bytesCodec","bigIntCodec","BlockAppEvalDeltaMeta: ObjectModelMetadata<BlockAppEvalDelta>","MapCodec","ObjectModelCodec","ArrayCodec","addressArrayCodec","bytesArrayCodec","BlockStateProofTrackingDataMeta: ObjectModelMetadata<BlockStateProofTrackingData>","ApplyDataMeta: ObjectModelMetadata<ApplyData>","SignedTxnWithADMeta: ObjectModelMetadata<SignedTxnWithAD>","SignedTransactionMeta","SignedTxnInBlockMeta: ObjectModelMetadata<SignedTxnInBlock>","booleanCodec","ParticipationUpdatesMeta: ObjectModelMetadata<ParticipationUpdates>","TxnCommitmentsMeta: ObjectModelMetadata<TxnCommitments>","fixedBytes32Codec","fixedBytes64Codec","RewardStateMeta: ObjectModelMetadata<RewardState>","addressCodec","UpgradeStateMeta: ObjectModelMetadata<UpgradeState>","stringCodec","UpgradeVoteMeta: ObjectModelMetadata<UpgradeVote>","BlockMeta: ObjectModelMetadata<Block>"],"sources":["../../../../../packages/algod_client/src/models/block.ts"],"sourcesContent":["import {\n Address,\n ArrayCodec,\n type EncodingFormat,\n MapCodec,\n ObjectModelCodec,\n type ObjectModelMetadata,\n type WireObject,\n addressArrayCodec,\n addressCodec,\n bigIntCodec,\n booleanCodec,\n bytesArrayCodec,\n bytesCodec,\n fixedBytes32Codec,\n fixedBytes64Codec,\n numberCodec,\n stringCodec,\n} from '@algorandfoundation/algokit-common'\nimport { type SignedTransaction, SignedTransactionMeta } from '@algorandfoundation/algokit-transact'\n\n/** BlockEvalDelta represents a TEAL value delta (block/msgpack wire keys). */\nexport type BlockEvalDelta = {\n /** [at] delta action. */\n action: number\n /** [bs] bytes value. */\n bytes?: Uint8Array\n /** [ui] uint value. */\n uint?: bigint\n}\n\nconst BlockEvalDeltaMeta: ObjectModelMetadata<BlockEvalDelta> = {\n name: 'BlockEvalDelta',\n kind: 'object',\n fields: [\n { name: 'action', wireKey: 'at', optional: false, codec: numberCodec },\n { name: 'bytes', wireKey: 'bs', optional: true, codec: bytesCodec },\n { name: 'uint', wireKey: 'ui', optional: true, codec: bigIntCodec },\n ],\n}\n\n/**\n * State changes from application execution, including inner transactions and logs.\n */\nexport type BlockAppEvalDelta = {\n /** [gd] Global state delta for the application. */\n globalDelta?: Map<Uint8Array, BlockEvalDelta>\n /** [ld] Local state deltas keyed by address index. */\n localDeltas?: Map<number, Map<Uint8Array, BlockEvalDelta>>\n /** [itx] Inner transactions produced by this application execution. */\n innerTxns?: SignedTxnWithAD[]\n /** [sa] Shared accounts referenced by local deltas. */\n sharedAccounts?: Address[]\n /** [lg] Application log outputs. */\n logs?: Uint8Array[]\n}\n\nconst BlockAppEvalDeltaMeta: ObjectModelMetadata<BlockAppEvalDelta> = {\n name: 'BlockAppEvalDelta',\n kind: 'object',\n fields: [\n {\n name: 'globalDelta',\n wireKey: 'gd',\n optional: true,\n codec: new MapCodec(bytesCodec, new ObjectModelCodec(BlockEvalDeltaMeta)),\n },\n {\n name: 'localDeltas',\n wireKey: 'ld',\n optional: true,\n codec: new MapCodec(numberCodec, new MapCodec(bytesCodec, new ObjectModelCodec(BlockEvalDeltaMeta))),\n },\n {\n name: 'innerTxns',\n wireKey: 'itx',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(() => SignedTxnWithADMeta)),\n },\n {\n name: 'sharedAccounts',\n wireKey: 'sa',\n optional: true,\n codec: addressArrayCodec,\n },\n { name: 'logs', wireKey: 'lg', optional: true, codec: bytesArrayCodec },\n ],\n}\n\n/** Tracking metadata for a specific StateProofType. */\nexport type BlockStateProofTrackingData = {\n /** [v] Vector commitment root of state proof voters. */\n stateProofVotersCommitment?: Uint8Array\n /** [t] Online total weight during state proof round. */\n stateProofOnlineTotalWeight?: bigint\n /** [n] Next round for which state proofs are accepted. */\n stateProofNextRound?: bigint\n}\n\nconst BlockStateProofTrackingDataMeta: ObjectModelMetadata<BlockStateProofTrackingData> = {\n name: 'BlockStateProofTrackingData',\n kind: 'object',\n fields: [\n { name: 'stateProofVotersCommitment', wireKey: 'v', optional: true, codec: bytesCodec },\n { name: 'stateProofOnlineTotalWeight', wireKey: 't', optional: true, codec: bigIntCodec },\n { name: 'stateProofNextRound', wireKey: 'n', optional: true, codec: bigIntCodec },\n ],\n}\n\nexport type ApplyData = {\n closingAmount?: bigint\n assetClosingAmount?: bigint\n senderRewards?: bigint\n receiverRewards?: bigint\n closeRewards?: bigint\n evalDelta?: BlockAppEvalDelta\n configAsset?: bigint\n applicationId?: bigint\n}\n\nconst ApplyDataMeta: ObjectModelMetadata<ApplyData> = {\n name: 'SignedTxnInBlock',\n kind: 'object',\n fields: [\n { name: 'closingAmount', wireKey: 'ca', optional: true, codec: bigIntCodec },\n { name: 'assetClosingAmount', wireKey: 'aca', optional: true, codec: bigIntCodec },\n { name: 'senderRewards', wireKey: 'rs', optional: true, codec: bigIntCodec },\n { name: 'receiverRewards', wireKey: 'rr', optional: true, codec: bigIntCodec },\n { name: 'closeRewards', wireKey: 'rc', optional: true, codec: bigIntCodec },\n { name: 'evalDelta', wireKey: 'dt', optional: true, codec: new ObjectModelCodec(BlockAppEvalDeltaMeta) },\n { name: 'configAsset', wireKey: 'caid', optional: true, codec: bigIntCodec },\n { name: 'applicationId', wireKey: 'apid', optional: true, codec: bigIntCodec },\n ],\n}\n\n/**\n * SignedTxnWithAD is a SignedTransaction with additional ApplyData.\n */\nexport type SignedTxnWithAD = {\n /** The signed transaction. */\n signedTxn: SignedTransaction\n /** Apply data containing transaction execution information. */\n applyData?: ApplyData\n}\n\nconst SignedTxnWithADMeta: ObjectModelMetadata<SignedTxnWithAD> = {\n name: 'SignedTxnWithAD',\n kind: 'object',\n fields: [\n {\n name: 'signedTxn',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(SignedTransactionMeta),\n },\n {\n name: 'applyData',\n flattened: true,\n optional: true,\n codec: new ObjectModelCodec(ApplyDataMeta),\n },\n ],\n}\n\n/**\n * SignedTxnInBlock is a SignedTransaction with additional ApplyData and block-specific metadata.\n */\nexport type SignedTxnInBlock = {\n signedTxn: SignedTxnWithAD\n hasGenesisId?: boolean\n hasGenesisHash?: boolean\n}\n\nconst SignedTxnInBlockMeta: ObjectModelMetadata<SignedTxnInBlock> = {\n name: 'SignedTxnInBlock',\n kind: 'object',\n fields: [\n {\n name: 'signedTxn',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(SignedTxnWithADMeta),\n },\n { name: 'hasGenesisId', wireKey: 'hgi', optional: true, codec: booleanCodec },\n { name: 'hasGenesisHash', wireKey: 'hgh', optional: true, codec: booleanCodec },\n ],\n}\n\nexport type ParticipationUpdates = {\n /** [partupdrmv] Expired participation accounts. */\n expiredParticipationAccounts: string[]\n /** [partupdabs] Absent participation accounts. */\n absentParticipationAccounts: string[]\n}\n\nconst ParticipationUpdatesMeta: ObjectModelMetadata<ParticipationUpdates> = {\n name: 'ParticipationUpdates',\n kind: 'object',\n fields: [\n {\n name: 'expiredParticipationAccounts',\n wireKey: 'partupdrmv',\n optional: false,\n codec: addressArrayCodec,\n },\n {\n name: 'absentParticipationAccounts',\n wireKey: 'partupdabs',\n optional: false,\n codec: addressArrayCodec,\n },\n ],\n}\n\n/** Transaction commitment hashes for the block. */\nexport type TxnCommitments = {\n /** [txn] Root of transaction merkle tree using SHA512_256. */\n nativeSha512_256Commitment: Uint8Array\n /** [txn256] Root of transaction vector commitment using SHA256. */\n sha256Commitment?: Uint8Array\n /** [txn512] Root of transaction vector commitment using SHA512. */\n sha512Commitment?: Uint8Array\n}\n\nconst TxnCommitmentsMeta: ObjectModelMetadata<TxnCommitments> = {\n name: 'TxnCommitments',\n kind: 'object',\n fields: [\n { name: 'nativeSha512_256Commitment', wireKey: 'txn', optional: false, codec: fixedBytes32Codec },\n { name: 'sha256Commitment', wireKey: 'txn256', optional: true, codec: fixedBytes32Codec },\n { name: 'sha512Commitment', wireKey: 'txn512', optional: true, codec: fixedBytes64Codec },\n ],\n}\n\n/** Reward distribution state for the block. */\nexport type RewardState = {\n /** [fees] FeeSink address. */\n feeSink: Address\n /** [rwd] RewardsPool address. */\n rewardsPool: Address\n /** [earn] Rewards level. */\n rewardsLevel: bigint\n /** [rate] Rewards rate. */\n rewardsRate: bigint\n /** [frac] Rewards residue. */\n rewardsResidue: bigint\n /** [rwcalr] Rewards recalculation round. */\n rewardsRecalculationRound: bigint\n}\n\nconst RewardStateMeta: ObjectModelMetadata<RewardState> = {\n name: 'RewardState',\n kind: 'object',\n fields: [\n { name: 'feeSink', wireKey: 'fees', optional: false, codec: addressCodec },\n { name: 'rewardsPool', wireKey: 'rwd', optional: false, codec: addressCodec },\n { name: 'rewardsLevel', wireKey: 'earn', optional: false, codec: bigIntCodec },\n { name: 'rewardsRate', wireKey: 'rate', optional: false, codec: bigIntCodec },\n { name: 'rewardsResidue', wireKey: 'frac', optional: false, codec: bigIntCodec },\n { name: 'rewardsRecalculationRound', wireKey: 'rwcalr', optional: false, codec: bigIntCodec },\n ],\n}\n\n/** Protocol upgrade state for the block. */\nexport type UpgradeState = {\n /** [proto] Current consensus protocol. */\n currentProtocol: string\n /** [nextproto] Next proposed protocol. */\n nextProtocol?: string\n /** [nextyes] Next protocol approvals. */\n nextProtocolApprovals?: bigint\n /** [nextbefore] Next protocol vote deadline. */\n nextProtocolVoteBefore?: bigint\n /** [nextswitch] Next protocol switch round. */\n nextProtocolSwitchOn?: bigint\n}\n\nconst UpgradeStateMeta: ObjectModelMetadata<UpgradeState> = {\n name: 'UpgradeState',\n kind: 'object',\n fields: [\n { name: 'currentProtocol', wireKey: 'proto', optional: false, codec: stringCodec },\n { name: 'nextProtocol', wireKey: 'nextproto', optional: true, codec: stringCodec },\n { name: 'nextProtocolApprovals', wireKey: 'nextyes', optional: true, codec: bigIntCodec },\n { name: 'nextProtocolVoteBefore', wireKey: 'nextbefore', optional: true, codec: bigIntCodec },\n { name: 'nextProtocolSwitchOn', wireKey: 'nextswitch', optional: true, codec: bigIntCodec },\n ],\n}\n\n/** Protocol upgrade vote parameters for the block. */\nexport type UpgradeVote = {\n /** [upgradeprop] Upgrade proposal. */\n upgradePropose?: string\n /** [upgradedelay] Upgrade delay in rounds. */\n upgradeDelay?: bigint\n /** [upgradeyes] Upgrade approval flag. */\n upgradeApprove?: boolean\n}\n\nconst UpgradeVoteMeta: ObjectModelMetadata<UpgradeVote> = {\n name: 'UpgradeVote',\n kind: 'object',\n fields: [\n { name: 'upgradePropose', wireKey: 'upgradeprop', optional: true, codec: stringCodec },\n { name: 'upgradeDelay', wireKey: 'upgradedelay', optional: true, codec: bigIntCodec },\n { name: 'upgradeApprove', wireKey: 'upgradeyes', optional: true, codec: booleanCodec },\n ],\n}\n\nexport type BlockHeader = {\n /** [rnd] Round number. */\n round: bigint\n /** [prev] Previous block hash. */\n previousBlockHash: Uint8Array\n /** [prev512] Previous block hash using SHA-512. */\n previousBlockHash512?: Uint8Array\n /** [seed] Sortition seed. */\n seed: Uint8Array\n /** Authenticates the set of transactions appearing in the block. */\n txnCommitments: TxnCommitments\n /** [ts] Block timestamp in seconds since epoch. */\n timestamp: bigint\n /** [gen] Genesis ID. */\n genesisId: string\n /** [gh] Genesis hash. */\n genesisHash: Uint8Array\n /** [prp] Proposer address. */\n proposer?: Address\n /** [fc] Fees collected in this block. */\n feesCollected?: bigint\n /** [bi] Bonus incentive for block proposal. */\n bonus?: bigint\n /** [pp] Proposer payout. */\n proposerPayout?: bigint\n /** Reward distribution state. */\n rewardState: RewardState\n /** Protocol upgrade state. */\n upgradeState: UpgradeState\n /** Protocol upgrade vote parameters. */\n upgradeVote?: UpgradeVote\n /** [tc] Transaction counter. */\n txnCounter?: bigint\n /** [spt] State proof tracking data keyed by state proof type. */\n stateProofTracking?: Map<number, BlockStateProofTrackingData>\n /** Represents participation account data that needs to be checked/acted on by the network */\n participationUpdates: ParticipationUpdates\n}\n\nconst BlockHeaderMeta: ObjectModelMetadata<BlockHeader> = {\n name: 'BlockHeader',\n kind: 'object',\n fields: [\n { name: 'round', wireKey: 'rnd', optional: false, codec: bigIntCodec },\n { name: 'previousBlockHash', wireKey: 'prev', optional: false, codec: fixedBytes32Codec },\n { name: 'previousBlockHash512', wireKey: 'prev512', optional: true, codec: fixedBytes64Codec },\n { name: 'seed', wireKey: 'seed', optional: false, codec: bytesCodec },\n {\n name: 'txnCommitments',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(TxnCommitmentsMeta),\n },\n { name: 'timestamp', wireKey: 'ts', optional: false, codec: bigIntCodec },\n { name: 'genesisId', wireKey: 'gen', optional: false, codec: stringCodec },\n { name: 'genesisHash', wireKey: 'gh', optional: false, codec: fixedBytes32Codec },\n { name: 'proposer', wireKey: 'prp', optional: true, codec: addressCodec },\n { name: 'feesCollected', wireKey: 'fc', optional: true, codec: bigIntCodec },\n { name: 'bonus', wireKey: 'bi', optional: true, codec: bigIntCodec },\n { name: 'proposerPayout', wireKey: 'pp', optional: true, codec: bigIntCodec },\n {\n name: 'rewardState',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(RewardStateMeta),\n },\n {\n name: 'upgradeState',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(UpgradeStateMeta),\n },\n {\n name: 'upgradeVote',\n flattened: true,\n optional: true,\n codec: new ObjectModelCodec(UpgradeVoteMeta),\n },\n { name: 'txnCounter', wireKey: 'tc', optional: true, codec: bigIntCodec },\n {\n name: 'stateProofTracking',\n wireKey: 'spt',\n optional: true,\n codec: new MapCodec(numberCodec, new ObjectModelCodec(BlockStateProofTrackingDataMeta)),\n },\n {\n name: 'participationUpdates',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(ParticipationUpdatesMeta),\n },\n ],\n}\n\n/**\n * Block contains the BlockHeader and the list of transactions (Payset).\n */\nexport type Block = {\n /** The block information (Header) */\n header: BlockHeader\n\n /** [txns] Block transactions (Payset). */\n payset: SignedTxnInBlock[]\n}\n\nconst BlockMeta: ObjectModelMetadata<Block> = {\n name: 'Block',\n kind: 'object',\n fields: [\n { name: 'header', flattened: true, optional: false, codec: new ObjectModelCodec(BlockHeaderMeta) },\n {\n name: 'payset',\n wireKey: 'txns',\n optional: false,\n codec: new ArrayCodec(new ObjectModelCodec(SignedTxnInBlockMeta)),\n },\n ],\n}\n\n/**\n * Custom codec for Block that populates genesis information on transactions after decoding.\n *\n * When blocks are returned from algod, transactions may not include the genesisId\n * and genesisHash fields even though they are required for correct transaction ID calculation.\n * The block contains `hasGenesisId` and `hasGenesisHash` flags that indicate whether these\n * fields should be populated from the block header.\n *\n * This codec automatically populates these fields after decoding to ensure transaction IDs\n * can be calculated correctly.\n */\nclass BlockCodec extends ObjectModelCodec<Block> {\n constructor() {\n super(BlockMeta)\n }\n\n protected fromEncoded(value: WireObject, format: EncodingFormat): Block {\n const block = super.fromEncoded(value, format)\n\n // Populate genesis id and hash on transactions if required to ensure tx id's are correct\n const genesisId = block.header.genesisId\n const genesisHash = block.header.genesisHash\n\n for (const txnInBlock of block.payset ?? []) {\n const txn = txnInBlock.signedTxn.signedTxn.txn\n\n if (txnInBlock.hasGenesisId && txn.genesisId === undefined) {\n txn.genesisId = genesisId\n }\n\n // The following assumes that Consensus.RequireGenesisHash is true\n // so assigns genesis hash unless explicitly set to false\n if (txnInBlock.hasGenesisHash !== false && txn.genesisHash === undefined) {\n txn.genesisHash = genesisHash\n }\n }\n\n return block\n }\n}\n\nexport const blockCodec = new BlockCodec()\n"],"mappings":";;;;;;;;;;;;;AA+BA,MAAMA,qBAA0D;CAC9D,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GAAE,MAAM;GAAU,SAAS;GAAM,UAAU;GAAO,OAAOC;GAAa;EACtE;GAAE,MAAM;GAAS,SAAS;GAAM,UAAU;GAAM,OAAOC;GAAY;EACnE;GAAE,MAAM;GAAQ,SAAS;GAAM,UAAU;GAAM,OAAOC;GAAa;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AAqB,CAAC;EAClE,CACF;CACF;;;;;;;;;;;;AAaD,IAAM,aAAN,cAAyBA,sCAAwB;CAC/C,cAAc;AACZ,QAAM,UAAU;;CAGlB,AAAU,YAAY,OAAmB,QAA+B;EACtE,MAAM,QAAQ,MAAM,YAAY,OAAO,OAAO;EAG9C,MAAM,YAAY,MAAM,OAAO;EAC/B,MAAM,cAAc,MAAM,OAAO;AAEjC,OAAK,MAAM,cAAc,MAAM,UAAU,EAAE,EAAE;GAC3C,MAAM,MAAM,WAAW,UAAU,UAAU;AAE3C,OAAI,WAAW,gBAAgB,IAAI,cAAc,OAC/C,KAAI,YAAY;AAKlB,OAAI,WAAW,mBAAmB,SAAS,IAAI,gBAAgB,OAC7D,KAAI,cAAc;;AAItB,SAAO;;;AAIX,MAAa,aAAa,IAAI,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.mjs","names":["BlockEvalDeltaMeta: ObjectModelMetadata<BlockEvalDelta>","BlockAppEvalDeltaMeta: ObjectModelMetadata<BlockAppEvalDelta>","BlockStateProofTrackingDataMeta: ObjectModelMetadata<BlockStateProofTrackingData>","ApplyDataMeta: ObjectModelMetadata<ApplyData>","SignedTxnWithADMeta: ObjectModelMetadata<SignedTxnWithAD>","SignedTxnInBlockMeta: ObjectModelMetadata<SignedTxnInBlock>","ParticipationUpdatesMeta: ObjectModelMetadata<ParticipationUpdates>","TxnCommitmentsMeta: ObjectModelMetadata<TxnCommitments>","RewardStateMeta: ObjectModelMetadata<RewardState>","UpgradeStateMeta: ObjectModelMetadata<UpgradeState>","UpgradeVoteMeta: ObjectModelMetadata<UpgradeVote>","BlockMeta: ObjectModelMetadata<Block>"],"sources":["../../../../../packages/algod_client/src/models/block.ts"],"sourcesContent":["import {\n Address,\n ArrayCodec,\n MapCodec,\n ObjectModelCodec,\n type EncodingFormat,\n type ObjectModelMetadata,\n type WireObject,\n addressArrayCodec,\n addressCodec,\n bigIntCodec,\n booleanCodec,\n bytesArrayCodec,\n bytesCodec,\n fixedBytes32Codec,\n fixedBytes64Codec,\n numberCodec,\n stringCodec,\n} from '@algorandfoundation/algokit-common'\nimport { type SignedTransaction, SignedTransactionMeta } from '@algorandfoundation/algokit-transact'\n\n/** BlockEvalDelta represents a TEAL value delta (block/msgpack wire keys). */\nexport type BlockEvalDelta = {\n /** [at] delta action. */\n action: number\n /** [bs] bytes value. */\n bytes?: Uint8Array\n /** [ui] uint value. */\n uint?: bigint\n}\n\nconst BlockEvalDeltaMeta: ObjectModelMetadata<BlockEvalDelta> = {\n name: 'BlockEvalDelta',\n kind: 'object',\n fields: [\n { name: 'action', wireKey: 'at', optional: false, codec: numberCodec },\n { name: 'bytes', wireKey: 'bs', optional: true, codec: bytesCodec },\n { name: 'uint', wireKey: 'ui', optional: true, codec: bigIntCodec },\n ],\n}\n\n/**\n * State changes from application execution, including inner transactions and logs.\n */\nexport type BlockAppEvalDelta = {\n /** [gd] Global state delta for the application. */\n globalDelta?: Map<Uint8Array, BlockEvalDelta>\n /** [ld] Local state deltas keyed by address index. */\n localDeltas?: Map<number, Map<Uint8Array, BlockEvalDelta>>\n /** [itx] Inner transactions produced by this application execution. */\n innerTxns?: SignedTxnWithAD[]\n /** [sa] Shared accounts referenced by local deltas. */\n sharedAccounts?: Address[]\n /** [lg] Application log outputs. */\n logs?: Uint8Array[]\n}\n\nconst BlockAppEvalDeltaMeta: ObjectModelMetadata<BlockAppEvalDelta> = {\n name: 'BlockAppEvalDelta',\n kind: 'object',\n fields: [\n {\n name: 'globalDelta',\n wireKey: 'gd',\n optional: true,\n codec: new MapCodec(bytesCodec, new ObjectModelCodec(BlockEvalDeltaMeta)),\n },\n {\n name: 'localDeltas',\n wireKey: 'ld',\n optional: true,\n codec: new MapCodec(numberCodec, new MapCodec(bytesCodec, new ObjectModelCodec(BlockEvalDeltaMeta))),\n },\n {\n name: 'innerTxns',\n wireKey: 'itx',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(() => SignedTxnWithADMeta)),\n },\n {\n name: 'sharedAccounts',\n wireKey: 'sa',\n optional: true,\n codec: addressArrayCodec,\n },\n { name: 'logs', wireKey: 'lg', optional: true, codec: bytesArrayCodec },\n ],\n}\n\n/** Tracking metadata for a specific StateProofType. */\nexport type BlockStateProofTrackingData = {\n /** [v] Vector commitment root of state proof voters. */\n stateProofVotersCommitment?: Uint8Array\n /** [t] Online total weight during state proof round. */\n stateProofOnlineTotalWeight?: bigint\n /** [n] Next round for which state proofs are accepted. */\n stateProofNextRound?: bigint\n}\n\nconst BlockStateProofTrackingDataMeta: ObjectModelMetadata<BlockStateProofTrackingData> = {\n name: 'BlockStateProofTrackingData',\n kind: 'object',\n fields: [\n { name: 'stateProofVotersCommitment', wireKey: 'v', optional: true, codec: bytesCodec },\n { name: 'stateProofOnlineTotalWeight', wireKey: 't', optional: true, codec: bigIntCodec },\n { name: 'stateProofNextRound', wireKey: 'n', optional: true, codec: bigIntCodec },\n ],\n}\n\nexport type ApplyData = {\n closingAmount?: bigint\n assetClosingAmount?: bigint\n senderRewards?: bigint\n receiverRewards?: bigint\n closeRewards?: bigint\n evalDelta?: BlockAppEvalDelta\n configAsset?: bigint\n applicationId?: bigint\n}\n\nconst ApplyDataMeta: ObjectModelMetadata<ApplyData> = {\n name: 'SignedTxnInBlock',\n kind: 'object',\n fields: [\n { name: 'closingAmount', wireKey: 'ca', optional: true, codec: bigIntCodec },\n { name: 'assetClosingAmount', wireKey: 'aca', optional: true, codec: bigIntCodec },\n { name: 'senderRewards', wireKey: 'rs', optional: true, codec: bigIntCodec },\n { name: 'receiverRewards', wireKey: 'rr', optional: true, codec: bigIntCodec },\n { name: 'closeRewards', wireKey: 'rc', optional: true, codec: bigIntCodec },\n { name: 'evalDelta', wireKey: 'dt', optional: true, codec: new ObjectModelCodec(BlockAppEvalDeltaMeta) },\n { name: 'configAsset', wireKey: 'caid', optional: true, codec: bigIntCodec },\n { name: 'applicationId', wireKey: 'apid', optional: true, codec: bigIntCodec },\n ],\n}\n\n/**\n * SignedTxnWithAD is a SignedTransaction with additional ApplyData.\n */\nexport type SignedTxnWithAD = {\n /** The signed transaction. */\n signedTxn: SignedTransaction\n /** Apply data containing transaction execution information. */\n applyData?: ApplyData\n}\n\nconst SignedTxnWithADMeta: ObjectModelMetadata<SignedTxnWithAD> = {\n name: 'SignedTxnWithAD',\n kind: 'object',\n fields: [\n {\n name: 'signedTxn',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(SignedTransactionMeta),\n },\n {\n name: 'applyData',\n flattened: true,\n optional: true,\n codec: new ObjectModelCodec(ApplyDataMeta),\n },\n ],\n}\n\n/**\n * SignedTxnInBlock is a SignedTransaction with additional ApplyData and block-specific metadata.\n */\nexport type SignedTxnInBlock = {\n signedTxn: SignedTxnWithAD\n hasGenesisId?: boolean\n hasGenesisHash?: boolean\n}\n\nconst SignedTxnInBlockMeta: ObjectModelMetadata<SignedTxnInBlock> = {\n name: 'SignedTxnInBlock',\n kind: 'object',\n fields: [\n {\n name: 'signedTxn',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(SignedTxnWithADMeta),\n },\n { name: 'hasGenesisId', wireKey: 'hgi', optional: true, codec: booleanCodec },\n { name: 'hasGenesisHash', wireKey: 'hgh', optional: true, codec: booleanCodec },\n ],\n}\n\nexport type ParticipationUpdates = {\n /** [partupdrmv] Expired participation accounts. */\n expiredParticipationAccounts: string[]\n /** [partupdabs] Absent participation accounts. */\n absentParticipationAccounts: string[]\n}\n\nconst ParticipationUpdatesMeta: ObjectModelMetadata<ParticipationUpdates> = {\n name: 'ParticipationUpdates',\n kind: 'object',\n fields: [\n {\n name: 'expiredParticipationAccounts',\n wireKey: 'partupdrmv',\n optional: false,\n codec: addressArrayCodec,\n },\n {\n name: 'absentParticipationAccounts',\n wireKey: 'partupdabs',\n optional: false,\n codec: addressArrayCodec,\n },\n ],\n}\n\n/** Transaction commitment hashes for the block. */\nexport type TxnCommitments = {\n /** [txn] Root of transaction merkle tree using SHA512_256. */\n nativeSha512_256Commitment: Uint8Array\n /** [txn256] Root of transaction vector commitment using SHA256. */\n sha256Commitment?: Uint8Array\n /** [txn512] Root of transaction vector commitment using SHA512. */\n sha512Commitment?: Uint8Array\n}\n\nconst TxnCommitmentsMeta: ObjectModelMetadata<TxnCommitments> = {\n name: 'TxnCommitments',\n kind: 'object',\n fields: [\n { name: 'nativeSha512_256Commitment', wireKey: 'txn', optional: false, codec: fixedBytes32Codec },\n { name: 'sha256Commitment', wireKey: 'txn256', optional: true, codec: fixedBytes32Codec },\n { name: 'sha512Commitment', wireKey: 'txn512', optional: true, codec: fixedBytes64Codec },\n ],\n}\n\n/** Reward distribution state for the block. */\nexport type RewardState = {\n /** [fees] FeeSink address. */\n feeSink: Address\n /** [rwd] RewardsPool address. */\n rewardsPool: Address\n /** [earn] Rewards level. */\n rewardsLevel: bigint\n /** [rate] Rewards rate. */\n rewardsRate: bigint\n /** [frac] Rewards residue. */\n rewardsResidue: bigint\n /** [rwcalr] Rewards recalculation round. */\n rewardsRecalculationRound: bigint\n}\n\nconst RewardStateMeta: ObjectModelMetadata<RewardState> = {\n name: 'RewardState',\n kind: 'object',\n fields: [\n { name: 'feeSink', wireKey: 'fees', optional: false, codec: addressCodec },\n { name: 'rewardsPool', wireKey: 'rwd', optional: false, codec: addressCodec },\n { name: 'rewardsLevel', wireKey: 'earn', optional: false, codec: bigIntCodec },\n { name: 'rewardsRate', wireKey: 'rate', optional: false, codec: bigIntCodec },\n { name: 'rewardsResidue', wireKey: 'frac', optional: false, codec: bigIntCodec },\n { name: 'rewardsRecalculationRound', wireKey: 'rwcalr', optional: false, codec: bigIntCodec },\n ],\n}\n\n/** Protocol upgrade state for the block. */\nexport type UpgradeState = {\n /** [proto] Current consensus protocol. */\n currentProtocol: string\n /** [nextproto] Next proposed protocol. */\n nextProtocol?: string\n /** [nextyes] Next protocol approvals. */\n nextProtocolApprovals?: bigint\n /** [nextbefore] Next protocol vote deadline. */\n nextProtocolVoteBefore?: bigint\n /** [nextswitch] Next protocol switch round. */\n nextProtocolSwitchOn?: bigint\n}\n\nconst UpgradeStateMeta: ObjectModelMetadata<UpgradeState> = {\n name: 'UpgradeState',\n kind: 'object',\n fields: [\n { name: 'currentProtocol', wireKey: 'proto', optional: false, codec: stringCodec },\n { name: 'nextProtocol', wireKey: 'nextproto', optional: true, codec: stringCodec },\n { name: 'nextProtocolApprovals', wireKey: 'nextyes', optional: true, codec: bigIntCodec },\n { name: 'nextProtocolVoteBefore', wireKey: 'nextbefore', optional: true, codec: bigIntCodec },\n { name: 'nextProtocolSwitchOn', wireKey: 'nextswitch', optional: true, codec: bigIntCodec },\n ],\n}\n\n/** Protocol upgrade vote parameters for the block. */\nexport type UpgradeVote = {\n /** [upgradeprop] Upgrade proposal. */\n upgradePropose?: string\n /** [upgradedelay] Upgrade delay in rounds. */\n upgradeDelay?: bigint\n /** [upgradeyes] Upgrade approval flag. */\n upgradeApprove?: boolean\n}\n\nconst UpgradeVoteMeta: ObjectModelMetadata<UpgradeVote> = {\n name: 'UpgradeVote',\n kind: 'object',\n fields: [\n { name: 'upgradePropose', wireKey: 'upgradeprop', optional: true, codec: stringCodec },\n { name: 'upgradeDelay', wireKey: 'upgradedelay', optional: true, codec: bigIntCodec },\n { name: 'upgradeApprove', wireKey: 'upgradeyes', optional: true, codec: booleanCodec },\n ],\n}\n\nexport type BlockHeader = {\n /** [rnd] Round number. */\n round: bigint\n /** [prev] Previous block hash. */\n previousBlockHash: Uint8Array\n /** [prev512] Previous block hash using SHA-512. */\n previousBlockHash512?: Uint8Array\n /** [seed] Sortition seed. */\n seed: Uint8Array\n /** Authenticates the set of transactions appearing in the block. */\n txnCommitments: TxnCommitments\n /** [ts] Block timestamp in seconds since epoch. */\n timestamp: bigint\n /** [gen] Genesis ID. */\n genesisId: string\n /** [gh] Genesis hash. */\n genesisHash: Uint8Array\n /** [prp] Proposer address. */\n proposer?: Address\n /** [fc] Fees collected in this block. */\n feesCollected?: bigint\n /** [bi] Bonus incentive for block proposal. */\n bonus?: bigint\n /** [pp] Proposer payout. */\n proposerPayout?: bigint\n /** Reward distribution state. */\n rewardState: RewardState\n /** Protocol upgrade state. */\n upgradeState: UpgradeState\n /** Protocol upgrade vote parameters. */\n upgradeVote: UpgradeVote\n /** [tc] Transaction counter. */\n txnCounter?: bigint\n /** [spt] State proof tracking data keyed by state proof type. */\n stateProofTracking?: Map<number, BlockStateProofTrackingData>\n /** Represents participation account data that needs to be checked/acted on by the network */\n participationUpdates: ParticipationUpdates\n}\n\nconst BlockHeaderMeta: ObjectModelMetadata<BlockHeader> = {\n name: 'BlockHeader',\n kind: 'object',\n fields: [\n { name: 'round', wireKey: 'rnd', optional: false, codec: bigIntCodec },\n { name: 'previousBlockHash', wireKey: 'prev', optional: false, codec: fixedBytes32Codec },\n { name: 'previousBlockHash512', wireKey: 'prev512', optional: true, codec: fixedBytes64Codec },\n { name: 'seed', wireKey: 'seed', optional: false, codec: bytesCodec },\n {\n name: 'txnCommitments',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(TxnCommitmentsMeta),\n },\n { name: 'timestamp', wireKey: 'ts', optional: false, codec: bigIntCodec },\n { name: 'genesisId', wireKey: 'gen', optional: false, codec: stringCodec },\n { name: 'genesisHash', wireKey: 'gh', optional: false, codec: fixedBytes32Codec },\n { name: 'proposer', wireKey: 'prp', optional: true, codec: addressCodec },\n { name: 'feesCollected', wireKey: 'fc', optional: true, codec: bigIntCodec },\n { name: 'bonus', wireKey: 'bi', optional: true, codec: bigIntCodec },\n { name: 'proposerPayout', wireKey: 'pp', optional: true, codec: bigIntCodec },\n {\n name: 'rewardState',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(RewardStateMeta),\n },\n {\n name: 'upgradeState',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(UpgradeStateMeta),\n },\n {\n name: 'upgradeVote',\n flattened: true,\n optional: true,\n codec: new ObjectModelCodec(UpgradeVoteMeta),\n },\n { name: 'txnCounter', wireKey: 'tc', optional: true, codec: bigIntCodec },\n {\n name: 'stateProofTracking',\n wireKey: 'spt',\n optional: true,\n codec: new MapCodec(numberCodec, new ObjectModelCodec(BlockStateProofTrackingDataMeta)),\n },\n {\n name: 'participationUpdates',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(ParticipationUpdatesMeta),\n },\n ],\n}\n\n/**\n * Block contains the BlockHeader and the list of transactions (Payset).\n */\nexport type Block = {\n /** The block information (Header) */\n header: BlockHeader\n\n /** [txns] Block transactions (Payset). */\n payset: SignedTxnInBlock[]\n}\n\nconst BlockMeta: ObjectModelMetadata<Block> = {\n name: 'Block',\n kind: 'object',\n fields: [\n { name: 'header', flattened: true, optional: false, codec: new ObjectModelCodec(BlockHeaderMeta) },\n {\n name: 'payset',\n wireKey: 'txns',\n optional: false,\n codec: new ArrayCodec(new ObjectModelCodec(SignedTxnInBlockMeta)),\n },\n ],\n}\n\n/**\n * Custom codec for Block that populates genesis information on transactions after decoding.\n *\n * When blocks are returned from algod, transactions may not include the genesisId\n * and genesisHash fields even though they are required for correct transaction ID calculation.\n * The block contains `hasGenesisId` and `hasGenesisHash` flags that indicate whether these\n * fields should be populated from the block header.\n *\n * This codec automatically populates these fields after decoding to ensure transaction IDs\n * can be calculated correctly.\n */\nclass BlockCodec extends ObjectModelCodec<Block> {\n constructor() {\n super(BlockMeta)\n }\n\n protected fromEncoded(value: WireObject, format: EncodingFormat): Block {\n const block = super.fromEncoded(value, format)\n\n // Populate genesis id and hash on transactions if required to ensure tx id's are correct\n const genesisId = block.header.genesisId\n const genesisHash = block.header.genesisHash\n\n for (const txnInBlock of block.payset ?? []) {\n const txn = txnInBlock.signedTxn.signedTxn.txn\n\n if (txnInBlock.hasGenesisId && txn.genesisId === undefined) {\n txn.genesisId = genesisId\n }\n\n // The following assumes that Consensus.RequireGenesisHash is true\n // so assigns genesis hash unless explicitly set to false\n if (txnInBlock.hasGenesisHash !== false && txn.genesisHash === undefined) {\n txn.genesisHash = genesisHash\n }\n }\n\n return block\n }\n}\n\nexport const blockCod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IACD;KACE,MAAM;KACN,WAAW;KACX,UAAU;KACV,OAAO,IAAI,iBAAiB,yBAAyB;KACtD;IACF;GACF,CAiBmG;EAAE,EAClG;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO,IAAI,WAAW,IAAI,iBAAiB,qBAAqB,CAAC;EAClE,CACF;CACF;;;;;;;;;;;;AAaD,IAAM,aAAN,cAAyB,iBAAwB;CAC/C,cAAc;AACZ,QAAM,UAAU;;CAGlB,AAAU,YAAY,OAAmB,QAA+B;EACtE,MAAM,QAAQ,MAAM,YAAY,OAAO,OAAO;EAG9C,MAAM,YAAY,MAAM,OAAO;EAC/B,MAAM,cAAc,MAAM,OAAO;AAEjC,OAAK,MAAM,cAAc,MAAM,UAAU,EAAE,EAAE;GAC3C,MAAM,MAAM,WAAW,UAAU,UAAU;AAE3C,OAAI,WAAW,gBAAgB,IAAI,cAAc,OAC/C,KAAI,YAAY;AAKlB,OAAI,WAAW,mBAAmB,SAAS,IAAI,gBAAgB,OAC7D,KAAI,cAAc;;AAItB,SAAO;;;AAIX,MAAa,aAAa,IAAI,YAAY"}
|
|
1
|
+
{"version":3,"file":"block.mjs","names":["BlockEvalDeltaMeta: ObjectModelMetadata<BlockEvalDelta>","BlockAppEvalDeltaMeta: ObjectModelMetadata<BlockAppEvalDelta>","BlockStateProofTrackingDataMeta: ObjectModelMetadata<BlockStateProofTrackingData>","ApplyDataMeta: ObjectModelMetadata<ApplyData>","SignedTxnWithADMeta: ObjectModelMetadata<SignedTxnWithAD>","SignedTxnInBlockMeta: ObjectModelMetadata<SignedTxnInBlock>","ParticipationUpdatesMeta: ObjectModelMetadata<ParticipationUpdates>","TxnCommitmentsMeta: ObjectModelMetadata<TxnCommitments>","RewardStateMeta: ObjectModelMetadata<RewardState>","UpgradeStateMeta: ObjectModelMetadata<UpgradeState>","UpgradeVoteMeta: ObjectModelMetadata<UpgradeVote>","BlockMeta: ObjectModelMetadata<Block>"],"sources":["../../../../../packages/algod_client/src/models/block.ts"],"sourcesContent":["import {\n Address,\n ArrayCodec,\n type EncodingFormat,\n MapCodec,\n ObjectModelCodec,\n type ObjectModelMetadata,\n type WireObject,\n addressArrayCodec,\n addressCodec,\n bigIntCodec,\n booleanCodec,\n bytesArrayCodec,\n bytesCodec,\n fixedBytes32Codec,\n fixedBytes64Codec,\n numberCodec,\n stringCodec,\n} from '@algorandfoundation/algokit-common'\nimport { type SignedTransaction, SignedTransactionMeta } from '@algorandfoundation/algokit-transact'\n\n/** BlockEvalDelta represents a TEAL value delta (block/msgpack wire keys). */\nexport type BlockEvalDelta = {\n /** [at] delta action. */\n action: number\n /** [bs] bytes value. */\n bytes?: Uint8Array\n /** [ui] uint value. */\n uint?: bigint\n}\n\nconst BlockEvalDeltaMeta: ObjectModelMetadata<BlockEvalDelta> = {\n name: 'BlockEvalDelta',\n kind: 'object',\n fields: [\n { name: 'action', wireKey: 'at', optional: false, codec: numberCodec },\n { name: 'bytes', wireKey: 'bs', optional: true, codec: bytesCodec },\n { name: 'uint', wireKey: 'ui', optional: true, codec: bigIntCodec },\n ],\n}\n\n/**\n * State changes from application execution, including inner transactions and logs.\n */\nexport type BlockAppEvalDelta = {\n /** [gd] Global state delta for the application. */\n globalDelta?: Map<Uint8Array, BlockEvalDelta>\n /** [ld] Local state deltas keyed by address index. */\n localDeltas?: Map<number, Map<Uint8Array, BlockEvalDelta>>\n /** [itx] Inner transactions produced by this application execution. */\n innerTxns?: SignedTxnWithAD[]\n /** [sa] Shared accounts referenced by local deltas. */\n sharedAccounts?: Address[]\n /** [lg] Application log outputs. */\n logs?: Uint8Array[]\n}\n\nconst BlockAppEvalDeltaMeta: ObjectModelMetadata<BlockAppEvalDelta> = {\n name: 'BlockAppEvalDelta',\n kind: 'object',\n fields: [\n {\n name: 'globalDelta',\n wireKey: 'gd',\n optional: true,\n codec: new MapCodec(bytesCodec, new ObjectModelCodec(BlockEvalDeltaMeta)),\n },\n {\n name: 'localDeltas',\n wireKey: 'ld',\n optional: true,\n codec: new MapCodec(numberCodec, new MapCodec(bytesCodec, new ObjectModelCodec(BlockEvalDeltaMeta))),\n },\n {\n name: 'innerTxns',\n wireKey: 'itx',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(() => SignedTxnWithADMeta)),\n },\n {\n name: 'sharedAccounts',\n wireKey: 'sa',\n optional: true,\n codec: addressArrayCodec,\n },\n { name: 'logs', wireKey: 'lg', optional: true, codec: bytesArrayCodec },\n ],\n}\n\n/** Tracking metadata for a specific StateProofType. */\nexport type BlockStateProofTrackingData = {\n /** [v] Vector commitment root of state proof voters. */\n stateProofVotersCommitment?: Uint8Array\n /** [t] Online total weight during state proof round. */\n stateProofOnlineTotalWeight?: bigint\n /** [n] Next round for which state proofs are accepted. */\n stateProofNextRound?: bigint\n}\n\nconst BlockStateProofTrackingDataMeta: ObjectModelMetadata<BlockStateProofTrackingData> = {\n name: 'BlockStateProofTrackingData',\n kind: 'object',\n fields: [\n { name: 'stateProofVotersCommitment', wireKey: 'v', optional: true, codec: bytesCodec },\n { name: 'stateProofOnlineTotalWeight', wireKey: 't', optional: true, codec: bigIntCodec },\n { name: 'stateProofNextRound', wireKey: 'n', optional: true, codec: bigIntCodec },\n ],\n}\n\nexport type ApplyData = {\n closingAmount?: bigint\n assetClosingAmount?: bigint\n senderRewards?: bigint\n receiverRewards?: bigint\n closeRewards?: bigint\n evalDelta?: BlockAppEvalDelta\n configAsset?: bigint\n applicationId?: bigint\n}\n\nconst ApplyDataMeta: ObjectModelMetadata<ApplyData> = {\n name: 'SignedTxnInBlock',\n kind: 'object',\n fields: [\n { name: 'closingAmount', wireKey: 'ca', optional: true, codec: bigIntCodec },\n { name: 'assetClosingAmount', wireKey: 'aca', optional: true, codec: bigIntCodec },\n { name: 'senderRewards', wireKey: 'rs', optional: true, codec: bigIntCodec },\n { name: 'receiverRewards', wireKey: 'rr', optional: true, codec: bigIntCodec },\n { name: 'closeRewards', wireKey: 'rc', optional: true, codec: bigIntCodec },\n { name: 'evalDelta', wireKey: 'dt', optional: true, codec: new ObjectModelCodec(BlockAppEvalDeltaMeta) },\n { name: 'configAsset', wireKey: 'caid', optional: true, codec: bigIntCodec },\n { name: 'applicationId', wireKey: 'apid', optional: true, codec: bigIntCodec },\n ],\n}\n\n/**\n * SignedTxnWithAD is a SignedTransaction with additional ApplyData.\n */\nexport type SignedTxnWithAD = {\n /** The signed transaction. */\n signedTxn: SignedTransaction\n /** Apply data containing transaction execution information. */\n applyData?: ApplyData\n}\n\nconst SignedTxnWithADMeta: ObjectModelMetadata<SignedTxnWithAD> = {\n name: 'SignedTxnWithAD',\n kind: 'object',\n fields: [\n {\n name: 'signedTxn',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(SignedTransactionMeta),\n },\n {\n name: 'applyData',\n flattened: true,\n optional: true,\n codec: new ObjectModelCodec(ApplyDataMeta),\n },\n ],\n}\n\n/**\n * SignedTxnInBlock is a SignedTransaction with additional ApplyData and block-specific metadata.\n */\nexport type SignedTxnInBlock = {\n signedTxn: SignedTxnWithAD\n hasGenesisId?: boolean\n hasGenesisHash?: boolean\n}\n\nconst SignedTxnInBlockMeta: ObjectModelMetadata<SignedTxnInBlock> = {\n name: 'SignedTxnInBlock',\n kind: 'object',\n fields: [\n {\n name: 'signedTxn',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(SignedTxnWithADMeta),\n },\n { name: 'hasGenesisId', wireKey: 'hgi', optional: true, codec: booleanCodec },\n { name: 'hasGenesisHash', wireKey: 'hgh', optional: true, codec: booleanCodec },\n ],\n}\n\nexport type ParticipationUpdates = {\n /** [partupdrmv] Expired participation accounts. */\n expiredParticipationAccounts: string[]\n /** [partupdabs] Absent participation accounts. */\n absentParticipationAccounts: string[]\n}\n\nconst ParticipationUpdatesMeta: ObjectModelMetadata<ParticipationUpdates> = {\n name: 'ParticipationUpdates',\n kind: 'object',\n fields: [\n {\n name: 'expiredParticipationAccounts',\n wireKey: 'partupdrmv',\n optional: false,\n codec: addressArrayCodec,\n },\n {\n name: 'absentParticipationAccounts',\n wireKey: 'partupdabs',\n optional: false,\n codec: addressArrayCodec,\n },\n ],\n}\n\n/** Transaction commitment hashes for the block. */\nexport type TxnCommitments = {\n /** [txn] Root of transaction merkle tree using SHA512_256. */\n nativeSha512_256Commitment: Uint8Array\n /** [txn256] Root of transaction vector commitment using SHA256. */\n sha256Commitment?: Uint8Array\n /** [txn512] Root of transaction vector commitment using SHA512. */\n sha512Commitment?: Uint8Array\n}\n\nconst TxnCommitmentsMeta: ObjectModelMetadata<TxnCommitments> = {\n name: 'TxnCommitments',\n kind: 'object',\n fields: [\n { name: 'nativeSha512_256Commitment', wireKey: 'txn', optional: false, codec: fixedBytes32Codec },\n { name: 'sha256Commitment', wireKey: 'txn256', optional: true, codec: fixedBytes32Codec },\n { name: 'sha512Commitment', wireKey: 'txn512', optional: true, codec: fixedBytes64Codec },\n ],\n}\n\n/** Reward distribution state for the block. */\nexport type RewardState = {\n /** [fees] FeeSink address. */\n feeSink: Address\n /** [rwd] RewardsPool address. */\n rewardsPool: Address\n /** [earn] Rewards level. */\n rewardsLevel: bigint\n /** [rate] Rewards rate. */\n rewardsRate: bigint\n /** [frac] Rewards residue. */\n rewardsResidue: bigint\n /** [rwcalr] Rewards recalculation round. */\n rewardsRecalculationRound: bigint\n}\n\nconst RewardStateMeta: ObjectModelMetadata<RewardState> = {\n name: 'RewardState',\n kind: 'object',\n fields: [\n { name: 'feeSink', wireKey: 'fees', optional: false, codec: addressCodec },\n { name: 'rewardsPool', wireKey: 'rwd', optional: false, codec: addressCodec },\n { name: 'rewardsLevel', wireKey: 'earn', optional: false, codec: bigIntCodec },\n { name: 'rewardsRate', wireKey: 'rate', optional: false, codec: bigIntCodec },\n { name: 'rewardsResidue', wireKey: 'frac', optional: false, codec: bigIntCodec },\n { name: 'rewardsRecalculationRound', wireKey: 'rwcalr', optional: false, codec: bigIntCodec },\n ],\n}\n\n/** Protocol upgrade state for the block. */\nexport type UpgradeState = {\n /** [proto] Current consensus protocol. */\n currentProtocol: string\n /** [nextproto] Next proposed protocol. */\n nextProtocol?: string\n /** [nextyes] Next protocol approvals. */\n nextProtocolApprovals?: bigint\n /** [nextbefore] Next protocol vote deadline. */\n nextProtocolVoteBefore?: bigint\n /** [nextswitch] Next protocol switch round. */\n nextProtocolSwitchOn?: bigint\n}\n\nconst UpgradeStateMeta: ObjectModelMetadata<UpgradeState> = {\n name: 'UpgradeState',\n kind: 'object',\n fields: [\n { name: 'currentProtocol', wireKey: 'proto', optional: false, codec: stringCodec },\n { name: 'nextProtocol', wireKey: 'nextproto', optional: true, codec: stringCodec },\n { name: 'nextProtocolApprovals', wireKey: 'nextyes', optional: true, codec: bigIntCodec },\n { name: 'nextProtocolVoteBefore', wireKey: 'nextbefore', optional: true, codec: bigIntCodec },\n { name: 'nextProtocolSwitchOn', wireKey: 'nextswitch', optional: true, codec: bigIntCodec },\n ],\n}\n\n/** Protocol upgrade vote parameters for the block. */\nexport type UpgradeVote = {\n /** [upgradeprop] Upgrade proposal. */\n upgradePropose?: string\n /** [upgradedelay] Upgrade delay in rounds. */\n upgradeDelay?: bigint\n /** [upgradeyes] Upgrade approval flag. */\n upgradeApprove?: boolean\n}\n\nconst UpgradeVoteMeta: ObjectModelMetadata<UpgradeVote> = {\n name: 'UpgradeVote',\n kind: 'object',\n fields: [\n { name: 'upgradePropose', wireKey: 'upgradeprop', optional: true, codec: stringCodec },\n { name: 'upgradeDelay', wireKey: 'upgradedelay', optional: true, codec: bigIntCodec },\n { name: 'upgradeApprove', wireKey: 'upgradeyes', optional: true, codec: booleanCodec },\n ],\n}\n\nexport type BlockHeader = {\n /** [rnd] Round number. */\n round: bigint\n /** [prev] Previous block hash. */\n previousBlockHash: Uint8Array\n /** [prev512] Previous block hash using SHA-512. */\n previousBlockHash512?: Uint8Array\n /** [seed] Sortition seed. */\n seed: Uint8Array\n /** Authenticates the set of transactions appearing in the block. */\n txnCommitments: TxnCommitments\n /** [ts] Block timestamp in seconds since epoch. */\n timestamp: bigint\n /** [gen] Genesis ID. */\n genesisId: string\n /** [gh] Genesis hash. */\n genesisHash: Uint8Array\n /** [prp] Proposer address. */\n proposer?: Address\n /** [fc] Fees collected in this block. */\n feesCollected?: bigint\n /** [bi] Bonus incentive for block proposal. */\n bonus?: bigint\n /** [pp] Proposer payout. */\n proposerPayout?: bigint\n /** Reward distribution state. */\n rewardState: RewardState\n /** Protocol upgrade state. */\n upgradeState: UpgradeState\n /** Protocol upgrade vote parameters. */\n upgradeVote?: UpgradeVote\n /** [tc] Transaction counter. */\n txnCounter?: bigint\n /** [spt] State proof tracking data keyed by state proof type. */\n stateProofTracking?: Map<number, BlockStateProofTrackingData>\n /** Represents participation account data that needs to be checked/acted on by the network */\n participationUpdates: ParticipationUpdates\n}\n\nconst BlockHeaderMeta: ObjectModelMetadata<BlockHeader> = {\n name: 'BlockHeader',\n kind: 'object',\n fields: [\n { name: 'round', wireKey: 'rnd', optional: false, codec: bigIntCodec },\n { name: 'previousBlockHash', wireKey: 'prev', optional: false, codec: fixedBytes32Codec },\n { name: 'previousBlockHash512', wireKey: 'prev512', optional: true, codec: fixedBytes64Codec },\n { name: 'seed', wireKey: 'seed', optional: false, codec: bytesCodec },\n {\n name: 'txnCommitments',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(TxnCommitmentsMeta),\n },\n { name: 'timestamp', wireKey: 'ts', optional: false, codec: bigIntCodec },\n { name: 'genesisId', wireKey: 'gen', optional: false, codec: stringCodec },\n { name: 'genesisHash', wireKey: 'gh', optional: false, codec: fixedBytes32Codec },\n { name: 'proposer', wireKey: 'prp', optional: true, codec: addressCodec },\n { name: 'feesCollected', wireKey: 'fc', optional: true, codec: bigIntCodec },\n { name: 'bonus', wireKey: 'bi', optional: true, codec: bigIntCodec },\n { name: 'proposerPayout', wireKey: 'pp', optional: true, codec: bigIntCodec },\n {\n name: 'rewardState',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(RewardStateMeta),\n },\n {\n name: 'upgradeState',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(UpgradeStateMeta),\n },\n {\n name: 'upgradeVote',\n flattened: true,\n optional: true,\n codec: new ObjectModelCodec(UpgradeVoteMeta),\n },\n { name: 'txnCounter', wireKey: 'tc', optional: true, codec: bigIntCodec },\n {\n name: 'stateProofTracking',\n wireKey: 'spt',\n optional: true,\n codec: new MapCodec(numberCodec, new ObjectModelCodec(BlockStateProofTrackingDataMeta)),\n },\n {\n name: 'participationUpdates',\n flattened: true,\n optional: false,\n codec: new ObjectModelCodec(ParticipationUpdatesMeta),\n },\n ],\n}\n\n/**\n * Block contains the BlockHeader and the list of transactions (Payset).\n */\nexport type Block = {\n /** The block information (Header) */\n header: BlockHeader\n\n /** [txns] Block transactions (Payset). */\n payset: SignedTxnInBlock[]\n}\n\nconst BlockMeta: ObjectModelMetadata<Block> = {\n name: 'Block',\n kind: 'object',\n fields: [\n { name: 'header', flattened: true, optional: false, codec: new ObjectModelCodec(BlockHeaderMeta) },\n {\n name: 'payset',\n wireKey: 'txns',\n optional: false,\n codec: new ArrayCodec(new ObjectModelCodec(SignedTxnInBlockMeta)),\n },\n ],\n}\n\n/**\n * Custom codec for Block that populates genesis information on transactions after decoding.\n *\n * When blocks are returned from algod, transactions may not include the genesisId\n * and genesisHash fields even though they are required for correct transaction ID calculation.\n * The block contains `hasGenesisId` and `hasGenesisHash` flags that indicate whether these\n * fields should be populated from the block header.\n *\n * This codec automatically populates these fields after decoding to ensure transaction IDs\n * can be calculated correctly.\n */\nclass BlockCodec extends ObjectModelCodec<Block> {\n constructor() {\n super(BlockMeta)\n }\n\n protected fromEncoded(value: WireObject, format: EncodingFormat): Block {\n const block = super.fromEncoded(value, format)\n\n // Populate genesis id and hash on transactions if required to ensure tx id's are correct\n const genesisId = block.header.genesisId\n const genesisHash = block.header.genesisHash\n\n for (const txnInBlock of block.payset ?? []) {\n const txn = txnInBlock.signedTxn.signedTxn.txn\n\n if (txnInBlock.hasGenesisId && txn.genesisId === undefined) {\n txn.genesisId = genesisId\n }\n\n // The following assumes that Consensus.RequireGenesisHash is true\n // so assigns genesis hash unless explicitly set to false\n if (txnInBlock.hasGenesisHash !== false && txn.genesisHash === undefined) {\n txn.genesisHash = genesisHash\n }\n }\n\n return block\n }\n}\n\nexport const blockCodec = new BlockCodec()\n"],"mappings":";;;;;;;;;;;;;AA+BA,MAAMA,qBAA0D;CAC9D,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GAAE,MAAM;GAAU,SAAS;GAAM,UAAU;GAAO,OAAO;GAAa;EACtE;GAAE,MAAM;GAAS,SAAS;GAAM,UAAU;GAAM,OAAO;GAAY;EACnE;GAAE,MAAM;GAAQ,SAAS;GAAM,UAAU;GAAM,OAAO;GAAa;EACpE;CACF;AAkBD,MAAMC,wBAAgE;CACpE,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAI,SAAS,YAAY,IAAI,iBAAiB,mBAAmB,CAAC;GAC1E;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAI,SAAS,aAAa,IAAI,SAAS,YAAY,IAAI,iBAAiB,mBAAmB,CAAC,CAAC;GACrG;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAI,WAAW,IAAI,uBAAuB,oBAAoB,CAAC;GACvE;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GAAE,MAAM;GAAQ,SAAS;GAAM,UAAU;GAAM,OAAO;GAAiB;EACxE;CACF;AAYD,MAAMC,kCAAoF;CACxF,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GAAE,MAAM;GAA8B,SAAS;GAAK,UAAU;GAAM,OAAO;GAAY;EACvF;GAAE,MAAM;GAA+B,SAAS;GAAK,UAAU;GAAM,OAAO;GAAa;EACzF;GAAE,MAAM;GAAuB,SAAS;GAAK,UAAU;GAAM,OAAO;GAAa;EAClF;CACF;AAaD,MAAMC,gBAAgD;CACpD,MA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