REF: improv ldk

This commit is contained in:
Overtorment 2021-09-24 15:50:06 +01:00
parent 1e080ec244
commit 2caf9886b6
No known key found for this signature in database
GPG Key ID: AB15F43F78CCBC06
7 changed files with 23 additions and 10 deletions

View File

@ -378,6 +378,8 @@ export class LightningLdkWallet extends LightningCustodianWallet {
await this.waitForAtLeastOneChannelBecomeActive();
}
if (this.getReceivableBalance() < amtSat) throw new Error('You dont have enough inbound capacity');
const bolt11 = await RnLdk.addInvoice(amtSat * 1000, memo);
if (!bolt11) return false;
@ -595,10 +597,14 @@ export class LightningLdkWallet extends LightningCustodianWallet {
await RnLdk.setRefundAddressScript(this._refundAddressScriptHex);
}
async getVersion() {
static async getVersion() {
return RnLdk.getVersion();
}
static getPackageVersion() {
return RnLdk.getPackageVersion();
}
/**
* executes async function in background, so calling code can return immediately, while catching all thrown exceptions
* and showing them in alert() instead of propagating them up

View File

@ -26,8 +26,8 @@ export const LdkButton = props => {
<Image style={{ width: 34, height: 34, marginRight: 8 }} source={require('../img/addWallet/lightning.png')} />
</View>
<View>
<Text style={{ color: colors.lnborderColor, fontWeight: 'bold', fontSize: 18 }}>LDK</Text>
<Text style={{ color: colors.alternativeTextColor, fontSize: 13, fontWeight: '500' }}>0.2.12</Text>
<Text style={{ color: colors.lnborderColor, fontWeight: 'bold', fontSize: 18 }}>{props.text || '?'}</Text>
<Text style={{ color: colors.alternativeTextColor, fontSize: 13, fontWeight: '500' }}>{props.subtext || '?'}</Text>
</View>
</View>
</View>

4
package-lock.json generated
View File

@ -20903,8 +20903,8 @@
}
},
"rn-ldk": {
"version": "git+https://github.com/BlueWallet/rn-ldk.git#2110c5bc36b4a6ffbc60c695abe058404e6bf44b",
"from": "git+https://github.com/BlueWallet/rn-ldk.git#2110c5bc36b4a6ffbc60c695abe058404e6bf44b"
"version": "git+https://github.com/BlueWallet/rn-ldk.git#v0.2.14",
"from": "git+https://github.com/BlueWallet/rn-ldk.git#v0.2.14"
},
"rn-nodeify": {
"version": "10.3.0",

View File

@ -190,7 +190,7 @@
"react-test-render": "1.1.2",
"readable-stream": "3.6.0",
"realm": "10.8.0",
"rn-ldk": "git+https://github.com/BlueWallet/rn-ldk.git#2110c5bc36b4a6ffbc60c695abe058404e6bf44b",
"rn-ldk": "git+https://github.com/BlueWallet/rn-ldk.git#v0.2.14",
"rn-nodeify": "10.3.0",
"scryptsy": "2.1.0",
"secure-random": "1.1.2",

View File

@ -288,7 +288,13 @@ const WalletsAdd = () => {
style={styles.button}
/>
{backdoorPressed > 10 ? (
<LdkButton active={selectedWalletType === ButtonSelected.LDK} onPress={handleOnLdkButtonPressed} style={styles.button} />
<LdkButton
active={selectedWalletType === ButtonSelected.LDK}
onPress={handleOnLdkButtonPressed}
style={styles.button}
subtext={LightningLdkWallet.getPackageVersion()}
text="LDK"
/>
) : null}
<VaultButton active={selectedWalletType === ButtonSelected.VAULT} onPress={handleOnVaultButtonPressed} style={styles.button} />
</View>

View File

@ -7,6 +7,7 @@ import navigationStyle from '../../components/navigationStyle';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import loc from '../../loc';
import { Icon } from 'react-native-elements';
import { LightningLdkWallet } from '../../class';
const fs = require('../../blue_modules/fs');
const LdkViewLogs = () => {
@ -85,7 +86,7 @@ const LdkViewLogs = () => {
setGetInfo(info);
const peers = await wallet.listPeers();
const listChannels = await wallet.listChannels();
const version = await wallet.getVersion();
const version = await LightningLdkWallet.getVersion();
let nfo = 'num peers: ' + peers.length;
nfo += '\nnum channels: ' + listChannels.length;

View File

@ -264,8 +264,8 @@ const WalletTransactions = () => {
wallet.chain !== Chain.OFFCHAIN &&
wallet.type !== LightningLdkWallet.type &&
renderSellFiat()}
{wallet.chain === Chain.OFFCHAIN && wallet.type !== LightningLdkWallet.type && renderMarketplaceButton()}
{wallet.chain === Chain.OFFCHAIN && wallet.type !== LightningLdkWallet.type && Platform.OS === 'ios' && renderLappBrowserButton()}
{wallet.chain === Chain.OFFCHAIN && renderMarketplaceButton()}
{wallet.chain === Chain.OFFCHAIN && Platform.OS === 'ios' && renderLappBrowserButton()}
</View>
{wallet.type === LightningLdkWallet.type && (lnNodeInfo.canSend > 0 || lnNodeInfo.canReceive > 0) && (
<View style={[styles.marginHorizontal18, styles.marginBottom18]}>