@invisi-labs/sdk 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -21,29 +21,33 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
23
  AddressRegistry: () => AddressRegistry,
24
- Detector: () => import_core15.Detector,
25
- Disclosure: () => import_core15.Disclosure,
24
+ Detector: () => import_core16.Detector,
25
+ Disclosure: () => import_core16.Disclosure,
26
26
  DisclosureVerifier: () => DisclosureVerifier,
27
27
  EncryptedWalletCodec: () => EncryptedWalletCodec,
28
28
  Invisi: () => Invisi,
29
- MissingCapabilityError: () => import_core15.MissingCapabilityError,
30
- NullifierCapability: () => import_core15.NullifierCapability,
29
+ MAX_MEMO_BYTES: () => import_core16.MAX_MEMO_BYTES,
30
+ MissingCapabilityError: () => import_core16.MissingCapabilityError,
31
+ NullifierCapability: () => import_core16.NullifierCapability,
31
32
  Operation: () => Operation,
32
33
  PreparedTransaction: () => PreparedTransaction,
33
34
  Protocol: () => import_protocol10.Protocol,
34
35
  ProtocolRpcClient: () => ProtocolRpcClient2,
35
36
  ProtocolRpcError: () => import_rpc3.ProtocolRpcError,
36
37
  RegistrationOperation: () => import_protocol10.RegistrationOperation,
37
- ViewingCapability: () => import_core15.ViewingCapability,
38
- Wallet: () => import_core15.Wallet,
39
- WalletAuthorization: () => import_core15.WalletAuthorization,
38
+ ViewingCapability: () => import_core16.ViewingCapability,
39
+ Wallet: () => import_core16.Wallet,
40
+ WalletAuthorization: () => import_core16.WalletAuthorization,
40
41
  WalletSession: () => WalletSession,
42
+ decodeMemoText: () => import_core16.decodeMemoText,
41
43
  defineGasBenchmarks: () => defineGasBenchmarks,
44
+ encodeMemo: () => import_core16.encodeMemo,
42
45
  walletBalance: () => walletBalance
43
46
  });
44
47
  module.exports = __toCommonJS(src_exports);
45
48
 
46
49
  // src/session/operation-protocol.ts
50
+ var import_core = require("@invisi-labs/core");
47
51
  var import_protocol = require("@invisi-labs/protocol");
48
52
 
49
53
  // src/session/state.ts
@@ -237,6 +241,7 @@ async function witnessFor(protocol, plan, authorization) {
237
241
  }
