How to use the @ethersproject/properties.deepCopy function in @ethersproject/properties

To help you get started, we’ve selected a few @ethersproject/properties 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 ethers-io / ethers.js / packages / providers / lib.esm / etherscan-provider.js View on Github external
const get = (url, procFunc) => __awaiter(this, void 0, void 0, function* () {
                this.emit("debug", {
                    action: "request",
                    request: url,
                    provider: this
                });
                const result = yield fetchJson(url, null, procFunc || getJsonResult);
                this.emit("debug", {
                    action: "response",
                    request: url,
                    response: deepCopy(result),
                    provider: this
                });
                return result;
            });
            switch (method) {
github ethers-io / ethers.js / packages / contracts / lib.esm / index.js View on Github external
_wrapEvent(runningEvent, log, listener) {
        let event = deepCopy(log);
        try {
            runningEvent.prepareEvent(event);
        }
        catch (error) {
            this.emit("error", error);
            throw error;
        }
        event.removeListener = () => {
            if (!listener) {
                return;
            }
            runningEvent.removeListener(listener);
            this._checkRunningEvents(runningEvent);
        };
        event.getBlock = () => { return this.provider.getBlock(log.blockHash); };
        event.getTransaction = () => { return this.provider.getTransaction(log.transactionHash); };
github ethers-io / ethers.js / packages / providers / lib.esm / json-rpc-provider.js View on Github external
send(method, params) {
        let request = {
            method: method,
            params: params,
            id: (this._nextId++),
            jsonrpc: "2.0"
        };
        this.emit("debug", {
            action: "request",
            request: deepCopy(request),
            provider: this
        });
        return fetchJson(this.connection, JSON.stringify(request), getResult).then((result) => {
            this.emit("debug", {
                action: "response",
                request: request,
                response: result,
                provider: this
            });
            return result;
        });
    }
    perform(method, params) {
github ethers-io / ethers.js / packages / providers / lib / json-rpc-provider.js View on Github external
JsonRpcProvider.prototype.send = function (method, params) {
        var _this = this;
        var request = {
            method: method,
            params: params,
            id: (this._nextId++),
            jsonrpc: "2.0"
        };
        this.emit("debug", {
            action: "request",
            request: properties_1.deepCopy(request),
            provider: this
        });
        return web_1.fetchJson(this.connection, JSON.stringify(request), getResult).then(function (result) {
            _this.emit("debug", {
                action: "response",
                request: request,
                response: result,
                provider: _this
            });
            return result;
        });
    };
    JsonRpcProvider.prototype.perform = function (method, params) {
github ethers-io / ethers.js / packages / contracts / lib / index.js View on Github external
Contract.prototype._wrapEvent = function (runningEvent, log, listener) {
        var _this = this;
        var event = properties_1.deepCopy(log);
        try {
            runningEvent.prepareEvent(event);
        }
        catch (error) {
            this.emit("error", error);
            throw error;
        }
        event.removeListener = function () {
            if (!listener) {
                return;
            }
            runningEvent.removeListener(listener);
            _this._checkRunningEvents(runningEvent);
        };
        event.getBlock = function () { return _this.provider.getBlock(log.blockHash); };
        event.getTransaction = function () { return _this.provider.getTransaction(log.transactionHash); };
github ethers-io / ethers.js / packages / providers / lib / etherscan-provider.js View on Github external
return web_1.fetchJson(url, null, getResult).then(function (result) {
                _this.emit("debug", {
                    action: "response",
                    request: url,
                    response: properties_1.deepCopy(result),
                    provider: _this
                });
                var output = [];
                result.forEach(function (tx) {
                    ["contractAddress", "to"].forEach(function (key) {
                        if (tx[key] == "") {
                            delete tx[key];
                        }
                    });
                    if (tx.creates == null && tx.contractAddress != null) {
                        tx.creates = tx.contractAddress;
                    }
                    var item = _this.formatter.transactionResponse(tx);
                    if (tx.timeStamp) {
                        item.timestamp = parseInt(tx.timeStamp);
                    }
github ethers-io / ethers.js / packages / providers / fallback-provider.js View on Github external
return FallbackProvider.doPerform(provider, method, params).then(function (result) {
                        var duration = now() - t0;
                        _this.emit("debug", {
                            action: "response",
                            rid: rid,
                            backend: { weight: weight, start: start, duration: duration, provider: provider },
                            request: { method: method, params: properties_1.deepCopy(params) },
                            response: properties_1.deepCopy(result)
                        });
                        return { weight: weight, result: result };
                    }, function (error) {
                        var duration = now() - t0;
github ethers-io / ethers.js / packages / contracts / lib / index.js View on Github external
receipt.events = receipt.logs.map(function (log) {
                            var event = properties_1.deepCopy(log);
                            var parsed = contract.interface.parseLog(log);
                            if (parsed) {
                                event.values = parsed.values;
                                event.decode = function (data, topics) {
                                    return _this.interface.decodeEventLog(parsed.eventFragment, data, topics);
                                };
                                event.event = parsed.name;
                                event.eventSignature = parsed.signature;
                            }
                            event.removeListener = function () { return contract.provider; };
                            event.getBlock = function () {
                                return contract.provider.getBlock(receipt.blockHash);
                            };
                            event.getTransaction = function () {
                                return contract.provider.getTransaction(receipt.transactionHash);
                            };