Skip to content

Commit

Permalink
fix: sync with master
Browse files Browse the repository at this point in the history
  • Loading branch information
limpbrains committed Nov 7, 2023
2 parents fda8c7c + 47f0b1e commit a5dbe05
Showing 442 changed files with 18,694 additions and 7,718 deletions.
10 changes: 10 additions & 0 deletions .env.development.template
Original file line number Diff line number Diff line change
@@ -23,10 +23,15 @@ ENABLE_LDK_LOGS=true
BACKUPS_SHARED_SECRET=6dabb95493023d5c45229331490a9a67fcde2a618798f9dea5c1247eabb13451
BACKUPS_SERVER_SLASHTAG=slash:3phbmj4jkzs7b6e6t1h8jwy1u6o9w9y39nscsc6r1q89t1mxcsuy

# LDK backups
BACKUPS_SERVER_HOST=https://blocktank.synonym.to/staging-backups-ldk
BACKUPS_SERVER_PUBKEY=02c03b8b8c1b5500b622646867d99bf91676fac0f38e2182c91a9ff0d053a21d6d

# Slashtags
DISABLE_SLASHTAGS=false
SLASHTAGS_SEEDER_BASE_URL=https://blocktank.synonym.to
SLASHTAGS_SEEDER_TOPIC=3b9f8ccd062ca9fc0b7dd407b4cd287ca6e2d8b32f046d7958fa7bea4d78fd75
WEB_RELAY=https://webrelay.slashtags.to

# Blocktank
BLOCKTANK_HOST=https://api.stag.blocktank.to
@@ -47,6 +52,11 @@ ELECTRUM_SIGNET_SSL_PORT=18484
ELECTRUM_SIGNET_TCP_PORT=18483
ELECTRUM_SIGNET_PROTO=tcp

TREASURE_HUNT_HOST=

# format: "<pubkey>, <pubkey>, ..."
TRUSTED_ZERO_CONF_PEERS="0296b2db342fcf87ea94d981757fdf4d3e545bd5cef4919f58b5d38dfdd73bf5c9,03b9a456fb45d5ac98c02040d39aec77fa3eeb41fd22cf40b862b393bcfc43473a"

WALLET_DEFAULT_SELECTED_NETWORK=bitcoin

E2E=false
10 changes: 10 additions & 0 deletions .env.test.template
Original file line number Diff line number Diff line change
@@ -23,10 +23,15 @@ ENABLE_LDK_LOGS=false
BACKUPS_SHARED_SECRET=6dabb95493023d5c45229331490a9a67fcde2a618798f9dea5c1247eabb13451
BACKUPS_SERVER_SLASHTAG=slash:3phbmj4jkzs7b6e6t1h8jwy1u6o9w9y39nscsc6r1q89t1mxcsuy

# LDK backups
BACKUPS_SERVER_HOST=https://blocktank.synonym.to/staging-backups-ldk
BACKUPS_SERVER_PUBKEY=02c03b8b8c1b5500b622646867d99bf91676fac0f38e2182c91a9ff0d053a21d6d

# Slashtags
DISABLE_SLASHTAGS=false
SLASHTAGS_SEEDER_BASE_URL=https://blocktank.synonym.to
SLASHTAGS_SEEDER_TOPIC=3b9f8ccd062ca9fc0b7dd407b4cd287ca6e2d8b32f046d7958fa7bea4d78fd75
WEB_RELAY=https://webrelay.slashtags.to

# Blocktank
BLOCKTANK_HOST=https://api.stag.blocktank.to
@@ -47,6 +52,11 @@ ELECTRUM_SIGNET_SSL_PORT=18484
ELECTRUM_SIGNET_TCP_PORT=18483
ELECTRUM_SIGNET_PROTO=tcp

TREASURE_HUNT_HOST=

