@cartridge/controller 0.5.0-alpha.4 → 0.5.0-alpha.6

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.
Files changed (71) hide show
  1. package/.turbo/turbo-build$colon$deps.log +116 -4
  2. package/dist/account.d.ts +9 -6
  3. package/dist/account.js +84 -74
  4. package/dist/account.js.map +1 -1
  5. package/dist/constants.d.ts +4 -2
  6. package/dist/constants.js +7 -2
  7. package/dist/constants.js.map +1 -1
  8. package/dist/controller.d.ts +12 -5
  9. package/dist/controller.js +739 -182
  10. package/dist/controller.js.map +1 -1
  11. package/dist/errors.d.ts +3 -1
  12. package/dist/errors.js +10 -6
  13. package/dist/errors.js.map +1 -1
  14. package/dist/icon.d.ts +3 -1
  15. package/dist/icon.js +5 -1
  16. package/dist/icon.js.map +1 -1
  17. package/dist/iframe/base.d.ts +5 -23
  18. package/dist/iframe/base.js +272 -98
  19. package/dist/iframe/base.js.map +1 -1
  20. package/dist/iframe/index.d.ts +5 -3
  21. package/dist/iframe/index.js +331 -3
  22. package/dist/iframe/index.js.map +1 -1
  23. package/dist/iframe/keychain.d.ts +5 -7
  24. package/dist/iframe/keychain.js +294 -13
  25. package/dist/iframe/keychain.js.map +1 -1
  26. package/dist/iframe/profile.d.ts +5 -11
  27. package/dist/iframe/profile.js +308 -16
  28. package/dist/iframe/profile.js.map +1 -1
  29. package/dist/index.d.ts +9 -4
  30. package/dist/index.js +767 -4
  31. package/dist/index.js.map +1 -1
  32. package/dist/presets.d.ts +9 -2
  33. package/dist/presets.js +159 -146
  34. package/dist/presets.js.map +1 -1
  35. package/dist/provider.d.ts +9 -4
  36. package/dist/provider.js +138 -124
  37. package/dist/provider.js.map +1 -1
  38. package/dist/session/account.d.ts +14 -8
  39. package/dist/session/account.js +235 -27
  40. package/dist/session/account.js.map +1 -1
  41. package/dist/session/backend.d.ts +4 -2
  42. package/dist/session/backend.js +38 -37
  43. package/dist/session/backend.js.map +1 -1
  44. package/dist/session/index.d.ts +9 -5
  45. package/dist/session/index.js +467 -5
  46. package/dist/session/index.js.map +1 -1
  47. package/dist/session/provider.d.ts +12 -8
  48. package/dist/session/provider.js +281 -81
  49. package/dist/session/provider.js.map +1 -1
  50. package/dist/telegram/backend.d.ts +5 -2
  51. package/dist/telegram/backend.js +38 -37
  52. package/dist/telegram/backend.js.map +1 -1
  53. package/dist/telegram/provider.d.ts +7 -4
  54. package/dist/telegram/provider.js +283 -70
  55. package/dist/telegram/provider.js.map +1 -1
  56. package/dist/types-DIeWpu0p.d.ts +196 -0
  57. package/dist/types.d.ts +5 -159
  58. package/dist/types.js +12 -8
  59. package/dist/types.js.map +1 -1
  60. package/dist/utils.d.ts +7 -3
  61. package/dist/utils.js +12 -8
  62. package/dist/utils.js.map +1 -1
  63. package/package.json +17 -14
  64. package/src/controller.ts +13 -25
  65. package/src/iframe/base.ts +3 -0
  66. package/src/iframe/profile.ts +17 -9
  67. package/src/presets.ts +10 -1
  68. package/src/session/provider.ts +1 -2
  69. package/src/types.ts +3 -7
  70. package/tsconfig.json +4 -1
  71. package/tsconfig.tsbuildinfo +0 -1
