Skip to content

Commit 6875c76

Browse files
committed
fix: Fix faucet request
1 parent 78409da commit 6875c76

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/controllers/api/account.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,11 @@ export class AccountController {
356356
const balance = balances[0];
357357
if (!balance || +balance.amount < TESTNET_MINIMUM_BALANCE * Math.pow(10, DEFAULT_DENOM_EXPONENT)) {
358358
// 3.1 If it's less then required for DID creation - assign new portion from testnet-faucet
359-
const resp = await FaucetHelper.delegateTokens(testnetAccount.address);
359+
const resp = await FaucetHelper.delegateTokens(
360+
testnetAccount.address,
361+
customerEntity.name,
362+
customerEntity.email
363+
);
360364
if (resp.status !== StatusCodes.OK) {
361365
return response.status(StatusCodes.BAD_GATEWAY).json({
362366
error: resp.error,
@@ -539,7 +543,11 @@ export class AccountController {
539543
const balance = balances[0];
540544
if (!balance || +balance.amount < TESTNET_MINIMUM_BALANCE * Math.pow(10, DEFAULT_DENOM_EXPONENT)) {
541545
// 3.1 If it's less then required for DID creation - assign new portion from testnet-faucet
542-
const resp = await FaucetHelper.delegateTokens(testnetAccount.address);
546+
const resp = await FaucetHelper.delegateTokens(
547+
testnetAccount.address,
548+
customerEntity.name,
549+
customerEntity.email
550+
);
543551

544552
if (resp.status !== StatusCodes.OK) {
545553
return response.status(StatusCodes.BAD_GATEWAY).json({

src/helpers/faucet.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import { MINIMAL_DENOM, FAUCET_URI } from '../types/constants.js';
33

44
export class FaucetHelper {
55
// ...
6-
static async delegateTokens(address: string): Promise<ICommonErrorResponse> {
6+
static async delegateTokens(address: string, name: string, email: string): Promise<ICommonErrorResponse> {
77
const faucetURI = FAUCET_URI;
88
const faucetBody = {
99
denom: MINIMAL_DENOM,
1010
address: address,
11+
email,
12+
name,
1113
};
1214
const response = await fetch(faucetURI, {
1315
headers: {

0 commit comments

Comments
 (0)