Set up TS ENV
1. New Project
2. Install packages
3. Add a TypeScript config
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 areCreate .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.
.env:
If you would like to be able to follow the full example walkthrough, please define your .env as:
.gitignore:
TS Execution
Copy one of the examples with the proper authority intosrc/index.ts for execution and run with:
JS Execution
Copy one of the examples with the proper authority intosrc/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
| Parameter | Type | Required | Description |
|---|---|---|---|
| chainId | Chain | Required | The Implementation Target network. Chain.AGUNG (9990) or Chain.PEAQ (3338). |
| provider | Provider | Required | An ethers Provider used for read-only calls across modules. |
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.

