@unlink-xyz/cli 0.1.0
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 +9 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +46 -0
- package/dist/commands/account.d.ts +2 -0
- package/dist/commands/account.js +83 -0
- package/dist/commands/balance.d.ts +2 -0
- package/dist/commands/balance.js +75 -0
- package/dist/commands/burner.d.ts +2 -0
- package/dist/commands/burner.js +114 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +140 -0
- package/dist/commands/deposit.d.ts +2 -0
- package/dist/commands/deposit.js +58 -0
- package/dist/commands/history.d.ts +2 -0
- package/dist/commands/history.js +30 -0
- package/dist/commands/multisig.d.ts +2 -0
- package/dist/commands/multisig.js +343 -0
- package/dist/commands/notes.d.ts +2 -0
- package/dist/commands/notes.js +28 -0
- package/dist/commands/sync.d.ts +2 -0
- package/dist/commands/sync.js +51 -0
- package/dist/commands/transfer.d.ts +2 -0
- package/dist/commands/transfer.js +47 -0
- package/dist/commands/tx-status.d.ts +2 -0
- package/dist/commands/tx-status.js +31 -0
- package/dist/commands/wallet.d.ts +2 -0
- package/dist/commands/wallet.js +98 -0
- package/dist/commands/withdraw.d.ts +2 -0
- package/dist/commands/withdraw.js +47 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -0
- package/dist/lib/context.d.ts +14 -0
- package/dist/lib/context.js +42 -0
- package/dist/lib/errors.d.ts +1 -0
- package/dist/lib/errors.js +24 -0
- package/dist/lib/multisig-store.d.ts +8 -0
- package/dist/lib/multisig-store.js +121 -0
- package/dist/lib/options.d.ts +40 -0
- package/dist/lib/options.js +109 -0
- package/dist/lib/output.d.ts +6 -0
- package/dist/lib/output.js +34 -0
- package/dist/lib/relay.d.ts +18 -0
- package/dist/lib/relay.js +35 -0
- package/dist/lib/tokens.d.ts +14 -0
- package/dist/lib/tokens.js +142 -0
- package/dist/storage/sqlite.d.ts +1 -0
- package/dist/storage/sqlite.js +1 -0
- package/dist/test-utils.d.ts +56 -0
- package/dist/test-utils.js +73 -0
- package/package.json +45 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSqliteStorage, type SqliteStorageOptions, } from "@unlink-xyz/node";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSqliteStorage, } from "@unlink-xyz/node";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { CLIContext } from "./lib/context.js";
|
|
2
|
+
import type { ResolvedOptions } from "./lib/options.js";
|
|
3
|
+
export declare function createMockWallet(): {
|
|
4
|
+
chainId: number;
|
|
5
|
+
poolAddress: string;
|
|
6
|
+
seed: {
|
|
7
|
+
exists: import("vitest").Mock<(...args: any[]) => any>;
|
|
8
|
+
create: import("vitest").Mock<(...args: any[]) => any>;
|
|
9
|
+
importMnemonic: import("vitest").Mock<(...args: any[]) => any>;
|
|
10
|
+
exportMnemonic: import("vitest").Mock<(...args: any[]) => any>;
|
|
11
|
+
delete: import("vitest").Mock<(...args: any[]) => any>;
|
|
12
|
+
};
|
|
13
|
+
accounts: {
|
|
14
|
+
list: import("vitest").Mock<(...args: any[]) => any>;
|
|
15
|
+
get: import("vitest").Mock<(...args: any[]) => any>;
|
|
16
|
+
create: import("vitest").Mock<(...args: any[]) => any>;
|
|
17
|
+
getActive: import("vitest").Mock<(...args: any[]) => any>;
|
|
18
|
+
getActiveIndex: import("vitest").Mock<(...args: any[]) => any>;
|
|
19
|
+
setActive: import("vitest").Mock<(...args: any[]) => any>;
|
|
20
|
+
};
|
|
21
|
+
deposit: import("vitest").Mock<(...args: any[]) => any>;
|
|
22
|
+
confirmDeposit: import("vitest").Mock<(...args: any[]) => any>;
|
|
23
|
+
transfer: import("vitest").Mock<(...args: any[]) => any>;
|
|
24
|
+
planTransfer: import("vitest").Mock<(...args: any[]) => any>;
|
|
25
|
+
executeTransfer: import("vitest").Mock<(...args: any[]) => any>;
|
|
26
|
+
withdraw: import("vitest").Mock<(...args: any[]) => any>;
|
|
27
|
+
planWithdraw: import("vitest").Mock<(...args: any[]) => any>;
|
|
28
|
+
executeWithdraw: import("vitest").Mock<(...args: any[]) => any>;
|
|
29
|
+
confirmTransaction: import("vitest").Mock<(...args: any[]) => any>;
|
|
30
|
+
getBalance: import("vitest").Mock<(...args: any[]) => any>;
|
|
31
|
+
getBalances: import("vitest").Mock<(...args: any[]) => any>;
|
|
32
|
+
getHistory: import("vitest").Mock<(...args: any[]) => any>;
|
|
33
|
+
getNotes: import("vitest").Mock<(...args: any[]) => any>;
|
|
34
|
+
sync: import("vitest").Mock<(...args: any[]) => any>;
|
|
35
|
+
startAutoSync: import("vitest").Mock<(...args: any[]) => any>;
|
|
36
|
+
stopAutoSync: import("vitest").Mock<(...args: any[]) => any>;
|
|
37
|
+
getTxStatus: import("vitest").Mock<(...args: any[]) => any>;
|
|
38
|
+
trackTx: import("vitest").Mock<(...args: any[]) => any>;
|
|
39
|
+
untrackTx: import("vitest").Mock<(...args: any[]) => any>;
|
|
40
|
+
on: import("vitest").Mock<(...args: any[]) => any>;
|
|
41
|
+
burner: {
|
|
42
|
+
addressOf: import("vitest").Mock<(...args: any[]) => any>;
|
|
43
|
+
fund: import("vitest").Mock<(...args: any[]) => any>;
|
|
44
|
+
send: import("vitest").Mock<(...args: any[]) => any>;
|
|
45
|
+
sweepToPool: import("vitest").Mock<(...args: any[]) => any>;
|
|
46
|
+
exportKey: import("vitest").Mock<(...args: any[]) => any>;
|
|
47
|
+
getBalance: import("vitest").Mock<(...args: any[]) => any>;
|
|
48
|
+
getTokenBalance: import("vitest").Mock<(...args: any[]) => any>;
|
|
49
|
+
};
|
|
50
|
+
advanced: {
|
|
51
|
+
transact: import("vitest").Mock<(...args: any[]) => any>;
|
|
52
|
+
reconcile: import("vitest").Mock<(...args: any[]) => any>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type MockWallet = ReturnType<typeof createMockWallet>;
|
|
56
|
+
export declare function mockContext(wallet: MockWallet, overrides?: Partial<ResolvedOptions>): CLIContext;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { vi } from "vitest";
|
|
2
|
+
export function createMockWallet() {
|
|
3
|
+
return {
|
|
4
|
+
chainId: 31337,
|
|
5
|
+
poolAddress: "0x1111111111111111111111111111111111111111",
|
|
6
|
+
seed: {
|
|
7
|
+
exists: vi.fn(),
|
|
8
|
+
create: vi.fn(),
|
|
9
|
+
importMnemonic: vi.fn(),
|
|
10
|
+
exportMnemonic: vi.fn(),
|
|
11
|
+
delete: vi.fn(),
|
|
12
|
+
},
|
|
13
|
+
accounts: {
|
|
14
|
+
list: vi.fn(),
|
|
15
|
+
get: vi.fn(),
|
|
16
|
+
create: vi.fn(),
|
|
17
|
+
getActive: vi.fn(),
|
|
18
|
+
getActiveIndex: vi.fn(),
|
|
19
|
+
setActive: vi.fn(),
|
|
20
|
+
},
|
|
21
|
+
deposit: vi.fn(),
|
|
22
|
+
confirmDeposit: vi.fn(),
|
|
23
|
+
transfer: vi.fn(),
|
|
24
|
+
planTransfer: vi.fn(),
|
|
25
|
+
executeTransfer: vi.fn(),
|
|
26
|
+
withdraw: vi.fn(),
|
|
27
|
+
planWithdraw: vi.fn(),
|
|
28
|
+
executeWithdraw: vi.fn(),
|
|
29
|
+
confirmTransaction: vi.fn(),
|
|
30
|
+
getBalance: vi.fn(),
|
|
31
|
+
getBalances: vi.fn(),
|
|
32
|
+
getHistory: vi.fn(),
|
|
33
|
+
getNotes: vi.fn(),
|
|
34
|
+
sync: vi.fn(),
|
|
35
|
+
startAutoSync: vi.fn(),
|
|
36
|
+
stopAutoSync: vi.fn(),
|
|
37
|
+
getTxStatus: vi.fn(),
|
|
38
|
+
trackTx: vi.fn(),
|
|
39
|
+
untrackTx: vi.fn(),
|
|
40
|
+
on: vi.fn(),
|
|
41
|
+
burner: {
|
|
42
|
+
addressOf: vi.fn(),
|
|
43
|
+
fund: vi.fn(),
|
|
44
|
+
send: vi.fn(),
|
|
45
|
+
sweepToPool: vi.fn(),
|
|
46
|
+
exportKey: vi.fn(),
|
|
47
|
+
getBalance: vi.fn(),
|
|
48
|
+
getTokenBalance: vi.fn(),
|
|
49
|
+
},
|
|
50
|
+
advanced: {
|
|
51
|
+
transact: vi.fn(),
|
|
52
|
+
reconcile: vi.fn(),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const defaultOptions = {
|
|
57
|
+
json: false,
|
|
58
|
+
dataDir: "/tmp/test",
|
|
59
|
+
gatewayUrl: "http://localhost:3000",
|
|
60
|
+
nodeUrl: undefined,
|
|
61
|
+
chainId: 31337,
|
|
62
|
+
poolAddress: undefined,
|
|
63
|
+
privateKey: undefined,
|
|
64
|
+
artifactVersion: undefined,
|
|
65
|
+
};
|
|
66
|
+
export function mockContext(wallet, overrides) {
|
|
67
|
+
const options = { ...defaultOptions, ...overrides };
|
|
68
|
+
return {
|
|
69
|
+
wallet: wallet,
|
|
70
|
+
options,
|
|
71
|
+
gatewayUrl: options.gatewayUrl ?? "http://localhost:0",
|
|
72
|
+
};
|
|
73
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unlink-xyz/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"unlink-cli": "./dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"main": "dist/cli.js",
|
|
9
|
+
"types": "dist/cli.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"cli": "node dist/index.js",
|
|
18
|
+
"build:deps": "pnpm --filter \"@unlink-xyz/cli^...\" build",
|
|
19
|
+
"prebuild": "pnpm run build:deps",
|
|
20
|
+
"build": "tsc -p tsconfig.json",
|
|
21
|
+
"pretest": "pnpm run build:deps",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"lint": "eslint .",
|
|
24
|
+
"lint:fix": "eslint . --fix",
|
|
25
|
+
"format": "prettier . --write",
|
|
26
|
+
"format:check": "prettier . --check"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@unlink-xyz/core": "0.1.3",
|
|
30
|
+
"@unlink-xyz/multisig": "0.1.0",
|
|
31
|
+
"@unlink-xyz/node": "0.1.0",
|
|
32
|
+
"commander": "^13.0.0",
|
|
33
|
+
"dotenv": "^16.0.0",
|
|
34
|
+
"ethers": "6.15.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/better-sqlite3": "^7.6.0",
|
|
38
|
+
"@types/node": "^22.0.0",
|
|
39
|
+
"eslint": "^9.19.0",
|
|
40
|
+
"globals": "^15.14.0",
|
|
41
|
+
"prettier": "^3.5.3",
|
|
42
|
+
"typescript": "^5.9.2",
|
|
43
|
+
"vitest": "4.0.1"
|
|
44
|
+
}
|
|
45
|
+
}
|