Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial commit * Adds rollup publishing build tool * Adds examples React app * Removes react from devDependencies, only peerDeps * Adds synapse sdk to package, ethers to example app, testing a fixed quote * Fetches bridge quote with static data * Adds tailwind, postcss rollup config * Basic styling * Adds dynamic fetching for amount * Adds receipt * Sets up theming and variable colors * Minor naming changes & organization * Adds customTheme support * Adds night theming preset * Adds tokens with token metadata as prop * Adds rollup watch mode * Renames package to @synapsecns/widget * Adds instructions on running locally * Merge pull request #17 from abtestingalpha/update-readme Adds instructions on running locally * apply color vars directly to widget * custom colors v1 * Removes unused fields * Removes unused type * Feat/wallet provider (#24) * Testing Provider Behavior * Update `Bridge` to accept `web3Provider` prop from Consumer * `useEthereumWallet` hook to handle mocking Consumer Wallet * Pass in Consumer web3Provider to Bridge component * `getAccounts` util function to grab current connect address to window.ethereum object * Consumer Provider state * useEthereumWallet utility hook to grab current browser ethereum data * Mock Consumer Provider * Log when Consumer chain/account updates * Add `Web3Provider` * ... * Update for merge * Start migration of Widget component to allow for index to be app setup * Declare `WidgetProps` type * Migrate Bridge contents to Widgets component * Wrap `Widget` with `Web3Provider` to provide Context access * Fetch Web3 Provider data when provider detected from Consumer * Update Context values * Construct `handleBridge` callback to test Consumer Provider * Add Button to invoke handleBridge * Add prettier config * Format code with Prettier * ... * Add settings (#25) * Tailwind refinements (#26) * tailwind refinements * variable naming wip * adds --brand color to CustomTheme * Removes unused fields * Removes unused type * Feat/wallet provider (#24) * Testing Provider Behavior * Update `Bridge` to accept `web3Provider` prop from Consumer * `useEthereumWallet` hook to handle mocking Consumer Wallet * Pass in Consumer web3Provider to Bridge component * `getAccounts` util function to grab current connect address to window.ethereum object * Consumer Provider state * useEthereumWallet utility hook to grab current browser ethereum data * Mock Consumer Provider * Log when Consumer chain/account updates * Add `Web3Provider` * ... * Update for merge * Start migration of Widget component to allow for index to be app setup * Declare `WidgetProps` type * Migrate Bridge contents to Widgets component * Wrap `Widget` with `Web3Provider` to provide Context access * Fetch Web3 Provider data when provider detected from Consumer * Update Context values * Construct `handleBridge` callback to test Consumer Provider * Add Button to invoke handleBridge * Add prettier config * Format code with Prettier * ... * Add settings (#25) * Update merge conflict missing code * Fix prop error --------- Co-authored-by: Lawson Kight <[email protected]> Co-authored-by: abtestingalpha <[email protected]> * Tailwind refinements (#27) * tailwind refinements * variable naming wip * adds --brand color to CustomTheme * Removes unused fields * Removes unused type * Feat/wallet provider (#24) * Testing Provider Behavior * Update `Bridge` to accept `web3Provider` prop from Consumer * `useEthereumWallet` hook to handle mocking Consumer Wallet * Pass in Consumer web3Provider to Bridge component * `getAccounts` util function to grab current connect address to window.ethereum object * Consumer Provider state * useEthereumWallet utility hook to grab current browser ethereum data * Mock Consumer Provider * Log when Consumer chain/account updates * Add `Web3Provider` * ... * Update for merge * Start migration of Widget component to allow for index to be app setup * Declare `WidgetProps` type * Migrate Bridge contents to Widgets component * Wrap `Widget` with `Web3Provider` to provide Context access * Fetch Web3 Provider data when provider detected from Consumer * Update Context values * Construct `handleBridge` callback to test Consumer Provider * Add Button to invoke handleBridge * Add prettier config * Format code with Prettier * ... * Add settings (#25) * Update merge conflict missing code * Fix prop error * hide second Bridge instance --------- Co-authored-by: abtestingalpha <[email protected]> Co-authored-by: bigboydiamonds <[email protected]> * fixed merge error * Adds react-redux & rtk, base state/store (#28) * Custom theme variables (#29) * update CustomTheme variable names * preparing to move theme builder into widget * Landing page reflects color variables used in code * Adds Token & Chain selectors (#30) * Feat/action callbacks (#31) * Init `useBridgeQuoteCallback` * Add guardrail statements for useBRidgeQuoteCallback states * getBridgeQuote * Add FetchStatusCallback to clean `getBridgeQuoet` progress updates * Return `getBridgeQuote` as callback in useBridgeQuoteCallback` * Add return type * BridgeQuote callback working * `useBridgeQuoteCallback` working properly in Widget * approveErc20Token util * init useApproveCallback * getErc20TokenAllowance * Init `useAllowance` hook * Update fetchErc20TokenAllowance prop naming * Add guardrail statements in useAllowance * Return checkAllowance callback in useAllowance hook * Clean useAllowance * useAllowance return type * Integrating * Add error handling for fetchErc20TokenAllowance * Import supported Chain constants, Wagmi setup * rollup image plugin * Basic Wagmi setup * Update roll up config, add back WagmiConfig * Working Viem * Update f etchErc20TokenAllowance with viem * Update `approveErc20Token` util action for viem * Basic useApprove callback * Basic approve callback flow working * Prevent approve callback from firing if guardrails fail * UseBridgeCallbackArgs interface * Pass synapseSDK object into useBridgeCallback * useBridgeCallback guardrail checks * Basic useBridgeCallback working with callback * Working * Wrap error handler on fetchBridgeQuote * Add Polygon on Consumer side * Set Polygon as Destination for testing bridge callback * Bridge Callback working * Add static Approve and Bridge button with states when Quote is reuiqred * rm assets/constants not being used yet * Fix merge * Setup Example with latest Redux work * Theme utility (#32) * utils stub * widget test * generate theme utility * popover style * hide synapse-accent --------- Co-authored-by: bigboydiamonds <[email protected]> * Adds setTokens (#33) * Specify index.d.ts file in rollup config (#34) * Adds bridgeable tokens for export from widget and import into consumer implementation (#35) * Exclude examples from core tsconfig (#36) * Feat/bridge button (#37) * Polish `useApproval` hook to include error handling * Improve useApproveCallback error handling * Log error when invoking approve missing dependencies * Keep Guardrail checks within approve callback function * . * UseBridgeCallbackErrors * Implement UseBridgeCallbackError types in Guardrail checks in callback * Update useBridgeCallback for error handling and return callback + error * Improve error handling in useApproveCallback for use in Bridge button * Update `useBridgeCallback` for error handlign updates * . * Add static function for switching wallets based on Consumer prop provider * `BridgeButton` * Calculate when `isAmountApproved` * Add callback for resetQuote function from useBridgeQuoteCallback * Update name to `useBridgeQuote` * Add isOnlyZeroes util function to test input state * Update util function to capture 0. * Track when input is valid * useEffect to trigger fetching bridge quote based on valid input * Add logging on fetch status * Restructure * Move buttons to BridgeButton component * Pass in required props for BridgeButton for approve/bridge functionality with error handling * Add BridgeError to temp display error handling between Approve and Bridge * Detect when Origin Chain is different from Connected Chain * `handleSwitchNetwork` callback * Show Switch Network Button when Consumer connected network is different from Origin network * Update BridgeButton to display name of network to connect to * Handle `handleSwitchNetwork` errors * Make explicit check for allowance being null when checking approvals * Abstract bridge/approve callback args * Add `approveState` to track when pending approval in progress * Add `isPendingApproval` and `isPendingBridge` props to `BridgeButton` * Provide `bridgeState` for pending bridge action * Add Pending status props value to BridgeButton * . * Show Pending text in Bridge button * Ensure Pending Approve fires * Refetch allowance on success * Update (#38) * Fix origin token decimals (#39) * Handles empty quote (#40) * Landing page (#41) * Adds setTokens (#33) * wip * article css * landing page styling wip * footer * remove hyperlink from receipt expand block * landing page light mode * mobile responsiveness --------- Co-authored-by: abtestingalpha <[email protected]> * Adds routeMaker (#42) * Placeholder for unselected options (#43) * feat/multicall-balances (#44) * Consumer passed in provider to be used for approve * Update `fetchErc20TokenAllowance` to use ethers * Remove viem client/wallet, use Consumer * Remove instances of viemClient/viemWallet * Add `switchNetwork` util function * Add error handling for `switchNetwork` * Add erc20 and multicall abis * `fetchTokenBalances`, add `useMulticallContract` hook * Setup `fetchTokenBalances` multicall * Add `resolveJsonModule: true` in ts config * Add `allowSyntheticDefaultImports` * Update to using ethers v6 syntax * Add `json()` to rollup config to parse json imports * Add `address` and `chainId` props to `fetchTokenBalances`, multicall successful * Add async thunk `fetchAndStoreTokenBalances` * Add `TokenBalances` return type for `fetchTokenBalances` * Add `balances` `TokenBalances type` state to Bridge * Add fetch states * Add reducers for `fetchAndStoreTokenBalances` async thunk * Set Redux store `serializableCheck` to false to store bigint * Temp store `balance` as string until can store directly as bigint * Remove balance check btn * Add `inputAmount` Bridge state * `setInputAmount` reducer * Add `debouncedInputAmount` state and reducer * Add debouncing for `inputAmount` * `handleUserInput` callback to handle updating `inputAmount` in Bridge state * Use `debouncedInputAmount` to trigger/fetch bridge quotes * `AvailableBalance` * Hook `AvailableBalance` up in Widget, functional * Show available balances in token drop down as well * Add `Address` type prior to removing Viem * Add zero address const * Replace `erc20ABI` with local import * Remove Wagmi Viem packages * Remove `viem` package from roll up config (#45) * Remove `viem` package from roll up config * Use `ZeroAddress` from ethers package * rm log * Filters for consumer provided tokens (#46) * Minor styling (#48) * Feat/polish callback flow (#47) * Select `networkProvider` instance based on `originChainId` in Bridge * Update `fetchTokenBalances` prop from `signer` to `signerOrProvider` * use `originChainProvider` to query for multicall token balances * Add guardrail checks in `fetchTokenBalances` to not fire off fetch call if signer or provider null or not matching `originChainId` * Type * Ensure `AvailableBalance` does not crash app when `balances` filled by fetch error state * Update `AvailableBalance` displayed value when `originChainId` and `originToken` update * Fix `stringToBigInt` error when amount not valid * Add `isOrigin` prop to `TokenSelect` to determine if to show balances * . * Update `ApproveStateCallback.onSuccess()` callback to fire off callback before setting approve state * Use `debouncedInputValue` throughout Widget where applicable * Pass in `originChainProvider` into approve/allowance callbacks * Ensure `fetchQuoteCallback` is a valid function before firing off in useEffect * . * Add back label * . * Update `web3Provider` and `networkProviders` with ethers types * Update chainId comparison * Remove `Address` type * Update for abstract provider * Temp set `networkProviders` to any * Add comments * * Adds ETH (#49) * Handles for zero address balances * Handles remaining token options (#51) * Feat/callback required provider (#50) * Update `fetchErc20TokenAllowance` props to use only `provider` and add error handling for when missing props * Update `useAllowance` invoked instances for update in props * `useApproveCallback` to accept Signer, not provider * . * Flow control for bridging eth (#52) * Package json updates (#53) * Updates name for scope (#54) * Uses package from registry (#55) * Increment version (#56) * Uses 0.0.2 (#57) * Increment to 0.0.3 (#58) * Adds terser to minify (#60) * Bridge Button States with Tooltip (#59) * Update Button text states * Tooltip with basic styling * Adjust Tooltip * Clean BridgeButton * Add status props to BridgeButton * Pending Button state, prevent callback from firing if currently pending * Pass inputGreaterThanBalance boolean value into `BridgeButton` for Tooltip state * Add `BridgeButton` tooltip state for when input greater than balance * Update `AvailableBalance` when `originToken` is null * Add Tooltip when Approve callback prompts Wallet * Adjust placement of `AvailableBalance` * Hide `AvailableBalance` if `originToken` is null * If !originToken, `AvailableBalance` display Select source token msg * `checkExists()` util function to check if value is null or undefined * Add Warning icon * Customize width of Warning icon * . * Move `checkExists()` to util file * Rename file to contain only single util func * 0.0.5 (#61) * Fix/eth approval (#62) * Return `fetchErc20TokenAllowance` early when tokenAddress is ZeroAddress * . * 0.0.6 (#63) * Adds validations and current balance hooks (#64) * Wallet (#65) * Migrate `balances` to wallet slice * Add wallet to store * Replace prior instances of `balances` from bridge state * Moves data fetching into Web3Provider (#66) * Refactor decimals (#67) * Adds fetch state to fulfilled and rejected (#68) * Transactions (#69) * Add `transactions` slice to store * Add reducers for `addTransaction` and `finalizeTransaction` * Add `removTransaction` reducer * Init Transaction component * Pass props into `DownArrow` icon component * Add MenuItem to add into DropdownMenu * Create static Transaction * Style basic Transaction with hover menu * Style Transaction * Transaction links (#71) * Add `getSynapseExplorerLink` util func * Use txHash if kappa not avail to construct synapse explorer link * `getTxBlockExplorerLink` util function * Apply Transaction props to form tx links * Set static props to test Transaction links, distinguish origin v dest txHash * Preflight false (#72) * Transaction links (#71) * Add `getSynapseExplorerLink` util func * Use txHash if kappa not avail to construct synapse explorer link * `getTxBlockExplorerLink` util function * Apply Transaction props to form tx links * Set static props to test Transaction links, distinguish origin v dest txHash * add border-solid * fix button and token popover --------- Co-authored-by: bigboydiamonds <[email protected]> * New branch (#74) * Preflight false (#72) * Transaction links (#71) * Add `getSynapseExplorerLink` util func * Use txHash if kappa not avail to construct synapse explorer link * `getTxBlockExplorerLink` util function * Apply Transaction props to form tx links * Set static props to test Transaction links, distinguish origin v dest txHash * add border-solid * fix button and token popover --------- Co-authored-by: bigboydiamonds <[email protected]> * consolidate BridgeButton styles cleanup --------- Co-authored-by: bigboydiamonds <[email protected]> * State refactor (#75) * Refactoring state * Adds bridgeTransaction slice * Adds approveTransaction slice * Serializer for BigInt Redux Devtools * Housekeeping: Cleanup typing * Adds peerDepsExternal (#77) * style adjustments (#76) * Style fixes (#78) * style adjustments * tailwind darkmode fixes * fixed duplicate line created from merge * fixes dark mode secondary color * Add variables (#79) * add variable names * consilidate focus * generateTheme bug fix (#80) * Moves themeVariables to hook (#81) * token popover layout (#82) * Removes inputAmount from redux (#84) * resizing and container playground (#83) * resizing and container playground * reset css wrapper * pending and receipt responsiveness * merge step 1 * merge step 2 * Transaction Flow + Examples/next (#86) * Export `transactions` actions * Update for more verbose name * Remove dispatch action within executeBridgeTxn async thunk * Add hook `useTransactionsState` * Transactions `Updater` component to handle keeping transactions slice up to date with latest txnHash pulled from `executeBridgeTxn` async thunk * Add `TransactionsUpdater` to root level of app * `useBridgeTxStatus` hook * Include `destinationTxHash` as part of TransactionDetails type * Basic `Transactions` component that will house rendering all transactions in store * Pass synapseSDK from Widget down to Transaction to use SDK functions * Add bridgeModuleName prop through transaction flow * Explorer util functions to return null if URL creation fails * Use bridge tx status to determine text to display * Add isNull util function * Render explorer links based on availability in Transaction component * getTime util function * Pass `bridgeQuote.bridgeModuleName` into executeBridgeTxn async thunk * Add additional values to bridgeTransaction slice necessary for Transaction component * Add timestamp to executeBridgeTxn async thunk * Add transaction with `TransactionDetail` props * Destructure tx hash out of tx receipt * Do not add transaction when txHash is null * Transaction hash + timestamp coming in properly * Require all props of TransactionDetail when updating store for transaction * Add `getSynapseTxId` util function * Return fetched kappa vaue in useBridgeTxStatus * Update store transaction for kappa when available * Ensure transaction has not already been marked complete before dispatching completeTransaction() * Include `estimatedTime` from bridge quote in storing tx flow * Add time tracker/updater in Transactions component to retrigger checking tx status every minute * Use proper triggers for calling `useBridgeTxStatus` for independent txs * Update synapse sdk pkg, ensure passing synapseSDK instance from Widget down to Transaction component * Show estimated time in minutes * Resolve path polyfill error * `TimeRemaining` Transaction component to determine what to display in estimated duration area * Add callback to handle when User wants to clear txn from display * Construct explorer constants file, add `getExplorerAddressUrl` util function * Provide dest explorer address url * Add ExplorerNames constant, update Avascan to Snowtrace * Return explorer name in util funcs for grabbing Explorer urls * Display explorer names dynamically * . * Remove `destinationTxHash` as we do not retrieve that in sdk flow * Init next app * Setup next app * CSR directive * Ensure proper destructuring of synapseSDK in Transactions component * Update roll up config * rm logs * Prevent reload if no link in MenuItme * Update Transaction MenuItem list for when isComplete is true * Update check to every 30s for txn status * rm unused pkgs * Fix * fix --------- Co-authored-by: Jonah Lin <[email protected]> * Simplifies next example to only widget (#87) * Updates sdk-router to 0.3.6 (#88) * Updates package version (#89) * landing page improvements (#90) * Adds chains & synapse provider (#91) * Increments to 0.0.9 (#92) * Adds chains for select (#93) * All chain support (#94) * Uses synapse providers (#95) * Resets balances to [] on chain change (#96) * 0.0.11 (#97) * Handles empty hoverText on Tooltip (#98) * Nowrapping on whitespace (#99) * 0.0.12 (#100) * Removes unused imports (#101) * Adds usdce (#102) * Selector scrolling (#103) * Removes unused attrs (#104) * SDK Slippage Helpers (#105) * Update SDK version * Replace slippage calculations with SDK * Replace slippage calculations with SDK * Remove slippage helpers * Removes value field for erc20s (#107) * Fix dom names (#109) * 0.0.14 (#110) * Fallback rpc (#106) * Implement FallbackProvider to utilize both primary and fallback rpc urls * Add mock custom rpcs to simulate Consumer object * Add `FallbackRpcUrls` type to temp declare prop structure for Consumer passing in custom rpcs * Utilize Consumer custom rpc provider * Setup quorum * Use default quorum for balanced speed/security * Fallback working, set quorum to 1 * Set priority for rpc based on order of Consumer, Primary, Fallback * Move `CustomFallbackRpc` type to types file * Add `CustomFallbackRpcs` type as optional prop in `WidgetProps` * Enforce 2s timeout before trying new rpc * Add error handling for `fetchAndStoreTokenBalances` so that unhealthy rpc will not crash app * Set error state to null when refetching async thunks * Working FallbackProvider with configs * Add Custom fallback rpc prop in with-react example * Allow null value for fallbackRpc prop * 0.0.15 (#111) * Exports all supported tokens (#112) * Renames to customRpcs (#114) * Refetch token allowance after approve (#113) * Refetch token allowance after approve * `executeBridge` callback will refetch allowance and balance after successful call * `executeApproval` to fetch allowance only on successful approve tx * Fetch balance/allowance on successful bridge tx * Ensure thunk type * 0.0.16 (#115) * Target tokens and target chainids (#116) * 0.0.17 (#117) * Sort Token balances (#118) * Merge `options` with `balances` to prep sort * Merge `remaining` with `balances` to prep sort * Sort options & remaining by balances, priorityRank * Render sorted options/remaining in Token dropdown, set balances to null if not available * clean * Prevent app crash when option not avail * Ensure every option has valid `BridgeableToken` assigned * Clean imports * Refactor merge logic into separate function * 0.0.18 (#119) * Upgrades sdk with new slippage calcs (#120) * Txn tracking rewrite (#121) * v0.0.19 * Fixes time (#122) * Fallback refactor (#123) * configureFallbackProvider() * configureFallbackProvider working * Stallout time set to 0.75s * Revert example arbitrum rpc * Update documentation comments for configureFallbackProvider * Code org (#124) * Uses rfq quotes (#125) * Consumer select (#126) * Uses rfq quotes (#125) * consumer select element for theme testing * padding and spacing improvements --------- Co-authored-by: abtestingalpha <[email protected]> * Switch on chain change (#127) * Gradient backgrounds (#128) * Consumer select (#126) * Uses rfq quotes (#125) * consumer select element for theme testing * padding and spacing improvements --------- Co-authored-by: abtestingalpha <[email protected]> * move bg style from tw className to style attribute --------- Co-authored-by: abtestingalpha <[email protected]> * Moving to node v16.14, downgrade rollup * Troubleshooting cjs build * Removes type module, React to draw from npm, Next from linked pkg * gmx bug fix * Renames build command * Pares down app for example * Adds Next landing-page app * Updates readmes * Linting * Updates package json with targets * Updates landing page for themes/tokens/chains by consumer * Filtering token selection options based on targetTokens * Adds existence check * Adds installation and customization instructions * Adds images * Updates instructional copy on landing page * Deprecates dark/light mode theme for customTheme bgColor * Comment out explorer link --------- Co-authored-by: Lawson Kight <[email protected]> Co-authored-by: bigboydiamonds <[email protected]> Co-authored-by: Jonah Lin <[email protected]>
- Loading branch information