Skip to content

Commit

Permalink
walletrpc+itest: add SignPsbt RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Jan 6, 2022
1 parent d135b63 commit 8994d86
Show file tree
Hide file tree
Showing 11 changed files with 844 additions and 249 deletions.
559 changes: 348 additions & 211 deletions lnrpc/walletrpc/walletkit.pb.go

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions lnrpc/walletrpc/walletkit.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions lnrpc/walletrpc/walletkit.pb.json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions lnrpc/walletrpc/walletkit.proto
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,21 @@ service WalletKit {
*/
rpc FundPsbt (FundPsbtRequest) returns (FundPsbtResponse);

/*
SignPsbt expects a partial transaction with all inputs and outputs fully
declared and tries to sign all unsigned inputs that have all required fields
(UTXO information, BIP32 derivation information, witness or sig scripts)
set.
If no error is returned, the PSBT is ready to be given to the next signer or
to be finalized if lnd was the last signer.
NOTE: This RPC only signs inputs (and only those it can sign), it does not
perform any other tasks (such as coin selection, UTXO locking or
input/output/fee value validation, PSBT finalization). Any input that is
incomplete will be skipped.
*/
rpc SignPsbt (SignPsbtRequest) returns (SignPsbtResponse);

/*
FinalizePsbt expects a partial transaction with all inputs and outputs fully
declared and tries to sign all inputs that belong to the wallet. Lnd must be
Expand Down Expand Up @@ -820,6 +835,19 @@ message UtxoLease {
uint64 expiration = 3;
}

message SignPsbtRequest {
/*
The PSBT that should be signed. The PSBT must contain all required inputs,
outputs, UTXO data and custom fields required to identify the signing key.
*/
bytes funded_psbt = 1;
}

message SignPsbtResponse {
// The signed transaction in PSBT format.
bytes signed_psbt = 1;
}

message FinalizePsbtRequest {
/*
A PSBT that should be signed and finalized. The PSBT must contain all
Expand Down
54 changes: 54 additions & 0 deletions lnrpc/walletrpc/walletkit.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,40 @@
]
}
},
"/v2/wallet/psbt/sign": {
"post": {
"summary": "SignPsbt expects a partial transaction with all inputs and outputs fully\ndeclared and tries to sign all unsigned inputs that have all required fields\n(UTXO information, BIP32 derivation information, witness or sig scripts)\nset.\nIf no error is returned, the PSBT is ready to be given to the next signer or\nto be finalized if lnd was the last signer.",
"description": "NOTE: This RPC only signs inputs (and only those it can sign), it does not\nperform any other tasks (such as coin selection, UTXO locking or\ninput/output/fee value validation, PSBT finalization). Any input that is\nincomplete will be skipped.",
"operationId": "WalletKit_SignPsbt",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/walletrpcSignPsbtResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/walletrpcSignPsbtRequest"
}
}
],
"tags": [
"WalletKit"
]
}
},
"/v2/wallet/send": {
"post": {
"summary": "SendOutputs is similar to the existing sendmany call in Bitcoind, and\nallows the caller to create a transaction that sends to several outputs at\nonce. This is ideal when wanting to batch create a set of transactions.",
Expand Down Expand Up @@ -1392,6 +1426,26 @@
}
}
},
"walletrpcSignPsbtRequest": {
"type": "object",
"properties": {
"funded_psbt": {
"type": "string",
"format": "byte",
"description": "The PSBT that should be signed. The PSBT must contain all required inputs,\noutputs, UTXO data and custom fields required to identify the signing key."
}
}
},
"walletrpcSignPsbtResponse": {
"type": "object",
"properties": {
"signed_psbt": {
"type": "string",
"format": "byte",
"description": "The signed transaction in PSBT format."
}
}
},
"walletrpcTransaction": {
"type": "object",
"properties": {
Expand Down
3 changes: 3 additions & 0 deletions lnrpc/walletrpc/walletkit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ http:
- selector: walletrpc.WalletKit.FundPsbt
post: "/v2/wallet/psbt/fund"
body: "*"
- selector: walletrpc.WalletKit.SignPsbt
post: "/v2/wallet/psbt/sign"
body: "*"
- selector: walletrpc.WalletKit.FinalizePsbt
post: "/v2/wallet/psbt/finalize"
body: "*"
Expand Down
60 changes: 60 additions & 0 deletions lnrpc/walletrpc/walletkit_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8994d86

Please sign in to comment.