Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 42 additions & 41 deletions types/invity-api/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,31 @@ export type FiatCurrencyCode =

export type FiatCurrenciesProps = Record<FiatCurrencyCode, number>;

export interface ClientVersion {
client: string;
version: string;
}

export interface ProviderMetadata {
name: string; // unique internal name, e.g. "changenow"
companyName: string; // name visible to clients, e.g. "ChangeNow"
logo: string; // logo image filename, e.g. "changenow-icon.jpg"
isActive: boolean;
isDisabled?: boolean;
disabledCurrencies?: string[]; // ['BTC', 'USD']
supportedCountries?: string[]; // ['CZ', 'NL']
disabledCountries?: string[];
supportUrl?: string; // https://www.simplex.com/support/
statusUrl?: string; // https://payment-status.simplex.com/api/v1/user/payments?uuid={{paymentId}}
termsUrl?: string; // https://www.simplex.com/terms-of-use/payment-terms
disabledClientVersions?: ClientVersion[];
}

export interface BuySellProviderMetadata extends ProviderMetadata {
supportedCountries: string[]; // ['AT', 'BE']
tradedCoins: CryptoId[]; // ['BTC', 'BCH', 'LTC', 'XRP', 'ETH', 'bitcoin', 'ethereum', 'litecoin', 'ethereum--0xdac17f958d2ee523a2206206994597c13d831ec7']
}

// buy types

export type BuyTradeFinalStatus =
Expand Down Expand Up @@ -119,22 +144,12 @@ export type BuyTradeTag =
| "widget"
| "noExternalAddress";

