Skip to content

Instantly share code, notes, and snippets.

@hewigovens
Last active December 5, 2019 06:23
Show Gist options
  • Save hewigovens/ad1169e4b51fb8cc2f76aa0937c28d66 to your computer and use it in GitHub Desktop.
Save hewigovens/ad1169e4b51fb8cc2f76aa0937c28d66 to your computer and use it in GitHub Desktop.
call wallet core from go on macOS
package main
// #cgo CFLAGS: -I${SRCDIR}/wallet-core/include
// #cgo LDFLAGS: -L${SRCDIR}/wallet-core/build/ios -lTrezorCrypto -lTrustWalletCore -lprotobuf -lc++
// #include <TrustWalletCore/TWHDWallet.h>
// #include <TrustWalletCore/TWString.h>
import "C"
import "fmt"
func main() {
fmt.Println("==> calling wallet core from go")
str := C.TWStringCreateWithUTF8Bytes(C.CString("confirm bleak useless tail chalk destroy horn step bulb genuine attract split"))
defer C.TWStringDelete(str)
valid := C.TWHDWalletIsValid(str)
fmt.Println("<== mnemonic is valid: ", valid)
}
@hewigovens
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment