@effectstream/midnight-contracts 0.103.2 → 0.104.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/package.json +2 -2
- package/src/dust-state.ts +8 -1
- package/src/midnight-env.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effectstream/midnight-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.104.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"homepage": "https://effectstream.github.io/docs/",
|
|
6
6
|
"repository": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"./types": "./src/types.ts"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@effectstream/utils": "0.
|
|
24
|
+
"@effectstream/utils": "0.104.0",
|
|
25
25
|
"@scure/bip39": "^2.0.1",
|
|
26
26
|
"dotenv": "^16.4.7",
|
|
27
27
|
"rxjs": "^7.8.2",
|
package/src/dust-state.ts
CHANGED
|
@@ -19,10 +19,17 @@ const log = console;
|
|
|
19
19
|
* Uses first 16 hex chars of the seed as a stable identifier — the seed
|
|
20
20
|
* deterministically maps to a dust address, so this is a unique key per wallet
|
|
21
21
|
* that is available before building the facade.
|
|
22
|
+
*
|
|
23
|
+
* `networkId` is stripped to a safe character set before it reaches
|
|
24
|
+
* `path.join`. No caller currently passes untrusted input here (`networkId`
|
|
25
|
+
* comes from the wallet SDK's own enum or a local CLI env var), but nothing
|
|
26
|
+
* upstream enforces that, and a `networkId` containing `../` would otherwise
|
|
27
|
+
* let the resulting path escape `baseDir`.
|
|
22
28
|
*/
|
|
23
29
|
export function getDustStatePath(baseDir: string, networkId: string, seed: string): string {
|
|
24
30
|
const seedKey = seed.slice(0, 16);
|
|
25
|
-
|
|
31
|
+
const safeNetworkId = networkId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
32
|
+
return path.join(baseDir, `${safeNetworkId}-${seedKey}.json`);
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
function isUndeployedNetwork(networkId: string): boolean {
|
package/src/midnight-env.ts
CHANGED
|
@@ -39,8 +39,8 @@ const undeployedNetworkConfig: NetworkConfig = {
|
|
|
39
39
|
} as const;
|
|
40
40
|
|
|
41
41
|
const deployedNetworkConfig = (networkId: NetworkId.NetworkId): NetworkConfig => ({
|
|
42
|
-
indexer: `https://indexer.${networkId}.midnight.network/api/
|
|
43
|
-
indexerWS: `wss://indexer.${networkId}.midnight.network/api/
|
|
42
|
+
indexer: `https://indexer.${networkId}.midnight.network/api/v4/graphql`,
|
|
43
|
+
indexerWS: `wss://indexer.${networkId}.midnight.network/api/v4/graphql/ws`,
|
|
44
44
|
node: `https://rpc.${networkId}.midnight.network`,
|
|
45
45
|
proofServer: "http://127.0.0.1:6300",
|
|
46
46
|
networkId,
|