@boostxyz/sdk 2.1.2 → 2.2.1
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.d.ts +2 -1
- package/dist/Actions/Action.d.ts.map +1 -1
- package/dist/Actions/Action.js +14 -13
- package/dist/Actions/Action.js.map +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +219 -0
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +39 -39
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.cjs.map +1 -1
- package/dist/AllowLists/AllowList.d.ts +2 -1
- package/dist/AllowLists/AllowList.d.ts.map +1 -1
- package/dist/AllowLists/AllowList.js +18 -17
- package/dist/AllowLists/AllowList.js.map +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.js +9 -9
- package/dist/AllowLists/SimpleDenyList.cjs +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/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +33 -0
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +98 -81
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.js +12 -12
- package/dist/{Budget-CUIFf1Br.js → Budget-2Zb3Mb-8.js} +40 -39
- package/dist/{Budget-CUIFf1Br.js.map → Budget-2Zb3Mb-8.js.map} +1 -1
- package/dist/{Budget-cI30CIMN.cjs → Budget-2xKEvkbL.cjs} +2 -2
- package/dist/{Budget-cI30CIMN.cjs.map → Budget-2xKEvkbL.cjs.map} +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.d.ts +2 -1
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +3 -3
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.js +33 -33
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.js +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts +158 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +268 -31
- package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -1
- package/dist/Incentive-CfIjdL4T.cjs +2 -0
- package/dist/Incentive-CfIjdL4T.cjs.map +1 -0
- package/dist/Incentive-DNwTyG5Z.js +393 -0
- package/dist/Incentive-DNwTyG5Z.js.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +28 -28
- 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 +30 -0
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +25 -25
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +25 -0
- 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 +30 -0
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +42 -42
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20PeggedIncentive.d.ts +905 -0
- package/dist/Incentives/ERC20PeggedIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +67 -0
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +31 -31
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +20 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +18 -18
- package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.cjs.map +1 -1
- package/dist/Incentives/Incentive.d.ts +26 -4
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +20 -40
- 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 +25 -0
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +29 -29
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-Ds0CQ4uR.cjs → SimpleDenyList-BQ0GqQfC.cjs} +2 -2
- package/dist/{SimpleDenyList-Ds0CQ4uR.cjs.map → SimpleDenyList-BQ0GqQfC.cjs.map} +1 -1
- package/dist/{SimpleDenyList-CXruWOyu.js → SimpleDenyList-D49GF3NX.js} +11 -11
- package/dist/{SimpleDenyList-CXruWOyu.js.map → SimpleDenyList-D49GF3NX.js.map} +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.d.ts +10 -0
- package/dist/Validators/LimitedSignerValidator.d.ts.map +1 -1
- package/dist/Validators/LimitedSignerValidator.js +15 -15
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +10 -0
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +8 -8
- 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 +2 -1
- package/dist/Validators/Validator.d.ts.map +1 -1
- package/dist/Validators/Validator.js +20 -19
- package/dist/Validators/Validator.js.map +1 -1
- package/dist/{componentInterfaces-dakxtQHf.js → componentInterfaces-C4uAYjSo.js} +12 -12
- package/dist/componentInterfaces-C4uAYjSo.js.map +1 -0
- package/dist/deployments.json +3 -0
- package/dist/{generated-BTslM7bf.js → generated-B5pVBNb-.js} +1835 -730
- package/dist/generated-B5pVBNb-.js.map +1 -0
- package/dist/generated-D50hBWtr.cjs +3 -0
- package/dist/generated-D50hBWtr.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +113 -110
- package/package.json +2 -2
- package/src/Actions/Action.ts +3 -0
- package/src/Actions/EventAction.test.ts +49 -2
- package/src/Actions/EventAction.ts +12 -4
- package/src/AllowLists/AllowList.ts +3 -0
- package/src/BoostCore.ts +27 -5
- package/src/Budgets/Budget.ts +3 -0
- package/src/Deployable/DeployableTargetWithRBAC.test.ts +175 -0
- package/src/Deployable/DeployableTargetWithRBAC.ts +281 -0
- package/src/Incentives/AllowListIncentive.test.ts +48 -0
- package/src/Incentives/AllowListIncentive.ts +1 -1
- package/src/Incentives/CGDAIncentive.test.ts +50 -0
- package/src/Incentives/CGDAIncentive.ts +1 -1
- package/src/Incentives/ERC1155Incentive.ts +1 -1
- package/src/Incentives/ERC20Incentive.test.ts +49 -0
- package/src/Incentives/ERC20Incentive.ts +1 -1
- package/src/Incentives/ERC20PeggedIncentive.ts +507 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +48 -0
- package/src/Incentives/ERC20VariableIncentive.ts +1 -1
- package/src/Incentives/Incentive.ts +9 -1
- package/src/Incentives/PointsIncentive.test.ts +51 -0
- package/src/Incentives/PointsIncentive.ts +1 -1
- package/src/Validators/Validator.ts +3 -0
- package/src/index.ts +1 -0
- package/dist/componentInterfaces-dakxtQHf.js.map +0 -1
- package/dist/generated-BTslM7bf.js.map +0 -1
- package/dist/generated-DhXxTQ20.cjs +0 -3
- package/dist/generated-DhXxTQ20.cjs.map +0 -1
|
@@ -32,6 +32,7 @@ describe("PointsIncentive", () => {
|
|
|
32
32
|
reward: 1n,
|
|
33
33
|
limit: 1n,
|
|
34
34
|
});
|
|
35
|
+
// @ts-expect-error
|
|
35
36
|
await action.deploy();
|
|
36
37
|
expect(isAddress(action.assertValidAddress())).toBe(true);
|
|
37
38
|
});
|
|
@@ -177,4 +178,54 @@ describe("PointsIncentive", () => {
|
|
|
177
178
|
expect(e).toBeInstanceOf(Error);
|
|
178
179
|
}
|
|
179
180
|
});
|
|
181
|
+
|
|
182
|
+
test("isClaimable returns expected values", async () => {
|
|
183
|
+
const referrer = accounts[1].account;
|
|
184
|
+
const trustedSigner = accounts[0];
|
|
185
|
+
const pointsIncentive = fixtures.core.PointsIncentive({
|
|
186
|
+
venue: points.assertValidAddress(),
|
|
187
|
+
selector: bytes4("issue(address,uint256)"),
|
|
188
|
+
reward: 1n,
|
|
189
|
+
limit: 1n,
|
|
190
|
+
});
|
|
191
|
+
const boost = await freshBoost(fixtures, {
|
|
192
|
+
incentives: [pointsIncentive],
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
const claimant = trustedSigner.account;
|
|
196
|
+
const incentiveData = pointsIncentive.buildClaimData();
|
|
197
|
+
|
|
198
|
+
// Should be claimable before claiming
|
|
199
|
+
expect(await boost.incentives[0]!.isClaimable({
|
|
200
|
+
target: claimant,
|
|
201
|
+
data: incentiveData
|
|
202
|
+
})).toBe(true);
|
|
203
|
+
|
|
204
|
+
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
205
|
+
signer: trustedSigner,
|
|
206
|
+
incentiveData,
|
|
207
|
+
chainId: defaultOptions.config.chains[0].id,
|
|
208
|
+
incentiveQuantity: boost.incentives.length,
|
|
209
|
+
claimant,
|
|
210
|
+
boostId: boost.id,
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
await writePointsGrantRoles(defaultOptions.config, {
|
|
214
|
+
address: points.assertValidAddress(),
|
|
215
|
+
args: [pointsIncentive.assertValidAddress(), 2n],
|
|
216
|
+
account: defaultOptions.account,
|
|
217
|
+
});
|
|
218
|
+
await fixtures.core.claimIncentive(
|
|
219
|
+
boost.id,
|
|
220
|
+
0n,
|
|
221
|
+
referrer,
|
|
222
|
+
claimDataPayload,
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
// Should not be claimable after claiming
|
|
226
|
+
expect(await boost.incentives[0]!.isClaimable({
|
|
227
|
+
target: claimant,
|
|
228
|
+
data: incentiveData
|
|
229
|
+
})).toBe(false);
|
|
230
|
+
});
|
|
180
231
|
});
|
|
@@ -290,7 +290,7 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
290
290
|
public async isClaimable(payload: ClaimPayload, params?: ReadParams) {
|
|
291
291
|
return await readPointsIncentiveIsClaimable(this._config, {
|
|
292
292
|
address: this.assertValidAddress(),
|
|
293
|
-
args: [
|
|
293
|
+
args: [payload.target, payload.data],
|
|
294
294
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
295
295
|
...(params as any),
|
|
296
296
|
});
|
|
@@ -8,6 +8,7 @@ import { readContract } from '@wagmi/core';
|
|
|
8
8
|
import { type Address, type Hex, decodeAbiParameters } from 'viem';
|
|
9
9
|
import type { DeployableOptions } from '../Deployable/Deployable';
|
|
10
10
|
import { InvalidComponentInterfaceError } from '../errors';
|
|
11
|
+
import type { ReadParams } from '../utils';
|
|
11
12
|
import { LimitedSignerValidator } from './LimitedSignerValidator';
|
|
12
13
|
import { SignerValidator } from './SignerValidator';
|
|
13
14
|
|
|
@@ -45,11 +46,13 @@ export const ValidatorByComponentInterface = {
|
|
|
45
46
|
export async function validatorFromAddress(
|
|
46
47
|
options: DeployableOptions,
|
|
47
48
|
address: Address,
|
|
49
|
+
params?: ReadParams,
|
|
48
50
|
) {
|
|
49
51
|
const interfaceId = (await readContract(options.config, {
|
|
50
52
|
abi: aValidatorAbi,
|
|
51
53
|
functionName: 'getComponentInterface',
|
|
52
54
|
address,
|
|
55
|
+
...params,
|
|
53
56
|
})) as keyof typeof ValidatorByComponentInterface;
|
|
54
57
|
const Ctor = ValidatorByComponentInterface[interfaceId];
|
|
55
58
|
if (!Ctor) {
|
package/src/index.ts
CHANGED
|
@@ -35,6 +35,7 @@ export * from './Deployable/DeployableTargetWithRBAC';
|
|
|
35
35
|
export * from './Incentives/AllowListIncentive';
|
|
36
36
|
export * from './Incentives/CGDAIncentive';
|
|
37
37
|
export * from './Incentives/ERC20Incentive';
|
|
38
|
+
export * from './Incentives/ERC20PeggedIncentive';
|
|
38
39
|
export * from './Incentives/ERC20VariableIncentive';
|
|
39
40
|
export * from './Incentives/ERC20VariableCriteriaIncentive';
|
|
40
41
|
// export * from './Incentives/ERC1155Incentive';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"componentInterfaces-dakxtQHf.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|