Documentation
¶
Index ¶
- func UnmarshalUpgrade(slateBytes []byte, slate *Slate) error
- type BlockFees
- type CbData
- type InitTxArgs
- type InitTxSendArgs
- type IssueInvoiceTxArgs
- type NodeHeightResult
- type OutputCommitMapping
- type OutputData
- type OutputStatus
- type ParticipantData
- type ParticipantMessageData
- type ParticipantMessages
- type SendTXArgs
- type Slate
- type TxLogEntry
- type TxLogEntryType
- type VersionCompatInfo
- type VersionInfo
- type WalletInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnmarshalUpgrade ¶
Types ¶
type BlockFees ¶
type BlockFees struct { // fees Fees core.Uint64 `json:"fees"` // height Height core.Uint64 `json:"height"` // key id KeyID *keychain.Identifier `json:"key_id"` }
BlockFees are the fees in block to use for coinbase amount calculation
type CbData ¶
type CbData struct { // Output Output core.Output `json:"output"` // Kernel Kernel core.TxKernel `json:"kernel"` // Key Id KeyID *keychain.Identifier `json:"key_id"` }
CbData is the response to build a coinbase output.
type InitTxArgs ¶
type InitTxArgs struct { // The human readable account name from which to draw outputs // for the transaction, overriding whatever the active account is as set via the // [`set_active_account`](../grin_wallet_api/owner/struct.Owner.html#method.set_active_account) method. SrcAcctName *string `json:"src_acct_name"` // The amount to send, in nanogrins. (`1 G = 1_000_000_000nG`) Amount core.Uint64 `json:"amount"` // The minimum number of confirmations an output // should have in order to be included in the transaction. MinimumConfirmations uint64 `json:"minimum_confirmations"` // By default, the wallet selects as many inputs as possible in a // transaction, to reduce the Output set and the fees. The wallet will attempt to spend // include up to `max_outputs` in a transaction, however if this is not enough to cover // the whole amount, the wallet will include more outputs. This parameter should be considered // a soft limit. MaxOutputs uint32 `json:"max_outputs"` // The target number of change outputs to create in the transaction. // The actual number created will be `num_change_outputs` + whatever remainder is needed. NumChangeOutputs uint32 `json:"num_change_outputs"` // If `true`, attempt to use up as many outputs as // possible to create the transaction, up the 'soft limit' of `max_outputs`. This helps // to reduce the size of the UTXO set and the amount of data stored in the wallet, and // minimizes fees. This will generally result in many inputs and a large change output(s), // usually much larger than the amount being sent. If `false`, the transaction will include // as many outputs as are needed to meet the amount, (and no more) starting with the smallest // value outputs. SelectionStrategyIsUseAll bool `json:"selection_strategy_is_use_all"` // An optional participant message to include alongside the sender's public // ParticipantData within the slate. This message will include a signature created with the // sender's private excess value, and will be publically verifiable. Note this message is for // the convenience of the participants during the exchange; it is not included in the final // transaction sent to the chain. The message will be truncated to 256 characters. Message *string `json:"message"` // Optionally set the output target slate version (acceptable // down to the minimum slate version compatible with the current. If `None` the slate // is generated with the latest version. TargetSlateVersion *uint16 `json:"target_slate_version"` // If true, just return an estimate of the resulting slate, containing fees and amounts // locked without actually locking outputs or creating the transaction. Note if this is set to // 'true', the amount field in the slate will contain the total amount locked, not the provided // transaction amount EstimateOnly *bool `json:"estimate_only"` // Sender arguments. If present, the underlying function will also attempt to send the // transaction to a destination and optionally finalize the result SendArgs *InitTxSendArgs `json:"send_args"` }
InitTxArgs is V2 Init / Send TX API Args
type InitTxSendArgs ¶
type InitTxSendArgs struct { // The transaction method. Can currently be 'http' or 'keybase'. Method string `json:"method"` // The destination, contents will depend on the particular method Dest string `json:"dest"` // Whether to finalize the result immediately if the send was successful Finalize bool `json:"finalize"` // Whether to post the transaction if the send and finalize were successful PostTx bool `json:"post_tx"` // Whether to use dandelion when posting. If false, skip the dandelion relay Fluff bool `json:"fluff"` }
InitTxSendArgs is the send TX API Args, for convenience functionality that inits the transaction and sends in one go
type IssueInvoiceTxArgs ¶
type IssueInvoiceTxArgs struct { // The human readable account name to which the received funds should be added // overriding whatever the active account is as set via the // [`set_active_account`](../grin_wallet_api/owner/struct.Owner.html#method.set_active_account) method. DestAcctName *string `json:"dest_acct_name"` // The invoice amount in nanogrins. (`1 G = 1_000_000_000nG`) Amount core.Uint64 `json:"amount"` // Optional message, that will be signed Message *string `json:"message"` // Optionally set the output target slate version (acceptable // down to the minimum slate version compatible with the current. If `None` the slate // is generated with the latest version. TargetSlateVersion *uint16 `json:"target_slate_version"` }
IssueInvoiceTxArgs are the v2 Issue Invoice Tx Args
type NodeHeightResult ¶
type NodeHeightResult struct { // Last known height Height core.Uint64 `json:"height"` // Whether this height was updated from the node UpdatedFromNode bool `json:"updated_from_node"` }
NodeHeightResult is the node height result
type OutputCommitMapping ¶
type OutputCommitMapping struct { // Output Data Output OutputData `json:"output"` // The commit Commit string `json:"commit"` }
OutputCommitMapping is the map Outputdata to commits
type OutputData ¶
type OutputData struct { // Root key_id that the key for this output is derived from RootKeyID keychain.Identifier `json:"root_key_id"` // Derived key for this output KeyID keychain.Identifier `json:"key_id"` // How many derivations down from the root key NChild uint32 `json:"n_child"` // The actual commit optionally stored Commit *string `json:"commit"` // PMMR Index, used on restore in case of duplicate wallets using the same // key_id (2 wallets using same seed, for instance MMRIndex *core.Uint64 `json:"mmr_index"` // Value of the output, necessary to rebuild the commitment Value core.Uint64 `json:"value"` // Current status of the output Status OutputStatus `json:"status"` // Height of the output Height core.Uint64 `json:"height"` // Height we are locked until LockHeight core.Uint64 `json:"lock_height"` // Is this a coinbase output? Is it subject to coinbase locktime? IsCoinbase bool `json:"is_coinbase"` // Optional corresponding internal entry in tx entry log TxLogEntry *uint32 `json:"tx_log_entry"` }
OutputData is the information about an output that's being tracked by the wallet. Must be enough to reconstruct the commitment associated with the output when the root private key is known.
type OutputStatus ¶
type OutputStatus int
OutputStatus is the status of an output that's being tracked by the wallet. Can either be unconfirmed, spent, unspent, or locked (when it's been used to generate a transaction but we don't have confirmation that the transaction was broadcasted or mined).
const ( // Unconfirmed output Unconfirmed OutputStatus = iota // Unspent output Unspent // Locked output Locked // Spent output Spent )
func (OutputStatus) MarshalJSON ¶
func (s OutputStatus) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (OutputStatus) String ¶
func (s OutputStatus) String() string
func (*OutputStatus) UnmarshalJSON ¶
func (s *OutputStatus) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals a quoted json string to the enum value
type ParticipantData ¶
type ParticipantData struct { // Id of participant in the transaction. (For now, 0=sender, 1=rec) ID core.Uint64 `json:"id"` // Public key corresponding to private blinding factor PublicBlindExcess string `json:"public_blind_excess"` // Public key corresponding to private nonce PublicNonce string `json:"public_nonce"` // Public partial signature PartSig *string `json:"part_sig"` // A message for other participants Message *string `json:"message"` // Signature, created with private key corresponding to 'public_blind_excess' MessageSig *string `json:"message_sig"` }
ParticipantData is a public data for each participant in the slate
type ParticipantMessageData ¶
type ParticipantMessageData struct { // id of the particpant in the tx ID core.Uint64 `json:"id"` // Public key PublicKey string `json:"public_key"` // Message, Message *string `json:"message"` // Signature MessageSig *string `json:"message_sig"` }
ParticipantMessageData is the public message data (for serializing and storage)
type ParticipantMessages ¶
type ParticipantMessages struct { // included messages Messages []ParticipantMessageData `json:"messages"` }
ParticipantMessages is an helper just to facilitate serialization
type SendTXArgs ¶
type SendTXArgs struct { // amount to send Amount uint64 `json:"amount"` // minimum confirmations MinimumConfirmations uint64 `json:"minimum_confirmations"` // payment method Method string `json:"method"` // destination url Dest string `json:"dest"` // Max number of outputs MaxOutputs uint `json:"max_outputs"` // Number of change outputs to generate NumChangeOutputs uint `json:"num_change_outputs"` // whether to use all outputs (combine) SelectionStrategyIsUseAll bool `json:"selection_strategy_is_use_all"` // Optional message, that will be signed Message *string `json:"message"` // Optional slate version to target when sending TargetSlateVersion *uint16 `json:"target_slate_version"` }
SendTXArgs Send TX API Args TODO: This is here to ensure the legacy V1 API remains intact remove this when v1 api is removed
type Slate ¶
type Slate struct { // Versioning info VersionInfo VersionCompatInfo `json:"version_info"` // The number of participants intended to take part in this transaction NumParticipants uint `json:"num_participants"` // Unique transaction ID, selected by sender ID uuid.UUID `json:"id"` // The core transaction data: // inputs, outputs, kernels, kernel offset Transaction core.Transaction `json:"tx"` // base amount (excluding fee) Amount core.Uint64 `json:"amount"` // fee amount Fee core.Uint64 `json:"fee"` // Block height for the transaction Height core.Uint64 `json:"height"` // Lock height LockHeight core.Uint64 `json:"lock_height"` // Participant data, each participant in the transaction will // insert their public data here. For now, 0 is sender and 1 // is receiver, though this will change for multi-party ParticipantData []ParticipantData `json:"participant_data"` }
A Slate is passed around to all parties to build up all of the public transaction data needed to create a finalized transaction. Callers can pass the slate around by whatever means they choose, (but we can provide some binary or JSON serialization helpers here).
type TxLogEntry ¶
type TxLogEntry struct { // BIP32 account path used for creating this tx ParentKeyID keychain.Identifier `json:"parent_key_id"` // Local id for this transaction (distinct from a slate transaction id) ID uint32 `json:"id"` // Slate transaction this entry is associated with, if any TxSlateID *uuid.UUID `json:"tx_slate_id"` // Transaction type (as above) TxType TxLogEntryType `json:"tx_type"` // Time this tx entry was created // #[serde(with = "tx_date_format")] CreationTs time.Time `json:"creation_ts"` // Time this tx was confirmed (by this wallet) // #[serde(default, with = "opt_tx_date_format")] ConfirmationTs *time.Time `json:"confirmation_ts"` // Whether the inputs+outputs involved in this transaction have been // confirmed (In all cases either all outputs involved in a tx should be // confirmed, or none should be; otherwise there's a deeper problem) Confirmed bool `json:"confirmed"` // number of inputs involved in TX NumInputs uint `json:"num_inputs"` // number of outputs involved in TX NumOutputs uint `json:"num_outputs"` // Amount credited via this transaction AmountCredited core.Uint64 `json:"amount_credited"` // Amount debited via this transaction AmountDebited core.Uint64 `json:"amount_debited"` // Fee Fee *core.Uint64 `json:"fee"` // Message data, stored as json Messages *ParticipantMessages `json:"messages"` // Location of the store transaction, (reference or resending) StoredTx *string `json:"stored_tx"` }
TxLogEntry is an optional transaction information, recorded when an event happens to add or remove funds from a wallet. One Transaction log entry maps to one or many outputs
type TxLogEntryType ¶
type TxLogEntryType int
TxLogEntryType represent the type of transactions that can be contained within a TXLog entry
const ( // ConfirmedCoinbase is a coinbase transaction becomes confirmed ConfirmedCoinbase TxLogEntryType = iota // TxReceived are outputs created when a transaction is received TxReceived // TxSent are inputs locked + change outputs when a transaction is created TxSent // TxReceivedCancelled is a received transaction that was rolled back by user TxReceivedCancelled // TxSentCancelled is a sent transaction that was rolled back by user TxSentCancelled )
func (TxLogEntryType) MarshalJSON ¶
func (s TxLogEntryType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (TxLogEntryType) String ¶
func (s TxLogEntryType) String() string
func (*TxLogEntryType) UnmarshalJSON ¶
func (s *TxLogEntryType) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals a quoted json string to the enum value
type VersionCompatInfo ¶
type VersionCompatInfo struct { // The current version of the slate format Version uint16 `json:"version"` // Original version this slate was converted from OrigVersion uint16 `json:"orig_version"` // The grin block header version this slate is intended for BlockHeaderVersion uint16 `json:"block_header_version"` }
VersionCompatInfo is the versioning and compatibility info about this slate
type VersionInfo ¶
type VersionInfo struct { // API version ForeignAPIVersion uint16 `json:"foreign_api_version"` // Slate version SupportedSlateVersions []slateversions.SlateVersion `json:"supported_slate_versions"` }
VersionInfo is the version request result
type WalletInfo ¶
type WalletInfo struct { // height from which info was taken LastConfirmedHeight core.Uint64 `json:"last_confirmed_height"` // Minimum number of confirmations for an output to be treated as "spendable". MinimumConfirmations core.Uint64 `json:"minimum_confirmations"` // total amount in the wallet Total core.Uint64 `json:"total"` // amount awaiting finalization AmountAwaitingFinalization core.Uint64 `json:"amount_awaiting_finalization"` // amount awaiting confirmation AmountAwaitingConfirmation core.Uint64 `json:"amount_awaiting_confirmation"` // coinbases waiting for lock height AmountImmature core.Uint64 `json:"amount_immature"` // amount currently spendable AmountCurrentlySpendable core.Uint64 `json:"amount_currently_spendable"` // amount locked via previous transactions AmountLocked core.Uint64 `json:"amount_locked"` }
WalletInfo is a contained wallet info struct, so automated tests can parse wallet info can add more fields here over time as needed