Skip to main content

TrustBonding actions

Version: V2
View Markdown

API for @0xintuition/sdk@4.1.0. Compatibility · Source.

Import from @0xintuition/sdk/actions.

Signatures show the exact accepted inputs and return types. Named input/output structures and dependency-injection types are listed below; viem and protocol types come from their respective packages. Preparation and quote functions can perform RPC reads. Envelope builders on the action-envelope pages use caller-supplied read context and perform no RPC reads or signing. feeProxyExecutePlan sends transactions; the other SDK actions on these pages prepare transactions or read data.

trustBondingGetRewardsDashboard​

Read epoch, utilization, balance, and reward information for the selected account and return a dashboard snapshot.

Source

function trustBondingGetRewardsDashboard(
config: ReadConfig,
inputs: {
account: Address;
},
deps?: TrustBondingDashboardDeps,
): Promise<TrustBondingRewardsDashboard>;

Defaults: deps = defaultTrustBondingDeps. Dependency arguments are optional test/customization hooks; normal consumers use the built-in dependencies.

trustBondingGetClaimActionState​

Determine whether the selected account can claim rewards and return the reason and claim state for the UI.

Source

function trustBondingGetClaimActionState(
config: ReadConfig,
inputs: {
account: Address;
recipient?: string | null;
},
deps?: TrustBondingDashboardDeps,
): Promise<TrustBondingClaimActionState>;

Defaults: deps = defaultTrustBondingDeps. Dependency arguments are optional test/customization hooks; normal consumers use the built-in dependencies.

trustBondingPrepareLockAction​

Determine the applicable lock operation and prepare its calldata and value. The result describes the action; it does not request a signature.

Source

function trustBondingPrepareLockAction(
config: ReadConfig,
inputs: {
account: Address;
amountDelta?: bigint;
unlockTime?: bigint;
nowTimestamp?: bigint;
},
deps?: TrustBondingLockDeps,
): Promise<TrustBondingLockActionPlan>;

Defaults: deps = defaultTrustBondingLockDeps. Dependency arguments are optional test/customization hooks; normal consumers use the built-in dependencies.

trustBondingClaimAndRestakePlan​

Prepare ordered claim and restake steps using the current account and lock state. Review the plan before executing it.

Source

function trustBondingClaimAndRestakePlan(
config: ReadConfig,
inputs: {
account: Address;
recipient?: Address;
target:
| {
kind: 'trust-bonding';
wrappedTrustAddress: Address;
beneficiary?: Address;
}
| {
kind: 'multivault';
receiver?: Address;
termId: Hex;
curveId: bigint;
multiVaultConfig: WriteConfig;
slippageBps?: bigint;
};
},
deps?: TrustBondingClaimAndRestakeDeps,
): Promise<TrustBondingClaimAndRestakePlanResult>;

Defaults: deps = defaultTrustBondingClaimAndRestakeDeps. Dependency arguments are optional test/customization hooks; normal consumers use the built-in dependencies.

trustBondingGetLockStateSummary​

Read the account lock balance, expiry, and related state into a normalized summary.

Source

function trustBondingGetLockStateSummary(
config: ReadConfig,
inputs: {
account: Address;
nowTimestamp?: bigint;
},
deps?: TrustBondingLockDeps,
): Promise<TrustBondingLockStateSummary>;

Defaults: deps = defaultTrustBondingLockDeps. Dependency arguments are optional test/customization hooks; normal consumers use the built-in dependencies.

trustBondingGetEpochRewardsTimeline​

Read reward information across the requested epoch window and return timeline points for presentation.

Source

function trustBondingGetEpochRewardsTimeline(
config: ReadConfig,
inputs: {
account: Address;
startEpoch: bigint;
endEpoch: bigint;
},
deps?: TrustBondingTimelineDeps,
): Promise<TrustBondingEpochRewardsTimeline>;

Defaults: deps = defaultTrustBondingTimelineDeps. Dependency arguments are optional test/customization hooks; normal consumers use the built-in dependencies.

Imported type provenance​

Public import locations and the definitions used by these signatures and helper types. Value imports appear where a dependency hook uses typeof.

