Documentation ¶
Index ¶
- Constants
- Variables
- func AccountDetails(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (stellar1.AccountDetails, error)
- func AccountDetailsToWalletAccountLocal(mctx libkb.MetaContext, accountID stellar1.AccountID, ...) (stellar1.WalletAccountLocal, error)
- func AccountExchangeRate(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (stellar1.OutsideExchangeRate, error)
- func AirdropStatus(mctx libkb.MetaContext) (stellar1.AirdropStatus, error)
- func AllWalletAccounts(mctx libkb.MetaContext, remoter remote.Remoter) ([]stellar1.WalletAccountLocal, error)
- func Batch(mctx libkb.MetaContext, walletState *WalletState, arg stellar1.BatchLocalArg) (res stellar1.BatchResultLocal, err error)
- func BuildPaymentLocal(mctx libkb.MetaContext, arg stellar1.BuildPaymentLocalArg) (res stellar1.BuildPaymentResLocal, err error)
- func BuildRequestLocal(mctx libkb.MetaContext, arg stellar1.BuildRequestLocalArg) (res stellar1.BuildRequestResLocal, err error)
- func ChangeAccountName(m libkb.MetaContext, accountID stellar1.AccountID, newName string) (err error)
- func Claim(mctx libkb.MetaContext, walletState *WalletState, txID string, ...) (res stellar1.RelayClaimResult, err error)
- func CreateNewAccount(mctx libkb.MetaContext, accountName string) (ret stellar1.AccountID, err error)
- func CreateWallet(mctx libkb.MetaContext) (created bool, err error)
- func CreateWalletSoft(mctx libkb.MetaContext)
- func DeleteAccount(m libkb.MetaContext, accountID stellar1.AccountID) error
- func EmptyAmountStack(mctx libkb.MetaContext)
- func ExportSecretKey(mctx libkb.MetaContext, accountID stellar1.AccountID) (res stellar1.SecretKey, err error)
- func FormatAmount(mctx libkb.MetaContext, amount string, precisionTwo bool, rounding FmtRounding) (string, error)
- func FormatAmountDescriptionAsset(mctx libkb.MetaContext, amount string, asset stellar1.Asset) (string, error)
- func FormatAmountDescriptionAssetEx(mctx libkb.MetaContext, amount string, asset stellar1.Asset) (string, error)
- func FormatAmountDescriptionXLM(mctx libkb.MetaContext, amount string) (string, error)
- func FormatAmountWithSuffix(mctx libkb.MetaContext, amount string, precisionTwo bool, simplify bool, ...) (string, error)
- func FormatAssetIssuerString(asset stellar1.Asset) string
- func FormatCurrency(mctx libkb.MetaContext, amount string, code stellar1.OutsideCurrencyCode, ...) (string, error)
- func FormatCurrencyLabel(ctx context.Context, g *libkb.GlobalContext, code stellar1.OutsideCurrencyCode) (string, error)
- func FormatCurrencyWithCodeSuffix(mctx libkb.MetaContext, amount string, code stellar1.OutsideCurrencyCode, ...) (string, error)
- func GetAccountDisplayCurrency(mctx libkb.MetaContext, accountID stellar1.AccountID) (res string, err error)
- func GetCurrencySetting(mctx libkb.MetaContext, accountID stellar1.AccountID) (res stellar1.CurrencyLocal, err error)
- func GetInflationDestination(mctx libkb.MetaContext, accountID stellar1.AccountID) (res stellar1.InflationDestinationResultLocal, err error)
- func GetOwnPrimaryAccountID(mctx libkb.MetaContext) (res stellar1.AccountID, err error)
- func GetPredefinedInflationDestinations(mctx libkb.MetaContext) (ret []stellar1.PredefinedInflationDestination, err error)
- func HasAcceptedDisclaimer(ctx context.Context, g *libkb.GlobalContext) (bool, error)
- func ImportSecretKey(mctx libkb.MetaContext, secretKey stellar1.SecretKey, makePrimary bool, ...) (err error)
- func InformAcceptedDisclaimer(ctx context.Context, g *libkb.GlobalContext)
- func LookupRecipient(m libkb.MetaContext, to stellarcommon.RecipientInput, isCLI bool) (res stellarcommon.Recipient, err error)
- func LookupSender(mctx libkb.MetaContext, accountID stellar1.AccountID) (stellar1.BundleEntry, stellar1.AccountBundle, error)
- func LookupSenderPrimary(mctx libkb.MetaContext) (stellar1.BundleEntry, stellar1.AccountBundle, error)
- func LookupSenderSeed(mctx libkb.MetaContext) (stellar1.AccountID, stellarnet.SeedStr, error)
- func LookupUserByAccountID(m libkb.MetaContext, accountID stellar1.AccountID) (uv keybase1.UserVersion, un libkb.NormalizedUsername, err error)
- func MakeRequestCLI(m libkb.MetaContext, remoter remote.Remoter, arg MakeRequestArg) (ret stellar1.KeybaseRequestID, err error)
- func MakeRequestGUI(m libkb.MetaContext, remoter remote.Remoter, arg MakeRequestArg) (ret stellar1.KeybaseRequestID, err error)
- func NoteDecryptB64(mctx libkb.MetaContext, noteB64 string) (res stellar1.NoteContents, err error)
- func NoteEncryptB64(mctx libkb.MetaContext, note stellar1.NoteContents, ...) (noteB64 string, err error)
- func OwnAccount(mctx libkb.MetaContext, accountID stellar1.AccountID) (own, isPrimary bool, err error)
- func PaymentDetailCLILocal(ctx context.Context, g *libkb.GlobalContext, remoter remote.Remoter, ...) (res stellar1.PaymentCLILocal, err error)
- func RandomBuildPaymentID() (stellar1.BuildPaymentID, error)
- func RecentPaymentsCLILocal(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (res []stellar1.PaymentOrErrorCLILocal, err error)
- func RefreshUnreadCount(g *libkb.GlobalContext, accountID stellar1.AccountID)
- func RemotePendingToLocal(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID, ...) (payments []stellar1.PaymentOrErrorLocal, err error)
- func RemoteRecentPaymentsToPage(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID, ...) (page stellar1.PaymentsPageLocal, err error)
- func ReviewPaymentLocal(mctx libkb.MetaContext, stellarUI stellar1.UiInterface, ...) (err error)
- func SendMiniChatPayments(m libkb.MetaContext, walletState *WalletState, convID chat1.ConversationID, ...) (res []libkb.MiniChatPaymentResult, err error)
- func SendPaymentLocal(mctx libkb.MetaContext, arg stellar1.SendPaymentLocalArg) (res stellar1.SendPaymentResLocal, err error)
- func ServiceInit(g *libkb.GlobalContext, walletState *WalletState, badger *badges.Badger)
- func SetAccountAsPrimary(m libkb.MetaContext, accountID stellar1.AccountID) (err error)
- func SetInflationDestinationLocal(mctx libkb.MetaContext, arg stellar1.SetInflationDestinationLocalArg) (err error)
- func SpecMiniChatPayments(mctx libkb.MetaContext, walletState *WalletState, ...) (*libkb.MiniChatPaymentSummary, error)
- func StartBuildPaymentLocal(mctx libkb.MetaContext) (res stellar1.BuildPaymentID, err error)
- func StopBuildPaymentLocal(mctx libkb.MetaContext, bid stellar1.BuildPaymentID)
- func SubtractFeeSoft(mctx libkb.MetaContext, availableStr string) string
- func TransformPaymentSummaryAccount(mctx libkb.MetaContext, p stellar1.PaymentSummary, oc OwnAccountLookupCache, ...) (*stellar1.PaymentLocal, error)
- func TransformPaymentSummaryGeneric(mctx libkb.MetaContext, p stellar1.PaymentSummary, oc OwnAccountLookupCache) (*stellar1.PaymentLocal, error)
- func TransformRequestDetails(mctx libkb.MetaContext, details stellar1.RequestDetails) (*stellar1.RequestDetailsLocal, error)
- func TransformToAirdropStatus(status remote.AirdropStatusAPI) stellar1.AirdropStatus
- func Upkeep(mctx libkb.MetaContext) (err error)
- func WalletAccount(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (stellar1.WalletAccountLocal, error)
- type AccountState
- func (a *AccountState) AccountSeqno(ctx context.Context) (uint64, error)
- func (a *AccountState) AccountSeqnoAndBump(ctx context.Context) (uint64, error)
- func (a *AccountState) AddPendingTx(ctx context.Context, txID stellar1.TransactionID, seqno uint64) error
- func (a *AccountState) Balances(ctx context.Context) ([]stellar1.Balance, error)
- func (a *AccountState) Details(ctx context.Context) (stellar1.AccountDetails, error)
- func (a *AccountState) ForceSeqnoRefresh(mctx libkb.MetaContext) error
- func (a *AccountState) PendingPayments(ctx context.Context, limit int) ([]stellar1.PaymentSummary, error)
- func (a *AccountState) RecentPayments(ctx context.Context) (stellar1.PaymentsPage, error)
- func (a *AccountState) Refresh(mctx libkb.MetaContext, router *libkb.NotifyRouter, reason string) error
- func (a *AccountState) RemovePendingTx(ctx context.Context, txID stellar1.TransactionID) error
- func (a *AccountState) Reset(mctx libkb.MetaContext)
- func (a *AccountState) String() string
- type AutoClaimRunner
- type BuildPaymentCache
- type CreateWalletGatedResult
- type DisplayBalance
- type FmtRounding
- type Loader
- func (p *Loader) GetListener() (id string, ch chan PaymentStatusUpdate, err error)
- func (p *Loader) LoadPayment(ctx context.Context, convID chat1.ConversationID, msgID chat1.MessageID, ...) *chat1.UIPaymentInfo
- func (p *Loader) LoadRequest(ctx context.Context, convID chat1.ConversationID, msgID chat1.MessageID, ...) *chat1.UIRequestInfo
- func (p *Loader) RemoveListener(id string)
- func (p *Loader) Shutdown() error
- func (p *Loader) UpdatePayment(ctx context.Context, paymentID stellar1.PaymentID)
- func (p *Loader) UpdateRequest(ctx context.Context, requestID stellar1.KeybaseRequestID)
- type MakeRequestArg
- type MiniPrepared
- type OwnAccountLookupCache
- type PaymentStatusUpdate
- type SendPaymentArg
- type SendPaymentResult
- type SeqnoProvider
- type Stellar
- func (s *Stellar) CachedHasWallet(ctx context.Context, uv keybase1.UserVersion) bool
- func (s *Stellar) CreateWalletSoft(ctx context.Context)
- func (s *Stellar) GetMigrationLock() *sync.Mutex
- func (s *Stellar) GetServerDefinitions(ctx context.Context) (ret stellar1.StellarServerDefinitions, err error)
- func (s *Stellar) HandleOobm(ctx context.Context, obm gregor.OutOfBandMessage) (bool, error)
- func (s *Stellar) InformHasWallet(ctx context.Context, uv keybase1.UserVersion)
- func (s *Stellar) KickAutoClaimRunner(mctx libkb.MetaContext, trigger gregor.MsgID)
- func (s *Stellar) OnLogout()
- func (s *Stellar) RemovePendingTx(mctx libkb.MetaContext, accountID stellar1.AccountID, ...) error
- func (s *Stellar) SendMiniChatPayments(mctx libkb.MetaContext, convID chat1.ConversationID, ...) ([]libkb.MiniChatPaymentResult, error)
- func (s *Stellar) SetFederationClientForTest(cli federation.ClientInterface)
- func (s *Stellar) SpecMiniChatPayments(mctx libkb.MetaContext, payments []libkb.MiniChatPayment) (*libkb.MiniChatPaymentSummary, error)
- func (s *Stellar) UpdateUnreadCount(ctx context.Context, accountID stellar1.AccountID, unread int) error
- func (s *Stellar) Upkeep(ctx context.Context) error
- type WalletState
- func (w *WalletState) AccountSeqno(ctx context.Context, accountID stellar1.AccountID) (uint64, error)
- func (w *WalletState) AccountSeqnoAndBump(ctx context.Context, accountID stellar1.AccountID) (uint64, error)
- func (w *WalletState) AddPendingTx(ctx context.Context, accountID stellar1.AccountID, txID stellar1.TransactionID, ...) error
- func (w *WalletState) Balances(ctx context.Context, accountID stellar1.AccountID) ([]stellar1.Balance, error)
- func (w *WalletState) Details(ctx context.Context, accountID stellar1.AccountID) (stellar1.AccountDetails, error)
- func (w *WalletState) DumpToLog(mctx libkb.MetaContext)
- func (w *WalletState) ExchangeRate(ctx context.Context, currency string) (stellar1.OutsideExchangeRate, error)
- func (w *WalletState) ForceSeqnoRefresh(mctx libkb.MetaContext, accountID stellar1.AccountID) error
- func (w *WalletState) MarkAsRead(ctx context.Context, accountID stellar1.AccountID, ...) error
- func (w *WalletState) PendingPayments(ctx context.Context, accountID stellar1.AccountID, limit int) ([]stellar1.PaymentSummary, error)
- func (w *WalletState) Primed() bool
- func (w *WalletState) RecentPayments(ctx context.Context, accountID stellar1.AccountID, cursor *stellar1.PageCursor, ...) (stellar1.PaymentsPage, error)
- func (w *WalletState) Refresh(mctx libkb.MetaContext, accountID stellar1.AccountID, reason string) error
- func (w *WalletState) RefreshAll(mctx libkb.MetaContext, reason string) error
- func (w *WalletState) RemovePendingTx(ctx context.Context, accountID stellar1.AccountID, txID stellar1.TransactionID) error
- func (w *WalletState) Reset(mctx libkb.MetaContext)
- func (w *WalletState) Shutdown() error
- func (w *WalletState) String() string
- func (w *WalletState) SubmitRelayClaim(ctx context.Context, post stellar1.RelayClaimPost) (stellar1.RelayClaimResult, error)
Constants ¶
const AccountNameMaxRunes = 24
const DefaultCurrencySetting = "USD"
const FmtRound = false
const FmtTruncate = true
Variables ¶
var ErrAccountNotFound = errors.New("account not found for user")
ErrAccountNotFound is returned when the account is not in WalletState's accounts map.
Functions ¶
func AccountDetails ¶
func AccountDetails(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (stellar1.AccountDetails, error)
AccountDetails gets stellar1.AccountDetails for accountID.
It has the side effect of updating the badge state with the stellar payment unread count for accountID.
func AccountDetailsToWalletAccountLocal ¶
func AccountDetailsToWalletAccountLocal(mctx libkb.MetaContext, accountID stellar1.AccountID, details stellar1.AccountDetails, isPrimary bool, accountName string, accountMode stellar1.AccountMode) (stellar1.WalletAccountLocal, error)
func AccountExchangeRate ¶
func AccountExchangeRate(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (stellar1.OutsideExchangeRate, error)
AccountExchangeRate returns the exchange rate for an account for the logged in user. Note that it is possible that multiple users can own the same account and have different display currency preferences.
func AirdropStatus ¶
func AirdropStatus(mctx libkb.MetaContext) (stellar1.AirdropStatus, error)
func AllWalletAccounts ¶
func AllWalletAccounts(mctx libkb.MetaContext, remoter remote.Remoter) ([]stellar1.WalletAccountLocal, error)
func Batch ¶
func Batch(mctx libkb.MetaContext, walletState *WalletState, arg stellar1.BatchLocalArg) (res stellar1.BatchResultLocal, err error)
Batch sends a batch of payments from the user to multiple recipients in a time-efficient manner.
func BuildPaymentLocal ¶
func BuildPaymentLocal(mctx libkb.MetaContext, arg stellar1.BuildPaymentLocalArg) (res stellar1.BuildPaymentResLocal, err error)
func BuildRequestLocal ¶
func BuildRequestLocal(mctx libkb.MetaContext, arg stellar1.BuildRequestLocalArg) (res stellar1.BuildRequestResLocal, err error)
func ChangeAccountName ¶
func ChangeAccountName(m libkb.MetaContext, accountID stellar1.AccountID, newName string) (err error)
ChangeAccountName changes the name of an account. Make sure to keep this in sync with ValidateAccountNameLocal. An empty name is not allowed. Renaming an account to an already used name is blocked. Maximum length of AccountNameMaxRunes runes.
func Claim ¶
func Claim(mctx libkb.MetaContext, walletState *WalletState, txID string, into stellar1.AccountID, dir *stellar1.RelayDirection, autoClaimToken *string) (res stellar1.RelayClaimResult, err error)
Claim claims a waiting relay. If `dir` is nil the direction is inferred.
func CreateNewAccount ¶
func CreateWallet ¶
func CreateWallet(mctx libkb.MetaContext) (created bool, err error)
CreateWallet creates and posts an initial stellar bundle for a user. Only succeeds if they do not already have one. Safe (but wasteful) to call even if the user has a bundle already.
func CreateWalletSoft ¶ added in v1.0.48
func CreateWalletSoft(mctx libkb.MetaContext)
CreateWalletSoft creates a user's initial wallet if they don't already have one. Does not get in the way of intentional user actions.
func DeleteAccount ¶
func DeleteAccount(m libkb.MetaContext, accountID stellar1.AccountID) error
func EmptyAmountStack ¶
func EmptyAmountStack(mctx libkb.MetaContext)
func ExportSecretKey ¶ added in v1.0.48
func FormatAmount ¶
func FormatAmount(mctx libkb.MetaContext, amount string, precisionTwo bool, rounding FmtRounding) (string, error)
func FormatAmountDescriptionAsset ¶
func FormatAmountDescriptionAsset(mctx libkb.MetaContext, amount string, asset stellar1.Asset) (string, error)
Example: "157.5000000 XLM" Example: "12.9000000 USD"
(where USD is a non-native asset issued by someone).
User interfaces should be careful to never give user just amount + asset code, but annotate when it's a non-native asset and make Issuer ID and Verified Domain visible. If you are coming from CLI, FormatAmountDescriptionAssetEx might be a better choice which is more verbose about non-native assets.
func FormatAmountDescriptionAssetEx ¶
func FormatAmountDescriptionAssetEx(mctx libkb.MetaContext, amount string, asset stellar1.Asset) (string, error)
FormatAmountDescriptionAssetEx is a more verbose version of FormatAmountDescriptionAsset. In case of non-native asset, it includes issuer domain (or "Unknown") and issuer ID. Example: "157.5000000 XLM" Example: "1,000.15 CATS/catmoney.example.com (GDWVJEG7CMYKRYGB2MWSRZNSPCWIGGA4FRNFTQBIR6RAEPNEGGEH4XYZ)" Example: "1,000.15 BTC/Unknown (GBPEHURSE52GCBRPDWNV2VL3HRLCI42367OGRPBOO3AW6VAYEW5EO5PM)"
func FormatAmountDescriptionXLM ¶
func FormatAmountDescriptionXLM(mctx libkb.MetaContext, amount string) (string, error)
Example: "157.5000000 XLM"
func FormatAmountWithSuffix ¶
func FormatAssetIssuerString ¶
FormatAssetIssuerString returns "Unknown issuer" if asset does not have a verified domain, or returns asset verified domain if it does (e.g. "example.com").
func FormatCurrency ¶
func FormatCurrency(mctx libkb.MetaContext, amount string, code stellar1.OutsideCurrencyCode, rounding FmtRounding) (string, error)
func FormatCurrencyLabel ¶
func FormatCurrencyLabel(ctx context.Context, g *libkb.GlobalContext, code stellar1.OutsideCurrencyCode) (string, error)
func FormatCurrencyWithCodeSuffix ¶
func FormatCurrencyWithCodeSuffix(mctx libkb.MetaContext, amount string, code stellar1.OutsideCurrencyCode, rounding FmtRounding) (string, error)
FormatCurrencyWithCodeSuffix will return a fiat currency amount formatted with its currency code suffix at the end, like "$123.12 CLP"
func GetAccountDisplayCurrency ¶
func GetAccountDisplayCurrency(mctx libkb.MetaContext, accountID stellar1.AccountID) (res string, err error)
GetAccountDisplayCurrency gets currency setting from the server, and it returned currency is empty (NULL in database), then default "USD" is used. When creating a wallet, client always sets default currency setting. Also when a new account in existing wallet is created, it will inherit currency setting from primary account (this happens serverside). Empty currency settings should only happen in very old accounts or when wallet generation was interrupted in precise moment.
func GetCurrencySetting ¶
func GetCurrencySetting(mctx libkb.MetaContext, accountID stellar1.AccountID) (res stellar1.CurrencyLocal, err error)
func GetInflationDestination ¶
func GetInflationDestination(mctx libkb.MetaContext, accountID stellar1.AccountID) (res stellar1.InflationDestinationResultLocal, err error)
func GetOwnPrimaryAccountID ¶ added in v1.0.48
func GetOwnPrimaryAccountID(mctx libkb.MetaContext) (res stellar1.AccountID, err error)
func GetPredefinedInflationDestinations ¶
func GetPredefinedInflationDestinations(mctx libkb.MetaContext) (ret []stellar1.PredefinedInflationDestination, err error)
func HasAcceptedDisclaimer ¶
func ImportSecretKey ¶ added in v1.0.47
func InformAcceptedDisclaimer ¶
func InformAcceptedDisclaimer(ctx context.Context, g *libkb.GlobalContext)
func LookupRecipient ¶ added in v1.0.48
func LookupRecipient(m libkb.MetaContext, to stellarcommon.RecipientInput, isCLI bool) (res stellarcommon.Recipient, err error)
LookupRecipient finds a recipient. `to` can be a username, social assertion, account ID, or federation address.
func LookupSender ¶
func LookupSender(mctx libkb.MetaContext, accountID stellar1.AccountID) (stellar1.BundleEntry, stellar1.AccountBundle, error)
func LookupSenderPrimary ¶ added in v1.0.48
func LookupSenderPrimary(mctx libkb.MetaContext) (stellar1.BundleEntry, stellar1.AccountBundle, error)
func LookupSenderSeed ¶
func LookupSenderSeed(mctx libkb.MetaContext) (stellar1.AccountID, stellarnet.SeedStr, error)
func LookupUserByAccountID ¶
func LookupUserByAccountID(m libkb.MetaContext, accountID stellar1.AccountID) (uv keybase1.UserVersion, un libkb.NormalizedUsername, err error)
Lookup a user who has the stellar account ID. Verifies the result against the user's sigchain. If there are no users, or multiple users, returns NotFoundError.
func MakeRequestCLI ¶
func MakeRequestCLI(m libkb.MetaContext, remoter remote.Remoter, arg MakeRequestArg) (ret stellar1.KeybaseRequestID, err error)
func MakeRequestGUI ¶
func MakeRequestGUI(m libkb.MetaContext, remoter remote.Remoter, arg MakeRequestArg) (ret stellar1.KeybaseRequestID, err error)
func NoteDecryptB64 ¶ added in v1.0.48
func NoteDecryptB64(mctx libkb.MetaContext, noteB64 string) (res stellar1.NoteContents, err error)
func NoteEncryptB64 ¶ added in v1.0.48
func NoteEncryptB64(mctx libkb.MetaContext, note stellar1.NoteContents, other *keybase1.UserVersion) (noteB64 string, err error)
func OwnAccount ¶ added in v1.0.48
func PaymentDetailCLILocal ¶ added in v1.0.48
func PaymentDetailCLILocal(ctx context.Context, g *libkb.GlobalContext, remoter remote.Remoter, txID string) (res stellar1.PaymentCLILocal, err error)
func RandomBuildPaymentID ¶
func RandomBuildPaymentID() (stellar1.BuildPaymentID, error)
func RecentPaymentsCLILocal ¶ added in v1.0.48
func RecentPaymentsCLILocal(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (res []stellar1.PaymentOrErrorCLILocal, err error)
func RefreshUnreadCount ¶
func RefreshUnreadCount(g *libkb.GlobalContext, accountID stellar1.AccountID)
func RemotePendingToLocal ¶
func RemotePendingToLocal(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID, pending []stellar1.PaymentSummary) (payments []stellar1.PaymentOrErrorLocal, err error)
func RemoteRecentPaymentsToPage ¶
func RemoteRecentPaymentsToPage(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID, remotePage stellar1.PaymentsPage) (page stellar1.PaymentsPageLocal, err error)
func ReviewPaymentLocal ¶
func ReviewPaymentLocal(mctx libkb.MetaContext, stellarUI stellar1.UiInterface, arg stellar1.ReviewPaymentLocalArg) (err error)
func SendMiniChatPayments ¶
func SendMiniChatPayments(m libkb.MetaContext, walletState *WalletState, convID chat1.ConversationID, payments []libkb.MiniChatPayment) (res []libkb.MiniChatPaymentResult, err error)
SendMiniChatPayments sends multiple payments from one sender to multiple different recipients as fast as it can. These come from chat messages like "+1XLM@alice +2XLM@charlie".
func SendPaymentLocal ¶
func SendPaymentLocal(mctx libkb.MetaContext, arg stellar1.SendPaymentLocalArg) (res stellar1.SendPaymentResLocal, err error)
func ServiceInit ¶ added in v1.0.48
func ServiceInit(g *libkb.GlobalContext, walletState *WalletState, badger *badges.Badger)
func SetAccountAsPrimary ¶
func SetAccountAsPrimary(m libkb.MetaContext, accountID stellar1.AccountID) (err error)
func SetInflationDestinationLocal ¶
func SetInflationDestinationLocal(mctx libkb.MetaContext, arg stellar1.SetInflationDestinationLocalArg) (err error)
func SpecMiniChatPayments ¶
func SpecMiniChatPayments(mctx libkb.MetaContext, walletState *WalletState, payments []libkb.MiniChatPayment) (*libkb.MiniChatPaymentSummary, error)
SpecMiniChatPayments returns a summary of the payment amounts for each recipient and a total.
func StartBuildPaymentLocal ¶
func StartBuildPaymentLocal(mctx libkb.MetaContext) (res stellar1.BuildPaymentID, err error)
func StopBuildPaymentLocal ¶
func StopBuildPaymentLocal(mctx libkb.MetaContext, bid stellar1.BuildPaymentID)
func SubtractFeeSoft ¶
func SubtractFeeSoft(mctx libkb.MetaContext, availableStr string) string
Subtract a 100 stroop fee from the available balance. This shows the real available balance assuming an intent to send a 1 op tx. Does not error out, just shows the inaccurate answer.
func TransformPaymentSummaryAccount ¶
func TransformPaymentSummaryAccount(mctx libkb.MetaContext, p stellar1.PaymentSummary, oc OwnAccountLookupCache, accountID stellar1.AccountID) (*stellar1.PaymentLocal, error)
TransformPaymentSummaryAccount converts a stellar1.PaymentSummary (p) into a stellar1.PaymentLocal, from the perspective of an owner of accountID.
func TransformPaymentSummaryGeneric ¶
func TransformPaymentSummaryGeneric(mctx libkb.MetaContext, p stellar1.PaymentSummary, oc OwnAccountLookupCache) (*stellar1.PaymentLocal, error)
TransformPaymentSummaryGeneric converts a stellar1.PaymentSummary (p) into a stellar1.PaymentLocal, without any modifications based on who is viewing the transaction.
func TransformRequestDetails ¶
func TransformRequestDetails(mctx libkb.MetaContext, details stellar1.RequestDetails) (*stellar1.RequestDetailsLocal, error)
func TransformToAirdropStatus ¶
func TransformToAirdropStatus(status remote.AirdropStatusAPI) stellar1.AirdropStatus
TransformToAirdropStatus takes the result from api server status_check and transforms it into stellar1.AirdropStatus.
func Upkeep ¶
func Upkeep(mctx libkb.MetaContext) (err error)
Upkeep makes sure the bundle is encrypted for the user's latest PUK.
func WalletAccount ¶
func WalletAccount(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (stellar1.WalletAccountLocal, error)
WalletAccount returns stellar1.WalletAccountLocal for accountID.
Types ¶
type AccountState ¶
type AccountState struct { sync.RWMutex // protects everything that follows // contains filtered or unexported fields }
AccountState holds the current data for a stellar account.
func (*AccountState) AccountSeqno ¶
func (a *AccountState) AccountSeqno(ctx context.Context) (uint64, error)
AccountSeqno returns the seqno that has already been fetched for this account.
func (*AccountState) AccountSeqnoAndBump ¶
func (a *AccountState) AccountSeqnoAndBump(ctx context.Context) (uint64, error)
AccountSeqnoAndBump returns the seqno that has already been fetched for this account. It bumps the seqno up by one.
func (*AccountState) AddPendingTx ¶
func (a *AccountState) AddPendingTx(ctx context.Context, txID stellar1.TransactionID, seqno uint64) error
AddPendingTx adds information about a tx that was submitted to the network. This allows AccountState to keep track of anything pending when managing the account seqno.
func (*AccountState) Balances ¶
Balances returns the balances that have already been fetched for this account.
func (*AccountState) Details ¶
func (a *AccountState) Details(ctx context.Context) (stellar1.AccountDetails, error)
Details returns the account details that have already been fetched for this account.
func (*AccountState) ForceSeqnoRefresh ¶
func (a *AccountState) ForceSeqnoRefresh(mctx libkb.MetaContext) error
ForceSeqnoRefresh refreshes the seqno for an account.
func (*AccountState) PendingPayments ¶
func (a *AccountState) PendingPayments(ctx context.Context, limit int) ([]stellar1.PaymentSummary, error)
PendingPayments returns the pending payments that have already been fetched for this account.
func (*AccountState) RecentPayments ¶
func (a *AccountState) RecentPayments(ctx context.Context) (stellar1.PaymentsPage, error)
RecentPayments returns the recent payments that have already been fetched for this account.
func (*AccountState) Refresh ¶
func (a *AccountState) Refresh(mctx libkb.MetaContext, router *libkb.NotifyRouter, reason string) error
Refresh updates all the data for this account from the server.
func (*AccountState) RemovePendingTx ¶
func (a *AccountState) RemovePendingTx(ctx context.Context, txID stellar1.TransactionID) error
RemovePendingTx removes a pending tx from WalletState. It doesn't matter if it succeeded or failed, just that it is done.
func (*AccountState) Reset ¶
func (a *AccountState) Reset(mctx libkb.MetaContext)
Reset sets the refreshReqs channel to nil so nothing will be put on it.
func (*AccountState) String ¶
func (a *AccountState) String() string
String returns a small string representation of AccountState suitable for debug logging.
type AutoClaimRunner ¶
type AutoClaimRunner struct {
// contains filtered or unexported fields
}
Claims relay payments in the background. Threadsafe.
func NewAutoClaimRunner ¶
func NewAutoClaimRunner(walletState *WalletState) *AutoClaimRunner
func (*AutoClaimRunner) Kick ¶
func (r *AutoClaimRunner) Kick(mctx libkb.MetaContext, trigger gregor.MsgID)
Kick the processor into gear. It will run until all relays in the queue are claimed. And then dismiss the gregor message. `trigger` is optional, and is of the gregor message that caused the kick.
func (*AutoClaimRunner) Shutdown ¶
func (r *AutoClaimRunner) Shutdown(mctx libkb.MetaContext)
type BuildPaymentCache ¶
type BuildPaymentCache interface { OwnsAccount(libkb.MetaContext, stellar1.AccountID) (own bool, primary bool, err error) PrimaryAccount(libkb.MetaContext) (stellar1.AccountID, error) // AccountSeqno should be cached _but_ it should also be busted asap. // Because it is used to prevent users from sending payments twice in a row. AccountSeqno(libkb.MetaContext, stellar1.AccountID) (string, error) IsAccountFunded(libkb.MetaContext, stellar1.AccountID) (bool, error) LookupRecipient(libkb.MetaContext, stellarcommon.RecipientInput) (stellarcommon.Recipient, error) GetOutsideExchangeRate(libkb.MetaContext, stellar1.OutsideCurrencyCode) (stellar1.OutsideExchangeRate, error) AvailableXLMToSend(libkb.MetaContext, stellar1.AccountID) (string, error) GetOutsideCurrencyPreference(libkb.MetaContext, stellar1.AccountID) (stellar1.OutsideCurrencyCode, error) }
BuildPaymentCache has helpers for getting information quickly when building a payment. Methods should err on the side of performance rather at the cost of serialization. CORE-8119: But they don't yet.
type CreateWalletGatedResult ¶
type CreateWalletGatedResult struct { JustCreated bool // whether the user's wallet was created by this call HasWallet bool // whether the user now has a wallet AcceptedDisclaimer bool // whether the user has accepted the disclaimer ErrorCreating error // error encountered while attempting to create the wallet }
func CreateWalletGated ¶
func CreateWalletGated(mctx libkb.MetaContext) (res CreateWalletGatedResult, err error)
CreateWalletGated may create a wallet for the user. Taking into account settings from the server. It should be speedy to call repeatedly _if_ the user gets a wallet.
type DisplayBalance ¶
type FmtRounding ¶
type FmtRounding bool
type Loader ¶
type Loader struct { libkb.Contextified sync.Mutex // contains filtered or unexported fields }
func DefaultLoader ¶
func DefaultLoader(g *libkb.GlobalContext) *Loader
func NewLoader ¶
func NewLoader(g *libkb.GlobalContext) *Loader
func (*Loader) GetListener ¶
func (p *Loader) GetListener() (id string, ch chan PaymentStatusUpdate, err error)
GetListener returns a channel and an ID for a payment status listener. The ID can be used to remove the listener from the loader.
func (*Loader) LoadPayment ¶
func (*Loader) LoadRequest ¶
func (p *Loader) LoadRequest(ctx context.Context, convID chat1.ConversationID, msgID chat1.MessageID, senderUsername string, requestID stellar1.KeybaseRequestID) *chat1.UIRequestInfo
func (*Loader) RemoveListener ¶
RemoveListener removes a listener from the loader when it is no longer needed.
func (*Loader) UpdatePayment ¶
UpdatePayment schedules a load of paymentID. Gregor status notification handlers should call this to update the payment data.
func (*Loader) UpdateRequest ¶
func (p *Loader) UpdateRequest(ctx context.Context, requestID stellar1.KeybaseRequestID)
UpdateRequest schedules a load for requestID. Gregor status notification handlers should call this to update the request data.
type MakeRequestArg ¶
type MakeRequestArg struct { To stellarcommon.RecipientInput Amount string Asset *stellar1.Asset Currency *stellar1.OutsideCurrencyCode Note string }
type MiniPrepared ¶
type MiniPrepared struct { Username libkb.NormalizedUsername Direct *stellar1.PaymentDirectPost Relay *stellar1.PaymentRelayPost TxID stellar1.TransactionID Seqno uint64 Error error }
func PrepareBatchPayments ¶
func PrepareBatchPayments(mctx libkb.MetaContext, walletState *WalletState, senderSeed stellarnet.SeedStr, payments []stellar1.BatchPaymentArg) ([]*MiniPrepared, error)
PrepareBatchPayments prepares a list of payments to be submitted. Each payment is prepared concurrently. (this is an exposed function to make testing from outside this package easier)
func PrepareMiniChatPayments ¶
func PrepareMiniChatPayments(m libkb.MetaContext, walletState *WalletState, senderSeed stellarnet.SeedStr, convID chat1.ConversationID, payments []libkb.MiniChatPayment) ([]*MiniPrepared, error)
type OwnAccountLookupCache ¶
type OwnAccountLookupCache interface {
OwnAccount(ctx context.Context, accountID stellar1.AccountID) (own bool, accountName string, err error)
}
Short-lived cache for looking up whether the logged-in user owns accounts.
func NewOwnAccountLookupCache ¶
func NewOwnAccountLookupCache(mctx libkb.MetaContext) OwnAccountLookupCache
NewOwnAccountLookupCache fetches the list of accounts in the background and stores them.
type PaymentStatusUpdate ¶
type PaymentStatusUpdate struct { AccountID stellar1.AccountID TxID stellar1.TransactionID Status stellar1.PaymentStatus }
type SendPaymentArg ¶
type SendPaymentArg struct { From stellar1.AccountID // Optional. Defaults to primary account. To stellarcommon.RecipientInput Amount string // Amount of XLM to send. DisplayBalance DisplayBalance SecretNote string // Optional. PublicMemo string // Optional. ForceRelay bool QuickReturn bool }
type SendPaymentResult ¶
type SendPaymentResult struct { KbTxID stellar1.KeybaseTransactionID // Direct: tx ID of the payment tx // Relay : tx ID of the funding payment tx TxID stellar1.TransactionID Pending bool // Implicit team that the relay secret is encrypted for. // Present if this was a relay transfer. RelayTeamID *keybase1.TeamID }
func SendPaymentCLI ¶
func SendPaymentCLI(m libkb.MetaContext, walletState *WalletState, sendArg SendPaymentArg) (res SendPaymentResult, err error)
SendPaymentCLI sends XLM from CLI.
func SendPaymentGUI ¶
func SendPaymentGUI(m libkb.MetaContext, walletState *WalletState, sendArg SendPaymentArg) (res SendPaymentResult, err error)
SendPaymentGUI sends XLM from GUI.
type SeqnoProvider ¶ added in v1.0.48
type SeqnoProvider struct {
// contains filtered or unexported fields
}
SeqnoProvider implements build.SequenceProvider. It can be used for several transactions in a row.
func NewSeqnoProvider ¶ added in v1.0.48
func NewSeqnoProvider(mctx libkb.MetaContext, walletState *WalletState) *SeqnoProvider
NewSeqnoProvider creates a SeqnoProvider.
func (*SeqnoProvider) SequenceForAccount ¶ added in v1.0.48
func (s *SeqnoProvider) SequenceForAccount(aid string) (xdr.SequenceNumber, error)
SequenceForAccount implements build.SequenceProvider.
type Stellar ¶ added in v1.0.48
type Stellar struct { libkb.Contextified // contains filtered or unexported fields }
func NewStellar ¶ added in v1.0.48
func NewStellar(g *libkb.GlobalContext, walletState *WalletState, badger *badges.Badger) *Stellar
func (*Stellar) CachedHasWallet ¶
func (*Stellar) CreateWalletSoft ¶ added in v1.0.48
func (*Stellar) GetMigrationLock ¶
func (*Stellar) GetServerDefinitions ¶
func (*Stellar) HandleOobm ¶
HandleOobm will handle any out of band gregor messages for stellar.
func (*Stellar) InformHasWallet ¶
func (s *Stellar) InformHasWallet(ctx context.Context, uv keybase1.UserVersion)
func (*Stellar) KickAutoClaimRunner ¶
func (s *Stellar) KickAutoClaimRunner(mctx libkb.MetaContext, trigger gregor.MsgID)
`trigger` is optional, and is of the gregor message that caused the kick.
func (*Stellar) RemovePendingTx ¶
func (s *Stellar) RemovePendingTx(mctx libkb.MetaContext, accountID stellar1.AccountID, txID stellar1.TransactionID) error
func (*Stellar) SendMiniChatPayments ¶
func (s *Stellar) SendMiniChatPayments(mctx libkb.MetaContext, convID chat1.ConversationID, payments []libkb.MiniChatPayment) ([]libkb.MiniChatPaymentResult, error)
SendMiniChatPayments sends multiple payments from one sender to multiple different recipients as fast as it can. These come from chat messages like "+1XLM@alice +2XLM@charlie".
func (*Stellar) SetFederationClientForTest ¶
func (s *Stellar) SetFederationClientForTest(cli federation.ClientInterface)
func (*Stellar) SpecMiniChatPayments ¶
func (s *Stellar) SpecMiniChatPayments(mctx libkb.MetaContext, payments []libkb.MiniChatPayment) (*libkb.MiniChatPaymentSummary, error)
SpecMiniChatPayments creates a summary of the amounts that a list of MiniChatPayments will result in.
type WalletState ¶
type WalletState struct { libkb.Contextified remote.Remoter sync.Mutex // contains filtered or unexported fields }
WalletState holds all the current data for all the accounts for the user. It is also a remote.Remoter and should be used in place of it so network calls can be avoided.
func NewWalletState ¶
func NewWalletState(g *libkb.GlobalContext, r remote.Remoter) *WalletState
NewWalletState creates a wallet state with a remoter that will be used for any network calls.
func (*WalletState) AccountSeqno ¶
func (w *WalletState) AccountSeqno(ctx context.Context, accountID stellar1.AccountID) (uint64, error)
AccountSeqno is an override of remoter's AccountSeqno that uses the stored value.
func (*WalletState) AccountSeqnoAndBump ¶
func (w *WalletState) AccountSeqnoAndBump(ctx context.Context, accountID stellar1.AccountID) (uint64, error)
AccountSeqnoAndBump gets the current seqno for an account and increments the stored value.
func (*WalletState) AddPendingTx ¶
func (w *WalletState) AddPendingTx(ctx context.Context, accountID stellar1.AccountID, txID stellar1.TransactionID, seqno uint64) error
AddPendingTx adds information about a tx that was submitted to the network. This allows WalletState to keep track of anything pending when managing the account seqno.
func (*WalletState) Balances ¶
func (w *WalletState) Balances(ctx context.Context, accountID stellar1.AccountID) ([]stellar1.Balance, error)
Balances is an override of remoter's Balances that uses stored data.
func (*WalletState) Details ¶
func (w *WalletState) Details(ctx context.Context, accountID stellar1.AccountID) (stellar1.AccountDetails, error)
Details is an override of remoter's Details that uses stored data.
func (*WalletState) DumpToLog ¶
func (w *WalletState) DumpToLog(mctx libkb.MetaContext)
DumpToLog outputs a summary of WalletState to the debug log.
func (*WalletState) ExchangeRate ¶
func (w *WalletState) ExchangeRate(ctx context.Context, currency string) (stellar1.OutsideExchangeRate, error)
ExchangeRate is an overrider of remoter's ExchangeRate.
func (*WalletState) ForceSeqnoRefresh ¶
func (w *WalletState) ForceSeqnoRefresh(mctx libkb.MetaContext, accountID stellar1.AccountID) error
ForceSeqnoRefresh refreshes the seqno for an account.
func (*WalletState) MarkAsRead ¶
func (w *WalletState) MarkAsRead(ctx context.Context, accountID stellar1.AccountID, mostRecentID stellar1.TransactionID) error
MarkAsRead is an override of remoter's MarkAsRead.
func (*WalletState) PendingPayments ¶
func (w *WalletState) PendingPayments(ctx context.Context, accountID stellar1.AccountID, limit int) ([]stellar1.PaymentSummary, error)
PendingPayments is an override of remoter's PendingPayments that uses stored data.
func (*WalletState) Primed ¶
func (w *WalletState) Primed() bool
Primed returns true if the WalletState has been refreshed.
func (*WalletState) RecentPayments ¶
func (w *WalletState) RecentPayments(ctx context.Context, accountID stellar1.AccountID, cursor *stellar1.PageCursor, limit int, skipPending bool) (stellar1.PaymentsPage, error)
RecentPayments is an override of remoter's RecentPayments that uses stored data.
func (*WalletState) Refresh ¶
func (w *WalletState) Refresh(mctx libkb.MetaContext, accountID stellar1.AccountID, reason string) error
Refresh gets all the data from the server for an account.
func (*WalletState) RefreshAll ¶
func (w *WalletState) RefreshAll(mctx libkb.MetaContext, reason string) error
RefreshAll refreshes all the accounts.
func (*WalletState) RemovePendingTx ¶
func (w *WalletState) RemovePendingTx(ctx context.Context, accountID stellar1.AccountID, txID stellar1.TransactionID) error
RemovePendingTx removes a pending tx from WalletState. It doesn't matter if it succeeded or failed, just that it is done.
func (*WalletState) Reset ¶
func (w *WalletState) Reset(mctx libkb.MetaContext)
Reset clears all the data in the WalletState.
func (*WalletState) Shutdown ¶
func (w *WalletState) Shutdown() error
Shutdown terminates any background operations and cleans up.
func (*WalletState) String ¶
func (w *WalletState) String() string
String returns a string representation of WalletState suitable for debug logging.
func (*WalletState) SubmitRelayClaim ¶
func (w *WalletState) SubmitRelayClaim(ctx context.Context, post stellar1.RelayClaimPost) (stellar1.RelayClaimResult, error)
SubmitRelayClaim is an override of remoter's SubmitRelayClaim.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
this file is for the implementation of all the frontend-requested service endpoints for wallets.
|
this file is for the implementation of all the frontend-requested service endpoints for wallets. |