@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/index.mjs
CHANGED
|
@@ -1314,6 +1314,9 @@ var BalanceManager = class {
|
|
|
1314
1314
|
fetchResult.token
|
|
1315
1315
|
);
|
|
1316
1316
|
const totalAmountMsat = receiveResult.unit === "msat" ? receiveResult.amount : receiveResult.amount * 1e3;
|
|
1317
|
+
if (receiveResult.success) {
|
|
1318
|
+
this.storageAdapter.removeApiKey(baseUrl);
|
|
1319
|
+
}
|
|
1317
1320
|
return {
|
|
1318
1321
|
success: receiveResult.success,
|
|
1319
1322
|
refundedAmount: totalAmountMsat,
|
|
@@ -2450,7 +2453,7 @@ var ProviderManager = class {
|
|
|
2450
2453
|
};
|
|
2451
2454
|
|
|
2452
2455
|
// client/RoutstrClient.ts
|
|
2453
|
-
var TOPUP_MARGIN =
|
|
2456
|
+
var TOPUP_MARGIN = 1.2;
|
|
2454
2457
|
var RoutstrClient = class {
|
|
2455
2458
|
constructor(walletAdapter, storageAdapter, providerRegistry, alertLevel, mode = "xcashu") {
|
|
2456
2459
|
this.walletAdapter = walletAdapter;
|
|
@@ -2954,8 +2957,6 @@ var RoutstrClient = class {
|
|
|
2954
2957
|
status,
|
|
2955
2958
|
refundResult.message ?? "Unknown error"
|
|
2956
2959
|
);
|
|
2957
|
-
} else {
|
|
2958
|
-
this.storageAdapter.removeApiKey(baseUrl);
|
|
2959
2960
|
}
|
|
2960
2961
|
}
|
|
2961
2962
|
}
|
|
@@ -3054,7 +3055,11 @@ var RoutstrClient = class {
|
|
|
3054
3055
|
baseUrl
|
|
3055
3056
|
);
|
|
3056
3057
|
const latestTokenBalance = latestBalanceInfo.unit === "msat" ? latestBalanceInfo.amount / 1e3 : latestBalanceInfo.amount;
|
|
3057
|
-
this.storageAdapter.
|
|
3058
|
+
const storedApiKeyEntry = this.storageAdapter.getApiKey(baseUrl);
|
|
3059
|
+
if (storedApiKeyEntry?.key.startsWith("cashu") && latestBalanceInfo.apiKey) {
|
|
3060
|
+
this.storageAdapter.removeApiKey(baseUrl);
|
|
3061
|
+
this.storageAdapter.setApiKey(baseUrl, latestBalanceInfo.apiKey);
|
|
3062
|
+
}
|
|
3058
3063
|
this.storageAdapter.updateApiKeyBalance(baseUrl, latestTokenBalance);
|
|
3059
3064
|
satsSpent = initialTokenBalance - latestTokenBalance;
|
|
3060
3065
|
} catch (e) {
|