Documentation ¶
Index ¶
- Constants
- Variables
- func AccountSetFlag(c context.Context, account string, flag uint32, secret string) (string, int64, error)
- func AmountToUint64(amount string) (uint64, error)
- func CalculateFeeAmount(c context.Context, amount uint64) (uint64, string, error)
- func CalculateNumberOfTransactions(c context.Context, amount uint64) (uint64, error)
- func CalculateReserve(c context.Context, accountLines uint64) uint64
- func CreatePayment(c context.Context, account string, destination string, quantity string, ...) (string, int64, error)
- func FromCurrency(currency string) (string, error)
- func Init()
- func InitWithConfigPath(configFilePath string)
- func ServerInfo(c context.Context) ([]byte, int64, error)
- func Sign(c context.Context, tx interface{}, secret string) (string, int64, error)
- func Submit(c context.Context, txHexString string) (string, int64, error)
- func ToCurrency(asset string) (string, error)
- func TrustSet(c context.Context, account string, currency string, value string, ...) (string, int64, error)
- func Uint64ToAmount(amount uint64) (string, error)
- func ValidCurrencyName(currency string) (bool, error)
- type AccountInfo
- type AccountSet
- type Amount
- type ApiResult
- type Balance
- type CcyByAccountResult
- type CurrenciesByAccount
- type Currency
- type Ledger
- type LedgerResult
- type LedgerValue
- type LimitAmount
- type Line
- type Lines
- type MasterWallet
- type Memo
- type PayloadGetCcyByAcct
- type PaymentAssetTx
- type PaymentXrpTx
- type Transaction
- type TrustSetStruct
- type Wallet
Constants ¶
const AsfAccountTxnID = 5
const AsfDefaultRipple = 8
const AsfDisableMaster = 4
const AsfDisallowXRP = 3
const AsfGlobalFreeze = 7
const AsfNoFreeze = 6
const AsfRequireAuth = 2
const AsfRequireDest = 1
Account set flags
const LsfDefaultRipple = 8388608
AccountRoot Flags
const TfClearFreeze = 2097152
const TfClearNoRipple = 262144
const TfSetFreeze = 1048576
const TfSetNoRipple = 131072
const TfSetfAuth = 65536
Trust set flags (on the transaction)
Variables ¶
var BaseReserve = 20000000
var DefaultAmountToTrust uint64 = 100000000000000000
var DefaultFee = "10000"
var DefaultFeeI uint64 = 10000
var OwnerReserve = 5000000
var RippleWallets []MasterWallet
Functions ¶
func AccountSetFlag ¶
func AccountSetFlag(c context.Context, account string, flag uint32, secret string) (string, int64, error)
Sets a specific flag on an account
func AmountToUint64 ¶
Converts a Ripple amount which is stored in a string into a Uint64 whose factor is in satoshis Uses big.Float and big.Int to stop overflows and maintain precision
func CalculateFeeAmount ¶
Returns the total XRP that is required for the given number of transactions
func CalculateNumberOfTransactions ¶
Returns the number of transactions that can be performed with the given amount of XRP
func CalculateReserve ¶
Calculates the reserve based upon the current reserve and number of account lines Returns in 'drops' the amount of XRP required
func CreatePayment ¶
func CreatePayment(c context.Context, account string, destination string, quantity string, currency string, issuer string, secret string) (string, int64, error)
Creates and signs the payment for the custom currency that is specified. If XRP is specified, then the amount MUST be specifed in droplets Returns the tx string if successful
func FromCurrency ¶
Converts a ripple currency to a normal string Where the currency is 3 characters, it is returned as is Where the currency is a 160 bit hex encoded string, it is converted to the ascii representation
func InitWithConfigPath ¶
func InitWithConfigPath(configFilePath string)
func Sign ¶
Signs a tx with the given secret. The tx should be a struct containing the tx to be marshalled into JSON and then signed
func ToCurrency ¶
Truncate to 19 characters and convert to a hex string equivalent. Prepend hex 80 to indicate a custom currency
func TrustSet ¶
func TrustSet(c context.Context, account string, currency string, value string, issuerAccount string, flag uint32, secret string) (string, int64, error)
Modifies a trust line between two accounts The trust line is directional - the given account trusts the issuer account for value amount of currency A trust line occupies space in the Ripple ledger and therefore requires a fee to be paid and consequently the secret of the source account
func Uint64ToAmount ¶
Converts a Uint64 into a Ripple amount which is stored in a string
func ValidCurrencyName ¶
We allow currency names up to 19 characters long
Types ¶
type AccountInfo ¶
type AccountInfo struct { Account string `json:",omitempty"` Balance string `json:",omitempty"` Flags uint32 `json:",omitempty"` LedgerEntryType string `json:",omitempty"` OwnerCount int `json:",omitempty"` PreviousTxnID string `json:",omitempty"` Sequence int `json:",omitempty"` Index string `json:"index,omitempty"` }
func GetAccountInfo ¶
type AccountSet ¶
type AccountSet struct { // Common fields Account string `json:",omitempty"` AccountTxnID string `json:",omitempty"` Fee string `json:",omitempty"` Flags uint32 `json:",omitempty"` LastLedgerSequence uint32 `json:",omitempty"` Memos []Memo Sequence uint32 `json:",omitempty"` SigningPubKey string `json:",omitempty"` SourceTag uint32 `json:",omitempty"` TransactionType string `json:",omitempty"` TxnSignature string `json:",omitempty"` ClearFlag uint32 `json:",omitempty"` Domain string `json:",omitempty"` EmailHash string `json:",omitempty"` MessageKey string `json:",omitempty"` SetFlag uint32 `json:",omitempty"` TransferRate uint32 `json:",omitempty"` }
type Balance ¶
type Balance struct { Value string `json:"value"` Currency string `json:"currency"` Counterparty string `json:"counterparty"` }
func GetAccountBalances ¶
Returns the balances, including xrp held by the account Assumes that all custom currencies ripple via a central issuing address. ie it doesn't sum balances of the same currency against different trust lines
type CcyByAccountResult ¶
type CurrenciesByAccount ¶
type CurrenciesByAccount struct {
Result CcyByAccountResult `json:"result"`
}
func GetCurrenciesByAccount ¶
type Ledger ¶
type Ledger struct {
Ledger LedgerValue `json:"ledger,omitempty"`
}
type LedgerResult ¶
type LedgerValue ¶
type LedgerValue struct { Accepted bool `json:"accepted,omitempty"` //Accepted2 string AccountHash string `json:"account_hash,omitempty"` CloseFlags uint32 `json:"close_flags,omitempty"` CloseTime uint32 `json:"close_time,omitempty"` CloseTimeHuman string `json:"close_time_human,omitempty"` CloseTimeResolution uint32 `json:"close_time_resolution,omitempty"` Closed bool `json:"closed,omitempty"` LedgerHash string `json:"ledger_hash,omitempty"` LedgerIndex string `json:"ledger_index,omitempty"` ParentCloseTime uint32 `json:"parent_close_time,omitempty"` ParentHash string `json:"parent_hash,omitempty"` SeqNum string `json:"seqNum,omitempty"` TotalCoins1 string `json:"totalCoins,omitempty"` TotalCoins2 string `json:"total_coins,omitempty"` TransactionHash string `json:"transaction_hash,omitempty"` }
func GetLatestValidatedLedger ¶
func GetLatestValidatedLedger(c context.Context) (LedgerValue, int64, error)
type LimitAmount ¶
type Line ¶
type Line struct { Account string `json:"account,omitempty"` Balance string `json:"balance,omitempty"` Currency string `json:"currency,omitempty"` Limit string `json:"limit,omitempty"` LimitPeer string `json:"limit_peer,omitempty"` NoRipple bool `json:"no_ripple,omitempty"` NoRipplePeer bool `json:"no_ripple_peer,omitempty"` QualityIn uint `json:"quality_in,omitempty"` QualityOut uint `json:"quality_out,omitempty"` }
type MasterWallet ¶
Used to store the internal wallets
type PayloadGetCcyByAcct ¶
type PaymentAssetTx ¶
type PaymentAssetTx struct { // Common fields Account string `json:",omitempty"` AccountTxnID string `json:",omitempty"` Fee string `json:",omitempty"` Flags uint32 `json:",omitempty"` LastLedgerSequence uint64 `json:",omitempty"` Memos []Memo Sequence uint32 `json:",omitempty"` SigningPubKey string `json:",omitempty"` SourceTag uint32 `json:",omitempty"` TransactionType string `json:",omitempty"` TxnSignature string `json:",omitempty"` // Payment specific fields Amount Amount // Note the Amount field is different between sending XRP or a custom currency SendMax Amount Destination string DestinationTag uint32 InvoiceID string }
Structure for payment transactions for custom currencies
type PaymentXrpTx ¶
type PaymentXrpTx struct { // Common fields Account string `json:",omitempty"` AccountTxnID string `json:",omitempty"` Fee string `json:",omitempty"` Flags uint32 `json:",omitempty"` LastLedgerSequence uint64 `json:",omitempty"` Memos []Memo Sequence uint32 `json:",omitempty"` SigningPubKey string `json:",omitempty"` SourceTag uint32 `json:",omitempty"` TransactionType string `json:",omitempty"` TxnSignature string `json:",omitempty"` // Payment specific fields Amount string `json:",omitempty"` Destination string `json:",omitempty"` DestinationTag uint32 `json:",omitempty"` InvoiceID string `json:",omitempty"` }
Structure for payment transactions for xrp
type Transaction ¶
type TrustSetStruct ¶
type TrustSetStruct struct { // Common fields Account string `json:",omitempty"` AccountTxnID string `json:",omitempty"` Fee string `json:",omitempty"` Flags uint32 `json:",omitempty"` LastLedgerSequence uint32 `json:",omitempty"` Memos []Memo `json:",omitempty"` Sequence uint32 `json:",omitempty"` SigningPubKey string `json:",omitempty"` SourceTag uint32 `json:",omitempty"` TransactionType string `json:",omitempty"` TxnSignature string `json:",omitempty"` LimitAmount LimitAmount `json:",omitempty"` QualityIn uint32 `json:",omitempty"` QualityOut uint32 `json:",omitempty"` }
type Wallet ¶
type Wallet struct { AccountId string `json:"account_id"` KeyType string `json:"key_type"` MasterKey string `json:"master_key"` MasterSeed string `json:"master_seed"` MasterSeedHex string `json:"master_seed_hex"` PublicKey string `json:"public_key"` PublicKeyHex string `json:"public_key_hex"` Status string `json:"status"` }