Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v12.16.7: display wallet connection rejection error #128

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/react-token-image@5"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/coinbase-wallet-sdk@3"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/walletconnect-v2@2"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/worldcoin-precompiled@0"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-wallets@17.5.0"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/worldcoin-precompiled@1"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-wallets@17.6.1"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-assets@7"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-exchanges@13"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-payments@13.12.10"></script>
Expand Down
4 changes: 2 additions & 2 deletions dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/react-token-image@5.1.0"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/coinbase-wallet-sdk@3"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/walletconnect-v2@2.12.2"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/worldcoin-precompiled@0"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-wallets@17.5.0"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/worldcoin-precompiled@1"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-wallets@17.6.1"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-assets@7.4.1"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-exchanges@13.11.0"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-payments@13.12.10"></script>
Expand Down
4 changes: 2 additions & 2 deletions dist/esm/index.bundle.js

Large diffs are not rendered by default.

92 changes: 68 additions & 24 deletions dist/esm/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -22190,20 +22190,25 @@ var ConnectWalletDialog = (function (props) {
_useState14[0];
_useState14[1];

var _useState15 = useState(false),
var _useState15 = useState(),
_useState16 = _slicedToArray(_useState15, 2),
showQRCode = _useState16[0],
setShowQRCode = _useState16[1];
connectionError = _useState16[0],
setConnectionError = _useState16[1];

var _useState17 = useState(false),
_useState18 = _slicedToArray(_useState17, 2),
showLinkCopied = _useState18[0],
setShowLinkCopied = _useState18[1];
showQRCode = _useState18[0],
setShowQRCode = _useState18[1];

var _useState19 = useState(),
var _useState19 = useState(false),
_useState20 = _slicedToArray(_useState19, 2),
QRCode = _useState20[0],
setQRCode = _useState20[1];
showLinkCopied = _useState20[0],
setShowLinkCopied = _useState20[1];

var _useState21 = useState(),
_useState22 = _slicedToArray(_useState21, 2),
QRCode = _useState22[0],
setQRCode = _useState22[1];

var _useContext = useContext(NavigateStackContext);
_useContext.navigate;
Expand All @@ -22224,8 +22229,17 @@ var ConnectWalletDialog = (function (props) {
src: props.wallet.logo
})))));

var handleConnectionError = function handleConnectionError(error) {
if (typeof error == 'string') {
setConnectionError(error);
} else {
setConnectionError();
}
};

var connectViaCopyLink = function connectViaCopyLink() {
var wallet = new wallets[props.platform.copyLink]();
setConnectionError();
wallet.connect({
name: props.wallet.name,
logo: props.wallet.logo,
Expand All @@ -22239,8 +22253,9 @@ var ConnectWalletDialog = (function (props) {
}, 3000);
}
}).then(function (account) {
setConnectionError();
props.resolve(account, wallet);
});
})["catch"](handleConnectionError);
};

