Stream triggers validation error

Hi, I want to get my http endpoint calls only when specific address make a swap on Uniswap? When I add UniversalRouter address (0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad) and ABI to the triggers, it gives me an error “Could not validate: [“triggers”]”. What I’m doing wrong?


Hi @JUMPER

Can you once try removing and adding ABI again? both the streams abi and the triggers abi. It could be possible that the ABI is not read correctly.

I copied ABI from etherscan, is this correct?

There is what returns from http request, when I click “Update stream”:

Ahh ok. This might be an existing issue which we know. Let me share it with the devs.

Can you share me your current stream config json and the ABI of the trigger?

You can get the json config of stream using the below endpoint

There it is

ABI:
[{“inputs”:[{“components”:[{“internalType”:“address”,“name”:“permit2”,“type”:“address”},{“internalType”:“address”,“name”:“weth9”,“type”:“address”},{“internalType”:“address”,“name”:“seaportV1_5”,“type”:“address”},{“internalType”:“address”,“name”:“seaportV1_4”,“type”:“address”},{“internalType”:“address”,“name”:“openseaConduit”,“type”:“address”},{“internalType”:“address”,“name”:“nftxZap”,“type”:“address”},{“internalType”:“address”,“name”:“x2y2”,“type”:“address”},{“internalType”:“address”,“name”:“foundation”,“type”:“address”},{“internalType”:“address”,“name”:“sudoswap”,“type”:“address”},{“internalType”:“address”,“name”:“elementMarket”,“type”:“address”},{“internalType”:“address”,“name”:“nft20Zap”,“type”:“address”},{“internalType”:“address”,“name”:“cryptopunks”,“type”:“address”},{“internalType”:“address”,“name”:“looksRareV2”,“type”:“address”},{“internalType”:“address”,“name”:“routerRewardsDistributor”,“type”:“address”},{“internalType”:“address”,“name”:“looksRareRewardsDistributor”,“type”:“address”},{“internalType”:“address”,“name”:“looksRareToken”,“type”:“address”},{“internalType”:“address”,“name”:“v2Factory”,“type”:“address”},{“internalType”:“address”,“name”:“v3Factory”,“type”:“address”},{“internalType”:“bytes32”,“name”:“pairInitCodeHash”,“type”:“bytes32”},{“internalType”:“bytes32”,“name”:“poolInitCodeHash”,“type”:“bytes32”}],“internalType”:“struct RouterParameters”,“name”:“params”,“type”:“tuple”}],“stateMutability”:“nonpayable”,“type”:“constructor”},{“inputs”:[],“name”:“BalanceTooLow”,“type”:“error”},{“inputs”:[],“name”:“BuyPunkFailed”,“type”:“error”},{“inputs”:[],“name”:“ContractLocked”,“type”:“error”},{“inputs”:[],“name”:“ETHNotAccepted”,“type”:“error”},{“inputs”:[{“internalType”:“uint256”,“name”:“commandIndex”,“type”:“uint256”},{“internalType”:“bytes”,“name”:“message”,“type”:“bytes”}],“name”:“ExecutionFailed”,“type”:“error”},{“inputs”:[],“name”:“FromAddressIsNotOwner”,“type”:“error”},{“inputs”:[],“name”:“InsufficientETH”,“type”:“error”},{“inputs”:[],“name”:“InsufficientToken”,“type”:“error”},{“inputs”:[],“name”:“InvalidBips”,“type”:“error”},{“inputs”:[{“internalType”:“uint256”,“name”:“commandType”,“type”:“uint256”}],“name”:“InvalidCommandType”,“type”:“error”},{“inputs”:[],“name”:“InvalidOwnerERC1155”,“type”:“error”},{“inputs”:[],“name”:“InvalidOwnerERC721”,“type”:“error”},{“inputs”:[],“name”:“InvalidPath”,“type”:“error”},{“inputs”:[],“name”:“InvalidReserves”,“type”:“error”},{“inputs”:[],“name”:“InvalidSpender”,“type”:“error”},{“inputs”:[],“name”:“LengthMismatch”,“type”:“error”},{“inputs”:[],“name”:“SliceOutOfBounds”,“type”:“error”},{“inputs”:[],“name”:“TransactionDeadlinePassed”,“type”:“error”},{“inputs”:[],“name”:“UnableToClaim”,“type”:“error”},{“inputs”:[],“name”:“UnsafeCast”,“type”:“error”},{“inputs”:[],“name”:“V2InvalidPath”,“type”:“error”},{“inputs”:[],“name”:“V2TooLittleReceived”,“type”:“error”},{“inputs”:[],“name”:“V2TooMuchRequested”,“type”:“error”},{“inputs”:[],“name”:“V3InvalidAmountOut”,“type”:“error”},{“inputs”:[],“name”:“V3InvalidCaller”,“type”:“error”},{“inputs”:[],“name”:“V3InvalidSwap”,“type”:“error”},{“inputs”:[],“name”:“V3TooLittleReceived”,“type”:“error”},{“inputs”:[],“name”:“V3TooMuchRequested”,“type”:“error”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“uint256”,“name”:“amount”,“type”:“uint256”}],“name”:“RewardsSent”,“type”:“event”},{“inputs”:[{“internalType”:“bytes”,“name”:“looksRareClaim”,“type”:“bytes”}],“name”:“collectRewards”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“bytes”,“name”:“commands”,“type”:“bytes”},{“internalType”:“bytes[]”,“name”:“inputs”,“type”:“bytes[]”}],“name”:“execute”,“outputs”:[],“stateMutability”:“payable”,“type”:“function”},{“inputs”:[{“internalType”:“bytes”,“name”:“commands”,“type”:“bytes”},{“internalType”:“bytes[]”,“name”:“inputs”,“type”:“bytes[]”},{“internalType”:“uint256”,“name”:“deadline”,“type”:“uint256”}],“name”:“execute”,“outputs”:[],“stateMutability”:“payable”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:"",“type”:“address”},{“internalType”:“address”,“name”:"",“type”:“address”},{“internalType”:“uint256[]”,“name”:"",“type”:“uint256[]”},{“internalType”:“uint256[]”,“name”:"",“type”:“uint256[]”},{“internalType”:“bytes”,“name”:"",“type”:“bytes”}],“name”:“onERC1155BatchReceived”,“outputs”:[{“internalType”:“bytes4”,“name”:"",“type”:“bytes4”}],“stateMutability”:“pure”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:"",“type”:“address”},{“internalType”:“address”,“name”:"",“type”:“address”},{“internalType”:“uint256”,“name”:"",“type”:“uint256”},{“internalType”:“uint256”,“name”:"",“type”:“uint256”},{“internalType”:“bytes”,“name”:"",“type”:“bytes”}],“name”:“onERC1155Received”,“outputs”:[{“internalType”:“bytes4”,“name”:"",“type”:“bytes4”}],“stateMutability”:“pure”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:"",“type”:“address”},{“internalType”:“address”,“name”:"",“type”:“address”},{“internalType”:“uint256”,“name”:"",“type”:“uint256”},{“internalType”:“bytes”,“name”:"",“type”:“bytes”}],“name”:“onERC721Received”,“outputs”:[{“internalType”:“bytes4”,“name”:"",“type”:“bytes4”}],“stateMutability”:“pure”,“type”:“function”},{“inputs”:[{“internalType”:“bytes4”,“name”:“interfaceId”,“type”:“bytes4”}],“name”:“supportsInterface”,“outputs”:[{“internalType”:“bool”,“name”:"",“type”:“bool”}],“stateMutability”:“pure”,“type”:“function”},{“inputs”:[{“internalType”:“int256”,“name”:“amount0Delta”,“type”:“int256”},{“internalType”:“int256”,“name”:“amount1Delta”,“type”:“int256”},{“internalType”:“bytes”,“name”:“data”,“type”:“bytes”}],“name”:“uniswapV3SwapCallback”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“stateMutability”:“payable”,“type”:“receive”}]

