@sip-protocol/sdk 0.6.0 → 0.6.2

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.
Files changed (63) hide show
  1. package/README.md +58 -0
  2. package/dist/browser.d.mts +4 -4
  3. package/dist/browser.d.ts +4 -4
  4. package/dist/browser.js +2752 -448
  5. package/dist/browser.mjs +31 -1
  6. package/dist/chunk-7QZPORY5.mjs +15604 -0
  7. package/dist/chunk-C2NPCUAJ.mjs +17010 -0
  8. package/dist/chunk-FCVLFUIC.mjs +16699 -0
  9. package/dist/chunk-G5UHXECN.mjs +16340 -0
  10. package/dist/chunk-GEDEIZHJ.mjs +16798 -0
  11. package/dist/chunk-GOOEOAMV.mjs +17026 -0
  12. package/dist/chunk-MTNYSNR7.mjs +16269 -0
  13. package/dist/chunk-O5PIB2EA.mjs +16698 -0
  14. package/dist/chunk-PCFM7FQO.mjs +17010 -0
  15. package/dist/chunk-QK464ARC.mjs +16946 -0
  16. package/dist/chunk-VNBMNGC3.mjs +16698 -0
  17. package/dist/chunk-W5TUELDQ.mjs +16947 -0
  18. package/dist/index-CD_zShu-.d.ts +10870 -0
  19. package/dist/index-CQBYdLYy.d.mts +10976 -0
  20. package/dist/index-Cg9TYEPv.d.mts +11321 -0
  21. package/dist/index-CqZJOO8C.d.mts +11323 -0
  22. package/dist/index-CywN9Bnp.d.ts +11321 -0
  23. package/dist/index-DHy5ZjCD.d.ts +10976 -0
  24. package/dist/index-DfsVsmxu.d.ts +11323 -0
  25. package/dist/index-ObjwyVDX.d.mts +10870 -0
  26. package/dist/index-m0xbSfmT.d.mts +11318 -0
  27. package/dist/index-rWLEgvhN.d.ts +11318 -0
  28. package/dist/index.d.mts +3 -3
  29. package/dist/index.d.ts +3 -3
  30. package/dist/index.js +2737 -427
  31. package/dist/index.mjs +31 -1
  32. package/dist/noir-DKfEzWy9.d.mts +482 -0
  33. package/dist/noir-DKfEzWy9.d.ts +482 -0
  34. package/dist/proofs/noir.d.mts +1 -1
  35. package/dist/proofs/noir.d.ts +1 -1
  36. package/dist/proofs/noir.js +12 -3
  37. package/dist/proofs/noir.mjs +12 -3
  38. package/package.json +16 -14
  39. package/src/adapters/near-intents.ts +13 -3
  40. package/src/auction/index.ts +20 -0
  41. package/src/auction/sealed-bid.ts +1037 -0
  42. package/src/compliance/derivation.ts +13 -3
  43. package/src/compliance/reports.ts +5 -4
  44. package/src/cosmos/ibc-stealth.ts +2 -2
  45. package/src/cosmos/stealth.ts +2 -2
  46. package/src/governance/index.ts +19 -0
  47. package/src/governance/private-vote.ts +1116 -0
  48. package/src/index.ts +50 -2
  49. package/src/intent.ts +145 -8
  50. package/src/nft/index.ts +27 -0
  51. package/src/nft/private-nft.ts +811 -0
  52. package/src/proofs/browser-utils.ts +1 -7
  53. package/src/proofs/noir.ts +34 -7
  54. package/src/settlement/backends/direct-chain.ts +14 -3
  55. package/src/stealth.ts +31 -13
  56. package/src/types/browser.d.ts +67 -0
  57. package/src/validation.ts +4 -2
  58. package/src/wallet/bitcoin/adapter.ts +159 -15
  59. package/src/wallet/bitcoin/types.ts +340 -15
  60. package/src/wallet/cosmos/mock.ts +16 -12
  61. package/src/wallet/hardware/ledger.ts +82 -12
  62. package/src/wallet/hardware/types.ts +2 -0
  63. package/LICENSE +0 -21
