How to use the @0x/assert.assert.isArray 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 / abi-gen / test-cli / expected-output / typescript / abi_gen_dummy.ts View on Github external
getABIEncodedTransactionData(a: string[]): string {
            assert.isArray('a', a);
            const self = (this as any) as AbiGenDummyContract;
            const abiEncodedTransactionData = self._strictEncodeArguments('acceptsAnArrayOfBytes(bytes[])', [a]);
            return abiEncodedTransactionData;
        },
        getABIDecodedTransactionData(callData: string): void {
github 0xProject / 0x-monorepo / packages / abi-gen-wrappers / src / generated-wrappers / erc1155_mintable.ts View on Github external
public mintNonFungible(type_: BigNumber, to: string[]): ContractTxFunctionObj {
        const self = (this as any) as ERC1155MintableContract;
        assert.isBigNumber('type_', type_);
        assert.isArray('to', to);
        const functionSignature = 'mintNonFungible(uint256,address[])';

        return {
            async sendTransactionAsync(
                txData?: Partial | undefined,
                opts: SendTransactionOpts = { shouldValidate: true },
            ): Promise {
                const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
                    { ...txData, data: this.getABIEncodedTransactionData() },
                    this.estimateGasAsync.bind(this),
                );
                if (opts.shouldValidate !== false) {
                    await this.callAsync(txDataWithDefaults);
                }
                return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
            },
github 0xProject / 0x-monorepo / packages / abi-gen-wrappers / src / generated-wrappers / erc1155_mintable.ts View on Github external
public mintFungible(id: BigNumber, to: string[], quantities: BigNumber[]): ContractTxFunctionObj {
        const self = (this as any) as ERC1155MintableContract;
        assert.isBigNumber('id', id);
        assert.isArray('to', to);
        assert.isArray('quantities', quantities);
        const functionSignature = 'mintFungible(uint256,address[],uint256[])';

        return {
            async sendTransactionAsync(
                txData?: Partial | undefined,
                opts: SendTransactionOpts = { shouldValidate: true },
            ): Promise {
                const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
                    { ...txData, data: this.getABIEncodedTransactionData() },
                    this.estimateGasAsync.bind(this),
                );
                if (opts.shouldValidate !== false) {
                    await this.callAsync(txDataWithDefaults);
                }
                return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
github 0xProject / 0x-monorepo / packages / contract-wrappers / src / generated-wrappers / i_asset_data.ts View on Github external
public ERC1155Assets(
        tokenAddress: string,
        tokenIds: BigNumber[],
        values: BigNumber[],
        callbackData: string,
    ): ContractTxFunctionObj {
        const self = (this as any) as IAssetDataContract;
        assert.isString('tokenAddress', tokenAddress);
        assert.isArray('tokenIds', tokenIds);
        assert.isArray('values', values);
        assert.isString('callbackData', callbackData);
        const functionSignature = 'ERC1155Assets(address,uint256[],uint256[],bytes)';

        return {
            async sendTransactionAsync(
                txData?: Partial | undefined,
                opts: SendTransactionOpts = { shouldValidate: true },
            ): Promise {
                const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
                    { ...txData, data: this.getABIEncodedTransactionData() },
                    this.estimateGasAsync.bind(this),
                );
                if (opts.shouldValidate !== false) {
                    await this.callAsync(txDataWithDefaults);
                }
github 0xProject / 0x-monorepo / packages / abi-gen-wrappers / src / generated-wrappers / erc1155_mintable.ts View on Github external
public safeBatchTransferFrom(
        from: string,
        to: string,
        ids: BigNumber[],
        values: BigNumber[],
        data: string,
    ): ContractTxFunctionObj {
        const self = (this as any) as ERC1155MintableContract;
        assert.isString('from', from);
        assert.isString('to', to);
        assert.isArray('ids', ids);
        assert.isArray('values', values);
        assert.isString('data', data);
        const functionSignature = 'safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)';

        return {
            async sendTransactionAsync(
                txData?: Partial | undefined,
                opts: SendTransactionOpts = { shouldValidate: true },
            ): Promise {
                const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
                    { ...txData, data: this.getABIEncodedTransactionData() },
                    this.estimateGasAsync.bind(this),
                );
                if (opts.shouldValidate !== false) {
                    await this.callAsync(txDataWithDefaults);
                }
github 0xProject / 0x-monorepo / packages / abi-gen-wrappers / src / generated-wrappers / erc1155_mintable.ts View on Github external
public safeBatchTransferFrom(
        from: string,
        to: string,
        ids: BigNumber[],
        values: BigNumber[],
        data: string,
    ): ContractTxFunctionObj {
        const self = (this as any) as ERC1155MintableContract;
        assert.isString('from', from);
        assert.isString('to', to);
        assert.isArray('ids', ids);
        assert.isArray('values', values);
        assert.isString('data', data);
        const functionSignature = 'safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)';

        return {
            async sendTransactionAsync(
                txData?: Partial | undefined,
                opts: SendTransactionOpts = { shouldValidate: true },
            ): Promise {
                const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
                    { ...txData, data: this.getABIEncodedTransactionData() },
                    this.estimateGasAsync.bind(this),
                );
                if (opts.shouldValidate !== false) {
                    await this.callAsync(txDataWithDefaults);
                }
                return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
github 0xProject / 0x-monorepo / packages / abi-gen-wrappers / src / generated-wrappers / order_validator.ts View on Github external
[
            Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>,
            Array<{
                makerBalance: BigNumber;
                makerAllowance: BigNumber;
                takerBalance: BigNumber;
                takerAllowance: BigNumber;
                makerZrxBalance: BigNumber;
                makerZrxAllowance: BigNumber;
                takerZrxBalance: BigNumber;
                takerZrxAllowance: BigNumber;
            }>
        ]
    > {
        const self = (this as any) as OrderValidatorContract;
        assert.isArray('orders', orders);
        assert.isArray('takerAddresses', takerAddresses);
        const functionSignature =
            'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])';

        return {
            async callAsync(
                callData: Partial = {},
                defaultBlock?: BlockParam,
            ): Promise<
                [
                    Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>,
                    Array<{
                        makerBalance: BigNumber;
                        makerAllowance: BigNumber;
                        takerBalance: BigNumber;
                        takerAllowance: BigNumber;
github 0xProject / 0x-monorepo / packages / abi-gen-wrappers / src / generated-wrappers / erc1155_mintable.ts View on Github external
public balanceOfBatch(owners: string[], ids: BigNumber[]): ContractFunctionObj {
        const self = (this as any) as ERC1155MintableContract;
        assert.isArray('owners', owners);
        assert.isArray('ids', ids);
        const functionSignature = 'balanceOfBatch(address[],uint256[])';

        return {
            async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise {
                BaseContract._assertCallParams(callData, defaultBlock);
                const rawCallResult = await self._performCallAsync(
                    { ...callData, data: this.getABIEncodedTransactionData() },
                    defaultBlock,
                );
                const abiEncoder = self._lookupAbiEncoder(functionSignature);
                return abiEncoder.strictDecodeReturnValue(rawCallResult);
            },
            getABIEncodedTransactionData(): string {
                return self._strictEncodeArguments(functionSignature, [owners, ids]);
            },
github 0xProject / 0x-monorepo / packages / contract-wrappers / src / generated-wrappers / i_asset_data.ts View on Github external
public MultiAsset(values: BigNumber[], nestedAssetData: string[]): ContractTxFunctionObj {
        const self = (this as any) as IAssetDataContract;
        assert.isArray('values', values);
        assert.isArray('nestedAssetData', nestedAssetData);
        const functionSignature = 'MultiAsset(uint256[],bytes[])';

        return {
            async sendTransactionAsync(
                txData?: Partial | undefined,
                opts: SendTransactionOpts = { shouldValidate: true },
            ): Promise {
                const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
                    { ...txData, data: this.getABIEncodedTransactionData() },
                    this.estimateGasAsync.bind(this),
                );
                if (opts.shouldValidate !== false) {
                    await this.callAsync(txDataWithDefaults);
                }
                return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
            },
github 0xProject / 0x-monorepo / packages / contract-wrappers / src / generated-wrappers / coordinator.ts View on Github external
transaction: {
            salt: BigNumber;
            expirationTimeSeconds: BigNumber;
            gasPrice: BigNumber;
            signerAddress: string;
            data: string;
        },
        txOrigin: string,
        transactionSignature: string,
        approvalSignatures: string[],
    ): ContractFunctionObj {
        const self = (this as any) as CoordinatorContract;

        assert.isString('txOrigin', txOrigin);
        assert.isString('transactionSignature', transactionSignature);
        assert.isArray('approvalSignatures', approvalSignatures);
        const functionSignature =
            'assertValidCoordinatorApprovals((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])';

        return {
            async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise {
                BaseContract._assertCallParams(callData, defaultBlock);
                const rawCallResult = await self._performCallAsync(
                    { ...callData, data: this.getABIEncodedTransactionData() },
                    defaultBlock,
                );
                const abiEncoder = self._lookupAbiEncoder(functionSignature);
                return abiEncoder.strictDecodeReturnValue(rawCallResult);
            },
            getABIEncodedTransactionData(): string {
                return self._strictEncodeArguments(functionSignature, [
                    transaction,