Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend .payments() call builder to encompass add'l non-payment types #885

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Shaptic marked this conversation as resolved.
Show resolved Hide resolved
| 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
Loading