@routstr/sdk 0.1.4 → 0.1.5
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/client/index.js +9 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +9 -4
- package/dist/client/index.mjs.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/dist/wallet/index.js +3 -0
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +3 -0
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -681,6 +681,9 @@ var BalanceManager = class {
|
|
|
681
681
|
fetchResult.token
|
|
682
682
|
);
|
|
683
683
|
const totalAmountMsat = receiveResult.unit === "msat" ? receiveResult.amount : receiveResult.amount * 1e3;
|
|
684
|
+
if (receiveResult.success) {
|
|
685
|
+
this.storageAdapter.removeApiKey(baseUrl);
|
|
686
|
+
}
|
|
684
687
|
return {
|
|
685
688
|
success: receiveResult.success,
|
|
686
689
|
refundedAmount: totalAmountMsat,
|
|
@@ -1761,7 +1764,7 @@ var ProviderManager = class {
|
|
|
1761
1764
|
};
|
|
1762
1765
|
|
|
1763
1766
|
// client/RoutstrClient.ts
|
|
1764
|
-
var TOPUP_MARGIN =
|
|
1767
|
+
var TOPUP_MARGIN = 1.2;
|
|
1765
1768
|
var RoutstrClient = class {
|
|
1766
1769
|
constructor(walletAdapter, storageAdapter, providerRegistry, alertLevel, mode = "xcashu") {
|
|
1767
1770
|
this.walletAdapter = walletAdapter;
|
|
@@ -2265,8 +2268,6 @@ var RoutstrClient = class {
|
|
|
2265
2268
|
status,
|
|
2266
2269
|
refundResult.message ?? "Unknown error"
|
|
2267
2270
|
);
|
|
2268
|
-
} else {
|
|
2269
|
-
this.storageAdapter.removeApiKey(baseUrl);
|
|
2270
2271
|
}
|
|
2271
2272
|
}
|
|
2272
2273
|
}
|
|
@@ -2365,7 +2366,11 @@ var RoutstrClient = class {
|
|
|
2365
2366
|
baseUrl
|
|
2366
2367
|
);
|
|
2367
2368
|
const latestTokenBalance = latestBalanceInfo.unit === "msat" ? latestBalanceInfo.amount / 1e3 : latestBalanceInfo.amount;
|
|
2368
|
-
this.storageAdapter.
|
|
2369
|
+
const storedApiKeyEntry = this.storageAdapter.getApiKey(baseUrl);
|
|
2370
|
+
if (storedApiKeyEntry?.key.startsWith("cashu") && latestBalanceInfo.apiKey) {
|
|
2371
|
+
this.storageAdapter.removeApiKey(baseUrl);
|
|
2372
|
+
this.storageAdapter.setApiKey(baseUrl, latestBalanceInfo.apiKey);
|
|
2373
|
+
}
|
|
2369
2374
|
this.storageAdapter.updateApiKeyBalance(baseUrl, latestTokenBalance);
|
|
2370
2375
|
satsSpent = initialTokenBalance - latestTokenBalance;
|
|
2371
2376
|
} catch (e) {
|