Züs
Search
K

GoSDK for webapps

GoSDK functions can be exported to WebAssembly which allows you to compile code from languages such as C/C++/Rust to and run them in the browser as web apps.

Exporting a gosdk function to WebAssembly

  1. 1.
    Build your own go method.
  2. 2.
    Expose it via jsbridge.BindAsyncFuncs. All of methods are exposed on wasm. You can check them as examples . Here is the list for convenience.\
"init": Init,
"setWallet": SetWallet,
"setZBoxHost": setZBoxHost,
"getEncryptedPublicKey": GetEncryptedPublicKey,
"hideLogs": hideLogs,
"showLogs": showLogs,
//blobber
"delete": Delete,
"rename": Rename,
"copy": Copy,
"move": Move,
"share": Share,
"download": Download,
"upload": Upload,
"listObjects": listObjects,
"createDir": createDir,
// zcn txn
"commitFileMetaTxn": CommitFileMetaTxn,
"commitFolderMetaTxn": CommitFolderMetaTxn,
// player
"play": Play,
"stop": Stop,
"getNextSegment": GetNextSegment,
// wallet
"createWallet": createWallet,
//allocation
"createAllocation": createAllocation,
"getAllocationBlobbers": getAllocationBlobbers,
"listAllocations": listAllocations,
//smartcontract
"executeSmartContract": executeSmartContract,
//swap
"setSwapWallets": setSwapWallets,
"swapToken": swapToken,