loyalty
Interfaces
Section titled “Interfaces”LoyaltyAtlasBankSnapshot
Section titled “LoyaltyAtlasBankSnapshot”Defined in: packages/sage/src/loyalty/index.ts:98
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:103
readonly bump: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:100
Inherited from
Section titled “Inherited from”Omit.bumpclaimableAtlasRaw
Section titled “claimableAtlasRaw”readonly claimableAtlasRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:104
Inherited from
Section titled “Inherited from”Omit.claimableAtlasRawexpiresAtUnixSeconds
Section titled “expiresAtUnixSeconds”readonly expiresAtUnixSeconds: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:108
Inherited from
Section titled “Inherited from”Omit.expiresAtUnixSecondsfaction
Section titled “faction”readonly faction: EntityRef<"faction">;Defined in: packages/sage/src/loyalty/index.ts:107
factionId
Section titled “factionId”readonly factionId: number;Defined in: packages/sage/src/loyalty/index.ts:106
readonly game: EntityRef<"game">;Defined in: packages/sage/src/loyalty/index.ts:104
readonly kind: "loyaltyAtlasBank";Defined in: packages/sage/src/loyalty/index.ts:102
lastCreditedAtUnixSeconds
Section titled “lastCreditedAtUnixSeconds”readonly lastCreditedAtUnixSeconds: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:107
Inherited from
Section titled “Inherited from”Omit.lastCreditedAtUnixSecondslifetimeAtlasRaw
Section titled “lifetimeAtlasRaw”readonly lifetimeAtlasRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:106
Inherited from
Section titled “Inherited from”Omit.lifetimeAtlasRawlifetimeLpRaw
Section titled “lifetimeLpRaw”readonly lifetimeLpRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:105
Inherited from
Section titled “Inherited from”Omit.lifetimeLpRawprofile
Section titled “profile”readonly profile: EntityRef<"profile">;Defined in: packages/sage/src/loyalty/index.ts:105
version
Section titled “version”readonly version: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:99
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:108
Returns
Section titled “Returns”unknown
LoyaltyContributionSnapshot
Section titled “LoyaltyContributionSnapshot”Defined in: packages/sage/src/loyalty/index.ts:76
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:81
atlasEntitlementRaw
Section titled “atlasEntitlementRaw”readonly atlasEntitlementRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:94
Inherited from
Section titled “Inherited from”Omit.atlasEntitlementRawreadonly bump: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:87
Inherited from
Section titled “Inherited from”Omit.bumpreadonly epoch: EntityRef<"loyaltyEpoch">;Defined in: packages/sage/src/loyalty/index.ts:86
epochIndex
Section titled “epochIndex”readonly epochIndex: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:92
Inherited from
Section titled “Inherited from”Omit.epochIndexfaction
Section titled “faction”readonly faction: EntityRef<"faction">;Defined in: packages/sage/src/loyalty/index.ts:85
factionId
Section titled “factionId”readonly factionId: number;Defined in: packages/sage/src/loyalty/index.ts:84
readonly game: EntityRef<"game">;Defined in: packages/sage/src/loyalty/index.ts:82
readonly kind: "loyaltyContribution";Defined in: packages/sage/src/loyalty/index.ts:80
readonly lpRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:93
Inherited from
Section titled “Inherited from”Omit.lpRawprofile
Section titled “profile”readonly profile: EntityRef<"profile">;Defined in: packages/sage/src/loyalty/index.ts:83
settled
Section titled “settled”readonly settled: boolean;Defined in: packages/sage/src/internal/c4/loyalty.ts:88
Inherited from
Section titled “Inherited from”Omit.settledsettledAtUnixSeconds
Section titled “settledAtUnixSeconds”readonly settledAtUnixSeconds: bigint | undefined;Defined in: packages/sage/src/loyalty/index.ts:87
version
Section titled “version”readonly version: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:86
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:88
Returns
Section titled “Returns”unknown
LoyaltyEpochSnapshot
Section titled “LoyaltyEpochSnapshot”Defined in: packages/sage/src/loyalty/index.ts:56
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:61
readonly bump: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:69
Inherited from
Section titled “Inherited from”Omit.bumpconfigVersion
Section titled “configVersion”readonly configVersion: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:74
Inherited from
Section titled “Inherited from”Omit.configVersionendsAtUnixSeconds
Section titled “endsAtUnixSeconds”readonly endsAtUnixSeconds: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:77
Inherited from
Section titled “Inherited from”Omit.endsAtUnixSecondsepochIndex
Section titled “epochIndex”readonly epochIndex: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:75
Inherited from
Section titled “Inherited from”Omit.epochIndexfaction
Section titled “faction”readonly faction: EntityRef<"faction">;Defined in: packages/sage/src/loyalty/index.ts:64
factionId
Section titled “factionId”readonly factionId: number;Defined in: packages/sage/src/loyalty/index.ts:63
readonly game: EntityRef<"game">;Defined in: packages/sage/src/loyalty/index.ts:62
readonly kind: "loyaltyEpoch";Defined in: packages/sage/src/loyalty/index.ts:60
kingSystems
Section titled “kingSystems”readonly kingSystems: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:71
Inherited from
Section titled “Inherited from”Omit.kingSystemspoolAtlasRaw
Section titled “poolAtlasRaw”readonly poolAtlasRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:80
Inherited from
Section titled “Inherited from”Omit.poolAtlasRawrewardConfig
Section titled “rewardConfig”readonly rewardConfig: EntityRef<"atlasRewardConfig">;Defined in: packages/sage/src/loyalty/index.ts:65
settledAtlasRaw
Section titled “settledAtlasRaw”readonly settledAtlasRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:82
Inherited from
Section titled “Inherited from”Omit.settledAtlasRawsettlementDeadlineUnixSeconds
Section titled “settlementDeadlineUnixSeconds”readonly settlementDeadlineUnixSeconds: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:78
Inherited from
Section titled “Inherited from”Omit.settlementDeadlineUnixSecondsstartsAtUnixSeconds
Section titled “startsAtUnixSeconds”readonly startsAtUnixSeconds: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:76
Inherited from
Section titled “Inherited from”Omit.startsAtUnixSecondsstatus
Section titled “status”readonly status: LoyaltyEpochStatus;Defined in: packages/sage/src/internal/c4/loyalty.ts:70
Inherited from
Section titled “Inherited from”Omit.statustotalLpRaw
Section titled “totalLpRaw”readonly totalLpRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:79
Inherited from
Section titled “Inherited from”Omit.totalLpRawunsettledAtlasRaw
Section titled “unsettledAtlasRaw”readonly unsettledAtlasRaw: bigint;Defined in: packages/sage/src/internal/c4/loyalty.ts:81
Inherited from
Section titled “Inherited from”Omit.unsettledAtlasRawversion
Section titled “version”readonly version: number;Defined in: packages/sage/src/internal/c4/loyalty.ts:68
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:66
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:141
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:130
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:44
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:117
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:634
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:581
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:541
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:430
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:516
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:336
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:490
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:311
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:464
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:405
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);