@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,116 @@
1
-
2
- > @cartridge/controller@0.5.0-alpha.4 build:deps /home/runner/work/controller/controller/packages/controller
3
- > tsc
4
-
1
+
2
+
3
+ > @cartridge/controller@0.5.0-alpha.6 build:deps /home/broody/development/controller/packages/controller
4
+ > tsup --dts-resolve
5
+
6
+ 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/telegram/backend.ts, src/telegram/provider.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
7
+ CLI Using tsconfig: tsconfig.json
8
+ CLI tsup v8.3.0
9
+ CLI Using tsup config: /home/broody/development/controller/packages/controller/package.json
10
+ CLI Target: es2020
11
+ CLI Cleaning output folder
12
+ ESM Build start
13
+ ESM dist/account.js 2.39 KB
14
+ ESM dist/controller.js 35.01 KB
15
+ ESM dist/errors.js 271.00 B
16
+ ESM dist/constants.js 194.00 B
17
+ ESM dist/provider.js 19.16 KB
18
+ ESM dist/types.js 437.00 B
19
+ ESM dist/telegram/backend.js 1.27 KB
20
+ ESM dist/utils.js 406.00 B
21
+ ESM dist/telegram/provider.js 23.14 KB
22
+ ESM dist/iframe/base.js 7.01 KB
23
+ ESM dist/iframe/index.js 8.33 KB
24
+ ESM dist/iframe/keychain.js 7.49 KB
25
+ ESM dist/index.js 35.44 KB
26
+ ESM dist/iframe/profile.js 7.87 KB
27
+ ESM dist/session/account.js 5.64 KB
28
+ ESM dist/icon.js 15.15 KB
29
+ ESM dist/session/backend.js 1.18 KB
30
+ ESM dist/presets.js 3.54 KB
31
+ ESM dist/session/index.js 27.68 KB
32
+ ESM dist/session/provider.js 23.58 KB
33
+ ESM dist/account.js.map 4.58 KB
34
+ ESM dist/constants.js.map 245.00 B
35
+ ESM dist/errors.js.map 385.00 B
36
+ ESM dist/controller.js.map 53.28 KB
37
+ ESM dist/types.js.map 5.09 KB
38
+ ESM dist/telegram/backend.js.map 1.98 KB
39
+ ESM dist/provider.js.map 22.49 KB
40
+ ESM dist/utils.js.map 707.00 B
41
+ ESM dist/telegram/provider.js.map 30.45 KB
42
+ ESM dist/iframe/index.js.map 15.86 KB
43
+ ESM dist/iframe/keychain.js.map 14.05 KB
44
+ ESM dist/iframe/base.js.map 12.91 KB
45
+ ESM dist/index.js.map 58.31 KB
46
+ ESM dist/iframe/profile.js.map 14.86 KB
47
+ ESM dist/session/account.js.map 14.35 KB
48
+ ESM dist/icon.js.map 15.20 KB
49
+ ESM dist/session/backend.js.map 2.88 KB
50
+ ESM dist/session/index.js.map 42.69 KB
51
+ ESM dist/session/provider.js.map 31.27 KB
52
+ ESM dist/presets.js.map 6.14 KB
53
+ ESM ⚡️ Build success in 38ms
54
+ DTS Build start
55
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
56
+
57
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
58
+
59
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
60
+
61
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
62
+
63
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
64
+
65
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
66
+
67
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
68
+
69
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
70
+
71
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
72
+
73
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
74
+
75
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
76
+
77
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
78
+
79
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
80
+
81
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
82
+
83
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
84
+
85
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
86
+
87
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
88
+
89
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
90
+
91
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
92
+
93
+ ../tsconfig/base.json(6,25): error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
94
+
95
+ DTS ⚡️ Build success in 4588ms
96
+ DTS dist/index.d.ts 891.00 B
97
+ DTS dist/session/index.d.ts 909.00 B
98
+ DTS dist/account.d.ts 1.64 KB
99
+ DTS dist/constants.d.ts 154.00 B
100
+ DTS dist/icon.d.ts 15.11 KB
101
+ DTS dist/controller.d.ts 1.05 KB
102
+ DTS dist/utils.d.ts 251.00 B
103
+ DTS dist/telegram/backend.d.ts 1.27 KB
104
+ DTS dist/telegram/provider.d.ts 706.00 B
105
+ DTS dist/session/account.d.ts 2.00 KB
106
+ DTS dist/session/backend.d.ts 2.29 KB
107
+ DTS dist/errors.d.ts 100.00 B
108
+ DTS dist/presets.d.ts 274.00 B
109
+ DTS dist/session/provider.d.ts 969.00 B
110
+ DTS dist/provider.d.ts 788.00 B
111
+ DTS dist/iframe/base.d.ts 196.00 B
112
+ DTS dist/iframe/keychain.d.ts 184.00 B
113
+ DTS dist/iframe/profile.d.ts 210.00 B
114
+ DTS dist/iframe/index.d.ts 264.00 B
115
+ DTS dist/types.d.ts 728.00 B
116
+ DTS dist/types-DIeWpu0p.d.ts 6.59 KB
package/dist/account.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { InvokeFunctionResponse, TypedData, WalletAccount, Call, AllowArray } from "starknet";
2
- import { SPEC } from "@starknet-io/types-js";
3
- import { Keychain, KeychainOptions, Modal } from "./types";
4
- import { AsyncMethodReturns } from "@cartridge/penpal";
5
- import BaseProvider from "./provider";
1
+ import { WalletAccount, AllowArray, Call, InvokeFunctionResponse, TypedData } from 'starknet';
2
+ import { SPEC } from '@starknet-io/types-js';
3
+ import { K as Keychain, i as KeychainOptions, M as Modal } from './types-DIeWpu0p.js';
4
+ import { AsyncMethodReturns } from '@cartridge/penpal';
5
+ import BaseProvider from './provider.js';
6
+ import '@cartridge/account-wasm/controller';
7
+
6
8
  declare class ControllerAccount extends WalletAccount {
7
9
  address: string;
8
10
  private keychain;
@@ -32,4 +34,5 @@ declare class ControllerAccount extends WalletAccount {
32
34
  */
33
35
  signMessage(typedData: TypedData): Promise<SPEC.SIGNATURE>;
34
36
  }
35
- export default ControllerAccount;
37
+
38
+ export { ControllerAccount as default };
package/dist/account.js CHANGED
@@ -1,76 +1,86 @@
1
- import { WalletAccount, } from "starknet";
2
- import { ResponseCodes, } from "./types";
3
- class ControllerAccount extends WalletAccount {
4
- constructor(provider, address, keychain, options, modal) {
5
- super({ nodeUrl: provider.rpc.toString() }, provider);
6
- this.address = address;
7
- this.keychain = keychain;
8
- this.options = options;
9
- this.modal = modal;
1
+ // src/account.ts
2
+ import {
3
+ WalletAccount
4
+ } from "starknet";
5
+ var ControllerAccount = class extends WalletAccount {
6
+ constructor(provider, address, keychain, options, modal) {
7
+ super({ nodeUrl: provider.rpc.toString() }, provider);
8
+ this.address = address;
9
+ this.keychain = keychain;
10
+ this.options = options;
11
+ this.modal = modal;
12
+ }
13
+ /**
14
+ * Invoke execute function in account contract
15
+ *
16
+ * @param calls the invocation object or an array of them, containing:
17
+ * - contractAddress - the address of the contract
18
+ * - entrypoint - the entrypoint of the contract
19
+ * - calldata - (defaults to []) the calldata
20
+ * - signature - (defaults to []) the signature
21
+ * @param abis (optional) the abi of the contract for better displaying
22
+ *
23
+ * @returns response from addTransaction
24
+ */
25
+ async execute(calls) {
26
+ calls = Array.isArray(calls) ? calls : [calls];
27
+ return new Promise(async (resolve, reject) => {
28
+ const sessionExecute = await this.keychain.execute(
29
+ calls,
30
+ void 0,
31
+ void 0,
32
+ false
33
+ );
34
+ if (sessionExecute.code === "SUCCESS" /* SUCCESS */) {
35
+ resolve(sessionExecute);
36
+ return;
37
+ }
38
+ if (this.options?.propagateSessionErrors) {
39
+ reject(sessionExecute.error);
40
+ return;
41
+ }
42
+ this.modal.open();
43
+ const manualExecute = await this.keychain.execute(
44
+ calls,
45
+ void 0,
46
+ void 0,
47
+ true,
48
+ sessionExecute.error
49
+ );
50
+ if (manualExecute.code === "SUCCESS" /* SUCCESS */) {
51
+ resolve(manualExecute);
52
+ this.modal.close();
53
+ return;
54
+ }
55
+ reject(manualExecute.error);
56
+ return;
57
+ });
58
+ }
59
+ /**
60
+ * Sign an JSON object for off-chain usage with the starknet private key and return the signature
61
+ * This adds a message prefix so it cant be interchanged with transactions
62
+ *
63
+ * @param json - JSON object to be signed
64
+ * @returns the signature of the JSON object
65
+ * @throws {Error} if the JSON object is not a valid JSON
66
+ */
67
+ async signMessage(typedData) {
68
+ try {
69
+ this.modal.open();
70
+ const res = await this.keychain.signMessage(typedData, "");
71
+ this.modal.close();
72
+ if ("code" in res) {
73
+ throw res;
74
+ }
75
+ return res;
76
+ } catch (e) {
77
+ console.error(e);
78
+ throw e;
10
79
  }
11
- /**
12
- * Invoke execute function in account contract
13
- *
14
- * @param calls the invocation object or an array of them, containing:
15
- * - contractAddress - the address of the contract
16
- * - entrypoint - the entrypoint of the contract
17
- * - calldata - (defaults to []) the calldata
18
- * - signature - (defaults to []) the signature
19
- * @param abis (optional) the abi of the contract for better displaying
20
- *
21
- * @returns response from addTransaction
22
- */
23
- async execute(calls) {
24
- calls = Array.isArray(calls) ? calls : [calls];
25
- return new Promise(async (resolve, reject) => {
26
- const sessionExecute = await this.keychain.execute(calls, undefined, undefined, false);
27
- // Session call succeeded
28
- if (sessionExecute.code === ResponseCodes.SUCCESS) {
29
- resolve(sessionExecute);
30
- return;
31
- }
32
- // Propagates session txn error back to caller
33
- if (this.options?.propagateSessionErrors) {
34
- reject(sessionExecute.error);
35
- return;
36
- }
37
- // Session call or Paymaster flow failed.
38
- // Session not avaialble, manual flow fallback
39
- this.modal.open();
40
- const manualExecute = await this.keychain.execute(calls, undefined, undefined, true, sessionExecute.error);
41
- // Manual call succeeded
42
- if (manualExecute.code === ResponseCodes.SUCCESS) {
43
- resolve(manualExecute);
44
- this.modal.close();
45
- return;
46
- }
47
- reject(manualExecute.error);
48
- return;
49
- });
50
- }
51
- /**
52
- * Sign an JSON object for off-chain usage with the starknet private key and return the signature
53
- * This adds a message prefix so it cant be interchanged with transactions
54
- *
55
- * @param json - JSON object to be signed
56
- * @returns the signature of the JSON object
57
- * @throws {Error} if the JSON object is not a valid JSON
58
- */
59
- async signMessage(typedData) {
60
- try {
61
- this.modal.open();
62
- const res = await this.keychain.signMessage(typedData, "");
63
- this.modal.close();
64
- if ("code" in res) {
65
- throw res;
66
- }
67
- return res;
68
- }
69
- catch (e) {
70
- console.error(e);
71
- throw e;
72
- }
73
- }
74
- }
75
- export default ControllerAccount;
80
+ }
81
+ };
82
+ var account_default = ControllerAccount;
83
+ export {
84
+ account_default as default
85
+ };
76
86
  //# sourceMappingURL=account.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,GAGd,MAAM,UAAU,CAAC;AAIlB,OAAO,EAKL,aAAa,GACd,MAAM,SAAS,CAAC;AAIjB,MAAM,iBAAkB,SAAQ,aAAa;IAM3C,YACE,QAAsB,EACtB,OAAe,EACf,QAAsC,EACtC,OAAwB,EACxB,KAAY;QAEZ,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;QAEtD,IAAI,CAAC,OAAO,GAAG,OAAO,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AAE,aAA8B,CAAC,KAAK,CAAC,CAAC;YAC9C,OAAO;QACT,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,WAAW,CAAC,SAAoB;QACpC,IAAI,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAClB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAEnB,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;gBAClB,MAAM,GAAG,CAAC;YACZ,CAAC;YAED,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjB,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;CACF;AAED,eAAe,iBAAiB,CAAC"}
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 try {\n this.modal.open();\n const res = await this.keychain.signMessage(typedData, \"\");\n this.modal.close();\n\n if (\"code\" in res) {\n throw res;\n }\n\n return res;\n } catch (e) {\n console.error(e);\n throw e;\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,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https://profile.cartridge.gg";
1
+ declare const KEYCHAIN_URL = "https://x.cartridge.gg";
2
+ declare const PROFILE_URL = "https://profile.cartridge.gg";
3
+
4
+ export { KEYCHAIN_URL, PROFILE_URL };
package/dist/constants.js CHANGED
@@ -1,3 +1,8 @@
1
- export const KEYCHAIN_URL = "https://x.cartridge.gg";
2
- export const PROFILE_URL = "https://profile.cartridge.gg";
1
+ // src/constants.ts
2
+ var KEYCHAIN_URL = "https://x.cartridge.gg";
3
+ var PROFILE_URL = "https://profile.cartridge.gg";
4
+ export {
5
+ KEYCHAIN_URL,
6
+ PROFILE_URL
7
+ };
3
8
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAwB,CAAC;AACrD,MAAM,CAAC,MAAM,WAAW,GAAG,8BAA8B,CAAC"}
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,13 +1,18 @@
1
- import { Policy, ControllerOptions, ProfileContextTypeVariant } from "./types";
2
- import BaseProvider from "./provider";
3
- export default class ControllerProvider extends BaseProvider {
1
+ import { f as ControllerOptions, k as ProfileContextTypeVariant, P as Policy } from './types-DIeWpu0p.js';
2
+ import BaseProvider from './provider.js';
3
+ import { WalletAccount } from 'starknet';
4
+ import '@starknet-io/types-js';
5
+ import '@cartridge/penpal';
6
+ import '@cartridge/account-wasm/controller';
7
+
8
+ declare class ControllerProvider extends BaseProvider {
4
9
  private keychain?;
5
10
  private profile?;
6
11
  private options;
7
12
  private iframes;
8
13
  constructor(options: ControllerOptions);
9
- probe(): Promise<import("starknet").WalletAccount | undefined>;
10
- connect(): Promise<import("starknet").WalletAccount | undefined>;
14
+ probe(): Promise<WalletAccount | undefined>;
15
+ connect(): Promise<WalletAccount | undefined>;
11
16
  disconnect(): Promise<void>;
12
17
  openProfile(tab?: ProfileContextTypeVariant): Promise<void>;
13
18
  openSettings(): Promise<boolean | null>;
@@ -18,3 +23,5 @@ export default class ControllerProvider extends BaseProvider {
18
23
  delegateAccount(): Promise<string | null>;
19
24
  private waitForKeychain;
20
25
  }
26
+
27
+ export { ControllerProvider as default };