@boostxyz/sdk 0.0.0-alpha.12 → 0.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.js +1 -1
- package/dist/Actions/ContractAction.d.ts +2 -2
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +2 -2
- 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 +2 -2
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +47 -43
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +2 -2
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +2 -2
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +23 -19
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +2 -2
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +6 -5
- package/dist/AllowLists/SimpleDenyList.js.map +1 -1
- 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 +27 -5
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +438 -347
- 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 +26 -5
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +125 -64
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +1 -1
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts +2 -2
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +41 -37
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/SimpleBudget.d.ts +2 -2
- package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +2 -2
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts +6 -6
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +22 -17
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +2 -2
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +17 -13
- 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 +14 -2
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +27 -23
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +2 -2
- 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 +2 -2
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +17 -13
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +2 -2
- 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.js +32 -28
- 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 +2 -2
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +13 -9
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-IJ9Ipya7.js → SimpleDenyList-C21O9Yfi.js} +23 -19
- package/dist/SimpleDenyList-C21O9Yfi.js.map +1 -0
- package/dist/SimpleDenyList-DeJRKD2D.cjs +2 -0
- package/dist/{SimpleDenyList-IJ9Ipya7.js.map → SimpleDenyList-DeJRKD2D.cjs.map} +1 -1
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +2 -2
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +18 -14
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +1 -1
- package/dist/deployments-BvFcK_eR.js +40 -0
- package/dist/deployments-BvFcK_eR.js.map +1 -0
- package/dist/deployments-Ho4PnGCS.cjs +2 -0
- package/dist/deployments-Ho4PnGCS.cjs.map +1 -0
- package/dist/deployments.json +38 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +70 -54
- package/dist/errors.js.map +1 -1
- package/dist/{generated-HGddZXHJ.js → generated-LpgSHrH0.js} +130 -90
- package/dist/generated-LpgSHrH0.js.map +1 -0
- package/dist/generated-tq_HLZJ0.cjs +3 -0
- package/dist/generated-tq_HLZJ0.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +113 -109
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +25 -11
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -23
- package/dist/utils.js.map +1 -1
- package/package.json +6 -5
- package/src/Actions/ContractAction.ts +5 -3
- package/src/Actions/ERC721MintAction.ts +5 -3
- package/src/Actions/EventAction.ts +6 -2
- package/src/AllowLists/AllowList.test.ts +1 -1
- package/src/AllowLists/SimpleAllowList.ts +6 -3
- package/src/AllowLists/SimpleDenyList.ts +6 -3
- package/src/BoostCore.test.ts +31 -91
- package/src/BoostCore.ts +137 -34
- package/src/BoostRegistry.ts +89 -21
- package/src/Budgets/ManagedBudget.ts +6 -4
- package/src/Budgets/SimpleBudget.ts +4 -3
- package/src/Budgets/VestingBudget.ts +4 -3
- package/src/Deployable/DeployableTarget.ts +22 -11
- package/src/Incentives/AllowListIncentive.ts +6 -3
- package/src/Incentives/CGDAIncentive.ts +6 -3
- package/src/Incentives/ERC1155Incentive.ts +4 -3
- package/src/Incentives/ERC20Incentive.ts +6 -3
- package/src/Incentives/ERC20VariableIncentive.ts +6 -3
- package/src/Incentives/PointsIncentive.ts +6 -3
- package/src/Validators/SignerValidator.ts +6 -3
- package/src/errors.ts +17 -1
- package/src/utils.ts +60 -11
- package/dist/SimpleDenyList-CqT0BMP7.cjs +0 -2
- package/dist/SimpleDenyList-CqT0BMP7.cjs.map +0 -1
- package/dist/generated-HGddZXHJ.js.map +0 -1
- package/dist/generated-wKBNvm48.cjs +0 -3
- package/dist/generated-wKBNvm48.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./BoostRegistry.cjs"),a=require("./BoostCore.cjs"),c=require("./Boost.cjs"),E=require("./Actions/Action.cjs"),o=require("./Actions/EventAction.cjs"),d=require("./AllowLists/AllowList.cjs"),s=require("./AllowLists/SimpleAllowList.cjs"),A=require("./SimpleDenyList-DeJRKD2D.cjs"),y=require("./Budgets/Budget.cjs"),t=require("./Budgets/ManagedBudget.cjs"),v=require("./Deployable/Deployable.cjs"),m=require("./Deployable/Contract.cjs"),D=require("./Deployable/DeployableTarget.cjs"),u=require("./Incentives/AllowListIncentive.cjs"),C=require("./Incentives/CGDAIncentive.cjs"),I=require("./Incentives/ERC20Incentive.cjs"),p=require("./Incentives/Incentive.cjs"),S=require("./Incentives/PointsIncentive.cjs"),i=require("./Validators/SignerValidator.cjs"),g=require("./Validators/Validator.cjs"),e=require("./errors.cjs"),n=require("./utils.cjs"),P=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-tq_HLZJ0.cjs");exports.BOOST_REGISTRY_ADDRESS=l.BOOST_REGISTRY_ADDRESS;exports.BOOST_REGISTRY_ADDRESSES=l.BOOST_REGISTRY_ADDRESSES;exports.BoostRegistry=l.BoostRegistry;exports.BOOST_CORE_ADDRESS=a.BOOST_CORE_ADDRESS;exports.BOOST_CORE_ADDRESSES=a.BOOST_CORE_ADDRESSES;exports.BOOST_CORE_CLAIM_FEE=a.BOOST_CORE_CLAIM_FEE;exports.BoostCore=a.BoostCore;exports.Boost=c.Boost;exports.prepareBoostPayload=c.prepareBoostPayload;exports.ActionByComponentInterface=E.ActionByComponentInterface;exports.actionFromAddress=E.actionFromAddress;exports.EventAction=o.EventAction;exports.FilterType=o.FilterType;exports.PrimitiveType=o.PrimitiveType;exports.SignatureType=o.SignatureType;exports.isEventActionPayloadSimple=o.isEventActionPayloadSimple;exports.prepareEventActionPayload=o.prepareEventActionPayload;exports.AllowListByComponentInterface=d.AllowListByComponentInterface;exports.OpenAllowList=d.OpenAllowList;exports.allowListFromAddress=d.allowListFromAddress;exports.LIST_MANAGER_ROLE=s.LIST_MANAGER_ROLE;exports.SimpleAllowList=s.SimpleAllowList;exports.prepareSimpleAllowListPayload=s.prepareSimpleAllowListPayload;exports.SimpleDenyList=A.SimpleDenyList;exports.prepareSimpleDenyListPayload=A.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=y.BudgetByComponentInterface;exports.budgetFromAddress=y.budgetFromAddress;exports.ManagedBudget=t.ManagedBudget;exports.ManagedBudgetRoles=t.ManagedBudgetRoles;exports.isERC1155TransferPayload=t.isERC1155TransferPayload;exports.isFungibleTransfer=t.isFungibleTransfer;exports.prepareManagedBudgetPayload=t.prepareManagedBudgetPayload;exports.prepareTransfer=t.prepareTransfer;exports.Deployable=v.Deployable;exports.Contract=m.Contract;exports.DeployableTarget=D.DeployableTarget;exports.AllowListIncentive=u.AllowListIncentive;exports.prepareAllowListIncentivePayload=u.prepareAllowListIncentivePayload;exports.CGDAIncentive=C.CGDAIncentive;exports.prepareCGDAIncentivePayload=C.prepareCGDAIncentivePayload;exports.ERC20Incentive=I.ERC20Incentive;exports.prepareERC20IncentivePayload=I.prepareERC20IncentivePayload;exports.ERC20VariableIncentive=p.ERC20VariableIncentive;exports.IncentiveByComponentInterface=p.IncentiveByComponentInterface;exports.incentiveFromAddress=p.incentiveFromAddress;exports.PointsIncentive=S.PointsIncentive;exports.preparePointsIncentivePayload=S.preparePointsIncentivePayload;exports.SignerValidator=i.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=i.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=i.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=i.prepareSignerValidatorPayload;exports.ValidatorByComponentInterface=g.ValidatorByComponentInterface;exports.validatorFromAddress=g.validatorFromAddress;exports.BoostCoreNoIdentifierEmitted=e.BoostCoreNoIdentifierEmitted;exports.BudgetMustAuthorizeBoostCore=e.BudgetMustAuthorizeBoostCore;exports.ContractAddressRequiredError=e.ContractAddressRequiredError;exports.DecodedArgsMalformedError=e.DecodedArgsMalformedError;exports.DeployableAlreadyDeployedError=e.DeployableAlreadyDeployedError;exports.DeployableBuildParametersUnspecifiedError=e.DeployableBuildParametersUnspecifiedError;exports.DeployableMissingPayloadError=e.DeployableMissingPayloadError;exports.DeployableUnknownOwnerProvidedError=e.DeployableUnknownOwnerProvidedError;exports.DeployableWagmiConfigurationRequiredError=e.DeployableWagmiConfigurationRequiredError;exports.FieldActionValidationError=e.FieldActionValidationError;exports.FieldValueNotComparableError=e.FieldValueNotComparableError;exports.FieldValueUndefinedError=e.FieldValueUndefinedError;exports.FunctionDataDecodeError=e.FunctionDataDecodeError;exports.IncentiveNotCloneableError=e.IncentiveNotCloneableError;exports.InvalidComponentInterfaceError=e.InvalidComponentInterfaceError;exports.InvalidNumericalCriteriaError=e.InvalidNumericalCriteriaError;exports.InvalidProtocolChainIdError=e.InvalidProtocolChainIdError;exports.MustInitializeBudgetError=e.MustInitializeBudgetError;exports.NoConnectedChainIdError=e.NoConnectedChainIdError;exports.NoContractAddressUponReceiptError=e.NoContractAddressUponReceiptError;exports.NoEventActionStepsProvidedError=e.NoEventActionStepsProvidedError;exports.TooManyEventActionStepsProvidedError=e.TooManyEventActionStepsProvidedError;exports.UnknownTransferPayloadSupplied=e.UnknownTransferPayloadSupplied;exports.UnparseableAbiParamError=e.UnparseableAbiParamError;exports.UnrecognizedFilterTypeError=e.UnrecognizedFilterTypeError;exports.RegistryType=n.RegistryType;exports.assertValidAddressByChainId=n.assertValidAddressByChainId;exports.awaitResult=n.awaitResult;exports.bytes4=n.bytes4;exports.getDeployedContractAddress=n.getDeployedContractAddress;exports.PassthroughAuth=P.PassthroughAuth;exports.allowListIncentiveAbi=r.A;exports.boostCoreAbi=r.d;exports.cgdaIncentiveAbi=r.v;exports.erc20IncentiveAbi=r.f;exports.managedBudgetAbi=r.p;exports.passthroughAuthAbi=r.ze;exports.pointsIncentiveAbi=r.l;exports.signerValidatorAbi=r.M;exports.simpleAllowListAbi=r.T;exports.simpleDenyListAbi=r.S;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,117 +1,121 @@
|
|
|
1
|
-
import { BOOST_REGISTRY_ADDRESS as o,
|
|
2
|
-
import { BOOST_CORE_ADDRESS as
|
|
3
|
-
import { Boost as
|
|
4
|
-
import { ActionByComponentInterface as
|
|
5
|
-
import { EventAction as
|
|
6
|
-
import { AllowListByComponentInterface as
|
|
7
|
-
import { LIST_MANAGER_ROLE as
|
|
8
|
-
import { S as
|
|
9
|
-
import { BudgetByComponentInterface as M, budgetFromAddress as
|
|
10
|
-
import { ManagedBudget as
|
|
11
|
-
import { Deployable as
|
|
12
|
-
import { Contract as
|
|
13
|
-
import { DeployableTarget as
|
|
14
|
-
import { AllowListIncentive as
|
|
15
|
-
import { CGDAIncentive as
|
|
16
|
-
import { ERC20Incentive as
|
|
17
|
-
import { ERC20VariableIncentive as
|
|
18
|
-
import { PointsIncentive as
|
|
19
|
-
import { SignerValidator as
|
|
20
|
-
import { ValidatorByComponentInterface as
|
|
21
|
-
import { BoostCoreNoIdentifierEmitted as
|
|
22
|
-
import { RegistryType as
|
|
23
|
-
import { PassthroughAuth as
|
|
24
|
-
import { A as
|
|
1
|
+
import { BOOST_REGISTRY_ADDRESS as o, BOOST_REGISTRY_ADDRESSES as t, BoostRegistry as a } from "./BoostRegistry.js";
|
|
2
|
+
import { BOOST_CORE_ADDRESS as n, BOOST_CORE_ADDRESSES as l, BOOST_CORE_CLAIM_FEE as p, BoostCore as d } from "./BoostCore.js";
|
|
3
|
+
import { Boost as m, prepareBoostPayload as A } from "./Boost.js";
|
|
4
|
+
import { ActionByComponentInterface as c, actionFromAddress as y } from "./Actions/Action.js";
|
|
5
|
+
import { EventAction as I, FilterType as C, PrimitiveType as S, SignatureType as g, isEventActionPayloadSimple as v, prepareEventActionPayload as u } from "./Actions/EventAction.js";
|
|
6
|
+
import { AllowListByComponentInterface as D, OpenAllowList as P, allowListFromAddress as B } from "./AllowLists/AllowList.js";
|
|
7
|
+
import { LIST_MANAGER_ROLE as R, SimpleAllowList as T, prepareSimpleAllowListPayload as O } from "./AllowLists/SimpleAllowList.js";
|
|
8
|
+
import { S as w, p as F } from "./SimpleDenyList-C21O9Yfi.js";
|
|
9
|
+
import { BudgetByComponentInterface as M, budgetFromAddress as V } from "./Budgets/Budget.js";
|
|
10
|
+
import { ManagedBudget as N, ManagedBudgetRoles as U, isERC1155TransferPayload as G, isFungibleTransfer as z, prepareManagedBudgetPayload as k, prepareTransfer as q } from "./Budgets/ManagedBudget.js";
|
|
11
|
+
import { Deployable as W } from "./Deployable/Deployable.js";
|
|
12
|
+
import { Contract as H } from "./Deployable/Contract.js";
|
|
13
|
+
import { DeployableTarget as K } from "./Deployable/DeployableTarget.js";
|
|
14
|
+
import { AllowListIncentive as X, prepareAllowListIncentivePayload as Z } from "./Incentives/AllowListIncentive.js";
|
|
15
|
+
import { CGDAIncentive as ee, prepareCGDAIncentivePayload as re } from "./Incentives/CGDAIncentive.js";
|
|
16
|
+
import { ERC20Incentive as te, prepareERC20IncentivePayload as ae } from "./Incentives/ERC20Incentive.js";
|
|
17
|
+
import { ERC20VariableIncentive as ne, IncentiveByComponentInterface as le, incentiveFromAddress as pe } from "./Incentives/Incentive.js";
|
|
18
|
+
import { PointsIncentive as se, preparePointsIncentivePayload as me } from "./Incentives/PointsIncentive.js";
|
|
19
|
+
import { SignerValidator as Ee, prepareSignerValidatorClaimDataPayload as ce, prepareSignerValidatorInputParams as ye, prepareSignerValidatorPayload as fe } from "./Validators/SignerValidator.js";
|
|
20
|
+
import { ValidatorByComponentInterface as Ce, validatorFromAddress as Se } from "./Validators/Validator.js";
|
|
21
|
+
import { BoostCoreNoIdentifierEmitted as ve, BudgetMustAuthorizeBoostCore as ue, ContractAddressRequiredError as be, DecodedArgsMalformedError as De, DeployableAlreadyDeployedError as Pe, DeployableBuildParametersUnspecifiedError as Be, DeployableMissingPayloadError as xe, DeployableUnknownOwnerProvidedError as Re, DeployableWagmiConfigurationRequiredError as Te, FieldActionValidationError as Oe, FieldValueNotComparableError as Le, FieldValueUndefinedError as we, FunctionDataDecodeError as Fe, IncentiveNotCloneableError as _e, InvalidComponentInterfaceError as Me, InvalidNumericalCriteriaError as Ve, InvalidProtocolChainIdError as he, MustInitializeBudgetError as Ne, NoConnectedChainIdError as Ue, NoContractAddressUponReceiptError as Ge, NoEventActionStepsProvidedError as ze, TooManyEventActionStepsProvidedError as ke, UnknownTransferPayloadSupplied as qe, UnparseableAbiParamError as Ye, UnrecognizedFilterTypeError as We } from "./errors.js";
|
|
22
|
+
import { RegistryType as He, assertValidAddressByChainId as Je, awaitResult as Ke, bytes4 as Qe, getDeployedContractAddress as Xe } from "./utils.js";
|
|
23
|
+
import { PassthroughAuth as $e } from "./Auth/PassthroughAuth.js";
|
|
24
|
+
import { A as rr, d as or, v as tr, f as ar, p as ir, z as nr, l as lr, M as pr, T as dr, S as sr } from "./generated-LpgSHrH0.js";
|
|
25
25
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
c as ActionByComponentInterface,
|
|
27
|
+
D as AllowListByComponentInterface,
|
|
28
|
+
X as AllowListIncentive,
|
|
29
|
+
n as BOOST_CORE_ADDRESS,
|
|
30
|
+
l as BOOST_CORE_ADDRESSES,
|
|
31
|
+
p as BOOST_CORE_CLAIM_FEE,
|
|
31
32
|
o as BOOST_REGISTRY_ADDRESS,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
t as BOOST_REGISTRY_ADDRESSES,
|
|
34
|
+
m as Boost,
|
|
35
|
+
d as BoostCore,
|
|
36
|
+
ve as BoostCoreNoIdentifierEmitted,
|
|
37
|
+
a as BoostRegistry,
|
|
36
38
|
M as BudgetByComponentInterface,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
ue as BudgetMustAuthorizeBoostCore,
|
|
40
|
+
ee as CGDAIncentive,
|
|
41
|
+
H as Contract,
|
|
42
|
+
be as ContractAddressRequiredError,
|
|
43
|
+
De as DecodedArgsMalformedError,
|
|
44
|
+
W as Deployable,
|
|
43
45
|
Pe as DeployableAlreadyDeployedError,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
Be as DeployableBuildParametersUnspecifiedError,
|
|
47
|
+
xe as DeployableMissingPayloadError,
|
|
48
|
+
K as DeployableTarget,
|
|
49
|
+
Re as DeployableUnknownOwnerProvidedError,
|
|
50
|
+
Te as DeployableWagmiConfigurationRequiredError,
|
|
51
|
+
te as ERC20Incentive,
|
|
52
|
+
ne as ERC20VariableIncentive,
|
|
53
|
+
I as EventAction,
|
|
54
|
+
Oe as FieldActionValidationError,
|
|
55
|
+
Le as FieldValueNotComparableError,
|
|
56
|
+
we as FieldValueUndefinedError,
|
|
57
|
+
C as FilterType,
|
|
58
|
+
Fe as FunctionDataDecodeError,
|
|
59
|
+
le as IncentiveByComponentInterface,
|
|
60
|
+
_e as IncentiveNotCloneableError,
|
|
59
61
|
Me as InvalidComponentInterfaceError,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
Ve as InvalidNumericalCriteriaError,
|
|
63
|
+
he as InvalidProtocolChainIdError,
|
|
64
|
+
R as LIST_MANAGER_ROLE,
|
|
65
|
+
N as ManagedBudget,
|
|
66
|
+
U as ManagedBudgetRoles,
|
|
67
|
+
Ne as MustInitializeBudgetError,
|
|
68
|
+
Ue as NoConnectedChainIdError,
|
|
69
|
+
Ge as NoContractAddressUponReceiptError,
|
|
70
|
+
ze as NoEventActionStepsProvidedError,
|
|
67
71
|
P as OpenAllowList,
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
72
|
+
$e as PassthroughAuth,
|
|
73
|
+
se as PointsIncentive,
|
|
74
|
+
S as PrimitiveType,
|
|
75
|
+
He as RegistryType,
|
|
76
|
+
g as SignatureType,
|
|
77
|
+
Ee as SignerValidator,
|
|
78
|
+
T as SimpleAllowList,
|
|
79
|
+
w as SimpleDenyList,
|
|
80
|
+
ke as TooManyEventActionStepsProvidedError,
|
|
81
|
+
qe as UnknownTransferPayloadSupplied,
|
|
82
|
+
Ye as UnparseableAbiParamError,
|
|
83
|
+
We as UnrecognizedFilterTypeError,
|
|
84
|
+
Ce as ValidatorByComponentInterface,
|
|
85
|
+
y as actionFromAddress,
|
|
86
|
+
B as allowListFromAddress,
|
|
87
|
+
rr as allowListIncentiveAbi,
|
|
88
|
+
Je as assertValidAddressByChainId,
|
|
89
|
+
Ke as awaitResult,
|
|
90
|
+
or as boostCoreAbi,
|
|
91
|
+
V as budgetFromAddress,
|
|
92
|
+
Qe as bytes4,
|
|
93
|
+
tr as cgdaIncentiveAbi,
|
|
94
|
+
ar as erc20IncentiveAbi,
|
|
95
|
+
Xe as getDeployedContractAddress,
|
|
96
|
+
pe as incentiveFromAddress,
|
|
97
|
+
G as isERC1155TransferPayload,
|
|
98
|
+
v as isEventActionPayloadSimple,
|
|
99
|
+
z as isFungibleTransfer,
|
|
100
|
+
ir as managedBudgetAbi,
|
|
101
|
+
nr as passthroughAuthAbi,
|
|
102
|
+
lr as pointsIncentiveAbi,
|
|
103
|
+
Z as prepareAllowListIncentivePayload,
|
|
104
|
+
A as prepareBoostPayload,
|
|
105
|
+
re as prepareCGDAIncentivePayload,
|
|
106
|
+
ae as prepareERC20IncentivePayload,
|
|
107
|
+
u as prepareEventActionPayload,
|
|
108
|
+
k as prepareManagedBudgetPayload,
|
|
109
|
+
me as preparePointsIncentivePayload,
|
|
110
|
+
ce as prepareSignerValidatorClaimDataPayload,
|
|
111
|
+
ye as prepareSignerValidatorInputParams,
|
|
112
|
+
fe as prepareSignerValidatorPayload,
|
|
113
|
+
O as prepareSimpleAllowListPayload,
|
|
114
|
+
F as prepareSimpleDenyListPayload,
|
|
115
|
+
q as prepareTransfer,
|
|
116
|
+
pr as signerValidatorAbi,
|
|
117
|
+
dr as simpleAllowListAbi,
|
|
118
|
+
sr as simpleDenyListAbi,
|
|
119
|
+
Se as validatorFromAddress
|
|
116
120
|
};
|
|
117
121
|
//# sourceMappingURL=index.js.map
|
package/dist/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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 {unknown}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * Given a wagmi config and a map of chain id's to addresses, determine an address/chainId combo that maps to the currently connected chain id, or throw a typed error.\n *\n * @export\n * @param {Config} config\n * @param {Record<string, Address>} addressByChainId\n * @param {number} desiredChainId\n * @returns {{ chainId: number, address: Address }}\n * @throws {@link InvalidProtocolChainIdError}\n */\nexport function assertValidAddressByChainId(\n config: Config,\n addressByChainId: Record<number, Address>,\n desiredChainId?: number,\n): { chainId: number; address: Address } {\n let chainId: number | undefined = undefined;\n const wagmiAccount = getAccount(config);\n // if manually providing a chain id for some contract operation, try to use it\n if (desiredChainId !== undefined) {\n if (addressByChainId[desiredChainId]) chainId = desiredChainId;\n } else if (wagmiAccount.chainId !== undefined) {\n // otherwise if we can get the current chain id off the connected account and it matches one of ours, use it\n if (addressByChainId[wagmiAccount.chainId]) chainId = wagmiAccount.chainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const client = getClient(config);\n if (client?.chain.id && addressByChainId[client?.chain.id])\n chainId = client.chain.id;\n }\n // if chainId is STILL undefined, use our default addresses\n // TODO: update this when on prod network\n if (chainId === undefined) chainId = Number(__DEFAULT_CHAIN_ID__);\n if (!addressByChainId[chainId])\n throw new InvalidProtocolChainIdError(\n chainId,\n Object.keys(addressByChainId).map(Number),\n );\n // biome-ignore lint/style/noNonNullAssertion: this type should be narrowed by the above statement but isn't?\n return { chainId, address: addressByChainId[chainId]! };\n}\n"],"names":["RegistryType","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiAccount","getAccount","client","getClient","InvalidProtocolChainIdError"],"mappings":"2JAqCY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,WAAa,CAAb,EAAA,aACAA,EAAAA,EAAA,OAAS,CAAT,EAAA,SACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YACAA,EAAAA,EAAA,UAAY,CAAZ,EAAA,YALUA,IAAAA,GAAA,CAAA,CAAA,EA2GL,SAASC,EAAOC,EAAe,CACpC,OAAOC,EAAM,MAAAC,EAAA,MAAMF,CAAK,EAAIG,EAAU,UAAAH,CAAK,EAAIG,EAAA,UAAUC,EAAM,MAAAJ,CAAK,CAAC,EAAG,EAAG,CAAC,CAC9E,CAasB,eAAAK,EACpBC,EACAC,EACAC,EACA,CACM,MAAAC,EAAU,MAAMC,EAAA,0BAA0BJ,EAAQ,CACtD,GAAGE,EACH,KAAM,MAAMD,CAAA,CACb,EACD,GAAI,CAACE,EAAQ,gBACL,MAAA,IAAIE,EAAAA,kCAAkCF,CAAO,EACrD,OAAOA,EAAQ,eACjB,CAsBsB,eAAAG,EACpBN,EACAO,EACAL,EACiB,CACjB,KAAM,CAAE,KAAAD,EAAM,OAAAO,CAAO,EAAI,MAAMD,EAC/B,aAAMH,EAAAA,0BAA0BJ,EAAQ,CACtC,GAAGE,EACH,KAAAD,CAAA,CACD,EACMO,CACT,CAYgB,SAAAC,EACdT,EACAU,EACAC,EACuC,CACvC,IAAIC,EACE,MAAAC,EAAeC,aAAWd,CAAM,EAStC,GAPIW,IAAmB,OACjBD,EAAiBC,CAAc,IAAaC,EAAAD,GACvCE,EAAa,UAAY,QAE9BH,EAAiBG,EAAa,OAAO,IAAGD,EAAUC,EAAa,SAGjED,IAAY,OAAW,CACnB,MAAAG,EAASC,YAAUhB,CAAM,EAC3Be,GAAA,MAAAA,EAAQ,MAAM,IAAML,EAAiBK,GAAA,YAAAA,EAAQ,MAAM,EAAE,IACvDH,EAAUG,EAAO,MAAM,GAC3B,CAII,GADAH,IAAY,SAAWA,EAAiB,UACxC,CAACF,EAAiBE,CAAO,EAC3B,MAAM,IAAIK,EAAA,4BACRL,EACA,OAAO,KAAKF,CAAgB,EAAE,IAAI,MAAM,CAAA,EAG5C,MAAO,CAAE,QAAAE,EAAS,QAASF,EAAiBE,CAAO,CAAG,CACxD"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { type Config, type ReadContractParameters, type WatchContractEventParameters, type WriteContractParameters } from '@wagmi/core';
|
|
2
2
|
import type { ExtractAbiEvent } from 'abitype';
|
|
3
|
-
import type { Abi, AbiEvent, ContractEventName, ContractFunctionName, GetLogsParameters, Hash, Log, WaitForTransactionReceiptParameters } from 'viem';
|
|
3
|
+
import type { Abi, AbiEvent, Address, ContractEventName, ContractFunctionName, GetLogsParameters, Hash, Log, WaitForTransactionReceiptParameters } from 'viem';
|
|
4
4
|
export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
5
|
+
/**
|
|
6
|
+
* Enum encapsulating all the different types of targets used in the Boost V2 Protocol.
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @enum {number}
|
|
10
|
+
*/
|
|
11
|
+
export declare enum RegistryType {
|
|
12
|
+
ACTION = 0,
|
|
13
|
+
ALLOW_LIST = 1,
|
|
14
|
+
BUDGET = 2,
|
|
15
|
+
INCENTIVE = 3,
|
|
16
|
+
VALIDATOR = 4
|
|
17
|
+
}
|
|
5
18
|
/**
|
|
6
19
|
* Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.
|
|
7
20
|
* See (writeContract)[https://viem.sh/docs/contract/writeContract]
|
|
@@ -11,7 +24,7 @@ export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
|
11
24
|
* @template {Abi} abi
|
|
12
25
|
* @template {ContractFunctionName<abi>} functionName
|
|
13
26
|
*/
|
|
14
|
-
export type WriteParams<abi extends Abi, functionName extends ContractFunctionName<abi>> = Partial<Omit<WriteContractParameters<abi, functionName>, 'address' | 'args' | 'functionName' | 'abi'>>;
|
|
27
|
+
export type WriteParams<abi extends Abi = Abi, functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>> = Partial<Omit<WriteContractParameters<abi, functionName>, 'address' | 'args' | 'functionName' | 'abi'>>;
|
|
15
28
|
/**
|
|
16
29
|
* Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.
|
|
17
30
|
* See (readContract)[https://viem.sh/docs/contract/readContract]
|
|
@@ -101,16 +114,17 @@ export type HashAndSimulatedResult<T = unknown> = {
|
|
|
101
114
|
*/
|
|
102
115
|
export declare function awaitResult<Result = unknown>(config: Config, hashPromise: Promise<HashAndSimulatedResult<Result>>, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<Result>;
|
|
103
116
|
/**
|
|
104
|
-
*
|
|
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"}
|
package/dist/utils.js
CHANGED
|
@@ -1,30 +1,45 @@
|
|
|
1
|
-
import { waitForTransactionReceipt as
|
|
2
|
-
import { slice as
|
|
3
|
-
import { NoContractAddressUponReceiptError as
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { waitForTransactionReceipt as f, getAccount as A, getClient as u } from "@wagmi/core";
|
|
2
|
+
import { slice as e, isHex as w, keccak256 as i, toHex as m } from "viem";
|
|
3
|
+
import { NoContractAddressUponReceiptError as I, InvalidProtocolChainIdError as s } from "./errors.js";
|
|
4
|
+
var N = /* @__PURE__ */ ((o) => (o[o.ACTION = 0] = "ACTION", o[o.ALLOW_LIST = 1] = "ALLOW_LIST", o[o.BUDGET = 2] = "BUDGET", o[o.INCENTIVE = 3] = "INCENTIVE", o[o.VALIDATOR = 4] = "VALIDATOR", o))(N || {});
|
|
5
|
+
function L(o) {
|
|
6
|
+
return e(w(o) ? i(o) : i(m(o)), 0, 4);
|
|
6
7
|
}
|
|
7
|
-
async function
|
|
8
|
-
const
|
|
9
|
-
...
|
|
10
|
-
hash: await
|
|
8
|
+
async function l(o, c, n) {
|
|
9
|
+
const t = await f(o, {
|
|
10
|
+
...n,
|
|
11
|
+
hash: await c
|
|
11
12
|
});
|
|
12
|
-
if (!
|
|
13
|
-
throw new
|
|
14
|
-
return
|
|
13
|
+
if (!t.contractAddress)
|
|
14
|
+
throw new I(t);
|
|
15
|
+
return t.contractAddress;
|
|
15
16
|
}
|
|
16
|
-
async function
|
|
17
|
-
const { hash:
|
|
18
|
-
return await
|
|
19
|
-
...
|
|
20
|
-
hash:
|
|
21
|
-
}),
|
|
17
|
+
async function v(o, c, n) {
|
|
18
|
+
const { hash: t, result: a } = await c;
|
|
19
|
+
return await f(o, {
|
|
20
|
+
...n,
|
|
21
|
+
hash: t
|
|
22
|
+
}), a;
|
|
23
|
+
}
|
|
24
|
+
function O(o, c, n) {
|
|
25
|
+
let t;
|
|
26
|
+
const a = A(o);
|
|
27
|
+
if (n !== void 0 ? c[n] && (t = n) : a.chainId !== void 0 && c[a.chainId] && (t = a.chainId), t === void 0) {
|
|
28
|
+
const r = u(o);
|
|
29
|
+
r != null && r.chain.id && c[r == null ? void 0 : r.chain.id] && (t = r.chain.id);
|
|
30
|
+
}
|
|
31
|
+
if (t === void 0 && (t = 11155111), !c[t])
|
|
32
|
+
throw new s(
|
|
33
|
+
t,
|
|
34
|
+
Object.keys(c).map(Number)
|
|
35
|
+
);
|
|
36
|
+
return { chainId: t, address: c[t] };
|
|
22
37
|
}
|
|
23
|
-
var i = /* @__PURE__ */ ((t) => (t[t.ACTION = 0] = "ACTION", t[t.ALLOW_LIST = 1] = "ALLOW_LIST", t[t.BUDGET = 2] = "BUDGET", t[t.INCENTIVE = 3] = "INCENTIVE", t[t.VALIDATOR = 4] = "VALIDATOR", t))(i || {});
|
|
24
38
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
N as RegistryType,
|
|
40
|
+
O as assertValidAddressByChainId,
|
|
41
|
+
v as awaitResult,
|
|
42
|
+
L as bytes4,
|
|
43
|
+
l as getDeployedContractAddress
|
|
29
44
|
};
|
|
30
45
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport { NoContractAddressUponReceiptError } from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {unknown}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n"],"names":["bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","RegistryType"],"mappings":";;;AA2HO,SAASA,EAAOC,GAAe;AACpC,SAAOC,EAAMC,EAAMF,CAAK,IAAIG,EAAUH,CAAK,IAAIG,EAAUC,EAAMJ,CAAK,CAAC,GAAG,GAAG,CAAC;AAC9E;AAasB,eAAAK,EACpBC,GACAC,GACAC,GACA;AACM,QAAAC,IAAU,MAAMC,EAA0BJ,GAAQ;AAAA,IACtD,GAAGE;AAAA,IACH,MAAM,MAAMD;AAAA,EAAA,CACb;AACD,MAAI,CAACE,EAAQ;AACL,UAAA,IAAIE,EAAkCF,CAAO;AACrD,SAAOA,EAAQ;AACjB;AAsBsB,eAAAG,EACpBN,GACAO,GACAL,GACiB;AACjB,QAAM,EAAE,MAAAD,GAAM,QAAAO,EAAO,IAAI,MAAMD;AAC/B,eAAMH,EAA0BJ,GAAQ;AAAA,IACtC,GAAGE;AAAA,IACH,MAAAD;AAAA,EAAA,CACD,GACMO;AACT;AAQY,IAAAC,sBAAAA,OACVA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,aAAa,CAAb,IAAA,cACAA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aALUA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n getAccount,\n getClient,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n Address,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport {\n InvalidProtocolChainIdError,\n NoConnectedChainIdError,\n NoContractAddressUponReceiptError,\n} from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi = Abi,\n functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {unknown}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * Given a wagmi config and a map of chain id's to addresses, determine an address/chainId combo that maps to the currently connected chain id, or throw a typed error.\n *\n * @export\n * @param {Config} config\n * @param {Record<string, Address>} addressByChainId\n * @param {number} desiredChainId\n * @returns {{ chainId: number, address: Address }}\n * @throws {@link InvalidProtocolChainIdError}\n */\nexport function assertValidAddressByChainId(\n config: Config,\n addressByChainId: Record<number, Address>,\n desiredChainId?: number,\n): { chainId: number; address: Address } {\n let chainId: number | undefined = undefined;\n const wagmiAccount = getAccount(config);\n // if manually providing a chain id for some contract operation, try to use it\n if (desiredChainId !== undefined) {\n if (addressByChainId[desiredChainId]) chainId = desiredChainId;\n } else if (wagmiAccount.chainId !== undefined) {\n // otherwise if we can get the current chain id off the connected account and it matches one of ours, use it\n if (addressByChainId[wagmiAccount.chainId]) chainId = wagmiAccount.chainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const client = getClient(config);\n if (client?.chain.id && addressByChainId[client?.chain.id])\n chainId = client.chain.id;\n }\n // if chainId is STILL undefined, use our default addresses\n // TODO: update this when on prod network\n if (chainId === undefined) chainId = Number(__DEFAULT_CHAIN_ID__);\n if (!addressByChainId[chainId])\n throw new InvalidProtocolChainIdError(\n chainId,\n Object.keys(addressByChainId).map(Number),\n );\n // biome-ignore lint/style/noNonNullAssertion: this type should be narrowed by the above statement but isn't?\n return { chainId, address: addressByChainId[chainId]! };\n}\n"],"names":["RegistryType","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiAccount","getAccount","client","getClient","InvalidProtocolChainIdError"],"mappings":";;;AAqCY,IAAAA,sBAAAA,OACVA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,aAAa,CAAb,IAAA,cACAA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aALUA,IAAAA,KAAA,CAAA,CAAA;AA2GL,SAASC,EAAOC,GAAe;AACpC,SAAOC,EAAMC,EAAMF,CAAK,IAAIG,EAAUH,CAAK,IAAIG,EAAUC,EAAMJ,CAAK,CAAC,GAAG,GAAG,CAAC;AAC9E;AAasB,eAAAK,EACpBC,GACAC,GACAC,GACA;AACM,QAAAC,IAAU,MAAMC,EAA0BJ,GAAQ;AAAA,IACtD,GAAGE;AAAA,IACH,MAAM,MAAMD;AAAA,EAAA,CACb;AACD,MAAI,CAACE,EAAQ;AACL,UAAA,IAAIE,EAAkCF,CAAO;AACrD,SAAOA,EAAQ;AACjB;AAsBsB,eAAAG,EACpBN,GACAO,GACAL,GACiB;AACjB,QAAM,EAAE,MAAAD,GAAM,QAAAO,EAAO,IAAI,MAAMD;AAC/B,eAAMH,EAA0BJ,GAAQ;AAAA,IACtC,GAAGE;AAAA,IACH,MAAAD;AAAA,EAAA,CACD,GACMO;AACT;AAYgB,SAAAC,EACdT,GACAU,GACAC,GACuC;AACvC,MAAIC;AACE,QAAAC,IAAeC,EAAWd,CAAM;AAStC,MAPIW,MAAmB,SACjBD,EAAiBC,CAAc,MAAaC,IAAAD,KACvCE,EAAa,YAAY,UAE9BH,EAAiBG,EAAa,OAAO,MAAGD,IAAUC,EAAa,UAGjED,MAAY,QAAW;AACnB,UAAAG,IAASC,EAAUhB,CAAM;AAC/B,IAAIe,KAAA,QAAAA,EAAQ,MAAM,MAAML,EAAiBK,KAAA,gBAAAA,EAAQ,MAAM,EAAE,MACvDH,IAAUG,EAAO,MAAM;AAAA,EAC3B;AAII,MADAH,MAAY,WAAWA,IAAiB,WACxC,CAACF,EAAiBE,CAAO;AAC3B,UAAM,IAAIK;AAAA,MACRL;AAAA,MACA,OAAO,KAAKF,CAAgB,EAAE,IAAI,MAAM;AAAA,IAAA;AAG5C,SAAO,EAAE,SAAAE,GAAS,SAASF,EAAiBE,CAAO,EAAG;AACxD;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boostxyz/sdk",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.13",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"node": "./dist/transfers.js",
|
|
55
55
|
"types": "./dist/transfers.d.ts"
|
|
56
56
|
},
|
|
57
|
+
"./deployments.json": "./dist/deployments.json",
|
|
57
58
|
"./Boost": {
|
|
58
59
|
"require": "./dist/Boost.cjs",
|
|
59
60
|
"import": "./dist/Boost.js",
|
|
@@ -191,8 +192,8 @@
|
|
|
191
192
|
"@boostxyz/signatures": "0.0.0-alpha.2"
|
|
192
193
|
},
|
|
193
194
|
"optionalDependencies": {
|
|
194
|
-
"@boostxyz/
|
|
195
|
-
"@boostxyz/
|
|
195
|
+
"@boostxyz/evm": "0.0.0-alpha.3",
|
|
196
|
+
"@boostxyz/signatures": "0.0.0-alpha.2"
|
|
196
197
|
},
|
|
197
198
|
"peerDependencies": {
|
|
198
199
|
"@wagmi/core": "2",
|
|
@@ -200,14 +201,14 @@
|
|
|
200
201
|
"viem": "2"
|
|
201
202
|
},
|
|
202
203
|
"scripts": {
|
|
203
|
-
"build": "vite build && tsc -p ./tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap",
|
|
204
|
+
"build": "mkdir -p dist && vite build && tsc -p ./tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap",
|
|
204
205
|
"typecheck": "tsc -p ./tsconfig.build.json --noEmit",
|
|
205
206
|
"lint:ci": "npx biome ci",
|
|
206
207
|
"lint": "npx biome check",
|
|
207
208
|
"bench": "vitest bench",
|
|
208
209
|
"bench:ci": "CI=true vitest bench",
|
|
209
210
|
"clean": "rm -rf dist",
|
|
210
|
-
"dev": "vite build --watch",
|
|
211
|
+
"dev": "mkdir -p dist && vite build --watch",
|
|
211
212
|
"test": "vitest dev",
|
|
212
213
|
"test:ci": "CI=true vitest --coverage",
|
|
213
214
|
"typedoc": "npx typedoc --tsconfig ./tsconfig.build.json --sort required-first --sort visibility --sort kind"
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
encodeAbiParameters,
|
|
18
18
|
parseAbiParameters,
|
|
19
19
|
} from 'viem';
|
|
20
|
+
import {} from '../../dist/deployments.json';
|
|
20
21
|
import type {
|
|
21
22
|
DeployableOptions,
|
|
22
23
|
GenericDeployableParams,
|
|
@@ -99,10 +100,11 @@ export class ContractAction<
|
|
|
99
100
|
*
|
|
100
101
|
* @public
|
|
101
102
|
* @static
|
|
102
|
-
* @type {Address}
|
|
103
|
+
* @type {Record<number, Address>}
|
|
103
104
|
*/
|
|
104
|
-
public static override
|
|
105
|
-
.VITE_CONTRACT_ACTION_BASE
|
|
105
|
+
public static override bases: Record<number, Address> = {
|
|
106
|
+
31337: import.meta.env.VITE_CONTRACT_ACTION_BASE,
|
|
107
|
+
};
|
|
106
108
|
/**
|
|
107
109
|
* @inheritdoc
|
|
108
110
|
*
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
encodeAbiParameters,
|
|
16
16
|
toHex,
|
|
17
17
|
} from 'viem';
|
|
18
|
+
import {} from '../../dist/deployments.json';
|
|
18
19
|
import type {
|
|
19
20
|
DeployableOptions,
|
|
20
21
|
GenericDeployableParams,
|
|
@@ -77,10 +78,11 @@ export class ERC721MintAction extends ContractAction<
|
|
|
77
78
|
*
|
|
78
79
|
* @public
|
|
79
80
|
* @static
|
|
80
|
-
* @type {Address}
|
|
81
|
+
* @type {Record<number, Address>}
|
|
81
82
|
*/
|
|
82
|
-
public static override
|
|
83
|
-
.VITE_ERC721_MINT_ACTION_BASE
|
|
83
|
+
public static override bases: Record<number, Address> = {
|
|
84
|
+
31337: import.meta.env.VITE_ERC721_MINT_ACTION_BASE,
|
|
85
|
+
};
|
|
84
86
|
/**
|
|
85
87
|
* @inheritdoc
|
|
86
88
|
*
|