Utils

Registry

To avoid malicious operations and assets, the platforms keeps a registry of the valid addresses. Use the following methods to check whitelisted operations and assets.

Is valid operation query

A query method that checks if an operation is in the registry.
JavaScript & Node
1
const result = await defire.query.isOperation("0x4b9E2247F3fe6d289D2FD6D4C893d5256A87CE22");
Copied!
Method parameters
address required string
Ethereum address to check if it is an operation
Returns
This method returns a Promise which resolves with true if the operation is in the registry, otherwise with false.

List of assets

These are the assets that operations handle: DAI, ETH, WETH and CDAI
JavaScript & Node
1
const dai = defire.Assets.DAI.address;
2
const eth = defire. Assets.ETH.address;
3
const weth = defire.Assets.WETH.address;
4
const cdai = defire.Assets.CDAI.address;
Copied!

Is valid asset query

A query method that checks if an asset is in the registry.
JavaScript & Node
1
const result = await defire.query.isAsset("0x9Ce1C0514233ECDBE22FFc96894Ce0f8Da0070c1");
Copied!
Method parameters
address required string
Ethereum address to check if it is an asset
Returns
This method returns a Promise which resolves with true if the asset is in the registry, otherwise with false.

Last modified 1yr ago