@medialane/sdk 0.48.0 → 0.49.0

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.cjs CHANGED
@@ -8658,9 +8658,7 @@ var MedialaneError = class extends Error {
8658
8658
 
8659
8659
  // src/utils/rpc.ts
8660
8660
  var PUBLIC_RPC_FALLBACKS = [
8661
- "https://rpc.starknet.lava.build",
8662
- "https://starknet-mainnet.public.blastapi.io/rpc/v0_7",
8663
- "https://free-rpc.nethermind.io/mainnet-juno/v0_7"
8661
+ "https://rpc.starknet.lava.build"
8664
8662
  ];
8665
8663
  var TRANSIENT_BODY_RE = /"code"\s*:\s*-32001|"code"\s*:\s*-32603|unable to complete|rate.?limit|too many|throttl|exceed.*quota|temporarily unavailable|service unavailable|overload|gateway.*time|upstream.*time|backend.*error/i;
8666
8664
  function isTransientRpcError(input) {
@@ -10136,6 +10134,35 @@ var ApiClient = class {
10136
10134
  );
10137
10135
  return res.data;
10138
10136
  }
10137
+ // ─── Rewards (v0.49.0) ─────────────────────────────────────────────────────
10138
+ // Scores are recomputed on a schedule by the backend (~15 min) — reads only.
10139
+ /** Score + level + progress + badges for one address (zeroed for unknown). */
10140
+ async getRewards(address) {
10141
+ const res = await this.get(`/v1/rewards/${this.addr(address)}`);
10142
+ return res.data;
10143
+ }
10144
+ /** Paginated XP leaderboard. */
10145
+ getRewardsLeaderboard(page = 1, limit = 50) {
10146
+ return this.get(`/v1/rewards?page=${page}&limit=${limit}`);
10147
+ }
10148
+ /** Point-event history for an address. */
10149
+ getRewardsEvents(address, page = 1, limit = 20) {
10150
+ return this.get(
10151
+ `/v1/rewards/${this.addr(address)}/events?page=${page}&limit=${limit}`
10152
+ );
10153
+ }
10154
+ /** Reward configuration: level ladder, enabled action XP values, badge catalog. */
10155
+ async getRewardsConfig() {
10156
+ const res = await this.get(`/v1/rewards/config`);
10157
+ return res.data;
10158
+ }
10159
+ /** Minimal level info for up to 50 addresses — one call per list page. */
10160
+ async getRewardsBatch(addresses) {
10161
+ if (addresses.length === 0) return [];
10162
+ const params = new URLSearchParams({ addresses: addresses.map((a) => this.addr(a)).join(",") });
10163
+ const res = await this.get(`/v1/rewards/batch?${params}`);
10164
+ return res.data;
10165
+ }
10139
10166
  };
10140
10167
  var PopService = class {
10141
10168
  constructor(config) {