@cartridge/controller 0.3.0 → 0.3.1

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/lib/inject.js CHANGED
@@ -31,12 +31,40 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
31
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
32
32
  });
33
33
  };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (_) try {
41
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
34
61
  Object.defineProperty(exports, "__esModule", { value: true });
35
62
  exports.injectController = exports.InjectedController = void 0;
36
- const starknet_1 = require("starknet");
37
- const _1 = __importStar(require("."));
38
- class InjectedController {
39
- constructor() {
63
+ var starknet_1 = require("starknet");
64
+ var _1 = __importStar(require("."));
65
+ var InjectedController = /** @class */ (function () {
66
+ function InjectedController(policies, options) {
67
+ var _this = this;
40
68
  this.id = "Cartridge";
41
69
  this.name = "Cartridge";
42
70
  this.version = "0.0.1";
@@ -44,63 +72,79 @@ class InjectedController {
44
72
  this.provider = _1.providers[starknet_1.constants.StarknetChainId.MAINNET];
45
73
  this.isConnected = false;
46
74
  this.subscriptions = [];
47
- this.request = (call) => {
75
+ this.request = function (call) {
48
76
  throw Error("Not implemented");
49
77
  };
50
- this.enable = () => __awaiter(this, void 0, void 0, function* () {
51
- this.account = yield this.controller.connect();
52
- if (!this.account) {
53
- return [];
54
- }
55
- this.provider = _1.providers[this.controller.chainId];
56
- this.isConnected = true;
57
- return [this.account.address];
58
- });
59
- this.isPreauthorized = () => __awaiter(this, void 0, void 0, function* () {
60
- return this.controller.ready().then(() => {
61
- return this.controller.probe();
62
- }).then(connected => !!connected);
63
- });
64
- this.on = (type, handler) => {
78
+ this.enable = function () { return __awaiter(_this, void 0, void 0, function () {
79
+ var _a;
80
+ return __generator(this, function (_b) {
81
+ switch (_b.label) {
82
+ case 0:
83
+ _a = this;
84
+ return [4 /*yield*/, this.controller.connect()];
85
+ case 1:
86
+ _a.account = _b.sent();
87
+ if (!this.account) {
88
+ return [2 /*return*/, []];
89
+ }
90
+ this.provider = _1.providers[this.controller.chainId];
91
+ this.isConnected = true;
92
+ return [2 /*return*/, [this.account.address]];
93
+ }
94
+ });
95
+ }); };
96
+ this.isPreauthorized = function () { return __awaiter(_this, void 0, void 0, function () {
97
+ var _this = this;
98
+ return __generator(this, function (_a) {
99
+ return [2 /*return*/, this.controller
100
+ .ready()
101
+ .then(function () {
102
+ return _this.controller.probe();
103
+ })
104
+ .then(function (connected) { return !!connected; })];
105
+ });
106
+ }); };
107
+ this.on = function (type, handler) {
65
108
  if (type === "accountsChanged") {
66
- this.subscriptions.push({
67
- type,
68
- handler,
109
+ _this.subscriptions.push({
110
+ type: type,
111
+ handler: handler,
69
112
  });
70
113
  }
71
114
  else if (type === "networkChanged") {
72
- this.subscriptions.push({
73
- type,
74
- handler,
115
+ _this.subscriptions.push({
116
+ type: type,
117
+ handler: handler,
75
118
  });
76
119
  }
77
120
  else {
78
- throw new Error(`Unknwown event: ${type}`);
121
+ throw new Error("Unknwown event: ".concat(type));
79
122
  }
80
123
  };
81
- this.off = (type, handler) => {
124
+ this.off = function (type, handler) {
82
125
  if (type !== "accountsChanged" && type !== "networkChanged") {
83
- throw new Error(`Unknwown event: ${type}`);
126
+ throw new Error("Unknwown event: ".concat(type));
84
127
  }
85
- const idx = this.subscriptions.findIndex((userEvent) => userEvent.type === type && userEvent.handler === handler);
128
+ var idx = _this.subscriptions.findIndex(function (userEvent) { return userEvent.type === type && userEvent.handler === handler; });
86
129
  if (idx >= 0) {
87
- this.subscriptions.splice(idx, 1);
130
+ _this.subscriptions.splice(idx, 1);
88
131
  }
89
132
  };
90
- this.controller = new _1.default();
91
- this.controller.ready().then(isConnected => {
92
- this.isConnected = !!isConnected;
93
- if (this.controller.account) {
94
- this.account = this.controller.account;
95
- this.provider = _1.providers[this.controller.chainId];
96
- this.selectedAddress = this.account.address;
133
+ this.controller = new _1.default(policies, options);
134
+ this.controller.ready().then(function (isConnected) {
135
+ _this.isConnected = !!isConnected;
136
+ if (_this.controller.account) {
137
+ _this.account = _this.controller.account;
138
+ _this.provider = _1.providers[_this.controller.chainId];
139
+ _this.selectedAddress = _this.account.address;
97
140
  }
98
141
  });
99
142
  }
100
- }
143
+ return InjectedController;
144
+ }());
101
145
  exports.InjectedController = InjectedController;
102
- function injectController() {
103
- window.starknet_cartridge = new InjectedController();
146
+ function injectController(policies, options) {
147
+ window.starknet_cartridge = new InjectedController(policies, options);
104
148
  }
105
149
  exports.injectController = injectController;
106
150
  //# sourceMappingURL=inject.js.map
package/lib/inject.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"inject.js","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAqC;AAErC,sCAA0C;AAkE1C,MAAa,kBAAkB;IAa3B;QAZO,OAAE,GAAG,WAAW,CAAC;QACjB,SAAI,GAAG,WAAW,CAAC;QACnB,YAAO,GAAG,OAAO,CAAA;QACjB,SAAI,GAAG,w8FAAw8F,CAAC;QACh9F,aAAQ,GAAG,YAAS,CAAC,oBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACxD,gBAAW,GAAY,KAAK,CAAC;QAG7B,kBAAa,GAAmB,EAAE,CAAA;QAgBzC,YAAO,GAAG,CAAC,IAAgC,EAAiC,EAAE;YAC1E,MAAM,KAAK,CAAC,iBAAiB,CAAC,CAAA;QAClC,CAAC,CAAA;QAED,WAAM,GAAG,GAA4B,EAAE;YACnC,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAA;YAC9C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACf,OAAO,EAAE,CAAC;aACb;YAED,IAAI,CAAC,QAAQ,GAAG,YAAS,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACnD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC,CAAA,CAAC;QAEF,oBAAe,GAAG,GAA2B,EAAE;YAC3C,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;gBACrC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;YAClC,CAAC,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I,GAAG,IAAI,CAAC,EAAE;gBACV,KAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;aACrC;QACL,CAAC,CAAC;QA/DE,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,UAAA,WAAW;YACpC,KAAI,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC;YACjC,IAAI,KAAI,CAAC,UAAU,CAAC,OAAO,EAAE;gBACzB,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,UAAU,CAAC,OAAO,CAAC;gBACvC,KAAI,CAAC,QAAQ,GAAG,YAAS,CAAC,KAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBACnD,KAAI,CAAC,eAAe,GAAG,KAAI,CAAC,OAAO,CAAC,OAAO,CAAC;aAC/C;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAuDL,yBAAC;AAAD,CAAC,AAnFD,IAmFC;AAnFY,gDAAkB;AAqF/B,SAAS,gBAAgB,CAAC,QAAmB,EACzC,OAGC;IACA,MAAc,CAAC,kBAAkB,GAAG,IAAI,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC;AAEQ,4CAAgB"}
package/lib/signer.js CHANGED
@@ -8,10 +8,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
11
38
  Object.defineProperty(exports, "__esModule", { value: true });
12
39
  exports.Signer = void 0;
13
- class Signer {
14
- constructor(keychain, modal) {
40
+ var Signer = /** @class */ (function () {
41
+ function Signer(keychain, modal) {
15
42
  this.keychain = keychain;
16
43
  this.modal = modal;
17
44
  }
@@ -20,9 +47,9 @@ class Signer {
20
47
  *
21
48
  * @returns public key of signer as hex string with 0x prefix
22
49
  */
23
- getPubKey() {
50
+ Signer.prototype.getPubKey = function () {
24
51
  return Promise.resolve("");
25
- }
52
+ };
26
53
  /**
27
54
  * Sign an JSON object for off-chain usage with the starknet private key and return the signature
28
55
  * This adds a message prefix so it cant be interchanged with transactions
@@ -32,14 +59,23 @@ class Signer {
32
59
  * @returns the signature of the JSON object
33
60
  * @throws {Error} if the JSON object is not a valid JSON
34
61
  */
35
- signMessage(typedData, account) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- this.modal.open();
38
- const res = yield this.keychain.signMessage(typedData, account);
39
- this.modal.close();
40
- return res;
62
+ Signer.prototype.signMessage = function (typedData, account) {
63
+ return __awaiter(this, void 0, void 0, function () {
64
+ var res;
65
+ return __generator(this, function (_a) {
66
+ switch (_a.label) {
67
+ case 0:
68
+ this.modal.open();
69
+ return [4 /*yield*/, this.keychain.signMessage(typedData, account)];
70
+ case 1:
71
+ res = _a.sent();
72
+ this.modal.close();
73
+ return [2 /*return*/, res];
74
+ }
75
+ });
41
76
  });
42
- }
43
- }
77
+ };
78
+ return Signer;
79
+ }());
44
80
  exports.Signer = Signer;
45
81
  //# sourceMappingURL=signer.js.map
package/lib/signer.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"signer.js","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,MAAa,MAAM;IAGjB,YAAY,QAAsC,EAAE,KAAY;QAC9D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACI,SAAS;QACd,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACU,WAAW,CACtB,SAA8B,EAC9B,OAAe;;YAEf,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAClB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAChE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACnB,OAAO,GAAgB,CAAC;QAC1B,CAAC;KAAA;CACF;AAnCD,wBAmCC"}
1
+ {"version":3,"file":"signer.js","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;IAGE,gBAAY,QAAsC,EAAE,KAAY;QAC9D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACI,0BAAS,GAAhB;QACE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACU,4BAAW,GAAxB,UACE,SAA8B,EAC9B,OAAe;;;;;;wBAEf,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;wBACN,qBAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,EAAA;;wBAAzD,GAAG,GAAG,SAAmD;wBAC/D,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;wBACnB,sBAAO,GAAgB,EAAC;;;;KACzB;IACH,aAAC;AAAD,CAAC,AAnCD,IAmCC;AAnCY,wBAAM"}
package/lib/utils.d.ts CHANGED
@@ -1,2 +1,15 @@
1
1
  import { Policy } from "./types";
2
+ import { GraphQLClient } from "graphql-request";
3
+ import BN from "bn.js";
4
+ export declare const ENDPOINT: string;
5
+ export declare const client: GraphQLClient;
2
6
  export declare function diff(a: Policy[], b: Policy[]): Policy[];
7
+ export declare const computeAddress: (username: string, { x0, x1, x2 }: {
8
+ x0: BN;
9
+ x1: BN;
10
+ x2: BN;
11
+ }, { y0, y1, y2 }: {
12
+ y0: BN;
13
+ y1: BN;
14
+ y2: BN;
15
+ }, deviceKey: string) => string;
package/lib/utils.js CHANGED
@@ -1,12 +1,63 @@
1
1
  "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
26
+ };
2
27
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
28
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
29
  };
5
30
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.diff = void 0;
7
- const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
31
+ exports.computeAddress = exports.diff = exports.client = exports.ENDPOINT = void 0;
32
+ var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
33
+ var graphql_request_1 = require("graphql-request");
34
+ var starknet_1 = require("starknet");
35
+ var constants_1 = require("@cartridge/controller/src/constants");
36
+ exports.ENDPOINT = process.env.NEXT_PUBLIC_API_URL;
37
+ exports.client = new graphql_request_1.GraphQLClient(exports.ENDPOINT, { credentials: "include" });
8
38
  function diff(a, b) {
9
- return a.reduce((prev, policyA) => b.some((policyB) => (0, fast_deep_equal_1.default)(policyB, policyA)) ? prev : [...prev, policyA], []);
39
+ return a.reduce(function (prev, policyA) {
40
+ return b.some(function (policyB) { return (0, fast_deep_equal_1.default)(policyB, policyA); }) ? prev : __spreadArray(__spreadArray([], __read(prev), false), [policyA], false);
41
+ }, []);
10
42
  }
11
43
  exports.diff = diff;
44
+ var computeAddress = function (username, _a, _b, deviceKey) {
45
+ var x0 = _a.x0, x1 = _a.x1, x2 = _a.x2;
46
+ var y0 = _b.y0, y1 = _b.y1, y2 = _b.y2;
47
+ return starknet_1.hash.calculateContractAddressFromHash(starknet_1.shortString.encodeShortString(username), starknet_1.number.toBN(constants_1.PROXY_CLASS), [
48
+ starknet_1.number.toBN(constants_1.CLASS_HASHES["0.0.1"].account),
49
+ starknet_1.hash.getSelectorFromName("initialize"),
50
+ "9",
51
+ starknet_1.number.toBN(constants_1.CLASS_HASHES["0.0.1"].controller),
52
+ "7",
53
+ x0,
54
+ x1,
55
+ x2,
56
+ y0,
57
+ y1,
58
+ y2,
59
+ starknet_1.number.toBN(deviceKey),
60
+ ], "0");
61
+ };
62
+ exports.computeAddress = computeAddress;
12
63
  //# sourceMappingURL=utils.js.map
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAoC;AAIpC,SAAgB,IAAI,CAAC,CAAW,EAAE,CAAW;IACzC,OAAO,CAAC,CAAC,MAAM,CACX,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CACd,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,yBAAK,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAC5E,EAAc,CACjB,CAAC;AACN,CAAC;AAND,oBAMC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAAoC;AAEpC,mDAAgD;AAChD,qCAAqD;AAErD,iEAAgF;AAEnE,QAAA,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAoB,CAAC;AAE5C,QAAA,MAAM,GAAG,IAAI,+BAAa,CAAC,gBAAQ,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AAE9E,SAAgB,IAAI,CAAC,CAAW,EAAE,CAAW;IAC3C,OAAO,CAAC,CAAC,MAAM,CACb,UAAC,IAAI,EAAE,OAAO;QACZ,OAAA,CAAC,CAAC,IAAI,CAAC,UAAC,OAAO,IAAK,OAAA,IAAA,yBAAK,EAAC,OAAO,EAAE,OAAO,CAAC,EAAvB,CAAuB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,wCAAK,IAAI,YAAE,OAAO,SAAC;IAAxE,CAAwE,EAC1E,EAAc,CACf,CAAC;AACJ,CAAC;AAND,oBAMC;AAEM,IAAM,cAAc,GAAG,UAC5B,QAAgB,EAChB,EAA0C,EAC1C,EAA0C,EAC1C,SAAiB;QAFf,EAAE,QAAA,EAAE,EAAE,QAAA,EAAE,EAAE,QAAA;QACV,EAAE,QAAA,EAAE,EAAE,QAAA,EAAE,EAAE,QAAA;IAGZ,OAAA,eAAI,CAAC,gCAAgC,CACnC,sBAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EACvC,iBAAM,CAAC,IAAI,CAAC,uBAAW,CAAC,EACxB;QACE,iBAAM,CAAC,IAAI,CAAC,wBAAY,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;QAC1C,eAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC;QACtC,GAAG;QACH,iBAAM,CAAC,IAAI,CAAC,wBAAY,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;QAC7C,GAAG;QACH,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,iBAAM,CAAC,IAAI,CAAC,SAAS,CAAC;KACvB,EACD,GAAG,CACJ;AAlBD,CAkBC,CAAC;AAxBS,QAAA,cAAc,kBAwBvB"}
package/package.json CHANGED
@@ -1,20 +1,24 @@
1
1
  {
2
2
  "name": "@cartridge/controller",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Cartridge Controller",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "scripts": {
8
- "build": "tsc",
8
+ "build": "tsc --build tsconfig.json",
9
9
  "dev": "tsc --watch",
10
- "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\""
10
+ "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
11
+ "gen": "graphql-codegen --config codegen.yaml"
11
12
  },
12
13
  "files": [
13
14
  "lib"
14
15
  ],
15
16
  "devDependencies": {
17
+ "@graphql-codegen/cli": "^2.16.4",
16
18
  "@types/jest": "^26.0.18",
17
19
  "@types/node": "^17.0.23",
20
+ "graphql": "^16.3.0",
21
+ "graphql-request": "^5.0.0",
18
22
  "jest": "^26.6.3",
19
23
  "ts-jest": "^26.5.1",
20
24
  "ts-node": "^10.4.0",
@@ -25,8 +29,9 @@
25
29
  "@cartridge/penpal": "^6.2.3",
26
30
  "base64url": "^3.0.1",
27
31
  "bn.js": "^5.2.1",
32
+ "cbor-x": "^1.5.0",
28
33
  "fast-deep-equal": "^3.1.3",
29
34
  "query-string": "^7.1.1",
30
- "starknet": "^4.15.1"
35
+ "starknet": "^4.17.1"
31
36
  }
32
37
  }
package/lib/account.d.ts DELETED
@@ -1,57 +0,0 @@
1
- import { Account, DeployContractPayload, Abi, Call, EstimateFeeDetails, DeployContractResponse as StarknetDeployContractResponse, InvocationsDetails, Signature, typedData, InvokeFunctionResponse, EstimateFee } from "starknet";
2
- import { Scope, Keychain } from "./types";
3
- import { AsyncMethodReturns } from "@cartridge/penpal";
4
- declare class CartridgeAccount extends Account {
5
- address: string;
6
- private keychain;
7
- private url;
8
- constructor(address: string, scopes: Scope[] | undefined, keychain: AsyncMethodReturns<Keychain>, options?: {
9
- url?: string;
10
- });
11
- /**
12
- * Deploys a given compiled contract (json) to starknet
13
- *
14
- * @param payload payload to be deployed containing:
15
- * - compiled contract code
16
- * - constructor calldata
17
- * - address salt
18
- * @param abi the abi of the contract
19
- * @returns a confirmation of sending a transaction on the starknet contract
20
- */
21
- deployContract(payload: DeployContractPayload, abi?: Abi): Promise<StarknetDeployContractResponse>;
22
- /**
23
- * Estimate Fee for a method on starknet
24
- *
25
- * @param calls the invocation object containing:
26
- * - contractAddress - the address of the contract
27
- * - entrypoint - the entrypoint of the contract
28
- * - calldata - (defaults to []) the calldata
29
- * - signature - (defaults to []) the signature
30
- *
31
- * @returns response from addTransaction
32
- */
33
- estimateFee(calls: Call | Call[], details?: EstimateFeeDetails): Promise<EstimateFee>;
34
- /**
35
- * Invoke execute function in account contract
36
- *
37
- * @param calls the invocation object or an array of them, containing:
38
- * - contractAddress - the address of the contract
39
- * - entrypoint - the entrypoint of the contract
40
- * - calldata - (defaults to []) the calldata
41
- * - signature - (defaults to []) the signature
42
- * @param abis (optional) the abi of the contract for better displaying
43
- *
44
- * @returns response from addTransaction
45
- */
46
- execute(calls: Call | Call[], abis?: Abi[], transactionsDetail?: InvocationsDetails): Promise<InvokeFunctionResponse>;
47
- /**
48
- * Sign an JSON object for off-chain usage with the starknet private key and return the signature
49
- * This adds a message prefix so it cant be interchanged with transactions
50
- *
51
- * @param json - JSON object to be signed
52
- * @returns the signature of the JSON object
53
- * @throws {Error} if the JSON object is not a valid JSON
54
- */
55
- signMessage(typedData: typedData.TypedData): Promise<Signature>;
56
- }
57
- export default CartridgeAccount;
package/lib/account.js DELETED
@@ -1,145 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const cuid_1 = __importDefault(require("cuid"));
16
- const starknet_1 = require("starknet");
17
- const query_string_1 = __importDefault(require("query-string"));
18
- const signer_1 = require("./signer");
19
- const constants_1 = require("starknet/constants");
20
- class CartridgeAccount extends starknet_1.Account {
21
- constructor(address, scopes = [], keychain, options) {
22
- super(starknet_1.defaultProvider, address, new signer_1.Signer(keychain, options));
23
- this.url = "https://x.cartridge.gg";
24
- this.address = address;
25
- this.keychain = keychain;
26
- if (options === null || options === void 0 ? void 0 : options.url) {
27
- this.url = options.url;
28
- }
29
- }
30
- /**
31
- * Deploys a given compiled contract (json) to starknet
32
- *
33
- * @param payload payload to be deployed containing:
34
- * - compiled contract code
35
- * - constructor calldata
36
- * - address salt
37
- * @param abi the abi of the contract
38
- * @returns a confirmation of sending a transaction on the starknet contract
39
- */
40
- deployContract(payload, abi) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- const id = (0, cuid_1.default)();
43
- window.open(`${this.url}/deploy?origin=${encodeURIComponent(window.origin)}&id=${id}`, "_blank", "height=650,width=400");
44
- throw new Error("unimplemented");
45
- // const response = await this.messenger.send<DeployContractResponse>({
46
- // method: "deploy-contract",
47
- // params: {
48
- // id,
49
- // payload,
50
- // abi,
51
- // },
52
- // });
53
- // if (response.error) {
54
- // throw new Error(response.error as string);
55
- // }
56
- // return response.result!;
57
- });
58
- }
59
- /**
60
- * Estimate Fee for a method on starknet
61
- *
62
- * @param calls the invocation object containing:
63
- * - contractAddress - the address of the contract
64
- * - entrypoint - the entrypoint of the contract
65
- * - calldata - (defaults to []) the calldata
66
- * - signature - (defaults to []) the signature
67
- *
68
- * @returns response from addTransaction
69
- */
70
- estimateFee(calls, details) {
71
- return __awaiter(this, void 0, void 0, function* () {
72
- return this.keychain.estimateFee(calls, details);
73
- });
74
- }
75
- /**
76
- * Invoke execute function in account contract
77
- *
78
- * @param calls the invocation object or an array of them, containing:
79
- * - contractAddress - the address of the contract
80
- * - entrypoint - the entrypoint of the contract
81
- * - calldata - (defaults to []) the calldata
82
- * - signature - (defaults to []) the signature
83
- * @param abis (optional) the abi of the contract for better displaying
84
- *
85
- * @returns response from addTransaction
86
- */
87
- execute(calls, abis, transactionsDetail) {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- if (!transactionsDetail) {
90
- transactionsDetail = {};
91
- }
92
- if (!transactionsDetail.nonce) {
93
- transactionsDetail.nonce = 0; //await this.getNonce();
94
- }
95
- if (!transactionsDetail.version) {
96
- transactionsDetail.version = 1;
97
- }
98
- if (!transactionsDetail.maxFee) {
99
- try {
100
- transactionsDetail.maxFee = "100"; // (await this.estimateFee(calls, { nonce: transactionsDetail.nonce })).suggestedMaxFee
101
- }
102
- catch (e) {
103
- console.error(e);
104
- throw e;
105
- }
106
- }
107
- try {
108
- return yield this.keychain.execute(calls, abis, transactionsDetail);
109
- }
110
- catch (e) {
111
- if (e.message !== "missing scopes") {
112
- console.error(e);
113
- throw e;
114
- }
115
- }
116
- window.open(`${this.url}/execute?${query_string_1.default.stringify({
117
- origin: window.origin,
118
- calls: JSON.stringify(calls),
119
- nonce: transactionsDetail.nonce,
120
- version: transactionsDetail.version,
121
- maxFee: transactionsDetail.maxFee,
122
- chainId: constants_1.StarknetChainId.TESTNET,
123
- })}`, "_blank", "height=650,width=400");
124
- return this.keychain.execute(calls, abis, transactionsDetail, true);
125
- });
126
- }
127
- /**
128
- * Sign an JSON object for off-chain usage with the starknet private key and return the signature
129
- * This adds a message prefix so it cant be interchanged with transactions
130
- *
131
- * @param json - JSON object to be signed
132
- * @returns the signature of the JSON object
133
- * @throws {Error} if the JSON object is not a valid JSON
134
- */
135
- signMessage(typedData) {
136
- return __awaiter(this, void 0, void 0, function* () {
137
- window.open(`${this.url}/sign?${query_string_1.default.stringify({
138
- typedData: JSON.stringify(typedData),
139
- })}`, "_blank", "height=650,width=400");
140
- return this.keychain.signMessage(typedData, this.address);
141
- });
142
- }
143
- }
144
- exports.default = CartridgeAccount;
145
- //# sourceMappingURL=account.js.map
@@ -1 +0,0 @@
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