Skip to content

types/app-arc56

@algorandfoundation/algokit-utils / types/app-arc56

Table of contents

Classes

Interfaces

Type Aliases

Functions

Type Aliases

ABIStruct

Ƭ ABIStruct: Object

Decoded ARC-56 struct as a struct rather than a tuple.

Index signature

▪ [key: string]: ABIStruct | algosdk.ABIValue

Defined in

src/types/app-arc56.ts:122


ABIType

Ƭ ABIType: string

An ABI-encoded type

Defined in

src/types/app-arc56.ts:453


AVMBytes

Ƭ AVMBytes: "AVMBytes"

Raw byteslice without the length prefixed that is specified in ARC-4

Defined in

src/types/app-arc56.ts:459


AVMString

Ƭ AVMString: "AVMString"

A utf-8 string without the length prefix that is specified in ARC-4

Defined in

src/types/app-arc56.ts:462


AVMType

Ƭ AVMType: AVMBytes | AVMString | AVMUint64

A native AVM type

Defined in

src/types/app-arc56.ts:468


AVMUint64

Ƭ AVMUint64: "AVMUint64"

A 64-bit unsigned integer

Defined in

src/types/app-arc56.ts:465


Arc56MethodArg

Ƭ Arc56MethodArg: Expand<Omit<Method["args"][number], "type"> & { type: algosdk.ABIArgumentType }>

Type to describe an argument within an Arc56Method.

Defined in

src/types/app-arc56.ts:7


Arc56MethodReturnType

Ƭ Arc56MethodReturnType: Expand<Omit<Method["returns"], "type"> & { type: algosdk.ABIReturnType }>

Type to describe a return type within an Arc56Method.

Defined in

src/types/app-arc56.ts:14


StructName

Ƭ StructName: string

The name of a defined struct

Defined in

src/types/app-arc56.ts:456

Functions

getABIDecodedValue

getABIDecodedValue(value, type, structs): algosdk.ABIValue | ABIStruct

Returns the decoded ABI value (or struct for a struct type) for the given raw Algorand value given an ARC-56 type and defined ARC-56 structs.

Parameters

NameTypeDescription
valuenumber | bigint | Uint8ArrayThe raw Algorand value (bytes or uint64)
typestringThe ARC-56 type - either an ABI Type string or a struct name
structsRecord<string, StructField[]>The defined ARC-56 structs

Returns

algosdk.ABIValue | ABIStruct

The decoded ABI value or struct

Defined in

src/types/app-arc56.ts:134


getABIEncodedValue

getABIEncodedValue(value, type, structs): Uint8Array

Returns the ABI-encoded value for the given value.

Parameters

NameTypeDescription
valueABIValue | ABIStructThe value to encode either already in encoded binary form (Uint8Array), a decoded ABI value or an ARC-56 struct
typestringThe ARC-56 type - either an ABI Type string or a struct name
structsRecord<string, StructField[]>The defined ARC-56 structs

Returns

Uint8Array

The binary ABI-encoded value

Defined in

src/types/app-arc56.ts:159


getABIStructFromABITuple

getABIStructFromABITuple<TReturn>(decodedABITuple, structFields, structs): TReturn

Converts a decoded ABI tuple as a struct.

Type parameters

NameType
TReturnextends ABIStruct = Record<string, any>

Parameters

NameTypeDescription
decodedABITupleABIValue[]The decoded ABI tuple value
structFieldsStructField[]The struct fields from an ARC-56 app spec
structsRecord<string, StructField[]>-

Returns

TReturn

The struct as a Record<string, any>

Defined in

src/types/app-arc56.ts:71


getABITupleFromABIStruct

getABITupleFromABIStruct(struct, structFields, structs): algosdk.ABIValue[]

Converts an ARC-56 struct as an ABI tuple.

Parameters

NameTypeDescription
structABIStructThe struct to convert
structFieldsStructField[]The struct fields from an ARC-56 app spec
structsRecord<string, StructField[]>-

Returns

algosdk.ABIValue[]

The struct as a decoded ABI tuple

Defined in

src/types/app-arc56.ts:108


getABITupleTypeFromABIStructDefinition

getABITupleTypeFromABIStructDefinition(struct, structs): algosdk.ABITupleType

Returns the ABITupleType for the given ARC-56 struct definition

Parameters

NameTypeDescription
structStructField[]The ARC-56 struct definition
structsRecord<string, StructField[]>-

Returns

algosdk.ABITupleType

The ABITupleType

Defined in

src/types/app-arc56.ts:49


getArc56Method

getArc56Method(methodNameOrSignature, appSpec): Arc56Method

Returns the ARC-56 ABI method object for a given method name or signature and ARC-56 app spec.

Parameters

NameTypeDescription
methodNameOrSignaturestringThe method name or method signature to call if an ABI call is being emitted. e.g. my_method or my_method(unit64,string)bytes
appSpecArc56ContractThe app spec for the app

Returns

Arc56Method

The Arc56Method

Defined in

src/types/app-arc56.ts:189


getArc56ReturnValue

getArc56ReturnValue<TReturn>(returnValue, method, structs): TReturn

Checks for decode errors on the AppCallTransactionResult and maps the return value to the specified generic type

Type parameters

NameType
TReturnextends undefined | ABIValue | ABIStruct

Parameters

NameTypeDescription
returnValueundefined | ABIReturnThe smart contract response
methodMethod | Arc56MethodThe method that was called
structsRecord<string, StructField[]>The struct fields from the app spec

Returns

TReturn

The smart contract response with an updated return value

Defined in

src/types/app-arc56.ts:220