๐Ÿ”ฎMedici SDK Quickstart

You are ready to get started! Below is the basic flow for setting up an RWA Client and minting new tokens using Medici.

Install Package

Step 1: Install Medici

yarn add @bridgesplit/rwa-token-sdk

Initialize RWA Client

Step 2: Begin by importing the RWA client, and instantiating it with its respective parameters.

const connectionUrl = process.env.RPC_URL ?? 'http://localhost:8899';
const connection = new Connection(connectionUrl);

const confirmationOptions: ConfirmOptions = {
	skipPreflight: false,
	maxRetries: 3,
	commitment: 'processed'
}

const config: Config = {
	connection: connection,
	rpcUrl: connectionUrl,
	confirmationOptions: confirmationOptions
}

/* Setup: payerKp, is just the keypair who will pay for the tx. */
const rwaClient = new RwaClient(config, new Wallet(setup.payerKp))

Initialize an Asset Controller

Step 3: Initialize an asset controller on chain.

Setup Data Registry

Step 4: Create the data registry account.

Attach a Policy

Step 5: Use the policy engine to attach policies to the asset.

Setup the First User

Step 6: Setup the first user (developer wallet). This user will hold all the issuance tokens.

Issue Tokens

Step 7: Issue tokens to owner address.

Transfer Tokens

Step 8: Transfer tokens.

Revoke Tokens

Step 9 (optional): Revoke tokens.

These are only 7 of the many functions available with the SDK. For an exhaustive list, please see the SDK.

Last updated