-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathtenderly.js
More file actions
26 lines (23 loc) · 631 Bytes
/
tenderly.js
File metadata and controls
26 lines (23 loc) · 631 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import axios from 'axios';
export default class Tenderly {
static async addFunds(rpcURL, account, amount = '0xDE0B6B3A764000000') {
const data = {
jsonrpc: '2.0',
method: 'tenderly_setBalance',
params: [[account], amount],
id: '1234',
};
const response = await axios.post(rpcURL, data, {
headers: {
'Content-Type': 'application/json',
},
});
if (response.data.error) {
// eslint-disable-next-line no-console
console.log(
`ERROR: Failed to add funds to Tenderly VirtualTestNet\n${response.data.error}`,
);
return null;
}
}
}