@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
40 lines • 1.89 kB
TypeScript
import type { BuilderCodeRequiredExtension } from "@x402/extensions/builder-code";
/**
* Service code every `CdpX402Client` attaches to `s`, alongside any codes the
* caller configures, for on-chain attribution of CDP SDK-originated payments.
*/
export declare const CDP_SDK_CLIENT_BUILDER_CODE = "cdp_sdk_client";
/**
* Service code every `createX402Server` EVM route attaches to `s`, alongside
* the developer's own app code (`a`) if configured, for on-chain attribution
* of payments received through the CDP SDK.
*/
export declare const CDP_SDK_SERVER_BUILDER_CODE = "cdp_sdk_server";
/**
* Asserts that a value is a syntactically valid builder code.
*
* @param code - Candidate builder code, possibly from untyped JSON.
* @throws If `code` is not a string matching `^[a-z0-9_]{1,32}$`.
*/
export declare function assertBuilderCode(code: unknown): asserts code is string;
/**
* Normalizes a client `builderCode` config value into a non-empty array of
* validated service codes.
*
* @param builderCode - A single service code, or an array of them.
* @returns The validated service codes.
* @throws If any code is invalid, or if the array has fewer than one or more
* than four codes.
*/
export declare function toServiceBuilderCodes(builderCode: unknown): string[];
/**
* Builds the `builder-code` extension declaration for `createX402Server`
* routes: the developer's own app code (`a`), if configured, alongside this
* SDK's own service code (`s`) for on-chain attribution.
*
* @param appCode - Developer-configured app code (already validated), or
* `undefined` to omit `a` and advertise only the SDK's own service code.
* @returns Extension declaration for `PaymentRequired.extensions["builder-code"]`.
*/
export declare function declareServerBuilderCodeExtension(appCode?: string): BuilderCodeRequiredExtension;
//# sourceMappingURL=builder-code.d.ts.map