Skip to content

Commit

Permalink
[cgo] refs fibercrypto#116 Finalized cipher.base58
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Jan 18, 2020
1 parent e4f888f commit 916426a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
8 changes: 7 additions & 1 deletion include/skytypes.gen.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// clang-format off
#include <stdbool.h>
#include "api.client.go.h"

#include "cipher.hash.go.h"
Expand All @@ -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"
Expand All @@ -32,4 +34,8 @@
#include "transaction.choose.go.h"
#include "api.send.go.h"

#include "cipher.bip32.path.go.h"
#include "cipher.bip32.bip32.go.h"
#include "cipher.bip32.path.go.h"
#include "cipher.bip44.bip44.go.h"

#include "params.distribution.go.h"
8 changes: 3 additions & 5 deletions lib/cgo/cipher.base58.base58.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

import (
"github.com/SkycoinProject/skycoin/src/cipher/base58"

"reflect"
"unsafe"

"github.com/SkycoinProject/skycoin/src/cipher/base58"
)

/*
Expand All @@ -13,12 +13,12 @@ import (
#include <stdlib.h>
#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))
Expand All @@ -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)
Expand All @@ -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)
Expand Down
16 changes: 15 additions & 1 deletion lib/cgo/libsky_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
}

0 comments on commit 916426a

Please sign in to comment.