Skip to content

Commit

Permalink
[cgo] refs fibercrypto#5 Added coin.mocks.Transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Mar 24, 2020
1 parent 4741786 commit 8a62c14
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/core.coin.go.h
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
typedef GoUint64_ core__Timestamp;
typedef GoUint64_ core__Timestamp;
typedef GoUint32_ core__TransactionStatus;
5 changes: 5 additions & 0 deletions include/fctypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ typedef Handle SeedGeneratorMocks__Handle;
*/
typedef Handle StringAddressMocks__Handle;

/**
* TransactionMocks__Handle Handle, struct mocks.Transaction
*/
typedef Handle TransactionMocks__Handle;

// Callbacks

/**
Expand Down
146 changes: 146 additions & 0 deletions lib/cgo/coin.mocks.Transaction.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
package main

import (
"reflect"
"unsafe"
)

/*
#include <string.h>
#include <stdlib.h>
#include "fctypes.h"
*/
import "C"

//export FC_mocks_Transaction_ComputeFee
func FC_mocks_Transaction_ComputeFee(__m *C.TransactionMocks__Handle, _ticker string, _arg1 *uint64) (____error_code uint32) {
_m, ok_m := lookupTransactionMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
ticker := _ticker
__arg1, ____return_err := _m.ComputeFee(ticker)
____error_code = libErrorCode(____return_err)
if ____return_err == nil {
*_arg1 = __arg1
}
return
}

//export FC_mocks_Transaction_GetId
func FC_mocks_Transaction_GetId(__m *C.TransactionMocks__Handle, _arg0 *C.GoString_) (____error_code uint32) {
_m, ok_m := lookupTransactionMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetId()
copyString(__arg0, _arg0)
return
}

//export FC_mocks_Transaction_GetInputs
func FC_mocks_Transaction_GetInputs(__m *C.TransactionMocks__Handle, _arg0 *C.GoSlice_) (____error_code uint32) {
_m, ok_m := lookupTransactionMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetInputs()
copyToGoSlice(reflect.ValueOf(__arg0), _arg0)
return
}

//export FC_mocks_Transaction_GetOutputs
func FC_mocks_Transaction_GetOutputs(__m *C.TransactionMocks__Handle, _arg0 *C.GoSlice_) (____error_code uint32) {
_m, ok_m := lookupTransactionMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetOutputs()
copyToGoSlice(reflect.ValueOf(__arg0), _arg0)
return
}

//export FC_mocks_Transaction_GetStatus
func FC_mocks_Transaction_GetStatus(__m *C.TransactionMocks__Handle, _arg0 *C.core__TransactionStatus) (____error_code uint32) {
_m, ok_m := lookupTransactionMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetStatus()
*_arg0 = *(*C.core__TransactionStatus)(unsafe.Pointer(&__arg0))
return
}

//export FC_mocks_Transaction_GetTimestamp
func FC_mocks_Transaction_GetTimestamp(__m *C.TransactionMocks__Handle, _arg0 *C.core__Timestamp) (____error_code uint32) {
_m, ok_m := lookupTransactionMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetTimestamp()
*_arg0 = *(*C.core__Timestamp)(unsafe.Pointer(&__arg0))
return
}

//export FC_mocks_Transaction_IsFullySigned
func FC_mocks_Transaction_IsFullySigned(__m *C.TransactionMocks__Handle, _arg0 *bool) (____error_code uint32) {
_m, ok_m := lookupTransactionMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0, ____return_err := _m.IsFullySigned()
____error_code = libErrorCode(____return_err)
if ____return_err == nil {
*_arg0 = __arg0
}
return
}

//export FC_mocks_Transaction_SupportedAssets
func FC_mocks_Transaction_SupportedAssets(__m *C.TransactionMocks__Handle, _arg0 *C.GoSlice_) (____error_code uint32) {
_m, ok_m := lookupTransactionMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.SupportedAssets()
copyToGoSlice(reflect.ValueOf(__arg0), _arg0)
return
}

//export FC_mocks_Transaction_VerifySigned
func FC_mocks_Transaction_VerifySigned(__m *C.TransactionMocks__Handle) (____error_code uint32) {
_m, ok_m := lookupTransactionMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
____return_err := _m.VerifySigned()
____error_code = libErrorCode(____return_err)
if ____return_err == nil {
}
return
}

//export FC_mocks_Transaction_VerifyUnsigned
func FC_mocks_Transaction_VerifyUnsigned(__m *C.TransactionMocks__Handle) (____error_code uint32) {
_m, ok_m := lookupTransactionMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
____return_err := _m.VerifyUnsigned()
____error_code = libErrorCode(____return_err)
if ____return_err == nil {
}
return
}
3 changes: 2 additions & 1 deletion lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ CGOGEN HANDLES mocks__PexNodeSet|PexNodeSetMocks
CGOGEN HANDLES mocks__PubKey|PubKeyMocks
CGOGEN HANDLES mocks__SecKey|SecKeyMocks
CGOGEN HANDLES mocks__SeedGenerator|SeedGeneratorMocks
CGOGEN HANDLES mocks__StringAddress|StringAddressMocks
CGOGEN HANDLES mocks__StringAddress|StringAddressMocks
CGOGEN HANDLES mocks__Transaction|TransactionMocks
13 changes: 13 additions & 0 deletions lib/cgo/libfc_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,3 +848,16 @@ func lookupStringAddressMocksHandle(handle C.StringAddressMocks__Handle) (*mocks
func registerStringAddressMocksHandle(obj *mocks.StringAddress) C.StringAddressMocks__Handle {
return (C.StringAddressMocks__Handle)(registerHandle(obj))
}
func lookupTransactionMocksHandle(handle C.TransactionMocks__Handle) (*mocks.Transaction, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*mocks.Transaction); isOK {
return obj, true
}
}
return nil, false
}

func registerTransactionMocksHandle(obj *mocks.Transaction) C.TransactionMocks__Handle {
return (C.TransactionMocks__Handle)(registerHandle(obj))
}

0 comments on commit 8a62c14

Please sign in to comment.