|
@@ -19,14 +19,15 @@ describe("basic-1", () => {
|
|
|
|
|
|
// Create the new account and initialize it with the program.
|
|
|
// #region code-simplified
|
|
|
- await program.rpc.initialize(new anchor.BN(1234), {
|
|
|
- accounts: {
|
|
|
+ await program.methods
|
|
|
+ .initialize(new anchor.BN(1234))
|
|
|
+ .accounts({
|
|
|
myAccount: myAccount.publicKey,
|
|
|
user: provider.wallet.publicKey,
|
|
|
systemProgram: SystemProgram.programId,
|
|
|
- },
|
|
|
- signers: [myAccount],
|
|
|
- });
|
|
|
+ })
|
|
|
+ .signers([myAccount])
|
|
|
+ .rpc();
|
|
|
// #endregion code-simplified
|
|
|
|
|
|
// Fetch the newly created account from the cluster.
|
|
@@ -48,11 +49,12 @@ describe("basic-1", () => {
|
|
|
const program = anchor.workspace.Basic1;
|
|
|
|
|
|
// Invoke the update rpc.
|
|
|
- await program.rpc.update(new anchor.BN(4321), {
|
|
|
- accounts: {
|
|
|
+ await program.methods
|
|
|
+ .update(new anchor.BN(4321))
|
|
|
+ .accounts({
|
|
|
myAccount: myAccount.publicKey,
|
|
|
- },
|
|
|
- });
|
|
|
+ })
|
|
|
+ .rpc();
|
|
|
|
|
|
// Fetch the newly updated account.
|
|
|
const account = await program.account.myAccount.fetch(myAccount.publicKey);
|