Documentation ¶
Index ¶
- Constants
- type SeedWallet
- func (wallet *SeedWallet) GetAddress(idx uint64) SpendableKey
- func (wallet *SeedWallet) GetAddresses(idx uint64, keys []SpendableKey)
- func (wallet *SeedWallet) RecoveryPhrase() (string, error)
- func (wallet *SeedWallet) SignTransaction(txn types.Transaction, keys []SpendableKey) (types.Transaction, error)
- type SpendableKey
- type SpendableOutput
- type UnlockConditions
Constants ¶
const ( //SeedChecksumSize is the number of bytes that are used to checksum //addresses to prevent accidental spending. //https://gitlab.com/NebulousLabs/Sia/blob/fb65620/modules/wallet.go#L24 SeedChecksumSize = 6 )
Some of these funcs and consts are copied directly from the Sia code base. Unfortunately we can't use some of the packages directly because of the wasm target
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SeedWallet ¶
type SeedWallet struct {
// contains filtered or unexported fields
}
SeedWallet creates keys and addresses for the generated seed. Wallet is stateless for ease of use
func RecoverSeed ¶
func RecoverSeed(phrase string) (wallet *SeedWallet, err error)
RecoverSeed loads a standard 29 word wallet phrase. Wanted to import this directly from modules, but cannot because of bbolt https://gitlab.com/NebulousLabs/Sia/blob/fb65620/modules/wallet.go#L526
func (*SeedWallet) GetAddress ¶
func (wallet *SeedWallet) GetAddress(idx uint64) SpendableKey
GetAddress returns the spendable address at the specified index
func (*SeedWallet) GetAddresses ¶
func (wallet *SeedWallet) GetAddresses(idx uint64, keys []SpendableKey)
GetAddresses returns the n addresses starting at idx and incrementing by 1. Wanted to import this directly from modules, but cannot because of bbolt https://gitlab.com/NebulousLabs/Sia/blob/fb65620/modules/wallet/seed.go#L49
func (*SeedWallet) RecoveryPhrase ¶
func (wallet *SeedWallet) RecoveryPhrase() (string, error)
RecoveryPhrase returns the 29 word seed recovery phrase. Wanted to import this directly from modules, but cannot because of bbolt https://gitlab.com/NebulousLabs/Sia/blob/fb65620/modules/wallet.go#L515
func (*SeedWallet) SignTransaction ¶
func (wallet *SeedWallet) SignTransaction(txn types.Transaction, keys []SpendableKey) (types.Transaction, error)
SignTransaction signs a transaction for simplicity only supports standard 1 signature keys and siacoin inputs
type SpendableKey ¶
type SpendableKey struct { UnlockConditions types.UnlockConditions `json:"unlock_conditions"` SecretKeys []crypto.SecretKey `json:"private_key"` }
SpendableKey a set of secret keys plus the corresponding unlock conditions. Siacoin and Siafund outputs with unlock hashes matching the unlock conditions can be spent by the seed
type SpendableOutput ¶
type SpendableOutput struct { ID [32]byte `json:"id"` UnlockHash string `json:"unlock_hash"` SeedIndex uint64 `json:"seed_index"` Value types.Currency `json:"value"` }
SpendableOutput an output known to be spendable by a seed with the index of the seed used to generate the unlock hash
type UnlockConditions ¶
type UnlockConditions struct { PublicKeys []string `json:"publickeys"` SignaturesRequired uint64 `json:"signaturesrequired"` Timelock uint64 `json:"timelock"` }
UnlockConditions maps sia unlock conditions to a more managable type