@layerswap/widget 0.1.4 → 0.1.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 +78 -3
- package/dist/Models/Theme.d.ts +7 -6
- package/dist/Models/Theme.js +7 -7
- package/dist/Models/WalletProvider.d.ts +0 -4
- package/dist/Models/WalletProvider.js +2 -0
- package/dist/components/Buttons/copyButton.js +4 -3
- package/dist/components/ColorSchema.js +79 -45
- package/dist/components/Common/AddressIcon.js +1 -0
- package/dist/components/Common/AverageCompletionTime.js +1 -1
- package/dist/components/Common/CountDownTimer.js +2 -2
- package/dist/components/Common/FormattedAverageCompletionTime.js +1 -1
- package/dist/components/HeaderWithMenu/index.js +1 -8
- package/dist/components/Input/Address/AddressNote.js +3 -2
- package/dist/components/Input/Address/AddressPicker/AddressWithIcon.js +2 -2
- package/dist/components/Input/Address/AddressPicker/ConnectedWallets/ConnectWalletButton.js +12 -5
- package/dist/components/Input/Address/AddressPicker/ExchangeNote.d.ts +1 -1
- package/dist/components/Input/Address/AddressPicker/ExchangeNote.js +1 -1
- package/dist/components/Input/RouteIcon.js +1 -1
- package/dist/components/LayerswapMenu/MenuList.js +2 -56
- package/dist/components/Pages/404/index.js +1 -0
- package/dist/components/Pages/Auth/Steps/CodeStep/VerifyEmailCode.js +1 -0
- package/dist/components/Pages/Auth/index.d.ts +1 -1
- package/dist/components/Pages/Auth/index.js +3 -2
- package/dist/components/Pages/Campaigns/Details/Leaderboard.js +1 -0
- package/dist/components/Pages/Campaigns/Details/index.d.ts +1 -1
- package/dist/components/Pages/Campaigns/Details/index.js +3 -2
- package/dist/components/Pages/Campaigns/index.d.ts +1 -1
- package/dist/components/Pages/Campaigns/index.js +3 -2
- package/dist/components/Pages/Maintanance/index.js +1 -0
- package/dist/components/Pages/NoCookies/index.js +1 -0
- package/dist/components/Pages/SwapHistory/History.js +1 -2
- package/dist/components/Pages/SwapHistory/index.d.ts +1 -1
- package/dist/components/Pages/SwapHistory/index.js +4 -3
- package/dist/components/Pages/SwapPages/Form/FeeDetails/Campaign.js +1 -0
- package/dist/components/Pages/SwapPages/Form/Form.js +1 -4
- package/dist/components/Pages/SwapPages/Form/SecondaryComponents/ValidationError.js +1 -1
- package/dist/components/Pages/SwapPages/Form/Select/Popover/PopoverSelect.js +1 -1
- package/dist/components/Pages/SwapPages/Form/index.js +1 -0
- package/dist/components/Pages/SwapPages/Withdraw/Coinbase/Carousel.js +8 -6
- package/dist/components/Pages/SwapPages/Withdraw/Processing/Processing.js +2 -2
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/FuelWalletWithdrawal.d.ts +0 -4
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/FuelWalletWithdrawal.js +159 -125
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/ImtblxWalletWithdrawStep.d.ts +0 -4
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/ImtblxWalletWithdrawStep.js +69 -51
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/ActivationTokentPicker.d.ts +0 -8
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/ActivationTokentPicker.js +87 -45
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/hooks.d.ts +0 -40
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/hooks.js +73 -46
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/index.d.ts +0 -4
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/index.js +175 -128
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/SVMWalletWithdraw/index.d.ts +0 -7
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/SVMWalletWithdraw/index.js +138 -116
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/SVMWalletWithdraw/transactionSender.d.ts +0 -8
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/SVMWalletWithdraw/transactionSender.js +96 -75
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/SophonWalletWithdraw.js +2 -2
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/StarknetWalletWithdraw.d.ts +0 -4
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/StarknetWalletWithdraw.js +88 -71
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/TonWalletWithdraw.d.ts +0 -4
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/TonWalletWithdraw.js +146 -136
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/TronWalletWithdraw.d.ts +0 -4
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/TronWalletWithdraw.js +120 -99
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/WalletTransfer/TransferToken.js +3 -3
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/WalletTransfer/buttons.js +1 -0
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/WalletTransfer/index.js +1 -1
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/WalletTransfer/transactionMessage.js +2 -2
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/WalletTransferContent.js +101 -33
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/Evm.d.ts +0 -4
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/Evm.js +60 -55
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/Starknet.d.ts +0 -4
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/Starknet.js +71 -55
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/buttons.js +1 -0
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/index.d.ts +0 -4
- package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/index.js +56 -52
- package/dist/components/Pages/SwapPages/Withdraw/index.d.ts +1 -1
- package/dist/components/Pages/SwapPages/Withdraw/index.js +3 -2
- package/dist/components/Wallet/WalletModal/Connector.js +1 -1
- package/dist/components/Wallet/WalletProviders/FuelProvider.d.ts +0 -5
- package/dist/components/Wallet/WalletProviders/FuelProvider.js +25 -20
- package/dist/components/Wallet/WalletProviders/ImtblPassportProvider.d.ts +0 -5
- package/dist/components/Wallet/WalletProviders/ImtblPassportProvider.js +39 -36
- package/dist/components/Wallet/WalletProviders/SolanaProvider.d.ts +0 -5
- package/dist/components/Wallet/WalletProviders/SolanaProvider.js +49 -38
- package/dist/components/Wallet/WalletProviders/StarknetProvider.d.ts +0 -5
- package/dist/components/Wallet/WalletProviders/StarknetProvider.js +112 -117
- package/dist/components/Wallet/WalletProviders/TonConnectProvider.d.ts +0 -6
- package/dist/components/Wallet/WalletProviders/TonConnectProvider.js +58 -50
- package/dist/components/Wallet/WalletProviders/TronProvider.d.ts +0 -3
- package/dist/components/Wallet/WalletProviders/TronProvider.js +23 -15
- package/dist/components/Wallet/WalletProviders/Wagmi.d.ts +1 -1
- package/dist/components/Wallet/WalletProviders/Wagmi.js +20 -10
- package/dist/components/Wallet/WalletProviders/index.js +13 -6
- package/dist/components/Widget/Footer.d.ts +2 -1
- package/dist/components/Widget/Footer.js +13 -4
- package/dist/components/Widget/Index.d.ts +1 -1
- package/dist/components/Widget/Index.js +1 -1
- package/dist/components/WidgetLoading.d.ts +1 -0
- package/dist/components/WidgetLoading.js +5 -0
- package/dist/components/Wizard/Wizard.js +1 -1
- package/dist/components/shadcn/command.js +1 -1
- package/dist/components/themeWrapper.js +3 -2
- package/dist/context/{LayerswapContext.d.ts → LayerswapProvider.d.ts} +3 -8
- package/dist/context/{LayerswapContext.js → LayerswapProvider.js} +8 -9
- package/dist/context/authContext.js +1 -0
- package/dist/context/walletHooksProvider.js +1 -0
- package/dist/hooks/useWallet.js +10 -14
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.js +2 -4
- package/dist/index.mjs +19 -0
- package/dist/lib/AppSettings.d.ts +7 -3
- package/dist/lib/AppSettings.js +8 -7
- package/dist/lib/address/formatter/index.js +8 -9
- package/dist/lib/address/validator/index.js +18 -20
- package/dist/lib/axiosInterceptor.js +1 -2
- package/dist/lib/balances/balanceResolver.js +16 -16
- package/dist/lib/balances/providers/evmBalanceProvider.js +3 -3
- package/dist/lib/balances/providers/loopringBalanceProvider.d.ts +0 -6
- package/dist/lib/balances/providers/loopringBalanceProvider.js +56 -43
- package/dist/lib/balances/providers/paradexBalanceProvider.d.ts +0 -6
- package/dist/lib/balances/providers/paradexBalanceProvider.js +42 -42
- package/dist/lib/balances/providers/solanaBalanceProvider.d.ts +0 -6
- package/dist/lib/balances/providers/solanaBalanceProvider.js +70 -71
- package/dist/lib/balances/providers/starknetBalanceProvider.d.ts +0 -6
- package/dist/lib/balances/providers/starknetBalanceProvider.js +48 -45
- package/dist/lib/balances/providers/tonBalanceProvider.d.ts +0 -18
- package/dist/lib/balances/providers/tonBalanceProvider.js +104 -100
- package/dist/lib/balances/providers/tronBalanceResolver.js +2 -3
- package/dist/lib/fuels/common/FakeAccount.d.ts +0 -24
- package/dist/lib/fuels/common/FakeAccount.js +58 -36
- package/dist/lib/fuels/common/PredicateConnector.d.ts +0 -54
- package/dist/lib/fuels/common/PredicateConnector.js +292 -205
- package/dist/lib/fuels/common/PredicateFactory.d.ts +0 -29
- package/dist/lib/fuels/common/PredicateFactory.js +123 -76
- package/dist/lib/fuels/common/PredicateWalletAdapter.d.ts +0 -17
- package/dist/lib/fuels/common/PredicateWalletAdapter.js +44 -29
- package/dist/lib/fuels/common/index.d.ts +0 -4
- package/dist/lib/fuels/common/index.js +4 -4
- package/dist/lib/fuels/connectors/fuel-wallet/FuelWalletConnector.d.ts +0 -51
- package/dist/lib/fuels/connectors/fuel-wallet/FuelWalletConnector.js +268 -234
- package/dist/lib/fuels/connectors/fuel-wallet/index.d.ts +0 -2
- package/dist/lib/fuels/connectors/fuel-wallet/index.js +2 -2
- package/dist/lib/fuels/connectors/fuel-wallet/types.d.ts +0 -50
- package/dist/lib/fuels/connectors/fuel-wallet/types.js +53 -9
- package/dist/lib/fuels/connectors/fuelet-wallet/FueletWalletConnector.d.ts +0 -7
- package/dist/lib/fuels/connectors/fuelet-wallet/FueletWalletConnector.js +20 -19
- package/dist/lib/fuels/connectors/fuelet-wallet/index.d.ts +0 -1
- package/dist/lib/fuels/connectors/fuelet-wallet/index.js +1 -1
- package/dist/lib/gases/gasResolver.d.ts +1 -1
- package/dist/lib/gases/gasResolver.js +10 -10
- package/dist/lib/gases/providers/evmGasProvider.js +5 -4
- package/dist/lib/gases/providers/loopringGasProvider.d.ts +0 -6
- package/dist/lib/gases/providers/loopringGasProvider.js +27 -24
- package/dist/lib/gases/providers/solanaGasProvider.d.ts +0 -7
- package/dist/lib/gases/providers/solanaGasProvider.js +32 -31
- package/dist/lib/gases/providers/starknetGasProvider.d.ts +0 -7
- package/dist/lib/gases/providers/starknetGasProvider.js +34 -33
- package/dist/lib/imtbl.d.ts +0 -69
- package/dist/lib/imtbl.js +63 -60
- package/dist/lib/internalApiClient.d.ts +0 -2
- package/dist/lib/internalApiClient.js +1 -4
- package/dist/lib/layerSwapApiClient.js +3 -3
- package/dist/lib/logError.js +2 -2
- package/dist/lib/nft/nftBalanceResolver.js +1 -2
- package/dist/lib/nft/providers/starknetNftProvider.d.ts +0 -6
- package/dist/lib/nft/providers/starknetNftProvider.js +49 -50
- package/dist/lib/wallets/connectors/EthereumProvider.d.ts +2 -2
- package/dist/lib/wallets/connectors/useSyncProviders/store.d.ts +1 -4
- package/dist/lib/wallets/fuel/Bako.d.ts +0 -15
- package/dist/lib/wallets/fuel/Bako.js +34 -29
- package/dist/lib/wallets/fuel/Basko.d.ts +0 -15
- package/dist/lib/wallets/fuel/Basko.js +34 -29
- package/dist/lib/wallets/fuel/useFuel.d.ts +0 -2
- package/dist/lib/wallets/fuel/useFuel.js +211 -192
- package/dist/lib/wallets/imtblX/useImtblX.d.ts +0 -2
- package/dist/lib/wallets/imtblX/useImtblX.js +87 -87
- package/dist/lib/wallets/paradex/Authorize/Ethereum.d.ts +0 -2
- package/dist/lib/wallets/paradex/Authorize/Ethereum.js +24 -23
- package/dist/lib/wallets/paradex/Authorize/Starknet.d.ts +0 -2
- package/dist/lib/wallets/paradex/Authorize/Starknet.js +14 -13
- package/dist/lib/wallets/paradex/lib/account.d.ts +0 -28
- package/dist/lib/wallets/paradex/lib/account.js +102 -53
- package/dist/lib/wallets/paradex/lib/index.d.ts +0 -24
- package/dist/lib/wallets/paradex/lib/index.js +20 -20
- package/dist/lib/wallets/paradex/lib/paraclear-provider.d.ts +0 -6
- package/dist/lib/wallets/paradex/lib/paraclear-provider.js +13 -9
- package/dist/lib/wallets/paradex/lib/paraclear.d.ts +0 -137
- package/dist/lib/wallets/paradex/lib/paraclear.js +258 -131
- package/dist/lib/wallets/paradex/lib/starknet-account-support.d.ts +0 -22
- package/dist/lib/wallets/paradex/lib/starknet-account-support.js +296 -220
- package/dist/lib/wallets/paradex/lib/starknet-signer.d.ts +0 -15
- package/dist/lib/wallets/paradex/lib/starknet-signer.js +120 -94
- package/dist/lib/wallets/paradex/useParadex.d.ts +0 -7
- package/dist/lib/wallets/paradex/useParadex.js +197 -194
- package/dist/lib/wallets/solana/transactionBuilder.d.ts +0 -4
- package/dist/lib/wallets/solana/transactionBuilder.js +63 -39
- package/dist/lib/wallets/solana/useSVM.d.ts +0 -5
- package/dist/lib/wallets/solana/useSVM.js +139 -142
- package/dist/lib/wallets/starknet/useStarknet.d.ts +0 -2
- package/dist/lib/wallets/starknet/useStarknet.js +139 -139
- package/dist/lib/wallets/ton/client.d.ts +0 -3
- package/dist/lib/wallets/ton/client.js +7 -7
- package/dist/lib/wallets/ton/useTON.d.ts +0 -2
- package/dist/lib/wallets/ton/useTON.js +121 -122
- package/dist/lib/wallets/tron/connectors/bitkeep.d.ts +0 -61
- package/dist/lib/wallets/tron/connectors/bitkeep.js +326 -303
- package/dist/lib/wallets/tron/connectors/index.d.ts +0 -4
- package/dist/lib/wallets/tron/connectors/index.js +4 -4
- package/dist/lib/wallets/tron/connectors/okxWallet.d.ts +0 -66
- package/dist/lib/wallets/tron/connectors/okxWallet.js +364 -336
- package/dist/lib/wallets/tron/connectors/tokenPocket.d.ts +0 -72
- package/dist/lib/wallets/tron/connectors/tokenPocket.js +337 -308
- package/dist/lib/wallets/tron/connectors/tronLink/index.d.ts +0 -102
- package/dist/lib/wallets/tron/connectors/tronLink/index.js +560 -520
- package/dist/lib/wallets/tron/connectors/tronLink/types.d.ts +0 -56
- package/dist/lib/wallets/tron/connectors/tronLink/types.js +53 -1
- package/dist/lib/wallets/tron/connectors/tronLink/utils.d.ts +0 -14
- package/dist/lib/wallets/tron/connectors/tronLink/utils.js +64 -61
- package/dist/lib/wallets/tron/useTron.d.ts +0 -2
- package/dist/lib/wallets/tron/useTron.js +111 -111
- package/dist/lib/wallets/utils/resolveWalletIcon.js +1 -0
- package/package.json +26 -77
- package/dist/hooks/useCopyClipboard.d.ts +0 -1
- package/dist/hooks/useCopyClipboard.js +0 -21
- package/dist/index.cjs +0 -125
- package/dist/lib/abis/ERC20.json +0 -258
- package/dist/lib/fuels/connectors/walletConnect/WalletConnectConnector.d.ts +0 -42
- package/dist/lib/fuels/connectors/walletConnect/WalletConnectConnector.js +0 -357
- package/dist/lib/fuels/connectors/walletConnect/constants.d.ts +0 -6
- package/dist/lib/fuels/connectors/walletConnect/constants.js +0 -7
- package/dist/lib/fuels/connectors/walletConnect/index.d.ts +0 -3
- package/dist/lib/fuels/connectors/walletConnect/index.js +0 -3
- package/dist/lib/fuels/connectors/walletConnect/types.d.ts +0 -12
- package/dist/lib/fuels/connectors/walletConnect/types.js +0 -1
- package/dist/lib/fuels/connectors/walletConnect/utils/index.d.ts +0 -1
- package/dist/lib/fuels/connectors/walletConnect/utils/index.js +0 -1
- package/dist/lib/fuels/connectors/walletConnect/utils/subscribeAndEnforceChain.d.ts +0 -2
- package/dist/lib/fuels/connectors/walletConnect/utils/subscribeAndEnforceChain.js +0 -39
- package/dist/lib/fuels/connectors/walletConnect/web3Modal.d.ts +0 -10
- package/dist/lib/fuels/connectors/walletConnect/web3Modal.js +0 -38
- package/dist/lib/loopring/LoopringAPI.d.ts +0 -12
- package/dist/lib/loopring/LoopringAPI.js +0 -13
- package/dist/lib/loopring/defs.d.ts +0 -425
- package/dist/lib/loopring/defs.js +0 -217
- package/dist/lib/loopring/eddsa.d.ts +0 -29
- package/dist/lib/loopring/eddsa.js +0 -208
- package/dist/lib/loopring/field.d.ts +0 -17
- package/dist/lib/loopring/field.js +0 -61
- package/dist/lib/loopring/formatter.d.ts +0 -137
- package/dist/lib/loopring/formatter.js +0 -516
- package/dist/lib/loopring/helpers.d.ts +0 -36
- package/dist/lib/loopring/helpers.js +0 -140
- package/dist/lib/loopring/jubjub.d.ts +0 -19
- package/dist/lib/loopring/jubjub.js +0 -79
- package/dist/lib/loopring/permutation.d.ts +0 -22
- package/dist/lib/loopring/permutation.js +0 -198
- package/dist/lib/loopring/poseidon/EDDSAUtil.d.ts +0 -14
- package/dist/lib/loopring/poseidon/EDDSAUtil.js +0 -61
- package/dist/lib/loopring/poseidon/babyJub.d.ts +0 -6
- package/dist/lib/loopring/poseidon/babyJub.js +0 -51
- package/dist/lib/loopring/poseidon/eddsa.d.ts +0 -29
- package/dist/lib/loopring/poseidon/eddsa.js +0 -210
- package/dist/lib/loopring/utils.d.ts +0 -76
- package/dist/lib/loopring/utils.js +0 -230
- package/dist/styles/dialog-transition.css +0 -28
- package/dist/styles/globals.css +0 -372
- package/dist/styles/manual-trasnfer-svg.css +0 -299
- package/dist/styles/vaul.css +0 -256
package/dist/components/Pages/SwapPages/Withdraw/Wallet/SVMWalletWithdraw/transactionSender.js
CHANGED
|
@@ -1,75 +1,96 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
1
|
+
// import {
|
|
2
|
+
// BlockhashWithExpiryBlockHeight,
|
|
3
|
+
// Connection,
|
|
4
|
+
// TransactionExpiredBlockheightExceededError,
|
|
5
|
+
// VersionedTransactionResponse,
|
|
6
|
+
// } from "@solana/web3.js";
|
|
7
|
+
// import { retry } from "../../../../../../lib/retry";
|
|
8
|
+
// type TransactionSenderAndConfirmationWaiterArgs = {
|
|
9
|
+
// connection: Connection;
|
|
10
|
+
// serializedTransaction: Buffer;
|
|
11
|
+
// blockhashWithExpiryBlockHeight: BlockhashWithExpiryBlockHeight;
|
|
12
|
+
// };
|
|
13
|
+
// const SEND_OPTIONS = {
|
|
14
|
+
// skipPreflight: true,
|
|
15
|
+
// };
|
|
16
|
+
// export async function transactionSenderAndConfirmationWaiter({
|
|
17
|
+
// connection,
|
|
18
|
+
// serializedTransaction,
|
|
19
|
+
// blockhashWithExpiryBlockHeight,
|
|
20
|
+
// }: TransactionSenderAndConfirmationWaiterArgs): Promise<VersionedTransactionResponse | null> {
|
|
21
|
+
// const txid = await connection.sendRawTransaction(
|
|
22
|
+
// serializedTransaction,
|
|
23
|
+
// SEND_OPTIONS
|
|
24
|
+
// );
|
|
25
|
+
// const controller = new AbortController();
|
|
26
|
+
// const abortSignal = controller.signal;
|
|
27
|
+
// const abortableResender = async () => {
|
|
28
|
+
// while (true) {
|
|
29
|
+
// await sleep(2000);
|
|
30
|
+
// if (abortSignal.aborted) return;
|
|
31
|
+
// try {
|
|
32
|
+
// await connection.sendRawTransaction(
|
|
33
|
+
// serializedTransaction,
|
|
34
|
+
// SEND_OPTIONS
|
|
35
|
+
// );
|
|
36
|
+
// } catch (e) {
|
|
37
|
+
// console.warn(`Failed to resend transaction: ${e}`);
|
|
38
|
+
// }
|
|
39
|
+
// }
|
|
40
|
+
// };
|
|
41
|
+
// try {
|
|
42
|
+
// abortableResender();
|
|
43
|
+
// const lastValidBlockHeight =
|
|
44
|
+
// blockhashWithExpiryBlockHeight.lastValidBlockHeight;
|
|
45
|
+
// // this would throw TransactionExpiredBlockheightExceededError
|
|
46
|
+
// await Promise.race([
|
|
47
|
+
// connection.confirmTransaction(
|
|
48
|
+
// {
|
|
49
|
+
// ...blockhashWithExpiryBlockHeight,
|
|
50
|
+
// lastValidBlockHeight,
|
|
51
|
+
// signature: txid,
|
|
52
|
+
// },
|
|
53
|
+
// "confirmed"
|
|
54
|
+
// ),
|
|
55
|
+
// new Promise(async (resolve) => {
|
|
56
|
+
// // in case ws socket died
|
|
57
|
+
// while (!abortSignal.aborted) {
|
|
58
|
+
// await sleep(2000);
|
|
59
|
+
// const tx = await connection.getSignatureStatus(txid, {
|
|
60
|
+
// searchTransactionHistory: false,
|
|
61
|
+
// });
|
|
62
|
+
// if (tx?.value?.confirmationStatus === "confirmed") {
|
|
63
|
+
// resolve(tx);
|
|
64
|
+
// }
|
|
65
|
+
// }
|
|
66
|
+
// }),
|
|
67
|
+
// ]);
|
|
68
|
+
// } catch (e) {
|
|
69
|
+
// if (e instanceof TransactionExpiredBlockheightExceededError) {
|
|
70
|
+
// // we consume this error and getTransaction would return null
|
|
71
|
+
// return null;
|
|
72
|
+
// } else {
|
|
73
|
+
// // invalid state from web3.js
|
|
74
|
+
// throw e;
|
|
75
|
+
// }
|
|
76
|
+
// } finally {
|
|
77
|
+
// controller.abort();
|
|
78
|
+
// }
|
|
79
|
+
// // in case rpc is not synced yet, we add some retries
|
|
80
|
+
// const response = retry(
|
|
81
|
+
// async () => {
|
|
82
|
+
// const response = await connection.getTransaction(txid, {
|
|
83
|
+
// commitment: "confirmed",
|
|
84
|
+
// maxSupportedTransactionVersion: 0,
|
|
85
|
+
// });
|
|
86
|
+
// if (!response) {
|
|
87
|
+
// throw new Error("Transaction not found");
|
|
88
|
+
// }
|
|
89
|
+
// return response;
|
|
90
|
+
// }
|
|
91
|
+
// );
|
|
92
|
+
// return response;
|
|
93
|
+
// }
|
|
94
|
+
// function sleep(ms) {
|
|
95
|
+
// return new Promise(resolve => setTimeout(resolve, ms));
|
|
96
|
+
// }
|
|
@@ -10,7 +10,7 @@ import { createWalletClient, custom } from 'viem';
|
|
|
10
10
|
import { eip712WalletActions, getGeneralPaymasterInput } from 'viem/zksync';
|
|
11
11
|
import KnownInternalNames from '../../../../../lib/knownIds';
|
|
12
12
|
import TransactionMessages from '../Messages/TransactionMessages';
|
|
13
|
-
import { datadogRum } from '@datadog/browser-rum';
|
|
13
|
+
// import { datadogRum } from '@datadog/browser-rum';
|
|
14
14
|
import WalletIcon from '../../../../Icons/WalletIcon';
|
|
15
15
|
import { getTransactionCount } from '@wagmi/core';
|
|
16
16
|
const SophonWalletWithdraw = ({ amount, depositAddress, network, token, swapId, callData }) => {
|
|
@@ -92,7 +92,7 @@ const TransactionMessage = ({ isLoading, error }) => {
|
|
|
92
92
|
const swapWithdrawalError = new Error(error);
|
|
93
93
|
swapWithdrawalError.name = `SwapWithdrawalError`;
|
|
94
94
|
swapWithdrawalError.cause = error;
|
|
95
|
-
datadogRum.addError(swapWithdrawalError);
|
|
95
|
+
// datadogRum.addError(swapWithdrawalError);
|
|
96
96
|
return _jsx(TransactionMessages.UexpectedErrorMessage, { message: error });
|
|
97
97
|
}
|
|
98
98
|
else
|
|
@@ -1,71 +1,88 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { ConnectWalletButton } from './WalletTransfer/buttons';
|
|
10
|
-
import TransactionMessages from '../Messages/TransactionMessages';
|
|
11
|
-
import { datadogRum } from '@datadog/browser-rum';
|
|
12
|
-
const StarknetWalletWithdrawStep = ({ network, token, callData, swapId }) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
1
|
+
// import { FC, useCallback, useState } from 'react'
|
|
2
|
+
// import SubmitButton from '../../../../Buttons/submitButton';
|
|
3
|
+
// import { BackendTransactionStatus } from '../../../../../lib/layerSwapApiClient';
|
|
4
|
+
// import { useAuthState } from '../../../../../context/authContext';
|
|
5
|
+
// import useWallet from '../../../../../hooks/useWallet';
|
|
6
|
+
// import { useSwapTransactionStore } from '../../../../../stores/swapTransactionStore';
|
|
7
|
+
// import WalletIcon from '../../../../Icons/WalletIcon';
|
|
8
|
+
// import { WithdrawPageProps } from './WalletTransferContent';
|
|
9
|
+
// import { ConnectWalletButton } from './WalletTransfer/buttons';
|
|
10
|
+
// import TransactionMessages from '../Messages/TransactionMessages';
|
|
11
|
+
// import { datadogRum } from '@datadog/browser-rum';
|
|
12
|
+
// const StarknetWalletWithdrawStep: FC<WithdrawPageProps> = ({ network, token, callData, swapId }) => {
|
|
13
|
+
// const [error, setError] = useState<string | undefined>()
|
|
14
|
+
// const [loading, setLoading] = useState(false)
|
|
15
|
+
// const [transferDone, setTransferDone] = useState<boolean>()
|
|
16
|
+
// const { provider } = useWallet(network, 'withdrawal')
|
|
17
|
+
// const { userId } = useAuthState()
|
|
18
|
+
// const { setSwapTransaction } = useSwapTransactionStore();
|
|
19
|
+
// const wallet = provider?.activeWallet
|
|
20
|
+
// const handleTransfer = useCallback(async () => {
|
|
21
|
+
// if (!swapId || !token) {
|
|
22
|
+
// return
|
|
23
|
+
// }
|
|
24
|
+
// setLoading(true)
|
|
25
|
+
// try {
|
|
26
|
+
// if (!wallet) {
|
|
27
|
+
// throw Error("Starknet wallet not connected")
|
|
28
|
+
// }
|
|
29
|
+
// const { transaction_hash: transferTxHash } = (await wallet?.metadata?.starknetAccount?.execute(JSON.parse(callData || "")) || {});
|
|
30
|
+
// if (transferTxHash) {
|
|
31
|
+
// setSwapTransaction(swapId, BackendTransactionStatus.Completed, transferTxHash);
|
|
32
|
+
// setTransferDone(true)
|
|
33
|
+
// }
|
|
34
|
+
// else {
|
|
35
|
+
// setError('failedTransfer')
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
38
|
+
// catch (e) {
|
|
39
|
+
// setError(e.message)
|
|
40
|
+
// }
|
|
41
|
+
// finally {
|
|
42
|
+
// setLoading(false)
|
|
43
|
+
// }
|
|
44
|
+
// }, [wallet, swapId, network, userId, token, callData])
|
|
45
|
+
// if (!wallet) {
|
|
46
|
+
// return <ConnectWalletButton />
|
|
47
|
+
// }
|
|
48
|
+
// return (
|
|
49
|
+
// <div className="w-full space-y-3 flex flex-col justify-between h-full text-secondary-text">
|
|
50
|
+
// <TransactionMessage isLoading={loading} error={error} />
|
|
51
|
+
// {
|
|
52
|
+
// !loading &&
|
|
53
|
+
// <SubmitButton
|
|
54
|
+
// isDisabled={!!(loading || transferDone) || !wallet}
|
|
55
|
+
// isSubmitting={!!(loading || transferDone)}
|
|
56
|
+
// onClick={handleTransfer}
|
|
57
|
+
// icon={
|
|
58
|
+
// <WalletIcon
|
|
59
|
+
// className="h-6 w-6 stroke-2"
|
|
60
|
+
// aria-hidden="true"
|
|
61
|
+
// />
|
|
62
|
+
// } >
|
|
63
|
+
// {error ? 'Try again' : 'Send from wallet'}
|
|
64
|
+
// </SubmitButton>
|
|
65
|
+
// }
|
|
66
|
+
// </div >
|
|
67
|
+
// )
|
|
68
|
+
// }
|
|
69
|
+
// const TransactionMessage: FC<{ isLoading: boolean, error: string | undefined }> = ({ isLoading, error }) => {
|
|
70
|
+
// if (isLoading) {
|
|
71
|
+
// return <TransactionMessages.ConfirmTransactionMessage />
|
|
72
|
+
// }
|
|
73
|
+
// else if (error === "An error occurred (USER_REFUSED_OP)" || error === "Execute failed") {
|
|
74
|
+
// return <TransactionMessages.TransactionRejectedMessage />
|
|
75
|
+
// }
|
|
76
|
+
// else if (error === "failedTransfer") {
|
|
77
|
+
// return <TransactionMessages.TransactionFailedMessage />
|
|
78
|
+
// }
|
|
79
|
+
// else if (error) {
|
|
80
|
+
// const swapWithdrawalError = new Error(error);
|
|
81
|
+
// swapWithdrawalError.name = `SwapWithdrawalError`;
|
|
82
|
+
// swapWithdrawalError.cause = error;
|
|
83
|
+
// datadogRum.addError(swapWithdrawalError);
|
|
84
|
+
// return <TransactionMessages.UexpectedErrorMessage message={error} />
|
|
85
|
+
// }
|
|
86
|
+
// else return <></>
|
|
87
|
+
// }
|
|
88
|
+
// export default StarknetWalletWithdrawStep;
|