@cartridge/controller 0.5.1 → 0.5.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.
Files changed (66) hide show
  1. package/.turbo/turbo-build$colon$deps.log +51 -51
  2. package/.turbo/turbo-build.log +119 -0
  3. package/dist/account.d.ts +2 -1
  4. package/dist/account.js +19 -4
  5. package/dist/account.js.map +1 -1
  6. package/dist/constants.d.ts +2 -1
  7. package/dist/constants.js +2 -0
  8. package/dist/constants.js.map +1 -1
  9. package/dist/controller.d.ts +2 -1
  10. package/dist/controller.js +27 -184
  11. package/dist/controller.js.map +1 -1
  12. package/dist/iframe/base.d.ts +2 -1
  13. package/dist/iframe/base.js +3 -177
  14. package/dist/iframe/base.js.map +1 -1
  15. package/dist/iframe/index.d.ts +2 -1
  16. package/dist/iframe/index.js +8 -180
  17. package/dist/iframe/index.js.map +1 -1
  18. package/dist/iframe/keychain.d.ts +2 -1
  19. package/dist/iframe/keychain.js +3 -177
  20. package/dist/iframe/keychain.js.map +1 -1
  21. package/dist/iframe/profile.d.ts +2 -1
  22. package/dist/iframe/profile.js +8 -180
  23. package/dist/iframe/profile.js.map +1 -1
  24. package/dist/index.d.ts +5 -2
  25. package/dist/index.js +166 -185
  26. package/dist/index.js.map +1 -1
  27. package/dist/lookup.d.ts +4 -0
  28. package/dist/lookup.js +56 -0
  29. package/dist/lookup.js.map +1 -0
  30. package/dist/provider.d.ts +2 -1
  31. package/dist/session/account.d.ts +2 -2
  32. package/dist/session/account.js +6 -170
  33. package/dist/session/account.js.map +1 -1
  34. package/dist/session/index.d.ts +2 -2
  35. package/dist/session/index.js +20 -183
  36. package/dist/session/index.js.map +1 -1
  37. package/dist/session/provider.d.ts +4 -3
  38. package/dist/session/provider.js +19 -14
  39. package/dist/session/provider.js.map +1 -1
  40. package/dist/telegram/provider.d.ts +7 -4
  41. package/dist/telegram/provider.js +19 -14
  42. package/dist/telegram/provider.js.map +1 -1
  43. package/dist/{types-ikHqoYmG.d.ts → types-1WsOoNO2.d.ts} +17 -37
  44. package/dist/types.d.ts +2 -1
  45. package/dist/types.js.map +1 -1
  46. package/dist/utils.d.ts +5 -5
  47. package/dist/utils.js +80 -14
  48. package/dist/utils.js.map +1 -1
  49. package/package.json +5 -3
  50. package/src/account.ts +2 -1
  51. package/src/constants.ts +1 -0
  52. package/src/controller.ts +1 -1
  53. package/src/iframe/base.ts +3 -9
  54. package/src/iframe/profile.ts +5 -3
  55. package/src/index.ts +3 -1
  56. package/src/lookup.ts +68 -0
  57. package/src/session/account.ts +0 -1
  58. package/src/session/index.ts +0 -2
  59. package/src/session/provider.ts +4 -4
  60. package/src/telegram/provider.ts +7 -7
  61. package/src/types.ts +23 -44
  62. package/src/utils.ts +100 -16
  63. package/dist/presets.d.ts +0 -8
  64. package/dist/presets.js +0 -170
  65. package/dist/presets.js.map +0 -1
  66. package/src/presets.ts +0 -167
@@ -1,55 +1,55 @@
1
1
 
2
- > @cartridge/controller@0.5.1 build:deps /home/runner/work/controller/controller/packages/controller
2
+ > @cartridge/controller@0.5.3 build:deps /home/runner/work/controller/controller/packages/controller
3
3
  > tsup --dts-resolve
4
4
 
5
- CLI Building entry: src/account.ts, src/constants.ts, src/controller.ts, src/errors.ts, src/icon.ts, src/index.ts, src/presets.ts, src/provider.ts, src/types.ts, src/utils.ts, src/iframe/base.ts, src/iframe/index.ts, src/iframe/keychain.ts, src/iframe/profile.ts, src/session/account.ts, src/session/backend.ts, src/session/index.ts, src/session/provider.ts, src/telegram/backend.ts, src/telegram/provider.ts
5
+ CLI Building entry: src/account.ts, src/constants.ts, src/controller.ts, src/errors.ts, src/icon.ts, src/index.ts, src/lookup.ts, src/provider.ts, src/types.ts, src/utils.ts, src/iframe/base.ts, src/iframe/index.ts, src/iframe/keychain.ts, src/iframe/profile.ts, src/session/account.ts, src/session/backend.ts, src/session/index.ts, src/session/provider.ts, src/telegram/backend.ts, src/telegram/provider.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.3.0
8
8
  CLI Using tsup config: /home/runner/work/controller/controller/packages/controller/package.json
9
9
  CLI Target: es2020
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
- ESM dist/account.js 2.61 KB
13
- ESM dist/iframe/base.js 7.17 KB
14
- ESM dist/session/account.js 5.86 KB
12
+ ESM dist/account.js 2.81 KB
13
+ ESM dist/iframe/base.js 3.39 KB
14
+ ESM dist/session/account.js 2.25 KB
15
15
  ESM dist/telegram/backend.js 1.27 KB
16
- ESM dist/controller.js 35.73 KB
17
- ESM dist/errors.js 271.00 B
18
- ESM dist/constants.js 194.00 B
16
+ ESM dist/constants.js 247.00 B
17
+ ESM dist/controller.js 32.23 KB
19
18
  ESM dist/icon.js 15.15 KB
20
- ESM dist/index.js 36.16 KB
21
- ESM dist/presets.js 3.71 KB
19
+ ESM dist/errors.js 271.00 B
20
+ ESM dist/index.js 36.44 KB
21
+ ESM dist/lookup.js 1.59 KB
22
22
  ESM dist/provider.js 19.16 KB
23
23
  ESM dist/types.js 437.00 B
24
- ESM dist/utils.js 1.08 KB
25
- ESM dist/iframe/index.js 8.51 KB
26
- ESM dist/iframe/keychain.js 7.64 KB
27
- ESM dist/iframe/profile.js 8.04 KB
24
+ ESM dist/utils.js 2.75 KB
25
+ ESM dist/iframe/index.js 4.81 KB
26
+ ESM dist/iframe/keychain.js 3.86 KB
27
+ ESM dist/iframe/profile.js 4.34 KB
28
28
  ESM dist/session/backend.js 1.18 KB
29
- ESM dist/session/index.js 28.54 KB
30
- ESM dist/session/provider.js 24.26 KB
31
- ESM dist/telegram/provider.js 23.82 KB
32
- ESM dist/account.js.map 5.08 KB
33
- ESM dist/iframe/base.js.map 13.18 KB
34
- ESM dist/session/account.js.map 15.68 KB
29
+ ESM dist/session/index.js 24.95 KB
30
+ ESM dist/session/provider.js 24.35 KB
31
+ ESM dist/telegram/provider.js 23.91 KB
32
+ ESM dist/account.js.map 8.81 KB
33
+ ESM dist/iframe/base.js.map 6.58 KB
34
+ ESM dist/session/account.js.map 11.10 KB
35
35
  ESM dist/telegram/backend.js.map 1.98 KB
36
+ ESM dist/constants.js.map 315.00 B
37
+ ESM dist/controller.js.map 52.09 KB
36
38
  ESM dist/errors.js.map 385.00 B
37
- ESM dist/constants.js.map 245.00 B
38
- ESM dist/controller.js.map 54.72 KB
39
39
  ESM dist/icon.js.map 15.20 KB
40
- ESM dist/presets.js.map 6.45 KB
40
+ ESM dist/lookup.js.map 3.49 KB
41
+ ESM dist/index.js.map 61.84 KB
41
42
  ESM dist/provider.js.map 22.49 KB
42
- ESM dist/types.js.map 5.23 KB
43
- ESM dist/index.js.map 59.88 KB
44
- ESM dist/utils.js.map 1.96 KB
45
- ESM dist/iframe/index.js.map 16.17 KB
46
- ESM dist/iframe/keychain.js.map 14.32 KB
47
- ESM dist/iframe/profile.js.map 15.17 KB
43
+ ESM dist/types.js.map 4.66 KB
44
+ ESM dist/utils.js.map 5.64 KB
45
+ ESM dist/iframe/index.js.map 9.77 KB
46
+ ESM dist/iframe/keychain.js.map 7.78 KB
47
+ ESM dist/iframe/profile.js.map 8.77 KB
48
48
  ESM dist/session/backend.js.map 2.88 KB
49
- ESM dist/session/index.js.map 44.48 KB
50
- ESM dist/session/provider.js.map 32.62 KB
51
- ESM dist/telegram/provider.js.map 31.79 KB
52
- ESM ⚡️ Build success in 59ms
49
+ ESM dist/session/index.js.map 40.10 KB
50
+ ESM dist/session/provider.js.map 35.18 KB
51
+ ESM dist/telegram/provider.js.map 34.36 KB
52
+ ESM ⚡️ Build success in 76ms
53
53
  DTS Build start
54
54
  ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
55
55
 
@@ -91,25 +91,25 @@
91
91
 
92
92
  ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
93
93
 
94
- DTS ⚡️ Build success in 5274ms
95
- DTS dist/index.d.ts 885.00 B
96
- DTS dist/session/index.d.ts 903.00 B
97
- DTS dist/account.d.ts 1.59 KB
98
- DTS dist/constants.d.ts 154.00 B
94
+ DTS ⚡️ Build success in 7481ms
95
+ DTS dist/index.d.ts 907.00 B
96
+ DTS dist/session/index.d.ts 735.00 B
97
+ DTS dist/account.d.ts 1.62 KB
98
+ DTS dist/constants.d.ts 215.00 B
99
99
  DTS dist/icon.d.ts 15.11 KB
100
- DTS dist/controller.d.ts 1.04 KB
101
- DTS dist/utils.d.ts 501.00 B
102
- DTS dist/session/account.d.ts 1.99 KB
100
+ DTS dist/controller.d.ts 1.07 KB
101
+ DTS dist/lookup.d.ts 216.00 B
102
+ DTS dist/utils.d.ts 610.00 B
103
+ DTS dist/session/account.d.ts 1.83 KB
103
104
  DTS dist/session/backend.d.ts 2.29 KB
104
105
  DTS dist/errors.d.ts 100.00 B
105
- DTS dist/presets.d.ts 229.00 B
106
- DTS dist/session/provider.d.ts 924.00 B
107
- DTS dist/provider.d.ts 743.00 B
106
+ DTS dist/session/provider.d.ts 971.00 B
108
107
  DTS dist/telegram/backend.d.ts 1.27 KB
109
- DTS dist/telegram/provider.d.ts 706.00 B
110
- DTS dist/iframe/base.d.ts 151.00 B
111
- DTS dist/iframe/keychain.d.ts 139.00 B
112
- DTS dist/iframe/profile.d.ts 165.00 B
113
- DTS dist/iframe/index.d.ts 219.00 B
114
- DTS dist/types.d.ts 722.00 B
115
- DTS dist/types-ikHqoYmG.d.ts 6.70 KB
108
+ DTS dist/telegram/provider.d.ts 831.00 B
109
+ DTS dist/provider.d.ts 772.00 B
110
+ DTS dist/iframe/base.d.ts 180.00 B
111
+ DTS dist/iframe/keychain.d.ts 168.00 B
112
+ DTS dist/iframe/profile.d.ts 194.00 B
113
+ DTS dist/iframe/index.d.ts 248.00 B
114
+ DTS dist/types.d.ts 602.00 B
115
+ DTS dist/types-1WsOoNO2.d.ts 6.01 KB
@@ -0,0 +1,119 @@
1
+
2
+ > @cartridge/controller@0.5.3 build /home/runner/work/controller/controller/packages/controller
3
+ > pnpm build:deps
4
+
5
+
6
+ > @cartridge/controller@0.5.3 build:deps /home/runner/work/controller/controller/packages/controller
7
+ > tsup --dts-resolve
8
+
9
+ CLI Building entry: src/account.ts, src/constants.ts, src/controller.ts, src/errors.ts, src/icon.ts, src/index.ts, src/lookup.ts, src/provider.ts, src/types.ts, src/utils.ts, src/iframe/base.ts, src/iframe/index.ts, src/iframe/keychain.ts, src/iframe/profile.ts, src/session/account.ts, src/session/backend.ts, src/session/index.ts, src/session/provider.ts, src/telegram/backend.ts, src/telegram/provider.ts
10
+ CLI Using tsconfig: tsconfig.json
11
+ CLI tsup v8.3.0
12
+ CLI Using tsup config: /home/runner/work/controller/controller/packages/controller/package.json
13
+ CLI Target: es2020
14
+ CLI Cleaning output folder
15
+ ESM Build start
16
+ ESM dist/account.js 2.81 KB
17
+ ESM dist/constants.js 247.00 B
18
+ ESM dist/errors.js 271.00 B
19
+ ESM dist/controller.js 32.23 KB
20
+ ESM dist/icon.js 15.15 KB
21
+ ESM dist/index.js 36.44 KB
22
+ ESM dist/lookup.js 1.59 KB
23
+ ESM dist/provider.js 19.16 KB
24
+ ESM dist/types.js 437.00 B
25
+ ESM dist/utils.js 2.75 KB
26
+ ESM dist/iframe/base.js 3.39 KB
27
+ ESM dist/iframe/index.js 4.81 KB
28
+ ESM dist/iframe/keychain.js 3.86 KB
29
+ ESM dist/iframe/profile.js 4.34 KB
30
+ ESM dist/session/account.js 2.25 KB
31
+ ESM dist/session/backend.js 1.18 KB
32
+ ESM dist/session/index.js 24.95 KB
33
+ ESM dist/session/provider.js 24.35 KB
34
+ ESM dist/telegram/backend.js 1.27 KB
35
+ ESM dist/telegram/provider.js 23.91 KB
36
+ ESM dist/account.js.map 8.81 KB
37
+ ESM dist/constants.js.map 315.00 B
38
+ ESM dist/errors.js.map 385.00 B
39
+ ESM dist/controller.js.map 52.09 KB
40
+ ESM dist/icon.js.map 15.20 KB
41
+ ESM dist/index.js.map 61.84 KB
42
+ ESM dist/lookup.js.map 3.49 KB
43
+ ESM dist/provider.js.map 22.49 KB
44
+ ESM dist/types.js.map 4.66 KB
45
+ ESM dist/utils.js.map 5.64 KB
46
+ ESM dist/iframe/base.js.map 6.58 KB
47
+ ESM dist/iframe/index.js.map 9.77 KB
48
+ ESM dist/iframe/keychain.js.map 7.78 KB
49
+ ESM dist/iframe/profile.js.map 8.77 KB
50
+ ESM dist/session/account.js.map 11.10 KB
51
+ ESM dist/session/backend.js.map 2.88 KB
52
+ ESM dist/session/index.js.map 40.10 KB
53
+ ESM dist/session/provider.js.map 35.18 KB
54
+ ESM dist/telegram/backend.js.map 1.98 KB
55
+ ESM dist/telegram/provider.js.map 34.36 KB
56
+ ESM ⚡️ Build success in 120ms
57
+ DTS Build start
58
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
59
+
60
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
61
+
62
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
63
+
64
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
65
+
66
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
67
+
68
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
69
+
70
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
71
+
72
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
73
+
74
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
75
+
76
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
77
+
78
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
79
+
80
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
81
+
82
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
83
+
84
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
85
+
86
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
87
+
88
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
89
+
90
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
91
+
92
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
93
+
94
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
95
+
96
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
97
+
98
+ DTS ⚡️ Build success in 7344ms
99
+ DTS dist/index.d.ts 907.00 B
100
+ DTS dist/session/index.d.ts 735.00 B
101
+ DTS dist/account.d.ts 1.62 KB
102
+ DTS dist/constants.d.ts 215.00 B
103
+ DTS dist/icon.d.ts 15.11 KB
104
+ DTS dist/controller.d.ts 1.07 KB
105
+ DTS dist/lookup.d.ts 216.00 B
106
+ DTS dist/utils.d.ts 610.00 B
107
+ DTS dist/session/account.d.ts 1.83 KB
108
+ DTS dist/session/backend.d.ts 2.29 KB
109
+ DTS dist/errors.d.ts 100.00 B
110
+ DTS dist/session/provider.d.ts 971.00 B
111
+ DTS dist/telegram/backend.d.ts 1.27 KB
112
+ DTS dist/telegram/provider.d.ts 831.00 B
113
+ DTS dist/provider.d.ts 772.00 B
114
+ DTS dist/iframe/base.d.ts 180.00 B
115
+ DTS dist/iframe/keychain.d.ts 168.00 B
116
+ DTS dist/iframe/profile.d.ts 194.00 B
117
+ DTS dist/iframe/index.d.ts 248.00 B
118
+ DTS dist/types.d.ts 602.00 B
119
+ DTS dist/types-1WsOoNO2.d.ts 6.01 KB
package/dist/account.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { WalletAccount, AllowArray, Call, InvokeFunctionResponse, TypedData } from 'starknet';
2
2
  import { SPEC } from '@starknet-io/types-js';
3
- import { K as Keychain, j as KeychainOptions, M as Modal } from './types-ikHqoYmG.js';
3
+ import { K as Keychain, j as KeychainOptions, M as Modal } from './types-1WsOoNO2.js';
4
4
  import { AsyncMethodReturns } from '@cartridge/penpal';
5
5
  import BaseProvider from './provider.js';
6
+ import '@cartridge/presets';
6
7
 
7
8
  declare class ControllerAccount extends WalletAccount {
8
9
  address: string;
package/dist/account.js CHANGED
@@ -2,6 +2,21 @@
2
2
  import {
3
3
  WalletAccount
4
4
  } from "starknet";
5
+
6
+ // src/utils.ts
7
+ import {
8
+ addAddressPadding,
9
+ CallData,
10
+ getChecksumAddress,
11
+ hash,
12
+ typedData,
13
+ TypedDataRevision
14
+ } from "starknet";
15
+ function toArray(val) {
16
+ return Array.isArray(val) ? val : [val];
17
+ }
18
+
19
+ // src/account.ts
5
20
  var ControllerAccount = class extends WalletAccount {
6
21
  constructor(provider, address, keychain, options, modal) {
7
22
  super({ nodeUrl: provider.rpc.toString() }, provider);
@@ -23,7 +38,7 @@ var ControllerAccount = class extends WalletAccount {
23
38
  * @returns response from addTransaction
24
39
  */
25
40
  async execute(calls) {
26
- calls = Array.isArray(calls) ? calls : [calls];
41
+ calls = toArray(calls);
27
42
  return new Promise(async (resolve, reject) => {
28
43
  const sessionExecute = await this.keychain.execute(
29
44
  calls,
@@ -64,15 +79,15 @@ var ControllerAccount = class extends WalletAccount {
64
79
  * @returns the signature of the JSON object
65
80
  * @throws {Error} if the JSON object is not a valid JSON
66
81
  */
67
- async signMessage(typedData) {
82
+ async signMessage(typedData2) {
68
83
  return new Promise(async (resolve, reject) => {
69
- const sessionSign = await this.keychain.signMessage(typedData, "", true);
84
+ const sessionSign = await this.keychain.signMessage(typedData2, "", true);
70
85
  if (!("code" in sessionSign)) {
71
86
  resolve(sessionSign);
72
87
  return;
73
88
  }
74
89
  this.modal.open();
75
- const manualSign = await this.keychain.signMessage(typedData, "", false);
90
+ const manualSign = await this.keychain.signMessage(typedData2, "", false);
76
91
  if (!("code" in manualSign)) {
77
92
  resolve(manualSign);
78
93
  } else {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/account.ts"],"sourcesContent":["import {\n InvokeFunctionResponse,\n TypedData,\n WalletAccount,\n Call,\n AllowArray,\n} from \"starknet\";\n\nimport { SPEC } from \"@starknet-io/types-js\";\n\nimport {\n ConnectError,\n Keychain,\n KeychainOptions,\n Modal,\n ResponseCodes,\n} from \"./types\";\nimport { AsyncMethodReturns } from \"@cartridge/penpal\";\nimport BaseProvider from \"./provider\";\n\nclass ControllerAccount extends WalletAccount {\n address: string;\n private keychain: AsyncMethodReturns<Keychain>;\n private modal: Modal;\n private options?: KeychainOptions;\n\n constructor(\n provider: BaseProvider,\n address: string,\n keychain: AsyncMethodReturns<Keychain>,\n options: KeychainOptions,\n modal: Modal,\n ) {\n super({ nodeUrl: provider.rpc.toString() }, provider);\n\n this.address = address;\n this.keychain = keychain;\n this.options = options;\n this.modal = modal;\n }\n\n /**\n * Invoke execute function in account contract\n *\n * @param calls the invocation object or an array of them, containing:\n * - contractAddress - the address of the contract\n * - entrypoint - the entrypoint of the contract\n * - calldata - (defaults to []) the calldata\n * - signature - (defaults to []) the signature\n * @param abis (optional) the abi of the contract for better displaying\n *\n * @returns response from addTransaction\n */\n async execute(calls: AllowArray<Call>): Promise<InvokeFunctionResponse> {\n calls = Array.isArray(calls) ? calls : [calls];\n\n return new Promise(async (resolve, reject) => {\n const sessionExecute = await this.keychain.execute(\n calls,\n undefined,\n undefined,\n false,\n );\n\n // Session call succeeded\n if (sessionExecute.code === ResponseCodes.SUCCESS) {\n resolve(sessionExecute as InvokeFunctionResponse);\n return;\n }\n\n // Propagates session txn error back to caller\n if (this.options?.propagateSessionErrors) {\n reject((sessionExecute as ConnectError).error);\n return;\n }\n\n // Session call or Paymaster flow failed.\n // Session not avaialble, manual flow fallback\n this.modal.open();\n const manualExecute = await this.keychain.execute(\n calls,\n undefined,\n undefined,\n true,\n (sessionExecute as ConnectError).error,\n );\n\n // Manual call succeeded\n if (manualExecute.code === ResponseCodes.SUCCESS) {\n resolve(manualExecute as InvokeFunctionResponse);\n this.modal.close();\n return;\n }\n\n reject((manualExecute as ConnectError).error);\n return;\n });\n }\n\n /**\n * Sign an JSON object for off-chain usage with the starknet private key and return the signature\n * This adds a message prefix so it cant be interchanged with transactions\n *\n * @param json - JSON object to be signed\n * @returns the signature of the JSON object\n * @throws {Error} if the JSON object is not a valid JSON\n */\n async signMessage(typedData: TypedData): Promise<SPEC.SIGNATURE> {\n return new Promise(async (resolve, reject) => {\n const sessionSign = await this.keychain.signMessage(typedData, \"\", true);\n\n // Session sign succeeded\n if (!(\"code\" in sessionSign)) {\n resolve(sessionSign as SPEC.SIGNATURE);\n return;\n }\n\n // Session not avaialble, manual flow fallback\n this.modal.open();\n const manualSign = await this.keychain.signMessage(typedData, \"\", false);\n\n if (!(\"code\" in manualSign)) {\n resolve(manualSign as SPEC.SIGNATURE);\n } else {\n reject((manualSign as ConnectError).error);\n }\n this.modal.close();\n });\n }\n}\n\nexport default ControllerAccount;\n"],"mappings":";AAAA;AAAA,EAGE;AAAA,OAGK;AAcP,IAAM,oBAAN,cAAgC,cAAc;AAAA,EAM5C,YACE,UACA,SACA,UACA,SACA,OACA;AACA,UAAM,EAAE,SAAS,SAAS,IAAI,SAAS,EAAE,GAAG,QAAQ;AAEpD,SAAK,UAAU;AACf,SAAK,WAAW;AAChB,SAAK,UAAU;AACf,SAAK,QAAQ;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,QAAQ,OAA0D;AACtE,YAAQ,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AAE7C,WAAO,IAAI,QAAQ,OAAO,SAAS,WAAW;AAC5C,YAAM,iBAAiB,MAAM,KAAK,SAAS;AAAA,QACzC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAGA,UAAI,eAAe,kCAAgC;AACjD,gBAAQ,cAAwC;AAChD;AAAA,MACF;AAGA,UAAI,KAAK,SAAS,wBAAwB;AACxC,eAAQ,eAAgC,KAAK;AAC7C;AAAA,MACF;AAIA,WAAK,MAAM,KAAK;AAChB,YAAM,gBAAgB,MAAM,KAAK,SAAS;AAAA,QACxC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,eAAgC;AAAA,MACnC;AAGA,UAAI,cAAc,kCAAgC;AAChD,gBAAQ,aAAuC;AAC/C,aAAK,MAAM,MAAM;AACjB;AAAA,MACF;AAEA,aAAQ,cAA+B,KAAK;AAC5C;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,YAAY,WAA+C;AAC/D,WAAO,IAAI,QAAQ,OAAO,SAAS,WAAW;AAC5C,YAAM,cAAc,MAAM,KAAK,SAAS,YAAY,WAAW,IAAI,IAAI;AAGvE,UAAI,EAAE,UAAU,cAAc;AAC5B,gBAAQ,WAA6B;AACrC;AAAA,MACF;AAGA,WAAK,MAAM,KAAK;AAChB,YAAM,aAAa,MAAM,KAAK,SAAS,YAAY,WAAW,IAAI,KAAK;AAEvE,UAAI,EAAE,UAAU,aAAa;AAC3B,gBAAQ,UAA4B;AAAA,MACtC,OAAO;AACL,eAAQ,WAA4B,KAAK;AAAA,MAC3C;AACA,WAAK,MAAM,MAAM;AAAA,IACnB,CAAC;AAAA,EACH;AACF;AAEA,IAAO,kBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/account.ts","../src/utils.ts"],"sourcesContent":["import {\n InvokeFunctionResponse,\n TypedData,\n WalletAccount,\n Call,\n AllowArray,\n} from \"starknet\";\n\nimport { SPEC } from \"@starknet-io/types-js\";\n\nimport {\n ConnectError,\n Keychain,\n KeychainOptions,\n Modal,\n ResponseCodes,\n} from \"./types\";\nimport { AsyncMethodReturns } from \"@cartridge/penpal\";\nimport BaseProvider from \"./provider\";\nimport { toArray } from \"./utils\";\n\nclass ControllerAccount extends WalletAccount {\n address: string;\n private keychain: AsyncMethodReturns<Keychain>;\n private modal: Modal;\n private options?: KeychainOptions;\n\n constructor(\n provider: BaseProvider,\n address: string,\n keychain: AsyncMethodReturns<Keychain>,\n options: KeychainOptions,\n modal: Modal,\n ) {\n super({ nodeUrl: provider.rpc.toString() }, provider);\n\n this.address = address;\n this.keychain = keychain;\n this.options = options;\n this.modal = modal;\n }\n\n /**\n * Invoke execute function in account contract\n *\n * @param calls the invocation object or an array of them, containing:\n * - contractAddress - the address of the contract\n * - entrypoint - the entrypoint of the contract\n * - calldata - (defaults to []) the calldata\n * - signature - (defaults to []) the signature\n * @param abis (optional) the abi of the contract for better displaying\n *\n * @returns response from addTransaction\n */\n async execute(calls: AllowArray<Call>): Promise<InvokeFunctionResponse> {\n calls = toArray(calls);\n\n return new Promise(async (resolve, reject) => {\n const sessionExecute = await this.keychain.execute(\n calls,\n undefined,\n undefined,\n false,\n );\n\n // Session call succeeded\n if (sessionExecute.code === ResponseCodes.SUCCESS) {\n resolve(sessionExecute as InvokeFunctionResponse);\n return;\n }\n\n // Propagates session txn error back to caller\n if (this.options?.propagateSessionErrors) {\n reject((sessionExecute as ConnectError).error);\n return;\n }\n\n // Session call or Paymaster flow failed.\n // Session not avaialble, manual flow fallback\n this.modal.open();\n const manualExecute = await this.keychain.execute(\n calls,\n undefined,\n undefined,\n true,\n (sessionExecute as ConnectError).error,\n );\n\n // Manual call succeeded\n if (manualExecute.code === ResponseCodes.SUCCESS) {\n resolve(manualExecute as InvokeFunctionResponse);\n this.modal.close();\n return;\n }\n\n reject((manualExecute as ConnectError).error);\n return;\n });\n }\n\n /**\n * Sign an JSON object for off-chain usage with the starknet private key and return the signature\n * This adds a message prefix so it cant be interchanged with transactions\n *\n * @param json - JSON object to be signed\n * @returns the signature of the JSON object\n * @throws {Error} if the JSON object is not a valid JSON\n */\n async signMessage(typedData: TypedData): Promise<SPEC.SIGNATURE> {\n return new Promise(async (resolve, reject) => {\n const sessionSign = await this.keychain.signMessage(typedData, \"\", true);\n\n // Session sign succeeded\n if (!(\"code\" in sessionSign)) {\n resolve(sessionSign as SPEC.SIGNATURE);\n return;\n }\n\n // Session not avaialble, manual flow fallback\n this.modal.open();\n const manualSign = await this.keychain.signMessage(typedData, \"\", false);\n\n if (!(\"code\" in manualSign)) {\n resolve(manualSign as SPEC.SIGNATURE);\n } else {\n reject((manualSign as ConnectError).error);\n }\n this.modal.close();\n });\n }\n}\n\nexport default ControllerAccount;\n","import {\n addAddressPadding,\n Call,\n CallData,\n getChecksumAddress,\n hash,\n typedData,\n TypedDataRevision,\n} from \"starknet\";\nimport wasm from \"@cartridge/account-wasm/controller\";\nimport { Policies, SessionPolicies } from \"@cartridge/presets\";\n\n// Whitelist of allowed property names to prevent prototype pollution\nconst ALLOWED_PROPERTIES = new Set([\n \"contracts\",\n \"messages\",\n \"target\",\n \"method\",\n \"name\",\n \"description\",\n \"types\",\n \"domain\",\n \"primaryType\",\n]);\n\nfunction validatePropertyName(prop: string): void {\n if (!ALLOWED_PROPERTIES.has(prop)) {\n throw new Error(`Invalid property name: ${prop}`);\n }\n}\n\nfunction safeObjectAccess<T>(obj: any, prop: string): T {\n validatePropertyName(prop);\n return obj[prop];\n}\n\nexport function normalizeCalls(calls: Call | Call[]) {\n return toArray(calls).map((call) => {\n return {\n entrypoint: call.entrypoint,\n contractAddress: addAddressPadding(call.contractAddress),\n calldata: CallData.toHex(call.calldata),\n };\n });\n}\n\nexport function toSessionPolicies(policies: Policies): SessionPolicies {\n return Array.isArray(policies)\n ? policies.reduce<SessionPolicies>(\n (prev, p) => {\n if (safeObjectAccess<string>(p, \"target\")) {\n const target = getChecksumAddress(\n safeObjectAccess<string>(p, \"target\"),\n );\n const entrypoint = safeObjectAccess<string>(p, \"method\");\n const contracts = safeObjectAccess<Record<string, any>>(\n prev,\n \"contracts\",\n );\n const item = {\n name: humanizeString(entrypoint),\n entrypoint: entrypoint,\n description: safeObjectAccess<string>(p, \"description\"),\n };\n\n if (target in contracts) {\n const methods = toArray(contracts[target].methods);\n contracts[target] = {\n methods: [...methods, item],\n };\n } else {\n contracts[target] = {\n methods: [item],\n };\n }\n } else {\n const messages = safeObjectAccess<any[]>(prev, \"messages\");\n messages.push(p);\n }\n\n return prev;\n },\n { contracts: {}, messages: [] },\n )\n : policies;\n}\n\nexport function toWasmPolicies(policies: SessionPolicies): wasm.Policy[] {\n return [\n ...Object.entries(policies.contracts ?? {}).flatMap(\n ([target, { methods }]) =>\n toArray(methods).map((m) => ({\n target,\n method: m.entrypoint,\n })),\n ),\n ...(policies.messages ?? []).map((p) => {\n const domainHash = typedData.getStructHash(\n p.types,\n \"StarknetDomain\",\n p.domain,\n TypedDataRevision.ACTIVE,\n );\n const typeHash = typedData.getTypeHash(\n p.types,\n p.primaryType,\n TypedDataRevision.ACTIVE,\n );\n\n return {\n scope_hash: hash.computePoseidonHash(domainHash, typeHash),\n };\n }),\n ];\n}\n\nexport function toArray<T>(val: T | T[]): T[] {\n return Array.isArray(val) ? val : [val];\n}\n\nfunction humanizeString(str: string): string {\n return (\n str\n // Convert from camelCase or snake_case\n .replace(/([a-z])([A-Z])/g, \"$1 $2\") // camelCase to spaces\n .replace(/_/g, \" \") // snake_case to spaces\n .toLowerCase()\n // Capitalize first letter\n .replace(/^\\w/, (c) => c.toUpperCase())\n );\n}\n"],"mappings":";AAAA;AAAA,EAGE;AAAA,OAGK;;;ACNP;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA4GA,SAAS,QAAW,KAAmB;AAC5C,SAAO,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;AACxC;;;ADjGA,IAAM,oBAAN,cAAgC,cAAc;AAAA,EAM5C,YACE,UACA,SACA,UACA,SACA,OACA;AACA,UAAM,EAAE,SAAS,SAAS,IAAI,SAAS,EAAE,GAAG,QAAQ;AAEpD,SAAK,UAAU;AACf,SAAK,WAAW;AAChB,SAAK,UAAU;AACf,SAAK,QAAQ;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,QAAQ,OAA0D;AACtE,YAAQ,QAAQ,KAAK;AAErB,WAAO,IAAI,QAAQ,OAAO,SAAS,WAAW;AAC5C,YAAM,iBAAiB,MAAM,KAAK,SAAS;AAAA,QACzC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAGA,UAAI,eAAe,kCAAgC;AACjD,gBAAQ,cAAwC;AAChD;AAAA,MACF;AAGA,UAAI,KAAK,SAAS,wBAAwB;AACxC,eAAQ,eAAgC,KAAK;AAC7C;AAAA,MACF;AAIA,WAAK,MAAM,KAAK;AAChB,YAAM,gBAAgB,MAAM,KAAK,SAAS;AAAA,QACxC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,eAAgC;AAAA,MACnC;AAGA,UAAI,cAAc,kCAAgC;AAChD,gBAAQ,aAAuC;AAC/C,aAAK,MAAM,MAAM;AACjB;AAAA,MACF;AAEA,aAAQ,cAA+B,KAAK;AAC5C;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,YAAYA,YAA+C;AAC/D,WAAO,IAAI,QAAQ,OAAO,SAAS,WAAW;AAC5C,YAAM,cAAc,MAAM,KAAK,SAAS,YAAYA,YAAW,IAAI,IAAI;AAGvE,UAAI,EAAE,UAAU,cAAc;AAC5B,gBAAQ,WAA6B;AACrC;AAAA,MACF;AAGA,WAAK,MAAM,KAAK;AAChB,YAAM,aAAa,MAAM,KAAK,SAAS,YAAYA,YAAW,IAAI,KAAK;AAEvE,UAAI,EAAE,UAAU,aAAa;AAC3B,gBAAQ,UAA4B;AAAA,MACtC,OAAO;AACL,eAAQ,WAA4B,KAAK;AAAA,MAC3C;AACA,WAAK,MAAM,MAAM;AAAA,IACnB,CAAC;AAAA,EACH;AACF;AAEA,IAAO,kBAAQ;","names":["typedData"]}
@@ -1,4 +1,5 @@
1
1
  declare const KEYCHAIN_URL = "https://x.cartridge.gg";
2
2
  declare const PROFILE_URL = "https://profile.cartridge.gg";
3
+ declare const API_URL = "https://api.cartridge.gg";
3
4
 
4
- export { KEYCHAIN_URL, PROFILE_URL };
5
+ export { API_URL, KEYCHAIN_URL, PROFILE_URL };
package/dist/constants.js CHANGED
@@ -1,7 +1,9 @@
1
1
  // src/constants.ts
2
2
  var KEYCHAIN_URL = "https://x.cartridge.gg";
3
3
  var PROFILE_URL = "https://profile.cartridge.gg";
4
+ var API_URL = "https://api.cartridge.gg";
4
5
  export {
6
+ API_URL,
5
7
  KEYCHAIN_URL,
6
8
  PROFILE_URL
7
9
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["export const KEYCHAIN_URL = \"https://x.cartridge.gg\";\nexport const PROFILE_URL = \"https://profile.cartridge.gg\";\n"],"mappings":";AAAO,IAAM,eAAe;AACrB,IAAM,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["export const KEYCHAIN_URL = \"https://x.cartridge.gg\";\nexport const PROFILE_URL = \"https://profile.cartridge.gg\";\nexport const API_URL = \"https://api.cartridge.gg\";\n"],"mappings":";AAAO,IAAM,eAAe;AACrB,IAAM,cAAc;AACpB,IAAM,UAAU;","names":[]}
@@ -1,6 +1,7 @@
1
- import { g as ControllerOptions, l as ProfileContextTypeVariant, P as Policy } from './types-ikHqoYmG.js';
1
+ import { g as ControllerOptions, l as ProfileContextTypeVariant } from './types-1WsOoNO2.js';
2
2
  import BaseProvider from './provider.js';
3
3
  import { WalletAccount } from 'starknet';
4
+ import { Policy } from '@cartridge/presets';
4
5
  import '@starknet-io/types-js';
5
6
  import '@cartridge/penpal';
6
7
 
@@ -2,6 +2,21 @@
2
2
  import {
3
3
  WalletAccount
4
4
  } from "starknet";
5
+
6
+ // src/utils.ts
7
+ import {
8
+ addAddressPadding,
9
+ CallData,
10
+ getChecksumAddress,
11
+ hash,
12
+ typedData,
13
+ TypedDataRevision
14
+ } from "starknet";
15
+ function toArray(val) {
16
+ return Array.isArray(val) ? val : [val];
17
+ }
18
+
19
+ // src/account.ts
5
20
  var ControllerAccount = class extends WalletAccount {
6
21
  constructor(provider, address, keychain, options, modal) {
7
22
  super({ nodeUrl: provider.rpc.toString() }, provider);
@@ -23,7 +38,7 @@ var ControllerAccount = class extends WalletAccount {
23
38
  * @returns response from addTransaction
24
39
  */
25
40
  async execute(calls) {
26
- calls = Array.isArray(calls) ? calls : [calls];
41
+ calls = toArray(calls);
27
42
  return new Promise(async (resolve, reject) => {
28
43
  const sessionExecute = await this.keychain.execute(
29
44
  calls,
@@ -64,15 +79,15 @@ var ControllerAccount = class extends WalletAccount {
64
79
  * @returns the signature of the JSON object
65
80
  * @throws {Error} if the JSON object is not a valid JSON
66
81
  */
67
- async signMessage(typedData) {
82
+ async signMessage(typedData2) {
68
83
  return new Promise(async (resolve, reject) => {
69
- const sessionSign = await this.keychain.signMessage(typedData, "", true);
84
+ const sessionSign = await this.keychain.signMessage(typedData2, "", true);
70
85
  if (!("code" in sessionSign)) {
71
86
  resolve(sessionSign);
72
87
  return;
73
88
  }
74
89
  this.modal.open();
75
- const manualSign = await this.keychain.signMessage(typedData, "", false);
90
+ const manualSign = await this.keychain.signMessage(typedData2, "", false);
76
91
  if (!("code" in manualSign)) {
77
92
  resolve(manualSign);
78
93
  } else {
@@ -86,175 +101,6 @@ var account_default = ControllerAccount;
86
101
 
87
102
  // src/iframe/base.ts
88
103
  import { connectToChild } from "@cartridge/penpal";
89
-
90
- // src/presets.ts
91
- var defaultPresets = {
92
- cartridge: {
93
- id: "cartridge",
94
- name: "Cartridge",
95
- icon: "/whitelabel/cartridge/icon.svg",
96
- cover: {
97
- light: "/whitelabel/cartridge/cover-light.png",
98
- dark: "/whitelabel/cartridge/cover-dark.png"
99
- }
100
- },
101
- "force-prime": {
102
- id: "force-prime",
103
- name: "Force Prime",
104
- icon: "/whitelabel/force-prime/icon.png",
105
- cover: "/whitelabel/force-prime/cover.png",
106
- colors: {
107
- primary: "#E1CC89"
108
- }
109
- },
110
- paved: {
111
- id: "paved",
112
- name: "Paved",
113
- icon: "/whitelabel/paved/icon.svg",
114
- cover: "/whitelabel/paved/cover.png",
115
- colors: {
116
- primary: "#B0CAF8"
117
- }
118
- },
119
- eternum: {
120
- id: "eternum",
121
- name: "Eternum",
122
- icon: "/whitelabel/eternum/icon.gif",
123
- cover: "/whitelabel/eternum/cover.png",
124
- colors: {
125
- primary: "#CE9822"
126
- }
127
- },
128
- pistols: {
129
- id: "pistols",
130
- name: "Pistols at Ten Blocks",
131
- icon: "/whitelabel/pistols/icon.png",
132
- cover: "/whitelabel/pistols/cover.png",
133
- colors: {
134
- primary: "#EF9758"
135
- }
136
- },
137
- pixelaw: {
138
- id: "pixelaw",
139
- name: "Pixelaw",
140
- icon: "/whitelabel/pixelaw/icon.svg",
141
- cover: "/whitelabel/pixelaw/cover.png",
142
- colors: {
143
- primary: "#7C00B1",
144
- primaryForeground: "white"
145
- }
146
- },
147
- "dope-wars": {
148
- id: "dope-wars",
149
- name: "Dope Wars",
150
- icon: "/whitelabel/dope-wars/icon.png",
151
- cover: "/whitelabel/dope-wars/cover.png",
152
- colors: {
153
- primary: "#11ED83"
154
- }
155
- },
156
- zkastle: {
157
- id: "zkastle",
158
- name: "zKastle",
159
- icon: "/whitelabel/zkastle/icon.svg",
160
- cover: "/whitelabel/zkastle/cover.png",
161
- colors: {
162
- primary: "#E50D2C"
163
- }
164
- },
165
- "loot-survivor": {
166
- id: "loot-survivor",
167
- name: "Loot Survivor",
168
- icon: "/whitelabel/loot-survivor/icon.png",
169
- cover: "/whitelabel/loot-survivor/cover.png",
170
- colors: {
171
- primary: "#33FF33"
172
- }
173
- },
174
- zktt: {
175
- id: "zktt",
176
- name: "zKTT",
177
- icon: "/whitelabel/zktt/icon.png",
178
- cover: "/whitelabel/zktt/cover.png",
179
- colors: {
180
- primary: "#FFFFFF"
181
- }
182
- },
183
- "tale-weaver": {
184
- id: "tale-weaver",
185
- name: "Tale Weaver",
186
- icon: "/whitelabel/tale-weaver/icon.png",
187
- cover: "/whitelabel/tale-weaver/cover.png",
188
- colors: {
189
- primary: "#fce377"
190
- }
191
- },
192
- "realm-of-ra": {
193
- id: "realm-of-ra",
194
- name: "Realm of Ra",
195
- icon: "/whitelabel/realm-of-ra/icon.png",
196
- cover: "/whitelabel/realm-of-ra/cover.png",
197
- colors: {
198
- primary: "#de9534"
199
- }
200
- },
201
- "jokers-of-neon": {
202
- id: "jokers-of-neon",
203
- name: "Jokers of Neon",
204
- icon: "/whitelabel/jokers-of-neon/icon.png",
205
- cover: "/whitelabel/jokers-of-neon/cover.png",
206
- colors: {
207
- primary: "#A144B2"
208
- }
209
- },
210
- flippyflop: {
211
- id: "flippyflop",
212
- name: "FlippyFlop",
213
- icon: "/whitelabel/flippyflop/icon.png",
214
- cover: "/whitelabel/flippyflop/cover.png",
215
- colors: {
216
- primary: "#F38332"
217
- }
218
- },
219
- "savage-summit": {
220
- id: "savage-summit",
221
- name: "Savage Summit",
222
- icon: "/whitelabel/savage-summit/icon.png",
223
- cover: "/whitelabel/savage-summit/cover.png",
224
- colors: {
225
- primary: "#fbf7da"
226
- }
227
- },
228
- "dark-shuffle": {
229
- id: "dark-shuffle",
230
- name: "Dark Shuffle",
231
- icon: "/whitelabel/dark-shuffle/icon.svg",
232
- cover: "/whitelabel/dark-shuffle/cover.png",
233
- colors: {
234
- primary: "#F59100"
235
- }
236
- },
237
- "blob-arena": {
238
- id: "blob-arena",
239
- name: "Blob Arena",
240
- icon: "/whitelabel/blob-arena/icon.png",
241
- cover: "/whitelabel/blob-arena/cover.png",
242
- colors: {
243
- primary: "#980f06"
244
- }
245
- },
246
- zkube: {
247
- id: "zkube",
248
- name: "zKube",
249
- icon: "/whitelabel/zkube/icon.png",
250
- cover: "/whitelabel/zkube/cover.png",
251
- colors: {
252
- primary: "#5bc3e6"
253
- }
254
- }
255
- };
256
-
257
- // src/iframe/base.ts
258
104
  var IFrame = class {
259
105
  constructor({
260
106
  id,
@@ -268,14 +114,9 @@ var IFrame = class {
268
114
  if (typeof document === "undefined") {
269
115
  return;
270
116
  }
271
- url.searchParams.set(
272
- "theme",
273
- encodeURIComponent(
274
- JSON.stringify(
275
- defaultPresets[theme ?? "cartridge"] ?? defaultPresets.cartridge
276
- )
277
- )
278
- );
117
+ if (theme) {
118
+ url.searchParams.set("theme", encodeURIComponent(theme));
119
+ }
279
120
  if (colorMode) {
280
121
  url.searchParams.set("colorMode", colorMode);
281
122
  }
@@ -400,9 +241,11 @@ var ProfileIFrame = class extends IFrame {
400
241
  }) {
401
242
  const _profileUrl = (profileUrl || PROFILE_URL).replace(/\/$/, "");
402
243
  const _url = new URL(
403
- slot ? namespace ? `${_profileUrl}/account/${username}/slot/${slot}?ns=${encodeURIComponent(
404
- namespace
405
- )}` : `${_profileUrl}/account/${username}/slot/${slot}` : `${_profileUrl}/account/${username}`
244
+ slot ? namespace ? `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(
245
+ slot
246
+ )}&ns=${encodeURIComponent(namespace)}` : `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(
247
+ slot
248
+ )}` : `${_profileUrl}/account/${username}`
406
249
  );
407
250
  _url.searchParams.set("rpcUrl", encodeURIComponent(rpcUrl));
408
251
  if (tokens?.erc20) {