import type { Arguments, CommandBuilder } from "yargs"; import * as anchor from "@project-serum/anchor"; import fs from "fs"; import { Keypair, LAMPORTS_PER_SOL, Transaction } from "@solana/web3.js"; import { Rain } from "@rainfi/rain"; export const command = "get_pool_from_owner_address"; export const desc = "Get pool from owner address"; type Options = { details?: string keypair:string publicKey:string network: string } export const builder: CommandBuilder = (yargs) => { return yargs .options({ 'details': { describe: 'Show details', default: 0, demandOption: false }, 'publicKey': { alias: 'publicKey', describe: 'The public key address to get the pool from owner address', demandOption: true, }, 'k': { alias: 'keypair', describe: 'Keypair used to send/sign the transaction', demandOption: true, default: `${process.env.HOME}/.config/solana/id.json` }, 'n': { alias: 'network', describe: 'Network to use', default: 'https://api.mainnet-beta.solana.com', demandOption: false } }) } export const handler = async (argv: Arguments): Promise => { const { publicKey, network } = argv const connection = new anchor.web3.Connection(network); const rain = new Rain() console.log("[i] - Using RPC:", network); console.log("[i] - Using program:", rain.PUBKEY.toBase58()); console.log("[i] - Get Pools from owner address : ", publicKey); const pool = await rain.utils.getPoolFromOwnerAddress(connection, publicKey.toString()) console.log(pool) };