-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from madfish-solutions/development
Release latest changes to master
- Loading branch information
Showing
7 changed files
with
77 additions
and
66 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
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
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
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 { ParsedQs } from 'qs'; | ||
|
||
import { isDefined } from '../helpers'; | ||
|
||
type QueryParam = string | ParsedQs | string[] | ParsedQs[] | undefined; | ||
|
||
export const getAliceBobEstimationPayload = ( | ||
isWithdraw: QueryParam, | ||
from: QueryParam, | ||
to: QueryParam, | ||
amount: QueryParam | ||
) => { | ||
const booleanIsWithdraw = isWithdraw === 'true'; | ||
|
||
return { | ||
from: isDefined(isWithdraw) ? (booleanIsWithdraw ? 'TEZ' : 'CARDUAH') : String(from), | ||
to: isDefined(isWithdraw) ? (booleanIsWithdraw ? 'CARDUAH' : 'TEZ') : String(to), | ||
fromAmount: Number(amount) | ||
}; | ||
}; |
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
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,14 @@ | ||
import { AliceBobPairInfo } from '../../interfaces/alice-bob.interfaces'; | ||
import { aliceBobApi } from '../api.sevice'; | ||
import { getAliceBobRequestHeaders } from './get-alice-bob-request-headers'; | ||
import { getAliceBobSignature } from './get-alice-bob-signature'; | ||
|
||
export const getAliceBobPairsInfo = async (isWithdraw = false) => { | ||
const { signature, now } = getAliceBobSignature(); | ||
|
||
const { data } = await aliceBobApi.get<AliceBobPairInfo[]>('/get-pairs-info', { | ||
headers: getAliceBobRequestHeaders(signature, now) | ||
}); | ||
|
||
return data.filter(pair => (isWithdraw ? pair.from === 'TEZ' : pair.from !== 'TEZ')); | ||
}; |
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