forked from openbook-dex/scripts-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateOpenOrders.ts
34 lines (31 loc) · 952 Bytes
/
createOpenOrders.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { AnchorProvider, BN, Wallet } from "@coral-xyz/anchor";
import {
Connection,
PublicKey,
SystemProgram,
Transaction,
} from "@solana/web3.js";
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { OpenBookV2Client } from "@openbook-dex/openbook-v2";
import { RPC, authority, programId } from "./utils";
const createIndexer = true;
async function main() {
const wallet = new Wallet(authority);
const provider = new AnchorProvider(new Connection(RPC), wallet, {
commitment: "confirmed",
});
const client = new OpenBookV2Client(provider);
const market = new PublicKey("2Hj72s8LRTs532YBDSU7R95DgHw2bSSN5nmwzeYwgJr3");
const accountIndex = new BN(2);
const openOrdersIndexer = new PublicKey(
"3zfApGWevn9t5Bu46WHQm8KNHCd8VwXfzeEmY1ANhEAB"
);
const tx = await client.createOpenOrders(
wallet.payer,
market,
accountIndex,
"name"
);
console.log("created open orders acc", tx);
}
main();