@boostxyz/sdk 2.0.0-alpha.35 → 2.1.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 +4 -4
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.js +17 -17
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +5 -5
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.js +19 -19
- 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 +14 -0
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +100 -81
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.js +31 -31
- package/dist/Budget-B0kJsZtZ.cjs +2 -0
- package/dist/Budget-B0kJsZtZ.cjs.map +1 -0
- package/dist/Budget-NtzY9H7G.js +462 -0
- package/dist/Budget-NtzY9H7G.js.map +1 -0
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.cjs.map +1 -1
- package/dist/Budgets/Budget.d.ts +5 -4
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +9 -26
- package/dist/Budgets/Budget.js.map +1 -1
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.js +34 -34
- package/dist/Budgets/ManagedBudgetWithFees.d.ts +1203 -0
- package/dist/Budgets/ManagedBudgetWithFees.d.ts.map +1 -0
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.js +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +23 -23
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +18 -0
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +48 -22
- 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 +18 -0
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +47 -16
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +18 -0
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +58 -32
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +29 -29
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +18 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +37 -11
- package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.js +4 -4
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +18 -0
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +49 -23
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-wDvsNIuY.cjs → SimpleDenyList-B65fnca2.cjs} +2 -2
- package/dist/{SimpleDenyList-wDvsNIuY.cjs.map → SimpleDenyList-B65fnca2.cjs.map} +1 -1
- package/dist/{SimpleDenyList-D-rGBaay.js → SimpleDenyList-UvXQl2vm.js} +20 -20
- package/dist/{SimpleDenyList-D-rGBaay.js.map → SimpleDenyList-UvXQl2vm.js.map} +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.js +9 -9
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.js +8 -8
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.cjs.map +1 -1
- package/dist/Validators/Validator.js +20 -20
- package/dist/componentInterfaces-Bt-4sNB5.cjs +2 -0
- package/dist/componentInterfaces-Bt-4sNB5.cjs.map +1 -0
- package/dist/componentInterfaces-dakxtQHf.js +16 -0
- package/dist/componentInterfaces-dakxtQHf.js.map +1 -0
- package/dist/deployments-DxkwtCyu.cjs +2 -0
- package/dist/deployments-DxkwtCyu.cjs.map +1 -0
- package/dist/{deployments-BdPDIh-i.js → deployments-ZLVwJGZD.js} +33 -30
- package/dist/deployments-ZLVwJGZD.js.map +1 -0
- package/dist/deployments.json +17 -14
- package/dist/{generated-CDEDSOGZ.js → generated-B0XfMfoq.js} +1037 -470
- package/dist/generated-B0XfMfoq.js.map +1 -0
- package/dist/generated-pNKCp_Ez.cjs +3 -0
- package/dist/generated-pNKCp_Ez.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +148 -144
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +12 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +64 -35
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/BoostCore.ts +30 -0
- package/src/Budgets/Budget.ts +8 -3
- package/src/Budgets/ManagedBudgetWithFees.test.ts +286 -0
- package/src/Budgets/ManagedBudgetWithFees.ts +671 -0
- package/src/Incentives/AllowListIncentive.test.ts +52 -4
- package/src/Incentives/AllowListIncentive.ts +28 -0
- package/src/Incentives/CGDAIncentive.test.ts +48 -3
- package/src/Incentives/CGDAIncentive.ts +34 -0
- package/src/Incentives/ERC20Incentive.test.ts +42 -0
- package/src/Incentives/ERC20Incentive.ts +28 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +41 -1
- package/src/Incentives/ERC20VariableIncentive.ts +28 -0
- package/src/Incentives/PointsIncentive.test.ts +47 -3
- package/src/Incentives/PointsIncentive.ts +28 -0
- package/src/index.ts +1 -0
- package/src/utils.ts +46 -0
- package/dist/componentInterfaces-BQw7DH-m.cjs +0 -2
- package/dist/componentInterfaces-BQw7DH-m.cjs.map +0 -1
- package/dist/componentInterfaces-C0vuWQlh.js +0 -15
- package/dist/componentInterfaces-C0vuWQlh.js.map +0 -1
- package/dist/deployments--f75Pthq.cjs +0 -2
- package/dist/deployments--f75Pthq.cjs.map +0 -1
- package/dist/deployments-BdPDIh-i.js.map +0 -1
- package/dist/generated-CDEDSOGZ.js.map +0 -1
- package/dist/generated-D3DE5TfH.cjs +0 -3
- package/dist/generated-D3DE5TfH.cjs.map +0 -1
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 c=require("./BoostRegistry.cjs"),n=require("./BoostCore.cjs"),A=require("./Boost.cjs"),u=require("./Actions/Action.cjs"),a=require("./Actions/EventAction.cjs"),E=require("./AllowLists/AllowList.cjs"),y=require("./AllowLists/SimpleAllowList.cjs"),C=require("./SimpleDenyList-B65fnca2.cjs"),l=require("./Budget-B0kJsZtZ.cjs"),o=require("./Budgets/ManagedBudget.cjs"),D=require("./Deployable/Deployable.cjs"),T=require("./Deployable/Contract.cjs"),V=require("./Deployable/DeployableTarget.cjs"),I=require("./Deployable/DeployableTargetWithRBAC.cjs"),m=require("./Incentives/AllowListIncentive.cjs"),S=require("./Incentives/CGDAIncentive.cjs"),v=require("./Incentives/ERC20Incentive.cjs"),P=require("./Incentives/ERC20VariableIncentive.cjs"),g=require("./Incentives/ERC20VariableCriteriaIncentive.cjs"),b=require("./Incentives/Incentive.cjs"),R=require("./Incentives/PointsIncentive.cjs"),d=require("./Validators/SignerValidator.cjs"),s=require("./Validators/LimitedSignerValidator.cjs"),p=require("./Validators/Validator.cjs"),e=require("./errors.cjs"),i=require("./utils.cjs"),B=require("./claiming.cjs"),t=require("./transfers.cjs"),L=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-pNKCp_Ez.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=n.BOOST_CORE_ADDRESS;exports.BOOST_CORE_ADDRESSES=n.BOOST_CORE_ADDRESSES;exports.BoostCore=n.BoostCore;exports.FEE_DENOMINATOR=n.FEE_DENOMINATOR;exports.Boost=A.Boost;exports.prepareBoostPayload=A.prepareBoostPayload;exports.ActionByComponentInterface=u.ActionByComponentInterface;exports.actionFromAddress=u.actionFromAddress;exports.EventAction=a.EventAction;exports.FilterType=a.FilterType;exports.PrimitiveType=a.PrimitiveType;exports.SignatureType=a.SignatureType;exports.anyActionParameter=a.anyActionParameter;exports.isEventActionPayloadSimple=a.isEventActionPayloadSimple;exports.prepareEventActionPayload=a.prepareEventActionPayload;exports.transactionSenderClaimant=a.transactionSenderClaimant;exports.AllowListByComponentInterface=E.AllowListByComponentInterface;exports.OpenAllowList=E.OpenAllowList;exports.allowListFromAddress=E.allowListFromAddress;exports.LIST_MANAGER_ROLE=y.LIST_MANAGER_ROLE;exports.SimpleAllowList=y.SimpleAllowList;exports.prepareSimpleAllowListPayload=y.prepareSimpleAllowListPayload;exports.SimpleDenyList=C.SimpleDenyList;exports.prepareSimpleDenyListPayload=C.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=l.BudgetByComponentInterface;exports.ManagedBudgetWithFees=l.ManagedBudgetWithFees;exports.budgetFromAddress=l.budgetFromAddress;exports.prepareManagedBudgetWithFeesPayload=l.prepareManagedBudgetWithFeesPayload;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=D.Deployable;exports.Contract=T.Contract;exports.DeployableTarget=V.DeployableTarget;exports.DeployableTargetWithRBAC=I.DeployableTargetWithRBAC;exports.Roles=I.Roles;exports.AllowListIncentive=m.AllowListIncentive;exports.prepareAllowListIncentivePayload=m.prepareAllowListIncentivePayload;exports.CGDAIncentive=S.CGDAIncentive;exports.prepareCGDAIncentivePayload=S.prepareCGDAIncentivePayload;exports.ERC20Incentive=v.ERC20Incentive;exports.prepareERC20IncentivePayload=v.prepareERC20IncentivePayload;exports.ERC20VariableIncentive=P.ERC20VariableIncentive;exports.prepareERC20VariableIncentivePayload=P.prepareERC20VariableIncentivePayload;exports.ERC20VariableCriteriaIncentive=g.ERC20VariableCriteriaIncentive;exports.gasRebateIncentiveCriteria=g.gasRebateIncentiveCriteria;exports.prepareERC20VariableCriteriaIncentivePayload=g.prepareERC20VariableCriteriaIncentivePayload;exports.IncentiveByComponentInterface=b.IncentiveByComponentInterface;exports.incentiveFromAddress=b.incentiveFromAddress;exports.PointsIncentive=R.PointsIncentive;exports.preparePointsIncentivePayload=R.preparePointsIncentivePayload;exports.SignerValidator=d.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=d.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=d.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=d.prepareSignerValidatorPayload;exports.LimitedSignerValidator=s.LimitedSignerValidator;exports.prepareLimitedSignerValidatorClaimDataPayload=s.prepareLimitedSignerValidatorClaimDataPayload;exports.prepareLimitedSignerValidatorInputParams=s.prepareLimitedSignerValidatorInputParams;exports.prepareLimitedSignerValidatorPayload=s.prepareLimitedSignerValidatorPayload;exports.BoostValidatorEOA=p.BoostValidatorEOA;exports.ValidatorByComponentInterface=p.ValidatorByComponentInterface;exports.decodeClaimData=p.decodeClaimData;exports.validatorFromAddress=p.validatorFromAddress;exports.BoostCoreNoIdentifierEmitted=e.BoostCoreNoIdentifierEmitted;exports.BoostNotFoundError=e.BoostNotFoundError;exports.BudgetMustAuthorizeBoostCore=e.BudgetMustAuthorizeBoostCore;exports.ContractAddressRequiredError=e.ContractAddressRequiredError;exports.DecodedArgsError=e.DecodedArgsError;exports.DecodedArgsMalformedError=e.DecodedArgsMalformedError;exports.DeployableAlreadyDeployedError=e.DeployableAlreadyDeployedError;exports.DeployableBuildParametersUnspecifiedError=e.DeployableBuildParametersUnspecifiedError;exports.DeployableMissingPayloadError=e.DeployableMissingPayloadError;exports.DeployableUnknownOwnerProvidedError=e.DeployableUnknownOwnerProvidedError;exports.DeployableWagmiConfigurationRequiredError=e.DeployableWagmiConfigurationRequiredError;exports.FieldActionValidationError=e.FieldActionValidationError;exports.FieldValueNotComparableError=e.FieldValueNotComparableError;exports.FieldValueUndefinedError=e.FieldValueUndefinedError;exports.FunctionDataDecodeError=e.FunctionDataDecodeError;exports.IncentiveCriteriaNotFoundError=e.IncentiveCriteriaNotFoundError;exports.IncentiveNotCloneableError=e.IncentiveNotCloneableError;exports.InvalidComponentInterfaceError=e.InvalidComponentInterfaceError;exports.InvalidCriteriaTypeError=e.InvalidCriteriaTypeError;exports.InvalidNumericalCriteriaError=e.InvalidNumericalCriteriaError;exports.InvalidProtocolChainIdError=e.InvalidProtocolChainIdError;exports.MustInitializeBudgetError=e.MustInitializeBudgetError;exports.NoConnectedChainIdError=e.NoConnectedChainIdError;exports.NoContractAddressUponReceiptError=e.NoContractAddressUponReceiptError;exports.NoEventActionStepsProvidedError=e.NoEventActionStepsProvidedError;exports.NoMatchingLogsError=e.NoMatchingLogsError;exports.TooManyEventActionStepsProvidedError=e.TooManyEventActionStepsProvidedError;exports.UnknownTransferPayloadSupplied=e.UnknownTransferPayloadSupplied;exports.UnparseableAbiParamError=e.UnparseableAbiParamError;exports.UnrecognizedFilterTypeError=e.UnrecognizedFilterTypeError;exports.ValidationAbiMissingError=e.ValidationAbiMissingError;exports.CheatCodes=i.CheatCodes;exports.RegistryType=i.RegistryType;exports.assertValidAddressByChainId=i.assertValidAddressByChainId;exports.awaitResult=i.awaitResult;exports.bytes4=i.bytes4;exports.getDeployedContractAddress=i.getDeployedContractAddress;exports.getErc20Balance=i.getErc20Balance;exports.StrategyType=B.StrategyType;exports.prepareClaimPayload=B.prepareClaimPayload;exports.AssetType=t.AssetType;exports.prepareERC1155Payload=t.prepareERC1155Payload;exports.prepareERC1155Transfer=t.prepareERC1155Transfer;exports.prepareFungiblePayload=t.prepareFungiblePayload;exports.prepareFungibleTransfer=t.prepareFungibleTransfer;exports.prepareTransferPayload=t.prepareTransferPayload;exports.PassthroughAuth=L.PassthroughAuth;exports.allowListIncentiveAbi=r.z;exports.boostCoreAbi=r.I;exports.boostRegistryAbi=r.ue;exports.cgdaIncentiveAbi=r.w;exports.erc20IncentiveAbi=r.m;exports.erc20VariableCriteriaIncentiveAbi=r.b;exports.erc20VariableIncentiveAbi=r.T;exports.limitedSignerValidatorAbi=r.H;exports.managedBudgetAbi=r.f;exports.managedBudgetWithFeesAbi=r.o;exports.passthroughAuthAbi=r.Le;exports.pointsIncentiveAbi=r.h;exports.rbacAbi=r.E;exports.signerValidatorAbi=r.F;exports.simpleAllowListAbi=r.R;exports.simpleDenyListAbi=r.O;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './AllowLists/SimpleAllowList';
|
|
|
8
8
|
export * from './AllowLists/SimpleDenyList';
|
|
9
9
|
export * from './Budgets/Budget';
|
|
10
10
|
export * from './Budgets/ManagedBudget';
|
|
11
|
+
export * from './Budgets/ManagedBudgetWithFees';
|
|
11
12
|
export * from './Deployable/Deployable';
|
|
12
13
|
export * from './Deployable/Contract';
|
|
13
14
|
export * from './Deployable/DeployableTarget';
|
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;
|
|
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;AACxC,cAAc,iCAAiC,CAAC;AAIhD,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,qCAAqC,CAAC;AACpD,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,161 +1,165 @@
|
|
|
1
|
-
import { BOOST_REGISTRY_ADDRESS as
|
|
2
|
-
import { BOOST_CORE_ADDRESS as n, BOOST_CORE_ADDRESSES as p, BoostCore as
|
|
1
|
+
import { BOOST_REGISTRY_ADDRESS as a, BOOST_REGISTRY_ADDRESSES as o, BoostRegistry as t } from "./BoostRegistry.js";
|
|
2
|
+
import { BOOST_CORE_ADDRESS as n, BOOST_CORE_ADDRESSES as p, BoostCore as d, FEE_DENOMINATOR as l } from "./BoostCore.js";
|
|
3
3
|
import { Boost as m, prepareBoostPayload as c } from "./Boost.js";
|
|
4
|
-
import { ActionByComponentInterface as
|
|
5
|
-
import { EventAction as f, FilterType as
|
|
6
|
-
import { AllowListByComponentInterface as
|
|
7
|
-
import { LIST_MANAGER_ROLE as V, SimpleAllowList as
|
|
8
|
-
import { S as
|
|
9
|
-
import {
|
|
10
|
-
import { ManagedBudget as
|
|
11
|
-
import { Deployable as
|
|
12
|
-
import { Contract as
|
|
13
|
-
import { DeployableTarget as
|
|
14
|
-
import { DeployableTargetWithRBAC as
|
|
15
|
-
import { AllowListIncentive as
|
|
16
|
-
import { CGDAIncentive as
|
|
17
|
-
import { ERC20Incentive as
|
|
18
|
-
import { ERC20VariableIncentive as
|
|
19
|
-
import { ERC20VariableCriteriaIncentive as
|
|
20
|
-
import { IncentiveByComponentInterface as
|
|
21
|
-
import { PointsIncentive as
|
|
22
|
-
import { SignerValidator as
|
|
23
|
-
import { LimitedSignerValidator as
|
|
24
|
-
import { BoostValidatorEOA as
|
|
25
|
-
import { BoostCoreNoIdentifierEmitted as
|
|
26
|
-
import { CheatCodes as
|
|
27
|
-
import { StrategyType as
|
|
28
|
-
import { AssetType as
|
|
29
|
-
import { PassthroughAuth as
|
|
30
|
-
import {
|
|
4
|
+
import { ActionByComponentInterface as A, actionFromAddress as y } from "./Actions/Action.js";
|
|
5
|
+
import { EventAction as f, FilterType as C, PrimitiveType as b, SignatureType as I, anyActionParameter as S, isEventActionPayloadSimple as u, prepareEventActionPayload as v, transactionSenderClaimant as P } from "./Actions/EventAction.js";
|
|
6
|
+
import { AllowListByComponentInterface as B, OpenAllowList as D, allowListFromAddress as x } from "./AllowLists/AllowList.js";
|
|
7
|
+
import { LIST_MANAGER_ROLE as V, SimpleAllowList as F, prepareSimpleAllowListPayload as L } from "./AllowLists/SimpleAllowList.js";
|
|
8
|
+
import { S as O, p as M } from "./SimpleDenyList-UvXQl2vm.js";
|
|
9
|
+
import { B as N, M as _, b as U, p as G } from "./Budget-NtzY9H7G.js";
|
|
10
|
+
import { ManagedBudget as z, ManagedBudgetRoles as k, isERC1155TransferPayload as q, isFungibleTransfer as Y, prepareManagedBudgetPayload as H, prepareTransfer as j } from "./Budgets/ManagedBudget.js";
|
|
11
|
+
import { Deployable as K } from "./Deployable/Deployable.js";
|
|
12
|
+
import { Contract as X } from "./Deployable/Contract.js";
|
|
13
|
+
import { DeployableTarget as $ } from "./Deployable/DeployableTarget.js";
|
|
14
|
+
import { DeployableTargetWithRBAC as re, Roles as ae } from "./Deployable/DeployableTargetWithRBAC.js";
|
|
15
|
+
import { AllowListIncentive as te, prepareAllowListIncentivePayload as ie } from "./Incentives/AllowListIncentive.js";
|
|
16
|
+
import { CGDAIncentive as pe, prepareCGDAIncentivePayload as de } from "./Incentives/CGDAIncentive.js";
|
|
17
|
+
import { ERC20Incentive as se, prepareERC20IncentivePayload as me } from "./Incentives/ERC20Incentive.js";
|
|
18
|
+
import { ERC20VariableIncentive as Ee, prepareERC20VariableIncentivePayload as Ae } from "./Incentives/ERC20VariableIncentive.js";
|
|
19
|
+
import { ERC20VariableCriteriaIncentive as ge, gasRebateIncentiveCriteria as fe, prepareERC20VariableCriteriaIncentivePayload as Ce } from "./Incentives/ERC20VariableCriteriaIncentive.js";
|
|
20
|
+
import { IncentiveByComponentInterface as Ie, incentiveFromAddress as Se } from "./Incentives/Incentive.js";
|
|
21
|
+
import { PointsIncentive as ve, preparePointsIncentivePayload as Pe } from "./Incentives/PointsIncentive.js";
|
|
22
|
+
import { SignerValidator as Be, prepareSignerValidatorClaimDataPayload as De, prepareSignerValidatorInputParams as xe, prepareSignerValidatorPayload as Te } from "./Validators/SignerValidator.js";
|
|
23
|
+
import { LimitedSignerValidator as Fe, prepareLimitedSignerValidatorClaimDataPayload as Le, prepareLimitedSignerValidatorInputParams as he, prepareLimitedSignerValidatorPayload as Oe } from "./Validators/LimitedSignerValidator.js";
|
|
24
|
+
import { BoostValidatorEOA as we, ValidatorByComponentInterface as Ne, decodeClaimData as _e, validatorFromAddress as Ue } from "./Validators/Validator.js";
|
|
25
|
+
import { BoostCoreNoIdentifierEmitted as We, BoostNotFoundError as ze, BudgetMustAuthorizeBoostCore as ke, ContractAddressRequiredError as qe, DecodedArgsError as Ye, DecodedArgsMalformedError as He, DeployableAlreadyDeployedError as je, DeployableBuildParametersUnspecifiedError as Je, DeployableMissingPayloadError as Ke, DeployableUnknownOwnerProvidedError as Qe, DeployableWagmiConfigurationRequiredError as Xe, FieldActionValidationError as Ze, FieldValueNotComparableError as $e, FieldValueUndefinedError as er, FunctionDataDecodeError as rr, IncentiveCriteriaNotFoundError as ar, IncentiveNotCloneableError as or, InvalidComponentInterfaceError as tr, InvalidCriteriaTypeError as ir, InvalidNumericalCriteriaError as nr, InvalidProtocolChainIdError as pr, MustInitializeBudgetError as dr, NoConnectedChainIdError as lr, NoContractAddressUponReceiptError as sr, NoEventActionStepsProvidedError as mr, NoMatchingLogsError as cr, TooManyEventActionStepsProvidedError as Er, UnknownTransferPayloadSupplied as Ar, UnparseableAbiParamError as yr, UnrecognizedFilterTypeError as gr, ValidationAbiMissingError as fr } from "./errors.js";
|
|
26
|
+
import { CheatCodes as br, RegistryType as Ir, assertValidAddressByChainId as Sr, awaitResult as ur, bytes4 as vr, getDeployedContractAddress as Pr, getErc20Balance as Rr } from "./utils.js";
|
|
27
|
+
import { StrategyType as Dr, prepareClaimPayload as xr } from "./claiming.js";
|
|
28
|
+
import { AssetType as Vr, prepareERC1155Payload as Fr, prepareERC1155Transfer as Lr, prepareFungiblePayload as hr, prepareFungibleTransfer as Or, prepareTransferPayload as Mr } from "./transfers.js";
|
|
29
|
+
import { PassthroughAuth as Nr } from "./Auth/PassthroughAuth.js";
|
|
30
|
+
import { z as Ur, I as Gr, u as Wr, w as zr, m as kr, b as qr, T as Yr, H as Hr, f as jr, o as Jr, L as Kr, h as Qr, E as Xr, F as Zr, R as $r, O as ea } from "./generated-B0XfMfoq.js";
|
|
31
31
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
A as ActionByComponentInterface,
|
|
33
|
+
B as AllowListByComponentInterface,
|
|
34
|
+
te as AllowListIncentive,
|
|
35
|
+
Vr as AssetType,
|
|
36
36
|
n as BOOST_CORE_ADDRESS,
|
|
37
37
|
p as BOOST_CORE_ADDRESSES,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
a as BOOST_REGISTRY_ADDRESS,
|
|
39
|
+
o as BOOST_REGISTRY_ADDRESSES,
|
|
40
40
|
m as Boost,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
d as BoostCore,
|
|
42
|
+
We as BoostCoreNoIdentifierEmitted,
|
|
43
|
+
ze as BoostNotFoundError,
|
|
44
44
|
t as BoostRegistry,
|
|
45
|
-
|
|
45
|
+
we as BoostValidatorEOA,
|
|
46
46
|
N as BudgetByComponentInterface,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
ke as BudgetMustAuthorizeBoostCore,
|
|
48
|
+
pe as CGDAIncentive,
|
|
49
|
+
br as CheatCodes,
|
|
50
|
+
X as Contract,
|
|
51
|
+
qe as ContractAddressRequiredError,
|
|
52
|
+
Ye as DecodedArgsError,
|
|
53
|
+
He as DecodedArgsMalformedError,
|
|
54
|
+
K as Deployable,
|
|
55
|
+
je as DeployableAlreadyDeployedError,
|
|
56
|
+
Je as DeployableBuildParametersUnspecifiedError,
|
|
57
|
+
Ke as DeployableMissingPayloadError,
|
|
58
|
+
$ as DeployableTarget,
|
|
59
|
+
re as DeployableTargetWithRBAC,
|
|
60
|
+
Qe as DeployableUnknownOwnerProvidedError,
|
|
61
|
+
Xe as DeployableWagmiConfigurationRequiredError,
|
|
62
|
+
se as ERC20Incentive,
|
|
63
|
+
ge as ERC20VariableCriteriaIncentive,
|
|
64
|
+
Ee as ERC20VariableIncentive,
|
|
65
65
|
f as EventAction,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
l as FEE_DENOMINATOR,
|
|
67
|
+
Ze as FieldActionValidationError,
|
|
68
|
+
$e as FieldValueNotComparableError,
|
|
69
|
+
er as FieldValueUndefinedError,
|
|
70
|
+
C as FilterType,
|
|
71
|
+
rr as FunctionDataDecodeError,
|
|
72
|
+
Ie as IncentiveByComponentInterface,
|
|
73
|
+
ar as IncentiveCriteriaNotFoundError,
|
|
74
|
+
or as IncentiveNotCloneableError,
|
|
75
|
+
tr as InvalidComponentInterfaceError,
|
|
76
|
+
ir as InvalidCriteriaTypeError,
|
|
77
|
+
nr as InvalidNumericalCriteriaError,
|
|
78
|
+
pr as InvalidProtocolChainIdError,
|
|
79
79
|
V as LIST_MANAGER_ROLE,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
lr as
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
80
|
+
Fe as LimitedSignerValidator,
|
|
81
|
+
z as ManagedBudget,
|
|
82
|
+
k as ManagedBudgetRoles,
|
|
83
|
+
_ as ManagedBudgetWithFees,
|
|
84
|
+
dr as MustInitializeBudgetError,
|
|
85
|
+
lr as NoConnectedChainIdError,
|
|
86
|
+
sr as NoContractAddressUponReceiptError,
|
|
87
|
+
mr as NoEventActionStepsProvidedError,
|
|
88
|
+
cr as NoMatchingLogsError,
|
|
89
|
+
D as OpenAllowList,
|
|
90
|
+
Nr as PassthroughAuth,
|
|
91
|
+
ve as PointsIncentive,
|
|
91
92
|
b as PrimitiveType,
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
Ir as RegistryType,
|
|
94
|
+
ae as Roles,
|
|
94
95
|
I as SignatureType,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
Be as SignerValidator,
|
|
97
|
+
F as SimpleAllowList,
|
|
98
|
+
O as SimpleDenyList,
|
|
99
|
+
Dr as StrategyType,
|
|
100
|
+
Er as TooManyEventActionStepsProvidedError,
|
|
101
|
+
Ar as UnknownTransferPayloadSupplied,
|
|
102
|
+
yr as UnparseableAbiParamError,
|
|
103
|
+
gr as UnrecognizedFilterTypeError,
|
|
104
|
+
fr as ValidationAbiMissingError,
|
|
105
|
+
Ne as ValidatorByComponentInterface,
|
|
105
106
|
y as actionFromAddress,
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
x as allowListFromAddress,
|
|
108
|
+
Ur as allowListIncentiveAbi,
|
|
108
109
|
S as anyActionParameter,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
110
|
+
Sr as assertValidAddressByChainId,
|
|
111
|
+
ur as awaitResult,
|
|
112
|
+
Gr as boostCoreAbi,
|
|
113
|
+
Wr as boostRegistryAbi,
|
|
114
|
+
U as budgetFromAddress,
|
|
115
|
+
vr as bytes4,
|
|
116
|
+
zr as cgdaIncentiveAbi,
|
|
117
|
+
_e as decodeClaimData,
|
|
118
|
+
kr as erc20IncentiveAbi,
|
|
119
|
+
qr as erc20VariableCriteriaIncentiveAbi,
|
|
120
|
+
Yr as erc20VariableIncentiveAbi,
|
|
121
|
+
fe as gasRebateIncentiveCriteria,
|
|
122
|
+
Pr as getDeployedContractAddress,
|
|
123
|
+
Rr as getErc20Balance,
|
|
124
|
+
Se as incentiveFromAddress,
|
|
125
|
+
q as isERC1155TransferPayload,
|
|
126
|
+
u as isEventActionPayloadSimple,
|
|
127
|
+
Y as isFungibleTransfer,
|
|
128
|
+
Hr as limitedSignerValidatorAbi,
|
|
129
|
+
jr as managedBudgetAbi,
|
|
130
|
+
Jr as managedBudgetWithFeesAbi,
|
|
131
|
+
Kr as passthroughAuthAbi,
|
|
132
|
+
Qr as pointsIncentiveAbi,
|
|
133
|
+
ie as prepareAllowListIncentivePayload,
|
|
131
134
|
c as prepareBoostPayload,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
de as prepareCGDAIncentivePayload,
|
|
136
|
+
xr as prepareClaimPayload,
|
|
137
|
+
Fr as prepareERC1155Payload,
|
|
138
|
+
Lr as prepareERC1155Transfer,
|
|
139
|
+
me as prepareERC20IncentivePayload,
|
|
137
140
|
Ce as prepareERC20VariableCriteriaIncentivePayload,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
De as
|
|
149
|
-
xe as
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
141
|
+
Ae as prepareERC20VariableIncentivePayload,
|
|
142
|
+
v as prepareEventActionPayload,
|
|
143
|
+
hr as prepareFungiblePayload,
|
|
144
|
+
Or as prepareFungibleTransfer,
|
|
145
|
+
Le as prepareLimitedSignerValidatorClaimDataPayload,
|
|
146
|
+
he as prepareLimitedSignerValidatorInputParams,
|
|
147
|
+
Oe as prepareLimitedSignerValidatorPayload,
|
|
148
|
+
H as prepareManagedBudgetPayload,
|
|
149
|
+
G as prepareManagedBudgetWithFeesPayload,
|
|
150
|
+
Pe as preparePointsIncentivePayload,
|
|
151
|
+
De as prepareSignerValidatorClaimDataPayload,
|
|
152
|
+
xe as prepareSignerValidatorInputParams,
|
|
153
|
+
Te as prepareSignerValidatorPayload,
|
|
154
|
+
L as prepareSimpleAllowListPayload,
|
|
155
|
+
M as prepareSimpleDenyListPayload,
|
|
156
|
+
j as prepareTransfer,
|
|
157
|
+
Mr as prepareTransferPayload,
|
|
158
|
+
Xr as rbacAbi,
|
|
159
|
+
Zr as signerValidatorAbi,
|
|
160
|
+
$r as simpleAllowListAbi,
|
|
161
|
+
ea as simpleDenyListAbi,
|
|
162
|
+
P as transactionSenderClaimant,
|
|
163
|
+
Ue as validatorFromAddress
|
|
160
164
|
};
|
|
161
165
|
//# sourceMappingURL=index.js.map
|
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 o=require("@wagmi/core"),r=require("viem"),A=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||{}),s=(t=>(t[t.ANY_ACTION_PARAM=255]="ANY_ACTION_PARAM",t[t.TX_SENDER_CLAIMANT=255]="TX_SENDER_CLAIMANT",t[t.GAS_REBATE_INCENTIVE=255]="GAS_REBATE_INCENTIVE",t))(s||{});function E(t){return r.slice(r.isHex(t)?r.keccak256(t):r.keccak256(r.toHex(t)),0,4)}async function N(t,a,c){const n=await o.waitForTransactionReceipt(t,{...c,hash:await a});if(!n.contractAddress)throw new A.NoContractAddressUponReceiptError(n);return n.contractAddress}async function l(t,a,c){const{hash:n,result:e}=await a;return await o.waitForTransactionReceipt(t,{...c,hash:n}),e}function f(t,a,c){let n;const e=o.getChainId(t);if(e&&a[e]&&(n=e),c!==void 0?a[c]&&(n=c):e!==void 0&&a[e]&&(n=e),n===void 0){const i=o.getAccount(t);i.chainId!==void 0&&a[i.chainId]&&(n=i.chainId)}if(n===void 0&&(n=11155111),!a[n])throw new A.InvalidProtocolChainIdError(n,Object.keys(a).map(Number));return{chainId:n,address:a[n]}}async function I(t,a,c,n){return await o.readContract(t,{...n,functionName:"balanceOf",address:a,args:[c],abi:[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"}]})}exports.CheatCodes=s;exports.RegistryType=u;exports.assertValidAddressByChainId=f;exports.awaitResult=l;exports.bytes4=E;exports.getDeployedContractAddress=N;exports.getErc20Balance=I;
|
|
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 SimulateContractParameters,\n type WatchContractEventParameters,\n getAccount,\n getChainId,\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 `ERC20VariableCriteriaIncentive`, if the criteria's `fieldIndex` is set to `CheatCodes.GAS_REBATE_INCENTIVE`, will claim an incentive amount equal to the transaction's gas used. */\n GAS_REBATE_INCENTIVE = 255,\n}\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams = 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"],"names":["RegistryType","CheatCodes","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"],"mappings":"2JAoCY,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,EAgGL,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,EAEE,MAAAC,EAAeC,aAAWd,CAAM,EAUtC,GATIa,GAAgBH,EAAiBG,CAAY,IAAaD,EAAAC,GAE1DF,IAAmB,OACjBD,EAAiBC,CAAc,IAAaC,EAAAD,GACvCE,IAAiB,QAEtBH,EAAiBG,CAAY,IAAaD,EAAAC,GAG5CD,IAAY,OAAW,CACnB,MAAAG,EAAeC,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"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../src/utils.ts"],"sourcesContent":["import {\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 `ERC20VariableCriteriaIncentive`, if the criteria's `fieldIndex` is set to `CheatCodes.GAS_REBATE_INCENTIVE`, will claim an incentive amount equal to the transaction's gas used. */\n GAS_REBATE_INCENTIVE = 255,\n}\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams = 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","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":"2JAqCY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,WAAa,CAAb,EAAA,aACAA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YALUA,IAAAA,GAAA,CAAA,CAAA,EAiBAC,GAAAA,IAEVA,EAAAA,EAAA,iBAAmB,GAAnB,EAAA,mBAEAA,EAAAA,EAAA,mBAAqB,GAArB,EAAA,qBAEAA,EAAAA,EAAA,qBAAuB,GAAvB,EAAA,uBANUA,IAAAA,GAAA,CAAA,CAAA,EAgGL,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,EAEE,MAAAC,EAAeC,aAAWd,CAAM,EAUtC,GATIa,GAAgBH,EAAiBG,CAAY,IAAaD,EAAAC,GAE1DF,IAAmB,OACjBD,EAAiBC,CAAc,IAAaC,EAAAD,GACvCE,IAAiB,QAEtBH,EAAiBG,CAAY,IAAaD,EAAAC,GAG5CD,IAAY,OAAW,CACnB,MAAAG,EAAeC,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
CHANGED
|
@@ -141,4 +141,16 @@ export declare function assertValidAddressByChainId(config: Config, addressByCha
|
|
|
141
141
|
chainId: number;
|
|
142
142
|
address: Address;
|
|
143
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* Check an ERC20's balance for a given asset and
|
|
146
|
+
*
|
|
147
|
+
* @public
|
|
148
|
+
* @async
|
|
149
|
+
* @param {Config} [config]
|
|
150
|
+
* @param {Address} [asset]
|
|
151
|
+
* @param {Address} [owner]
|
|
152
|
+
* @param {?ReadParams} [params]
|
|
153
|
+
* @returns {Promise<bigint>} - The erc20 balance
|
|
154
|
+
*/
|
|
155
|
+
export declare function getErc20Balance(config: Config, asset: Address, owner: Address, params?: ReadParams): Promise<bigint>;
|
|
144
156
|
//# 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,0BAA0B,EAC/B,KAAK,4BAA4B,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"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"}
|
package/dist/utils.js
CHANGED
|
@@ -1,46 +1,75 @@
|
|
|
1
|
-
import { waitForTransactionReceipt as
|
|
2
|
-
import { slice as
|
|
3
|
-
import { NoContractAddressUponReceiptError as
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
return
|
|
1
|
+
import { waitForTransactionReceipt as A, getChainId as u, getAccount as e, readContract as f } from "@wagmi/core";
|
|
2
|
+
import { slice as N, isHex as E, keccak256 as i, toHex as I } from "viem";
|
|
3
|
+
import { NoContractAddressUponReceiptError as m, InvalidProtocolChainIdError as w } from "./errors.js";
|
|
4
|
+
var _ = /* @__PURE__ */ ((t) => (t[t.ACTION = 0] = "ACTION", t[t.ALLOW_LIST = 1] = "ALLOW_LIST", t[t.BUDGET = 2] = "BUDGET", t[t.INCENTIVE = 3] = "INCENTIVE", t[t.VALIDATOR = 4] = "VALIDATOR", t))(_ || {}), l = /* @__PURE__ */ ((t) => (t[t.ANY_ACTION_PARAM = 255] = "ANY_ACTION_PARAM", t[t.TX_SENDER_CLAIMANT = 255] = "TX_SENDER_CLAIMANT", t[t.GAS_REBATE_INCENTIVE = 255] = "GAS_REBATE_INCENTIVE", t))(l || {});
|
|
5
|
+
function v(t) {
|
|
6
|
+
return N(E(t) ? i(t) : i(I(t)), 0, 4);
|
|
7
7
|
}
|
|
8
|
-
async function
|
|
9
|
-
const
|
|
10
|
-
...
|
|
11
|
-
hash: await
|
|
8
|
+
async function L(t, a, c) {
|
|
9
|
+
const n = await A(t, {
|
|
10
|
+
...c,
|
|
11
|
+
hash: await a
|
|
12
12
|
});
|
|
13
|
-
if (!
|
|
14
|
-
throw new
|
|
15
|
-
return
|
|
13
|
+
if (!n.contractAddress)
|
|
14
|
+
throw new m(n);
|
|
15
|
+
return n.contractAddress;
|
|
16
16
|
}
|
|
17
|
-
async function
|
|
18
|
-
const { hash:
|
|
19
|
-
return await
|
|
20
|
-
...
|
|
21
|
-
hash:
|
|
22
|
-
}),
|
|
17
|
+
async function b(t, a, c) {
|
|
18
|
+
const { hash: n, result: o } = await a;
|
|
19
|
+
return await A(t, {
|
|
20
|
+
...c,
|
|
21
|
+
hash: n
|
|
22
|
+
}), o;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
let
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
|
|
24
|
+
function D(t, a, c) {
|
|
25
|
+
let n;
|
|
26
|
+
const o = u(t);
|
|
27
|
+
if (o && a[o] && (n = o), c !== void 0 ? a[c] && (n = c) : o !== void 0 && a[o] && (n = o), n === void 0) {
|
|
28
|
+
const r = e(t);
|
|
29
|
+
r.chainId !== void 0 && a[r.chainId] && (n = r.chainId);
|
|
30
30
|
}
|
|
31
|
-
if (
|
|
31
|
+
if (n === void 0 && (n = 11155111), !a[n])
|
|
32
32
|
throw new w(
|
|
33
|
-
|
|
34
|
-
Object.keys(
|
|
33
|
+
n,
|
|
34
|
+
Object.keys(a).map(Number)
|
|
35
35
|
);
|
|
36
|
-
return { chainId:
|
|
36
|
+
return { chainId: n, address: a[n] };
|
|
37
|
+
}
|
|
38
|
+
async function V(t, a, c, n) {
|
|
39
|
+
return await f(t, {
|
|
40
|
+
...n,
|
|
41
|
+
functionName: "balanceOf",
|
|
42
|
+
address: a,
|
|
43
|
+
args: [c],
|
|
44
|
+
abi: [
|
|
45
|
+
{
|
|
46
|
+
constant: !0,
|
|
47
|
+
inputs: [
|
|
48
|
+
{
|
|
49
|
+
name: "_owner",
|
|
50
|
+
type: "address"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
name: "balanceOf",
|
|
54
|
+
outputs: [
|
|
55
|
+
{
|
|
56
|
+
name: "balance",
|
|
57
|
+
type: "uint256"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
stateMutability: "view",
|
|
61
|
+
type: "function"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
});
|
|
37
65
|
}
|
|
38
66
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
67
|
+
l as CheatCodes,
|
|
68
|
+
_ as RegistryType,
|
|
69
|
+
D as assertValidAddressByChainId,
|
|
70
|
+
b as awaitResult,
|
|
71
|
+
v as bytes4,
|
|
72
|
+
L as getDeployedContractAddress,
|
|
73
|
+
V as getErc20Balance
|
|
45
74
|
};
|
|
46
75
|
//# sourceMappingURL=utils.js.map
|