@egabee/actions
v1.0.3
Published
Egabee web3 actions
Downloads
13
Readme
@egabee/actions
Trigger Egabee Actions from blockchain indexers, i.e Subsquid, Subgraph, Subquery.
npm i @egabee/actions
pnpm i @egabee/actions
yarn add @egabee/actions
import axios from 'axios'
import { ActionRun } from '@egabee/actions'
const myAction = {
chainId: '1',
triggerSource: 'Subsquid'
eventType: 'Block'
payload: { blockNumber: 119756183 }
}
// Replace YOUR_ACCESS_TOKEN with your actual Egabee API token
const API_KEY = '9ec43feacc7ea9e4249d544b7092c9972f620a95297ffafcdcaa9428a14d38c3'
// Replace it with your project id
const PROJECT_ID = 'e2206c00-13b5-4dcb-8fe0-96cb28221e42'
const EGABEE_API_URL = `https://api.egabee.com/api/0/web3-actions/${PROJECT_ID}/actions/runs/`
const requestConfig = {
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
}
// Trigger the action with a post request
const { data } = await axios.post(url, myAction, requestConfig)
console.log(data.success)