@boostxyz/sdk 2.0.0-alpha.27 → 2.0.0-alpha.28

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.
@@ -1 +1 @@
1
- {"version":3,"file":"EventAction.js","sources":["../../../../node_modules/.pnpm/ts-pattern@5.4.0/node_modules/ts-pattern/dist/index.js","../../src/Actions/EventAction.ts"],"sourcesContent":["const t=Symbol.for(\"@ts-pattern/matcher\"),e=Symbol.for(\"@ts-pattern/isVariadic\"),n=\"@ts-pattern/anonymous-select-key\",r=t=>Boolean(t&&\"object\"==typeof t),i=e=>e&&!!e[t],s=(n,o,c)=>{if(i(n)){const e=n[t](),{matched:r,selections:i}=e.match(o);return r&&i&&Object.keys(i).forEach(t=>c(t,i[t])),r}if(r(n)){if(!r(o))return!1;if(Array.isArray(n)){if(!Array.isArray(o))return!1;let t=[],r=[],a=[];for(const s of n.keys()){const o=n[s];i(o)&&o[e]?a.push(o):a.length?r.push(o):t.push(o)}if(a.length){if(a.length>1)throw new Error(\"Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.\");if(o.length<t.length+r.length)return!1;const e=o.slice(0,t.length),n=0===r.length?[]:o.slice(-r.length),i=o.slice(t.length,0===r.length?Infinity:-r.length);return t.every((t,n)=>s(t,e[n],c))&&r.every((t,e)=>s(t,n[e],c))&&(0===a.length||s(a[0],i,c))}return n.length===o.length&&n.every((t,e)=>s(t,o[e],c))}return Reflect.ownKeys(n).every(e=>{const r=n[e];return(e in o||i(a=r)&&\"optional\"===a[t]().matcherType)&&s(r,o[e],c);var a})}return Object.is(o,n)},o=e=>{var n,s,a;return r(e)?i(e)?null!=(n=null==(s=(a=e[t]()).getSelectionKeys)?void 0:s.call(a))?n:[]:Array.isArray(e)?c(e,o):c(Object.values(e),o):[]},c=(t,e)=>t.reduce((t,n)=>t.concat(e(n)),[]);function a(...t){if(1===t.length){const[e]=t;return t=>s(e,t,()=>{})}if(2===t.length){const[e,n]=t;return s(e,n,()=>{})}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t.length}.`)}function u(t){return Object.assign(t,{optional:()=>h(t),and:e=>m(t,e),or:e=>d(t,e),select:e=>void 0===e?y(t):y(e,t)})}function l(t){return Object.assign((t=>Object.assign(t,{[Symbol.iterator](){let n=0;const r=[{value:Object.assign(t,{[e]:!0}),done:!1},{done:!0,value:void 0}];return{next:()=>{var t;return null!=(t=r[n++])?t:r.at(-1)}}}}))(t),{optional:()=>l(h(t)),select:e=>l(void 0===e?y(t):y(e,t))})}function h(e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e};return void 0===t?(o(e).forEach(t=>r(t,void 0)),{matched:!0,selections:n}):{matched:s(e,t,r),selections:n}},getSelectionKeys:()=>o(e),matcherType:\"optional\"})})}const f=(t,e)=>{for(const n of t)if(!e(n))return!1;return!0},g=(t,e)=>{for(const[n,r]of t.entries())if(!e(r,n))return!1;return!0};function m(...e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e};return{matched:e.every(e=>s(e,t,r)),selections:n}},getSelectionKeys:()=>c(e,o),matcherType:\"and\"})})}function d(...e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e};return c(e,o).forEach(t=>r(t,void 0)),{matched:e.some(e=>s(e,t,r)),selections:n}},getSelectionKeys:()=>c(e,o),matcherType:\"or\"})})}function p(e){return{[t]:()=>({match:t=>({matched:Boolean(e(t))})})}}function y(...e){const r=\"string\"==typeof e[0]?e[0]:void 0,i=2===e.length?e[1]:\"string\"==typeof e[0]?void 0:e[0];return u({[t]:()=>({match:t=>{let e={[null!=r?r:n]:t};return{matched:void 0===i||s(i,t,(t,n)=>{e[t]=n}),selections:e}},getSelectionKeys:()=>[null!=r?r:n].concat(void 0===i?[]:o(i))})})}function v(t){return\"number\"==typeof t}function b(t){return\"string\"==typeof t}function w(t){return\"bigint\"==typeof t}const S=u(p(function(t){return!0})),O=S,j=t=>Object.assign(u(t),{startsWith:e=>{return j(m(t,(n=e,p(t=>b(t)&&t.startsWith(n)))));var n},endsWith:e=>{return j(m(t,(n=e,p(t=>b(t)&&t.endsWith(n)))));var n},minLength:e=>j(m(t,(t=>p(e=>b(e)&&e.length>=t))(e))),length:e=>j(m(t,(t=>p(e=>b(e)&&e.length===t))(e))),maxLength:e=>j(m(t,(t=>p(e=>b(e)&&e.length<=t))(e))),includes:e=>{return j(m(t,(n=e,p(t=>b(t)&&t.includes(n)))));var n},regex:e=>{return j(m(t,(n=e,p(t=>b(t)&&Boolean(t.match(n))))));var n}}),K=j(p(b)),x=t=>Object.assign(u(t),{between:(e,n)=>x(m(t,((t,e)=>p(n=>v(n)&&t<=n&&e>=n))(e,n))),lt:e=>x(m(t,(t=>p(e=>v(e)&&e<t))(e))),gt:e=>x(m(t,(t=>p(e=>v(e)&&e>t))(e))),lte:e=>x(m(t,(t=>p(e=>v(e)&&e<=t))(e))),gte:e=>x(m(t,(t=>p(e=>v(e)&&e>=t))(e))),int:()=>x(m(t,p(t=>v(t)&&Number.isInteger(t)))),finite:()=>x(m(t,p(t=>v(t)&&Number.isFinite(t)))),positive:()=>x(m(t,p(t=>v(t)&&t>0))),negative:()=>x(m(t,p(t=>v(t)&&t<0)))}),E=x(p(v)),A=t=>Object.assign(u(t),{between:(e,n)=>A(m(t,((t,e)=>p(n=>w(n)&&t<=n&&e>=n))(e,n))),lt:e=>A(m(t,(t=>p(e=>w(e)&&e<t))(e))),gt:e=>A(m(t,(t=>p(e=>w(e)&&e>t))(e))),lte:e=>A(m(t,(t=>p(e=>w(e)&&e<=t))(e))),gte:e=>A(m(t,(t=>p(e=>w(e)&&e>=t))(e))),positive:()=>A(m(t,p(t=>w(t)&&t>0))),negative:()=>A(m(t,p(t=>w(t)&&t<0)))}),P=A(p(w)),T=u(p(function(t){return\"boolean\"==typeof t})),B=u(p(function(t){return\"symbol\"==typeof t})),_=u(p(function(t){return null==t})),k=u(p(function(t){return null!=t}));var N={__proto__:null,matcher:t,optional:h,array:function(...e){return l({[t]:()=>({match:t=>{if(!Array.isArray(t))return{matched:!1};if(0===e.length)return{matched:!0};const n=e[0];let r={};if(0===t.length)return o(n).forEach(t=>{r[t]=[]}),{matched:!0,selections:r};const i=(t,e)=>{r[t]=(r[t]||[]).concat([e])};return{matched:t.every(t=>s(n,t,i)),selections:r}},getSelectionKeys:()=>0===e.length?[]:o(e[0])})})},set:function(...e){return u({[t]:()=>({match:t=>{if(!(t instanceof Set))return{matched:!1};let n={};if(0===t.size)return{matched:!0,selections:n};if(0===e.length)return{matched:!0};const r=(t,e)=>{n[t]=(n[t]||[]).concat([e])},i=e[0];return{matched:f(t,t=>s(i,t,r)),selections:n}},getSelectionKeys:()=>0===e.length?[]:o(e[0])})})},map:function(...e){return u({[t]:()=>({match:t=>{if(!(t instanceof Map))return{matched:!1};let n={};if(0===t.size)return{matched:!0,selections:n};const r=(t,e)=>{n[t]=(n[t]||[]).concat([e])};if(0===e.length)return{matched:!0};var i;if(1===e.length)throw new Error(`\\`P.map\\` wasn't given enough arguments. Expected (key, value), received ${null==(i=e[0])?void 0:i.toString()}`);const[o,c]=e;return{matched:g(t,(t,e)=>{const n=s(o,e,r),i=s(c,t,r);return n&&i}),selections:n}},getSelectionKeys:()=>0===e.length?[]:[...o(e[0]),...o(e[1])]})})},intersection:m,union:d,not:function(e){return u({[t]:()=>({match:t=>({matched:!s(e,t,()=>{})}),getSelectionKeys:()=>[],matcherType:\"not\"})})},when:p,select:y,any:S,_:O,string:K,number:E,bigint:P,boolean:T,symbol:B,nullish:_,nonNullable:k,instanceOf:function(t){return u(p(function(t){return e=>e instanceof t}(t)))},shape:function(t){return u(p(a(t)))}};class W extends Error{constructor(t){let e;try{e=JSON.stringify(t)}catch(n){e=t}super(`Pattern matching error: no pattern matches value ${e}`),this.input=void 0,this.input=t}}const $={matched:!1,value:void 0};function z(t){return new I(t,$)}class I{constructor(t,e){this.input=void 0,this.state=void 0,this.input=t,this.state=e}with(...t){if(this.state.matched)return this;const e=t[t.length-1],r=[t[0]];let i;3===t.length&&\"function\"==typeof t[1]?i=t[1]:t.length>2&&r.push(...t.slice(1,t.length-1));let o=!1,c={};const a=(t,e)=>{o=!0,c[t]=e},u=!r.some(t=>s(t,this.input,a))||i&&!Boolean(i(this.input))?$:{matched:!0,value:e(o?n in c?c[n]:c:this.input,this.input)};return new I(this.input,u)}when(t,e){if(this.state.matched)return this;const n=Boolean(t(this.input));return new I(this.input,n?{matched:!0,value:e(this.input,this.input)}:$)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new W(this.input)}run(){return this.exhaustive()}returnType(){return this}}export{W as NonExhaustiveError,N as P,N as Pattern,a as isMatching,z as match};\n//# sourceMappingURL=index.js.map\n","import {\n eventActionAbi,\n readEventActionGetActionClaimant,\n readEventActionGetActionSteps,\n simulateEventActionExecute,\n writeEventActionExecute,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/actions/EventAction.sol/EventAction.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport { match } from 'ts-pattern';\nimport {\n type AbiEvent,\n type AbiFunction,\n AbiItem,\n type Address,\n type ContractFunctionName,\n type GetLogsReturnType,\n type GetTransactionParameters,\n type Hex,\n type Log,\n type Transaction,\n decodeEventLog,\n decodeFunctionData,\n encodeAbiParameters,\n fromHex,\n isAddress,\n isAddressEqual,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { EventAction as EventActionBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n DecodedArgsMalformedError,\n FieldValueNotComparableError,\n FieldValueUndefinedError,\n FunctionDataDecodeError,\n InvalidNumericalCriteriaError,\n NoEventActionStepsProvidedError,\n TooManyEventActionStepsProvidedError,\n UnparseableAbiParamError,\n UnrecognizedFilterTypeError,\n ValidationAbiMissingError,\n} from '../errors';\nimport {\n CheatCodes,\n type Overwrite,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\n/*\n * Action Event Payloads\n */\n\n/**\n * Filter types used to determine how criteria are evaluated.\n *\n * @export\n * @enum {number}\n */\nexport enum FilterType {\n EQUAL = 0,\n NOT_EQUAL = 1,\n GREATER_THAN = 2,\n LESS_THAN = 3,\n CONTAINS = 4,\n REGEX = 5,\n}\n\n/**\n * The primitive types supported for filtering.\n *\n * @export\n * @enum {number}\n */\nexport enum PrimitiveType {\n UINT = 0,\n ADDRESS = 1,\n BYTES = 2,\n STRING = 3,\n}\n\n/**\n * Object representation of a `Criteria` struct used in event actions.\n *\n * @export\n * @interface Criteria\n * @typedef {Criteria}\n */\nexport interface Criteria {\n /**\n * The filter type used in this criteria.\n *\n * @type {FilterType}\n */\n filterType: FilterType;\n /**\n * The primitive type of the field being filtered.\n *\n * @type {PrimitiveType}\n */\n fieldType: PrimitiveType;\n /**\n * The index in the logs argument array where the field is located.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The filter data used for complex filtering.\n *\n * @type {Hex}\n */\n filterData: Hex;\n}\n\n/**\n * Whether a given signature is an event or function\n *\n * @export\n * @enum {number}\n */\nexport enum SignatureType {\n EVENT = 0,\n FUNC = 1,\n}\n\n/**\n * The payload describing how claimants are identified\n *\n * @export\n * @interface ActionClaimant\n * @typedef {ActionClaimant}\n */\nexport interface ActionClaimant {\n /**\n * Whether claimaint is inferred from event or function\n *\n * @type {SignatureType}\n */\n signatureType: SignatureType;\n /**\n * The 4 byte signature of the event or function\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * The index corresponding to claimant.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The address of the target contract\n *\n * @type {Address}\n */\n targetContract: Address;\n /**\n * The chain id of the target contract.\n * @type {number}\n */\n chainid: number;\n}\n\n/**\n * Object representation of an `ActionStep` struct used in event actions.\n *\n * @export\n * @interface ActionStep\n * @typedef {ActionStep}\n */\nexport interface ActionStep {\n /**\n * The signature of the event.\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * Whether claimaint is inferred from event or function\n *\n * @type {SignatureType}\n */\n signatureType: SignatureType;\n /**\n * The type of action being performed.\n *\n * @type {number}\n */\n actionType?: number;\n /**\n * The address of the target contract.\n *\n * @type {Address}\n */\n targetContract: Address;\n /**\n * The chain id of the target contract.\n * @type {number}\n */\n chainid: number;\n /**\n * The criteria used for this action step.\n *\n * @type {Criteria}\n */\n actionParameter: Criteria;\n}\n\n/**\n * Parameters for validating an action step.\n *\n * @typedef {Object} ValidateActionStepParams\n * @property {Record<Hex, AbiEvent | AbiFunction>} [knownSignatures] - Record of known events, keyed by 32 byte selectors. You can use [@boostxyz/signatures](https://www.npmjs.com/package/@boostxyz/signatures) to assemble this parameter.\n * @property {AbiEvent | AbiFunction} [abiItem] - Optional ABI item definition.\n * @property {EventLogs} [logs] - Event logs to validate against. Required if 'hash' is not provided.\n * @property {Hex} [hash] - Transaction hash to validate against. Required if 'logs' is not provided.\n */\nexport type ValidateActionStepParams = {\n knownSignatures: Record<Hex, AbiEvent | AbiFunction>;\n abiItem?: AbiEvent | AbiFunction;\n} & ({ logs: EventLogs } | (GetTransactionParameters & { hash: Hex }));\n\n/**\n * You can either supply a simplified version of the payload, or one that explicitly declares action steps.\n *\n * @export\n * @typedef {EventActionPayload}\n */\nexport type EventActionPayload =\n | EventActionPayloadSimple\n | EventActionPayloadRaw;\n\nexport interface EventActionPayloadSimple {\n /**\n * The payload describing how claimants are identified\n *\n * @type {ActionClaimant}\n */\n actionClaimant: ActionClaimant;\n\n /**\n * Up to 4 action steps.\n * If you supply less than 4, then the last step will be reused to satisfy the EventAction.InitPayload\n * Any more than 4 will throw an error.\n *\n * @type {ActionStep[]}\n */\n actionSteps: ActionStep[];\n}\n\nexport type ActionStepTuple = [ActionStep, ActionStep, ActionStep, ActionStep];\n\n/**\n * Typeguard to determine if a user is supplying a simple or raw EventActionPayload\n *\n * @param {*} opts\n * @returns {opts is EventActionPayloadSimple}\n */\nexport function isEventActionPayloadSimple(\n opts: EventActionPayload,\n): opts is EventActionPayloadSimple {\n return Array.isArray((opts as EventActionPayloadSimple).actionSteps);\n}\n\n/**\n * Object representation of an `InitPayload` struct used to initialize event actions.\n *\n * @export\n * @interface EventActionPayloadRaw\n * @typedef {EventActionPayloadRaw}\n */\nexport interface EventActionPayloadRaw {\n /**\n * The payload describing how claimants are identified\n *\n * @type {ActionClaimant}\n */\n actionClaimant: ActionClaimant;\n /**\n * The first action step.\n *\n * @type {ActionStep}\n */\n actionStepOne: ActionStep;\n /**\n * The second action step.\n *\n * @type {ActionStep}\n */\n actionStepTwo: ActionStep;\n /**\n * The third action step.\n *\n * @type {ActionStep}\n */\n actionStepThree: ActionStep;\n /**\n * The fourth action step.\n *\n * @type {ActionStep}\n */\n actionStepFour: ActionStep;\n}\n\n/**\n * Array of event logs to pass into TxParams\n * @export\n * @typedef {EventLogs}\n */\nexport type EventLogs = GetLogsReturnType<AbiEvent, AbiEvent[], true>;\n\n/**\n * Getter params from the event action contract\n *\n * @export\n * @typedef {ReadEventActionParams}\n * @param {fnName} fnName - The getter function name\n */\nexport type ReadEventActionParams<\n fnName extends ContractFunctionName<typeof eventActionAbi, 'pure' | 'view'>,\n> = ReadParams<typeof eventActionAbi, fnName>;\n\n/**\n * A generic event action\n *\n * @export\n * @class EventAction\n * @typedef {EventAction}\n * @extends {DeployableTarget<EventActionPayload>}\n */\nexport class EventAction extends DeployableTarget<\n EventActionPayload,\n typeof eventActionAbi\n> {\n /**\n * @inheritdoc\n *\n * @public\n * @readonly\n * @type {*}\n */\n public override readonly abi = eventActionAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_EVENT_ACTION_BASE,\n ...(EventActionBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.ACTION;\n\n /**\n * Gets a specific action event by index\n *\n * @public\n * @async\n * @param {number} index The index of the action event to retrieve\n * @param {?ReadEventActionParams<'getActionStep'>} [params]\n * @returns {Promise<ActionStep>}\n */\n public async getActionStep(\n index: number,\n params?: ReadEventActionParams<'getActionStep'>,\n ) {\n const steps = await this.getActionSteps(params);\n return steps.at(index);\n }\n\n /**\n * Gets all action events\n *\n * @public\n * @async\n * @param {?ReadEventActionParams<'getActionSteps'>} [params]\n * @returns {Promise<ActionStep[]>}\n */\n public async getActionSteps(\n params?: ReadEventActionParams<'getActionSteps'>,\n ) {\n const steps = (await readEventActionGetActionSteps(this._config, {\n address: this.assertValidAddress(),\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 })) as RawActionStep[];\n return _dedupeActionSteps(steps.map(_fromRawActionStep));\n }\n\n /**\n * Gets the count of action events\n *\n * @public\n * @async\n * @param {?ReadEventActionParams<'getActionStepsCount'>} [params]\n * @returns {Promise<bigint>}\n */\n public async getActionStepsCount(\n params?: ReadEventActionParams<'getActionStepsCount'>,\n ) {\n const steps = await this.getActionSteps(params);\n return steps.length;\n }\n\n /**\n * Retrieves the payload describing how claimants can be identified from logs or function calls.\n *\n * @public\n * @async\n * @param {?ReadEventActionParams<'getActionClaimant'>} [params]\n * @returns {Promise<ActionClaimant>}\n */\n public async getActionClaimant(\n params?: ReadEventActionParams<'getActionClaimant'>,\n ): Promise<ActionClaimant> {\n const result = (await readEventActionGetActionClaimant(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n ...params,\n })) as RawActionClaimant;\n return _fromRawActionStep(result);\n }\n\n /**\n * Executes a prepared event action\n *\n * @public\n * @async\n * @param {Hex} data\n * @param {?WriteParams} [params]\n * @returns {Promise<readonly [boolean, `0x${string}`]>}\n */\n public async execute(\n data: Hex,\n params?: WriteParams<typeof eventActionAbi, 'execute'>,\n ) {\n return await this.awaitResult(this.executeRaw(data, params));\n }\n\n /**\n * Executes a prepared event action\n *\n * @public\n * @async\n * @param {Hex} data\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: readonly [boolean, `0x${string}`]; }>}\n */\n public async executeRaw(\n data: Hex,\n params?: WriteParams<typeof eventActionAbi, 'execute'>,\n ) {\n const { request, result } = await simulateEventActionExecute(this._config, {\n address: this.assertValidAddress(),\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 args: [data],\n });\n const hash = await writeEventActionExecute(this._config, request);\n return { hash, result };\n }\n\n /**\n * Derives the action claimant address from a transaction based on the provided ActionClaimant configuration.\n * This method supports both event-based and function-based claimant derivation.\n * **Important**: The claimant is considered to be `transaction.from` when `claimant.fieldIndex` is 255 using CheatCodes enum.\n * This may have unintended side effects for bridged transactions and SCW transactions, so these are considered unsupported use cases for the time being.\n *\n ** @example\n * // Example usage\n * const eventAction = boost.action as EventAction\n * const claimant = await eventAction.getActionClaimant() // {\n * signatureType: SignatureType.EVENT,\n * signature: '0x1234...',\n * fieldIndex: 2,\n * targetContract: '0xabcd...',\n * chainid: 1\n * };\n * const params: ValidateActionStepParams = {\n * hash: '0x5678...',\n * chainId: 1,\n * knownSignatures: {\n * '0x1234...': {\n * type: 'event',\n * name: 'Transfer(...)'\n * }\n * }\n * };\n * const claimantAddress = await eventAction.deriveActionClaimantFromTransaction(claimant, params);\n *\n * @param {ActionClaimant} claimant - The configuration specifying how to derive the claimant.\n * @param {ValidateActionStepParams} params - Parameters for validation, including transaction hash, known signatures, logs, and chain ID.\n * @returns {Promise<Address | undefined>} The derived claimant address if found, undefined otherwise.\n * @throws {ValidationAbiMissingError} If the ABI for the specified signature is not found.\n * @throws {FunctionDataDecodeError} If there's an error decoding function data (for function-based derivation).\n */\n public async deriveActionClaimantFromTransaction(\n claimant: ActionClaimant,\n params: ValidateActionStepParams,\n ): Promise<Address | undefined> {\n // find message sender and return it\n // WARNING: this is error prone in bridged transactions and SCW transactions, as this will return exit node\n if (claimant.fieldIndex === CheatCodes.TX_SENDER_CLAIMANT) {\n if ('hash' in params) {\n const transaction = await getTransaction(this._config, {\n ...params,\n chainId: claimant.chainid,\n });\n return transaction.from;\n }\n if ('logs' in params) {\n for (let log of params.logs) {\n if (log.transactionHash) {\n const transaction = await getTransaction(this._config, {\n ...params,\n hash: log.transactionHash,\n chainId: claimant.chainid,\n });\n return transaction.from;\n }\n }\n }\n return undefined;\n }\n\n const signature = claimant.signature;\n\n if (claimant.signatureType === SignatureType.EVENT) {\n let event: AbiEvent;\n if (params.abiItem) event = params.abiItem as AbiEvent;\n else {\n const sigPool = params.knownSignatures as Record<Hex, AbiEvent>;\n event = sigPool[signature] as AbiEvent;\n }\n if (!event) {\n throw new ValidationAbiMissingError(signature);\n }\n\n let address: Address | undefined;\n if ('logs' in params) {\n for (let log of params.logs) {\n if (!isAddressEqual(log.address, claimant.targetContract)) continue;\n let addressCandidate = this.validateClaimantAgainstArgs(\n claimant,\n log,\n );\n if (addressCandidate) address = addressCandidate;\n }\n return address;\n }\n const receipt = await getTransactionReceipt(this._config, {\n ...params,\n chainId: claimant.chainid,\n });\n const decodedLogs = receipt.logs.map((log) => {\n const { eventName, args } = decodeEventLog({\n abi: [event],\n data: log.data,\n topics: log.topics,\n });\n return { ...log, eventName, args };\n });\n\n for (let log of decodedLogs) {\n if (!isAddressEqual(log.address, claimant.targetContract)) continue;\n let addressCandidate = this.validateClaimantAgainstArgs(claimant, log);\n if (addressCandidate) address = addressCandidate;\n }\n return address;\n }\n if (claimant.signatureType === SignatureType.FUNC && 'hash' in params) {\n const transaction = await getTransaction(this._config, {\n ...params,\n chainId: claimant.chainid,\n });\n if (!isAddressEqual(transaction.to!, claimant.targetContract)) return;\n let func: AbiFunction;\n if (params.abiItem) func = params.abiItem as AbiFunction;\n else {\n const sigPool = params.knownSignatures as Record<Hex, AbiFunction>;\n func = sigPool[signature] as AbiFunction;\n }\n if (!func) {\n throw new ValidationAbiMissingError(claimant.signature);\n }\n let decodedData;\n try {\n decodedData = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n } catch (e) {\n throw new FunctionDataDecodeError([func], e as Error);\n }\n return this.validateClaimantAgainstArgs(claimant, decodedData);\n }\n }\n\n /**\n * Validates the action claimant against the arguments of a log or function data.\n *\n * @param {ActionClaimant} claimant - The action claimant to validate.\n * @param {Object} [logOrFnData] - Optional object containing the arguments to validate against.\n * @param {Array<any> | readonly unknown[] | Record<string, unknown>} [logOrFnData.args] - The arguments from the log or function data.\n * @returns {Address | undefined} The validated address if found and valid, otherwise undefined.\n */\n public validateClaimantAgainstArgs(\n claimant: ActionClaimant,\n logOrFnData?: {\n args: Array<unknown> | readonly unknown[] | Record<string, unknown>;\n },\n ): Address | undefined {\n if (\n !logOrFnData ||\n !Array.isArray(logOrFnData?.args) ||\n logOrFnData?.args.length <= claimant.fieldIndex\n ) {\n return;\n }\n const maybeAddress = logOrFnData.args.at(claimant.fieldIndex);\n if (isAddress(maybeAddress)) return maybeAddress;\n }\n\n /**\n * Retrieves action steps, and uses them to validate against, and optionally fetch logs that match the step's signature.\n * If logs are provided in the optional `params` argument, then those logs will be used instead of fetched with the configured client.\n *\n * @public\n * @async\n * @param ValidateActionStepParams params\n * @returns {Promise<boolean>}\n */\n public async validateActionSteps(params: ValidateActionStepParams) {\n const actionSteps = await this.getActionSteps();\n for (const actionStep of actionSteps) {\n if (!(await this.isActionStepValid(actionStep, params))) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Validates a single action step with a given criteria against logs or function calls.\n * If logs are provided in the optional `params` argument, then those logs will be used instead of being fetched with the configured client.\n * For functions a hash is required.\n *\n * @public\n * @async\n * @param {ActionStep} actionStep - The action step to validate. Can be a function of event step.\n * @param {ValidateActionStepParams} params - Additional parameters for validation, including hash, known events, logs, and chain ID.\n * @returns {Promise<boolean>}\n */\n public async isActionStepValid(\n actionStep: ActionStep,\n params: ValidateActionStepParams,\n ) {\n if (actionStep.signatureType === SignatureType.EVENT) {\n const signature = actionStep.signature;\n let event: AbiEvent;\n if (params.abiItem) event = params.abiItem as AbiEvent;\n else {\n const sigPool = params.knownSignatures as Record<Hex, AbiEvent>;\n event = sigPool[signature] as AbiEvent;\n }\n\n if (!event) {\n throw new ValidationAbiMissingError(signature);\n }\n\n if (this.isArraylikeIndexed(actionStep, event)) {\n // If the field is indexed, we can't filter on it\n throw new UnparseableAbiParamError(\n actionStep.actionParameter.fieldIndex,\n event,\n );\n }\n\n // Use the provided logs, no need to fetch receipt\n if ('logs' in params) {\n return this.isActionEventValid(actionStep, params.logs);\n }\n\n const receipt = await getTransactionReceipt(this._config, {\n ...params,\n chainId: actionStep.chainid,\n });\n const decodedLogs = receipt.logs.map((log) => {\n const { eventName, args } = decodeEventLog({\n abi: [event],\n data: log.data,\n topics: log.topics,\n });\n\n return { ...log, eventName, args };\n });\n\n return this.isActionEventValid(actionStep, decodedLogs);\n }\n if (actionStep.signatureType === SignatureType.FUNC) {\n if ('hash' in params) {\n const transaction = await getTransaction(this._config, {\n ...params,\n chainId: actionStep.chainid,\n });\n return this.isActionFunctionValid(actionStep, transaction, params);\n }\n }\n return false;\n }\n\n /**\n * Validates a single action event with a given criteria against logs.\n * If logs are provided in the optional `params` argument, then those logs will be used instead of being fetched with the configured client.\n *\n * @public\n * @async\n * @param {ActionStep} actionStep - The action step containing the event to validate.\n * @param {EventLogs} logs - Event logs to validate the given step against\n * @returns {Promise<boolean>} Resolves to true if the action event is valid, throws if input is invalid, otherwise false.\n */\n public isActionEventValid(actionStep: ActionStep, logs: EventLogs) {\n const criteria = actionStep.actionParameter;\n if (!logs.length) return false;\n for (let log of logs) {\n if (this.validateLogAgainstCriteria(criteria, log)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Validates a single action function with a given criteria against the transaction input.\n *\n * @public\n * @param {ActionStep} actionStep - The action step containing the function to validate.\n * @param {Transaction} transaction - The transaction that will be validated against.\n * @param {Object} [params] - Parameters for validation.\n * @param {AbiItem} [params.abiItem] - The ABI item for the function, if known.\n * @param {Record<Hex, AbiEvent | AbiFunction>} [params.knownSignatures] - A record of known signatures.\n * @returns {boolean} Returns true if the action function is valid, false otherwise.\n * @throws {ValidationAbiMissingError} Throws if the ABI for the function signature is not found.\n * @throws {FunctionDataDecodeError} Throws if there's an error decoding the function data.\n */\n public isActionFunctionValid(\n actionStep: ActionStep,\n transaction: Transaction,\n params: Pick<ValidateActionStepParams, 'abiItem' | 'knownSignatures'>,\n ) {\n const criteria = actionStep.actionParameter;\n let signature = actionStep.signature;\n\n let func: AbiFunction;\n if (params.abiItem) func = params?.abiItem as AbiFunction;\n else {\n const sigPool = params.knownSignatures as Record<Hex, AbiFunction>;\n func = sigPool[signature] as AbiFunction;\n }\n if (!func) {\n throw new ValidationAbiMissingError(signature);\n }\n\n let decodedData;\n try {\n decodedData = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n } catch (e) {\n throw new FunctionDataDecodeError([func], e as Error);\n }\n\n // Validate the criteria against decoded arguments using fieldIndex\n const decodedArgs = decodedData.args;\n\n if (!decodedArgs || !decodedData) return false;\n\n if (\n !this.validateFunctionAgainstCriteria(\n criteria,\n decodedArgs as (string | bigint)[],\n )\n ) {\n return false;\n }\n\n return true;\n }\n /**\n * Validates a field against a given criteria.\n *\n * @param {Criteria} criteria - The criteria to validate against.\n * @param {string | bigint | Hex} fieldValue - The field value to validate.\n * @param {Object} input - Additional context for validation.\n * @param {EventLogs[0]} [input.log] - The event log, if validating an event.\n * @param {readonly (string | bigint)[]} [input.decodedArgs] - The decoded function arguments, if validating a function call.\n * @returns {Promise<boolean>} - Returns true if the field passes the criteria, false otherwise.\n */\n public validateFieldAgainstCriteria(\n criteria: Criteria,\n fieldValue: string | bigint | Hex,\n input:\n | { log: EventLogs[0] }\n | { decodedArgs: readonly (string | bigint)[] },\n ): boolean {\n if (\n criteria.filterType === FilterType.EQUAL &&\n criteria.fieldType === PrimitiveType.BYTES &&\n criteria.fieldIndex === CheatCodes.ANY_ACTION_PARAM\n ) {\n return true;\n }\n\n // Type narrow based on criteria.filterType\n switch (criteria.filterType) {\n case FilterType.EQUAL:\n return match(criteria.fieldType)\n .with(PrimitiveType.ADDRESS, () =>\n isAddressEqual(criteria.filterData, fieldValue as Address),\n )\n .with(\n PrimitiveType.UINT,\n () => BigInt(fieldValue) === BigInt(criteria.filterData),\n )\n .with(\n PrimitiveType.STRING,\n () => fieldValue === fromHex(criteria.filterData, 'string'),\n )\n .otherwise(() => fieldValue === criteria.filterData);\n\n case FilterType.NOT_EQUAL:\n return match(criteria.fieldType)\n .with(\n PrimitiveType.ADDRESS,\n () => !isAddressEqual(criteria.filterData, fieldValue as Address),\n )\n .with(\n PrimitiveType.UINT,\n () => BigInt(fieldValue) !== BigInt(criteria.filterData),\n )\n .with(\n PrimitiveType.STRING,\n () => fieldValue !== fromHex(criteria.filterData, 'string'),\n )\n .otherwise(() => fieldValue !== criteria.filterData);\n\n case FilterType.GREATER_THAN:\n if (criteria.fieldType === PrimitiveType.UINT) {\n return BigInt(fieldValue) > BigInt(criteria.filterData);\n }\n throw new InvalidNumericalCriteriaError({\n ...input,\n criteria,\n fieldValue,\n });\n\n case FilterType.LESS_THAN:\n if (criteria.fieldType === PrimitiveType.UINT) {\n return BigInt(fieldValue) < BigInt(criteria.filterData);\n }\n throw new InvalidNumericalCriteriaError({\n ...input,\n criteria,\n fieldValue,\n });\n\n case FilterType.CONTAINS:\n if (\n criteria.fieldType === PrimitiveType.BYTES ||\n criteria.fieldType === PrimitiveType.STRING\n ) {\n let substring;\n if (criteria.fieldType === PrimitiveType.STRING) {\n substring = fromHex(criteria.filterData, 'string');\n } else {\n // truncate the `0x` prefix\n substring = criteria.filterData.slice(2);\n }\n return (fieldValue as string).includes(substring);\n }\n throw new FieldValueNotComparableError({\n ...input,\n criteria,\n fieldValue,\n });\n\n case FilterType.REGEX:\n if (typeof fieldValue !== 'string') {\n throw new FieldValueNotComparableError({\n ...input,\n criteria,\n fieldValue,\n });\n }\n\n if (criteria.fieldType === PrimitiveType.STRING) {\n // fieldValue is decoded by the ABI\n const regexString = fromHex(criteria.filterData, 'string');\n return new RegExp(regexString).test(fieldValue);\n }\n\n default:\n throw new UnrecognizedFilterTypeError({\n ...input,\n criteria,\n fieldValue,\n });\n }\n }\n\n /**\n * Validates a {@link Log} against a given criteria.\n * If the criteria's fieldIndex is 255 (using CheatCodes enum), it is reserved for anyValidation\n *\n * @param {Criteria} criteria - The criteria to validate against.\n * @param {Log} log - The Viem event log.\n * @returns {boolean} - Returns true if the log passes the criteria, false otherwise.\n */\n public validateLogAgainstCriteria(\n criteria: Criteria,\n log: EventLogs[0],\n ): boolean {\n if (\n !Array.isArray(log.args) ||\n (log.args.length <= criteria.fieldIndex &&\n criteria.fieldIndex !== CheatCodes.ANY_ACTION_PARAM)\n ) {\n throw new DecodedArgsMalformedError({\n log,\n criteria,\n fieldValue: undefined,\n });\n }\n\n const fieldValue =\n criteria.fieldIndex === CheatCodes.ANY_ACTION_PARAM\n ? zeroHash\n : log.args.at(criteria.fieldIndex);\n\n if (fieldValue === undefined) {\n throw new FieldValueUndefinedError({ log, criteria, fieldValue });\n }\n return this.validateFieldAgainstCriteria(criteria, fieldValue, { log });\n }\n\n /**\n * Validates a function's decoded arguments against a given criteria.\n * If the criteria's fieldIndex is 255 (using CheatCodes enum), it is reserved for anyValidation\n *\n * @param {Criteria} criteria - The criteria to validate against.\n * @param {unknown[]} decodedArgs - The decoded arguments of the function call.\n * @returns {Promise<boolean>} - Returns true if the decoded argument passes the criteria, false otherwise.\n */\n public validateFunctionAgainstCriteria(\n criteria: Criteria,\n decodedArgs: readonly (string | bigint)[],\n ): boolean {\n const fieldValue =\n criteria.fieldIndex === CheatCodes.ANY_ACTION_PARAM\n ? zeroHash\n : decodedArgs[criteria.fieldIndex];\n if (fieldValue === undefined) {\n throw new FieldValueUndefinedError({\n criteria,\n fieldValue,\n });\n }\n return this.validateFieldAgainstCriteria(criteria, fieldValue, {\n decodedArgs,\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?EventActionPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: EventActionPayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n let rawPayload: EventActionPayloadRaw;\n if (isEventActionPayloadSimple(payload)) {\n // filter out any falsy potential values\n let tmpSteps: ActionStep[] = payload.actionSteps.filter((step) => !!step);\n if (tmpSteps.length === 0) {\n throw new NoEventActionStepsProvidedError();\n }\n if (tmpSteps.length > 4) {\n throw new TooManyEventActionStepsProvidedError();\n }\n let steps: ActionStepTuple = Array.from({ length: 4 }, (_, i) => {\n // use either the provided step at the given index, or reuse the previous step\n // should aways exist\n return tmpSteps.at(i) || tmpSteps.at(-1);\n }) as ActionStepTuple;\n rawPayload = {\n actionClaimant: payload.actionClaimant,\n actionStepOne: steps[0],\n actionStepTwo: steps[1],\n actionStepThree: steps[2],\n actionStepFour: steps[3],\n };\n } else {\n rawPayload = payload;\n }\n return {\n abi: eventActionAbi,\n bytecode: bytecode as Hex,\n args: [prepareEventActionPayload(rawPayload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n public isArraylikeIndexed(step: ActionStep, event: AbiEvent) {\n if (\n (step.actionParameter.fieldType === PrimitiveType.STRING ||\n step.actionParameter.fieldType === PrimitiveType.BYTES) &&\n event.inputs[step.actionParameter.fieldIndex]?.indexed\n ) {\n return true;\n }\n return false;\n }\n}\n\nfunction _dedupeActionSteps(_steps: ActionStep[]): ActionStep[] {\n const steps: ActionStep[] = [],\n signatures: Record<string, boolean> = {};\n for (let step of _steps) {\n const signature = JSON.stringify(step);\n if (signatures[signature]) continue;\n steps.push(step);\n signatures[signature] = true;\n }\n return steps;\n}\ntype RawActionStep = Overwrite<ActionStep, { chainid: bigint }>;\ntype RawActionClaimant = Overwrite<ActionClaimant, { chainid: bigint }>;\n\nfunction _toRawActionStep<T extends ActionStep | ActionClaimant>(obj: T) {\n return {\n ...obj,\n chainid: BigInt(obj.chainid),\n };\n}\n\nfunction _fromRawActionStep<T extends RawActionStep | RawActionClaimant>(\n obj: T,\n) {\n if (obj.chainid > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new Error('Chain ID exceeds max safe integer');\n }\n\n return {\n ...obj,\n chainid: Number(obj.chainid),\n };\n}\n\n/**\n * Typeguard to determine if a user is supplying a simple or raw EventActionPayload\n *\n * @param {*} opts\n * @returns {opts is EventActionPayloadSimple}\n */\nfunction _isEventActionPayloadSimple(\n opts: EventActionPayload,\n): opts is EventActionPayloadSimple {\n return Array.isArray((opts as EventActionPayloadSimple).actionSteps);\n}\n\n/**\n * Function to properly encode an event action payload.\n *\n * @param {InitPayload} param0\n * @param {ActionStep} param0.actionStepOne - The first action step to initialize.\n * @param {ActionStep} param0.actionStepTwo - The second action step to initialize.\n * @param {ActionStep} param0.actionStepThree - The third action step to initialize.\n * @param {ActionStep} param0.actionStepFour - The fourth action step to initialize.\n * @returns {Hex}\n */\nexport function prepareEventActionPayload({\n actionClaimant,\n actionStepOne,\n actionStepTwo,\n actionStepThree,\n actionStepFour,\n}: EventActionPayloadRaw) {\n // note chainIds are technically uint256 but viem treats them (safely) as numbers,\n // so we encode them as uint32 here to avoid downcast issues\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayload',\n components: [\n {\n type: 'tuple',\n name: 'actionClaimant',\n components: [\n { type: 'uint8', name: 'signatureType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint256', name: 'chainid' },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepOne',\n components: [\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint256', name: 'chainid' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepTwo',\n components: [\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint256', name: 'chainid' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepThree',\n components: [\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint256', name: 'chainid' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepFour',\n components: [\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint256', name: 'chainid' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n ],\n },\n ],\n [\n {\n actionClaimant: _toRawActionStep(actionClaimant),\n actionStepOne: {\n ..._toRawActionStep(actionStepOne),\n actionType: actionStepOne.actionType || 0,\n },\n actionStepTwo: {\n ..._toRawActionStep(actionStepTwo),\n actionType: actionStepTwo.actionType || 0,\n },\n actionStepThree: {\n ..._toRawActionStep(actionStepThree),\n actionType: actionStepThree.actionType || 0,\n },\n actionStepFour: {\n ..._toRawActionStep(actionStepFour),\n actionType: actionStepFour.actionType || 0,\n },\n },\n ],\n );\n}\n\n/**\n * Creates a default Criteria object that allows validation to pass. This is used if you don't care about targeting specific parameters in the action step.\n *\n * This function returns a Criteria object with the following properties:\n * - filterType: Set to EQUAL for exact matching\n * - fieldType: Set to BYTES to handle any data type\n * - fieldIndex: Set to 255, which is typically used to indicate \"any\" or \"all\" in this context using CheatCodes enum\n * - filterData: Set to zeroHash (0x0000...0000)\n *\n * @returns {Criteria} A Criteria object that can be used to match any action parameter\n *\n * @example\n * const anyCriteria = anyActionParameter();\n * // Use this criteria in an ActionStep to match any parameter\n * const actionStep = {\n * // ... other properties ...\n * actionParameter: anyCriteria\n * };\n */\nexport function anyActionParameter(): Criteria {\n return {\n filterType: FilterType.EQUAL,\n fieldType: PrimitiveType.BYTES,\n fieldIndex: CheatCodes.ANY_ACTION_PARAM,\n filterData: zeroHash,\n };\n}\n\n/**\n * Creates an ActionClaimant object that represents the transaction sender as the claimant.\n * This function is useful when you want to set up an action where the transaction sender is always considered the valid claimant,\n * regardless of the event or function parameters.\n *\n * The returned ActionClaimant has the following properties:\n * - signatureType: Set to SignatureType.EVENT (though it doesn't matter for this case)\n * - signature: Set to zeroHash (0x0000...0000)\n * - fieldIndex: Set to 255, indicating \"any\" field using CheatCodes enum\n * - targetContract: Set to zeroAddress (0x0000...0000)\n * - chainid: The chain ID on which the transaction is sent, should match the chain ID for the action's {@link ActionStep}\n *\n * @param {number} chainId - The chain ID on which the transaction is sent, should match the chain ID for the action's {@link ActionStep}\n * @returns {ActionClaimant} An ActionClaimant object representing the msg.sender\n *\n * @example\n * const eventAction = new EventAction();\n * const payload: EventActionPayload = {\n * actionClaimant: transactionSenderClaimant(),\n * actionSteps: [\n * // ... define your action steps here\n * ]\n * };\n * await eventAction.deploy(payload);\n */\nexport function transactionSenderClaimant(chainId: number): ActionClaimant {\n return {\n signatureType: SignatureType.EVENT,\n signature: zeroHash,\n fieldIndex: CheatCodes.TX_SENDER_CLAIMANT,\n targetContract: zeroAddress,\n chainid: chainId,\n };\n}\n"],"names":["t","e","n","r","i","s","o","c","a","h","m","d","y","p","v","b","w","j","x","A","W","$","I","u","FilterType","PrimitiveType","SignatureType","isEventActionPayloadSimple","opts","_EventAction","DeployableTarget","eventActionAbi","index","params","steps","readEventActionGetActionSteps","_dedupeActionSteps","_fromRawActionStep","result","readEventActionGetActionClaimant","data","request","simulateEventActionExecute","writeEventActionExecute","claimant","CheatCodes","getTransaction","log","signature","event","ValidationAbiMissingError","address","isAddressEqual","addressCandidate","decodedLogs","getTransactionReceipt","eventName","args","decodeEventLog","transaction","func","decodedData","decodeFunctionData","FunctionDataDecodeError","logOrFnData","maybeAddress","isAddress","actionSteps","actionStep","UnparseableAbiParamError","logs","criteria","decodedArgs","fieldValue","input","match","fromHex","InvalidNumericalCriteriaError","substring","FieldValueNotComparableError","regexString","UnrecognizedFilterTypeError","DecodedArgsMalformedError","zeroHash","FieldValueUndefinedError","_payload","_options","payload","options","rawPayload","tmpSteps","step","NoEventActionStepsProvidedError","TooManyEventActionStepsProvidedError","_","bytecode","prepareEventActionPayload","_a","EventActionBases","RegistryType","EventAction","_steps","signatures","_toRawActionStep","obj","actionClaimant","actionStepOne","actionStepTwo","actionStepThree","actionStepFour","encodeAbiParameters","anyActionParameter","transactionSenderClaimant","chainId","zeroAddress"],"mappings":";;;;;;;q9jBAAMA,IAAE,OAAO,IAAI,qBAAqB,GAAEC,KAAE,OAAO,IAAI,wBAAwB,GAAEC,IAAE,oCAAmCC,IAAE,OAAG,GAAQ,KAAa,OAAO,KAAjB,WAAoBC,IAAE,CAAAH,MAAGA,KAAG,CAAC,CAACA,EAAED,CAAC,GAAEK,IAAE,CAACH,GAAEI,GAAEC,MAAI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A,IAChB,SAASD;AAAA,EAAA;AAEb;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"EventAction.js","sources":["../../../../node_modules/.pnpm/ts-pattern@5.4.0/node_modules/ts-pattern/dist/index.js","../../src/Actions/EventAction.ts"],"sourcesContent":["const t=Symbol.for(\"@ts-pattern/matcher\"),e=Symbol.for(\"@ts-pattern/isVariadic\"),n=\"@ts-pattern/anonymous-select-key\",r=t=>Boolean(t&&\"object\"==typeof t),i=e=>e&&!!e[t],s=(n,o,c)=>{if(i(n)){const e=n[t](),{matched:r,selections:i}=e.match(o);return r&&i&&Object.keys(i).forEach(t=>c(t,i[t])),r}if(r(n)){if(!r(o))return!1;if(Array.isArray(n)){if(!Array.isArray(o))return!1;let t=[],r=[],a=[];for(const s of n.keys()){const o=n[s];i(o)&&o[e]?a.push(o):a.length?r.push(o):t.push(o)}if(a.length){if(a.length>1)throw new Error(\"Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.\");if(o.length<t.length+r.length)return!1;const e=o.slice(0,t.length),n=0===r.length?[]:o.slice(-r.length),i=o.slice(t.length,0===r.length?Infinity:-r.length);return t.every((t,n)=>s(t,e[n],c))&&r.every((t,e)=>s(t,n[e],c))&&(0===a.length||s(a[0],i,c))}return n.length===o.length&&n.every((t,e)=>s(t,o[e],c))}return Reflect.ownKeys(n).every(e=>{const r=n[e];return(e in o||i(a=r)&&\"optional\"===a[t]().matcherType)&&s(r,o[e],c);var a})}return Object.is(o,n)},o=e=>{var n,s,a;return r(e)?i(e)?null!=(n=null==(s=(a=e[t]()).getSelectionKeys)?void 0:s.call(a))?n:[]:Array.isArray(e)?c(e,o):c(Object.values(e),o):[]},c=(t,e)=>t.reduce((t,n)=>t.concat(e(n)),[]);function a(...t){if(1===t.length){const[e]=t;return t=>s(e,t,()=>{})}if(2===t.length){const[e,n]=t;return s(e,n,()=>{})}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t.length}.`)}function u(t){return Object.assign(t,{optional:()=>h(t),and:e=>m(t,e),or:e=>d(t,e),select:e=>void 0===e?y(t):y(e,t)})}function l(t){return Object.assign((t=>Object.assign(t,{[Symbol.iterator](){let n=0;const r=[{value:Object.assign(t,{[e]:!0}),done:!1},{done:!0,value:void 0}];return{next:()=>{var t;return null!=(t=r[n++])?t:r.at(-1)}}}}))(t),{optional:()=>l(h(t)),select:e=>l(void 0===e?y(t):y(e,t))})}function h(e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e};return void 0===t?(o(e).forEach(t=>r(t,void 0)),{matched:!0,selections:n}):{matched:s(e,t,r),selections:n}},getSelectionKeys:()=>o(e),matcherType:\"optional\"})})}const f=(t,e)=>{for(const n of t)if(!e(n))return!1;return!0},g=(t,e)=>{for(const[n,r]of t.entries())if(!e(r,n))return!1;return!0};function m(...e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e};return{matched:e.every(e=>s(e,t,r)),selections:n}},getSelectionKeys:()=>c(e,o),matcherType:\"and\"})})}function d(...e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e};return c(e,o).forEach(t=>r(t,void 0)),{matched:e.some(e=>s(e,t,r)),selections:n}},getSelectionKeys:()=>c(e,o),matcherType:\"or\"})})}function p(e){return{[t]:()=>({match:t=>({matched:Boolean(e(t))})})}}function y(...e){const r=\"string\"==typeof e[0]?e[0]:void 0,i=2===e.length?e[1]:\"string\"==typeof e[0]?void 0:e[0];return u({[t]:()=>({match:t=>{let e={[null!=r?r:n]:t};return{matched:void 0===i||s(i,t,(t,n)=>{e[t]=n}),selections:e}},getSelectionKeys:()=>[null!=r?r:n].concat(void 0===i?[]:o(i))})})}function v(t){return\"number\"==typeof t}function b(t){return\"string\"==typeof t}function w(t){return\"bigint\"==typeof t}const S=u(p(function(t){return!0})),O=S,j=t=>Object.assign(u(t),{startsWith:e=>{return j(m(t,(n=e,p(t=>b(t)&&t.startsWith(n)))));var n},endsWith:e=>{return j(m(t,(n=e,p(t=>b(t)&&t.endsWith(n)))));var n},minLength:e=>j(m(t,(t=>p(e=>b(e)&&e.length>=t))(e))),length:e=>j(m(t,(t=>p(e=>b(e)&&e.length===t))(e))),maxLength:e=>j(m(t,(t=>p(e=>b(e)&&e.length<=t))(e))),includes:e=>{return j(m(t,(n=e,p(t=>b(t)&&t.includes(n)))));var n},regex:e=>{return j(m(t,(n=e,p(t=>b(t)&&Boolean(t.match(n))))));var n}}),K=j(p(b)),x=t=>Object.assign(u(t),{between:(e,n)=>x(m(t,((t,e)=>p(n=>v(n)&&t<=n&&e>=n))(e,n))),lt:e=>x(m(t,(t=>p(e=>v(e)&&e<t))(e))),gt:e=>x(m(t,(t=>p(e=>v(e)&&e>t))(e))),lte:e=>x(m(t,(t=>p(e=>v(e)&&e<=t))(e))),gte:e=>x(m(t,(t=>p(e=>v(e)&&e>=t))(e))),int:()=>x(m(t,p(t=>v(t)&&Number.isInteger(t)))),finite:()=>x(m(t,p(t=>v(t)&&Number.isFinite(t)))),positive:()=>x(m(t,p(t=>v(t)&&t>0))),negative:()=>x(m(t,p(t=>v(t)&&t<0)))}),E=x(p(v)),A=t=>Object.assign(u(t),{between:(e,n)=>A(m(t,((t,e)=>p(n=>w(n)&&t<=n&&e>=n))(e,n))),lt:e=>A(m(t,(t=>p(e=>w(e)&&e<t))(e))),gt:e=>A(m(t,(t=>p(e=>w(e)&&e>t))(e))),lte:e=>A(m(t,(t=>p(e=>w(e)&&e<=t))(e))),gte:e=>A(m(t,(t=>p(e=>w(e)&&e>=t))(e))),positive:()=>A(m(t,p(t=>w(t)&&t>0))),negative:()=>A(m(t,p(t=>w(t)&&t<0)))}),P=A(p(w)),T=u(p(function(t){return\"boolean\"==typeof t})),B=u(p(function(t){return\"symbol\"==typeof t})),_=u(p(function(t){return null==t})),k=u(p(function(t){return null!=t}));var N={__proto__:null,matcher:t,optional:h,array:function(...e){return l({[t]:()=>({match:t=>{if(!Array.isArray(t))return{matched:!1};if(0===e.length)return{matched:!0};const n=e[0];let r={};if(0===t.length)return o(n).forEach(t=>{r[t]=[]}),{matched:!0,selections:r};const i=(t,e)=>{r[t]=(r[t]||[]).concat([e])};return{matched:t.every(t=>s(n,t,i)),selections:r}},getSelectionKeys:()=>0===e.length?[]:o(e[0])})})},set:function(...e){return u({[t]:()=>({match:t=>{if(!(t instanceof Set))return{matched:!1};let n={};if(0===t.size)return{matched:!0,selections:n};if(0===e.length)return{matched:!0};const r=(t,e)=>{n[t]=(n[t]||[]).concat([e])},i=e[0];return{matched:f(t,t=>s(i,t,r)),selections:n}},getSelectionKeys:()=>0===e.length?[]:o(e[0])})})},map:function(...e){return u({[t]:()=>({match:t=>{if(!(t instanceof Map))return{matched:!1};let n={};if(0===t.size)return{matched:!0,selections:n};const r=(t,e)=>{n[t]=(n[t]||[]).concat([e])};if(0===e.length)return{matched:!0};var i;if(1===e.length)throw new Error(`\\`P.map\\` wasn't given enough arguments. Expected (key, value), received ${null==(i=e[0])?void 0:i.toString()}`);const[o,c]=e;return{matched:g(t,(t,e)=>{const n=s(o,e,r),i=s(c,t,r);return n&&i}),selections:n}},getSelectionKeys:()=>0===e.length?[]:[...o(e[0]),...o(e[1])]})})},intersection:m,union:d,not:function(e){return u({[t]:()=>({match:t=>({matched:!s(e,t,()=>{})}),getSelectionKeys:()=>[],matcherType:\"not\"})})},when:p,select:y,any:S,_:O,string:K,number:E,bigint:P,boolean:T,symbol:B,nullish:_,nonNullable:k,instanceOf:function(t){return u(p(function(t){return e=>e instanceof t}(t)))},shape:function(t){return u(p(a(t)))}};class W extends Error{constructor(t){let e;try{e=JSON.stringify(t)}catch(n){e=t}super(`Pattern matching error: no pattern matches value ${e}`),this.input=void 0,this.input=t}}const $={matched:!1,value:void 0};function z(t){return new I(t,$)}class I{constructor(t,e){this.input=void 0,this.state=void 0,this.input=t,this.state=e}with(...t){if(this.state.matched)return this;const e=t[t.length-1],r=[t[0]];let i;3===t.length&&\"function\"==typeof t[1]?i=t[1]:t.length>2&&r.push(...t.slice(1,t.length-1));let o=!1,c={};const a=(t,e)=>{o=!0,c[t]=e},u=!r.some(t=>s(t,this.input,a))||i&&!Boolean(i(this.input))?$:{matched:!0,value:e(o?n in c?c[n]:c:this.input,this.input)};return new I(this.input,u)}when(t,e){if(this.state.matched)return this;const n=Boolean(t(this.input));return new I(this.input,n?{matched:!0,value:e(this.input,this.input)}:$)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new W(this.input)}run(){return this.exhaustive()}returnType(){return this}}export{W as NonExhaustiveError,N as P,N as Pattern,a as isMatching,z as match};\n//# sourceMappingURL=index.js.map\n","import {\n eventActionAbi,\n readEventActionGetActionClaimant,\n readEventActionGetActionSteps,\n simulateEventActionExecute,\n writeEventActionExecute,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/actions/EventAction.sol/EventAction.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport { match } from 'ts-pattern';\nimport {\n type AbiEvent,\n type AbiFunction,\n AbiItem,\n type Address,\n type ContractFunctionName,\n type GetLogsReturnType,\n type GetTransactionParameters,\n type Hex,\n type Log,\n type Transaction,\n decodeEventLog,\n decodeFunctionData,\n encodeAbiParameters,\n fromHex,\n isAddress,\n isAddressEqual,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { EventAction as EventActionBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n DecodedArgsMalformedError,\n FieldValueNotComparableError,\n FieldValueUndefinedError,\n FunctionDataDecodeError,\n InvalidNumericalCriteriaError,\n NoEventActionStepsProvidedError,\n TooManyEventActionStepsProvidedError,\n UnparseableAbiParamError,\n UnrecognizedFilterTypeError,\n ValidationAbiMissingError,\n} from '../errors';\nimport {\n CheatCodes,\n type Overwrite,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\n/*\n * Action Event Payloads\n */\n\n/**\n * Filter types used to determine how criteria are evaluated.\n *\n * @export\n * @enum {number}\n */\nexport enum FilterType {\n EQUAL = 0,\n NOT_EQUAL = 1,\n GREATER_THAN = 2,\n LESS_THAN = 3,\n CONTAINS = 4,\n REGEX = 5,\n}\n\n/**\n * The primitive types supported for filtering.\n *\n * @export\n * @enum {number}\n */\nexport enum PrimitiveType {\n UINT = 0,\n ADDRESS = 1,\n BYTES = 2,\n STRING = 3,\n}\n\n/**\n * Object representation of a `Criteria` struct used in event actions.\n *\n * @export\n * @interface Criteria\n * @typedef {Criteria}\n */\nexport interface Criteria {\n /**\n * The filter type used in this criteria.\n *\n * @type {FilterType}\n */\n filterType: FilterType;\n /**\n * The primitive type of the field being filtered.\n *\n * @type {PrimitiveType}\n */\n fieldType: PrimitiveType;\n /**\n * The index in the logs argument array where the field is located.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The filter data used for complex filtering.\n *\n * @type {Hex}\n */\n filterData: Hex;\n}\n\n/**\n * Whether a given signature is an event or function\n *\n * @export\n * @enum {number}\n */\nexport enum SignatureType {\n EVENT = 0,\n FUNC = 1,\n}\n\n/**\n * The payload describing how claimants are identified\n *\n * @export\n * @interface ActionClaimant\n * @typedef {ActionClaimant}\n */\nexport interface ActionClaimant {\n /**\n * Whether claimaint is inferred from event or function\n *\n * @type {SignatureType}\n */\n signatureType: SignatureType;\n /**\n * The 4 byte signature of the event or function\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * The index corresponding to claimant.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The address of the target contract\n *\n * @type {Address}\n */\n targetContract: Address;\n /**\n * The chain id of the target contract.\n * @type {number}\n */\n chainid: number;\n}\n\n/**\n * Object representation of an `ActionStep` struct used in event actions.\n *\n * @export\n * @interface ActionStep\n * @typedef {ActionStep}\n */\nexport interface ActionStep {\n /**\n * The signature of the event.\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * Whether claimaint is inferred from event or function\n *\n * @type {SignatureType}\n */\n signatureType: SignatureType;\n /**\n * The type of action being performed.\n *\n * @type {number}\n */\n actionType?: number;\n /**\n * The address of the target contract.\n *\n * @type {Address}\n */\n targetContract: Address;\n /**\n * The chain id of the target contract.\n * @type {number}\n */\n chainid: number;\n /**\n * The criteria used for this action step.\n *\n * @type {Criteria}\n */\n actionParameter: Criteria;\n}\n\n/**\n * Parameters for validating an action step.\n *\n * @typedef {Object} ValidateActionStepParams\n * @property {Record<Hex, AbiEvent | AbiFunction>} [knownSignatures] - Record of known events, keyed by 32 byte selectors. You can use [@boostxyz/signatures](https://www.npmjs.com/package/@boostxyz/signatures) to assemble this parameter.\n * @property {AbiEvent | AbiFunction} [abiItem] - Optional ABI item definition.\n * @property {EventLogs} [logs] - Event logs to validate against. Required if 'hash' is not provided.\n * @property {Hex} [hash] - Transaction hash to validate against. Required if 'logs' is not provided.\n */\nexport type ValidateActionStepParams = {\n knownSignatures: Record<Hex, AbiEvent | AbiFunction>;\n abiItem?: AbiEvent | AbiFunction;\n notBeforeBlockNumber?: bigint;\n} & ({ logs: EventLogs } | (GetTransactionParameters & { hash: Hex }));\n\n/**\n * You can either supply a simplified version of the payload, or one that explicitly declares action steps.\n *\n * @export\n * @typedef {EventActionPayload}\n */\nexport type EventActionPayload =\n | EventActionPayloadSimple\n | EventActionPayloadRaw;\n\nexport interface EventActionPayloadSimple {\n /**\n * The payload describing how claimants are identified\n *\n * @type {ActionClaimant}\n */\n actionClaimant: ActionClaimant;\n\n /**\n * Up to 4 action steps.\n * If you supply less than 4, then the last step will be reused to satisfy the EventAction.InitPayload\n * Any more than 4 will throw an error.\n *\n * @type {ActionStep[]}\n */\n actionSteps: ActionStep[];\n}\n\nexport type ActionStepTuple = [ActionStep, ActionStep, ActionStep, ActionStep];\n\n/**\n * Typeguard to determine if a user is supplying a simple or raw EventActionPayload\n *\n * @param {*} opts\n * @returns {opts is EventActionPayloadSimple}\n */\nexport function isEventActionPayloadSimple(\n opts: EventActionPayload,\n): opts is EventActionPayloadSimple {\n return Array.isArray((opts as EventActionPayloadSimple).actionSteps);\n}\n\n/**\n * Object representation of an `InitPayload` struct used to initialize event actions.\n *\n * @export\n * @interface EventActionPayloadRaw\n * @typedef {EventActionPayloadRaw}\n */\nexport interface EventActionPayloadRaw {\n /**\n * The payload describing how claimants are identified\n *\n * @type {ActionClaimant}\n */\n actionClaimant: ActionClaimant;\n /**\n * The first action step.\n *\n * @type {ActionStep}\n */\n actionStepOne: ActionStep;\n /**\n * The second action step.\n *\n * @type {ActionStep}\n */\n actionStepTwo: ActionStep;\n /**\n * The third action step.\n *\n * @type {ActionStep}\n */\n actionStepThree: ActionStep;\n /**\n * The fourth action step.\n *\n * @type {ActionStep}\n */\n actionStepFour: ActionStep;\n}\n\n/**\n * Array of event logs to pass into TxParams\n * @export\n * @typedef {EventLogs}\n */\nexport type EventLogs = GetLogsReturnType<AbiEvent, AbiEvent[], true>;\n\n/**\n * Getter params from the event action contract\n *\n * @export\n * @typedef {ReadEventActionParams}\n * @param {fnName} fnName - The getter function name\n */\nexport type ReadEventActionParams<\n fnName extends ContractFunctionName<typeof eventActionAbi, 'pure' | 'view'>,\n> = ReadParams<typeof eventActionAbi, fnName>;\n\n/**\n * A generic event action\n *\n * @export\n * @class EventAction\n * @typedef {EventAction}\n * @extends {DeployableTarget<EventActionPayload>}\n */\nexport class EventAction extends DeployableTarget<\n EventActionPayload,\n typeof eventActionAbi\n> {\n /**\n * @inheritdoc\n *\n * @public\n * @readonly\n * @type {*}\n */\n public override readonly abi = eventActionAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_EVENT_ACTION_BASE,\n ...(EventActionBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.ACTION;\n\n /**\n * Gets a specific action event by index\n *\n * @public\n * @async\n * @param {number} index The index of the action event to retrieve\n * @param {?ReadEventActionParams<'getActionStep'>} [params]\n * @returns {Promise<ActionStep>}\n */\n public async getActionStep(\n index: number,\n params?: ReadEventActionParams<'getActionStep'>,\n ) {\n const steps = await this.getActionSteps(params);\n return steps.at(index);\n }\n\n /**\n * Gets all action events\n *\n * @public\n * @async\n * @param {?ReadEventActionParams<'getActionSteps'>} [params]\n * @returns {Promise<ActionStep[]>}\n */\n public async getActionSteps(\n params?: ReadEventActionParams<'getActionSteps'>,\n ) {\n const steps = (await readEventActionGetActionSteps(this._config, {\n address: this.assertValidAddress(),\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 })) as RawActionStep[];\n return _dedupeActionSteps(steps.map(_fromRawActionStep));\n }\n\n /**\n * Gets the count of action events\n *\n * @public\n * @async\n * @param {?ReadEventActionParams<'getActionStepsCount'>} [params]\n * @returns {Promise<bigint>}\n */\n public async getActionStepsCount(\n params?: ReadEventActionParams<'getActionStepsCount'>,\n ) {\n const steps = await this.getActionSteps(params);\n return steps.length;\n }\n\n /**\n * Retrieves the payload describing how claimants can be identified from logs or function calls.\n *\n * @public\n * @async\n * @param {?ReadEventActionParams<'getActionClaimant'>} [params]\n * @returns {Promise<ActionClaimant>}\n */\n public async getActionClaimant(\n params?: ReadEventActionParams<'getActionClaimant'>,\n ): Promise<ActionClaimant> {\n const result = (await readEventActionGetActionClaimant(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n ...params,\n })) as RawActionClaimant;\n return _fromRawActionStep(result);\n }\n\n /**\n * Executes a prepared event action\n *\n * @public\n * @async\n * @param {Hex} data\n * @param {?WriteParams} [params]\n * @returns {Promise<readonly [boolean, `0x${string}`]>}\n */\n public async execute(\n data: Hex,\n params?: WriteParams<typeof eventActionAbi, 'execute'>,\n ) {\n return await this.awaitResult(this.executeRaw(data, params));\n }\n\n /**\n * Executes a prepared event action\n *\n * @public\n * @async\n * @param {Hex} data\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: readonly [boolean, `0x${string}`]; }>}\n */\n public async executeRaw(\n data: Hex,\n params?: WriteParams<typeof eventActionAbi, 'execute'>,\n ) {\n const { request, result } = await simulateEventActionExecute(this._config, {\n address: this.assertValidAddress(),\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 args: [data],\n });\n const hash = await writeEventActionExecute(this._config, request);\n return { hash, result };\n }\n\n /**\n * Derives the action claimant address from a transaction based on the provided ActionClaimant configuration.\n * This method supports both event-based and function-based claimant derivation.\n * **Important**: The claimant is considered to be `transaction.from` when `claimant.fieldIndex` is 255 using CheatCodes enum.\n * This may have unintended side effects for bridged transactions and SCW transactions, so these are considered unsupported use cases for the time being.\n *\n ** @example\n * // Example usage\n * const eventAction = boost.action as EventAction\n * const claimant = await eventAction.getActionClaimant() // {\n * signatureType: SignatureType.EVENT,\n * signature: '0x1234...',\n * fieldIndex: 2,\n * targetContract: '0xabcd...',\n * chainid: 1\n * };\n * const params: ValidateActionStepParams = {\n * hash: '0x5678...',\n * chainId: 1,\n * knownSignatures: {\n * '0x1234...': {\n * type: 'event',\n * name: 'Transfer(...)'\n * }\n * }\n * };\n * const claimantAddress = await eventAction.deriveActionClaimantFromTransaction(claimant, params);\n *\n * @param {ActionClaimant} claimant - The configuration specifying how to derive the claimant.\n * @param {ValidateActionStepParams} params - Parameters for validation, including transaction hash, known signatures, logs, and chain ID.\n * @returns {Promise<Address | undefined>} The derived claimant address if found, undefined otherwise.\n * @throws {ValidationAbiMissingError} If the ABI for the specified signature is not found.\n * @throws {FunctionDataDecodeError} If there's an error decoding function data (for function-based derivation).\n */\n public async deriveActionClaimantFromTransaction(\n claimant: ActionClaimant,\n params: ValidateActionStepParams,\n ): Promise<Address | undefined> {\n // find message sender and return it\n // WARNING: this is error prone in bridged transactions and SCW transactions, as this will return exit node\n if (claimant.fieldIndex === CheatCodes.TX_SENDER_CLAIMANT) {\n if ('hash' in params) {\n const transaction = await getTransaction(this._config, {\n ...params,\n chainId: claimant.chainid,\n });\n if (\n params.notBeforeBlockNumber &&\n transaction.blockNumber < params.notBeforeBlockNumber\n ) {\n return undefined;\n }\n return transaction.from;\n }\n if ('logs' in params) {\n for (let log of params.logs) {\n if (log.transactionHash) {\n const transaction = await getTransaction(this._config, {\n ...params,\n hash: log.transactionHash,\n chainId: claimant.chainid,\n });\n if (\n params.notBeforeBlockNumber &&\n transaction.blockNumber < params.notBeforeBlockNumber\n ) {\n return undefined;\n }\n return transaction.from;\n }\n }\n }\n return undefined;\n }\n\n const signature = claimant.signature;\n\n if (claimant.signatureType === SignatureType.EVENT) {\n let event: AbiEvent;\n if (params.abiItem) event = params.abiItem as AbiEvent;\n else {\n const sigPool = params.knownSignatures as Record<Hex, AbiEvent>;\n event = sigPool[signature] as AbiEvent;\n }\n if (!event) {\n throw new ValidationAbiMissingError(signature);\n }\n\n let address: Address | undefined;\n if ('logs' in params) {\n for (let log of params.logs) {\n if (!isAddressEqual(log.address, claimant.targetContract)) continue;\n let addressCandidate = this.validateClaimantAgainstArgs(\n claimant,\n log,\n );\n if (addressCandidate) address = addressCandidate;\n }\n return address;\n }\n const receipt = await getTransactionReceipt(this._config, {\n ...params,\n chainId: claimant.chainid,\n });\n if (\n params.notBeforeBlockNumber &&\n receipt.blockNumber < params.notBeforeBlockNumber\n ) {\n return undefined;\n }\n const decodedLogs = receipt.logs.map((log) => {\n const { eventName, args } = decodeEventLog({\n abi: [event],\n data: log.data,\n topics: log.topics,\n });\n return { ...log, eventName, args };\n });\n\n for (let log of decodedLogs) {\n if (!isAddressEqual(log.address, claimant.targetContract)) continue;\n let addressCandidate = this.validateClaimantAgainstArgs(claimant, log);\n if (addressCandidate) address = addressCandidate;\n }\n return address;\n }\n if (claimant.signatureType === SignatureType.FUNC && 'hash' in params) {\n const transaction = await getTransaction(this._config, {\n ...params,\n chainId: claimant.chainid,\n });\n if (\n params.notBeforeBlockNumber &&\n transaction.blockNumber < params.notBeforeBlockNumber\n ) {\n return undefined;\n }\n if (!isAddressEqual(transaction.to!, claimant.targetContract)) return;\n let func: AbiFunction;\n if (params.abiItem) func = params.abiItem as AbiFunction;\n else {\n const sigPool = params.knownSignatures as Record<Hex, AbiFunction>;\n func = sigPool[signature] as AbiFunction;\n }\n if (!func) {\n throw new ValidationAbiMissingError(claimant.signature);\n }\n let decodedData;\n try {\n decodedData = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n } catch (e) {\n throw new FunctionDataDecodeError([func], e as Error);\n }\n return this.validateClaimantAgainstArgs(claimant, decodedData);\n }\n }\n\n /**\n * Validates the action claimant against the arguments of a log or function data.\n *\n * @param {ActionClaimant} claimant - The action claimant to validate.\n * @param {Object} [logOrFnData] - Optional object containing the arguments to validate against.\n * @param {Array<any> | readonly unknown[] | Record<string, unknown>} [logOrFnData.args] - The arguments from the log or function data.\n * @returns {Address | undefined} The validated address if found and valid, otherwise undefined.\n */\n public validateClaimantAgainstArgs(\n claimant: ActionClaimant,\n logOrFnData?: {\n args: Array<unknown> | readonly unknown[] | Record<string, unknown>;\n },\n ): Address | undefined {\n if (\n !logOrFnData ||\n !Array.isArray(logOrFnData?.args) ||\n logOrFnData?.args.length <= claimant.fieldIndex\n ) {\n return;\n }\n const maybeAddress = logOrFnData.args.at(claimant.fieldIndex);\n if (isAddress(maybeAddress)) return maybeAddress;\n }\n\n /**\n * Retrieves action steps, and uses them to validate against, and optionally fetch logs that match the step's signature.\n * If logs are provided in the optional `params` argument, then those logs will be used instead of fetched with the configured client.\n *\n * @public\n * @async\n * @param ValidateActionStepParams params\n * @returns {Promise<boolean>}\n */\n public async validateActionSteps(params: ValidateActionStepParams) {\n const actionSteps = await this.getActionSteps();\n for (const actionStep of actionSteps) {\n if (!(await this.isActionStepValid(actionStep, params))) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Validates a single action step with a given criteria against logs or function calls.\n * If logs are provided in the optional `params` argument, then those logs will be used instead of being fetched with the configured client.\n * For functions a hash is required.\n *\n * @public\n * @async\n * @param {ActionStep} actionStep - The action step to validate. Can be a function of event step.\n * @param {ValidateActionStepParams} params - Additional parameters for validation, including hash, known events, logs, and chain ID.\n * @returns {Promise<boolean>}\n */\n public async isActionStepValid(\n actionStep: ActionStep,\n params: ValidateActionStepParams,\n ) {\n if (actionStep.signatureType === SignatureType.EVENT) {\n const signature = actionStep.signature;\n let event: AbiEvent;\n if (params.abiItem) event = params.abiItem as AbiEvent;\n else {\n const sigPool = params.knownSignatures as Record<Hex, AbiEvent>;\n event = sigPool[signature] as AbiEvent;\n }\n\n if (!event) {\n throw new ValidationAbiMissingError(signature);\n }\n\n if (this.isArraylikeIndexed(actionStep, event)) {\n // If the field is indexed, we can't filter on it\n throw new UnparseableAbiParamError(\n actionStep.actionParameter.fieldIndex,\n event,\n );\n }\n\n // Use the provided logs, no need to fetch receipt\n if ('logs' in params) {\n return this.isActionEventValid(actionStep, params.logs);\n }\n\n const receipt = await getTransactionReceipt(this._config, {\n ...params,\n chainId: actionStep.chainid,\n });\n if (params.notBeforeBlockNumber)\n return receipt.blockNumber >= params.notBeforeBlockNumber;\n const decodedLogs = receipt.logs.map((log) => {\n const { eventName, args } = decodeEventLog({\n abi: [event],\n data: log.data,\n topics: log.topics,\n });\n\n return { ...log, eventName, args };\n });\n\n return this.isActionEventValid(actionStep, decodedLogs);\n }\n if (actionStep.signatureType === SignatureType.FUNC) {\n if ('hash' in params) {\n const transaction = await getTransaction(this._config, {\n ...params,\n chainId: actionStep.chainid,\n });\n if (params.notBeforeBlockNumber)\n return transaction.blockNumber >= params.notBeforeBlockNumber;\n return this.isActionFunctionValid(actionStep, transaction, params);\n }\n }\n return false;\n }\n\n /**\n * Validates a single action event with a given criteria against logs.\n * If logs are provided in the optional `params` argument, then those logs will be used instead of being fetched with the configured client.\n *\n * @public\n * @async\n * @param {ActionStep} actionStep - The action step containing the event to validate.\n * @param {EventLogs} logs - Event logs to validate the given step against\n * @returns {Promise<boolean>} Resolves to true if the action event is valid, throws if input is invalid, otherwise false.\n */\n public isActionEventValid(actionStep: ActionStep, logs: EventLogs) {\n const criteria = actionStep.actionParameter;\n if (!logs.length) return false;\n for (let log of logs) {\n if (this.validateLogAgainstCriteria(criteria, log)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Validates a single action function with a given criteria against the transaction input.\n *\n * @public\n * @param {ActionStep} actionStep - The action step containing the function to validate.\n * @param {Transaction} transaction - The transaction that will be validated against.\n * @param {Object} [params] - Parameters for validation.\n * @param {AbiItem} [params.abiItem] - The ABI item for the function, if known.\n * @param {Record<Hex, AbiEvent | AbiFunction>} [params.knownSignatures] - A record of known signatures.\n * @returns {boolean} Returns true if the action function is valid, false otherwise.\n * @throws {ValidationAbiMissingError} Throws if the ABI for the function signature is not found.\n * @throws {FunctionDataDecodeError} Throws if there's an error decoding the function data.\n */\n public isActionFunctionValid(\n actionStep: ActionStep,\n transaction: Transaction,\n params: Pick<ValidateActionStepParams, 'abiItem' | 'knownSignatures'>,\n ) {\n const criteria = actionStep.actionParameter;\n let signature = actionStep.signature;\n\n let func: AbiFunction;\n if (params.abiItem) func = params?.abiItem as AbiFunction;\n else {\n const sigPool = params.knownSignatures as Record<Hex, AbiFunction>;\n func = sigPool[signature] as AbiFunction;\n }\n if (!func) {\n throw new ValidationAbiMissingError(signature);\n }\n\n let decodedData;\n try {\n decodedData = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n } catch (e) {\n throw new FunctionDataDecodeError([func], e as Error);\n }\n\n // Validate the criteria against decoded arguments using fieldIndex\n const decodedArgs = decodedData.args;\n\n if (!decodedArgs || !decodedData) return false;\n\n if (\n !this.validateFunctionAgainstCriteria(\n criteria,\n decodedArgs as (string | bigint)[],\n )\n ) {\n return false;\n }\n\n return true;\n }\n /**\n * Validates a field against a given criteria.\n *\n * @param {Criteria} criteria - The criteria to validate against.\n * @param {string | bigint | Hex} fieldValue - The field value to validate.\n * @param {Object} input - Additional context for validation.\n * @param {EventLogs[0]} [input.log] - The event log, if validating an event.\n * @param {readonly (string | bigint)[]} [input.decodedArgs] - The decoded function arguments, if validating a function call.\n * @returns {Promise<boolean>} - Returns true if the field passes the criteria, false otherwise.\n */\n public validateFieldAgainstCriteria(\n criteria: Criteria,\n fieldValue: string | bigint | Hex,\n input:\n | { log: EventLogs[0] }\n | { decodedArgs: readonly (string | bigint)[] },\n ): boolean {\n if (\n criteria.filterType === FilterType.EQUAL &&\n criteria.fieldType === PrimitiveType.BYTES &&\n criteria.fieldIndex === CheatCodes.ANY_ACTION_PARAM\n ) {\n return true;\n }\n\n // Type narrow based on criteria.filterType\n switch (criteria.filterType) {\n case FilterType.EQUAL:\n return match(criteria.fieldType)\n .with(PrimitiveType.ADDRESS, () =>\n isAddressEqual(criteria.filterData, fieldValue as Address),\n )\n .with(\n PrimitiveType.UINT,\n () => BigInt(fieldValue) === BigInt(criteria.filterData),\n )\n .with(\n PrimitiveType.STRING,\n () => fieldValue === fromHex(criteria.filterData, 'string'),\n )\n .otherwise(() => fieldValue === criteria.filterData);\n\n case FilterType.NOT_EQUAL:\n return match(criteria.fieldType)\n .with(\n PrimitiveType.ADDRESS,\n () => !isAddressEqual(criteria.filterData, fieldValue as Address),\n )\n .with(\n PrimitiveType.UINT,\n () => BigInt(fieldValue) !== BigInt(criteria.filterData),\n )\n .with(\n PrimitiveType.STRING,\n () => fieldValue !== fromHex(criteria.filterData, 'string'),\n )\n .otherwise(() => fieldValue !== criteria.filterData);\n\n case FilterType.GREATER_THAN:\n if (criteria.fieldType === PrimitiveType.UINT) {\n return BigInt(fieldValue) > BigInt(criteria.filterData);\n }\n throw new InvalidNumericalCriteriaError({\n ...input,\n criteria,\n fieldValue,\n });\n\n case FilterType.LESS_THAN:\n if (criteria.fieldType === PrimitiveType.UINT) {\n return BigInt(fieldValue) < BigInt(criteria.filterData);\n }\n throw new InvalidNumericalCriteriaError({\n ...input,\n criteria,\n fieldValue,\n });\n\n case FilterType.CONTAINS:\n if (\n criteria.fieldType === PrimitiveType.BYTES ||\n criteria.fieldType === PrimitiveType.STRING\n ) {\n let substring;\n if (criteria.fieldType === PrimitiveType.STRING) {\n substring = fromHex(criteria.filterData, 'string');\n } else {\n // truncate the `0x` prefix\n substring = criteria.filterData.slice(2);\n }\n return (fieldValue as string).includes(substring);\n }\n throw new FieldValueNotComparableError({\n ...input,\n criteria,\n fieldValue,\n });\n\n case FilterType.REGEX:\n if (typeof fieldValue !== 'string') {\n throw new FieldValueNotComparableError({\n ...input,\n criteria,\n fieldValue,\n });\n }\n\n if (criteria.fieldType === PrimitiveType.STRING) {\n // fieldValue is decoded by the ABI\n const regexString = fromHex(criteria.filterData, 'string');\n return new RegExp(regexString).test(fieldValue);\n }\n\n default:\n throw new UnrecognizedFilterTypeError({\n ...input,\n criteria,\n fieldValue,\n });\n }\n }\n\n /**\n * Validates a {@link Log} against a given criteria.\n * If the criteria's fieldIndex is 255 (using CheatCodes enum), it is reserved for anyValidation\n *\n * @param {Criteria} criteria - The criteria to validate against.\n * @param {Log} log - The Viem event log.\n * @returns {boolean} - Returns true if the log passes the criteria, false otherwise.\n */\n public validateLogAgainstCriteria(\n criteria: Criteria,\n log: EventLogs[0],\n ): boolean {\n if (\n !Array.isArray(log.args) ||\n (log.args.length <= criteria.fieldIndex &&\n criteria.fieldIndex !== CheatCodes.ANY_ACTION_PARAM)\n ) {\n throw new DecodedArgsMalformedError({\n log,\n criteria,\n fieldValue: undefined,\n });\n }\n\n const fieldValue =\n criteria.fieldIndex === CheatCodes.ANY_ACTION_PARAM\n ? zeroHash\n : log.args.at(criteria.fieldIndex);\n\n if (fieldValue === undefined) {\n throw new FieldValueUndefinedError({ log, criteria, fieldValue });\n }\n return this.validateFieldAgainstCriteria(criteria, fieldValue, { log });\n }\n\n /**\n * Validates a function's decoded arguments against a given criteria.\n * If the criteria's fieldIndex is 255 (using CheatCodes enum), it is reserved for anyValidation\n *\n * @param {Criteria} criteria - The criteria to validate against.\n * @param {unknown[]} decodedArgs - The decoded arguments of the function call.\n * @returns {Promise<boolean>} - Returns true if the decoded argument passes the criteria, false otherwise.\n */\n public validateFunctionAgainstCriteria(\n criteria: Criteria,\n decodedArgs: readonly (string | bigint)[],\n ): boolean {\n const fieldValue =\n criteria.fieldIndex === CheatCodes.ANY_ACTION_PARAM\n ? zeroHash\n : decodedArgs[criteria.fieldIndex];\n if (fieldValue === undefined) {\n throw new FieldValueUndefinedError({\n criteria,\n fieldValue,\n });\n }\n return this.validateFieldAgainstCriteria(criteria, fieldValue, {\n decodedArgs,\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?EventActionPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: EventActionPayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n let rawPayload: EventActionPayloadRaw;\n if (isEventActionPayloadSimple(payload)) {\n // filter out any falsy potential values\n let tmpSteps: ActionStep[] = payload.actionSteps.filter((step) => !!step);\n if (tmpSteps.length === 0) {\n throw new NoEventActionStepsProvidedError();\n }\n if (tmpSteps.length > 4) {\n throw new TooManyEventActionStepsProvidedError();\n }\n let steps: ActionStepTuple = Array.from({ length: 4 }, (_, i) => {\n // use either the provided step at the given index, or reuse the previous step\n // should aways exist\n return tmpSteps.at(i) || tmpSteps.at(-1);\n }) as ActionStepTuple;\n rawPayload = {\n actionClaimant: payload.actionClaimant,\n actionStepOne: steps[0],\n actionStepTwo: steps[1],\n actionStepThree: steps[2],\n actionStepFour: steps[3],\n };\n } else {\n rawPayload = payload;\n }\n return {\n abi: eventActionAbi,\n bytecode: bytecode as Hex,\n args: [prepareEventActionPayload(rawPayload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n public isArraylikeIndexed(step: ActionStep, event: AbiEvent) {\n if (\n (step.actionParameter.fieldType === PrimitiveType.STRING ||\n step.actionParameter.fieldType === PrimitiveType.BYTES) &&\n event.inputs[step.actionParameter.fieldIndex]?.indexed\n ) {\n return true;\n }\n return false;\n }\n}\n\nfunction _dedupeActionSteps(_steps: ActionStep[]): ActionStep[] {\n const steps: ActionStep[] = [],\n signatures: Record<string, boolean> = {};\n for (let step of _steps) {\n const signature = JSON.stringify(step);\n if (signatures[signature]) continue;\n steps.push(step);\n signatures[signature] = true;\n }\n return steps;\n}\ntype RawActionStep = Overwrite<ActionStep, { chainid: bigint }>;\ntype RawActionClaimant = Overwrite<ActionClaimant, { chainid: bigint }>;\n\nfunction _toRawActionStep<T extends ActionStep | ActionClaimant>(obj: T) {\n return {\n ...obj,\n chainid: BigInt(obj.chainid),\n };\n}\n\nfunction _fromRawActionStep<T extends RawActionStep | RawActionClaimant>(\n obj: T,\n) {\n if (obj.chainid > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new Error('Chain ID exceeds max safe integer');\n }\n\n return {\n ...obj,\n chainid: Number(obj.chainid),\n };\n}\n\n/**\n * Typeguard to determine if a user is supplying a simple or raw EventActionPayload\n *\n * @param {*} opts\n * @returns {opts is EventActionPayloadSimple}\n */\nfunction _isEventActionPayloadSimple(\n opts: EventActionPayload,\n): opts is EventActionPayloadSimple {\n return Array.isArray((opts as EventActionPayloadSimple).actionSteps);\n}\n\n/**\n * Function to properly encode an event action payload.\n *\n * @param {InitPayload} param0\n * @param {ActionStep} param0.actionStepOne - The first action step to initialize.\n * @param {ActionStep} param0.actionStepTwo - The second action step to initialize.\n * @param {ActionStep} param0.actionStepThree - The third action step to initialize.\n * @param {ActionStep} param0.actionStepFour - The fourth action step to initialize.\n * @returns {Hex}\n */\nexport function prepareEventActionPayload({\n actionClaimant,\n actionStepOne,\n actionStepTwo,\n actionStepThree,\n actionStepFour,\n}: EventActionPayloadRaw) {\n // note chainIds are technically uint256 but viem treats them (safely) as numbers,\n // so we encode them as uint32 here to avoid downcast issues\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayload',\n components: [\n {\n type: 'tuple',\n name: 'actionClaimant',\n components: [\n { type: 'uint8', name: 'signatureType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint256', name: 'chainid' },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepOne',\n components: [\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint256', name: 'chainid' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepTwo',\n components: [\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint256', name: 'chainid' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepThree',\n components: [\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint256', name: 'chainid' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepFour',\n components: [\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint256', name: 'chainid' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n ],\n },\n ],\n [\n {\n actionClaimant: _toRawActionStep(actionClaimant),\n actionStepOne: {\n ..._toRawActionStep(actionStepOne),\n actionType: actionStepOne.actionType || 0,\n },\n actionStepTwo: {\n ..._toRawActionStep(actionStepTwo),\n actionType: actionStepTwo.actionType || 0,\n },\n actionStepThree: {\n ..._toRawActionStep(actionStepThree),\n actionType: actionStepThree.actionType || 0,\n },\n actionStepFour: {\n ..._toRawActionStep(actionStepFour),\n actionType: actionStepFour.actionType || 0,\n },\n },\n ],\n );\n}\n\n/**\n * Creates a default Criteria object that allows validation to pass. This is used if you don't care about targeting specific parameters in the action step.\n *\n * This function returns a Criteria object with the following properties:\n * - filterType: Set to EQUAL for exact matching\n * - fieldType: Set to BYTES to handle any data type\n * - fieldIndex: Set to 255, which is typically used to indicate \"any\" or \"all\" in this context using CheatCodes enum\n * - filterData: Set to zeroHash (0x0000...0000)\n *\n * @returns {Criteria} A Criteria object that can be used to match any action parameter\n *\n * @example\n * const anyCriteria = anyActionParameter();\n * // Use this criteria in an ActionStep to match any parameter\n * const actionStep = {\n * // ... other properties ...\n * actionParameter: anyCriteria\n * };\n */\nexport function anyActionParameter(): Criteria {\n return {\n filterType: FilterType.EQUAL,\n fieldType: PrimitiveType.BYTES,\n fieldIndex: CheatCodes.ANY_ACTION_PARAM,\n filterData: zeroHash,\n };\n}\n\n/**\n * Creates an ActionClaimant object that represents the transaction sender as the claimant.\n * This function is useful when you want to set up an action where the transaction sender is always considered the valid claimant,\n * regardless of the event or function parameters.\n *\n * The returned ActionClaimant has the following properties:\n * - signatureType: Set to SignatureType.EVENT (though it doesn't matter for this case)\n * - signature: Set to zeroHash (0x0000...0000)\n * - fieldIndex: Set to 255, indicating \"any\" field using CheatCodes enum\n * - targetContract: Set to zeroAddress (0x0000...0000)\n * - chainid: The chain ID on which the transaction is sent, should match the chain ID for the action's {@link ActionStep}\n *\n * @param {number} chainId - The chain ID on which the transaction is sent, should match the chain ID for the action's {@link ActionStep}\n * @returns {ActionClaimant} An ActionClaimant object representing the msg.sender\n *\n * @example\n * const eventAction = new EventAction();\n * const payload: EventActionPayload = {\n * actionClaimant: transactionSenderClaimant(),\n * actionSteps: [\n * // ... define your action steps here\n * ]\n * };\n * await eventAction.deploy(payload);\n */\nexport function transactionSenderClaimant(chainId: number): ActionClaimant {\n return {\n signatureType: SignatureType.EVENT,\n signature: zeroHash,\n fieldIndex: CheatCodes.TX_SENDER_CLAIMANT,\n targetContract: zeroAddress,\n chainid: chainId,\n };\n}\n"],"names":["t","e","n","r","i","s","o","c","a","h","m","d","y","p","v","b","w","j","x","A","W","$","I","u","FilterType","PrimitiveType","SignatureType","isEventActionPayloadSimple","opts","_EventAction","DeployableTarget","eventActionAbi","index","params","steps","readEventActionGetActionSteps","_dedupeActionSteps","_fromRawActionStep","result","readEventActionGetActionClaimant","data","request","simulateEventActionExecute","writeEventActionExecute","claimant","CheatCodes","transaction","getTransaction","log","signature","event","ValidationAbiMissingError","address","isAddressEqual","addressCandidate","receipt","getTransactionReceipt","decodedLogs","eventName","args","decodeEventLog","func","decodedData","decodeFunctionData","FunctionDataDecodeError","logOrFnData","maybeAddress","isAddress","actionSteps","actionStep","UnparseableAbiParamError","logs","criteria","decodedArgs","fieldValue","input","match","fromHex","InvalidNumericalCriteriaError","substring","FieldValueNotComparableError","regexString","UnrecognizedFilterTypeError","DecodedArgsMalformedError","zeroHash","FieldValueUndefinedError","_payload","_options","payload","options","rawPayload","tmpSteps","step","NoEventActionStepsProvidedError","TooManyEventActionStepsProvidedError","_","bytecode","prepareEventActionPayload","_a","EventActionBases","RegistryType","EventAction","_steps","signatures","_toRawActionStep","obj","actionClaimant","actionStepOne","actionStepTwo","actionStepThree","actionStepFour","encodeAbiParameters","anyActionParameter","transactionSenderClaimant","chainId","zeroAddress"],"mappings":";;;;;;;q9jBAAMA,IAAE,OAAO,IAAI,qBAAqB,GAAEC,KAAE,OAAO,IAAI,wBAAwB,GAAEC,IAAE,oCAAmCC,IAAE,OAAG,GAAQ,KAAa,OAAO,KAAjB,WAAoBC,IAAE,CAAAH,MAAGA,KAAG,CAAC,CAACA,EAAED,CAAC,GAAEK,IAAE,CAACH,GAAEI,GAAEC,MAAI;AAAC,MAAGH,EAAEF,CAAC,GAAE;AAAC,UAAMD,IAAEC,EAAEF,CAAC,EAAG,GAAC,EAAC,SAAQG,GAAE,YAAWC,EAAC,IAAEH,EAAE,MAAMK,CAAC;AAAE,WAAOH,KAAGC,KAAG,OAAO,KAAKA,CAAC,EAAE,QAAQ,CAAAJ,MAAGO,EAAEP,GAAEI,EAAEJ,CAAC,CAAC,CAAC,GAAEG;AAAA,EAAC;AAAC,MAAGA,EAAED,CAAC,GAAE;AAAC,QAAG,CAACC,EAAEG,CAAC,EAAE,QAAM;AAAG,QAAG,MAAM,QAAQJ,CAAC,GAAE;AAAC,UAAG,CAAC,MAAM,QAAQI,CAAC,EAAE,QAAM;AAAG,UAAIN,IAAE,CAAA,GAAGG,IAAE,CAAE,GAAC,IAAE,CAAA;AAAG,iBAAUE,KAAKH,EAAE,KAAM,GAAC;AAAC,cAAM,IAAEA,EAAEG,CAAC;AAAE,QAAAD,EAAE,CAAC,KAAG,EAAEH,EAAC,IAAE,EAAE,KAAK,CAAC,IAAE,EAAE,SAAOE,EAAE,KAAK,CAAC,IAAEH,EAAE,KAAK,CAAC;AAAA,MAAC;AAAC,UAAG,EAAE,QAAO;AAAC,YAAG,EAAE,SAAO,EAAE,OAAM,IAAI,MAAM,0FAA0F;AAAE,YAAGM,EAAE,SAAON,EAAE,SAAOG,EAAE,OAAO,QAAM;AAAG,cAAMF,IAAEK,EAAE,MAAM,GAAEN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AAA,MACE;AAAA,QACE,gBAAgBP,EAAiBE,CAAc;AAAA,QAC/C,eAAe;AAAA,UACb,GAAGF,EAAiBG,CAAa;AAAA,UACjC,YAAYA,EAAc,cAAc;AAAA,QAC1C;AAAA,QACA,eAAe;AAAA,UACb,GAAGH,EAAiBI,CAAa;AAAA,UACjC,YAAYA,EAAc,cAAc;AAAA,QAC1C;AAAA,QACA,iBAAiB;AAAA,UACf,GAAGJ,EAAiBK,CAAe;AAAA,UACnC,YAAYA,EAAgB,cAAc;AAAA,QAC5C;AAAA,QACA,gBAAgB;AAAA,UACd,GAAGL,EAAiBM,CAAc;AAAA,UAClC,YAAYA,EAAe,cAAc;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAAA,EAAA;AAEJ;AAqBO,SAASE,KAA+B;AACtC,SAAA;AAAA,IACL,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,YAAYnE,EAAW;AAAA,IACvB,YAAYuC;AAAA,EAAA;AAEhB;AA2BO,SAAS6B,GAA0BC,GAAiC;AAClE,SAAA;AAAA,IACL,eAAe;AAAA,IACf,WAAW9B;AAAA,IACX,YAAYvC,EAAW;AAAA,IACvB,gBAAgBsE;AAAA,IAChB,SAASD;AAAA,EAAA;AAEb;","x_google_ignoreList":[0]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boostxyz/sdk",
3
- "version": "2.0.0-alpha.27",
3
+ "version": "2.0.0-alpha.28",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "files": [
@@ -38,6 +38,7 @@ import {
38
38
  transactionSenderClaimant,
39
39
  } from "./EventAction";
40
40
  import { allKnownSignatures } from "@boostxyz/test/allKnownSignatures";
41
+ import { getTransactionReceipt } from "@wagmi/core";
41
42
 
42
43
  let fixtures: Fixtures,
43
44
  erc721: MockERC721,
@@ -427,7 +428,6 @@ describe("EventAction Event Selector", () => {
427
428
  expect(
428
429
  await action.validateActionSteps({
429
430
  hash,
430
- chainId,
431
431
  knownSignatures: allKnownSignatures,
432
432
  }),
433
433
  ).toBe(true);
@@ -466,7 +466,6 @@ describe("EventAction Event Selector", () => {
466
466
  expect(
467
467
  await action.validateActionSteps({
468
468
  hash,
469
- chainId,
470
469
  logs,
471
470
  knownSignatures: allKnownSignatures,
472
471
  }),
@@ -492,7 +491,6 @@ describe("EventAction Event Selector", () => {
492
491
  await expect(() =>
493
492
  action.validateActionSteps({
494
493
  hash,
495
- chainId,
496
494
  knownSignatures: allKnownSignatures,
497
495
  }),
498
496
  ).rejects.toThrowError(/Parameter is not transparently stored onchain/);
@@ -513,7 +511,6 @@ describe("EventAction Event Selector", () => {
513
511
  expect(
514
512
  await action.validateActionSteps({
515
513
  hash,
516
- chainId,
517
514
  knownSignatures: allKnownSignatures,
518
515
  }),
519
516
  ).toBe(true);
@@ -535,7 +532,6 @@ describe("EventAction Event Selector", () => {
535
532
  expect(
536
533
  await action.validateActionSteps({
537
534
  hash,
538
- chainId,
539
535
  knownSignatures: allKnownSignatures,
540
536
  }),
541
537
  ).toBe(true);
@@ -562,7 +558,6 @@ describe("EventAction Event Selector", () => {
562
558
  await action.getActionClaimant(),
563
559
  {
564
560
  hash,
565
- chainId,
566
561
  knownSignatures: allKnownSignatures,
567
562
  },
568
563
  ))!,
@@ -585,7 +580,6 @@ describe("EventAction Event Selector", () => {
585
580
  await action.getActionClaimant(),
586
581
  {
587
582
  hash,
588
- chainId,
589
583
  knownSignatures: allKnownSignatures,
590
584
  },
591
585
  ),
@@ -604,13 +598,65 @@ describe("EventAction Event Selector", () => {
604
598
  await action.getActionClaimant(),
605
599
  {
606
600
  hash,
607
- chainId,
608
601
  knownSignatures: allKnownSignatures,
609
602
  },
610
603
  ),
611
604
  ).toBe(recipient);
612
605
  });
613
606
 
607
+ test("can derive the claimant from a function action only if tx block number is gte than `notBeforeBlockNumber`", async () => {
608
+ const action = await loadFixture(cloneFunctionAction(fixtures, erc721));
609
+ const recipient = accounts[1].account;
610
+ const { hash } = await erc721.mintRaw(recipient, {
611
+ value: parseEther(".1"),
612
+ });
613
+
614
+ const receipt = await getTransactionReceipt(defaultOptions.config, {
615
+ hash,
616
+ });
617
+
618
+ expect(
619
+ await action.deriveActionClaimantFromTransaction(
620
+ await action.getActionClaimant(),
621
+ {
622
+ hash,
623
+ knownSignatures: allKnownSignatures,
624
+ notBeforeBlockNumber: 1n,
625
+ },
626
+ ),
627
+ ).toBe(recipient);
628
+ expect(
629
+ await action.deriveActionClaimantFromTransaction(
630
+ await action.getActionClaimant(),
631
+ {
632
+ hash,
633
+ knownSignatures: allKnownSignatures,
634
+ notBeforeBlockNumber: receipt.blockNumber,
635
+ },
636
+ ),
637
+ ).toBe(recipient);
638
+ expect(
639
+ await action.deriveActionClaimantFromTransaction(
640
+ await action.getActionClaimant(),
641
+ {
642
+ hash,
643
+ knownSignatures: allKnownSignatures,
644
+ notBeforeBlockNumber: receipt.blockNumber + 1n,
645
+ },
646
+ ),
647
+ ).toBe(undefined);
648
+ expect(
649
+ await action.deriveActionClaimantFromTransaction(
650
+ await action.getActionClaimant(),
651
+ {
652
+ hash,
653
+ knownSignatures: allKnownSignatures,
654
+ notBeforeBlockNumber: BigInt(Number.MAX_SAFE_INTEGER),
655
+ },
656
+ ),
657
+ ).toBe(undefined);
658
+ });
659
+
614
660
  test("validates empty actionParameter", async () => {
615
661
  const action = await loadFixture(
616
662
  cloneEventAction(
@@ -629,7 +675,6 @@ describe("EventAction Event Selector", () => {
629
675
  expect(
630
676
  await action.validateActionSteps({
631
677
  hash,
632
- chainId,
633
678
  knownSignatures: allKnownSignatures,
634
679
  }),
635
680
  ).toBe(true);
@@ -932,12 +977,57 @@ describe("EventAction Func Selector", () => {
932
977
  expect(
933
978
  await action.isActionStepValid(actionStep, {
934
979
  hash,
935
- chainId,
936
980
  knownSignatures: allKnownSignatures,
937
981
  }),
938
982
  ).toBe(true);
939
983
  });
940
984
 
985
+ test("validates action step with `notBeforeBlockNumber` lower than tx blockNumber", async () => {
986
+ const action = await loadFixture(cloneFunctionAction(fixtures, erc721));
987
+ const actionSteps = await action.getActionSteps();
988
+ const actionStep = actionSteps[0]!;
989
+ const recipient = accounts[1].account;
990
+ const { hash } = await erc721.mintRaw(recipient, {
991
+ value: parseEther(".1"),
992
+ });
993
+
994
+ const criteriaMatch = await action.isActionStepValid(actionStep, {
995
+ notBeforeBlockNumber: BigInt(Number.MAX_SAFE_INTEGER),
996
+ hash,
997
+ knownSignatures: allKnownSignatures,
998
+ });
999
+
1000
+ expect(criteriaMatch).toBe(false);
1001
+ });
1002
+
1003
+ test("validates action step with `notBeforeBlockNumber` greater than/equal to tx blockNumber", async () => {
1004
+ const action = await loadFixture(cloneFunctionAction(fixtures, erc721));
1005
+ const actionSteps = await action.getActionSteps();
1006
+ const actionStep = actionSteps[0]!;
1007
+ const recipient = accounts[1].account;
1008
+ const { hash } = await erc721.mintRaw(recipient, {
1009
+ value: parseEther(".1"),
1010
+ });
1011
+ const receipt = await getTransactionReceipt(defaultOptions.config, {
1012
+ hash,
1013
+ });
1014
+
1015
+ const eqMatch = await action.isActionStepValid(actionStep, {
1016
+ notBeforeBlockNumber: receipt.blockNumber,
1017
+ hash,
1018
+ knownSignatures: allKnownSignatures,
1019
+ });
1020
+
1021
+ expect(eqMatch).toBe(true);
1022
+ const gtMatch = await action.isActionStepValid(actionStep, {
1023
+ notBeforeBlockNumber: receipt.blockNumber - 1n,
1024
+ hash,
1025
+ knownSignatures: allKnownSignatures,
1026
+ });
1027
+
1028
+ expect(gtMatch).toBe(true);
1029
+ });
1030
+
941
1031
  test("validates function step with EQUAL filter", async () => {
942
1032
  const action = await loadFixture(cloneFunctionAction(fixtures, erc721));
943
1033
  const actionSteps = await action.getActionSteps();
@@ -949,7 +1039,6 @@ describe("EventAction Func Selector", () => {
949
1039
 
950
1040
  const criteriaMatch = await action.isActionStepValid(actionStep, {
951
1041
  hash,
952
- chainId,
953
1042
  knownSignatures: allKnownSignatures,
954
1043
  });
955
1044
 
@@ -974,7 +1063,6 @@ describe("EventAction Func Selector", () => {
974
1063
  try {
975
1064
  await action.isActionStepValid(invalidStep, {
976
1065
  hash,
977
- chainId,
978
1066
  knownSignatures: allKnownSignatures,
979
1067
  });
980
1068
  } catch (e) {
@@ -1001,7 +1089,6 @@ describe("EventAction Func Selector", () => {
1001
1089
  expect(
1002
1090
  await action.validateActionSteps({
1003
1091
  hash,
1004
- chainId,
1005
1092
  knownSignatures: allKnownSignatures,
1006
1093
  }),
1007
1094
  ).toBe(true);
@@ -1020,7 +1107,6 @@ describe("EventAction Func Selector", () => {
1020
1107
  expect(
1021
1108
  await action.isActionStepValid(actionStep, {
1022
1109
  hash,
1023
- chainId,
1024
1110
  knownSignatures: allKnownSignatures,
1025
1111
  }),
1026
1112
  ).toBe(true);
@@ -1045,7 +1131,6 @@ describe("EventAction Func Selector", () => {
1045
1131
  expect(
1046
1132
  await action.isActionStepValid(actionStep, {
1047
1133
  hash,
1048
- chainId,
1049
1134
  knownSignatures: allKnownSignatures,
1050
1135
  }),
1051
1136
  ).toBe(true);
@@ -1069,7 +1154,6 @@ describe("EventAction Func Selector", () => {
1069
1154
  expect(
1070
1155
  await action.isActionStepValid(actionStep, {
1071
1156
  hash,
1072
- chainId,
1073
1157
  knownSignatures: allKnownSignatures,
1074
1158
  }),
1075
1159
  ).toBe(true);
@@ -1085,7 +1169,6 @@ describe("EventAction Func Selector", () => {
1085
1169
  expect(
1086
1170
  await action.validateActionSteps({
1087
1171
  hash,
1088
- chainId,
1089
1172
  knownSignatures: allKnownSignatures,
1090
1173
  }),
1091
1174
  ).toBe(true);