@permissionless-technologies/upp-sdk 0.4.22 → 0.5.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/README.md +30 -0
- package/dist/{chunk-XDWRMHLY.js → chunk-27SFQEYY.js} +79 -40
- package/dist/chunk-27SFQEYY.js.map +1 -0
- package/dist/chunk-53JACDGZ.js +131 -0
- package/dist/chunk-53JACDGZ.js.map +1 -0
- package/dist/{chunk-D4VCRPKS.js → chunk-5CZ7R4CT.js} +2 -2
- package/dist/{chunk-D4VCRPKS.js.map → chunk-5CZ7R4CT.js.map} +1 -1
- package/dist/chunk-HB43C26P.cjs +139 -0
- package/dist/chunk-HB43C26P.cjs.map +1 -0
- package/dist/{chunk-UYPIWBKM.cjs → chunk-JVFP4Q2B.cjs} +2 -2
- package/dist/{chunk-UYPIWBKM.cjs.map → chunk-JVFP4Q2B.cjs.map} +1 -1
- package/dist/{chunk-DYSU7JYL.cjs → chunk-MSBRBR3X.cjs} +79 -40
- package/dist/chunk-MSBRBR3X.cjs.map +1 -0
- package/dist/core/index.cjs +21 -13
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/{index-CpfUNGm9.d.ts → index-BRgBwiBM.d.ts} +179 -2
- package/dist/{index-hNuffoCo.d.cts → index-BuUCObcz.d.cts} +1167 -714
- package/dist/{index-De5B4r0l.d.ts → index-C7OdmKfs.d.ts} +1167 -714
- package/dist/{index-AooYZ0kF.d.cts → index-brLSTa0y.d.cts} +179 -2
- package/dist/index.cjs +1489 -767
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1464 -747
- package/dist/index.js.map +1 -1
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.d.cts +5 -5
- package/dist/indexer/index.d.ts +5 -5
- package/dist/indexer/index.js +1 -1
- package/dist/react/index.cjs +30 -28
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +8 -4
- package/dist/react/index.d.ts +8 -4
- package/dist/react/index.js +30 -28
- package/dist/react/index.js.map +1 -1
- package/dist/{transfer-H6UWWUSN.cjs → transfer-AJWQANX7.cjs} +9 -9
- package/dist/{transfer-H6UWWUSN.cjs.map → transfer-AJWQANX7.cjs.map} +1 -1
- package/dist/{transfer-BGzySIhC.d.ts → transfer-BxiDgCvx.d.ts} +2 -0
- package/dist/{transfer-MLVRASM3.js → transfer-SEC6K5A5.js} +3 -3
- package/dist/{transfer-MLVRASM3.js.map → transfer-SEC6K5A5.js.map} +1 -1
- package/dist/{transfer-BhB-UuBP.d.cts → transfer-p-NXHdGY.d.cts} +2 -0
- package/package.json +4 -5
- package/src/contracts/interfaces/IUniversalPrivatePool.sol +52 -93
- package/src/deployments/11155111.json +28 -17
- package/src/deployments/31337.json +28 -14
- package/dist/chunk-632LPXPX.cjs +0 -49
- package/dist/chunk-632LPXPX.cjs.map +0 -1
- package/dist/chunk-DYSU7JYL.cjs.map +0 -1
- package/dist/chunk-UMWY4ICQ.js +0 -43
- package/dist/chunk-UMWY4ICQ.js.map +0 -1
- package/dist/chunk-XDWRMHLY.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PublicClient, WalletClient, Address, Hex } from 'viem';
|
|
2
|
-
import { B as ShieldParams, m as Note, $ as TransferParams, M as MergeParams, a5 as WithdrawParams, E as EncryptedNote } from './transfer-
|
|
2
|
+
import { B as ShieldParams, m as Note, $ as TransferParams, M as MergeParams, a5 as WithdrawParams, E as EncryptedNote } from './transfer-p-NXHdGY.cjs';
|
|
3
3
|
import { M as MasterKeys, O as OneTimeKeys, b as StarkMasterKeys } from './types-CJSbxv4q.cjs';
|
|
4
4
|
import { a as M31Digest } from './keccak-m31-B_AqBbRF.cjs';
|
|
5
5
|
import { P as Point } from './merkle-mteVOlDf.cjs';
|
|
@@ -275,6 +275,183 @@ declare function generateStarkStealthAddress(keys: StarkMasterKeys, chainId?: nu
|
|
|
275
275
|
*/
|
|
276
276
|
declare function detectAddressType(address: string): 'snark' | 'stark' | 'unknown';
|
|
277
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Deployment Configuration Loader
|
|
280
|
+
*
|
|
281
|
+
* Loads contract addresses based on chain ID.
|
|
282
|
+
* Built-in: Anvil (31337) and Sepolia (11155111).
|
|
283
|
+
* Custom chains can be registered at runtime via registerDeployment().
|
|
284
|
+
*/
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Verifier contract addresses
|
|
288
|
+
*/
|
|
289
|
+
interface VerifierAddresses {
|
|
290
|
+
Transfer: Address;
|
|
291
|
+
Merge: Address;
|
|
292
|
+
Withdraw: Address;
|
|
293
|
+
JoinSplit?: Address;
|
|
294
|
+
MergeTransfer2x2?: Address;
|
|
295
|
+
MergeTransfer4x2?: Address;
|
|
296
|
+
/** @deprecated Use `Transfer` */
|
|
297
|
+
TransferVerifier?: Address;
|
|
298
|
+
/** @deprecated Use `Merge` */
|
|
299
|
+
MergeVerifier?: Address;
|
|
300
|
+
/** @deprecated Use `Withdraw` */
|
|
301
|
+
WithdrawVerifier?: Address;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* STARK verifier contract addresses
|
|
305
|
+
*/
|
|
306
|
+
interface StarkVerifierAddresses {
|
|
307
|
+
CircleStarkVerifier?: Address;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Implementation addresses for UUPS proxies (for upgrade verification)
|
|
311
|
+
*/
|
|
312
|
+
interface ImplementationAddresses {
|
|
313
|
+
UniversalPrivatePool?: Address;
|
|
314
|
+
ASPRegistryHub?: Address;
|
|
315
|
+
UPPSwapModule?: Address;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Deployment configuration for a chain
|
|
319
|
+
*/
|
|
320
|
+
interface DeploymentConfig {
|
|
321
|
+
/** Universal Private Pool contract address (proxy) */
|
|
322
|
+
UniversalPrivatePool: Address;
|
|
323
|
+
/** ASP Registry Hub contract address (proxy) */
|
|
324
|
+
ASPRegistryHub: Address;
|
|
325
|
+
/** UPP Swap Module contract address (proxy) */
|
|
326
|
+
UPPSwapModule?: Address;
|
|
327
|
+
/** Implementation addresses for UUPS proxies */
|
|
328
|
+
implementations?: ImplementationAddresses;
|
|
329
|
+
/** Test token address (local/testnet) */
|
|
330
|
+
TestToken?: Address;
|
|
331
|
+
/** Test token 2 address — bonding curve token (local/testnet) */
|
|
332
|
+
TestToken2?: Address;
|
|
333
|
+
/** Verifier contract addresses */
|
|
334
|
+
verifiers: VerifierAddresses;
|
|
335
|
+
/** STARK verifier contract addresses */
|
|
336
|
+
starkVerifiers?: StarkVerifierAddresses;
|
|
337
|
+
/** Chain ID */
|
|
338
|
+
chainId: number;
|
|
339
|
+
/** Block number when contracts were deployed (for efficient scanning) */
|
|
340
|
+
deployBlock: number;
|
|
341
|
+
/** Timestamp when contracts were deployed */
|
|
342
|
+
deployTimestamp?: number;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Get deployment config for a chain
|
|
346
|
+
*
|
|
347
|
+
* @param chainId - Chain ID to get deployment for
|
|
348
|
+
* @returns Deployment config or null if not found
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```ts
|
|
352
|
+
* const deployment = getDeployment(31337)
|
|
353
|
+
* if (deployment) {
|
|
354
|
+
* console.log('Pool address:', deployment.UniversalPrivatePool)
|
|
355
|
+
* }
|
|
356
|
+
* ```
|
|
357
|
+
*/
|
|
358
|
+
declare function getDeployment(chainId: number): DeploymentConfig | null;
|
|
359
|
+
/**
|
|
360
|
+
* Get deployment config or throw if not found
|
|
361
|
+
*
|
|
362
|
+
* @param chainId - Chain ID to get deployment for
|
|
363
|
+
* @returns Deployment config
|
|
364
|
+
* @throws Error if deployment not found
|
|
365
|
+
*/
|
|
366
|
+
declare function getDeploymentOrThrow(chainId: number): DeploymentConfig;
|
|
367
|
+
/**
|
|
368
|
+
* Check if a chain has a deployment
|
|
369
|
+
*/
|
|
370
|
+
declare function hasDeployment(chainId: number): boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Get all supported chain IDs
|
|
373
|
+
*/
|
|
374
|
+
declare function getSupportedChainIds(): number[];
|
|
375
|
+
/**
|
|
376
|
+
* Get the token address for a chain
|
|
377
|
+
*/
|
|
378
|
+
declare function getTokenAddress(chainId: number): Address | null;
|
|
379
|
+
/**
|
|
380
|
+
* Register a deployment for a custom chain at runtime.
|
|
381
|
+
*
|
|
382
|
+
* Use this when deploying your own pool on a chain not built into the SDK.
|
|
383
|
+
* Overrides any existing deployment for the same chainId.
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```ts
|
|
387
|
+
* registerDeployment(8453, {
|
|
388
|
+
* UniversalPrivatePool: '0x...',
|
|
389
|
+
* ASPRegistryHub: '0x...',
|
|
390
|
+
* verifiers: { Transfer: '0x...', Merge: '0x...', Withdraw: '0x...' },
|
|
391
|
+
* chainId: 8453,
|
|
392
|
+
* deployBlock: 12345678,
|
|
393
|
+
* })
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
declare function registerDeployment(chainId: number, config: DeploymentConfig): void;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* UPP Deployment Verification — Check on-chain state matches deployment config.
|
|
400
|
+
*
|
|
401
|
+
* Verifies:
|
|
402
|
+
* 1. Bytecode exists at proxy and implementation addresses
|
|
403
|
+
* 2. UUPS proxy implementation slots point to expected implementations
|
|
404
|
+
*
|
|
405
|
+
* Use `verifyDeployment()` for comprehensive checks, or `checkImplementation()`
|
|
406
|
+
* for a lightweight proxy-vs-expected check suitable for UI warnings.
|
|
407
|
+
*/
|
|
408
|
+
|
|
409
|
+
interface VerificationCheck {
|
|
410
|
+
name: string;
|
|
411
|
+
passed: boolean;
|
|
412
|
+
expected?: string;
|
|
413
|
+
actual?: string;
|
|
414
|
+
}
|
|
415
|
+
interface VerificationResult {
|
|
416
|
+
chainId: number;
|
|
417
|
+
checks: VerificationCheck[];
|
|
418
|
+
passed: number;
|
|
419
|
+
failed: number;
|
|
420
|
+
allPassed: boolean;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Lightweight check: does the on-chain proxy point to the expected implementation?
|
|
424
|
+
*
|
|
425
|
+
* Returns `true` if the implementation matches, `false` if it doesn't or can't be read.
|
|
426
|
+
* Use this in UI code to warn users about outdated deployments.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```ts
|
|
430
|
+
* import { checkImplementation, getDeploymentOrThrow } from '@permissionless-technologies/upp-sdk'
|
|
431
|
+
*
|
|
432
|
+
* const deployment = getDeploymentOrThrow(11155111)
|
|
433
|
+
* const ok = await checkImplementation(publicClient, deployment, 'UniversalPrivatePool')
|
|
434
|
+
* if (!ok) {
|
|
435
|
+
* console.warn('Pool implementation has been upgraded — SDK may be outdated')
|
|
436
|
+
* }
|
|
437
|
+
* ```
|
|
438
|
+
*/
|
|
439
|
+
declare function checkImplementation(publicClient: PublicClient, deployment: DeploymentConfig, contract: 'UniversalPrivatePool' | 'ASPRegistryHub'): Promise<boolean>;
|
|
440
|
+
/**
|
|
441
|
+
* Full deployment verification — checks bytecode existence and proxy implementations.
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```ts
|
|
445
|
+
* const result = await verifyDeployment(publicClient, deployment)
|
|
446
|
+
* if (!result.allPassed) {
|
|
447
|
+
* for (const check of result.checks.filter(c => !c.passed)) {
|
|
448
|
+
* console.error(`FAIL: ${check.name}`, check.expected, check.actual)
|
|
449
|
+
* }
|
|
450
|
+
* }
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
declare function verifyDeployment(publicClient: PublicClient, deployment: DeploymentConfig): Promise<VerificationResult>;
|
|
454
|
+
|
|
278
455
|
/**
|
|
279
456
|
* Indexer Types
|
|
280
457
|
*
|
|
@@ -780,4 +957,4 @@ declare class NoteStore implements INoteStore {
|
|
|
780
957
|
private notify;
|
|
781
958
|
}
|
|
782
959
|
|
|
783
|
-
export { ADDRESS_VERSION as A,
|
|
960
|
+
export { hasDeployment as $, ADDRESS_VERSION as A, createNote as B, type CommitmentInsertedArgs as C, type DeploymentConfig as D, createOneTimeKeys as E, createUPPClient as F, decodeStarkStealthAddress as G, decodeStealthAddress as H, type Indexer as I, decryptNote as J, detectAddressType as K, type LiveSyncConfig as L, encodeStarkStealthAddress as M, type NoteStatus$1 as N, encodeStealthAddress as O, type ProofSystem as P, encryptNote as Q, type RpcIndexerConfig as R, type StorageAdapter as S, generateStarkStealthAddress as T, type UPPClient as U, type VerificationCheck as V, generateStealthAddress as W, getDeployment as X, getDeploymentOrThrow as Y, getSupportedChainIds as Z, getTokenAddress as _, type IndexedNote as a, isValidStarkStealthAddress as a0, isValidStealthAddress as a1, registerDeployment as a2, verifyDeployment as a3, verifyOwnership as a4, type NoteStatus as a5, type NoteFilters as b, type SyncResult as c, type SyncProgress as d, type SyncConfig as e, type IndexerState as f, type SyncState as g, type SerializedNote as h, type StealthTransactArgs as i, type NullifiedArgs as j, type ASPMembershipProof as k, DirectAccountAdapter as l, type IASPProvider as m, type IAccountAdapter as n, type INoteStore as o, NoteStore as p, STARK_ADDRESS_VERSION as q, STARK_STEALTH_ADDRESS_PREFIX as r, STEALTH_ADDRESS_PREFIX as s, type ShieldedNote as t, StorableAccountAdapter as u, type UPPClientConfig as v, type VerificationResult as w, type VerifierAddresses as x, checkImplementation as y, computeNoteEncryptionKey as z };
|