@boostxyz/sdk 2.0.0-alpha.29 → 2.0.0-alpha.31

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 (101) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.js +2 -2
  3. package/dist/Actions/EventAction.cjs +1 -1
  4. package/dist/Actions/EventAction.cjs.map +1 -1
  5. package/dist/Actions/EventAction.d.ts +3 -1
  6. package/dist/Actions/EventAction.d.ts.map +1 -1
  7. package/dist/Actions/EventAction.js +91 -75
  8. package/dist/Actions/EventAction.js.map +1 -1
  9. package/dist/AllowLists/AllowList.cjs +1 -1
  10. package/dist/AllowLists/AllowList.js +3 -3
  11. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  12. package/dist/AllowLists/SimpleAllowList.js +6 -6
  13. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  14. package/dist/AllowLists/SimpleDenyList.js +3 -3
  15. package/dist/Auth/PassthroughAuth.cjs +1 -1
  16. package/dist/Auth/PassthroughAuth.js +1 -1
  17. package/dist/BoostCore.cjs +2 -2
  18. package/dist/BoostCore.cjs.map +1 -1
  19. package/dist/BoostCore.d.ts +5 -4
  20. package/dist/BoostCore.d.ts.map +1 -1
  21. package/dist/BoostCore.js +35 -34
  22. package/dist/BoostCore.js.map +1 -1
  23. package/dist/BoostRegistry.cjs +1 -1
  24. package/dist/BoostRegistry.js +13 -13
  25. package/dist/Budgets/Budget.cjs +1 -1
  26. package/dist/Budgets/Budget.js +2 -2
  27. package/dist/Budgets/ManagedBudget.cjs +1 -1
  28. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  29. package/dist/Budgets/ManagedBudget.d.ts +4 -3
  30. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  31. package/dist/Budgets/ManagedBudget.js +25 -25
  32. package/dist/Budgets/ManagedBudget.js.map +1 -1
  33. package/dist/Deployable/DeployableTarget.cjs +1 -1
  34. package/dist/Deployable/DeployableTarget.js +1 -1
  35. package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
  36. package/dist/Deployable/DeployableTargetWithRBAC.js +13 -13
  37. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  38. package/dist/Incentives/AllowListIncentive.js +10 -10
  39. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  40. package/dist/Incentives/CGDAIncentive.js +10 -10
  41. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  42. package/dist/Incentives/ERC20Incentive.js +16 -16
  43. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
  44. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +1 -1
  45. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +37 -1
  46. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -1
  47. package/dist/Incentives/ERC20VariableCriteriaIncentive.js +69 -50
  48. package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +1 -1
  49. package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
  50. package/dist/Incentives/ERC20VariableIncentive.js +6 -6
  51. package/dist/Incentives/Incentive.cjs +1 -1
  52. package/dist/Incentives/Incentive.js +2 -2
  53. package/dist/Incentives/PointsIncentive.cjs +1 -1
  54. package/dist/Incentives/PointsIncentive.js +8 -8
  55. package/dist/{SimpleDenyList-DqM-Bczx.cjs → SimpleDenyList-DEOJMCvF.cjs} +2 -2
  56. package/dist/{SimpleDenyList-DqM-Bczx.cjs.map → SimpleDenyList-DEOJMCvF.cjs.map} +1 -1
  57. package/dist/{SimpleDenyList-7BojkCuF.js → SimpleDenyList-Ddg3_VkW.js} +13 -13
  58. package/dist/{SimpleDenyList-7BojkCuF.js.map → SimpleDenyList-Ddg3_VkW.js.map} +1 -1
  59. package/dist/Validators/LimitedSignerValidator.cjs +1 -1
  60. package/dist/Validators/LimitedSignerValidator.js +2 -2
  61. package/dist/Validators/SignerValidator.cjs +1 -1
  62. package/dist/Validators/SignerValidator.js +5 -5
  63. package/dist/Validators/Validator.cjs +1 -1
  64. package/dist/Validators/Validator.js +2 -2
  65. package/dist/{componentInterfaces-BJ_XfE8j.cjs → componentInterfaces-BQw7DH-m.cjs} +2 -2
  66. package/dist/componentInterfaces-BQw7DH-m.cjs.map +1 -0
  67. package/dist/componentInterfaces-C0vuWQlh.js +15 -0
  68. package/dist/componentInterfaces-C0vuWQlh.js.map +1 -0
  69. package/dist/deployments-DAmmY7Gs.cjs +2 -0
  70. package/dist/deployments-DAmmY7Gs.cjs.map +1 -0
  71. package/dist/deployments-ZfLmhZat.js +56 -0
  72. package/dist/deployments-ZfLmhZat.js.map +1 -0
  73. package/dist/deployments.json +28 -28
  74. package/dist/{generated-Dz_g2mFT.js → generated-BwSyxdrd.js} +231 -213
  75. package/dist/generated-BwSyxdrd.js.map +1 -0
  76. package/dist/{generated-BSUMIFi5.cjs → generated-CtPS8IvR.cjs} +3 -3
  77. package/dist/generated-CtPS8IvR.cjs.map +1 -0
  78. package/dist/index.cjs +1 -1
  79. package/dist/index.js +16 -16
  80. package/dist/utils.cjs.map +1 -1
  81. package/dist/utils.d.ts +4 -0
  82. package/dist/utils.d.ts.map +1 -1
  83. package/dist/utils.js.map +1 -1
  84. package/package.json +1 -4
  85. package/src/Actions/EventAction.test.ts +1 -1
  86. package/src/Actions/EventAction.ts +20 -0
  87. package/src/BoostCore.test.ts +7 -7
  88. package/src/BoostCore.ts +7 -8
  89. package/src/Budgets/ManagedBudget.ts +7 -3
  90. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +3 -0
  91. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +36 -0
  92. package/src/utils.ts +7 -0
  93. package/dist/componentInterfaces-BJ_XfE8j.cjs.map +0 -1
  94. package/dist/componentInterfaces-DBJaFhsl.js +0 -15
  95. package/dist/componentInterfaces-DBJaFhsl.js.map +0 -1
  96. package/dist/deployments-Ccx1MtoK.js +0 -56
  97. package/dist/deployments-Ccx1MtoK.js.map +0 -1
  98. package/dist/deployments-DF_6-7hH.cjs +0 -2
  99. package/dist/deployments-DF_6-7hH.cjs.map +0 -1
  100. package/dist/generated-BSUMIFi5.cjs.map +0 -1
  101. package/dist/generated-Dz_g2mFT.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./BoostRegistry.cjs"),n=require("./BoostCore.cjs"),A=require("./Boost.cjs"),C=require("./Actions/Action.cjs"),a=require("./Actions/EventAction.cjs"),p=require("./AllowLists/AllowList.cjs"),c=require("./AllowLists/SimpleAllowList.cjs"),u=require("./SimpleDenyList-DqM-Bczx.cjs"),g=require("./Budgets/Budget.cjs"),o=require("./Budgets/ManagedBudget.cjs"),B=require("./Deployable/Deployable.cjs"),T=require("./Deployable/Contract.cjs"),V=require("./Deployable/DeployableTarget.cjs"),I=require("./Deployable/DeployableTargetWithRBAC.cjs"),S=require("./Incentives/AllowListIncentive.cjs"),m=require("./Incentives/CGDAIncentive.cjs"),v=require("./Incentives/ERC20Incentive.cjs"),P=require("./Incentives/ERC20VariableIncentive.cjs"),y=require("./Incentives/ERC20VariableCriteriaIncentive.cjs"),b=require("./Incentives/Incentive.cjs"),R=require("./Incentives/PointsIncentive.cjs"),l=require("./Validators/SignerValidator.cjs"),d=require("./Validators/LimitedSignerValidator.cjs"),E=require("./Validators/Validator.cjs"),e=require("./errors.cjs"),i=require("./utils.cjs"),D=require("./claiming.cjs"),t=require("./transfers.cjs"),L=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-BSUMIFi5.cjs");exports.BOOST_REGISTRY_ADDRESS=s.BOOST_REGISTRY_ADDRESS;exports.BOOST_REGISTRY_ADDRESSES=s.BOOST_REGISTRY_ADDRESSES;exports.BoostRegistry=s.BoostRegistry;exports.BOOST_CORE_ADDRESS=n.BOOST_CORE_ADDRESS;exports.BOOST_CORE_ADDRESSES=n.BOOST_CORE_ADDRESSES;exports.BOOST_CORE_CLAIM_FEE=n.BOOST_CORE_CLAIM_FEE;exports.BoostCore=n.BoostCore;exports.Boost=A.Boost;exports.prepareBoostPayload=A.prepareBoostPayload;exports.ActionByComponentInterface=C.ActionByComponentInterface;exports.actionFromAddress=C.actionFromAddress;exports.EventAction=a.EventAction;exports.FilterType=a.FilterType;exports.PrimitiveType=a.PrimitiveType;exports.SignatureType=a.SignatureType;exports.anyActionParameter=a.anyActionParameter;exports.isEventActionPayloadSimple=a.isEventActionPayloadSimple;exports.prepareEventActionPayload=a.prepareEventActionPayload;exports.transactionSenderClaimant=a.transactionSenderClaimant;exports.AllowListByComponentInterface=p.AllowListByComponentInterface;exports.OpenAllowList=p.OpenAllowList;exports.allowListFromAddress=p.allowListFromAddress;exports.LIST_MANAGER_ROLE=c.LIST_MANAGER_ROLE;exports.SimpleAllowList=c.SimpleAllowList;exports.prepareSimpleAllowListPayload=c.prepareSimpleAllowListPayload;exports.SimpleDenyList=u.SimpleDenyList;exports.prepareSimpleDenyListPayload=u.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=g.BudgetByComponentInterface;exports.budgetFromAddress=g.budgetFromAddress;exports.ManagedBudget=o.ManagedBudget;exports.ManagedBudgetRoles=o.ManagedBudgetRoles;exports.isERC1155TransferPayload=o.isERC1155TransferPayload;exports.isFungibleTransfer=o.isFungibleTransfer;exports.prepareManagedBudgetPayload=o.prepareManagedBudgetPayload;exports.prepareTransfer=o.prepareTransfer;exports.Deployable=B.Deployable;exports.Contract=T.Contract;exports.DeployableTarget=V.DeployableTarget;exports.DeployableTargetWithRBAC=I.DeployableTargetWithRBAC;exports.Roles=I.Roles;exports.AllowListIncentive=S.AllowListIncentive;exports.prepareAllowListIncentivePayload=S.prepareAllowListIncentivePayload;exports.CGDAIncentive=m.CGDAIncentive;exports.prepareCGDAIncentivePayload=m.prepareCGDAIncentivePayload;exports.ERC20Incentive=v.ERC20Incentive;exports.prepareERC20IncentivePayload=v.prepareERC20IncentivePayload;exports.ERC20VariableIncentive=P.ERC20VariableIncentive;exports.prepareERC20VariableIncentivePayload=P.prepareERC20VariableIncentivePayload;exports.ERC20VariableCriteriaIncentive=y.ERC20VariableCriteriaIncentive;exports.gasRebateIncentiveCriteria=y.gasRebateIncentiveCriteria;exports.prepareERC20VariableCriteriaIncentivePayload=y.prepareERC20VariableCriteriaIncentivePayload;exports.IncentiveByComponentInterface=b.IncentiveByComponentInterface;exports.incentiveFromAddress=b.incentiveFromAddress;exports.PointsIncentive=R.PointsIncentive;exports.preparePointsIncentivePayload=R.preparePointsIncentivePayload;exports.SignerValidator=l.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=l.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=l.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=l.prepareSignerValidatorPayload;exports.LimitedSignerValidator=d.LimitedSignerValidator;exports.prepareLimitedSignerValidatorClaimDataPayload=d.prepareLimitedSignerValidatorClaimDataPayload;exports.prepareLimitedSignerValidatorInputParams=d.prepareLimitedSignerValidatorInputParams;exports.prepareLimitedSignerValidatorPayload=d.prepareLimitedSignerValidatorPayload;exports.BoostValidatorEOA=E.BoostValidatorEOA;exports.ValidatorByComponentInterface=E.ValidatorByComponentInterface;exports.validatorFromAddress=E.validatorFromAddress;exports.BoostCoreNoIdentifierEmitted=e.BoostCoreNoIdentifierEmitted;exports.BoostNotFoundError=e.BoostNotFoundError;exports.BudgetMustAuthorizeBoostCore=e.BudgetMustAuthorizeBoostCore;exports.ContractAddressRequiredError=e.ContractAddressRequiredError;exports.DecodedArgsError=e.DecodedArgsError;exports.DecodedArgsMalformedError=e.DecodedArgsMalformedError;exports.DeployableAlreadyDeployedError=e.DeployableAlreadyDeployedError;exports.DeployableBuildParametersUnspecifiedError=e.DeployableBuildParametersUnspecifiedError;exports.DeployableMissingPayloadError=e.DeployableMissingPayloadError;exports.DeployableUnknownOwnerProvidedError=e.DeployableUnknownOwnerProvidedError;exports.DeployableWagmiConfigurationRequiredError=e.DeployableWagmiConfigurationRequiredError;exports.FieldActionValidationError=e.FieldActionValidationError;exports.FieldValueNotComparableError=e.FieldValueNotComparableError;exports.FieldValueUndefinedError=e.FieldValueUndefinedError;exports.FunctionDataDecodeError=e.FunctionDataDecodeError;exports.IncentiveCriteriaNotFoundError=e.IncentiveCriteriaNotFoundError;exports.IncentiveNotCloneableError=e.IncentiveNotCloneableError;exports.InvalidComponentInterfaceError=e.InvalidComponentInterfaceError;exports.InvalidCriteriaTypeError=e.InvalidCriteriaTypeError;exports.InvalidNumericalCriteriaError=e.InvalidNumericalCriteriaError;exports.InvalidProtocolChainIdError=e.InvalidProtocolChainIdError;exports.MustInitializeBudgetError=e.MustInitializeBudgetError;exports.NoConnectedChainIdError=e.NoConnectedChainIdError;exports.NoContractAddressUponReceiptError=e.NoContractAddressUponReceiptError;exports.NoEventActionStepsProvidedError=e.NoEventActionStepsProvidedError;exports.NoMatchingLogsError=e.NoMatchingLogsError;exports.TooManyEventActionStepsProvidedError=e.TooManyEventActionStepsProvidedError;exports.UnknownTransferPayloadSupplied=e.UnknownTransferPayloadSupplied;exports.UnparseableAbiParamError=e.UnparseableAbiParamError;exports.UnrecognizedFilterTypeError=e.UnrecognizedFilterTypeError;exports.ValidationAbiMissingError=e.ValidationAbiMissingError;exports.CheatCodes=i.CheatCodes;exports.RegistryType=i.RegistryType;exports.assertValidAddressByChainId=i.assertValidAddressByChainId;exports.awaitResult=i.awaitResult;exports.bytes4=i.bytes4;exports.getDeployedContractAddress=i.getDeployedContractAddress;exports.StrategyType=D.StrategyType;exports.prepareClaimPayload=D.prepareClaimPayload;exports.AssetType=t.AssetType;exports.prepareERC1155Payload=t.prepareERC1155Payload;exports.prepareERC1155Transfer=t.prepareERC1155Transfer;exports.prepareFungiblePayload=t.prepareFungiblePayload;exports.prepareFungibleTransfer=t.prepareFungibleTransfer;exports.prepareTransferPayload=t.prepareTransferPayload;exports.PassthroughAuth=L.PassthroughAuth;exports.allowListIncentiveAbi=r.C;exports.boostCoreAbi=r.A;exports.boostRegistryAbi=r.oe;exports.cgdaIncentiveAbi=r.f;exports.erc20IncentiveAbi=r.y;exports.erc20VariableCriteriaIncentiveAbi=r.b;exports.erc20VariableIncentiveAbi=r.v;exports.limitedSignerValidatorAbi=r.z;exports.managedBudgetAbi=r.d;exports.passthroughAuthAbi=r.Ve;exports.pointsIncentiveAbi=r.T;exports.rbacAbi=r.O;exports.signerValidatorAbi=r.S;exports.simpleAllowListAbi=r.g;exports.simpleDenyListAbi=r.M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./BoostRegistry.cjs"),n=require("./BoostCore.cjs"),A=require("./Boost.cjs"),C=require("./Actions/Action.cjs"),a=require("./Actions/EventAction.cjs"),p=require("./AllowLists/AllowList.cjs"),c=require("./AllowLists/SimpleAllowList.cjs"),u=require("./SimpleDenyList-DEOJMCvF.cjs"),g=require("./Budgets/Budget.cjs"),o=require("./Budgets/ManagedBudget.cjs"),B=require("./Deployable/Deployable.cjs"),T=require("./Deployable/Contract.cjs"),V=require("./Deployable/DeployableTarget.cjs"),I=require("./Deployable/DeployableTargetWithRBAC.cjs"),S=require("./Incentives/AllowListIncentive.cjs"),m=require("./Incentives/CGDAIncentive.cjs"),v=require("./Incentives/ERC20Incentive.cjs"),P=require("./Incentives/ERC20VariableIncentive.cjs"),E=require("./Incentives/ERC20VariableCriteriaIncentive.cjs"),b=require("./Incentives/Incentive.cjs"),R=require("./Incentives/PointsIncentive.cjs"),l=require("./Validators/SignerValidator.cjs"),d=require("./Validators/LimitedSignerValidator.cjs"),y=require("./Validators/Validator.cjs"),e=require("./errors.cjs"),i=require("./utils.cjs"),D=require("./claiming.cjs"),t=require("./transfers.cjs"),L=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-CtPS8IvR.cjs");exports.BOOST_REGISTRY_ADDRESS=s.BOOST_REGISTRY_ADDRESS;exports.BOOST_REGISTRY_ADDRESSES=s.BOOST_REGISTRY_ADDRESSES;exports.BoostRegistry=s.BoostRegistry;exports.BOOST_CORE_ADDRESS=n.BOOST_CORE_ADDRESS;exports.BOOST_CORE_ADDRESSES=n.BOOST_CORE_ADDRESSES;exports.BOOST_CORE_CLAIM_FEE=n.BOOST_CORE_CLAIM_FEE;exports.BoostCore=n.BoostCore;exports.Boost=A.Boost;exports.prepareBoostPayload=A.prepareBoostPayload;exports.ActionByComponentInterface=C.ActionByComponentInterface;exports.actionFromAddress=C.actionFromAddress;exports.EventAction=a.EventAction;exports.FilterType=a.FilterType;exports.PrimitiveType=a.PrimitiveType;exports.SignatureType=a.SignatureType;exports.anyActionParameter=a.anyActionParameter;exports.isEventActionPayloadSimple=a.isEventActionPayloadSimple;exports.prepareEventActionPayload=a.prepareEventActionPayload;exports.transactionSenderClaimant=a.transactionSenderClaimant;exports.AllowListByComponentInterface=p.AllowListByComponentInterface;exports.OpenAllowList=p.OpenAllowList;exports.allowListFromAddress=p.allowListFromAddress;exports.LIST_MANAGER_ROLE=c.LIST_MANAGER_ROLE;exports.SimpleAllowList=c.SimpleAllowList;exports.prepareSimpleAllowListPayload=c.prepareSimpleAllowListPayload;exports.SimpleDenyList=u.SimpleDenyList;exports.prepareSimpleDenyListPayload=u.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=g.BudgetByComponentInterface;exports.budgetFromAddress=g.budgetFromAddress;exports.ManagedBudget=o.ManagedBudget;exports.ManagedBudgetRoles=o.ManagedBudgetRoles;exports.isERC1155TransferPayload=o.isERC1155TransferPayload;exports.isFungibleTransfer=o.isFungibleTransfer;exports.prepareManagedBudgetPayload=o.prepareManagedBudgetPayload;exports.prepareTransfer=o.prepareTransfer;exports.Deployable=B.Deployable;exports.Contract=T.Contract;exports.DeployableTarget=V.DeployableTarget;exports.DeployableTargetWithRBAC=I.DeployableTargetWithRBAC;exports.Roles=I.Roles;exports.AllowListIncentive=S.AllowListIncentive;exports.prepareAllowListIncentivePayload=S.prepareAllowListIncentivePayload;exports.CGDAIncentive=m.CGDAIncentive;exports.prepareCGDAIncentivePayload=m.prepareCGDAIncentivePayload;exports.ERC20Incentive=v.ERC20Incentive;exports.prepareERC20IncentivePayload=v.prepareERC20IncentivePayload;exports.ERC20VariableIncentive=P.ERC20VariableIncentive;exports.prepareERC20VariableIncentivePayload=P.prepareERC20VariableIncentivePayload;exports.ERC20VariableCriteriaIncentive=E.ERC20VariableCriteriaIncentive;exports.gasRebateIncentiveCriteria=E.gasRebateIncentiveCriteria;exports.prepareERC20VariableCriteriaIncentivePayload=E.prepareERC20VariableCriteriaIncentivePayload;exports.IncentiveByComponentInterface=b.IncentiveByComponentInterface;exports.incentiveFromAddress=b.incentiveFromAddress;exports.PointsIncentive=R.PointsIncentive;exports.preparePointsIncentivePayload=R.preparePointsIncentivePayload;exports.SignerValidator=l.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=l.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=l.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=l.prepareSignerValidatorPayload;exports.LimitedSignerValidator=d.LimitedSignerValidator;exports.prepareLimitedSignerValidatorClaimDataPayload=d.prepareLimitedSignerValidatorClaimDataPayload;exports.prepareLimitedSignerValidatorInputParams=d.prepareLimitedSignerValidatorInputParams;exports.prepareLimitedSignerValidatorPayload=d.prepareLimitedSignerValidatorPayload;exports.BoostValidatorEOA=y.BoostValidatorEOA;exports.ValidatorByComponentInterface=y.ValidatorByComponentInterface;exports.validatorFromAddress=y.validatorFromAddress;exports.BoostCoreNoIdentifierEmitted=e.BoostCoreNoIdentifierEmitted;exports.BoostNotFoundError=e.BoostNotFoundError;exports.BudgetMustAuthorizeBoostCore=e.BudgetMustAuthorizeBoostCore;exports.ContractAddressRequiredError=e.ContractAddressRequiredError;exports.DecodedArgsError=e.DecodedArgsError;exports.DecodedArgsMalformedError=e.DecodedArgsMalformedError;exports.DeployableAlreadyDeployedError=e.DeployableAlreadyDeployedError;exports.DeployableBuildParametersUnspecifiedError=e.DeployableBuildParametersUnspecifiedError;exports.DeployableMissingPayloadError=e.DeployableMissingPayloadError;exports.DeployableUnknownOwnerProvidedError=e.DeployableUnknownOwnerProvidedError;exports.DeployableWagmiConfigurationRequiredError=e.DeployableWagmiConfigurationRequiredError;exports.FieldActionValidationError=e.FieldActionValidationError;exports.FieldValueNotComparableError=e.FieldValueNotComparableError;exports.FieldValueUndefinedError=e.FieldValueUndefinedError;exports.FunctionDataDecodeError=e.FunctionDataDecodeError;exports.IncentiveCriteriaNotFoundError=e.IncentiveCriteriaNotFoundError;exports.IncentiveNotCloneableError=e.IncentiveNotCloneableError;exports.InvalidComponentInterfaceError=e.InvalidComponentInterfaceError;exports.InvalidCriteriaTypeError=e.InvalidCriteriaTypeError;exports.InvalidNumericalCriteriaError=e.InvalidNumericalCriteriaError;exports.InvalidProtocolChainIdError=e.InvalidProtocolChainIdError;exports.MustInitializeBudgetError=e.MustInitializeBudgetError;exports.NoConnectedChainIdError=e.NoConnectedChainIdError;exports.NoContractAddressUponReceiptError=e.NoContractAddressUponReceiptError;exports.NoEventActionStepsProvidedError=e.NoEventActionStepsProvidedError;exports.NoMatchingLogsError=e.NoMatchingLogsError;exports.TooManyEventActionStepsProvidedError=e.TooManyEventActionStepsProvidedError;exports.UnknownTransferPayloadSupplied=e.UnknownTransferPayloadSupplied;exports.UnparseableAbiParamError=e.UnparseableAbiParamError;exports.UnrecognizedFilterTypeError=e.UnrecognizedFilterTypeError;exports.ValidationAbiMissingError=e.ValidationAbiMissingError;exports.CheatCodes=i.CheatCodes;exports.RegistryType=i.RegistryType;exports.assertValidAddressByChainId=i.assertValidAddressByChainId;exports.awaitResult=i.awaitResult;exports.bytes4=i.bytes4;exports.getDeployedContractAddress=i.getDeployedContractAddress;exports.StrategyType=D.StrategyType;exports.prepareClaimPayload=D.prepareClaimPayload;exports.AssetType=t.AssetType;exports.prepareERC1155Payload=t.prepareERC1155Payload;exports.prepareERC1155Transfer=t.prepareERC1155Transfer;exports.prepareFungiblePayload=t.prepareFungiblePayload;exports.prepareFungibleTransfer=t.prepareFungibleTransfer;exports.prepareTransferPayload=t.prepareTransferPayload;exports.PassthroughAuth=L.PassthroughAuth;exports.allowListIncentiveAbi=r.C;exports.boostCoreAbi=r.A;exports.boostRegistryAbi=r.oe;exports.cgdaIncentiveAbi=r.f;exports.erc20IncentiveAbi=r.d;exports.erc20VariableCriteriaIncentiveAbi=r.c;exports.erc20VariableIncentiveAbi=r.v;exports.limitedSignerValidatorAbi=r.z;exports.managedBudgetAbi=r.m;exports.passthroughAuthAbi=r.Ve;exports.pointsIncentiveAbi=r.T;exports.rbacAbi=r.O;exports.signerValidatorAbi=r.S;exports.simpleAllowListAbi=r.g;exports.simpleDenyListAbi=r.M;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { BOOST_REGISTRY_ADDRESS as o, BOOST_REGISTRY_ADDRESSES as a, BoostRegistry as t } from "./BoostRegistry.js";
