MCPcopy Create free account
hub / github.com/DNAProject/DNA / BuildNativeTransaction

Function BuildNativeTransaction

core/utils/transaction_builder.go:67–80  ·  view source on GitHub ↗
(addr common.Address, initMethod string, args []byte)

Source from the content-addressed store, hash-verified

65}
66
67func BuildNativeTransaction(addr common.Address, initMethod string, args []byte) *types.MutableTransaction {
68 bf := new(bytes.Buffer)
69 builder := vm.NewParamsBuilder(bf)
70 builder.EmitPushByteArray(args)
71 builder.EmitPushByteArray([]byte(initMethod))
72 builder.EmitPushByteArray(addr[:])
73 builder.EmitPushInteger(big.NewInt(0))
74 builder.Emit(vm.SYSCALL)
75 builder.EmitPushByteArray([]byte(NATIVE_INVOKE_NAME))
76
77 tx := NewInvokeTransaction(builder.ToArray())
78 tx.GasLimit = math.MaxUint64
79 return tx
80}
81
82func BuildNativeInvokeCode(contractAddress common.Address, version byte, method string, params []interface{}) ([]byte, error) {
83 builder := vm.NewParamsBuilder(new(bytes.Buffer))

Callers

nothing calls this directly

Calls 5

EmitPushByteArrayMethod · 0.95
EmitPushIntegerMethod · 0.95
EmitMethod · 0.95
ToArrayMethod · 0.95
NewInvokeTransactionFunction · 0.70

Tested by

no test coverage detected