How to use the @0x/assert.assert.isUri 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-coordinator-server / ts / src / assertions.ts View on Github external
assert.isETHAddressHex(`settings.FEE_RECIPIENTS[${i}].ADDRESS`, feeRecipient.ADDRESS);
            assert.isString(`settings.FEE_RECIPIENTS[${i}].PRIVATE_KEY`, feeRecipient.PRIVATE_KEY);
            const PLACEHOLDER = 'FILL_ME_IN';
            if (feeRecipient.ADDRESS === PLACEHOLDER || feeRecipient.PRIVATE_KEY === PLACEHOLDER) {
                throw new Error(
                    `Found placeholder value '${PLACEHOLDER}' in FEE_RECIPIENTS configs. Please replace with actual values.`,
                );
            }
            const recoveredAddress = utils.getAddressFromPrivateKey(feeRecipient.PRIVATE_KEY);
            if (recoveredAddress !== feeRecipient.ADDRESS) {
                throw new Error(
                    `FeeRecipientAddress ${feeRecipient.ADDRESS} does not correspond to the private key ${feeRecipient.PRIVATE_KEY}`,
                );
            }
        });
        assert.isUri('settings.RPC_URL', settings.RPC_URL);
    });
}
github 0xProject / 0x-monorepo / packages / orderbook / src / order_provider / sra_websocket_order_provider.ts View on Github external
constructor(opts: SRAWebsocketOrderProviderOpts, orderStore: OrderStore) {
        super(orderStore, opts.httpEndpoint, PER_PAGE_DEFAULT);
        assert.isUri('websocketEndpoint', opts.websocketEndpoint);
        this._websocketEndpoint = opts.websocketEndpoint;
    }
github 0xProject / 0x-monorepo / packages / instant / src / util / assert.ts View on Github external
isValidOrderSource(variableName: string, orderSource: string | SignedOrder[]): void {
        if (_.isString(orderSource)) {
            sharedAssert.isUri(variableName, orderSource);
            return;
        }
        sharedAssert.doesConformToSchema(variableName, orderSource, schemas.signedOrdersSchema);
    },
    areValidAssetDatas(variableName: string, assetDatas: string[]): void {