@sundaeswap/wallet-lite 0.0.50 → 0.0.52

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sundaeswap/wallet-lite",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -38,8 +38,8 @@
38
38
  "@babel/cli": "^7.24.7",
39
39
  "@fabianbormann/cardano-peer-connect": "^1.2.17",
40
40
  "@koralabs/adahandle-sdk": "^1.5.4",
41
- "@sundaeswap/asset": "^0.7.1",
42
- "@sundaeswap/fraction": "0.5.9",
41
+ "@sundaeswap/asset": "^1.0.6",
42
+ "@sundaeswap/fraction": "1.0.5",
43
43
  "rxjs": "^7.8.1"
44
44
  },
45
45
  "peerDependencies": {
@@ -58,7 +58,7 @@
58
58
  "@babel/preset-react": "^7.24.7",
59
59
  "@babel/preset-typescript": "^7.24.7",
60
60
  "@happy-dom/global-registrator": "^14.12.0",
61
- "@sundaeswap/babel-preset": "^2.0.4",
61
+ "@sundaeswap/babel-preset": "^2.0.15",
62
62
  "@testing-library/dom": "^10.1.0",
63
63
  "@testing-library/react": "^16.0.0",
64
64
  "@testing-library/react-hooks": "^8.0.1",
@@ -44,17 +44,22 @@ export type TWindowCardano = {
44
44
  [K in TSupportedWalletExtensions]?: IWindowCip30Extension;
45
45
  };
46
46
 
47
+ /**
48
+ * Describes the function arguments for the metadata resolver.
49
+ */
50
+ export interface IMetadataResolverFuncArgs {
51
+ assetIds: string[];
52
+ normalizeAssetId: typeof normalizeAssetIdWithDot;
53
+ isAdaAsset: typeof isAdaAsset;
54
+ }
55
+
47
56
  /**
48
57
  * The metadata resolver should return a map composed of
49
58
  * the asset ID as the key, and the metadata as the value.
50
59
  */
51
60
  export type TMetadataResolverFunc<
52
61
  T extends IAssetAmountMetadata = IAssetAmountMetadata,
53
- > = (
54
- assetIds: string[],
55
- normalizeAssetIdFunc: typeof normalizeAssetIdWithDot,
56
- isAdaAssetFunc: typeof isAdaAsset,
57
- ) => Promise<Map<string, T>>;
62
+ > = (args: IMetadataResolverFuncArgs) => Promise<Map<string, T>>;
58
63
 
59
64
  /**
60
65
  * Options that are passed to the WalletObserver instance.
@@ -638,22 +638,22 @@ export class WalletObserver<
638
638
  let newMetadata: Map<string, AssetMetadata> | undefined;
639
639
  while (attempts <= 3 && !newMetadata) {
640
640
  try {
641
- newMetadata = await this._options.metadataResolver(
642
- assetIds.map(normalizeAssetIdWithDot),
643
- normalizeAssetIdWithDot,
641
+ newMetadata = await this._options.metadataResolver({
642
+ assetIds: assetIds.map(normalizeAssetIdWithDot),
643
+ normalizeAssetId: normalizeAssetIdWithDot,
644
644
  isAdaAsset,
645
- );
645
+ });
646
646
  } catch (e) {
647
647
  attempts++;
648
648
  }
649
649
  }
650
650
 
651
651
  if (!newMetadata) {
652
- newMetadata = await this.fallbackMetadataResolver(
653
- assetIds.map(normalizeAssetIdWithDot),
654
- normalizeAssetIdWithDot,
652
+ newMetadata = await this.fallbackMetadataResolver({
653
+ assetIds: assetIds.map(normalizeAssetIdWithDot),
654
+ normalizeAssetId: normalizeAssetIdWithDot,
655
655
  isAdaAsset,
656
- );
656
+ });
657
657
  }
658
658
 
659
659
  this._cachedMetadata = newMetadata;
@@ -671,7 +671,7 @@ export class WalletObserver<
671
671
  * @type {TMetadataResolverFunc<AssetMetadata>}
672
672
  */
673
673
  public fallbackMetadataResolver: TMetadataResolverFunc<AssetMetadata> =
674
- async (assetIds) => {
674
+ async ({ assetIds }) => {
675
675
  const map = new Map<string, AssetMetadata>();
676
676
  assetIds.forEach((id) =>
677
677
  map.set(normalizeAssetIdWithDot(id), {