UNPKG

starknetkit

Version:

<!-- logo --> <p align="center"> <img width='300' src="https://starknetkit-website-git-blo-1541-argentlabs.vercel.app/starknetKit-logo.svg"> </p>

186 lines (185 loc) 5.95 kB
var x = Object.defineProperty; var O = (s, a, o) => a in s ? x(s, a, { enumerable: !0, configurable: !0, writable: !0, value: o }) : s[a] = o; var m = (s, a, o) => (O(s, typeof a != "symbol" ? a + "" : a, o), o); import "starknet"; var A = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function L(s) { return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s; } function S(s) { if (s.__esModule) return s; var a = s.default; if (typeof a == "function") { var o = function v() { return this instanceof v ? Reflect.construct(a, arguments, this.constructor) : a.apply(this, arguments); }; o.prototype = a.prototype; } else o = {}; return Object.defineProperty(o, "__esModule", { value: !0 }), Object.keys(s).forEach(function(v) { var g = Object.getOwnPropertyDescriptor(s, v); Object.defineProperty(o, v, g.get ? g : { enumerable: !0, get: function() { return s[v]; } }); }), o; } var E = { exports: {} }; (function(s) { var a = Object.prototype.hasOwnProperty, o = "~"; function v() { } Object.create && (v.prototype = /* @__PURE__ */ Object.create(null), new v().__proto__ || (o = !1)); function g(c, t, n) { this.fn = c, this.context = t, this.once = n || !1; } function C(c, t, n, r, p) { if (typeof n != "function") throw new TypeError("The listener must be a function"); var l = new g(n, r || c, p), i = o ? o + t : t; return c._events[i] ? c._events[i].fn ? c._events[i] = [c._events[i], l] : c._events[i].push(l) : (c._events[i] = l, c._eventsCount++), c; } function b(c, t) { --c._eventsCount === 0 ? c._events = new v() : delete c._events[t]; } function u() { this._events = new v(), this._eventsCount = 0; } u.prototype.eventNames = function() { var t = [], n, r; if (this._eventsCount === 0) return t; for (r in n = this._events) a.call(n, r) && t.push(o ? r.slice(1) : r); return Object.getOwnPropertySymbols ? t.concat(Object.getOwnPropertySymbols(n)) : t; }, u.prototype.listeners = function(t) { var n = o ? o + t : t, r = this._events[n]; if (!r) return []; if (r.fn) return [r.fn]; for (var p = 0, l = r.length, i = new Array(l); p < l; p++) i[p] = r[p].fn; return i; }, u.prototype.listenerCount = function(t) { var n = o ? o + t : t, r = this._events[n]; return r ? r.fn ? 1 : r.length : 0; }, u.prototype.emit = function(t, n, r, p, l, i) { var h = o ? o + t : t; if (!this._events[h]) return !1; var e = this._events[h], d = arguments.length, y, f; if (e.fn) { switch (e.once && this.removeListener(t, e.fn, void 0, !0), d) { case 1: return e.fn.call(e.context), !0; case 2: return e.fn.call(e.context, n), !0; case 3: return e.fn.call(e.context, n, r), !0; case 4: return e.fn.call(e.context, n, r, p), !0; case 5: return e.fn.call(e.context, n, r, p, l), !0; case 6: return e.fn.call(e.context, n, r, p, l, i), !0; } for (f = 1, y = new Array(d - 1); f < d; f++) y[f - 1] = arguments[f]; e.fn.apply(e.context, y); } else { var w = e.length, _; for (f = 0; f < w; f++) switch (e[f].once && this.removeListener(t, e[f].fn, void 0, !0), d) { case 1: e[f].fn.call(e[f].context); break; case 2: e[f].fn.call(e[f].context, n); break; case 3: e[f].fn.call(e[f].context, n, r); break; case 4: e[f].fn.call(e[f].context, n, r, p); break; default: if (!y) for (_ = 1, y = new Array(d - 1); _ < d; _++) y[_ - 1] = arguments[_]; e[f].fn.apply(e[f].context, y); } } return !0; }, u.prototype.on = function(t, n, r) { return C(this, t, n, r, !1); }, u.prototype.once = function(t, n, r) { return C(this, t, n, r, !0); }, u.prototype.removeListener = function(t, n, r, p) { var l = o ? o + t : t; if (!this._events[l]) return this; if (!n) return b(this, l), this; var i = this._events[l]; if (i.fn) i.fn === n && (!p || i.once) && (!r || i.context === r) && b(this, l); else { for (var h = 0, e = [], d = i.length; h < d; h++) (i[h].fn !== n || p && !i[h].once || r && i[h].context !== r) && e.push(i[h]); e.length ? this._events[l] = e.length === 1 ? e[0] : e : b(this, l); } return this; }, u.prototype.removeAllListeners = function(t) { var n; return t ? (n = o ? o + t : t, this._events[n] && b(this, n)) : (this._events = new v(), this._eventsCount = 0), this; }, u.prototype.off = u.prototype.removeListener, u.prototype.addListener = u.prototype.on, u.prefixed = o, u.EventEmitter = u, s.exports = u; })(E); var j = E.exports; const P = /* @__PURE__ */ L(j); class R extends P { } const T = { ACCOUNTS: "accounts" }; class U extends Error { constructor() { super(...arguments); m(this, "name", "ConnectorNotConnectedError"); m(this, "message", "Connector not connected"); } } class W extends Error { constructor() { super(...arguments); m(this, "name", "ConnectorNotFoundError"); m(this, "message", "Connector not found"); } } class q extends Error { constructor() { super(...arguments); m(this, "name", "UserRejectedRequestError"); m(this, "message", "User rejected request"); } } const F = (s) => { localStorage.setItem("starknetLastConnectedWallet", s); }, M = () => { localStorage.removeItem("starknetLastConnectedWallet"); }; export { R as C, T as P, q as U, U as a, W as b, A as c, L as d, S as g, M as r, F as s };