@walletconnect/types
Version:
Typings for WalletConnect Protocol
3 lines (2 loc) • 7.98 kB
JavaScript
(function(l,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(l=typeof globalThis<"u"?globalThis:l||self,v(l["@walletconnect/types"]={}))})(this,function(l){"use strict";class v{}class x extends v{constructor(o){super(),this.opts=o,this.protocol="wc",this.version=2}}class P{constructor(o,c,p){this.core=o,this.logger=c}}class N extends v{constructor(o,c){super(),this.core=o,this.logger=c,this.records=new Map}}class S{constructor(o,c){this.logger=o,this.core=c}}class T extends v{constructor(o,c){super(),this.relayer=o,this.logger=c}}class A extends v{constructor(o){super()}}class K{constructor(o,c,p,m){this.core=o,this.logger=c,this.name=p}}class F{constructor(){this.map=new Map}}class W extends v{constructor(o,c){super(),this.relayer=o,this.logger=c}}class k{constructor(o,c){this.core=o,this.logger=c}}class H extends v{constructor(o,c){super(),this.core=o,this.logger=c}}class q{constructor(o,c){this.logger=o,this.core=c}}class J{constructor(o,c,p){this.core=o,this.logger=c,this.store=p}}class U{constructor(o,c){this.projectId=o,this.logger=c}}class V{constructor(o,c,p){this.core=o,this.logger=c,this.telemetryEnabled=p}}function D(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var g={exports:{}},L;function z(){if(L)return g.exports;L=1;var u=typeof Reflect=="object"?Reflect:null,o=u&&typeof u.apply=="function"?u.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},c;u&&typeof u.ownKeys=="function"?c=u.ownKeys:Object.getOwnPropertySymbols?c=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:c=function(e){return Object.getOwnPropertyNames(e)};function p(t){console&&console.warn&&console.warn(t)}var m=Number.isNaN||function(e){return e!==e};function f(){f.init.call(this)}g.exports=f,g.exports.once=te,f.EventEmitter=f,f.prototype._events=void 0,f.prototype._eventsCount=0,f.prototype._maxListeners=void 0;var I=10;function y(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(f,"defaultMaxListeners",{enumerable:!0,get:function(){return I},set:function(t){if(typeof t!="number"||t<0||m(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");I=t}}),f.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},f.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||m(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function b(t){return t._maxListeners===void 0?f.defaultMaxListeners:t._maxListeners}f.prototype.getMaxListeners=function(){return b(this)},f.prototype.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var s=e==="error",a=this._events;if(a!==void 0)s=s&&a.error===void 0;else if(!s)return!1;if(s){var i;if(n.length>0&&(i=n[0]),i instanceof Error)throw i;var h=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw h.context=i,h}var d=a[e];if(d===void 0)return!1;if(typeof d=="function")o(d,this,n);else for(var M=d.length,re=R(d,M),r=0;r<M;++r)o(re[r],this,n);return!0};function w(t,e,n,r){var s,a,i;if(y(n),a=t._events,a===void 0?(a=t._events=Object.create(null),t._eventsCount=0):(a.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),a=t._events),i=a[e]),i===void 0)i=a[e]=n,++t._eventsCount;else if(typeof i=="function"?i=a[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),s=b(t),s>0&&i.length>s&&!i.warned){i.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=i.length,p(h)}return t}f.prototype.addListener=function(e,n){return w(this,e,n,!1)},f.prototype.on=f.prototype.addListener,f.prototype.prependListener=function(e,n){return w(this,e,n,!0)};function Z(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},s=Z.bind(r);return s.listener=n,r.wrapFn=s,s}f.prototype.once=function(e,n){return y(n),this.on(e,_(this,e,n)),this},f.prototype.prependOnceListener=function(e,n){return y(n),this.prependListener(e,_(this,e,n)),this},f.prototype.removeListener=function(e,n){var r,s,a,i,h;if(y(n),s=this._events,s===void 0)return this;if(r=s[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(a=-1,i=r.length-1;i>=0;i--)if(r[i]===n||r[i].listener===n){h=r[i].listener,a=i;break}if(a<0)return this;a===0?r.shift():$(r,a),r.length===1&&(s[e]=r[0]),s.removeListener!==void 0&&this.emit("removeListener",e,h||n)}return this},f.prototype.off=f.prototype.removeListener,f.prototype.removeAllListeners=function(e){var n,r,s;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var a=Object.keys(r),i;for(s=0;s<a.length;++s)i=a[s],i!=="removeListener"&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[e],typeof n=="function")this.removeListener(e,n);else if(n!==void 0)for(s=n.length-1;s>=0;s--)this.removeListener(e,n[s]);return this};function C(t,e,n){var r=t._events;if(r===void 0)return[];var s=r[e];return s===void 0?[]:typeof s=="function"?n?[s.listener||s]:[s]:n?ee(s):R(s,s.length)}f.prototype.listeners=function(e){return C(this,e,!0)},f.prototype.rawListeners=function(e){return C(this,e,!1)},f.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):O.call(t,e)},f.prototype.listenerCount=O;function O(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}f.prototype.eventNames=function(){return this._eventsCount>0?c(this._events):[]};function R(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function $(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function ee(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function te(t,e){return new Promise(function(n,r){function s(i){t.removeListener(e,a),r(i)}function a(){typeof t.removeListener=="function"&&t.removeListener("error",s),n([].slice.call(arguments))}j(t,e,a,{once:!0}),e!=="error"&&ne(t,s,{once:!0})})}function ne(t,e,n){typeof t.on=="function"&&j(t,"error",e,n)}function j(t,e,n,r){if(typeof t.on=="function")r.once?t.once(e,n):t.on(e,n);else if(typeof t.addEventListener=="function")t.addEventListener(e,function s(a){r.once&&t.removeEventListener(e,s),n(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}return g.exports}var E=z(),B=D(E);class G extends B{constructor(){super()}}class Q{constructor(o){this.opts=o,this.protocol="wc",this.version=2}}class X extends E.EventEmitter{constructor(){super()}}class Y{constructor(o){this.client=o}}l.ICore=x,l.ICrypto=P,l.IEchoClient=U,l.IEngine=Y,l.IEngineEvents=X,l.IEventClient=V,l.IExpirer=H,l.IJsonRpcHistory=N,l.IKeyChain=k,l.IMessageTracker=S,l.IPairing=q,l.IPublisher=T,l.IRelayer=A,l.ISignClient=Q,l.ISignClientEvents=G,l.IStore=K,l.ISubscriber=W,l.ISubscriberTopicMap=F,l.IVerify=J});
//# sourceMappingURL=index.umd.js.map