github.com/bitfinexcom/bitfinex-api-go@v0.0.0-20210608095005-9e0b26f200fb/examples/v2/rest-generate-invoice/main.go (about)

     1  package main
     2  
     3  import (
     4  	"log"
     5  	"os"
     6  
     7  	"github.com/bitfinexcom/bitfinex-api-go/v2/rest"
     8  	"github.com/davecgh/go-spew/spew"
     9  )
    10  
    11  // Set BFX_API_KEY and BFX_API_SECRET:
    12  //
    13  // export BFX_API_KEY=<your-api-key>
    14  // export BFX_API_SECRET=<your-api-secret>
    15  //
    16  // you can obtain it from https://www.bitfinex.com/api
    17  
    18  func main() {
    19  	key := os.Getenv("BFX_API_KEY")
    20  	secret := os.Getenv("BFX_API_SECRET")
    21  
    22  	c := rest.
    23  		NewClient().
    24  		Credentials(key, secret)
    25  
    26  	args := rest.DepositInvoiceRequest{
    27  		Currency: "LNX",
    28  		Wallet:   "exchange",
    29  		Amount:   "0.002",
    30  	}
    31  
    32  	resp, err := c.Invoice.GenerateInvoice(args)
    33  	if err != nil {
    34  		log.Fatal(err)
    35  	}
    36  
    37  	spew.Dump(resp)
    38  }