import { type Base64EncodedWireTransaction, type TransactionSigner } from '@solana/kit'; import { Method } from 'mppx'; /** * Creates a Solana `charge` method for usage on the client. * * Supports two modes controlled by the `broadcast` option: * * - **Pull mode** (`broadcast: false`, default): Signs the transaction * and sends the serialized bytes as a `type="transaction"` credential. * The server broadcasts it to the Solana network. * * - **Push mode** (`broadcast: true`): Signs, broadcasts, confirms * the transaction on-chain, and sends the signature as a `type="signature"` * credential. Cannot be used with fee sponsorship. * * When the server advertises `feePayer: true` in the challenge, the client * sets the server's `feePayerKey` as the transaction fee payer and partially * signs (transfer authority only). The server adds its fee payer signature * before broadcasting. * * @example * ```ts * import { Mppx, solana } from '@solana/mpp/client' * * const method = solana.charge({ signer, rpcUrl: 'https://api.devnet.solana.com' }) * const mppx = Mppx.create({ methods: [method] }) * * const response = await mppx.fetch('https://api.example.com/paid-content') * console.log(await response.json()) * ``` */ export declare function charge(parameters: charge.Parameters): Method.Client<{ readonly intent: "charge"; readonly name: "solana"; readonly schema: { readonly credential: { readonly payload: import("zod/mini").ZodMiniObject<{ signature: import("zod/mini").ZodMiniOptional>; transaction: import("zod/mini").ZodMiniOptional>; type: import("zod/mini").ZodMiniString; }, import("zod/v4/core").$strip>; }; readonly request: import("zod/mini").ZodMiniObject<{ amount: import("zod/mini").ZodMiniString; currency: import("zod/mini").ZodMiniString; description: import("zod/mini").ZodMiniOptional>; externalId: import("zod/mini").ZodMiniOptional>; methodDetails: import("zod/mini").ZodMiniObject<{ decimals: import("zod/mini").ZodMiniOptional>; feePayer: import("zod/mini").ZodMiniOptional>; feePayerKey: import("zod/mini").ZodMiniOptional>; network: import("zod/mini").ZodMiniOptional>; recentBlockhash: import("zod/mini").ZodMiniOptional>; splits: import("zod/mini").ZodMiniOptional; ataCreationRequired: import("zod/mini").ZodMiniOptional>; memo: import("zod/mini").ZodMiniOptional>; recipient: import("zod/mini").ZodMiniString; }, import("zod/v4/core").$strip>>>; tokenProgram: import("zod/mini").ZodMiniOptional>; }, import("zod/v4/core").$strip>; recipient: import("zod/mini").ZodMiniString; }, import("zod/v4/core").$strip>; }; }, undefined>; /** * Builds and signs the Solana transaction for an MPP charge request. * * This is the lower-level client SDK entry point for integrations that already * have a decoded charge request and want the transaction bytes instead of the * full mppx `charge()` method wrapper. */ export declare function buildChargeTransaction(parameters: buildChargeTransaction.Parameters): Promise; export declare namespace charge { type Parameters = { /** * Opt-in (audit #26): allow signing unknown Token-2022 mints. Token-2022 * mints can carry transfer hooks that execute arbitrary code on transfer, * so by default the client refuses unknown (non-stablecoin) Token-2022 * mints. Vanilla Token mints are always allowed regardless of this flag. */ allowUnknownToken2022?: boolean; /** * If true, the client broadcasts the transaction and sends the signature * as a `type="signature"` credential. If false (default), the client sends * the signed transaction bytes as a `type="transaction"` credential and the * server broadcasts it. * * Cannot be used with server fee sponsorship (feePayer mode). */ broadcast?: boolean; /** Compute unit limit. Defaults to 200,000. */ computeUnitLimit?: number; /** Compute unit price in micro-lamports for priority fees. Defaults to 1. */ computeUnitPrice?: bigint; /** * Opt-in guard (audit #10): refuse to sign a challenge whose network does * not match this value. Use for auto-pay flows. Defaults to no constraint. */ expectedNetwork?: string; /** * Opt-in guard (audit #10): refuse to sign a challenge whose amount (in * base units) exceeds this cap. Use for auto-pay flows where the server * controls what gets signed. Defaults to no constraint. */ maxAmount?: bigint; /** Called at each step of the payment process. */ onProgress?: (event: ProgressEvent) => void; /** Custom RPC URL. If not set, inferred from the challenge's network field. */ rpcUrl?: string; /** * Solana transaction signer. Compatible with: * - ConnectorKit's `useTransactionSigner()` hook * - `createKeyPairSignerFromBytes()` from `@solana/kit` for headless usage * - Solana Keychain's `SolanaSigner` for remote signers * - Any `TransactionSigner` implementation */ signer: TransactionSigner; }; type ProgressEvent = { amount: string; currency: string; feePayerKey?: string; recipient: string; type: 'challenge'; } | { signature: string; type: 'confirming'; } | { signature: string; type: 'paid'; } | { transaction: string; type: 'signed'; } | { type: 'paying'; } | { type: 'signing'; }; } export declare namespace buildChargeTransaction { type Parameters = { /** * Allow signing unknown Token-2022 mints (audit #26). Defaults to false; * unknown (non-stablecoin) Token-2022 mints are refused because they may * carry transfer hooks. */ allowUnknownToken2022?: boolean; /** Compute unit limit. Defaults to 200,000. */ computeUnitLimit?: number; /** Compute unit price in micro-lamports for priority fees. Defaults to 1. */ computeUnitPrice?: bigint; /** Called at each step of the payment build/signing process. */ onProgress?: (event: { amount: string; currency: string; feePayerKey?: string; recipient: string; type: 'challenge'; } | { type: 'signing'; }) => void; /** Decoded request from a Solana MPP charge challenge. */ request: { amount: string; currency: string; externalId?: string; methodDetails: { decimals?: number; feePayer?: boolean; feePayerKey?: string; network?: string; recentBlockhash?: string; splits?: Array<{ amount: string; ataCreationRequired?: boolean; memo?: string; recipient: string; }>; tokenProgram?: string; }; recipient: string; }; /** Custom RPC URL. If not set, inferred from the request network field. */ rpcUrl?: string; /** Solana transaction signer. */ signer: TransactionSigner; }; } //# sourceMappingURL=Charge.d.ts.map