Skip to content

upsideos/solana-rwa-approve-and-transfer-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Approve and Transfer script for SPL 2022 tokens

This script demonstrates a simple flow:

  • Investor approves a delegate (third party) to spend tokens from their token account.
  • Third party performs a transfer using the transfer hook instruction.

Setup

  1. Copy .env.example to .env and fill the values (mint address, program ids, RPC_URL, token account addresses or leave blank to derive associated addresses).
  2. Place JSON keypair files in the same directory: investor-keypair.json and third-party-keypair.json (each file contains the secret key array produced by Keypair.toSecretKey() / fs.writeFileSync(..., JSON.stringify([...secretKey]))).
  3. Install dependencies:
npm install

Run

npm start

Notes

  • This script assumes holder/group/holdergroup/security-associated accounts and transfer rule exist on-chain for the token. It only performs approve + delegated transfer.
  • Replace placeholder key files with real secret key arrays. Do not commit real secrets to source control.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors