forked from cyberconnecthq/passport
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1251 update smart contract integration (passportxyz#1279)
* feat(iam, app): request fee from user and pass to smart contract * fix(app): 2 dollar fee * fix(app): testing the 2 dollar fee * fix(iam): cleaning up logs, wrapping up tests * fix(iam): fix linter complaints * fix(iam): fix failing tests, use default values for env vars --------- Co-authored-by: nutrina <[email protected]>
- Loading branch information
Showing
7 changed files
with
145 additions
and
64 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 was deleted.
Oops, something went wrong.
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,21 @@ | ||
import axios from "axios"; | ||
import { utils } from "ethers"; | ||
import { BigNumber } from "@ethersproject/bignumber"; | ||
|
||
export async function getEASFeeAmount(usdAmount: number): Promise<BigNumber> { | ||
const ethUSD: { | ||
data: { | ||
ethereum: { | ||
usd: number; | ||
}; | ||
}; | ||
} = await axios.get("https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=USD", { | ||
headers: { | ||
// TODO add API key | ||
Accept: "application/json", | ||
}, | ||
}); | ||
|
||
const ethAmount = usdAmount / ethUSD.data.ethereum.usd; | ||
return utils.parseEther(ethAmount.toFixed(18)); | ||
} |
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