@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.
Files changed (267) hide show
  1. package/README.md +78 -3
  2. package/dist/Models/Theme.d.ts +7 -6
  3. package/dist/Models/Theme.js +7 -7
  4. package/dist/Models/WalletProvider.d.ts +0 -4
  5. package/dist/Models/WalletProvider.js +2 -0
  6. package/dist/components/Buttons/copyButton.js +4 -3
  7. package/dist/components/ColorSchema.js +79 -45
  8. package/dist/components/Common/AddressIcon.js +1 -0
  9. package/dist/components/Common/AverageCompletionTime.js +1 -1
  10. package/dist/components/Common/CountDownTimer.js +2 -2
  11. package/dist/components/Common/FormattedAverageCompletionTime.js +1 -1
  12. package/dist/components/HeaderWithMenu/index.js +1 -8
  13. package/dist/components/Input/Address/AddressNote.js +3 -2
  14. package/dist/components/Input/Address/AddressPicker/AddressWithIcon.js +2 -2
  15. package/dist/components/Input/Address/AddressPicker/ConnectedWallets/ConnectWalletButton.js +12 -5
  16. package/dist/components/Input/Address/AddressPicker/ExchangeNote.d.ts +1 -1
  17. package/dist/components/Input/Address/AddressPicker/ExchangeNote.js +1 -1
  18. package/dist/components/Input/RouteIcon.js +1 -1
  19. package/dist/components/LayerswapMenu/MenuList.js +2 -56
  20. package/dist/components/Pages/404/index.js +1 -0
  21. package/dist/components/Pages/Auth/Steps/CodeStep/VerifyEmailCode.js +1 -0
  22. package/dist/components/Pages/Auth/index.d.ts +1 -1
  23. package/dist/components/Pages/Auth/index.js +3 -2
  24. package/dist/components/Pages/Campaigns/Details/Leaderboard.js +1 -0
  25. package/dist/components/Pages/Campaigns/Details/index.d.ts +1 -1
  26. package/dist/components/Pages/Campaigns/Details/index.js +3 -2
  27. package/dist/components/Pages/Campaigns/index.d.ts +1 -1
  28. package/dist/components/Pages/Campaigns/index.js +3 -2
  29. package/dist/components/Pages/Maintanance/index.js +1 -0
  30. package/dist/components/Pages/NoCookies/index.js +1 -0
  31. package/dist/components/Pages/SwapHistory/History.js +1 -2
  32. package/dist/components/Pages/SwapHistory/index.d.ts +1 -1
  33. package/dist/components/Pages/SwapHistory/index.js +4 -3
  34. package/dist/components/Pages/SwapPages/Form/FeeDetails/Campaign.js +1 -0
  35. package/dist/components/Pages/SwapPages/Form/Form.js +1 -4
  36. package/dist/components/Pages/SwapPages/Form/SecondaryComponents/ValidationError.js +1 -1
  37. package/dist/components/Pages/SwapPages/Form/Select/Popover/PopoverSelect.js +1 -1
  38. package/dist/components/Pages/SwapPages/Form/index.js +1 -0
  39. package/dist/components/Pages/SwapPages/Withdraw/Coinbase/Carousel.js +8 -6
  40. package/dist/components/Pages/SwapPages/Withdraw/Processing/Processing.js +2 -2
  41. package/dist/components/Pages/SwapPages/Withdraw/Wallet/FuelWalletWithdrawal.d.ts +0 -4
  42. package/dist/components/Pages/SwapPages/Withdraw/Wallet/FuelWalletWithdrawal.js +159 -125
  43. package/dist/components/Pages/SwapPages/Withdraw/Wallet/ImtblxWalletWithdrawStep.d.ts +0 -4
  44. package/dist/components/Pages/SwapPages/Withdraw/Wallet/ImtblxWalletWithdrawStep.js +69 -51
  45. package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/ActivationTokentPicker.d.ts +0 -8
  46. package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/ActivationTokentPicker.js +87 -45
  47. package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/hooks.d.ts +0 -40
  48. package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/hooks.js +73 -46
  49. package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/index.d.ts +0 -4
  50. package/dist/components/Pages/SwapPages/Withdraw/Wallet/Loopring/index.js +175 -128
  51. package/dist/components/Pages/SwapPages/Withdraw/Wallet/SVMWalletWithdraw/index.d.ts +0 -7
  52. package/dist/components/Pages/SwapPages/Withdraw/Wallet/SVMWalletWithdraw/index.js +138 -116
  53. package/dist/components/Pages/SwapPages/Withdraw/Wallet/SVMWalletWithdraw/transactionSender.d.ts +0 -8
  54. package/dist/components/Pages/SwapPages/Withdraw/Wallet/SVMWalletWithdraw/transactionSender.js +96 -75
  55. package/dist/components/Pages/SwapPages/Withdraw/Wallet/SophonWalletWithdraw.js +2 -2
  56. package/dist/components/Pages/SwapPages/Withdraw/Wallet/StarknetWalletWithdraw.d.ts +0 -4
  57. package/dist/components/Pages/SwapPages/Withdraw/Wallet/StarknetWalletWithdraw.js +88 -71
  58. package/dist/components/Pages/SwapPages/Withdraw/Wallet/TonWalletWithdraw.d.ts +0 -4
  59. package/dist/components/Pages/SwapPages/Withdraw/Wallet/TonWalletWithdraw.js +146 -136
  60. package/dist/components/Pages/SwapPages/Withdraw/Wallet/TronWalletWithdraw.d.ts +0 -4
  61. package/dist/components/Pages/SwapPages/Withdraw/Wallet/TronWalletWithdraw.js +120 -99
  62. package/dist/components/Pages/SwapPages/Withdraw/Wallet/WalletTransfer/TransferToken.js +3 -3
  63. package/dist/components/Pages/SwapPages/Withdraw/Wallet/WalletTransfer/buttons.js +1 -0
  64. package/dist/components/Pages/SwapPages/Withdraw/Wallet/WalletTransfer/index.js +1 -1
  65. package/dist/components/Pages/SwapPages/Withdraw/Wallet/WalletTransfer/transactionMessage.js +2 -2
  66. package/dist/components/Pages/SwapPages/Withdraw/Wallet/WalletTransferContent.js +101 -33
  67. package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/Evm.d.ts +0 -4
  68. package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/Evm.js +60 -55
  69. package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/Starknet.d.ts +0 -4
  70. package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/Starknet.js +71 -55
  71. package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/buttons.js +1 -0
  72. package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/index.d.ts +0 -4
  73. package/dist/components/Pages/SwapPages/Withdraw/Wallet/paradex/index.js +56 -52
  74. package/dist/components/Pages/SwapPages/Withdraw/index.d.ts +1 -1
  75. package/dist/components/Pages/SwapPages/Withdraw/index.js +3 -2
  76. package/dist/components/Wallet/WalletModal/Connector.js +1 -1
  77. package/dist/components/Wallet/WalletProviders/FuelProvider.d.ts +0 -5
  78. package/dist/components/Wallet/WalletProviders/FuelProvider.js +25 -20
  79. package/dist/components/Wallet/WalletProviders/ImtblPassportProvider.d.ts +0 -5
  80. package/dist/components/Wallet/WalletProviders/ImtblPassportProvider.js +39 -36
  81. package/dist/components/Wallet/WalletProviders/SolanaProvider.d.ts +0 -5
  82. package/dist/components/Wallet/WalletProviders/SolanaProvider.js +49 -38
  83. package/dist/components/Wallet/WalletProviders/StarknetProvider.d.ts +0 -5
  84. package/dist/components/Wallet/WalletProviders/StarknetProvider.js +112 -117
  85. package/dist/components/Wallet/WalletProviders/TonConnectProvider.d.ts +0 -6
  86. package/dist/components/Wallet/WalletProviders/TonConnectProvider.js +58 -50
  87. package/dist/components/Wallet/WalletProviders/TronProvider.d.ts +0 -3
  88. package/dist/components/Wallet/WalletProviders/TronProvider.js +23 -15
  89. package/dist/components/Wallet/WalletProviders/Wagmi.d.ts +1 -1
  90. package/dist/components/Wallet/WalletProviders/Wagmi.js +20 -10
  91. package/dist/components/Wallet/WalletProviders/index.js +13 -6
  92. package/dist/components/Widget/Footer.d.ts +2 -1
  93. package/dist/components/Widget/Footer.js +13 -4
  94. package/dist/components/Widget/Index.d.ts +1 -1
  95. package/dist/components/Widget/Index.js +1 -1
  96. package/dist/components/WidgetLoading.d.ts +1 -0
  97. package/dist/components/WidgetLoading.js +5 -0
  98. package/dist/components/Wizard/Wizard.js +1 -1
  99. package/dist/components/shadcn/command.js +1 -1
  100. package/dist/components/themeWrapper.js +3 -2
  101. package/dist/context/{LayerswapContext.d.ts → LayerswapProvider.d.ts} +3 -8
  102. package/dist/context/{LayerswapContext.js → LayerswapProvider.js} +8 -9
  103. package/dist/context/authContext.js +1 -0
  104. package/dist/context/walletHooksProvider.js +1 -0
  105. package/dist/hooks/useWallet.js +10 -14
  106. package/dist/index.css +1 -1
  107. package/dist/index.d.ts +3 -5
  108. package/dist/index.js +2 -4
  109. package/dist/index.mjs +19 -0
  110. package/dist/lib/AppSettings.d.ts +7 -3
  111. package/dist/lib/AppSettings.js +8 -7
  112. package/dist/lib/address/formatter/index.js +8 -9
  113. package/dist/lib/address/validator/index.js +18 -20
  114. package/dist/lib/axiosInterceptor.js +1 -2
  115. package/dist/lib/balances/balanceResolver.js +16 -16
  116. package/dist/lib/balances/providers/evmBalanceProvider.js +3 -3
  117. package/dist/lib/balances/providers/loopringBalanceProvider.d.ts +0 -6
  118. package/dist/lib/balances/providers/loopringBalanceProvider.js +56 -43
  119. package/dist/lib/balances/providers/paradexBalanceProvider.d.ts +0 -6
  120. package/dist/lib/balances/providers/paradexBalanceProvider.js +42 -42
  121. package/dist/lib/balances/providers/solanaBalanceProvider.d.ts +0 -6
  122. package/dist/lib/balances/providers/solanaBalanceProvider.js +70 -71
  123. package/dist/lib/balances/providers/starknetBalanceProvider.d.ts +0 -6
  124. package/dist/lib/balances/providers/starknetBalanceProvider.js +48 -45
  125. package/dist/lib/balances/providers/tonBalanceProvider.d.ts +0 -18
  126. package/dist/lib/balances/providers/tonBalanceProvider.js +104 -100
  127. package/dist/lib/balances/providers/tronBalanceResolver.js +2 -3
  128. package/dist/lib/fuels/common/FakeAccount.d.ts +0 -24
  129. package/dist/lib/fuels/common/FakeAccount.js +58 -36
  130. package/dist/lib/fuels/common/PredicateConnector.d.ts +0 -54
  131. package/dist/lib/fuels/common/PredicateConnector.js +292 -205
  132. package/dist/lib/fuels/common/PredicateFactory.d.ts +0 -29
  133. package/dist/lib/fuels/common/PredicateFactory.js +123 -76
  134. package/dist/lib/fuels/common/PredicateWalletAdapter.d.ts +0 -17
  135. package/dist/lib/fuels/common/PredicateWalletAdapter.js +44 -29
  136. package/dist/lib/fuels/common/index.d.ts +0 -4
  137. package/dist/lib/fuels/common/index.js +4 -4
  138. package/dist/lib/fuels/connectors/fuel-wallet/FuelWalletConnector.d.ts +0 -51
  139. package/dist/lib/fuels/connectors/fuel-wallet/FuelWalletConnector.js +268 -234
  140. package/dist/lib/fuels/connectors/fuel-wallet/index.d.ts +0 -2
  141. package/dist/lib/fuels/connectors/fuel-wallet/index.js +2 -2
  142. package/dist/lib/fuels/connectors/fuel-wallet/types.d.ts +0 -50
  143. package/dist/lib/fuels/connectors/fuel-wallet/types.js +53 -9
  144. package/dist/lib/fuels/connectors/fuelet-wallet/FueletWalletConnector.d.ts +0 -7
  145. package/dist/lib/fuels/connectors/fuelet-wallet/FueletWalletConnector.js +20 -19
  146. package/dist/lib/fuels/connectors/fuelet-wallet/index.d.ts +0 -1
  147. package/dist/lib/fuels/connectors/fuelet-wallet/index.js +1 -1
  148. package/dist/lib/gases/gasResolver.d.ts +1 -1
  149. package/dist/lib/gases/gasResolver.js +10 -10
  150. package/dist/lib/gases/providers/evmGasProvider.js +5 -4
  151. package/dist/lib/gases/providers/loopringGasProvider.d.ts +0 -6
  152. package/dist/lib/gases/providers/loopringGasProvider.js +27 -24
  153. package/dist/lib/gases/providers/solanaGasProvider.d.ts +0 -7
  154. package/dist/lib/gases/providers/solanaGasProvider.js +32 -31
  155. package/dist/lib/gases/providers/starknetGasProvider.d.ts +0 -7
  156. package/dist/lib/gases/providers/starknetGasProvider.js +34 -33
  157. package/dist/lib/imtbl.d.ts +0 -69
  158. package/dist/lib/imtbl.js +63 -60
  159. package/dist/lib/internalApiClient.d.ts +0 -2
  160. package/dist/lib/internalApiClient.js +1 -4
  161. package/dist/lib/layerSwapApiClient.js +3 -3
  162. package/dist/lib/logError.js +2 -2
  163. package/dist/lib/nft/nftBalanceResolver.js +1 -2
  164. package/dist/lib/nft/providers/starknetNftProvider.d.ts +0 -6
  165. package/dist/lib/nft/providers/starknetNftProvider.js +49 -50
  166. package/dist/lib/wallets/connectors/EthereumProvider.d.ts +2 -2
  167. package/dist/lib/wallets/connectors/useSyncProviders/store.d.ts +1 -4
  168. package/dist/lib/wallets/fuel/Bako.d.ts +0 -15
  169. package/dist/lib/wallets/fuel/Bako.js +34 -29
  170. package/dist/lib/wallets/fuel/Basko.d.ts +0 -15
  171. package/dist/lib/wallets/fuel/Basko.js +34 -29
  172. package/dist/lib/wallets/fuel/useFuel.d.ts +0 -2
  173. package/dist/lib/wallets/fuel/useFuel.js +211 -192
  174. package/dist/lib/wallets/imtblX/useImtblX.d.ts +0 -2
  175. package/dist/lib/wallets/imtblX/useImtblX.js +87 -87
  176. package/dist/lib/wallets/paradex/Authorize/Ethereum.d.ts +0 -2
  177. package/dist/lib/wallets/paradex/Authorize/Ethereum.js +24 -23
  178. package/dist/lib/wallets/paradex/Authorize/Starknet.d.ts +0 -2
  179. package/dist/lib/wallets/paradex/Authorize/Starknet.js +14 -13
  180. package/dist/lib/wallets/paradex/lib/account.d.ts +0 -28
  181. package/dist/lib/wallets/paradex/lib/account.js +102 -53
  182. package/dist/lib/wallets/paradex/lib/index.d.ts +0 -24
  183. package/dist/lib/wallets/paradex/lib/index.js +20 -20
  184. package/dist/lib/wallets/paradex/lib/paraclear-provider.d.ts +0 -6
  185. package/dist/lib/wallets/paradex/lib/paraclear-provider.js +13 -9
  186. package/dist/lib/wallets/paradex/lib/paraclear.d.ts +0 -137
  187. package/dist/lib/wallets/paradex/lib/paraclear.js +258 -131
  188. package/dist/lib/wallets/paradex/lib/starknet-account-support.d.ts +0 -22
  189. package/dist/lib/wallets/paradex/lib/starknet-account-support.js +296 -220
  190. package/dist/lib/wallets/paradex/lib/starknet-signer.d.ts +0 -15
  191. package/dist/lib/wallets/paradex/lib/starknet-signer.js +120 -94
  192. package/dist/lib/wallets/paradex/useParadex.d.ts +0 -7
  193. package/dist/lib/wallets/paradex/useParadex.js +197 -194
  194. package/dist/lib/wallets/solana/transactionBuilder.d.ts +0 -4
  195. package/dist/lib/wallets/solana/transactionBuilder.js +63 -39
  196. package/dist/lib/wallets/solana/useSVM.d.ts +0 -5
  197. package/dist/lib/wallets/solana/useSVM.js +139 -142
  198. package/dist/lib/wallets/starknet/useStarknet.d.ts +0 -2
  199. package/dist/lib/wallets/starknet/useStarknet.js +139 -139
  200. package/dist/lib/wallets/ton/client.d.ts +0 -3
  201. package/dist/lib/wallets/ton/client.js +7 -7
  202. package/dist/lib/wallets/ton/useTON.d.ts +0 -2
  203. package/dist/lib/wallets/ton/useTON.js +121 -122
  204. package/dist/lib/wallets/tron/connectors/bitkeep.d.ts +0 -61
  205. package/dist/lib/wallets/tron/connectors/bitkeep.js +326 -303
  206. package/dist/lib/wallets/tron/connectors/index.d.ts +0 -4
  207. package/dist/lib/wallets/tron/connectors/index.js +4 -4
  208. package/dist/lib/wallets/tron/connectors/okxWallet.d.ts +0 -66
  209. package/dist/lib/wallets/tron/connectors/okxWallet.js +364 -336
  210. package/dist/lib/wallets/tron/connectors/tokenPocket.d.ts +0 -72
  211. package/dist/lib/wallets/tron/connectors/tokenPocket.js +337 -308
  212. package/dist/lib/wallets/tron/connectors/tronLink/index.d.ts +0 -102
  213. package/dist/lib/wallets/tron/connectors/tronLink/index.js +560 -520
  214. package/dist/lib/wallets/tron/connectors/tronLink/types.d.ts +0 -56
  215. package/dist/lib/wallets/tron/connectors/tronLink/types.js +53 -1
  216. package/dist/lib/wallets/tron/connectors/tronLink/utils.d.ts +0 -14
  217. package/dist/lib/wallets/tron/connectors/tronLink/utils.js +64 -61
  218. package/dist/lib/wallets/tron/useTron.d.ts +0 -2
  219. package/dist/lib/wallets/tron/useTron.js +111 -111
  220. package/dist/lib/wallets/utils/resolveWalletIcon.js +1 -0
  221. package/package.json +26 -77
  222. package/dist/hooks/useCopyClipboard.d.ts +0 -1
  223. package/dist/hooks/useCopyClipboard.js +0 -21
  224. package/dist/index.cjs +0 -125
  225. package/dist/lib/abis/ERC20.json +0 -258
  226. package/dist/lib/fuels/connectors/walletConnect/WalletConnectConnector.d.ts +0 -42
  227. package/dist/lib/fuels/connectors/walletConnect/WalletConnectConnector.js +0 -357
  228. package/dist/lib/fuels/connectors/walletConnect/constants.d.ts +0 -6
  229. package/dist/lib/fuels/connectors/walletConnect/constants.js +0 -7
  230. package/dist/lib/fuels/connectors/walletConnect/index.d.ts +0 -3
  231. package/dist/lib/fuels/connectors/walletConnect/index.js +0 -3
  232. package/dist/lib/fuels/connectors/walletConnect/types.d.ts +0 -12
  233. package/dist/lib/fuels/connectors/walletConnect/types.js +0 -1
  234. package/dist/lib/fuels/connectors/walletConnect/utils/index.d.ts +0 -1
  235. package/dist/lib/fuels/connectors/walletConnect/utils/index.js +0 -1
  236. package/dist/lib/fuels/connectors/walletConnect/utils/subscribeAndEnforceChain.d.ts +0 -2
  237. package/dist/lib/fuels/connectors/walletConnect/utils/subscribeAndEnforceChain.js +0 -39
  238. package/dist/lib/fuels/connectors/walletConnect/web3Modal.d.ts +0 -10
  239. package/dist/lib/fuels/connectors/walletConnect/web3Modal.js +0 -38
  240. package/dist/lib/loopring/LoopringAPI.d.ts +0 -12
  241. package/dist/lib/loopring/LoopringAPI.js +0 -13
  242. package/dist/lib/loopring/defs.d.ts +0 -425
  243. package/dist/lib/loopring/defs.js +0 -217
  244. package/dist/lib/loopring/eddsa.d.ts +0 -29
  245. package/dist/lib/loopring/eddsa.js +0 -208
  246. package/dist/lib/loopring/field.d.ts +0 -17
  247. package/dist/lib/loopring/field.js +0 -61
  248. package/dist/lib/loopring/formatter.d.ts +0 -137
  249. package/dist/lib/loopring/formatter.js +0 -516
  250. package/dist/lib/loopring/helpers.d.ts +0 -36
  251. package/dist/lib/loopring/helpers.js +0 -140
  252. package/dist/lib/loopring/jubjub.d.ts +0 -19
  253. package/dist/lib/loopring/jubjub.js +0 -79
  254. package/dist/lib/loopring/permutation.d.ts +0 -22
  255. package/dist/lib/loopring/permutation.js +0 -198
  256. package/dist/lib/loopring/poseidon/EDDSAUtil.d.ts +0 -14
  257. package/dist/lib/loopring/poseidon/EDDSAUtil.js +0 -61
  258. package/dist/lib/loopring/poseidon/babyJub.d.ts +0 -6
  259. package/dist/lib/loopring/poseidon/babyJub.js +0 -51
  260. package/dist/lib/loopring/poseidon/eddsa.d.ts +0 -29
  261. package/dist/lib/loopring/poseidon/eddsa.js +0 -210
  262. package/dist/lib/loopring/utils.d.ts +0 -76
  263. package/dist/lib/loopring/utils.js +0 -230
  264. package/dist/styles/dialog-transition.css +0 -28
  265. package/dist/styles/globals.css +0 -372
  266. package/dist/styles/manual-trasnfer-svg.css +0 -299
  267. package/dist/styles/vaul.css +0 -256
