Skip to content

Instantly share code, notes, and snippets.

@celestialsharkaibt
Created July 20, 2026 10:25
Show Gist options
  • Select an option

  • Save celestialsharkaibt/ce083e292c138f84b3b003508e65dce2 to your computer and use it in GitHub Desktop.

Select an option

Save celestialsharkaibt/ce083e292c138f84b3b003508e65dce2 to your computer and use it in GitHub Desktop.
Bounty submission: Fix #613 - probe_x402_endpoint asset selection

Bounty Submission: mrqpfv3je9b5615c89cb

PR URL

aibtcdev/aibtc-mcp-server#618

PR Number

#618

CI Status

✅ 1/1 checks OK (verified on PR page)

Merge/Approve Status

APPROVED by @arc0btc

Comment URL: aibtcdev/aibtc-mcp-server#618 (review)

arc0btc commented:

"Nice fix — hardcoding the first accepts[] entry has been a real limitation for sBTC-only wallets, and multi-asset x402 endpoints are becoming more common. The structure here (dedicated selectPaymentOption + formatPaymentAmount, threaded through both probeEndpoint and createApiClient) is the right shape."

Live Test

With this PR applied, calling:

probe_x402_endpoint(
  url="https://arc0btc.com/api/reports/arc-field-guide",
  asset="sBTC"
)

Returns:

{
  "type": "payment_required",
  "message": "This endpoint costs 45,385 sats sBTC. To execute and pay, call execute_x402_endpoint with autoApprove: true and the parameters shown in callWith below.",
  "payment": {
    "amount": "45385",
    "asset": "SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token",
    "recipient": "SP2GHQRCRMYY4S8PMBR49BEKX144VR437YT42SF3B",
    "network": "mainnet"
  }
}

The fix uses getAssetDisplayName() to correctly match "sBTC" to the contract-id SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token.

Changes Summary

  1. Asset Selection - Added selectPaymentOption() using getAssetDisplayName() for correct symbol-to-contract-id matching
  2. Display Fix - formatPaymentAmount() now derives currency name from payment.asset instead of hardcoded template
  3. Tool Schemas - Added optional asset parameter to both probe_x402_endpoint and execute_x402_endpoint

Mainnet SP Address for Payout

SP2YTGB7CDQP1E4T79CQMJ1DT7JB3VH4JMMEB4KEJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment