@rango-dev/signer-starknet 0.1.15-next.0 → 0.1.15-next.1
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/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -8
- package/dist/index.js.map +7 -0
- package/dist/signer.d.ts +10 -9
- package/dist/signer.d.ts.map +1 -0
- package/package.json +5 -24
- package/dist/signer-starknet.cjs.development.js +0 -393
- package/dist/signer-starknet.cjs.development.js.map +0 -1
- package/dist/signer-starknet.cjs.production.min.js +0 -2
- package/dist/signer-starknet.cjs.production.min.js.map +0 -1
- package/dist/signer-starknet.esm.js +0 -389
- package/dist/signer-starknet.esm.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { DefaultStarknetSigner } from './signer';
|
|
1
|
+
export { DefaultStarknetSigner } from './signer';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (process.env.NODE_ENV === 'production') {
|
|
5
|
-
module.exports = require('./signer-starknet.cjs.production.min.js')
|
|
6
|
-
} else {
|
|
7
|
-
module.exports = require('./signer-starknet.cjs.development.js')
|
|
8
|
-
}
|
|
1
|
+
var o=Object.defineProperty;var i=(t,r)=>o(t,"name",{value:r,configurable:!0});import{SignerError as a,SignerErrorCode as s}from"rango-types";var e=class{constructor(r){this.provider=r}async signMessage(){throw a.UnimplementedError("signMessage")}async signAndSendTx(r){try{let{transaction_hash:n}=await this.provider.account.execute(r.calls);return n}catch(n){throw new a(s.SEND_TX_ERROR,void 0,n)}}};i(e,"DefaultStarknetSigner");export{e as DefaultStarknetSigner};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/signer.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n GenericSigner,\n SignerError,\n SignerErrorCode,\n StarknetTransaction,\n} from 'rango-types';\n\n// TODO - replace with real type\n// tslint:disable-next-line: no-any\ntype StarknetExternalProvider = any;\n\nexport class DefaultStarknetSigner\n implements GenericSigner<StarknetTransaction>\n{\n private provider: StarknetExternalProvider;\n\n constructor(provider: StarknetExternalProvider) {\n this.provider = provider;\n }\n\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: StarknetTransaction): Promise<string> {\n try {\n const { transaction_hash } = await this.provider.account.execute(\n tx.calls\n );\n return transaction_hash;\n } catch (error) {\n throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, error);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "+EAAA,OAEE,eAAAA,EACA,mBAAAC,MAEK,cAMA,IAAMC,EAAN,KAEP,CAGE,YAAYC,EAAoC,CAC9C,KAAK,SAAWA,CAClB,CAEA,MAAM,aAA+B,CACnC,MAAMC,EAAY,mBAAmB,aAAa,CACpD,CAEA,MAAM,cAAcC,EAA0C,CAC5D,GAAI,CACF,GAAM,CAAE,iBAAAC,CAAiB,EAAI,MAAM,KAAK,SAAS,QAAQ,QACvDD,EAAG,KACL,EACA,OAAOC,CACT,OAASC,EAAP,CACA,MAAM,IAAIH,EAAYI,EAAgB,cAAe,OAAWD,CAAK,CACvE,CACF,CACF,EAvBaE,EAAAP,EAAA",
|
|
6
|
+
"names": ["SignerError", "SignerErrorCode", "DefaultStarknetSigner", "provider", "SignerError", "tx", "transaction_hash", "error", "SignerErrorCode", "__name"]
|
|
7
|
+
}
|
package/dist/signer.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { GenericSigner, StarknetTransaction } from 'rango-types';
|
|
2
|
-
|
|
3
|
-
export declare class DefaultStarknetSigner implements GenericSigner<StarknetTransaction> {
|
|
4
|
-
private provider;
|
|
5
|
-
constructor(provider: StarknetExternalProvider);
|
|
6
|
-
signMessage(): Promise<string>;
|
|
7
|
-
signAndSendTx(tx: StarknetTransaction): Promise<string>;
|
|
8
|
-
}
|
|
9
|
-
export {};
|
|
1
|
+
import { GenericSigner, StarknetTransaction } from 'rango-types';
|
|
2
|
+
type StarknetExternalProvider = any;
|
|
3
|
+
export declare class DefaultStarknetSigner implements GenericSigner<StarknetTransaction> {
|
|
4
|
+
private provider;
|
|
5
|
+
constructor(provider: StarknetExternalProvider);
|
|
6
|
+
signMessage(): Promise<string>;
|
|
7
|
+
signAndSendTx(tx: StarknetTransaction): Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGb,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAIrB,KAAK,wBAAwB,GAAG,GAAG,CAAC;AAEpC,qBAAa,qBACX,YAAW,aAAa,CAAC,mBAAmB,CAAC;IAE7C,OAAO,CAAC,QAAQ,CAA2B;gBAE/B,QAAQ,EAAE,wBAAwB;IAIxC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9B,aAAa,CAAC,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAU9D"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/signer-starknet",
|
|
3
|
-
"version": "0.1.15-next.
|
|
3
|
+
"version": "0.1.15-next.1",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
7
|
"typings": "dist/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
@@ -11,33 +11,14 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"dev": "tsdx watch",
|
|
14
|
-
"build": "
|
|
15
|
-
"
|
|
16
|
-
"lint": "tsdx lint",
|
|
17
|
-
"size": "size-limit",
|
|
18
|
-
"analyze": "size-limit --why"
|
|
14
|
+
"build": "node ../../scripts/build/command.mjs --path signers/signer-starknet",
|
|
15
|
+
"clean": "rimraf dist"
|
|
19
16
|
},
|
|
20
17
|
"husky": {
|
|
21
18
|
"hooks": {
|
|
22
19
|
"pre-commit": "tsdx lint"
|
|
23
20
|
}
|
|
24
21
|
},
|
|
25
|
-
"prettier": {
|
|
26
|
-
"printWidth": 80,
|
|
27
|
-
"semi": true,
|
|
28
|
-
"singleQuote": true,
|
|
29
|
-
"trailingComma": "es5"
|
|
30
|
-
},
|
|
31
|
-
"size-limit": [
|
|
32
|
-
{
|
|
33
|
-
"path": "dist/signer-starknet.cjs.production.min.js",
|
|
34
|
-
"limit": "10 KB"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"path": "dist/signer-starknet.esm.js",
|
|
38
|
-
"limit": "10 KB"
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
22
|
"dependencies": {
|
|
42
23
|
"rango-types": "^0.1.32"
|
|
43
24
|
},
|
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var rangoTypes = require('rango-types');
|
|
6
|
-
|
|
7
|
-
function _regeneratorRuntime() {
|
|
8
|
-
_regeneratorRuntime = function () {
|
|
9
|
-
return exports;
|
|
10
|
-
};
|
|
11
|
-
var exports = {},
|
|
12
|
-
Op = Object.prototype,
|
|
13
|
-
hasOwn = Op.hasOwnProperty,
|
|
14
|
-
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
15
|
-
obj[key] = desc.value;
|
|
16
|
-
},
|
|
17
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
18
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
19
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
20
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
21
|
-
function define(obj, key, value) {
|
|
22
|
-
return Object.defineProperty(obj, key, {
|
|
23
|
-
value: value,
|
|
24
|
-
enumerable: !0,
|
|
25
|
-
configurable: !0,
|
|
26
|
-
writable: !0
|
|
27
|
-
}), obj[key];
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
define({}, "");
|
|
31
|
-
} catch (err) {
|
|
32
|
-
define = function (obj, key, value) {
|
|
33
|
-
return obj[key] = value;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
37
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
38
|
-
generator = Object.create(protoGenerator.prototype),
|
|
39
|
-
context = new Context(tryLocsList || []);
|
|
40
|
-
return defineProperty(generator, "_invoke", {
|
|
41
|
-
value: makeInvokeMethod(innerFn, self, context)
|
|
42
|
-
}), generator;
|
|
43
|
-
}
|
|
44
|
-
function tryCatch(fn, obj, arg) {
|
|
45
|
-
try {
|
|
46
|
-
return {
|
|
47
|
-
type: "normal",
|
|
48
|
-
arg: fn.call(obj, arg)
|
|
49
|
-
};
|
|
50
|
-
} catch (err) {
|
|
51
|
-
return {
|
|
52
|
-
type: "throw",
|
|
53
|
-
arg: err
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.wrap = wrap;
|
|
58
|
-
var ContinueSentinel = {};
|
|
59
|
-
function Generator() {}
|
|
60
|
-
function GeneratorFunction() {}
|
|
61
|
-
function GeneratorFunctionPrototype() {}
|
|
62
|
-
var IteratorPrototype = {};
|
|
63
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
64
|
-
return this;
|
|
65
|
-
});
|
|
66
|
-
var getProto = Object.getPrototypeOf,
|
|
67
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
68
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
69
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
70
|
-
function defineIteratorMethods(prototype) {
|
|
71
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
72
|
-
define(prototype, method, function (arg) {
|
|
73
|
-
return this._invoke(method, arg);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
78
|
-
function invoke(method, arg, resolve, reject) {
|
|
79
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
80
|
-
if ("throw" !== record.type) {
|
|
81
|
-
var result = record.arg,
|
|
82
|
-
value = result.value;
|
|
83
|
-
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
84
|
-
invoke("next", value, resolve, reject);
|
|
85
|
-
}, function (err) {
|
|
86
|
-
invoke("throw", err, resolve, reject);
|
|
87
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
88
|
-
result.value = unwrapped, resolve(result);
|
|
89
|
-
}, function (error) {
|
|
90
|
-
return invoke("throw", error, resolve, reject);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
reject(record.arg);
|
|
94
|
-
}
|
|
95
|
-
var previousPromise;
|
|
96
|
-
defineProperty(this, "_invoke", {
|
|
97
|
-
value: function (method, arg) {
|
|
98
|
-
function callInvokeWithMethodAndArg() {
|
|
99
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
100
|
-
invoke(method, arg, resolve, reject);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
108
|
-
var state = "suspendedStart";
|
|
109
|
-
return function (method, arg) {
|
|
110
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
111
|
-
if ("completed" === state) {
|
|
112
|
-
if ("throw" === method) throw arg;
|
|
113
|
-
return doneResult();
|
|
114
|
-
}
|
|
115
|
-
for (context.method = method, context.arg = arg;;) {
|
|
116
|
-
var delegate = context.delegate;
|
|
117
|
-
if (delegate) {
|
|
118
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
119
|
-
if (delegateResult) {
|
|
120
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
121
|
-
return delegateResult;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
125
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
126
|
-
context.dispatchException(context.arg);
|
|
127
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
128
|
-
state = "executing";
|
|
129
|
-
var record = tryCatch(innerFn, self, context);
|
|
130
|
-
if ("normal" === record.type) {
|
|
131
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
132
|
-
return {
|
|
133
|
-
value: record.arg,
|
|
134
|
-
done: context.done
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
142
|
-
var methodName = context.method,
|
|
143
|
-
method = delegate.iterator[methodName];
|
|
144
|
-
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;
|
|
145
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
146
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
147
|
-
var info = record.arg;
|
|
148
|
-
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);
|
|
149
|
-
}
|
|
150
|
-
function pushTryEntry(locs) {
|
|
151
|
-
var entry = {
|
|
152
|
-
tryLoc: locs[0]
|
|
153
|
-
};
|
|
154
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
155
|
-
}
|
|
156
|
-
function resetTryEntry(entry) {
|
|
157
|
-
var record = entry.completion || {};
|
|
158
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
159
|
-
}
|
|
160
|
-
function Context(tryLocsList) {
|
|
161
|
-
this.tryEntries = [{
|
|
162
|
-
tryLoc: "root"
|
|
163
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
164
|
-
}
|
|
165
|
-
function values(iterable) {
|
|
166
|
-
if (iterable) {
|
|
167
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
168
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
169
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
170
|
-
if (!isNaN(iterable.length)) {
|
|
171
|
-
var i = -1,
|
|
172
|
-
next = function next() {
|
|
173
|
-
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
174
|
-
return next.value = undefined, next.done = !0, next;
|
|
175
|
-
};
|
|
176
|
-
return next.next = next;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return {
|
|
180
|
-
next: doneResult
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
function doneResult() {
|
|
184
|
-
return {
|
|
185
|
-
value: undefined,
|
|
186
|
-
done: !0
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
190
|
-
value: GeneratorFunctionPrototype,
|
|
191
|
-
configurable: !0
|
|
192
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
193
|
-
value: GeneratorFunction,
|
|
194
|
-
configurable: !0
|
|
195
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
196
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
197
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
198
|
-
}, exports.mark = function (genFun) {
|
|
199
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
200
|
-
}, exports.awrap = function (arg) {
|
|
201
|
-
return {
|
|
202
|
-
__await: arg
|
|
203
|
-
};
|
|
204
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
205
|
-
return this;
|
|
206
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
207
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
208
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
209
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
210
|
-
return result.done ? result.value : iter.next();
|
|
211
|
-
});
|
|
212
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
213
|
-
return this;
|
|
214
|
-
}), define(Gp, "toString", function () {
|
|
215
|
-
return "[object Generator]";
|
|
216
|
-
}), exports.keys = function (val) {
|
|
217
|
-
var object = Object(val),
|
|
218
|
-
keys = [];
|
|
219
|
-
for (var key in object) keys.push(key);
|
|
220
|
-
return keys.reverse(), function next() {
|
|
221
|
-
for (; keys.length;) {
|
|
222
|
-
var key = keys.pop();
|
|
223
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
224
|
-
}
|
|
225
|
-
return next.done = !0, next;
|
|
226
|
-
};
|
|
227
|
-
}, exports.values = values, Context.prototype = {
|
|
228
|
-
constructor: Context,
|
|
229
|
-
reset: function (skipTempReset) {
|
|
230
|
-
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);
|
|
231
|
-
},
|
|
232
|
-
stop: function () {
|
|
233
|
-
this.done = !0;
|
|
234
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
235
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
236
|
-
return this.rval;
|
|
237
|
-
},
|
|
238
|
-
dispatchException: function (exception) {
|
|
239
|
-
if (this.done) throw exception;
|
|
240
|
-
var context = this;
|
|
241
|
-
function handle(loc, caught) {
|
|
242
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
243
|
-
}
|
|
244
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
245
|
-
var entry = this.tryEntries[i],
|
|
246
|
-
record = entry.completion;
|
|
247
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
248
|
-
if (entry.tryLoc <= this.prev) {
|
|
249
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
250
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
251
|
-
if (hasCatch && hasFinally) {
|
|
252
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
253
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
254
|
-
} else if (hasCatch) {
|
|
255
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
256
|
-
} else {
|
|
257
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
258
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
abrupt: function (type, arg) {
|
|
264
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
265
|
-
var entry = this.tryEntries[i];
|
|
266
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
267
|
-
var finallyEntry = entry;
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
272
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
273
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
274
|
-
},
|
|
275
|
-
complete: function (record, afterLoc) {
|
|
276
|
-
if ("throw" === record.type) throw record.arg;
|
|
277
|
-
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;
|
|
278
|
-
},
|
|
279
|
-
finish: function (finallyLoc) {
|
|
280
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
281
|
-
var entry = this.tryEntries[i];
|
|
282
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
catch: function (tryLoc) {
|
|
286
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
287
|
-
var entry = this.tryEntries[i];
|
|
288
|
-
if (entry.tryLoc === tryLoc) {
|
|
289
|
-
var record = entry.completion;
|
|
290
|
-
if ("throw" === record.type) {
|
|
291
|
-
var thrown = record.arg;
|
|
292
|
-
resetTryEntry(entry);
|
|
293
|
-
}
|
|
294
|
-
return thrown;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
throw new Error("illegal catch attempt");
|
|
298
|
-
},
|
|
299
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
300
|
-
return this.delegate = {
|
|
301
|
-
iterator: values(iterable),
|
|
302
|
-
resultName: resultName,
|
|
303
|
-
nextLoc: nextLoc
|
|
304
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
305
|
-
}
|
|
306
|
-
}, exports;
|
|
307
|
-
}
|
|
308
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
309
|
-
try {
|
|
310
|
-
var info = gen[key](arg);
|
|
311
|
-
var value = info.value;
|
|
312
|
-
} catch (error) {
|
|
313
|
-
reject(error);
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
if (info.done) {
|
|
317
|
-
resolve(value);
|
|
318
|
-
} else {
|
|
319
|
-
Promise.resolve(value).then(_next, _throw);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
function _asyncToGenerator(fn) {
|
|
323
|
-
return function () {
|
|
324
|
-
var self = this,
|
|
325
|
-
args = arguments;
|
|
326
|
-
return new Promise(function (resolve, reject) {
|
|
327
|
-
var gen = fn.apply(self, args);
|
|
328
|
-
function _next(value) {
|
|
329
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
330
|
-
}
|
|
331
|
-
function _throw(err) {
|
|
332
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
333
|
-
}
|
|
334
|
-
_next(undefined);
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
var DefaultStarknetSigner = /*#__PURE__*/function () {
|
|
340
|
-
function DefaultStarknetSigner(provider) {
|
|
341
|
-
this.provider = provider;
|
|
342
|
-
}
|
|
343
|
-
var _proto = DefaultStarknetSigner.prototype;
|
|
344
|
-
_proto.signMessage = /*#__PURE__*/function () {
|
|
345
|
-
var _signMessage = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
346
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
347
|
-
while (1) switch (_context.prev = _context.next) {
|
|
348
|
-
case 0:
|
|
349
|
-
throw rangoTypes.SignerError.UnimplementedError('signMessage');
|
|
350
|
-
case 1:
|
|
351
|
-
case "end":
|
|
352
|
-
return _context.stop();
|
|
353
|
-
}
|
|
354
|
-
}, _callee);
|
|
355
|
-
}));
|
|
356
|
-
function signMessage() {
|
|
357
|
-
return _signMessage.apply(this, arguments);
|
|
358
|
-
}
|
|
359
|
-
return signMessage;
|
|
360
|
-
}();
|
|
361
|
-
_proto.signAndSendTx = /*#__PURE__*/function () {
|
|
362
|
-
var _signAndSendTx = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(tx) {
|
|
363
|
-
var _yield$this$provider$, transaction_hash;
|
|
364
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
365
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
366
|
-
case 0:
|
|
367
|
-
_context2.prev = 0;
|
|
368
|
-
_context2.next = 3;
|
|
369
|
-
return this.provider.account.execute(tx.calls);
|
|
370
|
-
case 3:
|
|
371
|
-
_yield$this$provider$ = _context2.sent;
|
|
372
|
-
transaction_hash = _yield$this$provider$.transaction_hash;
|
|
373
|
-
return _context2.abrupt("return", transaction_hash);
|
|
374
|
-
case 8:
|
|
375
|
-
_context2.prev = 8;
|
|
376
|
-
_context2.t0 = _context2["catch"](0);
|
|
377
|
-
throw new rangoTypes.SignerError(rangoTypes.SignerErrorCode.SEND_TX_ERROR, undefined, _context2.t0);
|
|
378
|
-
case 11:
|
|
379
|
-
case "end":
|
|
380
|
-
return _context2.stop();
|
|
381
|
-
}
|
|
382
|
-
}, _callee2, this, [[0, 8]]);
|
|
383
|
-
}));
|
|
384
|
-
function signAndSendTx(_x) {
|
|
385
|
-
return _signAndSendTx.apply(this, arguments);
|
|
386
|
-
}
|
|
387
|
-
return signAndSendTx;
|
|
388
|
-
}();
|
|
389
|
-
return DefaultStarknetSigner;
|
|
390
|
-
}();
|
|
391
|
-
|
|
392
|
-
exports.DefaultStarknetSigner = DefaultStarknetSigner;
|
|
393
|
-
//# sourceMappingURL=signer-starknet.cjs.development.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signer-starknet.cjs.development.js","sources":["../src/signer.ts"],"sourcesContent":["import {\n GenericSigner,\n SignerError,\n SignerErrorCode,\n StarknetTransaction,\n} from 'rango-types';\n\n// TODO - replace with real type\n// tslint:disable-next-line: no-any\ntype StarknetExternalProvider = any;\n\nexport class DefaultStarknetSigner\n implements GenericSigner<StarknetTransaction>\n{\n private provider: StarknetExternalProvider;\n\n constructor(provider: StarknetExternalProvider) {\n this.provider = provider;\n }\n\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: StarknetTransaction): Promise<string> {\n try {\n const { transaction_hash } = await this.provider.account.execute(\n tx.calls\n );\n return transaction_hash;\n } catch (error) {\n throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, error);\n }\n }\n}\n"],"names":["DefaultStarknetSigner","provider","_proto","prototype","signMessage","_signMessage","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_callee$","_context","prev","next","SignerError","UnimplementedError","stop","apply","arguments","signAndSendTx","_signAndSendTx","_callee2","tx","_yield$this$provider$","transaction_hash","_callee2$","_context2","account","execute","calls","sent","abrupt","t0","SignerErrorCode","SEND_TX_ERROR","undefined","_x"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWaA,qBAAqB;EAKhC,SAAAA,sBAAYC,QAAkC;IAC5C,IAAI,CAACA,QAAQ,GAAGA,QAAQ;;EACzB,IAAAC,MAAA,GAAAF,qBAAA,CAAAG,SAAA;EAAAD,MAAA,CAEKE,WAAW;IAAA,IAAAC,YAAA,gBAAAC,iBAAA,eAAAC,mBAAA,GAAAC,IAAA,CAAjB,SAAAC;MAAA,OAAAF,mBAAA,GAAAG,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,MACQC,sBAAW,CAACC,kBAAkB,CAAC,aAAa,CAAC;UAAA;UAAA;YAAA,OAAAJ,QAAA,CAAAK,IAAA;;SAAAR,OAAA;KACpD;IAAA,SAAAL;MAAA,OAAAC,YAAA,CAAAa,KAAA,OAAAC,SAAA;;IAAA,OAAAf,WAAA;;EAAAF,MAAA,CAEKkB,aAAa;IAAA,IAAAC,cAAA,gBAAAf,iBAAA,eAAAC,mBAAA,GAAAC,IAAA,CAAnB,SAAAc,SAAoBC,EAAuB;MAAA,IAAAC,qBAAA,EAAAC,gBAAA;MAAA,OAAAlB,mBAAA,GAAAG,IAAA,UAAAgB,UAAAC,SAAA;QAAA,kBAAAA,SAAA,CAAAd,IAAA,GAAAc,SAAA,CAAAb,IAAA;UAAA;YAAAa,SAAA,CAAAd,IAAA;YAAAc,SAAA,CAAAb,IAAA;YAAA,OAEJ,IAAI,CAACb,QAAQ,CAAC2B,OAAO,CAACC,OAAO,CAC9DN,EAAE,CAACO,KAAK,CACT;UAAA;YAAAN,qBAAA,GAAAG,SAAA,CAAAI,IAAA;YAFON,gBAAgB,GAAAD,qBAAA,CAAhBC,gBAAgB;YAAA,OAAAE,SAAA,CAAAK,MAAA,WAGjBP,gBAAgB;UAAA;YAAAE,SAAA,CAAAd,IAAA;YAAAc,SAAA,CAAAM,EAAA,GAAAN,SAAA;YAAA,MAEjB,IAAIZ,sBAAW,CAACmB,0BAAe,CAACC,aAAa,EAAEC,SAAS,EAAAT,SAAA,CAAAM,EAAA,CAAQ;UAAA;UAAA;YAAA,OAAAN,SAAA,CAAAV,IAAA;;SAAAK,QAAA;KAEzE;IAAA,SAAAF,cAAAiB,EAAA;MAAA,OAAAhB,cAAA,CAAAH,KAAA,OAAAC,SAAA;;IAAA,OAAAC,aAAA;;EAAA,OAAApB,qBAAA;AAAA;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("rango-types");function r(){r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{s({},"")}catch(t){s=function(t,r,e){return t[r]=e}}function f(t,r,e,n){var i=Object.create((r&&r.prototype instanceof p?r:p).prototype),a=new j(n||[]);return o(i,"_invoke",{value:L(t,e,a)}),i}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var l={};function p(){}function v(){}function d(){}var y={};s(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(S([])));m&&m!==e&&n.call(m,a)&&(y=m);var w=d.prototype=p.prototype=Object.create(y);function x(t){["next","throw","return"].forEach((function(r){s(t,r,(function(t){return this._invoke(r,t)}))}))}function E(t,r){var e;o(this,"_invoke",{value:function(o,i){function a(){return new r((function(e,a){!function e(o,i,a,c){var u=h(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}(o,i,e,a)}))}return e=e?e.then(a,a):a()}})}function L(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=b(a,e);if(c){if(c===l)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=h(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}function b(t,r){var e=r.method,n=t.iterator[e];if(void 0===n)return r.delegate=null,"throw"===e&&t.iterator.return&&(r.method="return",r.arg=void 0,b(t,r),"throw"===r.method)||"return"!==e&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+e+"' method")),l;var o=h(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,l;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,l):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,l)}function _(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function O(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function S(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,o=function r(){for(;++e<t.length;)if(n.call(t,e))return r.value=t[e],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:k}}function k(){return{value:void 0,done:!0}}return v.prototype=d,o(w,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},x(E.prototype),s(E.prototype,c,(function(){return this})),t.AsyncIterator=E,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new E(f(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(w),s(w,u,"Generator"),s(w,a,(function(){return this})),s(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=S,j.prototype={constructor:j,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(O),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=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 r=this;function e(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,r){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&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:S(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),l}},t}function e(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function n(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))}}exports.DefaultStarknetSigner=function(){function e(t){this.provider=t}var o=e.prototype;return o.signMessage=function(){var e=n(r().mark((function e(){return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:throw t.SignerError.UnimplementedError("signMessage");case 1:case"end":return r.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),o.signAndSendTx=function(){var e=n(r().mark((function e(n){return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.provider.account.execute(n.calls);case 3:return r.abrupt("return",r.sent.transaction_hash);case 8:throw r.prev=8,r.t0=r.catch(0),new t.SignerError(t.SignerErrorCode.SEND_TX_ERROR,void 0,r.t0);case 11:case"end":return r.stop()}}),e,this,[[0,8]])})));return function(t){return e.apply(this,arguments)}}(),e}();
|
|
2
|
-
//# sourceMappingURL=signer-starknet.cjs.production.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signer-starknet.cjs.production.min.js","sources":["../src/signer.ts"],"sourcesContent":["import {\n GenericSigner,\n SignerError,\n SignerErrorCode,\n StarknetTransaction,\n} from 'rango-types';\n\n// TODO - replace with real type\n// tslint:disable-next-line: no-any\ntype StarknetExternalProvider = any;\n\nexport class DefaultStarknetSigner\n implements GenericSigner<StarknetTransaction>\n{\n private provider: StarknetExternalProvider;\n\n constructor(provider: StarknetExternalProvider) {\n this.provider = provider;\n }\n\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: StarknetTransaction): Promise<string> {\n try {\n const { transaction_hash } = await this.provider.account.execute(\n tx.calls\n );\n return transaction_hash;\n } catch (error) {\n throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, error);\n }\n }\n}\n"],"names":["DefaultStarknetSigner","provider","this","_proto","prototype","signMessage","_signMessage","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","next","SignerError","UnimplementedError","stop","apply","arguments","signAndSendTx","_signAndSendTx","_callee2","tx","_context2","account","execute","calls","abrupt","sent","transaction_hash","t0","SignerErrorCode","SEND_TX_ERROR","undefined","_x"],"mappings":"64NAgBE,SAAAA,EAAYC,GACVC,KAAKD,SAAWA,EACjB,IAAAE,EAAAH,EAAAI,UAeA,OAfAD,EAEKE,uBAAW,IAAAC,EAAAC,EAAAC,IAAAC,MAAjB,SAAAC,IAAA,OAAAF,IAAAG,eAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,OAAA,MACQC,cAAYC,mBAAmB,eAAc,OAAA,UAAA,OAAAJ,EAAAK,UAAAP,OACpD,OAAA,WAAA,OAAAJ,EAAAY,WAAAC,eAAAhB,EAEKiB,yBAAa,IAAAC,EAAAd,EAAAC,IAAAC,MAAnB,SAAAa,EAAoBC,GAAuB,OAAAf,IAAAG,eAAAa,GAAA,cAAAA,EAAAX,KAAAW,EAAAV,MAAA,OAAA,OAAAU,EAAAX,OAAAW,EAAAV,OAEJZ,KAAKD,SAASwB,QAAQC,QACvDH,EAAGI,OACJ,OAFuB,OAAAH,EAAAI,gBAEvBJ,EAAAK,KAFOC,kBAGe,OAAA,MAAAN,EAAAX,OAAAW,EAAAO,GAAAP,WAEjB,IAAIT,cAAYiB,kBAAgBC,mBAAeC,EAASV,EAAAO,IAAQ,QAAA,UAAA,OAAAP,EAAAP,UAAAK,oBAEzE,OAAA,SAAAa,GAAA,OAAAd,EAAAH,WAAAC,eAAAnB"}
|
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
import { SignerError, SignerErrorCode } from 'rango-types';
|
|
2
|
-
|
|
3
|
-
function _regeneratorRuntime() {
|
|
4
|
-
_regeneratorRuntime = function () {
|
|
5
|
-
return exports;
|
|
6
|
-
};
|
|
7
|
-
var exports = {},
|
|
8
|
-
Op = Object.prototype,
|
|
9
|
-
hasOwn = Op.hasOwnProperty,
|
|
10
|
-
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
11
|
-
obj[key] = desc.value;
|
|
12
|
-
},
|
|
13
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
14
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
15
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
16
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
17
|
-
function define(obj, key, value) {
|
|
18
|
-
return Object.defineProperty(obj, key, {
|
|
19
|
-
value: value,
|
|
20
|
-
enumerable: !0,
|
|
21
|
-
configurable: !0,
|
|
22
|
-
writable: !0
|
|
23
|
-
}), obj[key];
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
26
|
-
define({}, "");
|
|
27
|
-
} catch (err) {
|
|
28
|
-
define = function (obj, key, value) {
|
|
29
|
-
return obj[key] = value;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
33
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
34
|
-
generator = Object.create(protoGenerator.prototype),
|
|
35
|
-
context = new Context(tryLocsList || []);
|
|
36
|
-
return defineProperty(generator, "_invoke", {
|
|
37
|
-
value: makeInvokeMethod(innerFn, self, context)
|
|
38
|
-
}), generator;
|
|
39
|
-
}
|
|
40
|
-
function tryCatch(fn, obj, arg) {
|
|
41
|
-
try {
|
|
42
|
-
return {
|
|
43
|
-
type: "normal",
|
|
44
|
-
arg: fn.call(obj, arg)
|
|
45
|
-
};
|
|
46
|
-
} catch (err) {
|
|
47
|
-
return {
|
|
48
|
-
type: "throw",
|
|
49
|
-
arg: err
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.wrap = wrap;
|
|
54
|
-
var ContinueSentinel = {};
|
|
55
|
-
function Generator() {}
|
|
56
|
-
function GeneratorFunction() {}
|
|
57
|
-
function GeneratorFunctionPrototype() {}
|
|
58
|
-
var IteratorPrototype = {};
|
|
59
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
60
|
-
return this;
|
|
61
|
-
});
|
|
62
|
-
var getProto = Object.getPrototypeOf,
|
|
63
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
64
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
65
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
66
|
-
function defineIteratorMethods(prototype) {
|
|
67
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
68
|
-
define(prototype, method, function (arg) {
|
|
69
|
-
return this._invoke(method, arg);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
74
|
-
function invoke(method, arg, resolve, reject) {
|
|
75
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
76
|
-
if ("throw" !== record.type) {
|
|
77
|
-
var result = record.arg,
|
|
78
|
-
value = result.value;
|
|
79
|
-
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
80
|
-
invoke("next", value, resolve, reject);
|
|
81
|
-
}, function (err) {
|
|
82
|
-
invoke("throw", err, resolve, reject);
|
|
83
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
84
|
-
result.value = unwrapped, resolve(result);
|
|
85
|
-
}, function (error) {
|
|
86
|
-
return invoke("throw", error, resolve, reject);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
reject(record.arg);
|
|
90
|
-
}
|
|
91
|
-
var previousPromise;
|
|
92
|
-
defineProperty(this, "_invoke", {
|
|
93
|
-
value: function (method, arg) {
|
|
94
|
-
function callInvokeWithMethodAndArg() {
|
|
95
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
96
|
-
invoke(method, arg, resolve, reject);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
104
|
-
var state = "suspendedStart";
|
|
105
|
-
return function (method, arg) {
|
|
106
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
107
|
-
if ("completed" === state) {
|
|
108
|
-
if ("throw" === method) throw arg;
|
|
109
|
-
return doneResult();
|
|
110
|
-
}
|
|
111
|
-
for (context.method = method, context.arg = arg;;) {
|
|
112
|
-
var delegate = context.delegate;
|
|
113
|
-
if (delegate) {
|
|
114
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
115
|
-
if (delegateResult) {
|
|
116
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
117
|
-
return delegateResult;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
121
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
122
|
-
context.dispatchException(context.arg);
|
|
123
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
124
|
-
state = "executing";
|
|
125
|
-
var record = tryCatch(innerFn, self, context);
|
|
126
|
-
if ("normal" === record.type) {
|
|
127
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
128
|
-
return {
|
|
129
|
-
value: record.arg,
|
|
130
|
-
done: context.done
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
138
|
-
var methodName = context.method,
|
|
139
|
-
method = delegate.iterator[methodName];
|
|
140
|
-
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;
|
|
141
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
142
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
143
|
-
var info = record.arg;
|
|
144
|
-
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);
|
|
145
|
-
}
|
|
146
|
-
function pushTryEntry(locs) {
|
|
147
|
-
var entry = {
|
|
148
|
-
tryLoc: locs[0]
|
|
149
|
-
};
|
|
150
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
151
|
-
}
|
|
152
|
-
function resetTryEntry(entry) {
|
|
153
|
-
var record = entry.completion || {};
|
|
154
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
155
|
-
}
|
|
156
|
-
function Context(tryLocsList) {
|
|
157
|
-
this.tryEntries = [{
|
|
158
|
-
tryLoc: "root"
|
|
159
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
160
|
-
}
|
|
161
|
-
function values(iterable) {
|
|
162
|
-
if (iterable) {
|
|
163
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
164
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
165
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
166
|
-
if (!isNaN(iterable.length)) {
|
|
167
|
-
var i = -1,
|
|
168
|
-
next = function next() {
|
|
169
|
-
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
170
|
-
return next.value = undefined, next.done = !0, next;
|
|
171
|
-
};
|
|
172
|
-
return next.next = next;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return {
|
|
176
|
-
next: doneResult
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function doneResult() {
|
|
180
|
-
return {
|
|
181
|
-
value: undefined,
|
|
182
|
-
done: !0
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
186
|
-
value: GeneratorFunctionPrototype,
|
|
187
|
-
configurable: !0
|
|
188
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
189
|
-
value: GeneratorFunction,
|
|
190
|
-
configurable: !0
|
|
191
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
192
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
193
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
194
|
-
}, exports.mark = function (genFun) {
|
|
195
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
196
|
-
}, exports.awrap = function (arg) {
|
|
197
|
-
return {
|
|
198
|
-
__await: arg
|
|
199
|
-
};
|
|
200
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
201
|
-
return this;
|
|
202
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
203
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
204
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
205
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
206
|
-
return result.done ? result.value : iter.next();
|
|
207
|
-
});
|
|
208
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
209
|
-
return this;
|
|
210
|
-
}), define(Gp, "toString", function () {
|
|
211
|
-
return "[object Generator]";
|
|
212
|
-
}), exports.keys = function (val) {
|
|
213
|
-
var object = Object(val),
|
|
214
|
-
keys = [];
|
|
215
|
-
for (var key in object) keys.push(key);
|
|
216
|
-
return keys.reverse(), function next() {
|
|
217
|
-
for (; keys.length;) {
|
|
218
|
-
var key = keys.pop();
|
|
219
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
220
|
-
}
|
|
221
|
-
return next.done = !0, next;
|
|
222
|
-
};
|
|
223
|
-
}, exports.values = values, Context.prototype = {
|
|
224
|
-
constructor: Context,
|
|
225
|
-
reset: function (skipTempReset) {
|
|
226
|
-
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);
|
|
227
|
-
},
|
|
228
|
-
stop: function () {
|
|
229
|
-
this.done = !0;
|
|
230
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
231
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
232
|
-
return this.rval;
|
|
233
|
-
},
|
|
234
|
-
dispatchException: function (exception) {
|
|
235
|
-
if (this.done) throw exception;
|
|
236
|
-
var context = this;
|
|
237
|
-
function handle(loc, caught) {
|
|
238
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
239
|
-
}
|
|
240
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
241
|
-
var entry = this.tryEntries[i],
|
|
242
|
-
record = entry.completion;
|
|
243
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
244
|
-
if (entry.tryLoc <= this.prev) {
|
|
245
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
246
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
247
|
-
if (hasCatch && hasFinally) {
|
|
248
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
249
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
250
|
-
} else if (hasCatch) {
|
|
251
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
252
|
-
} else {
|
|
253
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
254
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
abrupt: function (type, arg) {
|
|
260
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
261
|
-
var entry = this.tryEntries[i];
|
|
262
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
263
|
-
var finallyEntry = entry;
|
|
264
|
-
break;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
268
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
269
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
270
|
-
},
|
|
271
|
-
complete: function (record, afterLoc) {
|
|
272
|
-
if ("throw" === record.type) throw record.arg;
|
|
273
|
-
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;
|
|
274
|
-
},
|
|
275
|
-
finish: function (finallyLoc) {
|
|
276
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
277
|
-
var entry = this.tryEntries[i];
|
|
278
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
catch: function (tryLoc) {
|
|
282
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
283
|
-
var entry = this.tryEntries[i];
|
|
284
|
-
if (entry.tryLoc === tryLoc) {
|
|
285
|
-
var record = entry.completion;
|
|
286
|
-
if ("throw" === record.type) {
|
|
287
|
-
var thrown = record.arg;
|
|
288
|
-
resetTryEntry(entry);
|
|
289
|
-
}
|
|
290
|
-
return thrown;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
throw new Error("illegal catch attempt");
|
|
294
|
-
},
|
|
295
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
296
|
-
return this.delegate = {
|
|
297
|
-
iterator: values(iterable),
|
|
298
|
-
resultName: resultName,
|
|
299
|
-
nextLoc: nextLoc
|
|
300
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
301
|
-
}
|
|
302
|
-
}, exports;
|
|
303
|
-
}
|
|
304
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
305
|
-
try {
|
|
306
|
-
var info = gen[key](arg);
|
|
307
|
-
var value = info.value;
|
|
308
|
-
} catch (error) {
|
|
309
|
-
reject(error);
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
if (info.done) {
|
|
313
|
-
resolve(value);
|
|
314
|
-
} else {
|
|
315
|
-
Promise.resolve(value).then(_next, _throw);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
function _asyncToGenerator(fn) {
|
|
319
|
-
return function () {
|
|
320
|
-
var self = this,
|
|
321
|
-
args = arguments;
|
|
322
|
-
return new Promise(function (resolve, reject) {
|
|
323
|
-
var gen = fn.apply(self, args);
|
|
324
|
-
function _next(value) {
|
|
325
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
326
|
-
}
|
|
327
|
-
function _throw(err) {
|
|
328
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
329
|
-
}
|
|
330
|
-
_next(undefined);
|
|
331
|
-
});
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
var DefaultStarknetSigner = /*#__PURE__*/function () {
|
|
336
|
-
function DefaultStarknetSigner(provider) {
|
|
337
|
-
this.provider = provider;
|
|
338
|
-
}
|
|
339
|
-
var _proto = DefaultStarknetSigner.prototype;
|
|
340
|
-
_proto.signMessage = /*#__PURE__*/function () {
|
|
341
|
-
var _signMessage = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
342
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
343
|
-
while (1) switch (_context.prev = _context.next) {
|
|
344
|
-
case 0:
|
|
345
|
-
throw SignerError.UnimplementedError('signMessage');
|
|
346
|
-
case 1:
|
|
347
|
-
case "end":
|
|
348
|
-
return _context.stop();
|
|
349
|
-
}
|
|
350
|
-
}, _callee);
|
|
351
|
-
}));
|
|
352
|
-
function signMessage() {
|
|
353
|
-
return _signMessage.apply(this, arguments);
|
|
354
|
-
}
|
|
355
|
-
return signMessage;
|
|
356
|
-
}();
|
|
357
|
-
_proto.signAndSendTx = /*#__PURE__*/function () {
|
|
358
|
-
var _signAndSendTx = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(tx) {
|
|
359
|
-
var _yield$this$provider$, transaction_hash;
|
|
360
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
361
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
362
|
-
case 0:
|
|
363
|
-
_context2.prev = 0;
|
|
364
|
-
_context2.next = 3;
|
|
365
|
-
return this.provider.account.execute(tx.calls);
|
|
366
|
-
case 3:
|
|
367
|
-
_yield$this$provider$ = _context2.sent;
|
|
368
|
-
transaction_hash = _yield$this$provider$.transaction_hash;
|
|
369
|
-
return _context2.abrupt("return", transaction_hash);
|
|
370
|
-
case 8:
|
|
371
|
-
_context2.prev = 8;
|
|
372
|
-
_context2.t0 = _context2["catch"](0);
|
|
373
|
-
throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, _context2.t0);
|
|
374
|
-
case 11:
|
|
375
|
-
case "end":
|
|
376
|
-
return _context2.stop();
|
|
377
|
-
}
|
|
378
|
-
}, _callee2, this, [[0, 8]]);
|
|
379
|
-
}));
|
|
380
|
-
function signAndSendTx(_x) {
|
|
381
|
-
return _signAndSendTx.apply(this, arguments);
|
|
382
|
-
}
|
|
383
|
-
return signAndSendTx;
|
|
384
|
-
}();
|
|
385
|
-
return DefaultStarknetSigner;
|
|
386
|
-
}();
|
|
387
|
-
|
|
388
|
-
export { DefaultStarknetSigner };
|
|
389
|
-
//# sourceMappingURL=signer-starknet.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signer-starknet.esm.js","sources":["../src/signer.ts"],"sourcesContent":["import {\n GenericSigner,\n SignerError,\n SignerErrorCode,\n StarknetTransaction,\n} from 'rango-types';\n\n// TODO - replace with real type\n// tslint:disable-next-line: no-any\ntype StarknetExternalProvider = any;\n\nexport class DefaultStarknetSigner\n implements GenericSigner<StarknetTransaction>\n{\n private provider: StarknetExternalProvider;\n\n constructor(provider: StarknetExternalProvider) {\n this.provider = provider;\n }\n\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: StarknetTransaction): Promise<string> {\n try {\n const { transaction_hash } = await this.provider.account.execute(\n tx.calls\n );\n return transaction_hash;\n } catch (error) {\n throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, error);\n }\n }\n}\n"],"names":["DefaultStarknetSigner","provider","_proto","prototype","signMessage","_signMessage","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_callee$","_context","prev","next","SignerError","UnimplementedError","stop","apply","arguments","signAndSendTx","_signAndSendTx","_callee2","tx","_yield$this$provider$","transaction_hash","_callee2$","_context2","account","execute","calls","sent","abrupt","t0","SignerErrorCode","SEND_TX_ERROR","undefined","_x"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWaA,qBAAqB;EAKhC,SAAAA,sBAAYC,QAAkC;IAC5C,IAAI,CAACA,QAAQ,GAAGA,QAAQ;;EACzB,IAAAC,MAAA,GAAAF,qBAAA,CAAAG,SAAA;EAAAD,MAAA,CAEKE,WAAW;IAAA,IAAAC,YAAA,gBAAAC,iBAAA,eAAAC,mBAAA,GAAAC,IAAA,CAAjB,SAAAC;MAAA,OAAAF,mBAAA,GAAAG,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,MACQC,WAAW,CAACC,kBAAkB,CAAC,aAAa,CAAC;UAAA;UAAA;YAAA,OAAAJ,QAAA,CAAAK,IAAA;;SAAAR,OAAA;KACpD;IAAA,SAAAL;MAAA,OAAAC,YAAA,CAAAa,KAAA,OAAAC,SAAA;;IAAA,OAAAf,WAAA;;EAAAF,MAAA,CAEKkB,aAAa;IAAA,IAAAC,cAAA,gBAAAf,iBAAA,eAAAC,mBAAA,GAAAC,IAAA,CAAnB,SAAAc,SAAoBC,EAAuB;MAAA,IAAAC,qBAAA,EAAAC,gBAAA;MAAA,OAAAlB,mBAAA,GAAAG,IAAA,UAAAgB,UAAAC,SAAA;QAAA,kBAAAA,SAAA,CAAAd,IAAA,GAAAc,SAAA,CAAAb,IAAA;UAAA;YAAAa,SAAA,CAAAd,IAAA;YAAAc,SAAA,CAAAb,IAAA;YAAA,OAEJ,IAAI,CAACb,QAAQ,CAAC2B,OAAO,CAACC,OAAO,CAC9DN,EAAE,CAACO,KAAK,CACT;UAAA;YAAAN,qBAAA,GAAAG,SAAA,CAAAI,IAAA;YAFON,gBAAgB,GAAAD,qBAAA,CAAhBC,gBAAgB;YAAA,OAAAE,SAAA,CAAAK,MAAA,WAGjBP,gBAAgB;UAAA;YAAAE,SAAA,CAAAd,IAAA;YAAAc,SAAA,CAAAM,EAAA,GAAAN,SAAA;YAAA,MAEjB,IAAIZ,WAAW,CAACmB,eAAe,CAACC,aAAa,EAAEC,SAAS,EAAAT,SAAA,CAAAM,EAAA,CAAQ;UAAA;UAAA;YAAA,OAAAN,SAAA,CAAAV,IAAA;;SAAAK,QAAA;KAEzE;IAAA,SAAAF,cAAAiB,EAAA;MAAA,OAAAhB,cAAA,CAAAH,KAAA,OAAAC,SAAA;;IAAA,OAAAC,aAAA;;EAAA,OAAApB,qBAAA;AAAA;;;;"}
|