# format: "<pubkey>, <pubkey>, ..."
TRUSTED_ZERO_CONF_PEERS="03b9a456fb45d5ac98c02040d39aec77fa3eeb41fd22cf40b862b393bcfc43473a"

WALLET_DEFAULT_SELECTED_NETWORK=bitcoinRegtest

E2E=true
5 changes: 3 additions & 2 deletions .github/workflows/e2e-ios.yml
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ on: pull_request
env:
NO_FLIPPER: 1
E2E_TESTS: 1 # build without transform-remove-console babel plugin
DEBUG: 'lnurl* lnurl server'

jobs:
e2e:
@@ -52,7 +53,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 18.17
cache: 'yarn' # cache packages, but not node_modules

- name: Activate enviroment variables
@@ -83,7 +84,7 @@ jobs:
run: pod install --project-directory=ios || pod install --project-directory=ios

- name: Build
run: yarn e2e:build:ios-release
run: yarn e2e:build:ios-release || yarn e2e:build:ios-release

- name: Test attempt 1
continue-on-error: true
4 changes: 2 additions & 2 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
@@ -27,11 +27,11 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 18.17
cache: 'yarn'

- name: Install Node.js dependencies
run: yarn install
run: yarn install || yarn install

- name: Activate enviroment variables
run: cp .env.development.template .env
2 changes: 1 addition & 1 deletion .github/workflows/lint-check.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 18.17
cache: 'yarn'

- name: Install Node.js dependencies
1 change: 0 additions & 1 deletion .github/workflows/react-native-skia-stub.patch
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ index 935e19e8..fa64a969 100644
@@ -178,7 +178,8 @@
"stream": "stream-browserify",
"vm": "vm-browserify",
"sodium-native": "react-native-libsodium",
- "net": "react-native-tcp-socket"
+ "net": "react-native-tcp-socket",
+ "@shopify/react-native-skia": "react-native-skia-stub"
2 changes: 1 addition & 1 deletion .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ jobs:
cache: 'yarn'

- name: Install Node.js dependencies
run: yarn install
run: yarn install || yarn install

