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

Updates for /assets and /claimable_balances/*/(operations|transactions) endpoints #628

Merged
merged 5 commits into from Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/horizon_api.ts
Expand Up @@ -88,6 +88,17 @@ export namespace Horizon {
? BalanceLineAsset<T>
: BalanceLineNative | BalanceLineAsset;

export interface AssetAccounts {
authorized: number;
authorized_to_maintain_liabilities: number;
unauthorized: number;
}
export interface AssetBalances {
authorized: string;
authorized_to_maintain_liabilities: string;
unauthorized: string;
}

paulbellamy marked this conversation as resolved.
Show resolved Hide resolved
export interface PriceR {
numerator: number;
denominator: number;
Expand Down
11 changes: 11 additions & 0 deletions src/operation_call_builder.ts
Expand Up @@ -47,6 +47,17 @@ export class OperationCallBuilder extends CallBuilder<
return this;
}

/**
* This endpoint represents all operations that reference a given claimable_balance.
* @see [Operations for Claimable Balance](https://www.stellar.org/developers/horizon/reference/endpoints/operations-for-claimable-balance.html)
* @param {string} claimableBalanceId Claimable Balance ID
* @returns {OperationCallBuilder} this OperationCallBuilder instance
*/
public forClaimableBalance(claimableBalanceId: string): this {
this.filter.push(["claimable_balances", claimableBalanceId, "operations"]);
return this;
}

/**
* This endpoint returns all operations that occurred in a given ledger.
*
Expand Down
4 changes: 4 additions & 0 deletions src/server_api.ts
Expand Up @@ -393,6 +393,10 @@ export namespace ServerApi {
asset_code: string;
asset_issuer: string;
paging_token: string;
accounts: Horizon.AssetAccounts;
num_claimable_balances: number;
balances: Horizon.AssetBalances;
claimable_balances_amount: string;
amount: string;
num_accounts: number;
flags: Horizon.Flags;
Expand Down
11 changes: 11 additions & 0 deletions src/transaction_call_builder.ts
Expand Up @@ -46,6 +46,17 @@ export class TransactionCallBuilder extends CallBuilder<
return this;
}

/**
* This endpoint represents all transactions that reference a given claimable_balance.
* @see [Operations for Claimable Balance](https://www.stellar.org/developers/horizon/reference/endpoints/transactions-for-claimable-balance.html)
* @param {string} claimableBalanceId Claimable Balance ID
* @returns {TransactionCallBuilder} this TransactionCallBuilder instance
*/
public forClaimableBalance(claimableBalanceId: string): this {
this.filter.push(["claimable_balances", claimableBalanceId, "transactions"]);
return this;
}

/**
* This endpoint represents all transactions in a given ledger.
* @see [Transactions for Ledger](https://www.stellar.org/developers/horizon/reference/endpoints/transactions-for-ledger.html)
Expand Down