@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
|
@@ -1,234 +1,268 @@
|
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
1
|
+
// import {
|
|
2
|
+
// Address,
|
|
3
|
+
// type Asset,
|
|
4
|
+
// type AssetFuel,
|
|
5
|
+
// type ConnectorMetadata,
|
|
6
|
+
// type FuelABI,
|
|
7
|
+
// FuelConnector,
|
|
8
|
+
// FuelConnectorEventType,
|
|
9
|
+
// FuelConnectorEventTypes,
|
|
10
|
+
// type Network,
|
|
11
|
+
// Provider,
|
|
12
|
+
// type SelectNetworkArguments,
|
|
13
|
+
// type TransactionRequestLike,
|
|
14
|
+
// type Version,
|
|
15
|
+
// transactionRequestify,
|
|
16
|
+
// } from 'fuels';
|
|
17
|
+
// import type { JSONRPCRequest } from 'json-rpc-2.0';
|
|
18
|
+
// import { JSONRPCClient } from 'json-rpc-2.0';
|
|
19
|
+
// import {
|
|
20
|
+
// APP_IMAGE,
|
|
21
|
+
// CONNECTOR_SCRIPT,
|
|
22
|
+
// CONTENT_SCRIPT_NAME,
|
|
23
|
+
// EVENT_MESSAGE,
|
|
24
|
+
// } from './constants';
|
|
25
|
+
// import {
|
|
26
|
+
// type CommunicationMessage,
|
|
27
|
+
// type EventMessage,
|
|
28
|
+
// MessageTypes,
|
|
29
|
+
// type ResponseMessage,
|
|
30
|
+
// } from './types';
|
|
31
|
+
// export class FuelWalletConnector extends FuelConnector {
|
|
32
|
+
// name = '';
|
|
33
|
+
// connected = false;
|
|
34
|
+
// installed = false;
|
|
35
|
+
// external = false;
|
|
36
|
+
// events = FuelConnectorEventTypes;
|
|
37
|
+
// metadata: ConnectorMetadata = {
|
|
38
|
+
// image: APP_IMAGE,
|
|
39
|
+
// install: {
|
|
40
|
+
// action: 'Install',
|
|
41
|
+
// description:
|
|
42
|
+
// 'To connect your Fuel Wallet, install the browser extension.',
|
|
43
|
+
// link: 'https://chrome.google.com/webstore/detail/fuel-wallet/dldjpboieedgcmpkchcjcbijingjcgok',
|
|
44
|
+
// },
|
|
45
|
+
// };
|
|
46
|
+
// readonly client: JSONRPCClient;
|
|
47
|
+
// constructor(name = 'Fuel Wallet') {
|
|
48
|
+
// super();
|
|
49
|
+
// this.name = name;
|
|
50
|
+
// this.setMaxListeners(100);
|
|
51
|
+
// this.client = new JSONRPCClient(
|
|
52
|
+
// this.sendRequest.bind(this),
|
|
53
|
+
// this.createRequestId,
|
|
54
|
+
// );
|
|
55
|
+
// this.setupListener();
|
|
56
|
+
// this.setupConnector();
|
|
57
|
+
// }
|
|
58
|
+
// /**
|
|
59
|
+
// * ============================================================
|
|
60
|
+
// * Application communication methods
|
|
61
|
+
// * ============================================================
|
|
62
|
+
// */
|
|
63
|
+
// private async setupConnector() {
|
|
64
|
+
// if (typeof window !== 'undefined') {
|
|
65
|
+
// this.ping()
|
|
66
|
+
// .then(() => {
|
|
67
|
+
// window.dispatchEvent(
|
|
68
|
+
// new CustomEvent(FuelConnectorEventType, { detail: this }),
|
|
69
|
+
// );
|
|
70
|
+
// })
|
|
71
|
+
// .catch(() => {});
|
|
72
|
+
// }
|
|
73
|
+
// }
|
|
74
|
+
// private acceptMessage(message: MessageEvent<CommunicationMessage>): boolean {
|
|
75
|
+
// const { data: event } = message;
|
|
76
|
+
// return (
|
|
77
|
+
// message.origin === window.origin &&
|
|
78
|
+
// event.type !== MessageTypes.request &&
|
|
79
|
+
// event.connectorName === this.name &&
|
|
80
|
+
// event.target === CONNECTOR_SCRIPT
|
|
81
|
+
// );
|
|
82
|
+
// }
|
|
83
|
+
// private setupListener() {
|
|
84
|
+
// if (typeof window === 'undefined') return;
|
|
85
|
+
// window.addEventListener(EVENT_MESSAGE, this.onMessage.bind(this));
|
|
86
|
+
// }
|
|
87
|
+
// private createRequestId(): string {
|
|
88
|
+
// return crypto.randomUUID();
|
|
89
|
+
// }
|
|
90
|
+
// private postMessage(message: CommunicationMessage, origin?: string) {
|
|
91
|
+
// window.postMessage(message, origin || window.origin);
|
|
92
|
+
// }
|
|
93
|
+
// private async sendRequest(request: JSONRPCRequest | null) {
|
|
94
|
+
// if (!request) return;
|
|
95
|
+
// this.postMessage({
|
|
96
|
+
// type: MessageTypes.request,
|
|
97
|
+
// target: CONTENT_SCRIPT_NAME,
|
|
98
|
+
// connectorName: this.name,
|
|
99
|
+
// request,
|
|
100
|
+
// });
|
|
101
|
+
// }
|
|
102
|
+
// private onResponse(message: ResponseMessage): void {
|
|
103
|
+
// this.client.receive(message.response);
|
|
104
|
+
// }
|
|
105
|
+
// private onEvent(message: EventMessage): void {
|
|
106
|
+
// message.events.forEach((eventData) => {
|
|
107
|
+
// if (eventData.event === 'start') {
|
|
108
|
+
// this.setupConnector();
|
|
109
|
+
// } else {
|
|
110
|
+
// this.emit(eventData.event, ...eventData.params);
|
|
111
|
+
// }
|
|
112
|
+
// });
|
|
113
|
+
// }
|
|
114
|
+
// private onMessage = (message: MessageEvent<CommunicationMessage>) => {
|
|
115
|
+
// const messageFroze = Object.freeze(message);
|
|
116
|
+
// if (!this.acceptMessage(messageFroze)) return;
|
|
117
|
+
// const { data: event } = messageFroze;
|
|
118
|
+
// this.onCommunicationMessage(event);
|
|
119
|
+
// };
|
|
120
|
+
// private onCommunicationMessage = (message: CommunicationMessage) => {
|
|
121
|
+
// switch (message.type) {
|
|
122
|
+
// case MessageTypes.response:
|
|
123
|
+
// this.onResponse(message);
|
|
124
|
+
// break;
|
|
125
|
+
// case MessageTypes.event:
|
|
126
|
+
// this.onEvent(message);
|
|
127
|
+
// break;
|
|
128
|
+
// default:
|
|
129
|
+
// }
|
|
130
|
+
// };
|
|
131
|
+
// /**
|
|
132
|
+
// * ============================================================
|
|
133
|
+
// * Connector methods
|
|
134
|
+
// * ============================================================
|
|
135
|
+
// */
|
|
136
|
+
// async ping(): Promise<boolean> {
|
|
137
|
+
// return this.client.timeout(800).request('ping', {});
|
|
138
|
+
// }
|
|
139
|
+
// async isConnected(): Promise<boolean> {
|
|
140
|
+
// // If the wallet not exists or not connected, return false
|
|
141
|
+
// try {
|
|
142
|
+
// return await this.client.request('isConnected', {});
|
|
143
|
+
// } catch {
|
|
144
|
+
// return false;
|
|
145
|
+
// }
|
|
146
|
+
// }
|
|
147
|
+
// async connect(): Promise<boolean> {
|
|
148
|
+
// return this.client.request('connect', {});
|
|
149
|
+
// }
|
|
150
|
+
// async disconnect(): Promise<boolean> {
|
|
151
|
+
// return this.client.request('disconnect', {});
|
|
152
|
+
// }
|
|
153
|
+
// async accounts(): Promise<Array<string>> {
|
|
154
|
+
// const accounts = await this.client.request('accounts', {});
|
|
155
|
+
// return accounts;
|
|
156
|
+
// }
|
|
157
|
+
// async currentAccount(): Promise<string | null> {
|
|
158
|
+
// const account = await this.client.request('currentAccount', {});
|
|
159
|
+
// if (!account) return null;
|
|
160
|
+
// return Address.fromDynamicInput(account).toString();
|
|
161
|
+
// }
|
|
162
|
+
// async signMessage(address: string, message: string): Promise<string> {
|
|
163
|
+
// if (!message.trim()) {
|
|
164
|
+
// throw new Error('Message is required');
|
|
165
|
+
// }
|
|
166
|
+
// return this.client.request('signMessage', {
|
|
167
|
+
// address,
|
|
168
|
+
// message,
|
|
169
|
+
// });
|
|
170
|
+
// }
|
|
171
|
+
// async sendTransaction(
|
|
172
|
+
// address: string,
|
|
173
|
+
// transaction: TransactionRequestLike,
|
|
174
|
+
// ): Promise<string> {
|
|
175
|
+
// if (!transaction) {
|
|
176
|
+
// throw new Error('Transaction is required');
|
|
177
|
+
// }
|
|
178
|
+
// // Transform transaction object to a transaction request
|
|
179
|
+
// const txRequest = transactionRequestify(transaction);
|
|
180
|
+
// /**
|
|
181
|
+
// * @todo We should remove this once the chainId standard start to be used and chainId is required
|
|
182
|
+
// * to be correct according to the network the transaction wants to target.
|
|
183
|
+
// */
|
|
184
|
+
// const network = await this.currentNetwork();
|
|
185
|
+
// const provider = {
|
|
186
|
+
// url: network.url,
|
|
187
|
+
// };
|
|
188
|
+
// return this.client.request('sendTransaction', {
|
|
189
|
+
// address,
|
|
190
|
+
// transaction: JSON.stringify(txRequest),
|
|
191
|
+
// provider,
|
|
192
|
+
// });
|
|
193
|
+
// }
|
|
194
|
+
// async assets(): Promise<Array<Asset>> {
|
|
195
|
+
// return this.client.request('assets', {});
|
|
196
|
+
// }
|
|
197
|
+
// async addAsset(asset: Asset): Promise<boolean> {
|
|
198
|
+
// return this.addAssets([asset]);
|
|
199
|
+
// }
|
|
200
|
+
// async addAssets(assets: Asset[]): Promise<boolean> {
|
|
201
|
+
// /**
|
|
202
|
+
// * @todo: Remove this once Fuel Wallet supports assets with multiple networks
|
|
203
|
+
// */
|
|
204
|
+
// const assetsData = assets.map((asset) => {
|
|
205
|
+
// const fuelNetworkAsset = asset.networks.find(
|
|
206
|
+
// (n) => n.type === 'fuel',
|
|
207
|
+
// ) as AssetFuel;
|
|
208
|
+
// if (!fuelNetworkAsset) {
|
|
209
|
+
// throw new Error('Asset for Fuel Network not found!');
|
|
210
|
+
// }
|
|
211
|
+
// return {
|
|
212
|
+
// ...asset,
|
|
213
|
+
// imageUrl: asset.icon,
|
|
214
|
+
// decimals: fuelNetworkAsset.decimals,
|
|
215
|
+
// assetId: fuelNetworkAsset.assetId,
|
|
216
|
+
// };
|
|
217
|
+
// });
|
|
218
|
+
// return this.client.request('addAssets', {
|
|
219
|
+
// assets: assetsData,
|
|
220
|
+
// });
|
|
221
|
+
// }
|
|
222
|
+
// async addABI(contractId: string, abi: FuelABI): Promise<boolean> {
|
|
223
|
+
// return this.client.request('addAbi', {
|
|
224
|
+
// abiMap: {
|
|
225
|
+
// [contractId]: abi,
|
|
226
|
+
// },
|
|
227
|
+
// });
|
|
228
|
+
// }
|
|
229
|
+
// async getABI(contractId: string): Promise<FuelABI> {
|
|
230
|
+
// return this.client.request('getAbi', {
|
|
231
|
+
// contractId,
|
|
232
|
+
// });
|
|
233
|
+
// }
|
|
234
|
+
// async hasABI(contractId: string): Promise<boolean> {
|
|
235
|
+
// const abi = await this.getABI(contractId);
|
|
236
|
+
// return !!abi;
|
|
237
|
+
// }
|
|
238
|
+
// async currentNetwork(): Promise<Network> {
|
|
239
|
+
// return this.client.request('network', {});
|
|
240
|
+
// }
|
|
241
|
+
// async selectNetwork(network: SelectNetworkArguments): Promise<boolean> {
|
|
242
|
+
// return this.client.request('selectNetwork', {
|
|
243
|
+
// network,
|
|
244
|
+
// });
|
|
245
|
+
// }
|
|
246
|
+
// async networks(): Promise<Network[]> {
|
|
247
|
+
// return this.client.request('networks', {});
|
|
248
|
+
// }
|
|
249
|
+
// async addNetwork(networkUrl: string): Promise<boolean> {
|
|
250
|
+
// /**
|
|
251
|
+
// * @todo: Remove fetch provider once Fuel Wallet supports adding networks
|
|
252
|
+
// * by URL
|
|
253
|
+
// */
|
|
254
|
+
// const provider = new Provider(networkUrl);
|
|
255
|
+
// return this.client.request('addNetwork', {
|
|
256
|
+
// network: {
|
|
257
|
+
// url: provider.url,
|
|
258
|
+
// name: (await provider.getChain()).name,
|
|
259
|
+
// },
|
|
260
|
+
// });
|
|
261
|
+
// }
|
|
262
|
+
// async version(): Promise<Version> {
|
|
263
|
+
// return this.client.request('version', {
|
|
264
|
+
// app: '0.0.0',
|
|
265
|
+
// network: '0.0.0',
|
|
266
|
+
// });
|
|
267
|
+
// }
|
|
268
|
+
// }
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './constants';
|
|
2
|
-
export { FuelWalletConnector } from './FuelWalletConnector';
|
|
3
|
-
export * from './types';
|
|
2
|
+
// export { FuelWalletConnector } from './FuelWalletConnector';
|
|
3
|
+
// export * from './types';
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { JSONRPCRequest, JSONRPCResponse } from 'json-rpc-2.0';
|
|
2
|
-
export declare enum MessageTypes {
|
|
3
|
-
ping = "ping",
|
|
4
|
-
uiEvent = "uiEvent",
|
|
5
|
-
event = "event",
|
|
6
|
-
request = "request",
|
|
7
|
-
response = "response",
|
|
8
|
-
removeConnection = "removeConnection"
|
|
9
|
-
}
|
|
10
|
-
export interface MessageSender {
|
|
11
|
-
id?: string | undefined;
|
|
12
|
-
origin?: string | undefined;
|
|
13
|
-
tab?: {
|
|
14
|
-
id?: number | undefined;
|
|
15
|
-
index?: number | undefined;
|
|
16
|
-
windowId?: number | undefined;
|
|
17
|
-
url?: string | undefined;
|
|
18
|
-
title?: string | undefined;
|
|
19
|
-
favIconUrl?: string | undefined;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
type BaseEvent<T> = {
|
|
23
|
-
readonly target: string;
|
|
24
|
-
readonly connectorName?: string;
|
|
25
|
-
readonly id?: string;
|
|
26
|
-
readonly sender?: MessageSender;
|
|
27
|
-
} & T;
|
|
28
|
-
export type EventMessageEvents = Array<{
|
|
29
|
-
event: string;
|
|
30
|
-
params: Array<unknown>;
|
|
31
|
-
}>;
|
|
32
|
-
export type UIEventMessage = BaseEvent<{
|
|
33
|
-
readonly type: MessageTypes.uiEvent;
|
|
34
|
-
readonly ready: boolean;
|
|
35
|
-
readonly session: string;
|
|
36
|
-
}>;
|
|
37
|
-
export type RequestMessage = BaseEvent<{
|
|
38
|
-
readonly type: MessageTypes.request;
|
|
39
|
-
readonly request: JSONRPCRequest;
|
|
40
|
-
}>;
|
|
41
|
-
export type ResponseMessage = BaseEvent<{
|
|
42
|
-
readonly type: MessageTypes.response;
|
|
43
|
-
readonly response: JSONRPCResponse;
|
|
44
|
-
}>;
|
|
45
|
-
export type EventMessage<T = EventMessageEvents> = BaseEvent<{
|
|
46
|
-
readonly type: MessageTypes.event;
|
|
47
|
-
readonly events: T;
|
|
48
|
-
}>;
|
|
49
|
-
export type CommunicationMessage = UIEventMessage | RequestMessage | ResponseMessage | EventMessage;
|
|
50
|
-
export {};
|
|
@@ -1,9 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
// import type { JSONRPCRequest, JSONRPCResponse } from 'json-rpc-2.0';
|
|
2
|
+
// export enum MessageTypes {
|
|
3
|
+
// ping = 'ping',
|
|
4
|
+
// uiEvent = 'uiEvent',
|
|
5
|
+
// event = 'event',
|
|
6
|
+
// request = 'request',
|
|
7
|
+
// response = 'response',
|
|
8
|
+
// removeConnection = 'removeConnection',
|
|
9
|
+
// }
|
|
10
|
+
// export interface MessageSender {
|
|
11
|
+
// id?: string | undefined;
|
|
12
|
+
// origin?: string | undefined;
|
|
13
|
+
// tab?: {
|
|
14
|
+
// id?: number | undefined;
|
|
15
|
+
// index?: number | undefined;
|
|
16
|
+
// windowId?: number | undefined;
|
|
17
|
+
// url?: string | undefined;
|
|
18
|
+
// title?: string | undefined;
|
|
19
|
+
// favIconUrl?: string | undefined;
|
|
20
|
+
// };
|
|
21
|
+
// }
|
|
22
|
+
// type BaseEvent<T> = {
|
|
23
|
+
// readonly target: string;
|
|
24
|
+
// readonly connectorName?: string;
|
|
25
|
+
// readonly id?: string;
|
|
26
|
+
// readonly sender?: MessageSender;
|
|
27
|
+
// } & T;
|
|
28
|
+
// export type EventMessageEvents = Array<{
|
|
29
|
+
// event: string;
|
|
30
|
+
// params: Array<unknown>;
|
|
31
|
+
// }>;
|
|
32
|
+
// export type UIEventMessage = BaseEvent<{
|
|
33
|
+
// readonly type: MessageTypes.uiEvent;
|
|
34
|
+
// readonly ready: boolean;
|
|
35
|
+
// readonly session: string;
|
|
36
|
+
// }>;
|
|
37
|
+
// export type RequestMessage = BaseEvent<{
|
|
38
|
+
// readonly type: MessageTypes.request;
|
|
39
|
+
// readonly request: JSONRPCRequest;
|
|
40
|
+
// }>;
|
|
41
|
+
// export type ResponseMessage = BaseEvent<{
|
|
42
|
+
// readonly type: MessageTypes.response;
|
|
43
|
+
// readonly response: JSONRPCResponse;
|
|
44
|
+
// }>;
|
|
45
|
+
// export type EventMessage<T = EventMessageEvents> = BaseEvent<{
|
|
46
|
+
// readonly type: MessageTypes.event;
|
|
47
|
+
// readonly events: T;
|
|
48
|
+
// }>;
|
|
49
|
+
// export type CommunicationMessage =
|
|
50
|
+
// | UIEventMessage
|
|
51
|
+
// | RequestMessage
|
|
52
|
+
// | ResponseMessage
|
|
53
|
+
// | EventMessage;
|