Name in this modulePublic importDefinition
multiVaultPreviewDepositimport { multiVaultPreviewDeposit } from '@0xintuition/protocol'Source definition
ReadConfigimport type { ReadConfig } from '@0xintuition/protocol'Source definition
trustBondingCurrentEpochimport { trustBondingCurrentEpoch } from '@0xintuition/protocol'Source definition
trustBondingEpochTimestampEndimport { trustBondingEpochTimestampEnd } from '@0xintuition/protocol'Source definition
trustBondingGetPersonalUtilizationRatioimport { trustBondingGetPersonalUtilizationRatio } from '@0xintuition/protocol'Source definition
trustBondingGetSystemApyimport { trustBondingGetSystemApy } from '@0xintuition/protocol'Source definition
trustBondingGetSystemUtilizationRatioimport { trustBondingGetSystemUtilizationRatio } from '@0xintuition/protocol'Source definition
trustBondingGetUserApyimport { trustBondingGetUserApy } from '@0xintuition/protocol'Source definition
trustBondingGetUserCurrentClaimableRewardsimport { trustBondingGetUserCurrentClaimableRewards } from '@0xintuition/protocol'Source definition
trustBondingGetUserInfoimport { trustBondingGetUserInfo } from '@0xintuition/protocol'Source definition
trustBondingGetUserRewardsForEpochimport { trustBondingGetUserRewardsForEpoch } from '@0xintuition/protocol'Source definition
trustBondingHasClaimedRewardsForEpochimport { trustBondingHasClaimedRewardsForEpoch } from '@0xintuition/protocol'Source definition
trustBondingLockedimport { trustBondingLocked } from '@0xintuition/protocol'Source definition
trustBondingLockedEndimport { trustBondingLockedEnd } from '@0xintuition/protocol'Source definition
trustBondingPreviousEpochimport { trustBondingPreviousEpoch } from '@0xintuition/protocol'Source definition
trustBondingUserEligibleRewardsForEpochimport { trustBondingUserEligibleRewardsForEpoch } from '@0xintuition/protocol'Source definition
WriteConfigimport type { WriteConfig } from '@0xintuition/protocol'Source definition
Addressimport type { Address } from 'viem'Owned by the external package.
Heximport type { Hex } from 'viem'Owned by the external package.

Input and result types​

Exported declarations are public imports from the SDK subpath above. Module-local helper aliases describe accepted shapes but are not public exports.

ApyTuple​

Module-local helper; not a public export.

type ApyTuple = readonly [bigint, bigint] & {
currentApy?: bigint;
maxApy?: bigint;
};

UserInfoTuple​

Module-local helper; not a public export.

type UserInfoTuple = readonly [
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
] & {
personalUtilization?: bigint;
eligibleRewards?: bigint;
maxRewards?: bigint;
lockedAmount?: bigint;
lockEnd?: bigint;
bondedBalance?: bigint;
};

LockedTuple​

Module-local helper; not a public export.

type LockedTuple = readonly [bigint, bigint] & {
amount?: bigint;
end?: bigint;
};

UserRewardsForEpochTuple​

Module-local helper; not a public export.

type UserRewardsForEpochTuple = readonly [bigint, bigint] & {
currentRewards?: bigint;
maxRewards?: bigint;
};

TrustBondingUserInfoSnapshot​

Public export.

export type TrustBondingUserInfoSnapshot = {
personalUtilization: bigint;
eligibleRewards: bigint;
maxRewards: bigint;
lockedAmount: bigint;
lockEnd: bigint;
bondedBalance: bigint;
};

TrustBondingRewardsDashboard​

Public export.

export type TrustBondingRewardsDashboard = {
account: Address;
currentEpoch: bigint;
previousEpoch: bigint;
currentEpochEndTimestamp: bigint;
userInfo: TrustBondingUserInfoSnapshot;
currentClaimableRewards: bigint;
userApy: {
currentApy: bigint;
maxApy: bigint;
};
systemApy: {
currentApy: bigint;
maxApy: bigint;
};
hasClaimedPreviousEpochRewards: boolean;
};

TrustBondingClaimActionReason​

Public export.

export type TrustBondingClaimActionReason =
| 'can-claim'
| 'invalid-recipient'
| 'too-early'
| 'already-claimed'
| 'nothing-to-claim'
| 'inconsistent-state';

TrustBondingClaimActionState​

Public export.

export type TrustBondingClaimActionState = {
account: Address;
recipient: Address | null;
currentEpoch: bigint;
previousEpoch: bigint | null;
claimableRewards: bigint;
hasClaimedPreviousEpochRewards: boolean | null;
canClaim: boolean;
reason: TrustBondingClaimActionReason;
ctaLabel: string;
};