@@ -0,0 +1,482 @@
1
+ import { ZKProof, HexString, Commitment } from '@sip-protocol/types';
2
+
3
+ /**
4
+ * Proof Provider Interface
5
+ *
6
+ * Defines a pluggable interface for ZK proof generation and verification.
7
+ * This allows different backends (Noir, mock for testing) to be swapped.
8
+ *
9
+ * @see docs/specs/ZK-ARCHITECTURE.md for framework decision (Noir)
10
+ */
11
+
12
+ /**
13
+ * Supported proof framework types
14
+ */
15
+ type ProofFramework = 'noir' | 'mock';
16
+ /**
17
+ * Parameters for generating a Funding Proof
18
+ *
19
+ * Proves: balance >= minimumRequired without revealing balance
20
+ *
21
+ * @see docs/specs/FUNDING-PROOF.md
22
+ */
23
+ interface FundingProofParams {
24
+ /** User's actual balance (private) */
25
+ balance: bigint;
26
+ /** Minimum amount required for the intent (public) */
27
+ minimumRequired: bigint;
28
+ /** Blinding factor for the commitment (private) */
29
+ blindingFactor: Uint8Array;
30
+ /** Asset identifier (public) */
31
+ assetId: string;
32
+ /** User's address for ownership proof (private) */
33
+ userAddress: string;
34
+ /** Signature proving ownership of the address (private) */
35
+ ownershipSignature: Uint8Array;
36
+ }
37
+ /**
38
+ * Public key coordinates for secp256k1 (X and Y as byte arrays)
39
+ */
40
+ interface PublicKeyXY {
41
+ /** X coordinate as 32-byte array */
42
+ x: Uint8Array;
43
+ /** Y coordinate as 32-byte array */
44
+ y: Uint8Array;
45
+ }
46
+ /**
47
+ * Parameters for generating a Validity Proof
48
+ *
49
+ * Proves: intent is authorized by sender without revealing sender
50
+ *
51
+ * @see docs/specs/VALIDITY-PROOF.md
52
+ */
53
+ interface ValidityProofParams {
54
+ /** Hash of the intent (public) */
55
+ intentHash: HexString;
56
+ /** Sender's address (private) */
57
+ senderAddress: string;
58
+ /** Blinding factor for sender commitment (private) */
59
+ senderBlinding: Uint8Array;
60
+ /** Sender's secret key (private) - used to derive public key if senderPublicKey not provided */
61
+ senderSecret: Uint8Array;
62
+ /** Signature authorizing the intent (private) */
63
+ authorizationSignature: Uint8Array;
64
+ /** Nonce for nullifier generation (private) */
65
+ nonce: Uint8Array;
66
+ /** Intent timestamp (public) */
67
+ timestamp: number;
68
+ /** Intent expiry (public) */
69
+ expiry: number;
70
+ /** Optional: Sender's public key. If not provided, derived from senderSecret */
71
+ senderPublicKey?: PublicKeyXY;
72
+ }
73
+ /**
74
+ * Parameters for generating a Fulfillment Proof
75
+ *
76
+ * Proves: solver delivered output >= minimum to correct recipient
77
+ *
78
+ * @see docs/specs/FULFILLMENT-PROOF.md
79
+ */
80
+ interface FulfillmentProofParams {
81
+ /** Hash of the original intent (public) */
82
+ intentHash: HexString;
83
+ /** Actual output amount delivered (private) */
84
+ outputAmount: bigint;
85
+ /** Blinding factor for output commitment (private) */
86
+ outputBlinding: Uint8Array;
87
+ /** Minimum required output from intent (public) */
88
+ minOutputAmount: bigint;
89
+ /** Recipient's stealth address (public) */
90
+ recipientStealth: HexString;
91
+ /** Solver's identifier (public) */
92
+ solverId: string;
93
+ /** Solver's secret for authorization (private) */
94
+ solverSecret: Uint8Array;
95
+ /** Oracle attestation of delivery (private) */
96
+ oracleAttestation: OracleAttestation;
97
+ /** Time of fulfillment (public) */
98
+ fulfillmentTime: number;
99
+ /** Intent expiry (public) */
100
+ expiry: number;
101
+ }
102
+ /**
103
+ * Oracle attestation for cross-chain verification
104
+ */
105
+ interface OracleAttestation {
106
+ /** Recipient who received funds */
107
+ recipient: HexString;
108
+ /** Amount received */
109
+ amount: bigint;
110
+ /** Transaction hash on destination chain */
111
+ txHash: HexString;
112
+ /** Block number containing the transaction */
113
+ blockNumber: bigint;
114
+ /** Oracle signature (threshold signature for multi-oracle) */
115
+ signature: Uint8Array;
116
+ }
117
+ /**
118
+ * Result of proof generation
119
+ */
120
+ interface ProofResult {
121
+ /** The generated proof */
122
+ proof: ZKProof;
123
+ /** Public inputs used in the proof */
124
+ publicInputs: HexString[];
125
+ /** Commitment (if generated as part of proof) */
126
+ commitment?: Commitment;
127
+ }
128
+ /**
129
+ * Proof Provider Interface
130
+ *
131
+ * Implementations of this interface provide ZK proof generation and verification.
132
+ * The SDK uses this interface to remain agnostic to the underlying ZK framework.
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * // Use mock provider for testing
137
+ * const mockProvider = new MockProofProvider()
138
+ *
139
+ * // Use Noir provider for production
140
+ * const noirProvider = new NoirProofProvider()
141
+ *
142
+ * // Configure SIP client with provider
143
+ * const sip = new SIP({
144
+ * network: 'testnet',
145
+ * proofProvider: noirProvider,
146
+ * })
147
+ * ```
148
+ */
149
+ interface ProofProvider {
150
+ /**
151
+ * The ZK framework this provider uses
152
+ */
153
+ readonly framework: ProofFramework;
154
+ /**
155
+ * Whether the provider is ready to generate proofs
156
+ * (e.g., circuits compiled, keys loaded)
157
+ */
158
+ readonly isReady: boolean;
159
+ /**
160
+ * Initialize the provider (compile circuits, load keys, etc.)
161
+ *
162
+ * @throws Error if initialization fails
163
+ */
164
+ initialize(): Promise<void>;
165
+ /**
166
+ * Generate a Funding Proof
167
+ *
168
+ * Proves that the user has sufficient balance without revealing the exact amount.
169
+ *
170
+ * @param params - Funding proof parameters
171
+ * @returns The generated proof with public inputs
172
+ * @throws ProofGenerationError if proof generation fails
173
+ *
174
+ * @see docs/specs/FUNDING-PROOF.md (~22,000 constraints)
175
+ */
176
+ generateFundingProof(params: FundingProofParams): Promise<ProofResult>;
177
+ /**
178
+ * Generate a Validity Proof
179
+ *
180
+ * Proves that the intent is authorized without revealing the sender.
181
+ *
182
+ * @param params - Validity proof parameters
183
+ * @returns The generated proof with public inputs
184
+ * @throws ProofGenerationError if proof generation fails
185
+ *
186
+ * @see docs/specs/VALIDITY-PROOF.md (~72,000 constraints)
187
+ */
188
+ generateValidityProof(params: ValidityProofParams): Promise<ProofResult>;
189
+ /**
190
+ * Generate a Fulfillment Proof
191
+ *
192
+ * Proves that the solver correctly delivered the output.
193
+ *
194
+ * @param params - Fulfillment proof parameters
195
+ * @returns The generated proof with public inputs
196
+ * @throws ProofGenerationError if proof generation fails
197
+ *
198
+ * @see docs/specs/FULFILLMENT-PROOF.md (~22,000 constraints)
199
+ */
200
+ generateFulfillmentProof(params: FulfillmentProofParams): Promise<ProofResult>;
201
+ /**
202
+ * Verify a proof
203
+ *
204
+ * @param proof - The proof to verify
205
+ * @returns true if the proof is valid, false otherwise
206
+ */
207
+ verifyProof(proof: ZKProof): Promise<boolean>;
208
+ }
209
+ /**
210
+ * Error thrown when proof generation fails
211
+ */
212
+ declare class ProofGenerationError extends Error {
213
+ readonly proofType: 'funding' | 'validity' | 'fulfillment';
214
+ readonly cause?: Error;
215
+ constructor(proofType: 'funding' | 'validity' | 'fulfillment', message: string, cause?: Error);
216
+ }
217
+
218
+ /**
219
+ * Noir Proof Provider
220
+ *
221
+ * Production-ready ZK proof provider using Noir (Aztec) circuits.
222
+ *
223
+ * This provider generates cryptographically sound proofs using:
224
+ * - Funding Proof: ~2,000 constraints (docs/specs/FUNDING-PROOF.md)
225
+ * - Validity Proof: ~72,000 constraints (docs/specs/VALIDITY-PROOF.md)
226
+ * - Fulfillment Proof: ~22,000 constraints (docs/specs/FULFILLMENT-PROOF.md)
227
+ *
228
+ * @see docs/specs/ZK-ARCHITECTURE.md for framework decision
229
+ */
230
+
231
+ /**
232
+ * Public key coordinates for secp256k1
233
+ */
234
+ interface PublicKeyCoordinates {
235
+ /** X coordinate as 32-byte array */
236
+ x: number[];
237
+ /** Y coordinate as 32-byte array */
238
+ y: number[];
239
+ }
240
+ /**
241
+ * Noir Proof Provider Configuration
242
+ */
243
+ interface NoirProviderConfig {
244
+ /**
245
+ * Path to compiled circuit artifacts
246
+ * If not provided, uses bundled artifacts
247
+ */
248
+ artifactsPath?: string;
249
+ /**
250
+ * Backend to use for proof generation
251
+ * @default 'barretenberg' (UltraHonk)
252
+ */
253
+ backend?: 'barretenberg';
254
+ /**
255
+ * Enable verbose logging for debugging
256
+ * @default false
257
+ */
258
+ verbose?: boolean;
259
+ /**
260
+ * Oracle public key for verifying attestations in fulfillment proofs
261
+ * Required for production use. If not provided and strictMode is true,
262
+ * fulfillment proof generation will throw an error.
263
+ */
264
+ oraclePublicKey?: PublicKeyCoordinates;
265
+ /**
266
+ * Enable strict mode for production use
267
+ *
268
+ * When true:
269
+ * - Fulfillment proofs require configured oraclePublicKey
270
+ * - Missing configuration throws errors instead of warnings
271
+ *
272
+ * When false (default):
273
+ * - Placeholder keys are used when oraclePublicKey not configured
274
+ * - Warnings are logged for missing configuration
275
+ *
276
+ * @default false
277
+ */
278
+ strictMode?: boolean;
279
+ }
280
+ /**
281
+ * Noir Proof Provider
282
+ *
283
+ * Production ZK proof provider using Noir circuits.
284
+ *
285
+ * @example
286
+ * ```typescript
287
+ * const provider = new NoirProofProvider()
288
+ *
289
+ * await provider.initialize()
290
+ *
291
+ * const result = await provider.generateFundingProof({
292
+ * balance: 100n,
293
+ * minimumRequired: 50n,
294
+ * blindingFactor: new Uint8Array(32),
295
+ * assetId: '0xABCD',
296
+ * userAddress: '0x1234...',
297
+ * ownershipSignature: new Uint8Array(64),
298
+ * })
299
+ * ```
300
+ */
301
+ declare class NoirProofProvider implements ProofProvider {
302
+ readonly framework: ProofFramework;
303
+ private _isReady;
304
+ private config;
305
+ private fundingNoir;
306
+ private fundingBackend;
307
+ private validityNoir;
308
+ private validityBackend;
309
+ private fulfillmentNoir;
310
+ private fulfillmentBackend;
311
+ constructor(config?: NoirProviderConfig);
312
+ get isReady(): boolean;
313
+ /**
314
+ * Derive secp256k1 public key coordinates from a private key
315
+ *
316
+ * Utility method that can be used to generate public key coordinates
317
+ * for use in ValidityProofParams.senderPublicKey or NoirProviderConfig.oraclePublicKey
318
+ *
319
+ * @param privateKey - 32-byte private key
320
+ * @returns X and Y coordinates as 32-byte arrays
321
+ *
322
+ * @example
323
+ * ```typescript
324
+ * const privateKey = new Uint8Array(32).fill(1) // Your secret key
325
+ * const publicKey = NoirProofProvider.derivePublicKey(privateKey)
326
+ *
327
+ * // Use for oracle configuration
328
+ * const provider = new NoirProofProvider({
329
+ * oraclePublicKey: publicKey
330
+ * })
331
+ *
332
+ * // Or use for validity proof params
333
+ * const validityParams = {
334
+ * // ... other params
335
+ * senderPublicKey: {
336
+ * x: new Uint8Array(publicKey.x),
337
+ * y: new Uint8Array(publicKey.y)
338
+ * }
339
+ * }
340
+ * ```
341
+ */
342
+ static derivePublicKey(privateKey: Uint8Array): PublicKeyCoordinates;
343
+ /**
344
+ * Initialize the Noir provider
345
+ *
346
+ * Loads circuit artifacts and initializes the proving backend.
347
+ */
348
+ initialize(): Promise<void>;
349
+ /**
350
+ * Generate a Funding Proof using Noir circuits
351
+ *
352
+ * Proves: balance >= minimumRequired without revealing balance
353
+ *
354
+ * @see docs/specs/FUNDING-PROOF.md
355
+ */
356
+ generateFundingProof(params: FundingProofParams): Promise<ProofResult>;
357
+ /**
358
+ * Generate a Validity Proof using Noir circuits
359
+ *
360
+ * Proves: Intent is authorized by sender without revealing identity
361
+ *
362
+ * @see docs/specs/VALIDITY-PROOF.md
363
+ */
364
+ generateValidityProof(params: ValidityProofParams): Promise<ProofResult>;
365
+ /**
366
+ * Generate a Fulfillment Proof using Noir circuits
367
+ *
368
+ * Proves: Solver correctly executed the intent and delivered the required
369
+ * output to the recipient, without revealing execution path or liquidity sources.
370
+ *
371
+ * @see docs/specs/FULFILLMENT-PROOF.md
372
+ */
373
+ generateFulfillmentProof(params: FulfillmentProofParams): Promise<ProofResult>;
374
+ /**
375
+ * Verify a Noir proof
376
+ */
377
+ verifyProof(proof: ZKProof): Promise<boolean>;
378
+ /**
379
+ * Destroy the provider and free resources
380
+ */
381
+ destroy(): Promise<void>;
382
+ private ensureReady;
383
+ /**
384
+ * Compute the commitment hash that the circuit expects
385
+ *
386
+ * The circuit computes:
387
+ * 1. commitment = pedersen_commitment([balance, blinding])
388
+ * 2. commitment_hash = pedersen_hash([commitment.x, commitment.y, asset_id])
389
+ *
390
+ * We need to compute this outside to pass as a public input.
391
+ *
392
+ * **IMPORTANT**: This SDK uses SHA256 as a deterministic stand-in for Pedersen hash.
393
+ * Both the SDK and circuit MUST use the same hash function. The bundled circuit
394
+ * artifacts are configured to use SHA256 for compatibility. If you use custom
395
+ * circuits with actual Pedersen hashing, you must update this implementation.
396
+ *
397
+ * @see docs/specs/HASH-COMPATIBILITY.md for hash function requirements
398
+ */
399
+ private computeCommitmentHash;
400
+ /**
401
+ * Convert asset ID to field element
402
+ */
403
+ private assetIdToField;
404
+ /**
405
+ * Convert bytes to field element string
406
+ */
407
+ private bytesToField;
408
+ /**
409
+ * Convert bigint to bytes
410
+ */
411
+ private bigintToBytes;
412
+ /**
413
+ * Convert hex string to bytes
414
+ */
415
+ private hexToBytes;
416
+ /**
417
+ * Convert hex string to field element string
418
+ */
419
+ private hexToField;
420
+ /**
421
+ * Convert field string to 32-byte array
422
+ */
423
+ private fieldToBytes32;
424
+ /**
425
+ * Compute sender commitment for validity proof
426
+ *
427
+ * Uses SHA256 for SDK-side computation. The bundled circuit artifacts
428
+ * are compiled to use SHA256 for compatibility with this SDK.
429
+ *
430
+ * @see computeCommitmentHash for hash function compatibility notes
431
+ */
432
+ private computeSenderCommitment;
433
+ /**
434
+ * Compute nullifier for validity proof
435
+ *
436
+ * Uses SHA256 for SDK-side computation. The bundled circuit artifacts
437
+ * are compiled to use SHA256 for compatibility with this SDK.
438
+ *
439
+ * @see computeCommitmentHash for hash function compatibility notes
440
+ */
441
+ private computeNullifier;
442
+ /**
443
+ * Compute output commitment for fulfillment proof
444
+ *
445
+ * Uses SHA256 for SDK-side computation. The bundled circuit artifacts
446
+ * are compiled to use SHA256 for compatibility with this SDK.
447
+ *
448
+ * @see computeCommitmentHash for hash function compatibility notes
449
+ */
450
+ private computeOutputCommitment;
451
+ /**
452
+ * Compute solver ID from solver secret
453
+ *
454
+ * Uses SHA256 for SDK-side computation. The bundled circuit artifacts
455
+ * are compiled to use SHA256 for compatibility with this SDK.
456
+ *
457
+ * @see computeCommitmentHash for hash function compatibility notes
458
+ */
459
+ private computeSolverId;
460
+ /**
461
+ * Compute oracle message hash for fulfillment proof
462
+ *
463
+ * Hash of attestation data that oracle signs
464
+ */
465
+ private computeOracleMessageHash;
466
+ /**
467
+ * Derive secp256k1 public key coordinates from a private key
468
+ *
469
+ * @param privateKey - 32-byte private key as Uint8Array
470
+ * @returns X and Y coordinates as 32-byte arrays
471
+ */
472
+ private getPublicKeyCoordinates;
473
+ /**
474
+ * Derive public key coordinates from a field string (private key)
475
+ *
476
+ * @param privateKeyField - Private key as hex field string
477
+ * @returns X and Y coordinates as 32-byte arrays
478
+ */
479
+ private getPublicKeyFromField;
480
+ }
481
+
482
+ export { type FundingProofParams as F, type NoirProviderConfig as N, type OracleAttestation as O, type ProofResult as P, type ValidityProofParams as V, type FulfillmentProofParams as a, ProofGenerationError as b, type ProofProvider as c, type ProofFramework as d, type PublicKeyCoordinates as e, NoirProofProvider as f };
@@ -1,2 +1,2 @@
1
1
  import '@sip-protocol/types';
2
- export { f as NoirProofProvider, N as NoirProviderConfig, e as PublicKeyCoordinates } from '../noir-BTyLXLlZ.mjs';
2
+ export { f as NoirProofProvider, N as NoirProviderConfig, e as PublicKeyCoordinates } from '../noir-DKfEzWy9.mjs';
@@ -1,2 +1,2 @@
1
1
  import '@sip-protocol/types';
2
- export { f as NoirProofProvider, N as NoirProviderConfig, e as PublicKeyCoordinates } from '../noir-BTyLXLlZ.js';
2
+ export { f as NoirProofProvider, N as NoirProviderConfig, e as PublicKeyCoordinates } from '../noir-DKfEzWy9.js';
@@ -1000,6 +1000,7 @@ var NoirProofProvider = class {
1000
1000
  this.config = {
1001
1001
  backend: "barretenberg",
1002
1002
  verbose: false,
1003
+ strictMode: false,
1003
1004
  ...config
1004
1005
  };
1005
1006
  }
@@ -1348,11 +1349,19 @@ var NoirProofProvider = class {
1348
1349
  attestation.txHash,
1349
1350
  attestation.blockNumber
1350
1351
  );
1352
+ if (!this.config.oraclePublicKey) {
1353
+ if (this.config.strictMode) {
1354
+ throw new ProofGenerationError(
1355
+ "fulfillment",
1356
+ "Oracle public key is required in strict mode. Configure oraclePublicKey in NoirProviderConfig for production use."
1357
+ );
1358
+ }
1359
+ console.warn(
1360
+ "[NoirProofProvider] WARNING: No oracle public key configured. Using placeholder keys. Proofs will NOT be valid for production. Set strictMode: true to enforce configuration."
1361
+ );
1362
+ }
1351
1363
  const oraclePubKeyX = this.config.oraclePublicKey?.x ?? new Array(32).fill(0);
