UNPKG

@tiplink/api

Version:

Api for creating and sending TipLinks

83 lines (82 loc) 4.01 kB
import { PublicKey } from "@solana/web3.js"; import { EscrowTipLink, TipLink } from "."; /** * Asynchronously calls secure enclave to create a TipLink, store it with an associated email, and return its public key. * * @param apiKey - The API key to be used for the request. * @param email - The email address to be associated with the receiver tiplink. * @returns A promise that resolves to the PublicKey of the receiver tiplink. * @throws Throws an error if the HTTPS request fails with a non-ok status. */ export declare function createReceiverTipLink(apiKey: string, email: string): Promise<PublicKey>; /** * Asynchronously calls secure enclave to retrieve the email associated with a receiver TipLink. * * @param apiKey - The API key to be used for the request. * @param publicKey - The public key of the TipLink for which to retrieve the associated email. * @returns A promise that resolves to the email address associated with the provided TipLink public key. * @throws Throws an error if the HTTPS request fails with a non-ok status. */ export declare function getReceiverEmail(apiKey: string, publicKey: PublicKey): Promise<string>; /** * @deprecated We are sunsetting this feature and will only be supporting * emailiing EscrowTipLinks. We recommend not using this feature. * * Asynchronously emails a TipLink. * * @param apiKey - The API key to be used for the request. * @param tipLink - The TipLink object to be sent. * @param toEmail - The email address of the recipient. * @param toName - Optional name of the recipient for the email. * @param replyEmail - Optional email address for the recipient to reply to. * @param replyName - Optional name of the sender for the email. * @param templateName - Optional name of the template to be used for the email. * @returns A promise that resolves when the email has been sent. * @throws Throws an error if the HTTP request fails with a non-ok status. */ export declare function mail(apiKey: string, tipLink: TipLink, toEmail: string, toName?: string, replyEmail?: string, replyName?: string, templateName?: string): Promise<void>; /** * @param apiKey - The API key to be used for the request. * @param escrowTipLink - The Escrow TipLink to be sent. Includes the toEmail and receiver TipLink public key. * @param toName - Optional name of the recipient for the email. * @param replyEmail - Optional email address for the recipient to reply to. * @param replyName - Optional name of the sender for the email. * @param templateName - Optional name of the template to be used for the email. * @returns A promise that resolves when the email has been sent. * @throws Throws an error if the HTTP request fails with a non-ok status. */ interface MailEscrowWithObjArgs { apiKey: string; escrowTipLink: EscrowTipLink; toName?: string; replyEmail?: string; replyName?: string; templateName?: string; } /** * @param apiKey - The API key to be used for the request. * @param toEmail - The email address of the recipient. * @param pda - The public key of the escrow vault. * @param receiverTipLink - The public key of the receiver TipLink. * @param toName - Optional name of the recipient for the email. * @param replyEmail - Optional email address for the recipient to reply to. * @param replyName - Optional name of the sender for the email. * @param templateName - Optional name of the template to be used for the email. * @returns A promise that resolves when the email has been sent. * @throws Throws an error if the HTTP request fails with a non-ok status. */ interface MailEscrowWithValsArgs { apiKey: string; toEmail: string; pda: PublicKey; receiverTipLink: PublicKey; toName?: string; replyEmail?: string; replyName?: string; templateName?: string; } /** * Asynchronously emails a deposited Escrow TipLink to a pre-defined recipient. */ export declare function mailEscrow(args: MailEscrowWithObjArgs | MailEscrowWithValsArgs): Promise<void>; export {};