Skip to content

Commit

Permalink
refactor(faucet)!: set default tokens (#369)
Browse files Browse the repository at this point in the history
* chore: develop -> main (#368)

* revert: cosmos submodule only (#362)

* revert: cosmos submodule only

* fix: rem

* fix: rem

* fix: update

* feat: add msg client

* fix: paths

* fix: try chaosnet ibc

* fix: path again

* fix: try hm

* fix: fixes to pass

* feat: eth protos (#366)

* fix: eth protos

* fix: client

* fix: fixes

* fix: try older nibiru

* fix: index

* fix: mainnet

* fix: import

* revert: build change

* chore: tests (#367)

* fix: all query tests

* chore: final tests

* fix: buf

* fix: fix

* fix: pull latest

* fix: build

* fix: build

* chore(release): 4.5.1

### [4.5.1](v4.5.0...v4.5.1) (2024-08-09)

### Miscellaneous Chores

* develop -> main ([#368](#368)) ([c6d6570](c6d6570)), closes [#362](#362) [#366](#366) [#367](#367)

 [skip ci]

* fix(faucet): remove unused tokens from default faucet request

* fix: bump test

---------

Co-authored-by: Cameron Gilbert <[email protected]>
Co-authored-by: semantic-release-bot <[email protected]>
  • Loading branch information
3 people authored Aug 15, 2024
1 parent b9b3d74 commit 859882a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### [4.5.1](https://github.com/NibiruChain/ts-sdk/compare/v4.5.0...v4.5.1) (2024-08-09)

### Miscellaneous Chores

- develop -> main ([#368](https://github.com/NibiruChain/ts-sdk/issues/368)) ([c6d6570](https://github.com/NibiruChain/ts-sdk/commit/c6d657009eed49442243c4b0e9021afd34392a98)), closes [#362](https://github.com/NibiruChain/ts-sdk/issues/362) [#366](https://github.com/NibiruChain/ts-sdk/issues/366) [#367](https://github.com/NibiruChain/ts-sdk/issues/367)

## [4.5.0](https://github.com/NibiruChain/ts-sdk/compare/v4.4.0...v4.5.0) (2024-06-28)

### Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nibiruchain/nibijs",
"description": "The TypeScript SDK for the Nibiru blockchain.",
"version": "4.5.0",
"version": "4.5.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
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

0 comments on commit 859882a

Please sign in to comment.