diff --git a/bindings/go/csdk/csdk_wrapper.go b/bindings/go/csdk/csdk_wrapper.go index 3c6488430..6c88d17d6 100644 --- a/bindings/go/csdk/csdk_wrapper.go +++ b/bindings/go/csdk/csdk_wrapper.go @@ -438,6 +438,21 @@ func (csdk *CSDK) GetSystemConfigByKey(chanData *CallbackChan, key string) { C.bcos_rpc_get_system_config_by_key(csdk.sdk, csdk.groupID, nil, cKey, C.bcos_sdk_c_struct_response_cb(C.on_recv_resp_callback), setContext(chanData)) } +// SendRPCRequest to specific group or node, group and node can be empty +func (csdk *CSDK) SendRPCRequest(group, node, request string, chanData *CallbackChan) error { + cGroup := C.CString(group) + defer C.free(unsafe.Pointer(cGroup)) + cNode := C.CString(node) + defer C.free(unsafe.Pointer(cNode)) + cRequest := C.CString(request) + defer C.free(unsafe.Pointer(cRequest)) + C.bcos_rpc_generic_method_call_to_group_node(csdk.sdk, cGroup, cNode, cRequest, C.bcos_sdk_c_struct_response_cb(C.on_recv_resp_callback), setContext(chanData)) + if C.bcos_sdk_is_last_opr_success() == 0 { + return fmt.Errorf("SendRPCRequest, error: %s", C.GoString(C.bcos_sdk_get_last_error_msg())) + } + return nil +} + // // amop // func (csdk *CSDK) SubscribeAmopTopicDefaultHandler(topic []string) { // cTopic := C.CString(topic) diff --git a/go.mod b/go.mod new file mode 100644 index 000000000..bb83cf102 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/FISCO-BCOS/bcos-c-sdk + +go 1.21.5 + +require github.com/patrickmn/go-cache v2.1.0+incompatible