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/accounts"
|
||||||
"github.com/ethereum/go-ethereum/node"
|
"github.com/ethereum/go-ethereum/node"
|
||||||
"github.com/urfave/cli"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -13,13 +12,13 @@ var (
|
||||||
scryptP = 1
|
scryptP = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
func createAccount(c *cli.Context) error {
|
func createAccount(password, keydir string) error {
|
||||||
|
|
||||||
var sync *[]node.Service
|
var sync *[]node.Service
|
||||||
w := true
|
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 {
|
if err != nil {
|
||||||
return err
|
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
|
package main
|
||||||
|
|
||||||
// #ifdef __cplusplus
|
|
||||||
// extern "C" {
|
|
||||||
// #endif
|
|
||||||
//
|
|
||||||
// extern int runCreateAccount(const char*);
|
|
||||||
//
|
|
||||||
// #ifdef __cplusplus
|
|
||||||
// }
|
|
||||||
// #endif
|
|
||||||
import "C"
|
import "C"
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//export doRunCreateAccount
|
//export doCreateAccount
|
||||||
func doRunCreateAccount(args *C.char) C.int {
|
func doCreateAccount(password, keydir *C.char) C.int {
|
||||||
// This is equivalent to creating an account from the command line,
|
// This is equivalent to creating an account from the command line,
|
||||||
// just modified to handle the function arg passing
|
// 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)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue