Method.toClient
Extend a method with client logic
Extends a payment method with client-side Credential creation logic.
Usage
import { } from 'mppx/client'
import { , } from 'mppx'
import * as from './methods'
// Create client-configured method.
const = .(., {
async ({ }) {
const = { : '0x...', : 'transaction' as }
return .({ , })
},
})
// Create Mppx client with the method configured.
.({
: [],
})import { , } from 'mppx'
export const = .({
: 'charge',
: 'tempo',
: {
: {
: .({
: .(),
: .('transaction'),
}),
},
: .({
: .(),
: .(),
: .(),
}),
},
})Return type
type ReturnType = Method.Client<method, context>A client-configured method that can be passed to Mppx.create.
Parameters
context (optional)
- Type:
ZodMiniType
Zod schema for additional context passed to createCredential.
createCredential
- Type:
(parameters: { challenge: Challenge; context?: context }) => Promise<string>
Function that creates a serialized Credential string from a Challenge.
method
- Type:
Method
The base payment method definition (created with Method.from).