Skip to content

Commit 74ee5e3

Browse files
committed
#24 add withdraw links fetch & storage
1 parent 00f1ec7 commit 74ee5e3

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/services/config.svc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ async function setWalletId(value) {
5252
});
5353
}
5454

55+
async function getWithdrawLinks() {
56+
const result = await browser.storage.sync.get({
57+
withdrawLinks: ''
58+
})
59+
return result.walletId
60+
}
61+
62+
async function setWithdrawLinks(value) {
63+
return browser.storage.sync.set({
64+
withdrawLinks: value
65+
});
66+
}
67+
5568
async function getActiveWallet() {
5669
const user = await getUser()
5770
const walletId = await getWalletId()
@@ -64,6 +77,7 @@ async function cleanConfig() {
6477
await setUserId('')
6578
await setWalletId('')
6679
await setUser({})
80+
await setWithdrawLinks([])
6781
}
6882

6983
async function isConfigValid() {
@@ -83,6 +97,8 @@ export default {
8397
getWalletId,
8498
setWalletId,
8599
getActiveWallet,
100+
getWithdrawLinks,
101+
setWithdrawLinks,
86102
cleanConfig,
87103
isConfigValid,
88104
}

src/services/lnbits-api.svc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ function lnbitsApi(serverUrl) {
5959
'/api/v1/payments/' + paymentHash,
6060
wallet.inkey
6161
)
62+
},
63+
getWithdrawLinks: function (wallet) {
64+
return this.request(
65+
'get',
66+
'/withdraw/api/v1/links/',
67+
wallet.inkey
68+
)
6269
}
6370
}
6471
}

0 commit comments

Comments
 (0)