Skip to content

Commit

Permalink
Merge pull request #9 from gnosis/add-local-fork-as-chain
Browse files Browse the repository at this point in the history
Added anvil remote
  • Loading branch information
gabrielfior authored Jan 28, 2025
2 parents 010439b + 2d37e40 commit b491e04
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 165 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
env:
CI: false # needed otherwise dependencies warnings stop the job
REACT_APP_RAINBOW_PROJECT_ID: ${{ secrets.REACT_APP_RAINBOW_PROJECT_ID }}
REACT_APP_RPC_URL: ${{ secrets.REACT_APP_RPC_URL }}
run: yarn --cwd python_web3_wallet/frontend build
- name: Cache frontend build
uses: actions/cache@v4
Expand Down
231 changes: 116 additions & 115 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "python-web3-wallet"
version = "0.0.15"
version = "0.0.16"
description = "Streamlit component that allows users to connect a wallet and send transactions with dynamic recipients and amounts"
authors = ["Gnosis AI <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion python_web3_wallet/README
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Run [app.py](app.py) with Streamlit - edit [PythonWeb3Wallet](frontend/src/Pytho

1. Build frontend
```
npm run build --prefix python_web3_wallet/frontend
yarn --cwd python_web3_wallet/frontend build
```

2. Publish Python package
Expand Down
3 changes: 2 additions & 1 deletion python_web3_wallet/frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PORT=3001
BROWSER=none
REACT_APP_DEBUG_VARIABLE=false
REACT_APP_RAINBOW_PROJECT_ID=
REACT_APP_RAINBOW_PROJECT_ID=
REACT_APP_RPC_URL=http://localhost:8545
17 changes: 11 additions & 6 deletions python_web3_wallet/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@
"dependencies": {
"@rainbow-me/rainbowkit": "^2.2.1",
"@tanstack/react-query": "^5.62.7",
"@types/node": "^12.20.55",
"@types/react": "^16.14.62",
"@types/react-dom": "^16.9.25",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"streamlit-component-lib": "^2.0.0",
"viem": "~2.21.55",
"react-scripts": "5.0.1",
"streamlit-component-lib": "^2.0.0",
"typescript": "5.5.2",
"@types/node": "^12.20.55",
"@types/react": "^16.14.62",
"@types/react-dom": "^16.9.25",
"viem": "~2.21.55",
"wagmi": "^2.14.1"
},
"scripts": {
"dev": "GENERATE_SOURCEMAP=false react-scripts start",
"start": "GENERATE_SOURCEMAP=false react-scripts start",
"build": "GENERATE_SOURCEMAP=false react-scripts build",
"test": "react-scripts test --transformIgnorePatterns \"node_modules/(?!@rainbow-me)/\"",
"format-check": "prettier --check \"src/**/*.ts\"",
"format-write": "prettier --write \"src/**/*.ts\"",
"eject": "react-scripts eject"
},
"eslintConfig": {
Expand All @@ -38,5 +40,8 @@
"last 1 safari version"
]
},
"homepage": "."
"homepage": ".",
"devDependencies": {
"prettier": "^3.4.2"
}
}
38 changes: 19 additions & 19 deletions python_web3_wallet/frontend/src/abi.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// Abi from AgentCommunicationContract - see https://gnosisscan.io/address/0xd422e0059ed819e8d792af936da206878188e34f#code
export const abi = [
{
"type": "function",
"name": "sendMessage",
"inputs": [
{
"name": "agentAddress",
"type": "address",
"internalType": "address"
},
{
"name": "message",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [],
"stateMutability": "payable"
},
] as const
{
type: "function",
name: "sendMessage",
inputs: [
{
name: "agentAddress",
type: "address",
internalType: "address",
},
{
name: "message",
type: "bytes",
internalType: "bytes",
},
],
outputs: [],
stateMutability: "payable",
},
] as const
3 changes: 2 additions & 1 deletion python_web3_wallet/frontend/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const AGENT_COMMUNICATION_CONTRACT = '0xd422e0059ed819e8d792af936da206878188e34f';
export const AGENT_COMMUNICATION_CONTRACT =
"0xe9dd78FF297DbaAbe5D0E45aE554a4B561935DE9"
36 changes: 20 additions & 16 deletions python_web3_wallet/frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@ import ReactDOM from "react-dom";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { getDefaultConfig, RainbowKitProvider } from "@rainbow-me/rainbowkit";
import { WagmiProvider } from "wagmi";
import { gnosis } from "wagmi/chains";
import { Chain, gnosis } from "wagmi/chains";
import PythonWeb3Wallet from "./PythonWeb3Wallet";

const queryClient = new QueryClient();

// for using with forked-Gnosis chain
// const gnosisFoundryLocalhost = {
// id: 99,
// name: 'Gnosis-Fork',
// nativeCurrency: { name: 'Ether', symbol: 'xDAI', decimals: 18 },
// rpcUrls: {
// default: { http: ['http://127.0.0.1:8545'] },
// },
// } as const satisfies Chain;
const gnosisRemoteAnvil = {
id: 8564,
name: 'Gnosis-Fork',
nativeCurrency: {
name: 'xDAI',
symbol: 'XDAI',
decimals: 18
},
rpcUrls: {
default: { http: [process.env.REACT_APP_RPC_URL!] },
},
} as const satisfies Chain;

console.log('debug', process.env.REACT_APP_DEBUG_VARIABLE);

Expand All @@ -25,17 +29,17 @@ const config = getDefaultConfig({
projectId: process.env.REACT_APP_RAINBOW_PROJECT_ID!,
chains: [
gnosis,
//gnosisFoundryLocalhost
gnosisRemoteAnvil
],
});

ReactDOM.render(
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<RainbowKitProvider>
<PythonWeb3Wallet />
</RainbowKitProvider>
</QueryClientProvider>
</WagmiProvider>,
<QueryClientProvider client={queryClient}>
<RainbowKitProvider>
<PythonWeb3Wallet />
</RainbowKitProvider>
</QueryClientProvider>
</WagmiProvider>,
document.getElementById("root")
)
10 changes: 5 additions & 5 deletions python_web3_wallet/frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8294,11 +8294,6 @@ node-addon-api@^7.0.0:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-7.1.1.tgz#1aba6693b0f255258a049d621329329322aad558"
integrity sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==

node-env@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/node-env/-/node-env-0.1.6.tgz#dc6570f0f912e58a9e7b72beeed2602ecfd63e21"
integrity sha512-rsDgeMTG8e5yRv4lllatqj/fKtMHt2H8RUQW1EuBL2p2t7Gbj8oa6MVns8v/f9a3Yl0IN5G2MurTc+E00V1qUw==

node-fetch-native@^1.6.4:
version "1.6.4"
resolved "https://registry.yarnpkg.com/node-fetch-native/-/node-fetch-native-1.6.4.tgz#679fc8fd8111266d47d7e72c379f1bed9acff06e"
Expand Down Expand Up @@ -9410,6 +9405,11 @@ prelude-ls@~1.1.2:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==

prettier@^3.4.2:
version "3.4.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.4.2.tgz#a5ce1fb522a588bf2b78ca44c6e6fe5aa5a2b13f"
integrity sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==

pretty-bytes@^5.3.0, pretty-bytes@^5.4.1:
version "5.6.0"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"
Expand Down

0 comments on commit b491e04

Please sign in to comment.