How to use the @0x/order-utils.eip712Utils.createCoordinatorApprovalTypedDataAsync function in @0x/order-utils

To help you get started, we’ve selected a few @0x/order-utils 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 / handlers.ts View on Github external
private async _generateApprovalSignatureAsync(
        txOrigin: string,
        signedTransaction: SignedZeroExTransaction,
        coordinatorOrders: Order[],
        chainId: number,
        approvalExpirationTimeSeconds: number,
    ): Promise {
        const contractWrappers = this._chainIdToContractWrappers[chainId];
        const typedData = await eip712Utils.createCoordinatorApprovalTypedDataAsync(
            signedTransaction,
            contractWrappers.coordinator.address,
            txOrigin,
        );
        const approvalHashBuff = signTypedDataUtils.generateTypedDataHash(typedData);

        // Since a coordinator can have multiple feeRecipientAddresses,
        // we need to make sure we issue a signature for each feeRecipientAddress
        // found in the orders submitted (i.e., someone can batch fill two coordinator
        // orders, each with a different feeRecipientAddress). In that case, we issue a
        // signature/expiration for each feeRecipientAddress
        const feeRecipientAddressSet = new Set();
        _.each(coordinatorOrders, o => {
            feeRecipientAddressSet.add(o.feeRecipientAddress);
        });
        const signatures = [];
github 0xProject / 0x-monorepo / contracts / coordinator / src / hash_utils.ts View on Github external
async getApprovalHashBufferAsync(
        transaction: SignedZeroExTransaction,
        verifyingContract: string,
        txOrigin: string,
    ): Promise {
        const typedData = await eip712Utils.createCoordinatorApprovalTypedDataAsync(
            transaction,
            verifyingContract,
            txOrigin,
        );
        const hashBuffer = signTypedDataUtils.generateTypedDataHash(typedData);
        return hashBuffer;
    },
    async getApprovalHashHexAsync(