Scaffolding for a dApp built on Solana using Blazor WebAssembly and Solnet + solana-web3.js interoperability
git clone https://github.com/bmresearch/blazor-wasm-dapp-scaffold.git
cd blazor-wasm-dapp-scaffold- Install net5
- Install npm
Before being able to run the project you will need to go inside the src/Client/JsLib folder and do the following:
npm install
npm run buildThis project currently features a bare bones skeleton to easily bootstrap dApps for Solana built using Blazor Wasm.
The list of adapters that were targeted with this:
It is currently able to (with much hacking around and probably a lot of errors/exceptions being thrown):
- request a connection from the wallet adapter
- fetch the address of the wallet selected in the wallet adapter
- request the wallet adapter to sign a transaction
What should be done:
- writing a class in the
src/Client/JsLibwhich abstracts the Wallet Adapters instead of using them directly and which allows us to plug in an event from C# which has a property with theJSInvokableattribute so it can be directly invoked from the JS - in the class mentioned previously some QoL abstractions should be made in order to make it easier to do the JS Interop calls,
out of the adapters mentioned previously only the Phantom one has
signMessage(message: Uint8Array), and the others havesignTransaction(transaction: Transaction)which is the solana-web3.jsTransactionobject, some compromise should be done in order to make this easier:- only do one
InvokeAsync<byte[]>("signMessage")where you pass the compiled message from the SolnetTransactionBuilderand it could check if the adapter hassignMessageor if it needs to deserialize the compiled message into a transaction object before callingsignTransaction
- only do one