@midnight-ntwrk/wallet-sdk-prover-client 1.0.0-beta.9 → 1.0.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 +77 -0
- package/dist/effect/HttpProverClient.js +1 -1
- package/dist/effect/ProverClient.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +10 -9
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# @midnight-ntwrk/wallet-sdk-prover-client
|
|
2
|
+
|
|
3
|
+
Client for interacting with the Midnight ZK proof generation service.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @midnight-ntwrk/wallet-sdk-prover-client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
This package provides a client for submitting transactions to a Proof Server that generates zero-knowledge proofs. It is
|
|
14
|
+
used to finalize shielded transactions by converting unproven transactions into proven ones.
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Basic Usage
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { HttpProverClient } from '@midnight-ntwrk/wallet-sdk-prover-client';
|
|
22
|
+
|
|
23
|
+
// Initialize the client with the Proof Server URL
|
|
24
|
+
const proverClient = new HttpProverClient({
|
|
25
|
+
serverUrl: 'http://localhost:6300',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Prove an unproven transaction
|
|
29
|
+
const provenTransaction = await proverClient.proveTransaction(unprovenTransaction);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### With Custom Cost Model
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
const provenTransaction = await proverClient.proveTransaction(unprovenTransaction, customCostModel);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## API
|
|
39
|
+
|
|
40
|
+
### HttpProverClient
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
class HttpProverClient {
|
|
44
|
+
constructor(config: { serverUrl: string });
|
|
45
|
+
|
|
46
|
+
proveTransaction<S extends Signaturish, B extends Bindingish>(
|
|
47
|
+
transaction: Transaction<S, PreProof, B>,
|
|
48
|
+
costModel?: CostModel,
|
|
49
|
+
): Promise<Transaction<S, Proof, B>>;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Exports
|
|
54
|
+
|
|
55
|
+
### Default Export
|
|
56
|
+
|
|
57
|
+
- `HttpProverClient` - HTTP client for the Proof Server
|
|
58
|
+
|
|
59
|
+
### Effect Submodule (`/effect`)
|
|
60
|
+
|
|
61
|
+
Effect.ts-based implementation:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { ProverClient, HttpProverClient } from '@midnight-ntwrk/wallet-sdk-prover-client/effect';
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Error Handling
|
|
68
|
+
|
|
69
|
+
The client may throw the following errors:
|
|
70
|
+
|
|
71
|
+
- `ClientError` - Issues with the provided transaction or connection problems
|
|
72
|
+
- `ServerError` - Internal server errors or connection failures
|
|
73
|
+
- `InvalidProtocolSchemeError` - Invalid URL scheme in configuration
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
Apache-2.0
|
|
@@ -16,7 +16,7 @@ import { SerializedTransaction, SerializedUnprovenTransaction } from '@midnight-
|
|
|
16
16
|
import { ProverClient } from './ProverClient.js';
|
|
17
17
|
import { ClientError, ServerError, HttpURL, } from '@midnight-ntwrk/wallet-sdk-utilities/networking';
|
|
18
18
|
import { BlobOps } from '@midnight-ntwrk/wallet-sdk-utilities';
|
|
19
|
-
import * as ledger from '@midnight-ntwrk/ledger-
|
|
19
|
+
import * as ledger from '@midnight-ntwrk/ledger-v7';
|
|
20
20
|
const PROVE_TX_PATH = '/prove';
|
|
21
21
|
const CHECK_TX_PATH = '/check';
|
|
22
22
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Context } from 'effect';
|
|
2
|
-
import * as ledger from '@midnight-ntwrk/ledger-
|
|
2
|
+
import * as ledger from '@midnight-ntwrk/ledger-v7';
|
|
3
3
|
import { ClientError, ServerError } from '@midnight-ntwrk/wallet-sdk-utilities/networking';
|
|
4
4
|
declare const ProverClient_base: Context.TagClass<ProverClient, "@midnight-ntwrk/prover-client#ProverClient", ProverClient.Service>;
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midnight-ntwrk/wallet-sdk-prover-client",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -29,25 +29,26 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@effect/platform": "^0.90.0",
|
|
32
|
-
"@midnight-ntwrk/ledger-
|
|
33
|
-
"@midnight-ntwrk/wallet-sdk-abstractions": "1.0.0
|
|
34
|
-
"@midnight-ntwrk/wallet-sdk-utilities": "1.0.0
|
|
35
|
-
"effect": "^3.
|
|
32
|
+
"@midnight-ntwrk/ledger-v7": "7.0.0",
|
|
33
|
+
"@midnight-ntwrk/wallet-sdk-abstractions": "1.0.0",
|
|
34
|
+
"@midnight-ntwrk/wallet-sdk-utilities": "1.0.0",
|
|
35
|
+
"effect": "^3.19.14"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"eslint": "^9.37.0",
|
|
39
|
+
"prettier": "^3.7.0",
|
|
39
40
|
"publint": "~0.3.14",
|
|
40
41
|
"rimraf": "^6.0.1",
|
|
41
|
-
"testcontainers": "^11.
|
|
42
|
+
"testcontainers": "^11.10.0",
|
|
42
43
|
"typescript": "^5.9.3",
|
|
43
|
-
"vitest": "^
|
|
44
|
+
"vitest": "^4.0.16"
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
47
|
"typecheck": "tsc -b ./tsconfig.json --noEmit",
|
|
47
48
|
"test": "vitest run",
|
|
48
49
|
"lint": "eslint --max-warnings 0",
|
|
49
|
-
"format": "prettier --write \"**/*.{ts,js,json,yaml,yml}\"",
|
|
50
|
-
"format:check": "prettier --check \"**/*.{ts,js,json,yaml,yml}\"",
|
|
50
|
+
"format": "prettier --write \"**/*.{ts,js,json,yaml,yml,md}\"",
|
|
51
|
+
"format:check": "prettier --check \"**/*.{ts,js,json,yaml,yml,md}\"",
|
|
51
52
|
"dist": "tsc -b ./tsconfig.build.json",
|
|
52
53
|
"dist:publish": "tsc -b ./tsconfig.publish.json",
|
|
53
54
|
"clean": "rimraf --glob dist 'tsconfig.*.tsbuildinfo' && date +%s > .clean-timestamp",
|