https://github.com/sovaslava/anydatarequester
https://github.com/sovaslava/anydatarequester
chainlink regular-expression
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/sovaslava/anydatarequester
- Owner: SovaSlava
- Created: 2022-10-15T13:28:58.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-15T13:44:31.000Z (over 3 years ago)
- Last Synced: 2025-03-09T02:32:27.668Z (over 1 year ago)
- Topics: chainlink, regular-expression
- Language: TypeScript
- Homepage:
- Size: 312 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Inspiration
Sometimes, smart contracts need to data from websites, but some of them don't have neccessary api. Or contract need to part of non-json ipfs file. I think Its hinders web3 development.
## What it does
Any data requester - is external adapter for chainlink node, which give you opportunity to get any data from web sites or ipfs file. Its possible, because you can use regular expressions for getting information.
There are 3 type of requests:
1. extract one text - you have to pass matchIndex parameter for cases, if result of matches will have more than one match of regulax expression.
2. extract all data(multiMatch), which match with regular expression.
3. get true/false result for question-if text from website or ipfs contain data, which match to regular expression.
And, if you make mistake in url or regexp, you will get response anyway. And can understand, where was mistake, because each response from external adapter hash status.
It is 0, if response complete without erros.
1 - if url is unreachable
2 - if regular express has error
3 - no such index in array of matched text (only for multiMatch type)
## How we built it
I launch own chainlink node in goerli network on vps for testing external adapter. And use hardhat for writing smart contract. Also write external adapter's code.
## Challenges we ran into
Writting errors handlers for cornen cases, converting string array to bytes for passing in contract.
## Accomplishments that we're proud of
Accomplishments that we're proud of tool, which brings opportunity get any data from web2 sites and ipfs.
## What we learned
How launch chainlink node, describe jobs, how external adapters work.
## What's next for Any data requester
* Next feature could be getting any data from tor.
* Use own ipfs node instance
* Add feature, which allow replace part of matched data, using external adapter.
## How to use it
Contract in goerli - https://goerli.etherscan.io/address/0x49d042d1f5933C6322568DD140241B9730ab98c5
#### Get second headline from chainlink press page
Use function "extractText"
* url - https://chain.link/press/
* regexp - /h3-newstitle\">(.*?)(.*?)