Skip to content

Bithomp/xrpl-go-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@Bithomp/xrpl-go-api A Bithomp Go library for XRPL

Go Report Card GoDoc

Tests

go test -v ./...

clean package

go clean -i ./...

# To import all the necessary modules
go mod tidy

# To update the modules
go get -u ./...

Generate address and seed

package main

import (
  "fmt"
  "github.com/Bithomp/xrpl-go-api/crypto"
  "github.com/Bithomp/xrpl-go-api/wallet"
)

func main() {
  // Generate an address and seed
  seed, address, _ := wallet.Generate(crypto.ALGORITHM_ED25519)
  fmt.Println("Address: ", address)
  fmt.Println("Seed: ", seed)
}

Convert classic address to X-address

package main

import (
  "fmt"
  "github.com/Bithomp/xrpl-go-api/address_codec"
)

func main() {
  // Convert classic address to X-address
  xAddress := address_codec.ClassicAddressToXAddress("rsuUjfWxrACCAwGQDsNeZUhpzXf1n1NK5Z", nil, false)
  fmt.Println("xAddress: ", xAddress) // X7czuu79XJ4GHhN5bsHDNyNjCrDFgjXw9rE9ELS86d47DXo
}

Convert node public to classic address

package main

import (
  "fmt"
  "github.com/Bithomp/xrpl-go-api/address_codec"
)

func main() {
  // Convert node public to classic address
  rAddress := address_codec.NodePublicToClassicAddress("nHBtDzdRDykxiuv7uSMPTcGexNm879RUUz5GW4h1qgjbtyvWZ1LE")
  fmt.Println("rAddress: ", rAddress) // rHiJahydBswnAUMZk5yhTjTvcjBE1fXAGh
}

Convert node public to X-address

package main

import (
  "fmt"
  "github.com/Bithomp/xrpl-go-api/address_codec"
)

func main() {
  // Convert node public to X-address
  xAddress := address_codec.NodePublicToXAddress("nHBtDzdRDykxiuv7uSMPTcGexNm879RUUz5GW4h1qgjbtyvWZ1LE", nil, false)
  fmt.Println("xAddress: ", xAddress) // XVQT4qc3xZCA2agKHNTvqRNMKknq8BDqhRnEX6o9mV1GPC5
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages