UNPKG

@celo/connect

Version:

Light Toolkit for connecting with the Celo network

31 lines 990 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stopProvider = exports.hasProperty = void 0; /** @internal */ function hasProperty(object, property) { return property in object; } exports.hasProperty = hasProperty; /** @internal */ function stopProvider(defaultProvider) { if (hasProperty(defaultProvider, 'stop')) { defaultProvider.stop(); } else { // Close the web3 connection or the CLI hangs forever. if (hasProperty(defaultProvider, 'connection')) { const connection = defaultProvider.connection; // WS if (hasProperty(connection, 'close')) { connection.close(); } // Net (IPC provider) if (hasProperty(connection, 'destroy')) { connection.destroy(); } // TODO: more cases? default? } } } exports.stopProvider = stopProvider; //# sourceMappingURL=provider-utils.js.map