Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS support for external bots #346

Merged
merged 4 commits into from
Oct 13, 2023

Conversation

haseebrabbani
Copy link
Collaborator

first need to set FORTA_API_KEY env variable. example usage:

const response = await sendAlerts({
    botId: "0x42265c815a3f2cc137bcd30f6688860ac0201911ce6006576b4b3e7f6e62ddc6",
    finding: Finding.from({
      name: `haseeb test ${Date.now()}`,
      description: "this is a test",
      alertId: "HASEEB_TEST_1",
      type: FindingType.Exploit,
      severity: FindingSeverity.Info,
      labels: [
        Label.from({
          entityType: EntityType.Address,
          entity: "0x87fb424282bd043de413aa74153af073d8c9bbb5",
          confidence: 0.95,
          label: "Attackerrr",
          metadata: {
            some: "data",
          },
        }),
        Label.from({
          entityType: EntityType.Unknown,
          entity: "bla",
          confidence: 0.15,
          label: "Hacker",
        }),
      ],
      source: {
        chains: [
          {
            chainId: 137,
          },
        ],
        transactions: [
          {
            chainId: 137,
            hash: "0xcc8dedfbc2c2757e793ccc781746a8996658541885017314ced5138ae6009f26",
          },
          {
            chainId: 1,
            hash: "0x0ce941aae4eecdd1cae0fe4c90e8c3b14a84f346b669c60e654b2eecd736b9b6",
          },
        ],
      },
      addresses: ["0x87fb424282bd043de413aa74153af073d8c9bbb5"],
      metadata: {
        chain: "137",
      },
      uniqueKey: `HASEEB-${Date.now()}`,
      timestamp: new Date(1694214981000),
    }),
  });
  console.log(response);

@haseebrabbani haseebrabbani merged commit 4e4c71a into master Oct 13, 2023
1 check failed
@haseebrabbani haseebrabbani deleted the forta-1259-js-external-bot-support branch October 13, 2023 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant