@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
50 lines • 2.29 kB
TypeScript
import type { CdpSmartAccount, CdpSolanaAccount } from "../../x402/account-signers.js";
import type { PaymentPayload, PaymentRequired } from "@x402/core/types";
import type { ClientEvmSigner } from "@x402/evm";
/**
* Options for signing an x402 payment payload.
*/
export interface SignX402PaymentOptions {
/** The x402 payment requirements returned by a resource server. */
paymentRequired: PaymentRequired;
/**
* Index into `paymentRequired.accepts` selecting which requirement to sign.
*/
acceptedIndex: number;
}
/**
* Signs an x402 payment payload with an EVM server account (EOA).
*
* Registers the exact and upto EVM schemes locally using the x402 SDK, then
* calls `x402Client.createPaymentPayload`. No CDP signing endpoint is used.
*
* @param account - The CDP EVM server account.
* @param options - The x402 payment requirements and selected accepted index.
* @returns The signed x402 payment payload.
*/
export declare function signEvmX402Payment(account: ClientEvmSigner, options: SignX402PaymentOptions): Promise<PaymentPayload>;
/**
* Signs an x402 payment payload with an EVM smart account.
*
* The smart-account adapter derives the CDP network from the EIP-712 domain's
* `chainId`, so no explicit network parameter is needed on the call site.
*
* Smart accounts produce an ERC-1271/ERC-6492 contract signature, which only
* settles via the EIP-3009 `exact` flow. The `upto` scheme and the Permit2
* transfer method are rejected because they require an on-chain Permit2
* allowance owned by an EOA.
*
* @param account - The CDP EVM smart account.
* @param options - The x402 payment requirements and selected accepted index.
* @returns The signed x402 payment payload.
*/
export declare function signEvmSmartAccountX402Payment(account: CdpSmartAccount, options: SignX402PaymentOptions): Promise<PaymentPayload>;
/**
* Signs an x402 payment payload with a Solana account.
*
* @param account - The CDP Solana account.
* @param options - The x402 payment requirements and selected accepted index.
* @returns The signed x402 payment payload.
*/
export declare function signSolanaX402Payment(account: CdpSolanaAccount, options: SignX402PaymentOptions): Promise<PaymentPayload>;
//# sourceMappingURL=signX402Payment.d.ts.map