@kimafinance/kima-transaction-widget 1.3.13 → 1.3.14
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 +30 -72
- package/dist/index.cjs +339 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +46 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +409 -281
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
const App = () => {
|
|
31
31
|
return (
|
|
32
32
|
<KimaProvider
|
|
33
|
+
kimaBackendUrl='http://localhost:3001' // or your deployed backend instance
|
|
33
34
|
walletConnectProjectId='e579511a495b5c312b572b036e60555a'
|
|
34
35
|
externalProvider={} // in case you want to provide an already connected wallet
|
|
35
36
|
>
|
|
@@ -38,8 +39,6 @@ const App = () => {
|
|
|
38
39
|
colorMode: ColorModeOptions.light
|
|
39
40
|
}}
|
|
40
41
|
mode={ModeOptions.payment}
|
|
41
|
-
kimaBackendUrl='http://localhost:3001' // or your deployed backend instance
|
|
42
|
-
kimaExplorer='https://explorer.sardis.kima.network' // or explorer.kima.network for mainnet
|
|
43
42
|
titleOption={{
|
|
44
43
|
initialTitle: 'New Purchase'
|
|
45
44
|
}}
|
|
@@ -54,15 +53,6 @@ const App = () => {
|
|
|
54
53
|
amount: 5,
|
|
55
54
|
currency: 'USDK'
|
|
56
55
|
}}
|
|
57
|
-
errorHandler={(e: any) => {
|
|
58
|
-
console.log('error:', e)
|
|
59
|
-
}}
|
|
60
|
-
successHandler={() => {
|
|
61
|
-
console.log('success')
|
|
62
|
-
}}
|
|
63
|
-
closeHandler={() => {
|
|
64
|
-
console.log('closed')
|
|
65
|
-
}}
|
|
66
56
|
/>
|
|
67
57
|
</KimaProvider>
|
|
68
58
|
)
|
|
@@ -87,6 +77,7 @@ import {
|
|
|
87
77
|
const App = () => {
|
|
88
78
|
return (
|
|
89
79
|
<KimaProvider
|
|
80
|
+
kimaBackendUrl='http://localhost:3001' // or your deployed backend instance
|
|
90
81
|
walletConnectProjectId='e579511a495b5c312b572b036e60555a'
|
|
91
82
|
externalProvider={} // in case you want to provide an already connected wallet
|
|
92
83
|
>
|
|
@@ -96,18 +87,7 @@ const App = () => {
|
|
|
96
87
|
fontSize: FontSizeOptions.medium
|
|
97
88
|
}}
|
|
98
89
|
mode={ModeOptions.bridge}
|
|
99
|
-
kimaBackendUrl='http://localhost:3001' // or your deployed backend instance
|
|
100
|
-
kimaExplorer='https://explorer.sardis.kima.network' // or explorer.kima.network for mainnet
|
|
101
90
|
compliantOption={false}
|
|
102
|
-
errorHandler={(e: any) => {
|
|
103
|
-
console.log('error:', e)
|
|
104
|
-
}}
|
|
105
|
-
successHandler={() => {
|
|
106
|
-
console.log('success')
|
|
107
|
-
}}
|
|
108
|
-
closeHandler={() => {
|
|
109
|
-
console.log('closed')
|
|
110
|
-
}}
|
|
111
91
|
excludedSourceNetworks={[SupportNetworks.SOLANA]} // exclude networks that your dapp doesn't support
|
|
112
92
|
excludedTargetNetworks={[SupportNetworks.SOLANA]}
|
|
113
93
|
/>
|
|
@@ -133,25 +113,17 @@ import {
|
|
|
133
113
|
|
|
134
114
|
const App = () => {
|
|
135
115
|
return (
|
|
136
|
-
<KimaProvider
|
|
116
|
+
<KimaProvider
|
|
117
|
+
kimaBackendUrl='http://localhost:3001' // or your deployed backend instance
|
|
118
|
+
walletConnectProjectId='e579511a495b5c312b572b036e60555a'
|
|
119
|
+
>
|
|
137
120
|
<KimaTransactionWidget
|
|
138
121
|
theme={{
|
|
139
122
|
colorMode: ColorModeOptions.light,
|
|
140
123
|
fontSize: FontSizeOptions.medium
|
|
141
124
|
}}
|
|
142
125
|
mode={ModeOptions.status}
|
|
143
|
-
kimaBackendUrl='http://localhost:3001' // or your deployed backend instance
|
|
144
|
-
kimaExplorer='https://explorer.sardis.kima.network' // or explorer.kima.network for mainnet
|
|
145
126
|
txId={10}
|
|
146
|
-
errorHandler={(e: any) => {
|
|
147
|
-
console.log('error:', e)
|
|
148
|
-
}}
|
|
149
|
-
successHandler={() => {
|
|
150
|
-
console.log('success')
|
|
151
|
-
}}
|
|
152
|
-
closeHandler={() => {
|
|
153
|
-
console.log('closed')
|
|
154
|
-
}}
|
|
155
127
|
/>
|
|
156
128
|
</KimaProvider>
|
|
157
129
|
)
|
|
@@ -281,38 +253,14 @@ Used to specify payment screen's title.
|
|
|
281
253
|
/>
|
|
282
254
|
```
|
|
283
255
|
|
|
284
|
-
### `kimaBackendUrl`
|
|
285
|
-
|
|
286
|
-
Used to specify kima transaction backend url.
|
|
287
|
-
|
|
288
|
-
- Required: `true`
|
|
289
|
-
- Type: `string`
|
|
290
|
-
|
|
291
|
-
### `kimaExplorer`
|
|
292
|
-
|
|
293
|
-
Used to specify url of kima block explorer.
|
|
294
|
-
|
|
295
|
-
- Required: `false`
|
|
296
|
-
- Type: `string`
|
|
297
|
-
- Default: `explorer.kima.network`
|
|
298
|
-
|
|
299
|
-
### Event handlers
|
|
300
|
-
|
|
301
|
-
- `errorHandler: (e: any) => void`: Callback function to handle errors.
|
|
302
|
-
- `closeHandler: (e: any) => void`: Callback function to handle close event.
|
|
303
|
-
- `successHandler: (e: any) => void`: Callback function to handle success event after transaction submission to kima transaction backend.
|
|
304
|
-
|
|
305
|
-
- `switchChainHandler: (chainId: number) => void`: Callback function to handle chain switch event.
|
|
306
|
-
|
|
307
|
-
- `keplrHandler: (e: any) => void`: Callback function to handle Keplr wallet events.
|
|
308
|
-
|
|
309
256
|
## Kima Provider
|
|
310
257
|
|
|
311
258
|
```tsx
|
|
312
259
|
<KimaProvider
|
|
313
|
-
|
|
314
|
-
networkOption={NetworkOptions.testnet}
|
|
260
|
+
kimaBackendUrl='http://localhost:3001' // or your deployed backend instance
|
|
315
261
|
externalProvider={new Web3Provider()}
|
|
262
|
+
logLevel='debug' // optional, default is 'error'
|
|
263
|
+
walletConnectProjectId='e579511a495b5c312b572b036e60555a'
|
|
316
264
|
>
|
|
317
265
|
{/ * etc */}
|
|
318
266
|
</KimaProvider>
|
|
@@ -320,6 +268,13 @@ Used to specify url of kima block explorer.
|
|
|
320
268
|
|
|
321
269
|
Used to provide the widget with wallet connection and chain switching functionality.
|
|
322
270
|
|
|
271
|
+
### `kimaBackendUrl`
|
|
272
|
+
|
|
273
|
+
Used to specify kima transaction backend url.
|
|
274
|
+
|
|
275
|
+
- Required: `true`
|
|
276
|
+
- Type: `string`
|
|
277
|
+
|
|
323
278
|
### `walletConnectProjectId`
|
|
324
279
|
|
|
325
280
|
Used to specify the WalletConnect project id. A default value is provided, but you can specify your own. To create a project, visit [Reown Cloud](https://cloud.reown.com/sign-in) and sign up for a free account (WalletConnect is now called Reown).
|
|
@@ -327,20 +282,13 @@ Used to specify the WalletConnect project id. A default value is provided, but y
|
|
|
327
282
|
- Required: `false`
|
|
328
283
|
- Type: `string`
|
|
329
284
|
|
|
330
|
-
### `
|
|
285
|
+
### `logLevel` (optional)
|
|
331
286
|
|
|
332
|
-
|
|
287
|
+
For debugging purposes, you can specify the log level. Available levels are `trace`, `debug`, `info`, `warn`, `error` and `silent`. By default, the log level is set to `error`.
|
|
333
288
|
|
|
334
|
-
|
|
335
|
-
enum NetworkOptions {
|
|
336
|
-
testnet = 'testnet',
|
|
337
|
-
mainnet = 'mainnet'
|
|
338
|
-
}
|
|
339
|
-
```
|
|
289
|
+
The log level can also be set using the `LOG_LEVEL` environment or the equivalent for your framework: `NEXT_PUBLIC_LOG_LEVEL`, `VITE_LOG_LEVEL`. The Widget property will take precedence over the environment variable as it is set last.
|
|
340
290
|
|
|
341
|
-
|
|
342
|
-
- Type: `NetworkOptions`
|
|
343
|
-
- Default: `NetworkOptions.testnet`
|
|
291
|
+
**DEBUG mode**: Type `D` `E` `B` `U` `G` while focus is on the Widget (not in the console) to enable debug mode. This will set the log level to `debug` and log all messages to the console. Type it again to disable debug mode and restore the default log level. Useful to temporarily toggle logging in the browser when in production or an already deployed app where changing the ENV variable would require a redeploy.
|
|
344
292
|
|
|
345
293
|
### `externalProvider`
|
|
346
294
|
|
|
@@ -357,6 +305,16 @@ interface ExternalProvider {
|
|
|
357
305
|
- Required: `false`
|
|
358
306
|
- Type: `ExternalProvider`
|
|
359
307
|
|
|
308
|
+
### Event handlers
|
|
309
|
+
|
|
310
|
+
- `errorHandler: (e: any) => void`: Callback function to handle errors.
|
|
311
|
+
- `closeHandler: (e: any) => void`: Callback function to handle close event.
|
|
312
|
+
- `successHandler: (e: any) => void`: Callback function to handle success event after transaction submission to kima transaction backend.
|
|
313
|
+
|
|
314
|
+
- `switchChainHandler: (chainId: number) => void`: Callback function to handle chain switch event.
|
|
315
|
+
|
|
316
|
+
- `keplrHandler: (e: any) => void`: Callback function to handle Keplr wallet events.
|
|
317
|
+
|
|
360
318
|
## Note
|
|
361
319
|
|
|
362
320
|
[How to fix Polyfill node core module error](https://www.alchemy.com/blog/how-to-polyfill-node-core-modules-in-webpack-5)
|