MCPcopy Create free account
hub / github.com/chain/txvm / AddInput

Method AddInput

protocol/txbuilder/template.go:244–263  ·  view source on GitHub ↗

AddInput adds an Input to the template.

(quorum int, keyHashes [][]byte, path [][]byte, pubkeys []ed25519.PublicKey, amount int64, assetID bc.Hash, anchor, inputRefdata []byte, version int)

Source from the content-addressed store, hash-verified

242
243// AddInput adds an Input to the template.
244func (tpl *Template) AddInput(quorum int, keyHashes [][]byte, path [][]byte, pubkeys []ed25519.PublicKey, amount int64, assetID bc.Hash, anchor, inputRefdata []byte, version int) *Input {
245 if version == 0 {
246 version = latestOutputVersion
247 }
248 inp := &Input{
249 Quorum: quorum,
250 KeyHashes: asHexBytes(keyHashes),
251 Path: asHexBytes(path),
252 Pubkeys: pubkeys,
253 Amount: amount,
254 AssetID: assetID,
255 Anchor: anchor,
256 InputRefdata: i10rjson.HexBytes(inputRefdata),
257 Index: tpl.index,
258 OutputVersion: version,
259 }
260 tpl.index++
261 tpl.Inputs = append(tpl.Inputs, inp)
262 return inp
263}
264
265// AddOutput adds an Output to the template.
266func (tpl *Template) AddOutput(quorum int, pubkeys []ed25519.PublicKey, amount int64, assetID bc.Hash, refData, tags []byte) *Output {

Callers 3

TestTxBuilderFunction · 0.95
TestResultsFunction · 0.95
mainFunction · 0.95

Calls 1

asHexBytesFunction · 0.85

Tested by 2

TestTxBuilderFunction · 0.76
TestResultsFunction · 0.76