algosdk 2.8.0 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.LICENSE.txt +0 -9
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/abi/abi_type.js +34 -27
- package/dist/cjs/abi/abi_type.js.map +1 -1
- package/dist/cjs/abi/contract.js +5 -3
- package/dist/cjs/abi/contract.js.map +1 -1
- package/dist/cjs/{types/transactions/asset.js → abi/event.js} +1 -1
- package/dist/cjs/abi/event.js.map +1 -0
- package/dist/cjs/abi/index.js +6 -6
- package/dist/cjs/abi/index.js.map +1 -1
- package/dist/cjs/abi/interface.js +3 -3
- package/dist/cjs/abi/interface.js.map +1 -1
- package/dist/cjs/abi/method.js +14 -10
- package/dist/cjs/abi/method.js.map +1 -1
- package/dist/cjs/abi/reference.js +1 -1
- package/dist/cjs/abi/reference.js.map +1 -1
- package/dist/cjs/abi/transaction.js +2 -2
- package/dist/cjs/abi/transaction.js.map +1 -1
- package/dist/cjs/account.js +4 -4
- package/dist/cjs/account.js.map +1 -1
- package/dist/cjs/boxStorage.js +17 -17
- package/dist/cjs/boxStorage.js.map +1 -1
- package/dist/cjs/client/client.js +77 -41
- package/dist/cjs/client/client.js.map +1 -1
- package/dist/cjs/client/index.js +29 -0
- package/dist/cjs/client/index.js.map +1 -0
- package/dist/cjs/client/kmd.js +69 -86
- package/dist/cjs/client/kmd.js.map +1 -1
- package/dist/cjs/client/urlTokenBaseHTTPClient.js +16 -11
- package/dist/cjs/client/urlTokenBaseHTTPClient.js.map +1 -1
- package/dist/cjs/client/v2/algod/accountApplicationInformation.js +11 -7
- package/dist/cjs/client/v2/algod/accountApplicationInformation.js.map +1 -1
- package/dist/cjs/client/v2/algod/accountAssetInformation.js +11 -7
- package/dist/cjs/client/v2/algod/accountAssetInformation.js.map +1 -1
- package/dist/cjs/client/v2/algod/accountInformation.js +11 -6
- package/dist/cjs/client/v2/algod/accountInformation.js.map +1 -1
- package/dist/cjs/client/v2/algod/algod.js +85 -83
- package/dist/cjs/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/client/v2/algod/block.js +6 -33
- package/dist/cjs/client/v2/algod/block.js.map +1 -1
- package/dist/cjs/client/v2/algod/compile.js +17 -11
- package/dist/cjs/client/v2/algod/compile.js.map +1 -1
- package/dist/cjs/client/v2/algod/disassemble.js +17 -11
- package/dist/cjs/client/v2/algod/disassemble.js.map +1 -1
- package/dist/cjs/client/v2/algod/dryrun.js +18 -37
- package/dist/cjs/client/v2/algod/dryrun.js.map +1 -1
- package/dist/cjs/client/v2/algod/genesis.js +6 -2
- package/dist/cjs/client/v2/algod/genesis.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxByName.js +10 -10
- package/dist/cjs/client/v2/algod/getApplicationBoxByName.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js +8 -8
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationByID.js +10 -5
- package/dist/cjs/client/v2/algod/getApplicationByID.js.map +1 -1
- package/dist/cjs/client/v2/algod/getAssetByID.js +10 -5
- package/dist/cjs/client/v2/algod/getAssetByID.js.map +1 -1
- package/dist/cjs/client/v2/algod/getBlockHash.js +10 -6
- package/dist/cjs/client/v2/algod/getBlockHash.js.map +1 -1
- package/dist/cjs/client/v2/algod/getBlockOffsetTimestamp.js +6 -5
- package/dist/cjs/client/v2/algod/getBlockOffsetTimestamp.js.map +1 -1
- package/dist/cjs/client/v2/algod/getBlockTxids.js +10 -4
- package/dist/cjs/client/v2/algod/getBlockTxids.js.map +1 -1
- package/dist/cjs/client/v2/algod/getLedgerStateDelta.js +11 -6
- package/dist/cjs/client/v2/algod/getLedgerStateDelta.js.map +1 -1
- package/dist/cjs/client/v2/algod/getLedgerStateDeltaForTransactionGroup.js +11 -6
- package/dist/cjs/client/v2/algod/getLedgerStateDeltaForTransactionGroup.js.map +1 -1
- package/dist/cjs/client/v2/algod/getSyncRound.js +6 -5
- package/dist/cjs/client/v2/algod/getSyncRound.js.map +1 -1
- package/dist/cjs/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.js +9 -9
- package/dist/cjs/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.js.map +1 -1
- package/dist/cjs/client/v2/algod/getTransactionProof.js +10 -6
- package/dist/cjs/client/v2/algod/getTransactionProof.js.map +1 -1
- package/dist/cjs/client/v2/algod/healthCheck.js +4 -9
- package/dist/cjs/client/v2/algod/healthCheck.js.map +1 -1
- package/dist/cjs/{types → client/v2/algod}/index.js +5 -3
- package/dist/cjs/client/v2/algod/index.js.map +1 -0
- package/dist/cjs/client/v2/algod/lightBlockHeaderProof.js +10 -5
- package/dist/cjs/client/v2/algod/lightBlockHeaderProof.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +3712 -1824
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/algod/pendingTransactionInformation.js +6 -32
- package/dist/cjs/client/v2/algod/pendingTransactionInformation.js.map +1 -1
- package/dist/cjs/client/v2/algod/pendingTransactions.js +6 -31
- package/dist/cjs/client/v2/algod/pendingTransactions.js.map +1 -1
- package/dist/cjs/client/v2/algod/pendingTransactionsByAddress.js +7 -33
- package/dist/cjs/client/v2/algod/pendingTransactionsByAddress.js.map +1 -1
- package/dist/cjs/client/v2/algod/ready.js +4 -2
- package/dist/cjs/client/v2/algod/ready.js.map +1 -1
- package/dist/cjs/client/v2/algod/sendRawTransaction.js +17 -8
- package/dist/cjs/client/v2/algod/sendRawTransaction.js.map +1 -1
- package/dist/cjs/client/v2/algod/setBlockOffsetTimestamp.js +13 -8
- package/dist/cjs/client/v2/algod/setBlockOffsetTimestamp.js.map +1 -1
- package/dist/cjs/client/v2/algod/setSyncRound.js +13 -8
- package/dist/cjs/client/v2/algod/setSyncRound.js.map +1 -1
- package/dist/cjs/client/v2/algod/simulateTransaction.js +15 -35
- package/dist/cjs/client/v2/algod/simulateTransaction.js.map +1 -1
- package/dist/cjs/client/v2/algod/stateproof.js +10 -5
- package/dist/cjs/client/v2/algod/stateproof.js.map +1 -1
- package/dist/cjs/client/v2/algod/status.js +8 -2
- package/dist/cjs/client/v2/algod/status.js.map +1 -1
- package/dist/cjs/client/v2/algod/statusAfterBlock.js +10 -5
- package/dist/cjs/client/v2/algod/statusAfterBlock.js.map +1 -1
- package/dist/cjs/client/v2/algod/suggestedParams.js +13 -9
- package/dist/cjs/client/v2/algod/suggestedParams.js.map +1 -1
- package/dist/cjs/client/v2/algod/supply.js +8 -2
- package/dist/cjs/client/v2/algod/supply.js.map +1 -1
- package/dist/cjs/client/v2/algod/unsetSyncRound.js +11 -5
- package/dist/cjs/client/v2/algod/unsetSyncRound.js.map +1 -1
- package/dist/cjs/client/v2/algod/versions.js +8 -2
- package/dist/cjs/client/v2/algod/versions.js.map +1 -1
- package/dist/cjs/client/v2/indexer/index.js +22 -0
- package/dist/cjs/client/v2/indexer/index.js.map +1 -0
- package/dist/cjs/client/v2/indexer/indexer.js +44 -43
- package/dist/cjs/client/v2/indexer/indexer.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAccountAppLocalStates.js +11 -6
- package/dist/cjs/client/v2/indexer/lookupAccountAppLocalStates.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAccountAssets.js +11 -6
- package/dist/cjs/client/v2/indexer/lookupAccountAssets.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAccountByID.js +11 -6
- package/dist/cjs/client/v2/indexer/lookupAccountByID.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAccountCreatedApplications.js +11 -6
- package/dist/cjs/client/v2/indexer/lookupAccountCreatedApplications.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAccountCreatedAssets.js +11 -6
- package/dist/cjs/client/v2/indexer/lookupAccountCreatedAssets.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAccountTransactions.js +19 -12
- package/dist/cjs/client/v2/indexer/lookupAccountTransactions.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupApplicationBoxByIDandName.js +10 -10
- package/dist/cjs/client/v2/indexer/lookupApplicationBoxByIDandName.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupApplicationLogs.js +10 -5
- package/dist/cjs/client/v2/indexer/lookupApplicationLogs.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupApplications.js +10 -5
- package/dist/cjs/client/v2/indexer/lookupApplications.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAssetBalances.js +10 -5
- package/dist/cjs/client/v2/indexer/lookupAssetBalances.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAssetByID.js +10 -5
- package/dist/cjs/client/v2/indexer/lookupAssetByID.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAssetTransactions.js +19 -12
- package/dist/cjs/client/v2/indexer/lookupAssetTransactions.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupBlock.js +10 -5
- package/dist/cjs/client/v2/indexer/lookupBlock.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupTransactionByID.js +10 -5
- package/dist/cjs/client/v2/indexer/lookupTransactionByID.js.map +1 -1
- package/dist/cjs/client/v2/indexer/makeHealthCheck.js +8 -2
- package/dist/cjs/client/v2/indexer/makeHealthCheck.js.map +1 -1
- package/dist/cjs/client/v2/indexer/models/types.js +3591 -1651
- package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchAccounts.js +9 -3
- package/dist/cjs/client/v2/indexer/searchAccounts.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchForApplicationBoxes.js +8 -8
- package/dist/cjs/client/v2/indexer/searchForApplicationBoxes.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchForApplications.js +9 -3
- package/dist/cjs/client/v2/indexer/searchForApplications.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchForAssets.js +9 -3
- package/dist/cjs/client/v2/indexer/searchForAssets.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchForTransactions.js +17 -9
- package/dist/cjs/client/v2/indexer/searchForTransactions.js.map +1 -1
- package/dist/cjs/client/v2/jsonrequest.js +22 -54
- package/dist/cjs/client/v2/jsonrequest.js.map +1 -1
- package/dist/cjs/client/v2/serviceClient.js +5 -25
- package/dist/cjs/client/v2/serviceClient.js.map +1 -1
- package/dist/cjs/client/v2/untypedmodel.js +22 -0
- package/dist/cjs/client/v2/untypedmodel.js.map +1 -0
- package/dist/cjs/composer.js +64 -58
- package/dist/cjs/composer.js.map +1 -1
- package/dist/cjs/convert.js.map +1 -1
- package/dist/cjs/dryrun.js +107 -203
- package/dist/cjs/dryrun.js.map +1 -1
- package/dist/cjs/encoding/address.js +88 -104
- package/dist/cjs/encoding/address.js.map +1 -1
- package/dist/cjs/encoding/bigint.js +2 -3
- package/dist/cjs/encoding/bigint.js.map +1 -1
- package/dist/cjs/encoding/binarydata.js +82 -0
- package/dist/cjs/encoding/binarydata.js.map +1 -0
- package/dist/cjs/encoding/encoding.js +353 -38
- package/dist/cjs/encoding/encoding.js.map +1 -1
- package/dist/cjs/encoding/schema/address.js +41 -0
- package/dist/cjs/encoding/schema/address.js.map +1 -0
- package/dist/cjs/encoding/schema/array.js +43 -0
- package/dist/cjs/encoding/schema/array.js.map +1 -0
- package/dist/cjs/encoding/schema/binarystring.js +55 -0
- package/dist/cjs/encoding/schema/binarystring.js.map +1 -0
- package/dist/cjs/encoding/schema/blockhash.js +67 -0
- package/dist/cjs/encoding/schema/blockhash.js.map +1 -0
- package/dist/cjs/encoding/schema/boolean.js +42 -0
- package/dist/cjs/encoding/schema/boolean.js.map +1 -0
- package/dist/cjs/encoding/schema/bytearray.js +98 -0
- package/dist/cjs/encoding/schema/bytearray.js.map +1 -0
- package/dist/cjs/encoding/schema/index.js +34 -0
- package/dist/cjs/encoding/schema/index.js.map +1 -0
- package/dist/cjs/encoding/schema/map.js +528 -0
- package/dist/cjs/encoding/schema/map.js.map +1 -0
- package/dist/cjs/encoding/schema/optional.js +58 -0
- package/dist/cjs/encoding/schema/optional.js.map +1 -0
- package/dist/cjs/encoding/schema/string.js +43 -0
- package/dist/cjs/encoding/schema/string.js.map +1 -0
- package/dist/cjs/encoding/schema/uint64.js +36 -0
- package/dist/cjs/encoding/schema/uint64.js.map +1 -0
- package/dist/cjs/encoding/schema/untyped.js +33 -0
- package/dist/cjs/encoding/schema/untyped.js.map +1 -0
- package/dist/cjs/encoding/uint64.js +2 -2
- package/dist/cjs/encoding/uint64.js.map +1 -1
- package/dist/cjs/group.js +23 -60
- package/dist/cjs/group.js.map +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logic/sourcemap.js +56 -25
- package/dist/cjs/logic/sourcemap.js.map +1 -1
- package/dist/cjs/logicsig.js +113 -146
- package/dist/cjs/logicsig.js.map +1 -1
- package/dist/cjs/main.js +113 -122
- package/dist/cjs/main.js.map +1 -1
- package/dist/cjs/makeTxn.js +320 -554
- package/dist/cjs/makeTxn.js.map +1 -1
- package/dist/cjs/mnemonic/mnemonic.js +8 -8
- package/dist/cjs/mnemonic/mnemonic.js.map +1 -1
- package/dist/cjs/multisig.js +60 -312
- package/dist/cjs/multisig.js.map +1 -1
- package/dist/cjs/multisigSigning.js +285 -0
- package/dist/cjs/multisigSigning.js.map +1 -0
- package/dist/cjs/nacl/naclWrappers.js +2 -2
- package/dist/cjs/nacl/naclWrappers.js.map +1 -1
- package/dist/cjs/signedTransaction.js +106 -0
- package/dist/cjs/signedTransaction.js.map +1 -0
- package/dist/cjs/signer.js +7 -7
- package/dist/cjs/signer.js.map +1 -1
- package/dist/cjs/signing.js +105 -0
- package/dist/cjs/signing.js.map +1 -0
- package/dist/cjs/stateproof.js +421 -0
- package/dist/cjs/stateproof.js.map +1 -0
- package/dist/cjs/transaction.js +724 -1009
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/cjs/types/block.js +813 -0
- package/dist/cjs/types/block.js.map +1 -0
- package/dist/cjs/types/intDecoding.js +1 -1
- package/dist/cjs/types/intDecoding.js.map +1 -1
- package/dist/cjs/types/statedelta.js +1155 -0
- package/dist/cjs/types/statedelta.js.map +1 -0
- package/dist/cjs/types/transactions/base.js +22 -5
- package/dist/cjs/types/transactions/base.js.map +1 -1
- package/dist/cjs/types/transactions/encoded.js +67 -0
- package/dist/cjs/types/transactions/encoded.js.map +1 -1
- package/dist/cjs/types/transactions/index.js +2 -5
- package/dist/cjs/types/transactions/index.js.map +1 -1
- package/dist/cjs/utils/utils.js +86 -22
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/cjs/wait.js +4 -4
- package/dist/cjs/wait.js.map +1 -1
- package/dist/esm/abi/abi_type.js +22 -15
- package/dist/esm/abi/abi_type.js.map +1 -1
- package/dist/esm/abi/contract.js +3 -1
- package/dist/esm/abi/contract.js.map +1 -1
- package/dist/esm/abi/event.js +2 -0
- package/dist/esm/abi/event.js.map +1 -0
- package/dist/esm/abi/index.js +6 -6
- package/dist/esm/abi/index.js.map +1 -1
- package/dist/esm/abi/interface.js +1 -1
- package/dist/esm/abi/interface.js.map +1 -1
- package/dist/esm/abi/method.js +8 -4
- package/dist/esm/abi/method.js.map +1 -1
- package/dist/esm/abi/transaction.js +1 -1
- package/dist/esm/abi/transaction.js.map +1 -1
- package/dist/esm/account.js +4 -4
- package/dist/esm/account.js.map +1 -1
- package/dist/esm/boxStorage.js +15 -15
- package/dist/esm/boxStorage.js.map +1 -1
- package/dist/esm/client/client.js +74 -40
- package/dist/esm/client/client.js.map +1 -1
- package/dist/esm/client/index.js +7 -0
- package/dist/esm/client/index.js.map +1 -0
- package/dist/esm/client/kmd.js +67 -62
- package/dist/esm/client/kmd.js.map +1 -1
- package/dist/esm/client/urlTokenBaseHTTPClient.js +16 -11
- package/dist/esm/client/urlTokenBaseHTTPClient.js.map +1 -1
- package/dist/esm/client/v2/algod/accountApplicationInformation.js +10 -6
- package/dist/esm/client/v2/algod/accountApplicationInformation.js.map +1 -1
- package/dist/esm/client/v2/algod/accountAssetInformation.js +10 -6
- package/dist/esm/client/v2/algod/accountAssetInformation.js.map +1 -1
- package/dist/esm/client/v2/algod/accountInformation.js +10 -5
- package/dist/esm/client/v2/algod/accountInformation.js.map +1 -1
- package/dist/esm/client/v2/algod/algod.js +71 -70
- package/dist/esm/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/client/v2/algod/block.js +5 -9
- package/dist/esm/client/v2/algod/block.js.map +1 -1
- package/dist/esm/client/v2/algod/compile.js +16 -10
- package/dist/esm/client/v2/algod/compile.js.map +1 -1
- package/dist/esm/client/v2/algod/disassemble.js +16 -10
- package/dist/esm/client/v2/algod/disassemble.js.map +1 -1
- package/dist/esm/client/v2/algod/dryrun.js +16 -12
- package/dist/esm/client/v2/algod/dryrun.js.map +1 -1
- package/dist/esm/client/v2/algod/genesis.js +5 -1
- package/dist/esm/client/v2/algod/genesis.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxByName.js +9 -9
- package/dist/esm/client/v2/algod/getApplicationBoxByName.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js +7 -7
- package/dist/esm/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationByID.js +9 -4
- package/dist/esm/client/v2/algod/getApplicationByID.js.map +1 -1
- package/dist/esm/client/v2/algod/getAssetByID.js +9 -4
- package/dist/esm/client/v2/algod/getAssetByID.js.map +1 -1
- package/dist/esm/client/v2/algod/getBlockHash.js +9 -5
- package/dist/esm/client/v2/algod/getBlockHash.js.map +1 -1
- package/dist/esm/client/v2/algod/getBlockOffsetTimestamp.js +5 -4
- package/dist/esm/client/v2/algod/getBlockOffsetTimestamp.js.map +1 -1
- package/dist/esm/client/v2/algod/getBlockTxids.js +9 -3
- package/dist/esm/client/v2/algod/getBlockTxids.js.map +1 -1
- package/dist/esm/client/v2/algod/getLedgerStateDelta.js +10 -5
- package/dist/esm/client/v2/algod/getLedgerStateDelta.js.map +1 -1
- package/dist/esm/client/v2/algod/getLedgerStateDeltaForTransactionGroup.js +10 -5
- package/dist/esm/client/v2/algod/getLedgerStateDeltaForTransactionGroup.js.map +1 -1
- package/dist/esm/client/v2/algod/getSyncRound.js +5 -4
- package/dist/esm/client/v2/algod/getSyncRound.js.map +1 -1
- package/dist/esm/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.js +8 -8
- package/dist/esm/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.js.map +1 -1
- package/dist/esm/client/v2/algod/getTransactionProof.js +9 -5
- package/dist/esm/client/v2/algod/getTransactionProof.js.map +1 -1
- package/dist/esm/client/v2/algod/healthCheck.js +3 -8
- package/dist/esm/client/v2/algod/healthCheck.js.map +1 -1
- package/dist/esm/client/v2/algod/index.js +4 -0
- package/dist/esm/client/v2/algod/index.js.map +1 -0
- package/dist/esm/client/v2/algod/lightBlockHeaderProof.js +9 -4
- package/dist/esm/client/v2/algod/lightBlockHeaderProof.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +3712 -1821
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/algod/pendingTransactionInformation.js +5 -8
- package/dist/esm/client/v2/algod/pendingTransactionInformation.js.map +1 -1
- package/dist/esm/client/v2/algod/pendingTransactions.js +5 -7
- package/dist/esm/client/v2/algod/pendingTransactions.js.map +1 -1
- package/dist/esm/client/v2/algod/pendingTransactionsByAddress.js +6 -9
- package/dist/esm/client/v2/algod/pendingTransactionsByAddress.js.map +1 -1
- package/dist/esm/client/v2/algod/ready.js +3 -1
- package/dist/esm/client/v2/algod/ready.js.map +1 -1
- package/dist/esm/client/v2/algod/sendRawTransaction.js +15 -6
- package/dist/esm/client/v2/algod/sendRawTransaction.js.map +1 -1
- package/dist/esm/client/v2/algod/setBlockOffsetTimestamp.js +12 -7
- package/dist/esm/client/v2/algod/setBlockOffsetTimestamp.js.map +1 -1
- package/dist/esm/client/v2/algod/setSyncRound.js +12 -7
- package/dist/esm/client/v2/algod/setSyncRound.js.map +1 -1
- package/dist/esm/client/v2/algod/simulateTransaction.js +14 -11
- package/dist/esm/client/v2/algod/simulateTransaction.js.map +1 -1
- package/dist/esm/client/v2/algod/stateproof.js +9 -4
- package/dist/esm/client/v2/algod/stateproof.js.map +1 -1
- package/dist/esm/client/v2/algod/status.js +7 -1
- package/dist/esm/client/v2/algod/status.js.map +1 -1
- package/dist/esm/client/v2/algod/statusAfterBlock.js +9 -4
- package/dist/esm/client/v2/algod/statusAfterBlock.js.map +1 -1
- package/dist/esm/client/v2/algod/suggestedParams.js +12 -8
- package/dist/esm/client/v2/algod/suggestedParams.js.map +1 -1
- package/dist/esm/client/v2/algod/supply.js +7 -1
- package/dist/esm/client/v2/algod/supply.js.map +1 -1
- package/dist/esm/client/v2/algod/unsetSyncRound.js +10 -4
- package/dist/esm/client/v2/algod/unsetSyncRound.js.map +1 -1
- package/dist/esm/client/v2/algod/versions.js +7 -1
- package/dist/esm/client/v2/algod/versions.js.map +1 -1
- package/dist/esm/client/v2/indexer/index.js +4 -0
- package/dist/esm/client/v2/indexer/index.js.map +1 -0
- package/dist/esm/client/v2/indexer/indexer.js +42 -42
- package/dist/esm/client/v2/indexer/indexer.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAccountAppLocalStates.js +10 -5
- package/dist/esm/client/v2/indexer/lookupAccountAppLocalStates.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAccountAssets.js +10 -5
- package/dist/esm/client/v2/indexer/lookupAccountAssets.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAccountByID.js +10 -5
- package/dist/esm/client/v2/indexer/lookupAccountByID.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAccountCreatedApplications.js +10 -5
- package/dist/esm/client/v2/indexer/lookupAccountCreatedApplications.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAccountCreatedAssets.js +10 -5
- package/dist/esm/client/v2/indexer/lookupAccountCreatedAssets.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAccountTransactions.js +18 -11
- package/dist/esm/client/v2/indexer/lookupAccountTransactions.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupApplicationBoxByIDandName.js +9 -9
- package/dist/esm/client/v2/indexer/lookupApplicationBoxByIDandName.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupApplicationLogs.js +9 -4
- package/dist/esm/client/v2/indexer/lookupApplicationLogs.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupApplications.js +9 -4
- package/dist/esm/client/v2/indexer/lookupApplications.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAssetBalances.js +9 -4
- package/dist/esm/client/v2/indexer/lookupAssetBalances.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAssetByID.js +9 -4
- package/dist/esm/client/v2/indexer/lookupAssetByID.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAssetTransactions.js +17 -10
- package/dist/esm/client/v2/indexer/lookupAssetTransactions.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupBlock.js +9 -4
- package/dist/esm/client/v2/indexer/lookupBlock.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupTransactionByID.js +9 -4
- package/dist/esm/client/v2/indexer/lookupTransactionByID.js.map +1 -1
- package/dist/esm/client/v2/indexer/makeHealthCheck.js +7 -1
- package/dist/esm/client/v2/indexer/makeHealthCheck.js.map +1 -1
- package/dist/esm/client/v2/indexer/models/types.js +3591 -1648
- package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchAccounts.js +8 -2
- package/dist/esm/client/v2/indexer/searchAccounts.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchForApplicationBoxes.js +7 -7
- package/dist/esm/client/v2/indexer/searchForApplicationBoxes.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchForApplications.js +8 -2
- package/dist/esm/client/v2/indexer/searchForApplications.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchForAssets.js +8 -2
- package/dist/esm/client/v2/indexer/searchForAssets.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchForTransactions.js +15 -7
- package/dist/esm/client/v2/indexer/searchForTransactions.js.map +1 -1
- package/dist/esm/client/v2/jsonrequest.js +22 -51
- package/dist/esm/client/v2/jsonrequest.js.map +1 -1
- package/dist/esm/client/v2/serviceClient.js +3 -20
- package/dist/esm/client/v2/serviceClient.js.map +1 -1
- package/dist/esm/client/v2/untypedmodel.js +18 -0
- package/dist/esm/client/v2/untypedmodel.js.map +1 -0
- package/dist/esm/composer.js +43 -37
- package/dist/esm/composer.js.map +1 -1
- package/dist/esm/convert.js.map +1 -1
- package/dist/esm/dryrun.js +98 -195
- package/dist/esm/dryrun.js.map +1 -1
- package/dist/esm/encoding/address.js +85 -100
- package/dist/esm/encoding/address.js.map +1 -1
- package/dist/esm/encoding/bigint.js +2 -3
- package/dist/esm/encoding/bigint.js.map +1 -1
- package/dist/esm/encoding/binarydata.js +73 -0
- package/dist/esm/encoding/binarydata.js.map +1 -0
- package/dist/esm/encoding/encoding.js +337 -12
- package/dist/esm/encoding/encoding.js.map +1 -1
- package/dist/esm/encoding/schema/address.js +37 -0
- package/dist/esm/encoding/schema/address.js.map +1 -0
- package/dist/esm/encoding/schema/array.js +39 -0
- package/dist/esm/encoding/schema/array.js.map +1 -0
- package/dist/esm/encoding/schema/binarystring.js +51 -0
- package/dist/esm/encoding/schema/binarystring.js.map +1 -0
- package/dist/esm/encoding/schema/blockhash.js +60 -0
- package/dist/esm/encoding/schema/blockhash.js.map +1 -0
- package/dist/esm/encoding/schema/boolean.js +38 -0
- package/dist/esm/encoding/schema/boolean.js.map +1 -0
- package/dist/esm/encoding/schema/bytearray.js +93 -0
- package/dist/esm/encoding/schema/bytearray.js.map +1 -0
- package/dist/esm/encoding/schema/index.js +12 -0
- package/dist/esm/encoding/schema/index.js.map +1 -0
- package/dist/esm/encoding/schema/map.js +517 -0
- package/dist/esm/encoding/schema/map.js.map +1 -0
- package/dist/esm/encoding/schema/optional.js +54 -0
- package/dist/esm/encoding/schema/optional.js.map +1 -0
- package/dist/esm/encoding/schema/string.js +39 -0
- package/dist/esm/encoding/schema/string.js.map +1 -0
- package/dist/esm/encoding/schema/uint64.js +32 -0
- package/dist/esm/encoding/schema/uint64.js.map +1 -0
- package/dist/esm/encoding/schema/untyped.js +29 -0
- package/dist/esm/encoding/schema/untyped.js.map +1 -0
- package/dist/esm/encoding/uint64.js +1 -1
- package/dist/esm/encoding/uint64.js.map +1 -1
- package/dist/esm/group.js +22 -58
- package/dist/esm/group.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logic/sourcemap.js +54 -23
- package/dist/esm/logic/sourcemap.js.map +1 -1
- package/dist/esm/logicsig.js +110 -141
- package/dist/esm/logicsig.js.map +1 -1
- package/dist/esm/main.js +47 -76
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/makeTxn.js +314 -513
- package/dist/esm/makeTxn.js.map +1 -1
- package/dist/esm/mnemonic/mnemonic.js +5 -5
- package/dist/esm/mnemonic/mnemonic.js.map +1 -1
- package/dist/esm/multisig.js +56 -305
- package/dist/esm/multisig.js.map +1 -1
- package/dist/esm/multisigSigning.js +254 -0
- package/dist/esm/multisigSigning.js.map +1 -0
- package/dist/esm/nacl/naclWrappers.js +1 -1
- package/dist/esm/nacl/naclWrappers.js.map +1 -1
- package/dist/esm/package.json +1 -0
- package/dist/esm/signedTransaction.js +100 -0
- package/dist/esm/signedTransaction.js.map +1 -0
- package/dist/esm/signer.js +3 -3
- package/dist/esm/signer.js.map +1 -1
- package/dist/esm/signing.js +77 -0
- package/dist/esm/signing.js.map +1 -0
- package/dist/esm/stateproof.js +408 -0
- package/dist/esm/stateproof.js.map +1 -0
- package/dist/esm/transaction.js +723 -1005
- package/dist/esm/transaction.js.map +1 -1
- package/dist/esm/types/block.js +797 -0
- package/dist/esm/types/block.js.map +1 -0
- package/dist/esm/types/intDecoding.js +1 -1
- package/dist/esm/types/intDecoding.js.map +1 -1
- package/dist/esm/types/statedelta.js +1129 -0
- package/dist/esm/types/statedelta.js.map +1 -0
- package/dist/esm/types/transactions/base.js +18 -2
- package/dist/esm/types/transactions/base.js.map +1 -1
- package/dist/esm/types/transactions/encoded.js +62 -1
- package/dist/esm/types/transactions/encoded.js.map +1 -1
- package/dist/esm/types/transactions/index.js +2 -3
- package/dist/esm/types/transactions/index.js.map +1 -1
- package/dist/esm/utils/utils.js +80 -21
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/esm/wait.js +4 -4
- package/dist/esm/wait.js.map +1 -1
- package/dist/types/abi/abi_type.d.ts +1 -1
- package/dist/types/abi/contract.d.ts +5 -1
- package/dist/types/abi/event.d.ts +16 -0
- package/dist/types/abi/index.d.ts +6 -6
- package/dist/types/abi/interface.d.ts +1 -1
- package/dist/types/abi/method.d.ts +12 -5
- package/dist/types/abi/transaction.d.ts +1 -1
- package/dist/types/account.d.ts +1 -1
- package/dist/types/boxStorage.d.ts +4 -5
- package/dist/types/client/baseHTTPClient.d.ts +9 -6
- package/dist/types/client/client.d.ts +59 -18
- package/dist/types/client/index.d.ts +5 -0
- package/dist/types/client/kmd.d.ts +12 -10
- package/dist/types/client/urlTokenBaseHTTPClient.d.ts +8 -5
- package/dist/types/client/v2/algod/accountApplicationInformation.d.ts +8 -6
- package/dist/types/client/v2/algod/accountAssetInformation.d.ts +8 -6
- package/dist/types/client/v2/algod/accountInformation.d.ts +7 -5
- package/dist/types/client/v2/algod/algod.d.ts +53 -52
- package/dist/types/client/v2/algod/block.d.ts +5 -4
- package/dist/types/client/v2/algod/compile.d.ts +7 -9
- package/dist/types/client/v2/algod/disassemble.d.ts +7 -9
- package/dist/types/client/v2/algod/dryrun.d.ts +7 -9
- package/dist/types/client/v2/algod/genesis.d.ts +4 -2
- package/dist/types/client/v2/algod/getApplicationBoxByName.d.ts +6 -7
- package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +6 -7
- package/dist/types/client/v2/algod/getApplicationByID.d.ts +6 -5
- package/dist/types/client/v2/algod/getAssetByID.d.ts +6 -5
- package/dist/types/client/v2/algod/getBlockHash.d.ts +7 -6
- package/dist/types/client/v2/algod/getBlockOffsetTimestamp.d.ts +5 -4
- package/dist/types/client/v2/algod/getBlockTxids.d.ts +6 -5
- package/dist/types/client/v2/algod/getLedgerStateDelta.d.ts +6 -5
- package/dist/types/client/v2/algod/getLedgerStateDeltaForTransactionGroup.d.ts +6 -5
- package/dist/types/client/v2/algod/getSyncRound.d.ts +5 -4
- package/dist/types/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.d.ts +6 -7
- package/dist/types/client/v2/algod/getTransactionProof.d.ts +6 -5
- package/dist/types/client/v2/algod/healthCheck.d.ts +4 -3
- package/dist/types/client/v2/algod/index.d.ts +2 -0
- package/dist/types/client/v2/algod/lightBlockHeaderProof.d.ts +6 -5
- package/dist/types/client/v2/algod/models/types.d.ts +629 -318
- package/dist/types/client/v2/algod/pendingTransactionInformation.d.ts +5 -4
- package/dist/types/client/v2/algod/pendingTransactions.d.ts +5 -4
- package/dist/types/client/v2/algod/pendingTransactionsByAddress.d.ts +7 -5
- package/dist/types/client/v2/algod/ready.d.ts +4 -2
- package/dist/types/client/v2/algod/sendRawTransaction.d.ts +7 -5
- package/dist/types/client/v2/algod/setBlockOffsetTimestamp.d.ts +6 -6
- package/dist/types/client/v2/algod/setSyncRound.d.ts +6 -6
- package/dist/types/client/v2/algod/simulateTransaction.d.ts +7 -7
- package/dist/types/client/v2/algod/stateproof.d.ts +6 -5
- package/dist/types/client/v2/algod/status.d.ts +5 -2
- package/dist/types/client/v2/algod/statusAfterBlock.d.ts +6 -5
- package/dist/types/client/v2/algod/suggestedParams.d.ts +25 -4
- package/dist/types/client/v2/algod/supply.d.ts +5 -2
- package/dist/types/client/v2/algod/unsetSyncRound.d.ts +5 -3
- package/dist/types/client/v2/algod/versions.d.ts +5 -2
- package/dist/types/client/v2/indexer/index.d.ts +2 -0
- package/dist/types/client/v2/indexer/indexer.d.ts +31 -30
- package/dist/types/client/v2/indexer/lookupAccountAppLocalStates.d.ts +7 -5
- package/dist/types/client/v2/indexer/lookupAccountAssets.d.ts +7 -5
- package/dist/types/client/v2/indexer/lookupAccountByID.d.ts +7 -5
- package/dist/types/client/v2/indexer/lookupAccountCreatedApplications.d.ts +7 -5
- package/dist/types/client/v2/indexer/lookupAccountCreatedAssets.d.ts +7 -5
- package/dist/types/client/v2/indexer/lookupAccountTransactions.d.ts +11 -9
- package/dist/types/client/v2/indexer/lookupApplicationBoxByIDandName.d.ts +6 -7
- package/dist/types/client/v2/indexer/lookupApplicationLogs.d.ts +6 -5
- package/dist/types/client/v2/indexer/lookupApplications.d.ts +6 -5
- package/dist/types/client/v2/indexer/lookupAssetBalances.d.ts +6 -5
- package/dist/types/client/v2/indexer/lookupAssetByID.d.ts +6 -5
- package/dist/types/client/v2/indexer/lookupAssetTransactions.d.ts +12 -10
- package/dist/types/client/v2/indexer/lookupBlock.d.ts +6 -5
- package/dist/types/client/v2/indexer/lookupTransactionByID.d.ts +6 -5
- package/dist/types/client/v2/indexer/makeHealthCheck.d.ts +5 -2
- package/dist/types/client/v2/indexer/models/types.d.ts +513 -267
- package/dist/types/client/v2/indexer/searchAccounts.d.ts +7 -3
- package/dist/types/client/v2/indexer/searchForApplicationBoxes.d.ts +6 -7
- package/dist/types/client/v2/indexer/searchForApplications.d.ts +7 -3
- package/dist/types/client/v2/indexer/searchForAssets.d.ts +7 -3
- package/dist/types/client/v2/indexer/searchForTransactions.d.ts +11 -7
- package/dist/types/client/v2/jsonrequest.d.ts +20 -33
- package/dist/types/client/v2/serviceClient.d.ts +4 -18
- package/dist/types/client/v2/untypedmodel.d.ts +10 -0
- package/dist/types/composer.d.ts +18 -17
- package/dist/types/dryrun.d.ts +8 -80
- package/dist/types/encoding/address.d.ts +40 -31
- package/dist/types/encoding/binarydata.d.ts +30 -0
- package/dist/types/encoding/encoding.d.ts +219 -7
- package/dist/types/encoding/schema/address.d.ts +10 -0
- package/dist/types/encoding/schema/array.d.ts +11 -0
- package/dist/types/encoding/schema/binarystring.d.ts +18 -0
- package/dist/types/encoding/schema/blockhash.d.ts +16 -0
- package/dist/types/encoding/schema/boolean.d.ts +10 -0
- package/dist/types/encoding/schema/bytearray.d.ts +19 -0
- package/dist/types/encoding/schema/index.d.ts +11 -0
- package/dist/types/encoding/schema/map.d.ts +125 -0
- package/dist/types/encoding/schema/optional.d.ts +24 -0
- package/dist/types/encoding/schema/string.d.ts +9 -0
- package/dist/types/encoding/schema/uint64.d.ts +9 -0
- package/dist/types/encoding/schema/untyped.d.ts +9 -0
- package/dist/types/encoding/uint64.d.ts +1 -0
- package/dist/types/group.d.ts +6 -25
- package/dist/types/index.d.ts +2 -2
- package/dist/types/logic/sourcemap.d.ts +39 -13
- package/dist/types/logicsig.d.ts +27 -57
- package/dist/types/main.d.ts +43 -54
- package/dist/types/makeTxn.d.ts +129 -388
- package/dist/types/mnemonic/mnemonic.d.ts +1 -1
- package/dist/types/multisig.d.ts +28 -99
- package/dist/types/multisigSigning.d.ts +72 -0
- package/dist/types/signedTransaction.d.ts +55 -0
- package/dist/types/signer.d.ts +5 -5
- package/dist/types/signing.d.ts +29 -0
- package/dist/types/stateproof.d.ts +194 -0
- package/dist/types/transaction.d.ts +103 -182
- package/dist/types/types/account.d.ts +2 -1
- package/dist/types/types/block.d.ts +407 -0
- package/dist/types/types/intDecoding.d.ts +1 -1
- package/dist/types/types/statedelta.d.ts +575 -0
- package/dist/types/types/transactions/base.d.ts +206 -118
- package/dist/types/types/transactions/encoded.d.ts +7 -301
- package/dist/types/types/transactions/index.d.ts +2 -15
- package/dist/types/types/utils.d.ts +7 -7
- package/dist/types/utils/utils.d.ts +21 -16
- package/dist/types/wait.d.ts +3 -2
- package/package.json +48 -20
- package/src/abi/abi_type.ts +28 -18
- package/src/abi/contract.ts +7 -1
- package/src/abi/event.ts +16 -0
- package/src/abi/index.ts +6 -6
- package/src/abi/interface.ts +1 -1
- package/src/abi/method.ts +22 -8
- package/src/abi/transaction.ts +2 -2
- package/src/account.ts +5 -5
- package/src/boxStorage.ts +25 -23
- package/src/client/baseHTTPClient.ts +12 -6
- package/src/client/client.ts +147 -75
- package/src/client/index.ts +6 -0
- package/src/client/kmd.ts +79 -72
- package/src/client/urlTokenBaseHTTPClient.ts +25 -14
- package/src/client/v2/algod/accountApplicationInformation.ts +16 -9
- package/src/client/v2/algod/accountAssetInformation.ts +16 -9
- package/src/client/v2/algod/accountInformation.ts +16 -11
- package/src/client/v2/algod/algod.ts +83 -105
- package/src/client/v2/algod/block.ts +7 -11
- package/src/client/v2/algod/compile.ts +27 -19
- package/src/client/v2/algod/disassemble.ts +27 -19
- package/src/client/v2/algod/dryrun.ts +23 -19
- package/src/client/v2/algod/genesis.ts +8 -2
- package/src/client/v2/algod/getApplicationBoxByName.ts +10 -15
- package/src/client/v2/algod/getApplicationBoxes.ts +12 -13
- package/src/client/v2/algod/getApplicationByID.ts +15 -7
- package/src/client/v2/algod/getAssetByID.ts +15 -7
- package/src/client/v2/algod/getBlockHash.ts +13 -9
- package/src/client/v2/algod/getBlockOffsetTimestamp.ts +7 -8
- package/src/client/v2/algod/getBlockTxids.ts +12 -6
- package/src/client/v2/algod/getLedgerStateDelta.ts +16 -8
- package/src/client/v2/algod/getLedgerStateDeltaForTransactionGroup.ts +16 -8
- package/src/client/v2/algod/getSyncRound.ts +7 -8
- package/src/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.ts +15 -15
- package/src/client/v2/algod/getTransactionProof.ts +11 -9
- package/src/client/v2/algod/healthCheck.ts +5 -9
- package/src/client/v2/algod/index.ts +3 -0
- package/src/client/v2/algod/lightBlockHeaderProof.ts +15 -8
- package/src/client/v2/algod/models/types.ts +4729 -2254
- package/src/client/v2/algod/pendingTransactionInformation.ts +11 -11
- package/src/client/v2/algod/pendingTransactions.ts +7 -9
- package/src/client/v2/algod/pendingTransactionsByAddress.ts +12 -11
- package/src/client/v2/algod/ready.ts +6 -2
- package/src/client/v2/algod/sendRawTransaction.ts +24 -13
- package/src/client/v2/algod/setBlockOffsetTimestamp.ts +21 -11
- package/src/client/v2/algod/setSyncRound.ts +21 -11
- package/src/client/v2/algod/simulateTransaction.ts +22 -23
- package/src/client/v2/algod/stateproof.ts +15 -8
- package/src/client/v2/algod/status.ts +10 -2
- package/src/client/v2/algod/statusAfterBlock.ts +15 -7
- package/src/client/v2/algod/suggestedParams.ts +40 -10
- package/src/client/v2/algod/supply.ts +10 -2
- package/src/client/v2/algod/unsetSyncRound.ts +16 -5
- package/src/client/v2/algod/versions.ts +10 -2
- package/src/client/v2/indexer/index.ts +3 -0
- package/src/client/v2/indexer/indexer.ts +51 -59
- package/src/client/v2/indexer/lookupAccountAppLocalStates.ts +16 -11
- package/src/client/v2/indexer/lookupAccountAssets.ts +16 -11
- package/src/client/v2/indexer/lookupAccountByID.ts +16 -11
- package/src/client/v2/indexer/lookupAccountCreatedApplications.ts +16 -11
- package/src/client/v2/indexer/lookupAccountCreatedAssets.ts +16 -11
- package/src/client/v2/indexer/lookupAccountTransactions.ts +26 -19
- package/src/client/v2/indexer/lookupApplicationBoxByIDandName.ts +10 -15
- package/src/client/v2/indexer/lookupApplicationLogs.ts +15 -7
- package/src/client/v2/indexer/lookupApplications.ts +15 -7
- package/src/client/v2/indexer/lookupAssetBalances.ts +15 -7
- package/src/client/v2/indexer/lookupAssetByID.ts +15 -7
- package/src/client/v2/indexer/lookupAssetTransactions.ts +27 -16
- package/src/client/v2/indexer/lookupBlock.ts +15 -7
- package/src/client/v2/indexer/lookupTransactionByID.ts +15 -7
- package/src/client/v2/indexer/makeHealthCheck.ts +10 -2
- package/src/client/v2/indexer/models/types.ts +4454 -1988
- package/src/client/v2/indexer/searchAccounts.ts +13 -4
- package/src/client/v2/indexer/searchForApplicationBoxes.ts +12 -13
- package/src/client/v2/indexer/searchForApplications.ts +13 -4
- package/src/client/v2/indexer/searchForAssets.ts +13 -4
- package/src/client/v2/indexer/searchForTransactions.ts +22 -11
- package/src/client/v2/jsonrequest.ts +39 -57
- package/src/client/v2/serviceClient.ts +9 -31
- package/src/client/v2/untypedmodel.ts +25 -0
- package/src/composer.ts +83 -60
- package/src/dryrun.ts +129 -306
- package/src/encoding/address.ts +134 -146
- package/src/encoding/bigint.ts +2 -4
- package/src/encoding/binarydata.ts +80 -0
- package/src/encoding/encoding.ts +558 -13
- package/src/encoding/schema/address.ts +53 -0
- package/src/encoding/schema/array.ts +66 -0
- package/src/encoding/schema/binarystring.ts +73 -0
- package/src/encoding/schema/blockhash.ts +84 -0
- package/src/encoding/schema/boolean.ts +54 -0
- package/src/encoding/schema/bytearray.ts +127 -0
- package/src/encoding/schema/index.ts +26 -0
- package/src/encoding/schema/map.ts +713 -0
- package/src/encoding/schema/optional.ts +72 -0
- package/src/encoding/schema/string.ts +55 -0
- package/src/encoding/schema/uint64.ts +46 -0
- package/src/encoding/schema/untyped.ts +47 -0
- package/src/encoding/uint64.ts +2 -1
- package/src/group.ts +27 -75
- package/src/index.ts +2 -2
- package/src/logic/sourcemap.ts +94 -29
- package/src/logicsig.ts +154 -202
- package/src/main.ts +91 -94
- package/src/makeTxn.ts +670 -1320
- package/src/mnemonic/mnemonic.ts +14 -14
- package/src/multisig.ts +89 -403
- package/src/multisigSigning.ts +359 -0
- package/src/nacl/naclWrappers.ts +1 -1
- package/src/signedTransaction.ts +163 -0
- package/src/signer.ts +10 -5
- package/src/signing.ts +95 -0
- package/src/stateproof.ts +595 -0
- package/src/transaction.ts +986 -1242
- package/src/types/account.ts +3 -1
- package/src/types/block.ts +1278 -0
- package/src/types/intDecoding.ts +1 -1
- package/src/types/statedelta.ts +1717 -0
- package/src/types/transactions/base.ts +230 -122
- package/src/types/transactions/encoded.ts +81 -371
- package/src/types/transactions/index.ts +2 -72
- package/src/types/utils.ts +3 -3
- package/src/utils/utils.ts +96 -25
- package/src/wait.ts +8 -7
- package/dist/cjs/bid.js +0 -83
- package/dist/cjs/bid.js.map +0 -1
- package/dist/cjs/client/v2/basemodel.js +0 -67
- package/dist/cjs/client/v2/basemodel.js.map +0 -1
- package/dist/cjs/types/address.js +0 -3
- package/dist/cjs/types/address.js.map +0 -1
- package/dist/cjs/types/blockHeader.js +0 -3
- package/dist/cjs/types/blockHeader.js.map +0 -1
- package/dist/cjs/types/index.js.map +0 -1
- package/dist/cjs/types/multisig.js +0 -3
- package/dist/cjs/types/multisig.js.map +0 -1
- package/dist/cjs/types/transactions/application.js +0 -3
- package/dist/cjs/types/transactions/application.js.map +0 -1
- package/dist/cjs/types/transactions/asset.js.map +0 -1
- package/dist/cjs/types/transactions/builder.js +0 -3
- package/dist/cjs/types/transactions/builder.js.map +0 -1
- package/dist/cjs/types/transactions/keyreg.js +0 -3
- package/dist/cjs/types/transactions/keyreg.js.map +0 -1
- package/dist/cjs/types/transactions/payment.js +0 -3
- package/dist/cjs/types/transactions/payment.js.map +0 -1
- package/dist/cjs/types/transactions/stateproof.js +0 -3
- package/dist/cjs/types/transactions/stateproof.js.map +0 -1
- package/dist/esm/bid.js +0 -57
- package/dist/esm/bid.js.map +0 -1
- package/dist/esm/client/v2/basemodel.js +0 -64
- package/dist/esm/client/v2/basemodel.js.map +0 -1
- package/dist/esm/types/address.js +0 -2
- package/dist/esm/types/address.js.map +0 -1
- package/dist/esm/types/blockHeader.js +0 -2
- package/dist/esm/types/blockHeader.js.map +0 -1
- package/dist/esm/types/index.js +0 -4
- package/dist/esm/types/index.js.map +0 -1
- package/dist/esm/types/multisig.js +0 -2
- package/dist/esm/types/multisig.js.map +0 -1
- package/dist/esm/types/transactions/application.js +0 -2
- package/dist/esm/types/transactions/application.js.map +0 -1
- package/dist/esm/types/transactions/asset.js +0 -2
- package/dist/esm/types/transactions/asset.js.map +0 -1
- package/dist/esm/types/transactions/builder.js +0 -2
- package/dist/esm/types/transactions/builder.js.map +0 -1
- package/dist/esm/types/transactions/keyreg.js +0 -2
- package/dist/esm/types/transactions/keyreg.js.map +0 -1
- package/dist/esm/types/transactions/payment.js +0 -2
- package/dist/esm/types/transactions/payment.js.map +0 -1
- package/dist/esm/types/transactions/stateproof.js +0 -2
- package/dist/esm/types/transactions/stateproof.js.map +0 -1
- package/dist/types/bid.d.ts +0 -38
- package/dist/types/client/v2/basemodel.d.ts +0 -11
- package/dist/types/types/address.d.ts +0 -7
- package/dist/types/types/blockHeader.d.ts +0 -67
- package/dist/types/types/index.d.ts +0 -3
- package/dist/types/types/multisig.d.ts +0 -20
- package/dist/types/types/transactions/application.d.ts +0 -22
- package/dist/types/types/transactions/asset.d.ts +0 -28
- package/dist/types/types/transactions/builder.d.ts +0 -36
- package/dist/types/types/transactions/keyreg.d.ts +0 -8
- package/dist/types/types/transactions/payment.d.ts +0 -8
- package/dist/types/types/transactions/stateproof.d.ts +0 -8
- package/src/bid.ts +0 -96
- package/src/client/v2/basemodel.ts +0 -81
- package/src/types/address.ts +0 -7
- package/src/types/blockHeader.ts +0 -81
- package/src/types/index.ts +0 -3
- package/src/types/multisig.ts +0 -22
- package/src/types/transactions/application.ts +0 -111
- package/src/types/transactions/asset.ts +0 -108
- package/src/types/transactions/builder.ts +0 -69
- package/src/types/transactions/keyreg.ts +0 -23
- package/src/types/transactions/payment.ts +0 -14
- package/src/types/transactions/stateproof.ts +0 -17
|
@@ -0,0 +1,1278 @@
|
|
|
1
|
+
import { Encodable, Schema } from '../encoding/encoding.js';
|
|
2
|
+
import {
|
|
3
|
+
NamedMapSchema,
|
|
4
|
+
Uint64MapSchema,
|
|
5
|
+
SpecialCaseBinaryStringMapSchema,
|
|
6
|
+
SpecialCaseBinaryStringSchema,
|
|
7
|
+
ArraySchema,
|
|
8
|
+
StringSchema,
|
|
9
|
+
BooleanSchema,
|
|
10
|
+
Uint64Schema,
|
|
11
|
+
AddressSchema,
|
|
12
|
+
ByteArraySchema,
|
|
13
|
+
FixedLengthByteArraySchema,
|
|
14
|
+
OptionalSchema,
|
|
15
|
+
allOmitEmpty,
|
|
16
|
+
combineMaps,
|
|
17
|
+
convertMap,
|
|
18
|
+
BlockHashSchema,
|
|
19
|
+
} from '../encoding/schema/index.js';
|
|
20
|
+
import { Address } from '../encoding/address.js';
|
|
21
|
+
import { SignedTransaction } from '../signedTransaction.js';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* StateProofTrackingData tracks the status of state proofs.
|
|
25
|
+
*/
|
|
26
|
+
export class StateProofTrackingData implements Encodable {
|
|
27
|
+
public static readonly encodingSchema = new NamedMapSchema(
|
|
28
|
+
allOmitEmpty([
|
|
29
|
+
{
|
|
30
|
+
key: 'v', // stateProofVotersCommitment
|
|
31
|
+
valueSchema: new ByteArraySchema(),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: 't', // stateProofOnlineTotalWeight
|
|
35
|
+
valueSchema: new Uint64Schema(),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
key: 'n', // stateProofNextRound
|
|
39
|
+
valueSchema: new Uint64Schema(),
|
|
40
|
+
},
|
|
41
|
+
])
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* StateProofVotersCommitment is the root of a vector commitment containing the online accounts
|
|
46
|
+
* that will help sign a state proof. The VC root, and the state proof, happen on blocks that are
|
|
47
|
+
* a multiple of ConsensusParams.StateProofRounds. For blocks that are not a multiple of
|
|
48
|
+
* ConsensusParams.StateProofRounds, this value is zero.
|
|
49
|
+
*/
|
|
50
|
+
public stateProofVotersCommitment: Uint8Array;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* StateProofOnlineTotalWeight is the total number of microalgos held by the online accounts during
|
|
54
|
+
* the StateProof round (or zero, if the merkle root is zero - no commitment for StateProof voters).
|
|
55
|
+
* This is intended for computing the threshold of votes to expect from StateProofVotersCommitment.
|
|
56
|
+
*/
|
|
57
|
+
public stateProofOnlineTotalWeight: bigint;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* StateProofNextRound is the next round for which we will accept a StateProof transaction.
|
|
61
|
+
*/
|
|
62
|
+
public stateProofNextRound: bigint;
|
|
63
|
+
|
|
64
|
+
public constructor(params: {
|
|
65
|
+
stateProofVotersCommitment: Uint8Array;
|
|
66
|
+
stateProofOnlineTotalWeight: bigint;
|
|
67
|
+
stateProofNextRound: bigint;
|
|
68
|
+
}) {
|
|
69
|
+
this.stateProofVotersCommitment = params.stateProofVotersCommitment;
|
|
70
|
+
this.stateProofOnlineTotalWeight = params.stateProofOnlineTotalWeight;
|
|
71
|
+
this.stateProofNextRound = params.stateProofNextRound;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// eslint-disable-next-line class-methods-use-this
|
|
75
|
+
public getEncodingSchema(): Schema {
|
|
76
|
+
return StateProofTrackingData.encodingSchema;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public toEncodingData(): Map<string, unknown> {
|
|
80
|
+
return new Map<string, unknown>([
|
|
81
|
+
['v', this.stateProofVotersCommitment],
|
|
82
|
+
['t', this.stateProofOnlineTotalWeight],
|
|
83
|
+
['n', this.stateProofNextRound],
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public static fromEncodingData(data: unknown): StateProofTrackingData {
|
|
88
|
+
if (!(data instanceof Map)) {
|
|
89
|
+
throw new Error(`Invalid decoded StateProofTrackingData: ${data}`);
|
|
90
|
+
}
|
|
91
|
+
return new StateProofTrackingData({
|
|
92
|
+
stateProofVotersCommitment: data.get('v'),
|
|
93
|
+
stateProofOnlineTotalWeight: data.get('t'),
|
|
94
|
+
stateProofNextRound: data.get('n'),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* TxnCommitments represents the commitments computed from the transactions in the block.
|
|
101
|
+
* It contains multiple commitments based on different algorithms and hash functions, to support
|
|
102
|
+
* different use cases.
|
|
103
|
+
*/
|
|
104
|
+
export class TxnCommitments implements Encodable {
|
|
105
|
+
public static readonly encodingSchema = new NamedMapSchema(
|
|
106
|
+
allOmitEmpty([
|
|
107
|
+
{
|
|
108
|
+
key: 'txn', // nativeSha512_256Commitment
|
|
109
|
+
valueSchema: new FixedLengthByteArraySchema(32),
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: 'txn256', // sha256Commitment
|
|
113
|
+
valueSchema: new FixedLengthByteArraySchema(32),
|
|
114
|
+
},
|
|
115
|
+
])
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Root of transaction merkle tree using SHA512_256 hash function. This commitment is computed
|
|
120
|
+
* based on the PaysetCommit type specified in the block's consensus protocol.
|
|
121
|
+
*/
|
|
122
|
+
public nativeSha512_256Commitment: Uint8Array;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Root of transaction vector commitment merkle tree using SHA256 hash function
|
|
126
|
+
*/
|
|
127
|
+
public sha256Commitment: Uint8Array;
|
|
128
|
+
|
|
129
|
+
constructor(params: {
|
|
130
|
+
nativeSha512_256Commitment: Uint8Array;
|
|
131
|
+
sha256Commitment: Uint8Array;
|
|
132
|
+
}) {
|
|
133
|
+
this.nativeSha512_256Commitment = params.nativeSha512_256Commitment;
|
|
134
|
+
this.sha256Commitment = params.sha256Commitment;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// eslint-disable-next-line class-methods-use-this
|
|
138
|
+
public getEncodingSchema(): Schema {
|
|
139
|
+
return TxnCommitments.encodingSchema;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public toEncodingData(): Map<string, unknown> {
|
|
143
|
+
return new Map<string, unknown>([
|
|
144
|
+
['txn', this.nativeSha512_256Commitment],
|
|
145
|
+
['txn256', this.sha256Commitment],
|
|
146
|
+
]);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public static fromEncodingData(data: unknown): TxnCommitments {
|
|
150
|
+
if (!(data instanceof Map)) {
|
|
151
|
+
throw new Error(`Invalid decoded TxnCommitments: ${data}`);
|
|
152
|
+
}
|
|
153
|
+
return new TxnCommitments({
|
|
154
|
+
nativeSha512_256Commitment: data.get('txn'),
|
|
155
|
+
sha256Commitment: data.get('txn256'),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* RewardsState represents the global parameters controlling the rate at which accounts accrue rewards.
|
|
162
|
+
*/
|
|
163
|
+
export class RewardState implements Encodable {
|
|
164
|
+
public static readonly encodingSchema = new NamedMapSchema(
|
|
165
|
+
allOmitEmpty([
|
|
166
|
+
{
|
|
167
|
+
key: 'fees', // feeSink
|
|
168
|
+
valueSchema: new AddressSchema(),
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
key: 'rwd', // rewardsPool
|
|
172
|
+
valueSchema: new AddressSchema(),
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
key: 'earn', // rewardsLevel
|
|
176
|
+
valueSchema: new Uint64Schema(),
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
key: 'rate', // rewardsRate
|
|
180
|
+
valueSchema: new Uint64Schema(),
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
key: 'frac', // rewardsResidue
|
|
184
|
+
valueSchema: new Uint64Schema(),
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
key: 'rwcalr', // rewardsRecalculationRound
|
|
188
|
+
valueSchema: new Uint64Schema(),
|
|
189
|
+
},
|
|
190
|
+
])
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The FeeSink address.
|
|
195
|
+
*/
|
|
196
|
+
public feeSink: Address;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* The RewardsPool address.
|
|
200
|
+
*/
|
|
201
|
+
public rewardsPool: Address;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* RewardsLevel specifies how many rewards, in MicroAlgos, have been distributed to each
|
|
205
|
+
* config.Protocol.RewardUnit of MicroAlgos since genesis.
|
|
206
|
+
*/
|
|
207
|
+
public rewardsLevel: bigint;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The number of new MicroAlgos added to the participation stake from rewards at the next round.
|
|
211
|
+
*/
|
|
212
|
+
public rewardsRate: bigint;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* The number of leftover MicroAlgos after the distribution of RewardsRate/rewardUnits MicroAlgos for
|
|
216
|
+
* every reward unit in the next round.
|
|
217
|
+
*/
|
|
218
|
+
public rewardsResidue: bigint;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* The round at which the RewardsRate will be recalculated.
|
|
222
|
+
*/
|
|
223
|
+
public rewardsRecalculationRound: bigint;
|
|
224
|
+
|
|
225
|
+
constructor(params: {
|
|
226
|
+
feeSink: Address;
|
|
227
|
+
rewardsPool: Address;
|
|
228
|
+
rewardsLevel: bigint;
|
|
229
|
+
rewardsRate: bigint;
|
|
230
|
+
rewardsResidue: bigint;
|
|
231
|
+
rewardsRecalculationRound: bigint;
|
|
232
|
+
}) {
|
|
233
|
+
this.feeSink = params.feeSink;
|
|
234
|
+
this.rewardsPool = params.rewardsPool;
|
|
235
|
+
this.rewardsLevel = params.rewardsLevel;
|
|
236
|
+
this.rewardsRate = params.rewardsRate;
|
|
237
|
+
this.rewardsResidue = params.rewardsResidue;
|
|
238
|
+
this.rewardsRecalculationRound = params.rewardsRecalculationRound;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// eslint-disable-next-line class-methods-use-this
|
|
242
|
+
public getEncodingSchema(): Schema {
|
|
243
|
+
return RewardState.encodingSchema;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
public toEncodingData(): Map<string, unknown> {
|
|
247
|
+
return new Map<string, unknown>([
|
|
248
|
+
['fees', this.feeSink],
|
|
249
|
+
['rwd', this.rewardsPool],
|
|
250
|
+
['earn', this.rewardsLevel],
|
|
251
|
+
['rate', this.rewardsRate],
|
|
252
|
+
['frac', this.rewardsResidue],
|
|
253
|
+
['rwcalr', this.rewardsRecalculationRound],
|
|
254
|
+
]);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
public static fromEncodingData(data: unknown): RewardState {
|
|
258
|
+
if (!(data instanceof Map)) {
|
|
259
|
+
throw new Error(`Invalid decoded RewardState: ${data}`);
|
|
260
|
+
}
|
|
261
|
+
return new RewardState({
|
|
262
|
+
feeSink: data.get('fees'),
|
|
263
|
+
rewardsPool: data.get('rwd'),
|
|
264
|
+
rewardsLevel: data.get('earn'),
|
|
265
|
+
rewardsRate: data.get('rate'),
|
|
266
|
+
rewardsResidue: data.get('frac'),
|
|
267
|
+
rewardsRecalculationRound: data.get('rwcalr'),
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* UpgradeState tracks the protocol upgrade state machine. It is, strictly speaking, computable from
|
|
274
|
+
* the history of all UpgradeVotes but we keep it in the block for explicitness and convenience
|
|
275
|
+
* (instead of materializing it separately, like balances).
|
|
276
|
+
*/
|
|
277
|
+
export class UpgradeState implements Encodable {
|
|
278
|
+
public static readonly encodingSchema = new NamedMapSchema(
|
|
279
|
+
allOmitEmpty([
|
|
280
|
+
{
|
|
281
|
+
key: 'proto', // currentProtocol
|
|
282
|
+
valueSchema: new StringSchema(),
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
key: 'nextproto', // nextProtocol
|
|
286
|
+
valueSchema: new StringSchema(),
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
key: 'nextyes', // nextProtocolApprovals
|
|
290
|
+
valueSchema: new Uint64Schema(),
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
key: 'nextbefore', // nextProtocolVoteBefore
|
|
294
|
+
valueSchema: new Uint64Schema(),
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
key: 'nextswitch', // nextProtocolSwitchOn
|
|
298
|
+
valueSchema: new Uint64Schema(),
|
|
299
|
+
},
|
|
300
|
+
])
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
public currentProtocol: string;
|
|
304
|
+
|
|
305
|
+
public nextProtocol: string;
|
|
306
|
+
|
|
307
|
+
public nextProtocolApprovals: bigint;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* NextProtocolVoteBefore specify the last voting round for the next protocol proposal. If there
|
|
311
|
+
* is no voting for an upgrade taking place, this would be zero.
|
|
312
|
+
*/
|
|
313
|
+
public nextProtocolVoteBefore: bigint;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* NextProtocolSwitchOn specify the round number at which the next protocol would be adopted. If
|
|
317
|
+
* there is no upgrade taking place, nor a wait for the next protocol, this would be zero.
|
|
318
|
+
*/
|
|
319
|
+
public nextProtocolSwitchOn: bigint;
|
|
320
|
+
|
|
321
|
+
public constructor(params: {
|
|
322
|
+
currentProtocol: string;
|
|
323
|
+
nextProtocol: string;
|
|
324
|
+
nextProtocolApprovals: bigint;
|
|
325
|
+
nextProtocolVoteBefore: bigint;
|
|
326
|
+
nextProtocolSwitchOn: bigint;
|
|
327
|
+
}) {
|
|
328
|
+
this.currentProtocol = params.currentProtocol;
|
|
329
|
+
this.nextProtocol = params.nextProtocol;
|
|
330
|
+
this.nextProtocolApprovals = params.nextProtocolApprovals;
|
|
331
|
+
this.nextProtocolVoteBefore = params.nextProtocolVoteBefore;
|
|
332
|
+
this.nextProtocolSwitchOn = params.nextProtocolSwitchOn;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// eslint-disable-next-line class-methods-use-this
|
|
336
|
+
public getEncodingSchema(): Schema {
|
|
337
|
+
return UpgradeState.encodingSchema;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
public toEncodingData(): Map<string, unknown> {
|
|
341
|
+
return new Map<string, unknown>([
|
|
342
|
+
['proto', this.currentProtocol],
|
|
343
|
+
['nextproto', this.nextProtocol],
|
|
344
|
+
['nextyes', this.nextProtocolApprovals],
|
|
345
|
+
['nextbefore', this.nextProtocolVoteBefore],
|
|
346
|
+
['nextswitch', this.nextProtocolSwitchOn],
|
|
347
|
+
]);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
public static fromEncodingData(data: unknown): UpgradeState {
|
|
351
|
+
if (!(data instanceof Map)) {
|
|
352
|
+
throw new Error(`Invalid decoded UpgradeState: ${data}`);
|
|
353
|
+
}
|
|
354
|
+
return new UpgradeState({
|
|
355
|
+
currentProtocol: data.get('proto'),
|
|
356
|
+
nextProtocol: data.get('nextproto'),
|
|
357
|
+
nextProtocolApprovals: data.get('nextyes'),
|
|
358
|
+
nextProtocolVoteBefore: data.get('nextbefore'),
|
|
359
|
+
nextProtocolSwitchOn: data.get('nextswitch'),
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* UpgradeVote represents the vote of the block proposer with respect to protocol upgrades.
|
|
366
|
+
*/
|
|
367
|
+
export class UpgradeVote implements Encodable {
|
|
368
|
+
public static readonly encodingSchema = new NamedMapSchema(
|
|
369
|
+
allOmitEmpty([
|
|
370
|
+
{
|
|
371
|
+
key: 'upgradeprop', // upgradePropose
|
|
372
|
+
valueSchema: new StringSchema(),
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
key: 'upgradedelay', // upgradeDelay
|
|
376
|
+
valueSchema: new Uint64Schema(),
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
key: 'upgradeyes', // upgradeApprove
|
|
380
|
+
valueSchema: new BooleanSchema(),
|
|
381
|
+
},
|
|
382
|
+
])
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* UpgradePropose indicates a proposed upgrade
|
|
387
|
+
*/
|
|
388
|
+
public upgradePropose: string;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* UpgradeDelay indicates the time between acceptance and execution
|
|
392
|
+
*/
|
|
393
|
+
public upgradeDelay: bigint;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* UpgradeApprove indicates a yes vote for the current proposal
|
|
397
|
+
*/
|
|
398
|
+
public upgradeApprove: boolean;
|
|
399
|
+
|
|
400
|
+
public constructor(params: {
|
|
401
|
+
upgradePropose: string;
|
|
402
|
+
upgradeDelay: bigint;
|
|
403
|
+
upgradeApprove: boolean;
|
|
404
|
+
}) {
|
|
405
|
+
this.upgradePropose = params.upgradePropose;
|
|
406
|
+
this.upgradeDelay = params.upgradeDelay;
|
|
407
|
+
this.upgradeApprove = params.upgradeApprove;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// eslint-disable-next-line class-methods-use-this
|
|
411
|
+
public getEncodingSchema(): Schema {
|
|
412
|
+
return UpgradeVote.encodingSchema;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
public toEncodingData(): Map<string, unknown> {
|
|
416
|
+
return new Map<string, unknown>([
|
|
417
|
+
['upgradeprop', this.upgradePropose],
|
|
418
|
+
['upgradedelay', this.upgradeDelay],
|
|
419
|
+
['upgradeyes', this.upgradeApprove],
|
|
420
|
+
]);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
public static fromEncodingData(data: unknown): UpgradeVote {
|
|
424
|
+
if (!(data instanceof Map)) {
|
|
425
|
+
throw new Error(`Invalid decoded UpgradeVote: ${data}`);
|
|
426
|
+
}
|
|
427
|
+
return new UpgradeVote({
|
|
428
|
+
upgradePropose: data.get('upgradeprop'),
|
|
429
|
+
upgradeDelay: data.get('upgradedelay'),
|
|
430
|
+
upgradeApprove: data.get('upgradeyes'),
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* ParticipationUpdates represents participation account data that needs to be checked/acted on by
|
|
437
|
+
* the network
|
|
438
|
+
*/
|
|
439
|
+
export class ParticipationUpdates implements Encodable {
|
|
440
|
+
public static readonly encodingSchema = new NamedMapSchema(
|
|
441
|
+
allOmitEmpty([
|
|
442
|
+
{
|
|
443
|
+
key: 'partupdrmv', // expiredParticipationAccounts
|
|
444
|
+
valueSchema: new ArraySchema(new AddressSchema()),
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
key: 'partupdabs', // absentParticipationAccounts
|
|
448
|
+
valueSchema: new ArraySchema(new AddressSchema()),
|
|
449
|
+
},
|
|
450
|
+
])
|
|
451
|
+
);
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* ExpiredParticipationAccounts contains a list of online accounts that needs to be converted to
|
|
455
|
+
* offline since their participation key expired.
|
|
456
|
+
*/
|
|
457
|
+
public expiredParticipationAccounts: Address[];
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* AbsentParticipationAccounts contains a list of online accounts that needs to be converted to
|
|
461
|
+
* offline since they are not proposing.
|
|
462
|
+
*/
|
|
463
|
+
public absentParticipationAccounts: Address[];
|
|
464
|
+
|
|
465
|
+
public constructor(params: {
|
|
466
|
+
expiredParticipationAccounts: Address[];
|
|
467
|
+
absentParticipationAccounts: Address[];
|
|
468
|
+
}) {
|
|
469
|
+
this.expiredParticipationAccounts = params.expiredParticipationAccounts;
|
|
470
|
+
this.absentParticipationAccounts = params.absentParticipationAccounts;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// eslint-disable-next-line class-methods-use-this
|
|
474
|
+
public getEncodingSchema(): Schema {
|
|
475
|
+
return ParticipationUpdates.encodingSchema;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
public toEncodingData(): Map<string, unknown> {
|
|
479
|
+
return new Map<string, unknown>([
|
|
480
|
+
['partupdrmv', this.expiredParticipationAccounts],
|
|
481
|
+
['partupdabs', this.absentParticipationAccounts],
|
|
482
|
+
]);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
public static fromEncodingData(data: unknown): ParticipationUpdates {
|
|
486
|
+
if (!(data instanceof Map)) {
|
|
487
|
+
throw new Error(`Invalid decoded ParticipationUpdates: ${data}`);
|
|
488
|
+
}
|
|
489
|
+
return new ParticipationUpdates({
|
|
490
|
+
expiredParticipationAccounts: data.get('partupdrmv'),
|
|
491
|
+
absentParticipationAccounts: data.get('partupdabs'),
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Represents the metadata and state of a block.
|
|
498
|
+
*
|
|
499
|
+
* For more information, refer to: https://github.com/algorand/go-algorand/blob/master/data/bookkeeping/block.go
|
|
500
|
+
*/
|
|
501
|
+
export class BlockHeader implements Encodable {
|
|
502
|
+
public static readonly encodingSchema = new NamedMapSchema(
|
|
503
|
+
allOmitEmpty([
|
|
504
|
+
{
|
|
505
|
+
key: 'rnd', // round
|
|
506
|
+
valueSchema: new Uint64Schema(),
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
key: 'prev', // branch
|
|
510
|
+
valueSchema: new BlockHashSchema(),
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
key: 'seed', // seed
|
|
514
|
+
valueSchema: new ByteArraySchema(),
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
key: '',
|
|
518
|
+
valueSchema: TxnCommitments.encodingSchema,
|
|
519
|
+
embedded: true,
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
key: 'ts', // timestamp
|
|
523
|
+
valueSchema: new Uint64Schema(),
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
key: 'gen', // genesisID
|
|
527
|
+
valueSchema: new StringSchema(),
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
key: 'gh', // genesisHash
|
|
531
|
+
valueSchema: new FixedLengthByteArraySchema(32),
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
key: 'prp', // proposer
|
|
535
|
+
valueSchema: new AddressSchema(),
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
key: 'fc', // feesCollected
|
|
539
|
+
valueSchema: new Uint64Schema(),
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
key: 'bi', // bonus
|
|
543
|
+
valueSchema: new Uint64Schema(),
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
key: 'pp', // proposerPayout
|
|
547
|
+
valueSchema: new Uint64Schema(),
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
key: '',
|
|
551
|
+
valueSchema: RewardState.encodingSchema,
|
|
552
|
+
embedded: true,
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
key: '',
|
|
556
|
+
valueSchema: UpgradeState.encodingSchema,
|
|
557
|
+
embedded: true,
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
key: '',
|
|
561
|
+
valueSchema: UpgradeVote.encodingSchema,
|
|
562
|
+
embedded: true,
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
key: 'tc', // txnCounter
|
|
566
|
+
valueSchema: new Uint64Schema(),
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
key: 'spt', // stateproofTracking
|
|
570
|
+
valueSchema: new Uint64MapSchema(StateProofTrackingData.encodingSchema),
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
key: '',
|
|
574
|
+
valueSchema: ParticipationUpdates.encodingSchema,
|
|
575
|
+
embedded: true,
|
|
576
|
+
},
|
|
577
|
+
])
|
|
578
|
+
);
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Round number
|
|
582
|
+
*/
|
|
583
|
+
public round: bigint;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Previous block hash
|
|
587
|
+
*/
|
|
588
|
+
public branch: Uint8Array;
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Sortition seed
|
|
592
|
+
*/
|
|
593
|
+
public seed: Uint8Array;
|
|
594
|
+
|
|
595
|
+
public txnCommitments: TxnCommitments;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Timestamp in seconds since epoch
|
|
599
|
+
*/
|
|
600
|
+
public timestamp: bigint;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Genesis ID to which this block belongs.
|
|
604
|
+
*/
|
|
605
|
+
public genesisID: string;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Genesis hash to which this block belongs.
|
|
609
|
+
*/
|
|
610
|
+
public genesisHash: Uint8Array;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Proposer is the proposer of this block. Like the Seed, agreement adds this after the block is
|
|
614
|
+
* assembled by the transaction pool, so that the same block can be prepared for multiple
|
|
615
|
+
* participating accounts in the same node. Populated if proto.Payouts.Enabled
|
|
616
|
+
*/
|
|
617
|
+
public proposer: Address;
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* FeesCollected is the sum of all fees paid by transactions in this block. Populated if
|
|
621
|
+
* proto.EnableMining.
|
|
622
|
+
*/
|
|
623
|
+
public feesCollected: bigint;
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Bonus is the bonus incentive to be paid for proposing this block. It begins as a consensus
|
|
627
|
+
* parameter value, and decays periodically.
|
|
628
|
+
*/
|
|
629
|
+
public bonus: bigint;
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* ProposerPayout is the amount that should be moved from the FeeSink to the Proposer at the start
|
|
633
|
+
* of the next block. It is basically the bonus + the payouts percent of FeesCollected, but may
|
|
634
|
+
* be zero'd by proposer ineligibility.
|
|
635
|
+
*/
|
|
636
|
+
public proposerPayout: bigint;
|
|
637
|
+
|
|
638
|
+
public rewardState: RewardState;
|
|
639
|
+
|
|
640
|
+
public upgradeState: UpgradeState;
|
|
641
|
+
|
|
642
|
+
public upgradeVote: UpgradeVote;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* TxnCounter is the number of the next transaction that will be committed after this block. Genesis
|
|
646
|
+
* blocks can start at either 0 or 1000, depending on a consensus parameter (AppForbidLowResources).
|
|
647
|
+
*/
|
|
648
|
+
public txnCounter: bigint;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* StateProofTracking tracks the status of the state proofs, potentially for multiple types of
|
|
652
|
+
* ASPs (Algorand's State Proofs).
|
|
653
|
+
*/
|
|
654
|
+
public stateproofTracking: Map<number, StateProofTrackingData>;
|
|
655
|
+
|
|
656
|
+
public participationUpdates: ParticipationUpdates;
|
|
657
|
+
|
|
658
|
+
public constructor(params: {
|
|
659
|
+
round: bigint;
|
|
660
|
+
branch: Uint8Array;
|
|
661
|
+
seed: Uint8Array;
|
|
662
|
+
txnCommitments: TxnCommitments;
|
|
663
|
+
timestamp: bigint;
|
|
664
|
+
genesisID: string;
|
|
665
|
+
genesisHash: Uint8Array;
|
|
666
|
+
proposer: Address;
|
|
667
|
+
feesCollected: bigint;
|
|
668
|
+
bonus: bigint;
|
|
669
|
+
proposerPayout: bigint;
|
|
670
|
+
rewardState: RewardState;
|
|
671
|
+
upgradeState: UpgradeState;
|
|
672
|
+
upgradeVote: UpgradeVote;
|
|
673
|
+
txnCounter: bigint;
|
|
674
|
+
stateproofTracking: Map<number, StateProofTrackingData>;
|
|
675
|
+
participationUpdates: ParticipationUpdates;
|
|
676
|
+
}) {
|
|
677
|
+
this.round = params.round;
|
|
678
|
+
this.branch = params.branch;
|
|
679
|
+
this.seed = params.seed;
|
|
680
|
+
this.txnCommitments = params.txnCommitments;
|
|
681
|
+
this.timestamp = params.timestamp;
|
|
682
|
+
this.genesisID = params.genesisID;
|
|
683
|
+
this.genesisHash = params.genesisHash;
|
|
684
|
+
this.proposer = params.proposer;
|
|
685
|
+
this.feesCollected = params.feesCollected;
|
|
686
|
+
this.bonus = params.bonus;
|
|
687
|
+
this.proposerPayout = params.proposerPayout;
|
|
688
|
+
this.rewardState = params.rewardState;
|
|
689
|
+
this.upgradeState = params.upgradeState;
|
|
690
|
+
this.upgradeVote = params.upgradeVote;
|
|
691
|
+
this.txnCounter = params.txnCounter;
|
|
692
|
+
this.stateproofTracking = params.stateproofTracking;
|
|
693
|
+
this.participationUpdates = params.participationUpdates;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// eslint-disable-next-line class-methods-use-this
|
|
697
|
+
public getEncodingSchema(): Schema {
|
|
698
|
+
return BlockHeader.encodingSchema;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
public toEncodingData(): Map<string, unknown> {
|
|
702
|
+
const data = new Map<string, unknown>([
|
|
703
|
+
['rnd', this.round],
|
|
704
|
+
['prev', this.branch],
|
|
705
|
+
['seed', this.seed],
|
|
706
|
+
['ts', this.timestamp],
|
|
707
|
+
['gen', this.genesisID],
|
|
708
|
+
['gh', this.genesisHash],
|
|
709
|
+
['prp', this.proposer],
|
|
710
|
+
['fc', this.feesCollected],
|
|
711
|
+
['bi', this.bonus],
|
|
712
|
+
['pp', this.proposerPayout],
|
|
713
|
+
['tc', this.txnCounter],
|
|
714
|
+
[
|
|
715
|
+
'spt',
|
|
716
|
+
convertMap(this.stateproofTracking, (key, value) => [
|
|
717
|
+
key,
|
|
718
|
+
value.toEncodingData(),
|
|
719
|
+
]),
|
|
720
|
+
],
|
|
721
|
+
]);
|
|
722
|
+
return combineMaps(
|
|
723
|
+
data,
|
|
724
|
+
this.txnCommitments.toEncodingData(),
|
|
725
|
+
this.rewardState.toEncodingData(),
|
|
726
|
+
this.upgradeState.toEncodingData(),
|
|
727
|
+
this.upgradeVote.toEncodingData(),
|
|
728
|
+
this.participationUpdates.toEncodingData()
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
public static fromEncodingData(data: unknown): BlockHeader {
|
|
733
|
+
if (!(data instanceof Map)) {
|
|
734
|
+
throw new Error(`Invalid decoded BlockHeader: ${data}`);
|
|
735
|
+
}
|
|
736
|
+
return new BlockHeader({
|
|
737
|
+
round: data.get('rnd'),
|
|
738
|
+
branch: data.get('prev'),
|
|
739
|
+
seed: data.get('seed'),
|
|
740
|
+
txnCommitments: TxnCommitments.fromEncodingData(data),
|
|
741
|
+
timestamp: data.get('ts'),
|
|
742
|
+
genesisID: data.get('gen'),
|
|
743
|
+
genesisHash: data.get('gh'),
|
|
744
|
+
proposer: data.get('prp'),
|
|
745
|
+
feesCollected: data.get('fc'),
|
|
746
|
+
bonus: data.get('bi'),
|
|
747
|
+
proposerPayout: data.get('pp'),
|
|
748
|
+
rewardState: RewardState.fromEncodingData(data),
|
|
749
|
+
upgradeState: UpgradeState.fromEncodingData(data),
|
|
750
|
+
upgradeVote: UpgradeVote.fromEncodingData(data),
|
|
751
|
+
txnCounter: data.get('tc'),
|
|
752
|
+
stateproofTracking: convertMap(
|
|
753
|
+
data.get('spt') as Map<bigint, unknown>,
|
|
754
|
+
(key, value) => [
|
|
755
|
+
Number(key),
|
|
756
|
+
StateProofTrackingData.fromEncodingData(value),
|
|
757
|
+
]
|
|
758
|
+
),
|
|
759
|
+
participationUpdates: ParticipationUpdates.fromEncodingData(data),
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
export class ValueDelta implements Encodable {
|
|
765
|
+
public static readonly encodingSchema = new NamedMapSchema(
|
|
766
|
+
allOmitEmpty([
|
|
767
|
+
{
|
|
768
|
+
key: 'at', // action
|
|
769
|
+
valueSchema: new Uint64Schema(),
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
key: 'bs', // bytes
|
|
773
|
+
valueSchema: new SpecialCaseBinaryStringSchema(),
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
key: 'ui', // uint
|
|
777
|
+
valueSchema: new Uint64Schema(),
|
|
778
|
+
},
|
|
779
|
+
])
|
|
780
|
+
);
|
|
781
|
+
|
|
782
|
+
public action: number;
|
|
783
|
+
public bytes: Uint8Array;
|
|
784
|
+
public uint: bigint;
|
|
785
|
+
|
|
786
|
+
public constructor(params: {
|
|
787
|
+
action: number;
|
|
788
|
+
bytes: Uint8Array;
|
|
789
|
+
uint: bigint;
|
|
790
|
+
}) {
|
|
791
|
+
this.action = params.action;
|
|
792
|
+
this.bytes = params.bytes;
|
|
793
|
+
this.uint = params.uint;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// eslint-disable-next-line class-methods-use-this
|
|
797
|
+
public getEncodingSchema(): Schema {
|
|
798
|
+
return ValueDelta.encodingSchema;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
public toEncodingData(): Map<string, unknown> {
|
|
802
|
+
return new Map<string, unknown>([
|
|
803
|
+
['at', this.action],
|
|
804
|
+
['bs', this.bytes],
|
|
805
|
+
['ui', this.uint],
|
|
806
|
+
]);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
public static fromEncodingData(data: unknown): ValueDelta {
|
|
810
|
+
if (!(data instanceof Map)) {
|
|
811
|
+
throw new Error(`Invalid decoded ValueDelta: ${data}`);
|
|
812
|
+
}
|
|
813
|
+
return new ValueDelta({
|
|
814
|
+
action: Number(data.get('at')),
|
|
815
|
+
bytes: data.get('bs'),
|
|
816
|
+
uint: data.get('ui'),
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
export class EvalDelta implements Encodable {
|
|
822
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
823
|
+
|
|
824
|
+
public static get encodingSchema(): Schema {
|
|
825
|
+
// This is declared like this in order to break the circular dependency of
|
|
826
|
+
// SignedTxnWithAD -> ApplyData -> EvalDelta -> SignedTxnWithAD
|
|
827
|
+
if (!this.encodingSchemaValue) {
|
|
828
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
829
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
830
|
+
...allOmitEmpty([
|
|
831
|
+
{
|
|
832
|
+
key: 'gd', // globalDelta
|
|
833
|
+
valueSchema: new OptionalSchema(
|
|
834
|
+
new SpecialCaseBinaryStringMapSchema(ValueDelta.encodingSchema)
|
|
835
|
+
),
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
key: 'ld', // localDeltas
|
|
839
|
+
valueSchema: new OptionalSchema(
|
|
840
|
+
new Uint64MapSchema(
|
|
841
|
+
new SpecialCaseBinaryStringMapSchema(ValueDelta.encodingSchema)
|
|
842
|
+
)
|
|
843
|
+
),
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
key: 'sa', // sharedAccts
|
|
847
|
+
valueSchema: new OptionalSchema(
|
|
848
|
+
new ArraySchema(new AddressSchema())
|
|
849
|
+
),
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
key: 'lg', // logs
|
|
853
|
+
valueSchema: new OptionalSchema(
|
|
854
|
+
new ArraySchema(new SpecialCaseBinaryStringSchema())
|
|
855
|
+
),
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
key: 'itx', // innerTxns
|
|
859
|
+
valueSchema: new OptionalSchema(
|
|
860
|
+
// eslint-disable-next-line no-use-before-define
|
|
861
|
+
new ArraySchema(SignedTxnWithAD.encodingSchema)
|
|
862
|
+
),
|
|
863
|
+
},
|
|
864
|
+
])
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
return this.encodingSchemaValue;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
public globalDelta: Map<Uint8Array, ValueDelta>;
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* When decoding EvalDeltas, the integer key represents an offset into
|
|
874
|
+
* [txn.Sender, txn.Accounts[0], txn.Accounts[1], ...]
|
|
875
|
+
*/
|
|
876
|
+
public localDeltas: Map<number, Map<Uint8Array, ValueDelta>>;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* If a program modifies the local of an account that is not the Sender, or
|
|
880
|
+
* in txn.Accounts, it must be recorded here, so that the key in LocalDeltas
|
|
881
|
+
* can refer to it.
|
|
882
|
+
*/
|
|
883
|
+
public sharedAccts: Address[];
|
|
884
|
+
|
|
885
|
+
public logs: Uint8Array[];
|
|
886
|
+
|
|
887
|
+
// eslint-disable-next-line no-use-before-define
|
|
888
|
+
public innerTxns: SignedTxnWithAD[];
|
|
889
|
+
|
|
890
|
+
public constructor(params: {
|
|
891
|
+
globalDelta?: Map<Uint8Array, ValueDelta>;
|
|
892
|
+
localDeltas?: Map<number, Map<Uint8Array, ValueDelta>>;
|
|
893
|
+
sharedAccts?: Address[];
|
|
894
|
+
logs?: Uint8Array[];
|
|
895
|
+
// eslint-disable-next-line no-use-before-define
|
|
896
|
+
innerTxns?: SignedTxnWithAD[];
|
|
897
|
+
}) {
|
|
898
|
+
this.globalDelta = params.globalDelta ?? new Map<Uint8Array, ValueDelta>();
|
|
899
|
+
this.localDeltas =
|
|
900
|
+
params.localDeltas ?? new Map<number, Map<Uint8Array, ValueDelta>>();
|
|
901
|
+
this.sharedAccts = params.sharedAccts ?? [];
|
|
902
|
+
this.logs = params.logs ?? [];
|
|
903
|
+
this.innerTxns = params.innerTxns ?? [];
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
// eslint-disable-next-line class-methods-use-this
|
|
907
|
+
public getEncodingSchema(): Schema {
|
|
908
|
+
return EvalDelta.encodingSchema;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
public toEncodingData(): Map<string, unknown> {
|
|
912
|
+
return new Map<string, unknown>([
|
|
913
|
+
[
|
|
914
|
+
'gd',
|
|
915
|
+
convertMap(this.globalDelta, (key, value) => [
|
|
916
|
+
key,
|
|
917
|
+
value.toEncodingData(),
|
|
918
|
+
]),
|
|
919
|
+
],
|
|
920
|
+
[
|
|
921
|
+
'ld',
|
|
922
|
+
convertMap(this.localDeltas, (key, value) => [
|
|
923
|
+
key,
|
|
924
|
+
convertMap(value, (k, v) => [k, v.toEncodingData()]),
|
|
925
|
+
]),
|
|
926
|
+
],
|
|
927
|
+
['sa', this.sharedAccts],
|
|
928
|
+
['lg', this.logs],
|
|
929
|
+
['itx', this.innerTxns.map((t) => t.toEncodingData())],
|
|
930
|
+
]);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
public static fromEncodingData(data: unknown): EvalDelta {
|
|
934
|
+
if (!(data instanceof Map)) {
|
|
935
|
+
throw new Error(`Invalid decoded EvalDelta: ${data}`);
|
|
936
|
+
}
|
|
937
|
+
return new EvalDelta({
|
|
938
|
+
globalDelta: data.get('gd')
|
|
939
|
+
? convertMap(
|
|
940
|
+
data.get('gd') as Map<Uint8Array, unknown>,
|
|
941
|
+
(key, value) => [key, ValueDelta.fromEncodingData(value)]
|
|
942
|
+
)
|
|
943
|
+
: undefined,
|
|
944
|
+
localDeltas: data.get('ld')
|
|
945
|
+
? convertMap(
|
|
946
|
+
data.get('ld') as Map<bigint, Map<Uint8Array, unknown>>,
|
|
947
|
+
(key, value) => [
|
|
948
|
+
Number(key),
|
|
949
|
+
convertMap(value, (k, v) => [k, ValueDelta.fromEncodingData(v)]),
|
|
950
|
+
]
|
|
951
|
+
)
|
|
952
|
+
: undefined,
|
|
953
|
+
sharedAccts: data.get('sa'),
|
|
954
|
+
logs: data.get('lg'),
|
|
955
|
+
// eslint-disable-next-line no-use-before-define
|
|
956
|
+
innerTxns: (data.get('itx') ?? []).map(SignedTxnWithAD.fromEncodingData),
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
export class ApplyData implements Encodable {
|
|
962
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
963
|
+
|
|
964
|
+
public static get encodingSchema(): Schema {
|
|
965
|
+
// This is declared like this in order to break the circular dependency of
|
|
966
|
+
// SignedTxnWithAD -> ApplyData -> EvalDelta -> SignedTxnWithAD
|
|
967
|
+
if (!this.encodingSchemaValue) {
|
|
968
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
969
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
970
|
+
...allOmitEmpty([
|
|
971
|
+
{
|
|
972
|
+
key: 'ca', // closingAmount
|
|
973
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
key: 'aca', // assetClosingAmount
|
|
977
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
key: 'rs', // senderRewards
|
|
981
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
key: 'rr', // receiverRewards
|
|
985
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
key: 'rc', // closeRewards
|
|
989
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
key: 'dt', // evalDelta
|
|
993
|
+
valueSchema: new OptionalSchema(EvalDelta.encodingSchema),
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
key: 'caid', // configAsset
|
|
997
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
key: 'apid', // applicationID
|
|
1001
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
1002
|
+
},
|
|
1003
|
+
])
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
return this.encodingSchemaValue;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* Closing amount for transaction.
|
|
1011
|
+
*/
|
|
1012
|
+
public closingAmount?: bigint;
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Closing amount for asset transaction.
|
|
1016
|
+
*/
|
|
1017
|
+
public assetClosingAmount?: bigint;
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Rewards applied to the Sender.
|
|
1021
|
+
*/
|
|
1022
|
+
public senderRewards?: bigint;
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Rewards applied to the Receiver.
|
|
1026
|
+
*/
|
|
1027
|
+
public receiverRewards?: bigint;
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Rewards applied to the CloseRemainderTo account.
|
|
1031
|
+
*/
|
|
1032
|
+
public closeRewards?: bigint;
|
|
1033
|
+
|
|
1034
|
+
public evalDelta?: EvalDelta;
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* If an ASA is being created, this is its newly created ID. Else 0.
|
|
1038
|
+
*/
|
|
1039
|
+
public configAsset?: bigint;
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* If an application is being created, this is its newly created ID. Else 0.
|
|
1043
|
+
*/
|
|
1044
|
+
public applicationID?: bigint;
|
|
1045
|
+
|
|
1046
|
+
public constructor(params: {
|
|
1047
|
+
closingAmount?: bigint;
|
|
1048
|
+
assetClosingAmount?: bigint;
|
|
1049
|
+
senderRewards?: bigint;
|
|
1050
|
+
receiverRewards?: bigint;
|
|
1051
|
+
closeRewards?: bigint;
|
|
1052
|
+
evalDelta?: EvalDelta;
|
|
1053
|
+
configAsset?: bigint;
|
|
1054
|
+
applicationID?: bigint;
|
|
1055
|
+
}) {
|
|
1056
|
+
this.closingAmount = params.closingAmount;
|
|
1057
|
+
this.assetClosingAmount = params.assetClosingAmount;
|
|
1058
|
+
this.senderRewards = params.senderRewards;
|
|
1059
|
+
this.receiverRewards = params.receiverRewards;
|
|
1060
|
+
this.closeRewards = params.closeRewards;
|
|
1061
|
+
this.evalDelta = params.evalDelta;
|
|
1062
|
+
this.configAsset = params.configAsset;
|
|
1063
|
+
this.applicationID = params.applicationID;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1067
|
+
public getEncodingSchema(): Schema {
|
|
1068
|
+
return ApplyData.encodingSchema;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
public toEncodingData(): Map<string, unknown> {
|
|
1072
|
+
return new Map<string, unknown>([
|
|
1073
|
+
['ca', this.closingAmount],
|
|
1074
|
+
['aca', this.assetClosingAmount],
|
|
1075
|
+
['rs', this.senderRewards],
|
|
1076
|
+
['rr', this.receiverRewards],
|
|
1077
|
+
['rc', this.closeRewards],
|
|
1078
|
+
['dt', this.evalDelta ? this.evalDelta.toEncodingData() : undefined],
|
|
1079
|
+
['caid', this.configAsset],
|
|
1080
|
+
['apid', this.applicationID],
|
|
1081
|
+
]);
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
public static fromEncodingData(data: unknown): ApplyData {
|
|
1085
|
+
if (!(data instanceof Map)) {
|
|
1086
|
+
throw new Error(`Invalid decoded ApplyData: ${data}`);
|
|
1087
|
+
}
|
|
1088
|
+
return new ApplyData({
|
|
1089
|
+
closingAmount: data.get('ca'),
|
|
1090
|
+
assetClosingAmount: data.get('aca'),
|
|
1091
|
+
senderRewards: data.get('rs'),
|
|
1092
|
+
receiverRewards: data.get('rr'),
|
|
1093
|
+
closeRewards: data.get('rc'),
|
|
1094
|
+
evalDelta: data.get('dt')
|
|
1095
|
+
? EvalDelta.fromEncodingData(data.get('dt'))
|
|
1096
|
+
: undefined,
|
|
1097
|
+
configAsset: data.get('caid'),
|
|
1098
|
+
applicationID: data.get('apid'),
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
export class SignedTxnWithAD implements Encodable {
|
|
1104
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
1105
|
+
|
|
1106
|
+
public static get encodingSchema(): Schema {
|
|
1107
|
+
// This is declared like this in order to break the circular dependency of
|
|
1108
|
+
// SignedTxnWithAD -> ApplyData -> EvalDelta -> SignedTxnWithAD
|
|
1109
|
+
if (!this.encodingSchemaValue) {
|
|
1110
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
1111
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
1112
|
+
...allOmitEmpty([
|
|
1113
|
+
{
|
|
1114
|
+
key: '',
|
|
1115
|
+
valueSchema: SignedTransaction.encodingSchema,
|
|
1116
|
+
embedded: true,
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
key: '',
|
|
1120
|
+
valueSchema: ApplyData.encodingSchema,
|
|
1121
|
+
embedded: true,
|
|
1122
|
+
},
|
|
1123
|
+
])
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
return this.encodingSchemaValue;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
public signedTxn: SignedTransaction;
|
|
1130
|
+
|
|
1131
|
+
public applyData: ApplyData;
|
|
1132
|
+
|
|
1133
|
+
public constructor(params: {
|
|
1134
|
+
signedTxn: SignedTransaction;
|
|
1135
|
+
applyData: ApplyData;
|
|
1136
|
+
}) {
|
|
1137
|
+
this.signedTxn = params.signedTxn;
|
|
1138
|
+
this.applyData = params.applyData;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1142
|
+
public getEncodingSchema(): Schema {
|
|
1143
|
+
return SignedTxnWithAD.encodingSchema;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
public toEncodingData(): Map<string, unknown> {
|
|
1147
|
+
return combineMaps(
|
|
1148
|
+
this.signedTxn.toEncodingData(),
|
|
1149
|
+
this.applyData.toEncodingData()
|
|
1150
|
+
);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
public static fromEncodingData(data: unknown): SignedTxnWithAD {
|
|
1154
|
+
if (!(data instanceof Map)) {
|
|
1155
|
+
throw new Error(`Invalid decoded SignedTxnWithAD: ${data}`);
|
|
1156
|
+
}
|
|
1157
|
+
return new SignedTxnWithAD({
|
|
1158
|
+
signedTxn: SignedTransaction.fromEncodingData(data),
|
|
1159
|
+
applyData: ApplyData.fromEncodingData(data),
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* SignedTxnInBlock is how a signed transaction is encoded in a block.
|
|
1166
|
+
*/
|
|
1167
|
+
export class SignedTxnInBlock implements Encodable {
|
|
1168
|
+
public static readonly encodingSchema = new NamedMapSchema(
|
|
1169
|
+
allOmitEmpty([
|
|
1170
|
+
{
|
|
1171
|
+
key: '',
|
|
1172
|
+
valueSchema: SignedTxnWithAD.encodingSchema,
|
|
1173
|
+
embedded: true,
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
key: 'hgi', // hasGenesisID
|
|
1177
|
+
valueSchema: new BooleanSchema(),
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
key: 'hgh', // hasGenesisHash
|
|
1181
|
+
valueSchema: new BooleanSchema(),
|
|
1182
|
+
},
|
|
1183
|
+
])
|
|
1184
|
+
);
|
|
1185
|
+
|
|
1186
|
+
public signedTxn: SignedTxnWithAD;
|
|
1187
|
+
|
|
1188
|
+
public hasGenesisID: boolean;
|
|
1189
|
+
|
|
1190
|
+
public hasGenesisHash: boolean;
|
|
1191
|
+
|
|
1192
|
+
public constructor(params: {
|
|
1193
|
+
signedTxn: SignedTxnWithAD;
|
|
1194
|
+
hasGenesisID: boolean;
|
|
1195
|
+
hasGenesisHash: boolean;
|
|
1196
|
+
}) {
|
|
1197
|
+
this.signedTxn = params.signedTxn;
|
|
1198
|
+
this.hasGenesisID = params.hasGenesisID;
|
|
1199
|
+
this.hasGenesisHash = params.hasGenesisHash;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1203
|
+
public getEncodingSchema(): Schema {
|
|
1204
|
+
return SignedTxnInBlock.encodingSchema;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
public toEncodingData(): Map<string, unknown> {
|
|
1208
|
+
const data = new Map<string, unknown>([
|
|
1209
|
+
['hgi', this.hasGenesisID],
|
|
1210
|
+
['hgh', this.hasGenesisHash],
|
|
1211
|
+
]);
|
|
1212
|
+
return combineMaps(data, this.signedTxn.toEncodingData());
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
public static fromEncodingData(data: unknown): SignedTxnInBlock {
|
|
1216
|
+
if (!(data instanceof Map)) {
|
|
1217
|
+
throw new Error(`Invalid decoded SignedTxnInBlock: ${data}`);
|
|
1218
|
+
}
|
|
1219
|
+
return new SignedTxnInBlock({
|
|
1220
|
+
signedTxn: SignedTxnWithAD.fromEncodingData(data),
|
|
1221
|
+
hasGenesisID: data.get('hgi'),
|
|
1222
|
+
hasGenesisHash: data.get('hgh'),
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* A Block contains the Payset and metadata corresponding to a given Round.
|
|
1229
|
+
*/
|
|
1230
|
+
export class Block implements Encodable {
|
|
1231
|
+
public static readonly encodingSchema = new NamedMapSchema(
|
|
1232
|
+
allOmitEmpty([
|
|
1233
|
+
{
|
|
1234
|
+
key: '',
|
|
1235
|
+
valueSchema: BlockHeader.encodingSchema,
|
|
1236
|
+
embedded: true,
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
key: 'txns', // payset
|
|
1240
|
+
valueSchema: new ArraySchema(SignedTxnInBlock.encodingSchema),
|
|
1241
|
+
},
|
|
1242
|
+
])
|
|
1243
|
+
);
|
|
1244
|
+
|
|
1245
|
+
public header: BlockHeader;
|
|
1246
|
+
|
|
1247
|
+
public payset: SignedTxnInBlock[];
|
|
1248
|
+
|
|
1249
|
+
public constructor(params: {
|
|
1250
|
+
header: BlockHeader;
|
|
1251
|
+
payset: SignedTxnInBlock[];
|
|
1252
|
+
}) {
|
|
1253
|
+
this.header = params.header;
|
|
1254
|
+
this.payset = params.payset;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1258
|
+
public getEncodingSchema(): Schema {
|
|
1259
|
+
return Block.encodingSchema;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
public toEncodingData(): Map<string, unknown> {
|
|
1263
|
+
const data = new Map<string, unknown>([
|
|
1264
|
+
['txns', this.payset.map((p) => p.toEncodingData())],
|
|
1265
|
+
]);
|
|
1266
|
+
return combineMaps(data, this.header.toEncodingData());
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
public static fromEncodingData(data: unknown): Block {
|
|
1270
|
+
if (!(data instanceof Map)) {
|
|
1271
|
+
throw new Error(`Invalid decoded BlockHeader: ${data}`);
|
|
1272
|
+
}
|
|
1273
|
+
return new Block({
|
|
1274
|
+
header: BlockHeader.fromEncodingData(data),
|
|
1275
|
+
payset: data.get('txns').map(SignedTxnInBlock.fromEncodingData),
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
}
|