@boostxyz/sdk 0.0.0-alpha.11 → 0.0.0-alpha.13

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.
Files changed (154) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.js +1 -1
  3. package/dist/Actions/ContractAction.d.ts +2 -2
  4. package/dist/Actions/ContractAction.d.ts.map +1 -1
  5. package/dist/Actions/ERC721MintAction.d.ts +2 -2
  6. package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
  7. package/dist/Actions/EventAction.cjs +1 -1
  8. package/dist/Actions/EventAction.cjs.map +1 -1
  9. package/dist/Actions/EventAction.d.ts +117 -33
  10. package/dist/Actions/EventAction.d.ts.map +1 -1
  11. package/dist/Actions/EventAction.js +309 -121
  12. package/dist/Actions/EventAction.js.map +1 -1
  13. package/dist/AllowLists/AllowList.cjs +1 -1
  14. package/dist/AllowLists/AllowList.js +2 -2
  15. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  16. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  17. package/dist/AllowLists/SimpleAllowList.d.ts +2 -2
  18. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  19. package/dist/AllowLists/SimpleAllowList.js +23 -19
  20. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  21. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  22. package/dist/AllowLists/SimpleDenyList.d.ts +2 -2
  23. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  24. package/dist/AllowLists/SimpleDenyList.js +6 -5
  25. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  26. package/dist/Auth/PassthroughAuth.cjs +1 -1
  27. package/dist/Auth/PassthroughAuth.js +1 -1
  28. package/dist/BoostCore.cjs +2 -2
  29. package/dist/BoostCore.cjs.map +1 -1
  30. package/dist/BoostCore.d.ts +27 -5
  31. package/dist/BoostCore.d.ts.map +1 -1
  32. package/dist/BoostCore.js +438 -347
  33. package/dist/BoostCore.js.map +1 -1
  34. package/dist/BoostRegistry.cjs +1 -1
  35. package/dist/BoostRegistry.cjs.map +1 -1
  36. package/dist/BoostRegistry.d.ts +26 -5
  37. package/dist/BoostRegistry.d.ts.map +1 -1
  38. package/dist/BoostRegistry.js +125 -64
  39. package/dist/BoostRegistry.js.map +1 -1
  40. package/dist/Budgets/Budget.cjs +1 -1
  41. package/dist/Budgets/Budget.js +1 -1
  42. package/dist/Budgets/ManagedBudget.cjs +1 -1
  43. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  44. package/dist/Budgets/ManagedBudget.d.ts +2 -2
  45. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  46. package/dist/Budgets/ManagedBudget.js +41 -37
  47. package/dist/Budgets/ManagedBudget.js.map +1 -1
  48. package/dist/Budgets/SimpleBudget.d.ts +2 -2
  49. package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
  50. package/dist/Budgets/VestingBudget.d.ts +2 -2
  51. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  52. package/dist/Deployable/DeployableTarget.cjs +1 -1
  53. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  54. package/dist/Deployable/DeployableTarget.d.ts +6 -6
  55. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  56. package/dist/Deployable/DeployableTarget.js +22 -17
  57. package/dist/Deployable/DeployableTarget.js.map +1 -1
  58. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  59. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  60. package/dist/Incentives/AllowListIncentive.d.ts +2 -2
  61. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  62. package/dist/Incentives/AllowListIncentive.js +17 -13
  63. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  64. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  65. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  66. package/dist/Incentives/CGDAIncentive.d.ts +14 -2
  67. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  68. package/dist/Incentives/CGDAIncentive.js +27 -23
  69. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  70. package/dist/Incentives/ERC1155Incentive.d.ts +2 -2
  71. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  72. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  73. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  74. package/dist/Incentives/ERC20Incentive.d.ts +2 -2
  75. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  76. package/dist/Incentives/ERC20Incentive.js +17 -13
  77. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  78. package/dist/Incentives/ERC20VariableIncentive.d.ts +2 -2
  79. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  80. package/dist/Incentives/Incentive.cjs +1 -1
  81. package/dist/Incentives/Incentive.cjs.map +1 -1
  82. package/dist/Incentives/Incentive.js +34 -30
  83. package/dist/Incentives/Incentive.js.map +1 -1
  84. package/dist/Incentives/PointsIncentive.cjs +1 -1
  85. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  86. package/dist/Incentives/PointsIncentive.d.ts +2 -2
  87. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  88. package/dist/Incentives/PointsIncentive.js +13 -9
  89. package/dist/Incentives/PointsIncentive.js.map +1 -1
  90. package/dist/{SimpleDenyList-4PtOPXTc.js → SimpleDenyList-C21O9Yfi.js} +23 -19
  91. package/dist/SimpleDenyList-C21O9Yfi.js.map +1 -0
  92. package/dist/SimpleDenyList-DeJRKD2D.cjs +2 -0
  93. package/dist/{SimpleDenyList-4PtOPXTc.js.map → SimpleDenyList-DeJRKD2D.cjs.map} +1 -1
  94. package/dist/Validators/SignerValidator.cjs +1 -1
  95. package/dist/Validators/SignerValidator.cjs.map +1 -1
  96. package/dist/Validators/SignerValidator.d.ts +2 -2
  97. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  98. package/dist/Validators/SignerValidator.js +18 -14
  99. package/dist/Validators/SignerValidator.js.map +1 -1
  100. package/dist/Validators/Validator.cjs +1 -1
  101. package/dist/Validators/Validator.js +1 -1
  102. package/dist/deployments-BvFcK_eR.js +40 -0
  103. package/dist/deployments-BvFcK_eR.js.map +1 -0
  104. package/dist/deployments-Ho4PnGCS.cjs +2 -0
  105. package/dist/deployments-Ho4PnGCS.cjs.map +1 -0
  106. package/dist/deployments.json +38 -0
  107. package/dist/errors.cjs +1 -1
  108. package/dist/errors.cjs.map +1 -1
  109. package/dist/errors.d.ts +122 -20
  110. package/dist/errors.d.ts.map +1 -1
  111. package/dist/errors.js +98 -28
  112. package/dist/errors.js.map +1 -1
  113. package/dist/{generated-BDeDiaCK.js → generated-LpgSHrH0.js} +150 -110
  114. package/dist/generated-LpgSHrH0.js.map +1 -0
  115. package/dist/generated-tq_HLZJ0.cjs +3 -0
  116. package/dist/generated-tq_HLZJ0.cjs.map +1 -0
  117. package/dist/index.cjs +1 -1
  118. package/dist/index.js +115 -108
  119. package/dist/utils.cjs +1 -1
  120. package/dist/utils.cjs.map +1 -1
  121. package/dist/utils.d.ts +25 -11
  122. package/dist/utils.d.ts.map +1 -1
  123. package/dist/utils.js +38 -23
  124. package/dist/utils.js.map +1 -1
  125. package/package.json +10 -6
  126. package/src/Actions/Action.test.ts +8 -4
  127. package/src/Actions/ContractAction.ts +5 -3
  128. package/src/Actions/ERC721MintAction.ts +5 -3
  129. package/src/Actions/EventAction.test.ts +528 -100
  130. package/src/Actions/EventAction.ts +302 -60
  131. package/src/AllowLists/AllowList.test.ts +1 -1
  132. package/src/AllowLists/SimpleAllowList.ts +6 -3
  133. package/src/AllowLists/SimpleDenyList.ts +6 -3
  134. package/src/BoostCore.test.ts +31 -91
  135. package/src/BoostCore.ts +137 -34
  136. package/src/BoostRegistry.ts +89 -21
  137. package/src/Budgets/ManagedBudget.ts +6 -4
  138. package/src/Budgets/SimpleBudget.ts +4 -3
  139. package/src/Budgets/VestingBudget.ts +4 -3
  140. package/src/Deployable/DeployableTarget.ts +22 -11
  141. package/src/Incentives/AllowListIncentive.ts +6 -3
  142. package/src/Incentives/CGDAIncentive.ts +6 -3
  143. package/src/Incentives/ERC1155Incentive.ts +4 -3
  144. package/src/Incentives/ERC20Incentive.ts +6 -3
  145. package/src/Incentives/ERC20VariableIncentive.ts +6 -3
  146. package/src/Incentives/PointsIncentive.ts +6 -3
  147. package/src/Validators/SignerValidator.ts +6 -3
  148. package/src/errors.ts +177 -21
  149. package/src/utils.ts +60 -11
  150. package/dist/SimpleDenyList-CqT0BMP7.cjs +0 -2
  151. package/dist/SimpleDenyList-CqT0BMP7.cjs.map +0 -1
  152. package/dist/generated-BDeDiaCK.js.map +0 -1
  153. package/dist/generated-wKBNvm48.cjs +0 -3
  154. package/dist/generated-wKBNvm48.cjs.map +0 -1