2
2
  import { BOOST_CORE_ADDRESS as n, BOOST_CORE_ADDRESSES as p, BOOST_CORE_CLAIM_FEE as l, BoostCore as d } from "./BoostCore.js";
3
- import { Boost as m, prepareBoostPayload as A } from "./Boost.js";
4
- import { ActionByComponentInterface as y, actionFromAddress as E } from "./Actions/Action.js";
3
+ import { Boost as m, prepareBoostPayload as c } from "./Boost.js";
4
+ import { ActionByComponentInterface as E, actionFromAddress as y } from "./Actions/Action.js";
5
5
  import { EventAction as f, FilterType as g, PrimitiveType as b, SignatureType as I, anyActionParameter as S, isEventActionPayloadSimple as v, prepareEventActionPayload as P, transactionSenderClaimant as u } from "./Actions/EventAction.js";
6
6
  import { AllowListByComponentInterface as x, OpenAllowList as D, allowListFromAddress as B } from "./AllowLists/AllowList.js";
7
7
  import { LIST_MANAGER_ROLE as V, SimpleAllowList as L, prepareSimpleAllowListPayload as O } from "./AllowLists/SimpleAllowList.js";
8
- import { S as h, p as w } from "./SimpleDenyList-7BojkCuF.js";
8
+ import { S as h, p as w } from "./SimpleDenyList-Ddg3_VkW.js";
9
9
  import { BudgetByComponentInterface as _, budgetFromAddress as N } from "./Budgets/Budget.js";
