Quick Start
Actions

Blockchain Actions

6min

Introduction

Blockchain Actions correspond to the definition of the functions to be executed in the mini-app. Using the BlockchainActionMetadata orBlockchainAction interface, properties such as address, abi, functionName and chain must be defined. The SDK has been designed in a way that gives developers the flexibility to execute any function, any smart contract and even any supported chain through the metadata definition.

Interfaces

The use of interfaces for Blockchain Actions is also crucial, since these define each of the functions that will be executed, and a bad definition of these could lead to an error in the transaction, either due to an error in the name of the function, a mistyped parameter, etc.

By using these interfaces and the createMetadata function we minimize these failures, since as long as the ABI and the address of the contract you want to execute are correct, we have your back with the types and the createMetadata function to avoid any errors when typing.

In this section, we introduce one of the two primary types of actions that developers can use to create interactive Sherry Links: Blockchain Actions and Transfer Actions . Each type serves a distinct purpose and offers flexibility in how users can interact with smart contracts through Sherry Links.

BlockchainAction

The only difference between BlockchainAction and BlockchainActionMetadata is that the latter is used in the definition process as mentioned above, and the former is used as a result of the validation process.

If we check the properties we see that it extends BlockchainActionMetadata and has two other properties transactionParameters and blockchainActionType. These are responsible for identifying the number and types of parameters to be used to interact with the function and the type of function (view, payable, etc.).

BlockchainActionMetadata

The BlockchainActionMetadata interface contains the following properties and can be used to define the action to be performed according to your preferences.

For a correct validation and definition we are using the types ABIType .

TypeScript


You can import it into your project as follows

TypeScript


You can also import BlockchainAction and define your metadata but it is more technically complex.

We recommend using the BlockchainActionMetadata interface and once you have everything defined, use the createMetadata function, you can learn more how to use it in Validating Metadata and a complete example in Guides .

TypeScript


Explanation

The BlockchainAction interface extends BlockchainActionMetadata and has two additional properties that transactionParameters and blockchainActionType will be populated by the createMetadata function. Although you can also use the interface and assign the values to it manually.

TypeScript