@turnkey/react-wallet-kit 2.7.1 → 2.8.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.
- package/dist/_virtual/_rollupPluginBabelHelpers.mjs +10 -1
- package/dist/_virtual/_rollupPluginBabelHelpers.mjs.map +1 -1
- package/dist/components/auth/Action.d.ts +1 -0
- package/dist/components/auth/Action.d.ts.map +1 -1
- package/dist/components/auth/Action.js +10 -3
- package/dist/components/auth/Action.js.map +1 -1
- package/dist/components/auth/Action.mjs +10 -3
- package/dist/components/auth/Action.mjs.map +1 -1
- package/dist/components/auth/wallet/DesktopWalletConnectScreen.d.ts +2 -0
- package/dist/components/auth/wallet/DesktopWalletConnectScreen.d.ts.map +1 -1
- package/dist/components/auth/wallet/DesktopWalletConnectScreen.js +7 -4
- package/dist/components/auth/wallet/DesktopWalletConnectScreen.js.map +1 -1
- package/dist/components/auth/wallet/DesktopWalletConnectScreen.mjs +22 -12
- package/dist/components/auth/wallet/DesktopWalletConnectScreen.mjs.map +1 -1
- package/dist/components/auth/wallet/ExternalWalletChainSelector.d.ts.map +1 -1
- package/dist/components/auth/wallet/ExternalWalletChainSelector.js +2 -1
- package/dist/components/auth/wallet/ExternalWalletChainSelector.js.map +1 -1
- package/dist/components/auth/wallet/ExternalWalletChainSelector.mjs +2 -2
- package/dist/components/auth/wallet/ExternalWalletChainSelector.mjs.map +1 -1
- package/dist/components/auth/wallet/MobileWalletConnectScreen.d.ts +1 -0
- package/dist/components/auth/wallet/MobileWalletConnectScreen.d.ts.map +1 -1
- package/dist/components/auth/wallet/MobileWalletConnectScreen.js +3 -1
- package/dist/components/auth/wallet/MobileWalletConnectScreen.js.map +1 -1
- package/dist/components/auth/wallet/MobileWalletConnectScreen.mjs +16 -8
- package/dist/components/auth/wallet/MobileWalletConnectScreen.mjs.map +1 -1
- package/dist/components/auth/wallet/ShowAllWalletsScreen.d.ts +2 -1
- package/dist/components/auth/wallet/ShowAllWalletsScreen.d.ts.map +1 -1
- package/dist/components/auth/wallet/ShowAllWalletsScreen.js +8 -3
- package/dist/components/auth/wallet/ShowAllWalletsScreen.js.map +1 -1
- package/dist/components/auth/wallet/ShowAllWalletsScreen.mjs +8 -3
- package/dist/components/auth/wallet/ShowAllWalletsScreen.mjs.map +1 -1
- package/dist/components/design/Success.d.ts +1 -1
- package/dist/components/design/Success.d.ts.map +1 -1
- package/dist/components/design/Success.js +2 -2
- package/dist/components/design/Success.js.map +1 -1
- package/dist/components/design/Success.mjs +2 -2
- package/dist/components/design/Success.mjs.map +1 -1
- package/dist/components/design/Svg.d.ts +1 -0
- package/dist/components/design/Svg.d.ts.map +1 -1
- package/dist/components/design/Svg.js +32 -12
- package/dist/components/design/Svg.js.map +1 -1
- package/dist/components/design/Svg.mjs +32 -13
- package/dist/components/design/Svg.mjs.map +1 -1
- package/dist/components/design/TabNav.d.ts +13 -0
- package/dist/components/design/TabNav.d.ts.map +1 -0
- package/dist/components/design/TabNav.js +64 -0
- package/dist/components/design/TabNav.js.map +1 -0
- package/dist/components/design/TabNav.mjs +81 -0
- package/dist/components/design/TabNav.mjs.map +1 -0
- package/dist/components/funding/CryptoAmountInput.d.ts +11 -0
- package/dist/components/funding/CryptoAmountInput.d.ts.map +1 -0
- package/dist/components/funding/CryptoAmountInput.js +82 -0
- package/dist/components/funding/CryptoAmountInput.js.map +1 -0
- package/dist/components/funding/CryptoAmountInput.mjs +87 -0
- package/dist/components/funding/CryptoAmountInput.mjs.map +1 -0
- package/dist/components/funding/CurrencyDropdown.d.ts +8 -0
- package/dist/components/funding/CurrencyDropdown.d.ts.map +1 -0
- package/dist/components/funding/CurrencyDropdown.js +132 -0
- package/dist/components/funding/CurrencyDropdown.js.map +1 -0
- package/dist/components/funding/CurrencyDropdown.mjs +132 -0
- package/dist/components/funding/CurrencyDropdown.mjs.map +1 -0
- package/dist/components/funding/FiatAmountInput.d.ts +11 -0
- package/dist/components/funding/FiatAmountInput.d.ts.map +1 -0
- package/dist/components/funding/FiatAmountInput.js +94 -0
- package/dist/components/funding/FiatAmountInput.js.map +1 -0
- package/dist/components/funding/FiatAmountInput.mjs +105 -0
- package/dist/components/funding/FiatAmountInput.mjs.map +1 -0
- package/dist/components/funding/OffRamp.d.ts +3 -0
- package/dist/components/funding/OffRamp.d.ts.map +1 -0
- package/dist/components/funding/OffRamp.js +31 -0
- package/dist/components/funding/OffRamp.js.map +1 -0
- package/dist/components/funding/OffRamp.mjs +30 -0
- package/dist/components/funding/OffRamp.mjs.map +1 -0
- package/dist/components/funding/OffRampAmount.d.ts +22 -0
- package/dist/components/funding/OffRampAmount.d.ts.map +1 -0
- package/dist/components/funding/OffRampAmount.js +304 -0
- package/dist/components/funding/OffRampAmount.js.map +1 -0
- package/dist/components/funding/OffRampAmount.mjs +376 -0
- package/dist/components/funding/OffRampAmount.mjs.map +1 -0
- package/dist/components/funding/OffRampDeposit.d.ts +22 -0
- package/dist/components/funding/OffRampDeposit.d.ts.map +1 -0
- package/dist/components/funding/OffRampDeposit.js +455 -0
- package/dist/components/funding/OffRampDeposit.js.map +1 -0
- package/dist/components/funding/OffRampDeposit.mjs +551 -0
- package/dist/components/funding/OffRampDeposit.mjs.map +1 -0
- package/dist/components/funding/OffRampReturn.d.ts +2 -0
- package/dist/components/funding/OffRampReturn.d.ts.map +1 -0
- package/dist/components/funding/OffRampReturn.js +144 -0
- package/dist/components/funding/OffRampReturn.js.map +1 -0
- package/dist/components/funding/OffRampReturn.mjs +146 -0
- package/dist/components/funding/OffRampReturn.mjs.map +1 -0
- package/dist/components/funding/OnRamp.d.ts +7 -0
- package/dist/components/funding/OnRamp.d.ts.map +1 -0
- package/dist/components/funding/OnRamp.js +64 -0
- package/dist/components/funding/OnRamp.js.map +1 -0
- package/dist/components/funding/OnRamp.mjs +58 -0
- package/dist/components/funding/OnRamp.mjs.map +1 -0
- package/dist/components/funding/OnRampAmount.d.ts +21 -0
- package/dist/components/funding/OnRampAmount.d.ts.map +1 -0
- package/dist/components/funding/OnRampAmount.js +229 -0
- package/dist/components/funding/OnRampAmount.js.map +1 -0
- package/dist/components/funding/OnRampAmount.mjs +312 -0
- package/dist/components/funding/OnRampAmount.mjs.map +1 -0
- package/dist/components/funding/OnRampCash.d.ts +3 -0
- package/dist/components/funding/OnRampCash.d.ts.map +1 -0
- package/dist/components/funding/OnRampCash.js +26 -0
- package/dist/components/funding/OnRampCash.js.map +1 -0
- package/dist/components/funding/OnRampCash.mjs +25 -0
- package/dist/components/funding/OnRampCash.mjs.map +1 -0
- package/dist/components/funding/OnRampCrypto.d.ts +11 -0
- package/dist/components/funding/OnRampCrypto.d.ts.map +1 -0
- package/dist/components/funding/OnRampCrypto.js +126 -0
- package/dist/components/funding/OnRampCrypto.js.map +1 -0
- package/dist/components/funding/OnRampCrypto.mjs +148 -0
- package/dist/components/funding/OnRampCrypto.mjs.map +1 -0
- package/dist/components/funding/OnRampCryptoSend.d.ts +15 -0
- package/dist/components/funding/OnRampCryptoSend.d.ts.map +1 -0
- package/dist/components/funding/OnRampCryptoSend.js +251 -0
- package/dist/components/funding/OnRampCryptoSend.js.map +1 -0
- package/dist/components/funding/OnRampCryptoSend.mjs +323 -0
- package/dist/components/funding/OnRampCryptoSend.mjs.map +1 -0
- package/dist/components/funding/OnRampCryptoStatus.d.ts +14 -0
- package/dist/components/funding/OnRampCryptoStatus.d.ts.map +1 -0
- package/dist/components/funding/OnRampCryptoStatus.js +153 -0
- package/dist/components/funding/OnRampCryptoStatus.js.map +1 -0
- package/dist/components/funding/OnRampCryptoStatus.mjs +272 -0
- package/dist/components/funding/OnRampCryptoStatus.mjs.map +1 -0
- package/dist/components/funding/OnRampExternalAccountSelector.d.ts +11 -0
- package/dist/components/funding/OnRampExternalAccountSelector.d.ts.map +1 -0
- package/dist/components/funding/OnRampExternalAccountSelector.js +95 -0
- package/dist/components/funding/OnRampExternalAccountSelector.js.map +1 -0
- package/dist/components/funding/OnRampExternalAccountSelector.mjs +109 -0
- package/dist/components/funding/OnRampExternalAccountSelector.mjs.map +1 -0
- package/dist/components/funding/OnRampExternalWallet.d.ts +12 -0
- package/dist/components/funding/OnRampExternalWallet.d.ts.map +1 -0
- package/dist/components/funding/OnRampExternalWallet.js +218 -0
- package/dist/components/funding/OnRampExternalWallet.js.map +1 -0
- package/dist/components/funding/OnRampExternalWallet.mjs +303 -0
- package/dist/components/funding/OnRampExternalWallet.mjs.map +1 -0
- package/dist/components/funding/OnRampStatus.d.ts +15 -0
- package/dist/components/funding/OnRampStatus.d.ts.map +1 -0
- package/dist/components/funding/OnRampStatus.js +114 -0
- package/dist/components/funding/OnRampStatus.js.map +1 -0
- package/dist/components/funding/OnRampStatus.mjs +166 -0
- package/dist/components/funding/OnRampStatus.mjs.map +1 -0
- package/dist/components/funding/PaymentMethods.d.ts +35 -0
- package/dist/components/funding/PaymentMethods.d.ts.map +1 -0
- package/dist/components/funding/PaymentMethods.js +173 -0
- package/dist/components/funding/PaymentMethods.js.map +1 -0
- package/dist/components/funding/PaymentMethods.mjs +180 -0
- package/dist/components/funding/PaymentMethods.mjs.map +1 -0
- package/dist/components/funding/QuoteDetails.d.ts +13 -0
- package/dist/components/funding/QuoteDetails.d.ts.map +1 -0
- package/dist/components/funding/QuoteDetails.js +124 -0
- package/dist/components/funding/QuoteDetails.js.map +1 -0
- package/dist/components/funding/QuoteDetails.mjs +121 -0
- package/dist/components/funding/QuoteDetails.mjs.map +1 -0
- package/dist/components/funding/QuoteOption.d.ts +23 -0
- package/dist/components/funding/QuoteOption.d.ts.map +1 -0
- package/dist/components/funding/QuoteOption.js +153 -0
- package/dist/components/funding/QuoteOption.js.map +1 -0
- package/dist/components/funding/QuoteOption.mjs +150 -0
- package/dist/components/funding/QuoteOption.mjs.map +1 -0
- package/dist/components/funding/QuotePicker.d.ts +13 -0
- package/dist/components/funding/QuotePicker.d.ts.map +1 -0
- package/dist/components/funding/QuotePicker.js +49 -0
- package/dist/components/funding/QuotePicker.js.map +1 -0
- package/dist/components/funding/QuotePicker.mjs +48 -0
- package/dist/components/funding/QuotePicker.mjs.map +1 -0
- package/dist/components/funding/TokenSelect.d.ts +18 -0
- package/dist/components/funding/TokenSelect.d.ts.map +1 -0
- package/dist/components/funding/TokenSelect.js +198 -0
- package/dist/components/funding/TokenSelect.js.map +1 -0
- package/dist/components/funding/TokenSelect.mjs +210 -0
- package/dist/components/funding/TokenSelect.mjs.map +1 -0
- package/dist/components/funding/offRampRedirect.d.ts +61 -0
- package/dist/components/funding/offRampRedirect.d.ts.map +1 -0
- package/dist/components/funding/offRampRedirect.js +282 -0
- package/dist/components/funding/offRampRedirect.js.map +1 -0
- package/dist/components/funding/offRampRedirect.mjs +274 -0
- package/dist/components/funding/offRampRedirect.mjs.map +1 -0
- package/dist/components/send-transaction/SendTransaction.d.ts.map +1 -1
- package/dist/components/send-transaction/SendTransaction.js +8 -6
- package/dist/components/send-transaction/SendTransaction.js.map +1 -1
- package/dist/components/send-transaction/SendTransaction.mjs +8 -6
- package/dist/components/send-transaction/SendTransaction.mjs.map +1 -1
- package/dist/components/send-transaction/helpers.d.ts.map +1 -1
- package/dist/components/send-transaction/helpers.js +4 -0
- package/dist/components/send-transaction/helpers.js.map +1 -1
- package/dist/components/send-transaction/helpers.mjs +4 -0
- package/dist/components/send-transaction/helpers.mjs.map +1 -1
- package/dist/components/sign/Message.d.ts.map +1 -1
- package/dist/components/sign/Message.js +2 -1
- package/dist/components/sign/Message.js.map +1 -1
- package/dist/components/sign/Message.mjs +2 -2
- package/dist/components/sign/Message.mjs.map +1 -1
- package/dist/providers/SupportedAssetsProvider.d.ts +18 -0
- package/dist/providers/SupportedAssetsProvider.d.ts.map +1 -0
- package/dist/providers/SupportedAssetsProvider.js +71 -0
- package/dist/providers/SupportedAssetsProvider.js.map +1 -0
- package/dist/providers/SupportedAssetsProvider.mjs +114 -0
- package/dist/providers/SupportedAssetsProvider.mjs.map +1 -0
- package/dist/providers/TurnkeyProvider.d.ts.map +1 -1
- package/dist/providers/TurnkeyProvider.js +2 -1
- package/dist/providers/TurnkeyProvider.js.map +1 -1
- package/dist/providers/TurnkeyProvider.mjs +2 -1
- package/dist/providers/TurnkeyProvider.mjs.map +1 -1
- package/dist/providers/client/Provider.d.ts.map +1 -1
- package/dist/providers/client/Provider.js +98 -153
- package/dist/providers/client/Provider.js.map +1 -1
- package/dist/providers/client/Provider.mjs +214 -328
- package/dist/providers/client/Provider.mjs.map +1 -1
- package/dist/providers/client/Types.d.ts +37 -12
- package/dist/providers/client/Types.d.ts.map +1 -1
- package/dist/providers/client/Types.js.map +1 -1
- package/dist/providers/client/Types.mjs.map +1 -1
- package/dist/providers/modal/Provider.d.ts +1 -0
- package/dist/providers/modal/Provider.d.ts.map +1 -1
- package/dist/providers/modal/Provider.js +12 -0
- package/dist/providers/modal/Provider.js.map +1 -1
- package/dist/providers/modal/Provider.mjs +15 -0
- package/dist/providers/modal/Provider.mjs.map +1 -1
- package/dist/providers/modal/Root.d.ts.map +1 -1
- package/dist/providers/modal/Root.js +16 -14
- package/dist/providers/modal/Root.js.map +1 -1
- package/dist/providers/modal/Root.mjs +16 -14
- package/dist/providers/modal/Root.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/method-types.d.ts +21 -9
- package/dist/types/method-types.d.ts.map +1 -1
- package/dist/utils/funding/buildCryptoTransfer.d.ts +41 -0
- package/dist/utils/funding/buildCryptoTransfer.d.ts.map +1 -0
- package/dist/utils/funding/buildCryptoTransfer.js +134 -0
- package/dist/utils/funding/buildCryptoTransfer.js.map +1 -0
- package/dist/utils/funding/buildCryptoTransfer.mjs +128 -0
- package/dist/utils/funding/buildCryptoTransfer.mjs.map +1 -0
- package/dist/utils/funding/chainLabel.d.ts +2 -0
- package/dist/utils/funding/chainLabel.d.ts.map +1 -0
- package/dist/utils/funding/chainLabel.js +19 -0
- package/dist/utils/funding/chainLabel.js.map +1 -0
- package/dist/utils/funding/chainLabel.mjs +18 -0
- package/dist/utils/funding/chainLabel.mjs.map +1 -0
- package/dist/utils/funding/depositPlan.d.ts +28 -0
- package/dist/utils/funding/depositPlan.d.ts.map +1 -0
- package/dist/utils/funding/depositPlan.js +127 -0
- package/dist/utils/funding/depositPlan.js.map +1 -0
- package/dist/utils/funding/depositPlan.mjs +120 -0
- package/dist/utils/funding/depositPlan.mjs.map +1 -0
- package/dist/utils/funding/index.d.ts +8 -0
- package/dist/utils/funding/index.d.ts.map +1 -0
- package/dist/utils/funding/onRampTokens.d.ts +6 -0
- package/dist/utils/funding/onRampTokens.d.ts.map +1 -0
- package/dist/utils/funding/onRampTokens.js +21 -0
- package/dist/utils/funding/onRampTokens.js.map +1 -0
- package/dist/utils/funding/onRampTokens.mjs +26 -0
- package/dist/utils/funding/onRampTokens.mjs.map +1 -0
- package/dist/utils/funding/rankQuotes.d.ts +7 -0
- package/dist/utils/funding/rankQuotes.d.ts.map +1 -0
- package/dist/utils/funding/rankQuotes.js +37 -0
- package/dist/utils/funding/rankQuotes.js.map +1 -0
- package/dist/utils/funding/rankQuotes.mjs +50 -0
- package/dist/utils/funding/rankQuotes.mjs.map +1 -0
- package/dist/utils/funding/sendCryptoTransfer.d.ts +26 -0
- package/dist/utils/funding/sendCryptoTransfer.d.ts.map +1 -0
- package/dist/utils/funding/sendCryptoTransfer.js +281 -0
- package/dist/utils/funding/sendCryptoTransfer.js.map +1 -0
- package/dist/utils/funding/sendCryptoTransfer.mjs +405 -0
- package/dist/utils/funding/sendCryptoTransfer.mjs.map +1 -0
- package/dist/utils/funding/tokenSymbol.d.ts +7 -0
- package/dist/utils/funding/tokenSymbol.d.ts.map +1 -0
- package/dist/utils/funding/tokenSymbol.js +32 -0
- package/dist/utils/funding/tokenSymbol.js.map +1 -0
- package/dist/utils/funding/tokenSymbol.mjs +31 -0
- package/dist/utils/funding/tokenSymbol.mjs.map +1 -0
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +5 -0
- package/dist/utils/utils.js.map +1 -1
- package/dist/utils/utils.mjs +7 -1
- package/dist/utils/utils.mjs.map +1 -1
- package/package.json +7 -3
- package/dist/components/onramp/OnRamp.d.ts +0 -14
- package/dist/components/onramp/OnRamp.d.ts.map +0 -1
- package/dist/components/onramp/OnRamp.js +0 -61
- package/dist/components/onramp/OnRamp.js.map +0 -1
- package/dist/components/onramp/OnRamp.mjs +0 -79
- package/dist/components/onramp/OnRamp.mjs.map +0 -1
|
@@ -13,7 +13,7 @@ import { useWalletProviderState, useDebouncedCallback, isValidSession, withTurnk
|
|
|
13
13
|
import { clearKeys, clearAll, setCappedTimeoutInMap, clearKey, setTimeoutInMap } from '../../utils/timers.mjs';
|
|
14
14
|
import { resetPasskeyScope, DEFAULT_SESSION_EXPIRATION_IN_SECONDS, OtpType, applyPasskeyScope, TurnkeyClient, Chain, WalletInterfaceType, getAuthProxyConfig, getClientParams, WalletSource, buildSecondaryOauthProviders, buildSecondaryOidcClaims } from '@turnkey/core';
|
|
15
15
|
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
16
|
-
import { TurnkeyError, TurnkeyErrorCodes, TurnkeyNetworkError, AuthAction, OAuthProviders
|
|
16
|
+
import { TurnkeyError, TurnkeyErrorCodes, TurnkeyNetworkError, AuthAction, OAuthProviders } from '@turnkey/sdk-types';
|
|
17
17
|
import { useModal } from '../modal/Hook.mjs';
|
|
18
18
|
import { AuthState, ClientState, AuthMethod, ExportType, ImportType } from '../../types/base.mjs';
|
|
19
19
|
import { AuthComponent } from '../../components/auth/index.mjs';
|
|
@@ -35,8 +35,8 @@ import { OtpVerification } from '../../components/auth/OTP.mjs';
|
|
|
35
35
|
import { RemoveEmail } from '../../components/user/RemoveEmail.mjs';
|
|
36
36
|
import { RemovePhoneNumber } from '../../components/user/RemovePhoneNumber.mjs';
|
|
37
37
|
import { VerifyPage } from '../../components/verify/Verify.mjs';
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
38
|
+
import { OffRampPage } from '../../components/funding/OffRamp.mjs';
|
|
39
|
+
import { OnRampProviders, OnRampPage } from '../../components/funding/OnRamp.mjs';
|
|
40
40
|
import { SendTransactionPage } from '../../components/send-transaction/SendTransaction.mjs';
|
|
41
41
|
import { getChainLogo } from '../../components/send-transaction/helpers.mjs';
|
|
42
42
|
import { Turnstile } from '../../components/auth/Turnstile.mjs';
|
|
@@ -945,11 +945,11 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
945
945
|
* @throws {TurnkeyError} If an error occurs while clearing the timers.
|
|
946
946
|
*/
|
|
947
947
|
function _initializeWalletProviderListeners() {
|
|
948
|
-
_initializeWalletProviderListeners = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
948
|
+
_initializeWalletProviderListeners = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee148(walletProviders, onUpdateState) {
|
|
949
949
|
var _masterConfig$walletC12, _masterConfig$walletC13, _masterConfig$walletC14, _masterConfig$walletC15;
|
|
950
950
|
var cleanups, nativeOnly, ethProviders, solProviders, wcProviders, wcProvider, attachEthereumListeners, attachSolanaListeners, _wcProvider$provider, _wcProvider$provider$, standardEvents, unsubscribe;
|
|
951
|
-
return _regenerator().w(function (
|
|
952
|
-
while (1) switch (
|
|
951
|
+
return _regenerator().w(function (_context148) {
|
|
952
|
+
while (1) switch (_context148.n) {
|
|
953
953
|
case 0:
|
|
954
954
|
attachSolanaListeners = function _attachSolanaListener(provider, onUpdateState) {
|
|
955
955
|
var _provider$features;
|
|
@@ -957,19 +957,19 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
957
957
|
var walletEvents = provider === null || provider === void 0 ? void 0 : (_provider$features = provider.features) === null || _provider$features === void 0 ? void 0 : _provider$features["standard:events"];
|
|
958
958
|
if (walletEvents !== null && walletEvents !== void 0 && walletEvents.on) {
|
|
959
959
|
var offChange = walletEvents.on("change", /*#__PURE__*/function () {
|
|
960
|
-
var
|
|
961
|
-
return _regenerator().w(function (
|
|
962
|
-
while (1) switch (
|
|
960
|
+
var _ref178 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee146(_evt) {
|
|
961
|
+
return _regenerator().w(function (_context146) {
|
|
962
|
+
while (1) switch (_context146.n) {
|
|
963
963
|
case 0:
|
|
964
|
-
|
|
964
|
+
_context146.n = 1;
|
|
965
965
|
return onUpdateState();
|
|
966
966
|
case 1:
|
|
967
|
-
return
|
|
967
|
+
return _context146.a(2);
|
|
968
968
|
}
|
|
969
|
-
},
|
|
969
|
+
}, _callee146);
|
|
970
970
|
}));
|
|
971
|
-
return function (
|
|
972
|
-
return
|
|
971
|
+
return function (_x121) {
|
|
972
|
+
return _ref178.apply(this, arguments);
|
|
973
973
|
};
|
|
974
974
|
}());
|
|
975
975
|
cleanups.push(offChange);
|
|
@@ -983,31 +983,31 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
983
983
|
attachEthereumListeners = function _attachEthereumListen(provider, onUpdateState) {
|
|
984
984
|
if (typeof provider.on !== "function") return;
|
|
985
985
|
var handleChainChanged = /*#__PURE__*/function () {
|
|
986
|
-
var
|
|
987
|
-
return _regenerator().w(function (
|
|
988
|
-
while (1) switch (
|
|
986
|
+
var _ref176 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee144(_chainId) {
|
|
987
|
+
return _regenerator().w(function (_context144) {
|
|
988
|
+
while (1) switch (_context144.n) {
|
|
989
989
|
case 0:
|
|
990
|
-
return
|
|
990
|
+
return _context144.a(2, onUpdateState());
|
|
991
991
|
}
|
|
992
|
-
},
|
|
992
|
+
}, _callee144);
|
|
993
993
|
}));
|
|
994
|
-
return function handleChainChanged(
|
|
995
|
-
return
|
|
994
|
+
return function handleChainChanged(_x119) {
|
|
995
|
+
return _ref176.apply(this, arguments);
|
|
996
996
|
};
|
|
997
997
|
}();
|
|
998
998
|
var handleAccountsChanged = /*#__PURE__*/function () {
|
|
999
|
-
var
|
|
1000
|
-
return _regenerator().w(function (
|
|
1001
|
-
while (1) switch (
|
|
999
|
+
var _ref177 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee145(accounts) {
|
|
1000
|
+
return _regenerator().w(function (_context145) {
|
|
1001
|
+
while (1) switch (_context145.n) {
|
|
1002
1002
|
case 0:
|
|
1003
1003
|
if (accounts.length === 0) onUpdateState();
|
|
1004
1004
|
case 1:
|
|
1005
|
-
return
|
|
1005
|
+
return _context145.a(2);
|
|
1006
1006
|
}
|
|
1007
|
-
},
|
|
1007
|
+
}, _callee145);
|
|
1008
1008
|
}));
|
|
1009
|
-
return function handleAccountsChanged(
|
|
1010
|
-
return
|
|
1009
|
+
return function handleAccountsChanged(_x120) {
|
|
1010
|
+
return _ref177.apply(this, arguments);
|
|
1011
1011
|
};
|
|
1012
1012
|
}();
|
|
1013
1013
|
var handleDisconnect = function handleDisconnect() {
|
|
@@ -1023,10 +1023,10 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
1023
1023
|
};
|
|
1024
1024
|
};
|
|
1025
1025
|
if (!(walletProviders.length === 0)) {
|
|
1026
|
-
|
|
1026
|
+
_context148.n = 1;
|
|
1027
1027
|
break;
|
|
1028
1028
|
}
|
|
1029
|
-
return
|
|
1029
|
+
return _context148.a(2, function () {});
|
|
1030
1030
|
case 1:
|
|
1031
1031
|
cleanups = []; // we only want to initialize these listeners for connected walletProviders
|
|
1032
1032
|
nativeOnly = function nativeOnly(provider) {
|
|
@@ -1064,82 +1064,82 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
1064
1064
|
if (standardEvents !== null && standardEvents !== void 0 && standardEvents.on) {
|
|
1065
1065
|
if (standardEvents !== null && standardEvents !== void 0 && standardEvents.on) {
|
|
1066
1066
|
unsubscribe = standardEvents.on("change", /*#__PURE__*/function () {
|
|
1067
|
-
var
|
|
1067
|
+
var _ref179 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee147(evt) {
|
|
1068
1068
|
var _callbacks$onError12, providers, currentSession, _wcProviders, wcWallets;
|
|
1069
|
-
return _regenerator().w(function (
|
|
1070
|
-
while (1) switch (
|
|
1069
|
+
return _regenerator().w(function (_context147) {
|
|
1070
|
+
while (1) switch (_context147.n) {
|
|
1071
1071
|
case 0:
|
|
1072
1072
|
if (!((evt === null || evt === void 0 ? void 0 : evt.type) === "proposalExpired")) {
|
|
1073
|
-
|
|
1073
|
+
_context147.n = 1;
|
|
1074
1074
|
break;
|
|
1075
1075
|
}
|
|
1076
1076
|
debouncedFetchWalletProviders();
|
|
1077
|
-
return
|
|
1077
|
+
return _context147.a(2);
|
|
1078
1078
|
case 1:
|
|
1079
1079
|
if (!((evt === null || evt === void 0 ? void 0 : evt.type) === "failed")) {
|
|
1080
|
-
|
|
1080
|
+
_context147.n = 2;
|
|
1081
1081
|
break;
|
|
1082
1082
|
}
|
|
1083
1083
|
debouncedFetchWalletProviders();
|
|
1084
1084
|
callbacks === null || callbacks === void 0 ? void 0 : (_callbacks$onError12 = callbacks.onError) === null || _callbacks$onError12 === void 0 ? void 0 : _callbacks$onError12.call(callbacks, new TurnkeyError("WalletConnect initialization failed: ".concat(evt.error || "Unknown error"), TurnkeyErrorCodes.WALLET_CONNECT_INITIALIZATION_ERROR, evt.error));
|
|
1085
|
-
return
|
|
1085
|
+
return _context147.a(2);
|
|
1086
1086
|
case 2:
|
|
1087
1087
|
if (!((evt === null || evt === void 0 ? void 0 : evt.type) === "initialized")) {
|
|
1088
|
-
|
|
1088
|
+
_context147.n = 7;
|
|
1089
1089
|
break;
|
|
1090
1090
|
}
|
|
1091
|
-
|
|
1091
|
+
_context147.n = 3;
|
|
1092
1092
|
return fetchWalletProviders();
|
|
1093
1093
|
case 3:
|
|
1094
|
-
providers =
|
|
1095
|
-
|
|
1094
|
+
providers = _context147.v;
|
|
1095
|
+
_context147.n = 4;
|
|
1096
1096
|
return getSession();
|
|
1097
1097
|
case 4:
|
|
1098
|
-
currentSession =
|
|
1098
|
+
currentSession = _context147.v;
|
|
1099
1099
|
if (!currentSession) {
|
|
1100
|
-
|
|
1100
|
+
_context147.n = 6;
|
|
1101
1101
|
break;
|
|
1102
1102
|
}
|
|
1103
1103
|
_wcProviders = providers === null || providers === void 0 ? void 0 : providers.filter(function (p) {
|
|
1104
1104
|
return p.interfaceType === WalletInterfaceType.WalletConnect;
|
|
1105
1105
|
});
|
|
1106
|
-
|
|
1106
|
+
_context147.n = 5;
|
|
1107
1107
|
return fetchWallets({
|
|
1108
1108
|
walletProviders: _wcProviders,
|
|
1109
1109
|
connectedOnly: true
|
|
1110
1110
|
});
|
|
1111
1111
|
case 5:
|
|
1112
|
-
wcWallets =
|
|
1112
|
+
wcWallets = _context147.v;
|
|
1113
1113
|
if (wcWallets.length > 0) {
|
|
1114
1114
|
setWallets(function (prev) {
|
|
1115
1115
|
return mergeWalletsWithoutDuplicates(prev, wcWallets);
|
|
1116
1116
|
});
|
|
1117
1117
|
}
|
|
1118
1118
|
case 6:
|
|
1119
|
-
return
|
|
1119
|
+
return _context147.a(2);
|
|
1120
1120
|
case 7:
|
|
1121
|
-
|
|
1121
|
+
_context147.n = 8;
|
|
1122
1122
|
return onUpdateState();
|
|
1123
1123
|
case 8:
|
|
1124
|
-
return
|
|
1124
|
+
return _context147.a(2);
|
|
1125
1125
|
}
|
|
1126
|
-
},
|
|
1126
|
+
}, _callee147);
|
|
1127
1127
|
}));
|
|
1128
|
-
return function (
|
|
1129
|
-
return
|
|
1128
|
+
return function (_x122) {
|
|
1129
|
+
return _ref179.apply(this, arguments);
|
|
1130
1130
|
};
|
|
1131
1131
|
}());
|
|
1132
1132
|
cleanups.push(unsubscribe);
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
1135
|
}
|
|
1136
|
-
return
|
|
1136
|
+
return _context148.a(2, function () {
|
|
1137
1137
|
cleanups.forEach(function (remove) {
|
|
1138
1138
|
return remove();
|
|
1139
1139
|
});
|
|
1140
1140
|
});
|
|
1141
1141
|
}
|
|
1142
|
-
},
|
|
1142
|
+
}, _callee148);
|
|
1143
1143
|
}));
|
|
1144
1144
|
return _initializeWalletProviderListeners.apply(this, arguments);
|
|
1145
1145
|
}
|
|
@@ -6845,266 +6845,151 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
6845
6845
|
};
|
|
6846
6846
|
}(), [ethSendErc20Transfer, getSession, pollTransactionStatus, pushPage]);
|
|
6847
6847
|
var handleOnRamp = useCallback(/*#__PURE__*/function () {
|
|
6848
|
-
var _ref169 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
6849
|
-
var
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
while (1) switch (_context140.n) {
|
|
6848
|
+
var _ref169 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee138(params) {
|
|
6849
|
+
var walletAccount, lockedCaip2, lockedCaip19, fiatCurrencyCode, defaultFiatCurrencyAmount, countryCode, countrySubdivisionCode, _params$sandboxMode, sandboxMode, stampWith, successPageDuration, openInNewTab, rpcUrl, s, organizationId;
|
|
6850
|
+
return _regenerator().w(function (_context138) {
|
|
6851
|
+
while (1) switch (_context138.n) {
|
|
6853
6852
|
case 0:
|
|
6854
|
-
walletAccount = params.walletAccount,
|
|
6855
|
-
|
|
6853
|
+
walletAccount = params.walletAccount, lockedCaip2 = params.lockedCaip2, lockedCaip19 = params.lockedCaip19, fiatCurrencyCode = params.fiatCurrencyCode, defaultFiatCurrencyAmount = params.defaultFiatCurrencyAmount, countryCode = params.countryCode, countrySubdivisionCode = params.countrySubdivisionCode, _params$sandboxMode = params.sandboxMode, sandboxMode = _params$sandboxMode === void 0 ? true : _params$sandboxMode, stampWith = params.stampWith, successPageDuration = params.successPageDuration, openInNewTab = params.openInNewTab, rpcUrl = params.rpcUrl;
|
|
6854
|
+
_context138.n = 1;
|
|
6856
6855
|
return getSession();
|
|
6857
6856
|
case 1:
|
|
6858
|
-
s =
|
|
6859
|
-
organizationId =
|
|
6857
|
+
s = _context138.v;
|
|
6858
|
+
organizationId = params.organizationId || (s === null || s === void 0 ? void 0 : s.organizationId);
|
|
6860
6859
|
if (organizationId) {
|
|
6861
|
-
|
|
6860
|
+
_context138.n = 2;
|
|
6862
6861
|
break;
|
|
6863
6862
|
}
|
|
6864
6863
|
throw new TurnkeyError("A session or passed in organization ID is required.", TurnkeyErrorCodes.INVALID_REQUEST);
|
|
6865
6864
|
case 2:
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
network = FiatOnRampBlockchainNetwork.SOLANA;
|
|
6878
|
-
return _context140.a(3, 7);
|
|
6879
|
-
case 6:
|
|
6880
|
-
cryptoCurrencyCode = FiatOnRampCryptoCurrency.ETHEREUM;
|
|
6881
|
-
network = FiatOnRampBlockchainNetwork.ETHEREUM;
|
|
6882
|
-
return _context140.a(3, 7);
|
|
6883
|
-
case 7:
|
|
6884
|
-
openNewTab = openInNewTab || isMobile;
|
|
6885
|
-
cryptoCurrencyCode = params.cryptoCurrencyCode || cryptoCurrencyCode;
|
|
6886
|
-
network = params.network || network;
|
|
6887
|
-
return _context140.a(2, new Promise(function (resolve, reject) {
|
|
6888
|
-
var OnRampContainer = function OnRampContainer() {
|
|
6889
|
-
var _useState15 = useState(false),
|
|
6890
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
6891
|
-
completed = _useState16[0],
|
|
6892
|
-
setCompleted = _useState16[1];
|
|
6893
|
-
var pollingRef = useRef(null);
|
|
6894
|
-
var cleanup = function cleanup() {
|
|
6895
|
-
if (pollingRef.current) {
|
|
6896
|
-
clearInterval(pollingRef.current);
|
|
6897
|
-
pollingRef.current = null;
|
|
6898
|
-
}
|
|
6899
|
-
};
|
|
6900
|
-
useEffect(function () {
|
|
6901
|
-
return function () {
|
|
6902
|
-
cleanup();
|
|
6903
|
-
};
|
|
6904
|
-
}, []);
|
|
6905
|
-
var action = /*#__PURE__*/function () {
|
|
6906
|
-
var _ref170 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee139() {
|
|
6907
|
-
var _client$httpClient, onRampWindow, result, popupWidth, popupHeight, left, top, onRampTransactionId, _t36;
|
|
6908
|
-
return _regenerator().w(function (_context139) {
|
|
6909
|
-
while (1) switch (_context139.p = _context139.n) {
|
|
6910
|
-
case 0:
|
|
6911
|
-
_context139.p = 0;
|
|
6912
|
-
onRampWindow = null;
|
|
6913
|
-
if (!openNewTab) {
|
|
6914
|
-
_context139.n = 1;
|
|
6915
|
-
break;
|
|
6916
|
-
}
|
|
6917
|
-
onRampWindow = window.open("", "_blank");
|
|
6918
|
-
if (onRampWindow) {
|
|
6919
|
-
_context139.n = 1;
|
|
6920
|
-
break;
|
|
6921
|
-
}
|
|
6922
|
-
throw new Error("Failed to open On Ramp tab.");
|
|
6923
|
-
case 1:
|
|
6924
|
-
_context139.n = 2;
|
|
6925
|
-
return client === null || client === void 0 ? void 0 : (_client$httpClient = client.httpClient) === null || _client$httpClient === void 0 ? void 0 : _client$httpClient.initFiatOnRamp(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
6926
|
-
onrampProvider: onrampProvider,
|
|
6927
|
-
walletAddress: walletAccount.address,
|
|
6928
|
-
network: network,
|
|
6929
|
-
cryptoCurrencyCode: cryptoCurrencyCode,
|
|
6930
|
-
sandboxMode: sandboxMode,
|
|
6931
|
-
organizationId: organizationId
|
|
6932
|
-
}, fiatCurrencyCode ? {
|
|
6933
|
-
fiatCurrencyCode: fiatCurrencyCode
|
|
6934
|
-
} : {}), fiatCurrencyAmount ? {
|
|
6935
|
-
fiatCurrencyAmount: fiatCurrencyAmount
|
|
6936
|
-
} : {}), paymentMethod ? {
|
|
6937
|
-
paymentMethod: paymentMethod
|
|
6938
|
-
} : {}), countryCode ? {
|
|
6939
|
-
countryCode: countryCode
|
|
6940
|
-
} : {}), countrySubdivisionCode ? {
|
|
6941
|
-
countrySubdivisionCode: countrySubdivisionCode
|
|
6942
|
-
} : {}), sandboxMode !== undefined ? {
|
|
6943
|
-
sandboxMode: sandboxMode
|
|
6944
|
-
} : {}), urlForSignature ? {
|
|
6945
|
-
urlForSignature: urlForSignature
|
|
6946
|
-
} : {}));
|
|
6947
|
-
case 2:
|
|
6948
|
-
result = _context139.v;
|
|
6949
|
-
if (result !== null && result !== void 0 && result.onRampUrl) {
|
|
6950
|
-
_context139.n = 3;
|
|
6951
|
-
break;
|
|
6952
|
-
}
|
|
6953
|
-
throw new Error("Missing onRampUrl");
|
|
6954
|
-
case 3:
|
|
6955
|
-
if (!(openNewTab && onRampWindow)) {
|
|
6956
|
-
_context139.n = 4;
|
|
6957
|
-
break;
|
|
6958
|
-
}
|
|
6959
|
-
onRampWindow.location.href = result.onRampUrl.toString();
|
|
6960
|
-
_context139.n = 5;
|
|
6961
|
-
break;
|
|
6962
|
-
case 4:
|
|
6963
|
-
popupWidth = 500;
|
|
6964
|
-
popupHeight = 600;
|
|
6965
|
-
left = window.screenX + (window.innerWidth - popupWidth) / 2;
|
|
6966
|
-
top = window.screenY + (window.innerHeight - popupHeight) / 2;
|
|
6967
|
-
onRampWindow = window.open(result.onRampUrl.toString(), "_blank", "width=".concat(popupWidth, ",height=").concat(popupHeight, ",top=").concat(top, ",left=").concat(left, ",scrollbars=yes,resizable=yes"));
|
|
6968
|
-
if (onRampWindow) {
|
|
6969
|
-
_context139.n = 5;
|
|
6970
|
-
break;
|
|
6971
|
-
}
|
|
6972
|
-
throw new Error("Failed to open On Ramp window.");
|
|
6973
|
-
case 5:
|
|
6974
|
-
onRampTransactionId = result.onRampTransactionId;
|
|
6975
|
-
if (onRampTransactionId) {
|
|
6976
|
-
_context139.n = 6;
|
|
6977
|
-
break;
|
|
6978
|
-
}
|
|
6979
|
-
throw new Error("No onRampTransactionId returned");
|
|
6980
|
-
case 6:
|
|
6981
|
-
return _context139.a(2, new Promise(function (resolveAction, rejectAction) {
|
|
6982
|
-
pollingRef.current = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee138() {
|
|
6983
|
-
var _onRampWindow, _client$httpClient2, currentUrl, _onRampWindow2, _onRampWindow3, resp, status, _onRampWindow4, _t35;
|
|
6984
|
-
return _regenerator().w(function (_context138) {
|
|
6985
|
-
while (1) switch (_context138.p = _context138.n) {
|
|
6986
|
-
case 0:
|
|
6987
|
-
_context138.p = 0;
|
|
6988
|
-
if (!(onrampProvider === "FIAT_ON_RAMP_PROVIDER_COINBASE" && (_onRampWindow = onRampWindow) !== null && _onRampWindow !== void 0 && _onRampWindow.closed)) {
|
|
6989
|
-
_context138.n = 1;
|
|
6990
|
-
break;
|
|
6991
|
-
}
|
|
6992
|
-
cleanup();
|
|
6993
|
-
rejectAction(new Error("On-ramp popup closed by user"));
|
|
6994
|
-
return _context138.a(2);
|
|
6995
|
-
case 1:
|
|
6996
|
-
currentUrl = "";
|
|
6997
|
-
try {
|
|
6998
|
-
currentUrl = ((_onRampWindow2 = onRampWindow) === null || _onRampWindow2 === void 0 ? void 0 : _onRampWindow2.location.href) || "";
|
|
6999
|
-
} catch (_unused6) {}
|
|
7000
|
-
if (!(currentUrl && currentUrl.startsWith(window.location.origin))) {
|
|
7001
|
-
_context138.n = 2;
|
|
7002
|
-
break;
|
|
7003
|
-
}
|
|
7004
|
-
cleanup();
|
|
7005
|
-
(_onRampWindow3 = onRampWindow) === null || _onRampWindow3 === void 0 ? void 0 : _onRampWindow3.close();
|
|
7006
|
-
setCompleted(true);
|
|
7007
|
-
resolveAction();
|
|
7008
|
-
return _context138.a(2);
|
|
7009
|
-
case 2:
|
|
7010
|
-
_context138.n = 3;
|
|
7011
|
-
return client === null || client === void 0 ? void 0 : (_client$httpClient2 = client.httpClient) === null || _client$httpClient2 === void 0 ? void 0 : _client$httpClient2.getOnRampTransactionStatus({
|
|
7012
|
-
transactionId: onRampTransactionId,
|
|
7013
|
-
refresh: true
|
|
7014
|
-
});
|
|
7015
|
-
case 3:
|
|
7016
|
-
resp = _context138.v;
|
|
7017
|
-
status = resp === null || resp === void 0 ? void 0 : resp.transactionStatus;
|
|
7018
|
-
if (["COMPLETED", "FAILED", "CANCELLED"].includes(status !== null && status !== void 0 ? status : "")) {
|
|
7019
|
-
cleanup();
|
|
7020
|
-
try {
|
|
7021
|
-
(_onRampWindow4 = onRampWindow) === null || _onRampWindow4 === void 0 ? void 0 : _onRampWindow4.close();
|
|
7022
|
-
} catch (_unused7) {}
|
|
7023
|
-
setCompleted(true);
|
|
7024
|
-
resolveAction();
|
|
7025
|
-
}
|
|
7026
|
-
_context138.n = 5;
|
|
7027
|
-
break;
|
|
7028
|
-
case 4:
|
|
7029
|
-
_context138.p = 4;
|
|
7030
|
-
_t35 = _context138.v;
|
|
7031
|
-
console.warn("Polling error (ignored):", _t35);
|
|
7032
|
-
case 5:
|
|
7033
|
-
return _context138.a(2);
|
|
7034
|
-
}
|
|
7035
|
-
}, _callee138, null, [[0, 4]]);
|
|
7036
|
-
})), 3000);
|
|
7037
|
-
}));
|
|
7038
|
-
case 7:
|
|
7039
|
-
_context139.p = 7;
|
|
7040
|
-
_t36 = _context139.v;
|
|
7041
|
-
cleanup();
|
|
7042
|
-
throw _t36;
|
|
7043
|
-
case 8:
|
|
7044
|
-
return _context139.a(2);
|
|
7045
|
-
}
|
|
7046
|
-
}, _callee139, null, [[0, 7]]);
|
|
7047
|
-
}));
|
|
7048
|
-
return function action() {
|
|
7049
|
-
return _ref170.apply(this, arguments);
|
|
7050
|
-
};
|
|
7051
|
-
}();
|
|
7052
|
-
return jsx(OnRampPage, {
|
|
7053
|
-
icon: onrampProvider === "FIAT_ON_RAMP_PROVIDER_COINBASE" ? jsx(CoinbaseLogo, {
|
|
7054
|
-
className: "w-12 h-12"
|
|
7055
|
-
}) : jsx(MoonPayLogo, {
|
|
7056
|
-
className: "w-12 h-12"
|
|
7057
|
-
}),
|
|
7058
|
-
onrampProvider: onrampProvider,
|
|
7059
|
-
action: action,
|
|
7060
|
-
sandboxMode: sandboxMode,
|
|
7061
|
-
completed: completed,
|
|
7062
|
-
successPageDuration: successPageDuration,
|
|
7063
|
-
onSuccess: function onSuccess() {
|
|
7064
|
-
return resolve();
|
|
7065
|
-
},
|
|
7066
|
-
onError: function onError(err) {
|
|
7067
|
-
return reject(err);
|
|
7068
|
-
}
|
|
7069
|
-
});
|
|
6865
|
+
return _context138.a(2, new Promise(function (resolve, reject) {
|
|
6866
|
+
var settled = false;
|
|
6867
|
+
var resolveOnce = function resolveOnce() {
|
|
6868
|
+
if (settled) return;
|
|
6869
|
+
settled = true;
|
|
6870
|
+
resolve();
|
|
6871
|
+
};
|
|
6872
|
+
var rejectOnce = function rejectOnce(error) {
|
|
6873
|
+
if (settled) return;
|
|
6874
|
+
settled = true;
|
|
6875
|
+
reject(error);
|
|
7070
6876
|
};
|
|
7071
6877
|
pushPage({
|
|
7072
|
-
key: "
|
|
7073
|
-
content: jsx(
|
|
7074
|
-
|
|
6878
|
+
key: "Deposit",
|
|
6879
|
+
content: jsx(OnRampPage, {
|
|
6880
|
+
lockedCaip2: lockedCaip2,
|
|
6881
|
+
lockedCaip19: lockedCaip19,
|
|
6882
|
+
walletAccount: walletAccount,
|
|
6883
|
+
sandboxMode: sandboxMode,
|
|
6884
|
+
organizationId: organizationId,
|
|
6885
|
+
stampWith: stampWith,
|
|
6886
|
+
fiatCurrencyCode: fiatCurrencyCode,
|
|
6887
|
+
defaultFiatCurrencyAmount: defaultFiatCurrencyAmount,
|
|
6888
|
+
countryCode: countryCode,
|
|
6889
|
+
countrySubdivisionCode: countrySubdivisionCode,
|
|
6890
|
+
openInNewTab: openInNewTab,
|
|
6891
|
+
successPageDuration: successPageDuration,
|
|
6892
|
+
rpcUrl: rpcUrl,
|
|
6893
|
+
onSuccess: resolveOnce,
|
|
6894
|
+
onError: rejectOnce
|
|
6895
|
+
}),
|
|
6896
|
+
contextProvider: OnRampProviders,
|
|
7075
6897
|
preventBack: true,
|
|
7076
6898
|
onClose: function onClose() {
|
|
7077
|
-
return
|
|
6899
|
+
return rejectOnce(new TurnkeyError("User canceled the onramp process.", TurnkeyErrorCodes.USER_CANCELED));
|
|
7078
6900
|
}
|
|
7079
6901
|
});
|
|
7080
6902
|
}));
|
|
7081
6903
|
}
|
|
7082
|
-
},
|
|
6904
|
+
}, _callee138);
|
|
7083
6905
|
}));
|
|
7084
6906
|
return function (_x115) {
|
|
7085
6907
|
return _ref169.apply(this, arguments);
|
|
7086
6908
|
};
|
|
7087
|
-
}(), [getSession,
|
|
6909
|
+
}(), [getSession, pushPage]);
|
|
6910
|
+
var handleOffRamp = useCallback(/*#__PURE__*/function () {
|
|
6911
|
+
var _ref170 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee139(params) {
|
|
6912
|
+
var walletAccount, lockedCaip2, lockedCaip19, fiatCurrencyCode, defaultCryptoAmount, countryCode, countrySubdivisionCode, _params$sandboxMode2, sandboxMode, stampWith, successPageDuration, openInNewTab, rpcUrl, s, organizationId;
|
|
6913
|
+
return _regenerator().w(function (_context139) {
|
|
6914
|
+
while (1) switch (_context139.n) {
|
|
6915
|
+
case 0:
|
|
6916
|
+
walletAccount = params.walletAccount, lockedCaip2 = params.lockedCaip2, lockedCaip19 = params.lockedCaip19, fiatCurrencyCode = params.fiatCurrencyCode, defaultCryptoAmount = params.defaultCryptoAmount, countryCode = params.countryCode, countrySubdivisionCode = params.countrySubdivisionCode, _params$sandboxMode2 = params.sandboxMode, sandboxMode = _params$sandboxMode2 === void 0 ? true : _params$sandboxMode2, stampWith = params.stampWith, successPageDuration = params.successPageDuration, openInNewTab = params.openInNewTab, rpcUrl = params.rpcUrl;
|
|
6917
|
+
_context139.n = 1;
|
|
6918
|
+
return getSession();
|
|
6919
|
+
case 1:
|
|
6920
|
+
s = _context139.v;
|
|
6921
|
+
organizationId = params.organizationId || (s === null || s === void 0 ? void 0 : s.organizationId);
|
|
6922
|
+
if (organizationId) {
|
|
6923
|
+
_context139.n = 2;
|
|
6924
|
+
break;
|
|
6925
|
+
}
|
|
6926
|
+
throw new TurnkeyError("A session or passed in organization ID is required.", TurnkeyErrorCodes.INVALID_REQUEST);
|
|
6927
|
+
case 2:
|
|
6928
|
+
return _context139.a(2, new Promise(function (resolve, reject) {
|
|
6929
|
+
var settled = false;
|
|
6930
|
+
var resolveOnce = function resolveOnce() {
|
|
6931
|
+
if (settled) return;
|
|
6932
|
+
settled = true;
|
|
6933
|
+
resolve();
|
|
6934
|
+
};
|
|
6935
|
+
var rejectOnce = function rejectOnce(error) {
|
|
6936
|
+
if (settled) return;
|
|
6937
|
+
settled = true;
|
|
6938
|
+
reject(error);
|
|
6939
|
+
};
|
|
6940
|
+
pushPage({
|
|
6941
|
+
key: "Withdraw",
|
|
6942
|
+
content: jsx(OffRampPage, {
|
|
6943
|
+
lockedCaip2: lockedCaip2,
|
|
6944
|
+
lockedCaip19: lockedCaip19,
|
|
6945
|
+
walletAccount: walletAccount,
|
|
6946
|
+
sandboxMode: sandboxMode,
|
|
6947
|
+
organizationId: organizationId,
|
|
6948
|
+
stampWith: stampWith,
|
|
6949
|
+
fiatCurrencyCode: fiatCurrencyCode,
|
|
6950
|
+
defaultCryptoAmount: defaultCryptoAmount,
|
|
6951
|
+
countryCode: countryCode,
|
|
6952
|
+
countrySubdivisionCode: countrySubdivisionCode,
|
|
6953
|
+
openInNewTab: openInNewTab,
|
|
6954
|
+
successPageDuration: successPageDuration,
|
|
6955
|
+
rpcUrl: rpcUrl,
|
|
6956
|
+
onSuccess: resolveOnce,
|
|
6957
|
+
onError: rejectOnce
|
|
6958
|
+
}),
|
|
6959
|
+
contextProvider: OnRampProviders,
|
|
6960
|
+
preventBack: true,
|
|
6961
|
+
onClose: function onClose() {
|
|
6962
|
+
return rejectOnce(new TurnkeyError("User canceled the offramp process.", TurnkeyErrorCodes.USER_CANCELED));
|
|
6963
|
+
}
|
|
6964
|
+
});
|
|
6965
|
+
}));
|
|
6966
|
+
}
|
|
6967
|
+
}, _callee139);
|
|
6968
|
+
}));
|
|
6969
|
+
return function (_x116) {
|
|
6970
|
+
return _ref170.apply(this, arguments);
|
|
6971
|
+
};
|
|
6972
|
+
}(), [getSession, pushPage]);
|
|
7088
6973
|
var handleVerifyAppProofs = useCallback(/*#__PURE__*/function () {
|
|
7089
|
-
var
|
|
7090
|
-
var
|
|
7091
|
-
return _regenerator().w(function (
|
|
7092
|
-
while (1) switch (
|
|
6974
|
+
var _ref171 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee140(params) {
|
|
6975
|
+
var _ref172, appProofs, _ref172$successPageDu, successPageDuration, stampWith, s, organizationId, _t35;
|
|
6976
|
+
return _regenerator().w(function (_context140) {
|
|
6977
|
+
while (1) switch (_context140.p = _context140.n) {
|
|
7093
6978
|
case 0:
|
|
7094
|
-
|
|
7095
|
-
|
|
6979
|
+
_ref172 = params || {}, appProofs = _ref172.appProofs, _ref172$successPageDu = _ref172.successPageDuration, successPageDuration = _ref172$successPageDu === void 0 ? 3000 : _ref172$successPageDu, stampWith = _ref172.stampWith;
|
|
6980
|
+
_context140.n = 1;
|
|
7096
6981
|
return getSession();
|
|
7097
6982
|
case 1:
|
|
7098
|
-
s =
|
|
6983
|
+
s = _context140.v;
|
|
7099
6984
|
organizationId = (params === null || params === void 0 ? void 0 : params.organizationId) || (s === null || s === void 0 ? void 0 : s.organizationId);
|
|
7100
6985
|
if (organizationId) {
|
|
7101
|
-
|
|
6986
|
+
_context140.n = 2;
|
|
7102
6987
|
break;
|
|
7103
6988
|
}
|
|
7104
6989
|
throw new TurnkeyError("A session or passed in organization ID is required.", TurnkeyErrorCodes.INVALID_REQUEST);
|
|
7105
6990
|
case 2:
|
|
7106
|
-
|
|
7107
|
-
return
|
|
6991
|
+
_context140.p = 2;
|
|
6992
|
+
return _context140.a(2, new Promise(function (resolve, reject) {
|
|
7108
6993
|
pushPage({
|
|
7109
6994
|
key: "Verify app proofs",
|
|
7110
6995
|
showTurnkeyBranding: false,
|
|
@@ -7130,34 +7015,34 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
7130
7015
|
});
|
|
7131
7016
|
}));
|
|
7132
7017
|
case 3:
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
if (!(
|
|
7136
|
-
|
|
7018
|
+
_context140.p = 3;
|
|
7019
|
+
_t35 = _context140.v;
|
|
7020
|
+
if (!(_t35 instanceof TurnkeyError)) {
|
|
7021
|
+
_context140.n = 4;
|
|
7137
7022
|
break;
|
|
7138
7023
|
}
|
|
7139
|
-
throw
|
|
7024
|
+
throw _t35;
|
|
7140
7025
|
case 4:
|
|
7141
|
-
throw new TurnkeyError("Failed to verify app proofs.", TurnkeyErrorCodes.VERIFY_APP_PROOFS_ERROR,
|
|
7026
|
+
throw new TurnkeyError("Failed to verify app proofs.", TurnkeyErrorCodes.VERIFY_APP_PROOFS_ERROR, _t35);
|
|
7142
7027
|
case 5:
|
|
7143
|
-
return
|
|
7028
|
+
return _context140.a(2);
|
|
7144
7029
|
}
|
|
7145
|
-
},
|
|
7030
|
+
}, _callee140, null, [[2, 3]]);
|
|
7146
7031
|
}));
|
|
7147
|
-
return function (
|
|
7148
|
-
return
|
|
7032
|
+
return function (_x117) {
|
|
7033
|
+
return _ref171.apply(this, arguments);
|
|
7149
7034
|
};
|
|
7150
7035
|
}(), [getSession, pushPage]);
|
|
7151
7036
|
useEffect(function () {
|
|
7152
7037
|
if (proxyAuthConfigRef.current) return;
|
|
7153
7038
|
// Fetch proxy auth config and client params once. Use both to build the master config.
|
|
7154
7039
|
var fetchProxyAuthConfig = /*#__PURE__*/function () {
|
|
7155
|
-
var
|
|
7156
|
-
var proxyAuthConfig, clientParams, promises, _callbacks$onError10, _callbacks$onError11,
|
|
7157
|
-
return _regenerator().w(function (
|
|
7158
|
-
while (1) switch (
|
|
7040
|
+
var _ref173 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee141() {
|
|
7041
|
+
var proxyAuthConfig, clientParams, promises, _callbacks$onError10, _callbacks$onError11, _t36;
|
|
7042
|
+
return _regenerator().w(function (_context141) {
|
|
7043
|
+
while (1) switch (_context141.p = _context141.n) {
|
|
7159
7044
|
case 0:
|
|
7160
|
-
|
|
7045
|
+
_context141.p = 0;
|
|
7161
7046
|
promises = [];
|
|
7162
7047
|
if (shouldFetchWalletKitConfig) {
|
|
7163
7048
|
promises.push(getAuthProxyConfig(config.authProxyConfigId, config.authProxyUrl).then(function (result) {
|
|
@@ -7169,7 +7054,7 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
7169
7054
|
clientParams = result;
|
|
7170
7055
|
}));
|
|
7171
7056
|
}
|
|
7172
|
-
|
|
7057
|
+
_context141.n = 1;
|
|
7173
7058
|
return Promise.all(promises);
|
|
7174
7059
|
case 1:
|
|
7175
7060
|
if (proxyAuthConfig) {
|
|
@@ -7179,27 +7064,27 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
7179
7064
|
clientParamsRef.current = clientParams;
|
|
7180
7065
|
}
|
|
7181
7066
|
setMasterConfig(buildConfig(proxyAuthConfig, clientParams));
|
|
7182
|
-
|
|
7067
|
+
_context141.n = 3;
|
|
7183
7068
|
break;
|
|
7184
7069
|
case 2:
|
|
7185
|
-
|
|
7186
|
-
|
|
7070
|
+
_context141.p = 2;
|
|
7071
|
+
_t36 = _context141.v;
|
|
7187
7072
|
setClientState(ClientState.Error);
|
|
7188
7073
|
// Without this the failure is silent: the provider goes to Error, every
|
|
7189
7074
|
// guarded method then throws "Config is not ready yet!", and the cause
|
|
7190
7075
|
// never reaches the integrator.
|
|
7191
|
-
if (
|
|
7192
|
-
callbacks === null || callbacks === void 0 ? void 0 : (_callbacks$onError10 = callbacks.onError) === null || _callbacks$onError10 === void 0 ? void 0 : _callbacks$onError10.call(callbacks,
|
|
7076
|
+
if (_t36 instanceof TurnkeyError || _t36 instanceof TurnkeyNetworkError) {
|
|
7077
|
+
callbacks === null || callbacks === void 0 ? void 0 : (_callbacks$onError10 = callbacks.onError) === null || _callbacks$onError10 === void 0 ? void 0 : _callbacks$onError10.call(callbacks, _t36);
|
|
7193
7078
|
} else {
|
|
7194
|
-
callbacks === null || callbacks === void 0 ? void 0 : (_callbacks$onError11 = callbacks.onError) === null || _callbacks$onError11 === void 0 ? void 0 : _callbacks$onError11.call(callbacks, new TurnkeyError("Failed to fetch the wallet kit configuration", TurnkeyErrorCodes.INITIALIZE_CLIENT_ERROR,
|
|
7079
|
+
callbacks === null || callbacks === void 0 ? void 0 : (_callbacks$onError11 = callbacks.onError) === null || _callbacks$onError11 === void 0 ? void 0 : _callbacks$onError11.call(callbacks, new TurnkeyError("Failed to fetch the wallet kit configuration", TurnkeyErrorCodes.INITIALIZE_CLIENT_ERROR, _t36));
|
|
7195
7080
|
}
|
|
7196
7081
|
case 3:
|
|
7197
|
-
return
|
|
7082
|
+
return _context141.a(2);
|
|
7198
7083
|
}
|
|
7199
|
-
},
|
|
7084
|
+
}, _callee141, null, [[0, 2]]);
|
|
7200
7085
|
}));
|
|
7201
7086
|
return function fetchProxyAuthConfig() {
|
|
7202
|
-
return
|
|
7087
|
+
return _ref173.apply(this, arguments);
|
|
7203
7088
|
};
|
|
7204
7089
|
}();
|
|
7205
7090
|
fetchProxyAuthConfig();
|
|
@@ -7232,34 +7117,34 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
7232
7117
|
var debouncedFetchWalletProviders = useDebouncedCallback(fetchWalletProviders, 100);
|
|
7233
7118
|
useEffect(function () {
|
|
7234
7119
|
var handleUpdateState = /*#__PURE__*/function () {
|
|
7235
|
-
var
|
|
7120
|
+
var _ref174 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee142() {
|
|
7236
7121
|
var currentSession;
|
|
7237
|
-
return _regenerator().w(function (
|
|
7238
|
-
while (1) switch (
|
|
7122
|
+
return _regenerator().w(function (_context142) {
|
|
7123
|
+
while (1) switch (_context142.n) {
|
|
7239
7124
|
case 0:
|
|
7240
|
-
|
|
7125
|
+
_context142.n = 1;
|
|
7241
7126
|
return getSession();
|
|
7242
7127
|
case 1:
|
|
7243
|
-
currentSession =
|
|
7128
|
+
currentSession = _context142.v;
|
|
7244
7129
|
if (!currentSession) {
|
|
7245
|
-
|
|
7130
|
+
_context142.n = 3;
|
|
7246
7131
|
break;
|
|
7247
7132
|
}
|
|
7248
|
-
|
|
7133
|
+
_context142.n = 2;
|
|
7249
7134
|
return debouncedRefreshWallets();
|
|
7250
7135
|
case 2:
|
|
7251
|
-
|
|
7136
|
+
_context142.n = 4;
|
|
7252
7137
|
break;
|
|
7253
7138
|
case 3:
|
|
7254
|
-
|
|
7139
|
+
_context142.n = 4;
|
|
7255
7140
|
return debouncedFetchWalletProviders();
|
|
7256
7141
|
case 4:
|
|
7257
|
-
return
|
|
7142
|
+
return _context142.a(2);
|
|
7258
7143
|
}
|
|
7259
|
-
},
|
|
7144
|
+
}, _callee142);
|
|
7260
7145
|
}));
|
|
7261
7146
|
return function handleUpdateState() {
|
|
7262
|
-
return
|
|
7147
|
+
return _ref174.apply(this, arguments);
|
|
7263
7148
|
};
|
|
7264
7149
|
}();
|
|
7265
7150
|
var cleanup = function cleanup() {};
|
|
@@ -7301,19 +7186,19 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
7301
7186
|
var mfaHandler = mfaHandlerRef.current;
|
|
7302
7187
|
if (mfaHandler) {
|
|
7303
7188
|
client.httpClient.config.onMfaRequired = /*#__PURE__*/function () {
|
|
7304
|
-
var
|
|
7305
|
-
return _regenerator().w(function (
|
|
7306
|
-
while (1) switch (
|
|
7189
|
+
var _ref175 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee143(ctx) {
|
|
7190
|
+
return _regenerator().w(function (_context143) {
|
|
7191
|
+
while (1) switch (_context143.n) {
|
|
7307
7192
|
case 0:
|
|
7308
|
-
|
|
7193
|
+
_context143.n = 1;
|
|
7309
7194
|
return mfaHandler(ctx);
|
|
7310
7195
|
case 1:
|
|
7311
|
-
return
|
|
7196
|
+
return _context143.a(2);
|
|
7312
7197
|
}
|
|
7313
|
-
},
|
|
7198
|
+
}, _callee143);
|
|
7314
7199
|
}));
|
|
7315
|
-
return function (
|
|
7316
|
-
return
|
|
7200
|
+
return function (_x118) {
|
|
7201
|
+
return _ref175.apply(this, arguments);
|
|
7317
7202
|
};
|
|
7318
7203
|
}();
|
|
7319
7204
|
}
|
|
@@ -7429,6 +7314,7 @@ var ClientProvider = function ClientProvider(_ref) {
|
|
|
7429
7314
|
handleRemoveUserPhoneNumber: handleRemoveUserPhoneNumber,
|
|
7430
7315
|
handleVerifyAppProofs: handleVerifyAppProofs,
|
|
7431
7316
|
handleOnRamp: handleOnRamp,
|
|
7317
|
+
handleOffRamp: handleOffRamp,
|
|
7432
7318
|
handleSendTransaction: handleSendTransaction,
|
|
7433
7319
|
handleSendErc20Transfer: handleSendErc20Transfer,
|
|
7434
7320
|
setMfaHandler: setMfaHandler,
|