@velora-dex/sdk 9.5.3-dev.0 → 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 +240 -387
- 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 +240 -387
- 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
package/dist/sdk.esm.js
CHANGED
|
@@ -3,6 +3,9 @@ export { ContractMethod, ContractMethodV5, ContractMethodV6, SwapSide } from '@p
|
|
|
3
3
|
import { assert } from 'ts-essentials';
|
|
4
4
|
import { hashTypedData } from 'viem/utils';
|
|
5
5
|
|
|
6
|
+
function _OverloadYield(e, d) {
|
|
7
|
+
this.v = e, this.k = d;
|
|
8
|
+
}
|
|
6
9
|
function _assertThisInitialized(e) {
|
|
7
10
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
8
11
|
return e;
|
|
@@ -75,311 +78,183 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
75
78
|
if (null == r) return {};
|
|
76
79
|
var t = {};
|
|
77
80
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
78
|
-
if (e.
|
|
81
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
79
82
|
t[n] = r[n];
|
|
80
83
|
}
|
|
81
84
|
return t;
|
|
82
85
|
}
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
86
|
+
function _regenerator() {
|
|
87
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
88
|
+
var e,
|
|
89
|
+
t,
|
|
90
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
91
|
+
n = r.iterator || "@@iterator",
|
|
92
|
+
o = r.toStringTag || "@@toStringTag";
|
|
93
|
+
function i(r, n, o, i) {
|
|
94
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
95
|
+
u = Object.create(c.prototype);
|
|
96
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
97
|
+
var i,
|
|
98
|
+
c,
|
|
99
|
+
u,
|
|
100
|
+
f = 0,
|
|
101
|
+
p = o || [],
|
|
102
|
+
y = !1,
|
|
103
|
+
G = {
|
|
104
|
+
p: 0,
|
|
105
|
+
n: 0,
|
|
106
|
+
v: e,
|
|
107
|
+
a: d,
|
|
108
|
+
f: d.bind(e, 4),
|
|
109
|
+
d: function (t, r) {
|
|
110
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
function d(r, n) {
|
|
114
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
115
|
+
var o,
|
|
116
|
+
i = p[t],
|
|
117
|
+
d = G.p,
|
|
118
|
+
l = i[2];
|
|
119
|
+
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));
|
|
120
|
+
}
|
|
121
|
+
if (o || r > 1) return a;
|
|
122
|
+
throw y = !0, n;
|
|
123
|
+
}
|
|
124
|
+
return function (o, p, l) {
|
|
125
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
126
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
127
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
128
|
+
try {
|
|
129
|
+
if (f = 2, i) {
|
|
130
|
+
if (c || (o = "next"), t = i[o]) {
|
|
131
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
132
|
+
if (!t.done) return t;
|
|
133
|
+
u = t.value, c < 2 && (c = 0);
|
|
134
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
135
|
+
i = e;
|
|
136
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
137
|
+
} catch (t) {
|
|
138
|
+
i = e, c = 1, u = t;
|
|
139
|
+
} finally {
|
|
140
|
+
f = 1;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
value: t,
|
|
145
|
+
done: y
|
|
146
|
+
};
|
|
131
147
|
};
|
|
132
|
-
}
|
|
148
|
+
}(r, o, i), !0), u;
|
|
133
149
|
}
|
|
134
|
-
|
|
135
|
-
var h = "suspendedStart",
|
|
136
|
-
l = "suspendedYield",
|
|
137
|
-
f = "executing",
|
|
138
|
-
s = "completed",
|
|
139
|
-
y = {};
|
|
150
|
+
var a = {};
|
|
140
151
|
function Generator() {}
|
|
141
152
|
function GeneratorFunction() {}
|
|
142
153
|
function GeneratorFunctionPrototype() {}
|
|
143
|
-
|
|
144
|
-
|
|
154
|
+
t = Object.getPrototypeOf;
|
|
155
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
156
|
+
return this;
|
|
157
|
+
}), t),
|
|
158
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
159
|
+
function f(e) {
|
|
160
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
161
|
+
}
|
|
162
|
+
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 () {
|
|
145
163
|
return this;
|
|
164
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
165
|
+
return "[object Generator]";
|
|
166
|
+
}), (_regenerator = function () {
|
|
167
|
+
return {
|
|
168
|
+
w: i,
|
|
169
|
+
m: f
|
|
170
|
+
};
|
|
171
|
+
})();
|
|
172
|
+
}
|
|
173
|
+
function _regeneratorAsync(n, e, r, t, o) {
|
|
174
|
+
var a = _regeneratorAsyncGen(n, e, r, t, o);
|
|
175
|
+
return a.next().then(function (n) {
|
|
176
|
+
return n.done ? n.value : a.next();
|
|
146
177
|
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
178
|
+
}
|
|
179
|
+
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
180
|
+
return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise);
|
|
181
|
+
}
|
|
182
|
+
function _regeneratorAsyncIterator(t, e) {
|
|
183
|
+
function n(r, o, i, f) {
|
|
184
|
+
try {
|
|
185
|
+
var c = t[r](o),
|
|
186
|
+
u = c.value;
|
|
187
|
+
return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
188
|
+
n("next", t, i, f);
|
|
189
|
+
}, function (t) {
|
|
190
|
+
n("throw", t, i, f);
|
|
191
|
+
}) : e.resolve(u).then(function (t) {
|
|
192
|
+
c.value = t, i(c);
|
|
193
|
+
}, function (t) {
|
|
194
|
+
return n("throw", t, i, f);
|
|
155
195
|
});
|
|
156
|
-
})
|
|
196
|
+
} catch (t) {
|
|
197
|
+
f(t);
|
|
198
|
+
}
|
|
157
199
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}, function (t) {
|
|
167
|
-
invoke("throw", t, i, a);
|
|
168
|
-
}) : e.resolve(h).then(function (t) {
|
|
169
|
-
u.value = t, i(u);
|
|
170
|
-
}, function (t) {
|
|
171
|
-
return invoke("throw", t, i, a);
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
a(c.arg);
|
|
200
|
+
var r;
|
|
201
|
+
this.next || (_regeneratorDefine(_regeneratorAsyncIterator.prototype), _regeneratorDefine(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
202
|
+
return this;
|
|
203
|
+
})), _regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
204
|
+
function f() {
|
|
205
|
+
return new e(function (e, r) {
|
|
206
|
+
n(t, i, e, r);
|
|
207
|
+
});
|
|
175
208
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
});
|
|
209
|
+
return r = r ? r.then(f, f) : f();
|
|
210
|
+
}, !0);
|
|
211
|
+
}
|
|
212
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
213
|
+
var i = Object.defineProperty;
|
|
214
|
+
try {
|
|
215
|
+
i({}, "", {});
|
|
216
|
+
} catch (e) {
|
|
217
|
+
i = 0;
|
|
187
218
|
}
|
|
188
|
-
function
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
219
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
220
|
+
function o(r, n) {
|
|
221
|
+
_regeneratorDefine(e, r, function (e) {
|
|
222
|
+
return this._invoke(r, n, e);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
r ? i ? i(e, r, {
|
|
226
|
+
value: n,
|
|
227
|
+
enumerable: !t,
|
|
228
|
+
configurable: !t,
|
|
229
|
+
writable: !t
|
|
230
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
231
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
232
|
+
}
|
|
233
|
+
function _regeneratorKeys(e) {
|
|
234
|
+
var n = Object(e),
|
|
235
|
+
r = [];
|
|
236
|
+
for (var t in n) r.unshift(t);
|
|
237
|
+
return function e() {
|
|
238
|
+
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
|
|
239
|
+
return e.done = !0, e;
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function _regeneratorValues(e) {
|
|
243
|
+
if (null != e) {
|
|
244
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
245
|
+
r = 0;
|
|
246
|
+
if (t) return t.call(e);
|
|
247
|
+
if ("function" == typeof e.next) return e;
|
|
248
|
+
if (!isNaN(e.length)) return {
|
|
249
|
+
next: function () {
|
|
250
|
+
return e && r >= e.length && (e = void 0), {
|
|
251
|
+
value: e && e[r++],
|
|
252
|
+
done: !e
|
|
197
253
|
};
|
|
198
254
|
}
|
|
199
|
-
for (n.method = i, n.arg = a;;) {
|
|
200
|
-
var c = n.delegate;
|
|
201
|
-
if (c) {
|
|
202
|
-
var u = maybeInvokeDelegate(c, n);
|
|
203
|
-
if (u) {
|
|
204
|
-
if (u === y) continue;
|
|
205
|
-
return u;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
209
|
-
if (o === h) throw o = s, n.arg;
|
|
210
|
-
n.dispatchException(n.arg);
|
|
211
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
212
|
-
o = f;
|
|
213
|
-
var p = tryCatch(e, r, n);
|
|
214
|
-
if ("normal" === p.type) {
|
|
215
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
216
|
-
return {
|
|
217
|
-
value: p.arg,
|
|
218
|
-
done: n.done
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
function maybeInvokeDelegate(e, r) {
|
|
226
|
-
var n = r.method,
|
|
227
|
-
o = e.iterator[n];
|
|
228
|
-
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;
|
|
229
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
230
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
231
|
-
var a = i.arg;
|
|
232
|
-
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);
|
|
233
|
-
}
|
|
234
|
-
function pushTryEntry(t) {
|
|
235
|
-
var e = {
|
|
236
|
-
tryLoc: t[0]
|
|
237
255
|
};
|
|
238
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
239
256
|
}
|
|
240
|
-
|
|
241
|
-
var e = t.completion || {};
|
|
242
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
243
|
-
}
|
|
244
|
-
function Context(t) {
|
|
245
|
-
this.tryEntries = [{
|
|
246
|
-
tryLoc: "root"
|
|
247
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
248
|
-
}
|
|
249
|
-
function values(e) {
|
|
250
|
-
if (e || "" === e) {
|
|
251
|
-
var r = e[a];
|
|
252
|
-
if (r) return r.call(e);
|
|
253
|
-
if ("function" == typeof e.next) return e;
|
|
254
|
-
if (!isNaN(e.length)) {
|
|
255
|
-
var o = -1,
|
|
256
|
-
i = function next() {
|
|
257
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
258
|
-
return next.value = t, next.done = !0, next;
|
|
259
|
-
};
|
|
260
|
-
return i.next = i;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
264
|
-
}
|
|
265
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
266
|
-
value: GeneratorFunctionPrototype,
|
|
267
|
-
configurable: !0
|
|
268
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
269
|
-
value: GeneratorFunction,
|
|
270
|
-
configurable: !0
|
|
271
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
272
|
-
var e = "function" == typeof t && t.constructor;
|
|
273
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
274
|
-
}, e.mark = function (t) {
|
|
275
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
276
|
-
}, e.awrap = function (t) {
|
|
277
|
-
return {
|
|
278
|
-
__await: t
|
|
279
|
-
};
|
|
280
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
281
|
-
return this;
|
|
282
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
283
|
-
void 0 === i && (i = Promise);
|
|
284
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
285
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
286
|
-
return t.done ? t.value : a.next();
|
|
287
|
-
});
|
|
288
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
289
|
-
return this;
|
|
290
|
-
}), define(g, "toString", function () {
|
|
291
|
-
return "[object Generator]";
|
|
292
|
-
}), e.keys = function (t) {
|
|
293
|
-
var e = Object(t),
|
|
294
|
-
r = [];
|
|
295
|
-
for (var n in e) r.push(n);
|
|
296
|
-
return r.reverse(), function next() {
|
|
297
|
-
for (; r.length;) {
|
|
298
|
-
var t = r.pop();
|
|
299
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
300
|
-
}
|
|
301
|
-
return next.done = !0, next;
|
|
302
|
-
};
|
|
303
|
-
}, e.values = values, Context.prototype = {
|
|
304
|
-
constructor: Context,
|
|
305
|
-
reset: function (e) {
|
|
306
|
-
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);
|
|
307
|
-
},
|
|
308
|
-
stop: function () {
|
|
309
|
-
this.done = !0;
|
|
310
|
-
var t = this.tryEntries[0].completion;
|
|
311
|
-
if ("throw" === t.type) throw t.arg;
|
|
312
|
-
return this.rval;
|
|
313
|
-
},
|
|
314
|
-
dispatchException: function (e) {
|
|
315
|
-
if (this.done) throw e;
|
|
316
|
-
var r = this;
|
|
317
|
-
function handle(n, o) {
|
|
318
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
319
|
-
}
|
|
320
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
321
|
-
var i = this.tryEntries[o],
|
|
322
|
-
a = i.completion;
|
|
323
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
324
|
-
if (i.tryLoc <= this.prev) {
|
|
325
|
-
var c = n.call(i, "catchLoc"),
|
|
326
|
-
u = n.call(i, "finallyLoc");
|
|
327
|
-
if (c && u) {
|
|
328
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
329
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
330
|
-
} else if (c) {
|
|
331
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
332
|
-
} else {
|
|
333
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
334
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
abrupt: function (t, e) {
|
|
340
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
341
|
-
var o = this.tryEntries[r];
|
|
342
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
343
|
-
var i = o;
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
348
|
-
var a = i ? i.completion : {};
|
|
349
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
350
|
-
},
|
|
351
|
-
complete: function (t, e) {
|
|
352
|
-
if ("throw" === t.type) throw t.arg;
|
|
353
|
-
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;
|
|
354
|
-
},
|
|
355
|
-
finish: function (t) {
|
|
356
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
357
|
-
var r = this.tryEntries[e];
|
|
358
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
359
|
-
}
|
|
360
|
-
},
|
|
361
|
-
catch: function (t) {
|
|
362
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
363
|
-
var r = this.tryEntries[e];
|
|
364
|
-
if (r.tryLoc === t) {
|
|
365
|
-
var n = r.completion;
|
|
366
|
-
if ("throw" === n.type) {
|
|
367
|
-
var o = n.arg;
|
|
368
|
-
resetTryEntry(r);
|
|
369
|
-
}
|
|
370
|
-
return o;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
throw Error("illegal catch attempt");
|
|
374
|
-
},
|
|
375
|
-
delegateYield: function (e, r, n) {
|
|
376
|
-
return this.delegate = {
|
|
377
|
-
iterator: values(e),
|
|
378
|
-
resultName: r,
|
|
379
|
-
nextLoc: n
|
|
380
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
381
|
-
}
|
|
382
|
-
}, e;
|
|
257
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
383
258
|
}
|
|
384
259
|
function _setPrototypeOf(t, e) {
|
|
385
260
|
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
@@ -408,6 +283,74 @@ function _wrapNativeSuper(t) {
|
|
|
408
283
|
}), _setPrototypeOf(Wrapper, t);
|
|
409
284
|
}, _wrapNativeSuper(t);
|
|
410
285
|
}
|
|
286
|
+
function _regeneratorRuntime() {
|
|
287
|
+
|
|
288
|
+
var r = _regenerator(),
|
|
289
|
+
e = r.m(_regeneratorRuntime),
|
|
290
|
+
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
291
|
+
function n(r) {
|
|
292
|
+
var e = "function" == typeof r && r.constructor;
|
|
293
|
+
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
294
|
+
}
|
|
295
|
+
var o = {
|
|
296
|
+
throw: 1,
|
|
297
|
+
return: 2,
|
|
298
|
+
break: 3,
|
|
299
|
+
continue: 3
|
|
300
|
+
};
|
|
301
|
+
function a(r) {
|
|
302
|
+
var e, t;
|
|
303
|
+
return function (n) {
|
|
304
|
+
e || (e = {
|
|
305
|
+
stop: function () {
|
|
306
|
+
return t(n.a, 2);
|
|
307
|
+
},
|
|
308
|
+
catch: function () {
|
|
309
|
+
return n.v;
|
|
310
|
+
},
|
|
311
|
+
abrupt: function (r, e) {
|
|
312
|
+
return t(n.a, o[r], e);
|
|
313
|
+
},
|
|
314
|
+
delegateYield: function (r, o, a) {
|
|
315
|
+
return e.resultName = o, t(n.d, _regeneratorValues(r), a);
|
|
316
|
+
},
|
|
317
|
+
finish: function (r) {
|
|
318
|
+
return t(n.f, r);
|
|
319
|
+
}
|
|
320
|
+
}, t = function (r, t, o) {
|
|
321
|
+
n.p = e.prev, n.n = e.next;
|
|
322
|
+
try {
|
|
323
|
+
return r(t, o);
|
|
324
|
+
} finally {
|
|
325
|
+
e.next = n.n;
|
|
326
|
+
}
|
|
327
|
+
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
328
|
+
try {
|
|
329
|
+
return r.call(this, e);
|
|
330
|
+
} finally {
|
|
331
|
+
n.p = e.prev, n.n = e.next;
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
return (_regeneratorRuntime = function () {
|
|
336
|
+
return {
|
|
337
|
+
wrap: function (e, t, n, o) {
|
|
338
|
+
return r.w(a(e), t, n, o && o.reverse());
|
|
339
|
+
},
|
|
340
|
+
isGeneratorFunction: n,
|
|
341
|
+
mark: r.m,
|
|
342
|
+
awrap: function (r, e) {
|
|
343
|
+
return new _OverloadYield(r, e);
|
|
344
|
+
},
|
|
345
|
+
AsyncIterator: _regeneratorAsyncIterator,
|
|
346
|
+
async: function (r, e, t, o, u) {
|
|
347
|
+
return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u);
|
|
348
|
+
},
|
|
349
|
+
keys: _regeneratorKeys,
|
|
350
|
+
values: _regeneratorValues
|
|
351
|
+
};
|
|
352
|
+
})();
|
|
353
|
+
}
|
|
411
354
|
|
|
412
355
|
var API_URL = 'https://api.paraswap.io';
|
|
413
356
|
var DEFAULT_VERSION = '6.2';
|
|
@@ -853,7 +796,7 @@ var constructGetBalances = function constructGetBalances(_ref) {
|
|
|
853
796
|
}
|
|
854
797
|
}, _callee4);
|
|
855
798
|
}));
|
|
856
|
-
return function getAllowance(_x9,
|
|
799
|
+
return function getAllowance(_x9, _x0, _x1) {
|
|
857
800
|
return _ref6.apply(this, arguments);
|
|
858
801
|
};
|
|
859
802
|
}();
|
|
@@ -1719,7 +1662,7 @@ function encodeEIP_2612PermitFunctionInput(_ref) {
|
|
|
1719
1662
|
return val.slice(2);
|
|
1720
1663
|
}) // Remove "0x" prefix from each encoded value
|
|
1721
1664
|
.join('') // Concatenate the values
|
|
1722
|
-
|
|
1665
|
+
;
|
|
1723
1666
|
}
|
|
1724
1667
|
// encoding params for DAIlike.permit() function
|
|
1725
1668
|
function encodeDAIlikePermitFunctionInput(_ref2) {
|
|
@@ -1746,7 +1689,7 @@ function encodeDAIlikePermitFunctionInput(_ref2) {
|
|
|
1746
1689
|
return val.slice(2);
|
|
1747
1690
|
}) // Remove "0x" prefix from each encoded value
|
|
1748
1691
|
.join('') // Concatenate the values
|
|
1749
|
-
|
|
1692
|
+
;
|
|
1750
1693
|
}
|
|
1751
1694
|
// encode an address (20 bytes) into 32 bytes
|
|
1752
1695
|
function encodeAddress(address) {
|
|
@@ -6070,7 +6013,7 @@ var constructDeltaTokenModule = function constructDeltaTokenModule(options) {
|
|
|
6070
6013
|
}
|
|
6071
6014
|
}, _callee4);
|
|
6072
6015
|
}));
|
|
6073
|
-
return function depositNativeAndPreSignDeltaOrder(
|
|
6016
|
+
return function depositNativeAndPreSignDeltaOrder(_x0, _x1, _x10) {
|
|
6074
6017
|
return _ref7.apply(this, arguments);
|
|
6075
6018
|
};
|
|
6076
6019
|
}();
|
|
@@ -6110,7 +6053,7 @@ var constructDeltaTokenModule = function constructDeltaTokenModule(options) {
|
|
|
6110
6053
|
}
|
|
6111
6054
|
}, _callee5);
|
|
6112
6055
|
}));
|
|
6113
|
-
return function cancelTWAPAndWithdrawDeltaOrder(
|
|
6056
|
+
return function cancelTWAPAndWithdrawDeltaOrder(_x11, _x12, _x13) {
|
|
6114
6057
|
return _ref8.apply(this, arguments);
|
|
6115
6058
|
};
|
|
6116
6059
|
}();
|
|
@@ -6150,7 +6093,7 @@ var constructDeltaTokenModule = function constructDeltaTokenModule(options) {
|
|
|
6150
6093
|
}
|
|
6151
6094
|
}, _callee6);
|
|
6152
6095
|
}));
|
|
6153
|
-
return function cancelTWAPBuyAndWithdrawDeltaOrder(
|
|
6096
|
+
return function cancelTWAPBuyAndWithdrawDeltaOrder(_x14, _x15, _x16) {
|
|
6154
6097
|
return _ref9.apply(this, arguments);
|
|
6155
6098
|
};
|
|
6156
6099
|
}();
|
|
@@ -7061,6 +7004,7 @@ function getAuctionAmounts(auction) {
|
|
|
7061
7004
|
}
|
|
7062
7005
|
var expected = {
|
|
7063
7006
|
srcAmount: auction.order.srcAmount,
|
|
7007
|
+
// defensive fallback in case Order shape changes or legacy Orders don't have all fields
|
|
7064
7008
|
destAmount: auction.order.expectedAmount || auction.order.destAmount
|
|
7065
7009
|
};
|
|
7066
7010
|
var order = auction.order;
|
|
@@ -7092,9 +7036,9 @@ function isOrderCrosschain(order
|
|
|
7092
7036
|
}
|
|
7093
7037
|
function scaleByFactor(amount, scalingFactor) {
|
|
7094
7038
|
if (!amount) return 0n;
|
|
7095
|
-
if (scalingFactor ===
|
|
7039
|
+
if (scalingFactor === 0) return amount;
|
|
7096
7040
|
var base = 10n;
|
|
7097
|
-
return scalingFactor < 0 ? amount /
|
|
7041
|
+
return scalingFactor < 0 ? amount / base ** BigInt(-scalingFactor) : amount * base ** BigInt(scalingFactor);
|
|
7098
7042
|
}
|
|
7099
7043
|
/**
|
|
7100
7044
|
* @description Checks whether an auction is fully executed.
|
|
@@ -7156,107 +7100,16 @@ function isPartiallyExecutedAuction(auction) {
|
|
|
7156
7100
|
* @description Calculates filled percentage from auction transaction filled bps values.
|
|
7157
7101
|
*/
|
|
7158
7102
|
function getFilledPercent(auction) {
|
|
7159
|
-
var
|
|
7103
|
+
var completeTransactions = !isOrderCrosschain(auction.order) ? auction.transactions : auction.transactions.filter(function (transaction) {
|
|
7160
7104
|
return transaction.bridgeStatus === 'filled';
|
|
7161
7105
|
});
|
|
7162
|
-
var filledPercentBps =
|
|
7106
|
+
var filledPercentBps = completeTransactions.reduce(function (acc, _ref3) {
|
|
7163
7107
|
var filledPercent = _ref3.filledPercent;
|
|
7164
7108
|
return acc + filledPercent;
|
|
7165
7109
|
}, 0);
|
|
7166
7110
|
var filledPercent = filledPercentBps / 100;
|
|
7167
7111
|
return filledPercent;
|
|
7168
7112
|
}
|
|
7169
|
-
///// TESTS //////
|
|
7170
|
-
// @TODO remove
|
|
7171
|
-
var auction = {};
|
|
7172
|
-
var minAuction = {
|
|
7173
|
-
onChainOrderType: 'TWAPOrder',
|
|
7174
|
-
gas: 6
|
|
7175
|
-
};
|
|
7176
|
-
if (isTWAPAuction(minAuction)) {
|
|
7177
|
-
console.log('🚀 ~ auction:', minAuction);
|
|
7178
|
-
/**
|
|
7179
|
-
* {
|
|
7180
|
-
onChainOrderType: OnChainOrderType;
|
|
7181
|
-
gas: number;
|
|
7182
|
-
} & {
|
|
7183
|
-
onChainOrderType: "TWAPOrder" | "TWAPBuyOrder";
|
|
7184
|
-
}
|
|
7185
|
-
*/
|
|
7186
|
-
}
|
|
7187
|
-
if (isTWAPAuction(auction)) {
|
|
7188
|
-
console.log('🚀 ~ auction:', auction);
|
|
7189
|
-
/**
|
|
7190
|
-
(DeltaAuctionBase & {
|
|
7191
|
-
onChainOrderType: "TWAPOrder";
|
|
7192
|
-
order: TWAPDeltaOrder;
|
|
7193
|
-
}) | (DeltaAuctionBase & {
|
|
7194
|
-
onChainOrderType: "TWAPBuyOrder";
|
|
7195
|
-
order: TWAPBuyDeltaOrder;
|
|
7196
|
-
})
|
|
7197
|
-
*/
|
|
7198
|
-
}
|
|
7199
|
-
if (isTWAPSellAuction(auction)) {
|
|
7200
|
-
console.log('🚀 ~ auction:', auction);
|
|
7201
|
-
/**
|
|
7202
|
-
* DeltaAuctionBase & {
|
|
7203
|
-
onChainOrderType: "TWAPOrder";
|
|
7204
|
-
order: TWAPDeltaOrder;
|
|
7205
|
-
}
|
|
7206
|
-
*/
|
|
7207
|
-
}
|
|
7208
|
-
if (isTWAPBuyAuction(auction)) {
|
|
7209
|
-
console.log('🚀 ~ auction:', auction);
|
|
7210
|
-
/**
|
|
7211
|
-
* DeltaAuctionBase & {
|
|
7212
|
-
onChainOrderType: "TWAPBuyOrder";
|
|
7213
|
-
order: TWAPBuyDeltaOrder;
|
|
7214
|
-
}
|
|
7215
|
-
*/
|
|
7216
|
-
}
|
|
7217
|
-
if (isDeltaAuction(auction)) {
|
|
7218
|
-
console.log('🚀 ~ auction:', auction);
|
|
7219
|
-
/**
|
|
7220
|
-
* DeltaAuctionBase & {
|
|
7221
|
-
onChainOrderType: "Order";
|
|
7222
|
-
order: DeltaAuctionOrder;
|
|
7223
|
-
}
|
|
7224
|
-
*/
|
|
7225
|
-
}
|
|
7226
|
-
if (isExternalAuction(auction)) {
|
|
7227
|
-
console.log('🚀 ~ auction:', auction);
|
|
7228
|
-
/**
|
|
7229
|
-
* DeltaAuctionBase & {
|
|
7230
|
-
onChainOrderType: "ExternalOrder";
|
|
7231
|
-
order: ExternalDeltaOrder;
|
|
7232
|
-
}
|
|
7233
|
-
*/
|
|
7234
|
-
}
|
|
7235
|
-
// ------------------------------------------------------------ //
|
|
7236
|
-
var orderAny = {};
|
|
7237
|
-
if (isOrderCrosschain(orderAny)) {
|
|
7238
|
-
console.log('🚀 ~ order:', orderAny);
|
|
7239
|
-
/**
|
|
7240
|
-
DeltaAuctionOrder | TWAPDeltaOrder | TWAPBuyDeltaOrder
|
|
7241
|
-
*/
|
|
7242
|
-
}
|
|
7243
|
-
var orderExternal = {};
|
|
7244
|
-
if (isOrderCrosschain(orderExternal)) {
|
|
7245
|
-
console.log('🚀 ~ order:', orderExternal);
|
|
7246
|
-
/**
|
|
7247
|
-
never
|
|
7248
|
-
*/
|
|
7249
|
-
}
|
|
7250
|
-
var orderLike = {};
|
|
7251
|
-
if (isOrderCrosschain(orderLike)) {
|
|
7252
|
-
console.log('🚀 ~ order:', orderLike);
|
|
7253
|
-
/**
|
|
7254
|
-
* {
|
|
7255
|
-
bridge: Bridge;
|
|
7256
|
-
a: 2;
|
|
7257
|
-
}
|
|
7258
|
-
*/
|
|
7259
|
-
}
|
|
7260
7113
|
|
|
7261
7114
|
export { API_URL, AssetType, DEFAULT_VERSION, OrderHelpers, constructAllDeltaOrdersHandlers, constructAllLimitOrdersHandlers, constructAllNFTOrdersHandlers, constructApproveToken, constructApproveTokenForDelta, constructApproveTokenForLimitOrder, constructApproveTokenForNFTOrder, constructFetcher$2 as constructAxiosFetcher, constructBuildDeltaOrder, constructBuildExternalDeltaOrder, constructBuildLimitOrder, constructBuildLimitOrderTx, constructBuildNFTOrder, constructBuildNFTOrderTx, constructBuildTWAPDeltaOrder, constructBuildTx, constructCancelDeltaOrder, constructCancelLimitOrder, constructCancelNFTOrder, constructDeltaTokenModule, constructEthersV5ContractCaller as constructEthersContractCaller, constructEthersV5ContractCaller, constructContractCaller$2 as constructEthersV6ContractCaller, constructFetcher$1 as constructFetchFetcher, constructFillOrderDirectly, constructFullSDK, constructGetAdapters, constructGetBalances, constructGetBridgeInfo, constructGetDeltaContract, constructGetDeltaOrders, constructGetDeltaPrice, constructGetLimitOrders, constructGetLimitOrdersContract, constructGetNFTOrders, constructGetNFTOrdersContract, constructGetPartnerFee, constructGetQuote, constructGetRate, constructGetSpender, constructGetTokens, constructIsTokenSupportedInDelta, constructPartialSDK, constructPostDeltaOrder, constructPostExternalDeltaOrder, constructPostLimitOrder, constructPostNFTOrder, constructPostTWAPDeltaOrder, constructPreSignDeltaOrder, constructPreSignExternalDeltaOrder, constructPreSignTWAPDeltaOrder, constructSignDeltaOrder, constructSignExternalDeltaOrder, constructSignLimitOrder, constructSignNFTOrder, constructSignTWAPDeltaOrder, constructSimpleSDK, constructSubmitDeltaOrder, constructSubmitExternalDeltaOrder, constructSubmitLimitOrder, constructSubmitNFTOrder, constructSubmitTWAPDeltaOrder, constructSwapSDK, constructSwapTx, constructToken, constructContractCaller as constructViemContractCaller, constructContractCaller$1 as constructWeb3ContractCaller, isAllowance, isFetcherError, txParamsToViemTxParams };
|
|
7262
7115
|
//# sourceMappingURL=sdk.esm.js.map
|