Skip to main content

AS-SDK

AS-SDK is a software development kit designed specifically for Massa smart contracts written in AssemblyScript. It provides a set of functions and objects that wrap the ABIs exposed by the node.

It includes several namespaces, each containing functions and objects that provide specific functionalities:

Coins

The Coins namespace includes functions for interacting with wallet balances and transfers. For more information on this namespace, see the AS-SDK Coins documentation.

Context

The Context namespace includes functions to interact with the execution context of a smart contract on the Massa blockchain. This namespace is particularly useful to retrieve information about the current state of a smart contract, such as the caller and callee of the current contract, the call stack, the amount of transferred coins, the remaining gas, and the timestamp. For more information on this namespace, see the AS-SDK Context documentation.

Contract

The Contract namespace includes functions to interact with other smart contract functions and manipulate their bytecode. This namespace is particularly useful to create new smart contracts and send messages to existing ones. For more information on this namespace, see the AS-SDK Contract documentation.

OpDatastore

The OpDatastore namespace includes functions to interact with the operation datastore. This key/value storage can be filled by the operation creator and then used by the smart contract being executed. This namespace is particularly useful to read the data that is passed with the bytecode in an execute smart contract operation. For more information on this namespace, see the AS-SDK OpDatastore documentation.

Storage

The Storage namespace includes functions to interact with the key-value datastore. This namespace is particularly useful to read and write data that is expected to persist between contract executions, such as contract state or user information. For more information on this namespace, see the AS-SDK Storage documentation.

Utilities

The Utilities namespace includes various utility functions, such as event generation, base58 encoding and decoding, and public key to address conversion. For more information on this namespace, see the AS-SDK Utilities documentation.