Thanks for the details. Will share it with the devs. :raised_hands:

Meanwhile, for a temporary fix, you can try creating a new stream with a similar configuration. Since this is a known issue for existing streams creating a new stream should not cause any issue.

Same error.
Maybe I do something wrong? Can you please explain what I should provide in trigger parameters to get stream requests only when listening address make swap on Uniswap? Should I provide whole UniversalRouter ABI or just a “execute” function ABI? Maybe your API listening only events on smartcontract so if there is no events on UniversalRouter - no notification will send.


Because when I set up stream to listen default erc20 token with “transfer” event - everything works perfectly. But I need to listen transaction of specific addresses with UniversalRouter, which has only one event “RewardSent(uint256)”.



image

hmm…Maybe remove the outer square brackets.
This docs has the below image where it show no outer square brackets

I came to the conclusion that these triggers are not suitable for me at all, since they can only work with read-only functions, but I need to listen “execute”, which is a write function.

Ahh I see. Write function require gas payment so it is not possible through API.

No, maybe you didn’t understand. I don’t need to interact with smartcontract (run read/write functions), I want to receive notification to my webhook when some user interacted with contract (made a swap on uniswap). Is that possible?

Swap transactions emit and event so you can monitor these contract events. You don’t need triggers for this. Triggers are for different purpose. You can setup stream to listen to just an event.

Here is an example that shows how to monitor an contract transfer event. You can apply the same to your contract.

The problem is that neither UniversalRouter (0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD) nor UniswapV2Router (0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D) have swap events.

Hi @JUMPER

Sry for the delay. I believe swap events are only emitted directly by the LP contracts not from the router contract.

From example
The below contract is the LP contract of USDT - WETH pair.
https://etherscan.io/address/0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852#events

So if you try to monitor the swaps from 0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852 contract you can get notifications from all the swaps.

In streams you can monitor more that one contract address. So if you add all the required addresses to your stream then you can get webhooks for all the swaps from the contracts.

Thank you, but this is not my case, I need to listen all swaps of the address, even shitcoins :frowning:

We have listen to all addresses option in streams. This will listen to all the contracts that are on blockchain for the event matching with the swap ABI.
image

Does this help?

Please note that if you enable this you will receive a lot of records in the webhook. So you have to make sure your server can process all the data quickly.