A client to make calls to the Lodash smart contract

Constructors

  • Creates a new instance of LodashClient

    Parameters

    • appClient: AppClient

      An AppClient instance which has been created with the Lodash app spec

    Returns LodashClient

  • Creates a new instance of LodashClient

    Parameters

    • params: Omit<AppClientParams, "appSpec">

      The parameters to initialise the app client with

    Returns LodashClient

Properties

appClient: AppClient

The underlying AppClient for when you want to have more flexibility

createTransaction: {
    clearState: (
        params?: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args?: Uint8Array<ArrayBufferLike>[];
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        },
    ) => Promise<Transaction>;
    get: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string] | { path: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & { onComplete?: NoOpOC },
    ) => Promise<
        {
            methodCalls: Map<number, ABIMethod>;
            signers: Map<number, TransactionSigner>;
            transactions: Transaction[];
        },
    >;
    set: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string, value: string] | { path: string; value: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & { onComplete?: NoOpOC },
    ) => Promise<
        {
            methodCalls: Map<number, ABIMethod>;
            signers: Map<number, TransactionSigner>;
            transactions: Transaction[];
        },
    >;
} = ...

Create transactions for the current app

Type declaration

  • clearState: (
        params?: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args?: Uint8Array<ArrayBufferLike>[];
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        },
    ) => Promise<Transaction>

    Makes a clear_state call to an existing instance of the Lodash smart contract.

  • get: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string] | { path: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & { onComplete?: NoOpOC },
    ) => Promise<
        {
            methodCalls: Map<number, ABIMethod>;
            signers: Map<number, TransactionSigner>;
            transactions: Transaction[];
        },
    >

    Makes a call to the Lodash smart contract using the get(string)string ABI method.

  • set: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string, value: string] | { path: string; value: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & { onComplete?: NoOpOC },
    ) => Promise<
        {
            methodCalls: Map<number, ABIMethod>;
            signers: Map<number, TransactionSigner>;
            transactions: Transaction[];
        },
    >

    Makes a call to the Lodash smart contract using the set(string,string)void ABI method.

params: {
    clearState: (
        params?: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args?: Uint8Array<ArrayBufferLike>[];
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        },
    ) => AppCallParams;
    get: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string] | { path: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & { onComplete?: NoOpOC },
    ) => Promise<AppCallMethodCall>;
    set: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string, value: string] | { path: string; value: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & { onComplete?: NoOpOC },
    ) => Promise<AppCallMethodCall>;
} = ...

Get parameters to create transactions for the current app. A good mental model for this is that these parameters represent a deferred transaction creation.

Type declaration

  • clearState: (
        params?: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args?: Uint8Array<ArrayBufferLike>[];
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        },
    ) => AppCallParams

    Makes a clear_state call to an existing instance of the Lodash smart contract.

  • get: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string] | { path: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & { onComplete?: NoOpOC },
    ) => Promise<AppCallMethodCall>

    Makes a call to the Lodash smart contract using the get(string)string ABI method.

  • set: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string, value: string] | { path: string; value: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & { onComplete?: NoOpOC },
    ) => Promise<AppCallMethodCall>

    Makes a call to the Lodash smart contract using the set(string,string)void ABI method.

send: {
    clearState: (
        params?: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args?: Uint8Array<ArrayBufferLike>[];
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            coverAppCallInnerTransactionFees?: boolean;
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            maxRoundsToWaitForConfirmation?: number;
            note?: string | Uint8Array<ArrayBufferLike>;
            populateAppCallResources?: boolean;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            suppressLog?: boolean;
            validityWindow?: number | bigint;
        },
    ) => Promise<
        {
            confirmation: PendingTransactionResponse;
            confirmations: PendingTransactionResponse[];
            groupId: string;
            return?: ABIReturn;
            returns?: ABIReturn[];
            transaction: Transaction;
            transactions: Transaction[];
            txIds: string[];
        },
    >;
    get: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string] | { path: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & SendParams & { onComplete?: NoOpOC },
    ) => Promise<
        {
            confirmation: PendingTransactionResponse;
            confirmations: PendingTransactionResponse[];
            groupId: string;
            return: undefined
            | string;
            returns?: ABIReturn[];
            transaction: Transaction;
            transactions: Transaction[];
            txIds: string[];
        },
    >;
    set: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string, value: string] | { path: string; value: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & SendParams & { onComplete?: NoOpOC },
    ) => Promise<
        {
            confirmation: PendingTransactionResponse;
            confirmations: PendingTransactionResponse[];
            groupId: string;
            return: undefined
            | void;
            returns?: ABIReturn[];
            transaction: Transaction;
            transactions: Transaction[];
            txIds: string[];
        },
    >;
} = ...

Send calls to the current app

Type declaration

  • clearState: (
        params?: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args?: Uint8Array<ArrayBufferLike>[];
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            coverAppCallInnerTransactionFees?: boolean;
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            maxRoundsToWaitForConfirmation?: number;
            note?: string | Uint8Array<ArrayBufferLike>;
            populateAppCallResources?: boolean;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            suppressLog?: boolean;
            validityWindow?: number | bigint;
        },
    ) => Promise<
        {
            confirmation: PendingTransactionResponse;
            confirmations: PendingTransactionResponse[];
            groupId: string;
            return?: ABIReturn;
            returns?: ABIReturn[];
            transaction: Transaction;
            transactions: Transaction[];
            txIds: string[];
        },
    >

    Makes a clear_state call to an existing instance of the Lodash smart contract.

  • get: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string] | { path: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & SendParams & { onComplete?: NoOpOC },
    ) => Promise<
        {
            confirmation: PendingTransactionResponse;
            confirmations: PendingTransactionResponse[];
            groupId: string;
            return: undefined
            | string;
            returns?: ABIReturn[];
            transaction: Transaction;
            transactions: Transaction[];
            txIds: string[];
        },
    >

    Makes a call to the Lodash smart contract using the get(string)string ABI method.

  • set: (
        params: {
            accountReferences?: (string | Address)[];
            appReferences?: bigint[];
            args: [path: string, value: string] | { path: string; value: string };
            assetReferences?: bigint[];
            boxReferences?: (BoxReference | BoxIdentifier)[];
            extraFee?: AlgoAmount;
            firstValidRound?: bigint;
            lastValidRound?: bigint;
            lease?: string | Uint8Array<ArrayBufferLike>;
            maxFee?: AlgoAmount;
            note?: string | Uint8Array<ArrayBufferLike>;
            rekeyTo?: string | Address;
            sender?: string | Address;
            signer?: TransactionSigner | TransactionSignerAccount;
            staticFee?: AlgoAmount;
            validityWindow?: number | bigint;
        } & SendParams & { onComplete?: NoOpOC },
    ) => Promise<
        {
            confirmation: PendingTransactionResponse;
            confirmations: PendingTransactionResponse[];
            groupId: string;
            return: undefined
            | void;
            returns?: ABIReturn[];
            transaction: Transaction;
            transactions: Transaction[];
            txIds: string[];
        },
    >

    Makes a call to the Lodash smart contract using the set(string,string)void ABI method.

state: {} = {}

Methods to access state for the current Lodash app

Accessors

  • get algorand(): AlgorandClientInterface

    A reference to the underlying AlgorandClient this app client is using.

    Returns AlgorandClientInterface

  • get appAddress(): Address

    The app address of the app instance this client is linked to.

    Returns Address

  • get appId(): bigint

    The ID of the app instance this client is linked to.

    Returns bigint

  • get appName(): string

    The name of the app.

    Returns string

  • get appSpec(): Arc56Contract

    The ARC-56 app spec being used

    Returns Arc56Contract

Methods

  • Clone this app client with different params

    Parameters

    • params: {
          appId?: bigint;
          appName?: string;
          approvalSourceMap?: ProgramSourceMap;
          clearSourceMap?: ProgramSourceMap;
          defaultSender?: string | Address;
          defaultSigner?: TransactionSigner;
      }

      The params to use for the the cloned app client. Omit a param to keep the original value. Set a param to override the original value. Setting to undefined will clear the original value.

      • OptionalappId?: bigint

        The ID of the app instance this client should make calls against.

      • OptionalappName?: string

        Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name

      • OptionalapprovalSourceMap?: ProgramSourceMap

        Optional source map for the approval program

      • OptionalclearSourceMap?: ProgramSourceMap

        Optional source map for the clear state program

      • OptionaldefaultSender?: string | Address

        Optional address to use for the account to use as the default sender for calls.

      • OptionaldefaultSigner?: TransactionSigner

        Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).

    Returns LodashClient

    A new app client with the altered params

  • Checks for decode errors on the given return value and maps the return value to the return type for the given method

    Type Parameters

    • TSignature extends "get" | "get(string)string"

    Parameters

    • method: TSignature
    • returnValue: undefined | ABIReturn

    Returns undefined | MethodReturn<TSignature>

    The typed return value or undefined if there was no value

  • Returns a new LodashClient client, resolving the app by creator address and name using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).

    Parameters

    • params: Omit<
          {
              algorand: AlgorandClientInterface;
              appLookupCache?: AppLookup;
              appName?: string;
              approvalSourceMap?: ProgramSourceMap;
              appSpec: string
              | Arc56Contract
              | AppSpec;
              clearSourceMap?: ProgramSourceMap;
              creatorAddress: string | Address;
              defaultSender?: string | Address;
              defaultSigner?: TransactionSigner;
              ignoreCache?: boolean;
          },
          "appSpec",
      >

      The parameters to create the app client

    Returns Promise<LodashClient>

  • Returns an LodashClient instance for the current network based on pre-determined network-specific app IDs specified in the ARC-56 app spec.

    If no IDs are in the app spec or the network isn't recognised, an error is thrown.

    Parameters

    • params: Omit<
          {
              algorand: AlgorandClientInterface;
              appName?: string;
              approvalSourceMap?: ProgramSourceMap;
              appSpec: string
              | Arc56Contract
              | AppSpec;
              clearSourceMap?: ProgramSourceMap;
              defaultSender?: string | Address;
              defaultSigner?: TransactionSigner;
          },
          "appSpec",
      >

      The parameters to create the app client

    Returns Promise<LodashClient>