Documentation ¶
Index ¶
- type Asset
- type Keychain
- type UTXOSet
- type Wallet
- func (w *Wallet) AllPartyIDs() party.IDSlice
- func (w *Wallet) AllPartyNicks() []string
- func (w *Wallet) Balance(assetID ids.ID) uint64
- func (w *Wallet) BalanceForDisplay(assetID ids.ID) string
- func (w *Wallet) Codec() codec.Manager
- func (w *Wallet) ConfirmTx(txID ids.ID) bool
- func (w *Wallet) CreateTx(assetID ids.ID, amount uint64, destAddr ids.ShortID, memo string) (*avm.Tx, error)
- func (w *Wallet) DumpUTXOs() string
- func (w *Wallet) FetchUTXOs() error
- func (w *Wallet) FormatAmount(asset Asset, amt uint64) string
- func (w *Wallet) FormatAssetID(assetID ids.ID) string
- func (w *Wallet) FormatIssueTxAsCurl(tx string) string
- func (w *Wallet) FormatTxURL(txID ids.ID) string
- func (w *Wallet) GetAsset(assetID ids.ID) Asset
- func (w *Wallet) GetBalances() map[ids.ID]uint64
- func (w *Wallet) GetFormattedAddress() string
- func (w *Wallet) GetName() string
- func (w *Wallet) GetUnsignedBytes(source interface{}) ([]byte, error)
- func (w *Wallet) GetUnwrappedKeyData() mpsconfig.Config
- func (w *Wallet) Initialize(keydata []byte)
- func (w *Wallet) IsFetching() bool
- func (w *Wallet) IssueTx(txBytes []byte) (ids.ID, error)
- func (w *Wallet) Marshal(source interface{}) (destination []byte, err error)
- func (w *Wallet) MpsSigToAvaSig(hashedmsg []byte, mpssig *mpsecdsa.Signature) ([]byte, error)
- func (w *Wallet) OtherPartyIDs() party.IDSlice
- func (w *Wallet) PublicKeyAvm() avacrypto.PublicKey
- func (w *Wallet) PublicKeyMpsPoint() curve.Point
- func (w *Wallet) SetName(name string)
- func (w *Wallet) Unmarshal(source []byte) (destination interface{}, err error)
- func (w *Wallet) UnmarshalJSON(data []byte) error
- func (w *Wallet) VerifyHash(hashedmsg []byte, mpssig *mpsecdsa.Signature) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keychain ¶
Keychain is a collection of multisig public keys that can be used to spend outputs TODO see MPS DeriveBIP32, derives a sharing of the ith child of the consortium signing key. TODO what about asset IDs? Should handling of those be in this struct?
func (*Keychain) Add ¶
func (kc *Keychain) Add(key *crypto.PublicKeySECP256K1R)
Add a new key to the key chain
func (*Keychain) Match ¶
func (kc *Keychain) Match(owners *secp256k1fx.OutputOwners, time uint64) bool
Match only outputs that have one owner (the multi sig key)
func (*Keychain) Spend ¶
func (kc *Keychain) Spend(out verify.Verifiable, time uint64) (verify.Verifiable, error)
Spend attempts to create an input from an output
type UTXOSet ¶
type UTXOSet struct { // List of UTXOs in this set // This can be used to iterate over. It should not be modified externally. UTXOs []*avax.UTXO // contains filtered or unexported fields }
func (*UTXOSet) PrefixedString ¶
PrefixedString returns a string with each new line prefixed with [prefix]
type Wallet ¶
type Wallet struct { // User-supplied name for this wallet Name string Threshold int Me user.User Others []user.User // Raw config.Config struct we get from the MPS Keygen protocol // This is a SECRET so figure out best way to protect it KeyData []byte // Public address computed from the MPS config and stored here so it shows up in the persisted JSON for reference Address string // Config params for a blockchain, i.e. Avax Fuji, etc Config constants.AvmConfig CreatedAt time.Time // contains filtered or unexported fields }
Wallet is a holder for keys and UTXOs for the blockchain. For now we use just one pub/priv key, maybe use BIP32 to enhance privacy?
func NewEmptyWallet ¶
func NewEmptyWallet(network string, name string, threshold int, me user.User, others []user.User) *Wallet
NewWallet returns a new Avalanche Wallet
func (*Wallet) AllPartyIDs ¶
All signers as partyIDs (required by the MSP library)
func (*Wallet) AllPartyNicks ¶
All signers as an array of string nicknames
func (*Wallet) BalanceForDisplay ¶
Balance returns the amount of the assets in this wallet in units of AVAX
func (*Wallet) CreateTx ¶
func (w *Wallet) CreateTx(assetID ids.ID, amount uint64, destAddr ids.ShortID, memo string) (*avm.Tx, error)
CreateTx returns a tx that sends [amount] of [assetID] to [destAddr] TODO this only works for avax, make it work for any asset id
func (*Wallet) FetchUTXOs ¶
Query the network for UTXOs Run in a Go routine, as well as called directly
func (*Wallet) FormatAssetID ¶
Return asset info
func (*Wallet) FormatIssueTxAsCurl ¶
func (*Wallet) GetFormattedAddress ¶
The string form of an Avalanche address (X-fuji1blahblah...)
func (*Wallet) GetUnsignedBytes ¶
func (*Wallet) GetUnwrappedKeyData ¶
Unmarshal the MPS config which contains the key data
func (*Wallet) Initialize ¶
func (*Wallet) IsFetching ¶
Is the wallet querying the network for UTXOs
func (*Wallet) MpsSigToAvaSig ¶
Convert the signature generated by the MPS protocol into an Avalance recoverable signature
func (*Wallet) OtherPartyIDs ¶
All signers excluding me
func (*Wallet) PublicKeyAvm ¶
From the MSP key data, convert to an Avalanche public key
func (*Wallet) PublicKeyMpsPoint ¶
func (*Wallet) UnmarshalJSON ¶
Do the funky chicken to unmarshal then init the struct TODO is this really best way init an unmarshaled struct?