types/app-arc56
@algorandfoundation/algokit-utils / types/app-arc56
Table of contents
Section titled “Table of contents”Classes
Section titled “Classes”Interfaces
Section titled “Interfaces”Type Aliases
Section titled “Type Aliases”- ABIStruct
- ABIType
- AVMBytes
- AVMString
- AVMType
- AVMUint64
- Arc56MethodArg
- Arc56MethodReturnType
- StructName
Functions
Section titled “Functions”- getABIDecodedValue
- getABIEncodedValue
- getABIStructFromABITuple
- getABITupleFromABIStruct
- getABITupleTypeFromABIStructDefinition
- getArc56Method
- getArc56ReturnValue
Type Aliases
Section titled “Type Aliases”ABIStruct
Section titled “ABIStruct”Ƭ ABIStruct: Object
Decoded ARC-56 struct as a struct rather than a tuple.
Index signature
Section titled “Index signature”▪ [key: string]: ABIStruct | algosdk.ABIValue
Defined in
Section titled “Defined in”ABIType
Section titled “ABIType”Ƭ ABIType: string
An ABI-encoded type
Defined in
Section titled “Defined in”AVMBytes
Section titled “AVMBytes”Ƭ AVMBytes: "AVMBytes"
Raw byteslice without the length prefixed that is specified in ARC-4
Defined in
Section titled “Defined in”AVMString
Section titled “AVMString”Ƭ AVMString: "AVMString"
A utf-8 string without the length prefix that is specified in ARC-4
Defined in
Section titled “Defined in”AVMType
Section titled “AVMType”Ƭ AVMType: AVMBytes | AVMString | AVMUint64
A native AVM type
Defined in
Section titled “Defined in”AVMUint64
Section titled “AVMUint64”Ƭ AVMUint64: "AVMUint64"
A 64-bit unsigned integer
Defined in
Section titled “Defined in”Arc56MethodArg
Section titled “Arc56MethodArg”Ƭ Arc56MethodArg: Expand<Omit<Method["args"][number], "type"> & { type: algosdk.ABIArgumentType }>
Type to describe an argument within an Arc56Method.
Defined in
Section titled “Defined in”Arc56MethodReturnType
Section titled “Arc56MethodReturnType”Ƭ Arc56MethodReturnType: Expand<Omit<Method["returns"], "type"> & { type: algosdk.ABIReturnType }>
Type to describe a return type within an Arc56Method.
Defined in
Section titled “Defined in”StructName
Section titled “StructName”Ƭ StructName: string
The name of a defined struct
Defined in
Section titled “Defined in”Functions
Section titled “Functions”getABIDecodedValue
Section titled “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
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
value | number | bigint | Uint8Array | The raw Algorand value (bytes or uint64) |
type | string | The ARC-56 type - either an ABI Type string or a struct name |
structs | Record<string, StructField[]> | The defined ARC-56 structs |
Returns
Section titled “Returns”algosdk.ABIValue | ABIStruct
The decoded ABI value or struct
Defined in
Section titled “Defined in”getABIEncodedValue
Section titled “getABIEncodedValue”▸ getABIEncodedValue(value, type, structs): Uint8Array
Returns the ABI-encoded value for the given value.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
value | ABIValue | ABIStruct | The value to encode either already in encoded binary form (Uint8Array), a decoded ABI value or an ARC-56 struct |
type | string | The ARC-56 type - either an ABI Type string or a struct name |
structs | Record<string, StructField[]> | The defined ARC-56 structs |
Returns
Section titled “Returns”Uint8Array
The binary ABI-encoded value
Defined in
Section titled “Defined in”getABIStructFromABITuple
Section titled “getABIStructFromABITuple”▸ getABIStructFromABITuple<TReturn>(decodedABITuple, structFields, structs): TReturn
Converts a decoded ABI tuple as a struct.
Type parameters
Section titled “Type parameters”| Name | Type |
|---|---|
TReturn | extends ABIStruct = Record<string, any> |
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
decodedABITuple | ABIValue[] | The decoded ABI tuple value |
structFields | StructField[] | The struct fields from an ARC-56 app spec |
structs | Record<string, StructField[]> | - |
Returns
Section titled “Returns”TReturn
The struct as a Record<string, any>
Defined in
Section titled “Defined in”getABITupleFromABIStruct
Section titled “getABITupleFromABIStruct”▸ getABITupleFromABIStruct(struct, structFields, structs): algosdk.ABIValue[]
Converts an ARC-56 struct as an ABI tuple.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
struct | ABIStruct | The struct to convert |
structFields | StructField[] | The struct fields from an ARC-56 app spec |
structs | Record<string, StructField[]> | - |
Returns
Section titled “Returns”algosdk.ABIValue[]
The struct as a decoded ABI tuple
Defined in
Section titled “Defined in”getABITupleTypeFromABIStructDefinition
Section titled “getABITupleTypeFromABIStructDefinition”▸ getABITupleTypeFromABIStructDefinition(struct, structs): algosdk.ABITupleType
Returns the ABITupleType for the given ARC-56 struct definition
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
struct | StructField[] | The ARC-56 struct definition |
structs | Record<string, StructField[]> | - |
Returns
Section titled “Returns”algosdk.ABITupleType
The ABITupleType
Defined in
Section titled “Defined in”getArc56Method
Section titled “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
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
methodNameOrSignature | string | The method name or method signature to call if an ABI call is being emitted. e.g. my_method or my_method(unit64,string)bytes |
appSpec | Arc56Contract | The app spec for the app |
Returns
Section titled “Returns”The Arc56Method
Defined in
Section titled “Defined in”getArc56ReturnValue
Section titled “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
Section titled “Type parameters”| Name | Type |
|---|---|
TReturn | extends undefined | ABIValue | ABIStruct |
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
returnValue | undefined | ABIReturn | The smart contract response |
method | Method | Arc56Method | The method that was called |
structs | Record<string, StructField[]> | The struct fields from the app spec |
Returns
Section titled “Returns”TReturn
The smart contract response with an updated return value