@autogames/sdk 1.1.1 → 1.2.3

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/main.d.ts CHANGED
@@ -40,6 +40,7 @@ declare class AutoGamesSDKClass {
40
40
  private config;
41
41
  private initPromise;
42
42
  private unsubscribe;
43
+ private chatWidgetMounted;
43
44
  /**
44
45
  * Initialize the SDK with optional configuration
45
46
  * @param config - Optional SDK configuration. If privyAppId is not provided, uses bundled default.
@@ -103,6 +104,19 @@ declare class AutoGamesSDKClass {
103
104
  * Get current authentication state
104
105
  */
105
106
  getAuthState(): AuthState;
107
+ /**
108
+ * Mount the chat widget
109
+ * @param options - Optional widget configuration (position)
110
+ */
111
+ mountChatWidget(options?: ChatWidgetOptions): Promise<void>;
112
+ /**
113
+ * Unmount the chat widget
114
+ */
115
+ unmountChatWidget(): Promise<void>;
116
+ /**
117
+ * Check if chat widget is mounted
118
+ */
119
+ isChatWidgetMounted(): boolean;
106
120
  /**
107
121
  * Clean up subscriptions
108
122
  */
@@ -133,6 +147,50 @@ declare interface BaseEntity {
133
147
  UpdatedAt: string;
134
148
  }
135
149
 
150
+ /**
151
+ * Chat entry - can be a user message, game event, or token event
152
+ */
153
+ export declare type ChatEntry = BaseEntity & {
154
+ ChatID: number;
155
+ EntryType: 'user_message' | 'game_event' | 'token_event';
156
+ UserMessageID: number | null;
157
+ GameEventID: number | null;
158
+ TokenEventID: number | null;
159
+ UserMessage: UserMessage | null;
160
+ GameEvent: GameEvent | null;
161
+ TokenEvent: TokenEvent | null;
162
+ };
163
+
164
+ /**
165
+ * Options for mounting the chat widget
166
+ */
167
+ export declare type ChatWidgetOptions = {
168
+ /**
169
+ * Custom positioning options
170
+ */
171
+ position?: {
172
+ /**
173
+ * Horizontal side placement (defaults to 'right')
174
+ */
175
+ side?: 'left' | 'right';
176
+ /**
177
+ * Vertical alignment (defaults to 'bottom')
178
+ * - 'top': Widget at top corner
179
+ * - 'bottom': Widget at bottom corner
180
+ * - 'middle': Bubble at bottom corner, expanded widget centered vertically
181
+ */
182
+ vertical?: 'top' | 'bottom' | 'middle';
183
+ /**
184
+ * Horizontal offset in pixels (defaults to 20)
185
+ */
186
+ offsetX?: number;
187
+ /**
188
+ * Vertical offset in pixels (defaults to 20)
189
+ */
190
+ offsetY?: number;
191
+ };
192
+ };
193
+
136
194
  declare type CreatedToken = {
137
195
  token: Token;
138
196
  user_token: UserToken;
@@ -151,6 +209,19 @@ declare type Game = BaseEntity & {
151
209
  TokenLaunchMinStart: number;
152
210
  TokensPerLvl: number;
153
211
  URL: string;
212
+ ChatID: number;
213
+ };
214
+
215
+ /**
216
+ * Game event entity
217
+ */
218
+ export declare type GameEvent = BaseEntity & {
219
+ GameID: number;
220
+ Game: Game | null;
221
+ Title: string;
222
+ Description?: string;
223
+ ShortSummary?: string;
224
+ Meta?: Record<string, unknown>;
154
225
  };
155
226
 
156
227
  declare type GameMetrics = BaseEntity & {
@@ -246,6 +317,20 @@ declare type Token = BaseEntity & {
246
317
  WebsiteURL: string;
247
318
  };
248
319
 
320
+ /**
321
+ * Token event entity
322
+ */
323
+ export declare type TokenEvent = BaseEntity & {
324
+ TokenID: number;
325
+ Token: Token | null;
326
+ GameID: number;
327
+ Game: Game | null;
328
+ Title: string;
329
+ Description?: string;
330
+ ShortSummary?: string;
331
+ Meta?: Record<string, unknown>;
332
+ };
333
+
249
334
  declare type TokenMetrics = BaseEntity & {
250
335
  current_price: number;
251
336
  holders_count: number;
@@ -323,6 +408,16 @@ export declare type UserCreatedTokensResponse = {
323
408
  created_tokens: CreatedToken[];
324
409
  };
325
410
 
411
+ /**
412
+ * User message entity
413
+ */
414
+ export declare type UserMessage = BaseEntity & {
415
+ ChatID: number;
416
+ Content: string;
417
+ UserID: number;
418
+ User: AutoGamesSDKUser;
419
+ };
420
+
326
421
  declare type UserToken = BaseEntity & {
327
422
  Amount: number;
328
423
  LastUpdatedAt: string;
@@ -0,0 +1,121 @@
1
+ import { M as m, bV as y, bI as w, a5 as x, bX as p, cj as z, cg as M, d9 as k, ci as d, da as T, Z as E, db as N, a4 as P, dc as S, bx as B, dd as L, cc as $, de as A } from "./bridge-mount-CPNiESrc.js";
2
+ function H(s, e) {
3
+ if (s.length !== e.length)
4
+ throw new m({
5
+ expectedLength: s.length,
6
+ givenLength: e.length
7
+ });
8
+ const i = [];
9
+ for (let t = 0; t < s.length; t++) {
10
+ const g = s[t], o = e[t];
11
+ i.push(b(g, o));
12
+ }
13
+ return y(i);
14
+ }
15
+ function b(s, e, i = !1) {
16
+ if (s === "address") {
17
+ const n = e;
18
+ if (!w(n))
19
+ throw new x({ address: n });
20
+ return p(n.toLowerCase(), {
21
+ size: i ? 32 : null
22
+ });
23
+ }
24
+ if (s === "string")
25
+ return z(e);
26
+ if (s === "bytes")
27
+ return e;
28
+ if (s === "bool")
29
+ return p(M(e), { size: i ? 32 : 1 });
30
+ const t = s.match(k);
31
+ if (t) {
32
+ const [n, r, c = "256"] = t, a = Number.parseInt(c, 10) / 8;
33
+ return d(e, {
34
+ size: i ? 32 : a,
35
+ signed: r === "int"
36
+ });
37
+ }
38
+ const g = s.match(T);
39
+ if (g) {
40
+ const [n, r] = g;
41
+ if (Number.parseInt(r, 10) !== (e.length - 2) / 2)
42
+ throw new E({
43
+ expectedSize: Number.parseInt(r, 10),
44
+ givenSize: (e.length - 2) / 2
45
+ });
46
+ return p(e, { dir: "right", size: i ? 32 : null });
47
+ }
48
+ const o = s.match(N);
49
+ if (o && Array.isArray(e)) {
50
+ const [n, r] = o, c = [];
51
+ for (let a = 0; a < e.length; a++)
52
+ c.push(b(r, e[a], !0));
53
+ return c.length === 0 ? "0x" : y(c);
54
+ }
55
+ throw new P(s);
56
+ }
57
+ function I(s) {
58
+ const { source: e } = s, i = /* @__PURE__ */ new Map(), t = new S(8192), g = /* @__PURE__ */ new Map(), o = ({ address: n, chainId: r }) => `${n}.${r}`;
59
+ return {
60
+ async consume({ address: n, chainId: r, client: c }) {
61
+ const a = o({ address: n, chainId: r }), u = this.get({ address: n, chainId: r, client: c });
62
+ this.increment({ address: n, chainId: r });
63
+ const f = await u;
64
+ return await e.set({ address: n, chainId: r }, f), t.set(a, f), f;
65
+ },
66
+ async increment({ address: n, chainId: r }) {
67
+ const c = o({ address: n, chainId: r }), a = i.get(c) ?? 0;
68
+ i.set(c, a + 1);
69
+ },
70
+ async get({ address: n, chainId: r, client: c }) {
71
+ const a = o({ address: n, chainId: r });
72
+ let u = g.get(a);
73
+ return u || (u = (async () => {
74
+ try {
75
+ const l = await e.get({ address: n, chainId: r, client: c }), h = t.get(a) ?? 0;
76
+ return h > 0 && l <= h ? h + 1 : (t.delete(a), l);
77
+ } finally {
78
+ this.reset({ address: n, chainId: r });
79
+ }
80
+ })(), g.set(a, u)), (i.get(a) ?? 0) + await u;
81
+ },
82
+ reset({ address: n, chainId: r }) {
83
+ const c = o({ address: n, chainId: r });
84
+ i.delete(c), g.delete(c);
85
+ }
86
+ };
87
+ }
88
+ function R(s) {
89
+ const { address: e, data: i, signature: t, to: g = "hex" } = s, o = y([
90
+ B([{ type: "address" }, { type: "bytes" }, { type: "bytes" }], [e, i, t]),
91
+ L
92
+ ]);
93
+ return g === "hex" ? o : $(o);
94
+ }
95
+ function V(s) {
96
+ const { r: e, s: i } = A.Signature.fromCompact(s.slice(2, 130)), t = +`0x${s.slice(130)}`, [g, o] = (() => {
97
+ if (t === 0 || t === 1)
98
+ return [void 0, t];
99
+ if (t === 27)
100
+ return [BigInt(t), 0];
101
+ if (t === 28)
102
+ return [BigInt(t), 1];
103
+ throw new Error("Invalid yParityOrV value");
104
+ })();
105
+ return typeof g < "u" ? {
106
+ r: d(e, { size: 32 }),
107
+ s: d(i, { size: 32 }),
108
+ v: g,
109
+ yParity: o
110
+ } : {
111
+ r: d(e, { size: 32 }),
112
+ s: d(i, { size: 32 }),
113
+ yParity: o
114
+ };
115
+ }
116
+ export {
117
+ I as c,
118
+ H as e,
119
+ V as p,
120
+ R as s
121
+ };
@@ -1,4 +1,4 @@
1
- import { db as nt, dc as qt, dd as ht, de as ue, df as D, dg as ae, dh as le, di as Ct, dj as de, dk as he } from "./bridge-mount-Bhf05oeO.js";
1
+ import { df as nt, dg as qt, dh as ht, di as ue, dj as D, dk as ae, dl as le, dm as Ct, dn as de, dp as he } from "./bridge-mount-CPNiESrc.js";
2
2
  const Nt = /* @__PURE__ */ BigInt(0), xt = /* @__PURE__ */ BigInt(1);
3
3
  function wt(e, n = "") {
4
4
  if (typeof e != "boolean") {