@sip-protocol/sdk 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/browser.d.mts +2 -0
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +12925 -0
- package/dist/browser.mjs +432 -0
- package/dist/chunk-O4Y2ZUDL.mjs +12721 -0
- package/dist/index.d.mts +800 -91
- package/dist/index.d.ts +800 -91
- package/dist/index.js +1855 -376
- package/dist/index.mjs +262 -11111
- package/package.json +23 -14
- package/src/adapters/near-intents.ts +139 -22
- package/src/browser.ts +33 -0
- package/src/commitment.ts +4 -4
- package/src/index.ts +71 -0
- package/src/oracle/index.ts +12 -0
- package/src/oracle/serialization.ts +237 -0
- package/src/oracle/types.ts +257 -0
- package/src/oracle/verification.ts +257 -0
- package/src/proofs/browser-utils.ts +141 -0
- package/src/proofs/browser.ts +884 -0
- package/src/proofs/index.ts +14 -0
- package/src/stealth.ts +868 -12
- package/src/validation.ts +7 -0
package/dist/browser.mjs
ADDED
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ATTESTATION_VERSION,
|
|
3
|
+
BaseWalletAdapter,
|
|
4
|
+
BrowserNoirProvider,
|
|
5
|
+
CHAIN_NUMERIC_IDS,
|
|
6
|
+
ComplianceManager,
|
|
7
|
+
CryptoError,
|
|
8
|
+
DEFAULT_THRESHOLD,
|
|
9
|
+
DEFAULT_TOTAL_ORACLES,
|
|
10
|
+
DerivationPath,
|
|
11
|
+
EncryptionNotImplementedError,
|
|
12
|
+
ErrorCode,
|
|
13
|
+
EthereumChainId,
|
|
14
|
+
EthereumWalletAdapter,
|
|
15
|
+
HardwareErrorCode,
|
|
16
|
+
HardwareWalletError,
|
|
17
|
+
IntentBuilder,
|
|
18
|
+
IntentError,
|
|
19
|
+
IntentStatus,
|
|
20
|
+
LedgerWalletAdapter,
|
|
21
|
+
MockEthereumAdapter,
|
|
22
|
+
MockLedgerAdapter,
|
|
23
|
+
MockProofProvider,
|
|
24
|
+
MockSolanaAdapter,
|
|
25
|
+
MockSolver,
|
|
26
|
+
MockTrezorAdapter,
|
|
27
|
+
MockWalletAdapter,
|
|
28
|
+
NATIVE_TOKENS,
|
|
29
|
+
NEARIntentsAdapter,
|
|
30
|
+
NetworkError,
|
|
31
|
+
NoirProofProvider,
|
|
32
|
+
ORACLE_DOMAIN,
|
|
33
|
+
OneClickClient,
|
|
34
|
+
OneClickDepositMode,
|
|
35
|
+
OneClickErrorCode,
|
|
36
|
+
OneClickSwapStatus,
|
|
37
|
+
OneClickSwapType,
|
|
38
|
+
PaymentBuilder,
|
|
39
|
+
PaymentStatus,
|
|
40
|
+
PrivacyLevel,
|
|
41
|
+
ProofError,
|
|
42
|
+
ProofGenerationError,
|
|
43
|
+
ProofNotImplementedError,
|
|
44
|
+
ProposalStatus,
|
|
45
|
+
ReportStatus,
|
|
46
|
+
SIP,
|
|
47
|
+
SIPError,
|
|
48
|
+
SIP_VERSION,
|
|
49
|
+
STABLECOIN_ADDRESSES,
|
|
50
|
+
STABLECOIN_DECIMALS,
|
|
51
|
+
STABLECOIN_INFO,
|
|
52
|
+
SolanaWalletAdapter,
|
|
53
|
+
Treasury,
|
|
54
|
+
TrezorWalletAdapter,
|
|
55
|
+
ValidationError,
|
|
56
|
+
WalletError,
|
|
57
|
+
WalletErrorCode,
|
|
58
|
+
ZcashErrorCode,
|
|
59
|
+
ZcashRPCClient,
|
|
60
|
+
ZcashRPCError,
|
|
61
|
+
ZcashShieldedService,
|
|
62
|
+
addBlindings,
|
|
63
|
+
addCommitments,
|
|
64
|
+
addOracle,
|
|
65
|
+
attachProofs,
|
|
66
|
+
base58ToHex,
|
|
67
|
+
bytesToHex,
|
|
68
|
+
checkEd25519StealthAddress,
|
|
69
|
+
checkStealthAddress,
|
|
70
|
+
commit,
|
|
71
|
+
commitZero,
|
|
72
|
+
computeAttestationHash,
|
|
73
|
+
createCommitment,
|
|
74
|
+
createEthereumAdapter,
|
|
75
|
+
createLedgerAdapter,
|
|
76
|
+
createMockEthereumAdapter,
|
|
77
|
+
createMockEthereumProvider,
|
|
78
|
+
createMockLedgerAdapter,
|
|
79
|
+
createMockSolanaAdapter,
|
|
80
|
+
createMockSolanaConnection,
|
|
81
|
+
createMockSolanaProvider,
|
|
82
|
+
createMockSolver,
|
|
83
|
+
createMockTrezorAdapter,
|
|
84
|
+
createNEARIntentsAdapter,
|
|
85
|
+
createOracleRegistry,
|
|
86
|
+
createProductionSIP,
|
|
87
|
+
createSIP,
|
|
88
|
+
createShieldedIntent,
|
|
89
|
+
createShieldedPayment,
|
|
90
|
+
createSolanaAdapter,
|
|
91
|
+
createTrezorAdapter,
|
|
92
|
+
createWalletFactory,
|
|
93
|
+
createZcashClient,
|
|
94
|
+
createZcashShieldedService,
|
|
95
|
+
decodeStealthMetaAddress,
|
|
96
|
+
decryptMemo,
|
|
97
|
+
decryptWithViewing,
|
|
98
|
+
deriveEd25519StealthPrivateKey,
|
|
99
|
+
deriveOracleId,
|
|
100
|
+
deriveStealthPrivateKey,
|
|
101
|
+
deriveViewingKey,
|
|
102
|
+
deserializeAttestationMessage,
|
|
103
|
+
deserializeIntent,
|
|
104
|
+
deserializePayment,
|
|
105
|
+
detectEthereumWallets,
|
|
106
|
+
detectSolanaWallets,
|
|
107
|
+
ed25519PublicKeyToNearAddress,
|
|
108
|
+
ed25519PublicKeyToSolanaAddress,
|
|
109
|
+
encodeStealthMetaAddress,
|
|
110
|
+
encryptForViewing,
|
|
111
|
+
featureNotSupportedError,
|
|
112
|
+
formatStablecoinAmount,
|
|
113
|
+
fromHex,
|
|
114
|
+
fromStablecoinUnits,
|
|
115
|
+
generateBlinding,
|
|
116
|
+
generateEd25519StealthAddress,
|
|
117
|
+
generateEd25519StealthMetaAddress,
|
|
118
|
+
generateIntentId,
|
|
119
|
+
generateRandomBytes,
|
|
120
|
+
generateStealthAddress,
|
|
121
|
+
generateStealthMetaAddress,
|
|
122
|
+
generateViewingKey,
|
|
123
|
+
getActiveOracles,
|
|
124
|
+
getAvailableTransports,
|
|
125
|
+
getBrowserInfo,
|
|
126
|
+
getChainNumericId,
|
|
127
|
+
getChainsForStablecoin,
|
|
128
|
+
getCurveForChain,
|
|
129
|
+
getDefaultRpcEndpoint,
|
|
130
|
+
getDerivationPath,
|
|
131
|
+
getErrorMessage,
|
|
132
|
+
getEthereumProvider,
|
|
133
|
+
getGenerators,
|
|
134
|
+
getIntentSummary,
|
|
135
|
+
getPaymentSummary,
|
|
136
|
+
getPaymentTimeRemaining,
|
|
137
|
+
getPrivacyConfig,
|
|
138
|
+
getPrivacyDescription,
|
|
139
|
+
getSolanaProvider,
|
|
140
|
+
getStablecoin,
|
|
141
|
+
getStablecoinInfo,
|
|
142
|
+
getStablecoinsForChain,
|
|
143
|
+
getSupportedStablecoins,
|
|
144
|
+
getTimeRemaining,
|
|
145
|
+
hasEnoughOracles,
|
|
146
|
+
hasErrorCode,
|
|
147
|
+
hasRequiredProofs,
|
|
148
|
+
hash,
|
|
149
|
+
hexToBytes,
|
|
150
|
+
hexToNumber,
|
|
151
|
+
isBrowser,
|
|
152
|
+
isEd25519Chain,
|
|
153
|
+
isExpired,
|
|
154
|
+
isNonNegativeAmount,
|
|
155
|
+
isPaymentExpired,
|
|
156
|
+
isPrivate,
|
|
157
|
+
isPrivateWalletAdapter,
|
|
158
|
+
isSIPError,
|
|
159
|
+
isStablecoin,
|
|
160
|
+
isStablecoinOnChain,
|
|
161
|
+
isValidAmount,
|
|
162
|
+
isValidChainId,
|
|
163
|
+
isValidCompressedPublicKey,
|
|
164
|
+
isValidEd25519PublicKey,
|
|
165
|
+
isValidHex,
|
|
166
|
+
isValidHexLength,
|
|
167
|
+
isValidNearAccountId,
|
|
168
|
+
isValidNearImplicitAddress,
|
|
169
|
+
isValidPrivacyLevel,
|
|
170
|
+
isValidPrivateKey,
|
|
171
|
+
isValidScalar,
|
|
172
|
+
isValidSlippage,
|
|
173
|
+
isValidSolanaAddress,
|
|
174
|
+
isValidStealthMetaAddress,
|
|
175
|
+
nearAddressToEd25519PublicKey,
|
|
176
|
+
normalizeAddress,
|
|
177
|
+
notConnectedError,
|
|
178
|
+
publicKeyToEthAddress,
|
|
179
|
+
registerWallet,
|
|
180
|
+
removeOracle,
|
|
181
|
+
secureWipe,
|
|
182
|
+
secureWipeAll,
|
|
183
|
+
serializeAttestationMessage,
|
|
184
|
+
serializeIntent,
|
|
185
|
+
serializePayment,
|
|
186
|
+
signAttestationMessage,
|
|
187
|
+
solanaAddressToEd25519PublicKey,
|
|
188
|
+
solanaPublicKeyToHex,
|
|
189
|
+
subtractBlindings,
|
|
190
|
+
subtractCommitments,
|
|
191
|
+
supportsSharedArrayBuffer,
|
|
192
|
+
supportsViewingKey,
|
|
193
|
+
supportsWebBluetooth,
|
|
194
|
+
supportsWebHID,
|
|
195
|
+
supportsWebUSB,
|
|
196
|
+
supportsWebWorkers,
|
|
197
|
+
toHex,
|
|
198
|
+
toStablecoinUnits,
|
|
199
|
+
trackIntent,
|
|
200
|
+
trackPayment,
|
|
201
|
+
updateOracleStatus,
|
|
202
|
+
validateAsset,
|
|
203
|
+
validateCreateIntentParams,
|
|
204
|
+
validateIntentInput,
|
|
205
|
+
validateIntentOutput,
|
|
206
|
+
validateScalar,
|
|
207
|
+
validateViewingKey,
|
|
208
|
+
verifyAttestation,
|
|
209
|
+
verifyCommitment,
|
|
210
|
+
verifyOpening,
|
|
211
|
+
verifyOracleSignature,
|
|
212
|
+
walletRegistry,
|
|
213
|
+
withSecureBuffer,
|
|
214
|
+
withSecureBufferSync,
|
|
215
|
+
wrapError
|
|
216
|
+
} from "./chunk-O4Y2ZUDL.mjs";
|
|
217
|
+
export {
|
|
218
|
+
ATTESTATION_VERSION,
|
|
219
|
+
BaseWalletAdapter,
|
|
220
|
+
BrowserNoirProvider,
|
|
221
|
+
CHAIN_NUMERIC_IDS,
|
|
222
|
+
ComplianceManager,
|
|
223
|
+
CryptoError,
|
|
224
|
+
DEFAULT_THRESHOLD,
|
|
225
|
+
DEFAULT_TOTAL_ORACLES,
|
|
226
|
+
DerivationPath,
|
|
227
|
+
EncryptionNotImplementedError,
|
|
228
|
+
ErrorCode,
|
|
229
|
+
EthereumChainId,
|
|
230
|
+
EthereumWalletAdapter,
|
|
231
|
+
HardwareErrorCode,
|
|
232
|
+
HardwareWalletError,
|
|
233
|
+
IntentBuilder,
|
|
234
|
+
IntentError,
|
|
235
|
+
IntentStatus,
|
|
236
|
+
LedgerWalletAdapter,
|
|
237
|
+
MockEthereumAdapter,
|
|
238
|
+
MockLedgerAdapter,
|
|
239
|
+
MockProofProvider,
|
|
240
|
+
MockSolanaAdapter,
|
|
241
|
+
MockSolver,
|
|
242
|
+
MockTrezorAdapter,
|
|
243
|
+
MockWalletAdapter,
|
|
244
|
+
NATIVE_TOKENS,
|
|
245
|
+
NEARIntentsAdapter,
|
|
246
|
+
NetworkError,
|
|
247
|
+
NoirProofProvider,
|
|
248
|
+
ORACLE_DOMAIN,
|
|
249
|
+
OneClickClient,
|
|
250
|
+
OneClickDepositMode,
|
|
251
|
+
OneClickErrorCode,
|
|
252
|
+
OneClickSwapStatus,
|
|
253
|
+
OneClickSwapType,
|
|
254
|
+
PaymentBuilder,
|
|
255
|
+
PaymentStatus,
|
|
256
|
+
PrivacyLevel,
|
|
257
|
+
ProofError,
|
|
258
|
+
ProofGenerationError,
|
|
259
|
+
ProofNotImplementedError,
|
|
260
|
+
ProposalStatus,
|
|
261
|
+
ReportStatus,
|
|
262
|
+
SIP,
|
|
263
|
+
SIPError,
|
|
264
|
+
SIP_VERSION,
|
|
265
|
+
STABLECOIN_ADDRESSES,
|
|
266
|
+
STABLECOIN_DECIMALS,
|
|
267
|
+
STABLECOIN_INFO,
|
|
268
|
+
SolanaWalletAdapter,
|
|
269
|
+
Treasury,
|
|
270
|
+
TrezorWalletAdapter,
|
|
271
|
+
ValidationError,
|
|
272
|
+
WalletError,
|
|
273
|
+
WalletErrorCode,
|
|
274
|
+
ZcashErrorCode,
|
|
275
|
+
ZcashRPCClient,
|
|
276
|
+
ZcashRPCError,
|
|
277
|
+
ZcashShieldedService,
|
|
278
|
+
addBlindings,
|
|
279
|
+
addCommitments,
|
|
280
|
+
addOracle,
|
|
281
|
+
attachProofs,
|
|
282
|
+
base58ToHex,
|
|
283
|
+
bytesToHex as browserBytesToHex,
|
|
284
|
+
hexToBytes as browserHexToBytes,
|
|
285
|
+
checkEd25519StealthAddress,
|
|
286
|
+
checkStealthAddress,
|
|
287
|
+
commit,
|
|
288
|
+
commitZero,
|
|
289
|
+
computeAttestationHash,
|
|
290
|
+
createCommitment,
|
|
291
|
+
createEthereumAdapter,
|
|
292
|
+
createLedgerAdapter,
|
|
293
|
+
createMockEthereumAdapter,
|
|
294
|
+
createMockEthereumProvider,
|
|
295
|
+
createMockLedgerAdapter,
|
|
296
|
+
createMockSolanaAdapter,
|
|
297
|
+
createMockSolanaConnection,
|
|
298
|
+
createMockSolanaProvider,
|
|
299
|
+
createMockSolver,
|
|
300
|
+
createMockTrezorAdapter,
|
|
301
|
+
createNEARIntentsAdapter,
|
|
302
|
+
createOracleRegistry,
|
|
303
|
+
createProductionSIP,
|
|
304
|
+
createSIP,
|
|
305
|
+
createShieldedIntent,
|
|
306
|
+
createShieldedPayment,
|
|
307
|
+
createSolanaAdapter,
|
|
308
|
+
createTrezorAdapter,
|
|
309
|
+
createWalletFactory,
|
|
310
|
+
createZcashClient,
|
|
311
|
+
createZcashShieldedService,
|
|
312
|
+
decodeStealthMetaAddress,
|
|
313
|
+
decryptMemo,
|
|
314
|
+
decryptWithViewing,
|
|
315
|
+
deriveEd25519StealthPrivateKey,
|
|
316
|
+
deriveOracleId,
|
|
317
|
+
deriveStealthPrivateKey,
|
|
318
|
+
deriveViewingKey,
|
|
319
|
+
deserializeAttestationMessage,
|
|
320
|
+
deserializeIntent,
|
|
321
|
+
deserializePayment,
|
|
322
|
+
detectEthereumWallets,
|
|
323
|
+
detectSolanaWallets,
|
|
324
|
+
ed25519PublicKeyToNearAddress,
|
|
325
|
+
ed25519PublicKeyToSolanaAddress,
|
|
326
|
+
encodeStealthMetaAddress,
|
|
327
|
+
encryptForViewing,
|
|
328
|
+
featureNotSupportedError,
|
|
329
|
+
formatStablecoinAmount,
|
|
330
|
+
fromHex,
|
|
331
|
+
fromStablecoinUnits,
|
|
332
|
+
generateBlinding,
|
|
333
|
+
generateEd25519StealthAddress,
|
|
334
|
+
generateEd25519StealthMetaAddress,
|
|
335
|
+
generateIntentId,
|
|
336
|
+
generateRandomBytes,
|
|
337
|
+
generateStealthAddress,
|
|
338
|
+
generateStealthMetaAddress,
|
|
339
|
+
generateViewingKey,
|
|
340
|
+
getActiveOracles,
|
|
341
|
+
getAvailableTransports,
|
|
342
|
+
getBrowserInfo,
|
|
343
|
+
getChainNumericId,
|
|
344
|
+
getChainsForStablecoin,
|
|
345
|
+
getCurveForChain,
|
|
346
|
+
getDefaultRpcEndpoint,
|
|
347
|
+
getDerivationPath,
|
|
348
|
+
getErrorMessage,
|
|
349
|
+
getEthereumProvider,
|
|
350
|
+
getGenerators,
|
|
351
|
+
getIntentSummary,
|
|
352
|
+
getPaymentSummary,
|
|
353
|
+
getPaymentTimeRemaining,
|
|
354
|
+
getPrivacyConfig,
|
|
355
|
+
getPrivacyDescription,
|
|
356
|
+
getSolanaProvider,
|
|
357
|
+
getStablecoin,
|
|
358
|
+
getStablecoinInfo,
|
|
359
|
+
getStablecoinsForChain,
|
|
360
|
+
getSupportedStablecoins,
|
|
361
|
+
getTimeRemaining,
|
|
362
|
+
hasEnoughOracles,
|
|
363
|
+
hasErrorCode,
|
|
364
|
+
hasRequiredProofs,
|
|
365
|
+
hash,
|
|
366
|
+
hexToNumber,
|
|
367
|
+
isBrowser,
|
|
368
|
+
isEd25519Chain,
|
|
369
|
+
isExpired,
|
|
370
|
+
isNonNegativeAmount,
|
|
371
|
+
isPaymentExpired,
|
|
372
|
+
isPrivate,
|
|
373
|
+
isPrivateWalletAdapter,
|
|
374
|
+
isSIPError,
|
|
375
|
+
isStablecoin,
|
|
376
|
+
isStablecoinOnChain,
|
|
377
|
+
isValidAmount,
|
|
378
|
+
isValidChainId,
|
|
379
|
+
isValidCompressedPublicKey,
|
|
380
|
+
isValidEd25519PublicKey,
|
|
381
|
+
isValidHex,
|
|
382
|
+
isValidHexLength,
|
|
383
|
+
isValidNearAccountId,
|
|
384
|
+
isValidNearImplicitAddress,
|
|
385
|
+
isValidPrivacyLevel,
|
|
386
|
+
isValidPrivateKey,
|
|
387
|
+
isValidScalar,
|
|
388
|
+
isValidSlippage,
|
|
389
|
+
isValidSolanaAddress,
|
|
390
|
+
isValidStealthMetaAddress,
|
|
391
|
+
nearAddressToEd25519PublicKey,
|
|
392
|
+
normalizeAddress,
|
|
393
|
+
notConnectedError,
|
|
394
|
+
publicKeyToEthAddress,
|
|
395
|
+
registerWallet,
|
|
396
|
+
removeOracle,
|
|
397
|
+
secureWipe,
|
|
398
|
+
secureWipeAll,
|
|
399
|
+
serializeAttestationMessage,
|
|
400
|
+
serializeIntent,
|
|
401
|
+
serializePayment,
|
|
402
|
+
signAttestationMessage,
|
|
403
|
+
solanaAddressToEd25519PublicKey,
|
|
404
|
+
solanaPublicKeyToHex,
|
|
405
|
+
subtractBlindings,
|
|
406
|
+
subtractCommitments,
|
|
407
|
+
supportsSharedArrayBuffer,
|
|
408
|
+
supportsViewingKey,
|
|
409
|
+
supportsWebBluetooth,
|
|
410
|
+
supportsWebHID,
|
|
411
|
+
supportsWebUSB,
|
|
412
|
+
supportsWebWorkers,
|
|
413
|
+
toHex,
|
|
414
|
+
toStablecoinUnits,
|
|
415
|
+
trackIntent,
|
|
416
|
+
trackPayment,
|
|
417
|
+
updateOracleStatus,
|
|
418
|
+
validateAsset,
|
|
419
|
+
validateCreateIntentParams,
|
|
420
|
+
validateIntentInput,
|
|
421
|
+
validateIntentOutput,
|
|
422
|
+
validateScalar,
|
|
423
|
+
validateViewingKey,
|
|
424
|
+
verifyAttestation,
|
|
425
|
+
verifyCommitment,
|
|
426
|
+
verifyOpening,
|
|
427
|
+
verifyOracleSignature,
|
|
428
|
+
walletRegistry,
|
|
429
|
+
withSecureBuffer,
|
|
430
|
+
withSecureBufferSync,
|
|
431
|
+
wrapError
|
|
432
|
+
};
|