@sundaeswap/wallet-lite 0.0.21 → 0.0.23
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/cjs/classes/WalletObserver.class.js +89 -41
- package/dist/cjs/classes/WalletObserver.class.js.map +1 -1
- package/dist/esm/classes/WalletObserver.class.js +19 -2
- package/dist/esm/classes/WalletObserver.class.js.map +1 -1
- package/dist/types/classes/WalletObserver.class.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/classes/WalletObserver.class.ts +36 -7
package/package.json
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { TransactionUnspentOutput } from "@cardano-sdk/core/dist/cjs/Serialization/index.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
Cip30WalletApi,
|
|
4
|
+
GetCollateral,
|
|
5
|
+
} from "@cardano-sdk/dapp-connector";
|
|
3
6
|
import { AssetAmount, type IAssetAmountMetadata } from "@sundaeswap/asset";
|
|
4
7
|
import merge from "lodash/merge.js";
|
|
5
8
|
|
|
@@ -517,7 +520,16 @@ export class WalletObserver<
|
|
|
517
520
|
}
|
|
518
521
|
|
|
519
522
|
const [cbor, { Serialization }, { typedHex }] = await Promise.all([
|
|
520
|
-
|
|
523
|
+
(async () => {
|
|
524
|
+
const funcCall =
|
|
525
|
+
this.api?.getCollateral ||
|
|
526
|
+
(this.api?.experimental.getCollateral as GetCollateral);
|
|
527
|
+
if (typeof funcCall !== "function") {
|
|
528
|
+
return [];
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
return await funcCall();
|
|
532
|
+
})(),
|
|
521
533
|
getCardanoCore(),
|
|
522
534
|
getCardanoUtil(),
|
|
523
535
|
]);
|
|
@@ -558,11 +570,28 @@ export class WalletObserver<
|
|
|
558
570
|
}
|
|
559
571
|
}
|
|
560
572
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
573
|
+
let attempts = 0;
|
|
574
|
+
let newMetadata: Map<string, AssetMetadata> | undefined;
|
|
575
|
+
while (attempts <= 3) {
|
|
576
|
+
try {
|
|
577
|
+
newMetadata = await this._options.metadataResolver(
|
|
578
|
+
assetIds.map(normalizeAssetIdWithDot),
|
|
579
|
+
normalizeAssetIdWithDot,
|
|
580
|
+
isAdaAsset
|
|
581
|
+
);
|
|
582
|
+
} catch (e) {
|
|
583
|
+
attempts++;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
if (!newMetadata) {
|
|
588
|
+
newMetadata = await this.fallbackMetadataResolver(
|
|
589
|
+
assetIds.map(normalizeAssetIdWithDot),
|
|
590
|
+
normalizeAssetIdWithDot,
|
|
591
|
+
isAdaAsset
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
|
|
566
595
|
this._cachedMetadata = newMetadata;
|
|
567
596
|
return newMetadata;
|
|
568
597
|
};
|