10
10
  import { ManagedBudget as G, ManagedBudgetRoles as z, isERC1155TransferPayload as k, isFungibleTransfer as q, prepareManagedBudgetPayload as W, prepareTransfer as Y } from "./Budgets/ManagedBudget.js";
11
11
  import { Deployable as H } from "./Deployable/Deployable.js";
@@ -15,21 +15,21 @@ import { DeployableTargetWithRBAC as $, Roles as ee } from "./Deployable/Deploya
15
15
  import { AllowListIncentive as oe, prepareAllowListIncentivePayload as ae } from "./Incentives/AllowListIncentive.js";
16
16
  import { CGDAIncentive as ie, prepareCGDAIncentivePayload as ne } from "./Incentives/CGDAIncentive.js";
17
17
  import { ERC20Incentive as le, prepareERC20IncentivePayload as de } from "./Incentives/ERC20Incentive.js";
18
- import { ERC20VariableIncentive as me, prepareERC20VariableIncentivePayload as Ae } from "./Incentives/ERC20VariableIncentive.js";
19
- import { ERC20VariableCriteriaIncentive as ye, gasRebateIncentiveCriteria as Ee, prepareERC20VariableCriteriaIncentivePayload as Ce } from "./Incentives/ERC20VariableCriteriaIncentive.js";
18
+ import { ERC20VariableIncentive as me, prepareERC20VariableIncentivePayload as ce } from "./Incentives/ERC20VariableIncentive.js";
19
+ import { ERC20VariableCriteriaIncentive as Ee, gasRebateIncentiveCriteria as ye, prepareERC20VariableCriteriaIncentivePayload as Ce } from "./Incentives/ERC20VariableCriteriaIncentive.js";
20
20
  import { IncentiveByComponentInterface as ge, incentiveFromAddress as be } from "./Incentives/Incentive.js";
