Skip to content

Commit e246d79

Browse files
authored
Merge pull request #173 from fireblocks/PIK-9685-fireblocks-network-link-add-the-rate-request-to-the-nlv-2
feat | Pik-9685 | fireblocks network link add the rate request to the nlv 2
2 parents e1851a0 + 2baeb50 commit e246d79

17 files changed

Lines changed: 668 additions & 6 deletions

File tree

v2/api-validator/capability-presets/all-capabilities/capabilities.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"transfersFiat": "*",
1010
"transfersPeerAccounts": "*",
1111
"trading": "*",
12-
"liquidity": "*"
12+
"liquidity": "*",
13+
"rates": "*"
1314
}
14-
}
15+
}

v2/api-validator/src/client/SecureClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
OpenAPI,
2222
OpenAPIConfig,
2323
RampsService,
24+
RatesService,
2425
TradingService,
2526
TransfersBlockchainService,
2627
TransfersFiatService,
@@ -105,6 +106,7 @@ export class SecureClient {
105106
public readonly transfersInternal: SecureService<TransfersInternalService>;
106107
public readonly collateral: SecureService<CollateralService>;
107108
public readonly ramps: SecureService<RampsService>;
109+
public readonly rates: SecureService<RatesService>;
108110
private readonly request: BaseHttpRequest;
109111

110112
private static cachedApiComponents?: ApiComponents;
@@ -116,6 +118,7 @@ export class SecureClient {
116118
BASE: config.get('client').serverBaseUrl,
117119
});
118120

121+
this.rates = stripSecurityHeaderArgs(new RatesService(this.request));
119122
this.accounts = stripSecurityHeaderArgs(new AccountsService(this.request));
120123
this.balances = stripSecurityHeaderArgs(new BalancesService(this.request));
121124
this.capabilities = stripSecurityHeaderArgs(new CapabilitiesService(this.request));

