squarefi-bff-api-module 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,23 +5,23 @@ export declare const refreshTokenPath = "/auth/refresh/refresh-token";
5
5
  export declare const auth: {
6
6
  otp: {
7
7
  verify: {
8
- email: (email: string, token: string) => Promise<import("axios").AxiosResponse<API.Auth.VerifyOtp.Response, any>>;
9
- phone: (phone: string, token: string) => Promise<import("axios").AxiosResponse<API.Auth.VerifyOtp.Response, any>>;
8
+ email: (email: string, token: string) => Promise<API.Auth.VerifyOtp.Response>;
9
+ phone: (phone: string, token: string) => Promise<API.Auth.VerifyOtp.Response>;
10
10
  };
11
11
  };
12
12
  signin: {
13
13
  omni: {
14
- email: (data: API.Auth.SignIn.Email.OTP.Request) => Promise<import("axios").AxiosResponse<unknown, any>>;
15
- phone: (data: API.Auth.SignIn.Phone.OTP.Request) => Promise<import("axios").AxiosResponse<unknown, any>>;
14
+ email: (data: API.Auth.SignIn.Email.OTP.Request) => Promise<unknown>;
15
+ phone: (data: API.Auth.SignIn.Phone.OTP.Request) => Promise<unknown>;
16
16
  };
17
- telegram: (data: API.Auth.Telegram.Signin) => Promise<import("axios").AxiosResponse<API.Auth.Tokens, any>>;
18
- password: (email: string, password: string) => Promise<import("axios").AxiosResponse<API.Auth.SupabaseGetSessionResponse, any>>;
17
+ telegram: (data: API.Auth.Telegram.Signin) => Promise<API.Auth.Tokens>;
18
+ password: (email: string, password: string) => Promise<API.Auth.SupabaseGetSessionResponse>;
19
19
  };
20
20
  signup: {
21
- password: (email: string, password: string) => Promise<import("axios").AxiosResponse<API.Auth.SupabaseGetSessionResponse, any>>;
22
- telegram: (data: API.Auth.Telegram.Signup) => Promise<import("axios").AxiosResponse<unknown, any>>;
21
+ password: (email: string, password: string) => Promise<API.Auth.SupabaseGetSessionResponse>;
22
+ telegram: (data: API.Auth.Telegram.Signup) => Promise<unknown>;
23
23
  };
24
24
  refresh: {
25
- refresh_token: (refresh_token: string) => Promise<import("axios").AxiosResponse<API.Auth.Tokens, any>>;
25
+ refresh_token: (refresh_token: string) => Promise<API.Auth.Tokens>;
26
26
  };
27
27
  };
@@ -1,12 +1,12 @@
1
1
  import { API } from './types';
2
2
  export declare const developer: {
3
3
  apiKeys: {
4
- getAll: () => Promise<import("axios").AxiosResponse<API.Developer.ApiCode.ApiCode[], any>>;
5
- create: (data: API.Developer.ApiCode.Create.Request) => Promise<import("axios").AxiosResponse<API.Developer.ApiCode.Create.Response, any>>;
6
- rotate: (data: API.Developer.ApiCode.Rotate.Request) => Promise<import("axios").AxiosResponse<API.Developer.ApiCode.Rotate.Response, any>>;
7
- update: (data: API.Developer.ApiCode.Update.Request) => Promise<import("axios").AxiosResponse<unknown, any>>;
4
+ getAll: () => Promise<API.Developer.ApiCode.ApiCode[]>;
5
+ create: (data: API.Developer.ApiCode.Create.Request) => Promise<API.Developer.ApiCode.Create.Response>;
6
+ rotate: (data: API.Developer.ApiCode.Rotate.Request) => Promise<API.Developer.ApiCode.Rotate.Response>;
7
+ update: (data: API.Developer.ApiCode.Update.Request) => Promise<unknown>;
8
8
  };
9
9
  vendors: {
10
- list: () => Promise<import("axios").AxiosResponse<API.Developer.Vendors.Vendor[], any>>;
10
+ list: () => Promise<API.Developer.Vendors.Vendor[]>;
11
11
  };
12
12
  };
@@ -4,15 +4,9 @@ exports.exchange = void 0;
4
4
  const apiClientFactory_1 = require("../utils/apiClientFactory");
5
5
  const constants_1 = require("../constants");
6
6
  const createOrderTypeMethods = (orderType) => ({
7
- getByFromCurrency: (from_uuid) => apiClientFactory_1.apiClientV1
8
- .getRequest('/exchange/', { params: { from_uuid, order_type: orderType } })
9
- .then(({ data }) => data),
10
- getByToCurrency: (to_uuid) => apiClientFactory_1.apiClientV1
11
- .getRequest('/exchange/', { params: { to_uuid, order_type: orderType } })
12
- .then(({ data }) => data),
13
- getByOrderType: () => apiClientFactory_1.apiClientV1
14
- .getRequest('/exchange/', { params: { order_type: orderType } })
15
- .then(({ data }) => data),
7
+ getByFromCurrency: (from_uuid) => apiClientFactory_1.apiClientV1.getRequest('/exchange/', { params: { from_uuid, order_type: orderType } }),
8
+ getByToCurrency: (to_uuid) => apiClientFactory_1.apiClientV1.getRequest('/exchange/', { params: { to_uuid, order_type: orderType } }),
9
+ getByOrderType: () => apiClientFactory_1.apiClientV1.getRequest('/exchange/', { params: { order_type: orderType } }),
16
10
  });
