From 916426a95d4285dd04f59cba49aa1ff415fc0613 Mon Sep 17 00:00:00 2001 From: Maykel Arias Torres Date: Fri, 17 Jan 2020 23:23:47 -0500 Subject: [PATCH] [cgo] refs #116 Finalized `cipher.base58` --- include/skytypes.gen.h | 8 +++++++- lib/cgo/cipher.base58.base58.go | 8 +++----- lib/cgo/libsky_handle.go | 16 +++++++++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/include/skytypes.gen.h b/include/skytypes.gen.h index 1bfae9aba..e18e3a28b 100644 --- a/include/skytypes.gen.h +++ b/include/skytypes.gen.h @@ -1,4 +1,5 @@ // clang-format off +#include #include "api.client.go.h" #include "cipher.hash.go.h" @@ -14,6 +15,7 @@ #include "cli.cli.go.h" #include "cli.create_rawtx.go.h" +#include "cli.check_balance.go.h" #include "coin.transactions.go.h" #include "coin.block.go.h" @@ -32,4 +34,8 @@ #include "transaction.choose.go.h" #include "api.send.go.h" -#include "cipher.bip32.path.go.h" \ No newline at end of file +#include "cipher.bip32.bip32.go.h" +#include "cipher.bip32.path.go.h" +#include "cipher.bip44.bip44.go.h" + +#include "params.distribution.go.h" \ No newline at end of file diff --git a/lib/cgo/cipher.base58.base58.go b/lib/cgo/cipher.base58.base58.go index ec5274a86..ac1c53c59 100644 --- a/lib/cgo/cipher.base58.base58.go +++ b/lib/cgo/cipher.base58.base58.go @@ -1,10 +1,10 @@ package main import ( + "github.com/SkycoinProject/skycoin/src/cipher/base58" + "reflect" "unsafe" - - "github.com/SkycoinProject/skycoin/src/cipher/base58" ) /* @@ -13,12 +13,12 @@ import ( #include #include "skytypes.h" + #include "skyfee.h" */ import "C" //export SKY_base58_NewAlphabet func SKY_base58_NewAlphabet(_s string, _arg1 *C.base58__Alphabet) (____error_code uint32) { - ____error_code = 0 s := _s __arg1 := base58.NewAlphabet(s) *_arg1 = *(*C.base58__Alphabet)(unsafe.Pointer(__arg1)) @@ -27,7 +27,6 @@ func SKY_base58_NewAlphabet(_s string, _arg1 *C.base58__Alphabet) (____error_cod //export SKY_base58_Encode func SKY_base58_Encode(_bin []byte, _arg1 *C.GoString_) (____error_code uint32) { - ____error_code = 0 bin := *(*[]byte)(unsafe.Pointer(&_bin)) __arg1 := base58.Encode(bin) copyString(__arg1, _arg1) @@ -36,7 +35,6 @@ func SKY_base58_Encode(_bin []byte, _arg1 *C.GoString_) (____error_code uint32) //export SKY_base58_Decode func SKY_base58_Decode(_str string, _arg1 *C.GoSlice_) (____error_code uint32) { - ____error_code = 0 str := _str __arg1, ____return_err := base58.Decode(str) ____error_code = libErrorCode(____return_err) diff --git a/lib/cgo/libsky_handle.go b/lib/cgo/libsky_handle.go index a8c5c8e7c..180b87027 100644 --- a/lib/cgo/libsky_handle.go +++ b/lib/cgo/libsky_handle.go @@ -663,7 +663,7 @@ func lookupAccountHandle(handle C.Account__Handle) (*bip44.Account, bool) { } func registerGetOutputserHandle(obj *cli.GetOutputser) C.GetOutputser__Handle { - return (C.Account__Handle)(registerHandle(obj)) + return (C.GetOutputser__Handle)(registerHandle(obj)) } func lookupGetOutputserHandle(handle C.GetOutputser__Handle) (*cli.GetOutputser, bool) { @@ -675,3 +675,17 @@ func lookupGetOutputserHandle(handle C.GetOutputser__Handle) (*cli.GetOutputser, } return nil, false } + +func registerUnspentOutputsSummaryHandle(obj *readable.UnspentOutputsSummary) C.UnspentOutputsSummary__Handle { + return (C.UnspentOutputsSummary__Handle)(registerHandle(obj)) +} + +func lookupUnspentOutputsSummaryHandle(handle C.UnspentOutputsSummary__Handle) (*readable.UnspentOutputsSummary, bool) { + obj, ok := lookupHandle(C.Handle(handle)) + if ok { + if obj, isOK := (obj).(*readable.UnspentOutputsSummary); isOK { + return obj, true + } + } + return nil, false +} \ No newline at end of file