@sip-protocol/sdk 0.2.1 → 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.d.mts +2 -1
- package/dist/browser.d.ts +2 -1
- package/dist/browser.js +6673 -7444
- package/dist/browser.mjs +22 -20
- package/dist/chunk-DU7LQDD2.mjs +10148 -0
- package/dist/chunk-NDGUWOOZ.mjs +10157 -0
- package/dist/chunk-UHZKNGIT.mjs +223 -0
- package/dist/chunk-VITVG25F.mjs +982 -0
- package/dist/index.d.mts +32 -467
- package/dist/index.d.ts +32 -467
- package/dist/index.js +14 -1764
- package/dist/index.mjs +17 -17
- package/dist/noir-BHQtFvRk.d.mts +467 -0
- package/dist/noir-BHQtFvRk.d.ts +467 -0
- package/dist/proofs/noir.d.mts +2 -0
- package/dist/proofs/noir.d.ts +2 -0
- package/dist/proofs/noir.js +1862 -0
- package/dist/proofs/noir.mjs +790 -0
- package/package.json +19 -14
- package/src/index.ts +5 -3
- package/src/proofs/index.ts +7 -2
- package/src/proofs/mock.ts +33 -2
- package/LICENSE +0 -21
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",
|
|
@@ -25,12 +25,28 @@
|
|
|
25
25
|
"types": "./dist/browser.d.ts",
|
|
26
26
|
"import": "./dist/browser.mjs",
|
|
27
27
|
"require": "./dist/browser.js"
|
|
28
|
+
},
|
|
29
|
+
"./proofs/noir": {
|
|
30
|
+
"types": "./dist/proofs/noir.d.ts",
|
|
31
|
+
"import": "./dist/proofs/noir.mjs",
|
|
32
|
+
"require": "./dist/proofs/noir.js"
|
|
28
33
|
}
|
|
29
34
|
},
|
|
30
35
|
"files": [
|
|
31
36
|
"dist",
|
|
32
37
|
"src"
|
|
33
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
|
+
},
|
|
34
50
|
"dependencies": {
|
|
35
51
|
"@aztec/bb.js": "^0.63.1",
|
|
36
52
|
"@noble/ciphers": "^2.0.1",
|
|
@@ -55,16 +71,5 @@
|
|
|
55
71
|
"stealth-addresses",
|
|
56
72
|
"zcash"
|
|
57
73
|
],
|
|
58
|
-
"license": "MIT"
|
|
59
|
-
|
|
60
|
-
"build": "tsup src/index.ts src/browser.ts --format cjs,esm --dts",
|
|
61
|
-
"dev": "tsup src/index.ts src/browser.ts --format cjs,esm --dts --watch",
|
|
62
|
-
"lint": "eslint --ext .ts src/",
|
|
63
|
-
"typecheck": "tsc --noEmit",
|
|
64
|
-
"clean": "rm -rf dist",
|
|
65
|
-
"test": "vitest",
|
|
66
|
-
"test:coverage": "vitest run --coverage",
|
|
67
|
-
"bench": "vitest bench --config vitest.bench.config.ts",
|
|
68
|
-
"bench:json": "vitest bench --config vitest.bench.config.ts --outputJson benchmarks/results.json"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
74
|
+
"license": "MIT"
|
|
75
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -164,11 +164,13 @@ export {
|
|
|
164
164
|
} from './validation'
|
|
165
165
|
|
|
166
166
|
// Proof providers
|
|
167
|
-
// NOTE: BrowserNoirProvider
|
|
168
|
-
//
|
|
167
|
+
// NOTE: NoirProofProvider and BrowserNoirProvider are NOT exported here
|
|
168
|
+
// to avoid bundling WASM in server builds (e.g., Next.js SSR).
|
|
169
|
+
// For ZK proof generation:
|
|
170
|
+
// - Browser: import { BrowserNoirProvider } from '@sip-protocol/sdk/browser'
|
|
171
|
+
// - Node.js: import { NoirProofProvider } from '@sip-protocol/sdk/proofs/noir'
|
|
169
172
|
export {
|
|
170
173
|
MockProofProvider,
|
|
171
|
-
NoirProofProvider,
|
|
172
174
|
ProofGenerationError,
|
|
173
175
|
// Browser utilities (safe - no WASM)
|
|
174
176
|
isBrowser,
|
package/src/proofs/index.ts
CHANGED
|
@@ -46,9 +46,14 @@ 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
|
-
|
|
51
|
+
// NOTE: NoirProofProvider is NOT exported from main entry to avoid bundling WASM
|
|
52
|
+
// in server-side builds (e.g., Next.js SSR). Import directly if needed:
|
|
53
|
+
//
|
|
54
|
+
// import { NoirProofProvider } from '@sip-protocol/sdk/proofs/noir'
|
|
55
|
+
//
|
|
56
|
+
// Types are safe to export (no runtime WASM dependency)
|
|
52
57
|
export type { NoirProviderConfig } from './noir'
|
|
53
58
|
|
|
54
59
|
// Browser utilities (no WASM dependencies - safe for all environments)
|
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.
|