@imtbl/sdk 1.77.7-alpha.1 → 1.77.7
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/{blockchain_data-Dg9Q9V5S.js → blockchain_data-B8XMnSWf.js} +2 -2
- package/dist/blockchain_data.js +3 -3
- package/dist/browser/checkout/{AddTokensWidget-TbB4PmLW.js → AddTokensWidget-BAbeB6QF.js} +408 -5
- package/dist/browser/checkout/{BridgeWidget-BhrCocw2.js → BridgeWidget-CrLjoZj2.js} +8 -7
- package/dist/browser/checkout/{CommerceWidget-Be5DHzdC.js → CommerceWidget-CJXKumJj.js} +16 -15
- package/dist/browser/checkout/{FeesBreakdown-Ck9YzdSC.js → FeesBreakdown-BypWN9Iy.js} +1 -1
- package/dist/browser/checkout/{HandoverContent-DB23bXer.js → HandoverContent-DQ1dvn2V.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-CqVk3g3X.js → OnRampWidget-JJO1UCrW.js} +3 -3
- package/dist/browser/checkout/{SaleWidget-BN4NOhbW.js → SaleWidget-Bpmzfc7A.js} +13 -12
- package/dist/browser/checkout/{SpendingCapHero-CPvvFrji.js → SpendingCapHero-Br5Uv8YR.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-CwFYyKSt.js → SwapWidget-BmfIQSUe.js} +8 -7
- package/dist/browser/checkout/{TokenImage-BKsKixKT.js → TokenImage-z4OoDdYE.js} +1 -1
- package/dist/browser/checkout/{TopUpView-B4EZHPvY.js → TopUpView-B4eXJlqS.js} +2 -1
- package/dist/browser/checkout/{WalletApproveHero--5umxYJp.js → WalletApproveHero-83IoWlwV.js} +3 -3
- package/dist/browser/checkout/{WalletWidget-DVqX_Zms.js → WalletWidget-ComOLNY_.js} +3 -3
- package/dist/browser/checkout/{auto-track-B82Gtc5w.js → auto-track-B1yl_Cb9.js} +1 -1
- package/dist/browser/checkout/{index-BsW6upSH.js → index-B3rZfPee.js} +1 -1
- package/dist/browser/checkout/{index-CwvzJ6GW.js → index-Bud6ZDGR.js} +1 -1
- package/dist/browser/checkout/{index-CE6PQBKk.js → index-CxRI6mbM.js} +1 -1
- package/dist/browser/checkout/{index-C0AbsZnL.js → index-D5flYG_V.js} +1 -1
- package/dist/browser/checkout/{index-AFLAGIsQ.js → index-DPJLapbR.js} +1 -1
- package/dist/browser/checkout/{index-Ba4jcykl.js → index-DURgDDlD.js} +1 -1
- package/dist/browser/checkout/{index-Smb16jHM.js → index-DWFmOHWm.js} +1 -1
- package/dist/browser/checkout/{index-uoFT0va2.js → index-QnoQrLJ7.js} +626 -1680
- package/dist/browser/checkout/index-aJ1AhJ6L.js +394 -0
- package/dist/browser/checkout/{index-Bkd29y5M.js → index-hJJjTrqc.js} +2 -2
- package/dist/browser/checkout/{index.umd-DHRFESK1.js → index.umd-CO9CmHyp.js} +1 -1
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/{useInterval-DoDljSUa.js → useInterval-Cs241Eva.js} +1 -1
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +646 -907
- package/dist/{checkout-CzqSs99h.js → checkout-BEnRmmWy.js} +5 -5
- package/dist/checkout.js +5 -5
- package/dist/{config-BJw9K8Po.js → config-j-wtV9bL.js} +1 -1
- package/dist/config.js +1 -1
- package/dist/{index-BxzTAKIm.js → index-BHMSlzV7.js} +4 -4
- package/dist/{index-CV8VqwDA.js → index-D3ERw9s5.js} +1 -1
- package/dist/{index-Bb-CtrNx.js → index-DaGRx7tS.js} +1 -1
- package/dist/{index-B2PvtsjM.js → index-DyUG4OFL.js} +3 -3
- package/dist/{index-DBVlwCPH.js → index-QwdUj2PO.js} +1 -1
- package/dist/{index-evZUxrpM.js → index-knWuA9k4.js} +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +14 -14
- package/dist/{minting_backend-Dy__LL73.js → minting_backend-mtmfZp09.js} +3 -3
- package/dist/minting_backend.js +5 -5
- package/dist/{orderbook-BS6_rEkr.js → orderbook-DoIjVZXk.js} +1 -1
- package/dist/orderbook.js +2 -2
- package/dist/{passport-CZQMKlmP.js → passport-BcbwvHFF.js} +3 -3
- package/dist/passport.js +4 -4
- package/dist/version.json +1 -1
- package/dist/{webhook-DXOqOK9I.js → webhook-qIYejhx3.js} +1 -1
- package/dist/webhook.js +2 -2
- package/dist/{x-x_2w6MwN.js → x-JXuh6vIe.js} +3 -3
- package/dist/x.js +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { D as BigNumber, cB as Logger, d9 as version$1, da as hexZeroPad, db as isBigNumberish, cM as arrayify, dc as isBytes } from './index-QnoQrLJ7.js';
|
|
2
|
+
|
|
3
|
+
const logger$1 = new Logger(version$1);
|
|
4
|
+
const _constructorGuard = {};
|
|
5
|
+
const Zero = BigNumber.from(0);
|
|
6
|
+
const NegativeOne = BigNumber.from(-1);
|
|
7
|
+
function throwFault(message, fault, operation, value) {
|
|
8
|
+
const params = { fault: fault, operation: operation };
|
|
9
|
+
if (value !== undefined) {
|
|
10
|
+
params.value = value;
|
|
11
|
+
}
|
|
12
|
+
return logger$1.throwError(message, Logger.errors.NUMERIC_FAULT, params);
|
|
13
|
+
}
|
|
14
|
+
// Constant to pull zeros from for multipliers
|
|
15
|
+
let zeros = "0";
|
|
16
|
+
while (zeros.length < 256) {
|
|
17
|
+
zeros += zeros;
|
|
18
|
+
}
|
|
19
|
+
// Returns a string "1" followed by decimal "0"s
|
|
20
|
+
function getMultiplier(decimals) {
|
|
21
|
+
if (typeof (decimals) !== "number") {
|
|
22
|
+
try {
|
|
23
|
+
decimals = BigNumber.from(decimals).toNumber();
|
|
24
|
+
}
|
|
25
|
+
catch (e) { }
|
|
26
|
+
}
|
|
27
|
+
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
28
|
+
return ("1" + zeros.substring(0, decimals));
|
|
29
|
+
}
|
|
30
|
+
return logger$1.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
31
|
+
}
|
|
32
|
+
function formatFixed(value, decimals) {
|
|
33
|
+
if (decimals == null) {
|
|
34
|
+
decimals = 0;
|
|
35
|
+
}
|
|
36
|
+
const multiplier = getMultiplier(decimals);
|
|
37
|
+
// Make sure wei is a big number (convert as necessary)
|
|
38
|
+
value = BigNumber.from(value);
|
|
39
|
+
const negative = value.lt(Zero);
|
|
40
|
+
if (negative) {
|
|
41
|
+
value = value.mul(NegativeOne);
|
|
42
|
+
}
|
|
43
|
+
let fraction = value.mod(multiplier).toString();
|
|
44
|
+
while (fraction.length < multiplier.length - 1) {
|
|
45
|
+
fraction = "0" + fraction;
|
|
46
|
+
}
|
|
47
|
+
// Strip training 0
|
|
48
|
+
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
|
|
49
|
+
const whole = value.div(multiplier).toString();
|
|
50
|
+
if (multiplier.length === 1) {
|
|
51
|
+
value = whole;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
value = whole + "." + fraction;
|
|
55
|
+
}
|
|
56
|
+
if (negative) {
|
|
57
|
+
value = "-" + value;
|
|
58
|
+
}
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
function parseFixed(value, decimals) {
|
|
62
|
+
if (decimals == null) {
|
|
63
|
+
decimals = 0;
|
|
64
|
+
}
|
|
65
|
+
const multiplier = getMultiplier(decimals);
|
|
66
|
+
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
|
|
67
|
+
logger$1.throwArgumentError("invalid decimal value", "value", value);
|
|
68
|
+
}
|
|
69
|
+
// Is it negative?
|
|
70
|
+
const negative = (value.substring(0, 1) === "-");
|
|
71
|
+
if (negative) {
|
|
72
|
+
value = value.substring(1);
|
|
73
|
+
}
|
|
74
|
+
if (value === ".") {
|
|
75
|
+
logger$1.throwArgumentError("missing value", "value", value);
|
|
76
|
+
}
|
|
77
|
+
// Split it into a whole and fractional part
|
|
78
|
+
const comps = value.split(".");
|
|
79
|
+
if (comps.length > 2) {
|
|
80
|
+
logger$1.throwArgumentError("too many decimal points", "value", value);
|
|
81
|
+
}
|
|
82
|
+
let whole = comps[0], fraction = comps[1];
|
|
83
|
+
if (!whole) {
|
|
84
|
+
whole = "0";
|
|
85
|
+
}
|
|
86
|
+
if (!fraction) {
|
|
87
|
+
fraction = "0";
|
|
88
|
+
}
|
|
89
|
+
// Trim trailing zeros
|
|
90
|
+
while (fraction[fraction.length - 1] === "0") {
|
|
91
|
+
fraction = fraction.substring(0, fraction.length - 1);
|
|
92
|
+
}
|
|
93
|
+
// Check the fraction doesn't exceed our decimals size
|
|
94
|
+
if (fraction.length > multiplier.length - 1) {
|
|
95
|
+
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
96
|
+
}
|
|
97
|
+
// If decimals is 0, we have an empty string for fraction
|
|
98
|
+
if (fraction === "") {
|
|
99
|
+
fraction = "0";
|
|
100
|
+
}
|
|
101
|
+
// Fully pad the string with zeros to get to wei
|
|
102
|
+
while (fraction.length < multiplier.length - 1) {
|
|
103
|
+
fraction += "0";
|
|
104
|
+
}
|
|
105
|
+
const wholeValue = BigNumber.from(whole);
|
|
106
|
+
const fractionValue = BigNumber.from(fraction);
|
|
107
|
+
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
|
|
108
|
+
if (negative) {
|
|
109
|
+
wei = wei.mul(NegativeOne);
|
|
110
|
+
}
|
|
111
|
+
return wei;
|
|
112
|
+
}
|
|
113
|
+
class FixedFormat {
|
|
114
|
+
constructor(constructorGuard, signed, width, decimals) {
|
|
115
|
+
if (constructorGuard !== _constructorGuard) {
|
|
116
|
+
logger$1.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
117
|
+
operation: "new FixedFormat"
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
this.signed = signed;
|
|
121
|
+
this.width = width;
|
|
122
|
+
this.decimals = decimals;
|
|
123
|
+
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
124
|
+
this._multiplier = getMultiplier(decimals);
|
|
125
|
+
Object.freeze(this);
|
|
126
|
+
}
|
|
127
|
+
static from(value) {
|
|
128
|
+
if (value instanceof FixedFormat) {
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
if (typeof (value) === "number") {
|
|
132
|
+
value = `fixed128x${value}`;
|
|
133
|
+
}
|
|
134
|
+
let signed = true;
|
|
135
|
+
let width = 128;
|
|
136
|
+
let decimals = 18;
|
|
137
|
+
if (typeof (value) === "string") {
|
|
138
|
+
if (value === "fixed") ;
|
|
139
|
+
else if (value === "ufixed") {
|
|
140
|
+
signed = false;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
|
144
|
+
if (!match) {
|
|
145
|
+
logger$1.throwArgumentError("invalid fixed format", "format", value);
|
|
146
|
+
}
|
|
147
|
+
signed = (match[1] !== "u");
|
|
148
|
+
width = parseInt(match[2]);
|
|
149
|
+
decimals = parseInt(match[3]);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else if (value) {
|
|
153
|
+
const check = (key, type, defaultValue) => {
|
|
154
|
+
if (value[key] == null) {
|
|
155
|
+
return defaultValue;
|
|
156
|
+
}
|
|
157
|
+
if (typeof (value[key]) !== type) {
|
|
158
|
+
logger$1.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
159
|
+
}
|
|
160
|
+
return value[key];
|
|
161
|
+
};
|
|
162
|
+
signed = check("signed", "boolean", signed);
|
|
163
|
+
width = check("width", "number", width);
|
|
164
|
+
decimals = check("decimals", "number", decimals);
|
|
165
|
+
}
|
|
166
|
+
if (width % 8) {
|
|
167
|
+
logger$1.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
168
|
+
}
|
|
169
|
+
if (decimals > 80) {
|
|
170
|
+
logger$1.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
171
|
+
}
|
|
172
|
+
return new FixedFormat(_constructorGuard, signed, width, decimals);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
class FixedNumber {
|
|
176
|
+
constructor(constructorGuard, hex, value, format) {
|
|
177
|
+
if (constructorGuard !== _constructorGuard) {
|
|
178
|
+
logger$1.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
179
|
+
operation: "new FixedFormat"
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
this.format = format;
|
|
183
|
+
this._hex = hex;
|
|
184
|
+
this._value = value;
|
|
185
|
+
this._isFixedNumber = true;
|
|
186
|
+
Object.freeze(this);
|
|
187
|
+
}
|
|
188
|
+
_checkFormat(other) {
|
|
189
|
+
if (this.format.name !== other.format.name) {
|
|
190
|
+
logger$1.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
addUnsafe(other) {
|
|
194
|
+
this._checkFormat(other);
|
|
195
|
+
const a = parseFixed(this._value, this.format.decimals);
|
|
196
|
+
const b = parseFixed(other._value, other.format.decimals);
|
|
197
|
+
return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);
|
|
198
|
+
}
|
|
199
|
+
subUnsafe(other) {
|
|
200
|
+
this._checkFormat(other);
|
|
201
|
+
const a = parseFixed(this._value, this.format.decimals);
|
|
202
|
+
const b = parseFixed(other._value, other.format.decimals);
|
|
203
|
+
return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);
|
|
204
|
+
}
|
|
205
|
+
mulUnsafe(other) {
|
|
206
|
+
this._checkFormat(other);
|
|
207
|
+
const a = parseFixed(this._value, this.format.decimals);
|
|
208
|
+
const b = parseFixed(other._value, other.format.decimals);
|
|
209
|
+
return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
210
|
+
}
|
|
211
|
+
divUnsafe(other) {
|
|
212
|
+
this._checkFormat(other);
|
|
213
|
+
const a = parseFixed(this._value, this.format.decimals);
|
|
214
|
+
const b = parseFixed(other._value, other.format.decimals);
|
|
215
|
+
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
216
|
+
}
|
|
217
|
+
floor() {
|
|
218
|
+
const comps = this.toString().split(".");
|
|
219
|
+
if (comps.length === 1) {
|
|
220
|
+
comps.push("0");
|
|
221
|
+
}
|
|
222
|
+
let result = FixedNumber.from(comps[0], this.format);
|
|
223
|
+
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
224
|
+
if (this.isNegative() && hasFraction) {
|
|
225
|
+
result = result.subUnsafe(ONE.toFormat(result.format));
|
|
226
|
+
}
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
ceiling() {
|
|
230
|
+
const comps = this.toString().split(".");
|
|
231
|
+
if (comps.length === 1) {
|
|
232
|
+
comps.push("0");
|
|
233
|
+
}
|
|
234
|
+
let result = FixedNumber.from(comps[0], this.format);
|
|
235
|
+
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
236
|
+
if (!this.isNegative() && hasFraction) {
|
|
237
|
+
result = result.addUnsafe(ONE.toFormat(result.format));
|
|
238
|
+
}
|
|
239
|
+
return result;
|
|
240
|
+
}
|
|
241
|
+
// @TODO: Support other rounding algorithms
|
|
242
|
+
round(decimals) {
|
|
243
|
+
if (decimals == null) {
|
|
244
|
+
decimals = 0;
|
|
245
|
+
}
|
|
246
|
+
// If we are already in range, we're done
|
|
247
|
+
const comps = this.toString().split(".");
|
|
248
|
+
if (comps.length === 1) {
|
|
249
|
+
comps.push("0");
|
|
250
|
+
}
|
|
251
|
+
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
|
252
|
+
logger$1.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
253
|
+
}
|
|
254
|
+
if (comps[1].length <= decimals) {
|
|
255
|
+
return this;
|
|
256
|
+
}
|
|
257
|
+
const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format);
|
|
258
|
+
const bump = BUMP.toFormat(this.format);
|
|
259
|
+
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
260
|
+
}
|
|
261
|
+
isZero() {
|
|
262
|
+
return (this._value === "0.0" || this._value === "0");
|
|
263
|
+
}
|
|
264
|
+
isNegative() {
|
|
265
|
+
return (this._value[0] === "-");
|
|
266
|
+
}
|
|
267
|
+
toString() { return this._value; }
|
|
268
|
+
toHexString(width) {
|
|
269
|
+
if (width == null) {
|
|
270
|
+
return this._hex;
|
|
271
|
+
}
|
|
272
|
+
if (width % 8) {
|
|
273
|
+
logger$1.throwArgumentError("invalid byte width", "width", width);
|
|
274
|
+
}
|
|
275
|
+
const hex = BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
276
|
+
return hexZeroPad(hex, width / 8);
|
|
277
|
+
}
|
|
278
|
+
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
279
|
+
toFormat(format) {
|
|
280
|
+
return FixedNumber.fromString(this._value, format);
|
|
281
|
+
}
|
|
282
|
+
static fromValue(value, decimals, format) {
|
|
283
|
+
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
284
|
+
if (format == null && decimals != null && !isBigNumberish(decimals)) {
|
|
285
|
+
format = decimals;
|
|
286
|
+
decimals = null;
|
|
287
|
+
}
|
|
288
|
+
if (decimals == null) {
|
|
289
|
+
decimals = 0;
|
|
290
|
+
}
|
|
291
|
+
if (format == null) {
|
|
292
|
+
format = "fixed";
|
|
293
|
+
}
|
|
294
|
+
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
|
295
|
+
}
|
|
296
|
+
static fromString(value, format) {
|
|
297
|
+
if (format == null) {
|
|
298
|
+
format = "fixed";
|
|
299
|
+
}
|
|
300
|
+
const fixedFormat = FixedFormat.from(format);
|
|
301
|
+
const numeric = parseFixed(value, fixedFormat.decimals);
|
|
302
|
+
if (!fixedFormat.signed && numeric.lt(Zero)) {
|
|
303
|
+
throwFault("unsigned value cannot be negative", "overflow", "value", value);
|
|
304
|
+
}
|
|
305
|
+
let hex = null;
|
|
306
|
+
if (fixedFormat.signed) {
|
|
307
|
+
hex = numeric.toTwos(fixedFormat.width).toHexString();
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
hex = numeric.toHexString();
|
|
311
|
+
hex = hexZeroPad(hex, fixedFormat.width / 8);
|
|
312
|
+
}
|
|
313
|
+
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
314
|
+
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
|
315
|
+
}
|
|
316
|
+
static fromBytes(value, format) {
|
|
317
|
+
if (format == null) {
|
|
318
|
+
format = "fixed";
|
|
319
|
+
}
|
|
320
|
+
const fixedFormat = FixedFormat.from(format);
|
|
321
|
+
if (arrayify(value).length > fixedFormat.width / 8) {
|
|
322
|
+
throw new Error("overflow");
|
|
323
|
+
}
|
|
324
|
+
let numeric = BigNumber.from(value);
|
|
325
|
+
if (fixedFormat.signed) {
|
|
326
|
+
numeric = numeric.fromTwos(fixedFormat.width);
|
|
327
|
+
}
|
|
328
|
+
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
329
|
+
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
330
|
+
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
|
331
|
+
}
|
|
332
|
+
static from(value, format) {
|
|
333
|
+
if (typeof (value) === "string") {
|
|
334
|
+
return FixedNumber.fromString(value, format);
|
|
335
|
+
}
|
|
336
|
+
if (isBytes(value)) {
|
|
337
|
+
return FixedNumber.fromBytes(value, format);
|
|
338
|
+
}
|
|
339
|
+
try {
|
|
340
|
+
return FixedNumber.fromValue(value, 0, format);
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
// Allow NUMERIC_FAULT to bubble up
|
|
344
|
+
if (error.code !== Logger.errors.INVALID_ARGUMENT) {
|
|
345
|
+
throw error;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return logger$1.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
349
|
+
}
|
|
350
|
+
static isFixedNumber(value) {
|
|
351
|
+
return !!(value && value._isFixedNumber);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
const ONE = FixedNumber.from(1);
|
|
355
|
+
const BUMP = FixedNumber.from("0.5");
|
|
356
|
+
|
|
357
|
+
const version = "units/5.7.0";
|
|
358
|
+
|
|
359
|
+
const logger = new Logger(version);
|
|
360
|
+
const names = [
|
|
361
|
+
"wei",
|
|
362
|
+
"kwei",
|
|
363
|
+
"mwei",
|
|
364
|
+
"gwei",
|
|
365
|
+
"szabo",
|
|
366
|
+
"finney",
|
|
367
|
+
"ether",
|
|
368
|
+
];
|
|
369
|
+
function formatUnits(value, unitName) {
|
|
370
|
+
if (typeof (unitName) === "string") {
|
|
371
|
+
const index = names.indexOf(unitName);
|
|
372
|
+
if (index !== -1) {
|
|
373
|
+
unitName = 3 * index;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return formatFixed(value, (unitName != null) ? unitName : 18);
|
|
377
|
+
}
|
|
378
|
+
function parseUnits(value, unitName) {
|
|
379
|
+
if (typeof (value) !== "string") {
|
|
380
|
+
logger.throwArgumentError("value must be a string", "value", value);
|
|
381
|
+
}
|
|
382
|
+
if (typeof (unitName) === "string") {
|
|
383
|
+
const index = names.indexOf(unitName);
|
|
384
|
+
if (index !== -1) {
|
|
385
|
+
unitName = 3 * index;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return parseFixed(value, (unitName != null) ? unitName : 18);
|
|
389
|
+
}
|
|
390
|
+
function parseEther(ether) {
|
|
391
|
+
return parseUnits(ether, 18);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export { parseEther as a, formatUnits as f, parseUnits as p };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dy as __awaiter, dz as __generator } from './index-QnoQrLJ7.js';
|
|
2
2
|
|
|
3
3
|
function loadLegacyVideoPlugins(analytics) {
|
|
4
4
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -7,7 +7,7 @@ function loadLegacyVideoPlugins(analytics) {
|
|
|
7
7
|
switch (_a.label) {
|
|
8
8
|
case 0: return [4 /*yield*/, import(
|
|
9
9
|
// @ts-expect-error
|
|
10
|
-
'./index.umd-
|
|
10
|
+
'./index.umd-CO9CmHyp.js').then(function (n) { return n.i; })
|
|
11
11
|
// This is super gross, but we need to support the `window.analytics.plugins` namespace
|
|
12
12
|
// that is linked in the segment docs in order to be backwards compatible with ajs-classic
|
|
13
13
|
// @ts-expect-error
|