aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/samples.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-08-30 18:52:00 -0700
committerAdam Soltys <[email protected]>2024-08-30 18:52:00 -0700
commit8346eb9e052d10abf4fb65b66838aaab47152e2a (patch)
tree0f5efabd144b720598441d9a638fd27d849628ff /src/lib/samples.ts
parentcb2edf24e48a49417ed6ec4a386e566470ff046c (diff)
downloadcoinos-ui-8346eb9e052d10abf4fb65b66838aaab47152e2a.tar.gz
coinos-ui-8346eb9e052d10abf4fb65b66838aaab47152e2a.zip
typescript
Diffstat (limited to 'src/lib/samples.ts')
-rw-r--r--src/lib/samples.ts89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/lib/samples.ts b/src/lib/samples.ts
new file mode 100644
index 00000000..17e4f4c8
--- /dev/null
+++ b/src/lib/samples.ts
@@ -0,0 +1,89 @@
+import { PUBLIC_DOMAIN, PUBLIC_COINOS_URL } from "$env/static/public";
+
+let api = PUBLIC_DOMAIN.includes("localhost")
+ ? `${PUBLIC_COINOS_URL}`
+ : `https://${PUBLIC_DOMAIN}/api`;
+
+export default {
+ register: `curl "${api}/register" -H "content-type: application/json" -d '{
+ "user": {
+ "username": "demo",
+ "password": "hunter2"
+ }
+}'`,
+ login: `curl "${api}/login" -H "content-type: application/json" -d '{
+ "username": "demo",
+ "password": "hunter2"
+}'`,
+ payments: `curl "${api}/payments"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+`,
+ lightning: `curl "${api}/payments"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "payreq": "lnbc1pj94d8fsp5n77k340ps4m9jn7kp8he8yynpddvurv6mcsrrqpnq5l2jxdxzlwqpp5m96pqhc5nrlk8cqsu9ufdxxa43sarp8vwf9egvm2pg9nl0zu9r8qdq2vdhkjmn0wvxqztgcqpjrzjqwhmav82kntsppmkp8jp4vg4h9nns78tsy8mg7ve4lq5txrkp0h56zlarvqqdtcqqsqqqqqqqqqqp6cq9q9qyysgqzxlypywzphyujm3ga5j5csfcmqvlnae0fgnvymkaaw94eeg7py5rqzysyjkr3ev2snq63qpsc69vf54adkd0szvmvwt5cuadjnuy95sq4xfa40"
+}'`,
+ bitcoin: `curl "${api}/bitcoin/send"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "amount": 5000,
+ "address": "bc1q3unh97w4rmelflrm2hvdwz37d8kray3vn4d5ca"
+}'`,
+ internal: `curl "${api}/send"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "amount": 5000,
+ "username": "alice"
+}'`,
+ rates: `curl "${api}/rates"
+ -H "content-type: application/json"
+}'`,
+ lightningInvoice: `curl "${api}/invoice"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "invoice": {
+ "amount": 1000,
+ "type": "lightning"
+ }
+}'`,
+ bitcoinAddress: `curl "${api}/invoice"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "invoice": {
+ "amount": 3141,
+ "type": "bitcoin"
+ }
+}'`,
+ webhook: `curl "${api}/invoice"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "invoice": {
+ "type": "lightning",
+ "webhook": "https://example.com/payment/received",
+ "secret": "webhooksecret"
+ }
+}'`,
+ fetchInvoice: `curl "${api}/invoice/bc1qmhfk9stzffhd9umzmld92vff7zg3mdlh7rvvaj"
+ -H "content-type: application/json"'`,
+ invoiceResponse: `{
+ "amount":3141
+ "tip":0
+ "type":"bitcoin"
+ "prompt":false
+ "rate":31836.9702667
+ "hash":"bc1qmhfk9stzffhd9umzmld92vff7zg3mdlh7rvvaj"
+ "text":"bitcoin:bc1qmhfk9stzffhd9umzmld92vff7zg3mdlh7rvvaj?amount=0.00003141"
+ "currency":"CAD"
+ "uid":"a9770421-3f65-11ed-9f57-0242ac2a0004"
+ "received":0
+ "created":1677537428134
+}`,
+ socketAuth: `echo '{"type":"login","data":{"username":"user","password":"password"}}' | websocat -n https://coinos.io/ws`,
+};