gaya-re-wamp
v1.0.1
Published
Scalable NestJS TypeScript SDK boilerplate
Readme
Gaya RE WAMP SDK
A lightweight TypeScript SDK exposing simple, ready-to-use functions for wallet utilities, PnL aggregation, and Solana swap helpers.
Install
npm install gaya-re-wampRequirements: Node.js 18+.
Importing
ESM:
import {
createWallet,
importWallet,
addAccount,
getPnL,
getSolanaUrls,
submitQuote,
confirmTransaction,
} from 'gaya-re-wamp';CommonJS:
const {
createWallet,
importWallet,
addAccount,
getPnL,
getSolanaUrls,
submitQuote,
confirmTransaction,
} = require('gaya-re-wamp');Exports & Usage (overview)
Wallet
- createWallet(mnemonic?) → Promise<{ mnemonic; wallets; responseTimeMs }>
- Generate a new mnemonic (if omitted) and first accounts for supported chains.
- importWallet(chainId, privateKey) → ImportWalletResponse
- Import an account by private key/seed. chainId: 'ethereum' | 'bsc' | 'solana' | 'arbitrum' | 'avalanche' | 'base' or EVM numeric id.
- addAccount(chainId, index, mnemonic) → Promise
- Derive another account (by index) for the specified chain from the mnemonic.
Minimal usage:
const created = await createWallet();
const eth1 = await addAccount('ethereum', 1, created.mnemonic);
const importedSol = importWallet('solana', '<32-byte-hex-seed>');PnL
- getPnL(input, options?) → Promise
- input: { ethAddress?, bscAddress?, solAddress?, refresh? }
- options: { birdeyeApiKey?, redis?, tokenProvider?, alchemyAssetsEndpointUrl? }
Minimal usage:
const pnl = await getPnL({ ethAddress: '<evm-addr>', solAddress: '<sol-addr>' }, {
birdeyeApiKey: process.env.BIRDEYE_API_KEY,
});Solana Swap
- getSolanaUrls() → { rpcUrl; endpointUrl }
- submitQuote(params, connection) → Promise<{ signature; status; message }>
- confirmTransaction({ signature }, connection) → Promise<{ signature; status; message }>
Minimal usage:
import { Connection } from '@solana/web3.js';
const { rpcUrl } = getSolanaUrls();
const connection = new Connection(rpcUrl);
const quote = await submitQuote({ /* inputToken, outputToken, amount, slippage, walletAddress, secretKey */ }, connection);
const confirmation = await confirmTransaction({ signature: quote.signature }, connection);This README focuses on import and usage.
