Documentation
¶
Index ¶
- Variables
- func MatchOwners(owners *secp256k1fx.OutputOwners, addrs set.Set[ids.ShortID], ...) ([]uint32, bool)
- type BridgeAttestation
- type BridgeRequest
- type BridgeWallet
- type ChainType
- type ChainUTXOs
- type ConfirmationReceipt
- type Factory
- type IssuanceReceipt
- type KeyManager
- type Option
- func UnionOptions(first, second []Option) []Option
- func WithAssumeDecided() Option
- func WithBaseFee(baseFee *big.Int) Option
- func WithChangeOwner(changeOwner *secp256k1fx.OutputOwners) Option
- func WithConfirmationHandler(f func(ConfirmationReceipt)) Option
- func WithContext(ctx context.Context) Option
- func WithCustomAddresses(addrs set.Set[ids.ShortID]) Option
- func WithCustomEthAddresses(addrs set.Set[common.Address]) Option
- func WithIssuanceHandler(f func(IssuanceReceipt)) Option
- func WithMemo(memo []byte) Option
- func WithMinIssuanceTime(minIssuanceTime uint64) Option
- func WithPollFrequency(pollFrequency time.Duration) Option
- func WithStakeableLocked() Option
- type Options
- func (o *Options) Addresses(defaultAddresses set.Set[ids.ShortID]) set.Set[ids.ShortID]
- func (o *Options) AllowStakeableLocked() bool
- func (o *Options) AssumeDecided() bool
- func (o *Options) BaseFee(defaultBaseFee *big.Int) *big.Int
- func (o *Options) ChangeOwner(defaultOwner *secp256k1fx.OutputOwners) *secp256k1fx.OutputOwners
- func (o *Options) ConfirmationHandler() func(ConfirmationReceipt)
- func (o *Options) Context() context.Context
- func (o *Options) EthAddresses(defaultAddresses set.Set[common.Address]) set.Set[common.Address]
- func (o *Options) IssuanceHandler() func(IssuanceReceipt)
- func (o *Options) Memo() []byte
- func (o *Options) MinIssuanceTime() uint64
- func (o *Options) PollFrequency() time.Duration
- type SignedTransaction
- type TransactionRequest
- type TransactionStatus
- type UTXOs
- type UnsignedTransaction
- type Wallet
- type WalletType
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func MatchOwners ¶
func MatchOwners( owners *secp256k1fx.OutputOwners, addrs set.Set[ids.ShortID], minIssuanceTime uint64, ) ([]uint32, bool)
MatchOwners attempts to match a list of addresses up to the provided threshold.
Types ¶
type BridgeAttestation ¶
type BridgeAttestation struct {
SourceChain ChainType
DestinationChain ChainType
MessageID ids.ID
Payload []byte
Validators []ids.NodeID
Signatures [][]byte // Classical signatures
RingtailSig []byte // Aggregated Ringtail signature
}
BridgeAttestation represents a cross-chain message attestation
type BridgeRequest ¶
type BridgeRequest struct {
SourceChain ChainType
DestinationChain ChainType
AssetID ids.ID
Amount *big.Int
Recipient string
Data []byte
}
BridgeRequest represents a cross-chain transaction request
type BridgeWallet ¶
type BridgeWallet interface {
Wallet
// CreateBridgeTransaction creates a cross-chain transaction
CreateBridgeTransaction(ctx context.Context, req *BridgeRequest) (UnsignedTransaction, error)
// VerifyBridgeAttestation verifies a bridge attestation with Ringtail signatures
VerifyBridgeAttestation(ctx context.Context, attestation *BridgeAttestation) error
}
BridgeWallet extends Wallet with cross-chain capabilities
type ChainType ¶
type ChainType string
ChainType represents different blockchain architectures
const ( ChainTypeLuxPrimary ChainType = "lux-primary" // P-Chain, X-Chain, C-Chain ChainTypeLuxL2 ChainType = "lux-l2" // SubnetEVM ChainTypeOPStack ChainType = "op-stack" // OP Stack on Lux ChainTypeBasedRollup ChainType = "based-rollup" // Based Rollup settling on Lux ChainTypeBitcoin ChainType = "bitcoin" // Bitcoin network ChainTypeXRPL ChainType = "xrpl" // XRP Ledger ChainTypeEVM ChainType = "evm" // Generic EVM chain )
type ChainUTXOs ¶
type ChainUTXOs interface {
AddUTXO(ctx context.Context, destinationChainID ids.ID, utxo *lux.UTXO) error
RemoveUTXO(ctx context.Context, sourceChainID, utxoID ids.ID) error
UTXOs(ctx context.Context, sourceChainID ids.ID) ([]*lux.UTXO, error)
GetUTXO(ctx context.Context, sourceChainID, utxoID ids.ID) (*lux.UTXO, error)
}
func NewChainUTXOs ¶
func NewChainUTXOs(chainID ids.ID, utxos UTXOs) ChainUTXOs
type ConfirmationReceipt ¶
type ConfirmationReceipt struct {
// Identifies the primary chain ("P", "X" or "C")
ChainAlias string
// ID of the issued transaction
TxID ids.ID
// The time from initiation to confirmation
TotalDuration time.Duration
// The time from issuance to confirmation. It does not include the duration
// of issuance.
ConfirmationDuration time.Duration
}
ConfirmationReceipt is the information known after issuing and confirming a transaction.
type Factory ¶
type Factory interface {
// CreateWallet creates a wallet for the specified chain
CreateWallet(ctx context.Context, chainType ChainType, keyManager KeyManager, config interface{}) (Wallet, error)
// CreateBridgeWallet creates a bridge-enabled wallet
CreateBridgeWallet(ctx context.Context, chainType ChainType, keyManager KeyManager, config interface{}) (BridgeWallet, error)
}
Factory creates wallets for different chain types
type IssuanceReceipt ¶
type IssuanceReceipt struct {
// Identifies the primary chain ("P", "X" or "C")
ChainAlias string
// ID of the issued transaction
TxID ids.ID
// The time from initiation to issuance
Duration time.Duration
}
IssuanceReceipt is the information known after issuing a transaction.
type KeyManager ¶
type KeyManager interface {
// GetPrivateKey returns the ECDSA private key
GetPrivateKey() *ecdsa.PrivateKey
// GetPublicKey returns the ECDSA public key
GetPublicKey() *ecdsa.PublicKey
GetRingtailShare() []byte
// Sign signs a message
Sign(message []byte) ([]byte, error)
// SignWithRingtail signs with Ringtail if available
SignWithRingtail(message []byte) ([]byte, error)
}
KeyManager manages keys for different wallet types
type Option ¶
type Option func(*Options)
func UnionOptions ¶
func WithAssumeDecided ¶
func WithAssumeDecided() Option
func WithBaseFee ¶
func WithChangeOwner ¶
func WithChangeOwner(changeOwner *secp256k1fx.OutputOwners) Option
func WithConfirmationHandler ¶
func WithConfirmationHandler(f func(ConfirmationReceipt)) Option
func WithContext ¶
func WithIssuanceHandler ¶
func WithIssuanceHandler(f func(IssuanceReceipt)) Option
func WithMinIssuanceTime ¶
func WithPollFrequency ¶
func WithStakeableLocked ¶
func WithStakeableLocked() Option
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func NewOptions ¶
func (*Options) AllowStakeableLocked ¶
func (*Options) AssumeDecided ¶
func (*Options) ChangeOwner ¶
func (o *Options) ChangeOwner(defaultOwner *secp256k1fx.OutputOwners) *secp256k1fx.OutputOwners
func (*Options) ConfirmationHandler ¶
func (o *Options) ConfirmationHandler() func(ConfirmationReceipt)
func (*Options) EthAddresses ¶
func (*Options) IssuanceHandler ¶
func (o *Options) IssuanceHandler() func(IssuanceReceipt)
func (*Options) MinIssuanceTime ¶
func (*Options) PollFrequency ¶
type SignedTransaction ¶
type SignedTransaction interface {
UnsignedTransaction
// GetSignatures returns the signatures
GetSignatures() [][]byte
// GetRingtailSignature returns the Ringtail signature if present
GetRingtailSignature() []byte
}
SignedTransaction represents a signed transaction
type TransactionRequest ¶
type TransactionRequest struct {
To string
AssetID ids.ID
Amount *big.Int
Fee *big.Int
Data []byte // For contract calls
Memo []byte // For UTXO chains
Extra interface{} // Chain-specific data
}
TransactionRequest represents a generic transaction request
type TransactionStatus ¶
type TransactionStatus struct {
ID ids.ID
Status string // pending, confirmed, failed
BlockNumber uint64
BlockHash ids.ID
Timestamp uint64
}
TransactionStatus represents the status of a transaction
type UTXOs ¶
type UTXOs interface {
AddUTXO(ctx context.Context, sourceChainID, destinationChainID ids.ID, utxo *lux.UTXO) error
RemoveUTXO(ctx context.Context, sourceChainID, destinationChainID, utxoID ids.ID) error
UTXOs(ctx context.Context, sourceChainID, destinationChainID ids.ID) ([]*lux.UTXO, error)
GetUTXO(ctx context.Context, sourceChainID, destinationChainID, utxoID ids.ID) (*lux.UTXO, error)
}
type UnsignedTransaction ¶
type UnsignedTransaction interface {
// GetID returns the transaction ID
GetID() ids.ID
// GetChainType returns the chain type
GetChainType() ChainType
// Bytes returns the serialized transaction
Bytes() []byte
}
UnsignedTransaction represents an unsigned transaction
type Wallet ¶
type Wallet interface {
// GetChainType returns the type of blockchain this wallet manages
GetChainType() ChainType
// GetWalletType returns whether this is UTXO or account-based
GetWalletType() WalletType
// GetAddress returns the primary address for this wallet
GetAddress() string
// GetBalance returns the balance for a specific asset
GetBalance(ctx context.Context, assetID ids.ID) (*big.Int, error)
// CreateTransaction creates a new transaction
CreateTransaction(ctx context.Context, req *TransactionRequest) (UnsignedTransaction, error)
// SignTransaction signs a transaction
SignTransaction(ctx context.Context, tx UnsignedTransaction) (SignedTransaction, error)
// BroadcastTransaction broadcasts a signed transaction
BroadcastTransaction(ctx context.Context, tx SignedTransaction) (ids.ID, error)
// GetTransactionStatus returns the status of a transaction
GetTransactionStatus(ctx context.Context, txID ids.ID) (TransactionStatus, error)
}
Wallet provides a unified interface for different blockchain wallets
type WalletType ¶
type WalletType string
WalletType represents the wallet model
const ( WalletTypeUTXO WalletType = "utxo" WalletTypeAccount WalletType = "account" )
Directories
¶
| Path | Synopsis |
|---|---|
|
chain
|
|
|
chains
|
|
|
bitcoin
Package bitcoin provides Bitcoin wallet functionality for the bridge chain
|
Package bitcoin provides Bitcoin wallet functionality for the bridge chain |
|
xrpl
Package xrpl provides XRP Ledger wallet functionality for the bridge chain
|
Package xrpl provides XRP Ledger wallet functionality for the bridge chain |
|
subnet
|
|
|
primary/examples/c-chain-export
command
|
|
|
primary/examples/c-chain-import
command
|
|
|
primary/examples/create-asset
command
|
|
|
primary/examples/create-chain
command
|
|
|
primary/examples/create-subnet
command
|
|
|
test
|
|