@boostxyz/sdk 0.0.0-alpha.16 → 0.0.0-alpha.18
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 +7 -7
- 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 -779
- 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.js +3 -3
- package/dist/AllowLists/OpenAllowList.d.ts +183 -0
- package/dist/AllowLists/OpenAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +82 -36
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +44 -80
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +192 -9
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +5 -5
- 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-C00iqvks.js +1477 -0
- package/dist/BoostCore-C00iqvks.js.map +1 -0
- package/dist/BoostCore.cjs +1 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +80 -35
- 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 +18 -18
- package/dist/BoostRegistry.js +36 -36
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.cjs.map +1 -1
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +2 -2
- package/dist/Budgets/Budget.js.map +1 -1
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts +24 -174
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +76 -298
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +181 -77
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- 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 +10 -10
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- 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-BO5WI_5s.js +1355 -0
- package/dist/EventAction-BO5WI_5s.js.map +1 -0
- package/dist/EventAction-DBDRaG4A.cjs +2 -0
- package/dist/EventAction-DBDRaG4A.cjs.map +1 -0
- package/dist/{Incentive-CtuAJAjG.js → Incentive-CF7kaz_9.js} +67 -68
- package/dist/Incentive-CF7kaz_9.js.map +1 -0
- package/dist/{Incentive-CqX3fYEd.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 +26 -26
- 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 +25 -25
- 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 +45 -45
- 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 +20 -20
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/SimpleDenyList-BwfNjRsg.cjs +2 -0
- package/dist/SimpleDenyList-BwfNjRsg.cjs.map +1 -0
- package/dist/SimpleDenyList-D9i4rw_F.js +132 -0
- package/dist/SimpleDenyList-D9i4rw_F.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 +25 -25
- 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-DLMdMwD1.js → generated-B8VWObPa.js} +2350 -1290
- package/dist/generated-B8VWObPa.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +134 -122
- package/dist/index.js.map +1 -1
- 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 +12 -5
- package/src/Actions/ContractAction.ts +9 -10
- package/src/Actions/ERC721MintAction.ts +12 -13
- package/src/Actions/EventAction.test.ts +182 -53
- package/src/Actions/EventAction.ts +128 -107
- package/src/AllowLists/SimpleAllowList.ts +14 -59
- package/src/AllowLists/SimpleDenyList.ts +12 -9
- package/src/Boost.ts +19 -0
- package/src/BoostCore.test.ts +117 -1
- package/src/BoostCore.ts +113 -54
- package/src/BoostRegistry.ts +18 -18
- package/src/Budgets/Budget.ts +1 -2
- package/src/Budgets/ManagedBudget.ts +21 -295
- package/src/Budgets/VestingBudget.ts +26 -97
- 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 +323 -0
- 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 +3 -4
- package/src/index.ts +2 -0
- package/src/transfers.ts +1 -1
- package/src/utils.ts +1 -1
- package/dist/Budgets/SimpleBudget.d.ts +0 -824
- package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
- package/dist/Incentive-CqX3fYEd.cjs.map +0 -1
- package/dist/Incentive-CtuAJAjG.js.map +0 -1
- package/dist/SimpleDenyList-9UIxZZKP.cjs +0 -2
- package/dist/SimpleDenyList-9UIxZZKP.cjs.map +0 -1
- package/dist/SimpleDenyList-DGPNc7ov.js +0 -132
- package/dist/SimpleDenyList-DGPNc7ov.js.map +0 -1
- package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
- package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
- package/dist/componentInterfaces-Cmg8tUxq.js +0 -13
- package/dist/componentInterfaces-Cmg8tUxq.js.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-BLg7yPgI.cjs +0 -3
- package/dist/generated-BLg7yPgI.cjs.map +0 -1
- package/dist/generated-DLMdMwD1.js.map +0 -1
- package/src/Budgets/SimpleBudget.test.ts +0 -152
- package/src/Budgets/SimpleBudget.ts +0 -563
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleDenyList-BwfNjRsg.cjs","sources":["../src/AllowLists/SimpleDenyList.ts"],"sourcesContent":["import {\n readSimpleAllowListOwner,\n readSimpleDenyListIsAllowed,\n simpleDenyListAbi,\n simulateSimpleDenyListSetDenied,\n writeSimpleDenyListSetDenied,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/allowlists/SimpleDenyList.sol/SimpleDenyList.json';\nimport { getAccount } from '@wagmi/core';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { SimpleDenyList as SimpleDenyListBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTargetWithRBAC } from '../Deployable/DeployableTargetWithRBAC';\nimport { DeployableUnknownOwnerProvidedError } from '../errors';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { simpleDenyListAbi };\n\n/**\n * Object representation of a {@link SimpleDenyList} initialization payload.\n *\n * @export\n * @interface SimpleDenyListPayload\n * @typedef {SimpleDenyListPayload}\n */\nexport interface SimpleDenyListPayload {\n /**\n * The allow list's owner\n *\n * @type {Address}\n */\n owner: Address;\n /**\n * List of denied addresses.\n *\n * @type {Address[]}\n */\n denied: Address[];\n}\n\n/**\n * A generic `viem.Log` event with support for `SimpleDenyList` event types.\n *\n * @export\n * @typedef {SimpleDenyListLog}\n * @template {ContractEventName<typeof simpleDenyListAbi>} [event=ContractEventName<\n * typeof simpleDenyListAbi\n * >]\n */\nexport type SimpleDenyListLog<\n event extends ContractEventName<typeof simpleDenyListAbi> = ContractEventName<\n typeof simpleDenyListAbi\n >,\n> = GenericLog<typeof simpleDenyListAbi, event>;\n\n/**\n * A simple implementation of an AllowList that implicitly allows all addresses except those explicitly added to the deny list\n *\n * @export\n * @class SimpleDenyList\n * @typedef {SimpleDenyList}\n * @extends {DeployableTargetWithRBAC<SimpleDenyListPayload>}\n */\nexport class SimpleDenyList<\n Payload = SimpleDenyListPayload,\n> extends DeployableTargetWithRBAC<\n Payload | undefined,\n typeof simpleDenyListAbi\n> {\n public override readonly abi = simpleDenyListAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n ...(SimpleDenyListBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.ALLOW_LIST;\n\n /**\n * Retrieves the owner\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>} - The address of the owner\n */\n public async owner(\n params?: ReadParams<typeof simpleDenyListAbi, 'owner'>,\n ): Promise<Address> {\n return await readSimpleAllowListOwner(this._config, {\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n address: this.assertValidAddress(),\n args: [],\n });\n }\n\n /**\n * Check if a user is authorized (i.e. not denied)\n *\n * @public\n * @async\n * @param {Address} address - The address of the user\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the user is authorized\n */\n public async isAllowed(\n address: Address,\n params?: ReadParams<typeof simpleDenyListAbi, 'isAllowed'>,\n ): Promise<boolean> {\n return await readSimpleDenyListIsAllowed(this._config, {\n address: this.assertValidAddress(),\n args: [address, zeroHash],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Set the denied status of a user. The length of the `users_` and `denied_` arrays must be the same. This function can only be called by the owner\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of users to update\n * @param {boolean[]} allowed - The denied status of each user\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setDenied(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof simpleDenyListAbi, 'setDenied'>,\n ) {\n return await this.awaitResult(\n this.setDeniedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the denied status of a user. The length of the `users_` and `denied_` arrays must be the same. This function can only be called by the owner\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of users to update\n * @param {boolean[]} allowed - The denied status of each user\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async setDeniedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof simpleDenyListAbi, 'setDenied'>,\n ) {\n const { request, result } = await simulateSimpleDenyListSetDenied(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSimpleDenyListSetDenied(this._config, request);\n return { hash, result };\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?SimpleDenyListPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [p, options] = this.validateDeploymentConfig(_payload, _options);\n const payload = p as SimpleDenyListPayload;\n if (!payload.owner || payload.owner === zeroAddress) {\n const owner = options.account\n ? options.account.address\n : options.config\n ? getAccount(options.config).address\n : this._account?.address;\n if (owner) {\n payload.owner = owner;\n } else {\n throw new DeployableUnknownOwnerProvidedError();\n }\n }\n return {\n abi: simpleDenyListAbi,\n bytecode: bytecode as Hex,\n args: [prepareSimpleDenyListPayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Given a {@link SimpleDenyListPayload}, properly encode the initialization payload.\n *\n * @param {SimpleDenyListPayload} param0\n * @param {Address} param0.owner - The allow list's owner\n * @param {Address[]} param0.denied - List of denied addresses.\n * @returns {Hex}\n */\nexport function prepareSimpleDenyListPayload({\n owner,\n denied,\n}: SimpleDenyListPayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'owner' },\n { type: 'address[]', name: 'denied' },\n ],\n [owner, denied],\n );\n}\n"],"names":["_SimpleDenyList","DeployableTargetWithRBAC","simpleDenyListAbi","params","readSimpleAllowListOwner","address","readSimpleDenyListIsAllowed","zeroHash","addresses","allowed","request","result","simulateSimpleDenyListSetDenied","writeSimpleDenyListSetDenied","_payload","_options","p","options","payload","zeroAddress","owner","getAccount","_a","DeployableUnknownOwnerProvidedError","bytecode","prepareSimpleDenyListPayload","SimpleDenyListBases","RegistryType","SimpleDenyList","denied","encodeAbiParameters"],"mappings":"qnaA8EaA,EAAN,MAAMA,UAEHC,EAAAA,wBAGR,CALK,aAAA,CAAA,MAAA,GAAA,SAAA,EAML,KAAyB,IAAMC,GAAA,CA4B/B,MAAa,MACXC,EACkB,CACX,OAAA,MAAMC,EAAAA,GAAyB,KAAK,QAAS,CAClD,GAAG,KAAK,wBAAwB,EAEhC,GAAID,EACJ,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,CAAA,CACR,CACH,CAWA,MAAa,UACXE,EACAF,EACkB,CACX,OAAA,MAAMG,EAAAA,GAA4B,KAAK,QAAS,CACrD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACD,EAASE,UAAQ,EACxB,GAAG,KAAK,wBAAwB,EAEhC,GAAIJ,CAAA,CACL,CACH,CAYA,MAAa,UACXK,EACAC,EACAN,EACA,CACA,OAAO,MAAM,KAAK,YAChB,KAAK,aAAaK,EAAWC,EAASN,CAAM,CAAA,CAEhD,CAYA,MAAa,aACXK,EACAC,EACAN,EACA,CACA,KAAM,CAAE,QAAAO,EAAS,OAAAC,CAAO,EAAI,MAAMC,EAAA,GAChC,KAAK,QACL,CACE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACJ,EAAWC,CAAO,EACzB,GAAG,KAAK,wBAAwB,EAEhC,GAAIN,CACN,CAAA,EAGK,MAAA,CAAE,KADI,MAAMU,EAA6B,GAAA,KAAK,QAASH,CAAO,EACtD,OAAAC,EACjB,CAUgB,gBACdG,EACAC,EACyB,OACzB,KAAM,CAACC,EAAGC,CAAO,EAAI,KAAK,yBAAyBH,EAAUC,CAAQ,EAC/DG,EAAUF,EAChB,GAAI,CAACE,EAAQ,OAASA,EAAQ,QAAUC,EAAAA,YAAa,CACnD,MAAMC,EAAQH,EAAQ,QAClBA,EAAQ,QAAQ,QAChBA,EAAQ,OACNI,EAAA,WAAWJ,EAAQ,MAAM,EAAE,SAC3BK,EAAA,KAAK,WAAL,YAAAA,EAAe,QACrB,GAAIF,EACFF,EAAQ,MAAQE,MAEhB,OAAM,IAAIG,EAAoC,mCAElD,CACO,MAAA,CACL,IAAKrB,EAAA,EACL,SAAAsB,EACA,KAAM,CAACC,EAA6BP,CAAO,CAAC,EAC5C,GAAG,KAAK,wBAAwBD,EAAQ,OAAO,CAAA,CAEnD,CACF,EAxIEjB,EAAuB,MAAiC,CACtD,GAAI0B,EAAA,cAAA,EASN1B,EAAuB,aAA6B2B,EAAa,aAAA,WAxB5D,IAAMC,EAAN5B,EAgKA,SAASyB,EAA6B,CAC3C,MAAAL,EACA,OAAAS,CACF,EAA0B,CACjB,OAAAC,EAAA,oBACL,CACE,CAAE,KAAM,UAAW,KAAM,OAAQ,EACjC,CAAE,KAAM,YAAa,KAAM,QAAS,CACtC,EACA,CAACV,EAAOS,CAAM,CAAA,CAElB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { I as r, a4 as n, a8 as h, a9 as l, aa as p } from "./generated-B8VWObPa.js";
|
|
2
|
+
import { getAccount as u } from "@wagmi/core";
|
|
3
|
+
import { zeroHash as m, zeroAddress as w, encodeAbiParameters as y } from "viem";
|
|
4
|
+
import { a as A } from "./deployments-BM42vImE.js";
|
|
5
|
+
import { DeployableTargetWithRBAC as g } from "./Deployable/DeployableTargetWithRBAC.js";
|
|
6
|
+
import { DeployableUnknownOwnerProvidedError as D } from "./errors.js";
|
|
7
|
+
import { RegistryType as R } from "./utils.js";
|
|
8
|
+
const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b6118ff806100bd5f395ff3fe60806040526004361061014a575f3560e01c806354d1f13d116100b5578063e66708291161006e578063e66708291461040a578063ec87621c14610432578063f04e283e1461045c578063f2fde38b14610478578063fe9fbb8014610494578063fee81cf4146104d05761014a565b806354d1f13d1461033e578063715018a61461034857806375b238fc1461035257806380fd60051461037c5780638da5cb5b146103a4578063e3f756de146103ce5761014a565b806328d6183b1161010757806328d6183b146102305780632de948071461025a5780634359d28a14610296578063439fab91146102be5780634a4ee7b1146102e6578063514e62fc146103025761014a565b806301ffc9a71461014e578063141973b01461018a578063183a4f6e146101b25780631c10893f146101ce5780631cd64df4146101ea5780632569296214610226575b5f80fd5b348015610159575f80fd5b50610174600480360381019061016f919061116f565b61050c565b60405161018191906111b4565b60405180910390f35b348015610195575f80fd5b506101b060048036038101906101ab9190611283565b610585565b005b6101cc60048036038101906101c79190611334565b6106c5565b005b6101e860048036038101906101e391906113b9565b6106d2565b005b3480156101f5575f80fd5b50610210600480360381019061020b91906113b9565b6106e8565b60405161021d91906111b4565b60405180910390f35b61022e6106fe565b005b34801561023b575f80fd5b5061024461074f565b6040516102519190611406565b60405180910390f35b348015610265575f80fd5b50610280600480360381019061027b919061141f565b610776565b60405161028d9190611459565b60405180910390f35b3480156102a1575f80fd5b506102bc60048036038101906102b79190611283565b61078f565b005b3480156102c9575f80fd5b506102e460048036038101906102df91906114c7565b61089d565b005b61030060048036038101906102fb91906113b9565b6109ba565b005b34801561030d575f80fd5b50610328600480360381019061032391906113b9565b6109d0565b60405161033591906111b4565b60405180910390f35b6103466109e7565b005b610350610a20565b005b34801561035d575f80fd5b50610366610a33565b6040516103739190611459565b60405180910390f35b348015610387575f80fd5b506103a2600480360381019061039d9190611567565b610a38565b005b3480156103af575f80fd5b506103b8610aee565b6040516103c591906115f4565b60405180910390f35b3480156103d9575f80fd5b506103f460048036038101906103ef919061160d565b610b16565b60405161040191906111b4565b60405180910390f35b348015610415575f80fd5b50610430600480360381019061042b9190611567565b610b6a565b005b34801561043d575f80fd5b50610446610c20565b6040516104539190611459565b60405180910390f35b6104766004803603810190610471919061141f565b610c25565b005b610492600480360381019061048d919061141f565b610c63565b005b34801561049f575f80fd5b506104ba60048036038101906104b5919061141f565b610c8c565b6040516104c791906111b4565b60405180910390f35b3480156104db575f80fd5b506104f660048036038101906104f1919061141f565b610cdf565b6040516105039190611459565b60405180910390f35b5f7f3d30a22c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061057e575061057d82610cf8565b5b9050919050565b61058e33610c8c565b6105c4576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818190508484905014610603576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848490508110156106be578282828181106106235761062261166a565b5b905060200201602081019061063891906116c1565b5f8087878581811061064d5761064c61166a565b5b9050602002016020810190610662919061141f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610605565b5050505050565b6106cf3382610d71565b50565b6106da610d80565b6106e48282610db7565b5050565b5f81826106f485610776565b1614905092915050565b5f610707610dc7565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f3d30a22c00000000000000000000000000000000000000000000000000000000905090565b5f638b78c6d8600c52815f526020600c20549050919050565b600261079a81610dd1565b8282905085859050146107d9576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015610895575f8484838181106107fa576107f961166a565b5b905060200201602081019061080f91906116c1565b905060011515811515036108545761084f8787848181106108335761083261166a565b5b9050602002016020810190610848919061141f565b6001610db7565b610887565b61088687878481811061086a5761086961166a565b5b905060200201602081019061087f919061141f565b6001610d71565b5b5080806001019150506107db565b505050505050565b5f6108a6610e06565b905080546003825580156108d85760018160011c14303b106108cf5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f8084848101906108ea919061186f565b915091506108f782610e2f565b5f5b815181101561097d5760015f808484815181106109195761091861166a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555080806001019150506108f9565b50505080156109b5576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b6109c2610d80565b6109cc8282610d71565b5050565b5f80826109dc85610776565b161415905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610a28610d80565b610a315f610f05565b565b600281565b6002610a4381610dd1565b828290508585905014610a82576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015610ae657610ad9868683818110610aa557610aa461166a565b5b9050602002016020810190610aba919061141f565b858584818110610acd57610acc61166a565b5b90506020020135610d71565b8080600101915050610a84565b505050505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff161590509392505050565b6002610b7581610dd1565b828290508585905014610bb4576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015610c1857610c0b868683818110610bd757610bd661166a565b5b9050602002016020810190610bec919061141f565b858584818110610bff57610bfe61166a565b5b90506020020135610db7565b8080600101915050610bb6565b505050505050565b600181565b610c2d610d80565b63389a75e1600c52805f526020600c208054421115610c5357636f5e88185f526004601cfd5b5f815550610c6081610f05565b50565b610c6b610d80565b8060601b610c8057637448fbae5f526004601cfd5b610c8981610f05565b50565b5f8173ffffffffffffffffffffffffffffffffffffffff16610cac610aee565b73ffffffffffffffffffffffffffffffffffffffff161480610cd85750610cd78260026001176109d0565b5b9050919050565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fe2089f79000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610d6a5750610d6982610fcb565b5b9050919050565b610d7c82825f611044565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610db5576382b429005f526004601cfd5b565b610dc382826001611044565b5050565b5f6202a300905090565b638b78c6d819543314610e0357638b78c6d8600c52335f52806020600c205416610e02576382b429005f526004601cfd5b5b50565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610e3761109c565b15610eaf577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610e7157630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610f02565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b610f0d61109c565b15610f72577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610fc8565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061103d575061103c826110a0565b5b9050919050565b638b78c6d8600c52825f526020600c2080548381178361106657848216821890505b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61114e8161111a565b8114611158575f80fd5b50565b5f8135905061116981611145565b92915050565b5f6020828403121561118457611183611112565b5b5f6111918482850161115b565b91505092915050565b5f8115159050919050565b6111ae8161119a565b82525050565b5f6020820190506111c75f8301846111a5565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126111ee576111ed6111cd565b5b8235905067ffffffffffffffff81111561120b5761120a6111d1565b5b602083019150836020820283011115611227576112266111d5565b5b9250929050565b5f8083601f840112611243576112426111cd565b5b8235905067ffffffffffffffff8111156112605761125f6111d1565b5b60208301915083602082028301111561127c5761127b6111d5565b5b9250929050565b5f805f806040858703121561129b5761129a611112565b5b5f85013567ffffffffffffffff8111156112b8576112b7611116565b5b6112c4878288016111d9565b9450945050602085013567ffffffffffffffff8111156112e7576112e6611116565b5b6112f38782880161122e565b925092505092959194509250565b5f819050919050565b61131381611301565b811461131d575f80fd5b50565b5f8135905061132e8161130a565b92915050565b5f6020828403121561134957611348611112565b5b5f61135684828501611320565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6113888261135f565b9050919050565b6113988161137e565b81146113a2575f80fd5b50565b5f813590506113b38161138f565b92915050565b5f80604083850312156113cf576113ce611112565b5b5f6113dc858286016113a5565b92505060206113ed85828601611320565b9150509250929050565b6114008161111a565b82525050565b5f6020820190506114195f8301846113f7565b92915050565b5f6020828403121561143457611433611112565b5b5f611441848285016113a5565b91505092915050565b61145381611301565b82525050565b5f60208201905061146c5f83018461144a565b92915050565b5f8083601f840112611487576114866111cd565b5b8235905067ffffffffffffffff8111156114a4576114a36111d1565b5b6020830191508360018202830111156114c0576114bf6111d5565b5b9250929050565b5f80602083850312156114dd576114dc611112565b5b5f83013567ffffffffffffffff8111156114fa576114f9611116565b5b61150685828601611472565b92509250509250929050565b5f8083601f840112611527576115266111cd565b5b8235905067ffffffffffffffff811115611544576115436111d1565b5b6020830191508360208202830111156115605761155f6111d5565b5b9250929050565b5f805f806040858703121561157f5761157e611112565b5b5f85013567ffffffffffffffff81111561159c5761159b611116565b5b6115a8878288016111d9565b9450945050602085013567ffffffffffffffff8111156115cb576115ca611116565b5b6115d787828801611512565b925092505092959194509250565b6115ee8161137e565b82525050565b5f6020820190506116075f8301846115e5565b92915050565b5f805f6040848603121561162457611623611112565b5b5f611631868287016113a5565b935050602084013567ffffffffffffffff81111561165257611651611116565b5b61165e86828701611472565b92509250509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b6116a08161119a565b81146116aa575f80fd5b50565b5f813590506116bb81611697565b92915050565b5f602082840312156116d6576116d5611112565b5b5f6116e3848285016116ad565b91505092915050565b5f6116f68261135f565b9050919050565b611706816116ec565b8114611710575f80fd5b50565b5f81359050611721816116fd565b92915050565b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61176d82611727565b810181811067ffffffffffffffff8211171561178c5761178b611737565b5b80604052505050565b5f61179e611109565b90506117aa8282611764565b919050565b5f67ffffffffffffffff8211156117c9576117c8611737565b5b602082029050602081019050919050565b5f6117ec6117e7846117af565b611795565b9050808382526020820190506020840283018581111561180f5761180e6111d5565b5b835b81811015611838578061182488826113a5565b845260208401935050602081019050611811565b5050509392505050565b5f82601f830112611856576118556111cd565b5b81356118668482602086016117da565b91505092915050565b5f806040838503121561188557611884611112565b5b5f61189285828601611713565b925050602083013567ffffffffffffffff8111156118b3576118b2611116565b5b6118bf85828601611842565b915050925092905056fea2646970667358221220fd609c06ff9cd293684eb4eec8e0aa68d6f6029c7edd4b9b212b807f76fa1d1464736f6c634300081a0033", c = class c extends g {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.abi = r;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves the owner
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
* @async
|
|
17
|
+
* @param {?ReadParams} [params]
|
|
18
|
+
* @returns {Promise<Address>} - The address of the owner
|
|
19
|
+
*/
|
|
20
|
+
async owner(f) {
|
|
21
|
+
return await n(this._config, {
|
|
22
|
+
...this.optionallyAttachAccount(),
|
|
23
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
24
|
+
...f,
|
|
25
|
+
address: this.assertValidAddress(),
|
|
26
|
+
args: []
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check if a user is authorized (i.e. not denied)
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
* @async
|
|
34
|
+
* @param {Address} address - The address of the user
|
|
35
|
+
* @param {?ReadParams} [params]
|
|
36
|
+
* @returns {Promise<boolean>} - True if the user is authorized
|
|
37
|
+
*/
|
|
38
|
+
async isAllowed(f, b) {
|
|
39
|
+
return await h(this._config, {
|
|
40
|
+
address: this.assertValidAddress(),
|
|
41
|
+
args: [f, m],
|
|
42
|
+
...this.optionallyAttachAccount(),
|
|
43
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
44
|
+
...b
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Set the denied status of a user. The length of the `users_` and `denied_` arrays must be the same. This function can only be called by the owner
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
* @async
|
|
52
|
+
* @param {Address[]} addresses - The list of users to update
|
|
53
|
+
* @param {boolean[]} allowed - The denied status of each user
|
|
54
|
+
* @param {?WriteParams} [params]
|
|
55
|
+
* @returns {Promise<void>}
|
|
56
|
+
*/
|
|
57
|
+
async setDenied(f, b, e) {
|
|
58
|
+
return await this.awaitResult(
|
|
59
|
+
this.setDeniedRaw(f, b, e)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Set the denied status of a user. The length of the `users_` and `denied_` arrays must be the same. This function can only be called by the owner
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
* @async
|
|
67
|
+
* @param {Address[]} addresses - The list of users to update
|
|
68
|
+
* @param {boolean[]} allowed - The denied status of each user
|
|
69
|
+
* @param {?WriteParams} [params]
|
|
70
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
71
|
+
*/
|
|
72
|
+
async setDeniedRaw(f, b, e) {
|
|
73
|
+
const { request: a, result: d } = await l(
|
|
74
|
+
this._config,
|
|
75
|
+
{
|
|
76
|
+
address: this.assertValidAddress(),
|
|
77
|
+
args: [f, b],
|
|
78
|
+
...this.optionallyAttachAccount(),
|
|
79
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
80
|
+
...e
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
return { hash: await p(this._config, a), result: d };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @inheritdoc
|
|
87
|
+
*
|
|
88
|
+
* @public
|
|
89
|
+
* @param {?SimpleDenyListPayload} [_payload]
|
|
90
|
+
* @param {?DeployableOptions} [_options]
|
|
91
|
+
* @returns {GenericDeployableParams}
|
|
92
|
+
*/
|
|
93
|
+
buildParameters(f, b) {
|
|
94
|
+
var t;
|
|
95
|
+
const [e, a] = this.validateDeploymentConfig(f, b), d = e;
|
|
96
|
+
if (!d.owner || d.owner === w) {
|
|
97
|
+
const s = a.account ? a.account.address : a.config ? u(a.config).address : (t = this._account) == null ? void 0 : t.address;
|
|
98
|
+
if (s)
|
|
99
|
+
d.owner = s;
|
|
100
|
+
else
|
|
101
|
+
throw new D();
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
abi: r,
|
|
105
|
+
bytecode: P,
|
|
106
|
+
args: [T(d)],
|
|
107
|
+
...this.optionallyAttachAccount(a.account)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
c.bases = {
|
|
112
|
+
...A
|
|
113
|
+
}, c.registryType = R.ALLOW_LIST;
|
|
114
|
+
let o = c;
|
|
115
|
+
function T({
|
|
116
|
+
owner: i,
|
|
117
|
+
denied: f
|
|
118
|
+
}) {
|
|
119
|
+
return y(
|
|
120
|
+
[
|
|
121
|
+
{ type: "address", name: "owner" },
|
|
122
|
+
{ type: "address[]", name: "denied" }
|
|
123
|
+
],
|
|
124
|
+
[i, f]
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
o as S,
|
|
129
|
+
P as b,
|
|
130
|
+
T as p
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=SimpleDenyList-D9i4rw_F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleDenyList-D9i4rw_F.js","sources":["../src/AllowLists/SimpleDenyList.ts"],"sourcesContent":["import {\n readSimpleAllowListOwner,\n readSimpleDenyListIsAllowed,\n simpleDenyListAbi,\n simulateSimpleDenyListSetDenied,\n writeSimpleDenyListSetDenied,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/allowlists/SimpleDenyList.sol/SimpleDenyList.json';\nimport { getAccount } from '@wagmi/core';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { SimpleDenyList as SimpleDenyListBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTargetWithRBAC } from '../Deployable/DeployableTargetWithRBAC';\nimport { DeployableUnknownOwnerProvidedError } from '../errors';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { simpleDenyListAbi };\n\n/**\n * Object representation of a {@link SimpleDenyList} initialization payload.\n *\n * @export\n * @interface SimpleDenyListPayload\n * @typedef {SimpleDenyListPayload}\n */\nexport interface SimpleDenyListPayload {\n /**\n * The allow list's owner\n *\n * @type {Address}\n */\n owner: Address;\n /**\n * List of denied addresses.\n *\n * @type {Address[]}\n */\n denied: Address[];\n}\n\n/**\n * A generic `viem.Log` event with support for `SimpleDenyList` event types.\n *\n * @export\n * @typedef {SimpleDenyListLog}\n * @template {ContractEventName<typeof simpleDenyListAbi>} [event=ContractEventName<\n * typeof simpleDenyListAbi\n * >]\n */\nexport type SimpleDenyListLog<\n event extends ContractEventName<typeof simpleDenyListAbi> = ContractEventName<\n typeof simpleDenyListAbi\n >,\n> = GenericLog<typeof simpleDenyListAbi, event>;\n\n/**\n * A simple implementation of an AllowList that implicitly allows all addresses except those explicitly added to the deny list\n *\n * @export\n * @class SimpleDenyList\n * @typedef {SimpleDenyList}\n * @extends {DeployableTargetWithRBAC<SimpleDenyListPayload>}\n */\nexport class SimpleDenyList<\n Payload = SimpleDenyListPayload,\n> extends DeployableTargetWithRBAC<\n Payload | undefined,\n typeof simpleDenyListAbi\n> {\n public override readonly abi = simpleDenyListAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n ...(SimpleDenyListBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.ALLOW_LIST;\n\n /**\n * Retrieves the owner\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>} - The address of the owner\n */\n public async owner(\n params?: ReadParams<typeof simpleDenyListAbi, 'owner'>,\n ): Promise<Address> {\n return await readSimpleAllowListOwner(this._config, {\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n address: this.assertValidAddress(),\n args: [],\n });\n }\n\n /**\n * Check if a user is authorized (i.e. not denied)\n *\n * @public\n * @async\n * @param {Address} address - The address of the user\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the user is authorized\n */\n public async isAllowed(\n address: Address,\n params?: ReadParams<typeof simpleDenyListAbi, 'isAllowed'>,\n ): Promise<boolean> {\n return await readSimpleDenyListIsAllowed(this._config, {\n address: this.assertValidAddress(),\n args: [address, zeroHash],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Set the denied status of a user. The length of the `users_` and `denied_` arrays must be the same. This function can only be called by the owner\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of users to update\n * @param {boolean[]} allowed - The denied status of each user\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setDenied(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof simpleDenyListAbi, 'setDenied'>,\n ) {\n return await this.awaitResult(\n this.setDeniedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the denied status of a user. The length of the `users_` and `denied_` arrays must be the same. This function can only be called by the owner\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of users to update\n * @param {boolean[]} allowed - The denied status of each user\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async setDeniedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof simpleDenyListAbi, 'setDenied'>,\n ) {\n const { request, result } = await simulateSimpleDenyListSetDenied(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSimpleDenyListSetDenied(this._config, request);\n return { hash, result };\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?SimpleDenyListPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [p, options] = this.validateDeploymentConfig(_payload, _options);\n const payload = p as SimpleDenyListPayload;\n if (!payload.owner || payload.owner === zeroAddress) {\n const owner = options.account\n ? options.account.address\n : options.config\n ? getAccount(options.config).address\n : this._account?.address;\n if (owner) {\n payload.owner = owner;\n } else {\n throw new DeployableUnknownOwnerProvidedError();\n }\n }\n return {\n abi: simpleDenyListAbi,\n bytecode: bytecode as Hex,\n args: [prepareSimpleDenyListPayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Given a {@link SimpleDenyListPayload}, properly encode the initialization payload.\n *\n * @param {SimpleDenyListPayload} param0\n * @param {Address} param0.owner - The allow list's owner\n * @param {Address[]} param0.denied - List of denied addresses.\n * @returns {Hex}\n */\nexport function prepareSimpleDenyListPayload({\n owner,\n denied,\n}: SimpleDenyListPayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'owner' },\n { type: 'address[]', name: 'denied' },\n ],\n [owner, denied],\n );\n}\n"],"names":["_SimpleDenyList","DeployableTargetWithRBAC","simpleDenyListAbi","params","readSimpleAllowListOwner","address","readSimpleDenyListIsAllowed","zeroHash","addresses","allowed","request","result","simulateSimpleDenyListSetDenied","writeSimpleDenyListSetDenied","_payload","_options","p","options","payload","zeroAddress","owner","getAccount","_a","DeployableUnknownOwnerProvidedError","bytecode","prepareSimpleDenyListPayload","SimpleDenyListBases","RegistryType","SimpleDenyList","denied","encodeAbiParameters"],"mappings":";;;;;;;w4ZA8EaA,IAAN,MAAMA,UAEHC,EAGR;AAAA,EALK,cAAA;AAAA,UAAA,GAAA,SAAA,GAML,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4B/B,MAAa,MACXC,GACkB;AACX,WAAA,MAAMC,EAAyB,KAAK,SAAS;AAAA,MAClD,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAID;AAAA,MACJ,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA,IAAA,CACR;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,UACXE,GACAF,GACkB;AACX,WAAA,MAAMG,EAA4B,KAAK,SAAS;AAAA,MACrD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACD,GAASE,CAAQ;AAAA,MACxB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIJ;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAa,UACXK,GACAC,GACAN,GACA;AACA,WAAO,MAAM,KAAK;AAAA,MAChB,KAAK,aAAaK,GAAWC,GAASN,CAAM;AAAA,IAAA;AAAA,EAEhD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAa,aACXK,GACAC,GACAN,GACA;AACA,UAAM,EAAE,SAAAO,GAAS,QAAAC,EAAO,IAAI,MAAMC;AAAAA,MAChC,KAAK;AAAA,MACL;AAAA,QACE,SAAS,KAAK,mBAAmB;AAAA,QACjC,MAAM,CAACJ,GAAWC,CAAO;AAAA,QACzB,GAAG,KAAK,wBAAwB;AAAA;AAAA,QAEhC,GAAIN;AAAA,MACN;AAAA,IAAA;AAGK,WAAA,EAAE,MADI,MAAMU,EAA6B,KAAK,SAASH,CAAO,GACtD,QAAAC;EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUgB,gBACdG,GACAC,GACyB;;AACzB,UAAM,CAACC,GAAGC,CAAO,IAAI,KAAK,yBAAyBH,GAAUC,CAAQ,GAC/DG,IAAUF;AAChB,QAAI,CAACE,EAAQ,SAASA,EAAQ,UAAUC,GAAa;AACnD,YAAMC,IAAQH,EAAQ,UAClBA,EAAQ,QAAQ,UAChBA,EAAQ,SACNI,EAAWJ,EAAQ,MAAM,EAAE,WAC3BK,IAAA,KAAK,aAAL,gBAAAA,EAAe;AACrB,UAAIF;AACF,QAAAF,EAAQ,QAAQE;AAAA;AAEhB,cAAM,IAAIG,EAAoC;AAAA,IAElD;AACO,WAAA;AAAA,MACL,KAAKrB;AAAAA,MACL,UAAAsB;AAAA,MACA,MAAM,CAACC,EAA6BP,CAAO,CAAC;AAAA,MAC5C,GAAG,KAAK,wBAAwBD,EAAQ,OAAO;AAAA,IAAA;AAAA,EAEnD;AACF;AAxIEjB,EAAuB,QAAiC;AAAA,EACtD,GAAI0B;AAAA,GASN1B,EAAuB,eAA6B2B,EAAa;AAxB5D,IAAMC,IAAN5B;AAgKA,SAASyB,EAA6B;AAAA,EAC3C,OAAAL;AAAA,EACA,QAAAS;AACF,GAA0B;AACjB,SAAAC;AAAA,IACL;AAAA,MACE,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,MACjC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,IACtC;AAAA,IACA,CAACV,GAAOS,CAAM;AAAA,EAAA;AAElB;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../generated-BLg7yPgI.cjs"),r=require("viem"),g=require("viem/accounts"),m=require("../deployments-Ho4PnGCS.cjs"),A=require("../Deployable/DeployableTarget.cjs"),w=require("../utils.cjs"),D="0x610120604052348015610010575f80fd5b503073ffffffffffffffffffffffffffffffffffffffff16608081815250504660a0818152505060608061004861013960201b60201c565b6100635761005a61014160201b60201c565b80925081935050505b5f61007261013960201b60201c565b610083578280519060200120610087565b5f801b5b90505f61009861013960201b60201c565b6100a95782805190602001206100ad565b5f801b5b90508160c081815250508060e081815250505f6100ce61013960201b60201c565b610118576040517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f815283602082015282604082015246606082015230608082015260a081209150505b80610100818152505050505050506101346101b860201b60201c565b61024d565b5f6001905090565b6060806040518060400160405280600f81526020017f5369676e657256616c696461746f72000000000000000000000000000000000081525091506040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525090509091565b5f6101c761022460201b60201c565b9050805460018116156101e15763f92ee8a95f526004601cfd5b8160c01c808260011c1461021f578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b60805160a05160c05160e05161010051611ecf61028a5f395f610f6401525f6110a301525f61108001525f61111201525f6111360152611ecf5ff3fe6080604052600436106100f2575f3560e01c8063736c0d5b11610089578063d3de6e7511610058578063d3de6e75146102c4578063f04e283e14610300578063f2fde38b1461031c578063fee81cf414610338576100f2565b8063736c0d5b1461020657806384b0196e146102425780638da5cb5b14610272578063a1d2756f1461029c576100f2565b8063439fab91116100c5578063439fab911461018e57806354d1f13d146101b6578063703b6900146101c0578063715018a6146101fc576100f2565b806301ffc9a7146100f6578063256929621461013257806328d6183b1461013c5780634359d28a14610166575b5f80fd5b348015610101575f80fd5b5061011c60048036038101906101179190611235565b610374565b604051610129919061127a565b60405180910390f35b61013a6103ed565b005b348015610147575f80fd5b5061015061043e565b60405161015d91906112a2565b60405180910390f35b348015610171575f80fd5b5061018c60048036038101906101879190611371565b610465565b005b348015610199575f80fd5b506101b460048036038101906101af9190611444565b61056e565b005b6101be6106e5565b005b3480156101cb575f80fd5b506101e660048036038101906101e1919061151c565b61071e565b6040516101f3919061127a565b60405180910390f35b610204610911565b005b348015610211575f80fd5b5061022c600480360381019061022791906115a0565b610924565b604051610239919061127a565b60405180910390f35b34801561024d575f80fd5b50610256610940565b6040516102699796959493929190611762565b60405180910390f35b34801561027d575f80fd5b5061028661098b565b60405161029391906117e4565b60405180910390f35b3480156102a7575f80fd5b506102c260048036038101906102bd91906115a0565b6109b3565b005b3480156102cf575f80fd5b506102ea60048036038101906102e5919061195b565b6109fe565b6040516102f791906119db565b60405180910390f35b61031a600480360381019061031591906115a0565b610a67565b005b610336600480360381019061033191906115a0565b610aa5565b005b348015610343575f80fd5b5061035e600480360381019061035991906115a0565b610ace565b60405161036b91906119f4565b60405180910390f35b5f7fb8ce7b22000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806103e657506103e582610ae7565b5b9050919050565b5f6103f6610b60565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7fb8ce7b2200000000000000000000000000000000000000000000000000000000905090565b61046d610b6a565b8181905084849050146104ac576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b84849050811015610567578282828181106104cc576104cb611a0d565b5b90506020020160208101906104e19190611a64565b5f808787858181106104f6576104f5611a0d565b5b905060200201602081019061050b91906115a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555080806001019150506104ae565b5050505050565b5f610577610ba1565b905080546003825580156105a95760018160011c14303b106105a05763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f8084848101906105bb9190611b8a565b915091506105e2825f815181106105d5576105d4611a0d565b5b6020026020010151610bca565b8060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505f5b82518110156106a85760015f8085848151811061064457610643611a0d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610624565b50505080156106e0576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b5f60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107a5576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f83838101906107b59190611c71565b90505f815f01518060200190518101906107cf9190611dcb565b90505f6107e68983604001518986602001516109fe565b905087826040015160ff1611610839578160400151886040517f17c66bc7000000000000000000000000000000000000000000000000000000008152600401610830929190611e21565b60405180910390fd5b5f80835f015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff166108bb576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108d181896001610ca09092919063ffffffff16565b610903818360200151845f015173ffffffffffffffffffffffffffffffffffffffff16610d059092919063ffffffff16565b935050505095945050505050565b610919610b6a565b6109225f610e08565b565b5f602052805f5260405f205f915054906101000a900460ff1681565b5f6060805f805f60607f0f000000000000000000000000000000000000000000000000000000000000009650610974610ece565b809650819750505046935030925090919293949596565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b6109bb610b6a565b8060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f610a5d7ffea51d5bd45bcd3c2ecc3679b43a3b80b0bd0923f8c16f822455b8cdecd9852f8686868680519060200120604051602001610a42959493929190611e48565b60405160208183030381529060405280519060200120610f45565b9050949350505050565b610a6f610b6a565b63389a75e1600c52805f526020600c208054421115610a9557636f5e88185f526004601cfd5b5f815550610aa281610e08565b50565b610aad610b6a565b8060601b610ac257637448fbae5f526004601cfd5b610acb81610e08565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7f5912b89c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610b595750610b5882610fc1565b5b9050919050565b5f6202a300905090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610b9f576382b429005f526004601cfd5b565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610bd261103a565b15610c4a577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610c0c57630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610c9d565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b5f633f57fc5c60e01b90505f634de1225a60e01b90506007831115610ccb57815f528260045260245ffd5b84602052835f5260405f206001841b81541880851c6001166001188015610cf857835f528560045260245ffd5b8183555050505050505050565b5f8360601b60601c93508315610e0157604051835f5260208301516040526040835103610d72576040830151601b8160ff1c016020528060011b60011c6060526020600160805f60015afa805187183d1517610d6f57600193505f60605282604052505050610e01565b50505b6041835103610db85760608301515f1a60205260408301516060526020600160805f60015afa805186183d1517610db657600192505f606052816040525050610e01565b505b5f60605280604052631626ba7e60e01b808252846004830152602482016040815284516020018060448501828860045afa5060208260443d01868b5afa83835114169450505050505b9392505050565b610e1061103a565b15610e75577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610ecb565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b6060806040518060400160405280600f81526020017f5369676e657256616c696461746f72000000000000000000000000000000000081525091506040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525090509091565b5f610f4e61103e565b15610f6257610f5b611046565b9050610f9e565b7f00000000000000000000000000000000000000000000000000000000000000009050610f8d61110e565b15610f9d57610f9a611046565b90505b5b6719010000000000005f5280601a5281603a52604260182090505f603a52919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611033575061103282611166565b5b9050919050565b5f90565b5f6001905090565b5f8061105061103e565b1561107e575f8061105f610ece565b91509150818051906020012093508080519060200120925050506110c5565b7f000000000000000000000000000000000000000000000000000000000000000091507f000000000000000000000000000000000000000000000000000000000000000090505b6040517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f815282602082015281604082015246606082015230608082015260a081209250505090565b5f807f000000000000000000000000000000000000000000000000000000000000000090505f7f0000000000000000000000000000000000000000000000000000000000000000905080301482461416159250505090565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611214816111e0565b811461121e575f80fd5b50565b5f8135905061122f8161120b565b92915050565b5f6020828403121561124a576112496111d8565b5b5f61125784828501611221565b91505092915050565b5f8115159050919050565b61127481611260565b82525050565b5f60208201905061128d5f83018461126b565b92915050565b61129c816111e0565b82525050565b5f6020820190506112b55f830184611293565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126112dc576112db6112bb565b5b8235905067ffffffffffffffff8111156112f9576112f86112bf565b5b602083019150836020820283011115611315576113146112c3565b5b9250929050565b5f8083601f840112611331576113306112bb565b5b8235905067ffffffffffffffff81111561134e5761134d6112bf565b5b60208301915083602082028301111561136a576113696112c3565b5b9250929050565b5f805f8060408587031215611389576113886111d8565b5b5f85013567ffffffffffffffff8111156113a6576113a56111dc565b5b6113b2878288016112c7565b9450945050602085013567ffffffffffffffff8111156113d5576113d46111dc565b5b6113e18782880161131c565b925092505092959194509250565b5f8083601f840112611404576114036112bb565b5b8235905067ffffffffffffffff811115611421576114206112bf565b5b60208301915083600182028301111561143d5761143c6112c3565b5b9250929050565b5f806020838503121561145a576114596111d8565b5b5f83013567ffffffffffffffff811115611477576114766111dc565b5b611483858286016113ef565b92509250509250929050565b5f819050919050565b6114a18161148f565b81146114ab575f80fd5b50565b5f813590506114bc81611498565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6114eb826114c2565b9050919050565b6114fb816114e1565b8114611505575f80fd5b50565b5f81359050611516816114f2565b92915050565b5f805f805f60808688031215611535576115346111d8565b5b5f611542888289016114ae565b9550506020611553888289016114ae565b945050604061156488828901611508565b935050606086013567ffffffffffffffff811115611585576115846111dc565b5b611591888289016113ef565b92509250509295509295909350565b5f602082840312156115b5576115b46111d8565b5b5f6115c284828501611508565b91505092915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6115ff816115cb565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61164782611605565b611651818561160f565b935061166181856020860161161f565b61166a8161162d565b840191505092915050565b61167e8161148f565b82525050565b61168d816114e1565b82525050565b5f819050919050565b6116a581611693565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6116dd8161148f565b82525050565b5f6116ee83836116d4565b60208301905092915050565b5f602082019050919050565b5f611710826116ab565b61171a81856116b5565b9350611725836116c5565b805f5b8381101561175557815161173c88826116e3565b9750611747836116fa565b925050600181019050611728565b5085935050505092915050565b5f60e0820190506117755f83018a6115f6565b8181036020830152611787818961163d565b9050818103604083015261179b818861163d565b90506117aa6060830187611675565b6117b76080830186611684565b6117c460a083018561169c565b81810360c08301526117d68184611706565b905098975050505050505050565b5f6020820190506117f75f830184611684565b92915050565b5f60ff82169050919050565b611812816117fd565b811461181c575f80fd5b50565b5f8135905061182d81611809565b92915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61186d8261162d565b810181811067ffffffffffffffff8211171561188c5761188b611837565b5b80604052505050565b5f61189e6111cf565b90506118aa8282611864565b919050565b5f67ffffffffffffffff8211156118c9576118c8611837565b5b6118d28261162d565b9050602081019050919050565b828183375f83830152505050565b5f6118ff6118fa846118af565b611895565b90508281526020810184848401111561191b5761191a611833565b5b6119268482856118df565b509392505050565b5f82601f830112611942576119416112bb565b5b81356119528482602086016118ed565b91505092915050565b5f805f8060808587031215611973576119726111d8565b5b5f611980878288016114ae565b94505060206119918782880161181f565b93505060406119a287828801611508565b925050606085013567ffffffffffffffff8111156119c3576119c26111dc565b5b6119cf8782880161192e565b91505092959194509250565b5f6020820190506119ee5f83018461169c565b92915050565b5f602082019050611a075f830184611675565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b611a4381611260565b8114611a4d575f80fd5b50565b5f81359050611a5e81611a3a565b92915050565b5f60208284031215611a7957611a786111d8565b5b5f611a8684828501611a50565b91505092915050565b5f67ffffffffffffffff821115611aa957611aa8611837565b5b602082029050602081019050919050565b5f611acc611ac784611a8f565b611895565b90508083825260208201905060208402830185811115611aef57611aee6112c3565b5b835b81811015611b185780611b048882611508565b845260208401935050602081019050611af1565b5050509392505050565b5f82601f830112611b3657611b356112bb565b5b8135611b46848260208601611aba565b91505092915050565b5f611b59826114c2565b9050919050565b611b6981611b4f565b8114611b73575f80fd5b50565b5f81359050611b8481611b60565b92915050565b5f8060408385031215611ba057611b9f6111d8565b5b5f83013567ffffffffffffffff811115611bbd57611bbc6111dc565b5b611bc985828601611b22565b9250506020611bda85828601611b76565b9150509250929050565b5f80fd5b5f80fd5b5f60408284031215611c0157611c00611be4565b5b611c0b6040611895565b90505f82013567ffffffffffffffff811115611c2a57611c29611be8565b5b611c368482850161192e565b5f83015250602082013567ffffffffffffffff811115611c5957611c58611be8565b5b611c658482850161192e565b60208301525092915050565b5f60208284031215611c8657611c856111d8565b5b5f82013567ffffffffffffffff811115611ca357611ca26111dc565b5b611caf84828501611bec565b91505092915050565b5f81519050611cc6816114f2565b92915050565b5f611cde611cd9846118af565b611895565b905082815260208101848484011115611cfa57611cf9611833565b5b611d0584828561161f565b509392505050565b5f82601f830112611d2157611d206112bb565b5b8151611d31848260208601611ccc565b91505092915050565b5f81519050611d4881611809565b92915050565b5f60608284031215611d6357611d62611be4565b5b611d6d6060611895565b90505f611d7c84828501611cb8565b5f83015250602082015167ffffffffffffffff811115611d9f57611d9e611be8565b5b611dab84828501611d0d565b6020830152506040611dbf84828501611d3a565b60408301525092915050565b5f60208284031215611de057611ddf6111d8565b5b5f82015167ffffffffffffffff811115611dfd57611dfc6111dc565b5b611e0984828501611d4e565b91505092915050565b611e1b816117fd565b82525050565b5f604082019050611e345f830185611e12565b611e416020830184611675565b9392505050565b5f60a082019050611e5b5f83018861169c565b611e686020830187611675565b611e756040830186611e12565b611e826060830185611684565b611e8f608083018461169c565b969550505050505056fea26469706673582212208c5f7c2a8beb5f8e3f225aee74f09348b6ae100f0396a5d513683b79c274d19964736f6c634300081a0033",s=class s extends A.DeployableTarget{constructor(){super(...arguments),this.abi=e.M}async signers(f,b){return await e.IN(this._config,{address:this.assertValidAddress(),args:[f],...b})}async hashSignerData(f,b){return await e.vN(this._config,{address:this.assertValidAddress(),args:[f.boostId,f.incentiveQuantity,f.claimant,f.incentiveData],...b})}async validate(f,b){return await this.awaitResult(this.validateRaw(f,b))}async validateRaw(f,b){const{request:a,result:c}=await e.PN(this._config,{address:this.assertValidAddress(),args:[f.boostId,f.incentiveId,f.claimant,f.claimData],...this.optionallyAttachAccount(),...b});return{hash:await e.BN(this._config,a),result:c}}async setAuthorized(f,b,a){return await this.awaitResult(this.setAuthorizedRaw(f,b,a))}async setAuthorizedRaw(f,b,a){const{request:c,result:t}=await e.LN(this._config,{address:this.assertValidAddress(),args:[f,b],...this.optionallyAttachAccount(),...a});return{hash:await e.EN(this._config,c),result:t}}async setValidatorCallerRaw(f,b){const{request:a,result:c}=await e.kN(this._config,{address:this.assertValidAddress(),args:[f],...this.optionallyAttachAccount(),...b});return{hash:await e.RN(this._config,a),result:c}}async setValidatorCaller(f,b){return await this.awaitResult(this.setValidatorCallerRaw(f,b))}async encodeClaimData(f){return await o({...f,validator:this.assertValidAddress()})}buildParameters(f,b){const[a,c]=this.validateDeploymentConfig(f,b);return{abi:e.M,bytecode:D,args:[u(a)],...this.optionallyAttachAccount(c.account)}}};s.bases={...m.SignerValidator},s.registryType=w.RegistryType.VALIDATOR;let i=s;async function o({signer:d,incentiveData:f,chainId:b,validator:a,incentiveQuantity:c,claimant:t,boostId:n}){const y={domain:{name:"SignerValidator",version:"1",chainId:b,verifyingContract:a},types:{SignerValidatorData:[{name:"boostId",type:"uint256"},{name:"incentiveQuantity",type:"uint8"},{name:"claimant",type:"address"},{name:"incentiveData",type:"bytes"}]},primaryType:"SignerValidatorData",message:{boostId:n,incentiveQuantity:c,claimant:t,incentiveData:f}},h=await g.signTypedData({...y,privateKey:d.key}),p=l({signer:d.account,signature:h,incentiveQuantity:c});return r.encodeAbiParameters([{type:"tuple",name:"BoostClaimData",components:[{type:"bytes",name:"validatorData"},{type:"bytes",name:"incentiveData"}]}],[{validatorData:p,incentiveData:f}])}function l({signer:d,signature:f,incentiveQuantity:b}){return r.encodeAbiParameters([{type:"tuple",name:"SignerValidatorInputParams",components:[{type:"address",name:"signer"},{type:"bytes",name:"signature"},{type:"uint8",name:"incentiveQuantity"}]}],[{signer:d,signature:f,incentiveQuantity:b}])}function u({signers:d,validatorCaller:f}){return r.encodeAbiParameters([{type:"address[]",name:"signers"},{type:"address",name:"validatorCaller"}],[d,f])}exports.signerValidatorAbi=e.M;exports.SignerValidator=i;exports.prepareSignerValidatorClaimDataPayload=o;exports.prepareSignerValidatorInputParams=l;exports.prepareSignerValidatorPayload=u;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../generated-B0tk-c9b.cjs"),r=require("viem"),p=require("viem/accounts"),m=require("../deployments-CMdF5uEC.cjs"),A=require("../Deployable/DeployableTarget.cjs"),w=require("../utils.cjs"),D="0x610120604052348015610010575f80fd5b503073ffffffffffffffffffffffffffffffffffffffff16608081815250504660a0818152505060608061004861013960201b60201c565b6100635761005a61014160201b60201c565b80925081935050505b5f61007261013960201b60201c565b610083578280519060200120610087565b5f801b5b90505f61009861013960201b60201c565b6100a95782805190602001206100ad565b5f801b5b90508160c081815250508060e081815250505f6100ce61013960201b60201c565b610118576040517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f815283602082015282604082015246606082015230608082015260a081209150505b80610100818152505050505050506101346101b860201b60201c565b61024d565b5f6001905090565b6060806040518060400160405280600f81526020017f5369676e657256616c696461746f72000000000000000000000000000000000081525091506040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525090509091565b5f6101c761022460201b60201c565b9050805460018116156101e15763f92ee8a95f526004601cfd5b8160c01c808260011c1461021f578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b60805160a05160c05160e05161010051611ecf61028a5f395f610f6401525f6110a301525f61108001525f61111201525f6111360152611ecf5ff3fe6080604052600436106100f2575f3560e01c8063736c0d5b11610089578063d3de6e7511610058578063d3de6e75146102c4578063f04e283e14610300578063f2fde38b1461031c578063fee81cf414610338576100f2565b8063736c0d5b1461020657806384b0196e146102425780638da5cb5b14610272578063a1d2756f1461029c576100f2565b8063439fab91116100c5578063439fab911461018e57806354d1f13d146101b6578063703b6900146101c0578063715018a6146101fc576100f2565b806301ffc9a7146100f6578063256929621461013257806328d6183b1461013c5780634359d28a14610166575b5f80fd5b348015610101575f80fd5b5061011c60048036038101906101179190611235565b610374565b604051610129919061127a565b60405180910390f35b61013a6103ed565b005b348015610147575f80fd5b5061015061043e565b60405161015d91906112a2565b60405180910390f35b348015610171575f80fd5b5061018c60048036038101906101879190611371565b610465565b005b348015610199575f80fd5b506101b460048036038101906101af9190611444565b61056e565b005b6101be6106e5565b005b3480156101cb575f80fd5b506101e660048036038101906101e1919061151c565b61071e565b6040516101f3919061127a565b60405180910390f35b610204610911565b005b348015610211575f80fd5b5061022c600480360381019061022791906115a0565b610924565b604051610239919061127a565b60405180910390f35b34801561024d575f80fd5b50610256610940565b6040516102699796959493929190611762565b60405180910390f35b34801561027d575f80fd5b5061028661098b565b60405161029391906117e4565b60405180910390f35b3480156102a7575f80fd5b506102c260048036038101906102bd91906115a0565b6109b3565b005b3480156102cf575f80fd5b506102ea60048036038101906102e5919061195b565b6109fe565b6040516102f791906119db565b60405180910390f35b61031a600480360381019061031591906115a0565b610a67565b005b610336600480360381019061033191906115a0565b610aa5565b005b348015610343575f80fd5b5061035e600480360381019061035991906115a0565b610ace565b60405161036b91906119f4565b60405180910390f35b5f7fb8ce7b22000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806103e657506103e582610ae7565b5b9050919050565b5f6103f6610b60565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7fb8ce7b2200000000000000000000000000000000000000000000000000000000905090565b61046d610b6a565b8181905084849050146104ac576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b84849050811015610567578282828181106104cc576104cb611a0d565b5b90506020020160208101906104e19190611a64565b5f808787858181106104f6576104f5611a0d565b5b905060200201602081019061050b91906115a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555080806001019150506104ae565b5050505050565b5f610577610ba1565b905080546003825580156105a95760018160011c14303b106105a05763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f8084848101906105bb9190611b8a565b915091506105e2825f815181106105d5576105d4611a0d565b5b6020026020010151610bca565b8060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505f5b82518110156106a85760015f8085848151811061064457610643611a0d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610624565b50505080156106e0576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b5f60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107a5576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f83838101906107b59190611c71565b90505f815f01518060200190518101906107cf9190611dcb565b90505f6107e68983604001518986602001516109fe565b905087826040015160ff1611610839578160400151886040517f17c66bc7000000000000000000000000000000000000000000000000000000008152600401610830929190611e21565b60405180910390fd5b5f80835f015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff166108bb576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108d181896001610ca09092919063ffffffff16565b610903818360200151845f015173ffffffffffffffffffffffffffffffffffffffff16610d059092919063ffffffff16565b935050505095945050505050565b610919610b6a565b6109225f610e08565b565b5f602052805f5260405f205f915054906101000a900460ff1681565b5f6060805f805f60607f0f000000000000000000000000000000000000000000000000000000000000009650610974610ece565b809650819750505046935030925090919293949596565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b6109bb610b6a565b8060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f610a5d7ffea51d5bd45bcd3c2ecc3679b43a3b80b0bd0923f8c16f822455b8cdecd9852f8686868680519060200120604051602001610a42959493929190611e48565b60405160208183030381529060405280519060200120610f45565b9050949350505050565b610a6f610b6a565b63389a75e1600c52805f526020600c208054421115610a9557636f5e88185f526004601cfd5b5f815550610aa281610e08565b50565b610aad610b6a565b8060601b610ac257637448fbae5f526004601cfd5b610acb81610e08565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7f5912b89c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610b595750610b5882610fc1565b5b9050919050565b5f6202a300905090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610b9f576382b429005f526004601cfd5b565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610bd261103a565b15610c4a577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610c0c57630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610c9d565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b5f633f57fc5c60e01b90505f634de1225a60e01b90506007831115610ccb57815f528260045260245ffd5b84602052835f5260405f206001841b81541880851c6001166001188015610cf857835f528560045260245ffd5b8183555050505050505050565b5f8360601b60601c93508315610e0157604051835f5260208301516040526040835103610d72576040830151601b8160ff1c016020528060011b60011c6060526020600160805f60015afa805187183d1517610d6f57600193505f60605282604052505050610e01565b50505b6041835103610db85760608301515f1a60205260408301516060526020600160805f60015afa805186183d1517610db657600192505f606052816040525050610e01565b505b5f60605280604052631626ba7e60e01b808252846004830152602482016040815284516020018060448501828860045afa5060208260443d01868b5afa83835114169450505050505b9392505050565b610e1061103a565b15610e75577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610ecb565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b6060806040518060400160405280600f81526020017f5369676e657256616c696461746f72000000000000000000000000000000000081525091506040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525090509091565b5f610f4e61103e565b15610f6257610f5b611046565b9050610f9e565b7f00000000000000000000000000000000000000000000000000000000000000009050610f8d61110e565b15610f9d57610f9a611046565b90505b5b6719010000000000005f5280601a5281603a52604260182090505f603a52919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611033575061103282611166565b5b9050919050565b5f90565b5f6001905090565b5f8061105061103e565b1561107e575f8061105f610ece565b91509150818051906020012093508080519060200120925050506110c5565b7f000000000000000000000000000000000000000000000000000000000000000091507f000000000000000000000000000000000000000000000000000000000000000090505b6040517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f815282602082015281604082015246606082015230608082015260a081209250505090565b5f807f000000000000000000000000000000000000000000000000000000000000000090505f7f0000000000000000000000000000000000000000000000000000000000000000905080301482461416159250505090565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611214816111e0565b811461121e575f80fd5b50565b5f8135905061122f8161120b565b92915050565b5f6020828403121561124a576112496111d8565b5b5f61125784828501611221565b91505092915050565b5f8115159050919050565b61127481611260565b82525050565b5f60208201905061128d5f83018461126b565b92915050565b61129c816111e0565b82525050565b5f6020820190506112b55f830184611293565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126112dc576112db6112bb565b5b8235905067ffffffffffffffff8111156112f9576112f86112bf565b5b602083019150836020820283011115611315576113146112c3565b5b9250929050565b5f8083601f840112611331576113306112bb565b5b8235905067ffffffffffffffff81111561134e5761134d6112bf565b5b60208301915083602082028301111561136a576113696112c3565b5b9250929050565b5f805f8060408587031215611389576113886111d8565b5b5f85013567ffffffffffffffff8111156113a6576113a56111dc565b5b6113b2878288016112c7565b9450945050602085013567ffffffffffffffff8111156113d5576113d46111dc565b5b6113e18782880161131c565b925092505092959194509250565b5f8083601f840112611404576114036112bb565b5b8235905067ffffffffffffffff811115611421576114206112bf565b5b60208301915083600182028301111561143d5761143c6112c3565b5b9250929050565b5f806020838503121561145a576114596111d8565b5b5f83013567ffffffffffffffff811115611477576114766111dc565b5b611483858286016113ef565b92509250509250929050565b5f819050919050565b6114a18161148f565b81146114ab575f80fd5b50565b5f813590506114bc81611498565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6114eb826114c2565b9050919050565b6114fb816114e1565b8114611505575f80fd5b50565b5f81359050611516816114f2565b92915050565b5f805f805f60808688031215611535576115346111d8565b5b5f611542888289016114ae565b9550506020611553888289016114ae565b945050604061156488828901611508565b935050606086013567ffffffffffffffff811115611585576115846111dc565b5b611591888289016113ef565b92509250509295509295909350565b5f602082840312156115b5576115b46111d8565b5b5f6115c284828501611508565b91505092915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6115ff816115cb565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61164782611605565b611651818561160f565b935061166181856020860161161f565b61166a8161162d565b840191505092915050565b61167e8161148f565b82525050565b61168d816114e1565b82525050565b5f819050919050565b6116a581611693565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6116dd8161148f565b82525050565b5f6116ee83836116d4565b60208301905092915050565b5f602082019050919050565b5f611710826116ab565b61171a81856116b5565b9350611725836116c5565b805f5b8381101561175557815161173c88826116e3565b9750611747836116fa565b925050600181019050611728565b5085935050505092915050565b5f60e0820190506117755f83018a6115f6565b8181036020830152611787818961163d565b9050818103604083015261179b818861163d565b90506117aa6060830187611675565b6117b76080830186611684565b6117c460a083018561169c565b81810360c08301526117d68184611706565b905098975050505050505050565b5f6020820190506117f75f830184611684565b92915050565b5f60ff82169050919050565b611812816117fd565b811461181c575f80fd5b50565b5f8135905061182d81611809565b92915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61186d8261162d565b810181811067ffffffffffffffff8211171561188c5761188b611837565b5b80604052505050565b5f61189e6111cf565b90506118aa8282611864565b919050565b5f67ffffffffffffffff8211156118c9576118c8611837565b5b6118d28261162d565b9050602081019050919050565b828183375f83830152505050565b5f6118ff6118fa846118af565b611895565b90508281526020810184848401111561191b5761191a611833565b5b6119268482856118df565b509392505050565b5f82601f830112611942576119416112bb565b5b81356119528482602086016118ed565b91505092915050565b5f805f8060808587031215611973576119726111d8565b5b5f611980878288016114ae565b94505060206119918782880161181f565b93505060406119a287828801611508565b925050606085013567ffffffffffffffff8111156119c3576119c26111dc565b5b6119cf8782880161192e565b91505092959194509250565b5f6020820190506119ee5f83018461169c565b92915050565b5f602082019050611a075f830184611675565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b611a4381611260565b8114611a4d575f80fd5b50565b5f81359050611a5e81611a3a565b92915050565b5f60208284031215611a7957611a786111d8565b5b5f611a8684828501611a50565b91505092915050565b5f67ffffffffffffffff821115611aa957611aa8611837565b5b602082029050602081019050919050565b5f611acc611ac784611a8f565b611895565b90508083825260208201905060208402830185811115611aef57611aee6112c3565b5b835b81811015611b185780611b048882611508565b845260208401935050602081019050611af1565b5050509392505050565b5f82601f830112611b3657611b356112bb565b5b8135611b46848260208601611aba565b91505092915050565b5f611b59826114c2565b9050919050565b611b6981611b4f565b8114611b73575f80fd5b50565b5f81359050611b8481611b60565b92915050565b5f8060408385031215611ba057611b9f6111d8565b5b5f83013567ffffffffffffffff811115611bbd57611bbc6111dc565b5b611bc985828601611b22565b9250506020611bda85828601611b76565b9150509250929050565b5f80fd5b5f80fd5b5f60408284031215611c0157611c00611be4565b5b611c0b6040611895565b90505f82013567ffffffffffffffff811115611c2a57611c29611be8565b5b611c368482850161192e565b5f83015250602082013567ffffffffffffffff811115611c5957611c58611be8565b5b611c658482850161192e565b60208301525092915050565b5f60208284031215611c8657611c856111d8565b5b5f82013567ffffffffffffffff811115611ca357611ca26111dc565b5b611caf84828501611bec565b91505092915050565b5f81519050611cc6816114f2565b92915050565b5f611cde611cd9846118af565b611895565b905082815260208101848484011115611cfa57611cf9611833565b5b611d0584828561161f565b509392505050565b5f82601f830112611d2157611d206112bb565b5b8151611d31848260208601611ccc565b91505092915050565b5f81519050611d4881611809565b92915050565b5f60608284031215611d6357611d62611be4565b5b611d6d6060611895565b90505f611d7c84828501611cb8565b5f83015250602082015167ffffffffffffffff811115611d9f57611d9e611be8565b5b611dab84828501611d0d565b6020830152506040611dbf84828501611d3a565b60408301525092915050565b5f60208284031215611de057611ddf6111d8565b5b5f82015167ffffffffffffffff811115611dfd57611dfc6111dc565b5b611e0984828501611d4e565b91505092915050565b611e1b816117fd565b82525050565b5f604082019050611e345f830185611e12565b611e416020830184611675565b9392505050565b5f60a082019050611e5b5f83018861169c565b611e686020830187611675565b611e756040830186611e12565b611e826060830185611684565b611e8f608083018461169c565b969550505050505056fea26469706673582212208c5f7c2a8beb5f8e3f225aee74f09348b6ae100f0396a5d513683b79c274d19964736f6c634300081a0033",s=class s extends A.DeployableTarget{constructor(){super(...arguments),this.abi=e.x}async signers(f,b){return await e.Dg(this._config,{address:this.assertValidAddress(),args:[f],...b})}async hashSignerData(f,b){return await e.Vg(this._config,{address:this.assertValidAddress(),args:[f.boostId,f.incentiveQuantity,f.claimant,f.incentiveData],...b})}async validate(f,b){return await this.awaitResult(this.validateRaw(f,b))}async validateRaw(f,b){const{request:a,result:c}=await e.rO(this._config,{address:this.assertValidAddress(),args:[f.boostId,f.incentiveId,f.claimant,f.claimData],...this.optionallyAttachAccount(),...b});return{hash:await e.Jg(this._config,a),result:c}}async setAuthorized(f,b,a){return await this.awaitResult(this.setAuthorizedRaw(f,b,a))}async setAuthorizedRaw(f,b,a){const{request:c,result:t}=await e.aO(this._config,{address:this.assertValidAddress(),args:[f,b],...this.optionallyAttachAccount(),...a});return{hash:await e.$g(this._config,c),result:t}}async setValidatorCallerRaw(f,b){const{request:a,result:c}=await e.iO(this._config,{address:this.assertValidAddress(),args:[f],...this.optionallyAttachAccount(),...b});return{hash:await e.Wg(this._config,a),result:c}}async setValidatorCaller(f,b){return await this.awaitResult(this.setValidatorCallerRaw(f,b))}async encodeClaimData(f){return await o({...f,validator:this.assertValidAddress()})}buildParameters(f,b){const[a,c]=this.validateDeploymentConfig(f,b);return{abi:e.x,bytecode:D,args:[u(a)],...this.optionallyAttachAccount(c.account)}}};s.bases={...m.SignerValidator},s.registryType=w.RegistryType.VALIDATOR;let i=s;async function o({signer:d,incentiveData:f,chainId:b,validator:a,incentiveQuantity:c,claimant:t,boostId:n}){const y={domain:{name:"SignerValidator",version:"1",chainId:b,verifyingContract:a},types:{SignerValidatorData:[{name:"boostId",type:"uint256"},{name:"incentiveQuantity",type:"uint8"},{name:"claimant",type:"address"},{name:"incentiveData",type:"bytes"}]},primaryType:"SignerValidatorData",message:{boostId:n,incentiveQuantity:c,claimant:t,incentiveData:f}},h=await p.signTypedData({...y,privateKey:d.key}),g=l({signer:d.account,signature:h,incentiveQuantity:c});return r.encodeAbiParameters([{type:"tuple",name:"BoostClaimData",components:[{type:"bytes",name:"validatorData"},{type:"bytes",name:"incentiveData"}]}],[{validatorData:g,incentiveData:f}])}function l({signer:d,signature:f,incentiveQuantity:b}){return r.encodeAbiParameters([{type:"tuple",name:"SignerValidatorInputParams",components:[{type:"address",name:"signer"},{type:"bytes",name:"signature"},{type:"uint8",name:"incentiveQuantity"}]}],[{signer:d,signature:f,incentiveQuantity:b}])}function u({signers:d,validatorCaller:f}){return r.encodeAbiParameters([{type:"address[]",name:"signers"},{type:"address",name:"validatorCaller"}],[d,f])}exports.signerValidatorAbi=e.x;exports.SignerValidator=i;exports.prepareSignerValidatorClaimDataPayload=o;exports.prepareSignerValidatorInputParams=l;exports.prepareSignerValidatorPayload=u;
|
|
2
2
|
//# sourceMappingURL=SignerValidator.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignerValidator.cjs","sources":["../../src/Validators/SignerValidator.ts"],"sourcesContent":["import {\n readSignerValidatorHashSignerData,\n readSignerValidatorSigners,\n signerValidatorAbi,\n simulateSignerValidatorSetAuthorized,\n simulateSignerValidatorSetValidatorCaller,\n simulateSignerValidatorValidate,\n writeSignerValidatorSetAuthorized,\n writeSignerValidatorSetValidatorCaller,\n writeSignerValidatorValidate,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/validators/SignerValidator.sol/SignerValidator.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n type PrivateKeyAccount,\n encodeAbiParameters,\n} from 'viem';\nimport { signTypedData } from 'viem/accounts';\nimport { SignerValidator as SignerValidatorBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { signerValidatorAbi };\n\n/**\n * Object reprentation of a {@link SignerValidator} initialization payload\n *\n * @export\n * @interface SignerValidatorPayload\n * @typedef {SignerValidatorPayload}\n */\nexport interface SignerValidatorPayload {\n /**\n * The list of authorized signers. The first address in the list will be the initial owner of the contract.\n *\n * @type {Address[]}\n */\n signers: Address[];\n /**\n * The authorized caller of the {@link prepareSignerValidator} function\n * @type {Address}\n */\n validatorCaller: Address;\n}\n\n/**\n * Description placeholder\n *\n * @export\n * @interface SignerValidatorValidatePayload\n * @typedef {SignerValidatorValidatePayload}\n */\nexport interface SignerValidatorValidatePayload {\n /**\n * The ID of the boost.\n *\n * @type {bigint}\n */\n boostId: bigint;\n /**\n * The ID of the incentive.\n *\n * @type {bigint}\n */\n incentiveId: bigint;\n /**\n * The address of the claimant.\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The claim data.\n *\n * @type {Hex}\n */\n claimData: Hex;\n}\n\n/**\n * Object reprentation of a {@link SignerValidator} initialization payload\n *\n * @export\n * @interface SignerValidatorPayload\n * @typedef {SignerValidatorPayload}\n */\nexport interface SignerValidatorPayload {\n /**\n * The list of authorized signers. The first address in the list will be the initial owner of the contract.\n *\n * @type {Address[]}\n */\n signers: Address[];\n /**\n * The authorized caller of the {@link prepareSignerValidator} function\n * @type {Address}\n */\n validatorCaller: Address;\n}\n\n/**\n * Description placeholder\n *\n * @export\n * @interface SignerValidatorValidatePayload\n * @typedef {SignerValidatorValidatePayload}\n */\nexport interface SignerValidatorValidatePayload {\n /**\n * The ID of the boost.\n *\n * @type {bigint}\n */\n boostId: bigint;\n /**\n * The ID of the incentive.\n *\n * @type {bigint}\n */\n incentiveId: bigint;\n /**\n * The address of the claimant.\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The claim data.\n *\n * @type {Hex}\n */\n claimData: Hex;\n}\n\n/**\n * Signer Validator Claim Data Payload\n *\n * @export\n * @interface SignerValidatorClaimDataParams\n * @typedef {SignerValidatorClaimDataParams}\n */\nexport interface SignerValidatorClaimDataParams {\n /**\n * The signer with which to sign the input\n *\n * @type {{\n * account: Address;\n * key: Hex;\n * privateKey: PrivateKeyAccount;\n * }}\n */\n signer: {\n account: Address;\n key: Hex;\n privateKey: PrivateKeyAccount;\n };\n /**\n * The encoded data to provide the underlying incentive. You can use {@link prepareAllowListIncentivePayload}, {@link prepareCGDAIncentivePayload}, {@link prepareERC20IncentivePayload}, {@link prepareERC1155IncentivePayload}, or {@link preparePointsIncentivePayload}\n *\n * @type {Hex}\n */\n incentiveData: Hex;\n /**\n * The chain id to target\n *\n * @type {number}\n */\n chainId: number;\n /**\n * The address of the validator\n *\n * @type {Address}\n */\n validator: Address;\n /**\n * The incentive quantity.\n *\n * @type {number}\n */\n incentiveQuantity: number;\n /**\n * The address of the claimant\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The ID of the boost\n *\n * @type {bigint}\n */\n boostId: bigint;\n}\n\n/**\n * Object representation of a {@link SignerValidatorInputParams} initialization payload\n *\n * @export\n * @interface SignerValidatorInputParams\n * @typedef {SignerValidatorInputParams}\n */\nexport interface SignerValidatorInputParams {\n /**\n * The signer address.\n *\n * @type {Address}\n */\n signer: Address;\n\n /**\n * The signature data.\n *\n * @type {string}\n */\n signature: Hex;\n\n /**\n * The incentive quantity.\n *\n * @type {number}\n */\n incentiveQuantity: number;\n}\n\n/**\n * Object representing the payload for signing before validaton.\n *\n * @export\n * @interface SignerValidatorSignaturePayload\n * @typedef {SignerValidatorSignaturePayload}\n */\nexport interface SignerValidatorSignaturePayload {\n /**\n * The ID of the boost.\n *\n * @type {bigint}\n */\n boostId: bigint;\n /**\n * The ID of the incentive.\n *\n * @type {number}\n */\n incentiveQuantity: number;\n /**\n * The address of the claimant.\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The claim data.\n *\n * @type {Hex}\n */\n incentiveData: Hex;\n}\n\n/**\n * A generic `viem.Log` event with support for `BoostCore` event types.\n *\n * @export\n * @typedef {SignerValidatorLog}\n * @template {ContractEventName<\n * typeof signerValidatorAbi\n * >} [event=ContractEventName<typeof signerValidatorAbi>]\n */\nexport type SignerValidatorLog<\n event extends ContractEventName<\n typeof signerValidatorAbi\n > = ContractEventName<typeof signerValidatorAbi>,\n> = GenericLog<typeof signerValidatorAbi, event>;\n\n/**\n * A simple implementation of a Validator that verifies a given signature and checks the recovered address against a set of authorized signers\n *\n * @export\n * @class SignerValidator\n * @typedef {SignerValidator}\n * @extends {DeployableTarget<SignerValidatorPayload>}\n */\nexport class SignerValidator extends DeployableTarget<\n SignerValidatorPayload,\n typeof signerValidatorAbi\n> {\n /**\n * @inheritdoc\n *\n * @public\n * @readonly\n * @type {*}\n */\n public override readonly abi = signerValidatorAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n ...(SignerValidatorBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.VALIDATOR;\n\n /**\n * The set of authorized signers\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof signerValidatorAbi, 'signers'>} [params]\n * @returns {unknown}\n */\n public async signers(\n address: Address,\n params?: ReadParams<typeof signerValidatorAbi, 'signers'>,\n ) {\n return await readSignerValidatorSigners(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Retrieve the hash and signer data for a given hash\n *\n * @public\n * @async\n * @param {SignerValidatorSignaturePayload} payload\n * @param {?ReadParams<typeof signerValidatorAbi, 'hashSignerData'>} [params]\n * @returns {unknown}\n */\n public async hashSignerData(\n payload: SignerValidatorSignaturePayload,\n params?: ReadParams<typeof signerValidatorAbi, 'hashSignerData'>,\n ) {\n return await readSignerValidatorHashSignerData(this._config, {\n address: this.assertValidAddress(),\n args: [\n payload.boostId,\n payload.incentiveQuantity,\n payload.claimant,\n payload.incentiveData,\n ],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * 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.\n *\n * @public\n * @async\n * @param {SignerValidatorValidatePayload} payload\n * @param {?WriteParams<typeof signerValidatorAbi, 'validate'>} [params]\n * @returns {Promise<boolean>} - True if the action has been validated based on the data payload\n */\n protected async validate(\n payload: SignerValidatorValidatePayload,\n params?: WriteParams<typeof signerValidatorAbi, 'validate'>,\n ) {\n return await this.awaitResult(this.validateRaw(payload, params));\n }\n\n /**\n * 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.\n *\n * @public\n * @async\n * @param {SignerValidatorValidatePayload} payload\n * @param {?WriteParams<typeof signerValidatorAbi, 'validate'>} [params]\n * @returns {Promise<boolean>} - True if the action has been validated based on the data payload\n */\n protected async validateRaw(\n payload: SignerValidatorValidatePayload,\n params?: ReadParams<typeof signerValidatorAbi, 'validate'>,\n ) {\n const { request, result } = await simulateSignerValidatorValidate(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [\n payload.boostId,\n payload.incentiveId,\n payload.claimant,\n payload.claimData,\n ],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorValidate(this._config, request);\n return { hash, result };\n }\n\n /**\n * Set the authorized status of a signer\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of signers to update\n * @param {boolean[]} allowed - The authorized status of each signer\n * @param {?WriteParams<typeof signerValidatorAbi, 'setAuthorized'>} [params]\n * @returns {unknown}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof signerValidatorAbi, 'setAuthorized'>,\n ) {\n return await this.awaitResult(\n this.setAuthorizedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the authorized status of a signer\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of signers to update\n * @param {boolean[]} allowed - The authorized status of each signer\n * @param {?WriteParams<typeof signerValidatorAbi, 'setAuthorized'>} [params]\n * @returns {unknown}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof signerValidatorAbi, 'setAuthorized'>,\n ) {\n const { request, result } = await simulateSignerValidatorSetAuthorized(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Update the authorized caller of the validator function\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>} [params]\n * @returns {unknown}\n */\n public async setValidatorCallerRaw(\n address: Address,\n params?: WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>,\n ) {\n const { request, result } = await simulateSignerValidatorSetValidatorCaller(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [address],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorSetValidatorCaller(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Update the authorized caller of the validator function\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>} [params]\n * @returns {unknown}\n */\n public async setValidatorCaller(\n address: Address,\n params?: WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>,\n ) {\n return await this.awaitResult(this.setValidatorCallerRaw(address, params));\n }\n\n /**\n * Properly encodes the data needed to claim\n *\n * @public\n * @async\n * @param {SignerValidatorClaimDataParams} params\n * @returns {Promise<Hex>}\n */\n public async encodeClaimData(\n params: Omit<SignerValidatorClaimDataParams, 'validator'>,\n ): Promise<Hex> {\n return await prepareSignerValidatorClaimDataPayload({\n ...params,\n validator: this.assertValidAddress(),\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?SignerValidatorPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: SignerValidatorPayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: signerValidatorAbi,\n bytecode: bytecode as Hex,\n args: [prepareSignerValidatorPayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Signer Validator Claim Data Payload Preparation\n *\n * @export\n * @async\n * @param {SignerValidatorClaimDataParams} param0\n * @param {{ account: Address; key: Hex; privateKey: PrivateKeyAccount; }} param0.signer\n * @param {Hex} param0.incentiveData\n * @param {number} param0.chainId\n * @param {Address} param0.validator\n * @param {number} param0.incentiveQuantity\n * @param {Address} param0.claimant\n * @param {bigint} param0.boostId\n * @returns {Promise<Hex>}\n */\nexport async function prepareSignerValidatorClaimDataPayload({\n signer,\n incentiveData,\n chainId,\n validator,\n incentiveQuantity,\n claimant,\n boostId,\n}: SignerValidatorClaimDataParams): Promise<Hex> {\n const domain = {\n name: 'SignerValidator',\n version: '1',\n chainId: chainId,\n verifyingContract: validator,\n };\n const typedData = {\n domain,\n types: {\n SignerValidatorData: [\n { name: 'boostId', type: 'uint256' },\n { name: 'incentiveQuantity', type: 'uint8' },\n { name: 'claimant', type: 'address' },\n { name: 'incentiveData', type: 'bytes' },\n ],\n },\n primaryType: 'SignerValidatorData' as const,\n message: {\n boostId,\n incentiveQuantity,\n claimant,\n incentiveData: incentiveData,\n },\n };\n\n const trustedSignature = await signTypedData({\n ...typedData,\n privateKey: signer.key,\n });\n\n // Prepare the claim data payload using the new helper\n const validatorData = prepareSignerValidatorInputParams({\n signer: signer.account,\n signature: trustedSignature,\n incentiveQuantity, // Adjust incentive quantity as necessary\n });\n\n const boostClaimDataPayload = encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n [{ validatorData, incentiveData }],\n );\n\n return boostClaimDataPayload;\n}\n\n/**\n * Given a {@link SignerValidatorInputParams}, properly encode the initialization payload.\n *\n * @param {SignerValidatorInputParams} param0\n * @param {Address} param0.signer\n * @param {Hex} param0.signature\n * @param {number} param0.incentiveQuantity\n * @returns {Hex}\n */\nexport function prepareSignerValidatorInputParams({\n signer,\n signature,\n incentiveQuantity,\n}: SignerValidatorInputParams) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'SignerValidatorInputParams',\n components: [\n { type: 'address', name: 'signer' },\n { type: 'bytes', name: 'signature' },\n { type: 'uint8', name: 'incentiveQuantity' },\n ],\n },\n ],\n [{ signer, signature, incentiveQuantity }],\n );\n}\n\n/**\n * Given a {@link SignerValidatorPayload}, properly encode the initialization payload.\n *\n * @param {SignerValidatorPayload} param0\n * @param {Address[]} param0.signers\n * @param {Address} param0.validatorCaller\n * @returns {Hex}\n */\nexport function prepareSignerValidatorPayload({\n signers,\n validatorCaller,\n}: SignerValidatorPayload) {\n return encodeAbiParameters(\n [\n { type: 'address[]', name: 'signers' },\n { type: 'address', name: 'validatorCaller' },\n ],\n [signers, validatorCaller],\n );\n}\n"],"names":["_SignerValidator","DeployableTarget","signerValidatorAbi","address","params","readSignerValidatorSigners","payload","readSignerValidatorHashSignerData","request","result","simulateSignerValidatorValidate","writeSignerValidatorValidate","addresses","allowed","simulateSignerValidatorSetAuthorized","writeSignerValidatorSetAuthorized","simulateSignerValidatorSetValidatorCaller","writeSignerValidatorSetValidatorCaller","prepareSignerValidatorClaimDataPayload","_payload","_options","options","bytecode","prepareSignerValidatorPayload","SignerValidatorBases","RegistryType","SignerValidator","signer","incentiveData","chainId","validator","incentiveQuantity","claimant","boostId","typedData","trustedSignature","signTypedData","validatorData","prepareSignerValidatorInputParams","encodeAbiParameters","signature","signers","validatorCaller"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"SignerValidator.cjs","sources":["../../src/Validators/SignerValidator.ts"],"sourcesContent":["import {\n readSignerValidatorHashSignerData,\n readSignerValidatorSigners,\n signerValidatorAbi,\n simulateSignerValidatorSetAuthorized,\n simulateSignerValidatorSetValidatorCaller,\n simulateSignerValidatorValidate,\n writeSignerValidatorSetAuthorized,\n writeSignerValidatorSetValidatorCaller,\n writeSignerValidatorValidate,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/validators/SignerValidator.sol/SignerValidator.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n type PrivateKeyAccount,\n encodeAbiParameters,\n} from 'viem';\nimport { signTypedData } from 'viem/accounts';\nimport { SignerValidator as SignerValidatorBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { signerValidatorAbi };\n\n/**\n * Object reprentation of a {@link SignerValidator} initialization payload\n *\n * @export\n * @interface SignerValidatorPayload\n * @typedef {SignerValidatorPayload}\n */\nexport interface SignerValidatorPayload {\n /**\n * The list of authorized signers. The first address in the list will be the initial owner of the contract.\n *\n * @type {Address[]}\n */\n signers: Address[];\n /**\n * The authorized caller of the {@link prepareSignerValidator} function\n * @type {Address}\n */\n validatorCaller: Address;\n}\n\n/**\n * Description placeholder\n *\n * @export\n * @interface SignerValidatorValidatePayload\n * @typedef {SignerValidatorValidatePayload}\n */\nexport interface SignerValidatorValidatePayload {\n /**\n * The ID of the boost.\n *\n * @type {bigint}\n */\n boostId: bigint;\n /**\n * The ID of the incentive.\n *\n * @type {bigint}\n */\n incentiveId: bigint;\n /**\n * The address of the claimant.\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The claim data.\n *\n * @type {Hex}\n */\n claimData: Hex;\n}\n\n/**\n * Object reprentation of a {@link SignerValidator} initialization payload\n *\n * @export\n * @interface SignerValidatorPayload\n * @typedef {SignerValidatorPayload}\n */\nexport interface SignerValidatorPayload {\n /**\n * The list of authorized signers. The first address in the list will be the initial owner of the contract.\n *\n * @type {Address[]}\n */\n signers: Address[];\n /**\n * The authorized caller of the {@link prepareSignerValidator} function\n * @type {Address}\n */\n validatorCaller: Address;\n}\n\n/**\n * Description placeholder\n *\n * @export\n * @interface SignerValidatorValidatePayload\n * @typedef {SignerValidatorValidatePayload}\n */\nexport interface SignerValidatorValidatePayload {\n /**\n * The ID of the boost.\n *\n * @type {bigint}\n */\n boostId: bigint;\n /**\n * The ID of the incentive.\n *\n * @type {bigint}\n */\n incentiveId: bigint;\n /**\n * The address of the claimant.\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The claim data.\n *\n * @type {Hex}\n */\n claimData: Hex;\n}\n\n/**\n * Signer Validator Claim Data Payload\n *\n * @export\n * @interface SignerValidatorClaimDataParams\n * @typedef {SignerValidatorClaimDataParams}\n */\nexport interface SignerValidatorClaimDataParams {\n /**\n * The signer with which to sign the input\n *\n * @type {{\n * account: Address;\n * key: Hex;\n * privateKey: PrivateKeyAccount;\n * }}\n */\n signer: {\n account: Address;\n key: Hex;\n privateKey: PrivateKeyAccount;\n };\n /**\n * The encoded data to provide the underlying incentive. You can use {@link prepareAllowListIncentivePayload}, {@link prepareCGDAIncentivePayload}, {@link prepareERC20IncentivePayload}, {@link prepareERC1155IncentivePayload}, or {@link preparePointsIncentivePayload}\n *\n * @type {Hex}\n */\n incentiveData: Hex;\n /**\n * The chain id to target\n *\n * @type {number}\n */\n chainId: number;\n /**\n * The address of the validator\n *\n * @type {Address}\n */\n validator: Address;\n /**\n * The incentive quantity.\n *\n * @type {number}\n */\n incentiveQuantity: number;\n /**\n * The address of the claimant\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The ID of the boost\n *\n * @type {bigint}\n */\n boostId: bigint;\n}\n\n/**\n * Object representation of a {@link SignerValidatorInputParams} initialization payload\n *\n * @export\n * @interface SignerValidatorInputParams\n * @typedef {SignerValidatorInputParams}\n */\nexport interface SignerValidatorInputParams {\n /**\n * The signer address.\n *\n * @type {Address}\n */\n signer: Address;\n\n /**\n * The signature data.\n *\n * @type {string}\n */\n signature: Hex;\n\n /**\n * The incentive quantity.\n *\n * @type {number}\n */\n incentiveQuantity: number;\n}\n\n/**\n * Object representing the payload for signing before validaton.\n *\n * @export\n * @interface SignerValidatorSignaturePayload\n * @typedef {SignerValidatorSignaturePayload}\n */\nexport interface SignerValidatorSignaturePayload {\n /**\n * The ID of the boost.\n *\n * @type {bigint}\n */\n boostId: bigint;\n /**\n * The ID of the incentive.\n *\n * @type {number}\n */\n incentiveQuantity: number;\n /**\n * The address of the claimant.\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The claim data.\n *\n * @type {Hex}\n */\n incentiveData: Hex;\n}\n\n/**\n * A generic `viem.Log` event with support for `BoostCore` event types.\n *\n * @export\n * @typedef {SignerValidatorLog}\n * @template {ContractEventName<\n * typeof signerValidatorAbi\n * >} [event=ContractEventName<typeof signerValidatorAbi>]\n */\nexport type SignerValidatorLog<\n event extends ContractEventName<\n typeof signerValidatorAbi\n > = ContractEventName<typeof signerValidatorAbi>,\n> = GenericLog<typeof signerValidatorAbi, event>;\n\n/**\n * A simple implementation of a Validator that verifies a given signature and checks the recovered address against a set of authorized signers\n *\n * @export\n * @class SignerValidator\n * @typedef {SignerValidator}\n * @extends {DeployableTarget<SignerValidatorPayload>}\n */\nexport class SignerValidator extends DeployableTarget<\n SignerValidatorPayload,\n typeof signerValidatorAbi\n> {\n /**\n * @inheritdoc\n *\n * @public\n * @readonly\n * @type {*}\n */\n public override readonly abi = signerValidatorAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n ...(SignerValidatorBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.VALIDATOR;\n\n /**\n * The set of authorized signers\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async signers(\n address: Address,\n params?: ReadParams<typeof signerValidatorAbi, 'signers'>,\n ) {\n return await readSignerValidatorSigners(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Retrieve the hash and signer data for a given hash\n *\n * @public\n * @async\n * @param {SignerValidatorSignaturePayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<Hex>}\n */\n public async hashSignerData(\n payload: SignerValidatorSignaturePayload,\n params?: ReadParams<typeof signerValidatorAbi, 'hashSignerData'>,\n ) {\n return await readSignerValidatorHashSignerData(this._config, {\n address: this.assertValidAddress(),\n args: [\n payload.boostId,\n payload.incentiveQuantity,\n payload.claimant,\n payload.incentiveData,\n ],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * 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.\n *\n * @public\n * @async\n * @param {SignerValidatorValidatePayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the action has been validated based on the data payload\n */\n protected async validate(\n payload: SignerValidatorValidatePayload,\n params?: WriteParams<typeof signerValidatorAbi, 'validate'>,\n ) {\n return await this.awaitResult(this.validateRaw(payload, params));\n }\n\n /**\n * 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.\n *\n * @public\n * @async\n * @param {SignerValidatorValidatePayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the action has been validated based on the data payload\n */\n protected async validateRaw(\n payload: SignerValidatorValidatePayload,\n params?: ReadParams<typeof signerValidatorAbi, 'validate'>,\n ) {\n const { request, result } = await simulateSignerValidatorValidate(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [\n payload.boostId,\n payload.incentiveId,\n payload.claimant,\n payload.claimData,\n ],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorValidate(this._config, request);\n return { hash, result };\n }\n\n /**\n * Set the authorized status of a signer\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of signers to update\n * @param {boolean[]} allowed - The authorized status of each signer\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof signerValidatorAbi, 'setAuthorized'>,\n ) {\n return await this.awaitResult(\n this.setAuthorizedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the authorized status of a signer\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of signers to update\n * @param {boolean[]} allowed - The authorized status of each signer\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof signerValidatorAbi, 'setAuthorized'>,\n ) {\n const { request, result } = await simulateSignerValidatorSetAuthorized(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Update the authorized caller of the validator function\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async setValidatorCallerRaw(\n address: Address,\n params?: WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>,\n ) {\n const { request, result } = await simulateSignerValidatorSetValidatorCaller(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [address],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorSetValidatorCaller(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Update the authorized caller of the validator function\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setValidatorCaller(\n address: Address,\n params?: WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>,\n ) {\n return await this.awaitResult(this.setValidatorCallerRaw(address, params));\n }\n\n /**\n * Properly encodes the data needed to claim\n *\n * @public\n * @async\n * @param {SignerValidatorClaimDataParams} params\n * @returns {Promise<Hex>}\n */\n public async encodeClaimData(\n params: Omit<SignerValidatorClaimDataParams, 'validator'>,\n ): Promise<Hex> {\n return await prepareSignerValidatorClaimDataPayload({\n ...params,\n validator: this.assertValidAddress(),\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?SignerValidatorPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: SignerValidatorPayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: signerValidatorAbi,\n bytecode: bytecode as Hex,\n args: [prepareSignerValidatorPayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Signer Validator Claim Data Payload Preparation\n *\n * @export\n * @async\n * @param {SignerValidatorClaimDataParams} param0\n * @param {{ account: Address; key: Hex; privateKey: PrivateKeyAccount; }} param0.signer\n * @param {Hex} param0.incentiveData\n * @param {number} param0.chainId\n * @param {Address} param0.validator\n * @param {number} param0.incentiveQuantity\n * @param {Address} param0.claimant\n * @param {bigint} param0.boostId\n * @returns {Promise<Hex>}\n */\nexport async function prepareSignerValidatorClaimDataPayload({\n signer,\n incentiveData,\n chainId,\n validator,\n incentiveQuantity,\n claimant,\n boostId,\n}: SignerValidatorClaimDataParams): Promise<Hex> {\n const domain = {\n name: 'SignerValidator',\n version: '1',\n chainId: chainId,\n verifyingContract: validator,\n };\n const typedData = {\n domain,\n types: {\n SignerValidatorData: [\n { name: 'boostId', type: 'uint256' },\n { name: 'incentiveQuantity', type: 'uint8' },\n { name: 'claimant', type: 'address' },\n { name: 'incentiveData', type: 'bytes' },\n ],\n },\n primaryType: 'SignerValidatorData' as const,\n message: {\n boostId,\n incentiveQuantity,\n claimant,\n incentiveData: incentiveData,\n },\n };\n\n const trustedSignature = await signTypedData({\n ...typedData,\n privateKey: signer.key,\n });\n\n // Prepare the claim data payload using the new helper\n const validatorData = prepareSignerValidatorInputParams({\n signer: signer.account,\n signature: trustedSignature,\n incentiveQuantity, // Adjust incentive quantity as necessary\n });\n\n const boostClaimDataPayload = encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n [{ validatorData, incentiveData }],\n );\n\n return boostClaimDataPayload;\n}\n\n/**\n * Given a {@link SignerValidatorInputParams}, properly encode the initialization payload.\n *\n * @param {SignerValidatorInputParams} param0\n * @param {Address} param0.signer\n * @param {Hex} param0.signature\n * @param {number} param0.incentiveQuantity\n * @returns {Hex}\n */\nexport function prepareSignerValidatorInputParams({\n signer,\n signature,\n incentiveQuantity,\n}: SignerValidatorInputParams) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'SignerValidatorInputParams',\n components: [\n { type: 'address', name: 'signer' },\n { type: 'bytes', name: 'signature' },\n { type: 'uint8', name: 'incentiveQuantity' },\n ],\n },\n ],\n [{ signer, signature, incentiveQuantity }],\n );\n}\n\n/**\n * Given a {@link SignerValidatorPayload}, properly encode the initialization payload.\n *\n * @param {SignerValidatorPayload} param0\n * @param {Address[]} param0.signers\n * @param {Address} param0.validatorCaller\n * @returns {Hex}\n */\nexport function prepareSignerValidatorPayload({\n signers,\n validatorCaller,\n}: SignerValidatorPayload) {\n return encodeAbiParameters(\n [\n { type: 'address[]', name: 'signers' },\n { type: 'address', name: 'validatorCaller' },\n ],\n [signers, validatorCaller],\n );\n}\n"],"names":["_SignerValidator","DeployableTarget","signerValidatorAbi","address","params","readSignerValidatorSigners","payload","readSignerValidatorHashSignerData","request","result","simulateSignerValidatorValidate","writeSignerValidatorValidate","addresses","allowed","simulateSignerValidatorSetAuthorized","writeSignerValidatorSetAuthorized","simulateSignerValidatorSetValidatorCaller","writeSignerValidatorSetValidatorCaller","prepareSignerValidatorClaimDataPayload","_payload","_options","options","bytecode","prepareSignerValidatorPayload","SignerValidatorBases","RegistryType","SignerValidator","signer","incentiveData","chainId","validator","incentiveQuantity","claimant","boostId","typedData","trustedSignature","signTypedData","validatorData","prepareSignerValidatorInputParams","encodeAbiParameters","signature","signers","validatorCaller"],"mappings":"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"}
|
|
@@ -603,8 +603,8 @@ export declare class SignerValidator extends DeployableTarget<SignerValidatorPay
|
|
|
603
603
|
* @public
|
|
604
604
|
* @async
|
|
605
605
|
* @param {Address} address
|
|
606
|
-
* @param {?ReadParams
|
|
607
|
-
* @returns {
|
|
606
|
+
* @param {?ReadParams} [params]
|
|
607
|
+
* @returns {Promise<boolean>}
|
|
608
608
|
*/
|
|
609
609
|
signers(address: Address, params?: ReadParams<typeof signerValidatorAbi, 'signers'>): Promise<boolean>;
|
|
610
610
|
/**
|
|
@@ -613,8 +613,8 @@ export declare class SignerValidator extends DeployableTarget<SignerValidatorPay
|
|
|
613
613
|
* @public
|
|
614
614
|
* @async
|
|
615
615
|
* @param {SignerValidatorSignaturePayload} payload
|
|
616
|
-
* @param {?ReadParams
|
|
617
|
-
* @returns {
|
|
616
|
+
* @param {?ReadParams} [params]
|
|
617
|
+
* @returns {Promise<Hex>}
|
|
618
618
|
*/
|
|
619
619
|
hashSignerData(payload: SignerValidatorSignaturePayload, params?: ReadParams<typeof signerValidatorAbi, 'hashSignerData'>): Promise<`0x${string}`>;
|
|
620
620
|
/**
|
|
@@ -623,7 +623,7 @@ export declare class SignerValidator extends DeployableTarget<SignerValidatorPay
|
|
|
623
623
|
* @public
|
|
624
624
|
* @async
|
|
625
625
|
* @param {SignerValidatorValidatePayload} payload
|
|
626
|
-
* @param {?WriteParams
|
|
626
|
+
* @param {?WriteParams} [params]
|
|
627
627
|
* @returns {Promise<boolean>} - True if the action has been validated based on the data payload
|
|
628
628
|
*/
|
|
629
629
|
protected validate(payload: SignerValidatorValidatePayload, params?: WriteParams<typeof signerValidatorAbi, 'validate'>): Promise<boolean>;
|
|
@@ -633,7 +633,7 @@ export declare class SignerValidator extends DeployableTarget<SignerValidatorPay
|
|
|
633
633
|
* @public
|
|
634
634
|
* @async
|
|
635
635
|
* @param {SignerValidatorValidatePayload} payload
|
|
636
|
-
* @param {?WriteParams
|
|
636
|
+
* @param {?WriteParams} [params]
|
|
637
637
|
* @returns {Promise<boolean>} - True if the action has been validated based on the data payload
|
|
638
638
|
*/
|
|
639
639
|
protected validateRaw(payload: SignerValidatorValidatePayload, params?: ReadParams<typeof signerValidatorAbi, 'validate'>): Promise<{
|
|
@@ -647,8 +647,8 @@ export declare class SignerValidator extends DeployableTarget<SignerValidatorPay
|
|
|
647
647
|
* @async
|
|
648
648
|
* @param {Address[]} addresses - The list of signers to update
|
|
649
649
|
* @param {boolean[]} allowed - The authorized status of each signer
|
|
650
|
-
* @param {?WriteParams
|
|
651
|
-
* @returns {
|
|
650
|
+
* @param {?WriteParams} [params]
|
|
651
|
+
* @returns {Promise<void>}
|
|
652
652
|
*/
|
|
653
653
|
setAuthorized(addresses: Address[], allowed: boolean[], params?: WriteParams<typeof signerValidatorAbi, 'setAuthorized'>): Promise<void>;
|
|
654
654
|
/**
|
|
@@ -658,8 +658,8 @@ export declare class SignerValidator extends DeployableTarget<SignerValidatorPay
|
|
|
658
658
|
* @async
|
|
659
659
|
* @param {Address[]} addresses - The list of signers to update
|
|
660
660
|
* @param {boolean[]} allowed - The authorized status of each signer
|
|
661
|
-
* @param {?WriteParams
|
|
662
|
-
* @returns {
|
|
661
|
+
* @param {?WriteParams} [params]
|
|
662
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
663
663
|
*/
|
|
664
664
|
setAuthorizedRaw(addresses: Address[], allowed: boolean[], params?: WriteParams<typeof signerValidatorAbi, 'setAuthorized'>): Promise<{
|
|
665
665
|
hash: `0x${string}`;
|
|
@@ -671,8 +671,8 @@ export declare class SignerValidator extends DeployableTarget<SignerValidatorPay
|
|
|
671
671
|
* @public
|
|
672
672
|
* @async
|
|
673
673
|
* @param {Address} address
|
|
674
|
-
* @param {?WriteParams
|
|
675
|
-
* @returns {
|
|
674
|
+
* @param {?WriteParams} [params]
|
|
675
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
676
676
|
*/
|
|
677
677
|
setValidatorCallerRaw(address: Address, params?: WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>): Promise<{
|
|
678
678
|
hash: `0x${string}`;
|
|
@@ -684,8 +684,8 @@ export declare class SignerValidator extends DeployableTarget<SignerValidatorPay
|
|
|
684
684
|
* @public
|
|
685
685
|
* @async
|
|
686
686
|
* @param {Address} address
|
|
687
|
-
* @param {?WriteParams
|
|
688
|
-
* @returns {
|
|
687
|
+
* @param {?WriteParams} [params]
|
|
688
|
+
* @returns {Promise<void>}
|
|
689
689
|
*/
|
|
690
690
|
setValidatorCaller(address: Address, params?: WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>): Promise<void>;
|
|
691
691
|
/**
|