Skip to content

Fix WalletConnect solana_signAllTransactions support#1827

Open
0xh3rman wants to merge 1 commit intomainfrom
feature/wc-sign-all-transactions
Open

Fix WalletConnect solana_signAllTransactions support#1827
0xh3rman wants to merge 1 commit intomainfrom
feature/wc-sign-all-transactions

Conversation

@0xh3rman
Copy link
Contributor

Fixes #1825

Update core submodule and handle new SignAllTransactions action in iOS.

Update core submodule and handle new SignAllTransactions action in iOS.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a reported issue with WalletConnect's solana_signAllTransactions functionality by integrating the necessary handling for multi-transaction signing within the application's WalletConnect service. It also updates a core dependency to ensure compatibility and leverage the latest features, enhancing the overall stability and capability of Solana transaction processing via WalletConnect.

Highlights

  • WalletConnect Solana Multi-Transaction Signing: Added support for the solana_signAllTransactions action within the WalletConnectorService, allowing the application to handle requests to sign multiple Solana transactions simultaneously.
  • Core Submodule Update: The core submodule has been updated to a newer commit (0d02ab1a24cacb67dfef05abfbf17430180ec98b), incorporating the latest changes from the dependency.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new signAllTransactions case within the WalletConnectorService to handle the signing of multiple transactions, and updates a core subproject dependency. A review comment suggests improving the performance of the signAllTransactions method by processing transactions concurrently using TaskGroup instead of sequentially.

Comment on lines +232 to +238
var signedTransactions: [String] = []
for data in transactions {
let simulation = try await simulateSendTransaction(chain: chain, transactionType: type, data: data)
let transaction = try walletConnect.decodeSendTransaction(transactionType: type, data: data)
let signed = try await signer.signTransaction(sessionId: sessionId, chain: chain.map(), transaction: transaction.map(), simulation: simulation)
signedTransactions.append(signed)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current implementation processes transactions sequentially within a for loop. Since each transaction's signing process is an independent asynchronous operation, they can be executed concurrently to improve performance.

Using a TaskGroup will allow these operations to run in parallel, which can significantly reduce the total execution time when signing multiple transactions. The suggested change preserves the order of the signed transactions.

Suggested change
var signedTransactions: [String] = []
for data in transactions {
let simulation = try await simulateSendTransaction(chain: chain, transactionType: type, data: data)
let transaction = try walletConnect.decodeSendTransaction(transactionType: type, data: data)
let signed = try await signer.signTransaction(sessionId: sessionId, chain: chain.map(), transaction: transaction.map(), simulation: simulation)
signedTransactions.append(signed)
}
let signedTransactions = try await withThrowingTaskGroup(of: (Int, String).self) { group -> [String] in
for (index, data) in transactions.enumerated() {
group.addTask {
let simulation = try await self.simulateSendTransaction(chain: chain, transactionType: type, data: data)
let transaction = try self.walletConnect.decodeSendTransaction(transactionType: type, data: data)
let signed = try await self.signer.signTransaction(sessionId: sessionId, chain: chain.map(), transaction: transaction.map(), simulation: simulation)
return (index, signed)
}
}
var indexedResults: [(Int, String)] = []
indexedResults.reserveCapacity(transactions.count)
for try await result in group {
indexedResults.append(result)
}
return indexedResults.sorted { $0.0 < $1.0 }.map { $0.1 }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Magic Eden WalletConnect sign error

2 participants