rpcutils

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 25 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

Shorthand for the asset transfer output proof delivery status enum.

nolint: lll

Functions

func IsAssetBtc

func IsAssetBtc(assetSpecifier *priceoraclerpc.AssetSpecifier) bool

IsAssetBtc is a helper function that returns true if the given asset specifier represents BTC, and false otherwise.

func MarshalAsset

func MarshalAsset(ctx context.Context, a *asset.Asset,
	isSpent, withWitness bool, keyRing KeyLookup,
	decDisplay fn.Option[uint32]) (*taprpc.Asset, error)

MarshalAsset converts an asset to its rpc representation.

func MarshalAssetKey

func MarshalAssetKey(outPoint wire.OutPoint,
	scriptKeyPubKey *btcec.PublicKey) *universerpc.AssetKey

MarshalAssetKey returns an RPC ready AssetKey.

func MarshalAssetRates

func MarshalAssetRates(
	assetRate rfqmsg.AssetRate) lfn.Result[*priceoraclerpc.AssetRates]

MarshalAssetRates converts an asset rate to an RPC AssetRates. The OK result has a pointer type so that it is nil if there is an error. NOTE: The payment asset is assumed to be BTC.

func MarshalAssetVersion

func MarshalAssetVersion(version asset.Version) (taprpc.AssetVersion, error)

MarshalAssetVersion parses an asset version from the RPC variant.

func MarshalBigIntFixedPoint

func MarshalBigIntFixedPoint(
	fp rfqmath.BigIntFixedPoint) (*priceoraclerpc.FixedPoint, error)

MarshalBigIntFixedPoint converts a BigIntFixedPoint to an RPC FixedPoint.

func MarshalChainAsset

func MarshalChainAsset(ctx context.Context, a asset.ChainAsset,
	decDisplay fn.Option[uint32], withWitness bool,
	keyRing KeyLookup) (*taprpc.Asset, error)

MarshalChainAsset marshals a chain asset into its RPC counterpart.

func MarshalExternalKey

func MarshalExternalKey(key asset.ExternalKey) *taprpc.ExternalKey

MarshalExternalKey marshals an external key into its RPC counterpart.

func MarshalGenesisInfo

func MarshalGenesisInfo(gen *asset.Genesis,
	assetType asset.Type) *taprpc.GenesisInfo

MarshalGenesisInfo marshals the native asset genesis into the RPC counterpart.

func MarshalGroupKeyRequest

func MarshalGroupKeyRequest(
	req *asset.GroupKeyRequest) (*taprpc.GroupKeyRequest, error)

MarshalGroupKeyRequest marshals the native group key request into the RPC counterpart.

func MarshalGroupVirtualTx

func MarshalGroupVirtualTx(genTx *asset.GroupVirtualTx) (*taprpc.GroupVirtualTx,
	error)

MarshalGroupVirtualTx marshals the native asset group virtual transaction into the RPC counterpart.

func MarshalKeyDescriptor

func MarshalKeyDescriptor(desc keychain.KeyDescriptor) *taprpc.KeyDescriptor

MarshalKeyDescriptor marshals the native key descriptor into the RPC counterpart.

func MarshalOutpoint

func MarshalOutpoint(outPoint wire.OutPoint) *universerpc.Outpoint

MarshalOutpoint marshals a wire.OutPoint into an RPC ready Outpoint.

func MarshalScriptKey

func MarshalScriptKey(scriptKey asset.ScriptKey) *taprpc.ScriptKey

MarshalScriptKey marshals the native script key into the RPC counterpart.

func MarshalScriptKeyType

func MarshalScriptKeyType(typ asset.ScriptKeyType) taprpc.ScriptKeyType

MarshalScriptKeyType marshals the script key type from the RPC variant.

func MarshalUniverseID

func MarshalUniverseID(assetIDBytes []byte,
	groupKeyBytes []byte) *universerpc.ID

MarshalUniverseID returns an RPC ready universe ID.

func ParseScriptKeyTypeQuery

