Skip to content
Draft
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
15 changes: 15 additions & 0 deletions .github/workflows/etherscan-apiv2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ on:
- transaction
- contract
- ens_resolve
- eth_blockNumber
ens_name:
description: 'ENS name to resolve (default: kushmanmb.eth)'
required: false
Expand Down Expand Up @@ -214,6 +215,13 @@ jobs:
DATA="0x70a08231000000000000000000000000${QUERY_ADDRESS#0x}"
PARAMS="&to=${RESOLVER_CONTRACT}&data=${DATA}&tag=latest"
;;
"eth_blockNumber")
# Get current Ethereum block number
echo "Fetching current Ethereum block number..."
MODULE="proxy"
ACTION="eth_blockNumber"
PARAMS=""
;;
*)
MODULE="account"
ACTION="balance"
Expand All @@ -225,6 +233,13 @@ jobs:
echo "Target Address: ${TARGET_ADDRESS}"
echo "ENS Name: ${ENS_NAME}"

# Build API URL
if [ "${ENDPOINT}" = "ens_resolve" ] || [ "${ENDPOINT}" = "eth_blockNumber" ]; then
# Use v2 API for proxy calls (matching problem statement)
api_url="https://api.etherscan.io/v2/api?chainid=1&module=${MODULE}&action=${ACTION}${PARAMS}"
else
api_url="${BASE_URL}?module=${MODULE}&action=${ACTION}${PARAMS}"
fi
# Build API URL - All endpoints now use V2 API
api_url="${BASE_URL}?chainid=1&module=${MODULE}&action=${ACTION}${PARAMS}"

Expand Down
5 changes: 4 additions & 1 deletion ENS_CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ console.log('kushmanmb.eth resolves to:', address);
#### 2. Via Etherscan API

```bash
# Using Etherscan V2 API with eth_call (as specified in problem statement)
# Using Etherscan V2 API with eth_call
curl "https://api.etherscan.io/v2/api?chainid=1&module=proxy&action=eth_call&to=0xAEEF46DB4855E25702F8237E8f403FddcaF931C0&data=0x70a08231000000000000000000000000e16359506c028e51f16be38986ec5746251e9724&tag=latest&apikey=YourApiKeyToken"

# Get current Ethereum block number
curl "https://api.etherscan.io/v2/api?chainid=1&module=proxy&action=eth_blockNumber&apikey=YourApiKeyToken"
```

#### 3. Via ENS Registry Contract
Expand Down
10 changes: 7 additions & 3 deletions QUICKSTART_KUSHMANMB_ETH.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This guide provides quick instructions for using the kushmanmb.eth ENS integrati
- `transaction` - Get transaction history
- `contract` - Get contract ABI (if applicable)
- `ens_resolve` - Resolve ENS name via eth_call
- `eth_blockNumber` - Get current Ethereum block number
- **ENS name**: Keep default `kushmanmb.eth` or enter another ENS name
5. **Click "Run workflow"** green button

Expand All @@ -36,12 +37,15 @@ The workflow will:
5. Commit and push the data files back to the repository
6. Generate a summary in the workflow run

### Example: Fetching Account Balance
### Example API Calls

The curl command from the problem statement is now integrated:
The following Etherscan API calls are supported:

```bash
# This is automatically executed in the workflow:
# Get current Ethereum block number
curl "https://api.etherscan.io/v2/api?chainid=1&module=proxy&action=eth_blockNumber&apikey=<YOUR_KEY>"

# Query via eth_call (automatically executed in the workflow)
curl "https://api.etherscan.io/v2/api?chainid=1&module=proxy&action=eth_call&to=0xAEEF46DB4855E25702F8237E8f403FddcaF931C0&data=0x70a08231000000000000000000000000e16359506c028e51f16be38986ec5746251e9724&tag=latest&apikey=<YOUR_KEY>"
```

Expand Down
Loading