@z402-net/server
v0.1.0
Published
The provider side of z402 for x402 resource servers: the prepaid-voucher scheme and the start-up provider check
Maintainers
Readme
@z402-net/server
Documentation: https://z402.net/docs/reference/server (all z402 docs: https://z402.net/docs)
The provider side of z402 for x402 resource servers: PrepaidVoucherServerScheme, the prepaid-voucher scheme you register with the stock x402ResourceServer, and checkProvider, the start-up check that an API key and a pay-to address belong together.
pnpm add @z402-net/server @z402-net/protocol
pnpm add --save-exact @x402/[email protected]@x402/core is a peer dependency, pinned to exactly 2.28.0 (the declarations use its types). The example also imports NETWORK_REGTEST from @z402-net/protocol.
import { HTTPFacilitatorClient, x402ResourceServer } from "@x402/core/server";
import { NETWORK_REGTEST } from "@z402-net/protocol";
import { PrepaidVoucherServerScheme } from "@z402-net/server";
const payTo = "uregtest1...";
const server = new x402ResourceServer(new HTTPFacilitatorClient({ url: "https://facilitator.example" })).register(
NETWORK_REGTEST,
new PrepaidVoucherServerScheme({ payTo, network: NETWORK_REGTEST }),
);Source and issues: https://github.com/oynozan/z402
MIT licensed.
