import { SignifyClient } from './clienting.ts'; import { Dict } from '../core/core.ts'; import { Serder } from '../core/serder.ts'; import { Dip, ExnV1, HabState, Icp, Ixn } from '../core/keyState.ts'; import { Rpy } from './escrowing.ts'; import { components } from '../../types/keria-api-schema.ts'; export type Exn = components['schemas']['Exn']; export type ExchangeResource = components['schemas']['ExchangeResource']; export type ExchangeResourceV1 = Omit & { exn: ExnV1; }; export type ExnMultisig = components['schemas']['ExnMultisig']; export declare const MULTISIG_ICP_ROUTE = "/multisig/icp"; export declare const MULTISIG_ROT_ROUTE = "/multisig/rot"; export declare const MULTISIG_IXN_ROUTE = "/multisig/ixn"; export declare const MULTISIG_RPY_ROUTE = "/multisig/rpy"; export declare const MULTISIG_VCP_ROUTE = "/multisig/vcp"; export declare const MULTISIG_ISS_ROUTE = "/multisig/iss"; export declare const MULTISIG_EXN_ROUTE = "/multisig/exn"; export declare const MULTISIG_REV_ROUTE = "/multisig/rev"; export declare const IPEX_GRANT_ROUTE = "/ipex/grant"; export declare const IPEX_OFFER_ROUTE = "/ipex/offer"; export declare const IPEX_APPLY_ROUTE = "/ipex/apply"; export declare const IPEX_AGREE_ROUTE = "/ipex/agree"; export declare const IPEX_ADMIT_ROUTE = "/ipex/admit"; export type AnchorEvent = components['schemas']['IXN_V_1'] | components['schemas']['ICP_V_1'] | components['schemas']['ROT_V_1'] | components['schemas']['DIP_V_1'] | components['schemas']['DIP_V_2']; export type MultisigIcpExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof MULTISIG_ICP_ROUTE; e: { icp: Icp | Dip; d?: string; }; a: { gid: string; smids: string[]; rmids?: string[]; [key: string]: unknown; }; }; }; export type MultisigRotExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof MULTISIG_ROT_ROUTE; e: { rot: components['schemas']['ROT_V_1']; d?: string; }; a: { gid: string; smids: string[]; rmids?: string[]; [key: string]: unknown; }; }; }; export type MultisigIxnExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof MULTISIG_IXN_ROUTE; e: { ixn: Ixn; d?: string; }; a: { gid: string; smids: string[]; rmids?: string[]; [key: string]: unknown; }; }; }; export type MultisigRpyExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof MULTISIG_RPY_ROUTE; e: { rpy: Rpy; d?: string; }; a: { gid: string; [key: string]: unknown; }; }; }; export type MultisigVcpExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof MULTISIG_VCP_ROUTE; e: { vcp: components['schemas']['VCP_V_1']; anc: AnchorEvent; d?: string; }; a: { gid: string; usage?: string; [key: string]: unknown; }; }; }; export type MultisigIssExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof MULTISIG_ISS_ROUTE; e: { acdc: components['schemas']['ACDC_V_1']; iss: components['schemas']['ISS_V_1']; anc: AnchorEvent; d?: string; }; a: { gid: string; [key: string]: unknown; }; }; }; export type MultisigExnExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof MULTISIG_EXN_ROUTE; e: { exn: ExnV1; d?: string; }; a: { gid: string; [key: string]: unknown; }; }; }; export type MultisigRevExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof MULTISIG_REV_ROUTE; e: { rev: components['schemas']['REV_V_1']; d?: string; }; a: { gid: string; [key: string]: unknown; }; }; }; type WithGroupMetadata = Pick; export type MultisigIcpGroup = Omit & WithGroupMetadata; export type MultisigRotGroup = Omit & WithGroupMetadata; export type MultisigIxnGroup = Omit & WithGroupMetadata; export type MultisigRpyGroup = Omit & WithGroupMetadata; export type MultisigVcpGroup = Omit & WithGroupMetadata; export type MultisigIssGroup = Omit & WithGroupMetadata; export type MultisigExnGroup = Omit & WithGroupMetadata; export type MultisigRevGroup = Omit & WithGroupMetadata; export type IpexGrantExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof IPEX_GRANT_ROUTE; e: { acdc: components['schemas']['ACDC_V_1']; iss: components['schemas']['ISS_V_1']; anc: AnchorEvent; d?: string; }; }; }; export type IpexOfferExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof IPEX_OFFER_ROUTE; e: { acdc: components['schemas']['ACDC_V_1']; d?: string; }; }; }; export type IpexApplyExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof IPEX_APPLY_ROUTE; e: object; }; }; export type IpexAgreeExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof IPEX_AGREE_ROUTE; e: object; }; }; export type IpexAdmitExchange = ExchangeResourceV1 & { exn: ExnV1 & { r: typeof IPEX_ADMIT_ROUTE; e: object; }; }; export declare function isMultisigIcp(msg: ExchangeResourceV1): msg is MultisigIcpExchange; export declare function isMultisigIcp(msg: ExnMultisig): msg is MultisigIcpGroup; export declare function isMultisigRot(msg: ExchangeResourceV1): msg is MultisigRotExchange; export declare function isMultisigRot(msg: ExnMultisig): msg is MultisigRotGroup; export declare function isMultisigIxn(msg: ExchangeResourceV1): msg is MultisigIxnExchange; export declare function isMultisigIxn(msg: ExnMultisig): msg is MultisigIxnGroup; export declare function isMultisigRpy(msg: ExchangeResourceV1): msg is MultisigRpyExchange; export declare function isMultisigRpy(msg: ExnMultisig): msg is MultisigRpyGroup; export declare function isMultisigVcp(msg: ExchangeResourceV1): msg is MultisigVcpExchange; export declare function isMultisigVcp(msg: ExnMultisig): msg is MultisigVcpGroup; export declare function isMultisigIss(msg: ExchangeResourceV1): msg is MultisigIssExchange; export declare function isMultisigIss(msg: ExnMultisig): msg is MultisigIssGroup; export declare function isMultisigExn(msg: ExchangeResourceV1): msg is MultisigExnExchange; export declare function isMultisigExn(msg: ExnMultisig): msg is MultisigExnGroup; export declare function isMultisigRev(msg: ExchangeResourceV1): msg is MultisigRevExchange; export declare function isMultisigRev(msg: ExnMultisig): msg is MultisigRevGroup; export declare function isIpexGrant(msg: ExchangeResourceV1): msg is IpexGrantExchange; export declare function isIpexOffer(msg: ExchangeResourceV1): msg is IpexOfferExchange; export declare function isIpexApply(msg: ExchangeResourceV1): msg is IpexApplyExchange; export declare function isIpexAgree(msg: ExchangeResourceV1): msg is IpexAgreeExchange; export declare function isIpexAdmit(msg: ExchangeResourceV1): msg is IpexAdmitExchange; export declare function assertMultisigIss(msg: ExchangeResourceV1): MultisigIssExchange; export declare function assertMultisigIss(msg: ExnMultisig): MultisigIssGroup; export declare function assertMultisigIcp(msg: ExchangeResourceV1): MultisigIcpExchange; export declare function assertMultisigIcp(msg: ExnMultisig): MultisigIcpGroup; export declare function assertMultisigRot(msg: ExchangeResourceV1): MultisigRotExchange; export declare function assertMultisigRot(msg: ExnMultisig): MultisigRotGroup; export declare function assertMultisigIxn(msg: ExchangeResourceV1): MultisigIxnExchange; export declare function assertMultisigIxn(msg: ExnMultisig): MultisigIxnGroup; export declare function assertMultisigRpy(msg: ExchangeResourceV1): MultisigRpyExchange; export declare function assertMultisigRpy(msg: ExnMultisig): MultisigRpyGroup; export declare function assertMultisigVcp(msg: ExchangeResourceV1): MultisigVcpExchange; export declare function assertMultisigVcp(msg: ExnMultisig): MultisigVcpGroup; export declare function assertMultisigExn(msg: ExchangeResourceV1): MultisigExnExchange; export declare function assertMultisigExn(msg: ExnMultisig): MultisigExnGroup; export declare function assertMultisigRev(msg: ExchangeResourceV1): MultisigRevExchange; export declare function assertMultisigRev(msg: ExnMultisig): MultisigRevGroup; export declare function assertIpexGrant(msg: ExchangeResourceV1): IpexGrantExchange; export declare function assertIpexGrant(msg: ExnMultisig): ExnMultisig; export declare function assertIpexOffer(msg: ExchangeResourceV1): IpexOfferExchange; export declare function assertIpexOffer(msg: ExnMultisig): ExnMultisig; export declare function assertIpexApply(msg: ExchangeResourceV1): IpexApplyExchange; export declare function assertIpexApply(msg: ExnMultisig): ExnMultisig; export declare function assertIpexAgree(msg: ExchangeResourceV1): IpexAgreeExchange; export declare function assertIpexAgree(msg: ExnMultisig): ExnMultisig; export declare function assertIpexAdmit(msg: ExchangeResourceV1): IpexAdmitExchange; export declare function assertIpexAdmit(msg: ExnMultisig): ExnMultisig; /** * Exchanges */ export declare class Exchanges { client: SignifyClient; /** * Exchanges * @param {SignifyClient} client */ constructor(client: SignifyClient); /** * Create exn message * @async * @returns {Promise} A promise to the list of replay messages * @param sender * @param route * @param payload * @param embeds * @param recipient * @param datetime * @param dig */ createExchangeMessage(sender: HabState, route: string, payload: Dict, embeds: Dict, recipient: string, datetime?: string, dig?: string): Promise<[Serder, string[], string]>; /** * Send exn messages to list of recipients * @async * @returns {Promise} A promise to the list of replay messages * @param name * @param topic * @param sender * @param route * @param payload * @param embeds * @param recipients */ send(name: string, topic: string, sender: HabState, route: string, payload: Dict, embeds: Dict, recipients: string[]): Promise; /** * Send exn message to list of recipients * @async * @returns {Promise} A promise to the list of replay messages * @param name * @param topic * @param exn * @param sigs * @param atc * @param recipients */ sendFromEvents(name: string, topic: string, exn: Serder, sigs: string[], atc: string, recipients: string[]): Promise; /** * Get exn message by said * @async * @returns A promise to the exn message * @param said The said of the exn message */ get(said: string): Promise; } export declare function exchange(route: string, payload: Dict, sender: string, recipient: string, date?: string, dig?: string, modifiers?: Dict, embeds?: Dict): [Serder, Uint8Array]; export {};