@invisi-labs/sdk 1.1.2 → 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,32 +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
- MAX_MEMO_BYTES: () => import_core15.MAX_MEMO_BYTES,
30
- MissingCapabilityError: () => import_core15.MissingCapabilityError,
31
- NullifierCapability: () => import_core15.NullifierCapability,
29
+ MAX_MEMO_BYTES: () => import_core16.MAX_MEMO_BYTES,
30
+ MissingCapabilityError: () => import_core16.MissingCapabilityError,
31
+ NullifierCapability: () => import_core16.NullifierCapability,
32
32
  Operation: () => Operation,
33
33
  PreparedTransaction: () => PreparedTransaction,
34
34
  Protocol: () => import_protocol10.Protocol,
35
35
  ProtocolRpcClient: () => ProtocolRpcClient2,
36
36
  ProtocolRpcError: () => import_rpc3.ProtocolRpcError,
37
37
  RegistrationOperation: () => import_protocol10.RegistrationOperation,
38
- ViewingCapability: () => import_core15.ViewingCapability,
39
- Wallet: () => import_core15.Wallet,
40
- WalletAuthorization: () => import_core15.WalletAuthorization,
38
+ ViewingCapability: () => import_core16.ViewingCapability,
39
+ Wallet: () => import_core16.Wallet,
40
+ WalletAuthorization: () => import_core16.WalletAuthorization,
41
41
  WalletSession: () => WalletSession,
42
- decodeMemoText: () => import_core15.decodeMemoText,
42
+ decodeMemoText: () => import_core16.decodeMemoText,
43
43
  defineGasBenchmarks: () => defineGasBenchmarks,
44
- encodeMemo: () => import_core15.encodeMemo,
44
+ encodeMemo: () => import_core16.encodeMemo,
45
45
  walletBalance: () => walletBalance
46
46
  });
47
47
  module.exports = __toCommonJS(src_exports);
48
48
 
49
49
  // src/session/operation-protocol.ts
50
+ var import_core = require("@invisi-labs/core");
50
51
  var import_protocol = require("@invisi-labs/protocol");
51
52
 
52
53
  // src/session/state.ts
@@ -240,6 +241,7 @@ async function witnessFor(protocol, plan, authorization) {
240
241
  }
