Pārlūkot izejas kodu

update yarn lockfile, fix cli template, and fix ci (#1770)

Paul 3 gadi atpakaļ
vecāks
revīzija
fb149f96a1

+ 1 - 1
.github/workflows/tests.yaml

@@ -319,7 +319,7 @@ jobs:
           name: anchor-binary
           path: ~/.cargo/bin/
 
-      - run: cd "$(mktemp -d)" && anchor init hello-anchor && cd hello-anchor && anchor test && yarn lint:fix
+      - run: cd "$(mktemp -d)" && anchor init hello-anchor && cd hello-anchor && yarn link @project-serum/anchor && anchor test && yarn lint:fix
       - uses: ./.github/actions/git-diff/
 
   test-programs:

+ 4 - 0
CHANGELOG.md

@@ -10,6 +10,10 @@ The minor version will be incremented upon a breaking change and the patch versi
 
 ## [Unreleased]
 
+### Fixes
+
+* cli: Update js/ts template to use new `AnchorProvider` class ([#1770](https://github.com/project-serum/anchor/pull/1770)).
+
 ## [0.24.0] - 2022-04-12
 
 ### Features

+ 5 - 5
cli/src/template.rs

@@ -91,7 +91,7 @@ async function main() {{
     const connection = new anchor.web3.Connection(url, preflightCommitment);
     const wallet = anchor.Wallet.local();
 
-    const provider = new anchor.Provider(connection, wallet, {{
+    const provider = new anchor.AnchorProvider(connection, wallet, {{
         preflightCommitment,
         commitment: 'recent',
     }});
@@ -118,7 +118,7 @@ async function main() {{
     const connection = new anchor.web3.Connection(url, preflightCommitment);
     const wallet = anchor.Wallet.local();
 
-    const provider = new anchor.Provider(connection, wallet, {{
+    const provider = new anchor.AnchorProvider(connection, wallet, {{
         preflightCommitment,
         commitment: 'recent',
     }});
@@ -199,7 +199,7 @@ pub fn mocha(name: &str) -> String {
 
 describe("{}", () => {{
   // Configure the client to use the local cluster.
-  anchor.setProvider(anchor.Provider.env());
+  anchor.setProvider(anchor.AnchorProvider.env());
 
   it("Is initialized!", async () => {{
     // Add your test here.
@@ -269,7 +269,7 @@ import {{ {} }} from "../target/types/{}";
 
 describe("{}", () => {{
   // Configure the client to use the local cluster.
-  anchor.setProvider(anchor.Provider.env());
+  anchor.setProvider(anchor.AnchorProvider.env());
 
   const program = anchor.workspace.{} as Program<{}>;
 
@@ -352,7 +352,7 @@ const __wallet = new anchor.Wallet(
   ),
 );
 const __connection = new web3.Connection("{}", "processed");
-const provider = new anchor.Provider(__connection, __wallet, {{
+const provider = new anchor.AnchorProvider(__connection, __wallet, {{
   commitment: "processed",
   preflightcommitment: "processed",
 }});

+ 4 - 17
examples/tutorial/yarn.lock

@@ -30,10 +30,10 @@
     "@ethersproject/logger" "^5.5.0"
     hash.js "1.1.7"
 
-"@project-serum/anchor@^0.23.0":
-  version "0.23.0"
-  resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.23.0.tgz#2b2eb6b51601b073e8db26663aa2d6c2f2841771"
-  integrity sha512-LV2/ifZOJVFTZ4GbEloXln3iVfCvO1YM8i7BBCrUm4tehP7irMx4nr4/IabHWOzrQcQElsxSP/lb1tBp+2ff8A==
+"@project-serum/anchor@^0.24.0":
+  version "0.24.0"
+  resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.24.0.tgz#ec8a45847f6b54f56ab97552cf5735beded3b39e"
+  integrity sha512-kDCpDMmXAEyhjExv0A5voEJN6eiKtCChu4egidk8ljdsxp0c29YWjSkx3zjOrMUK0YH1cz0qnsxuT1nCCtUgUQ==
   dependencies:
     "@project-serum/borsh" "^0.2.5"
     "@solana/web3.js" "^1.36.0"
@@ -45,7 +45,6 @@
     cross-fetch "^3.1.5"
     crypto-hash "^1.3.0"
     eventemitter3 "^4.0.7"
-    find "^0.3.0"
     js-sha256 "^0.9.0"
     pako "^2.0.3"
     snake-case "^3.0.4"
@@ -469,13 +468,6 @@ find-up@5.0.0:
     locate-path "^6.0.0"
     path-exists "^4.0.0"
 
-find@^0.3.0:
-  version "0.3.0"
-  resolved "https://registry.yarnpkg.com/find/-/find-0.3.0.tgz#4082e8fc8d8320f1a382b5e4f521b9bc50775cb8"
-  integrity sha512-iSd+O4OEYV/I36Zl8MdYJO0xD82wH528SaCieTVHhclgiYNe9y+yPKSwK+A7/WsmHL1EZ+pYUJBXWTL5qofksw==
-  dependencies:
-    traverse-chain "~0.1.0"
-
 flat@^5.0.2:
   version "5.0.2"
   resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241"
@@ -966,11 +958,6 @@ tr46@~0.0.3:
   resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
   integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=
 
-traverse-chain@~0.1.0:
-  version "0.1.0"
-  resolved "https://registry.yarnpkg.com/traverse-chain/-/traverse-chain-0.1.0.tgz#61dbc2d53b69ff6091a12a168fd7d433107e40f1"
-  integrity sha1-YdvC1Ttp/2CRoSoWj9fUMxB+QPE=
-
 tslib@^2.0.3:
   version "2.3.1"
   resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"

+ 4 - 0
examples/yarn.lock

@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+

+ 4 - 5
tests/yarn.lock

@@ -50,10 +50,10 @@
     snake-case "^3.0.4"
     toml "^3.0.0"
 
-"@project-serum/anchor@^0.23.0":
-  version "0.23.0"
-  resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.23.0.tgz#2b2eb6b51601b073e8db26663aa2d6c2f2841771"
-  integrity sha512-LV2/ifZOJVFTZ4GbEloXln3iVfCvO1YM8i7BBCrUm4tehP7irMx4nr4/IabHWOzrQcQElsxSP/lb1tBp+2ff8A==
+"@project-serum/anchor@^0.24.0":
+  version "0.24.0"
+  resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.24.0.tgz#ec8a45847f6b54f56ab97552cf5735beded3b39e"
+  integrity sha512-kDCpDMmXAEyhjExv0A5voEJN6eiKtCChu4egidk8ljdsxp0c29YWjSkx3zjOrMUK0YH1cz0qnsxuT1nCCtUgUQ==
   dependencies:
     "@project-serum/borsh" "^0.2.5"
     "@solana/web3.js" "^1.36.0"
@@ -65,7 +65,6 @@
     cross-fetch "^3.1.5"
     crypto-hash "^1.3.0"
     eventemitter3 "^4.0.7"
-    find "^0.3.0"
     js-sha256 "^0.9.0"
     pako "^2.0.3"
     snake-case "^3.0.4"

+ 0 - 12
ts/yarn.lock

@@ -2227,13 +2227,6 @@ find-versions@^4.0.0:
   dependencies:
     semver-regex "^3.1.2"
 
-find@^0.3.0:
-  version "0.3.0"
-  resolved "https://registry.yarnpkg.com/find/-/find-0.3.0.tgz#4082e8fc8d8320f1a382b5e4f521b9bc50775cb8"
-  integrity sha512-iSd+O4OEYV/I36Zl8MdYJO0xD82wH528SaCieTVHhclgiYNe9y+yPKSwK+A7/WsmHL1EZ+pYUJBXWTL5qofksw==
-  dependencies:
-    traverse-chain "~0.1.0"
-
 flat-cache@^3.0.4:
   version "3.0.4"
   resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
@@ -4506,11 +4499,6 @@ tr46@~0.0.3:
   resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
   integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=
 
-traverse-chain@~0.1.0:
-  version "0.1.0"
-  resolved "https://registry.yarnpkg.com/traverse-chain/-/traverse-chain-0.1.0.tgz#61dbc2d53b69ff6091a12a168fd7d433107e40f1"
-  integrity sha1-YdvC1Ttp/2CRoSoWj9fUMxB+QPE=
-
 trim-newlines@^3.0.0:
   version "3.0.1"
   resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144"