-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix compile error by moving node-wallet anchor usage into not-exporte…
…d file (#257)
- Loading branch information
1 parent
77bc5b7
commit 67f0e92
Showing
4 changed files
with
24 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Connection, Keypair } from '@solana/web3.js'; | ||
import { OpenBookV2Client } from '..'; | ||
import { AnchorProvider, Wallet } from '@coral-xyz/anchor'; | ||
|
||
export function initReadOnlyOpenbookClient(): OpenBookV2Client { | ||
const conn = new Connection(process.env.SOL_RPC_URL!); | ||
const stubWallet = new Wallet(Keypair.generate()); | ||
const provider = new AnchorProvider(conn, stubWallet, {}); | ||
return new OpenBookV2Client(provider); | ||
} | ||
|
||
export function initOpenbookClient(): OpenBookV2Client { | ||
const conn = new Connection(process.env.SOL_RPC_URL!, 'processed'); | ||
const wallet = new Wallet( | ||
Keypair.fromSecretKey(Uint8Array.from(JSON.parse(process.env.KEYPAIR!))), | ||
); | ||
const provider = new AnchorProvider(conn, wallet, {}); | ||
return new OpenBookV2Client(provider, undefined, { | ||
prioritizationFee: 10_000, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters