Options
All
  • Public
  • Public/Protected
  • All
Menu

@algo-builder/algob

Index

Variables

Const ERRORS

ERRORS: {[ category in keyof typeof ERROR_RANGES]: {} }

Const globalZeroAddress

globalZeroAddress: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ" = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ"

Functions

KMDCredentialsFromEnv

algodCredentialsFromEnv

balanceOf

  • balanceOf(deployer: Deployer, accountAddress: AccountAddress, assetID: number): Promise<modelsv2.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<modelsv2.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

  • 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<ConfirmedTxInfo>

executeTransaction

getProgram

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

    Parameters

    • fileName: string

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

    • Optional scInitParam: SCParams

      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[]

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

printLocalStateSSC

readAppGlobalState

readAppLocalState

  • 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<Map<Key, StateValue> | undefined>

signLogicSigMultiSig

  • signLogicSigMultiSig(lsigAccount: LogicSigAccount, signer: Account, mparams?: MultisigMetadata): LogicSigAccount
  • 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

    • lsigAccount: LogicSigAccount
    • signer: Account
    • Optional mparams: MultisigMetadata

    Returns LogicSigAccount

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

signMultiSig

  • signMultiSig(signerAccount: Account, rawTxn: Uint8Array, mparams?: MultisigMetadata): { blob: Uint8Array; txID: string }
  • Signs a raw multi-sig transaction object

    Parameters

    • signerAccount: Account

      account(addr, sk) to sign the transaction

    • rawTxn: Uint8Array

      encoded transaction fetched from file in /assets

    • Optional mparams: MultisigMetadata

      multisig metadata. Required if creating a new signed multisig transaction.

    Returns { blob: Uint8Array; txID: string }

    signed transaction object

    • blob: Uint8Array
    • txID: string

signTransactions

  • Signs transaction object(s) and returns raw signed transaction Note: signTransaction is used to sign single transaction and signTransactions takes array of SDK transaction object with signers, signs it.

    Parameters

    Returns Uint8Array[]

Generated using TypeDoc