loyalty
Interfaces
Section titled “Interfaces”LoyaltyAtlasBankSnapshot
Section titled “LoyaltyAtlasBankSnapshot”Defined in: packages/sage/src/loyalty/index.ts:93
Immutable accumulated ATLAS bank for one Profile and faction.
Example
Section titled “Example”declare const bank: LoyaltyAtlasBankSnapshot;console.log(bank.claimableAtlasRaw, bank.expiresAtUnixSeconds);Extends
Section titled “Extends”Omit<LoyaltyAtlasBankAccountData,"game"|"profile"|"factionId">
Properties
Section titled “Properties”address
Section titled “address”readonly address: Address;Defined in: packages/sage/src/loyalty/index.ts:98
readonly bump: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:138
Inherited from
Section titled “Inherited from”Omit.bumpclaimableAtlasRaw
Section titled “claimableAtlasRaw”readonly claimableAtlasRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:142
Inherited from
Section titled “Inherited from”Omit.claimableAtlasRawexpiresAtUnixSeconds
Section titled “expiresAtUnixSeconds”readonly expiresAtUnixSeconds: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:146
Inherited from
Section titled “Inherited from”Omit.expiresAtUnixSecondsfaction
Section titled “faction”readonly faction: EntityRef<"faction">;Defined in: packages/sage/src/loyalty/index.ts:102
factionId
Section titled “factionId”readonly factionId: number;Defined in: packages/sage/src/loyalty/index.ts:101
readonly game: EntityRef<"game">;Defined in: packages/sage/src/loyalty/index.ts:99
readonly kind: "loyaltyAtlasBank";Defined in: packages/sage/src/loyalty/index.ts:97
lastCreditedAtUnixSeconds
Section titled “lastCreditedAtUnixSeconds”readonly lastCreditedAtUnixSeconds: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:145
Inherited from
Section titled “Inherited from”Omit.lastCreditedAtUnixSecondslifetimeAtlasRaw
Section titled “lifetimeAtlasRaw”readonly lifetimeAtlasRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:144
Inherited from
Section titled “Inherited from”Omit.lifetimeAtlasRawlifetimeLpRaw
Section titled “lifetimeLpRaw”readonly lifetimeLpRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:143
Inherited from
Section titled “Inherited from”Omit.lifetimeLpRawprofile
Section titled “profile”readonly profile: EntityRef<"profile">;Defined in: packages/sage/src/loyalty/index.ts:100
version
Section titled “version”readonly version: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:137
Inherited from
Section titled “Inherited from”Omit.versionMethods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): unknown;Defined in: packages/sage/src/loyalty/index.ts:103
Returns
Section titled “Returns”unknown
LoyaltyContributionSnapshot
Section titled “LoyaltyContributionSnapshot”Defined in: packages/sage/src/loyalty/index.ts:71
Immutable Profile contribution for one faction epoch.
Example
Section titled “Example”declare const contribution: LoyaltyContributionSnapshot;console.log(contribution.profile.address, contribution.lpRaw);Extends
Section titled “Extends”Omit<LoyaltyContributionAccountData,"game"|"profile"|"factionId"|"settledAtUnixSeconds">
Properties
Section titled “Properties”address
Section titled “address”readonly address: Address;Defined in: packages/sage/src/loyalty/index.ts:76
atlasEntitlementRaw
Section titled “atlasEntitlementRaw”readonly atlasEntitlementRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:132
Inherited from
Section titled “Inherited from”Omit.atlasEntitlementRawreadonly bump: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:125
Inherited from
Section titled “Inherited from”Omit.bumpreadonly epoch: EntityRef<"loyaltyEpoch">;Defined in: packages/sage/src/loyalty/index.ts:81
epochIndex
Section titled “epochIndex”readonly epochIndex: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:130
Inherited from
Section titled “Inherited from”Omit.epochIndexfaction
Section titled “faction”readonly faction: EntityRef<"faction">;Defined in: packages/sage/src/loyalty/index.ts:80
factionId
Section titled “factionId”readonly factionId: number;Defined in: packages/sage/src/loyalty/index.ts:79
readonly game: EntityRef<"game">;Defined in: packages/sage/src/loyalty/index.ts:77
readonly kind: "loyaltyContribution";Defined in: packages/sage/src/loyalty/index.ts:75
readonly lpRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:131
Inherited from
Section titled “Inherited from”Omit.lpRawprofile
Section titled “profile”readonly profile: EntityRef<"profile">;Defined in: packages/sage/src/loyalty/index.ts:78
settled
Section titled “settled”readonly settled: boolean;Defined in: packages/sage/src/internal/c4/loyalty.ts:126
Inherited from
Section titled “Inherited from”Omit.settledsettledAtUnixSeconds
Section titled “settledAtUnixSeconds”readonly settledAtUnixSeconds: bigint | undefined;Defined in: packages/sage/src/loyalty/index.ts:82
version
Section titled “version”readonly version: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:124
Inherited from
Section titled “Inherited from”Omit.versionMethods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): unknown;Defined in: packages/sage/src/loyalty/index.ts:83
Returns
Section titled “Returns”unknown
LoyaltyEpochSnapshot
Section titled “LoyaltyEpochSnapshot”Defined in: packages/sage/src/loyalty/index.ts:51
Immutable faction loyalty epoch with exact LP/ATLAS values.
Example
Section titled “Example”declare const epoch: LoyaltyEpochSnapshot;console.log(epoch.faction.address, epoch.totalLpRaw);Extends
Section titled “Extends”Omit<LoyaltyEpochAccountData,"game"|"factionId">
Properties
Section titled “Properties”address
Section titled “address”readonly address: Address;Defined in: packages/sage/src/loyalty/index.ts:56
readonly bump: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:107
Inherited from
Section titled “Inherited from”Omit.bumpconfigVersion
Section titled “configVersion”readonly configVersion: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:112
Inherited from
Section titled “Inherited from”Omit.configVersionendsAtUnixSeconds
Section titled “endsAtUnixSeconds”readonly endsAtUnixSeconds: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:115
Inherited from
Section titled “Inherited from”Omit.endsAtUnixSecondsepochIndex
Section titled “epochIndex”readonly epochIndex: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:113
Inherited from
Section titled “Inherited from”Omit.epochIndexfaction
Section titled “faction”readonly faction: EntityRef<"faction">;Defined in: packages/sage/src/loyalty/index.ts:59
factionId
Section titled “factionId”readonly factionId: number;Defined in: packages/sage/src/loyalty/index.ts:58
readonly game: EntityRef<"game">;Defined in: packages/sage/src/loyalty/index.ts:57
readonly kind: "loyaltyEpoch";Defined in: packages/sage/src/loyalty/index.ts:55
kingSystems
Section titled “kingSystems”readonly kingSystems: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:109
Inherited from
Section titled “Inherited from”Omit.kingSystemspoolAtlasRaw
Section titled “poolAtlasRaw”readonly poolAtlasRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:118
Inherited from
Section titled “Inherited from”Omit.poolAtlasRawrewardConfig
Section titled “rewardConfig”readonly rewardConfig: EntityRef<"atlasRewardConfig">;Defined in: packages/sage/src/loyalty/index.ts:60
settledAtlasRaw
Section titled “settledAtlasRaw”readonly settledAtlasRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:120
Inherited from
Section titled “Inherited from”Omit.settledAtlasRawsettlementDeadlineUnixSeconds
Section titled “settlementDeadlineUnixSeconds”readonly settlementDeadlineUnixSeconds: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:116
Inherited from
Section titled “Inherited from”Omit.settlementDeadlineUnixSecondsstartsAtUnixSeconds
Section titled “startsAtUnixSeconds”readonly startsAtUnixSeconds: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:114
Inherited from
Section titled “Inherited from”Omit.startsAtUnixSecondsstatus
Section titled “status”readonly status: LoyaltyEpochStatus;Defined in: packages/sage/src/internal/c4/loyalty.ts:108
Inherited from
Section titled “Inherited from”Omit.statustotalLpRaw
Section titled “totalLpRaw”readonly totalLpRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:117
Inherited from
Section titled “Inherited from”Omit.totalLpRawunsettledAtlasRaw
Section titled “unsettledAtlasRaw”readonly unsettledAtlasRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:119
Inherited from
Section titled “Inherited from”Omit.unsettledAtlasRawversion
Section titled “version”readonly version: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:106
Inherited from
Section titled “Inherited from”Omit.versionMethods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): unknown;Defined in: packages/sage/src/loyalty/index.ts:61
Returns
Section titled “Returns”unknown
Type Aliases
Section titled “Type Aliases”LoyaltyAtlasBankState
Section titled “LoyaltyAtlasBankState”type LoyaltyAtlasBankState = | { kind: "empty";} | { claimableAtlasRaw: bigint; kind: "claimable";} | { claimableAtlasRaw: bigint; kind: "expired";};Defined in: packages/sage/src/loyalty/index.ts:136
Claimability state of one loyalty ATLAS bank.
Example
Section titled “Example”const state: LoyaltyAtlasBankState = { kind: 'empty' };LoyaltyContributionState
Section titled “LoyaltyContributionState”type LoyaltyContributionState = | { kind: "unsettled";} | { kind: "settled"; settledAtUnixSeconds: bigint;} | { kind: "expired";};Defined in: packages/sage/src/loyalty/index.ts:125
Settlement state of one loyalty contribution.
Example
Section titled “Example”const state: LoyaltyContributionState = { kind: 'unsettled' };LoyaltyDiscoveryOptions
Section titled “LoyaltyDiscoveryOptions”type LoyaltyDiscoveryOptions = Omit<DiscoveryRequest, "filters" | "strategy">;Defined in: packages/sage/src/loyalty/index.ts:39
Options accepted by targeted loyalty reverse discovery.
Example
Section titled “Example”const options: LoyaltyDiscoveryOptions = { commitment: 'confirmed' };LoyaltyEpochState
Section titled “LoyaltyEpochState”type LoyaltyEpochState = | { kind: "scheduled";} | { kind: "open"; remainingSeconds: bigint;} | { kind: "settling"; remainingSeconds: bigint;} | { kind: "expired";} | { kind: "swept";};Defined in: packages/sage/src/loyalty/index.ts:112
Time-projected lifecycle of one loyalty epoch.
Example
Section titled “Example”const state: LoyaltyEpochState = { kind: 'scheduled' };Functions
Section titled “Functions”deriveLoyaltyAtlasBankState()
Section titled “deriveLoyaltyAtlasBankState()”function deriveLoyaltyAtlasBankState(bank, atUnixSeconds): LoyaltyAtlasBankState;Defined in: packages/sage/src/loyalty/index.ts:641
Projects whether an accumulated ATLAS bank is empty, claimable, or expired.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
bank | Pick<LoyaltyAtlasBankSnapshot, "claimableAtlasRaw" | "expiresAtUnixSeconds"> |
atUnixSeconds | bigint |
Returns
Section titled “Returns”Example
Section titled “Example”declare const bank: LoyaltyAtlasBankSnapshot;const state = deriveLoyaltyAtlasBankState(bank, 1_700_000_000n);deriveLoyaltyContributionState()
Section titled “deriveLoyaltyContributionState()”function deriveLoyaltyContributionState( contribution, epoch, atUnixSeconds): LoyaltyContributionState;Defined in: packages/sage/src/loyalty/index.ts:588
Projects settlement or expiry for one contribution and matching epoch. Unsettled contributions are expired as soon as their epoch is swept.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
contribution | Pick<LoyaltyContributionSnapshot, "settled" | "settledAtUnixSeconds" | "epoch" | "factionId" | "game"> |
epoch | Pick<LoyaltyEpochSnapshot, | "address" | "factionId" | "game" | "status" | "endsAtUnixSeconds" | "settlementDeadlineUnixSeconds"> |
atUnixSeconds | bigint |
Returns
Section titled “Returns”Example
Section titled “Example”declare const contribution: LoyaltyContributionSnapshot;declare const epoch: LoyaltyEpochSnapshot;const state = deriveLoyaltyContributionState(contribution, epoch, 1_700_000_000n);deriveLoyaltyEpochState()
Section titled “deriveLoyaltyEpochState()”function deriveLoyaltyEpochState(epoch, atUnixSeconds): LoyaltyEpochState;Defined in: packages/sage/src/loyalty/index.ts:548
Projects a loyalty epoch at an explicit Unix timestamp.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
epoch | Pick<LoyaltyEpochSnapshot, | "status" | "startsAtUnixSeconds" | "endsAtUnixSeconds" | "settlementDeadlineUnixSeconds"> |
atUnixSeconds | bigint |
Returns
Section titled “Returns”Example
Section titled “Example”declare const epoch: LoyaltyEpochSnapshot;const state = deriveLoyaltyEpochState(epoch, epoch.startsAtUnixSeconds);getLoyaltyAtlasBank()
Section titled “getLoyaltyAtlasBank()”function getLoyaltyAtlasBank( context, profile, factionId,options?): Promise<LoyaltyAtlasBankSnapshot>;Defined in: packages/sage/src/loyalty/index.ts:437
Derives and reads a required Profile loyalty ATLAS bank.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
profile | Address |
factionId | number |
options? | ReadOptions |
Returns
Section titled “Returns”Promise<LoyaltyAtlasBankSnapshot>
Example
Section titled “Example”declare const ctx: SageContext;declare const profile: Address;const bank = await getLoyaltyAtlasBank(ctx, profile, 3);getLoyaltyAtlasBanksByProfile()
Section titled “getLoyaltyAtlasBanksByProfile()”function getLoyaltyAtlasBanksByProfile( context, profile,options?): Promise<readonly LoyaltyAtlasBankSnapshot[]>;Defined in: packages/sage/src/loyalty/index.ts:523
Discovers validated loyalty ATLAS banks for one Profile.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
profile | Address |
options? | LoyaltyDiscoveryOptions |
Returns
Section titled “Returns”Promise<readonly LoyaltyAtlasBankSnapshot[]>
Example
Section titled “Example”declare const ctx: SageContext;declare const profile: Address;const banks = await getLoyaltyAtlasBanksByProfile(ctx, profile);getLoyaltyContribution()
Section titled “getLoyaltyContribution()”function getLoyaltyContribution( context, profile, factionId, epochIndex,options?): Promise<LoyaltyContributionSnapshot>;Defined in: packages/sage/src/loyalty/index.ts:343
Derives and reads one required Profile contribution.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
profile | Address |
factionId | number |
epochIndex | bigint |
options? | ReadOptions |
Returns
Section titled “Returns”Promise<LoyaltyContributionSnapshot>
Example
Section titled “Example”declare const ctx: SageContext;declare const profile: Address;const contribution = await getLoyaltyContribution(ctx, profile, 1, 20_668n);getLoyaltyContributionsByProfile()
Section titled “getLoyaltyContributionsByProfile()”function getLoyaltyContributionsByProfile( context, profile,options?): Promise<readonly LoyaltyContributionSnapshot[]>;Defined in: packages/sage/src/loyalty/index.ts:497
Discovers validated loyalty contributions for one Profile.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
profile | Address |
options? | LoyaltyDiscoveryOptions |
Returns
Section titled “Returns”Promise<readonly LoyaltyContributionSnapshot[]>
Example
Section titled “Example”declare const ctx: SageContext;declare const profile: Address;const contributions = await getLoyaltyContributionsByProfile(ctx, profile);getLoyaltyEpoch()
Section titled “getLoyaltyEpoch()”function getLoyaltyEpoch( context, factionId, epochIndex,options?): Promise<LoyaltyEpochSnapshot>;Defined in: packages/sage/src/loyalty/index.ts:318
Derives and reads one required faction loyalty epoch.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
factionId | number |
epochIndex | bigint |
options? | ReadOptions |
Returns
Section titled “Returns”Promise<LoyaltyEpochSnapshot>
Example
Section titled “Example”declare const ctx: SageContext;const epoch = await getLoyaltyEpoch(ctx, 1, 20_665n);getLoyaltyEpochsByFaction()
Section titled “getLoyaltyEpochsByFaction()”function getLoyaltyEpochsByFaction( context, factionId,options?): Promise<readonly LoyaltyEpochSnapshot[]>;Defined in: packages/sage/src/loyalty/index.ts:471
Discovers validated loyalty epochs for one faction.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
factionId | number |
options? | LoyaltyDiscoveryOptions |
Returns
Section titled “Returns”Promise<readonly LoyaltyEpochSnapshot[]>
Example
Section titled “Example”declare const ctx: SageContext;const epochs = await getLoyaltyEpochsByFaction(ctx, 1);maybeGetLoyaltyAtlasBank()
Section titled “maybeGetLoyaltyAtlasBank()”function maybeGetLoyaltyAtlasBank( context, profile, factionId, options?): Promise< | LoyaltyAtlasBankSnapshot| undefined>;Defined in: packages/sage/src/loyalty/index.ts:412
Derives and reads an optional Profile loyalty ATLAS bank.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
profile | Address |
factionId | number |
options? | ReadOptions |
Returns
Section titled “Returns”Promise<
| LoyaltyAtlasBankSnapshot
| undefined>
Example
Section titled “Example”declare const ctx: SageContext;declare const profile: Address;const bank = await maybeGetLoyaltyAtlasBank(ctx, profile, 3);