// Loads the local .env file into `process.env`.
require("dotenv").config();
import { Connection, Keypair } from "@solana/web3.js";
import { Client, Exchange, Network, Wallet, utils, types} from "@zetamarkets/sdk";
import fetch from "node-fetch";
// Loads the private key in .env
const privateKey = Keypair.fromSecretKey(
new Uint8Array(JSON.parse(Buffer.from(process.env.private_key).toString()))
const wallet = new Wallet(privateKey);
// Starts a solana web3 connection to an RPC endpoint
const connection = new Connection(networkUrl, utils.defaultCommitment());
// Airdrop some SOL to your wallet
await connection.requestAirdrop(wallet.publicKey, 100000000);
// USDC faucet - Mint $10,000 USDC (Note USDC is fake on devnet)
await fetch(`${SERVER_URL}/faucet/USDC`, {
key: wallet.publicKey.toString(),
headers: { "Content-Type": "application/json" },
// Loads the SDK exchange singleton. This can take up to 10 seconds...
utils.defaultCommitment(),
undefined, // Exchange wallet can be ignored for normal clients.
0 // ThrottleMs - increase if you are running into rate limit issues on startup.
undefined, // Callback - See below for more details.