lootpay
Version:
To install dependencies:
125 lines (124 loc) • 3.62 kB
TypeScript
import LootPayCryptoSuccessResponse from "../../types/LootPayCryptoSuccessResponse";
import SanitizedBalanceTransaction from "../../types/LootPayBalanceHistory";
import LootPayCryptoData from "../../types/LootPayCryptoData";
import LootPayTransaction from "../../types/LootPayTransaction";
import LootPayMethod from "../../types/LootPayMethod";
export default class LootPayClient {
private readonly apiKey;
constructor(apiKey: string);
/**
* Send a crypto payment
* @param amount - The amount to send in USD
* @param address - The address to send the payment to
* @param network - The crypto network to send the payment to
*/
sendCryptoPayment({ amount, address, network, }: {
amount: number;
address: string;
network: 'litecoin' | 'bitcoin' | 'ethereum';
}): Promise<{
err?: string;
data?: LootPayCryptoSuccessResponse;
}>;
/**
* Get the prices of all supported cryptocurrencies
*/
getCryptoPrices(): Promise<{
err: string;
data?: undefined;
} | {
err: undefined;
data: ({
BTC: LootPayCryptoData;
LTC: LootPayCryptoData;
ETH: LootPayCryptoData;
SOL: LootPayCryptoData;
} & {
[key: string]: LootPayCryptoData | undefined;
}) | undefined;
}>;
/**
* Get your applications balance
*/
getBalance(): Promise<{
err: string;
data?: undefined;
} | {
err: undefined;
data: {
balance: number;
} | undefined;
}>;
/**
* Get the balance history
* @param limit - The number of transactions to return
* @param offset - The number of transactions to skip
*/
getBalanceHistory({ limit, offset, }: {
limit?: number;
offset?: number;
}): Promise<{
err: string;
data?: undefined;
} | {
err: undefined;
data: SanitizedBalanceTransaction[] | undefined;
}>;
/**
* Get all transactions
* @param limit - The number of transactions to return
* @param offset - The number of transactions to skip
* @param type - The type of transactions to return
*/
getTransactionHistory({ limit, offset, type, }: {
limit?: number;
offset?: number;
type?: 'cryptoRedemption' | 'balanceAdjustment' | 'giftcardRedemption';
}): Promise<{
err: string;
data?: undefined;
} | {
err: undefined;
data: LootPayTransaction[] | undefined;
}>;
/**
* Get a transaction by ID
* @param transactionID - The ID of the transaction to get
*/
getTransaction(transactionID: string): Promise<{
err: string;
data?: undefined;
} | {
err: undefined;
data: LootPayTransaction | undefined;
}>;
/**
* Get all available redemption methods
*/
getMethods(): Promise<{
err: string;
data?: undefined;
} | {
err: undefined;
data: LootPayMethod[] | undefined;
}>;
/**
* Send a loot link
* @param amount - The amount to send in USD
* @param email - The email to send the loot link to
* @param username - The username of the user you're sending the loot link to
*/
sendLootLink({ amount, email, username, }: {
amount: number;
email: string;
username: string;
}): Promise<{
err: string;
data?: undefined;
} | {
err: undefined;
data: {
link: string;
} | undefined;
}>;
}