var getNewQRCode = function getNewQRCode() {
Expand Down Expand Up @@ -22286,6 +22301,8 @@ var ConnectWalletDialog = (function (props) {

var _wallet = new wallets[props.platform.qr]();

setConnectionError();

_wallet.connect({
name: props.wallet.name,
logo: props.wallet.logo,
Expand All @@ -22299,14 +22316,16 @@ var ConnectWalletDialog = (function (props) {
setQRCode(newQRCode);
}
}).then(function (account) {
setConnectionError();
props.resolve(account, _wallet);
});
})["catch"](handleConnectionError);
}

break;

case 'WalletLink':
var wallet = new wallets[props.platform.qr]();
setConnectionError();
wallet.connect({
connect: function connect(_ref3) {
var uri = _ref3.uri;
Expand All @@ -22317,8 +22336,9 @@ var ConnectWalletDialog = (function (props) {
setQRCode(newQRCode);
}
}).then(function (account) {
setConnectionError();
props.resolve(account, wallet);
});
})["catch"](handleConnectionError);
break;
}
}, 100), []);
Expand Down Expand Up @@ -22478,10 +22498,14 @@ var ConnectWalletDialog = (function (props) {
}, /*#__PURE__*/React.createElement("div", {
className: "Alert FontSizeS"
}, /*#__PURE__*/React.createElement("strong", null, "Most wallets do not connect to http!"))), !extensionIsAvailable && !connectAppIsAvailable && !openInAppIsAvailable && !copyLinkIsAvailable && !scanQrAvailable && /*#__PURE__*/React.createElement("div", {
className: "PaddingTopS PaddingBottomS PaddingLeftL PaddingRightL"
className: "PaddingTopS PaddingLeftL PaddingRightL"
}, /*#__PURE__*/React.createElement("div", {
className: "Alert FontSizeS"
}, /*#__PURE__*/React.createElement("strong", null, "Unable to connect to this wallet!"))), showQRCode && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
}, /*#__PURE__*/React.createElement("strong", null, "Unable to connect to this wallet!"))), (props.connectionError || connectionError) && /*#__PURE__*/React.createElement("div", {
className: "PaddingTopS PaddingLeftL PaddingRightL"
}, /*#__PURE__*/React.createElement("div", {
className: "Alert FontSizeS"
}, /*#__PURE__*/React.createElement("strong", null, props.connectionError || connectionError))), showQRCode && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
ref: QRCodeElement,
className: "QRCode"
}, showQRCode && QRCode === undefined && /*#__PURE__*/React.createElement("div", {
Expand Down Expand Up @@ -23447,17 +23471,22 @@ var ConnectStack = (function (props) {
redirectUri = _useState12[0],
setRedirectUri = _useState12[1];

var _useState13 = useState({
blockchain: undefined
}),
var _useState13 = useState(),
_useState14 = _slicedToArray(_useState13, 2),
selection = _useState14[0];
_useState14[1];
connectionError = _useState14[0],
setConnectionError = _useState14[1];

var _useState15 = useState(false),
var _useState15 = useState({
blockchain: undefined
}),
_useState16 = _slicedToArray(_useState15, 2),
showConnectExtensionWarning = _useState16[0],
setShowConnectExtensionWarning = _useState16[1];
selection = _useState16[0];
_useState16[1];

var _useState17 = useState(false),
_useState18 = _slicedToArray(_useState17, 2),
showConnectExtensionWarning = _useState18[0],
setShowConnectExtensionWarning = _useState18[1];

var resolve = function resolve(account, wallet) {
if (account && wallet) {
Expand Down Expand Up @@ -23515,6 +23544,8 @@ var ConnectStack = (function (props) {
if ((error === null || error === void 0 ? void 0 : error.code) == -32002) {
// Request of type 'wallet_requestPermissions' already pending...
setShowConnectExtensionWarning(true);
} else if (typeof error === 'string') {
setConnectionError(error);
}
});
};
Expand Down Expand Up @@ -23622,6 +23653,8 @@ var ConnectStack = (function (props) {
});
}

setConnectionError();

_wallet.connect({
name: walletMetaData.name,
logo: walletMetaData.logo,
Expand All @@ -23638,20 +23671,30 @@ var ConnectStack = (function (props) {
}).then(function (account) {
setConnectingApp(false);
resolve(account, _wallet);
})["catch"](function () {
})["catch"](function (error) {
setConnectingApp(false);

if (typeof error === 'string') {
setConnectionError(error);
}
});
} else if (platform.connect === 'SolanaMobileWalletAdapter') {
var _wallet2 = new wallets[platform.connect]();

setConnectionError();

_wallet2.connect({
name: walletMetaData.name,
logo: walletMetaData.logo
}).then(function (account) {
setConnectingApp(false);
resolve(account, _wallet2);
})["catch"](function () {
})["catch"](function (error) {
setConnectingApp(false);

if (typeof error === 'string') {
setConnectionError(error);
}
});
}
};
Expand Down Expand Up @@ -23719,7 +23762,8 @@ var ConnectStack = (function (props) {
connectingExtension: connectingExtension,
connectingApp: connectingApp,
showConnectExtensionWarning: showConnectExtensionWarning,
continueWithSolanaPay: props.continueWithSolanaPay
continueWithSolanaPay: props.continueWithSolanaPay,
connectionError: connectionError
})
}
}), /*#__PURE__*/React.createElement(PoweredBy, null));
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.evm.js.map

Large diffs are not rendered by default.

Loading
Loading