Skip to content

Commit

Permalink
chore: remove the uid page view
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Burtey committed Sep 23, 2023
1 parent 3cefee9 commit 157a80f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 25 deletions.
File renamed without changes.
16 changes: 0 additions & 16 deletions apps/boltcard/app/api/card/uid/[uid]/route.ts

This file was deleted.

2 changes: 2 additions & 0 deletions apps/boltcard/app/api/program/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface ActivateCardResponse {
protocol_name: string
protocol_version: number
card_name: string
cardId: string
lnurlw_base: string
k0: string
k1: string
Expand Down Expand Up @@ -54,6 +55,7 @@ export async function GET(req: NextRequest) {
protocol_name: "create_bolt_card_response",
protocol_version: 2,
card_name: cardKeysSetup.cardId,
cardId: cardKeysSetup.cardId,
lnurlw_base: lnurlwBase,
k0: cardKeysSetup.k0AuthKey,
k1: k1DecryptKey,
Expand Down
6 changes: 3 additions & 3 deletions apps/boltcard/app/card/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { isAdmin, serverUrl } from "@/services/config"
export default async function Card({ params }: { params: { id: string } }) {
const { id } = params

const cardApi = `${serverUrl}/api/card/id/${id}`
const cardApi = `${serverUrl}/api/card/${id}`
const cardResult = await fetch(cardApi, { cache: "no-store" })
const cardInfo = await cardResult.json()

const transactionsApi = `${serverUrl}/api/card/id/${id}/transactions`
const transactionsApi = `${serverUrl}/api/card/${id}/transactions`
const transactionsResult = await fetch(transactionsApi, { cache: "no-store" })
const transactionsInfo = await transactionsResult.json()

Expand All @@ -26,7 +26,7 @@ export default async function Card({ params }: { params: { id: string } }) {
lnurlQrCode = await QRCode.toDataURL(cardInfo.lnurlp, { width: 300 })
}

const invoiceApi = `${serverUrl}/api/card/id/${id}/invoice`
const invoiceApi = `${serverUrl}/api/card/${id}/invoice`
const invoiceResult = await fetch(invoiceApi, { cache: "no-store" })
const invoiceInfo = await invoiceResult.json()
const invoice = invoiceInfo?.data
Expand Down
11 changes: 5 additions & 6 deletions apps/boltcard/bats/e2e-test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ random_phone() {

K1_VALUE=$(echo $RESPONSE | jq -r '.k1')
K2_VALUE=$(echo $RESPONSE | jq -r '.k2')
cardId=$(echo $RESPONSE | jq -r '.cardId')

cache_value "k1" "$K1_VALUE"
cache_value "k2" "$K2_VALUE"
cache_value "cardId" "$cardId"
}

@test "payment: first ln call" {
Expand All @@ -57,16 +59,13 @@ random_phone() {

echo "K1_CALLBACK: $K1_CALLBACK"
cache_value "k1_callback" "$K1_CALLBACK"
cache_value "uid" "$uid"
}

# todo: a second ln call; the paths are different

@test "onchain funding" {
uid=$(read_value "uid")
address=$(curl -s http://localhost:3000/api/card/uid/${uid} | jq -r '.onchainAddress')
cardId=$(curl -s http://localhost:3000/api/card/uid/${uid} | jq -r '.id')
cache_value "cardId" "$cardId"
cardId=$(read_value "cardId")
address=$(curl -s http://localhost:3000/api/card/${cardId} | jq -r '.onchainAddress')

amount="0.001"
token_name=$(read_value "alice")
Expand Down Expand Up @@ -108,7 +107,7 @@ random_phone() {
@test "transactions" {
cardId=$(read_value "cardId")

response=$(curl -s http://localhost:3000/api/card/id/$cardId/transactions)
response=$(curl -s http://localhost:3000/api/card/$cardId/transactions)

echo "$response"
count=$(echo "$response" | jq 'length')
Expand Down

0 comments on commit 157a80f

Please sign in to comment.