Skip to content

horizonclient v2.1.0

Compare
Choose a tag to compare
@abuiles abuiles released this 24 Feb 15:45
4e70d6a

Add

  • Add client.StrictReceivePaths and client.StrictSendPaths (#2237).

client.StrictReceivePaths:

	client := horizonclient.DefaultPublicNetClient
	// Find paths for XLM->NGN
	pr := horizonclient.PathsRequest{
		DestinationAccount:     "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU",
		DestinationAmount:      "100",
		DestinationAssetCode:   "NGN",
		DestinationAssetIssuer: "GDZST3XVCDTUJ76ZAV2HA72KYQODXXZ5PTMAPZGDHZ6CS7RO7MGG3DBM",
		DestinationAssetType:   horizonclient.AssetType4,
		SourceAccount:          "GDZST3XVCDTUJ76ZAV2HA72KYQODXXZ5PTMAPZGDHZ6CS7RO7MGG3DBM",
	}
	paths, err := client.StrictReceivePaths(pr)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Print(paths)

client.StrictSendPaths:

	client := horizonclient.DefaultPublicNetClient
	// Find paths for USD->EUR
	pr := horizonclient.StrictSendPathsRequest{
		SourceAmount:      "20",
		SourceAssetCode:   "USD",
		SourceAssetIssuer: "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX",
		SourceAssetType:   horizonclient.AssetType4,
		DestinationAssets: "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S",
	}
	paths, err := client.StrictSendPaths(pr)
  • Add client.OfferDetails (#2303).
	client := horizonclient.DefaultPublicNetClient
	offer, err := client.OfferDetails("2")
	if err != nil {
		fmt.Println(err)
		return
	}	
	fmt.Print(offer)
  • Add support to client.Offers for the filters: Seller, Selling and Buying (#2230).
	offerRequest = horizonclient.OfferRequest{
		Seller:  "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU",
		Selling: "COP:GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU",
		Buying:  "EUR:GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU",
		Order:   horizonclient.OrderDesc,
	}	
	offers, err = client.Offers(offerRequest)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Print(offers)
  • Add client.Accounts (#2229).

This feature allows account retrieval filtering by signer or by a trustline to an asset.

	client := horizonclient.DefaultPublicNetClient
	accountID := "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU"
	accountsRequest := horizonclient.AccountsRequest{Signer: accountID}	
	account, err := client.Accounts(accountsRequest)
	if err != nil {
		fmt.Println(err)
		return
	}	
	fmt.Print(account)
  • Add IsNotFoundError (#2197).

Deprecate

  • Make hProtocol.FeeStats backwards compatible with Horizon 0.24.1 and 1.0 deprecating usage of *_accepted_fee (#2290).

All the _accepted_fee fields were removed in Horizon 1.0, however we extended this version of the SDK to backfill the FeeStat struct using data from MaxFee. This is a temporary workaround and it will be removed in horizonclient 3.0. Please start using data from FeeStat.MaxFee instead.