Skip to content

Commit

Permalink
Extend .payments() call builder to encompass add'l non-payment types (
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Dec 1, 2023
1 parent f3384ce commit c17718d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ A breaking change will get clearly marked in this log.
### Fixed
* The `SorobanRpc.Server.getEvents` method now correctly parses responses without a `contractId` field set. The `events[i].contractId` field on an event is now optional, omitted if there was no ID for the event (e.g. system events; ([#883](https://github.com/stellar/js-stellar-sdk/pull/883))).

### Breaking Changes
* The `PaymentCallBuilder` was incorrectly indicating that it would return a collection of `Payment` records, while [in reality](https://developers.stellar.org/api/horizon/resources/list-all-payments) it can return a handful of "payment-like" records ([#885](https://github.com/stellar/js-stellar-sdk/pull/885)).


## [v11.0.0-beta.6](https://github.com/stellar/js-stellar-sdk/compare/v11.0.0-beta.5...v11.0.0-beta.6)

Expand Down
15 changes: 11 additions & 4 deletions src/horizon/payment_call_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ import { ServerApi } from "./server_api";
* Creates a new {@link PaymentCallBuilder} pointed to server defined by serverUrl.
*
* Do not create this object directly, use {@link Server#payments}.
* @see [All Payments](https://developers.stellar.org/api/resources/payments/)
* @see [All Payments](https://developers.stellar.org/api/horizon/resources/list-all-payments/)
* @constructor
* @extends CallBuilder
* @param {string} serverUrl Horizon server URL.
*/
export class PaymentCallBuilder extends CallBuilder<
ServerApi.CollectionPage<ServerApi.PaymentOperationRecord>
ServerApi.CollectionPage<
| ServerApi.PaymentOperationRecord
| ServerApi.CreateAccountOperationRecord
| ServerApi.AccountMergeOperationRecord
| ServerApi.PathPaymentOperationRecord
| ServerApi.PathPaymentStrictSendOperationRecord
| ServerApi.InvokeHostFunctionOperationRecord
>
> {
constructor(serverUrl: URI) {
super(serverUrl, "payments");
Expand All @@ -20,7 +27,7 @@ export class PaymentCallBuilder extends CallBuilder<

/**
* This endpoint responds with a collection of Payment operations where the given account was either the sender or receiver.
* @see [Payments for Account](https://developers.stellar.org/api/resources/accounts/payments/)
* @see [Payments for Account](https://developers.stellar.org/api/horizon/resources/get-payments-by-account-id)
* @param {string} accountId For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
* @returns {PaymentCallBuilder} this PaymentCallBuilder instance
*/
Expand All @@ -30,7 +37,7 @@ export class PaymentCallBuilder extends CallBuilder<

/**
* This endpoint represents all payment operations that are part of a valid transactions in a given ledger.
* @see [Payments for Ledger](https://developers.stellar.org/api/resources/ledgers/payments/)
* @see [Payments for Ledger](https://developers.stellar.org/api/horizon/resources/retrieve-a-ledgers-payments)
* @param {number|string} sequence Ledger sequence
* @returns {PaymentCallBuilder} this PaymentCallBuilder instance
*/
Expand Down

0 comments on commit c17718d

Please sign in to comment.