@boostxyz/sdk 7.8.0 → 8.0.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.js +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +4 -4
- package/dist/Actions/EventAction.js +97 -97
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/{AllowList-DiU7g4Hs.js → AllowList-CWqAYlwr.js} +28 -28
- package/dist/{AllowList-DiU7g4Hs.js.map → AllowList-CWqAYlwr.js.map} +1 -1
- package/dist/{AllowList-BJ9HQGFs.cjs → AllowList-Lpqz7tn9.cjs} +2 -2
- package/dist/{AllowList-BJ9HQGFs.cjs.map → AllowList-Lpqz7tn9.cjs.map} +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +3 -3
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.js +8 -8
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.js +3 -3
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +106 -23
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +518 -451
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.js +46 -46
- package/dist/{Budget-YIhV65cc.js → Budget-BPPXnBAK.js} +36 -36
- package/dist/{Budget-YIhV65cc.js.map → Budget-BPPXnBAK.js.map} +1 -1
- package/dist/{Budget-D_zhh1rh.cjs → Budget-rZm-AY09.cjs} +2 -2
- package/dist/{Budget-D_zhh1rh.cjs.map → Budget-rZm-AY09.cjs.map} +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +2 -2
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.js +24 -24
- package/dist/Deployable/Contract.cjs +1 -1
- package/dist/Deployable/Contract.cjs.map +1 -1
- package/dist/Deployable/Contract.d.ts +8 -0
- package/dist/Deployable/Contract.d.ts.map +1 -1
- package/dist/Deployable/Contract.js +14 -4
- package/dist/Deployable/Contract.js.map +1 -1
- package/dist/Deployable/Deployable.cjs +1 -1
- package/dist/Deployable/Deployable.cjs.map +1 -1
- package/dist/Deployable/Deployable.d.ts +7 -0
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +13 -4
- package/dist/Deployable/Deployable.js.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.js +7 -7
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +16 -16
- package/dist/{Incentive-CrnbYN_a.cjs → Incentive-Bse5BKbF.cjs} +2 -2
- package/dist/{Incentive-CrnbYN_a.cjs.map → Incentive-Bse5BKbF.cjs.map} +1 -1
- package/dist/{Incentive-CeoEla-t.js → Incentive-D1sYPD0W.js} +23 -23
- package/dist/{Incentive-CeoEla-t.js.map → Incentive-D1sYPD0W.js.map} +1 -1
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.js +17 -17
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.js +38 -38
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.js +13 -13
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.d.ts +6 -6
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js +22 -22
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.d.ts +6 -6
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js +91 -91
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +6 -6
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +9 -9
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.d.ts +6 -6
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js +9 -9
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +12 -12
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.js +2 -2
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.js +10 -10
- package/dist/{SimpleDenyList-Dr03aOeP.js → SimpleDenyList-BtEUdiAj.js} +14 -14
- package/dist/{SimpleDenyList-Dr03aOeP.js.map → SimpleDenyList-BtEUdiAj.js.map} +1 -1
- package/dist/{SimpleDenyList-7-VTqfsH.cjs → SimpleDenyList-DEoMIYhE.cjs} +2 -2
- package/dist/{SimpleDenyList-7-VTqfsH.cjs.map → SimpleDenyList-DEoMIYhE.cjs.map} +1 -1
- package/dist/{Validator-rYW7PMwW.cjs → Validator-DHS4vjSa.cjs} +2 -2
- package/dist/{Validator-rYW7PMwW.cjs.map → Validator-DHS4vjSa.cjs.map} +1 -1
- package/dist/{Validator-DgvB9wge.js → Validator-Kpvmj9Bs.js} +9 -9
- package/dist/{Validator-DgvB9wge.js.map → Validator-Kpvmj9Bs.js.map} +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.js +17 -17
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.js +3 -3
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +2 -2
- package/dist/{deployments-CHQ30INq.js → deployments-Coa8CGi2.js} +67 -67
- package/dist/{deployments-CHQ30INq.js.map → deployments-Coa8CGi2.js.map} +1 -1
- package/dist/{deployments-BjBgk03b.cjs → deployments-Dgzcz4Ev.cjs} +2 -2
- package/dist/deployments-Dgzcz4Ev.cjs.map +1 -0
- package/dist/deployments.json +46 -46
- package/dist/generated-BzLYuFx3.cjs +3 -0
- package/dist/generated-BzLYuFx3.cjs.map +1 -0
- package/dist/{generated-B6mEIx8i.js → generated-D6oDILUw.js} +250 -193
- package/dist/generated-D6oDILUw.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +16 -16
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/BoostCore.test.ts +34 -23
- package/src/BoostCore.ts +124 -26
- package/src/Deployable/Contract.ts +11 -0
- package/src/Deployable/Deployable.ts +10 -0
- package/src/utils.ts +0 -1
- package/dist/deployments-BjBgk03b.cjs.map +0 -1
- package/dist/generated-B6mEIx8i.js.map +0 -1
- package/dist/generated-dd4FN0Fo.cjs +0 -3
- package/dist/generated-dd4FN0Fo.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./BoostRegistry.cjs"),s=require("./BoostCore.cjs"),I=require("./Boost.cjs"),A=require("./Actions/Action.cjs"),a=require("./Actions/EventAction.cjs"),l=require("./AllowList-BJ9HQGFs.cjs"),y=require("./AllowLists/SimpleAllowList.cjs"),P=require("./SimpleDenyList-7-VTqfsH.cjs"),n=require("./Budget-D_zhh1rh.cjs"),o=require("./Budgets/ManagedBudget.cjs"),F=require("./Deployable/Deployable.cjs"),L=require("./Deployable/Contract.cjs"),f=require("./Deployable/DeployableTarget.cjs"),b=require("./Deployable/DeployableTargetWithRBAC.cjs"),v=require("./Incentives/AllowListIncentive.cjs"),m=require("./Incentives/CGDAIncentive.cjs"),R=require("./Incentives/ERC20Incentive.cjs"),p=require("./Incentive-CrnbYN_a.cjs"),S=require("./Incentives/ERC20VariableIncentive.cjs"),E=require("./Incentives/ERC20VariableCriteriaIncentive.cjs"),V=require("./Incentives/ERC20PeggedVariableCriteriaIncentive.cjs"),u=require("./Incentives/ERC20VariableCriteriaIncentiveV2.cjs"),T=require("./Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs"),B=require("./Incentives/PointsIncentive.cjs"),c=require("./Validators/SignerValidator.cjs"),g=require("./Validators/LimitedSignerValidator.cjs"),i=require("./Validator-rYW7PMwW.cjs"),e=require("./errors.cjs"),t=require("./utils.cjs"),D=require("./claiming.cjs"),d=require("./transfers.cjs"),h=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-dd4FN0Fo.cjs");exports.BOOST_REGISTRY_ADDRESS=C.BOOST_REGISTRY_ADDRESS;exports.BOOST_REGISTRY_ADDRESSES=C.BOOST_REGISTRY_ADDRESSES;exports.BoostRegistry=C.BoostRegistry;exports.BOOST_CORE_ADDRESS=s.BOOST_CORE_ADDRESS;exports.BOOST_CORE_ADDRESSES=s.BOOST_CORE_ADDRESSES;exports.BoostCore=s.BoostCore;exports.FEE_DENOMINATOR=s.FEE_DENOMINATOR;exports.Boost=I.Boost;exports.prepareBoostPayload=I.prepareBoostPayload;exports.ActionByComponentInterface=A.ActionByComponentInterface;exports.actionFromAddress=A.actionFromAddress;exports.EventAction=a.EventAction;exports.FilterType=a.FilterType;exports.PrimitiveType=a.PrimitiveType;exports.SignatureType=a.SignatureType;exports.ValueType=a.ValueType;exports.anyActionParameter=a.anyActionParameter;exports.decodeAndReorderLogArgs=a.decodeAndReorderLogArgs;exports.detectSignatureType=a.detectSignatureType;exports.getScalarValueFromTuple=a.getScalarValueFromTuple;exports.isClaimantFieldIndexTuple=a.isClaimantFieldIndexTuple;exports.isCriteriaFieldIndexTuple=a.isCriteriaFieldIndexTuple;exports.isEventActionPayloadSimple=a.isEventActionPayloadSimple;exports.packClaimantFieldIndexes=a.packClaimantFieldIndexes;exports.packCriteriaFieldIndexes=a.packCriteriaFieldIndexes;exports.packFieldIndexes=a.packFieldIndexes;exports.prepareEventActionPayload=a.prepareEventActionPayload;exports.transactionSenderClaimant=a.transactionSenderClaimant;exports.unpackClaimantFieldIndexes=a.unpackClaimantFieldIndexes;exports.unpackCriteriaFieldIndexes=a.unpackCriteriaFieldIndexes;exports.unpackFieldIndexes=a.unpackFieldIndexes;exports.AllowListByComponentInterface=l.AllowListByComponentInterface;exports.OffchainAccessList=l.OffchainAccessList;exports.OpenAllowList=l.OpenAllowList;exports.allowListFromAddress=l.allowListFromAddress;exports.prepareOffchainAccessListPayload=l.prepareOffchainAccessListPayload;exports.LIST_MANAGER_ROLE=y.LIST_MANAGER_ROLE;exports.SimpleAllowList=y.SimpleAllowList;exports.prepareSimpleAllowListPayload=y.prepareSimpleAllowListPayload;exports.SimpleDenyList=P.SimpleDenyList;exports.prepareSimpleDenyListPayload=P.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=n.BudgetByComponentInterface;exports.ManagedBudgetWithFees=n.ManagedBudgetWithFees;exports.ManagedBudgetWithFeesV2=n.ManagedBudgetWithFeesV2;exports.TransparentBudget=n.TransparentBudget;exports.budgetFromAddress=n.budgetFromAddress;exports.prepareManagedBudgetWithFeesPayload=n.prepareManagedBudgetWithFeesPayload;exports.prepareManagedBudgetWithFeesV2Payload=n.prepareManagedBudgetWithFeesV2Payload;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=F.Deployable;exports.Contract=L.Contract;exports.DeployableTarget=f.DeployableTarget;exports.DeployableTargetWithRBAC=b.DeployableTargetWithRBAC;exports.Roles=b.Roles;exports.AllowListIncentive=v.AllowListIncentive;exports.prepareAllowListIncentivePayload=v.prepareAllowListIncentivePayload;exports.CGDAIncentive=m.CGDAIncentive;exports.prepareCGDAIncentivePayload=m.prepareCGDAIncentivePayload;exports.ERC20Incentive=R.ERC20Incentive;exports.prepareERC20IncentivePayload=R.prepareERC20IncentivePayload;exports.ERC20PeggedIncentive=p.ERC20PeggedIncentive;exports.IncentiveByComponentInterface=p.IncentiveByComponentInterface;exports.incentiveFromAddress=p.incentiveFromAddress;exports.prepareERC20PeggedIncentivePayload=p.prepareERC20PeggedIncentivePayload;exports.ERC20VariableIncentive=S.ERC20VariableIncentive;exports.prepareERC20VariableIncentivePayload=S.prepareERC20VariableIncentivePayload;exports.ERC20VariableCriteriaIncentive=E.ERC20VariableCriteriaIncentive;exports.gasRebateIncentiveCriteria=E.gasRebateIncentiveCriteria;exports.prepareERC20VariableCriteriaIncentivePayload=E.prepareERC20VariableCriteriaIncentivePayload;exports.ERC20PeggedVariableCriteriaIncentive=V.ERC20PeggedVariableCriteriaIncentive;exports.prepareERC20PeggedVariableCriteriaIncentivePayload=V.prepareERC20PeggedVariableCriteriaIncentivePayload;exports.ERC20VariableCriteriaIncentiveV2=u.ERC20VariableCriteriaIncentiveV2;exports.gasRebateIncentiveCriteriaV2=u.gasRebateIncentiveCriteriaV2;exports.prepareERC20VariableCriteriaIncentiveV2Payload=u.prepareERC20VariableCriteriaIncentiveV2Payload;exports.ERC20PeggedVariableCriteriaIncentiveV2=T.ERC20PeggedVariableCriteriaIncentiveV2;exports.prepareERC20PeggedVariableCriteriaIncentiveV2Payload=T.prepareERC20PeggedVariableCriteriaIncentiveV2Payload;exports.PointsIncentive=B.PointsIncentive;exports.preparePointsIncentivePayload=B.preparePointsIncentivePayload;exports.SignerValidator=c.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=c.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=c.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=c.prepareSignerValidatorPayload;exports.LimitedSignerValidator=g.LimitedSignerValidator;exports.prepareLimitedSignerValidatorClaimDataPayload=g.prepareLimitedSignerValidatorClaimDataPayload;exports.prepareLimitedSignerValidatorInputParams=g.prepareLimitedSignerValidatorInputParams;exports.prepareLimitedSignerValidatorPayload=g.prepareLimitedSignerValidatorPayload;exports.BoostValidatorEOA=i.BoostValidatorEOA;exports.PayableLimitedSignerValidator=i.PayableLimitedSignerValidator;exports.ValidatorByComponentInterface=i.ValidatorByComponentInterface;exports.decodeClaimData=i.decodeClaimData;exports.preparePayableLimitedSignerValidatorClaimDataPayload=i.preparePayableLimitedSignerValidatorClaimDataPayload;exports.preparePayableLimitedSignerValidatorInputParams=i.preparePayableLimitedSignerValidatorInputParams;exports.preparePayableLimitedSignerValidatorPayload=i.preparePayableLimitedSignerValidatorPayload;exports.validatorFromAddress=i.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.InvalidTupleDecodingError=e.InvalidTupleDecodingError;exports.InvalidTupleEncodingError=e.InvalidTupleEncodingError;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=t.CheatCodes;exports.RegistryType=t.RegistryType;exports.TRANSFER_SIGNATURE=t.TRANSFER_SIGNATURE;exports.assertValidAddressByChainId=t.assertValidAddressByChainId;exports.awaitResult=t.awaitResult;exports.bytes4=t.bytes4;exports.getDeployedContractAddress=t.getDeployedContractAddress;exports.getErc20Balance=t.getErc20Balance;exports.StrategyType=D.StrategyType;exports.prepareClaimPayload=D.prepareClaimPayload;exports.AssetType=d.AssetType;exports.prepareERC1155Payload=d.prepareERC1155Payload;exports.prepareERC1155Transfer=d.prepareERC1155Transfer;exports.prepareFungiblePayload=d.prepareFungiblePayload;exports.prepareFungibleTransfer=d.prepareFungibleTransfer;exports.prepareTransferPayload=d.prepareTransferPayload;exports.PassthroughAuth=h.PassthroughAuth;exports.allowListIncentiveAbi=r.q;exports.boostCoreAbi=r.R;exports.boostRegistryAbi=r.Re;exports.cgdaIncentiveAbi=r.z;exports.erc20IncentiveAbi=r.T;exports.erc20PeggedIncentiveAbi=r.g;exports.erc20PeggedVariableCriteriaIncentiveAbi=r.y;exports.erc20PeggedVariableCriteriaIncentiveV2Abi=r.d;exports.erc20VariableCriteriaIncentiveAbi=r.c;exports.erc20VariableCriteriaIncentiveV2Abi=r.m;exports.erc20VariableIncentiveAbi=r.O;exports.limitedSignerValidatorAbi=r.G;exports.managedBudgetAbi=r.C;exports.managedBudgetWithFeesAbi=r.p;exports.managedBudgetWithFeesV2Abi=r.r;exports.offchainAccessListAbi=r.M;exports.passthroughAuthAbi=r.pt;exports.payableLimitedSignerValidatorAbi=r._;exports.pointsIncentiveAbi=r.H;exports.rbacAbi=r.D;exports.signerValidatorAbi=r.j;exports.simpleAllowListAbi=r.S;exports.simpleDenyListAbi=r.P;exports.transparentBudgetAbi=r.b;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./BoostRegistry.cjs"),s=require("./BoostCore.cjs"),I=require("./Boost.cjs"),A=require("./Actions/Action.cjs"),a=require("./Actions/EventAction.cjs"),l=require("./AllowList-Lpqz7tn9.cjs"),y=require("./AllowLists/SimpleAllowList.cjs"),P=require("./SimpleDenyList-DEoMIYhE.cjs"),n=require("./Budget-rZm-AY09.cjs"),o=require("./Budgets/ManagedBudget.cjs"),F=require("./Deployable/Deployable.cjs"),L=require("./Deployable/Contract.cjs"),f=require("./Deployable/DeployableTarget.cjs"),b=require("./Deployable/DeployableTargetWithRBAC.cjs"),v=require("./Incentives/AllowListIncentive.cjs"),m=require("./Incentives/CGDAIncentive.cjs"),R=require("./Incentives/ERC20Incentive.cjs"),p=require("./Incentive-Bse5BKbF.cjs"),S=require("./Incentives/ERC20VariableIncentive.cjs"),E=require("./Incentives/ERC20VariableCriteriaIncentive.cjs"),V=require("./Incentives/ERC20PeggedVariableCriteriaIncentive.cjs"),u=require("./Incentives/ERC20VariableCriteriaIncentiveV2.cjs"),T=require("./Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs"),B=require("./Incentives/PointsIncentive.cjs"),c=require("./Validators/SignerValidator.cjs"),g=require("./Validators/LimitedSignerValidator.cjs"),i=require("./Validator-DHS4vjSa.cjs"),e=require("./errors.cjs"),t=require("./utils.cjs"),D=require("./claiming.cjs"),d=require("./transfers.cjs"),h=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-BzLYuFx3.cjs");exports.BOOST_REGISTRY_ADDRESS=C.BOOST_REGISTRY_ADDRESS;exports.BOOST_REGISTRY_ADDRESSES=C.BOOST_REGISTRY_ADDRESSES;exports.BoostRegistry=C.BoostRegistry;exports.BOOST_CORE_ADDRESS=s.BOOST_CORE_ADDRESS;exports.BOOST_CORE_ADDRESSES=s.BOOST_CORE_ADDRESSES;exports.BoostCore=s.BoostCore;exports.FEE_DENOMINATOR=s.FEE_DENOMINATOR;exports.Boost=I.Boost;exports.prepareBoostPayload=I.prepareBoostPayload;exports.ActionByComponentInterface=A.ActionByComponentInterface;exports.actionFromAddress=A.actionFromAddress;exports.EventAction=a.EventAction;exports.FilterType=a.FilterType;exports.PrimitiveType=a.PrimitiveType;exports.SignatureType=a.SignatureType;exports.ValueType=a.ValueType;exports.anyActionParameter=a.anyActionParameter;exports.decodeAndReorderLogArgs=a.decodeAndReorderLogArgs;exports.detectSignatureType=a.detectSignatureType;exports.getScalarValueFromTuple=a.getScalarValueFromTuple;exports.isClaimantFieldIndexTuple=a.isClaimantFieldIndexTuple;exports.isCriteriaFieldIndexTuple=a.isCriteriaFieldIndexTuple;exports.isEventActionPayloadSimple=a.isEventActionPayloadSimple;exports.packClaimantFieldIndexes=a.packClaimantFieldIndexes;exports.packCriteriaFieldIndexes=a.packCriteriaFieldIndexes;exports.packFieldIndexes=a.packFieldIndexes;exports.prepareEventActionPayload=a.prepareEventActionPayload;exports.transactionSenderClaimant=a.transactionSenderClaimant;exports.unpackClaimantFieldIndexes=a.unpackClaimantFieldIndexes;exports.unpackCriteriaFieldIndexes=a.unpackCriteriaFieldIndexes;exports.unpackFieldIndexes=a.unpackFieldIndexes;exports.AllowListByComponentInterface=l.AllowListByComponentInterface;exports.OffchainAccessList=l.OffchainAccessList;exports.OpenAllowList=l.OpenAllowList;exports.allowListFromAddress=l.allowListFromAddress;exports.prepareOffchainAccessListPayload=l.prepareOffchainAccessListPayload;exports.LIST_MANAGER_ROLE=y.LIST_MANAGER_ROLE;exports.SimpleAllowList=y.SimpleAllowList;exports.prepareSimpleAllowListPayload=y.prepareSimpleAllowListPayload;exports.SimpleDenyList=P.SimpleDenyList;exports.prepareSimpleDenyListPayload=P.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=n.BudgetByComponentInterface;exports.ManagedBudgetWithFees=n.ManagedBudgetWithFees;exports.ManagedBudgetWithFeesV2=n.ManagedBudgetWithFeesV2;exports.TransparentBudget=n.TransparentBudget;exports.budgetFromAddress=n.budgetFromAddress;exports.prepareManagedBudgetWithFeesPayload=n.prepareManagedBudgetWithFeesPayload;exports.prepareManagedBudgetWithFeesV2Payload=n.prepareManagedBudgetWithFeesV2Payload;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=F.Deployable;exports.Contract=L.Contract;exports.DeployableTarget=f.DeployableTarget;exports.DeployableTargetWithRBAC=b.DeployableTargetWithRBAC;exports.Roles=b.Roles;exports.AllowListIncentive=v.AllowListIncentive;exports.prepareAllowListIncentivePayload=v.prepareAllowListIncentivePayload;exports.CGDAIncentive=m.CGDAIncentive;exports.prepareCGDAIncentivePayload=m.prepareCGDAIncentivePayload;exports.ERC20Incentive=R.ERC20Incentive;exports.prepareERC20IncentivePayload=R.prepareERC20IncentivePayload;exports.ERC20PeggedIncentive=p.ERC20PeggedIncentive;exports.IncentiveByComponentInterface=p.IncentiveByComponentInterface;exports.incentiveFromAddress=p.incentiveFromAddress;exports.prepareERC20PeggedIncentivePayload=p.prepareERC20PeggedIncentivePayload;exports.ERC20VariableIncentive=S.ERC20VariableIncentive;exports.prepareERC20VariableIncentivePayload=S.prepareERC20VariableIncentivePayload;exports.ERC20VariableCriteriaIncentive=E.ERC20VariableCriteriaIncentive;exports.gasRebateIncentiveCriteria=E.gasRebateIncentiveCriteria;exports.prepareERC20VariableCriteriaIncentivePayload=E.prepareERC20VariableCriteriaIncentivePayload;exports.ERC20PeggedVariableCriteriaIncentive=V.ERC20PeggedVariableCriteriaIncentive;exports.prepareERC20PeggedVariableCriteriaIncentivePayload=V.prepareERC20PeggedVariableCriteriaIncentivePayload;exports.ERC20VariableCriteriaIncentiveV2=u.ERC20VariableCriteriaIncentiveV2;exports.gasRebateIncentiveCriteriaV2=u.gasRebateIncentiveCriteriaV2;exports.prepareERC20VariableCriteriaIncentiveV2Payload=u.prepareERC20VariableCriteriaIncentiveV2Payload;exports.ERC20PeggedVariableCriteriaIncentiveV2=T.ERC20PeggedVariableCriteriaIncentiveV2;exports.prepareERC20PeggedVariableCriteriaIncentiveV2Payload=T.prepareERC20PeggedVariableCriteriaIncentiveV2Payload;exports.PointsIncentive=B.PointsIncentive;exports.preparePointsIncentivePayload=B.preparePointsIncentivePayload;exports.SignerValidator=c.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=c.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=c.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=c.prepareSignerValidatorPayload;exports.LimitedSignerValidator=g.LimitedSignerValidator;exports.prepareLimitedSignerValidatorClaimDataPayload=g.prepareLimitedSignerValidatorClaimDataPayload;exports.prepareLimitedSignerValidatorInputParams=g.prepareLimitedSignerValidatorInputParams;exports.prepareLimitedSignerValidatorPayload=g.prepareLimitedSignerValidatorPayload;exports.BoostValidatorEOA=i.BoostValidatorEOA;exports.PayableLimitedSignerValidator=i.PayableLimitedSignerValidator;exports.ValidatorByComponentInterface=i.ValidatorByComponentInterface;exports.decodeClaimData=i.decodeClaimData;exports.preparePayableLimitedSignerValidatorClaimDataPayload=i.preparePayableLimitedSignerValidatorClaimDataPayload;exports.preparePayableLimitedSignerValidatorInputParams=i.preparePayableLimitedSignerValidatorInputParams;exports.preparePayableLimitedSignerValidatorPayload=i.preparePayableLimitedSignerValidatorPayload;exports.validatorFromAddress=i.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.InvalidTupleDecodingError=e.InvalidTupleDecodingError;exports.InvalidTupleEncodingError=e.InvalidTupleEncodingError;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=t.CheatCodes;exports.RegistryType=t.RegistryType;exports.TRANSFER_SIGNATURE=t.TRANSFER_SIGNATURE;exports.assertValidAddressByChainId=t.assertValidAddressByChainId;exports.awaitResult=t.awaitResult;exports.bytes4=t.bytes4;exports.getDeployedContractAddress=t.getDeployedContractAddress;exports.getErc20Balance=t.getErc20Balance;exports.StrategyType=D.StrategyType;exports.prepareClaimPayload=D.prepareClaimPayload;exports.AssetType=d.AssetType;exports.prepareERC1155Payload=d.prepareERC1155Payload;exports.prepareERC1155Transfer=d.prepareERC1155Transfer;exports.prepareFungiblePayload=d.prepareFungiblePayload;exports.prepareFungibleTransfer=d.prepareFungibleTransfer;exports.prepareTransferPayload=d.prepareTransferPayload;exports.PassthroughAuth=h.PassthroughAuth;exports.allowListIncentiveAbi=r.q;exports.boostCoreAbi=r.y;exports.boostRegistryAbi=r.Re;exports.cgdaIncentiveAbi=r.z;exports.erc20IncentiveAbi=r.w;exports.erc20PeggedIncentiveAbi=r.A;exports.erc20PeggedVariableCriteriaIncentiveAbi=r.d;exports.erc20PeggedVariableCriteriaIncentiveV2Abi=r.c;exports.erc20VariableCriteriaIncentiveAbi=r.m;exports.erc20VariableCriteriaIncentiveV2Abi=r.b;exports.erc20VariableIncentiveAbi=r.O;exports.limitedSignerValidatorAbi=r.U;exports.managedBudgetAbi=r.C;exports.managedBudgetWithFeesAbi=r.p;exports.managedBudgetWithFeesV2Abi=r.r;exports.offchainAccessListAbi=r.R;exports.passthroughAuthAbi=r.ut;exports.payableLimitedSignerValidatorAbi=r._;exports.pointsIncentiveAbi=r.H;exports.rbacAbi=r.D;exports.signerValidatorAbi=r.j;exports.simpleAllowListAbi=r.S;exports.simpleDenyListAbi=r.P;exports.transparentBudgetAbi=r.f;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,10 @@ import { BOOST_CORE_ADDRESS as n, BOOST_CORE_ADDRESSES as d, BoostCore as l, FEE
|
|
|
3
3
|
import { Boost as c, prepareBoostPayload as g } from "./Boost.js";
|
|
4
4
|
import { ActionByComponentInterface as A, actionFromAddress as y } from "./Actions/Action.js";
|
|
5
5
|
import { EventAction as E, FilterType as b, PrimitiveType as I, SignatureType as P, ValueType as f, anyActionParameter as u, decodeAndReorderLogArgs as v, detectSignatureType as V, getScalarValueFromTuple as S, isClaimantFieldIndexTuple as R, isCriteriaFieldIndexTuple as x, isEventActionPayloadSimple as B, packClaimantFieldIndexes as T, packCriteriaFieldIndexes as D, packFieldIndexes as F, prepareEventActionPayload as L, transactionSenderClaimant as h, unpackClaimantFieldIndexes as O, unpackCriteriaFieldIndexes as M, unpackFieldIndexes as N } from "./Actions/EventAction.js";
|
|
6
|
-
import { A as _, O as
|
|
6
|
+
import { A as _, O as U, a as k, b as W, p as G } from "./AllowList-CWqAYlwr.js";
|
|
7
7
|
import { LIST_MANAGER_ROLE as q, SimpleAllowList as Y, prepareSimpleAllowListPayload as j } from "./AllowLists/SimpleAllowList.js";
|
|
8
|
-
import { S as J, p as K } from "./SimpleDenyList-
|
|
9
|
-
import { B as X, M as Z, a as $, T as ee, b as re, p as ae, c as ie } from "./Budget-
|
|
8
|
+
import { S as J, p as K } from "./SimpleDenyList-BtEUdiAj.js";
|
|
9
|
+
import { B as X, M as Z, a as $, T as ee, b as re, p as ae, c as ie } from "./Budget-BPPXnBAK.js";
|
|
10
10
|
import { ManagedBudget as te, ManagedBudgetRoles as ne, isERC1155TransferPayload as de, isFungibleTransfer as le, prepareManagedBudgetPayload as pe, prepareTransfer as se } from "./Budgets/ManagedBudget.js";
|
|
11
11
|
import { Deployable as ge } from "./Deployable/Deployable.js";
|
|
12
12
|
import { Contract as Ae } from "./Deployable/Contract.js";
|
|
@@ -15,22 +15,22 @@ import { DeployableTargetWithRBAC as be, Roles as Ie } from "./Deployable/Deploy
|
|
|
15
15
|
import { AllowListIncentive as fe, prepareAllowListIncentivePayload as ue } from "./Incentives/AllowListIncentive.js";
|
|
16
16
|
import { CGDAIncentive as Ve, prepareCGDAIncentivePayload as Se } from "./Incentives/CGDAIncentive.js";
|
|
17
17
|
import { ERC20Incentive as xe, prepareERC20IncentivePayload as Be } from "./Incentives/ERC20Incentive.js";
|
|
18
|
-
import { E as De, I as Fe, i as Le, p as he } from "./Incentive-
|
|
18
|
+
import { E as De, I as Fe, i as Le, p as he } from "./Incentive-D1sYPD0W.js";
|
|
19
19
|
import { ERC20VariableIncentive as Me, prepareERC20VariableIncentivePayload as Ne } from "./Incentives/ERC20VariableIncentive.js";
|
|
20
|
-
import { ERC20VariableCriteriaIncentive as _e, gasRebateIncentiveCriteria as
|
|
20
|
+
import { ERC20VariableCriteriaIncentive as _e, gasRebateIncentiveCriteria as Ue, prepareERC20VariableCriteriaIncentivePayload as ke } from "./Incentives/ERC20VariableCriteriaIncentive.js";
|
|
21
21
|
import { ERC20PeggedVariableCriteriaIncentive as Ge, prepareERC20PeggedVariableCriteriaIncentivePayload as ze } from "./Incentives/ERC20PeggedVariableCriteriaIncentive.js";
|
|
22
22
|
import { ERC20VariableCriteriaIncentiveV2 as Ye, gasRebateIncentiveCriteriaV2 as je, prepareERC20VariableCriteriaIncentiveV2Payload as He } from "./Incentives/ERC20VariableCriteriaIncentiveV2.js";
|
|
23
23
|
import { ERC20PeggedVariableCriteriaIncentiveV2 as Ke, prepareERC20PeggedVariableCriteriaIncentiveV2Payload as Qe } from "./Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js";
|
|
24
24
|
import { PointsIncentive as Ze, preparePointsIncentivePayload as $e } from "./Incentives/PointsIncentive.js";
|
|
25
25
|
import { SignerValidator as rr, prepareSignerValidatorClaimDataPayload as ar, prepareSignerValidatorInputParams as ir, prepareSignerValidatorPayload as or } from "./Validators/SignerValidator.js";
|
|
26
26
|
import { LimitedSignerValidator as nr, prepareLimitedSignerValidatorClaimDataPayload as dr, prepareLimitedSignerValidatorInputParams as lr, prepareLimitedSignerValidatorPayload as pr } from "./Validators/LimitedSignerValidator.js";
|
|
27
|
-
import { B as cr, P as gr, V as mr, d as Ar, p as yr, a as Cr, b as Er, v as br } from "./Validator-
|
|
28
|
-
import { BoostCoreNoIdentifierEmitted as Pr, BoostNotFoundError as fr, BudgetMustAuthorizeBoostCore as ur, ContractAddressRequiredError as vr, DecodedArgsError as Vr, DecodedArgsMalformedError as Sr, DeployableAlreadyDeployedError as Rr, DeployableBuildParametersUnspecifiedError as xr, DeployableMissingPayloadError as Br, DeployableUnknownOwnerProvidedError as Tr, DeployableWagmiConfigurationRequiredError as Dr, FieldActionValidationError as Fr, FieldValueNotComparableError as Lr, FieldValueUndefinedError as hr, FunctionDataDecodeError as Or, IncentiveCriteriaNotFoundError as Mr, IncentiveNotCloneableError as Nr, InvalidComponentInterfaceError as wr, InvalidCriteriaTypeError as _r, InvalidNumericalCriteriaError as
|
|
27
|
+
import { B as cr, P as gr, V as mr, d as Ar, p as yr, a as Cr, b as Er, v as br } from "./Validator-Kpvmj9Bs.js";
|
|
28
|
+
import { BoostCoreNoIdentifierEmitted as Pr, BoostNotFoundError as fr, BudgetMustAuthorizeBoostCore as ur, ContractAddressRequiredError as vr, DecodedArgsError as Vr, DecodedArgsMalformedError as Sr, DeployableAlreadyDeployedError as Rr, DeployableBuildParametersUnspecifiedError as xr, DeployableMissingPayloadError as Br, DeployableUnknownOwnerProvidedError as Tr, DeployableWagmiConfigurationRequiredError as Dr, FieldActionValidationError as Fr, FieldValueNotComparableError as Lr, FieldValueUndefinedError as hr, FunctionDataDecodeError as Or, IncentiveCriteriaNotFoundError as Mr, IncentiveNotCloneableError as Nr, InvalidComponentInterfaceError as wr, InvalidCriteriaTypeError as _r, InvalidNumericalCriteriaError as Ur, InvalidProtocolChainIdError as kr, InvalidTupleDecodingError as Wr, InvalidTupleEncodingError as Gr, MustInitializeBudgetError as zr, NoConnectedChainIdError as qr, NoContractAddressUponReceiptError as Yr, NoEventActionStepsProvidedError as jr, NoMatchingLogsError as Hr, TooManyEventActionStepsProvidedError as Jr, UnknownTransferPayloadSupplied as Kr, UnparseableAbiParamError as Qr, UnrecognizedFilterTypeError as Xr, ValidationAbiMissingError as Zr } from "./errors.js";
|
|
29
29
|
import { CheatCodes as ea, RegistryType as ra, TRANSFER_SIGNATURE as aa, assertValidAddressByChainId as ia, awaitResult as oa, bytes4 as ta, getDeployedContractAddress as na, getErc20Balance as da } from "./utils.js";
|
|
30
30
|
import { StrategyType as pa, prepareClaimPayload as sa } from "./claiming.js";
|
|
31
31
|
import { AssetType as ga, prepareERC1155Payload as ma, prepareERC1155Transfer as Aa, prepareFungiblePayload as ya, prepareFungibleTransfer as Ca, prepareTransferPayload as Ea } from "./transfers.js";
|
|
32
32
|
import { PassthroughAuth as Ia } from "./Auth/PassthroughAuth.js";
|
|
33
|
-
import { q as fa,
|
|
33
|
+
import { q as fa, y as ua, R as va, z as Va, w as Sa, A as Ra, d as xa, c as Ba, m as Ta, b as Da, O as Fa, U as La, C as ha, p as Oa, r as Ma, a as Na, u as wa, _ as _a, H as Ua, D as ka, j as Wa, S as Ga, P as za, f as qa } from "./generated-D6oDILUw.js";
|
|
34
34
|
export {
|
|
35
35
|
A as ActionByComponentInterface,
|
|
36
36
|
_ as AllowListByComponentInterface,
|
|
@@ -81,8 +81,8 @@ export {
|
|
|
81
81
|
Nr as IncentiveNotCloneableError,
|
|
82
82
|
wr as InvalidComponentInterfaceError,
|
|
83
83
|
_r as InvalidCriteriaTypeError,
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
Ur as InvalidNumericalCriteriaError,
|
|
85
|
+
kr as InvalidProtocolChainIdError,
|
|
86
86
|
Wr as InvalidTupleDecodingError,
|
|
87
87
|
Gr as InvalidTupleEncodingError,
|
|
88
88
|
q as LIST_MANAGER_ROLE,
|
|
@@ -96,8 +96,8 @@ export {
|
|
|
96
96
|
Yr as NoContractAddressUponReceiptError,
|
|
97
97
|
jr as NoEventActionStepsProvidedError,
|
|
98
98
|
Hr as NoMatchingLogsError,
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
U as OffchainAccessList,
|
|
100
|
+
k as OpenAllowList,
|
|
101
101
|
Ia as PassthroughAuth,
|
|
102
102
|
gr as PayableLimitedSignerValidator,
|
|
103
103
|
Ze as PointsIncentive,
|
|
@@ -139,7 +139,7 @@ export {
|
|
|
139
139
|
Ta as erc20VariableCriteriaIncentiveAbi,
|
|
140
140
|
Da as erc20VariableCriteriaIncentiveV2Abi,
|
|
141
141
|
Fa as erc20VariableIncentiveAbi,
|
|
142
|
-
|
|
142
|
+
Ue as gasRebateIncentiveCriteria,
|
|
143
143
|
je as gasRebateIncentiveCriteriaV2,
|
|
144
144
|
na as getDeployedContractAddress,
|
|
145
145
|
da as getErc20Balance,
|
|
@@ -160,7 +160,7 @@ export {
|
|
|
160
160
|
F as packFieldIndexes,
|
|
161
161
|
wa as passthroughAuthAbi,
|
|
162
162
|
_a as payableLimitedSignerValidatorAbi,
|
|
163
|
-
|
|
163
|
+
Ua as pointsIncentiveAbi,
|
|
164
164
|
ue as prepareAllowListIncentivePayload,
|
|
165
165
|
g as prepareBoostPayload,
|
|
166
166
|
Se as prepareCGDAIncentivePayload,
|
|
@@ -171,7 +171,7 @@ export {
|
|
|
171
171
|
he as prepareERC20PeggedIncentivePayload,
|
|
172
172
|
ze as prepareERC20PeggedVariableCriteriaIncentivePayload,
|
|
173
173
|
Qe as prepareERC20PeggedVariableCriteriaIncentiveV2Payload,
|
|
174
|
-
|
|
174
|
+
ke as prepareERC20VariableCriteriaIncentivePayload,
|
|
175
175
|
He as prepareERC20VariableCriteriaIncentiveV2Payload,
|
|
176
176
|
Ne as prepareERC20VariableIncentivePayload,
|
|
177
177
|
L as prepareEventActionPayload,
|
|
@@ -195,7 +195,7 @@ export {
|
|
|
195
195
|
K as prepareSimpleDenyListPayload,
|
|
196
196
|
se as prepareTransfer,
|
|
197
197
|
Ea as prepareTransferPayload,
|
|
198
|
-
|
|
198
|
+
ka as rbacAbi,
|
|
199
199
|
Wa as signerValidatorAbi,
|
|
200
200
|
Ga as simpleAllowListAbi,
|
|
201
201
|
za as simpleDenyListAbi,
|
package/dist/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../src/utils.ts"],"sourcesContent":["import { events } from '@boostxyz/signatures';\nimport {\n type Config,\n type ReadContractParameters,\n type SimulateContractParameters,\n type WatchContractEventParameters,\n getAccount,\n getChainId,\n readContract,\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 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 `ERC20VariableCriteriaIncentiveV2`, 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 * The signature for the Transfer event for both ERC20 and ERC721.\n *\n * @type {Hex}\n */\nexport const TRANSFER_SIGNATURE = events.selectors[\n 'Transfer(address indexed,address indexed,uint256 indexed)'\n] as Hex;\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 = Partial<\n Omit<SimulateContractParameters, 'address' | 'args' | 'functionName' | 'abi'>\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 = Partial<\n Omit<ReadContractParameters, 'address' | 'args' | 'functionName' | 'abi'>\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\n const wagmiChainId = getChainId(config);\n if (wagmiChainId && addressByChainId[wagmiChainId]) chainId = wagmiChainId;\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 (wagmiChainId !== 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[wagmiChainId]) chainId = wagmiChainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const wagmiAccount = getAccount(config);\n 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])\n chainId = wagmiAccount.chainId;\n }\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\n/**\n * Check an ERC20's balance for a given asset and\n *\n * @public\n * @async\n * @param {Config} [config]\n * @param {Address} [asset]\n * @param {Address} [owner]\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The erc20 balance\n */\nexport async function getErc20Balance(\n config: Config,\n asset: Address,\n owner: Address,\n params?: ReadParams,\n) {\n return await readContract(config, {\n ...params,\n functionName: 'balanceOf',\n address: asset,\n args: [owner],\n abi: [\n {\n constant: true,\n inputs: [\n {\n name: '_owner',\n type: 'address',\n },\n ],\n name: 'balanceOf',\n outputs: [\n {\n name: 'balance',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n ],\n });\n}\n"],"names":["RegistryType","CheatCodes","TRANSFER_SIGNATURE","events","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiChainId","getChainId","wagmiAccount","getAccount","InvalidProtocolChainIdError","getErc20Balance","asset","owner","params","readContract"],"mappings":"49mBAsCY,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,EAcC,MAAAC,EAAqBC,EAAO,UACvC,2DACF,EAyFO,SAASC,EAAOC,EAAe,CACpC,OAAOC,EAAM,MAAAC,EAAA,MAAMF,CAAK,EAAIG,EAAU,UAAAH,CAAK,EAAIG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CACE,KAAM,SACN,KAAM,SACR,CACF,EACA,KAAM,YACN,QAAS,CACP,CACE,KAAM,UACN,KAAM,SACR,CACF,EACA,gBAAiB,OACjB,KAAM,UACR,CACF,CAAA,CACD,CACH"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../src/utils.ts"],"sourcesContent":["import { events } from '@boostxyz/signatures';\nimport {\n type Config,\n type ReadContractParameters,\n type SimulateContractParameters,\n type WatchContractEventParameters,\n getAccount,\n getChainId,\n readContract,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n Address,\n ContractEventName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport {\n InvalidProtocolChainIdError,\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 `ERC20VariableCriteriaIncentiveV2`, 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 * The signature for the Transfer event for both ERC20 and ERC721.\n *\n * @type {Hex}\n */\nexport const TRANSFER_SIGNATURE = events.selectors[\n 'Transfer(address indexed,address indexed,uint256 indexed)'\n] as Hex;\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 = Partial<\n Omit<SimulateContractParameters, 'address' | 'args' | 'functionName' | 'abi'>\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 = Partial<\n Omit<ReadContractParameters, 'address' | 'args' | 'functionName' | 'abi'>\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\n const wagmiChainId = getChainId(config);\n if (wagmiChainId && addressByChainId[wagmiChainId]) chainId = wagmiChainId;\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 (wagmiChainId !== 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[wagmiChainId]) chainId = wagmiChainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const wagmiAccount = getAccount(config);\n 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])\n chainId = wagmiAccount.chainId;\n }\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\n/**\n * Check an ERC20's balance for a given asset and\n *\n * @public\n * @async\n * @param {Config} [config]\n * @param {Address} [asset]\n * @param {Address} [owner]\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The erc20 balance\n */\nexport async function getErc20Balance(\n config: Config,\n asset: Address,\n owner: Address,\n params?: ReadParams,\n) {\n return await readContract(config, {\n ...params,\n functionName: 'balanceOf',\n address: asset,\n args: [owner],\n abi: [\n {\n constant: true,\n inputs: [\n {\n name: '_owner',\n type: 'address',\n },\n ],\n name: 'balanceOf',\n outputs: [\n {\n name: 'balance',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n ],\n });\n}\n"],"names":["RegistryType","CheatCodes","TRANSFER_SIGNATURE","events","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiChainId","getChainId","wagmiAccount","getAccount","InvalidProtocolChainIdError","getErc20Balance","asset","owner","params","readContract"],"mappings":"49mBAqCY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,W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eC,aAAWhB,CAAM,EAClCe,EAAa,UAAY,QAEvBL,EAAiBK,EAAa,OAAO,IACvCH,EAAUG,EAAa,QAE7B,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,CAaA,eAAsBM,EACpBlB,EACAmB,EACAC,EACAC,EACA,CACO,OAAA,MAAMC,eAAatB,EAAQ,CAChC,GAAGqB,EACH,aAAc,YACd,QAASF,EACT,KAAM,CAACC,CAAK,EACZ,IAAK,CACH,CACE,SAAU,GACV,OAAQ,CACN,CACE,KAAM,SACN,KAAM,SACR,CACF,EACA,KAAM,YACN,QAAS,CACP,CACE,KAAM,UACN,KAAM,SACR,CACF,EACA,gBAAiB,OACjB,KAAM,UACR,CACF,CAAA,CACD,CACH"}
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EAKlC,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EACV,GAAG,EACH,QAAQ,EACR,OAAO,EACP,iBAAiB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EAKlC,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/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,CAAC,EAAE,IAAI,CAAC,mCAAmC,EAAE,MAAM,CAAC,GAC7D,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,cAAc,CAAC,EAAE,MAAM,GACtB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CA+BvC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,UAAU,mBA4BpB"}
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import { events } from '@boostxyz/signatures';\nimport {\n type Config,\n type ReadContractParameters,\n type SimulateContractParameters,\n type WatchContractEventParameters,\n getAccount,\n getChainId,\n readContract,\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 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 `ERC20VariableCriteriaIncentiveV2`, 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 * The signature for the Transfer event for both ERC20 and ERC721.\n *\n * @type {Hex}\n */\nexport const TRANSFER_SIGNATURE = events.selectors[\n 'Transfer(address indexed,address indexed,uint256 indexed)'\n] as Hex;\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 = Partial<\n Omit<SimulateContractParameters, 'address' | 'args' | 'functionName' | 'abi'>\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 = Partial<\n Omit<ReadContractParameters, 'address' | 'args' | 'functionName' | 'abi'>\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\n const wagmiChainId = getChainId(config);\n if (wagmiChainId && addressByChainId[wagmiChainId]) chainId = wagmiChainId;\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 (wagmiChainId !== 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[wagmiChainId]) chainId = wagmiChainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const wagmiAccount = getAccount(config);\n 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])\n chainId = wagmiAccount.chainId;\n }\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\n/**\n * Check an ERC20's balance for a given asset and\n *\n * @public\n * @async\n * @param {Config} [config]\n * @param {Address} [asset]\n * @param {Address} [owner]\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The erc20 balance\n */\nexport async function getErc20Balance(\n config: Config,\n asset: Address,\n owner: Address,\n params?: ReadParams,\n) {\n return await readContract(config, {\n ...params,\n functionName: 'balanceOf',\n address: asset,\n args: [owner],\n abi: [\n {\n constant: true,\n inputs: [\n {\n name: '_owner',\n type: 'address',\n },\n ],\n name: 'balanceOf',\n outputs: [\n {\n name: 'balance',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n ],\n });\n}\n"],"names":["RegistryType","CheatCodes","TRANSFER_SIGNATURE","events","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiChainId","getChainId","wagmiAccount","getAccount","InvalidProtocolChainIdError","getErc20Balance","asset","owner","params","readContract"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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MAAMC,EAAatB,GAAQ;AAAA,IAChC,GAAGqB;AAAA,IACH,cAAc;AAAA,IACd,SAASF;AAAA,IACT,MAAM,CAACC,CAAK;AAAA,IACZ,KAAK;AAAA,MACH;AAAA,QACE,UAAU;AAAA,QACV,QAAQ;AAAA,UACN;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,UACR;AAAA,QACF;AAAA,QACA,MAAM;AAAA,QACN,SAAS;AAAA,UACP;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,UACR;AAAA,QACF;AAAA,QACA,iBAAiB;AAAA,QACjB,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EAAA,CACD;AACH;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import { events } from '@boostxyz/signatures';\nimport {\n type Config,\n type ReadContractParameters,\n type SimulateContractParameters,\n type WatchContractEventParameters,\n getAccount,\n getChainId,\n readContract,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n Address,\n ContractEventName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport {\n InvalidProtocolChainIdError,\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 `ERC20VariableCriteriaIncentiveV2`, 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 * The signature for the Transfer event for both ERC20 and ERC721.\n *\n * @type {Hex}\n */\nexport const TRANSFER_SIGNATURE = events.selectors[\n 'Transfer(address indexed,address indexed,uint256 indexed)'\n] as Hex;\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 = Partial<\n Omit<SimulateContractParameters, 'address' | 'args' | 'functionName' | 'abi'>\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 = Partial<\n Omit<ReadContractParameters, 'address' | 'args' | 'functionName' | 'abi'>\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\n const wagmiChainId = getChainId(config);\n if (wagmiChainId && addressByChainId[wagmiChainId]) chainId = wagmiChainId;\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 (wagmiChainId !== 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[wagmiChainId]) chainId = wagmiChainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const wagmiAccount = getAccount(config);\n 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])\n chainId = wagmiAccount.chainId;\n }\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\n/**\n * Check an ERC20's balance for a given asset and\n *\n * @public\n * @async\n * @param {Config} [config]\n * @param {Address} [asset]\n * @param {Address} [owner]\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The erc20 balance\n */\nexport async function getErc20Balance(\n config: Config,\n asset: Address,\n owner: Address,\n params?: ReadParams,\n) {\n return await readContract(config, {\n ...params,\n functionName: 'balanceOf',\n address: asset,\n args: [owner],\n abi: [\n {\n constant: true,\n inputs: [\n {\n name: '_owner',\n type: 'address',\n },\n ],\n name: 'balanceOf',\n outputs: [\n {\n name: 'balance',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n ],\n });\n}\n"],"names":["RegistryType","CheatCodes","TRANSFER_SIGNATURE","events","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiChainId","getChainId","wagmiAccount","getAccount","InvalidProtocolChainIdError","getErc20Balance","asset","owner","params","readContract"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IACZ,KAAK;AAAA,MACH;AAAA,QACE,UAAU;AAAA,QACV,QAAQ;AAAA,UACN;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,UACR;AAAA,QACF;AAAA,QACA,MAAM;AAAA,QACN,SAAS;AAAA,UACP;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,UACR;AAAA,QACF;AAAA,QACA,iBAAiB;AAAA,QACjB,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EAAA,CACD;AACH;"}
|
package/package.json
CHANGED
package/src/BoostCore.test.ts
CHANGED
|
@@ -77,6 +77,7 @@ describe("BoostCore", () => {
|
|
|
77
77
|
await core.getBoost(1000n);
|
|
78
78
|
} catch (e) {
|
|
79
79
|
expect(e instanceof BoostNotFoundError).toBe(true);
|
|
80
|
+
// @ts-ignore
|
|
80
81
|
expect(e.id).toBe("1000");
|
|
81
82
|
}
|
|
82
83
|
});
|
|
@@ -648,20 +649,20 @@ describe("BoostCore", () => {
|
|
|
648
649
|
// expect(erc721MintAction._account).toEqual(defaultOptions.account);
|
|
649
650
|
|
|
650
651
|
const eventAction = core.EventAction(zeroAddress);
|
|
651
|
-
expect(eventAction.
|
|
652
|
-
expect(eventAction.
|
|
652
|
+
expect(eventAction.config).toEqual(defaultOptions.config);
|
|
653
|
+
expect(eventAction.account).toEqual(defaultOptions.account);
|
|
653
654
|
|
|
654
655
|
const allowList = core.SimpleAllowList(zeroAddress);
|
|
655
|
-
expect(allowList.
|
|
656
|
-
expect(allowList.
|
|
656
|
+
expect(allowList.config).toEqual(defaultOptions.config);
|
|
657
|
+
expect(allowList.account).toEqual(defaultOptions.account);
|
|
657
658
|
|
|
658
659
|
const denyList = core.SimpleDenyList(zeroAddress);
|
|
659
|
-
expect(denyList.
|
|
660
|
-
expect(denyList.
|
|
660
|
+
expect(denyList.config).toEqual(defaultOptions.config);
|
|
661
|
+
expect(denyList.account).toEqual(defaultOptions.account);
|
|
661
662
|
|
|
662
663
|
const managedBudget = core.ManagedBudget(zeroAddress);
|
|
663
|
-
expect(managedBudget.
|
|
664
|
-
expect(managedBudget.
|
|
664
|
+
expect(managedBudget.config).toEqual(defaultOptions.config);
|
|
665
|
+
expect(managedBudget.account).toEqual(defaultOptions.account);
|
|
665
666
|
|
|
666
667
|
// const simpleBudget = core.SimpleBudget(zeroAddress);
|
|
667
668
|
// expect(simpleBudget._config).toEqual(defaultOptions.config);
|
|
@@ -675,8 +676,8 @@ describe("BoostCore", () => {
|
|
|
675
676
|
allowList: zeroAddress,
|
|
676
677
|
limit: 0n,
|
|
677
678
|
});
|
|
678
|
-
expect(allowListIncentive.
|
|
679
|
-
expect(allowListIncentive.
|
|
679
|
+
expect(allowListIncentive.config).toEqual(defaultOptions.config);
|
|
680
|
+
expect(allowListIncentive.account).toEqual(defaultOptions.account);
|
|
680
681
|
|
|
681
682
|
const cgdaIncentive = core.CGDAIncentive({
|
|
682
683
|
asset: zeroAddress,
|
|
@@ -686,8 +687,8 @@ describe("BoostCore", () => {
|
|
|
686
687
|
totalBudget: 0n,
|
|
687
688
|
manager: zeroAddress,
|
|
688
689
|
});
|
|
689
|
-
expect(cgdaIncentive.
|
|
690
|
-
expect(cgdaIncentive.
|
|
690
|
+
expect(cgdaIncentive.config).toEqual(defaultOptions.config);
|
|
691
|
+
expect(cgdaIncentive.account).toEqual(defaultOptions.account);
|
|
691
692
|
|
|
692
693
|
const erc20Incentive = core.ERC20Incentive({
|
|
693
694
|
asset: zeroAddress,
|
|
@@ -695,16 +696,17 @@ describe("BoostCore", () => {
|
|
|
695
696
|
reward: 0n,
|
|
696
697
|
limit: 0n,
|
|
697
698
|
});
|
|
698
|
-
expect(erc20Incentive.
|
|
699
|
-
expect(erc20Incentive.
|
|
699
|
+
expect(erc20Incentive.config).toEqual(defaultOptions.config);
|
|
700
|
+
expect(erc20Incentive.account).toEqual(defaultOptions.account);
|
|
700
701
|
|
|
701
702
|
const erc20VariableIncentive = core.ERC20VariableIncentive({
|
|
702
703
|
asset: zeroAddress,
|
|
703
704
|
reward: 0n,
|
|
704
705
|
limit: 0n,
|
|
706
|
+
manager: zeroAddress,
|
|
705
707
|
});
|
|
706
|
-
expect(erc20VariableIncentive.
|
|
707
|
-
expect(erc20VariableIncentive.
|
|
708
|
+
expect(erc20VariableIncentive.config).toEqual(defaultOptions.config);
|
|
709
|
+
expect(erc20VariableIncentive.account).toEqual(defaultOptions.account);
|
|
708
710
|
|
|
709
711
|
// const erc1155Incentive = core.ERC1155Incentive({
|
|
710
712
|
// asset: zeroAddress,
|
|
@@ -722,12 +724,12 @@ describe("BoostCore", () => {
|
|
|
722
724
|
reward: 0n,
|
|
723
725
|
limit: 0n,
|
|
724
726
|
});
|
|
725
|
-
expect(pointsIncentive.
|
|
726
|
-
expect(pointsIncentive.
|
|
727
|
+
expect(pointsIncentive.config).toEqual(defaultOptions.config);
|
|
728
|
+
expect(pointsIncentive.account).toEqual(defaultOptions.account);
|
|
727
729
|
|
|
728
730
|
const signerValidator = core.SignerValidator(zeroAddress);
|
|
729
|
-
expect(signerValidator.
|
|
730
|
-
expect(signerValidator.
|
|
731
|
+
expect(signerValidator.config).toEqual(defaultOptions.config);
|
|
732
|
+
expect(signerValidator.account).toEqual(defaultOptions.account);
|
|
731
733
|
});
|
|
732
734
|
|
|
733
735
|
test("can subscribe to contract events", async () => {
|
|
@@ -776,6 +778,7 @@ describe("BoostCore", () => {
|
|
|
776
778
|
const { core } = fixtures;
|
|
777
779
|
|
|
778
780
|
const auth = core.PassthroughAuth();
|
|
781
|
+
// @ts-ignore
|
|
779
782
|
await auth.deploy();
|
|
780
783
|
await core.setCreateBoostAuth(auth);
|
|
781
784
|
expect((await core.createBoostAuth()).toLowerCase()).toBe(
|
|
@@ -1032,6 +1035,8 @@ describe("Top-Up Incentives", () => {
|
|
|
1032
1035
|
let boostId: bigint;
|
|
1033
1036
|
|
|
1034
1037
|
beforeAll(async () => {
|
|
1038
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
1039
|
+
budgets = await loadFixture(fundBudget(defaultOptions, fixtures));
|
|
1035
1040
|
const { core } = fixtures;
|
|
1036
1041
|
const { budget, erc20 } = budgets;
|
|
1037
1042
|
|
|
@@ -1078,12 +1083,9 @@ describe("Top-Up Incentives", () => {
|
|
|
1078
1083
|
const { core } = fixtures;
|
|
1079
1084
|
const { budget, erc20 } = budgets;
|
|
1080
1085
|
|
|
1081
|
-
console.log("budget", budget.assertValidAddress());
|
|
1082
|
-
|
|
1083
1086
|
const netTopup = parseEther("5");
|
|
1084
1087
|
|
|
1085
1088
|
await core.topupIncentiveFromBudgetPreFee(boostId, 0n, netTopup, budget.assertValidAddress());
|
|
1086
|
-
console.log("topup done");
|
|
1087
1089
|
|
|
1088
1090
|
expect(await incentive.limit()).toBe(5n + 5n); // original limit 5 + topup 5
|
|
1089
1091
|
});
|
|
@@ -1155,6 +1157,8 @@ describe("ERC20PeggedVariableCriteriaIncentive Top-Ups", () => {
|
|
|
1155
1157
|
let erc721: MockERC721;
|
|
1156
1158
|
|
|
1157
1159
|
beforeAll(async () => {
|
|
1160
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
1161
|
+
budgets = await loadFixture(fundBudget(defaultOptions, fixtures));
|
|
1158
1162
|
const { core } = fixtures;
|
|
1159
1163
|
const { budget, erc20 } = budgets;
|
|
1160
1164
|
|
|
@@ -1285,6 +1289,13 @@ describe("ERC20PeggedVariableCriteriaIncentive Top-Ups", () => {
|
|
|
1285
1289
|
});
|
|
1286
1290
|
|
|
1287
1291
|
describe("ERC20PeggedVariableCriteriaIncentive with LimitedSignerValidator", () => {
|
|
1292
|
+
beforeAll(async () => {
|
|
1293
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
1294
|
+
});
|
|
1295
|
+
beforeEach(async () => {
|
|
1296
|
+
budgets = await loadFixture(fundBudget(defaultOptions, fixtures));
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1288
1299
|
test("enforces validator claim limit", async () => {
|
|
1289
1300
|
const referrer = accounts[1].account!;
|
|
1290
1301
|
const signer = accounts[0];
|