func (s ActionSlice) Prepare() error { var prepare = func(seed data.Seed, fee data.Value, keyType data.KeyType, tx data.Transaction, txType data.TransactionType) error { var ( sequence uint32 key = seed.Key(keyType) base = tx.GetBase() ) base.TransactionType = txType base.Fee = fee base.Account = seed.AccountId(keyType, &sequence) return data.Sign(tx, key, &sequence) } return s.each(prepare) }
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)) }