UNPKG

@cryptoscan/orca-sdk

Version:

The fastest and easiest way to trade on Orca.

27 lines (26 loc) 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const solana_wallet_sdk_1 = require("@cryptoscan/solana-wallet-sdk"); const OrcaApi_js_1 = require("../OrcaApi.js"); const web3_js_1 = require("@solana/web3.js"); const vitest_1 = require("vitest"); (0, vitest_1.describe)('Test buy', () => { (0, vitest_1.test)('Should buy', async () => { const api = new OrcaApi_js_1.OrcaApi({ connection: new web3_js_1.Connection(process.env.CONNECTION_URL), }); const coinAddress = process.env.COIN_ADDRESS || 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'; const wallet = (0, solana_wallet_sdk_1.getWallet)(process.env.TEST_SECRET_KEY); console.log('WALLET:', wallet.publicKey.toString()); const tx = await api.buy({ wallet, coinAddress, sol: 0.05, fee: 0.0001, // priorityFee: 0.00001, }); console.log('TX:', tx); (0, vitest_1.expect)(typeof tx === 'string').toBe(true); (0, vitest_1.expect)(!!tx).toBe(true); }, 60_000); });