@@ -53,12 +53,16 @@ export WESTEND_BLOCK_EXPLORER_URL="https://blockscout-asset-hub.parity-chains-sc
5353export PASSET_HUB_WS_URL=" wss://testnet-passet-hub.polkadot.io"
5454export PASSET_HUB_ETH_HTTP_URL=" https://testnet-passet-hub-eth-rpc.polkadot.io"
5555
56- export PASSEO_HUB_ETH_HTTP_URL=https://services.polkadothub-rpc.com/testnet
56+ export PASEO_HUB_WS_URL=" wss://sys.ibp.network/asset-hub-paseo"
57+ export PASEO_HUB_ETH_HTTP_URL=https://services.polkadothub-rpc.com/testnet
5758
5859# Kusama Asset Hub Substrate RPC endpoint
5960export KSM_WS_URL=" wss://kusama-asset-hub-rpc.polkadot.io"
6061export KSM_ETH_HTTP_URL=" https://kusama-asset-hub-eth-rpc.polkadot.io"
6162
63+ export POLKADOT_ETH_HTTP_URL=" https://eth-rpc.polkadot.io"
64+ export POLKADOT_BLOCK_EXPLORER_URL=" https://blockscout.polkadot.io"
65+
6266# Validates that POLKADOT_SDK_DIR exists and is a valid polkadot-sdk checkout
6367function validate_polkadot_sdk_dir() {
6468 local sdk_dir=" $1 "
@@ -83,7 +87,7 @@ function validate_polkadot_sdk_dir() {
8387# Follows development setup from https://github.com/pgherveou/mitmproxy/blob/main/CONTRIBUTING.md
8488# Usage: install_mitmproxy
8589function install_mitmproxy() {
86- local mitmproxy_dir=" $HOME /mitmproxy"
90+ local mitmproxy_dir=" $HOME /github/ mitmproxy"
8791
8892 echo " Installing mitmproxy fork from https://github.com/pgherveou/mitmproxy..."
8993
@@ -157,27 +161,45 @@ function install_mitmproxy() {
157161}
158162
159163# Starts mitmproxy in a new tmux window
160- # Usage: start_mitmproxy [listen_port:proxy_port]
164+ # Usage: start_mitmproxy [listen_port:target] ...
161165# Examples:
162- # start_mitmproxy - Start with default ports 8000:8545
163- # start_mitmproxy 9944:8844 - Start listening on 9944, proxying to 8844
166+ # start_mitmproxy - Start with default ports 8000:8545
167+ # start_mitmproxy 9944:8844 - Start listening on 9944, proxying to localhost:8844
168+ # start_mitmproxy 8545:https://example.com - Proxy to remote URL
169+ # start_mitmproxy 8000:8545 8545:https://testnet.polkadot.io - Multiple reverse proxies
164170function start_mitmproxy() {
165- local ports=" ${1:- 8000: 8545} "
166- IFS=" :" read listen_port proxy_port <<< " $ports"
171+ pkill -f " python.*mitmproxy" 2> /dev/null || true
172+
173+ # Build mode arguments for each mapping
174+ local mode_args=" "
175+ local mappings=(" $@ " )
176+ [[ ${# mappings[@]} -eq 0 ]] && mappings=(" 8000:8545" )
167177
168- pkill -f mitmproxy
178+ for mapping in " ${mappings[@]} " ; do
179+ local listen_port=" ${mapping%%:* } "
180+ local target=" ${mapping#*: } "
181+
182+ # If target is just a number, assume localhost
183+ if [[ " $target " =~ ^[0-9]+$ ]]; then
184+ target=" http://localhost:${target} "
185+ fi
186+
187+ mode_args+=" --mode reverse:${target} @${listen_port} "
188+ done
169189
170190 # Check if tmux is installed
171191 if ! command -v tmux & > /dev/null; then
172192 echo " tmux is not installed. Please run this command in a new terminal:"
173193 echo " "
174- echo " cd $HOME /mitmproxy && source venv/bin/activate && mitmproxy --listen-port $listen_port --mode reverse:http://localhost: ${proxy_port } -s $HOME /mitmproxy/scripts/json-rpc.py"
194+ echo " cd $HOME /github/ mitmproxy && source venv/bin/activate && mitmproxy${mode_args } -s $HOME /github /mitmproxy/scripts/json-rpc.py"
175195 echo " "
176196 return 0
177197 fi
178198
179199 tmux kill-window -t mitmproxy 2> /dev/null
180- tmux new-window -d -n mitmproxy " cd $HOME /mitmproxy; source venv/bin/activate; mitmproxy --listen-port $listen_port --mode reverse:http://localhost:${proxy_port} -s $HOME /mitmproxy/scripts/json-rpc.py; tmux wait-for -S mitmproxy-done"
200+ local cmd=" cd $HOME /github/mitmproxy && source venv/bin/activate && mitmproxy${mode_args} -s scripts/json-rpc.py"
201+ echo " Running: $cmd "
202+ tmux new-window -d -n mitmproxy " $cmd "
181203}
182204
183205# Manages the Polkadot Revive development node with various build and run options
@@ -1000,6 +1022,39 @@ function wait_for_eth_rpc() {
10001022 return 1
10011023}
10021024
1025+ # Funds the default development address from the geth dev account
1026+ # The default address (0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac) is used by the deploy scripts
1027+ # This sends 1000 ETH from geth's pre-funded dev account to the default address
1028+ # Usage: fund_default_address [url]
1029+ # Examples:
1030+ # fund_default_address - Use default URL http://localhost:8545
1031+ # fund_default_address http://localhost:8546 - Use custom URL
1032+ function fund_default_address() {
1033+ local eth_rpc_url=" ${1:- http:// localhost: 8545} "
1034+ local default_address=" 0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"
1035+ local endowment=" 1000ether"
1036+
1037+ echo " Funding default address $default_address with $endowment ..."
1038+
1039+ # Get the geth dev account (first account, pre-funded)
1040+ local dev_account
1041+ dev_account=$( cast rpc eth_accounts --rpc-url " $eth_rpc_url " 2> /dev/null | jq -r ' .[0]' )
1042+
1043+ if [ -z " $dev_account " ] || [ " $dev_account " = " null" ]; then
1044+ echo " Warning: Could not get geth dev account"
1045+ return 1
1046+ fi
1047+
1048+ # Send funds from dev account to default address
1049+ # In geth --dev mode, the dev account can send transactions without unlocking
1050+ if cast send " $default_address " --value " $endowment " --from " $dev_account " --unlocked --rpc-url " $eth_rpc_url " > /dev/null 2>&1 ; then
1051+ echo " Successfully funded $default_address with $endowment "
1052+ else
1053+ echo " Warning: Failed to fund default address"
1054+ return 1
1055+ fi
1056+ }
1057+
10031058# Manages the Westend Asset Hub runtime for testing Polkadot Revive contracts
10041059# Builds a custom chain spec with development accounts endowed with funds
10051060# Usage: westend [bacon|build|run] [--retester]
@@ -1150,10 +1205,10 @@ function cast_passet() {
11501205# Example:
11511206# cast_passet
11521207# cast send --value 0.1ether 0x... --private-key $PRIVATE_KEY
1153- function cast_passet () {
1208+ function cast_paseo () {
11541209 export ETH_FROM=" 0x3d26c9637dFaB74141bA3C466224C0DBFDfF4A63"
11551210 export PRIVATE_KEY=0x2286c61f76910500cb63395dc50b77f821ac9687297081593057a8da0c7d92ba
1156- export ETH_RPC_URL=$PASSEO_HUB_ETH_HTTP_URL
1211+ export ETH_RPC_URL=$PASEO_HUB_ETH_HTTP_URL
11571212
11581213 echo " Loading account $ETH_FROM "
11591214 echo " Setting ETH_RPC_URL to $ETH_RPC_URL "
@@ -1194,6 +1249,11 @@ function cast_kusama() {
11941249 echo " Setting ETH_RPC_URL to $ETH_RPC_URL "
11951250}
11961251
1252+ function cast_polkadot() {
1253+ export ETH_RPC_URL=$POLKADOT_ETH_HTTP_URL
1254+ echo " Setting ETH_RPC_URL to $ETH_RPC_URL "
1255+ }
1256+
11971257# Manages the Passet Hub runtime for testing (custom parachain)
11981258# Builds a custom chain spec with development accounts endowed with funds
11991259# Requires ~/github/passet-hub repository to be checked out
@@ -1562,6 +1622,10 @@ function geth_stack() {
15621622 # Create new 'servers' window in detached mode
15631623 # Source shell config and run geth with specified mode
15641624 tmux new-window -d -n servers " $CURRENT_SHELL -c 'source $SHELL_RC ; geth-dev $mode $retester_flag ; exec \$ SHELL'"
1625+
1626+ # Wait for eth-rpc to be ready and fund the default address
1627+ wait_for_eth_rpc
1628+ fund_default_address
15651629}
15661630
15671631# Runs the complete Passet Hub stack (passet node + eth-rpc) in tmux window
0 commit comments