/// import { Models } from '@open-rights-exchange/chain-js'; import { AlgorandMultisigOptions, AlgorandValue } from './generalModels'; import { AlgorandAddress, AlgorandPublicKey } from './cryptoModels'; import { AlgorandTxActionStruct } from './algoStructures'; /** * Chain response type after a transaction is confirmed on the chain */ export type AlgorandTxChainResponse = { type: string; tx: string; from: string; fee: number; 'first-round': number; 'last-round': number; noteb64: string; round: number; payment?: { to: string; amount: number; torewards: number; closerewards: number; }; fromrewards?: number; genesisID: string; genesishashb64: string; note: Buffer; }; /** * Chain response type after submitting a transaction */ export type AlgorandTxResult = { transactionId: string; chainResponse?: AlgorandTxChainResponse; }; /** Cost in Algos to run the transaction */ export type AlgorandTransactionFee = { /** fee is a string value in units of Algos - e.g. { fee: '.01' } */ fee: string; }; /** Transaction properties that contain the genesis information and fee required to construct a transaction */ export type AlgorandTxHeaderParams = { genesisID?: string; genesisHash?: string; firstRound?: number; lastRound?: number; fee?: number; flatFee?: boolean; }; /** A type passed to algorand SDK that includes transaction params common to use with make...TxnWithSuggestedParams functions */ export type AlgorandSuggestedParams = { genesisID: string; genesisHash: string; firstRound: number; lastRound: number; fee: number; flatFee?: boolean; }; export type TransactionExpirationOptions = { expireSeconds?: number; windowSeconds?: number; }; /** Transaction 'header' options set to chain along with the content type */ export type AlgorandTransactionOptions = { /** Number of seconds after which transaction expires - must be submitted to the chain before then */ expireSeconds?: number; fee?: AlgorandValue; flatFee?: boolean; multisigOptions?: AlgorandMultisigOptions; /** (optional) The publicKey used to sign the transaction - if an account has been rekeyed, use the signing key here * if not provided, defaults to 'from' address's publicKey */ signerPublicKey?: AlgorandPublicKey; /** scalar values to multiply suggested fee by by priority */ feeMultipliers?: Models.TransactionFeePriorityMultipliers; }; /** Raw transaction ready to be signed */ export type AlgorandTxActionRaw = AlgorandTxActionStruct; /** All possible properties of an Algorand transaction action * Can be used to create or compose a new Algorand action */ export type AlgorandTxAction = AlgorandTxActionUnencodeFields & AlgorandTxActionSharedFields; /** All possible properties of an Algorand transaction action * Encodes several fields (e.g. note) as expected by the algoSDK */ export type AlgorandTxActionSdkEncoded = AlgorandTxActionSdkEncodedFields & AlgorandTxActionSharedFields; /** action fields in an unencoded state (these will be encoded for the algorand SDK) */ export type AlgorandTxActionUnencodeFields = { appApprovalProgram?: string; appClearProgram?: string; appArgs?: (string | number | Uint8Array)[]; group?: string; lease?: string; note?: string; selectionKey?: string; tag?: string; voteKey?: string; }; /** action fields as they should be encoded for the algorand SDK */ export type AlgorandTxActionSdkEncodedFields = { appApprovalProgram?: Uint8Array; appClearProgram?: Uint8Array; appArgs?: Uint8Array[]; group?: Buffer; lease?: Uint8Array; note?: Uint8Array; selectionKey?: Buffer; tag?: Buffer; voteKey?: Buffer; }; /** Algorand Tx Fields for both SdkEncoded and non-encoded types * All possible properties of an Algorand transaction action * Can be used to create or compose a new Algorand action */ type AlgorandTxActionSharedFields = AlgorandTxHeaderParams & { to?: AlgorandAddress; from?: AlgorandAddress; amount?: number; name?: string; lease?: string; closeRemainderTo?: AlgorandAddress; voteKey?: string; selectionKey?: string; voteFirst?: number; voteLast?: number; voteKeyDilution?: number; assetIndex?: number; assetTotal?: number; assetDecimals?: number; assetDefaultFrozen?: boolean; assetManager?: AlgorandAddress; assetReserve?: AlgorandAddress; assetFreeze?: AlgorandAddress; assetClawback?: AlgorandAddress; assetUnitName?: string; assetName?: string; assetURL?: string; assetMetadataHash?: string | Uint8Array; freezeAccount?: AlgorandAddress; freezeState?: boolean; assetRevocationTarget?: AlgorandAddress; type?: string; group?: string; decimals?: number; appIndex?: number; appOnComplete?: number; appLocalInts?: number; appLocalByteSlices?: number; appGlobalInts?: number; appGlobalByteSlices?: number; appAccounts?: AlgorandAddress[]; appForeignApps?: number[]; appForeignAssets?: number[]; reKeyTo?: AlgorandAddress; }; /** algoSdk.transaction object */ export type AlgorandTransactionBuilder = any; /** Algorand Tx Fields for a transction that has retrieved from the chain * Includes optional fields related to actual cost, final block, etc. */ export type AlgorandTxFromChain = AlgorandTxHeaderParams & { closeRewards: number; closingAmount: number; confirmedRound: number; fee: number; firstValid?: number; genesisID: string; genesisHash: string; group?: string; id: string; intraRoundOffset?: number; lastValid?: number; paymentTransaction?: { amount: number; closeAmount: number; receiver: AlgorandAddress; }; receiverRewards: number; roundTime: number; sender: AlgorandAddress; senderRewards: number; txType: string; }; export {};