@cartridge/controller 0.5.7 → 0.5.8
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/.turbo/turbo-build$colon$deps.log +29 -29
- package/.turbo/turbo-build.log +32 -32
- package/dist/account.d.ts +2 -2
- package/dist/account.js +2 -2
- package/dist/account.js.map +1 -1
- package/dist/controller.d.ts +7 -2
- package/dist/controller.js +90 -29
- package/dist/controller.js.map +1 -1
- package/dist/iframe/base.d.ts +1 -1
- package/dist/iframe/index.d.ts +1 -1
- package/dist/iframe/keychain.d.ts +1 -1
- package/dist/iframe/profile.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +107 -30
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts +5 -6
- package/dist/provider.js +24 -19
- package/dist/provider.js.map +1 -1
- package/dist/session/account.d.ts +1 -1
- package/dist/session/account.js.map +1 -1
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js +34 -22
- package/dist/session/index.js.map +1 -1
- package/dist/session/provider.d.ts +4 -3
- package/dist/session/provider.js +34 -22
- package/dist/session/provider.js.map +1 -1
- package/dist/telegram/provider.d.ts +4 -3
- package/dist/telegram/provider.js +34 -24
- package/dist/telegram/provider.js.map +1 -1
- package/dist/{types-BReKRAuh.d.ts → types-CVnDQVqD.d.ts} +10 -11
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
- package/src/account.ts +2 -1
- package/src/controller.ts +84 -9
- package/src/provider.ts +37 -23
- package/src/session/provider.ts +14 -4
- package/src/telegram/provider.ts +14 -5
- package/src/types.ts +11 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @cartridge/controller@0.5.
|
|
2
|
+
> @cartridge/controller@0.5.8 build:deps /home/runner/work/controller/controller/packages/controller
|
|
3
3
|
> tsup --dts-resolve
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m 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
|
|
@@ -14,42 +14,42 @@
|
|
|
14
14
|
[32mESM[39m [1mdist/session/account.js [22m[32m2.25 KB[39m
|
|
15
15
|
[32mESM[39m [1mdist/telegram/backend.js [22m[32m1.27 KB[39m
|
|
16
16
|
[32mESM[39m [1mdist/constants.js [22m[32m247.00 B[39m
|
|
17
|
-
[32mESM[39m [1mdist/controller.js [22m[
|
|
17
|
+
[32mESM[39m [1mdist/controller.js [22m[32m36.30 KB[39m
|
|
18
18
|
[32mESM[39m [1mdist/errors.js [22m[32m271.00 B[39m
|
|
19
19
|
[32mESM[39m [1mdist/icon.js [22m[32m15.15 KB[39m
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m260.41 KB[39m
|
|
20
21
|
[32mESM[39m [1mdist/lookup.js [22m[32m1.59 KB[39m
|
|
21
|
-
[32mESM[39m [1mdist/provider.js [22m[32m20.
|
|
22
|
-
[32mESM[39m [1mdist/types.js [22m[32m437.00 B[39m
|
|
22
|
+
[32mESM[39m [1mdist/provider.js [22m[32m20.52 KB[39m
|
|
23
23
|
[32mESM[39m [1mdist/utils.js [22m[32m2.77 KB[39m
|
|
24
|
+
[32mESM[39m [1mdist/types.js [22m[32m437.00 B[39m
|
|
24
25
|
[32mESM[39m [1mdist/iframe/index.js [22m[32m5.16 KB[39m
|
|
25
|
-
[32mESM[39m [1mdist/index.js [22m[32m257.85 KB[39m
|
|
26
26
|
[32mESM[39m [1mdist/iframe/keychain.js [22m[32m4.12 KB[39m
|
|
27
27
|
[32mESM[39m [1mdist/iframe/profile.js [22m[32m4.69 KB[39m
|
|
28
28
|
[32mESM[39m [1mdist/session/backend.js [22m[32m1.18 KB[39m
|
|
29
|
-
[32mESM[39m [1mdist/session/index.js [22m[32m26.
|
|
30
|
-
[32mESM[39m [1mdist/session/provider.js [22m[32m25.
|
|
31
|
-
[32mESM[39m [1mdist/telegram/provider.js [22m[32m25.
|
|
32
|
-
[32mESM[39m [1mdist/account.js.map [22m[32m8.
|
|
29
|
+
[32mESM[39m [1mdist/session/index.js [22m[32m26.51 KB[39m
|
|
30
|
+
[32mESM[39m [1mdist/session/provider.js [22m[32m25.91 KB[39m
|
|
31
|
+
[32mESM[39m [1mdist/telegram/provider.js [22m[32m25.46 KB[39m
|
|
32
|
+
[32mESM[39m [1mdist/account.js.map [22m[32m8.81 KB[39m
|
|
33
33
|
[32mESM[39m [1mdist/iframe/base.js.map [22m[32m7.08 KB[39m
|
|
34
34
|
[32mESM[39m [1mdist/session/account.js.map [22m[32m11.19 KB[39m
|
|
35
35
|
[32mESM[39m [1mdist/telegram/backend.js.map [22m[32m1.98 KB[39m
|
|
36
36
|
[32mESM[39m [1mdist/constants.js.map [22m[32m315.00 B[39m
|
|
37
|
-
[32mESM[39m [1mdist/controller.js.map [22m[
|
|
37
|
+
[32mESM[39m [1mdist/controller.js.map [22m[32m60.04 KB[39m
|
|
38
38
|
[32mESM[39m [1mdist/errors.js.map [22m[32m385.00 B[39m
|
|
39
|
-
[32mESM[39m [1mdist/
|
|
39
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m393.35 KB[39m
|
|
40
40
|
[32mESM[39m [1mdist/lookup.js.map [22m[32m3.49 KB[39m
|
|
41
|
-
[32mESM[39m [1mdist/provider.js.map [22m[32m24.59 KB[39m
|
|
42
|
-
[32mESM[39m [1mdist/types.js.map [22m[32m4.75 KB[39m
|
|
43
41
|
[32mESM[39m [1mdist/utils.js.map [22m[32m5.65 KB[39m
|
|
42
|
+
[32mESM[39m [1mdist/types.js.map [22m[32m4.75 KB[39m
|
|
43
|
+
[32mESM[39m [1mdist/provider.js.map [22m[32m25.41 KB[39m
|
|
44
44
|
[32mESM[39m [1mdist/iframe/index.js.map [22m[32m10.47 KB[39m
|
|
45
45
|
[32mESM[39m [1mdist/iframe/keychain.js.map [22m[32m8.27 KB[39m
|
|
46
|
-
[32mESM[39m [1mdist/iframe/profile.js.map [22m[32m9.47 KB[39m
|
|
47
46
|
[32mESM[39m [1mdist/session/backend.js.map [22m[32m2.88 KB[39m
|
|
48
|
-
[32mESM[39m [1mdist/
|
|
49
|
-
[32mESM[39m [1mdist/session/
|
|
50
|
-
[32mESM[39m [1mdist/
|
|
51
|
-
[32mESM[39m [1mdist/
|
|
52
|
-
[32mESM[39m
|
|
47
|
+
[32mESM[39m [1mdist/iframe/profile.js.map [22m[32m9.47 KB[39m
|
|
48
|
+
[32mESM[39m [1mdist/session/index.js.map [22m[32m43.61 KB[39m
|
|
49
|
+
[32mESM[39m [1mdist/session/provider.js.map [22m[32m38.61 KB[39m
|
|
50
|
+
[32mESM[39m [1mdist/icon.js.map [22m[32m15.20 KB[39m
|
|
51
|
+
[32mESM[39m [1mdist/telegram/provider.js.map [22m[32m37.76 KB[39m
|
|
52
|
+
[32mESM[39m ⚡️ Build success in 123ms
|
|
53
53
|
[34mDTS[39m Build start
|
|
54
54
|
../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
|
|
55
55
|
|
|
@@ -93,26 +93,26 @@
|
|
|
93
93
|
|
|
94
94
|
../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
|
|
95
95
|
|
|
96
|
-
[32mDTS[39m ⚡️ Build success in
|
|
97
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.
|
|
98
|
-
[32mDTS[39m [1mdist/session/index.d.ts [22m[
|
|
99
|
-
[32mDTS[39m [1mdist/account.d.ts [22m[32m1.
|
|
96
|
+
[32mDTS[39m ⚡️ Build success in 8227ms
|
|
97
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.28 KB[39m
|
|
98
|
+
[32mDTS[39m [1mdist/session/index.d.ts [22m[32m737.00 B[39m
|
|
99
|
+
[32mDTS[39m [1mdist/account.d.ts [22m[32m1.64 KB[39m
|
|
100
100
|
[32mDTS[39m [1mdist/constants.d.ts [22m[32m215.00 B[39m
|
|
101
101
|
[32mDTS[39m [1mdist/icon.d.ts [22m[32m15.11 KB[39m
|
|
102
|
-
[32mDTS[39m [1mdist/controller.d.ts [22m[32m1.
|
|
102
|
+
[32mDTS[39m [1mdist/controller.d.ts [22m[32m1.34 KB[39m
|
|
103
103
|
[32mDTS[39m [1mdist/lookup.d.ts [22m[32m216.00 B[39m
|
|
104
104
|
[32mDTS[39m [1mdist/utils.d.ts [22m[32m725.00 B[39m
|
|
105
105
|
[32mDTS[39m [1mdist/session/account.d.ts [22m[32m1.83 KB[39m
|
|
106
106
|
[32mDTS[39m [1mdist/errors.d.ts [22m[32m100.00 B[39m
|
|
107
|
-
[32mDTS[39m [1mdist/session/provider.d.ts [22m[
|
|
107
|
+
[32mDTS[39m [1mdist/session/provider.d.ts [22m[32m1.10 KB[39m
|
|
108
108
|
[32mDTS[39m [1mdist/telegram/backend.d.ts [22m[32m1.28 KB[39m
|
|
109
109
|
[32mDTS[39m [1mdist/session/backend.d.ts [22m[32m2.29 KB[39m
|
|
110
|
-
[32mDTS[39m [1mdist/telegram/provider.d.ts [22m[
|
|
111
|
-
[32mDTS[39m [1mdist/provider.d.ts [22m[
|
|
110
|
+
[32mDTS[39m [1mdist/telegram/provider.d.ts [22m[32m975.00 B[39m
|
|
111
|
+
[32mDTS[39m [1mdist/provider.d.ts [22m[32m897.00 B[39m
|
|
112
112
|
[32mDTS[39m [1mdist/iframe/base.d.ts [22m[32m184.00 B[39m
|
|
113
113
|
[32mDTS[39m [1mdist/iframe/keychain.d.ts [22m[32m172.00 B[39m
|
|
114
114
|
[32mDTS[39m [1mdist/iframe/profile.d.ts [22m[32m198.00 B[39m
|
|
115
115
|
[32mDTS[39m [1mdist/iframe/index.d.ts [22m[32m252.00 B[39m
|
|
116
|
-
[32mDTS[39m [1mdist/types.d.ts [22m[
|
|
116
|
+
[32mDTS[39m [1mdist/types.d.ts [22m[32m603.00 B[39m
|
|
117
117
|
[32mDTS[39m [1mdist/index.d-BbTUPBeO.d.ts [22m[32m2.15 KB[39m
|
|
118
|
-
[32mDTS[39m [1mdist/types-
|
|
118
|
+
[32mDTS[39m [1mdist/types-CVnDQVqD.d.ts [22m[32m6.21 KB[39m
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
> @cartridge/controller@0.5.
|
|
2
|
+
> @cartridge/controller@0.5.8 build /home/runner/work/controller/controller/packages/controller
|
|
3
3
|
> pnpm build:deps
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @cartridge/controller@0.5.
|
|
6
|
+
> @cartridge/controller@0.5.8 build:deps /home/runner/work/controller/controller/packages/controller
|
|
7
7
|
> tsup --dts-resolve
|
|
8
8
|
|
|
9
|
-
[34mCLI[39m 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/
|
|
9
|
+
[34mCLI[39m 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/telegram/backend.ts, src/telegram/provider.ts, src/session/account.ts, src/session/backend.ts, src/session/index.ts, src/session/provider.ts
|
|
10
10
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
11
11
|
[34mCLI[39m tsup v8.3.0
|
|
12
12
|
[34mCLI[39m Using tsup config: /home/runner/work/controller/controller/packages/controller/package.json
|
|
@@ -15,45 +15,45 @@
|
|
|
15
15
|
[34mESM[39m Build start
|
|
16
16
|
[32mESM[39m [1mdist/account.js [22m[32m2.81 KB[39m
|
|
17
17
|
[32mESM[39m [1mdist/constants.js [22m[32m247.00 B[39m
|
|
18
|
-
[32mESM[39m [1mdist/controller.js [22m[
|
|
18
|
+
[32mESM[39m [1mdist/controller.js [22m[32m36.30 KB[39m
|
|
19
19
|
[32mESM[39m [1mdist/errors.js [22m[32m271.00 B[39m
|
|
20
20
|
[32mESM[39m [1mdist/icon.js [22m[32m15.15 KB[39m
|
|
21
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
21
|
+
[32mESM[39m [1mdist/index.js [22m[32m260.41 KB[39m
|
|
22
22
|
[32mESM[39m [1mdist/lookup.js [22m[32m1.59 KB[39m
|
|
23
|
-
[32mESM[39m [1mdist/provider.js [22m[32m20.
|
|
23
|
+
[32mESM[39m [1mdist/provider.js [22m[32m20.52 KB[39m
|
|
24
24
|
[32mESM[39m [1mdist/types.js [22m[32m437.00 B[39m
|
|
25
25
|
[32mESM[39m [1mdist/utils.js [22m[32m2.77 KB[39m
|
|
26
26
|
[32mESM[39m [1mdist/iframe/base.js [22m[32m3.64 KB[39m
|
|
27
27
|
[32mESM[39m [1mdist/iframe/index.js [22m[32m5.16 KB[39m
|
|
28
28
|
[32mESM[39m [1mdist/iframe/keychain.js [22m[32m4.12 KB[39m
|
|
29
29
|
[32mESM[39m [1mdist/iframe/profile.js [22m[32m4.69 KB[39m
|
|
30
|
+
[32mESM[39m [1mdist/telegram/backend.js [22m[32m1.27 KB[39m
|
|
31
|
+
[32mESM[39m [1mdist/telegram/provider.js [22m[32m25.46 KB[39m
|
|
30
32
|
[32mESM[39m [1mdist/session/account.js [22m[32m2.25 KB[39m
|
|
31
33
|
[32mESM[39m [1mdist/session/backend.js [22m[32m1.18 KB[39m
|
|
32
|
-
[32mESM[39m [1mdist/session/index.js [22m[32m26.
|
|
33
|
-
[32mESM[39m [1mdist/session/provider.js [22m[32m25.
|
|
34
|
-
[32mESM[39m [1mdist/
|
|
35
|
-
[32mESM[39m [1mdist/telegram/provider.js [22m[32m25.09 KB[39m
|
|
36
|
-
[32mESM[39m [1mdist/account.js.map [22m[32m8.82 KB[39m
|
|
34
|
+
[32mESM[39m [1mdist/session/index.js [22m[32m26.51 KB[39m
|
|
35
|
+
[32mESM[39m [1mdist/session/provider.js [22m[32m25.91 KB[39m
|
|
36
|
+
[32mESM[39m [1mdist/account.js.map [22m[32m8.81 KB[39m
|
|
37
37
|
[32mESM[39m [1mdist/constants.js.map [22m[32m315.00 B[39m
|
|
38
|
-
[32mESM[39m [1mdist/controller.js.map [22m[
|
|
38
|
+
[32mESM[39m [1mdist/controller.js.map [22m[32m60.04 KB[39m
|
|
39
39
|
[32mESM[39m [1mdist/errors.js.map [22m[32m385.00 B[39m
|
|
40
40
|
[32mESM[39m [1mdist/icon.js.map [22m[32m15.20 KB[39m
|
|
41
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m393.35 KB[39m
|
|
41
42
|
[32mESM[39m [1mdist/lookup.js.map [22m[32m3.49 KB[39m
|
|
42
|
-
[32mESM[39m [1mdist/
|
|
43
|
-
[32mESM[39m [1mdist/provider.js.map [22m[32m24.59 KB[39m
|
|
43
|
+
[32mESM[39m [1mdist/provider.js.map [22m[32m25.41 KB[39m
|
|
44
44
|
[32mESM[39m [1mdist/types.js.map [22m[32m4.75 KB[39m
|
|
45
45
|
[32mESM[39m [1mdist/utils.js.map [22m[32m5.65 KB[39m
|
|
46
46
|
[32mESM[39m [1mdist/iframe/base.js.map [22m[32m7.08 KB[39m
|
|
47
47
|
[32mESM[39m [1mdist/iframe/index.js.map [22m[32m10.47 KB[39m
|
|
48
48
|
[32mESM[39m [1mdist/iframe/keychain.js.map [22m[32m8.27 KB[39m
|
|
49
49
|
[32mESM[39m [1mdist/iframe/profile.js.map [22m[32m9.47 KB[39m
|
|
50
|
-
[32mESM[39m [1mdist/session/account.js.map [22m[32m11.19 KB[39m
|
|
51
|
-
[32mESM[39m [1mdist/session/backend.js.map [22m[32m2.88 KB[39m
|
|
52
|
-
[32mESM[39m [1mdist/session/index.js.map [22m[32m42.29 KB[39m
|
|
53
|
-
[32mESM[39m [1mdist/session/provider.js.map [22m[32m37.29 KB[39m
|
|
54
50
|
[32mESM[39m [1mdist/telegram/backend.js.map [22m[32m1.98 KB[39m
|
|
55
|
-
[32mESM[39m [1mdist/telegram/provider.js.map [22m[
|
|
56
|
-
[32mESM[39m
|
|
51
|
+
[32mESM[39m [1mdist/telegram/provider.js.map [22m[32m37.76 KB[39m
|
|
52
|
+
[32mESM[39m [1mdist/session/backend.js.map [22m[32m2.88 KB[39m
|
|
53
|
+
[32mESM[39m [1mdist/session/index.js.map [22m[32m43.61 KB[39m
|
|
54
|
+
[32mESM[39m [1mdist/session/provider.js.map [22m[32m38.61 KB[39m
|
|
55
|
+
[32mESM[39m [1mdist/session/account.js.map [22m[32m11.19 KB[39m
|
|
56
|
+
[32mESM[39m ⚡️ Build success in 172ms
|
|
57
57
|
[34mDTS[39m Build start
|
|
58
58
|
../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
|
|
59
59
|
|
|
@@ -97,26 +97,26 @@
|
|
|
97
97
|
|
|
98
98
|
../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
|
|
99
99
|
|
|
100
|
-
[32mDTS[39m ⚡️ Build success in
|
|
101
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.
|
|
102
|
-
[32mDTS[39m [1mdist/session/index.d.ts [22m[
|
|
103
|
-
[32mDTS[39m [1mdist/account.d.ts [22m[32m1.
|
|
100
|
+
[32mDTS[39m ⚡️ Build success in 8188ms
|
|
101
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.28 KB[39m
|
|
102
|
+
[32mDTS[39m [1mdist/session/index.d.ts [22m[32m737.00 B[39m
|
|
103
|
+
[32mDTS[39m [1mdist/account.d.ts [22m[32m1.64 KB[39m
|
|
104
104
|
[32mDTS[39m [1mdist/constants.d.ts [22m[32m215.00 B[39m
|
|
105
105
|
[32mDTS[39m [1mdist/icon.d.ts [22m[32m15.11 KB[39m
|
|
106
|
-
[32mDTS[39m [1mdist/controller.d.ts [22m[32m1.
|
|
106
|
+
[32mDTS[39m [1mdist/controller.d.ts [22m[32m1.34 KB[39m
|
|
107
107
|
[32mDTS[39m [1mdist/lookup.d.ts [22m[32m216.00 B[39m
|
|
108
108
|
[32mDTS[39m [1mdist/utils.d.ts [22m[32m725.00 B[39m
|
|
109
|
-
[32mDTS[39m [1mdist/session/account.d.ts [22m[32m1.83 KB[39m
|
|
110
|
-
[32mDTS[39m [1mdist/errors.d.ts [22m[32m100.00 B[39m
|
|
111
|
-
[32mDTS[39m [1mdist/session/provider.d.ts [22m[32m980.00 B[39m
|
|
112
109
|
[32mDTS[39m [1mdist/telegram/backend.d.ts [22m[32m1.28 KB[39m
|
|
110
|
+
[32mDTS[39m [1mdist/telegram/provider.d.ts [22m[32m975.00 B[39m
|
|
111
|
+
[32mDTS[39m [1mdist/session/account.d.ts [22m[32m1.83 KB[39m
|
|
113
112
|
[32mDTS[39m [1mdist/session/backend.d.ts [22m[32m2.29 KB[39m
|
|
114
|
-
[32mDTS[39m [1mdist/
|
|
115
|
-
[32mDTS[39m [1mdist/provider.d.ts
|
|
113
|
+
[32mDTS[39m [1mdist/errors.d.ts [22m[32m100.00 B[39m
|
|
114
|
+
[32mDTS[39m [1mdist/session/provider.d.ts [22m[32m1.10 KB[39m
|
|
115
|
+
[32mDTS[39m [1mdist/provider.d.ts [22m[32m897.00 B[39m
|
|
116
116
|
[32mDTS[39m [1mdist/iframe/base.d.ts [22m[32m184.00 B[39m
|
|
117
117
|
[32mDTS[39m [1mdist/iframe/keychain.d.ts [22m[32m172.00 B[39m
|
|
118
118
|
[32mDTS[39m [1mdist/iframe/profile.d.ts [22m[32m198.00 B[39m
|
|
119
119
|
[32mDTS[39m [1mdist/iframe/index.d.ts [22m[32m252.00 B[39m
|
|
120
|
-
[32mDTS[39m [1mdist/types.d.ts [22m[
|
|
120
|
+
[32mDTS[39m [1mdist/types.d.ts [22m[32m603.00 B[39m
|
|
121
121
|
[32mDTS[39m [1mdist/index.d-BbTUPBeO.d.ts [22m[32m2.15 KB[39m
|
|
122
|
-
[32mDTS[39m [1mdist/types-
|
|
122
|
+
[32mDTS[39m [1mdist/types-CVnDQVqD.d.ts [22m[32m6.21 KB[39m
|
package/dist/account.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletAccount, AllowArray, Call, InvokeFunctionResponse, TypedData } from 'starknet';
|
|
2
2
|
import { SPEC } from '@starknet-io/types-js';
|
|
3
|
-
import { K as Keychain,
|
|
3
|
+
import { K as Keychain, k as KeychainOptions, M as Modal } from './types-CVnDQVqD.js';
|
|
4
4
|
import { AsyncMethodReturns } from '@cartridge/penpal';
|
|
5
5
|
import BaseProvider from './provider.js';
|
|
6
6
|
import './index.d-BbTUPBeO.js';
|
|
@@ -10,7 +10,7 @@ declare class ControllerAccount extends WalletAccount {
|
|
|
10
10
|
private keychain;
|
|
11
11
|
private modal;
|
|
12
12
|
private options?;
|
|
13
|
-
constructor(provider: BaseProvider, address: string, keychain: AsyncMethodReturns<Keychain>, options: KeychainOptions, modal: Modal);
|
|
13
|
+
constructor(provider: BaseProvider, rpcUrl: string, address: string, keychain: AsyncMethodReturns<Keychain>, options: KeychainOptions, modal: Modal);
|
|
14
14
|
/**
|
|
15
15
|
* Invoke execute function in account contract
|
|
16
16
|
*
|
package/dist/account.js
CHANGED
|
@@ -18,8 +18,8 @@ function toArray(val) {
|
|
|
18
18
|
|
|
19
19
|
// src/account.ts
|
|
20
20
|
var ControllerAccount = class extends WalletAccount {
|
|
21
|
-
constructor(provider, address, keychain, options, modal) {
|
|
22
|
-
super({ nodeUrl:
|
|
21
|
+
constructor(provider, rpcUrl, address, keychain, options, modal) {
|
|
22
|
+
super({ nodeUrl: rpcUrl }, provider);
|
|
23
23
|
this.address = address;
|
|
24
24
|
this.keychain = keychain;
|
|
25
25
|
this.options = options;
|
package/dist/account.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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:
|
|
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 rpcUrl: string,\n address: string,\n keychain: AsyncMethodReturns<Keychain>,\n options: KeychainOptions,\n modal: Modal,\n ) {\n super({ nodeUrl: rpcUrl }, 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\nexport function 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,QACA,SACA,UACA,SACA,OACA;AACA,UAAM,EAAE,SAAS,OAAO,GAAG,QAAQ;AAEnC,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"]}
|
package/dist/controller.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { g as ControllerOptions,
|
|
1
|
+
import { g as ControllerOptions, m as ProfileContextTypeVariant } from './types-CVnDQVqD.js';
|
|
2
2
|
import BaseProvider from './provider.js';
|
|
3
3
|
import { WalletAccount } from 'starknet';
|
|
4
4
|
import { i as Policy } from './index.d-BbTUPBeO.js';
|
|
5
|
-
import '@starknet-io/types-js';
|
|
5
|
+
import { AddStarknetChainParameters } from '@starknet-io/types-js';
|
|
6
6
|
import '@cartridge/penpal';
|
|
7
7
|
|
|
8
8
|
declare class ControllerProvider extends BaseProvider {
|
|
@@ -10,13 +10,18 @@ declare class ControllerProvider extends BaseProvider {
|
|
|
10
10
|
private profile?;
|
|
11
11
|
private options;
|
|
12
12
|
private iframes;
|
|
13
|
+
private selectedChain;
|
|
14
|
+
private chains;
|
|
13
15
|
constructor(options: ControllerOptions);
|
|
14
16
|
probe(): Promise<WalletAccount | undefined>;
|
|
15
17
|
connect(): Promise<WalletAccount | undefined>;
|
|
18
|
+
switchStarknetChain(chainId: string): Promise<boolean>;
|
|
19
|
+
addStarknetChain(_chain: AddStarknetChainParameters): Promise<boolean>;
|
|
16
20
|
disconnect(): Promise<void>;
|
|
17
21
|
openProfile(tab?: ProfileContextTypeVariant): Promise<void>;
|
|
18
22
|
openSettings(): Promise<boolean | null>;
|
|
19
23
|
revoke(origin: string, _policy: Policy[]): Promise<void> | null;
|
|
24
|
+
rpcUrl(): string;
|
|
20
25
|
username(): Promise<string> | undefined;
|
|
21
26
|
fetchControllers(contractAddresses: string[]): Promise<Record<string, string>>;
|
|
22
27
|
openPurchaseCredits(): void;
|
package/dist/controller.js
CHANGED
|
@@ -18,8 +18,8 @@ function toArray(val) {
|
|
|
18
18
|
|
|
19
19
|
// src/account.ts
|
|
20
20
|
var ControllerAccount = class extends WalletAccount {
|
|
21
|
-
constructor(provider, address, keychain, options, modal) {
|
|
22
|
-
super({ nodeUrl:
|
|
21
|
+
constructor(provider, rpcUrl, address, keychain, options, modal) {
|
|
22
|
+
super({ nodeUrl: rpcUrl }, provider);
|
|
23
23
|
this.address = address;
|
|
24
24
|
this.keychain = keychain;
|
|
25
25
|
this.options = options;
|
|
@@ -294,7 +294,7 @@ import {
|
|
|
294
294
|
// package.json
|
|
295
295
|
var package_default = {
|
|
296
296
|
name: "@cartridge/controller",
|
|
297
|
-
version: "0.5.
|
|
297
|
+
version: "0.5.8",
|
|
298
298
|
description: "Cartridge Controller",
|
|
299
299
|
module: "dist/index.js",
|
|
300
300
|
types: "dist/index.d.ts",
|
|
@@ -346,7 +346,7 @@ var icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AA
|
|
|
346
346
|
|
|
347
347
|
// src/provider.ts
|
|
348
348
|
var BaseProvider = class {
|
|
349
|
-
constructor(
|
|
349
|
+
constructor() {
|
|
350
350
|
this.id = "controller";
|
|
351
351
|
this.name = "Controller";
|
|
352
352
|
this.version = package_default.version;
|
|
@@ -364,8 +364,9 @@ var BaseProvider = class {
|
|
|
364
364
|
if (this.account) {
|
|
365
365
|
return [this.account.address];
|
|
366
366
|
}
|
|
367
|
+
const silentMode = call.params && call.params.silent_mode;
|
|
367
368
|
this.account = await this.probe();
|
|
368
|
-
if (!this.account) {
|
|
369
|
+
if (!this.account && !silentMode) {
|
|
369
370
|
this.account = await this.connect();
|
|
370
371
|
}
|
|
371
372
|
if (this.account) {
|
|
@@ -379,24 +380,20 @@ var BaseProvider = class {
|
|
|
379
380
|
message: "An unexpected error occurred",
|
|
380
381
|
data: "wallet_watchAsset not implemented"
|
|
381
382
|
};
|
|
382
|
-
case "wallet_addStarknetChain":
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
code: 63,
|
|
391
|
-
message: "An unexpected error occurred",
|
|
392
|
-
data: "wallet_switchStarknetChain not implemented"
|
|
393
|
-
};
|
|
383
|
+
case "wallet_addStarknetChain": {
|
|
384
|
+
let params2 = call.params;
|
|
385
|
+
return this.addStarknetChain(params2);
|
|
386
|
+
}
|
|
387
|
+
case "wallet_switchStarknetChain": {
|
|
388
|
+
let params2 = call.params;
|
|
389
|
+
return this.switchStarknetChain(params2.chainId);
|
|
390
|
+
}
|
|
394
391
|
case "wallet_requestChainId":
|
|
395
392
|
if (!this.account) {
|
|
396
393
|
throw {
|
|
397
394
|
code: 63,
|
|
398
395
|
message: "An unexpected error occurred",
|
|
399
|
-
data: "
|
|
396
|
+
data: "Account not initialized"
|
|
400
397
|
};
|
|
401
398
|
}
|
|
402
399
|
return await this.account.getChainId();
|
|
@@ -411,7 +408,7 @@ var BaseProvider = class {
|
|
|
411
408
|
throw {
|
|
412
409
|
code: 63,
|
|
413
410
|
message: "An unexpected error occurred",
|
|
414
|
-
data: "
|
|
411
|
+
data: "Account not initialized"
|
|
415
412
|
};
|
|
416
413
|
}
|
|
417
414
|
let params = call.params;
|
|
@@ -467,16 +464,60 @@ var BaseProvider = class {
|
|
|
467
464
|
this.subscriptions.splice(idx, 1);
|
|
468
465
|
}
|
|
469
466
|
};
|
|
470
|
-
|
|
471
|
-
|
|
467
|
+
}
|
|
468
|
+
emitNetworkChanged(chainId) {
|
|
469
|
+
this.subscriptions.filter((sub) => sub.type === "networkChanged").forEach((sub) => {
|
|
470
|
+
sub.handler(chainId);
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
emitAccountsChanged(accounts) {
|
|
474
|
+
this.subscriptions.filter((sub) => sub.type === "accountsChanged").forEach((sub) => {
|
|
475
|
+
sub.handler(accounts);
|
|
476
|
+
});
|
|
472
477
|
}
|
|
473
478
|
};
|
|
474
479
|
|
|
475
480
|
// src/controller.ts
|
|
481
|
+
import { constants } from "starknet";
|
|
476
482
|
var ControllerProvider = class extends BaseProvider {
|
|
477
483
|
constructor(options) {
|
|
478
|
-
|
|
479
|
-
|
|
484
|
+
super();
|
|
485
|
+
const chains = /* @__PURE__ */ new Map();
|
|
486
|
+
for (const chain of options.chains) {
|
|
487
|
+
let chainId;
|
|
488
|
+
const url = new URL(chain.rpcUrl);
|
|
489
|
+
const parts = url.pathname.split("/");
|
|
490
|
+
if (parts.includes("starknet")) {
|
|
491
|
+
if (parts.includes("mainnet")) {
|
|
492
|
+
chainId = constants.StarknetChainId.SN_MAIN;
|
|
493
|
+
} else if (parts.includes("sepolia")) {
|
|
494
|
+
chainId = constants.StarknetChainId.SN_SEPOLIA;
|
|
495
|
+
}
|
|
496
|
+
} else if (parts.length >= 3) {
|
|
497
|
+
const projectName = parts[2];
|
|
498
|
+
if (parts.includes("katana")) {
|
|
499
|
+
chainId = `WP_${projectName.toUpperCase()}`;
|
|
500
|
+
} else if (parts.includes("mainnet")) {
|
|
501
|
+
chainId = `GG_${projectName.toUpperCase()}`;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
if (!chainId) {
|
|
505
|
+
throw new Error(`Chain ${chain.rpcUrl} not supported`);
|
|
506
|
+
}
|
|
507
|
+
chains.set(chainId, chain);
|
|
508
|
+
}
|
|
509
|
+
if (options.policies?.messages?.length && options.policies.messages.length !== chains.size) {
|
|
510
|
+
console.warn(
|
|
511
|
+
"Each message policy is associated with a specific chain. The number of message policies does not match the number of chains specified - session message signing may not work on some chains."
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
this.chains = chains;
|
|
515
|
+
this.selectedChain = options.defaultChainId;
|
|
516
|
+
if (!this.chains.has(this.selectedChain)) {
|
|
517
|
+
throw new Error(
|
|
518
|
+
`Chain ${this.selectedChain} not found in configured chains`
|
|
519
|
+
);
|
|
520
|
+
}
|
|
480
521
|
this.iframes = {
|
|
481
522
|
keychain: new KeychainIFrame({
|
|
482
523
|
...options,
|
|
@@ -498,11 +539,10 @@ var ControllerProvider = class extends BaseProvider {
|
|
|
498
539
|
console.error(new NotReadyToConnect().message);
|
|
499
540
|
return;
|
|
500
541
|
}
|
|
501
|
-
const response = await this.keychain.probe(
|
|
502
|
-
this.rpc.toString()
|
|
503
|
-
);
|
|
542
|
+
const response = await this.keychain.probe(this.rpcUrl());
|
|
504
543
|
this.account = new account_default(
|
|
505
544
|
this,
|
|
545
|
+
this.rpcUrl(),
|
|
506
546
|
response.address,
|
|
507
547
|
this.keychain,
|
|
508
548
|
this.options,
|
|
@@ -524,7 +564,7 @@ var ControllerProvider = class extends BaseProvider {
|
|
|
524
564
|
openPurchaseCredits: () => this.openPurchaseCredits.bind(this),
|
|
525
565
|
openExecute: () => this.openExecute.bind(this)
|
|
526
566
|
},
|
|
527
|
-
rpcUrl: this.
|
|
567
|
+
rpcUrl: this.rpcUrl(),
|
|
528
568
|
username,
|
|
529
569
|
version: this.version
|
|
530
570
|
});
|
|
@@ -548,8 +588,8 @@ var ControllerProvider = class extends BaseProvider {
|
|
|
548
588
|
this.iframes.keychain.open();
|
|
549
589
|
try {
|
|
550
590
|
let response = await this.keychain.connect(
|
|
551
|
-
this.options.policies ||
|
|
552
|
-
this.
|
|
591
|
+
this.options.policies || {},
|
|
592
|
+
this.rpcUrl()
|
|
553
593
|
);
|
|
554
594
|
if (response.code !== "SUCCESS" /* SUCCESS */) {
|
|
555
595
|
throw new Error(response.message);
|
|
@@ -557,6 +597,7 @@ var ControllerProvider = class extends BaseProvider {
|
|
|
557
597
|
response = response;
|
|
558
598
|
this.account = new account_default(
|
|
559
599
|
this,
|
|
600
|
+
this.rpcUrl(),
|
|
560
601
|
response.address,
|
|
561
602
|
this.keychain,
|
|
562
603
|
this.options,
|
|
@@ -569,6 +610,23 @@ var ControllerProvider = class extends BaseProvider {
|
|
|
569
610
|
this.iframes.keychain.close();
|
|
570
611
|
}
|
|
571
612
|
}
|
|
613
|
+
async switchStarknetChain(chainId) {
|
|
614
|
+
try {
|
|
615
|
+
this.selectedChain = chainId;
|
|
616
|
+
this.account = await this.probe();
|
|
617
|
+
if (!this.account) {
|
|
618
|
+
this.account = await this.connect();
|
|
619
|
+
}
|
|
620
|
+
} catch (e) {
|
|
621
|
+
console.error(e);
|
|
622
|
+
return false;
|
|
623
|
+
}
|
|
624
|
+
this.emitNetworkChanged(chainId);
|
|
625
|
+
return true;
|
|
626
|
+
}
|
|
627
|
+
addStarknetChain(_chain) {
|
|
628
|
+
return Promise.resolve(true);
|
|
629
|
+
}
|
|
572
630
|
async disconnect() {
|
|
573
631
|
if (!this.keychain) {
|
|
574
632
|
console.error(new NotReadyToConnect().message);
|
|
@@ -621,6 +679,9 @@ var ControllerProvider = class extends BaseProvider {
|
|
|
621
679
|
}
|
|
622
680
|
return this.keychain.revoke(origin);
|
|
623
681
|
}
|
|
682
|
+
rpcUrl() {
|
|
683
|
+
return this.chains.get(this.selectedChain).rpcUrl;
|
|
684
|
+
}
|
|
624
685
|
username() {
|
|
625
686
|
if (!this.keychain) {
|
|
626
687
|
console.error(new NotReadyToConnect().message);
|