@sip-protocol/sdk 0.2.8 → 0.2.10
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/LICENSE +21 -0
- package/README.md +349 -0
- package/dist/browser.d.mts +100 -2
- package/dist/browser.d.ts +100 -2
- package/dist/browser.js +1362 -268
- package/dist/browser.mjs +502 -16
- package/dist/{chunk-UPTISVCY.mjs → chunk-AV37IZST.mjs} +731 -15
- package/dist/{chunk-VITVG25F.mjs → chunk-XLEPIR2P.mjs} +2 -100
- package/dist/index-BFOKTz2z.d.ts +6062 -0
- package/dist/index-CAhjA4kh.d.mts +6062 -0
- package/dist/index.d.mts +2 -5609
- package/dist/index.d.ts +2 -5609
- package/dist/index.js +588 -154
- package/dist/index.mjs +5 -1
- package/dist/{noir-BHQtFvRk.d.mts → noir-BTyLXLlZ.d.mts} +1 -1
- package/dist/{noir-BHQtFvRk.d.ts → noir-BTyLXLlZ.d.ts} +1 -1
- package/dist/proofs/noir.d.mts +1 -1
- package/dist/proofs/noir.d.ts +1 -1
- package/dist/proofs/noir.js +11 -112
- package/dist/proofs/noir.mjs +10 -13
- package/package.json +16 -16
- package/src/browser.ts +23 -0
- package/src/index.ts +12 -0
- package/src/proofs/browser-utils.ts +389 -0
- package/src/proofs/browser.ts +246 -19
- package/src/proofs/circuits/funding_proof.json +1 -1
- package/src/proofs/noir.ts +14 -14
- package/src/proofs/worker.ts +426 -0
- package/src/zcash/bridge.ts +738 -0
- package/src/zcash/index.ts +36 -1
- package/src/zcash/swap-service.ts +793 -0
- package/dist/chunk-4VJHI66K.mjs +0 -12120
- package/dist/chunk-5BAS4D44.mjs +0 -10283
- package/dist/chunk-6WOV2YNG.mjs +0 -10179
- package/dist/chunk-DU7LQDD2.mjs +0 -10148
- package/dist/chunk-MR7HRCRS.mjs +0 -10165
- package/dist/chunk-NDGUWOOZ.mjs +0 -10157
- package/dist/chunk-O4Y2ZUDL.mjs +0 -12721
- package/dist/chunk-VXSHK7US.mjs +0 -10158
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
# @sip-protocol/sdk
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@sip-protocol/sdk)
|
|
4
|
+
[](https://github.com/sip-protocol/sip-protocol/actions/workflows/ci.yml)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
**Privacy layer for cross-chain transactions.** One toggle to shield sender, amount, and recipient.
|
|
8
|
+
|
|
9
|
+
SIP (Shielded Intents Protocol) is the privacy standard for Web3 - like HTTPS for the internet. Add privacy to any cross-chain swap with stealth addresses, Pedersen commitments, and viewing keys for compliance.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @sip-protocol/sdk
|
|
15
|
+
# or
|
|
16
|
+
pnpm add @sip-protocol/sdk
|
|
17
|
+
# or
|
|
18
|
+
yarn add @sip-protocol/sdk
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### Basic Private Swap
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { SIP, PrivacyLevel, NATIVE_TOKENS } from '@sip-protocol/sdk'
|
|
27
|
+
|
|
28
|
+
// Create SIP client
|
|
29
|
+
const sip = new SIP({ network: 'mainnet' })
|
|
30
|
+
|
|
31
|
+
// Create a shielded cross-chain swap
|
|
32
|
+
const intent = await sip.createIntent({
|
|
33
|
+
input: { chain: 'ethereum', token: 'ETH', amount: '1.0' },
|
|
34
|
+
output: { chain: 'solana', token: 'SOL' },
|
|
35
|
+
privacy: PrivacyLevel.SHIELDED,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// Get quotes from solvers
|
|
39
|
+
const quotes = await sip.getQuotes(intent)
|
|
40
|
+
|
|
41
|
+
// Execute the swap (privacy preserved!)
|
|
42
|
+
const result = await sip.execute(intent, quotes[0])
|
|
43
|
+
console.log('Swap complete:', result.status)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Privacy Levels
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { PrivacyLevel } from '@sip-protocol/sdk'
|
|
50
|
+
|
|
51
|
+
// Full transparency (regular swap)
|
|
52
|
+
PrivacyLevel.TRANSPARENT
|
|
53
|
+
|
|
54
|
+
// Maximum privacy (hidden sender, amount, recipient)
|
|
55
|
+
PrivacyLevel.SHIELDED
|
|
56
|
+
|
|
57
|
+
// Privacy + compliance (auditor can verify with viewing key)
|
|
58
|
+
PrivacyLevel.COMPLIANT
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Generate Stealth Address
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { generateStealthMetaAddress, generateStealthAddress } from '@sip-protocol/sdk'
|
|
65
|
+
|
|
66
|
+
// Recipient generates a meta-address (share this publicly)
|
|
67
|
+
const { metaAddress, spendingKey, viewingKey } = generateStealthMetaAddress('ethereum')
|
|
68
|
+
|
|
69
|
+
// Sender generates one-time stealth address from meta-address
|
|
70
|
+
const { stealthAddress, ephemeralPublicKey } = generateStealthAddress(metaAddress)
|
|
71
|
+
|
|
72
|
+
// Funds sent to stealthAddress are only recoverable by recipient
|
|
73
|
+
console.log('Send funds to:', stealthAddress)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Pedersen Commitments
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { commit, verifyOpening, addCommitments } from '@sip-protocol/sdk'
|
|
80
|
+
|
|
81
|
+
// Hide an amount in a commitment
|
|
82
|
+
const amount = 1000000n // 1 USDC (6 decimals)
|
|
83
|
+
const { commitment, blinding } = commit(amount)
|
|
84
|
+
|
|
85
|
+
// Verify the commitment opens to the claimed amount
|
|
86
|
+
const isValid = verifyOpening(commitment, amount, blinding)
|
|
87
|
+
console.log('Commitment valid:', isValid) // true
|
|
88
|
+
|
|
89
|
+
// Commitments are homomorphic (can add without revealing)
|
|
90
|
+
const { commitment: c1, blinding: b1 } = commit(100n)
|
|
91
|
+
const { commitment: c2, blinding: b2 } = commit(200n)
|
|
92
|
+
const sumCommitment = addCommitments(c1, c2)
|
|
93
|
+
// sumCommitment commits to 300 without revealing individual amounts
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### NEAR Intents Integration
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { NEARIntentsAdapter, generateStealthMetaAddress, PrivacyLevel } from '@sip-protocol/sdk'
|
|
100
|
+
|
|
101
|
+
const adapter = new NEARIntentsAdapter({
|
|
102
|
+
jwtToken: process.env.NEAR_INTENTS_JWT,
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
// Create swap request
|
|
106
|
+
const request = {
|
|
107
|
+
requestId: `swap_${Date.now()}`,
|
|
108
|
+
privacyLevel: PrivacyLevel.SHIELDED,
|
|
109
|
+
inputAsset: { chain: 'near', symbol: 'NEAR', decimals: 24 },
|
|
110
|
+
inputAmount: 1000000000000000000000000n, // 1 NEAR
|
|
111
|
+
outputAsset: { chain: 'ethereum', symbol: 'ETH', decimals: 18 },
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Generate stealth address for recipient
|
|
115
|
+
const { metaAddress } = generateStealthMetaAddress('ethereum')
|
|
116
|
+
|
|
117
|
+
// Prepare and execute
|
|
118
|
+
const prepared = await adapter.prepareSwap(request, metaAddress)
|
|
119
|
+
const quote = await adapter.getQuote(prepared)
|
|
120
|
+
console.log('Quote:', quote.amountOut, 'ETH')
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Compliant Mode with Viewing Keys
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import {
|
|
127
|
+
SIP,
|
|
128
|
+
PrivacyLevel,
|
|
129
|
+
generateViewingKey,
|
|
130
|
+
encryptForViewing,
|
|
131
|
+
decryptWithViewing
|
|
132
|
+
} from '@sip-protocol/sdk'
|
|
133
|
+
|
|
134
|
+
// Create compliant swap (privacy + audit capability)
|
|
135
|
+
const sip = new SIP({ network: 'mainnet' })
|
|
136
|
+
|
|
137
|
+
const intent = await sip.createIntent({
|
|
138
|
+
input: { chain: 'ethereum', token: 'USDC', amount: '10000' },
|
|
139
|
+
output: { chain: 'polygon', token: 'USDC' },
|
|
140
|
+
privacy: PrivacyLevel.COMPLIANT,
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
// Generate viewing key for auditor
|
|
144
|
+
const viewingKey = generateViewingKey()
|
|
145
|
+
|
|
146
|
+
// Encrypt transaction details for auditor
|
|
147
|
+
const encrypted = encryptForViewing(
|
|
148
|
+
{ amount: '10000', sender: '0x...', recipient: '0x...' },
|
|
149
|
+
viewingKey.publicKey
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
// Auditor can decrypt with their private key
|
|
153
|
+
const decrypted = decryptWithViewing(encrypted, viewingKey.privateKey)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Core Concepts
|
|
157
|
+
|
|
158
|
+
### Stealth Addresses (EIP-5564)
|
|
159
|
+
|
|
160
|
+
One-time addresses that prevent linking transactions to recipients:
|
|
161
|
+
|
|
162
|
+
| Chain Type | Curve | Function |
|
|
163
|
+
|------------|-------|----------|
|
|
164
|
+
| EVM (Ethereum, Polygon, Arbitrum) | secp256k1 | `generateStealthMetaAddress()` |
|
|
165
|
+
| Solana, NEAR | ed25519 | `generateEd25519StealthMetaAddress()` |
|
|
166
|
+
|
|
167
|
+
### Pedersen Commitments
|
|
168
|
+
|
|
169
|
+
Hide amounts while proving correctness:
|
|
170
|
+
|
|
171
|
+
- **Hiding**: Commitment reveals nothing about the value
|
|
172
|
+
- **Binding**: Cannot open to different values
|
|
173
|
+
- **Homomorphic**: `C(a) + C(b) = C(a+b)` - verify sums without revealing
|
|
174
|
+
|
|
175
|
+
### Privacy Levels
|
|
176
|
+
|
|
177
|
+
| Level | Sender | Amount | Recipient | Auditable |
|
|
178
|
+
|-------|--------|--------|-----------|-----------|
|
|
179
|
+
| `TRANSPARENT` | Visible | Visible | Visible | N/A |
|
|
180
|
+
| `SHIELDED` | Hidden | Hidden | Hidden | No |
|
|
181
|
+
| `COMPLIANT` | Hidden | Hidden | Hidden | Yes (viewing key) |
|
|
182
|
+
|
|
183
|
+
## API Reference
|
|
184
|
+
|
|
185
|
+
### Main Client
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import { SIP, createSIP, createProductionSIP } from '@sip-protocol/sdk'
|
|
189
|
+
|
|
190
|
+
const sip = new SIP({ network: 'mainnet' })
|
|
191
|
+
// or
|
|
192
|
+
const sip = createSIP({ network: 'testnet' })
|
|
193
|
+
// or (with NEAR Intents)
|
|
194
|
+
const sip = createProductionSIP({ jwtToken: '...' })
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Intent Builder
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import { IntentBuilder, createShieldedIntent } from '@sip-protocol/sdk'
|
|
201
|
+
|
|
202
|
+
// Fluent API
|
|
203
|
+
const intent = new IntentBuilder()
|
|
204
|
+
.from('ethereum', 'ETH', '1.0')
|
|
205
|
+
.to('solana', 'SOL')
|
|
206
|
+
.withPrivacy(PrivacyLevel.SHIELDED)
|
|
207
|
+
.build()
|
|
208
|
+
|
|
209
|
+
// Or direct creation
|
|
210
|
+
const intent = createShieldedIntent({
|
|
211
|
+
input: { chain: 'ethereum', token: 'ETH', amount: '1.0' },
|
|
212
|
+
output: { chain: 'solana', token: 'SOL' },
|
|
213
|
+
})
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Wallet Adapters
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
import {
|
|
220
|
+
EthereumWalletAdapter,
|
|
221
|
+
SolanaWalletAdapter,
|
|
222
|
+
LedgerWalletAdapter,
|
|
223
|
+
TrezorWalletAdapter,
|
|
224
|
+
} from '@sip-protocol/sdk'
|
|
225
|
+
|
|
226
|
+
// MetaMask / Browser wallet
|
|
227
|
+
const eth = await EthereumWalletAdapter.create()
|
|
228
|
+
await eth.connect()
|
|
229
|
+
|
|
230
|
+
// Phantom / Solflare
|
|
231
|
+
const sol = await SolanaWalletAdapter.create()
|
|
232
|
+
await sol.connect()
|
|
233
|
+
|
|
234
|
+
// Hardware wallets
|
|
235
|
+
const ledger = await LedgerWalletAdapter.create({ transport: 'webusb' })
|
|
236
|
+
const trezor = await TrezorWalletAdapter.create()
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Proof Providers
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
// Browser (WASM-based)
|
|
243
|
+
import { BrowserNoirProvider } from '@sip-protocol/sdk/browser'
|
|
244
|
+
|
|
245
|
+
const provider = new BrowserNoirProvider()
|
|
246
|
+
await provider.initialize()
|
|
247
|
+
const proof = await provider.generateFundingProof(params)
|
|
248
|
+
|
|
249
|
+
// Node.js
|
|
250
|
+
import { NoirProofProvider } from '@sip-protocol/sdk/proofs/noir'
|
|
251
|
+
|
|
252
|
+
const provider = new NoirProofProvider()
|
|
253
|
+
await provider.initialize()
|
|
254
|
+
const proof = await provider.generateFundingProof(params)
|
|
255
|
+
|
|
256
|
+
// Mock (for testing)
|
|
257
|
+
import { MockProofProvider } from '@sip-protocol/sdk'
|
|
258
|
+
|
|
259
|
+
const mock = new MockProofProvider()
|
|
260
|
+
const proof = await mock.generateFundingProof(params)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Zcash Integration
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
import { ZcashRPCClient, ZcashShieldedService } from '@sip-protocol/sdk'
|
|
267
|
+
|
|
268
|
+
const client = new ZcashRPCClient({
|
|
269
|
+
host: 'localhost',
|
|
270
|
+
port: 8232,
|
|
271
|
+
username: process.env.ZCASH_RPC_USER,
|
|
272
|
+
password: process.env.ZCASH_RPC_PASS,
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
const service = new ZcashShieldedService({ client })
|
|
276
|
+
const result = await service.shieldedSend({
|
|
277
|
+
from: 'z-address...',
|
|
278
|
+
to: 'z-address...',
|
|
279
|
+
amount: 1.5,
|
|
280
|
+
memo: 'Private payment',
|
|
281
|
+
})
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Supported Chains
|
|
285
|
+
|
|
286
|
+
| Chain | Input | Output | Stealth Curve |
|
|
287
|
+
|-------|-------|--------|---------------|
|
|
288
|
+
| Ethereum | Yes | Yes | secp256k1 |
|
|
289
|
+
| Solana | Yes | Yes | ed25519 |
|
|
290
|
+
| NEAR | Yes | Yes | ed25519 |
|
|
291
|
+
| Polygon | Yes | Yes | secp256k1 |
|
|
292
|
+
| Arbitrum | Yes | Yes | secp256k1 |
|
|
293
|
+
| Base | Yes | Yes | secp256k1 |
|
|
294
|
+
| Optimism | Yes | Yes | secp256k1 |
|
|
295
|
+
| Bitcoin | Yes | Yes | - |
|
|
296
|
+
| Zcash | Yes | Yes | - |
|
|
297
|
+
|
|
298
|
+
## Error Handling
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
import { SIPError, ValidationError, CryptoError, isSIPError } from '@sip-protocol/sdk'
|
|
302
|
+
|
|
303
|
+
try {
|
|
304
|
+
await sip.execute(intent, quote)
|
|
305
|
+
} catch (error) {
|
|
306
|
+
if (isSIPError(error)) {
|
|
307
|
+
console.error('SIP Error:', error.code, error.message)
|
|
308
|
+
|
|
309
|
+
if (error instanceof ValidationError) {
|
|
310
|
+
console.error('Invalid input:', error.details)
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Testing
|
|
317
|
+
|
|
318
|
+
The SDK includes 1,295 tests covering all functionality:
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# Run all tests
|
|
322
|
+
pnpm test
|
|
323
|
+
|
|
324
|
+
# Run with coverage
|
|
325
|
+
pnpm test:coverage
|
|
326
|
+
|
|
327
|
+
# Run benchmarks
|
|
328
|
+
pnpm bench
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## Documentation
|
|
332
|
+
|
|
333
|
+
- [Full Documentation](https://docs.sip-protocol.org)
|
|
334
|
+
- [API Reference](https://docs.sip-protocol.org/api)
|
|
335
|
+
- [Examples](https://github.com/sip-protocol/sip-protocol/tree/main/examples)
|
|
336
|
+
|
|
337
|
+
## Contributing
|
|
338
|
+
|
|
339
|
+
See [CONTRIBUTING.md](https://github.com/sip-protocol/sip-protocol/blob/main/CONTRIBUTING.md) for guidelines.
|
|
340
|
+
|
|
341
|
+
## License
|
|
342
|
+
|
|
343
|
+
MIT License - see [LICENSE](https://github.com/sip-protocol/sip-protocol/blob/main/LICENSE) for details.
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
**SIP Protocol** - Privacy is a feature, not a bug.
|
|
348
|
+
|
|
349
|
+
[Website](https://sip-protocol.org) | [Docs](https://docs.sip-protocol.org) | [GitHub](https://github.com/sip-protocol/sip-protocol) | [Discord](https://discord.gg/sip-protocol)
|
package/dist/browser.d.mts
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
-
export { ATTESTATION_VERSION, AttestationRequest, AttestationResult, BaseWalletAdapter, B as BrowserNoirProvider, BrowserNoirProviderConfig, CHAIN_NUMERIC_IDS, CommitmentPoint, ComplianceManager, CreateIntentOptions, CreatePaymentOptions, CryptoError, DEFAULT_THRESHOLD, DEFAULT_TOTAL_ORACLES, DerivationPath, EIP1193ConnectInfo, EIP1193Event, EIP1193Provider, EIP1193ProviderRpcError, EIP1193RequestArguments, EIP712Domain, EIP712TypeDefinition, EIP712TypedData, EIP712Types, EncryptionNotImplementedError, ErrorCode, EthereumAdapterConfig, EthereumChainId, EthereumChainIdType, EthereumChainMetadata, EthereumTokenMetadata, EthereumTransactionReceipt, EthereumTransactionRequest, EthereumWalletAdapter, EthereumWalletName, ExportedViewingKey, HardwareAccount, HardwareConnectionStatus, HardwareDeviceInfo, HardwareErrorCode, HardwareErrorCodeType, HardwareEthereumTx, HardwareSignRequest, HardwareSignature, HardwareTransport, HardwareWalletConfig, HardwareWalletError, HardwareWalletType, IntentBuilder, IntentError, LedgerConfig, LedgerModel, LedgerWalletAdapter, MockEthereumAdapter, MockEthereumAdapterConfig, MockHardwareConfig, MockLedgerAdapter, MockProofProvider, MockSolanaAdapter, MockSolanaAdapterConfig, MockSolver, MockSolverConfig, MockTrezorAdapter, MockWalletAdapter, NEARIntentsAdapter, NEARIntentsAdapterConfig, NetworkError, ORACLE_DOMAIN, OneClickClient, OracleAttestationMessage, OracleId, OracleInfo, OracleRegistry, OracleRegistryConfig, OracleSignature, OracleStatus, PaymentBuilder, PedersenCommitment, PreparedSwap, PrivacyConfig, ProductionQuote, ProofError, ProofNotImplementedError, ProofProgressCallback, ReceivedNote, SIP, SIPConfig, SIPError, STABLECOIN_ADDRESSES, STABLECOIN_DECIMALS, STABLECOIN_INFO, SerializedError, ShieldedBalance, ShieldedSendParams, ShieldedSendResult, SignedOracleAttestation, SolanaAdapterConfig, SolanaCluster, SolanaConnection, SolanaPublicKey, SolanaSendOptions, SolanaSignature, SolanaTransaction, SolanaUnsignedTransaction, SolanaVersionedTransaction, SolanaWalletAdapter, SolanaWalletName, SolanaWalletProvider, StablecoinInfo, StealthCurve, SwapRequest, SwapResult, TransactionData, TransportType, Treasury, TrezorConfig, TrezorModel, TrezorWalletAdapter, ValidationError, VerificationResult, WalletAdapter, WalletError, ZcashRPCClient, ZcashRPCError, ZcashShieldedService, ZcashShieldedServiceConfig, addBlindings, addCommitments, addOracle, attachProofs, base58ToHex, browserBytesToHex, browserHexToBytes, checkEd25519StealthAddress, checkStealthAddress, commit, commitZero, computeAttestationHash, createCommitment, createEthereumAdapter, createLedgerAdapter, createMockEthereumAdapter, createMockEthereumProvider, createMockLedgerAdapter, createMockSolanaAdapter, createMockSolanaConnection, createMockSolanaProvider, createMockSolver, createMockTrezorAdapter, createNEARIntentsAdapter, createOracleRegistry, createProductionSIP, createSIP, createShieldedIntent, createShieldedPayment, createSolanaAdapter, createTrezorAdapter, createWalletFactory, createZcashClient, createZcashShieldedService, decodeStealthMetaAddress, decryptMemo, decryptWithViewing, deriveEd25519StealthPrivateKey, deriveOracleId, deriveStealthPrivateKey, deriveViewingKey, deserializeAttestationMessage, deserializeIntent, deserializePayment, detectEthereumWallets, detectSolanaWallets, ed25519PublicKeyToNearAddress, ed25519PublicKeyToSolanaAddress, encodeStealthMetaAddress, encryptForViewing, featureNotSupportedError, formatStablecoinAmount, fromHex, fromStablecoinUnits, generateBlinding, generateEd25519StealthAddress, generateEd25519StealthMetaAddress, generateIntentId, generateRandomBytes, generateStealthAddress, generateStealthMetaAddress, generateViewingKey, getActiveOracles, getAvailableTransports, getBrowserInfo, getChainNumericId, getChainsForStablecoin, getCurveForChain, getDefaultRpcEndpoint, getDerivationPath, getErrorMessage, getEthereumProvider, getGenerators, getIntentSummary, getPaymentSummary, getPaymentTimeRemaining, getPrivacyConfig, getPrivacyDescription, getSolanaProvider, getStablecoin, getStablecoinInfo, getStablecoinsForChain, getSupportedStablecoins, getTimeRemaining, hasEnoughOracles, hasErrorCode, hasRequiredProofs, hash, hexToNumber, isBrowser, isEd25519Chain, isExpired, isNonNegativeAmount, isPaymentExpired, isPrivateWalletAdapter, isSIPError, isStablecoin, isStablecoinOnChain, isValidAmount, isValidChainId, isValidCompressedPublicKey, isValidEd25519PublicKey, isValidHex, isValidHexLength, isValidNearAccountId, isValidNearImplicitAddress, isValidPrivacyLevel, isValidPrivateKey, isValidScalar, isValidSlippage, isValidSolanaAddress, isValidStealthMetaAddress, nearAddressToEd25519PublicKey, normalizeAddress, notConnectedError, publicKeyToEthAddress, registerWallet, removeOracle, secureWipe, secureWipeAll, serializeAttestationMessage, serializeIntent, serializePayment, signAttestationMessage, solanaAddressToEd25519PublicKey, solanaPublicKeyToHex, subtractBlindings, subtractCommitments, supportsSharedArrayBuffer, supportsWebBluetooth, supportsWebHID, supportsWebUSB, supportsWebWorkers, toHex, toStablecoinUnits, trackIntent, trackPayment, updateOracleStatus, validateAsset, validateCreateIntentParams, validateIntentInput, validateIntentOutput, validateScalar, validateViewingKey, verifyAttestation, verifyCommitment, verifyOpening, verifyOracleSignature, walletRegistry, withSecureBuffer, withSecureBufferSync, wrapError } from './index.mjs';
|
|
2
|
-
|
|
1
|
+
export { bj as ATTESTATION_VERSION, bv as AttestationRequest, bw as AttestationResult, ct as BaseWalletAdapter, c1 as BridgeProvider, B as BrowserNoirProvider, t as BrowserNoirProviderConfig, bm as CHAIN_NUMERIC_IDS, aM as CommitmentPoint, cs as ComplianceManager, $ as CreateIntentOptions, cp as CreatePaymentOptions, C as CryptoError, bk as DEFAULT_THRESHOLD, bl as DEFAULT_TOTAL_ORACLES, c$ as DerivationPath, dt as EIP1193ConnectInfo, ds as EIP1193Event, dq as EIP1193Provider, du as EIP1193ProviderRpcError, dr as EIP1193RequestArguments, dv as EIP712Domain, dw as EIP712TypeDefinition, dy as EIP712TypedData, dx as EIP712Types, w as EncryptionNotImplementedError, E as ErrorCode, dE as EthereumAdapterConfig, cY as EthereumChainId, dF as EthereumChainIdType, dC as EthereumChainMetadata, dB as EthereumTokenMetadata, dA as EthereumTransactionReceipt, dz as EthereumTransactionRequest, cM as EthereumWalletAdapter, dD as EthereumWalletName, bU as ExportedViewingKey, dT as HardwareAccount, dK as HardwareConnectionStatus, dM as HardwareDeviceInfo, cZ as HardwareErrorCode, dV as HardwareErrorCodeType, dR as HardwareEthereumTx, dQ as HardwareSignRequest, dS as HardwareSignature, dU as HardwareTransport, dN as HardwareWalletConfig, c_ as HardwareWalletError, dH as HardwareWalletType, L as IntentBuilder, I as IntentError, dO as LedgerConfig, dI as LedgerModel, d5 as LedgerWalletAdapter, p as MobileBrowser, q as MobileDeviceInfo, M as MobilePlatform, r as MobileWASMCompatibility, cO as MockEthereumAdapter, dG as MockEthereumAdapterConfig, dW as MockHardwareConfig, d9 as MockLedgerAdapter, b3 as MockProofProvider, cE as MockSolanaAdapter, dp as MockSolanaAdapterConfig, bF as MockSolver, bH as MockSolverConfig, da as MockTrezorAdapter, cu as MockWalletAdapter, bz as NEARIntentsAdapter, bE as NEARIntentsAdapterConfig, N as NetworkError, bi as ORACLE_DOMAIN, by as OneClickClient, bq as OracleAttestationMessage, bn as OracleId, bp as OracleInfo, bt as OracleRegistry, bu as OracleRegistryConfig, br as OracleSignature, bo as OracleStatus, c3 as PaymentBuilder, aL as PedersenCommitment, bC as PreparedSwap, c2 as PriceFeed, ar as PrivacyConfig, K as ProductionQuote, u as ProofError, v as ProofNotImplementedError, P as ProofProgressCallback, bS as ReceivedNote, F as SIP, J as SIPConfig, S as SIPError, cd as STABLECOIN_ADDRESSES, ce as STABLECOIN_DECIMALS, cc as STABLECOIN_INFO, D as SerializedError, bT as ShieldedBalance, bQ as ShieldedSendParams, bR as ShieldedSendResult, bs as SignedOracleAttestation, dj as SolanaAdapterConfig, di as SolanaCluster, dk as SolanaConnection, dd as SolanaPublicKey, dl as SolanaSendOptions, dn as SolanaSignature, de as SolanaTransaction, dm as SolanaUnsignedTransaction, df as SolanaVersionedTransaction, cC as SolanaWalletAdapter, dh as SolanaWalletName, dg as SolanaWalletProvider, cq as StablecoinInfo, ak as StealthCurve, bB as SwapRequest, bD as SwapResult, as as TransactionData, dL as TransportType, cr as Treasury, dP as TrezorConfig, dJ as TrezorModel, d7 as TrezorWalletAdapter, V as ValidationError, bx as VerificationResult, W as WalletAdapter, cv as WalletError, bZ as ZcashQuote, bY as ZcashQuoteParams, bI as ZcashRPCClient, bJ as ZcashRPCError, bL as ZcashShieldedService, bP as ZcashShieldedServiceConfig, b_ as ZcashSwapParams, b$ as ZcashSwapResult, bN as ZcashSwapService, bV as ZcashSwapServiceConfig, bW as ZcashSwapSourceChain, bX as ZcashSwapSourceToken, c0 as ZcashSwapStatus, aH as addBlindings, aF as addCommitments, b9 as addOracle, Q as attachProofs, cL as base58ToHex, b as browserBytesToHex, h as browserHexToBytes, ac as checkEd25519StealthAddress, f as checkMobileWASMCompatibility, a3 as checkStealthAddress, aC as commit, aE as commitZero, bg as computeAttestationHash, at as createCommitment, cN as createEthereumAdapter, d6 as createLedgerAdapter, cP as createMockEthereumAdapter, cQ as createMockEthereumProvider, db as createMockLedgerAdapter, cF as createMockSolanaAdapter, cH as createMockSolanaConnection, cG as createMockSolanaProvider, bG as createMockSolver, dc as createMockTrezorAdapter, bA as createNEARIntentsAdapter, b8 as createOracleRegistry, H as createProductionSIP, G as createSIP, O as createShieldedIntent, c4 as createShieldedPayment, cD as createSolanaAdapter, d8 as createTrezorAdapter, cA as createWalletFactory, bK as createZcashClient, bM as createZcashShieldedService, bO as createZcashSwapService, a5 as decodeStealthMetaAddress, c5 as decryptMemo, ap as decryptWithViewing, ab as deriveEd25519StealthPrivateKey, b7 as deriveOracleId, a2 as deriveStealthPrivateKey, an as deriveViewingKey, bf as deserializeAttestationMessage, Z as deserializeIntent, ca as deserializePayment, cS as detectEthereumWallets, c as detectMobileBrowser, d as detectMobilePlatform, cJ as detectSolanaWallets, ag as ed25519PublicKeyToNearAddress, ad as ed25519PublicKeyToSolanaAddress, a4 as encodeStealthMetaAddress, ao as encryptForViewing, cx as featureNotSupportedError, co as formatStablecoinAmount, cU as fromHex, cn as fromStablecoinUnits, aK as generateBlinding, aa as generateEd25519StealthAddress, a9 as generateEd25519StealthMetaAddress, av as generateIntentId, ax as generateRandomBytes, a1 as generateStealthAddress, a0 as generateStealthMetaAddress, am as generateViewingKey, bc as getActiveOracles, d4 as getAvailableTransports, g as getBrowserInfo, j as getBrowserVersion, bh as getChainNumericId, cl as getChainsForStablecoin, a8 as getCurveForChain, cX as getDefaultRpcEndpoint, d0 as getDerivationPath, A as getErrorMessage, cR as getEthereumProvider, aJ as getGenerators, _ as getIntentSummary, e as getMobileDeviceInfo, k as getOSVersion, cb as getPaymentSummary, c8 as getPaymentTimeRemaining, al as getPrivacyConfig, aq as getPrivacyDescription, cI as getSolanaProvider, cf as getStablecoin, ci as getStablecoinInfo, cg as getStablecoinsForChain, cj as getSupportedStablecoins, X as getTimeRemaining, bd as hasEnoughOracles, y as hasErrorCode, R as hasRequiredProofs, aw as hash, cV as hexToNumber, i as isBrowser, a7 as isEd25519Chain, U as isExpired, aS as isNonNegativeAmount, c7 as isPaymentExpired, cB as isPrivateWalletAdapter, x as isSIPError, ch as isStablecoin, ck as isStablecoinOnChain, l as isTablet, aR as isValidAmount, aN as isValidChainId, aV as isValidCompressedPublicKey, aW as isValidEd25519PublicKey, aP as isValidHex, aQ as isValidHexLength, aj as isValidNearAccountId, ai as isValidNearImplicitAddress, aO as isValidPrivacyLevel, aX as isValidPrivateKey, aY as isValidScalar, aT as isValidSlippage, af as isValidSolanaAddress, aU as isValidStealthMetaAddress, ah as nearAddressToEd25519PublicKey, cW as normalizeAddress, cw as notConnectedError, a6 as publicKeyToEthAddress, cz as registerWallet, ba as removeOracle, ay as secureWipe, az as secureWipeAll, be as serializeAttestationMessage, Y as serializeIntent, c9 as serializePayment, b6 as signAttestationMessage, ae as solanaAddressToEd25519PublicKey, cK as solanaPublicKeyToHex, aI as subtractBlindings, aG as subtractCommitments, a as supportsSharedArrayBuffer, m as supportsTouch, o as supportsWASMBulkMemory, n as supportsWASMSimd, d3 as supportsWebBluetooth, d2 as supportsWebHID, d1 as supportsWebUSB, s as supportsWebWorkers, cT as toHex, cm as toStablecoinUnits, T as trackIntent, c6 as trackPayment, bb as updateOracleStatus, a_ as validateAsset, aZ as validateCreateIntentParams, a$ as validateIntentInput, b0 as validateIntentOutput, b2 as validateScalar, b1 as validateViewingKey, b4 as verifyAttestation, au as verifyCommitment, aD as verifyOpening, b5 as verifyOracleSignature, cy as walletRegistry, aA as withSecureBuffer, aB as withSecureBufferSync, z as wrapError } from './index-CAhjA4kh.mjs';
|
|
2
|
+
import { F as FundingProofParams, V as ValidityProofParams, a as FulfillmentProofParams, P as ProofResult } from './noir-BTyLXLlZ.mjs';
|
|
3
|
+
export { N as NoirProviderConfig, O as OracleAttestation, d as ProofFramework, b as ProofGenerationError, c as ProofProvider } from './noir-BTyLXLlZ.mjs';
|
|
3
4
|
export { Asset, AuditLogEntry, AuditScope, AuditorRegistration, AuditorViewingKey, BatchPaymentRecipient, BatchPaymentRequest, ChainId, Commitment, ComplianceConfig, ComplianceReport, ComplianceRole, CreateBatchProposalParams, CreateComplianceConfigParams, CreateIntentParams, CreatePaymentParams, CreatePaymentProposalParams, CreateTreasuryParams, DefuseAssetId, DisclosedTransaction, DisclosureRequest, FulfillmentCommitment, FulfillmentProof, FulfillmentRequest, FulfillmentResult, FulfillmentStatus, GenerateReportParams, Hash, HexString, WalletAdapter as IWalletAdapter, IntentStatus, NATIVE_TOKENS, OneClickConfig, OneClickDepositMode, OneClickErrorCode, OneClickQuoteRequest, OneClickQuoteResponse, OneClickStatusResponse, OneClickSwapStatus, OneClickSwapType, PaymentPurpose, PaymentReceipt, PaymentStatus, PaymentStatusType, PrivacyLevel, PrivateWalletAdapter, ProposalSignature, ProposalStatus, ProposalStatusType, ProposalType, Quote, RegisterAuditorParams, ReportData, ReportFormat, ReportStatus, ReportStatusType, ReportType, SIPSolver, SIP_VERSION, ShieldedIntent, ShieldedPayment, Signature, SignedTransaction, Solver, SolverCapabilities, SolverEvent, SolverEventListener, SolverQuote, SolverVisibleIntent, StablecoinSymbol, StealthAddress, StealthAddressRecovery, StealthMetaAddress, SwapRoute, SwapRouteStep, TrackedIntent, TrackedPayment, TransactionReceipt, TreasuryBalance, TreasuryConfig, TreasuryMember, TreasuryProposal, TreasuryRole, TreasuryTransaction, UnsignedTransaction, ViewingKey, WalletAccountChangedEvent, WalletAdapterFactory, WalletChainChangedEvent, WalletConnectEvent, WalletConnectionState, WalletDisconnectEvent, WalletErrorCode, WalletErrorEvent, WalletEvent, WalletEventHandler, WalletEventType, WalletInfo, WalletRegistryEntry, WalletShieldedSendParams, WalletShieldedSendResult, ZKProof, ZcashAccountAddress, ZcashAccountBalance, ZcashAddressInfo, ZcashAddressType, ZcashBlock, ZcashBlockHeader, ZcashBlockchainInfo, ZcashConfig, ZcashErrorCode, ZcashNetwork, ZcashNetworkInfo, ZcashNewAccount, ZcashOperation, ZcashOperationError, ZcashOperationStatus, ZcashOperationTxResult, ZcashPool, ZcashPoolBalance, ZcashPrivacyPolicy, ZcashReceiverType, ZcashSendRecipient, ZcashShieldedSendParams, ZcashUnspentNote, isPrivate, supportsViewingKey } from '@sip-protocol/types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Proof Generation Web Worker
|
|
8
|
+
*
|
|
9
|
+
* Runs proof generation off the main thread to keep UI responsive.
|
|
10
|
+
* Communicates via postMessage with the main thread.
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/sip-protocol/sip-protocol/issues/140
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
type WorkerMessageType = 'init' | 'generateFundingProof' | 'generateValidityProof' | 'generateFulfillmentProof' | 'destroy';
|
|
16
|
+
interface WorkerRequest {
|
|
17
|
+
id: string;
|
|
18
|
+
type: WorkerMessageType;
|
|
19
|
+
params?: FundingProofParams | ValidityProofParams | FulfillmentProofParams;
|
|
20
|
+
config?: {
|
|
21
|
+
verbose?: boolean;
|
|
22
|
+
oraclePublicKey?: {
|
|
23
|
+
x: number[];
|
|
24
|
+
y: number[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface WorkerResponse {
|
|
29
|
+
id: string;
|
|
30
|
+
type: 'success' | 'error' | 'progress';
|
|
31
|
+
result?: ProofResult;
|
|
32
|
+
error?: string;
|
|
33
|
+
progress?: {
|
|
34
|
+
stage: string;
|
|
35
|
+
percent: number;
|
|
36
|
+
message: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create inline worker code as a blob URL
|
|
41
|
+
* This approach works with most bundlers without special configuration
|
|
42
|
+
*/
|
|
43
|
+
declare function createWorkerBlobURL(): string;
|
|
44
|
+
/**
|
|
45
|
+
* ProofWorker class for managing Web Worker proof generation
|
|
46
|
+
*
|
|
47
|
+
* Provides a clean API for generating proofs in a Web Worker,
|
|
48
|
+
* with progress callbacks and automatic fallback to main thread.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const worker = new ProofWorker()
|
|
53
|
+
* await worker.initialize()
|
|
54
|
+
*
|
|
55
|
+
* const result = await worker.generateProof('funding', params, (progress) => {
|
|
56
|
+
* console.log(`${progress.stage}: ${progress.percent}%`)
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare class ProofWorker {
|
|
61
|
+
private worker;
|
|
62
|
+
private pendingRequests;
|
|
63
|
+
private _isReady;
|
|
64
|
+
private requestCounter;
|
|
65
|
+
/**
|
|
66
|
+
* Check if Web Workers are supported
|
|
67
|
+
*/
|
|
68
|
+
static isSupported(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Check if worker is initialized and ready
|
|
71
|
+
*/
|
|
72
|
+
get isReady(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Initialize the worker
|
|
75
|
+
*/
|
|
76
|
+
initialize(config?: {
|
|
77
|
+
verbose?: boolean;
|
|
78
|
+
oraclePublicKey?: {
|
|
79
|
+
x: number[];
|
|
80
|
+
y: number[];
|
|
81
|
+
};
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Generate a proof using the worker
|
|
85
|
+
*/
|
|
86
|
+
generateProof(type: 'funding' | 'validity' | 'fulfillment', params: FundingProofParams | ValidityProofParams | FulfillmentProofParams, onProgress?: (progress: NonNullable<WorkerResponse['progress']>) => void): Promise<ProofResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Destroy the worker and free resources
|
|
89
|
+
*/
|
|
90
|
+
destroy(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Send a request to the worker
|
|
93
|
+
*/
|
|
94
|
+
private sendRequest;
|
|
95
|
+
/**
|
|
96
|
+
* Handle messages from the worker
|
|
97
|
+
*/
|
|
98
|
+
private handleWorkerMessage;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { FulfillmentProofParams, FundingProofParams, ProofResult, ProofWorker, ValidityProofParams, type WorkerMessageType, type WorkerRequest, type WorkerResponse, createWorkerBlobURL };
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
-
export { ATTESTATION_VERSION, AttestationRequest, AttestationResult, BaseWalletAdapter, B as BrowserNoirProvider, BrowserNoirProviderConfig, CHAIN_NUMERIC_IDS, CommitmentPoint, ComplianceManager, CreateIntentOptions, CreatePaymentOptions, CryptoError, DEFAULT_THRESHOLD, DEFAULT_TOTAL_ORACLES, DerivationPath, EIP1193ConnectInfo, EIP1193Event, EIP1193Provider, EIP1193ProviderRpcError, EIP1193RequestArguments, EIP712Domain, EIP712TypeDefinition, EIP712TypedData, EIP712Types, EncryptionNotImplementedError, ErrorCode, EthereumAdapterConfig, EthereumChainId, EthereumChainIdType, EthereumChainMetadata, EthereumTokenMetadata, EthereumTransactionReceipt, EthereumTransactionRequest, EthereumWalletAdapter, EthereumWalletName, ExportedViewingKey, HardwareAccount, HardwareConnectionStatus, HardwareDeviceInfo, HardwareErrorCode, HardwareErrorCodeType, HardwareEthereumTx, HardwareSignRequest, HardwareSignature, HardwareTransport, HardwareWalletConfig, HardwareWalletError, HardwareWalletType, IntentBuilder, IntentError, LedgerConfig, LedgerModel, LedgerWalletAdapter, MockEthereumAdapter, MockEthereumAdapterConfig, MockHardwareConfig, MockLedgerAdapter, MockProofProvider, MockSolanaAdapter, MockSolanaAdapterConfig, MockSolver, MockSolverConfig, MockTrezorAdapter, MockWalletAdapter, NEARIntentsAdapter, NEARIntentsAdapterConfig, NetworkError, ORACLE_DOMAIN, OneClickClient, OracleAttestationMessage, OracleId, OracleInfo, OracleRegistry, OracleRegistryConfig, OracleSignature, OracleStatus, PaymentBuilder, PedersenCommitment, PreparedSwap, PrivacyConfig, ProductionQuote, ProofError, ProofNotImplementedError, ProofProgressCallback, ReceivedNote, SIP, SIPConfig, SIPError, STABLECOIN_ADDRESSES, STABLECOIN_DECIMALS, STABLECOIN_INFO, SerializedError, ShieldedBalance, ShieldedSendParams, ShieldedSendResult, SignedOracleAttestation, SolanaAdapterConfig, SolanaCluster, SolanaConnection, SolanaPublicKey, SolanaSendOptions, SolanaSignature, SolanaTransaction, SolanaUnsignedTransaction, SolanaVersionedTransaction, SolanaWalletAdapter, SolanaWalletName, SolanaWalletProvider, StablecoinInfo, StealthCurve, SwapRequest, SwapResult, TransactionData, TransportType, Treasury, TrezorConfig, TrezorModel, TrezorWalletAdapter, ValidationError, VerificationResult, WalletAdapter, WalletError, ZcashRPCClient, ZcashRPCError, ZcashShieldedService, ZcashShieldedServiceConfig, addBlindings, addCommitments, addOracle, attachProofs, base58ToHex, browserBytesToHex, browserHexToBytes, checkEd25519StealthAddress, checkStealthAddress, commit, commitZero, computeAttestationHash, createCommitment, createEthereumAdapter, createLedgerAdapter, createMockEthereumAdapter, createMockEthereumProvider, createMockLedgerAdapter, createMockSolanaAdapter, createMockSolanaConnection, createMockSolanaProvider, createMockSolver, createMockTrezorAdapter, createNEARIntentsAdapter, createOracleRegistry, createProductionSIP, createSIP, createShieldedIntent, createShieldedPayment, createSolanaAdapter, createTrezorAdapter, createWalletFactory, createZcashClient, createZcashShieldedService, decodeStealthMetaAddress, decryptMemo, decryptWithViewing, deriveEd25519StealthPrivateKey, deriveOracleId, deriveStealthPrivateKey, deriveViewingKey, deserializeAttestationMessage, deserializeIntent, deserializePayment, detectEthereumWallets, detectSolanaWallets, ed25519PublicKeyToNearAddress, ed25519PublicKeyToSolanaAddress, encodeStealthMetaAddress, encryptForViewing, featureNotSupportedError, formatStablecoinAmount, fromHex, fromStablecoinUnits, generateBlinding, generateEd25519StealthAddress, generateEd25519StealthMetaAddress, generateIntentId, generateRandomBytes, generateStealthAddress, generateStealthMetaAddress, generateViewingKey, getActiveOracles, getAvailableTransports, getBrowserInfo, getChainNumericId, getChainsForStablecoin, getCurveForChain, getDefaultRpcEndpoint, getDerivationPath, getErrorMessage, getEthereumProvider, getGenerators, getIntentSummary, getPaymentSummary, getPaymentTimeRemaining, getPrivacyConfig, getPrivacyDescription, getSolanaProvider, getStablecoin, getStablecoinInfo, getStablecoinsForChain, getSupportedStablecoins, getTimeRemaining, hasEnoughOracles, hasErrorCode, hasRequiredProofs, hash, hexToNumber, isBrowser, isEd25519Chain, isExpired, isNonNegativeAmount, isPaymentExpired, isPrivateWalletAdapter, isSIPError, isStablecoin, isStablecoinOnChain, isValidAmount, isValidChainId, isValidCompressedPublicKey, isValidEd25519PublicKey, isValidHex, isValidHexLength, isValidNearAccountId, isValidNearImplicitAddress, isValidPrivacyLevel, isValidPrivateKey, isValidScalar, isValidSlippage, isValidSolanaAddress, isValidStealthMetaAddress, nearAddressToEd25519PublicKey, normalizeAddress, notConnectedError, publicKeyToEthAddress, registerWallet, removeOracle, secureWipe, secureWipeAll, serializeAttestationMessage, serializeIntent, serializePayment, signAttestationMessage, solanaAddressToEd25519PublicKey, solanaPublicKeyToHex, subtractBlindings, subtractCommitments, supportsSharedArrayBuffer, supportsWebBluetooth, supportsWebHID, supportsWebUSB, supportsWebWorkers, toHex, toStablecoinUnits, trackIntent, trackPayment, updateOracleStatus, validateAsset, validateCreateIntentParams, validateIntentInput, validateIntentOutput, validateScalar, validateViewingKey, verifyAttestation, verifyCommitment, verifyOpening, verifyOracleSignature, walletRegistry, withSecureBuffer, withSecureBufferSync, wrapError } from './index.js';
|
|
2
|
-
|
|
1
|
+
export { bj as ATTESTATION_VERSION, bv as AttestationRequest, bw as AttestationResult, ct as BaseWalletAdapter, c1 as BridgeProvider, B as BrowserNoirProvider, t as BrowserNoirProviderConfig, bm as CHAIN_NUMERIC_IDS, aM as CommitmentPoint, cs as ComplianceManager, $ as CreateIntentOptions, cp as CreatePaymentOptions, C as CryptoError, bk as DEFAULT_THRESHOLD, bl as DEFAULT_TOTAL_ORACLES, c$ as DerivationPath, dt as EIP1193ConnectInfo, ds as EIP1193Event, dq as EIP1193Provider, du as EIP1193ProviderRpcError, dr as EIP1193RequestArguments, dv as EIP712Domain, dw as EIP712TypeDefinition, dy as EIP712TypedData, dx as EIP712Types, w as EncryptionNotImplementedError, E as ErrorCode, dE as EthereumAdapterConfig, cY as EthereumChainId, dF as EthereumChainIdType, dC as EthereumChainMetadata, dB as EthereumTokenMetadata, dA as EthereumTransactionReceipt, dz as EthereumTransactionRequest, cM as EthereumWalletAdapter, dD as EthereumWalletName, bU as ExportedViewingKey, dT as HardwareAccount, dK as HardwareConnectionStatus, dM as HardwareDeviceInfo, cZ as HardwareErrorCode, dV as HardwareErrorCodeType, dR as HardwareEthereumTx, dQ as HardwareSignRequest, dS as HardwareSignature, dU as HardwareTransport, dN as HardwareWalletConfig, c_ as HardwareWalletError, dH as HardwareWalletType, L as IntentBuilder, I as IntentError, dO as LedgerConfig, dI as LedgerModel, d5 as LedgerWalletAdapter, p as MobileBrowser, q as MobileDeviceInfo, M as MobilePlatform, r as MobileWASMCompatibility, cO as MockEthereumAdapter, dG as MockEthereumAdapterConfig, dW as MockHardwareConfig, d9 as MockLedgerAdapter, b3 as MockProofProvider, cE as MockSolanaAdapter, dp as MockSolanaAdapterConfig, bF as MockSolver, bH as MockSolverConfig, da as MockTrezorAdapter, cu as MockWalletAdapter, bz as NEARIntentsAdapter, bE as NEARIntentsAdapterConfig, N as NetworkError, bi as ORACLE_DOMAIN, by as OneClickClient, bq as OracleAttestationMessage, bn as OracleId, bp as OracleInfo, bt as OracleRegistry, bu as OracleRegistryConfig, br as OracleSignature, bo as OracleStatus, c3 as PaymentBuilder, aL as PedersenCommitment, bC as PreparedSwap, c2 as PriceFeed, ar as PrivacyConfig, K as ProductionQuote, u as ProofError, v as ProofNotImplementedError, P as ProofProgressCallback, bS as ReceivedNote, F as SIP, J as SIPConfig, S as SIPError, cd as STABLECOIN_ADDRESSES, ce as STABLECOIN_DECIMALS, cc as STABLECOIN_INFO, D as SerializedError, bT as ShieldedBalance, bQ as ShieldedSendParams, bR as ShieldedSendResult, bs as SignedOracleAttestation, dj as SolanaAdapterConfig, di as SolanaCluster, dk as SolanaConnection, dd as SolanaPublicKey, dl as SolanaSendOptions, dn as SolanaSignature, de as SolanaTransaction, dm as SolanaUnsignedTransaction, df as SolanaVersionedTransaction, cC as SolanaWalletAdapter, dh as SolanaWalletName, dg as SolanaWalletProvider, cq as StablecoinInfo, ak as StealthCurve, bB as SwapRequest, bD as SwapResult, as as TransactionData, dL as TransportType, cr as Treasury, dP as TrezorConfig, dJ as TrezorModel, d7 as TrezorWalletAdapter, V as ValidationError, bx as VerificationResult, W as WalletAdapter, cv as WalletError, bZ as ZcashQuote, bY as ZcashQuoteParams, bI as ZcashRPCClient, bJ as ZcashRPCError, bL as ZcashShieldedService, bP as ZcashShieldedServiceConfig, b_ as ZcashSwapParams, b$ as ZcashSwapResult, bN as ZcashSwapService, bV as ZcashSwapServiceConfig, bW as ZcashSwapSourceChain, bX as ZcashSwapSourceToken, c0 as ZcashSwapStatus, aH as addBlindings, aF as addCommitments, b9 as addOracle, Q as attachProofs, cL as base58ToHex, b as browserBytesToHex, h as browserHexToBytes, ac as checkEd25519StealthAddress, f as checkMobileWASMCompatibility, a3 as checkStealthAddress, aC as commit, aE as commitZero, bg as computeAttestationHash, at as createCommitment, cN as createEthereumAdapter, d6 as createLedgerAdapter, cP as createMockEthereumAdapter, cQ as createMockEthereumProvider, db as createMockLedgerAdapter, cF as createMockSolanaAdapter, cH as createMockSolanaConnection, cG as createMockSolanaProvider, bG as createMockSolver, dc as createMockTrezorAdapter, bA as createNEARIntentsAdapter, b8 as createOracleRegistry, H as createProductionSIP, G as createSIP, O as createShieldedIntent, c4 as createShieldedPayment, cD as createSolanaAdapter, d8 as createTrezorAdapter, cA as createWalletFactory, bK as createZcashClient, bM as createZcashShieldedService, bO as createZcashSwapService, a5 as decodeStealthMetaAddress, c5 as decryptMemo, ap as decryptWithViewing, ab as deriveEd25519StealthPrivateKey, b7 as deriveOracleId, a2 as deriveStealthPrivateKey, an as deriveViewingKey, bf as deserializeAttestationMessage, Z as deserializeIntent, ca as deserializePayment, cS as detectEthereumWallets, c as detectMobileBrowser, d as detectMobilePlatform, cJ as detectSolanaWallets, ag as ed25519PublicKeyToNearAddress, ad as ed25519PublicKeyToSolanaAddress, a4 as encodeStealthMetaAddress, ao as encryptForViewing, cx as featureNotSupportedError, co as formatStablecoinAmount, cU as fromHex, cn as fromStablecoinUnits, aK as generateBlinding, aa as generateEd25519StealthAddress, a9 as generateEd25519StealthMetaAddress, av as generateIntentId, ax as generateRandomBytes, a1 as generateStealthAddress, a0 as generateStealthMetaAddress, am as generateViewingKey, bc as getActiveOracles, d4 as getAvailableTransports, g as getBrowserInfo, j as getBrowserVersion, bh as getChainNumericId, cl as getChainsForStablecoin, a8 as getCurveForChain, cX as getDefaultRpcEndpoint, d0 as getDerivationPath, A as getErrorMessage, cR as getEthereumProvider, aJ as getGenerators, _ as getIntentSummary, e as getMobileDeviceInfo, k as getOSVersion, cb as getPaymentSummary, c8 as getPaymentTimeRemaining, al as getPrivacyConfig, aq as getPrivacyDescription, cI as getSolanaProvider, cf as getStablecoin, ci as getStablecoinInfo, cg as getStablecoinsForChain, cj as getSupportedStablecoins, X as getTimeRemaining, bd as hasEnoughOracles, y as hasErrorCode, R as hasRequiredProofs, aw as hash, cV as hexToNumber, i as isBrowser, a7 as isEd25519Chain, U as isExpired, aS as isNonNegativeAmount, c7 as isPaymentExpired, cB as isPrivateWalletAdapter, x as isSIPError, ch as isStablecoin, ck as isStablecoinOnChain, l as isTablet, aR as isValidAmount, aN as isValidChainId, aV as isValidCompressedPublicKey, aW as isValidEd25519PublicKey, aP as isValidHex, aQ as isValidHexLength, aj as isValidNearAccountId, ai as isValidNearImplicitAddress, aO as isValidPrivacyLevel, aX as isValidPrivateKey, aY as isValidScalar, aT as isValidSlippage, af as isValidSolanaAddress, aU as isValidStealthMetaAddress, ah as nearAddressToEd25519PublicKey, cW as normalizeAddress, cw as notConnectedError, a6 as publicKeyToEthAddress, cz as registerWallet, ba as removeOracle, ay as secureWipe, az as secureWipeAll, be as serializeAttestationMessage, Y as serializeIntent, c9 as serializePayment, b6 as signAttestationMessage, ae as solanaAddressToEd25519PublicKey, cK as solanaPublicKeyToHex, aI as subtractBlindings, aG as subtractCommitments, a as supportsSharedArrayBuffer, m as supportsTouch, o as supportsWASMBulkMemory, n as supportsWASMSimd, d3 as supportsWebBluetooth, d2 as supportsWebHID, d1 as supportsWebUSB, s as supportsWebWorkers, cT as toHex, cm as toStablecoinUnits, T as trackIntent, c6 as trackPayment, bb as updateOracleStatus, a_ as validateAsset, aZ as validateCreateIntentParams, a$ as validateIntentInput, b0 as validateIntentOutput, b2 as validateScalar, b1 as validateViewingKey, b4 as verifyAttestation, au as verifyCommitment, aD as verifyOpening, b5 as verifyOracleSignature, cy as walletRegistry, aA as withSecureBuffer, aB as withSecureBufferSync, z as wrapError } from './index-BFOKTz2z.js';
|
|
2
|
+
import { F as FundingProofParams, V as ValidityProofParams, a as FulfillmentProofParams, P as ProofResult } from './noir-BTyLXLlZ.js';
|
|
3
|
+
export { N as NoirProviderConfig, O as OracleAttestation, d as ProofFramework, b as ProofGenerationError, c as ProofProvider } from './noir-BTyLXLlZ.js';
|
|
3
4
|
export { Asset, AuditLogEntry, AuditScope, AuditorRegistration, AuditorViewingKey, BatchPaymentRecipient, BatchPaymentRequest, ChainId, Commitment, ComplianceConfig, ComplianceReport, ComplianceRole, CreateBatchProposalParams, CreateComplianceConfigParams, CreateIntentParams, CreatePaymentParams, CreatePaymentProposalParams, CreateTreasuryParams, DefuseAssetId, DisclosedTransaction, DisclosureRequest, FulfillmentCommitment, FulfillmentProof, FulfillmentRequest, FulfillmentResult, FulfillmentStatus, GenerateReportParams, Hash, HexString, WalletAdapter as IWalletAdapter, IntentStatus, NATIVE_TOKENS, OneClickConfig, OneClickDepositMode, OneClickErrorCode, OneClickQuoteRequest, OneClickQuoteResponse, OneClickStatusResponse, OneClickSwapStatus, OneClickSwapType, PaymentPurpose, PaymentReceipt, PaymentStatus, PaymentStatusType, PrivacyLevel, PrivateWalletAdapter, ProposalSignature, ProposalStatus, ProposalStatusType, ProposalType, Quote, RegisterAuditorParams, ReportData, ReportFormat, ReportStatus, ReportStatusType, ReportType, SIPSolver, SIP_VERSION, ShieldedIntent, ShieldedPayment, Signature, SignedTransaction, Solver, SolverCapabilities, SolverEvent, SolverEventListener, SolverQuote, SolverVisibleIntent, StablecoinSymbol, StealthAddress, StealthAddressRecovery, StealthMetaAddress, SwapRoute, SwapRouteStep, TrackedIntent, TrackedPayment, TransactionReceipt, TreasuryBalance, TreasuryConfig, TreasuryMember, TreasuryProposal, TreasuryRole, TreasuryTransaction, UnsignedTransaction, ViewingKey, WalletAccountChangedEvent, WalletAdapterFactory, WalletChainChangedEvent, WalletConnectEvent, WalletConnectionState, WalletDisconnectEvent, WalletErrorCode, WalletErrorEvent, WalletEvent, WalletEventHandler, WalletEventType, WalletInfo, WalletRegistryEntry, WalletShieldedSendParams, WalletShieldedSendResult, ZKProof, ZcashAccountAddress, ZcashAccountBalance, ZcashAddressInfo, ZcashAddressType, ZcashBlock, ZcashBlockHeader, ZcashBlockchainInfo, ZcashConfig, ZcashErrorCode, ZcashNetwork, ZcashNetworkInfo, ZcashNewAccount, ZcashOperation, ZcashOperationError, ZcashOperationStatus, ZcashOperationTxResult, ZcashPool, ZcashPoolBalance, ZcashPrivacyPolicy, ZcashReceiverType, ZcashSendRecipient, ZcashShieldedSendParams, ZcashUnspentNote, isPrivate, supportsViewingKey } from '@sip-protocol/types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Proof Generation Web Worker
|
|
8
|
+
*
|
|
9
|
+
* Runs proof generation off the main thread to keep UI responsive.
|
|
10
|
+
* Communicates via postMessage with the main thread.
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/sip-protocol/sip-protocol/issues/140
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
type WorkerMessageType = 'init' | 'generateFundingProof' | 'generateValidityProof' | 'generateFulfillmentProof' | 'destroy';
|
|
16
|
+
interface WorkerRequest {
|
|
17
|
+
id: string;
|
|
18
|
+
type: WorkerMessageType;
|
|
19
|
+
params?: FundingProofParams | ValidityProofParams | FulfillmentProofParams;
|
|
20
|
+
config?: {
|
|
21
|
+
verbose?: boolean;
|
|
22
|
+
oraclePublicKey?: {
|
|
23
|
+
x: number[];
|
|
24
|
+
y: number[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface WorkerResponse {
|
|
29
|
+
id: string;
|
|
30
|
+
type: 'success' | 'error' | 'progress';
|
|
31
|
+
result?: ProofResult;
|
|
32
|
+
error?: string;
|
|
33
|
+
progress?: {
|
|
34
|
+
stage: string;
|
|
35
|
+
percent: number;
|
|
36
|
+
message: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create inline worker code as a blob URL
|
|
41
|
+
* This approach works with most bundlers without special configuration
|
|
42
|
+
*/
|
|
43
|
+
declare function createWorkerBlobURL(): string;
|
|
44
|
+
/**
|
|
45
|
+
* ProofWorker class for managing Web Worker proof generation
|
|
46
|
+
*
|
|
47
|
+
* Provides a clean API for generating proofs in a Web Worker,
|
|
48
|
+
* with progress callbacks and automatic fallback to main thread.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const worker = new ProofWorker()
|
|
53
|
+
* await worker.initialize()
|
|
54
|
+
*
|
|
55
|
+
* const result = await worker.generateProof('funding', params, (progress) => {
|
|
56
|
+
* console.log(`${progress.stage}: ${progress.percent}%`)
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare class ProofWorker {
|
|
61
|
+
private worker;
|
|
62
|
+
private pendingRequests;
|
|
63
|
+
private _isReady;
|
|
64
|
+
private requestCounter;
|
|
65
|
+
/**
|
|
66
|
+
* Check if Web Workers are supported
|
|
67
|
+
*/
|
|
68
|
+
static isSupported(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Check if worker is initialized and ready
|
|
71
|
+
*/
|
|
72
|
+
get isReady(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Initialize the worker
|
|
75
|
+
*/
|
|
76
|
+
initialize(config?: {
|
|
77
|
+
verbose?: boolean;
|
|
78
|
+
oraclePublicKey?: {
|
|
79
|
+
x: number[];
|
|
80
|
+
y: number[];
|
|
81
|
+
};
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Generate a proof using the worker
|
|
85
|
+
*/
|
|
86
|
+
generateProof(type: 'funding' | 'validity' | 'fulfillment', params: FundingProofParams | ValidityProofParams | FulfillmentProofParams, onProgress?: (progress: NonNullable<WorkerResponse['progress']>) => void): Promise<ProofResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Destroy the worker and free resources
|
|
89
|
+
*/
|
|
90
|
+
destroy(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Send a request to the worker
|
|
93
|
+
*/
|
|
94
|
+
private sendRequest;
|
|
95
|
+
/**
|
|
96
|
+
* Handle messages from the worker
|
|
97
|
+
*/
|
|
98
|
+
private handleWorkerMessage;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { FulfillmentProofParams, FundingProofParams, ProofResult, ProofWorker, ValidityProofParams, type WorkerMessageType, type WorkerRequest, type WorkerResponse, createWorkerBlobURL };
|