export interface BuyProviderInfo {
name: string; // simplex
companyName: string; // UAB Invity Finance
brandName?: string; // Invity
logo: string; // simplex-icon.jpg
isActive: boolean;
isDisabled?: boolean;
tradedCoins: CryptoId[]; // ['bitcoin', 'ethereum', 'litecoin', 'ethereum--0xdac17f958d2ee523a2206206994597c13d831ec7']
export interface BuyProviderInfo extends BuySellProviderMetadata {
tradedFiatCurrencies: string[]; // ['EUR', 'USD']
disabledCurrencies?: string[];
supportedCountries: string[]; // ['CZ', 'NL']
disabledCountries?: string[];
paymentMethods: BuyCryptoPaymentMethod[];
statusUrl?: string; // https://payment-status.simplex.com/api/v1/user/payments?uuid={{paymentId}}
supportUrl?: string; // https://www.simplex.com/support/
pendingTimeoutSeconds?: number; // Time until a SUBMITTED transaction automatically changes to APPROVAL_PENDING. Null means it does not change.
disabledPaymentMethods?: BuyCryptoPaymentMethod[];
brandName?: string; // Invity
pendingTimeoutSeconds?: number; // time until a SUBMITTED transaction automatically changes to APPROVAL_PENDING, null means it does not change
}

export interface BuyListResponse {
Expand Down Expand Up @@ -250,23 +265,18 @@ export type ExchangeMaximum =
export type ExchangeTradeTag = "renewed" | "bestRate" | "favorite" | "kyc" | "widget" | "noExternalAddress";
export type ExchangeKYCType = "KYC-required" | "KYC-norefund" | "KYC-yesrefund" | "noKYC" | "DEX";

export interface ExchangeProviderInfo {
name: string; // changenow
companyName: string; // ChangeNow
logo: string; // changenow-icon.jpg
isActive: boolean;
export interface ExchangeProviderInfo extends ProviderMetadata {
isFixedRate: boolean;
isDex: boolean;
buyTickers: CryptoId[];
sellTickers: CryptoId[];
addressFormats: StringMap; // specification of formats required by selected exchange
statusUrl: string; // https://changenow.io/exchange/txs/{{orderId}}
addressFormats: StringMap;
kycUrl?: string; // https://changenow.io/faq#kyc
supportUrl: string; // https://support.changenow.io
// TODO region of operation
kycPolicy?: string | undefined;
kycPolicy?: string;
kycPolicyType: ExchangeKYCType;
isRefundRequired?: boolean | undefined;
isRefundRequired?: boolean;
}

export type ExchangeListResponse = ExchangeProviderInfo[];
Expand Down Expand Up @@ -463,25 +473,16 @@ export type SellProviderType = "Fiat" | "Voucher";

export type SellFiatFlowType = "BANK_ACCOUNT" | "PAYMENT_GATE" | "N/A";

export interface SellProviderInfo {
name: string; // simplex
companyName: string; // Simplex
logo: string; // simplex-icon.jpg
export interface SellProviderInfo extends BuySellProviderMetadata {
type: SellProviderType;
isActive: boolean;
tradedCoins: CryptoId[]; // ['bitcoin', 'bitcoin-cash', 'litecoin']
tradedFiatCurrencies?: string[] | undefined; // ['EUR', 'USD']
supportedCountries: string[]; // ['AT', 'BE']
statusUrl?: string | undefined; // https://payment-status.simplex.com/api/v1/user/payments?uuid={{paymentId}}
supportUrl?: string | undefined; // https://www.simplex.com/support/
quoteInfo?: string | undefined; // some info text shown on quote
voucherSiteOrigin?: string | undefined;
paymentMethods?: SellCryptoPaymentMethod[] | undefined;
flow?: SellFiatFlowType | undefined;
isRefundAddressRequired?: boolean | undefined;
pendingTimeout?: number | undefined; // Time until a SUBMITTED transaction automatically changes to PENDING. Null means it does not change.
/** Should be used when it's necessary to have the exact amount match between the trade and the transaction */
lockSendAmount?: boolean;
tradedFiatCurrencies?: string[]; // ['EUR', 'USD']
quoteInfo?: string; // some info text shown on quote
paymentMethods?: SellCryptoPaymentMethod[];
disabledPaymentMethods?: SellCryptoPaymentMethod[];
flow?: SellFiatFlowType;
isRefundAddressRequired?: boolean;
pendingTimeout?: number; // time until a SUBMITTED transaction automatically changes to PENDING, null means it does not change
lockSendAmount?: boolean; // should be used when it's necessary to have the exact amount match between the trade and the transaction */
}

export interface SellListResponse {
Expand Down
7 changes: 6 additions & 1 deletion types/invity-api/invity-api-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ const providerInfo: BuyProviderInfo = {
tradedFiatCurrencies: [],
supportedCountries: [],
paymentMethods: [],
statusUrl: "https://test-finance.invity.io/#status/{{paymentId}}",
supportUrl: "",
termsUrl: "https://invity.io/terms-of-use-invity-finance",
};

const infoResponse: InfoResponse = {
Expand Down Expand Up @@ -105,7 +108,8 @@ const exchangeProviderInfo: ExchangeProviderInfo = {
},
statusUrl: "https://example.com/txs/{{orderId}}",
kycUrl: "https://example.com/faq#kyc",
supportUrl: " https://support.example.com",
supportUrl: "https://support.example.com",
termsUrl: "https://example.com/legal/terms-of-use",
kycPolicy: "KYC is required...",
kycPolicyType: "KYC-norefund",
isRefundRequired: false,
Expand All @@ -122,6 +126,7 @@ const sellProviderInfo: SellProviderInfo = {
supportedCountries: ["US"],
statusUrl: "https://example.com/txs/{{orderId}}",
supportUrl: " https://support.example.com",
termsUrl: "https://example.com/legal/terms-of-use",
flow: "PAYMENT_GATE",
isRefundAddressRequired: false,
lockSendAmount: false,
Expand Down
8 changes: 6 additions & 2 deletions types/mokapi/faker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
export function fake(schema: Schema | JSONSchema): any;

/**
* Retrieves a node from the faker tree by its name.
* Retrieves a node from the faker tree by its name or path.
*
* @param name name - The name of the node to find.
* A node can be referenced either by its simple name (e.g. `"name"`) or by a path
* that describes its location in the tree (e.g. `"/person/name"` for an absolute
* path from the root, or `"middle/name"` for a relative path).
*
* @param name name - The name or path of the node to find.
* @returns The matching {@link Node} from the faker tree.
*
* @example
Expand Down
94 changes: 93 additions & 1 deletion types/mokapi/http.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,105 @@ export function del(url: string, body?: JSONValue, args?: Args): Response;
*/
export function options(url: string, body?: JSONValue, args?: Args): Response;

/**
* Sends an HTTP request and returns a Promise resolving to the response.
*
* @param {string} url - The URL to request.
* @param {FetchOptions} opts - Optional fetch configuration.
* @returns {Promise<Response>} A Promise that resolves with the response.
*
* @example
* // Simple GET request
* const res = await fetch('https://foo.bar/api');
* const data = await res.json();
*
* @example
* // POST request with JSON body
* const res = await fetch('https://foo.bar/api', {
* method: 'POST',
* headers: { 'Content-Type': 'application/json' },
* body: { name: 'Alice' }
* });
*
* @example
* // Request with timeout and redirect settings
* const res = await fetch('https://foo.bar/api', {
* timeout: '5s',
* maxRedirects: 2
* });
*/
export function fetch(url: string, opts?: FetchOptions): Promise<Response>;

/**
* Request arguments.
* Used to add headers to a request.
*/
export interface Args {
/** Request headers. */
header?: { [name: string]: string };
headers?: { [name: string]: string };
/**
* The number of redirects to follow for this request.
* @default 5
*/
maxRedirects?: number;
/**
* Maximum time to wait for the request to complete. Default
* timeout is 60 seconds ("60s"). The type can also be a number, in which
* case Mokapi interprets it as milliseconds
* @example
* const res = get(url, { timeout: '5m' })
*/
timeout?: number | string;
}

/**
* Options for the {@link fetch} function.
*/
export interface FetchOptions {
/**
* HTTP method to use for the request.
* @default "GET"
* @example
* const res = await fetch(url, { method: 'POST' });
*/
method?: string;

/**
* The body of the request, such as a string or object.
* @example
* const res = await fetch(url, { body: JSON.stringify({ name: 'Alice' }) });
*/
body?: any;

/**
* Request headers.
* @example
* const res = await fetch(url, {
* headers: { 'Authorization': 'Bearer token123' }
* });
*/
headers?: { [name: string]: string };

/**
* The number of redirects to follow for this request.
* @default 5
* @example
* const res = await fetch(url, { maxRedirects: 1 });
*/
maxRedirects?: number;

/**
* Maximum time to wait for the request to complete. Default
* timeout is 60 seconds ("60s"). The type can also be a number, in which
* case Mokapi interprets it as milliseconds
* @default "60s"
* @example
* const res = get(url, { timeout: '5m' })
* @example
* // Timeout as milliseconds
* const res = await fetch(url, { timeout: 3000 });
*/
timeout?: number | string;
}

/**
Expand Down
Loading