TrustBondingLockActionKind​

Public export.

export type TrustBondingLockActionKind =
| 'createLock'
| 'increaseAmount'
| 'increaseUnlockTime'
| 'increaseAmountAndTime'
| 'withdrawAndCreateLock';

TrustBondingLockActionPlan​

Public export.

export type TrustBondingLockActionPlan = {
account: Address;
action: TrustBondingLockActionKind;
args: readonly bigint[];
calldata: Hex;
lockedAmount: bigint;
lockEnd: bigint;
nowTimestamp: bigint;
isExpired: boolean;
};

TrustBondingClaimAndRestakeStep​

Public export.

export type TrustBondingClaimAndRestakeStep = {
type:
| 'claimRewards'
| 'wrappedTrustDeposit'
| 'wrappedTrustApprove'
| 'trustBondingDepositFor'
| 'multiVaultDeposit';
to: Address;
calldata: Hex;
value?: bigint;
estimatedAmount: bigint;
};

TrustBondingClaimAndRestakePlanResult​

Public export.

export type TrustBondingClaimAndRestakePlanResult = {
account: Address;
recipient: Address;
claimableRewards: bigint;
target: 'trust-bonding' | 'multivault';
steps: TrustBondingClaimAndRestakeStep[];
estimatedSharesOut?: bigint;
minSharesOut?: bigint;
};

TrustBondingLockStateSummary​

Public export.

export type TrustBondingLockStateSummary = {
account: Address;
lockedAmount: bigint;
lockEnd: bigint;
nowTimestamp: bigint;
isExpired: boolean;
timeRemaining: bigint;
nextActions: TrustBondingLockActionKind[];
};

TrustBondingEpochRewardsPoint​

Public export.

export type TrustBondingEpochRewardsPoint = {
epoch: bigint;
eligibleRewards: bigint;
currentRewards: bigint;
maxRewards: bigint;
hasClaimed: boolean;
personalUtilizationRatio: bigint;
systemUtilizationRatio: bigint;
statusLabel: 'claimed' | 'claimable' | 'unclaimed' | 'no-rewards';
};

TrustBondingEpochRewardsTimeline​

Public export.

export type TrustBondingEpochRewardsTimeline = {
account: Address;
startEpoch: bigint;
endEpoch: bigint;
currentEpoch: bigint;
totalEligibleRewards: bigint;
totalCurrentRewards: bigint;
totalMaxRewards: bigint;
points: TrustBondingEpochRewardsPoint[];
};

TrustBondingDashboardDeps​

Module-local helper; not a public export.

type TrustBondingDashboardDeps = {
currentEpoch: typeof trustBondingCurrentEpoch;
previousEpoch: typeof trustBondingPreviousEpoch;
epochTimestampEnd: typeof trustBondingEpochTimestampEnd;
getUserInfo: typeof trustBondingGetUserInfo;
getUserCurrentClaimableRewards: typeof trustBondingGetUserCurrentClaimableRewards;
getUserApy: typeof trustBondingGetUserApy;
getSystemApy: typeof trustBondingGetSystemApy;
hasClaimedRewardsForEpoch: typeof trustBondingHasClaimedRewardsForEpoch;
};

TrustBondingLockDeps​

Module-local helper; not a public export.

type TrustBondingLockDeps = {
locked: typeof trustBondingLocked;
lockedEnd: typeof trustBondingLockedEnd;
};

TrustBondingClaimAndRestakeDeps​

Module-local helper; not a public export.

type TrustBondingClaimAndRestakeDeps = {
getClaimActionState: typeof trustBondingGetClaimActionState;
previewDeposit: typeof multiVaultPreviewDeposit;
};

TrustBondingTimelineDeps​

Module-local helper; not a public export.

type TrustBondingTimelineDeps = {
currentEpoch: typeof trustBondingCurrentEpoch;
userEligibleRewardsForEpoch: typeof trustBondingUserEligibleRewardsForEpoch;
hasClaimedRewardsForEpoch: typeof trustBondingHasClaimedRewardsForEpoch;
getUserRewardsForEpoch: typeof trustBondingGetUserRewardsForEpoch;
getPersonalUtilizationRatio: typeof trustBondingGetPersonalUtilizationRatio;
getSystemUtilizationRatio: typeof trustBondingGetSystemUtilizationRatio;
};

Applies to V2 · @0xintuition/sdk 4.1.0