heraldex-onramp-sdk 2.0.0 → 4.0.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  # Herald Exchange Onramp SDK Widget
2
2
 
3
- Herald Exchange Onramp SDK Widget is a simple component for React applications.
3
+ Herald Exchange Onramp SDK is a simple component for React applications.
4
4
 
5
5
  ## Installation
6
6
 
7
- You can install Herald Exchange Onramp SDK Widget via npm:
7
+ You can install Herald Exchange Onramp SDK via npm:
8
8
 
9
9
  ```bash
10
- npm install herald-exchange-onramp-widget
10
+ npm install heraldex-onramp-sdk
11
11
  # or
12
- yarn add herald-exchange-onramp-widget
12
+ yarn add heraldex-onramp-sdk
13
13
  ```
14
14
 
15
15
  ## Usage
@@ -17,20 +17,21 @@ yarn add herald-exchange-onramp-widget
17
17
  To use widget in your React application, follow these steps:
18
18
 
19
19
  ```tsx
20
- import { BuyCryptoWidget } from "herald-exchange-onramp-widget";
20
+ import { BuyCryptoWidget } from "heraldex-onramp-sdk";
21
21
  ```
22
22
 
23
23
  Initialize the widget:
24
24
 
25
- > To Generate API Key Please Visit : [Herald Exchange](https://app.herald.exchange/login).
25
+ > To Generate API Key Please Visit : [Herald Exchange](https://app.herald.exchange/signin).
26
26
  > Supported Token Types : ["USDT", "USDC", "ETH", "BNB", "MATIC", "SOL", "TRX"]
27
27
 
28
28
  ```tsx
29
29
  <BuyCryptoWidget
30
- clientReferenceID={YOUR_CLIENT_REFERENCE_ID}
30
+ clientReferenceID={YOUR_SALT_KEY}
31
31
  apiKey={YOUR_API_KEY}
32
32
  redirectUrl={REDIRECT_URL}
33
33
  buyParameters={{ from_amount: "25", token_type: "TRX" }}
34
+ callback={(data) => alert(JSON.stringify(data))}
34
35
  />
35
36
  ```
36
37
 
@@ -53,23 +54,7 @@ Initialize the widget:
53
54
 
54
55
  - This key is used to authenticate and authorize the widget.
55
56
 
56
- - Example: `4bb06e2fdbfb8e392a0ab49e4d9819ae072dcef82d79af7893625a5ff1416f`
57
-
58
- ---
59
-
60
- ### `mode` (optional)
61
-
62
- - Type: string
63
-
64
- - Allowed Values: "development" | "production"
65
-
66
- - Default: "development"
67
-
68
- - Description: Specifies the environment in which the widget runs.
69
-
70
- - "development" is used for testing and debugging purposes.
71
-
72
- - "production" should be used in live environments for optimized performance.
57
+ - Example: `4bb06e2fdbfb8e392a0ab49e4d9819.ae072dcef82d79af7893625a5ff1416f`
73
58
 
74
59
  ---
75
60
 
@@ -81,19 +66,7 @@ Initialize the widget:
81
66
 
82
67
  - Helps track user activity and transaction flow.
83
68
 
84
- - Example: `34edd6d6-eb12-422f-bd0e-63c5733527`
85
-
86
- ---
87
-
88
- ### `redirectUrl` (optional)
89
-
90
- - **Type**: `string`
91
-
92
- - **Description**: The URL to which the user will be redirected **after completing the transaction**.
93
-
94
- - A **callback** will be made to this URL along with the **transaction result or status** as query parameters or payload (depending on the integration).
95
-
96
- - Example: `https://yourapp.com/transaction-complete`
69
+ - Example: `34edd6d6eb12422fbd0e63c5733527`
97
70
 
98
71
  ---
99
72
 
@@ -109,7 +82,6 @@ Initialize the widget:
109
82
  ```
110
83
 
111
84
  - **Description**: Defines the default configuration for the buy flow.
112
-
113
85
  - from_amount: A string representing the default amount to be displayed in the input field (e.g., "25").
114
86
 
115
87
  - token_type: The token that should be selected by default for purchase (e.g., "USDC").
@@ -118,6 +90,51 @@ Initialize the widget:
118
90
 
119
91
  ---
120
92
 
93
+ ### `callback` (required)
94
+
95
+ - **Type**:
96
+
97
+ ```ts
98
+ (data: {
99
+ status: string;
100
+ message?: string;
101
+ transaction_id?: string;
102
+ [key: string]: any;
103
+ }) => void
104
+
105
+ ```
106
+
107
+ - **Description**: A callback function that is triggered whenever the widget returns a response or status update.
108
+
109
+ status: Represents the current state of the action (e.g., "success", "failed", "pending").
110
+ message: Optional message returned from the widget response.
111
+ transaction_id: Optional unique transaction identifier.
112
+ Additional response fields may be included depending on the event type.
113
+
114
+ ---
115
+
116
+ ### `redirect` (optinal)
117
+
118
+ - **Type**: `boolean`
119
+
120
+ - **Description**: Determines whether redirection should be enabled after the action is completed.
121
+
122
+ - Example: `false | true`
123
+
124
+ ---
125
+
126
+ ### `redirectUrl` (optional)
127
+
128
+ - **Type**: `string`
129
+
130
+ - **Description**: The URL to which the user will be redirected **after completing the transaction**.
131
+
132
+ - A **callback** will be made to this URL along with the **transaction result or status** as query parameters or payload (depending on the integration).
133
+
134
+ - Example: `https://yourapp.com/transaction-complete`
135
+
136
+ ---
137
+
121
138
  ## License
122
139
 
123
140
  This project is licensed under the MIT License - see the LICENSE file for details.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
3
  type BuyParamsType = {
4
- from_amount?: string;
5
- token_type?: string;
4
+ from_amount: string;
5
+ token_type: string;
6
+ fiat: string;
6
7
  };
7
8
  type CallBackResponse = {
8
9
  status: "success" | "failed";
@@ -23,7 +24,7 @@ type CallBackResponse = {
23
24
 
24
25
  type WidgetComponentProps = {
25
26
  apiKey: string;
26
- buyParameters?: BuyParamsType;
27
+ buyParameters: BuyParamsType;
27
28
  clientReferenceID: string;
28
29
  mode?: "development" | "production";
29
30
  callback: (data: CallBackResponse) => void;