Skip to content

Commit 8822d56

Browse files
shunkakinokipkieltykaScreamingHawkAgusx1211taylanpince
authored
feat: add anypay + @anypay/sdk (#720)
* clean up: move turbo boilerplate pkgs from packages/ to repo/ folder * add packages/services and packages/utils * services/relayer: disable older tests * remove old. rename apps to extras. group core wallet pkgs in folder. * rename @0xsequence/sequence-XXX to @0xsequence/wallet-XXX * update path * various fixes after path change * Ignore husky. We use lefthook * Fix typecheck * ci tests * Completing configuration update deletes other pending updates (#719) * pnpm lint fixes * Enable lint and typecheck * delete unused file * ci: update to pnpm@v10 * pnpm config, hoist eslint * Migrate `demo-anypay` v3 * Enhanced UI elements for better readability. * Update payment description in HomeIndexRoute component * Refactor payment action display in HomeIndexRoute for improved styling * Add custom call functionality as `custom_call` for intent destination call * Update button variants and improve layout in HomeIndexRoute for better user interaction * Refactor action click handling in HomeIndexRoute to reset custom call form visibility * Enhance native token balance handling in HomeIndexRoute by including native balances in the summary and updating UI elements for better clarity. * Refactor HomeIndexRoute to support both native and ERC20 token balances, enhancing balance formatting and UI representation for improved clarity and user experience. * Refactor token selection logic in HomeIndexRoute to differentiate between native and ERC20 tokens, ensuring correct state updates and improved UI feedback for user interactions. * Add chain name display in HomeIndexRoute for better context on selected network * Implement mock interaction handling in HomeIndexRoute, adding mock data for contract address, chain ID, token address, and token amount to facilitate testing and development. * Add precondition checks in LocalRelayer and update exports in wallet module * Filter out tokens on testnets in HomeIndexRoute to ensure only valid balances are displayed, enhancing accuracy of token balance representation. * Enhance LocalRelayer's relay method to support precondition checks and implement polling for transaction relaying. * Enhance wallet module by adding precondition checks in LocalRelayer, implementing balance and approval checks for ERC20, ERC721, and ERC1155 tokens. Update exports in wallet core and primitives modules for better structure and accessibility. * Update API and wallet module: Regenerate API types with enhance LocalRelayer tests with precondition checks for ERC20 balances, and improve mock implementations for provider calls. * Fix pnpm lock * Update README.md to master * Refactor HomeIndexRoute to use new intent operations API. Update state management for intent operations and preconditions, replacing previous intent quote handling. Adjust UI to display new data structure and ensure proper error handling. * Update dependencies in pnpm-lock.yaml and package.json for @0xsequence packages to latest versions. Refactor HomeIndexRoute to return all balances without filtering out testnet tokens. * Implement client-side address verification for AnyPay operations in HomeIndexRoute. Enhance error handling and logging for intent operations, ensuring proper checks for received and calculated addresses. Update state management to handle cases with no operations returned from the API. * Enhance HomeIndexRoute with commit intent functionality and address verification. Introduce state management for verification status and update UI to reflect commit intent process. Clean up README.md formatting. * Update HomeIndexRoute to enhance transaction details display. Rename "Origin Call" to "Intent Operations" and improve associated text for clarity. Add detailed transaction information section including sender, recipient, value, data, and chain ID for better user understanding. * Refactor HomeIndexRoute to improve UI responsiveness and add transaction sending functionality. Update CSS for body and root elements to allow dynamic height. Introduce transaction handling with verification status display, enhancing user feedback during transaction processes. * Add relayer integration in HomeIndexRoute and update package dependencies * Add rpc relayer * Update pnpm-lock.yaml * Add balance retrieval and call methods to PkRelayer; implement precondition check placeholder * Add mock contract addresses and mint function ABI to test constants * Enhance HomeIndexRoute with transaction receipt handling and precondition status checks. Integrate RpcRelayer for improved transaction management and update UI to reflect transaction status dynamically. * Refactor HomeIndexRoute to correct origin token address assignment and clarify precondition text for better user understanding. * Remove unused variable isOriginNative from HomeIndexRoute to streamline code and improve readability. * Refactor HomeIndexRoute to enhance the display of intent operations by iterating through multiple operations and their calls, improving UI structure and readability. * Update HomeIndexRoute to adjust spacing in the intent operations display for improved visual clarity. * Add calculateIntentAddress function to HomeIndexRoute for improved intent address calculation. Update UI to preview calculated address based on user input, enhancing user experience and error handling. * Enhance HomeIndexRoute by adding origin call parameter calculations and updating UI to reflect calculated values. Implement useCallback for performance optimization and improve error handling for parameter retrieval. * Update HomeIndexRoute to include contract verification status and filter for ERC20 contract types in token balance summary retrieval, enhancing data accuracy and filtering capabilities. * Refactor HomeIndexRoute to implement a verification banner for displaying contract verification status, enhancing user feedback on verification results. Adjust error handling to ensure generic errors are only shown when no verification status is present. * Update HomeIndexRoute to integrate lucide-react icons for improved UI consistency and replace SVG elements with corresponding icon components. Add lucide-react as a dependency in package.json and update pnpm-lock.yaml accordingly. * Refactor HomeIndexRoute to replace lucide-react icon components with inline SVGs for improved performance and maintainability. Update UI elements to ensure consistent styling and enhance user feedback with additional information on intent address and precondition status. * Enhance HomeIndexRoute UI by adding scrollable containers for data display, improving readability for long data entries. Update intent address retrieval logic to check for both ERC20 and native balance preconditions, providing clearer feedback on address availability. * Refactor HomeIndexRoute to update the display of the returned intent address, enhancing clarity by checking both ERC20 and native balance preconditions. Adjust verification banner to correctly label calculated and received addresses, improving user feedback on verification results. * Refactor HomeIndexRoute to replace inline SVGs with lucide-react icon components, enhancing UI consistency and maintainability. Update various UI elements to improve user feedback during transaction processing and intent operations. * Enhance HomeIndexRoute UI by restructuring account information display for improved clarity and user experience. Update status indicators and connection prompts with better styling and organization, ensuring consistent feedback during wallet connection processes. * Refactor HomeIndexRoute to enhance UI structure by adding separate cards for Relayer Status and Preconditions Status, improving clarity and organization. Update styling for better visual feedback and ensure consistent spacing across components. * Refactor HomeIndexRoute to improve UI layout by enhancing account and token selection sections with better organization and status indicators. Update button sizes for consistency and refine status display for relayer and token loading, ensuring clearer user feedback. * Refactor HomeIndexRoute to standardize button sizes across the UI, improving consistency in user interactions. Update button styles for better visual feedback during actions and enhance the display of payment amounts for clarity. * Refactor HomeIndexRoute to import jsx from react/jsx-runtime for improved JSX handling. Update RpcRelayer constructor to remove chainId and rpcUrl parameters, setting them directly within the constructor for better encapsulation and clarity. * Refactor HomeIndexRoute to enhance the RpcRelayer constructor by adding chainId and rpcUrl parameters for improved flexibility. Update the instantiation of RpcRelayer in HomeIndexRoute to utilize the new parameters, ensuring better configuration options for the relayer. * Refactor RpcRelayer to improve balance and approval checks by adding range validation for minimum and maximum values. Update HomeIndexRoute to ensure consistent handling of relayer status and precondition checks, enhancing overall reliability and clarity in transaction processing. * Remove workspace dependency for @0xsequence/relayer in package.json. Update Vite configuration to include necessary dependencies for wallet-related packages. Refactor HomeIndexRoute to format precondition data before checking with the relayer, ensuring consistent data handling. * Refactor HomeIndexRoute to introduce a new function for finding precondition addresses, improving clarity and reducing code duplication. Update address verification logic to utilize the new function, ensuring accurate handling of intent operations and preconditions. * Update HomeIndexRoute to change success message text color from green to white for improved visibility against the background. This enhances user feedback during intent configuration confirmation. * Enhance HomeIndexRoute by adding committed intent address state management and a new query to fetch committed intent configuration details. Update address verification logic to improve error handling and user feedback during intent configuration. Refactor UI components to display verification status and committed configuration results, ensuring clearer communication of transaction outcomes. * Refactor wagmi.config.ts to utilize chains from 'viem/chains' for improved flexibility. Update HomeIndexRoute to integrate chain switching functionality, enhancing user experience by allowing seamless transitions between networks without resetting state. Add error handling for chain switching and improve UI feedback during transactions. * Refactor HomeIndexRoute to streamline chain switching logic by removing unnecessary state resets and timeout checks. Enhance transaction handling by ensuring immediate transaction sending after successful chain switches. Improve clarity in the useEffect hooks for managing transaction status and precondition checks, ensuring better user feedback during operations. * Update HomeIndexRoute to correct the AMOUNT constant from 30,000,000 to 30,000, reflecting the accurate value of 0.03 USDC. This change ensures proper transaction handling and clarity in the displayed amounts. * Add auto-execution feature in HomeIndexRoute for seamless transaction handling after chain switches. Introduce state management for auto-execution toggle and enhance UI feedback for transaction status. Update button states and texts for improved user experience during intent configuration and transaction processes. * Add auto-execute toggle in HomeIndexRoute for improved transaction handling. Enhance UI with clear status indicators for auto-execution and streamline transaction details display. This update improves user experience by providing immediate feedback on transaction execution settings. * Enhance error handling in HomeIndexRoute by disabling auto-execute toggle when user rejects transactions. This update improves user experience by providing clearer feedback on transaction execution settings during error scenarios. * Refactor Auto-Execute Toggle in HomeIndexRoute for improved UI layout. The toggle component is now positioned within the "Choose Action" section, enhancing visual organization and user experience. This change maintains existing functionality while streamlining the interface. * Refactor HomeIndexRoute to improve clarity in chain ID handling. Replace instances of calcChainId with originChainId for better readability and maintainability in transaction processing logic. * Add operation status management in HomeIndexRoute for enhanced transaction tracking. Introduce state to track individual operation statuses (pending, success, failed) and update UI to display these statuses. Implement effects to initialize, update, and reset operation statuses based on transaction outcomes and account connection state, improving user feedback during transaction processes. * Implement meta-transaction handling in HomeIndexRoute to enhance transaction processing. Introduce state management for meta-transaction status, operation statuses, and relayer configuration based on chain IDs. Update logic to send meta-transactions through appropriate relayers and monitor their statuses, improving user feedback and transaction tracking during operations. * Enhance TypeScript configuration and Vite setup for improved module resolution and code organization. Update `tsconfig.app.json` to include path mappings for easier imports, and modify `vite.config.ts` to establish aliasing for the `@` symbol pointing to the `src` directory. Additionally, refactor `useMetaTxnMonitor` in `home-index-route.tsx` to improve transaction monitoring and state management, ensuring better handling of operation statuses and preventing duplicate transactions. * Improve error handling and validation in HomeIndexRoute for chain ID and relayer checks. Enhance logging for precondition and transaction errors, ensuring clearer feedback during transaction processing. Update operation status management to reflect pending states after successful relay initiation, improving user experience and transaction tracking. * Update HomeIndexRoute to include a TODO for calling Factory Deploy when encoding operation data. This change aims to clarify the next steps in the transaction processing logic. * Implement meta-transaction state management in HomeIndexRoute. Introduce a new state for meta-transactions and update logic to handle the retrieval and usage of meta-transaction data during intent operations. Enhance logging to provide clearer insights into transaction processing, improving user feedback and tracking. * Refactor HomeIndexRoute to utilize meta-transactions correctly. Update state management to reflect meta-transactions instead of calls, enhancing the UI to display meta-transaction details. Improve success and error handling logic to ensure accurate state updates and user feedback during transaction processing. * Refactor API type definitions and improve code consistency in api.gen.ts. Update string literals to use double quotes, enhance type annotations, and streamline function implementations for better readability and maintainability. Additionally, ensure consistent formatting across interfaces and enums. * Refactor HomeIndexRoute and API type definitions for consistency and clarity. Update chain ID references to use 'chainId' for uniformity across the codebase. Enhance logging for precondition checks and improve type annotations in api.gen.ts. Additionally, modify Vite configuration to force dependency optimization, ensuring smoother builds. * Refactor precondition handling in HomeIndexRoute to simplify the check by removing unnecessary normalization of precondition data. This change enhances code clarity and maintains the integrity of precondition checks. * Enhance precondition status checks in HomeIndexRoute by adding a useEffect to trigger status verification when intentPreconditions are updated. This improves the responsiveness of the component to changes in precondition data, ensuring accurate state management during transaction processing. * Refactor HomeIndexRoute to streamline precondition checks and enhance UI for meta-transactions. Removed redundant useEffect for precondition status verification and reorganized the display of meta-transaction details, improving clarity and user experience. * Implement meta-transaction retry logic in HomeIndexRoute by tracking timestamps of sent transactions. Introduce a retry window to prevent immediate resending of transactions, enhancing transaction management and user feedback during processing. * Refactor HomeIndexRoute to simplify intent operations handling by removing unnecessary normalization of preconditions. Update state management to directly use precondition data from the API response, enhancing code clarity and maintaining accurate transaction processing. * Refactor API type definitions in api.gen.ts to enhance consistency and readability. Update string literals to use double quotes, streamline function implementations, and improve type annotations across interfaces and enums. Additionally, ensure consistent formatting and punctuation throughout the file. * Enhance HomeIndexRoute with comprehensive meta-transaction management. Introduce state tracking for meta-transaction statuses, enabling better user feedback on transaction progress. Implement manual controls for sending meta-transactions and improve UI to display transaction statuses, including success, failure, and pending states. Refactor related logic for clarity and maintainability. * Enhance HomeIndexRoute by adding transaction ID display for both individual transactions and meta-transactions. Update UI components to improve clarity and user experience, ensuring that transaction details are presented consistently. Refactor related code for better maintainability and readability. * Refactor HomeIndexRoute to improve state management for meta-transaction statuses. Rename state variables for clarity, streamline the handling of operation statuses, and remove redundant code. Enhance the component's responsiveness to changes in transaction data, ensuring accurate tracking and user feedback during processing. * Enhance HomeIndexRoute by adding functionality to select and send specific meta-transactions. Introduce a new state for selected transaction ID and update the sendMetaTxn function to process transactions based on the selected ID. Improve the UI to allow users to choose a transaction from a list, enhancing user experience and control over transaction management. * Add Preconditions Status display to HomeIndexRoute for improved user feedback on transaction readiness. The new UI section shows the status of each precondition, indicating whether they are met or not, enhancing clarity and user experience during transaction management. * Refactor HomeIndexRoute to streamline meta-transaction sending process. Update sendMetaTxn function to handle specific transaction IDs and improve error handling for missing transactions. Enhance logging for better debugging and user feedback during transaction relaying. * Enhance useRelayers and HomeIndexRoute for improved meta-transaction handling. Add support for Base chain in useRelayers, and refactor sendMetaTxn function in HomeIndexRoute to streamline transaction sending logic. Update error handling and logging for better debugging and user feedback during transaction processing. * Refactor HomeIndexRoute to implement a mutation-based approach for sending meta-transactions. Update sendMetaTxn function to utilize useMutation for improved error handling, state management, and UI feedback during transaction processing. Enhance retry logic with exponential backoff for better reliability in transaction sending. * Refactor HomeIndexRoute to enhance transaction status management and auto-execution logic. Update the effect for monitoring transaction status to improve state handling and prevent unnecessary updates. Introduce a new effect for auto-executing transactions based on specific conditions, ensuring better user feedback and streamlined transaction processing. * Update contract addresses in HomeIndexRoute for improved transaction processing accuracy. * Add stage2 contract address in HomeIndexRoute and export AnyPay module in wallet core index for improved modularity. * Update import statements to include file extensions for consistency and clarity across wallet core and primitives modules. * Update export statement in AnyPay module to include file extension for consistency with other modules. * Refactor AnyPay test suite to improve clarity and consistency. Update import statements to include Hex type for better type safety, and streamline precondition data structure by adding chainId. Remove unnecessary mock provider setup for cleaner test code. * Enhance AnyPay test suite by adding a mock provider for improved test isolation. Update import statements to include 'vi' for mocking capabilities, ensuring better control over provider behavior during tests. * Add export for Rpc module in wallet core relayer index for enhanced modularity. * Refactor transaction monitoring in HomeIndexRoute by replacing useMetaTxnMonitor with useMetaTxnsMonitor for improved handling of multiple meta transactions. Remove deprecated monitoring logic and enhance status updates with detailed transaction information, including gas used and error handling. * Refactor HomeIndexRoute to replace meta transaction status management with origin call status handling. Remove deprecated state and effects related to meta transactions, streamlining transaction monitoring and improving clarity in status updates. Update related function names and UI bindings for consistency. * Remove deprecated optimistic UI update logic from HomeIndexRoute, simplifying the transaction success handling. Adjust related success callback to focus on relevant transaction data, enhancing clarity in state management. * Add gas estimation functionality to HomeIndexRoute, enhancing transaction handling. Integrate useEstimateGas hook for accurate gas limits, implement error handling for estimation failures, and update UI to reflect gas estimation status. * Removing the IntentOperation type and updating the calculateIntentConfigurationAddress function to accept calls and chainId directly * Add tests for calculating intent configuration address in AnyPay test suite. Implement scenarios for single and multiple operations, ensuring expected addresses match Go test results. * Refactor HomeIndexRoute and API types to replace IntentOperation with IntentCallsPayload, enhancing clarity and consistency in transaction handling. Update related functions and state management to accommodate new payload structure, ensuring compatibility with recent API changes. * Add Raw JSON Data view to HomeIndexRoute for intent calls payloads. Enhance UI with improved styling for better readability and clarity in transaction data presentation. * Add Raw JSON Data display to HomeIndexRoute for enhanced transaction visibility. Improve UI styling for better readability and organization of transaction data. * Enhance HomeIndexRoute with detailed logging for intent address calculations. Update AnyPay tests to utilize isAddressEqual for address verification and add multi-chain intent operation scenarios, ensuring deterministic address calculations align with expected results. * Update AnyPay tests to reflect changes in mainSigner address and adjust expected address verification. Enhance test scenarios for multi-chain intent operations, ensuring alignment with deterministic address calculations. * Update default stage addresses in HomeIndexRoute, AnyPay tests, and constants for consistency across the application. Ensure alignment with recent changes in address verification and intent configuration. * Update AnyPay test to reflect the new expected address for intent configuration verification, ensuring consistency with recent address changes. * Enhance logging in calculateIntentAddress function within HomeIndexRoute for improved debugging. Added console logs to display main signer and calls payload during intent address calculations. * Add hashIntentParams function to compute a deterministic hash for intent parameters. Implement validation checks for input fields and update AnyPay tests to cover new hashing functionality, ensuring accurate hash generation for single and multiple calls. * Refactor hashIntentParams function to accept arrays of origin and destination tokens, enhancing input validation and ABI encoding. Update tests to reflect new parameter structure and ensure accurate hash generation for single and multiple calls, including detailed debug logging for better traceability. * Update AnyPay tests to reflect new expected hash values and parameter adjustments for intent hashing. Modify test cases for single and multiple calls, ensuring alignment with recent changes in hash generation logic. * Refactor hashIntentParams function to improve input validation and hash generation logic. Update cumulative hash calculation for destination calls and adjust ABI schema. Modify AnyPay tests to reflect changes in expected hash values and error handling behavior. * Update AnyPay tests to reflect new expected address values for intent configuration. Add console logs for debugging address calculations in multiple test cases, ensuring alignment with recent changes in address verification logic. * Enhance hashIntentParams function to include nonce parameter for improved validation and ABI encoding. Update tests to incorporate nonce in input validation and adjust expected hash values accordingly, ensuring consistency with recent changes in hash generation logic. * Add lifiInfos state management to HomeIndexRoute and update API types. Enhance intent configuration handling by incorporating lifiInfos in relevant functions and ensure proper error handling. Update API schema to include new lifiInfos structure for improved data flow. * Add Lifi Infos section to HomeIndexRoute for displaying integration details. Include raw JSON view of lifiInfos to enhance data visibility and debugging capabilities. * Add getAnypayLifiInfoHash function to compute a hash for Anypay Lifi information. Implement validation for input parameters and update tests to cover various scenarios, including error handling for empty inputs and zero addresses. * Refactor calculateIntentConfigurationAddress to include optional lifiInfos and attestationSigner parameters. Update HomeIndexRoute and tests to accommodate changes, ensuring proper handling of undefined values and enhancing intent configuration logic. * Refactor buildMerkleTreeFromMembers function to use an iterative approach for constructing the Merkle tree. This change improves performance and readability by eliminating recursion, while maintaining the same functionality for handling topology members. * Enhance calculateIntentAddress function in HomeIndexRoute to accept lifiInfos as an argument, improving intent configuration logic. Update related calls and logging to ensure proper handling of Lifi information throughout the component. * Remove console log for LifiInfos in HomeIndexRoute to clean up output and improve performance. This change enhances the overall readability of the code without affecting functionality. * Fix formatting in HomeIndexRoute by removing unnecessary comment on coreLifiInfos parameter. This change improves code clarity without altering functionality. * Refactor AnypayLifiInfo structure to replace minAmount with amount for consistency across components. Update related functions and interfaces to ensure proper handling of Lifi information in HomeIndexRoute and intents. * Update MOCK_TOKEN_AMOUNT and add USDC transfer parameters in HomeIndexRoute for enhanced transaction handling. This change improves clarity and prepares the component for USDC interactions on the destination chain. * Refactor HomeIndexRoute to use constants for BASE_USDC_ADDRESS and BASE_USDC_DESTINATION_CHAIN_ID, improving code clarity and maintainability. Update transaction handling to ensure consistent use of these constants across different actions. * Enhance HomeIndexRoute logging by adding LifiInfos output for improved debugging. Update Anypay module to export constants, and refactor intent configuration to use ANYPAY_LIFI_SAPIENT_SIGNER_ADDRESS for better clarity and maintainability. * Refactor AnypayLifiInfo structure to replace minAmount with amount for consistency. Update related tests to reflect this change and ensure accurate address calculations in intent configurations. * Add ANYPAY_LIFI_ATTESTATION_SIGNER_ADDRESS constant and refactor calculateIntentConfigurationAddress to improve parameter handling. Update tests to reflect changes in intent configuration logic. * Update HomeIndexRoute to include ANYPAY_LIFI_ATTESTATION_SIGNER_ADDRESS in intent configuration and export constants in Anypay module for improved clarity and maintainability. * Replace ANYPAY_LIFI_SAPIENT_SIGNER_ADDRESS with ANYPAY_LIFI_SAPIENT_SIGNER_LITE_ADDRESS in intent configuration and update constants file to reflect this change. Comment out the previous signer address for clarity. * Uncomment ANYPAY_LIFI_SAPIENT_SIGNER_ADDRESS in constants file to restore its usage in the Anypay module, ensuring clarity in intent configuration. * Update ANYPAY_LIFI_SAPIENT_SIGNER_LITE_ADDRESS in constants file to reflect the new signer address, ensuring accurate configuration in the Anypay module. * Update HomeIndexRoute to replace ANYPAY_LIFI_ATTESTATION_SIGNER_ADDRESS with a placeholder address for testing purposes, enhancing clarity in intent configuration. * Update test cases in anypay.test.ts to reflect new attestation signer address and expected address calculations for single and multiple operations, ensuring accuracy in intent configuration tests. * Change demo to donate to give directly * Refactor relayer URL configuration in useRelayers hook to support development environment and V3 relayers, enhancing chain-specific endpoint handling. * Enhance relayer URL configuration in index.tsx to support V3 API usage in development environment, improving flexibility for different API endpoints. * Add V3 API configuration options to .env.sample for enhanced development support * Enhance HomeIndexRoute to include explorer links for calculated intent addresses, improving user navigation and transaction visibility. * Refactor HomeIndexRoute to enhance UI structure with SectionHeader components, improving readability and organization of account and transaction sections. * Implement auto-execution state management in HomeIndexRoute by adding hasAutoExecuted state and related logic, while removing obsolete auto-execution effects to streamline transaction handling. * Implement auto-sending of meta transactions in HomeIndexRoute when conditions are met, enhancing transaction handling and user experience. * Refactor HomeIndexRoute to simplify UI labels and enhance styling for Commit Intent section, improving overall user experience. * Update donation amount in HomeIndexRoute from 0.03 to 0.30 $USDC for improved clarity in payment options. * Update relayer and API URLs in useRelayers hook and index.tsx to support V3 endpoints, enhancing development environment flexibility and chain-specific handling. * Remove checkPrecondition method from LocalRelayer class to streamline code and improve maintainability. * Update AnyPay test to include a timeout parameter and add environment variable checks for RPC_URL and PRIVATE_KEY in constants, improving test reliability and configuration management. * Switch deps to snapshot versions * Switch deps to snapshot versions * Move indexer and api confs to env file * Add indexer gateway url override * chore: disable preconditions status section * Disable preconditions * Comment out sequenceWallet configuration in wagmi.config.ts to simplify setup and avoid potential issues. * Add actionSubtitle and subtitle props to SectionHeader component; update HomeIndexRoute to utilize new props for enhanced intent display. * Enhance HomeIndexRoute to display final destination address details based on intent actions, improving user clarity and interaction feedback. * Refactor useMetaTxnsMonitor to use metaTxn.id for polling and enhance HomeIndexRoute to display detailed meta transaction status when confirmed or failed, improving user feedback. * Enhance HomeIndexRoute to display a transaction explorer link when the transaction status is confirmed, providing users with direct access to transaction details. * Update wallet-core and wallet-primitives versions in pnpm-lock.yaml and package.json to 0.0.0-anypay-20250528092509, ensuring consistency across dependencies. * Update HomeIndexRoute text to simplify messaging about cross-chain intents, enhancing clarity for users. * Enforce public on non-published packages for now * Update ANYPAY_LIFI_SAPIENT_SIGNER_LITE_ADDRESS constant to new address for improved transaction handling. * Update wallet-core version in pnpm-lock.yaml and package.json to 0.0.0-20250528185915, ensuring alignment with the latest dependency specifications. * Update test cases in anypay.test.ts to reflect new expected addresses for single and multiple operations with LifiInfo, ensuring accuracy in address validation. * Update wallet-core version in pnpm-lock.yaml and package.json to 0.0.0-20250528195743, ensuring alignment with the latest dependency specifications. * Refactor useMetaTxnsMonitor and HomeIndexRoute to remove operationHashes state, improving clarity and error handling for missing operation hashes and unavailable relayers. * Update HomeIndexRoute to calculate and display the actual intent address for transaction explorer links, improving accuracy and user experience. * Update HomeIndexRoute to prevent status updates when waiting for receipt, enhancing transaction handling logic. * Add getExplorerTransactionUrl function and update HomeIndexRoute to use transactionHash for explorer links * Update wallet-core, wallet-primitives, and wallet-wdk versions in pnpm-lock.yaml and package.json to 0.0.0-anypay-20250529090443, ensuring consistency across dependencies. Refactor useMetaTxnsMonitor to enhance transaction status handling and improve HomeIndexRoute for better display of transaction details. * Enhance HomeIndexRoute transaction status handling by preventing reprocessing of final statuses and improving receipt error messaging. Remove unused preconditions status section for cleaner UI. * Add transaction explorer link to HomeIndexRoute for improved user access to transaction details * Reduce POLL_INTERVAL in useMetaTxnsMonitor from 10 seconds to 3 seconds for more responsive transaction monitoring. * Refactor useMetaTxnsMonitor to utilize react-query for improved transaction status polling and error handling, enhancing responsiveness and clarity in monitoring meta transactions. * Enhance HomeIndexRoute with block timestamp fetching for origin and meta transactions, improving transaction monitoring and user feedback. Refactor state management for clarity and error handling, ensuring accurate display of timestamps and error messages. * Add time since origin calculation to HomeIndexRoute for enhanced transaction feedback * Comment out error display for transaction timestamps in HomeIndexRoute to streamline UI and prevent unnecessary error messages during monitoring. * Add backup relayers * Setup new TypeScript project for AnyPay SDK * Enhance useMetaTxnsMonitor with detailed logging and improved error handling for transaction status. Added checks for receipt availability and status validity, along with retry logic for API failures, ensuring robust monitoring of meta transactions. * Migrate demo anypay specific hooks to the anypay sdk for reusability * Set up anypay sdk tests * Update anypay sdk single transfer e2e test * Update anypay sdk test * Split up anypay sdk hooks * Add anypay sdk eslint config * anypay sdk and demo build fixes * Migrate AnyPay files from wallet-core to anypay sdk * Add widget demo route to anypay demo * Scaffold anypay widget demo * AnyPay widget connect MetaMask wallet * AnyPay widget render token list * AnyPay widget add back button * AnyPay widget update modal style * AnyPay widget create intent with sdk * AnyPay widget send form fixes * AnyPay widget demo send confirmation * AnyPay sdk update README * anypay-sdk: Update tsconfig.json * anypay-sdk: Update eslint config * anypay-sdk: Update tests to use vitest * anypay-sdk: build fixes * anypay-sdk: setup widget export * Add Anypay SDK with initial setup, including TypeScript configuration, API client, and meta transaction handling. Introduce widget components and enhance routing structure for better modularity. * Refactor Anypay SDK code for improved readability and maintainability by adjusting formatting and adding a new meta transaction monitor component. * Refactor API client and related files for improved code readability and consistency by adjusting formatting and line breaks. * Add AccountInfoSection component for improved account management UI * anypay-sdk: migrate react from demo to sdk and dual build * anypay-demo: display widget integration code snippet * anypay-sdk: update dep version * anypay-sdk: vite dep build fix * anypay-sdk: widget token images * Add types and utility functions for balance formatting and chain info retrieval * Refactor meta transaction monitoring to use react-query for improved status handling and reduce polling interval * Update package.json and pnpm-lock.yaml to use workspace references for dependencies * anypay-sdk: dry mode option to debug * Add origin block timestamp handling and formatting utility for improved transaction monitoring * Remove unnecessary console logs from RelayerStatusSection and AnyPay functions for cleaner code * Regenerate pnpm lock file due to merge conflicts * Revert minor changes * Update @0xsequence/tee-verifier to version 0.1.1 and bump @noble/hashes to 1.7.2 * Remove unnecessary test input for extras/**/*.tsx in turbo.json * Add React import and update dependencies in package.json; implement checkPrecondition method in SequenceRelayer --------- Co-authored-by: Peter Kieltyka <[email protected]> Co-authored-by: Michael Standen <[email protected]> Co-authored-by: Michael Standen <[email protected]> Co-authored-by: Agusx1211 <[email protected]> Co-authored-by: Taylan Pince <[email protected]> Co-authored-by: Miguel Mota <[email protected]>
1 parent 2a78cc2 commit 8822d56

File tree

103 files changed

+23988
-2382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+23988
-2382
lines changed

extras/demo-anypay/.env.sample

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Sequence Project Access Key (Required)
2+
VITE_ENV=
3+
VITE_USE_V3_API=true
4+
VITE_USE_V3_RELAYERS=true
5+
VITE_PROJECT_ACCESS_KEY=
6+
VITE_API_URL=https://api.sequence.app
7+
VITE_INDEXER_URL=https://indexer.sequence.app

extras/demo-anypay/.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# env files (can opt-in for commiting if needed)
29+
.env*
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
37+
38+
# env files
39+
.env
40+
.env.local
41+
.env.development
42+
.env.production
43+
.env.test
44+
!.env.sample

extras/demo-anypay/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cors-anywhere:
2+
docker run -d -p 8080:8080 --dns 8.8.4.4 --name cors-anywhere testcab/cors-anywhere
3+
4+
cors-anywhere-stop:
5+
docker stop cors-anywhere
6+
7+
cors-anywhere-start:
8+
docker start cors-anywhere

extras/demo-anypay/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Anypay Demo App
2+
3+
A simple application demonstrating Sequence Anypay intent configuration.
4+
5+
## Setup
6+
7+
1. Clone the `sequence-core` repo if you haven't already.
8+
2. Install dependencies and build the core packages:
9+
```bash
10+
pnpm install
11+
pnpm build
12+
```
13+
3. Copy `.env.sample` to `.env` and add your Sequence Project Access Key:
14+
```bash
15+
cp apps/demo-anypay/.env.sample apps/demo-anypay/.env
16+
```
17+
4. Run the development server:
18+
```bash
19+
pnpm --filter demo-anypay dev
20+
```
21+
22+
## Usage
23+
24+
1. Open the app in your browser.
25+
2. Connect your wallet (e.g., Metamask).
26+
3. Select a token from your balance list.
27+
4. Click "Pay" or "Mock Contract Interaction".
28+
5. Observe the generated intent configuration details.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { nextJsConfig } from '@repo/eslint-config/next-js'
2+
3+
/** @type {import("eslint").Linter.Config} */
4+
export default nextJsConfig

extras/demo-anypay/index.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
6+
<title>Sequence Anypay Demo</title>
7+
8+
<meta
9+
name="description"
10+
content="Seamless and secure wallet for web3, NFTs, and crypto. Explore, play, own, and trade with Sequence, web3's most user-friendly wallet"
11+
/>
12+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
13+
14+
<link rel="icon" href="/favicon.ico" sizes="any" />
15+
<link rel="icon" href="/icon.svg" type="image/svg+xml" />
16+
<link rel="preconnect" href="https://fonts.googleapis.com" />
17+
<link
18+
rel="preconnect"
19+
href="https://fonts.gstatic.com"
20+
crossorigin="anonymous"
21+
/>
22+
<link
23+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
24+
rel="stylesheet"
25+
/>
26+
</head>
27+
<body>
28+
<div id="root"></div>
29+
<script type="module" src="/src/index.tsx"></script>
30+
</body>
31+
</html>

extras/demo-anypay/package.json

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"name": "demo-anypay",
3+
"version": "0.1.0",
4+
"type": "module",
5+
"private": true,
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc -b && vite build",
9+
"lint": "eslint .",
10+
"lint:fix": "eslint --fix .",
11+
"prettier": "prettier --list-different './src/**/*.{ts,tsx}'",
12+
"prettier:fix": "prettier --list-different --write './src/**/*.{ts,tsx}'",
13+
"format": "pnpm run lint:fix && pnpm run prettier:fix",
14+
"preview": "vite preview",
15+
"prepare": "husky",
16+
"test": "echo tests are not implemented.",
17+
"typecheck": "tsc --noEmit",
18+
"reinstall": "rimraf -g ./node_modules && pnpm install"
19+
},
20+
"dependencies": {
21+
"@0xsequence/api": "workspace:*",
22+
"@0xsequence/design-system": "^2.1.6",
23+
"@0xsequence/hooks": "^5.1.0",
24+
"@0xsequence/indexer": "^2.3.9",
25+
"@0xsequence/network": "^2.3.9",
26+
"@0xsequence/wagmi-connector": "^4.0.1",
27+
"@0xsequence/wallet-core": "workspace:*",
28+
"@0xsequence/wallet-primitives": "workspace:*",
29+
"@0xsequence/wallet-wdk": "workspace:*",
30+
"@anypay/sdk": "workspace:*",
31+
"@radix-ui/react-popover": "^1.1.6",
32+
"@repo/eslint-config": "workspace:*",
33+
"@repo/typescript-config": "workspace:*",
34+
"@tanstack/react-query": "^5.69.0",
35+
"@types/react-syntax-highlighter": "^15.5.13",
36+
"class-variance-authority": "^0.7.1",
37+
"clsx": "^2.1.1",
38+
"copy-to-clipboard": "^3.3.3",
39+
"jotai": "^2.12.2",
40+
"lucide-react": "^0.493.0",
41+
"motion": "^12.6.2",
42+
"ox": "^0.6.10",
43+
"qrcode.react": "^4.2.0",
44+
"react": "^19.0.0",
45+
"react-dom": "^19.0.0",
46+
"react-router": "^7.4.0",
47+
"react-syntax-highlighter": "^15.6.1",
48+
"tailwindcss": "^4.0.15",
49+
"viem": "^2.24.1",
50+
"wagmi": "^2.14.16"
51+
},
52+
"devDependencies": {
53+
"@eslint/js": "^9.21.0",
54+
"@tailwindcss/vite": "^4.0.15",
55+
"@types/react": "^19.0.10",
56+
"@types/react-dom": "^19.0.4",
57+
"@vitejs/plugin-react": "^4.3.4",
58+
"eslint": "^9.21.0",
59+
"eslint-plugin-react-hooks": "^5.1.0",
60+
"eslint-plugin-react-refresh": "^0.4.19",
61+
"globals": "^15.15.0",
62+
"husky": "^9.1.7",
63+
"prettier": "^3.5.3",
64+
"rimraf": "^6.0.1",
65+
"typescript": "~5.7.2",
66+
"typescript-eslint": "^8.24.1",
67+
"vite": "^6.2.0",
68+
"zod": "^3.24.2"
69+
}
70+
}
1.04 KB
Binary file not shown.