package/src/errors.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  import {
2
+ type AbiEvent,
3
+ type AbiFunction,
2
4
  type Hex,
3
5
  type Log,
4
6
  type WaitForTransactionReceiptReturnType,
5
7
  zeroHash,
6
8
  } from 'viem';
7
9
  import type { Criteria } from './Actions/EventAction';
10
+ import type { EventLogs } from './Actions/EventAction';
8
11
  import type { BoostRegistry } from './BoostRegistry';
9
12
  import type { Incentive } from './Incentives/Incentive';
10
13
 
@@ -84,7 +87,7 @@ export class DeployableAlreadyDeployedError extends Error {
84
87
  */
85
88
  constructor(address: string) {
86
89
  super(
87
- `Attempted to deploy a contract that already has an address configured`,
90
+ 'Attempted to deploy a contract that already has an address configured',
88
91
  );
89
92
  this.address = address;
90
93
  }
@@ -248,6 +251,44 @@ export class InvalidComponentInterfaceError extends Error {
248
251
  }
249
252
  }
250
253
 
254
+ /**
255
+ * This error is thrown when a param is not transparently stored onchain
256
+ *
257
+ * @export
258
+ * @class UnparseableAbiParamError
259
+ * @typedef {UnparseableAbiParamError}
260
+ * @extends {Error}
261
+ */
262
+ export class UnparseableAbiParamError extends Error {
263
+ /**
264
+ * the param index that is unparseable
265
+ *
266
+ * @type {number}
267
+ */
268
+ input_param_idx: number;
269
+ /**
270
+ * The given event that contains the unparseable param
271
+ *
272
+ * @type {AbiEvent}
273
+ */
274
+ event: AbiEvent;
275
+ /**
276
+ * Creates an instance of UnknownTransferPayloadSupplied.
277
+ *
278
+ * @constructor
279
+ * @param {number} input_param_idx
280
+ * @param {AbiEvent} event
281
+ */
282
+ constructor(input_param_idx: number, event: AbiEvent) {
283
+ super(
284
+ `Parameter is not transparently stored onchain. Parameter ${input_param_idx} in event ${event.name} cannot be used in an action`,
285
+ { cause: event },
286
+ );
287
+ this.event = event;
288
+ this.input_param_idx = input_param_idx;
289
+ }
290
+ }
291
+
251
292
  /**
252
293
  * This error is thrown when attempting a Budget transfer and arguments aren't of the type `FungibleTransferPayload` or `ERC1155TransferPayload`
253
294
  *
@@ -380,6 +421,28 @@ export class TooManyEventActionStepsProvidedError extends Error {
380
421
  }
381
422
  }
382
423
 
424
+ /**
425
+ * Function action validation context to help debug other validation errors
426
+ *
427
+ * @interface FunctionActionValidationMeta
428
+ * @typedef {FunctionActionValidationMeta}
429
+ */
430
+ interface FunctionActionValidationMeta {
431
+ decodedArgs: readonly (string | bigint)[];
432
+ /**
433
+ * The value pulled off the log being validated against
434
+ *
435
+ * @type {*}
436
+ * biome-ignore lint/suspicious/noExplicitAny: this can be a few different types based on what the log emits
437
+ */
438
+ fieldValue: any;
439
+ /**
440
+ * The criteria being used to compare during validation
441
+ *
442
+ * @type {Criteria}
443
+ */
444
+ criteria: Criteria;
445
+ }
383
446
  /**
384
447
  * Event action validation context to help debug other validation errors
385
448
  *
@@ -392,7 +455,7 @@ interface EventActionValidationMeta {
392
455
  *
393
456
  * @type {Log}
394
457
  */
