Skip to content

Transaction Builder made in Wasm to use on edge/browser/cli

License

Notifications You must be signed in to change notification settings

gist-rs/tx-builder-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

tx-builder-wasm

Transaction Builder made in Wasm to use on edge/browser/cli

Problem 🤔

Solana Pay transfer spec can be use only on mobile, and to accomplish the same thing on web wallet (Phantom) we will need a lot of web3.js dependency and builder/helper code for create simple transfer transaction.

dApp will need web3.js and tx_builder code to make a transfer transaction.

graph LR
    A(dApp + tx_builder + web3.js) -- transfer tx --> Y(Web Wallet)
Loading

Proposed Solution 🙌

Use web3.wasm = web3 + tx-builder on the edge and/or browser.

Usage Options

  1. Keep compatible (Fully trust browser): dApp can still use web3.wasm as usual; plus able to build transfer transaction.
graph LR
    A(dApp) -- transfer prompt --> B1(browser + web3.wasm) -- transfer tx --> Y(Web Wallet)
Loading
  1. Lean dependency (Fully trust edge): dApp can use web3.wasm on the edge and build transfer with prompt as transfer spec.
graph LR
    A(dApp) -- transfer prompt --> B(edge + web3.wasm) -- transfer tx --> Y(Web Wallet)
Loading
  1. Cross check: dApp use built tx from edge as a cross check (required same tx_bytes_hash).
graph LR
    A(dApp) -- transfer prompt --> B1(browser + web3.wasm) -- transfer tx1 --> C{Cross check}
    A(dApp) -- transfer prompt --> B2(edge + web3.wasm) -- transfer tx2 --> C{tx1 == tx2} -- true\ntransfer tx --> Y(Web Wallet)
Loading

Use cases

  • dApp can make a 1 liner code payment Button for some specified token amount from user without any web3.js lib required on both mobile app with solana pay's deeplink (existing solution) and on web with browser/edge (our solution).
  • dApp can ensure that built transaction is not compromise by doing cross check between browser and on-edge.

Other ideas

  • Can be use with Continue with Web3 button (sign to login).
  • Can be use with NFT paywall link (verify and redirect).

Supported By

About

Transaction Builder made in Wasm to use on edge/browser/cli

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published