3️⃣API Examples
Before integrating, ensure you have:
✅ A wallet that supports the target blockchain (Base, Polygon, Avalanche, or Solana)
✅ USDC tokens for API payments (if required by the endpoint)
✅ An HTTP client library (axios, fetch, etc.)
✅ Web3 library for transaction signing (ethers.js, web3.js, or @solana/web3.js)
Integration Steps
Step 1: Send Initial Query
Send a POST request with your natural language command:
const response = await fetch("http://api.hashhunter.app/api/process", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
messages: [
{
role: "user",
content: "Send 10 USDC to 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
},
],
wallet: "0xYourWalletAddress",
chain: "base",
}),
});
const data = await response.json();
console.log(data.operationId); // Save this for next stepsResponse:
Step 2: Request Payment Information
Using the operationId from Step 1, request payment details:
Response (402 Payment Required):
Step 3: Make Payment (X402 Protocol)
Generate the X402 payment proof. This typically involves:
Creating a payment transaction to the
payToaddressIncluding the required metadata
Signing with your wallet
Generating the payment proof string
Note: The X402 payment implementation depends on your client library. Refer to X402 Documentation for detailed implementation.
Step 4: Verify Payment & Get Transaction
Send the payment proof to retrieve your transaction:
Response:
Step 5: Execute Transaction
Execute the transaction using your Web3 library:
For EVM Chains (Base, Polygon, Avalanche)
For Solana
Last updated