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
JavaScript & Node
const result = await defire.query.isOperation("0x4b9E2247F3fe6d289D2FD6D4C893d5256A87CE22");

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
JavaScript & Node
const dai = defire.Assets.DAI.address;
const eth = defire. Assets.ETH.address;
const weth = defire.Assets.WETH.address;
const cdai = defire.Assets.CDAI.address;

Is valid asset query

A query method that checks if an asset is in the registry.

JavaScript & Node
JavaScript & Node
const result = await defire.query.isAsset("0x9Ce1C0514233ECDBE22FFc96894Ce0f8Da0070c1");

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.

‚Äč