本文整理匯總了Golang中github.com/FactomProject/factomd/common/primitives.EncodeJSONString函數的典型用法代碼示例。如果您正苦於以下問題:Golang EncodeJSONString函數的具體用法?Golang EncodeJSONString怎麽用?Golang EncodeJSONString使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EncodeJSONString函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TopupFAddress
func TopupFAddress() {
const fBalanceThreshold uint64 = 20000000 //0.2
fBalance, err := factom.GetFactoidBalance(FaucetAddress)
if err != nil {
panic(err)
}
if fBalance < int64(fBalanceThreshold) {
panic(fmt.Sprintf("Balance is too low - %v vs %v", fBalance/100000000.0, fBalanceThreshold/100000000.0))
}
tx, err := factom.SendFactoid(FaucetAddress, FAddressStr, fBalanceThreshold)
if err != nil {
panic(err)
}
fmt.Printf("F Topup tx - %v\n", tx)
for i := 0; ; i++ {
i = i % 3
time.Sleep(5 * time.Second)
ack, err := factom.FactoidACK(tx, "")
if err != nil {
panic(err)
}
str, err := primitives.EncodeJSONString(ack)
if err != nil {
panic(err)
}
fmt.Printf("Topup ack - %v", str)
for j := 0; j < i+1; j++ {
fmt.Printf(".")
}
fmt.Printf(" \r")
if ack.Status != "DBlockConfirmed" {
continue
}
fmt.Printf("Topup ack - %v\n", str)
break
}
fBalance, _, err = CheckFactomBalance()
if err != nil {
panic(err)
}
if uint64(fBalance) < fBalanceThreshold {
panic("Balance was not increased!")
}
}
示例2: TopupECAddress
func TopupECAddress() {
//fmt.Printf("TopupECAddress - %v, %v\n", FAddressStr, ECAddressStr)
const ecBalanceThreshold uint64 = 10
tx, err := factom.BuyExactEC(FAddressStr, ECAddressStr, uint64(ecBalanceThreshold))
//tx, err := factom.BuyExactEC(FaucetAddress, ECAddressStr, uint64(ecBalanceThreshold))
if err != nil {
panic(err)
}
fmt.Printf("EC Topup tx - %v\n", tx)
for i := 0; ; i++ {
i = i % 3
time.Sleep(5 * time.Second)
ack, err := factom.FactoidACK(tx, "")
if err != nil {
panic(err)
}
str, err := primitives.EncodeJSONString(ack)
if err != nil {
panic(err)
}
fmt.Printf("Topup ack - %v", str)
for j := 0; j < i+1; j++ {
fmt.Printf(".")
}
fmt.Printf(" \r")
if ack.Status != "DBlockConfirmed" {
continue
}
fmt.Printf("Topup ack - %v\n", str)
break
}
_, ecBalance, err := CheckFactomBalance()
if err != nil {
panic(err)
}
if uint64(ecBalance) < ecBalanceThreshold {
panic("Balance was not increased!")
}
}
示例3: JSONString
func (e *IncreaseServerCount) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例4: JSONString
func (e *ECBlockBody) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例5: JSONString
func (e *DirectoryBlock) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例6: JSONString
func (e *EBlockHeader) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例7: JSONString
func (e *ServerFault) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例8: JSONString
func (e *MsgAck) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例9: JSONString
func (e *DataResponse) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例10: JSONString
func (e *AddServerMsg) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例11: JSONString
func (e *RequestBlock) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例12: JSONString
func (e *DBStateMissing) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例13: JSONString
func (e *MsgGetEntryData) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例14: JSONString
func (e ByteStore) JSONString() (string, error) {
return primitives.EncodeJSONString(e)
}
示例15: JSONString
func (s *FactoidSignature) JSONString() (string, error) {
return primitives.EncodeJSONString(s)
}