@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/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./BoostRegistry.cjs"),a=require("./BoostCore.cjs"),c=require("./Boost.cjs"),y=require("./Actions/Action.cjs"),o=require("./Actions/EventAction.cjs"),l=require("./AllowLists/AllowList.cjs"),s=require("./AllowLists/SimpleAllowList.cjs"),u=require("./SimpleDenyList-CqT0BMP7.cjs"),A=require("./Budgets/Budget.cjs"),t=require("./Budgets/ManagedBudget.cjs"),m=require("./Deployable/Deployable.cjs"),P=require("./Deployable/Contract.cjs"),S=require("./Deployable/DeployableTarget.cjs"),E=require("./Incentives/AllowListIncentive.cjs"),g=require("./Incentives/CGDAIncentive.cjs"),v=require("./Incentives/ERC20Incentive.cjs"),d=require("./Incentives/Incentive.cjs"),C=require("./Incentives/PointsIncentive.cjs"),n=require("./Validators/SignerValidator.cjs"),I=require("./Validators/Validator.cjs"),e=require("./errors.cjs"),i=require("./utils.cjs"),B=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-wKBNvm48.cjs");exports.BOOST_REGISTRY_ADDRESS=p.BOOST_REGISTRY_ADDRESS;exports.BoostRegistry=p.BoostRegistry;exports.BOOST_CORE_ADDRESS=a.BOOST_CORE_ADDRESS;exports.BOOST_CORE_CLAIM_FEE=a.BOOST_CORE_CLAIM_FEE;exports.BoostCore=a.BoostCore;exports.Boost=c.Boost;exports.prepareBoostPayload=c.prepareBoostPayload;exports.ActionByComponentInterface=y.ActionByComponentInterface;exports.actionFromAddress=y.actionFromAddress;exports.EventAction=o.EventAction;exports.FilterType=o.FilterType;exports.PrimitiveType=o.PrimitiveType;exports.SignatureType=o.SignatureType;exports.isEventActionPayloadSimple=o.isEventActionPayloadSimple;exports.prepareEventActionPayload=o.prepareEventActionPayload;exports.AllowListByComponentInterface=l.AllowListByComponentInterface;exports.OpenAllowList=l.OpenAllowList;exports.allowListFromAddress=l.allowListFromAddress;exports.LIST_MANAGER_ROLE=s.LIST_MANAGER_ROLE;exports.SimpleAllowList=s.SimpleAllowList;exports.prepareSimpleAllowListPayload=s.prepareSimpleAllowListPayload;exports.SimpleDenyList=u.SimpleDenyList;exports.prepareSimpleDenyListPayload=u.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=A.BudgetByComponentInterface;exports.budgetFromAddress=A.budgetFromAddress;exports.ManagedBudget=t.ManagedBudget;exports.ManagedBudgetRoles=t.ManagedBudgetRoles;exports.isERC1155TransferPayload=t.isERC1155TransferPayload;exports.isFungibleTransfer=t.isFungibleTransfer;exports.prepareManagedBudgetPayload=t.prepareManagedBudgetPayload;exports.prepareTransfer=t.prepareTransfer;exports.Deployable=m.Deployable;exports.Contract=P.Contract;exports.DeployableTarget=S.DeployableTarget;exports.AllowListIncentive=E.AllowListIncentive;exports.prepareAllowListIncentivePayload=E.prepareAllowListIncentivePayload;exports.CGDAIncentive=g.CGDAIncentive;exports.prepareCGDAIncentivePayload=g.prepareCGDAIncentivePayload;exports.ERC20Incentive=v.ERC20Incentive;exports.prepareERC20IncentivePayload=v.prepareERC20IncentivePayload;exports.ERC20VariableIncentive=d.ERC20VariableIncentive;exports.IncentiveByComponentInterface=d.IncentiveByComponentInterface;exports.incentiveFromAddress=d.incentiveFromAddress;exports.PointsIncentive=C.PointsIncentive;exports.preparePointsIncentivePayload=C.preparePointsIncentivePayload;exports.SignerValidator=n.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=n.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=n.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=n.prepareSignerValidatorPayload;exports.ValidatorByComponentInterface=I.ValidatorByComponentInterface;exports.validatorFromAddress=I.validatorFromAddress;exports.BoostCoreNoIdentifierEmitted=e.BoostCoreNoIdentifierEmitted;exports.BudgetMustAuthorizeBoostCore=e.BudgetMustAuthorizeBoostCore;exports.ContractAddressRequiredError=e.ContractAddressRequiredError;exports.DeployableAlreadyDeployedError=e.DeployableAlreadyDeployedError;exports.DeployableBuildParametersUnspecifiedError=e.DeployableBuildParametersUnspecifiedError;exports.DeployableMissingPayloadError=e.DeployableMissingPayloadError;exports.DeployableUnknownOwnerProvidedError=e.DeployableUnknownOwnerProvidedError;exports.DeployableWagmiConfigurationRequiredError=e.DeployableWagmiConfigurationRequiredError;exports.EventActionValidationError=e.EventActionValidationError;exports.FieldValueNotComparableError=e.FieldValueNotComparableError;exports.FieldValueUndefinedError=e.FieldValueUndefinedError;exports.IncentiveNotCloneableError=e.IncentiveNotCloneableError;exports.InvalidComponentInterfaceError=e.InvalidComponentInterfaceError;exports.InvalidNumericalCriteriaError=e.InvalidNumericalCriteriaError;exports.MustInitializeBudgetError=e.MustInitializeBudgetError;exports.NoContractAddressUponReceiptError=e.NoContractAddressUponReceiptError;exports.NoEventActionStepsProvidedError=e.NoEventActionStepsProvidedError;exports.TooManyEventActionStepsProvidedError=e.TooManyEventActionStepsProvidedError;exports.UnknownTransferPayloadSupplied=e.UnknownTransferPayloadSupplied;exports.UnrecognizedFilterTypeError=e.UnrecognizedFilterTypeError;exports.RegistryType=i.RegistryType;exports.awaitResult=i.awaitResult;exports.bytes4=i.bytes4;exports.getDeployedContractAddress=i.getDeployedContractAddress;exports.PassthroughAuth=B.PassthroughAuth;exports.allowListIncentiveAbi=r.A;exports.boostCoreAbi=r.c;exports.boostRegistryAbi=r.ee;exports.cgdaIncentiveAbi=r.v;exports.erc20IncentiveAbi=r.f;exports.managedBudgetAbi=r.p;exports.passthroughAuthAbi=r.ze;exports.pointsIncentiveAbi=r.l;exports.signerValidatorAbi=r.M;exports.simpleAllowListAbi=r.T;exports.simpleDenyListAbi=r.S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./BoostRegistry.cjs"),a=require("./BoostCore.cjs"),c=require("./Boost.cjs"),E=require("./Actions/Action.cjs"),o=require("./Actions/EventAction.cjs"),d=require("./AllowLists/AllowList.cjs"),s=require("./AllowLists/SimpleAllowList.cjs"),A=require("./SimpleDenyList-DeJRKD2D.cjs"),y=require("./Budgets/Budget.cjs"),t=require("./Budgets/ManagedBudget.cjs"),v=require("./Deployable/Deployable.cjs"),m=require("./Deployable/Contract.cjs"),D=require("./Deployable/DeployableTarget.cjs"),u=require("./Incentives/AllowListIncentive.cjs"),C=require("./Incentives/CGDAIncentive.cjs"),I=require("./Incentives/ERC20Incentive.cjs"),p=require("./Incentives/Incentive.cjs"),S=require("./Incentives/PointsIncentive.cjs"),i=require("./Validators/SignerValidator.cjs"),g=require("./Validators/Validator.cjs"),e=require("./errors.cjs"),n=require("./utils.cjs"),P=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-tq_HLZJ0.cjs");exports.BOOST_REGISTRY_ADDRESS=l.BOOST_REGISTRY_ADDRESS;exports.BOOST_REGISTRY_ADDRESSES=l.BOOST_REGISTRY_ADDRESSES;exports.BoostRegistry=l.BoostRegistry;exports.BOOST_CORE_ADDRESS=a.BOOST_CORE_ADDRESS;exports.BOOST_CORE_ADDRESSES=a.BOOST_CORE_ADDRESSES;exports.BOOST_CORE_CLAIM_FEE=a.BOOST_CORE_CLAIM_FEE;exports.BoostCore=a.BoostCore;exports.Boost=c.Boost;exports.prepareBoostPayload=c.prepareBoostPayload;exports.ActionByComponentInterface=E.ActionByComponentInterface;exports.actionFromAddress=E.actionFromAddress;exports.EventAction=o.EventAction;exports.FilterType=o.FilterType;exports.PrimitiveType=o.PrimitiveType;exports.SignatureType=o.SignatureType;exports.isEventActionPayloadSimple=o.isEventActionPayloadSimple;exports.prepareEventActionPayload=o.prepareEventActionPayload;exports.AllowListByComponentInterface=d.AllowListByComponentInterface;exports.OpenAllowList=d.OpenAllowList;exports.allowListFromAddress=d.allowListFromAddress;exports.LIST_MANAGER_ROLE=s.LIST_MANAGER_ROLE;exports.SimpleAllowList=s.SimpleAllowList;exports.prepareSimpleAllowListPayload=s.prepareSimpleAllowListPayload;exports.SimpleDenyList=A.SimpleDenyList;exports.prepareSimpleDenyListPayload=A.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=y.BudgetByComponentInterface;exports.budgetFromAddress=y.budgetFromAddress;exports.ManagedBudget=t.ManagedBudget;exports.ManagedBudgetRoles=t.ManagedBudgetRoles;exports.isERC1155TransferPayload=t.isERC1155TransferPayload;exports.isFungibleTransfer=t.isFungibleTransfer;exports.prepareManagedBudgetPayload=t.prepareManagedBudgetPayload;exports.prepareTransfer=t.prepareTransfer;exports.Deployable=v.Deployable;exports.Contract=m.Contract;exports.DeployableTarget=D.DeployableTarget;exports.AllowListIncentive=u.AllowListIncentive;exports.prepareAllowListIncentivePayload=u.prepareAllowListIncentivePayload;exports.CGDAIncentive=C.CGDAIncentive;exports.prepareCGDAIncentivePayload=C.prepareCGDAIncentivePayload;exports.ERC20Incentive=I.ERC20Incentive;exports.prepareERC20IncentivePayload=I.prepareERC20IncentivePayload;exports.ERC20VariableIncentive=p.ERC20VariableIncentive;exports.IncentiveByComponentInterface=p.IncentiveByComponentInterface;exports.incentiveFromAddress=p.incentiveFromAddress;exports.PointsIncentive=S.PointsIncentive;exports.preparePointsIncentivePayload=S.preparePointsIncentivePayload;exports.SignerValidator=i.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=i.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=i.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=i.prepareSignerValidatorPayload;exports.ValidatorByComponentInterface=g.ValidatorByComponentInterface;exports.validatorFromAddress=g.validatorFromAddress;exports.BoostCoreNoIdentifierEmitted=e.BoostCoreNoIdentifierEmitted;exports.BudgetMustAuthorizeBoostCore=e.BudgetMustAuthorizeBoostCore;exports.ContractAddressRequiredError=e.ContractAddressRequiredError;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.IncentiveNotCloneableError=e.IncentiveNotCloneableError;exports.InvalidComponentInterfaceError=e.InvalidComponentInterfaceError;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.TooManyEventActionStepsProvidedError=e.TooManyEventActionStepsProvidedError;exports.UnknownTransferPayloadSupplied=e.UnknownTransferPayloadSupplied;exports.UnparseableAbiParamError=e.UnparseableAbiParamError;exports.UnrecognizedFilterTypeError=e.UnrecognizedFilterTypeError;exports.RegistryType=n.RegistryType;exports.assertValidAddressByChainId=n.assertValidAddressByChainId;exports.awaitResult=n.awaitResult;exports.bytes4=n.bytes4;exports.getDeployedContractAddress=n.getDeployedContractAddress;exports.PassthroughAuth=P.PassthroughAuth;exports.allowListIncentiveAbi=r.A;exports.boostCoreAbi=r.d;exports.cgdaIncentiveAbi=r.v;exports.erc20IncentiveAbi=r.f;exports.managedBudgetAbi=r.p;exports.passthroughAuthAbi=r.ze;exports.pointsIncentiveAbi=r.l;exports.signerValidatorAbi=r.M;exports.simpleAllowListAbi=r.T;exports.simpleDenyListAbi=r.S;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,114 +1,121 @@
1
- import { BOOST_REGISTRY_ADDRESS as o, BoostRegistry as t } from "./BoostRegistry.js";
2
- import { BOOST_CORE_ADDRESS as i, BOOST_CORE_CLAIM_FEE as n, BoostCore as p } from "./BoostCore.js";
3
- import { Boost as s, prepareBoostPayload as d } from "./Boost.js";
4
- import { ActionByComponentInterface as A, actionFromAddress as y } from "./Actions/Action.js";
5
- import { EventAction as f, FilterType as E, PrimitiveType as g, SignatureType as v, isEventActionPayloadSimple as I, prepareEventActionPayload as C } from "./Actions/EventAction.js";
6
- import { AllowListByComponentInterface as b, OpenAllowList as x, allowListFromAddress as P } from "./AllowLists/AllowList.js";
7
- import { LIST_MANAGER_ROLE as B, SimpleAllowList as R, prepareSimpleAllowListPayload as D } from "./AllowLists/SimpleAllowList.js";
8
- import { S as L, p as w } from "./SimpleDenyList-4PtOPXTc.js";
9
- import { BudgetByComponentInterface as O, budgetFromAddress as M } from "./Budgets/Budget.js";
10
- import { ManagedBudget as _, ManagedBudgetRoles as h, isERC1155TransferPayload as N, isFungibleTransfer as U, prepareManagedBudgetPayload as z, prepareTransfer as G } from "./Budgets/ManagedBudget.js";
11
- import { Deployable as q } from "./Deployable/Deployable.js";
12
- import { Contract as Y } from "./Deployable/Contract.js";
13
- import { DeployableTarget as H } from "./Deployable/DeployableTarget.js";
14
- import { AllowListIncentive as K, prepareAllowListIncentivePayload as Q } from "./Incentives/AllowListIncentive.js";
15
- import { CGDAIncentive as Z, prepareCGDAIncentivePayload as $ } from "./Incentives/CGDAIncentive.js";
16
- import { ERC20Incentive as re, prepareERC20IncentivePayload as oe } from "./Incentives/ERC20Incentive.js";
17
- import { ERC20VariableIncentive as ae, IncentiveByComponentInterface as ie, incentiveFromAddress as ne } from "./Incentives/Incentive.js";
18
- import { PointsIncentive as le, preparePointsIncentivePayload as se } from "./Incentives/PointsIncentive.js";
19
- import { SignerValidator as me, prepareSignerValidatorClaimDataPayload as Ae, prepareSignerValidatorInputParams as ye, prepareSignerValidatorPayload as ce } from "./Validators/SignerValidator.js";
20
- import { ValidatorByComponentInterface as Ee, validatorFromAddress as ge } from "./Validators/Validator.js";
21
- import { BoostCoreNoIdentifierEmitted as Ie, BudgetMustAuthorizeBoostCore as Ce, ContractAddressRequiredError as ue, DeployableAlreadyDeployedError as be, DeployableBuildParametersUnspecifiedError as xe, DeployableMissingPayloadError as Pe, DeployableUnknownOwnerProvidedError as Se, DeployableWagmiConfigurationRequiredError as Be, EventActionValidationError as Re, FieldValueNotComparableError as De, FieldValueUndefinedError as Te, IncentiveNotCloneableError as Le, InvalidComponentInterfaceError as we, InvalidNumericalCriteriaError as Fe, MustInitializeBudgetError as Oe, NoContractAddressUponReceiptError as Me, NoEventActionStepsProvidedError as Ve, TooManyEventActionStepsProvidedError as _e, UnknownTransferPayloadSupplied as he, UnrecognizedFilterTypeError as Ne } from "./errors.js";
22
- import { RegistryType as ze, awaitResult as Ge, bytes4 as ke, getDeployedContractAddress as qe } from "./utils.js";
23
- import { PassthroughAuth as Ye } from "./Auth/PassthroughAuth.js";
24
- import { A as He, c as Je, e as Ke, v as Qe, f as Xe, p as Ze, z as $e, l as er, M as rr, T as or, S as tr } from "./generated-BDeDiaCK.js";
1
+ import { BOOST_REGISTRY_ADDRESS as o, BOOST_REGISTRY_ADDRESSES as t, BoostRegistry as a } from "./BoostRegistry.js";
2
+ import { BOOST_CORE_ADDRESS as n, BOOST_CORE_ADDRESSES as l, BOOST_CORE_CLAIM_FEE as p, BoostCore as d } from "./BoostCore.js";
3
+ import { Boost as m, prepareBoostPayload as A } from "./Boost.js";
4
+ import { ActionByComponentInterface as c, actionFromAddress as y } from "./Actions/Action.js";
5
+ import { EventAction as I, FilterType as C, PrimitiveType as S, SignatureType as g, isEventActionPayloadSimple as v, prepareEventActionPayload as u } from "./Actions/EventAction.js";
6
+ import { AllowListByComponentInterface as D, OpenAllowList as P, allowListFromAddress as B } from "./AllowLists/AllowList.js";
7
+ import { LIST_MANAGER_ROLE as R, SimpleAllowList as T, prepareSimpleAllowListPayload as O } from "./AllowLists/SimpleAllowList.js";
8
+ import { S as w, p as F } from "./SimpleDenyList-C21O9Yfi.js";
9
+ import { BudgetByComponentInterface as M, budgetFromAddress as V } from "./Budgets/Budget.js";
10
+ import { ManagedBudget as N, ManagedBudgetRoles as U, isERC1155TransferPayload as G, isFungibleTransfer as z, prepareManagedBudgetPayload as k, prepareTransfer as q } from "./Budgets/ManagedBudget.js";
11
+ import { Deployable as W } from "./Deployable/Deployable.js";
12
+ import { Contract as H } from "./Deployable/Contract.js";
13
+ import { DeployableTarget as K } from "./Deployable/DeployableTarget.js";
14
+ import { AllowListIncentive as X, prepareAllowListIncentivePayload as Z } from "./Incentives/AllowListIncentive.js";
15
+ import { CGDAIncentive as ee, prepareCGDAIncentivePayload as re } from "./Incentives/CGDAIncentive.js";
16
+ import { ERC20Incentive as te, prepareERC20IncentivePayload as ae } from "./Incentives/ERC20Incentive.js";
17
+ import { ERC20VariableIncentive as ne, IncentiveByComponentInterface as le, incentiveFromAddress as pe } from "./Incentives/Incentive.js";
18
+ import { PointsIncentive as se, preparePointsIncentivePayload as me } from "./Incentives/PointsIncentive.js";
19
+ import { SignerValidator as Ee, prepareSignerValidatorClaimDataPayload as ce, prepareSignerValidatorInputParams as ye, prepareSignerValidatorPayload as fe } from "./Validators/SignerValidator.js";
20
+ import { ValidatorByComponentInterface as Ce, validatorFromAddress as Se } from "./Validators/Validator.js";
21
+ import { BoostCoreNoIdentifierEmitted as ve, BudgetMustAuthorizeBoostCore as ue, ContractAddressRequiredError as be, DecodedArgsMalformedError as De, DeployableAlreadyDeployedError as Pe, DeployableBuildParametersUnspecifiedError as Be, DeployableMissingPayloadError as xe, DeployableUnknownOwnerProvidedError as Re, DeployableWagmiConfigurationRequiredError as Te, FieldActionValidationError as Oe, FieldValueNotComparableError as Le, FieldValueUndefinedError as we, FunctionDataDecodeError as Fe, IncentiveNotCloneableError as _e, InvalidComponentInterfaceError as Me, InvalidNumericalCriteriaError as Ve, InvalidProtocolChainIdError as he, MustInitializeBudgetError as Ne, NoConnectedChainIdError as Ue, NoContractAddressUponReceiptError as Ge, NoEventActionStepsProvidedError as ze, TooManyEventActionStepsProvidedError as ke, UnknownTransferPayloadSupplied as qe, UnparseableAbiParamError as Ye, UnrecognizedFilterTypeError as We } from "./errors.js";
22
+ import { RegistryType as He, assertValidAddressByChainId as Je, awaitResult as Ke, bytes4 as Qe, getDeployedContractAddress as Xe } from "./utils.js";
23
+ import { PassthroughAuth as $e } from "./Auth/PassthroughAuth.js";
24
+ import { A as rr, d as or, v as tr, f as ar, p as ir, z as nr, l as lr, M as pr, T as dr, S as sr } from "./generated-LpgSHrH0.js";
25
25
  export {
26
- A as ActionByComponentInterface,
27
- b as AllowListByComponentInterface,
28
- K as AllowListIncentive,
29
- i as BOOST_CORE_ADDRESS,
30
- n as BOOST_CORE_CLAIM_FEE,
26
+ c as ActionByComponentInterface,
27
+ D as AllowListByComponentInterface,
28
+ X as AllowListIncentive,
29
+ n as BOOST_CORE_ADDRESS,
30
+ l as BOOST_CORE_ADDRESSES,
31
+ p as BOOST_CORE_CLAIM_FEE,
31
32
  o as BOOST_REGISTRY_ADDRESS,
32
- s as Boost,
33
- p as BoostCore,
34
- Ie as BoostCoreNoIdentifierEmitted,
35
- t as BoostRegistry,
36
- O as BudgetByComponentInterface,
37
- Ce as BudgetMustAuthorizeBoostCore,
38
- Z as CGDAIncentive,
39
- Y as Contract,
40
- ue as ContractAddressRequiredError,
41
- q as Deployable,
42
- be as DeployableAlreadyDeployedError,
43
- xe as DeployableBuildParametersUnspecifiedError,
44
- Pe as DeployableMissingPayloadError,
45
- H as DeployableTarget,
46
- Se as DeployableUnknownOwnerProvidedError,
47
- Be as DeployableWagmiConfigurationRequiredError,
48
- re as ERC20Incentive,
49
- ae as ERC20VariableIncentive,
50
- f as EventAction,
51
- Re as EventActionValidationError,
52
- De as FieldValueNotComparableError,
53
- Te as FieldValueUndefinedError,
54
- E as FilterType,
55
- ie as IncentiveByComponentInterface,
56
- Le as IncentiveNotCloneableError,
57
- we as InvalidComponentInterfaceError,
58
- Fe as InvalidNumericalCriteriaError,
59
- B as LIST_MANAGER_ROLE,
60
- _ as ManagedBudget,
61
- h as ManagedBudgetRoles,
62
- Oe as MustInitializeBudgetError,
63
- Me as NoContractAddressUponReceiptError,
64
- Ve as NoEventActionStepsProvidedError,
65
- x as OpenAllowList,
66
- Ye as PassthroughAuth,
67
- le as PointsIncentive,
68
- g as PrimitiveType,
69
- ze as RegistryType,
70
- v as SignatureType,
71
- me as SignerValidator,
72
- R as SimpleAllowList,
73
- L as SimpleDenyList,
74
- _e as TooManyEventActionStepsProvidedError,
75
- he as UnknownTransferPayloadSupplied,
76
- Ne as UnrecognizedFilterTypeError,
77
- Ee as ValidatorByComponentInterface,
33
+ t as BOOST_REGISTRY_ADDRESSES,
34
+ m as Boost,
35
+ d as BoostCore,
36
+ ve as BoostCoreNoIdentifierEmitted,
37
+ a as BoostRegistry,
38
+ M as BudgetByComponentInterface,
39
+ ue as BudgetMustAuthorizeBoostCore,
40
+ ee as CGDAIncentive,
41
+ H as Contract,
42
+ be as ContractAddressRequiredError,
43
+ De as DecodedArgsMalformedError,
44
+ W as Deployable,
45
+ Pe as DeployableAlreadyDeployedError,
46
+ Be as DeployableBuildParametersUnspecifiedError,
47
+ xe as DeployableMissingPayloadError,
48
+ K as DeployableTarget,
49
+ Re as DeployableUnknownOwnerProvidedError,
50
+ Te as DeployableWagmiConfigurationRequiredError,
51
+ te as ERC20Incentive,
52
+ ne as ERC20VariableIncentive,
53
+ I as EventAction,
54
+ Oe as FieldActionValidationError,
55
+ Le as FieldValueNotComparableError,
56
+ we as FieldValueUndefinedError,
57
+ C as FilterType,
58
+ Fe as FunctionDataDecodeError,
59
+ le as IncentiveByComponentInterface,
60
+ _e as IncentiveNotCloneableError,
61
+ Me as InvalidComponentInterfaceError,
62
+ Ve as InvalidNumericalCriteriaError,
63
+ he as InvalidProtocolChainIdError,
64
+ R as LIST_MANAGER_ROLE,
65
+ N as ManagedBudget,
66
+ U as ManagedBudgetRoles,
67
+ Ne as MustInitializeBudgetError,
68
+ Ue as NoConnectedChainIdError,
69
+ Ge as NoContractAddressUponReceiptError,
70
+ ze as NoEventActionStepsProvidedError,
71
+ P as OpenAllowList,
72
+ $e as PassthroughAuth,
73
+ se as PointsIncentive,
74
+ S as PrimitiveType,
75
+ He as RegistryType,
76
+ g as SignatureType,
77
+ Ee as SignerValidator,
78
+ T as SimpleAllowList,
79
+ w as SimpleDenyList,
80
+ ke as TooManyEventActionStepsProvidedError,
81
+ qe as UnknownTransferPayloadSupplied,
82
+ Ye as UnparseableAbiParamError,
83
+ We as UnrecognizedFilterTypeError,
84
+ Ce as ValidatorByComponentInterface,
78
85
  y as actionFromAddress,
79
- P as allowListFromAddress,
80
- He as allowListIncentiveAbi,
81
- Ge as awaitResult,
82
- Je as boostCoreAbi,
83
- Ke as boostRegistryAbi,
84
- M as budgetFromAddress,
85
- ke as bytes4,
86
- Qe as cgdaIncentiveAbi,
87
- Xe as erc20IncentiveAbi,
88
- qe as getDeployedContractAddress,
89
- ne as incentiveFromAddress,
90
- N as isERC1155TransferPayload,
91
- I as isEventActionPayloadSimple,
92
- U as isFungibleTransfer,
93
- Ze as managedBudgetAbi,
94
- $e as passthroughAuthAbi,
95
- er as pointsIncentiveAbi,
96
- Q as prepareAllowListIncentivePayload,
97
- d as prepareBoostPayload,
98
- $ as prepareCGDAIncentivePayload,
99
- oe as prepareERC20IncentivePayload,
100
- C as prepareEventActionPayload,
101
- z as prepareManagedBudgetPayload,
102
- se as preparePointsIncentivePayload,
103
- Ae as prepareSignerValidatorClaimDataPayload,
86
+ B as allowListFromAddress,
87
+ rr as allowListIncentiveAbi,
88
+ Je as assertValidAddressByChainId,
89
+ Ke as awaitResult,
90
+ or as boostCoreAbi,
91
+ V as budgetFromAddress,
92
+ Qe as bytes4,
93
+ tr as cgdaIncentiveAbi,
94
+ ar as erc20IncentiveAbi,
95
+ Xe as getDeployedContractAddress,
96
+ pe as incentiveFromAddress,
97
+ G as isERC1155TransferPayload,
98
+ v as isEventActionPayloadSimple,
99
+ z as isFungibleTransfer,
100
+ ir as managedBudgetAbi,
101
+ nr as passthroughAuthAbi,
102
+ lr as pointsIncentiveAbi,
103
+ Z as prepareAllowListIncentivePayload,
104
+ A as prepareBoostPayload,
105
+ re as prepareCGDAIncentivePayload,
106
+ ae as prepareERC20IncentivePayload,
107
+ u as prepareEventActionPayload,
108
+ k as prepareManagedBudgetPayload,
109
+ me as preparePointsIncentivePayload,
110
+ ce as prepareSignerValidatorClaimDataPayload,
104
111
  ye as prepareSignerValidatorInputParams,
105
- ce as prepareSignerValidatorPayload,
106
- D as prepareSimpleAllowListPayload,
107
- w as prepareSimpleDenyListPayload,
108
- G as prepareTransfer,
109
- rr as signerValidatorAbi,
110
- or as simpleAllowListAbi,
111
- tr as simpleDenyListAbi,
112
- ge as validatorFromAddress
112
+ fe as prepareSignerValidatorPayload,
113
+ O as prepareSimpleAllowListPayload,
114
+ F as prepareSimpleDenyListPayload,
115
+ q as prepareTransfer,
116
+ pr as signerValidatorAbi,
117
+ dr as simpleAllowListAbi,
118
+ sr as simpleDenyListAbi,
119
+ Se as validatorFromAddress
113
120
  };
114
121
  //# sourceMappingURL=index.js.map
package/dist/utils.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@wagmi/core"),e=require("viem"),i=require("./errors.cjs");function d(t){return e.slice(e.isHex(t)?e.keccak256(t):e.keccak256(e.toHex(t)),0,4)}async function u(t,a,c){const r=await o.waitForTransactionReceipt(t,{...c,hash:await a});if(!r.contractAddress)throw new i.NoContractAddressUponReceiptError(r);return r.contractAddress}async function A(t,a,c){const{hash:r,result:s}=await a;return await o.waitForTransactionReceipt(t,{...c,hash:r}),s}var n=(t=>(t[t.ACTION=0]="ACTION",t[t.ALLOW_LIST=1]="ALLOW_LIST",t[t.BUDGET=2]="BUDGET",t[t.INCENTIVE=3]="INCENTIVE",t[t.VALIDATOR=4]="VALIDATOR",t))(n||{});exports.RegistryType=n;exports.awaitResult=A;exports.bytes4=d;exports.getDeployedContractAddress=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@wagmi/core"),n=require("viem"),s=require("./errors.cjs");var u=(t=>(t[t.ACTION=0]="ACTION",t[t.ALLOW_LIST=1]="ALLOW_LIST",t[t.BUDGET=2]="BUDGET",t[t.INCENTIVE=3]="INCENTIVE",t[t.VALIDATOR=4]="VALIDATOR",t))(u||{});function d(t){return n.slice(n.isHex(t)?n.keccak256(t):n.keccak256(n.toHex(t)),0,4)}async function A(t,c,r){const o=await i.waitForTransactionReceipt(t,{...r,hash:await c});if(!o.contractAddress)throw new s.NoContractAddressUponReceiptError(o);return o.contractAddress}async function f(t,c,r){const{hash:o,result:a}=await c;return await i.waitForTransactionReceipt(t,{...r,hash:o}),a}function l(t,c,r){let o;const a=i.getAccount(t);if(r!==void 0?c[r]&&(o=r):a.chainId!==void 0&&c[a.chainId]&&(o=a.chainId),o===void 0){const e=i.getClient(t);e!=null&&e.chain.id&&c[e==null?void 0:e.chain.id]&&(o=e.chain.id)}if(o===void 0&&(o=11155111),!c[o])throw new s.InvalidProtocolChainIdError(o,Object.keys(c).map(Number));return{chainId:o,address:c[o]}}exports.RegistryType=u;exports.assertValidAddressByChainId=l;exports.awaitResult=f;exports.bytes4=d;exports.getDeployedContractAddress=A;
2
2
  //# sourceMappingURL=utils.cjs.map
@@ -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 waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\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 { NoContractAddressUponReceiptError } from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\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,\n functionName extends 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 {unknown}\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 * 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"],"names":["bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","RegistryType"],"mappings":"2JA2HO,SAASA,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,CAQY,IAAAC,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"}
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 * 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 {unknown}\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","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,EA2GL,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,IAAGD,EAAUC,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,SAAWA,EAAiB,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
@@ -1,7 +1,20 @@
1
1
  import { type Config, type ReadContractParameters, type WatchContractEventParameters, type WriteContractParameters } from '@wagmi/core';
2
2
  import type { ExtractAbiEvent } from 'abitype';
3
- import type { Abi, AbiEvent, ContractEventName, ContractFunctionName, GetLogsParameters, Hash, Log, WaitForTransactionReceiptParameters } from 'viem';
3
+ import type { Abi, AbiEvent, Address, ContractEventName, ContractFunctionName, GetLogsParameters, Hash, Log, WaitForTransactionReceiptParameters } from 'viem';
4
4
  export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
5
+ /**
6
+ * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.
7
+ *
8
+ * @export
9
+ * @enum {number}
10
+ */
11
+ export declare enum RegistryType {
12
+ ACTION = 0,
13
+ ALLOW_LIST = 1,
14
+ BUDGET = 2,
15
+ INCENTIVE = 3,
16
+ VALIDATOR = 4
17
+ }
5
18
  /**
6
19
  * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.
7
20
  * See (writeContract)[https://viem.sh/docs/contract/writeContract]
@@ -11,7 +24,7 @@ export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
11
24
  * @template {Abi} abi
12
25
  * @template {ContractFunctionName<abi>} functionName
13
26
  */
