@sip-protocol/sdk 0.2.2 → 0.2.3
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/dist/browser.js +11 -2
- package/dist/browser.mjs +1 -1
- package/dist/chunk-NDGUWOOZ.mjs +10157 -0
- package/dist/index.d.mts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +11 -2
- package/dist/index.mjs +1 -1
- package/package.json +14 -14
- package/src/proofs/index.ts +1 -0
- package/src/proofs/mock.ts +33 -2
- package/LICENSE +0 -21
package/dist/index.d.mts
CHANGED
|
@@ -301,6 +301,20 @@ declare function getErrorMessage(error: unknown): string;
|
|
|
301
301
|
* The mock proofs are clearly marked and will be rejected by any real verifier.
|
|
302
302
|
*/
|
|
303
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Configuration options for MockProofProvider
|
|
306
|
+
*/
|
|
307
|
+
interface MockProofProviderOptions {
|
|
308
|
+
/**
|
|
309
|
+
* Suppress the console warning about mock usage.
|
|
310
|
+
*
|
|
311
|
+
* Use this ONLY for SSR fallback scenarios where the mock provider
|
|
312
|
+
* is a placeholder and real proofs will be generated client-side.
|
|
313
|
+
*
|
|
314
|
+
* @default false
|
|
315
|
+
*/
|
|
316
|
+
silent?: boolean;
|
|
317
|
+
}
|
|
304
318
|
/**
|
|
305
319
|
* Mock Proof Provider for testing
|
|
306
320
|
*
|
|
@@ -316,16 +330,29 @@ declare function getErrorMessage(error: unknown): string;
|
|
|
316
330
|
* // ... other params
|
|
317
331
|
* })
|
|
318
332
|
* ```
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```typescript
|
|
336
|
+
* // SSR fallback (silent mode)
|
|
337
|
+
* const ssrFallback = new MockProofProvider({ silent: true })
|
|
338
|
+
* ```
|
|
319
339
|
*/
|
|
320
340
|
declare class MockProofProvider implements ProofProvider {
|
|
321
341
|
readonly framework: ProofFramework;
|
|
322
342
|
private _isReady;
|
|
323
343
|
private _warningShown;
|
|
344
|
+
private _silent;
|
|
345
|
+
/**
|
|
346
|
+
* Create a new MockProofProvider
|
|
347
|
+
*
|
|
348
|
+
* @param options - Configuration options
|
|
349
|
+
*/
|
|
350
|
+
constructor(options?: MockProofProviderOptions);
|
|
324
351
|
get isReady(): boolean;
|
|
325
352
|
/**
|
|
326
353
|
* Initialize the mock provider
|
|
327
354
|
*
|
|
328
|
-
* Logs a warning to console about mock usage.
|
|
355
|
+
* Logs a warning to console about mock usage (unless silent mode is enabled).
|
|
329
356
|
*/
|
|
330
357
|
initialize(): Promise<void>;
|
|
331
358
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -301,6 +301,20 @@ declare function getErrorMessage(error: unknown): string;
|
|
|
301
301
|
* The mock proofs are clearly marked and will be rejected by any real verifier.
|
|
302
302
|
*/
|
|
303
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Configuration options for MockProofProvider
|
|
306
|
+
*/
|
|
307
|
+
interface MockProofProviderOptions {
|
|
308
|
+
/**
|
|
309
|
+
* Suppress the console warning about mock usage.
|
|
310
|
+
*
|
|
311
|
+
* Use this ONLY for SSR fallback scenarios where the mock provider
|
|
312
|
+
* is a placeholder and real proofs will be generated client-side.
|
|
313
|
+
*
|
|
314
|
+
* @default false
|
|
315
|
+
*/
|
|
316
|
+
silent?: boolean;
|
|
317
|
+
}
|
|
304
318
|
/**
|
|
305
319
|
* Mock Proof Provider for testing
|
|
306
320
|
*
|
|
@@ -316,16 +330,29 @@ declare function getErrorMessage(error: unknown): string;
|
|
|
316
330
|
* // ... other params
|
|
317
331
|
* })
|
|
318
332
|
* ```
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```typescript
|
|
336
|
+
* // SSR fallback (silent mode)
|
|
337
|
+
* const ssrFallback = new MockProofProvider({ silent: true })
|
|
338
|
+
* ```
|
|
319
339
|
*/
|
|
320
340
|
declare class MockProofProvider implements ProofProvider {
|
|
321
341
|
readonly framework: ProofFramework;
|
|
322
342
|
private _isReady;
|
|
323
343
|
private _warningShown;
|
|
344
|
+
private _silent;
|
|
345
|
+
/**
|
|
346
|
+
* Create a new MockProofProvider
|
|
347
|
+
*
|
|
348
|
+
* @param options - Configuration options
|
|
349
|
+
*/
|
|
350
|
+
constructor(options?: MockProofProviderOptions);
|
|
324
351
|
get isReady(): boolean;
|
|
325
352
|
/**
|
|
326
353
|
* Initialize the mock provider
|
|
327
354
|
*
|
|
328
|
-
* Logs a warning to console about mock usage.
|
|
355
|
+
* Logs a warning to console about mock usage (unless silent mode is enabled).
|
|
329
356
|
*/
|
|
330
357
|
initialize(): Promise<void>;
|
|
331
358
|
/**
|
package/dist/index.js
CHANGED
|
@@ -3144,16 +3144,25 @@ var MockProofProvider = class {
|
|
|
3144
3144
|
framework = "mock";
|
|
3145
3145
|
_isReady = false;
|
|
3146
3146
|
_warningShown = false;
|
|
3147
|
+
_silent;
|
|
3148
|
+
/**
|
|
3149
|
+
* Create a new MockProofProvider
|
|
3150
|
+
*
|
|
3151
|
+
* @param options - Configuration options
|
|
3152
|
+
*/
|
|
3153
|
+
constructor(options) {
|
|
3154
|
+
this._silent = options?.silent ?? false;
|
|
3155
|
+
}
|
|
3147
3156
|
get isReady() {
|
|
3148
3157
|
return this._isReady;
|
|
3149
3158
|
}
|
|
3150
3159
|
/**
|
|
3151
3160
|
* Initialize the mock provider
|
|
3152
3161
|
*
|
|
3153
|
-
* Logs a warning to console about mock usage.
|
|
3162
|
+
* Logs a warning to console about mock usage (unless silent mode is enabled).
|
|
3154
3163
|
*/
|
|
3155
3164
|
async initialize() {
|
|
3156
|
-
if (!this._warningShown) {
|
|
3165
|
+
if (!this._warningShown && !this._silent) {
|
|
3157
3166
|
console.warn(WARNING_MESSAGE);
|
|
3158
3167
|
this._warningShown = true;
|
|
3159
3168
|
}
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sip-protocol/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Core SDK for Shielded Intents Protocol - Privacy layer for cross-chain transactions",
|
|
5
5
|
"author": "SIP Protocol <hello@sip-protocol.org>",
|
|
6
6
|
"homepage": "https://sip-protocol.org",
|
|
@@ -36,6 +36,17 @@
|
|
|
36
36
|
"dist",
|
|
37
37
|
"src"
|
|
38
38
|
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsup src/index.ts src/browser.ts src/proofs/noir.ts --format cjs,esm --dts",
|
|
41
|
+
"dev": "tsup src/index.ts src/browser.ts src/proofs/noir.ts --format cjs,esm --dts --watch",
|
|
42
|
+
"lint": "eslint --ext .ts src/",
|
|
43
|
+
"typecheck": "tsc --noEmit",
|
|
44
|
+
"clean": "rm -rf dist",
|
|
45
|
+
"test": "vitest",
|
|
46
|
+
"test:coverage": "vitest run --coverage",
|
|
47
|
+
"bench": "vitest bench --config vitest.bench.config.ts",
|
|
48
|
+
"bench:json": "vitest bench --config vitest.bench.config.ts --outputJson benchmarks/results.json"
|
|
49
|
+
},
|
|
39
50
|
"dependencies": {
|
|
40
51
|
"@aztec/bb.js": "^0.63.1",
|
|
41
52
|
"@noble/ciphers": "^2.0.1",
|
|
@@ -60,16 +71,5 @@
|
|
|
60
71
|
"stealth-addresses",
|
|
61
72
|
"zcash"
|
|
62
73
|
],
|
|
63
|
-
"license": "MIT"
|
|
64
|
-
|
|
65
|
-
"build": "tsup src/index.ts src/browser.ts src/proofs/noir.ts --format cjs,esm --dts",
|
|
66
|
-
"dev": "tsup src/index.ts src/browser.ts src/proofs/noir.ts --format cjs,esm --dts --watch",
|
|
67
|
-
"lint": "eslint --ext .ts src/",
|
|
68
|
-
"typecheck": "tsc --noEmit",
|
|
69
|
-
"clean": "rm -rf dist",
|
|
70
|
-
"test": "vitest",
|
|
71
|
-
"test:coverage": "vitest run --coverage",
|
|
72
|
-
"bench": "vitest bench --config vitest.bench.config.ts",
|
|
73
|
-
"bench:json": "vitest bench --config vitest.bench.config.ts --outputJson benchmarks/results.json"
|
|
74
|
-
}
|
|
75
|
-
}
|
|
74
|
+
"license": "MIT"
|
|
75
|
+
}
|
package/src/proofs/index.ts
CHANGED
|
@@ -46,6 +46,7 @@ export { ProofGenerationError } from './interface'
|
|
|
46
46
|
|
|
47
47
|
// Mock provider (testing only)
|
|
48
48
|
export { MockProofProvider } from './mock'
|
|
49
|
+
export type { MockProofProviderOptions } from './mock'
|
|
49
50
|
|
|
50
51
|
// NOTE: NoirProofProvider is NOT exported from main entry to avoid bundling WASM
|
|
51
52
|
// in server-side builds (e.g., Next.js SSR). Import directly if needed:
|
package/src/proofs/mock.ts
CHANGED
|
@@ -44,6 +44,21 @@ const WARNING_MESSAGE = `
|
|
|
44
44
|
╚══════════════════════════════════════════════════════════════╝
|
|
45
45
|
`
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Configuration options for MockProofProvider
|
|
49
|
+
*/
|
|
50
|
+
export interface MockProofProviderOptions {
|
|
51
|
+
/**
|
|
52
|
+
* Suppress the console warning about mock usage.
|
|
53
|
+
*
|
|
54
|
+
* Use this ONLY for SSR fallback scenarios where the mock provider
|
|
55
|
+
* is a placeholder and real proofs will be generated client-side.
|
|
56
|
+
*
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
silent?: boolean
|
|
60
|
+
}
|
|
61
|
+
|
|
47
62
|
/**
|
|
48
63
|
* Mock Proof Provider for testing
|
|
49
64
|
*
|
|
@@ -59,11 +74,27 @@ const WARNING_MESSAGE = `
|
|
|
59
74
|
* // ... other params
|
|
60
75
|
* })
|
|
61
76
|
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* // SSR fallback (silent mode)
|
|
81
|
+
* const ssrFallback = new MockProofProvider({ silent: true })
|
|
82
|
+
* ```
|
|
62
83
|
*/
|
|
63
84
|
export class MockProofProvider implements ProofProvider {
|
|
64
85
|
readonly framework: ProofFramework = 'mock'
|
|
65
86
|
private _isReady = false
|
|
66
87
|
private _warningShown = false
|
|
88
|
+
private _silent: boolean
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Create a new MockProofProvider
|
|
92
|
+
*
|
|
93
|
+
* @param options - Configuration options
|
|
94
|
+
*/
|
|
95
|
+
constructor(options?: MockProofProviderOptions) {
|
|
96
|
+
this._silent = options?.silent ?? false
|
|
97
|
+
}
|
|
67
98
|
|
|
68
99
|
get isReady(): boolean {
|
|
69
100
|
return this._isReady
|
|
@@ -72,10 +103,10 @@ export class MockProofProvider implements ProofProvider {
|
|
|
72
103
|
/**
|
|
73
104
|
* Initialize the mock provider
|
|
74
105
|
*
|
|
75
|
-
* Logs a warning to console about mock usage.
|
|
106
|
+
* Logs a warning to console about mock usage (unless silent mode is enabled).
|
|
76
107
|
*/
|
|
77
108
|
async initialize(): Promise<void> {
|
|
78
|
-
if (!this._warningShown) {
|
|
109
|
+
if (!this._warningShown && !this._silent) {
|
|
79
110
|
console.warn(WARNING_MESSAGE)
|
|
80
111
|
this._warningShown = true
|
|
81
112
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 RECTOR Labs
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|