msggen: add createrune method

This commit is contained in:
daywalker90 2024-04-24 21:42:46 +02:00 committed by Christian Decker
parent 19646f93c6
commit 473694c39a
10 changed files with 149 additions and 40 deletions

View File

@ -819,6 +819,15 @@
"CreateOnion.onion": 1,
"CreateOnion.shared_secrets[]": 2
},
"CreateruneRequest": {
"CreateRune.restrictions": 2,
"CreateRune.rune": 1
},
"CreateruneResponse": {
"CreateRune.rune": 1,
"CreateRune.unique_id": 2,
"CreateRune.warning_unrestricted_rune": 3
},
"CustomMsgNotification": {
"custommsg.payload": 2,
"custommsg.peer_id": 1
@ -4114,6 +4123,26 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"CreateRune": {
"added": "pre-v0.10.1",
"deprecated": null
},
"CreateRune.restrictions": {
"added": "pre-v0.10.1",
"deprecated": false
},
"CreateRune.rune": {
"added": "pre-v0.10.1",
"deprecated": false
},
"CreateRune.unique_id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"CreateRune.warning_unrestricted_rune": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Datastore": {
"added": "pre-v0.10.1",
"deprecated": null

Binary file not shown.

BIN
cln-grpc/src/convert.rs generated

Binary file not shown.

View File

@ -3538,6 +3538,38 @@ impl Node for Server
}
async fn create_rune(
&self,
request: tonic::Request<pb::CreateruneRequest>,
) -> Result<tonic::Response<pb::CreateruneResponse>, tonic::Status> {
let req = request.into_inner();
let req: requests::CreateruneRequest = req.into();
debug!("Client asked for create_rune");
trace!("create_rune request: {:?}", req);
let mut rpc = ClnRpc::new(&self.rpc_path)
.await
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
let result = rpc.call(Request::CreateRune(req))
.await
.map_err(|e| Status::new(
Code::Unknown,
format!("Error calling method CreateRune: {:?}", e)))?;
match result {
Response::CreateRune(r) => {
trace!("create_rune response: {:?}", r);
Ok(tonic::Response::new(r.into()))
},
r => Err(Status::new(
Code::Internal,
format!(
"Unexpected result {:?} to method call CreateRune",
r
)
)),
}
}
async fn show_runes(
&self,
request: tonic::Request<pb::ShowrunesRequest>,

BIN
cln-rpc/src/model.rs generated

Binary file not shown.

View File

@ -513,6 +513,7 @@ DecodeRoutehintListField = PrimitiveField(
added=None,
deprecated=None
)
CreateRuneRestrictionsField = ArrayField(itemtype=PrimitiveField("string", None, None, added=None, deprecated=None), dims=1, path=None, description=None, added=None, deprecated=None)
# TlvStreams are special, they don't have preset dict-keys, rather
# they can specify `u64` keys pointing to hex payloads. So the schema
@ -544,7 +545,8 @@ overrides = {
'WaitInvoice.label': InvoiceLabelField,
'Offer.recurrence_base': OfferStringField,
'Offer.amount': OfferStringField,
'SetConfig.val': SetConfigValField
'SetConfig.val': SetConfigValField,
'CreateRune.restrictions': CreateRuneRestrictionsField,
}

View File

@ -201,6 +201,7 @@ def load_jsonrpc_service():
"Bkpr-ListAccountEvents",
"Bkpr-ListBalances",
"Bkpr-ListIncome",
"CreateRune",
"ShowRunes",
]

File diff suppressed because one or more lines are too long

View File

@ -554,6 +554,11 @@ class NodeStub(object):
request_serializer=node__pb2.BkprlistincomeRequest.SerializeToString,
response_deserializer=node__pb2.BkprlistincomeResponse.FromString,
)
self.CreateRune = channel.unary_unary(
'/cln.Node/CreateRune',
request_serializer=node__pb2.CreateruneRequest.SerializeToString,
response_deserializer=node__pb2.CreateruneResponse.FromString,
)
self.ShowRunes = channel.unary_unary(
'/cln.Node/ShowRunes',
request_serializer=node__pb2.ShowrunesRequest.SerializeToString,
@ -1237,6 +1242,12 @@ class NodeServicer(object):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def CreateRune(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ShowRunes(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@ -1816,6 +1827,11 @@ def add_NodeServicer_to_server(servicer, server):
request_deserializer=node__pb2.BkprlistincomeRequest.FromString,
response_serializer=node__pb2.BkprlistincomeResponse.SerializeToString,
),
'CreateRune': grpc.unary_unary_rpc_method_handler(
servicer.CreateRune,
request_deserializer=node__pb2.CreateruneRequest.FromString,
response_serializer=node__pb2.CreateruneResponse.SerializeToString,
),
'ShowRunes': grpc.unary_unary_rpc_method_handler(
servicer.ShowRunes,
request_deserializer=node__pb2.ShowrunesRequest.FromString,
@ -3692,6 +3708,23 @@ class Node(object):
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def CreateRune(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/cln.Node/CreateRune',
node__pb2.CreateruneRequest.SerializeToString,
node__pb2.CreateruneResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ShowRunes(request,
target,

View File

@ -2790,6 +2790,14 @@ def bkpr_listincome2py(m):
})
def createrune2py(m):
return remove_default({
"rune": m.rune, # PrimitiveField in generate_composite
"unique_id": m.unique_id, # PrimitiveField in generate_composite
"warning_unrestricted_rune": m.warning_unrestricted_rune, # PrimitiveField in generate_composite
})
def showrunes_runes_restrictions_alternatives2py(m):
return remove_default({
"condition": m.condition, # PrimitiveField in generate_composite