@velora-dex/sdk 9.5.3-dev.1 → 9.5.3
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/README.md +2 -2
- package/dist/examples/wagmi.d.ts.map +1 -1
- package/dist/methods/delta/helpers/orders.d.ts.map +1 -1
- package/dist/methods/delta/helpers/types.d.ts.map +1 -1
- package/dist/sdk.cjs.development.js +239 -386
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +239 -386
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +17 -9
- package/src/examples/wagmi.ts +2 -2
- package/src/index.js +13 -1
- package/src/methods/delta/helpers/orders.ts +9 -101
- package/src/methods/delta/helpers/types.ts +2 -1
|
@@ -6,6 +6,9 @@ var core = require('@paraswap/core');
|
|
|
6
6
|
var tsEssentials = require('ts-essentials');
|
|
7
7
|
var utils = require('viem/utils');
|
|
8
8
|
|
|
9
|
+
function _OverloadYield(e, d) {
|
|
10
|
+
this.v = e, this.k = d;
|
|
11
|
+
}
|
|
9
12
|
function _assertThisInitialized(e) {
|
|
10
13
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
11
14
|
return e;
|
|
@@ -78,311 +81,183 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
78
81
|
if (null == r) return {};
|
|
79
82
|
var t = {};
|
|
80
83
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
81
|
-
if (e.
|
|
84
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
82
85
|
t[n] = r[n];
|
|
83
86
|
}
|
|
84
87
|
return t;
|
|
85
88
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
89
|
+
function _regenerator() {
|
|
90
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
91
|
+
var e,
|
|
92
|
+
t,
|
|
93
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
94
|
+
n = r.iterator || "@@iterator",
|
|
95
|
+
o = r.toStringTag || "@@toStringTag";
|
|
96
|
+
function i(r, n, o, i) {
|
|
97
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
98
|
+
u = Object.create(c.prototype);
|
|
99
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
100
|
+
var i,
|
|
101
|
+
c,
|
|
102
|
+
u,
|
|
103
|
+
f = 0,
|
|
104
|
+
p = o || [],
|
|
105
|
+
y = !1,
|
|
106
|
+
G = {
|
|
107
|
+
p: 0,
|
|
108
|
+
n: 0,
|
|
109
|
+
v: e,
|
|
110
|
+
a: d,
|
|
111
|
+
f: d.bind(e, 4),
|
|
112
|
+
d: function (t, r) {
|
|
113
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
function d(r, n) {
|
|
117
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
118
|
+
var o,
|
|
119
|
+
i = p[t],
|
|
120
|
+
d = G.p,
|
|
121
|
+
l = i[2];
|
|
122
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
123
|
+
}
|
|
124
|
+
if (o || r > 1) return a;
|
|
125
|
+
throw y = !0, n;
|
|
126
|
+
}
|
|
127
|
+
return function (o, p, l) {
|
|
128
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
129
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
130
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
131
|
+
try {
|
|
132
|
+
if (f = 2, i) {
|
|
133
|
+
if (c || (o = "next"), t = i[o]) {
|
|
134
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
135
|
+
if (!t.done) return t;
|
|
136
|
+
u = t.value, c < 2 && (c = 0);
|
|
137
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
138
|
+
i = e;
|
|
139
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
140
|
+
} catch (t) {
|
|
141
|
+
i = e, c = 1, u = t;
|
|
142
|
+
} finally {
|
|
143
|
+
f = 1;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
value: t,
|
|
148
|
+
done: y
|
|
149
|
+
};
|
|
134
150
|
};
|
|
135
|
-
}
|
|
151
|
+
}(r, o, i), !0), u;
|
|
136
152
|
}
|
|
137
|
-
|
|
138
|
-
var h = "suspendedStart",
|
|
139
|
-
l = "suspendedYield",
|
|
140
|
-
f = "executing",
|
|
141
|
-
s = "completed",
|
|
142
|
-
y = {};
|
|
153
|
+
var a = {};
|
|
143
154
|
function Generator() {}
|
|
144
155
|
function GeneratorFunction() {}
|
|
145
156
|
function GeneratorFunctionPrototype() {}
|
|
146
|
-
|
|
147
|
-
|
|
157
|
+
t = Object.getPrototypeOf;
|
|
158
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
159
|
+
return this;
|
|
160
|
+
}), t),
|
|
161
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
162
|
+
function f(e) {
|
|
163
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
164
|
+
}
|
|
165
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
148
166
|
return this;
|
|
167
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
168
|
+
return "[object Generator]";
|
|
169
|
+
}), (_regenerator = function () {
|
|
170
|
+
return {
|
|
171
|
+
w: i,
|
|
172
|
+
m: f
|
|
173
|
+
};
|
|
174
|
+
})();
|
|
175
|
+
}
|
|
176
|
+
function _regeneratorAsync(n, e, r, t, o) {
|
|
177
|
+
var a = _regeneratorAsyncGen(n, e, r, t, o);
|
|
178
|
+
return a.next().then(function (n) {
|
|
179
|
+
return n.done ? n.value : a.next();
|
|
149
180
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
181
|
+
}
|
|
182
|
+
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
183
|
+
return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise);
|
|
184
|
+
}
|
|
185
|
+
function _regeneratorAsyncIterator(t, e) {
|
|
186
|
+
function n(r, o, i, f) {
|
|
187
|
+
try {
|
|
188
|
+
var c = t[r](o),
|
|
189
|
+
u = c.value;
|
|
190
|
+
return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
191
|
+
n("next", t, i, f);
|
|
192
|
+
}, function (t) {
|
|
193
|
+
n("throw", t, i, f);
|
|
194
|
+
}) : e.resolve(u).then(function (t) {
|
|
195
|
+
c.value = t, i(c);
|
|
196
|
+
}, function (t) {
|
|
197
|
+
return n("throw", t, i, f);
|
|
158
198
|
});
|
|
159
|
-
})
|
|
199
|
+
} catch (t) {
|
|
200
|
+
f(t);
|
|
201
|
+
}
|
|
160
202
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}, function (t) {
|
|
170
|
-
invoke("throw", t, i, a);
|
|
171
|
-
}) : e.resolve(h).then(function (t) {
|
|
172
|
-
u.value = t, i(u);
|
|
173
|
-
}, function (t) {
|
|
174
|
-
return invoke("throw", t, i, a);
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
a(c.arg);
|
|
203
|
+
var r;
|
|
204
|
+
this.next || (_regeneratorDefine(_regeneratorAsyncIterator.prototype), _regeneratorDefine(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
205
|
+
return this;
|
|
206
|
+
})), _regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
207
|
+
function f() {
|
|
208
|
+
return new e(function (e, r) {
|
|
209
|
+
n(t, i, e, r);
|
|
210
|
+
});
|
|
178
211
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
});
|
|
212
|
+
return r = r ? r.then(f, f) : f();
|
|
213
|
+
}, !0);
|
|
214
|
+
}
|
|
215
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
216
|
+
var i = Object.defineProperty;
|
|
217
|
+
try {
|
|
218
|
+
i({}, "", {});
|
|
219
|
+
} catch (e) {
|
|
220
|
+
i = 0;
|
|
190
221
|
}
|
|
191
|
-
function
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
222
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
223
|
+
function o(r, n) {
|
|
224
|
+
_regeneratorDefine(e, r, function (e) {
|
|
225
|
+
return this._invoke(r, n, e);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
r ? i ? i(e, r, {
|
|
229
|
+
value: n,
|
|
230
|
+
enumerable: !t,
|
|
231
|
+
configurable: !t,
|
|
232
|
+
writable: !t
|
|
233
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
234
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
235
|
+
}
|
|
236
|
+
function _regeneratorKeys(e) {
|
|
237
|
+
var n = Object(e),
|
|
238
|
+
r = [];
|
|
239
|
+
for (var t in n) r.unshift(t);
|
|
240
|
+
return function e() {
|
|
241
|
+
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
|
|
242
|
+
return e.done = !0, e;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function _regeneratorValues(e) {
|
|
246
|
+
if (null != e) {
|
|
247
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
248
|
+
r = 0;
|
|
249
|
+
if (t) return t.call(e);
|
|
250
|
+
if ("function" == typeof e.next) return e;
|
|
251
|
+
if (!isNaN(e.length)) return {
|
|
252
|
+
next: function () {
|
|
253
|
+
return e && r >= e.length && (e = void 0), {
|
|
254
|
+
value: e && e[r++],
|
|
255
|
+
done: !e
|
|
200
256
|
};
|
|
201
257
|
}
|
|
202
|
-
for (n.method = i, n.arg = a;;) {
|
|
203
|
-
var c = n.delegate;
|
|
204
|
-
if (c) {
|
|
205
|
-
var u = maybeInvokeDelegate(c, n);
|
|
206
|
-
if (u) {
|
|
207
|
-
if (u === y) continue;
|
|
208
|
-
return u;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
212
|
-
if (o === h) throw o = s, n.arg;
|
|
213
|
-
n.dispatchException(n.arg);
|
|
214
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
215
|
-
o = f;
|
|
216
|
-
var p = tryCatch(e, r, n);
|
|
217
|
-
if ("normal" === p.type) {
|
|
218
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
219
|
-
return {
|
|
220
|
-
value: p.arg,
|
|
221
|
-
done: n.done
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
function maybeInvokeDelegate(e, r) {
|
|
229
|
-
var n = r.method,
|
|
230
|
-
o = e.iterator[n];
|
|
231
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
232
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
233
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
234
|
-
var a = i.arg;
|
|
235
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
236
|
-
}
|
|
237
|
-
function pushTryEntry(t) {
|
|
238
|
-
var e = {
|
|
239
|
-
tryLoc: t[0]
|
|
240
258
|
};
|
|
241
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
242
259
|
}
|
|
243
|
-
|
|
244
|
-
var e = t.completion || {};
|
|
245
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
246
|
-
}
|
|
247
|
-
function Context(t) {
|
|
248
|
-
this.tryEntries = [{
|
|
249
|
-
tryLoc: "root"
|
|
250
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
251
|
-
}
|
|
252
|
-
function values(e) {
|
|
253
|
-
if (e || "" === e) {
|
|
254
|
-
var r = e[a];
|
|
255
|
-
if (r) return r.call(e);
|
|
256
|
-
if ("function" == typeof e.next) return e;
|
|
257
|
-
if (!isNaN(e.length)) {
|
|
258
|
-
var o = -1,
|
|
259
|
-
i = function next() {
|
|
260
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
261
|
-
return next.value = t, next.done = !0, next;
|
|
262
|
-
};
|
|
263
|
-
return i.next = i;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
267
|
-
}
|
|
268
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
269
|
-
value: GeneratorFunctionPrototype,
|
|
270
|
-
configurable: !0
|
|
271
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
272
|
-
value: GeneratorFunction,
|
|
273
|
-
configurable: !0
|
|
274
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
275
|
-
var e = "function" == typeof t && t.constructor;
|
|
276
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
277
|
-
}, e.mark = function (t) {
|
|
278
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
279
|
-
}, e.awrap = function (t) {
|
|
280
|
-
return {
|
|
281
|
-
__await: t
|
|
282
|
-
};
|
|
283
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
284
|
-
return this;
|
|
285
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
286
|
-
void 0 === i && (i = Promise);
|
|
287
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
288
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
289
|
-
return t.done ? t.value : a.next();
|
|
290
|
-
});
|
|
291
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
292
|
-
return this;
|
|
293
|
-
}), define(g, "toString", function () {
|
|
294
|
-
return "[object Generator]";
|
|
295
|
-
}), e.keys = function (t) {
|
|
296
|
-
var e = Object(t),
|
|
297
|
-
r = [];
|
|
298
|
-
for (var n in e) r.push(n);
|
|
299
|
-
return r.reverse(), function next() {
|
|
300
|
-
for (; r.length;) {
|
|
301
|
-
var t = r.pop();
|
|
302
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
303
|
-
}
|
|
304
|
-
return next.done = !0, next;
|
|
305
|
-
};
|
|
306
|
-
}, e.values = values, Context.prototype = {
|
|
307
|
-
constructor: Context,
|
|
308
|
-
reset: function (e) {
|
|
309
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
310
|
-
},
|
|
311
|
-
stop: function () {
|
|
312
|
-
this.done = !0;
|
|
313
|
-
var t = this.tryEntries[0].completion;
|
|
314
|
-
if ("throw" === t.type) throw t.arg;
|
|
315
|
-
return this.rval;
|
|
316
|
-
},
|
|
317
|
-
dispatchException: function (e) {
|
|
318
|
-
if (this.done) throw e;
|
|
319
|
-
var r = this;
|
|
320
|
-
function handle(n, o) {
|
|
321
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
322
|
-
}
|
|
323
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
324
|
-
var i = this.tryEntries[o],
|
|
325
|
-
a = i.completion;
|
|
326
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
327
|
-
if (i.tryLoc <= this.prev) {
|
|
328
|
-
var c = n.call(i, "catchLoc"),
|
|
329
|
-
u = n.call(i, "finallyLoc");
|
|
330
|
-
if (c && u) {
|
|
331
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
332
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
333
|
-
} else if (c) {
|
|
334
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
335
|
-
} else {
|
|
336
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
337
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
},
|
|
342
|
-
abrupt: function (t, e) {
|
|
343
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
344
|
-
var o = this.tryEntries[r];
|
|
345
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
346
|
-
var i = o;
|
|
347
|
-
break;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
351
|
-
var a = i ? i.completion : {};
|
|
352
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
353
|
-
},
|
|
354
|
-
complete: function (t, e) {
|
|
355
|
-
if ("throw" === t.type) throw t.arg;
|
|
356
|
-
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), y;
|
|
357
|
-
},
|
|
358
|
-
finish: function (t) {
|
|
359
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
360
|
-
var r = this.tryEntries[e];
|
|
361
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
catch: function (t) {
|
|
365
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
366
|
-
var r = this.tryEntries[e];
|
|
367
|
-
if (r.tryLoc === t) {
|
|
368
|
-
var n = r.completion;
|
|
369
|
-
if ("throw" === n.type) {
|
|
370
|
-
var o = n.arg;
|
|
371
|
-
resetTryEntry(r);
|
|
372
|
-
}
|
|
373
|
-
return o;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
throw Error("illegal catch attempt");
|
|
377
|
-
},
|
|
378
|
-
delegateYield: function (e, r, n) {
|
|
379
|
-
return this.delegate = {
|
|
380
|
-
iterator: values(e),
|
|
381
|
-
resultName: r,
|
|
382
|
-
nextLoc: n
|
|
383
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
384
|
-
}
|
|
385
|
-
}, e;
|
|
260
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
386
261
|
}
|
|
387
262
|
function _setPrototypeOf(t, e) {
|
|
388
263
|
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
@@ -411,6 +286,74 @@ function _wrapNativeSuper(t) {
|
|
|
411
286
|
}), _setPrototypeOf(Wrapper, t);
|
|
412
287
|
}, _wrapNativeSuper(t);
|
|
413
288
|
}
|
|
289
|
+
function _regeneratorRuntime() {
|
|
290
|
+
|
|
291
|
+
var r = _regenerator(),
|
|
292
|
+
e = r.m(_regeneratorRuntime),
|
|
293
|
+
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
294
|
+
function n(r) {
|
|
295
|
+
var e = "function" == typeof r && r.constructor;
|
|
296
|
+
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
297
|
+
}
|
|
298
|
+
var o = {
|
|
299
|
+
throw: 1,
|
|
300
|
+
return: 2,
|
|
301
|
+
break: 3,
|
|
302
|
+
continue: 3
|
|
303
|
+
};
|
|
304
|
+
function a(r) {
|
|
305
|
+
var e, t;
|
|
306
|
+
return function (n) {
|
|
307
|
+
e || (e = {
|
|
308
|
+
stop: function () {
|
|
309
|
+
return t(n.a, 2);
|
|
310
|
+
},
|
|
311
|
+
catch: function () {
|
|
312
|
+
return n.v;
|
|
313
|
+
},
|
|
314
|
+
abrupt: function (r, e) {
|
|
315
|
+
return t(n.a, o[r], e);
|
|
316
|
+
},
|
|
317
|
+
delegateYield: function (r, o, a) {
|
|
318
|
+
return e.resultName = o, t(n.d, _regeneratorValues(r), a);
|
|
319
|
+
},
|
|
320
|
+
finish: function (r) {
|
|
321
|
+
return t(n.f, r);
|
|
322
|
+
}
|
|
323
|
+
}, t = function (r, t, o) {
|
|
324
|
+
n.p = e.prev, n.n = e.next;
|
|
325
|
+
try {
|
|
326
|
+
return r(t, o);
|
|
327
|
+
} finally {
|
|
328
|
+
e.next = n.n;
|
|
329
|
+
}
|
|
330
|
+
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
331
|
+
try {
|
|
332
|
+
return r.call(this, e);
|
|
333
|
+
} finally {
|
|
334
|
+
n.p = e.prev, n.n = e.next;
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
return (_regeneratorRuntime = function () {
|
|
339
|
+
return {
|
|
340
|
+
wrap: function (e, t, n, o) {
|
|
341
|
+
return r.w(a(e), t, n, o && o.reverse());
|
|
342
|
+
},
|
|
343
|
+
isGeneratorFunction: n,
|
|
344
|
+
mark: r.m,
|
|
345
|
+
awrap: function (r, e) {
|
|
346
|
+
return new _OverloadYield(r, e);
|
|
347
|
+
},
|
|
348
|
+
AsyncIterator: _regeneratorAsyncIterator,
|
|
349
|
+
async: function (r, e, t, o, u) {
|
|
350
|
+
return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u);
|
|
351
|
+
},
|
|
352
|
+
keys: _regeneratorKeys,
|
|
353
|
+
values: _regeneratorValues
|
|
354
|
+
};
|
|
355
|
+
})();
|
|
356
|
+
}
|
|
414
357
|
|
|
415
358
|
var API_URL = 'https://api.paraswap.io';
|
|
416
359
|
var DEFAULT_VERSION = '6.2';
|
|
@@ -856,7 +799,7 @@ var constructGetBalances = function constructGetBalances(_ref) {
|
|
|
856
799
|
}
|
|
857
800
|
}, _callee4);
|
|
858
801
|
}));
|
|
859
|
-
return function getAllowance(_x9,
|
|
802
|
+
return function getAllowance(_x9, _x0, _x1) {
|
|
860
803
|
return _ref6.apply(this, arguments);
|
|
861
804
|
};
|
|
862
805
|
}();
|
|
@@ -1722,7 +1665,7 @@ function encodeEIP_2612PermitFunctionInput(_ref) {
|
|
|
1722
1665
|
return val.slice(2);
|
|
1723
1666
|
}) // Remove "0x" prefix from each encoded value
|
|
1724
1667
|
.join('') // Concatenate the values
|
|
1725
|
-
|
|
1668
|
+
;
|
|
1726
1669
|
}
|
|
1727
1670
|
// encoding params for DAIlike.permit() function
|
|
1728
1671
|
function encodeDAIlikePermitFunctionInput(_ref2) {
|
|
@@ -1749,7 +1692,7 @@ function encodeDAIlikePermitFunctionInput(_ref2) {
|
|
|
1749
1692
|
return val.slice(2);
|
|
1750
1693
|
}) // Remove "0x" prefix from each encoded value
|
|
1751
1694
|
.join('') // Concatenate the values
|
|
1752
|
-
|
|
1695
|
+
;
|
|
1753
1696
|
}
|
|
1754
1697
|
// encode an address (20 bytes) into 32 bytes
|
|
1755
1698
|
function encodeAddress(address) {
|
|
@@ -6073,7 +6016,7 @@ var constructDeltaTokenModule = function constructDeltaTokenModule(options) {
|
|
|
6073
6016
|
}
|
|
6074
6017
|
}, _callee4);
|
|
6075
6018
|
}));
|
|
6076
|
-
return function depositNativeAndPreSignDeltaOrder(
|
|
6019
|
+
return function depositNativeAndPreSignDeltaOrder(_x0, _x1, _x10) {
|
|
6077
6020
|
return _ref7.apply(this, arguments);
|
|
6078
6021
|
};
|
|
6079
6022
|
}();
|
|
@@ -6113,7 +6056,7 @@ var constructDeltaTokenModule = function constructDeltaTokenModule(options) {
|
|
|
6113
6056
|
}
|
|
6114
6057
|
}, _callee5);
|
|
6115
6058
|
}));
|
|
6116
|
-
return function cancelTWAPAndWithdrawDeltaOrder(
|
|
6059
|
+
return function cancelTWAPAndWithdrawDeltaOrder(_x11, _x12, _x13) {
|
|
6117
6060
|
return _ref8.apply(this, arguments);
|
|
6118
6061
|
};
|
|
6119
6062
|
}();
|
|
@@ -6153,7 +6096,7 @@ var constructDeltaTokenModule = function constructDeltaTokenModule(options) {
|
|
|
6153
6096
|
}
|
|
6154
6097
|
}, _callee6);
|
|
6155
6098
|
}));
|
|
6156
|
-
return function cancelTWAPBuyAndWithdrawDeltaOrder(
|
|
6099
|
+
return function cancelTWAPBuyAndWithdrawDeltaOrder(_x14, _x15, _x16) {
|
|
6157
6100
|
return _ref9.apply(this, arguments);
|
|
6158
6101
|
};
|
|
6159
6102
|
}();
|
|
@@ -7064,6 +7007,7 @@ function getAuctionAmounts(auction) {
|
|
|
7064
7007
|
}
|
|
7065
7008
|
var expected = {
|
|
7066
7009
|
srcAmount: auction.order.srcAmount,
|
|
7010
|
+
// defensive fallback in case Order shape changes or legacy Orders don't have all fields
|
|
7067
7011
|
destAmount: auction.order.expectedAmount || auction.order.destAmount
|
|
7068
7012
|
};
|
|
7069
7013
|
var order = auction.order;
|
|
@@ -7095,7 +7039,7 @@ function isOrderCrosschain(order
|
|
|
7095
7039
|
}
|
|
7096
7040
|
function scaleByFactor(amount, scalingFactor) {
|
|
7097
7041
|
if (!amount) return 0n;
|
|
7098
|
-
if (scalingFactor ===
|
|
7042
|
+
if (scalingFactor === 0) return amount;
|
|
7099
7043
|
var base = 10n;
|
|
7100
7044
|
return scalingFactor < 0 ? amount / base ** BigInt(-scalingFactor) : amount * base ** BigInt(scalingFactor);
|
|
7101
7045
|
}
|
|
@@ -7159,107 +7103,16 @@ function isPartiallyExecutedAuction(auction) {
|
|
|
7159
7103
|
* @description Calculates filled percentage from auction transaction filled bps values.
|
|
7160
7104
|
*/
|
|
7161
7105
|
function getFilledPercent(auction) {
|
|
7162
|
-
var
|
|
7106
|
+
var completeTransactions = !isOrderCrosschain(auction.order) ? auction.transactions : auction.transactions.filter(function (transaction) {
|
|
7163
7107
|
return transaction.bridgeStatus === 'filled';
|
|
7164
7108
|
});
|
|
7165
|
-
var filledPercentBps =
|
|
7109
|
+
var filledPercentBps = completeTransactions.reduce(function (acc, _ref3) {
|
|
7166
7110
|
var filledPercent = _ref3.filledPercent;
|
|
7167
7111
|
return acc + filledPercent;
|
|
7168
7112
|
}, 0);
|
|
7169
7113
|
var filledPercent = filledPercentBps / 100;
|
|
7170
7114
|
return filledPercent;
|
|
7171
7115
|
}
|
|
7172
|
-
///// TESTS //////
|
|
7173
|
-
// @TODO remove
|
|
7174
|
-
var auction = {};
|
|
7175
|
-
var minAuction = {
|
|
7176
|
-
onChainOrderType: 'TWAPOrder',
|
|
7177
|
-
gas: 6
|
|
7178
|
-
};
|
|
7179
|
-
if (isTWAPAuction(minAuction)) {
|
|
7180
|
-
console.log('🚀 ~ auction:', minAuction);
|
|
7181
|
-
/**
|
|
7182
|
-
* {
|
|
7183
|
-
onChainOrderType: OnChainOrderType;
|
|
7184
|
-
gas: number;
|
|
7185
|
-
} & {
|
|
7186
|
-
onChainOrderType: "TWAPOrder" | "TWAPBuyOrder";
|
|
7187
|
-
}
|
|
7188
|
-
*/
|
|
7189
|
-
}
|
|
7190
|
-
if (isTWAPAuction(auction)) {
|
|
7191
|
-
console.log('🚀 ~ auction:', auction);
|
|
7192
|
-
/**
|
|
7193
|
-
(DeltaAuctionBase & {
|
|
7194
|
-
onChainOrderType: "TWAPOrder";
|
|
7195
|
-
order: TWAPDeltaOrder;
|
|
7196
|
-
}) | (DeltaAuctionBase & {
|
|
7197
|
-
onChainOrderType: "TWAPBuyOrder";
|
|
7198
|
-
order: TWAPBuyDeltaOrder;
|
|
7199
|
-
})
|
|
7200
|
-
*/
|
|
7201
|
-
}
|
|
7202
|
-
if (isTWAPSellAuction(auction)) {
|
|
7203
|
-
console.log('🚀 ~ auction:', auction);
|
|
7204
|
-
/**
|
|
7205
|
-
* DeltaAuctionBase & {
|
|
7206
|
-
onChainOrderType: "TWAPOrder";
|
|
7207
|
-
order: TWAPDeltaOrder;
|
|
7208
|
-
}
|
|
7209
|
-
*/
|
|
7210
|
-
}
|
|
7211
|
-
if (isTWAPBuyAuction(auction)) {
|
|
7212
|
-
console.log('🚀 ~ auction:', auction);
|
|
7213
|
-
/**
|
|
7214
|
-
* DeltaAuctionBase & {
|
|
7215
|
-
onChainOrderType: "TWAPBuyOrder";
|
|
7216
|
-
order: TWAPBuyDeltaOrder;
|
|
7217
|
-
}
|
|
7218
|
-
*/
|
|
7219
|
-
}
|
|
7220
|
-
if (isDeltaAuction(auction)) {
|
|
7221
|
-
console.log('🚀 ~ auction:', auction);
|
|
7222
|
-
/**
|
|
7223
|
-
* DeltaAuctionBase & {
|
|
7224
|
-
onChainOrderType: "Order";
|
|
7225
|
-
order: DeltaAuctionOrder;
|
|
7226
|
-
}
|
|
7227
|
-
*/
|
|
7228
|
-
}
|
|
7229
|
-
if (isExternalAuction(auction)) {
|
|
7230
|
-
console.log('🚀 ~ auction:', auction);
|
|
7231
|
-
/**
|
|
7232
|
-
* DeltaAuctionBase & {
|
|
7233
|
-
onChainOrderType: "ExternalOrder";
|
|
7234
|
-
order: ExternalDeltaOrder;
|
|
7235
|
-
}
|
|
7236
|
-
*/
|
|
7237
|
-
}
|
|
7238
|
-
// ------------------------------------------------------------ //
|
|
7239
|
-
var orderAny = {};
|
|
7240
|
-
if (isOrderCrosschain(orderAny)) {
|
|
7241
|
-
console.log('🚀 ~ order:', orderAny);
|
|
7242
|
-
/**
|
|
7243
|
-
DeltaAuctionOrder | TWAPDeltaOrder | TWAPBuyDeltaOrder
|
|
7244
|
-
*/
|
|
7245
|
-
}
|
|
7246
|
-
var orderExternal = {};
|
|
7247
|
-
if (isOrderCrosschain(orderExternal)) {
|
|
7248
|
-
console.log('🚀 ~ order:', orderExternal);
|
|
7249
|
-
/**
|
|
7250
|
-
never
|
|
7251
|
-
*/
|
|
7252
|
-
}
|
|
7253
|
-
var orderLike = {};
|
|
7254
|
-
if (isOrderCrosschain(orderLike)) {
|
|
7255
|
-
console.log('🚀 ~ order:', orderLike);
|
|
7256
|
-
/**
|
|
7257
|
-
* {
|
|
7258
|
-
bridge: Bridge;
|
|
7259
|
-
a: 2;
|
|
7260
|
-
}
|
|
7261
|
-
*/
|
|
7262
|
-
}
|
|
7263
7116
|
|
|
7264
7117
|
Object.defineProperty(exports, 'ContractMethod', {
|
|
7265
7118
|
enumerable: true,
|