modify structure of bindings
This commit is contained in:
parent
994b3e45b0
commit
6967788eb4
|
@ -5,7 +5,6 @@ import (
|
|||
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/node"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -13,13 +12,13 @@ var (
|
|||
scryptP = 1
|
||||
)
|
||||
|
||||
func createAccount(c *cli.Context) error {
|
||||
func createAccount(password, keydir string) error {
|
||||
|
||||
var sync *[]node.Service
|
||||
w := true
|
||||
accman := accounts.NewManager(c.String("keydir"), scryptN, scryptP, sync)
|
||||
accman := accounts.NewManager(keydir, scryptN, scryptP, sync)
|
||||
|
||||
account, err := accman.NewAccount(c.String("password"), w)
|
||||
account, err := accman.NewAccount(password, w)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#include "_cgo_export.h"
|
||||
|
||||
int runCreateAccount(const char* args) {
|
||||
return doRunCreateAccount((char*)args);
|
||||
}
|
|
@ -1,26 +1,16 @@
|
|||
package main
|
||||
|
||||
// #ifdef __cplusplus
|
||||
// extern "C" {
|
||||
// #endif
|
||||
//
|
||||
// extern int runCreateAccount(const char*);
|
||||
//
|
||||
// #ifdef __cplusplus
|
||||
// }
|
||||
// #endif
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//export doRunCreateAccount
|
||||
func doRunCreateAccount(args *C.char) C.int {
|
||||
//export doCreateAccount
|
||||
func doCreateAccount(password, keydir *C.char) C.int {
|
||||
// This is equivalent to creating an account from the command line,
|
||||
// just modified to handle the function arg passing
|
||||
if err := app.Run(strings.Split("statusgo "+C.GoString(args), " ")); err != nil {
|
||||
if err := createAccount(C.GoString(password), C.GoString(keydir)); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
return -1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue