Options
All
  • Public
  • Public/Protected
  • All
Menu

@algo-builder/algob

Index

Variables

Const globalZeroAddress

globalZeroAddress: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ" = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ"

Functions

KMDCredentialsFromEnv

algodCredentialsFromEnv

balanceOf

  • balanceOf(deployer: Deployer, accountAddress: AccountAddress, assetID: number): Promise<AssetHolding | undefined>
  • Returns account asset holding of assetID. Returns undefined if the account is not opt-in to the given asset id.

    Parameters

    • deployer: Deployer

      algob deployer

    • accountAddress: AccountAddress

      account to return assetholding info

    • assetID: number

      asset index

    Returns Promise<AssetHolding | undefined>

createMsigAddress

  • createMsigAddress(version: number, threshold: number, accountList: string[]): [MultisigMetadata, string]
  • returns multisignature account address

    Parameters

    • version: number

      version of msig

    • threshold: number

      represents min no. of signatures for a tx to be approved

    • accountList: string[]

      account address of multisig (note: order is important)

    Returns [MultisigMetadata, string]

    multisig metadata ({v: .., thr: .., addr: ..}) and the multisig addresses

executeSignedTxnFromFile

  • executeSignedTxnFromFile(deployer: Deployer, fileName: string): Promise<algosdk.ConfirmedTxInfo>
  • Decode signed txn from file and send to network. probably won't work, because transaction contains fields like firstValid and lastValid which might not be equal to the current network's blockchain block height.

    Parameters

    • deployer: Deployer

      Deployer

    • fileName: string

      raw(encoded) signed txn file

    Returns Promise<algosdk.ConfirmedTxInfo>

executeTransaction

  • Execute single transaction or group of transactions (atomic transaction)

    Parameters

    Returns Promise<algosdk.ConfirmedTxInfo>

getProgram

  • getProgram(fileName: string, scInitParam?: unknown): string
  • returns program TEAL code.

    Parameters

    • fileName: string

      filename in /assets. Must end with .teal OR .py

    • Optional scInitParam: unknown

      smart contract template parameters, used to set hardcoded values in .py smart contract. (used only when compiling PyTEAL to TEAL)

    Returns string

getSuggestedParams

  • getSuggestedParams(algocl: Algodv2): Promise<SuggestedParams>
  • Returns blockchain transaction suggested parameters (firstRound, lastRound, fee..)

    Parameters

    • algocl: Algodv2

      an Algorand client, instance of Algodv2, used to communicate with a blockchain node.

    Returns Promise<SuggestedParams>

loadAccountsFromEnv

loadAccountsFromFile

  • loadAccountsFromFile(filename: string): Promise<Account[]>
  • Loads accounts from filename. The file should be a YAML file with list of objects which is either HDAccount, MnemonicAccount or an Account.

    Parameters

    • filename: string

      file to load accounts from

    Returns Promise<Account[]>

loadAccountsFromFileSync

  • loadAccountsFromFileSync(filename: string): Account[]
  • Same as loadAccountsFromFile but uses sync method instead of async

    Parameters

    • filename: string

      file to load accounts from

    Returns Account[]

mkAccounts

mkTxParams

  • mkTxParams(algocl: Algodv2, userParams: TxParams, s?: SuggestedParams): Promise<SuggestedParams>
  • Returns a union object of custom transaction params and suggested params.

    Parameters

    • algocl: Algodv2

      an Algorand client, instance of Algodv2, used to communicate with a blockchain node.

    • userParams: TxParams

      a dict containing custom params defined by the user

    • Optional s: SuggestedParams

      suggested transaction params

    Returns Promise<SuggestedParams>

printAssets

  • printAssets(deployer: Deployer, account: string): Promise<void>
  • Prints account asset holdings and ALGO balance (in microalgos)

    Parameters

    • deployer: Deployer

      algob deployer object

    • account: string

      account whose asset holding to print

    Returns Promise<void>

printGlobalStateSSC

  • print global state of a stateful smart contract

    Parameters

    • deployer: Deployer

      algob deployer

    • creatorAddr: AccountAddress

      creator address of stateful smart contract

    • appId: number

      application index of smart contract

    Returns Promise<void>

printLocalStateSSC

  • print account's local state of a stateful smart contract

    Parameters

    • deployer: Deployer

      algob deployer

    • accountAddr: AccountAddress

      account address to print local state

    • appId: number

      application index of smart contract

    Returns Promise<void>

readGlobalStateSSC

  • readGlobalStateSSC(deployer: Deployer, creator: AccountAddress, appId: number): Promise<SSCStateSchema[] | undefined>
  • fetches and returns the global state of application.

    Parameters

    • deployer: Deployer

      Deployer

    • creator: AccountAddress

      Account from which call needs to be made

    • appId: number

      ID of the application being configured or empty if creating

    Returns Promise<SSCStateSchema[] | undefined>

readLocalStateSSC

  • readLocalStateSSC(deployer: Deployer, account: AccountAddress, appId: number): Promise<SSCStateSchema[] | undefined>
  • Read and return the local state of application from an account.

    Parameters

    • deployer: Deployer

      Deployer

    • account: AccountAddress

      account from the which the local state has to be read

    • appId: number

      ID of the application being configured or empty if creating

    Returns Promise<SSCStateSchema[] | undefined>

signLogicSigMultiSig

  • signLogicSigMultiSig(lsig: LogicSig, signer: Account, mparams?: MultisigMetadata): LogicSig
  • Appends signature (using signer's sk) to multi-signed logic signature. If multisig is not found then new multisig is created eg. appending own signature to a signed lsig (received from multisignature account address network)

    Parameters

    • lsig: LogicSig

      Logic Sig object

    • signer: Account
    • Optional mparams: MultisigMetadata

    Returns LogicSig

    multi signed logic signature (with appended signature using signer's sk)

signMultiSig

  • signMultiSig(signerAccount: Account, rawTxn: Uint8Array): TxSig
  • Signs a raw multi-sig transaction object

    Parameters

    • signerAccount: Account
    • rawTxn: Uint8Array

    Returns TxSig

    signed transaction object

Generated using TypeDoc