@swype-org/react-sdk 0.2.171 → 0.2.174
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/dist/index.cjs +21 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext, forwardRef, useContext, useRef, useState, useCallback, useMemo, useEffect, useSyncExternalStore, useReducer, Component } from 'react';
|
|
2
2
|
import { PrivyProvider, usePrivy, useLoginWithPasskey, useSignupWithPasskey } from '@privy-io/react-auth';
|
|
3
3
|
import { createConfig, http, WagmiProvider, useConfig, useConnect, useSwitchChain } from 'wagmi';
|
|
4
|
-
import { mainnet, arbitrum, base, polygon, bsc, megaeth, baseSepolia } from 'wagmi/chains';
|
|
4
|
+
import { mainnet, arbitrum, base, polygon, bsc, megaeth, monad, baseSepolia } from 'wagmi/chains';
|
|
5
5
|
import { injected, coinbaseWallet } from 'wagmi/connectors';
|
|
6
6
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -606,7 +606,7 @@ function resolveSelectSourceOption(choices, options, chainName, tokenSymbol, rec
|
|
|
606
606
|
}
|
|
607
607
|
var BLINK_PRIVY_APP_ID = "cmlil87uv004n0ck0blwumwek";
|
|
608
608
|
var wagmiConfig = createConfig({
|
|
609
|
-
chains: [mainnet, arbitrum, base, polygon, bsc, megaeth, baseSepolia],
|
|
609
|
+
chains: [mainnet, arbitrum, base, polygon, bsc, megaeth, monad, baseSepolia],
|
|
610
610
|
connectors: [
|
|
611
611
|
injected({ unstable_shimAsyncInject: 2e3 }),
|
|
612
612
|
// `preference: 'all'` (default) lets the Coinbase Wallet SDK prefer an
|
|
@@ -625,6 +625,7 @@ var wagmiConfig = createConfig({
|
|
|
625
625
|
[polygon.id]: http("https://polygon-bor-rpc.publicnode.com"),
|
|
626
626
|
[bsc.id]: http(),
|
|
627
627
|
[megaeth.id]: http(),
|
|
628
|
+
[monad.id]: http(),
|
|
628
629
|
[baseSepolia.id]: http()
|
|
629
630
|
}
|
|
630
631
|
});
|
|
@@ -1991,6 +1992,7 @@ var DEFAULT_POLL_INTERVAL_MS = 2e3;
|
|
|
1991
1992
|
var DEFAULT_MAX_ATTEMPTS = 60;
|
|
1992
1993
|
var DEFAULT_REQUEST_TIMEOUT_MS = 8e3;
|
|
1993
1994
|
var DEFAULT_MAX_CONSECUTIVE_ERRORS = 5;
|
|
1995
|
+
var DEFAULT_ERROR_GRACE_PERIOD_MS = 6e4;
|
|
1994
1996
|
var DEFAULT_LOG_EVERY_N_ATTEMPTS = 5;
|
|
1995
1997
|
function classifyCallsStatus(status) {
|
|
1996
1998
|
if (typeof status === "number") {
|
|
@@ -2012,11 +2014,14 @@ async function pollWalletCallsStatus(walletClient, callsId, options = {}) {
|
|
|
2012
2014
|
const maxAttempts = options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
|
|
2013
2015
|
const requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
2014
2016
|
const maxConsecutiveErrors = options.maxConsecutiveErrors ?? DEFAULT_MAX_CONSECUTIVE_ERRORS;
|
|
2017
|
+
const errorGracePeriodMs = options.errorGracePeriodMs ?? DEFAULT_ERROR_GRACE_PERIOD_MS;
|
|
2015
2018
|
const logEveryN = Math.max(1, options.logEveryNAttempts ?? DEFAULT_LOG_EVERY_N_ATTEMPTS);
|
|
2016
2019
|
const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
2020
|
+
const now = options.now ?? (() => Date.now());
|
|
2017
2021
|
const info = options.logger?.info ?? ((m) => console.info(m));
|
|
2018
2022
|
const warn = options.logger?.warn ?? ((m) => console.warn(m));
|
|
2019
2023
|
const error = options.logger?.error ?? ((m) => console.error(m));
|
|
2024
|
+
const pollStartedAt = now();
|
|
2020
2025
|
let consecutiveErrors = 0;
|
|
2021
2026
|
let lastStatus;
|
|
2022
2027
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
@@ -2036,9 +2041,15 @@ async function pollWalletCallsStatus(walletClient, callsId, options = {}) {
|
|
|
2036
2041
|
consecutiveErrors += 1;
|
|
2037
2042
|
const message = err instanceof Error ? err.message : String(err);
|
|
2038
2043
|
const isTimeout = err instanceof PromiseTimeoutError;
|
|
2044
|
+
const elapsedMs = now() - pollStartedAt;
|
|
2045
|
+
const inGracePeriod = elapsedMs < errorGracePeriodMs;
|
|
2039
2046
|
warn(
|
|
2040
|
-
`[blink-sdk][batch-wallet-calls] wallet_getCallsStatus errored. callsId=${callsId}, attempt=${attempt}, consecutiveErrors=${consecutiveErrors}, isTimeout=${isTimeout}, error=${message}`
|
|
2047
|
+
`[blink-sdk][batch-wallet-calls] wallet_getCallsStatus errored. callsId=${callsId}, attempt=${attempt}, consecutiveErrors=${consecutiveErrors}, isTimeout=${isTimeout}, inGracePeriod=${inGracePeriod}, elapsedMs=${elapsedMs}, error=${message}`
|
|
2041
2048
|
);
|
|
2049
|
+
if (inGracePeriod) {
|
|
2050
|
+
consecutiveErrors = 0;
|
|
2051
|
+
continue;
|
|
2052
|
+
}
|
|
2042
2053
|
if (consecutiveErrors >= maxConsecutiveErrors) {
|
|
2043
2054
|
error(
|
|
2044
2055
|
`[blink-sdk][batch-wallet-calls] Aborting poll after ${consecutiveErrors} consecutive errors. callsId=${callsId}, attempt=${attempt}, lastError=${message}`
|
|
@@ -5446,21 +5457,16 @@ var POLYGON_CHAIN_SVG = `<svg width="150" height="150" viewBox="0 0 150 150" fil
|
|
|
5446
5457
|
<rect width="150" height="150" rx="75" fill="#8247E5"/>
|
|
5447
5458
|
<path d="M96.836 28.5L67.9327 45.0996V96.9076L51.9855 106.152L35.9408 96.9003V78.4038L51.9855 69.2417L62.3023 75.2246V60.2596L51.8955 54.3516L23 71.1384V104.345L51.993 121.042L80.8886 104.345V52.5446L96.9331 43.2926L112.971 52.5446V70.9588L96.9331 80.2932L86.5268 74.2575V89.1475L96.836 95.0934L126.016 78.4936V45.0996L96.836 28.5Z" fill="white"/>
|
|
5448
5459
|
</svg>`;
|
|
5449
|
-
var ETHEREUM_CHAIN_SVG = `<svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5450
|
-
<rect width="150" height="150" rx="75" fill="#627EEA"/>
|
|
5451
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M108.532 81.6914L74.8068 126.42V101.308L108.532 81.6914Z" fill="#C0CCF7"/>
|
|
5452
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M41.0841 81.6914L74.8094 126.42V101.308L41.0841 81.6914Z" fill="white"/>
|
|
5453
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M41.0762 76.5079L74.8079 61.5098V95.7005L41.0762 76.5079Z" fill="#C0CCF7"/>
|
|
5454
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M108.538 76.5079L74.8062 61.5098V95.7005L108.538 76.5079Z" fill="#8198EE"/>
|
|
5455
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M41.0841 76.5067L74.8094 23.5806V61.5087L41.0841 76.5067Z" fill="white"/>
|
|
5456
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M108.532 76.5067L74.8068 23.5806V61.5087L108.532 76.5067Z" fill="#C0CCF7"/>
|
|
5457
|
-
</svg>`;
|
|
5458
5460
|
var MEGAETH_CHAIN_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="105" height="105" viewBox="0 0 105 105" fill="none">
|
|
5459
5461
|
<path d="M62.7534 81.6321C65.9781 81.6321 68.5825 79.0297 68.5825 75.8195C68.5825 72.6093 65.9781 70.0068 62.7534 70.0068C59.5536 70.0068 56.9492 72.6093 56.9492 75.8195C56.9492 79.0297 59.5536 81.6321 62.7534 81.6321Z" fill="#19191A"/>
|
|
5460
5462
|
<path d="M41.8648 81.805C45.0894 81.805 47.6693 79.2026 47.6693 75.9923C47.6693 72.7821 45.0894 70.1797 41.8648 70.1797C38.665 70.1797 36.0605 72.7821 36.0605 75.9923C36.0605 79.2026 38.665 81.805 41.8648 81.805Z" fill="#19191A"/>
|
|
5461
5463
|
<path d="M29.1376 21.0791H42.9855C45.5913 28.1286 52.3911 48.1021 52.8874 49.215C53.0115 48.6586 59.8608 26.8919 61.7966 21.2028H76.1904V70.8582C74.4036 69.8687 72.6166 68.8795 70.6809 67.7662C69.3407 67.0863 68.1 66.344 66.7351 65.7875C66.611 56.1409 66.487 46.5561 66.1892 36.5385C64.2535 42.2894 57.5776 62.5721 57.0316 63.1286H48.1225C48.1225 63.1286 39.4613 38.5172 39.0394 37.4042C38.9154 46.8653 38.7913 56.3264 38.4687 66.0968C33.1579 68.8175 30.0063 70.3635 29.0137 70.7344V21.0791H29.1376Z" fill="#19191A"/>
|
|
5462
5464
|
<path d="M52.5124 8.34804C76.8081 8.34804 96.6616 28.136 96.6616 52.4999C96.6616 76.864 76.8825 96.6519 52.5124 96.6519C28.1423 96.6519 8.36325 76.864 8.36325 52.4999C8.36325 28.136 28.1423 8.34804 52.5124 8.34804ZM52.5124 0C23.5016 0 0 23.4983 0 52.4999C0 81.5016 23.5016 105 52.5124 105C81.4984 105 105 81.5016 105 52.4999C105 23.4983 81.4984 0 52.5124 0Z" fill="#19191A"/>
|
|
5463
5465
|
</svg>`;
|
|
5466
|
+
var MONAD_CHAIN_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="105" height="105" viewBox="0 0 105 105" fill="none">
|
|
5467
|
+
<rect width="105" height="105" rx="52.5" fill="#200052"/>
|
|
5468
|
+
<path d="M52.5 19.6875C44.7715 19.6875 22.7227 49.2188 22.7227 52.5C22.7227 55.7812 44.7715 85.3125 52.5 85.3125C60.2285 85.3125 82.2773 55.7812 82.2773 52.5C82.2773 49.2188 60.2285 19.6875 52.5 19.6875ZM48.7559 76.7344C46.4707 76.1426 33.5215 57.4805 33.5215 52.5C33.5215 47.5195 46.4707 28.8574 48.7559 28.2656C51.041 27.6738 51.041 77.3262 48.7559 76.7344ZM56.2441 76.7344C53.959 77.3262 53.959 27.6738 56.2441 28.2656C58.5293 28.8574 71.4785 47.5195 71.4785 52.5C71.4785 57.4805 58.5293 76.1426 56.2441 76.7344Z" fill="white"/>
|
|
5469
|
+
</svg>`;
|
|
5464
5470
|
var USDM_TOKEN_SVG = `<svg xmlns="http://www.w3.org/2000/svg" id="_\u56FE\u5C42_2" data-name="\u56FE\u5C42 2" viewBox="0 0 1068.49 1068.74">
|
|
5465
5471
|
<defs>
|
|
5466
5472
|
<style>
|
|
@@ -5578,8 +5584,9 @@ var BASE_CHAIN_LOGO = svgToDataUri(BASE_CHAIN_SVG);
|
|
|
5578
5584
|
var ARBITRUM_CHAIN_LOGO = svgToDataUri(ARBITRUM_CHAIN_SVG);
|
|
5579
5585
|
var BNB_CHAIN_LOGO = svgToDataUri(BNB_CHAIN_SVG);
|
|
5580
5586
|
var POLYGON_CHAIN_LOGO = svgToDataUri(POLYGON_CHAIN_SVG);
|
|
5581
|
-
var ETHEREUM_CHAIN_LOGO =
|
|
5587
|
+
var ETHEREUM_CHAIN_LOGO = "https://assets.relay.link/icons/1/light.png";
|
|
5582
5588
|
var MEGAETH_CHAIN_LOGO = svgToDataUri(MEGAETH_CHAIN_SVG);
|
|
5589
|
+
var MONAD_CHAIN_LOGO = svgToDataUri(MONAD_CHAIN_SVG);
|
|
5583
5590
|
var USDM_LOGO = svgToDataUri(USDM_TOKEN_SVG);
|
|
5584
5591
|
var METAMASK_LOGO = svgToDataUri(METAMASK_SVG);
|
|
5585
5592
|
var TRUST_WALLET_LOGO = svgToDataUri(TRUST_WALLET_SVG);
|
|
@@ -5612,7 +5619,8 @@ var CHAIN_LOGOS = {
|
|
|
5612
5619
|
"bnb chain": BNB_CHAIN_LOGO,
|
|
5613
5620
|
"bnb smart chain": BNB_CHAIN_LOGO,
|
|
5614
5621
|
bsc: BNB_CHAIN_LOGO,
|
|
5615
|
-
megaeth: MEGAETH_CHAIN_LOGO
|
|
5622
|
+
megaeth: MEGAETH_CHAIN_LOGO,
|
|
5623
|
+
monad: MONAD_CHAIN_LOGO
|
|
5616
5624
|
};
|
|
5617
5625
|
function ScreenLayout({ children, footer }) {
|
|
5618
5626
|
const { tokens, theme } = useBlinkConfig();
|