midnightwalletsync 0.1.0 → 0.3.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/.env.example +1 -1
- package/README.md +3 -0
- package/bin/midnightsync.js +11 -3
- package/package.json +1 -1
- package/src/config.ts +1 -1
package/.env.example
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
wallet_id_n1=
|
|
1
|
+
wallet_id_n1=replace_me
|
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# MidNight-walletsync
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/midnightwalletsync)
|
|
4
|
+
[View on npm](https://www.npmjs.com/package/midnightwalletsync)
|
|
5
|
+
|
|
3
6
|
A lightweight Midnight wallet synchronization SDK and CLI for keeping one or more wallets synced, saving snapshots locally, and querying balances from a running synced process.
|
|
4
7
|
|
|
5
8
|
This package is designed for a local workspace. It is not a public RPC replacement and it does not hold any secrets by itself; it reads seeds from your `.env` file and uses them to build and start wallet instances.
|
package/bin/midnightsync.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { spawnSync } from 'child_process';
|
|
4
|
+
import { existsSync } from 'fs';
|
|
4
5
|
import { dirname, join } from 'path';
|
|
5
6
|
import { fileURLToPath } from 'url';
|
|
6
7
|
|
|
7
8
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
9
|
const rootDir = join(__dirname, '..');
|
|
9
10
|
|
|
10
|
-
//
|
|
11
|
-
const
|
|
11
|
+
// Resolve tsx from package-local node_modules first, then hoisted node_modules.
|
|
12
|
+
const localTsxPath = join(rootDir, 'node_modules', '.bin', 'tsx');
|
|
13
|
+
const hoistedTsxPath = join(rootDir, '..', '.bin', 'tsx');
|
|
14
|
+
const tsxPath = existsSync(localTsxPath) ? localTsxPath : hoistedTsxPath;
|
|
12
15
|
|
|
13
16
|
const result = spawnSync(tsxPath, [join(rootDir, 'src', 'cli.ts'), ...process.argv.slice(2)], {
|
|
14
|
-
cwd:
|
|
17
|
+
cwd: process.cwd(),
|
|
15
18
|
env: {
|
|
16
19
|
...process.env,
|
|
17
20
|
NODE_OPTIONS: '--no-deprecation',
|
|
@@ -19,4 +22,9 @@ const result = spawnSync(tsxPath, [join(rootDir, 'src', 'cli.ts'), ...process.ar
|
|
|
19
22
|
stdio: 'inherit',
|
|
20
23
|
});
|
|
21
24
|
|
|
25
|
+
if (result.error) {
|
|
26
|
+
console.error('[error] failed to start CLI:', result.error.message);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
process.exit(result.status ?? 0);
|
package/package.json
CHANGED
package/src/config.ts
CHANGED