func ParseScriptKeyTypeQuery(
	q *taprpc.ScriptKeyTypeQuery) (fn.Option[asset.ScriptKeyType], bool,
	error)

ParseScriptKeyTypeQuery parses the script key type query from the RPC variant.

func UnmarshalAssetVersion

func UnmarshalAssetVersion(version taprpc.AssetVersion) (asset.Version, error)

UnmarshalAssetVersion parses an asset version from the RPC variant.

func UnmarshalExternalKey

func UnmarshalExternalKey(rpcKey *taprpc.ExternalKey) (asset.ExternalKey,
	error)

UnmarshalExternalKey parses an external key from the RPC variant.

func UnmarshalFixedPoint

func UnmarshalFixedPoint(
	fp *priceoraclerpc.FixedPoint) (*rfqmath.BigIntFixedPoint, error)

UnmarshalFixedPoint converts an RPC FixedPoint to a BigIntFixedPoint.

func UnmarshalGenesisInfo

func UnmarshalGenesisInfo(rpcGen *taprpc.GenesisInfo) (*asset.Genesis, error)

UnmarshalGenesisInfo parses an asset Genesis from the RPC variant.

func UnmarshalGroupKeyRequest

func UnmarshalGroupKeyRequest(
	req *taprpc.GroupKeyRequest) (*asset.GroupKeyRequest, error)

UnmarshalGroupKeyRequest parses a group key request from the RPC variant.

func UnmarshalGroupVirtualTx

func UnmarshalGroupVirtualTx(
	genTx *taprpc.GroupVirtualTx) (*asset.GroupVirtualTx, error)

UnmarshalGroupVirtualTx parses a group virtual transaction from the RPC variant.

func UnmarshalKeyDescriptor

func UnmarshalKeyDescriptor(
	rpcDesc *taprpc.KeyDescriptor) (keychain.KeyDescriptor, error)

UnmarshalKeyDescriptor parses the RPC key descriptor into the native counterpart.

func UnmarshalOutPoint

func UnmarshalOutPoint(rpcOutpoint *taprpc.OutPoint) (wire.OutPoint, error)

UnmarshalOutPoint parses an outpoint from the RPC variant.

func UnmarshalRfqFixedPoint

func UnmarshalRfqFixedPoint(fp *rfqrpc.FixedPoint) (*rfqmath.BigIntFixedPoint,
	error)

UnmarshalRfqFixedPoint converts an RPC FixedPoint to a BigIntFixedPoint.

func UnmarshalScriptKey

func UnmarshalScriptKey(rpcKey *taprpc.ScriptKey) (*asset.ScriptKey, error)

UnmarshalScriptKey parses the RPC script key into the native counterpart.

func UnmarshalScriptKeyType

func UnmarshalScriptKeyType(rpcType taprpc.ScriptKeyType) (asset.ScriptKeyType,
	error)

UnmarshalScriptKeyType parses the script key type from the RPC variant.

func UnmarshalTapscriptBranch

func UnmarshalTapscriptBranch(
	branch *taprpc.TapBranch) (*asset.TapscriptTreeNodes, error)

UnmarshalTapscriptBranch parses a Tapscript branch from the RPC variant.

func UnmarshalTapscriptFullTree

func UnmarshalTapscriptFullTree(tree *taprpc.TapscriptFullTree) (
	*asset.TapscriptTreeNodes, error)

UnmarshalTapscriptFullTree parses a Tapscript tree from the RPC variant.

func UnmarshalTapscriptSibling

func UnmarshalTapscriptSibling(rpcTree *taprpc.TapscriptFullTree,
	rpcBranch *taprpc.TapBranch) (fn.Option[asset.TapscriptTreeNodes],
	error)

UnmarshalTapscriptSibling parses a Tapscript sibling from the RPC variant.

Types

type KeyLookup

type KeyLookup interface {
	// IsLocalKey returns true if the key is under the control of the
	// wallet and can be derived by it.
	IsLocalKey(ctx context.Context, desc keychain.KeyDescriptor) bool
}

KeyLookup is used to determine whether a key is under the control of the local wallet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL