-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: transak api get crypto and fiat currencies (#2709)
- Loading branch information
1 parent
f587654
commit 3fa8484
Showing
11 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './transak.api' |
20 changes: 20 additions & 0 deletions
20
packages/shared/src/lib/auxiliary/transak/apis/transak.api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { BaseApi } from '@core/utils' | ||
import { TRANSAK_API_BASE_URL } from '../constants' | ||
import { ITransakApiCryptoCurrenciesResponse, ITransakApiFiatCurrenciesResponse } from '../interfaces' | ||
import { TransakApiEndpoint } from '../enums' | ||
|
||
export class TransakApi extends BaseApi { | ||
constructor() { | ||
super(TRANSAK_API_BASE_URL) | ||
} | ||
|
||
async getFiatCurrencies(): Promise<ITransakApiFiatCurrenciesResponse | undefined> { | ||
const response = await this.get<ITransakApiFiatCurrenciesResponse>(TransakApiEndpoint.FiatCurrencies) | ||
return response | ||
} | ||
|
||
async getCryptoCurrencies(): Promise<ITransakApiCryptoCurrenciesResponse | undefined> { | ||
const response = await this.get<ITransakApiCryptoCurrenciesResponse>(TransakApiEndpoint.CryptoCurrencies) | ||
return response | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
export * from './transak-api-base-url.constant' | ||
export * from './transak-api-production-base-url.constant' | ||
export * from './transak-api-staging-base-url.constant' | ||
export * from './transak-production-widget-url.constant' | ||
export * from './transak-staging-widget-url.constant' | ||
export * from './transak-widget-url.constant' |
6 changes: 6 additions & 0 deletions
6
packages/shared/src/lib/auxiliary/transak/constants/transak-api-base-url.constant.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { AppStage } from '@core/app/enums/app-stage.enum' | ||
import { TRANSAK_API_PRODUCTION_BASE_URL } from './transak-api-production-base-url.constant' | ||
import { TRANSAK_API_STAGING_BASE_URL } from './transak-api-staging-base-url.constant' | ||
|
||
export const TRANSAK_API_BASE_URL = | ||
process.env.STAGE === AppStage.PROD ? TRANSAK_API_PRODUCTION_BASE_URL : TRANSAK_API_STAGING_BASE_URL |
1 change: 1 addition & 0 deletions
1
...es/shared/src/lib/auxiliary/transak/constants/transak-api-production-base-url.constant.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const TRANSAK_API_PRODUCTION_BASE_URL = 'https://api.transak.com/api/v2' |
1 change: 1 addition & 0 deletions
1
packages/shared/src/lib/auxiliary/transak/constants/transak-api-staging-base-url.constant.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const TRANSAK_API_STAGING_BASE_URL = 'https://api-stg.transak.com/api/v2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './transak-api-endpoint.enum' | ||
export * from './transak-connection-status.enum' |
4 changes: 4 additions & 0 deletions
4
packages/shared/src/lib/auxiliary/transak/enums/transak-api-endpoint.enum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum TransakApiEndpoint { | ||
CryptoCurrencies = 'currencies/crypto-currencies', | ||
FiatCurrencies = 'currencies/fiat-currencies', | ||
} |
2 changes: 2 additions & 0 deletions
2
packages/shared/src/lib/auxiliary/transak/interfaces/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './transak-api-crypto-currencies-response.interface' | ||
export * from './transak-api-fiat-currencies-response.interface' |
34 changes: 34 additions & 0 deletions
34
.../src/lib/auxiliary/transak/interfaces/transak-api-crypto-currencies-response.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export interface ITransakApiCryptoCurrenciesResponse { | ||
response: ITransakApiCryptoCurrenciesResponseItem[] | ||
} | ||
|
||
export interface ITransakApiCryptoCurrenciesResponseItem { | ||
_id: string | ||
coinId: string | ||
address?: string | ||
addressAdditionalData?: boolean | { name: string; displayName: string } | ||
createdAt: string | ||
decimals: number | ||
image: ITransakCryptoCurrencyImage | ||
isAllowed: boolean | ||
isPopular: boolean | ||
isStable: boolean | ||
name: string | ||
roundOff: number | ||
symbol: string | ||
isIgnorePriceVerification: boolean | ||
image_bk?: ITransakCryptoCurrencyImage | ||
kycCountriesNotSupported: string[] | ||
network: { name: string; fiatCurrenciesNotSupported: string[]; chainId?: string } | ||
uniqueId: string | ||
tokenType: string | ||
isPayInAllowed: boolean | ||
isSuspended: boolean | ||
tokenIdentifier?: string | ||
} | ||
|
||
interface ITransakCryptoCurrencyImage { | ||
large: string | ||
small: string | ||
thumb: string | ||
} |
46 changes: 46 additions & 0 deletions
46
...ed/src/lib/auxiliary/transak/interfaces/transak-api-fiat-currencies-response.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FiatCurrency } from '@core/market' | ||
|
||
export interface ITransakApiFiatCurrenciesResponse { | ||
response: ITransakApiFiatCurrenciesResponseItem[] | ||
} | ||
|
||
export interface ITransakApiFiatCurrenciesResponseItem { | ||
symbol: keyof typeof FiatCurrency | ||
supportingCountries: string[] | ||
logoSymbol: string | ||
name: string | ||
paymentOptions: ITransakApiPaymentOption[] | ||
isPopular: boolean | ||
isAllowed: boolean | ||
roundOff: number | ||
isPayOutAllowed: boolean | ||
defaultCountryForNFT?: string | ||
icon: string | ||
displayMessage?: string | ||
} | ||
|
||
export interface ITransakApiPaymentOption { | ||
name: string | ||
id: string | ||
isNftAllowed?: boolean | ||
isNonCustodial?: boolean | ||
processingTime: string | ||
displayText: boolean | ||
icon: string | ||
limitCurrency: string | ||
isActive: boolean | ||
provider?: string | ||
maxAmount: number | ||
minAmount: number | ||
defaultAmount: number | ||
isConverted: boolean | ||
visaPayoutCountries?: string[] | ||
mastercardPayoutCountries?: string[] | ||
isPayOutAllowed?: boolean | ||
minAmountForPayOut?: number | ||
maxAmountForPayOut?: number | ||
defaultAmountForPayOut?: number | ||
isBillingAddressRequired?: boolean | ||
supportedCountryCode?: string[] | ||
displayMessage?: string | ||
} |