@leather.io/utils 0.48.2 → 0.49.0

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @leather.io/utils@0.48.2 build /home/runner/work/mono/mono/packages/utils
2
+ > @leather.io/utils@0.49.0 build /home/runner/work/mono/mono/packages/utils
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,9 +8,9 @@
8
8
  CLI Using tsup config: /home/runner/work/mono/mono/packages/utils/tsup.config.ts
9
9
  CLI Target: es2022
10
10
  ESM Build start
11
- ESM dist/index.js 73.26 KB
12
- ESM dist/index.js.map 138.80 KB
13
- ESM ⚡️ Build success in 38ms
11
+ ESM dist/index.js 73.66 KB
12
+ ESM dist/index.js.map 139.51 KB
13
+ ESM ⚡️ Build success in 86ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 2195ms
16
- DTS dist/index.d.ts 14.75 KB
15
+ DTS ⚡️ Build success in 3207ms
16
+ DTS dist/index.d.ts 15.02 KB
package/CHANGELOG.md CHANGED
@@ -368,6 +368,70 @@
368
368
  * devDependencies
369
369
  * @leather.io/prettier-config bumped to 0.9.0
370
370
 
371
+ ## [0.49.0](https://github.com/leather-io/mono/compare/@leather.io/utils-v0.48.3...@leather.io/utils-v0.49.0) (2025-11-19)
372
+
373
+
374
+ ### Features
375
+
376
+ * add alex swap provider ([152fd3a](https://github.com/leather-io/mono/commit/152fd3a6d015aace7bd682819a7d3d6112a64730))
377
+ * add descriptors to get addresses rpc ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
378
+ * add portfolio table ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
379
+ * portfolio activity ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
380
+ * portfolio ui hover, borders, token count ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
381
+ * **web:** add empty state ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
382
+ * **web:** add hover events ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
383
+ * **web:** add portfolio modal ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
384
+ * **web:** add stacked bar chart ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
385
+ * **web:** add stacks to portfolio list ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
386
+ * **web:** add tooltip ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
387
+ * **web:** adjust hover events ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
388
+ * **web:** bitcoin balance for portfolio ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
389
+ * **web:** breakdown by allocation ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
390
+ * **web:** scaffold portfolio page ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
391
+ * **web:** sip10 avatar icons web ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
392
+ * **web:** sip10 balances and assets ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
393
+ * **web:** stacks portfolio balance ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
394
+
395
+
396
+ ### Bug Fixes
397
+
398
+ * **mobile:** ensure translations updated ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
399
+ * **mobile:** name is now defined for all models used ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
400
+ * responsive portfolio ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
401
+ * **web:** a few style fixes ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
402
+ * **web:** add loading spinner to asset list ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
403
+ * **web:** add loading state to bar ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
404
+ * **web:** ensure stacks renders in list ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
405
+ * **web:** improve hover events and styles ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
406
+ * **web:** invisible hover overlay ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
407
+ * **web:** layout as per designs ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
408
+ * **web:** remove unused ui ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
409
+ * **web:** remove unused var ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
410
+
411
+
412
+ ### Dependencies
413
+
414
+ * The following workspace dependencies were updated
415
+ * dependencies
416
+ * @leather.io/constants bumped to 0.28.0
417
+ * @leather.io/models bumped to 0.49.0
418
+
419
+ ## [0.48.3](https://github.com/leather-io/mono/compare/@leather.io/utils-v0.48.2...@leather.io/utils-v0.48.3) (2025-11-17)
420
+
421
+
422
+ ### Bug Fixes
423
+
424
+ * **mobile:** favour ord.io for viewing inscriptions ([ee42dd6](https://github.com/leather-io/mono/commit/ee42dd66ae0074bc1662928755ce418d1da08297))
425
+ * **mobile:** ord.io preview for html and image, fix bug showing stamp-details ([716bf48](https://github.com/leather-io/mono/commit/716bf4802f94ca01d13ececa7ec323845539cbaf))
426
+
427
+
428
+ ### Dependencies
429
+
430
+ * The following workspace dependencies were updated
431
+ * dependencies
432
+ * @leather.io/constants bumped to 0.27.5
433
+ * @leather.io/models bumped to 0.48.0
434
+
371
435
  ## [0.48.2](https://github.com/leather-io/mono/compare/@leather.io/utils-v0.48.1...@leather.io/utils-v0.48.2) (2025-11-14)
372
436
 
373
437
 
package/dist/index.d.ts CHANGED
@@ -93,6 +93,7 @@ interface CreateInscriptionData {
93
93
  readonly genesisTimestamp: string | number;
94
94
  readonly genesisBlockHeight: number;
95
95
  readonly outputValue: string;
96
+ readonly thumbnailSrc?: string;
96
97
  }
97
98
  declare function createInscriptionAsset(data: CreateInscriptionData): InscriptionAsset;
98
99
 
@@ -101,6 +102,11 @@ declare function isSameAssetId(assetId1: CryptoAssetId, assetId2: CryptoAssetId)
101
102
  declare function isSameAsset(asset1: CryptoAsset, asset2: CryptoAsset): boolean;
102
103
  declare function getAssetId(asset: CryptoAsset): CryptoAssetId;
103
104
  declare function createSip9AssetId(asset: Sip9Asset): CryptoAssetId;
105
+ declare function formatSip9IdField(asset: Sip9Asset): string;
106
+ declare function parseSip9IdField(id: string): {
107
+ assetId: string;
108
+ tokenId: number;
109
+ };
104
110
  type SerializedCryptoAssetId = `${string}|${string}`;
105
111
  declare function serializeAssetId(assetId: CryptoAssetId): SerializedCryptoAssetId;
106
112
  declare function deserializeAssetId(serializedAssetId: SerializedCryptoAssetId): CryptoAssetId;
@@ -205,6 +211,8 @@ interface FlattenedObject {
205
211
  */
206
212
  declare function flattenObject(input: ObjectValue, prefix?: string): FlattenedObject;
207
213
 
214
+ declare const minusSign = "\u2212";
215
+
208
216
  interface SpamFilterArgs {
209
217
  input: string;
210
218
  whitelist: string[];
@@ -283,4 +291,4 @@ declare function uniqueArray<T>(arr: T[]): T[];
283
291
  declare function removeTrailingNullCharacters(s: string): string;
284
292
  declare function isNumberOrNumberList(value: unknown): value is number | number[];
285
293
 
286
- export { type CreateInscriptionData, type FormatAmountOptions, type SerializedCryptoAssetId, aggregateBaseCryptoAssetBalances, aggregateBtcBalances, aggregateStxBalances, assertExistence, assertIsTruthy, assertUnreachable, baseCurrencyAmountInQuote, baseCurrencyAmountInQuoteWithFallback, btcToSat, calculateMeanAverage, capitalize, convertAmountToBaseUnit, convertAmountToFractionalUnit, convertToMoneyTypeWithDefaultOfZero, countDecimals, createAccountAddresses, createBaseCryptoAssetBalance, createBtcBalance, createCounter, createCurrencyFormatter, createInscriptionAsset, createMoney, createMoneyFromDecimal, createNullArrayOfLength, createNumArrayOfRange, createSip9AssetId, createStxBalance, dateToUnixTimestamp, daysInMs, daysInSec, defaultWalletKeyId, delay, deserializeAssetId, ensureArray, extractPhraseFromString, fibonacciGenerator, fiveMinInMs, flattenObject, getAssetDisplayName, getAssetId, getTicker, hasBitcoinAddress, hasStacksAddress, hexToNumber, hoursInMs, hoursInSec, increaseValueByOneMicroStx, initBigNumber, invertExchangeRate, isBigInt, isBoolean, isDefined, isEmpty, isEmptyArray, isEmptyString, isError, isEven, isFiatCurrencyCode, isFulfilled, isFunction, isHexString, isMoney, isMoneyGreaterThanZero, isNumber, isNumberOrNumberList, isObject, isRejected, isSameAsset, isSameAssetId, isString, isTypedArray, isUndefined, makeNumberRange, makeStacksTxExplorerLink, mapObject, matchesAssetId, maxMoney, microStxToStx, migratePositiveAssetBalancesToTop, minMoney, minutesInMs, minutesInSec, moneyToBaseUnit, noop, oneDayInMs, oneMinInMs, oneWeekInMs, propIfDefined, pxStringToNumber, quoteCurrencyAmountToBase, rebaseMarketData, removeTrailingNullCharacters, reverseBytes, safelyFormatHexTxid, sanitizeContent, satToBtc, scaleValue, secondsInMs, serializeAssetId, sortAssetsByName, spamFilter, stxToMicroStx, subtractMoney, sumMoney, sumNumbers, toHexString, truncateMiddle, undefinedIfLengthZero, uniqueArray, unitToFractionalUnit, weeksInMs, weeksInSec, whenInscriptionMimeType, whenNetwork };
294
+ export { type CreateInscriptionData, type FormatAmountOptions, type SerializedCryptoAssetId, aggregateBaseCryptoAssetBalances, aggregateBtcBalances, aggregateStxBalances, assertExistence, assertIsTruthy, assertUnreachable, baseCurrencyAmountInQuote, baseCurrencyAmountInQuoteWithFallback, btcToSat, calculateMeanAverage, capitalize, convertAmountToBaseUnit, convertAmountToFractionalUnit, convertToMoneyTypeWithDefaultOfZero, countDecimals, createAccountAddresses, createBaseCryptoAssetBalance, createBtcBalance, createCounter, createCurrencyFormatter, createInscriptionAsset, createMoney, createMoneyFromDecimal, createNullArrayOfLength, createNumArrayOfRange, createSip9AssetId, createStxBalance, dateToUnixTimestamp, daysInMs, daysInSec, defaultWalletKeyId, delay, deserializeAssetId, ensureArray, extractPhraseFromString, fibonacciGenerator, fiveMinInMs, flattenObject, formatSip9IdField, getAssetDisplayName, getAssetId, getTicker, hasBitcoinAddress, hasStacksAddress, hexToNumber, hoursInMs, hoursInSec, increaseValueByOneMicroStx, initBigNumber, invertExchangeRate, isBigInt, isBoolean, isDefined, isEmpty, isEmptyArray, isEmptyString, isError, isEven, isFiatCurrencyCode, isFulfilled, isFunction, isHexString, isMoney, isMoneyGreaterThanZero, isNumber, isNumberOrNumberList, isObject, isRejected, isSameAsset, isSameAssetId, isString, isTypedArray, isUndefined, makeNumberRange, makeStacksTxExplorerLink, mapObject, matchesAssetId, maxMoney, microStxToStx, migratePositiveAssetBalancesToTop, minMoney, minusSign, minutesInMs, minutesInSec, moneyToBaseUnit, noop, oneDayInMs, oneMinInMs, oneWeekInMs, parseSip9IdField, propIfDefined, pxStringToNumber, quoteCurrencyAmountToBase, rebaseMarketData, removeTrailingNullCharacters, reverseBytes, safelyFormatHexTxid, sanitizeContent, satToBtc, scaleValue, secondsInMs, serializeAssetId, sortAssetsByName, spamFilter, stxToMicroStx, subtractMoney, sumMoney, sumNumbers, toHexString, truncateMiddle, undefinedIfLengthZero, uniqueArray, unitToFractionalUnit, weeksInMs, weeksInSec, whenInscriptionMimeType, whenNetwork };
package/dist/index.js CHANGED
@@ -1440,6 +1440,7 @@ function aggregateStxBalances(balances) {
1440
1440
  }
1441
1441
 
1442
1442
  // src/assets/inscription-helpers.ts
1443
+ import { ORD_IO_URL } from "@leather.io/constants";
1443
1444
  import {
1444
1445
  CryptoAssetCategories,
1445
1446
  CryptoAssetChains,
@@ -1509,7 +1510,10 @@ function whenInscriptionMimeType(mimeType, branches) {
1509
1510
  throw new Error("Unhandled inscription type");
1510
1511
  }
1511
1512
  function createInscriptionAsset(data) {
1512
- const iframeSrc = `https://ordinals.com/preview/${data.id}`;
1513
+ const ordinalPreviewSrc = `https://ordinals.com/preview/${data.id}`;
1514
+ const ordIoSrc = `${ORD_IO_URL}/content/${data.id}`;
1515
+ const thumbnailSrc = data.thumbnailSrc ?? ordinalPreviewSrc;
1516
+ const primarySrc = data.contentSrc || ordinalPreviewSrc;
1513
1517
  const preview = `https://ordinals.hiro.so/inscription/${data.id}`;
1514
1518
  const title = `Inscription ${data.number}`;
1515
1519
  const [txid, output, offset] = data.satPoint.split(":");
@@ -1528,7 +1532,8 @@ function createInscriptionAsset(data) {
1528
1532
  genesisBlockHeight: data.genesisBlockHeight,
1529
1533
  genesisBlockHash: data.genesisBlockHash,
1530
1534
  genesisTimestamp: dateToUnixTimestamp(new Date(data.genesisTimestamp)),
1531
- value: data.outputValue
1535
+ value: data.outputValue,
1536
+ thumbnailSrc
1532
1537
  };
1533
1538
  if (!data.mimeType) {
1534
1539
  return {
@@ -1542,31 +1547,33 @@ function createInscriptionAsset(data) {
1542
1547
  ...sharedInfo,
1543
1548
  mimeType: "audio",
1544
1549
  name: "inscription",
1545
- src: iframeSrc
1550
+ src: primarySrc
1546
1551
  }),
1547
1552
  gltf: () => ({
1548
1553
  ...sharedInfo,
1549
1554
  mimeType: "gltf",
1550
1555
  name: "inscription",
1551
- src: iframeSrc
1556
+ src: primarySrc
1552
1557
  }),
1553
1558
  html: () => ({
1554
1559
  ...sharedInfo,
1555
1560
  mimeType: "html",
1556
1561
  name: "inscription",
1557
- src: iframeSrc
1562
+ thumbnailSrc: ordIoSrc,
1563
+ src: primarySrc
1558
1564
  }),
1559
1565
  image: () => ({
1560
1566
  ...sharedInfo,
1561
1567
  mimeType: "image",
1562
1568
  name: "inscription",
1563
- src: data.contentSrc
1569
+ thumbnailSrc: ordIoSrc,
1570
+ src: primarySrc
1564
1571
  }),
1565
1572
  svg: () => ({
1566
1573
  ...sharedInfo,
1567
1574
  mimeType: "svg",
1568
1575
  name: "inscription",
1569
- src: iframeSrc
1576
+ src: primarySrc
1570
1577
  }),
1571
1578
  text: () => ({
1572
1579
  ...sharedInfo,
@@ -1578,29 +1585,24 @@ function createInscriptionAsset(data) {
1578
1585
  ...sharedInfo,
1579
1586
  mimeType: "video",
1580
1587
  name: "inscription",
1581
- src: iframeSrc
1588
+ src: primarySrc
1582
1589
  }),
1583
1590
  other: () => ({
1584
1591
  ...sharedInfo,
1585
1592
  mimeType: "other",
1586
1593
  name: "inscription",
1587
- src: ""
1594
+ src: data.contentSrc ?? ""
1588
1595
  })
1589
1596
  });
1590
1597
  }
1591
1598
 
1592
1599
  // src/assets/asset-id.ts
1593
1600
  import {
1594
- CryptoAssetProtocols as CryptoAssetProtocols2,
1595
- isSip9Asset
1601
+ CryptoAssetProtocols as CryptoAssetProtocols2
1596
1602
  } from "@leather.io/models";
1597
1603
  function matchesAssetId(asset, assetId) {
1598
- const protocol = getAssetId(asset).protocol;
1599
- const id = getAssetId(asset).id;
1600
- if (isSip9Asset(asset)) {
1601
- return protocol === assetId.protocol && assetId.id === asset.assetId && assetId.tokenId === asset.tokenId;
1602
- }
1603
- return protocol === assetId.protocol && id === assetId.id;
1604
+ const assetIdentifier = getAssetId(asset);
1605
+ return isSameAssetId(assetIdentifier, assetId);
1604
1606
  }
1605
1607
  function isSameAssetId(assetId1, assetId2) {
1606
1608
  return assetId1.protocol === assetId2.protocol && assetId1.id === assetId2.id;
@@ -1664,21 +1666,28 @@ function getAssetId(asset) {
1664
1666
  function createSip9AssetId(asset) {
1665
1667
  return {
1666
1668
  protocol: asset.protocol,
1667
- id: `${asset.assetId}|${asset.tokenId}`
1669
+ id: formatSip9IdField(asset)
1668
1670
  };
1669
1671
  }
1672
+ function formatSip9IdField(asset) {
1673
+ return `${asset.assetId}|${asset.tokenId}`;
1674
+ }
1675
+ function parseSip9IdField(id) {
1676
+ const [assetId, tokenId] = id.split("|");
1677
+ return { assetId, tokenId: Number(tokenId) };
1678
+ }
1670
1679
  function serializeAssetId(assetId) {
1671
1680
  return `${assetId.protocol}|${assetId.id}`;
1672
1681
  }
1673
1682
  function deserializeAssetId(serializedAssetId) {
1674
- const [protocol, id, tokenId] = serializedAssetId.split("|");
1683
+ const [protocol, ...idParts] = serializedAssetId.split("|");
1684
+ const id = idParts.join("|");
1675
1685
  if (!Object.keys(CryptoAssetProtocols2).includes(protocol)) {
1676
1686
  throw new Error(`Unrecognized Asset Protocol: ${protocol}`);
1677
1687
  }
1678
1688
  return {
1679
1689
  protocol,
1680
- id,
1681
- tokenId: tokenId ? parseInt(tokenId, 10) : void 0
1690
+ id
1682
1691
  };
1683
1692
  }
1684
1693
 
@@ -1989,6 +1998,9 @@ function flattenObject(input, prefix = "") {
1989
1998
  return result;
1990
1999
  }
1991
2000
 
2001
+ // src/special-char.ts
2002
+ var minusSign = "\u2212";
2003
+
1992
2004
  // src/spam-filter/tlds-list.ts
1993
2005
  var tlds = [
1994
2006
  "AAA",
@@ -3696,6 +3708,7 @@ export {
3696
3708
  fibonacciGenerator,
3697
3709
  fiveMinInMs,
3698
3710
  flattenObject,
3711
+ formatSip9IdField,
3699
3712
  getAssetDisplayName,
3700
3713
  getAssetId,
3701
3714
  getTicker,
@@ -3738,6 +3751,7 @@ export {
3738
3751
  microStxToStx,
3739
3752
  migratePositiveAssetBalancesToTop,
3740
3753
  minMoney,
3754
+ minusSign,
3741
3755
  minutesInMs,
3742
3756
  minutesInSec,
3743
3757
  moneyToBaseUnit,
@@ -3745,6 +3759,7 @@ export {
3745
3759
  oneDayInMs,
3746
3760
  oneMinInMs,
3747
3761
  oneWeekInMs,
3762
+ parseSip9IdField,
3748
3763
  propIfDefined,
3749
3764
  pxStringToNumber,
3750
3765
  quoteCurrencyAmountToBase,