241
242
  if (credit.draw) {
242
243
  return builder.drawCredit({
244
+ timestamp: plan.preparedAt.timestamp,
243
245
  params: credit.draw,
244
246
  deliveries: credit.deliveries,
245
247
  inputs: credit.inputs,
@@ -370,12 +372,836 @@ function operationExpired(plan, now) {
370
372
  const credit = plan.credit;
371
373
  if (credit?.topUp && now >= credit.topUp.previousExpiry) return true;
372
374
  if (credit?.creation && now >= credit.creation.expiry) return true;
373
- 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
+ }
374
381
  return false;
375
382
  }
376
383
 
377
384
  // src/data/gas-benchmarks.json
378
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
+ },
379
1205
  {
380
1206
  formatVersion: 1,
381
1207
  id: "protocol-92ef274-osaka-real",
@@ -800,190 +1626,6 @@ var gas_benchmarks_default = [
800
1626
  calldataBytes: 10116
801
1627
  }
802
1628
  ]
803
- },
804
- {
805
- id: "create-credit-1x1",
806
- shape: {
807
- kind: "create-credit",
808
- target: "evm",
809
- capacity: 10,
810
- noteInputs: 1,
811
- noteOutputs: 1,
812
- sourceTrees: 1,
813
- creditInputs: 0,
814
- creditOutputs: 1,
815
- creditRemainders: 0,
816
- funding: "none",
817
- permit: false,
818
- deliveryBytes: 1162
819
- },
820
- circuit: {
821
- circuitName: "create_credit",
822
- target: "evm",
823
- artifactSha256: "ab97cd5a036851a9748a5cfd8e6f9834e23090c8e95db4531aabfc37d3abb353",
824
- vkSha256: "fac0e65b768a28750323cca851990598af936611125b6cfa3f5c16b04c7d084f"
825
- },
826
- samples: [
827
- {
828
- gasUsed: "1627325",
829
- transactionHash: "0x7763d93a5b1e8797b5f4af2e1e5b1bb029a8b0f9f7b90bcc04f581947d826803",
830
- blockNumber: "49",
831
- blockHash: "0x93e51ae5e99c68dc642693d478e444330d8e26255ff5bb9aafc4a3f4e70d3a45",
832
- calldataBytes: 11940
833
- },
834
- {
835
- gasUsed: "1627385",
836
- transactionHash: "0xe246d59cafa2a26dddf21c8385dd843be4d4596388ebe23e936df84e7f906635",
837
- blockNumber: "49",
838
- blockHash: "0x3c24b2d6ed2a998562d34b49e0517515742a9b39d59aec38a9ac6b22be1b694b",
839
- calldataBytes: 11940
840
- },
841
- {
842
- gasUsed: "1627157",
843
- transactionHash: "0x2f7ed0b75435cc6a820d0cd90fd82d362f74787057413722b6eb3c6e37db87d3",
844
- blockNumber: "49",
845
- blockHash: "0x0a0301670b46017da772800c68bb941245ac1941c79fde9c85717632154e15ee",
846
- calldataBytes: 11940
847
- }
848
- ]
849
- },
850
- {
851
- id: "draw-credit-1-partial",
852
- shape: {
853
- kind: "draw-credit",
854
- target: "evm",
855
- capacity: 1,
856
- noteInputs: 0,
857
- noteOutputs: 0,
858
- sourceTrees: 1,
859
- creditInputs: 1,
860
- creditOutputs: 1,
861
- creditRemainders: 1,
862
- funding: "none",
863
- permit: false,
864
- deliveryBytes: 936
865
- },
866
- circuit: {
867
- circuitName: "credit_draw_slots1",
868
- target: "evm",
869
- artifactSha256: "f5e458790948f37a61a833fad52cf2cc3b26a59515d271de32e0caaa4e229eb5",
870
- vkSha256: "613699a440f50a0937e4c57e5152b5fdea42c31b10157d6b93226fef313df553"
871
- },
872
- samples: [
873
- {
874
- gasUsed: "1581294",
875
- transactionHash: "0xd438e22b0fa07a657279f182537e4996f1936f0881d5b7d637845f8ca2808aab",
876
- blockNumber: "49",
877
- blockHash: "0x9e384a3054530b1ff237a639bca1a559afb2b73b30e21c262aac85ebf480fc9b",
878
- calldataBytes: 11396
879
- },
880
- {
881
- gasUsed: "1581402",
882
- transactionHash: "0xa70ac3e7284b6e98f8591a6ba88e4ddfb23ecbd05343641d0532f34920e10b56",
883
- blockNumber: "49",
884
- blockHash: "0x37c5eb34ce96a841e96c36103a7ab65c1a3e08603dc9843efb0c0752c069f1d4",
885
- calldataBytes: 11396
886
- },
887
- {
888
- gasUsed: "1581174",
889
- transactionHash: "0xd062494979d0bc0e284ccb070f87b48f3e8e5befb6001f15a006dd2a4a72ca24",
890
- blockNumber: "49",
891
- blockHash: "0x12840d920f14163b2d29491f28cee616e1bb9fd9514a4debe10ae35256345fc1",
892
- calldataBytes: 11396
893
- }
894
- ]
895
- },
896
- {
897
- id: "top-up-credit-1x1",
898
- shape: {
899
- kind: "top-up-credit",
900
- target: "evm",
901
- capacity: 10,
902
- noteInputs: 1,
903
- noteOutputs: 1,
904
- sourceTrees: 2,
905
- creditInputs: 1,
906
- creditOutputs: 1,
907
- creditRemainders: 0,
908
- funding: "none",
909
- permit: false,
910
- deliveryBytes: 1162
911
- },
912
- circuit: {
913
- circuitName: "credit_top_up",
914
- target: "evm",
915
- artifactSha256: "ee9dbcf8be6f6c09478190996e90b1d39d4a10a00245950f69fc1d2c329c6e9b",
916
- vkSha256: "0c369fec0469b60baebb3be650bad42f3ccae6f0ff139cce6ad9a3f451ed7513"
917
- },
918
- samples: [
919
- {
920
- gasUsed: "1666948",
921
- transactionHash: "0x1403da01167962a4349d2655ea217bfcfc1a2390138bea0279792c44b4381dd2",
922
- blockNumber: "49",
923
- blockHash: "0xcb554ffcdb4afe5f6458e5d23ffbdd1fdbef9c23f982343065772c0b3e3dd633",
924
- calldataBytes: 12100
925
- },
926
- {
927
- gasUsed: "1666900",
928
- transactionHash: "0x3b5e54f29e3f888a443526cf23ab9255b3f0c7adf1d0d127c16b85f4c6a324d9",
929
- blockNumber: "49",
930
- blockHash: "0xeb304df6bdd24b249cac3197b543b0eaa6381ed75ad812dff248f914864105ed",
931
- calldataBytes: 12100
932
- },
933
- {
934
- gasUsed: "1666780",
935
- transactionHash: "0x81c5ef25268a719275cb3b80618c2af291e1f7b3f91d7e82cc26bc894a8c332a",
936
- blockNumber: "49",
937
- blockHash: "0xfa42070d6349fc8d559b8bd4ad0ee6b79089107540c4472b9e492b8f5a6bd3e4",
938
- calldataBytes: 12100
939
- }
940
- ]
941
- },
942
- {
943
- id: "cancel-credit-1",
944
- shape: {
945
- kind: "cancel-credit",
946
- target: "evm",
947
- capacity: 1,
948
- noteInputs: 0,
949
- noteOutputs: 0,
950
- sourceTrees: 1,
951
- creditInputs: 1,
952
- creditOutputs: 0,
953
- creditRemainders: 0,
954
- funding: "none",
955
- permit: false,
956
- deliveryBytes: 0
957
- },
958
- circuit: {
959
- circuitName: "credit_cancel",
960
- target: "evm",
961
- artifactSha256: "d332453a2b8c2c544747ac8d5f01912c9757f48d986226fd6a9b0e24d8321474",
962
- vkSha256: "1f8a3c20cb081d6a90962556da3124919cc4e5675e59ad31562af39299da02fb"
963
- },
964
- samples: [
965
- {
966
- gasUsed: "998146",
967
- transactionHash: "0x97bc72692d241e2c344b912804f9939061db5ef59cf4bb23922d93812e382160",
968
- blockNumber: "49",
969
- blockHash: "0x2e09df4df84a1c25961386febe8404531bb5da274836d50cc15a26c91b433a98",
970
- calldataBytes: 9540
971
- },
972
- {
973
- gasUsed: "998134",
974
- transactionHash: "0x26c5067b12c2bc4b694070784e6b19d4855efa6e77c2422f0c6b1567f061570a",
975
- blockNumber: "49",
976
- blockHash: "0xdd3f20520c09e001374cab58387e52c82446db053539e30dad28b0de679a333c",
977
- calldataBytes: 9540
978
- },
979
- {
980
- gasUsed: "998230",
981
- transactionHash: "0x5dc09445a405150da1445c22f50d6dd10d8d428a6a3f41ee90db7d3574657e31",
982
- blockNumber: "49",
983
- blockHash: "0x5c8f8223a50d2c8d48188a2db28ffa33c1b150a2fb465e99db4430949db3664b",
984
- calldataBytes: 9540
985
- }
986
- ]
987
1629
  }
988
1630
  ]
989
1631
  }
@@ -1012,6 +1654,29 @@ function copyGasBenchmarks(profiles) {
1012
1654
  for (const p of copy) {
1013
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)
1014
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");
1015
1680
  for (const m of p.measurements) {
1016
1681
  if (!m.id || !m.samples.length || !["none", "caller", "signature"].includes(m.shape.funding) || typeof m.shape.permit !== "boolean")
1017
1682
  throw new Error("invalid gas benchmark measurement");
@@ -1091,11 +1756,20 @@ function estimateBenchmarkGas(plan, protocol, profiles) {
1091
1756
  );
1092
1757
  if (!request.deployment.runtimeCodeHash || !candidates.length)
1093
1758
  return { ...base, available: false, reason: "deployment-not-covered" };
1094
- for (const profile of candidates) {
1095
- const measurement = profile.measurements.find(
1759
+ const exact = candidates.flatMap(
1760
+ (profile) => profile.measurements.filter(
1096
1761
  (m) => shapeKeys.every((key) => m.shape[key] === request.shape[key]) && sameCircuit(m.circuit, request.circuit)
1097
- );
1098
- 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];
1099
1773
  const gas = measurement.samples.map((sample) => BigInt(sample.gasUsed));
1100
1774
  const count = BigInt(gas.length);
1101
1775
  return {
@@ -1125,14 +1799,20 @@ function estimateShapeGas(request, profiles = defaultProfiles) {
1125
1799
  const matching = measurements.filter(
1126
1800
  (measurement) => measurement.shape.kind === request.shape.kind && measurement.shape.target === request.shape.target && sameCircuit(measurement.circuit, request.circuit)
1127
1801
  );
1128
- const exact = matching.find(
1802
+ const exact = matching.filter(
1129
1803
  (measurement) => shapeKeys.every((key) => measurement.shape[key] === request.shape[key])
1130
1804
  );
1131
- if (exact) {
1132
- const gas = exact.samples.map((sample) => BigInt(sample.gasUsed));
1133
- const count = BigInt(gas.length);
1134
- 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) };
1135
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");
1136
1816
  const candidates = matching.length ? matching : measurements.filter(
1137
1817
  (measurement) => measurement.shape.kind === request.shape.kind && measurement.shape.target === request.shape.target
1138
1818
  );
@@ -1147,7 +1827,22 @@ function estimateShapeGas(request, profiles = defaultProfiles) {
1147
1827
  "deliveryBytes",
1148
1828
  ...!matching.length ? ["capacity"] : []
1149
1829
  ];
1150
- 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) => {
1151
1846
  let numerator = 1n;
1152
1847
  let denominator = 1n;
1153
1848
  for (const key of dimensions) {
@@ -1181,7 +1876,7 @@ var import_ethers6 = require("ethers");
1181
1876
 
1182
1877
  // src/session/operation-execution.ts
1183
1878
  var import_ethers2 = require("ethers");
1184
- var import_core = require("@invisi-labs/core");
1879
+ var import_core2 = require("@invisi-labs/core");
1185
1880
 
1186
1881
  // src/session/proof-integrity.ts
1187
1882
  var import_ethers = require("ethers");
@@ -1210,7 +1905,7 @@ async function authorizeOperation(plan, provider) {
1210
1905
  if (provider.walletIdentity !== plan.scope.walletIdentity)
1211
1906
  throw new Error("wallet authorization capability mismatch");
1212
1907
  const request = authorizationRequest(plan);
1213
- const digest = (0, import_core.computeWalletAuthorizationDigest)(request);
1908
+ const digest = (0, import_core2.computeWalletAuthorizationDigest)(request);
1214
1909
  const signed = await provider.authorize(structuredClone(request));
1215
1910
  if (signed.walletIdentity !== plan.scope.walletIdentity || signed.digest !== digest)
1216
1911
  throw new Error("wallet authorization statement mismatch");
@@ -1258,7 +1953,7 @@ async function signOperationFunding(saved, signer, verifier) {
1258
1953
  }
1259
1954
 
1260
1955
  // src/PreparedTransaction.ts
1261
- var import_core2 = require("@invisi-labs/core");
1956
+ var import_core3 = require("@invisi-labs/core");
1262
1957
  var import_protocol2 = require("@invisi-labs/protocol");
1263
1958
 
1264
1959
  // src/session/operation-preview.ts
@@ -1401,7 +2096,7 @@ var PreparedTransaction = class _PreparedTransaction {
1401
2096
  }
1402
2097
  const prover = "prove" in backendOrOptions ? backendOrOptions : this.#runtime.options.prover;
1403
2098
  if (!prover) {
1404
- throw new import_core2.MissingCapabilityError("prover");
2099
+ throw new import_core3.MissingCapabilityError("prover");
1405
2100
  }
1406
2101
  return this.stage(
1407
2102
  "proof",
@@ -1437,7 +2132,7 @@ var PreparedTransaction = class _PreparedTransaction {
1437
2132
  check2(p.kind === "shield" || this.#saved.proof, "proof must precede funding authorization");
1438
2133
  const signer = suppliedSigner ?? this.#runtime.options.fundingSigner;
1439
2134
  if (!signer) {
1440
- throw new import_core2.MissingCapabilityError("EVM funding signer");
2135
+ throw new import_core3.MissingCapabilityError("EVM funding signer");
1441
2136
  }
1442
2137
  check2(
1443
2138
  signer.address.toLowerCase() === p.funding.payer.toLowerCase(),
@@ -1518,21 +2213,21 @@ var PreparedTransaction = class _PreparedTransaction {
1518
2213
 
1519
2214
  // src/session/prepare-common.ts
1520
2215
  var import_ethers3 = require("ethers");
1521
- var import_core4 = require("@invisi-labs/core");
2216
+ var import_core5 = require("@invisi-labs/core");
1522
2217
  var import_protocol3 = require("@invisi-labs/protocol");
1523
2218
 
1524
2219
  // src/session/membership.ts
1525
- var import_core3 = require("@invisi-labs/core");
2220
+ var import_core4 = require("@invisi-labs/core");
1526
2221
  async function verifyMembership(reader, context, block, input, proof) {
1527
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))
1528
2223
  throw new Error("membership context/root mismatch");
1529
2224
  let root = BigInt(input.commitment);
1530
2225
  for (let i = 0; i < 16; i++) {
1531
2226
  const sibling = proof.path[i];
1532
- if (typeof sibling !== "bigint" || sibling < 0n || sibling >= import_core3.FIELD_MODULUS)
2227
+ if (typeof sibling !== "bigint" || sibling < 0n || sibling >= import_core4.FIELD_MODULUS)
1533
2228
  throw new Error("noncanonical membership path");
1534
2229
  root = BigInt(
1535
- 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])
1536
2231
  );
1537
2232
  }
1538
2233
  if (root !== BigInt(proof.root))
@@ -1592,7 +2287,15 @@ var Preparation = class {
1592
2287
  throw new Error("canonical wallet checkpoint changed; resync required");
1593
2288
  }
1594
2289
  }
1595
- 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
+ };
1596
2299
  }
1597
2300
  async assertBlock(frame) {
1598
2301
  if ((await this.runtime.reader.getBlock(frame.block.number)).hash !== frame.block.hash) {
@@ -1633,12 +2336,12 @@ var Preparation = class {
1633
2336
  }
1634
2337
  async output(payment, context, change = false) {
1635
2338
  positiveAmount(payment.amount);
1636
- const recipient = await import_core4.ReceivingAddress.parse(payment.to).resolve(
2339
+ const recipient = await import_core5.ReceivingAddress.parse(payment.to).resolve(
1637
2340
  this.runtime.options.addressResolver
1638
2341
  );
1639
- const memo = (0, import_core4.encodeMemo)(payment.memo);
1640
- const nonce = (0, import_core4.generateNonce)();
1641
- 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);
1642
2345
  const keys = recipient.getReceivingKeys();
1643
2346
  const note = {
1644
2347
  chainId: context.chainId,
@@ -1649,7 +2352,7 @@ var Preparation = class {
1649
2352
  ...memo.length === 0 ? {} : { memo },
1650
2353
  nonce
1651
2354
  };
1652
- const commitment = await (0, import_core4.computeNoteCommitment)(
2355
+ const commitment = await (0, import_core5.computeNoteCommitment)(
1653
2356
  context.chainId,
1654
2357
  identity,
1655
2358
  note.tokenAddress,
@@ -1663,20 +2366,20 @@ var Preparation = class {
1663
2366
  change,
1664
2367
  delivery: {
1665
2368
  ciphertext: (0, import_ethers3.hexlify)(
1666
- await (0, import_core4.encryptPrivateTransferNote)(keys.viewingPublicKey, note, {
2369
+ await (0, import_core5.encryptPrivateTransferNote)(keys.viewingPublicKey, note, {
1667
2370
  chainId: context.chainId,
1668
2371
  protocolAddress: note.protocolAddress,
1669
2372
  outputCommitment: commitment
1670
2373
  })
1671
2374
  ),
1672
- clue: (0, import_ethers3.hexlify)((0, import_core4.createClue)(keys.clueKey))
2375
+ clue: (0, import_ethers3.hexlify)((0, import_core5.createClue)(keys.clueKey))
1673
2376
  }
1674
2377
  };
1675
2378
  }
1676
2379
  async membership(input, frame) {
1677
2380
  const { options, reader } = this.runtime;
1678
2381
  if (!options.protocolRpc)
1679
- throw new import_core4.MissingCapabilityError("Protocol RPC membership provider");
2382
+ throw new import_core5.MissingCapabilityError("Protocol RPC membership provider");
1680
2383
  const root = this.#roots.get(input.treeId);
1681
2384
  const proof = await options.protocolRpc.getMembership(
1682
2385
  frame.context,
@@ -1723,9 +2426,9 @@ var Preparation = class {
1723
2426
  for (const input of selected) {
1724
2427
  const note = input.note;
1725
2428
  const c = frame.context;
1726
- 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)(
1727
2430
  c.chainId,
1728
- await (0, import_core4.computeNoteIdentity)(BigInt(note.walletIdentity), note.nonce),
2431
+ await (0, import_core5.computeNoteIdentity)(BigInt(note.walletIdentity), note.nonce),
1729
2432
  note.tokenAddress,
1730
2433
  note.amount
1731
2434
  ) !== input.commitment) {
@@ -1781,14 +2484,14 @@ var import_protocol5 = require("@invisi-labs/protocol");
1781
2484
 
1782
2485
  // src/session/prepare-credit.ts
1783
2486
  var import_ethers4 = require("ethers");
1784
- var import_core6 = require("@invisi-labs/core");
2487
+ var import_core7 = require("@invisi-labs/core");
1785
2488
  var import_protocol4 = require("@invisi-labs/protocol");
1786
2489
 
1787
2490
  // src/session/credit-values.ts
1788
- var import_core5 = require("@invisi-labs/core");
2491
+ var import_core6 = require("@invisi-labs/core");
1789
2492
  async function creditLeaf(state) {
1790
2493
  const n = state.note;
1791
- return (0, import_core5.computeCreditCommitment)(
2494
+ return (0, import_core6.computeCreditCommitment)(
1792
2495
  n.chainId,
1793
2496
  n.spenderWalletIdentity,
1794
2497
  n.ownerWalletIdentity,
@@ -1798,7 +2501,8 @@ async function creditLeaf(state) {
1798
2501
  n.amount,
1799
2502
  n.nonce,
1800
2503
  n.expiry,
1801
- await (0, import_core5.computeCreditSharedKeyHash)(n.creditSharedKey)
2504
+ await (0, import_core6.computeCreditSharedKeyHash)(n.creditSharedKey),
2505
+ n
1802
2506
  );
1803
2507
  }
1804
2508
 
@@ -1817,7 +2521,7 @@ var CreditPreparation = class {
1817
2521
  return value;
1818
2522
  }
1819
2523
  async seal(input, frame) {
1820
- const state = (0, import_core6.normalizeCreditDeliveryState)(input);
2524
+ const state = (0, import_core7.normalizeCreditDeliveryState)(input);
1821
2525
  const commitment = await creditLeaf(state);
1822
2526
  const context = {
1823
2527
  chainId: frame.context.chainId,
@@ -1829,9 +2533,9 @@ var CreditPreparation = class {
1829
2533
  const keys = role === "owner" ? state.ownerReceivingKeys : state.spenderReceivingKeys;
1830
2534
  return {
1831
2535
  ciphertext: (0, import_ethers4.hexlify)(
1832
- await (0, import_core6.encryptCreditNote)(keys.viewingPublicKey, state, { ...context, role })
2536
+ await (0, import_core7.encryptCreditNote)(keys.viewingPublicKey, state, { ...context, role })
1833
2537
  ),
1834
- clue: (0, import_ethers4.hexlify)((0, import_core6.createClue)(keys.clueKey))
2538
+ clue: (0, import_ethers4.hexlify)((0, import_core7.createClue)(keys.clueKey))
1835
2539
  };
1836
2540
  })
1837
2541
  );
@@ -1842,14 +2546,14 @@ var CreditPreparation = class {
1842
2546
  if (!stored || stored.spent !== "unspent" || stored.role !== role) {
1843
2547
  throw new Error(`confirmed unspent ${role} Credit is unavailable`);
1844
2548
  }
1845
- const state = (0, import_core6.normalizeCreditDeliveryState)(stored.state);
2549
+ const state = (0, import_core7.normalizeCreditDeliveryState)(stored.state);
1846
2550
  const n = state.note;
1847
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) {
1848
2552
  throw new Error("Credit role, commitment or deployment mismatch");
1849
2553
  }
1850
2554
  const proof = await this.#prepare.membership(stored, frame);
1851
2555
  const path = [...proof.path];
1852
- 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);
1853
2557
  await this.#prepare.assertUnspent([nullifier], frame);
1854
2558
  return {
1855
2559
  input: {
@@ -1886,7 +2590,7 @@ var CreditPreparation = class {
1886
2590
  positiveAmount(options.amount, 126);
1887
2591
  const frame = await this.#prepare.frame(options.deadline);
1888
2592
  const expiry = this.expiry(options.expiry, frame);
1889
- const spender = await import_core6.ReceivingAddress.parse(options.spender).resolve(
2593
+ const spender = await import_core7.ReceivingAddress.parse(options.spender).resolve(
1890
2594
  this.runtime.options.addressResolver
1891
2595
  );
1892
2596
  const owner = await this.runtime.options.wallet.getReceivingAddress().resolve(this.runtime.options.addressResolver);
@@ -1905,11 +2609,16 @@ var CreditPreparation = class {
1905
2609
  spenderWalletIdentity: spender.walletIdentity,
1906
2610
  ownerPayout: BigInt(ownerPayout),
1907
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
+ }),
1908
2617
  amount: options.amount,
1909
2618
  ...options.memo === void 0 ? {} : { memo: options.memo },
1910
2619
  expiry,
1911
- nonce: (0, import_core6.generateNonce)(),
1912
- creditSharedKey: (0, import_core6.generateCreditSharedKey)()
2620
+ nonce: (0, import_core7.generateNonce)(),
2621
+ creditSharedKey: (0, import_core7.generateCreditSharedKey)()
1913
2622
  },
1914
2623
  ownerReceivingKeys: owner.getReceivingKeys(),
1915
2624
  spenderReceivingKeys: spender.getReceivingKeys()
@@ -2002,9 +2711,12 @@ var CreditPreparation = class {
2002
2711
  ...old,
2003
2712
  note: {
2004
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,
2005
2717
  amount,
2006
2718
  expiry,
2007
- nonce: (0, import_core6.generateNonce)(),
2719
+ nonce: (0, import_core7.generateNonce)(),
2008
2720
  ...options.memo === void 0 ? {} : { memo: options.memo }
2009
2721
  }
2010
2722
  },
@@ -2053,6 +2765,7 @@ var CreditPreparation = class {
2053
2765
  }
2054
2766
  sources.set(member.source.treeId, member.source.merkleRoot);
2055
2767
  amounts.push(amount);
2768
+ const usage = (0, import_core7.applyCreditDrawUsage)(n, amount, frame.block.timestamp);
2056
2769
  const remaining = n.amount - amount;
2057
2770
  if (remaining === 0n) {
2058
2771
  remainders.push((0, import_protocol4.word)(0n));
@@ -2072,9 +2785,10 @@ var CreditPreparation = class {
2072
2785
  ...state,
2073
2786
  note: {
2074
2787
  ...n,
2788
+ ...usage,
2075
2789
  amount: remaining,
2076
2790
  ...options.credits[i].memo === void 0 ? {} : { memo: options.credits[i].memo },
2077
- nonce: await (0, import_core6.deriveRemainderNonce)(...args)
2791
+ nonce: await (0, import_core7.deriveRemainderNonce)(...args)
2078
2792
  }
2079
2793
  },
2080
2794
  frame
@@ -2082,7 +2796,7 @@ var CreditPreparation = class {
2082
2796
  outputs.push(output);
2083
2797
  remainders.push(output.commitment);
2084
2798
  recoveryAmounts.push(
2085
- (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)
2086
2800
  );
2087
2801
  deliveries.push(...output.deliveries);
2088
2802
  }
@@ -2755,7 +3469,7 @@ var EthersFundingVerifier = class {
2755
3469
  };
2756
3470
 
2757
3471
  // src/Invisi.ts
2758
- var import_core14 = require("@invisi-labs/core");
3472
+ var import_core15 = require("@invisi-labs/core");
2759
3473
 
2760
3474
  // src/session/codec.ts
2761
3475
  function encode(value) {
@@ -2866,7 +3580,7 @@ function readProtocolLogs(receipt, protocolAddress) {
2866
3580
 
2867
3581
  // src/session/discovery.ts
2868
3582
  var import_ethers9 = require("ethers");
2869
- var import_core7 = require("@invisi-labs/core");
3583
+ var import_core8 = require("@invisi-labs/core");
2870
3584
  var import_protocol6 = require("@invisi-labs/protocol");
2871
3585
  var EVENTS = /* @__PURE__ */ new Set([
2872
3586
  "CommitmentsInserted",
@@ -3056,7 +3770,7 @@ function extractDeliveryCandidates(logs, context, confirmedThrough) {
3056
3770
  }
3057
3771
  async function decryptCandidates(logs, options) {
3058
3772
  contextCheck(options.context);
3059
- (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());
3060
3774
  check4(
3061
3775
  !logs.some(
3062
3776
  (log) => log.address.toLowerCase() === options.context.protocolAddress.toLowerCase() && log.removed
@@ -3344,7 +4058,7 @@ function mergeReceiptRecords(state, batch) {
3344
4058
  }
3345
4059
 
3346
4060
  // src/session/store.ts
3347
- var import_core8 = require("@invisi-labs/core");
4061
+ var import_core9 = require("@invisi-labs/core");
3348
4062
  var import_sha2562 = require("@noble/hashes/sha256");
3349
4063
  var import_utils2 = require("@noble/hashes/utils");
3350
4064
  function scopeKey(scope) {
@@ -3397,12 +4111,12 @@ function validateState(state, scope, revision) {
3397
4111
  throw new Error("invalid spent state");
3398
4112
  }
3399
4113
  for (const record of Object.values(state.credits)) {
3400
- const note = (0, import_core8.normalizeCreditDeliveryState)(record.state).note;
4114
+ const note = (0, import_core9.normalizeCreditDeliveryState)(record.state).note;
3401
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))
3402
4116
  throw new Error("invalid stored Credit context or role");
3403
4117
  }
3404
4118
  for (const record of [...Object.values(state.notes), ...Object.values(state.credits)]) {
3405
- 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))
3406
4120
  throw new Error("invalid stored receipt position");
3407
4121
  }
3408
4122
  for (const [id, operation] of Object.entries(state.reservations))
@@ -3463,11 +4177,11 @@ var TransactionalWalletStore = class {
3463
4177
  };
3464
4178
 
3465
4179
  // src/session/Operation.ts
3466
- var import_core10 = require("@invisi-labs/core");
4180
+ var import_core11 = require("@invisi-labs/core");
3467
4181
  var import_protocol8 = require("@invisi-labs/protocol");
3468
4182
 
3469
4183
  // src/session/operation-confirmation.ts
3470
- var import_core9 = require("@invisi-labs/core");
4184
+ var import_core10 = require("@invisi-labs/core");
3471
4185
 
3472
4186
  // src/session/aggregate-receipt.ts
3473
4187
  var import_ethers11 = require("ethers");
@@ -3687,7 +4401,7 @@ async function confirmOperation(runtime, id, generation, hash2, signal) {
3687
4401
  if (credits.length) {
3688
4402
  const nullifiers = await Promise.all(
3689
4403
  credits.map(
3690
- async (record) => (0, import_core9.computeCreditNullifier)(
4404
+ async (record) => (0, import_core10.computeCreditNullifier)(
3691
4405
  plan.context.chainId,
3692
4406
  record.state.note.creditSharedKey,
3693
4407
  await creditLeaf(record.state)
@@ -4019,7 +4733,7 @@ var Operation = class _Operation {
4019
4733
  }
4020
4734
  const prover = this.#runtime.options.prover;
4021
4735
  if (!prover) {
4022
- throw new import_core10.MissingCapabilityError("prover");
4736
+ throw new import_core11.MissingCapabilityError("prover");
4023
4737
  }
4024
4738
  return this.stage(
4025
4739
  "proof",
@@ -4053,7 +4767,7 @@ var Operation = class _Operation {
4053
4767
  check7(p.kind === "shield" || this.#saved.proof, "proof must precede funding authorization");
4054
4768
  const signer = this.#runtime.options.fundingSigner;
4055
4769
  if (!signer) {
4056
- throw new import_core10.MissingCapabilityError("EVM funding signer");
4770
+ throw new import_core11.MissingCapabilityError("EVM funding signer");
4057
4771
  }
4058
4772
  check7(
4059
4773
  signer.address.toLowerCase() === p.funding.payer.toLowerCase(),
@@ -4244,7 +4958,7 @@ var Operation = class _Operation {
4244
4958
 
4245
4959
  // src/session/WalletSession.ts
4246
4960
  var import_ethers12 = require("ethers");
4247
- var import_core13 = require("@invisi-labs/core");
4961
+ var import_core14 = require("@invisi-labs/core");
4248
4962
 
4249
4963
  // src/session/refresh.ts
4250
4964
  async function refreshWallet(runtime, options) {
@@ -4301,10 +5015,10 @@ async function refreshWallet(runtime, options) {
4301
5015
  }
4302
5016
 
4303
5017
  // src/session/WalletUpdater.ts
4304
- var import_core12 = require("@invisi-labs/core");
5018
+ var import_core13 = require("@invisi-labs/core");
4305
5019
 
4306
5020
  // src/session/inventory.ts
4307
- var import_core11 = require("@invisi-labs/core");
5021
+ var import_core12 = require("@invisi-labs/core");
4308
5022
  var CanonicalConflict = class extends Error {
4309
5023
  };
4310
5024
  var CreditMetadataMismatch = class extends Error {
@@ -4356,10 +5070,10 @@ var InventoryProcessor = class {
4356
5070
  }
4357
5071
  async creditNullifier(state) {
4358
5072
  const n = state.note;
4359
- return (0, import_core11.computeCreditNullifier)(
5073
+ return (0, import_core12.computeCreditNullifier)(
4360
5074
  n.chainId,
4361
5075
  n.creditSharedKey,
4362
- await (0, import_core11.computeCreditCommitment)(
5076
+ await (0, import_core12.computeCreditCommitment)(
4363
5077
  n.chainId,
4364
5078
  n.spenderWalletIdentity,
4365
5079
  n.ownerWalletIdentity,
@@ -4369,7 +5083,8 @@ var InventoryProcessor = class {
4369
5083
  n.amount,
4370
5084
  n.nonce,
4371
5085
  n.expiry,
4372
- await (0, import_core11.computeCreditSharedKeyHash)(n.creditSharedKey)
5086
+ await (0, import_core12.computeCreditSharedKeyHash)(n.creditSharedKey),
5087
+ n
4373
5088
  )
4374
5089
  );
4375
5090
  }
@@ -4416,6 +5131,9 @@ var InventoryProcessor = class {
4416
5131
  };
4417
5132
  for (const event of logs) {
4418
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");
4419
5137
  const args = event.args;
4420
5138
  const params = args.params;
4421
5139
  const indices = args.remainderLeafIndices;
@@ -4429,10 +5147,11 @@ var InventoryProcessor = class {
4429
5147
  previous.state.note.expiry === params.expiries[index2],
4430
5148
  "draw recovery expiry mismatch"
4431
5149
  );
4432
- const remainder = await (0, import_core11.recoverCreditRemainder)(
5150
+ const remainder = await (0, import_core12.recoverCreditRemainder)(
4433
5151
  context,
4434
5152
  previous.state.note,
4435
5153
  {
5154
+ timestamp: block.timestamp,
4436
5155
  creditNullifier: nullifier,
4437
5156
  remainderCommitment: params.remainderCommitments[index2],
4438
5157
  recoveryAmount: BigInt(params.recoveryAmounts[index2])
@@ -4457,7 +5176,7 @@ var InventoryProcessor = class {
4457
5176
  ...clone(previous.state),
4458
5177
  note: {
4459
5178
  ...remainder,
4460
- ...memo === void 0 ? {} : { memo: (0, import_core11.encodeMemo)(memo) }
5179
+ ...memo === void 0 ? {} : { memo: (0, import_core12.encodeMemo)(memo) }
4461
5180
  }
4462
5181
  },
4463
5182
  receivingKeySource: { kind: "draw", commitment: previous.commitment },
@@ -4536,7 +5255,7 @@ var WalletUpdater = class extends InventoryProcessor {
4536
5255
  }
4537
5256
  async run(batch, options) {
4538
5257
  const { reader, protocol, scope, store, viewing } = this.#options;
4539
- const nullifier = import_core12.NullifierCapability.fromIdentity(scope.walletIdentity);
5258
+ const nullifier = import_core13.NullifierCapability.fromIdentity(scope.walletIdentity);
4540
5259
  const { signal, reset } = options;
4541
5260
  signal?.throwIfAborted();
4542
5261
  const context = protocol.context;
@@ -4757,7 +5476,7 @@ var WalletSession = class {
4757
5476
  /** Delegate sending to ethers; managed operations additionally retain the resulting hash. */
4758
5477
  async sendTransaction(input, options = {}) {
4759
5478
  const signer = this.#options.signer;
4760
- if (!signer) throw new import_core13.MissingCapabilityError("ethers signer");
5479
+ if (!signer) throw new import_core14.MissingCapabilityError("ethers signer");
4761
5480
  const operation = input instanceof Operation ? input : void 0;
4762
5481
  if (operation && this.#sending.has(operation.id))
4763
5482
  throw new Error("operation is already being sent by this session");
@@ -4765,12 +5484,12 @@ var WalletSession = class {
4765
5484
  const overrides = { ...options };
4766
5485
  const plain = operation ? void 0 : { ...input };
4767
5486
  try {
4768
- if (!signer.provider) throw new import_core13.MissingCapabilityError("connected ethers signer");
5487
+ if (!signer.provider) throw new import_core14.MissingCapabilityError("connected ethers signer");
4769
5488
  if ((await signer.provider.getNetwork()).chainId !== this.protocol.context.chainId) {
4770
5489
  throw new Error("signer-provider session chain mismatch");
4771
5490
  }
4772
5491
  if (operation) {
4773
- if (!this.#options.store) throw new import_core13.MissingCapabilityError("wallet store");
5492
+ if (!this.#options.store) throw new import_core14.MissingCapabilityError("wallet store");
4774
5493
  const state = await this.#options.store.readSnapshot(this.scope);
4775
5494
  if (!state.operations[operation.id])
4776
5495
  throw new Error("operation does not belong to this wallet session");
@@ -4801,10 +5520,10 @@ var WalletSession = class {
4801
5520
  runtime(tokenAddress) {
4802
5521
  const options = this.#options;
4803
5522
  if (!options.store) {
4804
- throw new import_core13.MissingCapabilityError("wallet store");
5523
+ throw new import_core14.MissingCapabilityError("wallet store");
4805
5524
  }
4806
5525
  if (!options.chainReader) {
4807
- throw new import_core13.MissingCapabilityError("chain reader");
5526
+ throw new import_core14.MissingCapabilityError("chain reader");
4808
5527
  }
4809
5528
  return {
4810
5529
  options: { ...options, protocol: options.protocol.forToken(tokenAddress) },
@@ -4818,7 +5537,7 @@ var WalletSession = class {
4818
5537
  if (this.#updater) return this.#updater;
4819
5538
  const options = this.#options;
4820
5539
  if (!options.store || !options.chainReader || !options.protocolRpc)
4821
- 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");
4822
5541
  const viewing = options.viewing ?? options.wallet.getViewer();
4823
5542
  const receivingAddress = options.wallet.getReceivingAddress();
4824
5543
  const receivingKeys = receivingAddress.kind === "long" ? receivingAddress.getReceivingKeys() : void 0;
@@ -4836,7 +5555,7 @@ var WalletSession = class {
4836
5555
  async balance(tokenAddress) {
4837
5556
  const store = this.#options.store;
4838
5557
  if (!store) {
4839
- throw new import_core13.MissingCapabilityError("wallet store");
5558
+ throw new import_core14.MissingCapabilityError("wallet store");
4840
5559
  }
4841
5560
  return walletBalance(await store.readSnapshot(this.scope), (0, import_ethers12.getAddress)(tokenAddress));
4842
5561
  }
@@ -4844,8 +5563,8 @@ var WalletSession = class {
4844
5563
  async refresh(options) {
4845
5564
  const provider = this.#options.protocolRpc;
4846
5565
  const reader = this.#options.chainReader;
4847
- if (!reader) throw new import_core13.MissingCapabilityError("chain reader");
4848
- 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");
4849
5568
  const updater = this.updater();
4850
5569
  const request = {
4851
5570
  ...options,
@@ -4904,7 +5623,7 @@ var WalletSession = class {
4904
5623
  }
4905
5624
  async resume(operationId) {
4906
5625
  const store = this.#options.store;
4907
- if (!store) throw new import_core13.MissingCapabilityError("wallet store");
5626
+ if (!store) throw new import_core14.MissingCapabilityError("wallet store");
4908
5627
  const state = await store.readSnapshot(this.scope);
4909
5628
  const saved = state.operations[operationId]?.payload;
4910
5629
  if (!saved?.plan) throw new Error("operation not found");
@@ -4943,7 +5662,7 @@ var Invisi = class {
4943
5662
  const combined = { ...this.#options, ...selected };
4944
5663
  const { provider, signer, ...runtime } = combined;
4945
5664
  const reader = combined.chainReader ?? (provider ? new EthersChainReader(provider) : void 0);
4946
- if (!reader) throw new import_core14.MissingCapabilityError("chain reader");
5665
+ if (!reader) throw new import_core15.MissingCapabilityError("chain reader");
4947
5666
  if (provider && (await provider.getNetwork()).chainId !== selected.protocol.context.chainId)
4948
5667
  throw new Error("provider deployment chain mismatch");
4949
5668
  await selected.protocol.validateDeployment(reader);
@@ -4951,7 +5670,7 @@ var Invisi = class {
4951
5670
  runtime.protocolRpc = runtime.protocolRpc.withReader(reader);
4952
5671
  }
4953
5672
  if (signer) {
4954
- if (!provider) throw new import_core14.MissingCapabilityError("provider for signer");
5673
+ if (!provider) throw new import_core15.MissingCapabilityError("provider for signer");
4955
5674
  if (!signer.provider) throw new Error("signer must be connected to a provider");
4956
5675
  if ((await signer.provider.getNetwork()).chainId !== selected.protocol.context.chainId)
4957
5676
  throw new Error("signer-provider deployment chain mismatch");
@@ -5042,7 +5761,7 @@ var Invisi = class {
5042
5761
  };
5043
5762
 
5044
5763
  // src/index.ts
5045
- var import_core15 = require("@invisi-labs/core");
5764
+ var import_core16 = require("@invisi-labs/core");
5046
5765
  var import_protocol10 = require("@invisi-labs/protocol");
5047
5766
  var import_rpc3 = require("@invisi-labs/rpc");
5048
5767