@boostxyz/sdk 8.0.0-canary.4 → 8.0.0-canary.5

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.
@@ -27,7 +27,6 @@ import {
27
27
  isAddress,
28
28
  isAddressEqual,
29
29
  pad,
30
- toEventSelector,
31
30
  trim,
32
31
  zeroAddress,
33
32
  zeroHash,
@@ -613,7 +612,7 @@ export class EventAction extends DeployableTarget<
613
612
  ({ decodedLogs } = await this.decodeTransferLogs(receipt));
614
613
  } else {
615
614
  decodedLogs = receipt.logs
616
- .filter((log) => log.topics[0] === toEventSelector(event))
615
+ .filter((log) => log.topics[0] === signature)
617
616
  .map((log) => decodeAndReorderLogArgs(event, log));
618
617
  }
619
618
 
@@ -777,7 +776,7 @@ export class EventAction extends DeployableTarget<
777
776
  }
778
777
 
779
778
  const decodedLogs = receipt.logs
780
- .filter((log) => log.topics[0] === toEventSelector(event))
779
+ .filter((log) => log.topics[0] === signature)
781
780
  .map((log) => decodeAndReorderLogArgs(event, log));
782
781
 
783
782
  return this.isActionEventValid(actionStep, decodedLogs, event);
@@ -819,6 +818,13 @@ export class EventAction extends DeployableTarget<
819
818
 
820
819
  // Check each log
821
820
  for (let log of logs) {
821
+ // Log address must match the target contract. Zero address is a wildcard.
822
+ if (
823
+ actionStep.targetContract !== zeroAddress &&
824
+ !isAddressEqual(log.address, actionStep.targetContract)
825
+ ) {
826
+ continue;
827
+ }
822
828
  // parse out final (scalar) field from the log args
823
829
  try {
824
830
  if (!Array.isArray(log.args)) {
@@ -999,6 +1005,14 @@ export class EventAction extends DeployableTarget<
999
1005
  transaction: Transaction,
1000
1006
  params: Pick<ValidateActionStepParams, 'abiItem' | 'knownSignatures'>,
1001
1007
  ) {
1008
+ // Log address must match the target contract. Zero address is a wildcard.
1009
+ if (
1010
+ actionStep.targetContract !== zeroAddress &&
1011
+ (!transaction.to ||
1012
+ !isAddressEqual(transaction.to, actionStep.targetContract))
1013
+ ) {
1014
+ return false;
1015
+ }
1002
1016
  const criteria = actionStep.actionParameter;
1003
1017
  const signature = actionStep.signature;
1004
1018
 
@@ -1363,7 +1377,7 @@ export class EventAction extends DeployableTarget<
1363
1377
  }
1364
1378
 
1365
1379
  const decodedLogs = receipt.logs
1366
- .filter((log) => log.topics[0] === toEventSelector(event))
1380
+ .filter((log) => log.topics[0] === signature)
1367
1381
  .map((log) => decodeAndReorderLogArgs(event, log));
1368
1382
 
1369
1383
  return this.filterLogsByActionStepCriteria(actionStep, decodedLogs, event);
@@ -1389,7 +1403,12 @@ export class EventAction extends DeployableTarget<
1389
1403
  if (!logs.length) return filteredLogs;
1390
1404
 
1391
1405
  for (let log of logs) {
1392
- if (!isAddressEqual(log.address, actionStep.targetContract)) continue;
1406
+ // Log address must match the target contract. Zero address is a wildcard.
1407
+ if (
1408
+ actionStep.targetContract !== zeroAddress &&
1409
+ !isAddressEqual(log.address, actionStep.targetContract)
1410
+ )
1411
+ continue;
1393
1412
 
1394
1413
  try {
1395
1414
  if (!Array.isArray(log.args)) {