coral-xyz / backpack

🎒 Next level crypto wallet
https://backpack.app
GNU General Public License v3.0
1.4k stars 828 forks source link

Support signing transaction without web3.js #1638

Open GabrielePicco opened 1 year ago

GabrielePicco commented 1 year ago

Problem description

The current SignTransaction (Solana implementation) only accepts a @solana/web3.js Transaction object. In the Solana.Unity-SDK we would like to sign transactions that are byte[] or base58 encoded string, so that we can avoid importing Web3.js in games compiled to WebGL with the SDK. Would it be possible to add these methods in backpack? Thanks for building such an amazing product.

armaniferrante commented 1 year ago

Has this been resolved with a workaround @GabrielePicco, since I see you have a successful xNFT running with unity?

GabrielePicco commented 1 year ago

@armaniferrante yes it currently works with a workaround, we inject web3js in a custom WebGL template and serialise/deserialise the transaction. If you happen to implement bytes signature in the future, we can streamline the integration.

armaniferrante commented 1 year ago

Does the new solana wallet standard support this now? https://github.com/coral-xyz/backpack/blob/master/packages/wallet-standard/src/wallet.ts#L234

GabrielePicco commented 1 year ago

AFAIK the Solana Wallet Adapter does not support signing byte[] transactions, while Mobile Wallet Adapter does support it. Solana.Unity-SDK already uses MWA on mobile, and we are changing the WebGL implementation to use Wallet Adapter, likely we have to inject web3js anyways and signing byte[] is not necessary anymore.