@boostxyz/sdk 0.0.0-alpha.2 → 0.0.0-alpha.21
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 +2 -1
- package/dist/Actions/Action.cjs.map +1 -0
- package/dist/Actions/Action.d.ts +1 -1
- package/dist/Actions/Action.d.ts.map +1 -1
- package/dist/Actions/Action.js +14 -12
- package/dist/Actions/Action.js.map +1 -0
- package/dist/Actions/ContractAction.d.ts +57 -14
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +50 -23
- package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.cjs +2 -1
- package/dist/Actions/EventAction.cjs.map +1 -0
- package/dist/Actions/EventAction.d.ts +405 -36
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +15 -209
- package/dist/Actions/EventAction.js.map +1 -0
- package/dist/AllowLists/AllowList.cjs +2 -1
- package/dist/AllowLists/AllowList.cjs.map +1 -0
- package/dist/AllowLists/AllowList.d.ts +6 -5
- package/dist/AllowLists/AllowList.d.ts.map +1 -1
- package/dist/AllowLists/AllowList.js +46 -22
- package/dist/AllowLists/AllowList.js.map +1 -0
- package/dist/AllowLists/OpenAllowList.d.ts +423 -0
- package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
- package/dist/AllowLists/SimpleAllowList.cjs +2 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -0
- package/dist/AllowLists/SimpleAllowList.d.ts +124 -40
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +76 -76
- package/dist/AllowLists/SimpleAllowList.js.map +1 -0
- package/dist/AllowLists/SimpleDenyList.cjs +2 -1
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -0
- package/dist/AllowLists/SimpleDenyList.d.ts +234 -13
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +12 -200
- package/dist/AllowLists/SimpleDenyList.js.map +1 -0
- package/dist/Auth/Auth.cjs +1 -0
- package/dist/Auth/Auth.cjs.map +1 -0
- package/dist/Auth/Auth.js +1 -0
- package/dist/Auth/Auth.js.map +1 -0
- package/dist/Auth/PassthroughAuth.cjs +2 -1
- package/dist/Auth/PassthroughAuth.cjs.map +1 -0
- package/dist/Auth/PassthroughAuth.js +5 -4
- package/dist/Auth/PassthroughAuth.js.map +1 -0
- package/dist/Boost.cjs +2 -1
- package/dist/Boost.cjs.map +1 -0
- package/dist/Boost.d.ts +105 -14
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js +138 -5
- package/dist/Boost.js.map +1 -0
- package/dist/BoostCore-DolmDuXW.cjs +3 -0
- package/dist/BoostCore-DolmDuXW.cjs.map +1 -0
- package/dist/BoostCore-Z97KVu4V.js +1448 -0
- package/dist/BoostCore-Z97KVu4V.js.map +1 -0
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -0
- package/dist/BoostCore.d.ts +788 -79
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +30 -1103
- package/dist/BoostCore.js.map +1 -0
- package/dist/BoostRegistry.cjs +2 -1
- package/dist/BoostRegistry.cjs.map +1 -0
- package/dist/BoostRegistry.d.ts +95 -26
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +183 -89
- package/dist/BoostRegistry.js.map +1 -0
- package/dist/Budgets/Budget.cjs +2 -1
- package/dist/Budgets/Budget.cjs.map +1 -0
- package/dist/Budgets/Budget.d.ts +1 -1
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +15 -13
- package/dist/Budgets/Budget.js.map +1 -0
- package/dist/Budgets/ManagedBudget.cjs +2 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -0
- package/dist/Budgets/ManagedBudget.d.ts +112 -192
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +91 -291
- package/dist/Budgets/ManagedBudget.js.map +1 -0
- package/dist/Budgets/VestingBudget.d.ts +277 -91
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/Contract.cjs +2 -1
- package/dist/Deployable/Contract.cjs.map +1 -0
- package/dist/Deployable/Contract.d.ts +4 -5
- package/dist/Deployable/Contract.d.ts.map +1 -1
- package/dist/Deployable/Contract.js +7 -8
- package/dist/Deployable/Contract.js.map +1 -0
- package/dist/Deployable/Deployable.cjs +1 -0
- package/dist/Deployable/Deployable.cjs.map +1 -0
- package/dist/Deployable/Deployable.d.ts +9 -3
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +10 -5
- package/dist/Deployable/Deployable.js.map +1 -0
- package/dist/Deployable/DeployableTarget.cjs +2 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -0
- package/dist/Deployable/DeployableTarget.d.ts +16 -15
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +49 -42
- package/dist/Deployable/DeployableTarget.js.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
- package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts +179 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
- package/dist/EventAction-CBKzuNoN.cjs +2 -0
- package/dist/EventAction-CBKzuNoN.cjs.map +1 -0
- package/dist/EventAction-DWuuc_Qy.js +1528 -0
- package/dist/EventAction-DWuuc_Qy.js.map +1 -0
- package/dist/Incentive-BxzEtN26.js +298 -0
- package/dist/Incentive-BxzEtN26.js.map +1 -0
- package/dist/Incentive-CrF3-ayL.cjs +2 -0
- package/dist/Incentive-CrF3-ayL.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +2 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.d.ts +65 -21
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +52 -36
- package/dist/Incentives/AllowListIncentive.js.map +1 -0
- package/dist/Incentives/CGDAIncentive.cjs +2 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -0
- package/dist/Incentives/CGDAIncentive.d.ts +315 -26
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +64 -39
- package/dist/Incentives/CGDAIncentive.js.map +1 -0
- package/dist/Incentives/ERC1155Incentive.d.ts +291 -43
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +2 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -0
- package/dist/Incentives/ERC20Incentive.d.ts +270 -33
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +69 -46
- package/dist/Incentives/ERC20Incentive.js.map +1 -0
- package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +338 -421
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +262 -32
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.cjs +2 -1
- package/dist/Incentives/Incentive.cjs.map +1 -0
- package/dist/Incentives/Incentive.d.ts +5 -8
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +17 -278
- package/dist/Incentives/Incentive.js.map +1 -0
- package/dist/Incentives/PointsIncentive.cjs +2 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -0
- package/dist/Incentives/PointsIncentive.d.ts +81 -23
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +57 -36
- package/dist/Incentives/PointsIncentive.js.map +1 -0
- package/dist/SimpleDenyList-BUR17Tt1.cjs +2 -0
- package/dist/SimpleDenyList-BUR17Tt1.cjs.map +1 -0
- package/dist/SimpleDenyList-CGaWjuld.js +132 -0
- package/dist/SimpleDenyList-CGaWjuld.js.map +1 -0
- package/dist/Validators/SignerValidator.cjs +2 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -0
- package/dist/Validators/SignerValidator.d.ts +310 -17
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +165 -36
- package/dist/Validators/SignerValidator.js.map +1 -0
- package/dist/Validators/Validator.cjs +2 -1
- package/dist/Validators/Validator.cjs.map +1 -0
- package/dist/Validators/Validator.d.ts +2 -2
- package/dist/Validators/Validator.d.ts.map +1 -1
- package/dist/Validators/Validator.js +10 -8
- package/dist/Validators/Validator.js.map +1 -0
- package/dist/claiming.cjs +2 -0
- package/dist/claiming.cjs.map +1 -0
- package/dist/claiming.d.ts +43 -0
- package/dist/claiming.d.ts.map +1 -0
- package/dist/claiming.js +17 -0
- package/dist/claiming.js.map +1 -0
- package/dist/componentInterfaces-BBCFkrZv.js +14 -0
- package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
- package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
- package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
- package/dist/deployments-DVXioW2i.cjs +2 -0
- package/dist/deployments-DVXioW2i.cjs.map +1 -0
- package/dist/deployments-oykLv3_Z.js +43 -0
- package/dist/deployments-oykLv3_Z.js.map +1 -0
- package/dist/deployments.json +44 -0
- package/dist/errors.cjs +2 -1
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.ts +421 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +297 -39
- package/dist/errors.js.map +1 -0
- package/dist/{generated-x_abr3Yv.js → generated-CKt2yCQd.js} +3143 -3002
- package/dist/generated-CKt2yCQd.js.map +1 -0
- package/dist/generated-CyTNlOwM.cjs +3 -0
- package/dist/generated-CyTNlOwM.cjs.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +144 -1353
- package/dist/index.js.map +1 -0
- package/dist/transfers.cjs +2 -0
- package/dist/transfers.cjs.map +1 -0
- package/dist/transfers.d.ts +198 -0
- package/dist/transfers.d.ts.map +1 -0
- package/dist/transfers.js +84 -0
- package/dist/transfers.js.map +1 -0
- package/dist/utils.cjs +2 -1
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +26 -1350
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -636
- package/dist/utils.js.map +1 -0
- package/package.json +37 -11
- package/src/Actions/Action.test.ts +79 -0
- package/src/Actions/Action.ts +61 -0
- package/src/Actions/ContractAction.test.ts +197 -0
- package/src/Actions/ContractAction.ts +300 -0
- package/src/Actions/ERC721MintAction.test.ts +112 -0
- package/src/Actions/ERC721MintAction.ts +291 -0
- package/src/Actions/EventAction.test.ts +787 -0
- package/src/Actions/EventAction.ts +1218 -0
- package/src/AllowLists/AllowList.test.ts +64 -0
- package/src/AllowLists/AllowList.ts +62 -0
- package/src/AllowLists/OpenAllowList.test.ts +40 -0
- package/src/AllowLists/OpenAllowList.ts +45 -0
- package/src/AllowLists/SimpleAllowList.test.ts +52 -0
- package/src/AllowLists/SimpleAllowList.ts +262 -0
- package/src/AllowLists/SimpleDenyList.test.ts +52 -0
- package/src/AllowLists/SimpleDenyList.ts +250 -0
- package/src/Auth/Auth.ts +11 -0
- package/src/Auth/PassthroughAuth.test.ts +12 -0
- package/src/Auth/PassthroughAuth.ts +80 -0
- package/src/Boost.ts +287 -0
- package/src/BoostCore.test.ts +894 -0
- package/src/BoostCore.ts +1438 -0
- package/src/BoostRegistry.test.ts +53 -0
- package/src/BoostRegistry.ts +588 -0
- package/src/Budgets/Budget.test.ts +27 -0
- package/src/Budgets/Budget.ts +60 -0
- package/src/Budgets/ManagedBudget.test.ts +217 -0
- package/src/Budgets/ManagedBudget.ts +534 -0
- package/src/Budgets/VestingBudget.test.ts +123 -0
- package/src/Budgets/VestingBudget.ts +530 -0
- package/src/Deployable/Contract.ts +228 -0
- package/src/Deployable/Deployable.ts +250 -0
- package/src/Deployable/DeployableTarget.ts +234 -0
- package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
- package/src/Incentives/AllowListIncentive.test.ts +143 -0
- package/src/Incentives/AllowListIncentive.ts +336 -0
- package/src/Incentives/CGDAIncentive.test.ts +135 -0
- package/src/Incentives/CGDAIncentive.ts +476 -0
- package/src/Incentives/ERC1155Incentive.test.ts +87 -0
- package/src/Incentives/ERC1155Incentive.ts +465 -0
- package/src/Incentives/ERC20Incentive.test.ts +133 -0
- package/src/Incentives/ERC20Incentive.ts +490 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +309 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +139 -0
- package/src/Incentives/ERC20VariableIncentive.ts +428 -0
- package/src/Incentives/Incentive.test.ts +95 -0
- package/src/Incentives/Incentive.ts +86 -0
- package/src/Incentives/PointsIncentive.test.ts +138 -0
- package/src/Incentives/PointsIncentive.ts +367 -0
- package/src/Validators/SignerValidator.test.ts +159 -0
- package/src/Validators/SignerValidator.ts +683 -0
- package/src/Validators/Validator.test.ts +21 -0
- package/src/Validators/Validator.ts +55 -0
- package/src/claiming.ts +56 -0
- package/src/errors.ts +866 -0
- package/src/index.test.ts +122 -0
- package/src/index.ts +58 -0
- package/src/transfers.ts +284 -0
- package/src/utils.test.ts +44 -0
- package/src/utils.ts +247 -0
- package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
- package/dist/generated-BaaleHW-.cjs +0 -2
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readSignerValidatorHashSignerData,
|
|
3
|
+
readSignerValidatorSigners,
|
|
4
|
+
signerValidatorAbi,
|
|
5
|
+
simulateSignerValidatorSetAuthorized,
|
|
6
|
+
simulateSignerValidatorSetValidatorCaller,
|
|
7
|
+
simulateSignerValidatorValidate,
|
|
8
|
+
writeSignerValidatorSetAuthorized,
|
|
9
|
+
writeSignerValidatorSetValidatorCaller,
|
|
10
|
+
writeSignerValidatorValidate,
|
|
11
|
+
} from '@boostxyz/evm';
|
|
12
|
+
import { bytecode } from '@boostxyz/evm/artifacts/contracts/validators/SignerValidator.sol/SignerValidator.json';
|
|
13
|
+
import {
|
|
14
|
+
type Address,
|
|
15
|
+
type ContractEventName,
|
|
16
|
+
type Hex,
|
|
17
|
+
type PrivateKeyAccount,
|
|
18
|
+
encodeAbiParameters,
|
|
19
|
+
} from 'viem';
|
|
20
|
+
import { signTypedData } from 'viem/accounts';
|
|
21
|
+
import { SignerValidator as SignerValidatorBases } from '../../dist/deployments.json';
|
|
22
|
+
import type {
|
|
23
|
+
DeployableOptions,
|
|
24
|
+
GenericDeployableParams,
|
|
25
|
+
} from '../Deployable/Deployable';
|
|
26
|
+
import { DeployableTarget } from '../Deployable/DeployableTarget';
|
|
27
|
+
import {
|
|
28
|
+
type GenericLog,
|
|
29
|
+
type ReadParams,
|
|
30
|
+
RegistryType,
|
|
31
|
+
type WriteParams,
|
|
32
|
+
} from '../utils';
|
|
33
|
+
|
|
34
|
+
export { signerValidatorAbi };
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Object reprentation of a {@link SignerValidator} initialization payload
|
|
38
|
+
*
|
|
39
|
+
* @export
|
|
40
|
+
* @interface SignerValidatorPayload
|
|
41
|
+
* @typedef {SignerValidatorPayload}
|
|
42
|
+
*/
|
|
43
|
+
export interface SignerValidatorPayload {
|
|
44
|
+
/**
|
|
45
|
+
* The list of authorized signers. The first address in the list will be the initial owner of the contract.
|
|
46
|
+
*
|
|
47
|
+
* @type {Address[]}
|
|
48
|
+
*/
|
|
49
|
+
signers: Address[];
|
|
50
|
+
/**
|
|
51
|
+
* The authorized caller of the {@link prepareSignerValidator} function
|
|
52
|
+
* @type {Address}
|
|
53
|
+
*/
|
|
54
|
+
validatorCaller: Address;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Description placeholder
|
|
59
|
+
*
|
|
60
|
+
* @export
|
|
61
|
+
* @interface SignerValidatorValidatePayload
|
|
62
|
+
* @typedef {SignerValidatorValidatePayload}
|
|
63
|
+
*/
|
|
64
|
+
export interface SignerValidatorValidatePayload {
|
|
65
|
+
/**
|
|
66
|
+
* The ID of the boost.
|
|
67
|
+
*
|
|
68
|
+
* @type {bigint}
|
|
69
|
+
*/
|
|
70
|
+
boostId: bigint;
|
|
71
|
+
/**
|
|
72
|
+
* The ID of the incentive.
|
|
73
|
+
*
|
|
74
|
+
* @type {bigint}
|
|
75
|
+
*/
|
|
76
|
+
incentiveId: bigint;
|
|
77
|
+
/**
|
|
78
|
+
* The address of the claimant.
|
|
79
|
+
*
|
|
80
|
+
* @type {Address}
|
|
81
|
+
*/
|
|
82
|
+
claimant: Address;
|
|
83
|
+
/**
|
|
84
|
+
* The claim data.
|
|
85
|
+
*
|
|
86
|
+
* @type {Hex}
|
|
87
|
+
*/
|
|
88
|
+
claimData: Hex;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Object reprentation of a {@link SignerValidator} initialization payload
|
|
93
|
+
*
|
|
94
|
+
* @export
|
|
95
|
+
* @interface SignerValidatorPayload
|
|
96
|
+
* @typedef {SignerValidatorPayload}
|
|
97
|
+
*/
|
|
98
|
+
export interface SignerValidatorPayload {
|
|
99
|
+
/**
|
|
100
|
+
* The list of authorized signers. The first address in the list will be the initial owner of the contract.
|
|
101
|
+
*
|
|
102
|
+
* @type {Address[]}
|
|
103
|
+
*/
|
|
104
|
+
signers: Address[];
|
|
105
|
+
/**
|
|
106
|
+
* The authorized caller of the {@link prepareSignerValidator} function
|
|
107
|
+
* @type {Address}
|
|
108
|
+
*/
|
|
109
|
+
validatorCaller: Address;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Description placeholder
|
|
114
|
+
*
|
|
115
|
+
* @export
|
|
116
|
+
* @interface SignerValidatorValidatePayload
|
|
117
|
+
* @typedef {SignerValidatorValidatePayload}
|
|
118
|
+
*/
|
|
119
|
+
export interface SignerValidatorValidatePayload {
|
|
120
|
+
/**
|
|
121
|
+
* The ID of the boost.
|
|
122
|
+
*
|
|
123
|
+
* @type {bigint}
|
|
124
|
+
*/
|
|
125
|
+
boostId: bigint;
|
|
126
|
+
/**
|
|
127
|
+
* The ID of the incentive.
|
|
128
|
+
*
|
|
129
|
+
* @type {bigint}
|
|
130
|
+
*/
|
|
131
|
+
incentiveId: bigint;
|
|
132
|
+
/**
|
|
133
|
+
* The address of the claimant.
|
|
134
|
+
*
|
|
135
|
+
* @type {Address}
|
|
136
|
+
*/
|
|
137
|
+
claimant: Address;
|
|
138
|
+
/**
|
|
139
|
+
* The claim data.
|
|
140
|
+
*
|
|
141
|
+
* @type {Hex}
|
|
142
|
+
*/
|
|
143
|
+
claimData: Hex;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Signer Validator Claim Data Payload
|
|
148
|
+
*
|
|
149
|
+
* @export
|
|
150
|
+
* @interface SignerValidatorClaimDataParams
|
|
151
|
+
* @typedef {SignerValidatorClaimDataParams}
|
|
152
|
+
*/
|
|
153
|
+
export interface SignerValidatorClaimDataParams {
|
|
154
|
+
/**
|
|
155
|
+
* The signer with which to sign the input
|
|
156
|
+
*
|
|
157
|
+
* @type {{
|
|
158
|
+
* account: Address;
|
|
159
|
+
* key: Hex;
|
|
160
|
+
* privateKey: PrivateKeyAccount;
|
|
161
|
+
* }}
|
|
162
|
+
*/
|
|
163
|
+
signer: {
|
|
164
|
+
account: Address;
|
|
165
|
+
key: Hex;
|
|
166
|
+
privateKey: PrivateKeyAccount;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* The encoded data to provide the underlying incentive. You can use {@link prepareAllowListIncentivePayload}, {@link prepareCGDAIncentivePayload}, {@link prepareERC20IncentivePayload}, {@link prepareERC1155IncentivePayload}, or {@link preparePointsIncentivePayload}
|
|
170
|
+
*
|
|
171
|
+
* @type {Hex}
|
|
172
|
+
*/
|
|
173
|
+
incentiveData: Hex;
|
|
174
|
+
/**
|
|
175
|
+
* The chain id to target
|
|
176
|
+
*
|
|
177
|
+
* @type {number}
|
|
178
|
+
*/
|
|
179
|
+
chainId: number;
|
|
180
|
+
/**
|
|
181
|
+
* The address of the validator
|
|
182
|
+
*
|
|
183
|
+
* @type {Address}
|
|
184
|
+
*/
|
|
185
|
+
validator: Address;
|
|
186
|
+
/**
|
|
187
|
+
* The incentive quantity.
|
|
188
|
+
*
|
|
189
|
+
* @type {number}
|
|
190
|
+
*/
|
|
191
|
+
incentiveQuantity: number;
|
|
192
|
+
/**
|
|
193
|
+
* The address of the claimant
|
|
194
|
+
*
|
|
195
|
+
* @type {Address}
|
|
196
|
+
*/
|
|
197
|
+
claimant: Address;
|
|
198
|
+
/**
|
|
199
|
+
* The ID of the boost
|
|
200
|
+
*
|
|
201
|
+
* @type {bigint}
|
|
202
|
+
*/
|
|
203
|
+
boostId: bigint;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Object representation of a {@link SignerValidatorInputParams} initialization payload
|
|
208
|
+
*
|
|
209
|
+
* @export
|
|
210
|
+
* @interface SignerValidatorInputParams
|
|
211
|
+
* @typedef {SignerValidatorInputParams}
|
|
212
|
+
*/
|
|
213
|
+
export interface SignerValidatorInputParams {
|
|
214
|
+
/**
|
|
215
|
+
* The signer address.
|
|
216
|
+
*
|
|
217
|
+
* @type {Address}
|
|
218
|
+
*/
|
|
219
|
+
signer: Address;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* The signature data.
|
|
223
|
+
*
|
|
224
|
+
* @type {string}
|
|
225
|
+
*/
|
|
226
|
+
signature: Hex;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* The incentive quantity.
|
|
230
|
+
*
|
|
231
|
+
* @type {number}
|
|
232
|
+
*/
|
|
233
|
+
incentiveQuantity: number;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Object representing the payload for signing before validaton.
|
|
238
|
+
*
|
|
239
|
+
* @export
|
|
240
|
+
* @interface SignerValidatorSignaturePayload
|
|
241
|
+
* @typedef {SignerValidatorSignaturePayload}
|
|
242
|
+
*/
|
|
243
|
+
export interface SignerValidatorSignaturePayload {
|
|
244
|
+
/**
|
|
245
|
+
* The ID of the boost.
|
|
246
|
+
*
|
|
247
|
+
* @type {bigint}
|
|
248
|
+
*/
|
|
249
|
+
boostId: bigint;
|
|
250
|
+
/**
|
|
251
|
+
* The ID of the incentive.
|
|
252
|
+
*
|
|
253
|
+
* @type {number}
|
|
254
|
+
*/
|
|
255
|
+
incentiveQuantity: number;
|
|
256
|
+
/**
|
|
257
|
+
* The address of the claimant.
|
|
258
|
+
*
|
|
259
|
+
* @type {Address}
|
|
260
|
+
*/
|
|
261
|
+
claimant: Address;
|
|
262
|
+
/**
|
|
263
|
+
* The claim data.
|
|
264
|
+
*
|
|
265
|
+
* @type {Hex}
|
|
266
|
+
*/
|
|
267
|
+
incentiveData: Hex;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* A generic `viem.Log` event with support for `BoostCore` event types.
|
|
272
|
+
*
|
|
273
|
+
* @export
|
|
274
|
+
* @typedef {SignerValidatorLog}
|
|
275
|
+
* @template {ContractEventName<
|
|
276
|
+
* typeof signerValidatorAbi
|
|
277
|
+
* >} [event=ContractEventName<typeof signerValidatorAbi>]
|
|
278
|
+
*/
|
|
279
|
+
export type SignerValidatorLog<
|
|
280
|
+
event extends ContractEventName<
|
|
281
|
+
typeof signerValidatorAbi
|
|
282
|
+
> = ContractEventName<typeof signerValidatorAbi>,
|
|
283
|
+
> = GenericLog<typeof signerValidatorAbi, event>;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* A simple implementation of a Validator that verifies a given signature and checks the recovered address against a set of authorized signers
|
|
287
|
+
*
|
|
288
|
+
* @export
|
|
289
|
+
* @class SignerValidator
|
|
290
|
+
* @typedef {SignerValidator}
|
|
291
|
+
* @extends {DeployableTarget<SignerValidatorPayload>}
|
|
292
|
+
*/
|
|
293
|
+
export class SignerValidator extends DeployableTarget<
|
|
294
|
+
SignerValidatorPayload,
|
|
295
|
+
typeof signerValidatorAbi
|
|
296
|
+
> {
|
|
297
|
+
/**
|
|
298
|
+
* @inheritdoc
|
|
299
|
+
*
|
|
300
|
+
* @public
|
|
301
|
+
* @readonly
|
|
302
|
+
* @type {*}
|
|
303
|
+
*/
|
|
304
|
+
public override readonly abi = signerValidatorAbi;
|
|
305
|
+
/**
|
|
306
|
+
* @inheritdoc
|
|
307
|
+
*
|
|
308
|
+
* @public
|
|
309
|
+
* @static
|
|
310
|
+
* @type {Record<number, Address>}
|
|
311
|
+
*/
|
|
312
|
+
public static override bases: Record<number, Address> = {
|
|
313
|
+
...(SignerValidatorBases as Record<number, Address>),
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* @inheritdoc
|
|
317
|
+
*
|
|
318
|
+
* @public
|
|
319
|
+
* @static
|
|
320
|
+
* @type {RegistryType}
|
|
321
|
+
*/
|
|
322
|
+
public static override registryType: RegistryType = RegistryType.VALIDATOR;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* The set of authorized signers
|
|
326
|
+
*
|
|
327
|
+
* @public
|
|
328
|
+
* @async
|
|
329
|
+
* @param {Address} address
|
|
330
|
+
* @param {?ReadParams} [params]
|
|
331
|
+
* @returns {Promise<boolean>}
|
|
332
|
+
*/
|
|
333
|
+
public async signers(
|
|
334
|
+
address: Address,
|
|
335
|
+
params?: ReadParams<typeof signerValidatorAbi, 'signers'>,
|
|
336
|
+
) {
|
|
337
|
+
return await readSignerValidatorSigners(this._config, {
|
|
338
|
+
address: this.assertValidAddress(),
|
|
339
|
+
args: [address],
|
|
340
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
341
|
+
...(params as any),
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Retrieve the hash and signer data for a given hash
|
|
347
|
+
*
|
|
348
|
+
* @public
|
|
349
|
+
* @async
|
|
350
|
+
* @param {SignerValidatorSignaturePayload} payload
|
|
351
|
+
* @param {?ReadParams} [params]
|
|
352
|
+
* @returns {Promise<Hex>}
|
|
353
|
+
*/
|
|
354
|
+
public async hashSignerData(
|
|
355
|
+
payload: SignerValidatorSignaturePayload,
|
|
356
|
+
params?: ReadParams<typeof signerValidatorAbi, 'hashSignerData'>,
|
|
357
|
+
) {
|
|
358
|
+
return await readSignerValidatorHashSignerData(this._config, {
|
|
359
|
+
address: this.assertValidAddress(),
|
|
360
|
+
args: [
|
|
361
|
+
payload.boostId,
|
|
362
|
+
payload.incentiveQuantity,
|
|
363
|
+
payload.claimant,
|
|
364
|
+
payload.incentiveData,
|
|
365
|
+
],
|
|
366
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
367
|
+
...(params as any),
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Validate that the action has been completed successfully. The data payload is expected to be a tuple of (address signer, bytes32 hash, bytes signature). The signature is expected to be a valid ECDSA or EIP-1271 signature of a unique hash by an authorized signer.
|
|
373
|
+
*
|
|
374
|
+
* @public
|
|
375
|
+
* @async
|
|
376
|
+
* @param {SignerValidatorValidatePayload} payload
|
|
377
|
+
* @param {?WriteParams} [params]
|
|
378
|
+
* @returns {Promise<boolean>} - True if the action has been validated based on the data payload
|
|
379
|
+
*/
|
|
380
|
+
protected async validate(
|
|
381
|
+
payload: SignerValidatorValidatePayload,
|
|
382
|
+
params?: WriteParams<typeof signerValidatorAbi, 'validate'>,
|
|
383
|
+
) {
|
|
384
|
+
return await this.awaitResult(this.validateRaw(payload, params));
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Validate that the action has been completed successfully. The data payload is expected to be a tuple of (address signer, bytes32 hash, bytes signature). The signature is expected to be a valid ECDSA or EIP-1271 signature of a unique hash by an authorized signer.
|
|
389
|
+
*
|
|
390
|
+
* @public
|
|
391
|
+
* @async
|
|
392
|
+
* @param {SignerValidatorValidatePayload} payload
|
|
393
|
+
* @param {?WriteParams} [params]
|
|
394
|
+
* @returns {Promise<boolean>} - True if the action has been validated based on the data payload
|
|
395
|
+
*/
|
|
396
|
+
protected async validateRaw(
|
|
397
|
+
payload: SignerValidatorValidatePayload,
|
|
398
|
+
params?: ReadParams<typeof signerValidatorAbi, 'validate'>,
|
|
399
|
+
) {
|
|
400
|
+
const { request, result } = await simulateSignerValidatorValidate(
|
|
401
|
+
this._config,
|
|
402
|
+
{
|
|
403
|
+
address: this.assertValidAddress(),
|
|
404
|
+
args: [
|
|
405
|
+
payload.boostId,
|
|
406
|
+
payload.incentiveId,
|
|
407
|
+
payload.claimant,
|
|
408
|
+
payload.claimData,
|
|
409
|
+
],
|
|
410
|
+
...this.optionallyAttachAccount(),
|
|
411
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
412
|
+
...(params as any),
|
|
413
|
+
},
|
|
414
|
+
);
|
|
415
|
+
const hash = await writeSignerValidatorValidate(this._config, request);
|
|
416
|
+
return { hash, result };
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Set the authorized status of a signer
|
|
421
|
+
*
|
|
422
|
+
* @public
|
|
423
|
+
* @async
|
|
424
|
+
* @param {Address[]} addresses - The list of signers to update
|
|
425
|
+
* @param {boolean[]} allowed - The authorized status of each signer
|
|
426
|
+
* @param {?WriteParams} [params]
|
|
427
|
+
* @returns {Promise<void>}
|
|
428
|
+
*/
|
|
429
|
+
public async setAuthorized(
|
|
430
|
+
addresses: Address[],
|
|
431
|
+
allowed: boolean[],
|
|
432
|
+
params?: WriteParams<typeof signerValidatorAbi, 'setAuthorized'>,
|
|
433
|
+
) {
|
|
434
|
+
return await this.awaitResult(
|
|
435
|
+
this.setAuthorizedRaw(addresses, allowed, params),
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Set the authorized status of a signer
|
|
441
|
+
*
|
|
442
|
+
* @public
|
|
443
|
+
* @async
|
|
444
|
+
* @param {Address[]} addresses - The list of signers to update
|
|
445
|
+
* @param {boolean[]} allowed - The authorized status of each signer
|
|
446
|
+
* @param {?WriteParams} [params]
|
|
447
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
448
|
+
*/
|
|
449
|
+
public async setAuthorizedRaw(
|
|
450
|
+
addresses: Address[],
|
|
451
|
+
allowed: boolean[],
|
|
452
|
+
params?: WriteParams<typeof signerValidatorAbi, 'setAuthorized'>,
|
|
453
|
+
) {
|
|
454
|
+
const { request, result } = await simulateSignerValidatorSetAuthorized(
|
|
455
|
+
this._config,
|
|
456
|
+
{
|
|
457
|
+
address: this.assertValidAddress(),
|
|
458
|
+
args: [addresses, allowed],
|
|
459
|
+
...this.optionallyAttachAccount(),
|
|
460
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
461
|
+
...(params as any),
|
|
462
|
+
},
|
|
463
|
+
);
|
|
464
|
+
const hash = await writeSignerValidatorSetAuthorized(this._config, request);
|
|
465
|
+
return { hash, result };
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Update the authorized caller of the validator function
|
|
470
|
+
*
|
|
471
|
+
* @public
|
|
472
|
+
* @async
|
|
473
|
+
* @param {Address} address
|
|
474
|
+
* @param {?WriteParams} [params]
|
|
475
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
476
|
+
*/
|
|
477
|
+
public async setValidatorCallerRaw(
|
|
478
|
+
address: Address,
|
|
479
|
+
params?: WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>,
|
|
480
|
+
) {
|
|
481
|
+
const { request, result } = await simulateSignerValidatorSetValidatorCaller(
|
|
482
|
+
this._config,
|
|
483
|
+
{
|
|
484
|
+
address: this.assertValidAddress(),
|
|
485
|
+
args: [address],
|
|
486
|
+
...this.optionallyAttachAccount(),
|
|
487
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
488
|
+
...(params as any),
|
|
489
|
+
},
|
|
490
|
+
);
|
|
491
|
+
const hash = await writeSignerValidatorSetValidatorCaller(
|
|
492
|
+
this._config,
|
|
493
|
+
request,
|
|
494
|
+
);
|
|
495
|
+
return { hash, result };
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Update the authorized caller of the validator function
|
|
500
|
+
*
|
|
501
|
+
* @public
|
|
502
|
+
* @async
|
|
503
|
+
* @param {Address} address
|
|
504
|
+
* @param {?WriteParams} [params]
|
|
505
|
+
* @returns {Promise<void>}
|
|
506
|
+
*/
|
|
507
|
+
public async setValidatorCaller(
|
|
508
|
+
address: Address,
|
|
509
|
+
params?: WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>,
|
|
510
|
+
) {
|
|
511
|
+
return await this.awaitResult(this.setValidatorCallerRaw(address, params));
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Properly encodes the data needed to claim
|
|
516
|
+
*
|
|
517
|
+
* @public
|
|
518
|
+
* @async
|
|
519
|
+
* @param {SignerValidatorClaimDataParams} params
|
|
520
|
+
* @returns {Promise<Hex>}
|
|
521
|
+
*/
|
|
522
|
+
public async encodeClaimData(
|
|
523
|
+
params: Omit<SignerValidatorClaimDataParams, 'validator'>,
|
|
524
|
+
): Promise<Hex> {
|
|
525
|
+
return await prepareSignerValidatorClaimDataPayload({
|
|
526
|
+
...params,
|
|
527
|
+
validator: this.assertValidAddress(),
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* @inheritdoc
|
|
533
|
+
*
|
|
534
|
+
* @public
|
|
535
|
+
* @param {?SignerValidatorPayload} [_payload]
|
|
536
|
+
* @param {?DeployableOptions} [_options]
|
|
537
|
+
* @returns {GenericDeployableParams}
|
|
538
|
+
*/
|
|
539
|
+
public override buildParameters(
|
|
540
|
+
_payload?: SignerValidatorPayload,
|
|
541
|
+
_options?: DeployableOptions,
|
|
542
|
+
): GenericDeployableParams {
|
|
543
|
+
const [payload, options] = this.validateDeploymentConfig(
|
|
544
|
+
_payload,
|
|
545
|
+
_options,
|
|
546
|
+
);
|
|
547
|
+
return {
|
|
548
|
+
abi: signerValidatorAbi,
|
|
549
|
+
bytecode: bytecode as Hex,
|
|
550
|
+
args: [prepareSignerValidatorPayload(payload)],
|
|
551
|
+
...this.optionallyAttachAccount(options.account),
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Signer Validator Claim Data Payload Preparation
|
|
558
|
+
*
|
|
559
|
+
* @export
|
|
560
|
+
* @async
|
|
561
|
+
* @param {SignerValidatorClaimDataParams} param0
|
|
562
|
+
* @param {{ account: Address; key: Hex; privateKey: PrivateKeyAccount; }} param0.signer
|
|
563
|
+
* @param {Hex} param0.incentiveData
|
|
564
|
+
* @param {number} param0.chainId
|
|
565
|
+
* @param {Address} param0.validator
|
|
566
|
+
* @param {number} param0.incentiveQuantity
|
|
567
|
+
* @param {Address} param0.claimant
|
|
568
|
+
* @param {bigint} param0.boostId
|
|
569
|
+
* @returns {Promise<Hex>}
|
|
570
|
+
*/
|
|
571
|
+
export async function prepareSignerValidatorClaimDataPayload({
|
|
572
|
+
signer,
|
|
573
|
+
incentiveData,
|
|
574
|
+
chainId,
|
|
575
|
+
validator,
|
|
576
|
+
incentiveQuantity,
|
|
577
|
+
claimant,
|
|
578
|
+
boostId,
|
|
579
|
+
}: SignerValidatorClaimDataParams): Promise<Hex> {
|
|
580
|
+
const domain = {
|
|
581
|
+
name: 'SignerValidator',
|
|
582
|
+
version: '1',
|
|
583
|
+
chainId: chainId,
|
|
584
|
+
verifyingContract: validator,
|
|
585
|
+
};
|
|
586
|
+
const typedData = {
|
|
587
|
+
domain,
|
|
588
|
+
types: {
|
|
589
|
+
SignerValidatorData: [
|
|
590
|
+
{ name: 'boostId', type: 'uint256' },
|
|
591
|
+
{ name: 'incentiveQuantity', type: 'uint8' },
|
|
592
|
+
{ name: 'claimant', type: 'address' },
|
|
593
|
+
{ name: 'incentiveData', type: 'bytes' },
|
|
594
|
+
],
|
|
595
|
+
},
|
|
596
|
+
primaryType: 'SignerValidatorData' as const,
|
|
597
|
+
message: {
|
|
598
|
+
boostId,
|
|
599
|
+
incentiveQuantity,
|
|
600
|
+
claimant,
|
|
601
|
+
incentiveData: incentiveData,
|
|
602
|
+
},
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
const trustedSignature = await signTypedData({
|
|
606
|
+
...typedData,
|
|
607
|
+
privateKey: signer.key,
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
// Prepare the claim data payload using the new helper
|
|
611
|
+
const validatorData = prepareSignerValidatorInputParams({
|
|
612
|
+
signer: signer.account,
|
|
613
|
+
signature: trustedSignature,
|
|
614
|
+
incentiveQuantity, // Adjust incentive quantity as necessary
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
const boostClaimDataPayload = encodeAbiParameters(
|
|
618
|
+
[
|
|
619
|
+
{
|
|
620
|
+
type: 'tuple',
|
|
621
|
+
name: 'BoostClaimData',
|
|
622
|
+
components: [
|
|
623
|
+
{ type: 'bytes', name: 'validatorData' },
|
|
624
|
+
{ type: 'bytes', name: 'incentiveData' },
|
|
625
|
+
],
|
|
626
|
+
},
|
|
627
|
+
],
|
|
628
|
+
[{ validatorData, incentiveData }],
|
|
629
|
+
);
|
|
630
|
+
|
|
631
|
+
return boostClaimDataPayload;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Given a {@link SignerValidatorInputParams}, properly encode the initialization payload.
|
|
636
|
+
*
|
|
637
|
+
* @param {SignerValidatorInputParams} param0
|
|
638
|
+
* @param {Address} param0.signer
|
|
639
|
+
* @param {Hex} param0.signature
|
|
640
|
+
* @param {number} param0.incentiveQuantity
|
|
641
|
+
* @returns {Hex}
|
|
642
|
+
*/
|
|
643
|
+
export function prepareSignerValidatorInputParams({
|
|
644
|
+
signer,
|
|
645
|
+
signature,
|
|
646
|
+
incentiveQuantity,
|
|
647
|
+
}: SignerValidatorInputParams) {
|
|
648
|
+
return encodeAbiParameters(
|
|
649
|
+
[
|
|
650
|
+
{
|
|
651
|
+
type: 'tuple',
|
|
652
|
+
name: 'SignerValidatorInputParams',
|
|
653
|
+
components: [
|
|
654
|
+
{ type: 'address', name: 'signer' },
|
|
655
|
+
{ type: 'bytes', name: 'signature' },
|
|
656
|
+
{ type: 'uint8', name: 'incentiveQuantity' },
|
|
657
|
+
],
|
|
658
|
+
},
|
|
659
|
+
],
|
|
660
|
+
[{ signer, signature, incentiveQuantity }],
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Given a {@link SignerValidatorPayload}, properly encode the initialization payload.
|
|
666
|
+
*
|
|
667
|
+
* @param {SignerValidatorPayload} param0
|
|
668
|
+
* @param {Address[]} param0.signers
|
|
669
|
+
* @param {Address} param0.validatorCaller
|
|
670
|
+
* @returns {Hex}
|
|
671
|
+
*/
|
|
672
|
+
export function prepareSignerValidatorPayload({
|
|
673
|
+
signers,
|
|
674
|
+
validatorCaller,
|
|
675
|
+
}: SignerValidatorPayload) {
|
|
676
|
+
return encodeAbiParameters(
|
|
677
|
+
[
|
|
678
|
+
{ type: 'address[]', name: 'signers' },
|
|
679
|
+
{ type: 'address', name: 'validatorCaller' },
|
|
680
|
+
],
|
|
681
|
+
[signers, validatorCaller],
|
|
682
|
+
);
|
|
683
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { defaultOptions } from '@boostxyz/test/helpers';
|
|
3
|
+
import { testAccount } from '@boostxyz/test/viem';
|
|
4
|
+
import { SignerValidator } from './SignerValidator';
|
|
5
|
+
import { validatorFromAddress } from './Validator';
|
|
6
|
+
|
|
7
|
+
describe('Validator', () => {
|
|
8
|
+
test('can automatically instantiate SignerValidator given an address', async () => {
|
|
9
|
+
const validator = new SignerValidator(defaultOptions, {
|
|
10
|
+
signers: [testAccount.address],
|
|
11
|
+
validatorCaller: testAccount.address,
|
|
12
|
+
});
|
|
13
|
+
await validator.deploy();
|
|
14
|
+
expect(
|
|
15
|
+
await validatorFromAddress(
|
|
16
|
+
defaultOptions,
|
|
17
|
+
validator.assertValidAddress(),
|
|
18
|
+
),
|
|
19
|
+
).toBeInstanceOf(SignerValidator);
|
|
20
|
+
});
|
|
21
|
+
});
|