-
Notifications
You must be signed in to change notification settings - Fork 2
/
v060-get-logger-info.js
44 lines (36 loc) · 1.01 KB
/
v060-get-logger-info.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
37
38
39
40
41
42
43
44
require('dotenv').config()
const { inspect } = require('util')
const { getLogger } = require('@phala/sdk')
const R = require('ramda');
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
async function main() {
const argv = require('arg')({
'--pruntime': String,
'--loggerContractId': String,
'--systemContractId': String,
})
if (!argv['--pruntime']) {
console.log('You neeed specific the target pruntime with --pruntime')
return process.exit(1)
}
if (!argv['--loggerContractId']) {
console.log('You neeed specific the logger contract id with --loggerContractId')
return process.exit(1)
}
//
// END: parse arguments
//
const pinkLogger = await getLogger({
pruntimeURL: argv['--pruntime'],
contractId: argv['--loggerContractId'],
systemContract: argv['--systemContractId'],
})
const info = await pinkLogger.getInfo()
console.log(info)
}
main().then(() => process.exit(0)).catch(err => {
console.error(err)
process.exit(1)
})