@requestnetwork/toolbox
is a typescript library part of the Request Network protocol.
It is a collection of miscellaneous tools.
This package can use other package of the monorepo, but the other packages cannot use toolbox.
Create a request. Only the amount can be specified, optionally.
- Currency: BTC
- Payee: 0x627306090abab3a6e1400e9345bc60c78a8bef57
- Payer: 0xf17f52151ebef6c7334fad080c5704d77216b732
- Amount (default): 1000
import { CreateRequest } from '@requestnetwork/toolbox';
CreateRequest.createTestRequest();
CreateRequest.createTestRequest(12);
yarn request-toolbox request create
yarn request-toolbox request create 12
or if ran from the /toolbox
folder
yarn cli request create
yarn cli request create 12
If you receive the following error
error Command "request-toolbox" not found.
then build the toolbox package like bellow:
cd packages/toolbox
yarn --check-files
The following command guides you in adding missing aggregators.
yarn request-toolbox addAggregators mainnet --privateKey $PRIVATE_KEY --dryRun
It will suggest pairs of currencies:
- With a Chainlink price feed oracle (according to a cached JSON)
- If they exist in Currency Manager (cf. ../currency/src/erc20/networks)
- If they are not already added to the Chainlink Aggregation Path contract, as reported by the Price Aggregators subgraph (Example for Ethereum)
The following commands are also available:
yarn request-toolbox addAggregator
can be used if you have all information about an aggregator you want to addyarn request-toolbox removeAggregator
will set the given currency pair to the 0x00[...]00 address.yarn request-toolbox listMissingAggregators <name>
(wherename
is a valid Request Finance currency list, https://api.request.network/currency/list/name should be valid) will display missing aggregators for that list on all networks.
Use --help
for details about each command.
NB: this procedure is only used to update the standard list. For an always up-to-date list, use the Aggregator Subgraphs requires jq
./updateAggregators.sh mainnet
# or, depending on the network, you can specify the URL
WEB3_URL=https://polygon-mainnet.infura.io/v3/xxx ./updateAggregators.sh matic
git add ../currency
git commit ...
Returns all the aggregators used for the any-to-erc20 proxy. It can be used to populate the currency pair (in @requestnetwork/currency) when we add a new aggregator to ChainlinkConversionPath.sol on any network.
yarn chainlinkPath
# ###################################################################
# All aggregators: (Used to list all the aggregators)
# {
# network: {
# "currencyIn": {
# "currencyOut": "aggregator"
# ...
# }
# ...
# }
# ...
# }
# All aggregators nodes for the currency pairs graph: (Used to populate @requestnetwork/currency)
# {
# network: {
# "currencyIn": {
# "currencyOut": 1,
# ...
# }
# ...
# }
# ...
# }
# ###################################################################
To get only aggregators of one network:
yarn chainlinkPath mainnet
You can change the default blockRange (some networks allow a very large range, some don't) with maxRange
yarn chainlinkPath mainnet --maxRange 1000000
To get a currency hash:
yarn currencyHash ETH
# #####################################################################
# Currency hash of: ETH
# 0xf5af88e117747e87fc5929f2ff87221b1447652e
# #####################################################################
yarn currencyHash FTM-fantom
#####################################################################
Currency hash of: FTM-fantom
0x10bf4137b0558c33c2dc9f71c3bb81c2865fa2fb
#####################################################################
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Read the contributing guide