How to use the @0x/contract-wrappers.ExchangeEvents.CancelUpTo 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
}
                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();
                // Revalidate orders
                const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByMaker(args.makerAddress);
                await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
                break;
            }

            default:
                throw errorUtils.spawnSwitchErr('decodedLog.event', decodedLog.event);
        }
    }
    private async _emitRevalidateOrdersAsync(orderHashes: string[], transactionHash?: string): Promise {
github 0xProject / 0x-monorepo / packages / pipeline / src / data_sources / contract-wrappers / exchange_events.ts View on Github external
public async getCancelUpToEventsAsync(
        startBlock: number,
        endBlock: number,
    ): Promise>> {
        const getCancelUpToEventsForRangeAsync = this._makeGetterFuncForEventType(
            ExchangeEvents.CancelUpTo,
        );
        return getEventsWithPaginationAsync(getCancelUpToEventsForRangeAsync, startBlock, endBlock);
    }