You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 13, 2024. It is now read-only.
The library comes with some ready-to-use Badger components, `BadgerBadge` and `BadgerButton`, with more coming soon. These components are can be added quickly to any React projects. If you require a different solution then continue reading to learn how to create custom Badger integrations using `BadgerBase`.
These props are required or supported by all components which build upon `BadgerBase`.
33
55
56
+
<spacer></spacer>
57
+
34
58
-`to: BCH Address` - Required - Bitcoin Cash address to send BCH to
35
-
-`price: number` - Optional - Price in chosen fiat currency, will be turned into the satoshis equivalent
36
-
-`amount: number` - Optional - Price in chosen ticker, currently only BCH
59
+
-`stepControlled` - Optional [`fresh`, `pending`, `complete`] - Control the payment step manually. Useful for payment systems where the transaction is validated by a payment server.
37
60
<spacer></spacer>
38
61
-`currency: string` - Default `USD` - [ISO Country Code](https://en.wikipedia.org/wiki/ISO_4217) to charge in
39
-
-`ticker: string` - Default `BCH` - Ticker to send, currently only BCH
62
+
-`price: number` - Optional - Price in chosen fiat currency, will be turned into the satoshis equivalent
63
+
<spacer></spacer>
64
+
-`coinType: string` - `BCH` or `SLP` - Default `BCH`
65
+
-`tokenId: string` - tokenId of the SLP token to be used, required when coinType is SLP
66
+
-`amount: number` - Optional - Amount of BCH or SLP token
40
67
<spacer></spacer>
41
68
-`opReturn: string[]` - Optional - OP_RETURN message when paid with Badger
69
+
-`showQR: boolean` - Optional - Show QR code if payment does not use OP_RETURN or SLP tokens
70
+
-`watchAddress` - Optional - Go to confirmed if address receives any payment, best if used with unique payment codes
71
+
<spacer></spacer>
42
72
-`isRepeatable` - Optional - Payment can be done multiple times in a single visit
43
73
-`repeatTimeout` - Optional - How many milliseconds until button reverts to a fresh state
44
-
-`watchAddress` - Optional - Go to confirmed if address receives any payment, best if used with unique payment codes
45
74
<spacer></spacer>
46
75
-`successFn: Function` - Optional -Callback function when payment is successful
47
76
-`failFn: Function` - Optional - Callback function when payment fails or is cancelled
48
77
49
-
#### Badger Button
78
+
###BadgerButton
50
79
51
-
Simple Badger Button to display the price in local currency, satoshi amount, and have an optional message. Supports the following props
80
+
Simple Badger Button to display the price in local currency, bch or token amount, and have an optional message. Supports the following props
52
81
53
-
- All props from Base Props
54
-
-`showSatoshis: boolean` Default `true` - Show the value in BCH Satoshis below the button
82
+
-[All props from Base Props](/badger/docs/badger-components-react/#base-props)
83
+
-`showAmount: boolean` Default `true` - Show the value in BCH Satoshis below the button
55
84
-`showBorder: boolean` - Default `false` - Border around button and text
56
-
-`showQR: boolean` - Default `false` - Show a QR code attached to the button
57
85
-`text: string` - Optional - Text between the button and border
isRepeatable // Reset to fresh state after a few seconds
197
+
repeatTimeout={4000} // time in ms to reset button after payment
198
+
watchAddress // Watch all payments to address
199
+
/>
133
200
</>
134
201
)
135
202
}
@@ -139,33 +206,27 @@ export default Example
139
206
140
207
### Creating Custom Badger Integrations
141
208
142
-
The library contains a Higher Order Component (HOC) `BadgerBase` which contains all of the required Badger interaction logic. This allows the creation of custom Badger integrations and components easily.
209
+
The majority of the logic is handled by the Higher Order Component (HOC) `BadgerBase`. By wrapping your component with this HOC, it is very easy to create any Badger integration you want, and start using BCH and SLP tokens in your app.
143
210
144
211
Components wrapped in `BadgerBase` support the following props
145
212
146
-
-`to: BCH Address` - Required - Bitcoin Cash address to send BCH to
147
-
-`price: number` - Optional - Price in chosen fiat currency, will be turned into the satoshis equivalent
148
-
-`amount: number` - Optional - Price in chosen ticker, currently only BCH
149
-
<spacer></spacer>
150
-
-`currency: string` - Default `USD` - [ISO Country Code](https://en.wikipedia.org/wiki/ISO_4217) to charge in
151
-
-`ticker: string` - Default `BCH` - Ticker to send, currently only BCH
152
-
<spacer></spacer>
153
-
-`opReturn: string[]` - Optional - OP_RETURN message when paid with Badger
154
-
-`isRepeatable` - Optional - Payment can be done multiple times in a single visit
155
-
-`repeatTimeout` - Optional - How many milliseconds until button reverts to a fresh state
156
-
-`watchAddress` - Optional - Go to confirmed if address receives any payment, best if used with unique payment codes
157
-
<spacer></spacer>
158
-
-`successFn: Function` - Optional -Callback function when payment is successful
159
-
-`failFn: Function` - Optional - Callback function when payment fails or is cancelled
213
+
-[All props from Base Props](/badger/docs/badger-components-react/#base-props)
160
214
161
-
And get the following props added to them for use in the custom integration component
215
+
<spacer></spacer>
216
+
And get the following props added to be used in the custom component
162
217
163
218
-`handleClick: Function` - Call this to start the Badger transaction
164
219
-`step: string` - State of the Badger transaction. One of `fresh`, `pending`, `complete`, `login`, `install`
220
+
-`coinSymbol` - `ticker` of the coin or token. For Bitcoin Cash this will be BCH, for DogeCash this is DOGE, etc.
221
+
-`coinName` - Full name of the coin or token. Bitcoin Cash for BCH, DogeCash for DOGE, etc
222
+
-`coinDecimals` - Maximum decimals for the coin or token. 8 for BCH, variable for SLP tokens
223
+
224
+
<spacer></spacer>
225
+
Like other components, components enhanced with BadgerBase are free to add any other props, and extend the functionality in new unique ways.
0 commit comments