aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/samples.js59
-rw-r--r--src/lib/utils.js6
2 files changed, 54 insertions, 11 deletions
diff --git a/src/lib/samples.js b/src/lib/samples.js
index 14d9e4e0..0b447d06 100644
--- a/src/lib/samples.js
+++ b/src/lib/samples.js
@@ -1,32 +1,69 @@
export default {
- register: `curl "https://coinos.io/api/register" -H "application/json" -d '{
- "username": "adam",
+ register: `curl "https://coinos.io/api/register" -H "content-type: application/json" -d '{
+ "username": "demo",
"password": "hunter2"
}'`,
- login: `curl "https://coinos.io/api/login" -H "application/json" -d '{
- "username": "adam",
+ login: `curl "https://coinos.io/api/login" -H "content-type: application/json" -d '{
+ "username": "demo",
"password": "hunter2"
}'`,
payments: `curl "https://coinos.io/api/payments"
- -H "application/json"
+ -H "content-type: application/json"
-H "Authorization: Bearer $token"
+`,
+ lightning: `curl "https://coinos.io/api/payments"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "payreq": "lnbc1pj94d8fsp5n77k340ps4m9jn7kp8he8yynpddvurv6mcsrrqpnq5l2jxdxzlwqpp5m96pqhc5nrlk8cqsu9ufdxxa43sarp8vwf9egvm2pg9nl0zu9r8qdq2vdhkjmn0wvxqztgcqpjrzjqwhmav82kntsppmkp8jp4vg4h9nns78tsy8mg7ve4lq5txrkp0h56zlarvqqdtcqqsqqqqqqqqqqp6cq9q9qyysgqzxlypywzphyujm3ga5j5csfcmqvlnae0fgnvymkaaw94eeg7py5rqzysyjkr3ev2snq63qpsc69vf54adkd0szvmvwt5cuadjnuy95sq4xfa40"
+}'`,
+ bitcoin: `curl "https://coinos.io/api/payments"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "amount": 5000,
+ "hash": "bc1q3unh97w4rmelflrm2hvdwz37d8kray3vn4d5ca"
+}'`,
+ internal: `curl "https://coinos.io/api/payments"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "amount": 5000,
+ "username": "alice"
}'`,
rates: `curl "https://coinos.io/api/rates"
- -H "application/json"
+ -H "content-type: application/json"
}'`,
- invoice: `curl "https://coinos.io/api/invoice"
- -H "application/json"
+ lightningInvoice: `curl "https://coinos.io/api/invoice"
+ -H "content-type: application/json"
-H "Authorization: Bearer $token"
-d '{
"invoice": {
"amount": 1000,
+ "type": "lightning"
+ }
+}'`,
+ bitcoinAddress: `curl "https://coinos.io/api/invoice"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "invoice": {
+ "amount": 3141,
+ "type": "bitcoin"
+ }
+}'`,
+ webhook: `curl "https://coinos.io/api/invoice"
+ -H "content-type: application/json"
+ -H "Authorization: Bearer $token"
+ -d '{
+ "invoice": {
"type": "lightning",
"webhook": "https://example.com/payment/received",
- "secret": "hunter2"
- },
+ "secret": "webhooksecret"
+ }
}'`,
fetchInvoice: `curl "https://coinos.io/api/invoice/bc1qmhfk9stzffhd9umzmld92vff7zg3mdlh7rvvaj"
- -H "application/json"'`,
+ -H "content-type: application/json"'`,
invoiceResponse: `{
"amount":3141
"tip":0
diff --git a/src/lib/utils.js b/src/lib/utils.js
index 69606d36..70ea5d3b 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -74,6 +74,12 @@ export let copy = (text) => {
success('Copied!');
};
+export let copyNoNewlines = (text) => {
+ let stripped = text.replace(/\n/g, ' ').replace(/\s+/g, ' ');
+ navigator.clipboard.writeText(stripped);
+ success('Copied!');
+};
+
export function reverseFormat(val, locale) {
let parts = new Intl.NumberFormat(locale).formatToParts(1111.1);
let group = parts.find((part) => part.type === 'group').value;