-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
36 lines (31 loc) · 1.12 KB
/
config.js
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
27
28
29
30
31
32
33
34
35
36
var os = require('os');
Array.prototype.forEachAsync = async function (fn) {
for (let t of this) { await fn(t) }
}
Array.prototype.forEachAsyncParallel = async function (fn) {
await Promise.all(this.map(fn));
}
Array.prototype.forEachAsyncParallel10 = async function (fn) {
const promises = this.map(async (item, index) => {
await fn(item, index);
await new Promise(resolve => setTimeout(resolve, 100)); // Wait for 100 milliseconds (10 promises per second)
});
await Promise.all(promises);
}
global.filterArray = (array, fields, value) => {
fields = Array.isArray(fields) ? fields : [fields];
return array.filter((item) => fields.some((field) => item[field] === value))
};
global.waitforme=(ms)=> {
return new Promise( resolve => { setTimeout(resolve, ms); });
}
global.UniversalProject=`ui0`
global.jitotx=0
let settings={
Host:os.hostname(),
Port:3002,
localhost:os.networkInterfaces()["lo0"][0].address=="127.0.0.1"?true:false,
mainnet:"https://api.mainnet-beta.solana.com",
devnet:"https://api.devnet.solana.com",
}
module.exports=settings;