SDK Quick Start
Documentation for using the TypeScript Valist software development kit.
Welcome to Valist’s TypeScript SDK v2. It helps developers interact with Valist’s Registry smart contracts, protocols like IPFS, The Graph, OpenGSN, and more, in an easy to use interface.

Getting Started

The SDK is written in TypeScript and is meant to simplify interaction with Valist in a Javascript based environment. It is compatible with both Node.js and Browser environments!

Overview

The SDK is broken into two components,
  1. 1.
    Client : An exported class used to interact with the contracts and registry to manage projects and accounts.
    • This connects to the Polygon network and corresponding contract addresses, as well as gasless meta-transactions powered by OpenGSN.
    • This also connects to IPFS, and handles automatic storage functionality when publishing content.
  2. 2.
    Types/interface: Exported interfaces for metadata associated with Accounts, Projects and Releases.
Everything is abstracted into a clean interface, and all you need to get started is a Wallet/Web3 Provider! You can also customize the infrastructure (RPC, IPFS, Subgraph, etc) the SDK connects with. By default it uses the valist.io managed infrastructure, but you can swap out every component for your own!

Installation

To start using the SDK, simply install it into your project...
1
npm install @valist/valist-sdk
Copied!
Then, you can import the create function to create a Valist client!
1
import { create } from "@valist/valist-sdk"
Copied!
If there are other functions with the same name (i.e., IPFS client library), you can import it like this instead:
1
import { create as createValist } from "@valist/valist-sdk"
Copied!
Below is an example of creating a Valist Client and fetching some Project and Release metadata:
1
// Example
2
const ethers = require('ethers');
3
const create = require('@valist/sdk').create;
4
const Web3HttpProvider = require('web3-providers-http');
5
​
6
async function main() {
7
try {
8
const web3 = new Web3HttpProvider("https://rpc.valist.io/polygon");
9
10
const privateKey = ethers.Wallet.createRandom();
11
const wallet = new ethers.Wallet(privateKey);
12
13
const provider = new ethers.providers.Web3Provider(web3);
14
const valist = await create(provider, { wallet, metaTx: true });
15
16
const accountID = valist.generateID(137, 'acme-co');
17
const projectID = valist.generateID(accountID, 'go-binary')
18
const releaseID = await valist.getLatestReleaseID(projectID)
19
20
const projectMeta = await valist.getProjectMeta(projectID);
21
const latestRelease = await valist.getReleaseMeta(releaseID);
22
23
console.log(projectMeta);
24
console.log(latestRelease);
25
} catch (err) {
26
console.log(err)
27
}
28
}
29
​
30
main()
Copied!
Here's a live example:

TypeDoc

To view the TypeDoc for the Valist TypeScript SDK, navigate to the following site:
@valist/sdk
Export as PDF
Copy link