@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,100 +1,104 @@
|
|
|
1
|
-
import { datadogRum } from "@datadog/browser-rum";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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
|
-
const
|
|
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
|
-
|
|
1
|
+
// import { datadogRum } from "@datadog/browser-rum";
|
|
2
|
+
// import { Balance } from "../../../Models/Balance";
|
|
3
|
+
// import { Network, NetworkWithTokens, Token } from "../../../Models/Network";
|
|
4
|
+
// import formatAmount from "../../formatAmount";
|
|
5
|
+
// import KnownInternalNames from "../../knownIds";
|
|
6
|
+
// import retryWithExponentialBackoff from "../../retry";
|
|
7
|
+
// import tonClient from "../../wallets/ton/client";
|
|
8
|
+
// import { insertIfNotExists } from "./helpers";
|
|
9
|
+
// export class TonBalanceProvider {
|
|
10
|
+
// supportsNetwork(network: NetworkWithTokens): boolean {
|
|
11
|
+
// return KnownInternalNames.Networks.TONMainnet.includes(network.name)
|
|
12
|
+
// }
|
|
13
|
+
// fetchBalance = async (address: string, network: NetworkWithTokens) => {
|
|
14
|
+
// let balances: Balance[] = []
|
|
15
|
+
// const tokens = insertIfNotExists(network.tokens || [], network.token)
|
|
16
|
+
// for (const token of tokens) {
|
|
17
|
+
// try {
|
|
18
|
+
// const balance = await resolveBalance({ network, address, token })
|
|
19
|
+
// if (!balance) return
|
|
20
|
+
// balances = [
|
|
21
|
+
// ...balances,
|
|
22
|
+
// balance,
|
|
23
|
+
// ]
|
|
24
|
+
// }
|
|
25
|
+
// catch (e) {
|
|
26
|
+
// console.log(e)
|
|
27
|
+
// }
|
|
28
|
+
// }
|
|
29
|
+
// return balances
|
|
30
|
+
// }
|
|
31
|
+
// }
|
|
32
|
+
// export const resolveBalance = async ({ address, network, token }: {
|
|
33
|
+
// network: Network,
|
|
34
|
+
// token: Token,
|
|
35
|
+
// address: string
|
|
36
|
+
// }
|
|
37
|
+
// ) => {
|
|
38
|
+
// if (token.contract) {
|
|
39
|
+
// const res = await getJettonBalance({ network, token, address })
|
|
40
|
+
// return res
|
|
41
|
+
// }
|
|
42
|
+
// else {
|
|
43
|
+
// const res = await getNativeAssetBalance({ network, token, address })
|
|
44
|
+
// return res
|
|
45
|
+
// }
|
|
46
|
+
// }
|
|
47
|
+
// const getNativeAssetBalance = async ({ network, token, address }: { network: Network, token: Token, address: string }) => {
|
|
48
|
+
// try {
|
|
49
|
+
// const { Address } = await import("@ton/ton");
|
|
50
|
+
// const getBalance = async () => {
|
|
51
|
+
// return await tonClient.getBalance(Address.parse(address))
|
|
52
|
+
// }
|
|
53
|
+
// const tonBalance = await retryWithExponentialBackoff(getBalance)
|
|
54
|
+
// return ({
|
|
55
|
+
// network: network.name,
|
|
56
|
+
// token: token.symbol,
|
|
57
|
+
// amount: formatAmount(tonBalance.toString(), Number(token?.decimals)),
|
|
58
|
+
// request_time: new Date().toJSON(),
|
|
59
|
+
// decimals: Number(token?.decimals),
|
|
60
|
+
// isNativeCurrency: false,
|
|
61
|
+
// })
|
|
62
|
+
// }
|
|
63
|
+
// catch (e) {
|
|
64
|
+
// const error = new Error(e)
|
|
65
|
+
// error.name = "TonNativeAssetBalanceError"
|
|
66
|
+
// error.cause = e
|
|
67
|
+
// datadogRum.addError(error);
|
|
68
|
+
// return null;
|
|
69
|
+
// }
|
|
70
|
+
// }
|
|
71
|
+
// const getJettonBalance = async ({ network, token, address }: { network: Network, token: Token, address: string }) => {
|
|
72
|
+
// try {
|
|
73
|
+
// const { JettonMaster, JettonWallet, Address } = await import("@ton/ton");
|
|
74
|
+
// const jettonMasterAddress = Address.parse(token.contract!)
|
|
75
|
+
// const userAddress = Address.parse(address)
|
|
76
|
+
// const jettonMaster = tonClient.open(JettonMaster.create(jettonMasterAddress))
|
|
77
|
+
// const getJettonAddress = async () => {
|
|
78
|
+
// return await jettonMaster.getWalletAddress(userAddress)
|
|
79
|
+
// }
|
|
80
|
+
// const jettonAddress = await retryWithExponentialBackoff(getJettonAddress)
|
|
81
|
+
// await new Promise((resolve) => setTimeout(resolve, 1000))
|
|
82
|
+
// const jettonWallet = JettonWallet.create(jettonAddress)
|
|
83
|
+
// const getBalance = async () => {
|
|
84
|
+
// return await jettonWallet.getBalance(tonClient.provider(jettonAddress))
|
|
85
|
+
// }
|
|
86
|
+
// const jettonBalance = await retryWithExponentialBackoff(getBalance)
|
|
87
|
+
// const balance = {
|
|
88
|
+
// network: network.name,
|
|
89
|
+
// token: token.symbol,
|
|
90
|
+
// amount: formatAmount(Number(BigInt(jettonBalance)), token.decimals),
|
|
91
|
+
// request_time: new Date().toJSON(),
|
|
92
|
+
// decimals: token.decimals,
|
|
93
|
+
// isNativeCurrency: false,
|
|
94
|
+
// }
|
|
95
|
+
// return balance
|
|
96
|
+
// }
|
|
97
|
+
// catch (e) {
|
|
98
|
+
// const error = new Error(e)
|
|
99
|
+
// error.name = "TonJettonBalanceError"
|
|
100
|
+
// error.cause = e
|
|
101
|
+
// datadogRum.addError(error);
|
|
102
|
+
// return null;
|
|
103
|
+
// }
|
|
104
|
+
// }
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { datadogRum } from "@datadog/browser-rum";
|
|
2
1
|
import formatAmount from "../../formatAmount";
|
|
3
2
|
import KnownInternalNames from "../../knownIds";
|
|
4
3
|
import { TronWeb } from 'tronweb';
|
|
@@ -56,7 +55,7 @@ const getNativeAssetBalance = async ({ network, token, address, provider }) => {
|
|
|
56
55
|
const error = new Error(e);
|
|
57
56
|
error.name = "TronNativeAssetBalanceError";
|
|
58
57
|
error.cause = e;
|
|
59
|
-
datadogRum.addError(error);
|
|
58
|
+
// datadogRum.addError(error);
|
|
60
59
|
return null;
|
|
61
60
|
}
|
|
62
61
|
};
|
|
@@ -82,7 +81,7 @@ const getTRC20Balance = async ({ network, token, address, provider }) => {
|
|
|
82
81
|
const error = new Error(e);
|
|
83
82
|
error.name = "TronTRC20BalanceError";
|
|
84
83
|
error.cause = e;
|
|
85
|
-
datadogRum.addError(error);
|
|
84
|
+
// datadogRum.addError(error);
|
|
86
85
|
return null;
|
|
87
86
|
}
|
|
88
87
|
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Hash, Option } from './types';
|
|
2
|
-
export interface FakeAccount {
|
|
3
|
-
generate: () => void;
|
|
4
|
-
getAddress: () => Option<string, Hash>;
|
|
5
|
-
getRawAddress: () => Uint8Array;
|
|
6
|
-
signMessage: (message: Option<string, Uint8Array, Hash>) => Promise<Option<string, Uint8Array, Hash>>;
|
|
7
|
-
}
|
|
8
|
-
export declare class EthereumFakeAccount implements FakeAccount {
|
|
9
|
-
private account;
|
|
10
|
-
constructor();
|
|
11
|
-
generate: () => void;
|
|
12
|
-
getAddress: () => Option<string, Hash>;
|
|
13
|
-
getRawAddress: () => Uint8Array;
|
|
14
|
-
signMessage: (message: Option<string, Uint8Array, Hash>) => Promise<Option<string, Uint8Array, Hash>>;
|
|
15
|
-
}
|
|
16
|
-
export declare class SolanaFakeAccount implements FakeAccount {
|
|
17
|
-
private keypair;
|
|
18
|
-
constructor();
|
|
19
|
-
generate: () => void;
|
|
20
|
-
getAddress: () => Option<string, Hash>;
|
|
21
|
-
getRawAddress: () => Uint8Array;
|
|
22
|
-
private getSmallTxId;
|
|
23
|
-
signMessage: (message: Option<string, Uint8Array, Hash>) => Promise<Option<string, Uint8Array, Hash>>;
|
|
24
|
-
}
|
|
@@ -1,36 +1,58 @@
|
|
|
1
|
-
import { Keypair } from '@solana/web3.js';
|
|
2
|
-
import nacl from 'tweetnacl';
|
|
3
|
-
import { privateKeyToAccount } from 'viem/accounts';
|
|
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
|
-
|
|
1
|
+
// import { Keypair } from '@solana/web3.js';
|
|
2
|
+
// import nacl from 'tweetnacl';
|
|
3
|
+
// import { type PrivateKeyAccount, privateKeyToAccount } from 'viem/accounts';
|
|
4
|
+
// import type { Hash, Option } from './types';
|
|
5
|
+
// export interface FakeAccount {
|
|
6
|
+
// generate: () => void;
|
|
7
|
+
// getAddress: () => Option<string, Hash>;
|
|
8
|
+
// getRawAddress: () => Uint8Array;
|
|
9
|
+
// signMessage: (
|
|
10
|
+
// message: Option<string, Uint8Array, Hash>,
|
|
11
|
+
// ) => Promise<Option<string, Uint8Array, Hash>>;
|
|
12
|
+
// }
|
|
13
|
+
// export class EthereumFakeAccount implements FakeAccount {
|
|
14
|
+
// private account!: PrivateKeyAccount;
|
|
15
|
+
// constructor() {
|
|
16
|
+
// this.generate();
|
|
17
|
+
// }
|
|
18
|
+
// generate = (): void => {
|
|
19
|
+
// this.account = privateKeyToAccount(
|
|
20
|
+
// '0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
21
|
+
// );
|
|
22
|
+
// };
|
|
23
|
+
// getAddress = (): Option<string, Hash> => this.account.address;
|
|
24
|
+
// getRawAddress = (): Uint8Array =>
|
|
25
|
+
// Buffer.from(this.account.address.slice(2), 'hex');
|
|
26
|
+
// signMessage = (
|
|
27
|
+
// message: Option<string, Uint8Array, Hash>,
|
|
28
|
+
// ): Promise<Option<string, Uint8Array, Hash>> => {
|
|
29
|
+
// return this.account.signMessage({
|
|
30
|
+
// message: message as string,
|
|
31
|
+
// });
|
|
32
|
+
// };
|
|
33
|
+
// }
|
|
34
|
+
// export class SolanaFakeAccount implements FakeAccount {
|
|
35
|
+
// private keypair!: Keypair;
|
|
36
|
+
// constructor() {
|
|
37
|
+
// this.generate();
|
|
38
|
+
// }
|
|
39
|
+
// generate = (): void => {
|
|
40
|
+
// this.keypair = Keypair.generate();
|
|
41
|
+
// };
|
|
42
|
+
// getAddress = (): Option<string, Hash> => this.keypair.publicKey.toString();
|
|
43
|
+
// getRawAddress = (): Uint8Array => this.keypair.publicKey.toBytes();
|
|
44
|
+
// private getSmallTxId = (
|
|
45
|
+
// message: Option<string, Uint8Array, Hash>,
|
|
46
|
+
// ): Uint8Array => {
|
|
47
|
+
// const txIdNo0x = message.slice(2);
|
|
48
|
+
// const idBytes = `${txIdNo0x.slice(0, 16)}${txIdNo0x.slice(-16)}`;
|
|
49
|
+
// return new TextEncoder().encode(idBytes);
|
|
50
|
+
// };
|
|
51
|
+
// signMessage = (
|
|
52
|
+
// message: Option<string, Uint8Array, Hash>,
|
|
53
|
+
// ): Promise<Option<string, Uint8Array, Hash>> => {
|
|
54
|
+
// return Promise.resolve(
|
|
55
|
+
// nacl.sign.detached(this.getSmallTxId(message), this.keypair.secretKey),
|
|
56
|
+
// );
|
|
57
|
+
// };
|
|
58
|
+
// }
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { type AbiMap, type Asset, type BytesLike, type ConnectorMetadata, FuelConnector, FuelConnectorEventTypes, type JsonAbi, type Network, type SelectNetworkArguments, type TransactionRequestLike, type Version } from 'fuels';
|
|
2
|
-
import { PredicateFactory } from './PredicateFactory';
|
|
3
|
-
import type { PredicateWalletAdapter } from './PredicateWalletAdapter';
|
|
4
|
-
import type { ConnectorConfig, Maybe, MaybeAsync, PredicateConfig, PredicateVersion, PreparedTransaction, ProviderDictionary, SignedMessageCustomCurve } from './types';
|
|
5
|
-
export declare abstract class PredicateConnector extends FuelConnector {
|
|
6
|
-
connected: boolean;
|
|
7
|
-
installed: boolean;
|
|
8
|
-
external: boolean;
|
|
9
|
-
events: typeof FuelConnectorEventTypes;
|
|
10
|
-
protected predicateAddress: string;
|
|
11
|
-
protected customPredicate: Maybe<PredicateConfig>;
|
|
12
|
-
protected predicateAccount: Maybe<PredicateFactory>;
|
|
13
|
-
protected subscriptions: Array<() => void>;
|
|
14
|
-
protected hasProviderSucceeded: boolean;
|
|
15
|
-
private _predicateVersions;
|
|
16
|
-
abstract name: string;
|
|
17
|
-
abstract metadata: ConnectorMetadata;
|
|
18
|
-
abstract sendTransaction(address: string, transaction: TransactionRequestLike): Promise<string>;
|
|
19
|
-
abstract connect(): Promise<boolean>;
|
|
20
|
-
abstract disconnect(): Promise<boolean>;
|
|
21
|
-
protected abstract configProviders(config: ConnectorConfig): MaybeAsync<void>;
|
|
22
|
-
protected abstract getWalletAdapter(): PredicateWalletAdapter;
|
|
23
|
-
protected abstract getPredicateVersions(): Record<string, PredicateVersion>;
|
|
24
|
-
protected abstract getAccountAddress(): MaybeAsync<Maybe<string>>;
|
|
25
|
-
protected abstract getProviders(): Promise<ProviderDictionary>;
|
|
26
|
-
protected abstract requireConnection(): MaybeAsync<void>;
|
|
27
|
-
protected abstract walletAccounts(): Promise<Array<string>>;
|
|
28
|
-
abstract signMessageCustomCurve(_message: string): Promise<SignedMessageCustomCurve>;
|
|
29
|
-
protected emitAccountChange(address: string, connected?: boolean): Promise<void>;
|
|
30
|
-
protected get predicateVersions(): Array<PredicateFactory>;
|
|
31
|
-
protected isAddressPredicate(b: BytesLike, walletAccount: string): boolean;
|
|
32
|
-
protected getCurrentUserPredicate(): Promise<Maybe<PredicateFactory>>;
|
|
33
|
-
protected getNewestPredicate(): Maybe<PredicateFactory>;
|
|
34
|
-
protected setupPredicate(): Promise<PredicateFactory>;
|
|
35
|
-
protected subscribe(listener: () => void): void;
|
|
36
|
-
protected prepareTransaction(address: string, transaction: TransactionRequestLike): Promise<PreparedTransaction>;
|
|
37
|
-
clearSubscriptions(): void;
|
|
38
|
-
ping(): Promise<boolean>;
|
|
39
|
-
version(): Promise<Version>;
|
|
40
|
-
isConnected(): Promise<boolean>;
|
|
41
|
-
accounts(): Promise<Array<string>>;
|
|
42
|
-
currentAccount(): Promise<string | null>;
|
|
43
|
-
networks(): Promise<Network[]>;
|
|
44
|
-
currentNetwork(): Promise<Network>;
|
|
45
|
-
signMessage(_address: string, _message: string): Promise<string>;
|
|
46
|
-
addAssets(_assets: Asset[]): Promise<boolean>;
|
|
47
|
-
addAsset(_asset: Asset): Promise<boolean>;
|
|
48
|
-
assets(): Promise<Array<Asset>>;
|
|
49
|
-
addNetwork(_networkUrl: string): Promise<boolean>;
|
|
50
|
-
selectNetwork(_network: SelectNetworkArguments): Promise<boolean>;
|
|
51
|
-
addAbi(_abiMap: AbiMap): Promise<boolean>;
|
|
52
|
-
getAbi(_contractId: string): Promise<JsonAbi>;
|
|
53
|
-
hasAbi(_contractId: string): Promise<boolean>;
|
|
54
|
-
}
|