|
@@ -1,3 +1,4 @@
|
|
1
|
+import axios from 'axios';
|
1
|
2
|
import { Wallet } from "../src/util/types";
|
2
|
3
|
import { readFileSync } from 'fs'
|
3
|
4
|
const Path = require('path')
|
|
@@ -7,22 +8,18 @@ export const TEST_CONFIG = {
|
7
|
8
|
}
|
8
|
9
|
export const TEST_DATA = "test123123"
|
9
|
10
|
|
10
|
|
-import fetch from 'node-fetch';
|
11
|
|
-
|
12
|
|
-export const makeTestnetWallet = () : Promise<Wallet> => fetch('https://faucet.altnet.rippletest.net/accounts', {
|
13
|
|
- method: 'POST',
|
14
|
|
- headers: {
|
15
|
|
- 'Accept': 'application/json',
|
16
|
|
- 'Content-Type': 'application/json'
|
17
|
|
- },
|
18
|
|
-}).then((raw:any) => {
|
19
|
|
- return raw.json().then(content => {
|
20
|
|
- return({
|
21
|
|
- secret: content.account.secret,
|
22
|
|
- address: content.account.address
|
23
|
|
- });
|
24
|
|
- })
|
25
|
|
-});
|
|
11
|
+export const makeTestnetWallet = async () : Promise<Wallet> => {
|
|
12
|
+ try{
|
|
13
|
+ const response = await axios.post('https://faucet.altnet.rippletest.net/accounts', {})
|
|
14
|
+ return ({
|
|
15
|
+ secret: response.data.seed,
|
|
16
|
+ address: response.data.account.address
|
|
17
|
+ })
|
|
18
|
+
|
|
19
|
+ }catch(e){
|
|
20
|
+ console.log(e)
|
|
21
|
+ }
|
|
22
|
+}
|
26
|
23
|
|
27
|
24
|
export const htmlTxt = readFileSync(Path.resolve(__dirname, '..', '..', 'test', 'index.html')).toString('ascii')
|
28
|
25
|
|