Blockchain Actions
Blockchain Actions correspond to the definition of the functions to be executed in the mini-app. Using the BlockchainActionMetadata or BlockchainAction interface, properties such as contractAddress, contractABI, functionName and chainId 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.
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.
As its name says, it will be the action to be executed, which translates into the call to a function of a smart contract according to the given definition. The word Metadata has been added to differentiate that this interface is used in the Metadata definition process.
Each action will culminate in a button and inputs according to the definition of the function to be executed.
The interface can be imported as follows
The definition of the properties is as follows
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.).
For a correct validation and definition we are using the types ABIType .
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.