Skip to content

Commit

Permalink
Add new asset stat fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Jul 12, 2023
1 parent af5871f commit dcc2fb7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ A breaking change will get clearly marked in this log.

## Unreleased

### Add

- Asset stat records (`ServerApi.AssetRecord`) contain two new fields to support the Protocol 20 (Soroban) release ([#TODO](https://github.com/stellar/js-stellar-sdk/pulls/)):
* `num_contracts` - the integer quantity of contracts that hold this asset
* `contracts_amount` - the total units of that asset held by contracts


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

Expand Down
8 changes: 5 additions & 3 deletions src/types/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ export interface AssetRecord extends Horizon.BaseResponse {
asset_issuer: string;
paging_token: string;
accounts: Horizon.AssetAccounts;
balances: Horizon.AssetBalances;
num_claimable_balances: number;
num_liquidity_pools: number;
balances: Horizon.AssetBalances;
claimable_balances_amount: string;
amount: string;
num_contracts: number;
num_accounts: number;
amount: string;
claimable_balances_amount: string;
liquidity_pools_amount: string;
contracts_amount: string;
flags: Horizon.Flags;
}
8 changes: 8 additions & 0 deletions test/unit/server_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3479,12 +3479,14 @@ describe("server.js non-transaction tests", function () {
unauthorized: 0,
},
num_claimable_balances: 3,
num_contracts: 2,
balances: {
authorized: "1000000.0000000",
authorized_to_maintain_liabilities: "500000.0000000",
unauthorized: "0.0000000",
},
claimable_balances_amount: "0.0000000",
contracts_amount: "1000.0000000",
amount: "1000000.0000000",
num_accounts: 2,
flags: {
Expand Down Expand Up @@ -3553,12 +3555,14 @@ describe("server.js non-transaction tests", function () {
unauthorized: 0,
},
num_claimable_balances: 3,
num_contracts: 2,
balances: {
authorized: "111.0010000",
authorized_to_maintain_liabilities: "55.5005000",
unauthorized: "0.0000000",
},
claimable_balances_amount: "0.0000000",
contracts_amount: "10000.0000000",
amount: "111.0010000",
num_accounts: 127,
flags: {
Expand Down Expand Up @@ -3629,12 +3633,14 @@ describe("server.js non-transaction tests", function () {
unauthorized: 0,
},
num_claimable_balances: 3,
num_contracts: 2,
balances: {
authorized: "757.0000000",
authorized_to_maintain_liabilities: "378.5000000",
unauthorized: "0.0000000",
},
claimable_balances_amount: "0.0000000",
contracts_amount: "10000.0000000",
amount: "757.0000000",
num_accounts: 18,
flags: {
Expand Down Expand Up @@ -3704,12 +3710,14 @@ describe("server.js non-transaction tests", function () {
unauthorized: 0,
},
num_claimable_balances: 0,
num_contracts: 2,
balances: {
authorized: "1387.0000000",
authorized_to_maintain_liabilities: "0.0000000",
unauthorized: "0.0000000",
},
claimable_balances_amount: "0.0000000",
contracts_amount: "10000.0000000",
amount: "1387.0000000",
num_accounts: 1,
flags: {
Expand Down

0 comments on commit dcc2fb7

Please sign in to comment.