@rango-dev/provider-coin98 0.1.11-next.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers.d.ts +4 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +8 -0
- package/dist/provider-coin98.cjs.development.js +580 -0
- package/dist/provider-coin98.cjs.development.js.map +1 -0
- package/dist/provider-coin98.cjs.production.min.js +2 -0
- package/dist/provider-coin98.cjs.production.min.js.map +1 -0
- package/dist/provider-coin98.esm.js +567 -0
- package/dist/provider-coin98.esm.js.map +1 -0
- package/dist/signer.d.ts +2 -0
- package/package.json +56 -0
- package/src/helpers.ts +28 -0
- package/src/index.ts +113 -0
- package/src/signer.ts +51 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Network, WalletType, CanSwitchNetwork, Connect, Subscribe, SwitchNetwork, WalletSigners, BlockchainMeta, WalletInfo } from '@rango-dev/wallets-shared';
|
|
2
|
+
import { coin98 as coin98_instances } from './helpers';
|
|
3
|
+
export declare const config: {
|
|
4
|
+
type: WalletType;
|
|
5
|
+
defaultNetwork: Network;
|
|
6
|
+
};
|
|
7
|
+
export declare const getInstance: typeof coin98_instances;
|
|
8
|
+
export declare const connect: Connect;
|
|
9
|
+
export declare const subscribe: Subscribe;
|
|
10
|
+
export declare const switchNetwork: SwitchNetwork;
|
|
11
|
+
export declare const canSwitchNetworkTo: CanSwitchNetwork;
|
|
12
|
+
export declare const getSigners: (provider: any) => WalletSigners;
|
|
13
|
+
export declare const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
+
|
|
7
|
+
var walletsShared = require('@rango-dev/wallets-shared');
|
|
8
|
+
var web3_js = require('@solana/web3.js');
|
|
9
|
+
var bs58 = _interopDefault(require('bs58'));
|
|
10
|
+
|
|
11
|
+
function _regeneratorRuntime() {
|
|
12
|
+
_regeneratorRuntime = function () {
|
|
13
|
+
return exports;
|
|
14
|
+
};
|
|
15
|
+
var exports = {},
|
|
16
|
+
Op = Object.prototype,
|
|
17
|
+
hasOwn = Op.hasOwnProperty,
|
|
18
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
19
|
+
obj[key] = desc.value;
|
|
20
|
+
},
|
|
21
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
22
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
23
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
24
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
25
|
+
function define(obj, key, value) {
|
|
26
|
+
return Object.defineProperty(obj, key, {
|
|
27
|
+
value: value,
|
|
28
|
+
enumerable: !0,
|
|
29
|
+
configurable: !0,
|
|
30
|
+
writable: !0
|
|
31
|
+
}), obj[key];
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
define({}, "");
|
|
35
|
+
} catch (err) {
|
|
36
|
+
define = function (obj, key, value) {
|
|
37
|
+
return obj[key] = value;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
41
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
42
|
+
generator = Object.create(protoGenerator.prototype),
|
|
43
|
+
context = new Context(tryLocsList || []);
|
|
44
|
+
return defineProperty(generator, "_invoke", {
|
|
45
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
46
|
+
}), generator;
|
|
47
|
+
}
|
|
48
|
+
function tryCatch(fn, obj, arg) {
|
|
49
|
+
try {
|
|
50
|
+
return {
|
|
51
|
+
type: "normal",
|
|
52
|
+
arg: fn.call(obj, arg)
|
|
53
|
+
};
|
|
54
|
+
} catch (err) {
|
|
55
|
+
return {
|
|
56
|
+
type: "throw",
|
|
57
|
+
arg: err
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.wrap = wrap;
|
|
62
|
+
var ContinueSentinel = {};
|
|
63
|
+
function Generator() {}
|
|
64
|
+
function GeneratorFunction() {}
|
|
65
|
+
function GeneratorFunctionPrototype() {}
|
|
66
|
+
var IteratorPrototype = {};
|
|
67
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
68
|
+
return this;
|
|
69
|
+
});
|
|
70
|
+
var getProto = Object.getPrototypeOf,
|
|
71
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
72
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
73
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
74
|
+
function defineIteratorMethods(prototype) {
|
|
75
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
76
|
+
define(prototype, method, function (arg) {
|
|
77
|
+
return this._invoke(method, arg);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
82
|
+
function invoke(method, arg, resolve, reject) {
|
|
83
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
84
|
+
if ("throw" !== record.type) {
|
|
85
|
+
var result = record.arg,
|
|
86
|
+
value = result.value;
|
|
87
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
88
|
+
invoke("next", value, resolve, reject);
|
|
89
|
+
}, function (err) {
|
|
90
|
+
invoke("throw", err, resolve, reject);
|
|
91
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
92
|
+
result.value = unwrapped, resolve(result);
|
|
93
|
+
}, function (error) {
|
|
94
|
+
return invoke("throw", error, resolve, reject);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
reject(record.arg);
|
|
98
|
+
}
|
|
99
|
+
var previousPromise;
|
|
100
|
+
defineProperty(this, "_invoke", {
|
|
101
|
+
value: function (method, arg) {
|
|
102
|
+
function callInvokeWithMethodAndArg() {
|
|
103
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
104
|
+
invoke(method, arg, resolve, reject);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
112
|
+
var state = "suspendedStart";
|
|
113
|
+
return function (method, arg) {
|
|
114
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
115
|
+
if ("completed" === state) {
|
|
116
|
+
if ("throw" === method) throw arg;
|
|
117
|
+
return doneResult();
|
|
118
|
+
}
|
|
119
|
+
for (context.method = method, context.arg = arg;;) {
|
|
120
|
+
var delegate = context.delegate;
|
|
121
|
+
if (delegate) {
|
|
122
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
123
|
+
if (delegateResult) {
|
|
124
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
125
|
+
return delegateResult;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
129
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
130
|
+
context.dispatchException(context.arg);
|
|
131
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
132
|
+
state = "executing";
|
|
133
|
+
var record = tryCatch(innerFn, self, context);
|
|
134
|
+
if ("normal" === record.type) {
|
|
135
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
136
|
+
return {
|
|
137
|
+
value: record.arg,
|
|
138
|
+
done: context.done
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
146
|
+
var methodName = context.method,
|
|
147
|
+
method = delegate.iterator[methodName];
|
|
148
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
149
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
150
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
151
|
+
var info = record.arg;
|
|
152
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
153
|
+
}
|
|
154
|
+
function pushTryEntry(locs) {
|
|
155
|
+
var entry = {
|
|
156
|
+
tryLoc: locs[0]
|
|
157
|
+
};
|
|
158
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
159
|
+
}
|
|
160
|
+
function resetTryEntry(entry) {
|
|
161
|
+
var record = entry.completion || {};
|
|
162
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
163
|
+
}
|
|
164
|
+
function Context(tryLocsList) {
|
|
165
|
+
this.tryEntries = [{
|
|
166
|
+
tryLoc: "root"
|
|
167
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
168
|
+
}
|
|
169
|
+
function values(iterable) {
|
|
170
|
+
if (iterable) {
|
|
171
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
172
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
173
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
174
|
+
if (!isNaN(iterable.length)) {
|
|
175
|
+
var i = -1,
|
|
176
|
+
next = function next() {
|
|
177
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
178
|
+
return next.value = undefined, next.done = !0, next;
|
|
179
|
+
};
|
|
180
|
+
return next.next = next;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
next: doneResult
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function doneResult() {
|
|
188
|
+
return {
|
|
189
|
+
value: undefined,
|
|
190
|
+
done: !0
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
194
|
+
value: GeneratorFunctionPrototype,
|
|
195
|
+
configurable: !0
|
|
196
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
197
|
+
value: GeneratorFunction,
|
|
198
|
+
configurable: !0
|
|
199
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
200
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
201
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
202
|
+
}, exports.mark = function (genFun) {
|
|
203
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
204
|
+
}, exports.awrap = function (arg) {
|
|
205
|
+
return {
|
|
206
|
+
__await: arg
|
|
207
|
+
};
|
|
208
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
209
|
+
return this;
|
|
210
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
211
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
212
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
213
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
214
|
+
return result.done ? result.value : iter.next();
|
|
215
|
+
});
|
|
216
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
217
|
+
return this;
|
|
218
|
+
}), define(Gp, "toString", function () {
|
|
219
|
+
return "[object Generator]";
|
|
220
|
+
}), exports.keys = function (val) {
|
|
221
|
+
var object = Object(val),
|
|
222
|
+
keys = [];
|
|
223
|
+
for (var key in object) keys.push(key);
|
|
224
|
+
return keys.reverse(), function next() {
|
|
225
|
+
for (; keys.length;) {
|
|
226
|
+
var key = keys.pop();
|
|
227
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
228
|
+
}
|
|
229
|
+
return next.done = !0, next;
|
|
230
|
+
};
|
|
231
|
+
}, exports.values = values, Context.prototype = {
|
|
232
|
+
constructor: Context,
|
|
233
|
+
reset: function (skipTempReset) {
|
|
234
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
235
|
+
},
|
|
236
|
+
stop: function () {
|
|
237
|
+
this.done = !0;
|
|
238
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
239
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
240
|
+
return this.rval;
|
|
241
|
+
},
|
|
242
|
+
dispatchException: function (exception) {
|
|
243
|
+
if (this.done) throw exception;
|
|
244
|
+
var context = this;
|
|
245
|
+
function handle(loc, caught) {
|
|
246
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
247
|
+
}
|
|
248
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
249
|
+
var entry = this.tryEntries[i],
|
|
250
|
+
record = entry.completion;
|
|
251
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
252
|
+
if (entry.tryLoc <= this.prev) {
|
|
253
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
254
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
255
|
+
if (hasCatch && hasFinally) {
|
|
256
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
257
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
258
|
+
} else if (hasCatch) {
|
|
259
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
260
|
+
} else {
|
|
261
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
262
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
abrupt: function (type, arg) {
|
|
268
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
269
|
+
var entry = this.tryEntries[i];
|
|
270
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
271
|
+
var finallyEntry = entry;
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
276
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
277
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
278
|
+
},
|
|
279
|
+
complete: function (record, afterLoc) {
|
|
280
|
+
if ("throw" === record.type) throw record.arg;
|
|
281
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
282
|
+
},
|
|
283
|
+
finish: function (finallyLoc) {
|
|
284
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
285
|
+
var entry = this.tryEntries[i];
|
|
286
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
catch: function (tryLoc) {
|
|
290
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
291
|
+
var entry = this.tryEntries[i];
|
|
292
|
+
if (entry.tryLoc === tryLoc) {
|
|
293
|
+
var record = entry.completion;
|
|
294
|
+
if ("throw" === record.type) {
|
|
295
|
+
var thrown = record.arg;
|
|
296
|
+
resetTryEntry(entry);
|
|
297
|
+
}
|
|
298
|
+
return thrown;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
throw new Error("illegal catch attempt");
|
|
302
|
+
},
|
|
303
|
+
delegateYield: function (iterable, resultName, nextLoc) {
|
|
304
|
+
return this.delegate = {
|
|
305
|
+
iterator: values(iterable),
|
|
306
|
+
resultName: resultName,
|
|
307
|
+
nextLoc: nextLoc
|
|
308
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
309
|
+
}
|
|
310
|
+
}, exports;
|
|
311
|
+
}
|
|
312
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
313
|
+
try {
|
|
314
|
+
var info = gen[key](arg);
|
|
315
|
+
var value = info.value;
|
|
316
|
+
} catch (error) {
|
|
317
|
+
reject(error);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (info.done) {
|
|
321
|
+
resolve(value);
|
|
322
|
+
} else {
|
|
323
|
+
Promise.resolve(value).then(_next, _throw);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function _asyncToGenerator(fn) {
|
|
327
|
+
return function () {
|
|
328
|
+
var self = this,
|
|
329
|
+
args = arguments;
|
|
330
|
+
return new Promise(function (resolve, reject) {
|
|
331
|
+
var gen = fn.apply(self, args);
|
|
332
|
+
function _next(value) {
|
|
333
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
334
|
+
}
|
|
335
|
+
function _throw(err) {
|
|
336
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
337
|
+
}
|
|
338
|
+
_next(undefined);
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function _extends() {
|
|
343
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
344
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
345
|
+
var source = arguments[i];
|
|
346
|
+
for (var key in source) {
|
|
347
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
348
|
+
target[key] = source[key];
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return target;
|
|
353
|
+
};
|
|
354
|
+
return _extends.apply(this, arguments);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function coin98() {
|
|
358
|
+
var _window = window,
|
|
359
|
+
coin98 = _window.coin98,
|
|
360
|
+
ethereum = _window.ethereum;
|
|
361
|
+
if (!coin98) return null;
|
|
362
|
+
var instances = new Map();
|
|
363
|
+
// When disabled overring metamask
|
|
364
|
+
if (coin98.provider) instances.set(walletsShared.Network.ETHEREUM, coin98.provider);
|
|
365
|
+
if (ethereum && ethereum.isCoin98) instances.set(walletsShared.Network.ETHEREUM, ethereum);
|
|
366
|
+
if (coin98.sol) instances.set(walletsShared.Network.SOLANA, coin98.sol);
|
|
367
|
+
return instances;
|
|
368
|
+
}
|
|
369
|
+
/*
|
|
370
|
+
This is how coin98 is getting solana accounts.
|
|
371
|
+
That's the reason we haven't moved it to `shared`
|
|
372
|
+
*/
|
|
373
|
+
function getSolanaAccounts(_x) {
|
|
374
|
+
return _getSolanaAccounts.apply(this, arguments);
|
|
375
|
+
}
|
|
376
|
+
function _getSolanaAccounts() {
|
|
377
|
+
_getSolanaAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(instance) {
|
|
378
|
+
var accounts;
|
|
379
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
380
|
+
while (1) switch (_context.prev = _context.next) {
|
|
381
|
+
case 0:
|
|
382
|
+
_context.next = 2;
|
|
383
|
+
return instance.enable();
|
|
384
|
+
case 2:
|
|
385
|
+
_context.next = 4;
|
|
386
|
+
return instance.request({
|
|
387
|
+
method: 'sol_accounts'
|
|
388
|
+
});
|
|
389
|
+
case 4:
|
|
390
|
+
accounts = _context.sent;
|
|
391
|
+
return _context.abrupt("return", {
|
|
392
|
+
accounts: accounts
|
|
393
|
+
});
|
|
394
|
+
case 6:
|
|
395
|
+
case "end":
|
|
396
|
+
return _context.stop();
|
|
397
|
+
}
|
|
398
|
+
}, _callee);
|
|
399
|
+
}));
|
|
400
|
+
return _getSolanaAccounts.apply(this, arguments);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function getSigners(provider) {
|
|
404
|
+
return _extends({}, walletsShared.defaultSigners({
|
|
405
|
+
provider: provider,
|
|
406
|
+
walletType: walletsShared.WalletType.COIN98,
|
|
407
|
+
supportEvm: true
|
|
408
|
+
}), {
|
|
409
|
+
executeSolanaTransaction: function () {
|
|
410
|
+
var _executeSolanaTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(tx, requestId) {
|
|
411
|
+
var solProvider, solanaSigner, hash;
|
|
412
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
413
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
414
|
+
case 0:
|
|
415
|
+
solProvider = walletsShared.getNetworkInstance(provider, walletsShared.Network.SOLANA);
|
|
416
|
+
solanaSigner = /*#__PURE__*/function () {
|
|
417
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(solanaWeb3Transaction) {
|
|
418
|
+
var response, publicKey, sign, raw;
|
|
419
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
420
|
+
while (1) switch (_context.prev = _context.next) {
|
|
421
|
+
case 0:
|
|
422
|
+
_context.next = 2;
|
|
423
|
+
return solProvider.request({
|
|
424
|
+
method: 'sol_sign',
|
|
425
|
+
params: [solanaWeb3Transaction]
|
|
426
|
+
});
|
|
427
|
+
case 2:
|
|
428
|
+
response = _context.sent;
|
|
429
|
+
publicKey = new web3_js.PublicKey(response.publicKey);
|
|
430
|
+
sign = bs58.decode(response.signature);
|
|
431
|
+
solanaWeb3Transaction.addSignature(publicKey, Buffer.from(sign));
|
|
432
|
+
raw = solanaWeb3Transaction.serialize();
|
|
433
|
+
return _context.abrupt("return", raw);
|
|
434
|
+
case 8:
|
|
435
|
+
case "end":
|
|
436
|
+
return _context.stop();
|
|
437
|
+
}
|
|
438
|
+
}, _callee);
|
|
439
|
+
}));
|
|
440
|
+
return function solanaSigner(_x3) {
|
|
441
|
+
return _ref.apply(this, arguments);
|
|
442
|
+
};
|
|
443
|
+
}();
|
|
444
|
+
_context2.next = 4;
|
|
445
|
+
return walletsShared.generalSolanaTransactionExecutor(requestId, tx, solanaSigner);
|
|
446
|
+
case 4:
|
|
447
|
+
hash = _context2.sent;
|
|
448
|
+
return _context2.abrupt("return", hash);
|
|
449
|
+
case 6:
|
|
450
|
+
case "end":
|
|
451
|
+
return _context2.stop();
|
|
452
|
+
}
|
|
453
|
+
}, _callee2);
|
|
454
|
+
}));
|
|
455
|
+
function executeSolanaTransaction(_x, _x2) {
|
|
456
|
+
return _executeSolanaTransaction.apply(this, arguments);
|
|
457
|
+
}
|
|
458
|
+
return executeSolanaTransaction;
|
|
459
|
+
}()
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
var WALLET = walletsShared.WalletType.COIN98;
|
|
464
|
+
var config = {
|
|
465
|
+
type: WALLET,
|
|
466
|
+
// TODO: Get from evm networks
|
|
467
|
+
defaultNetwork: walletsShared.Network.ETHEREUM
|
|
468
|
+
};
|
|
469
|
+
var getInstance = coin98;
|
|
470
|
+
var connect = /*#__PURE__*/function () {
|
|
471
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
472
|
+
var instance, meta, evm_instance, sol_instance, evm, _yield$getSolanaAccou, solanaAccounts;
|
|
473
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
474
|
+
while (1) switch (_context.prev = _context.next) {
|
|
475
|
+
case 0:
|
|
476
|
+
instance = _ref.instance, meta = _ref.meta;
|
|
477
|
+
evm_instance = walletsShared.chooseInstance(instance, meta, walletsShared.Network.ETHEREUM);
|
|
478
|
+
sol_instance = walletsShared.chooseInstance(instance, meta, walletsShared.Network.SOLANA);
|
|
479
|
+
_context.next = 5;
|
|
480
|
+
return walletsShared.getEvmAccounts(evm_instance);
|
|
481
|
+
case 5:
|
|
482
|
+
evm = _context.sent;
|
|
483
|
+
_context.next = 8;
|
|
484
|
+
return getSolanaAccounts(sol_instance);
|
|
485
|
+
case 8:
|
|
486
|
+
_yield$getSolanaAccou = _context.sent;
|
|
487
|
+
solanaAccounts = _yield$getSolanaAccou.accounts;
|
|
488
|
+
return _context.abrupt("return", [evm, {
|
|
489
|
+
accounts: solanaAccounts,
|
|
490
|
+
chainId: walletsShared.Network.SOLANA
|
|
491
|
+
}]);
|
|
492
|
+
case 11:
|
|
493
|
+
case "end":
|
|
494
|
+
return _context.stop();
|
|
495
|
+
}
|
|
496
|
+
}, _callee);
|
|
497
|
+
}));
|
|
498
|
+
return function connect(_x) {
|
|
499
|
+
return _ref2.apply(this, arguments);
|
|
500
|
+
};
|
|
501
|
+
}();
|
|
502
|
+
var subscribe = function subscribe(_ref3) {
|
|
503
|
+
var instance = _ref3.instance,
|
|
504
|
+
meta = _ref3.meta,
|
|
505
|
+
updateChainId = _ref3.updateChainId,
|
|
506
|
+
connect = _ref3.connect;
|
|
507
|
+
var eth = walletsShared.chooseInstance(instance, meta, walletsShared.Network.ETHEREUM);
|
|
508
|
+
eth == null ? void 0 : eth.on('chainChanged', function (chainId) {
|
|
509
|
+
var network = walletsShared.getBlockChainNameFromId(chainId, meta) || walletsShared.Network.Unknown;
|
|
510
|
+
var targetInstance = walletsShared.chooseInstance(instance, meta, network);
|
|
511
|
+
targetInstance.request({
|
|
512
|
+
method: 'eth_requestAccounts'
|
|
513
|
+
}).then(function () {
|
|
514
|
+
return undefined;
|
|
515
|
+
})["catch"](function (err) {
|
|
516
|
+
console.log({
|
|
517
|
+
err: err
|
|
518
|
+
});
|
|
519
|
+
});
|
|
520
|
+
/*
|
|
521
|
+
TODO:
|
|
522
|
+
We are calling `connect` here because signer can't detect
|
|
523
|
+
currect network, I guess the bug is in our signer and it
|
|
524
|
+
gets the wrong network by calling a wrong method or something.
|
|
525
|
+
Anyways, this works for now, maybe we can reconsider it in future
|
|
526
|
+
Whenever we refactored the signer code as well.
|
|
527
|
+
*/
|
|
528
|
+
// we need to update `network` first, if not, it will goes through
|
|
529
|
+
// the switching network and will open unneccessary pop ups.
|
|
530
|
+
updateChainId(chainId);
|
|
531
|
+
connect(network);
|
|
532
|
+
});
|
|
533
|
+
};
|
|
534
|
+
var switchNetwork = /*#__PURE__*/function () {
|
|
535
|
+
var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
536
|
+
var instance;
|
|
537
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
538
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
539
|
+
case 0:
|
|
540
|
+
instance = walletsShared.chooseInstance(options.instance, options.meta, options.network);
|
|
541
|
+
return _context2.abrupt("return", walletsShared.switchNetworkForEvm(_extends({}, options, {
|
|
542
|
+
instance: instance
|
|
543
|
+
})));
|
|
544
|
+
case 2:
|
|
545
|
+
case "end":
|
|
546
|
+
return _context2.stop();
|
|
547
|
+
}
|
|
548
|
+
}, _callee2);
|
|
549
|
+
}));
|
|
550
|
+
return function switchNetwork(_x2) {
|
|
551
|
+
return _ref4.apply(this, arguments);
|
|
552
|
+
};
|
|
553
|
+
}();
|
|
554
|
+
var canSwitchNetworkTo = walletsShared.canSwitchNetworkToEvm;
|
|
555
|
+
var getSigners$1 = getSigners;
|
|
556
|
+
var getWalletInfo = function getWalletInfo(allBlockChains) {
|
|
557
|
+
var evms = walletsShared.evmBlockchains(allBlockChains);
|
|
558
|
+
var solana = walletsShared.solanaBlockchain(allBlockChains);
|
|
559
|
+
return {
|
|
560
|
+
name: 'Coin98',
|
|
561
|
+
img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/coin98.svg',
|
|
562
|
+
installLink: {
|
|
563
|
+
CHROME: 'https://chrome.google.com/webstore/detail/coin98-wallet/aeachknmefphepccionboohckonoeemg',
|
|
564
|
+
BRAVE: 'https://chrome.google.com/webstore/detail/coin98-wallet/aeachknmefphepccionboohckonoeemg',
|
|
565
|
+
DEFAULT: 'https://coin98.com/wallet'
|
|
566
|
+
},
|
|
567
|
+
color: '#1d1c25',
|
|
568
|
+
supportedChains: [].concat(evms, solana)
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
exports.canSwitchNetworkTo = canSwitchNetworkTo;
|
|
573
|
+
exports.config = config;
|
|
574
|
+
exports.connect = connect;
|
|
575
|
+
exports.getInstance = getInstance;
|
|
576
|
+
exports.getSigners = getSigners$1;
|
|
577
|
+
exports.getWalletInfo = getWalletInfo;
|
|
578
|
+
exports.subscribe = subscribe;
|
|
579
|
+
exports.switchNetwork = switchNetwork;
|
|
580
|
+
//# sourceMappingURL=provider-coin98.cjs.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-coin98.cjs.development.js","sources":["../src/helpers.ts","../src/signer.ts","../src/index.ts"],"sourcesContent":["import { Network } from '@rango-dev/wallets-shared';\n\nexport function coin98() {\n const { coin98, ethereum } = window;\n\n if (!coin98) return null;\n\n const instances = new Map();\n\n // When disabled overring metamask\n if (coin98.provider) instances.set(Network.ETHEREUM, coin98.provider);\n if (ethereum && ethereum.isCoin98) instances.set(Network.ETHEREUM, ethereum);\n if (coin98.sol) instances.set(Network.SOLANA, coin98.sol);\n\n return instances;\n}\n\n/* \n This is how coin98 is getting solana accounts.\n That's the reason we haven't moved it to `shared`\n*/\nexport async function getSolanaAccounts(instance: any) {\n await instance.enable();\n const accounts = await instance.request({ method: 'sol_accounts' });\n return {\n accounts,\n };\n}\n","import {\n SolanaTransaction,\n Network,\n WalletType,\n WalletSigners,\n getNetworkInstance,\n defaultSigners,\n generalSolanaTransactionExecutor,\n SolanaSigner,\n} from '@rango-dev/wallets-shared';\nimport { PublicKey, Transaction } from '@solana/web3.js';\nimport bs58 from 'bs58';\n\nexport default function getSigners(provider: any): WalletSigners {\n return {\n ...defaultSigners({\n provider,\n walletType: WalletType.COIN98,\n supportEvm: true,\n }),\n\n executeSolanaTransaction: async (\n tx: SolanaTransaction,\n requestId: string\n ): Promise<string> => {\n const solProvider = getNetworkInstance(provider, Network.SOLANA);\n\n const solanaSigner: SolanaSigner = async (\n solanaWeb3Transaction: Transaction\n ) => {\n const response: { publicKey: string; signature: string } =\n await solProvider.request({\n method: 'sol_sign',\n params: [solanaWeb3Transaction],\n });\n const publicKey = new PublicKey(response.publicKey);\n const sign = bs58.decode(response.signature);\n\n solanaWeb3Transaction.addSignature(publicKey, Buffer.from(sign));\n const raw = solanaWeb3Transaction.serialize();\n return raw;\n };\n const hash = await generalSolanaTransactionExecutor(\n requestId,\n tx,\n solanaSigner\n );\n return hash;\n },\n };\n}\n","import {\n getBlockChainNameFromId,\n Network,\n WalletType,\n canSwitchNetworkToEvm,\n chooseInstance,\n getEvmAccounts,\n switchNetworkForEvm,\n CanSwitchNetwork,\n Connect,\n Subscribe,\n SwitchNetwork,\n WalletSigners,\n BlockchainMeta,\n WalletInfo,\n evmBlockchains,\n solanaBlockchain,\n} from '@rango-dev/wallets-shared';\nimport { coin98 as coin98_instances } from './helpers';\nimport { getSolanaAccounts } from './helpers';\nimport signer from './signer';\n\nconst WALLET = WalletType.COIN98;\n\nexport const config = {\n type: WALLET,\n // TODO: Get from evm networks\n defaultNetwork: Network.ETHEREUM,\n};\nexport const getInstance = coin98_instances;\n\nexport const connect: Connect = async ({ instance, meta }) => {\n const evm_instance = chooseInstance(instance, meta, Network.ETHEREUM);\n const sol_instance = chooseInstance(instance, meta, Network.SOLANA);\n const evm = await getEvmAccounts(evm_instance);\n const { accounts: solanaAccounts } = await getSolanaAccounts(sol_instance);\n\n return [\n evm,\n {\n accounts: solanaAccounts,\n chainId: Network.SOLANA,\n },\n ];\n};\n\nexport const subscribe: Subscribe = ({\n instance,\n meta,\n updateChainId,\n connect,\n}) => {\n const eth = chooseInstance(instance, meta, Network.ETHEREUM);\n eth?.on('chainChanged', (chainId: string) => {\n const network = getBlockChainNameFromId(chainId, meta) || Network.Unknown;\n const targetInstance = chooseInstance(instance, meta, network);\n targetInstance\n .request({ method: 'eth_requestAccounts' })\n .then(() => undefined)\n .catch((err: unknown) => {\n console.log({ err });\n });\n /*\n TODO:\n We are calling `connect` here because signer can't detect\n currect network, I guess the bug is in our signer and it \n gets the wrong network by calling a wrong method or something.\n Anyways, this works for now, maybe we can reconsider it in future\n Whenever we refactored the signer code as well. \n */\n\n // we need to update `network` first, if not, it will goes through\n // the switching network and will open unneccessary pop ups.\n updateChainId(chainId);\n connect(network);\n });\n};\n\nexport const switchNetwork: SwitchNetwork = async (options) => {\n const instance = chooseInstance(\n options.instance,\n options.meta,\n options.network\n );\n return switchNetworkForEvm({\n ...options,\n instance,\n });\n};\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = canSwitchNetworkToEvm;\n\nexport const getSigners: (provider: any) => WalletSigners = signer;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const evms = evmBlockchains(allBlockChains);\n const solana = solanaBlockchain(allBlockChains);\n return {\n name: 'Coin98',\n img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/coin98.svg',\n installLink: {\n CHROME:\n 'https://chrome.google.com/webstore/detail/coin98-wallet/aeachknmefphepccionboohckonoeemg',\n BRAVE:\n 'https://chrome.google.com/webstore/detail/coin98-wallet/aeachknmefphepccionboohckonoeemg',\n DEFAULT: 'https://coin98.com/wallet',\n },\n color: '#1d1c25',\n supportedChains: [...evms, ...solana],\n };\n};\n"],"names":["coin98","window","ethereum","instances","Map","provider","set","Network","ETHEREUM","isCoin98","sol","SOLANA","getSolanaAccounts","instance","enable","request","method","accounts","getSigners","defaultSigners","walletType","WalletType","COIN98","supportEvm","executeSolanaTransaction","tx","requestId","solProvider","getNetworkInstance","solanaSigner","solanaWeb3Transaction","params","response","publicKey","PublicKey","sign","bs58","decode","signature","addSignature","Buffer","from","raw","serialize","generalSolanaTransactionExecutor","hash","WALLET","config","type","defaultNetwork","getInstance","coin98_instances","connect","meta","evm_instance","chooseInstance","sol_instance","getEvmAccounts","evm","solanaAccounts","chainId","subscribe","updateChainId","eth","on","network","getBlockChainNameFromId","Unknown","targetInstance","then","undefined","err","console","log","switchNetwork","options","switchNetworkForEvm","canSwitchNetworkTo","canSwitchNetworkToEvm","signer","getWalletInfo","allBlockChains","evms","evmBlockchains","solana","solanaBlockchain","name","img","installLink","CHROME","BRAVE","DEFAULT","color","supportedChains"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAEgBA,MAAM;EACpB,cAA6BC,MAAM;IAA3BD,MAAM,WAANA,MAAM;IAAEE,QAAQ,WAARA,QAAQ;EAExB,IAAI,CAACF,MAAM,EAAE,OAAO,IAAI;EAExB,IAAMG,SAAS,GAAG,IAAIC,GAAG,EAAE;;EAG3B,IAAIJ,MAAM,CAACK,QAAQ,EAAEF,SAAS,CAACG,GAAG,CAACC,qBAAO,CAACC,QAAQ,EAAER,MAAM,CAACK,QAAQ,CAAC;EACrE,IAAIH,QAAQ,IAAIA,QAAQ,CAACO,QAAQ,EAAEN,SAAS,CAACG,GAAG,CAACC,qBAAO,CAACC,QAAQ,EAAEN,QAAQ,CAAC;EAC5E,IAAIF,MAAM,CAACU,GAAG,EAAEP,SAAS,CAACG,GAAG,CAACC,qBAAO,CAACI,MAAM,EAAEX,MAAM,CAACU,GAAG,CAAC;EAEzD,OAAOP,SAAS;AAClB;AAEA;;;;SAIsBS,iBAAiB;EAAA;AAAA;AAMtC;EAAA,gFANM,iBAAiCC,QAAa;IAAA;IAAA;MAAA;QAAA;UAAA;UAAA,OAC7CA,QAAQ,CAACC,MAAM,EAAE;QAAA;UAAA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(exports,"__esModule",{value:!0});var t,e=require("@rango-dev/wallets-shared"),r=require("@solana/web3.js"),n=(t=require("bs58"))&&"object"==typeof t&&"default"in t?t.default:t;function o(){o=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,o){var a=Object.create((e&&e.prototype instanceof p?e:p).prototype),i=new O(o||[]);return n(a,"_invoke",{value:E(t,r,i)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var f={};function p(){}function v(){}function d(){}var y={};s(y,i,(function(){return this}));var g=Object.getPrototypeOf,w=g&&g(g(_([])));w&&w!==e&&r.call(w,i)&&(y=w);var m=d.prototype=p.prototype=Object.create(y);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var o;n(this,"_invoke",{value:function(n,a){function i(){return new e((function(o,i){!function n(o,a,i,c){var u=h(t[o],t,a);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,i,c)}),(function(t){n("throw",t,i,c)})):e.resolve(l).then((function(t){s.value=t,i(s)}),(function(t){return n("throw",t,i,c)}))}c(u.arg)}(n,a,o,i)}))}return o=o?o.then(i,i):i()}})}function E(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=k(i,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=h(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var a=o.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function _(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return v.prototype=d,n(m,"constructor",{value:d,configurable:!0}),n(d,"constructor",{value:v,configurable:!0}),v.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},x(b.prototype),s(b.prototype,c,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new b(l(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},x(m),s(m,u,"Generator"),s(m,i,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=_,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(N),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function a(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function c(t){a(i,n,o,c,u,"next",t)}function u(t){a(i,n,o,c,u,"throw",t)}c(void 0)}))}}function c(){return(c=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function u(t){return s.apply(this,arguments)}function s(){return(s=i(o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.enable();case 2:return t.next=4,e.request({method:"sol_accounts"});case 4:return t.abrupt("return",{accounts:t.sent});case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var l={type:e.WalletType.COIN98,defaultNetwork:e.Network.ETHEREUM},h=function(){var t=i(o().mark((function t(r){var n,a,i,c,s;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=e.chooseInstance(n=r.instance,a=r.meta,e.Network.ETHEREUM),c=e.chooseInstance(n,a,e.Network.SOLANA),t.next=5,e.getEvmAccounts(i);case 5:return s=t.sent,t.next=8,u(c);case 8:return t.abrupt("return",[s,{accounts:t.sent.accounts,chainId:e.Network.SOLANA}]);case 11:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),f=function(){var t=i(o().mark((function t(r){var n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.chooseInstance(r.instance,r.meta,r.network),t.abrupt("return",e.switchNetworkForEvm(c({},r,{instance:n})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();exports.canSwitchNetworkTo=e.canSwitchNetworkToEvm,exports.config=l,exports.connect=h,exports.getInstance=function(){var t=window,r=t.coin98,n=t.ethereum;if(!r)return null;var o=new Map;return r.provider&&o.set(e.Network.ETHEREUM,r.provider),n&&n.isCoin98&&o.set(e.Network.ETHEREUM,n),r.sol&&o.set(e.Network.SOLANA,r.sol),o},exports.getSigners=function(t){return c({},e.defaultSigners({provider:t,walletType:e.WalletType.COIN98,supportEvm:!0}),{executeSolanaTransaction:(a=i(o().mark((function a(c,u){var s,l;return o().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s=e.getNetworkInstance(t,e.Network.SOLANA),l=function(){var t=i(o().mark((function t(e){var a,i,c,u;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.request({method:"sol_sign",params:[e]});case 2:return i=new r.PublicKey((a=t.sent).publicKey),c=n.decode(a.signature),e.addSignature(i,Buffer.from(c)),u=e.serialize(),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),a.next=4,e.generalSolanaTransactionExecutor(u,c,l);case 4:return a.abrupt("return",a.sent);case 6:case"end":return a.stop()}}),a)}))),function(t,e){return a.apply(this,arguments)})});var a},exports.getWalletInfo=function(t){var r=e.evmBlockchains(t),n=e.solanaBlockchain(t);return{name:"Coin98",img:"https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/coin98.svg",installLink:{CHROME:"https://chrome.google.com/webstore/detail/coin98-wallet/aeachknmefphepccionboohckonoeemg",BRAVE:"https://chrome.google.com/webstore/detail/coin98-wallet/aeachknmefphepccionboohckonoeemg",DEFAULT:"https://coin98.com/wallet"},color:"#1d1c25",supportedChains:[].concat(r,n)}},exports.subscribe=function(t){var r=t.instance,n=t.meta,o=t.updateChainId,a=t.connect,i=e.chooseInstance(r,n,e.Network.ETHEREUM);null==i||i.on("chainChanged",(function(t){var i=e.getBlockChainNameFromId(t,n)||e.Network.Unknown;e.chooseInstance(r,n,i).request({method:"eth_requestAccounts"}).then((function(){})).catch((function(t){console.log({err:t})})),o(t),a(i)}))},exports.switchNetwork=f;
|
|
2
|
+
//# sourceMappingURL=provider-coin98.cjs.production.min.js.map
|