@@ -176,14 +176,14 @@ class Libwallet {
176176 ptrsToFree: [cName, cNumBlocks],
177177 );
178178 break ;
179- case "createsignedtransaction " :
179+ case "createtransaction " :
180180 final name = args["name" ] ?? "" ;
181- final signReq = args["signreq " ] ?? "" ;
181+ final signReq = args["req " ] ?? "" ;
182182 final cName = name.toCString ();
183- final cSignReq = signReq.toCString ();
183+ final cReq = signReq.toCString ();
184184 res = executePayloadFn (
185- fn: () => dcrwalletApi.createSignedTransaction (cName, cSignReq ),
186- ptrsToFree: [cName, cSignReq ],
185+ fn: () => dcrwalletApi.createTransaction (cName, cReq ),
186+ ptrsToFree: [cName, cReq ],
187187 );
188188 break ;
189189 case "sendrawtransaction" :
@@ -299,9 +299,65 @@ class Libwallet {
299299 ptrsToFree: [cName],
300300 );
301301 break ;
302- case "shutdown" :
302+ case "addrfromextendedkey" :
303+ final req = args["req" ] ?? "" ;
304+ final cReq = req.toCString ();
305+ res = executePayloadFn (
306+ fn: () => dcrwalletApi.addrFromExtendedKey (cReq),
307+ ptrsToFree: [cReq],
308+ );
309+ break ;
310+ case "createextendedkey" :
311+ final req = args["req" ] ?? "" ;
312+ final cReq = req.toCString ();
313+ res = executePayloadFn (
314+ fn: () => dcrwalletApi.createExtendedKey (cReq),
315+ ptrsToFree: [cReq],
316+ );
317+ break ;
318+ case "decodetx" :
319+ final name = args["name" ] ?? "" ;
320+ final cName = name.toCString ();
321+ final txHex = args["txhex" ] ?? "" ;
322+ final cTxHex = txHex.toCString ();
323+ res = executePayloadFn (
324+ fn: () => dcrwalletApi.decodeTx (cName, cTxHex),
325+ ptrsToFree: [cName, cTxHex],
326+ );
327+ break ;
328+ case "gettxn" :
329+ final name = args["name" ] ?? "" ;
330+ final cName = name.toCString ();
331+ final hashes = args["hashes" ] ?? "" ;
332+ final cHashes = hashes.toCString ();
333+ res = executePayloadFn (
334+ fn: () => dcrwalletApi.getTxn (cName, cHashes),
335+ ptrsToFree: [cName, cHashes],
336+ );
337+ break ;
338+ case "validateaddr" :
303339 final name = args["name" ] ?? "" ;
304- // final cName = name.toCString();
340+ final cName = name.toCString ();
341+ final addr = args["addr" ] ?? "" ;
342+ final cAddr = addr.toCString ();
343+ res = executePayloadFn (
344+ fn: () => dcrwalletApi.validateAddr (cName, cAddr),
345+ ptrsToFree: [cName, cAddr],
346+ );
347+ break ;
348+ case "addsigs" :
349+ final name = args["name" ] ?? "" ;
350+ final cName = name.toCString ();
351+ final txHex = args["txhex" ] ?? "" ;
352+ final cTxHex = txHex.toCString ();
353+ final sigScripts = args["sigscripts" ] ?? "" ;
354+ final cSigScripts = sigScripts.toCString ();
355+ res = executePayloadFn (
356+ fn: () => dcrwalletApi.addSigs (cName, cTxHex, cSigScripts),
357+ ptrsToFree: [cName, cTxHex, cSigScripts],
358+ );
359+ break ;
360+ case "shutdown" :
305361 executePayloadFn (
306362 fn: () => dcrwalletApi.shutdown (),
307363 ptrsToFree: [],
@@ -490,16 +546,15 @@ class Libwallet {
490546 return res.payload;
491547 }
492548
493- Future <String > createSignedTransaction (
494- String walletName, String createSignedTransactionReq) async {
549+ Future <String > createTransaction (String walletName, String createTransactionReq) async {
495550 if (_closed) throw StateError ('Closed' );
496551 final completer = Completer <Object ?>.sync ();
497552 final id = _idCounter++ ;
498553 _activeRequests[id] = completer;
499554 final req = {
500- "method" : "createsignedtransaction " ,
555+ "method" : "createtransaction " ,
501556 "name" : walletName,
502- "signreq " : createSignedTransactionReq ,
557+ "req " : createTransactionReq ,
503558 };
504559 _commands.send ((id, req));
505560 final res = await completer.future as PayloadResult ;
@@ -680,6 +735,95 @@ class Libwallet {
680735 return res.payload;
681736 }
682737
738+ Future <String > addrFromExtendedKey (String afekReq) async {
739+ if (_closed) throw StateError ('Closed' );
740+ final completer = Completer <Object ?>.sync ();
741+ final id = _idCounter++ ;
742+ _activeRequests[id] = completer;
743+ final req = {
744+ "method" : "addrfromextendedkey" ,
745+ "req" : afekReq,
746+ };
747+ _commands.send ((id, req));
748+ final res = await completer.future as PayloadResult ;
749+ return res.payload;
750+ }
751+
752+ Future <String > createExtendedKey (String createReq) async {
753+ if (_closed) throw StateError ('Closed' );
754+ final completer = Completer <Object ?>.sync ();
755+ final id = _idCounter++ ;
756+ _activeRequests[id] = completer;
757+ final req = {
758+ "method" : "createextendedkey" ,
759+ "req" : createReq,
760+ };
761+ _commands.send ((id, req));
762+ final res = await completer.future as PayloadResult ;
763+ return res.payload;
764+ }
765+
766+ Future <String > decodeTx (String walletName, String txHex) async {
767+ if (_closed) throw StateError ('Closed' );
768+ final completer = Completer <Object ?>.sync ();
769+ final id = _idCounter++ ;
770+ _activeRequests[id] = completer;
771+ final req = {
772+ "method" : "decodetx" ,
773+ "name" : walletName,
774+ "txhex" : txHex,
775+ };
776+ _commands.send ((id, req));
777+ final res = await completer.future as PayloadResult ;
778+ return res.payload;
779+ }
780+
781+ Future <String > getTxn (String walletName, String hashes) async {
782+ if (_closed) throw StateError ('Closed' );
783+ final completer = Completer <Object ?>.sync ();
784+ final id = _idCounter++ ;
785+ _activeRequests[id] = completer;
786+ final req = {
787+ "method" : "gettxn" ,
788+ "name" : walletName,
789+ "hashes" : hashes,
790+ };
791+ _commands.send ((id, req));
792+ final res = await completer.future as PayloadResult ;
793+ return res.payload;
794+ }
795+
796+ Future <String > validateAddr (String walletName, String addr) async {
797+ if (_closed) throw StateError ('Closed' );
798+ final completer = Completer <Object ?>.sync ();
799+ final id = _idCounter++ ;
800+ _activeRequests[id] = completer;
801+ final req = {
802+ "method" : "validateaddr" ,
803+ "name" : walletName,
804+ "addr" : addr,
805+ };
806+ _commands.send ((id, req));
807+ final res = await completer.future as PayloadResult ;
808+ return res.payload;
809+ }
810+
811+ Future <String > addSigs (String walletName, String txHex, String sigScripts) async {
812+ if (_closed) throw StateError ('Closed' );
813+ final completer = Completer <Object ?>.sync ();
814+ final id = _idCounter++ ;
815+ _activeRequests[id] = completer;
816+ final req = {
817+ "method" : "addsigs" ,
818+ "name" : walletName,
819+ "txhex" : txHex,
820+ "sigscripts" : sigScripts,
821+ };
822+ _commands.send ((id, req));
823+ final res = await completer.future as PayloadResult ;
824+ return res.payload;
825+ }
826+
683827 Future <void > shutdown () async {
684828 if (_closed) throw StateError ('Closed' );
685829 final completer = Completer <Object ?>.sync ();
0 commit comments