mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 18:10:34 +01:00
602 lines
13 KiB
Go
602 lines
13 KiB
Go
// Code generated by falafel 0.9.1. DO NOT EDIT.
|
|
// source: walletkit.proto
|
|
|
|
// +build js
|
|
|
|
package walletrpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
gateway "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
)
|
|
|
|
func RegisterWalletKitJSONCallbacks(registry map[string]func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error))) {
|
|
|
|
marshaler := &gateway.JSONPb{
|
|
MarshalOptions: protojson.MarshalOptions{
|
|
UseProtoNames: true,
|
|
EmitUnpopulated: true,
|
|
},
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.ListUnspent"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListUnspentRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.ListUnspent(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.LeaseOutput"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &LeaseOutputRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.LeaseOutput(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.ReleaseOutput"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ReleaseOutputRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.ReleaseOutput(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.ListLeases"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListLeasesRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.ListLeases(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.DeriveNextKey"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &KeyReq{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.DeriveNextKey(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.DeriveKey"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &signrpc.KeyLocator{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.DeriveKey(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.NextAddr"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &AddrRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.NextAddr(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.ListAccounts"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListAccountsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.ListAccounts(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.RequiredReserve"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &RequiredReserveRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.RequiredReserve(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.ListAddresses"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListAddressesRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.ListAddresses(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.ImportAccount"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ImportAccountRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.ImportAccount(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.ImportPublicKey"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ImportPublicKeyRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.ImportPublicKey(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.ImportTapscript"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ImportTapscriptRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.ImportTapscript(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.PublishTransaction"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &Transaction{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.PublishTransaction(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.SendOutputs"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &SendOutputsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.SendOutputs(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.EstimateFee"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &EstimateFeeRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.EstimateFee(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.PendingSweeps"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &PendingSweepsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.PendingSweeps(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.BumpFee"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &BumpFeeRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.BumpFee(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.ListSweeps"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListSweepsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.ListSweeps(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.LabelTransaction"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &LabelTransactionRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.LabelTransaction(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.FundPsbt"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &FundPsbtRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.FundPsbt(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.SignPsbt"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &SignPsbtRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.SignPsbt(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["walletrpc.WalletKit.FinalizePsbt"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &FinalizePsbtRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWalletKitClient(conn)
|
|
resp, err := client.FinalizePsbt(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}
|