@bit-gpt/h402
Version:
BitGPT's 402 open protocol for blockchain-native payments
118 lines • 4.64 kB
TypeScript
import { z } from "zod";
import { SettleResponse } from "./h402Specs.js";
export declare const facilitatorRequestSchema: z.ZodObject<{
paymentHeader: z.ZodString;
paymentRequirements: z.ZodObject<{
namespace: z.ZodEnum<["evm", "solana"]>;
tokenAddress: z.ZodString;
tokenDecimals: z.ZodOptional<z.ZodNumber>;
tokenSymbol: z.ZodOptional<z.ZodString>;
amountRequired: z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>;
amountRequiredFormat: z.ZodEnum<["humanReadable", "smallestUnit"]>;
payToAddress: z.ZodString;
networkId: z.ZodString;
description: z.ZodOptional<z.ZodString>;
resource: z.ZodOptional<z.ZodString>;
scheme: z.ZodEnum<["exact"]>;
mimeType: z.ZodOptional<z.ZodString>;
outputSchema: z.ZodOptional<z.ZodAny>;
estimatedProcessingTime: z.ZodOptional<z.ZodNumber>;
extra: z.ZodOptional<z.ZodAny>;
maxAmountRequired: z.ZodOptional<z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>>;
requiredDeadlineSeconds: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
scheme: "exact";
namespace: "solana" | "evm";
tokenAddress: string;
amountRequired: number | bigint;
amountRequiredFormat: "humanReadable" | "smallestUnit";
payToAddress: string;
networkId: string;
description?: string | undefined;
tokenSymbol?: string | undefined;
tokenDecimals?: number | undefined;
resource?: string | undefined;
mimeType?: string | undefined;
outputSchema?: any;
estimatedProcessingTime?: number | undefined;
extra?: any;
maxAmountRequired?: number | bigint | undefined;
requiredDeadlineSeconds?: number | undefined;
}, {
scheme: "exact";
namespace: "solana" | "evm";
tokenAddress: string;
amountRequired: number | bigint;
amountRequiredFormat: "humanReadable" | "smallestUnit";
payToAddress: string;
networkId: string;
description?: string | undefined;
tokenSymbol?: string | undefined;
tokenDecimals?: number | undefined;
resource?: string | undefined;
mimeType?: string | undefined;
outputSchema?: any;
estimatedProcessingTime?: number | undefined;
extra?: any;
maxAmountRequired?: number | bigint | undefined;
requiredDeadlineSeconds?: number | undefined;
}>;
}, "strip", z.ZodTypeAny, {
paymentHeader: string;
paymentRequirements: {
scheme: "exact";
namespace: "solana" | "evm";
tokenAddress: string;
amountRequired: number | bigint;
amountRequiredFormat: "humanReadable" | "smallestUnit";
payToAddress: string;
networkId: string;
description?: string | undefined;
tokenSymbol?: string | undefined;
tokenDecimals?: number | undefined;
resource?: string | undefined;
mimeType?: string | undefined;
outputSchema?: any;
estimatedProcessingTime?: number | undefined;
extra?: any;
maxAmountRequired?: number | bigint | undefined;
requiredDeadlineSeconds?: number | undefined;
};
}, {
paymentHeader: string;
paymentRequirements: {
scheme: "exact";
namespace: "solana" | "evm";
tokenAddress: string;
amountRequired: number | bigint;
amountRequiredFormat: "humanReadable" | "smallestUnit";
payToAddress: string;
networkId: string;
description?: string | undefined;
tokenSymbol?: string | undefined;
tokenDecimals?: number | undefined;
resource?: string | undefined;
mimeType?: string | undefined;
outputSchema?: any;
estimatedProcessingTime?: number | undefined;
extra?: any;
maxAmountRequired?: number | bigint | undefined;
requiredDeadlineSeconds?: number | undefined;
};
}>;
export type FacilitatorRequest = z.infer<typeof facilitatorRequestSchema>;
/**
* Encodes a settlement response into a base64 header string
*
* @param response - The settlement response to encode
* @returns A base64 encoded string containing the settlement response
*/
export declare function settleResponseHeader(response: SettleResponse): string;
/**
* Decodes a base64 header string back into a settlement response
*
* @param header - The base64 encoded settlement response header
* @returns The decoded settlement response object
*/
export declare function settleResponseFromHeader(header: string): SettleResponse;
//# sourceMappingURL=facilitator.d.ts.map