@notabene/javascript-sdk 1.22.0 → 1.23.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.
Files changed (3) hide show
  1. package/CODEOWNERS +1 -1
  2. package/README.md +47 -1
  3. package/package.json +1 -1
package/CODEOWNERS CHANGED
@@ -1 +1 @@
1
- * @ajunge @brunosimplicio @lluissuros @omrinuri @dw1284 @ilja.nevolin @richardcrosby @cblage_notabene @anibal9 @david1250 @marieh_mai
1
+ * @ajunge @brunosimplicio @lluissuros @omrinuri @dw1284 @ilja.nevolin @richardcrosby @david1250 @marieh_mai @timothy4915912
package/README.md CHANGED
@@ -15,6 +15,14 @@ This library is the JavaScript SDK for loading the widget on a frontend.
15
15
 
16
16
  </div>
17
17
 
18
+ - [Installation](#installation)
19
+ - [Usage](#usage)
20
+ - [Supported asset formats](#supported-asset-formats)
21
+ - [Re-rendering](#re-rendering)
22
+ - [Error handling](#error-handling)
23
+ - [Customization](#customization)
24
+ - [License](#license)
25
+
18
26
  ## Installation
19
27
 
20
28
  There are two options for loading the Notabene SDK:
@@ -76,7 +84,7 @@ Once the widget determines the transaction is valid, it will call the `onValidSt
76
84
  const currentTransactionInfo = notabene.tx;
77
85
  ```
78
86
 
79
- ###Supported asset formats
87
+ ### Supported asset formats
80
88
 
81
89
  - `USDC` the simple asset code passed as a `string`, in case different chain (polygon) -> `USDC-POLY`
82
90
  - `CAIP19` format
@@ -112,6 +120,44 @@ notabene.renderWidget();
112
120
 
113
121
  Calling the `renderWidget` methods without destroying it first will not work.
114
122
 
123
+ ---
124
+
125
+ ### Error handling
126
+
127
+ If any error occurs, the `onError` function from the Notabene instance will be triggered. The `error` passed as argument contains a `data` property that has the following type `ErrorData`.
128
+
129
+ > ⚠️ **Note**: These errors are mainly used for debugging internal issues while implementing the widget. They are not meant to be shown directly to the end user.
130
+
131
+ ```js
132
+ type ErrorData = {
133
+ title: string;
134
+ detail: string;
135
+ code: number;
136
+ type: string;
137
+ };
138
+
139
+ const notabene = new Notabene({
140
+ ...,
141
+ onError: (err) => {
142
+ const errorData = err.data;
143
+
144
+ // Do something
145
+ },
146
+ });
147
+ ```
148
+
149
+ **Notabene Internal Errors**
150
+
151
+ Type | Code | Title | Detail
152
+ -- | -- | -- | --
153
+ `BAD_REQUEST` | `400` | `Bad Request` | `NotabeneBadRequest: ...`
154
+ `TRANSACTION_INVALID` | `400` | `Transaction Invalid` | `NotabeneTransactionInvalid: ...`
155
+ `TOKEN_INVALID` | `401` | `Token Invalid` | `NotabeneTokenInvalid: ...`
156
+ `ASSET_NOT_SUPPORTED` | `404` | `Asset Not Supported` | `NotabeneAssetNotSupported: ...`
157
+ `SERVICE_UNAVAILABLE` | `500` | `Service Unavailable` | `NotabeneServiceUnavailable: ...`
158
+ `WALLET_CONNECTED_FAILED` | `500` | `Wallet Connection Failed` | `NotabeneWalletConnectionFailed: ...`
159
+ `WALLET_NOT_SUPPORTED` | `501` | `Wallet Not Supported` | `NotabeneWalletNotSupported: ...`
160
+
115
161
  ## Customization
116
162
 
117
163
  **Functionality**
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "author": "Notabene <developers@notabene.id>",
10
10
  "license": "MIT",
11
- "version": "1.22.0",
11
+ "version": "1.23.0",
12
12
  "main": "dist/index.js",
13
13
  "packageManager": "yarn@3.2.2",
14
14
  "browserslist": "> 0.5%, last 2 versions, not dead",