mppx 0.8.17 → 0.8.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/README.md +15 -0
- package/dist/Challenge.js +21 -4
- package/dist/bin.js +3 -3
- package/dist/cli/THIRD-PARTY-LICENSES.txt +328 -0
- package/dist/cli/cli.js +253 -1505
- package/dist/cli/plugins/index.js +19 -5
- package/dist/cli/plugins/tempo.js +7 -3
- package/dist/cli/sessions/Manager.js +7 -4
- package/dist/cli/sessions/request.d.ts +2 -0
- package/dist/cli/sessions/request.js +18 -0
- package/dist/cli/sessions/store.js +28 -14
- package/dist/discovery/Discovery.js +2 -1
- package/dist/evm/client/Charge.js +8 -0
- package/dist/server/core.d.ts +9 -0
- package/dist/server/core.js +9 -0
- package/dist/stripe/server/Charge.js +2 -4
- package/dist/stripe/server/Methods.d.ts +2 -2
- package/dist/stripe/server/Methods.js +17 -11
- package/dist/stripe/server/internal/html.gen.d.ts +1 -1
- package/dist/stripe/server/internal/html.gen.js +1 -1
- package/dist/stripe/server/spt.d.ts +8 -0
- package/dist/stripe/server/spt.js +8 -0
- package/dist/tempo/Methods.d.ts +13 -0
- package/dist/tempo/Methods.js +14 -3
- package/dist/tempo/client/Charge.d.ts +3 -0
- package/dist/tempo/client/Charge.js +31 -9
- package/dist/tempo/client/Methods.d.ts +13 -0
- package/dist/tempo/internal/defaults.d.ts +11 -0
- package/dist/tempo/internal/defaults.js +11 -0
- package/dist/tempo/internal/machine-token-charge.d.ts +51 -0
- package/dist/tempo/internal/machine-token-charge.js +113 -0
- package/dist/tempo/internal/machine-token-session.d.ts +88 -0
- package/dist/tempo/internal/machine-token-session.js +173 -0
- package/dist/tempo/internal/signature-envelope.d.ts +14 -0
- package/dist/tempo/internal/signature-envelope.js +28 -0
- package/dist/tempo/legacy/client/ChannelOps.d.ts +2 -2
- package/dist/tempo/legacy/client/ChannelOps.js +11 -5
- package/dist/tempo/legacy/client/Session.d.ts +13 -1
- package/dist/tempo/legacy/client/Session.js +3 -3
- package/dist/tempo/legacy/client/SessionManager.d.ts +3 -1
- package/dist/tempo/legacy/client/SessionManager.js +2 -0
- package/dist/tempo/server/Charge.d.ts +3 -0
- package/dist/tempo/server/Charge.js +58 -17
- package/dist/tempo/server/Methods.d.ts +21 -4
- package/dist/tempo/server/Methods.js +8 -4
- package/dist/tempo/server/internal/html.gen.d.ts +1 -1
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/client/ChannelOps.d.ts +18 -3
- package/dist/tempo/session/client/ChannelOps.js +35 -6
- package/dist/tempo/session/client/ChannelStore.d.ts +0 -5
- package/dist/tempo/session/client/ChannelStore.js +2 -2
- package/dist/tempo/session/client/CredentialState.d.ts +17 -2
- package/dist/tempo/session/client/CredentialState.js +77 -76
- package/dist/tempo/session/client/Runtime.d.ts +4 -2
- package/dist/tempo/session/client/Runtime.js +21 -5
- package/dist/tempo/session/client/Session.d.ts +15 -3
- package/dist/tempo/session/client/Session.js +186 -63
- package/dist/tempo/session/client/SessionManager.d.ts +3 -1
- package/dist/tempo/session/client/SessionManager.js +35 -11
- package/dist/tempo/session/client/Transports.d.ts +2 -0
- package/dist/tempo/session/client/Transports.js +12 -2
- package/dist/tempo/session/precompile/Chain.d.ts +10 -2
- package/dist/tempo/session/precompile/Chain.js +50 -10
- package/dist/tempo/session/precompile/Protocol.d.ts +15 -0
- package/dist/tempo/session/precompile/Protocol.js +7 -0
- package/dist/tempo/session/precompile/Voucher.d.ts +3 -1
- package/dist/tempo/session/precompile/Voucher.js +6 -12
- package/dist/tempo/session/server/ChannelStore.d.ts +6 -0
- package/dist/tempo/session/server/ChannelStore.js +11 -4
- package/dist/tempo/session/server/CredentialVerification.d.ts +11 -9
- package/dist/tempo/session/server/CredentialVerification.js +185 -109
- package/dist/tempo/session/server/MeteredStream.d.ts +1 -1
- package/dist/tempo/session/server/MeteredStream.js +5 -4
- package/dist/tempo/session/server/RequestState.d.ts +19 -0
- package/dist/tempo/session/server/RequestState.js +61 -15
- package/dist/tempo/session/server/Session.d.ts +14 -2
- package/dist/tempo/session/server/Session.js +37 -6
- package/dist/tempo/session/server/Settlement.d.ts +11 -4
- package/dist/tempo/session/server/Settlement.js +53 -21
- package/dist/x402/client/Exact.d.ts +8 -0
- package/dist/x402/client/Exact.js +40 -10
- package/dist/x402/server/EvmCharge.d.ts +22 -0
- package/dist/x402/server/EvmCharge.js +23 -1
- package/package.json +15 -37
- package/dist/BodyDigest.d.ts.map +0 -1
- package/dist/BodyDigest.js.map +0 -1
- package/dist/Challenge.d.ts.map +0 -1
- package/dist/Challenge.js.map +0 -1
- package/dist/Constants.d.ts.map +0 -1
- package/dist/Constants.js.map +0 -1
- package/dist/Credential.d.ts.map +0 -1
- package/dist/Credential.js.map +0 -1
- package/dist/Errors.d.ts.map +0 -1
- package/dist/Errors.js.map +0 -1
- package/dist/Expires.d.ts.map +0 -1
- package/dist/Expires.js.map +0 -1
- package/dist/Html.d.ts.map +0 -1
- package/dist/Html.js.map +0 -1
- package/dist/Mcp.d.ts.map +0 -1
- package/dist/Mcp.js.map +0 -1
- package/dist/Method.d.ts.map +0 -1
- package/dist/Method.js.map +0 -1
- package/dist/PaymentRequest.d.ts.map +0 -1
- package/dist/PaymentRequest.js.map +0 -1
- package/dist/Receipt.d.ts.map +0 -1
- package/dist/Receipt.js.map +0 -1
- package/dist/Store.d.ts.map +0 -1
- package/dist/Store.js.map +0 -1
- package/dist/attestation/Client.d.ts.map +0 -1
- package/dist/attestation/Client.js.map +0 -1
- package/dist/attestation/Constants.d.ts.map +0 -1
- package/dist/attestation/Constants.js.map +0 -1
- package/dist/attestation/Server.d.ts.map +0 -1
- package/dist/attestation/Server.js.map +0 -1
- package/dist/attestation/Types.d.ts.map +0 -1
- package/dist/attestation/Types.js.map +0 -1
- package/dist/attestation/index.d.ts.map +0 -1
- package/dist/attestation/index.js.map +0 -1
- package/dist/attestation/internal/HttpMessageSignature.d.ts.map +0 -1
- package/dist/attestation/internal/HttpMessageSignature.js.map +0 -1
- package/dist/attestation/internal/SigningContext.d.ts.map +0 -1
- package/dist/attestation/internal/SigningContext.js.map +0 -1
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js.map +0 -1
- package/dist/cli/account.d.ts.map +0 -1
- package/dist/cli/account.js.map +0 -1
- package/dist/cli/cli.d.ts.map +0 -1
- package/dist/cli/cli.js.map +0 -1
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/internal.d.ts.map +0 -1
- package/dist/cli/internal.js.map +0 -1
- package/dist/cli/plugins/evm.d.ts.map +0 -1
- package/dist/cli/plugins/evm.js.map +0 -1
- package/dist/cli/plugins/index.d.ts.map +0 -1
- package/dist/cli/plugins/index.js.map +0 -1
- package/dist/cli/plugins/plugin.d.ts.map +0 -1
- package/dist/cli/plugins/plugin.js.map +0 -1
- package/dist/cli/plugins/stripe.d.ts.map +0 -1
- package/dist/cli/plugins/stripe.js.map +0 -1
- package/dist/cli/plugins/tempo.d.ts.map +0 -1
- package/dist/cli/plugins/tempo.js.map +0 -1
- package/dist/cli/sessions/Manager.d.ts.map +0 -1
- package/dist/cli/sessions/Manager.js.map +0 -1
- package/dist/cli/sessions/commands.d.ts.map +0 -1
- package/dist/cli/sessions/commands.js.map +0 -1
- package/dist/cli/sessions/request.d.ts.map +0 -1
- package/dist/cli/sessions/request.js.map +0 -1
- package/dist/cli/sessions/store.d.ts.map +0 -1
- package/dist/cli/sessions/store.js.map +0 -1
- package/dist/cli/utils.d.ts.map +0 -1
- package/dist/cli/utils.js.map +0 -1
- package/dist/cli/validate/challenge.d.ts.map +0 -1
- package/dist/cli/validate/challenge.js.map +0 -1
- package/dist/cli/validate/discovery.d.ts.map +0 -1
- package/dist/cli/validate/discovery.js.map +0 -1
- package/dist/cli/validate/helpers.d.ts.map +0 -1
- package/dist/cli/validate/helpers.js.map +0 -1
- package/dist/cli/validate/index.d.ts.map +0 -1
- package/dist/cli/validate/index.js.map +0 -1
- package/dist/cli/validate/messages.d.ts.map +0 -1
- package/dist/cli/validate/messages.js.map +0 -1
- package/dist/cli/validate/payment.d.ts.map +0 -1
- package/dist/cli/validate/payment.js.map +0 -1
- package/dist/client/Methods.d.ts.map +0 -1
- package/dist/client/Methods.js.map +0 -1
- package/dist/client/Mppx.d.ts.map +0 -1
- package/dist/client/Mppx.js.map +0 -1
- package/dist/client/Transport.d.ts.map +0 -1
- package/dist/client/Transport.js.map +0 -1
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/client/internal/Fetch.d.ts.map +0 -1
- package/dist/client/internal/Fetch.js.map +0 -1
- package/dist/client/internal/MethodChallenge.d.ts.map +0 -1
- package/dist/client/internal/MethodChallenge.js.map +0 -1
- package/dist/client/internal/MethodResponse.d.ts.map +0 -1
- package/dist/client/internal/MethodResponse.js.map +0 -1
- package/dist/client/internal/protocols/Mcp.d.ts.map +0 -1
- package/dist/client/internal/protocols/Mcp.js.map +0 -1
- package/dist/client/internal/protocols/Mpp.d.ts.map +0 -1
- package/dist/client/internal/protocols/Mpp.js.map +0 -1
- package/dist/client/internal/protocols/Protocol.d.ts.map +0 -1
- package/dist/client/internal/protocols/Protocol.js.map +0 -1
- package/dist/client/internal/protocols/Shared.d.ts.map +0 -1
- package/dist/client/internal/protocols/Shared.js.map +0 -1
- package/dist/client/internal/protocols/X402.d.ts.map +0 -1
- package/dist/client/internal/protocols/X402.js.map +0 -1
- package/dist/client/node.d.ts.map +0 -1
- package/dist/client/node.js.map +0 -1
- package/dist/discovery/Discovery.d.ts.map +0 -1
- package/dist/discovery/Discovery.js.map +0 -1
- package/dist/discovery/OpenApi.d.ts.map +0 -1
- package/dist/discovery/OpenApi.js.map +0 -1
- package/dist/discovery/Validate.d.ts.map +0 -1
- package/dist/discovery/Validate.js.map +0 -1
- package/dist/discovery/index.d.ts.map +0 -1
- package/dist/discovery/index.js.map +0 -1
- package/dist/discovery/internal/Metadata.d.ts.map +0 -1
- package/dist/discovery/internal/Metadata.js.map +0 -1
- package/dist/evm/Assets.d.ts.map +0 -1
- package/dist/evm/Assets.js.map +0 -1
- package/dist/evm/Chains.d.ts.map +0 -1
- package/dist/evm/Chains.js.map +0 -1
- package/dist/evm/Methods.d.ts.map +0 -1
- package/dist/evm/Methods.js.map +0 -1
- package/dist/evm/Types.d.ts.map +0 -1
- package/dist/evm/Types.js.map +0 -1
- package/dist/evm/client/Charge.d.ts.map +0 -1
- package/dist/evm/client/Charge.js.map +0 -1
- package/dist/evm/client/Methods.d.ts.map +0 -1
- package/dist/evm/client/Methods.js.map +0 -1
- package/dist/evm/client/index.d.ts.map +0 -1
- package/dist/evm/client/index.js.map +0 -1
- package/dist/evm/index.d.ts.map +0 -1
- package/dist/evm/index.js.map +0 -1
- package/dist/evm/server/Charge.d.ts.map +0 -1
- package/dist/evm/server/Charge.js.map +0 -1
- package/dist/evm/server/Methods.d.ts.map +0 -1
- package/dist/evm/server/Methods.js.map +0 -1
- package/dist/evm/server/index.d.ts.map +0 -1
- package/dist/evm/server/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/internal/AcceptPayment.d.ts.map +0 -1
- package/dist/internal/AcceptPayment.js.map +0 -1
- package/dist/internal/HeaderCodec.d.ts.map +0 -1
- package/dist/internal/HeaderCodec.js.map +0 -1
- package/dist/internal/constantTimeEqual.d.ts.map +0 -1
- package/dist/internal/constantTimeEqual.js.map +0 -1
- package/dist/internal/env.d.ts.map +0 -1
- package/dist/internal/env.js.map +0 -1
- package/dist/internal/types.d.ts.map +0 -1
- package/dist/internal/types.js.map +0 -1
- package/dist/mcp/client/McpClient.d.ts.map +0 -1
- package/dist/mcp/client/McpClient.js.map +0 -1
- package/dist/mcp/client/index.d.ts.map +0 -1
- package/dist/mcp/client/index.js.map +0 -1
- package/dist/mcp/server/Transport.d.ts.map +0 -1
- package/dist/mcp/server/Transport.js.map +0 -1
- package/dist/mcp/server/index.d.ts.map +0 -1
- package/dist/mcp/server/index.js.map +0 -1
- package/dist/middlewares/elysia.d.ts.map +0 -1
- package/dist/middlewares/elysia.js.map +0 -1
- package/dist/middlewares/express.d.ts.map +0 -1
- package/dist/middlewares/express.js.map +0 -1
- package/dist/middlewares/hono.d.ts.map +0 -1
- package/dist/middlewares/hono.js.map +0 -1
- package/dist/middlewares/internal/mppx.d.ts.map +0 -1
- package/dist/middlewares/internal/mppx.js.map +0 -1
- package/dist/middlewares/nextjs.d.ts.map +0 -1
- package/dist/middlewares/nextjs.js.map +0 -1
- package/dist/proxy/Proxy.d.ts.map +0 -1
- package/dist/proxy/Proxy.js.map +0 -1
- package/dist/proxy/Service.d.ts.map +0 -1
- package/dist/proxy/Service.js.map +0 -1
- package/dist/proxy/index.d.ts.map +0 -1
- package/dist/proxy/index.js.map +0 -1
- package/dist/proxy/internal/Headers.d.ts.map +0 -1
- package/dist/proxy/internal/Headers.js.map +0 -1
- package/dist/proxy/internal/Route.d.ts.map +0 -1
- package/dist/proxy/internal/Route.js.map +0 -1
- package/dist/proxy/services/anthropic.d.ts.map +0 -1
- package/dist/proxy/services/anthropic.js.map +0 -1
- package/dist/proxy/services/openai.d.ts.map +0 -1
- package/dist/proxy/services/openai.js.map +0 -1
- package/dist/proxy/services/stripe.d.ts.map +0 -1
- package/dist/proxy/services/stripe.js.map +0 -1
- package/dist/server/Methods.d.ts.map +0 -1
- package/dist/server/Methods.js.map +0 -1
- package/dist/server/Mppx.d.ts.map +0 -1
- package/dist/server/Mppx.js.map +0 -1
- package/dist/server/NodeListener.d.ts.map +0 -1
- package/dist/server/NodeListener.js.map +0 -1
- package/dist/server/Request.d.ts.map +0 -1
- package/dist/server/Request.js.map +0 -1
- package/dist/server/Response.d.ts.map +0 -1
- package/dist/server/Response.js.map +0 -1
- package/dist/server/Transport.d.ts.map +0 -1
- package/dist/server/Transport.js.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/server/internal/html/compose.main.gen.d.ts.map +0 -1
- package/dist/server/internal/html/compose.main.gen.js.map +0 -1
- package/dist/server/internal/html/config.d.ts.map +0 -1
- package/dist/server/internal/html/config.js.map +0 -1
- package/dist/server/internal/html/constants.d.ts.map +0 -1
- package/dist/server/internal/html/constants.js.map +0 -1
- package/dist/server/internal/html/serviceWorker.client.d.ts.map +0 -1
- package/dist/server/internal/html/serviceWorker.client.js.map +0 -1
- package/dist/server/internal/html/serviceWorker.gen.d.ts.map +0 -1
- package/dist/server/internal/html/serviceWorker.gen.js.map +0 -1
- package/dist/server/internal/scope.d.ts.map +0 -1
- package/dist/server/internal/scope.js.map +0 -1
- package/dist/stripe/Methods.d.ts.map +0 -1
- package/dist/stripe/Methods.js.map +0 -1
- package/dist/stripe/client/Charge.d.ts.map +0 -1
- package/dist/stripe/client/Charge.js.map +0 -1
- package/dist/stripe/client/Methods.d.ts.map +0 -1
- package/dist/stripe/client/Methods.js.map +0 -1
- package/dist/stripe/client/index.d.ts.map +0 -1
- package/dist/stripe/client/index.js.map +0 -1
- package/dist/stripe/index.d.ts.map +0 -1
- package/dist/stripe/index.js.map +0 -1
- package/dist/stripe/internal/constants.d.ts.map +0 -1
- package/dist/stripe/internal/constants.js.map +0 -1
- package/dist/stripe/internal/types.d.ts.map +0 -1
- package/dist/stripe/internal/types.js.map +0 -1
- package/dist/stripe/server/Charge.d.ts.map +0 -1
- package/dist/stripe/server/Charge.js.map +0 -1
- package/dist/stripe/server/Methods.d.ts.map +0 -1
- package/dist/stripe/server/Methods.js.map +0 -1
- package/dist/stripe/server/index.d.ts.map +0 -1
- package/dist/stripe/server/index.js.map +0 -1
- package/dist/stripe/server/internal/deposit-address.d.ts.map +0 -1
- package/dist/stripe/server/internal/deposit-address.js.map +0 -1
- package/dist/stripe/server/internal/html/types.d.ts.map +0 -1
- package/dist/stripe/server/internal/html/types.js.map +0 -1
- package/dist/stripe/server/internal/html.gen.d.ts.map +0 -1
- package/dist/stripe/server/internal/html.gen.js.map +0 -1
- package/dist/stripe/server/internal/record-payment.d.ts.map +0 -1
- package/dist/stripe/server/internal/record-payment.js.map +0 -1
- package/dist/stripe/server/internal/request.d.ts.map +0 -1
- package/dist/stripe/server/internal/request.js.map +0 -1
- package/dist/tap/Constants.d.ts.map +0 -1
- package/dist/tap/Constants.js.map +0 -1
- package/dist/tap/Types.d.ts.map +0 -1
- package/dist/tap/Types.js.map +0 -1
- package/dist/tap/client/index.d.ts.map +0 -1
- package/dist/tap/client/index.js.map +0 -1
- package/dist/tap/index.d.ts.map +0 -1
- package/dist/tap/index.js.map +0 -1
- package/dist/tap/server/index.d.ts.map +0 -1
- package/dist/tap/server/index.js.map +0 -1
- package/dist/tempo/Attribution.d.ts.map +0 -1
- package/dist/tempo/Attribution.js.map +0 -1
- package/dist/tempo/Methods.d.ts.map +0 -1
- package/dist/tempo/Methods.js.map +0 -1
- package/dist/tempo/Proof.d.ts.map +0 -1
- package/dist/tempo/Proof.js.map +0 -1
- package/dist/tempo/client/Charge.d.ts.map +0 -1
- package/dist/tempo/client/Charge.js.map +0 -1
- package/dist/tempo/client/Methods.d.ts.map +0 -1
- package/dist/tempo/client/Methods.js.map +0 -1
- package/dist/tempo/client/ResolveAccount.d.ts.map +0 -1
- package/dist/tempo/client/ResolveAccount.js.map +0 -1
- package/dist/tempo/client/Subscription.d.ts.map +0 -1
- package/dist/tempo/client/Subscription.js.map +0 -1
- package/dist/tempo/client/index.d.ts.map +0 -1
- package/dist/tempo/client/index.js.map +0 -1
- package/dist/tempo/index.d.ts.map +0 -1
- package/dist/tempo/index.js.map +0 -1
- package/dist/tempo/internal/account.d.ts.map +0 -1
- package/dist/tempo/internal/account.js.map +0 -1
- package/dist/tempo/internal/address.d.ts.map +0 -1
- package/dist/tempo/internal/address.js.map +0 -1
- package/dist/tempo/internal/auto-swap.d.ts.map +0 -1
- package/dist/tempo/internal/auto-swap.js.map +0 -1
- package/dist/tempo/internal/charge.d.ts.map +0 -1
- package/dist/tempo/internal/charge.js.map +0 -1
- package/dist/tempo/internal/defaults.d.ts.map +0 -1
- package/dist/tempo/internal/defaults.js.map +0 -1
- package/dist/tempo/internal/fee-payer.d.ts.map +0 -1
- package/dist/tempo/internal/fee-payer.js.map +0 -1
- package/dist/tempo/internal/fee-token.d.ts.map +0 -1
- package/dist/tempo/internal/fee-token.js.map +0 -1
- package/dist/tempo/internal/proof.d.ts.map +0 -1
- package/dist/tempo/internal/proof.js.map +0 -1
- package/dist/tempo/internal/selectors.d.ts.map +0 -1
- package/dist/tempo/internal/selectors.js.map +0 -1
- package/dist/tempo/internal/types.d.ts.map +0 -1
- package/dist/tempo/internal/types.js.map +0 -1
- package/dist/tempo/legacy/client/ChannelOps.d.ts.map +0 -1
- package/dist/tempo/legacy/client/ChannelOps.js.map +0 -1
- package/dist/tempo/legacy/client/Session.d.ts.map +0 -1
- package/dist/tempo/legacy/client/Session.js.map +0 -1
- package/dist/tempo/legacy/client/SessionManager.d.ts.map +0 -1
- package/dist/tempo/legacy/client/SessionManager.js.map +0 -1
- package/dist/tempo/legacy/client/index.d.ts.map +0 -1
- package/dist/tempo/legacy/client/index.js.map +0 -1
- package/dist/tempo/legacy/index.d.ts.map +0 -1
- package/dist/tempo/legacy/index.js.map +0 -1
- package/dist/tempo/legacy/session/Chain.d.ts.map +0 -1
- package/dist/tempo/legacy/session/Chain.js.map +0 -1
- package/dist/tempo/legacy/session/Channel.d.ts.map +0 -1
- package/dist/tempo/legacy/session/Channel.js.map +0 -1
- package/dist/tempo/legacy/session/Types.d.ts.map +0 -1
- package/dist/tempo/legacy/session/Types.js.map +0 -1
- package/dist/tempo/legacy/session/Voucher.d.ts.map +0 -1
- package/dist/tempo/legacy/session/Voucher.js.map +0 -1
- package/dist/tempo/legacy/session/escrow.abi.d.ts.map +0 -1
- package/dist/tempo/legacy/session/escrow.abi.js.map +0 -1
- package/dist/tempo/legacy/session/index.d.ts.map +0 -1
- package/dist/tempo/legacy/session/index.js.map +0 -1
- package/dist/tempo/server/Charge.d.ts.map +0 -1
- package/dist/tempo/server/Charge.js.map +0 -1
- package/dist/tempo/server/Methods.d.ts.map +0 -1
- package/dist/tempo/server/Methods.js.map +0 -1
- package/dist/tempo/server/Relay.d.ts.map +0 -1
- package/dist/tempo/server/Relay.js.map +0 -1
- package/dist/tempo/server/SponsorBudget.d.ts.map +0 -1
- package/dist/tempo/server/SponsorBudget.js.map +0 -1
- package/dist/tempo/server/Subscription.d.ts.map +0 -1
- package/dist/tempo/server/Subscription.js.map +0 -1
- package/dist/tempo/server/index.d.ts.map +0 -1
- package/dist/tempo/server/index.js.map +0 -1
- package/dist/tempo/server/internal/html.gen.d.ts.map +0 -1
- package/dist/tempo/server/internal/html.gen.js.map +0 -1
- package/dist/tempo/server/internal/request-body.d.ts.map +0 -1
- package/dist/tempo/server/internal/request-body.js.map +0 -1
- package/dist/tempo/server/internal/transport.d.ts.map +0 -1
- package/dist/tempo/server/internal/transport.js.map +0 -1
- package/dist/tempo/session/Snapshot.d.ts.map +0 -1
- package/dist/tempo/session/Snapshot.js.map +0 -1
- package/dist/tempo/session/client/ChannelOps.d.ts.map +0 -1
- package/dist/tempo/session/client/ChannelOps.js.map +0 -1
- package/dist/tempo/session/client/ChannelStore.d.ts.map +0 -1
- package/dist/tempo/session/client/ChannelStore.js.map +0 -1
- package/dist/tempo/session/client/CredentialState.d.ts.map +0 -1
- package/dist/tempo/session/client/CredentialState.js.map +0 -1
- package/dist/tempo/session/client/ReceiptCoordinator.d.ts.map +0 -1
- package/dist/tempo/session/client/ReceiptCoordinator.js.map +0 -1
- package/dist/tempo/session/client/Runtime.d.ts.map +0 -1
- package/dist/tempo/session/client/Runtime.js.map +0 -1
- package/dist/tempo/session/client/Session.d.ts.map +0 -1
- package/dist/tempo/session/client/Session.js.map +0 -1
- package/dist/tempo/session/client/SessionManager.d.ts.map +0 -1
- package/dist/tempo/session/client/SessionManager.js.map +0 -1
- package/dist/tempo/session/client/Transports.d.ts.map +0 -1
- package/dist/tempo/session/client/Transports.js.map +0 -1
- package/dist/tempo/session/client/index.d.ts.map +0 -1
- package/dist/tempo/session/client/index.js.map +0 -1
- package/dist/tempo/session/client/internal/SessionManager.d.ts.map +0 -1
- package/dist/tempo/session/client/internal/SessionManager.js.map +0 -1
- package/dist/tempo/session/index.d.ts.map +0 -1
- package/dist/tempo/session/index.js.map +0 -1
- package/dist/tempo/session/precompile/Chain.d.ts.map +0 -1
- package/dist/tempo/session/precompile/Chain.js.map +0 -1
- package/dist/tempo/session/precompile/Channel.d.ts.map +0 -1
- package/dist/tempo/session/precompile/Channel.js.map +0 -1
- package/dist/tempo/session/precompile/Protocol.d.ts.map +0 -1
- package/dist/tempo/session/precompile/Protocol.js.map +0 -1
- package/dist/tempo/session/precompile/Voucher.d.ts.map +0 -1
- package/dist/tempo/session/precompile/Voucher.js.map +0 -1
- package/dist/tempo/session/precompile/escrow.abi.d.ts.map +0 -1
- package/dist/tempo/session/precompile/escrow.abi.js.map +0 -1
- package/dist/tempo/session/precompile/index.d.ts.map +0 -1
- package/dist/tempo/session/precompile/index.js.map +0 -1
- package/dist/tempo/session/server/ChannelOps.d.ts.map +0 -1
- package/dist/tempo/session/server/ChannelOps.js.map +0 -1
- package/dist/tempo/session/server/ChannelStore.d.ts.map +0 -1
- package/dist/tempo/session/server/ChannelStore.js.map +0 -1
- package/dist/tempo/session/server/CredentialVerification.d.ts.map +0 -1
- package/dist/tempo/session/server/CredentialVerification.js.map +0 -1
- package/dist/tempo/session/server/MeteredStream.d.ts.map +0 -1
- package/dist/tempo/session/server/MeteredStream.js.map +0 -1
- package/dist/tempo/session/server/RequestState.d.ts.map +0 -1
- package/dist/tempo/session/server/RequestState.js.map +0 -1
- package/dist/tempo/session/server/Session.d.ts.map +0 -1
- package/dist/tempo/session/server/Session.js.map +0 -1
- package/dist/tempo/session/server/Settlement.d.ts.map +0 -1
- package/dist/tempo/session/server/Settlement.js.map +0 -1
- package/dist/tempo/session/server/Sse.d.ts.map +0 -1
- package/dist/tempo/session/server/Sse.js.map +0 -1
- package/dist/tempo/session/server/Transports.d.ts.map +0 -1
- package/dist/tempo/session/server/Transports.js.map +0 -1
- package/dist/tempo/session/server/Ws.d.ts.map +0 -1
- package/dist/tempo/session/server/Ws.js.map +0 -1
- package/dist/tempo/session/server/index.d.ts.map +0 -1
- package/dist/tempo/session/server/index.js.map +0 -1
- package/dist/tempo/subscription/KeyAuthorization.d.ts.map +0 -1
- package/dist/tempo/subscription/KeyAuthorization.js.map +0 -1
- package/dist/tempo/subscription/Receipt.d.ts.map +0 -1
- package/dist/tempo/subscription/Receipt.js.map +0 -1
- package/dist/tempo/subscription/Store.d.ts.map +0 -1
- package/dist/tempo/subscription/Store.js.map +0 -1
- package/dist/tempo/subscription/Types.d.ts.map +0 -1
- package/dist/tempo/subscription/Types.js.map +0 -1
- package/dist/tempo/subscription/index.d.ts.map +0 -1
- package/dist/tempo/subscription/index.js.map +0 -1
- package/dist/validation/core.d.ts.map +0 -1
- package/dist/validation/core.js.map +0 -1
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/viem/Account.d.ts.map +0 -1
- package/dist/viem/Account.js.map +0 -1
- package/dist/viem/Client.d.ts.map +0 -1
- package/dist/viem/Client.js.map +0 -1
- package/dist/web-bot-auth/Constants.d.ts.map +0 -1
- package/dist/web-bot-auth/Constants.js.map +0 -1
- package/dist/web-bot-auth/Types.d.ts.map +0 -1
- package/dist/web-bot-auth/Types.js.map +0 -1
- package/dist/web-bot-auth/client/index.d.ts.map +0 -1
- package/dist/web-bot-auth/client/index.js.map +0 -1
- package/dist/web-bot-auth/index.d.ts.map +0 -1
- package/dist/web-bot-auth/index.js.map +0 -1
- package/dist/web-bot-auth/internal/JwkThumbprint.d.ts.map +0 -1
- package/dist/web-bot-auth/internal/JwkThumbprint.js.map +0 -1
- package/dist/web-bot-auth/internal/SignatureAgent.d.ts.map +0 -1
- package/dist/web-bot-auth/internal/SignatureAgent.js.map +0 -1
- package/dist/web-bot-auth/server/index.d.ts.map +0 -1
- package/dist/web-bot-auth/server/index.js.map +0 -1
- package/dist/x402/Assets.d.ts.map +0 -1
- package/dist/x402/Assets.js.map +0 -1
- package/dist/x402/Header.d.ts.map +0 -1
- package/dist/x402/Header.js.map +0 -1
- package/dist/x402/Types.d.ts.map +0 -1
- package/dist/x402/Types.js.map +0 -1
- package/dist/x402/client/Exact.d.ts.map +0 -1
- package/dist/x402/client/Exact.js.map +0 -1
- package/dist/x402/index.d.ts.map +0 -1
- package/dist/x402/index.js.map +0 -1
- package/dist/x402/internal/ChallengeBrand.d.ts.map +0 -1
- package/dist/x402/internal/ChallengeBrand.js.map +0 -1
- package/dist/x402/internal/RouteBinding.d.ts.map +0 -1
- package/dist/x402/internal/RouteBinding.js.map +0 -1
- package/dist/x402/server/EvmCharge.d.ts.map +0 -1
- package/dist/x402/server/EvmCharge.js.map +0 -1
- package/dist/x402/server/Facilitator.d.ts.map +0 -1
- package/dist/x402/server/Facilitator.js.map +0 -1
- package/dist/zod.d.ts.map +0 -1
- package/dist/zod.js.map +0 -1
- package/src/BodyDigest.test.ts +0 -43
- package/src/BodyDigest.ts +0 -55
- package/src/Challenge.fuzz.test.ts +0 -154
- package/src/Challenge.test-d.ts +0 -82
- package/src/Challenge.test.ts +0 -1060
- package/src/Challenge.ts +0 -687
- package/src/Constants.ts +0 -58
- package/src/Credential.fuzz.test.ts +0 -62
- package/src/Credential.test.ts +0 -378
- package/src/Credential.ts +0 -217
- package/src/Errors.test.ts +0 -520
- package/src/Errors.ts +0 -448
- package/src/Expires.test.ts +0 -112
- package/src/Expires.ts +0 -59
- package/src/Html.ts +0 -67
- package/src/Mcp.ts +0 -85
- package/src/Method.test.ts +0 -177
- package/src/Method.ts +0 -631
- package/src/PaymentRequest.test.ts +0 -147
- package/src/PaymentRequest.ts +0 -108
- package/src/Receipt.test.ts +0 -151
- package/src/Receipt.ts +0 -146
- package/src/Store.test-d.ts +0 -211
- package/src/Store.test.ts +0 -407
- package/src/Store.ts +0 -397
- package/src/attestation/Attestation.integration.test.ts +0 -208
- package/src/attestation/Client.test.ts +0 -83
- package/src/attestation/Client.ts +0 -34
- package/src/attestation/Constants.ts +0 -15
- package/src/attestation/Server.test.ts +0 -60
- package/src/attestation/Server.ts +0 -12
- package/src/attestation/Types.test-d.ts +0 -54
- package/src/attestation/Types.ts +0 -77
- package/src/attestation/index.ts +0 -5
- package/src/attestation/internal/HttpMessageSignature.test.ts +0 -101
- package/src/attestation/internal/HttpMessageSignature.ts +0 -429
- package/src/attestation/internal/SigningContext.ts +0 -13
- package/src/bin.js +0 -2
- package/src/bin.ts +0 -4
- package/src/cli/account.ts +0 -269
- package/src/cli/cli.test.ts +0 -2221
- package/src/cli/cli.ts +0 -1650
- package/src/cli/config.test.ts +0 -89
- package/src/cli/config.ts +0 -50
- package/src/cli/internal.ts +0 -114
- package/src/cli/mcp.test.ts +0 -262
- package/src/cli/plugins/evm.ts +0 -55
- package/src/cli/plugins/index.ts +0 -4
- package/src/cli/plugins/plugin.ts +0 -84
- package/src/cli/plugins/stripe.ts +0 -174
- package/src/cli/plugins/tempo.ts +0 -1102
- package/src/cli/sessions/Manager.test.ts +0 -249
- package/src/cli/sessions/Manager.ts +0 -93
- package/src/cli/sessions/commands.ts +0 -444
- package/src/cli/sessions/request.test.ts +0 -51
- package/src/cli/sessions/request.ts +0 -353
- package/src/cli/sessions/store.test.ts +0 -581
- package/src/cli/sessions/store.ts +0 -940
- package/src/cli/utils.test.ts +0 -156
- package/src/cli/utils.ts +0 -394
- package/src/cli/validate/challenge.ts +0 -565
- package/src/cli/validate/discovery.test.ts +0 -435
- package/src/cli/validate/discovery.ts +0 -221
- package/src/cli/validate/helpers.ts +0 -166
- package/src/cli/validate/index.ts +0 -229
- package/src/cli/validate/messages.ts +0 -7
- package/src/cli/validate/payment.ts +0 -774
- package/src/cli/validate.test.ts +0 -843
- package/src/client/Methods.ts +0 -8
- package/src/client/Mppx.test-d.ts +0 -287
- package/src/client/Mppx.test.ts +0 -1065
- package/src/client/Mppx.ts +0 -487
- package/src/client/Transport.test.ts +0 -586
- package/src/client/Transport.ts +0 -170
- package/src/client/index.ts +0 -29
- package/src/client/internal/Fetch.browser.test.ts +0 -197
- package/src/client/internal/Fetch.test-d.ts +0 -109
- package/src/client/internal/Fetch.test.ts +0 -2336
- package/src/client/internal/Fetch.ts +0 -1075
- package/src/client/internal/MethodChallenge.ts +0 -35
- package/src/client/internal/MethodResponse.ts +0 -67
- package/src/client/internal/protocols/Mcp.test.ts +0 -220
- package/src/client/internal/protocols/Mcp.ts +0 -186
- package/src/client/internal/protocols/Mpp.ts +0 -21
- package/src/client/internal/protocols/Protocol.ts +0 -10
- package/src/client/internal/protocols/Shared.ts +0 -25
- package/src/client/internal/protocols/X402.ts +0 -46
- package/src/client/node.test.ts +0 -115
- package/src/client/node.ts +0 -247
- package/src/discovery/Discovery.test.ts +0 -214
- package/src/discovery/Discovery.ts +0 -105
- package/src/discovery/OpenApi.test.ts +0 -623
- package/src/discovery/OpenApi.ts +0 -192
- package/src/discovery/Validate.test.ts +0 -305
- package/src/discovery/Validate.ts +0 -77
- package/src/discovery/index.ts +0 -3
- package/src/discovery/internal/Metadata.ts +0 -51
- package/src/env.d.ts +0 -12
- package/src/evm/Assets.ts +0 -1
- package/src/evm/Chains.ts +0 -11
- package/src/evm/Methods.ts +0 -44
- package/src/evm/PublicInterface.test-d.ts +0 -134
- package/src/evm/Types.ts +0 -140
- package/src/evm/client/Charge.test.ts +0 -347
- package/src/evm/client/Charge.ts +0 -187
- package/src/evm/client/Methods.ts +0 -19
- package/src/evm/client/index.ts +0 -6
- package/src/evm/index.ts +0 -16
- package/src/evm/server/Charge.test.ts +0 -339
- package/src/evm/server/Charge.ts +0 -295
- package/src/evm/server/Methods.ts +0 -22
- package/src/evm/server/index.ts +0 -6
- package/src/index.ts +0 -14
- package/src/internal/AcceptPayment.test.ts +0 -347
- package/src/internal/AcceptPayment.ts +0 -366
- package/src/internal/HeaderCodec.ts +0 -36
- package/src/internal/changeset.test.ts +0 -106
- package/src/internal/constantTimeEqual.test.ts +0 -47
- package/src/internal/constantTimeEqual.ts +0 -10
- package/src/internal/env.test.ts +0 -42
- package/src/internal/env.ts +0 -49
- package/src/internal/types.test-d.ts +0 -21
- package/src/internal/types.ts +0 -479
- package/src/mcp/client/McpClient.integration.test.ts +0 -639
- package/src/mcp/client/McpClient.test-d.ts +0 -144
- package/src/mcp/client/McpClient.test.ts +0 -463
- package/src/mcp/client/McpClient.ts +0 -307
- package/src/mcp/client/McpClient.unit.test.ts +0 -135
- package/src/mcp/client/index.ts +0 -2
- package/src/mcp/server/Transport.test.ts +0 -191
- package/src/mcp/server/Transport.ts +0 -111
- package/src/mcp/server/index.ts +0 -1
- package/src/middlewares/elysia.test.ts +0 -285
- package/src/middlewares/elysia.ts +0 -116
- package/src/middlewares/express.test.ts +0 -361
- package/src/middlewares/express.ts +0 -140
- package/src/middlewares/hono.test.ts +0 -473
- package/src/middlewares/hono.ts +0 -153
- package/src/middlewares/internal/mppx.test.ts +0 -177
- package/src/middlewares/internal/mppx.ts +0 -67
- package/src/middlewares/nextjs.test.ts +0 -359
- package/src/middlewares/nextjs.ts +0 -107
- package/src/proxy/Proxy.test.ts +0 -1038
- package/src/proxy/Proxy.ts +0 -483
- package/src/proxy/Proxy.upstreamError.test.ts +0 -364
- package/src/proxy/Service.test.ts +0 -252
- package/src/proxy/Service.ts +0 -280
- package/src/proxy/index.ts +0 -6
- package/src/proxy/internal/Headers.test.ts +0 -139
- package/src/proxy/internal/Headers.ts +0 -66
- package/src/proxy/internal/Route.test.ts +0 -217
- package/src/proxy/internal/Route.ts +0 -64
- package/src/proxy/services/anthropic.test.ts +0 -132
- package/src/proxy/services/anthropic.ts +0 -53
- package/src/proxy/services/hooks.test-d.ts +0 -14
- package/src/proxy/services/hooks.test.ts +0 -44
- package/src/proxy/services/openai.test.ts +0 -157
- package/src/proxy/services/openai.ts +0 -60
- package/src/proxy/services/stripe.test.ts +0 -175
- package/src/proxy/services/stripe.ts +0 -59
- package/src/server/Methods.test-d.ts +0 -88
- package/src/server/Methods.test.ts +0 -69
- package/src/server/Methods.ts +0 -3
- package/src/server/Mppx.authorize.test.ts +0 -210
- package/src/server/Mppx.test-d.ts +0 -494
- package/src/server/Mppx.test.ts +0 -6711
- package/src/server/Mppx.ts +0 -2919
- package/src/server/NodeListener.test.ts +0 -293
- package/src/server/NodeListener.ts +0 -45
- package/src/server/Request.test.ts +0 -255
- package/src/server/Request.ts +0 -155
- package/src/server/Response.test.ts +0 -32
- package/src/server/Response.ts +0 -45
- package/src/server/Transport.test.ts +0 -598
- package/src/server/Transport.ts +0 -320
- package/src/server/index.ts +0 -9
- package/src/server/internal/html/compose.main.gen.ts +0 -2
- package/src/server/internal/html/compose.main.ts +0 -88
- package/src/server/internal/html/config.ts +0 -672
- package/src/server/internal/html/constants.ts +0 -28
- package/src/server/internal/html/serviceWorker.client.ts +0 -28
- package/src/server/internal/html/serviceWorker.gen.ts +0 -2
- package/src/server/internal/html/serviceWorker.ts +0 -27
- package/src/server/internal/html/tsconfig.compose.json +0 -8
- package/src/server/internal/html/tsconfig.worker.client.json +0 -8
- package/src/server/internal/html/tsconfig.worker.json +0 -8
- package/src/server/internal/scope.ts +0 -43
- package/src/stripe/Charge.integration.test.ts +0 -329
- package/src/stripe/Methods.test.ts +0 -62
- package/src/stripe/Methods.ts +0 -44
- package/src/stripe/client/Charge.test.ts +0 -205
- package/src/stripe/client/Charge.ts +0 -132
- package/src/stripe/client/Methods.ts +0 -37
- package/src/stripe/client/index.ts +0 -2
- package/src/stripe/index.ts +0 -1
- package/src/stripe/internal/constants.ts +0 -7
- package/src/stripe/internal/types.ts +0 -47
- package/src/stripe/server/Charge.test-d.ts +0 -81
- package/src/stripe/server/Charge.test.ts +0 -700
- package/src/stripe/server/Charge.ts +0 -487
- package/src/stripe/server/Methods.test-d.ts +0 -157
- package/src/stripe/server/Methods.test.ts +0 -403
- package/src/stripe/server/Methods.ts +0 -441
- package/src/stripe/server/index.ts +0 -2
- package/src/stripe/server/internal/deposit-address.ts +0 -57
- package/src/stripe/server/internal/html/main.ts +0 -165
- package/src/stripe/server/internal/html/node_modules/.bin/mppx +0 -22
- package/src/stripe/server/internal/html/node_modules/.bin/mppx.src +0 -22
- package/src/stripe/server/internal/html/package.json +0 -9
- package/src/stripe/server/internal/html/stripe-js-pure.d.ts +0 -7
- package/src/stripe/server/internal/html/tsconfig.json +0 -8
- package/src/stripe/server/internal/html/types.ts +0 -5
- package/src/stripe/server/internal/html.gen.ts +0 -2
- package/src/stripe/server/internal/record-payment.ts +0 -66
- package/src/stripe/server/internal/request.ts +0 -49
- package/src/tap/Constants.ts +0 -32
- package/src/tap/Tap.test.ts +0 -125
- package/src/tap/Types.ts +0 -11
- package/src/tap/client/index.ts +0 -54
- package/src/tap/index.ts +0 -4
- package/src/tap/server/index.ts +0 -48
- package/src/tempo/AccessKeyAuthorization.test.ts +0 -141
- package/src/tempo/Attribution.test.ts +0 -294
- package/src/tempo/Attribution.ts +0 -185
- package/src/tempo/Methods.test.ts +0 -425
- package/src/tempo/Methods.ts +0 -367
- package/src/tempo/Proof.conformance.test.ts +0 -146
- package/src/tempo/Proof.test-d.ts +0 -32
- package/src/tempo/Proof.test.ts +0 -40
- package/src/tempo/Proof.ts +0 -69
- package/src/tempo/PublicExports.test-d.ts +0 -130
- package/src/tempo/Subscription.integration.test.ts +0 -591
- package/src/tempo/client/Charge.test.ts +0 -501
- package/src/tempo/client/Charge.ts +0 -271
- package/src/tempo/client/Methods.ts +0 -45
- package/src/tempo/client/ResolveAccount.ts +0 -46
- package/src/tempo/client/Subscription.test.ts +0 -180
- package/src/tempo/client/Subscription.ts +0 -156
- package/src/tempo/client/index.ts +0 -17
- package/src/tempo/index.ts +0 -5
- package/src/tempo/internal/account.ts +0 -56
- package/src/tempo/internal/address.test.ts +0 -42
- package/src/tempo/internal/address.ts +0 -6
- package/src/tempo/internal/auto-swap.test.ts +0 -198
- package/src/tempo/internal/auto-swap.ts +0 -145
- package/src/tempo/internal/charge.test.ts +0 -66
- package/src/tempo/internal/charge.ts +0 -43
- package/src/tempo/internal/defaults.test.ts +0 -95
- package/src/tempo/internal/defaults.ts +0 -53
- package/src/tempo/internal/fee-payer.test.ts +0 -1177
- package/src/tempo/internal/fee-payer.ts +0 -808
- package/src/tempo/internal/fee-token.test.ts +0 -165
- package/src/tempo/internal/fee-token.ts +0 -72
- package/src/tempo/internal/proof.test.ts +0 -97
- package/src/tempo/internal/proof.ts +0 -87
- package/src/tempo/internal/selectors.ts +0 -10
- package/src/tempo/internal/types.ts +0 -19
- package/src/tempo/legacy/AccessKeyAuthorization.test.ts +0 -162
- package/src/tempo/legacy/README.md +0 -9
- package/src/tempo/legacy/client/ChannelOps.test.ts +0 -379
- package/src/tempo/legacy/client/ChannelOps.ts +0 -271
- package/src/tempo/legacy/client/Session.test.ts +0 -800
- package/src/tempo/legacy/client/Session.ts +0 -397
- package/src/tempo/legacy/client/SessionManager.test.ts +0 -468
- package/src/tempo/legacy/client/SessionManager.ts +0 -909
- package/src/tempo/legacy/client/index.ts +0 -6
- package/src/tempo/legacy/index.ts +0 -4
- package/src/tempo/legacy/session/Chain.test.ts +0 -1349
- package/src/tempo/legacy/session/Chain.ts +0 -830
- package/src/tempo/legacy/session/Channel.test.ts +0 -109
- package/src/tempo/legacy/session/Channel.ts +0 -51
- package/src/tempo/legacy/session/Types.ts +0 -91
- package/src/tempo/legacy/session/Voucher.test.ts +0 -410
- package/src/tempo/legacy/session/Voucher.ts +0 -183
- package/src/tempo/legacy/session/escrow.abi.ts +0 -760
- package/src/tempo/legacy/session/index.ts +0 -8
- package/src/tempo/server/AtomicStore.test-d.ts +0 -63
- package/src/tempo/server/Charge.test.ts +0 -6056
- package/src/tempo/server/Charge.ts +0 -1379
- package/src/tempo/server/Methods.ts +0 -86
- package/src/tempo/server/Relay.test.ts +0 -677
- package/src/tempo/server/Relay.ts +0 -297
- package/src/tempo/server/SponsorBudget.test.ts +0 -154
- package/src/tempo/server/SponsorBudget.ts +0 -219
- package/src/tempo/server/Sse.test.ts +0 -321
- package/src/tempo/server/Subscription.test.ts +0 -1944
- package/src/tempo/server/Subscription.ts +0 -1336
- package/src/tempo/server/index.ts +0 -12
- package/src/tempo/server/internal/html/main.ts +0 -115
- package/src/tempo/server/internal/html/node_modules/.bin/mppx +0 -22
- package/src/tempo/server/internal/html/node_modules/.bin/mppx.src +0 -22
- package/src/tempo/server/internal/html/package.json +0 -10
- package/src/tempo/server/internal/html/tsconfig.json +0 -8
- package/src/tempo/server/internal/html.gen.ts +0 -2
- package/src/tempo/server/internal/request-body.test.ts +0 -210
- package/src/tempo/server/internal/request-body.ts +0 -61
- package/src/tempo/server/internal/transport.test.ts +0 -922
- package/src/tempo/server/internal/transport.ts +0 -322
- package/src/tempo/session/README.md +0 -320
- package/src/tempo/session/Snapshot.test.ts +0 -41
- package/src/tempo/session/Snapshot.ts +0 -95
- package/src/tempo/session/client/ChannelOps.test.ts +0 -218
- package/src/tempo/session/client/ChannelOps.ts +0 -348
- package/src/tempo/session/client/ChannelStore.ts +0 -111
- package/src/tempo/session/client/CredentialState.test.ts +0 -789
- package/src/tempo/session/client/CredentialState.ts +0 -942
- package/src/tempo/session/client/ReceiptCoordinator.ts +0 -95
- package/src/tempo/session/client/Runtime.test.ts +0 -1104
- package/src/tempo/session/client/Runtime.ts +0 -1008
- package/src/tempo/session/client/Session.test.ts +0 -1355
- package/src/tempo/session/client/Session.ts +0 -420
- package/src/tempo/session/client/SessionManager.test.ts +0 -1899
- package/src/tempo/session/client/SessionManager.ts +0 -996
- package/src/tempo/session/client/Transports.test.ts +0 -1141
- package/src/tempo/session/client/Transports.ts +0 -1534
- package/src/tempo/session/client/index.ts +0 -40
- package/src/tempo/session/client/internal/SessionManager.ts +0 -36
- package/src/tempo/session/index.ts +0 -7
- package/src/tempo/session/precompile/Chain.integration.test.ts +0 -339
- package/src/tempo/session/precompile/Chain.test.ts +0 -1641
- package/src/tempo/session/precompile/Chain.ts +0 -1269
- package/src/tempo/session/precompile/Channel.test.ts +0 -147
- package/src/tempo/session/precompile/Channel.ts +0 -108
- package/src/tempo/session/precompile/Protocol.test.ts +0 -358
- package/src/tempo/session/precompile/Protocol.ts +0 -520
- package/src/tempo/session/precompile/Voucher.test.ts +0 -354
- package/src/tempo/session/precompile/Voucher.ts +0 -162
- package/src/tempo/session/precompile/escrow.abi.ts +0 -226
- package/src/tempo/session/precompile/index.ts +0 -33
- package/src/tempo/session/server/ChannelOps.test.ts +0 -129
- package/src/tempo/session/server/ChannelOps.ts +0 -157
- package/src/tempo/session/server/ChannelStore.test.ts +0 -1093
- package/src/tempo/session/server/ChannelStore.ts +0 -856
- package/src/tempo/session/server/CredentialVerification.test.ts +0 -299
- package/src/tempo/session/server/CredentialVerification.ts +0 -1087
- package/src/tempo/session/server/MeteredStream.ts +0 -99
- package/src/tempo/session/server/RequestState.test.ts +0 -574
- package/src/tempo/session/server/RequestState.ts +0 -507
- package/src/tempo/session/server/Session.integration.test.ts +0 -449
- package/src/tempo/session/server/Session.test.ts +0 -4247
- package/src/tempo/session/server/Session.ts +0 -669
- package/src/tempo/session/server/Settlement.test.ts +0 -345
- package/src/tempo/session/server/Settlement.ts +0 -527
- package/src/tempo/session/server/Sse.fuzz.test.ts +0 -138
- package/src/tempo/session/server/Sse.test.ts +0 -634
- package/src/tempo/session/server/Sse.ts +0 -261
- package/src/tempo/session/server/Transports.test.ts +0 -346
- package/src/tempo/session/server/Transports.ts +0 -256
- package/src/tempo/session/server/Ws.test.ts +0 -765
- package/src/tempo/session/server/Ws.ts +0 -391
- package/src/tempo/session/server/index.ts +0 -12
- package/src/tempo/subscription/KeyAuthorization.test.ts +0 -282
- package/src/tempo/subscription/KeyAuthorization.ts +0 -396
- package/src/tempo/subscription/Receipt.ts +0 -28
- package/src/tempo/subscription/Store.test.ts +0 -609
- package/src/tempo/subscription/Store.ts +0 -449
- package/src/tempo/subscription/Types.ts +0 -68
- package/src/tempo/subscription/index.ts +0 -23
- package/src/tsconfig.json +0 -10
- package/src/validation/core.ts +0 -386
- package/src/validation/index.ts +0 -11
- package/src/viem/Account.test.ts +0 -72
- package/src/viem/Account.ts +0 -30
- package/src/viem/Client.test.ts +0 -366
- package/src/viem/Client.ts +0 -93
- package/src/web-bot-auth/Constants.ts +0 -24
- package/src/web-bot-auth/Types.ts +0 -9
- package/src/web-bot-auth/WebBotAuth.test.ts +0 -182
- package/src/web-bot-auth/client/index.ts +0 -84
- package/src/web-bot-auth/index.ts +0 -6
- package/src/web-bot-auth/internal/JwkThumbprint.ts +0 -21
- package/src/web-bot-auth/internal/SignatureAgent.ts +0 -18
- package/src/web-bot-auth/server/index.ts +0 -113
- package/src/x402/Assets.test.ts +0 -253
- package/src/x402/Assets.ts +0 -221
- package/src/x402/Exact.e2e.test.ts +0 -488
- package/src/x402/Exact.localnet.test.ts +0 -475
- package/src/x402/Header.test.ts +0 -73
- package/src/x402/Header.ts +0 -79
- package/src/x402/PublicInterface.test-d.ts +0 -39
- package/src/x402/Types.ts +0 -248
- package/src/x402/client/Exact.test.ts +0 -309
- package/src/x402/client/Exact.ts +0 -186
- package/src/x402/index.ts +0 -6
- package/src/x402/internal/ChallengeBrand.ts +0 -14
- package/src/x402/internal/RouteBinding.ts +0 -18
- package/src/x402/server/EvmCharge.ts +0 -410
- package/src/x402/server/Facilitator.test.ts +0 -111
- package/src/x402/server/Facilitator.ts +0 -56
- package/src/zod.test.ts +0 -169
- package/src/zod.ts +0 -71
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import type * as Hex from 'ox/Hex'
|
|
2
|
-
import type { Address } from 'viem'
|
|
3
|
-
import {
|
|
4
|
-
prepareTransactionRequest,
|
|
5
|
-
sendCallsSync,
|
|
6
|
-
signTypedData,
|
|
7
|
-
signTransaction,
|
|
8
|
-
} from 'viem/actions'
|
|
9
|
-
import { Actions } from 'viem/tempo'
|
|
10
|
-
import { tempo as tempo_chain } from 'viem/tempo/chains'
|
|
11
|
-
|
|
12
|
-
import * as Credential from '../../Credential.js'
|
|
13
|
-
import * as Method from '../../Method.js'
|
|
14
|
-
import * as Account from '../../viem/Account.js'
|
|
15
|
-
import * as Client from '../../viem/Client.js'
|
|
16
|
-
import * as z from '../../zod.js'
|
|
17
|
-
import * as Attribution from '../Attribution.js'
|
|
18
|
-
import * as AutoSwap from '../internal/auto-swap.js'
|
|
19
|
-
import * as Charge_internal from '../internal/charge.js'
|
|
20
|
-
import * as defaults from '../internal/defaults.js'
|
|
21
|
-
import * as Proof from '../internal/proof.js'
|
|
22
|
-
import * as Methods from '../Methods.js'
|
|
23
|
-
import type * as AccountResolution from './ResolveAccount.js'
|
|
24
|
-
|
|
25
|
-
/** Runtime context accepted by the Tempo charge client method. */
|
|
26
|
-
export type ChargeContext = {
|
|
27
|
-
account?: Account.getResolver.Parameters['account'] | undefined
|
|
28
|
-
autoSwap?: AutoSwap.resolve.Value | undefined
|
|
29
|
-
mode?: Methods.ChargeMode | undefined
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const chargeContextSchema = z.object({
|
|
33
|
-
account: z.optional(z.custom<ChargeContext['account']>()),
|
|
34
|
-
autoSwap: z.optional(z.custom<ChargeContext['autoSwap']>()),
|
|
35
|
-
mode: z.optional(z.enum(Methods.chargeModes)),
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Creates a Tempo charge method intent for usage on the client.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```ts
|
|
43
|
-
* import { tempo } from 'mppx/client'
|
|
44
|
-
* import { privateKeyToAccount } from 'viem/accounts'
|
|
45
|
-
*
|
|
46
|
-
* const charge = tempo.charge({
|
|
47
|
-
* account: privateKeyToAccount('0x...'),
|
|
48
|
-
* })
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export function charge(parameters: charge.Parameters = {}) {
|
|
52
|
-
const { clientId } = parameters
|
|
53
|
-
const getClient = Client.getResolver({
|
|
54
|
-
chain: tempo_chain,
|
|
55
|
-
getClient: parameters.getClient,
|
|
56
|
-
rpcUrl: defaults.rpcUrl,
|
|
57
|
-
})
|
|
58
|
-
const getAccount = Account.getResolver({ account: parameters.account })
|
|
59
|
-
|
|
60
|
-
return Method.toClient(Methods.charge, {
|
|
61
|
-
context: chargeContextSchema,
|
|
62
|
-
|
|
63
|
-
async createCredential({ challenge, context }) {
|
|
64
|
-
// Chain pinning: reject a challenge whose chain ID conflicts with the
|
|
65
|
-
// pinned one, and sign on the pin when the challenge omits a chain ID.
|
|
66
|
-
const challengeChainId = challenge.request.methodDetails?.chainId
|
|
67
|
-
if (
|
|
68
|
-
parameters.expectedChainId !== undefined &&
|
|
69
|
-
challengeChainId !== undefined &&
|
|
70
|
-
challengeChainId !== parameters.expectedChainId
|
|
71
|
-
)
|
|
72
|
-
throw new Error(
|
|
73
|
-
`Chain ID mismatch: expected ${parameters.expectedChainId}, got ${challengeChainId}.`,
|
|
74
|
-
)
|
|
75
|
-
const resolvedChainId = challengeChainId ?? parameters.expectedChainId
|
|
76
|
-
const client = await getClient({ chainId: resolvedChainId })
|
|
77
|
-
const chainId = resolvedChainId ?? client.chain?.id
|
|
78
|
-
if (chainId === undefined)
|
|
79
|
-
throw new Error('No `chainId` provided. Pass a chain ID in the challenge or client.')
|
|
80
|
-
|
|
81
|
-
const { request } = challenge
|
|
82
|
-
const { amount, methodDetails } = request
|
|
83
|
-
const supportedModes = (methodDetails?.supportedModes as
|
|
84
|
-
| readonly Methods.ChargeMode[]
|
|
85
|
-
| undefined) ?? ['pull', 'push']
|
|
86
|
-
const defaultAccount = getAccount(client, context)
|
|
87
|
-
|
|
88
|
-
// Zero-amount: sign EIP-712 typed data instead of creating a transaction.
|
|
89
|
-
if (BigInt(amount) === 0n) {
|
|
90
|
-
const signature = await signTypedData(client, {
|
|
91
|
-
account: defaultAccount,
|
|
92
|
-
// `account` here is the signing account; the proof's bound payer is
|
|
93
|
-
// `account.address` (echoed in the credential `source` below).
|
|
94
|
-
...Proof.typedData({
|
|
95
|
-
account: defaultAccount.address,
|
|
96
|
-
chainId,
|
|
97
|
-
challengeId: challenge.id,
|
|
98
|
-
realm: challenge.realm,
|
|
99
|
-
}),
|
|
100
|
-
})
|
|
101
|
-
return Credential.serialize({
|
|
102
|
-
challenge,
|
|
103
|
-
payload: { signature, type: 'proof' },
|
|
104
|
-
source: Proof.proofSource({ address: defaultAccount.address, chainId }),
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const currency = request.currency as Address
|
|
109
|
-
if (parameters.expectedRecipients) {
|
|
110
|
-
const allowed = new Set(parameters.expectedRecipients.map((a) => a.toLowerCase()))
|
|
111
|
-
const splits = methodDetails?.splits as readonly { recipient: string }[] | undefined
|
|
112
|
-
if (splits) {
|
|
113
|
-
for (const split of splits) {
|
|
114
|
-
if (!allowed.has(split.recipient.toLowerCase()))
|
|
115
|
-
throw new Error(`Unexpected split recipient: ${split.recipient}`)
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
const memo = methodDetails?.memo
|
|
120
|
-
? (methodDetails.memo as Hex.Hex)
|
|
121
|
-
: Attribution.encode({ challengeId: challenge.id, clientId, serverId: challenge.realm })
|
|
122
|
-
const transfers = Charge_internal.getTransfers({
|
|
123
|
-
amount,
|
|
124
|
-
methodDetails: {
|
|
125
|
-
...methodDetails,
|
|
126
|
-
memo,
|
|
127
|
-
},
|
|
128
|
-
recipient: request.recipient as Address,
|
|
129
|
-
})
|
|
130
|
-
const transferCalls = transfers.map(
|
|
131
|
-
(transfer): AccountResolution.ResolveAccountCall =>
|
|
132
|
-
Actions.token.transfer.call(client, {
|
|
133
|
-
amount: BigInt(transfer.amount),
|
|
134
|
-
...(transfer.memo && { memo: transfer.memo as Hex.Hex }),
|
|
135
|
-
to: transfer.recipient as Address,
|
|
136
|
-
token: currency,
|
|
137
|
-
}),
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
const autoSwap = AutoSwap.resolve(
|
|
141
|
-
context?.autoSwap ?? parameters.autoSwap,
|
|
142
|
-
AutoSwap.defaultCurrencies,
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
const account =
|
|
146
|
-
(await parameters.resolveAccount?.({
|
|
147
|
-
account: defaultAccount,
|
|
148
|
-
chainId,
|
|
149
|
-
operation: {
|
|
150
|
-
kind: 'executeCalls',
|
|
151
|
-
...(autoSwap ? {} : { calls: transferCalls }),
|
|
152
|
-
},
|
|
153
|
-
})) ?? defaultAccount
|
|
154
|
-
|
|
155
|
-
const mode = (() => {
|
|
156
|
-
const explicitMode = context?.mode ?? parameters.mode
|
|
157
|
-
if (explicitMode) {
|
|
158
|
-
if (!supportedModes.includes(explicitMode))
|
|
159
|
-
throw new Error(`Challenge does not support ${explicitMode} mode.`)
|
|
160
|
-
return explicitMode
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const preferredMode = account.type === 'json-rpc' ? 'push' : 'pull'
|
|
164
|
-
if (supportedModes.includes(preferredMode)) return preferredMode
|
|
165
|
-
return supportedModes[0]!
|
|
166
|
-
})()
|
|
167
|
-
|
|
168
|
-
const swapCalls = autoSwap
|
|
169
|
-
? await AutoSwap.findCalls(client, {
|
|
170
|
-
account: account.address,
|
|
171
|
-
amountOut: BigInt(amount),
|
|
172
|
-
tokenOut: currency,
|
|
173
|
-
tokenIn: autoSwap.tokenIn,
|
|
174
|
-
slippage: autoSwap.slippage,
|
|
175
|
-
})
|
|
176
|
-
: undefined
|
|
177
|
-
|
|
178
|
-
const calls = [...(swapCalls ?? []), ...transferCalls]
|
|
179
|
-
|
|
180
|
-
const validBefore = (() => {
|
|
181
|
-
const defaultExpiry = Math.floor(Date.now() / 1000) + 25
|
|
182
|
-
if (!challenge.expires) return defaultExpiry
|
|
183
|
-
const challengeExpiry = Math.floor(new Date(challenge.expires).getTime() / 1000)
|
|
184
|
-
return Math.min(defaultExpiry, challengeExpiry)
|
|
185
|
-
})()
|
|
186
|
-
|
|
187
|
-
if (mode === 'push') {
|
|
188
|
-
const { receipts } = await sendCallsSync(client, {
|
|
189
|
-
account,
|
|
190
|
-
calls: calls as never,
|
|
191
|
-
experimental_fallback: true,
|
|
192
|
-
})
|
|
193
|
-
const hash = receipts?.[0]?.transactionHash
|
|
194
|
-
if (!hash) throw new Error('No transaction receipt returned.')
|
|
195
|
-
return Credential.serialize({
|
|
196
|
-
challenge,
|
|
197
|
-
payload: { hash, type: 'hash' },
|
|
198
|
-
source: Proof.proofSource({ address: account.address, chainId }),
|
|
199
|
-
})
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const prepared = await prepareTransactionRequest(client, {
|
|
203
|
-
account,
|
|
204
|
-
calls,
|
|
205
|
-
nonceKey: 'expiring',
|
|
206
|
-
validBefore,
|
|
207
|
-
} as never)
|
|
208
|
-
// Estimate before enabling fee-payer mode so Tempo includes sender
|
|
209
|
-
// signature and access-key verification costs in the gas budget.
|
|
210
|
-
prepared.gas = (prepared.gas ?? 0n) + 5_000n
|
|
211
|
-
if (methodDetails?.feePayer) {
|
|
212
|
-
const sponsored = prepared as Record<string, unknown>
|
|
213
|
-
delete sponsored.feePayerSignature
|
|
214
|
-
delete sponsored.feeToken
|
|
215
|
-
sponsored.feePayer = true
|
|
216
|
-
}
|
|
217
|
-
const signature = await signTransaction(client, prepared as never)
|
|
218
|
-
|
|
219
|
-
return Credential.serialize({
|
|
220
|
-
challenge,
|
|
221
|
-
payload: { signature, type: 'transaction' },
|
|
222
|
-
source: Proof.proofSource({ address: account.address, chainId }),
|
|
223
|
-
})
|
|
224
|
-
},
|
|
225
|
-
})
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export declare namespace charge {
|
|
229
|
-
type AutoSwap = AutoSwap.resolve.Value
|
|
230
|
-
type Context = ChargeContext
|
|
231
|
-
type ResolveAccount = AccountResolution.ResolveAccount
|
|
232
|
-
type ResolveAccountInfo = AccountResolution.ResolveAccountInfo
|
|
233
|
-
|
|
234
|
-
type Parameters = {
|
|
235
|
-
/**
|
|
236
|
-
* Automatically swap from a fallback currency (pathUsd, USDC.e) via the
|
|
237
|
-
* Tempo DEX when the user lacks sufficient balance of the target currency.
|
|
238
|
-
*
|
|
239
|
-
* @default false
|
|
240
|
-
*/
|
|
241
|
-
autoSwap?: AutoSwap | undefined
|
|
242
|
-
/** Client identifier used to derive the client fingerprint in attribution memos. */
|
|
243
|
-
clientId?: string | undefined
|
|
244
|
-
/**
|
|
245
|
-
* Chain ID this client is willing to pay on. When set, the client rejects
|
|
246
|
-
* any challenge whose `methodDetails.chainId` differs, and signs on this
|
|
247
|
-
* chain when the challenge omits a chain ID.
|
|
248
|
-
*/
|
|
249
|
-
expectedChainId?: number | undefined
|
|
250
|
-
/**
|
|
251
|
-
* Allowlist of expected split recipient addresses. When set, the client
|
|
252
|
-
* rejects any challenge whose split recipients are not in this list.
|
|
253
|
-
*/
|
|
254
|
-
expectedRecipients?: readonly Address[] | undefined
|
|
255
|
-
/**
|
|
256
|
-
* Controls how the charge transaction is submitted.
|
|
257
|
-
*
|
|
258
|
-
* - `'push'`: Client broadcasts the transaction and sends the tx hash to the server.
|
|
259
|
-
* - `'pull'`: Client signs the transaction and sends the serialized tx to the server for broadcast.
|
|
260
|
-
*
|
|
261
|
-
* If the server advertises `supportedModes`, this setting must be one of
|
|
262
|
-
* the supported values for the challenge.
|
|
263
|
-
*
|
|
264
|
-
* @default `'push'` for JSON-RPC accounts, `'pull'` for local accounts.
|
|
265
|
-
*/
|
|
266
|
-
mode?: Methods.ChargeMode | undefined
|
|
267
|
-
/** Selects the account that signs this charge after the challenge and chain are known. */
|
|
268
|
-
resolveAccount?: ResolveAccount | undefined
|
|
269
|
-
} & Account.getResolver.Parameters &
|
|
270
|
-
Client.getResolver.Parameters
|
|
271
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
session as sessionLegacyIntent_,
|
|
3
|
-
sessionManager as sessionLegacy_,
|
|
4
|
-
} from '../legacy/client/index.js'
|
|
5
|
-
import { session as sessionMethod_ } from '../session/client/Session.js'
|
|
6
|
-
import { sessionManager as session_ } from '../session/client/SessionManager.js'
|
|
7
|
-
import { charge as charge_ } from './Charge.js'
|
|
8
|
-
import { subscription as subscription_ } from './Subscription.js'
|
|
9
|
-
|
|
10
|
-
const sessionClient = Object.assign(sessionMethod_, { manager: session_ })
|
|
11
|
-
const sessionLegacyClient = Object.assign(sessionLegacy_, { method: sessionLegacyIntent_ })
|
|
12
|
-
|
|
13
|
-
/** Creates a TIP-1034 client method, with explicit managed lifecycle helpers attached. */
|
|
14
|
-
export { sessionClient as session }
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Creates the common Tempo `charge` and `session` client methods from shared parameters.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* import { Mppx, tempo } from 'mppx/client'
|
|
22
|
-
*
|
|
23
|
-
* const mppx = Mppx.create({
|
|
24
|
-
* methods: [tempo.common({ account })],
|
|
25
|
-
* })
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export function tempo(parameters: tempo.Parameters = {}) {
|
|
29
|
-
return [charge_(parameters), sessionClient(parameters)] as const
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export namespace tempo {
|
|
33
|
-
export type Parameters = charge_.Parameters & sessionMethod_.Parameters
|
|
34
|
-
|
|
35
|
-
/** Creates a Tempo `charge` client method for one-time TIP-20 token transfers. */
|
|
36
|
-
export const charge = charge_
|
|
37
|
-
/** Creates the common Tempo `charge` and `session` client methods from shared parameters. */
|
|
38
|
-
export const common = tempo
|
|
39
|
-
/** Creates a TIP-1034 client method for Mppx registration. Use `tempo.session.manager()` for direct lifecycle control. */
|
|
40
|
-
export const session = sessionClient
|
|
41
|
-
/** @deprecated Use `tempo.session()` for the TIP-1034 session client method. */
|
|
42
|
-
export const sessionLegacy = sessionLegacyClient
|
|
43
|
-
/** Creates a Tempo `subscription` client method for recurring TIP-20 payments. */
|
|
44
|
-
export const subscription = subscription_
|
|
45
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type * as Hex from 'ox/Hex'
|
|
2
|
-
import type { Account, Address } from 'viem'
|
|
3
|
-
|
|
4
|
-
import type { MaybePromise } from '../../internal/types.js'
|
|
5
|
-
|
|
6
|
-
/** Resolves the account that should satisfy an mppx account operation. */
|
|
7
|
-
export type ResolveAccount = (info: ResolveAccountInfo) => MaybePromise<Account | undefined>
|
|
8
|
-
|
|
9
|
-
/** Account-resolution details for a client credential operation. */
|
|
10
|
-
export type ResolveAccountInfo = {
|
|
11
|
-
/** Account mppx will use when the hook returns `undefined`. */
|
|
12
|
-
account: Account
|
|
13
|
-
/** EIP-155 chain ID used for the operation. */
|
|
14
|
-
chainId: number
|
|
15
|
-
/** Capability the selected account must satisfy. */
|
|
16
|
-
operation: ResolveAccountOperation
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** Capability an mppx-selected account must satisfy. */
|
|
20
|
-
export type ResolveAccountOperation =
|
|
21
|
-
| {
|
|
22
|
-
kind: 'executeCalls'
|
|
23
|
-
/**
|
|
24
|
-
* Exact EVM calls the selected account will execute.
|
|
25
|
-
*
|
|
26
|
-
* Omitted when the calls depend on which account is selected, such as
|
|
27
|
-
* account-balance-dependent auto-swap routing.
|
|
28
|
-
*/
|
|
29
|
-
calls?: readonly ResolveAccountCall[] | undefined
|
|
30
|
-
}
|
|
31
|
-
| {
|
|
32
|
-
kind: 'authorizePaymentChannel'
|
|
33
|
-
/**
|
|
34
|
-
* Signer required by an existing reusable channel. Omitted when opening
|
|
35
|
-
* a new channel or when no existing channel has fixed a signer yet.
|
|
36
|
-
*/
|
|
37
|
-
authority?: Address | undefined
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** EVM call data used by account resolvers for scoped account selection. */
|
|
41
|
-
export type ResolveAccountCall = {
|
|
42
|
-
/** Contract address being called. */
|
|
43
|
-
to: Address
|
|
44
|
-
/** Calldata being sent. */
|
|
45
|
-
data: Hex.Hex
|
|
46
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { Challenge, Credential } from 'mppx'
|
|
2
|
-
import { KeyAuthorization } from 'ox/tempo'
|
|
3
|
-
import { privateKeyToAccount } from 'viem/accounts'
|
|
4
|
-
import { describe, expect, test } from 'vp/test'
|
|
5
|
-
|
|
6
|
-
import * as Methods from '../Methods.js'
|
|
7
|
-
import {
|
|
8
|
-
signSubscriptionKeyAuthorization,
|
|
9
|
-
transferWithMemoSelector,
|
|
10
|
-
} from '../subscription/KeyAuthorization.js'
|
|
11
|
-
import type { SubscriptionAccessKey } from '../subscription/Types.js'
|
|
12
|
-
import { subscription } from './Subscription.js'
|
|
13
|
-
|
|
14
|
-
const chainId = 4217
|
|
15
|
-
const currency = '0x20c0000000000000000000000000000000000001'
|
|
16
|
-
const recipient = '0x1234567890abcdef1234567890abcdef12345678'
|
|
17
|
-
const selectedAccount = privateKeyToAccount(
|
|
18
|
-
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
19
|
-
)
|
|
20
|
-
const accessAccount = privateKeyToAccount(
|
|
21
|
-
'0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
22
|
-
)
|
|
23
|
-
const otherRootAccount = privateKeyToAccount(
|
|
24
|
-
'0x0000000000000000000000000000000000000000000000000000000000000003',
|
|
25
|
-
)
|
|
26
|
-
const accessKey = {
|
|
27
|
-
accessKeyAddress: accessAccount.address,
|
|
28
|
-
keyType: 'secp256k1',
|
|
29
|
-
} as const satisfies SubscriptionAccessKey
|
|
30
|
-
|
|
31
|
-
type SubscriptionRequest = ReturnType<typeof Methods.subscription.schema.request.parse>
|
|
32
|
-
|
|
33
|
-
function secondsFromNow(milliseconds: number) {
|
|
34
|
-
return new Date(Math.ceil((Date.now() + milliseconds) / 1_000) * 1_000).toISOString()
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function createChallenge(
|
|
38
|
-
overrides: Partial<Parameters<typeof Methods.subscription.schema.request.parse>[0]> = {},
|
|
39
|
-
): Challenge.Challenge<SubscriptionRequest, 'subscription', 'tempo'> {
|
|
40
|
-
const request = Methods.subscription.schema.request.parse({
|
|
41
|
-
accessKey,
|
|
42
|
-
amount: '1',
|
|
43
|
-
chainId,
|
|
44
|
-
currency,
|
|
45
|
-
decimals: 6,
|
|
46
|
-
periodCount: '1',
|
|
47
|
-
periodUnit: 'day',
|
|
48
|
-
recipient,
|
|
49
|
-
subscriptionExpires: secondsFromNow(86_400_000),
|
|
50
|
-
...overrides,
|
|
51
|
-
})
|
|
52
|
-
return Challenge.from({
|
|
53
|
-
id: 'test-challenge-id',
|
|
54
|
-
intent: 'subscription',
|
|
55
|
-
method: 'tempo',
|
|
56
|
-
realm: 'api.example.com',
|
|
57
|
-
request,
|
|
58
|
-
}) as Challenge.Challenge<SubscriptionRequest, 'subscription', 'tempo'>
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
describe('tempo.subscription client', () => {
|
|
62
|
-
test('uses Tempo testnet as the default subscription chain', async () => {
|
|
63
|
-
const challenge = createChallenge({ chainId: undefined })
|
|
64
|
-
const method = subscription({
|
|
65
|
-
account: selectedAccount,
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
const credential = Credential.deserialize(
|
|
69
|
-
await method.createCredential({ challenge, context: {} }),
|
|
70
|
-
)
|
|
71
|
-
const payload = Methods.subscription.schema.credential.payload.parse(credential.payload)
|
|
72
|
-
const authorization = KeyAuthorization.deserialize(payload.signature as `0x${string}`)
|
|
73
|
-
|
|
74
|
-
expect(authorization.chainId).toBe(42431n)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
test('can reject subscription expiry from custom request validation', async () => {
|
|
78
|
-
const challenge = createChallenge({
|
|
79
|
-
subscriptionExpires: secondsFromNow(2 * 86_400_000),
|
|
80
|
-
})
|
|
81
|
-
const method = subscription({
|
|
82
|
-
account: selectedAccount,
|
|
83
|
-
validateRequest: (request) => {
|
|
84
|
-
const maxExpiry = Date.now() + 86_400_000
|
|
85
|
-
if (new Date(request.subscriptionExpires).getTime() > maxExpiry) {
|
|
86
|
-
throw new Error('subscription expiry too late')
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
await expect(method.createCredential({ challenge, context: {} })).rejects.toThrow(
|
|
92
|
-
'subscription expiry too late',
|
|
93
|
-
)
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
test('runs custom request validation before authorizing the access key', async () => {
|
|
97
|
-
const challenge = createChallenge()
|
|
98
|
-
const method = subscription({
|
|
99
|
-
account: selectedAccount,
|
|
100
|
-
validateRequest: () => {
|
|
101
|
-
throw new Error('unexpected subscription request')
|
|
102
|
-
},
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
await expect(method.createCredential({ challenge, context: {} })).rejects.toThrow(
|
|
106
|
-
'unexpected subscription request',
|
|
107
|
-
)
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
test('passes hex-encoded `scopes` and `limits` to wallet_authorizeAccessKey', async () => {
|
|
111
|
-
const challenge = createChallenge()
|
|
112
|
-
const keyAuthorization = await signSubscriptionKeyAuthorization({
|
|
113
|
-
accessKey,
|
|
114
|
-
account: selectedAccount,
|
|
115
|
-
chainId,
|
|
116
|
-
request: challenge.request,
|
|
117
|
-
})
|
|
118
|
-
if (!keyAuthorization) throw new Error('expected key authorization')
|
|
119
|
-
|
|
120
|
-
let capturedParams: Record<string, unknown> | undefined
|
|
121
|
-
const method = subscription({
|
|
122
|
-
account: selectedAccount.address,
|
|
123
|
-
getClient: async () =>
|
|
124
|
-
({
|
|
125
|
-
request: async ({ params }: { params: readonly Record<string, unknown>[] }) => {
|
|
126
|
-
capturedParams = params[0]
|
|
127
|
-
return { keyAuthorization: KeyAuthorization.toRpc(keyAuthorization) }
|
|
128
|
-
},
|
|
129
|
-
}) as never,
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
await method.createCredential({ challenge, context: {} })
|
|
133
|
-
|
|
134
|
-
expect(capturedParams).toMatchObject({
|
|
135
|
-
address: accessKey.accessKeyAddress.toLowerCase(),
|
|
136
|
-
keyType: accessKey.keyType,
|
|
137
|
-
expiry: expect.any(Number),
|
|
138
|
-
limits: [
|
|
139
|
-
{
|
|
140
|
-
token: expect.stringMatching(/^0x[0-9a-fA-F]{40}$/),
|
|
141
|
-
limit: '0xf4240',
|
|
142
|
-
period: expect.any(Number),
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
scopes: [
|
|
146
|
-
{
|
|
147
|
-
address: expect.stringMatching(/^0x[0-9a-fA-F]{40}$/),
|
|
148
|
-
selector: transferWithMemoSelector,
|
|
149
|
-
recipients: expect.any(Array),
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
})
|
|
153
|
-
expect(capturedParams).not.toHaveProperty('allowedCalls')
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
test('rejects key authorizations signed by a different account', async () => {
|
|
157
|
-
const challenge = createChallenge()
|
|
158
|
-
const keyAuthorization = await signSubscriptionKeyAuthorization({
|
|
159
|
-
accessKey,
|
|
160
|
-
account: otherRootAccount,
|
|
161
|
-
chainId,
|
|
162
|
-
request: challenge.request,
|
|
163
|
-
})
|
|
164
|
-
if (!keyAuthorization) throw new Error('expected key authorization')
|
|
165
|
-
|
|
166
|
-
const method = subscription({
|
|
167
|
-
account: selectedAccount.address,
|
|
168
|
-
getClient: async () =>
|
|
169
|
-
({
|
|
170
|
-
request: async () => ({
|
|
171
|
-
keyAuthorization: KeyAuthorization.toRpc(keyAuthorization),
|
|
172
|
-
}),
|
|
173
|
-
}) as never,
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
await expect(method.createCredential({ challenge, context: {} })).rejects.toThrow(
|
|
177
|
-
'keyAuthorization signer does not match the selected account',
|
|
178
|
-
)
|
|
179
|
-
})
|
|
180
|
-
})
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { Hex } from 'ox'
|
|
2
|
-
import { KeyAuthorization } from 'ox/tempo'
|
|
3
|
-
import { isAddressEqual, type Address } from 'viem'
|
|
4
|
-
import { tempo as tempo_chain } from 'viem/tempo/chains'
|
|
5
|
-
|
|
6
|
-
import * as Credential from '../../Credential.js'
|
|
7
|
-
import type { MaybePromise } from '../../internal/types.js'
|
|
8
|
-
import * as Method from '../../Method.js'
|
|
9
|
-
import * as Account from '../../viem/Account.js'
|
|
10
|
-
import * as Client from '../../viem/Client.js'
|
|
11
|
-
import * as z from '../../zod.js'
|
|
12
|
-
import * as defaults from '../internal/defaults.js'
|
|
13
|
-
import * as Methods from '../Methods.js'
|
|
14
|
-
import {
|
|
15
|
-
getSubscriptionScopes,
|
|
16
|
-
signSubscriptionKeyAuthorization,
|
|
17
|
-
toSubscriptionExpiryDate,
|
|
18
|
-
toSubscriptionExpirySeconds,
|
|
19
|
-
toSubscriptionPeriodSeconds,
|
|
20
|
-
verifySubscriptionKeyAuthorization,
|
|
21
|
-
} from '../subscription/KeyAuthorization.js'
|
|
22
|
-
import type { SubscriptionAccessKey } from '../subscription/Types.js'
|
|
23
|
-
|
|
24
|
-
type SubscriptionRequest = ReturnType<typeof Methods.subscription.schema.request.parse>
|
|
25
|
-
|
|
26
|
-
/** Context accepted by the Tempo subscription client method. */
|
|
27
|
-
export const subscriptionContextSchema = z.object({
|
|
28
|
-
accessKey: z.optional(z.custom<SubscriptionAccessKey>()),
|
|
29
|
-
account: z.optional(z.custom<Account.getResolver.Parameters['account']>()),
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
/** Runtime context for creating a Tempo subscription credential. */
|
|
33
|
-
export type SubscriptionContext = z.infer<typeof subscriptionContextSchema>
|
|
34
|
-
|
|
35
|
-
/** Creates a Tempo subscription client method. */
|
|
36
|
-
export function subscription(parameters: subscription.Parameters = {}) {
|
|
37
|
-
const getClient = Client.getResolver({
|
|
38
|
-
chain: tempo_chain,
|
|
39
|
-
getClient: parameters.getClient,
|
|
40
|
-
rpcUrl: defaults.rpcUrl,
|
|
41
|
-
})
|
|
42
|
-
const getAccount = Account.getResolver({ account: parameters.account })
|
|
43
|
-
|
|
44
|
-
return Method.toClient(Methods.subscription, {
|
|
45
|
-
context: subscriptionContextSchema,
|
|
46
|
-
|
|
47
|
-
async createCredential({ challenge, context }) {
|
|
48
|
-
const chainId = challenge.request.methodDetails?.chainId ?? defaults.chainId.testnet
|
|
49
|
-
const client = await getClient({ chainId })
|
|
50
|
-
const account = getAccount(client, context)
|
|
51
|
-
const accessKey =
|
|
52
|
-
context?.accessKey ?? parameters.accessKey ?? challenge.request.methodDetails?.accessKey
|
|
53
|
-
if (!accessKey) {
|
|
54
|
-
throw new Error(
|
|
55
|
-
'No `accessKey` provided. The subscription challenge must include `accessKey`, or the client must pass one to parameters/context.',
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
assertSubscriptionRequestRepresentable(challenge.request)
|
|
60
|
-
await parameters.validateRequest?.(challenge.request)
|
|
61
|
-
|
|
62
|
-
const keyAuthorization = await authorizeAccessKey(client, {
|
|
63
|
-
accessKey,
|
|
64
|
-
account,
|
|
65
|
-
chainId,
|
|
66
|
-
request: challenge.request,
|
|
67
|
-
} as never)
|
|
68
|
-
|
|
69
|
-
const verified = verifySubscriptionKeyAuthorization({
|
|
70
|
-
accessKey,
|
|
71
|
-
chainId,
|
|
72
|
-
payload: {
|
|
73
|
-
signature: KeyAuthorization.serialize(keyAuthorization as never),
|
|
74
|
-
type: 'keyAuthorization',
|
|
75
|
-
},
|
|
76
|
-
request: challenge.request,
|
|
77
|
-
})
|
|
78
|
-
if (!isAddressEqual(verified.source.address, account.address)) {
|
|
79
|
-
throw new Error('keyAuthorization signer does not match the selected account')
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return Credential.serialize({
|
|
83
|
-
challenge,
|
|
84
|
-
payload: {
|
|
85
|
-
signature: KeyAuthorization.serialize(keyAuthorization as never),
|
|
86
|
-
type: 'keyAuthorization',
|
|
87
|
-
},
|
|
88
|
-
source: `did:pkh:eip155:${chainId}:${account.address.toLowerCase()}`,
|
|
89
|
-
})
|
|
90
|
-
},
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async function authorizeAccessKey(
|
|
95
|
-
client: Awaited<ReturnType<ReturnType<typeof Client.getResolver>>>,
|
|
96
|
-
parameters: {
|
|
97
|
-
accessKey: SubscriptionAccessKey
|
|
98
|
-
account: Account.Account
|
|
99
|
-
chainId: number
|
|
100
|
-
request: Pick<
|
|
101
|
-
SubscriptionRequest,
|
|
102
|
-
'amount' | 'currency' | 'periodCount' | 'periodUnit' | 'recipient' | 'subscriptionExpires'
|
|
103
|
-
>
|
|
104
|
-
},
|
|
105
|
-
) {
|
|
106
|
-
const { accessKey, account, chainId, request } = parameters
|
|
107
|
-
|
|
108
|
-
const local = await signSubscriptionKeyAuthorization({
|
|
109
|
-
accessKey,
|
|
110
|
-
account,
|
|
111
|
-
chainId,
|
|
112
|
-
request,
|
|
113
|
-
})
|
|
114
|
-
if (local) return local
|
|
115
|
-
|
|
116
|
-
const result = (await client.request({
|
|
117
|
-
method: 'wallet_authorizeAccessKey',
|
|
118
|
-
params: [
|
|
119
|
-
{
|
|
120
|
-
address: accessKey.accessKeyAddress,
|
|
121
|
-
expiry: toSubscriptionExpirySeconds(toSubscriptionExpiryDate(request.subscriptionExpires)),
|
|
122
|
-
keyType: accessKey.keyType,
|
|
123
|
-
limits: [
|
|
124
|
-
{
|
|
125
|
-
token: request.currency as Address,
|
|
126
|
-
limit: Hex.fromNumber(BigInt(request.amount)),
|
|
127
|
-
period: toSubscriptionPeriodSeconds(request),
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
scopes: getSubscriptionScopes(request),
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
} as never)) as {
|
|
134
|
-
keyAuthorization: Parameters<typeof KeyAuthorization.fromRpc>[0]
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return KeyAuthorization.fromRpc(result.keyAuthorization)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function assertSubscriptionRequestRepresentable(request: SubscriptionRequest) {
|
|
141
|
-
toSubscriptionPeriodSeconds(request)
|
|
142
|
-
toSubscriptionExpirySeconds(toSubscriptionExpiryDate(request.subscriptionExpires))
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export declare namespace subscription {
|
|
146
|
-
/** Parameters for creating a Tempo subscription credential. */
|
|
147
|
-
type Parameters = Account.getResolver.Parameters &
|
|
148
|
-
Client.getResolver.Parameters & {
|
|
149
|
-
accessKey?: SubscriptionAccessKey | undefined
|
|
150
|
-
validateRequest?:
|
|
151
|
-
| ((
|
|
152
|
-
request: ReturnType<typeof Methods.subscription.schema.request.parse>,
|
|
153
|
-
) => MaybePromise<void>)
|
|
154
|
-
| undefined
|
|
155
|
-
}
|
|
156
|
-
}
|