@0xobelisk/sui-cli 1.1.4 ā 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/dubhe.js +48 -59
- package/dist/dubhe.js.map +1 -1
- package/package.json +11 -7
- package/src/commands/build.ts +50 -53
- package/src/commands/call.ts +71 -71
- package/src/commands/checkBalance.ts +20 -20
- package/src/commands/configStore.ts +31 -35
- package/src/commands/faucet.ts +63 -71
- package/src/commands/generateKey.ts +25 -25
- package/src/commands/hello.ts +5 -5
- package/src/commands/index.ts +15 -17
- package/src/commands/indexer.ts +41 -46
- package/src/commands/localnode.ts +14 -29
- package/src/commands/publish.ts +35 -39
- package/src/commands/query.ts +70 -70
- package/src/commands/schemagen.ts +26 -26
- package/src/commands/test.ts +37 -37
- package/src/commands/upgrade.ts +29 -29
- package/src/commands/watch.ts +12 -12
- package/src/dubhe.ts +14 -12
- package/src/modules.d.ts +2 -2
- package/src/utils/callHandler.ts +117 -122
- package/src/utils/checkBalance.ts +25 -33
- package/src/utils/errors.ts +28 -28
- package/src/utils/generateAccount.ts +76 -91
- package/src/utils/indexerHandler.ts +183 -151
- package/src/utils/printDubhe.ts +1 -1
- package/src/utils/publishHandler.ts +325 -346
- package/src/utils/queryStorage.ts +126 -126
- package/src/utils/startNode.ts +102 -120
- package/src/utils/storeConfig.ts +33 -45
- package/src/utils/upgradeHandler.ts +208 -234
- package/src/utils/utils.ts +150 -176
- package/src/commands/install.ts +0 -126
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xobelisk/sui-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Tookit for interacting with move eps framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sui",
|
|
@@ -41,16 +41,14 @@
|
|
|
41
41
|
"execa": "^7.0.0",
|
|
42
42
|
"glob": "^8.0.3",
|
|
43
43
|
"path": "^0.12.7",
|
|
44
|
-
"prettier": "^2.8.4",
|
|
45
|
-
"prettier-plugin-rust": "^0.1.9",
|
|
46
44
|
"sqlite": "^5.1.1",
|
|
47
45
|
"sqlite3": "^5.1.7",
|
|
48
46
|
"typescript": "5.1.6",
|
|
49
47
|
"yargs": "^17.7.1",
|
|
50
48
|
"zod": "^3.22.3",
|
|
51
49
|
"zod-validation-error": "^1.3.0",
|
|
52
|
-
"@0xobelisk/sui-client": "1.1.
|
|
53
|
-
"@0xobelisk/sui-common": "1.1.
|
|
50
|
+
"@0xobelisk/sui-client": "1.1.7",
|
|
51
|
+
"@0xobelisk/sui-common": "1.1.7"
|
|
54
52
|
},
|
|
55
53
|
"devDependencies": {
|
|
56
54
|
"@types/ejs": "^3.1.1",
|
|
@@ -60,7 +58,10 @@
|
|
|
60
58
|
"ts-node": "^10.9.1",
|
|
61
59
|
"tsup": "^6.7.0",
|
|
62
60
|
"tsx": "^3.12.6",
|
|
63
|
-
"vitest": "0.31.4"
|
|
61
|
+
"vitest": "0.31.4",
|
|
62
|
+
"eslint": "^8.56.0",
|
|
63
|
+
"eslint-config-prettier": "^9.1.0",
|
|
64
|
+
"prettier": "3.3.3"
|
|
64
65
|
},
|
|
65
66
|
"scripts": {
|
|
66
67
|
"build": "pnpm run type-check && pnpm run build:js",
|
|
@@ -69,6 +70,9 @@
|
|
|
69
70
|
"clean:js": "rimraf dist",
|
|
70
71
|
"dev": "tsup --watch",
|
|
71
72
|
"lint": "eslint . --ext .ts",
|
|
72
|
-
"
|
|
73
|
+
"format": "prettier --write .",
|
|
74
|
+
"format:check": "prettier --check .",
|
|
75
|
+
"type-check": "tsc --noEmit",
|
|
76
|
+
"validate": "pnpm format:check && pnpm type-check"
|
|
73
77
|
}
|
|
74
78
|
}
|
package/src/commands/build.ts
CHANGED
|
@@ -2,65 +2,62 @@ import type { CommandModule } from 'yargs';
|
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { DubheConfig, loadConfig } from '@0xobelisk/sui-common';
|
|
5
|
-
import { switchEnv } from '../utils';
|
|
6
|
-
import {generateCargoToml} from "./install";
|
|
7
|
-
import {writeFileSync} from "fs";
|
|
5
|
+
import { switchEnv, updateDubheDependency } from '../utils';
|
|
8
6
|
|
|
9
7
|
type Options = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
'config-path': string;
|
|
9
|
+
network: any;
|
|
10
|
+
'dump-bytecode-as-base64'?: boolean;
|
|
13
11
|
};
|
|
14
12
|
|
|
15
13
|
const commandModule: CommandModule<Options, Options> = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
14
|
+
command: 'build',
|
|
15
|
+
describe: 'Run tests in Dubhe contracts',
|
|
16
|
+
builder(yargs) {
|
|
17
|
+
return yargs.options({
|
|
18
|
+
'config-path': {
|
|
19
|
+
type: 'string',
|
|
20
|
+
default: 'dubhe.config.ts',
|
|
21
|
+
description: 'Options to pass to forge test'
|
|
22
|
+
},
|
|
23
|
+
network: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
default: 'localnet',
|
|
26
|
+
choices: ['mainnet', 'testnet', 'devnet', 'localnet'],
|
|
27
|
+
desc: 'Node network (mainnet/testnet/devnet/localnet)'
|
|
28
|
+
},
|
|
29
|
+
'dump-bytecode-as-base64': {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
default: false,
|
|
32
|
+
desc: 'Dump bytecode as base64'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
},
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
37
|
+
async handler({
|
|
38
|
+
'config-path': configPath,
|
|
39
|
+
network,
|
|
40
|
+
'dump-bytecode-as-base64': dumpBytecodeAsBase64
|
|
41
|
+
}) {
|
|
42
|
+
// Start an internal anvil process if no world address is provided
|
|
43
|
+
try {
|
|
44
|
+
console.log('š Running move build');
|
|
45
|
+
const dubheConfig = (await loadConfig(configPath)) as DubheConfig;
|
|
46
|
+
const path = process.cwd();
|
|
47
|
+
const projectPath = `${path}/contracts/${dubheConfig.name}`;
|
|
48
|
+
await switchEnv(network);
|
|
49
|
+
await updateDubheDependency(projectPath + '/Move.toml', network);
|
|
50
|
+
const command = `sui move build --path ${projectPath} ${
|
|
51
|
+
dumpBytecodeAsBase64 ? ` --dump-bytecode-as-base64` : ''
|
|
52
|
+
}`;
|
|
53
|
+
const output = execSync(command, { encoding: 'utf-8' });
|
|
54
|
+
console.log(output);
|
|
55
|
+
} catch (error: any) {
|
|
56
|
+
console.error(chalk.red('Error executing sui move build:'));
|
|
57
|
+
console.log(error.stdout);
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
64
61
|
};
|
|
65
62
|
|
|
66
63
|
export default commandModule;
|
package/src/commands/call.ts
CHANGED
|
@@ -4,87 +4,87 @@ import { callHandler } from '../utils';
|
|
|
4
4
|
import { loadConfig, DubheConfig } from '@0xobelisk/sui-common';
|
|
5
5
|
|
|
6
6
|
type Options = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
network: 'mainnet' | 'testnet' | 'devnet' | 'localnet';
|
|
8
|
+
module: string;
|
|
9
|
+
function: string;
|
|
10
|
+
'config-path'?: string;
|
|
11
|
+
'package-id'?: string;
|
|
12
|
+
'metadata-path'?: string;
|
|
13
|
+
params?: any[];
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* CLI command for calling a function in a module
|
|
18
18
|
*/
|
|
19
19
|
const commandModule: CommandModule<Options, Options> = {
|
|
20
|
-
|
|
20
|
+
command: 'call',
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
describe: 'Call a function in a module',
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
24
|
+
builder: {
|
|
25
|
+
network: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
choices: ['mainnet', 'testnet', 'devnet', 'localnet'],
|
|
28
|
+
desc: 'Node network (mainnet/testnet/devnet/localnet)',
|
|
29
|
+
default: 'localnet'
|
|
30
|
+
},
|
|
31
|
+
module: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
desc: 'Module name',
|
|
34
|
+
demandOption: true
|
|
35
|
+
},
|
|
36
|
+
function: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
desc: 'Function name',
|
|
39
|
+
demandOption: true
|
|
40
|
+
},
|
|
41
|
+
'config-path': {
|
|
42
|
+
type: 'string',
|
|
43
|
+
default: 'dubhe.config.ts',
|
|
44
|
+
desc: 'Configuration file path'
|
|
45
|
+
},
|
|
46
|
+
'package-id': {
|
|
47
|
+
type: 'string',
|
|
48
|
+
desc: 'Package ID (optional)'
|
|
49
|
+
},
|
|
50
|
+
'metadata-path': {
|
|
51
|
+
type: 'string',
|
|
52
|
+
desc: 'Path to metadata JSON file (optional)'
|
|
53
|
+
},
|
|
54
|
+
params: {
|
|
55
|
+
type: 'array',
|
|
56
|
+
desc: 'Params for the function',
|
|
57
|
+
string: true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
async handler({
|
|
62
|
+
network,
|
|
63
|
+
'config-path': configPath,
|
|
64
|
+
module: moduleName,
|
|
65
|
+
function: funcName,
|
|
66
|
+
'package-id': packageId,
|
|
67
|
+
'metadata-path': metadataPath,
|
|
68
|
+
params
|
|
69
|
+
}) {
|
|
70
|
+
try {
|
|
71
|
+
const dubheConfig = (await loadConfig(configPath)) as DubheConfig;
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
await callHandler({
|
|
74
|
+
dubheConfig,
|
|
75
|
+
moduleName,
|
|
76
|
+
funcName,
|
|
77
|
+
network,
|
|
78
|
+
packageId,
|
|
79
|
+
metadataFilePath: metadataPath,
|
|
80
|
+
params
|
|
81
|
+
});
|
|
82
|
+
} catch (error: any) {
|
|
83
|
+
logError(error);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
process.exit(0);
|
|
87
|
+
}
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
export default commandModule;
|
|
@@ -2,29 +2,29 @@ import type { CommandModule } from 'yargs';
|
|
|
2
2
|
import { checkBalanceHandler } from '../utils/checkBalance';
|
|
3
3
|
|
|
4
4
|
type Options = {
|
|
5
|
-
|
|
5
|
+
network: 'mainnet' | 'testnet' | 'devnet' | 'localnet';
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
const commandModule: CommandModule<Options, Options> = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
command: 'check-balance',
|
|
10
|
+
describe: 'Check the balance of the account',
|
|
11
|
+
builder: {
|
|
12
|
+
network: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
choices: ['mainnet', 'testnet', 'devnet', 'localnet'],
|
|
15
|
+
desc: 'Network to check balance on',
|
|
16
|
+
default: 'localnet'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
async handler({ network }) {
|
|
20
|
+
try {
|
|
21
|
+
await checkBalanceHandler(network);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('Error checking balance:', error);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export default commandModule;
|
|
@@ -3,46 +3,42 @@ import { storeConfigHandler } from '../utils/storeConfig';
|
|
|
3
3
|
import { loadConfig, DubheConfig } from '@0xobelisk/sui-common';
|
|
4
4
|
|
|
5
5
|
type Options = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
'config-path': string;
|
|
7
|
+
network: 'mainnet' | 'testnet' | 'devnet' | 'localnet';
|
|
8
|
+
'output-ts-path': string;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const commandModule: CommandModule<Options, Options> = {
|
|
12
|
-
|
|
12
|
+
command: 'config-store',
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
describe: 'Store configuration for the Dubhe project',
|
|
15
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
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
process.exit(0);
|
|
45
|
-
},
|
|
16
|
+
builder: {
|
|
17
|
+
'config-path': {
|
|
18
|
+
type: 'string',
|
|
19
|
+
default: 'dubhe.config.ts',
|
|
20
|
+
desc: 'Path to the config file'
|
|
21
|
+
},
|
|
22
|
+
network: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
choices: ['mainnet', 'testnet', 'devnet', 'localnet'],
|
|
25
|
+
desc: 'Network to store config for'
|
|
26
|
+
},
|
|
27
|
+
'output-ts-path': {
|
|
28
|
+
type: 'string',
|
|
29
|
+
desc: 'Specify the output path for the generated TypeScript configuration file (e.g., ./src/config/generated.ts)'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
async handler({ 'config-path': configPath, network, 'output-ts-path': outputTsPath }) {
|
|
33
|
+
try {
|
|
34
|
+
const dubheConfig = (await loadConfig(configPath)) as DubheConfig;
|
|
35
|
+
await storeConfigHandler(dubheConfig, network, outputTsPath);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('Error storing config:', error);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
46
42
|
};
|
|
47
43
|
|
|
48
44
|
export default commandModule;
|
package/src/commands/faucet.ts
CHANGED
|
@@ -1,96 +1,88 @@
|
|
|
1
1
|
import { Dubhe } from '@0xobelisk/sui-client';
|
|
2
2
|
import type { CommandModule } from 'yargs';
|
|
3
3
|
import { requestSuiFromFaucetV0, getFaucetHost } from '@mysten/sui/faucet';
|
|
4
|
-
import {
|
|
5
|
-
SuiClient,
|
|
6
|
-
getFullnodeUrl,
|
|
7
|
-
GetBalanceParams,
|
|
8
|
-
} from '@mysten/sui/client';
|
|
4
|
+
import { SuiClient, getFullnodeUrl, GetBalanceParams } from '@mysten/sui/client';
|
|
9
5
|
import { validatePrivateKey, DubheCliError } from '../utils';
|
|
10
6
|
|
|
11
7
|
type Options = {
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
network: any;
|
|
9
|
+
recipient?: string;
|
|
14
10
|
};
|
|
15
11
|
|
|
16
12
|
const commandModule: CommandModule<Options, Options> = {
|
|
17
|
-
|
|
13
|
+
command: 'faucet',
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
describe: 'Interact with a Dubhe faucet',
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
builder(yargs) {
|
|
18
|
+
return yargs.options({
|
|
19
|
+
network: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
desc: 'URL of the Dubhe faucet',
|
|
22
|
+
choices: ['testnet', 'devnet', 'localnet'],
|
|
23
|
+
default: 'localnet'
|
|
24
|
+
},
|
|
25
|
+
recipient: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
desc: 'Sui address to fund'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
},
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
async handler({ network, recipient }) {
|
|
33
|
+
let faucet_address = '';
|
|
34
|
+
if (recipient === undefined) {
|
|
35
|
+
const privateKey = process.env.PRIVATE_KEY;
|
|
36
|
+
if (!privateKey)
|
|
37
|
+
throw new DubheCliError(
|
|
38
|
+
`Missing PRIVATE_KEY environment variable.
|
|
43
39
|
Run 'echo "PRIVATE_KEY=YOUR_PRIVATE_KEY" > .env'
|
|
44
40
|
in your contracts directory to use the default sui private key.`
|
|
45
|
-
|
|
41
|
+
);
|
|
46
42
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
const privateKeyFormat = validatePrivateKey(privateKey);
|
|
44
|
+
if (privateKeyFormat === false) {
|
|
45
|
+
throw new DubheCliError(`Please check your PRIVATE_KEY.`);
|
|
46
|
+
}
|
|
47
|
+
const dubhe = new Dubhe({
|
|
48
|
+
secretKey: privateKeyFormat
|
|
49
|
+
});
|
|
50
|
+
faucet_address = dubhe.getAddress();
|
|
51
|
+
} else {
|
|
52
|
+
faucet_address = recipient;
|
|
53
|
+
}
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
console.log('\nš Starting Faucet Operation...');
|
|
56
|
+
console.log(` āā Network: ${network}`);
|
|
61
57
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
if (recipient === undefined) {
|
|
59
|
+
console.log(' āā Using Environment PrivateKey');
|
|
60
|
+
console.log(` āā Generated Address: ${faucet_address}`);
|
|
61
|
+
} else {
|
|
62
|
+
console.log(` āā Using Provided Address: ${faucet_address}`);
|
|
63
|
+
}
|
|
68
64
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
console.log(' āā Requesting funds from faucet...');
|
|
66
|
+
await requestSuiFromFaucetV0({
|
|
67
|
+
host: getFaucetHost(network),
|
|
68
|
+
recipient: faucet_address
|
|
69
|
+
});
|
|
74
70
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
console.log(' āā Checking balance...');
|
|
72
|
+
const client = new SuiClient({ url: getFullnodeUrl(network) });
|
|
73
|
+
let params = {
|
|
74
|
+
owner: faucet_address
|
|
75
|
+
} as GetBalanceParams;
|
|
80
76
|
|
|
81
|
-
|
|
77
|
+
const balance = await client.getBalance(params);
|
|
82
78
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
` āā Balance: ${(
|
|
87
|
-
Number(balance.totalBalance) / 1_000_000_000
|
|
88
|
-
).toFixed(4)} SUI`
|
|
89
|
-
);
|
|
79
|
+
console.log('\nš° Account Summary');
|
|
80
|
+
console.log(` āā Address: ${faucet_address}`);
|
|
81
|
+
console.log(` āā Balance: ${(Number(balance.totalBalance) / 1_000_000_000).toFixed(4)} SUI`);
|
|
90
82
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
console.log('\nā
Faucet Operation Complete\n');
|
|
84
|
+
process.exit(0);
|
|
85
|
+
}
|
|
94
86
|
};
|
|
95
87
|
|
|
96
88
|
export default commandModule;
|