21
21
  import { PointsIncentive as Se, preparePointsIncentivePayload as ve } from "./Incentives/PointsIncentive.js";
22
22
  import { SignerValidator as ue, prepareSignerValidatorClaimDataPayload as Re, prepareSignerValidatorInputParams as xe, prepareSignerValidatorPayload as De } from "./Validators/SignerValidator.js";
23
23
  import { LimitedSignerValidator as Te, prepareLimitedSignerValidatorClaimDataPayload as Ve, prepareLimitedSignerValidatorInputParams as Le, prepareLimitedSignerValidatorPayload as Oe } from "./Validators/LimitedSignerValidator.js";
24
24
  import { BoostValidatorEOA as he, ValidatorByComponentInterface as we, validatorFromAddress as Me } from "./Validators/Validator.js";
25
- import { BoostCoreNoIdentifierEmitted as Ne, BoostNotFoundError as Ue, BudgetMustAuthorizeBoostCore as Ge, ContractAddressRequiredError as ze, DecodedArgsError as ke, DecodedArgsMalformedError as qe, DeployableAlreadyDeployedError as We, DeployableBuildParametersUnspecifiedError as Ye, DeployableMissingPayloadError as je, DeployableUnknownOwnerProvidedError as He, DeployableWagmiConfigurationRequiredError as Je, FieldActionValidationError as Ke, FieldValueNotComparableError as Qe, FieldValueUndefinedError as Xe, FunctionDataDecodeError as Ze, IncentiveCriteriaNotFoundError as $e, IncentiveNotCloneableError as er, InvalidComponentInterfaceError as rr, InvalidCriteriaTypeError as or, InvalidNumericalCriteriaError as ar, InvalidProtocolChainIdError as tr, MustInitializeBudgetError as ir, NoConnectedChainIdError as nr, NoContractAddressUponReceiptError as pr, NoEventActionStepsProvidedError as lr, NoMatchingLogsError as dr, TooManyEventActionStepsProvidedError as sr, UnknownTransferPayloadSupplied as mr, UnparseableAbiParamError as Ar, UnrecognizedFilterTypeError as cr, ValidationAbiMissingError as yr } from "./errors.js";
25
+ import { BoostCoreNoIdentifierEmitted as Ne, BoostNotFoundError as Ue, BudgetMustAuthorizeBoostCore as Ge, ContractAddressRequiredError as ze, DecodedArgsError as ke, DecodedArgsMalformedError as qe, DeployableAlreadyDeployedError as We, DeployableBuildParametersUnspecifiedError as Ye, DeployableMissingPayloadError as je, DeployableUnknownOwnerProvidedError as He, DeployableWagmiConfigurationRequiredError as Je, FieldActionValidationError as Ke, FieldValueNotComparableError as Qe, FieldValueUndefinedError as Xe, FunctionDataDecodeError as Ze, IncentiveCriteriaNotFoundError as $e, IncentiveNotCloneableError as er, InvalidComponentInterfaceError as rr, InvalidCriteriaTypeError as or, InvalidNumericalCriteriaError as ar, InvalidProtocolChainIdError as tr, MustInitializeBudgetError as ir, NoConnectedChainIdError as nr, NoContractAddressUponReceiptError as pr, NoEventActionStepsProvidedError as lr, NoMatchingLogsError as dr, TooManyEventActionStepsProvidedError as sr, UnknownTransferPayloadSupplied as mr, UnparseableAbiParamError as cr, UnrecognizedFilterTypeError as Ar, ValidationAbiMissingError as Er } from "./errors.js";
26
26
  import { CheatCodes as Cr, RegistryType as fr, assertValidAddressByChainId as gr, awaitResult as br, bytes4 as Ir, getDeployedContractAddress as Sr } from "./utils.js";
27
27
  import { StrategyType as Pr, prepareClaimPayload as ur } from "./claiming.js";
28
28
  import { AssetType as xr, prepareERC1155Payload as Dr, prepareERC1155Transfer as Br, prepareFungiblePayload as Tr, prepareFungibleTransfer as Vr, prepareTransferPayload as Lr } from "./transfers.js";
29
29
  import { PassthroughAuth as Fr } from "./Auth/PassthroughAuth.js";
