@boostxyz/sdk 0.0.0-alpha.17 → 0.0.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.cjs.map +1 -1
- package/dist/Actions/Action.js +13 -13
- package/dist/Actions/ContractAction.d.ts +9 -9
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +12 -12
- 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 +32 -49
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +13 -962
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +3 -3
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +5 -5
- package/dist/AllowLists/SimpleAllowList.js +24 -24
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +6 -6
- package/dist/AllowLists/SimpleDenyList.js +3 -3
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/Boost.cjs.map +1 -1
- package/dist/Boost.d.ts +18 -0
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore-BiPwp6SR.cjs +3 -0
- package/dist/BoostCore-BiPwp6SR.cjs.map +1 -0
- package/dist/BoostCore-kwoUw7YE.js +1477 -0
- package/dist/BoostCore-kwoUw7YE.js.map +1 -0
- package/dist/BoostCore.cjs +1 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +86 -36
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +29 -1273
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.d.ts +25 -19
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +30 -29
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +2 -2
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts +18 -18
- package/dist/Budgets/ManagedBudget.js +48 -48
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +23 -23
- package/dist/Deployable/Contract.cjs +1 -1
- package/dist/Deployable/Contract.cjs.map +1 -1
- package/dist/Deployable/Contract.d.ts +4 -5
- package/dist/Deployable/Contract.d.ts.map +1 -1
- package/dist/Deployable/Contract.js +4 -5
- package/dist/Deployable/Contract.js.map +1 -1
- package/dist/Deployable/Deployable.cjs.map +1 -1
- package/dist/Deployable/Deployable.d.ts +1 -1
- package/dist/Deployable/Deployable.js +1 -1
- 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 +5 -5
- package/dist/Deployable/DeployableTarget.js +6 -6
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts +15 -15
- package/dist/Deployable/DeployableTargetWithRBAC.js +33 -33
- package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -1
- package/dist/EventAction-D5tnm00s.js +1355 -0
- package/dist/EventAction-D5tnm00s.js.map +1 -0
- package/dist/EventAction-DBDRaG4A.cjs +2 -0
- package/dist/EventAction-DBDRaG4A.cjs.map +1 -0
- package/dist/{Incentive-DJf-vdyL.js → Incentive-Bp8Sez7M.js} +61 -62
- package/dist/Incentive-Bp8Sez7M.js.map +1 -0
- package/dist/{Incentive-DNwROd1r.cjs → Incentive-Djnzseoj.cjs} +2 -2
- package/dist/Incentive-Djnzseoj.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +12 -12
- package/dist/Incentives/AllowListIncentive.js +19 -19
- 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 +15 -15
- package/dist/Incentives/CGDAIncentive.js +18 -18
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +30 -30
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +23 -23
- package/dist/Incentives/ERC20Incentive.js +25 -25
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +523 -0
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +19 -19
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.d.ts +3 -3
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +3 -3
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +14 -14
- package/dist/Incentives/PointsIncentive.js +21 -21
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-DMlUkmAn.cjs → SimpleDenyList-BwfNjRsg.cjs} +2 -2
- package/dist/SimpleDenyList-BwfNjRsg.cjs.map +1 -0
- package/dist/{SimpleDenyList-DvUvmOeE.js → SimpleDenyList-Cn5WpNn0.js} +9 -9
- package/dist/SimpleDenyList-Cn5WpNn0.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 +14 -14
- package/dist/Validators/SignerValidator.js +19 -19
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.cjs.map +1 -1
- package/dist/Validators/Validator.d.ts +1 -1
- package/dist/Validators/Validator.js +6 -6
- package/dist/Validators/Validator.js.map +1 -1
- package/dist/claiming.cjs.map +1 -1
- package/dist/claiming.d.ts +1 -1
- package/dist/claiming.js.map +1 -1
- package/dist/componentInterfaces-D09mhzxO.cjs +2 -0
- package/dist/componentInterfaces-D09mhzxO.cjs.map +1 -0
- package/dist/componentInterfaces-RXBMI5yH.js +14 -0
- package/dist/componentInterfaces-RXBMI5yH.js.map +1 -0
- package/dist/deployments-BM42vImE.js +43 -0
- package/dist/deployments-BM42vImE.js.map +1 -0
- package/dist/deployments-CMdF5uEC.cjs +2 -0
- package/dist/deployments-CMdF5uEC.cjs.map +1 -0
- package/dist/deployments.json +15 -12
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +132 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +122 -36
- package/dist/errors.js.map +1 -1
- package/dist/generated-B0tk-c9b.cjs +3 -0
- package/dist/generated-B0tk-c9b.cjs.map +1 -0
- package/dist/{generated-C_7Jx3YG.js → generated-B7VaSah4.js} +631 -343
- package/dist/generated-B7VaSah4.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +135 -126
- package/dist/transfers.cjs.map +1 -1
- package/dist/transfers.d.ts +1 -1
- package/dist/transfers.js.map +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +5 -5
- package/src/Actions/ContractAction.ts +9 -10
- package/src/Actions/ERC721MintAction.ts +12 -13
- package/src/Actions/EventAction.test.ts +45 -54
- package/src/Actions/EventAction.ts +100 -100
- package/src/AllowLists/SimpleAllowList.ts +5 -5
- package/src/AllowLists/SimpleDenyList.ts +6 -6
- package/src/Boost.ts +19 -0
- package/src/BoostCore.test.ts +117 -1
- package/src/BoostCore.ts +121 -57
- package/src/BoostRegistry.ts +29 -21
- package/src/Budgets/ManagedBudget.ts +18 -18
- package/src/Budgets/VestingBudget.ts +23 -23
- package/src/Deployable/Contract.ts +4 -5
- package/src/Deployable/Deployable.ts +1 -1
- package/src/Deployable/DeployableTarget.ts +5 -5
- package/src/Deployable/DeployableTargetWithRBAC.ts +15 -15
- package/src/Incentives/AllowListIncentive.ts +12 -12
- package/src/Incentives/CGDAIncentive.ts +15 -15
- package/src/Incentives/ERC1155Incentive.ts +26 -26
- package/src/Incentives/ERC20Incentive.ts +23 -23
- package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +309 -0
- package/src/Incentives/ERC20VariableIncentive.ts +19 -19
- package/src/Incentives/Incentive.ts +6 -5
- package/src/Incentives/PointsIncentive.test.ts +21 -21
- package/src/Incentives/PointsIncentive.ts +14 -14
- package/src/Validators/SignerValidator.ts +14 -14
- package/src/Validators/Validator.ts +1 -1
- package/src/claiming.ts +1 -1
- package/src/errors.ts +165 -0
- package/src/index.test.ts +117 -33
- package/src/index.ts +1 -0
- package/src/transfers.ts +1 -1
- package/src/utils.ts +1 -1
- package/dist/Incentive-DJf-vdyL.js.map +0 -1
- package/dist/Incentive-DNwROd1r.cjs.map +0 -1
- package/dist/SimpleDenyList-DMlUkmAn.cjs.map +0 -1
- package/dist/SimpleDenyList-DvUvmOeE.js.map +0 -1
- package/dist/componentInterfaces-BPVR_Ykd.js +0 -13
- package/dist/componentInterfaces-BPVR_Ykd.js.map +0 -1
- package/dist/componentInterfaces-BfppSIl4.cjs +0 -2
- package/dist/componentInterfaces-BfppSIl4.cjs.map +0 -1
- package/dist/deployments-BvFcK_eR.js +0 -40
- package/dist/deployments-BvFcK_eR.js.map +0 -1
- package/dist/deployments-Ho4PnGCS.cjs +0 -2
- package/dist/deployments-Ho4PnGCS.cjs.map +0 -1
- package/dist/generated-CMQ6ZC2_.cjs +0 -3
- package/dist/generated-CMQ6ZC2_.cjs.map +0 -1
- package/dist/generated-C_7Jx3YG.js.map +0 -1
|
@@ -116,8 +116,8 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
116
116
|
*
|
|
117
117
|
* @public
|
|
118
118
|
* @async
|
|
119
|
-
* @param {?ReadParams
|
|
120
|
-
* @returns {
|
|
119
|
+
* @param {?ReadParams} [params]
|
|
120
|
+
* @returns {Promise<Address>}
|
|
121
121
|
*/
|
|
122
122
|
public async owner(
|
|
123
123
|
params?: ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>,
|
|
@@ -135,7 +135,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
135
135
|
*
|
|
136
136
|
* @public
|
|
137
137
|
* @async
|
|
138
|
-
* @param {?ReadParams
|
|
138
|
+
* @param {?ReadParams} [params]
|
|
139
139
|
* @returns {Promise<bigint>}
|
|
140
140
|
*/
|
|
141
141
|
public async totalClaimed(
|
|
@@ -154,7 +154,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
154
154
|
*
|
|
155
155
|
* @public
|
|
156
156
|
* @async
|
|
157
|
-
* @param {?ReadParams
|
|
157
|
+
* @param {?ReadParams} [params]
|
|
158
158
|
* @returns {Promise<bigint>} - The current reward
|
|
159
159
|
*/
|
|
160
160
|
public async currentReward(
|
|
@@ -173,7 +173,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
173
173
|
*
|
|
174
174
|
* @public
|
|
175
175
|
* @async
|
|
176
|
-
* @param {?ReadParams
|
|
176
|
+
* @param {?ReadParams} [params]
|
|
177
177
|
* @returns {Promise<bigint>}
|
|
178
178
|
*/
|
|
179
179
|
public async claims(
|
|
@@ -193,7 +193,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
193
193
|
* @public
|
|
194
194
|
* @async
|
|
195
195
|
* @param {Address} address
|
|
196
|
-
* @param {?ReadParams
|
|
196
|
+
* @param {?ReadParams} [params]
|
|
197
197
|
* @returns {Promise<boolean>}
|
|
198
198
|
*/
|
|
199
199
|
public async claimed(
|
|
@@ -213,7 +213,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
213
213
|
*
|
|
214
214
|
* @public
|
|
215
215
|
* @async
|
|
216
|
-
* @param {?ReadParams
|
|
216
|
+
* @param {?ReadParams} [params]
|
|
217
217
|
* @returns {Promise<Address>}
|
|
218
218
|
*/
|
|
219
219
|
public async asset(
|
|
@@ -231,7 +231,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
231
231
|
*
|
|
232
232
|
* @public
|
|
233
233
|
* @async
|
|
234
|
-
* @param {?ReadParams
|
|
234
|
+
* @param {?ReadParams} [params]
|
|
235
235
|
* @returns {Promise<bigint>}
|
|
236
236
|
*/
|
|
237
237
|
public async reward(
|
|
@@ -249,8 +249,8 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
249
249
|
*
|
|
250
250
|
* @public
|
|
251
251
|
* @async
|
|
252
|
-
* @param {?ReadParams
|
|
253
|
-
* @returns {
|
|
252
|
+
* @param {?ReadParams} [params]
|
|
253
|
+
* @returns {Promise<bigint>}
|
|
254
254
|
*/
|
|
255
255
|
public async limit(
|
|
256
256
|
params?: ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>,
|
|
@@ -268,7 +268,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
268
268
|
* @public
|
|
269
269
|
* @async
|
|
270
270
|
* @param {ClaimPayload} payload
|
|
271
|
-
* @param {?WriteParams
|
|
271
|
+
* @param {?WriteParams} [params]
|
|
272
272
|
* @returns {Promise<boolean>} - Returns true if successfully claimed
|
|
273
273
|
*/
|
|
274
274
|
protected async claim(
|
|
@@ -284,8 +284,8 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
284
284
|
* @public
|
|
285
285
|
* @async
|
|
286
286
|
* @param {ClaimPayload} payload
|
|
287
|
-
* @param {?WriteParams
|
|
288
|
-
* @returns {Promise<boolean>} - Returns true if successfully claimed
|
|
287
|
+
* @param {?WriteParams} [params]
|
|
288
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed
|
|
289
289
|
*/
|
|
290
290
|
protected async claimRaw(
|
|
291
291
|
payload: ClaimPayload,
|
|
@@ -311,7 +311,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
311
311
|
* @public
|
|
312
312
|
* @async
|
|
313
313
|
* @param {ClaimPayload} payload
|
|
314
|
-
* @param {?WriteParams
|
|
314
|
+
* @param {?WriteParams} [params]
|
|
315
315
|
* @returns {Promise<boolean>} - True if the assets were successfully clawbacked
|
|
316
316
|
*/
|
|
317
317
|
public async clawback(
|
|
@@ -327,8 +327,8 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
327
327
|
* @public
|
|
328
328
|
* @async
|
|
329
329
|
* @param {ClaimPayload} payload
|
|
330
|
-
* @param {?WriteParams
|
|
331
|
-
* @returns {Promise<boolean>} - True if the assets were successfully clawbacked
|
|
330
|
+
* @param {?WriteParams} [params]
|
|
331
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked
|
|
332
332
|
*/
|
|
333
333
|
public async clawbackRaw(
|
|
334
334
|
payload: ClaimPayload,
|
|
@@ -357,8 +357,8 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
357
357
|
* @public
|
|
358
358
|
* @async
|
|
359
359
|
* @param {ClaimPayload} payload
|
|
360
|
-
* @param {?ReadParams
|
|
361
|
-
* @returns {
|
|
360
|
+
* @param {?ReadParams} [params]
|
|
361
|
+
* @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload
|
|
362
362
|
*/
|
|
363
363
|
public async isClaimable(
|
|
364
364
|
payload: ClaimPayload,
|
|
@@ -404,7 +404,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
404
404
|
* @param {Address} param0.asset - The address of the incentivized asset.
|
|
405
405
|
* @param {bigint} param0.reward - The amount of the asset to distribute.
|
|
406
406
|
* @param {bigint} param0.limit - How many times can this incentive be claimed.
|
|
407
|
-
* @returns {
|
|
407
|
+
* @returns {Hex}
|
|
408
408
|
*/
|
|
409
409
|
export function prepareERC20VariableIncentivePayload({
|
|
410
410
|
asset,
|
|
@@ -13,6 +13,7 @@ import { InvalidComponentInterfaceError } from '../errors';
|
|
|
13
13
|
import { AllowListIncentive } from './AllowListIncentive';
|
|
14
14
|
import { CGDAIncentive } from './CGDAIncentive';
|
|
15
15
|
import { ERC20Incentive } from './ERC20Incentive';
|
|
16
|
+
import type { ERC20VariableCriteriaIncentive } from './ERC20VariableCriteriaIncentive';
|
|
16
17
|
import { ERC20VariableIncentive } from './ERC20VariableIncentive';
|
|
17
18
|
// import { ERC1155Incentive } from './ERC1155Incentive';
|
|
18
19
|
import { PointsIncentive } from './PointsIncentive';
|
|
@@ -38,7 +39,8 @@ export type Incentive =
|
|
|
38
39
|
| ERC20Incentive
|
|
39
40
|
// | ERC1155Incentive
|
|
40
41
|
| PointsIncentive
|
|
41
|
-
| ERC20VariableIncentive
|
|
42
|
+
| ERC20VariableIncentive
|
|
43
|
+
| ERC20VariableCriteriaIncentive;
|
|
42
44
|
|
|
43
45
|
/**
|
|
44
46
|
* A map of Incentive component interfaces to their constructors.
|
|
@@ -48,9 +50,8 @@ export type Incentive =
|
|
|
48
50
|
export const IncentiveByComponentInterface = {
|
|
49
51
|
[APointsIncentive as Hex]: PointsIncentive,
|
|
50
52
|
[AERC20Incentive as Hex]: ERC20Incentive,
|
|
51
|
-
|
|
52
|
-
[
|
|
53
|
-
// [APointsIncentive as Hex]: ERC1155Incentive,
|
|
53
|
+
[AAllowListIncentive]: AllowListIncentive,
|
|
54
|
+
// [AERC1155Incentive as Hex]: ERC1155Incentive,
|
|
54
55
|
[ACGDAIncentive as Hex]: CGDAIncentive,
|
|
55
56
|
[AERC20VariableIncentive as Hex]: ERC20VariableIncentive,
|
|
56
57
|
};
|
|
@@ -62,7 +63,7 @@ export const IncentiveByComponentInterface = {
|
|
|
62
63
|
* @async
|
|
63
64
|
* @param {DeployableOptions} options
|
|
64
65
|
* @param {Address} address
|
|
65
|
-
* @returns {
|
|
66
|
+
* @returns {Incentive}
|
|
66
67
|
* @throws {@link InvalidComponentInterfaceError}
|
|
67
68
|
*/
|
|
68
69
|
export async function incentiveFromAddress(
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { readPointsBalanceOf, writePointsGrantRoles } from
|
|
2
|
-
import { loadFixture } from
|
|
3
|
-
import { isAddress, pad, parseEther, zeroAddress } from
|
|
4
|
-
import { beforeAll, beforeEach, describe, expect, test } from
|
|
5
|
-
import type { MockPoints } from
|
|
6
|
-
import { accounts } from
|
|
1
|
+
import { readPointsBalanceOf, writePointsGrantRoles } from "@boostxyz/evm";
|
|
2
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
3
|
+
import { isAddress, pad, parseEther, zeroAddress } from "viem";
|
|
4
|
+
import { beforeAll, beforeEach, describe, expect, test } from "vitest";
|
|
5
|
+
import type { MockPoints } from "@boostxyz/test/MockPoints";
|
|
6
|
+
import { accounts } from "@boostxyz/test/accounts";
|
|
7
7
|
import {
|
|
8
8
|
type Fixtures,
|
|
9
9
|
defaultOptions,
|
|
10
10
|
deployFixtures,
|
|
11
11
|
freshBoost,
|
|
12
12
|
freshPoints,
|
|
13
|
-
} from
|
|
14
|
-
import { bytes4 } from
|
|
15
|
-
import { PointsIncentive } from
|
|
13
|
+
} from "@boostxyz/test/helpers";
|
|
14
|
+
import { bytes4 } from "../utils";
|
|
15
|
+
import { PointsIncentive } from "./PointsIncentive";
|
|
16
16
|
|
|
17
17
|
let fixtures: Fixtures, points: MockPoints;
|
|
18
18
|
|
|
19
|
-
describe(
|
|
19
|
+
describe("PointsIncentive", () => {
|
|
20
20
|
beforeAll(async () => {
|
|
21
21
|
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
22
22
|
});
|
|
@@ -25,10 +25,10 @@ describe('PointsIncentive', () => {
|
|
|
25
25
|
points = await loadFixture(freshPoints);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
test(
|
|
28
|
+
test("can successfully be deployed", async () => {
|
|
29
29
|
const action = new PointsIncentive(defaultOptions, {
|
|
30
30
|
venue: zeroAddress,
|
|
31
|
-
selector:
|
|
31
|
+
selector: "0xdeadb33f",
|
|
32
32
|
reward: 1n,
|
|
33
33
|
limit: 1n,
|
|
34
34
|
});
|
|
@@ -36,14 +36,14 @@ describe('PointsIncentive', () => {
|
|
|
36
36
|
expect(isAddress(action.assertValidAddress())).toBe(true);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
test(
|
|
39
|
+
test("can claim", async () => {
|
|
40
40
|
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
41
41
|
const referrer = accounts.at(1)!.account!;
|
|
42
42
|
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
43
43
|
const trustedSigner = accounts.at(0)!;
|
|
44
44
|
const pointsIncentive = fixtures.core.PointsIncentive({
|
|
45
45
|
venue: points.assertValidAddress(),
|
|
46
|
-
selector: bytes4(
|
|
46
|
+
selector: bytes4("issue(address,uint256)"),
|
|
47
47
|
reward: 1n,
|
|
48
48
|
limit: 10n,
|
|
49
49
|
});
|
|
@@ -52,7 +52,7 @@ describe('PointsIncentive', () => {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
const claimant = trustedSigner.account;
|
|
55
|
-
const incentiveData = pad(
|
|
55
|
+
const incentiveData = pad("0xdef456232173821931823712381232131391321934");
|
|
56
56
|
const incentiveQuantity = 1;
|
|
57
57
|
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
58
58
|
signer: trustedSigner,
|
|
@@ -73,7 +73,7 @@ describe('PointsIncentive', () => {
|
|
|
73
73
|
0n,
|
|
74
74
|
referrer,
|
|
75
75
|
claimDataPayload,
|
|
76
|
-
{ value: parseEther(
|
|
76
|
+
{ value: parseEther("0.000075") },
|
|
77
77
|
);
|
|
78
78
|
expect(
|
|
79
79
|
await readPointsBalanceOf(defaultOptions.config, {
|
|
@@ -83,7 +83,7 @@ describe('PointsIncentive', () => {
|
|
|
83
83
|
).toBe(1n);
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
test(
|
|
86
|
+
test("cannot claim twice", async () => {
|
|
87
87
|
const reward = 1n;
|
|
88
88
|
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
89
89
|
const referrer = accounts.at(1)!.account!;
|
|
@@ -92,7 +92,7 @@ describe('PointsIncentive', () => {
|
|
|
92
92
|
|
|
93
93
|
const pointsIncentive = fixtures.core.PointsIncentive({
|
|
94
94
|
venue: points.assertValidAddress(),
|
|
95
|
-
selector: bytes4(
|
|
95
|
+
selector: bytes4("issue(address,uint256)"),
|
|
96
96
|
reward,
|
|
97
97
|
limit: 10n,
|
|
98
98
|
});
|
|
@@ -101,7 +101,7 @@ describe('PointsIncentive', () => {
|
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
const claimant = trustedSigner.account;
|
|
104
|
-
const incentiveData = pad(
|
|
104
|
+
const incentiveData = pad("0xdef456232173821931823712381232131391321934");
|
|
105
105
|
const incentiveQuantity = 1;
|
|
106
106
|
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
107
107
|
signer: trustedSigner,
|
|
@@ -122,7 +122,7 @@ describe('PointsIncentive', () => {
|
|
|
122
122
|
0n,
|
|
123
123
|
referrer,
|
|
124
124
|
claimDataPayload,
|
|
125
|
-
{ value: parseEther(
|
|
125
|
+
{ value: parseEther("0.000075") },
|
|
126
126
|
);
|
|
127
127
|
try {
|
|
128
128
|
await fixtures.core.claimIncentive(
|
|
@@ -130,7 +130,7 @@ describe('PointsIncentive', () => {
|
|
|
130
130
|
0n,
|
|
131
131
|
referrer,
|
|
132
132
|
claimDataPayload,
|
|
133
|
-
{ value: parseEther(
|
|
133
|
+
{ value: parseEther("0.000075") },
|
|
134
134
|
);
|
|
135
135
|
} catch (e) {
|
|
136
136
|
expect(e).toBeInstanceOf(Error);
|
|
@@ -125,7 +125,7 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
125
125
|
*
|
|
126
126
|
* @public
|
|
127
127
|
* @async
|
|
128
|
-
* @param {?ReadParams
|
|
128
|
+
* @param {?ReadParams} [params]
|
|
129
129
|
* @returns {Promise<bigint>}
|
|
130
130
|
*/
|
|
131
131
|
public async claims(
|
|
@@ -144,7 +144,7 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
144
144
|
*
|
|
145
145
|
* @public
|
|
146
146
|
* @async
|
|
147
|
-
* @param {?ReadParams
|
|
147
|
+
* @param {?ReadParams} [params]
|
|
148
148
|
* @returns {Promise<bigint>} - The current reward
|
|
149
149
|
*/
|
|
150
150
|
public async currentReward(
|
|
@@ -163,8 +163,8 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
163
163
|
*
|
|
164
164
|
* @public
|
|
165
165
|
* @async
|
|
166
|
-
* @param {?ReadParams
|
|
167
|
-
* @returns {
|
|
166
|
+
* @param {?ReadParams} [params]
|
|
167
|
+
* @returns {Promise<bigint>} The reward amount issued for each claim
|
|
168
168
|
*/
|
|
169
169
|
public async reward(
|
|
170
170
|
params?: ReadParams<typeof pointsIncentiveAbi, 'reward'>,
|
|
@@ -183,8 +183,8 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
183
183
|
* @public
|
|
184
184
|
* @async
|
|
185
185
|
* @param {Address} address
|
|
186
|
-
* @param {?ReadParams
|
|
187
|
-
* @returns {
|
|
186
|
+
* @param {?ReadParams} [params]
|
|
187
|
+
* @returns {Promise<boolean>}
|
|
188
188
|
*/
|
|
189
189
|
public async claimed(
|
|
190
190
|
address: Address,
|
|
@@ -203,8 +203,8 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
203
203
|
*
|
|
204
204
|
* @public
|
|
205
205
|
* @async
|
|
206
|
-
* @param {?ReadParams
|
|
207
|
-
* @returns {
|
|
206
|
+
* @param {?ReadParams} [params]
|
|
207
|
+
* @returns {Promise<Address>}
|
|
208
208
|
*/
|
|
209
209
|
public async venue(params?: ReadParams<typeof pointsIncentiveAbi, 'venue'>) {
|
|
210
210
|
return await readPointsIncentiveVenue(this._config, {
|
|
@@ -219,7 +219,7 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
219
219
|
*
|
|
220
220
|
* @public
|
|
221
221
|
* @async
|
|
222
|
-
* @param {?ReadParams
|
|
222
|
+
* @param {?ReadParams} [params]
|
|
223
223
|
* @returns {Promise<bigint>}
|
|
224
224
|
*/
|
|
225
225
|
public async limit(params?: ReadParams<typeof pointsIncentiveAbi, 'limit'>) {
|
|
@@ -235,7 +235,7 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
235
235
|
*
|
|
236
236
|
* @public
|
|
237
237
|
* @async
|
|
238
|
-
* @param {?ReadParams
|
|
238
|
+
* @param {?ReadParams} [params]
|
|
239
239
|
* @returns {Promise<Hex>}
|
|
240
240
|
*/
|
|
241
241
|
public async selector(
|
|
@@ -254,7 +254,7 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
254
254
|
* @public
|
|
255
255
|
* @async
|
|
256
256
|
* @param {ClaimPayload} payload
|
|
257
|
-
* @param {?WriteParams
|
|
257
|
+
* @param {?WriteParams} [params]
|
|
258
258
|
* @returns {Promise<boolean>} - True if the incentive was successfully claimed
|
|
259
259
|
*/
|
|
260
260
|
protected async claim(
|
|
@@ -270,8 +270,8 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
270
270
|
* @public
|
|
271
271
|
* @async
|
|
272
272
|
* @param {ClaimPayload} payload
|
|
273
|
-
* @param {?WriteParams
|
|
274
|
-
* @returns {Promise<boolean>} - True if the incentive was successfully claimed
|
|
273
|
+
* @param {?WriteParams} [params]
|
|
274
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the incentive was successfully claimed
|
|
275
275
|
*/
|
|
276
276
|
protected async claimRaw(
|
|
277
277
|
payload: ClaimPayload,
|
|
@@ -299,7 +299,7 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
299
299
|
* @public
|
|
300
300
|
* @async
|
|
301
301
|
* @param {ClaimPayload} payload
|
|
302
|
-
* @param {?ReadParams
|
|
302
|
+
* @param {?ReadParams} [params]
|
|
303
303
|
* @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload
|
|
304
304
|
*/
|
|
305
305
|
public async isClaimable(
|
|
@@ -327,8 +327,8 @@ export class SignerValidator extends DeployableTarget<
|
|
|
327
327
|
* @public
|
|
328
328
|
* @async
|
|
329
329
|
* @param {Address} address
|
|
330
|
-
* @param {?ReadParams
|
|
331
|
-
* @returns {
|
|
330
|
+
* @param {?ReadParams} [params]
|
|
331
|
+
* @returns {Promise<boolean>}
|
|
332
332
|
*/
|
|
333
333
|
public async signers(
|
|
334
334
|
address: Address,
|
|
@@ -348,8 +348,8 @@ export class SignerValidator extends DeployableTarget<
|
|
|
348
348
|
* @public
|
|
349
349
|
* @async
|
|
350
350
|
* @param {SignerValidatorSignaturePayload} payload
|
|
351
|
-
* @param {?ReadParams
|
|
352
|
-
* @returns {
|
|
351
|
+
* @param {?ReadParams} [params]
|
|
352
|
+
* @returns {Promise<Hex>}
|
|
353
353
|
*/
|
|
354
354
|
public async hashSignerData(
|
|
355
355
|
payload: SignerValidatorSignaturePayload,
|
|
@@ -374,7 +374,7 @@ export class SignerValidator extends DeployableTarget<
|
|
|
374
374
|
* @public
|
|
375
375
|
* @async
|
|
376
376
|
* @param {SignerValidatorValidatePayload} payload
|
|
377
|
-
* @param {?WriteParams
|
|
377
|
+
* @param {?WriteParams} [params]
|
|
378
378
|
* @returns {Promise<boolean>} - True if the action has been validated based on the data payload
|
|
379
379
|
*/
|
|
380
380
|
protected async validate(
|
|
@@ -390,7 +390,7 @@ export class SignerValidator extends DeployableTarget<
|
|
|
390
390
|
* @public
|
|
391
391
|
* @async
|
|
392
392
|
* @param {SignerValidatorValidatePayload} payload
|
|
393
|
-
* @param {?WriteParams
|
|
393
|
+
* @param {?WriteParams} [params]
|
|
394
394
|
* @returns {Promise<boolean>} - True if the action has been validated based on the data payload
|
|
395
395
|
*/
|
|
396
396
|
protected async validateRaw(
|
|
@@ -423,8 +423,8 @@ export class SignerValidator extends DeployableTarget<
|
|
|
423
423
|
* @async
|
|
424
424
|
* @param {Address[]} addresses - The list of signers to update
|
|
425
425
|
* @param {boolean[]} allowed - The authorized status of each signer
|
|
426
|
-
* @param {?WriteParams
|
|
427
|
-
* @returns {
|
|
426
|
+
* @param {?WriteParams} [params]
|
|
427
|
+
* @returns {Promise<void>}
|
|
428
428
|
*/
|
|
429
429
|
public async setAuthorized(
|
|
430
430
|
addresses: Address[],
|
|
@@ -443,8 +443,8 @@ export class SignerValidator extends DeployableTarget<
|
|
|
443
443
|
* @async
|
|
444
444
|
* @param {Address[]} addresses - The list of signers to update
|
|
445
445
|
* @param {boolean[]} allowed - The authorized status of each signer
|
|
446
|
-
* @param {?WriteParams
|
|
447
|
-
* @returns {
|
|
446
|
+
* @param {?WriteParams} [params]
|
|
447
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
448
448
|
*/
|
|
449
449
|
public async setAuthorizedRaw(
|
|
450
450
|
addresses: Address[],
|
|
@@ -471,8 +471,8 @@ export class SignerValidator extends DeployableTarget<
|
|
|
471
471
|
* @public
|
|
472
472
|
* @async
|
|
473
473
|
* @param {Address} address
|
|
474
|
-
* @param {?WriteParams
|
|
475
|
-
* @returns {
|
|
474
|
+
* @param {?WriteParams} [params]
|
|
475
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
476
476
|
*/
|
|
477
477
|
public async setValidatorCallerRaw(
|
|
478
478
|
address: Address,
|
|
@@ -501,8 +501,8 @@ export class SignerValidator extends DeployableTarget<
|
|
|
501
501
|
* @public
|
|
502
502
|
* @async
|
|
503
503
|
* @param {Address} address
|
|
504
|
-
* @param {?WriteParams
|
|
505
|
-
* @returns {
|
|
504
|
+
* @param {?WriteParams} [params]
|
|
505
|
+
* @returns {Promise<void>}
|
|
506
506
|
*/
|
|
507
507
|
public async setValidatorCaller(
|
|
508
508
|
address: Address,
|
|
@@ -32,7 +32,7 @@ export const ValidatorByComponentInterface = {
|
|
|
32
32
|
* @async
|
|
33
33
|
* @param {DeployableOptions} options
|
|
34
34
|
* @param {Address} address
|
|
35
|
-
* @returns {
|
|
35
|
+
* @returns {Promise<Validator>}
|
|
36
36
|
* @throws {@link InvalidComponentInterfaceError}
|
|
37
37
|
*/
|
|
38
38
|
export async function validatorFromAddress(
|
package/src/claiming.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface ClaimPayload {
|
|
|
40
40
|
* @param {ClaimPayload} param0
|
|
41
41
|
* @param {Address} param0.target - The address of the recipient
|
|
42
42
|
* @param {Hex} [param0.data=zeroHash] - The implementation-specific data for the claim, if needed
|
|
43
|
-
* @returns {
|
|
43
|
+
* @returns {Hex}
|
|
44
44
|
*/
|
|
45
45
|
export const prepareClaimPayload = ({
|
|
46
46
|
target,
|
package/src/errors.ts
CHANGED
|
@@ -421,6 +421,45 @@ export class TooManyEventActionStepsProvidedError extends Error {
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
+
/**
|
|
425
|
+
* The error is thrown when trying to reuse an existing deployed Incentive that isn't a base implementation.
|
|
426
|
+
*
|
|
427
|
+
* @export
|
|
428
|
+
* @class ValidationAbiMissingError
|
|
429
|
+
* @typedef {ValidationAbiMissingError}
|
|
430
|
+
* @extends {Error}
|
|
431
|
+
*/
|
|
432
|
+
export class ValidationAbiMissingError extends Error {
|
|
433
|
+
/**
|
|
434
|
+
* Creates an instance of ValidationAbiMissingError.
|
|
435
|
+
*
|
|
436
|
+
* @constructor
|
|
437
|
+
* @param {Hex} signature
|
|
438
|
+
*/
|
|
439
|
+
constructor(signature: Hex) {
|
|
440
|
+
super(`No known ABI for given signature: ${signature}`);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Thrown when missing logs for validating action steps.
|
|
446
|
+
*
|
|
447
|
+
* @export
|
|
448
|
+
* @class ValidationLogsMissingError
|
|
449
|
+
* @typedef {ValidationLogsMissingError}
|
|
450
|
+
* @extends {Error}
|
|
451
|
+
*/
|
|
452
|
+
export class ValidationLogsMissingError extends Error {
|
|
453
|
+
/**
|
|
454
|
+
* Creates an instance of ValidationLogsMissingError.
|
|
455
|
+
*
|
|
456
|
+
* @constructor
|
|
457
|
+
*/
|
|
458
|
+
constructor() {
|
|
459
|
+
super('Logs are required for validation');
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
424
463
|
/**
|
|
425
464
|
* Function action validation context to help debug other validation errors
|
|
426
465
|
*
|
|
@@ -681,18 +720,144 @@ export class UnrecognizedFilterTypeError extends FieldActionValidationError {
|
|
|
681
720
|
}
|
|
682
721
|
}
|
|
683
722
|
|
|
723
|
+
/**
|
|
724
|
+
* Thrown when no chain ID is provided in the Wagmi configuration.
|
|
725
|
+
*
|
|
726
|
+
* @export
|
|
727
|
+
* @class NoConnectedChainIdError
|
|
728
|
+
* @typedef {NoConnectedChainIdError}
|
|
729
|
+
* @extends {Error}
|
|
730
|
+
*/
|
|
684
731
|
export class NoConnectedChainIdError extends Error {
|
|
732
|
+
/**
|
|
733
|
+
* Creates an instance of NoConnectedChainIdError.
|
|
734
|
+
*
|
|
735
|
+
* @constructor
|
|
736
|
+
*/
|
|
685
737
|
constructor() {
|
|
686
738
|
super(
|
|
687
739
|
'Provided Wagmi configuration does not define `chainId` property with which to target protocol contracts',
|
|
688
740
|
);
|
|
741
|
+
this.name = 'NoConnectedChainIdError';
|
|
689
742
|
}
|
|
690
743
|
}
|
|
691
744
|
|
|
745
|
+
/**
|
|
746
|
+
* Thrown when an invalid chain ID is provided that doesn't match any deployed protocol.
|
|
747
|
+
*
|
|
748
|
+
* @export
|
|
749
|
+
* @class InvalidProtocolChainIdError
|
|
750
|
+
* @typedef {InvalidProtocolChainIdError}
|
|
751
|
+
* @extends {Error}
|
|
752
|
+
*/
|
|
692
753
|
export class InvalidProtocolChainIdError extends Error {
|
|
754
|
+
/**
|
|
755
|
+
* Creates an instance of InvalidProtocolChainIdError.
|
|
756
|
+
*
|
|
757
|
+
* @constructor
|
|
758
|
+
* @param {number} chainId - The chain ID provided in the configuration.
|
|
759
|
+
* @param {number[]} validChainIds - A list of valid chain IDs where the protocol is deployed.
|
|
760
|
+
*/
|
|
693
761
|
constructor(chainId: number, validChainIds: number[]) {
|
|
694
762
|
super(
|
|
695
763
|
`Provided Wagmi configuration supplied a "chainId" where protocol is not deployed, provided: ${chainId}, but valid chains are: ${validChainIds}`,
|
|
696
764
|
);
|
|
765
|
+
this.name = 'InvalidProtocolChainIdError';
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Thrown when the incentive criteria cannot be fetched from the contract.
|
|
771
|
+
*
|
|
772
|
+
* @export
|
|
773
|
+
* @class IncentiveCriteriaNotFoundError
|
|
774
|
+
* @typedef {IncentiveCriteriaNotFoundError}
|
|
775
|
+
* @extends {Error}
|
|
776
|
+
*/
|
|
777
|
+
export class IncentiveCriteriaNotFoundError extends Error {
|
|
778
|
+
/**
|
|
779
|
+
* Creates an instance of IncentiveCriteriaNotFoundError.
|
|
780
|
+
*
|
|
781
|
+
* @constructor
|
|
782
|
+
* @param {Error} [e] - Optional error object for further context.
|
|
783
|
+
* @param {string} [message='Unable to fetch Incentive Criteria from contract'] - Custom error message.
|
|
784
|
+
*/
|
|
785
|
+
constructor(
|
|
786
|
+
e?: Error,
|
|
787
|
+
message = 'Unable to fetch Incentive Criteria from contract',
|
|
788
|
+
) {
|
|
789
|
+
super(message + (e ? `: ${e.message}` : ''));
|
|
790
|
+
this.name = 'IncentiveCriteriaNotFoundError';
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Thrown when no matching logs are found for a given event signature.
|
|
796
|
+
*
|
|
797
|
+
* @export
|
|
798
|
+
* @class NoMatchingLogsError
|
|
799
|
+
* @typedef {NoMatchingLogsError}
|
|
800
|
+
* @extends {Error}
|
|
801
|
+
*/
|
|
802
|
+
export class NoMatchingLogsError extends Error {
|
|
803
|
+
/**
|
|
804
|
+
* Creates an instance of NoMatchingLogsError.
|
|
805
|
+
*
|
|
806
|
+
* @constructor
|
|
807
|
+
* @param {string} signature - The event signature for which logs are being searched.
|
|
808
|
+
* @param {string} [message] - Optional custom error message.
|
|
809
|
+
*/
|
|
810
|
+
constructor(
|
|
811
|
+
signature: string,
|
|
812
|
+
message = `No logs found for event signature ${signature}`,
|
|
813
|
+
) {
|
|
814
|
+
super(message);
|
|
815
|
+
this.name = 'NoMatchingLogsError';
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Thrown when an invalid criteria type is provided.
|
|
821
|
+
*
|
|
822
|
+
* @export
|
|
823
|
+
* @class InvalidCriteriaTypeError
|
|
824
|
+
* @typedef {InvalidCriteriaTypeError}
|
|
825
|
+
* @extends {Error}
|
|
826
|
+
*/
|
|
827
|
+
export class InvalidCriteriaTypeError extends Error {
|
|
828
|
+
/**
|
|
829
|
+
* Creates an instance of InvalidCriteriaTypeError.
|
|
830
|
+
*
|
|
831
|
+
* @constructor
|
|
832
|
+
* @param {string} [criteriaType='unknown'] - The invalid criteria type that was provided.
|
|
833
|
+
* @param {string} [message] - Optional custom error message.
|
|
834
|
+
*/
|
|
835
|
+
constructor(
|
|
836
|
+
criteriaType = 'unknown',
|
|
837
|
+
message = `Invalid criteria type ${criteriaType}`,
|
|
838
|
+
) {
|
|
839
|
+
super(message);
|
|
840
|
+
this.name = 'InvalidCriteriaTypeError';
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Thrown when decoding function arguments fails.
|
|
846
|
+
*
|
|
847
|
+
* @export
|
|
848
|
+
* @class DecodedArgsError
|
|
849
|
+
* @typedef {DecodedArgsError}
|
|
850
|
+
* @extends {Error}
|
|
851
|
+
*/
|
|
852
|
+
export class DecodedArgsError extends Error {
|
|
853
|
+
/**
|
|
854
|
+
* Creates an instance of DecodedArgsError.
|
|
855
|
+
*
|
|
856
|
+
* @constructor
|
|
857
|
+
* @param {string} [message='Issue decoding args'] - Custom error message.
|
|
858
|
+
*/
|
|
859
|
+
constructor(message = 'Issue decoding args') {
|
|
860
|
+
super(message);
|
|
861
|
+
this.name = 'DecodedArgsError';
|
|
697
862
|
}
|
|
698
863
|
}
|