14
- export type WriteParams<abi extends Abi, functionName extends ContractFunctionName<abi>> = Partial<Omit<WriteContractParameters<abi, functionName>, 'address' | 'args' | 'functionName' | 'abi'>>;
27
+ export type WriteParams<abi extends Abi = Abi, functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>> = Partial<Omit<WriteContractParameters<abi, functionName>, 'address' | 'args' | 'functionName' | 'abi'>>;
15
28
  /**
16
29
  * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.
17
30
  * See (readContract)[https://viem.sh/docs/contract/readContract]
@@ -101,16 +114,17 @@ export type HashAndSimulatedResult<T = unknown> = {
101
114
  */
102
115
  export declare function awaitResult<Result = unknown>(config: Config, hashPromise: Promise<HashAndSimulatedResult<Result>>, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<Result>;
103
116
  /**
104
- * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.
117
+ * 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.
105
118
  *
106
119
  * @export
107
- * @enum {number}
120
+ * @param {Config} config
121
+ * @param {Record<string, Address>} addressByChainId
122
+ * @param {number} desiredChainId
123
+ * @returns {{ chainId: number, address: Address }}
124
+ * @throws {@link InvalidProtocolChainIdError}
108
125
  */
109
- export declare enum RegistryType {
110
- ACTION = 0,
111
- ALLOW_LIST = 1,
112
- BUDGET = 2,
113
- INCENTIVE = 3,
114
- VALIDATOR = 4
115
- }
126
+ export declare function assertValidAddressByChainId(config: Config, addressByChainId: Record<number, Address>, desiredChainId?: number): {
127
+ chainId: number;
128
+ address: Address;
129
+ };
116
130
  //# sourceMappingURL=utils.d.ts.map
@@ -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,EAE7B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EACV,GAAG,EACH,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,IAAI,EAEJ,GAAG,EACH,mCAAmC,EACpC,MAAM,MAAM,CAAC;AAId,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CACrB,GAAG,SAAS,GAAG,EACf,YAAY,SAAS,oBAAoB,CAAC,GAAG,CAAC,IAC5C,OAAO,CACT,IAAI,CACF,uBAAuB,CAAC,GAAG,EAAE,YAAY,CAAC,EAC1C,SAAS,GAAG,MAAM,GAAG,cAAc,GAAG,KAAK,CAC5C,CACF,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,CACpB,GAAG,SAAS,GAAG,EACf,YAAY,SAAS,oBAAoB,CAAC,GAAG,CAAC,IAC5C,OAAO,CACT,IAAI,CACF,sBAAsB,CAAC,GAAG,EAAE,YAAY,CAAC,EACzC,SAAS,GAAG,MAAM,GAAG,cAAc,GAAG,KAAK,CAC5C,CACF,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CACrB,GAAG,SAAS,GAAG,EACf,SAAS,SAAS,iBAAiB,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,SAAS,IAC9D,OAAO,CACT,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC,CACtE,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,CACvB,GAAG,SAAS,GAAG,EACf,KAAK,SAAS,iBAAiB,CAAC,GAAG,CAAC,EACpC,QAAQ,SAAS,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,EAC1E,SAAS,SACL,SAAS,QAAQ,EAAE,GACnB,SAAS,OAAO,EAAE,GAClB,SAAS,GAAG,QAAQ,SAAS,QAAQ,GAAG,CAAC,QAAQ,CAAC,GAAG,SAAS,IAChE,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC,GAAG;IACrE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CACpB,GAAG,SAAS,GAAG,EACf,KAAK,SAAS,iBAAiB,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,GAAG,CAAC,IAC3D,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AAEnE;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,iBAEnC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EACnB,UAAU,CAAC,EAAE,IAAI,CAAC,mCAAmC,EAAE,MAAM,CAAC,0BAS/D;AAED;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,OAAO,IAAI;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC;AAE5E;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,MAAM,GAAG,OAAO,EAChD,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,OAAO,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,EACpD,UAAU,CAAC,EAAE,IAAI,CAAC,mCAAmC,EAAE,MAAM,CAAC,GAC7D,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;;;GAKG;AACH,oBAAY,YAAY;IACtB,MAAM,IAAI;IACV,UAAU,IAAI;IACd,MAAM,IAAI;IACV,SAAS,IAAI;IACb,SAAS,IAAI;CACd"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"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"}
package/dist/utils.js CHANGED
@@ -1,30 +1,45 @@
1
- import { waitForTransactionReceipt as n } from "@wagmi/core";
2
- import { slice as s, isHex as I, keccak256 as c, toHex as d } from "viem";
3
- import { NoContractAddressUponReceiptError as e } from "./errors.js";
4
- function u(t) {
5
- return s(I(t) ? c(t) : c(d(t)), 0, 4);
1
+ import { waitForTransactionReceipt as f, getAccount as A, getClient as u } from "@wagmi/core";
2
+ import { slice as e, isHex as w, keccak256 as i, toHex as m } from "viem";
3
+ import { NoContractAddressUponReceiptError as I, InvalidProtocolChainIdError as s } from "./errors.js";
4
+ var N = /* @__PURE__ */ ((o) => (o[o.ACTION = 0] = "ACTION", o[o.ALLOW_LIST = 1] = "ALLOW_LIST", o[o.BUDGET = 2] = "BUDGET", o[o.INCENTIVE = 3] = "INCENTIVE", o[o.VALIDATOR = 4] = "VALIDATOR", o))(N || {});
5
+ function L(o) {
6
+ return e(w(o) ? i(o) : i(m(o)), 0, 4);
6
7
  }
7
- async function E(t, a, r) {
8
- const o = await n(t, {
9
- ...r,
10
- hash: await a
8
+ async function l(o, c, n) {
9
+ const t = await f(o, {
10
+ ...n,
11
+ hash: await c
11
12
  });
12
- if (!o.contractAddress)
13
- throw new e(o);
14
- return o.contractAddress;
13
+ if (!t.contractAddress)
14
+ throw new I(t);
15
+ return t.contractAddress;
15
16
  }
16
- async function N(t, a, r) {
17
- const { hash: o, result: A } = await a;
18
- return await n(t, {
19
- ...r,
20
- hash: o
21
- }), A;
17
+ async function v(o, c, n) {
18
+ const { hash: t, result: a } = await c;
19
+ return await f(o, {
20
+ ...n,
21
+ hash: t
22
+ }), a;
23
+ }
24
+ function O(o, c, n) {
25
+ let t;
26
+ const a = A(o);
27
+ if (n !== void 0 ? c[n] && (t = n) : a.chainId !== void 0 && c[a.chainId] && (t = a.chainId), t === void 0) {
28
+ const r = u(o);
29
+ r != null && r.chain.id && c[r == null ? void 0 : r.chain.id] && (t = r.chain.id);
30
+ }
31
+ if (t === void 0 && (t = 11155111), !c[t])
32
+ throw new s(
33
+ t,
34
+ Object.keys(c).map(Number)
35
+ );
36
+ return { chainId: t, address: c[t] };
22
37
  }
23
- var i = /* @__PURE__ */ ((t) => (t[t.ACTION = 0] = "ACTION", t[t.ALLOW_LIST = 1] = "ALLOW_LIST", t[t.BUDGET = 2] = "BUDGET", t[t.INCENTIVE = 3] = "INCENTIVE", t[t.VALIDATOR = 4] = "VALIDATOR", t))(i || {});
24
38
  export {
25
- i as RegistryType,
26
- N as awaitResult,
27
- u as bytes4,
28
- E as getDeployedContractAddress
39
+ N as RegistryType,
40
+ O as assertValidAddressByChainId,
41
+ v as awaitResult,
42
+ L as bytes4,
43
+ l as getDeployedContractAddress
29
44
  };
30
45
  //# sourceMappingURL=utils.js.map
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 waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\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 { NoContractAddressUponReceiptError } from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\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,\n functionName extends 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 {unknown}\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 * 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"],"names":["bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","RegistryType"],"mappings":";;;AA2HO,SAASA,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;AAQY,IAAAC,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;"}
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 * 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 {unknown}\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","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;AA2GL,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,MAAGD,IAAUC,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,WAAWA,IAAiB,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": "0.0.0-alpha.11",
3
+ "version": "0.0.0-alpha.13",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "files": [
@@ -54,6 +54,7 @@
54
54
  "node": "./dist/transfers.js",
55
55
  "types": "./dist/transfers.d.ts"
56
56
  },
57
+ "./deployments.json": "./dist/deployments.json",
57
58
  "./Boost": {
58
59
  "require": "./dist/Boost.cjs",
59
60
  "import": "./dist/Boost.js",
@@ -187,24 +188,27 @@
187
188
  "types": "./dist/Validators/SignerValidator.d.ts"
188
189
  }
189
190
  },
191
+ "dependencies": {
192
+ "@boostxyz/signatures": "0.0.0-alpha.2"
193
+ },
190
194
  "optionalDependencies": {
191
- "@boostxyz/evm": "0.0.0-alpha.1",
195
+ "@boostxyz/evm": "0.0.0-alpha.3",
192
196
  "@boostxyz/signatures": "0.0.0-alpha.2"
193
197
  },
194
198
  "peerDependencies": {
195
199
  "@wagmi/core": "2",
196
- "viem": "2",
197
- "abitype": "1"
200
+ "abitype": "1",
201
+ "viem": "2"
198
202
  },
199
203
  "scripts": {
200
- "build": "vite build && tsc -p ./tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap",
204
+ "build": "mkdir -p dist && vite build && tsc -p ./tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap",
201
205
  "typecheck": "tsc -p ./tsconfig.build.json --noEmit",
202
206
  "lint:ci": "npx biome ci",
203
207
  "lint": "npx biome check",
204
208
  "bench": "vitest bench",
205
209
  "bench:ci": "CI=true vitest bench",
206
210
  "clean": "rm -rf dist",
207
- "dev": "vite build --watch",
211
+ "dev": "mkdir -p dist && vite build --watch",
208
212
  "test": "vitest dev",
209
213
  "test:ci": "CI=true vitest --coverage",
210
214
  "typedoc": "npx typedoc --tsconfig ./tsconfig.build.json --sort required-first --sort visibility --sort kind"
@@ -27,20 +27,24 @@ export function basicErc721TransferAction(
27
27
  actionClaimant: {
28
28
  chainid: 31337,
29
29
  signatureType: SignatureType.EVENT,
30
- signature: selectors['Transfer(address,address,uint256)'] as Hex,
31
- fieldIndex: 2,
30
+ signature: selectors[
31
+ 'Transfer(address indexed,address indexed,uint256 indexed)'
32
+ ] as Hex,
33
+ fieldIndex: 1,
32
34
  targetContract: erc721.assertValidAddress(),
33
35
  },
34
36
  actionSteps: [
35
37
  {
36
38
  chainid: 31337,
37
- signature: selectors['Transfer(address,address,uint256)'] as Hex,
39
+ signature: selectors[
40
+ 'Transfer(address indexed,address indexed,uint256 indexed)'
41
+ ] as Hex,
38
42
  signatureType: SignatureType.EVENT,
39
43
  targetContract: erc721.assertValidAddress(),
40
44
  actionParameter: {
41
45
  filterType: FilterType.EQUAL,
42
46
  fieldType: PrimitiveType.ADDRESS,
43
- fieldIndex: 2,
47
+ fieldIndex: 1,
44
48
  filterData: accounts[1].account,
45
49
  },
46
50
  },