mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +01:00
Merge branch 'master' into devicel
This commit is contained in:
commit
5c07a9ae41
8 changed files with 40 additions and 30 deletions
|
@ -14,6 +14,8 @@ import TcpSocket from 'react-native-tcp-socket';
|
|||
*/
|
||||
function Socket() {
|
||||
this._socket = false; // reference to socket thats gona be created later
|
||||
// defaults:
|
||||
this._noDelay = true;
|
||||
|
||||
this._listeners = {};
|
||||
|
||||
|
@ -21,7 +23,12 @@ function Socket() {
|
|||
this.setTimeout = () => {};
|
||||
this.setEncoding = () => {};
|
||||
this.setKeepAlive = () => {};
|
||||
this.setNoDelay = () => {};
|
||||
|
||||
// proxying call to real socket object:
|
||||
this.setNoDelay = noDelay => {
|
||||
if (this._socket) this._socket.setNoDelay(noDelay);
|
||||
this._noDelay = noDelay;
|
||||
};
|
||||
|
||||
this.connect = (port, host, callback) => {
|
||||
this._socket = TcpSocket.createConnection(
|
||||
|
@ -36,15 +43,6 @@ function Socket() {
|
|||
this._socket.on('data', data => {
|
||||
this._passOnEvent('data', data);
|
||||
});
|
||||
this._socket.on('end', data => {
|
||||
this._passOnEvent('end', data);
|
||||
});
|
||||
this._socket.on('timeout', () => {
|
||||
this._passOnEvent('timeout');
|
||||
});
|
||||
this._socket.on('onerror', data => {
|
||||
this._passOnEvent('onerror', data);
|
||||
});
|
||||
this._socket.on('error', data => {
|
||||
this._passOnEvent('error', data);
|
||||
});
|
||||
|
@ -53,9 +51,7 @@ function Socket() {
|
|||
});
|
||||
this._socket.on('connect', data => {
|
||||
this._passOnEvent('connect', data);
|
||||
});
|
||||
this._socket.on('secureConnect', data => {
|
||||
this._passOnEvent('secureConnect', data);
|
||||
this._socket.setNoDelay(this._noDelay);
|
||||
});
|
||||
this._socket.on('connection', data => {
|
||||
this._passOnEvent('connection', data);
|
||||
|
|
|
@ -22,10 +22,23 @@ function connect(config, callback) {
|
|||
callback,
|
||||
);
|
||||
|
||||
// defaults:
|
||||
this._noDelay = true;
|
||||
|
||||
// functions not supported by RN module, yet:
|
||||
client.setTimeout = () => {};
|
||||
client.setEncoding = () => {};
|
||||
client.setKeepAlive = () => {};
|
||||
client.setNoDelay = () => {};
|
||||
|
||||
// we will save `noDelay` and proxy it to socket object when its actually created and connected:
|
||||
const realSetNoDelay = client.setNoDelay; // reference to real setter
|
||||
client.setNoDelay = noDelay => {
|
||||
this._noDelay = noDelay;
|
||||
};
|
||||
|
||||
client.on('connect', () => {
|
||||
realSetNoDelay.apply(client, [this._noDelay]);
|
||||
});
|
||||
|
||||
return client;
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ PODS:
|
|||
- React
|
||||
- react-native-slider (2.0.8):
|
||||
- React
|
||||
- react-native-tcp-socket (3.6.0):
|
||||
- react-native-tcp-socket (3.7.1):
|
||||
- CocoaAsyncSocket
|
||||
- React
|
||||
- react-native-webview (6.11.1):
|
||||
|
@ -533,7 +533,7 @@ SPEC CHECKSUMS:
|
|||
react-native-randombytes: 991545e6eaaf700b4ee384c291ef3d572e0b2ca8
|
||||
react-native-safe-area-context: 0b0460e3298465bdb4b859ea43c2d7b9128cf988
|
||||
react-native-slider: b2f361499888302147205f17f6fffa921a7bda70
|
||||
react-native-tcp-socket: b53ac2c9cbec9f3def9b867aa4a3ea51b104f8db
|
||||
react-native-tcp-socket: 96a4f104cdcc9c6621aafe92937f163d88447c5b
|
||||
react-native-webview: f11ac6c8bcaba5b71ddda1c12a10c8ea059b080f
|
||||
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
|
||||
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
|
||||
|
|
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -3912,11 +3912,10 @@
|
|||
"integrity": "sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow=="
|
||||
},
|
||||
"bitcoinjs-lib": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/bitcoinjs-lib/-/bitcoinjs-lib-5.1.6.tgz",
|
||||
"integrity": "sha512-NgvnA8XXUuzpuBnVs1plzZvVOYsuont4KPzaGcVIwjktYQbCk1hUkXnt4wujIOBscNsXuu+plVbPYvtMosZI/w==",
|
||||
"version": "5.1.8",
|
||||
"resolved": "https://registry.npmjs.org/bitcoinjs-lib/-/bitcoinjs-lib-5.1.8.tgz",
|
||||
"integrity": "sha512-LQQ9uw33sqW3K1aSzYCy0Az8zbcsR1ttaNkjThFwApT/vbB7bibEesPIxf0zvzjf8V8It68v7D/fCkjd4bStMw==",
|
||||
"requires": {
|
||||
"@types/node": "10.12.18",
|
||||
"bech32": "^1.1.2",
|
||||
"bip174": "^1.0.1",
|
||||
"bip32": "^2.0.4",
|
||||
|
@ -12093,9 +12092,9 @@
|
|||
}
|
||||
},
|
||||
"react-native-tcp-socket": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-tcp-socket/-/react-native-tcp-socket-3.6.0.tgz",
|
||||
"integrity": "sha512-lGnlklcHNCQSgdVhrF4fwslc6Xjk3nXLVqjqvJY1pSEJ9H8S4clZR4uwohfbM16VrHnUhBh4o/1wGRO/xrp7nQ==",
|
||||
"version": "3.7.1",
|
||||
"resolved": "https://registry.npmjs.org/react-native-tcp-socket/-/react-native-tcp-socket-3.7.1.tgz",
|
||||
"integrity": "sha512-ToyFSYuJp0/DQ7bXd/vTwF5m3yhNSRngIpVlBFBDccDZQmp2qIo0exrObCNlJLOOHb38dil726hM+GKjR1/60w==",
|
||||
"requires": {
|
||||
"buffer": "^5.4.3"
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
"bip21": "2.0.2",
|
||||
"bip32": "2.0.5",
|
||||
"bip39": "2.6.0",
|
||||
"bitcoinjs-lib": "5.1.6",
|
||||
"bitcoinjs-lib": "5.1.8",
|
||||
"bolt11": "1.2.7",
|
||||
"buffer": "5.6.0",
|
||||
"buffer-reverse": "1.0.1",
|
||||
|
@ -134,7 +134,7 @@
|
|||
"react-native-snap-carousel": "3.9.1",
|
||||
"react-native-sortable-list": "0.0.24",
|
||||
"react-native-svg": "9.13.6",
|
||||
"react-native-tcp-socket": "3.6.0",
|
||||
"react-native-tcp-socket": "3.7.1",
|
||||
"react-native-tooltip": "git+https://github.com/marcosrdz/react-native-tooltip.git",
|
||||
"react-native-vector-icons": "6.6.0",
|
||||
"react-native-watch-connectivity": "0.4.2",
|
||||
|
|
|
@ -32,9 +32,6 @@ const styles = StyleSheet.create({
|
|||
paddingRight: 16,
|
||||
borderRadius: 20,
|
||||
},
|
||||
connectText: {
|
||||
fontWeight: '600',
|
||||
},
|
||||
containerConnected: {
|
||||
backgroundColor: '#D2F8D6',
|
||||
},
|
||||
|
@ -43,9 +40,11 @@ const styles = StyleSheet.create({
|
|||
},
|
||||
textConnected: {
|
||||
color: '#37C0A1',
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
textDisconnected: {
|
||||
color: '#D0021B',
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
hostname: {
|
||||
textAlign: 'center',
|
||||
|
@ -161,7 +160,7 @@ export default class ElectrumSettings extends Component {
|
|||
<BlueText style={styles.status}>Status</BlueText>
|
||||
<View style={styles.connectWrap}>
|
||||
<View style={[styles.container, this.state.config.status === 1 ? styles.containerConnected : styles.containerDisconnected]}>
|
||||
<BlueText style={[styles.connectText, this.state.config.status === 1 ? styles.textConnected : styles.textDisconnected]}>
|
||||
<BlueText style={this.state.config.status === 1 ? styles.textConnected : styles.textDisconnected}>
|
||||
{(this.state.config.status === 1 && 'Connected') || 'Not Connected'}
|
||||
</BlueText>
|
||||
</View>
|
||||
|
|
|
@ -200,6 +200,7 @@ export default class WalletsList extends Component {
|
|||
await BlueApp.fetchWalletTransactions();
|
||||
const end = +new Date();
|
||||
console.log('fetch all wallet txs took', (end - start) / 1000, 'sec');
|
||||
await BlueApp.saveToDisk();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
|
|
@ -85,7 +85,9 @@ describe('LegacyWallet', function () {
|
|||
|
||||
it.each([
|
||||
['addresses for vout missing', '1PVfrmbn1vSMoFZB2Ga7nDuXLFDyJZHrHK'],
|
||||
['txdatas were coming back null from BlueElectrum because of high batchsize', '34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo'],
|
||||
// ['txdatas were coming back null from BlueElectrum because of high batchsize', '34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo'],
|
||||
// skipped because its slow and flaky if being run in pack with other electrum tests. uncomment and run single
|
||||
// if you need to debug huge electrum batches
|
||||
])(
|
||||
'can fetch TXs when %s',
|
||||
async (useCase, address) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue