Skip to content

Commit

Permalink
chore: recv
Browse files Browse the repository at this point in the history
  • Loading branch information
sandipndev committed Mar 13, 2024
1 parent e825285 commit 4e0909b
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tilt-down:
cd dev && tilt down

emulator:
emulator -avd Pixel_API_34 -gpu swiftshader
emulator -avd Pixel_API_34 -gpu swiftshader -wipe-data -no-boot-anim

reset-e2e:
tilt trigger dev-setup
Expand Down
13 changes: 11 additions & 2 deletions dev/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,23 @@ dc_resource('otel-agent', labels = ["otel"])
dc_resource('quickstart-test', labels = ['quickstart'], auto_init=False)

local_resource(
name='dev-setup',
name='dev-ln-setup',
labels = ['dev-setup'],
cmd='bin/dev-setup.sh',
cmd='bin/dev-ln-setup.sh',
resource_deps = galoy_services + [
"init-lightning"
]
)

local_resource(
name='dev-setup',
labels = ['dev-setup'],
cmd='bin/dev-setup.sh',
resource_deps = [
"dev-ln-setup"
]
)

local_resource(
name='one-block-every-5s',
labels = ['dev-setup'],
Expand Down
39 changes: 39 additions & 0 deletions dev/bin/dev-ln-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

set -e

REPO_ROOT=$(git rev-parse --show-toplevel)

source ${REPO_ROOT}/dev/vendor/galoy-quickstart/bin/helpers.sh
source ${REPO_ROOT}/dev/vendor/galoy-quickstart/dev/helpers/cli.sh

function performTransactions {
address="$(lnd_cli newaddress p2wkh | jq -r '.address')"
bitcoin_cli sendtoaddress "$address" 0.1
bitcoin_cli -generate 3

address="$(lnd_outside_cli newaddress p2wkh | jq -r '.address')"
bitcoin_cli sendtoaddress "$address" 0.1
bitcoin_cli -generate 3

btc_amount=100000
invoice_response="$(lnd_cli addinvoice --amt $btc_amount)"
payment_request="$(echo $invoice_response | jq -r '.payment_request')"
lnd_outside_cli payinvoice -f --pay_req "$payment_request"
local result1=$?

btc_amount=20000
invoice_response="$(lnd_outside_cli addinvoice --amt $btc_amount)"
payment_request="$(echo $invoice_response | jq -r '.payment_request')"
lnd_cli payinvoice -f --pay_req "$payment_request"
local result2=$?

return $(($result1 + $result2))
}

until performTransactions; do
echo "One or more transactions failed. Retrying in 5 seconds..."
sleep 5
done

echo "lnd <--> lnd-outside channel created with funds"
10 changes: 2 additions & 8 deletions dev/bin/dev-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ echo "alice funded & set up"
login_user "bob" "$BOB_PHONE" "000000"
echo "bob logged in"
BOB_TOKEN=$(read_value "bob")
receive_onchain "bob"
receive_onchain "bob" "btc"
receive_onchain "bob" "usd"
exec_graphql 'bob' 'user-update-username' "{\"input\": {\"username\": \"$BOB_USERNAME\"}}"
echo "bob funded & set up"

Expand All @@ -38,10 +39,3 @@ BOB_PHONE="$BOB_PHONE"
BOB_TOKEN="$BOB_TOKEN"
BOB_USERNAME="bob_$BOB_SUFFIX"
EOF

btc_amount=100000
invoice_response="$(lnd_cli addinvoice --amt $btc_amount)"
payment_request="$(echo $invoice_response | jq -r '.payment_request')"
lnd_outside_cli payinvoice -f --pay_req "$payment_request"

echo "lnd channel created with local funds"
10 changes: 5 additions & 5 deletions e2e/detox/03-payment-send.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ beforeAll(async () => {
await setLocalAndLoginWithAccessToken(ALICE_TOKEN, LL)
})

describe("Intraledger using Username - BTC Amount", () => {
describe("Send: Intraledger using Username - BTC Amount", () => {
it("send btc to bob using his username", async () => {
await tap(by.id(LL.HomeScreen.send()))

Expand Down Expand Up @@ -65,7 +65,7 @@ describe("Intraledger using Username - BTC Amount", () => {
})
})

describe("Intraledger using Username - USD Amount", () => {
describe("Send: Intraledger using Username - USD Amount", () => {
it("send btc to bob using his username", async () => {
await tap(by.id(LL.HomeScreen.send()))

Expand Down Expand Up @@ -113,7 +113,7 @@ describe("Intraledger using Username - USD Amount", () => {
})
})

describe("Intraledger using LN Invoice", () => {
describe("Send: Intraledger using LN Invoice", () => {
it("send btc to bob using his ln invoice", async () => {
await tap(by.id(LL.HomeScreen.send()))

Expand Down Expand Up @@ -154,7 +154,7 @@ describe("Intraledger using LN Invoice", () => {
})
})

describe("Send to External LN Invoice", () => {
describe("Send: to External LN Invoice", () => {
it("send btc to an external invoice taken from lnd-outside-1", async () => {
await tap(by.id(LL.HomeScreen.send()))

Expand Down Expand Up @@ -190,7 +190,7 @@ describe("Send to External LN Invoice", () => {
})
})

describe("Send to Onchain Address", () => {
describe("Send: to Onchain Address", () => {
it("send btc to an onchain address from bitcoind", async () => {
await tap(by.id(LL.HomeScreen.send()))

Expand Down
32 changes: 32 additions & 0 deletions e2e/detox/04-payment-receive.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import "detox"

import { i18nObject } from "../../app/i18n/i18n-util"
import { loadLocale } from "../../app/i18n/i18n-util.sync"
import {
getExternalLNNoAmountInvoice,

Check failure on line 6 in e2e/detox/04-payment-receive.test.ts

View workflow job for this annotation

GitHub Actions / Check Code

'getExternalLNNoAmountInvoice' is defined but never used. Allowed unused vars must match /^_/u
getLnInvoiceForBob,

Check failure on line 7 in e2e/detox/04-payment-receive.test.ts

View workflow job for this annotation

GitHub Actions / Check Code

'getLnInvoiceForBob' is defined but never used. Allowed unused vars must match /^_/u
getOnchainAddress,

Check failure on line 8 in e2e/detox/04-payment-receive.test.ts

View workflow job for this annotation

GitHub Actions / Check Code

'getOnchainAddress' is defined but never used. Allowed unused vars must match /^_/u
} from "./utils/commandline"
import { setLocalAndLoginWithAccessToken, waitForHomeScreen } from "./utils/common-flows"

Check failure on line 10 in e2e/detox/04-payment-receive.test.ts

View workflow job for this annotation

GitHub Actions / Check Code

'waitForHomeScreen' is defined but never used. Allowed unused vars must match /^_/u
import { timeout, BOB_USERNAME, ALICE_TOKEN } from "./utils/config"

Check failure on line 11 in e2e/detox/04-payment-receive.test.ts

View workflow job for this annotation

GitHub Actions / Check Code

'timeout' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 11 in e2e/detox/04-payment-receive.test.ts

View workflow job for this annotation

GitHub Actions / Check Code

'BOB_USERNAME' is defined but never used. Allowed unused vars must match /^_/u
import { addAmount, tap, verifyTextPresent, sleep, slideSlider } from "./utils/controls"

Check failure on line 12 in e2e/detox/04-payment-receive.test.ts

View workflow job for this annotation

GitHub Actions / Check Code

'addAmount' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 12 in e2e/detox/04-payment-receive.test.ts

View workflow job for this annotation

GitHub Actions / Check Code

'tap' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 12 in e2e/detox/04-payment-receive.test.ts

View workflow job for this annotation

GitHub Actions / Check Code

'verifyTextPresent' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 12 in e2e/detox/04-payment-receive.test.ts

View workflow job for this annotation

GitHub Actions / Check Code

'sleep' is defined but never used. Allowed unused vars must match /^_/u

loadLocale("en")
const LL = i18nObject("en")

// Make sure all tests in this file reset back to home screen because tests reuse same session in this file
beforeAll(async () => {
await device.launchApp({ newInstance: true })
await setLocalAndLoginWithAccessToken(ALICE_TOKEN, LL)
})

// Only for the LN tests do we send funds from bob's account for alice to receive
describe("Receive: LN BTC Amountless", () => {})
describe("Receive: LN BTC $0.02 Amount", () => {})
describe("Receive: LN Stablesats Amountless", () => {})
describe("Receive: LN Stablesats $0.02 Amount", () => {})

describe("Receive: Onchain BTC", () => {})
describe("Receive: Onchain Stablesats", () => {})

describe("Receive: Paycode", () => {})

0 comments on commit 4e0909b

Please sign in to comment.