Skip to content

Commit

Permalink
Feature: add method to set wallet mode in WASM (#1666)
Browse files Browse the repository at this point in the history
* feature: added opportunity to set wallet mode in a separate function

* fix: fixed bugs

* fix: fixed bugs
  • Loading branch information
YarikRevich authored Nov 7, 2024
1 parent cbbeeb8 commit 5217a55
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/client/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ func SetWallet(w zcncrypto.Wallet) {
client.wallets[w.ClientID] = &w
}

// SetWalletMode sets current wallet split key mode.
func SetWalletMode(mode bool) {
client.wallet.IsSplit = mode
}

// splitKeyWallet parameter is valid only if SignatureScheme is "BLS0Chain"
func SetSplitKeyWallet(isSplitKeyWallet bool) error {
if client.signatureScheme == constants.BLS0CHAIN.String() {
Expand Down
1 change: 1 addition & 0 deletions wasmsdk/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func main() {
//sdk
"init": initSDKs,
"setWallet": setWallet,
"setWalletMode": setWalletMode,
"getPublicEncryptionKey": zcncore.GetPublicEncryptionKey,
"hideLogs": hideLogs,
"showLogs": showLogs,
Expand Down
6 changes: 6 additions & 0 deletions wasmsdk/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ func setWallet(clientID, clientKey, peerPublicKey, publicKey, privateKey, mnemon

return nil
}

func setWalletMode(mode bool) {
client.SetWalletMode(mode)

fmt.Println("gosdk setWalletMode: ", "is split:", mode)
}

0 comments on commit 5217a55

Please sign in to comment.