Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/faucet/faucet.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
} from './exceptions'
import { AuthGuard } from '../auth/auth.guard'

const KILT_FEMTO_COIN = '1000000000000000'
const DEFAULT_TOKEN_AMOUNT = 500

@Controller('faucet')
Expand Down Expand Up @@ -73,7 +72,8 @@ export class FaucetController {
const status: SubmittableResult = await Balance.makeTransfer(
faucetAccount,
address,
new BN(KILT_FEMTO_COIN).muln(DEFAULT_TOKEN_AMOUNT)
new BN(DEFAULT_TOKEN_AMOUNT),
0
)
return Promise.resolve(status.isFinalized)
} catch (e) {
Expand Down
15 changes: 10 additions & 5 deletions src/faucet/faucet.module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ describe('Faucet Module', () => {
expect(mockedMakeTransfer).toHaveBeenCalledWith(
faucetIdentity,
claimerAddress,
new BN(KILT_FEMTO_COIN).muln(DEFAULT_TOKEN_AMOUNT)
new BN(DEFAULT_TOKEN_AMOUNT),
0
)
})
it('updates the database on unsuccessful transfer and throws exception', async () => {
Expand All @@ -136,7 +137,8 @@ describe('Faucet Module', () => {
expect(mockedMakeTransfer).toHaveBeenCalledWith(
faucetIdentity,
claimerAddress,
new BN(KILT_FEMTO_COIN).muln(DEFAULT_TOKEN_AMOUNT)
new BN(DEFAULT_TOKEN_AMOUNT),
0
)
expect(updateSpy).toHaveBeenCalledWith(testFaucetDrop)
})
Expand Down Expand Up @@ -196,7 +198,8 @@ describe('Faucet Module', () => {
expect(mockedMakeTransfer).toHaveBeenCalledWith(
faucetIdentity,
claimerAddress,
new BN(KILT_FEMTO_COIN).muln(DEFAULT_TOKEN_AMOUNT)
new BN(DEFAULT_TOKEN_AMOUNT),
0
)
})
it(`returns false on thrown error or if the transfer failed`, async () => {
Expand Down Expand Up @@ -226,7 +229,8 @@ describe('Faucet Module', () => {
expect(mockedMakeTransfer).toHaveBeenCalledWith(
faucetIdentity,
claimerAddress,
new BN(KILT_FEMTO_COIN).muln(DEFAULT_TOKEN_AMOUNT)
new BN(DEFAULT_TOKEN_AMOUNT),
0
)
mockedMakeTransfer.mockImplementation(async () => {
return {
Expand All @@ -242,7 +246,8 @@ describe('Faucet Module', () => {
expect(mockedMakeTransfer).toHaveBeenCalledWith(
faucetIdentity,
claimerAddress,
new BN(KILT_FEMTO_COIN).muln(DEFAULT_TOKEN_AMOUNT)
new BN(DEFAULT_TOKEN_AMOUNT),
0
)
})
})
Expand Down
3 changes: 2 additions & 1 deletion test/faucet.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ describe('faucet endpoint (e2e)', () => {
expect(spy).toHaveBeenCalledWith(
expect.objectContaining({ seedAsHex: FAUCET_SEED }),
idAlice.address,
expect.any(BN)
expect.any(BN),
0
)
})

Expand Down