mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-04 09:58:22 +08:00
feat: route nofxos data API calls through claw402 x402 payment
When CLAW402_WALLET_KEY env var is set, all nofxos.ai data API calls (AI500, OI rankings, NetFlow, price rankings) are automatically routed through claw402.ai with x402 USDC micropayment. - provider/nofxos/claw402.go: x402 GET request client for data APIs - provider/nofxos/client.go: claw402 mode support in doRequest() - kernel/engine.go: auto-detect CLAW402_WALLET_KEY and enable routing - mcp/payment/x402.go: MakeClaw402SignFunc helper Without CLAW402_WALLET_KEY, falls back to direct nofxos.ai (backward compat).
This commit is contained in:
@@ -81,6 +81,13 @@ func X402DecodeHeader(b64 string) ([]byte, error) {
|
||||
return decoded, nil
|
||||
}
|
||||
|
||||
// MakeClaw402SignFunc creates an X402SignFunc from a private key for claw402 payments.
|
||||
func MakeClaw402SignFunc(privateKey *ecdsa.PrivateKey) X402SignFunc {
|
||||
return func(paymentHeaderB64 string) (string, error) {
|
||||
return SignBasePaymentHeader(privateKey, paymentHeaderB64, "Claw402")
|
||||
}
|
||||
}
|
||||
|
||||
// SignBasePaymentHeader decodes a base64 x402 header, parses it, and signs with
|
||||
// EIP-712 (USDC TransferWithAuthorization).
|
||||
func SignBasePaymentHeader(privateKey *ecdsa.PrivateKey, paymentHeaderB64 string, providerName string) (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user