@secretkeylabs/xverse-agent-wallet 0.1.10 → 0.1.11
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/cli.js +1043 -798
- package/package.json +1 -1
- package/skill/xverse-agent-wallet/SKILL.md +28 -0
package/dist/cli.js
CHANGED
|
@@ -171242,17 +171242,50 @@ var init_utxoCache = __esm(() => {
|
|
|
171242
171242
|
};
|
|
171243
171243
|
});
|
|
171244
171244
|
|
|
171245
|
-
// ../
|
|
171246
|
-
|
|
171247
|
-
|
|
171248
|
-
|
|
171245
|
+
// ../api/xverse/account.ts
|
|
171246
|
+
function createAccountMethods({ authenticatedClient }) {
|
|
171247
|
+
const account2 = {
|
|
171248
|
+
fetchAddressBtcHistory: async (addresses, options) => {
|
|
171249
|
+
const response = await authenticatedClient.get(`/v1/account/history`, {
|
|
171250
|
+
params: {
|
|
171251
|
+
addresses,
|
|
171252
|
+
...options
|
|
171253
|
+
}
|
|
171254
|
+
});
|
|
171255
|
+
return response.data;
|
|
171256
|
+
},
|
|
171257
|
+
fetchAccountBtcHistory: async (acct, options) => {
|
|
171258
|
+
const addresses = Object.values(acct.btcAddresses).map((a) => a.address);
|
|
171259
|
+
return account2.fetchAddressBtcHistory(addresses, options);
|
|
171260
|
+
},
|
|
171261
|
+
getGlobalTxHistory: async (params) => {
|
|
171262
|
+
if (!params.cursor && !params.addresses.bitcoin && !params.addresses.stacks && !params.addresses.starknet && !params.addresses.spark) {
|
|
171263
|
+
throw new Error("At least one address is required");
|
|
171264
|
+
}
|
|
171265
|
+
const body = params.cursor ? {
|
|
171266
|
+
type: "cursor",
|
|
171267
|
+
cursor: params.cursor,
|
|
171268
|
+
limit: params.limit,
|
|
171269
|
+
filter: params.filter
|
|
171270
|
+
} : {
|
|
171271
|
+
type: "initial",
|
|
171272
|
+
addresses: {
|
|
171273
|
+
bitcoin: params.addresses.bitcoin,
|
|
171274
|
+
stacks: params.addresses.stacks,
|
|
171275
|
+
starknet: params.addresses.starknet ? {
|
|
171276
|
+
address: params.addresses.starknet
|
|
171277
|
+
} : undefined,
|
|
171278
|
+
spark: params.addresses.spark
|
|
171279
|
+
},
|
|
171280
|
+
limit: params.limit,
|
|
171281
|
+
filter: params.filter
|
|
171282
|
+
};
|
|
171283
|
+
const result = await authenticatedClient.post("/v2/global-history", body);
|
|
171284
|
+
return result.data;
|
|
171285
|
+
}
|
|
171286
|
+
};
|
|
171287
|
+
return account2;
|
|
171249
171288
|
}
|
|
171250
|
-
var accountIdBrandName = "AccountId", accountIdSchema;
|
|
171251
|
-
var init_accountId = __esm(() => {
|
|
171252
|
-
init_sha22();
|
|
171253
|
-
init_utils6();
|
|
171254
|
-
accountIdSchema = v6.pipe(v6.string(), v6.brand(accountIdBrandName));
|
|
171255
|
-
});
|
|
171256
171289
|
|
|
171257
171290
|
// ../api/xverse/addressRegistrar/base.ts
|
|
171258
171291
|
class BaseAddressRegistrar {
|
|
@@ -171702,7 +171735,7 @@ var require_utils16 = __commonJS((exports) => {
|
|
|
171702
171735
|
exports.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
171703
171736
|
if (!exports.isLE)
|
|
171704
171737
|
throw new Error("Non little-endian hardware is not supported");
|
|
171705
|
-
var hexes4 = Array.from({ length: 256 }, (
|
|
171738
|
+
var hexes4 = Array.from({ length: 256 }, (v6, i) => i.toString(16).padStart(2, "0"));
|
|
171706
171739
|
function bytesToHex5(uint8a) {
|
|
171707
171740
|
if (!(uint8a instanceof Uint8Array))
|
|
171708
171741
|
throw new Error("Uint8Array expected");
|
|
@@ -173105,12 +173138,12 @@ var require_utils17 = __commonJS((exports) => {
|
|
|
173105
173138
|
return encodedLength;
|
|
173106
173139
|
}
|
|
173107
173140
|
exports.getBase64OutputLength = getBase64OutputLength;
|
|
173108
|
-
function hashCode(
|
|
173141
|
+
function hashCode(string6) {
|
|
173109
173142
|
let hash3 = 0;
|
|
173110
|
-
if (
|
|
173143
|
+
if (string6.length === 0)
|
|
173111
173144
|
return hash3;
|
|
173112
|
-
for (let i = 0;i <
|
|
173113
|
-
const character =
|
|
173145
|
+
for (let i = 0;i < string6.length; i++) {
|
|
173146
|
+
const character = string6.charCodeAt(i);
|
|
173114
173147
|
hash3 = (hash3 << 5) - hash3 + character;
|
|
173115
173148
|
hash3 &= hash3;
|
|
173116
173149
|
}
|
|
@@ -173855,8 +173888,8 @@ var require_lib11 = __commonJS((exports) => {
|
|
|
173855
173888
|
chk = bech32Polymod2(chk);
|
|
173856
173889
|
for (let i = 0;i < len; i++)
|
|
173857
173890
|
chk = bech32Polymod2(chk) ^ prefix2.charCodeAt(i) & 31;
|
|
173858
|
-
for (let
|
|
173859
|
-
chk = bech32Polymod2(chk) ^
|
|
173891
|
+
for (let v6 of words)
|
|
173892
|
+
chk = bech32Polymod2(chk) ^ v6;
|
|
173860
173893
|
for (let i = 0;i < 6; i++)
|
|
173861
173894
|
chk = bech32Polymod2(chk);
|
|
173862
173895
|
chk ^= encodingConst;
|
|
@@ -176407,7 +176440,7 @@ var require_utils18 = __commonJS((exports) => {
|
|
|
176407
176440
|
exports.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
176408
176441
|
if (!exports.isLE)
|
|
176409
176442
|
throw new Error("Non little-endian hardware is not supported");
|
|
176410
|
-
var hexes4 = Array.from({ length: 256 }, (
|
|
176443
|
+
var hexes4 = Array.from({ length: 256 }, (v6, i) => i.toString(16).padStart(2, "0"));
|
|
176411
176444
|
function bytesToHex5(uint8a) {
|
|
176412
176445
|
if (!(uint8a instanceof Uint8Array))
|
|
176413
176446
|
throw new Error("Uint8Array expected");
|
|
@@ -177636,8 +177669,8 @@ var require_lib12 = __commonJS((exports) => {
|
|
|
177636
177669
|
chk = bech32Polymod2(chk);
|
|
177637
177670
|
for (let i = 0;i < len; i++)
|
|
177638
177671
|
chk = bech32Polymod2(chk) ^ prefix2.charCodeAt(i) & 31;
|
|
177639
|
-
for (let
|
|
177640
|
-
chk = bech32Polymod2(chk) ^
|
|
177672
|
+
for (let v6 of words)
|
|
177673
|
+
chk = bech32Polymod2(chk) ^ v6;
|
|
177641
177674
|
for (let i = 0;i < 6; i++)
|
|
177642
177675
|
chk = bech32Polymod2(chk);
|
|
177643
177676
|
chk ^= encodingConst;
|
|
@@ -182415,8 +182448,8 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
182415
182448
|
var _iteratee = wrapAsync2(iteratee);
|
|
182416
182449
|
eachfn(arr, function(value, _, callback2) {
|
|
182417
182450
|
var index2 = counter++;
|
|
182418
|
-
_iteratee(value, function(err2,
|
|
182419
|
-
results[index2] =
|
|
182451
|
+
_iteratee(value, function(err2, v6) {
|
|
182452
|
+
results[index2] = v6;
|
|
182420
182453
|
callback2(err2);
|
|
182421
182454
|
});
|
|
182422
182455
|
}, function(err2) {
|
|
@@ -182674,8 +182707,8 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
182674
182707
|
while (++index2 < length && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) {}
|
|
182675
182708
|
return index2;
|
|
182676
182709
|
}
|
|
182677
|
-
function asciiToArray(
|
|
182678
|
-
return
|
|
182710
|
+
function asciiToArray(string6) {
|
|
182711
|
+
return string6.split("");
|
|
182679
182712
|
}
|
|
182680
182713
|
var rsAstralRange = "\\ud800-\\udfff";
|
|
182681
182714
|
var rsComboMarksRange = "\\u0300-\\u036f";
|
|
@@ -182685,8 +182718,8 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
182685
182718
|
var rsVarRange = "\\ufe0e\\ufe0f";
|
|
182686
182719
|
var rsZWJ = "\\u200d";
|
|
182687
182720
|
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
|
|
182688
|
-
function hasUnicode(
|
|
182689
|
-
return reHasUnicode.test(
|
|
182721
|
+
function hasUnicode(string6) {
|
|
182722
|
+
return reHasUnicode.test(string6);
|
|
182690
182723
|
}
|
|
182691
182724
|
var rsAstralRange$1 = "\\ud800-\\udfff";
|
|
182692
182725
|
var rsComboMarksRange$1 = "\\u0300-\\u036f";
|
|
@@ -182708,25 +182741,25 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
182708
182741
|
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
|
|
182709
182742
|
var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
|
|
182710
182743
|
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
|
|
182711
|
-
function unicodeToArray(
|
|
182712
|
-
return
|
|
182744
|
+
function unicodeToArray(string6) {
|
|
182745
|
+
return string6.match(reUnicode) || [];
|
|
182713
182746
|
}
|
|
182714
|
-
function stringToArray(
|
|
182715
|
-
return hasUnicode(
|
|
182747
|
+
function stringToArray(string6) {
|
|
182748
|
+
return hasUnicode(string6) ? unicodeToArray(string6) : asciiToArray(string6);
|
|
182716
182749
|
}
|
|
182717
182750
|
function toString4(value) {
|
|
182718
182751
|
return value == null ? "" : baseToString(value);
|
|
182719
182752
|
}
|
|
182720
182753
|
var reTrim = /^\s+|\s+$/g;
|
|
182721
|
-
function trim3(
|
|
182722
|
-
|
|
182723
|
-
if (
|
|
182724
|
-
return
|
|
182754
|
+
function trim3(string6, chars2, guard) {
|
|
182755
|
+
string6 = toString4(string6);
|
|
182756
|
+
if (string6 && (guard || chars2 === undefined)) {
|
|
182757
|
+
return string6.replace(reTrim, "");
|
|
182725
182758
|
}
|
|
182726
|
-
if (!
|
|
182727
|
-
return
|
|
182759
|
+
if (!string6 || !(chars2 = baseToString(chars2))) {
|
|
182760
|
+
return string6;
|
|
182728
182761
|
}
|
|
182729
|
-
var strSymbols = stringToArray(
|
|
182762
|
+
var strSymbols = stringToArray(string6), chrSymbols = stringToArray(chars2), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
|
|
182730
182763
|
return castSlice(strSymbols, start, end).join("");
|
|
182731
182764
|
}
|
|
182732
182765
|
var FN_ARGS = /^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m;
|
|
@@ -183011,8 +183044,8 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
183011
183044
|
callback = once(callback || noop2);
|
|
183012
183045
|
var _iteratee = wrapAsync2(iteratee);
|
|
183013
183046
|
eachOfSeries(coll, function(x, i, callback2) {
|
|
183014
|
-
_iteratee(memo, x, function(err2,
|
|
183015
|
-
memo =
|
|
183047
|
+
_iteratee(memo, x, function(err2, v6) {
|
|
183048
|
+
memo = v6;
|
|
183016
183049
|
callback2(err2);
|
|
183017
183050
|
});
|
|
183018
183051
|
}, function(err2) {
|
|
@@ -183102,7 +183135,7 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
183102
183135
|
});
|
|
183103
183136
|
};
|
|
183104
183137
|
}
|
|
183105
|
-
function _findGetResult(
|
|
183138
|
+
function _findGetResult(v6, x) {
|
|
183106
183139
|
return x;
|
|
183107
183140
|
}
|
|
183108
183141
|
var detect = doParallel(_createTester(identity, _findGetResult));
|
|
@@ -183216,8 +183249,8 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
183216
183249
|
sync = false;
|
|
183217
183250
|
});
|
|
183218
183251
|
}
|
|
183219
|
-
function notId(
|
|
183220
|
-
return !
|
|
183252
|
+
function notId(v6) {
|
|
183253
|
+
return !v6;
|
|
183221
183254
|
}
|
|
183222
183255
|
var every = doParallel(_createTester(notId, notId));
|
|
183223
183256
|
var everyLimit = doParallelLimit(_createTester(notId, notId));
|
|
@@ -183230,8 +183263,8 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
183230
183263
|
function filterArray(eachfn, arr, iteratee, callback) {
|
|
183231
183264
|
var truthValues = new Array(arr.length);
|
|
183232
183265
|
eachfn(arr, function(x, index2, callback2) {
|
|
183233
|
-
iteratee(x, function(err2,
|
|
183234
|
-
truthValues[index2] = !!
|
|
183266
|
+
iteratee(x, function(err2, v6) {
|
|
183267
|
+
truthValues[index2] = !!v6;
|
|
183235
183268
|
callback2(err2);
|
|
183236
183269
|
});
|
|
183237
183270
|
}, function(err2) {
|
|
@@ -183248,11 +183281,11 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
183248
183281
|
function filterGeneric(eachfn, coll, iteratee, callback) {
|
|
183249
183282
|
var results = [];
|
|
183250
183283
|
eachfn(coll, function(x, index2, callback2) {
|
|
183251
|
-
iteratee(x, function(err2,
|
|
183284
|
+
iteratee(x, function(err2, v6) {
|
|
183252
183285
|
if (err2) {
|
|
183253
183286
|
callback2(err2);
|
|
183254
183287
|
} else {
|
|
183255
|
-
if (
|
|
183288
|
+
if (v6) {
|
|
183256
183289
|
results.push({ index: index2, value: x });
|
|
183257
183290
|
}
|
|
183258
183291
|
callback2();
|
|
@@ -183486,8 +183519,8 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
183486
183519
|
}
|
|
183487
183520
|
function reject$1(eachfn, arr, iteratee, callback) {
|
|
183488
183521
|
_filter(eachfn, arr, function(value, cb) {
|
|
183489
|
-
iteratee(value, function(err2,
|
|
183490
|
-
cb(err2, !
|
|
183522
|
+
iteratee(value, function(err2, v6) {
|
|
183523
|
+
cb(err2, !v6);
|
|
183491
183524
|
});
|
|
183492
183525
|
}, callback);
|
|
183493
183526
|
}
|
|
@@ -183629,8 +183662,8 @@ var require_async3 = __commonJS((exports, module) => {
|
|
|
183629
183662
|
}
|
|
183630
183663
|
callback = once(callback || noop2);
|
|
183631
183664
|
var _iteratee = wrapAsync2(iteratee);
|
|
183632
|
-
eachOf(coll, function(
|
|
183633
|
-
_iteratee(accumulator,
|
|
183665
|
+
eachOf(coll, function(v6, k, cb) {
|
|
183666
|
+
_iteratee(accumulator, v6, k, cb);
|
|
183634
183667
|
}, function(err2) {
|
|
183635
183668
|
callback(err2, accumulator);
|
|
183636
183669
|
});
|
|
@@ -185390,10 +185423,10 @@ var require_profile = __commonJS((exports) => {
|
|
|
185390
185423
|
k2 = k;
|
|
185391
185424
|
o[k2] = m[k];
|
|
185392
185425
|
});
|
|
185393
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
185394
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
185395
|
-
} : function(o,
|
|
185396
|
-
o["default"] =
|
|
185426
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v6) {
|
|
185427
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v6 });
|
|
185428
|
+
} : function(o, v6) {
|
|
185429
|
+
o["default"] = v6;
|
|
185397
185430
|
});
|
|
185398
185431
|
var __importStar = exports && exports.__importStar || function(mod5) {
|
|
185399
185432
|
if (mod5 && mod5.__esModule)
|
|
@@ -185806,10 +185839,10 @@ var require_userSession = __commonJS((exports) => {
|
|
|
185806
185839
|
k2 = k;
|
|
185807
185840
|
o[k2] = m[k];
|
|
185808
185841
|
});
|
|
185809
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
185810
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
185811
|
-
} : function(o,
|
|
185812
|
-
o["default"] =
|
|
185842
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v6) {
|
|
185843
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v6 });
|
|
185844
|
+
} : function(o, v6) {
|
|
185845
|
+
o["default"] = v6;
|
|
185813
185846
|
});
|
|
185814
185847
|
var __importStar = exports && exports.__importStar || function(mod5) {
|
|
185815
185848
|
if (mod5 && mod5.__esModule)
|
|
@@ -188366,13 +188399,13 @@ function invert4(number2, modulo = CURVE2.P) {
|
|
|
188366
188399
|
}
|
|
188367
188400
|
let a = mod5(number2, modulo);
|
|
188368
188401
|
let b = modulo;
|
|
188369
|
-
let x = _0n15, y = _1n15, u = _1n15,
|
|
188402
|
+
let x = _0n15, y = _1n15, u = _1n15, v6 = _0n15;
|
|
188370
188403
|
while (a !== _0n15) {
|
|
188371
188404
|
const q = b / a;
|
|
188372
188405
|
const r = b % a;
|
|
188373
188406
|
const m = x - u * q;
|
|
188374
|
-
const n = y -
|
|
188375
|
-
b = a, a = r, x = u, y =
|
|
188407
|
+
const n = y - v6 * q;
|
|
188408
|
+
b = a, a = r, x = u, y = v6, u = m, v6 = n;
|
|
188376
188409
|
}
|
|
188377
188410
|
const gcd2 = b;
|
|
188378
188411
|
if (gcd2 !== _1n15)
|
|
@@ -188646,7 +188679,7 @@ var init_esm8 = __esm(() => {
|
|
|
188646
188679
|
pointPrecomputes4 = new WeakMap;
|
|
188647
188680
|
Point3.BASE = new Point3(CURVE2.Gx, CURVE2.Gy);
|
|
188648
188681
|
Point3.ZERO = new Point3(_0n15, _0n15);
|
|
188649
|
-
hexes4 = Array.from({ length: 256 }, (
|
|
188682
|
+
hexes4 = Array.from({ length: 256 }, (v6, i) => i.toString(16).padStart(2, "0"));
|
|
188650
188683
|
POW_2_256 = BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");
|
|
188651
188684
|
schnorr3 = {
|
|
188652
188685
|
Signature: SchnorrSignature,
|
|
@@ -190771,14 +190804,14 @@ var require_base2 = __commonJS((exports, module) => {
|
|
|
190771
190804
|
return;
|
|
190772
190805
|
return payload;
|
|
190773
190806
|
}
|
|
190774
|
-
function decodeUnsafe(
|
|
190775
|
-
var buffer = base582.decodeUnsafe(
|
|
190807
|
+
function decodeUnsafe(string6) {
|
|
190808
|
+
var buffer = base582.decodeUnsafe(string6);
|
|
190776
190809
|
if (!buffer)
|
|
190777
190810
|
return;
|
|
190778
190811
|
return decodeRaw(buffer);
|
|
190779
190812
|
}
|
|
190780
|
-
function decode3(
|
|
190781
|
-
var buffer = base582.decode(
|
|
190813
|
+
function decode3(string6) {
|
|
190814
|
+
var buffer = base582.decode(string6);
|
|
190782
190815
|
var payload = decodeRaw(buffer, checksumFn);
|
|
190783
190816
|
if (!payload)
|
|
190784
190817
|
throw new Error("Invalid checksum");
|
|
@@ -193055,7 +193088,7 @@ var require_globalXpub = __commonJS((exports) => {
|
|
|
193055
193088
|
if (dupeSet.has(dupeString))
|
|
193056
193089
|
return false;
|
|
193057
193090
|
dupeSet.add(dupeString);
|
|
193058
|
-
return array4.filter((
|
|
193091
|
+
return array4.filter((v6) => v6.extendedPubkey.equals(item.extendedPubkey)).length === 0;
|
|
193059
193092
|
}
|
|
193060
193093
|
exports.canAddToArray = canAddToArray;
|
|
193061
193094
|
});
|
|
@@ -193219,7 +193252,7 @@ var require_partialSig = __commonJS((exports) => {
|
|
|
193219
193252
|
if (dupeSet.has(dupeString))
|
|
193220
193253
|
return false;
|
|
193221
193254
|
dupeSet.add(dupeString);
|
|
193222
|
-
return array4.filter((
|
|
193255
|
+
return array4.filter((v6) => v6.pubkey.equals(item.pubkey)).length === 0;
|
|
193223
193256
|
}
|
|
193224
193257
|
exports.canAddToArray = canAddToArray;
|
|
193225
193258
|
});
|
|
@@ -193355,7 +193388,7 @@ var require_tapLeafScript = __commonJS((exports) => {
|
|
|
193355
193388
|
if (dupeSet.has(dupeString))
|
|
193356
193389
|
return false;
|
|
193357
193390
|
dupeSet.add(dupeString);
|
|
193358
|
-
return array4.filter((
|
|
193391
|
+
return array4.filter((v6) => v6.controlBlock.equals(item.controlBlock)).length === 0;
|
|
193359
193392
|
}
|
|
193360
193393
|
exports.canAddToArray = canAddToArray;
|
|
193361
193394
|
});
|
|
@@ -193431,7 +193464,7 @@ var require_tapScriptSig = __commonJS((exports) => {
|
|
|
193431
193464
|
if (dupeSet.has(dupeString))
|
|
193432
193465
|
return false;
|
|
193433
193466
|
dupeSet.add(dupeString);
|
|
193434
|
-
return array4.filter((
|
|
193467
|
+
return array4.filter((v6) => v6.pubkey.equals(item.pubkey) && v6.leafHash.equals(item.leafHash)).length === 0;
|
|
193435
193468
|
}
|
|
193436
193469
|
exports.canAddToArray = canAddToArray;
|
|
193437
193470
|
});
|
|
@@ -193726,7 +193759,7 @@ var require_bip32Derivation = __commonJS((exports) => {
|
|
|
193726
193759
|
if (dupeSet.has(dupeString))
|
|
193727
193760
|
return false;
|
|
193728
193761
|
dupeSet.add(dupeString);
|
|
193729
|
-
return array4.filter((
|
|
193762
|
+
return array4.filter((v6) => v6.pubkey.equals(item.pubkey)).length === 0;
|
|
193730
193763
|
}
|
|
193731
193764
|
return {
|
|
193732
193765
|
decode: decode3,
|
|
@@ -194467,7 +194500,7 @@ var require_utils20 = __commonJS((exports) => {
|
|
|
194467
194500
|
}
|
|
194468
194501
|
const arr = mainData[name] || [];
|
|
194469
194502
|
const dupeCheckSet = new Set;
|
|
194470
|
-
if (!data.every((
|
|
194503
|
+
if (!data.every((v6) => canAddToArray(arr, v6, dupeCheckSet))) {
|
|
194471
194504
|
throw new Error("Can not add duplicate data to array");
|
|
194472
194505
|
}
|
|
194473
194506
|
mainData[name] = arr.concat(data);
|
|
@@ -195358,7 +195391,7 @@ var require_psbt2 = __commonJS((exports) => {
|
|
|
195358
195391
|
results.push(false);
|
|
195359
195392
|
}
|
|
195360
195393
|
}
|
|
195361
|
-
if (results.every((
|
|
195394
|
+
if (results.every((v6) => v6 === false)) {
|
|
195362
195395
|
throw new Error("No inputs were signed");
|
|
195363
195396
|
}
|
|
195364
195397
|
return this;
|
|
@@ -195378,7 +195411,7 @@ var require_psbt2 = __commonJS((exports) => {
|
|
|
195378
195411
|
}));
|
|
195379
195412
|
}
|
|
195380
195413
|
return Promise.all(promises).then(() => {
|
|
195381
|
-
if (results.every((
|
|
195414
|
+
if (results.every((v6) => v6 === false)) {
|
|
195382
195415
|
return reject(new Error("No inputs were signed"));
|
|
195383
195416
|
}
|
|
195384
195417
|
resolve();
|
|
@@ -195417,7 +195450,7 @@ var require_psbt2 = __commonJS((exports) => {
|
|
|
195417
195450
|
results.push(false);
|
|
195418
195451
|
}
|
|
195419
195452
|
}
|
|
195420
|
-
if (results.every((
|
|
195453
|
+
if (results.every((v6) => v6 === false)) {
|
|
195421
195454
|
throw new Error("No inputs were signed");
|
|
195422
195455
|
}
|
|
195423
195456
|
return this;
|
|
@@ -195436,7 +195469,7 @@ var require_psbt2 = __commonJS((exports) => {
|
|
|
195436
195469
|
}));
|
|
195437
195470
|
}
|
|
195438
195471
|
return Promise.all(promises).then(() => {
|
|
195439
|
-
if (results.every((
|
|
195472
|
+
if (results.every((v6) => v6 === false)) {
|
|
195440
195473
|
return reject(new Error("No inputs were signed"));
|
|
195441
195474
|
}
|
|
195442
195475
|
resolve();
|
|
@@ -195548,7 +195581,7 @@ var require_psbt2 = __commonJS((exports) => {
|
|
|
195548
195581
|
signaturePromises.push(...tapScriptSigPromises);
|
|
195549
195582
|
}
|
|
195550
195583
|
return Promise.all(signaturePromises).then((results) => {
|
|
195551
|
-
results.forEach((
|
|
195584
|
+
results.forEach((v6) => this.data.updateInput(inputIndex, v6));
|
|
195552
195585
|
});
|
|
195553
195586
|
}
|
|
195554
195587
|
checkTaprootHashesForSig(inputIndex, input, keyPair, tapLeafHashToSign, allowedSighashTypes) {
|
|
@@ -195669,7 +195702,7 @@ var require_psbt2 = __commonJS((exports) => {
|
|
|
195669
195702
|
sigs = pubkeys.map((pkey) => {
|
|
195670
195703
|
const pubkey = compressPubkey(pkey);
|
|
195671
195704
|
return partialSig.find((pSig) => pSig.pubkey.equals(pubkey));
|
|
195672
|
-
}).filter((
|
|
195705
|
+
}).filter((v6) => !!v6);
|
|
195673
195706
|
} else {
|
|
195674
195707
|
sigs = partialSig;
|
|
195675
195708
|
}
|
|
@@ -195992,7 +196025,7 @@ PROCEED WITH CAUTION!
|
|
|
195992
196025
|
} else {
|
|
195993
196026
|
return;
|
|
195994
196027
|
}
|
|
195995
|
-
}).filter((
|
|
196028
|
+
}).filter((v6) => !!v6);
|
|
195996
196029
|
if (myDerivations.length === 0) {
|
|
195997
196030
|
throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");
|
|
195998
196031
|
}
|
|
@@ -196011,7 +196044,7 @@ PROCEED WITH CAUTION!
|
|
|
196011
196044
|
return (partialSig.filter((ps) => {
|
|
196012
196045
|
return ps.pubkey.equals(pk);
|
|
196013
196046
|
})[0] || {}).signature;
|
|
196014
|
-
}).filter((
|
|
196047
|
+
}).filter((v6) => !!v6);
|
|
196015
196048
|
}
|
|
196016
196049
|
function scriptWitnessToWitnessStack(buffer) {
|
|
196017
196050
|
let offset = 0;
|
|
@@ -196307,8 +196340,8 @@ var require_bech32 = __commonJS((exports, module) => {
|
|
|
196307
196340
|
}
|
|
196308
196341
|
chk = polymodStep(chk);
|
|
196309
196342
|
for (i = 0;i < prefix2.length; ++i) {
|
|
196310
|
-
var
|
|
196311
|
-
chk = polymodStep(chk) ^
|
|
196343
|
+
var v6 = prefix2.charCodeAt(i);
|
|
196344
|
+
chk = polymodStep(chk) ^ v6 & 31;
|
|
196312
196345
|
}
|
|
196313
196346
|
return chk;
|
|
196314
196347
|
}
|
|
@@ -196333,8 +196366,8 @@ var require_bech32 = __commonJS((exports, module) => {
|
|
|
196333
196366
|
}
|
|
196334
196367
|
chk ^= 1;
|
|
196335
196368
|
for (i = 0;i < 6; ++i) {
|
|
196336
|
-
var
|
|
196337
|
-
result += ALPHABET2.charAt(
|
|
196369
|
+
var v6 = chk >> (5 - i) * 5 & 31;
|
|
196370
|
+
result += ALPHABET2.charAt(v6);
|
|
196338
196371
|
}
|
|
196339
196372
|
return result;
|
|
196340
196373
|
}
|
|
@@ -196364,13 +196397,13 @@ var require_bech32 = __commonJS((exports, module) => {
|
|
|
196364
196397
|
var words = [];
|
|
196365
196398
|
for (var i = 0;i < wordChars.length; ++i) {
|
|
196366
196399
|
var c = wordChars.charAt(i);
|
|
196367
|
-
var
|
|
196368
|
-
if (
|
|
196400
|
+
var v6 = ALPHABET_MAP[c];
|
|
196401
|
+
if (v6 === undefined)
|
|
196369
196402
|
return "Unknown character " + c;
|
|
196370
|
-
chk = polymodStep(chk) ^
|
|
196403
|
+
chk = polymodStep(chk) ^ v6;
|
|
196371
196404
|
if (i + 6 >= wordChars.length)
|
|
196372
196405
|
continue;
|
|
196373
|
-
words.push(
|
|
196406
|
+
words.push(v6);
|
|
196374
196407
|
}
|
|
196375
196408
|
if (chk !== 1)
|
|
196376
196409
|
return "Invalid checksum for " + str;
|
|
@@ -197788,8 +197821,8 @@ var require_bn = __commonJS((exports, module) => {
|
|
|
197788
197821
|
}
|
|
197789
197822
|
return this.strip();
|
|
197790
197823
|
};
|
|
197791
|
-
function parseHex4Bits(
|
|
197792
|
-
var c =
|
|
197824
|
+
function parseHex4Bits(string6, index) {
|
|
197825
|
+
var c = string6.charCodeAt(index);
|
|
197793
197826
|
if (c >= 65 && c <= 70) {
|
|
197794
197827
|
return c - 55;
|
|
197795
197828
|
} else if (c >= 97 && c <= 102) {
|
|
@@ -197798,10 +197831,10 @@ var require_bn = __commonJS((exports, module) => {
|
|
|
197798
197831
|
return c - 48 & 15;
|
|
197799
197832
|
}
|
|
197800
197833
|
}
|
|
197801
|
-
function parseHexByte(
|
|
197802
|
-
var r = parseHex4Bits(
|
|
197834
|
+
function parseHexByte(string6, lowerBound, index) {
|
|
197835
|
+
var r = parseHex4Bits(string6, index);
|
|
197803
197836
|
if (index - 1 >= lowerBound) {
|
|
197804
|
-
r |= parseHex4Bits(
|
|
197837
|
+
r |= parseHex4Bits(string6, index - 1) << 4;
|
|
197805
197838
|
}
|
|
197806
197839
|
return r;
|
|
197807
197840
|
}
|
|
@@ -200681,8 +200714,8 @@ var require_bn2 = __commonJS((exports, module) => {
|
|
|
200681
200714
|
}
|
|
200682
200715
|
return this.strip();
|
|
200683
200716
|
};
|
|
200684
|
-
function parseHex4Bits(
|
|
200685
|
-
var c =
|
|
200717
|
+
function parseHex4Bits(string6, index) {
|
|
200718
|
+
var c = string6.charCodeAt(index);
|
|
200686
200719
|
if (c >= 65 && c <= 70) {
|
|
200687
200720
|
return c - 55;
|
|
200688
200721
|
} else if (c >= 97 && c <= 102) {
|
|
@@ -200691,10 +200724,10 @@ var require_bn2 = __commonJS((exports, module) => {
|
|
|
200691
200724
|
return c - 48 & 15;
|
|
200692
200725
|
}
|
|
200693
200726
|
}
|
|
200694
|
-
function parseHexByte(
|
|
200695
|
-
var r = parseHex4Bits(
|
|
200727
|
+
function parseHexByte(string6, lowerBound, index) {
|
|
200728
|
+
var r = parseHex4Bits(string6, index);
|
|
200696
200729
|
if (index - 1 >= lowerBound) {
|
|
200697
|
-
r |= parseHex4Bits(
|
|
200730
|
+
r |= parseHex4Bits(string6, index - 1) << 4;
|
|
200698
200731
|
}
|
|
200699
200732
|
return r;
|
|
200700
200733
|
}
|
|
@@ -204001,7 +204034,7 @@ var require_short = __commonJS((exports, module) => {
|
|
|
204001
204034
|
ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
|
|
204002
204035
|
var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
|
|
204003
204036
|
var u = lambda;
|
|
204004
|
-
var
|
|
204037
|
+
var v6 = this.n.clone();
|
|
204005
204038
|
var x1 = new BN2(1);
|
|
204006
204039
|
var y1 = new BN2(0);
|
|
204007
204040
|
var x2 = new BN2(0);
|
|
@@ -204017,8 +204050,8 @@ var require_short = __commonJS((exports, module) => {
|
|
|
204017
204050
|
var r;
|
|
204018
204051
|
var x;
|
|
204019
204052
|
while (u.cmpn(0) !== 0) {
|
|
204020
|
-
var q =
|
|
204021
|
-
r =
|
|
204053
|
+
var q = v6.div(u);
|
|
204054
|
+
r = v6.sub(q.mul(u));
|
|
204022
204055
|
x = x2.sub(q.mul(x1));
|
|
204023
204056
|
var y = y2.sub(q.mul(y1));
|
|
204024
204057
|
if (!a1 && r.cmp(aprxSqrt) < 0) {
|
|
@@ -204030,7 +204063,7 @@ var require_short = __commonJS((exports, module) => {
|
|
|
204030
204063
|
break;
|
|
204031
204064
|
}
|
|
204032
204065
|
prevR = r;
|
|
204033
|
-
|
|
204066
|
+
v6 = u;
|
|
204034
204067
|
u = r;
|
|
204035
204068
|
x2 = x1;
|
|
204036
204069
|
x1 = x;
|
|
@@ -204372,9 +204405,9 @@ var require_short = __commonJS((exports, module) => {
|
|
|
204372
204405
|
}
|
|
204373
204406
|
var h2 = h.redSqr();
|
|
204374
204407
|
var h3 = h2.redMul(h);
|
|
204375
|
-
var
|
|
204376
|
-
var nx = r.redSqr().redIAdd(h3).redISub(
|
|
204377
|
-
var ny = r.redMul(
|
|
204408
|
+
var v6 = u1.redMul(h2);
|
|
204409
|
+
var nx = r.redSqr().redIAdd(h3).redISub(v6).redISub(v6);
|
|
204410
|
+
var ny = r.redMul(v6.redISub(nx)).redISub(s1.redMul(h3));
|
|
204378
204411
|
var nz = this.z.redMul(p.z).redMul(h);
|
|
204379
204412
|
return this.curve.jpoint(nx, ny, nz);
|
|
204380
204413
|
};
|
|
@@ -204398,9 +204431,9 @@ var require_short = __commonJS((exports, module) => {
|
|
|
204398
204431
|
}
|
|
204399
204432
|
var h2 = h.redSqr();
|
|
204400
204433
|
var h3 = h2.redMul(h);
|
|
204401
|
-
var
|
|
204402
|
-
var nx = r.redSqr().redIAdd(h3).redISub(
|
|
204403
|
-
var ny = r.redMul(
|
|
204434
|
+
var v6 = u1.redMul(h2);
|
|
204435
|
+
var nx = r.redSqr().redIAdd(h3).redISub(v6).redISub(v6);
|
|
204436
|
+
var ny = r.redMul(v6.redISub(nx)).redISub(s1.redMul(h3));
|
|
204404
204437
|
var nz = this.z.redMul(h);
|
|
204405
204438
|
return this.curve.jpoint(nx, ny, nz);
|
|
204406
204439
|
};
|
|
@@ -208976,6 +209009,180 @@ var init_addressRegistrar = __esm(() => {
|
|
|
208976
209009
|
addressRegistrar_default = { LedgerAddressRegistrar, SoftwareAddressRegistrar };
|
|
208977
209010
|
});
|
|
208978
209011
|
|
|
209012
|
+
// ../api/xverse/app.ts
|
|
209013
|
+
function createAppMethods({ client: client2, network: network2 }) {
|
|
209014
|
+
return {
|
|
209015
|
+
fetchAppInfo: async () => {
|
|
209016
|
+
const response = await client2.get("/v1/info");
|
|
209017
|
+
return response.data;
|
|
209018
|
+
},
|
|
209019
|
+
getAppConfig: async () => {
|
|
209020
|
+
const response = await client2.get(`/v1/app-config`);
|
|
209021
|
+
return response;
|
|
209022
|
+
},
|
|
209023
|
+
getAppFeatures: async (context, headers) => {
|
|
209024
|
+
const response = await client2.post("/v1/app-features", { context: { ...context, network: network2 } }, { headers });
|
|
209025
|
+
return response.data;
|
|
209026
|
+
},
|
|
209027
|
+
getFeaturedDapps: async () => {
|
|
209028
|
+
const response = await client2.get(`/v2/featured/dapp`);
|
|
209029
|
+
return response.data.featuredDapp;
|
|
209030
|
+
},
|
|
209031
|
+
getNotificationBanners: async () => {
|
|
209032
|
+
const response = await client2.get(`/v2/notification-banners`);
|
|
209033
|
+
return response.data.notificationBanners;
|
|
209034
|
+
}
|
|
209035
|
+
};
|
|
209036
|
+
}
|
|
209037
|
+
|
|
209038
|
+
// ../permissions/utils/accountId.ts
|
|
209039
|
+
import * as v6 from "valibot";
|
|
209040
|
+
function makeAccountId(options) {
|
|
209041
|
+
return v6.parse(accountIdSchema, bytesToHex2(sha2562(`account-${options.masterPubKey}-${options.derivationIndex}-${options.derivationType}`)));
|
|
209042
|
+
}
|
|
209043
|
+
var accountIdBrandName = "AccountId", accountIdSchema;
|
|
209044
|
+
var init_accountId = __esm(() => {
|
|
209045
|
+
init_sha22();
|
|
209046
|
+
init_utils6();
|
|
209047
|
+
accountIdSchema = v6.pipe(v6.string(), v6.brand(accountIdBrandName));
|
|
209048
|
+
});
|
|
209049
|
+
|
|
209050
|
+
// ../api/xverse/auth.ts
|
|
209051
|
+
function createAuthMethods({ authenticatedClient }) {
|
|
209052
|
+
return {
|
|
209053
|
+
ensureAccountRegistered: async (account2) => {
|
|
209054
|
+
const accountId = makeAccountId({
|
|
209055
|
+
derivationIndex: account2.id,
|
|
209056
|
+
derivationType: account2.derivationType,
|
|
209057
|
+
masterPubKey: account2.masterPubKey
|
|
209058
|
+
});
|
|
209059
|
+
if (account2.accountType === "software") {
|
|
209060
|
+
const addressDetails = [
|
|
209061
|
+
...Object.values(account2.btcAddresses).map((a) => ({
|
|
209062
|
+
address: a.address,
|
|
209063
|
+
chain: "btc",
|
|
209064
|
+
accountId
|
|
209065
|
+
}))
|
|
209066
|
+
];
|
|
209067
|
+
if (account2.stxAddress) {
|
|
209068
|
+
addressDetails.push({
|
|
209069
|
+
address: account2.stxAddress,
|
|
209070
|
+
chain: "stacks",
|
|
209071
|
+
accountId
|
|
209072
|
+
});
|
|
209073
|
+
}
|
|
209074
|
+
if (account2.spark && account2.spark.address) {
|
|
209075
|
+
addressDetails.push({
|
|
209076
|
+
address: account2.spark.address,
|
|
209077
|
+
chain: "spark",
|
|
209078
|
+
accountId
|
|
209079
|
+
});
|
|
209080
|
+
}
|
|
209081
|
+
if (account2.strkAddresses) {
|
|
209082
|
+
Object.values(account2.strkAddresses).forEach(({ address }) => {
|
|
209083
|
+
addressDetails.push({
|
|
209084
|
+
address,
|
|
209085
|
+
chain: "starknet",
|
|
209086
|
+
accountId
|
|
209087
|
+
});
|
|
209088
|
+
});
|
|
209089
|
+
}
|
|
209090
|
+
try {
|
|
209091
|
+
await authenticatedClient.extendAddresses(addressDetails);
|
|
209092
|
+
} catch (error3) {
|
|
209093
|
+
console.warn("Failed to extend auth addresses:", error3);
|
|
209094
|
+
}
|
|
209095
|
+
}
|
|
209096
|
+
const addresses = Object.values(account2.btcAddresses).map((a) => a.address);
|
|
209097
|
+
const alreadyAuthorized = await authenticatedClient.hasScope(addresses);
|
|
209098
|
+
if (alreadyAuthorized) {
|
|
209099
|
+
return;
|
|
209100
|
+
}
|
|
209101
|
+
if (account2.accountType === "ledger" || account2.accountType === "keystone") {
|
|
209102
|
+
const addressesToRegister = Object.values(account2.btcAddresses).map((a) => a.address);
|
|
209103
|
+
const addressDetails = [
|
|
209104
|
+
...addressesToRegister.map((addr) => ({
|
|
209105
|
+
address: addr,
|
|
209106
|
+
chain: "btc",
|
|
209107
|
+
accountId
|
|
209108
|
+
}))
|
|
209109
|
+
];
|
|
209110
|
+
await authenticatedClient.extendAddresses(addressDetails);
|
|
209111
|
+
return authenticatedClient.extend(addressesToRegister);
|
|
209112
|
+
}
|
|
209113
|
+
return authenticatedClient.extendSoftwareAccountScope(account2);
|
|
209114
|
+
},
|
|
209115
|
+
batchEnsureSoftwareAccountRegistered: async (accounts, config2) => {
|
|
209116
|
+
const walletId = accounts[0].walletId;
|
|
209117
|
+
const isThereAnyAccountWithDifferentWalletId = accounts.some((account2) => account2.walletId !== walletId);
|
|
209118
|
+
if (isThereAnyAccountWithDifferentWalletId) {
|
|
209119
|
+
throw new Error("All accounts must belong to the same wallet");
|
|
209120
|
+
}
|
|
209121
|
+
const addresses = accounts.map((account2) => Object.values(account2.btcAddresses).map((btcItem) => btcItem.address)).flat();
|
|
209122
|
+
const addressDetails = accounts.flatMap((account2) => {
|
|
209123
|
+
const accountId = makeAccountId({
|
|
209124
|
+
derivationIndex: account2.id,
|
|
209125
|
+
derivationType: account2.derivationType,
|
|
209126
|
+
masterPubKey: account2.masterPubKey
|
|
209127
|
+
});
|
|
209128
|
+
const details = Object.values(account2.btcAddresses).map((a) => ({
|
|
209129
|
+
address: a.address,
|
|
209130
|
+
chain: "btc",
|
|
209131
|
+
accountId
|
|
209132
|
+
}));
|
|
209133
|
+
if (account2.stxAddress) {
|
|
209134
|
+
details.push({
|
|
209135
|
+
address: account2.stxAddress,
|
|
209136
|
+
chain: "stacks",
|
|
209137
|
+
accountId
|
|
209138
|
+
});
|
|
209139
|
+
}
|
|
209140
|
+
if (account2.accountType === "software") {
|
|
209141
|
+
if (account2.spark?.address) {
|
|
209142
|
+
details.push({
|
|
209143
|
+
address: account2.spark.address,
|
|
209144
|
+
chain: "spark",
|
|
209145
|
+
accountId
|
|
209146
|
+
});
|
|
209147
|
+
}
|
|
209148
|
+
if (account2.strkAddresses) {
|
|
209149
|
+
Object.values(account2.strkAddresses).forEach(({ address }) => {
|
|
209150
|
+
details.push({
|
|
209151
|
+
address,
|
|
209152
|
+
chain: "starknet",
|
|
209153
|
+
accountId
|
|
209154
|
+
});
|
|
209155
|
+
});
|
|
209156
|
+
}
|
|
209157
|
+
}
|
|
209158
|
+
return details;
|
|
209159
|
+
});
|
|
209160
|
+
try {
|
|
209161
|
+
await authenticatedClient.extendAddresses(addressDetails);
|
|
209162
|
+
} catch (error3) {
|
|
209163
|
+
console.warn("Failed to extend auth addresses in batch:", error3);
|
|
209164
|
+
}
|
|
209165
|
+
const alreadyAuthorized = await authenticatedClient.hasScope(addresses);
|
|
209166
|
+
if (alreadyAuthorized) {
|
|
209167
|
+
return;
|
|
209168
|
+
}
|
|
209169
|
+
const batchSize = 3;
|
|
209170
|
+
const batches = [];
|
|
209171
|
+
for (let i = 0;i < accounts.length; i += batchSize) {
|
|
209172
|
+
batches.push(accounts.slice(i, i + batchSize));
|
|
209173
|
+
}
|
|
209174
|
+
const scopeChecks = await Promise.all(batches.map((batch) => authenticatedClient.hasScope(batch.flatMap((a) => Object.values(a.btcAddresses).map((b) => b.address)))));
|
|
209175
|
+
const toRegister = batches.filter((_, i) => !scopeChecks[i]);
|
|
209176
|
+
for (const batch of toRegister) {
|
|
209177
|
+
await authenticatedClient.batchExtendSoftwareAccountScope(batch, config2);
|
|
209178
|
+
}
|
|
209179
|
+
}
|
|
209180
|
+
};
|
|
209181
|
+
}
|
|
209182
|
+
var init_auth3 = __esm(() => {
|
|
209183
|
+
init_accountId();
|
|
209184
|
+
});
|
|
209185
|
+
|
|
208979
209186
|
// ../vaults/common.ts
|
|
208980
209187
|
var StorageKeys;
|
|
208981
209188
|
var init_common2 = __esm(() => {
|
|
@@ -209994,161 +210201,36 @@ var init_authenticatedClient = __esm(() => {
|
|
|
209994
210201
|
};
|
|
209995
210202
|
});
|
|
209996
210203
|
|
|
209997
|
-
// ../api/xverse/
|
|
209998
|
-
|
|
209999
|
-
|
|
210000
|
-
|
|
210001
|
-
|
|
210002
|
-
tooltipLabel: new Date(timestamp).toLocaleString("en-US", {
|
|
210003
|
-
weekday: "short",
|
|
210004
|
-
month: "short",
|
|
210005
|
-
day: "numeric",
|
|
210006
|
-
hour: "2-digit",
|
|
210007
|
-
minute: "2-digit",
|
|
210008
|
-
hourCycle: "h23"
|
|
210009
|
-
})
|
|
210010
|
-
}), XverseApi;
|
|
210011
|
-
var init_xverse2 = __esm(() => {
|
|
210012
|
-
init_axios2();
|
|
210013
|
-
init_constant();
|
|
210014
|
-
init_accountId();
|
|
210015
|
-
init_bignumber();
|
|
210016
|
-
init_tokenHelpers();
|
|
210017
|
-
init_addressRegistrar();
|
|
210018
|
-
init_authenticatedClient();
|
|
210019
|
-
XverseApi = class XverseApi {
|
|
210020
|
-
client;
|
|
210021
|
-
authenticatedClient;
|
|
210022
|
-
network;
|
|
210023
|
-
rateLimiter;
|
|
210024
|
-
static addressRegistrars = addressRegistrar_default;
|
|
210025
|
-
constructor(vault, network2, customBaseUrl) {
|
|
210026
|
-
const baseURL = customBaseUrl || XVERSE_API_BASE_URL(network2);
|
|
210027
|
-
this.client = axios_default.create({
|
|
210028
|
-
baseURL,
|
|
210029
|
-
headers: {
|
|
210030
|
-
"Content-Type": "application/json",
|
|
210031
|
-
"X-Client-Version": getXClientVersion() || undefined
|
|
210032
|
-
}
|
|
210033
|
-
});
|
|
210034
|
-
this.authenticatedClient = new AuthenticatedClient({
|
|
210035
|
-
baseURL,
|
|
210036
|
-
headers: {
|
|
210037
|
-
"Content-Type": "application/json",
|
|
210038
|
-
"X-Client-Version": getXClientVersion() || undefined
|
|
210039
|
-
}
|
|
210040
|
-
}, vault, network2);
|
|
210041
|
-
this.rateLimiter = new AxiosRateLimit([this.client, this.authenticatedClient], {
|
|
210042
|
-
maxRPS: 10
|
|
210043
|
-
});
|
|
210044
|
-
this.network = network2;
|
|
210045
|
-
}
|
|
210046
|
-
fetchBtcFeeRate = async () => {
|
|
210047
|
-
const response = await this.client.get("/v1/fees/btc");
|
|
210048
|
-
return response.data;
|
|
210049
|
-
};
|
|
210050
|
-
fetchStxToBtcRate = async () => {
|
|
210051
|
-
const response = await this.client.get("/v1/prices/stx/btc", { timeout: API_TIMEOUT_MILLI });
|
|
210052
|
-
return new BN(response.data.stxBtcRate.toString());
|
|
210053
|
-
};
|
|
210054
|
-
fetchStrkToBtcRate = async () => {
|
|
210055
|
-
const response = await this.client.get("/v1/prices/strk/btc", { timeout: API_TIMEOUT_MILLI });
|
|
210056
|
-
return new BN(response.data.strkBtcRate.toString());
|
|
210057
|
-
};
|
|
210058
|
-
fetchBtcToCurrencyRate = async ({ fiatCurrency }) => {
|
|
210059
|
-
const response = await this.client.get(`/v1/prices/btc/${fiatCurrency}`, { timeout: API_TIMEOUT_MILLI });
|
|
210060
|
-
return new BN(response.data.btcFiatRate.toString());
|
|
210061
|
-
};
|
|
210062
|
-
fetchTokenFiateRate = async (ft, fiatCurrency) => {
|
|
210063
|
-
const url2 = `/v1/prices/${ft}/${fiatCurrency}`;
|
|
210064
|
-
return this.client.get(url2, { timeout: API_TIMEOUT_MILLI }).then((response) => {
|
|
210065
|
-
return new BN(response.data.tokenFiatRate);
|
|
210066
|
-
}).catch(() => {
|
|
210067
|
-
return new BN(0);
|
|
210068
|
-
});
|
|
210069
|
-
};
|
|
210070
|
-
getSip10Tokens = async (contractids, fiatCurrency) => {
|
|
210071
|
-
const response = await this.client.post("/v1/sip10/tokens", {
|
|
210072
|
-
currency: fiatCurrency,
|
|
210073
|
-
coins: JSON.stringify(contractids)
|
|
210074
|
-
});
|
|
210075
|
-
return response.data;
|
|
210076
|
-
};
|
|
210077
|
-
getSparkTokenPools = async (request) => {
|
|
210078
|
-
const response = await this.client.post("/v1/spark/token-pools", request);
|
|
210079
|
-
return response.data;
|
|
210080
|
-
};
|
|
210081
|
-
getBrc20Tokens = async (tickers, fiatCurrency) => {
|
|
210082
|
-
const response = await this.client.get("/v1/brc20/tokens", {
|
|
210083
|
-
params: {
|
|
210084
|
-
currency: fiatCurrency,
|
|
210085
|
-
tickers
|
|
210086
|
-
}
|
|
210087
|
-
});
|
|
210088
|
-
return response.data;
|
|
210089
|
-
};
|
|
210090
|
-
getTokenStatsAndInfo = async (id, protocol) => {
|
|
210091
|
-
const response = await this.client.get("/v2/token-stats-and-info", {
|
|
210092
|
-
params: { id, protocol }
|
|
210093
|
-
});
|
|
210094
|
-
return response.data;
|
|
210095
|
-
};
|
|
210096
|
-
getRuneFiatRates = async (runeNames, fiatCurrency) => {
|
|
210097
|
-
const response = await this.client.post("/v2/runes/fiat-rates", {
|
|
210098
|
-
currency: fiatCurrency,
|
|
210099
|
-
runeNames
|
|
210100
|
-
});
|
|
210101
|
-
return response.data;
|
|
210102
|
-
};
|
|
210103
|
-
getRuneTxHistory = async (address, runeName, offset, limit) => {
|
|
210104
|
-
const response = await this.client.get(`/v1/address/${address}/rune/${runeName}?offset=${offset}&limit=${limit}`);
|
|
210105
|
-
return response.data;
|
|
210106
|
-
};
|
|
210107
|
-
fetchAppInfo = async () => {
|
|
210108
|
-
const response = await this.client.get("/v1/info");
|
|
210109
|
-
return response.data;
|
|
210110
|
-
};
|
|
210111
|
-
fetchStackingPoolInfo = async () => {
|
|
210112
|
-
const response = await this.client.get(`/v1/pool/info?pool_version=5`);
|
|
210113
|
-
return response.data;
|
|
210114
|
-
};
|
|
210115
|
-
fetchPoolStackerInfo = async (stxAddress) => {
|
|
210116
|
-
const response = await this.client.get(`/v1/pool/${stxAddress}/status`);
|
|
210117
|
-
return response.data;
|
|
210118
|
-
};
|
|
210119
|
-
getPoolStackingData = async (currency2) => {
|
|
210120
|
-
const response = await this.client.get(`/v1/pool/stacking-data/${currency2}`);
|
|
210121
|
-
return response.data;
|
|
210122
|
-
};
|
|
210123
|
-
getMoonPaySignedUrl = async (unsignedUrl) => {
|
|
210124
|
-
const response = await this.client.post("/v1/sign-url", {
|
|
210125
|
-
url: unsignedUrl
|
|
210126
|
-
});
|
|
210127
|
-
return response.data;
|
|
210128
|
-
};
|
|
210129
|
-
getBinanceSignature = async (srcData) => {
|
|
210130
|
-
const response = await this.client.post("/v1/binance/sign", {
|
|
210131
|
-
url: srcData
|
|
210132
|
-
});
|
|
210204
|
+
// ../api/xverse/callToAction.ts
|
|
210205
|
+
function createCallToActionMethods({ client: client2 }) {
|
|
210206
|
+
return {
|
|
210207
|
+
getExtensionCallToAction: async () => {
|
|
210208
|
+
const response = await client2.get("/v3/call-to-action/extension");
|
|
210133
210209
|
return response.data;
|
|
210134
|
-
}
|
|
210135
|
-
|
|
210136
|
-
const response = await
|
|
210210
|
+
},
|
|
210211
|
+
getMobileCallToAction: async () => {
|
|
210212
|
+
const response = await client2.get("/v3/call-to-action/mobile");
|
|
210137
210213
|
return response.data;
|
|
210138
|
-
}
|
|
210139
|
-
|
|
210140
|
-
const response = await
|
|
210214
|
+
},
|
|
210215
|
+
getPortalCallToAction: async () => {
|
|
210216
|
+
const response = await client2.get("/v3/call-to-action/portal");
|
|
210141
210217
|
return response.data;
|
|
210142
|
-
}
|
|
210143
|
-
|
|
210144
|
-
|
|
210218
|
+
}
|
|
210219
|
+
};
|
|
210220
|
+
}
|
|
210221
|
+
|
|
210222
|
+
// ../api/xverse/collections.ts
|
|
210223
|
+
function createCollectionsMethods({ client: client2 }) {
|
|
210224
|
+
return {
|
|
210225
|
+
getCollections: async (address, offset, limit, filters) => {
|
|
210226
|
+
const response = await client2.post(`/v2/address/${address}/ordinals/collections`, {
|
|
210145
210227
|
limit,
|
|
210146
210228
|
offset,
|
|
210147
210229
|
filters
|
|
210148
210230
|
});
|
|
210149
210231
|
return response.data;
|
|
210150
|
-
}
|
|
210151
|
-
getAllCollections
|
|
210232
|
+
},
|
|
210233
|
+
getAllCollections: async ({
|
|
210152
210234
|
ordinalsAddress,
|
|
210153
210235
|
stacksAddress,
|
|
210154
210236
|
filters,
|
|
@@ -210156,7 +210238,7 @@ var init_xverse2 = __esm(() => {
|
|
|
210156
210238
|
offset = 0,
|
|
210157
210239
|
currency: currency2 = "USD"
|
|
210158
210240
|
}) => {
|
|
210159
|
-
const response = await
|
|
210241
|
+
const response = await client2.post(`/v1/nft/collections`, {
|
|
210160
210242
|
ordinalsAddress,
|
|
210161
210243
|
stacksAddress,
|
|
210162
210244
|
limit,
|
|
@@ -210165,35 +210247,35 @@ var init_xverse2 = __esm(() => {
|
|
|
210165
210247
|
currency: currency2
|
|
210166
210248
|
});
|
|
210167
210249
|
return response.data;
|
|
210168
|
-
}
|
|
210169
|
-
getOrdinalCollectionDetails
|
|
210170
|
-
const response = await
|
|
210250
|
+
},
|
|
210251
|
+
getOrdinalCollectionDetails: async (collectionId) => {
|
|
210252
|
+
const response = await client2.get(`/v1/nft/ordinals/collections/${collectionId}/info`);
|
|
210171
210253
|
return response.data;
|
|
210172
|
-
}
|
|
210173
|
-
getStacksCollectionDetails
|
|
210174
|
-
const response = await
|
|
210254
|
+
},
|
|
210255
|
+
getStacksCollectionDetails: async (collectionId) => {
|
|
210256
|
+
const response = await client2.get(`/v1/nft/stacks/collections/${collectionId}/info`);
|
|
210175
210257
|
return response.data;
|
|
210176
|
-
}
|
|
210177
|
-
getAddressCollectionOrdinals
|
|
210178
|
-
const response = await
|
|
210258
|
+
},
|
|
210259
|
+
getAddressCollectionOrdinals: async (address, collectionId, offset, limit, filters, currency2 = "USD") => {
|
|
210260
|
+
const response = await client2.post(`/v1/nft/ordinals/address/${address}/collections/${collectionId}`, {
|
|
210179
210261
|
limit,
|
|
210180
210262
|
offset,
|
|
210181
210263
|
filters,
|
|
210182
210264
|
currency: currency2
|
|
210183
210265
|
});
|
|
210184
210266
|
return response.data;
|
|
210185
|
-
}
|
|
210186
|
-
getAddressCollectionStacks
|
|
210187
|
-
const response = await
|
|
210267
|
+
},
|
|
210268
|
+
getAddressCollectionStacks: async (address, collectionId, offset, limit, filters, currency2 = "USD") => {
|
|
210269
|
+
const response = await client2.post(`/v1/nft/stacks/address/${address}/collections/${collectionId}`, {
|
|
210188
210270
|
limit,
|
|
210189
210271
|
offset,
|
|
210190
210272
|
filters,
|
|
210191
210273
|
currency: currency2
|
|
210192
210274
|
});
|
|
210193
210275
|
return response.data;
|
|
210194
|
-
}
|
|
210195
|
-
getCollectionSpecificInscriptions
|
|
210196
|
-
const response = await
|
|
210276
|
+
},
|
|
210277
|
+
getCollectionSpecificInscriptions: async (address, collectionId, offset, limit, filters) => {
|
|
210278
|
+
const response = await client2.get(`/v1/address/${address}/ordinals/collections/${collectionId}`, {
|
|
210197
210279
|
params: {
|
|
210198
210280
|
limit,
|
|
210199
210281
|
offset,
|
|
@@ -210201,50 +210283,470 @@ var init_xverse2 = __esm(() => {
|
|
|
210201
210283
|
}
|
|
210202
210284
|
});
|
|
210203
210285
|
return response.data;
|
|
210204
|
-
}
|
|
210205
|
-
getCollectionMarketData
|
|
210206
|
-
const response = await
|
|
210286
|
+
},
|
|
210287
|
+
getCollectionMarketData: async (collectionId) => {
|
|
210288
|
+
const response = await client2.get(`/v1/ordinals/collections/${collectionId}`);
|
|
210207
210289
|
return response.data;
|
|
210208
|
-
}
|
|
210209
|
-
getInscription
|
|
210210
|
-
const response = await
|
|
210290
|
+
},
|
|
210291
|
+
getInscription: async (address, inscriptionId) => {
|
|
210292
|
+
const response = await client2.get(`/v1/address/${address}/ordinals/inscriptions/${inscriptionId}`);
|
|
210211
210293
|
return response.data;
|
|
210212
|
-
}
|
|
210213
|
-
|
|
210214
|
-
const response = await
|
|
210215
|
-
return response;
|
|
210216
|
-
};
|
|
210217
|
-
getFeaturedDapps = async () => {
|
|
210218
|
-
const response = await this.client.get(`/v2/featured/dapp`);
|
|
210219
|
-
return response.data.featuredDapp;
|
|
210220
|
-
};
|
|
210221
|
-
getNotificationBanners = async () => {
|
|
210222
|
-
const response = await this.client.get(`/v2/notification-banners`);
|
|
210223
|
-
return response.data.notificationBanners;
|
|
210224
|
-
};
|
|
210225
|
-
getCoinsMarketData = async (ids) => {
|
|
210226
|
-
const response = await this.client.get(`/v2/coins-market-data?ids=${ids.join(",")}`);
|
|
210294
|
+
},
|
|
210295
|
+
getOrdinalInfo: async (ordinalId) => {
|
|
210296
|
+
const response = await client2.get(`/v1/ordinals/${ordinalId}`);
|
|
210227
210297
|
return response.data;
|
|
210228
|
-
}
|
|
210229
|
-
|
|
210230
|
-
const response = await
|
|
210298
|
+
},
|
|
210299
|
+
getErc721Metadata: async (tokenContract, tokenId) => {
|
|
210300
|
+
const response = await client2.get(`/v1/eth/${tokenContract}/${tokenId}`);
|
|
210231
210301
|
return response.data;
|
|
210232
|
-
}
|
|
210233
|
-
|
|
210302
|
+
}
|
|
210303
|
+
};
|
|
210304
|
+
}
|
|
210305
|
+
|
|
210306
|
+
// ../api/xverse/device.ts
|
|
210307
|
+
function createDeviceMethods({ authenticatedClient }) {
|
|
210308
|
+
return {
|
|
210309
|
+
storeDeviceAndUserInfo: async (params) => {
|
|
210310
|
+
const { walletId, ...deviceParams } = params;
|
|
210311
|
+
await authenticatedClient.post(`/v1/device/info/${walletId}`, deviceParams);
|
|
210312
|
+
},
|
|
210313
|
+
setNotificationSettings: async (walletId, settings) => {
|
|
210314
|
+
await authenticatedClient.post(`/v1/device/notification-settings/${walletId}`, settings);
|
|
210315
|
+
},
|
|
210316
|
+
getNotificationSettings: async (walletId) => {
|
|
210317
|
+
try {
|
|
210318
|
+
const resp = await authenticatedClient.get(`/v1/device/notification-settings/${walletId}`);
|
|
210319
|
+
return resp.data;
|
|
210320
|
+
} catch (error3) {
|
|
210321
|
+
if (isAxiosError2(error3)) {
|
|
210322
|
+
if (error3.status === 404) {
|
|
210323
|
+
return {
|
|
210324
|
+
isNotificationPermissionGranted: false
|
|
210325
|
+
};
|
|
210326
|
+
}
|
|
210327
|
+
}
|
|
210328
|
+
throw error3;
|
|
210329
|
+
}
|
|
210330
|
+
}
|
|
210331
|
+
};
|
|
210332
|
+
}
|
|
210333
|
+
var init_device = __esm(() => {
|
|
210334
|
+
init_axios2();
|
|
210335
|
+
});
|
|
210336
|
+
|
|
210337
|
+
// ../api/xverse/due.ts
|
|
210338
|
+
function createDueMethods({ authenticatedClient }) {
|
|
210339
|
+
return {
|
|
210340
|
+
createAccount: async (body) => {
|
|
210341
|
+
const response = await authenticatedClient.post("/v1/due/accounts", body);
|
|
210342
|
+
return response.data;
|
|
210343
|
+
},
|
|
210344
|
+
getAccount: async () => {
|
|
210345
|
+
const response = await authenticatedClient.get("/v1/due/accounts");
|
|
210346
|
+
return response.data;
|
|
210347
|
+
},
|
|
210348
|
+
acceptTos: async () => {
|
|
210349
|
+
const response = await authenticatedClient.post("/v1/due/accounts/accept-tos");
|
|
210350
|
+
return response.data;
|
|
210351
|
+
},
|
|
210352
|
+
getTos: async () => {
|
|
210353
|
+
const response = await authenticatedClient.get("/v1/due/accounts/tos");
|
|
210354
|
+
return response.data;
|
|
210355
|
+
},
|
|
210356
|
+
getAccountCategories: async () => {
|
|
210357
|
+
const response = await authenticatedClient.get("/v1/due/account-categories");
|
|
210358
|
+
return response.data;
|
|
210359
|
+
},
|
|
210360
|
+
createVirtualAccount: async (body) => {
|
|
210361
|
+
const response = await authenticatedClient.post("/v1/due/virtual-accounts", body);
|
|
210362
|
+
return response.data;
|
|
210363
|
+
},
|
|
210364
|
+
listVirtualAccounts: async (params) => {
|
|
210365
|
+
const response = await authenticatedClient.get("/v1/due/virtual-accounts", {
|
|
210366
|
+
params
|
|
210367
|
+
});
|
|
210368
|
+
return response.data;
|
|
210369
|
+
},
|
|
210370
|
+
getVirtualAccount: async (id) => {
|
|
210371
|
+
const response = await authenticatedClient.get(`/v1/due/virtual-accounts/${id}`);
|
|
210372
|
+
return response.data;
|
|
210373
|
+
},
|
|
210374
|
+
getChannels: async (params) => {
|
|
210375
|
+
const response = await authenticatedClient.get(`/v1/due/channels`, {
|
|
210376
|
+
params
|
|
210377
|
+
});
|
|
210378
|
+
return response.data;
|
|
210379
|
+
},
|
|
210380
|
+
createQuote: async (body) => {
|
|
210381
|
+
const response = await authenticatedClient.post("/v1/due/quotes", body);
|
|
210382
|
+
return response.data;
|
|
210383
|
+
},
|
|
210384
|
+
getPaymentSchemas: async () => {
|
|
210385
|
+
const response = await authenticatedClient.get("/v1/due/schemas");
|
|
210386
|
+
return response.data;
|
|
210387
|
+
}
|
|
210388
|
+
};
|
|
210389
|
+
}
|
|
210390
|
+
|
|
210391
|
+
// ../api/xverse/earn.ts
|
|
210392
|
+
function createEarnMethods({ authenticatedClient }) {
|
|
210393
|
+
return {
|
|
210394
|
+
log: async (earnData) => {
|
|
210395
|
+
await authenticatedClient.post("/v1/earn/log", earnData);
|
|
210396
|
+
}
|
|
210397
|
+
};
|
|
210398
|
+
}
|
|
210399
|
+
|
|
210400
|
+
// ../api/xverse/listings.ts
|
|
210401
|
+
function createListingsMethods({ client: client2 }) {
|
|
210402
|
+
return {
|
|
210403
|
+
getRuneMarketData: async (body) => {
|
|
210404
|
+
const response = await client2.post(`/v1/listings/runes/market-data`, body);
|
|
210405
|
+
return response.data;
|
|
210406
|
+
},
|
|
210407
|
+
getRuneSellOrder: async (body) => {
|
|
210408
|
+
const response = await client2.post("/v1/listings/runes/create-order", body);
|
|
210409
|
+
return response.data;
|
|
210410
|
+
},
|
|
210411
|
+
submitRuneSellOrder: async (body) => {
|
|
210412
|
+
const response = await client2.post("/v1/listings/runes/submit-order", body);
|
|
210413
|
+
return response.data;
|
|
210414
|
+
},
|
|
210415
|
+
getListedUtxos: async (body) => {
|
|
210416
|
+
const response = await client2.post("/v1/listings/runes/listed-utxos", body);
|
|
210417
|
+
return response.data;
|
|
210418
|
+
},
|
|
210419
|
+
getRuneCancelOrder: async (body) => {
|
|
210420
|
+
const response = await client2.post("/v1/listings/runes/create-cancellation", body);
|
|
210421
|
+
return response.data;
|
|
210422
|
+
},
|
|
210423
|
+
submitRuneCancelOrder: async (body) => {
|
|
210424
|
+
const response = await client2.post("/v1/listings/runes/submit-cancellation", body);
|
|
210425
|
+
return response.data;
|
|
210426
|
+
}
|
|
210427
|
+
};
|
|
210428
|
+
}
|
|
210429
|
+
|
|
210430
|
+
// ../api/xverse/market.ts
|
|
210431
|
+
function createMarketMethods({ client: client2 }) {
|
|
210432
|
+
return {
|
|
210433
|
+
getCoinsMarketData: async (ids) => {
|
|
210434
|
+
const response = await client2.get(`/v2/coins-market-data?ids=${ids.join(",")}`);
|
|
210435
|
+
return response.data;
|
|
210436
|
+
},
|
|
210437
|
+
getExchangeRate: async (currency2) => {
|
|
210438
|
+
const response = await client2.get(`/v2/exchange-rate?currency=${currency2}`);
|
|
210439
|
+
return response.data;
|
|
210440
|
+
},
|
|
210441
|
+
getHistoricalData: async (id, period, exchangeRate = 1) => {
|
|
210234
210442
|
const idMap = {
|
|
210235
210443
|
btc: "bitcoin",
|
|
210236
210444
|
stx: "stacks"
|
|
210237
210445
|
};
|
|
210238
210446
|
const formattedId = idMap[id.toLowerCase()] || id.toLowerCase();
|
|
210239
|
-
const response = await
|
|
210447
|
+
const response = await client2.get(`/v2/historical-data?id=${formattedId}&period=${period}`);
|
|
210240
210448
|
return response.data.map(([timestamp, price]) => produceHistoricalDataObject(timestamp, price * exchangeRate));
|
|
210241
|
-
}
|
|
210242
|
-
|
|
210243
|
-
|
|
210449
|
+
}
|
|
210450
|
+
};
|
|
210451
|
+
}
|
|
210452
|
+
var produceHistoricalDataObject = (timestamp, price) => ({
|
|
210453
|
+
x: timestamp,
|
|
210454
|
+
y: price,
|
|
210455
|
+
tooltipLabel: new Date(timestamp).toLocaleString("en-US", {
|
|
210456
|
+
weekday: "short",
|
|
210457
|
+
month: "short",
|
|
210458
|
+
day: "numeric",
|
|
210459
|
+
hour: "2-digit",
|
|
210460
|
+
minute: "2-digit",
|
|
210461
|
+
hourCycle: "h23"
|
|
210462
|
+
})
|
|
210463
|
+
});
|
|
210464
|
+
|
|
210465
|
+
// ../api/xverse/onramp.ts
|
|
210466
|
+
function createOnrampMethods({ client: client2 }) {
|
|
210467
|
+
return {
|
|
210468
|
+
getOnrampSignatureData: async (body) => {
|
|
210469
|
+
const response = await client2.get(`/v1/onramp/sign-address?address=${body.address}&platform=${body.platform}`);
|
|
210244
210470
|
return response.data;
|
|
210245
|
-
}
|
|
210246
|
-
|
|
210247
|
-
|
|
210471
|
+
}
|
|
210472
|
+
};
|
|
210473
|
+
}
|
|
210474
|
+
|
|
210475
|
+
// ../api/xverse/prices.ts
|
|
210476
|
+
function createPricesMethods({ client: client2 }) {
|
|
210477
|
+
return {
|
|
210478
|
+
fetchBtcFeeRate: async () => {
|
|
210479
|
+
const response = await client2.get("/v1/fees/btc");
|
|
210480
|
+
return response.data;
|
|
210481
|
+
},
|
|
210482
|
+
fetchStxToBtcRate: async () => {
|
|
210483
|
+
const response = await client2.get("/v1/prices/stx/btc", { timeout: API_TIMEOUT_MILLI });
|
|
210484
|
+
return new BN(response.data.stxBtcRate.toString());
|
|
210485
|
+
},
|
|
210486
|
+
fetchStrkToBtcRate: async () => {
|
|
210487
|
+
const response = await client2.get("/v1/prices/strk/btc", { timeout: API_TIMEOUT_MILLI });
|
|
210488
|
+
return new BN(response.data.strkBtcRate.toString());
|
|
210489
|
+
},
|
|
210490
|
+
fetchBtcToCurrencyRate: async ({ fiatCurrency }) => {
|
|
210491
|
+
const response = await client2.get(`/v1/prices/btc/${fiatCurrency}`, { timeout: API_TIMEOUT_MILLI });
|
|
210492
|
+
return new BN(response.data.btcFiatRate.toString());
|
|
210493
|
+
},
|
|
210494
|
+
fetchTokenFiateRate: async (ft, fiatCurrency) => {
|
|
210495
|
+
const url2 = `/v1/prices/${ft}/${fiatCurrency}`;
|
|
210496
|
+
return client2.get(url2, { timeout: API_TIMEOUT_MILLI }).then((response) => {
|
|
210497
|
+
return new BN(response.data.tokenFiatRate);
|
|
210498
|
+
}).catch(() => {
|
|
210499
|
+
return new BN(0);
|
|
210500
|
+
});
|
|
210501
|
+
}
|
|
210502
|
+
};
|
|
210503
|
+
}
|
|
210504
|
+
var init_prices = __esm(() => {
|
|
210505
|
+
init_constant();
|
|
210506
|
+
init_bignumber();
|
|
210507
|
+
});
|
|
210508
|
+
|
|
210509
|
+
// ../api/xverse/signing.ts
|
|
210510
|
+
function createSigningMethods({ client: client2 }) {
|
|
210511
|
+
return {
|
|
210512
|
+
getMoonPaySignedUrl: async (unsignedUrl) => {
|
|
210513
|
+
const response = await client2.post("/v1/sign-url", {
|
|
210514
|
+
url: unsignedUrl
|
|
210515
|
+
});
|
|
210516
|
+
return response.data;
|
|
210517
|
+
},
|
|
210518
|
+
getBinanceSignature: async (srcData) => {
|
|
210519
|
+
const response = await client2.post("/v1/binance/sign", {
|
|
210520
|
+
url: srcData
|
|
210521
|
+
});
|
|
210522
|
+
return response.data;
|
|
210523
|
+
}
|
|
210524
|
+
};
|
|
210525
|
+
}
|
|
210526
|
+
|
|
210527
|
+
// ../api/xverse/spark.ts
|
|
210528
|
+
function createSparkMethods({ client: client2 }) {
|
|
210529
|
+
return {
|
|
210530
|
+
getAddressMetadata: async (address, currency2) => {
|
|
210531
|
+
const response = await client2.get(`/v1/spark/address/${address}`, {
|
|
210532
|
+
params: currency2 ? { currency: currency2 } : undefined
|
|
210533
|
+
});
|
|
210534
|
+
return response.data;
|
|
210535
|
+
},
|
|
210536
|
+
getSparkTokenMetadata: async (tokenAddresses, currency2) => {
|
|
210537
|
+
const response = await client2.post("/v1/spark/tokens", {
|
|
210538
|
+
tokenAddresses,
|
|
210539
|
+
currency: currency2
|
|
210540
|
+
});
|
|
210541
|
+
return response.data;
|
|
210542
|
+
}
|
|
210543
|
+
};
|
|
210544
|
+
}
|
|
210545
|
+
|
|
210546
|
+
// ../api/xverse/stacking.ts
|
|
210547
|
+
function createStackingMethods({ client: client2 }) {
|
|
210548
|
+
return {
|
|
210549
|
+
fetchStackingPoolInfo: async () => {
|
|
210550
|
+
const response = await client2.get(`/v1/pool/info?pool_version=5`);
|
|
210551
|
+
return response.data;
|
|
210552
|
+
},
|
|
210553
|
+
fetchPoolStackerInfo: async (stxAddress) => {
|
|
210554
|
+
const response = await client2.get(`/v1/pool/${stxAddress}/status`);
|
|
210555
|
+
return response.data;
|
|
210556
|
+
},
|
|
210557
|
+
getPoolStackingData: async (currency2) => {
|
|
210558
|
+
const response = await client2.get(`/v1/pool/stacking-data/${currency2}`);
|
|
210559
|
+
return response.data;
|
|
210560
|
+
}
|
|
210561
|
+
};
|
|
210562
|
+
}
|
|
210563
|
+
|
|
210564
|
+
// ../api/xverse/starknet.ts
|
|
210565
|
+
import { validateAndParseAddress as validateAndParseAddress2 } from "starknet";
|
|
210566
|
+
function createStarknetMethods({ client: client2, authenticatedClient }) {
|
|
210567
|
+
return {
|
|
210568
|
+
getHistory: async (params) => {
|
|
210569
|
+
const { address, ...body } = params;
|
|
210570
|
+
const response = await client2.post(`/v1/starknet/address/${address}/history`, body);
|
|
210571
|
+
const normalizedResponse = {
|
|
210572
|
+
...response.data,
|
|
210573
|
+
transactions: response.data.transactions.map((transaction3) => {
|
|
210574
|
+
if (transaction3.type === "starknet") {
|
|
210575
|
+
try {
|
|
210576
|
+
return {
|
|
210577
|
+
...transaction3,
|
|
210578
|
+
data: {
|
|
210579
|
+
...transaction3.data,
|
|
210580
|
+
contractAddress: validateAndParseAddress2(transaction3.data.contractAddress),
|
|
210581
|
+
fromAddress: validateAndParseAddress2(transaction3.data.fromAddress),
|
|
210582
|
+
toAddress: validateAndParseAddress2(transaction3.data.toAddress)
|
|
210583
|
+
}
|
|
210584
|
+
};
|
|
210585
|
+
} catch (error3) {
|
|
210586
|
+
console.warn("Failed to normalize Starknet addresses:", error3);
|
|
210587
|
+
return transaction3;
|
|
210588
|
+
}
|
|
210589
|
+
}
|
|
210590
|
+
return transaction3;
|
|
210591
|
+
})
|
|
210592
|
+
};
|
|
210593
|
+
return normalizedResponse;
|
|
210594
|
+
},
|
|
210595
|
+
getTokenBalances: async (body) => {
|
|
210596
|
+
const response = await client2.get("/starknet/v1/tokenBalances", {
|
|
210597
|
+
params: body
|
|
210598
|
+
});
|
|
210599
|
+
const normalizedResponse = {
|
|
210600
|
+
...response.data,
|
|
210601
|
+
tokenBalances: response.data.tokenBalances.map((token) => ({
|
|
210602
|
+
...token,
|
|
210603
|
+
contractAddress: validateAndParseAddress2(token.contractAddress)
|
|
210604
|
+
}))
|
|
210605
|
+
};
|
|
210606
|
+
return normalizedResponse;
|
|
210607
|
+
},
|
|
210608
|
+
getSponsorshipStatus: async (body) => {
|
|
210609
|
+
const bitcoinAddresses = body.bitcoinAddress ? Array.isArray(body.bitcoinAddress) ? body.bitcoinAddress : [body.bitcoinAddress] : undefined;
|
|
210610
|
+
const response = await authenticatedClient.post("/starknet/v1/sponsorTransaction", {
|
|
210611
|
+
...body,
|
|
210612
|
+
bitcoinAddresses,
|
|
210613
|
+
checkOnly: true
|
|
210614
|
+
});
|
|
210615
|
+
return response.data;
|
|
210616
|
+
},
|
|
210617
|
+
sponsorTransaction: async (body) => {
|
|
210618
|
+
const bitcoinAddresses = body.bitcoinAddress ? Array.isArray(body.bitcoinAddress) ? body.bitcoinAddress : [body.bitcoinAddress] : undefined;
|
|
210619
|
+
const response = await authenticatedClient.post("/starknet/v1/sponsorTransaction", {
|
|
210620
|
+
...body,
|
|
210621
|
+
bitcoinAddresses,
|
|
210622
|
+
checkOnly: false
|
|
210623
|
+
});
|
|
210624
|
+
return response.data;
|
|
210625
|
+
}
|
|
210626
|
+
};
|
|
210627
|
+
}
|
|
210628
|
+
var init_starknet3 = () => {};
|
|
210629
|
+
|
|
210630
|
+
// ../api/xverse/swaps.ts
|
|
210631
|
+
function createSwapsMethods({ client: client2, authenticatedClient }) {
|
|
210632
|
+
return {
|
|
210633
|
+
getDestinationTokens: async (body) => {
|
|
210634
|
+
const response = await client2.post("/v1/swaps/get-destination-tokens", body);
|
|
210635
|
+
return response.data;
|
|
210636
|
+
},
|
|
210637
|
+
getQuotes: async (body) => {
|
|
210638
|
+
const response = await client2.post("/v1/swaps/get-quotes", body);
|
|
210639
|
+
return response.data;
|
|
210640
|
+
},
|
|
210641
|
+
getUtxos: async (body) => {
|
|
210642
|
+
const response = await client2.post("/v1/swaps/get-utxos", body);
|
|
210643
|
+
return response.data;
|
|
210644
|
+
},
|
|
210645
|
+
placeOrder: async (body) => {
|
|
210646
|
+
const response = await client2.post("/v1/swaps/place-order", body);
|
|
210647
|
+
return response.data;
|
|
210648
|
+
},
|
|
210649
|
+
executeOrder: async (body) => {
|
|
210650
|
+
const response = await client2.post("/v1/swaps/execute-order", body);
|
|
210651
|
+
return response.data;
|
|
210652
|
+
},
|
|
210653
|
+
placeStxOrder: async (body) => {
|
|
210654
|
+
const response = await client2.post("/v1/swaps/place-stx-order", body);
|
|
210655
|
+
return response.data;
|
|
210656
|
+
},
|
|
210657
|
+
executeStxOrder: async (body) => {
|
|
210658
|
+
const response = await client2.post("/v1/swaps/execute-stx-order", body);
|
|
210659
|
+
return response.data;
|
|
210660
|
+
},
|
|
210661
|
+
placeUtxoOrder: async (body) => {
|
|
210662
|
+
const response = await client2.post("/v1/swaps/place-utxo-order", body);
|
|
210663
|
+
return response.data;
|
|
210664
|
+
},
|
|
210665
|
+
executeUtxoOrder: async (body) => {
|
|
210666
|
+
const response = await client2.post("/v1/swaps/execute-utxo-order", body);
|
|
210667
|
+
return response.data;
|
|
210668
|
+
},
|
|
210669
|
+
placeXcOrder: async (body) => {
|
|
210670
|
+
const response = await client2.post("/v1/swaps/place-xc-order", body);
|
|
210671
|
+
return response.data;
|
|
210672
|
+
},
|
|
210673
|
+
atomiqQuote: async (body) => {
|
|
210674
|
+
const response = await client2.post("/v1/swaps/atomiq/quote", body);
|
|
210675
|
+
return response.data;
|
|
210676
|
+
},
|
|
210677
|
+
atomiqCreate: async (body) => {
|
|
210678
|
+
const response = await client2.post("/v1/swaps/atomiq/create", body);
|
|
210679
|
+
return response.data;
|
|
210680
|
+
},
|
|
210681
|
+
atomiqSubmit: async (body) => {
|
|
210682
|
+
const response = await client2.post("/v1/swaps/atomiq/submit", body);
|
|
210683
|
+
return response.data;
|
|
210684
|
+
},
|
|
210685
|
+
atomiqStatus: async (swapId) => {
|
|
210686
|
+
const response = await client2.get(`/v1/swaps/atomiq/status/${swapId}`);
|
|
210687
|
+
return response.data;
|
|
210688
|
+
},
|
|
210689
|
+
atomiqEnrichByTxIds: async (body) => {
|
|
210690
|
+
const response = await client2.post(`/v1/swaps/atomiq/enrich`, body);
|
|
210691
|
+
return response.data;
|
|
210692
|
+
},
|
|
210693
|
+
atomiqCommit: async (body) => {
|
|
210694
|
+
const response = await client2.post("/v1/swaps/atomiq/commit", body);
|
|
210695
|
+
return response.data;
|
|
210696
|
+
},
|
|
210697
|
+
log: async (swapData) => {
|
|
210698
|
+
const swapRecord = {
|
|
210699
|
+
slippage: swapData.slippage || "0",
|
|
210700
|
+
feeRate: swapData.feeRate || "0",
|
|
210701
|
+
...swapData
|
|
210702
|
+
};
|
|
210703
|
+
await authenticatedClient.post("/v1/swaps/log", swapRecord);
|
|
210704
|
+
}
|
|
210705
|
+
};
|
|
210706
|
+
}
|
|
210707
|
+
|
|
210708
|
+
// ../api/xverse/tokens.ts
|
|
210709
|
+
function createTokensMethods({ client: client2, authenticatedClient }) {
|
|
210710
|
+
return {
|
|
210711
|
+
getSip10Tokens: async (contractids, fiatCurrency) => {
|
|
210712
|
+
const response = await client2.post("/v1/sip10/tokens", {
|
|
210713
|
+
currency: fiatCurrency,
|
|
210714
|
+
coins: JSON.stringify(contractids)
|
|
210715
|
+
});
|
|
210716
|
+
return response.data;
|
|
210717
|
+
},
|
|
210718
|
+
getSparkTokenPools: async (request) => {
|
|
210719
|
+
const response = await client2.post("/v1/spark/token-pools", request);
|
|
210720
|
+
return response.data;
|
|
210721
|
+
},
|
|
210722
|
+
getBrc20Tokens: async (tickers, fiatCurrency) => {
|
|
210723
|
+
const response = await client2.get("/v1/brc20/tokens", {
|
|
210724
|
+
params: {
|
|
210725
|
+
currency: fiatCurrency,
|
|
210726
|
+
tickers
|
|
210727
|
+
}
|
|
210728
|
+
});
|
|
210729
|
+
return response.data;
|
|
210730
|
+
},
|
|
210731
|
+
getTokenStatsAndInfo: async (id, protocol) => {
|
|
210732
|
+
const response = await client2.get("/v2/token-stats-and-info", {
|
|
210733
|
+
params: { id, protocol }
|
|
210734
|
+
});
|
|
210735
|
+
return response.data;
|
|
210736
|
+
},
|
|
210737
|
+
getRuneFiatRates: async (runeNames, fiatCurrency) => {
|
|
210738
|
+
const response = await client2.post("/v2/runes/fiat-rates", {
|
|
210739
|
+
currency: fiatCurrency,
|
|
210740
|
+
runeNames
|
|
210741
|
+
});
|
|
210742
|
+
return response.data;
|
|
210743
|
+
},
|
|
210744
|
+
getRuneTxHistory: async (address, runeName, offset, limit) => {
|
|
210745
|
+
const response = await client2.get(`/v1/address/${address}/rune/${runeName}?offset=${offset}&limit=${limit}`);
|
|
210746
|
+
return response.data;
|
|
210747
|
+
},
|
|
210748
|
+
getTopTokens: async (offset, limit) => {
|
|
210749
|
+
const response = await authenticatedClient.get("/v1/top-tokens", {
|
|
210248
210750
|
params: {
|
|
210249
210751
|
offset,
|
|
210250
210752
|
limit
|
|
@@ -210264,9 +210766,9 @@ var init_xverse2 = __esm(() => {
|
|
|
210264
210766
|
return {
|
|
210265
210767
|
runes: topRunesTokens
|
|
210266
210768
|
};
|
|
210267
|
-
}
|
|
210268
|
-
getTopBtknTokens
|
|
210269
|
-
const response = await
|
|
210769
|
+
},
|
|
210770
|
+
getTopBtknTokens: async (limit, sort = "VOLUME24H_DESC") => {
|
|
210771
|
+
const response = await authenticatedClient.get("/v1/spark/top-tokens", {
|
|
210270
210772
|
params: {
|
|
210271
210773
|
limit,
|
|
210272
210774
|
sort
|
|
@@ -210285,9 +210787,9 @@ var init_xverse2 = __esm(() => {
|
|
|
210285
210787
|
return {
|
|
210286
210788
|
btkn: topBtknTokens
|
|
210287
210789
|
};
|
|
210288
|
-
}
|
|
210289
|
-
getTopAnvuTokens
|
|
210290
|
-
const response = await
|
|
210790
|
+
},
|
|
210791
|
+
getTopAnvuTokens: async (limit) => {
|
|
210792
|
+
const response = await authenticatedClient.get("/v1/starknet/top-tokens", {
|
|
210291
210793
|
params: {
|
|
210292
210794
|
limit
|
|
210293
210795
|
}
|
|
@@ -210305,474 +210807,197 @@ var init_xverse2 = __esm(() => {
|
|
|
210305
210807
|
return {
|
|
210306
210808
|
anvuTokens: topAnvuTokens
|
|
210307
210809
|
};
|
|
210308
|
-
}
|
|
210309
|
-
|
|
210310
|
-
const response = await
|
|
210810
|
+
},
|
|
210811
|
+
getSpamTokensList: async () => {
|
|
210812
|
+
const response = await client2.get(`/v1/spam-tokens`);
|
|
210311
210813
|
return response.data;
|
|
210312
|
-
}
|
|
210313
|
-
|
|
210314
|
-
const
|
|
210315
|
-
|
|
210316
|
-
}
|
|
210317
|
-
|
|
210318
|
-
await
|
|
210319
|
-
|
|
210320
|
-
|
|
210321
|
-
|
|
210322
|
-
|
|
210323
|
-
|
|
210324
|
-
|
|
210325
|
-
|
|
210326
|
-
|
|
210327
|
-
|
|
210328
|
-
|
|
210329
|
-
|
|
210330
|
-
|
|
210331
|
-
|
|
210332
|
-
|
|
210333
|
-
|
|
210334
|
-
|
|
210335
|
-
|
|
210336
|
-
|
|
210337
|
-
|
|
210338
|
-
|
|
210339
|
-
|
|
210340
|
-
|
|
210341
|
-
|
|
210342
|
-
|
|
210343
|
-
|
|
210344
|
-
|
|
210345
|
-
|
|
210346
|
-
|
|
210347
|
-
|
|
210348
|
-
|
|
210349
|
-
|
|
210350
|
-
|
|
210351
|
-
|
|
210352
|
-
|
|
210353
|
-
|
|
210354
|
-
|
|
210355
|
-
|
|
210356
|
-
|
|
210357
|
-
|
|
210358
|
-
|
|
210359
|
-
|
|
210360
|
-
|
|
210361
|
-
|
|
210362
|
-
|
|
210363
|
-
|
|
210364
|
-
|
|
210365
|
-
|
|
210366
|
-
|
|
210367
|
-
|
|
210368
|
-
|
|
210369
|
-
|
|
210370
|
-
|
|
210371
|
-
|
|
210372
|
-
|
|
210373
|
-
|
|
210374
|
-
|
|
210375
|
-
|
|
210376
|
-
|
|
210377
|
-
|
|
210378
|
-
|
|
210379
|
-
|
|
210380
|
-
|
|
210381
|
-
|
|
210382
|
-
return;
|
|
210383
|
-
}
|
|
210384
|
-
if (account2.accountType === "ledger" || account2.accountType === "keystone") {
|
|
210385
|
-
const addressesToRegister = Object.values(account2.btcAddresses).map((a) => a.address);
|
|
210386
|
-
const addressDetails = [
|
|
210387
|
-
...addressesToRegister.map((addr) => ({
|
|
210388
|
-
address: addr,
|
|
210389
|
-
chain: "btc",
|
|
210390
|
-
accountId
|
|
210391
|
-
}))
|
|
210392
|
-
];
|
|
210393
|
-
await this.authenticatedClient.extendAddresses(addressDetails);
|
|
210394
|
-
return this.authenticatedClient.extend(addressesToRegister);
|
|
210395
|
-
}
|
|
210396
|
-
return this.authenticatedClient.extendSoftwareAccountScope(account2);
|
|
210397
|
-
},
|
|
210398
|
-
batchEnsureSoftwareAccountRegistered: async (accounts, config2) => {
|
|
210399
|
-
const walletId = accounts[0].walletId;
|
|
210400
|
-
const isThereAnyAccountWithDifferentWalletId = accounts.some((account2) => account2.walletId !== walletId);
|
|
210401
|
-
if (isThereAnyAccountWithDifferentWalletId) {
|
|
210402
|
-
throw new Error("All accounts must belong to the same wallet");
|
|
210403
|
-
}
|
|
210404
|
-
const addresses = accounts.map((account2) => Object.values(account2.btcAddresses).map((btcItem) => btcItem.address)).flat();
|
|
210405
|
-
const addressDetails = accounts.flatMap((account2) => {
|
|
210406
|
-
const accountId = makeAccountId({
|
|
210407
|
-
derivationIndex: account2.id,
|
|
210408
|
-
derivationType: account2.derivationType,
|
|
210409
|
-
masterPubKey: account2.masterPubKey
|
|
210410
|
-
});
|
|
210411
|
-
const details = Object.values(account2.btcAddresses).map((a) => ({
|
|
210412
|
-
address: a.address,
|
|
210413
|
-
chain: "btc",
|
|
210414
|
-
accountId
|
|
210415
|
-
}));
|
|
210416
|
-
if (account2.stxAddress) {
|
|
210417
|
-
details.push({
|
|
210418
|
-
address: account2.stxAddress,
|
|
210419
|
-
chain: "stacks",
|
|
210420
|
-
accountId
|
|
210421
|
-
});
|
|
210422
|
-
}
|
|
210423
|
-
if (account2.accountType === "software") {
|
|
210424
|
-
if (account2.spark?.address) {
|
|
210425
|
-
details.push({
|
|
210426
|
-
address: account2.spark.address,
|
|
210427
|
-
chain: "spark",
|
|
210428
|
-
accountId
|
|
210429
|
-
});
|
|
210430
|
-
}
|
|
210431
|
-
if (account2.strkAddresses) {
|
|
210432
|
-
Object.values(account2.strkAddresses).forEach(({ address }) => {
|
|
210433
|
-
details.push({
|
|
210434
|
-
address,
|
|
210435
|
-
chain: "starknet",
|
|
210436
|
-
accountId
|
|
210437
|
-
});
|
|
210438
|
-
});
|
|
210439
|
-
}
|
|
210440
|
-
}
|
|
210441
|
-
return details;
|
|
210442
|
-
});
|
|
210443
|
-
try {
|
|
210444
|
-
await this.authenticatedClient.extendAddresses(addressDetails);
|
|
210445
|
-
} catch (error3) {
|
|
210446
|
-
console.warn("Failed to extend auth addresses in batch:", error3);
|
|
210447
|
-
}
|
|
210448
|
-
const alreadyAuthorized = await this.authenticatedClient.hasScope(addresses);
|
|
210449
|
-
if (alreadyAuthorized) {
|
|
210450
|
-
return;
|
|
210451
|
-
}
|
|
210452
|
-
const batchSize = 3;
|
|
210453
|
-
const batches = [];
|
|
210454
|
-
for (let i = 0;i < accounts.length; i += batchSize) {
|
|
210455
|
-
batches.push(accounts.slice(i, i + batchSize));
|
|
210814
|
+
},
|
|
210815
|
+
getRunesBalance: async (body) => {
|
|
210816
|
+
const response = await client2.get(`/v3/address/${body.address}/runes/balance?includeUnconfirmed=${body.includeUnconfirmed}`);
|
|
210817
|
+
return response.data;
|
|
210818
|
+
},
|
|
210819
|
+
getRunesMarketData: async (body) => {
|
|
210820
|
+
const response = await client2.post("/v3/runes/market-data", body);
|
|
210821
|
+
return response.data;
|
|
210822
|
+
},
|
|
210823
|
+
getBrc20Balance: async (body) => {
|
|
210824
|
+
const response = await client2.get(`/v3/address/${body.address}/brc20/balance`);
|
|
210825
|
+
return response.data;
|
|
210826
|
+
},
|
|
210827
|
+
getBrc20MarketData: async (body) => {
|
|
210828
|
+
const response = await client2.post("/v3/brc20/market-data", body);
|
|
210829
|
+
return response.data;
|
|
210830
|
+
},
|
|
210831
|
+
getSip10MarketData: async (body) => {
|
|
210832
|
+
const response = await client2.post("/v3/sip10/market-data", body);
|
|
210833
|
+
return response.data;
|
|
210834
|
+
}
|
|
210835
|
+
};
|
|
210836
|
+
}
|
|
210837
|
+
var init_tokens2 = __esm(() => {
|
|
210838
|
+
init_tokenHelpers();
|
|
210839
|
+
});
|
|
210840
|
+
|
|
210841
|
+
// ../api/xverse/index.ts
|
|
210842
|
+
var XverseApi;
|
|
210843
|
+
var init_xverse2 = __esm(() => {
|
|
210844
|
+
init_axios2();
|
|
210845
|
+
init_constant();
|
|
210846
|
+
init_addressRegistrar();
|
|
210847
|
+
init_auth3();
|
|
210848
|
+
init_authenticatedClient();
|
|
210849
|
+
init_device();
|
|
210850
|
+
init_prices();
|
|
210851
|
+
init_starknet3();
|
|
210852
|
+
init_tokens2();
|
|
210853
|
+
XverseApi = class XverseApi {
|
|
210854
|
+
client;
|
|
210855
|
+
authenticatedClient;
|
|
210856
|
+
network;
|
|
210857
|
+
rateLimiter;
|
|
210858
|
+
static addressRegistrars = addressRegistrar_default;
|
|
210859
|
+
prices;
|
|
210860
|
+
tokens;
|
|
210861
|
+
collections;
|
|
210862
|
+
stacking;
|
|
210863
|
+
market;
|
|
210864
|
+
app;
|
|
210865
|
+
device;
|
|
210866
|
+
signing;
|
|
210867
|
+
auth;
|
|
210868
|
+
account;
|
|
210869
|
+
listings;
|
|
210870
|
+
starknet;
|
|
210871
|
+
spark;
|
|
210872
|
+
swaps;
|
|
210873
|
+
earn;
|
|
210874
|
+
onramp;
|
|
210875
|
+
callToAction;
|
|
210876
|
+
due;
|
|
210877
|
+
constructor(vault, network2, customBaseUrl) {
|
|
210878
|
+
const baseURL = customBaseUrl || XVERSE_API_BASE_URL(network2);
|
|
210879
|
+
this.client = axios_default.create({
|
|
210880
|
+
baseURL,
|
|
210881
|
+
headers: {
|
|
210882
|
+
"Content-Type": "application/json",
|
|
210883
|
+
"X-Client-Version": getXClientVersion() || undefined
|
|
210456
210884
|
}
|
|
210457
|
-
|
|
210458
|
-
|
|
210459
|
-
|
|
210460
|
-
|
|
210885
|
+
});
|
|
210886
|
+
this.authenticatedClient = new AuthenticatedClient({
|
|
210887
|
+
baseURL,
|
|
210888
|
+
headers: {
|
|
210889
|
+
"Content-Type": "application/json",
|
|
210890
|
+
"X-Client-Version": getXClientVersion() || undefined
|
|
210461
210891
|
}
|
|
210462
|
-
}
|
|
210463
|
-
|
|
210464
|
-
|
|
210465
|
-
|
|
210466
|
-
|
|
210467
|
-
|
|
210468
|
-
|
|
210469
|
-
|
|
210470
|
-
|
|
210471
|
-
|
|
210472
|
-
|
|
210473
|
-
|
|
210474
|
-
|
|
210475
|
-
|
|
210476
|
-
|
|
210477
|
-
|
|
210478
|
-
|
|
210479
|
-
|
|
210480
|
-
|
|
210481
|
-
|
|
210482
|
-
|
|
210483
|
-
|
|
210484
|
-
|
|
210485
|
-
|
|
210486
|
-
|
|
210487
|
-
|
|
210488
|
-
|
|
210489
|
-
|
|
210490
|
-
|
|
210491
|
-
|
|
210492
|
-
|
|
210493
|
-
|
|
210494
|
-
|
|
210495
|
-
|
|
210496
|
-
|
|
210497
|
-
|
|
210498
|
-
|
|
210499
|
-
|
|
210500
|
-
|
|
210501
|
-
|
|
210502
|
-
|
|
210503
|
-
|
|
210504
|
-
|
|
210505
|
-
|
|
210506
|
-
|
|
210507
|
-
|
|
210508
|
-
|
|
210509
|
-
|
|
210510
|
-
|
|
210511
|
-
|
|
210512
|
-
|
|
210513
|
-
|
|
210514
|
-
|
|
210515
|
-
|
|
210516
|
-
|
|
210517
|
-
|
|
210518
|
-
|
|
210519
|
-
|
|
210520
|
-
|
|
210521
|
-
|
|
210522
|
-
|
|
210523
|
-
|
|
210524
|
-
|
|
210525
|
-
|
|
210526
|
-
|
|
210527
|
-
|
|
210528
|
-
|
|
210529
|
-
|
|
210530
|
-
|
|
210531
|
-
|
|
210532
|
-
|
|
210533
|
-
|
|
210534
|
-
|
|
210535
|
-
|
|
210536
|
-
|
|
210537
|
-
|
|
210538
|
-
|
|
210539
|
-
|
|
210540
|
-
|
|
210541
|
-
|
|
210542
|
-
|
|
210543
|
-
|
|
210544
|
-
|
|
210545
|
-
|
|
210546
|
-
|
|
210547
|
-
|
|
210548
|
-
|
|
210549
|
-
|
|
210550
|
-
|
|
210551
|
-
|
|
210552
|
-
|
|
210553
|
-
|
|
210554
|
-
|
|
210555
|
-
|
|
210556
|
-
|
|
210557
|
-
|
|
210558
|
-
|
|
210559
|
-
|
|
210560
|
-
|
|
210561
|
-
|
|
210562
|
-
|
|
210563
|
-
|
|
210564
|
-
|
|
210565
|
-
|
|
210566
|
-
|
|
210567
|
-
|
|
210568
|
-
|
|
210569
|
-
|
|
210570
|
-
|
|
210571
|
-
getSponsorshipStatus: async (body) => {
|
|
210572
|
-
const bitcoinAddresses = body.bitcoinAddress ? Array.isArray(body.bitcoinAddress) ? body.bitcoinAddress : [body.bitcoinAddress] : undefined;
|
|
210573
|
-
const response = await this.authenticatedClient.post("/starknet/v1/sponsorTransaction", {
|
|
210574
|
-
...body,
|
|
210575
|
-
bitcoinAddresses,
|
|
210576
|
-
checkOnly: true
|
|
210577
|
-
});
|
|
210578
|
-
return response.data;
|
|
210579
|
-
},
|
|
210580
|
-
sponsorTransaction: async (body) => {
|
|
210581
|
-
const bitcoinAddresses = body.bitcoinAddress ? Array.isArray(body.bitcoinAddress) ? body.bitcoinAddress : [body.bitcoinAddress] : undefined;
|
|
210582
|
-
const response = await this.authenticatedClient.post("/starknet/v1/sponsorTransaction", {
|
|
210583
|
-
...body,
|
|
210584
|
-
bitcoinAddresses,
|
|
210585
|
-
checkOnly: false
|
|
210586
|
-
});
|
|
210587
|
-
return response.data;
|
|
210588
|
-
}
|
|
210589
|
-
};
|
|
210590
|
-
spark = {
|
|
210591
|
-
getAddressMetadata: async (address, currency2) => {
|
|
210592
|
-
const response = await this.client.get(`/v1/spark/address/${address}`, {
|
|
210593
|
-
params: currency2 ? { currency: currency2 } : undefined
|
|
210594
|
-
});
|
|
210595
|
-
return response.data;
|
|
210596
|
-
},
|
|
210597
|
-
getSparkTokenMetadata: async (tokenAddresses, currency2) => {
|
|
210598
|
-
const response = await this.client.post("/v1/spark/tokens", {
|
|
210599
|
-
tokenAddresses,
|
|
210600
|
-
currency: currency2
|
|
210601
|
-
});
|
|
210602
|
-
return response.data;
|
|
210603
|
-
}
|
|
210604
|
-
};
|
|
210605
|
-
swaps = {
|
|
210606
|
-
getDestinationTokens: async (body) => {
|
|
210607
|
-
const response = await this.client.post("/v1/swaps/get-destination-tokens", body);
|
|
210608
|
-
return response.data;
|
|
210609
|
-
},
|
|
210610
|
-
getQuotes: async (body) => {
|
|
210611
|
-
const response = await this.client.post("/v1/swaps/get-quotes", body);
|
|
210612
|
-
return response.data;
|
|
210613
|
-
},
|
|
210614
|
-
getUtxos: async (body) => {
|
|
210615
|
-
const response = await this.client.post("/v1/swaps/get-utxos", body);
|
|
210616
|
-
return response.data;
|
|
210617
|
-
},
|
|
210618
|
-
placeOrder: async (body) => {
|
|
210619
|
-
const response = await this.client.post("/v1/swaps/place-order", body);
|
|
210620
|
-
return response.data;
|
|
210621
|
-
},
|
|
210622
|
-
executeOrder: async (body) => {
|
|
210623
|
-
const response = await this.client.post("/v1/swaps/execute-order", body);
|
|
210624
|
-
return response.data;
|
|
210625
|
-
},
|
|
210626
|
-
placeStxOrder: async (body) => {
|
|
210627
|
-
const response = await this.client.post("/v1/swaps/place-stx-order", body);
|
|
210628
|
-
return response.data;
|
|
210629
|
-
},
|
|
210630
|
-
executeStxOrder: async (body) => {
|
|
210631
|
-
const response = await this.client.post("/v1/swaps/execute-stx-order", body);
|
|
210632
|
-
return response.data;
|
|
210633
|
-
},
|
|
210634
|
-
placeUtxoOrder: async (body) => {
|
|
210635
|
-
const response = await this.client.post("/v1/swaps/place-utxo-order", body);
|
|
210636
|
-
return response.data;
|
|
210637
|
-
},
|
|
210638
|
-
executeUtxoOrder: async (body) => {
|
|
210639
|
-
const response = await this.client.post("/v1/swaps/execute-utxo-order", body);
|
|
210640
|
-
return response.data;
|
|
210641
|
-
},
|
|
210642
|
-
placeXcOrder: async (body) => {
|
|
210643
|
-
const response = await this.client.post("/v1/swaps/place-xc-order", body);
|
|
210644
|
-
return response.data;
|
|
210645
|
-
},
|
|
210646
|
-
atomiqQuote: async (body) => {
|
|
210647
|
-
const response = await this.client.post("/v1/swaps/atomiq/quote", body);
|
|
210648
|
-
return response.data;
|
|
210649
|
-
},
|
|
210650
|
-
atomiqCreate: async (body) => {
|
|
210651
|
-
const response = await this.client.post("/v1/swaps/atomiq/create", body);
|
|
210652
|
-
return response.data;
|
|
210653
|
-
},
|
|
210654
|
-
atomiqSubmit: async (body) => {
|
|
210655
|
-
const response = await this.client.post("/v1/swaps/atomiq/submit", body);
|
|
210656
|
-
return response.data;
|
|
210657
|
-
},
|
|
210658
|
-
atomiqStatus: async (swapId) => {
|
|
210659
|
-
const response = await this.client.get(`/v1/swaps/atomiq/status/${swapId}`);
|
|
210660
|
-
return response.data;
|
|
210661
|
-
},
|
|
210662
|
-
atomiqEnrichByTxIds: async (body) => {
|
|
210663
|
-
const response = await this.client.post(`/v1/swaps/atomiq/enrich`, body);
|
|
210664
|
-
return response.data;
|
|
210665
|
-
},
|
|
210666
|
-
atomiqCommit: async (body) => {
|
|
210667
|
-
const response = await this.client.post("/v1/swaps/atomiq/commit", body);
|
|
210668
|
-
return response.data;
|
|
210669
|
-
},
|
|
210670
|
-
log: async (swapData) => {
|
|
210671
|
-
const swapRecord = {
|
|
210672
|
-
slippage: swapData.slippage || "0",
|
|
210673
|
-
feeRate: swapData.feeRate || "0",
|
|
210674
|
-
...swapData
|
|
210675
|
-
};
|
|
210676
|
-
await this.authenticatedClient.post("/v1/swaps/log", swapRecord);
|
|
210677
|
-
}
|
|
210678
|
-
};
|
|
210679
|
-
earn = {
|
|
210680
|
-
log: async (earnData) => {
|
|
210681
|
-
await this.authenticatedClient.post("/v1/earn/log", earnData);
|
|
210682
|
-
}
|
|
210683
|
-
};
|
|
210684
|
-
v3 = {
|
|
210685
|
-
getRunesBalance: async (body) => {
|
|
210686
|
-
const response = await this.client.get(`/v3/address/${body.address}/runes/balance?includeUnconfirmed=${body.includeUnconfirmed}`);
|
|
210687
|
-
return response.data;
|
|
210688
|
-
},
|
|
210689
|
-
getRunesMarketData: async (body) => {
|
|
210690
|
-
const response = await this.client.post("/v3/runes/market-data", body);
|
|
210691
|
-
return response.data;
|
|
210692
|
-
},
|
|
210693
|
-
getBrc20Balance: async (body) => {
|
|
210694
|
-
const response = await this.client.get(`/v3/address/${body.address}/brc20/balance`);
|
|
210695
|
-
return response.data;
|
|
210696
|
-
},
|
|
210697
|
-
getBrc20MarketData: async (body) => {
|
|
210698
|
-
const response = await this.client.post("/v3/brc20/market-data", body);
|
|
210699
|
-
return response.data;
|
|
210700
|
-
},
|
|
210701
|
-
getSip10MarketData: async (body) => {
|
|
210702
|
-
const response = await this.client.post("/v3/sip10/market-data", body);
|
|
210703
|
-
return response.data;
|
|
210704
|
-
}
|
|
210705
|
-
};
|
|
210706
|
-
callToAction = {
|
|
210707
|
-
getExtensionCallToAction: async () => {
|
|
210708
|
-
const response = await this.client.get("/v3/call-to-action/extension");
|
|
210709
|
-
return response.data;
|
|
210710
|
-
},
|
|
210711
|
-
getMobileCallToAction: async () => {
|
|
210712
|
-
const response = await this.client.get("/v3/call-to-action/mobile");
|
|
210713
|
-
return response.data;
|
|
210714
|
-
},
|
|
210715
|
-
getPortalCallToAction: async () => {
|
|
210716
|
-
const response = await this.client.get("/v3/call-to-action/portal");
|
|
210717
|
-
return response.data;
|
|
210718
|
-
}
|
|
210719
|
-
};
|
|
210720
|
-
onramp = {
|
|
210721
|
-
getOnrampSignatureData: async (body) => {
|
|
210722
|
-
const response = await this.client.get(`/v1/onramp/sign-address?address=${body.address}&platform=${body.platform}`);
|
|
210723
|
-
return response.data;
|
|
210724
|
-
}
|
|
210725
|
-
};
|
|
210726
|
-
due = {
|
|
210727
|
-
createAccount: async (body) => {
|
|
210728
|
-
const response = await this.authenticatedClient.post("/v1/due/accounts", body);
|
|
210729
|
-
return response.data;
|
|
210730
|
-
},
|
|
210731
|
-
getAccount: async () => {
|
|
210732
|
-
const response = await this.authenticatedClient.get("/v1/due/accounts");
|
|
210733
|
-
return response.data;
|
|
210734
|
-
},
|
|
210735
|
-
acceptTos: async () => {
|
|
210736
|
-
const response = await this.authenticatedClient.post("/v1/due/accounts/accept-tos");
|
|
210737
|
-
return response.data;
|
|
210738
|
-
},
|
|
210739
|
-
getTos: async () => {
|
|
210740
|
-
const response = await this.authenticatedClient.get("/v1/due/accounts/tos");
|
|
210741
|
-
return response.data;
|
|
210742
|
-
},
|
|
210743
|
-
getAccountCategories: async () => {
|
|
210744
|
-
const response = await this.authenticatedClient.get("/v1/due/account-categories");
|
|
210745
|
-
return response.data;
|
|
210746
|
-
},
|
|
210747
|
-
createVirtualAccount: async (body) => {
|
|
210748
|
-
const response = await this.authenticatedClient.post("/v1/due/virtual-accounts", body);
|
|
210749
|
-
return response.data;
|
|
210750
|
-
},
|
|
210751
|
-
listVirtualAccounts: async (params) => {
|
|
210752
|
-
const response = await this.authenticatedClient.get("/v1/due/virtual-accounts", {
|
|
210753
|
-
params
|
|
210754
|
-
});
|
|
210755
|
-
return response.data;
|
|
210756
|
-
},
|
|
210757
|
-
getVirtualAccount: async (id) => {
|
|
210758
|
-
const response = await this.authenticatedClient.get(`/v1/due/virtual-accounts/${id}`);
|
|
210759
|
-
return response.data;
|
|
210760
|
-
},
|
|
210761
|
-
getChannels: async (params) => {
|
|
210762
|
-
const response = await this.authenticatedClient.get(`/v1/due/channels`, {
|
|
210763
|
-
params
|
|
210764
|
-
});
|
|
210765
|
-
return response.data;
|
|
210766
|
-
},
|
|
210767
|
-
createQuote: async (body) => {
|
|
210768
|
-
const response = await this.authenticatedClient.post("/v1/due/quotes", body);
|
|
210769
|
-
return response.data;
|
|
210770
|
-
},
|
|
210771
|
-
getPaymentSchemas: async () => {
|
|
210772
|
-
const response = await this.authenticatedClient.get("/v1/due/schemas");
|
|
210773
|
-
return response.data;
|
|
210774
|
-
}
|
|
210775
|
-
};
|
|
210892
|
+
}, vault, network2);
|
|
210893
|
+
this.rateLimiter = new AxiosRateLimit([this.client, this.authenticatedClient], {
|
|
210894
|
+
maxRPS: 10
|
|
210895
|
+
});
|
|
210896
|
+
this.network = network2;
|
|
210897
|
+
const deps = { client: this.client, authenticatedClient: this.authenticatedClient, network: network2 };
|
|
210898
|
+
this.prices = createPricesMethods(deps);
|
|
210899
|
+
this.tokens = createTokensMethods(deps);
|
|
210900
|
+
this.collections = createCollectionsMethods(deps);
|
|
210901
|
+
this.stacking = createStackingMethods(deps);
|
|
210902
|
+
this.market = createMarketMethods(deps);
|
|
210903
|
+
this.app = createAppMethods(deps);
|
|
210904
|
+
this.device = createDeviceMethods(deps);
|
|
210905
|
+
this.signing = createSigningMethods(deps);
|
|
210906
|
+
this.auth = createAuthMethods(deps);
|
|
210907
|
+
this.account = createAccountMethods(deps);
|
|
210908
|
+
this.listings = createListingsMethods(deps);
|
|
210909
|
+
this.starknet = createStarknetMethods(deps);
|
|
210910
|
+
this.spark = createSparkMethods(deps);
|
|
210911
|
+
this.swaps = createSwapsMethods(deps);
|
|
210912
|
+
this.earn = createEarnMethods(deps);
|
|
210913
|
+
this.onramp = createOnrampMethods(deps);
|
|
210914
|
+
this.callToAction = createCallToActionMethods(deps);
|
|
210915
|
+
this.due = createDueMethods(deps);
|
|
210916
|
+
this.fetchBtcFeeRate = this.prices.fetchBtcFeeRate;
|
|
210917
|
+
this.fetchStxToBtcRate = this.prices.fetchStxToBtcRate;
|
|
210918
|
+
this.fetchStrkToBtcRate = this.prices.fetchStrkToBtcRate;
|
|
210919
|
+
this.fetchBtcToCurrencyRate = this.prices.fetchBtcToCurrencyRate;
|
|
210920
|
+
this.fetchTokenFiateRate = this.prices.fetchTokenFiateRate;
|
|
210921
|
+
this.getSip10Tokens = this.tokens.getSip10Tokens;
|
|
210922
|
+
this.getSparkTokenPools = this.tokens.getSparkTokenPools;
|
|
210923
|
+
this.getBrc20Tokens = this.tokens.getBrc20Tokens;
|
|
210924
|
+
this.getTokenStatsAndInfo = this.tokens.getTokenStatsAndInfo;
|
|
210925
|
+
this.getRuneFiatRates = this.tokens.getRuneFiatRates;
|
|
210926
|
+
this.getRuneTxHistory = this.tokens.getRuneTxHistory;
|
|
210927
|
+
this.getTopTokens = this.tokens.getTopTokens;
|
|
210928
|
+
this.getTopBtknTokens = this.tokens.getTopBtknTokens;
|
|
210929
|
+
this.getTopAnvuTokens = this.tokens.getTopAnvuTokens;
|
|
210930
|
+
this.getSpamTokensList = this.tokens.getSpamTokensList;
|
|
210931
|
+
this.getCollections = this.collections.getCollections;
|
|
210932
|
+
this.getAllCollections = this.collections.getAllCollections;
|
|
210933
|
+
this.getOrdinalCollectionDetails = this.collections.getOrdinalCollectionDetails;
|
|
210934
|
+
this.getStacksCollectionDetails = this.collections.getStacksCollectionDetails;
|
|
210935
|
+
this.getAddressCollectionOrdinals = this.collections.getAddressCollectionOrdinals;
|
|
210936
|
+
this.getAddressCollectionStacks = this.collections.getAddressCollectionStacks;
|
|
210937
|
+
this.getCollectionSpecificInscriptions = this.collections.getCollectionSpecificInscriptions;
|
|
210938
|
+
this.getCollectionMarketData = this.collections.getCollectionMarketData;
|
|
210939
|
+
this.getInscription = this.collections.getInscription;
|
|
210940
|
+
this.getOrdinalInfo = this.collections.getOrdinalInfo;
|
|
210941
|
+
this.getErc721Metadata = this.collections.getErc721Metadata;
|
|
210942
|
+
this.fetchStackingPoolInfo = this.stacking.fetchStackingPoolInfo;
|
|
210943
|
+
this.fetchPoolStackerInfo = this.stacking.fetchPoolStackerInfo;
|
|
210944
|
+
this.getPoolStackingData = this.stacking.getPoolStackingData;
|
|
210945
|
+
this.getCoinsMarketData = this.market.getCoinsMarketData;
|
|
210946
|
+
this.getExchangeRate = this.market.getExchangeRate;
|
|
210947
|
+
this.getHistoricalData = this.market.getHistoricalData;
|
|
210948
|
+
this.fetchAppInfo = this.app.fetchAppInfo;
|
|
210949
|
+
this.getAppConfig = this.app.getAppConfig;
|
|
210950
|
+
this.getAppFeatures = this.app.getAppFeatures;
|
|
210951
|
+
this.getFeaturedDapps = this.app.getFeaturedDapps;
|
|
210952
|
+
this.getNotificationBanners = this.app.getNotificationBanners;
|
|
210953
|
+
this.storeDeviceAndUserInfo = this.device.storeDeviceAndUserInfo;
|
|
210954
|
+
this.setNotificationSettings = this.device.setNotificationSettings;
|
|
210955
|
+
this.getNotificationSettings = this.device.getNotificationSettings;
|
|
210956
|
+
this.getMoonPaySignedUrl = this.signing.getMoonPaySignedUrl;
|
|
210957
|
+
this.getBinanceSignature = this.signing.getBinanceSignature;
|
|
210958
|
+
}
|
|
210959
|
+
fetchBtcFeeRate;
|
|
210960
|
+
fetchStxToBtcRate;
|
|
210961
|
+
fetchStrkToBtcRate;
|
|
210962
|
+
fetchBtcToCurrencyRate;
|
|
210963
|
+
fetchTokenFiateRate;
|
|
210964
|
+
getSip10Tokens;
|
|
210965
|
+
getSparkTokenPools;
|
|
210966
|
+
getBrc20Tokens;
|
|
210967
|
+
getTokenStatsAndInfo;
|
|
210968
|
+
getRuneFiatRates;
|
|
210969
|
+
getRuneTxHistory;
|
|
210970
|
+
getTopTokens;
|
|
210971
|
+
getTopBtknTokens;
|
|
210972
|
+
getTopAnvuTokens;
|
|
210973
|
+
getSpamTokensList;
|
|
210974
|
+
getCollections;
|
|
210975
|
+
getAllCollections;
|
|
210976
|
+
getOrdinalCollectionDetails;
|
|
210977
|
+
getStacksCollectionDetails;
|
|
210978
|
+
getAddressCollectionOrdinals;
|
|
210979
|
+
getAddressCollectionStacks;
|
|
210980
|
+
getCollectionSpecificInscriptions;
|
|
210981
|
+
getCollectionMarketData;
|
|
210982
|
+
getInscription;
|
|
210983
|
+
getOrdinalInfo;
|
|
210984
|
+
getErc721Metadata;
|
|
210985
|
+
fetchStackingPoolInfo;
|
|
210986
|
+
fetchPoolStackerInfo;
|
|
210987
|
+
getPoolStackingData;
|
|
210988
|
+
getCoinsMarketData;
|
|
210989
|
+
getExchangeRate;
|
|
210990
|
+
getHistoricalData;
|
|
210991
|
+
fetchAppInfo;
|
|
210992
|
+
getAppConfig;
|
|
210993
|
+
getAppFeatures;
|
|
210994
|
+
getFeaturedDapps;
|
|
210995
|
+
getNotificationBanners;
|
|
210996
|
+
storeDeviceAndUserInfo;
|
|
210997
|
+
setNotificationSettings;
|
|
210998
|
+
getNotificationSettings;
|
|
210999
|
+
getMoonPaySignedUrl;
|
|
211000
|
+
getBinanceSignature;
|
|
210776
211001
|
logout = () => {
|
|
210777
211002
|
this.authenticatedClient.logout();
|
|
210778
211003
|
};
|
|
@@ -210945,7 +211170,7 @@ async function getAccountStrkAddresses({ rootNode, accountIndex }) {
|
|
|
210945
211170
|
return strkAddresses;
|
|
210946
211171
|
}
|
|
210947
211172
|
var getStarknetNetwork = (type) => type === "Mainnet" ? constants7.NetworkName.SN_MAIN : constants7.NetworkName.SN_SEPOLIA;
|
|
210948
|
-
var
|
|
211173
|
+
var init_starknet4 = __esm(() => {
|
|
210949
211174
|
init_utils14();
|
|
210950
211175
|
});
|
|
210951
211176
|
|
|
@@ -211575,7 +211800,7 @@ var init_account = __esm(() => {
|
|
|
211575
211800
|
init_starknet2();
|
|
211576
211801
|
init_btcNetwork();
|
|
211577
211802
|
init_ecpair();
|
|
211578
|
-
|
|
211803
|
+
init_starknet4();
|
|
211579
211804
|
init_bitcoinModeToLegacyBitcoinNetworkType();
|
|
211580
211805
|
init_bitcoinModeToLegacyBitcoinNetworkType();
|
|
211581
211806
|
import_transactions5 = __toESM(require_dist3(), 1);
|
|
@@ -225104,13 +225329,13 @@ var init_bitcoin2 = () => {};
|
|
|
225104
225329
|
var init_stacks3 = () => {};
|
|
225105
225330
|
|
|
225106
225331
|
// ../walletManager/ledger/starknet/index.ts
|
|
225107
|
-
var
|
|
225332
|
+
var init_starknet5 = () => {};
|
|
225108
225333
|
|
|
225109
225334
|
// ../walletManager/ledger/index.ts
|
|
225110
225335
|
var init_ledger2 = __esm(() => {
|
|
225111
225336
|
init_bitcoin2();
|
|
225112
225337
|
init_stacks3();
|
|
225113
|
-
|
|
225338
|
+
init_starknet5();
|
|
225114
225339
|
});
|
|
225115
225340
|
|
|
225116
225341
|
// ../walletManager/software/bitcoin/accountHelpers.ts
|
|
@@ -225507,7 +225732,7 @@ class SoftwareStarknetWallet {
|
|
|
225507
225732
|
destroy = async () => {};
|
|
225508
225733
|
}
|
|
225509
225734
|
var init_starknetWallet = __esm(() => {
|
|
225510
|
-
|
|
225735
|
+
init_starknet4();
|
|
225511
225736
|
init_common3();
|
|
225512
225737
|
});
|
|
225513
225738
|
|
|
@@ -225572,7 +225797,7 @@ var init_starknetAccountWallet = __esm(() => {
|
|
|
225572
225797
|
});
|
|
225573
225798
|
|
|
225574
225799
|
// ../walletManager/software/starknet/index.ts
|
|
225575
|
-
var
|
|
225800
|
+
var init_starknet6 = __esm(() => {
|
|
225576
225801
|
init_starknetAccountWallet();
|
|
225577
225802
|
init_starknetWallet();
|
|
225578
225803
|
init_utils15();
|
|
@@ -225582,7 +225807,7 @@ var init_starknet5 = __esm(() => {
|
|
|
225582
225807
|
var init_software2 = __esm(() => {
|
|
225583
225808
|
init_bitcoin3();
|
|
225584
225809
|
init_stacks4();
|
|
225585
|
-
|
|
225810
|
+
init_starknet6();
|
|
225586
225811
|
});
|
|
225587
225812
|
|
|
225588
225813
|
// ../walletManager/types/index.ts
|
|
@@ -226882,7 +227107,7 @@ var init_stacks5 = __esm(() => {
|
|
|
226882
227107
|
// ../persistentStoreManager/stores/networks/networks/starknet.ts
|
|
226883
227108
|
import * as v14 from "valibot";
|
|
226884
227109
|
var starknetChainMode, starknetChainModeSchema, starknetNetworkConfigurationSchema, starknetMainnetId = "starknet", starknetSepoliaId = "starknet-sepolia", starknetMainnetConfiguration, starknetSepoliaConfiguration, builtinStarknetNetworkConfigurations;
|
|
226885
|
-
var
|
|
227110
|
+
var init_starknet7 = __esm(() => {
|
|
226886
227111
|
init_chains();
|
|
226887
227112
|
init_common4();
|
|
226888
227113
|
starknetChainMode = {
|
|
@@ -226928,7 +227153,7 @@ var init_network2 = __esm(() => {
|
|
|
226928
227153
|
init_bitcoin4();
|
|
226929
227154
|
init_spark4();
|
|
226930
227155
|
init_stacks5();
|
|
226931
|
-
|
|
227156
|
+
init_starknet7();
|
|
226932
227157
|
networkConfigurationSchema = v15.variant("chain", [
|
|
226933
227158
|
bitcoinNetworkConfigurationSchema,
|
|
226934
227159
|
sparkNetworkConfigurationSchema,
|
|
@@ -226944,7 +227169,7 @@ var init_options = __esm(() => {
|
|
|
226944
227169
|
init_bitcoin4();
|
|
226945
227170
|
init_spark4();
|
|
226946
227171
|
init_stacks5();
|
|
226947
|
-
|
|
227172
|
+
init_starknet7();
|
|
226948
227173
|
omitFields = ["id"];
|
|
226949
227174
|
bitcoinNetworkConfigurationOptionsSchema = v16.omit(bitcoinNetworkConfigurationSchema, omitFields);
|
|
226950
227175
|
sparkNetworkConfigurationOptionsSchema = v16.omit(sparkNetworkConfigurationSchema, omitFields);
|
|
@@ -226967,7 +227192,7 @@ var init_networks = __esm(() => {
|
|
|
226967
227192
|
init_options();
|
|
226968
227193
|
init_spark4();
|
|
226969
227194
|
init_stacks5();
|
|
226970
|
-
|
|
227195
|
+
init_starknet7();
|
|
226971
227196
|
});
|
|
226972
227197
|
|
|
226973
227198
|
// ../persistentStoreManager/stores/networks/index.ts
|
|
@@ -226983,7 +227208,7 @@ var init_networks2 = __esm(() => {
|
|
|
226983
227208
|
init_common4();
|
|
226984
227209
|
init_spark4();
|
|
226985
227210
|
init_stacks5();
|
|
226986
|
-
|
|
227211
|
+
init_starknet7();
|
|
226987
227212
|
init_constants5();
|
|
226988
227213
|
init_networks();
|
|
226989
227214
|
defaultValue3 = {
|
|
@@ -227688,7 +227913,7 @@ var import_transactions10, absoluteMinFee, stxFeeReducer = ({
|
|
|
227688
227913
|
newFee = newFee < BigInt(absoluteMinFee[1]) ? BigInt(absoluteMinFee[1]) : newFee;
|
|
227689
227914
|
return newFee;
|
|
227690
227915
|
}, applyMultiplierAndCapFeeAtThreshold = async (unsignedTx, xverseApiClient) => {
|
|
227691
|
-
const appInfo = await xverseApiClient.fetchAppInfo();
|
|
227916
|
+
const appInfo = await xverseApiClient.app.fetchAppInfo();
|
|
227692
227917
|
const newFee = stxFeeReducer({
|
|
227693
227918
|
initialFee: import_transactions10.getFee(unsignedTx.auth),
|
|
227694
227919
|
appInfo,
|
|
@@ -239551,8 +239776,8 @@ var require_dist21 = __commonJS((exports) => {
|
|
|
239551
239776
|
|
|
239552
239777
|
// ../transactions/stacks/stacking.ts
|
|
239553
239778
|
async function generateUnsignedDelegateTransaction(amount, rewardAddress, poolAddress, poolContractAddress, poolContractName, publicKey, network3, poolPoxAddress, xverseApiClient) {
|
|
239554
|
-
const poolRewardAddressTuple =
|
|
239555
|
-
const userRewardAddressTuple =
|
|
239779
|
+
const poolRewardAddressTuple = import_stacking2.poxAddressToTuple(poolPoxAddress);
|
|
239780
|
+
const userRewardAddressTuple = import_stacking2.poxAddressToTuple(rewardAddress);
|
|
239556
239781
|
const funcArgs = [
|
|
239557
239782
|
import_transactions14.uintCV(amount.toFixed()),
|
|
239558
239783
|
import_transactions14.standardPrincipalCV(poolAddress),
|
|
@@ -239619,13 +239844,13 @@ async function generateUnsignedRevokeTransaction(publicKey, network3, poxContrac
|
|
|
239619
239844
|
});
|
|
239620
239845
|
return unsignedTx;
|
|
239621
239846
|
}
|
|
239622
|
-
var import_connect6,
|
|
239847
|
+
var import_connect6, import_stacking2, import_transactions14;
|
|
239623
239848
|
var init_stacking = __esm(() => {
|
|
239624
239849
|
init_utils16();
|
|
239625
239850
|
init_builders();
|
|
239626
239851
|
init_nonceHelpers();
|
|
239627
239852
|
import_connect6 = __toESM(require_dist20(), 1);
|
|
239628
|
-
|
|
239853
|
+
import_stacking2 = __toESM(require_dist21(), 1);
|
|
239629
239854
|
import_transactions14 = __toESM(require_dist3(), 1);
|
|
239630
239855
|
});
|
|
239631
239856
|
|
|
@@ -239634,7 +239859,7 @@ var import_connect7, import_transactions15, createContractCallPromises = async (
|
|
|
239634
239859
|
const { postConds } = extractFromPayload(payload);
|
|
239635
239860
|
const nonce = await nextBestNonce(import_transactions15.getAddressFromPublicKey(stxPublicKey), network3.stacksApiUrl);
|
|
239636
239861
|
const ftContactAddresses = getFTInfoFromPostConditions(postConds);
|
|
239637
|
-
const coinsMetaDataPromise = xverseApiClient.getSip10Tokens(ftContactAddresses, "USD").catch(() => {
|
|
239862
|
+
const coinsMetaDataPromise = xverseApiClient.tokens.getSip10Tokens(ftContactAddresses, "USD").catch(() => {
|
|
239638
239863
|
return null;
|
|
239639
239864
|
});
|
|
239640
239865
|
const unSignedContractCall = await generateUnsignedTx({
|
|
@@ -241711,7 +241936,7 @@ async function fetchLiquidStakeWbtcApyAndTvl(networkType) {
|
|
|
241711
241936
|
async function fetchStackStxApyAndTvl(xverseApi) {
|
|
241712
241937
|
if (xverseApi.network !== "Mainnet")
|
|
241713
241938
|
return defaultAnyTestnetApyAndTvl;
|
|
241714
|
-
const res = await xverseApi.getPoolStackingData("USD");
|
|
241939
|
+
const res = await xverseApi.stacking.getPoolStackingData("USD");
|
|
241715
241940
|
return {
|
|
241716
241941
|
apy: STACKING_APY,
|
|
241717
241942
|
tvl: Number(res.poolStxLocked.totalStxLockedInCurrency) / MICROSTX_TO_STX_MULTIPLIER
|
|
@@ -241751,7 +241976,7 @@ async function fetchNativeStakeWbtcApyAndTvl(networkType, xverseApi) {
|
|
|
241751
241976
|
stakingContract.get_epoch_info(),
|
|
241752
241977
|
stakingContract.contract_parameters_v1(),
|
|
241753
241978
|
stakingContract.get_current_total_staking_power(),
|
|
241754
|
-
xverseApi.fetchStrkToBtcRate(),
|
|
241979
|
+
xverseApi.prices.fetchStrkToBtcRate(),
|
|
241755
241980
|
poolContract.contract_parameters_v1()
|
|
241756
241981
|
]);
|
|
241757
241982
|
const totalBtcStakingPower = stakingPower["1"].amount_18_decimals;
|
|
@@ -245158,7 +245383,7 @@ var init_xverse_core_private = __esm(() => {
|
|
|
245158
245383
|
init_btcNetwork();
|
|
245159
245384
|
init_permissions();
|
|
245160
245385
|
init_account();
|
|
245161
|
-
|
|
245386
|
+
init_starknet4();
|
|
245162
245387
|
init_api2();
|
|
245163
245388
|
init_bridge();
|
|
245164
245389
|
init_cash();
|
|
@@ -372467,11 +372692,31 @@ var registerAccountCommands = (program) => {
|
|
|
372467
372692
|
|
|
372468
372693
|
// commands/agent.ts
|
|
372469
372694
|
import { spawnSync } from "child_process";
|
|
372695
|
+
import * as readline from "readline";
|
|
372470
372696
|
var DEFAULT_AGENT = "claude";
|
|
372471
372697
|
var readFromTTY = (prompt, mask) => new Promise((resolve) => {
|
|
372698
|
+
const { stdin } = process;
|
|
372699
|
+
if (!stdin.isTTY) {
|
|
372700
|
+
process.stdout.write(prompt);
|
|
372701
|
+
const rl = readline.createInterface({ input: stdin, terminal: false });
|
|
372702
|
+
let firstLine = "";
|
|
372703
|
+
let gotLine = false;
|
|
372704
|
+
rl.on("line", (line) => {
|
|
372705
|
+
if (!gotLine) {
|
|
372706
|
+
firstLine = line;
|
|
372707
|
+
gotLine = true;
|
|
372708
|
+
rl.close();
|
|
372709
|
+
}
|
|
372710
|
+
});
|
|
372711
|
+
rl.once("close", () => {
|
|
372712
|
+
process.stdout.write(`
|
|
372713
|
+
`);
|
|
372714
|
+
resolve(firstLine);
|
|
372715
|
+
});
|
|
372716
|
+
return;
|
|
372717
|
+
}
|
|
372472
372718
|
process.stdout.write(prompt);
|
|
372473
372719
|
const buf = [];
|
|
372474
|
-
const { stdin } = process;
|
|
372475
372720
|
const wasRaw = stdin.isRaw;
|
|
372476
372721
|
stdin.setRawMode(true);
|
|
372477
372722
|
stdin.resume();
|
|
@@ -380508,7 +380753,7 @@ Run with --yes to confirm.`,
|
|
|
380508
380753
|
};
|
|
380509
380754
|
|
|
380510
380755
|
// index.ts
|
|
380511
|
-
var cliVersion = "0.1.
|
|
380756
|
+
var cliVersion = "0.1.11";
|
|
380512
380757
|
setXClientVersion(`xverse-agent-wallet/${cliVersion}`);
|
|
380513
380758
|
var program = new Command;
|
|
380514
380759
|
program.name("xverse-wallet").version(cliVersion).description("Xverse wallet CLI");
|