238
242
  if (credit.draw) {
239
243
  return builder.drawCredit({
244
+ timestamp: plan.preparedAt.timestamp,
240
245
  params: credit.draw,
241
246
  deliveries: credit.deliveries,
242
247
  inputs: credit.inputs,
@@ -367,12 +372,836 @@ function operationExpired(plan, now) {
367
372
  const credit = plan.credit;
368
373
  if (credit?.topUp && now >= credit.topUp.previousExpiry) return true;
369
374
  if (credit?.creation && now >= credit.creation.expiry) return true;
370
- if (credit?.draw && credit.draw.expiries.some((expiry) => now >= expiry)) return true;
375
+ if (credit?.draw) {
376
+ if (credit.draw.expiries.some((expiry) => now >= expiry)) return true;
377
+ const prepared = (0, import_core.creditPeriods)(plan.preparedAt.timestamp), current2 = (0, import_core.creditPeriods)(now);
378
+ if (prepared.currentDay !== current2.currentDay || prepared.currentMonth !== current2.currentMonth)
379
+ return true;
380
+ }
371
381
  return false;
372
382
  }
373
383
 
374
384
  // src/data/gas-benchmarks.json
375
385
  var gas_benchmarks_default = [
386
+ {
387
+ formatVersion: 1,
388
+ id: "protocol-42f2546-621cbef5f84a-prague-credit-real",
389
+ deployment: {
390
+ chainId: "31337",
391
+ protocolAddress: "0xEeD9be753bccbCB21463C49f0c56cC0E48bEcf3c",
392
+ runtimeCodeHash: "0x80228a2080d224b4481fc5df24fe8ce080d4536c663b13ec7829ecf0ef46abbd",
393
+ tokenAddress: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf"
394
+ },
395
+ source: {
396
+ protocolCommit: "42f2546b62312e4c11e21b8e6b2ff6f72187d6a6",
397
+ measuredAt: "2026-10-29T10:56:24.758Z",
398
+ chain: "Anvil 31337",
399
+ hardfork: "prague",
400
+ token: "MockERC20",
401
+ verifier: "real",
402
+ fingerprints: {
403
+ protocolSourceSha256: "621cbef5f84a133ca96674a2dba39b21b5f9fbc022977d4d2ab296d9d6e685e0",
404
+ dirtyDiffSha256: "eb2c41cca3802a47196181648397ec6f47fb2ba0efa8aa3800508d8d255fae3f",
405
+ compiledArtifactsSha256: "c0e658d74fe49caeebf5ef9deadc1751d9e48add690f7e9ab478de7a00dab7e4",
406
+ creditManifestSha256: "da819378af60471905cc902a43e464b58159e0c75bd46fb804ea9d34d8aa7ef6",
407
+ userManifestSha256: "067b6c50e4bc4d9c19dd29f25352db88d189a5f49aed0ed603daa70760e699df",
408
+ sdkSourceSha256: "37e1f82a447db741f46e1490b866ddf85718eab42c33d369cf5f5d2ec3a25c78"
409
+ },
410
+ toolchain: {
411
+ solidity: "0.8.38",
412
+ barretenberg: "6.0.0",
413
+ noir: "1.0.0-rc.6",
414
+ evmVersion: "prague",
415
+ optimizerRuns: 200,
416
+ anvil: "anvil Version: 1.8.6"
417
+ },
418
+ blockGasLimit: "500000000",
419
+ runtimeContracts: {
420
+ transact_user_slots14_direct_Verifier: {
421
+ address: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
422
+ runtimeCodeHash: "0xedab185b2b9fc7d98660db2cdc99fe30b9d1341dfe568172a1626e322d208f7e"
423
+ },
424
+ "transact_user_slots14-adapter": {
425
+ address: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
426
+ runtimeCodeHash: "0xe222cd9c142bc2b13e083e6fe66ea76c0e1e9a194715bfa57082b625c55d867f"
427
+ },
428
+ transact_user_slots56_direct_Verifier: {
429
+ address: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
430
+ runtimeCodeHash: "0x8913eb7060f38234aca199c4a1007892f68e703de48b588c436b24faaeb23a53"
431
+ },
432
+ "transact_user_slots56-adapter": {
433
+ address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
434
+ runtimeCodeHash: "0x97c416d190da0b9b8111a5ee17367e8a702ba7884019bf724155ae629a783477"
435
+ },
436
+ transact_user_slots112_direct_Verifier: {
437
+ address: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
438
+ runtimeCodeHash: "0x501a4791ff0c0a96465ab5e0d42d0ce763bbbb7fd8aebe21929de4d460e1b42c"
439
+ },
440
+ "transact_user_slots112-adapter": {
441
+ address: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
442
+ runtimeCodeHash: "0xf22ed8ea34a4011650a41c1b9f664b5259ea5a8d66a82d706dab9611a38c109f"
443
+ },
444
+ transact_user_slots168_direct_Verifier: {
445
+ address: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
446
+ runtimeCodeHash: "0xc22acdfa6f3e278ae46d194a1c50b905e4815fd7b61e39edb52334570670fdce"
447
+ },
448
+ "transact_user_slots168-adapter": {
449
+ address: "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
450
+ runtimeCodeHash: "0x05a318f54d93440a501b6fc6be88e4e76e89d72f1be8333553cb4a61f4f9a0d7"
451
+ },
452
+ transact_aggregate_14_4_Verifier: {
453
+ address: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
454
+ runtimeCodeHash: "0x7a6f2bafe4c61a72a99a195e188f2f4a32900c0cc63cc132e33881d8199fd446"
455
+ },
456
+ "transact_aggregate_14_4-adapter": {
457
+ address: "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
458
+ runtimeCodeHash: "0x15877da9940d5b8dd4868ffa92ded3b93d6092c3963ba9e18b50f1ea15d89898"
459
+ },
460
+ transact_aggregate_14_8_Verifier: {
461
+ address: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
462
+ runtimeCodeHash: "0x5667d16b39973813a499375f6885a3082d7bfcd6e3c0f3548d7de3131cd285f3"
463
+ },
464
+ "transact_aggregate_14_8-adapter": {
465
+ address: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
466
+ runtimeCodeHash: "0x9d1a93c78edf7e81b4b6da10ab209b3fb009ed8355594f670559a67842d88cfc"
467
+ },
468
+ transact_aggregate_14_12_Verifier: {
469
+ address: "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
470
+ runtimeCodeHash: "0xa4e67840a47182d4011d577981c2477bb4ab2bc36845bb136375f19f12c0800b"
471
+ },
472
+ "transact_aggregate_14_12-adapter": {
473
+ address: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
474
+ runtimeCodeHash: "0x96a6e170aafc0af9d46232ba00206d950bba85e65962d43501bafb6d7f9fe61d"
475
+ },
476
+ create_credit_direct_Verifier: {
477
+ address: "0x9A676e781A523b5d0C0e43731313A708CB607508",
478
+ runtimeCodeHash: "0xbdc6450bf9ba01001082f345b8bd21006a4f75274f32d026cf6e14270e6d56e6"
479
+ },
480
+ "create_credit-adapter": {
481
+ address: "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
482
+ runtimeCodeHash: "0x3a95a22b32aef18ce053a7110056bbfbf13bb0b07932a49765ebb136528a4707"
483
+ },
484
+ credit_draw_slots1_direct_Verifier: {
485
+ address: "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
486
+ runtimeCodeHash: "0x47be80e72c3a22ea044638f6004de8c3a0264d5a0d17189c01153cdabfd7bab6"
487
+ },
488
+ "credit_draw_slots1-adapter": {
489
+ address: "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
490
+ runtimeCodeHash: "0x28f25aeb97659fb9253ae67f2ff284789710bc59e1ed077ffc7a07b800cbfcc1"
491
+ },
492
+ credit_draw_slots12_direct_Verifier: {
493
+ address: "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
494
+ runtimeCodeHash: "0x244d9ba22f5c736c2a5c42c466701e2a8ba7ae8108665133541026ea45d56e04"
495
+ },
496
+ "credit_draw_slots12-adapter": {
497
+ address: "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
498
+ runtimeCodeHash: "0x60d48a35279d318a0621e5f59b293f44074463b8002ce180b7e6a31b995ac195"
499
+ },
500
+ credit_draw_slots50_direct_Verifier: {
501
+ address: "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d",
502
+ runtimeCodeHash: "0x2ad5eb64bcfae34ef04111dd8f9c1ffc5fc8aa6c1ad3a65d8da78233f3390660"
503
+ },
504
+ "credit_draw_slots50-adapter": {
505
+ address: "0x59b670e9fA9D0A427751Af201D676719a970857b",
506
+ runtimeCodeHash: "0x468966de20e5c71cf7b6f3cda7fa7a76b5d80dc5ddf82119f441ea6a7c6c1e70"
507
+ },
508
+ credit_draw_slots120_direct_Verifier: {
509
+ address: "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
510
+ runtimeCodeHash: "0x523b6d211618bbd33d708f8198b9f3daafc10e2fa7a6a857db5795ed748a24e4"
511
+ },
512
+ "credit_draw_slots120-adapter": {
513
+ address: "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44",
514
+ runtimeCodeHash: "0xa91d585ce6037e703efb914205bf193881fde4f470d2fc63b615699b56175239"
515
+ },
516
+ credit_cancel_direct_Verifier: {
517
+ address: "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
518
+ runtimeCodeHash: "0x182e86861a73f712071e40a6b8497b80c58c383eaa799182e7a50e39196399fd"
519
+ },
520
+ "credit_cancel-adapter": {
521
+ address: "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
522
+ runtimeCodeHash: "0xea1f0f22445eed5a92c8d6990219059b7e241ad66c55a6d9ddef22a94a0f015f"
523
+ },
524
+ credit_top_up_direct_Verifier: {
525
+ address: "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
526
+ runtimeCodeHash: "0xeeb42a2b6377ab305b713d1caf4ca96edb302c6d1e1007239e5c70091819c266"
527
+ },
528
+ "credit_top_up-adapter": {
529
+ address: "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
530
+ runtimeCodeHash: "0xbcf35a1d0e6c16dd01b09f944889aa5917d358d986fe399a0343d06bbdedaa61"
531
+ },
532
+ PrivateTransferVerifierRegistry: {
533
+ address: "0xc5a5C42992dECbae36851359345FE25997F5C42d",
534
+ runtimeCodeHash: "0x678684af147cb42c872184b6e22c8439748139ae0c5885032941ab8832fcb142"
535
+ },
536
+ CrossTreeVerifierRegistry: {
537
+ address: "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
538
+ runtimeCodeHash: "0xa5ee16fc7ed9f982450e42a48365a93bfca784fa884adcb8695b557e921cb93b"
539
+ },
540
+ DualVerifierRouter: {
541
+ address: "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
542
+ runtimeCodeHash: "0xcc094ed6f1bcc9270c597f62b817e4fc0a54770f373320133c2836e5b07ef2cc"
543
+ },
544
+ AtomicBatchOutputLib: {
545
+ address: "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
546
+ runtimeCodeHash: "0x7c138c13e40b3ad0fee3b319d6c1580a21855cb5ecdda92571d530509d9b7316"
547
+ },
548
+ FundingLib: {
549
+ address: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
550
+ runtimeCodeHash: "0x898d13d6ec4123df85f21ee0f98678dcd9f9b9a60134f88e35c1ef1aaa0a45f9"
551
+ },
552
+ PrivateTransferLib: {
553
+ address: "0x9E545E3C0baAB3E08CdfD552C960A1050f373042",
554
+ runtimeCodeHash: "0xfb18f2dd0a39af1b99ae35c25e2746cb5bc85c205e041db5f440671d84c82e5e"
555
+ },
556
+ CrossTreeTransferLib: {
557
+ address: "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
558
+ runtimeCodeHash: "0x7b33a08f2feb9da462b951c95482cb2909796a85c0fde7cc9a6b65ff8b7ff253"
559
+ },
560
+ AggregateTransferLib: {
561
+ address: "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
562
+ runtimeCodeHash: "0xb3b4bd3a428f5c35712a57180f07b2249774d399ca87d4494929148ea26c5b99"
563
+ },
564
+ CreateCreditLib: {
565
+ address: "0x851356ae760d987E095750cCeb3bC6014560891C",
566
+ runtimeCodeHash: "0xe37a4b7c129c4fba5615d25ed8b7e898e64a306c68f7e599ade911db98fe881c"
567
+ },
568
+ CreditLifecycleLib: {
569
+ address: "0xf5059a5D33d5853360D16C683c16e67980206f36",
570
+ runtimeCodeHash: "0xf87a2227680efa7070071516587793e2e847c172b83261b8983c826f8a8c79bb"
571
+ },
572
+ ShieldLib: {
573
+ address: "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
574
+ runtimeCodeHash: "0x371e57d8d324e44445a4ec30303b89a8bc98bbdbd03aeaa80faf0f821a65451d"
575
+ },
576
+ InvisiFactory: {
577
+ address: "0x998abeb3E57409262aE5b751f60747921B33613E",
578
+ runtimeCodeHash: "0xc56e5a0b71f4a1f63576a6663efb62b17c0d7520b6885a8d3483a356e12edf9b"
579
+ },
580
+ InvisiAddressRegistry: {
581
+ address: "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
582
+ runtimeCodeHash: "0x007da3f4e888366ba0eed52cd511c4a369359291387ad19ca37e89eb395fce30"
583
+ },
584
+ InvisiProtocol: {
585
+ address: "0xEeD9be753bccbCB21463C49f0c56cC0E48bEcf3c",
586
+ runtimeCodeHash: "0x80228a2080d224b4481fc5df24fe8ce080d4536c663b13ec7829ecf0ef46abbd"
587
+ },
588
+ MockERC20: {
589
+ address: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
590
+ runtimeCodeHash: "0xf7f676b5c54f6e94f82f0de65a0117468a0d915e8a79d150e74f76bd6d7f708b"
591
+ }
592
+ },
593
+ assumptions: [
594
+ "normal CREATE/Factory deployment and fresh registry; EIP170/EIP3860 unchanged; no code/storage injection",
595
+ "Solidity0.8.38 optimizer200 Prague; pinned BB6.0.0 real verifiers; every native proof independently verified",
596
+ "one physical source tree and 123 existing leaves shared by every sample; top-up has two authenticated source groups; no rollover or screener",
597
+ "funding/approvals/121 genuine Credit seeds/usage-seed draw/payout reset excluded from business gas",
598
+ "each round restores identical token balances, exact caller allowance100, note cursor, nullifiers and baseline; spender payout starts zero",
599
+ "complete receipt.gasUsed is measured, including verifier/calldata/logging/output insertion; memo0",
600
+ "Prague local block gas limit500000000; measured transactions may be unmineable under lower network transaction/block limits",
601
+ "observed three-sample ranges are neither a confidence interval nor a recommended transaction gas limit"
602
+ ]
603
+ },
604
+ measurements: [
605
+ {
606
+ id: "create-credit-caller-0x0",
607
+ shape: {
608
+ kind: "create-credit",
609
+ target: "evm",
610
+ capacity: 10,
611
+ noteInputs: 0,
612
+ noteOutputs: 0,
613
+ sourceTrees: 0,
614
+ creditInputs: 0,
615
+ creditOutputs: 1,
616
+ creditRemainders: 0,
617
+ funding: "caller",
618
+ permit: false,
619
+ deliveryBytes: 1132
620
+ },
621
+ circuit: {
622
+ circuitName: "create_credit",
623
+ target: "evm",
624
+ artifactSha256: "3ed6cfdee4f5fd840f023580f76c208768777fea79737f2511377e5c55be0230",
625
+ vkSha256: "56f663c6053be0d158a271022d200c732597efd3a2e0be48fe94549d0b1795e0"
626
+ },
627
+ samples: [
628
+ {
629
+ gasUsed: "1574696",
630
+ transactionHash: "0x76112c532a1b5f24ad84fb83f91789ba4acd15ed9473ec9a0267cd5fe605448d",
631
+ blockNumber: "172",
632
+ blockHash: "0x0d91421e94947132a19f38ffdd76932c2d85add201de3d9189325ed3568125a7",
633
+ calldataBytes: 11780
634
+ },
635
+ {
636
+ gasUsed: "1574576",
637
+ transactionHash: "0x545f72d9d207329bfc69ef0d1e96470c614924d5e463d974cc001712bf619fd8",
638
+ blockNumber: "172",
639
+ blockHash: "0x2053f97a2b2f3cf66e14da0ab9c1d7bd462d2d4f3ef2b13021aefcddedb71cf8",
640
+ calldataBytes: 11780
641
+ },
642
+ {
643
+ gasUsed: "1574612",
644
+ transactionHash: "0x880ec0c666068d0756fba39947dc5b211aeebb31f41bd1e1e54856b090f65d34",
645
+ blockNumber: "172",
646
+ blockHash: "0xbb86ed21379a917e9688a3c90364ae8fbe1ba633ac068360e0a82bf4d3113b6d",
647
+ calldataBytes: 11780
648
+ }
649
+ ]
650
+ },
651
+ {
652
+ id: "create-credit-1x1",
653
+ shape: {
654
+ kind: "create-credit",
655
+ target: "evm",
656
+ capacity: 10,
657
+ noteInputs: 1,
658
+ noteOutputs: 1,
659
+ sourceTrees: 1,
660
+ creditInputs: 0,
661
+ creditOutputs: 1,
662
+ creditRemainders: 0,
663
+ funding: "none",
664
+ permit: false,
665
+ deliveryBytes: 1360
666
+ },
667
+ circuit: {
668
+ circuitName: "create_credit",
669
+ target: "evm",
670
+ artifactSha256: "3ed6cfdee4f5fd840f023580f76c208768777fea79737f2511377e5c55be0230",
671
+ vkSha256: "56f663c6053be0d158a271022d200c732597efd3a2e0be48fe94549d0b1795e0"
672
+ },
673
+ samples: [
674
+ {
675
+ gasUsed: "1671641",
676
+ transactionHash: "0x24ca3f03681aeb188b48989d5eaf7dd264a8c32e828acd34ff1b44be74f17ea6",
677
+ blockNumber: "172",
678
+ blockHash: "0xcdac07aa5d3ec187874dc1fc9be65503235289c7036ebe455feaf5161db42bb5",
679
+ calldataBytes: 12132
680
+ },
681
+ {
682
+ gasUsed: "1671509",
683
+ transactionHash: "0x31a7f69ab02effa5fdd2e02bd02fb7e715a54786813261113fd7c07a0d3ef549",
684
+ blockNumber: "172",
685
+ blockHash: "0xc78ca874aa22cc6b8ea19e12a2806ba448a0f844345450d3fedc9841ea71c3a8",
686
+ calldataBytes: 12132
687
+ },
688
+ {
689
+ gasUsed: "1671485",
690
+ transactionHash: "0xc5a30116885dcac8b3631c15847544cfeb91c46bde44c3765ac0ce42e3259157",
691
+ blockNumber: "172",
692
+ blockHash: "0x4a2c90ff972da4d37408567062779762efbb5790d4784d03842ee2c926c8c894",
693
+ calldataBytes: 12132
694
+ }
695
+ ]
696
+ },
697
+ {
698
+ id: "draw-credit-1-partial",
699
+ shape: {
700
+ kind: "draw-credit",
701
+ target: "evm",
702
+ capacity: 1,
703
+ noteInputs: 0,
704
+ noteOutputs: 0,
705
+ sourceTrees: 1,
706
+ creditInputs: 1,
707
+ creditOutputs: 1,
708
+ creditRemainders: 1,
709
+ funding: "none",
710
+ permit: false,
711
+ deliveryBytes: 1132
712
+ },
713
+ circuit: {
714
+ circuitName: "credit_draw_slots1",
715
+ target: "evm",
716
+ artifactSha256: "4542b227e0552b45c302f1dace21cadeba4962c96244e021472f1f7531cff8d1",
717
+ vkSha256: "43c051a2bedf9454c12e70b10156361e414944823ba23e80662c16c7ced0a2ce"
718
+ },
719
+ samples: [
720
+ {
721
+ gasUsed: "1588303",
722
+ transactionHash: "0x85c5180692470aa952aa13eb29ca0404d4f5b5192cb31475f90d03d78864895e",
723
+ blockNumber: "172",
724
+ blockHash: "0xfe4876c0a2ebf05385a46562bca693b6df80da731fd9651117593916015dc38c",
725
+ calldataBytes: 11588
726
+ },
727
+ {
728
+ gasUsed: "1588303",
729
+ transactionHash: "0x61684313840623187ca1205b4b07b43a08038448524ee1a028c7e14050032682",
730
+ blockNumber: "172",
731
+ blockHash: "0x9726d31c10e6516e38e3f63c84fc4b9a8a161486d35e0d8d07e6829261a88fe7",
732
+ calldataBytes: 11588
733
+ },
734
+ {
735
+ gasUsed: "1588255",
736
+ transactionHash: "0x0aa052fb8e356cc81dd73bcdae72f760937cd2e56bd4a3e8eb5878208b4f7596",
737
+ blockNumber: "172",
738
+ blockHash: "0x2c958cfba0627e18cd5cb47001b278628c305071929596e3335d770b92c1dc16",
739
+ calldataBytes: 11588
740
+ }
741
+ ]
742
+ },
743
+ {
744
+ id: "draw-credit-1-full",
745
+ shape: {
746
+ kind: "draw-credit",
747
+ target: "evm",
748
+ capacity: 1,
749
+ noteInputs: 0,
750
+ noteOutputs: 0,
751
+ sourceTrees: 1,
752
+ creditInputs: 1,
753
+ creditOutputs: 0,
754
+ creditRemainders: 0,
755
+ funding: "none",
756
+ permit: false,
757
+ deliveryBytes: 0
758
+ },
759
+ circuit: {
760
+ circuitName: "credit_draw_slots1",
761
+ target: "evm",
762
+ artifactSha256: "4542b227e0552b45c302f1dace21cadeba4962c96244e021472f1f7531cff8d1",
763
+ vkSha256: "43c051a2bedf9454c12e70b10156361e414944823ba23e80662c16c7ced0a2ce"
764
+ },
765
+ samples: [
766
+ {
767
+ gasUsed: "1042812",
768
+ transactionHash: "0xb5d55729d975abdc92ca44c0b72e44a0d5841da8b23dc11b5bd31f46d88a341a",
769
+ blockNumber: "172",
770
+ blockHash: "0x8a6ddbe2f1630e1956485cac7984fb9cdc4fbb26b10522e158b38e2970ee4f3b",
771
+ calldataBytes: 10372
772
+ },
773
+ {
774
+ gasUsed: "1042824",
775
+ transactionHash: "0xf64f3186fbf94fcbd9fb12426c714b4a8425599e1a7e5677866fae3d6873b7ae",
776
+ blockNumber: "172",
777
+ blockHash: "0xd630c44d8ce96234ec836dd2178caac2a6d0bc2df5cf37df1534eb8896be48d3",
778
+ calldataBytes: 10372
779
+ },
780
+ {
781
+ gasUsed: "1042884",
782
+ transactionHash: "0xdf634e809b87603a62292ef046fa5e84715561fa76ef121c768303dd779568f1",
783
+ blockNumber: "172",
784
+ blockHash: "0x09cad4a799360bdf825c3ad70fe374b7fe2df802f8ee37ccb7f26ffc49aa2a3a",
785
+ calldataBytes: 10372
786
+ }
787
+ ]
788
+ },
789
+ {
790
+ id: "draw-credit-12-partial",
791
+ shape: {
792
+ kind: "draw-credit",
793
+ target: "evm",
794
+ capacity: 12,
795
+ noteInputs: 0,
796
+ noteOutputs: 0,
797
+ sourceTrees: 1,
798
+ creditInputs: 12,
799
+ creditOutputs: 12,
800
+ creditRemainders: 12,
801
+ funding: "none",
802
+ permit: false,
803
+ deliveryBytes: 13584
804
+ },
805
+ circuit: {
806
+ circuitName: "credit_draw_slots12",
807
+ target: "evm",
808
+ artifactSha256: "dd72b0867fc3be7cd90de263bd2d0892075cb18eb4f6dd671b13111710f10369",
809
+ vkSha256: "5e31d771e6294993736078596d9c69f21fe7595eda50e3cce6d7406b65cf1443"
810
+ },
811
+ samples: [
812
+ {
813
+ gasUsed: "3102895",
814
+ transactionHash: "0x699ba81f296f4af397a8dfaf96adf14d00d0f7dd69c0b09608641fc9b99fc28f",
815
+ blockNumber: "172",
816
+ blockHash: "0x8d318f563f5563fa5c213617481089f75aab3a6e9d14818db107ac20a8c20ffb",
817
+ calldataBytes: 30276
818
+ },
819
+ {
820
+ gasUsed: "3102871",
821
+ transactionHash: "0xddfc1c6c505f6c54f4d9aabc96a02eb6b606182e8ad708a578eacd274d885dee",
822
+ blockNumber: "172",
823
+ blockHash: "0xcc7738fe329a608241615dc43b7d16e075eb62be202ea8aaf4ae27a5278bf438",
824
+ calldataBytes: 30276
825
+ },
826
+ {
827
+ gasUsed: "3103171",
828
+ transactionHash: "0x6efab6408d927e1877f1f6c33ecd285a128382f7d1dfe6e123927b035781c8aa",
829
+ blockNumber: "172",
830
+ blockHash: "0xcb4588df9ecdca0d353ccbd226e1d5d07f21e6dc93875e41cdd5f64568859f4d",
831
+ calldataBytes: 30276
832
+ }
833
+ ]
834
+ },
835
+ {
836
+ id: "draw-credit-12-full",
837
+ shape: {
838
+ kind: "draw-credit",
839
+ target: "evm",
840
+ capacity: 12,
841
+ noteInputs: 0,
842
+ noteOutputs: 0,
843
+ sourceTrees: 1,
844
+ creditInputs: 12,
845
+ creditOutputs: 0,
846
+ creditRemainders: 0,
847
+ funding: "none",
848
+ permit: false,
849
+ deliveryBytes: 0
850
+ },
851
+ circuit: {
852
+ circuitName: "credit_draw_slots12",
853
+ target: "evm",
854
+ artifactSha256: "dd72b0867fc3be7cd90de263bd2d0892075cb18eb4f6dd671b13111710f10369",
855
+ vkSha256: "5e31d771e6294993736078596d9c69f21fe7595eda50e3cce6d7406b65cf1443"
856
+ },
857
+ samples: [
858
+ {
859
+ gasUsed: "1536675",
860
+ transactionHash: "0xc0d3eef8e6b0e90984d776a5e41bcdce1e0ca0bc6dc3a71616e4768e80c01546",
861
+ blockNumber: "172",
862
+ blockHash: "0x22dfac3d8e9913a6a1f2ff84faaece4ed59bfe1cb74e06a60131ff28cc6c2f9d",
863
+ calldataBytes: 15684
864
+ },
865
+ {
866
+ gasUsed: "1536675",
867
+ transactionHash: "0x9879d86a1eaa550a6a6afaeeb0f5f07745d5dcd9caa07b660d7fb512911dc67e",
868
+ blockNumber: "172",
869
+ blockHash: "0xf88ba9f1b7a0c627338a61bbabe1c650bdfcd7fa1c56433d6853f492135b753d",
870
+ calldataBytes: 15684
871
+ },
872
+ {
873
+ gasUsed: "1536711",
874
+ transactionHash: "0xbd8f75a021a8ce8dc1900bd2d84d723acc6a64018844050a5aa2f8712cf7fd6b",
875
+ blockNumber: "172",
876
+ blockHash: "0xa55b539c2ea4e10ce9a9ee8e6de9cf1daa97263b51f32cfef8342c100b663b0f",
877
+ calldataBytes: 15684
878
+ }
879
+ ]
880
+ },
881
+ {
882
+ id: "draw-credit-50-partial",
883
+ shape: {
884
+ kind: "draw-credit",
885
+ target: "evm",
886
+ capacity: 50,
887
+ noteInputs: 0,
888
+ noteOutputs: 0,
889
+ sourceTrees: 1,
890
+ creditInputs: 50,
891
+ creditOutputs: 50,
892
+ creditRemainders: 50,
893
+ funding: "none",
894
+ permit: false,
895
+ deliveryBytes: 56600
896
+ },
897
+ circuit: {
898
+ circuitName: "credit_draw_slots50",
899
+ target: "evm",
900
+ artifactSha256: "09c7469866748b4c0c4bbf2b040844771948a170999f6dc7a38fe5c0ecda4054",
901
+ vkSha256: "7b613225b6f32a077011d4196c356e836d22dcd116efe687fde53144fbd8db9f"
902
+ },
903
+ samples: [
904
+ {
905
+ gasUsed: "8015473",
906
+ transactionHash: "0x5dcc0fa08abaf5212424ac6f3e2f3bb8a0bd333f90ef6e421f8d3fe370ca1acf",
907
+ blockNumber: "172",
908
+ blockHash: "0x3197c523dece3492226c5021f974e7c02db2e686265943d03a5550c6cb96a12e",
909
+ calldataBytes: 94276
910
+ },
911
+ {
912
+ gasUsed: "8015449",
913
+ transactionHash: "0x6a55f88551a45b3e118cde0607cfff1ef0b6ab15ad9472e838412d9ce714b42a",
914
+ blockNumber: "172",
915
+ blockHash: "0xea82c8962d45db8361bd67ed326806f21c511bd51550adc453d0c3e5cab3a7ae",
916
+ calldataBytes: 94276
917
+ },
918
+ {
919
+ gasUsed: "8015149",
920
+ transactionHash: "0x2cc8d474a92abe91f8025109a70cf1f9f081dbec43aa4a475ab9f33222cfc76b",
921
+ blockNumber: "172",
922
+ blockHash: "0x4398f419da699ccca33867852d4975b5c461a40bb01cd5241a0e6dcacaeb78b3",
923
+ calldataBytes: 94276
924
+ }
925
+ ]
926
+ },
927
+ {
928
+ id: "draw-credit-50-full",
929
+ shape: {
930
+ kind: "draw-credit",
931
+ target: "evm",
932
+ capacity: 50,
933
+ noteInputs: 0,
934
+ noteOutputs: 0,
935
+ sourceTrees: 1,
936
+ creditInputs: 50,
937
+ creditOutputs: 0,
938
+ creditRemainders: 0,
939
+ funding: "none",
940
+ permit: false,
941
+ deliveryBytes: 0
942
+ },
943
+ circuit: {
944
+ circuitName: "credit_draw_slots50",
945
+ target: "evm",
946
+ artifactSha256: "09c7469866748b4c0c4bbf2b040844771948a170999f6dc7a38fe5c0ecda4054",
947
+ vkSha256: "7b613225b6f32a077011d4196c356e836d22dcd116efe687fde53144fbd8db9f"
948
+ },
949
+ samples: [
950
+ {
951
+ gasUsed: "3216708",
952
+ transactionHash: "0x16933368d26ea1d7fbe69027c700671df832ad308944eeff42e7c2da40297b06",
953
+ blockNumber: "172",
954
+ blockHash: "0x0739a6f4188b8bdeae7bd5460960086d04adfea993d07d65b2b3630ad01b8cab",
955
+ calldataBytes: 33476
956
+ },
957
+ {
958
+ gasUsed: "3216840",
959
+ transactionHash: "0x45dc15a62b1661f54e167cf13b9693770370c926a8a7af959da7354e9bb4aa6e",
960
+ blockNumber: "172",
961
+ blockHash: "0xf2e294db9af3b11814fed1dec358b8370ea28a99189211f883c9b0012349d677",
962
+ calldataBytes: 33476
963
+ },
964
+ {
965
+ gasUsed: "3216744",
966
+ transactionHash: "0x2c827753026ea421497534a01bcc2adaca866a7612f570dad3fcf18c660f8590",
967
+ blockNumber: "172",
968
+ blockHash: "0x3ccd465528ff22e6d1955670220df3565899a16dd683f71c83c9810f2df420b4",
969
+ calldataBytes: 33476
970
+ }
971
+ ]
972
+ },
973
+ {
974
+ id: "draw-credit-120-partial",
975
+ shape: {
976
+ kind: "draw-credit",
977
+ target: "evm",
978
+ capacity: 120,
979
+ noteInputs: 0,
980
+ noteOutputs: 0,
981
+ sourceTrees: 1,
982
+ creditInputs: 120,
983
+ creditOutputs: 120,
984
+ creditRemainders: 120,
985
+ funding: "none",
986
+ permit: false,
987
+ deliveryBytes: 135840
988
+ },
989
+ circuit: {
990
+ circuitName: "credit_draw_slots120",
991
+ target: "evm",
992
+ artifactSha256: "6ccd0366a669c50fd5da875c3eae194fe8aa4c36d35a5f9ebfd64636ea599b48",
993
+ vkSha256: "d715848afc5c1ecdfcef5ed5026865abef5040a3bc232fd65330a5ffee8475fb"
994
+ },
995
+ samples: [
996
+ {
997
+ gasUsed: "17458512",
998
+ transactionHash: "0x84dd6bda5f3172a53e899051fd226dc5869edb796bd513a33e7f224bed13f4ae",
999
+ blockNumber: "172",
1000
+ blockHash: "0xfca82de1e112b92319185d8c3f0115e0aa339d0247ea65970eb0d37ba958b08e",
1001
+ calldataBytes: 211140
1002
+ },
1003
+ {
1004
+ gasUsed: "17458224",
1005
+ transactionHash: "0xae26838942cf8b5499d43cb5e74681ae87aec77890a8eabddd692ff83830e013",
1006
+ blockNumber: "172",
1007
+ blockHash: "0x3e513447e0cfdbb682a95b7a719b0d300ec46b0ee22b518eaae7fb082f6436e7",
1008
+ calldataBytes: 211140
1009
+ },
1010
+ {
1011
+ gasUsed: "17458524",
1012
+ transactionHash: "0xeaa07e77fe958f4317e71b07ddb876482ae9c5172fd6d6cefaacc551dbbda7d5",
1013
+ blockNumber: "172",
1014
+ blockHash: "0x12b34c1fd2e15480276052842157c2a6355acdd43d7bd01ae7511c3f39e0ecfc",
1015
+ calldataBytes: 211140
1016
+ }
1017
+ ]
1018
+ },
1019
+ {
1020
+ id: "draw-credit-120-full",
1021
+ shape: {
1022
+ kind: "draw-credit",
1023
+ target: "evm",
1024
+ capacity: 120,
1025
+ noteInputs: 0,
1026
+ noteOutputs: 0,
1027
+ sourceTrees: 1,
1028
+ creditInputs: 120,
1029
+ creditOutputs: 0,
1030
+ creditRemainders: 0,
1031
+ funding: "none",
1032
+ permit: false,
1033
+ deliveryBytes: 0
1034
+ },
1035
+ circuit: {
1036
+ circuitName: "credit_draw_slots120",
1037
+ target: "evm",
1038
+ artifactSha256: "6ccd0366a669c50fd5da875c3eae194fe8aa4c36d35a5f9ebfd64636ea599b48",
1039
+ vkSha256: "d715848afc5c1ecdfcef5ed5026865abef5040a3bc232fd65330a5ffee8475fb"
1040
+ },
1041
+ samples: [
1042
+ {
1043
+ gasUsed: "6289576",
1044
+ transactionHash: "0xbf11743f7edc5ed5ff334efc5e35634f45e48e4940d33ddd9c87d8fe444dafc5",
1045
+ blockNumber: "172",
1046
+ blockHash: "0x774de17971107b73cab2cd20f26b60665f55a37b0cc1147166babf16743e34d5",
1047
+ calldataBytes: 65220
1048
+ },
1049
+ {
1050
+ gasUsed: "6289768",
1051
+ transactionHash: "0x651bb13e0645ee8a08657db627f1072f5e964ddaff44f70f829440ed68488dea",
1052
+ blockNumber: "172",
1053
+ blockHash: "0xa9795828565fb0ce65bda295073106b8bbdc110bb8317d269839d3db3e312d5b",
1054
+ calldataBytes: 65220
1055
+ },
1056
+ {
1057
+ gasUsed: "6289720",
1058
+ transactionHash: "0x2a859d381cb4b50830971b1ffc9789b11569fc96147e130dae6fecd141f5ceb0",
1059
+ blockNumber: "172",
1060
+ blockHash: "0x7d990830157bfeff8e5cbe580e9effe97faa7676c9957ce32891b76c83961430",
1061
+ calldataBytes: 65220
1062
+ }
1063
+ ]
1064
+ },
1065
+ {
1066
+ id: "top-up-credit-1x1-unchanged-limits",
1067
+ shape: {
1068
+ kind: "top-up-credit",
1069
+ target: "evm",
1070
+ capacity: 10,
1071
+ noteInputs: 1,
1072
+ noteOutputs: 1,
1073
+ sourceTrees: 2,
1074
+ creditInputs: 1,
1075
+ creditOutputs: 1,
1076
+ creditRemainders: 0,
1077
+ funding: "none",
1078
+ permit: false,
1079
+ deliveryBytes: 1360
1080
+ },
1081
+ circuit: {
1082
+ circuitName: "credit_top_up",
1083
+ target: "evm",
1084
+ artifactSha256: "2ffebd5753ec1b0c050204d4f97498765fe61ea01a793a9b2466c2f97536345c",
1085
+ vkSha256: "40b02a9d2e7eb7b49daaac4b7760328537b7982fd5a225cc065bb74cd5ef44b3"
1086
+ },
1087
+ samples: [
1088
+ {
1089
+ gasUsed: "1711282",
1090
+ transactionHash: "0x74d45084bb07bacabbced09ee6ef69d8632a22a4493be783c326c47e929ba0ed",
1091
+ blockNumber: "172",
1092
+ blockHash: "0x3503643f7081b52ae20d4754a0e9b11f52034ae48059f5b5298546c2570fa091",
1093
+ calldataBytes: 12292
1094
+ },
1095
+ {
1096
+ gasUsed: "1711282",
1097
+ transactionHash: "0x4b5e2432d5571f6b56507b3ab995a8120560ba608959ff100f03b87873e72be6",
1098
+ blockNumber: "172",
1099
+ blockHash: "0xca15dc309371a5aa9c7bc5bf1d65c5b325c71528ce7856ba68a118114124fccc",
1100
+ calldataBytes: 12292
1101
+ },
1102
+ {
1103
+ gasUsed: "1711390",
1104
+ transactionHash: "0x304f3740b64c80dcc5c894fb30af59080d96a11e08371096ae695cbc46ef2c8b",
1105
+ blockNumber: "172",
1106
+ blockHash: "0x9671ed76d6b8e49a36ba229d3609289fcf70756f31277ac5fc0e3f08cd52304f",
1107
+ calldataBytes: 12292
1108
+ }
1109
+ ]
1110
+ },
1111
+ {
1112
+ id: "top-up-credit-1x1-changed-limits",
1113
+ shape: {
1114
+ kind: "top-up-credit",
1115
+ target: "evm",
1116
+ capacity: 10,
1117
+ noteInputs: 1,
1118
+ noteOutputs: 1,
1119
+ sourceTrees: 2,
1120
+ creditInputs: 1,
1121
+ creditOutputs: 1,
1122
+ creditRemainders: 0,
1123
+ funding: "none",
1124
+ permit: false,
1125
+ deliveryBytes: 1360
1126
+ },
1127
+ circuit: {
1128
+ circuitName: "credit_top_up",
1129
+ target: "evm",
1130
+ artifactSha256: "2ffebd5753ec1b0c050204d4f97498765fe61ea01a793a9b2466c2f97536345c",
1131
+ vkSha256: "40b02a9d2e7eb7b49daaac4b7760328537b7982fd5a225cc065bb74cd5ef44b3"
1132
+ },
1133
+ samples: [
1134
+ {
1135
+ gasUsed: "1711318",
1136
+ transactionHash: "0x65284df534b42631f8a592fb2a6efc16361a4cc122f1a8dd41418e7b950f48f1",
1137
+ blockNumber: "172",
1138
+ blockHash: "0xf198242a1edf5b133961568c9165648c829729e7bfbbf57a1e148551c971b87c",
1139
+ calldataBytes: 12292
1140
+ },
1141
+ {
1142
+ gasUsed: "1711438",
1143
+ transactionHash: "0xcee89a81e598974798365c4ebada806fb51196ee602334b0fffdbb25da0afe25",
1144
+ blockNumber: "172",
1145
+ blockHash: "0xb506a6fb54cc2f91b803211ed955aac0203fba93e2428f8f52ec0d413c90af09",
1146
+ calldataBytes: 12292
1147
+ },
1148
+ {
1149
+ gasUsed: "1711342",
1150
+ transactionHash: "0x957de5c79f365c9b0510b9e125a662317494aad50cb446edceef6f678d561cc7",
1151
+ blockNumber: "172",
1152
+ blockHash: "0xb1d5cffd6d6db58ade9d5e16d48b060b9ab2152415966dc809e7e70785472ab8",
1153
+ calldataBytes: 12292
1154
+ }
1155
+ ]
1156
+ },
1157
+ {
1158
+ id: "cancel-credit-1",
1159
+ shape: {
1160
+ kind: "cancel-credit",
1161
+ target: "evm",
1162
+ capacity: 1,
1163
+ noteInputs: 0,
1164
+ noteOutputs: 0,
1165
+ sourceTrees: 1,
1166
+ creditInputs: 1,
1167
+ creditOutputs: 0,
1168
+ creditRemainders: 0,
1169
+ funding: "none",
1170
+ permit: false,
1171
+ deliveryBytes: 0
1172
+ },
1173
+ circuit: {
1174
+ circuitName: "credit_cancel",
1175
+ target: "evm",
1176
+ artifactSha256: "b4459c2cf756d096e37291cf4d7cd129866b6d420b6d03c928f383b057112ccb",
1177
+ vkSha256: "fc8ad196ef15f3328afcc8f01d867a3ebefd15451c2813948442fab1923b73b2"
1178
+ },
1179
+ samples: [
1180
+ {
1181
+ gasUsed: "985543",
1182
+ transactionHash: "0x29ca63fbefcc5e92dbc86f67d6280993e567a5dd02ff3defd7f3251ce711865e",
1183
+ blockNumber: "172",
1184
+ blockHash: "0xecd7808fe9f7467af917069bd7a82ab0324e3cbab8dcad622b089d6e3eee9a58",
1185
+ calldataBytes: 9540
1186
+ },
1187
+ {
1188
+ gasUsed: "985795",
1189
+ transactionHash: "0xaf8bca0769330f89b647363f99b752dbbe6fdbb8b1aae912224f6a3a59f40faa",
1190
+ blockNumber: "172",
1191
+ blockHash: "0x58e1358e02f189d57628fa7c504b87fb000fe60eb9f0a0c3c0e58dae876e64da",
1192
+ calldataBytes: 9540
1193
+ },
1194
+ {
1195
+ gasUsed: "985711",
1196
+ transactionHash: "0x2c911fd5a422f6f72f2a00b16872b7e46e182d39b8f5bfa9e3b2bf99d3155da7",
1197
+ blockNumber: "172",
1198
+ blockHash: "0x9da571cbe63f52232261ee1527d5ed97a9e90e374b4fcda97d04feb25114d18e",
1199
+ calldataBytes: 9540
1200
+ }
1201
+ ]
1202
+ }
1203
+ ]
1204
+ },
376
1205
  {
377
1206
  formatVersion: 1,
378
1207
  id: "protocol-92ef274-osaka-real",
@@ -797,190 +1626,6 @@ var gas_benchmarks_default = [
797
1626
  calldataBytes: 10116
798
1627
  }
799
1628
  ]
800
- },
801
- {
802
- id: "create-credit-1x1",
803
- shape: {
804
- kind: "create-credit",
805
- target: "evm",
806
- capacity: 10,
807
- noteInputs: 1,
808
- noteOutputs: 1,
809
- sourceTrees: 1,
810
- creditInputs: 0,
811
- creditOutputs: 1,
812
- creditRemainders: 0,
813
- funding: "none",
814
- permit: false,
815
- deliveryBytes: 1162
816
- },
817
- circuit: {
818
- circuitName: "create_credit",
819
- target: "evm",
820
- artifactSha256: "ab97cd5a036851a9748a5cfd8e6f9834e23090c8e95db4531aabfc37d3abb353",
821
- vkSha256: "fac0e65b768a28750323cca851990598af936611125b6cfa3f5c16b04c7d084f"
822
- },
823
- samples: [
824
- {
825
- gasUsed: "1627325",
826
- transactionHash: "0x7763d93a5b1e8797b5f4af2e1e5b1bb029a8b0f9f7b90bcc04f581947d826803",
827
- blockNumber: "49",
828
- blockHash: "0x93e51ae5e99c68dc642693d478e444330d8e26255ff5bb9aafc4a3f4e70d3a45",
829
- calldataBytes: 11940
830
- },
831
- {
832
- gasUsed: "1627385",
833
- transactionHash: "0xe246d59cafa2a26dddf21c8385dd843be4d4596388ebe23e936df84e7f906635",
834
- blockNumber: "49",
835
- blockHash: "0x3c24b2d6ed2a998562d34b49e0517515742a9b39d59aec38a9ac6b22be1b694b",
836
- calldataBytes: 11940
837
- },
838
- {
839
- gasUsed: "1627157",
840
- transactionHash: "0x2f7ed0b75435cc6a820d0cd90fd82d362f74787057413722b6eb3c6e37db87d3",
841
- blockNumber: "49",
842
- blockHash: "0x0a0301670b46017da772800c68bb941245ac1941c79fde9c85717632154e15ee",
843
- calldataBytes: 11940
844
- }
845
- ]
846
- },
847
- {
848
- id: "draw-credit-1-partial",
849
- shape: {
850
- kind: "draw-credit",
851
- target: "evm",
852
- capacity: 1,
853
- noteInputs: 0,
854
- noteOutputs: 0,
855
- sourceTrees: 1,
856
- creditInputs: 1,
857
- creditOutputs: 1,
858
- creditRemainders: 1,
859
- funding: "none",
860
- permit: false,
861
- deliveryBytes: 936
862
- },
863
- circuit: {
864
- circuitName: "credit_draw_slots1",
865
- target: "evm",
866
- artifactSha256: "f5e458790948f37a61a833fad52cf2cc3b26a59515d271de32e0caaa4e229eb5",
867
- vkSha256: "613699a440f50a0937e4c57e5152b5fdea42c31b10157d6b93226fef313df553"
868
- },
869
- samples: [
870
- {
871
- gasUsed: "1581294",
872
- transactionHash: "0xd438e22b0fa07a657279f182537e4996f1936f0881d5b7d637845f8ca2808aab",
873
- blockNumber: "49",
874
- blockHash: "0x9e384a3054530b1ff237a639bca1a559afb2b73b30e21c262aac85ebf480fc9b",
875
- calldataBytes: 11396
876
- },
877
- {
878
- gasUsed: "1581402",
879
- transactionHash: "0xa70ac3e7284b6e98f8591a6ba88e4ddfb23ecbd05343641d0532f34920e10b56",
880
- blockNumber: "49",
881
- blockHash: "0x37c5eb34ce96a841e96c36103a7ab65c1a3e08603dc9843efb0c0752c069f1d4",
882
- calldataBytes: 11396
883
- },
884
- {
885
- gasUsed: "1581174",
886
- transactionHash: "0xd062494979d0bc0e284ccb070f87b48f3e8e5befb6001f15a006dd2a4a72ca24",
887
- blockNumber: "49",
888
- blockHash: "0x12840d920f14163b2d29491f28cee616e1bb9fd9514a4debe10ae35256345fc1",
889
- calldataBytes: 11396
890
- }
891
- ]
892
- },
893
- {
894
- id: "top-up-credit-1x1",
895
- shape: {
896
- kind: "top-up-credit",
897
- target: "evm",
898
- capacity: 10,
899
- noteInputs: 1,
900
- noteOutputs: 1,
901
- sourceTrees: 2,
902
- creditInputs: 1,
903
- creditOutputs: 1,
904
- creditRemainders: 0,
905
- funding: "none",
906
- permit: false,
907
- deliveryBytes: 1162
908
- },
909
- circuit: {
910
- circuitName: "credit_top_up",
911
- target: "evm",
912
- artifactSha256: "ee9dbcf8be6f6c09478190996e90b1d39d4a10a00245950f69fc1d2c329c6e9b",
913
- vkSha256: "0c369fec0469b60baebb3be650bad42f3ccae6f0ff139cce6ad9a3f451ed7513"
914
- },
915
- samples: [
916
- {
917
- gasUsed: "1666948",
918
- transactionHash: "0x1403da01167962a4349d2655ea217bfcfc1a2390138bea0279792c44b4381dd2",
919
- blockNumber: "49",
920
- blockHash: "0xcb554ffcdb4afe5f6458e5d23ffbdd1fdbef9c23f982343065772c0b3e3dd633",
921
- calldataBytes: 12100
922
- },
923
- {
924
- gasUsed: "1666900",
925
- transactionHash: "0x3b5e54f29e3f888a443526cf23ab9255b3f0c7adf1d0d127c16b85f4c6a324d9",
926
- blockNumber: "49",
927
- blockHash: "0xeb304df6bdd24b249cac3197b543b0eaa6381ed75ad812dff248f914864105ed",
928
- calldataBytes: 12100
929
- },
930
- {
931
- gasUsed: "1666780",
932
- transactionHash: "0x81c5ef25268a719275cb3b80618c2af291e1f7b3f91d7e82cc26bc894a8c332a",
933
- blockNumber: "49",
934
- blockHash: "0xfa42070d6349fc8d559b8bd4ad0ee6b79089107540c4472b9e492b8f5a6bd3e4",
935
- calldataBytes: 12100
936
- }
937
- ]
938
- },
939
- {
940
- id: "cancel-credit-1",
941
- shape: {
942
- kind: "cancel-credit",
943
- target: "evm",
944
- capacity: 1,
945
- noteInputs: 0,
946
- noteOutputs: 0,
947
- sourceTrees: 1,
948
- creditInputs: 1,
949
- creditOutputs: 0,
950
- creditRemainders: 0,
951
- funding: "none",
952
- permit: false,
953
- deliveryBytes: 0
954
- },
955
- circuit: {
956
- circuitName: "credit_cancel",
957
- target: "evm",
958
- artifactSha256: "d332453a2b8c2c544747ac8d5f01912c9757f48d986226fd6a9b0e24d8321474",
959
- vkSha256: "1f8a3c20cb081d6a90962556da3124919cc4e5675e59ad31562af39299da02fb"
960
- },
961
- samples: [
962
- {
963
- gasUsed: "998146",
964
- transactionHash: "0x97bc72692d241e2c344b912804f9939061db5ef59cf4bb23922d93812e382160",
965
- blockNumber: "49",
966
- blockHash: "0x2e09df4df84a1c25961386febe8404531bb5da274836d50cc15a26c91b433a98",
967
- calldataBytes: 9540
968
- },
969
- {
970
- gasUsed: "998134",
971
- transactionHash: "0x26c5067b12c2bc4b694070784e6b19d4855efa6e77c2422f0c6b1567f061570a",
972
- blockNumber: "49",
973
- blockHash: "0xdd3f20520c09e001374cab58387e52c82446db053539e30dad28b0de679a333c",
974
- calldataBytes: 9540
975
- },
976
- {
977
- gasUsed: "998230",
978
- transactionHash: "0x5dc09445a405150da1445c22f50d6dd10d8d428a6a3f41ee90db7d3574657e31",
979
- blockNumber: "49",
980
- blockHash: "0x5c8f8223a50d2c8d48188a2db28ffa33c1b150a2fb465e99db4430949db3664b",
981
- calldataBytes: 9540
982
- }
983
- ]
984
1629
  }
985
1630
  ]
986
1631
  }
@@ -1009,6 +1654,29 @@ function copyGasBenchmarks(profiles) {
1009
1654
  for (const p of copy) {
1010
1655
  if (p.formatVersion !== 1 || !p.id || !decimal.test(p.deployment.chainId) || !address.test(p.deployment.protocolAddress) || !address.test(p.deployment.tokenAddress) || !p.deployment.runtimeCodeHash || !word.test(p.deployment.runtimeCodeHash) || p.source.verifier !== "real" || !/^[0-9a-f]{40}$/i.test(p.source.protocolCommit) || !p.source.measuredAt || !Array.isArray(p.source.assumptions) || !p.source.assumptions.every((assumption) => typeof assumption === "string") || !p.measurements.length)
1011
1656
  throw new Error("invalid gas benchmark profile");
1657
+ if (p.source.fingerprints && ![
1658
+ "protocolSourceSha256",
1659
+ "dirtyDiffSha256",
1660
+ "compiledArtifactsSha256",
1661
+ "creditManifestSha256",
1662
+ "userManifestSha256",
1663
+ "sdkSourceSha256"
1664
+ ].every((key) => {
1665
+ const v = p.source.fingerprints[key];
1666
+ return typeof v === "string" && /^[a-f0-9]{64}$/i.test(v);
1667
+ }))
1668
+ throw new Error("invalid benchmark source fingerprint");
1669
+ if (p.source.blockGasLimit !== void 0 && (!decimal.test(p.source.blockGasLimit) || BigInt(p.source.blockGasLimit) <= 0n))
1670
+ throw new Error("invalid benchmark block gas limit");
1671
+ if (p.source.runtimeContracts && !Object.values(p.source.runtimeContracts).every(
1672
+ (v) => address.test(v.address) && word.test(v.runtimeCodeHash)
1673
+ ))
1674
+ throw new Error("invalid benchmark runtime identity");
1675
+ if (p.source.toolchain && (!["solidity", "barretenberg", "noir", "evmVersion", "anvil"].every((key) => {
1676
+ const v = p.source.toolchain[key];
1677
+ return typeof v === "string" && v.length > 0;
1678
+ }) || !Number.isSafeInteger(p.source.toolchain.optimizerRuns) || p.source.toolchain.optimizerRuns < 0))
1679
+ throw new Error("invalid benchmark toolchain");
1012
1680
  for (const m of p.measurements) {
1013
1681
  if (!m.id || !m.samples.length || !["none", "caller", "signature"].includes(m.shape.funding) || typeof m.shape.permit !== "boolean")
1014
1682
  throw new Error("invalid gas benchmark measurement");
@@ -1088,11 +1756,20 @@ function estimateBenchmarkGas(plan, protocol, profiles) {
1088
1756
  );
1089
1757
  if (!request.deployment.runtimeCodeHash || !candidates.length)
1090
1758
  return { ...base, available: false, reason: "deployment-not-covered" };
1091
- for (const profile of candidates) {
1092
- const measurement = profile.measurements.find(
1759
+ const exact = candidates.flatMap(
1760
+ (profile) => profile.measurements.filter(
1093
1761
  (m) => shapeKeys.every((key) => m.shape[key] === request.shape[key]) && sameCircuit(m.circuit, request.circuit)
1094
- );
1095
- if (!measurement) continue;
1762
+ ).map((measurement) => ({ profile, measurement }))
1763
+ );
1764
+ const mean = (measurement) => {
1765
+ const count = BigInt(measurement.samples.length);
1766
+ return (measurement.samples.reduce((sum, s) => sum + BigInt(s.gasUsed), 0n) + count - 1n) / count;
1767
+ };
1768
+ exact.sort(
1769
+ (a, b) => mean(a.measurement) > mean(b.measurement) ? -1 : mean(a.measurement) < mean(b.measurement) ? 1 : a.measurement.id.localeCompare(b.measurement.id)
1770
+ );
1771
+ if (exact.length) {
1772
+ const { profile, measurement } = exact[0];
1096
1773
  const gas = measurement.samples.map((sample) => BigInt(sample.gasUsed));
1097
1774
  const count = BigInt(gas.length);
1098
1775
  return {
@@ -1122,14 +1799,20 @@ function estimateShapeGas(request, profiles = defaultProfiles) {
1122
1799
  const matching = measurements.filter(
1123
1800
  (measurement) => measurement.shape.kind === request.shape.kind && measurement.shape.target === request.shape.target && sameCircuit(measurement.circuit, request.circuit)
1124
1801
  );
1125
- const exact = matching.find(
1802
+ const exact = matching.filter(
1126
1803
  (measurement) => shapeKeys.every((key) => measurement.shape[key] === request.shape[key])
1127
1804
  );
1128
- if (exact) {
1129
- const gas = exact.samples.map((sample) => BigInt(sample.gasUsed));
1130
- const count = BigInt(gas.length);
1131
- return { gasUnits: (gas.reduce((sum, value) => sum + value, 0n) + count - 1n) / count };
1805
+ if (exact.length) {
1806
+ const means = exact.map((m) => {
1807
+ const count = BigInt(m.samples.length);
1808
+ return (m.samples.reduce((sum, s) => sum + BigInt(s.gasUsed), 0n) + count - 1n) / count;
1809
+ });
1810
+ return { gasUnits: means.reduce((max, v) => v > max ? v : max) };
1132
1811
  }
1812
+ if (["create-credit", "draw-credit", "top-up-credit", "cancel-credit"].includes(
1813
+ request.shape.kind
1814
+ ) && !matching.length)
1815
+ throw new Error("No current Credit gas reference for this artifact and verification key");
1133
1816
  const candidates = matching.length ? matching : measurements.filter(
1134
1817
  (measurement) => measurement.shape.kind === request.shape.kind && measurement.shape.target === request.shape.target
1135
1818
  );
@@ -1144,7 +1827,22 @@ function estimateShapeGas(request, profiles = defaultProfiles) {
1144
1827
  "deliveryBytes",
1145
1828
  ...!matching.length ? ["capacity"] : []
1146
1829
  ];
1147
- const estimates = candidates.map((measurement) => {
1830
+ const groups = /* @__PURE__ */ new Map();
1831
+ for (const candidate of candidates) {
1832
+ const key = JSON.stringify([
1833
+ shapeKeys.map((k) => candidate.shape[k]),
1834
+ candidate.circuit?.circuitName,
1835
+ candidate.circuit?.target,
1836
+ candidate.circuit?.artifactSha256.toLowerCase(),
1837
+ candidate.circuit?.vkSha256.toLowerCase()
1838
+ ]);
1839
+ const previous = groups.get(key);
1840
+ groups.set(
1841
+ key,
1842
+ previous ? { ...candidate, samples: [...previous.samples, ...candidate.samples] } : candidate
1843
+ );
1844
+ }
1845
+ const estimates = [...groups.values()].map((measurement) => {
1148
1846
  let numerator = 1n;
1149
1847
  let denominator = 1n;
1150
1848
  for (const key of dimensions) {
@@ -1178,7 +1876,7 @@ var import_ethers6 = require("ethers");
1178
1876
 
1179
1877
  // src/session/operation-execution.ts
1180
1878
  var import_ethers2 = require("ethers");
1181
- var import_core = require("@invisi-labs/core");
1879
+ var import_core2 = require("@invisi-labs/core");
1182
1880
 
1183
1881
  // src/session/proof-integrity.ts
1184
1882
  var import_ethers = require("ethers");
@@ -1207,7 +1905,7 @@ async function authorizeOperation(plan, provider) {
1207
1905
  if (provider.walletIdentity !== plan.scope.walletIdentity)
1208
1906
  throw new Error("wallet authorization capability mismatch");
1209
1907
  const request = authorizationRequest(plan);
1210
- const digest = (0, import_core.computeWalletAuthorizationDigest)(request);
1908
+ const digest = (0, import_core2.computeWalletAuthorizationDigest)(request);
1211
1909
  const signed = await provider.authorize(structuredClone(request));
1212
1910
  if (signed.walletIdentity !== plan.scope.walletIdentity || signed.digest !== digest)
1213
1911
  throw new Error("wallet authorization statement mismatch");
@@ -1255,7 +1953,7 @@ async function signOperationFunding(saved, signer, verifier) {
1255
1953
  }
1256
1954
 
1257
1955
  // src/PreparedTransaction.ts
1258
- var import_core2 = require("@invisi-labs/core");
1956
+ var import_core3 = require("@invisi-labs/core");
1259
1957
  var import_protocol2 = require("@invisi-labs/protocol");
1260
1958
 
1261
1959
  // src/session/operation-preview.ts
@@ -1398,7 +2096,7 @@ var PreparedTransaction = class _PreparedTransaction {
1398
2096
  }
1399
2097
  const prover = "prove" in backendOrOptions ? backendOrOptions : this.#runtime.options.prover;
1400
2098
  if (!prover) {
1401
- throw new import_core2.MissingCapabilityError("prover");
2099
+ throw new import_core3.MissingCapabilityError("prover");
1402
2100
  }
1403
2101
  return this.stage(
1404
2102
  "proof",
@@ -1434,7 +2132,7 @@ var PreparedTransaction = class _PreparedTransaction {
1434
2132
  check2(p.kind === "shield" || this.#saved.proof, "proof must precede funding authorization");
1435
2133
  const signer = suppliedSigner ?? this.#runtime.options.fundingSigner;
1436
2134
  if (!signer) {
1437
- throw new import_core2.MissingCapabilityError("EVM funding signer");
2135
+ throw new import_core3.MissingCapabilityError("EVM funding signer");
1438
2136
  }
1439
2137
  check2(
1440
2138
  signer.address.toLowerCase() === p.funding.payer.toLowerCase(),
@@ -1515,21 +2213,21 @@ var PreparedTransaction = class _PreparedTransaction {
1515
2213
 
1516
2214
  // src/session/prepare-common.ts
1517
2215
  var import_ethers3 = require("ethers");
1518
- var import_core4 = require("@invisi-labs/core");
2216
+ var import_core5 = require("@invisi-labs/core");
1519
2217
  var import_protocol3 = require("@invisi-labs/protocol");
1520
2218
 
1521
2219
  // src/session/membership.ts
1522
- var import_core3 = require("@invisi-labs/core");
2220
+ var import_core4 = require("@invisi-labs/core");
1523
2221
  async function verifyMembership(reader, context, block, input, proof) {
1524
2222
  if (proof.block.hash !== block.hash || proof.block.number !== block.number || proof.leaf !== input.commitment || proof.treeId !== input.treeId || proof.leafIndex !== input.leafIndex || proof.path.length !== 16 || !Number.isInteger(input.leafIndex) || input.leafIndex < 0 || input.leafIndex >= 65536 || !await reader.isKnownRoot(context, input.treeId, proof.root, block))
1525
2223
  throw new Error("membership context/root mismatch");
1526
2224
  let root = BigInt(input.commitment);
1527
2225
  for (let i = 0; i < 16; i++) {
1528
2226
  const sibling = proof.path[i];
1529
- if (typeof sibling !== "bigint" || sibling < 0n || sibling >= import_core3.FIELD_MODULUS)
2227
+ if (typeof sibling !== "bigint" || sibling < 0n || sibling >= import_core4.FIELD_MODULUS)
1530
2228
  throw new Error("noncanonical membership path");
1531
2229
  root = BigInt(
1532
- await (0, import_core3.poseidonHash)(input.leafIndex >> i & 1 ? [sibling, root] : [root, sibling])
2230
+ await (0, import_core4.poseidonHash)(input.leafIndex >> i & 1 ? [sibling, root] : [root, sibling])
1533
2231
  );
1534
2232
  }
1535
2233
  if (root !== BigInt(proof.root))
@@ -1589,7 +2287,15 @@ var Preparation = class {
1589
2287
  throw new Error("canonical wallet checkpoint changed; resync required");
1590
2288
  }
1591
2289
  }
1592
- return { context: { ...options.protocol.context, now: block.timestamp }, block, deadline };
2290
+ return {
2291
+ context: {
2292
+ ...options.protocol.context,
2293
+ now: block.timestamp,
2294
+ timestamp: block.timestamp
2295
+ },
2296
+ block,
2297
+ deadline
2298
+ };
1593
2299
  }
1594
2300
  async assertBlock(frame) {
1595
2301
  if ((await this.runtime.reader.getBlock(frame.block.number)).hash !== frame.block.hash) {
@@ -1630,11 +2336,12 @@ var Preparation = class {
1630
2336
  }
1631
2337
  async output(payment, context, change = false) {
1632
2338
  positiveAmount(payment.amount);
1633
- const recipient = await import_core4.ReceivingAddress.parse(payment.to).resolve(
2339
+ const recipient = await import_core5.ReceivingAddress.parse(payment.to).resolve(
1634
2340
  this.runtime.options.addressResolver
1635
2341
  );
1636
- const nonce = (0, import_core4.generateNonce)();
1637
- const identity = await (0, import_core4.computeNoteIdentity)(BigInt(recipient.walletIdentity), nonce);
2342
+ const memo = (0, import_core5.encodeMemo)(payment.memo);
2343
+ const nonce = (0, import_core5.generateNonce)();
2344
+ const identity = await (0, import_core5.computeNoteIdentity)(BigInt(recipient.walletIdentity), nonce);
1638
2345
  const keys = recipient.getReceivingKeys();
1639
2346
  const note = {
1640
2347
  chainId: context.chainId,
@@ -1642,9 +2349,10 @@ var Preparation = class {
1642
2349
  tokenAddress: BigInt(context.tokenAddress),
1643
2350
  walletIdentity: recipient.walletIdentity,
1644
2351
  amount: payment.amount,
2352
+ ...memo.length === 0 ? {} : { memo },
1645
2353
  nonce
1646
2354
  };
1647
- const commitment = await (0, import_core4.computeNoteCommitment)(
2355
+ const commitment = await (0, import_core5.computeNoteCommitment)(
1648
2356
  context.chainId,
1649
2357
  identity,
1650
2358
  note.tokenAddress,
@@ -1658,20 +2366,20 @@ var Preparation = class {
1658
2366
  change,
1659
2367
  delivery: {
1660
2368
  ciphertext: (0, import_ethers3.hexlify)(
1661
- await (0, import_core4.encryptPrivateTransferNote)(keys.viewingPublicKey, note, {
2369
+ await (0, import_core5.encryptPrivateTransferNote)(keys.viewingPublicKey, note, {
1662
2370
  chainId: context.chainId,
1663
2371
  protocolAddress: note.protocolAddress,
1664
2372
  outputCommitment: commitment
1665
2373
  })
1666
2374
  ),
1667
- clue: (0, import_ethers3.hexlify)((0, import_core4.createClue)(keys.clueKey))
2375
+ clue: (0, import_ethers3.hexlify)((0, import_core5.createClue)(keys.clueKey))
1668
2376
  }
1669
2377
  };
1670
2378
  }
1671
2379
  async membership(input, frame) {
1672
2380
  const { options, reader } = this.runtime;
1673
2381
  if (!options.protocolRpc)
1674
- throw new import_core4.MissingCapabilityError("Protocol RPC membership provider");
2382
+ throw new import_core5.MissingCapabilityError("Protocol RPC membership provider");
1675
2383
  const root = this.#roots.get(input.treeId);
1676
2384
  const proof = await options.protocolRpc.getMembership(
1677
2385
  frame.context,
@@ -1718,9 +2426,9 @@ var Preparation = class {
1718
2426
  for (const input of selected) {
1719
2427
  const note = input.note;
1720
2428
  const c = frame.context;
1721
- if (note.walletIdentity !== scope.walletIdentity || note.chainId !== c.chainId || note.protocolAddress !== BigInt(c.protocolAddress) || note.tokenAddress !== BigInt(c.tokenAddress) || await (0, import_core4.computeNoteCommitment)(
2429
+ if (note.walletIdentity !== scope.walletIdentity || note.chainId !== c.chainId || note.protocolAddress !== BigInt(c.protocolAddress) || note.tokenAddress !== BigInt(c.tokenAddress) || await (0, import_core5.computeNoteCommitment)(
1722
2430
  c.chainId,
1723
- await (0, import_core4.computeNoteIdentity)(BigInt(note.walletIdentity), note.nonce),
2431
+ await (0, import_core5.computeNoteIdentity)(BigInt(note.walletIdentity), note.nonce),
1724
2432
  note.tokenAddress,
1725
2433
  note.amount
1726
2434
  ) !== input.commitment) {
@@ -1776,14 +2484,14 @@ var import_protocol5 = require("@invisi-labs/protocol");
1776
2484
 
1777
2485
  // src/session/prepare-credit.ts
1778
2486
  var import_ethers4 = require("ethers");
1779
- var import_core6 = require("@invisi-labs/core");
2487
+ var import_core7 = require("@invisi-labs/core");
1780
2488
  var import_protocol4 = require("@invisi-labs/protocol");
1781
2489
 
1782
2490
  // src/session/credit-values.ts
1783
- var import_core5 = require("@invisi-labs/core");
2491
+ var import_core6 = require("@invisi-labs/core");
1784
2492
  async function creditLeaf(state) {
1785
2493
  const n = state.note;
1786
- return (0, import_core5.computeCreditCommitment)(
2494
+ return (0, import_core6.computeCreditCommitment)(
1787
2495
  n.chainId,
1788
2496
  n.spenderWalletIdentity,
1789
2497
  n.ownerWalletIdentity,
@@ -1793,7 +2501,8 @@ async function creditLeaf(state) {
1793
2501
  n.amount,
1794
2502
  n.nonce,
1795
2503
  n.expiry,
1796
- await (0, import_core5.computeCreditSharedKeyHash)(n.creditSharedKey)
2504
+ await (0, import_core6.computeCreditSharedKeyHash)(n.creditSharedKey),
2505
+ n
1797
2506
  );
1798
2507
  }
1799
2508
 
@@ -1812,7 +2521,7 @@ var CreditPreparation = class {
1812
2521
  return value;
1813
2522
  }
1814
2523
  async seal(input, frame) {
1815
- const state = (0, import_core6.normalizeCreditDeliveryState)(input);
2524
+ const state = (0, import_core7.normalizeCreditDeliveryState)(input);
1816
2525
  const commitment = await creditLeaf(state);
1817
2526
  const context = {
1818
2527
  chainId: frame.context.chainId,
@@ -1824,9 +2533,9 @@ var CreditPreparation = class {
1824
2533
  const keys = role === "owner" ? state.ownerReceivingKeys : state.spenderReceivingKeys;
1825
2534
  return {
1826
2535
  ciphertext: (0, import_ethers4.hexlify)(
1827
- await (0, import_core6.encryptCreditNote)(keys.viewingPublicKey, state, { ...context, role })
2536
+ await (0, import_core7.encryptCreditNote)(keys.viewingPublicKey, state, { ...context, role })
1828
2537
  ),
1829
- clue: (0, import_ethers4.hexlify)((0, import_core6.createClue)(keys.clueKey))
2538
+ clue: (0, import_ethers4.hexlify)((0, import_core7.createClue)(keys.clueKey))
1830
2539
  };
1831
2540
  })
1832
2541
  );
@@ -1837,14 +2546,14 @@ var CreditPreparation = class {
1837
2546
  if (!stored || stored.spent !== "unspent" || stored.role !== role) {
1838
2547
  throw new Error(`confirmed unspent ${role} Credit is unavailable`);
1839
2548
  }
1840
- const state = (0, import_core6.normalizeCreditDeliveryState)(stored.state);
2549
+ const state = (0, import_core7.normalizeCreditDeliveryState)(stored.state);
1841
2550
  const n = state.note;
1842
2551
  if ((role === "owner" ? n.ownerWalletIdentity : n.spenderWalletIdentity) !== this.runtime.scope.walletIdentity || n.chainId !== frame.context.chainId || n.protocolAddress !== BigInt(frame.context.protocolAddress) || n.tokenAddress !== BigInt(frame.context.tokenAddress) || await creditLeaf(state) !== commitment) {
1843
2552
  throw new Error("Credit role, commitment or deployment mismatch");
1844
2553
  }
1845
2554
  const proof = await this.#prepare.membership(stored, frame);
1846
2555
  const path = [...proof.path];
1847
- const nullifier = await (0, import_core6.computeCreditNullifier)(n.chainId, n.creditSharedKey, commitment);
2556
+ const nullifier = await (0, import_core7.computeCreditNullifier)(n.chainId, n.creditSharedKey, commitment);
1848
2557
  await this.#prepare.assertUnspent([nullifier], frame);
1849
2558
  return {
1850
2559
  input: {
@@ -1881,7 +2590,7 @@ var CreditPreparation = class {
1881
2590
  positiveAmount(options.amount, 126);
1882
2591
  const frame = await this.#prepare.frame(options.deadline);
1883
2592
  const expiry = this.expiry(options.expiry, frame);
1884
- const spender = await import_core6.ReceivingAddress.parse(options.spender).resolve(
2593
+ const spender = await import_core7.ReceivingAddress.parse(options.spender).resolve(
1885
2594
  this.runtime.options.addressResolver
1886
2595
  );
1887
2596
  const owner = await this.runtime.options.wallet.getReceivingAddress().resolve(this.runtime.options.addressResolver);
@@ -1900,10 +2609,16 @@ var CreditPreparation = class {
1900
2609
  spenderWalletIdentity: spender.walletIdentity,
1901
2610
  ownerPayout: BigInt(ownerPayout),
1902
2611
  spenderPayout: BigInt(spenderPayout),
2612
+ ...(0, import_core7.normalizeCreditPolicy)({
2613
+ singleLimit: options.singleLimit ?? 0n,
2614
+ dailyLimit: options.dailyLimit ?? 0n,
2615
+ monthlyLimit: options.monthlyLimit ?? 0n
2616
+ }),
1903
2617
  amount: options.amount,
2618
+ ...options.memo === void 0 ? {} : { memo: options.memo },
1904
2619
  expiry,
1905
- nonce: (0, import_core6.generateNonce)(),
1906
- creditSharedKey: (0, import_core6.generateCreditSharedKey)()
2620
+ nonce: (0, import_core7.generateNonce)(),
2621
+ creditSharedKey: (0, import_core7.generateCreditSharedKey)()
1907
2622
  },
1908
2623
  ownerReceivingKeys: owner.getReceivingKeys(),
1909
2624
  spenderReceivingKeys: spender.getReceivingKeys()
@@ -1992,7 +2707,19 @@ var CreditPreparation = class {
1992
2707
  }
1993
2708
  const amount = positiveAmount(old.note.amount + options.additionalAmount, 126);
1994
2709
  const output = await this.seal(
1995
- { ...old, note: { ...old.note, amount, expiry, nonce: (0, import_core6.generateNonce)() } },
2710
+ {
2711
+ ...old,
2712
+ note: {
2713
+ ...old.note,
2714
+ singleLimit: options.singleLimit ?? old.note.singleLimit ?? 0n,
2715
+ dailyLimit: options.dailyLimit ?? old.note.dailyLimit ?? 0n,
2716
+ monthlyLimit: options.monthlyLimit ?? old.note.monthlyLimit ?? 0n,
2717
+ amount,
2718
+ expiry,
2719
+ nonce: (0, import_core7.generateNonce)(),
2720
+ ...options.memo === void 0 ? {} : { memo: options.memo }
2721
+ }
2722
+ },
1996
2723
  frame
1997
2724
  );
1998
2725
  return this.creation(
@@ -2038,6 +2765,7 @@ var CreditPreparation = class {
2038
2765
  }
2039
2766
  sources.set(member.source.treeId, member.source.merkleRoot);
2040
2767
  amounts.push(amount);
2768
+ const usage = (0, import_core7.applyCreditDrawUsage)(n, amount, frame.block.timestamp);
2041
2769
  const remaining = n.amount - amount;
2042
2770
  if (remaining === 0n) {
2043
2771
  remainders.push((0, import_protocol4.word)(0n));
@@ -2057,8 +2785,10 @@ var CreditPreparation = class {
2057
2785
  ...state,
2058
2786
  note: {
2059
2787
  ...n,
2788
+ ...usage,
2060
2789
  amount: remaining,
2061
- nonce: await (0, import_core6.deriveRemainderNonce)(...args)
2790
+ ...options.credits[i].memo === void 0 ? {} : { memo: options.credits[i].memo },
2791
+ nonce: await (0, import_core7.deriveRemainderNonce)(...args)
2062
2792
  }
2063
2793
  },
2064
2794
  frame
@@ -2066,7 +2796,7 @@ var CreditPreparation = class {
2066
2796
  outputs.push(output);
2067
2797
  remainders.push(output.commitment);
2068
2798
  recoveryAmounts.push(
2069
- (0, import_protocol4.word)((remaining + await (0, import_core6.computeCreditRecoveryPad)(...args)) % import_core6.FIELD_MODULUS)
2799
+ (0, import_protocol4.word)((remaining + await (0, import_core7.computeCreditRecoveryPad)(...args)) % import_core7.FIELD_MODULUS)
2070
2800
  );
2071
2801
  deliveries.push(...output.deliveries);
2072
2802
  }
@@ -2739,7 +3469,7 @@ var EthersFundingVerifier = class {
2739
3469
  };
2740
3470
 
2741
3471
  // src/Invisi.ts
2742
- var import_core14 = require("@invisi-labs/core");
3472
+ var import_core15 = require("@invisi-labs/core");
2743
3473
 
2744
3474
  // src/session/codec.ts
2745
3475
  function encode(value) {
@@ -2850,7 +3580,7 @@ function readProtocolLogs(receipt, protocolAddress) {
2850
3580
 
2851
3581
  // src/session/discovery.ts
2852
3582
  var import_ethers9 = require("ethers");
2853
- var import_core7 = require("@invisi-labs/core");
3583
+ var import_core8 = require("@invisi-labs/core");
2854
3584
  var import_protocol6 = require("@invisi-labs/protocol");
2855
3585
  var EVENTS = /* @__PURE__ */ new Set([
2856
3586
  "CommitmentsInserted",
@@ -2994,25 +3724,27 @@ function extractDeliveryCandidates(logs, context, confirmedThrough) {
2994
3724
  const tokens = array(a.tokens);
2995
3725
  const cs = array(a.commitments), tree = integer(a.treeId), start = index(a.startLeafIndex), packed = a.packedDeliveries;
2996
3726
  check4(
2997
- typeof packed === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(packed) && packed.length === 2 + 452 * cs.length,
3727
+ typeof packed === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(packed),
2998
3728
  "invalid packed deliveries"
2999
3729
  );
3000
3730
  check4(tokens.length === cs.length, "batch token count mismatch");
3731
+ check4(start + cs.length <= 65536, "batch exceeds tree capacity");
3732
+ let offset = 2;
3001
3733
  cs.forEach((c, i) => {
3002
- const segment = packed.slice(2 + 452 * i, 2 + 452 * (i + 1));
3003
- add(
3004
- log,
3005
- tree,
3006
- start + i,
3007
- c,
3008
- "funds",
3009
- {
3010
- ciphertext: `0x${segment.slice(0, 316)}`,
3011
- clue: `0x${segment.slice(316)}`
3012
- },
3013
- tokens[i]
3734
+ check4(offset + 4 <= packed.length, "truncated delivery length prefix");
3735
+ const length = Number.parseInt(packed.slice(offset, offset + 4), 16);
3736
+ offset += 4;
3737
+ check4(
3738
+ length >= 160 && length <= 416 && offset + length * 2 + 136 <= packed.length,
3739
+ "invalid packed delivery length"
3014
3740
  );
3741
+ const ciphertext = `0x${packed.slice(offset, offset + length * 2)}`;
3742
+ offset += length * 2;
3743
+ const clue = `0x${packed.slice(offset, offset + 136)}`;
3744
+ offset += 136;
3745
+ add(log, tree, start + i, c, "funds", { ciphertext, clue }, tokens[i]);
3015
3746
  });
3747
+ check4(offset === packed.length, "trailing packed delivery bytes");
3016
3748
  } else if (log.eventName === "CreditCreated") creation(log, a, a);
3017
3749
  else if (log.eventName === "CreditToppedUp")
3018
3750
  creation(log, a, object(object(a.params).creation));
@@ -3038,7 +3770,7 @@ function extractDeliveryCandidates(logs, context, confirmedThrough) {
3038
3770
  }
3039
3771
  async function decryptCandidates(logs, options) {
3040
3772
  contextCheck(options.context);
3041
- (0, import_core7.decodeAddress)(import_core7.ReceivingAddress.fromIdentity(options.viewing.walletIdentity).toString());
3773
+ (0, import_core8.decodeAddress)(import_core8.ReceivingAddress.fromIdentity(options.viewing.walletIdentity).toString());
3042
3774
  check4(
3043
3775
  !logs.some(
3044
3776
  (log) => log.address.toLowerCase() === options.context.protocolAddress.toLowerCase() && log.removed
@@ -3326,7 +4058,7 @@ function mergeReceiptRecords(state, batch) {
3326
4058
  }
3327
4059
 
3328
4060
  // src/session/store.ts
3329
- var import_core8 = require("@invisi-labs/core");
4061
+ var import_core9 = require("@invisi-labs/core");
3330
4062
  var import_sha2562 = require("@noble/hashes/sha256");
3331
4063
  var import_utils2 = require("@noble/hashes/utils");
3332
4064
  function scopeKey(scope) {
@@ -3379,12 +4111,12 @@ function validateState(state, scope, revision) {
3379
4111
  throw new Error("invalid spent state");
3380
4112
  }
3381
4113
  for (const record of Object.values(state.credits)) {
3382
- const note = (0, import_core8.normalizeCreditDeliveryState)(record.state).note;
4114
+ const note = (0, import_core9.normalizeCreditDeliveryState)(record.state).note;
3383
4115
  if (note.chainId !== scope.chainId || note.protocolAddress !== BigInt(scope.protocolAddress) || !["owner", "spender"].includes(record.role) || (record.role === "owner" ? note.ownerWalletIdentity : note.spenderWalletIdentity).toLowerCase() !== scope.walletIdentity.toLowerCase() || !["unspent", "unknown", "spent"].includes(record.spent))
3384
4116
  throw new Error("invalid stored Credit context or role");
3385
4117
  }
3386
4118
  for (const record of [...Object.values(state.notes), ...Object.values(state.credits)]) {
3387
- if (!/^0x[0-9a-fA-F]{64}$/.test(record.commitment) || BigInt(record.commitment) <= 0n || BigInt(record.commitment) >= import_core8.FIELD_MODULUS || typeof record.treeId !== "bigint" || record.treeId < 1n || record.treeId >= 1n << 64n || !Number.isInteger(record.leafIndex) || record.leafIndex < 0 || record.leafIndex >= 65536 || typeof record.blockNumber !== "bigint" || record.blockNumber < 0n || !/^0x[0-9a-fA-F]{64}$/.test(record.blockHash))
4119
+ if (!/^0x[0-9a-fA-F]{64}$/.test(record.commitment) || BigInt(record.commitment) <= 0n || BigInt(record.commitment) >= import_core9.FIELD_MODULUS || typeof record.treeId !== "bigint" || record.treeId < 1n || record.treeId >= 1n << 64n || !Number.isInteger(record.leafIndex) || record.leafIndex < 0 || record.leafIndex >= 65536 || typeof record.blockNumber !== "bigint" || record.blockNumber < 0n || !/^0x[0-9a-fA-F]{64}$/.test(record.blockHash))
3388
4120
  throw new Error("invalid stored receipt position");
3389
4121
  }
3390
4122
  for (const [id, operation] of Object.entries(state.reservations))
@@ -3445,11 +4177,11 @@ var TransactionalWalletStore = class {
3445
4177
  };
3446
4178
 
3447
4179
  // src/session/Operation.ts
3448
- var import_core10 = require("@invisi-labs/core");
4180
+ var import_core11 = require("@invisi-labs/core");
3449
4181
  var import_protocol8 = require("@invisi-labs/protocol");
3450
4182
 
3451
4183
  // src/session/operation-confirmation.ts
3452
- var import_core9 = require("@invisi-labs/core");
4184
+ var import_core10 = require("@invisi-labs/core");
3453
4185
 
3454
4186
  // src/session/aggregate-receipt.ts
3455
4187
  var import_ethers11 = require("ethers");
@@ -3669,7 +4401,7 @@ async function confirmOperation(runtime, id, generation, hash2, signal) {
3669
4401
  if (credits.length) {
3670
4402
  const nullifiers = await Promise.all(
3671
4403
  credits.map(
3672
- async (record) => (0, import_core9.computeCreditNullifier)(
4404
+ async (record) => (0, import_core10.computeCreditNullifier)(
3673
4405
  plan.context.chainId,
3674
4406
  record.state.note.creditSharedKey,
3675
4407
  await creditLeaf(record.state)
@@ -4001,7 +4733,7 @@ var Operation = class _Operation {
4001
4733
  }
4002
4734
  const prover = this.#runtime.options.prover;
4003
4735
  if (!prover) {
4004
- throw new import_core10.MissingCapabilityError("prover");
4736
+ throw new import_core11.MissingCapabilityError("prover");
4005
4737
  }
4006
4738
  return this.stage(
4007
4739
  "proof",
@@ -4035,7 +4767,7 @@ var Operation = class _Operation {
4035
4767
  check7(p.kind === "shield" || this.#saved.proof, "proof must precede funding authorization");
4036
4768
  const signer = this.#runtime.options.fundingSigner;
4037
4769
  if (!signer) {
4038
- throw new import_core10.MissingCapabilityError("EVM funding signer");
4770
+ throw new import_core11.MissingCapabilityError("EVM funding signer");
4039
4771
  }
4040
4772
  check7(
4041
4773
  signer.address.toLowerCase() === p.funding.payer.toLowerCase(),
@@ -4226,7 +4958,7 @@ var Operation = class _Operation {
4226
4958
 
4227
4959
  // src/session/WalletSession.ts
4228
4960
  var import_ethers12 = require("ethers");
4229
- var import_core13 = require("@invisi-labs/core");
4961
+ var import_core14 = require("@invisi-labs/core");
4230
4962
 
4231
4963
  // src/session/refresh.ts
4232
4964
  async function refreshWallet(runtime, options) {
@@ -4283,10 +5015,10 @@ async function refreshWallet(runtime, options) {
4283
5015
  }
4284
5016
 
4285
5017
  // src/session/WalletUpdater.ts
4286
- var import_core12 = require("@invisi-labs/core");
5018
+ var import_core13 = require("@invisi-labs/core");
4287
5019
 
4288
5020
  // src/session/inventory.ts
4289
- var import_core11 = require("@invisi-labs/core");
5021
+ var import_core12 = require("@invisi-labs/core");
4290
5022
  var CanonicalConflict = class extends Error {
4291
5023
  };
4292
5024
  var CreditMetadataMismatch = class extends Error {
@@ -4338,10 +5070,10 @@ var InventoryProcessor = class {
4338
5070
  }
4339
5071
  async creditNullifier(state) {
4340
5072
  const n = state.note;
4341
- return (0, import_core11.computeCreditNullifier)(
5073
+ return (0, import_core12.computeCreditNullifier)(
4342
5074
  n.chainId,
4343
5075
  n.creditSharedKey,
4344
- await (0, import_core11.computeCreditCommitment)(
5076
+ await (0, import_core12.computeCreditCommitment)(
4345
5077
  n.chainId,
4346
5078
  n.spenderWalletIdentity,
4347
5079
  n.ownerWalletIdentity,
@@ -4351,7 +5083,8 @@ var InventoryProcessor = class {
4351
5083
  n.amount,
4352
5084
  n.nonce,
4353
5085
  n.expiry,
4354
- await (0, import_core11.computeCreditSharedKeyHash)(n.creditSharedKey)
5086
+ await (0, import_core12.computeCreditSharedKeyHash)(n.creditSharedKey),
5087
+ n
4355
5088
  )
4356
5089
  );
4357
5090
  }
@@ -4398,6 +5131,9 @@ var InventoryProcessor = class {
4398
5131
  };
4399
5132
  for (const event of logs) {
4400
5133
  if (event.eventName === "CreditDraw") {
5134
+ const block = await this.#options.reader.getBlock(event.blockNumber);
5135
+ if (block.hash !== event.blockHash)
5136
+ throw new CanonicalConflict("draw block changed during Credit recovery");
4401
5137
  const args = event.args;
4402
5138
  const params = args.params;
4403
5139
  const indices = args.remainderLeafIndices;
@@ -4411,10 +5147,11 @@ var InventoryProcessor = class {
4411
5147
  previous.state.note.expiry === params.expiries[index2],
4412
5148
  "draw recovery expiry mismatch"
4413
5149
  );
4414
- const remainder = await (0, import_core11.recoverCreditRemainder)(
5150
+ const remainder = await (0, import_core12.recoverCreditRemainder)(
4415
5151
  context,
4416
5152
  previous.state.note,
4417
5153
  {
5154
+ timestamp: block.timestamp,
4418
5155
  creditNullifier: nullifier,
4419
5156
  remainderCommitment: params.remainderCommitments[index2],
4420
5157
  recoveryAmount: BigInt(params.recoveryAmounts[index2])
@@ -4423,6 +5160,10 @@ var InventoryProcessor = class {
4423
5160
  if (!remainder) {
4424
5161
  continue;
4425
5162
  }
5163
+ const child = foundByKey.get(
5164
+ params.remainderCommitments[index2] + ":" + previous.role
5165
+ );
5166
+ const memo = child?.state.note.memo;
4426
5167
  const record = {
4427
5168
  commitment: params.remainderCommitments[index2],
4428
5169
  treeId: BigInt(args.outputTreeId),
@@ -4431,7 +5172,13 @@ var InventoryProcessor = class {
4431
5172
  blockHash: event.blockHash,
4432
5173
  transactionHash: event.transactionHash,
4433
5174
  role: previous.role,
4434
- state: { ...clone(previous.state), note: remainder },
5175
+ state: {
5176
+ ...clone(previous.state),
5177
+ note: {
5178
+ ...remainder,
5179
+ ...memo === void 0 ? {} : { memo: (0, import_core12.encodeMemo)(memo) }
5180
+ }
5181
+ },
4435
5182
  receivingKeySource: { kind: "draw", commitment: previous.commitment },
4436
5183
  spent: "unknown"
4437
5184
  };
@@ -4508,7 +5255,7 @@ var WalletUpdater = class extends InventoryProcessor {
4508
5255
  }
4509
5256
  async run(batch, options) {
4510
5257
  const { reader, protocol, scope, store, viewing } = this.#options;
4511
- const nullifier = import_core12.NullifierCapability.fromIdentity(scope.walletIdentity);
5258
+ const nullifier = import_core13.NullifierCapability.fromIdentity(scope.walletIdentity);
4512
5259
  const { signal, reset } = options;
4513
5260
  signal?.throwIfAborted();
4514
5261
  const context = protocol.context;
@@ -4729,7 +5476,7 @@ var WalletSession = class {
4729
5476
  /** Delegate sending to ethers; managed operations additionally retain the resulting hash. */
4730
5477
  async sendTransaction(input, options = {}) {
4731
5478
  const signer = this.#options.signer;
4732
- if (!signer) throw new import_core13.MissingCapabilityError("ethers signer");
5479
+ if (!signer) throw new import_core14.MissingCapabilityError("ethers signer");
4733
5480
  const operation = input instanceof Operation ? input : void 0;
4734
5481
  if (operation && this.#sending.has(operation.id))
4735
5482
  throw new Error("operation is already being sent by this session");
@@ -4737,12 +5484,12 @@ var WalletSession = class {
4737
5484
  const overrides = { ...options };
4738
5485
  const plain = operation ? void 0 : { ...input };
4739
5486
  try {
4740
- if (!signer.provider) throw new import_core13.MissingCapabilityError("connected ethers signer");
5487
+ if (!signer.provider) throw new import_core14.MissingCapabilityError("connected ethers signer");
4741
5488
  if ((await signer.provider.getNetwork()).chainId !== this.protocol.context.chainId) {
4742
5489
  throw new Error("signer-provider session chain mismatch");
4743
5490
  }
4744
5491
  if (operation) {
4745
- if (!this.#options.store) throw new import_core13.MissingCapabilityError("wallet store");
5492
+ if (!this.#options.store) throw new import_core14.MissingCapabilityError("wallet store");
4746
5493
  const state = await this.#options.store.readSnapshot(this.scope);
4747
5494
  if (!state.operations[operation.id])
4748
5495
  throw new Error("operation does not belong to this wallet session");
@@ -4773,10 +5520,10 @@ var WalletSession = class {
4773
5520
  runtime(tokenAddress) {
4774
5521
  const options = this.#options;
4775
5522
  if (!options.store) {
4776
- throw new import_core13.MissingCapabilityError("wallet store");
5523
+ throw new import_core14.MissingCapabilityError("wallet store");
4777
5524
  }
4778
5525
  if (!options.chainReader) {
4779
- throw new import_core13.MissingCapabilityError("chain reader");
5526
+ throw new import_core14.MissingCapabilityError("chain reader");
4780
5527
  }
4781
5528
  return {
4782
5529
  options: { ...options, protocol: options.protocol.forToken(tokenAddress) },
@@ -4790,7 +5537,7 @@ var WalletSession = class {
4790
5537
  if (this.#updater) return this.#updater;
4791
5538
  const options = this.#options;
4792
5539
  if (!options.store || !options.chainReader || !options.protocolRpc)
4793
- throw new import_core13.MissingCapabilityError("wallet store, chain reader and Protocol RPC");
5540
+ throw new import_core14.MissingCapabilityError("wallet store, chain reader and Protocol RPC");
4794
5541
  const viewing = options.viewing ?? options.wallet.getViewer();
4795
5542
  const receivingAddress = options.wallet.getReceivingAddress();
4796
5543
  const receivingKeys = receivingAddress.kind === "long" ? receivingAddress.getReceivingKeys() : void 0;
@@ -4808,7 +5555,7 @@ var WalletSession = class {
4808
5555
  async balance(tokenAddress) {
4809
5556
  const store = this.#options.store;
4810
5557
  if (!store) {
4811
- throw new import_core13.MissingCapabilityError("wallet store");
5558
+ throw new import_core14.MissingCapabilityError("wallet store");
4812
5559
  }
4813
5560
  return walletBalance(await store.readSnapshot(this.scope), (0, import_ethers12.getAddress)(tokenAddress));
4814
5561
  }
@@ -4816,8 +5563,8 @@ var WalletSession = class {
4816
5563
  async refresh(options) {
4817
5564
  const provider = this.#options.protocolRpc;
4818
5565
  const reader = this.#options.chainReader;
4819
- if (!reader) throw new import_core13.MissingCapabilityError("chain reader");
4820
- if (!provider) throw new import_core13.MissingCapabilityError("Protocol RPC");
5566
+ if (!reader) throw new import_core14.MissingCapabilityError("chain reader");
5567
+ if (!provider) throw new import_core14.MissingCapabilityError("Protocol RPC");
4821
5568
  const updater = this.updater();
4822
5569
  const request = {
4823
5570
  ...options,
@@ -4876,7 +5623,7 @@ var WalletSession = class {
4876
5623
  }
4877
5624
  async resume(operationId) {
4878
5625
  const store = this.#options.store;
4879
- if (!store) throw new import_core13.MissingCapabilityError("wallet store");
5626
+ if (!store) throw new import_core14.MissingCapabilityError("wallet store");
4880
5627
  const state = await store.readSnapshot(this.scope);
4881
5628
  const saved = state.operations[operationId]?.payload;
4882
5629
  if (!saved?.plan) throw new Error("operation not found");
@@ -4915,7 +5662,7 @@ var Invisi = class {
4915
5662
  const combined = { ...this.#options, ...selected };
4916
5663
  const { provider, signer, ...runtime } = combined;
4917
5664
  const reader = combined.chainReader ?? (provider ? new EthersChainReader(provider) : void 0);
4918
- if (!reader) throw new import_core14.MissingCapabilityError("chain reader");
5665
+ if (!reader) throw new import_core15.MissingCapabilityError("chain reader");
4919
5666
  if (provider && (await provider.getNetwork()).chainId !== selected.protocol.context.chainId)
4920
5667
  throw new Error("provider deployment chain mismatch");
4921
5668
  await selected.protocol.validateDeployment(reader);
@@ -4923,7 +5670,7 @@ var Invisi = class {
4923
5670
  runtime.protocolRpc = runtime.protocolRpc.withReader(reader);
4924
5671
  }
4925
5672
  if (signer) {
4926
- if (!provider) throw new import_core14.MissingCapabilityError("provider for signer");
5673
+ if (!provider) throw new import_core15.MissingCapabilityError("provider for signer");
4927
5674
  if (!signer.provider) throw new Error("signer must be connected to a provider");
4928
5675
  if ((await signer.provider.getNetwork()).chainId !== selected.protocol.context.chainId)
4929
5676
  throw new Error("signer-provider deployment chain mismatch");
@@ -5014,7 +5761,7 @@ var Invisi = class {
5014
5761
  };
5015
5762
 
5016
5763
  // src/index.ts
5017
- var import_core15 = require("@invisi-labs/core");
5764
+ var import_core16 = require("@invisi-labs/core");
5018
5765
  var import_protocol10 = require("@invisi-labs/protocol");
5019
5766
  var import_rpc3 = require("@invisi-labs/rpc");
5020
5767
 
@@ -5132,6 +5879,7 @@ var EncryptedWalletCodec = class _EncryptedWalletCodec {
5132
5879
  DisclosureVerifier,
5133
5880
  EncryptedWalletCodec,
5134
5881
  Invisi,
5882
+ MAX_MEMO_BYTES,
5135
5883
  MissingCapabilityError,
5136
5884
  NullifierCapability,
5137
5885
  Operation,
@@ -5144,7 +5892,9 @@ var EncryptedWalletCodec = class _EncryptedWalletCodec {
5144
5892
  Wallet,
5145
5893
  WalletAuthorization,
5146
5894
  WalletSession,
5895
+ decodeMemoText,
5147
5896
  defineGasBenchmarks,
5897
+ encodeMemo,
5148
5898
  walletBalance
5149
5899
  });
5150
5900
  //# sourceMappingURL=index.cjs.map