1352
1364
  const oraclePubKeyY = this.config.oraclePublicKey?.y ?? new Array(32).fill(0);
1353
- if (!this.config.oraclePublicKey && this.config.verbose) {
1354
- console.warn("[NoirProofProvider] Warning: No oracle public key configured. Using placeholder keys.");
1355
- }
1356
1365
  const witnessInputs = {
1357
1366
  // Public inputs
1358
1367
  intent_hash: intentHashField,
@@ -28,6 +28,7 @@ var NoirProofProvider = class {
28
28
  this.config = {
29
29
  backend: "barretenberg",
30
30
  verbose: false,
31
+ strictMode: false,
31
32
  ...config
32
33
  };
33
34
  }
@@ -376,11 +377,19 @@ var NoirProofProvider = class {
376
377
  attestation.txHash,
377
378
  attestation.blockNumber
378
379
  );
380
+ if (!this.config.oraclePublicKey) {
381
+ if (this.config.strictMode) {
382
+ throw new ProofGenerationError(
383
+ "fulfillment",
384
+ "Oracle public key is required in strict mode. Configure oraclePublicKey in NoirProviderConfig for production use."
385
+ );
386
+ }
387
+ console.warn(
388
+ "[NoirProofProvider] WARNING: No oracle public key configured. Using placeholder keys. Proofs will NOT be valid for production. Set strictMode: true to enforce configuration."
389
+ );
390
+ }
379
391
  const oraclePubKeyX = this.config.oraclePublicKey?.x ?? new Array(32).fill(0);
380
392
  const oraclePubKeyY = this.config.oraclePublicKey?.y ?? new Array(32).fill(0);
381
- if (!this.config.oraclePublicKey && this.config.verbose) {
382
- console.warn("[NoirProofProvider] Warning: No oracle public key configured. Using placeholder keys.");
383
- }
384
393
  const witnessInputs = {
385
394
  // Public inputs
386
395
  intent_hash: intentHashField,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sip-protocol/sdk",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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,8 +36,21 @@
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
+ "demo:auction": "tsx examples/auction-demo.ts"
50
+ },
39
51
  "dependencies": {
40
52
  "@aztec/bb.js": "^0.63.1",
53
+ "@ethereumjs/rlp": "^10.1.0",
41
54
  "@noble/ciphers": "^2.0.1",
42
55
  "@noble/curves": "^1.3.0",
43
56
  "@noble/hashes": "^1.3.3",
@@ -61,16 +74,5 @@
61
74
  "stealth-addresses",
62
75
  "zcash"
63
76
  ],
64
- "license": "MIT",
65
- "scripts": {
66
- "build": "tsup src/index.ts src/browser.ts src/proofs/noir.ts --format cjs,esm --dts",
67
- "dev": "tsup src/index.ts src/browser.ts src/proofs/noir.ts --format cjs,esm --dts --watch",
68
- "lint": "eslint --ext .ts src/",
69
- "typecheck": "tsc --noEmit",
70
- "clean": "rm -rf dist",
71
- "test": "vitest",
72
- "test:coverage": "vitest run --coverage",
73
- "bench": "vitest bench --config vitest.bench.config.ts",
74
- "bench:json": "vitest bench --config vitest.bench.config.ts --outputJson benchmarks/results.json"
75
- }
76
- }
77
+ "license": "MIT"
78
+ }
@@ -39,6 +39,8 @@ import {
39
39
  getCurveForChain,
40
40
  type StealthCurve,
41
41
  } from '../stealth'
