Documentation ¶
Index ¶
- Constants
- func AccountExchangeRate(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (stellar1.OutsideExchangeRate, error)
- func ChangeAccountName(m libkb.MetaContext, accountID stellar1.AccountID, newName string) (err error)
- func ChatSendPaymentMessage(m libkb.MetaContext, recipient stellarcommon.Recipient, ...) error
- func Claim(ctx context.Context, g *libkb.GlobalContext, remoter remote.Remoter, ...) (res stellar1.RelayClaimResult, err error)
- func CreateNewAccount(m libkb.MetaContext, accountName string) (ret stellar1.AccountID, err error)
- func CreateWallet(ctx context.Context, g *libkb.GlobalContext) (created bool, err error)
- func CreateWalletGated(ctx context.Context, g *libkb.GlobalContext) (justCreated, hasWallet bool, err error)
- func CreateWalletSoft(ctx context.Context, g *libkb.GlobalContext)
- func DeleteAccount(m libkb.MetaContext, accountID stellar1.AccountID) error
- func ExportSecretKey(ctx context.Context, g *libkb.GlobalContext, accountID stellar1.AccountID) (res stellar1.SecretKey, err error)
- func FormatAmount(amount string, precisionTwo bool) (string, error)
- func FormatAmountWithSuffix(amount string, precisionTwo bool, simplify bool, suffix string) (string, error)
- func FormatAmountXLM(amount string) (string, error)
- func FormatCurrency(ctx context.Context, g *libkb.GlobalContext, amount string, ...) (string, error)
- func FormatCurrencyLabel(ctx context.Context, g *libkb.GlobalContext, code stellar1.OutsideCurrencyCode) (string, error)
- func FormatPaymentAmountXLM(amount string, delta stellar1.BalanceDelta) (string, error)
- func GetAccountDisplayCurrency(mctx libkb.MetaContext, accountID stellar1.AccountID) (res string, err error)
- func GetCurrencySetting(mctx libkb.MetaContext, remoter remote.Remoter, accountID stellar1.AccountID) (res stellar1.CurrencyLocal, err error)
- func GetOwnPrimaryAccountID(ctx context.Context, g *libkb.GlobalContext) (res stellar1.AccountID, err error)
- func ImportSecretKey(ctx context.Context, g *libkb.GlobalContext, secretKey stellar1.SecretKey, ...) (err error)
- func LookupRecipient(m libkb.MetaContext, to stellarcommon.RecipientInput, isCLI bool) (res stellarcommon.Recipient, err error)
- func LookupSender(ctx context.Context, g *libkb.GlobalContext, accountID stellar1.AccountID) (stellar1.BundleEntry, 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(ctx context.Context, g *libkb.GlobalContext, noteB64 string) (res stellar1.NoteContents, err error)
- func NoteEncryptB64(ctx context.Context, g *libkb.GlobalContext, note stellar1.NoteContents, ...) (noteB64 string, err error)
- func OwnAccount(ctx context.Context, g *libkb.GlobalContext, accountID stellar1.AccountID) (bool, error)
- func PaymentDetailCLILocal(ctx context.Context, g *libkb.GlobalContext, remoter remote.Remoter, ...) (res stellar1.PaymentCLILocal, err error)
- func RecentPaymentsCLILocal(ctx context.Context, g *libkb.GlobalContext, remoter remote.Remoter, ...) (res []stellar1.PaymentOrErrorCLILocal, err error)
- func ServiceInit(g *libkb.GlobalContext, remoter remote.Remoter)
- func SetAccountAsPrimary(m libkb.MetaContext, accountID stellar1.AccountID) (err error)
- 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 Upkeep(ctx context.Context, g *libkb.GlobalContext) (err error)
- type AutoClaimRunner
- type BuildPaymentCache
- type DisplayBalance
- type Loader
- 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) 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 OwnAccountLookupCache
- type SendPaymentArg
- type SendPaymentResult
- type SeqnoProvider
- type Stellar
- func (s *Stellar) CachedHasWallet(ctx context.Context, uv keybase1.UserVersion) bool
- func (s *Stellar) CreateWalletGated(ctx context.Context) (err error)
- func (s *Stellar) CreateWalletSoft(ctx context.Context)
- func (s *Stellar) GetServerDefinitions(ctx context.Context) (ret stellar1.StellarServerDefinitions, err 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) SetFederationClientForTest(cli federation.ClientInterface)
- func (s *Stellar) Upkeep(ctx context.Context) error
Constants ¶
const AccountNameMaxRunes = 24
const DefaultCurrencySetting = "USD"
Variables ¶
This section is empty.
Functions ¶
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 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 ChatSendPaymentMessage ¶
func ChatSendPaymentMessage(m libkb.MetaContext, recipient stellarcommon.Recipient, txID stellar1.TransactionID) error
func Claim ¶
func Claim(ctx context.Context, g *libkb.GlobalContext, remoter remote.Remoter, 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 ¶
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 CreateWalletGated ¶
func CreateWalletGated(ctx context.Context, g *libkb.GlobalContext) (justCreated, hasWallet bool, err error)
CreateWalletGated may create a wallet for the user. Taking into account settings from the server and env. It should be speedy to call repeatedly _if_ the user gets a wallet. `hasWallet` returns whether the user has by the time this call returns.
func CreateWalletSoft ¶ added in v1.0.48
func CreateWalletSoft(ctx context.Context, g *libkb.GlobalContext)
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 ExportSecretKey ¶ added in v1.0.48
func FormatAmountWithSuffix ¶
func FormatAmountXLM ¶
Example: "157.5000000 XLM"
func FormatCurrency ¶
func FormatCurrency(ctx context.Context, g *libkb.GlobalContext, amount string, code stellar1.OutsideCurrencyCode) (string, error)
func FormatCurrencyLabel ¶
func FormatCurrencyLabel(ctx context.Context, g *libkb.GlobalContext, code stellar1.OutsideCurrencyCode) (string, error)
func FormatPaymentAmountXLM ¶
func FormatPaymentAmountXLM(amount string, delta stellar1.BalanceDelta) (string, 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, remoter remote.Remoter, accountID stellar1.AccountID) (res stellar1.CurrencyLocal, err error)
func GetOwnPrimaryAccountID ¶ added in v1.0.48
func ImportSecretKey ¶ added in v1.0.47
func LookupRecipient ¶ added in v1.0.48
func LookupRecipient(m libkb.MetaContext, to stellarcommon.RecipientInput, isCLI bool) (res stellarcommon.Recipient, err error)
func LookupSender ¶
func LookupSender(ctx context.Context, g *libkb.GlobalContext, accountID stellar1.AccountID) (stellar1.BundleEntry, 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(ctx context.Context, g *libkb.GlobalContext, noteB64 string) (res stellar1.NoteContents, err error)
func NoteEncryptB64 ¶ added in v1.0.48
func NoteEncryptB64(ctx context.Context, g *libkb.GlobalContext, 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 RecentPaymentsCLILocal ¶ added in v1.0.48
func ServiceInit ¶ added in v1.0.48
func ServiceInit(g *libkb.GlobalContext, remoter remote.Remoter)
func SetAccountAsPrimary ¶
func SetAccountAsPrimary(m libkb.MetaContext, accountID stellar1.AccountID) (err error)
func TransformPaymentSummaryAccount ¶
func TransformPaymentSummaryAccount(mctx libkb.MetaContext, p stellar1.PaymentSummary, oc OwnAccountLookupCache, accountID stellar1.AccountID, exchRate *stellar1.OutsideExchangeRate) (*stellar1.PaymentLocal, error)
TransformPaymentSummaryAccount converts a stellar1.PaymentSummary (p) into a stellar1.PaymentLocal, from the perspective of an owner of accountID.
exchRate is the current exchange rate from XLM to the "outside" currency that is the preference for 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)
Types ¶
type AutoClaimRunner ¶
type AutoClaimRunner struct {
// contains filtered or unexported fields
}
Claims relay payments in the background. Threadsafe.
func NewAutoClaimRunner ¶
func NewAutoClaimRunner(remoter remote.Remoter) *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 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) (bool, 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.
func GetBuildPaymentCache ¶
func GetBuildPaymentCache(mctx libkb.MetaContext, remoter remote.Remoter) BuildPaymentCache
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) 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) 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 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(ctx context.Context, g *libkb.GlobalContext) OwnAccountLookupCache
NewOwnAccountLookupCache fetches the list of accounts in the background and stores them.
type SendPaymentArg ¶
type SendPaymentArg struct { From stellar1.AccountID // Optional. Defaults to primary account. FromSeqno *uint64 // Optional. Use this value for the from stellar sequence number. 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, remoter remote.Remoter, sendArg SendPaymentArg) (res SendPaymentResult, err error)
SendPaymentCLI sends XLM from CLI.
func SendPaymentGUI ¶
func SendPaymentGUI(m libkb.MetaContext, remoter remote.Remoter, 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 is intended as a one-shot wrapper and shouldn't be reused after the transaction is built.
func NewSeqnoProvider ¶ added in v1.0.48
func NewSeqnoProvider(ctx context.Context, remoter remote.Remoter) *SeqnoProvider
NewSeqnoProvider creates a SeqnoProvider.
func (*SeqnoProvider) Override ¶
func (s *SeqnoProvider) Override(aid string, seqno xdr.SequenceNumber)
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, remoter remote.Remoter) *Stellar
func (*Stellar) CachedHasWallet ¶
func (*Stellar) CreateWalletGated ¶ added in v1.0.48
func (*Stellar) CreateWalletSoft ¶ added in v1.0.48
func (*Stellar) GetServerDefinitions ¶
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)
func (*Stellar) SetFederationClientForTest ¶
func (s *Stellar) SetFederationClientForTest(cli federation.ClientInterface)
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. |