395
- log: Log;
458
+ log?: EventLogs[0];
396
459
  /**
397
460
  * The value pulled off the log being validated against
398
461
  *
@@ -413,17 +476,23 @@ interface EventActionValidationMeta {
413
476
  * Instantiated with relevent context data for more in depth debugging.
414
477
  *
415
478
  * @export
416
- * @class EventActionValidationError
417
- * @typedef {EventActionValidationError}
479
+ * @class FieldActionValidationError
480
+ * @typedef {FieldActionValidationError}
418
481
  * @extends {Error}
419
482
  */
420
- export class EventActionValidationError extends Error {
483
+ export class FieldActionValidationError extends Error {
484
+ /**
485
+ * The function input arguments being validated against
486
+ *
487
+ * @type {decodedArgs}
488
+ */
489
+ decodedArgs?: readonly (string | bigint)[];
421
490
  /**
422
491
  * The viem log being validated against
423
492
  *
424
493
  * @type {Log}
425
494
  */
426
- log: Log;
495
+ log?: EventLogs[0];
427
496
  /**
428
497
  * The value pulled off the log being validated against
429
498
  *
@@ -438,7 +507,7 @@ export class EventActionValidationError extends Error {
438
507
  */
439
508
  criteria: Criteria;
440
509
  /**
441
- * Creates an instance of EventActionValidationError.
510
+ * Creates an instance of FieldActionValidationError.
442
511
  *
443
512
  * @constructor
444
513
  * @param {string} message
@@ -449,12 +518,48 @@ export class EventActionValidationError extends Error {
449
518
  */
450
519
  constructor(
451
520
  message: string,
452
- { fieldValue, criteria, log }: EventActionValidationMeta,
521
+ {
522
+ fieldValue,
523
+ criteria,
524
+ ...args
525
+ }: EventActionValidationMeta | FunctionActionValidationMeta,
453
526
  ) {
454
527
  super(message);
455
528
  this.fieldValue = fieldValue;
456
529
  this.criteria = criteria;
457
- this.log = log;
530
+
531
+ switch (true) {
532
+ case 'log' in args:
533
+ this.log = args.log;
534
+ break;
535
+ case 'decodedArgs' in args:
536
+ this.decodedArgs = args.decodedArgs;
537
+ }
538
+ }
539
+ }
540
+
541
+ /**
542
+ * Thrown when abi-decoded args on log is undefined
543
+ *
544
+ * @export
545
+ * @class FieldValueUndefinedError
546
+ * @typedef {FieldValueUndefinedError}
547
+ * @extends {FieldActionValidationError}
548
+ */
549
+ export class DecodedArgsMalformedError extends FieldActionValidationError {
550
+ /**
551
+ * Creates an instance of DecodedArgsUndefinedError.
552
+ *
553
+ * @constructor
554
+ * @param {DecodedArgsMalformedError} metadata
555
+ */
556
+ constructor(
557
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
558
+ ) {
559
+ super(
560
+ 'Decoded Args are malformed; Check which params are indexed',
561
+ metadata,
562
+ );
458
563
  }
459
564
  }
460
565
 
@@ -464,16 +569,18 @@ export class EventActionValidationError extends Error {
464
569
  * @export
465
570
  * @class FieldValueUndefinedError
466
571
  * @typedef {FieldValueUndefinedError}
467
- * @extends {EventActionValidationError}
572
+ * @extends {FieldActionValidationError}
468
573
  */
469
- export class FieldValueUndefinedError extends EventActionValidationError {
574
+ export class FieldValueUndefinedError extends FieldActionValidationError {
470
575
  /**
471
576
  * Creates an instance of FieldValueUndefinedError.
472
577
  *
473
578
  * @constructor
474
579
  * @param {EventActionValidationMeta} metadata
475
580
  */
476
- constructor(metadata: EventActionValidationMeta) {
581
+ constructor(
582
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
583
+ ) {
477
584
  super('Field value is undefined', metadata);
478
585
  }
479
586
  }
@@ -484,16 +591,18 @@ export class FieldValueUndefinedError extends EventActionValidationError {
484
591
  * @export
485
592
  * @class InvalidNumericalCriteriaError
486
593
  * @typedef {InvalidNumericalCriteriaError}
487
- * @extends {EventActionValidationError}
594
+ * @extends {FieldActionValidationError}
488
595
  */
489
- export class InvalidNumericalCriteriaError extends EventActionValidationError {
596
+ export class InvalidNumericalCriteriaError extends FieldActionValidationError {
490
597
  /**
491
598
  * Creates an instance of InvalidNumericalCriteria.
492
599
  *
493
600
  * @constructor
494
601
  * @param {EventActionValidationMeta} metadata
495
602
  */
496
- constructor(metadata: EventActionValidationMeta) {
603
+ constructor(
604
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
605
+ ) {
497
606
  super(
498
607
  'Numerical comparisons cannot be used with non-numerical criteria',
499
608
  metadata,
@@ -501,22 +610,51 @@ export class InvalidNumericalCriteriaError extends EventActionValidationError {
501
610
  }
502
611
  }
503
612
 
613
+ /**
614
+ * Thrown when decoding function data fails.
615
+ *
616
+ * @export
617
+ * @class FunctionDataDecodeError
618
+ * @typedef {FunctionDataDecodeError}
619
+ * @extends {Error}
620
+ */
621
+ export class FunctionDataDecodeError extends Error {
622
+ public abi: AbiFunction[];
623
+ public originalError: Error;
624
+
625
+ /**
626
+ * Creates an instance of FunctionDataDecodeError.
627
+ *
628
+ * @constructor
629
+ * @param {AbiFunction[]} abi - The ABI of the function.
630
+ * @param {Error} originalError - The original error that was thrown.
631
+ */
632
+ constructor(abi: AbiFunction[], originalError: Error) {
633
+ super(`Failed to decode function data: ${originalError.message}`);
634
+ this.name = 'FunctionDataDecodeError';
635
+ this.abi = abi;
636
+ this.originalError = originalError;
637
+ }
638
+ }
639
+
504
640
  /**
505
641
  * Thrown when an the log's field value is being compared a field type that isn't bytes or string during event action validation
506
642
  *
507
643
  * @export
508
644
  * @class FieldValueNotComparableError
509
645
  * @typedef {FieldValueNotComparableError}
510
- * @extends {EventActionValidationError}
646
+ * @extends {FieldActionValidationError}
511
647
  */
512
- export class FieldValueNotComparableError extends EventActionValidationError {
648
+ export class FieldValueNotComparableError extends FieldActionValidationError {
513
649
  /**
514
650
  * Creates an instance of FieldValueNotComparableError.
515
651
  *
516
652
  * @constructor
517
653
  * @param {EventActionValidationMeta} metadata
518
654
  */
519
- constructor(metadata: EventActionValidationMeta) {
655
+ constructor(
656
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
657
+ ) {
520
658
  super('Filter can only be used with bytes or string field type', metadata);
521
659
  }
522
660
  }
@@ -527,16 +665,34 @@ export class FieldValueNotComparableError extends EventActionValidationError {
527
665
  * @export
528
666
  * @class UnrecognizedFilterTypeError
529
667
  * @typedef {UnrecognizedFilterTypeError}
530
- * @extends {EventActionValidationError}
668
+ * @extends {FieldActionValidationError}
531
669
  */
532
- export class UnrecognizedFilterTypeError extends EventActionValidationError {
670
+ export class UnrecognizedFilterTypeError extends FieldActionValidationError {
533
671
  /**
534
672
  * Creates an instance of UnrecognizedFilterTypeError.
535
673
  *
536
674
  * @constructor
537
675
  * @param {EventActionValidationMeta} metadata
538
676
  */
539
- constructor(metadata: EventActionValidationMeta) {
677
+ constructor(
678
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
679
+ ) {
540
680
  super('Invalid FilterType provided', metadata);
541
681
  }
542
682
  }
683
+
684
+ export class NoConnectedChainIdError extends Error {
685
+ constructor() {
686
+ super(
687
+ 'Provided Wagmi configuration does not define `chainId` property with which to target protocol contracts',
688
+ );
689
+ }
690
+ }
691
+
692
+ export class InvalidProtocolChainIdError extends Error {
693
+ constructor(chainId: number, validChainIds: number[]) {
694
+ super(
695
+ `Provided Wagmi configuration supplied a "chainId" where protocol is not deployed, provided: ${chainId}, but valid chains are: ${validChainIds}`,
696
+ );
697
+ }
698
+ }
package/src/utils.ts CHANGED
@@ -3,12 +3,15 @@ import {
3
3
  type ReadContractParameters,
4
4
  type WatchContractEventParameters,
5
5
  type WriteContractParameters,
6
+ getAccount,
7
+ getClient,
6
8
  waitForTransactionReceipt,
7
9
  } from '@wagmi/core';
8
10
  import type { ExtractAbiEvent } from 'abitype';
9
11
  import type {
10
12
  Abi,
11
13
  AbiEvent,
14
+ Address,
12
15
  ContractEventName,
13
16
  ContractFunctionName,
14
17
  GetLogsParameters,
@@ -18,10 +21,28 @@ import type {
18
21
  WaitForTransactionReceiptParameters,
19
22
  } from 'viem';
20
23
  import { isHex, keccak256, slice, toHex } from 'viem';
21
- import { NoContractAddressUponReceiptError } from './errors';
24
+ import {
25
+ InvalidProtocolChainIdError,
26
+ NoConnectedChainIdError,
27
+ NoContractAddressUponReceiptError,
28
+ } from './errors';
22
29
 
23
30
  export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
24
31
 
32
+ /**
33
+ * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.
34
+ *
35
+ * @export
36
+ * @enum {number}
37
+ */
38
+ export enum RegistryType {
39
+ ACTION = 0,
40
+ ALLOW_LIST = 1,
41
+ BUDGET = 2,
42
+ INCENTIVE = 3,
43
+ VALIDATOR = 4,
44
+ }
45
+
25
46
  /**
26
47
  * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.
27
48
  * See (writeContract)[https://viem.sh/docs/contract/writeContract]
@@ -32,8 +53,8 @@ export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
32
53
  * @template {ContractFunctionName<abi>} functionName
33
54
  */
34
55
  export type WriteParams<
35
- abi extends Abi,
36
- functionName extends ContractFunctionName<abi>,
56
+ abi extends Abi = Abi,
57
+ functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>,
37
58
  > = Partial<
38
59
  Omit<
39
60
  WriteContractParameters<abi, functionName>,
@@ -184,15 +205,43 @@ export async function awaitResult<Result = unknown>(
184
205
  }
185
206
 
186
207
  /**
187
- * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.
208
+ * Given a wagmi config and a map of chain id's to addresses, determine an address/chainId combo that maps to the currently connected chain id, or throw a typed error.
188
209
  *
189
210
  * @export
190
- * @enum {number}
211
+ * @param {Config} config
212
+ * @param {Record<string, Address>} addressByChainId
213
+ * @param {number} desiredChainId
214
+ * @returns {{ chainId: number, address: Address }}
215
+ * @throws {@link InvalidProtocolChainIdError}
191
216
  */
192
- export enum RegistryType {
193
- ACTION = 0,
194
- ALLOW_LIST = 1,
195
- BUDGET = 2,
196
- INCENTIVE = 3,
197
- VALIDATOR = 4,
217
+ export function assertValidAddressByChainId(
218
+ config: Config,
219
+ addressByChainId: Record<number, Address>,
220
+ desiredChainId?: number,
221
+ ): { chainId: number; address: Address } {
222
+ let chainId: number | undefined = undefined;
223
+ const wagmiAccount = getAccount(config);
224
+ // if manually providing a chain id for some contract operation, try to use it
225
+ if (desiredChainId !== undefined) {
226
+ if (addressByChainId[desiredChainId]) chainId = desiredChainId;
227
+ } else if (wagmiAccount.chainId !== undefined) {
228
+ // otherwise if we can get the current chain id off the connected account and it matches one of ours, use it
229
+ if (addressByChainId[wagmiAccount.chainId]) chainId = wagmiAccount.chainId;
230
+ }
231
+ // chainId is still undefined, try to get chain id off viem client
232
+ if (chainId === undefined) {
233
+ const client = getClient(config);
234
+ if (client?.chain.id && addressByChainId[client?.chain.id])
235
+ chainId = client.chain.id;
236
+ }
237
+ // if chainId is STILL undefined, use our default addresses
238
+ // TODO: update this when on prod network
239
+ if (chainId === undefined) chainId = Number(__DEFAULT_CHAIN_ID__);
240
+ if (!addressByChainId[chainId])
241
+ throw new InvalidProtocolChainIdError(
242
+ chainId,
243
+ Object.keys(addressByChainId).map(Number),
244
+ );
245
+ // biome-ignore lint/style/noNonNullAssertion: this type should be narrowed by the above statement but isn't?
246
+ return { chainId, address: addressByChainId[chainId]! };
198
247
  }
@@ -1,2 +0,0 @@
1
- "use strict";const c=require("./generated-wKBNvm48.cjs"),h=require("@wagmi/core"),r=require("viem"),y=require("./Deployable/DeployableTarget.cjs"),p=require("./errors.cjs"),w=require("./utils.cjs"),i="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b6110ac806100bd5f395ff3fe6080604052600436106100a6575f3560e01c8063715018a611610063578063715018a6146101745780638da5cb5b1461017e578063e3f756de146101a8578063f04e283e146101e4578063f2fde38b14610200578063fee81cf41461021c576100a6565b806301ffc9a7146100aa578063141973b0146100e6578063256929621461010e57806328d6183b14610118578063439fab911461014257806354d1f13d1461016a575b5f80fd5b3480156100b5575f80fd5b506100d060048036038101906100cb9190610a82565b610258565b6040516100dd9190610ac7565b60405180910390f35b3480156100f1575f80fd5b5061010c60048036038101906101079190610b96565b6102d1565b005b6101166103da565b005b348015610123575f80fd5b5061012c61042b565b6040516101399190610c23565b60405180910390f35b34801561014d575f80fd5b5061016860048036038101906101639190610c91565b610452565b005b61017261056f565b005b61017c6105a8565b005b348015610189575f80fd5b506101926105bb565b60405161019f9190610d1b565b60405180910390f35b3480156101b3575f80fd5b506101ce60048036038101906101c99190610d5e565b6105e3565b6040516101db9190610ac7565b60405180910390f35b6101fe60048036038101906101f99190610dbb565b610637565b005b61021a60048036038101906102159190610dbb565b610675565b005b348015610227575f80fd5b50610242600480360381019061023d9190610dbb565b61069e565b60405161024f9190610dfe565b60405180910390f35b5f7f3d30a22c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806102ca57506102c9826106b7565b5b9050919050565b6102d9610730565b818190508484905014610318576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848490508110156103d35782828281811061033857610337610e17565b5b905060200201602081019061034d9190610e6e565b5f8087878581811061036257610361610e17565b5b90506020020160208101906103779190610dbb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550808060010191505061031a565b5050505050565b5f6103e3610767565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f3d30a22c00000000000000000000000000000000000000000000000000000000905090565b5f61045b610771565b9050805460038255801561048d5760018160011c14303b106104845763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f80848481019061049f919061101c565b915091506104ac8261079a565b5f5b81518110156105325760015f808484815181106104ce576104cd610e17565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555080806001019150506104ae565b505050801561056a576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6105b0610730565b6105b95f610870565b565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff161590509392505050565b61063f610730565b63389a75e1600c52805f526020600c20805442111561066557636f5e88185f526004601cfd5b5f81555061067281610870565b50565b61067d610730565b8060601b61069257637448fbae5f526004601cfd5b61069b81610870565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fe2089f79000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610729575061072882610936565b5b9050919050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610765576382b429005f526004601cfd5b565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b6107a26109af565b1561081a577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278054156107dc57630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35061086d565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b6108786109af565b156108dd577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610933565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806109a857506109a7826109b3565b5b9050919050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610a6181610a2d565b8114610a6b575f80fd5b50565b5f81359050610a7c81610a58565b92915050565b5f60208284031215610a9757610a96610a25565b5b5f610aa484828501610a6e565b91505092915050565b5f8115159050919050565b610ac181610aad565b82525050565b5f602082019050610ada5f830184610ab8565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112610b0157610b00610ae0565b5b8235905067ffffffffffffffff811115610b1e57610b1d610ae4565b5b602083019150836020820283011115610b3a57610b39610ae8565b5b9250929050565b5f8083601f840112610b5657610b55610ae0565b5b8235905067ffffffffffffffff811115610b7357610b72610ae4565b5b602083019150836020820283011115610b8f57610b8e610ae8565b5b9250929050565b5f805f8060408587031215610bae57610bad610a25565b5b5f85013567ffffffffffffffff811115610bcb57610bca610a29565b5b610bd787828801610aec565b9450945050602085013567ffffffffffffffff811115610bfa57610bf9610a29565b5b610c0687828801610b41565b925092505092959194509250565b610c1d81610a2d565b82525050565b5f602082019050610c365f830184610c14565b92915050565b5f8083601f840112610c5157610c50610ae0565b5b8235905067ffffffffffffffff811115610c6e57610c6d610ae4565b5b602083019150836001820283011115610c8a57610c89610ae8565b5b9250929050565b5f8060208385031215610ca757610ca6610a25565b5b5f83013567ffffffffffffffff811115610cc457610cc3610a29565b5b610cd085828601610c3c565b92509250509250929050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610d0582610cdc565b9050919050565b610d1581610cfb565b82525050565b5f602082019050610d2e5f830184610d0c565b92915050565b610d3d81610cfb565b8114610d47575f80fd5b50565b5f81359050610d5881610d34565b92915050565b5f805f60408486031215610d7557610d74610a25565b5b5f610d8286828701610d4a565b935050602084013567ffffffffffffffff811115610da357610da2610a29565b5b610daf86828701610c3c565b92509250509250925092565b5f60208284031215610dd057610dcf610a25565b5b5f610ddd84828501610d4a565b91505092915050565b5f819050919050565b610df881610de6565b82525050565b5f602082019050610e115f830184610def565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b610e4d81610aad565b8114610e57575f80fd5b50565b5f81359050610e6881610e44565b92915050565b5f60208284031215610e8357610e82610a25565b5b5f610e9084828501610e5a565b91505092915050565b5f610ea382610cdc565b9050919050565b610eb381610e99565b8114610ebd575f80fd5b50565b5f81359050610ece81610eaa565b92915050565b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610f1a82610ed4565b810181811067ffffffffffffffff82111715610f3957610f38610ee4565b5b80604052505050565b5f610f4b610a1c565b9050610f578282610f11565b919050565b5f67ffffffffffffffff821115610f7657610f75610ee4565b5b602082029050602081019050919050565b5f610f99610f9484610f5c565b610f42565b90508083825260208201905060208402830185811115610fbc57610fbb610ae8565b5b835b81811015610fe55780610fd18882610d4a565b845260208401935050602081019050610fbe565b5050509392505050565b5f82601f83011261100357611002610ae0565b5b8135611013848260208601610f87565b91505092915050565b5f806040838503121561103257611031610a25565b5b5f61103f85828601610ec0565b925050602083013567ffffffffffffffff8111156110605761105f610a29565b5b61106c85828601610fef565b915050925092905056fea2646970667358221220f8901ba0ad91db050edba1d0412882eecda8dba26237dd3383d77357c2f7173964736f6c634300081a0033",t=class t extends y.DeployableTarget{constructor(){super(...arguments),this.abi=c.S}async isAllowed(f,b){return await c.A2(this._config,{address:this.assertValidAddress(),args:[f,r.zeroHash],...this.optionallyAttachAccount(),...b})}async setDenied(f,b,d){return await this.awaitResult(this.setDeniedRaw(f,b,d))}async setDeniedRaw(f,b,d){const{request:a,result:e}=await c.k2(this._config,{address:this.assertValidAddress(),args:[f,b],...this.optionallyAttachAccount(),...d});return{hash:await c.B2(this._config,a),result:e}}buildParameters(f,b){var s;const[d,a]=this.validateDeploymentConfig(f,b),e=d;if(!e.owner||e.owner===r.zeroAddress){const o=a.account?a.account.address:a.config?h.getAccount(a.config).address:(s=this._account)==null?void 0:s.address;if(o)e.owner=o;else throw new p.DeployableUnknownOwnerProvidedError}return{abi:c.S,bytecode:i,args:[u(e)],...this.optionallyAttachAccount(a.account)}}};t.base="0x7eb4E958D42b64fd1c4Ce947d05a755fCC7C30B7",t.registryType=w.RegistryType.ALLOW_LIST;let n=t;function u({owner:l,denied:f}){return r.encodeAbiParameters([{type:"address",name:"owner"},{type:"address[]",name:"denied"}],[l,f])}exports.SimpleDenyList=n;exports.bytecode=i;exports.prepareSimpleDenyListPayload=u;
2
- //# sourceMappingURL=SimpleDenyList-CqT0BMP7.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SimpleDenyList-CqT0BMP7.cjs","sources":["../src/AllowLists/SimpleDenyList.ts"],"sourcesContent":["import {\n readSimpleDenyListIsAllowed,\n simpleDenyListAbi,\n simulateSimpleDenyListSetDenied,\n writeSimpleDenyListSetDenied,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/allowlists/SimpleDenyList.sol/SimpleDenyList.json';\nimport { getAccount } from '@wagmi/core';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { DeployableUnknownOwnerProvidedError } from '../errors';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { simpleDenyListAbi };\n\n/**\n * Object representation of a {@link SimpleDenyList} initialization payload.\n *\n * @export\n * @interface SimpleDenyListPayload\n * @typedef {SimpleDenyListPayload}\n */\nexport interface SimpleDenyListPayload {\n /**\n * The allow list's owner\n *\n * @type {Address}\n */\n owner: Address;\n /**\n * List of denied addresses.\n *\n * @type {Address[]}\n */\n denied: Address[];\n}\n\n/**\n * A generic `viem.Log` event with support for `SimpleDenyList` event types.\n *\n * @export\n * @typedef {SimpleDenyListLog}\n * @template {ContractEventName<typeof simpleDenyListAbi>} [event=ContractEventName<\n * typeof simpleDenyListAbi\n * >]\n */\nexport type SimpleDenyListLog<\n event extends ContractEventName<typeof simpleDenyListAbi> = ContractEventName<\n typeof simpleDenyListAbi\n >,\n> = GenericLog<typeof simpleDenyListAbi, event>;\n\n/**\n * A simple implementation of an AllowList that implicitly allows all addresses except those explicitly added to the deny list\n *\n * @export\n * @class SimpleDenyList\n * @typedef {SimpleDenyList}\n * @extends {DeployableTarget<SimpleDenyListPayload>}\n */\nexport class SimpleDenyList<\n Payload = SimpleDenyListPayload,\n> extends DeployableTarget<Payload | undefined, typeof simpleDenyListAbi> {\n public override readonly abi = simpleDenyListAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_SIMPLE_DENYLIST_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.ALLOW_LIST;\n\n /**\n * Check if a user is authorized (i.e. not denied)\n *\n * @public\n * @async\n * @param {Address} address - The address of the user\n * @param {?ReadParams<typeof simpleDenyListAbi, 'isAllowed'>} [params]\n * @returns {Promise<boolean>} - True if the user is authorized\n */\n public async isAllowed(\n address: Address,\n params?: ReadParams<typeof simpleDenyListAbi, 'isAllowed'>,\n ): Promise<boolean> {\n return await readSimpleDenyListIsAllowed(this._config, {\n address: this.assertValidAddress(),\n args: [address, zeroHash],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Set the denied status of a user. The length of the `users_` and `denied_` arrays must be the same. This function can only be called by the owner\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of users to update\n * @param {boolean[]} allowed - The denied status of each user\n * @param {?WriteParams<typeof simpleDenyListAbi, 'setDenied'>} [params]\n * @returns {unknown}\n */\n public async setDenied(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof simpleDenyListAbi, 'setDenied'>,\n ) {\n return await this.awaitResult(\n this.setDeniedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the denied status of a user. The length of the `users_` and `denied_` arrays must be the same. This function can only be called by the owner\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of users to update\n * @param {boolean[]} allowed - The denied status of each user\n * @param {?WriteParams<typeof simpleDenyListAbi, 'setDenied'>} [params]\n * @returns {unknown}\n */\n public async setDeniedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof simpleDenyListAbi, 'setDenied'>,\n ) {\n const { request, result } = await simulateSimpleDenyListSetDenied(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSimpleDenyListSetDenied(this._config, request);\n return { hash, result };\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?SimpleDenyListPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [p, options] = this.validateDeploymentConfig(_payload, _options);\n const payload = p as SimpleDenyListPayload;\n if (!payload.owner || payload.owner === zeroAddress) {\n const owner = options.account\n ? options.account.address\n : options.config\n ? getAccount(options.config).address\n : this._account?.address;\n if (owner) {\n payload.owner = owner;\n } else {\n throw new DeployableUnknownOwnerProvidedError();\n }\n }\n return {\n abi: simpleDenyListAbi,\n bytecode: bytecode as Hex,\n args: [prepareSimpleDenyListPayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Given a {@link SimpleDenyListPayload}, properly encode the initialization payload.\n *\n * @param {SimpleDenyListPayload} param0\n * @param {Address} param0.owner - The allow list's owner\n * @param {Address[]} param0.denied - List of denied addresses.\n * @returns {Hex}\n */\nexport function prepareSimpleDenyListPayload({\n owner,\n denied,\n}: SimpleDenyListPayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'owner' },\n { type: 'address[]', name: 'denied' },\n ],\n [owner, denied],\n );\n}\n"],"names":["_SimpleDenyList","DeployableTarget","simpleDenyListAbi","address","params","readSimpleDenyListIsAllowed","zeroHash","addresses","allowed","request","result","simulateSimpleDenyListSetDenied","writeSimpleDenyListSetDenied","_payload","_options","p","options","payload","zeroAddress","owner","getAccount","_a","DeployableUnknownOwnerProvidedError","bytecode","prepareSimpleDenyListPayload","RegistryType","SimpleDenyList","denied","encodeAbiParameters"],"mappings":"+5RA4EaA,EAAN,MAAMA,UAEHC,EAAAA,gBAAgE,CAFnE,aAAA,CAAA,MAAA,GAAA,SAAA,EAGL,KAAyB,IAAMC,GAAA,CA4B/B,MAAa,UACXC,EACAC,EACkB,CACX,OAAA,MAAMC,EAAAA,GAA4B,KAAK,QAAS,CACrD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACF,EAASG,UAAQ,EACxB,GAAG,KAAK,wBAAwB,EAEhC,GAAIF,CAAA,CACL,CACH,CAYA,MAAa,UACXG,EACAC,EACAJ,EACA,CACA,OAAO,MAAM,KAAK,YAChB,KAAK,aAAaG,EAAWC,EAASJ,CAAM,CAAA,CAEhD,CAYA,MAAa,aACXG,EACAC,EACAJ,EACA,CACA,KAAM,CAAE,QAAAK,EAAS,OAAAC,CAAO,EAAI,MAAMC,EAAA,GAChC,KAAK,QACL,CACE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACJ,EAAWC,CAAO,EACzB,GAAG,KAAK,wBAAwB,EAEhC,GAAIJ,CACN,CAAA,EAGK,MAAA,CAAE,KADI,MAAMQ,EAA6B,GAAA,KAAK,QAASH,CAAO,EACtD,OAAAC,EACjB,CAUgB,gBACdG,EACAC,EACyB,OACzB,KAAM,CAACC,EAAGC,CAAO,EAAI,KAAK,yBAAyBH,EAAUC,CAAQ,EAC/DG,EAAUF,EAChB,GAAI,CAACE,EAAQ,OAASA,EAAQ,QAAUC,EAAAA,YAAa,CACnD,MAAMC,EAAQH,EAAQ,QAClBA,EAAQ,QAAQ,QAChBA,EAAQ,OACNI,EAAA,WAAWJ,EAAQ,MAAM,EAAE,SAC3BK,EAAA,KAAK,WAAL,YAAAA,EAAe,QACrB,GAAIF,EACFF,EAAQ,MAAQE,MAEhB,OAAM,IAAIG,EAAoC,mCAElD,CACO,MAAA,CACL,IAAKpB,EAAA,EACL,SAAAqB,EACA,KAAM,CAACC,EAA6BP,CAAO,CAAC,EAC5C,GAAG,KAAK,wBAAwBD,EAAQ,OAAO,CAAA,CAEnD,CACF,EAnHyBhB,EAAA,KAAgB,6CASvCA,EAAuB,aAA6ByB,EAAa,aAAA,WApB5D,IAAMC,EAAN1B,EAwIA,SAASwB,EAA6B,CAC3C,MAAAL,EACA,OAAAQ,CACF,EAA0B,CACjB,OAAAC,EAAA,oBACL,CACE,CAAE,KAAM,UAAW,KAAM,OAAQ,EACjC,CAAE,KAAM,YAAa,KAAM,QAAS,CACtC,EACA,CAACT,EAAOQ,CAAM,CAAA,CAElB"}