@kimafinance/kima-transaction-widget 1.2.65-beta.1 → 1.2.67-beta.1
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 +35 -0
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +28 -9
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -353,6 +353,41 @@ Used to specify url of kima block explorer.
|
|
|
353
353
|
|
|
354
354
|
- `keplrHandler: (e: any) => void`: Callback function to handle Keplr wallet events.
|
|
355
355
|
|
|
356
|
+
## Kima Provider
|
|
357
|
+
|
|
358
|
+
```tsx
|
|
359
|
+
<KimaProvider
|
|
360
|
+
walletConnectProjectId='e579511a495b5c312b572b036e60555a'
|
|
361
|
+
networkOption={NetworkOptions.testnet}
|
|
362
|
+
>
|
|
363
|
+
{/ * etc */}
|
|
364
|
+
</KimaProvider>
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Used to provide the widget with wallet connection and chain switching functionality.
|
|
368
|
+
|
|
369
|
+
### `walletConnectProjectId`
|
|
370
|
+
|
|
371
|
+
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).
|
|
372
|
+
|
|
373
|
+
- Required: `false`
|
|
374
|
+
- Type: `string`
|
|
375
|
+
|
|
376
|
+
### `networkOption`
|
|
377
|
+
|
|
378
|
+
Used to specify the network type.
|
|
379
|
+
|
|
380
|
+
```ts
|
|
381
|
+
enum NetworkOptions {
|
|
382
|
+
testnet = 'testnet',
|
|
383
|
+
mainnet = 'mainnet'
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
- Required: `false`
|
|
388
|
+
- Type: `NetworkOptions`
|
|
389
|
+
- Default: `NetworkOptions.testnet`
|
|
390
|
+
|
|
356
391
|
## Note
|
|
357
392
|
|
|
358
393
|
[How to fix Polyfill node core module error](https://www.alchemy.com/blog/how-to-polyfill-node-core-modules-in-webpack-5)
|
package/dist/index.js
CHANGED
|
@@ -2785,6 +2785,7 @@ function useCurrencyOptions() {
|
|
|
2785
2785
|
var nodeProviderQuery = reactRedux.useSelector(selectNodeProviderQuery);
|
|
2786
2786
|
var originNetwork = reactRedux.useSelector(selectSourceChain);
|
|
2787
2787
|
var targetNetwork = reactRedux.useSelector(selectTargetChain);
|
|
2788
|
+
var dAppOption = reactRedux.useSelector(selectDappOption);
|
|
2788
2789
|
React.useEffect(function () {
|
|
2789
2790
|
if (!nodeProviderQuery || !originNetwork || !targetNetwork || !transactionOption && mode === exports.ModeOptions.payment) return;
|
|
2790
2791
|
(function () {
|
|
@@ -2811,7 +2812,11 @@ function useCurrencyOptions() {
|
|
|
2811
2812
|
dispatch(setSourceCurrency(_tokenList[0]));
|
|
2812
2813
|
dispatch(setTargetCurrency(_tokenList[0]));
|
|
2813
2814
|
}
|
|
2814
|
-
|
|
2815
|
+
if (dAppOption !== exports.DAppOptions.None) {
|
|
2816
|
+
setTokenList([(transactionOption === null || transactionOption === void 0 ? void 0 : transactionOption.currency) || 'USDK']);
|
|
2817
|
+
} else {
|
|
2818
|
+
setTokenList(_tokenList);
|
|
2819
|
+
}
|
|
2815
2820
|
});
|
|
2816
2821
|
}, function (e) {
|
|
2817
2822
|
console.log('rpc disconnected', e);
|
|
@@ -2821,7 +2826,7 @@ function useCurrencyOptions() {
|
|
|
2821
2826
|
Promise.reject(e);
|
|
2822
2827
|
}
|
|
2823
2828
|
})();
|
|
2824
|
-
}, [nodeProviderQuery, originNetwork, targetNetwork, transactionOption, mode]);
|
|
2829
|
+
}, [nodeProviderQuery, originNetwork, targetNetwork, transactionOption, mode, dAppOption]);
|
|
2825
2830
|
return React.useMemo(function () {
|
|
2826
2831
|
return {
|
|
2827
2832
|
tokenList: tokenList
|
|
@@ -3329,7 +3334,7 @@ var TransactionWidget = function TransactionWidget(_ref) {
|
|
|
3329
3334
|
var data;
|
|
3330
3335
|
var isLP = dAppOption === exports.DAppOptions.LPAdd || dAppOption === exports.DAppOptions.LPDrain;
|
|
3331
3336
|
return Promise.resolve(fetchWrapper.post(graphqlProviderQuery, JSON.stringify({
|
|
3332
|
-
query: "query TransactionDetailsKima($txId: String) {\n " + (
|
|
3337
|
+
query: isLP ? "query TransactionDetailsKima($txId: String) {\n liquidity_transaction_data(where: { tx_id: { _eq: " + txId.toString() + " } }, limit: 1) {\n failreason\n pullfailcount\n pullhash\n releasefailcount\n releasehash\n txstatus\n amount\n creator\n chain\n providerchainaddress\n symbol\n tx_id\n }\n }" : "query TransactionDetailsKima($txId: String) {\n transaction_data(where: { tx_id: { _eq: " + txId.toString() + " } }, limit: 1) {\n failreason\n pullfailcount\n pullhash\n releasefailcount\n releasehash\n txstatus\n amount\n creator\n originaddress\n originchain\n originsymbol\n targetsymbol\n targetaddress\n targetchain\n tx_id\n }\n }"
|
|
3333
3338
|
}))).then(function (result) {
|
|
3334
3339
|
var _result$data, _result$data$transact;
|
|
3335
3340
|
if (!(result !== null && result !== void 0 && (_result$data = result.data) !== null && _result$data !== void 0 && (_result$data$transact = _result$data.transaction_data) !== null && _result$data$transact !== void 0 && _result$data$transact.length)) {
|
|
@@ -3344,14 +3349,14 @@ var TransactionWidget = function TransactionWidget(_ref) {
|
|
|
3344
3349
|
if (isLP) {
|
|
3345
3350
|
setData({
|
|
3346
3351
|
status: data.txstatus,
|
|
3347
|
-
sourceChain: data.
|
|
3348
|
-
targetChain: data.
|
|
3352
|
+
sourceChain: data.chain,
|
|
3353
|
+
targetChain: data.chain,
|
|
3349
3354
|
tssPullHash: dAppOption === exports.DAppOptions.LPAdd ? data.releaseHash : '',
|
|
3350
3355
|
tssReleaseHash: dAppOption === exports.DAppOptions.LPDrain ? data.releaseHash : '',
|
|
3351
3356
|
failReason: data.failreason,
|
|
3352
3357
|
amount: +data.amount,
|
|
3353
|
-
sourceSymbol: data.
|
|
3354
|
-
targetSymbol: data.
|
|
3358
|
+
sourceSymbol: data.symbol,
|
|
3359
|
+
targetSymbol: data.symbol,
|
|
3355
3360
|
kimaTxHash: data.kimahash
|
|
3356
3361
|
});
|
|
3357
3362
|
} else {
|