diff --git a/go.mod b/go.mod index bf5e93f4b9f30317d6fa1ddc977da985037ce550..5a77e7adcad83d24ffe215fd8bf2562a6285e5c1 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/hack-pad/go-indexeddb v0.2.0 github.com/pkg/errors v0.9.1 github.com/spf13/jwalterweatherman v1.1.0 - gitlab.com/elixxir/client v1.5.1-0.20221017222923-185226c4412d + gitlab.com/elixxir/client v1.5.1-0.20221018172737-bd006184ff48 gitlab.com/elixxir/crypto v0.0.7-0.20221017204335-9201b3672f3a gitlab.com/elixxir/primitives v0.0.3-0.20221017172918-6176818d1aba gitlab.com/xx_network/crypto v0.0.5-0.20221017172404-b384a8d8b171 diff --git a/go.sum b/go.sum index 1c0830cdde24e9409dbb352283809e6e0308982f..b33f2d6866e6114f3b9f5c731f062671c3a93916 100644 --- a/go.sum +++ b/go.sum @@ -616,8 +616,8 @@ github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo= github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= gitlab.com/elixxir/bloomfilter v0.0.0-20211222005329-7d931ceead6f h1:yXGvNBqzZwAhDYlSnxPRbgor6JWoOt1Z7s3z1O9JR40= gitlab.com/elixxir/bloomfilter v0.0.0-20211222005329-7d931ceead6f/go.mod h1:H6jztdm0k+wEV2QGK/KYA+MY9nj9Zzatux/qIvDDv3k= -gitlab.com/elixxir/client v1.5.1-0.20221017222923-185226c4412d h1:c6hhamrVh5xAG4n/mc4LuPXkPuREd1Ql181wL16i+bI= -gitlab.com/elixxir/client v1.5.1-0.20221017222923-185226c4412d/go.mod h1:/j/GbuxAVfR5cqLqYAq5s8IgafpyHVO63efwh/Xob4w= +gitlab.com/elixxir/client v1.5.1-0.20221018172737-bd006184ff48 h1:m6upCBR5S2FmGbBZsGZkgYd/FBsd3l7DXOu/7IbVFZI= +gitlab.com/elixxir/client v1.5.1-0.20221018172737-bd006184ff48/go.mod h1:/j/GbuxAVfR5cqLqYAq5s8IgafpyHVO63efwh/Xob4w= gitlab.com/elixxir/comms v0.0.4-0.20221017173926-4eaa6061dfaa h1:/FEpu0N0rAyq74FkvO3uY8BcQoWLSbVPhj/s5QfscZw= gitlab.com/elixxir/comms v0.0.4-0.20221017173926-4eaa6061dfaa/go.mod h1:rW7xdbHntP2MoF3q+2+f+IR8OHol94MRyviotfR5rXg= gitlab.com/elixxir/crypto v0.0.0-20200804182833-984246dea2c4/go.mod h1:ucm9SFKJo+K0N2GwRRpaNr+tKXMIOVWzmyUD0SbOu2c= diff --git a/wasm/cmix.go b/wasm/cmix.go index 4779e557c2d977ded765acd628046bca11f5c3a9..cf18ee064a83604569e6e757a71a888f6161f557 100644 --- a/wasm/cmix.go +++ b/wasm/cmix.go @@ -41,6 +41,7 @@ func newCmixJS(api *bindings.Cmix) map[string]interface{} { "StartNetworkFollower": js.FuncOf(c.StartNetworkFollower), "StopNetworkFollower": js.FuncOf(c.StopNetworkFollower), "WaitForNetwork": js.FuncOf(c.WaitForNetwork), + "ReadyToSend": js.FuncOf(c.ReadyToSend), "NetworkFollowerStatus": js.FuncOf(c.NetworkFollowerStatus), "GetNodeRegistrationStatus": js.FuncOf(c.GetNodeRegistrationStatus), "HasRunningProcessies": js.FuncOf(c.HasRunningProcessies), diff --git a/wasm/follow.go b/wasm/follow.go index 627250636d990de545a9ed0b2b98e1afad752116..4b343314206a28f5139b9d464fd4e965c11ea8a0 100644 --- a/wasm/follow.go +++ b/wasm/follow.go @@ -103,6 +103,16 @@ func (c *Cmix) WaitForNetwork(_ js.Value, args []js.Value) interface{} { return utils.CreatePromise(promiseFn) } +// ReadyToSend determines if the network is ready to send messages on. It +// returns true if the network is healthy and if the client has registered with +// at least 70% of the nodes. Returns false otherwise. +// +// Returns: +// - Returns true if network is ready to send on (boolean). +func (c *Cmix) ReadyToSend(js.Value, []js.Value) interface{} { + return c.api.ReadyToSend() +} + // NetworkFollowerStatus gets the state of the network follower. It returns a // status with the following values: // Stopped - 0