diff --git a/address/address.go b/address/address.go index 1f91ce53f..74cf35101 100644 --- a/address/address.go +++ b/address/address.go @@ -60,6 +60,10 @@ var ( // the local database. ErrScriptKeyNotFound = errors.New("script key not found") + // ErrInternalKeyNotFound is returned when an internal key is not found + // in the local database. + ErrInternalKeyNotFound = errors.New("internal key not found") + // ErrUnknownVersion is returned when encountering an address with an // unrecognised version number. ErrUnknownVersion = errors.New("address: unknown version number") diff --git a/asset/asset.go b/asset/asset.go index 63d180865..f5482f434 100644 --- a/asset/asset.go +++ b/asset/asset.go @@ -426,8 +426,10 @@ func (w *Witness) Decode(r io.Reader) error { return stream.Decode(r) } -// DeepEqual returns true if this witness is equal with the given witness. -func (w *Witness) DeepEqual(o *Witness) bool { +// DeepEqual returns true if this witness is equal with the given witness. If +// the skipTxWitness boolean is set, the TxWitness field of the Witness is not +// compared. +func (w *Witness) DeepEqual(skipTxWitness bool, o *Witness) bool { if w == nil || o == nil { return w == o } @@ -436,11 +438,17 @@ func (w *Witness) DeepEqual(o *Witness) bool { return false } - if !reflect.DeepEqual(w.TxWitness, o.TxWitness) { + if !w.SplitCommitment.DeepEqual(o.SplitCommitment) { return false } - return w.SplitCommitment.DeepEqual(o.SplitCommitment) + // If we're not comparing the TxWitness, we're done. This might be + // useful when comparing witnesses of segregated witness version assets. + if skipTxWitness { + return true + } + + return reflect.DeepEqual(w.TxWitness, o.TxWitness) } // ScriptVersion denotes the asset script versioning scheme. @@ -1398,6 +1406,20 @@ func (a *Asset) Copy() *Asset { // DeepEqual returns true if this asset is equal with the given asset. func (a *Asset) DeepEqual(o *Asset) bool { + return a.deepEqual(false, o) +} + +// DeepEqualAllowSegWitIgnoreTxWitness returns true if this asset is equal with +// the given asset, ignoring the TxWitness field of the Witness if the asset +// version is v1. +func (a *Asset) DeepEqualAllowSegWitIgnoreTxWitness(o *Asset) bool { + return a.deepEqual(true, o) +} + +// deepEqual returns true if this asset is equal with the given asset. The +// allowSegWitIgnoreTxWitness flag is used to determine whether the TxWitness +// field of the Witness should be ignored if the asset version is v1. +func (a *Asset) deepEqual(allowSegWitIgnoreTxWitness bool, o *Asset) bool { if a.Version != o.Version { return false } @@ -1437,7 +1459,9 @@ func (a *Asset) DeepEqual(o *Asset) bool { } for i := range a.PrevWitnesses { - if !a.PrevWitnesses[i].DeepEqual(&o.PrevWitnesses[i]) { + oPrevWitness := &o.PrevWitnesses[i] + skipTxWitness := a.Version == V1 && allowSegWitIgnoreTxWitness + if !a.PrevWitnesses[i].DeepEqual(skipTxWitness, oPrevWitness) { return false } } diff --git a/itest/assertions.go b/itest/assertions.go index 33ed2450a..256ba1bf9 100644 --- a/itest/assertions.go +++ b/itest/assertions.go @@ -20,7 +20,9 @@ import ( "github.com/lightninglabs/taproot-assets/fn" "github.com/lightninglabs/taproot-assets/proof" "github.com/lightninglabs/taproot-assets/taprpc" + wrpc "github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc" "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" + "github.com/lightninglabs/taproot-assets/taprpc/tapdevrpc" unirpc "github.com/lightninglabs/taproot-assets/taprpc/universerpc" "github.com/lightninglabs/taproot-assets/universe" "github.com/lightningnetwork/lnd/lnrpc/chainrpc" @@ -36,6 +38,16 @@ var ( statusCompleted = taprpc.AddrEventStatus_ADDR_EVENT_STATUS_COMPLETED ) +// tapClient is an interface that covers all currently available RPC interfaces +// a client should implement. +type tapClient interface { + taprpc.TaprootAssetsClient + wrpc.AssetWalletClient + tapdevrpc.TapDevClient + mintrpc.MintClient + unirpc.UniverseClient +} + // AssetCheck is a function type that checks an RPC asset's property. type AssetCheck func(a *taprpc.Asset) error @@ -593,7 +605,7 @@ func VerifyProofBlob(t *testing.T, tapClient taprpc.TaprootAssetsClient, // AssertAddrCreated makes sure an address was created correctly for the given // asset. -func AssertAddrCreated(t *testing.T, client taprpc.TaprootAssetsClient, +func AssertAddrCreated(t *testing.T, client tapClient, expected *taprpc.Asset, actual *taprpc.Addr) { // Was the address created correctly? @@ -631,6 +643,43 @@ func AssertAddrCreated(t *testing.T, client taprpc.TaprootAssetsClient, // Does the address in the list contain all information we expect? AssertAddr(t, expected, rpcAddr) + + // We also make sure we can query the script and internal keys of the + // address correctly. + scriptKeyResp, err := client.QueryScriptKey( + ctxt, &wrpc.QueryScriptKeyRequest{ + TweakedScriptKey: actual.ScriptKey, + }, + ) + require.NoError(t, err) + require.NotNil(t, scriptKeyResp.ScriptKey) + require.NotNil(t, scriptKeyResp.ScriptKey.KeyDesc) + require.NotNil(t, scriptKeyResp.ScriptKey.KeyDesc.KeyLoc) + require.EqualValues( + t, asset.TaprootAssetsKeyFamily, + scriptKeyResp.ScriptKey.KeyDesc.KeyLoc.KeyFamily, + ) + require.NotEqual( + t, scriptKeyResp.ScriptKey.PubKey, + scriptKeyResp.ScriptKey.KeyDesc.RawKeyBytes, + ) + + internalKeyResp, err := client.QueryInternalKey( + ctxt, &wrpc.QueryInternalKeyRequest{ + InternalKey: actual.InternalKey, + }, + ) + require.NoError(t, err) + require.NotNil(t, internalKeyResp.InternalKey) + require.NotNil(t, internalKeyResp.InternalKey.KeyLoc) + require.EqualValues( + t, asset.TaprootAssetsKeyFamily, + internalKeyResp.InternalKey.KeyLoc.KeyFamily, + ) + require.Equal( + t, actual.InternalKey, + internalKeyResp.InternalKey.RawKeyBytes, + ) } // AssertAddrEvent makes sure the given address was detected by the given @@ -850,11 +899,8 @@ func AssertAddr(t *testing.T, expected *taprpc.Asset, actual *taprpc.Addr) { if expected.AssetGroup == nil { require.Nil(t, actual.GroupKey) } else { - // TODO(guggero): Address 33-byte vs. 32-byte issue in encoded - // address vs. database. require.Equal( - t, expected.AssetGroup.TweakedGroupKey[1:], - actual.GroupKey[1:], + t, expected.AssetGroup.TweakedGroupKey, actual.GroupKey, ) } @@ -863,7 +909,7 @@ func AssertAddr(t *testing.T, expected *taprpc.Asset, actual *taprpc.Addr) { require.NotEqual(t, expected.ScriptKey, actual.ScriptKey) } -// assertEqualAsset asserts that two taprpc.Asset objects are equal, ignoring +// AssertAsset asserts that two taprpc.Asset objects are equal, ignoring // node-specific fields like if script keys are local, if the asset is spent, // or if the anchor information is populated. func AssertAsset(t *testing.T, expected, actual *taprpc.Asset) { diff --git a/itest/loadtest/utils.go b/itest/loadtest/utils.go index 22446d97b..8e9e6f401 100644 --- a/itest/loadtest/utils.go +++ b/itest/loadtest/utils.go @@ -17,6 +17,7 @@ import ( "github.com/lightninglabs/taproot-assets/taprpc" "github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc" "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" + "github.com/lightninglabs/taproot-assets/taprpc/tapdevrpc" "github.com/lightninglabs/taproot-assets/taprpc/universerpc" "github.com/lightningnetwork/lnd/macaroons" "github.com/stretchr/testify/require" @@ -34,9 +35,10 @@ var ( type rpcClient struct { cfg *TapConfig taprpc.TaprootAssetsClient - universerpc.UniverseClient - mintrpc.MintClient assetwalletrpc.AssetWalletClient + tapdevrpc.TapDevClient + mintrpc.MintClient + universerpc.UniverseClient } // assetIDWithBalance returns the asset ID of an asset that has at least the @@ -166,16 +168,18 @@ func getTapClient(t *testing.T, ctx context.Context, require.NoError(t, err) assetsClient := taprpc.NewTaprootAssetsClient(conn) - universeClient := universerpc.NewUniverseClient(conn) - mintMintClient := mintrpc.NewMintClient(conn) assetWalletClient := assetwalletrpc.NewAssetWalletClient(conn) + devClient := tapdevrpc.NewTapDevClient(conn) + mintMintClient := mintrpc.NewMintClient(conn) + universeClient := universerpc.NewUniverseClient(conn) client := &rpcClient{ cfg: cfg, TaprootAssetsClient: assetsClient, - UniverseClient: universeClient, - MintClient: mintMintClient, AssetWalletClient: assetWalletClient, + TapDevClient: devClient, + MintClient: mintMintClient, + UniverseClient: universeClient, } t.Cleanup(func() { diff --git a/perms/perms.go b/perms/perms.go index 2d7afc005..ea718f967 100644 --- a/perms/perms.go +++ b/perms/perms.go @@ -108,6 +108,14 @@ var ( Entity: "assets", Action: "write", }}, + "/assetwalletrpc.AssetWallet/QueryInternalKey": {{ + Entity: "assets", + Action: "read", + }}, + "/assetwalletrpc.AssetWallet/QueryScriptKey": {{ + Entity: "assets", + Action: "read", + }}, "/assetwalletrpc.AssetWallet/ProveAssetOwnership": {{ Entity: "assets", Action: "write", diff --git a/proof/append.go b/proof/append.go index 5cd0eb170..9b8908eac 100644 --- a/proof/append.go +++ b/proof/append.go @@ -166,7 +166,13 @@ func CreateTransitionProof(prevOut wire.OutPoint, } // Make sure the committed asset matches the root asset exactly. - if !committedRoot.DeepEqual(rootAsset) { + // We allow the TxWitness to mismatch for assets with version 1 + // as they would not include the witness when the proof is + // created. + if !committedRoot.DeepEqualAllowSegWitIgnoreTxWitness( + rootAsset, + ) { + return nil, fmt.Errorf("root asset mismatch") } diff --git a/rpcserver.go b/rpcserver.go index 372db4d4d..416eb96fa 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1707,7 +1707,7 @@ func (r *rpcServer) FundVirtualPsbt(ctx context.Context, // SignVirtualPsbt signs the inputs of a virtual transaction and prepares the // commitments of the inputs and outputs. -func (r *rpcServer) SignVirtualPsbt(_ context.Context, +func (r *rpcServer) SignVirtualPsbt(ctx context.Context, req *wrpc.SignVirtualPsbtRequest) (*wrpc.SignVirtualPsbtResponse, error) { @@ -1722,6 +1722,43 @@ func (r *rpcServer) SignVirtualPsbt(_ context.Context, return nil, fmt.Errorf("error decoding packet: %w", err) } + // Make sure the input keys are known. + for _, input := range vPkt.Inputs { + // If we have all the derivation information, we don't need to + // do anything. + if len(input.Bip32Derivation) > 0 && + len(input.TaprootBip32Derivation) > 0 { + + continue + } + + scriptKey := input.Asset().ScriptKey + + // If the full tweaked script key isn't set on the asset, we + // need to look it up in the local database, to make sure we'll + // be able to sign for it. + if scriptKey.TweakedScriptKey == nil { + tweakedScriptKey, err := r.cfg.AssetWallet.FetchScriptKey( + ctx, scriptKey.PubKey, + ) + if err != nil { + return nil, fmt.Errorf("error fetching "+ + "script key: %w", err) + } + + scriptKey.TweakedScriptKey = tweakedScriptKey + } + + derivation, trDerivation := tappsbt.Bip32DerivationFromKeyDesc( + scriptKey.TweakedScriptKey.RawKey, + r.cfg.ChainParams.HDCoinType, + ) + input.Bip32Derivation = []*psbt.Bip32Derivation{derivation} + input.TaprootBip32Derivation = []*psbt.TaprootBip32Derivation{ + trDerivation, + } + } + signedInputs, err := r.cfg.AssetWallet.SignVirtualPacket(vPkt) if err != nil { return nil, fmt.Errorf("error signing packet: %w", err) @@ -1855,6 +1892,149 @@ func (r *rpcServer) NextScriptKey(ctx context.Context, }, nil } +// QueryInternalKey returns the key descriptor for the given internal key. +func (r *rpcServer) QueryInternalKey(ctx context.Context, + req *wrpc.QueryInternalKeyRequest) (*wrpc.QueryInternalKeyResponse, + error) { + + var ( + internalKey *btcec.PublicKey + keyLocator keychain.KeyLocator + err error + ) + + // We allow the user to specify the key either in the 33-byte compressed + // format or the 32-byte x-only format. + switch { + case len(req.InternalKey) == 33: + internalKey, err = btcec.ParsePubKey(req.InternalKey) + if err != nil { + return nil, fmt.Errorf("error parsing internal key: %w", + err) + } + + // If the full 33-byte key was specified, we expect the user to + // already know the parity byte, so we only try once. + keyLocator, err = r.cfg.AssetWallet.FetchInternalKeyLocator( + ctx, internalKey, + ) + if err != nil { + return nil, fmt.Errorf("error fetching internal key: "+ + "%w", err) + } + + case len(req.InternalKey) == 32: + internalKey, err = schnorr.ParsePubKey(req.InternalKey) + if err != nil { + return nil, fmt.Errorf("error parsing internal key: %w", + err) + } + + keyLocator, err = r.cfg.AssetWallet.FetchInternalKeyLocator( + ctx, internalKey, + ) + + switch { + // If the key can't be found with the even parity, we'll try + // the odd parity. + case errors.Is(err, address.ErrInternalKeyNotFound): + internalKey = tapscript.FlipParity(internalKey) + + keyLocator, err = r.cfg.AssetWallet.FetchInternalKeyLocator( + ctx, internalKey, + ) + if err != nil { + return nil, fmt.Errorf("error fetching "+ + "internal key: %w", err) + } + + // For any other error from above, we'll return it to the user. + case err != nil: + return nil, fmt.Errorf("error fetching internal key: "+ + "%w", err) + } + + default: + return nil, fmt.Errorf("invalid internal key length") + } + + return &wrpc.QueryInternalKeyResponse{ + InternalKey: marshalKeyDescriptor(keychain.KeyDescriptor{ + PubKey: internalKey, + KeyLocator: keyLocator, + }), + }, nil +} + +// QueryScriptKey returns the full script key descriptor for the given tweaked +// script key. +func (r *rpcServer) QueryScriptKey(ctx context.Context, + req *wrpc.QueryScriptKeyRequest) (*wrpc.QueryScriptKeyResponse, error) { + + var ( + scriptKey *btcec.PublicKey + tweakedKey *asset.TweakedScriptKey + err error + ) + + // We allow the user to specify the key either in the 33-byte compressed + // format or the 32-byte x-only format. + switch { + case len(req.TweakedScriptKey) == 33: + scriptKey, err = btcec.ParsePubKey(req.TweakedScriptKey) + if err != nil { + return nil, fmt.Errorf("error parsing script key: %w", + err) + } + + tweakedKey, err = r.cfg.AssetWallet.FetchScriptKey( + ctx, scriptKey, + ) + if err != nil { + return nil, fmt.Errorf("error fetching script key: %w", + err) + } + + case len(req.TweakedScriptKey) == 32: + scriptKey, err = schnorr.ParsePubKey(req.TweakedScriptKey) + if err != nil { + return nil, fmt.Errorf("error parsing script key: %w", + err) + } + + tweakedKey, err = r.cfg.AssetWallet.FetchScriptKey( + ctx, scriptKey, + ) + + // If the key can't be found with the even parity, we'll try + // the odd parity. + if errors.Is(err, address.ErrScriptKeyNotFound) { + scriptKey = tapscript.FlipParity(scriptKey) + + tweakedKey, err = r.cfg.AssetWallet.FetchScriptKey( + ctx, scriptKey, + ) + } + + // Return either the original error or the error from the re-try + // with odd parity. + if err != nil { + return nil, fmt.Errorf("error fetching script key: %w", + err) + } + + default: + return nil, fmt.Errorf("invalid script key length") + } + + return &wrpc.QueryScriptKeyResponse{ + ScriptKey: marshalScriptKey(asset.ScriptKey{ + PubKey: scriptKey, + TweakedScriptKey: tweakedKey, + }), + }, nil +} + // marshalAddr turns an address into its RPC counterpart. func marshalAddr(addr *address.Tap, db address.Storage) (*taprpc.Addr, error) { diff --git a/tapdb/addrs.go b/tapdb/addrs.go index 3e243d94b..195a0f116 100644 --- a/tapdb/addrs.go +++ b/tapdb/addrs.go @@ -64,6 +64,10 @@ type ( // ScriptKey is a type alias for fetching the script key information. ScriptKey = sqlc.FetchScriptKeyByTweakedKeyRow + + // KeyLocator is a type alias for fetching the key locator information + // for an internal key. + KeyLocator = sqlc.FetchInternalKeyLocatorRow ) // AddrBook is an interface that represents the storage backed needed to create @@ -139,6 +143,10 @@ type AddrBook interface { // corresponding internal key from the database. FetchScriptKeyByTweakedKey(ctx context.Context, tweakedScriptKey []byte) (ScriptKey, error) + + // FetchInternalKeyLocator fetches the key locator for an internal key. + FetchInternalKeyLocator(ctx context.Context, rawKey []byte) (KeyLocator, + error) } // AddrBookTxOptions defines the set of db txn options the AddrBook @@ -1073,6 +1081,42 @@ func (t *TapAddressBook) FetchScriptKey(ctx context.Context, return scriptKey, nil } +// FetchInternalKeyLocator attempts to fetch the key locator information for the +// given raw internal key. If the key cannot be found, then +// ErrInternalKeyNotFound is returned. +func (t *TapAddressBook) FetchInternalKeyLocator(ctx context.Context, + rawKey *btcec.PublicKey) (keychain.KeyLocator, error) { + + var ( + readOpts = NewAddrBookReadTx() + keyLoc keychain.KeyLocator + ) + err := t.db.ExecTx(ctx, &readOpts, func(db AddrBook) error { + dbKey, err := db.FetchInternalKeyLocator( + ctx, rawKey.SerializeCompressed(), + ) + if err != nil { + return err + } + + keyLoc = keychain.KeyLocator{ + Family: keychain.KeyFamily(dbKey.KeyFamily), + Index: uint32(dbKey.KeyIndex), + } + + return nil + }) + switch { + case errors.Is(err, sql.ErrNoRows): + return keyLoc, address.ErrInternalKeyNotFound + + case err != nil: + return keyLoc, err + } + + return keyLoc, nil +} + // A set of compile-time assertions to ensure that TapAddressBook meets the // address.Storage and address.EventStorage interface. var _ address.Storage = (*TapAddressBook)(nil) diff --git a/tapdb/addrs_test.go b/tapdb/addrs_test.go index 94d6790fe..25a3dffb1 100644 --- a/tapdb/addrs_test.go +++ b/tapdb/addrs_test.go @@ -194,6 +194,17 @@ func TestAddressInsertion(t *testing.T) { require.NoError(t, err) require.NotNil(t, scriptKey.RawKey.PubKey) require.False(t, scriptKey.RawKey.IsEmpty()) + require.Equal(t, addr.ScriptKeyTweak.RawKey, scriptKey.RawKey) + + // And the internal key as well. + internalKeyLoc, err := addrBook.FetchInternalKeyLocator( + ctx, &addr.InternalKey, + ) + require.NoError(t, err) + require.False(t, internalKeyLoc.IsEmpty()) + require.Equal( + t, addr.InternalKeyDesc.KeyLocator, internalKeyLoc, + ) } // All addresses should be unmanaged at this point. diff --git a/tapdb/sqlc/assets.sql.go b/tapdb/sqlc/assets.sql.go index a89066174..6c15a89fd 100644 --- a/tapdb/sqlc/assets.sql.go +++ b/tapdb/sqlc/assets.sql.go @@ -1145,6 +1145,24 @@ func (q *Queries) FetchGroupedAssets(ctx context.Context) ([]FetchGroupedAssetsR return items, nil } +const fetchInternalKeyLocator = `-- name: FetchInternalKeyLocator :one +SELECT key_family, key_index +FROM internal_keys +WHERE raw_key = $1 +` + +type FetchInternalKeyLocatorRow struct { + KeyFamily int32 + KeyIndex int32 +} + +func (q *Queries) FetchInternalKeyLocator(ctx context.Context, rawKey []byte) (FetchInternalKeyLocatorRow, error) { + row := q.db.QueryRowContext(ctx, fetchInternalKeyLocator, rawKey) + var i FetchInternalKeyLocatorRow + err := row.Scan(&i.KeyFamily, &i.KeyIndex) + return i, err +} + const fetchManagedUTXO = `-- name: FetchManagedUTXO :one SELECT utxo_id, outpoint, amt_sats, internal_key_id, taproot_asset_root, tapscript_sibling, merkle_root, txn_id, lease_owner, lease_expiry, key_id, raw_key, key_family, key_index FROM managed_utxos utxos diff --git a/tapdb/sqlc/querier.go b/tapdb/sqlc/querier.go index 8730f19c4..15c7b14ac 100644 --- a/tapdb/sqlc/querier.go +++ b/tapdb/sqlc/querier.go @@ -63,6 +63,7 @@ type Querier interface { // Sort and limit to return the genesis ID for initial genesis of the group. FetchGroupByGroupKey(ctx context.Context, groupKey []byte) (FetchGroupByGroupKeyRow, error) FetchGroupedAssets(ctx context.Context) ([]FetchGroupedAssetsRow, error) + FetchInternalKeyLocator(ctx context.Context, rawKey []byte) (FetchInternalKeyLocatorRow, error) FetchManagedUTXO(ctx context.Context, arg FetchManagedUTXOParams) (FetchManagedUTXORow, error) FetchManagedUTXOs(ctx context.Context) ([]FetchManagedUTXOsRow, error) FetchMintingBatch(ctx context.Context, rawKey []byte) (FetchMintingBatchRow, error) diff --git a/tapdb/sqlc/queries/assets.sql b/tapdb/sqlc/queries/assets.sql index 84a68ab5d..516369fdf 100644 --- a/tapdb/sqlc/queries/assets.sql +++ b/tapdb/sqlc/queries/assets.sql @@ -771,6 +771,11 @@ JOIN internal_keys ON script_keys.internal_key_id = internal_keys.key_id WHERE script_keys.tweaked_script_key = $1; +-- name: FetchInternalKeyLocator :one +SELECT key_family, key_index +FROM internal_keys +WHERE raw_key = $1; + -- name: FetchGenesisByAssetID :one SELECT * FROM genesis_info_view diff --git a/tapfreighter/wallet.go b/tapfreighter/wallet.go index aebc75a71..fd045aaa0 100644 --- a/tapfreighter/wallet.go +++ b/tapfreighter/wallet.go @@ -141,6 +141,20 @@ type Wallet interface { // owned asset. The ownership proof consists of a valid witness of a // signed virtual packet that spends the asset fully to the NUMS key. SignOwnershipProof(ownedAsset *asset.Asset) (wire.TxWitness, error) + + // FetchScriptKey attempts to fetch the full tweaked script key struct + // (including the key descriptor) for the given tweaked script key. If + // the key cannot be found, then address.ErrScriptKeyNotFound is + // returned. + FetchScriptKey(ctx context.Context, + tweakedScriptKey *btcec.PublicKey) (*asset.TweakedScriptKey, + error) + + // FetchInternalKeyLocator attempts to fetch the key locator information + // for the given raw internal key. If the key cannot be found, then + // address.ErrInternalKeyNotFound is returned. + FetchInternalKeyLocator(ctx context.Context, + rawKey *btcec.PublicKey) (keychain.KeyLocator, error) } // AddrBook is an interface that provides access to the address book. @@ -151,6 +165,12 @@ type AddrBook interface { FetchScriptKey(ctx context.Context, tweakedScriptKey *btcec.PublicKey) (*asset.TweakedScriptKey, error) + + // FetchInternalKeyLocator attempts to fetch the key locator information + // for the given raw internal key. If the key cannot be found, then + // ErrInternalKeyNotFound is returned. + FetchInternalKeyLocator(ctx context.Context, + rawKey *btcec.PublicKey) (keychain.KeyLocator, error) } // AnchorVTxnsParams holds all the parameters needed to create a BTC level @@ -1494,6 +1514,24 @@ func (f *AssetWallet) SignOwnershipProof( return vPkt.Outputs[0].Asset.PrevWitnesses[0].TxWitness, nil } +// FetchScriptKey attempts to fetch the full tweaked script key struct +// (including the key descriptor) for the given tweaked script key. If the key +// cannot be found, then address.ErrScriptKeyNotFound is returned. +func (f *AssetWallet) FetchScriptKey(ctx context.Context, + tweakedScriptKey *btcec.PublicKey) (*asset.TweakedScriptKey, error) { + + return f.cfg.AddrBook.FetchScriptKey(ctx, tweakedScriptKey) +} + +// FetchInternalKeyLocator attempts to fetch the key locator information for the +// given raw internal key. If the key cannot be found, then +// address.ErrInternalKeyNotFound is returned. +func (f *AssetWallet) FetchInternalKeyLocator(ctx context.Context, + rawKey *btcec.PublicKey) (keychain.KeyLocator, error) { + + return f.cfg.AddrBook.FetchInternalKeyLocator(ctx, rawKey) +} + // inputAnchorPkScript returns the top-level Taproot output script of the input // anchor output as well as the Taproot Asset script root of the output (the // Taproot tweak). diff --git a/taprpc/assetwalletrpc/assetwallet.pb.go b/taprpc/assetwalletrpc/assetwallet.pb.go index 820b400ae..05762e267 100644 --- a/taprpc/assetwalletrpc/assetwallet.pb.go +++ b/taprpc/assetwalletrpc/assetwallet.pb.go @@ -696,6 +696,199 @@ func (x *NextScriptKeyResponse) GetScriptKey() *taprpc.ScriptKey { return nil } +type QueryInternalKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The internal key to look for. This can either be the 32-byte x-only raw + // internal key or the 33-byte raw internal key with the parity byte. + InternalKey []byte `protobuf:"bytes,1,opt,name=internal_key,json=internalKey,proto3" json:"internal_key,omitempty"` +} + +func (x *QueryInternalKeyRequest) Reset() { + *x = QueryInternalKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryInternalKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryInternalKeyRequest) ProtoMessage() {} + +func (x *QueryInternalKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryInternalKeyRequest.ProtoReflect.Descriptor instead. +func (*QueryInternalKeyRequest) Descriptor() ([]byte, []int) { + return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{12} +} + +func (x *QueryInternalKeyRequest) GetInternalKey() []byte { + if x != nil { + return x.InternalKey + } + return nil +} + +type QueryInternalKeyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InternalKey *taprpc.KeyDescriptor `protobuf:"bytes,1,opt,name=internal_key,json=internalKey,proto3" json:"internal_key,omitempty"` +} + +func (x *QueryInternalKeyResponse) Reset() { + *x = QueryInternalKeyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryInternalKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryInternalKeyResponse) ProtoMessage() {} + +func (x *QueryInternalKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryInternalKeyResponse.ProtoReflect.Descriptor instead. +func (*QueryInternalKeyResponse) Descriptor() ([]byte, []int) { + return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{13} +} + +func (x *QueryInternalKeyResponse) GetInternalKey() *taprpc.KeyDescriptor { + if x != nil { + return x.InternalKey + } + return nil +} + +type QueryScriptKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The tweaked script key to look for. This can either be the 32-byte + // x-only tweaked script key or the 33-byte tweaked script key with the + // parity byte. + TweakedScriptKey []byte `protobuf:"bytes,1,opt,name=tweaked_script_key,json=tweakedScriptKey,proto3" json:"tweaked_script_key,omitempty"` +} + +func (x *QueryScriptKeyRequest) Reset() { + *x = QueryScriptKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryScriptKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryScriptKeyRequest) ProtoMessage() {} + +func (x *QueryScriptKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryScriptKeyRequest.ProtoReflect.Descriptor instead. +func (*QueryScriptKeyRequest) Descriptor() ([]byte, []int) { + return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{14} +} + +func (x *QueryScriptKeyRequest) GetTweakedScriptKey() []byte { + if x != nil { + return x.TweakedScriptKey + } + return nil +} + +type QueryScriptKeyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ScriptKey *taprpc.ScriptKey `protobuf:"bytes,1,opt,name=script_key,json=scriptKey,proto3" json:"script_key,omitempty"` +} + +func (x *QueryScriptKeyResponse) Reset() { + *x = QueryScriptKeyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryScriptKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryScriptKeyResponse) ProtoMessage() {} + +func (x *QueryScriptKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryScriptKeyResponse.ProtoReflect.Descriptor instead. +func (*QueryScriptKeyResponse) Descriptor() ([]byte, []int) { + return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{15} +} + +func (x *QueryScriptKeyResponse) GetScriptKey() *taprpc.ScriptKey { + if x != nil { + return x.ScriptKey + } + return nil +} + type ProveAssetOwnershipRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -708,7 +901,7 @@ type ProveAssetOwnershipRequest struct { func (x *ProveAssetOwnershipRequest) Reset() { *x = ProveAssetOwnershipRequest{} if protoimpl.UnsafeEnabled { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[12] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -721,7 +914,7 @@ func (x *ProveAssetOwnershipRequest) String() string { func (*ProveAssetOwnershipRequest) ProtoMessage() {} func (x *ProveAssetOwnershipRequest) ProtoReflect() protoreflect.Message { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[12] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -734,7 +927,7 @@ func (x *ProveAssetOwnershipRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ProveAssetOwnershipRequest.ProtoReflect.Descriptor instead. func (*ProveAssetOwnershipRequest) Descriptor() ([]byte, []int) { - return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{12} + return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{16} } func (x *ProveAssetOwnershipRequest) GetAssetId() []byte { @@ -762,7 +955,7 @@ type ProveAssetOwnershipResponse struct { func (x *ProveAssetOwnershipResponse) Reset() { *x = ProveAssetOwnershipResponse{} if protoimpl.UnsafeEnabled { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[13] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -775,7 +968,7 @@ func (x *ProveAssetOwnershipResponse) String() string { func (*ProveAssetOwnershipResponse) ProtoMessage() {} func (x *ProveAssetOwnershipResponse) ProtoReflect() protoreflect.Message { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[13] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -788,7 +981,7 @@ func (x *ProveAssetOwnershipResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ProveAssetOwnershipResponse.ProtoReflect.Descriptor instead. func (*ProveAssetOwnershipResponse) Descriptor() ([]byte, []int) { - return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{13} + return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{17} } func (x *ProveAssetOwnershipResponse) GetProofWithWitness() []byte { @@ -809,7 +1002,7 @@ type VerifyAssetOwnershipRequest struct { func (x *VerifyAssetOwnershipRequest) Reset() { *x = VerifyAssetOwnershipRequest{} if protoimpl.UnsafeEnabled { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[14] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -822,7 +1015,7 @@ func (x *VerifyAssetOwnershipRequest) String() string { func (*VerifyAssetOwnershipRequest) ProtoMessage() {} func (x *VerifyAssetOwnershipRequest) ProtoReflect() protoreflect.Message { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[14] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -835,7 +1028,7 @@ func (x *VerifyAssetOwnershipRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use VerifyAssetOwnershipRequest.ProtoReflect.Descriptor instead. func (*VerifyAssetOwnershipRequest) Descriptor() ([]byte, []int) { - return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{14} + return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{18} } func (x *VerifyAssetOwnershipRequest) GetProofWithWitness() []byte { @@ -856,7 +1049,7 @@ type VerifyAssetOwnershipResponse struct { func (x *VerifyAssetOwnershipResponse) Reset() { *x = VerifyAssetOwnershipResponse{} if protoimpl.UnsafeEnabled { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[15] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -869,7 +1062,7 @@ func (x *VerifyAssetOwnershipResponse) String() string { func (*VerifyAssetOwnershipResponse) ProtoMessage() {} func (x *VerifyAssetOwnershipResponse) ProtoReflect() protoreflect.Message { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[15] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -882,7 +1075,7 @@ func (x *VerifyAssetOwnershipResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use VerifyAssetOwnershipResponse.ProtoReflect.Descriptor instead. func (*VerifyAssetOwnershipResponse) Descriptor() ([]byte, []int) { - return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{15} + return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{19} } func (x *VerifyAssetOwnershipResponse) GetValidProof() bool { @@ -904,7 +1097,7 @@ type RemoveUTXOLeaseRequest struct { func (x *RemoveUTXOLeaseRequest) Reset() { *x = RemoveUTXOLeaseRequest{} if protoimpl.UnsafeEnabled { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[16] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -917,7 +1110,7 @@ func (x *RemoveUTXOLeaseRequest) String() string { func (*RemoveUTXOLeaseRequest) ProtoMessage() {} func (x *RemoveUTXOLeaseRequest) ProtoReflect() protoreflect.Message { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[16] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -930,7 +1123,7 @@ func (x *RemoveUTXOLeaseRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveUTXOLeaseRequest.ProtoReflect.Descriptor instead. func (*RemoveUTXOLeaseRequest) Descriptor() ([]byte, []int) { - return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{16} + return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{20} } func (x *RemoveUTXOLeaseRequest) GetOutpoint() *OutPoint { @@ -949,7 +1142,7 @@ type RemoveUTXOLeaseResponse struct { func (x *RemoveUTXOLeaseResponse) Reset() { *x = RemoveUTXOLeaseResponse{} if protoimpl.UnsafeEnabled { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[17] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -962,7 +1155,7 @@ func (x *RemoveUTXOLeaseResponse) String() string { func (*RemoveUTXOLeaseResponse) ProtoMessage() {} func (x *RemoveUTXOLeaseResponse) ProtoReflect() protoreflect.Message { - mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[17] + mi := &file_assetwalletrpc_assetwallet_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -975,7 +1168,7 @@ func (x *RemoveUTXOLeaseResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveUTXOLeaseResponse.ProtoReflect.Descriptor instead. func (*RemoveUTXOLeaseResponse) Descriptor() ([]byte, []int) { - return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{17} + return file_assetwalletrpc_assetwallet_proto_rawDescGZIP(), []int{21} } var File_assetwalletrpc_assetwallet_proto protoreflect.FileDescriptor @@ -1053,89 +1246,120 @@ var file_assetwalletrpc_assetwallet_proto_rawDesc = []byte{ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0a, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x61, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x09, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x22, 0x56, 0x0a, 0x1a, 0x50, 0x72, 0x6f, - 0x76, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x73, 0x73, 0x65, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x73, 0x73, 0x65, 0x74, - 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, - 0x79, 0x22, 0x4b, 0x0a, 0x1b, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, - 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x77, - 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x70, 0x72, - 0x6f, 0x6f, 0x66, 0x57, 0x69, 0x74, 0x68, 0x57, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x22, 0x4b, - 0x0a, 0x1b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, - 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, - 0x12, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x77, 0x69, 0x74, 0x6e, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6f, 0x66, - 0x57, 0x69, 0x74, 0x68, 0x57, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x22, 0x3f, 0x0a, 0x1c, 0x56, - 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, - 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x4e, 0x0a, 0x16, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x54, 0x58, 0x4f, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, - 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, - 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x50, 0x6f, 0x69, - 0x6e, 0x74, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x22, 0x19, 0x0a, 0x17, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x54, 0x58, 0x4f, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xba, 0x06, 0x0a, 0x0b, 0x41, 0x73, 0x73, 0x65, - 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x62, 0x0a, 0x0f, 0x46, 0x75, 0x6e, 0x64, 0x56, - 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x12, 0x26, 0x2e, 0x61, 0x73, 0x73, - 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x75, 0x6e, 0x64, - 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, - 0x72, 0x70, 0x63, 0x2e, 0x46, 0x75, 0x6e, 0x64, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, - 0x73, 0x62, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0f, 0x53, - 0x69, 0x67, 0x6e, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x12, 0x26, - 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, - 0x53, 0x69, 0x67, 0x6e, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, - 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x56, 0x69, 0x72, 0x74, - 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x5a, 0x0a, 0x12, 0x41, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, - 0x50, 0x73, 0x62, 0x74, 0x73, 0x12, 0x29, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, - 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x56, 0x69, 0x72, - 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x19, 0x2e, 0x74, 0x61, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x41, 0x73, - 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0f, 0x4e, - 0x65, 0x78, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x12, 0x26, - 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, - 0x4e, 0x65, 0x78, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, - 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x5c, 0x0a, 0x0d, 0x4e, 0x65, 0x78, 0x74, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, - 0x12, 0x24, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, - 0x63, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, - 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x53, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, - 0x13, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, - 0x73, 0x68, 0x69, 0x70, 0x12, 0x2a, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, - 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, - 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2b, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, - 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, - 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, - 0x14, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, - 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x2b, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, - 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x73, 0x73, - 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, - 0x72, 0x70, 0x63, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, - 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x62, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x54, 0x58, 0x4f, 0x4c, 0x65, - 0x61, 0x73, 0x65, 0x12, 0x26, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, - 0x74, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x54, 0x58, 0x4f, 0x4c, - 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x61, 0x73, - 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x55, 0x54, 0x58, 0x4f, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62, 0x73, - 0x2f, 0x74, 0x61, 0x70, 0x72, 0x6f, 0x6f, 0x74, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, - 0x74, 0x61, 0x70, 0x72, 0x70, 0x63, 0x2f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, - 0x65, 0x74, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x22, 0x3c, 0x0a, 0x17, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x22, 0x54, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x61, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x4b, 0x65, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x52, 0x0b, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x22, 0x45, 0x0a, + 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x74, 0x77, 0x65, 0x61, 0x6b, 0x65, + 0x64, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x10, 0x74, 0x77, 0x65, 0x61, 0x6b, 0x65, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x4b, 0x65, 0x79, 0x22, 0x4a, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, + 0x0a, 0x0a, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x61, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x09, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, + 0x22, 0x56, 0x0a, 0x1a, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, + 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, + 0x0a, 0x08, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x61, 0x73, 0x73, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x22, 0x4b, 0x0a, 0x1b, 0x50, 0x72, 0x6f, 0x76, + 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x77, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x57, 0x69, 0x74, 0x68, 0x57, 0x69, + 0x74, 0x6e, 0x65, 0x73, 0x73, 0x22, 0x4b, 0x0a, 0x1b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, + 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x77, 0x69, + 0x74, 0x68, 0x5f, 0x77, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x57, 0x69, 0x74, 0x68, 0x57, 0x69, 0x74, 0x6e, 0x65, + 0x73, 0x73, 0x22, 0x3f, 0x0a, 0x1c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x73, 0x73, 0x65, + 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x6f, + 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x22, 0x4e, 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x54, 0x58, + 0x4f, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, + 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, + 0x2e, 0x4f, 0x75, 0x74, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x22, 0x19, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x54, 0x58, + 0x4f, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x82, + 0x08, 0x0a, 0x0b, 0x41, 0x73, 0x73, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x62, + 0x0a, 0x0f, 0x46, 0x75, 0x6e, 0x64, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, + 0x74, 0x12, 0x26, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, + 0x70, 0x63, 0x2e, 0x46, 0x75, 0x6e, 0x64, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, + 0x62, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x61, 0x73, 0x73, 0x65, + 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x75, 0x6e, 0x64, 0x56, + 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0f, 0x53, 0x69, 0x67, 0x6e, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, + 0x6c, 0x50, 0x73, 0x62, 0x74, 0x12, 0x26, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, + 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x56, 0x69, 0x72, 0x74, 0x75, + 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, + 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x12, 0x41, 0x6e, 0x63, 0x68, 0x6f, 0x72, + 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x73, 0x12, 0x29, 0x2e, 0x61, + 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x6e, + 0x63, 0x68, 0x6f, 0x72, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x73, 0x62, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x74, 0x61, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0f, 0x4e, 0x65, 0x78, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, + 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, + 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4e, + 0x65, 0x78, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0d, 0x4e, 0x65, 0x78, 0x74, 0x53, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x24, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, + 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x53, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, + 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x4e, + 0x65, 0x78, 0x74, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x12, 0x27, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, + 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, + 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x28, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, + 0x70, 0x63, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x2e, + 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, + 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, 0x13, + 0x50, 0x72, 0x6f, 0x76, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, + 0x68, 0x69, 0x70, 0x12, 0x2a, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, + 0x74, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, + 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2b, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, + 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x14, + 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x73, 0x68, 0x69, 0x70, 0x12, 0x2b, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, + 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x73, 0x73, 0x65, + 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2c, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, + 0x70, 0x63, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4f, 0x77, + 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x62, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x54, 0x58, 0x4f, 0x4c, 0x65, 0x61, + 0x73, 0x65, 0x12, 0x26, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, + 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x54, 0x58, 0x4f, 0x4c, 0x65, + 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x61, 0x73, 0x73, + 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x55, 0x54, 0x58, 0x4f, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62, 0x73, 0x2f, + 0x74, 0x61, 0x70, 0x72, 0x6f, 0x6f, 0x74, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x74, + 0x61, 0x70, 0x72, 0x70, 0x63, 0x2f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x77, 0x61, 0x6c, 0x6c, 0x65, + 0x74, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1150,7 +1374,7 @@ func file_assetwalletrpc_assetwallet_proto_rawDescGZIP() []byte { return file_assetwalletrpc_assetwallet_proto_rawDescData } -var file_assetwalletrpc_assetwallet_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_assetwalletrpc_assetwallet_proto_msgTypes = make([]protoimpl.MessageInfo, 23) var file_assetwalletrpc_assetwallet_proto_goTypes = []interface{}{ (*FundVirtualPsbtRequest)(nil), // 0: assetwalletrpc.FundVirtualPsbtRequest (*FundVirtualPsbtResponse)(nil), // 1: assetwalletrpc.FundVirtualPsbtResponse @@ -1164,46 +1388,56 @@ var file_assetwalletrpc_assetwallet_proto_goTypes = []interface{}{ (*NextInternalKeyResponse)(nil), // 9: assetwalletrpc.NextInternalKeyResponse (*NextScriptKeyRequest)(nil), // 10: assetwalletrpc.NextScriptKeyRequest (*NextScriptKeyResponse)(nil), // 11: assetwalletrpc.NextScriptKeyResponse - (*ProveAssetOwnershipRequest)(nil), // 12: assetwalletrpc.ProveAssetOwnershipRequest - (*ProveAssetOwnershipResponse)(nil), // 13: assetwalletrpc.ProveAssetOwnershipResponse - (*VerifyAssetOwnershipRequest)(nil), // 14: assetwalletrpc.VerifyAssetOwnershipRequest - (*VerifyAssetOwnershipResponse)(nil), // 15: assetwalletrpc.VerifyAssetOwnershipResponse - (*RemoveUTXOLeaseRequest)(nil), // 16: assetwalletrpc.RemoveUTXOLeaseRequest - (*RemoveUTXOLeaseResponse)(nil), // 17: assetwalletrpc.RemoveUTXOLeaseResponse - nil, // 18: assetwalletrpc.TxTemplate.RecipientsEntry - (*taprpc.KeyDescriptor)(nil), // 19: taprpc.KeyDescriptor - (*taprpc.ScriptKey)(nil), // 20: taprpc.ScriptKey - (*taprpc.SendAssetResponse)(nil), // 21: taprpc.SendAssetResponse + (*QueryInternalKeyRequest)(nil), // 12: assetwalletrpc.QueryInternalKeyRequest + (*QueryInternalKeyResponse)(nil), // 13: assetwalletrpc.QueryInternalKeyResponse + (*QueryScriptKeyRequest)(nil), // 14: assetwalletrpc.QueryScriptKeyRequest + (*QueryScriptKeyResponse)(nil), // 15: assetwalletrpc.QueryScriptKeyResponse + (*ProveAssetOwnershipRequest)(nil), // 16: assetwalletrpc.ProveAssetOwnershipRequest + (*ProveAssetOwnershipResponse)(nil), // 17: assetwalletrpc.ProveAssetOwnershipResponse + (*VerifyAssetOwnershipRequest)(nil), // 18: assetwalletrpc.VerifyAssetOwnershipRequest + (*VerifyAssetOwnershipResponse)(nil), // 19: assetwalletrpc.VerifyAssetOwnershipResponse + (*RemoveUTXOLeaseRequest)(nil), // 20: assetwalletrpc.RemoveUTXOLeaseRequest + (*RemoveUTXOLeaseResponse)(nil), // 21: assetwalletrpc.RemoveUTXOLeaseResponse + nil, // 22: assetwalletrpc.TxTemplate.RecipientsEntry + (*taprpc.KeyDescriptor)(nil), // 23: taprpc.KeyDescriptor + (*taprpc.ScriptKey)(nil), // 24: taprpc.ScriptKey + (*taprpc.SendAssetResponse)(nil), // 25: taprpc.SendAssetResponse } var file_assetwalletrpc_assetwallet_proto_depIdxs = []int32{ 2, // 0: assetwalletrpc.FundVirtualPsbtRequest.raw:type_name -> assetwalletrpc.TxTemplate 3, // 1: assetwalletrpc.TxTemplate.inputs:type_name -> assetwalletrpc.PrevId - 18, // 2: assetwalletrpc.TxTemplate.recipients:type_name -> assetwalletrpc.TxTemplate.RecipientsEntry + 22, // 2: assetwalletrpc.TxTemplate.recipients:type_name -> assetwalletrpc.TxTemplate.RecipientsEntry 4, // 3: assetwalletrpc.PrevId.outpoint:type_name -> assetwalletrpc.OutPoint - 19, // 4: assetwalletrpc.NextInternalKeyResponse.internal_key:type_name -> taprpc.KeyDescriptor - 20, // 5: assetwalletrpc.NextScriptKeyResponse.script_key:type_name -> taprpc.ScriptKey - 4, // 6: assetwalletrpc.RemoveUTXOLeaseRequest.outpoint:type_name -> assetwalletrpc.OutPoint - 0, // 7: assetwalletrpc.AssetWallet.FundVirtualPsbt:input_type -> assetwalletrpc.FundVirtualPsbtRequest - 5, // 8: assetwalletrpc.AssetWallet.SignVirtualPsbt:input_type -> assetwalletrpc.SignVirtualPsbtRequest - 7, // 9: assetwalletrpc.AssetWallet.AnchorVirtualPsbts:input_type -> assetwalletrpc.AnchorVirtualPsbtsRequest - 8, // 10: assetwalletrpc.AssetWallet.NextInternalKey:input_type -> assetwalletrpc.NextInternalKeyRequest - 10, // 11: assetwalletrpc.AssetWallet.NextScriptKey:input_type -> assetwalletrpc.NextScriptKeyRequest - 12, // 12: assetwalletrpc.AssetWallet.ProveAssetOwnership:input_type -> assetwalletrpc.ProveAssetOwnershipRequest - 14, // 13: assetwalletrpc.AssetWallet.VerifyAssetOwnership:input_type -> assetwalletrpc.VerifyAssetOwnershipRequest - 16, // 14: assetwalletrpc.AssetWallet.RemoveUTXOLease:input_type -> assetwalletrpc.RemoveUTXOLeaseRequest - 1, // 15: assetwalletrpc.AssetWallet.FundVirtualPsbt:output_type -> assetwalletrpc.FundVirtualPsbtResponse - 6, // 16: assetwalletrpc.AssetWallet.SignVirtualPsbt:output_type -> assetwalletrpc.SignVirtualPsbtResponse - 21, // 17: assetwalletrpc.AssetWallet.AnchorVirtualPsbts:output_type -> taprpc.SendAssetResponse - 9, // 18: assetwalletrpc.AssetWallet.NextInternalKey:output_type -> assetwalletrpc.NextInternalKeyResponse - 11, // 19: assetwalletrpc.AssetWallet.NextScriptKey:output_type -> assetwalletrpc.NextScriptKeyResponse - 13, // 20: assetwalletrpc.AssetWallet.ProveAssetOwnership:output_type -> assetwalletrpc.ProveAssetOwnershipResponse - 15, // 21: assetwalletrpc.AssetWallet.VerifyAssetOwnership:output_type -> assetwalletrpc.VerifyAssetOwnershipResponse - 17, // 22: assetwalletrpc.AssetWallet.RemoveUTXOLease:output_type -> assetwalletrpc.RemoveUTXOLeaseResponse - 15, // [15:23] is the sub-list for method output_type - 7, // [7:15] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 23, // 4: assetwalletrpc.NextInternalKeyResponse.internal_key:type_name -> taprpc.KeyDescriptor + 24, // 5: assetwalletrpc.NextScriptKeyResponse.script_key:type_name -> taprpc.ScriptKey + 23, // 6: assetwalletrpc.QueryInternalKeyResponse.internal_key:type_name -> taprpc.KeyDescriptor + 24, // 7: assetwalletrpc.QueryScriptKeyResponse.script_key:type_name -> taprpc.ScriptKey + 4, // 8: assetwalletrpc.RemoveUTXOLeaseRequest.outpoint:type_name -> assetwalletrpc.OutPoint + 0, // 9: assetwalletrpc.AssetWallet.FundVirtualPsbt:input_type -> assetwalletrpc.FundVirtualPsbtRequest + 5, // 10: assetwalletrpc.AssetWallet.SignVirtualPsbt:input_type -> assetwalletrpc.SignVirtualPsbtRequest + 7, // 11: assetwalletrpc.AssetWallet.AnchorVirtualPsbts:input_type -> assetwalletrpc.AnchorVirtualPsbtsRequest + 8, // 12: assetwalletrpc.AssetWallet.NextInternalKey:input_type -> assetwalletrpc.NextInternalKeyRequest + 10, // 13: assetwalletrpc.AssetWallet.NextScriptKey:input_type -> assetwalletrpc.NextScriptKeyRequest + 12, // 14: assetwalletrpc.AssetWallet.QueryInternalKey:input_type -> assetwalletrpc.QueryInternalKeyRequest + 14, // 15: assetwalletrpc.AssetWallet.QueryScriptKey:input_type -> assetwalletrpc.QueryScriptKeyRequest + 16, // 16: assetwalletrpc.AssetWallet.ProveAssetOwnership:input_type -> assetwalletrpc.ProveAssetOwnershipRequest + 18, // 17: assetwalletrpc.AssetWallet.VerifyAssetOwnership:input_type -> assetwalletrpc.VerifyAssetOwnershipRequest + 20, // 18: assetwalletrpc.AssetWallet.RemoveUTXOLease:input_type -> assetwalletrpc.RemoveUTXOLeaseRequest + 1, // 19: assetwalletrpc.AssetWallet.FundVirtualPsbt:output_type -> assetwalletrpc.FundVirtualPsbtResponse + 6, // 20: assetwalletrpc.AssetWallet.SignVirtualPsbt:output_type -> assetwalletrpc.SignVirtualPsbtResponse + 25, // 21: assetwalletrpc.AssetWallet.AnchorVirtualPsbts:output_type -> taprpc.SendAssetResponse + 9, // 22: assetwalletrpc.AssetWallet.NextInternalKey:output_type -> assetwalletrpc.NextInternalKeyResponse + 11, // 23: assetwalletrpc.AssetWallet.NextScriptKey:output_type -> assetwalletrpc.NextScriptKeyResponse + 13, // 24: assetwalletrpc.AssetWallet.QueryInternalKey:output_type -> assetwalletrpc.QueryInternalKeyResponse + 15, // 25: assetwalletrpc.AssetWallet.QueryScriptKey:output_type -> assetwalletrpc.QueryScriptKeyResponse + 17, // 26: assetwalletrpc.AssetWallet.ProveAssetOwnership:output_type -> assetwalletrpc.ProveAssetOwnershipResponse + 19, // 27: assetwalletrpc.AssetWallet.VerifyAssetOwnership:output_type -> assetwalletrpc.VerifyAssetOwnershipResponse + 21, // 28: assetwalletrpc.AssetWallet.RemoveUTXOLease:output_type -> assetwalletrpc.RemoveUTXOLeaseResponse + 19, // [19:29] is the sub-list for method output_type + 9, // [9:19] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_assetwalletrpc_assetwallet_proto_init() } @@ -1357,7 +1591,7 @@ func file_assetwalletrpc_assetwallet_proto_init() { } } file_assetwalletrpc_assetwallet_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProveAssetOwnershipRequest); i { + switch v := v.(*QueryInternalKeyRequest); i { case 0: return &v.state case 1: @@ -1369,7 +1603,7 @@ func file_assetwalletrpc_assetwallet_proto_init() { } } file_assetwalletrpc_assetwallet_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProveAssetOwnershipResponse); i { + switch v := v.(*QueryInternalKeyResponse); i { case 0: return &v.state case 1: @@ -1381,7 +1615,7 @@ func file_assetwalletrpc_assetwallet_proto_init() { } } file_assetwalletrpc_assetwallet_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VerifyAssetOwnershipRequest); i { + switch v := v.(*QueryScriptKeyRequest); i { case 0: return &v.state case 1: @@ -1393,7 +1627,7 @@ func file_assetwalletrpc_assetwallet_proto_init() { } } file_assetwalletrpc_assetwallet_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VerifyAssetOwnershipResponse); i { + switch v := v.(*QueryScriptKeyResponse); i { case 0: return &v.state case 1: @@ -1405,7 +1639,7 @@ func file_assetwalletrpc_assetwallet_proto_init() { } } file_assetwalletrpc_assetwallet_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveUTXOLeaseRequest); i { + switch v := v.(*ProveAssetOwnershipRequest); i { case 0: return &v.state case 1: @@ -1417,6 +1651,54 @@ func file_assetwalletrpc_assetwallet_proto_init() { } } file_assetwalletrpc_assetwallet_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProveAssetOwnershipResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_assetwalletrpc_assetwallet_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifyAssetOwnershipRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_assetwalletrpc_assetwallet_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifyAssetOwnershipResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_assetwalletrpc_assetwallet_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveUTXOLeaseRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_assetwalletrpc_assetwallet_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RemoveUTXOLeaseResponse); i { case 0: return &v.state @@ -1439,7 +1721,7 @@ func file_assetwalletrpc_assetwallet_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_assetwalletrpc_assetwallet_proto_rawDesc, NumEnums: 0, - NumMessages: 19, + NumMessages: 23, NumExtensions: 0, NumServices: 1, }, diff --git a/taprpc/assetwalletrpc/assetwallet.pb.gw.go b/taprpc/assetwalletrpc/assetwallet.pb.gw.go index 2f2c1b809..9abd65fba 100644 --- a/taprpc/assetwalletrpc/assetwallet.pb.gw.go +++ b/taprpc/assetwalletrpc/assetwallet.pb.gw.go @@ -201,6 +201,110 @@ func local_request_AssetWallet_NextScriptKey_0(ctx context.Context, marshaler ru } +func request_AssetWallet_QueryInternalKey_0(ctx context.Context, marshaler runtime.Marshaler, client AssetWalletClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInternalKeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["internal_key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "internal_key") + } + + protoReq.InternalKey, err = runtime.Bytes(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "internal_key", err) + } + + msg, err := client.QueryInternalKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_AssetWallet_QueryInternalKey_0(ctx context.Context, marshaler runtime.Marshaler, server AssetWalletServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInternalKeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["internal_key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "internal_key") + } + + protoReq.InternalKey, err = runtime.Bytes(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "internal_key", err) + } + + msg, err := server.QueryInternalKey(ctx, &protoReq) + return msg, metadata, err + +} + +func request_AssetWallet_QueryScriptKey_0(ctx context.Context, marshaler runtime.Marshaler, client AssetWalletClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryScriptKeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["tweaked_script_key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "tweaked_script_key") + } + + protoReq.TweakedScriptKey, err = runtime.Bytes(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "tweaked_script_key", err) + } + + msg, err := client.QueryScriptKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_AssetWallet_QueryScriptKey_0(ctx context.Context, marshaler runtime.Marshaler, server AssetWalletServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryScriptKeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["tweaked_script_key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "tweaked_script_key") + } + + protoReq.TweakedScriptKey, err = runtime.Bytes(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "tweaked_script_key", err) + } + + msg, err := server.QueryScriptKey(ctx, &protoReq) + return msg, metadata, err + +} + func request_AssetWallet_ProveAssetOwnership_0(ctx context.Context, marshaler runtime.Marshaler, client AssetWalletClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ProveAssetOwnershipRequest var metadata runtime.ServerMetadata @@ -424,6 +528,52 @@ func RegisterAssetWalletHandlerServer(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("GET", pattern_AssetWallet_QueryInternalKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/assetwalletrpc.AssetWallet/QueryInternalKey", runtime.WithHTTPPathPattern("/v1/taproot-assets/wallet/internal-key/{internal_key}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_AssetWallet_QueryInternalKey_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_AssetWallet_QueryInternalKey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_AssetWallet_QueryScriptKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/assetwalletrpc.AssetWallet/QueryScriptKey", runtime.WithHTTPPathPattern("/v1/taproot-assets/wallet/script-key/{tweaked_script_key}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_AssetWallet_QueryScriptKey_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_AssetWallet_QueryScriptKey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_AssetWallet_ProveAssetOwnership_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -634,6 +784,46 @@ func RegisterAssetWalletHandlerClient(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("GET", pattern_AssetWallet_QueryInternalKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/assetwalletrpc.AssetWallet/QueryInternalKey", runtime.WithHTTPPathPattern("/v1/taproot-assets/wallet/internal-key/{internal_key}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_AssetWallet_QueryInternalKey_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_AssetWallet_QueryInternalKey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_AssetWallet_QueryScriptKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/assetwalletrpc.AssetWallet/QueryScriptKey", runtime.WithHTTPPathPattern("/v1/taproot-assets/wallet/script-key/{tweaked_script_key}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_AssetWallet_QueryScriptKey_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_AssetWallet_QueryScriptKey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_AssetWallet_ProveAssetOwnership_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -708,6 +898,10 @@ var ( pattern_AssetWallet_NextScriptKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "taproot-assets", "wallet", "script-key", "next"}, "")) + pattern_AssetWallet_QueryInternalKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "taproot-assets", "wallet", "internal-key", "internal_key"}, "")) + + pattern_AssetWallet_QueryScriptKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "taproot-assets", "wallet", "script-key", "tweaked_script_key"}, "")) + pattern_AssetWallet_ProveAssetOwnership_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "taproot-assets", "wallet", "ownership", "prove"}, "")) pattern_AssetWallet_VerifyAssetOwnership_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "taproot-assets", "wallet", "ownership", "verify"}, "")) @@ -726,6 +920,10 @@ var ( forward_AssetWallet_NextScriptKey_0 = runtime.ForwardResponseMessage + forward_AssetWallet_QueryInternalKey_0 = runtime.ForwardResponseMessage + + forward_AssetWallet_QueryScriptKey_0 = runtime.ForwardResponseMessage + forward_AssetWallet_ProveAssetOwnership_0 = runtime.ForwardResponseMessage forward_AssetWallet_VerifyAssetOwnership_0 = runtime.ForwardResponseMessage diff --git a/taprpc/assetwalletrpc/assetwallet.pb.json.go b/taprpc/assetwalletrpc/assetwallet.pb.json.go index 71f9bf20d..c5c17fbc4 100644 --- a/taprpc/assetwalletrpc/assetwallet.pb.json.go +++ b/taprpc/assetwalletrpc/assetwallet.pb.json.go @@ -146,6 +146,56 @@ func RegisterAssetWalletJSONCallbacks(registry map[string]func(ctx context.Conte callback(string(respBytes), nil) } + registry["assetwalletrpc.AssetWallet.QueryInternalKey"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &QueryInternalKeyRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewAssetWalletClient(conn) + resp, err := client.QueryInternalKey(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } + + registry["assetwalletrpc.AssetWallet.QueryScriptKey"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &QueryScriptKeyRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewAssetWalletClient(conn) + resp, err := client.QueryScriptKey(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } + registry["assetwalletrpc.AssetWallet.ProveAssetOwnership"] = func(ctx context.Context, conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { diff --git a/taprpc/assetwalletrpc/assetwallet.proto b/taprpc/assetwalletrpc/assetwallet.proto index 5a0709655..d0a092788 100644 --- a/taprpc/assetwalletrpc/assetwallet.proto +++ b/taprpc/assetwalletrpc/assetwallet.proto @@ -49,6 +49,18 @@ service AssetWallet { */ rpc NextScriptKey (NextScriptKeyRequest) returns (NextScriptKeyResponse); + /* + QueryInternalKey returns the key descriptor for the given internal key. + */ + rpc QueryInternalKey (QueryInternalKeyRequest) + returns (QueryInternalKeyResponse); + + /* + QueryScriptKey returns the full script key descriptor for the given tweaked + script key. + */ + rpc QueryScriptKey (QueryScriptKeyRequest) returns (QueryScriptKeyResponse); + /* tapcli: `proofs proveownership` ProveAssetOwnership creates an ownership proof embedded in an asset transition proof. That ownership proof is a signed virtual transaction @@ -196,6 +208,27 @@ message NextScriptKeyResponse { taprpc.ScriptKey script_key = 1; } +message QueryInternalKeyRequest { + // The internal key to look for. This can either be the 32-byte x-only raw + // internal key or the 33-byte raw internal key with the parity byte. + bytes internal_key = 1; +} + +message QueryInternalKeyResponse { + taprpc.KeyDescriptor internal_key = 1; +} + +message QueryScriptKeyRequest { + // The tweaked script key to look for. This can either be the 32-byte + // x-only tweaked script key or the 33-byte tweaked script key with the + // parity byte. + bytes tweaked_script_key = 1; +} + +message QueryScriptKeyResponse { + taprpc.ScriptKey script_key = 1; +} + message ProveAssetOwnershipRequest { bytes asset_id = 1; diff --git a/taprpc/assetwalletrpc/assetwallet.swagger.json b/taprpc/assetwalletrpc/assetwallet.swagger.json index 4d778587a..54792917a 100644 --- a/taprpc/assetwalletrpc/assetwallet.swagger.json +++ b/taprpc/assetwalletrpc/assetwallet.swagger.json @@ -49,6 +49,39 @@ ] } }, + "/v1/taproot-assets/wallet/internal-key/{internal_key}": { + "get": { + "summary": "QueryInternalKey returns the key descriptor for the given internal key.", + "operationId": "AssetWallet_QueryInternalKey", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/assetwalletrpcQueryInternalKeyResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "internal_key", + "description": "The internal key to look for. This can either be the 32-byte x-only raw\ninternal key or the 33-byte raw internal key with the parity byte.", + "in": "path", + "required": true, + "type": "string", + "format": "byte" + } + ], + "tags": [ + "AssetWallet" + ] + } + }, "/v1/taproot-assets/wallet/ownership/prove": { "post": { "summary": "tapcli: `proofs proveownership`\nProveAssetOwnership creates an ownership proof embedded in an asset\ntransition proof. That ownership proof is a signed virtual transaction\nspending the asset with a valid witness to prove the prover owns the keys\nthat can spend the asset.", @@ -148,6 +181,39 @@ ] } }, + "/v1/taproot-assets/wallet/script-key/{tweaked_script_key}": { + "get": { + "summary": "QueryScriptKey returns the full script key descriptor for the given tweaked\nscript key.", + "operationId": "AssetWallet_QueryScriptKey", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/assetwalletrpcQueryScriptKeyResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "tweaked_script_key", + "description": "The tweaked script key to look for. This can either be the 32-byte\nx-only tweaked script key or the 33-byte tweaked script key with the\nparity byte.", + "in": "path", + "required": true, + "type": "string", + "format": "byte" + } + ], + "tags": [ + "AssetWallet" + ] + } + }, "/v1/taproot-assets/wallet/utxo-lease/delete": { "post": { "summary": "RemoveUTXOLease removes the lease/lock/reservation of the given managed\nUTXO.", @@ -415,6 +481,22 @@ } } }, + "assetwalletrpcQueryInternalKeyResponse": { + "type": "object", + "properties": { + "internal_key": { + "$ref": "#/definitions/taprpcKeyDescriptor" + } + } + }, + "assetwalletrpcQueryScriptKeyResponse": { + "type": "object", + "properties": { + "script_key": { + "$ref": "#/definitions/taprpcScriptKey" + } + } + }, "assetwalletrpcRemoveUTXOLeaseRequest": { "type": "object", "properties": { diff --git a/taprpc/assetwalletrpc/assetwallet.yaml b/taprpc/assetwalletrpc/assetwallet.yaml index 948b1e2c5..74426670a 100644 --- a/taprpc/assetwalletrpc/assetwallet.yaml +++ b/taprpc/assetwalletrpc/assetwallet.yaml @@ -23,6 +23,12 @@ http: post: "/v1/taproot-assets/wallet/script-key/next" body: "*" + - selector: assetwalletrpc.AssetWallet.QueryInternalKey + get: "/v1/taproot-assets/wallet/internal-key/{internal_key}" + + - selector: assetwalletrpc.AssetWallet.QueryScriptKey + get: "/v1/taproot-assets/wallet/script-key/{tweaked_script_key}" + - selector: assetwalletrpc.AssetWallet.ProveAssetOwnership post: "/v1/taproot-assets/wallet/ownership/prove" body: "*" diff --git a/taprpc/assetwalletrpc/assetwallet_grpc.pb.go b/taprpc/assetwalletrpc/assetwallet_grpc.pb.go index 394d19839..c49a0ebcf 100644 --- a/taprpc/assetwalletrpc/assetwallet_grpc.pb.go +++ b/taprpc/assetwalletrpc/assetwallet_grpc.pb.go @@ -42,6 +42,11 @@ type AssetWalletClient interface { // key) and stores them both in the database to make sure they are identified // as local keys later on when importing proofs. NextScriptKey(ctx context.Context, in *NextScriptKeyRequest, opts ...grpc.CallOption) (*NextScriptKeyResponse, error) + // QueryInternalKey returns the key descriptor for the given internal key. + QueryInternalKey(ctx context.Context, in *QueryInternalKeyRequest, opts ...grpc.CallOption) (*QueryInternalKeyResponse, error) + // QueryScriptKey returns the full script key descriptor for the given tweaked + // script key. + QueryScriptKey(ctx context.Context, in *QueryScriptKeyRequest, opts ...grpc.CallOption) (*QueryScriptKeyResponse, error) // tapcli: `proofs proveownership` // ProveAssetOwnership creates an ownership proof embedded in an asset // transition proof. That ownership proof is a signed virtual transaction @@ -110,6 +115,24 @@ func (c *assetWalletClient) NextScriptKey(ctx context.Context, in *NextScriptKey return out, nil } +func (c *assetWalletClient) QueryInternalKey(ctx context.Context, in *QueryInternalKeyRequest, opts ...grpc.CallOption) (*QueryInternalKeyResponse, error) { + out := new(QueryInternalKeyResponse) + err := c.cc.Invoke(ctx, "/assetwalletrpc.AssetWallet/QueryInternalKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *assetWalletClient) QueryScriptKey(ctx context.Context, in *QueryScriptKeyRequest, opts ...grpc.CallOption) (*QueryScriptKeyResponse, error) { + out := new(QueryScriptKeyResponse) + err := c.cc.Invoke(ctx, "/assetwalletrpc.AssetWallet/QueryScriptKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *assetWalletClient) ProveAssetOwnership(ctx context.Context, in *ProveAssetOwnershipRequest, opts ...grpc.CallOption) (*ProveAssetOwnershipResponse, error) { out := new(ProveAssetOwnershipResponse) err := c.cc.Invoke(ctx, "/assetwalletrpc.AssetWallet/ProveAssetOwnership", in, out, opts...) @@ -164,6 +187,11 @@ type AssetWalletServer interface { // key) and stores them both in the database to make sure they are identified // as local keys later on when importing proofs. NextScriptKey(context.Context, *NextScriptKeyRequest) (*NextScriptKeyResponse, error) + // QueryInternalKey returns the key descriptor for the given internal key. + QueryInternalKey(context.Context, *QueryInternalKeyRequest) (*QueryInternalKeyResponse, error) + // QueryScriptKey returns the full script key descriptor for the given tweaked + // script key. + QueryScriptKey(context.Context, *QueryScriptKeyRequest) (*QueryScriptKeyResponse, error) // tapcli: `proofs proveownership` // ProveAssetOwnership creates an ownership proof embedded in an asset // transition proof. That ownership proof is a signed virtual transaction @@ -199,6 +227,12 @@ func (UnimplementedAssetWalletServer) NextInternalKey(context.Context, *NextInte func (UnimplementedAssetWalletServer) NextScriptKey(context.Context, *NextScriptKeyRequest) (*NextScriptKeyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NextScriptKey not implemented") } +func (UnimplementedAssetWalletServer) QueryInternalKey(context.Context, *QueryInternalKeyRequest) (*QueryInternalKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryInternalKey not implemented") +} +func (UnimplementedAssetWalletServer) QueryScriptKey(context.Context, *QueryScriptKeyRequest) (*QueryScriptKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryScriptKey not implemented") +} func (UnimplementedAssetWalletServer) ProveAssetOwnership(context.Context, *ProveAssetOwnershipRequest) (*ProveAssetOwnershipResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ProveAssetOwnership not implemented") } @@ -311,6 +345,42 @@ func _AssetWallet_NextScriptKey_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _AssetWallet_QueryInternalKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryInternalKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AssetWalletServer).QueryInternalKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/assetwalletrpc.AssetWallet/QueryInternalKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AssetWalletServer).QueryInternalKey(ctx, req.(*QueryInternalKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AssetWallet_QueryScriptKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryScriptKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AssetWalletServer).QueryScriptKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/assetwalletrpc.AssetWallet/QueryScriptKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AssetWalletServer).QueryScriptKey(ctx, req.(*QueryScriptKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _AssetWallet_ProveAssetOwnership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ProveAssetOwnershipRequest) if err := dec(in); err != nil { @@ -392,6 +462,14 @@ var AssetWallet_ServiceDesc = grpc.ServiceDesc{ MethodName: "NextScriptKey", Handler: _AssetWallet_NextScriptKey_Handler, }, + { + MethodName: "QueryInternalKey", + Handler: _AssetWallet_QueryInternalKey_Handler, + }, + { + MethodName: "QueryScriptKey", + Handler: _AssetWallet_QueryScriptKey_Handler, + }, { MethodName: "ProveAssetOwnership", Handler: _AssetWallet_ProveAssetOwnership_Handler, diff --git a/tapscript/tx.go b/tapscript/tx.go index db029aab6..5f63a4056 100644 --- a/tapscript/tx.go +++ b/tapscript/tx.go @@ -17,7 +17,6 @@ import ( "github.com/lightninglabs/taproot-assets/mssmt" "github.com/lightninglabs/taproot-assets/tappsbt" "github.com/lightningnetwork/lnd/input" - "github.com/lightningnetwork/lnd/keychain" ) var ( @@ -320,7 +319,14 @@ func CreateTaprootSignature(vIn *tappsbt.VInput, virtualTx *wire.MsgTx, "one at a time") } - derivation := vIn.TaprootBip32Derivation[0] + derivation := vIn.Bip32Derivation[0] + trDerivation := vIn.TaprootBip32Derivation[0] + + keyDesc, err := tappsbt.KeyDescFromBip32Derivation(derivation) + if err != nil { + return nil, fmt.Errorf("error identifying input asset key "+ + "descriptor from BIP-0032 derivation: %w", err) + } // Compute a virtual prevOut from the input asset for the signer. prevOut, err := InputAssetPrevOut(*vIn.Asset()) @@ -331,9 +337,7 @@ func CreateTaprootSignature(vIn *tappsbt.VInput, virtualTx *wire.MsgTx, // Start with a default sign descriptor and the BIP-0086 sign method // then adjust depending on the input parameters. spendDesc := lndclient.SignDescriptor{ - KeyDesc: keychain.KeyDescriptor{ - PubKey: vIn.Asset().ScriptKey.RawKey.PubKey, - }, + KeyDesc: keyDesc, SignMethod: input.TaprootKeySpendBIP0086SignMethod, Output: prevOut, HashType: vIn.SighashType, @@ -350,7 +354,7 @@ func CreateTaprootSignature(vIn *tappsbt.VInput, virtualTx *wire.MsgTx, // No leaf hash means we're not signing a specific script, so this is // the key spend path with a script root. case len(vIn.TaprootMerkleRoot) == sha256.Size && - len(derivation.LeafHashes) == 0: + len(trDerivation.LeafHashes) == 0: spendDesc.SignMethod = input.TaprootKeySpendSignMethod spendDesc.TapTweak = vIn.TaprootMerkleRoot @@ -359,7 +363,7 @@ func CreateTaprootSignature(vIn *tappsbt.VInput, virtualTx *wire.MsgTx, // script. There can be other scripts in the tree, but we only support // creating a signature for a single one at a time. case len(vIn.TaprootMerkleRoot) == sha256.Size && - len(derivation.LeafHashes) == 1: + len(trDerivation.LeafHashes) == 1: // If we're supposed to be signing for a leaf hash, we also // expect the leaf script that hashes to that hash in the @@ -376,7 +380,7 @@ func CreateTaprootSignature(vIn *tappsbt.VInput, virtualTx *wire.MsgTx, Script: leafScript.Script, } leafHash := leaf.TapHash() - if !bytes.Equal(leafHash[:], derivation.LeafHashes[0]) { + if !bytes.Equal(leafHash[:], trDerivation.LeafHashes[0]) { return nil, fmt.Errorf("specified leaf hash in " + "taproot BIP-0032 derivation but " + "corresponding taproot leaf script was not " + diff --git a/tapscript/util.go b/tapscript/util.go index 742700641..b4287c9ce 100644 --- a/tapscript/util.go +++ b/tapscript/util.go @@ -36,6 +36,18 @@ func PayToTaprootScript(taprootKey *btcec.PublicKey) ([]byte, error) { Script() } +// FlipParity turns the given public key from even to odd parity or vice versa. +func FlipParity(pubKey *btcec.PublicKey) *btcec.PublicKey { + keyCompressed := pubKey.SerializeCompressed() + keyCompressed[0] ^= 1 + + // We already know the given key is a valid point on the curve, so we + // don't need to check the error here as the flipped key will also be + // valid. + flippedKey, _ := btcec.ParsePubKey(keyCompressed) + return flippedKey +} + // EstimateFee provides a worst-case fee and vsize estimate for a transaction // built from the given inputs and outputs. This mirrors the fee estimation // implemented in btcwallet/wallet/txauthor/author.go:NewUnsignedTransaction()