@@ -1,4 +1,332 @@
1
- export * from "./base";
2
- export * from "./keychain";
3
- export * from "./profile";
1
+ // src/iframe/base.ts
2
+ import { connectToChild } from "@cartridge/penpal";
3
+
4
+ // src/presets.ts
5
+ var defaultPresets = {
6
+ cartridge: {
7
+ id: "cartridge",
8
+ name: "Cartridge",
9
+ icon: "/whitelabel/cartridge/icon.svg",
10
+ cover: {
11
+ light: "/whitelabel/cartridge/cover-light.png",
12
+ dark: "/whitelabel/cartridge/cover-dark.png"
13
+ }
14
+ },
15
+ "force-prime": {
16
+ id: "force-prime",
17
+ name: "Force Prime",
18
+ icon: "/whitelabel/force-prime/icon.png",
19
+ cover: "/whitelabel/force-prime/cover.png",
20
+ colors: {
21
+ primary: "#E1CC89"
22
+ }
23
+ },
24
+ paved: {
25
+ id: "paved",
26
+ name: "Paved",
27
+ icon: "/whitelabel/paved/icon.svg",
28
+ cover: "/whitelabel/paved/cover.png",
29
+ colors: {
30
+ primary: "#B0CAF8"
31
+ }
32
+ },
33
+ eternum: {
34
+ id: "eternum",
35
+ name: "Eternum",
36
+ icon: "/whitelabel/eternum/icon.gif",
37
+ cover: "/whitelabel/eternum/cover.png",
38
+ colors: {
39
+ primary: "#CE9822"
40
+ }
41
+ },
42
+ pistols: {
43
+ id: "pistols",
44
+ name: "Pistols at Ten Blocks",
45
+ icon: "/whitelabel/pistols/icon.png",
46
+ cover: "/whitelabel/pistols/cover.png",
47
+ colors: {
48
+ primary: "#EF9758"
49
+ }
50
+ },
51
+ pixelaw: {
52
+ id: "pixelaw",
53
+ name: "Pixelaw",
54
+ icon: "/whitelabel/pixelaw/icon.svg",
55
+ cover: "/whitelabel/pixelaw/cover.png",
56
+ colors: {
57
+ primary: "#7C00B1",
58
+ primaryForeground: "white"
59
+ }
60
+ },
61
+ "dope-wars": {
62
+ id: "dope-wars",
63
+ name: "Dope Wars",
64
+ icon: "/whitelabel/dope-wars/icon.png",
65
+ cover: "/whitelabel/dope-wars/cover.png",
66
+ colors: {
67
+ primary: "#11ED83"
68
+ }
69
+ },
70
+ zkastle: {
71
+ id: "zkastle",
72
+ name: "zKastle",
73
+ icon: "/whitelabel/zkastle/icon.svg",
74
+ cover: "/whitelabel/zkastle/cover.png",
75
+ colors: {
76
+ primary: "#E50D2C"
77
+ }
78
+ },
79
+ "loot-survivor": {
80
+ id: "loot-survivor",
81
+ name: "Loot Survivor",
82
+ icon: "/whitelabel/loot-survivor/icon.png",
83
+ cover: "/whitelabel/loot-survivor/cover.png",
84
+ colors: {
85
+ primary: "#33FF33"
86
+ }
87
+ },
88
+ "tale-weaver": {
89
+ id: "tale-weaver",
90
+ name: "Tale Weaver",
91
+ icon: "/whitelabel/tale-weaver/icon.png",
92
+ cover: "/whitelabel/tale-weaver/cover.png",
93
+ colors: {
94
+ primary: "#fce377"
95
+ }
96
+ },
97
+ "realm-of-ra": {
98
+ id: "realm-of-ra",
99
+ name: "Realm of Ra",
100
+ icon: "/whitelabel/realm-of-ra/icon.png",
101
+ cover: "/whitelabel/realm-of-ra/cover.png",
102
+ colors: {
103
+ primary: "#de9534"
104
+ }
105
+ },
106
+ "jokers-of-neon": {
107
+ id: "jokers-of-neon",
108
+ name: "Jokers of Neon",
109
+ icon: "/whitelabel/jokers-of-neon/icon.png",
110
+ cover: "/whitelabel/jokers-of-neon/cover.png",
111
+ colors: {
112
+ primary: "#A144B2"
113
+ }
114
+ },
115
+ flippyflop: {
116
+ id: "flippyflop",
117
+ name: "FlippyFlop",
118
+ icon: "/whitelabel/flippyflop/icon.png",
119
+ cover: "/whitelabel/flippyflop/cover.png",
120
+ colors: {
121
+ primary: "#F38332"
122
+ }
123
+ },
124
+ "savage-summit": {
125
+ id: "savage-summit",
126
+ name: "Savage Summit",
127
+ icon: "/whitelabel/savage-summit/icon.png",
128
+ cover: "/whitelabel/savage-summit/cover.png",
129
+ colors: {
130
+ primary: "#fbf7da"
131
+ }
132
+ },
133
+ "dark-shuffle": {
134
+ id: "dark-shuffle",
135
+ name: "Dark Shuffle",
136
+ icon: "/whitelabel/dark-shuffle/icon.svg",
137
+ cover: "/whitelabel/dark-shuffle/cover.png",
138
+ colors: {
139
+ primary: "#F59100"
140
+ }
141
+ },
142
+ "blob-arena": {
143
+ id: "blob-arena",
144
+ name: "Blob Arena",
145
+ icon: "/whitelabel/blob-arena/icon.png",
146
+ cover: "/whitelabel/blob-arena/cover.png",
147
+ colors: {
148
+ primary: "#980f06"
149
+ }
150
+ },
151
+ zkube: {
152
+ id: "zkube",
153
+ name: "zKube",
154
+ icon: "/whitelabel/zkube/icon.png",
155
+ cover: "/whitelabel/zkube/cover.png",
156
+ colors: {
157
+ primary: "#5bc3e6"
158
+ }
159
+ }
160
+ };
161
+
162
+ // src/iframe/base.ts
163
+ var IFrame = class {
164
+ constructor({
165
+ id,
166
+ url,
167
+ theme,
168
+ config,
169
+ colorMode,
170
+ onClose,
171
+ onConnect,
172
+ methods = {}
173
+ }) {
174
+ if (typeof document === "undefined") {
175
+ return;
176
+ }
177
+ url.searchParams.set(
178
+ "theme",
179
+ encodeURIComponent(
180
+ JSON.stringify(
181
+ config?.presets?.[theme ?? "cartridge"] ?? defaultPresets.cartridge
182
+ )
183
+ )
184
+ );
185
+ if (colorMode) {
186
+ url.searchParams.set("colorMode", colorMode);
187
+ }
188
+ this.url = url;
189
+ const iframe = document.createElement("iframe");
190
+ iframe.src = url.toString();
191
+ iframe.id = id;
192
+ iframe.style.border = "none";
193
+ iframe.sandbox.add("allow-forms");
194
+ iframe.sandbox.add("allow-popups");
195
+ iframe.sandbox.add("allow-scripts");
196
+ iframe.sandbox.add("allow-same-origin");
197
+ iframe.allow = "publickey-credentials-create *; publickey-credentials-get *; clipboard-write";
198
+ if (!!document.hasStorageAccess) {
199
+ iframe.sandbox.add("allow-storage-access-by-user-activation");
200
+ }
201
+ const container = document.createElement("div");
202
+ container.id = "controller";
203
+ container.style.position = "fixed";
204
+ container.style.height = "100%";
205
+ container.style.width = "100%";
206
+ container.style.top = "0";
207
+ container.style.left = "0";
208
+ container.style.zIndex = "10000";
209
+ container.style.backgroundColor = "rgba(0,0,0,0.6)";
210
+ container.style.display = "flex";
211
+ container.style.alignItems = "center";
212
+ container.style.justifyContent = "center";
213
+ container.style.visibility = "hidden";
214
+ container.style.opacity = "0";
215
+ container.style.transition = "opacity 0.2s ease";
216
+ container.appendChild(iframe);
217
+ this.iframe = iframe;
218
+ this.container = container;
219
+ connectToChild({
220
+ iframe: this.iframe,
221
+ methods: { close: () => this.close(), ...methods }
222
+ }).promise.then(onConnect);
223
+ this.resize();
224
+ window.addEventListener("resize", () => this.resize());
225
+ const observer = new MutationObserver(() => {
226
+ const existingController2 = document.getElementById("controller");
227
+ if (document.body) {
228
+ if (id === "controller-keychain" && !existingController2 || id === "controller-profile") {
229
+ document.body.appendChild(container);
230
+ observer.disconnect();
231
+ }
232
+ }
233
+ });
234
+ observer.observe(document.documentElement, {
235
+ childList: true,
236
+ subtree: true
237
+ });
238
+ const existingController = document.getElementById("controller");
239
+ if (document.body) {
240
+ if (id === "controller-keychain" && !existingController || id === "controller-profile") {
241
+ document.body.appendChild(container);
242
+ }
243
+ }
244
+ this.onClose = onClose;
245
+ }
246
+ open() {
247
+ if (!this.container) return;
248
+ document.body.style.overflow = "hidden";
249
+ this.container.style.visibility = "visible";
250
+ this.container.style.opacity = "1";
251
+ }
252
+ close() {
253
+ if (!this.container) return;
254
+ this.onClose?.();
255
+ document.body.style.overflow = "auto";
256
+ this.container.style.visibility = "hidden";
257
+ this.container.style.opacity = "0";
258
+ }
259
+ resize() {
260
+ if (!this.iframe) return;
261
+ this.iframe.style.userSelect = "none";
262
+ if (window.innerWidth < 768) {
263
+ this.iframe.style.height = "100%";
264
+ this.iframe.style.width = "100%";
265
+ this.iframe.style.borderRadius = "0";
266
+ return;
267
+ }
268
+ this.iframe.style.height = "600px";
269
+ this.iframe.style.width = "432px";
270
+ this.iframe.style.borderRadius = "8px";
271
+ }
272
+ };
273
+
274
+ // src/constants.ts
275
+ var KEYCHAIN_URL = "https://x.cartridge.gg";
276
+ var PROFILE_URL = "https://profile.cartridge.gg";
277
+
278
+ // src/iframe/keychain.ts
279
+ var KeychainIFrame = class extends IFrame {
280
+ constructor({ url, policies, ...iframeOptions }) {
281
+ const _url = new URL(url ?? KEYCHAIN_URL);
282
+ if (policies) {
283
+ _url.searchParams.set(
284
+ "policies",
285
+ encodeURIComponent(JSON.stringify(policies))
286
+ );
287
+ }
288
+ super({
289
+ ...iframeOptions,
290
+ id: "controller-keychain",
291
+ url: _url
292
+ });
293
+ }
294
+ };
295
+
296
+ // src/iframe/profile.ts
297
+ var ProfileIFrame = class extends IFrame {
298
+ constructor({
299
+ profileUrl,
300
+ rpcUrl,
301
+ namespace,
302
+ slot,
303
+ username,
304
+ tokens,
305
+ ...iframeOptions
306
+ }) {
307
+ const _profileUrl = profileUrl || PROFILE_URL;
308
+ const _url = new URL(
309
+ slot ? namespace ? `${_profileUrl}/account/${username}/slot/${slot}?ns=${encodeURIComponent(
310
+ namespace
311
+ )}` : `${_profileUrl}/account/${username}/slot/${slot}` : `${_profileUrl}/account/${username}`
312
+ );
313
+ _url.searchParams.set("rpcUrl", encodeURIComponent(rpcUrl));
314
+ if (tokens?.erc20) {
315
+ _url.searchParams.set(
316
+ "erc20",
317
+ encodeURIComponent(tokens.erc20.toString())
318
+ );
319
+ }
320
+ super({
321
+ ...iframeOptions,
322
+ id: "controller-profile",
323
+ url: _url
324
+ });
325
+ }
326
+ };
327
+ export {
328
+ IFrame,
329
+ KeychainIFrame,
330
+ ProfileIFrame
331
+ };
4
332
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/iframe/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"sources":["../../src/iframe/base.ts","../../src/presets.ts","../../src/constants.ts","../../src/iframe/keychain.ts","../../src/iframe/profile.ts"],"sourcesContent":["import { AsyncMethodReturns, connectToChild } from \"@cartridge/penpal\";\nimport { defaultPresets } from \"../presets\";\nimport { ControllerOptions, Modal } from \"../types\";\n\nexport type IFrameOptions<CallSender> = Omit<\n ConstructorParameters<typeof IFrame>[0],\n \"id\" | \"url\" | \"onConnect\"\n> & {\n url?: string;\n onConnect: (child: AsyncMethodReturns<CallSender>) => void;\n};\n\nexport class IFrame<CallSender extends {}> implements Modal {\n url?: URL;\n private iframe?: HTMLIFrameElement;\n private container?: HTMLDivElement;\n private onClose?: () => void;\n\n constructor({\n id,\n url,\n theme,\n config,\n colorMode,\n onClose,\n onConnect,\n methods = {},\n }: Pick<ControllerOptions, \"theme\" | \"config\" | \"colorMode\"> & {\n id: string;\n url: URL;\n onClose?: () => void;\n onConnect: (child: AsyncMethodReturns<CallSender>) => void;\n methods?: { [key: string]: (...args: any[]) => void };\n }) {\n if (typeof document === \"undefined\") {\n return;\n }\n\n url.searchParams.set(\n \"theme\",\n encodeURIComponent(\n JSON.stringify(\n config?.presets?.[theme ?? \"cartridge\"] ?? defaultPresets.cartridge,\n ),\n ),\n );\n\n if (colorMode) {\n url.searchParams.set(\"colorMode\", colorMode);\n }\n\n this.url = url;\n\n const iframe = document.createElement(\"iframe\");\n iframe.src = url.toString();\n iframe.id = id;\n iframe.style.border = \"none\";\n iframe.sandbox.add(\"allow-forms\");\n iframe.sandbox.add(\"allow-popups\");\n iframe.sandbox.add(\"allow-scripts\");\n iframe.sandbox.add(\"allow-same-origin\");\n iframe.allow =\n \"publickey-credentials-create *; publickey-credentials-get *; clipboard-write\";\n if (!!document.hasStorageAccess) {\n iframe.sandbox.add(\"allow-storage-access-by-user-activation\");\n }\n\n const container = document.createElement(\"div\");\n container.id = \"controller\";\n container.style.position = \"fixed\";\n container.style.height = \"100%\";\n container.style.width = \"100%\";\n container.style.top = \"0\";\n container.style.left = \"0\";\n container.style.zIndex = \"10000\";\n container.style.backgroundColor = \"rgba(0,0,0,0.6)\";\n container.style.display = \"flex\";\n container.style.alignItems = \"center\";\n container.style.justifyContent = \"center\";\n container.style.visibility = \"hidden\";\n container.style.opacity = \"0\";\n container.style.transition = \"opacity 0.2s ease\";\n container.appendChild(iframe);\n\n this.iframe = iframe;\n this.container = container;\n\n connectToChild<CallSender>({\n iframe: this.iframe,\n methods: { close: () => this.close(), ...methods },\n }).promise.then(onConnect);\n\n this.resize();\n window.addEventListener(\"resize\", () => this.resize());\n\n const observer = new MutationObserver(() => {\n const existingController = document.getElementById(\"controller\");\n if (document.body) {\n if (\n (id === \"controller-keychain\" && !existingController) ||\n id === \"controller-profile\"\n ) {\n document.body.appendChild(container);\n observer.disconnect();\n }\n }\n });\n\n observer.observe(document.documentElement, {\n childList: true,\n subtree: true,\n });\n\n const existingController = document.getElementById(\"controller\");\n if (document.body) {\n if (\n (id === \"controller-keychain\" && !existingController) ||\n id === \"controller-profile\"\n ) {\n document.body.appendChild(container);\n }\n }\n\n this.onClose = onClose;\n }\n\n open() {\n if (!this.container) return;\n document.body.style.overflow = \"hidden\";\n\n this.container.style.visibility = \"visible\";\n this.container.style.opacity = \"1\";\n }\n\n close() {\n if (!this.container) return;\n this.onClose?.();\n\n document.body.style.overflow = \"auto\";\n\n this.container.style.visibility = \"hidden\";\n this.container.style.opacity = \"0\";\n }\n\n private resize() {\n if (!this.iframe) return;\n\n this.iframe.style.userSelect = \"none\";\n\n if (window.innerWidth < 768) {\n this.iframe.style.height = \"100%\";\n this.iframe.style.width = \"100%\";\n this.iframe.style.borderRadius = \"0\";\n return;\n }\n\n this.iframe.style.height = \"600px\";\n this.iframe.style.width = \"432px\";\n this.iframe.style.borderRadius = \"8px\";\n }\n}\n","import { ControllerThemePresets } from \"./types\";\n\nexport const defaultPresets: ControllerThemePresets = {\n cartridge: {\n id: \"cartridge\",\n name: \"Cartridge\",\n icon: \"/whitelabel/cartridge/icon.svg\",\n cover: {\n light: \"/whitelabel/cartridge/cover-light.png\",\n dark: \"/whitelabel/cartridge/cover-dark.png\",\n },\n },\n \"force-prime\": {\n id: \"force-prime\",\n name: \"Force Prime\",\n icon: \"/whitelabel/force-prime/icon.png\",\n cover: \"/whitelabel/force-prime/cover.png\",\n colors: {\n primary: \"#E1CC89\",\n },\n },\n paved: {\n id: \"paved\",\n name: \"Paved\",\n icon: \"/whitelabel/paved/icon.svg\",\n cover: \"/whitelabel/paved/cover.png\",\n colors: {\n primary: \"#B0CAF8\",\n },\n },\n eternum: {\n id: \"eternum\",\n name: \"Eternum\",\n icon: \"/whitelabel/eternum/icon.gif\",\n cover: \"/whitelabel/eternum/cover.png\",\n colors: {\n primary: \"#CE9822\",\n },\n },\n pistols: {\n id: \"pistols\",\n name: \"Pistols at Ten Blocks\",\n icon: \"/whitelabel/pistols/icon.png\",\n cover: \"/whitelabel/pistols/cover.png\",\n colors: {\n primary: \"#EF9758\",\n },\n },\n pixelaw: {\n id: \"pixelaw\",\n name: \"Pixelaw\",\n icon: \"/whitelabel/pixelaw/icon.svg\",\n cover: \"/whitelabel/pixelaw/cover.png\",\n colors: {\n primary: \"#7C00B1\",\n primaryForeground: \"white\",\n },\n },\n \"dope-wars\": {\n id: \"dope-wars\",\n name: \"Dope Wars\",\n icon: \"/whitelabel/dope-wars/icon.png\",\n cover: \"/whitelabel/dope-wars/cover.png\",\n colors: {\n primary: \"#11ED83\",\n },\n },\n zkastle: {\n id: \"zkastle\",\n name: \"zKastle\",\n icon: \"/whitelabel/zkastle/icon.svg\",\n cover: \"/whitelabel/zkastle/cover.png\",\n colors: {\n primary: \"#E50D2C\",\n },\n },\n \"loot-survivor\": {\n id: \"loot-survivor\",\n name: \"Loot Survivor\",\n icon: \"/whitelabel/loot-survivor/icon.png\",\n cover: \"/whitelabel/loot-survivor/cover.png\",\n colors: {\n primary: \"#33FF33\",\n },\n },\n \"tale-weaver\": {\n id: \"tale-weaver\",\n name: \"Tale Weaver\",\n icon: \"/whitelabel/tale-weaver/icon.png\",\n cover: \"/whitelabel/tale-weaver/cover.png\",\n colors: {\n primary: \"#fce377\",\n },\n },\n \"realm-of-ra\": {\n id: \"realm-of-ra\",\n name: \"Realm of Ra\",\n icon: \"/whitelabel/realm-of-ra/icon.png\",\n cover: \"/whitelabel/realm-of-ra/cover.png\",\n colors: {\n primary: \"#de9534\",\n },\n },\n \"jokers-of-neon\": {\n id: \"jokers-of-neon\",\n name: \"Jokers of Neon\",\n icon: \"/whitelabel/jokers-of-neon/icon.png\",\n cover: \"/whitelabel/jokers-of-neon/cover.png\",\n colors: {\n primary: \"#A144B2\",\n },\n },\n flippyflop: {\n id: \"flippyflop\",\n name: \"FlippyFlop\",\n icon: \"/whitelabel/flippyflop/icon.png\",\n cover: \"/whitelabel/flippyflop/cover.png\",\n colors: {\n primary: \"#F38332\",\n },\n },\n \"savage-summit\": {\n id: \"savage-summit\",\n name: \"Savage Summit\",\n icon: \"/whitelabel/savage-summit/icon.png\",\n cover: \"/whitelabel/savage-summit/cover.png\",\n colors: {\n primary: \"#fbf7da\",\n },\n },\n \"dark-shuffle\": {\n id: \"dark-shuffle\",\n name: \"Dark Shuffle\",\n icon: \"/whitelabel/dark-shuffle/icon.svg\",\n cover: \"/whitelabel/dark-shuffle/cover.png\",\n colors: {\n primary: \"#F59100\",\n },\n },\n \"blob-arena\": {\n id: \"blob-arena\",\n name: \"Blob Arena\",\n icon: \"/whitelabel/blob-arena/icon.png\",\n cover: \"/whitelabel/blob-arena/cover.png\",\n colors: {\n primary: \"#980f06\",\n },\n },\n zkube: {\n id: \"zkube\",\n name: \"zKube\",\n icon: \"/whitelabel/zkube/icon.png\",\n cover: \"/whitelabel/zkube/cover.png\",\n colors: {\n primary: \"#5bc3e6\",\n },\n },\n};\n","export const KEYCHAIN_URL = \"https://x.cartridge.gg\";\nexport const PROFILE_URL = \"https://profile.cartridge.gg\";\n","import { KEYCHAIN_URL } from \"../constants\";\nimport { Keychain, KeychainOptions } from \"../types\";\nimport { IFrame, IFrameOptions } from \"./base\";\n\ntype KeychainIframeOptions = IFrameOptions<Keychain> & KeychainOptions;\n\nexport class KeychainIFrame extends IFrame<Keychain> {\n constructor({ url, policies, ...iframeOptions }: KeychainIframeOptions) {\n const _url = new URL(url ?? KEYCHAIN_URL);\n\n if (policies) {\n _url.searchParams.set(\n \"policies\",\n encodeURIComponent(JSON.stringify(policies)),\n );\n }\n\n super({\n ...iframeOptions,\n id: \"controller-keychain\",\n url: _url,\n });\n }\n}\n","import { PROFILE_URL } from \"../constants\";\nimport { Profile, ProfileOptions } from \"../types\";\nimport { IFrame, IFrameOptions } from \"./base\";\n\nexport type ProfileIFrameOptions = IFrameOptions<Profile> &\n ProfileOptions & {\n rpcUrl: string;\n username: string;\n slot?: string;\n namespace?: string;\n };\n\nexport class ProfileIFrame extends IFrame<Profile> {\n constructor({\n profileUrl,\n rpcUrl,\n namespace,\n slot,\n username,\n tokens,\n ...iframeOptions\n }: ProfileIFrameOptions) {\n const _profileUrl = profileUrl || PROFILE_URL;\n const _url = new URL(\n slot\n ? namespace\n ? `${_profileUrl}/account/${username}/slot/${slot}?ns=${encodeURIComponent(\n namespace,\n )}`\n : `${_profileUrl}/account/${username}/slot/${slot}`\n : `${_profileUrl}/account/${username}`,\n );\n\n _url.searchParams.set(\"rpcUrl\", encodeURIComponent(rpcUrl));\n\n if (tokens?.erc20) {\n _url.searchParams.set(\n \"erc20\",\n encodeURIComponent(tokens.erc20.toString()),\n );\n }\n\n super({\n ...iframeOptions,\n id: \"controller-profile\",\n url: _url,\n });\n }\n}\n"],"mappings":";AAAA,SAA6B,sBAAsB;;;ACE5C,IAAM,iBAAyC;AAAA,EACpD,WAAW;AAAA,IACT,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,MACN,SAA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G,WAAW,YAAY,QAAQ,SAAS,IAAI,KACjD,GAAG,WAAW,YAAY,QAAQ;AAAA,IACxC;AAEA,SAAK,aAAa,IAAI,UAAU,mBAAmB,MAAM,CAAC;AAE1D,QAAI,QAAQ,OAAO;AACjB,WAAK,aAAa;AAAA,QAChB;AAAA,QACA,mBAAmB,OAAO,MAAM,SAAS,CAAC;AAAA,MAC5C;AAAA,IACF;AAEA,UAAM;AAAA,MACJ,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACF;","names":["existingController"]}
@@ -1,7 +1,5 @@
1
- import { Keychain, KeychainOptions } from "../types";
2
- import { IFrame, IFrameOptions } from "./base";
3
- type KeychainIframeOptions = IFrameOptions<Keychain> & KeychainOptions;
4
- export declare class KeychainIFrame extends IFrame<Keychain> {
5
- constructor({ url, policies, ...iframeOptions }: KeychainIframeOptions);
6
- }
7
- export {};
1
+ export { v as KeychainIFrame } from '../types-DIeWpu0p.js';
2
+ import 'starknet';
3
+ import '@starknet-io/types-js';
4
+ import '@cartridge/penpal';
5
+ import '@cartridge/account-wasm/controller';