Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: develop -> main #370

Merged
merged 17 commits into from
Aug 15, 2024
7 changes: 3 additions & 4 deletions src/sdk/utils/faucet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe("useFaucet", () => {
test("should request funds from faucet with default amounts", async () => {
await useFaucet({ address, chain, grecaptcha })

const expectedCoins = ["11000000unibi", "100000000unusd", "100000000uusdt"]
const expectedCoins = ["10000000unibi"]

expect(fetch).toHaveBeenCalledWith(expectedUrl, {
method: "POST",
Expand All @@ -91,10 +91,9 @@ describe("useFaucet", () => {
})

test("should request funds from faucet with custom amounts", async () => {
const amts = { nibi: 5, nusd: 50, usdt: 50 }
await useFaucet({ address, chain, amts, grecaptcha })
await useFaucet({ address, chain, grecaptcha })

const expectedCoins = ["5000000unibi", "50000000unusd", "50000000uusdt"]
const expectedCoins = ["10000000unibi"]

expect(fetch).toHaveBeenCalledWith(expectedUrl, {
method: "POST",
Expand Down
19 changes: 2 additions & 17 deletions src/sdk/utils/faucet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,18 @@ import { fetch } from "cross-fetch"
import { Chain, chainToParts } from "."

/**
* Sends 11 NIBI, 100 NUSD, and 100 USDT to the given address from the testnet faucet.
* Sends 10 NIBI to the given address from the testnet faucet.
*/
export async function useFaucet({
address,
chain,
amts,
grecaptcha,
}: {
address: string
chain: Chain
amts?: { nibi: number; nusd: number; usdt: number }
grecaptcha: string
}): Promise<Response | undefined> {
if (!amts) {
// default values
amts = {
nibi: 11,
nusd: 100,
usdt: 100,
}
}

const coins: string[] = [
`${amts.nibi * 1e6}unibi`,
`${amts.nusd * 1e6}unusd`,
`${amts.usdt * 1e6}uusdt`,
]
const coins: string[] = [`${10e6}unibi`]
const faucetUrl = faucetUrlFromChain(chain)

// Execute faucet request
Expand Down
Loading