v2/api-validator/src/client/generated/ApiClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { CollateralService } from './services/CollateralService';
1313
import { HistoricBalancesService } from './services/HistoricBalancesService';
1414
import { LiquidityService } from './services/LiquidityService';
1515
import { RampsService } from './services/RampsService';
16+
import { RatesService } from './services/RatesService';
1617
import { TradingService } from './services/TradingService';
1718
import { TransfersService } from './services/TransfersService';
1819
import { TransfersBlockchainService } from './services/TransfersBlockchainService';
@@ -31,6 +32,7 @@ export class ApiClient {
3132
public readonly historicBalances: HistoricBalancesService;
3233
public readonly liquidity: LiquidityService;
3334
public readonly ramps: RampsService;
35+
public readonly rates: RatesService;
3436
public readonly trading: TradingService;
3537
public readonly transfers: TransfersService;
3638
public readonly transfersBlockchain: TransfersBlockchainService;
@@ -60,6 +62,7 @@ export class ApiClient {
6062
this.historicBalances = new HistoricBalancesService(this.request);
6163
this.liquidity = new LiquidityService(this.request);
6264
this.ramps = new RampsService(this.request);
65+
this.rates = new RatesService(this.request);
6366
this.trading = new TradingService(this.request);
6467
this.transfers = new TransfersService(this.request);
6568
this.transfersBlockchain = new TransfersBlockchainService(this.request);

v2/api-validator/src/client/generated/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export type { CollateralWithdrawalTransactions } from './models/CollateralWithdr
7272
export { CollateralWithdrawalTransactionStatus } from './models/CollateralWithdrawalTransactionStatus';
7373
export type { CommonRamp } from './models/CommonRamp';
7474
export type { CommonRampRequestProperties } from './models/CommonRampRequestProperties';
75+
export type { ConversionPairIdQueryParam } from './models/ConversionPairIdQueryParam';
7576
export { CountryAlpha2Code } from './models/CountryAlpha2Code';
7677
export type { CryptocurrencyReference } from './models/CryptocurrencyReference';
7778
export { CryptocurrencySymbol } from './models/CryptocurrencySymbol';
@@ -127,6 +128,7 @@ export { OnRampProperties } from './models/OnRampProperties';
127128
export type { OnRampPropertiesWithPaymentInstructions } from './models/OnRampPropertiesWithPaymentInstructions';
128129
export type { Order } from './models/Order';
129130
export type { OrderBook } from './models/OrderBook';
131+
export type { OrderBookPairIdQueryParam } from './models/OrderBookPairIdQueryParam';
130132
export type { OrderCommonProperties } from './models/OrderCommonProperties';
131133
export type { OrderData } from './models/OrderData';
132134
export { OrderQuote } from './models/OrderQuote';
@@ -173,7 +175,9 @@ export type { RampFees } from './models/RampFees';
173175
export type { RampFiatTransfer } from './models/RampFiatTransfer';
174176
export type { RampMethod } from './models/RampMethod';
175177
export type { RampRequest } from './models/RampRequest';
178+
export type { RampsPairIdQueryParam } from './models/RampsPairIdQueryParam';
176179
export { RampStatus } from './models/RampStatus';
180+
export type { Rate } from './models/Rate';
177181
export { RequestPart } from './models/RequestPart';
178182
export type { RoutingNumber } from './models/RoutingNumber';
179183
export type { SettlementDepositInstruction } from './models/SettlementDepositInstruction';
@@ -222,6 +226,7 @@ export { CollateralService } from './services/CollateralService';
222226
export { HistoricBalancesService } from './services/HistoricBalancesService';
223227
export { LiquidityService } from './services/LiquidityService';
224228
export { RampsService } from './services/RampsService';
229+
export { RatesService } from './services/RatesService';
225230
export { TradingService } from './services/TradingService';
226231
export { TransfersService } from './services/TransfersService';
227232
export { TransfersBlockchainService } from './services/TransfersBlockchainService';

v2/api-validator/src/client/generated/models/ApiComponents.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ export type ApiComponents = {
2121
liquidity?: AccountsSet;
2222
collateral?: AccountsSet;
2323
ramps?: AccountsSet;
24+
rates?: AccountsSet;
2425
};
2526

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
6+
/**
7+
* Conversion pair to get the rate for.
8+
*/
9+
export type ConversionPairIdQueryParam = string;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
6+
/**
7+
* Order book pair to get the rate for.
8+
*/
9+
export type OrderBookPairIdQueryParam = string;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
6+
/**
7+
* Ramps pair to get the rate for.
8+
*/
9+
export type RampsPairIdQueryParam = string;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
6+
export type Rate = {
7+
rate: string;
8+
/**
9+
* In Milliseconds. The timestamp on the creation of the rate.
10+
*/
11+
timestamp: number;
12+
};
13+
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
import type { Rate } from '../models/Rate';
6+
7+
import type { CancelablePromise } from '../core/CancelablePromise';
8+
import type { BaseHttpRequest } from '../core/BaseHttpRequest';
9+
10+
export class RatesService {
11+
12+
constructor(public readonly httpRequest: BaseHttpRequest) {}
13+
14+
/**
15+
* Get rate by account and assets
16+
* @returns Rate Rate by pair id.
17+
* @throws ApiError
18+
*/
19+
public getRateByAccountAndPairId({
20+
xFbapiKey,
21+
xFbapiNonce,
22+
xFbapiTimestamp,
23+
xFbapiSignature,
24+
accountId,
25+
conversionPairId,
26+
rampsPairId,
27+
orderBookPairId,
28+
}: {
29+
/**
30+
* API authentication key.
31+
*/
32+
xFbapiKey: string,
33+
/**
34+
* Unique identifier of the request.
35+
*/
36+
xFbapiNonce: string,
37+
/**
38+
* Request timestamp in milliseconds since Unix epoch.
39+
*/
40+
xFbapiTimestamp: number,
41+
/**
42+
* Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order:
43+
* - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body
44+
*/
45+
xFbapiSignature: string,
46+
/**
47+
* Sub-account identifier.
48+
*/
49+
accountId: string,
50+
/**
51+
* Conversion pair to get the rate for.
52+
*/
53+
conversionPairId?: string,
54+
/**
55+
* Ramps pair to get the rate for.
56+
*/
57+
rampsPairId?: string,
58+
/**
59+
* Order book pair to get the rate for.
60+
*/
61+
orderBookPairId?: string,
62+
}): CancelablePromise<Rate> {
63+
return this.httpRequest.request({
64+
method: 'GET',
65+
url: '/accounts/{accountId}/rate',
66+
path: {
67+
'accountId': accountId,
68+
},
69+
headers: {
70+
'X-FBAPI-KEY': xFbapiKey,
71+
'X-FBAPI-NONCE': xFbapiNonce,
72+
'X-FBAPI-TIMESTAMP': xFbapiTimestamp,
73+
'X-FBAPI-SIGNATURE': xFbapiSignature,
74+
},
75+
query: {
76+
'conversionPairId': conversionPairId,
77+
'rampsPairId': rampsPairId,
78+
'orderBookPairId': orderBookPairId,
79+
},
80+
errors: {
81+
400: `Request could not be processed due to a client error.`,
82+
401: `Request is unauthorized`,
83+
},
84+
});
85+
}
86+
87+
}

0 commit comments

Comments
 (0)