@omen.foundation/game-sdk 1.0.14 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +74 -3
- package/dist/index.d.ts +74 -3
- package/dist/index.js +164 -389
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +164 -389
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -74,8 +74,9 @@ interface OmenXGameSDKConfig {
|
|
|
74
74
|
interface OAuthOptions {
|
|
75
75
|
/**
|
|
76
76
|
* Redirect URI (must be registered in developer portal)
|
|
77
|
+
* If not provided, defaults to `${window.location.origin}/auth/callback`
|
|
77
78
|
*/
|
|
78
|
-
redirectUri
|
|
79
|
+
redirectUri?: string;
|
|
79
80
|
/**
|
|
80
81
|
* State parameter for CSRF protection (auto-generated if not provided)
|
|
81
82
|
*/
|
|
@@ -106,6 +107,38 @@ interface ApiCallOptions {
|
|
|
106
107
|
*/
|
|
107
108
|
includeAuth?: boolean;
|
|
108
109
|
}
|
|
110
|
+
interface VipTierInfo {
|
|
111
|
+
tierIndex: number;
|
|
112
|
+
tierKey: string;
|
|
113
|
+
displayName: string;
|
|
114
|
+
allocationBoundary: number;
|
|
115
|
+
usdPrice?: number;
|
|
116
|
+
perksDescription?: string;
|
|
117
|
+
active?: boolean;
|
|
118
|
+
/** Structured perks from tiers JSON (e.g. GAME_BONUS_POINTS_LEVEL). */
|
|
119
|
+
perks?: Record<string, unknown>;
|
|
120
|
+
tierPerksShortDescription?: string;
|
|
121
|
+
/** Games read this (1–21) for Game Alpha Access (higher tiers), Game Beta Access (lower tiers), or in-game gifts. */
|
|
122
|
+
gameBonusPointsLevel?: number;
|
|
123
|
+
}
|
|
124
|
+
interface VipStatus {
|
|
125
|
+
walletAddress: string;
|
|
126
|
+
entitlement: number;
|
|
127
|
+
claimed: number;
|
|
128
|
+
claimable: number;
|
|
129
|
+
tier: VipTierInfo;
|
|
130
|
+
nextTier: VipTierInfo | null;
|
|
131
|
+
phaseIndex: number;
|
|
132
|
+
claimingAllowed: boolean;
|
|
133
|
+
phaseClaimingClosed?: boolean;
|
|
134
|
+
currentEpoch?: {
|
|
135
|
+
epochId: string;
|
|
136
|
+
startAt: string;
|
|
137
|
+
endAt: string;
|
|
138
|
+
epochPoolAmount: number;
|
|
139
|
+
estimatedShare?: number;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
109
142
|
|
|
110
143
|
/**
|
|
111
144
|
* OmenX Game SDK
|
|
@@ -153,6 +186,16 @@ declare class OmenXGameSDK {
|
|
|
153
186
|
* Handle auth data from iframe
|
|
154
187
|
*/
|
|
155
188
|
private handleAuthData;
|
|
189
|
+
/**
|
|
190
|
+
* Get current VIP status for the authenticated user (tier, allocation, claimable, perks).
|
|
191
|
+
* Games can read tier.gameBonusPointsLevel (1–21) for Alpha/Beta access or in-game gifts.
|
|
192
|
+
*/
|
|
193
|
+
getVipStatus(): Promise<VipStatus | null>;
|
|
194
|
+
/**
|
|
195
|
+
* Get the current user's game bonus points level (1–21) from their VIP tier.
|
|
196
|
+
* Use for Game Alpha Access (e.g. level >= 6), Game Beta Access (e.g. level >= 1), or in-game gifts.
|
|
197
|
+
*/
|
|
198
|
+
getGameBonusPointsLevel(): Promise<number | null>;
|
|
156
199
|
/**
|
|
157
200
|
* Refresh access token using refresh token
|
|
158
201
|
*/
|
|
@@ -194,12 +237,19 @@ declare class OmenXServerSDK {
|
|
|
194
237
|
/**
|
|
195
238
|
* Player Operations
|
|
196
239
|
*/
|
|
240
|
+
/**
|
|
241
|
+
* Get full player data: NFTs (system + game) and balances for a wallet.
|
|
242
|
+
* Requires both nfts:read and balances:read scopes.
|
|
243
|
+
*/
|
|
244
|
+
getPlayer(wallet: string, chainId: string): Promise<any>;
|
|
197
245
|
/**
|
|
198
246
|
* Get native and ERC20 token balances for a wallet
|
|
199
247
|
*/
|
|
200
248
|
getPlayerBalances(wallet: string, chainId: string): Promise<any>;
|
|
201
249
|
/**
|
|
202
|
-
* Get paginated NFTs for a wallet
|
|
250
|
+
* Get paginated NFTs for a wallet.
|
|
251
|
+
* With no contract: returns OmenX system NFTs (Asset Manager, Faucet, Early Adopter) + game NFTs.
|
|
252
|
+
* With contract: returns only NFTs for that contract.
|
|
203
253
|
*/
|
|
204
254
|
getPlayerNfts(wallet: string, chainId: string, options?: {
|
|
205
255
|
contract?: string;
|
|
@@ -273,6 +323,27 @@ declare class OmenXServerSDK {
|
|
|
273
323
|
dropTableId: string;
|
|
274
324
|
recipientAddress: string;
|
|
275
325
|
}): Promise<any>;
|
|
326
|
+
/**
|
|
327
|
+
* VIP Points (Developer pool)
|
|
328
|
+
* Requires scope: vip_points:write.
|
|
329
|
+
* Grants VIP points to a player from this game's allocated pool. Enforces total allocation and max per quest.
|
|
330
|
+
* Call from your game backend only (API key auth); not for client-side use.
|
|
331
|
+
*/
|
|
332
|
+
grantVipPoints(params: {
|
|
333
|
+
/** Player wallet address (0x-prefixed, 40 hex chars). */
|
|
334
|
+
wallet: string;
|
|
335
|
+
/** Points to grant (positive integer). Capped by pool remaining and max per quest. */
|
|
336
|
+
amount: number;
|
|
337
|
+
/** Optional quest/activity id for idempotency or auditing. */
|
|
338
|
+
questId?: string;
|
|
339
|
+
}): Promise<{
|
|
340
|
+
success: boolean;
|
|
341
|
+
data?: {
|
|
342
|
+
wallet: string;
|
|
343
|
+
amount: number;
|
|
344
|
+
phaseIndex?: number;
|
|
345
|
+
};
|
|
346
|
+
}>;
|
|
276
347
|
}
|
|
277
348
|
|
|
278
|
-
export { type ApiCallOptions, type AuthData, type OAuthOptions, OmenXGameSDK, type OmenXGameSDKConfig, OmenXServerSDK, type UserInfo };
|
|
349
|
+
export { type ApiCallOptions, type AuthData, type OAuthOptions, OmenXGameSDK, type OmenXGameSDKConfig, OmenXServerSDK, type UserInfo, type VipStatus, type VipTierInfo };
|
package/dist/index.d.ts
CHANGED
|
@@ -74,8 +74,9 @@ interface OmenXGameSDKConfig {
|
|
|
74
74
|
interface OAuthOptions {
|
|
75
75
|
/**
|
|
76
76
|
* Redirect URI (must be registered in developer portal)
|
|
77
|
+
* If not provided, defaults to `${window.location.origin}/auth/callback`
|
|
77
78
|
*/
|
|
78
|
-
redirectUri
|
|
79
|
+
redirectUri?: string;
|
|
79
80
|
/**
|
|
80
81
|
* State parameter for CSRF protection (auto-generated if not provided)
|
|
81
82
|
*/
|
|
@@ -106,6 +107,38 @@ interface ApiCallOptions {
|
|
|
106
107
|
*/
|
|
107
108
|
includeAuth?: boolean;
|
|
108
109
|
}
|
|
110
|
+
interface VipTierInfo {
|
|
111
|
+
tierIndex: number;
|
|
112
|
+
tierKey: string;
|
|
113
|
+
displayName: string;
|
|
114
|
+
allocationBoundary: number;
|
|
115
|
+
usdPrice?: number;
|
|
116
|
+
perksDescription?: string;
|
|
117
|
+
active?: boolean;
|
|
118
|
+
/** Structured perks from tiers JSON (e.g. GAME_BONUS_POINTS_LEVEL). */
|
|
119
|
+
perks?: Record<string, unknown>;
|
|
120
|
+
tierPerksShortDescription?: string;
|
|
121
|
+
/** Games read this (1–21) for Game Alpha Access (higher tiers), Game Beta Access (lower tiers), or in-game gifts. */
|
|
122
|
+
gameBonusPointsLevel?: number;
|
|
123
|
+
}
|
|
124
|
+
interface VipStatus {
|
|
125
|
+
walletAddress: string;
|
|
126
|
+
entitlement: number;
|
|
127
|
+
claimed: number;
|
|
128
|
+
claimable: number;
|
|
129
|
+
tier: VipTierInfo;
|
|
130
|
+
nextTier: VipTierInfo | null;
|
|
131
|
+
phaseIndex: number;
|
|
132
|
+
claimingAllowed: boolean;
|
|
133
|
+
phaseClaimingClosed?: boolean;
|
|
134
|
+
currentEpoch?: {
|
|
135
|
+
epochId: string;
|
|
136
|
+
startAt: string;
|
|
137
|
+
endAt: string;
|
|
138
|
+
epochPoolAmount: number;
|
|
139
|
+
estimatedShare?: number;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
109
142
|
|
|
110
143
|
/**
|
|
111
144
|
* OmenX Game SDK
|
|
@@ -153,6 +186,16 @@ declare class OmenXGameSDK {
|
|
|
153
186
|
* Handle auth data from iframe
|
|
154
187
|
*/
|
|
155
188
|
private handleAuthData;
|
|
189
|
+
/**
|
|
190
|
+
* Get current VIP status for the authenticated user (tier, allocation, claimable, perks).
|
|
191
|
+
* Games can read tier.gameBonusPointsLevel (1–21) for Alpha/Beta access or in-game gifts.
|
|
192
|
+
*/
|
|
193
|
+
getVipStatus(): Promise<VipStatus | null>;
|
|
194
|
+
/**
|
|
195
|
+
* Get the current user's game bonus points level (1–21) from their VIP tier.
|
|
196
|
+
* Use for Game Alpha Access (e.g. level >= 6), Game Beta Access (e.g. level >= 1), or in-game gifts.
|
|
197
|
+
*/
|
|
198
|
+
getGameBonusPointsLevel(): Promise<number | null>;
|
|
156
199
|
/**
|
|
157
200
|
* Refresh access token using refresh token
|
|
158
201
|
*/
|
|
@@ -194,12 +237,19 @@ declare class OmenXServerSDK {
|
|
|
194
237
|
/**
|
|
195
238
|
* Player Operations
|
|
196
239
|
*/
|
|
240
|
+
/**
|
|
241
|
+
* Get full player data: NFTs (system + game) and balances for a wallet.
|
|
242
|
+
* Requires both nfts:read and balances:read scopes.
|
|
243
|
+
*/
|
|
244
|
+
getPlayer(wallet: string, chainId: string): Promise<any>;
|
|
197
245
|
/**
|
|
198
246
|
* Get native and ERC20 token balances for a wallet
|
|
199
247
|
*/
|
|
200
248
|
getPlayerBalances(wallet: string, chainId: string): Promise<any>;
|
|
201
249
|
/**
|
|
202
|
-
* Get paginated NFTs for a wallet
|
|
250
|
+
* Get paginated NFTs for a wallet.
|
|
251
|
+
* With no contract: returns OmenX system NFTs (Asset Manager, Faucet, Early Adopter) + game NFTs.
|
|
252
|
+
* With contract: returns only NFTs for that contract.
|
|
203
253
|
*/
|
|
204
254
|
getPlayerNfts(wallet: string, chainId: string, options?: {
|
|
205
255
|
contract?: string;
|
|
@@ -273,6 +323,27 @@ declare class OmenXServerSDK {
|
|
|
273
323
|
dropTableId: string;
|
|
274
324
|
recipientAddress: string;
|
|
275
325
|
}): Promise<any>;
|
|
326
|
+
/**
|
|
327
|
+
* VIP Points (Developer pool)
|
|
328
|
+
* Requires scope: vip_points:write.
|
|
329
|
+
* Grants VIP points to a player from this game's allocated pool. Enforces total allocation and max per quest.
|
|
330
|
+
* Call from your game backend only (API key auth); not for client-side use.
|
|
331
|
+
*/
|
|
332
|
+
grantVipPoints(params: {
|
|
333
|
+
/** Player wallet address (0x-prefixed, 40 hex chars). */
|
|
334
|
+
wallet: string;
|
|
335
|
+
/** Points to grant (positive integer). Capped by pool remaining and max per quest. */
|
|
336
|
+
amount: number;
|
|
337
|
+
/** Optional quest/activity id for idempotency or auditing. */
|
|
338
|
+
questId?: string;
|
|
339
|
+
}): Promise<{
|
|
340
|
+
success: boolean;
|
|
341
|
+
data?: {
|
|
342
|
+
wallet: string;
|
|
343
|
+
amount: number;
|
|
344
|
+
phaseIndex?: number;
|
|
345
|
+
};
|
|
346
|
+
}>;
|
|
276
347
|
}
|
|
277
348
|
|
|
278
|
-
export { type ApiCallOptions, type AuthData, type OAuthOptions, OmenXGameSDK, type OmenXGameSDKConfig, OmenXServerSDK, type UserInfo };
|
|
349
|
+
export { type ApiCallOptions, type AuthData, type OAuthOptions, OmenXGameSDK, type OmenXGameSDKConfig, OmenXServerSDK, type UserInfo, type VipStatus, type VipTierInfo };
|