@@ -1,76 +0,0 @@
1
- import * as ethUtil from 'ethereumjs-util';
2
- import { OriginTransferRequestV3, ChainId, UpdateAccountRequestV3 } from './defs';
3
- export type EddsaKey = {
4
- keyPair: {
5
- publicKeyX: string;
6
- publicKeyY: string;
7
- secretKey: string;
8
- };
9
- formatedPx: string;
10
- formatedPy: string;
11
- sk: string;
12
- };
13
- export declare function generateKey(sig: string): EddsaKey;
14
- export declare const getEdDSASigWithPoseidon: (inputs: any, PrivateKey: string | undefined) => {
15
- hash: any;
16
- result: string;
17
- };
18
- export declare const genSigWithPadding: (PrivateKey: string | undefined, hash: any) => string;
19
- export declare function convertPublicKey2(pk: {
20
- x: string;
21
- y: string;
22
- }): ethUtil.BN;
23
- export declare function getUpdateAccountEcdsaTypedData(data: UpdateAccountRequestV3, chainId: ChainId): {
24
- types: {
25
- EIP712Domain: {
26
- name: string;
27
- type: string;
28
- }[];
29
- AccountUpdate: {
30
- name: string;
31
- type: string;
32
- }[];
33
- };
34
- primaryType: string;
35
- domain: {
36
- name: string;
37
- version: string;
38
- chainId: ChainId;
39
- verifyingContract: string;
40
- };
41
- message: any;
42
- };
43
- export declare function getTransferTypedData(data: OriginTransferRequestV3, chainId: ChainId): {
44
- types: {
45
- EIP712Domain: {
46
- name: string;
47
- type: string;
48
- }[];
49
- Transfer: {
50
- name: string;
51
- type: string;
52
- }[];
53
- };
54
- primaryType: string;
55
- domain: {
56
- name: string;
57
- version: string;
58
- chainId: ChainId;
59
- verifyingContract: string;
60
- };
61
- message: {
62
- from: string;
63
- to: string;
64
- tokenID: string | number;
65
- amount: string;
66
- feeTokenID: string | number;
67
- maxFee: string;
68
- validUntil: number;
69
- storageID: number;
70
- };
71
- };
72
- export declare function get_EddsaSig_Transfer(request: OriginTransferRequestV3, eddsaKey: string): {
73
- hash: any;
74
- result: string;
75
- };
76
- export declare function getEdDSASig(method: string, basePath: string, api_url: string, requestInfo: any, PrivateKey: string | undefined): string;
@@ -1,230 +0,0 @@
1
- import { BigNumber } from 'ethers';
2
- import { jubjub } from './jubjub';
3
- import { SignatureScheme } from './eddsa';
4
- import * as ethUtil from 'ethereumjs-util';
5
- import * as fm from './formatter';
6
- import { bnToBufWithFixedLength } from './poseidon/eddsa';
7
- import { field } from './field';
8
- import { PoseidonParams, permunation } from './permutation';
9
- import { EDDSAUtil } from './poseidon/EDDSAUtil';
10
- import BN from 'bn.js';
11
- import BigInteger from 'bignumber.js';
12
- import * as crypto from 'crypto-js';
13
- import { toBig, toHex } from './formatter';
14
- const SNARK_SCALAR_FIELD = new BigInteger('21888242871839275222246405745257275088548364400416034343698204186575808495617', 10);
15
- const generateKeyPair = (seed) => {
16
- let bigInt = BigNumber.from(0);
17
- for (let i = 0; i < seed.length; i++) {
18
- const item = seed[i];
19
- const itemBigInt = BigNumber.from(item);
20
- const tmp = BigNumber.from("256").pow(BigNumber.from(i));
21
- bigInt = bigInt.add(itemBigInt.mul(tmp));
22
- }
23
- const secretKey = bigInt.mod(jubjub.JUBJUB_L);
24
- const copySecretKey = BigNumber.from(secretKey.toString());
25
- const B = SignatureScheme.B();
26
- const publicKey = B.mul(copySecretKey);
27
- const keyPair = {
28
- "publicKeyX": publicKey.x.n.toString(),
29
- "publicKeyY": publicKey.y.n.toString(),
30
- "secretKey": secretKey.toString()
31
- };
32
- return keyPair;
33
- };
34
- export function generateKey(sig) {
35
- if (sig) {
36
- const seedBuff = ethUtil.sha256(fm.toBuffer(sig));
37
- const seed = BigNumber.from('0x' + seedBuff.toString('hex'));
38
- const bitIntDataItems = bnToBufWithFixedLength(seed.toString(), 32);
39
- const keyPair = generateKeyPair(bitIntDataItems);
40
- const formatedPx = fm.formatEddsaKey(fm.toHex(fm.toBig(keyPair.publicKeyX)));
41
- const formatedPy = fm.formatEddsaKey(fm.toHex(fm.toBig(keyPair.publicKeyY)));
42
- const sk = toHex(toBig(keyPair.secretKey));
43
- return {
44
- keyPair,
45
- formatedPx,
46
- formatedPy,
47
- sk,
48
- };
49
- }
50
- else {
51
- throw Error("No signature");
52
- }
53
- }
54
- export const getEdDSASigWithPoseidon = (inputs, PrivateKey) => {
55
- const p = field.SNARK_SCALAR_FIELD;
56
- const poseidonParams = new PoseidonParams(p, inputs.length + 1, 6, 53, 'poseidon', BigNumber.from(5), null, null, 128);
57
- let bigIntInputs;
58
- bigIntInputs = [];
59
- for (let i = 0; i < inputs.length; i++) {
60
- const input = inputs[i];
61
- bigIntInputs.push(BigNumber.from(input));
62
- }
63
- const hash = permunation.poseidon(bigIntInputs, poseidonParams);
64
- return {
65
- hash,
66
- result: genSigWithPadding(PrivateKey, hash),
67
- };
68
- };
69
- export const genSigWithPadding = (PrivateKey, hash) => {
70
- const signature = EDDSAUtil.sign(PrivateKey, hash);
71
- let signatureRx_Hex = fm.clearHexPrefix(fm.toHex(fm.toBN(signature.Rx)));
72
- if (signatureRx_Hex.length < 64) {
73
- const padding = new Array(64 - signatureRx_Hex.length).fill(0);
74
- signatureRx_Hex = padding.join('').toString() + signatureRx_Hex;
75
- }
76
- let signatureRy_Hex = fm.clearHexPrefix(fm.toHex(fm.toBN(signature.Ry)));
77
- if (signatureRy_Hex.length < 64) {
78
- const padding = new Array(64 - signatureRy_Hex.length).fill(0);
79
- signatureRy_Hex = padding.join('').toString() + signatureRy_Hex;
80
- }
81
- let signatureS_Hex = fm.clearHexPrefix(fm.toHex(fm.toBN(signature.s)));
82
- if (signatureS_Hex.length < 64) {
83
- const padding = new Array(64 - signatureS_Hex.length).fill(0);
84
- signatureS_Hex = padding.join('').toString() + signatureS_Hex;
85
- }
86
- const result = '0x' + signatureRx_Hex + signatureRy_Hex + signatureS_Hex;
87
- return result;
88
- };
89
- export function convertPublicKey2(pk) {
90
- // return new BN(EdDSA.pack(pk.x, pk.y), 16);
91
- return new BN(EDDSAUtil.pack(pk.x, pk.y), 16);
92
- }
93
- export function getUpdateAccountEcdsaTypedData(data, chainId) {
94
- const message = {
95
- owner: data.owner,
96
- accountID: data.accountId,
97
- feeTokenID: data.maxFee.tokenId,
98
- maxFee: data.maxFee.volume,
99
- publicKey: fm.addHexPrefix(convertPublicKey2(data.publicKey).toString(16)),
100
- validUntil: data.validUntil,
101
- nonce: data.nonce,
102
- };
103
- const typedData = {
104
- types: {
105
- EIP712Domain: [
106
- { name: 'name', type: 'string' },
107
- { name: 'version', type: 'string' },
108
- { name: 'chainId', type: 'uint256' },
109
- { name: 'verifyingContract', type: 'address' },
110
- ],
111
- AccountUpdate: [
112
- { name: 'owner', type: 'address' },
113
- { name: 'accountID', type: 'uint32' },
114
- { name: 'feeTokenID', type: 'uint16' },
115
- { name: 'maxFee', type: 'uint96' },
116
- { name: 'publicKey', type: 'uint256' },
117
- { name: 'validUntil', type: 'uint32' },
118
- { name: 'nonce', type: 'uint32' },
119
- ],
120
- },
121
- primaryType: 'AccountUpdate',
122
- domain: {
123
- name: 'Loopring Protocol',
124
- version: '3.6.0',
125
- chainId,
126
- verifyingContract: data.exchange,
127
- },
128
- message: message,
129
- };
130
- return typedData;
131
- }
132
- export function getTransferTypedData(data, chainId) {
133
- const message = {
134
- from: data.payerAddr,
135
- to: data.payeeAddr,
136
- tokenID: data.token.tokenId,
137
- amount: data.token.volume,
138
- feeTokenID: data.maxFee.tokenId,
139
- maxFee: data.maxFee.volume,
140
- validUntil: data.validUntil,
141
- storageID: data.storageId,
142
- };
143
- const typedData = {
144
- types: {
145
- EIP712Domain: [
146
- { name: 'name', type: 'string' },
147
- { name: 'version', type: 'string' },
148
- { name: 'chainId', type: 'uint256' },
149
- { name: 'verifyingContract', type: 'address' },
150
- ],
151
- Transfer: [
152
- { name: 'from', type: 'address' },
153
- { name: 'to', type: 'address' },
154
- { name: 'tokenID', type: 'uint16' },
155
- { name: 'amount', type: 'uint96' },
156
- { name: 'feeTokenID', type: 'uint16' },
157
- { name: 'maxFee', type: 'uint96' },
158
- { name: 'validUntil', type: 'uint32' },
159
- { name: 'storageID', type: 'uint32' },
160
- ],
161
- },
162
- primaryType: 'Transfer',
163
- domain: {
164
- name: 'Loopring Protocol',
165
- version: '3.6.0',
166
- chainId: chainId,
167
- verifyingContract: data.exchange,
168
- },
169
- message: message,
170
- };
171
- return typedData;
172
- }
173
- export function get_EddsaSig_Transfer(request, eddsaKey) {
174
- const inputs = [
175
- new BN(ethUtil.toBuffer(request.exchange)).toString(),
176
- request.payerId,
177
- request.payeeId,
178
- request.token.tokenId,
179
- request.token.volume,
180
- request.maxFee.tokenId,
181
- request.maxFee.volume,
182
- new BN(ethUtil.toBuffer(request.payeeAddr)).toString(),
183
- 0,
184
- 0,
185
- request.validUntil,
186
- request.storageId,
187
- ];
188
- return getEdDSASigWithPoseidon(inputs, eddsaKey);
189
- }
190
- export function getEdDSASig(method, basePath, api_url, requestInfo, PrivateKey) {
191
- let params;
192
- method = method.toUpperCase().trim();
193
- if (method === 'GET' || method === 'DELETE') {
194
- params = makeRequestParamStr(requestInfo);
195
- }
196
- else if (method === 'POST' || method === 'PUT') {
197
- params = makeObjectStr(requestInfo);
198
- }
199
- else {
200
- throw new Error(`${method} is not supported yet!`);
201
- }
202
- const uri = encodeURIComponent(`${basePath}${api_url}`);
203
- const message = `${method}&${uri}&${params}`;
204
- let _hash = new BigInteger(crypto.SHA256(message).toString(), 16);
205
- let hash = _hash.mod(SNARK_SCALAR_FIELD).toFormat(0, 0, {});
206
- const sig = genSigWithPadding(PrivateKey, hash);
207
- return sig;
208
- }
209
- const makeRequestParamStr = (request) => {
210
- const arrObj = Array.from(request);
211
- arrObj.sort(function (a, b) {
212
- return a[0].localeCompare(b[0]);
213
- });
214
- const orderedMap = new Map(arrObj.map((i) => [i[0], i[1]]));
215
- const paramlist = [];
216
- const keys = Object.keys(Object.fromEntries(orderedMap));
217
- if (keys) {
218
- keys.forEach((key) => {
219
- const value = request.get(key);
220
- if (value !== undefined && value !== '')
221
- paramlist.push(`${key}=${value}`);
222
- });
223
- }
224
- // force to change encode ',' due to different encode rules between server and client
225
- return encodeURIComponent(paramlist.join('&')).replace(/%2C/g, '%252C');
226
- };
227
- const makeObjectStr = (request) => {
228
- const jsonTxt = JSON.stringify(Object.fromEntries(request));
229
- return encodeURIComponent(jsonTxt).replace(/[!'()]/g, escape); //replace(/'/ig, "%27")
230
- };
@@ -1,28 +0,0 @@
1
- /*Transition*/
2
- @keyframes fadeIn {
3
- from {
4
- opacity: 0;
5
- }
6
- to {
7
- opacity: 1;
8
- }
9
- }
10
-
11
- @keyframes fadeOut {
12
- from {
13
- opacity: 1;
14
- }
15
- to {
16
- opacity: 0;
17
- }
18
- }
19
-
20
- .dialog-overlay[data-state='open'],
21
- .dialog-content[data-state='open'] {
22
- animation: fadeIn 100ms ease-out;
23
- }
24
-
25
- .dialog-overlay[data-state='closed'],
26
- .dialog-content[data-state='closed'] {
27
- animation: fadeOut 100ms ease-in;
28
- }
@@ -1,372 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- @layer utilities {
6
-
7
- /* Chrome, Safari, Edge, Opera */
8
- input::-webkit-outer-spin-button,
9
- input::-webkit-inner-spin-button {
10
- -webkit-appearance: none;
11
- margin: 0;
12
- }
13
-
14
- /* Firefox */
15
- input[type="number"] {
16
- -moz-appearance: textfield;
17
- }
18
-
19
- .styled-scroll {
20
- @apply scrollbar:!w-1.5 scrollbar:!h-1.5 scrollbar:bg-secondary-500 scrollbar-thumb:!rounded scrollbar-thumb:!bg-slate-500/50 ;
21
- }
22
-
23
- .rdxCommandList {
24
- max-height: var(--radix-popper-available-height);
25
- }
26
- }
27
-
28
- @layer base {
29
-
30
- body {
31
- @apply bg-secondary-900 sm:bg-secondary-950;
32
- }
33
-
34
- /* On iOS disabled inputs have default opacitiy */
35
- .ntdi {
36
- opacity: 1;
37
- /* required on iOS */
38
- }
39
- }
40
-
41
- .styled-scroll {
42
- scrollbar-width: thin !important;
43
- scrollbar-color: rgba(100, 116, 139, 0.5) transparent;
44
- }
45
-
46
- .styled-scroll::-webkit-scrollbar {
47
- width: 0.375rem !important;
48
- height: 0.375rem;
49
- background-color: #64748b;
50
- }
51
-
52
- .styled-scroll::-webkit-scrollbar-thumb {
53
- background-color: rgba(100, 116, 139, 0.5);
54
- border-radius: 9999px;
55
- }
56
-
57
- iframe body {
58
- display: none;
59
- }
60
-
61
- .light .top-backdrop {
62
- display: none;
63
- }
64
-
65
- .top-backdrop {
66
- width: 1325px;
67
- height: 1164px;
68
- position: absolute;
69
- filter: blur(133px);
70
- transform: translate(-50%, -50%) translate3d(0, 0, 0);
71
- left: 50%;
72
- top: -5%;
73
- border-radius: 50%;
74
- z-index: -1;
75
- opacity: 80%;
76
- background: theme('colors.primary.background');
77
- }
78
-
79
-
80
- input:-webkit-autofill,
81
- input:-webkit-autofill:hover,
82
- input:-webkit-autofill:focus,
83
- textarea:-webkit-autofill,
84
- textarea:-webkit-autofill:hover,
85
- textarea:-webkit-autofill:focus,
86
- select:-webkit-autofill,
87
- select:-webkit-autofill:hover,
88
- select:-webkit-autofill:focus {
89
- transition: all 5000s ease-in-out 0s;
90
- transition-property: background-color, color;
91
-
92
- /* border: 1px solid #1A2949; */
93
- -webkit-text-fill-color: rgb(var(--ls-colors-primary-text));
94
- caret-color: rgb(var(--ls-colors-primary-text));
95
- -webkit-box-shadow: 0 0 0px 1000px rgb(var(--ls-colors-secondary-700)) inset;
96
- box-shadow: 0 0 0px 1000px rgb(var(--ls-colors-secondary-700)) inset;
97
-
98
- }
99
-
100
- .shadowed-button {
101
- transform: translate3d(0, 0, 0);
102
- }
103
-
104
- hr.horizontal-gradient {
105
- border: 0;
106
- height: 1px;
107
- background-image: linear-gradient(to right, hsla(0, 0%, 100%, 0), #1A2949, hsla(0, 0%, 100%, 0));
108
- }
109
-
110
- .strong-highlight {
111
- position: relative;
112
- opacity: 1;
113
- z-index: 1;
114
- display: inline-block;
115
- margin: 0 3px;
116
- }
117
-
118
- .strong-highlight::after {
119
- /* Highlight color */
120
- background-color: theme('colors.secondary.500');
121
- content: "";
122
- position: absolute;
123
- width: calc(100% + 10px);
124
- height: 110%;
125
- border-radius: 5px;
126
- left: -5px;
127
- bottom: -5%;
128
- z-index: -1;
129
- }
130
-
131
- .iphone-x {
132
- position: relative;
133
- margin: 40px auto;
134
- width: 320px;
135
- height: 780px;
136
- background-color: #7371ee;
137
- background-size: contain;
138
- border-radius: 40px;
139
- box-shadow: 0px 0px 0px 11px #1f1f1f, 0px 0px 0px 13px #191919, 0px 0px 0px 20px #111;
140
- }
141
-
142
- .iphone-x:before,
143
- .iphone-x:after {
144
- content: "";
145
- position: absolute;
146
- left: 50%;
147
- transform: translateX(-50%);
148
- }
149
-
150
- .iphone-x:after {
151
- bottom: 7px;
152
- width: 140px;
153
- height: 4px;
154
- background-color: #f2f2f2;
155
- border-radius: 10px;
156
- }
157
-
158
- .iphone-x:before {
159
- top: 0px;
160
- width: 56%;
161
- height: 30px;
162
- background-color: #1f1f1f;
163
- border-radius: 0px 0px 40px 40px;
164
- }
165
-
166
- .iphone-x i,
167
- .iphone-x b,
168
- .iphone-x s,
169
- .iphone-x span {
170
- position: absolute;
171
- display: block;
172
- color: transparent;
173
- }
174
-
175
- .iphone-x i {
176
- top: 0px;
177
- left: 50%;
178
- transform: translate(-50%, 6px);
179
- height: 8px;
180
- width: 15%;
181
- background-color: #101010;
182
- border-radius: 8px;
183
- box-shadow: inset 0px -3px 3px 0px rgba(255, 255, 255, 0.2);
184
- }
185
-
186
- .iphone-x b {
187
- left: 10%;
188
- top: 0px;
189
- transform: translate(180px, 4px);
190
- width: 12px;
191
- height: 12px;
192
- background-color: #101010;
193
- border-radius: 12px;
194
- box-shadow: inset 0px -3px 2px 0px rgba(255, 255, 255, 0.2);
195
- }
196
-
197
- .iphone-x b:after {
198
- content: "";
199
- position: absolute;
200
- background-color: #2d4d76;
201
- width: 6px;
202
- height: 6px;
203
- top: 2px;
204
- left: 2px;
205
- top: 3px;
206
- left: 3px;
207
- display: block;
208
- border-radius: 4px;
209
- box-shadow: inset 0px -2px 2px rgba(0, 0, 0, 0.5);
210
- }
211
-
212
- .iphone-x s {
213
- top: 50px;
214
- color: #fff;
215
- text-align: center;
216
- text-decoration: none;
217
- width: 100%;
218
- font-size: 70px;
219
- font-weight: 100;
220
- padding-top: 60px;
221
- }
222
-
223
- .iphone-x span {
224
- bottom: 50px;
225
- width: 40px;
226
- height: 40px;
227
- background-color: rgba(0, 0, 0, 0.3);
228
- border-radius: 50%;
229
- left: 30px;
230
- }
231
-
232
- .iphone-x span+span {
233
- left: auto;
234
- right: 30px;
235
- }
236
-
237
-
238
-
239
- .carousel {
240
- overflow: hidden;
241
- }
242
-
243
- .inner {
244
- white-space: nowrap;
245
- transition: transform 0.3s;
246
- }
247
-
248
- .carousel-item {
249
- display: inline-flex;
250
- align-items: center;
251
- justify-content: center;
252
- height: 200px;
253
- background-color: green;
254
- color: #fff;
255
- }
256
-
257
- .indicators {
258
- display: flex;
259
- justify-content: center;
260
- }
261
-
262
- .indicators>button {
263
- margin: 5px;
264
- }
265
-
266
- .indicators>button.active {
267
- background-color: green;
268
- color: #fff;
269
- }
270
-
271
- .carousel {
272
- display: inline-flex;
273
- overflow-x: hidden;
274
- /* scroll snap is a great feature which will center the image on snap on touch screen devices */
275
- scroll-snap-type: x mandatory;
276
- /* all below will hide the scrollbar on all browsers. */
277
- -webkit-overflow-scrolling: touch;
278
- scrollbar-width: none;
279
- /* For Firefox */
280
- -ms-overflow-style: none;
281
- /* For Internet Explorer and Edge */
282
- }
283
-
284
- tspan {
285
- font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
286
- }
287
-
288
- input::-webkit-input-placeholder {
289
- line-height: normal !important;
290
- }
291
-
292
- body {
293
- overflow: overlay;
294
- }
295
-
296
- body::-webkit-scrollbar {
297
- --tw-bg-opacity: 1;
298
- background-color: rgb(var(--ls-colors-secondary-700));
299
- }
300
-
301
- body::-webkit-scrollbar {
302
- width: 0.375rem !important;
303
- }
304
-
305
- body::-webkit-scrollbar {
306
- height: 0.375rem !important;
307
- }
308
-
309
- body::-webkit-scrollbar-thumb {
310
- background-color: rgb(var(--ls-colors-secondary-text), 0.4) !important;
311
- }
312
-
313
- body::-webkit-scrollbar-thumb {
314
- --tw-bg-opacity: 1 !important;
315
- }
316
-
317
- body::-webkit-scrollbar-thumb {
318
- border-radius: 0.25rem !important;
319
- }
320
-
321
- input:disabled,
322
- textarea:disabled,
323
- input:disabled::placeholder,
324
- textarea:disabled::placeholder {
325
- -webkit-text-fill-color: theme('colors.primary.text-placeholder');
326
- /* 1. sets text fill to 'primary-text': '#a4afc8' */
327
- opacity: 1;
328
- /* 2. correct opacity on iOS */
329
- }
330
-
331
- .space-x-reverse {
332
- --space-x-reverse: 1
333
- }
334
-
335
- .space-y-reverse {
336
- --space-y-reverse: 1
337
- }
338
-
339
- .loader, .loader:before, .loader:after {
340
- border-radius: 50%;
341
- width: 2.5em;
342
- height: 2.5em;
343
- animation-fill-mode: both;
344
- animation: bblFadInOut 1.8s infinite ease-in-out;
345
- }
346
- .loader {
347
- color: #FFF;
348
- font-size: 7px;
349
- position: relative;
350
- text-indent: -9999em;
351
- transform: translateZ(0);
352
- animation-delay: -0.16s;
353
- }
354
- .loader:before,
355
- .loader:after {
356
- content: '';
357
- position: absolute;
358
- top: 0;
359
- }
360
- .loader:before {
361
- left: -3.5em;
362
- animation-delay: -0.32s;
363
- }
364
- .loader:after {
365
- left: 3.5em;
366
- }
367
-
368
- @keyframes bblFadInOut {
369
- 0%, 80%, 100% { box-shadow: 0 2.5em 0 -1.3em }
370
- 40% { box-shadow: 0 2.5em 0 0 }
371
- }
372
-