@stable-io/cctp-sdk-definitions
Version:
Definitions for the CCTP SDK
48 lines • 1.98 kB
TypeScript
import type { ApiVersion, Domain, Network, Usdc, Duration, Percentage } from "../../constants/index.js";
import { Brand, TODO } from "@stable-io/utils";
export type FastBurnAllowanceResponse = Readonly<{
allowance: Usdc;
lastUpdated: Date;
}>;
export type FastBurnFeeResponse = Readonly<{
minimumFee: Percentage;
}>;
export type MessageStatus = "complete" | "pending_confirmations";
export type CCTPNonce = Brand<string, "CCTPNonce">;
export type ApiResponseMessage = {
message: Uint8Array;
eventNonce: CCTPNonce;
attestation: Uint8Array;
decodedMessage?: TODO;
cctpVersion: ApiVersion;
status: MessageStatus;
};
export type GetMessagesResponse = Readonly<{
status: "success";
messages: ReadonlyArray<ApiResponseMessage>;
} | {
status: "not_found";
code: number;
error: string;
} | {
status: "pending";
}>;
export type TxHashOrNonce = {
transactionHash: string;
} | {
nonce: string;
};
export declare const fetchFastBurnAllowanceFactory: <N extends Network>(network: N) => (ttl?: Duration) => Promise<FastBurnAllowanceResponse>;
export declare const fetchFastBurnFeeFactory: <N extends Network>(network: N) => (sourceDomain: Domain, destinationDomain: Domain, ttl?: Duration) => Promise<FastBurnFeeResponse>;
export declare const fetchMessagesFactory: <N extends Network>(network: N) => (sourceDomain: Domain, txHashOrNonce: TxHashOrNonce, ttl?: Duration) => Promise<GetMessagesResponse>;
export declare const init: <N extends Network>(network: N) => {
readonly fetchFastBurnAllowance: (ttl?: Duration) => Promise<Readonly<{
allowance: Usdc;
lastUpdated: Date;
}>>;
readonly fetchFastBurnFee: (sourceDomain: Domain, destinationDomain: Domain, ttl?: Duration) => Promise<Readonly<{
minimumFee: Percentage;
}>>;
readonly fetchMessages: (sourceDomain: Domain, txHashOrNonce: TxHashOrNonce, ttl?: Duration) => Promise<GetMessagesResponse>;
};
//# sourceMappingURL=api.d.ts.map