Documentation
¶
Index ¶
- func FinalizePendingTxs(ctx context.Context, args FinalizePendingTxsArgs) ([]string, error)
- func VerifySignedCheckpointTxs(originalCheckpoints, signedCheckpoints []string, ...) error
- func VerifySignedTx(original, signed string, signers map[string]*btcec.PublicKey) error
- type BaseArgs
- type BuildAndSignBurnTxArgs
- type BuildAndSignIssuanceTxArgs
- type BuildAndSignIssuanceTxRes
- type BuildAndSignReissuanceTxArgs
- type BuildAndSignTxArgs
- type BuildAndSignTxRes
- func BuildAndSignBurnTx(ctx context.Context, args BuildAndSignBurnTxArgs, opts ...Option) (*BuildAndSignTxRes, error)
- func BuildAndSignReissuanceTx(ctx context.Context, args BuildAndSignReissuanceTxArgs, opts ...Option) (*BuildAndSignTxRes, error)
- func BuildAndSignTx(ctx context.Context, args BuildAndSignTxArgs, opts ...Option) (*BuildAndSignTxRes, error)
- type BurnAssetArgs
- type FinalizePendingTxsArgs
- type IssueAssetArgs
- type IssueAssetRes
- type OffchainTxRes
- type Option
- type ReissueAssetArgs
- type SendArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FinalizePendingTxs ¶
func FinalizePendingTxs( ctx context.Context, args FinalizePendingTxsArgs, ) ([]string, error)
FinalizePendingTxs asks the server for pending offchain txs tied to args.Vtxos via the intent proof, then signs and finalizes each.
Types ¶
type BaseArgs ¶
type BaseArgs struct {
ServerParams clientlib.ServerParams // provides Dust, SignerPubKey (hex), CheckpointTapscript (hex)
SignTx clientlib.SignFn // signs ark tx + checkpoint txs
Vtxos []clientlib.Vtxo // pre-fetched spendable vtxos (selection runs inside the primitive)
ChangeAddr string // pre-derived offchain change address
}
BaseArgs is the input shared by every BuildAndSign...Tx primitive and the orchestrators that wrap them.
type BuildAndSignBurnTxArgs ¶
BuildAndSignBurnTxArgs configures the BuildAndSignBurnTx primitive: which asset to destroy (AssetId) and how much of it (Amount). Any remaining balance is returned to the caller's change address.
type BuildAndSignIssuanceTxArgs ¶
type BuildAndSignIssuanceTxArgs struct {
BaseArgs
Amount uint64
ControlAsset clientlib.ControlAsset
Metadata []asset.Metadata
}
BuildAndSignIssuanceTxArgs configures the BuildAndSignIssuanceTx primitive. Amount is the quantity of the new asset to issue. ControlAsset is optional: pass NewControlAsset to mint a fresh control asset alongside the issuance, ExistingControlAsset to authorize via a control asset already held, or nil for an unauthorized issuance. Metadata is attached to the new asset group.
type BuildAndSignIssuanceTxRes ¶
type BuildAndSignIssuanceTxRes struct {
BuildAndSignTxRes
IssuedAssets []asset.AssetId
}
BuildAndSignIssuanceTxRes extends BuildAndSignTxRes with the asset IDs derived inside the primitive from the unsigned tx's txid plus the asset-group index.
func BuildAndSignIssuanceTx ¶
func BuildAndSignIssuanceTx( ctx context.Context, args BuildAndSignIssuanceTxArgs, opts ...Option, ) (*BuildAndSignIssuanceTxRes, error)
BuildAndSignIssuanceTx builds and signs an offchain ark transaction that issues a new asset (and, optionally, a fresh control asset). It does NOT submit the tx to the server — IssueAsset wraps the full lifecycle.
type BuildAndSignReissuanceTxArgs ¶
type BuildAndSignReissuanceTxArgs struct {
BaseArgs
Asset clientlib.Asset
ControlAsset clientlib.Asset
}
BuildAndSignReissuanceTxArgs configures the BuildAndSignReissuanceTx primitive. AssetId is the existing asset to mint more of; ControlAssetId identifies the control asset that authorizes the reissuance (caller is expected to resolve it from the indexer); Amount is the quantity to mint.
type BuildAndSignTxArgs ¶
BuildAndSignTxArgs configures the BuildAndSignTx primitive. Receivers are the outputs of the offchain payment; the rest of the configuration comes from BaseArgs (server info, vtxos to spend, change address, SignTx).
type BuildAndSignTxRes ¶
type BuildAndSignTxRes struct {
// Txid of the resulting ark tx, computed from arkPtx.UnsignedTx.TxID()
// after all outputs (including the extension OP_RETURN) are attached but
// before any witnesses are added. Witness data does not affect the txid.
Txid string
// ArkTx is the unsigned PSBT (base64) used for post-submit verification.
ArkTx string
// SignedArkTx is the client-signed PSBT (base64) ready for SubmitTx.
SignedArkTx string
// CheckpointTxs are the unsigned checkpoint PSBTs (base64). They are
// signed by the client only after the server signs them in SubmitTx;
// finalization passes them through args.SignTx.
CheckpointTxs []string
SelectedCoins []clientlib.Vtxo
ChangeReceiver *clientlib.Receiver
AssetPacket asset.Packet
Extension extension.Extension
}
BuildAndSignTxRes is the output of every BuildAndSign...Tx primitive except BuildAndSignIssuanceTx (which also adds the derived asset IDs).
func BuildAndSignBurnTx ¶
func BuildAndSignBurnTx( ctx context.Context, args BuildAndSignBurnTxArgs, opts ...Option, ) (*BuildAndSignTxRes, error)
BuildAndSignBurnTx builds and signs an offchain ark transaction that destroys a given amount of an asset, carrying any remaining asset change and BTC change back to the caller. It does NOT submit the tx to the server — BurnAsset wraps the full lifecycle.
func BuildAndSignReissuanceTx ¶
func BuildAndSignReissuanceTx( ctx context.Context, args BuildAndSignReissuanceTxArgs, opts ...Option, ) (*BuildAndSignTxRes, error)
BuildAndSignReissuanceTx builds and signs an offchain ark transaction that mints additional units of an existing asset, authorized by the control asset. It does NOT submit the tx to the server — ReissueAsset wraps the full lifecycle.
func BuildAndSignTx ¶
func BuildAndSignTx( ctx context.Context, args BuildAndSignTxArgs, opts ...Option, ) (*BuildAndSignTxRes, error)
BuildAndSignTx builds and signs an offchain transaction (plus its checkpoint transactions) ready for submission. It does NOT submit the txs to the server — callers can use the result with a custom submit flow, while SendOffChain wraps the full lifecycle.
type BurnAssetArgs ¶
type BurnAssetArgs struct {
Client clientlib.Client
ServerParams clientlib.ServerParams
SignTx clientlib.SignFn
Vtxos []clientlib.Vtxo
ChangeAddr string
Asset clientlib.Asset
}
BurnAssetArgs configures the BurnAsset orchestrator. It carries the Client used to submit and finalize the tx plus every input needed to build it: ServerInfo, SignTx, the Vtxos to spend, the change address and the Asset to destroy. See BuildAndSignBurnTxArgs for the Asset semantics.
type FinalizePendingTxsArgs ¶
type FinalizePendingTxsArgs struct {
Client clientlib.Client
SignTx clientlib.SignFn
Vtxos []clientlib.Vtxo
CreatedAfter *time.Time // informational only; caller already filtered Vtxos
}
FinalizePendingTxsArgs configures the FinalizePendingTxs orchestrator. Vtxos lists the pending vtxos whose pending offchain txs should be fetched, signed, and finalized; the caller has already filtered them. CreatedAfter is informational only — used by the caller to track which txs were considered.
type IssueAssetArgs ¶
type IssueAssetArgs struct {
Client clientlib.Client
ServerParams clientlib.ServerParams
SignTx clientlib.SignFn
Vtxos []clientlib.Vtxo
ChangeAddr string
Amount uint64
ControlAsset clientlib.ControlAsset
Metadata []asset.Metadata
}
IssueAssetArgs configures the IssueAsset orchestrator. It carries the Client used to submit and finalize the tx plus every input needed to build it: ServerInfo, SignTx, the Vtxos to spend, the change address, the Amount of the new asset to issue, the optional ControlAsset and the asset Metadata. See BuildAndSignIssuanceTxArgs for the ControlAsset semantics.
type IssueAssetRes ¶
type IssueAssetRes struct {
OffchainTxRes
IssuedAssets []asset.AssetId
}
IssueAssetRes carries the new asset IDs alongside the standard offchain transaction result.
func IssueAsset ¶
func IssueAsset( ctx context.Context, args IssueAssetArgs, opts ...Option, ) (*IssueAssetRes, error)
IssueAsset builds, signs, submits, verifies, and finalizes an offchain ark transaction that issues one (or two, when a new control asset is created) asset groups. Returns the finalized tx along with the IDs of the newly minted assets.
type OffchainTxRes ¶
type OffchainTxRes struct {
Txid string
Tx string
CheckpointTxs []string
Inputs []clientlib.Vtxo
Outputs []clientlib.Receiver
Extension extension.Extension
}
OffchainTxRes is the result of a full-lifecycle orchestrator call.
func BurnAsset ¶
func BurnAsset(ctx context.Context, args BurnAssetArgs, opts ...Option) (*OffchainTxRes, error)
BurnAsset builds, signs, submits, verifies, and finalizes an offchain ark transaction that destroys a given amount of an asset, returning any remaining asset balance and BTC change to the caller's change address.
func ReissueAsset ¶
func ReissueAsset( ctx context.Context, args ReissueAssetArgs, opts ...Option, ) (*OffchainTxRes, error)
ReissueAsset builds, signs, submits, verifies, and finalizes an offchain ark transaction that mints additional units of an existing asset, authorized by the control asset vtxo held by the caller.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option customizes the behavior of an offchain-tx operation (Send, IssueAsset, ReissueAsset, BurnAsset, and their BuildAndSign* primitives). Use the With* helpers in this package to construct instances.
func WithExtraPacket ¶
WithExtraPacket appends extra extension.Packet values to the OP_RETURN extension blob included in the ark transaction alongside the asset packet (type 0x00). Type 0x00 is reserved and rejected. Duplicate packet types are not permitted.
func WithTxOutsTaprootTree ¶
WithTxOutsTaprootTree sets the PSBT BIP-371 TaprootTapTree field on every output whose hex-encoded pkScript matches a key in the map. Callers pass the BIP-371-encoded tap tree bytes (via txutils.TapTree(scripts).Encode()). SendOffChain returns an error if any pkScript key matches no output of the ark tx, surfacing what would otherwise be a silent footgun for protocol- critical VTXO spending.
type ReissueAssetArgs ¶
type ReissueAssetArgs struct {
Client clientlib.Client
ServerParams clientlib.ServerParams
SignTx clientlib.SignFn
Vtxos []clientlib.Vtxo
ChangeAddr string
Asset clientlib.Asset
ControlAsset clientlib.Asset
}
ReissueAssetArgs configures the ReissueAsset orchestrator. It carries the Client used to submit and finalize the tx plus every input needed to build it: ServerInfo, SignTx, the Vtxos to spend, the change address, the Asset to mint more of and the ControlAsset that authorizes the reissuance. See BuildAndSignReissuanceTxArgs for the Asset/ControlAsset semantics.
type SendArgs ¶
type SendArgs struct {
Client clientlib.Client
ServerParams clientlib.ServerParams
SignTx clientlib.SignFn
Vtxos []clientlib.Vtxo
ChangeAddr string
Receivers []clientlib.Receiver
}
SendArgs configures the Send orchestrator. It carries the Client used to submit and finalize the tx plus every input needed to build it: ServerInfo, SignTx, the Vtxos to spend, the change address and the payment Receivers.