-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.js
More file actions
29 lines (22 loc) · 900 Bytes
/
client.js
File metadata and controls
29 lines (22 loc) · 900 Bytes
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
// client.js is used to introduce the reader to generating clients from IDLs.
// It is not expected users directly test with this example. For a more
// ergonomic example, see `tests/basic-0.js` in this workspace.
const anchor = require("@project-serum/anchor");
// Configure the local cluster.
anchor.setProvider(anchor.Provider.local());
async function main() {
// #region main
// Read the generated IDL.
const idl = JSON.parse(
require("fs").readFileSync("./target/idl/liminal.json", "utf8")
);
// Address of the deployed program.
const programId = new anchor.web3.PublicKey("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
// Generate the program client from IDL.
const program = new anchor.Program(idl, programId);
// Execute the RPC.
await program.rpc.initialize();
// #endregion main
}
console.log("Running client.");
main().then(() => console.log("Success"));