@zilliqa-js/core
Advanced tools
Comparing version 0.8.4 to 0.8.7
import fetch from 'cross-fetch'; | ||
import mitt from 'mitt'; | ||
@@ -237,2 +238,3 @@ // This file is part of Zilliqa-Javascript-Library. | ||
RPCMethod["GetMinimumGasPrice"] = "GetMinimumGasPrice"; | ||
RPCMethod["GetPendingTxn"] = "GetPendingTxn"; | ||
// Contract-related methods | ||
@@ -508,64 +510,2 @@ RPCMethod["GetSmartContracts"] = "GetSmartContracts"; | ||
// | ||
// An event handler can take an optional event argument | ||
// and should not return a value | ||
// An array of all currently registered event handlers for a type | ||
// A map of event types and their corresponding event handlers. | ||
/** Mitt: Tiny (~200b) functional event emitter / pubsub. | ||
* @name mitt | ||
* @returns {Mitt} | ||
*/ | ||
function mitt(all ) { | ||
all = all || Object.create(null); | ||
return { | ||
/** | ||
* Register an event handler for the given type. | ||
* | ||
* @param {String} type Type of event to listen for, or `"*"` for all events | ||
* @param {Function} handler Function to call in response to given event | ||
* @memberOf mitt | ||
*/ | ||
on: function on(type , handler ) { | ||
(all[type] || (all[type] = [])).push(handler); | ||
}, | ||
/** | ||
* Remove an event handler for the given type. | ||
* | ||
* @param {String} type Type of event to unregister `handler` from, or `"*"` | ||
* @param {Function} handler Handler function to remove | ||
* @memberOf mitt | ||
*/ | ||
off: function off(type , handler ) { | ||
if (all[type]) { | ||
all[type].splice(all[type].indexOf(handler) >>> 0, 1); | ||
} | ||
}, | ||
/** | ||
* Invoke all handlers for the given type. | ||
* If present, `"*"` handlers are invoked after type-matched handlers. | ||
* | ||
* @param {String} type The event type to invoke | ||
* @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler | ||
* @memberOf mitt | ||
*/ | ||
emit: function emit(type , evt ) { | ||
(all[type] || []).slice().map(function (handler) { handler(evt); }); | ||
(all['*'] || []).slice().map(function (handler) { handler(type, evt); }); | ||
} | ||
}; | ||
} | ||
var EventEmitter = /** @class */ (function () { | ||
@@ -572,0 +512,0 @@ function EventEmitter() { |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('cross-fetch')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'cross-fetch'], factory) : | ||
(factory((global.zjsCore = {}),global.fetch)); | ||
}(this, (function (exports,fetch) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('cross-fetch'), require('mitt')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'cross-fetch', 'mitt'], factory) : | ||
(factory((global.zjsCore = {}),global['cross-fetch'],global.mitt)); | ||
}(this, (function (exports,fetch,mitt) { 'use strict'; | ||
fetch = fetch && fetch.hasOwnProperty('default') ? fetch['default'] : fetch; | ||
mitt = mitt && mitt.hasOwnProperty('default') ? mitt['default'] : mitt; | ||
@@ -238,2 +239,3 @@ // This file is part of Zilliqa-Javascript-Library. | ||
RPCMethod["GetMinimumGasPrice"] = "GetMinimumGasPrice"; | ||
RPCMethod["GetPendingTxn"] = "GetPendingTxn"; | ||
// Contract-related methods | ||
@@ -508,64 +510,2 @@ RPCMethod["GetSmartContracts"] = "GetSmartContracts"; | ||
// | ||
// An event handler can take an optional event argument | ||
// and should not return a value | ||
// An array of all currently registered event handlers for a type | ||
// A map of event types and their corresponding event handlers. | ||
/** Mitt: Tiny (~200b) functional event emitter / pubsub. | ||
* @name mitt | ||
* @returns {Mitt} | ||
*/ | ||
function mitt(all ) { | ||
all = all || Object.create(null); | ||
return { | ||
/** | ||
* Register an event handler for the given type. | ||
* | ||
* @param {String} type Type of event to listen for, or `"*"` for all events | ||
* @param {Function} handler Function to call in response to given event | ||
* @memberOf mitt | ||
*/ | ||
on: function on(type , handler ) { | ||
(all[type] || (all[type] = [])).push(handler); | ||
}, | ||
/** | ||
* Remove an event handler for the given type. | ||
* | ||
* @param {String} type Type of event to unregister `handler` from, or `"*"` | ||
* @param {Function} handler Handler function to remove | ||
* @memberOf mitt | ||
*/ | ||
off: function off(type , handler ) { | ||
if (all[type]) { | ||
all[type].splice(all[type].indexOf(handler) >>> 0, 1); | ||
} | ||
}, | ||
/** | ||
* Invoke all handlers for the given type. | ||
* If present, `"*"` handlers are invoked after type-matched handlers. | ||
* | ||
* @param {String} type The event type to invoke | ||
* @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler | ||
* @memberOf mitt | ||
*/ | ||
emit: function emit(type , evt ) { | ||
(all[type] || []).slice().map(function (handler) { handler(evt); }); | ||
(all['*'] || []).slice().map(function (handler) { handler(type, evt); }); | ||
} | ||
}; | ||
} | ||
var EventEmitter = /** @class */ (function () { | ||
@@ -572,0 +512,0 @@ function EventEmitter() { |
@@ -32,2 +32,3 @@ import { WithRequest } from './util'; | ||
GetMinimumGasPrice = "GetMinimumGasPrice", | ||
GetPendingTxn = "GetPendingTxn", | ||
GetSmartContracts = "GetSmartContracts", | ||
@@ -34,0 +35,0 @@ GetSmartContractCode = "GetSmartContractCode", |
@@ -53,2 +53,3 @@ "use strict"; | ||
RPCMethod["GetMinimumGasPrice"] = "GetMinimumGasPrice"; | ||
RPCMethod["GetPendingTxn"] = "GetPendingTxn"; | ||
// Contract-related methods | ||
@@ -55,0 +56,0 @@ RPCMethod["GetSmartContracts"] = "GetSmartContracts"; |
@@ -154,3 +154,8 @@ /// <reference types="node" /> | ||
} | ||
export interface PendingTxnResult { | ||
code: number; | ||
confirmed: boolean; | ||
info: string; | ||
} | ||
export {}; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@zilliqa-js/core", | ||
"version": "0.8.4", | ||
"version": "0.8.7", | ||
"description": "Core abstractions that power the zilliqa JS client.", | ||
@@ -36,3 +36,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "64e1bd5f295ed6747797e2ac695beb47d1dad286" | ||
"gitHead": "ba1ffcf76474010bb3e4dbd2abfd83a9a8b771bf" | ||
} |
@@ -55,2 +55,3 @@ // This file is part of Zilliqa-Javascript-Library. | ||
GetMinimumGasPrice = 'GetMinimumGasPrice', | ||
GetPendingTxn = 'GetPendingTxn', | ||
@@ -57,0 +58,0 @@ // Contract-related methods |
@@ -31,3 +31,5 @@ // This file is part of Zilliqa-Javascript-Library. | ||
): Promise<RPCResponse<R, E>>; | ||
subscribe?(event: string, subscriber: Subscriber): symbol; | ||
unsubscribe?(token: symbol): void; | ||
@@ -199,1 +201,7 @@ } | ||
} | ||
export interface PendingTxnResult { | ||
code: number; | ||
confirmed: boolean; | ||
info: string; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
361355
3168