17
11
  exports.exchange = {
18
12
  byOrderType: {
@@ -2,31 +2,31 @@ import { API } from './types';
2
2
  export declare const fiat_accounts_v2: {
3
3
  list: {
4
4
  withCards: {
5
- getAll: (wallet_uuid: string, limit: number, offset: number) => Promise<import("axios").AxiosResponse<API.FiatAccountsV2.FiatAccountsListWithCards, any>>;
5
+ getAll: (wallet_uuid: string, limit: number, offset: number) => Promise<API.FiatAccountsV2.FiatAccountsListWithCards>;
6
6
  };
7
7
  withoutCards: {
8
- getAll: (wallet_uuid: string, limit: number, offset: number) => Promise<import("axios").AxiosResponse<API.FiatAccountsV2.FiatAccountsListWithoutCards, any>>;
8
+ getAll: (wallet_uuid: string, limit: number, offset: number) => Promise<API.FiatAccountsV2.FiatAccountsListWithoutCards>;
9
9
  };
10
10
  };
11
- getByUuid: ({ wallet_uuid, fiat_account_id }: API.FiatAccountsV2.ExtendedFiatAccount.Request) => Promise<import("axios").AxiosResponse<API.FiatAccountsV2.ExtendedFiatAccount.ExtendedFiatAccount, any>>;
12
- create: ({ wallet_id, program_id }: API.FiatAccountsV2.CreateFiatAccount.Request) => Promise<import("axios").AxiosResponse<API.FiatAccountsV2.CreateFiatAccount.Response, any>>;
11
+ getByUuid: ({ wallet_uuid, fiat_account_id }: API.FiatAccountsV2.ExtendedFiatAccount.Request) => Promise<API.FiatAccountsV2.ExtendedFiatAccount.ExtendedFiatAccount>;
12
+ create: ({ wallet_id, program_id }: API.FiatAccountsV2.CreateFiatAccount.Request) => Promise<API.FiatAccountsV2.CreateFiatAccount.Response>;
13
13
  transactions: {
14
- get: ({ fiat_account_id, wallet_uuid, limit, offset }: API.FiatAccountsV2.Transactions.TransactionList.Request) => Promise<import("axios").AxiosResponse<API.FiatAccountsV2.Transactions.TransactionList.Response, any>>;
14
+ get: ({ fiat_account_id, wallet_uuid, limit, offset }: API.FiatAccountsV2.Transactions.TransactionList.Request) => Promise<API.FiatAccountsV2.Transactions.TransactionList.Response>;
15
15
  };
16
16
  };
17
17
  export declare const fiat_accounts: {
18
18
  list: {
19
19
  withCards: {
20
- getSinglecards: (wallet_uuid: string, limit: number, offset: number) => Promise<import("axios").AxiosResponse<API.FiatAccounts.FiatAccountWithCards[], any>>;
21
- getAll: (wallet_uuid: string, limit: number, offset: number) => Promise<import("axios").AxiosResponse<API.FiatAccounts.FiatAccountWithCards[], any>>;
20
+ getSinglecards: (wallet_uuid: string, limit: number, offset: number) => Promise<API.FiatAccounts.FiatAccountWithCards[]>;
21
+ getAll: (wallet_uuid: string, limit: number, offset: number) => Promise<API.FiatAccounts.FiatAccountWithCards[]>;
22
22
  };
23
23
  withoutCards: {
24
- getAll: (wallet_uuid: string, limit: number, offset: number) => Promise<import("axios").AxiosResponse<API.FiatAccounts.FiatAccount[], any>>;
24
+ getAll: (wallet_uuid: string, limit: number, offset: number) => Promise<API.FiatAccounts.FiatAccount[]>;
25
25
  };
26
26
  };
27
- getByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<API.FiatAccounts.FiatAccount, any>>;
28
- create: (wallet_id: string, program_id: string) => Promise<import("axios").AxiosResponse<API.FiatAccounts.FiatAccount, any>>;
27
+ getByUuid: (uuid: string) => Promise<API.FiatAccounts.FiatAccount>;
28
+ create: (wallet_id: string, program_id: string) => Promise<API.FiatAccounts.FiatAccount>;
29
29
  transactions: {
30
- get: (fiat_account_id: string, limit?: number, offset?: number) => Promise<import("axios").AxiosResponse<API.FiatAccounts.TransactionList, any>>;
30
+ get: (fiat_account_id: string, limit?: number, offset?: number) => Promise<API.FiatAccounts.TransactionList>;
31
31
  };
32
32
  };
@@ -1,27 +1,26 @@
1
- import { AxiosResponse } from 'axios';
2
1
  import { API } from './types';
3
2
  export declare const issuing: {
4
3
  cards: {
5
4
  create: {
6
- standAloneCard: (data: API.Cards.Create.StandAloneRequest) => Promise<AxiosResponse<API.Cards.CardDetailItem, any>>;
7
- fiatAccountCard: (data: API.Cards.Create.FiatAccountRequest) => Promise<AxiosResponse<API.Cards.CardDetailItem, any>>;
5
+ standAloneCard: (data: API.Cards.Create.StandAloneRequest) => Promise<API.Cards.CardDetailItem>;
6
+ fiatAccountCard: (data: API.Cards.Create.FiatAccountRequest) => Promise<API.Cards.CardDetailItem>;
8
7
  };
9
- getByWalletUuid: (params: API.Cards.CardsList.Request.ByWalletUuid) => Promise<AxiosResponse<API.Cards.CardsList.Response, any>>;
10
- getByFiatAccountAndWalletId: (params: API.Cards.CardsList.Request.ByFiatAccountAndWalletId) => Promise<AxiosResponse<API.Cards.CardsList.Response, any>>;
11
- getById: (card_id: string) => Promise<AxiosResponse<API.Cards.CardDetailItem, any>>;
8
+ getByWalletUuid: (params: API.Cards.CardsList.Request.ByWalletUuid) => Promise<API.Cards.CardsList.Response>;
9
+ getByFiatAccountAndWalletId: (params: API.Cards.CardsList.Request.ByFiatAccountAndWalletId) => Promise<API.Cards.CardsList.Response>;
10
+ getById: (card_id: string) => Promise<API.Cards.CardDetailItem>;
12
11
  sensitiveData: {
13
- get: (card_id: string) => Promise<AxiosResponse<API.Cards.SensitiveData, any>>;
12
+ get: (card_id: string) => Promise<API.Cards.SensitiveData>;
14
13
  otp: {
15
- get: (card_id: string) => Promise<AxiosResponse<API.Cards.OTP, any>>;
14
+ get: (card_id: string) => Promise<API.Cards.OTP>;
16
15
  };
17
16
  };
18
- close: (card_id: string) => Promise<AxiosResponse<any, any>>;
19
- freeze: (card_id: string) => Promise<AxiosResponse<API.Cards.CardDetailItem, any>>;
20
- unfreeze: (card_id: string) => Promise<AxiosResponse<API.Cards.CardDetailItem, any>>;
17
+ close: (card_id: string) => Promise<any>;
18
+ freeze: (card_id: string) => Promise<API.Cards.CardDetailItem>;
19
+ unfreeze: (card_id: string) => Promise<API.Cards.CardDetailItem>;
21
20
  };
22
21
  transactions: {
23
- getByCardId: (card_id: string, limit?: number, offset?: number) => Promise<AxiosResponse<API.Cards.TransactionsList, any>>;
24
- getByFiatAccountId: (fiat_account_id: string, limit?: number, offset?: number) => Promise<AxiosResponse<API.Cards.TransactionsList, any>>;
22
+ getByCardId: (card_id: string, limit?: number, offset?: number) => Promise<API.Cards.TransactionsList>;
23
+ getByFiatAccountId: (fiat_account_id: string, limit?: number, offset?: number) => Promise<API.Cards.TransactionsList>;
25
24
  };
26
25
  config: {
27
26
  programs: {
@@ -8,17 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
11
  Object.defineProperty(exports, "__esModule", { value: true });
23
12
  exports.issuing = void 0;
24
13
  const fiat_accounts_1 = require("./fiat_accounts");
@@ -33,13 +22,13 @@ exports.issuing = {
33
22
  getByWalletUuid: (params) => apiClientFactory_1.apiClientV1.getRequest('/issuing/cards', { params }),
34
23
  getByFiatAccountAndWalletId: (params) => apiClientFactory_1.apiClientV1.getRequest('/issuing/cards', { params }),
35
24
  getById: (card_id) => __awaiter(void 0, void 0, void 0, function* () {
36
- const _a = yield apiClientFactory_1.apiClientV1.getRequest(`/issuing/cards/${card_id}`), { data: card } = _a, rest = __rest(_a, ["data"]);
37
- const { data: fiatAccountData } = yield fiat_accounts_1.fiat_accounts.getByUuid(card.fiat_account.id);
25
+ const card = yield apiClientFactory_1.apiClientV1.getRequest(`/issuing/cards/${card_id}`);
26
+ const fiatAccountData = yield fiat_accounts_1.fiat_accounts.getByUuid(card.fiat_account.id);
38
27
  // const { data: fiatAccountData } = await fiat_accounts.getByUuid({ V2 API FIAT ACCOUNTS
39
28
  // wallet_uuid: card.fiat_account.wallet_id,
40
29
  // fiat_account_id: card.fiat_account.id,
41
30
  // });
42
- return Object.assign(Object.assign({}, rest), { data: Object.assign(Object.assign({}, card), { fiat_account: Object.assign(Object.assign({}, fiatAccountData), { type: card.fiat_account.type }) }) });
31
+ return Object.assign(Object.assign({}, card), { fiat_account: Object.assign(Object.assign({}, fiatAccountData), { type: card.fiat_account.type }) });
43
32
  }),
44
33
  sensitiveData: {
45
34
  get: (card_id) => apiClientFactory_1.apiClientV1.getRequest(`/issuing/cards/${card_id}/sensitive`),
@@ -62,7 +51,7 @@ exports.issuing = {
62
51
  },
63
52
  config: {
64
53
  programs: {
65
- getAll: () => apiClientFactory_1.apiClientV1.getRequest('/issuing/config/programs').then(({ data }) => data),
54
+ getAll: () => apiClientFactory_1.apiClientV1.getRequest('/issuing/config/programs'),
66
55
  },
67
56
  },
68
57
  };
package/dist/api/kyc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { API } from './types';
2
2
  export declare const kyc: {
3
3
  sumsub: {
4
- generate_token: (data: API.KYC.Sumsub.GenerateToken.Request) => Promise<import("axios").AxiosResponse<API.KYC.Sumsub.GenerateToken.Response, any>>;
4
+ generate_token: (data: API.KYC.Sumsub.GenerateToken.Request) => Promise<API.KYC.Sumsub.GenerateToken.Response>;
5
5
  };
6
6
  };
package/dist/api/list.js CHANGED
@@ -5,9 +5,9 @@ exports.list = void 0;
5
5
  const apiClientFactory_1 = require("../utils/apiClientFactory");
6
6
  exports.list = {
7
7
  currencies: {
8
- getAll: (params) => apiClientFactory_1.apiClientV2.getRequest('/currencies', params).then(({ data }) => data),
8
+ getAll: (params) => apiClientFactory_1.apiClientV2.getRequest('/currencies', params),
9
9
  },
10
10
  chains: {
11
- getAll: (params) => apiClientFactory_1.apiClientV2.getRequest('/chains', params).then(({ data }) => data),
11
+ getAll: (params) => apiClientFactory_1.apiClientV2.getRequest('/chains', params),
12
12
  },
13
13
  };
@@ -3,10 +3,10 @@ export declare const orders: {
3
3
  calc: ({ signal, ...params }: API.Orders.Calc.Request) => Promise<API.Orders.Calc.Response>;
4
4
  create: {
5
5
  byOrderType: {
6
- TRANSFER_CARD_SUBACCOUNT: (data: API.Orders.Create.ByOrderType.TRANSFER_CARD_SUBACCOUNT.Request) => Promise<import("axios").AxiosResponse<API.Orders.Create.ByOrderType.TRANSFER_CARD_SUBACCOUNT.Response, any>>;
7
- WITHDRAWAL_CRYPTO: (data: API.Orders.Create.ByOrderType.WITHDRAWAL_CRYPTO.Request) => Promise<import("axios").AxiosResponse<API.Orders.Create.ByOrderType.WITHDRAWAL_CRYPTO.Response, any>>;
8
- EXCHANGE_CRYPTO_INTERNAL: (data: API.Orders.Create.ByOrderType.EXCHANGE_CRYPTO_INTERNAL.Request) => Promise<import("axios").AxiosResponse<API.Orders.Create.ByOrderType.EXCHANGE_CRYPTO_INTERNAL.Response, any>>;
9
- TRANSFER_CARD_WHOLESALE: (data: API.Orders.Create.ByOrderType.TRANSFER_CARD_WHOLESALE.Request) => Promise<import("axios").AxiosResponse<null, any>>;
6
+ TRANSFER_CARD_SUBACCOUNT: (data: API.Orders.Create.ByOrderType.TRANSFER_CARD_SUBACCOUNT.Request) => Promise<API.Orders.Create.ByOrderType.TRANSFER_CARD_SUBACCOUNT.Response>;
7
+ WITHDRAWAL_CRYPTO: (data: API.Orders.Create.ByOrderType.WITHDRAWAL_CRYPTO.Request) => Promise<API.Orders.Create.ByOrderType.WITHDRAWAL_CRYPTO.Response>;
8
+ EXCHANGE_CRYPTO_INTERNAL: (data: API.Orders.Create.ByOrderType.EXCHANGE_CRYPTO_INTERNAL.Request) => Promise<API.Orders.Create.ByOrderType.EXCHANGE_CRYPTO_INTERNAL.Response>;
9
+ TRANSFER_CARD_WHOLESALE: (data: API.Orders.Create.ByOrderType.TRANSFER_CARD_WHOLESALE.Request) => Promise<null>;
10
10
  };
11
11
  };
12
12
  };
@@ -17,7 +17,7 @@ const constants_1 = require("../constants");
17
17
  exports.orders = {
18
18
  calc: (_a) => {
19
19
  var { signal } = _a, params = __rest(_a, ["signal"]);
20
- return apiClientFactory_1.apiClientV1.getRequest('/orders/calc', { params, signal }).then((res) => res.data);
20
+ return apiClientFactory_1.apiClientV1.getRequest('/orders/calc', { params, signal });
21
21
  },
22
22
  create: {
23
23
  byOrderType: {
@@ -1,18 +1,18 @@
1
1
  import { API } from './types';
2
2
  export declare const user: {
3
- get: () => Promise<import("axios").AxiosResponse<API.User.User, any>>;
3
+ get: () => Promise<API.User.User>;
4
4
  userData: {
5
- get: () => Promise<import("axios").AxiosResponse<API.User.UserData.UserData, any>>;
6
- update: (data: API.User.UserData.UpdateUserData.Request) => Promise<import("axios").AxiosResponse<API.User.UserData.UserData, any>>;
5
+ get: () => Promise<API.User.UserData.UserData>;
6
+ update: (data: API.User.UserData.UpdateUserData.Request) => Promise<API.User.UserData.UserData>;
7
7
  };
8
8
  update: {
9
9
  phone: {
10
- request: (data: API.User.UpdateUser.Phone.RequestOTP.Request) => Promise<import("axios").AxiosResponse<unknown, any>>;
11
- confirm: (data: API.User.UpdateUser.Phone.Confirm.Request) => Promise<import("axios").AxiosResponse<unknown, any>>;
10
+ request: (data: API.User.UpdateUser.Phone.RequestOTP.Request) => Promise<unknown>;
11
+ confirm: (data: API.User.UpdateUser.Phone.Confirm.Request) => Promise<unknown>;
12
12
  };
13
13
  email: {
14
- request: (data: API.User.UpdateUser.Email.RequestOTP.Request) => Promise<import("axios").AxiosResponse<unknown, any>>;
15
- confirm: (data: API.User.UpdateUser.Email.Confirm.Request) => Promise<import("axios").AxiosResponse<unknown, any>>;
14
+ request: (data: API.User.UpdateUser.Email.RequestOTP.Request) => Promise<unknown>;
15
+ confirm: (data: API.User.UpdateUser.Email.Confirm.Request) => Promise<unknown>;
16
16
  };
17
17
  };
18
18
  };
@@ -13,30 +13,24 @@ exports.wallets = void 0;
13
13
  const apiClientFactory_1 = require("../utils/apiClientFactory");
14
14
  const constants_1 = require("../constants");
15
15
  exports.wallets = {
16
- create: (type) => apiClientFactory_1.apiClientV2.postRequest('/wallets', { data: { type } }).then(({ data }) => data),
17
- getAll: () => apiClientFactory_1.apiClientV2.getRequest('/wallets').then(({ data }) => data),
18
- getByUuid: (uuid) => apiClientFactory_1.apiClientV2.getRequest(`/wallets/${uuid}`).then(({ data }) => data),
16
+ create: (type) => apiClientFactory_1.apiClientV2.postRequest('/wallets', { data: { type } }),
17
+ getAll: () => apiClientFactory_1.apiClientV2.getRequest('/wallets'),
18
+ getByUuid: (uuid) => apiClientFactory_1.apiClientV2.getRequest(`/wallets/${uuid}`),
19
19
  addresses: {
20
- create: ({ wallet_uuid, chain, label }) => apiClientFactory_1.apiClientV2
21
- .postRequest(`/wallets/${wallet_uuid}/addresses/${chain}`, {
20
+ create: ({ wallet_uuid, chain, label }) => apiClientFactory_1.apiClientV2.postRequest(`/wallets/${wallet_uuid}/addresses/${chain}`, {
22
21
  data: { label },
23
- })
24
- .then(({ data }) => data),
22
+ }),
25
23
  get: {
26
24
  byWalletUuid: {
27
- byChainId: (wallet_uuid, chain_id) => apiClientFactory_1.apiClientV2
28
- .getRequest(`/wallets/${wallet_uuid}/addresses/${chain_id}`)
29
- .then(({ data }) => data),
25
+ byChainId: (wallet_uuid, chain_id) => apiClientFactory_1.apiClientV2.getRequest(`/wallets/${wallet_uuid}/addresses/${chain_id}`),
30
26
  },
31
27
  },
32
28
  },
33
29
  transactions: {
34
30
  getByWalletUuid: (wallet_uuid_1, ...args_1) => __awaiter(void 0, [wallet_uuid_1, ...args_1], void 0, function* (wallet_uuid, limit = constants_1.defaultPaginationParams.limit, offset = constants_1.defaultPaginationParams.offset) {
35
- return apiClientFactory_1.apiClientV2
36
- .getRequest(`/wallets/${wallet_uuid}/transactions`, {
31
+ return apiClientFactory_1.apiClientV2.getRequest(`/wallets/${wallet_uuid}/transactions`, {
37
32
  params: { limit, offset },
38
- })
39
- .then(({ data }) => data);
33
+ });
40
34
  }),
41
35
  },
42
36
  };
@@ -1,25 +1,25 @@
1
- import { AxiosRequestConfig, AxiosResponse } from 'axios';
1
+ import { AxiosRequestConfig } from 'axios';
2
2
  type CreateApiClientOptions = {
3
3
  baseURL: string;
4
4
  tenantId: string;
5
5
  isBearerToken?: boolean;
6
6
  };
7
7
  export declare const createApiClient: ({ baseURL, isBearerToken, tenantId }: CreateApiClientOptions) => {
8
- patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
9
- postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
10
- deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<any, any>>;
11
- getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
8
+ patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
9
+ postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
10
+ deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<any>;
11
+ getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
12
12
  };
13
13
  export declare const apiClientV1: {
14
- patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
15
- postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
16
- deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<any, any>>;
17
- getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
14
+ patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
15
+ postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
16
+ deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<any>;
17
+ getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
18
18
  };
19
19
  export declare const apiClientV2: {
20
- patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
21
- postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
22
- deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<any, any>>;
23
- getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
20
+ patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
21
+ postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
22
+ deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<any>;
23
+ getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
24
24
  };
25
25
  export {};
@@ -115,22 +115,22 @@ const createApiClient = ({ baseURL, isBearerToken, tenantId }) => {
115
115
  const patchRequest = (url, config) => __awaiter(void 0, void 0, void 0, function* () {
116
116
  const _a = config !== null && config !== void 0 ? config : {}, { data = {} } = _a, restConfig = __rest(_a, ["data"]);
117
117
  const res = yield instance.patch(url, data, restConfig);
118
- return res;
118
+ return res.data;
119
119
  });
120
120
  const postRequest = (url, config) => __awaiter(void 0, void 0, void 0, function* () {
121
121
  const _a = config !== null && config !== void 0 ? config : {}, { data = {} } = _a, restConfig = __rest(_a, ["data"]);
122
122
  const res = yield instance.post(url, data, restConfig);
123
- return res;
123
+ return res.data;
124
124
  });
125
125
  const deleteRequest = (url, config) => __awaiter(void 0, void 0, void 0, function* () {
126
126
  const _a = config !== null && config !== void 0 ? config : {}, { data = {} } = _a, restConfig = __rest(_a, ["data"]);
127
127
  const res = yield instance.delete(url, Object.assign({ data }, restConfig));
128
- return res;
128
+ return res.data;
129
129
  });
130
130
  const getRequest = (url, config) => __awaiter(void 0, void 0, void 0, function* () {
131
131
  const _a = config !== null && config !== void 0 ? config : {}, { params = {} } = _a, restConfig = __rest(_a, ["params"]);
132
132
  const res = yield instance.get(url, Object.assign({ params }, restConfig));
133
- return res;
133
+ return res.data;
134
134
  });
135
135
  return { patchRequest, postRequest, deleteRequest, getRequest };
136
136
  };
@@ -40,9 +40,9 @@ function refreshTokens() {
40
40
  })
41
41
  : auth_1.auth.refresh.refresh_token(refreshToken);
42
42
  };
43
- const { data } = yield refreshHandler();
44
- setTokens(data);
45
- return data;
43
+ const tokens = yield refreshHandler();
44
+ setTokens(tokens);
45
+ return tokens;
46
46
  });
47
47
  }
48
48
  function getTokens() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarefi-bff-api-module",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Squarefi BFF API client module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -6,17 +6,11 @@ import { OrderType } from '../constants';
6
6
 
7
7
  const createOrderTypeMethods = (orderType: OrderType) => ({
8
8
  getByFromCurrency: (from_uuid: string) =>
9
- apiClientV1
10
- .getRequest<API.Exchange.Exchange[]>('/exchange/', { params: { from_uuid, order_type: orderType } })
11
- .then(({ data }) => data),
9
+ apiClientV1.getRequest<API.Exchange.Exchange[]>('/exchange/', { params: { from_uuid, order_type: orderType } }),
12
10
  getByToCurrency: (to_uuid: string) =>
13
- apiClientV1
14
- .getRequest<API.Exchange.Exchange[]>('/exchange/', { params: { to_uuid, order_type: orderType } })
15
- .then(({ data }) => data),
11
+ apiClientV1.getRequest<API.Exchange.Exchange[]>('/exchange/', { params: { to_uuid, order_type: orderType } }),
16
12
  getByOrderType: () =>
17
- apiClientV1
18
- .getRequest<API.Exchange.Exchange[]>('/exchange/', { params: { order_type: orderType } })
19
- .then(({ data }) => data),
13
+ apiClientV1.getRequest<API.Exchange.Exchange[]>('/exchange/', { params: { order_type: orderType } }),
20
14
  });
21
15
 
22
16
  export const exchange = {
@@ -1,5 +1,3 @@
1
- import { AxiosResponse } from 'axios';
2
-
3
1
  import { fiat_accounts } from './fiat_accounts';
4
2
  import { API } from './types';
5
3
 
@@ -19,17 +17,15 @@ export const issuing = {
19
17
  apiClientV1.getRequest<API.Cards.CardsList.Response>('/issuing/cards', { params }),
20
18
  getByFiatAccountAndWalletId: (params: API.Cards.CardsList.Request.ByFiatAccountAndWalletId) =>
21
19
  apiClientV1.getRequest<API.Cards.CardsList.Response>('/issuing/cards', { params }),
22
- getById: async (card_id: string): Promise<AxiosResponse<API.Cards.CardDetailItem, any>> => {
23
- const { data: card, ...rest } = await apiClientV1.getRequest<API.Cards.CardDetailItem>(
24
- `/issuing/cards/${card_id}`
25
- );
26
- const { data: fiatAccountData } = await fiat_accounts.getByUuid(card.fiat_account.id);
20
+ getById: async (card_id: string): Promise<API.Cards.CardDetailItem> => {
21
+ const card = await apiClientV1.getRequest<API.Cards.CardDetailItem>(`/issuing/cards/${card_id}`);
22
+ const fiatAccountData = await fiat_accounts.getByUuid(card.fiat_account.id);
27
23
 
28
24
  // const { data: fiatAccountData } = await fiat_accounts.getByUuid({ V2 API FIAT ACCOUNTS
29
25
  // wallet_uuid: card.fiat_account.wallet_id,
30
26
  // fiat_account_id: card.fiat_account.id,
31
27
  // });
32
- return { ...rest, data: { ...card, fiat_account: { ...fiatAccountData, type: card.fiat_account.type } } };
28
+ return { ...card, fiat_account: { ...fiatAccountData, type: card.fiat_account.type } };
33
29
  },
34
30
  sensitiveData: {
35
31
  get: (card_id: string) => apiClientV1.getRequest<API.Cards.SensitiveData>(`/issuing/cards/${card_id}/sensitive`),
@@ -59,8 +55,7 @@ export const issuing = {
59
55
  },
60
56
  config: {
61
57
  programs: {
62
- getAll: () =>
63
- apiClientV1.getRequest<API.Issuing.Programs.Response>('/issuing/config/programs').then(({ data }) => data),
58
+ getAll: () => apiClientV1.getRequest<API.Issuing.Programs.Response>('/issuing/config/programs'),
64
59
  },
65
60
  },
66
61
  };
package/src/api/list.ts CHANGED
@@ -8,11 +8,9 @@ import { apiClientV2 } from '../utils/apiClientFactory';
8
8
 
9
9
  export const list = {
10
10
  currencies: {
11
- getAll: (params?: AxiosRequestConfig) =>
12
- apiClientV2.getRequest<API.Currencies.CurrencyList>('/currencies', params).then(({ data }) => data),
11
+ getAll: (params?: AxiosRequestConfig) => apiClientV2.getRequest<API.Currencies.CurrencyList>('/currencies', params),
13
12
  },
14
13
  chains: {
15
- getAll: (params?: AxiosRequestConfig) =>
16
- apiClientV2.getRequest<API.Chains.ChainList>('/chains', params).then(({ data }) => data),
14
+ getAll: (params?: AxiosRequestConfig) => apiClientV2.getRequest<API.Chains.ChainList>('/chains', params),
17
15
  },
18
16
  };
package/src/api/orders.ts CHANGED
@@ -6,7 +6,7 @@ import { OrderType } from '../constants';
6
6
 
7
7
  export const orders = {
8
8
  calc: ({ signal, ...params }: API.Orders.Calc.Request) =>
9
- apiClientV1.getRequest<API.Orders.Calc.Response>('/orders/calc', { params, signal }).then((res) => res.data),
9
+ apiClientV1.getRequest<API.Orders.Calc.Response>('/orders/calc', { params, signal }),
10
10
  create: {
11
11
  byOrderType: {
12
12
  [OrderType.TRANSFER_CARD_SUBACCOUNT]: (data: API.Orders.Create.ByOrderType.TRANSFER_CARD_SUBACCOUNT.Request) =>
@@ -5,22 +5,18 @@ import { apiClientV2 } from '../utils/apiClientFactory';
5
5
  import { defaultPaginationParams, WalletTypeValues } from '../constants';
6
6
 
7
7
  export const wallets = {
8
- create: (type: WalletTypeValues) => apiClientV2.postRequest('/wallets', { data: { type } }).then(({ data }) => data),
9
- getAll: () => apiClientV2.getRequest<API.Wallets.WalletsList.Response>('/wallets').then(({ data }) => data),
10
- getByUuid: (uuid: string) => apiClientV2.getRequest<API.Wallets.Wallet>(`/wallets/${uuid}`).then(({ data }) => data),
8
+ create: (type: WalletTypeValues) => apiClientV2.postRequest('/wallets', { data: { type } }),
9
+ getAll: () => apiClientV2.getRequest<API.Wallets.WalletsList.Response>('/wallets'),
10
+ getByUuid: (uuid: string) => apiClientV2.getRequest<API.Wallets.Wallet>(`/wallets/${uuid}`),
11
11
  addresses: {
12
12
  create: ({ wallet_uuid, chain, label }: API.Wallets.WalletChain.Create.Request) =>
13
- apiClientV2
14
- .postRequest<API.Wallets.WalletChain.Create.Response>(`/wallets/${wallet_uuid}/addresses/${chain}`, {
15
- data: { label },
16
- })
17
- .then(({ data }) => data),
13
+ apiClientV2.postRequest<API.Wallets.WalletChain.Create.Response>(`/wallets/${wallet_uuid}/addresses/${chain}`, {
14
+ data: { label },
15
+ }),
18
16
  get: {
19
17
  byWalletUuid: {
20
18
  byChainId: (wallet_uuid: string, chain_id: number) =>
21
- apiClientV2
22
- .getRequest<API.Wallets.WalletChain.WalletChain>(`/wallets/${wallet_uuid}/addresses/${chain_id}`)
23
- .then(({ data }) => data),
19
+ apiClientV2.getRequest<API.Wallets.WalletChain.WalletChain>(`/wallets/${wallet_uuid}/addresses/${chain_id}`),
24
20
  },
25
21
  },
26
22
  },
@@ -30,10 +26,11 @@ export const wallets = {
30
26
  limit = defaultPaginationParams.limit,
31
27
  offset = defaultPaginationParams.offset
32
28
  ) =>
33
- apiClientV2
34
- .getRequest<API.Wallets.WalletTransactions.TransactionList.Response>(`/wallets/${wallet_uuid}/transactions`, {
29
+ apiClientV2.getRequest<API.Wallets.WalletTransactions.TransactionList.Response>(
30
+ `/wallets/${wallet_uuid}/transactions`,
31
+ {
35
32
  params: { limit, offset },
36
- })
37
- .then(({ data }) => data),
33
+ }
34
+ ),
38
35
  },
39
36
  };
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-console */
2
2
  import { isTMA } from '@telegram-apps/sdk-react';
3
- import axios, { AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
3
+ import axios, { AxiosRequestConfig, InternalAxiosRequestConfig } from 'axios';
4
4
 
5
5
  import { telegramSignUpPath, telegramSignInPath, refreshTokenPath } from '../api/auth';
6
6
 
@@ -122,20 +122,20 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }: CreateApiC
122
122
  }
123
123
  );
124
124
 
125
- const patchRequest = async <T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> => {
125
+ const patchRequest = async <T>(url: string, config?: AxiosRequestConfig): Promise<T> => {
126
126
  const { data = {}, ...restConfig } = config ?? {};
127
127
 
128
128
  const res = await instance.patch(url, data, restConfig);
129
129
 
130
- return res;
130
+ return res.data;
131
131
  };
132
132
 
133
- const postRequest = async <T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> => {
133
+ const postRequest = async <T>(url: string, config?: AxiosRequestConfig): Promise<T> => {
134
134
  const { data = {}, ...restConfig } = config ?? {};
135
135
 
136
136
  const res = await instance.post(url, data, restConfig);
137
137
 
138
- return res;
138
+ return res.data;
139
139
  };
140
140
 
141
141
  const deleteRequest = async (url: string, config?: AxiosRequestConfig) => {
@@ -143,15 +143,15 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }: CreateApiC
143
143
 
144
144
  const res = await instance.delete(url, { data, ...restConfig });
145
145
 
146
- return res;
146
+ return res.data;
147
147
  };
148
148
 
149
- const getRequest = async <T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> => {
149
+ const getRequest = async <T>(url: string, config?: AxiosRequestConfig): Promise<T> => {
150
150
  const { params = {}, ...restConfig } = config ?? {};
151
151
 
152
152
  const res = await instance.get(url, { params, ...restConfig });
153
153
 
154
- return res;
154
+ return res.data;
155
155
  };
156
156
 
157
157
  return { patchRequest, postRequest, deleteRequest, getRequest };
@@ -35,11 +35,11 @@ export async function refreshTokens() {
35
35
  })
36
36
  : auth.refresh.refresh_token(refreshToken as string);
37
37
 
38
- const { data } = await refreshHandler();
38
+ const tokens = await refreshHandler();
39
39
 
40
- setTokens(data);
40
+ setTokens(tokens);
41
41
 
42
- return data;
42
+ return tokens;
43
43
  }
44
44
 
45
45
  export function getTokens() {