@agentpay-sui/facilitator
v0.1.0
Published
Self-hostable AgentPay facilitator for Sui x402 payments.
Readme
@agentpay-sui/facilitator
Self-hostable AgentPay facilitator for Sui x402 payments.
The facilitator exposes:
POST /verify: validatePaymentAuth, tool binding, nonce state, wallet ownership, allowance, and balancePOST /settle: submit the Sui PTB that settles payment, mints a receipt, and optionally consumes a feedback right for reputation
Run
agentpay-facilitatorRequired environment:
AGENTPAY_NETWORK=sui:testnet
AGENTPAY_PACKAGE_ID=0x...
AGENTPAY_NONCE_REGISTRY_ID=0x...
AGENTPAY_REPUTATION_REGISTRY_ID=0x...
AGENTPAY_FACILITATOR_PRIVATE_KEY=suiprivkey...
AGENTPAY_TOOLS_JSON='[{"toolId":"0x...","expectedPayee":"0x...","coinType":"0x2::sui::SUI","defaultAgentId":"0x...","defaultWalletId":"0x..."}]'Optional native Sui gas sponsorship:
AGENTPAY_SPONSOR_PRIVATE_KEY=suiprivkey...
AGENTPAY_SPONSOR_GAS_BUDGET=50000000
AGENTPAY_SPONSOR_GAS_COIN_LIMIT=8When sponsor env is set, the facilitator builds a Sui sponsored transaction: the facilitator signer remains the transaction sender, the sponsor wallet owns the gas payment, and the transaction is submitted with both signatures.
Embed
import {
FacilitatorService,
createFacilitatorApp,
} from "@agentpay-sui/facilitator";
const service = new FacilitatorService(config);
const app = createFacilitatorApp(service);
app.listen(8080);