diff --git a/lib/cgo/cli.cli.go b/lib/cgo/cli.cli.go index 2e2dbe26e..fa0cf7790 100644 --- a/lib/cgo/cli.cli.go +++ b/lib/cgo/cli.cli.go @@ -35,17 +35,6 @@ func SKY_cli_Config_FullDBPath(_c *C.cli__Config, _arg0 *C.GoString_) (____error return } -//export SKY_cli_NewCLI -func SKY_cli_NewCLI(_cfg *C.cli__Config, _arg1 *C.CLI__Handle) (____error_code uint32) { - cfg := *(*cli.Config)(unsafe.Pointer(_cfg)) - __arg1, ____return_err := cli.NewCLI(cfg) - ____error_code = libErrorCode(____return_err) - if ____return_err == nil { - *_arg1 = registerCLIHandle(__arg1) - } - return -} - //export SKY_cli_WalletLoadError_Error func SKY_cli_WalletLoadError_Error(_e *C.cli__WalletLoadError, _arg0 *C.GoString_) (____error_code uint32) { e := *(*cli.WalletLoadError)(unsafe.Pointer(_e)) diff --git a/lib/cgo/coin.outputs.go b/lib/cgo/coin.outputs.go index 88b1a1248..17bf29efc 100644 --- a/lib/cgo/coin.outputs.go +++ b/lib/cgo/coin.outputs.go @@ -4,6 +4,7 @@ import ( "reflect" "unsafe" + cipher "github.com/SkycoinProject/skycoin/src/cipher" coin "github.com/SkycoinProject/skycoin/src/coin" ) @@ -224,3 +225,82 @@ func SKY_coin_UxArray_Add(_ua *C.coin__UxArray, _other *C.coin__UxArray, _arg1 * copyToBuffer(reflect.ValueOf(__arg1[:]), unsafe.Pointer(_arg1), uint(SizeofUxArray)) return } + +// Helpers + +//export SKY_coin_AddressUxOuts_Get +func SKY_coin_AddressUxOuts_Get(handle C.AddressUxOuts__Handle, _key *C.cipher__Address, _uxOuts *C.coin__UxArray) (____error_code uint32) { + a, ok := lookupAddressUxOutHandle(handle) + if ok { + key := *(*cipher.Address)(unsafe.Pointer(_key)) + uxOuts, found := (*a)[key] + if found { + copyTocoin_UxArray(reflect.ValueOf(uxOuts), _uxOuts) + ____error_code = SKY_OK + } + } else { + ____error_code = SKY_BAD_HANDLE + } + return +} + +//export SKY_coin_AddressUxOuts_HasKey +func SKY_coin_AddressUxOuts_HasKey(handle C.AddressUxOuts__Handle, _key *C.cipher__Address, _hasKey *bool) (____error_code uint32) { + a, ok := lookupAddressUxOutHandle(handle) + if ok { + key := *(*cipher.Address)(unsafe.Pointer(_key)) + _, found := (*a)[key] + *_hasKey = found + ____error_code = SKY_OK + } else { + ____error_code = SKY_BAD_HANDLE + } + return +} + +//export SKY_coin_AddressUxOuts_GetOutputLength +func SKY_coin_AddressUxOuts_GetOutputLength(handle C.AddressUxOuts__Handle, _key *C.cipher__Address, _length *int) (____error_code uint32) { + a, ok := lookupAddressUxOutHandle(handle) + if ok { + key := *(*cipher.Address)(unsafe.Pointer(_key)) + uxOuts, found := (*a)[key] + if found { + *_length = len(uxOuts) + ____error_code = SKY_OK + } + } else { + ____error_code = SKY_BAD_HANDLE + } + return +} + +//export SKY_coin_AddressUxOuts_Length +func SKY_coin_AddressUxOuts_Length(handle C.AddressUxOuts__Handle, _length *int) (____error_code uint32) { + a, ok := lookupAddressUxOutHandle(handle) + if ok { + *_length = len(*a) + ____error_code = SKY_OK + } else { + ____error_code = SKY_BAD_HANDLE + } + return +} + +//export SKY_coin_AddressUxOuts_Set +func SKY_coin_AddressUxOuts_Set(handle C.AddressUxOuts__Handle, _key *C.cipher__Address, _uxOuts *C.coin__UxArray) (____error_code uint32) { + a, ok := lookupAddressUxOutHandle(handle) + if ok { + key := *(*cipher.Address)(unsafe.Pointer(_key)) + //Copy the slice because it is going to be kept + //We can't hold memory allocated outside Go + tempUxOuts := *(*coin.UxArray)(unsafe.Pointer(_uxOuts)) + uxOuts := make(coin.UxArray, 0, len(tempUxOuts)) + + uxOuts = append(uxOuts, tempUxOuts...) + (*a)[key] = uxOuts + ____error_code = SKY_OK + } else { + ____error_code = SKY_BAD_HANDLE + } + return +}