Skip to content

Commit 5217a55

Browse files
authored
Feature: add method to set wallet mode in WASM (#1666)
* feature: added opportunity to set wallet mode in a separate function * fix: fixed bugs * fix: fixed bugs
1 parent cbbeeb8 commit 5217a55

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

core/client/set.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ func SetWallet(w zcncrypto.Wallet) {
156156
client.wallets[w.ClientID] = &w
157157
}
158158

159+
// SetWalletMode sets current wallet split key mode.
160+
func SetWalletMode(mode bool) {
161+
client.wallet.IsSplit = mode
162+
}
163+
159164
// splitKeyWallet parameter is valid only if SignatureScheme is "BLS0Chain"
160165
func SetSplitKeyWallet(isSplitKeyWallet bool) error {
161166
if client.signatureScheme == constants.BLS0CHAIN.String() {

wasmsdk/proxy.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ func main() {
205205
//sdk
206206
"init": initSDKs,
207207
"setWallet": setWallet,
208+
"setWalletMode": setWalletMode,
208209
"getPublicEncryptionKey": zcncore.GetPublicEncryptionKey,
209210
"hideLogs": hideLogs,
210211
"showLogs": showLogs,

wasmsdk/wallet.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,9 @@ func setWallet(clientID, clientKey, peerPublicKey, publicKey, privateKey, mnemon
5757

5858
return nil
5959
}
60+
61+
func setWalletMode(mode bool) {
62+
client.SetWalletMode(mode)
63+
64+
fmt.Println("gosdk setWalletMode: ", "is split:", mode)
65+
}

0 commit comments

Comments
 (0)