42
+ import { ed25519PublicKeyToAptosAddress } from '../move/aptos'
43
+ import { ed25519PublicKeyToSuiAddress } from '../move/sui'
42
44
  import { ValidationError } from '../errors'
43
45
  import { isAddressValidForChain, getChainAddressType } from '../validation'
44
46
 
@@ -360,12 +362,16 @@ export class NEARIntentsAdapter {
360
362
  recipientAddress = ed25519PublicKeyToSolanaAddress(stealthAddress.address)
361
363
  } else if (outputChain === 'near') {
362
364
  recipientAddress = ed25519PublicKeyToNearAddress(stealthAddress.address)
365
+ } else if (outputChain === 'aptos') {
366
+ recipientAddress = ed25519PublicKeyToAptosAddress(stealthAddress.address)
367
+ } else if (outputChain === 'sui') {
368
+ recipientAddress = ed25519PublicKeyToSuiAddress(stealthAddress.address)
363
369
  } else {
364
- // Future ed25519 chains
370
+ // This should not happen if ED25519_CHAINS is kept in sync
365
371
  throw new ValidationError(
366
- `ed25519 address derivation not implemented for ${outputChain}`,
372
+ `ed25519 address derivation not implemented for ${outputChain}. Please add support in near-intents.ts.`,
367
373
  'outputAsset',
368
- { outputChain }
374
+ { outputChain, hint: 'Add address derivation function for this chain' }
369
375
  )
370
376
  }
