😎SDK Reference
Integrating into your front-end
Installation
You can install the @denota-labs/denota-sdk package with the following command:
Quickstart
The setProvider
function initializes the library's internal state by setting up the provider, signer, account, and other necessary contracts for executing transactions. It also retrieves the corresponding contract addresses based on the chain ID. This function must be called before performing any transactions to ensure a smooth and seamless experience.
The function accepts an ethers.Signer
and chainId
as its input parameters, providing flexibility for developers.
Before sending funds, use the approveToken
function to approve a token for use in writing notas.
Interacting with Notas
Write
The write
function is used to create a nota based on the provided module data.
Metadata can be attached in two forms. If the metadata has already been uploaded to IFPS, it can be attached to the nota:
If the metadata hasn't been uploaded yet, it can be uploaded through the SDK:
Fund
The fund
function is used to fund a nota based on the nota ID.
Usage:
Cash
The cash
function is used to move a payment out of escrow based on the nota ID and the action type ("reversal" or "release").
Transfer
[Coming soon]
Approve
[Coming soon]
Querying Notas
Denota Protocol provides a subgraph to query nota data using the Graph Protocol. To access Nota data, you can use the getNotasQueryURL()
function to get the query URL and a GraphQL library like Apollo Client to perform the queries.
Setup
To get started, set up the Apollo Client in your project:
Sample Query
Here's a sample query that fetches notas for a given account:
This query retrieves the following data:
id
: Nota IDamount
: Nota amounttimestamp
: Nota creation timestampstatus
: Nota statusuri
: Nota URIerc20
: Token information for the nota currencysender
: Sender's Ethereum addressreceiver
: Receiver's Ethereum address
Replace 0x...
with the Ethereum address of the account you want to fetch notas for.
Exploring the Schema
To explore the full schema and test queries, use the GraphiQL playground at the following URL:
[Coming Soon]
This playground allows you to explore the available types, fields, and relationships in the Denota subgraph and test your queries before integrating them into your application.
Last updated