@zerohash-sdk/crypto-withdrawals-js 1.16.9 → 1.16.11
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 +25 -11
- package/dist/index.d.ts +12 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,17 +87,17 @@ await cryptoWithdrawals.render(document.getElementById('container')!);
|
|
|
87
87
|
|
|
88
88
|
### Configuration
|
|
89
89
|
|
|
90
|
-
| Prop | Type
|
|
91
|
-
| ------------- |
|
|
92
|
-
| `jwt` | `string`
|
|
93
|
-
| `env` | `"prod" \| "cert" \| "dev" \| "local"`
|
|
94
|
-
| `theme` | `"auto" \| "light" \| "dark"`
|
|
95
|
-
| `onCompleted` | `({ withdrawalRequestId }) => void`
|
|
96
|
-
| `onFailed` | `({ withdrawalRequestId }) => void`
|
|
97
|
-
| `onError` | `({ errorCode, reason }) => void`
|
|
98
|
-
| `onClose` | `() => void`
|
|
99
|
-
| `onEvent` | `({ type, data }) => void`
|
|
100
|
-
| `onLoaded` | `() => void`
|
|
90
|
+
| Prop | Type | Required | Default | Description |
|
|
91
|
+
| ------------- | ----------------------------------------------------------------------- | -------- | -------- | -------------------------------------------------------- |
|
|
92
|
+
| `jwt` | `string` | Yes | - | JWT token for authentication with Connect |
|
|
93
|
+
| `env` | `"prod" \| "cert" \| "dev" \| "local"` | No | `"prod"` | Target environment |
|
|
94
|
+
| `theme` | `"auto" \| "light" \| "dark"` | No | `"auto"` | Theme mode for the interface |
|
|
95
|
+
| `onCompleted` | `({ withdrawalRequestId, status, assetId, networkId, amount }) => void` | No | - | Callback when the withdrawal flow completes successfully |
|
|
96
|
+
| `onFailed` | `({ withdrawalRequestId }) => void` | No | - | Callback when a withdrawal ends in a failed state |
|
|
97
|
+
| `onError` | `({ errorCode, reason }) => void` | No | - | Callback for error events |
|
|
98
|
+
| `onClose` | `() => void` | No | - | Callback when the widget is closed |
|
|
99
|
+
| `onEvent` | `({ type, data }) => void` | No | - | Callback for general events |
|
|
100
|
+
| `onLoaded` | `() => void` | No | - | Callback when the widget is loaded and ready |
|
|
101
101
|
|
|
102
102
|
### Methods
|
|
103
103
|
|
|
@@ -118,6 +118,20 @@ await cryptoWithdrawals.render(document.getElementById('container')!);
|
|
|
118
118
|
- Safari 14+
|
|
119
119
|
- All modern browsers with Web Components support
|
|
120
120
|
|
|
121
|
+
### `onCompleted` payload
|
|
122
|
+
|
|
123
|
+
`onCompleted` receives `{ withdrawalRequestId, status, assetId, networkId, amount }`.
|
|
124
|
+
What `status` and `amount` mean depends on the flow that completed:
|
|
125
|
+
|
|
126
|
+
| Flow | `status` | `amount` |
|
|
127
|
+
| ---------------- | ----------- | --------------------------------------- |
|
|
128
|
+
| Classic (manual) | `SUBMITTED` | The requested amount, before fees |
|
|
129
|
+
| Auth | `CONFIRMED` | The net amount the destination received |
|
|
130
|
+
|
|
131
|
+
`SUBMITTED` means the withdrawal was submitted, not confirmed on-chain.
|
|
132
|
+
`assetId` is the asset ticker (e.g. `BTC`, `USDC`) and `networkId` the network
|
|
133
|
+
chain code (e.g. `bitcoin`, `ethereum`).
|
|
134
|
+
|
|
121
135
|
### `onFailed` and `onError` on a failed withdrawal
|
|
122
136
|
|
|
123
137
|
A failed withdrawal fires **both** `onFailed` and `onError`, so existing
|
package/dist/index.d.ts
CHANGED
|
@@ -422,7 +422,12 @@ declare type CryptoWithdrawalsCallbacks = CommonCallbacks<CryptoWithdrawalsEvent
|
|
|
422
422
|
declare type CryptoWithdrawalsCompletedData = {
|
|
423
423
|
/** The withdrawal request ID returned from the API */
|
|
424
424
|
withdrawalRequestId: string;
|
|
425
|
-
/**
|
|
425
|
+
/**
|
|
426
|
+
* Status value. The Auth flow sends a terminal status, e.g. `CONFIRMED` or
|
|
427
|
+
* `FAILED`. The classic (manual) flow sends `SUBMITTED`
|
|
428
|
+
* ({@link CRYPTO_WITHDRAWALS_STATUS_SUBMITTED}): the withdrawal was
|
|
429
|
+
* submitted, not confirmed.
|
|
430
|
+
*/
|
|
426
431
|
status?: string;
|
|
427
432
|
/**
|
|
428
433
|
* Human-readable reason for the status. On a failure this is the only
|
|
@@ -430,13 +435,15 @@ declare type CryptoWithdrawalsCompletedData = {
|
|
|
430
435
|
* reporting a bare id.
|
|
431
436
|
*/
|
|
432
437
|
statusDetails?: string;
|
|
433
|
-
/** Asset
|
|
438
|
+
/** Asset ticker (e.g. 'BTC', 'USDC') */
|
|
434
439
|
assetId?: string;
|
|
435
|
-
/** Network
|
|
440
|
+
/** Network chain code (e.g. 'bitcoin', 'ethereum') */
|
|
436
441
|
networkId?: string;
|
|
437
442
|
/**
|
|
438
|
-
* On `onCompleted`, the net amount the destination received,
|
|
439
|
-
* On
|
|
443
|
+
* On the Auth flow's `onCompleted`, the net amount the destination received,
|
|
444
|
+
* after fees. On the classic (manual) flow's `onCompleted`, the requested
|
|
445
|
+
* amount, before fees, since the withdrawal has not settled yet. On
|
|
446
|
+
* `onFailed`, the requested amount, since nothing was received.
|
|
440
447
|
*/
|
|
441
448
|
amount?: string;
|
|
442
449
|
};
|