From 06497d29f8edbdd3b0bc6f89095a467b2e1cb122 Mon Sep 17 00:00:00 2001 From: Warren Mira Date: Thu, 28 Dec 2023 10:23:02 +0800 Subject: [PATCH] fix docs for keyPair loading --- source/index.html.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index abcda68..7d9f9ee 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -117,14 +117,15 @@ The connection object is used to send transactions to the Solana blockchain. It ```typescript import {Wallet, loadKeypair} from "@drift-labs/sdk"; -const keyPairFile = '~/.config/solana/my-keypair.json'; +const keyPairFile = `${process.env.HOME}/.config/solana/my-keypair.json`; const wallet = new Wallet(loadKeypair(keyPairFile)); ``` ```python +import os from anchorpy import Wallet from driftpy.keypair import load_keypair -keypair_file = '~/.config/solana/my-keypair.json' +keypair_file = os.path.expanduser('~/.config/solana/my-keypair.json') keypair = load_keypair(keypair_file) wallet = Wallet(kp) ``` @@ -142,7 +143,7 @@ import {Wallet, loadKeypair, DriftClient} from "@drift-labs/sdk"; const connection = new Connection('https://api.mainnet-beta.solana.com'); const keyPairFile = '~/.config/solana/my-keypair.json'; -const wallet = new Wallet(loadKeypair(privateKeyFile)) +const wallet = new Wallet(loadKeypair(keyPairFile)) const driftClient = new DriftClient({ connection,