@depay/widgets 6.12.1 → 6.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/esm/index.bundle.js +256 -89
- package/dist/esm/index.js +193 -62
- package/dist/umd/index.bundle.js +256 -89
- package/dist/umd/index.js +193 -62
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -194,6 +194,25 @@ DePayWidgets.Payment({
|
|
|
194
194
|
});
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
+
#### fromToken, fromAmount + toToken
|
|
198
|
+
|
|
199
|
+
In case where you want to configure payments based on the source token + amount, rather than target token and amount, you can pass `fromToken`, `fromAmount` and `toToken` to `accept`.
|
|
200
|
+
|
|
201
|
+
In those cases make sure to NOT configure `token` nor `amount`!
|
|
202
|
+
|
|
203
|
+
```javascript
|
|
204
|
+
DePayWidgets.Payment({
|
|
205
|
+
accept: [{
|
|
206
|
+
blockchain: 'bsc',
|
|
207
|
+
fromToken: '0xe9e7cea3dedca5984780bafc599bd69add087d56',
|
|
208
|
+
fromAmount: 0.1,
|
|
209
|
+
toToken: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
210
|
+
receiver: '0x08B277154218CCF3380CAE48d630DA13462E3950'
|
|
211
|
+
}]
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// This will open a payment widget to send 0.1 BUSD to the receiver, converting it to BNB along the way.
|
|
215
|
+
```
|
|
197
216
|
|
|
198
217
|
#### track
|
|
199
218
|
|
|
@@ -586,6 +605,29 @@ let { unmount } = await DePayWidgets.Payment({})
|
|
|
586
605
|
unmount()
|
|
587
606
|
```
|
|
588
607
|
|
|
608
|
+
#### recover
|
|
609
|
+
|
|
610
|
+
`recover`
|
|
611
|
+
|
|
612
|
+
Allows you to recover a previous made payment. E.g. useful if you need to continue to show a pending payment progress if user rearrives or reloads a payment page:
|
|
613
|
+
|
|
614
|
+
```javascript
|
|
615
|
+
DePayWidgets.Payment({
|
|
616
|
+
recover: {
|
|
617
|
+
blockchain: 'ethereum',
|
|
618
|
+
transaction: '0x081ae81229b2c7df586835e9e4c16aa89f8a15dc118fac31b7521477c53ed2a9',
|
|
619
|
+
sender: '0x317d875ca3b9f8d14f960486c0d1d1913be74e90',
|
|
620
|
+
nonce: 2865,
|
|
621
|
+
afterBlock: 14088130,
|
|
622
|
+
token: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
623
|
+
amount: 0.0001
|
|
624
|
+
}
|
|
625
|
+
})
|
|
626
|
+
|
|
627
|
+
A recovered payment still results in a confirmed or failed payment, and also calls one of those callbacks also when created with recover.
|
|
628
|
+
|
|
629
|
+
```
|
|
630
|
+
|
|
589
631
|
## DePay Sales
|
|
590
632
|
|
|
591
633
|
DePay Sales allows you to sell tokens directly from your website or dApp with automatic any-to-any payment conversion (so people can use any token when buying your token directly off your website or dApp).
|