Skip to content

Commit

Permalink
Rename variables to match the truth better
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Sep 14, 2024
1 parent f527390 commit bb7771b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/rpc/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ export namespace Api {
export interface ContractBalanceResponse {
latestLedger: number;
// present only on success, otherwise request malformed or no balance
trustline?: {
balance: string;
balanceEntry?: {
amount: string;
authorized: boolean;
clawback: boolean;

Expand Down
4 changes: 2 additions & 2 deletions src/rpc/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -982,10 +982,10 @@ export class Server {
// these fields exist:
return {
latestLedger: response.latestLedger,
trustline: {
balanceEntry: {
liveUntilLedgerSeq,
lastModifiedLedgerSeq,
balance: entry.amount.toString(),
amount: entry.amount.toString(),
authorized: entry.authorized,
clawback: entry.clawback,
}
Expand Down
16 changes: 8 additions & 8 deletions test/unit/server/soroban/get_contract_balance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ describe("Server#getContractBalance", function () {
.getContractBalance(contract, token, StellarSdk.Networks.TESTNET)
.then((response) => {
expect(response.latestLedger).to.equal(1000);
expect(response.trustline).to.not.be.undefined;
expect(response.trustline.balance).to.equal("1000000000000");
expect(response.trustline.authorized).to.be.true;
expect(response.trustline.clawback).to.be.false;
expect(response.balanceEntry).to.not.be.undefined;
expect(response.balanceEntry.amount).to.equal("1000000000000");
expect(response.balanceEntry.authorized).to.be.true;
expect(response.balanceEntry.clawback).to.be.false;
done();
})
.catch((err) => done(err));
Expand Down Expand Up @@ -125,10 +125,10 @@ describe("Server#getContractBalance", function () {
.getContractBalance(contract, token)
.then((response) => {
expect(response.latestLedger).to.equal(1000);
expect(response.trustline).to.not.be.undefined;
expect(response.trustline.balance).to.equal("1000000000000");
expect(response.trustline.authorized).to.be.true;
expect(response.trustline.clawback).to.be.false;
expect(response.balanceEntry).to.not.be.undefined;
expect(response.balanceEntry.amount).to.equal("1000000000000");
expect(response.balanceEntry.authorized).to.be.true;
expect(response.balanceEntry.clawback).to.be.false;
done();
})
.catch((err) => done(err));
Expand Down

0 comments on commit bb7771b

Please sign in to comment.