@boostxyz/sdk 0.0.0-alpha.2 → 0.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions/Action.cjs +2 -1
- package/dist/Actions/Action.cjs.map +1 -0
- package/dist/Actions/Action.d.ts +1 -1
- package/dist/Actions/Action.d.ts.map +1 -1
- package/dist/Actions/Action.js +14 -12
- package/dist/Actions/Action.js.map +1 -0
- package/dist/Actions/ContractAction.d.ts +57 -14
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +50 -23
- package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.cjs +2 -1
- package/dist/Actions/EventAction.cjs.map +1 -0
- package/dist/Actions/EventAction.d.ts +405 -36
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +15 -209
- package/dist/Actions/EventAction.js.map +1 -0
- package/dist/AllowLists/AllowList.cjs +2 -1
- package/dist/AllowLists/AllowList.cjs.map +1 -0
- package/dist/AllowLists/AllowList.d.ts +6 -5
- package/dist/AllowLists/AllowList.d.ts.map +1 -1
- package/dist/AllowLists/AllowList.js +46 -22
- package/dist/AllowLists/AllowList.js.map +1 -0
- package/dist/AllowLists/OpenAllowList.d.ts +423 -0
- package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
- package/dist/AllowLists/SimpleAllowList.cjs +2 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -0
- package/dist/AllowLists/SimpleAllowList.d.ts +124 -40
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +76 -76
- package/dist/AllowLists/SimpleAllowList.js.map +1 -0
- package/dist/AllowLists/SimpleDenyList.cjs +2 -1
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -0
- package/dist/AllowLists/SimpleDenyList.d.ts +234 -13
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +12 -200
- package/dist/AllowLists/SimpleDenyList.js.map +1 -0
- package/dist/Auth/Auth.cjs +1 -0
- package/dist/Auth/Auth.cjs.map +1 -0
- package/dist/Auth/Auth.js +1 -0
- package/dist/Auth/Auth.js.map +1 -0
- package/dist/Auth/PassthroughAuth.cjs +2 -1
- package/dist/Auth/PassthroughAuth.cjs.map +1 -0
- package/dist/Auth/PassthroughAuth.js +5 -4
- package/dist/Auth/PassthroughAuth.js.map +1 -0
- package/dist/Boost.cjs +2 -1
- package/dist/Boost.cjs.map +1 -0
- package/dist/Boost.d.ts +105 -14
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js +138 -5
- package/dist/Boost.js.map +1 -0
- package/dist/BoostCore-DolmDuXW.cjs +3 -0
- package/dist/BoostCore-DolmDuXW.cjs.map +1 -0
- package/dist/BoostCore-Z97KVu4V.js +1448 -0
- package/dist/BoostCore-Z97KVu4V.js.map +1 -0
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -0
- package/dist/BoostCore.d.ts +788 -79
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +30 -1103
- package/dist/BoostCore.js.map +1 -0
- package/dist/BoostRegistry.cjs +2 -1
- package/dist/BoostRegistry.cjs.map +1 -0
- package/dist/BoostRegistry.d.ts +95 -26
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +183 -89
- package/dist/BoostRegistry.js.map +1 -0
- package/dist/Budgets/Budget.cjs +2 -1
- package/dist/Budgets/Budget.cjs.map +1 -0
- package/dist/Budgets/Budget.d.ts +1 -1
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +15 -13
- package/dist/Budgets/Budget.js.map +1 -0
- package/dist/Budgets/ManagedBudget.cjs +2 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -0
- package/dist/Budgets/ManagedBudget.d.ts +112 -192
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +91 -291
- package/dist/Budgets/ManagedBudget.js.map +1 -0
- package/dist/Budgets/VestingBudget.d.ts +277 -91
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/Contract.cjs +2 -1
- package/dist/Deployable/Contract.cjs.map +1 -0
- package/dist/Deployable/Contract.d.ts +4 -5
- package/dist/Deployable/Contract.d.ts.map +1 -1
- package/dist/Deployable/Contract.js +7 -8
- package/dist/Deployable/Contract.js.map +1 -0
- package/dist/Deployable/Deployable.cjs +1 -0
- package/dist/Deployable/Deployable.cjs.map +1 -0
- package/dist/Deployable/Deployable.d.ts +9 -3
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +10 -5
- package/dist/Deployable/Deployable.js.map +1 -0
- package/dist/Deployable/DeployableTarget.cjs +2 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -0
- package/dist/Deployable/DeployableTarget.d.ts +16 -15
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +49 -42
- package/dist/Deployable/DeployableTarget.js.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
- package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts +179 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
- package/dist/EventAction-CBKzuNoN.cjs +2 -0
- package/dist/EventAction-CBKzuNoN.cjs.map +1 -0
- package/dist/EventAction-DWuuc_Qy.js +1528 -0
- package/dist/EventAction-DWuuc_Qy.js.map +1 -0
- package/dist/Incentive-BxzEtN26.js +298 -0
- package/dist/Incentive-BxzEtN26.js.map +1 -0
- package/dist/Incentive-CrF3-ayL.cjs +2 -0
- package/dist/Incentive-CrF3-ayL.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +2 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.d.ts +65 -21
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +52 -36
- package/dist/Incentives/AllowListIncentive.js.map +1 -0
- package/dist/Incentives/CGDAIncentive.cjs +2 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -0
- package/dist/Incentives/CGDAIncentive.d.ts +315 -26
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +64 -39
- package/dist/Incentives/CGDAIncentive.js.map +1 -0
- package/dist/Incentives/ERC1155Incentive.d.ts +291 -43
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +2 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -0
- package/dist/Incentives/ERC20Incentive.d.ts +270 -33
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +69 -46
- package/dist/Incentives/ERC20Incentive.js.map +1 -0
- package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +338 -421
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +262 -32
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.cjs +2 -1
- package/dist/Incentives/Incentive.cjs.map +1 -0
- package/dist/Incentives/Incentive.d.ts +5 -8
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +17 -278
- package/dist/Incentives/Incentive.js.map +1 -0
- package/dist/Incentives/PointsIncentive.cjs +2 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -0
- package/dist/Incentives/PointsIncentive.d.ts +81 -23
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +57 -36
- package/dist/Incentives/PointsIncentive.js.map +1 -0
- package/dist/SimpleDenyList-BUR17Tt1.cjs +2 -0
- package/dist/SimpleDenyList-BUR17Tt1.cjs.map +1 -0
- package/dist/SimpleDenyList-CGaWjuld.js +132 -0
- package/dist/SimpleDenyList-CGaWjuld.js.map +1 -0
- package/dist/Validators/SignerValidator.cjs +2 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -0
- package/dist/Validators/SignerValidator.d.ts +310 -17
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +165 -36
- package/dist/Validators/SignerValidator.js.map +1 -0
- package/dist/Validators/Validator.cjs +2 -1
- package/dist/Validators/Validator.cjs.map +1 -0
- package/dist/Validators/Validator.d.ts +2 -2
- package/dist/Validators/Validator.d.ts.map +1 -1
- package/dist/Validators/Validator.js +10 -8
- package/dist/Validators/Validator.js.map +1 -0
- package/dist/claiming.cjs +2 -0
- package/dist/claiming.cjs.map +1 -0
- package/dist/claiming.d.ts +43 -0
- package/dist/claiming.d.ts.map +1 -0
- package/dist/claiming.js +17 -0
- package/dist/claiming.js.map +1 -0
- package/dist/componentInterfaces-BBCFkrZv.js +14 -0
- package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
- package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
- package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
- package/dist/deployments-DVXioW2i.cjs +2 -0
- package/dist/deployments-DVXioW2i.cjs.map +1 -0
- package/dist/deployments-oykLv3_Z.js +43 -0
- package/dist/deployments-oykLv3_Z.js.map +1 -0
- package/dist/deployments.json +44 -0
- package/dist/errors.cjs +2 -1
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.ts +421 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +297 -39
- package/dist/errors.js.map +1 -0
- package/dist/{generated-x_abr3Yv.js → generated-CKt2yCQd.js} +3143 -3002
- package/dist/generated-CKt2yCQd.js.map +1 -0
- package/dist/generated-CyTNlOwM.cjs +3 -0
- package/dist/generated-CyTNlOwM.cjs.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +144 -1353
- package/dist/index.js.map +1 -0
- package/dist/transfers.cjs +2 -0
- package/dist/transfers.cjs.map +1 -0
- package/dist/transfers.d.ts +198 -0
- package/dist/transfers.d.ts.map +1 -0
- package/dist/transfers.js +84 -0
- package/dist/transfers.js.map +1 -0
- package/dist/utils.cjs +2 -1
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +26 -1350
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -636
- package/dist/utils.js.map +1 -0
- package/package.json +37 -11
- package/src/Actions/Action.test.ts +79 -0
- package/src/Actions/Action.ts +61 -0
- package/src/Actions/ContractAction.test.ts +197 -0
- package/src/Actions/ContractAction.ts +300 -0
- package/src/Actions/ERC721MintAction.test.ts +112 -0
- package/src/Actions/ERC721MintAction.ts +291 -0
- package/src/Actions/EventAction.test.ts +787 -0
- package/src/Actions/EventAction.ts +1218 -0
- package/src/AllowLists/AllowList.test.ts +64 -0
- package/src/AllowLists/AllowList.ts +62 -0
- package/src/AllowLists/OpenAllowList.test.ts +40 -0
- package/src/AllowLists/OpenAllowList.ts +45 -0
- package/src/AllowLists/SimpleAllowList.test.ts +52 -0
- package/src/AllowLists/SimpleAllowList.ts +262 -0
- package/src/AllowLists/SimpleDenyList.test.ts +52 -0
- package/src/AllowLists/SimpleDenyList.ts +250 -0
- package/src/Auth/Auth.ts +11 -0
- package/src/Auth/PassthroughAuth.test.ts +12 -0
- package/src/Auth/PassthroughAuth.ts +80 -0
- package/src/Boost.ts +287 -0
- package/src/BoostCore.test.ts +894 -0
- package/src/BoostCore.ts +1438 -0
- package/src/BoostRegistry.test.ts +53 -0
- package/src/BoostRegistry.ts +588 -0
- package/src/Budgets/Budget.test.ts +27 -0
- package/src/Budgets/Budget.ts +60 -0
- package/src/Budgets/ManagedBudget.test.ts +217 -0
- package/src/Budgets/ManagedBudget.ts +534 -0
- package/src/Budgets/VestingBudget.test.ts +123 -0
- package/src/Budgets/VestingBudget.ts +530 -0
- package/src/Deployable/Contract.ts +228 -0
- package/src/Deployable/Deployable.ts +250 -0
- package/src/Deployable/DeployableTarget.ts +234 -0
- package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
- package/src/Incentives/AllowListIncentive.test.ts +143 -0
- package/src/Incentives/AllowListIncentive.ts +336 -0
- package/src/Incentives/CGDAIncentive.test.ts +135 -0
- package/src/Incentives/CGDAIncentive.ts +476 -0
- package/src/Incentives/ERC1155Incentive.test.ts +87 -0
- package/src/Incentives/ERC1155Incentive.ts +465 -0
- package/src/Incentives/ERC20Incentive.test.ts +133 -0
- package/src/Incentives/ERC20Incentive.ts +490 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +309 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +139 -0
- package/src/Incentives/ERC20VariableIncentive.ts +428 -0
- package/src/Incentives/Incentive.test.ts +95 -0
- package/src/Incentives/Incentive.ts +86 -0
- package/src/Incentives/PointsIncentive.test.ts +138 -0
- package/src/Incentives/PointsIncentive.ts +367 -0
- package/src/Validators/SignerValidator.test.ts +159 -0
- package/src/Validators/SignerValidator.ts +683 -0
- package/src/Validators/Validator.test.ts +21 -0
- package/src/Validators/Validator.ts +55 -0
- package/src/claiming.ts +56 -0
- package/src/errors.ts +866 -0
- package/src/index.test.ts +122 -0
- package/src/index.ts +58 -0
- package/src/transfers.ts +284 -0
- package/src/utils.test.ts +44 -0
- package/src/utils.ts +247 -0
- package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
- package/dist/generated-BaaleHW-.cjs +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../generated-CyTNlOwM.cjs"),c=require("./DeployableTarget.cjs");var n=(i=>(i[i.MANAGER=1n]="MANAGER",i[i.ADMIN=2n]="ADMIN",i))(n||{});class l extends c.DeployableTarget{async setAuthorized(t,s,a){return await this.awaitResult(this.setAuthorizedRaw(t,s,a))}async setAuthorizedRaw(t,s,a){const{request:r,result:o}=await e.CM(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.TM(this._config,r),result:o}}async grantRoles(t,s,a){return await this.awaitResult(this.grantRolesRaw(t,s,a))}async grantRolesRaw(t,s,a){const{request:r,result:o}=await e.gM(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.mM(this._config,r),result:o}}async revokeRoles(t,s,a){return await this.awaitResult(this.revokeRolesRaw(t,s,a))}async revokeRolesRaw(t,s,a){const{request:r,result:o}=await e.EM(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.wM(this._config,r),result:o}}async rolesOf(t,s){const a=await e.lM(this._config,{address:this.assertValidAddress(),args:[t],...this.optionallyAttachAccount(),...s});return[n.MANAGER,n.ADMIN].filter(r=>(a&r)===r)}hasAnyRole(t,s,a){return e.rM(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a})}hasAllRoles(t,s,a){return e.sM(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a})}isAuthorized(t,s){return e.oM(this._config,{address:this.assertValidAddress(),args:[t],...this.optionallyAttachAccount(),...s})}}exports.rbacAbi=e.z;exports.DeployableTargetWithRBAC=l;exports.Roles=n;
|
|
2
|
+
//# sourceMappingURL=DeployableTargetWithRBAC.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployableTargetWithRBAC.cjs","sources":["../../src/Deployable/DeployableTargetWithRBAC.ts"],"sourcesContent":["import {\n rbacAbi,\n readRbacHasAllRoles,\n readRbacHasAnyRole,\n readRbacIsAuthorized,\n readRbacRolesOf,\n simulateRbacGrantRoles,\n simulateRbacRevokeRoles,\n simulateRbacSetAuthorized,\n writeRbacGrantRoles,\n writeRbacRevokeRoles,\n writeRbacSetAuthorized,\n} from '@boostxyz/evm';\nimport type { Abi, Address, ContractEventName } from 'viem';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport type { GenericLog, ReadParams, WriteParams } from '../utils';\nexport { rbacAbi };\n\n/**\n * Enum representing available roles for use with the `RBAC` authorization scheme.\n * `MANAGER` has lowest level of write permissions, for specific implementations, see Budgets and ALlowLists\n * `ADMIN` can additionally manage authorized users on the contract.\n *\n * @export\n * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}\n * @enum {bigint}\n */\nexport enum Roles {\n //@ts-expect-error ts doesn't like bigint enum values\n MANAGER = 1n,\n //@ts-expect-error ts doesn't like bigint enum values\n ADMIN = 2n,\n}\n\n/**\n * A generic `viem.Log` event with support for `Rbac` event types.\n *\n * @export\n * @typedef {RBACLog}\n * @template {ContractEventName<typeof rbacAbi>} [event=ContractEventName<\n * typeof rbacAbi\n * >]\n */\nexport type RBACLog<\n event extends ContractEventName<typeof rbacAbi> = ContractEventName<\n typeof rbacAbi\n >,\n> = GenericLog<typeof rbacAbi, event>;\n\n/**\n * A minimal RBAC implementation that offers MANAGER and ADMIN roles, and\n * Budgets and allowlists support this auth scheme\n *\n * @export\n * @class DeployableTargetWithRBAC\n * @typedef {DeployableTargetWithRBAC}\n * @extends {DeployableTarget<RbacPayload>}\n */\nexport class DeployableTargetWithRBAC<\n Payload,\n ABI extends Abi,\n> extends DeployableTarget<Payload, ABI> {\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof rbacAbi, 'setAuthorized'>,\n ) {\n return await this.awaitResult(\n this.setAuthorizedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof rbacAbi, 'setAuthorized'>,\n ) {\n const { request, result } = await simulateRbacSetAuthorized(this._config, {\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 const hash = await writeRbacSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async grantRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n return await this.awaitResult(this.grantRolesRaw(addresses, roles, params));\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n const { request, result } = await simulateRbacGrantRoles(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, roles],\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 const hash = await writeRbacGrantRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n return await this.awaitResult(\n this.revokeRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n const { request, result } = await simulateRbacRevokeRoles(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, roles],\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 const hash = await writeRbacRevokeRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Return an array of the roles assigned to the given account.\n * @example\n * ```ts\n * (await rbac.rolesOf(0xfoo)).includes(RbacRoles.ADMIN)\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<Array<RbacRoles>>}\n */\n public async rolesOf(\n account: Address,\n params?: ReadParams<typeof rbacAbi, 'rolesOf'>,\n ) {\n const roles = await readRbacRolesOf(this._config, {\n address: this.assertValidAddress(),\n args: [account],\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 return ([Roles.MANAGER, Roles.ADMIN] as unknown as Array<bigint>).filter(\n (role) => (roles & role) === role,\n ) as unknown as Roles[];\n }\n\n /**\n * Returns whether given account has any of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAnyRole(0xfoo, RbacRoles.ADMIN | RbacRoles.MANAGER)\n * @public\n * @param {Address} account\n * @param {RbacRoles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAnyRole(\n account: Address,\n roles: Roles,\n params?: ReadParams<typeof rbacAbi, 'hasAnyRole'>,\n ) {\n return readRbacHasAnyRole(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\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 * Returns whether given account has all of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAllRoles(0xfoo, RbacRoles.ADMIN & RbacRoles.MANAGER)\n *\n * @public\n * @param {Address} account\n * @param {RbacRoles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAllRoles(\n account: Address,\n roles: Roles,\n params?: ReadParams<typeof rbacAbi, 'hasAllRoles'>,\n ) {\n return readRbacHasAllRoles(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\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 * Check if the given account is authorized to use the rbac\n *\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the account is authorized\n */\n public isAuthorized(\n account: Address,\n params?: ReadParams<typeof rbacAbi, 'isAuthorized'>,\n ) {\n return readRbacIsAuthorized(this._config, {\n address: this.assertValidAddress(),\n args: [account],\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"],"names":["Roles","DeployableTargetWithRBAC","DeployableTarget","addresses","allowed","params","request","result","simulateRbacSetAuthorized","writeRbacSetAuthorized","roles","simulateRbacGrantRoles","writeRbacGrantRoles","simulateRbacRevokeRoles","writeRbacRevokeRoles","account","readRbacRolesOf","role","readRbacHasAnyRole","readRbacHasAllRoles","readRbacIsAuthorized"],"mappings":"iKA2BY,IAAAA,GAAAA,IAEVA,EAAAA,EAAA,QAAU,EAAV,EAAA,UAEAA,EAAAA,EAAA,MAAQ,EAAR,EAAA,QAJUA,IAAAA,GAAA,CAAA,CAAA,EA+BL,MAAMC,UAGHC,EAAAA,gBAA+B,CAYvC,MAAa,cACXC,EACAC,EACAC,EACA,CACA,OAAO,MAAM,KAAK,YAChB,KAAK,iBAAiBF,EAAWC,EAASC,CAAM,CAAA,CAEpD,CAaA,MAAa,iBACXF,EACAC,EACAC,EACA,CACA,KAAM,CAAE,QAAAC,EAAS,OAAAC,CAAA,EAAW,MAAMC,EAAA,GAA0B,KAAK,QAAS,CACxE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACL,EAAWC,CAAO,EACzB,GAAG,KAAK,wBAAwB,EAEhC,GAAIC,CAAA,CACL,EAEM,MAAA,CAAE,KADI,MAAMI,EAAuB,GAAA,KAAK,QAASH,CAAO,EAChD,OAAAC,EACjB,CAgBA,MAAa,WACXJ,EACAO,EACAL,EACA,CACO,OAAA,MAAM,KAAK,YAAY,KAAK,cAAcF,EAAWO,EAAOL,CAAM,CAAC,CAC5E,CAgBA,MAAa,cACXF,EACAO,EACAL,EACA,CACA,KAAM,CAAE,QAAAC,EAAS,OAAAC,CAAA,EAAW,MAAMI,EAAA,GAAuB,KAAK,QAAS,CACrE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACR,EAAWO,CAAK,EACvB,GAAG,KAAK,wBAAwB,EAEhC,GAAIL,CAAA,CACL,EAMM,MAAA,CAAE,KALI,MAAMO,EAAA,GACjB,KAAK,QAELN,CAAA,EAEa,OAAAC,EACjB,CAgBA,MAAa,YACXJ,EACAO,EACAL,EACA,CACA,OAAO,MAAM,KAAK,YAChB,KAAK,eAAeF,EAAWO,EAAOL,CAAM,CAAA,CAEhD,CAeA,MAAa,eACXF,EACAO,EACAL,EACA,CACA,KAAM,CAAE,QAAAC,EAAS,OAAAC,CAAA,EAAW,MAAMM,EAAA,GAAwB,KAAK,QAAS,CACtE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACV,EAAWO,CAAK,EACvB,GAAG,KAAK,wBAAwB,EAEhC,GAAIL,CAAA,CACL,EAMM,MAAA,CAAE,KALI,MAAMS,EAAA,GACjB,KAAK,QAELR,CAAA,EAEa,OAAAC,EACjB,CAYA,MAAa,QACXQ,EACAV,EACA,CACA,MAAMK,EAAQ,MAAMM,KAAgB,KAAK,QAAS,CAChD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACD,CAAO,EACd,GAAG,KAAK,wBAAwB,EAEhC,GAAIV,CAAA,CACL,EACD,MAAQ,CAACL,EAAM,QAASA,EAAM,KAAK,EAA+B,OAC/DiB,IAAUP,EAAQO,KAAUA,CAAA,CAEjC,CAcO,WACLF,EACAL,EACAL,EACA,CACO,OAAAa,EAAA,GAAmB,KAAK,QAAS,CACtC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACH,EAASL,CAAK,EACrB,GAAG,KAAK,wBAAwB,EAEhC,GAAIL,CAAA,CACL,CACH,CAeO,YACLU,EACAL,EACAL,EACA,CACO,OAAAc,EAAA,GAAoB,KAAK,QAAS,CACvC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACJ,EAASL,CAAK,EACrB,GAAG,KAAK,wBAAwB,EAEhC,GAAIL,CAAA,CACL,CACH,CAUO,aACLU,EACAV,EACA,CACO,OAAAe,EAAA,GAAqB,KAAK,QAAS,CACxC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACL,CAAO,EACd,GAAG,KAAK,wBAAwB,EAEhC,GAAIV,CAAA,CACL,CACH,CACF"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { rbacAbi } from '@boostxyz/evm';
|
|
2
|
+
import type { Abi, Address, ContractEventName } from 'viem';
|
|
3
|
+
import { DeployableTarget } from '../Deployable/DeployableTarget';
|
|
4
|
+
import type { GenericLog, ReadParams, WriteParams } from '../utils';
|
|
5
|
+
export { rbacAbi };
|
|
6
|
+
/**
|
|
7
|
+
* Enum representing available roles for use with the `RBAC` authorization scheme.
|
|
8
|
+
* `MANAGER` has lowest level of write permissions, for specific implementations, see Budgets and ALlowLists
|
|
9
|
+
* `ADMIN` can additionally manage authorized users on the contract.
|
|
10
|
+
*
|
|
11
|
+
* @export
|
|
12
|
+
* @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}
|
|
13
|
+
* @enum {bigint}
|
|
14
|
+
*/
|
|
15
|
+
export declare enum Roles {
|
|
16
|
+
MANAGER,
|
|
17
|
+
ADMIN
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A generic `viem.Log` event with support for `Rbac` event types.
|
|
21
|
+
*
|
|
22
|
+
* @export
|
|
23
|
+
* @typedef {RBACLog}
|
|
24
|
+
* @template {ContractEventName<typeof rbacAbi>} [event=ContractEventName<
|
|
25
|
+
* typeof rbacAbi
|
|
26
|
+
* >]
|
|
27
|
+
*/
|
|
28
|
+
export type RBACLog<event extends ContractEventName<typeof rbacAbi> = ContractEventName<typeof rbacAbi>> = GenericLog<typeof rbacAbi, event>;
|
|
29
|
+
/**
|
|
30
|
+
* A minimal RBAC implementation that offers MANAGER and ADMIN roles, and
|
|
31
|
+
* Budgets and allowlists support this auth scheme
|
|
32
|
+
*
|
|
33
|
+
* @export
|
|
34
|
+
* @class DeployableTargetWithRBAC
|
|
35
|
+
* @typedef {DeployableTargetWithRBAC}
|
|
36
|
+
* @extends {DeployableTarget<RbacPayload>}
|
|
37
|
+
*/
|
|
38
|
+
export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends DeployableTarget<Payload, ABI> {
|
|
39
|
+
/**
|
|
40
|
+
* Set the authorized status of the given accounts
|
|
41
|
+
* The mechanism for managing authorization is left to the implementing contract
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
* @async
|
|
45
|
+
* @param {Address[]} addresses - The accounts to authorize or deauthorize
|
|
46
|
+
* @param {boolean[]} allowed - The authorization status for the given accounts
|
|
47
|
+
* @param {?WriteParams} [params]
|
|
48
|
+
* @returns {Promise<void>}
|
|
49
|
+
*/
|
|
50
|
+
setAuthorized(addresses: Address[], allowed: boolean[], params?: WriteParams<typeof rbacAbi, 'setAuthorized'>): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Set the authorized status of the given accounts
|
|
53
|
+
* The mechanism for managing authorization is left to the implementing contract
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
* @async
|
|
57
|
+
* @param {Address[]} addresses - The accounts to authorize or deauthorize
|
|
58
|
+
* @param {boolean[]} allowed - The authorization status for the given accounts
|
|
59
|
+
* @param {?WriteParams} [params]
|
|
60
|
+
* @returns {Promise<void>}
|
|
61
|
+
*/
|
|
62
|
+
setAuthorizedRaw(addresses: Address[], allowed: boolean[], params?: WriteParams<typeof rbacAbi, 'setAuthorized'>): Promise<{
|
|
63
|
+
hash: `0x${string}`;
|
|
64
|
+
result: void;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Grant many accounts permissions on the rbac.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* await rbac.grantRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])
|
|
72
|
+
* ```
|
|
73
|
+
* @public
|
|
74
|
+
* @async
|
|
75
|
+
* @param {Address[]} addresses
|
|
76
|
+
* @param {RbacRoles[]} roles
|
|
77
|
+
* @param {?WriteParams} [params]
|
|
78
|
+
* @returns {Promise<void>}
|
|
79
|
+
*/
|
|
80
|
+
grantRoles(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'grantRoles'>): Promise<never>;
|
|
81
|
+
/**
|
|
82
|
+
* Grant many accounts permissions on the rbac.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* await rbac.grantRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])
|
|
87
|
+
*
|
|
88
|
+
* @public
|
|
89
|
+
* @async
|
|
90
|
+
* @param {Address[]} addresses
|
|
91
|
+
* @param {RbacRoles[]} roles
|
|
92
|
+
* @param {?WriteParams} [params]
|
|
93
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
94
|
+
*/
|
|
95
|
+
grantRolesRaw(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'grantRoles'>): Promise<{
|
|
96
|
+
hash: `0x${string}`;
|
|
97
|
+
result: never;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Revoke many accounts' permissions on the rbac.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])
|
|
105
|
+
*
|
|
106
|
+
* @public
|
|
107
|
+
* @async
|
|
108
|
+
* @param {Address[]} addresses
|
|
109
|
+
* @param {RbacRoles[]} roles
|
|
110
|
+
* @param {?WriteParams} [params]
|
|
111
|
+
* @returns {Promise<void>}
|
|
112
|
+
*/
|
|
113
|
+
revokeRoles(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'revokeRoles'>): Promise<never>;
|
|
114
|
+
/**
|
|
115
|
+
* Revoke many accounts' permissions on the rbac.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])
|
|
120
|
+
* @public
|
|
121
|
+
* @async
|
|
122
|
+
* @param {Address[]} addresses
|
|
123
|
+
* @param {RbacRoles[]} roles
|
|
124
|
+
* @param {?WriteParams} [params]
|
|
125
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
126
|
+
*/
|
|
127
|
+
revokeRolesRaw(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'revokeRoles'>): Promise<{
|
|
128
|
+
hash: `0x${string}`;
|
|
129
|
+
result: never;
|
|
130
|
+
}>;
|
|
131
|
+
/**
|
|
132
|
+
* Return an array of the roles assigned to the given account.
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* (await rbac.rolesOf(0xfoo)).includes(RbacRoles.ADMIN)
|
|
136
|
+
* @public
|
|
137
|
+
* @param {Address} account
|
|
138
|
+
* @param {?ReadParams} [params]
|
|
139
|
+
* @returns {Promise<Array<RbacRoles>>}
|
|
140
|
+
*/
|
|
141
|
+
rolesOf(account: Address, params?: ReadParams<typeof rbacAbi, 'rolesOf'>): Promise<Roles[]>;
|
|
142
|
+
/**
|
|
143
|
+
* Returns whether given account has any of the provided roles bitmap.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* await rbac.hasAnyRole(0xfoo, RbacRoles.ADMIN | RbacRoles.MANAGER)
|
|
148
|
+
* @public
|
|
149
|
+
* @param {Address} account
|
|
150
|
+
* @param {RbacRoles} roles
|
|
151
|
+
* @param {?ReadParams} [params]
|
|
152
|
+
* @returns {Promise<boolean>}
|
|
153
|
+
*/
|
|
154
|
+
hasAnyRole(account: Address, roles: Roles, params?: ReadParams<typeof rbacAbi, 'hasAnyRole'>): Promise<boolean>;
|
|
155
|
+
/**
|
|
156
|
+
* Returns whether given account has all of the provided roles bitmap.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* await rbac.hasAllRoles(0xfoo, RbacRoles.ADMIN & RbacRoles.MANAGER)
|
|
161
|
+
*
|
|
162
|
+
* @public
|
|
163
|
+
* @param {Address} account
|
|
164
|
+
* @param {RbacRoles} roles
|
|
165
|
+
* @param {?ReadParams} [params]
|
|
166
|
+
* @returns {Promise<boolean>}
|
|
167
|
+
*/
|
|
168
|
+
hasAllRoles(account: Address, roles: Roles, params?: ReadParams<typeof rbacAbi, 'hasAllRoles'>): Promise<boolean>;
|
|
169
|
+
/**
|
|
170
|
+
* Check if the given account is authorized to use the rbac
|
|
171
|
+
*
|
|
172
|
+
* @public
|
|
173
|
+
* @param {Address} account
|
|
174
|
+
* @param {?ReadParams} [params]
|
|
175
|
+
* @returns {Promise<boolean>} - True if the account is authorized
|
|
176
|
+
*/
|
|
177
|
+
isAuthorized(account: Address, params?: ReadParams<typeof rbacAbi, 'isAuthorized'>): Promise<boolean>;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=DeployableTargetWithRBAC.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployableTargetWithRBAC.d.ts","sourceRoot":"","sources":["../../src/Deployable/DeployableTargetWithRBAC.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAWR,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB;;;;;;;;GAQG;AACH,oBAAY,KAAK;IAEf,OAAY;IAEZ,KAAU;CACX;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,CACjB,KAAK,SAAS,iBAAiB,CAAC,OAAO,OAAO,CAAC,GAAG,iBAAiB,CACjE,OAAO,OAAO,CACf,IACC,UAAU,CAAC,OAAO,OAAO,EAAE,KAAK,CAAC,CAAC;AAEtC;;;;;;;;GAQG;AACH,qBAAa,wBAAwB,CACnC,OAAO,EACP,GAAG,SAAS,GAAG,CACf,SAAQ,gBAAgB,CAAC,OAAO,EAAE,GAAG,CAAC;IACtC;;;;;;;;;;OAUG;IACU,aAAa,CACxB,SAAS,EAAE,OAAO,EAAE,EACpB,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,OAAO,EAAE,eAAe,CAAC;IAOvD;;;;;;;;;;OAUG;IACU,gBAAgB,CAC3B,SAAS,EAAE,OAAO,EAAE,EACpB,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,OAAO,EAAE,eAAe,CAAC;;;;IAavD;;;;;;;;;;;;;OAaG;IACU,UAAU,CACrB,SAAS,EAAE,OAAO,EAAE,EACpB,KAAK,EAAE,KAAK,EAAE,EACd,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,OAAO,EAAE,YAAY,CAAC;IAKpD;;;;;;;;;;;;;OAaG;IACU,aAAa,CACxB,SAAS,EAAE,OAAO,EAAE,EACpB,KAAK,EAAE,KAAK,EAAE,EACd,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,OAAO,EAAE,YAAY,CAAC;;;;IAiBpD;;;;;;;;;;;;;OAaG;IACU,WAAW,CACtB,SAAS,EAAE,OAAO,EAAE,EACpB,KAAK,EAAE,KAAK,EAAE,EACd,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,OAAO,EAAE,aAAa,CAAC;IAOrD;;;;;;;;;;;;OAYG;IACU,cAAc,CACzB,SAAS,EAAE,OAAO,EAAE,EACpB,KAAK,EAAE,KAAK,EAAE,EACd,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,OAAO,EAAE,aAAa,CAAC;;;;IAiBrD;;;;;;;;;OASG;IACU,OAAO,CAClB,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,OAAO,EAAE,SAAS,CAAC;IAchD;;;;;;;;;;;OAWG;IACI,UAAU,CACf,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,OAAO,EAAE,YAAY,CAAC;IAWnD;;;;;;;;;;;;OAYG;IACI,WAAW,CAChB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,OAAO,EAAE,aAAa,CAAC;IAWpD;;;;;;;OAOG;IACI,YAAY,CACjB,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,OAAO,EAAE,cAAc,CAAC;CAUtD"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { C as n, e as c, h as l, m as d, E as A, j as u, l as g, r as w, s as R, o as y } from "../generated-CKt2yCQd.js";
|
|
2
|
+
import { z as N } from "../generated-CKt2yCQd.js";
|
|
3
|
+
import { DeployableTarget as M } from "./DeployableTarget.js";
|
|
4
|
+
var o = /* @__PURE__ */ ((i) => (i[i.MANAGER = 1n] = "MANAGER", i[i.ADMIN = 2n] = "ADMIN", i))(o || {});
|
|
5
|
+
class _ extends M {
|
|
6
|
+
/**
|
|
7
|
+
* Set the authorized status of the given accounts
|
|
8
|
+
* The mechanism for managing authorization is left to the implementing contract
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @async
|
|
12
|
+
* @param {Address[]} addresses - The accounts to authorize or deauthorize
|
|
13
|
+
* @param {boolean[]} allowed - The authorization status for the given accounts
|
|
14
|
+
* @param {?WriteParams} [params]
|
|
15
|
+
* @returns {Promise<void>}
|
|
16
|
+
*/
|
|
17
|
+
async setAuthorized(s, t, a) {
|
|
18
|
+
return await this.awaitResult(
|
|
19
|
+
this.setAuthorizedRaw(s, t, a)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Set the authorized status of the given accounts
|
|
24
|
+
* The mechanism for managing authorization is left to the implementing contract
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
* @async
|
|
28
|
+
* @param {Address[]} addresses - The accounts to authorize or deauthorize
|
|
29
|
+
* @param {boolean[]} allowed - The authorization status for the given accounts
|
|
30
|
+
* @param {?WriteParams} [params]
|
|
31
|
+
* @returns {Promise<void>}
|
|
32
|
+
*/
|
|
33
|
+
async setAuthorizedRaw(s, t, a) {
|
|
34
|
+
const { request: r, result: e } = await n(this._config, {
|
|
35
|
+
address: this.assertValidAddress(),
|
|
36
|
+
args: [s, t],
|
|
37
|
+
...this.optionallyAttachAccount(),
|
|
38
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
39
|
+
...a
|
|
40
|
+
});
|
|
41
|
+
return { hash: await c(this._config, r), result: e };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Grant many accounts permissions on the rbac.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* await rbac.grantRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])
|
|
49
|
+
* ```
|
|
50
|
+
* @public
|
|
51
|
+
* @async
|
|
52
|
+
* @param {Address[]} addresses
|
|
53
|
+
* @param {RbacRoles[]} roles
|
|
54
|
+
* @param {?WriteParams} [params]
|
|
55
|
+
* @returns {Promise<void>}
|
|
56
|
+
*/
|
|
57
|
+
async grantRoles(s, t, a) {
|
|
58
|
+
return await this.awaitResult(this.grantRolesRaw(s, t, a));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Grant many accounts permissions on the rbac.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* await rbac.grantRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
* @async
|
|
69
|
+
* @param {Address[]} addresses
|
|
70
|
+
* @param {RbacRoles[]} roles
|
|
71
|
+
* @param {?WriteParams} [params]
|
|
72
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
73
|
+
*/
|
|
74
|
+
async grantRolesRaw(s, t, a) {
|
|
75
|
+
const { request: r, result: e } = await l(this._config, {
|
|
76
|
+
address: this.assertValidAddress(),
|
|
77
|
+
args: [s, t],
|
|
78
|
+
...this.optionallyAttachAccount(),
|
|
79
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
80
|
+
...a
|
|
81
|
+
});
|
|
82
|
+
return { hash: await d(
|
|
83
|
+
this._config,
|
|
84
|
+
// biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
|
|
85
|
+
r
|
|
86
|
+
), result: e };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Revoke many accounts' permissions on the rbac.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
* @async
|
|
97
|
+
* @param {Address[]} addresses
|
|
98
|
+
* @param {RbacRoles[]} roles
|
|
99
|
+
* @param {?WriteParams} [params]
|
|
100
|
+
* @returns {Promise<void>}
|
|
101
|
+
*/
|
|
102
|
+
async revokeRoles(s, t, a) {
|
|
103
|
+
return await this.awaitResult(
|
|
104
|
+
this.revokeRolesRaw(s, t, a)
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Revoke many accounts' permissions on the rbac.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])
|
|
113
|
+
* @public
|
|
114
|
+
* @async
|
|
115
|
+
* @param {Address[]} addresses
|
|
116
|
+
* @param {RbacRoles[]} roles
|
|
117
|
+
* @param {?WriteParams} [params]
|
|
118
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
119
|
+
*/
|
|
120
|
+
async revokeRolesRaw(s, t, a) {
|
|
121
|
+
const { request: r, result: e } = await A(this._config, {
|
|
122
|
+
address: this.assertValidAddress(),
|
|
123
|
+
args: [s, t],
|
|
124
|
+
...this.optionallyAttachAccount(),
|
|
125
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
126
|
+
...a
|
|
127
|
+
});
|
|
128
|
+
return { hash: await u(
|
|
129
|
+
this._config,
|
|
130
|
+
// biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
|
|
131
|
+
r
|
|
132
|
+
), result: e };
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Return an array of the roles assigned to the given account.
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* (await rbac.rolesOf(0xfoo)).includes(RbacRoles.ADMIN)
|
|
139
|
+
* @public
|
|
140
|
+
* @param {Address} account
|
|
141
|
+
* @param {?ReadParams} [params]
|
|
142
|
+
* @returns {Promise<Array<RbacRoles>>}
|
|
143
|
+
*/
|
|
144
|
+
async rolesOf(s, t) {
|
|
145
|
+
const a = await g(this._config, {
|
|
146
|
+
address: this.assertValidAddress(),
|
|
147
|
+
args: [s],
|
|
148
|
+
...this.optionallyAttachAccount(),
|
|
149
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
150
|
+
...t
|
|
151
|
+
});
|
|
152
|
+
return [o.MANAGER, o.ADMIN].filter(
|
|
153
|
+
(r) => (a & r) === r
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Returns whether given account has any of the provided roles bitmap.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* await rbac.hasAnyRole(0xfoo, RbacRoles.ADMIN | RbacRoles.MANAGER)
|
|
162
|
+
* @public
|
|
163
|
+
* @param {Address} account
|
|
164
|
+
* @param {RbacRoles} roles
|
|
165
|
+
* @param {?ReadParams} [params]
|
|
166
|
+
* @returns {Promise<boolean>}
|
|
167
|
+
*/
|
|
168
|
+
hasAnyRole(s, t, a) {
|
|
169
|
+
return w(this._config, {
|
|
170
|
+
address: this.assertValidAddress(),
|
|
171
|
+
args: [s, t],
|
|
172
|
+
...this.optionallyAttachAccount(),
|
|
173
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
174
|
+
...a
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Returns whether given account has all of the provided roles bitmap.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* await rbac.hasAllRoles(0xfoo, RbacRoles.ADMIN & RbacRoles.MANAGER)
|
|
183
|
+
*
|
|
184
|
+
* @public
|
|
185
|
+
* @param {Address} account
|
|
186
|
+
* @param {RbacRoles} roles
|
|
187
|
+
* @param {?ReadParams} [params]
|
|
188
|
+
* @returns {Promise<boolean>}
|
|
189
|
+
*/
|
|
190
|
+
hasAllRoles(s, t, a) {
|
|
191
|
+
return R(this._config, {
|
|
192
|
+
address: this.assertValidAddress(),
|
|
193
|
+
args: [s, t],
|
|
194
|
+
...this.optionallyAttachAccount(),
|
|
195
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
196
|
+
...a
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Check if the given account is authorized to use the rbac
|
|
201
|
+
*
|
|
202
|
+
* @public
|
|
203
|
+
* @param {Address} account
|
|
204
|
+
* @param {?ReadParams} [params]
|
|
205
|
+
* @returns {Promise<boolean>} - True if the account is authorized
|
|
206
|
+
*/
|
|
207
|
+
isAuthorized(s, t) {
|
|
208
|
+
return y(this._config, {
|
|
209
|
+
address: this.assertValidAddress(),
|
|
210
|
+
args: [s],
|
|
211
|
+
...this.optionallyAttachAccount(),
|
|
212
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
213
|
+
...t
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
export {
|
|
218
|
+
_ as DeployableTargetWithRBAC,
|
|
219
|
+
o as Roles,
|
|
220
|
+
N as rbacAbi
|
|
221
|
+
};
|
|
222
|
+
//# sourceMappingURL=DeployableTargetWithRBAC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployableTargetWithRBAC.js","sources":["../../src/Deployable/DeployableTargetWithRBAC.ts"],"sourcesContent":["import {\n rbacAbi,\n readRbacHasAllRoles,\n readRbacHasAnyRole,\n readRbacIsAuthorized,\n readRbacRolesOf,\n simulateRbacGrantRoles,\n simulateRbacRevokeRoles,\n simulateRbacSetAuthorized,\n writeRbacGrantRoles,\n writeRbacRevokeRoles,\n writeRbacSetAuthorized,\n} from '@boostxyz/evm';\nimport type { Abi, Address, ContractEventName } from 'viem';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport type { GenericLog, ReadParams, WriteParams } from '../utils';\nexport { rbacAbi };\n\n/**\n * Enum representing available roles for use with the `RBAC` authorization scheme.\n * `MANAGER` has lowest level of write permissions, for specific implementations, see Budgets and ALlowLists\n * `ADMIN` can additionally manage authorized users on the contract.\n *\n * @export\n * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}\n * @enum {bigint}\n */\nexport enum Roles {\n //@ts-expect-error ts doesn't like bigint enum values\n MANAGER = 1n,\n //@ts-expect-error ts doesn't like bigint enum values\n ADMIN = 2n,\n}\n\n/**\n * A generic `viem.Log` event with support for `Rbac` event types.\n *\n * @export\n * @typedef {RBACLog}\n * @template {ContractEventName<typeof rbacAbi>} [event=ContractEventName<\n * typeof rbacAbi\n * >]\n */\nexport type RBACLog<\n event extends ContractEventName<typeof rbacAbi> = ContractEventName<\n typeof rbacAbi\n >,\n> = GenericLog<typeof rbacAbi, event>;\n\n/**\n * A minimal RBAC implementation that offers MANAGER and ADMIN roles, and\n * Budgets and allowlists support this auth scheme\n *\n * @export\n * @class DeployableTargetWithRBAC\n * @typedef {DeployableTargetWithRBAC}\n * @extends {DeployableTarget<RbacPayload>}\n */\nexport class DeployableTargetWithRBAC<\n Payload,\n ABI extends Abi,\n> extends DeployableTarget<Payload, ABI> {\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof rbacAbi, 'setAuthorized'>,\n ) {\n return await this.awaitResult(\n this.setAuthorizedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof rbacAbi, 'setAuthorized'>,\n ) {\n const { request, result } = await simulateRbacSetAuthorized(this._config, {\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 const hash = await writeRbacSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async grantRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n return await this.awaitResult(this.grantRolesRaw(addresses, roles, params));\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n const { request, result } = await simulateRbacGrantRoles(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, roles],\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 const hash = await writeRbacGrantRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n return await this.awaitResult(\n this.revokeRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n const { request, result } = await simulateRbacRevokeRoles(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, roles],\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 const hash = await writeRbacRevokeRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Return an array of the roles assigned to the given account.\n * @example\n * ```ts\n * (await rbac.rolesOf(0xfoo)).includes(RbacRoles.ADMIN)\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<Array<RbacRoles>>}\n */\n public async rolesOf(\n account: Address,\n params?: ReadParams<typeof rbacAbi, 'rolesOf'>,\n ) {\n const roles = await readRbacRolesOf(this._config, {\n address: this.assertValidAddress(),\n args: [account],\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 return ([Roles.MANAGER, Roles.ADMIN] as unknown as Array<bigint>).filter(\n (role) => (roles & role) === role,\n ) as unknown as Roles[];\n }\n\n /**\n * Returns whether given account has any of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAnyRole(0xfoo, RbacRoles.ADMIN | RbacRoles.MANAGER)\n * @public\n * @param {Address} account\n * @param {RbacRoles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAnyRole(\n account: Address,\n roles: Roles,\n params?: ReadParams<typeof rbacAbi, 'hasAnyRole'>,\n ) {\n return readRbacHasAnyRole(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\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 * Returns whether given account has all of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAllRoles(0xfoo, RbacRoles.ADMIN & RbacRoles.MANAGER)\n *\n * @public\n * @param {Address} account\n * @param {RbacRoles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAllRoles(\n account: Address,\n roles: Roles,\n params?: ReadParams<typeof rbacAbi, 'hasAllRoles'>,\n ) {\n return readRbacHasAllRoles(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\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 * Check if the given account is authorized to use the rbac\n *\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the account is authorized\n */\n public isAuthorized(\n account: Address,\n params?: ReadParams<typeof rbacAbi, 'isAuthorized'>,\n ) {\n return readRbacIsAuthorized(this._config, {\n address: this.assertValidAddress(),\n args: [account],\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"],"names":["Roles","DeployableTargetWithRBAC","DeployableTarget","addresses","allowed","params","request","result","simulateRbacSetAuthorized","writeRbacSetAuthorized","roles","simulateRbacGrantRoles","writeRbacGrantRoles","simulateRbacRevokeRoles","writeRbacRevokeRoles","account","readRbacRolesOf","role","readRbacHasAnyRole","readRbacHasAllRoles","readRbacIsAuthorized"],"mappings":";;;AA2BY,IAAAA,sBAAAA,OAEVA,EAAAA,EAAA,UAAU,EAAV,IAAA,WAEAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SAJUA,IAAAA,KAAA,CAAA,CAAA;AA+BL,MAAMC,UAGHC,EAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYvC,MAAa,cACXC,GACAC,GACAC,GACA;AACA,WAAO,MAAM,KAAK;AAAA,MAChB,KAAK,iBAAiBF,GAAWC,GAASC,CAAM;AAAA,IAAA;AAAA,EAEpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,MAAa,iBACXF,GACAC,GACAC,GACA;AACA,UAAM,EAAE,SAAAC,GAAS,QAAAC,EAAA,IAAW,MAAMC,EAA0B,KAAK,SAAS;AAAA,MACxE,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACL,GAAWC,CAAO;AAAA,MACzB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIC;AAAA,IAAA,CACL;AAEM,WAAA,EAAE,MADI,MAAMI,EAAuB,KAAK,SAASH,CAAO,GAChD,QAAAC;EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAa,WACXJ,GACAO,GACAL,GACA;AACO,WAAA,MAAM,KAAK,YAAY,KAAK,cAAcF,GAAWO,GAAOL,CAAM,CAAC;AAAA,EAC5E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAa,cACXF,GACAO,GACAL,GACA;AACA,UAAM,EAAE,SAAAC,GAAS,QAAAC,EAAA,IAAW,MAAMI,EAAuB,KAAK,SAAS;AAAA,MACrE,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACR,GAAWO,CAAK;AAAA,MACvB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIL;AAAA,IAAA,CACL;AAMM,WAAA,EAAE,MALI,MAAMO;AAAAA,MACjB,KAAK;AAAA;AAAA,MAELN;AAAA,IAAA,GAEa,QAAAC;EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAa,YACXJ,GACAO,GACAL,GACA;AACA,WAAO,MAAM,KAAK;AAAA,MAChB,KAAK,eAAeF,GAAWO,GAAOL,CAAM;AAAA,IAAA;AAAA,EAEhD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,MAAa,eACXF,GACAO,GACAL,GACA;AACA,UAAM,EAAE,SAAAC,GAAS,QAAAC,EAAA,IAAW,MAAMM,EAAwB,KAAK,SAAS;AAAA,MACtE,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACV,GAAWO,CAAK;AAAA,MACvB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIL;AAAA,IAAA,CACL;AAMM,WAAA,EAAE,MALI,MAAMS;AAAAA,MACjB,KAAK;AAAA;AAAA,MAELR;AAAA,IAAA,GAEa,QAAAC;EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAa,QACXQ,GACAV,GACA;AACA,UAAMK,IAAQ,MAAMM,EAAgB,KAAK,SAAS;AAAA,MAChD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACD,CAAO;AAAA,MACd,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIV;AAAA,IAAA,CACL;AACD,WAAQ,CAACL,EAAM,SAASA,EAAM,KAAK,EAA+B;AAAA,MAChE,CAACiB,OAAUP,IAAQO,OAAUA;AAAA,IAAA;AAAA,EAEjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcO,WACLF,GACAL,GACAL,GACA;AACO,WAAAa,EAAmB,KAAK,SAAS;AAAA,MACtC,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACH,GAASL,CAAK;AAAA,MACrB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIL;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeO,YACLU,GACAL,GACAL,GACA;AACO,WAAAc,EAAoB,KAAK,SAAS;AAAA,MACvC,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACJ,GAASL,CAAK;AAAA,MACrB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIL;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUO,aACLU,GACAV,GACA;AACO,WAAAe,EAAqB,KAAK,SAAS;AAAA,MACxC,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACL,CAAO;AAAA,MACd,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIV;AAAA,IAAA,CACL;AAAA,EACH;AACF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const E=require("./generated-CyTNlOwM.cjs"),L=require("@wagmi/core"),p=require("viem"),W=require("./deployments-DVXioW2i.cjs"),X=require("./Deployable/DeployableTarget.cjs"),u=require("./errors.cjs"),Q=require("./utils.cjs"),$="0x60a0604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b60805161231a6100c85f395f61034a015261231a5ff3fe608060405260043610610090575f3560e01c80639bc1cf81116100585780639bc1cf811461017d578063c26624e8146101a7578063d7768c47146101e3578063dbdf21101461021f578063ddd6ab081461024957610090565b806301ffc9a71461009457806309c5eabe146100d057806328d6183b14610101578063393df8cb1461012b578063439fab9114610155575b5f80fd5b34801561009f575f80fd5b506100ba60048036038101906100b59190611333565b610273565b6040516100c79190611378565b60405180910390f35b6100ea60048036038101906100e591906113f2565b6102ec565b6040516100f89291906114ad565b60405180910390f35b34801561010c575f80fd5b50610115610321565b60405161012291906114ea565b60405180910390f35b348015610136575f80fd5b5061013f610348565b60405161014c919061157d565b60405180910390f35b348015610160575f80fd5b5061017b600480360381019061017691906113f2565b61036c565b005b348015610188575f80fd5b506101916103f9565b60405161019e91906118e9565b60405180910390f35b3480156101b2575f80fd5b506101cd60048036038101906101c89190611933565b610648565b6040516101da91906119e4565b60405180910390f35b3480156101ee575f80fd5b50610209600480360381019061020491906113f2565b610875565b6040516102169190611a04565b60405180910390f35b34801561022a575f80fd5b506102336108a9565b6040516102409190611a8a565b60405180910390f35b348015610254575f80fd5b5061025d610981565b60405161026a9190611ab2565b60405180910390f35b5f7f7687b0ed000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806102e557506102e48261098d565b5b9050919050565b5f60606040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f7f7687b0ed00000000000000000000000000000000000000000000000000000000905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f610375610a06565b905080546003825580156103a75760018160011c14303b1061039e5763f92ee8a95f526004601cfd5b818160ff1b1b91505b506103bf83838101906103ba9190611fb0565b610a2f565b80156103f4576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b60606004805480602002602001604051908101604052809291908181526020015f905b8282101561063f578382905f5260205f2090600502016040518060c00160405290815f8201548152602001600182015f9054906101000a900460ff16600181111561046a576104696115d7565b5b600181111561047c5761047b6115d7565b5b81526020016001820160019054906101000a900460ff1660ff1660ff1681526020016001820160029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160028201548152602001600382016040518060800160405290815f82015f9054906101000a900460ff1660058111156105305761052f6115d7565b5b6005811115610542576105416115d7565b5b81526020015f820160019054906101000a900460ff16600381111561056a576105696115d7565b5b600381111561057c5761057b6115d7565b5b81526020015f820160029054906101000a900460ff1660ff1660ff1681526020016001820180546105ac90612024565b80601f01602080910402602001604051908101604052809291908181526020018280546105d890612024565b80156106235780601f106105fa57610100808354040283529160200191610623565b820191905f5260205f20905b81548152906001019060200180831161060657829003601f168201915b505050505081525050815250508152602001906001019061041c565b50505050905090565b6106506111c4565b6004828154811061066457610663612054565b5b905f5260205f2090600502016040518060c00160405290815f8201548152602001600182015f9054906101000a900460ff1660018111156106a8576106a76115d7565b5b60018111156106ba576106b96115d7565b5b81526020016001820160019054906101000a900460ff1660ff1660ff1681526020016001820160029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160028201548152602001600382016040518060800160405290815f82015f9054906101000a900460ff16600581111561076e5761076d6115d7565b5b60058111156107805761077f6115d7565b5b81526020015f820160019054906101000a900460ff1660038111156107a8576107a76115d7565b5b60038111156107ba576107b96115d7565b5b81526020015f820160029054906101000a900460ff1660ff1660ff1681526020016001820180546107ea90612024565b80601f016020809104026020016040519081016040528092919081815260200182805461081690612024565b80156108615780601f1061083857610100808354040283529160200191610861565b820191905f5260205f20905b81548152906001019060200180831161084457829003601f168201915b505050505081525050815250509050919050565b60606040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108b1611229565b5f6040518060a00160405290815f82015f9054906101000a900460ff1660018111156108e0576108df6115d7565b5b60018111156108f2576108f16115d7565b5b815260200160018201548152602001600282015f9054906101000a900460ff1660ff1660ff1681526020016002820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600382015481525050905090565b5f600480549050905090565b5f7fe6715795000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806109ff57506109fe826110be565b5b9050919050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610a37611137565b805f01515f80820151815f015f6101000a81548160ff02191690836001811115610a6457610a636115d7565b5b0217905550602082015181600101556040820151816002015f6101000a81548160ff021916908360ff16021790555060608201518160020160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506080820151816003015590505060048160200151908060018154018082558091505060019003905f5260205f2090600502015f909190919091505f820151815f01556020820151816001015f6101000a81548160ff02191690836001811115610b4657610b456115d7565b5b021790555060408201518160010160016101000a81548160ff021916908360ff16021790555060608201518160010160026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506080820151816002015560a0820151816003015f820151815f015f6101000a81548160ff02191690836005811115610bee57610bed6115d7565b5b02179055506020820151815f0160016101000a81548160ff02191690836003811115610c1d57610c1c6115d7565b5b02179055506040820151815f0160026101000a81548160ff021916908360ff1602179055506060820151816001019081610c579190612215565b505050505060048160400151908060018154018082558091505060019003905f5260205f2090600502015f909190919091505f820151815f01556020820151816001015f6101000a81548160ff02191690836001811115610cbb57610cba6115d7565b5b021790555060408201518160010160016101000a81548160ff021916908360ff16021790555060608201518160010160026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506080820151816002015560a0820151816003015f820151815f015f6101000a81548160ff02191690836005811115610d6357610d626115d7565b5b02179055506020820151815f0160016101000a81548160ff02191690836003811115610d9257610d916115d7565b5b02179055506040820151815f0160026101000a81548160ff021916908360ff1602179055506060820151816001019081610dcc9190612215565b505050505060048160600151908060018154018082558091505060019003905f5260205f2090600502015f909190919091505f820151815f01556020820151816001015f6101000a81548160ff02191690836001811115610e3057610e2f6115d7565b5b021790555060408201518160010160016101000a81548160ff021916908360ff16021790555060608201518160010160026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506080820151816002015560a0820151816003015f820151815f015f6101000a81548160ff02191690836005811115610ed857610ed76115d7565b5b02179055506020820151815f0160016101000a81548160ff02191690836003811115610f0757610f066115d7565b5b02179055506040820151815f0160026101000a81548160ff021916908360ff1602179055506060820151816001019081610f419190612215565b505050505060048160800151908060018154018082558091505060019003905f5260205f2090600502015f909190919091505f820151815f01556020820151816001015f6101000a81548160ff02191690836001811115610fa557610fa46115d7565b5b021790555060408201518160010160016101000a81548160ff021916908360ff16021790555060608201518160010160026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506080820151816002015560a0820151816003015f820151815f015f6101000a81548160ff0219169083600581111561104d5761104c6115d7565b5b02179055506020820151815f0160016101000a81548160ff0219169083600381111561107c5761107b6115d7565b5b02179055506040820151815f0160026101000a81548160ff021916908360ff16021790555060608201518160010190816110b69190612215565b505050505050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611130575061112f8261115b565b5b9050919050565b5f611140610a06565b905080546001166111585763d7e6bcf85f526004601cfd5b50565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6040518060c001604052805f80191681526020015f60018111156111eb576111ea6115d7565b5b81526020015f60ff1681526020015f73ffffffffffffffffffffffffffffffffffffffff1681526020015f8152602001611223611281565b81525090565b6040518060a001604052805f6001811115611247576112466115d7565b5b81526020015f80191681526020015f60ff1681526020015f73ffffffffffffffffffffffffffffffffffffffff1681526020015f81525090565b60405180608001604052805f600581111561129f5761129e6115d7565b5b81526020015f60038111156112b7576112b66115d7565b5b81526020015f60ff168152602001606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611312816112de565b811461131c575f80fd5b50565b5f8135905061132d81611309565b92915050565b5f60208284031215611348576113476112d6565b5b5f6113558482850161131f565b91505092915050565b5f8115159050919050565b6113728161135e565b82525050565b5f60208201905061138b5f830184611369565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126113b2576113b1611391565b5b8235905067ffffffffffffffff8111156113cf576113ce611395565b5b6020830191508360018202830111156113eb576113ea611399565b5b9250929050565b5f8060208385031215611408576114076112d6565b5b5f83013567ffffffffffffffff811115611425576114246112da565b5b6114318582860161139d565b92509250509250929050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61147f8261143d565b6114898185611447565b9350611499818560208601611457565b6114a281611465565b840191505092915050565b5f6040820190506114c05f830185611369565b81810360208301526114d28184611475565b90509392505050565b6114e4816112de565b82525050565b5f6020820190506114fd5f8301846114db565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f819050919050565b5f61154561154061153b84611503565b611522565b611503565b9050919050565b5f6115568261152b565b9050919050565b5f6115678261154c565b9050919050565b6115778161155d565b82525050565b5f6020820190506115905f83018461156e565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f819050919050565b6115d1816115bf565b82525050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b60028110611615576116146115d7565b5b50565b5f81905061162582611604565b919050565b5f61163482611618565b9050919050565b6116448161162a565b82525050565b5f60ff82169050919050565b61165f8161164a565b82525050565b5f61166f82611503565b9050919050565b61167f81611665565b82525050565b5f819050919050565b61169781611685565b82525050565b600681106116ae576116ad6115d7565b5b50565b5f8190506116be8261169d565b919050565b5f6116cd826116b1565b9050919050565b6116dd816116c3565b82525050565b600481106116f4576116f36115d7565b5b50565b5f819050611704826116e3565b919050565b5f611713826116f7565b9050919050565b61172381611709565b82525050565b5f82825260208201905092915050565b5f6117438261143d565b61174d8185611729565b935061175d818560208601611457565b61176681611465565b840191505092915050565b5f608083015f8301516117865f8601826116d4565b506020830151611799602086018261171a565b5060408301516117ac6040860182611656565b50606083015184820360608601526117c48282611739565b9150508091505092915050565b5f60c083015f8301516117e65f8601826115c8565b5060208301516117f9602086018261163b565b50604083015161180c6040860182611656565b50606083015161181f6060860182611676565b506080830151611832608086018261168e565b5060a083015184820360a086015261184a8282611771565b9150508091505092915050565b5f61186283836117d1565b905092915050565b5f602082019050919050565b5f61188082611596565b61188a81856115a0565b93508360208202850161189c856115b0565b805f5b858110156118d757848403895281516118b88582611857565b94506118c38361186a565b925060208a0199505060018101905061189f565b50829750879550505050505092915050565b5f6020820190508181035f8301526119018184611876565b905092915050565b61191281611685565b811461191c575f80fd5b50565b5f8135905061192d81611909565b92915050565b5f60208284031215611948576119476112d6565b5b5f6119558482850161191f565b91505092915050565b5f60c083015f8301516119735f8601826115c8565b506020830151611986602086018261163b565b5060408301516119996040860182611656565b5060608301516119ac6060860182611676565b5060808301516119bf608086018261168e565b5060a083015184820360a08601526119d78282611771565b9150508091505092915050565b5f6020820190508181035f8301526119fc818461195e565b905092915050565b5f6020820190508181035f830152611a1c8184611475565b905092915050565b60a082015f820151611a385f85018261163b565b506020820151611a4b60208501826115c8565b506040820151611a5e6040850182611656565b506060820151611a716060850182611676565b506080820151611a84608085018261168e565b50505050565b5f60a082019050611a9d5f830184611a24565b92915050565b611aac81611685565b82525050565b5f602082019050611ac55f830184611aa3565b92915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b611b0582611465565b810181811067ffffffffffffffff82111715611b2457611b23611acf565b5b80604052505050565b5f611b366112cd565b9050611b428282611afc565b919050565b5f80fd5b60028110611b57575f80fd5b50565b5f81359050611b6881611b4b565b92915050565b611b77816115bf565b8114611b81575f80fd5b50565b5f81359050611b9281611b6e565b92915050565b611ba18161164a565b8114611bab575f80fd5b50565b5f81359050611bbc81611b98565b92915050565b611bcb81611665565b8114611bd5575f80fd5b50565b5f81359050611be681611bc2565b92915050565b5f60a08284031215611c0157611c00611acb565b5b611c0b60a0611b2d565b90505f611c1a84828501611b5a565b5f830152506020611c2d84828501611b84565b6020830152506040611c4184828501611bae565b6040830152506060611c5584828501611bd8565b6060830152506080611c698482850161191f565b60808301525092915050565b60068110611c81575f80fd5b50565b5f81359050611c9281611c75565b92915050565b60048110611ca4575f80fd5b50565b5f81359050611cb581611c98565b92915050565b5f80fd5b5f67ffffffffffffffff821115611cd957611cd8611acf565b5b611ce282611465565b9050602081019050919050565b828183375f83830152505050565b5f611d0f611d0a84611cbf565b611b2d565b905082815260208101848484011115611d2b57611d2a611cbb565b5b611d36848285611cef565b509392505050565b5f82601f830112611d5257611d51611391565b5b8135611d62848260208601611cfd565b91505092915050565b5f60808284031215611d8057611d7f611acb565b5b611d8a6080611b2d565b90505f611d9984828501611c84565b5f830152506020611dac84828501611ca7565b6020830152506040611dc084828501611bae565b604083015250606082013567ffffffffffffffff811115611de457611de3611b47565b5b611df084828501611d3e565b60608301525092915050565b5f60c08284031215611e1157611e10611acb565b5b611e1b60c0611b2d565b90505f611e2a84828501611b84565b5f830152506020611e3d84828501611b5a565b6020830152506040611e5184828501611bae565b6040830152506060611e6584828501611bd8565b6060830152506080611e798482850161191f565b60808301525060a082013567ffffffffffffffff811115611e9d57611e9c611b47565b5b611ea984828501611d6b565b60a08301525092915050565b5f6101208284031215611ecb57611eca611acb565b5b611ed560a0611b2d565b90505f611ee484828501611bec565b5f8301525060a082013567ffffffffffffffff811115611f0757611f06611b47565b5b611f1384828501611dfc565b60208301525060c082013567ffffffffffffffff811115611f3757611f36611b47565b5b611f4384828501611dfc565b60408301525060e082013567ffffffffffffffff811115611f6757611f66611b47565b5b611f7384828501611dfc565b60608301525061010082013567ffffffffffffffff811115611f9857611f97611b47565b5b611fa484828501611dfc565b60808301525092915050565b5f60208284031215611fc557611fc46112d6565b5b5f82013567ffffffffffffffff811115611fe257611fe16112da565b5b611fee84828501611eb5565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061203b57607f821691505b60208210810361204e5761204d611ff7565b5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026120dd7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826120a2565b6120e786836120a2565b95508019841693508086168417925050509392505050565b5f61211961211461210f84611685565b611522565b611685565b9050919050565b5f819050919050565b612132836120ff565b61214661213e82612120565b8484546120ae565b825550505050565b5f90565b61215a61214e565b612165818484612129565b505050565b5b818110156121885761217d5f82612152565b60018101905061216b565b5050565b601f8211156121cd5761219e81612081565b6121a784612093565b810160208510156121b6578190505b6121ca6121c285612093565b83018261216a565b50505b505050565b5f82821c905092915050565b5f6121ed5f19846008026121d2565b1980831691505092915050565b5f61220583836121de565b9150826002028217905092915050565b61221e8261143d565b67ffffffffffffffff81111561223757612236611acf565b5b6122418254612024565b61224c82828561218c565b5f60209050601f83116001811461227d575f841561226b578287015190505b61227585826121fa565b8655506122dc565b601f19841661228b86612081565b5f5b828110156122b25784890151825560018201915060208501945060208101905061228d565b868310156122cf57848901516122cb601f8916826121de565b8355505b6001600288020188555050505b50505050505056fea26469706673582212208eb365eda8d73b432dcac87772fa84d3bb11eb90f5c05dbe00a55fa3412254c364736f6c634300081a0033",z={"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef":{name:"Transfer",type:"event",inputs:[{type:"address",indexed:!0},{type:"address",indexed:!0},{type:"uint256",indexed:!0}]},"Transfer(address indexed,address indexed,uint256 indexed)":{name:"Transfer",type:"event",inputs:[{type:"address",indexed:!0},{type:"address",indexed:!0},{type:"uint256",indexed:!0}]},"0xb362243af1e2070d7d5bf8d713f2e0fab64203f1b71462afbe20572909788c5e":{name:"Purchased",type:"event",inputs:[{type:"address",indexed:!0},{type:"address",indexed:!0},{type:"uint256",indexed:!0},{type:"uint256"},{type:"uint256"}]},"Purchased(address indexed,address indexed,uint256 indexed,uint256,uint256)":{name:"Purchased",type:"event",inputs:[{type:"address",indexed:!0},{type:"address",indexed:!0},{type:"uint256",indexed:!0},{type:"uint256"},{type:"uint256"}]},"0x69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf27":{name:"NameRegistered",type:"event",inputs:[{type:"string"},{type:"bytes32"},{type:"address"},{type:"uint256"},{type:"uint256"},{type:"uint256"}]},"NameRegistered(string,bytes32,address,uint256,uint256,uint256)":{name:"NameRegistered",type:"event",inputs:[{type:"string"},{type:"bytes32"},{type:"address"},{type:"uint256"},{type:"uint256"},{type:"uint256"}]},"0x3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f":{name:"DelegateChanged",type:"event",inputs:[{type:"address",indexed:!0},{type:"address",indexed:!0},{type:"address",indexed:!0}]},"DelegateChanged(address indexed,address indexed,address indexed)":{name:"DelegateChanged",type:"event",inputs:[{type:"address",indexed:!0},{type:"address",indexed:!0},{type:"address",indexed:!0}]},"0xe00361d207b252a464323eb23d45d42583e391f2031acdd2e9fa36efddd43cb0":{name:"SwappedV3",type:"event",inputs:[{type:"bytes16"},{type:"address"},{type:"uint256"},{type:"address"},{type:"address",indexed:!0},{type:"address",indexed:!0},{type:"address",indexed:!0},{type:"uint256"},{type:"uint256"},{type:"uint256"}]},"SwappedV3(bytes16,address,uint256,address,address indexed,address indexed,address indexed,uint256,uint256,uint256)":{name:"SwappedV3",type:"event",inputs:[{type:"bytes16"},{type:"address"},{type:"uint256"},{type:"address"},{type:"address",indexed:!0},{type:"address",indexed:!0},{type:"address",indexed:!0},{type:"uint256"},{type:"uint256"},{type:"uint256"}]},"0xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4":{name:"VoteCast",type:"event",inputs:[{type:"address",indexed:!0},{type:"uint256"},{type:"uint8"},{type:"uint256"},{type:"string"}]},"VoteCast(address indexed,uint256,uint8,uint256,string)":{name:"VoteCast",type:"event",inputs:[{type:"address",indexed:!0},{type:"uint256"},{type:"uint8"},{type:"uint256"},{type:"string"}]},"0x883a883a9ea847654d33471b1e5fb2dea76a2cfc86a6cc7da6c14102800e4d0b":{name:"InfoIndexed",type:"event",inputs:[{type:"address",indexed:!0},{type:"string",indexed:!0}]},"InfoIndexed(address indexed,string indexed)":{name:"InfoIndexed",type:"event",inputs:[{type:"address",indexed:!0},{type:"string",indexed:!0}]},"0xe46343e36b0721f173bdc76b8f25c08b04f417df09c27e1e83ba1980007fef8c":{name:"Info",type:"event",inputs:[{type:"address"},{type:"string"}]},"Info(address,string)":{name:"Info",type:"event",inputs:[{type:"address"},{type:"string"}]}},J={"Transfer(address indexed,address indexed,uint256 indexed)":"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef":"Transfer(address indexed,address indexed,uint256 indexed)","Purchased(address indexed,address indexed,uint256 indexed,uint256,uint256)":"0xb362243af1e2070d7d5bf8d713f2e0fab64203f1b71462afbe20572909788c5e","0xb362243af1e2070d7d5bf8d713f2e0fab64203f1b71462afbe20572909788c5e":"Purchased(address indexed,address indexed,uint256 indexed,uint256,uint256)","NameRegistered(string,bytes32,address,uint256,uint256,uint256)":"0x69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf27","0x69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf27":"NameRegistered(string,bytes32,address,uint256,uint256,uint256)","DelegateChanged(address indexed,address indexed,address indexed)":"0x3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f","0x3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f":"DelegateChanged(address indexed,address indexed,address indexed)","SwappedV3(bytes16,address,uint256,address,address indexed,address indexed,address indexed,uint256,uint256,uint256)":"0xe00361d207b252a464323eb23d45d42583e391f2031acdd2e9fa36efddd43cb0","0xe00361d207b252a464323eb23d45d42583e391f2031acdd2e9fa36efddd43cb0":"SwappedV3(bytes16,address,uint256,address,address indexed,address indexed,address indexed,uint256,uint256,uint256)","VoteCast(address indexed,uint256,uint8,uint256,string)":"0xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4","0xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4":"VoteCast(address indexed,uint256,uint8,uint256,string)","InfoIndexed(address indexed,string indexed)":"0x883a883a9ea847654d33471b1e5fb2dea76a2cfc86a6cc7da6c14102800e4d0b","0x883a883a9ea847654d33471b1e5fb2dea76a2cfc86a6cc7da6c14102800e4d0b":"InfoIndexed(address indexed,string indexed)","Info(address,string)":"0xe46343e36b0721f173bdc76b8f25c08b04f417df09c27e1e83ba1980007fef8c","0xe46343e36b0721f173bdc76b8f25c08b04f417df09c27e1e83ba1980007fef8c":"Info(address,string)"},M={abi:z,selectors:J},Y={"0x0000000000000000000000000000000000000000000000000000000040c10f19":{name:"mint",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[]},"mint(address to, uint256 amount)":{name:"mint",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[]},"0x00000000000000000000000000000000000000000000000000000000a836f32f":{name:"mint",type:"function",stateMutability:"nonpayable",inputs:[{type:"address"},{type:"uint256"},{type:"address"},{type:"uint256"},{type:"address"},{type:"string"}],outputs:[]},"mint(address,uint256,address,uint256,address,string)":{name:"mint",type:"function",stateMutability:"nonpayable",inputs:[{type:"address"},{type:"uint256"},{type:"address"},{type:"uint256"},{type:"address"},{type:"string"}],outputs:[]},"0x0000000000000000000000000000000000000000000000000000000017d304b0":{name:"mintPayable",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[]},"mintPayable(address to, uint256 amount)":{name:"mintPayable",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[]},"0x0000000000000000000000000000000000000000000000000000000024856bc3":{name:"execute",type:"function",stateMutability:"nonpayable",inputs:[{type:"bytes",name:"commands"},{type:"bytes[]",name:"inputs"}],outputs:[]},"execute(bytes commands,bytes[] inputs)":{name:"execute",type:"function",stateMutability:"nonpayable",inputs:[{type:"bytes",name:"commands"},{type:"bytes[]",name:"inputs"}],outputs:[]},"0x0000000000000000000000000000000000000000000000000000000074694a2b":{name:"register",type:"function",stateMutability:"nonpayable",inputs:[{type:"string",name:"name"},{type:"address",name:"owner"},{type:"uint256",name:"duration"},{type:"bytes32",name:"secret"},{type:"address",name:"resolver"},{type:"bytes[]",name:"data"},{type:"bool",name:"reverseRecord"},{type:"uint16",name:"ownerControlledFuses"}],outputs:[]},"register(string name,address owner,uint256 duration,bytes32 secret,address resolver,bytes[] data,bool reverseRecord,uint16 ownerControlledFuses)":{name:"register",type:"function",stateMutability:"nonpayable",inputs:[{type:"string",name:"name"},{type:"address",name:"owner"},{type:"uint256",name:"duration"},{type:"bytes32",name:"secret"},{type:"address",name:"resolver"},{type:"bytes[]",name:"data"},{type:"bool",name:"reverseRecord"},{type:"uint16",name:"ownerControlledFuses"}],outputs:[]},"0x00000000000000000000000000000000000000000000000000000000eb9019d4":{name:"getVotes",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"uint256",name:"blockNumber"}],outputs:[{type:"uint256"}]},"getVotes(address account, uint256 blockNumber) view returns (uint256)":{name:"getVotes",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"uint256",name:"blockNumber"}],outputs:[{type:"uint256"}]},"0x0000000000000000000000000000000000000000000000000000000023b872dd":{name:"transferFrom",type:"function",stateMutability:"nonpayable",inputs:[{type:"address"},{type:"address"},{type:"uint256"}],outputs:[]},"transferFrom(address,address,uint256)":{name:"transferFrom",type:"function",stateMutability:"nonpayable",inputs:[{type:"address"},{type:"address"},{type:"uint256"}],outputs:[]},"0x000000000000000000000000000000000000000000000000000000006a627842":{name:"mint",type:"function",stateMutability:"nonpayable",inputs:[{type:"address"}],outputs:[]},"mint(address)":{name:"mint",type:"function",stateMutability:"nonpayable",inputs:[{type:"address"}],outputs:[]}},Z={"mint(address to, uint256 amount)":"0x0000000000000000000000000000000000000000000000000000000040c10f19","0x0000000000000000000000000000000000000000000000000000000040c10f19":"mint(address to, uint256 amount)","mint(address,uint256,address,uint256,address,string)":"0x00000000000000000000000000000000000000000000000000000000a836f32f","0x00000000000000000000000000000000000000000000000000000000a836f32f":"mint(address,uint256,address,uint256,address,string)","mintPayable(address to, uint256 amount)":"0x0000000000000000000000000000000000000000000000000000000017d304b0","0x0000000000000000000000000000000000000000000000000000000017d304b0":"mintPayable(address to, uint256 amount)","execute(bytes commands,bytes[] inputs)":"0x0000000000000000000000000000000000000000000000000000000024856bc3","0x0000000000000000000000000000000000000000000000000000000024856bc3":"execute(bytes commands,bytes[] inputs)","register(string name,address owner,uint256 duration,bytes32 secret,address resolver,bytes[] data,bool reverseRecord,uint16 ownerControlledFuses)":"0x0000000000000000000000000000000000000000000000000000000074694a2b","0x0000000000000000000000000000000000000000000000000000000074694a2b":"register(string name,address owner,uint256 duration,bytes32 secret,address resolver,bytes[] data,bool reverseRecord,uint16 ownerControlledFuses)","getVotes(address account, uint256 blockNumber) view returns (uint256)":"0x00000000000000000000000000000000000000000000000000000000eb9019d4","0x00000000000000000000000000000000000000000000000000000000eb9019d4":"getVotes(address account, uint256 blockNumber) view returns (uint256)","transferFrom(address,address,uint256)":"0x0000000000000000000000000000000000000000000000000000000023b872dd","0x0000000000000000000000000000000000000000000000000000000023b872dd":"transferFrom(address,address,uint256)","mint(address)":"0x000000000000000000000000000000000000000000000000000000006a627842","0x000000000000000000000000000000000000000000000000000000006a627842":"mint(address)"},V={abi:Y,selectors:Z},x=Symbol.for("@ts-pattern/matcher"),f0=Symbol.for("@ts-pattern/isVariadic"),P="@ts-pattern/anonymous-select-key",B=t=>!!(t&&typeof t=="object"),N=t=>t&&!!t[x],g=(t,f,e)=>{if(N(t)){const n=t[x](),{matched:a,selections:d}=n.match(f);return a&&d&&Object.keys(d).forEach(s=>e(s,d[s])),a}if(B(t)){if(!B(f))return!1;if(Array.isArray(t)){if(!Array.isArray(f))return!1;let n=[],a=[],d=[];for(const s of t.keys()){const b=t[s];N(b)&&b[f0]?d.push(b):d.length?a.push(b):n.push(b)}if(d.length){if(d.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(f.length<n.length+a.length)return!1;const s=f.slice(0,n.length),b=a.length===0?[]:f.slice(-a.length),r=f.slice(n.length,a.length===0?1/0:-a.length);return n.every((o,h)=>g(o,s[h],e))&&a.every((o,h)=>g(o,b[h],e))&&(d.length===0||g(d[0],r,e))}return t.length===f.length&&t.every((s,b)=>g(s,f[b],e))}return Reflect.ownKeys(t).every(n=>{const a=t[n];return(n in f||N(d=a)&&d[x]().matcherType==="optional")&&g(a,f[n],e);var d})}return Object.is(f,t)},T=t=>{var f,e,n;return B(t)?N(t)?(f=(e=(n=t[x]()).getSelectionKeys)==null?void 0:e.call(n))!=null?f:[]:Array.isArray(t)?S(t,T):S(Object.values(t),T):[]},S=(t,f)=>t.reduce((e,n)=>e.concat(f(n)),[]);function y(t){return Object.assign(t,{optional:()=>e0(t),and:f=>c(t,f),or:f=>t0(t,f),select:f=>f===void 0?q(t):q(f,t)})}function e0(t){return y({[x]:()=>({match:f=>{let e={};const n=(a,d)=>{e[a]=d};return f===void 0?(T(t).forEach(a=>n(a,void 0)),{matched:!0,selections:e}):{matched:g(t,f,n),selections:e}},getSelectionKeys:()=>T(t),matcherType:"optional"})})}function c(...t){return y({[x]:()=>({match:f=>{let e={};const n=(a,d)=>{e[a]=d};return{matched:t.every(a=>g(a,f,n)),selections:e}},getSelectionKeys:()=>S(t,T),matcherType:"and"})})}function t0(...t){return y({[x]:()=>({match:f=>{let e={};const n=(a,d)=>{e[a]=d};return S(t,T).forEach(a=>n(a,void 0)),{matched:t.some(a=>g(a,f,n)),selections:e}},getSelectionKeys:()=>S(t,T),matcherType:"or"})})}function i(t){return{[x]:()=>({match:f=>({matched:!!t(f)})})}}function q(...t){const f=typeof t[0]=="string"?t[0]:void 0,e=t.length===2?t[1]:typeof t[0]=="string"?void 0:t[0];return y({[x]:()=>({match:n=>{let a={[f??P]:n};return{matched:e===void 0||g(e,n,(d,s)=>{a[d]=s}),selections:a}},getSelectionKeys:()=>[f??P].concat(e===void 0?[]:T(e))})})}function l(t){return typeof t=="number"}function w(t){return typeof t=="string"}function v(t){return typeof t=="bigint"}y(i(function(t){return!0}));const A=t=>Object.assign(y(t),{startsWith:f=>{return A(c(t,(e=f,i(n=>w(n)&&n.startsWith(e)))));var e},endsWith:f=>{return A(c(t,(e=f,i(n=>w(n)&&n.endsWith(e)))));var e},minLength:f=>A(c(t,(e=>i(n=>w(n)&&n.length>=e))(f))),length:f=>A(c(t,(e=>i(n=>w(n)&&n.length===e))(f))),maxLength:f=>A(c(t,(e=>i(n=>w(n)&&n.length<=e))(f))),includes:f=>{return A(c(t,(e=f,i(n=>w(n)&&n.includes(e)))));var e},regex:f=>{return A(c(t,(e=f,i(n=>w(n)&&!!n.match(e)))));var e}});A(i(w));const m=t=>Object.assign(y(t),{between:(f,e)=>m(c(t,((n,a)=>i(d=>l(d)&&n<=d&&a>=d))(f,e))),lt:f=>m(c(t,(e=>i(n=>l(n)&&n<e))(f))),gt:f=>m(c(t,(e=>i(n=>l(n)&&n>e))(f))),lte:f=>m(c(t,(e=>i(n=>l(n)&&n<=e))(f))),gte:f=>m(c(t,(e=>i(n=>l(n)&&n>=e))(f))),int:()=>m(c(t,i(f=>l(f)&&Number.isInteger(f)))),finite:()=>m(c(t,i(f=>l(f)&&Number.isFinite(f)))),positive:()=>m(c(t,i(f=>l(f)&&f>0))),negative:()=>m(c(t,i(f=>l(f)&&f<0)))});m(i(l));const I=t=>Object.assign(y(t),{between:(f,e)=>I(c(t,((n,a)=>i(d=>v(d)&&n<=d&&a>=d))(f,e))),lt:f=>I(c(t,(e=>i(n=>v(n)&&n<e))(f))),gt:f=>I(c(t,(e=>i(n=>v(n)&&n>e))(f))),lte:f=>I(c(t,(e=>i(n=>v(n)&&n<=e))(f))),gte:f=>I(c(t,(e=>i(n=>v(n)&&n>=e))(f))),positive:()=>I(c(t,i(f=>v(f)&&f>0))),negative:()=>I(c(t,i(f=>v(f)&&f<0)))});I(i(v));y(i(function(t){return typeof t=="boolean"}));y(i(function(t){return typeof t=="symbol"}));y(i(function(t){return t==null}));y(i(function(t){return t!=null}));class n0 extends Error{constructor(f){let e;try{e=JSON.stringify(f)}catch{e=f}super(`Pattern matching error: no pattern matches value ${e}`),this.input=void 0,this.input=f}}const _={matched:!1,value:void 0};function U(t){return new R(t,_)}class R{constructor(f,e){this.input=void 0,this.state=void 0,this.input=f,this.state=e}with(...f){if(this.state.matched)return this;const e=f[f.length-1],n=[f[0]];let a;f.length===3&&typeof f[1]=="function"?a=f[1]:f.length>2&&n.push(...f.slice(1,f.length-1));let d=!1,s={};const b=(o,h)=>{d=!0,s[o]=h},r=!n.some(o=>g(o,this.input,b))||a&&!a(this.input)?_:{matched:!0,value:e(d?P in s?s[P]:s:this.input,this.input)};return new R(this.input,r)}when(f,e){if(this.state.matched)return this;const n=!!f(this.input);return new R(this.input,n?{matched:!0,value:e(this.input,this.input)}:_)}otherwise(f){return this.state.matched?this.state.value:f(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new n0(this.input)}run(){return this.exhaustive()}returnType(){return this}}var H=(t=>(t[t.EQUAL=0]="EQUAL",t[t.NOT_EQUAL=1]="NOT_EQUAL",t[t.GREATER_THAN=2]="GREATER_THAN",t[t.LESS_THAN=3]="LESS_THAN",t[t.CONTAINS=4]="CONTAINS",t[t.REGEX=5]="REGEX",t))(H||{}),G=(t=>(t[t.UINT=0]="UINT",t[t.ADDRESS=1]="ADDRESS",t[t.BYTES=2]="BYTES",t[t.STRING=3]="STRING",t))(G||{}),j=(t=>(t[t.EVENT=0]="EVENT",t[t.FUNC=1]="FUNC",t))(j||{});function K(t){return Array.isArray(t.actionSteps)}const D=class D extends X.DeployableTarget{constructor(){super(...arguments),this.abi=E.X}async getActionStep(f,e){return(await this.getActionSteps(e)).at(f)}async getActionSteps(f){const e=await E.zI(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...f});return a0(e.map(F))}async getActionStepsCount(f){return(await this.getActionSteps(f)).length}async getActionClaimant(f){const e=await E.EI(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...f});return F(e)}async execute(f,e){return await this.awaitResult(this.executeRaw(f,e))}async executeRaw(f,e){const{request:n,result:a}=await E.DI(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...e,args:[f]});return{hash:await E.VI(this._config,n),result:a}}async deriveActionClaimantFromTransaction(f,e){const n=f.signature;if(f.signatureType===0){let a;if(e.abiItem?a=e.abiItem:a={...M.abi,...e.knownSignatures||{}}[n],!a)throw new u.ValidationAbiMissingError(n);let d;if("logs"in e){for(let r of e.logs){if(!p.isAddressEqual(r.address,f.targetContract))continue;let o=this.validateClaimantAgainstArgs(f,r);o&&(d=o)}return d}const b=(await L.getTransactionReceipt(this._config,e)).logs.map(r=>{const{eventName:o,args:h}=p.decodeEventLog({abi:[a],data:r.data,topics:r.topics});return{...r,eventName:o,args:h}});for(let r of b){if(!p.isAddressEqual(r.address,f.targetContract))continue;let o=this.validateClaimantAgainstArgs(f,r);o&&(d=o)}return d}if(f.signatureType===1&&"hash"in e&&"chainId"in e){const a=await L.getTransaction(this._config,{hash:e.hash});if(!p.isAddressEqual(a.to,f.targetContract))return;let d;if(e.abiItem?d=e.abiItem:d={...V.abi,...e.knownSignatures||{}}[n],!d)throw new u.ValidationAbiMissingError(f.signature);let s;try{s=p.decodeFunctionData({abi:[d],data:a.input})}catch(b){throw new u.FunctionDataDecodeError([d],b)}return this.validateClaimantAgainstArgs(f,s)}}validateClaimantAgainstArgs(f,e){if(!e||!Array.isArray(e==null?void 0:e.args)||(e==null?void 0:e.args.length)<=f.fieldIndex)return;const n=e.args.at(f.fieldIndex);if(p.isAddress(n))return n}async validateActionSteps(f){const e=await this.getActionSteps();for(const n of e)if(!await this.isActionStepValid(n,f))return!1;return!0}async isActionStepValid(f,e){if(f.signatureType===0){const n=f.signature;let a;if(e.abiItem?a=e.abiItem:a={...M.abi,...e.knownSignatures||{}}[n],!a)throw new u.ValidationAbiMissingError(n);if(this.isArraylikeIndexed(f,a))throw new u.UnparseableAbiParamError(f.actionParameter.fieldIndex,a);if("logs"in e)return this.isActionEventValid(f,e.logs);const b=(await this._config.getClient({chainId:e.chainId}).getTransactionReceipt({hash:e.hash})).logs.map(r=>{const{eventName:o,args:h}=p.decodeEventLog({abi:[a],data:r.data,topics:r.topics});return{...r,eventName:o,args:h}});return this.isActionEventValid(f,b)}if(f.signatureType===1&&"hash"in e&&"chainId"in e){const a=await this._config.getClient({chainId:e.chainId}).getTransaction({hash:e.hash});return this.isActionFunctionValid(f,a,e)}return!1}isActionEventValid(f,e){const n=f.actionParameter;if(!e.length)return!1;for(let a of e)if(this.validateLogAgainstCriteria(n,a))return!0;return!1}isActionFunctionValid(f,e,n){const a=f.actionParameter;let d=f.signature,s;if(n!=null&&n.abiItem?s=n==null?void 0:n.abiItem:s={...V.abi,...(n==null?void 0:n.knownSignatures)||{}}[d],!s)throw new u.ValidationAbiMissingError(d);let b;try{b=p.decodeFunctionData({abi:[s],data:e.input})}catch(o){throw new u.FunctionDataDecodeError([s],o)}const r=b.args;return!(!r||!b||!this.validateFunctionAgainstCriteria(a,r))}validateFieldAgainstCriteria(f,e,n){switch(f.filterType){case 0:return U(f.fieldType).with(1,()=>p.isAddressEqual(f.filterData,e)).with(0,()=>BigInt(e)===BigInt(f.filterData)).with(3,()=>e===p.fromHex(f.filterData,"string")).otherwise(()=>e===f.filterData);case 1:return U(f.fieldType).with(1,()=>!p.isAddressEqual(f.filterData,e)).with(0,()=>BigInt(e)!==BigInt(f.filterData)).with(3,()=>e!==p.fromHex(f.filterData,"string")).otherwise(()=>e!==f.filterData);case 2:if(f.fieldType===0)return BigInt(e)>BigInt(f.filterData);throw new u.InvalidNumericalCriteriaError({...n,criteria:f,fieldValue:e});case 3:if(f.fieldType===0)return BigInt(e)<BigInt(f.filterData);throw new u.InvalidNumericalCriteriaError({...n,criteria:f,fieldValue:e});case 4:if(f.fieldType===2||f.fieldType===3){let a;return f.fieldType===3?a=p.fromHex(f.filterData,"string"):a=f.filterData.slice(2),e.includes(a)}throw new u.FieldValueNotComparableError({...n,criteria:f,fieldValue:e});case 5:if(typeof e!="string")throw new u.FieldValueNotComparableError({...n,criteria:f,fieldValue:e});if(f.fieldType===3){const a=p.fromHex(f.filterData,"string");return new RegExp(a).test(e)}default:throw new u.UnrecognizedFilterTypeError({...n,criteria:f,fieldValue:e})}}validateLogAgainstCriteria(f,e){if(!Array.isArray(e.args)||e.args.length<=f.fieldIndex)throw new u.DecodedArgsMalformedError({log:e,criteria:f,fieldValue:void 0});const n=e.args.at(f.fieldIndex);if(n===void 0)throw new u.FieldValueUndefinedError({log:e,criteria:f,fieldValue:n});return this.validateFieldAgainstCriteria(f,n,{log:e})}validateFunctionAgainstCriteria(f,e){const n=e[f.fieldIndex];if(n===void 0)throw new u.FieldValueUndefinedError({criteria:f,fieldValue:n});return this.validateFieldAgainstCriteria(f,n,{decodedArgs:e})}buildParameters(f,e){const[n,a]=this.validateDeploymentConfig(f,e);let d;if(K(n)){let s=n.actionSteps.filter(r=>!!r);if(s.length===0)throw new u.NoEventActionStepsProvidedError;if(s.length>4)throw new u.TooManyEventActionStepsProvidedError;let b=Array.from({length:4},(r,o)=>s.at(o)||s.at(-1));d={actionClaimant:n.actionClaimant,actionStepOne:b[0],actionStepTwo:b[1],actionStepThree:b[2],actionStepFour:b[3]}}else d=n;return{abi:E.X,bytecode:$,args:[O(d)],...this.optionallyAttachAccount(a.account)}}isArraylikeIndexed(f,e){var n;return!!((f.actionParameter.fieldType===3||f.actionParameter.fieldType===2)&&((n=e.inputs[f.actionParameter.fieldIndex])!=null&&n.indexed))}};D.bases={...W.EventAction},D.registryType=Q.RegistryType.ACTION;let k=D;function a0(t){const f=[],e={};for(let n of t){const a=JSON.stringify(n);e[a]||(f.push(n),e[a]=!0)}return f}function C(t){return{...t,chainid:BigInt(t.chainid)}}function F(t){if(t.chainid>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Chain ID exceeds max safe integer");return{...t,chainid:Number(t.chainid)}}function O({actionClaimant:t,actionStepOne:f,actionStepTwo:e,actionStepThree:n,actionStepFour:a}){return p.encodeAbiParameters([{type:"tuple",name:"initPayload",components:[{type:"tuple",name:"actionClaimant",components:[{type:"uint8",name:"signatureType"},{type:"bytes32",name:"signature"},{type:"uint8",name:"fieldIndex"},{type:"address",name:"targetContract"},{type:"uint256",name:"chainid"}]},{type:"tuple",name:"actionStepOne",components:[{type:"bytes32",name:"signature"},{type:"uint8",name:"signatureType"},{type:"uint8",name:"actionType"},{type:"address",name:"targetContract"},{type:"uint256",name:"chainid"},{type:"tuple",name:"actionParameter",components:[{type:"uint8",name:"filterType"},{type:"uint8",name:"fieldType"},{type:"uint8",name:"fieldIndex"},{type:"bytes",name:"filterData"}]}]},{type:"tuple",name:"actionStepTwo",components:[{type:"bytes32",name:"signature"},{type:"uint8",name:"signatureType"},{type:"uint8",name:"actionType"},{type:"address",name:"targetContract"},{type:"uint256",name:"chainid"},{type:"tuple",name:"actionParameter",components:[{type:"uint8",name:"filterType"},{type:"uint8",name:"fieldType"},{type:"uint8",name:"fieldIndex"},{type:"bytes",name:"filterData"}]}]},{type:"tuple",name:"actionStepThree",components:[{type:"bytes32",name:"signature"},{type:"uint8",name:"signatureType"},{type:"uint8",name:"actionType"},{type:"address",name:"targetContract"},{type:"uint256",name:"chainid"},{type:"tuple",name:"actionParameter",components:[{type:"uint8",name:"filterType"},{type:"uint8",name:"fieldType"},{type:"uint8",name:"fieldIndex"},{type:"bytes",name:"filterData"}]}]},{type:"tuple",name:"actionStepFour",components:[{type:"bytes32",name:"signature"},{type:"uint8",name:"signatureType"},{type:"uint8",name:"actionType"},{type:"address",name:"targetContract"},{type:"uint256",name:"chainid"},{type:"tuple",name:"actionParameter",components:[{type:"uint8",name:"filterType"},{type:"uint8",name:"fieldType"},{type:"uint8",name:"fieldIndex"},{type:"bytes",name:"filterData"}]}]}]}],[{actionClaimant:C(t),actionStepOne:{...C(f),actionType:f.actionType||0},actionStepTwo:{...C(e),actionType:e.actionType||0},actionStepThree:{...C(n),actionType:n.actionType||0},actionStepFour:{...C(a),actionType:a.actionType||0}}])}exports.EventAction=k;exports.FilterType=H;exports.PrimitiveType=G;exports.SignatureType=j;exports.events=M;exports.functions=V;exports.isEventActionPayloadSimple=K;exports.prepareEventActionPayload=O;
|
|
2
|
+
//# sourceMappingURL=EventAction-CBKzuNoN.cjs.map
|