For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Querying Obligation Accounts

Use ScallopQuery to read the Obligation Accounts owned by a wallet, including their collaterals, debts and risk level. All methods below are read-only and do not require a secretKey; a walletAddress is enough.

import { ScallopQuery } from '@scallop-io/sui-scallop-sdk';

const scallopQuery = new ScallopQuery({
  addressId: '695fcdc084f790c04eb068dc',
  fullnodeUrl: 'https://fullnode.mainnet.sui.io:443',
  walletAddress: '0x...',
});

await scallopQuery.init();

Get Owned Obligations

Returns the id, key id and lock status of every Obligation Account owned by the address. locked is true when the obligation is staked in the borrow incentive program.

const obligations = await scallopQuery.getObligations();
// [{ id: '0x...', keyId: '0x...', locked: false }, ...]

// Query another wallet
const others = await scallopQuery.getObligations('0x...');

Get Obligation Accounts Information

getObligationAccounts returns the detailed collateral and borrowing information of all obligations owned by the address, keyed by obligation id.

To read a single obligation, use getObligationAccount:

Fields ending with Amount are in the coin's smallest unit (e.g. 1e9 for 1 SUI), while fields ending with Coin are in the coin's normal unit.

Main Fields of ObligationAccount

Field
Description

obligationId

Obligation Account id

totalDepositedValue

Total value of all deposited collaterals (USD)

totalBorrowedValue

Total value of all debts (USD)

totalBorrowCapacityValue

Maximum debt value allowed by the collaterals (USD)

totalAvailableCollateralValue

Collateral value that is not required by the current debts (USD)

totalRiskLevel

Ratio of weighted debt to unhealthy collateral. Liquidatable above 1

collaterals

Collateral details, keyed by coin name

debts

Debt details (including borrow incentive rewards), keyed by coin name

Query Raw Obligation Data

queryObligation returns the raw collateral and debt amounts of one obligation, without prices or risk calculation.

Check If an Obligation is Locked

An obligation that is staked in the borrow incentive program is locked, and some actions (such as withdrawing collateral) are not available until it is unstaked.

Was this helpful?