amount

package
v0.0.0-...-801da37 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2017 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package amount provides utilities for converting numbers to/from the format used internally to stellar-core.

stellar-core represents asset "amounts" as 64-bit integers, but to enable fractional units of an asset, horizon, the client-libraries and other built on top of stellar-core use a convention, encoding amounts as a string of decimal digits with up to seven digits of precision in the fractional portion. For example, an amount shown as "101.001" in horizon would be represented in stellar-core as 1010010000.

Index

Constants

View Source
const One = 10000000

One is the value of one whole unit of currency. Stellar uses 7 fixed digits for fractional values, thus One is 10 million (10^7)

Variables

This section is empty.

Functions

func MustParse

func MustParse(v string) xdr.Int64

MustParse is the panicking version of Parse

func Parse

func Parse(v string) (xdr.Int64, error)

Parse parses the provided as a stellar "amount", i.e. A 64-bit signed integer that represents a decimal number with 7 digits of significance in the fractional portion of the number.

func String

func String(v xdr.Int64) string

String returns an "amount string" from the provided raw value `v`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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