@algorandfoundation/algokit-utils 10.0.0-alpha.22 → 10.0.0-alpha.24
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.js.map +1 -1
- package/packages/algod_client/src/models/block.mjs.map +1 -1
- package/packages/algod_client/src/models/eval-delta-key-value.js +2 -2
- package/packages/algod_client/src/models/eval-delta-key-value.js.map +1 -1
- package/packages/algod_client/src/models/eval-delta-key-value.mjs +2 -2
- package/packages/algod_client/src/models/eval-delta-key-value.mjs.map +1 -1
- package/packages/algod_client/src/models/eval-delta.js +2 -2
- package/packages/algod_client/src/models/eval-delta.js.map +1 -1
- package/packages/algod_client/src/models/eval-delta.mjs +2 -2
- package/packages/algod_client/src/models/eval-delta.mjs.map +1 -1
- package/packages/common/src/codecs/primitives/bytes-base64.js +26 -0
- package/packages/common/src/codecs/primitives/bytes-base64.js.map +1 -0
- package/packages/common/src/codecs/primitives/bytes-base64.mjs +25 -0
- package/packages/common/src/codecs/primitives/bytes-base64.mjs.map +1 -0
- package/transactions/method-call.js +7 -6
- package/transactions/method-call.js.map +1 -1
- package/transactions/method-call.mjs +7 -6
- package/transactions/method-call.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +28 -28
- package/types/algorand-client-transaction-sender.d.ts +28 -28
- package/types/app-client.d.ts +70 -70
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs.map +1 -1
- package/types/app-factory.d.ts +35 -35
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.24",
|
|
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",
|
|
@@ -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 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;EACpE;CACF;AAkBD,MAAMC,wBAAgE;CACpE,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;G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AAM,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.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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AOH;KAAa;IACzE;KACE,MAAM;KACN,SAAS;KACT,UAAU;KACV,OAAO,IAAIE,qBAASJ,4BAAa,IAAIK,sCAAiB,gCAAgC,CAAC;KACxF;IACD;KACE,MAAM;KACN,WAAW;KACX,UAAU;KACV,OAAO,IAAIA,sCAAiB,yBAAyB;KACtD;IACF;GACF,CAiBmG;EAAE,EAClG;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO,IAAIC,yBAAW,IAAID,sCAAiB,qBAAqB,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 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;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;KACN,WAAW;KACX,UAAU;KACV,OAAO,IAAI,iBAAiB,iBAAiB;KAC9C;IACD;KACE,MAAM;KACN,WAAW;KACX,UAAU;KACV,OAAO,IAAI,iBAAiB,gBAAgB;KAC7C;IACD;KAAE,MAAM;KAAc,SAAS;KAAM,UAAU;KAAM,OAAO;KAAa;IACzE;KACE,MAAM;KACN,SAAS;KACT,UAAU;KACV,OAAO,IAAI,SAAS,aAAa,IAAI,iBAAiB,gCAAgC,CAAC;KACxF;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 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,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,O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ives/bytes-base64.js');
|
|
2
2
|
const require_object_model = require('../../../common/src/codecs/models/object-model.js');
|
|
3
3
|
const require_eval_delta = require('./eval-delta.js');
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ const EvalDeltaKeyValueMeta = {
|
|
|
10
10
|
name: "key",
|
|
11
11
|
wireKey: "key",
|
|
12
12
|
optional: false,
|
|
13
|
-
codec:
|
|
13
|
+
codec: require_bytes_base64.bytesBase64Codec
|
|
14
14
|
}, {
|
|
15
15
|
name: "value",
|
|
16
16
|
wireKey: "value",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval-delta-key-value.js","names":["EvalDeltaKeyValueMeta: ObjectModelMetadata<EvalDeltaKeyValue>","
|
|
1
|
+
{"version":3,"file":"eval-delta-key-value.js","names":["EvalDeltaKeyValueMeta: ObjectModelMetadata<EvalDeltaKeyValue>","bytesBase64Codec","ObjectModelCodec","EvalDeltaMeta"],"sources":["../../../../../packages/algod_client/src/models/eval-delta-key-value.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { bytesBase64Codec, ObjectModelCodec } from '@algorandfoundation/algokit-common'\nimport type { EvalDelta } from './eval-delta'\nimport { EvalDeltaMeta } from './eval-delta'\n\n/**\n * Key-value pairs for StateDelta.\n */\nexport type EvalDeltaKeyValue = {\n key: Uint8Array\n value: EvalDelta\n}\n\nexport const EvalDeltaKeyValueMeta: ObjectModelMetadata<EvalDeltaKeyValue> = {\n name: 'EvalDeltaKeyValue',\n kind: 'object',\n fields: [\n {\n name: 'key',\n wireKey: 'key',\n optional: false,\n codec: bytesBase64Codec,\n },\n {\n name: 'value',\n wireKey: 'value',\n optional: false,\n codec: new ObjectModelCodec(EvalDeltaMeta),\n },\n ],\n}\n"],"mappings":";;;;;AAaA,MAAaA,wBAAgE;CAC3E,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOC;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO,IAAIC,sCAAiBC,iCAAc;EAC3C,CACF;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bytesBase64Codec } from "../../../common/src/codecs/primitives/bytes-base64.mjs";
|
|
2
2
|
import { ObjectModelCodec } from "../../../common/src/codecs/models/object-model.mjs";
|
|
3
3
|
import { EvalDeltaMeta } from "./eval-delta.mjs";
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ const EvalDeltaKeyValueMeta = {
|
|
|
10
10
|
name: "key",
|
|
11
11
|
wireKey: "key",
|
|
12
12
|
optional: false,
|
|
13
|
-
codec:
|
|
13
|
+
codec: bytesBase64Codec
|
|
14
14
|
}, {
|
|
15
15
|
name: "value",
|
|
16
16
|
wireKey: "value",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval-delta-key-value.mjs","names":["EvalDeltaKeyValueMeta: ObjectModelMetadata<EvalDeltaKeyValue>"],"sources":["../../../../../packages/algod_client/src/models/eval-delta-key-value.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport {
|
|
1
|
+
{"version":3,"file":"eval-delta-key-value.mjs","names":["EvalDeltaKeyValueMeta: ObjectModelMetadata<EvalDeltaKeyValue>"],"sources":["../../../../../packages/algod_client/src/models/eval-delta-key-value.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { bytesBase64Codec, ObjectModelCodec } from '@algorandfoundation/algokit-common'\nimport type { EvalDelta } from './eval-delta'\nimport { EvalDeltaMeta } from './eval-delta'\n\n/**\n * Key-value pairs for StateDelta.\n */\nexport type EvalDeltaKeyValue = {\n key: Uint8Array\n value: EvalDelta\n}\n\nexport const EvalDeltaKeyValueMeta: ObjectModelMetadata<EvalDeltaKeyValue> = {\n name: 'EvalDeltaKeyValue',\n kind: 'object',\n fields: [\n {\n name: 'key',\n wireKey: 'key',\n optional: false,\n codec: bytesBase64Codec,\n },\n {\n name: 'value',\n wireKey: 'value',\n optional: false,\n codec: new ObjectModelCodec(EvalDeltaMeta),\n },\n ],\n}\n"],"mappings":";;;;;AAaA,MAAaA,wBAAgE;CAC3E,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO,IAAI,iBAAiB,cAAc;EAC3C,CACF;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_bigint = require('../../../common/src/codecs/primitives/bigint.js');
|
|
2
|
-
const
|
|
2
|
+
const require_bytes_base64 = require('../../../common/src/codecs/primitives/bytes-base64.js');
|
|
3
3
|
const require_number = require('../../../common/src/codecs/primitives/number.js');
|
|
4
4
|
|
|
5
5
|
//#region packages/algod_client/src/models/eval-delta.ts
|
|
@@ -17,7 +17,7 @@ const EvalDeltaMeta = {
|
|
|
17
17
|
name: "bytes",
|
|
18
18
|
wireKey: "bytes",
|
|
19
19
|
optional: true,
|
|
20
|
-
codec:
|
|
20
|
+
codec: require_bytes_base64.bytesBase64Codec
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
name: "uint",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval-delta.js","names":["EvalDeltaMeta: ObjectModelMetadata<EvalDelta>","numberCodec","
|
|
1
|
+
{"version":3,"file":"eval-delta.js","names":["EvalDeltaMeta: ObjectModelMetadata<EvalDelta>","numberCodec","bytesBase64Codec","bigIntCodec"],"sources":["../../../../../packages/algod_client/src/models/eval-delta.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec, bigIntCodec, bytesBase64Codec } from '@algorandfoundation/algokit-common'\n\n/**\n * Represents a TEAL value delta.\n */\nexport type EvalDelta = {\n /**\n * \\[at\\] delta action.\n */\n action: number\n\n /**\n * \\[bs\\] bytes value.\n */\n bytes?: Uint8Array\n\n /**\n * \\[ui\\] uint value.\n */\n uint?: bigint\n}\n\nexport const EvalDeltaMeta: ObjectModelMetadata<EvalDelta> = {\n name: 'EvalDelta',\n kind: 'object',\n fields: [\n {\n name: 'action',\n wireKey: 'action',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'bytes',\n wireKey: 'bytes',\n optional: true,\n codec: bytesBase64Codec,\n },\n {\n name: 'uint',\n wireKey: 'uint',\n optional: true,\n codec: bigIntCodec,\n },\n ],\n}\n"],"mappings":";;;;;AAuBA,MAAaA,gBAAgD;CAC3D,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACF;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bigIntCodec } from "../../../common/src/codecs/primitives/bigint.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { bytesBase64Codec } from "../../../common/src/codecs/primitives/bytes-base64.mjs";
|
|
3
3
|
import { numberCodec } from "../../../common/src/codecs/primitives/number.mjs";
|
|
4
4
|
|
|
5
5
|
//#region packages/algod_client/src/models/eval-delta.ts
|
|
@@ -17,7 +17,7 @@ const EvalDeltaMeta = {
|
|
|
17
17
|
name: "bytes",
|
|
18
18
|
wireKey: "bytes",
|
|
19
19
|
optional: true,
|
|
20
|
-
codec:
|
|
20
|
+
codec: bytesBase64Codec
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
name: "uint",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval-delta.mjs","names":["EvalDeltaMeta: ObjectModelMetadata<EvalDelta>"],"sources":["../../../../../packages/algod_client/src/models/eval-delta.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec, bigIntCodec,
|
|
1
|
+
{"version":3,"file":"eval-delta.mjs","names":["EvalDeltaMeta: ObjectModelMetadata<EvalDelta>"],"sources":["../../../../../packages/algod_client/src/models/eval-delta.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec, bigIntCodec, bytesBase64Codec } from '@algorandfoundation/algokit-common'\n\n/**\n * Represents a TEAL value delta.\n */\nexport type EvalDelta = {\n /**\n * \\[at\\] delta action.\n */\n action: number\n\n /**\n * \\[bs\\] bytes value.\n */\n bytes?: Uint8Array\n\n /**\n * \\[ui\\] uint value.\n */\n uint?: bigint\n}\n\nexport const EvalDeltaMeta: ObjectModelMetadata<EvalDelta> = {\n name: 'EvalDelta',\n kind: 'object',\n fields: [\n {\n name: 'action',\n wireKey: 'action',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'bytes',\n wireKey: 'bytes',\n optional: true,\n codec: bytesBase64Codec,\n },\n {\n name: 'uint',\n wireKey: 'uint',\n optional: true,\n codec: bigIntCodec,\n },\n ],\n}\n"],"mappings":";;;;;AAuBA,MAAaA,gBAAgD;CAC3D,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACF;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_codec = require('../codec.js');
|
|
3
|
+
let buffer = require("buffer");
|
|
4
|
+
|
|
5
|
+
//#region packages/common/src/codecs/primitives/bytes-base64.ts
|
|
6
|
+
var BytesBase64Codec = class extends require_codec.Codec {
|
|
7
|
+
defaultValue() {
|
|
8
|
+
return new Uint8Array();
|
|
9
|
+
}
|
|
10
|
+
toEncoded(value, _format) {
|
|
11
|
+
return buffer.Buffer.from(value).toString("base64");
|
|
12
|
+
}
|
|
13
|
+
fromEncoded(value, _format) {
|
|
14
|
+
if (value instanceof Uint8Array) return new Uint8Array(buffer.Buffer.from(buffer.Buffer.from(value).toString("utf-8"), "base64"));
|
|
15
|
+
if (typeof value === "string") return new Uint8Array(buffer.Buffer.from(value, "base64"));
|
|
16
|
+
throw new Error(`Cannot decode bytes from ${typeof value}`);
|
|
17
|
+
}
|
|
18
|
+
isDefaultValue(value) {
|
|
19
|
+
return value.byteLength === 0;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const bytesBase64Codec = new BytesBase64Codec();
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.bytesBase64Codec = bytesBase64Codec;
|
|
26
|
+
//# sourceMappingURL=bytes-base64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes-base64.js","names":["Codec","Buffer"],"sources":["../../../../../../packages/common/src/codecs/primitives/bytes-base64.ts"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\nimport { WireString } from '../wire'\n\n// Some fields in the msgpack encoded models are base64 encoded strings representing bytes values.\n// This is a deviation from the general pattern of using raw byte arrays for bytes fields in the wire format.\n// This codec explicitly handles encoding/decoding of base64 string encoded bytes fields.\nclass BytesBase64Codec extends Codec<Uint8Array, WireString> {\n public defaultValue(): Uint8Array {\n return new Uint8Array()\n }\n\n protected toEncoded(value: Uint8Array, _format: EncodingFormat): WireString {\n return Buffer.from(value).toString('base64')\n }\n\n protected fromEncoded(value: WireString, _format: EncodingFormat): Uint8Array {\n if (value instanceof Uint8Array) {\n return new Uint8Array(Buffer.from(Buffer.from(value).toString('utf-8'), 'base64'))\n }\n if (typeof value === 'string') {\n return new Uint8Array(Buffer.from(value, 'base64'))\n }\n throw new Error(`Cannot decode bytes from ${typeof value}`)\n }\n\n public isDefaultValue(value: Uint8Array): boolean {\n return value.byteLength === 0\n }\n}\n\nexport const bytesBase64Codec = new BytesBase64Codec()\n"],"mappings":";;;;;AAQA,IAAM,mBAAN,cAA+BA,oBAA8B;CAC3D,AAAO,eAA2B;AAChC,SAAO,IAAI,YAAY;;CAGzB,AAAU,UAAU,OAAmB,SAAqC;AAC1E,SAAOC,cAAO,KAAK,MAAM,CAAC,SAAS,SAAS;;CAG9C,AAAU,YAAY,OAAmB,SAAqC;AAC5E,MAAI,iBAAiB,WACnB,QAAO,IAAI,WAAWA,cAAO,KAAKA,cAAO,KAAK,MAAM,CAAC,SAAS,QAAQ,EAAE,SAAS,CAAC;AAEpF,MAAI,OAAO,UAAU,SACnB,QAAO,IAAI,WAAWA,cAAO,KAAK,OAAO,SAAS,CAAC;AAErD,QAAM,IAAI,MAAM,4BAA4B,OAAO,QAAQ;;CAG7D,AAAO,eAAe,OAA4B;AAChD,SAAO,MAAM,eAAe;;;AAIhC,MAAa,mBAAmB,IAAI,kBAAkB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Codec } from "../codec.mjs";
|
|
2
|
+
import { Buffer } from "buffer";
|
|
3
|
+
|
|
4
|
+
//#region packages/common/src/codecs/primitives/bytes-base64.ts
|
|
5
|
+
var BytesBase64Codec = class extends Codec {
|
|
6
|
+
defaultValue() {
|
|
7
|
+
return new Uint8Array();
|
|
8
|
+
}
|
|
9
|
+
toEncoded(value, _format) {
|
|
10
|
+
return Buffer.from(value).toString("base64");
|
|
11
|
+
}
|
|
12
|
+
fromEncoded(value, _format) {
|
|
13
|
+
if (value instanceof Uint8Array) return new Uint8Array(Buffer.from(Buffer.from(value).toString("utf-8"), "base64"));
|
|
14
|
+
if (typeof value === "string") return new Uint8Array(Buffer.from(value, "base64"));
|
|
15
|
+
throw new Error(`Cannot decode bytes from ${typeof value}`);
|
|
16
|
+
}
|
|
17
|
+
isDefaultValue(value) {
|
|
18
|
+
return value.byteLength === 0;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const bytesBase64Codec = new BytesBase64Codec();
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { bytesBase64Codec };
|
|
25
|
+
//# sourceMappingURL=bytes-base64.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes-base64.mjs","names":[],"sources":["../../../../../../packages/common/src/codecs/primitives/bytes-base64.ts"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\nimport { WireString } from '../wire'\n\n// Some fields in the msgpack encoded models are base64 encoded strings representing bytes values.\n// This is a deviation from the general pattern of using raw byte arrays for bytes fields in the wire format.\n// This codec explicitly handles encoding/decoding of base64 string encoded bytes fields.\nclass BytesBase64Codec extends Codec<Uint8Array, WireString> {\n public defaultValue(): Uint8Array {\n return new Uint8Array()\n }\n\n protected toEncoded(value: Uint8Array, _format: EncodingFormat): WireString {\n return Buffer.from(value).toString('base64')\n }\n\n protected fromEncoded(value: WireString, _format: EncodingFormat): Uint8Array {\n if (value instanceof Uint8Array) {\n return new Uint8Array(Buffer.from(Buffer.from(value).toString('utf-8'), 'base64'))\n }\n if (typeof value === 'string') {\n return new Uint8Array(Buffer.from(value, 'base64'))\n }\n throw new Error(`Cannot decode bytes from ${typeof value}`)\n }\n\n public isDefaultValue(value: Uint8Array): boolean {\n return value.byteLength === 0\n }\n}\n\nexport const bytesBase64Codec = new BytesBase64Codec()\n"],"mappings":";;;;AAQA,IAAM,mBAAN,cAA+B,MAA8B;CAC3D,AAAO,eAA2B;AAChC,SAAO,IAAI,YAAY;;CAGzB,AAAU,UAAU,OAAmB,SAAqC;AAC1E,SAAO,OAAO,KAAK,MAAM,CAAC,SAAS,SAAS;;CAG9C,AAAU,YAAY,OAAmB,SAAqC;AAC5E,MAAI,iBAAiB,WACnB,QAAO,IAAI,WAAW,OAAO,KAAK,OAAO,KAAK,MAAM,CAAC,SAAS,QAAQ,EAAE,SAAS,CAAC;AAEpF,MAAI,OAAO,UAAU,SACnB,QAAO,IAAI,WAAW,OAAO,KAAK,OAAO,SAAS,CAAC;AAErD,QAAM,IAAI,MAAM,4BAA4B,OAAO,QAAQ;;CAG7D,AAAO,eAAe,OAA4B;AAChD,SAAO,MAAM,eAAe;;;AAIhC,MAAa,mBAAmB,IAAI,kBAAkB"}
|
|
@@ -9,7 +9,7 @@ const require_abi_type = require('../packages/abi/src/abi-type.js');
|
|
|
9
9
|
const require_abi_method = require('../packages/abi/src/abi-method.js');
|
|
10
10
|
|
|
11
11
|
//#region src/transactions/method-call.ts
|
|
12
|
-
const ARGS_TUPLE_PACKING_THRESHOLD =
|
|
12
|
+
const ARGS_TUPLE_PACKING_THRESHOLD = 15;
|
|
13
13
|
function extractComposerTransactionsFromAppMethodCallParams(params, parentSigner) {
|
|
14
14
|
const composerTransactions = new Array();
|
|
15
15
|
const methodCallArgs = params.args;
|
|
@@ -175,11 +175,12 @@ function encodeArgsIndividually(abiTypes, abiValues) {
|
|
|
175
175
|
*/
|
|
176
176
|
function encodeArgsWithTuplePacking(abiTypes, abiValues) {
|
|
177
177
|
const encodedArgs = [];
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const
|
|
178
|
+
const splitAt = ARGS_TUPLE_PACKING_THRESHOLD - 1;
|
|
179
|
+
const firstAbiTypes = abiTypes.slice(0, splitAt);
|
|
180
|
+
const firstAbiValues = abiValues.slice(0, splitAt);
|
|
181
|
+
encodedArgs.push(...encodeArgsIndividually(firstAbiTypes, firstAbiValues));
|
|
182
|
+
const remainingAbiTypes = abiTypes.slice(splitAt);
|
|
183
|
+
const remainingAbiValues = abiValues.slice(splitAt);
|
|
183
184
|
if (remainingAbiTypes.length > 0) {
|
|
184
185
|
const tupleEncoded = new require_abi_type.ABITupleType(remainingAbiTypes).encode(remainingAbiValues);
|
|
185
186
|
encodedArgs.push(tupleEncoded);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method-call.js","names":["Address","argTypeIsReference","addr: Address","getAddress","argTypeIsTransaction","ABIUintType","encodedArgs: Uint8Array[]","ABITupleType","buildTransactionCommonData","calculateExtraProgramPages","Transaction","TransactionType","OnApplicationComplete","AppManager"],"sources":["../../src/transactions/method-call.ts"],"sourcesContent":["import {\n ABIMethod,\n ABITupleType,\n ABIType,\n ABIUintType,\n ABIValue,\n argTypeIsReference,\n argTypeIsTransaction,\n} from '@algorandfoundation/algokit-abi'\nimport { SuggestedParams } from '@algorandfoundation/algokit-algod-client'\nimport { Address, Expand, getAddress } from '@algorandfoundation/algokit-common'\nimport { OnApplicationComplete, Transaction, TransactionSigner, TransactionType } from '@algorandfoundation/algokit-transact'\nimport { TransactionWithSigner } from '../transaction'\nimport { AlgoAmount } from '../types/amount'\nimport { AppManager } from '../types/app-manager'\nimport { calculateExtraProgramPages } from '../util'\nimport { AppCreateParams, AppDeleteParams, AppMethodCallParams, AppUpdateParams } from './app-call'\nimport { buildTransactionCommonData } from './common'\n\nconst ARGS_TUPLE_PACKING_THRESHOLD = 14 // 14+ args trigger tuple packing, excluding the method selector\n\n/** Parameters to define an ABI method call create transaction. */\nexport type AppCreateMethodCall = Expand<AppMethodCall<AppCreateParams>>\n/** Parameters to define an ABI method call update transaction. */\nexport type AppUpdateMethodCall = Expand<AppMethodCall<AppUpdateParams>>\n/** Parameters to define an ABI method call delete transaction. */\nexport type AppDeleteMethodCall = Expand<AppMethodCall<AppDeleteParams>>\n/** Parameters to define an ABI method call transaction. */\nexport type AppCallMethodCall = Expand<AppMethodCall<AppMethodCallParams>>\n\nexport type ProcessedAppCreateMethodCall = Expand<\n Omit<AppCreateMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\nexport type ProcessedAppUpdateMethodCall = Expand<\n Omit<AppUpdateMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\nexport type ProcessedAppCallMethodCall = Expand<\n Omit<AppCallMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\n/** Types that can be used to define a transaction argument for an ABI call transaction. */\nexport type AppMethodCallTransactionArgument =\n // The following should match the partial `args` types from `AppMethodCall<T>` below\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n\n/** Parameters to define an ABI method call. */\nexport type AppMethodCall<T> = Expand<Omit<T, 'args'>> & {\n /** The ABI method to call */\n method: ABIMethod\n /** Arguments to the ABI method, either:\n * * An ABI value\n * * A transaction with explicit signer\n * * A transaction (where the signer will be automatically assigned)\n * * An unawaited transaction (e.g. from algorand.createTransaction.{transactionType}())\n * * Another method call (via method call params object)\n * * undefined (this represents a placeholder transaction argument that is fulfilled by another method call argument)\n */\n args?: (\n | ABIValue\n // The following should match the above `AppMethodCallTransactionArgument` type above\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n | undefined\n )[]\n}\n\ntype AppMethodCallArgs = AppMethodCall<unknown>['args']\ntype AppMethodCallArg = NonNullable<AppMethodCallArgs>[number]\n\nexport type AsyncTransactionParams = {\n txn: Promise<Transaction>\n signer?: TransactionSigner\n maxFee?: AlgoAmount\n}\n\nexport type TransactionParams = {\n txn: Transaction\n signer?: TransactionSigner\n maxFee?: AlgoAmount\n}\n\ntype ExtractedMethodCallTransactionArg =\n | { data: TransactionParams; type: 'txn' }\n | {\n data: AsyncTransactionParams\n type: 'asyncTxn'\n }\n | { data: ProcessedAppCallMethodCall | ProcessedAppCreateMethodCall | ProcessedAppUpdateMethodCall; type: 'methodCall' }\n\nexport function extractComposerTransactionsFromAppMethodCallParams(\n params: AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall | AppDeleteMethodCall,\n parentSigner?: TransactionSigner,\n): ExtractedMethodCallTransactionArg[] {\n const composerTransactions = new Array<ExtractedMethodCallTransactionArg>()\n const methodCallArgs = params.args\n if (!methodCallArgs) return []\n\n // Extract signer from params, falling back to parentSigner\n const currentSigner = params.signer ? ('signer' in params.signer ? params.signer.signer : params.signer) : parentSigner\n\n for (let i = 0; i < methodCallArgs.length; i++) {\n const arg = methodCallArgs[i]\n\n if (arg === undefined) {\n // is a transaction or default value placeholder, do nothing\n continue\n }\n if (isAbiValue(arg)) {\n // if is ABI value, also ignore\n continue\n }\n\n if (isTransactionWithSignerArg(arg)) {\n composerTransactions.push({\n data: {\n txn: arg.txn,\n signer: arg.signer,\n },\n type: 'txn',\n })\n\n continue\n }\n if (isAppCallMethodCallArg(arg)) {\n // Recursively extract nested method call transactions, passing the nested call itself and current signer as parent\n const nestedComposerTransactions = extractComposerTransactionsFromAppMethodCallParams(arg, currentSigner)\n composerTransactions.push(...nestedComposerTransactions)\n composerTransactions.push({\n data: {\n ...arg,\n signer: arg.signer ?? currentSigner,\n args: processAppMethodCallArgs(arg.args),\n },\n type: 'methodCall',\n } satisfies ExtractedMethodCallTransactionArg)\n\n continue\n }\n if (arg instanceof Promise) {\n composerTransactions.push({\n data: {\n txn: arg,\n signer: currentSigner,\n },\n type: 'asyncTxn',\n })\n continue\n }\n\n composerTransactions.push({\n data: {\n txn: Promise.resolve(arg),\n signer: currentSigner,\n },\n type: 'asyncTxn',\n })\n }\n\n return composerTransactions\n}\n\nexport function processAppMethodCallArgs(args: AppMethodCallArg[] | undefined): (ABIValue | undefined)[] | undefined {\n if (args === undefined) return undefined\n\n return args.map((arg) => {\n if (arg === undefined) {\n // Handle explicit placeholders (either transaction or default value)\n return undefined\n } else if (!isAbiValue(arg)) {\n // If the arg is not an ABIValue, it's must be a transaction, set to undefined\n // transaction arguments should be flattened out and added into the composer during the add process\n return undefined\n }\n return arg\n })\n}\n\nfunction isTransactionWithSignerArg(arg: AppMethodCallArg): arg is TransactionWithSigner {\n return typeof arg === 'object' && arg !== undefined && 'txn' in arg && 'signer' in arg\n}\n\nfunction isAppCallMethodCallArg(\n arg: AppMethodCallArg,\n): arg is AppMethodCall<AppCreateParams> | AppMethodCall<AppUpdateParams> | AppMethodCall<AppMethodCallParams> {\n return typeof arg === 'object' && arg !== undefined && 'method' in arg\n}\n\nconst isAbiValue = (x: unknown): x is ABIValue => {\n if (Array.isArray(x)) return x.length == 0 || x.every(isAbiValue)\n\n // If x is a POJO literal\n if (Object.getPrototypeOf(x) === Object.getPrototypeOf({})) {\n return Object.values(x as object).every(isAbiValue)\n }\n\n return (\n typeof x === 'bigint' ||\n typeof x === 'boolean' ||\n typeof x === 'number' ||\n typeof x === 'string' ||\n x instanceof Uint8Array ||\n x instanceof Address\n )\n}\n\n/**\n * Prepares method arguments for ABI encoding by building reference arrays and\n * replacing reference-type arguments (account, asset, application) with their indices.\n */\nfunction prepareArgsForEncoding(\n sender: Address,\n appId: bigint,\n method: ABIMethod,\n methodArgs: (ABIValue | undefined)[],\n accountReferences?: Address[],\n appReferences?: bigint[],\n assetReferences?: bigint[],\n): { accountReferences: Address[]; appReferences: bigint[]; assetReferences: bigint[]; updatedArgs: (ABIValue | undefined)[] } {\n const accounts = [...(accountReferences ?? [])]\n const assets = [...(assetReferences ?? [])]\n const apps = [...(appReferences ?? [])]\n\n const updatedArgs = methodArgs.map((arg, i) => {\n const argType = method.args[i].type\n if (!argTypeIsReference(argType)) {\n return arg\n }\n switch (argType) {\n case 'account': {\n let addr: Address\n if (typeof arg === 'string') {\n addr = getAddress(arg)\n } else if (arg instanceof Uint8Array) {\n addr = new Address(arg)\n } else {\n throw new Error('Invalid value for account')\n }\n\n if (sender.equals(addr)) {\n return 0\n }\n\n const existing = accounts.findIndex((a) => a.equals(addr)) + 1\n if (existing) return existing\n\n accounts.push(addr)\n return accounts.length\n }\n case 'asset': {\n if (typeof arg !== 'bigint') {\n throw new Error('Invalid value for asset')\n }\n\n const existing = assets.findIndex((a) => a === arg)\n if (existing === -1) {\n assets.push(arg)\n return assets.length - 1\n }\n\n return existing\n }\n case 'application': {\n if (typeof arg !== 'bigint') {\n throw new Error('Invalid value for application')\n }\n\n if (arg === appId) return 0\n\n const existing = apps.findIndex((a) => a === arg) + 1\n if (existing) return existing\n\n apps.push(arg)\n return apps.length\n }\n }\n })\n\n return { accountReferences: accounts, appReferences: apps, assetReferences: assets, updatedArgs }\n}\n\n/**\n * Encode ABI method arguments with tuple packing support\n * Ports the logic from the Rust encode_method_arguments function\n */\nfunction encodeMethodArguments(method: ABIMethod, args: (ABIValue | undefined)[]): Uint8Array[] {\n const encodedArgs = new Array<Uint8Array>()\n\n // Insert method selector at the front\n encodedArgs.push(method.getSelector())\n\n // Get ABI types for non-transaction arguments\n const abiTypes = new Array<ABIType>()\n const abiValues = new Array<ABIValue>()\n\n // Process each method argument\n for (let i = 0; i < method.args.length; i++) {\n const methodArg = method.args[i]\n const argValue = args[i]\n\n if (argTypeIsTransaction(methodArg.type)) {\n // Transaction arguments are not ABI encoded - they're handled separately\n } else if (argTypeIsReference(methodArg.type)) {\n // Reference types are encoded as uint8 indexes\n const referenceType = methodArg.type\n if (typeof argValue === 'number') {\n abiTypes.push(new ABIUintType(8))\n abiValues.push(argValue)\n } else {\n throw new Error(`Invalid reference value for ${referenceType}: ${argValue}`)\n }\n } else if (argValue !== undefined) {\n // Regular ABI value\n abiTypes.push(methodArg.type)\n // it's safe to cast to ABIValue here because the abiType must be ABIValue\n abiValues.push(argValue as ABIValue)\n }\n\n // Skip undefined values (transaction placeholders)\n }\n\n if (abiValues.length !== abiTypes.length) {\n throw new Error('Mismatch in length of non-transaction arguments')\n }\n\n // Apply ARC-4 tuple packing for methods with more than 14 arguments\n // 14 instead of 15 in the ARC-4 because the first argument (method selector) is added separately\n if (abiTypes.length > ARGS_TUPLE_PACKING_THRESHOLD) {\n encodedArgs.push(...encodeArgsWithTuplePacking(abiTypes, abiValues))\n } else {\n encodedArgs.push(...encodeArgsIndividually(abiTypes, abiValues))\n }\n\n return encodedArgs\n}\n\n/**\n * Encode individual ABI values\n */\nfunction encodeArgsIndividually(abiTypes: ABIType[], abiValues: ABIValue[]): Uint8Array[] {\n const encodedArgs: Uint8Array[] = []\n\n for (let i = 0; i < abiTypes.length; i++) {\n const abiType = abiTypes[i]\n const abiValue = abiValues[i]\n const encoded = abiType.encode(abiValue)\n encodedArgs.push(encoded)\n }\n\n return encodedArgs\n}\n\n/**\n * Encode ABI values with tuple packing for methods with many arguments\n */\nfunction encodeArgsWithTuplePacking(abiTypes: ABIType[], abiValues: ABIValue[]): Uint8Array[] {\n const encodedArgs: Uint8Array[] = []\n\n // Encode first 14 arguments individually\n const first14AbiTypes = abiTypes.slice(0, ARGS_TUPLE_PACKING_THRESHOLD)\n const first14AbiValues = abiValues.slice(0, ARGS_TUPLE_PACKING_THRESHOLD)\n encodedArgs.push(...encodeArgsIndividually(first14AbiTypes, first14AbiValues))\n\n // Pack remaining arguments into tuple at position 15\n const remainingAbiTypes = abiTypes.slice(ARGS_TUPLE_PACKING_THRESHOLD)\n const remainingAbiValues = abiValues.slice(ARGS_TUPLE_PACKING_THRESHOLD)\n\n if (remainingAbiTypes.length > 0) {\n const tupleType = new ABITupleType(remainingAbiTypes)\n const tupleValue = remainingAbiValues\n const tupleEncoded = tupleType.encode(tupleValue)\n encodedArgs.push(tupleEncoded)\n }\n\n return encodedArgs\n}\n\n/**\n * Builds encoded ABI method arguments and resolves reference arrays\n */\nfunction buildMethodCallArgsAndReferences(params: {\n sender: Address\n appId: bigint\n method: ABIMethod\n args: (ABIValue | undefined)[]\n accountReferences?: Address[]\n appReferences?: bigint[]\n assetReferences?: bigint[]\n}): { args: Uint8Array[]; accountReferences: Address[]; appReferences: bigint[]; assetReferences: bigint[] } {\n const { accountReferences, appReferences, assetReferences, updatedArgs } = prepareArgsForEncoding(\n params.sender,\n params.appId,\n params.method,\n params.args ?? [],\n params.accountReferences,\n params.appReferences,\n params.assetReferences,\n )\n\n const encodedArgs = encodeMethodArguments(params.method, updatedArgs)\n\n return {\n args: encodedArgs,\n accountReferences,\n appReferences,\n assetReferences,\n }\n}\n\nexport const buildAppCreateMethodCall = async (\n params: ProcessedAppCreateMethodCall,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n const globalStateSchema =\n params.schema?.globalByteSlices !== undefined || params.schema?.globalInts !== undefined\n ? {\n numByteSlices: params.schema?.globalByteSlices ?? 0,\n numUints: params.schema?.globalInts ?? 0,\n }\n : undefined\n const localStateSchema =\n params.schema?.localByteSlices !== undefined || params.schema?.localInts !== undefined\n ? {\n numByteSlices: params.schema?.localByteSlices ?? 0,\n numUints: params.schema?.localInts ?? 0,\n }\n : undefined\n const extraProgramPages =\n params.extraProgramPages !== undefined ? params.extraProgramPages : calculateExtraProgramPages(approvalProgram!, clearStateProgram!)\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: 0n,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: 0n,\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n globalStateSchema: globalStateSchema,\n localStateSchema: localStateSchema,\n extraProgramPages: extraProgramPages,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppUpdateMethodCall = async (\n params: ProcessedAppUpdateMethodCall,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: params.appId,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: OnApplicationComplete.UpdateApplication,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppCallMethodCall = async (\n params: ProcessedAppCallMethodCall,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: params.appId,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,+BAA+B;AAuFrC,SAAgB,mDACd,QACA,cACqC;CACrC,MAAM,uBAAuB,IAAI,OAA0C;CAC3E,MAAM,iBAAiB,OAAO;AAC9B,KAAI,CAAC,eAAgB,QAAO,EAAE;CAG9B,MAAM,gBAAgB,OAAO,SAAU,YAAY,OAAO,SAAS,OAAO,OAAO,SAAS,OAAO,SAAU;AAE3G,MAAK,IAAI,IAAI,GAAG,IAAI,eAAe,QAAQ,KAAK;EAC9C,MAAM,MAAM,eAAe;AAE3B,MAAI,QAAQ,OAEV;AAEF,MAAI,WAAW,IAAI,CAEjB;AAGF,MAAI,2BAA2B,IAAI,EAAE;AACnC,wBAAqB,KAAK;IACxB,MAAM;KACJ,KAAK,IAAI;KACT,QAAQ,IAAI;KACb;IACD,MAAM;IACP,CAAC;AAEF;;AAEF,MAAI,uBAAuB,IAAI,EAAE;GAE/B,MAAM,6BAA6B,mDAAmD,KAAK,cAAc;AACzG,wBAAqB,KAAK,GAAG,2BAA2B;AACxD,wBAAqB,KAAK;IACxB,MAAM;KACJ,GAAG;KACH,QAAQ,IA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BAAgB;IACrE;GACL,eAAe,OAAO;GACvB;EACF,CAAC;;AAGJ,MAAa,yBAAyB,OACpC,QACA,iBACA,0BACyB;CACzB,MAAM,aAAaL,0CAA2B,QAAQ,iBAAiB,sBAAsB;CAC7F,MAAM,oBAAoB,OAAO,mBAAmB,KAAK,MAAML,2BAAW,EAAE,CAAC;CAC7E,MAAM,oBAAoB,iCAAiC;EACzD,QAAQ,WAAW;EACnB,OAAO,OAAO;EACd,QAAQ,OAAO;EACf,MAAM,OAAO,QAAQ,EAAE;EACJ;EACnB,eAAe,OAAO;EACtB,iBAAiB,OAAO;EACzB,CAAC;CAGF,MAAM,sBAAsB,OAAO,oBAAoB,OAAO,iBAAiB,SAAS;AAExF,QAAO,IAAIO,gCAAY;EACrB,GAAG;EACH,MAAMC,yCAAgB;EACtB,SAAS;GACP,OAAO,OAAO;GACd,YAAY,OAAO,cAAcC,uCAAsB;GACvD,MAAM,kBAAkB;GACxB,GAAI,sBACA,EAAE,kBAAkB,OAAO,kBAAkB,GAC7C;IACE,mBAAmB,kBAAkB;IACrC,eAAe,kBAAkB;IACjC,iBAAiB,kBAAkB;IACnC,eAAe,OAAO,eAAe,IAAIC,+BAAW,gBAAgB;IACrE;GACL,eAAe,OAAO;GACvB;EACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"method-call.js","names":["Address","argTypeIsReference","addr: Address","getAddress","argTypeIsTransaction","ABIUintType","encodedArgs: Uint8Array[]","ABITupleType","buildTransactionCommonData","calculateExtraProgramPages","Transaction","TransactionType","OnApplicationComplete","AppManager"],"sources":["../../src/transactions/method-call.ts"],"sourcesContent":["import {\n ABIMethod,\n ABITupleType,\n ABIType,\n ABIUintType,\n ABIValue,\n argTypeIsReference,\n argTypeIsTransaction,\n} from '@algorandfoundation/algokit-abi'\nimport { SuggestedParams } from '@algorandfoundation/algokit-algod-client'\nimport { Address, Expand, getAddress } from '@algorandfoundation/algokit-common'\nimport { OnApplicationComplete, Transaction, TransactionSigner, TransactionType } from '@algorandfoundation/algokit-transact'\nimport { TransactionWithSigner } from '../transaction'\nimport { AlgoAmount } from '../types/amount'\nimport { AppManager } from '../types/app-manager'\nimport { calculateExtraProgramPages } from '../util'\nimport { AppCreateParams, AppDeleteParams, AppMethodCallParams, AppUpdateParams } from './app-call'\nimport { buildTransactionCommonData } from './common'\n\nconst ARGS_TUPLE_PACKING_THRESHOLD = 15 // ARC-4 allows 15 ABI args (slots 1-15) before tuple packing is needed\n\n/** Parameters to define an ABI method call create transaction. */\nexport type AppCreateMethodCall = Expand<AppMethodCall<AppCreateParams>>\n/** Parameters to define an ABI method call update transaction. */\nexport type AppUpdateMethodCall = Expand<AppMethodCall<AppUpdateParams>>\n/** Parameters to define an ABI method call delete transaction. */\nexport type AppDeleteMethodCall = Expand<AppMethodCall<AppDeleteParams>>\n/** Parameters to define an ABI method call transaction. */\nexport type AppCallMethodCall = Expand<AppMethodCall<AppMethodCallParams>>\n\nexport type ProcessedAppCreateMethodCall = Expand<\n Omit<AppCreateMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\nexport type ProcessedAppUpdateMethodCall = Expand<\n Omit<AppUpdateMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\nexport type ProcessedAppCallMethodCall = Expand<\n Omit<AppCallMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\n/** Types that can be used to define a transaction argument for an ABI call transaction. */\nexport type AppMethodCallTransactionArgument =\n // The following should match the partial `args` types from `AppMethodCall<T>` below\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n\n/** Parameters to define an ABI method call. */\nexport type AppMethodCall<T> = Expand<Omit<T, 'args'>> & {\n /** The ABI method to call */\n method: ABIMethod\n /** Arguments to the ABI method, either:\n * * An ABI value\n * * A transaction with explicit signer\n * * A transaction (where the signer will be automatically assigned)\n * * An unawaited transaction (e.g. from algorand.createTransaction.{transactionType}())\n * * Another method call (via method call params object)\n * * undefined (this represents a placeholder transaction argument that is fulfilled by another method call argument)\n */\n args?: (\n | ABIValue\n // The following should match the above `AppMethodCallTransactionArgument` type above\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n | undefined\n )[]\n}\n\ntype AppMethodCallArgs = AppMethodCall<unknown>['args']\ntype AppMethodCallArg = NonNullable<AppMethodCallArgs>[number]\n\nexport type AsyncTransactionParams = {\n txn: Promise<Transaction>\n signer?: TransactionSigner\n maxFee?: AlgoAmount\n}\n\nexport type TransactionParams = {\n txn: Transaction\n signer?: TransactionSigner\n maxFee?: AlgoAmount\n}\n\ntype ExtractedMethodCallTransactionArg =\n | { data: TransactionParams; type: 'txn' }\n | {\n data: AsyncTransactionParams\n type: 'asyncTxn'\n }\n | { data: ProcessedAppCallMethodCall | ProcessedAppCreateMethodCall | ProcessedAppUpdateMethodCall; type: 'methodCall' }\n\nexport function extractComposerTransactionsFromAppMethodCallParams(\n params: AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall | AppDeleteMethodCall,\n parentSigner?: TransactionSigner,\n): ExtractedMethodCallTransactionArg[] {\n const composerTransactions = new Array<ExtractedMethodCallTransactionArg>()\n const methodCallArgs = params.args\n if (!methodCallArgs) return []\n\n // Extract signer from params, falling back to parentSigner\n const currentSigner = params.signer ? ('signer' in params.signer ? params.signer.signer : params.signer) : parentSigner\n\n for (let i = 0; i < methodCallArgs.length; i++) {\n const arg = methodCallArgs[i]\n\n if (arg === undefined) {\n // is a transaction or default value placeholder, do nothing\n continue\n }\n if (isAbiValue(arg)) {\n // if is ABI value, also ignore\n continue\n }\n\n if (isTransactionWithSignerArg(arg)) {\n composerTransactions.push({\n data: {\n txn: arg.txn,\n signer: arg.signer,\n },\n type: 'txn',\n })\n\n continue\n }\n if (isAppCallMethodCallArg(arg)) {\n // Recursively extract nested method call transactions, passing the nested call itself and current signer as parent\n const nestedComposerTransactions = extractComposerTransactionsFromAppMethodCallParams(arg, currentSigner)\n composerTransactions.push(...nestedComposerTransactions)\n composerTransactions.push({\n data: {\n ...arg,\n signer: arg.signer ?? currentSigner,\n args: processAppMethodCallArgs(arg.args),\n },\n type: 'methodCall',\n } satisfies ExtractedMethodCallTransactionArg)\n\n continue\n }\n if (arg instanceof Promise) {\n composerTransactions.push({\n data: {\n txn: arg,\n signer: currentSigner,\n },\n type: 'asyncTxn',\n })\n continue\n }\n\n composerTransactions.push({\n data: {\n txn: Promise.resolve(arg),\n signer: currentSigner,\n },\n type: 'asyncTxn',\n })\n }\n\n return composerTransactions\n}\n\nexport function processAppMethodCallArgs(args: AppMethodCallArg[] | undefined): (ABIValue | undefined)[] | undefined {\n if (args === undefined) return undefined\n\n return args.map((arg) => {\n if (arg === undefined) {\n // Handle explicit placeholders (either transaction or default value)\n return undefined\n } else if (!isAbiValue(arg)) {\n // If the arg is not an ABIValue, it's must be a transaction, set to undefined\n // transaction arguments should be flattened out and added into the composer during the add process\n return undefined\n }\n return arg\n })\n}\n\nfunction isTransactionWithSignerArg(arg: AppMethodCallArg): arg is TransactionWithSigner {\n return typeof arg === 'object' && arg !== undefined && 'txn' in arg && 'signer' in arg\n}\n\nfunction isAppCallMethodCallArg(\n arg: AppMethodCallArg,\n): arg is AppMethodCall<AppCreateParams> | AppMethodCall<AppUpdateParams> | AppMethodCall<AppMethodCallParams> {\n return typeof arg === 'object' && arg !== undefined && 'method' in arg\n}\n\nconst isAbiValue = (x: unknown): x is ABIValue => {\n if (Array.isArray(x)) return x.length == 0 || x.every(isAbiValue)\n\n // If x is a POJO literal\n if (Object.getPrototypeOf(x) === Object.getPrototypeOf({})) {\n return Object.values(x as object).every(isAbiValue)\n }\n\n return (\n typeof x === 'bigint' ||\n typeof x === 'boolean' ||\n typeof x === 'number' ||\n typeof x === 'string' ||\n x instanceof Uint8Array ||\n x instanceof Address\n )\n}\n\n/**\n * Prepares method arguments for ABI encoding by building reference arrays and\n * replacing reference-type arguments (account, asset, application) with their indices.\n */\nfunction prepareArgsForEncoding(\n sender: Address,\n appId: bigint,\n method: ABIMethod,\n methodArgs: (ABIValue | undefined)[],\n accountReferences?: Address[],\n appReferences?: bigint[],\n assetReferences?: bigint[],\n): { accountReferences: Address[]; appReferences: bigint[]; assetReferences: bigint[]; updatedArgs: (ABIValue | undefined)[] } {\n const accounts = [...(accountReferences ?? [])]\n const assets = [...(assetReferences ?? [])]\n const apps = [...(appReferences ?? [])]\n\n const updatedArgs = methodArgs.map((arg, i) => {\n const argType = method.args[i].type\n if (!argTypeIsReference(argType)) {\n return arg\n }\n switch (argType) {\n case 'account': {\n let addr: Address\n if (typeof arg === 'string') {\n addr = getAddress(arg)\n } else if (arg instanceof Uint8Array) {\n addr = new Address(arg)\n } else {\n throw new Error('Invalid value for account')\n }\n\n if (sender.equals(addr)) {\n return 0\n }\n\n const existing = accounts.findIndex((a) => a.equals(addr)) + 1\n if (existing) return existing\n\n accounts.push(addr)\n return accounts.length\n }\n case 'asset': {\n if (typeof arg !== 'bigint') {\n throw new Error('Invalid value for asset')\n }\n\n const existing = assets.findIndex((a) => a === arg)\n if (existing === -1) {\n assets.push(arg)\n return assets.length - 1\n }\n\n return existing\n }\n case 'application': {\n if (typeof arg !== 'bigint') {\n throw new Error('Invalid value for application')\n }\n\n if (arg === appId) return 0\n\n const existing = apps.findIndex((a) => a === arg) + 1\n if (existing) return existing\n\n apps.push(arg)\n return apps.length\n }\n }\n })\n\n return { accountReferences: accounts, appReferences: apps, assetReferences: assets, updatedArgs }\n}\n\n/**\n * Encode ABI method arguments with tuple packing support\n * Ports the logic from the Rust encode_method_arguments function\n */\nfunction encodeMethodArguments(method: ABIMethod, args: (ABIValue | undefined)[]): Uint8Array[] {\n const encodedArgs = new Array<Uint8Array>()\n\n // Insert method selector at the front\n encodedArgs.push(method.getSelector())\n\n // Get ABI types for non-transaction arguments\n const abiTypes = new Array<ABIType>()\n const abiValues = new Array<ABIValue>()\n\n // Process each method argument\n for (let i = 0; i < method.args.length; i++) {\n const methodArg = method.args[i]\n const argValue = args[i]\n\n if (argTypeIsTransaction(methodArg.type)) {\n // Transaction arguments are not ABI encoded - they're handled separately\n } else if (argTypeIsReference(methodArg.type)) {\n // Reference types are encoded as uint8 indexes\n const referenceType = methodArg.type\n if (typeof argValue === 'number') {\n abiTypes.push(new ABIUintType(8))\n abiValues.push(argValue)\n } else {\n throw new Error(`Invalid reference value for ${referenceType}: ${argValue}`)\n }\n } else if (argValue !== undefined) {\n // Regular ABI value\n abiTypes.push(methodArg.type)\n // it's safe to cast to ABIValue here because the abiType must be ABIValue\n abiValues.push(argValue as ABIValue)\n }\n\n // Skip undefined values (transaction placeholders)\n }\n\n if (abiValues.length !== abiTypes.length) {\n throw new Error('Mismatch in length of non-transaction arguments')\n }\n\n // Apply ARC-4 tuple packing for methods with more than 15 ABI arguments\n // Algorand allows 16 app args total; slot 0 is the method selector, leaving 15 for ABI args\n if (abiTypes.length > ARGS_TUPLE_PACKING_THRESHOLD) {\n encodedArgs.push(...encodeArgsWithTuplePacking(abiTypes, abiValues))\n } else {\n encodedArgs.push(...encodeArgsIndividually(abiTypes, abiValues))\n }\n\n return encodedArgs\n}\n\n/**\n * Encode individual ABI values\n */\nfunction encodeArgsIndividually(abiTypes: ABIType[], abiValues: ABIValue[]): Uint8Array[] {\n const encodedArgs: Uint8Array[] = []\n\n for (let i = 0; i < abiTypes.length; i++) {\n const abiType = abiTypes[i]\n const abiValue = abiValues[i]\n const encoded = abiType.encode(abiValue)\n encodedArgs.push(encoded)\n }\n\n return encodedArgs\n}\n\n/**\n * Encode ABI values with tuple packing for methods with many arguments\n */\nfunction encodeArgsWithTuplePacking(abiTypes: ABIType[], abiValues: ABIValue[]): Uint8Array[] {\n const encodedArgs: Uint8Array[] = []\n\n // When packing is needed (> 15 args), we split at 14 to leave one slot for the packed tuple\n // This gives us: 1 (selector) + 14 (individual) + 1 (packed tuple) = 16 total app args\n const splitAt = ARGS_TUPLE_PACKING_THRESHOLD - 1\n const firstAbiTypes = abiTypes.slice(0, splitAt)\n const firstAbiValues = abiValues.slice(0, splitAt)\n encodedArgs.push(...encodeArgsIndividually(firstAbiTypes, firstAbiValues))\n\n // Pack remaining arguments into a tuple\n const remainingAbiTypes = abiTypes.slice(splitAt)\n const remainingAbiValues = abiValues.slice(splitAt)\n\n if (remainingAbiTypes.length > 0) {\n const tupleType = new ABITupleType(remainingAbiTypes)\n const tupleValue = remainingAbiValues\n const tupleEncoded = tupleType.encode(tupleValue)\n encodedArgs.push(tupleEncoded)\n }\n\n return encodedArgs\n}\n\n/**\n * Builds encoded ABI method arguments and resolves reference arrays\n */\nfunction buildMethodCallArgsAndReferences(params: {\n sender: Address\n appId: bigint\n method: ABIMethod\n args: (ABIValue | undefined)[]\n accountReferences?: Address[]\n appReferences?: bigint[]\n assetReferences?: bigint[]\n}): { args: Uint8Array[]; accountReferences: Address[]; appReferences: bigint[]; assetReferences: bigint[] } {\n const { accountReferences, appReferences, assetReferences, updatedArgs } = prepareArgsForEncoding(\n params.sender,\n params.appId,\n params.method,\n params.args ?? [],\n params.accountReferences,\n params.appReferences,\n params.assetReferences,\n )\n\n const encodedArgs = encodeMethodArguments(params.method, updatedArgs)\n\n return {\n args: encodedArgs,\n accountReferences,\n appReferences,\n assetReferences,\n }\n}\n\nexport const buildAppCreateMethodCall = async (\n params: ProcessedAppCreateMethodCall,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n const globalStateSchema =\n params.schema?.globalByteSlices !== undefined || params.schema?.globalInts !== undefined\n ? {\n numByteSlices: params.schema?.globalByteSlices ?? 0,\n numUints: params.schema?.globalInts ?? 0,\n }\n : undefined\n const localStateSchema =\n params.schema?.localByteSlices !== undefined || params.schema?.localInts !== undefined\n ? {\n numByteSlices: params.schema?.localByteSlices ?? 0,\n numUints: params.schema?.localInts ?? 0,\n }\n : undefined\n const extraProgramPages =\n params.extraProgramPages !== undefined ? params.extraProgramPages : calculateExtraProgramPages(approvalProgram!, clearStateProgram!)\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: 0n,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: 0n,\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n globalStateSchema: globalStateSchema,\n localStateSchema: localStateSchema,\n extraProgramPages: extraProgramPages,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppUpdateMethodCall = async (\n params: ProcessedAppUpdateMethodCall,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: params.appId,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: OnApplicationComplete.UpdateApplication,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppCallMethodCall = async (\n params: ProcessedAppCallMethodCall,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: params.appId,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,+BAA+B;AAuFrC,SAAgB,mDACd,QACA,cACqC;CACrC,MAAM,uBAAuB,IAAI,OAA0C;CAC3E,MAAM,iBAAiB,OAAO;AAC9B,KAAI,CAAC,eAAgB,QAAO,EAAE;CAG9B,MAAM,gBAAgB,OAAO,SAAU,YAAY,OAAO,SAAS,OAAO,OAAO,SAAS,OAAO,SAAU;AAE3G,MAAK,IAAI,IAAI,GAAG,IAAI,eAAe,QAAQ,KAAK;EAC9C,MAAM,MAAM,eAAe;AAE3B,MAAI,QAAQ,OAEV;AAEF,MAAI,WAAW,IAAI,CAEjB;AAGF,MAAI,2BAA2B,IAAI,EAAE;AACnC,wBAAqB,KAAK;IACxB,MAAM;KACJ,KAAK,IAAI;KACT,QAAQ,IAAI;KACb;IACD,MAAM;IACP,CAAC;AAEF;;AAEF,MAAI,uBAAuB,IAAI,EAAE;GAE/B,MAAM,6BAA6B,mDAAmD,KAAK,cAAc;AACzG,wBAAqB,KAAK,GAAG,2BAA2B;AACxD,wBAAqB,KAAK;IACxB,MAAM;KACJ,GAAG;KACH,QAAQ,IAAI,UAAU;KACtB,MAAM,yBAAyB,IAAI,KAAK;KACzC;IACD,MAAM;IACP,CAA6C;AAE9C;;AAEF,MAAI,eAAe,SAAS;AAC1B,wBAAqB,KAAK;IACxB,MAAM;KACJ,KAAK;KACL,QAAQ;KACT;IACD,MAAM;IACP,CAAC;AACF;;AAGF,uBAAqB,KAAK;GACxB,MAAM;IACJ,KAAK,QAAQ,QAAQ,IAAI;IACzB,QAAQ;IACT;GACD,MAAM;GACP,CAAC;;AAGJ,QAAO;;AAGT,SAAgB,yBAAyB,MAA4E;AACnH,KAAI,SAAS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