@boostxyz/sdk 0.0.0-alpha.13 → 0.0.0-alpha.15
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.map +1 -1
- 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.map +1 -1
- package/dist/Actions/EventAction.js +68 -63
- 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.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +10 -11
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +2 -2
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/Boost.js +10 -22
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.js +90 -76
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.js +12 -12
- 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.map +1 -1
- package/dist/Budgets/ManagedBudget.js +34 -35
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/Contract.cjs.map +1 -1
- package/dist/Deployable/Contract.js +1 -2
- package/dist/Deployable/Contract.js.map +1 -1
- package/dist/Deployable/Deployable.cjs.map +1 -1
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +2 -4
- package/dist/Deployable/Deployable.js.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts +1 -1
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +3 -5
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Incentive-BroOQqVi.cjs +2 -0
- package/dist/Incentive-BroOQqVi.cjs.map +1 -0
- package/dist/Incentive-CSnbCt3P.js +299 -0
- package/dist/Incentive-CSnbCt3P.js.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +10 -11
- 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.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +10 -11
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- 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.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +18 -19
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- 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 +16 -300
- 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.map +1 -1
- package/dist/Incentives/PointsIncentive.js +8 -9
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-DeJRKD2D.cjs → SimpleDenyList-CzNNbmmV.cjs} +2 -2
- package/dist/SimpleDenyList-CzNNbmmV.cjs.map +1 -0
- package/dist/{SimpleDenyList-C21O9Yfi.js → SimpleDenyList-sfskWLfa.js} +9 -10
- package/dist/SimpleDenyList-sfskWLfa.js.map +1 -0
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +15 -16
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +1 -1
- package/dist/generated-BulULVyy.cjs +3 -0
- package/dist/generated-BulULVyy.cjs.map +1 -0
- package/dist/{generated-LpgSHrH0.js → generated-CdXG-MpB.js} +367 -351
- package/dist/generated-CdXG-MpB.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +96 -84
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +6 -6
- package/src/Actions/Action.test.ts +4 -4
- package/src/Actions/ContractAction.test.ts +4 -4
- package/src/Actions/ContractAction.ts +1 -3
- package/src/Actions/ERC721MintAction.test.ts +4 -4
- package/src/Actions/ERC721MintAction.ts +1 -3
- package/src/Actions/EventAction.test.ts +80 -83
- package/src/Actions/EventAction.ts +3 -2
- package/src/AllowLists/AllowList.test.ts +2 -2
- package/src/AllowLists/OpenAllowList.test.ts +3 -3
- package/src/AllowLists/SimpleAllowList.test.ts +2 -2
- package/src/AllowLists/SimpleAllowList.ts +1 -1
- package/src/AllowLists/SimpleDenyList.test.ts +2 -2
- package/src/AllowLists/SimpleDenyList.ts +0 -1
- package/src/Auth/PassthroughAuth.test.ts +1 -1
- package/src/BoostCore.test.ts +10 -12
- package/src/Budgets/Budget.test.ts +2 -2
- package/src/Budgets/ManagedBudget.test.ts +6 -6
- package/src/Budgets/ManagedBudget.ts +0 -1
- package/src/Budgets/SimpleBudget.test.ts +5 -5
- package/src/Budgets/SimpleBudget.ts +1 -3
- package/src/Budgets/VestingBudget.test.ts +4 -4
- package/src/Budgets/VestingBudget.ts +1 -3
- package/src/Deployable/DeployableTarget.ts +2 -2
- package/src/Incentives/AllowListIncentive.test.ts +3 -3
- package/src/Incentives/AllowListIncentive.ts +0 -1
- package/src/Incentives/CGDAIncentive.test.ts +3 -3
- package/src/Incentives/CGDAIncentive.ts +0 -1
- package/src/Incentives/ERC1155Incentive.test.ts +3 -3
- package/src/Incentives/ERC1155Incentive.ts +1 -3
- package/src/Incentives/ERC20Incentive.test.ts +3 -3
- package/src/Incentives/ERC20Incentive.ts +0 -1
- package/src/Incentives/ERC20VariableIncentive.test.ts +3 -3
- package/src/Incentives/ERC20VariableIncentive.ts +0 -1
- package/src/Incentives/Incentive.test.ts +1 -1
- package/src/Incentives/PointsIncentive.test.ts +4 -4
- package/src/Incentives/PointsIncentive.ts +0 -1
- package/src/Validators/SignerValidator.test.ts +4 -4
- package/src/Validators/SignerValidator.ts +0 -1
- package/src/Validators/Validator.test.ts +2 -2
- package/src/index.ts +3 -0
- package/src/utils.test.ts +2 -2
- package/dist/SimpleDenyList-C21O9Yfi.js.map +0 -1
- package/dist/SimpleDenyList-DeJRKD2D.cjs.map +0 -1
- package/dist/generated-LpgSHrH0.js.map +0 -1
- package/dist/generated-tq_HLZJ0.cjs +0 -3
- package/dist/generated-tq_HLZJ0.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 s=require("./BoostRegistry.cjs"),i=require("./BoostCore.cjs"),y=require("./Boost.cjs"),E=require("./Actions/Action.cjs"),o=require("./Actions/EventAction.cjs"),p=require("./AllowLists/AllowList.cjs"),c=require("./AllowLists/SimpleAllowList.cjs"),A=require("./SimpleDenyList-CzNNbmmV.cjs"),u=require("./Budgets/Budget.cjs"),a=require("./Budgets/ManagedBudget.cjs"),m=require("./Deployable/Deployable.cjs"),R=require("./Deployable/Contract.cjs"),D=require("./Deployable/DeployableTarget.cjs"),C=require("./Incentives/AllowListIncentive.cjs"),g=require("./Incentives/CGDAIncentive.cjs"),I=require("./Incentives/ERC20Incentive.cjs"),l=require("./Incentive-BroOQqVi.cjs"),S=require("./Incentives/PointsIncentive.cjs"),d=require("./Validators/SignerValidator.cjs"),v=require("./Validators/Validator.cjs"),e=require("./errors.cjs"),n=require("./utils.cjs"),P=require("./claiming.cjs"),t=require("./transfers.cjs"),B=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-BulULVyy.cjs");exports.BOOST_REGISTRY_ADDRESS=s.BOOST_REGISTRY_ADDRESS;exports.BOOST_REGISTRY_ADDRESSES=s.BOOST_REGISTRY_ADDRESSES;exports.BoostRegistry=s.BoostRegistry;exports.BOOST_CORE_ADDRESS=i.BOOST_CORE_ADDRESS;exports.BOOST_CORE_ADDRESSES=i.BOOST_CORE_ADDRESSES;exports.BOOST_CORE_CLAIM_FEE=i.BOOST_CORE_CLAIM_FEE;exports.BoostCore=i.BoostCore;exports.Boost=y.Boost;exports.prepareBoostPayload=y.prepareBoostPayload;exports.ActionByComponentInterface=E.ActionByComponentInterface;exports.actionFromAddress=E.actionFromAddress;exports.EventAction=o.EventAction;exports.FilterType=o.FilterType;exports.PrimitiveType=o.PrimitiveType;exports.SignatureType=o.SignatureType;exports.isEventActionPayloadSimple=o.isEventActionPayloadSimple;exports.prepareEventActionPayload=o.prepareEventActionPayload;exports.AllowListByComponentInterface=p.AllowListByComponentInterface;exports.OpenAllowList=p.OpenAllowList;exports.allowListFromAddress=p.allowListFromAddress;exports.LIST_MANAGER_ROLE=c.LIST_MANAGER_ROLE;exports.SimpleAllowList=c.SimpleAllowList;exports.prepareSimpleAllowListPayload=c.prepareSimpleAllowListPayload;exports.SimpleDenyList=A.SimpleDenyList;exports.prepareSimpleDenyListPayload=A.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=u.BudgetByComponentInterface;exports.budgetFromAddress=u.budgetFromAddress;exports.ManagedBudget=a.ManagedBudget;exports.ManagedBudgetRoles=a.ManagedBudgetRoles;exports.isERC1155TransferPayload=a.isERC1155TransferPayload;exports.isFungibleTransfer=a.isFungibleTransfer;exports.prepareManagedBudgetPayload=a.prepareManagedBudgetPayload;exports.prepareTransfer=a.prepareTransfer;exports.Deployable=m.Deployable;exports.Contract=R.Contract;exports.DeployableTarget=D.DeployableTarget;exports.AllowListIncentive=C.AllowListIncentive;exports.prepareAllowListIncentivePayload=C.prepareAllowListIncentivePayload;exports.CGDAIncentive=g.CGDAIncentive;exports.prepareCGDAIncentivePayload=g.prepareCGDAIncentivePayload;exports.ERC20Incentive=I.ERC20Incentive;exports.prepareERC20IncentivePayload=I.prepareERC20IncentivePayload;exports.ERC20VariableIncentive=l.ERC20VariableIncentive;exports.IncentiveByComponentInterface=l.IncentiveByComponentInterface;exports.incentiveFromAddress=l.incentiveFromAddress;exports.prepareERC20VariableIncentivePayload=l.prepareERC20VariableIncentivePayload;exports.PointsIncentive=S.PointsIncentive;exports.preparePointsIncentivePayload=S.preparePointsIncentivePayload;exports.SignerValidator=d.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=d.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=d.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=d.prepareSignerValidatorPayload;exports.ValidatorByComponentInterface=v.ValidatorByComponentInterface;exports.validatorFromAddress=v.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.StrategyType=P.StrategyType;exports.prepareClaimPayload=P.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=B.PassthroughAuth;exports.allowListIncentiveAbi=r.A;exports.boostCoreAbi=r.d;exports.cgdaIncentiveAbi=r.v;exports.erc20IncentiveAbi=r.f;exports.erc20VariableIncentiveAbi=r.w;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.d.ts
CHANGED
|
@@ -14,12 +14,15 @@ export * from './Deployable/DeployableTarget';
|
|
|
14
14
|
export * from './Incentives/AllowListIncentive';
|
|
15
15
|
export * from './Incentives/CGDAIncentive';
|
|
16
16
|
export * from './Incentives/ERC20Incentive';
|
|
17
|
+
export * from './Incentives/ERC20VariableIncentive';
|
|
17
18
|
export * from './Incentives/Incentive';
|
|
18
19
|
export * from './Incentives/PointsIncentive';
|
|
19
20
|
export * from './Validators/SignerValidator';
|
|
20
21
|
export * from './Validators/Validator';
|
|
21
22
|
export * from './errors';
|
|
22
23
|
export * from './utils';
|
|
24
|
+
export * from './claiming';
|
|
25
|
+
export * from './transfers';
|
|
23
26
|
export * from './Auth/Auth';
|
|
24
27
|
export * from './Auth/PassthroughAuth';
|
|
25
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AAIxB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,uBAAuB,CAAC;AAItC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAI5C,cAAc,kBAAkB,CAAC;AAGjC,cAAc,yBAAyB,CAAC;AAIxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAI9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AAIxB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,uBAAuB,CAAC;AAItC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAI5C,cAAc,kBAAkB,CAAC;AAGjC,cAAc,yBAAyB,CAAC;AAIxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAI9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AAEpD,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAI7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AAIvC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAI5B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,121 +1,133 @@
|
|
|
1
|
-
import { BOOST_REGISTRY_ADDRESS as o, BOOST_REGISTRY_ADDRESSES as
|
|
2
|
-
import { BOOST_CORE_ADDRESS as n, BOOST_CORE_ADDRESSES as
|
|
3
|
-
import { Boost as m, prepareBoostPayload 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
|
|
1
|
+
import { BOOST_REGISTRY_ADDRESS as o, BOOST_REGISTRY_ADDRESSES as a, BoostRegistry as t } from "./BoostRegistry.js";
|
|
2
|
+
import { BOOST_CORE_ADDRESS as n, BOOST_CORE_ADDRESSES as p, BOOST_CORE_CLAIM_FEE as l, BoostCore as d } from "./BoostCore.js";
|
|
3
|
+
import { Boost as m, prepareBoostPayload as y } from "./Boost.js";
|
|
4
|
+
import { ActionByComponentInterface as E, actionFromAddress as c } from "./Actions/Action.js";
|
|
5
|
+
import { EventAction as C, FilterType as I, PrimitiveType as g, SignatureType as S, isEventActionPayloadSimple as v, prepareEventActionPayload as b } from "./Actions/EventAction.js";
|
|
6
|
+
import { AllowListByComponentInterface as u, OpenAllowList as R, allowListFromAddress as x } from "./AllowLists/AllowList.js";
|
|
7
|
+
import { LIST_MANAGER_ROLE as B, SimpleAllowList as T, prepareSimpleAllowListPayload as O } from "./AllowLists/SimpleAllowList.js";
|
|
8
|
+
import { S as L, p as w } from "./SimpleDenyList-sfskWLfa.js";
|
|
9
|
+
import { BudgetByComponentInterface as _, budgetFromAddress as M } from "./Budgets/Budget.js";
|
|
10
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
11
|
import { Deployable as W } from "./Deployable/Deployable.js";
|
|
12
12
|
import { Contract as H } from "./Deployable/Contract.js";
|
|
13
13
|
import { DeployableTarget as K } from "./Deployable/DeployableTarget.js";
|
|
14
14
|
import { AllowListIncentive as X, prepareAllowListIncentivePayload as Z } from "./Incentives/AllowListIncentive.js";
|
|
15
15
|
import { CGDAIncentive as ee, prepareCGDAIncentivePayload as re } from "./Incentives/CGDAIncentive.js";
|
|
16
|
-
import { ERC20Incentive as
|
|
17
|
-
import {
|
|
18
|
-
import { PointsIncentive as
|
|
19
|
-
import { SignerValidator as Ee, prepareSignerValidatorClaimDataPayload as ce, prepareSignerValidatorInputParams as
|
|
20
|
-
import { ValidatorByComponentInterface as
|
|
21
|
-
import { BoostCoreNoIdentifierEmitted as
|
|
22
|
-
import { RegistryType as
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
16
|
+
import { ERC20Incentive as ae, prepareERC20IncentivePayload as te } from "./Incentives/ERC20Incentive.js";
|
|
17
|
+
import { E as ne, I as pe, i as le, p as de } from "./Incentive-CSnbCt3P.js";
|
|
18
|
+
import { PointsIncentive as me, preparePointsIncentivePayload as ye } from "./Incentives/PointsIncentive.js";
|
|
19
|
+
import { SignerValidator as Ee, prepareSignerValidatorClaimDataPayload as ce, prepareSignerValidatorInputParams as fe, prepareSignerValidatorPayload as Ce } from "./Validators/SignerValidator.js";
|
|
20
|
+
import { ValidatorByComponentInterface as ge, validatorFromAddress as Se } from "./Validators/Validator.js";
|
|
21
|
+
import { BoostCoreNoIdentifierEmitted as be, BudgetMustAuthorizeBoostCore as Pe, ContractAddressRequiredError as ue, DecodedArgsMalformedError as Re, DeployableAlreadyDeployedError as xe, DeployableBuildParametersUnspecifiedError as De, DeployableMissingPayloadError as Be, DeployableUnknownOwnerProvidedError as Te, DeployableWagmiConfigurationRequiredError as Oe, FieldActionValidationError as Fe, FieldValueNotComparableError as Le, FieldValueUndefinedError as we, FunctionDataDecodeError as Ve, IncentiveNotCloneableError as _e, InvalidComponentInterfaceError as Me, InvalidNumericalCriteriaError as he, InvalidProtocolChainIdError as Ne, MustInitializeBudgetError as Ue, NoConnectedChainIdError as Ge, NoContractAddressUponReceiptError as ze, NoEventActionStepsProvidedError as ke, TooManyEventActionStepsProvidedError as qe, UnknownTransferPayloadSupplied as Ye, UnparseableAbiParamError as We, UnrecognizedFilterTypeError as je } from "./errors.js";
|
|
22
|
+
import { RegistryType as Je, assertValidAddressByChainId as Ke, awaitResult as Qe, bytes4 as Xe, getDeployedContractAddress as Ze } from "./utils.js";
|
|
23
|
+
import { StrategyType as er, prepareClaimPayload as rr } from "./claiming.js";
|
|
24
|
+
import { AssetType as ar, prepareERC1155Payload as tr, prepareERC1155Transfer as ir, prepareFungiblePayload as nr, prepareFungibleTransfer as pr, prepareTransferPayload as lr } from "./transfers.js";
|
|
25
|
+
import { PassthroughAuth as sr } from "./Auth/PassthroughAuth.js";
|
|
26
|
+
import { A as yr, d as Ar, v as Er, f as cr, w as fr, p as Cr, z as Ir, l as gr, M as Sr, T as vr, S as br } from "./generated-CdXG-MpB.js";
|
|
25
27
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
E as ActionByComponentInterface,
|
|
29
|
+
u as AllowListByComponentInterface,
|
|
28
30
|
X as AllowListIncentive,
|
|
31
|
+
ar as AssetType,
|
|
29
32
|
n as BOOST_CORE_ADDRESS,
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
p as BOOST_CORE_ADDRESSES,
|
|
34
|
+
l as BOOST_CORE_CLAIM_FEE,
|
|
32
35
|
o as BOOST_REGISTRY_ADDRESS,
|
|
33
|
-
|
|
36
|
+
a as BOOST_REGISTRY_ADDRESSES,
|
|
34
37
|
m as Boost,
|
|
35
38
|
d as BoostCore,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
be as BoostCoreNoIdentifierEmitted,
|
|
40
|
+
t as BoostRegistry,
|
|
41
|
+
_ as BudgetByComponentInterface,
|
|
42
|
+
Pe as BudgetMustAuthorizeBoostCore,
|
|
40
43
|
ee as CGDAIncentive,
|
|
41
44
|
H as Contract,
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
ue as ContractAddressRequiredError,
|
|
46
|
+
Re as DecodedArgsMalformedError,
|
|
44
47
|
W as Deployable,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
xe as DeployableAlreadyDeployedError,
|
|
49
|
+
De as DeployableBuildParametersUnspecifiedError,
|
|
50
|
+
Be as DeployableMissingPayloadError,
|
|
48
51
|
K as DeployableTarget,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
Te as DeployableUnknownOwnerProvidedError,
|
|
53
|
+
Oe as DeployableWagmiConfigurationRequiredError,
|
|
54
|
+
ae as ERC20Incentive,
|
|
52
55
|
ne as ERC20VariableIncentive,
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
C as EventAction,
|
|
57
|
+
Fe as FieldActionValidationError,
|
|
55
58
|
Le as FieldValueNotComparableError,
|
|
56
59
|
we as FieldValueUndefinedError,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
I as FilterType,
|
|
61
|
+
Ve as FunctionDataDecodeError,
|
|
62
|
+
pe as IncentiveByComponentInterface,
|
|
60
63
|
_e as IncentiveNotCloneableError,
|
|
61
64
|
Me as InvalidComponentInterfaceError,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
he as InvalidNumericalCriteriaError,
|
|
66
|
+
Ne as InvalidProtocolChainIdError,
|
|
67
|
+
B as LIST_MANAGER_ROLE,
|
|
65
68
|
N as ManagedBudget,
|
|
66
69
|
U as ManagedBudgetRoles,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
Ue as MustInitializeBudgetError,
|
|
71
|
+
Ge as NoConnectedChainIdError,
|
|
72
|
+
ze as NoContractAddressUponReceiptError,
|
|
73
|
+
ke as NoEventActionStepsProvidedError,
|
|
74
|
+
R as OpenAllowList,
|
|
75
|
+
sr as PassthroughAuth,
|
|
76
|
+
me as PointsIncentive,
|
|
77
|
+
g as PrimitiveType,
|
|
78
|
+
Je as RegistryType,
|
|
79
|
+
S as SignatureType,
|
|
77
80
|
Ee as SignerValidator,
|
|
78
81
|
T as SimpleAllowList,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
qe as
|
|
82
|
-
Ye as
|
|
83
|
-
We as
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Ke as
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
82
|
+
L as SimpleDenyList,
|
|
83
|
+
er as StrategyType,
|
|
84
|
+
qe as TooManyEventActionStepsProvidedError,
|
|
85
|
+
Ye as UnknownTransferPayloadSupplied,
|
|
86
|
+
We as UnparseableAbiParamError,
|
|
87
|
+
je as UnrecognizedFilterTypeError,
|
|
88
|
+
ge as ValidatorByComponentInterface,
|
|
89
|
+
c as actionFromAddress,
|
|
90
|
+
x as allowListFromAddress,
|
|
91
|
+
yr as allowListIncentiveAbi,
|
|
92
|
+
Ke as assertValidAddressByChainId,
|
|
93
|
+
Qe as awaitResult,
|
|
94
|
+
Ar as boostCoreAbi,
|
|
95
|
+
M as budgetFromAddress,
|
|
96
|
+
Xe as bytes4,
|
|
97
|
+
Er as cgdaIncentiveAbi,
|
|
98
|
+
cr as erc20IncentiveAbi,
|
|
99
|
+
fr as erc20VariableIncentiveAbi,
|
|
100
|
+
Ze as getDeployedContractAddress,
|
|
101
|
+
le as incentiveFromAddress,
|
|
97
102
|
G as isERC1155TransferPayload,
|
|
98
103
|
v as isEventActionPayloadSimple,
|
|
99
104
|
z as isFungibleTransfer,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
Cr as managedBudgetAbi,
|
|
106
|
+
Ir as passthroughAuthAbi,
|
|
107
|
+
gr as pointsIncentiveAbi,
|
|
103
108
|
Z as prepareAllowListIncentivePayload,
|
|
104
|
-
|
|
109
|
+
y as prepareBoostPayload,
|
|
105
110
|
re as prepareCGDAIncentivePayload,
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
rr as prepareClaimPayload,
|
|
112
|
+
tr as prepareERC1155Payload,
|
|
113
|
+
ir as prepareERC1155Transfer,
|
|
114
|
+
te as prepareERC20IncentivePayload,
|
|
115
|
+
de as prepareERC20VariableIncentivePayload,
|
|
116
|
+
b as prepareEventActionPayload,
|
|
117
|
+
nr as prepareFungiblePayload,
|
|
118
|
+
pr as prepareFungibleTransfer,
|
|
108
119
|
k as prepareManagedBudgetPayload,
|
|
109
|
-
|
|
120
|
+
ye as preparePointsIncentivePayload,
|
|
110
121
|
ce as prepareSignerValidatorClaimDataPayload,
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
fe as prepareSignerValidatorInputParams,
|
|
123
|
+
Ce as prepareSignerValidatorPayload,
|
|
113
124
|
O as prepareSimpleAllowListPayload,
|
|
114
|
-
|
|
125
|
+
w as prepareSimpleDenyListPayload,
|
|
115
126
|
q as prepareTransfer,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
lr as prepareTransferPayload,
|
|
128
|
+
Sr as signerValidatorAbi,
|
|
129
|
+
vr as simpleAllowListAbi,
|
|
130
|
+
br as simpleDenyListAbi,
|
|
119
131
|
Se as validatorFromAddress
|
|
120
132
|
};
|
|
121
133
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/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 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"}
|
|
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,MAAaA,EAAa,SAGjED,IAAY,OAAW,CACnB,MAAAG,EAASC,YAAUhB,CAAM,EAC3Be,GAAA,MAAAA,EAAQ,MAAM,IAAML,EAAiBK,GAAA,YAAAA,EAAQ,MAAM,EAAE,IACvDH,EAAUG,EAAO,MAAM,GAC3B,CAII,GADAH,IAAY,SAAqBA,EAAO,UACxC,CAACF,EAAiBE,CAAO,EAC3B,MAAM,IAAIK,EAAA,4BACRL,EACA,OAAO,KAAKF,CAAgB,EAAE,IAAI,MAAM,CAAA,EAG5C,MAAO,CAAE,QAAAE,EAAS,QAASF,EAAiBE,CAAO,CAAG,CACxD"}
|
package/dist/utils.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 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;"}
|
|
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,UAAaA,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,WAAqBA,IAAO,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.15",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -189,16 +189,16 @@
|
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
191
|
"dependencies": {
|
|
192
|
-
"@boostxyz/signatures": "0.0.0-alpha.
|
|
192
|
+
"@boostxyz/signatures": "0.0.0-alpha.4"
|
|
193
193
|
},
|
|
194
194
|
"optionalDependencies": {
|
|
195
|
-
"@boostxyz/
|
|
196
|
-
"@boostxyz/
|
|
195
|
+
"@boostxyz/signatures": "0.0.0-alpha.4",
|
|
196
|
+
"@boostxyz/evm": "0.0.0-alpha.4"
|
|
197
197
|
},
|
|
198
198
|
"peerDependencies": {
|
|
199
|
-
"@wagmi/core": "2",
|
|
199
|
+
"@wagmi/core": "2.x",
|
|
200
200
|
"abitype": "1",
|
|
201
|
-
"viem": "2"
|
|
201
|
+
"viem": "2.x"
|
|
202
202
|
},
|
|
203
203
|
"scripts": {
|
|
204
204
|
"build": "mkdir -p dist && vite build && tsc -p ./tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap",
|
|
@@ -2,14 +2,14 @@ import { selectors } from '@boostxyz/signatures/events';
|
|
|
2
2
|
import { loadFixture } from '@nomicfoundation/hardhat-toolbox-viem/network-helpers';
|
|
3
3
|
import type { Hex } from 'viem';
|
|
4
4
|
import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
5
|
-
import type { MockERC721 } from '
|
|
6
|
-
import { accounts } from '
|
|
5
|
+
import type { MockERC721 } from '@boostxyz/test/MockERC721';
|
|
6
|
+
import { accounts } from '@boostxyz/test/accounts';
|
|
7
7
|
import {
|
|
8
8
|
type Fixtures,
|
|
9
9
|
defaultOptions,
|
|
10
10
|
deployFixtures,
|
|
11
11
|
fundErc721,
|
|
12
|
-
} from '
|
|
12
|
+
} from '@boostxyz/test/helpers';
|
|
13
13
|
import { EventAction, actionFromAddress } from './Action';
|
|
14
14
|
import {
|
|
15
15
|
type EventActionPayloadSimple,
|
|
@@ -62,7 +62,7 @@ export function cloneEventAction(fixtures: Fixtures, erc721: MockERC721) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
beforeAll(async () => {
|
|
65
|
-
fixtures = await loadFixture(deployFixtures);
|
|
65
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
describe('Action', () => {
|
|
@@ -10,20 +10,20 @@ import {
|
|
|
10
10
|
zeroAddress,
|
|
11
11
|
} from 'viem';
|
|
12
12
|
import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
13
|
-
import type { MockERC20 } from '
|
|
14
|
-
import { accounts } from '
|
|
13
|
+
import type { MockERC20 } from '@boostxyz/test/MockERC20';
|
|
14
|
+
import { accounts } from '@boostxyz/test/accounts';
|
|
15
15
|
import {
|
|
16
16
|
type Fixtures,
|
|
17
17
|
defaultOptions,
|
|
18
18
|
deployFixtures,
|
|
19
19
|
fundErc20,
|
|
20
|
-
} from '
|
|
20
|
+
} from '@boostxyz/test/helpers';
|
|
21
21
|
import { ContractAction } from './ContractAction';
|
|
22
22
|
|
|
23
23
|
let fixtures: Fixtures, erc20: MockERC20;
|
|
24
24
|
|
|
25
25
|
beforeAll(async () => {
|
|
26
|
-
fixtures = await loadFixture(deployFixtures);
|
|
26
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
const mintPayableSelector = toFunctionSelector(
|
|
@@ -102,9 +102,7 @@ export class ContractAction<
|
|
|
102
102
|
* @static
|
|
103
103
|
* @type {Record<number, Address>}
|
|
104
104
|
*/
|
|
105
|
-
public static override bases: Record<number, Address> = {
|
|
106
|
-
31337: import.meta.env.VITE_CONTRACT_ACTION_BASE,
|
|
107
|
-
};
|
|
105
|
+
public static override bases: Record<number, Address> = {};
|
|
108
106
|
/**
|
|
109
107
|
* @inheritdoc
|
|
110
108
|
*
|
|
@@ -9,20 +9,20 @@ import {
|
|
|
9
9
|
zeroAddress,
|
|
10
10
|
} from 'viem';
|
|
11
11
|
import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
12
|
-
import type { MockERC721 } from '
|
|
13
|
-
import { accounts } from '
|
|
12
|
+
import type { MockERC721 } from '@boostxyz/test/MockERC721';
|
|
13
|
+
import { accounts } from '@boostxyz/test/accounts';
|
|
14
14
|
import {
|
|
15
15
|
type Fixtures,
|
|
16
16
|
defaultOptions,
|
|
17
17
|
deployFixtures,
|
|
18
18
|
fundErc721,
|
|
19
|
-
} from '
|
|
19
|
+
} from '@boostxyz/test/helpers';
|
|
20
20
|
import { ERC721MintAction } from './ERC721MintAction';
|
|
21
21
|
|
|
22
22
|
let fixtures: Fixtures, erc721: MockERC721;
|
|
23
23
|
|
|
24
24
|
beforeAll(async () => {
|
|
25
|
-
fixtures = await loadFixture(deployFixtures);
|
|
25
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const mintSelector = toFunctionSelector('function mint(address to)');
|
|
@@ -80,9 +80,7 @@ export class ERC721MintAction extends ContractAction<
|
|
|
80
80
|
* @static
|
|
81
81
|
* @type {Record<number, Address>}
|
|
82
82
|
*/
|
|
83
|
-
public static override bases: Record<number, Address> = {
|
|
84
|
-
31337: import.meta.env.VITE_ERC721_MINT_ACTION_BASE,
|
|
85
|
-
};
|
|
83
|
+
public static override bases: Record<number, Address> = {};
|
|
86
84
|
/**
|
|
87
85
|
* @inheritdoc
|
|
88
86
|
*
|