types/app-arc56
@algorandfoundation/algokit-utils / types/app-arc56
Table of contents
Classes
Interfaces
Type Aliases
- ABIStruct
- ABIType
- AVMBytes
- AVMString
- AVMType
- AVMUint64
- Arc56MethodArg
- Arc56MethodReturnType
- StructName
Functions
- getABIDecodedValue
- getABIEncodedValue
- getABIStructFromABITuple
- getABITupleFromABIStruct
- getABITupleTypeFromABIStructDefinition
- getArc56Method
- getArc56ReturnValue
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
ABIType
Ƭ ABIType: string
An ABI-encoded type
Defined in
AVMBytes
Ƭ AVMBytes: "AVMBytes"
Raw byteslice without the length prefixed that is specified in ARC-4
Defined in
AVMString
Ƭ AVMString: "AVMString"
A utf-8 string without the length prefix that is specified in ARC-4
Defined in
AVMType
Ƭ AVMType: AVMBytes
| AVMString
| AVMUint64
A native AVM type
Defined in
AVMUint64
Ƭ AVMUint64: "AVMUint64"
A 64-bit unsigned integer
Defined in
Arc56MethodArg
Ƭ Arc56MethodArg: Expand
<Omit
<Method
["args"
][number
], "type"
> & { type
: algosdk.ABIArgumentType
}>
Type to describe an argument within an Arc56Method
.
Defined in
Arc56MethodReturnType
Ƭ Arc56MethodReturnType: Expand
<Omit
<Method
["returns"
], "type"
> & { type
: algosdk.ABIReturnType
}>
Type to describe a return type within an Arc56Method
.
Defined in
StructName
Ƭ StructName: string
The name of a defined struct
Defined in
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
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
algosdk.ABIValue
| ABIStruct
The decoded ABI value or struct
Defined in
getABIEncodedValue
▸ getABIEncodedValue(value
, type
, structs
): Uint8Array
Returns the ABI-encoded value for the given value.
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
Uint8Array
The binary ABI-encoded value
Defined in
getABIStructFromABITuple
▸ getABIStructFromABITuple<TReturn
>(decodedABITuple
, structFields
, structs
): TReturn
Converts a decoded ABI tuple as a struct.
Type parameters
Name | Type |
---|---|
TReturn | extends ABIStruct = Record <string , any > |
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
TReturn
The struct as a Record<string, any>
Defined in
getABITupleFromABIStruct
▸ getABITupleFromABIStruct(struct
, structFields
, structs
): algosdk.ABIValue
[]
Converts an ARC-56 struct as an ABI tuple.
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
algosdk.ABIValue
[]
The struct as a decoded ABI tuple
Defined in
getABITupleTypeFromABIStructDefinition
▸ getABITupleTypeFromABIStructDefinition(struct
, structs
): algosdk.ABITupleType
Returns the ABITupleType
for the given ARC-56 struct definition
Parameters
Name | Type | Description |
---|---|---|
struct | StructField [] | The ARC-56 struct definition |
structs | Record <string , StructField []> | - |
Returns
algosdk.ABITupleType
The ABITupleType
Defined in
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
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
The Arc56Method
Defined in
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
Name | Type |
---|---|
TReturn | extends undefined | ABIValue | ABIStruct |
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
TReturn
The smart contract response with an updated return value