371
377
  nativeRecipientAddress = recipientAddress
@@ -419,6 +425,10 @@ export class NEARIntentsAdapter {
419
425
  refundAddress = ed25519PublicKeyToSolanaAddress(refundStealth.stealthAddress.address)
420
426
  } else if (inputChain === 'near') {
421
427
  refundAddress = ed25519PublicKeyToNearAddress(refundStealth.stealthAddress.address)
428
+ } else if (inputChain === 'aptos') {
429
+ refundAddress = ed25519PublicKeyToAptosAddress(refundStealth.stealthAddress.address)
430
+ } else if (inputChain === 'sui') {
431
+ refundAddress = ed25519PublicKeyToSuiAddress(refundStealth.stealthAddress.address)
422
432
  }
423
433
  } else {
424
434
  // Cross-curve: output is secp256k1 but input is ed25519
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Sealed-Bid Auction Module
3
+ *
4
+ * Cryptographic primitives for privacy-preserving sealed-bid auctions.
5
+ *
6
+ * @module auction
7
+ */
8
+
9
+ export {
10
+ SealedBidAuction,
11
+ createSealedBidAuction,
12
+ type SealedBid,
13
+ type BidReceipt,
14
+ type RevealedBid,
15
+ type CreateBidParams,
16
+ type VerifyBidParams,
17
+ } from './sealed-bid'
18
+
19
+ // Re-export winner verification types from @sip-protocol/types
20
+ export type { WinnerResult, WinnerProof, WinnerVerification } from '@sip-protocol/types'