fix: protocolID must be a string in the mobile API (#466)

This commit is contained in:
RichΛrd 2023-02-20 17:50:36 -04:00 committed by GitHub
parent 54005c8733
commit a1edf45fad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -9,7 +9,6 @@ import "C"
import (
"unsafe"
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
mobile "github.com/waku-org/go-waku/mobile"
"github.com/waku-org/go-waku/waku/v2/protocol"
)
@ -90,7 +89,7 @@ func waku_listen_addresses() *C.char {
//
//export waku_add_peer
func waku_add_peer(address *C.char, protocolID *C.char) *C.char {
response := mobile.AddPeer(C.GoString(address), libp2pProtocol.ID(C.GoString(protocolID)))
response := mobile.AddPeer(C.GoString(address), C.GoString(protocolID))
return C.CString(response)
}

View File

@ -321,7 +321,7 @@ func ListenAddresses() string {
return PrepareJSONResponse(addresses, nil)
}
func AddPeer(address string, protocolID libp2pProtocol.ID) string {
func AddPeer(address string, protocolID string) string {
if wakuState.node == nil {
return MakeJSONResponse(errWakuNodeNotReady)
}
@ -331,7 +331,7 @@ func AddPeer(address string, protocolID libp2pProtocol.ID) string {
return MakeJSONResponse(err)
}
peerID, err := wakuState.node.AddPeer(ma, protocolID)
peerID, err := wakuState.node.AddPeer(ma, libp2pProtocol.ID(protocolID))
return PrepareJSONResponse(peerID, err)
}