pkg/client-sdk: expose IsLocked (#247)

* expose IsLocked

* add test for IsLocked
This commit is contained in:
Marco Argentieri
2024-08-14 14:07:15 +02:00
committed by GitHub
parent e79819cca8
commit 2e6fa7fe6d
5 changed files with 21 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ func init() {
js.Global().Set("init", InitWrapper())
js.Global().Set("unlock", UnlockWrapper())
js.Global().Set("lock", LockWrapper())
js.Global().Set("locked", IsLockedWrapper())
js.Global().Set("balance", BalanceWrapper())
js.Global().Set("onboard", OnboardWrapper())
js.Global().Set("receive", ReceiveWrapper())

View File

@@ -76,6 +76,12 @@ func InitWrapper() js.Func {
})
}
func IsLockedWrapper() js.Func {
return js.FuncOf(func(this js.Value, p []js.Value) interface{} {
return js.ValueOf(arkSdkClient.IsLocked(context.Background()))
})
}
func UnlockWrapper() js.Func {
return JSPromise(func(args []js.Value) (interface{}, error) {
if len(args) != 1 {