Browse Source

cli: Fix using deprecated commitment `recent` in migration scripts (#3725)

acheron 4 months ago
parent
commit
0bdfa3f760
2 changed files with 12 additions and 19 deletions
  1. 2 3
      CHANGELOG.md
  2. 10 16
      cli/src/rust_template.rs

+ 2 - 3
CHANGELOG.md

@@ -10,13 +10,12 @@ The minor version will be incremented upon a breaking change and the patch versi
 
 
 ## [Unreleased]
 ## [Unreleased]
 
 
-- 
-
 ### Features
 ### Features
 
 
 ### Fixes
 ### Fixes
 
 
-- docker: Upgrade `node` to 20.18.0 LTS ([#3179](https://github.com/solana-foundation/anchor/pull/3687)).
+- docker: Upgrade `node` to 20.18.0 LTS ([#3687](https://github.com/solana-foundation/anchor/pull/3687)).
+- cli: Fix using deprecated commitment `recent` in migration scripts ([#3725](https://github.com/coral-xyz/anchor/pull/3725)).
 
 
 ### Breaking
 ### Breaking
 
 

+ 10 - 16
cli/src/rust_template.rs

@@ -256,15 +256,12 @@ const anchor = require('@coral-xyz/anchor');
 const userScript = require("{script_path}");
 const userScript = require("{script_path}");
 
 
 async function main() {{
 async function main() {{
-    const url = "{cluster_url}";
-    const preflightCommitment = 'recent';
-    const connection = new anchor.web3.Connection(url, preflightCommitment);
+    const connection = new anchor.web3.Connection(
+      "{cluster_url}",
+      anchor.AnchorProvider.defaultOptions().commitment
+    );
     const wallet = anchor.Wallet.local();
     const wallet = anchor.Wallet.local();
-
-    const provider = new anchor.AnchorProvider(connection, wallet, {{
-        preflightCommitment,
-        commitment: 'recent',
-    }});
+    const provider = new anchor.AnchorProvider(connection, wallet);
 
 
     // Run the user's deploy script.
     // Run the user's deploy script.
     userScript(provider);
     userScript(provider);
@@ -282,15 +279,12 @@ pub fn deploy_ts_script_host(cluster_url: &str, script_path: &str) -> String {
 const userScript = require("{script_path}");
 const userScript = require("{script_path}");
 
 
 async function main() {{
 async function main() {{
-    const url = "{cluster_url}";
-    const preflightCommitment = 'recent';
-    const connection = new anchor.web3.Connection(url, preflightCommitment);
+    const connection = new anchor.web3.Connection(
+      "{cluster_url}",
+      anchor.AnchorProvider.defaultOptions().commitment
+    );
     const wallet = anchor.Wallet.local();
     const wallet = anchor.Wallet.local();
-
-    const provider = new anchor.AnchorProvider(connection, wallet, {{
-        preflightCommitment,
-        commitment: 'recent',
-    }});
+    const provider = new anchor.AnchorProvider(connection, wallet);
 
 
     // Run the user's deploy script.
     // Run the user's deploy script.
     userScript(provider);
     userScript(provider);