浏览代码

cli: update js/ts templates to use new `.methods` syntax (#1732)

Co-authored-by: Nikhil B N <nikhilbn365@gmail.com>
Paul 3 年之前
父节点
当前提交
9e070870f4
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 1 0
      CHANGELOG.md
  2. 2 2
      cli/src/template.rs

+ 1 - 0
CHANGELOG.md

@@ -16,6 +16,7 @@ The minor version will be incremented upon a breaking change and the patch versi
 * lang: Add return values to CPI client ([#1598](https://github.com/project-serum/anchor/pull/1598)).
 * ts: Add view functions ([#1695](https://github.com/project-serum/anchor/pull/1695)).
 * avm: New `avm update` command to update the Anchor CLI to the latest version ([#1670](https://github.com/project-serum/anchor/pull/1670)).
+* cli: Update js/ts templates to use new `program.methods` syntax ([#1732](https://github.com/project-serum/anchor/pull/1732)).
 
 ### Fixes
 

+ 2 - 2
cli/src/template.rs

@@ -201,7 +201,7 @@ describe("{}", () => {{
   it("Is initialized!", async () => {{
     // Add your test here.
     const program = anchor.workspace.{};
-    const tx = await program.rpc.initialize();
+    const tx = await program.methods.initialize().rpc();
     console.log("Your transaction signature", tx);
   }});
 }});
@@ -262,7 +262,7 @@ describe("{}", () => {{
 
   it("Is initialized!", async () => {{
     // Add your test here.
-    const tx = await program.rpc.initialize({{}});
+    const tx = await program.methods.initialize().rpc();
     console.log("Your transaction signature", tx);
   }});
 }});