示例#1
0
文件: tx.go 项目: rubblelabs/tx
func sign(c *cli.Context, tx data.Transaction) {
	base := tx.GetBase()
	base.Sequence = uint32(c.GlobalInt("sequence"))
	copy(base.Account[:], key.Id(keySequence))
	if c.GlobalInt("lastledger") > 0 {
		base.LastLedgerSequence = new(uint32)
		*base.LastLedgerSequence = uint32(c.GlobalInt("lastledger"))
	}
	if base.Flags == nil {
		base.Flags = new(data.TransactionFlag)
	}
	if c.GlobalString("fee") != "" {
		fee, err := data.NewNativeValue(int64(c.GlobalInt("fee")))
		checkErr(err)
		base.Fee = *fee
	}
	checkErr(data.Sign(tx, key, keySequence))
}
示例#2
0
文件: terminal.go 项目: askk/ripple
func newTxBundle(v data.Transaction, insert string, flag Flag) (*bundle, error) {
	var (
		base   = v.GetBase()
		format = "%s %-11s %-8s %s%s %-34s %-9d "
		values = []interface{}{SignSymbol(v), base.GetType(), base.Fee, insert, MemoSymbol(v), base.Account, base.Sequence}
	)
	if flag&ShowTransactionId > 0 {
		txId, err := data.NodeId(v)
		if err != nil {
			return nil, err
		}
		format = "%s " + format
		values = append([]interface{}{txId}, values...)
	}
	switch tx := v.(type) {
	case *data.Payment:
		format += "=> %-34s %-60s %-60s"
		values = append(values, []interface{}{tx.Destination, tx.Amount, tx.SendMax}...)
	case *data.OfferCreate:
		format += "%-60s %-60s %-18s"
		values = append(values, []interface{}{tx.TakerPays, tx.TakerGets, tx.Ratio()}...)
	case *data.OfferCancel:
		format += "%-9d"
		values = append(values, tx.Sequence)
	case *data.AccountSet:
		format += "%-9d"
		values = append(values, tx.Sequence)
	case *data.TrustSet:
		format += "%-60s %d %d"
		values = append(values, tx.LimitAmount, tx.QualityIn, tx.QualityOut)
	}
	return &bundle{
		color:  txStyle,
		format: format,
		values: values,
		flag:   flag,
	}, nil
}
示例#3
0
文件: terminal.go 项目: askk/ripple
func MemoSymbol(tx data.Transaction) string {
	if len(tx.GetBase().Memos) > 0 {
		return "✐"
	}
	return " "
}
示例#4
0
func MemoSymbol(tx data.Transaction) string {
	return BoolSymbol(len(tx.GetBase().Memos) > 0)
}