From 5c27c3bef9bc34007c8a91f4e260303abb6ad694 Mon Sep 17 00:00:00 2001 From: h0ngcha0 Date: Fri, 3 Feb 2023 13:43:43 +0100 Subject: [PATCH] Upgrade web3 version --- Readme.md | 149 ++------------------- lerna.json | 2 +- package.json | 2 +- packages/dapp/package.json | 8 +- packages/extension/package.json | 6 +- packages/get-extension-wallet/package.json | 4 +- packages/storybook/package.json | 2 +- yarn.lock | 30 ++--- 8 files changed, 36 insertions(+), 167 deletions(-) diff --git a/Readme.md b/Readme.md index 7c9907251..9e05f9970 100644 --- a/Readme.md +++ b/Readme.md @@ -1,81 +1,15 @@ -

- -

---- - -

โฌ‡๏ธ Get Argent X for StarkNet today:

- -

- - - -

+![Alephium Logo](https://raw.githubusercontent.com/alephium/alephium-brand-guide/master/logos/light/Logo-Horizontal-Light.png#gh-dark-mode-only) ![Alephium Logo](https://raw.githubusercontent.com/alephium/alephium-brand-guide/master/logos/dark/Logo-Horizontal-Dark.png#gh-light-mode-only) --- -

๐ŸŒˆ Table of contents

- -- [๐Ÿง’ Example dapp](#-example-dapp) -- [๐ŸŒ Usage with your dapp](#-usage-with-your-dapp) -- [๐Ÿš€ Install from sources](#-install-from-sources) -- [๐Ÿ‘ฉ๐Ÿพโ€๐Ÿ’ป Development](#-development) -- [๐Ÿงช Testing](#-testing) - - [Setup](#setup) - - [Run tests](#run-tests) -- [โœ๏ธ Contributing](#๏ธ-contributing) -- [โค๏ธ Family and friends](#๏ธ-family-and-friends) -- [๐Ÿ‘จ๐Ÿผโ€๐ŸŽจ Authors and license](#-authors-and-license) - -## ๐Ÿง’ Example dapp - -You can try the extension using our example dapp hosted at: - -[https://argentlabs.github.io/argent-x/](https://argentlabs.github.io/argent-x/) - -The example dapp is also contained in this repository. - -## ๐ŸŒ Usage with your dapp - -If you want to use this StarkNet Wallet extension with your dapp, the easiest way is to checkout the `@argent/get-starknet` package developed in this repo by running: - -```bash -# starknet.js is a peer dependency -yarn add @argent/get-starknet starknet -``` +

Table of contents

-The package is a light wrapper around [starknet.js](https://github.com/0xs34n/starknet.js) to interact with the wallet extension. You can then use it like the following: +- [Install from sources](#-install-from-sources) +- [Development](#-development) -```javascript -import { connect } from "@argent/get-starknet" - -// Let the user pick a wallet (on button click) -const starknet = connect() - -// or try to connect to an approved wallet silently (on mount probably) -const starknet = connect({ showList: false }) - -if (!starknet) { - throw Error("User rejected wallet selection or silent connect found nothing") -} - -// (optional) connect the wallet -await starknet.enable() - -// Check if connection was successful -if(starknet.isConnected) { - // If the extension was installed and successfully connected, you have access to a starknet.js Signer object to do all kinds of requests through the user's wallet contract. - starknet.account.execute({ ... }) -} else { - // In case the extension wasn't successfully connected you still have access to a starknet.js Provider to read starknet states and sent anonymous transactions - starknet.provider.callContract( ... ) -} -``` - -Checkout [starknet.js](https://github.com/0xs34n/starknet.js) to learn more about how to use `Provider` and `Signer`. - -## ๐Ÿš€ Install from sources +## Install from sources First clone this repository on your machine then run: @@ -84,19 +18,9 @@ yarn # setup dependencies yarn build # run build process for all packages ``` -Now you need to load the locally built chrome extension into your browser, by loading an unpacked extension from path `packages/extension/dist`: - -1. Open the Extension Management page by navigating to `chrome://extensions`. -2. Enable Developer Mode by clicking the toggle switch next to **Developer mode**. -3. Click the Load unpacked button and select the extension directory. - -![Chrome screenshot of setup](https://wd.imgix.net/image/BhuKGJaIeLNPW9ehns59NfwqKxF2/vOu7iPbaapkALed96rzN.png?auto=format) - -[Source](https://developer.chrome.com/docs/extensions/mv3/getstarted/#manifest) - -## ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿ’ป Development +To load the locally built chrome extension into your browser, follow the guide [here](https://developer.chrome.com/docs/extensions/mv3/getstarted/#manifest) -To contribute to this repository please read the [contributing guidelines](Contributing.md) first. +## Development To setup the repo on your machine just run: @@ -105,61 +29,6 @@ yarn # setup dependencies yarn dev # run build process for all packages in watch mode ``` -This project contains 3 packages: - -| package | description | -| --- | --- | -| extension | Argent X extension | -| get-starknet | npm module to get started with starknet.js and Argent X quickly | -| dapp | example dapp for testing purposes and example for dapps how to use `get-starknet` | - -To test changes made to the `extension` package you need to load the local unpacked extension into Chrome as [described above](#install-fromsources). Changes are shown after reopening the extension. Changes to `background.js` are just shown after a complete restart of the Chrome process. - -## ๐Ÿงช Testing - -### Setup - -Some tests require [`starknet-devnet`](https://github.com/Shard-Labs/starknet-devnet) to be available at http://127.0.0.1:5050/. If tests are run without then you may see errors including `connect ECONNREFUSED 127.0.0.1:5050`. - -### Run devnet locally - -For convenience this service can be started with [Docker desktop](https://www.docker.com/get-started/) running; - -- For ARM computers (e.g. Mac computers with Apple silicon) - - ```bash - docker run -it -p 5050:5050 shardlabs/starknet-devnet:latest-arm-seed0 - ``` - -- Otherwise - - ```bash - docker run -it -p 5050:5050 shardlabs/starknet-devnet:latest-seed0 - ``` - -### Run tests - -```bash -yarn test # run unit tests for all packages -yarn test:e2e # run end-to-end tests for all packages -``` - -### Tools to help with testing - -See also [/docs/tools-for-local-testing.md](/docs/tools-for-local-testing.md) - -## โœ๏ธ Contributing - -Everyone is welcome to contribute. Please take a moment to review the [contributing guidelines](Contributing.md). - -## โค๏ธ Family and friends - -Since this project would not have been possible without [starknet.js](https://github.com/seanjameshan/starknet.js), we would like to say a big thank you to all [starknet.js contributors](https://github.com/0xs34n/starknet.js/graphs/contributors) and [@0xs34n](https://github.com/0xs34n) for starting it. - -One more thank you to the StarkWare Team. - -## ๐Ÿ‘จ๐Ÿผโ€๐ŸŽจ Authors and license - -[Argent](https://github.com/argentlabs) and [contributors](https://github.com/argentlabs/argent-x/graphs/contributors). +## Credits -GNU General Public License V3, see the included [License.md](License.md) file. +We have built this project on top of [Argent X](https://github.com/argentlabs/argent-x)'s codebase. We would like to take this oppurtunity to thank all the [contributors](https://github.com/argentlabs/argent-x/graphs/contributors) of the Argent X project โค๏ธ diff --git a/lerna.json b/lerna.json index 75dc7deb0..1208d5d00 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "packages": ["packages/*"], - "version": "0.5.0-rc.1", + "version": "0.5.0-rc.2", "npmClient": "yarn", "useWorkspaces": true } diff --git a/package.json b/package.json index e23c3a45d..ff16cb5d7 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.5.0-rc.1", + "version": "0.5.0-rc.2", "private": true, "name": "alephium-browser-extension-wallet", "repository": "github:alephium/extension-wallet", diff --git a/packages/dapp/package.json b/packages/dapp/package.json index 8581fcff1..2c0ce1de7 100644 --- a/packages/dapp/package.json +++ b/packages/dapp/package.json @@ -1,6 +1,6 @@ { "name": "@alephium/dapp", - "version": "0.5.0-rc.1", + "version": "0.5.0-rc.2", "private": true, "scripts": { "dev": "next dev", @@ -10,8 +10,8 @@ "lint": "next lint" }, "dependencies": { - "@alephium/web3": "v0.3.0-rc.7", - "@alephium/get-extension-wallet": "^0.5.0-rc.1", + "@alephium/web3": "v0.3.0-rc.8", + "@alephium/get-extension-wallet": "^0.5.0-rc.2", "@argent/get-starknet": "^5.2.0", "@argent/x-sessions": "^5.2.0", "ethers": "^5.5.1", @@ -22,7 +22,7 @@ "starknet5": "npm:starknet@5.0.0-beta.3" }, "devDependencies": { - "@alephium/cli": "v0.3.0-rc.7", + "@alephium/cli": "v0.3.0-rc.8", "@types/node": "18.11.18", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", diff --git a/packages/extension/package.json b/packages/extension/package.json index 4f26fcfa5..399e598e8 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -1,12 +1,12 @@ { "name": "@alephium/extension", - "version": "0.5.0-rc.1", + "version": "0.5.0-rc.2", "main": "index.js", "license": "MIT", "devDependencies": { "@alephium/sdk": "0.3.0", - "@alephium/web3": "v0.3.0-rc.7", - "@alephium/web3-wallet": "v0.3.0-rc.7", + "@alephium/web3": "v0.3.0-rc.8", + "@alephium/web3-wallet": "v0.3.0-rc.8", "@playwright/test": "^1.23.0", "@sentry/webpack-plugin": "^1.18.9", "@svgr/webpack": "^6.0.0", diff --git a/packages/get-extension-wallet/package.json b/packages/get-extension-wallet/package.json index bb1553b67..d860bc132 100644 --- a/packages/get-extension-wallet/package.json +++ b/packages/get-extension-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@alephium/get-extension-wallet", - "version": "0.5.0-rc.1", + "version": "0.5.0-rc.2", "main": "dist/", "browser": { "crypto": false @@ -54,6 +54,6 @@ }, "dependencies": { "bowser": "^2.11.0", - "@alephium/web3": "v0.3.0-rc.7" + "@alephium/web3": "v0.3.0-rc.8" } } diff --git a/packages/storybook/package.json b/packages/storybook/package.json index bcbe9c0b1..d73f11d62 100644 --- a/packages/storybook/package.json +++ b/packages/storybook/package.json @@ -3,7 +3,7 @@ "version": "5.2.0", "private": true, "devDependencies": { - "@alephium/extension": "^0.5.0-rc.1", + "@alephium/extension": "^0.5.0-rc.2", "@argent/ui": "^5.2.0", "@babel/core": "^7.18.5", "@chakra-ui/storybook-addon": "^4.0.12", diff --git a/yarn.lock b/yarn.lock index 0815a5db9..5f5579a4f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,13 +2,13 @@ # yarn lockfile v1 -"@alephium/cli@v0.3.0-rc.7": - version "0.3.0-rc.7" - resolved "https://registry.npmjs.org/@alephium/cli/-/cli-0.3.0-rc.7.tgz" - integrity sha512-anngUxSEVr9S8Xf3tyAN+4tV1V4zAlnwnBE7352FPdvlXs0F6Z/iVyWzvoVTWqOWDy10FUzoGI81jJFe8x2o8g== +"@alephium/cli@v0.3.0-rc.8": + version "0.3.0-rc.8" + resolved "https://registry.yarnpkg.com/@alephium/cli/-/cli-0.3.0-rc.8.tgz#48395fcd43abc579cd40a46a14455251af7a901b" + integrity sha512-O+PZFM5nNFQX5+cUdmGQuPXj4w+9XyFvw8xK05mDkGkPJvdvHP1NShMSzNud/xp9WlApwAB8ZJTVMKu3QjU/vg== dependencies: - "@alephium/web3" "^0.3.0-rc.7" - "@alephium/web3-wallet" "^0.3.0-rc.7" + "@alephium/web3" "^0.3.0-rc.8" + "@alephium/web3-wallet" "^0.3.0-rc.8" commander "^9.4.0" cross-fetch "^3.1.5" crypto-js "^4.1.1" @@ -29,12 +29,12 @@ crypto-js "^4.1.1" elliptic "^6.5.4" -"@alephium/web3-wallet@^0.3.0-rc.7", "@alephium/web3-wallet@v0.3.0-rc.7": - version "0.3.0-rc.7" - resolved "https://registry.npmjs.org/@alephium/web3-wallet/-/web3-wallet-0.3.0-rc.7.tgz" - integrity sha512-e+Y8xGkP/LeSltFdBn8m+KZ0ONkeIRJP7p8Z99cNktL7mafPvOXYqVYv0w+V4BegNotjAhoKugKHPJ61a6CIaQ== +"@alephium/web3-wallet@^0.3.0-rc.8", "@alephium/web3-wallet@v0.3.0-rc.8": + version "0.3.0-rc.8" + resolved "https://registry.yarnpkg.com/@alephium/web3-wallet/-/web3-wallet-0.3.0-rc.8.tgz#0decfed421fb45fbf437bbe5298dae65726403da" + integrity sha512-SwXom5couvhXL3ADStzJdbRXHdzJeAoBkkYws42DK+BeUbykR/Km7i1lQOLjRW3dIjqRh04JJTPcApVJ7w9z8g== dependencies: - "@alephium/web3" "^0.3.0-rc.7" + "@alephium/web3" "^0.3.0-rc.8" "@types/node" "16.7.8" bip32 "3.1.0" bip39 "3.0.4" @@ -42,10 +42,10 @@ fs-extra "10.0.1" tiny-secp256k1 "2.2.1" -"@alephium/web3@^0.3.0-rc.7", "@alephium/web3@v0.3.0-rc.7": - version "0.3.0-rc.7" - resolved "https://registry.npmjs.org/@alephium/web3/-/web3-0.3.0-rc.7.tgz" - integrity sha512-3DoB+ey9kbFfC94mxItIdUKLqVY4xTUMDOsoI/a7QY7eOKUBKceMTRkGVEtU90AKv1rOjMPKOt6aekKdazeijA== +"@alephium/web3@^0.3.0-rc.8", "@alephium/web3@v0.3.0-rc.8": + version "0.3.0-rc.8" + resolved "https://registry.yarnpkg.com/@alephium/web3/-/web3-0.3.0-rc.8.tgz#378fd3f9af7e1cf4054177da5cd37377b5bdc94d" + integrity sha512-fDFsPK52btpiLVGRGVSXNPhgO4JnJOyIjg3Nf1ycy2guTC0e6afOzpWtAgy75nsFZ5CgGrSgVNXyJx0hKjfqLg== dependencies: base-x "4.0.0" blakejs "1.2.1"