Skip to content

Commit eebd85e

Browse files
authored
🤖 Merge PR DefinitelyTyped#74595 [invity-api] add subdivision to lists and statusUrl to trades by @hehe100596
1 parent 8e111f1 commit eebd85e

2 files changed

Lines changed: 64 additions & 4 deletions

File tree

‎types/invity-api/index.d.ts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ export interface BuySellProviderMetadata extends ProviderMetadata {
100100
disabledSubdivisions?: Subdivisions;
101101
}
102102

103+
export interface TradeCommon {
104+
statusUrl?: string | null; // URL with ID assigned to the trade by the provider to check status; if null, do not show any status url
105+
}
106+
103107
// buy types
104108

105109
export type BuyTradeFinalStatus =
@@ -160,6 +164,7 @@ export interface BuyProviderInfo extends BuySellProviderMetadata {
160164

161165
export interface BuyListResponse {
162166
country: string;
167+
subdivision?: string;
163168
suggestedFiatCurrency?: string | undefined; // optional field, fiat currency based on user's IP
164169
providers: BuyProviderInfo[];
165170
defaultAmountsOfFiatCurrencies: FiatCurrenciesProps;
@@ -180,7 +185,7 @@ export interface BuyTradeQuoteRequest {
180185

181186
export type BuyTradeQuoteResponse = BuyTrade[];
182187

183-
export interface BuyTrade {
188+
export interface BuyTrade extends TradeCommon {
184189
fiatAmount?: number | undefined; // 1000 - DEPRECATED, used only for TREZOR
185190
fiatStringAmount?: string | undefined; // 1000 - will pay fiat amount
186191
fiatCurrency?: string | undefined; // EUR
@@ -294,7 +299,7 @@ export type DexApprovalType =
294299
| "ZERO" // resets approval
295300
| "PRESET"; // PRESET takes value from approvalStringAmount
296301

297-
export interface ExchangeTrade {
302+
export interface ExchangeTrade extends TradeCommon {
298303
send?: CryptoId | undefined; // bitcoin
299304

300305
sendStringAmount?: string | undefined; // "0.01"
@@ -314,7 +319,6 @@ export interface ExchangeTrade {
314319
signature?: string | undefined; // Evercoin only, passed from createTrade response to confirmTrade request
315320
orderId?: string | undefined; // internal ID assigned to the trade by the exchange
316321
quoteId?: string | undefined;
317-
statusUrl?: string | undefined; // internal URL + ID assigned to the trade by the exchange to check status
318322
status?: ExchangeTradeStatus | undefined; // state of trade after confirmTrade
319323
error?: string | undefined; // something went wrong after confirmTrade
320324
receiveTxHash?: string | undefined; // hash of tx from exchange to user or DEX swap
@@ -494,6 +498,7 @@ export interface SellProviderInfo extends BuySellProviderMetadata {
494498

495499
export interface SellListResponse {
496500
country: string;
501+
subdivision?: string;
497502
providers: SellProviderInfo[];
498503
}
499504

@@ -515,7 +520,7 @@ export interface SellFiatTradeQuoteRequest {
515520

516521
export type SellFiatTradeQuoteResponse = SellFiatTrade[];
517522

518-
export interface SellFiatTrade {
523+
export interface SellFiatTrade extends TradeCommon {
519524
amountInCrypto?: boolean | undefined; // true for cryptoAmount, false for fiatAmount
520525
fiatStringAmount?: string | undefined; // 1000
521526
fiatCurrency?: string | undefined; // EUR

‎types/invity-api/invity-api-tests.ts‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
BuyListResponse,
23
BuyProviderInfo,
34
BuyTrade,
45
ConfirmExchangeTradeRequest,
@@ -12,6 +13,7 @@ import {
1213
InfoResponse,
1314
SellFiatTrade,
1415
SellFiatTradeSigned,
16+
SellListResponse,
1517
SellProviderInfo,
1618
WatchSellTradeResponse,
1719
} from "invity-api";
@@ -178,3 +180,56 @@ const exchangeTradeQuoteRequest: ExchangeTradeQuoteRequest = {
178180
fromAddress: "fromAddress",
179181
receiveAddress: "receiveAddress",
180182
};
183+
184+
const buyListResponse: BuyListResponse = {
185+
country: "US",
186+
subdivision: "WA",
187+
suggestedFiatCurrency: "USD",
188+
providers: [providerInfo],
189+
defaultAmountsOfFiatCurrencies: {
190+
usd: 1,
191+
eur: 1,
192+
gbp: 1,
193+
aed: 1,
194+
ars: 1,
195+
aud: 1,
196+
bdt: 1,
197+
brl: 1,
198+
cad: 1,
199+
chf: 1,
200+
clp: 1,
201+
cny: 1,
202+
czk: 1,
203+
dkk: 1,
204+
hkd: 1,
205+
huf: 1,
206+
idr: 1,
207+
ils: 1,
208+
inr: 1,
209+
jpy: 1,
210+
krw: 1,
211+
kwd: 1,
212+
lkr: 1,
213+
mxn: 1,
214+
myr: 1,
215+
nok: 1,
216+
nzd: 1,
217+
php: 1,
218+
pln: 1,
219+
rub: 1,
220+
sar: 1,
221+
sek: 1,
222+
sgd: 1,
223+
thb: 1,
224+
try: 1,
225+
twd: 1,
226+
vnd: 1,
227+
zar: 1,
228+
},
229+
};
230+
231+
const sellListResponse: SellListResponse = {
232+
country: "US",
233+
subdivision: "WA",
234+
providers: [sellProviderInfo],
235+
};

0 commit comments

Comments
 (0)