@cartridge/controller 0.3.16 → 0.3.18
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/package.json +1 -1
- package/lib/src/account.d.ts +0 -88
- package/lib/src/account.js +0 -347
- package/lib/src/account.js.map +0 -1
- package/lib/src/index.d.ts +0 -23
- package/lib/src/index.js +0 -185
- package/lib/src/index.js.map +0 -1
- package/lib/src/messenger.d.ts +0 -16
- package/lib/src/messenger.js +0 -87
- package/lib/src/messenger.js.map +0 -1
- package/lib/src/signer.d.ts +0 -38
- package/lib/src/signer.js +0 -141
- package/lib/src/signer.js.map +0 -1
- package/lib/src/types.d.ts +0 -162
- package/lib/src/types.js +0 -2
- package/lib/src/types.js.map +0 -1
- package/lib/src/utils.d.ts +0 -2
- package/lib/src/utils.js +0 -16
- package/lib/src/utils.js.map +0 -1
- package/lib/src/webauthn.d.ts +0 -16
- package/lib/src/webauthn.js +0 -191
- package/lib/src/webauthn.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
package/package.json
CHANGED
package/lib/src/account.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { AccountInterface, DeployContractPayload, Abi, Call, DeployContractResponse as StarknetDeployContractResponse, InvocationsDetails, Signature, typedData, number, Provider, Invocation, SignerInterface, InvokeFunctionResponse } from "starknet";
|
|
2
|
-
import { EstimateFee } from "starknet/types/account";
|
|
3
|
-
import { Messenger } from "./messenger";
|
|
4
|
-
import { Scope } from "./types";
|
|
5
|
-
export declare class Account extends Provider implements AccountInterface {
|
|
6
|
-
address: string;
|
|
7
|
-
private messenger;
|
|
8
|
-
private url;
|
|
9
|
-
private _scopes;
|
|
10
|
-
signer: SignerInterface;
|
|
11
|
-
constructor(address: string, scopes: Scope[] | undefined, messenger: Messenger, options?: {
|
|
12
|
-
url?: string;
|
|
13
|
-
});
|
|
14
|
-
/**
|
|
15
|
-
* Deploys a given compiled contract (json) to starknet
|
|
16
|
-
*
|
|
17
|
-
* @param payload payload to be deployed containing:
|
|
18
|
-
* - compiled contract code
|
|
19
|
-
* - constructor calldata
|
|
20
|
-
* - address salt
|
|
21
|
-
* @param abi the abi of the contract
|
|
22
|
-
* @returns a confirmation of sending a transaction on the starknet contract
|
|
23
|
-
*/
|
|
24
|
-
deployContract(payload: DeployContractPayload, abi?: Abi): Promise<StarknetDeployContractResponse>;
|
|
25
|
-
/**
|
|
26
|
-
* Estimate Fee for a method on starknet
|
|
27
|
-
*
|
|
28
|
-
* @param invocation the invocation object containing:
|
|
29
|
-
* - contractAddress - the address of the contract
|
|
30
|
-
* - entrypoint - the entrypoint of the contract
|
|
31
|
-
* - calldata - (defaults to []) the calldata
|
|
32
|
-
* - signature - (defaults to []) the signature
|
|
33
|
-
*
|
|
34
|
-
* @returns response from addTransaction
|
|
35
|
-
*/
|
|
36
|
-
estimateFee(invocation: Invocation): Promise<EstimateFee>;
|
|
37
|
-
/**
|
|
38
|
-
* Invoke execute function in account contract
|
|
39
|
-
*
|
|
40
|
-
* @param transactions the invocation object or an array of them, containing:
|
|
41
|
-
* - contractAddress - the address of the contract
|
|
42
|
-
* - entrypoint - the entrypoint of the contract
|
|
43
|
-
* - calldata - (defaults to []) the calldata
|
|
44
|
-
* - signature - (defaults to []) the signature
|
|
45
|
-
* @param abi (optional) the abi of the contract for better displaying
|
|
46
|
-
*
|
|
47
|
-
* @returns response from addTransaction
|
|
48
|
-
*/
|
|
49
|
-
execute(transactions: Call | Call[], abis?: Abi[], transactionsDetail?: InvocationsDetails): Promise<InvokeFunctionResponse>;
|
|
50
|
-
/**
|
|
51
|
-
* Sign an JSON object for off-chain usage with the starknet private key and return the signature
|
|
52
|
-
* This adds a message prefix so it cant be interchanged with transactions
|
|
53
|
-
*
|
|
54
|
-
* @param json - JSON object to be signed
|
|
55
|
-
* @returns the signature of the JSON object
|
|
56
|
-
* @throws {Error} if the JSON object is not a valid JSON
|
|
57
|
-
*/
|
|
58
|
-
signMessage(typedData: typedData.TypedData): Promise<Signature>;
|
|
59
|
-
/**
|
|
60
|
-
* Hash a JSON object with pederson hash and return the hash
|
|
61
|
-
* This adds a message prefix so it cant be interchanged with transactions
|
|
62
|
-
*
|
|
63
|
-
* @param json - JSON object to be hashed
|
|
64
|
-
* @returns the hash of the JSON object
|
|
65
|
-
* @throws {Error} if the JSON object is not a valid JSON
|
|
66
|
-
*/
|
|
67
|
-
hashMessage(typedData: typedData.TypedData): Promise<string>;
|
|
68
|
-
/**
|
|
69
|
-
* Verify a signature of a JSON object
|
|
70
|
-
*
|
|
71
|
-
* @param json - JSON object to be verified
|
|
72
|
-
* @param signature - signature of the JSON object
|
|
73
|
-
* @returns true if the signature is valid, false otherwise
|
|
74
|
-
* @throws {Error} if the JSON object is not a valid JSON or the signature is not a valid signature
|
|
75
|
-
*/
|
|
76
|
-
verifyMessage(typedData: typedData.TypedData, signature: Signature): Promise<boolean>;
|
|
77
|
-
/**
|
|
78
|
-
* Verify a signature of a given hash
|
|
79
|
-
* @warning This method is not recommended, use verifyMessage instead
|
|
80
|
-
*
|
|
81
|
-
* @param hash - hash to be verified
|
|
82
|
-
* @param signature - signature of the hash
|
|
83
|
-
* @returns true if the signature is valid, false otherwise
|
|
84
|
-
* @throws {Error} if the signature is not a valid signature
|
|
85
|
-
*/
|
|
86
|
-
verifyMessageHash(hash: number.BigNumberish, signature: Signature): Promise<boolean>;
|
|
87
|
-
getNonce(): Promise<string>;
|
|
88
|
-
}
|
package/lib/src/account.js
DELETED
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
-
function step(op) {
|
|
30
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
-
while (_) try {
|
|
32
|
-
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;
|
|
33
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
-
switch (op[0]) {
|
|
35
|
-
case 0: case 1: t = op; break;
|
|
36
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
-
default:
|
|
40
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
-
if (t[2]) _.ops.pop();
|
|
45
|
-
_.trys.pop(); continue;
|
|
46
|
-
}
|
|
47
|
-
op = body.call(thisArg, _);
|
|
48
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
import cuid from "cuid";
|
|
53
|
-
import { Provider, } from "starknet";
|
|
54
|
-
import qs from 'query-string';
|
|
55
|
-
import { Signer } from "./signer";
|
|
56
|
-
var Account = /** @class */ (function (_super) {
|
|
57
|
-
__extends(Account, _super);
|
|
58
|
-
function Account(address, scopes, messenger, options) {
|
|
59
|
-
if (scopes === void 0) { scopes = []; }
|
|
60
|
-
var _this = _super.call(this) || this;
|
|
61
|
-
_this.url = "https://cartridge.gg";
|
|
62
|
-
_this._scopes = [];
|
|
63
|
-
_this.address = address;
|
|
64
|
-
_this.messenger = messenger;
|
|
65
|
-
_this._scopes = scopes;
|
|
66
|
-
_this.signer = new Signer(messenger, options);
|
|
67
|
-
if (options === null || options === void 0 ? void 0 : options.url) {
|
|
68
|
-
_this.url = options.url;
|
|
69
|
-
}
|
|
70
|
-
return _this;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Deploys a given compiled contract (json) to starknet
|
|
74
|
-
*
|
|
75
|
-
* @param payload payload to be deployed containing:
|
|
76
|
-
* - compiled contract code
|
|
77
|
-
* - constructor calldata
|
|
78
|
-
* - address salt
|
|
79
|
-
* @param abi the abi of the contract
|
|
80
|
-
* @returns a confirmation of sending a transaction on the starknet contract
|
|
81
|
-
*/
|
|
82
|
-
Account.prototype.deployContract = function (payload, abi) {
|
|
83
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
-
var id, response;
|
|
85
|
-
return __generator(this, function (_a) {
|
|
86
|
-
switch (_a.label) {
|
|
87
|
-
case 0:
|
|
88
|
-
id = cuid();
|
|
89
|
-
window.open("".concat(this.url, "/deploy?origin=").concat(encodeURIComponent(window.origin), "&id=").concat(id), "_blank", "height=650,width=400");
|
|
90
|
-
return [4 /*yield*/, this.messenger.send({
|
|
91
|
-
method: "deploy-contract",
|
|
92
|
-
params: {
|
|
93
|
-
id: id,
|
|
94
|
-
payload: payload,
|
|
95
|
-
abi: abi,
|
|
96
|
-
},
|
|
97
|
-
})];
|
|
98
|
-
case 1:
|
|
99
|
-
response = _a.sent();
|
|
100
|
-
if (response.error) {
|
|
101
|
-
throw new Error(response.error);
|
|
102
|
-
}
|
|
103
|
-
return [2 /*return*/, response.result];
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Estimate Fee for a method on starknet
|
|
110
|
-
*
|
|
111
|
-
* @param invocation the invocation object containing:
|
|
112
|
-
* - contractAddress - the address of the contract
|
|
113
|
-
* - entrypoint - the entrypoint of the contract
|
|
114
|
-
* - calldata - (defaults to []) the calldata
|
|
115
|
-
* - signature - (defaults to []) the signature
|
|
116
|
-
*
|
|
117
|
-
* @returns response from addTransaction
|
|
118
|
-
*/
|
|
119
|
-
Account.prototype.estimateFee = function (invocation) {
|
|
120
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
-
var response;
|
|
122
|
-
return __generator(this, function (_a) {
|
|
123
|
-
switch (_a.label) {
|
|
124
|
-
case 0: return [4 /*yield*/, this.messenger.send({
|
|
125
|
-
method: "estimate-fee",
|
|
126
|
-
params: {
|
|
127
|
-
invocation: invocation,
|
|
128
|
-
},
|
|
129
|
-
})];
|
|
130
|
-
case 1:
|
|
131
|
-
response = _a.sent();
|
|
132
|
-
if (response.error) {
|
|
133
|
-
throw new Error(response.error);
|
|
134
|
-
}
|
|
135
|
-
return [2 /*return*/, response.result];
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Invoke execute function in account contract
|
|
142
|
-
*
|
|
143
|
-
* @param transactions the invocation object or an array of them, containing:
|
|
144
|
-
* - contractAddress - the address of the contract
|
|
145
|
-
* - entrypoint - the entrypoint of the contract
|
|
146
|
-
* - calldata - (defaults to []) the calldata
|
|
147
|
-
* - signature - (defaults to []) the signature
|
|
148
|
-
* @param abi (optional) the abi of the contract for better displaying
|
|
149
|
-
*
|
|
150
|
-
* @returns response from addTransaction
|
|
151
|
-
*/
|
|
152
|
-
Account.prototype.execute = function (transactions, abis, transactionsDetail) {
|
|
153
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
154
|
-
var response, id, calls;
|
|
155
|
-
return __generator(this, function (_a) {
|
|
156
|
-
switch (_a.label) {
|
|
157
|
-
case 0: return [4 /*yield*/, this.messenger.send({
|
|
158
|
-
method: "execute",
|
|
159
|
-
params: {
|
|
160
|
-
transactions: transactions,
|
|
161
|
-
abis: abis,
|
|
162
|
-
transactionsDetail: transactionsDetail,
|
|
163
|
-
},
|
|
164
|
-
})];
|
|
165
|
-
case 1:
|
|
166
|
-
response = _a.sent();
|
|
167
|
-
if (response.result) {
|
|
168
|
-
return [2 /*return*/, response.result];
|
|
169
|
-
}
|
|
170
|
-
if (response.error && response.error !== "missing scopes") {
|
|
171
|
-
throw new Error(response.error);
|
|
172
|
-
}
|
|
173
|
-
id = cuid();
|
|
174
|
-
calls = Array.isArray(transactions) ? transactions : [transactions];
|
|
175
|
-
window.open("".concat(this.url, "/execute?").concat(qs.stringify({
|
|
176
|
-
id: id,
|
|
177
|
-
origin: window.origin,
|
|
178
|
-
calls: JSON.stringify(calls),
|
|
179
|
-
})), "_blank", "height=650,width=400");
|
|
180
|
-
return [4 /*yield*/, this.messenger.send({
|
|
181
|
-
method: "execute",
|
|
182
|
-
params: {
|
|
183
|
-
id: id,
|
|
184
|
-
transactions: transactions,
|
|
185
|
-
abis: abis,
|
|
186
|
-
transactionsDetail: transactionsDetail,
|
|
187
|
-
},
|
|
188
|
-
})];
|
|
189
|
-
case 2:
|
|
190
|
-
response = _a.sent();
|
|
191
|
-
if (response.error) {
|
|
192
|
-
throw new Error(response.error);
|
|
193
|
-
}
|
|
194
|
-
return [2 /*return*/, response.result];
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
/**
|
|
200
|
-
* Sign an JSON object for off-chain usage with the starknet private key and return the signature
|
|
201
|
-
* This adds a message prefix so it cant be interchanged with transactions
|
|
202
|
-
*
|
|
203
|
-
* @param json - JSON object to be signed
|
|
204
|
-
* @returns the signature of the JSON object
|
|
205
|
-
* @throws {Error} if the JSON object is not a valid JSON
|
|
206
|
-
*/
|
|
207
|
-
Account.prototype.signMessage = function (typedData) {
|
|
208
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
209
|
-
var id, response;
|
|
210
|
-
return __generator(this, function (_a) {
|
|
211
|
-
switch (_a.label) {
|
|
212
|
-
case 0:
|
|
213
|
-
id = cuid();
|
|
214
|
-
window.open("".concat(this.url, "/sign?").concat(qs.stringify({
|
|
215
|
-
id: id,
|
|
216
|
-
origin: window.origin,
|
|
217
|
-
typedData: JSON.stringify(typedData),
|
|
218
|
-
})), "_blank", "height=650,width=400");
|
|
219
|
-
return [4 /*yield*/, this.messenger.send({
|
|
220
|
-
method: "sign-message",
|
|
221
|
-
params: {
|
|
222
|
-
id: id,
|
|
223
|
-
typedData: typedData,
|
|
224
|
-
},
|
|
225
|
-
})];
|
|
226
|
-
case 1:
|
|
227
|
-
response = _a.sent();
|
|
228
|
-
if (response.error) {
|
|
229
|
-
throw new Error(response.error);
|
|
230
|
-
}
|
|
231
|
-
return [2 /*return*/, response.result];
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
};
|
|
236
|
-
/**
|
|
237
|
-
* Hash a JSON object with pederson hash and return the hash
|
|
238
|
-
* This adds a message prefix so it cant be interchanged with transactions
|
|
239
|
-
*
|
|
240
|
-
* @param json - JSON object to be hashed
|
|
241
|
-
* @returns the hash of the JSON object
|
|
242
|
-
* @throws {Error} if the JSON object is not a valid JSON
|
|
243
|
-
*/
|
|
244
|
-
Account.prototype.hashMessage = function (typedData) {
|
|
245
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
246
|
-
var response;
|
|
247
|
-
return __generator(this, function (_a) {
|
|
248
|
-
switch (_a.label) {
|
|
249
|
-
case 0: return [4 /*yield*/, this.messenger.send({
|
|
250
|
-
method: "hash-message",
|
|
251
|
-
params: {
|
|
252
|
-
typedData: typedData,
|
|
253
|
-
},
|
|
254
|
-
})];
|
|
255
|
-
case 1:
|
|
256
|
-
response = _a.sent();
|
|
257
|
-
if (response.error) {
|
|
258
|
-
throw new Error(response.error);
|
|
259
|
-
}
|
|
260
|
-
return [2 /*return*/, response.result];
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
};
|
|
265
|
-
/**
|
|
266
|
-
* Verify a signature of a JSON object
|
|
267
|
-
*
|
|
268
|
-
* @param json - JSON object to be verified
|
|
269
|
-
* @param signature - signature of the JSON object
|
|
270
|
-
* @returns true if the signature is valid, false otherwise
|
|
271
|
-
* @throws {Error} if the JSON object is not a valid JSON or the signature is not a valid signature
|
|
272
|
-
*/
|
|
273
|
-
Account.prototype.verifyMessage = function (typedData, signature) {
|
|
274
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
275
|
-
var response;
|
|
276
|
-
return __generator(this, function (_a) {
|
|
277
|
-
switch (_a.label) {
|
|
278
|
-
case 0: return [4 /*yield*/, this.messenger.send({
|
|
279
|
-
method: "verify-message",
|
|
280
|
-
params: {
|
|
281
|
-
typedData: typedData,
|
|
282
|
-
signature: signature,
|
|
283
|
-
},
|
|
284
|
-
})];
|
|
285
|
-
case 1:
|
|
286
|
-
response = _a.sent();
|
|
287
|
-
if (response.error) {
|
|
288
|
-
throw new Error(response.error);
|
|
289
|
-
}
|
|
290
|
-
return [2 /*return*/, response.result];
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
};
|
|
295
|
-
/**
|
|
296
|
-
* Verify a signature of a given hash
|
|
297
|
-
* @warning This method is not recommended, use verifyMessage instead
|
|
298
|
-
*
|
|
299
|
-
* @param hash - hash to be verified
|
|
300
|
-
* @param signature - signature of the hash
|
|
301
|
-
* @returns true if the signature is valid, false otherwise
|
|
302
|
-
* @throws {Error} if the signature is not a valid signature
|
|
303
|
-
*/
|
|
304
|
-
Account.prototype.verifyMessageHash = function (hash, signature) {
|
|
305
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
306
|
-
var response;
|
|
307
|
-
return __generator(this, function (_a) {
|
|
308
|
-
switch (_a.label) {
|
|
309
|
-
case 0: return [4 /*yield*/, this.messenger.send({
|
|
310
|
-
method: "verify-message-hash",
|
|
311
|
-
params: {
|
|
312
|
-
hash: hash,
|
|
313
|
-
signature: signature,
|
|
314
|
-
},
|
|
315
|
-
})];
|
|
316
|
-
case 1:
|
|
317
|
-
response = _a.sent();
|
|
318
|
-
if (response.error) {
|
|
319
|
-
throw new Error(response.error);
|
|
320
|
-
}
|
|
321
|
-
return [2 /*return*/, response.result];
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
};
|
|
326
|
-
Account.prototype.getNonce = function () {
|
|
327
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
328
|
-
var response;
|
|
329
|
-
return __generator(this, function (_a) {
|
|
330
|
-
switch (_a.label) {
|
|
331
|
-
case 0: return [4 /*yield*/, this.messenger.send({
|
|
332
|
-
method: "get-nonce",
|
|
333
|
-
})];
|
|
334
|
-
case 1:
|
|
335
|
-
response = _a.sent();
|
|
336
|
-
if (response.error) {
|
|
337
|
-
throw new Error(response.error);
|
|
338
|
-
}
|
|
339
|
-
return [2 /*return*/, response.result];
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
};
|
|
344
|
-
return Account;
|
|
345
|
-
}(Provider));
|
|
346
|
-
export { Account };
|
|
347
|
-
//# sourceMappingURL=account.js.map
|
package/lib/src/account.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/account.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAUL,QAAQ,GAIT,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,MAAM,cAAc,CAAC;AAe9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;IAA6B,2BAAQ;IAQnC,iBACE,OAAe,EACf,MAAoB,EACpB,SAAoB,EACpB,OAEC;QAJD,uBAAA,EAAA,WAAoB;QAFtB,YAQE,iBAAO,SASR;QAtBO,SAAG,GAAW,sBAAsB,CAAC;QACrC,aAAO,GAAY,EAAE,CAAC;QAa5B,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,KAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,KAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QAE5C,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,EAAE;YAChB,KAAI,CAAC,GAAG,G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I,QAAQ,GAAG,SAMf;wBAEF,IAAI,QAAQ,CAAC,KAAK,EAAE;4BAClB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC;yBAC3C;wBAED,sBAAO,QAAQ,CAAC,MAAO,EAAC;;;;KACzB;IAED;;;;;;;;OAQG;IACG,mCAAiB,GAAvB,UACE,IAAyB,EACzB,SAAoB;;;;;4BAEH,qBAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAA4B;4BACpE,MAAM,EAAE,qBAAqB;4BAC7B,MAAM,EAAE;gCACN,IAAI,MAAA;gCACJ,SAAS,WAAA;6BACV;yBACF,CAAC,EAAA;;wBANI,QAAQ,GAAG,SAMf;wBAEF,IAAI,QAAQ,CAAC,KAAK,EAAE;4BAClB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC;yBAC3C;wBAED,sBAAO,QAAQ,CAAC,MAAO,EAAC;;;;KACzB;IAEK,0BAAQ,GAAd;;;;;4BACmB,qBAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAmB;4BAC3D,MAAM,EAAE,WAAW;yBACpB,CAAC,EAAA;;wBAFI,QAAQ,GAAG,SAEf;wBAEF,IAAI,QAAQ,CAAC,KAAK,EAAE;4BAClB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC;yBAC3C;wBAED,sBAAO,QAAQ,CAAC,MAAO,EAAC;;;;KACzB;IACH,cAAC;AAAD,CAAC,AA5RD,CAA6B,QAAQ,GA4RpC"}
|
package/lib/src/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Message, Messenger } from "./messenger";
|
|
2
|
-
import { Scope } from "./types";
|
|
3
|
-
import { AccountInterface } from "starknet";
|
|
4
|
-
export declare class Cartridge {
|
|
5
|
-
private selector;
|
|
6
|
-
private messenger?;
|
|
7
|
-
private scopes;
|
|
8
|
-
private url;
|
|
9
|
-
private origin;
|
|
10
|
-
private loading;
|
|
11
|
-
private ready_;
|
|
12
|
-
private account;
|
|
13
|
-
constructor(scopes?: Scope[], options?: {
|
|
14
|
-
url?: string;
|
|
15
|
-
origin?: string;
|
|
16
|
-
});
|
|
17
|
-
ready(): Promise<boolean | undefined>;
|
|
18
|
-
probe(): Promise<AccountInterface | undefined>;
|
|
19
|
-
connect(): Promise<AccountInterface | undefined>;
|
|
20
|
-
}
|
|
21
|
-
export type { Message };
|
|
22
|
-
export { Messenger };
|
|
23
|
-
export * from "./types";
|
package/lib/src/index.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (_) try {
|
|
17
|
-
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;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import cuid from "cuid";
|
|
38
|
-
import { Account } from "./account";
|
|
39
|
-
import { Messenger } from "./messenger";
|
|
40
|
-
import qs from "query-string";
|
|
41
|
-
var Cartridge = /** @class */ (function () {
|
|
42
|
-
function Cartridge(scopes, options) {
|
|
43
|
-
var _this = this;
|
|
44
|
-
this.selector = "cartridge-messenger";
|
|
45
|
-
this.scopes = [];
|
|
46
|
-
this.url = "https://cartridge.gg";
|
|
47
|
-
this.origin = "https://cartridge.gg";
|
|
48
|
-
this.loading = true;
|
|
49
|
-
if (scopes) {
|
|
50
|
-
this.scopes = scopes;
|
|
51
|
-
}
|
|
52
|
-
if (options === null || options === void 0 ? void 0 : options.url) {
|
|
53
|
-
this.url = options.url;
|
|
54
|
-
}
|
|
55
|
-
if (options === null || options === void 0 ? void 0 : options.origin) {
|
|
56
|
-
this.origin = options.origin;
|
|
57
|
-
}
|
|
58
|
-
if (typeof document !== "undefined") {
|
|
59
|
-
this.ready_ = new Promise(function (resolve, reject) {
|
|
60
|
-
window.addEventListener("message", function (e) { return __awaiter(_this, void 0, void 0, function () {
|
|
61
|
-
return __generator(this, function (_a) {
|
|
62
|
-
switch (_a.label) {
|
|
63
|
-
case 0:
|
|
64
|
-
if (!(e.data.target === "cartridge" &&
|
|
65
|
-
e.data.payload.method === "ready")) return [3 /*break*/, 2];
|
|
66
|
-
return [4 /*yield*/, this.probe()];
|
|
67
|
-
case 1:
|
|
68
|
-
_a.sent();
|
|
69
|
-
this.loading = false;
|
|
70
|
-
resolve(true);
|
|
71
|
-
_a.label = 2;
|
|
72
|
-
case 2: return [2 /*return*/];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}); });
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
if (typeof document !== "undefined" && !this.messenger) {
|
|
79
|
-
var iframe = document.getElementById(this.selector);
|
|
80
|
-
if (!!iframe) {
|
|
81
|
-
if (!this.messenger) {
|
|
82
|
-
this.messenger = new Messenger(iframe.contentWindow, this.origin);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
iframe = document.createElement("iframe");
|
|
87
|
-
iframe.id = this.selector;
|
|
88
|
-
iframe.src = "".concat(this.url, "/iframe");
|
|
89
|
-
iframe.style.opacity = "0";
|
|
90
|
-
iframe.style.height = "0";
|
|
91
|
-
iframe.style.width = "0";
|
|
92
|
-
iframe.sandbox.add("allow-scripts");
|
|
93
|
-
iframe.sandbox.add("allow-same-origin");
|
|
94
|
-
if (!!document.hasStorageAccess) {
|
|
95
|
-
iframe.sandbox.add("allow-storage-access-by-user-activation");
|
|
96
|
-
}
|
|
97
|
-
document.body.appendChild(iframe);
|
|
98
|
-
this.messenger = new Messenger(iframe.contentWindow, this.origin);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
Cartridge.prototype.ready = function () {
|
|
103
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
104
|
-
return __generator(this, function (_a) {
|
|
105
|
-
if (!this.loading)
|
|
106
|
-
return [2 /*return*/, Promise.resolve(true)];
|
|
107
|
-
return [2 /*return*/, this.ready_];
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
Cartridge.prototype.probe = function () {
|
|
112
|
-
var _a, _b;
|
|
113
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
-
var prob;
|
|
115
|
-
return __generator(this, function (_c) {
|
|
116
|
-
switch (_c.label) {
|
|
117
|
-
case 0: return [4 /*yield*/, ((_a = this.messenger) === null || _a === void 0 ? void 0 : _a.send({
|
|
118
|
-
method: "probe",
|
|
119
|
-
}))];
|
|
120
|
-
case 1:
|
|
121
|
-
prob = _c.sent();
|
|
122
|
-
if (this.messenger && ((_b = prob === null || prob === void 0 ? void 0 : prob.result) === null || _b === void 0 ? void 0 : _b.address)) {
|
|
123
|
-
this.account = new Account(prob.result.address, prob.result.scopes, this.messenger, {
|
|
124
|
-
url: this.url,
|
|
125
|
-
});
|
|
126
|
-
return [2 /*return*/, this.account];
|
|
127
|
-
}
|
|
128
|
-
return [2 /*return*/];
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
Cartridge.prototype.connect = function () {
|
|
134
|
-
var _a;
|
|
135
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
-
var id, ok, response;
|
|
137
|
-
return __generator(this, function (_b) {
|
|
138
|
-
switch (_b.label) {
|
|
139
|
-
case 0:
|
|
140
|
-
id = cuid();
|
|
141
|
-
if (this.account) {
|
|
142
|
-
return [2 /*return*/, this.account];
|
|
143
|
-
}
|
|
144
|
-
if (!!!document.hasStorageAccess) return [3 /*break*/, 3];
|
|
145
|
-
return [4 /*yield*/, document.hasStorageAccess()];
|
|
146
|
-
case 1:
|
|
147
|
-
ok = _b.sent();
|
|
148
|
-
if (!!ok) return [3 /*break*/, 3];
|
|
149
|
-
return [4 /*yield*/, document.requestStorageAccess()];
|
|
150
|
-
case 2:
|
|
151
|
-
_b.sent();
|
|
152
|
-
_b.label = 3;
|
|
153
|
-
case 3:
|
|
154
|
-
window.open("".concat(this.url, "/connect?").concat(qs.stringify({
|
|
155
|
-
id: id,
|
|
156
|
-
origin: window.origin,
|
|
157
|
-
scopes: JSON.stringify(this.scopes),
|
|
158
|
-
})), "_blank", "height=650,width=400");
|
|
159
|
-
return [4 /*yield*/, ((_a = this.messenger) === null || _a === void 0 ? void 0 : _a.send({
|
|
160
|
-
method: "connect",
|
|
161
|
-
params: {
|
|
162
|
-
id: id,
|
|
163
|
-
scopes: this.scopes,
|
|
164
|
-
},
|
|
165
|
-
}))];
|
|
166
|
-
case 4:
|
|
167
|
-
response = _b.sent();
|
|
168
|
-
if (!this.messenger || !response || response.error || !response.result) {
|
|
169
|
-
console.error("not ready for connect");
|
|
170
|
-
return [2 /*return*/];
|
|
171
|
-
}
|
|
172
|
-
this.account = new Account(response.result.address, response.result.scopes, this.messenger, {
|
|
173
|
-
url: this.url,
|
|
174
|
-
});
|
|
175
|
-
return [2 /*return*/, this.account];
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
return Cartridge;
|
|
181
|
-
}());
|
|
182
|
-
export { Cartridge };
|
|
183
|
-
export { Messenger };
|
|
184
|
-
export * from "./types";
|
|
185
|
-
//# sourceMappingURL=index.js.map
|
package/lib/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC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