30
- import { C as wr, A as Mr, o as _r, f as Nr, y as Ur, b as Gr, v as zr, z as kr, d as qr, V as Wr, T as Yr, O as jr, S as Hr, g as Jr, M as Kr } from "./generated-Dz_g2mFT.js";
30
+ import { C as wr, A as Mr, o as _r, f as Nr, d as Ur, c as Gr, v as zr, z as kr, m as qr, V as Wr, T as Yr, O as jr, S as Hr, g as Jr, M as Kr } from "./generated-BwSyxdrd.js";
31
31
  export {
32
- y as ActionByComponentInterface,
32
+ E as ActionByComponentInterface,
33
33
  x as AllowListByComponentInterface,
34
34
  oe as AllowListIncentive,
35
35
  xr as AssetType,
@@ -61,7 +61,7 @@ export {
61
61
  He as DeployableUnknownOwnerProvidedError,
62
62
  Je as DeployableWagmiConfigurationRequiredError,
63
63
  le as ERC20Incentive,
64
- ye as ERC20VariableCriteriaIncentive,
64
+ Ee as ERC20VariableCriteriaIncentive,
65
65
  me as ERC20VariableIncentive,
66
66
  f as EventAction,
67
67
  Ke as FieldActionValidationError,
@@ -98,11 +98,11 @@ export {
98
98
  Pr as StrategyType,
99
99
  sr as TooManyEventActionStepsProvidedError,
100
100
  mr as UnknownTransferPayloadSupplied,
101
- Ar as UnparseableAbiParamError,
102
- cr as UnrecognizedFilterTypeError,
103
- yr as ValidationAbiMissingError,
101
+ cr as UnparseableAbiParamError,
102
+ Ar as UnrecognizedFilterTypeError,
103
+ Er as ValidationAbiMissingError,
104
104
  we as ValidatorByComponentInterface,
105
- E as actionFromAddress,
105
+ y as actionFromAddress,
106
106
  B as allowListFromAddress,
107
107
  wr as allowListIncentiveAbi,
108
108
  S as anyActionParameter,
@@ -116,7 +116,7 @@ export {
116
116
  Ur as erc20IncentiveAbi,
117
117
  Gr as erc20VariableCriteriaIncentiveAbi,
118
118
  zr as erc20VariableIncentiveAbi,
119
- Ee as gasRebateIncentiveCriteria,
119
+ ye as gasRebateIncentiveCriteria,
120
120
  Sr as getDeployedContractAddress,
121
121
  be as incentiveFromAddress,
122
122
  k as isERC1155TransferPayload,
@@ -127,14 +127,14 @@ export {
127
127
  Wr as passthroughAuthAbi,
128
128
  Yr as pointsIncentiveAbi,
129
129
  ae as prepareAllowListIncentivePayload,
130
- A as prepareBoostPayload,
130
+ c as prepareBoostPayload,
131
131
  ne as prepareCGDAIncentivePayload,
132
132
  ur as prepareClaimPayload,
133
133
  Dr as prepareERC1155Payload,
134
134
  Br as prepareERC1155Transfer,
135
135
  de as prepareERC20IncentivePayload,
136
136
  Ce as prepareERC20VariableCriteriaIncentivePayload,
137
- Ae as prepareERC20VariableIncentivePayload,
137
+ ce as prepareERC20VariableIncentivePayload,
138
138
  P as prepareEventActionPayload,
139
139
  Tr as prepareFungiblePayload,
140
140
  Vr as prepareFungibleTransfer,
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n getAccount,\n getClient,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n Address,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport {\n InvalidProtocolChainIdError,\n NoConnectedChainIdError,\n NoContractAddressUponReceiptError,\n} from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n\n/**\n * Enum encapsulating all the different cheat codes for criteria modules.\n * @export\n * @enum {number}\n */\nexport enum CheatCodes {\n ANY_ACTION_PARAM = 255,\n TX_SENDER_CLAIMANT = 255,\n GAS_REBATE_INCENTIVE = 255,\n}\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi = Abi,\n functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {Promise<Address>}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * 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.\n *\n * @export\n * @param {Config} config\n * @param {Record<string, Address>} addressByChainId\n * @param {number} desiredChainId\n * @returns {{ chainId: number, address: Address }}\n * @throws {@link InvalidProtocolChainIdError}\n */\nexport function assertValidAddressByChainId(\n config: Config,\n addressByChainId: Record<number, Address>,\n desiredChainId?: number,\n): { chainId: number; address: Address } {\n let chainId: number | undefined = undefined;\n const wagmiAccount = getAccount(config);\n // if manually providing a chain id for some contract operation, try to use it\n if (desiredChainId !== undefined) {\n if (addressByChainId[desiredChainId]) chainId = desiredChainId;\n } else if (wagmiAccount.chainId !== undefined) {\n // otherwise if we can get the current chain id off the connected account and it matches one of ours, use it\n if (addressByChainId[wagmiAccount.chainId]) chainId = wagmiAccount.chainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const client = getClient(config);\n if (client?.chain.id && addressByChainId[client?.chain.id])\n chainId = client.chain.id;\n }\n // if chainId is STILL undefined, use our default addresses\n // TODO: update this when on prod network\n if (chainId === undefined) chainId = Number(__DEFAULT_CHAIN_ID__);\n if (!addressByChainId[chainId])\n throw new InvalidProtocolChainIdError(\n chainId,\n Object.keys(addressByChainId).map(Number),\n );\n // biome-ignore lint/style/noNonNullAssertion: this type should be narrowed by the above statement but isn't?\n return { chainId, address: addressByChainId[chainId]! };\n}\n"],"names":["RegistryType","CheatCodes","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiAccount","getAccount","client","getClient","InvalidProtocolChainIdError"],"mappings":"2JAqCY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,WAAa,CAAb,EAAA,aACAA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YALUA,IAAAA,GAAA,CAAA,CAAA,EAaAC,GAAAA,IACVA,EAAAA,EAAA,iBAAmB,GAAnB,EAAA,mBACAA,EAAAA,EAAA,mBAAqB,GAArB,EAAA,qBACAA,EAAAA,EAAA,qBAAuB,GAAvB,EAAA,uBAHUA,IAAAA,GAAA,CAAA,CAAA,EAyGL,SAASC,EAAOC,EAAe,CACpC,OAAOC,EAAM,MAAAC,EAAA,MAAMF,CAAK,EAAIG,EAAU,UAAAH,CAAK,EAAIG,EAAA,UAAUC,EAAM,MAAAJ,CAAK,CAAC,EAAG,EAAG,CAAC,CAC9E,CAasB,eAAAK,EACpBC,EACAC,EACAC,EACA,CACM,MAAAC,EAAU,MAAMC,EAAA,0BAA0BJ,EAAQ,CACtD,GAAGE,EACH,KAAM,MAAMD,CAAA,CACb,EACD,GAAI,CAACE,EAAQ,gBACL,MAAA,IAAIE,EAAAA,kCAAkCF,CAAO,EACrD,OAAOA,EAAQ,eACjB,CAsBsB,eAAAG,EACpBN,EACAO,EACAL,EACiB,CACjB,KAAM,CAAE,KAAAD,EAAM,OAAAO,CAAO,EAAI,MAAMD,EAC/B,aAAMH,EAAAA,0BAA0BJ,EAAQ,CACtC,GAAGE,EACH,KAAAD,CAAA,CACD,EACMO,CACT,CAYgB,SAAAC,EACdT,EACAU,EACAC,EACuC,CACvC,IAAIC,EACE,MAAAC,EAAeC,aAAWd,CAAM,EAStC,GAPIW,IAAmB,OACjBD,EAAiBC,CAAc,IAAaC,EAAAD,GACvCE,EAAa,UAAY,QAE9BH,EAAiBG,EAAa,OAAO,MAAaA,EAAa,SAGjED,IAAY,OAAW,CACnB,MAAAG,EAASC,YAAUhB,CAAM,EAC3Be,GAAA,MAAAA,EAAQ,MAAM,IAAML,EAAiBK,GAAA,YAAAA,EAAQ,MAAM,EAAE,IACvDH,EAAUG,EAAO,MAAM,GAC3B,CAII,GADAH,IAAY,SAAqBA,EAAO,UACxC,CAACF,EAAiBE,CAAO,EAC3B,MAAM,IAAIK,EAAA,4BACRL,EACA,OAAO,KAAKF,CAAgB,EAAE,IAAI,MAAM,CAAA,EAG5C,MAAO,CAAE,QAAAE,EAAS,QAASF,EAAiBE,CAAO,CAAG,CACxD"}
1
+ {"version":3,"file":"utils.cjs","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n getAccount,\n getClient,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n Address,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport {\n InvalidProtocolChainIdError,\n NoConnectedChainIdError,\n NoContractAddressUponReceiptError,\n} from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n\n/**\n * Enum encapsulating all the different cheat codes for criteria modules.\n * An Event Action action step criteria with a `fieldIndex` set to `CheatCodes.ANY_ACTION_PARAM`, fieldType set to `PrimitiveType.BYTES`, and `filterType` set to `FilterType.EQUAL` will always return true when validating the field, regardless of inputs\n * An Event Action `ActionClaimant` with a `fieldIndex` set to `CheatCodes.TX_SENDER_CLAIMANT`, will always validate with the sender of a given transaction.\n *\n *\n * @export\n * @enum {number}\n */\nexport enum CheatCodes {\n /* An Event Action action step criteria with a `fieldIndex` set to `CheatCodes.ANY_ACTION_PARAM`, fieldType set to `PrimitiveType.BYTES`, and `filterType` set to `FilterType.EQUAL` will always return true when validating the field, regardless of inputs */\n ANY_ACTION_PARAM = 255,\n /* An Event Action `ActionClaimant` with a `fieldIndex` set to `CheatCodes.TX_SENDER_CLAIMANT`, will always validate with the sender of a given transaction. */\n TX_SENDER_CLAIMANT = 255,\n /* For use with `ERC20VariableCriteriaIncentive`, if the criteria's `fieldIndex` is set to `CheatCodes.GAS_REBATE_INCENTIVE`, will claim an incentive amount equal to the transaction's gas used. */\n GAS_REBATE_INCENTIVE = 255,\n}\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi = Abi,\n functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {Promise<Address>}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * 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.\n *\n * @export\n * @param {Config} config\n * @param {Record<string, Address>} addressByChainId\n * @param {number} desiredChainId\n * @returns {{ chainId: number, address: Address }}\n * @throws {@link InvalidProtocolChainIdError}\n */\nexport function assertValidAddressByChainId(\n config: Config,\n addressByChainId: Record<number, Address>,\n desiredChainId?: number,\n): { chainId: number; address: Address } {\n let chainId: number | undefined = undefined;\n const wagmiAccount = getAccount(config);\n // if manually providing a chain id for some contract operation, try to use it\n if (desiredChainId !== undefined) {\n if (addressByChainId[desiredChainId]) chainId = desiredChainId;\n } else if (wagmiAccount.chainId !== undefined) {\n // otherwise if we can get the current chain id off the connected account and it matches one of ours, use it\n if (addressByChainId[wagmiAccount.chainId]) chainId = wagmiAccount.chainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const client = getClient(config);\n if (client?.chain.id && addressByChainId[client?.chain.id])\n chainId = client.chain.id;\n }\n // if chainId is STILL undefined, use our default addresses\n // TODO: update this when on prod network\n if (chainId === undefined) chainId = Number(__DEFAULT_CHAIN_ID__);\n if (!addressByChainId[chainId])\n throw new InvalidProtocolChainIdError(\n chainId,\n Object.keys(addressByChainId).map(Number),\n );\n // biome-ignore lint/style/noNonNullAssertion: this type should be narrowed by the above statement but isn't?\n return { chainId, address: addressByChainId[chainId]! };\n}\n"],"names":["RegistryType","CheatCodes","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiAccount","getAccount","client","getClient","InvalidProtocolChainIdError"],"mappings":"2JAqCY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,WAAa,CAAb,EAAA,aACAA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YALUA,IAAAA,GAAA,CAAA,CAAA,EAiBAC,GAAAA,IAEVA,EAAAA,EAAA,iBAAmB,GAAnB,EAAA,mBAEAA,EAAAA,EAAA,mBAAqB,GAArB,EAAA,qBAEAA,EAAAA,EAAA,qBAAuB,GAAvB,EAAA,uBANUA,IAAAA,GAAA,CAAA,CAAA,EA4GL,SAASC,EAAOC,EAAe,CACpC,OAAOC,EAAM,MAAAC,EAAA,MAAMF,CAAK,EAAIG,EAAU,UAAAH,CAAK,EAAIG,EAAA,UAAUC,EAAM,MAAAJ,CAAK,CAAC,EAAG,EAAG,CAAC,CAC9E,CAasB,eAAAK,EACpBC,EACAC,EACAC,EACA,CACM,MAAAC,EAAU,MAAMC,EAAA,0BAA0BJ,EAAQ,CACtD,GAAGE,EACH,KAAM,MAAMD,CAAA,CACb,EACD,GAAI,CAACE,EAAQ,gBACL,MAAA,IAAIE,EAAAA,kCAAkCF,CAAO,EACrD,OAAOA,EAAQ,eACjB,CAsBsB,eAAAG,EACpBN,EACAO,EACAL,EACiB,CACjB,KAAM,CAAE,KAAAD,EAAM,OAAAO,CAAO,EAAI,MAAMD,EAC/B,aAAMH,EAAAA,0BAA0BJ,EAAQ,CACtC,GAAGE,EACH,KAAAD,CAAA,CACD,EACMO,CACT,CAYgB,SAAAC,EACdT,EACAU,EACAC,EACuC,CACvC,IAAIC,EACE,MAAAC,EAAeC,aAAWd,CAAM,EAStC,GAPIW,IAAmB,OACjBD,EAAiBC,CAAc,IAAaC,EAAAD,GACvCE,EAAa,UAAY,QAE9BH,EAAiBG,EAAa,OAAO,MAAaA,EAAa,SAGjED,IAAY,OAAW,CACnB,MAAAG,EAASC,YAAUhB,CAAM,EAC3Be,GAAA,MAAAA,EAAQ,MAAM,IAAML,EAAiBK,GAAA,YAAAA,EAAQ,MAAM,EAAE,IACvDH,EAAUG,EAAO,MAAM,GAC3B,CAII,GADAH,IAAY,SAAqBA,EAAO,UACxC,CAACF,EAAiBE,CAAO,EAC3B,MAAM,IAAIK,EAAA,4BACRL,EACA,OAAO,KAAKF,CAAgB,EAAE,IAAI,MAAM,CAAA,EAG5C,MAAO,CAAE,QAAAE,EAAS,QAASF,EAAiBE,CAAO,CAAG,CACxD"}
package/dist/utils.d.ts CHANGED
@@ -17,6 +17,10 @@ export declare enum RegistryType {
17
17
  }
18
18
  /**
19
19
  * Enum encapsulating all the different cheat codes for criteria modules.
20
+ * An Event Action action step criteria with a `fieldIndex` set to `CheatCodes.ANY_ACTION_PARAM`, fieldType set to `PrimitiveType.BYTES`, and `filterType` set to `FilterType.EQUAL` will always return true when validating the field, regardless of inputs
21
+ * An Event Action `ActionClaimant` with a `fieldIndex` set to `CheatCodes.TX_SENDER_CLAIMANT`, will always validate with the sender of a given transaction.
22
+ *
23
+ *
20
24
  * @export
21
25
  * @enum {number}
22
26
  */
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAI7B,MAAM,aAAa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AE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CA0BvC"}
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n getAccount,\n getClient,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n Address,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport {\n InvalidProtocolChainIdError,\n NoConnectedChainIdError,\n NoContractAddressUponReceiptError,\n} from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n\n/**\n * Enum encapsulating all the different cheat codes for criteria modules.\n * @export\n * @enum {number}\n */\nexport enum CheatCodes {\n ANY_ACTION_PARAM = 255,\n TX_SENDER_CLAIMANT = 255,\n GAS_REBATE_INCENTIVE = 255,\n}\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi = Abi,\n functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {Promise<Address>}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * 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.\n *\n * @export\n * @param {Config} config\n * @param {Record<string, Address>} addressByChainId\n * @param {number} desiredChainId\n * @returns {{ chainId: number, address: Address }}\n * @throws {@link InvalidProtocolChainIdError}\n */\nexport function assertValidAddressByChainId(\n config: Config,\n addressByChainId: Record<number, Address>,\n desiredChainId?: number,\n): { chainId: number; address: Address } {\n let chainId: number | undefined = undefined;\n const wagmiAccount = getAccount(config);\n // if manually providing a chain id for some contract operation, try to use it\n if (desiredChainId !== undefined) {\n if (addressByChainId[desiredChainId]) chainId = desiredChainId;\n } else if (wagmiAccount.chainId !== undefined) {\n // otherwise if we can get the current chain id off the connected account and it matches one of ours, use it\n if (addressByChainId[wagmiAccount.chainId]) chainId = wagmiAccount.chainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const client = getClient(config);\n if (client?.chain.id && addressByChainId[client?.chain.id])\n chainId = client.chain.id;\n }\n // if chainId is STILL undefined, use our default addresses\n // TODO: update this when on prod network\n if (chainId === undefined) chainId = Number(__DEFAULT_CHAIN_ID__);\n if (!addressByChainId[chainId])\n throw new InvalidProtocolChainIdError(\n chainId,\n Object.keys(addressByChainId).map(Number),\n );\n // biome-ignore lint/style/noNonNullAssertion: this type should be narrowed by the above statement but isn't?\n return { chainId, address: addressByChainId[chainId]! };\n}\n"],"names":["RegistryType","CheatCodes","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiAccount","getAccount","client","getClient","InvalidProtocolChainIdError"],"mappings":";;;AAqCY,IAAAA,sBAAAA,O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,EAAQ,MAAM,MAAML,EAAiBK,KAAA,gBAAAA,EAAQ,MAAM,EAAE,MACvDH,IAAUG,EAAO,MAAM;AAAA,EAC3B;AAII,MADAH,MAAY,WAAqBA,IAAO,WACxC,CAACF,EAAiBE,CAAO;AAC3B,UAAM,IAAIK;AAAA,MACRL;AAAA,MACA,OAAO,KAAKF,CAAgB,EAAE,IAAI,MAAM;AAAA,IAAA;AAG5C,SAAO,EAAE,SAAAE,GAAS,SAASF,EAAiBE,CAAO,EAAG;AACxD;"}
1
+ {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n getAccount,\n getClient,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n Address,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport {\n InvalidProtocolChainIdError,\n NoConnectedChainIdError,\n NoContractAddressUponReceiptError,\n} from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n\n/**\n * Enum encapsulating all the different cheat codes for criteria modules.\n * An Event Action action step criteria with a `fieldIndex` set to `CheatCodes.ANY_ACTION_PARAM`, fieldType set to `PrimitiveType.BYTES`, and `filterType` set to `FilterType.EQUAL` will always return true when validating the field, regardless of inputs\n * An Event Action `ActionClaimant` with a `fieldIndex` set to `CheatCodes.TX_SENDER_CLAIMANT`, will always validate with the sender of a given transaction.\n *\n *\n * @export\n * @enum {number}\n */\nexport enum CheatCodes {\n /* An Event Action action step criteria with a `fieldIndex` set to `CheatCodes.ANY_ACTION_PARAM`, fieldType set to `PrimitiveType.BYTES`, and `filterType` set to `FilterType.EQUAL` will always return true when validating the field, regardless of inputs */\n ANY_ACTION_PARAM = 255,\n /* An Event Action `ActionClaimant` with a `fieldIndex` set to `CheatCodes.TX_SENDER_CLAIMANT`, will always validate with the sender of a given transaction. */\n TX_SENDER_CLAIMANT = 255,\n /* For use with `ERC20VariableCriteriaIncentive`, if the criteria's `fieldIndex` is set to `CheatCodes.GAS_REBATE_INCENTIVE`, will claim an incentive amount equal to the transaction's gas used. */\n GAS_REBATE_INCENTIVE = 255,\n}\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi = Abi,\n functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {Promise<Address>}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * 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.\n *\n * @export\n * @param {Config} config\n * @param {Record<string, Address>} addressByChainId\n * @param {number} desiredChainId\n * @returns {{ chainId: number, address: Address }}\n * @throws {@link InvalidProtocolChainIdError}\n */\nexport function assertValidAddressByChainId(\n config: Config,\n addressByChainId: Record<number, Address>,\n desiredChainId?: number,\n): { chainId: number; address: Address } {\n let chainId: number | undefined = undefined;\n const wagmiAccount = getAccount(config);\n // if manually providing a chain id for some contract operation, try to use it\n if (desiredChainId !== undefined) {\n if (addressByChainId[desiredChainId]) chainId = desiredChainId;\n } else if (wagmiAccount.chainId !== undefined) {\n // otherwise if we can get the current chain id off the connected account and it matches one of ours, use it\n if (addressByChainId[wagmiAccount.chainId]) chainId = wagmiAccount.chainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const client = getClient(config);\n if (client?.chain.id && addressByChainId[client?.chain.id])\n chainId = client.chain.id;\n }\n // if chainId is STILL undefined, use our default addresses\n // TODO: update this when on prod network\n if (chainId === undefined) chainId = Number(__DEFAULT_CHAIN_ID__);\n if (!addressByChainId[chainId])\n throw new InvalidProtocolChainIdError(\n chainId,\n Object.keys(addressByChainId).map(Number),\n );\n // biome-ignore lint/style/noNonNullAssertion: this type should be narrowed by the above statement but isn't?\n return { chainId, address: addressByChainId[chainId]! };\n}\n"],"names":["RegistryType","CheatCodes","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiAccount","getAccount","client","getClient","InvalidProtocolChainIdError"],"mappings":";;;AAqCY,IAAAA,sBAAAA,OACVA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,aAAa,CAAb,IAAA,cACAA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aALUA,IAAAA,KAAA,CAAA,CAAA,GAiBAC,sBAAAA,OAEVA,EAAAA,EAAA,mBAAmB,GAAnB,IAAA,oBAEAA,EAAAA,EAAA,qBAAqB,GAArB,IAAA,sBAEAA,EAAAA,EAAA,uBAAuB,GAAvB,IAAA,wBANUA,IAAAA,KAAA,CAAA,CAAA;AA4GL,SAASC,EAAOC,GAAe;AACpC,SAAOC,EAAMC,EAAMF,CAAK,IAAIG,EAAUH,CAAK,IAAIG,EAAUC,EAAMJ,CAAK,CAAC,GAAG,GAAG,CAAC;AAC9E;AAasB,eAAAK,EACpBC,GACAC,GACAC,GACA;AACM,QAAAC,IAAU,MAAMC,EAA0BJ,GAAQ;AAAA,IACtD,GAAGE;AAAA,IACH,MAAM,MAAMD;AAAA,EAAA,CACb;AACD,MAAI,CAACE,EAAQ;AACL,UAAA,IAAIE,EAAkCF,CAAO;AACrD,SAAOA,EAAQ;AACjB;AAsBsB,eAAAG,EACpBN,GACAO,GACAL,GACiB;AACjB,QAAM,EAAE,MAAAD,GAAM,QAAAO,EAAO,IAAI,MAAMD;AAC/B,eAAMH,EAA0BJ,GAAQ;AAAA,IACtC,GAAGE;AAAA,IACH,MAAAD;AAAA,EAAA,CACD,GACMO;AACT;AAYgB,SAAAC,EACdT,GACAU,GACAC,GACuC;AACvC,MAAIC;AACE,QAAAC,IAAeC,EAAWd,CAAM;AAStC,MAPIW,MAAmB,SACjBD,EAAiBC,CAAc,MAAaC,IAAAD,KACvCE,EAAa,YAAY,UAE9BH,EAAiBG,EAAa,OAAO,UAAaA,EAAa,UAGjED,MAAY,QAAW;AACnB,UAAAG,IAASC,EAAUhB,CAAM;AAC/B,IAAIe,KAAA,QAAAA,EAAQ,MAAM,MAAML,EAAiBK,KAAA,gBAAAA,EAAQ,MAAM,EAAE,MACvDH,IAAUG,EAAO,MAAM;AAAA,EAC3B;AAII,MADAH,MAAY,WAAqBA,IAAO,WACxC,CAACF,EAAiBE,CAAO;AAC3B,UAAM,IAAIK;AAAA,MACRL;AAAA,MACA,OAAO,KAAKF,CAAgB,EAAE,IAAI,MAAM;AAAA,IAAA;AAG5C,SAAO,EAAE,SAAAE,GAAS,SAASF,EAAiBE,CAAO,EAAG;AACxD;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boostxyz/sdk",
3
- "version": "2.0.0-alpha.29",
3
+ "version": "2.0.0-alpha.31",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "files": [
@@ -215,9 +215,6 @@
215
215
  "dependencies": {
216
216
  "ts-pattern": "5.4.0"
217
217
  },
218
- "optionalDependencies": {
219
- "@boostxyz/evm": "2.0.0-alpha.24"
220
- },
221
218
  "peerDependencies": {
222
219
  "@wagmi/core": "2.x",
223
220
  "abitype": "1",
@@ -873,7 +873,7 @@ describe("validateFieldAgainstCriteria unit tests", () => {
873
873
 
874
874
  test("should throw UnrecognizedFilterTypeError for unrecognized filter type", () => {
875
875
  const mockCriteria = createMockCriteria(
876
- 6 as FilterType,
876
+ 8 as FilterType,
877
877
  PrimitiveType.STRING,
878
878
  "0x74657374",
879
879
  ); // Decoded value: 'test'
@@ -72,6 +72,8 @@ export enum FilterType {
72
72
  LESS_THAN = 3,
73
73
  CONTAINS = 4,
74
74
  REGEX = 5,
75
+ GREATER_THAN_OR_EQUAL = 6,
76
+ LESS_THAN_OR_EQUAL = 7,
75
77
  }
76
78
 
77
79
  /**
@@ -908,6 +910,15 @@ export class EventAction extends DeployableTarget<
908
910
  criteria,
909
911
  fieldValue,
910
912
  });
913
+ case FilterType.GREATER_THAN_OR_EQUAL:
914
+ if (criteria.fieldType === PrimitiveType.UINT) {
915
+ return BigInt(fieldValue) >= BigInt(criteria.filterData);
916
+ }
917
+ throw new InvalidNumericalCriteriaError({
918
+ ...input,
919
+ criteria,
920
+ fieldValue,
921
+ });
911
922
 
912
923
  case FilterType.LESS_THAN:
913
924
  if (criteria.fieldType === PrimitiveType.UINT) {
@@ -918,6 +929,15 @@ export class EventAction extends DeployableTarget<
918
929
  criteria,
919
930
  fieldValue,
920
931
  });
932
+ case FilterType.LESS_THAN_OR_EQUAL:
933
+ if (criteria.fieldType === PrimitiveType.UINT) {
934
+ return BigInt(fieldValue) <= BigInt(criteria.filterData);
935
+ }
936
+ throw new InvalidNumericalCriteriaError({
937
+ ...input,
938
+ criteria,
939
+ fieldValue,
940
+ });
921
941
 
922
942
  case FilterType.CONTAINS:
923
943
  if (
@@ -78,7 +78,7 @@ describe("BoostCore", () => {
78
78
  const { core } = fixtures;
79
79
  const { budget, erc20 } = budgets;
80
80
  const boost = await core.createBoost({
81
- protocolFee: 1n,
81
+ protocolFee: 0n,
82
82
  maxParticipants: 100n,
83
83
  budget: budget,
84
84
  action: core.EventAction(
@@ -160,7 +160,7 @@ describe("BoostCore", () => {
160
160
  const { core } = fixtures;
161
161
  const { budget, erc20 } = budgets;
162
162
  const _boost = await core.createBoost({
163
- protocolFee: 1n,
163
+ protocolFee: 0n,
164
164
  maxParticipants: 100n,
165
165
  budget: budget,
166
166
  action: core.EventAction(
@@ -188,7 +188,7 @@ describe("BoostCore", () => {
188
188
  ],
189
189
  });
190
190
  const boost = await core.readBoost(_boost.id);
191
- expect(boost.protocolFee).toBe(1001n);
191
+ expect(boost.protocolFee).toBe(1000n);
192
192
  expect(boost.maxParticipants).toBe(100n);
193
193
  expect(boost.budget).toBe(_boost.budget.assertValidAddress());
194
194
  expect(boost.action).toBe(_boost.action.assertValidAddress());
@@ -203,7 +203,7 @@ describe("BoostCore", () => {
203
203
  const { core } = fixtures;
204
204
  const { budget, erc20 } = budgets;
205
205
  const _boost = await core.createBoost({
206
- protocolFee: 1n,
206
+ protocolFee: 0n,
207
207
  maxParticipants: 100n,
208
208
  budget: budget,
209
209
  action: core.EventAction(
@@ -234,7 +234,7 @@ describe("BoostCore", () => {
234
234
  const { core } = fixtures;
235
235
  const { budget, erc20 } = budgets;
236
236
  const simulated = await core.simulateCreateBoost({
237
- protocolFee: 1n,
237
+ protocolFee: 0n,
238
238
  maxParticipants: 100n,
239
239
  budget: budget,
240
240
  action: core.EventAction(
@@ -569,7 +569,7 @@ describe("BoostCore", () => {
569
569
  });
570
570
 
571
571
  await core.createBoost({
572
- protocolFee: 1n,
572
+ protocolFee: 0n,
573
573
  maxParticipants: 100n,
574
574
  budget: budget,
575
575
  action: core.EventAction(
@@ -730,7 +730,7 @@ describe("BoostCore", () => {
730
730
  core.subscribe(subscription, { pollingInterval: 100 });
731
731
  const { budget, erc20 } = budgets;
732
732
  await core.createBoost({
733
- protocolFee: 1n,
733
+ protocolFee: 0n,
734
734
  maxParticipants: 100n,
735
735
  budget: budget,
736
736
  action: core.EventAction(
package/src/BoostCore.ts CHANGED
@@ -324,19 +324,19 @@ export class BoostCore extends Deployable<
324
324
  /**
325
325
  * Create a new Boost.
326
326
  *
327
+ *
327
328
  * @public
328
329
  * @async
329
330
  * @param {CreateBoostPayload} _boostPayload
330
- * @param {?DeployableOptions} [_params]
331
+ * @param {?WriteParams} [params]
331
332
  * @returns {Promise<Boost>}
332
333
  */
333
334
  public async createBoost(
334
335
  _boostPayload: CreateBoostPayload,
335
- _params?: DeployableOptions &
336
- WriteParams<typeof boostCoreAbi, 'createBoost'>,
336
+ _params?: WriteParams<typeof boostCoreAbi, 'createBoost'>,
337
337
  ) {
338
338
  const [payload, options] =
339
- this.validateDeploymentConfig<CreateBoostPayload>(_boostPayload, _params);
339
+ this.validateDeploymentConfig<CreateBoostPayload>(_boostPayload);
340
340
  const desiredChainId = _params?.chain?.id || _params?.chainId;
341
341
  const { chainId, address: coreAddress } = assertValidAddressByChainId(
342
342
  options.config,
@@ -398,16 +398,15 @@ export class BoostCore extends Deployable<
398
398
  * @public
399
399
  * @async
400
400
  * @param {CreateBoostPayload} _boostPayload
401
- * @param {?DeployableOptions} [_params]
401
+ * @param {?WriteParams} [params]
402
402
  * @returns {Promise<SimulateContractReturnType>}
403
403
  */
404
404
  public async simulateCreateBoost(
405
405
  _boostPayload: CreateBoostPayload,
406
- _params?: DeployableOptions &
407
- WriteParams<typeof boostCoreAbi, 'createBoost'>,
406
+ _params?: WriteParams<typeof boostCoreAbi, 'createBoost'>,
408
407
  ) {
409
408
  const [payload, options] =
410
- this.validateDeploymentConfig<CreateBoostPayload>(_boostPayload, _params);
409
+ this.validateDeploymentConfig<CreateBoostPayload>(_boostPayload);
411
410
  const desiredChainId = _params?.chain?.id || _params?.chainId;
412
411
  const { chainId, address: coreAddress } = assertValidAddressByChainId(
413
412
  options.config,
@@ -28,7 +28,10 @@ import type {
28
28
  DeployableOptions,
29
29
  GenericDeployableParams,
30
30
  } from '../Deployable/Deployable';
31
- import { DeployableTargetWithRBAC } from '../Deployable/DeployableTargetWithRBAC';
31
+ import {
32
+ DeployableTargetWithRBAC,
33
+ type Roles,
34
+ } from '../Deployable/DeployableTargetWithRBAC';
32
35
  import {
33
36
  DeployableUnknownOwnerProvidedError,
34
37
  UnknownTransferPayloadSupplied,
@@ -71,9 +74,9 @@ export interface ManagedBudgetPayload {
71
74
  /**
72
75
  * List of roles to assign to the corresponding account by index.
73
76
  *
74
- * @type {ManagedBudgetRoles[]}
77
+ * @type {Roles[]}
75
78
  */
76
- roles: ManagedBudgetRoles[];
79
+ roles: Roles[];
77
80
  }
78
81
 
79
82
  /**
@@ -81,6 +84,7 @@ export interface ManagedBudgetPayload {
81
84
  * `MANAGER` can disburse funds.
82
85
  * `ADMIN` can additionally manage authorized users on the budget.
83
86
  *
87
+ * @deprecated use {@link Roles} instead
84
88
  * @export
85
89
  * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}
86
90
  * @enum {bigint}
@@ -75,6 +75,7 @@ export function basicErc721TransferScalarPayload(
75
75
  asset: erc721.assertValidAddress(),
76
76
  reward: 1n,
77
77
  limit: 1n,
78
+ maxReward: 0n,
78
79
  criteria: basicErc721TransferScalarCriteria(erc721),
79
80
  };
80
81
  }
@@ -145,6 +146,7 @@ describe('ERC20VariableCriteriaIncentive', () => {
145
146
  asset: budgets.erc20.assertValidAddress(),
146
147
  reward: 1n,
147
148
  limit: 1n,
149
+ maxReward: 0n,
148
150
  criteria: basicErc721MintScalarCriteria(erc721),
149
151
  });
150
152
 
@@ -175,6 +177,7 @@ describe('ERC20VariableCriteriaIncentive', () => {
175
177
  asset: budgets.erc20.assertValidAddress(),
176
178
  reward: 1n,
177
179
  limit: 1n,
180
+ maxReward: 0n,
178
181
  criteria: gasRebateCriteria,
179
182
  });
180
183
 
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  erc20VariableCriteriaIncentiveAbi,
3
3
  readErc20VariableCriteriaIncentiveGetIncentiveCriteria,
4
+ readErc20VariableCriteriaIncentiveGetMaxReward,
4
5
  } from '@boostxyz/evm';
5
6
  import { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableCriteriaIncentive.sol/ERC20VariableCriteriaIncentive.json';
6
7
  import { getTransaction, getTransactionReceipt } from '@wagmi/core';
@@ -51,6 +52,13 @@ export interface ERC20VariableCriteriaIncentivePayload {
51
52
  * @type {bigint}
52
53
  */
53
54
  limit: bigint;
55
+ /**
56
+ * The total amount claimable in a single claim or maximum per-action reward.
57
+ *
58
+ * @type {bigint}
59
+ * @optional
60
+ */
61
+ maxReward?: bigint;
54
62
  /**
55
63
  * The criteria for the incentive that determines how the reward is distributed.
56
64
  *
@@ -157,6 +165,30 @@ export class ERC20VariableCriteriaIncentive extends ERC20VariableIncentive<
157
165
  }
158
166
  }
159
167
 
168
+ /**
169
+ * Fetches the IncentiveCriteria struct from the contract
170
+ *
171
+ * @param {?ReadParams} [params]
172
+ * @returns {Promise<IncentiveCriteria>} Incentive criteria structure
173
+ * @throws {IncentiveCriteriaNotFoundError}
174
+ */
175
+ public async getMaxReward(
176
+ params?: ReadParams<
177
+ typeof erc20VariableCriteriaIncentiveAbi,
178
+ 'getIncentiveCriteria'
179
+ >,
180
+ ): Promise<bigint> {
181
+ const maxReward = await readErc20VariableCriteriaIncentiveGetMaxReward(
182
+ this._config,
183
+ {
184
+ ...params,
185
+ address: this.assertValidAddress(),
186
+ },
187
+ );
188
+
189
+ return maxReward;
190
+ }
191
+
160
192
  /**
161
193
  * Fetches the incentive scalar from a transaction hash
162
194
  *
@@ -319,6 +351,7 @@ export function gasRebateIncentiveCriteria(): IncentiveCriteria {
319
351
  * @param {Address} param0.asset - The address of the ERC20 asset to incentivize.
320
352
  * @param {bigint} param0.reward - The reward amount to distribute per action.
321
353
  * @param {bigint} param0.limit - The total limit of the asset distribution.
354
+ * @param {bigint} param0.maxReward - The maximum value claimable from a single completion.
322
355
  * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.
323
356
  * @returns {Hex}
324
357
  */
@@ -326,6 +359,7 @@ export function prepareERC20VariableCriteriaIncentivePayload({
326
359
  asset,
327
360
  reward,
328
361
  limit,
362
+ maxReward = 0n,
329
363
  criteria,
330
364
  }: ERC20VariableCriteriaIncentivePayload) {
331
365
  return encodeAbiParameters(
@@ -337,6 +371,7 @@ export function prepareERC20VariableCriteriaIncentivePayload({
337
371
  { type: 'address', name: 'asset' },
338
372
  { type: 'uint256', name: 'reward' },
339
373
  { type: 'uint256', name: 'limit' },
374
+ { type: 'uint256', name: 'maxReward' },
340
375
  {
341
376
  type: 'tuple',
342
377
  name: 'criteria',
@@ -355,6 +390,7 @@ export function prepareERC20VariableCriteriaIncentivePayload({
355
390
  asset: asset,
356
391
  reward: reward,
357
392
  limit: limit,
393
+ maxReward: maxReward,
358
394
  criteria: {
359
395
  criteriaType: criteria.criteriaType,
360
396
  signature: criteria.signature,
package/src/utils.ts CHANGED
@@ -45,12 +45,19 @@ export enum RegistryType {
45
45
 
46
46
  /**
47
47
  * Enum encapsulating all the different cheat codes for criteria modules.
48
+ * An Event Action action step criteria with a `fieldIndex` set to `CheatCodes.ANY_ACTION_PARAM`, fieldType set to `PrimitiveType.BYTES`, and `filterType` set to `FilterType.EQUAL` will always return true when validating the field, regardless of inputs
49
+ * An Event Action `ActionClaimant` with a `fieldIndex` set to `CheatCodes.TX_SENDER_CLAIMANT`, will always validate with the sender of a given transaction.
50
+ *
51
+ *
48
52
  * @export
49
53
  * @enum {number}
50
54
  */
51
55
  export enum CheatCodes {
56
+ /* An Event Action action step criteria with a `fieldIndex` set to `CheatCodes.ANY_ACTION_PARAM`, fieldType set to `PrimitiveType.BYTES`, and `filterType` set to `FilterType.EQUAL` will always return true when validating the field, regardless of inputs */
52
57
  ANY_ACTION_PARAM = 255,
58
+ /* An Event Action `ActionClaimant` with a `fieldIndex` set to `CheatCodes.TX_SENDER_CLAIMANT`, will always validate with the sender of a given transaction. */
53
59
  TX_SENDER_CLAIMANT = 255,
60
+ /* For use with `ERC20VariableCriteriaIncentive`, if the criteria's `fieldIndex` is set to `CheatCodes.GAS_REBATE_INCENTIVE`, will claim an incentive amount equal to the transaction's gas used. */
54
61
  GAS_REBATE_INCENTIVE = 255,
55
62
  }
56
63
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"componentInterfaces-BJ_XfE8j.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}