@boostxyz/sdk 0.0.0-alpha.9 → 1.1.0-alpha.23
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.cjs.map +1 -1
- package/dist/Actions/Action.js +2 -2
- package/dist/Actions/ContractAction.d.ts +11 -11
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +14 -14
- package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +174 -41
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +557 -129
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.cjs.map +1 -1
- package/dist/AllowLists/AllowList.d.ts +6 -4
- package/dist/AllowLists/AllowList.d.ts.map +1 -1
- package/dist/AllowLists/AllowList.js +45 -23
- package/dist/AllowLists/AllowList.js.map +1 -1
- package/dist/AllowLists/OpenAllowList.d.ts +423 -0
- package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +92 -37
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +60 -75
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +203 -11
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +11 -112
- package/dist/AllowLists/SimpleDenyList.js.map +1 -1
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/Boost.cjs +1 -1
- package/dist/Boost.cjs.map +1 -1
- package/dist/Boost.d.ts +20 -21
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js +43 -57
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore-Btl5BdAs.cjs +3 -0
- package/dist/BoostCore-Btl5BdAs.cjs.map +1 -0
- package/dist/BoostCore-CD56zbYX.js +2641 -0
- package/dist/BoostCore-CD56zbYX.js.map +1 -0
- package/dist/BoostCore.cjs +1 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +749 -78
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +29 -1150
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.d.ts +80 -25
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +164 -82
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.cjs.map +1 -1
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +2 -2
- package/dist/Budgets/Budget.js.map +1 -1
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts +103 -221
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +81 -298
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +223 -89
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/Contract.cjs +1 -1
- package/dist/Deployable/Contract.cjs.map +1 -1
- package/dist/Deployable/Contract.d.ts +4 -5
- package/dist/Deployable/Contract.d.ts.map +1 -1
- package/dist/Deployable/Contract.js +5 -7
- package/dist/Deployable/Contract.js.map +1 -1
- package/dist/Deployable/Deployable.cjs.map +1 -1
- package/dist/Deployable/Deployable.d.ts +1 -1
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +3 -5
- package/dist/Deployable/Deployable.js.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts +13 -13
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +28 -25
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
- package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts +248 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js +320 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
- package/dist/Incentive-CcnOIc8L.cjs +2 -0
- package/dist/Incentive-CcnOIc8L.cjs.map +1 -0
- package/dist/Incentive-rM5nKznp.js +313 -0
- package/dist/Incentive-rM5nKznp.js.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +38 -16
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +43 -29
- package/dist/Incentives/AllowListIncentive.js.map +1 -1
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
- package/dist/Incentives/CGDAIncentive.d.ts +234 -21
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +46 -32
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +224 -37
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +234 -30
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +62 -46
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +333 -438
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +231 -29
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.cjs.map +1 -1
- package/dist/Incentives/Incentive.d.ts +4 -4
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +16 -296
- package/dist/Incentives/Incentive.js.map +1 -1
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +40 -18
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +38 -24
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/SimpleDenyList-BDXpY74P.js +133 -0
- package/dist/SimpleDenyList-BDXpY74P.js.map +1 -0
- package/dist/SimpleDenyList-DNj5qDWM.cjs +2 -0
- package/dist/SimpleDenyList-DNj5qDWM.cjs.map +1 -0
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +16 -16
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +32 -28
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.cjs.map +1 -1
- package/dist/Validators/Validator.d.ts +1 -1
- package/dist/Validators/Validator.js +2 -2
- package/dist/Validators/Validator.js.map +1 -1
- package/dist/claiming.cjs.map +1 -1
- package/dist/claiming.d.ts +1 -1
- package/dist/claiming.js.map +1 -1
- package/dist/componentInterfaces-BBCFkrZv.js +14 -0
- package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
- package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
- package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
- package/dist/deployments-DF_6-7hH.cjs +2 -0
- package/dist/deployments-DF_6-7hH.cjs.map +1 -0
- package/dist/deployments-fJsWblwS.js +56 -0
- package/dist/deployments-fJsWblwS.js.map +1 -0
- package/dist/deployments.json +58 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +256 -20
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +183 -26
- package/dist/errors.js.map +1 -1
- package/dist/{generated-57_Kffpz.js → generated-CsNyWPKA.js} +3843 -2084
- package/dist/generated-CsNyWPKA.js.map +1 -0
- package/dist/generated-DHerxf1y.cjs +3 -0
- package/dist/generated-DHerxf1y.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +142 -108
- package/dist/index.js.map +1 -1
- package/dist/transfers.cjs.map +1 -1
- package/dist/transfers.d.ts +1 -1
- package/dist/transfers.js.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +26 -12
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -23
- package/dist/utils.js.map +1 -1
- package/package.json +20 -10
- package/src/Actions/Action.test.ts +14 -13
- package/src/Actions/ContractAction.test.ts +10 -10
- package/src/Actions/ContractAction.ts +11 -12
- package/src/Actions/ERC721MintAction.test.ts +6 -6
- package/src/Actions/ERC721MintAction.ts +14 -15
- package/src/Actions/EventAction.test.ts +735 -109
- package/src/Actions/EventAction.ts +527 -88
- package/src/AllowLists/AllowList.test.ts +7 -7
- package/src/AllowLists/AllowList.ts +5 -3
- package/src/AllowLists/OpenAllowList.test.ts +40 -0
- package/src/AllowLists/OpenAllowList.ts +45 -0
- package/src/AllowLists/SimpleAllowList.test.ts +4 -4
- package/src/AllowLists/SimpleAllowList.ts +40 -61
- package/src/AllowLists/SimpleDenyList.test.ts +4 -4
- package/src/AllowLists/SimpleDenyList.ts +41 -17
- package/src/Auth/PassthroughAuth.test.ts +1 -1
- package/src/Boost.ts +21 -24
- package/src/BoostCore.test.ts +361 -306
- package/src/BoostCore.ts +403 -220
- package/src/BoostRegistry.test.ts +53 -0
- package/src/BoostRegistry.ts +161 -40
- package/src/Budgets/Budget.test.ts +2 -2
- package/src/Budgets/Budget.ts +1 -2
- package/src/Budgets/ManagedBudget.test.ts +106 -19
- package/src/Budgets/ManagedBudget.ts +49 -321
- package/src/Budgets/VestingBudget.test.ts +7 -7
- package/src/Budgets/VestingBudget.ts +36 -106
- package/src/Deployable/Contract.ts +4 -5
- package/src/Deployable/Deployable.ts +1 -1
- package/src/Deployable/DeployableTarget.ts +30 -19
- package/src/Deployable/DeployableTargetWithRBAC.test.ts +103 -0
- package/src/Deployable/DeployableTargetWithRBAC.ts +447 -0
- package/src/Incentives/AllowListIncentive.test.ts +12 -12
- package/src/Incentives/AllowListIncentive.ts +30 -15
- package/src/Incentives/CGDAIncentive.test.ts +9 -6
- package/src/Incentives/CGDAIncentive.ts +39 -18
- package/src/Incentives/ERC1155Incentive.test.ts +3 -3
- package/src/Incentives/ERC1155Incentive.ts +30 -29
- package/src/Incentives/ERC20Incentive.test.ts +9 -6
- package/src/Incentives/ERC20Incentive.ts +54 -27
- package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +325 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +8 -11
- package/src/Incentives/ERC20VariableIncentive.ts +50 -26
- package/src/Incentives/Incentive.test.ts +4 -1
- package/src/Incentives/Incentive.ts +7 -6
- package/src/Incentives/PointsIncentive.test.ts +24 -25
- package/src/Incentives/PointsIncentive.ts +32 -17
- package/src/Validators/SignerValidator.test.ts +6 -6
- package/src/Validators/SignerValidator.ts +20 -17
- package/src/Validators/Validator.test.ts +2 -2
- package/src/Validators/Validator.ts +1 -1
- package/src/claiming.ts +1 -1
- package/src/errors.ts +345 -21
- package/src/index.test.ts +118 -36
- package/src/index.ts +5 -0
- package/src/transfers.ts +1 -1
- package/src/utils.test.ts +2 -2
- package/src/utils.ts +61 -12
- package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
- package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
- package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
- package/dist/componentInterfaces-DYkaxBda.js +0 -13
- package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
- package/dist/generated-57_Kffpz.js.map +0 -1
- package/dist/generated-wKBNvm48.cjs +0 -3
- package/dist/generated-wKBNvm48.cjs.map +0 -1
- package/src/Budgets/SimpleBudget.test.ts +0 -152
- package/src/Budgets/SimpleBudget.ts +0 -564
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./BoostRegistry.cjs"),a=require("./BoostCore-Btl5BdAs.cjs"),y=require("./Boost.cjs"),E=require("./Actions/Action.cjs"),o=require("./Actions/EventAction.cjs"),p=require("./AllowLists/AllowList.cjs"),c=require("./AllowLists/SimpleAllowList.cjs"),A=require("./SimpleDenyList-DNj5qDWM.cjs"),u=require("./Budgets/Budget.cjs"),t=require("./Budgets/ManagedBudget.cjs"),R=require("./Deployable/Deployable.cjs"),m=require("./Deployable/Contract.cjs"),B=require("./Deployable/DeployableTarget.cjs"),C=require("./Deployable/DeployableTargetWithRBAC.cjs"),g=require("./Incentives/AllowListIncentive.cjs"),I=require("./Incentives/CGDAIncentive.cjs"),v=require("./Incentives/ERC20Incentive.cjs"),l=require("./Incentive-CcnOIc8L.cjs"),P=require("./Incentives/PointsIncentive.cjs"),d=require("./Validators/SignerValidator.cjs"),S=require("./Validators/Validator.cjs"),e=require("./errors.cjs"),n=require("./utils.cjs"),b=require("./claiming.cjs"),i=require("./transfers.cjs"),D=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-DHerxf1y.cjs");exports.BOOST_REGISTRY_ADDRESS=s.BOOST_REGISTRY_ADDRESS;exports.BOOST_REGISTRY_ADDRESSES=s.BOOST_REGISTRY_ADDRESSES;exports.BoostRegistry=s.BoostRegistry;exports.BOOST_CORE_ADDRESS=a.BOOST_CORE_ADDRESS;exports.BOOST_CORE_ADDRESSES=a.BOOST_CORE_ADDRESSES;exports.BOOST_CORE_CLAIM_FEE=a.BOOST_CORE_CLAIM_FEE;exports.BoostCore=a.BoostCore;exports.ERC20VariableCriteriaIncentive=a.ERC20VariableCriteriaIncentive;exports.prepareERC20VariableCriteriaIncentivePayload=a.prepareERC20VariableCriteriaIncentivePayload;exports.Boost=y.Boost;exports.prepareBoostPayload=y.prepareBoostPayload;exports.ActionByComponentInterface=E.ActionByComponentInterface;exports.actionFromAddress=E.actionFromAddress;exports.EventAction=o.EventAction;exports.FilterType=o.FilterType;exports.PrimitiveType=o.PrimitiveType;exports.SignatureType=o.SignatureType;exports.anyActionParameter=o.anyActionParameter;exports.isEventActionPayloadSimple=o.isEventActionPayloadSimple;exports.prepareEventActionPayload=o.prepareEventActionPayload;exports.AllowListByComponentInterface=p.AllowListByComponentInterface;exports.OpenAllowList=p.OpenAllowList;exports.allowListFromAddress=p.allowListFromAddress;exports.LIST_MANAGER_ROLE=c.LIST_MANAGER_ROLE;exports.SimpleAllowList=c.SimpleAllowList;exports.prepareSimpleAllowListPayload=c.prepareSimpleAllowListPayload;exports.SimpleDenyList=A.SimpleDenyList;exports.prepareSimpleDenyListPayload=A.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=u.BudgetByComponentInterface;exports.budgetFromAddress=u.budgetFromAddress;exports.ManagedBudget=t.ManagedBudget;exports.ManagedBudgetRoles=t.ManagedBudgetRoles;exports.isERC1155TransferPayload=t.isERC1155TransferPayload;exports.isFungibleTransfer=t.isFungibleTransfer;exports.prepareManagedBudgetPayload=t.prepareManagedBudgetPayload;exports.prepareTransfer=t.prepareTransfer;exports.Deployable=R.Deployable;exports.Contract=m.Contract;exports.DeployableTarget=B.DeployableTarget;exports.DeployableTargetWithRBAC=C.DeployableTargetWithRBAC;exports.Roles=C.Roles;exports.AllowListIncentive=g.AllowListIncentive;exports.prepareAllowListIncentivePayload=g.prepareAllowListIncentivePayload;exports.CGDAIncentive=I.CGDAIncentive;exports.prepareCGDAIncentivePayload=I.prepareCGDAIncentivePayload;exports.ERC20Incentive=v.ERC20Incentive;exports.prepareERC20IncentivePayload=v.prepareERC20IncentivePayload;exports.ERC20VariableIncentive=l.ERC20VariableIncentive;exports.IncentiveByComponentInterface=l.IncentiveByComponentInterface;exports.incentiveFromAddress=l.incentiveFromAddress;exports.prepareERC20VariableIncentivePayload=l.prepareERC20VariableIncentivePayload;exports.PointsIncentive=P.PointsIncentive;exports.preparePointsIncentivePayload=P.preparePointsIncentivePayload;exports.SignerValidator=d.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=d.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=d.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=d.prepareSignerValidatorPayload;exports.ValidatorByComponentInterface=S.ValidatorByComponentInterface;exports.validatorFromAddress=S.validatorFromAddress;exports.BoostCoreNoIdentifierEmitted=e.BoostCoreNoIdentifierEmitted;exports.BoostNotFoundError=e.BoostNotFoundError;exports.BudgetMustAuthorizeBoostCore=e.BudgetMustAuthorizeBoostCore;exports.ContractAddressRequiredError=e.ContractAddressRequiredError;exports.DecodedArgsError=e.DecodedArgsError;exports.DecodedArgsMalformedError=e.DecodedArgsMalformedError;exports.DeployableAlreadyDeployedError=e.DeployableAlreadyDeployedError;exports.DeployableBuildParametersUnspecifiedError=e.DeployableBuildParametersUnspecifiedError;exports.DeployableMissingPayloadError=e.DeployableMissingPayloadError;exports.DeployableUnknownOwnerProvidedError=e.DeployableUnknownOwnerProvidedError;exports.DeployableWagmiConfigurationRequiredError=e.DeployableWagmiConfigurationRequiredError;exports.FieldActionValidationError=e.FieldActionValidationError;exports.FieldValueNotComparableError=e.FieldValueNotComparableError;exports.FieldValueUndefinedError=e.FieldValueUndefinedError;exports.FunctionDataDecodeError=e.FunctionDataDecodeError;exports.IncentiveCriteriaNotFoundError=e.IncentiveCriteriaNotFoundError;exports.IncentiveNotCloneableError=e.IncentiveNotCloneableError;exports.InvalidComponentInterfaceError=e.InvalidComponentInterfaceError;exports.InvalidCriteriaTypeError=e.InvalidCriteriaTypeError;exports.InvalidNumericalCriteriaError=e.InvalidNumericalCriteriaError;exports.InvalidProtocolChainIdError=e.InvalidProtocolChainIdError;exports.MustInitializeBudgetError=e.MustInitializeBudgetError;exports.NoConnectedChainIdError=e.NoConnectedChainIdError;exports.NoContractAddressUponReceiptError=e.NoContractAddressUponReceiptError;exports.NoEventActionStepsProvidedError=e.NoEventActionStepsProvidedError;exports.NoMatchingLogsError=e.NoMatchingLogsError;exports.TooManyEventActionStepsProvidedError=e.TooManyEventActionStepsProvidedError;exports.UnknownTransferPayloadSupplied=e.UnknownTransferPayloadSupplied;exports.UnparseableAbiParamError=e.UnparseableAbiParamError;exports.UnrecognizedFilterTypeError=e.UnrecognizedFilterTypeError;exports.ValidationAbiMissingError=e.ValidationAbiMissingError;exports.RegistryType=n.RegistryType;exports.assertValidAddressByChainId=n.assertValidAddressByChainId;exports.awaitResult=n.awaitResult;exports.bytes4=n.bytes4;exports.getDeployedContractAddress=n.getDeployedContractAddress;exports.StrategyType=b.StrategyType;exports.prepareClaimPayload=b.prepareClaimPayload;exports.AssetType=i.AssetType;exports.prepareERC1155Payload=i.prepareERC1155Payload;exports.prepareERC1155Transfer=i.prepareERC1155Transfer;exports.prepareFungiblePayload=i.prepareFungiblePayload;exports.prepareFungibleTransfer=i.prepareFungibleTransfer;exports.prepareTransferPayload=i.prepareTransferPayload;exports.PassthroughAuth=D.PassthroughAuth;exports.allowListIncentiveAbi=r.O;exports.boostCoreAbi=r.T;exports.boostRegistryAbi=r.ie;exports.cgdaIncentiveAbi=r.b;exports.erc20IncentiveAbi=r.y;exports.erc20VariableIncentiveAbi=r.f;exports.managedBudgetAbi=r.d;exports.passthroughAuthAbi=r.Be;exports.pointsIncentiveAbi=r.w;exports.rbacAbi=r.R;exports.signerValidatorAbi=r.B;exports.simpleAllowListAbi=r.h;exports.simpleDenyListAbi=r.g;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -11,15 +11,20 @@ export * from './Budgets/ManagedBudget';
|
|
|
11
11
|
export * from './Deployable/Deployable';
|
|
12
12
|
export * from './Deployable/Contract';
|
|
13
13
|
export * from './Deployable/DeployableTarget';
|
|
14
|
+
export * from './Deployable/DeployableTargetWithRBAC';
|
|
14
15
|
export * from './Incentives/AllowListIncentive';
|
|
15
16
|
export * from './Incentives/CGDAIncentive';
|
|
16
17
|
export * from './Incentives/ERC20Incentive';
|
|
18
|
+
export * from './Incentives/ERC20VariableIncentive';
|
|
19
|
+
export * from './Incentives/ERC20VariableCriteriaIncentive';
|
|
17
20
|
export * from './Incentives/Incentive';
|
|
18
21
|
export * from './Incentives/PointsIncentive';
|
|
19
22
|
export * from './Validators/SignerValidator';
|
|
20
23
|
export * from './Validators/Validator';
|
|
21
24
|
export * from './errors';
|
|
22
25
|
export * from './utils';
|
|
26
|
+
export * from './claiming';
|
|
27
|
+
export * from './transfers';
|
|
23
28
|
export * from './Auth/Auth';
|
|
24
29
|
export * from './Auth/PassthroughAuth';
|
|
25
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AAIxB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,uBAAuB,CAAC;AAItC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAI5C,cAAc,kBAAkB,CAAC;AAGjC,cAAc,yBAAyB,CAAC;AAIxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AAIxB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,uBAAuB,CAAC;AAItC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAI5C,cAAc,kBAAkB,CAAC;AAGjC,cAAc,yBAAyB,CAAC;AAIxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,CAAC;AAItD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAE5D,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAI7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AAIvC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAI5B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,113 +1,147 @@
|
|
|
1
|
-
import { BOOST_REGISTRY_ADDRESS as o, BoostRegistry as t } from "./BoostRegistry.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Boost as
|
|
4
|
-
import { ActionByComponentInterface as
|
|
5
|
-
import { EventAction as
|
|
6
|
-
import { AllowListByComponentInterface as
|
|
7
|
-
import { LIST_MANAGER_ROLE as
|
|
8
|
-
import {
|
|
9
|
-
import { BudgetByComponentInterface as
|
|
10
|
-
import { ManagedBudget as
|
|
11
|
-
import { Deployable as
|
|
12
|
-
import { Contract as
|
|
13
|
-
import { DeployableTarget as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
1
|
+
import { BOOST_REGISTRY_ADDRESS as o, BOOST_REGISTRY_ADDRESSES as a, BoostRegistry as t } from "./BoostRegistry.js";
|
|
2
|
+
import { b as n, a as p, B as s, c as l, E as d, p as E } from "./BoostCore-CD56zbYX.js";
|
|
3
|
+
import { Boost as y, prepareBoostPayload as c } from "./Boost.js";
|
|
4
|
+
import { ActionByComponentInterface as f, actionFromAddress as C } from "./Actions/Action.js";
|
|
5
|
+
import { EventAction as g, FilterType as I, PrimitiveType as v, SignatureType as P, anyActionParameter as R, isEventActionPayloadSimple as S, prepareEventActionPayload as u } from "./Actions/EventAction.js";
|
|
6
|
+
import { AllowListByComponentInterface as D, OpenAllowList as x, allowListFromAddress as T } from "./AllowLists/AllowList.js";
|
|
7
|
+
import { LIST_MANAGER_ROLE as O, SimpleAllowList as L, prepareSimpleAllowListPayload as V } from "./AllowLists/SimpleAllowList.js";
|
|
8
|
+
import { S as h, p as _ } from "./SimpleDenyList-BDXpY74P.js";
|
|
9
|
+
import { BudgetByComponentInterface as N, budgetFromAddress as U } from "./Budgets/Budget.js";
|
|
10
|
+
import { ManagedBudget as z, ManagedBudgetRoles as k, isERC1155TransferPayload as q, isFungibleTransfer as W, prepareManagedBudgetPayload as Y, prepareTransfer as j } from "./Budgets/ManagedBudget.js";
|
|
11
|
+
import { Deployable as J } from "./Deployable/Deployable.js";
|
|
12
|
+
import { Contract as Q } from "./Deployable/Contract.js";
|
|
13
|
+
import { DeployableTarget as Z } from "./Deployable/DeployableTarget.js";
|
|
14
|
+
import { DeployableTargetWithRBAC as ee, Roles as re } from "./Deployable/DeployableTargetWithRBAC.js";
|
|
15
|
+
import { AllowListIncentive as ae, prepareAllowListIncentivePayload as te } from "./Incentives/AllowListIncentive.js";
|
|
16
|
+
import { CGDAIncentive as ne, prepareCGDAIncentivePayload as pe } from "./Incentives/CGDAIncentive.js";
|
|
17
|
+
import { ERC20Incentive as le, prepareERC20IncentivePayload as de } from "./Incentives/ERC20Incentive.js";
|
|
18
|
+
import { E as me, I as ye, i as ce, p as Ae } from "./Incentive-rM5nKznp.js";
|
|
19
|
+
import { PointsIncentive as Ce, preparePointsIncentivePayload as be } from "./Incentives/PointsIncentive.js";
|
|
20
|
+
import { SignerValidator as Ie, prepareSignerValidatorClaimDataPayload as ve, prepareSignerValidatorInputParams as Pe, prepareSignerValidatorPayload as Re } from "./Validators/SignerValidator.js";
|
|
21
|
+
import { ValidatorByComponentInterface as ue, validatorFromAddress as Be } from "./Validators/Validator.js";
|
|
22
|
+
import { BoostCoreNoIdentifierEmitted as xe, BoostNotFoundError as Te, BudgetMustAuthorizeBoostCore as Fe, ContractAddressRequiredError as Oe, DecodedArgsError as Le, DecodedArgsMalformedError as Ve, DeployableAlreadyDeployedError as we, DeployableBuildParametersUnspecifiedError as he, DeployableMissingPayloadError as _e, DeployableUnknownOwnerProvidedError as Me, DeployableWagmiConfigurationRequiredError as Ne, FieldActionValidationError as Ue, FieldValueNotComparableError as Ge, FieldValueUndefinedError as ze, FunctionDataDecodeError as ke, IncentiveCriteriaNotFoundError as qe, IncentiveNotCloneableError as We, InvalidComponentInterfaceError as Ye, InvalidCriteriaTypeError as je, InvalidNumericalCriteriaError as He, InvalidProtocolChainIdError as Je, MustInitializeBudgetError as Ke, NoConnectedChainIdError as Qe, NoContractAddressUponReceiptError as Xe, NoEventActionStepsProvidedError as Ze, NoMatchingLogsError as $e, TooManyEventActionStepsProvidedError as er, UnknownTransferPayloadSupplied as rr, UnparseableAbiParamError as or, UnrecognizedFilterTypeError as ar, ValidationAbiMissingError as tr } from "./errors.js";
|
|
23
|
+
import { RegistryType as nr, assertValidAddressByChainId as pr, awaitResult as sr, bytes4 as lr, getDeployedContractAddress as dr } from "./utils.js";
|
|
24
|
+
import { StrategyType as mr, prepareClaimPayload as yr } from "./claiming.js";
|
|
25
|
+
import { AssetType as Ar, prepareERC1155Payload as fr, prepareERC1155Transfer as Cr, prepareFungiblePayload as br, prepareFungibleTransfer as gr, prepareTransferPayload as Ir } from "./transfers.js";
|
|
26
|
+
import { PassthroughAuth as Pr } from "./Auth/PassthroughAuth.js";
|
|
27
|
+
import { O as Sr, T as ur, i as Br, b as Dr, y as xr, f as Tr, d as Fr, a as Or, w as Lr, R as Vr, B as wr, h as hr, g as _r } from "./generated-CsNyWPKA.js";
|
|
25
28
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
n as
|
|
29
|
+
f as ActionByComponentInterface,
|
|
30
|
+
D as AllowListByComponentInterface,
|
|
31
|
+
ae as AllowListIncentive,
|
|
32
|
+
Ar as AssetType,
|
|
33
|
+
n as BOOST_CORE_ADDRESS,
|
|
34
|
+
p as BOOST_CORE_ADDRESSES,
|
|
35
|
+
s as BOOST_CORE_CLAIM_FEE,
|
|
31
36
|
o as BOOST_REGISTRY_ADDRESS,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
a as BOOST_REGISTRY_ADDRESSES,
|
|
38
|
+
y as Boost,
|
|
39
|
+
l as BoostCore,
|
|
40
|
+
xe as BoostCoreNoIdentifierEmitted,
|
|
41
|
+
Te as BoostNotFoundError,
|
|
35
42
|
t as BoostRegistry,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
ee as
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
U as
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
43
|
+
N as BudgetByComponentInterface,
|
|
44
|
+
Fe as BudgetMustAuthorizeBoostCore,
|
|
45
|
+
ne as CGDAIncentive,
|
|
46
|
+
Q as Contract,
|
|
47
|
+
Oe as ContractAddressRequiredError,
|
|
48
|
+
Le as DecodedArgsError,
|
|
49
|
+
Ve as DecodedArgsMalformedError,
|
|
50
|
+
J as Deployable,
|
|
51
|
+
we as DeployableAlreadyDeployedError,
|
|
52
|
+
he as DeployableBuildParametersUnspecifiedError,
|
|
53
|
+
_e as DeployableMissingPayloadError,
|
|
54
|
+
Z as DeployableTarget,
|
|
55
|
+
ee as DeployableTargetWithRBAC,
|
|
56
|
+
Me as DeployableUnknownOwnerProvidedError,
|
|
57
|
+
Ne as DeployableWagmiConfigurationRequiredError,
|
|
58
|
+
le as ERC20Incentive,
|
|
59
|
+
d as ERC20VariableCriteriaIncentive,
|
|
60
|
+
me as ERC20VariableIncentive,
|
|
61
|
+
g as EventAction,
|
|
62
|
+
Ue as FieldActionValidationError,
|
|
63
|
+
Ge as FieldValueNotComparableError,
|
|
64
|
+
ze as FieldValueUndefinedError,
|
|
65
|
+
I as FilterType,
|
|
66
|
+
ke as FunctionDataDecodeError,
|
|
67
|
+
ye as IncentiveByComponentInterface,
|
|
68
|
+
qe as IncentiveCriteriaNotFoundError,
|
|
69
|
+
We as IncentiveNotCloneableError,
|
|
70
|
+
Ye as InvalidComponentInterfaceError,
|
|
71
|
+
je as InvalidCriteriaTypeError,
|
|
72
|
+
He as InvalidNumericalCriteriaError,
|
|
73
|
+
Je as InvalidProtocolChainIdError,
|
|
74
|
+
O as LIST_MANAGER_ROLE,
|
|
75
|
+
z as ManagedBudget,
|
|
76
|
+
k as ManagedBudgetRoles,
|
|
77
|
+
Ke as MustInitializeBudgetError,
|
|
78
|
+
Qe as NoConnectedChainIdError,
|
|
79
|
+
Xe as NoContractAddressUponReceiptError,
|
|
80
|
+
Ze as NoEventActionStepsProvidedError,
|
|
81
|
+
$e as NoMatchingLogsError,
|
|
82
|
+
x as OpenAllowList,
|
|
83
|
+
Pr as PassthroughAuth,
|
|
84
|
+
Ce as PointsIncentive,
|
|
85
|
+
v as PrimitiveType,
|
|
86
|
+
nr as RegistryType,
|
|
87
|
+
re as Roles,
|
|
88
|
+
P as SignatureType,
|
|
89
|
+
Ie as SignerValidator,
|
|
90
|
+
L as SimpleAllowList,
|
|
91
|
+
h as SimpleDenyList,
|
|
92
|
+
mr as StrategyType,
|
|
93
|
+
er as TooManyEventActionStepsProvidedError,
|
|
94
|
+
rr as UnknownTransferPayloadSupplied,
|
|
95
|
+
or as UnparseableAbiParamError,
|
|
96
|
+
ar as UnrecognizedFilterTypeError,
|
|
97
|
+
tr as ValidationAbiMissingError,
|
|
98
|
+
ue as ValidatorByComponentInterface,
|
|
99
|
+
C as actionFromAddress,
|
|
100
|
+
T as allowListFromAddress,
|
|
101
|
+
Sr as allowListIncentiveAbi,
|
|
102
|
+
R as anyActionParameter,
|
|
103
|
+
pr as assertValidAddressByChainId,
|
|
104
|
+
sr as awaitResult,
|
|
105
|
+
ur as boostCoreAbi,
|
|
106
|
+
Br as boostRegistryAbi,
|
|
107
|
+
U as budgetFromAddress,
|
|
108
|
+
lr as bytes4,
|
|
109
|
+
Dr as cgdaIncentiveAbi,
|
|
110
|
+
xr as erc20IncentiveAbi,
|
|
111
|
+
Tr as erc20VariableIncentiveAbi,
|
|
112
|
+
dr as getDeployedContractAddress,
|
|
113
|
+
ce as incentiveFromAddress,
|
|
114
|
+
q as isERC1155TransferPayload,
|
|
115
|
+
S as isEventActionPayloadSimple,
|
|
116
|
+
W as isFungibleTransfer,
|
|
117
|
+
Fr as managedBudgetAbi,
|
|
118
|
+
Or as passthroughAuthAbi,
|
|
119
|
+
Lr as pointsIncentiveAbi,
|
|
120
|
+
te as prepareAllowListIncentivePayload,
|
|
121
|
+
c as prepareBoostPayload,
|
|
122
|
+
pe as prepareCGDAIncentivePayload,
|
|
123
|
+
yr as prepareClaimPayload,
|
|
124
|
+
fr as prepareERC1155Payload,
|
|
125
|
+
Cr as prepareERC1155Transfer,
|
|
126
|
+
de as prepareERC20IncentivePayload,
|
|
127
|
+
E as prepareERC20VariableCriteriaIncentivePayload,
|
|
128
|
+
Ae as prepareERC20VariableIncentivePayload,
|
|
129
|
+
u as prepareEventActionPayload,
|
|
130
|
+
br as prepareFungiblePayload,
|
|
131
|
+
gr as prepareFungibleTransfer,
|
|
132
|
+
Y as prepareManagedBudgetPayload,
|
|
133
|
+
be as preparePointsIncentivePayload,
|
|
134
|
+
ve as prepareSignerValidatorClaimDataPayload,
|
|
135
|
+
Pe as prepareSignerValidatorInputParams,
|
|
136
|
+
Re as prepareSignerValidatorPayload,
|
|
137
|
+
V as prepareSimpleAllowListPayload,
|
|
138
|
+
_ as prepareSimpleDenyListPayload,
|
|
139
|
+
j as prepareTransfer,
|
|
140
|
+
Ir as prepareTransferPayload,
|
|
141
|
+
Vr as rbacAbi,
|
|
142
|
+
wr as signerValidatorAbi,
|
|
143
|
+
hr as simpleAllowListAbi,
|
|
144
|
+
_r as simpleDenyListAbi,
|
|
145
|
+
Be as validatorFromAddress
|
|
112
146
|
};
|
|
113
147
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/transfers.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfers.cjs","sources":["../src/transfers.ts"],"sourcesContent":["import {\n type Address,\n type Hex,\n encodeAbiParameters,\n parseAbiParameters,\n zeroAddress,\n} from 'viem';\n\n/**\n * The various types of assets supported in Budgets and Incentives.\n *\n * @export\n * @enum {number}\n */\nexport enum AssetType {\n ETH,\n ERC20,\n ERC1155,\n}\n\n/**\n * Object representation of a generic `Transfer` struct.\n *\n * @export\n * @interface TransferPayload\n * @typedef {TransferPayload}\n */\nexport interface TransferPayload {\n /**\n * The type of the asset being transferred.\n *\n * @type {AssetType}\n */\n assetType: AssetType;\n /**\n * The address of the asset to transfer, zero address for ETH.\n *\n * @type {Address}\n */\n address: Address;\n /**\n * The account from which to transfer the assets.\n *\n * @type {Address}\n */\n target: Address;\n /**\n * An encoded {@link FungiblePayload}, use {@link prepareFungiblePayload} to construct.\n *\n * @type {Hex}\n */\n data: Hex;\n}\n\n/**\n * Encodes parameters for transferring the transfer of Fungible and ERC1155 assets, used for {@link Budget} operations.\n * Typically you'd use {@link prepareFungibleTransfer} or {@link prepareERC1155Transfer}\n *\n * @param {TransferPayload} param0\n * @param {AssetType} param0.assetType - The asset type being transferred.\n * @param {Address} param0.address - The address of the asset, use zero address for ETH transfers.\n * @param {Address} param0.target - The address of the account being transferred from\n * @param {Hex} param0.data - Use {@link prepareFungiblePayload} to properly encode an amount to transfer\n * @returns {Hex}\n */\nexport const prepareTransferPayload = ({\n assetType,\n address,\n target,\n data,\n}: TransferPayload) => {\n return encodeAbiParameters(\n [\n { type: 'uint8', name: 'assetType' },\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'target' },\n { type: 'bytes', name: 'data' },\n ],\n [assetType, address, target, data],\n );\n};\n\n/**\n * Object representation of\n *\n * @export\n * @interface ERC1155Payload\n * @typedef {ERC1155Payload}\n */\nexport interface ERC1155Payload {\n /**\n * The ERC1155 token ID for the incentive\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n}\n\n/**\n * Given a token ID and amount, properly encode a `ERC1155Incentive.ERC1155Payload` for use with {@link ERC1155Incentive} initialization.\n *\n * @export\n * @param {ERC1155Payload} param0\n * @param {bigint} param0.tokenId - The ERC1155 token ID for the incentive\n * @param {bigint} param0.amount - The amount to transfer\n * @returns {Hex}\n */\nexport function prepareERC1155Payload({ tokenId, amount }: ERC1155Payload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'ERC1155Payload payload',\n 'struct ERC1155Payload { uint256 tokenId; uint256 amount; bytes data; }',\n ]),\n [{ tokenId, amount, data: '0x' }],\n );\n}\n\n/**\n * An object representation of the `Budget.Transfer` contract struct for transfers of ERC1155 assets.\n *\n * @export\n * @interface ERC1155TransferPayload\n * @typedef {ERC1155TransferPayload}\n */\nexport interface ERC1155TransferPayload {\n /**\n * The token ID to transfer\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n /**\n * The address of the asset to target\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The account to transfer from\n *\n * @type {Address}\n */\n target: Address;\n}\n\n/**\n * Encodes parameters for transferring the transfer of ERC1155 assets, used for {@link Budget} operations.\n * The caller must have already approved the contract to transfer the asset.\n *\n * @export\n * @param {ERC1155TransferPayload} param0\n * @param {bigint} param0.tokenId - The token ID to transfer\n * @param {bigint} param0.amount - The amount to transfer\n * @param {Address} param0.asset - The address of the asset to target\n * @param {Address} param0.target - The account to transfer from\n * @returns {Hex}\n */\nexport function prepareERC1155Transfer({\n tokenId,\n amount,\n asset,\n target,\n}: ERC1155TransferPayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'Transfer request',\n 'struct Transfer { uint8 assetType; address asset; address target; bytes data; }',\n ]),\n [\n {\n assetType: AssetType.ERC1155,\n asset,\n data: prepareERC1155Payload({ tokenId, amount }),\n target,\n },\n ],\n );\n}\n\n/**\n * An object representation of the `FungiblePayload` struct\n *\n * @export\n * @interface FungiblePayload\n * @typedef {FungiblePayload}\n */\nexport interface FungiblePayload {\n /**\n * The amount being transferred\n *\n * @type {bigint}\n */\n amount: bigint;\n}\n\n/**\n * Encodes an amount for the `FungiblePayload` struct\n *\n * @export\n * @param {FungiblePayload} param0\n * @param {bigint} param0.amount - The amount being transferred\n * @returns {
|
|
1
|
+
{"version":3,"file":"transfers.cjs","sources":["../src/transfers.ts"],"sourcesContent":["import {\n type Address,\n type Hex,\n encodeAbiParameters,\n parseAbiParameters,\n zeroAddress,\n} from 'viem';\n\n/**\n * The various types of assets supported in Budgets and Incentives.\n *\n * @export\n * @enum {number}\n */\nexport enum AssetType {\n ETH,\n ERC20,\n ERC1155,\n}\n\n/**\n * Object representation of a generic `Transfer` struct.\n *\n * @export\n * @interface TransferPayload\n * @typedef {TransferPayload}\n */\nexport interface TransferPayload {\n /**\n * The type of the asset being transferred.\n *\n * @type {AssetType}\n */\n assetType: AssetType;\n /**\n * The address of the asset to transfer, zero address for ETH.\n *\n * @type {Address}\n */\n address: Address;\n /**\n * The account from which to transfer the assets.\n *\n * @type {Address}\n */\n target: Address;\n /**\n * An encoded {@link FungiblePayload}, use {@link prepareFungiblePayload} to construct.\n *\n * @type {Hex}\n */\n data: Hex;\n}\n\n/**\n * Encodes parameters for transferring the transfer of Fungible and ERC1155 assets, used for {@link Budget} operations.\n * Typically you'd use {@link prepareFungibleTransfer} or {@link prepareERC1155Transfer}\n *\n * @param {TransferPayload} param0\n * @param {AssetType} param0.assetType - The asset type being transferred.\n * @param {Address} param0.address - The address of the asset, use zero address for ETH transfers.\n * @param {Address} param0.target - The address of the account being transferred from\n * @param {Hex} param0.data - Use {@link prepareFungiblePayload} to properly encode an amount to transfer\n * @returns {Hex}\n */\nexport const prepareTransferPayload = ({\n assetType,\n address,\n target,\n data,\n}: TransferPayload) => {\n return encodeAbiParameters(\n [\n { type: 'uint8', name: 'assetType' },\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'target' },\n { type: 'bytes', name: 'data' },\n ],\n [assetType, address, target, data],\n );\n};\n\n/**\n * Object representation of\n *\n * @export\n * @interface ERC1155Payload\n * @typedef {ERC1155Payload}\n */\nexport interface ERC1155Payload {\n /**\n * The ERC1155 token ID for the incentive\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n}\n\n/**\n * Given a token ID and amount, properly encode a `ERC1155Incentive.ERC1155Payload` for use with {@link ERC1155Incentive} initialization.\n *\n * @export\n * @param {ERC1155Payload} param0\n * @param {bigint} param0.tokenId - The ERC1155 token ID for the incentive\n * @param {bigint} param0.amount - The amount to transfer\n * @returns {Hex}\n */\nexport function prepareERC1155Payload({ tokenId, amount }: ERC1155Payload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'ERC1155Payload payload',\n 'struct ERC1155Payload { uint256 tokenId; uint256 amount; bytes data; }',\n ]),\n [{ tokenId, amount, data: '0x' }],\n );\n}\n\n/**\n * An object representation of the `Budget.Transfer` contract struct for transfers of ERC1155 assets.\n *\n * @export\n * @interface ERC1155TransferPayload\n * @typedef {ERC1155TransferPayload}\n */\nexport interface ERC1155TransferPayload {\n /**\n * The token ID to transfer\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n /**\n * The address of the asset to target\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The account to transfer from\n *\n * @type {Address}\n */\n target: Address;\n}\n\n/**\n * Encodes parameters for transferring the transfer of ERC1155 assets, used for {@link Budget} operations.\n * The caller must have already approved the contract to transfer the asset.\n *\n * @export\n * @param {ERC1155TransferPayload} param0\n * @param {bigint} param0.tokenId - The token ID to transfer\n * @param {bigint} param0.amount - The amount to transfer\n * @param {Address} param0.asset - The address of the asset to target\n * @param {Address} param0.target - The account to transfer from\n * @returns {Hex}\n */\nexport function prepareERC1155Transfer({\n tokenId,\n amount,\n asset,\n target,\n}: ERC1155TransferPayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'Transfer request',\n 'struct Transfer { uint8 assetType; address asset; address target; bytes data; }',\n ]),\n [\n {\n assetType: AssetType.ERC1155,\n asset,\n data: prepareERC1155Payload({ tokenId, amount }),\n target,\n },\n ],\n );\n}\n\n/**\n * An object representation of the `FungiblePayload` struct\n *\n * @export\n * @interface FungiblePayload\n * @typedef {FungiblePayload}\n */\nexport interface FungiblePayload {\n /**\n * The amount being transferred\n *\n * @type {bigint}\n */\n amount: bigint;\n}\n\n/**\n * Encodes an amount for the `FungiblePayload` struct\n *\n * @export\n * @param {FungiblePayload} param0\n * @param {bigint} param0.amount - The amount being transferred\n * @returns {Hex}\n */\nexport function prepareFungiblePayload({ amount }: FungiblePayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'FungiblePayload payload',\n 'struct FungiblePayload { uint256 amount; }',\n ]),\n [{ amount }],\n );\n}\n\n/**\n * An object representation of the `Budget.Transfer` contract struct for transfers of fungible assets.\n *\n * @export\n * @interface FungibleTransferPayload\n * @typedef {FungibleTransferPayload}\n */\nexport interface FungibleTransferPayload {\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n /**\n * The address of the asset. Use zero address for ETH transfers.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The account to transfer from\n *\n * @type {Address}\n */\n target: Address;\n}\n\n/**\n * Encodes parameters for a Fungible transfer, used for Budget allocations.\n * The caller must have already approved the contract to transfer the asset.\n *\n * @export\n * @param {FungibleTransferPayload} param0\n * @param {bigint} param0.amount - The amount to transfer\n * @param {Address} param0.asset - The address of the asset. Use zero address for ETH transfers.\n * @param {Address} param0.target - The account to transfer from\n * @returns {Hex}\n */\nexport function prepareFungibleTransfer({\n amount,\n asset,\n target,\n}: FungibleTransferPayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'Transfer request',\n 'struct Transfer { uint8 assetType; address asset; address target; bytes data; }',\n ]),\n [\n {\n assetType: asset == zeroAddress ? AssetType.ETH : AssetType.ERC20,\n asset,\n data: prepareFungiblePayload({ amount }),\n target,\n },\n ],\n );\n}\n"],"names":["AssetType","AssetType2","prepareTransferPayload","assetType","address","target","data","encodeAbiParameters","prepareERC1155Payload","tokenId","amount","parseAbiParameters","prepareERC1155Transfer","asset","prepareFungiblePayload","prepareFungibleTransfer","zeroAddress"],"mappings":"wGAcY,IAAAA,GAAAA,IACVA,EAAAC,EAAA,IAAA,CAAA,EAAA,MACAD,EAAAC,EAAA,MAAA,CAAA,EAAA,QACAD,EAAAC,EAAA,QAAA,CAAA,EAAA,UAHUD,IAAAA,GAAA,CAAA,CAAA,EAmDL,MAAME,EAAyB,CAAC,CACrC,UAAAC,EACA,QAAAC,EACA,OAAAC,EACA,KAAAC,CACF,IACSC,EAAA,oBACL,CACE,CAAE,KAAM,QAAS,KAAM,WAAY,EACnC,CAAE,KAAM,UAAW,KAAM,OAAQ,EACjC,CAAE,KAAM,UAAW,KAAM,QAAS,EAClC,CAAE,KAAM,QAAS,KAAM,MAAO,CAChC,EACA,CAACJ,EAAWC,EAASC,EAAQC,CAAI,CAAA,EAmC9B,SAASE,EAAsB,CAAE,QAAAC,EAAS,OAAAC,GAA0B,CAClE,OAAAH,EAAA,oBACLI,qBAAmB,CACjB,yBACA,wEAAA,CACD,EACD,CAAC,CAAE,QAAAF,EAAS,OAAAC,EAAQ,KAAM,KAAM,CAAA,CAEpC,CAgDO,SAASE,EAAuB,CACrC,QAAAH,EACA,OAAAC,EACA,MAAAG,EACA,OAAAR,CACF,EAA2B,CAClB,OAAAE,EAAA,oBACLI,qBAAmB,CACjB,mBACA,iFAAA,CACD,EACD,CACE,CACE,UAAW,EACX,MAAAE,EACA,KAAML,EAAsB,CAAE,QAAAC,EAAS,OAAAC,EAAQ,EAC/C,OAAAL,CACF,CACF,CAAA,CAEJ,CA0BgB,SAAAS,EAAuB,CAAE,OAAAJ,GAA2B,CAC3D,OAAAH,EAAA,oBACLI,qBAAmB,CACjB,0BACA,4CAAA,CACD,EACD,CAAC,CAAE,OAAAD,CAAA,CAAQ,CAAA,CAEf,CAyCO,SAASK,EAAwB,CACtC,OAAAL,EACA,MAAAG,EACA,OAAAR,CACF,EAA4B,CACnB,OAAAE,EAAA,oBACLI,qBAAmB,CACjB,mBACA,iFAAA,CACD,EACD,CACE,CACE,UAAWE,GAASG,cAAc,EAAgB,EAClD,MAAAH,EACA,KAAMC,EAAuB,CAAE,OAAAJ,EAAQ,EACvC,OAAAL,CACF,CACF,CAAA,CAEJ"}
|
package/dist/transfers.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ export interface FungiblePayload {
|
|
|
153
153
|
* @export
|
|
154
154
|
* @param {FungiblePayload} param0
|
|
155
155
|
* @param {bigint} param0.amount - The amount being transferred
|
|
156
|
-
* @returns {
|
|
156
|
+
* @returns {Hex}
|
|
157
157
|
*/
|
|
158
158
|
export declare function prepareFungiblePayload({ amount }: FungiblePayload): `0x${string}`;
|
|
159
159
|
/**
|
package/dist/transfers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfers.js","sources":["../src/transfers.ts"],"sourcesContent":["import {\n type Address,\n type Hex,\n encodeAbiParameters,\n parseAbiParameters,\n zeroAddress,\n} from 'viem';\n\n/**\n * The various types of assets supported in Budgets and Incentives.\n *\n * @export\n * @enum {number}\n */\nexport enum AssetType {\n ETH,\n ERC20,\n ERC1155,\n}\n\n/**\n * Object representation of a generic `Transfer` struct.\n *\n * @export\n * @interface TransferPayload\n * @typedef {TransferPayload}\n */\nexport interface TransferPayload {\n /**\n * The type of the asset being transferred.\n *\n * @type {AssetType}\n */\n assetType: AssetType;\n /**\n * The address of the asset to transfer, zero address for ETH.\n *\n * @type {Address}\n */\n address: Address;\n /**\n * The account from which to transfer the assets.\n *\n * @type {Address}\n */\n target: Address;\n /**\n * An encoded {@link FungiblePayload}, use {@link prepareFungiblePayload} to construct.\n *\n * @type {Hex}\n */\n data: Hex;\n}\n\n/**\n * Encodes parameters for transferring the transfer of Fungible and ERC1155 assets, used for {@link Budget} operations.\n * Typically you'd use {@link prepareFungibleTransfer} or {@link prepareERC1155Transfer}\n *\n * @param {TransferPayload} param0\n * @param {AssetType} param0.assetType - The asset type being transferred.\n * @param {Address} param0.address - The address of the asset, use zero address for ETH transfers.\n * @param {Address} param0.target - The address of the account being transferred from\n * @param {Hex} param0.data - Use {@link prepareFungiblePayload} to properly encode an amount to transfer\n * @returns {Hex}\n */\nexport const prepareTransferPayload = ({\n assetType,\n address,\n target,\n data,\n}: TransferPayload) => {\n return encodeAbiParameters(\n [\n { type: 'uint8', name: 'assetType' },\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'target' },\n { type: 'bytes', name: 'data' },\n ],\n [assetType, address, target, data],\n );\n};\n\n/**\n * Object representation of\n *\n * @export\n * @interface ERC1155Payload\n * @typedef {ERC1155Payload}\n */\nexport interface ERC1155Payload {\n /**\n * The ERC1155 token ID for the incentive\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n}\n\n/**\n * Given a token ID and amount, properly encode a `ERC1155Incentive.ERC1155Payload` for use with {@link ERC1155Incentive} initialization.\n *\n * @export\n * @param {ERC1155Payload} param0\n * @param {bigint} param0.tokenId - The ERC1155 token ID for the incentive\n * @param {bigint} param0.amount - The amount to transfer\n * @returns {Hex}\n */\nexport function prepareERC1155Payload({ tokenId, amount }: ERC1155Payload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'ERC1155Payload payload',\n 'struct ERC1155Payload { uint256 tokenId; uint256 amount; bytes data; }',\n ]),\n [{ tokenId, amount, data: '0x' }],\n );\n}\n\n/**\n * An object representation of the `Budget.Transfer` contract struct for transfers of ERC1155 assets.\n *\n * @export\n * @interface ERC1155TransferPayload\n * @typedef {ERC1155TransferPayload}\n */\nexport interface ERC1155TransferPayload {\n /**\n * The token ID to transfer\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n /**\n * The address of the asset to target\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The account to transfer from\n *\n * @type {Address}\n */\n target: Address;\n}\n\n/**\n * Encodes parameters for transferring the transfer of ERC1155 assets, used for {@link Budget} operations.\n * The caller must have already approved the contract to transfer the asset.\n *\n * @export\n * @param {ERC1155TransferPayload} param0\n * @param {bigint} param0.tokenId - The token ID to transfer\n * @param {bigint} param0.amount - The amount to transfer\n * @param {Address} param0.asset - The address of the asset to target\n * @param {Address} param0.target - The account to transfer from\n * @returns {Hex}\n */\nexport function prepareERC1155Transfer({\n tokenId,\n amount,\n asset,\n target,\n}: ERC1155TransferPayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'Transfer request',\n 'struct Transfer { uint8 assetType; address asset; address target; bytes data; }',\n ]),\n [\n {\n assetType: AssetType.ERC1155,\n asset,\n data: prepareERC1155Payload({ tokenId, amount }),\n target,\n },\n ],\n );\n}\n\n/**\n * An object representation of the `FungiblePayload` struct\n *\n * @export\n * @interface FungiblePayload\n * @typedef {FungiblePayload}\n */\nexport interface FungiblePayload {\n /**\n * The amount being transferred\n *\n * @type {bigint}\n */\n amount: bigint;\n}\n\n/**\n * Encodes an amount for the `FungiblePayload` struct\n *\n * @export\n * @param {FungiblePayload} param0\n * @param {bigint} param0.amount - The amount being transferred\n * @returns {
|
|
1
|
+
{"version":3,"file":"transfers.js","sources":["../src/transfers.ts"],"sourcesContent":["import {\n type Address,\n type Hex,\n encodeAbiParameters,\n parseAbiParameters,\n zeroAddress,\n} from 'viem';\n\n/**\n * The various types of assets supported in Budgets and Incentives.\n *\n * @export\n * @enum {number}\n */\nexport enum AssetType {\n ETH,\n ERC20,\n ERC1155,\n}\n\n/**\n * Object representation of a generic `Transfer` struct.\n *\n * @export\n * @interface TransferPayload\n * @typedef {TransferPayload}\n */\nexport interface TransferPayload {\n /**\n * The type of the asset being transferred.\n *\n * @type {AssetType}\n */\n assetType: AssetType;\n /**\n * The address of the asset to transfer, zero address for ETH.\n *\n * @type {Address}\n */\n address: Address;\n /**\n * The account from which to transfer the assets.\n *\n * @type {Address}\n */\n target: Address;\n /**\n * An encoded {@link FungiblePayload}, use {@link prepareFungiblePayload} to construct.\n *\n * @type {Hex}\n */\n data: Hex;\n}\n\n/**\n * Encodes parameters for transferring the transfer of Fungible and ERC1155 assets, used for {@link Budget} operations.\n * Typically you'd use {@link prepareFungibleTransfer} or {@link prepareERC1155Transfer}\n *\n * @param {TransferPayload} param0\n * @param {AssetType} param0.assetType - The asset type being transferred.\n * @param {Address} param0.address - The address of the asset, use zero address for ETH transfers.\n * @param {Address} param0.target - The address of the account being transferred from\n * @param {Hex} param0.data - Use {@link prepareFungiblePayload} to properly encode an amount to transfer\n * @returns {Hex}\n */\nexport const prepareTransferPayload = ({\n assetType,\n address,\n target,\n data,\n}: TransferPayload) => {\n return encodeAbiParameters(\n [\n { type: 'uint8', name: 'assetType' },\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'target' },\n { type: 'bytes', name: 'data' },\n ],\n [assetType, address, target, data],\n );\n};\n\n/**\n * Object representation of\n *\n * @export\n * @interface ERC1155Payload\n * @typedef {ERC1155Payload}\n */\nexport interface ERC1155Payload {\n /**\n * The ERC1155 token ID for the incentive\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n}\n\n/**\n * Given a token ID and amount, properly encode a `ERC1155Incentive.ERC1155Payload` for use with {@link ERC1155Incentive} initialization.\n *\n * @export\n * @param {ERC1155Payload} param0\n * @param {bigint} param0.tokenId - The ERC1155 token ID for the incentive\n * @param {bigint} param0.amount - The amount to transfer\n * @returns {Hex}\n */\nexport function prepareERC1155Payload({ tokenId, amount }: ERC1155Payload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'ERC1155Payload payload',\n 'struct ERC1155Payload { uint256 tokenId; uint256 amount; bytes data; }',\n ]),\n [{ tokenId, amount, data: '0x' }],\n );\n}\n\n/**\n * An object representation of the `Budget.Transfer` contract struct for transfers of ERC1155 assets.\n *\n * @export\n * @interface ERC1155TransferPayload\n * @typedef {ERC1155TransferPayload}\n */\nexport interface ERC1155TransferPayload {\n /**\n * The token ID to transfer\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n /**\n * The address of the asset to target\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The account to transfer from\n *\n * @type {Address}\n */\n target: Address;\n}\n\n/**\n * Encodes parameters for transferring the transfer of ERC1155 assets, used for {@link Budget} operations.\n * The caller must have already approved the contract to transfer the asset.\n *\n * @export\n * @param {ERC1155TransferPayload} param0\n * @param {bigint} param0.tokenId - The token ID to transfer\n * @param {bigint} param0.amount - The amount to transfer\n * @param {Address} param0.asset - The address of the asset to target\n * @param {Address} param0.target - The account to transfer from\n * @returns {Hex}\n */\nexport function prepareERC1155Transfer({\n tokenId,\n amount,\n asset,\n target,\n}: ERC1155TransferPayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'Transfer request',\n 'struct Transfer { uint8 assetType; address asset; address target; bytes data; }',\n ]),\n [\n {\n assetType: AssetType.ERC1155,\n asset,\n data: prepareERC1155Payload({ tokenId, amount }),\n target,\n },\n ],\n );\n}\n\n/**\n * An object representation of the `FungiblePayload` struct\n *\n * @export\n * @interface FungiblePayload\n * @typedef {FungiblePayload}\n */\nexport interface FungiblePayload {\n /**\n * The amount being transferred\n *\n * @type {bigint}\n */\n amount: bigint;\n}\n\n/**\n * Encodes an amount for the `FungiblePayload` struct\n *\n * @export\n * @param {FungiblePayload} param0\n * @param {bigint} param0.amount - The amount being transferred\n * @returns {Hex}\n */\nexport function prepareFungiblePayload({ amount }: FungiblePayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'FungiblePayload payload',\n 'struct FungiblePayload { uint256 amount; }',\n ]),\n [{ amount }],\n );\n}\n\n/**\n * An object representation of the `Budget.Transfer` contract struct for transfers of fungible assets.\n *\n * @export\n * @interface FungibleTransferPayload\n * @typedef {FungibleTransferPayload}\n */\nexport interface FungibleTransferPayload {\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n /**\n * The address of the asset. Use zero address for ETH transfers.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The account to transfer from\n *\n * @type {Address}\n */\n target: Address;\n}\n\n/**\n * Encodes parameters for a Fungible transfer, used for Budget allocations.\n * The caller must have already approved the contract to transfer the asset.\n *\n * @export\n * @param {FungibleTransferPayload} param0\n * @param {bigint} param0.amount - The amount to transfer\n * @param {Address} param0.asset - The address of the asset. Use zero address for ETH transfers.\n * @param {Address} param0.target - The account to transfer from\n * @returns {Hex}\n */\nexport function prepareFungibleTransfer({\n amount,\n asset,\n target,\n}: FungibleTransferPayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'Transfer request',\n 'struct Transfer { uint8 assetType; address asset; address target; bytes data; }',\n ]),\n [\n {\n assetType: asset == zeroAddress ? AssetType.ETH : AssetType.ERC20,\n asset,\n data: prepareFungiblePayload({ amount }),\n target,\n },\n ],\n );\n}\n"],"names":["AssetType","AssetType2","prepareTransferPayload","assetType","address","target","data","encodeAbiParameters","prepareERC1155Payload","tokenId","amount","parseAbiParameters","prepareERC1155Transfer","asset","prepareFungiblePayload","prepareFungibleTransfer","zeroAddress"],"mappings":";AAcY,IAAAA,sBAAAA,OACVA,EAAAC,EAAA,MAAA,CAAA,IAAA,OACAD,EAAAC,EAAA,QAAA,CAAA,IAAA,SACAD,EAAAC,EAAA,UAAA,CAAA,IAAA,WAHUD,IAAAA,KAAA,CAAA,CAAA;AAmDL,MAAME,IAAyB,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AACF,MACSC;AAAA,EACL;AAAA,IACE,EAAE,MAAM,SAAS,MAAM,YAAY;AAAA,IACnC,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,IACjC,EAAE,MAAM,WAAW,MAAM,SAAS;AAAA,IAClC,EAAE,MAAM,SAAS,MAAM,OAAO;AAAA,EAChC;AAAA,EACA,CAACJ,GAAWC,GAASC,GAAQC,CAAI;AAAA;AAmC9B,SAASE,EAAsB,EAAE,SAAAC,GAAS,QAAAC,KAA0B;AAClE,SAAAH;AAAA,IACLI,EAAmB;AAAA,MACjB;AAAA,MACA;AAAA,IAAA,CACD;AAAA,IACD,CAAC,EAAE,SAAAF,GAAS,QAAAC,GAAQ,MAAM,MAAM;AAAA,EAAA;AAEpC;AAgDO,SAASE,EAAuB;AAAA,EACrC,SAAAH;AAAA,EACA,QAAAC;AAAA,EACA,OAAAG;AAAA,EACA,QAAAR;AACF,GAA2B;AAClB,SAAAE;AAAA,IACLI,EAAmB;AAAA,MACjB;AAAA,MACA;AAAA,IAAA,CACD;AAAA,IACD;AAAA,MACE;AAAA,QACE,WAAW;AAAA,QACX,OAAAE;AAAA,QACA,MAAML,EAAsB,EAAE,SAAAC,GAAS,QAAAC,GAAQ;AAAA,QAC/C,QAAAL;AAAA,MACF;AAAA,IACF;AAAA,EAAA;AAEJ;AA0BgB,SAAAS,EAAuB,EAAE,QAAAJ,KAA2B;AAC3D,SAAAH;AAAA,IACLI,EAAmB;AAAA,MACjB;AAAA,MACA;AAAA,IAAA,CACD;AAAA,IACD,CAAC,EAAE,QAAAD,EAAA,CAAQ;AAAA,EAAA;AAEf;AAyCO,SAASK,EAAwB;AAAA,EACtC,QAAAL;AAAA,EACA,OAAAG;AAAA,EACA,QAAAR;AACF,GAA4B;AACnB,SAAAE;AAAA,IACLI,EAAmB;AAAA,MACjB;AAAA,MACA;AAAA,IAAA,CACD;AAAA,IACD;AAAA,MACE;AAAA,QACE,WAAWE,KAASG,IAAc,IAAgB;AAAA,QAClD,OAAAH;AAAA,QACA,MAAMC,EAAuB,EAAE,QAAAJ,GAAQ;AAAA,QACvC,QAAAL;AAAA,MACF;AAAA,IACF;AAAA,EAAA;AAEJ;"}
|
package/dist/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@wagmi/core"),n=require("viem"),s=require("./errors.cjs");var u=(t=>(t[t.ACTION=0]="ACTION",t[t.ALLOW_LIST=1]="ALLOW_LIST",t[t.BUDGET=2]="BUDGET",t[t.INCENTIVE=3]="INCENTIVE",t[t.VALIDATOR=4]="VALIDATOR",t))(u||{});function d(t){return n.slice(n.isHex(t)?n.keccak256(t):n.keccak256(n.toHex(t)),0,4)}async function A(t,c,r){const o=await i.waitForTransactionReceipt(t,{...r,hash:await c});if(!o.contractAddress)throw new s.NoContractAddressUponReceiptError(o);return o.contractAddress}async function f(t,c,r){const{hash:o,result:a}=await c;return await i.waitForTransactionReceipt(t,{...r,hash:o}),a}function l(t,c,r){let o;const a=i.getAccount(t);if(r!==void 0?c[r]&&(o=r):a.chainId!==void 0&&c[a.chainId]&&(o=a.chainId),o===void 0){const e=i.getClient(t);e!=null&&e.chain.id&&c[e==null?void 0:e.chain.id]&&(o=e.chain.id)}if(o===void 0&&(o=11155111),!c[o])throw new s.InvalidProtocolChainIdError(o,Object.keys(c).map(Number));return{chainId:o,address:c[o]}}exports.RegistryType=u;exports.assertValidAddressByChainId=l;exports.awaitResult=f;exports.bytes4=d;exports.getDeployedContractAddress=A;
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport { NoContractAddressUponReceiptError } from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {unknown}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n"],"names":["bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","RegistryType"],"mappings":"2JA2HO,SAASA,EAAOC,EAAe,CACpC,OAAOC,EAAM,MAAAC,EAAA,MAAMF,CAAK,EAAIG,EAAU,UAAAH,CAAK,EAAIG,EAAA,UAAUC,EAAM,MAAAJ,CAAK,CAAC,EAAG,EAAG,CAAC,CAC9E,CAasB,eAAAK,EACpBC,EACAC,EACAC,EACA,CACM,MAAAC,EAAU,MAAMC,EAAA,0BAA0BJ,EAAQ,CACtD,GAAGE,EACH,KAAM,MAAMD,CAAA,CACb,EACD,GAAI,CAACE,EAAQ,gBACL,MAAA,IAAIE,EAAAA,kCAAkCF,CAAO,EACrD,OAAOA,EAAQ,eACjB,CAsBsB,eAAAG,EACpBN,EACAO,EACAL,EACiB,CACjB,KAAM,CAAE,KAAAD,EAAM,OAAAO,CAAO,EAAI,MAAMD,EAC/B,aAAMH,EAAAA,0BAA0BJ,EAAQ,CACtC,GAAGE,EACH,KAAAD,CAAA,CACD,EACMO,CACT,CAQY,IAAAC,GAAAA,IACVA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,WAAa,CAAb,EAAA,aACAA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YALUA,IAAAA,GAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n getAccount,\n getClient,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n Address,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport {\n InvalidProtocolChainIdError,\n NoConnectedChainIdError,\n NoContractAddressUponReceiptError,\n} from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi = Abi,\n functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {Promise<Address>}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * Given a wagmi config and a map of chain id's to addresses, determine an address/chainId combo that maps to the currently connected chain id, or throw a typed error.\n *\n * @export\n * @param {Config} config\n * @param {Record<string, Address>} addressByChainId\n * @param {number} desiredChainId\n * @returns {{ chainId: number, address: Address }}\n * @throws {@link InvalidProtocolChainIdError}\n */\nexport function assertValidAddressByChainId(\n config: Config,\n addressByChainId: Record<number, Address>,\n desiredChainId?: number,\n): { chainId: number; address: Address } {\n let chainId: number | undefined = undefined;\n const wagmiAccount = getAccount(config);\n // if manually providing a chain id for some contract operation, try to use it\n if (desiredChainId !== undefined) {\n if (addressByChainId[desiredChainId]) chainId = desiredChainId;\n } else if (wagmiAccount.chainId !== undefined) {\n // otherwise if we can get the current chain id off the connected account and it matches one of ours, use it\n if (addressByChainId[wagmiAccount.chainId]) chainId = wagmiAccount.chainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const client = getClient(config);\n if (client?.chain.id && addressByChainId[client?.chain.id])\n chainId = client.chain.id;\n }\n // if chainId is STILL undefined, use our default addresses\n // TODO: update this when on prod network\n if (chainId === undefined) chainId = Number(__DEFAULT_CHAIN_ID__);\n if (!addressByChainId[chainId])\n throw new InvalidProtocolChainIdError(\n chainId,\n Object.keys(addressByChainId).map(Number),\n );\n // biome-ignore lint/style/noNonNullAssertion: this type should be narrowed by the above statement but isn't?\n return { chainId, address: addressByChainId[chainId]! };\n}\n"],"names":["RegistryType","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiAccount","getAccount","client","getClient","InvalidProtocolChainIdError"],"mappings":"2JAqCY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,WAAa,CAAb,EAAA,aACAA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YALUA,IAAAA,GAAA,CAAA,CAAA,EA2GL,SAASC,EAAOC,EAAe,CACpC,OAAOC,EAAM,MAAAC,EAAA,MAAMF,CAAK,EAAIG,EAAU,UAAAH,CAAK,EAAIG,EAAA,UAAUC,EAAM,MAAAJ,CAAK,CAAC,EAAG,EAAG,CAAC,CAC9E,CAasB,eAAAK,EACpBC,EACAC,EACAC,EACA,CACM,MAAAC,EAAU,MAAMC,EAAA,0BAA0BJ,EAAQ,CACtD,GAAGE,EACH,KAAM,MAAMD,CAAA,CACb,EACD,GAAI,CAACE,EAAQ,gBACL,MAAA,IAAIE,EAAAA,kCAAkCF,CAAO,EACrD,OAAOA,EAAQ,eACjB,CAsBsB,eAAAG,EACpBN,EACAO,EACAL,EACiB,CACjB,KAAM,CAAE,KAAAD,EAAM,OAAAO,CAAO,EAAI,MAAMD,EAC/B,aAAMH,EAAAA,0BAA0BJ,EAAQ,CACtC,GAAGE,EACH,KAAAD,CAAA,CACD,EACMO,CACT,CAYgB,SAAAC,EACdT,EACAU,EACAC,EACuC,CACvC,IAAIC,EACE,MAAAC,EAAeC,aAAWd,CAAM,EAStC,GAPIW,IAAmB,OACjBD,EAAiBC,CAAc,IAAaC,EAAAD,GACvCE,EAAa,UAAY,QAE9BH,EAAiBG,EAAa,OAAO,MAAaA,EAAa,SAGjED,IAAY,OAAW,CACnB,MAAAG,EAASC,YAAUhB,CAAM,EAC3Be,GAAA,MAAAA,EAAQ,MAAM,IAAML,EAAiBK,GAAA,YAAAA,EAAQ,MAAM,EAAE,IACvDH,EAAUG,EAAO,MAAM,GAC3B,CAII,GADAH,IAAY,SAAqBA,EAAO,UACxC,CAACF,EAAiBE,CAAO,EAC3B,MAAM,IAAIK,EAAA,4BACRL,EACA,OAAO,KAAKF,CAAgB,EAAE,IAAI,MAAM,CAAA,EAG5C,MAAO,CAAE,QAAAE,EAAS,QAASF,EAAiBE,CAAO,CAAG,CACxD"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { type Config, type ReadContractParameters, type WatchContractEventParameters, type WriteContractParameters } from '@wagmi/core';
|
|
2
2
|
import type { ExtractAbiEvent } from 'abitype';
|
|
3
|
-
import type { Abi, AbiEvent, ContractEventName, ContractFunctionName, GetLogsParameters, Hash, Log, WaitForTransactionReceiptParameters } from 'viem';
|
|
3
|
+
import type { Abi, AbiEvent, Address, ContractEventName, ContractFunctionName, GetLogsParameters, Hash, Log, WaitForTransactionReceiptParameters } from 'viem';
|
|
4
4
|
export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
5
|
+
/**
|
|
6
|
+
* Enum encapsulating all the different types of targets used in the Boost V2 Protocol.
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @enum {number}
|
|
10
|
+
*/
|
|
11
|
+
export declare enum RegistryType {
|
|
12
|
+
ACTION = 0,
|
|
13
|
+
ALLOW_LIST = 1,
|
|
14
|
+
BUDGET = 2,
|
|
15
|
+
INCENTIVE = 3,
|
|
16
|
+
VALIDATOR = 4
|
|
17
|
+
}
|
|
5
18
|
/**
|
|
6
19
|
* Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.
|
|
7
20
|
* See (writeContract)[https://viem.sh/docs/contract/writeContract]
|
|
@@ -11,7 +24,7 @@ export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
|
11
24
|
* @template {Abi} abi
|
|
12
25
|
* @template {ContractFunctionName<abi>} functionName
|
|
13
26
|
*/
|
|
14
|
-
export type WriteParams<abi extends Abi, functionName extends ContractFunctionName<abi>> = Partial<Omit<WriteContractParameters<abi, functionName>, 'address' | 'args' | 'functionName' | 'abi'>>;
|
|
27
|
+
export type WriteParams<abi extends Abi = Abi, functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>> = Partial<Omit<WriteContractParameters<abi, functionName>, 'address' | 'args' | 'functionName' | 'abi'>>;
|
|
15
28
|
/**
|
|
16
29
|
* Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.
|
|
17
30
|
* See (readContract)[https://viem.sh/docs/contract/readContract]
|
|
@@ -73,7 +86,7 @@ export declare function bytes4(input: string): `0x${string}`;
|
|
|
73
86
|
* @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)
|
|
74
87
|
* @param {Promise<Hash>} hash - A transaction hash promise
|
|
75
88
|
* @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}
|
|
76
|
-
* @returns {
|
|
89
|
+
* @returns {Promise<Address>}
|
|
77
90
|
* @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received
|
|
78
91
|
*/
|
|
79
92
|
export declare function getDeployedContractAddress(config: Config, hash: Promise<Hash>, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<`0x${string}`>;
|
|
@@ -101,16 +114,17 @@ export type HashAndSimulatedResult<T = unknown> = {
|
|
|
101
114
|
*/
|
|
102
115
|
export declare function awaitResult<Result = unknown>(config: Config, hashPromise: Promise<HashAndSimulatedResult<Result>>, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<Result>;
|
|
103
116
|
/**
|
|
104
|
-
*
|
|
117
|
+
* Given a wagmi config and a map of chain id's to addresses, determine an address/chainId combo that maps to the currently connected chain id, or throw a typed error.
|
|
105
118
|
*
|
|
106
119
|
* @export
|
|
107
|
-
* @
|
|
120
|
+
* @param {Config} config
|
|
121
|
+
* @param {Record<string, Address>} addressByChainId
|
|
122
|
+
* @param {number} desiredChainId
|
|
123
|
+
* @returns {{ chainId: number, address: Address }}
|
|
124
|
+
* @throws {@link InvalidProtocolChainIdError}
|
|
108
125
|
*/
|
|
109
|
-
export declare
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
INCENTIVE = 3,
|
|
114
|
-
VALIDATOR = 4
|
|
115
|
-
}
|
|
126
|
+
export declare function assertValidAddressByChainId(config: Config, addressByChainId: Record<number, Address>, desiredChainId?: number): {
|
|
127
|
+
chainId: number;
|
|
128
|
+
address: Address;
|
|
129
|
+
};
|
|
116
130
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAI7B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EACV,GAAG,EACH,QAAQ,EACR,OAAO,EACP,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,IAAI,EAEJ,GAAG,EACH,mCAAmC,EACpC,MAAM,MAAM,CAAC;AAQd,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErE;;;;;GAKG;AACH,oBAAY,YAAY;IACtB,MAAM,IAAI;IACV,UAAU,IAAI;IACd,MAAM,IAAI;IACV,SAAS,IAAI;IACb,SAAS,IAAI;CACd;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CACrB,GAAG,SAAS,GAAG,GAAG,GAAG,EACrB,YAAY,SAAS,oBAAoB,CAAC,GAAG,CAAC,GAAG,oBAAoB,CAAC,GAAG,CAAC,IACxE,OAAO,CACT,IAAI,CACF,uBAAuB,CAAC,GAAG,EAAE,YAAY,CAAC,EAC1C,SAAS,GAAG,MAAM,GAAG,cAAc,GAAG,KAAK,CAC5C,CACF,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,CACpB,GAAG,SAAS,GAAG,EACf,YAAY,SAAS,oBAAoB,CAAC,GAAG,CAAC,IAC5C,OAAO,CACT,IAAI,CACF,sBAAsB,CAAC,GAAG,EAAE,YAAY,CAAC,EACzC,SAAS,GAAG,MAAM,GAAG,cAAc,GAAG,KAAK,CAC5C,CACF,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CACrB,GAAG,SAAS,GAAG,EACf,SAAS,SAAS,iBAAiB,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,SAAS,IAC9D,OAAO,CACT,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC,CACtE,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,CACvB,GAAG,SAAS,GAAG,EACf,KAAK,SAAS,iBAAiB,CAAC,GAAG,CAAC,EACpC,QAAQ,SAAS,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,EAC1E,SAAS,SACL,SAAS,QAAQ,EAAE,GACnB,SAAS,OAAO,EAAE,GAClB,SAAS,GAAG,QAAQ,SAAS,QAAQ,GAAG,CAAC,QAAQ,CAAC,GAAG,SAAS,IAChE,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC,GAAG;IACrE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CACpB,GAAG,SAAS,GAAG,EACf,KAAK,SAAS,iBAAiB,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,GAAG,CAAC,IAC3D,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AAEnE;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,iBAEnC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EACnB,UAAU,CAAC,EAAE,IAAI,CAAC,mCAAmC,EAAE,MAAM,CAAC,0BAS/D;AAED;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,OAAO,IAAI;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC;AAE5E;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,MAAM,GAAG,OAAO,EAChD,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,OAAO,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,EACpD,UAAU,CAAC,EAAE,IAAI,CAAC,mCAAmC,EAAE,MAAM,CAAC,GAC7D,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;;;;;;;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,CA0BvC"}
|