@cartridge/controller 0.1.47 → 0.1.50

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/account.js CHANGED
@@ -1,19 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -23,56 +8,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
24
9
  });
25
10
  };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
54
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
55
13
  };
56
14
  Object.defineProperty(exports, "__esModule", { value: true });
57
- var cuid_1 = __importDefault(require("cuid"));
58
- var starknet_1 = require("starknet");
59
- var number_1 = require("starknet/utils/number");
60
- var query_string_1 = __importDefault(require("query-string"));
61
- var signer_1 = require("./signer");
62
- var CartridgeAccount = /** @class */ (function (_super) {
63
- __extends(CartridgeAccount, _super);
64
- function CartridgeAccount(address, scopes, messenger, options) {
65
- if (scopes === void 0) { scopes = []; }
66
- var _this = _super.call(this, starknet_1.defaultProvider, address, new signer_1.Signer(messenger, options)) || this;
67
- _this.url = "https://x.cartridge.gg";
68
- _this._scopes = [];
69
- _this.address = address;
70
- _this.messenger = messenger;
71
- _this._scopes = scopes;
15
+ const cuid_1 = __importDefault(require("cuid"));
16
+ const starknet_1 = require("starknet");
17
+ const number_1 = require("starknet/utils/number");
18
+ const query_string_1 = __importDefault(require("query-string"));
19
+ const signer_1 = require("./signer");
20
+ class CartridgeAccount extends starknet_1.Account {
21
+ constructor(address, scopes = [], messenger, options) {
22
+ super(starknet_1.defaultProvider, address, new signer_1.Signer(messenger, options));
23
+ this.url = "https://x.cartridge.gg";
24
+ this._scopes = [];
25
+ this.address = address;
26
+ this.messenger = messenger;
27
+ this._scopes = scopes;
72
28
  if (options === null || options === void 0 ? void 0 : options.url) {
73
- _this.url = options.url;
29
+ this.url = options.url;
74
30
  }
75
- return _this;
76
31
  }
77
32
  /**
78
33
  * Deploys a given compiled contract (json) to starknet
@@ -84,32 +39,24 @@ var CartridgeAccount = /** @class */ (function (_super) {
84
39
  * @param abi the abi of the contract
85
40
  * @returns a confirmation of sending a transaction on the starknet contract
86
41
  */
87
- CartridgeAccount.prototype.deployContract = function (payload, abi) {
88
- return __awaiter(this, void 0, void 0, function () {
89
- var id, response;
90
- return __generator(this, function (_a) {
91
- switch (_a.label) {
92
- case 0:
93
- id = (0, cuid_1.default)();
94
- window.open("".concat(this.url, "/deploy?origin=").concat(encodeURIComponent(window.origin), "&id=").concat(id), "_blank", "height=650,width=400");
95
- return [4 /*yield*/, this.messenger.send({
96
- method: "deploy-contract",
97
- params: {
98
- id: id,
99
- payload: payload,
100
- abi: abi,
101
- },
102
- })];
103
- case 1:
104
- response = _a.sent();
105
- if (response.error) {
106
- throw new Error(response.error);
107
- }
108
- return [2 /*return*/, response.result];
109
- }
42
+ deployContract(payload, abi) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const id = (0, cuid_1.default)();
45
+ window.open(`${this.url}/deploy?origin=${encodeURIComponent(window.origin)}&id=${id}`, "_blank", "height=650,width=400");
46
+ const response = yield this.messenger.send({
47
+ method: "deploy-contract",
48
+ params: {
49
+ id,
50
+ payload,
51
+ abi,
52
+ },
110
53
  });
54
+ if (response.error) {
55
+ throw new Error(response.error);
56
+ }
57
+ return response.result;
111
58
  });
112
- };
59
+ }
113
60
  /**
114
61
  * Estimate Fee for a method on starknet
115
62
  *
@@ -121,41 +68,23 @@ var CartridgeAccount = /** @class */ (function (_super) {
121
68
  *
122
69
  * @returns response from addTransaction
123
70
  */
124
- CartridgeAccount.prototype.estimateFee = function (calls, _a) {
125
- var _b = _a === void 0 ? {} : _a, providedNonce = _b.nonce, blockIdentifier = _b.blockIdentifier;
126
- return __awaiter(this, void 0, void 0, function () {
127
- var nonce, _c, _d, response;
128
- return __generator(this, function (_e) {
129
- switch (_e.label) {
130
- case 0:
131
- _c = number_1.toBN;
132
- if (!(providedNonce !== null && providedNonce !== void 0)) return [3 /*break*/, 1];
133
- _d = providedNonce;
134
- return [3 /*break*/, 3];
135
- case 1: return [4 /*yield*/, this.getNonce()];
136
- case 2:
137
- _d = (_e.sent());
138
- _e.label = 3;
139
- case 3:
140
- nonce = _c.apply(void 0, [_d]);
141
- return [4 /*yield*/, this.messenger.send({
142
- method: "estimate-fee",
143
- params: {
144
- calls: calls,
145
- nonce: nonce,
146
- blockIdentifier: blockIdentifier,
147
- },
148
- })];
149
- case 4:
150
- response = _e.sent();
151
- if (response.error) {
152
- throw new Error(response.error);
153
- }
154
- return [2 /*return*/, response.result];
155
- }
71
+ estimateFee(calls, { nonce: providedNonce, blockIdentifier } = {}) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const nonce = (0, number_1.toBN)(providedNonce !== null && providedNonce !== void 0 ? providedNonce : (yield this.getNonce()));
74
+ const response = yield this.messenger.send({
75
+ method: "estimate-fee",
76
+ params: {
77
+ calls,
78
+ nonce,
79
+ blockIdentifier,
80
+ },
156
81
  });
82
+ if (response.error) {
83
+ throw new Error(response.error);
84
+ }
85
+ return response.result;
157
86
  });
158
- };
87
+ }
159
88
  /**
160
89
  * Invoke execute function in account contract
161
90
  *
@@ -168,52 +97,43 @@ var CartridgeAccount = /** @class */ (function (_super) {
168
97
  *
169
98
  * @returns response from addTransaction
170
99
  */
171
- CartridgeAccount.prototype.execute = function (calls, abis, transactionsDetail) {
172
- return __awaiter(this, void 0, void 0, function () {
173
- var response, id;
174
- return __generator(this, function (_a) {
175
- switch (_a.label) {
176
- case 0: return [4 /*yield*/, this.messenger.send({
177
- method: "execute",
178
- params: {
179
- calls: calls,
180
- abis: abis,
181
- transactionsDetail: transactionsDetail,
182
- },
183
- })];
184
- case 1:
185
- response = _a.sent();
186
- if (response.result) {
187
- return [2 /*return*/, response.result];
188
- }
189
- if (response.error && response.error !== "missing scopes") {
190
- throw new Error(response.error);
191
- }
192
- id = (0, cuid_1.default)();
193
- window.open("".concat(this.url, "/execute?").concat(query_string_1.default.stringify({
194
- id: id,
195
- origin: window.origin,
196
- calls: JSON.stringify(calls),
197
- })), "_blank", "height=650,width=400");
198
- return [4 /*yield*/, this.messenger.send({
199
- method: "execute",
200
- params: {
201
- id: id,
202
- calls: calls,
203
- abis: abis,
204
- transactionsDetail: transactionsDetail,
205
- },
206
- })];
207
- case 2:
208
- response = _a.sent();
209
- if (response.error) {
210
- throw new Error(response.error);
211
- }
212
- return [2 /*return*/, response.result];
213
- }
100
+ execute(calls, abis, transactionsDetail) {
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ let response = yield this.messenger.send({
103
+ method: "execute",
104
+ params: {
105
+ calls,
106
+ abis,
107
+ transactionsDetail,
108
+ },
214
109
  });
110
+ if (response.result) {
111
+ return response.result;
112
+ }
113
+ if (response.error && response.error !== "missing scopes") {
114
+ throw new Error(response.error);
115
+ }
116
+ const id = (0, cuid_1.default)();
117
+ window.open(`${this.url}/execute?${query_string_1.default.stringify({
118
+ id,
119
+ origin: window.origin,
120
+ calls: JSON.stringify(calls),
121
+ })}`, "_blank", "height=650,width=400");
122
+ response = yield this.messenger.send({
123
+ method: "execute",
124
+ params: {
125
+ id,
126
+ calls,
127
+ abis,
128
+ transactionsDetail,
129
+ },
130
+ });
131
+ if (response.error) {
132
+ throw new Error(response.error);
133
+ }
134
+ return response.result;
215
135
  });
216
- };
136
+ }
217
137
  /**
218
138
  * Sign an JSON object for off-chain usage with the starknet private key and return the signature
219
139
  * This adds a message prefix so it cant be interchanged with transactions
@@ -222,36 +142,27 @@ var CartridgeAccount = /** @class */ (function (_super) {
222
142
  * @returns the signature of the JSON object
223
143
  * @throws {Error} if the JSON object is not a valid JSON
224
144
  */
225
- CartridgeAccount.prototype.signMessage = function (typedData) {
226
- return __awaiter(this, void 0, void 0, function () {
227
- var id, response;
228
- return __generator(this, function (_a) {
229
- switch (_a.label) {
230
- case 0:
231
- id = (0, cuid_1.default)();
232
- window.open("".concat(this.url, "/sign?").concat(query_string_1.default.stringify({
233
- id: id,
234
- origin: window.origin,
235
- typedData: JSON.stringify(typedData),
236
- })), "_blank", "height=650,width=400");
237
- return [4 /*yield*/, this.messenger.send({
238
- method: "sign-message",
239
- params: {
240
- id: id,
241
- typedData: typedData,
242
- },
243
- })];
244
- case 1:
245
- response = _a.sent();
246
- if (response.error) {
247
- throw new Error(response.error);
248
- }
249
- return [2 /*return*/, response.result];
250
- }
145
+ signMessage(typedData) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ const id = (0, cuid_1.default)();
148
+ window.open(`${this.url}/sign?${query_string_1.default.stringify({
149
+ id,
150
+ origin: window.origin,
151
+ typedData: JSON.stringify(typedData),
152
+ })}`, "_blank", "height=650,width=400");
153
+ const response = yield this.messenger.send({
154
+ method: "sign-message",
155
+ params: {
156
+ id,
157
+ typedData,
158
+ },
251
159
  });
160
+ if (response.error) {
161
+ throw new Error(response.error);
162
+ }
163
+ return response.result;
252
164
  });
253
- };
254
- return CartridgeAccount;
255
- }(starknet_1.Account));
165
+ }
166
+ }
256
167
  exports.default = CartridgeAccount;
257
168
  //# sourceMappingURL=account.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAwB;AACxB,qCAakB;AAClB,gDAA6C;AAC7C,8DAA8B;AAY9B,mCAAkC;AAElC;IAA+B,oCAAO;IAMpC,0BACE,OAAe,EACf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;YAED,OAAO,QAAQ,CAAC,MAAO,CAAC;QAC1B,CAAC;KAAA;CACF;AAED,kBAAe,gBAAgB,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AccountInterface } from "starknet";
2
+ import { BigNumberish } from "starknet/utils/number";
2
3
  import Messenger, { Message } from "./messenger";
3
4
  import { Scope } from "./types";
4
5
  declare class Controller {
@@ -15,8 +16,11 @@ declare class Controller {
15
16
  });
16
17
  ready(): Promise<boolean | undefined>;
17
18
  probe(): Promise<AccountInterface | undefined>;
18
- register(address: string): Promise<{
19
- publicKey: string;
19
+ register(username: string, credential: {
20
+ x: BigNumberish;
21
+ y: BigNumberish;
22
+ }): Promise<{
23
+ address: string;
20
24
  }>;
21
25
  connect(): Promise<AccountInterface | null>;
22
26
  }