UNPKG

@dfinity/sns

Version:

A library for interfacing with a Service Nervous System (SNS) project.

49 lines (48 loc) 2.06 kB
import type { QueryParams } from "@dfinity/utils"; import { Canister } from "@dfinity/utils"; import type { BuyerState, GetAutoFinalizationStatusResponse, GetBuyerStateRequest, GetDerivedStateResponse, GetLifecycleResponse, GetSaleParametersResponse, GetStateResponse, RefreshBuyerTokensRequest, RefreshBuyerTokensResponse, _SERVICE as SnsSwapService, Ticket } from "../candid/sns_swap"; import type { SnsCanisterOptions } from "./types/canister.options"; import type { NewSaleTicketParams } from "./types/swap.params"; export declare class SnsSwapCanister extends Canister<SnsSwapService> { static create(options: SnsCanisterOptions<SnsSwapService>): SnsSwapCanister; /** * Get the state of the swap */ state: (params: QueryParams) => Promise<GetStateResponse>; /** * Notify of the payment failure to remove the ticket */ notifyPaymentFailure: () => Promise<Ticket | undefined>; /** * Notify of the user participating in the swap */ notifyParticipation: (params: RefreshBuyerTokensRequest) => Promise<RefreshBuyerTokensResponse>; /** * Get user commitment */ getUserCommitment: (params: GetBuyerStateRequest & QueryParams) => Promise<BuyerState | undefined>; /** * Get sale buyers state */ getDerivedState: ({ certified, }: QueryParams) => Promise<GetDerivedStateResponse>; /** * Get sale parameters */ getSaleParameters: ({ certified, }: QueryParams) => Promise<GetSaleParametersResponse>; /** * Return a sale ticket if created and not yet removed (payment flow) */ getOpenTicket: (params: QueryParams) => Promise<Ticket | undefined>; /** * Create a sale ticket (payment flow) */ newSaleTicket: (params: NewSaleTicketParams) => Promise<Ticket>; /** * Get sale lifecycle state */ getLifecycle: (params: QueryParams) => Promise<GetLifecycleResponse>; /** * Get sale lifecycle state */ getFinalizationStatus: (params: QueryParams) => Promise<GetAutoFinalizationStatusResponse>; }