How to use the @0x/assert.assert.isWebUri function in @0x/assert

To help you get started, we’ve selected a few @0x/assert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 0xProject / 0x-monorepo / packages / connect / src / http_client.ts View on Github external
constructor(url: string) {
        assert.isWebUri('url', url);
        this._apiEndpointUrl = url.replace(TRAILING_SLASHES_REGEX, ''); // remove trailing slashes
    }
    /**
github 0xProject / 0x-monorepo / packages / instant / src / util / liquidity.ts View on Github external
export const checkErc20TokenLiquidityAsync = async (sraApiUrl: string, erc20TokenAddress: string) => {
    assert.isWebUri('sraApiUrl', sraApiUrl);
    assert.isETHAddressHex('erc20TokenAddress', erc20TokenAddress);

    const tokenAssetData = assetDataUtils.encodeERC20AssetData(erc20TokenAddress);
    const httpClient = new HttpClient(sraApiUrl);
    const response = await httpClient.getAssetPairsAsync({
        networkId: Network.Mainnet,
        assetDataA: MAINNET_WETH_ASSET_DATA,
        assetDataB: tokenAssetData,
        perPage: 1000,
    });
    const supported = response.records.length > 0;
    return { supported };
};