@kippurocks/libticketto-papi
Version:
A Kippu implementation of The Ticketto Protocol with Polkadot-API
79 lines (78 loc) • 2.85 kB
TypeScript
import { PolkadotClient, TypedApi } from "polkadot-api";
import { AccountId } from "@ticketto/types";
import { ClientConfig } from "@ticketto/protocol";
import { Enum } from "@polkadot-api/substrate-bindings";
import { contracts, kreivo } from "@polkadot-api/descriptors";
import { createInkSdk, InkSdkTypedApi } from "@polkadot-api/sdk-ink";
export declare function currency(client: PolkadotClient): Promise<{
UNIT: bigint;
CENTS: bigint;
MILLICENTS: bigint;
}>;
export type KreivoApi = TypedApi<typeof kreivo>;
export type EventContractTypes = (typeof contracts)["tickettoEvents"]["__types"];
export type TicketsContractTypes = (typeof contracts)["tickettoTickets"]["__types"];
type EventsSdk = ReturnType<typeof createInkSdk<InkSdkTypedApi, (typeof contracts)["tickettoEvents"]>>;
type TicketsSdk = ReturnType<typeof createInkSdk<InkSdkTypedApi, (typeof contracts)["tickettoTickets"]>>;
export type EventsContract = ReturnType<EventsSdk["getContract"]>;
export type TicketsContract = ReturnType<TicketsSdk["getContract"]>;
export type KreivoApiCall = ReturnType<KreivoApi["txFromCallData"]>;
export type EventsContractCall = ReturnType<EventsContract["send"]>;
export type TicketsContractCall = ReturnType<TicketsContract["send"]>;
export declare function isKreivoTx(value: unknown): value is KreivoTx;
export type KreivoTx = KreivoApiCall | EventsContractCall | TicketsContractCall;
export type KippuConsumerSettings = {
client: PolkadotClient;
apiEndpoint: string;
eventsContractAddress: AccountId;
ticketsContractAddress: AccountId;
storeId?: number;
merchantId?: number;
};
export type KippuConfig = Required<ClientConfig<KippuConsumerSettings>>;
export type KippuAccountProvider = KippuConfig["accountProvider"];
export declare enum TOKEN {
MERCHANT_ID = "MerchantId",
ACCUNT_PROVIDER = "AccountProvider",
SETTINGS = "KippuConsumerSetttings",
SUBMITTER = "TransactionSubmitter",
QUEUE = "EventsQueue",
POLKADOT_CLIENT = "PolkadotClient",
KREIVO_API = "KreivoApi",
EVENTS_CONTRACT_ADDRESS = "EventsContractAddress",
EVENTS_CONTRACT = "EventsContract",
TICKETS_CONTRACT = "TicketsContract"
}
export type TickettoAttendancePolicy = Enum<{
Single: undefined;
Multiple: {
max: number;
maybe_until?: bigint;
};
Unlimited: {
maybe_until?: bigint;
};
}>;
export type TickettoAssetId = Enum<{
Here: number;
Sibling: {
id: number;
pallet: number;
index: number;
};
External: {
network: Enum<{
Polkadot: undefined;
Kusama: undefined;
Ethereum: {
chain_id: bigint;
};
}>;
child?: {
id: number;
pallet: number;
index: number;
} | undefined;
};
}>;
export {};