repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | /** |
| #2 | * x402 Payment Protocol |
| #3 | * |
| #4 | * Enables the automaton to make USDC micropayments via HTTP 402. |
| #5 | * Adapted from runtime-mcp/src/x402/index.ts |
| #6 | */ |
| #7 | import { type Address, type PrivateKeyAccount } from "viem"; |
| #8 | declare const USDC_ADDRESSES: Record<string, Address>; |
| #9 | type NetworkId = keyof typeof USDC_ADDRESSES; |
| #10 | interface PaymentRequirement { |
| #11 | scheme: string; |
| #12 | network: NetworkId; |
| #13 | maxAmountRequired: string; |
| #14 | payToAddress: Address; |
| #15 | requiredDeadlineSeconds: number; |
| #16 | usdcAddress: Address; |
| #17 | } |
| #18 | interface X402PaymentResult { |
| #19 | success: boolean; |
| #20 | response?: any; |
| #21 | error?: string; |
| #22 | status?: number; |
| #23 | } |
| #24 | export interface UsdcBalanceResult { |
| #25 | balance: number; |
| #26 | network: string; |
| #27 | ok: boolean; |
| #28 | error?: string; |
| #29 | } |
| #30 | /** |
| #31 | * Get the USDC balance for the automaton's wallet on a given network. |
| #32 | */ |
| #33 | export declare function getUsdcBalance(address: Address, network?: string): Promise<number>; |
| #34 | /** |
| #35 | * Get the USDC balance and read status details for diagnostics. |
| #36 | */ |
| #37 | export declare function getUsdcBalanceDetailed(address: Address, network?: string): Promise<UsdcBalanceResult>; |
| #38 | /** |
| #39 | * Check if a URL requires x402 payment. |
| #40 | */ |
| #41 | export declare function checkX402(url: string): Promise<PaymentRequirement | null>; |
| #42 | /** |
| #43 | * Fetch a URL with automatic x402 payment. |
| #44 | * If the endpoint returns 402, sign and pay, then retry. |
| #45 | */ |
| #46 | export declare function x402Fetch(url: string, account: PrivateKeyAccount, method?: string, body?: string, headers?: Record<string, string>): Promise<X402PaymentResult>; |
| #47 | export {}; |
| #48 | //# sourceMappingURL=x402.d.ts.map |