فهرست منبع

examples: Fix passing `programId` to `Program` constructor (#2948)

acheron 1 سال پیش
والد
کامیت
970cd236b6
1فایلهای تغییر یافته به همراه2 افزوده شده و 7 حذف شده
  1. 2 7
      examples/tutorial/basic-0/client.js

+ 2 - 7
examples/tutorial/basic-0/client.js

@@ -10,15 +10,10 @@ anchor.setProvider(anchor.AnchorProvider.local());
 async function main() {
   // #region main
   // Read the generated IDL.
-  const idl = JSON.parse(
-    require("fs").readFileSync("./target/idl/basic_0.json", "utf8")
-  );
-
-  // Address of the deployed program.
-  const programId = new anchor.web3.PublicKey("<YOUR-PROGRAM-ID>");
+  const idl = require("./target/idl/basic_0.json");
 
   // Generate the program client from IDL.
-  const program = new anchor.Program(idl, programId);
+  const program = new anchor.Program(idl);
 
   // Execute the RPC.
   await program.rpc.initialize();