Gelato Network
Search
⌃K

Testing Web3 Functions

Test your web3 function

To test your Web3 Function locally, run:
npx w3f test FILENAME
Example:
npx w3f test src/web3-functions/examples/oracle/index.ts

Optional flags:

  • --show-logs Show internal Web3 Function logs
  • --debug Show Runtime debug messages
  • --chain-id=[number] Specify the chainId to be used for your Web3 Function (default: 5)
  • --user-args=[key]:[value] Set your Web3 Function user args
Example:
npx w3f test src/web3-functions/examples/oracle/index.ts --show-logs
Output:
Web3Function Build result:
✓ File: ./.tmp/index.js
✓ File size: 1.70mb
✓ Build time: 109.93ms
Web3Function running logs:
> ChainId: 5
> Last oracle update: 1665512172
> Next oracle update: 1665512472
> Updating price: 1586
Web3Function Result:
✓ Return value: {
canExec: true,
callData: '0x8d6cc56d0000000000000000000000000000000000000000000000000000000000000632'
}
Web3Function Runtime stats:
✓ Duration: 5.41s
✓ Memory: 57.77mb