How to use the @0x/contract-wrappers.ExchangeEvents.Cancel function in @0x/contract-wrappers

To help you get started, we’ve selected a few @0x/contract-wrappers 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 / order-watcher / src / order_watcher / order_watcher.ts View on Github external
await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
                break;
            }
            case ExchangeEvents.Fill: {
                // Invalidate cache
                const args = decodedLog.args as ExchangeFillEventArgs;
                this._orderFilledCancelledLazyStore.deleteFilledTakerAmount(args.orderHash);
                // Revalidate orders
                const orderHash = args.orderHash;
                const isOrderWatched = this._orderByOrderHash[orderHash] !== undefined;
                if (isOrderWatched) {
                    await this._emitRevalidateOrdersAsync([orderHash], transactionHash);
                }
                break;
            }
            case ExchangeEvents.Cancel: {
                // Invalidate cache
                const args = decodedLog.args as ExchangeCancelEventArgs;
                this._orderFilledCancelledLazyStore.deleteIsCancelled(args.orderHash);
                // Revalidate orders
                const orderHash = args.orderHash;
                const isOrderWatched = this._orderByOrderHash[orderHash] !== undefined;
                if (isOrderWatched) {
                    await this._emitRevalidateOrdersAsync([orderHash], transactionHash);
                }
                break;
            }
            case ExchangeEvents.CancelUpTo: {
                // TODO(logvinov): Do it smarter and actually look at the salt and order epoch
                // Invalidate cache
                const args = decodedLog.args as ExchangeCancelUpToEventArgs;
                this._orderFilledCancelledLazyStore.deleteAllIsCancelled();
github 0xProject / 0x-monorepo / packages / pipeline / src / data_sources / contract-wrappers / exchange_events.ts View on Github external
public async getCancelEventsAsync(
        startBlock: number,
        endBlock: number,
    ): Promise>> {
        const getCancelEventsForRangeAsync = this._makeGetterFuncForEventType(
            ExchangeEvents.Cancel,
        );
        return getEventsWithPaginationAsync(getCancelEventsForRangeAsync, startBlock, endBlock);
    }
github 0xProject / 0x-monorepo / packages / website / ts / blockchain.ts View on Github external
public async cancelOrderAsync(signedOrder: SignedOrder): Promise {
        this._showFlashMessageIfLedger();
        const txHash = await this._contractWrappers.exchange.cancelOrderAsync(signedOrder, {
            gasPrice: this._defaultGasPrice,
        });
        const receipt = await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
        const logs: Array> = receipt.logs as any;
        const logCancel = _.find(logs, { event: ExchangeEvents.Cancel });
        const args = (logCancel.args as any) as ExchangeCancelEventArgs;
        const cancelledOrderHash = args.orderHash;
        return cancelledOrderHash;
    }
    public async getUnavailableTakerAmountAsync(orderHash: string): Promise {