@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,76 +1,123 @@
|
|
|
1
|
-
import { arrayify } from '@ethersproject/bytes';
|
|
2
|
-
import {
|
|
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
|
-
|
|
1
|
+
// import { arrayify } from '@ethersproject/bytes';
|
|
2
|
+
// import {
|
|
3
|
+
// Address,
|
|
4
|
+
// type B256Address,
|
|
5
|
+
// type BN,
|
|
6
|
+
// type BytesLike,
|
|
7
|
+
// type InputValue,
|
|
8
|
+
// type JsonAbi,
|
|
9
|
+
// Predicate,
|
|
10
|
+
// type Provider,
|
|
11
|
+
// ScriptTransactionRequest,
|
|
12
|
+
// ZeroBytes32,
|
|
13
|
+
// bn,
|
|
14
|
+
// getPredicateRoot,
|
|
15
|
+
// } from 'fuels';
|
|
16
|
+
// import memoize from 'memoizee';
|
|
17
|
+
// // import type { PredicateWalletAdapter } from './PredicateWalletAdapter';
|
|
18
|
+
// import type { Maybe, PredicateConfig } from './types';
|
|
19
|
+
// export class PredicateFactory {
|
|
20
|
+
// private abi: JsonAbi;
|
|
21
|
+
// private bytecode: BytesLike;
|
|
22
|
+
// private adapter: any//PredicateWalletAdapter;
|
|
23
|
+
// private root: string;
|
|
24
|
+
// private generatedAt: number = Date.now();
|
|
25
|
+
// constructor(
|
|
26
|
+
// adapter: any, //PredicateWalletAdapter,
|
|
27
|
+
// { abi, bin }: PredicateConfig,
|
|
28
|
+
// root: string,
|
|
29
|
+
// generatedAt: number = Date.now(),
|
|
30
|
+
// ) {
|
|
31
|
+
// this.adapter = adapter;
|
|
32
|
+
// this.abi = abi;
|
|
33
|
+
// this.bytecode = bin;
|
|
34
|
+
// this.root = root;
|
|
35
|
+
// this.generatedAt = generatedAt;
|
|
36
|
+
// }
|
|
37
|
+
// getRoot = (): string => this.root;
|
|
38
|
+
// getPredicateAddress = memoize((address: string | B256Address): string => {
|
|
39
|
+
// // @ts-expect-error processPredicateData is only available in the Predicate class
|
|
40
|
+
// const { predicateBytes } = Predicate.processPredicateData(
|
|
41
|
+
// this.bytecode,
|
|
42
|
+
// this.abi,
|
|
43
|
+
// {
|
|
44
|
+
// SIGNER: this.adapter.convertAddress(address),
|
|
45
|
+
// },
|
|
46
|
+
// );
|
|
47
|
+
// return Address.fromB256(getPredicateRoot(predicateBytes)).toString();
|
|
48
|
+
// });
|
|
49
|
+
// build = memoize(
|
|
50
|
+
// <T extends InputValue[]>(
|
|
51
|
+
// address: string | B256Address,
|
|
52
|
+
// provider: Provider,
|
|
53
|
+
// data?: T,
|
|
54
|
+
// ): Predicate<T> =>
|
|
55
|
+
// new Predicate({
|
|
56
|
+
// bytecode: arrayify(this.bytecode),
|
|
57
|
+
// abi: this.abi,
|
|
58
|
+
// provider,
|
|
59
|
+
// configurableConstants: {
|
|
60
|
+
// SIGNER: this.adapter.convertAddress(address),
|
|
61
|
+
// },
|
|
62
|
+
// data,
|
|
63
|
+
// }),
|
|
64
|
+
// );
|
|
65
|
+
// getAccountAddress = (
|
|
66
|
+
// address: string,
|
|
67
|
+
// accounts: Array<string> = [],
|
|
68
|
+
// ): Maybe<string> =>
|
|
69
|
+
// accounts.find(
|
|
70
|
+
// (account: string) => this.getPredicateAddress(account) === address,
|
|
71
|
+
// );
|
|
72
|
+
// getPredicateAddresses = (accounts: Array<string> = []): Array<string> =>
|
|
73
|
+
// accounts.map((account) => this.getPredicateAddress(account));
|
|
74
|
+
// getMaxPredicateGasUsed = memoize(async (provider: Provider): Promise<BN> => {
|
|
75
|
+
// const fakeAccount = this.adapter.generateFakeAccount();
|
|
76
|
+
// const chainId = await provider.getChainId();
|
|
77
|
+
// const fakePredicate = this.build(fakeAccount.getAddress(), provider, [0]);
|
|
78
|
+
// const request = new ScriptTransactionRequest();
|
|
79
|
+
// request.addCoinInput({
|
|
80
|
+
// id: ZeroBytes32,
|
|
81
|
+
// assetId: ZeroBytes32,
|
|
82
|
+
// amount: bn(),
|
|
83
|
+
// owner: fakePredicate.address,
|
|
84
|
+
// blockCreated: bn(),
|
|
85
|
+
// txCreatedIdx: bn(),
|
|
86
|
+
// });
|
|
87
|
+
// fakePredicate.populateTransactionPredicateData(request);
|
|
88
|
+
// const txId = request.getTransactionId(chainId);
|
|
89
|
+
// //
|
|
90
|
+
// const signature = await fakeAccount.signMessage(txId);
|
|
91
|
+
// request.witnesses = this.adapter.buildWitnessData(fakeAccount, signature);
|
|
92
|
+
// //
|
|
93
|
+
// await fakePredicate.provider.estimatePredicates(request);
|
|
94
|
+
// const predicateInput = request.inputs[0];
|
|
95
|
+
// if (predicateInput && 'predicate' in predicateInput) {
|
|
96
|
+
// return bn(predicateInput.predicateGasUsed);
|
|
97
|
+
// }
|
|
98
|
+
// return bn();
|
|
99
|
+
// });
|
|
100
|
+
// equals = (predicate: Maybe<PredicateFactory>): boolean =>
|
|
101
|
+
// !!predicate && predicate.root === this.root;
|
|
102
|
+
// sort = (predicate: PredicateFactory): number =>
|
|
103
|
+
// predicate.generatedAt - this.generatedAt;
|
|
104
|
+
// }
|
|
105
|
+
// /**
|
|
106
|
+
// * Since the predicate resources were fetched and added to the TransactionRequest before the predicate
|
|
107
|
+
// * was instantiated, it is very likely that they were fetched and added as normal account resources,
|
|
108
|
+
// * resulting in a witness placeholder being added to the witnesses of the TransactionRequest to
|
|
109
|
+
// * later be replaced with an actual signature. Since predicate resources do not require a signature,
|
|
110
|
+
// * this placeholder witness will be removed when calling `Predicate.populateTransactionPredicateData`.
|
|
111
|
+
// * However, we need to validate if this placeholder witness was added here in order to instantiate the
|
|
112
|
+
// * predicate with the correct witness index argument.
|
|
113
|
+
// */
|
|
114
|
+
// export const getMockedSignatureIndex = (witnesses: BytesLike[]) => {
|
|
115
|
+
// const hasPlaceholderWitness = witnesses.some(
|
|
116
|
+
// (item) =>
|
|
117
|
+
// item instanceof Uint8Array &&
|
|
118
|
+
// item.length === 64 &&
|
|
119
|
+
// item.every((value) => value === 0),
|
|
120
|
+
// );
|
|
121
|
+
// // if it is a placeholder witness, we can safely replace it, otherwise we will consider a new element.
|
|
122
|
+
// return hasPlaceholderWitness ? witnesses.length - 1 : witnesses.length;
|
|
123
|
+
// };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type FakeAccount } from './FakeAccount';
|
|
2
|
-
import type { Hash, Option } from './types';
|
|
3
|
-
export interface PredicateWalletAdapter {
|
|
4
|
-
convertAddress: (address: string) => string;
|
|
5
|
-
generateFakeAccount: () => FakeAccount;
|
|
6
|
-
buildWitnessData: (account: FakeAccount, signature: Option<string, Uint8Array, Hash>) => Array<Option<string, Uint8Array, Hash>>;
|
|
7
|
-
}
|
|
8
|
-
export declare class EthereumWalletAdapter implements PredicateWalletAdapter {
|
|
9
|
-
convertAddress: (address: string) => string;
|
|
10
|
-
generateFakeAccount: () => FakeAccount;
|
|
11
|
-
buildWitnessData: (_account: FakeAccount, signature: Option<string, Uint8Array, Hash>) => Array<Option<string, Uint8Array, Hash>>;
|
|
12
|
-
}
|
|
13
|
-
export declare class SolanaWalletAdapter implements PredicateWalletAdapter {
|
|
14
|
-
convertAddress: (address: string) => string;
|
|
15
|
-
generateFakeAccount: () => FakeAccount;
|
|
16
|
-
buildWitnessData: (_account: FakeAccount, signature: Option<string, Uint8Array, Hash>) => Array<Option<string, Uint8Array, Hash>>;
|
|
17
|
-
}
|
|
@@ -1,29 +1,44 @@
|
|
|
1
|
-
import bs58 from 'bs58';
|
|
2
|
-
import { Address, hexlify } from 'fuels';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
export class
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
1
|
+
// import bs58 from 'bs58';
|
|
2
|
+
// import { Address, hexlify } from 'fuels';
|
|
3
|
+
// import {
|
|
4
|
+
// EthereumFakeAccount,
|
|
5
|
+
// type FakeAccount,
|
|
6
|
+
// SolanaFakeAccount,
|
|
7
|
+
// } from './FakeAccount';
|
|
8
|
+
// import type { Hash, Option } from './types';
|
|
9
|
+
// export interface PredicateWalletAdapter {
|
|
10
|
+
// convertAddress: (address: string) => string;
|
|
11
|
+
// generateFakeAccount: () => FakeAccount;
|
|
12
|
+
// buildWitnessData: (
|
|
13
|
+
// account: FakeAccount,
|
|
14
|
+
// signature: Option<string, Uint8Array, Hash>,
|
|
15
|
+
// ) => Array<Option<string, Uint8Array, Hash>>;
|
|
16
|
+
// }
|
|
17
|
+
// export class EthereumWalletAdapter implements PredicateWalletAdapter {
|
|
18
|
+
// convertAddress = (address: string): string => {
|
|
19
|
+
// return Address.fromEvmAddress(address).toString();
|
|
20
|
+
// };
|
|
21
|
+
// generateFakeAccount = (): FakeAccount => {
|
|
22
|
+
// return new EthereumFakeAccount();
|
|
23
|
+
// };
|
|
24
|
+
// buildWitnessData = (
|
|
25
|
+
// _account: FakeAccount,
|
|
26
|
+
// signature: Option<string, Uint8Array, Hash>,
|
|
27
|
+
// ): Array<Option<string, Uint8Array, Hash>> => {
|
|
28
|
+
// return [signature];
|
|
29
|
+
// };
|
|
30
|
+
// }
|
|
31
|
+
// export class SolanaWalletAdapter implements PredicateWalletAdapter {
|
|
32
|
+
// convertAddress = (address: string): string => {
|
|
33
|
+
// return hexlify(bs58.decode(address));
|
|
34
|
+
// };
|
|
35
|
+
// generateFakeAccount = (): FakeAccount => {
|
|
36
|
+
// return new SolanaFakeAccount();
|
|
37
|
+
// };
|
|
38
|
+
// buildWitnessData = (
|
|
39
|
+
// _account: FakeAccount,
|
|
40
|
+
// signature: Option<string, Uint8Array, Hash>,
|
|
41
|
+
// ): Array<Option<string, Uint8Array, Hash>> => {
|
|
42
|
+
// return [signature];
|
|
43
|
+
// };
|
|
44
|
+
// }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './PredicateFactory';
|
|
2
|
-
export * from './PredicateWalletAdapter';
|
|
3
|
-
export * from './FakeAccount';
|
|
1
|
+
// export * from './PredicateFactory';
|
|
2
|
+
// export * from './PredicateWalletAdapter';
|
|
3
|
+
// export * from './FakeAccount';
|
|
4
4
|
export * from './types';
|
|
5
|
-
export * from './PredicateConnector';
|
|
5
|
+
// export * from './PredicateConnector';
|
|
6
6
|
export * from './utils';
|
|
7
7
|
export * from './networks';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { type Asset, type ConnectorMetadata, type FuelABI, FuelConnector, FuelConnectorEventTypes, type Network, type SelectNetworkArguments, type TransactionRequestLike, type Version } from 'fuels';
|
|
2
|
-
import { JSONRPCClient } from 'json-rpc-2.0';
|
|
3
|
-
export declare class FuelWalletConnector extends FuelConnector {
|
|
4
|
-
name: string;
|
|
5
|
-
connected: boolean;
|
|
6
|
-
installed: boolean;
|
|
7
|
-
external: boolean;
|
|
8
|
-
events: typeof FuelConnectorEventTypes;
|
|
9
|
-
metadata: ConnectorMetadata;
|
|
10
|
-
readonly client: JSONRPCClient;
|
|
11
|
-
constructor(name?: string);
|
|
12
|
-
/**
|
|
13
|
-
* ============================================================
|
|
14
|
-
* Application communication methods
|
|
15
|
-
* ============================================================
|
|
16
|
-
*/
|
|
17
|
-
private setupConnector;
|
|
18
|
-
private acceptMessage;
|
|
19
|
-
private setupListener;
|
|
20
|
-
private createRequestId;
|
|
21
|
-
private postMessage;
|
|
22
|
-
private sendRequest;
|
|
23
|
-
private onResponse;
|
|
24
|
-
private onEvent;
|
|
25
|
-
private onMessage;
|
|
26
|
-
private onCommunicationMessage;
|
|
27
|
-
/**
|
|
28
|
-
* ============================================================
|
|
29
|
-
* Connector methods
|
|
30
|
-
* ============================================================
|
|
31
|
-
*/
|
|
32
|
-
ping(): Promise<boolean>;
|
|
33
|
-
isConnected(): Promise<boolean>;
|
|
34
|
-
connect(): Promise<boolean>;
|
|
35
|
-
disconnect(): Promise<boolean>;
|
|
36
|
-
accounts(): Promise<Array<string>>;
|
|
37
|
-
currentAccount(): Promise<string | null>;
|
|
38
|
-
signMessage(address: string, message: string): Promise<string>;
|
|
39
|
-
sendTransaction(address: string, transaction: TransactionRequestLike): Promise<string>;
|
|
40
|
-
assets(): Promise<Array<Asset>>;
|
|
41
|
-
addAsset(asset: Asset): Promise<boolean>;
|
|
42
|
-
addAssets(assets: Asset[]): Promise<boolean>;
|
|
43
|
-
addABI(contractId: string, abi: FuelABI): Promise<boolean>;
|
|
44
|
-
getABI(contractId: string): Promise<FuelABI>;
|
|
45
|
-
hasABI(contractId: string): Promise<boolean>;
|
|
46
|
-
currentNetwork(): Promise<Network>;
|
|
47
|
-
selectNetwork(network: SelectNetworkArguments): Promise<boolean>;
|
|
48
|
-
networks(): Promise<Network[]>;
|
|
49
|
-
addNetwork(networkUrl: string): Promise<boolean>;
|
|
50
|
-
version(): Promise<Version>;
|
|
51
|
-
}
|