@boostxyz/sdk 0.0.0-alpha.12 → 0.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.js +1 -1
- package/dist/Actions/ContractAction.d.ts +2 -2
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +2 -2
- package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +2 -2
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +47 -43
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +2 -2
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +2 -2
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +23 -19
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +2 -2
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +6 -5
- package/dist/AllowLists/SimpleDenyList.js.map +1 -1
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +27 -5
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +438 -347
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.d.ts +26 -5
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +125 -64
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +1 -1
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts +2 -2
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +41 -37
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/SimpleBudget.d.ts +2 -2
- package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +2 -2
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts +6 -6
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +22 -17
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +2 -2
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +17 -13
- package/dist/Incentives/AllowListIncentive.js.map +1 -1
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
- package/dist/Incentives/CGDAIncentive.d.ts +14 -2
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +27 -23
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +2 -2
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +2 -2
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +17 -13
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +2 -2
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.cjs.map +1 -1
- package/dist/Incentives/Incentive.js +32 -28
- package/dist/Incentives/Incentive.js.map +1 -1
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +2 -2
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +13 -9
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-IJ9Ipya7.js → SimpleDenyList-C21O9Yfi.js} +23 -19
- package/dist/SimpleDenyList-C21O9Yfi.js.map +1 -0
- package/dist/SimpleDenyList-DeJRKD2D.cjs +2 -0
- package/dist/{SimpleDenyList-IJ9Ipya7.js.map → SimpleDenyList-DeJRKD2D.cjs.map} +1 -1
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +2 -2
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +18 -14
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +1 -1
- package/dist/deployments-BvFcK_eR.js +40 -0
- package/dist/deployments-BvFcK_eR.js.map +1 -0
- package/dist/deployments-Ho4PnGCS.cjs +2 -0
- package/dist/deployments-Ho4PnGCS.cjs.map +1 -0
- package/dist/deployments.json +38 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +70 -54
- package/dist/errors.js.map +1 -1
- package/dist/{generated-HGddZXHJ.js → generated-LpgSHrH0.js} +130 -90
- package/dist/generated-LpgSHrH0.js.map +1 -0
- package/dist/generated-tq_HLZJ0.cjs +3 -0
- package/dist/generated-tq_HLZJ0.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +113 -109
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +25 -11
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -23
- package/dist/utils.js.map +1 -1
- package/package.json +6 -5
- package/src/Actions/ContractAction.ts +5 -3
- package/src/Actions/ERC721MintAction.ts +5 -3
- package/src/Actions/EventAction.ts +6 -2
- package/src/AllowLists/AllowList.test.ts +1 -1
- package/src/AllowLists/SimpleAllowList.ts +6 -3
- package/src/AllowLists/SimpleDenyList.ts +6 -3
- package/src/BoostCore.test.ts +31 -91
- package/src/BoostCore.ts +137 -34
- package/src/BoostRegistry.ts +89 -21
- package/src/Budgets/ManagedBudget.ts +6 -4
- package/src/Budgets/SimpleBudget.ts +4 -3
- package/src/Budgets/VestingBudget.ts +4 -3
- package/src/Deployable/DeployableTarget.ts +22 -11
- package/src/Incentives/AllowListIncentive.ts +6 -3
- package/src/Incentives/CGDAIncentive.ts +6 -3
- package/src/Incentives/ERC1155Incentive.ts +4 -3
- package/src/Incentives/ERC20Incentive.ts +6 -3
- package/src/Incentives/ERC20VariableIncentive.ts +6 -3
- package/src/Incentives/PointsIncentive.ts +6 -3
- package/src/Validators/SignerValidator.ts +6 -3
- package/src/errors.ts +17 -1
- package/src/utils.ts +60 -11
- package/dist/SimpleDenyList-CqT0BMP7.cjs +0 -2
- package/dist/SimpleDenyList-CqT0BMP7.cjs.map +0 -1
- package/dist/generated-HGddZXHJ.js.map +0 -1
- package/dist/generated-wKBNvm48.cjs +0 -3
- package/dist/generated-wKBNvm48.cjs.map +0 -1
package/src/BoostCore.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
zeroAddress,
|
|
32
32
|
zeroHash,
|
|
33
33
|
} from 'viem';
|
|
34
|
+
import { BoostCore as BoostCoreBases } from '../dist/deployments.json';
|
|
34
35
|
import { type Action, actionFromAddress } from './Actions/Action';
|
|
35
36
|
import { EventAction, type EventActionPayload } from './Actions/EventAction';
|
|
36
37
|
import { type AllowList, allowListFromAddress } from './AllowLists/AllowList';
|
|
@@ -95,7 +96,12 @@ import {
|
|
|
95
96
|
IncentiveNotCloneableError,
|
|
96
97
|
MustInitializeBudgetError,
|
|
97
98
|
} from './errors';
|
|
98
|
-
import
|
|
99
|
+
import {
|
|
100
|
+
type GenericLog,
|
|
101
|
+
type ReadParams,
|
|
102
|
+
type WriteParams,
|
|
103
|
+
assertValidAddressByChainId,
|
|
104
|
+
} from './utils';
|
|
99
105
|
|
|
100
106
|
export { boostCoreAbi };
|
|
101
107
|
|
|
@@ -107,13 +113,24 @@ export { boostCoreAbi };
|
|
|
107
113
|
export const BOOST_CORE_CLAIM_FEE = parseEther('0.000075');
|
|
108
114
|
|
|
109
115
|
/**
|
|
110
|
-
* The
|
|
111
|
-
* By default, `new BoostCore` will use this address if not otherwise provided.
|
|
116
|
+
* The address of the deployed BoostCore instance. In prerelease mode, this will be its sepolia address
|
|
112
117
|
*
|
|
113
118
|
* @type {Address}
|
|
114
119
|
*/
|
|
115
|
-
export const BOOST_CORE_ADDRESS
|
|
116
|
-
|
|
120
|
+
export const BOOST_CORE_ADDRESS = (BoostCoreBases as Record<string, Address>)[
|
|
121
|
+
__DEFAULT_CHAIN_ID__
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The fixed addresses for the deployed Boost Core.
|
|
126
|
+
* By default, `new BoostCore` will use the address deployed to the currently connected chain, or `BOOST_CORE_ADDRESS` if not provided.
|
|
127
|
+
*
|
|
128
|
+
* @type {Record<number, Address>}
|
|
129
|
+
*/
|
|
130
|
+
export const BOOST_CORE_ADDRESSES: Record<number, Address> = {
|
|
131
|
+
...(BoostCoreBases as Record<number, Address>),
|
|
132
|
+
31337: import.meta.env.VITE_BOOST_CORE_ADDRESS,
|
|
133
|
+
};
|
|
117
134
|
|
|
118
135
|
/**
|
|
119
136
|
* A generic `viem.Log` event with support for `BoostCore` event types.
|
|
@@ -232,6 +249,26 @@ export class BoostCore extends Deployable<
|
|
|
232
249
|
[Address, Address],
|
|
233
250
|
typeof boostCoreAbi
|
|
234
251
|
> {
|
|
252
|
+
/**
|
|
253
|
+
* A static property representing a map of stringified chain ID's to the address of the deployed implementation on chain
|
|
254
|
+
*
|
|
255
|
+
* @static
|
|
256
|
+
* @readonly
|
|
257
|
+
* @type {Record<string, Address>}
|
|
258
|
+
*/
|
|
259
|
+
static readonly addresses: Record<number, Address> = BOOST_CORE_ADDRESSES;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* A getter that will return Boost core's static addresses by numerical chain ID
|
|
263
|
+
*
|
|
264
|
+
* @public
|
|
265
|
+
* @readonly
|
|
266
|
+
* @type {Record<number, Address>}
|
|
267
|
+
*/
|
|
268
|
+
public get addresses(): Record<number, Address> {
|
|
269
|
+
return (this.constructor as typeof BoostCore).addresses;
|
|
270
|
+
}
|
|
271
|
+
|
|
235
272
|
/**
|
|
236
273
|
* Creates an instance of BoostCore.
|
|
237
274
|
*
|
|
@@ -250,7 +287,11 @@ export class BoostCore extends Deployable<
|
|
|
250
287
|
options.protocolFeeReceiver,
|
|
251
288
|
]);
|
|
252
289
|
} else {
|
|
253
|
-
|
|
290
|
+
const { address } = assertValidAddressByChainId(
|
|
291
|
+
config,
|
|
292
|
+
BOOST_CORE_ADDRESSES,
|
|
293
|
+
);
|
|
294
|
+
super({ account, config }, address);
|
|
254
295
|
}
|
|
255
296
|
//@ts-expect-error I can't set this property on the class because for some reason it takes super out of constructor scope?
|
|
256
297
|
this.abi = boostCoreAbi;
|
|
@@ -266,14 +307,17 @@ export class BoostCore extends Deployable<
|
|
|
266
307
|
*/
|
|
267
308
|
public async createBoost(
|
|
268
309
|
_boostPayload: CreateBoostPayload,
|
|
269
|
-
|
|
310
|
+
_params?: DeployableOptions &
|
|
311
|
+
WriteParams<typeof boostCoreAbi, 'createBoost'>,
|
|
270
312
|
) {
|
|
271
|
-
const coreAddress = this.assertValidAddress();
|
|
272
313
|
const [payload, options] =
|
|
273
|
-
this.validateDeploymentConfig<CreateBoostPayload>(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
314
|
+
this.validateDeploymentConfig<CreateBoostPayload>(_boostPayload, _params);
|
|
315
|
+
const desiredChainId = _params?.chain?.id || _params?.chainId;
|
|
316
|
+
const { chainId, address: coreAddress } = assertValidAddressByChainId(
|
|
317
|
+
options.config,
|
|
318
|
+
this.addresses,
|
|
319
|
+
desiredChainId,
|
|
320
|
+
);
|
|
277
321
|
|
|
278
322
|
let {
|
|
279
323
|
budget,
|
|
@@ -290,7 +334,7 @@ export class BoostCore extends Deployable<
|
|
|
290
334
|
const boostFactory = createWriteContract({
|
|
291
335
|
abi: boostCoreAbi,
|
|
292
336
|
functionName: 'createBoost',
|
|
293
|
-
address:
|
|
337
|
+
address: coreAddress,
|
|
294
338
|
});
|
|
295
339
|
|
|
296
340
|
if (!owner) {
|
|
@@ -321,7 +365,7 @@ export class BoostCore extends Deployable<
|
|
|
321
365
|
parameters: zeroHash,
|
|
322
366
|
};
|
|
323
367
|
if (action.address) {
|
|
324
|
-
const isBase = action.
|
|
368
|
+
const isBase = action.isBase;
|
|
325
369
|
actionPayload = {
|
|
326
370
|
isBase: isBase,
|
|
327
371
|
instance: action.address,
|
|
@@ -332,7 +376,11 @@ export class BoostCore extends Deployable<
|
|
|
332
376
|
} else {
|
|
333
377
|
actionPayload.parameters =
|
|
334
378
|
action.buildParameters(undefined, options).args.at(0) || zeroHash;
|
|
335
|
-
actionPayload.instance =
|
|
379
|
+
actionPayload.instance = assertValidAddressByChainId(
|
|
380
|
+
options.config,
|
|
381
|
+
action.bases,
|
|
382
|
+
chainId,
|
|
383
|
+
).address;
|
|
336
384
|
}
|
|
337
385
|
|
|
338
386
|
let validatorPayload: BoostPayload['validator'] = {
|
|
@@ -341,7 +389,7 @@ export class BoostCore extends Deployable<
|
|
|
341
389
|
parameters: zeroHash,
|
|
342
390
|
};
|
|
343
391
|
if (validator.address) {
|
|
344
|
-
const isBase = validator.
|
|
392
|
+
const isBase = validator.isBase;
|
|
345
393
|
validatorPayload = {
|
|
346
394
|
isBase: isBase,
|
|
347
395
|
instance: validator.address,
|
|
@@ -368,7 +416,11 @@ export class BoostCore extends Deployable<
|
|
|
368
416
|
options,
|
|
369
417
|
)
|
|
370
418
|
.args.at(0) || zeroHash;
|
|
371
|
-
validatorPayload.instance =
|
|
419
|
+
validatorPayload.instance = assertValidAddressByChainId(
|
|
420
|
+
options.config,
|
|
421
|
+
validator.bases,
|
|
422
|
+
chainId,
|
|
423
|
+
).address;
|
|
372
424
|
}
|
|
373
425
|
|
|
374
426
|
let allowListPayload: BoostPayload['allowList'] = {
|
|
@@ -377,7 +429,7 @@ export class BoostCore extends Deployable<
|
|
|
377
429
|
parameters: zeroHash,
|
|
378
430
|
};
|
|
379
431
|
if (allowList.address) {
|
|
380
|
-
const isBase = allowList.
|
|
432
|
+
const isBase = allowList.isBase;
|
|
381
433
|
allowListPayload = {
|
|
382
434
|
isBase: isBase,
|
|
383
435
|
instance: allowList.address,
|
|
@@ -388,10 +440,14 @@ export class BoostCore extends Deployable<
|
|
|
388
440
|
} else {
|
|
389
441
|
allowListPayload.parameters =
|
|
390
442
|
allowList.buildParameters(undefined, options).args.at(0) || zeroHash;
|
|
391
|
-
allowListPayload.instance =
|
|
443
|
+
allowListPayload.instance = assertValidAddressByChainId(
|
|
444
|
+
options.config,
|
|
445
|
+
allowList.bases,
|
|
446
|
+
chainId,
|
|
447
|
+
).address;
|
|
392
448
|
}
|
|
393
449
|
|
|
394
|
-
|
|
450
|
+
const incentivesPayloads: Array<Target> = incentives.map(() => ({
|
|
395
451
|
instance: zeroAddress,
|
|
396
452
|
isBase: true,
|
|
397
453
|
parameters: zeroHash,
|
|
@@ -400,7 +456,7 @@ export class BoostCore extends Deployable<
|
|
|
400
456
|
// biome-ignore lint/style/noNonNullAssertion: this will never be undefined
|
|
401
457
|
const incentive = incentives.at(i)!;
|
|
402
458
|
if (incentive.address) {
|
|
403
|
-
const isBase = incentive.
|
|
459
|
+
const isBase = incentive.isBase;
|
|
404
460
|
if (!isBase) throw new IncentiveNotCloneableError(incentive);
|
|
405
461
|
incentivesPayloads[i] = {
|
|
406
462
|
isBase: isBase,
|
|
@@ -415,7 +471,11 @@ export class BoostCore extends Deployable<
|
|
|
415
471
|
incentivesPayloads[i]!.parameters =
|
|
416
472
|
incentive.buildParameters(undefined, options).args.at(0) || zeroHash;
|
|
417
473
|
// biome-ignore lint/style/noNonNullAssertion: this will never be undefined
|
|
418
|
-
incentivesPayloads[i]!.instance =
|
|
474
|
+
incentivesPayloads[i]!.instance = assertValidAddressByChainId(
|
|
475
|
+
options.config,
|
|
476
|
+
incentive.bases,
|
|
477
|
+
chainId,
|
|
478
|
+
).address;
|
|
419
479
|
}
|
|
420
480
|
}
|
|
421
481
|
|
|
@@ -432,8 +492,11 @@ export class BoostCore extends Deployable<
|
|
|
432
492
|
};
|
|
433
493
|
|
|
434
494
|
const boostHash = await boostFactory(options.config, {
|
|
435
|
-
args: [prepareBoostPayload(onChainPayload)],
|
|
436
495
|
...this.optionallyAttachAccount(options.account),
|
|
496
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
497
|
+
...(_params as any),
|
|
498
|
+
chainId,
|
|
499
|
+
args: [prepareBoostPayload(onChainPayload)],
|
|
437
500
|
});
|
|
438
501
|
const receipt = await waitForTransactionReceipt(options.config, {
|
|
439
502
|
hash: boostHash,
|
|
@@ -510,7 +573,11 @@ export class BoostCore extends Deployable<
|
|
|
510
573
|
const { request, result } = await simulateBoostCoreClaimIncentive(
|
|
511
574
|
this._config,
|
|
512
575
|
{
|
|
513
|
-
|
|
576
|
+
...assertValidAddressByChainId(
|
|
577
|
+
this._config,
|
|
578
|
+
this.addresses,
|
|
579
|
+
params?.chain?.id || params?.chainId,
|
|
580
|
+
),
|
|
514
581
|
args: [boostId, incentiveId, referrer, data],
|
|
515
582
|
...this.optionallyAttachAccount(),
|
|
516
583
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -578,7 +645,11 @@ export class BoostCore extends Deployable<
|
|
|
578
645
|
const { request, result } = await simulateBoostCoreClaimIncentiveFor(
|
|
579
646
|
this._config,
|
|
580
647
|
{
|
|
581
|
-
|
|
648
|
+
...assertValidAddressByChainId(
|
|
649
|
+
this._config,
|
|
650
|
+
this.addresses,
|
|
651
|
+
params?.chain?.id || params?.chainId,
|
|
652
|
+
),
|
|
582
653
|
args: [boostId, incentiveId, referrer, data, claimant],
|
|
583
654
|
...this.optionallyAttachAccount(),
|
|
584
655
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -677,7 +748,11 @@ export class BoostCore extends Deployable<
|
|
|
677
748
|
params?: ReadParams<typeof boostCoreAbi, 'getBoostCount'>,
|
|
678
749
|
) {
|
|
679
750
|
return await readBoostCoreGetBoostCount(this._config, {
|
|
680
|
-
|
|
751
|
+
...assertValidAddressByChainId(
|
|
752
|
+
this._config,
|
|
753
|
+
this.addresses,
|
|
754
|
+
params?.chainId,
|
|
755
|
+
),
|
|
681
756
|
args: [],
|
|
682
757
|
...this.optionallyAttachAccount(),
|
|
683
758
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -700,7 +775,7 @@ export class BoostCore extends Deployable<
|
|
|
700
775
|
params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'> &
|
|
701
776
|
ReadParams<typeof iAuthAbi, 'isAuthorized'>,
|
|
702
777
|
) {
|
|
703
|
-
const auth = await this.createBoostAuth();
|
|
778
|
+
const auth = await this.createBoostAuth(params);
|
|
704
779
|
return readIAuthIsAuthorized(this._config, {
|
|
705
780
|
address: auth,
|
|
706
781
|
args: [address],
|
|
@@ -722,7 +797,11 @@ export class BoostCore extends Deployable<
|
|
|
722
797
|
params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'>,
|
|
723
798
|
) {
|
|
724
799
|
return await readBoostCoreCreateBoostAuth(this._config, {
|
|
725
|
-
|
|
800
|
+
...assertValidAddressByChainId(
|
|
801
|
+
this._config,
|
|
802
|
+
this.addresses,
|
|
803
|
+
params?.chainId,
|
|
804
|
+
),
|
|
726
805
|
args: [],
|
|
727
806
|
...this.optionallyAttachAccount(),
|
|
728
807
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -766,7 +845,11 @@ export class BoostCore extends Deployable<
|
|
|
766
845
|
const { request, result } = await simulateBoostCoreSetCreateBoostAuth(
|
|
767
846
|
this._config,
|
|
768
847
|
{
|
|
769
|
-
|
|
848
|
+
...assertValidAddressByChainId(
|
|
849
|
+
this._config,
|
|
850
|
+
this.addresses,
|
|
851
|
+
params?.chainId,
|
|
852
|
+
),
|
|
770
853
|
args: [address],
|
|
771
854
|
...this.optionallyAttachAccount(),
|
|
772
855
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -789,7 +872,11 @@ export class BoostCore extends Deployable<
|
|
|
789
872
|
params?: ReadParams<typeof boostCoreAbi, 'protocolFee'>,
|
|
790
873
|
) {
|
|
791
874
|
return await readBoostCoreProtocolFee(this._config, {
|
|
792
|
-
|
|
875
|
+
...assertValidAddressByChainId(
|
|
876
|
+
this._config,
|
|
877
|
+
this.addresses,
|
|
878
|
+
params?.chainId,
|
|
879
|
+
),
|
|
793
880
|
args: [],
|
|
794
881
|
...this.optionallyAttachAccount(),
|
|
795
882
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -809,7 +896,11 @@ export class BoostCore extends Deployable<
|
|
|
809
896
|
params?: ReadParams<typeof boostCoreAbi, 'protocolFeeReceiver'>,
|
|
810
897
|
) {
|
|
811
898
|
return await readBoostCoreProtocolFeeReceiver(this._config, {
|
|
812
|
-
|
|
899
|
+
...assertValidAddressByChainId(
|
|
900
|
+
this._config,
|
|
901
|
+
this.addresses,
|
|
902
|
+
params?.chainId,
|
|
903
|
+
),
|
|
813
904
|
args: [],
|
|
814
905
|
...this.optionallyAttachAccount(),
|
|
815
906
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -853,7 +944,11 @@ export class BoostCore extends Deployable<
|
|
|
853
944
|
const { request, result } = await simulateBoostCoreSetProtocolFeeReceiver(
|
|
854
945
|
this._config,
|
|
855
946
|
{
|
|
856
|
-
|
|
947
|
+
...assertValidAddressByChainId(
|
|
948
|
+
this._config,
|
|
949
|
+
this.addresses,
|
|
950
|
+
params?.chainId,
|
|
951
|
+
),
|
|
857
952
|
args: [address],
|
|
858
953
|
...this.optionallyAttachAccount(),
|
|
859
954
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -877,7 +972,11 @@ export class BoostCore extends Deployable<
|
|
|
877
972
|
*/
|
|
878
973
|
public async claimFee(params?: ReadParams<typeof boostCoreAbi, 'claimFee'>) {
|
|
879
974
|
return await readBoostCoreClaimFee(this._config, {
|
|
880
|
-
|
|
975
|
+
...assertValidAddressByChainId(
|
|
976
|
+
this._config,
|
|
977
|
+
this.addresses,
|
|
978
|
+
params?.chainId,
|
|
979
|
+
),
|
|
881
980
|
args: [],
|
|
882
981
|
...this.optionallyAttachAccount(),
|
|
883
982
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -917,7 +1016,11 @@ export class BoostCore extends Deployable<
|
|
|
917
1016
|
const { request, result } = await simulateBoostCoreSetClaimFee(
|
|
918
1017
|
this._config,
|
|
919
1018
|
{
|
|
920
|
-
|
|
1019
|
+
...assertValidAddressByChainId(
|
|
1020
|
+
this._config,
|
|
1021
|
+
this.addresses,
|
|
1022
|
+
params?.chainId,
|
|
1023
|
+
),
|
|
921
1024
|
args: [claimFee],
|
|
922
1025
|
...this.optionallyAttachAccount(),
|
|
923
1026
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
package/src/BoostRegistry.ts
CHANGED
|
@@ -15,30 +15,41 @@ import {
|
|
|
15
15
|
type Hex,
|
|
16
16
|
isAddress,
|
|
17
17
|
} from 'viem';
|
|
18
|
+
import { BoostRegistry as BoostRegistryBases } from '../dist/deployments.json';
|
|
18
19
|
import {
|
|
19
20
|
Deployable,
|
|
20
21
|
type DeployableOptions,
|
|
21
22
|
type GenericDeployableParams,
|
|
22
23
|
} from './Deployable/Deployable';
|
|
23
24
|
import type { DeployableTarget } from './Deployable/DeployableTarget';
|
|
24
|
-
import
|
|
25
|
-
GenericLog,
|
|
26
|
-
HashAndSimulatedResult,
|
|
27
|
-
ReadParams,
|
|
28
|
-
RegistryType,
|
|
29
|
-
WriteParams,
|
|
25
|
+
import {
|
|
26
|
+
type GenericLog,
|
|
27
|
+
type HashAndSimulatedResult,
|
|
28
|
+
type ReadParams,
|
|
29
|
+
type RegistryType,
|
|
30
|
+
type WriteParams,
|
|
31
|
+
assertValidAddressByChainId,
|
|
30
32
|
} from './utils';
|
|
31
33
|
|
|
32
|
-
export { boostRegistryAbi };
|
|
33
|
-
|
|
34
34
|
/**
|
|
35
|
-
* The
|
|
36
|
-
* By default, `new BoostRegistry` will use this address if not otherwise provided.
|
|
35
|
+
* The address of the deployed `BoostRegistry` instance. In prerelease mode, this will be its sepolia address
|
|
37
36
|
*
|
|
38
37
|
* @type {Address}
|
|
39
38
|
*/
|
|
40
|
-
export const BOOST_REGISTRY_ADDRESS
|
|
41
|
-
|
|
39
|
+
export const BOOST_REGISTRY_ADDRESS = (
|
|
40
|
+
BoostRegistryBases as Record<string, Address>
|
|
41
|
+
)[__DEFAULT_CHAIN_ID__];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The fixed addresses for the deployed Boost Registry.
|
|
45
|
+
* By default, `new BoostRegistry` will use the address deployed to the currently connected chain, or `BOOST_REGISTRY_ADDRESS` if not provided.
|
|
46
|
+
*
|
|
47
|
+
* @type {Record<number, Address>}
|
|
48
|
+
*/
|
|
49
|
+
export const BOOST_REGISTRY_ADDRESSES: Record<number, Address> = {
|
|
50
|
+
...(BoostRegistryBases as Record<number, Address>),
|
|
51
|
+
31337: import.meta.env.VITE_BOOST_REGISTRY_ADDRESS,
|
|
52
|
+
};
|
|
42
53
|
|
|
43
54
|
/**
|
|
44
55
|
* A record of `BoostRegistry` event names to `AbiEvent` objects for use with `getLogs`
|
|
@@ -151,6 +162,26 @@ export class BoostRegistry extends Deployable<
|
|
|
151
162
|
never[],
|
|
152
163
|
typeof boostRegistryAbi
|
|
153
164
|
> {
|
|
165
|
+
/**
|
|
166
|
+
* A static property representing a map of stringified chain ID's to the address of the deployed implementation on chain
|
|
167
|
+
*
|
|
168
|
+
* @static
|
|
169
|
+
* @readonly
|
|
170
|
+
* @type {Record<string, Address>}
|
|
171
|
+
*/
|
|
172
|
+
static readonly addresses: Record<number, Address> = BOOST_REGISTRY_ADDRESSES;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* A getter that will return Boost registry's static addresses by numerical chain ID
|
|
176
|
+
*
|
|
177
|
+
* @public
|
|
178
|
+
* @readonly
|
|
179
|
+
* @type {Record<number, Address>}
|
|
180
|
+
*/
|
|
181
|
+
public get addresses(): Record<number, Address> {
|
|
182
|
+
return (this.constructor as typeof BoostRegistry).addresses;
|
|
183
|
+
}
|
|
184
|
+
|
|
154
185
|
/**
|
|
155
186
|
* Creates an instance of BoostRegistry.
|
|
156
187
|
*
|
|
@@ -167,7 +198,11 @@ export class BoostRegistry extends Deployable<
|
|
|
167
198
|
} else if (isBoostRegistryDeployable(options)) {
|
|
168
199
|
super({ account, config }, []);
|
|
169
200
|
} else {
|
|
170
|
-
|
|
201
|
+
const { address } = assertValidAddressByChainId(
|
|
202
|
+
config,
|
|
203
|
+
BOOST_REGISTRY_ADDRESSES,
|
|
204
|
+
);
|
|
205
|
+
super({ account, config }, address);
|
|
171
206
|
}
|
|
172
207
|
}
|
|
173
208
|
|
|
@@ -216,7 +251,11 @@ export class BoostRegistry extends Deployable<
|
|
|
216
251
|
const { request, result } = await simulateBoostRegistryRegister(
|
|
217
252
|
this._config,
|
|
218
253
|
{
|
|
219
|
-
|
|
254
|
+
...assertValidAddressByChainId(
|
|
255
|
+
this._config,
|
|
256
|
+
this.addresses,
|
|
257
|
+
params?.chain?.id || params?.chainId,
|
|
258
|
+
),
|
|
220
259
|
args: [registryType, name, implementation],
|
|
221
260
|
...this.optionallyAttachAccount(),
|
|
222
261
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -310,11 +349,20 @@ export class BoostRegistry extends Deployable<
|
|
|
310
349
|
config: this._config,
|
|
311
350
|
account: this._account,
|
|
312
351
|
});
|
|
352
|
+
const { address: baseAddress } = assertValidAddressByChainId(
|
|
353
|
+
this._config,
|
|
354
|
+
target.bases,
|
|
355
|
+
params?.chain?.id || params?.chainId,
|
|
356
|
+
);
|
|
313
357
|
const { request, result } = await simulateBoostRegistryDeployClone(
|
|
314
358
|
this._config,
|
|
315
359
|
{
|
|
316
|
-
|
|
317
|
-
|
|
360
|
+
...assertValidAddressByChainId(
|
|
361
|
+
this._config,
|
|
362
|
+
this.addresses,
|
|
363
|
+
params?.chain?.id || params?.chainId,
|
|
364
|
+
),
|
|
365
|
+
args: [target.registryType, baseAddress, displayName, payload.args[0]],
|
|
318
366
|
...this.optionallyAttachAccount(),
|
|
319
367
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
320
368
|
...(params as any),
|
|
@@ -339,7 +387,11 @@ export class BoostRegistry extends Deployable<
|
|
|
339
387
|
params?: ReadParams<typeof boostRegistryAbi, 'getBaseImplementation'>,
|
|
340
388
|
) {
|
|
341
389
|
return await readBoostRegistryGetBaseImplementation(this._config, {
|
|
342
|
-
|
|
390
|
+
...assertValidAddressByChainId(
|
|
391
|
+
this._config,
|
|
392
|
+
this.addresses,
|
|
393
|
+
params?.chainId,
|
|
394
|
+
),
|
|
343
395
|
args: [identifier],
|
|
344
396
|
...this.optionallyAttachAccount(),
|
|
345
397
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -361,7 +413,11 @@ export class BoostRegistry extends Deployable<
|
|
|
361
413
|
params?: ReadParams<typeof boostRegistryAbi, 'getClone'>,
|
|
362
414
|
) {
|
|
363
415
|
return await readBoostRegistryGetBaseImplementation(this._config, {
|
|
364
|
-
|
|
416
|
+
...assertValidAddressByChainId(
|
|
417
|
+
this._config,
|
|
418
|
+
this.addresses,
|
|
419
|
+
params?.chainId,
|
|
420
|
+
),
|
|
365
421
|
args: [identifier],
|
|
366
422
|
...this.optionallyAttachAccount(),
|
|
367
423
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -383,7 +439,11 @@ export class BoostRegistry extends Deployable<
|
|
|
383
439
|
params?: ReadParams<typeof boostRegistryAbi, 'getClones'>,
|
|
384
440
|
) {
|
|
385
441
|
return await readBoostRegistryGetClones(this._config, {
|
|
386
|
-
|
|
442
|
+
...assertValidAddressByChainId(
|
|
443
|
+
this._config,
|
|
444
|
+
this.addresses,
|
|
445
|
+
params?.chainId,
|
|
446
|
+
),
|
|
387
447
|
args: [deployer],
|
|
388
448
|
...this.optionallyAttachAccount(),
|
|
389
449
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -411,7 +471,11 @@ export class BoostRegistry extends Deployable<
|
|
|
411
471
|
params?: ReadParams<typeof boostRegistryAbi, 'getCloneIdentifier'>,
|
|
412
472
|
) {
|
|
413
473
|
return await readBoostRegistryGetCloneIdentifier(this._config, {
|
|
414
|
-
|
|
474
|
+
...assertValidAddressByChainId(
|
|
475
|
+
this._config,
|
|
476
|
+
this.addresses,
|
|
477
|
+
params?.chainId,
|
|
478
|
+
),
|
|
415
479
|
args: [registryType, base, deployer, displayName],
|
|
416
480
|
...this.optionallyAttachAccount(),
|
|
417
481
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -435,7 +499,11 @@ export class BoostRegistry extends Deployable<
|
|
|
435
499
|
params?: ReadParams<typeof boostRegistryAbi, 'getIdentifier'>,
|
|
436
500
|
) {
|
|
437
501
|
return await readBoostRegistryGetCloneIdentifier(this._config, {
|
|
438
|
-
|
|
502
|
+
...assertValidAddressByChainId(
|
|
503
|
+
this._config,
|
|
504
|
+
this.addresses,
|
|
505
|
+
params?.chainId,
|
|
506
|
+
),
|
|
439
507
|
args: [registryType, displayName],
|
|
440
508
|
...this.optionallyAttachAccount(),
|
|
441
509
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
parseAbiParameters,
|
|
34
34
|
zeroAddress,
|
|
35
35
|
} from 'viem';
|
|
36
|
+
import { ManagedBudget as ManagedBudgetBases } from '../../dist/deployments.json';
|
|
36
37
|
import type {
|
|
37
38
|
DeployableOptions,
|
|
38
39
|
GenericDeployableParams,
|
|
@@ -54,7 +55,6 @@ import {
|
|
|
54
55
|
RegistryType,
|
|
55
56
|
type WriteParams,
|
|
56
57
|
} from '../utils';
|
|
57
|
-
|
|
58
58
|
export { managedBudgetAbi };
|
|
59
59
|
export type { ERC1155TransferPayload, FungibleTransferPayload };
|
|
60
60
|
|
|
@@ -189,10 +189,12 @@ export class ManagedBudget extends DeployableTarget<
|
|
|
189
189
|
*
|
|
190
190
|
* @public
|
|
191
191
|
* @static
|
|
192
|
-
* @type {Address}
|
|
192
|
+
* @type {Record<number, Address>}
|
|
193
193
|
*/
|
|
194
|
-
public static override
|
|
195
|
-
|
|
194
|
+
public static override bases: Record<number, Address> = {
|
|
195
|
+
...(ManagedBudgetBases as Record<number, Address>),
|
|
196
|
+
31337: import.meta.env.VITE_MANAGED_BUDGET_BASE,
|
|
197
|
+
};
|
|
196
198
|
/**
|
|
197
199
|
* @inheritdoc
|
|
198
200
|
*
|
|
@@ -151,10 +151,11 @@ export class SimpleBudget extends DeployableTarget<
|
|
|
151
151
|
*
|
|
152
152
|
* @public
|
|
153
153
|
* @static
|
|
154
|
-
* @type {Address}
|
|
154
|
+
* @type {Record<number, Address>}
|
|
155
155
|
*/
|
|
156
|
-
public static override
|
|
157
|
-
.VITE_SIMPLE_BUDGET_BASE
|
|
156
|
+
public static override bases: Record<number, Address> = {
|
|
157
|
+
31337: import.meta.env.VITE_SIMPLE_BUDGET_BASE,
|
|
158
|
+
};
|
|
158
159
|
/**
|
|
159
160
|
* @inheritdoc
|
|
160
161
|
*
|
|
@@ -127,10 +127,11 @@ export class VestingBudget extends DeployableTarget<
|
|
|
127
127
|
*
|
|
128
128
|
* @public
|
|
129
129
|
* @static
|
|
130
|
-
* @type {Address}
|
|
130
|
+
* @type {Record<number, Address>}
|
|
131
131
|
*/
|
|
132
|
-
public static override
|
|
133
|
-
.VITE_VESTING_BUDGET_BASE
|
|
132
|
+
public static override bases: Record<number, Address> = {
|
|
133
|
+
31337: import.meta.env.VITE_VESTING_BUDGET_BASE,
|
|
134
|
+
};
|
|
134
135
|
/**
|
|
135
136
|
* @inheritdoc
|
|
136
137
|
*
|