- name: Type check
run: yarn tsc:check
1 change: 1 addition & 0 deletions __mocks__/@react-native-async-storage/async-storage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@react-native-async-storage/async-storage/jest/async-storage-mock';
33 changes: 18 additions & 15 deletions __tests__/backups.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import {
addTag,
addMetaTxTag,
resetMetaStore,
updateMetaIncTxTags,
updatePendingInvoice,
addMetaSlashTagsUrlTag,
} from '../src/store/actions/metadata';
import {
@@ -100,17 +100,19 @@ describe('Remote backups', () => {
if (fetchRes.isErr()) {
throw fetchRes.error;
}
const bytesToStringRes = bytesToString(fetchRes.value.content);
if (bytesToStringRes.isErr()) {
throw bytesToStringRes.error;
}
expect(bytesToStringRes.value).toEqual(message);
const jsonString = bytesToString(fetchRes.value.content);
expect(jsonString).toEqual(message);
});

it('Backups and restores metadata', async () => {
addMetaTxTag('txid1', 'tag');
addTag('tag');
updateMetaIncTxTags('address', 'invoice', ['futuretag']);
updatePendingInvoice({
id: 'id123',
tags: ['futuretag'],
address: 'address',
payReq: 'lightningInvoice',
});
addMetaSlashTagsUrlTag('txid2', 'slashtag');

const backup = getMetaDataStore();
@@ -182,15 +184,16 @@ describe('Remote backups', () => {
});

it('Backups and restores widgets', async () => {
setFeedWidget('url', {
name: 'name',
setFeedWidget({
url: 'url',
type: 'type',
icon: 'icon',
field: {
name: 'name',
main: 'main',
files: {},
},
fields: [
{
name: 'name',
main: 'main',
files: {},
},
],
});
updateWidgets({ onboardedWidgets: true });

34 changes: 28 additions & 6 deletions __tests__/scanner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { decodeQRData } from '../src/utils/scanner';
import { findlnurl } from '../src/utils/lnurl';
import { TBitcoinUrl, decodeQRData } from '../src/utils/scanner';

describe('QR codes', () => {
it('decodes a bitcoin URI with params', async () => {
@@ -8,7 +9,7 @@ describe('QR codes', () => {
if (res.isErr()) {
throw res.error;
}
const qrData = res.value[0];
const qrData = res.value[0] as TBitcoinUrl;
expect(qrData.network).toEqual('bitcoin');
expect(qrData.qrDataType).toEqual('bitcoinAddress');
expect(qrData.sats).toEqual(50000);
@@ -22,7 +23,7 @@ describe('QR codes', () => {
if (res.isErr()) {
throw res.error;
}
const qrData = res.value[0];
const qrData = res.value[0] as TBitcoinUrl;
expect(qrData.network).toEqual('bitcoin');
expect(qrData.qrDataType).toEqual('bitcoinAddress');
});
@@ -34,7 +35,7 @@ describe('QR codes', () => {
if (res.isErr()) {
throw res.error;
}
const qrData = res.value[0];
const qrData = res.value[0] as TBitcoinUrl;
expect(qrData.network).toEqual('bitcoin');
expect(qrData.qrDataType).toEqual('bitcoinAddress');
});
@@ -46,7 +47,7 @@ describe('QR codes', () => {
if (res.isErr()) {
throw res.error;
}
const qrData = res.value[0];
const qrData = res.value[0] as TBitcoinUrl;
expect(qrData.network).toEqual('bitcoin');
expect(qrData.qrDataType).toEqual('bitcoinAddress');
});
@@ -58,8 +59,29 @@ describe('QR codes', () => {
if (res.isErr()) {
throw res.error;
}
const qrData = res.value[0];
const qrData = res.value[0] as TBitcoinUrl;
expect(qrData.network).toEqual('bitcoin');
expect(qrData.qrDataType).toEqual('bitcoinAddress');
});

it('finds lnurl', async () => {
const base =
'lnurl1dp68gurn8ghj7mrww3uxymm59e3xjemnw4hzu7re0ghkcmn4wfkz7urp0ylh2um9wf5kg0fhxycnv9g9w58';
expect(findlnurl(base)).toEqual(base);
expect(findlnurl(base.toUpperCase())).toEqual(base);
expect(findlnurl('https://site.com/?lightning=' + base)).toEqual(base);
expect(
findlnurl('https://site.com/?lightning=' + base.toUpperCase()),
).toEqual(base);
expect(findlnurl('https://site.com/?nada=nada&lightning=' + base)).toEqual(
base,
);
expect(
findlnurl('https://site.com/?nada=nada&lightning=' + base.toUpperCase()),
).toEqual(base);
expect(findlnurl('bs')).toEqual(null);
expect(findlnurl('https://site.com')).toEqual(null);
expect(findlnurl('https://site.com/?bs=' + base)).toEqual(null);
expect(findlnurl('bitcoin:site.com/?lightning=' + base)).toEqual(base);
});
});
15 changes: 15 additions & 0 deletions __tests__/slashtags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { getNewProfileUrl } from '../src/utils/slashtags2';

describe('Slashtags', () => {
it('profile url convert function woks', () => {
expect(
getNewProfileUrl(
'slash:c7xk1b11o8k8jw6cn9a8asjcau77aenf7iq79tbc9u933wyoyjxy',
'https://dht-relay.synonym.to/staging/web-relay',
),
).toEqual(
'slash:c7xk1b11o8k8jw6cn9a8asjcau77aenf7iq79tbc9u933wyoyjxy?relay=https://dht-relay.synonym.to/staging/web-relay',
);
expect(() => getNewProfileUrl('xxx', 'yyy')).toThrow(Error);
});
});
Loading

0 comments on commit a5dbe05

Please sign in to comment.