Skip to content

Commit d1038da

Browse files
author
Segfault
committed
Faucet test implementation
1 parent 20504dd commit d1038da

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export const MsgMintAndSendUrl = '/lum.network.faucet.MsgMintAndSend';
2+
3+
/**
4+
* MsgMintAndSend defines a SDK message asking the faucet module to send you
5+
* a set of coins, for testing purposes only.
6+
* This module is ONLY enabled in testnet
7+
*/
8+
export interface MsgMintAndSend {
9+
minter: string;
10+
mintTime: Date;
11+
}
12+
13+
export const BuildMsgMintAndSend = (minter: string, mintTime: Date) => {
14+
return {
15+
typeUrl: MsgMintAndSendUrl,
16+
value: {
17+
minter,
18+
mintTime,
19+
} as MsgMintAndSend,
20+
};
21+
};

src/messages/faucet/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './MsgMintAndSend';

src/messages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './Message';
22
export * from './bank';
33
export * from './distribution';
44
export * from './staking';
5+
export * from './faucet';

tests/faucet.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { LumClient, LumConstants, LumMessages, LumWallet } from '../src';
2+
3+
describe('LumClient', () => {
4+
let clt: LumClient;
5+
let w1: LumWallet;
6+
7+
beforeAll(async () => {
8+
clt = await LumClient.connect('http://node0.testnet.lum.network/rpc');
9+
w1 = await LumWallet.fromMnemonic('noodle hope lounge dismiss erase elephant seek crawl check equal city chest');
10+
console.log(w1.address);
11+
});
12+
13+
afterAll(async () => {
14+
await expect(clt.disconnect()).resolves.toBeTruthy();
15+
});
16+
17+
it('should build and dispatch a mint message', async () => {
18+
const mintMsg = LumMessages.BuildMsgMintAndSend(w1.address, new Date());
19+
20+
const fee = {
21+
amount: [{ denom: LumConstants.LumDenom, amount: '0' }],
22+
gas: '100000',
23+
};
24+
25+
const broadcastResult = await clt.signAndBroadcastTx(w1, [mintMsg], fee, 'You mad bro? You aint got money bro?');
26+
console.log(broadcastResult);
27+
});
28+
});

0 commit comments

Comments
 (0)