Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: run prettier on all files + wallet rpc examples #12

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 50 additions & 50 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,53 @@ on:
- '**'

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: '18'
- name: Install deps
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Lint
run: yarn run lint
- name: Tests
run: yarn run test

maybe-release:
name: release
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: release-please-action
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true}]'
- uses: actions/checkout@v3
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: 18
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}
- run: yarn install --frozen-lockfile
if: ${{ steps.release.outputs.release_created }}
- run: yarn build
if: ${{ steps.release.outputs.release_created }}

- run: yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.release_created }}
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: '18'
- name: Install deps
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Lint
run: yarn run lint
- name: Tests
run: yarn run test

maybe-release:
name: release
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: release-please-action
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true}]'

- uses: actions/checkout@v3
if: ${{ steps.release.outputs.release_created }}

- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: 18
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}

- run: yarn install --frozen-lockfile
if: ${{ steps.release.outputs.release_created }}

- run: yarn build
if: ${{ steps.release.outputs.release_created }}

- run: yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.release_created }}
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ permissions:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
group: 'pages'
cancel-in-progress: false

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_title.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Semantic PR"
name: 'Semantic PR'

on:
pull_request_target:
Expand Down
8 changes: 7 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"trailingComma": "all"
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 90,
"tabWidth": 2,
"endOfLine": "auto",
"bracketSpacing": true
}
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ pnpm add web3-plugin-wallet-rpc
### Register plugin

```typescript
import { Web3 } from "web3";
import { WalletRpcPlugin } from "web3-plugin-wallet-rpc";
import { Web3 } from 'web3';
import { WalletRpcPlugin } from 'web3-plugin-wallet-rpc';

const web3 = new Web3("https://eth.llamarpc.com");
const web3 = new Web3('https://eth.llamarpc.com');
web3.registerPlugin(new WalletRpcPlugin());
```

Expand All @@ -51,15 +51,15 @@ Invokes the `wallet_addEthereumChain` method as defined in [EIP-3085](https://ei
```typescript
await web3.walletRpc.addEthereumChain({
chainId: 5000,
blockExplorerUrls: ["https://mantlescan.xyz"],
chainName: "Mantle",
iconUrls: ["https://icons.llamao.fi/icons/chains/rsz_mantle.jpg"],
blockExplorerUrls: ['https://mantlescan.xyz'],
chainName: 'Mantle',
iconUrls: ['https://icons.llamao.fi/icons/chains/rsz_mantle.jpg'],
nativeCurrency: {
name: "Mantle",
symbol: "MNT",
name: 'Mantle',
symbol: 'MNT',
decimals: 18,
},
rpcUrls: ["https://rpc.mantle.xyz"],
rpcUrls: ['https://rpc.mantle.xyz'],
});
```

Expand All @@ -77,10 +77,10 @@ Invokes the `wallet_watchAsset` method as defined in [EIP-747](https://eips.ethe

```typescript
await web3.walletRpc.watchAsset({
type: "ERC20",
type: 'ERC20',
options: {
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
symbol: "USDC",
address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
symbol: 'USDC',
},
});
```
Expand Down Expand Up @@ -122,14 +122,14 @@ Invokes the `wallet_updateEthereumChain` method as defined in [EIP-2015](https:/
```typescript
await web3.walletRpc.updateEthereumChain({
chainId: 5000,
blockExplorerUrls: ["https://mantlescan.xyz"],
chainName: "Mantle",
blockExplorerUrls: ['https://mantlescan.xyz'],
chainName: 'Mantle',
nativeCurrency: {
name: "Mantle",
symbol: "MNT",
name: 'Mantle',
symbol: 'MNT',
decimals: 18,
},
rpcUrls: ["https://rpc.mantle.xyz"],
rpcUrls: ['https://rpc.mantle.xyz'],
});
```

Expand All @@ -139,7 +139,7 @@ Invokes the `wallet_getOwnedAssets` method as defined in [EIP-2256](https://eips

```typescript
const ownedAssets = await web3.walletRpc.getOwnedAssets({
address: "0xa5653e88D9c352387deDdC79bcf99f0ada62e9c6",
address: '0xa5653e88D9c352387deDdC79bcf99f0ada62e9c6',
});
```

Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@
],
"packageManager": "[email protected]",
"scripts": {
"lint": "cd packages/web3-plugin-wallet-rpc && yarn lint",
"build": "cd packages/web3-plugin-wallet-rpc && yarn build",
"build:docs": "cd packages/web3-plugin-wallet-rpc && yarn build:docs",
"test": "cd packages/web3-plugin-wallet-rpc && yarn test",
"lint": "yarn lint:plugin && yarn lint:example",
"lint:plugin": "cd packages/web3-plugin-wallet-rpc && yarn lint",
"lint:example": "cd packages/example-react-app && yarn lint",
"start:example": "cd packages/example-react-app && yarn start"
"format": "prettier --write .",
"start:example": "yarn build && cd packages/example-react-app && yarn start"
},
"devDependencies": {
"prettier": "^3.3.3"
}
}
18 changes: 10 additions & 8 deletions packages/example-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@
],
"license": "MIT",
"dependencies": {
"@types/node": "^16.18.108",
"@types/react": "^18.3.8",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^10.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-scripts": "5.0.1",
"typescript": "5.3.x",
"uuid": "^10.0.0",
"web3": "^4.14.0",
"web3-eth": "^4.9.0",
"web3-plugin-wallet-rpc": "*"
},
"devDependencies": {
"@types/node": "^16.18.108",
"@types/react": "^18.3.8",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^10.0.0",
"eslint": "8",
"react-scripts": "5.0.1",
"typescript": "5.3.x"
},
"scripts": {
"start": "react-scripts start",
"lint": "eslint 'src/**/*.{ts,tsx}'"
"lint": "eslint 'src/**/*.{js,ts,tsx}'"
},
"eslintConfig": {
"extends": [
Expand Down
7 changes: 2 additions & 5 deletions packages/example-react-app/public/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web3.js Wallet RPC Methods Demonstration dApp"
/>
<meta name="description" content="Web3.js Wallet RPC Methods Demonstration dApp" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
56 changes: 0 additions & 56 deletions packages/example-react-app/src/AccountDetail.tsx

This file was deleted.

Loading
Loading