stellar

package
v2.1.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeAccountName

func ChangeAccountName(m libkb.MetaContext, accountID stellar1.AccountID, newName string) (err 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 CreateNewAccount(m libkb.MetaContext, accountName string) (ret stellar1.AccountID, err error)

func CreateWallet

func CreateWallet(ctx context.Context, g *libkb.GlobalContext) (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 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 ExportSecretKey(ctx context.Context, g *libkb.GlobalContext, accountID stellar1.AccountID) (res stellar1.SecretKey, err error)

func FormatAmount

func FormatAmount(amount string, precisionTwo bool) (string, error)

func FormatAmountWithSuffix

func FormatAmountWithSuffix(amount string, precisionTwo bool, suffix string) (string, error)

func FormatAmountXLM

func FormatAmountXLM(amount string) (string, error)

Example: "157.5000000 XLM"

func FormatCurrency

func FormatCurrency(ctx context.Context, g *libkb.GlobalContext, amount string, code stellar1.OutsideCurrencyCode) (string, error)

func FormatPaymentAmountXLM

func FormatPaymentAmountXLM(amount string, delta stellar1.BalanceDelta) (string, error)

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 GetOwnPrimaryAccountID(ctx context.Context, g *libkb.GlobalContext) (res stellar1.AccountID, err error)

func ImportSecretKey added in v1.0.47

func ImportSecretKey(ctx context.Context, g *libkb.GlobalContext, secretKey stellar1.SecretKey, makePrimary bool, accountName string) (err error)

func LookupRecipient added in v1.0.48

func LookupRecipient(m libkb.MetaContext, to stellarcommon.RecipientInput) (res stellarcommon.Recipient, err error)

TODO: handle stellar federation address rebecca*keybase.io (or rebecca*anything.wow)

func LookupSender

func LookupSender(ctx context.Context, g *libkb.GlobalContext, accountID stellar1.AccountID) (stellar1.BundleEntry, 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 OwnAccount(ctx context.Context, g *libkb.GlobalContext, accountID stellar1.AccountID) (bool, error)

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 RecentPaymentsCLILocal(ctx context.Context, g *libkb.GlobalContext, remoter remote.Remoter, accountID stellar1.AccountID) (res []stellar1.PaymentOrErrorCLILocal, err error)

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 Upkeep

func Upkeep(ctx context.Context, g *libkb.GlobalContext) (err error)

Upkeep makes sure the bundle is encrypted for the user's latest PUK.

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)
	// 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 DisplayBalance struct {
	Amount   string
	Currency string
}

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 SendPayment added in v1.0.48

func SendPayment(m libkb.MetaContext, remoter remote.Remoter, sendArg SendPaymentArg) (res SendPaymentResult, err error)

SendPayment sends XLM. Recipient: Stellar address : Standard payment User with wallet ready : Standard payment User without a wallet : Relay payment Unresolved assertion : Relay payment

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 (s *Stellar) CachedHasWallet(ctx context.Context, uv keybase1.UserVersion) bool

func (*Stellar) CreateWalletGated added in v1.0.48

func (s *Stellar) CreateWalletGated(ctx context.Context) (err error)

func (*Stellar) CreateWalletSoft added in v1.0.48

func (s *Stellar) CreateWalletSoft(ctx context.Context)

func (*Stellar) GetServerDefinitions

func (s *Stellar) GetServerDefinitions(ctx context.Context) (ret stellar1.StellarServerDefinitions, err error)

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) OnLogout added in v1.0.48

func (s *Stellar) OnLogout()

func (*Stellar) Upkeep added in v1.0.48

func (s *Stellar) Upkeep(ctx context.Context) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL