Skip to main content
Install the RWA SDK from npm and set up your project.

Set up TS ENV

1. New Project

2. Install packages

3. Add a TypeScript config

Add the following into the file:

4. Update scripts in package.json.

The src/index.ts is the executable file.

5. Create source file

Set up JS ENV

1. Initialize node env

2. Install packages

3. Create source file

Execute

For both TS/JS environments your next steps are

Create .env file

Next we will create the .env file where we store VARIABLES_LIKE_THIS. Make sure you add the corresponding variables named in the sdk code into this same file. We also add a gitignore to make sure you don’t accidently post secrets.
Add to .env: If you would like to be able to follow the full example walkthrough, please define your .env as:
Add to .gitignore:

TS Execution

Copy one of the examples with the proper authority into src/index.ts for execution and run with:

JS Execution

Copy one of the examples with the proper authority into src/index.js for execution and run with:

new RWA(opts)

Initialize the peaq RWA SDK for a specific chain. The instance wires module addresses for that chain and exposes module entry points. A Provider is required at initialization and is used for read operations; write operations require an explicit Signer.

Parameters

Usage

TypeScript

ESM JavaScript

Default setup in JS guide with "type": "module", set via cmd: npm pkg set type=module

Common JavaScript

Optional setup to use cjs. Remove "type": "module", from your package.json.