diff --git a/.changeset/afraid-terms-push.md b/.changeset/afraid-terms-push.md new file mode 100644 index 000000000..8b1ba8f92 --- /dev/null +++ b/.changeset/afraid-terms-push.md @@ -0,0 +1,7 @@ +--- +'@fuel-wallet/sdk': minor +--- + +feat: add hooks `useAddAssets`, `useAddNetwork`, `useAssets` and `useNetwork`. +feat: improve hooks `useWallet` `useConnect` and `useAccounts`. +feat: remove `FuelConnectorProvider` and consolidate into `FuelProvider`. diff --git a/.changeset/angry-eggs-rest.md b/.changeset/angry-eggs-rest.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/angry-eggs-rest.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.changeset/config.json b/.changeset/config.json index 477b7ab55..8a4be3a77 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -14,12 +14,7 @@ "access": "public", "baseBranch": "master", "updateInternalDependencies": "patch", - "ignore": [ - "docs", - "@fuel-wallet/sdk-v2", - "@fuel-wallet/e2e-contract-tests", - "@fuels/update-sdk" - ], + "ignore": ["docs", "@fuel-wallet/e2e-contract-tests", "@fuels/update-sdk"], "snapshot": { "useCalculatedVersion": true, "prereleaseTemplate": "{tag}-{commit}" diff --git a/.changeset/itchy-ducks-juggle.md b/.changeset/itchy-ducks-juggle.md new file mode 100644 index 000000000..997103229 --- /dev/null +++ b/.changeset/itchy-ducks-juggle.md @@ -0,0 +1,5 @@ +--- +'@fuel-wallet/react': patch +--- + +Feat support for image from connector metadata diff --git a/.changeset/large-shoes-fail.md b/.changeset/large-shoes-fail.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/large-shoes-fail.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.changeset/tasty-insects-admire.md b/.changeset/tasty-insects-admire.md new file mode 100644 index 000000000..e26453b81 --- /dev/null +++ b/.changeset/tasty-insects-admire.md @@ -0,0 +1,9 @@ +--- +'@fuel-wallet/connections': minor +'@fuel-wallet/react': minor +'@fuel-wallet/types': minor +'fuels-wallet': minor +'@fuel-wallet/sdk': minor +--- + +feat: update sdk for the new connectors standard. diff --git a/.changeset/ten-snails-smoke.md b/.changeset/ten-snails-smoke.md new file mode 100644 index 000000000..102bbb880 --- /dev/null +++ b/.changeset/ten-snails-smoke.md @@ -0,0 +1,10 @@ +--- +'@fuel-wallet/connections': minor +'@fuel-wallet/playwright-utils': minor +'@fuel-wallet/react': minor +'@fuel-wallet/types': minor +'fuels-wallet': minor +'@fuel-wallet/sdk': minor +--- + +feat: remove fuel-ui from connectors ui and update to the new connectors api. diff --git a/.changeset/tender-yaks-warn.md b/.changeset/tender-yaks-warn.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/tender-yaks-warn.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 15448e592..b31290388 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -2,7 +2,7 @@ name: Tests on: pull_request: - branches: [main, master] + branches: [main, master, sdk-v2] types: [opened, synchronize, reopened] concurrency: diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index f9bb5a05a..f52348512 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -49,7 +49,7 @@ jobs: uses: FuelLabs/github-actions/setups/node@master - name: Validate Changeset - run: pnpm changeset status --since=origin/master + run: pnpm changeset status --since=origin/${{ github.base_ref }} audit: name: Audit diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 03c56c6ba..49723b50e 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -5,6 +5,7 @@ services: platform: linux/amd64 container_name: '${PROJECT:-fuel-node}_fuel-core' environment: + NETWORK_NAME: '${PROJECT} local' MIN_GAS_PRICE: ${MIN_GAS_PRICE} # This is the private key of the consensus.PoA.signing_key in the chainConfig.json # this key is responsible for validating the transactions diff --git a/docker/fuel-core/Dockerfile b/docker/fuel-core/Dockerfile index 51fa09f1a..94310a552 100644 --- a/docker/fuel-core/Dockerfile +++ b/docker/fuel-core/Dockerfile @@ -2,6 +2,7 @@ FROM ghcr.io/fuellabs/fuel-core:v0.22.0 ENV MIN_GAS_PRICE="${MIN_GAS_PRICE}" ENV CONSENSUS_KEY="${CONSENSUS_KEY}" +ENV NETWORK_NAME="${NETWORK_NAME}" # Install curl to use on # healthcheck config @@ -11,17 +12,7 @@ RUN apt install curl -y WORKDIR /root/ COPY chainConfig.json . - -# https://stackoverflow.com/a/44671685 -# https://stackoverflow.com/a/40454758 -# hadolint ignore=DL3025 -CMD ./fuel-core run \ - --ip 0.0.0.0 \ - --port 4000 \ - --db-path ./mnt/db/ \ - --utxo-validation \ - --min-gas-price ${MIN_GAS_PRICE} \ - --consensus-key ${CONSENSUS_KEY} \ - --chain ./chainConfig.json - +COPY run.sh . EXPOSE ${PORT} + +CMD ["sh", "./run.sh"] diff --git a/docker/fuel-core/accounts.json b/docker/fuel-core/accounts.json new file mode 100644 index 000000000..51825697c --- /dev/null +++ b/docker/fuel-core/accounts.json @@ -0,0 +1,10 @@ +[ + { + "account": "0xc8e615a4089466174459ef19cfd257d2e17adfabff3b8f219dbb5fb4eca87c50", + "privateKey": "0xba9e8401405cd4327119548bccf0cd8b195c3fb716c848d9571c60bb230c6978" + }, + { + "account": "0x92dffc873b56f219329ed03bb69bebe8c3d8b041088574882f7a6404f02e2f28", + "privateKey": "0xa349d39f614a3085b7f7f8cef63fd5189136924fc1238e6d25ccdaa43a901cd0" + } +] diff --git a/docker/fuel-core/chainConfig.json b/docker/fuel-core/chainConfig.json index 697ba4ccc..d3b1d5268 100644 --- a/docker/fuel-core/chainConfig.json +++ b/docker/fuel-core/chainConfig.json @@ -194,7 +194,17 @@ }, { "owner": "0x6684dd7bb61364e1ac458e9241f969178c4a2e302bbc23e143c49d8b6dba701a", - "amount": "0xFFFFFFFFFFFFFFFF", + "amount": "0x00000000FFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0xc8e615a4089466174459ef19cfd257d2e17adfabff3b8f219dbb5fb4eca87c50", + "amount": "0x00000000FFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x92dffc873b56f219329ed03bb69bebe8c3d8b041088574882f7a6404f02e2f28", + "amount": "0x00000000FFFFFFFF", "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" } ] diff --git a/docker/fuel-core/run.sh b/docker/fuel-core/run.sh new file mode 100644 index 000000000..9dbb11922 --- /dev/null +++ b/docker/fuel-core/run.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Change the network name +sed -i "s/local_testnet/$NETWORK_NAME/g" ./chainConfig.json + +# Start the Fuel Core node +/root/fuel-core run \ + --ip 0.0.0.0 \ + --port 4000 \ + --db-path ./mnt/db/ \ + --utxo-validation \ + --min-gas-price ${MIN_GAS_PRICE} \ + --consensus-key ${CONSENSUS_KEY} \ + --chain ./chainConfig.json diff --git a/examples/cra-dapp/.gitignore b/examples/cra-dapp/.gitignore new file mode 100644 index 000000000..4d29575de --- /dev/null +++ b/examples/cra-dapp/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/examples/cra-dapp/README.md b/examples/cra-dapp/README.md new file mode 100644 index 000000000..b87cb0044 --- /dev/null +++ b/examples/cra-dapp/README.md @@ -0,0 +1,46 @@ +# Getting Started with Create React App + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.\ +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.\ +You will also see any lint errors in the console. + +### `npm test` + +Launches the test runner in the interactive watch mode.\ +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `npm run build` + +Builds the app for production to the `build` folder.\ +It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.\ +Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `npm run eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. + +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). diff --git a/examples/cra-dapp/package.json b/examples/cra-dapp/package.json new file mode 100644 index 000000000..9d139e4f8 --- /dev/null +++ b/examples/cra-dapp/package.json @@ -0,0 +1,33 @@ +{ + "name": "cra-dapp", + "version": "0.1.0", + "private": true, + "dependencies": { + "@fuel-wallet/react": "workspace:*", + "@types/node": "^16.18.61", + "@types/react": "^18.2.37", + "@types/react-dom": "^18.2.15", + "fuels": "0.67.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-scripts": "5.0.1", + "typescript": "^4.9.5", + "web-vitals": "^2.1.4" + }, + "scripts": { + "start": "react-scripts start", + "eject": "react-scripts eject" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/examples/cra-dapp/public/favicon.ico b/examples/cra-dapp/public/favicon.ico new file mode 100644 index 000000000..a11777cc4 Binary files /dev/null and b/examples/cra-dapp/public/favicon.ico differ diff --git a/examples/cra-dapp/public/index.html b/examples/cra-dapp/public/index.html new file mode 100644 index 000000000..e65acb3de --- /dev/null +++ b/examples/cra-dapp/public/index.html @@ -0,0 +1,43 @@ + + +
+ + + + + + + + + +{error?.message}
} + {isConnected && ( +