Use secp256k1 for public key type

This commit is contained in:
elsirion
2022-05-13 21:30:07 +00:00
committed by Christian Decker
parent e272c93a88
commit b4b0b479ac
9 changed files with 301 additions and 330 deletions

View File

@@ -302,8 +302,8 @@ class GrpcConverterGenerator(IGenerator):
'u16?': f'c.{name}.map(|v| v.into())',
'msat': f'Some(c.{name}.into())',
'msat?': f'c.{name}.map(|f| f.into())',
'pubkey': f'c.{name}.to_vec()',
'pubkey?': f'c.{name}.map(|v| v.to_vec())',
'pubkey': f'c.{name}.serialize().to_vec()',
'pubkey?': f'c.{name}.map(|v| v.serialize().to_vec())',
'hex': f'hex::decode(&c.{name}).unwrap()',
'hex?': f'c.{name}.map(|v| hex::decode(v).unwrap())',
'txid': f'hex::decode(&c.{name}).unwrap()',
@@ -351,6 +351,7 @@ class GrpcConverterGenerator(IGenerator):
use std::str::FromStr;
use bitcoin_hashes::sha256::Hash as Sha256;
use bitcoin_hashes::Hash;
use cln_rpc::primitives::PublicKey;
""")
@@ -420,8 +421,8 @@ class GrpcUnconverterGenerator(GrpcConverterGenerator):
'hex': f'hex::encode(&c.{name})',
'hex?': f'c.{name}.map(|v| hex::encode(v))',
'txid?': f'c.{name}.map(|v| hex::encode(v))',
'pubkey': f'cln_rpc::primitives::Pubkey::from_slice(&c.{name}).unwrap()',
'pubkey?': f'c.{name}.map(|v| cln_rpc::primitives::Pubkey::from_slice(&v[..]).unwrap())',
'pubkey': f'PublicKey::from_slice(&c.{name}).unwrap()',
'pubkey?': f'c.{name}.map(|v| PublicKey::from_slice(&v).unwrap())',
'msat': f'c.{name}.unwrap().into()',
'msat?': f'c.{name}.map(|a| a.into())',
'msat_or_all': f'c.{name}.unwrap().into()',

View File

@@ -38,7 +38,7 @@ typemap = {
'msat_or_all': 'AmountOrAll',
'msat_or_any': 'AmountOrAny',
'number': 'f64',
'pubkey': 'Pubkey',
'pubkey': 'PublicKey',
'short_channel_id': 'ShortChannelId',
'signature': 'String',
'string': 'String',