-
Notifications
You must be signed in to change notification settings - Fork 2
/
example1.html
141 lines (123 loc) · 3.7 KB
/
example1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html>
<head>
<!-- This is a very basic example -->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body {
height: 100%;
margin: 0px;
padding: 30px
}
</style>
<title>lnpay-js</title>
<script src="../dist/lnpay.js"></script>
<script>
/**
* Initialize the SDK with our keys
*/
let publicApiKey = '';
let walletAccessKey = '';
LNPay.Initialize(publicApiKey);
/**
* Create a wallet
* @see https://docs.lnpay.co/wallet/create-wallet
*/
/*
LNPay.createWallet({"user_label":"My wallet"},function(result) {
console.log(result);
}
);
*/
/**
* Get wallet info / balance
* @see https://docs.lnpay.co/wallet/get-balance
*/
/*
let myWallet = new LNPayWallet(walletAccessKey);
myWallet.getInfo(function(result) {
console.log(result);
}
);
*/
/**
* Generate an invoice from wallet
* @see https://docs.lnpay.co/wallet/generate-invoice
*/
/*
let invoiceParams = {"num_satoshis":2,"memo":"Tester"};
let myWallet = new LNPayWallet(walletAccessKey);
myWallet.createInvoice(invoiceParams,function(result) {
console.log(result);
}
);
*/
/**
* Pay Invoice
* @see https://docs.lnpay.co/wallet/pay-invoice
*/
/*
let invoiceParams = {"payment_request":"lnbc111...."};
let myWallet = new LNPayWallet(walletAccessKey);
myWallet.payInvoice(invoiceParams,function(result) {
console.log(result);
}
);
*/
/**
* Transfer between LNPay wallets
* @see https://docs.lnpay.co/wallet/transfers-between-wallets
*/
/*
let transferParams = {"dest_wallet_id":"wa_xxxxx","num_satoshis":22,"memo":"Transfer Memo"};
let myWallet = new LNPayWallet(walletAccessKey);
myWallet.internalTransfer(transferParams,function(result) {
console.log(result);
}
);
*/
/**
* Get wallet transactions (these are only settled transactions)
* @see https://docs.lnpay.co/wallet/get-transactions
*/
/*
let queryParams = {}; //pagination, searching eventually
let myWallet = new LNPayWallet(walletAccessKey);
myWallet.getTransactions(queryParams,function(result) {
console.log(result);
}
);
*/
/**
* Get an LNURL withdraw link
* @see https://docs.lnpay.co/wallet/lnurl-withdraw
*/
/*
let lnurlParams = {"num_satoshis":12,"memo":"SatsBack!"};
let myWallet = new LNPayWallet(walletAccessKey);
myWallet.getLnurl(lnurlParams,function(result) {
console.log(result);
}
);
*/
/**
* Check if LN Invoice is settled or not
* @see https://docs.lnpay.co/lntx/get-invoice-status
*/
/*
let lntx_id = "lntx_Mxxxxx";
let lntx = new LNPayLnTx(lntx_id);
lntx.getInfo(function(result) {
console.log(result);
}
);
*/
</script>
</head>
<body>
<h1>Hello World</h1>
<p>Uncomment some of the JS and look in the console.</p>
<p>Find out more at <a href="https://github.com/lnpay/lnpay-js">github.com/lnpay/lnpay-js</a></p>
</body>
</html>