extras/demo-anypay/public/icon.svg

Lines changed: 65 additions & 0 deletions
Loading
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import { Connector, useConnect } from 'wagmi'
2+
import type { UseAccountReturnType } from 'wagmi'
3+
import { Button, Text, NetworkImage } from '@0xsequence/design-system'
4+
import { AlertTriangle } from 'lucide-react'
5+
import { SectionHeader } from '@/components/SectionHeader'
6+
import { Address } from 'viem'
7+
8+
interface AccountInfoSectionProps {
9+
account: {
10+
address?: Address
11+
chainId?: number
12+
status: UseAccountReturnType['status']
13+
}
14+
connectors: readonly Connector[]
15+
connect: (args: { connector: Connector; chainId?: number }) => void
16+
disconnect: () => void
17+
connectStatus: ReturnType<typeof useConnect>['status']
18+
connectError?: Error | null
19+
}
20+
21+
export const AccountInfoSection = ({
22+
account,
23+
connectors,
24+
connect,
25+
disconnect,
26+
connectStatus,
27+
connectError,
28+
}: AccountInfoSectionProps) => {
29+
return (
30+
<SectionHeader
31+
className="bg-gray-800/80 rounded-xl shadow-lg border border-gray-700/50 backdrop-blur-sm transition-all duration-300 hover:shadow-blue-900/20 mb-6"
32+
titleContainerClassName="p-6 flex items-center justify-between w-full"
33+
contentContainerClassName="p-6 pt-0"
34+
title={
35+
<div className="flex items-center">
36+
<div className="bg-blue-600 text-white rounded-full w-7 h-7 flex items-center justify-center mr-2 shadow-lg">
37+
<span>1</span>
38+
</div>
39+
<h3 className="text-xl font-semibold text-white">Account</h3>
40+
</div>
41+
}
42+
statusPill={
43+
<div className="px-3 py-1 rounded-full bg-gray-700/50 text-gray-300 text-sm flex items-center">
44+
<span
45+
className={`w-2 h-2 rounded-full ${account.status === 'connected' ? 'bg-green-400' : 'bg-yellow-400'} mr-2 animate-pulse`}
46+
></span>
47+
{account.status === 'connected' ? 'Connected' : 'Disconnected'}
48+
</div>
49+
}
50+
>
51+
{account.status === 'connected' ? (
52+
<div className="bg-gray-900/50 p-4 rounded-lg border border-gray-700/30 space-y-2 mt-4">
53+
<div className="flex items-center justify-between">
54+
<Text variant="small" color="secondary" className="flex items-center">
55+
<span className="text-blue-300 font-semibold mr-2">Address:</span>
56+
<span className="font-mono bg-gray-800/70 px-3 py-1 rounded-full">{account.address}</span>
57+
</Text>
58+
<Button variant="danger" size="sm" onClick={() => disconnect()} className="px-5 py-2">
59+
Disconnect
60+
</Button>
61+
</div>
62+
<div className="flex items-center space-x-4">
63+
<Text variant="small" color="secondary" className="flex items-center">
64+
<span className="text-blue-300 font-semibold mr-2">Chain:</span>
65+
<div className="flex items-center">
66+
<NetworkImage chainId={Number(account.chainId)} size="sm" className="w-4 h-4 mr-1" />
67+
<span className="font-mono bg-gray-800/70 px-3 py-1 rounded-full">{account.chainId}</span>
68+
</div>
69+
</Text>
70+
<Text variant="small" color="secondary" className="flex items-center">
71+
<span className="text-blue-300 font-semibold mr-2">Status:</span>
72+
<span className="text-green-400 font-mono bg-green-900/20 px-3 py-1 rounded-full border border-green-700/30">
73+
{account.status}
74+
</span>
75+
</Text>
76+
</div>
77+
</div>
78+
) : (
79+
<div className="bg-gray-900/50 p-4 rounded-lg border border-gray-700/30">
80+
<Text variant="small" color="secondary" className="mb-3">
81+
Select a wallet to connect:
82+
</Text>
83+
<div className="flex flex-wrap gap-2 mb-4">
84+
{connectors.map((connector: Connector) => (
85+
<Button
86+
key={connector.uid}
87+
variant="primary"
88+
size="sm"
89+
onClick={() => connect({ connector })}
90+
className="px-5 py-2 transition-all duration-300 transform hover:scale-105 hover:shadow-lg shadow-md"
91+
>
92+
{connector.name}
93+
</Button>
94+
))}
95+
</div>
96+
<div className="mt-3 bg-gray-800/70 p-2 rounded-lg flex items-center justify-between">
97+
<Text variant="small" color="secondary" className="flex items-center">
98+
<span className="text-blue-300 font-semibold mr-2">Status:</span>
99+
<span className="text-yellow-400 font-mono">
100+
{account.status}
101+
{connectStatus === 'pending' && <span className="ml-1">(Connecting...)</span>}
102+
</span>
103+
</Text>
104+
{connectError && (
105+
<Text variant="small" color="error" className="flex items-center">
106+
<AlertTriangle className="h-4 w-4 mr-1" />
107+
{connectError.message}
108+
</Text>
109+
)}
110+
</div>
111+
</div>
112+
)}
113+
</SectionHeader>
114+
)
115+
}

0 commit comments

Comments
 (0)