Umi's Interfaces
The core interfaces
Umi defines a set of core interfaces that makes it easy to interact with the Solana blockchain. Namely, they are:
Signer
: An interface representing a wallet that can sign transactions and messages.EddsaInterface
: An interface to create keypairs, find PDAs and sign/verify messages using the EdDSA algorithm.RpcInterface
: An interface representing a Solana RPC client.TransactionFactoryInterface
: An interface allowing us to create and serialize transactions.UploaderInterface
: An interface allowing us to upload files and get a URI to access them.DownloaderInterface
: An interface allowing us to download files from a given URI.HttpInterface
: An interface allowing us to send HTTP requests.ProgramRepositoryInterface
: An interface for registering and retrieving programs.
The Context interface
The interfaces above are all defined in a Context
interface that can be used to inject them in your code. The Context
type is defined as follows:
As you can see the Signer
interface is used twice in the context:
Once for the
identity
which is the signer using your app.Once for the
payer
which is the signer paying for things like transaction fees and storage fees. Usually this will be the same signer as theidentity
but separating them offers more flexibility for apps – e.g. in case they wish to abstract some costs from their users to improve the user experience.
The Umi interface
The Umi
interface is built on top of this Context
interface and simply adds a use
method which enables end-users to register plugins. It is defined as follows:
Therefore, end-users can add plugins to their Umi
instance like so:
Last updated