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 AddTrustlineLocal(mctx libkb.MetaContext, arg stellar1.AddTrustlineLocalArg) (err error)
- func AirdropStatus(mctx libkb.MetaContext) (stellar1.AirdropStatus, error)
- func AllWalletAccounts(mctx libkb.MetaContext, remoter remote.Remoter) ([]stellar1.WalletAccountLocal, error)
- func AssetSliceToAssetBase(path []stellar1.Asset) []stellarnet.AssetBase
- func Batch(mctx libkb.MetaContext, walletState *WalletState, arg stellar1.BatchLocalArg) (res stellar1.BatchResultLocal, err error)
- func BatchMulti(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, walletState *WalletState, accountID stellar1.AccountID, ...) (err error)
- func ChangeTrustlineLimitLocal(mctx libkb.MetaContext, arg stellar1.ChangeTrustlineLimitLocalArg) (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 DeleteTrustlineLocal(mctx libkb.MetaContext, arg stellar1.DeleteTrustlineLocalArg) (err error)
- func EmptyAmountStack(mctx libkb.MetaContext)
- func ExportSecretKey(mctx libkb.MetaContext, accountID stellar1.AccountID) (res stellar1.SecretKey, err error)
- func FindPaymentPath(mctx libkb.MetaContext, remoter remote.Remoter, source stellar1.AccountID, ...) (stellar1.PaymentPath, error)
- func FormatAmount(mctx libkb.MetaContext, amount string, precisionTwo bool, ...) (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 FormatAmountDescriptionAssetEx2(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 FormatCurrencyWithCodeSuffix(mctx libkb.MetaContext, amount string, code stellar1.OutsideCurrencyCode, ...) (string, error)
- func FuzzyAssetSearch(mctx libkb.MetaContext, remoter remote.Remoter, ...) ([]stellar1.Asset, 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 GetSendAssetChoicesLocal(mctx libkb.MetaContext, remoter remote.Remoter, ...) (res []stellar1.SendAssetChoiceLocal, 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 ListPopularAssets(mctx libkb.MetaContext, remoter remote.Remoter, ...) (stellar1.AssetListResult, error)
- 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 OwnAccountCached(mctx libkb.MetaContext, accountID stellar1.AccountID) (own, isPrimary bool, err error)
- func PathPaymentTx(mctx libkb.MetaContext, walletState *WalletState, sendArg SendPathPaymentArg) (*stellarnet.SignResult, *stellar1.BundleEntry, *stellarcommon.Recipient, 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, walletState *WalletState, accountID stellar1.AccountID) (err error)
- func SetInflationDestinationLocal(mctx libkb.MetaContext, arg stellar1.SetInflationDestinationLocalArg) (err error)
- func ShouldOfferAdvancedSend(mctx libkb.MetaContext, remoter remote.Remoter, from, to stellar1.AccountID) (shouldShow stellar1.AdvancedBanner, 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, baseFee uint64) 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) SeqnoDebug(mctx libkb.MetaContext)
- func (a *AccountState) String() string
- type AccountsCache
- type AutoClaimRunner
- type BuildPaymentCache
- type ClaimSeqnoProvider
- type CreateWalletGatedResult
- type DisplayBalance
- type Loader
- func (p *Loader) GetListener() (id string, ch chan PaymentStatusUpdate, err error)
- func (p *Loader) GetPaymentLocal(ctx context.Context, paymentID stellar1.PaymentID) (*stellar1.PaymentLocal, bool)
- func (p *Loader) LoadPayment(ctx context.Context, convID chat1.ConversationID, msgID chat1.MessageID, ...) *chat1.UIPaymentInfo
- func (p *Loader) LoadPaymentSync(ctx context.Context, paymentID stellar1.PaymentID)
- func (p *Loader) LoadRequest(ctx context.Context, convID chat1.ConversationID, msgID chat1.MessageID, ...) *chat1.UIRequestInfo
- func (p *Loader) PaymentsLen() int
- func (p *Loader) RemoveListener(id string)
- func (p *Loader) RequestsLen() int
- 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 Options
- type OwnAccountLookupCache
- type PaymentStatusUpdate
- type SendPathPaymentArg
- type SendPaymentArg
- type SendPaymentResult
- func SendPathPaymentCLI(mctx libkb.MetaContext, walletState *WalletState, sendArg SendPathPaymentArg) (res SendPaymentResult, err error)
- func SendPathPaymentGUI(mctx libkb.MetaContext, walletState *WalletState, sendArg SendPathPaymentArg) (res SendPaymentResult, err error)
- func SendPaymentCLI(m libkb.MetaContext, walletState *WalletState, sendArg SendPaymentArg) (res SendPaymentResult, err error)
- func SendPaymentGUI(m libkb.MetaContext, walletState *WalletState, sendArg SendPaymentArg) (res SendPaymentResult, err error)
- type SeqnoProvider
- type Stellar
- func (s *Stellar) BaseFee(mctx libkb.MetaContext) uint64
- func (s *Stellar) CachedHasWallet(ctx context.Context, uv keybase1.UserVersion) bool
- func (s *Stellar) Clear(mctx libkb.MetaContext)
- func (s *Stellar) CreateWalletSoft(ctx context.Context)
- 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) InformBundle(mctx libkb.MetaContext, rev stellar1.BundleRevision, ...)
- func (s *Stellar) InformDefaultCurrencyChange(mctx libkb.MetaContext)
- func (s *Stellar) InformHasWallet(ctx context.Context, uv keybase1.UserVersion)
- func (s *Stellar) KickAutoClaimRunner(mctx libkb.MetaContext, trigger gregor.MsgID)
- func (s *Stellar) KnownCurrencyCodeInstant(ctx context.Context, code string) (known, ok bool)
- func (s *Stellar) OnDbNuke(mctx libkb.MetaContext) error
- func (s *Stellar) OnLogout(mctx libkb.MetaContext) error
- func (s *Stellar) OwnAccountCached(mctx libkb.MetaContext, accountID stellar1.AccountID) (own, isPrimary bool, err error)
- 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
- func (s *Stellar) WalletStateForTest() *WalletState
- type TimeCache
- func (c *TimeCache) Clear()
- func (c *TimeCache) Get(mctx libkb.MetaContext, key string, into interface{}) (ok bool)
- func (c *TimeCache) GetWithFill(mctx libkb.MetaContext, key string, into interface{}, fill cacheFillFunc) error
- func (c *TimeCache) Put(mctx libkb.MetaContext, key string, val interface{})
- type WalletState
- func (w *WalletState) AccountMode(accountID stellar1.AccountID) (stellar1.AccountMode, error)
- func (w *WalletState) AccountName(accountID stellar1.AccountID) (string, error)
- 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) BaseFee(mctx libkb.MetaContext) uint64
- 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) IsPrimary(accountID stellar1.AccountID) (bool, 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, arg remote.RecentPaymentsArg) (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) RefreshAsync(mctx libkb.MetaContext, accountID stellar1.AccountID, 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) SeqnoLock()
- func (w *WalletState) SeqnoUnlock()
- func (w *WalletState) Shutdown() error
- func (w *WalletState) String() string
- func (w *WalletState) SubmitPayment(ctx context.Context, post stellar1.PaymentDirectPost) (stellar1.PaymentResult, error)
- func (w *WalletState) SubmitRelayClaim(ctx context.Context, post stellar1.RelayClaimPost) (stellar1.RelayClaimResult, error)
- func (w *WalletState) SubmitRelayPayment(ctx context.Context, post stellar1.PaymentRelayPost) (stellar1.PaymentResult, error)
- func (w *WalletState) UpdateAccountEntries(mctx libkb.MetaContext, reason string) (err error)
- func (w *WalletState) UpdateAccountEntriesWithBundle(mctx libkb.MetaContext, reason string, bundle *stellar1.Bundle) (err error)
Constants ¶
const AccountNameMaxRunes = 24
const DefaultCurrencySetting = "USD"
Variables ¶
var ErrAccountNotFound = errors.New("account not found for user")
ErrAccountNotFound is returned when the account is not in WalletState's accounts map.
var ErrRefreshQueueFull = errors.New("refresh queue is full")
ErrRefreshQueueFull is returned when the refresh queue is clogged up.
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 AddTrustlineLocal ¶
func AddTrustlineLocal(mctx libkb.MetaContext, arg stellar1.AddTrustlineLocalArg) (err error)
func AirdropStatus ¶
func AirdropStatus(mctx libkb.MetaContext) (stellar1.AirdropStatus, error)
func AllWalletAccounts ¶
func AllWalletAccounts(mctx libkb.MetaContext, remoter remote.Remoter) ([]stellar1.WalletAccountLocal, error)
func AssetSliceToAssetBase ¶
func AssetSliceToAssetBase(path []stellar1.Asset) []stellarnet.AssetBase
AssetSliceToAssetBase converts []stellar1.Asset to []stellarnet.AssetBase.
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 BatchMulti ¶
func BatchMulti(mctx libkb.MetaContext, walletState *WalletState, arg stellar1.BatchLocalArg) (res stellar1.BatchResultLocal, err error)
BatchMulti sends a batch of payments from the user to multiple recipients in a single multi-operation transaction.
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, walletState *WalletState, 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 ChangeTrustlineLimitLocal ¶
func ChangeTrustlineLimitLocal(mctx libkb.MetaContext, arg stellar1.ChangeTrustlineLimitLocalArg) (err error)
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 DeleteTrustlineLocal ¶
func DeleteTrustlineLocal(mctx libkb.MetaContext, arg stellar1.DeleteTrustlineLocalArg) (err error)
func EmptyAmountStack ¶
func EmptyAmountStack(mctx libkb.MetaContext)
func ExportSecretKey ¶ added in v1.0.48
func FindPaymentPath ¶
func FormatAmount ¶
func FormatAmount(mctx libkb.MetaContext, amount string, precisionTwo bool, rounding stellarnet.FmtRoundingBehavior) (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 FormatAmountDescriptionAssetEx2 ¶
func FormatAmountDescriptionAssetEx2(mctx libkb.MetaContext, amount string, asset stellar1.Asset) (string, error)
FormatAmountDescriptionAssetEx2 is like FormatAmountDescriptionAssetEx, except that it only shows one of issuer domain and issuer account ID. When issuer domain is available, the domain is shown. Otherwise account ID is used. Example: "157.5000000 XLM" Example: "1,000.15 CATS/catmoney.example.com Example: "1,000.15 BTC/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 stellarnet.FmtRoundingBehavior) (string, error)
func FormatCurrencyWithCodeSuffix ¶
func FormatCurrencyWithCodeSuffix(mctx libkb.MetaContext, amount string, code stellar1.OutsideCurrencyCode, rounding stellarnet.FmtRoundingBehavior) (string, error)
FormatCurrencyWithCodeSuffix will return a fiat currency amount formatted with its currency code suffix at the end, like "$123.12 CLP"
func FuzzyAssetSearch ¶
func FuzzyAssetSearch(mctx libkb.MetaContext, remoter remote.Remoter, arg stellar1.FuzzyAssetSearchArg) ([]stellar1.Asset, error)
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 GetSendAssetChoicesLocal ¶
func GetSendAssetChoicesLocal(mctx libkb.MetaContext, remoter remote.Remoter, arg stellar1.GetSendAssetChoicesLocalArg) (res []stellar1.SendAssetChoiceLocal, err error)
func HasAcceptedDisclaimer ¶
func ImportSecretKey ¶ added in v1.0.47
func InformAcceptedDisclaimer ¶
func InformAcceptedDisclaimer(ctx context.Context, g *libkb.GlobalContext)
func ListPopularAssets ¶
func ListPopularAssets(mctx libkb.MetaContext, remoter remote.Remoter, arg stellar1.ListPopularAssetsArg) (stellar1.AssetListResult, error)
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 OwnAccountCached ¶
func PathPaymentTx ¶
func PathPaymentTx(mctx libkb.MetaContext, walletState *WalletState, sendArg SendPathPaymentArg) (*stellarnet.SignResult, *stellar1.BundleEntry, *stellarcommon.Recipient, error)
PathPaymentTx reutrns a signed path payment tx.
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, walletState *WalletState, accountID stellar1.AccountID) (err error)
func SetInflationDestinationLocal ¶
func SetInflationDestinationLocal(mctx libkb.MetaContext, arg stellar1.SetInflationDestinationLocalArg) (err error)
func ShouldOfferAdvancedSend ¶
func ShouldOfferAdvancedSend(mctx libkb.MetaContext, remoter remote.Remoter, from, to stellar1.AccountID) (shouldShow stellar1.AdvancedBanner, 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, baseFee uint64) string
Subtract baseFee 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) SeqnoDebug ¶
func (a *AccountState) SeqnoDebug(mctx libkb.MetaContext)
SeqnoDebug outputs some information about the seqno state.
func (*AccountState) String ¶
func (a *AccountState) String() string
String returns a small string representation of AccountState suitable for debug logging.
type AccountsCache ¶
type AccountsCache struct { Stored time.Time Revision stellar1.BundleRevision Accounts []stellar1.BundleEntry }
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 { 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, stellar1.BuildPaymentID) (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.BuildPaymentID) (stellar1.OutsideCurrencyCode, error) ShouldOfferAdvancedSend(mctx libkb.MetaContext, from, to stellar1.AccountID) (stellar1.AdvancedBanner, error) InformDefaultCurrencyChange(mctx libkb.MetaContext) }
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 ClaimSeqnoProvider ¶
type ClaimSeqnoProvider struct {
// contains filtered or unexported fields
}
ClaimSeqnoProvider is a build.SequenceProvider for relay claims. It should only be used for relay claims.
It only uses the network and skips any of the work in WalletState to keep track of in-use seqnos for multiple concurrent payments.
It also returns an `unlock` function that must be called after the operation that used this seqno provider has been submitted.
func NewClaimSeqnoProvider ¶
func NewClaimSeqnoProvider(mctx libkb.MetaContext, walletState *WalletState) (seqnoProvider *ClaimSeqnoProvider, unlock func())
NewClaimSeqnoProvider creates a ClaimSeqnoProvider for use in relay claims.
func (*ClaimSeqnoProvider) SequenceForAccount ¶
func (s *ClaimSeqnoProvider) SequenceForAccount(aid string) (xdr.SequenceNumber, error)
SequenceForAccount implements build.SequenceProvider.
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 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) GetPaymentLocal ¶
func (*Loader) LoadPayment ¶
func (*Loader) LoadPaymentSync ¶
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) PaymentsLen ¶
func (*Loader) RemoveListener ¶
RemoveListener removes a listener from the loader when it is no longer needed.
func (*Loader) RequestsLen ¶
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, batchID string) ([]*MiniPrepared, func(), 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, func(), error)
type Options ¶
Options holds dynamic options for clients to use when preparing stellar transactions.
func NewOptions ¶
func NewOptions() *Options
func (*Options) NetworkOptions ¶
func (o *Options) NetworkOptions(mctx libkb.MetaContext, r remote.Remoter) stellar1.NetworkOptions
NetworkOptions returns stellar1.NetworkOptions that is less than 1 hour old.
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. Was created before Stellar.accounts, and could probably benefit from using that cache.
type PaymentStatusUpdate ¶
type PaymentStatusUpdate struct { AccountID stellar1.AccountID TxID stellar1.TransactionID Status stellar1.PaymentStatus }
type SendPathPaymentArg ¶
type SendPathPaymentArg struct { From stellar1.AccountID To stellarcommon.RecipientInput Path stellar1.PaymentPath SecretNote string PublicMemo *stellarnet.Memo QuickReturn bool }
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 *stellarnet.Memo // 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 JumpToChat string }
func SendPathPaymentCLI ¶
func SendPathPaymentCLI(mctx libkb.MetaContext, walletState *WalletState, sendArg SendPathPaymentArg) (res SendPaymentResult, err error)
SendPathPaymentCLI sends a path payment from CLI.
func SendPathPaymentGUI ¶
func SendPathPaymentGUI(mctx libkb.MetaContext, walletState *WalletState, sendArg SendPathPaymentArg) (res SendPaymentResult, err error)
SendPathPaymentGUI sends a path payment from GUI.
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 *SeqnoProvider, unlock func())
NewSeqnoProvider creates a SeqnoProvider. It also returns an `unlock` function that must be called after the operation(s) that used this seqno provider have been submitted.
The idea here is to fix a race where multiple calls to send payments will make a SeqnoProvider and while they will consume seqnos in order, they are not guaranteed to be submitted in order. In particular, the `dust storm` function in the bot has a tendency to expose the race.
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) BaseFee ¶
func (s *Stellar) BaseFee(mctx libkb.MetaContext) uint64
BaseFee returns the server-suggested base fee per operation.
func (*Stellar) CachedHasWallet ¶
func (*Stellar) Clear ¶
func (s *Stellar) Clear(mctx libkb.MetaContext)
func (*Stellar) CreateWalletSoft ¶ added in v1.0.48
func (*Stellar) GetServerDefinitions ¶
func (*Stellar) HandleOobm ¶
HandleOobm will handle any out of band gregor messages for stellar.
func (*Stellar) InformBundle ¶
func (s *Stellar) InformBundle(mctx libkb.MetaContext, rev stellar1.BundleRevision, accounts []stellar1.BundleEntry)
func (*Stellar) InformDefaultCurrencyChange ¶
func (s *Stellar) InformDefaultCurrencyChange(mctx libkb.MetaContext)
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) KnownCurrencyCodeInstant ¶
func (*Stellar) OnLogout ¶ added in v1.0.48
func (s *Stellar) OnLogout(mctx libkb.MetaContext) error
func (*Stellar) OwnAccountCached ¶
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.
func (*Stellar) UpdateUnreadCount ¶
func (s *Stellar) UpdateUnreadCount(ctx context.Context, accountID stellar1.AccountID, unread int) error
UpdateUnreadCount will take the unread count for an account id and update the badger.
func (*Stellar) WalletStateForTest ¶
func (s *Stellar) WalletStateForTest() *WalletState
type TimeCache ¶
type TimeCache struct {
// contains filtered or unexported fields
}
Threadsafe cache with expiration and singleflighting.
func (*TimeCache) Get ¶
func (c *TimeCache) Get(mctx libkb.MetaContext, key string, into interface{}) (ok bool)
func (*TimeCache) GetWithFill ¶
func (c *TimeCache) GetWithFill(mctx libkb.MetaContext, key string, into interface{}, fill cacheFillFunc) error
GetWithFill is prefereable to Get because it holds a locktab lock during the fill. Which prevents concurrent accesses from doing the extra work of running fill at the same time.
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) AccountMode ¶
func (w *WalletState) AccountMode(accountID stellar1.AccountID) (stellar1.AccountMode, error)
AccountMode returns the mode of the account (USER or MOBILE). MOBILE accounts can only get access to the secret key from a mobile device.
func (*WalletState) AccountName ¶
func (w *WalletState) AccountName(accountID stellar1.AccountID) (string, error)
AccountName returns the name for an account.
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) BaseFee ¶
func (w *WalletState) BaseFee(mctx libkb.MetaContext) uint64
BaseFee returns stellard's current suggestion for the base operation fee.
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) IsPrimary ¶
func (w *WalletState) IsPrimary(accountID stellar1.AccountID) (bool, error)
IsPrimary returns true if an account is the primary account for the user.
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, arg remote.RecentPaymentsArg) (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) RefreshAsync ¶
func (w *WalletState) RefreshAsync(mctx libkb.MetaContext, accountID stellar1.AccountID, reason string) error
RefreshAsync makes a request to refresh an account in the background. It clears the refresh time to ensure that a refresh happens/
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) SeqnoLock ¶
func (w *WalletState) SeqnoLock()
SeqnoLock acquires a lock on seqno operations. NewSeqnoProvider calls it. After all operations with a seqno provider are done (i.e. fully submitted to stellard), then the lock should be released with SeqnoUnlock.
func (*WalletState) SeqnoUnlock ¶
func (w *WalletState) SeqnoUnlock()
SeqnoUnlock releases the lock on seqno operations.
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) SubmitPayment ¶
func (w *WalletState) SubmitPayment(ctx context.Context, post stellar1.PaymentDirectPost) (stellar1.PaymentResult, error)
SubmitPayment is an override of remoter's SubmitPayment.
func (*WalletState) SubmitRelayClaim ¶
func (w *WalletState) SubmitRelayClaim(ctx context.Context, post stellar1.RelayClaimPost) (stellar1.RelayClaimResult, error)
SubmitRelayClaim is an override of remoter's SubmitRelayClaim.
func (*WalletState) SubmitRelayPayment ¶
func (w *WalletState) SubmitRelayPayment(ctx context.Context, post stellar1.PaymentRelayPost) (stellar1.PaymentResult, error)
SubmitRelayPayment is an override of remoter's SubmitRelayPayment.
func (*WalletState) UpdateAccountEntries ¶
func (w *WalletState) UpdateAccountEntries(mctx libkb.MetaContext, reason string) (err error)
UpdateAccountEntries gets the bundle from the server and updates the individual account entries with the server's bundle information.
func (*WalletState) UpdateAccountEntriesWithBundle ¶
func (w *WalletState) UpdateAccountEntriesWithBundle(mctx libkb.MetaContext, reason string, bundle *stellar1.Bundle) (err error)
UpdateAccountEntriesWithBundle updates the individual account entries with the bundle information.
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. |