Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
mock getFee function
Browse files Browse the repository at this point in the history
  • Loading branch information
W3stside committed Dec 9, 2020
1 parent bfb6384 commit 8be0e2c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/custom/utils/fees.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
interface FeeInformation {
expirationDate: string
minimalFee: string
feeRatio: number
}

// TODO: remove
const ONE_WEEKS_MS = 604800000
const DEFAULT_BASIS_POINTS = 10
const DEFAULT_MINIMAL_FEE = '10'

const MOCK_FEE_INFORMATION: FeeInformation = {
get expirationDate() {
return new Date(Date.now() + ONE_WEEKS_MS).toISOString()
},
minimalFee: DEFAULT_MINIMAL_FEE,
feeRatio: DEFAULT_BASIS_POINTS
}

/**
* @name getFee
* @param currencyId sellToken address as string
* @description Consume fee endpoint
*/
export const getFee = async (currencyId: string): Promise<FeeInformation> => {
return new Promise(accept => {
return setTimeout(() => {
console.debug(
`[MOCK] utils/price::getFee ==> https://protocol.dev.gnosisdev.com/api/v1/fee/${currencyId}`,
MOCK_FEE_INFORMATION
)
accept(MOCK_FEE_INFORMATION)
}, Math.floor(Math.random() * 1000))
})
}

0 comments on commit 8be0e2c

Please sign in to comment.