@getpara/graz-connector 2.0.0-alpha.50 → 2.0.0-alpha.65
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/dist/cjs/connector.js +348 -0
- package/dist/cjs/index.js +30 -0
- package/dist/cjs/package.json +3 -0
- package/dist/{connector.js → esm/connector.js} +0 -4
- package/dist/{connector.d.ts → types/connector.d.ts} +0 -2
- package/package.json +15 -10
- package/scripts/build.mjs +0 -36
- package/src/connector.ts +0 -355
- package/src/index.ts +0 -2
- package/tsconfig.json +0 -13
- /package/dist/{chunk-M66XENHI.js → esm/chunk-M66XENHI.js} +0 -0
- /package/dist/{index.js → esm/index.js} +0 -0
- /package/dist/{package.json → esm/package.json} +0 -0
- /package/dist/{index.d.ts → types/index.d.ts} +0 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __async = (__this, __arguments, generator) => {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
var fulfilled = (value) => {
|
|
22
|
+
try {
|
|
23
|
+
step(generator.next(value));
|
|
24
|
+
} catch (e) {
|
|
25
|
+
reject(e);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var rejected = (value) => {
|
|
29
|
+
try {
|
|
30
|
+
step(generator.throw(value));
|
|
31
|
+
} catch (e) {
|
|
32
|
+
reject(e);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
36
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
var connector_exports = {};
|
|
40
|
+
__export(connector_exports, {
|
|
41
|
+
ParaGrazConnector: () => ParaGrazConnector,
|
|
42
|
+
toArray: () => toArray
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(connector_exports);
|
|
45
|
+
var import_encoding = require("@cosmjs/encoding");
|
|
46
|
+
var import_cosmjs_v0_integration = require("@getpara/cosmjs-v0-integration");
|
|
47
|
+
function toArray(v) {
|
|
48
|
+
return Array.isArray(v) ? v : [v];
|
|
49
|
+
}
|
|
50
|
+
class ParaOfflineSigner {
|
|
51
|
+
constructor(chainId, connector) {
|
|
52
|
+
this.chainId = chainId;
|
|
53
|
+
this.connector = connector;
|
|
54
|
+
}
|
|
55
|
+
get para() {
|
|
56
|
+
return this.connector.getParaWebClient();
|
|
57
|
+
}
|
|
58
|
+
get prefix() {
|
|
59
|
+
return this.connector.getBech32Prefix(this.chainId);
|
|
60
|
+
}
|
|
61
|
+
wallet() {
|
|
62
|
+
return __async(this, null, function* () {
|
|
63
|
+
return this.connector.getFirstWallet();
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
getAccounts() {
|
|
67
|
+
return __async(this, null, function* () {
|
|
68
|
+
const key = yield this.connector.getKey(this.chainId);
|
|
69
|
+
return [
|
|
70
|
+
{
|
|
71
|
+
address: key.bech32Address,
|
|
72
|
+
algo: key.algo,
|
|
73
|
+
pubkey: key.pubKey
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
signDirect(signerAddress, signDoc) {
|
|
79
|
+
return __async(this, null, function* () {
|
|
80
|
+
if (this.chainId !== signDoc.chainId) {
|
|
81
|
+
throw new Error(`Chain ID mismatch: expected ${this.chainId}, got ${signDoc.chainId}`);
|
|
82
|
+
}
|
|
83
|
+
const accounts = yield this.getAccounts();
|
|
84
|
+
if (accounts.every((a) => a.address !== signerAddress)) {
|
|
85
|
+
throw new Error(`Signer address ${signerAddress} not found in wallet`);
|
|
86
|
+
}
|
|
87
|
+
const signer = new import_cosmjs_v0_integration.ParaProtoSigner(this.para, this.prefix, (yield this.wallet()).id);
|
|
88
|
+
try {
|
|
89
|
+
const result = yield signer.signDirect(signerAddress, signDoc);
|
|
90
|
+
return {
|
|
91
|
+
signed: {
|
|
92
|
+
bodyBytes: result.signed.bodyBytes,
|
|
93
|
+
authInfoBytes: result.signed.authInfoBytes,
|
|
94
|
+
chainId: result.signed.chainId,
|
|
95
|
+
accountNumber: result.signed.accountNumber
|
|
96
|
+
},
|
|
97
|
+
signature: result.signature
|
|
98
|
+
};
|
|
99
|
+
} catch (err) {
|
|
100
|
+
throw new Error(`Direct signing failed: ${err instanceof Error ? err.message : "Unknown error"}`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
class ParaGrazConnector {
|
|
106
|
+
constructor(config, chains = null) {
|
|
107
|
+
this.config = config;
|
|
108
|
+
this.chains = chains;
|
|
109
|
+
this.enabledChainIds = /* @__PURE__ */ new Set();
|
|
110
|
+
if (!(config == null ? void 0 : config.paraWeb)) {
|
|
111
|
+
throw new Error("ParaWeb instance required in config");
|
|
112
|
+
}
|
|
113
|
+
this.events = config.events;
|
|
114
|
+
this.paraWebClient = config.paraWeb;
|
|
115
|
+
}
|
|
116
|
+
ensureChainEnabled(chainId) {
|
|
117
|
+
return __async(this, null, function* () {
|
|
118
|
+
if (!this.enabledChainIds.has(chainId)) {
|
|
119
|
+
throw new Error(`Chain ${chainId} not enabled. Call enable() first`);
|
|
120
|
+
}
|
|
121
|
+
if (!(yield this.paraWebClient.isFullyLoggedIn())) {
|
|
122
|
+
throw new Error("Para wallet not authenticated");
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
waitForLogin(timeoutMs = 6e4) {
|
|
127
|
+
return __async(this, null, function* () {
|
|
128
|
+
const deadline = Date.now() + timeoutMs;
|
|
129
|
+
let delay = 500;
|
|
130
|
+
const MAX_DELAY = 5e3;
|
|
131
|
+
while (true) {
|
|
132
|
+
if (yield this.paraWebClient.isFullyLoggedIn()) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (Date.now() >= deadline) {
|
|
136
|
+
throw new Error(`Login timeout after ${timeoutMs / 1e3}s`);
|
|
137
|
+
}
|
|
138
|
+
yield new Promise((r) => setTimeout(r, delay));
|
|
139
|
+
delay = Math.min(delay * 1.5, MAX_DELAY);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
waitForAccounts(timeoutMs = 5e3) {
|
|
144
|
+
return __async(this, null, function* () {
|
|
145
|
+
const deadline = Date.now() + timeoutMs;
|
|
146
|
+
let delay = 250;
|
|
147
|
+
const MAX_DELAY = 1e3;
|
|
148
|
+
while (true) {
|
|
149
|
+
const wallets = this.paraWebClient.getWalletsByType("COSMOS");
|
|
150
|
+
if (wallets.length) {
|
|
151
|
+
return wallets;
|
|
152
|
+
}
|
|
153
|
+
if (Date.now() >= deadline) {
|
|
154
|
+
throw new Error("No Cosmos wallets found");
|
|
155
|
+
}
|
|
156
|
+
yield new Promise((r) => setTimeout(r, delay));
|
|
157
|
+
delay = Math.min(delay * 1.5, MAX_DELAY);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
hasCosmosWallet() {
|
|
162
|
+
return __async(this, null, function* () {
|
|
163
|
+
const isLoggedIn = yield this.paraWebClient.isFullyLoggedIn();
|
|
164
|
+
const wallets = this.paraWebClient.getWalletsByType("COSMOS");
|
|
165
|
+
return isLoggedIn && wallets.length > 0;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
enable(chainIdsInput) {
|
|
169
|
+
return __async(this, null, function* () {
|
|
170
|
+
var _a, _b, _c, _d;
|
|
171
|
+
const chainIds = toArray(chainIdsInput);
|
|
172
|
+
const previousEnabled = new Set(this.enabledChainIds);
|
|
173
|
+
try {
|
|
174
|
+
chainIds.forEach((id) => this.enabledChainIds.add(id));
|
|
175
|
+
if (yield this.hasCosmosWallet()) {
|
|
176
|
+
(_b = (_a = this.events) == null ? void 0 : _a.onEnabled) == null ? void 0 : _b.call(_a, chainIds, this);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
yield this.waitForLogin();
|
|
180
|
+
yield this.waitForAccounts();
|
|
181
|
+
(_d = (_c = this.events) == null ? void 0 : _c.onEnabled) == null ? void 0 : _d.call(_c, chainIds, this);
|
|
182
|
+
} catch (err) {
|
|
183
|
+
this.enabledChainIds = previousEnabled;
|
|
184
|
+
if (err instanceof Error) {
|
|
185
|
+
throw err;
|
|
186
|
+
}
|
|
187
|
+
throw new Error("Failed to enable Para wallet");
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
disconnect() {
|
|
192
|
+
return __async(this, null, function* () {
|
|
193
|
+
try {
|
|
194
|
+
yield this.paraWebClient.logout();
|
|
195
|
+
} catch (err) {
|
|
196
|
+
throw new Error("Disconnect failed");
|
|
197
|
+
} finally {
|
|
198
|
+
this.enabledChainIds.clear();
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
getFirstWallet() {
|
|
203
|
+
return __async(this, null, function* () {
|
|
204
|
+
try {
|
|
205
|
+
const [wallet] = yield this.waitForAccounts();
|
|
206
|
+
return wallet;
|
|
207
|
+
} catch (err) {
|
|
208
|
+
throw new Error("No Para wallet available");
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
getBech32Prefix(chainId) {
|
|
213
|
+
var _a, _b, _c;
|
|
214
|
+
const prefix = ((_c = (_b = (_a = this.chains) == null ? void 0 : _a.find((c) => c.chainId === chainId)) == null ? void 0 : _b.bech32Config) == null ? void 0 : _c.bech32PrefixAccAddr) || "cosmos";
|
|
215
|
+
return prefix;
|
|
216
|
+
}
|
|
217
|
+
getParaWebClient() {
|
|
218
|
+
return this.paraWebClient;
|
|
219
|
+
}
|
|
220
|
+
getConfig() {
|
|
221
|
+
return this.config;
|
|
222
|
+
}
|
|
223
|
+
buildHybridSigner(chainId) {
|
|
224
|
+
const aminoSigner = this.getOfflineSignerOnlyAmino(chainId);
|
|
225
|
+
const directSigner = new ParaOfflineSigner(chainId, this);
|
|
226
|
+
return {
|
|
227
|
+
getAccounts: () => directSigner.getAccounts(),
|
|
228
|
+
signAmino: (signer, signDoc) => aminoSigner.signAmino(signer, signDoc),
|
|
229
|
+
signDirect: (signer, signDoc) => directSigner.signDirect(signer, signDoc)
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
getKey(chainId) {
|
|
233
|
+
return __async(this, null, function* () {
|
|
234
|
+
try {
|
|
235
|
+
yield this.ensureChainEnabled(chainId);
|
|
236
|
+
const wallet = yield this.getFirstWallet();
|
|
237
|
+
const signer = new import_cosmjs_v0_integration.ParaProtoSigner(this.paraWebClient, this.getBech32Prefix(chainId), wallet.id);
|
|
238
|
+
const [account] = yield signer.getAccounts();
|
|
239
|
+
if (!account) {
|
|
240
|
+
throw new Error(`No Cosmos accounts for chain ${chainId}`);
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
name: "Para Wallet",
|
|
244
|
+
algo: account.algo,
|
|
245
|
+
pubKey: account.pubkey,
|
|
246
|
+
address: (0, import_encoding.fromBech32)(account.address).data,
|
|
247
|
+
bech32Address: account.address,
|
|
248
|
+
isKeystone: false,
|
|
249
|
+
isNanoLedger: false
|
|
250
|
+
};
|
|
251
|
+
} catch (err) {
|
|
252
|
+
if (err instanceof Error) {
|
|
253
|
+
throw err;
|
|
254
|
+
}
|
|
255
|
+
throw new Error(`Failed to get key for chain ${chainId}`);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
getOfflineSignerOnlyAmino(chainId) {
|
|
260
|
+
void this.ensureChainEnabled(chainId);
|
|
261
|
+
const wallet = this.paraWebClient.getWalletsByType("COSMOS")[0];
|
|
262
|
+
if (!wallet) {
|
|
263
|
+
throw new Error("No Cosmos wallet for Amino signing");
|
|
264
|
+
}
|
|
265
|
+
return new import_cosmjs_v0_integration.ParaAminoSigner(this.paraWebClient, this.getBech32Prefix(chainId), wallet.id);
|
|
266
|
+
}
|
|
267
|
+
getOfflineSigner(chainId) {
|
|
268
|
+
void this.ensureChainEnabled(chainId);
|
|
269
|
+
return this.buildHybridSigner(chainId);
|
|
270
|
+
}
|
|
271
|
+
getOfflineSignerAuto(chainId) {
|
|
272
|
+
return __async(this, null, function* () {
|
|
273
|
+
void this.ensureChainEnabled(chainId);
|
|
274
|
+
return this.buildHybridSigner(chainId);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
signAmino(chainId, signer, signDoc, _signOptions) {
|
|
278
|
+
return __async(this, null, function* () {
|
|
279
|
+
yield this.ensureChainEnabled(chainId);
|
|
280
|
+
try {
|
|
281
|
+
const wallet = yield this.getFirstWallet();
|
|
282
|
+
const signerImpl = new import_cosmjs_v0_integration.ParaAminoSigner(this.paraWebClient, this.getBech32Prefix(chainId), wallet.id);
|
|
283
|
+
const response = yield signerImpl.signAmino(signer, signDoc);
|
|
284
|
+
return response;
|
|
285
|
+
} catch (err) {
|
|
286
|
+
throw new Error(`Amino signing failed: ${err instanceof Error ? err.message : "Unknown error"}`);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
signDirect(chainId, signer, signDoc, _signOptions) {
|
|
291
|
+
return __async(this, null, function* () {
|
|
292
|
+
var _a, _b;
|
|
293
|
+
yield this.ensureChainEnabled(chainId);
|
|
294
|
+
try {
|
|
295
|
+
const wallet = yield this.getFirstWallet();
|
|
296
|
+
const signerImpl = new import_cosmjs_v0_integration.ParaProtoSigner(this.paraWebClient, this.getBech32Prefix(chainId), wallet.id);
|
|
297
|
+
const convertedSignDoc = {
|
|
298
|
+
bodyBytes: (_a = signDoc.bodyBytes) != null ? _a : new Uint8Array(),
|
|
299
|
+
authInfoBytes: (_b = signDoc.authInfoBytes) != null ? _b : new Uint8Array(),
|
|
300
|
+
chainId: signDoc.chainId,
|
|
301
|
+
accountNumber: typeof signDoc.accountNumber === "bigint" ? signDoc.accountNumber : BigInt(signDoc.accountNumber)
|
|
302
|
+
};
|
|
303
|
+
const result = yield signerImpl.signDirect(signer, convertedSignDoc);
|
|
304
|
+
return {
|
|
305
|
+
signed: {
|
|
306
|
+
bodyBytes: result.signed.bodyBytes,
|
|
307
|
+
authInfoBytes: result.signed.authInfoBytes,
|
|
308
|
+
chainId: result.signed.chainId,
|
|
309
|
+
accountNumber: result.signed.accountNumber
|
|
310
|
+
},
|
|
311
|
+
signature: result.signature
|
|
312
|
+
};
|
|
313
|
+
} catch (err) {
|
|
314
|
+
throw new Error(`Direct signing failed: ${err instanceof Error ? err.message : "Unknown error"}`);
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
signArbitrary(chainId, signer, data) {
|
|
319
|
+
return __async(this, null, function* () {
|
|
320
|
+
yield this.ensureChainEnabled(chainId);
|
|
321
|
+
const encodedData = typeof data === "string" ? Buffer.from(data, "utf-8").toString("base64") : Buffer.from(data).toString("base64");
|
|
322
|
+
const signDoc = {
|
|
323
|
+
chain_id: "",
|
|
324
|
+
account_number: "0",
|
|
325
|
+
sequence: "0",
|
|
326
|
+
fee: { gas: "0", amount: [] },
|
|
327
|
+
msgs: [
|
|
328
|
+
{
|
|
329
|
+
type: "sign/MsgSignData",
|
|
330
|
+
value: { signer, data: encodedData }
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
memo: ""
|
|
334
|
+
};
|
|
335
|
+
try {
|
|
336
|
+
const response = yield this.signAmino(chainId, signer, signDoc);
|
|
337
|
+
return response.signature;
|
|
338
|
+
} catch (err) {
|
|
339
|
+
throw new Error(`Arbitrary signing failed: ${err instanceof Error ? err.message : "Unknown error"}`);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
345
|
+
0 && (module.exports = {
|
|
346
|
+
ParaGrazConnector,
|
|
347
|
+
toArray
|
|
348
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var src_exports = {};
|
|
20
|
+
__export(src_exports, {
|
|
21
|
+
ParaGrazConnector: () => import_connector.ParaGrazConnector,
|
|
22
|
+
toArray: () => import_connector.toArray
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(src_exports);
|
|
25
|
+
var import_connector = require("./connector.js");
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
ParaGrazConnector,
|
|
29
|
+
toArray
|
|
30
|
+
});
|
|
@@ -72,7 +72,6 @@ class ParaGrazConnector {
|
|
|
72
72
|
}
|
|
73
73
|
this.events = config.events;
|
|
74
74
|
this.paraWebClient = config.paraWeb;
|
|
75
|
-
this.noModal = config.noModal;
|
|
76
75
|
}
|
|
77
76
|
ensureChainEnabled(chainId) {
|
|
78
77
|
return __async(this, null, function* () {
|
|
@@ -137,9 +136,6 @@ class ParaGrazConnector {
|
|
|
137
136
|
(_b = (_a = this.events) == null ? void 0 : _a.onEnabled) == null ? void 0 : _b.call(_a, chainIds, this);
|
|
138
137
|
return;
|
|
139
138
|
}
|
|
140
|
-
if (!this.noModal) {
|
|
141
|
-
throw new Error("Modal not supported. Use @getpara/graz-integration or set noModal: true");
|
|
142
|
-
}
|
|
143
139
|
yield this.waitForLogin();
|
|
144
140
|
yield this.waitForAccounts();
|
|
145
141
|
(_d = (_c = this.events) == null ? void 0 : _c.onEnabled) == null ? void 0 : _d.call(_c, chainIds, this);
|
|
@@ -9,7 +9,6 @@ export type ParaGrazConnectorEvents = {
|
|
|
9
9
|
export interface ParaGrazConfig {
|
|
10
10
|
paraWeb: ParaWeb;
|
|
11
11
|
events?: ParaGrazConnectorEvents;
|
|
12
|
-
noModal?: boolean;
|
|
13
12
|
}
|
|
14
13
|
export declare function toArray<T>(v: T | T[]): T[];
|
|
15
14
|
export declare class ParaGrazConnector implements Omit<Wallet, 'experimentalSuggestChain'> {
|
|
@@ -18,7 +17,6 @@ export declare class ParaGrazConnector implements Omit<Wallet, 'experimentalSugg
|
|
|
18
17
|
protected paraWebClient: ParaWeb;
|
|
19
18
|
protected enabledChainIds: Set<string>;
|
|
20
19
|
protected readonly events?: ParaGrazConnectorEvents;
|
|
21
|
-
protected noModal?: boolean;
|
|
22
20
|
constructor(config: ParaGrazConfig, chains?: ChainInfo[] | null);
|
|
23
21
|
protected ensureChainEnabled(chainId: string): Promise<void>;
|
|
24
22
|
protected waitForLogin(timeoutMs?: number): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/graz-connector",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.65",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"main": "dist/esm/index.js",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/esm/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
8
13
|
"scripts": {
|
|
9
|
-
"
|
|
10
|
-
"build": "rm -rf dist &&
|
|
14
|
+
"build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
|
|
15
|
+
"build:types": "rm -rf dist/types && tsc --module esnext --declarationDir dist/types --emitDeclarationOnly --declaration"
|
|
11
16
|
},
|
|
12
17
|
"dependencies": {
|
|
13
|
-
"@getpara/cosmjs-v0-integration": "2.0.0-alpha.
|
|
14
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
18
|
+
"@getpara/cosmjs-v0-integration": "2.0.0-alpha.65",
|
|
19
|
+
"@getpara/web-sdk": "2.0.0-alpha.65"
|
|
15
20
|
},
|
|
16
21
|
"devDependencies": {
|
|
17
22
|
"@cosmjs/amino": "^0.32.4",
|
|
@@ -21,7 +26,7 @@
|
|
|
21
26
|
"@cosmjs/tendermint-rpc": "^0.32.4",
|
|
22
27
|
"@keplr-wallet/types": "^0.12.156",
|
|
23
28
|
"cosmjs-types": "^0.9.0",
|
|
24
|
-
"graz": "^0.
|
|
29
|
+
"graz": "^0.4.1",
|
|
25
30
|
"typescript": "5.1.6"
|
|
26
31
|
},
|
|
27
32
|
"peerDependencies": {
|
|
@@ -32,6 +37,6 @@
|
|
|
32
37
|
"@cosmjs/tendermint-rpc": ">=0.32.4",
|
|
33
38
|
"@keplr-wallet/types": ">=0.12.156",
|
|
34
39
|
"cosmjs-types": ">=0.8.0",
|
|
35
|
-
"graz": ">=0.
|
|
40
|
+
"graz": ">=0.4.1"
|
|
36
41
|
}
|
|
37
42
|
}
|
package/scripts/build.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import * as fs from 'fs/promises';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import { dirname, resolve } from 'path';
|
|
5
|
-
import { glob } from 'glob';
|
|
6
|
-
|
|
7
|
-
const entryPoints = await glob('src/**/*.{ts,tsx,js,jsx}');
|
|
8
|
-
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const distDir = resolve(__dirname, '../dist');
|
|
11
|
-
|
|
12
|
-
await fs.mkdir(distDir, { recursive: true });
|
|
13
|
-
await fs.writeFile(`${distDir}/package.json`, JSON.stringify({ type: 'module', sideEffects: false }, null, 2));
|
|
14
|
-
|
|
15
|
-
/** @type {import('esbuild').BuildOptions} */
|
|
16
|
-
await esbuild.build({
|
|
17
|
-
banner: {
|
|
18
|
-
js: '"use client";', // Required for Next 13 App Router
|
|
19
|
-
},
|
|
20
|
-
bundle: false,
|
|
21
|
-
write: true,
|
|
22
|
-
format: 'esm',
|
|
23
|
-
loader: {
|
|
24
|
-
'.png': 'dataurl',
|
|
25
|
-
'.svg': 'dataurl',
|
|
26
|
-
'.json': 'text',
|
|
27
|
-
},
|
|
28
|
-
platform: 'browser',
|
|
29
|
-
entryPoints,
|
|
30
|
-
outdir: distDir,
|
|
31
|
-
allowOverwrite: true,
|
|
32
|
-
splitting: true, // Required for tree shaking
|
|
33
|
-
minify: false,
|
|
34
|
-
target: ['es2015'],
|
|
35
|
-
packages: 'external',
|
|
36
|
-
});
|
package/src/connector.ts
DELETED
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import { fromBech32 } from '@cosmjs/encoding';
|
|
2
|
-
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx.js';
|
|
3
|
-
import { Wallet, SignDoc as GrazSignDoc, Key } from 'graz';
|
|
4
|
-
import { ParaAminoSigner, ParaProtoSigner } from '@getpara/cosmjs-v0-integration';
|
|
5
|
-
import { ParaWeb, Wallet as ParaWallet } from '@getpara/web-sdk';
|
|
6
|
-
import { Algo, DirectSignResponse, OfflineDirectSigner } from '@cosmjs/proto-signing';
|
|
7
|
-
import { AccountData, AminoSignResponse, OfflineAminoSigner, StdSignature, StdSignDoc } from '@cosmjs/amino';
|
|
8
|
-
import { ChainInfo, KeplrSignOptions } from '@keplr-wallet/types';
|
|
9
|
-
|
|
10
|
-
export type ParaGrazConnectorEvents = {
|
|
11
|
-
onEnabled?: (chainIds: string[], connector: ParaGrazConnector) => void;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export interface ParaGrazConfig {
|
|
15
|
-
paraWeb: ParaWeb;
|
|
16
|
-
events?: ParaGrazConnectorEvents;
|
|
17
|
-
noModal?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function toArray<T>(v: T | T[]): T[] {
|
|
21
|
-
return Array.isArray(v) ? v : [v];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
class ParaOfflineSigner implements OfflineDirectSigner {
|
|
25
|
-
constructor(
|
|
26
|
-
protected readonly chainId: string,
|
|
27
|
-
protected readonly connector: ParaGrazConnector,
|
|
28
|
-
) {}
|
|
29
|
-
|
|
30
|
-
protected get para() {
|
|
31
|
-
return this.connector.getParaWebClient();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
protected get prefix() {
|
|
35
|
-
return this.connector.getBech32Prefix(this.chainId);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
protected async wallet() {
|
|
39
|
-
return this.connector.getFirstWallet();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async getAccounts(): Promise<readonly AccountData[]> {
|
|
43
|
-
const key = await this.connector.getKey(this.chainId);
|
|
44
|
-
return [
|
|
45
|
-
{
|
|
46
|
-
address: key.bech32Address,
|
|
47
|
-
algo: key.algo as Algo,
|
|
48
|
-
pubkey: key.pubKey,
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async signDirect(signerAddress: string, signDoc: SignDoc): Promise<DirectSignResponse> {
|
|
54
|
-
if (this.chainId !== signDoc.chainId) {
|
|
55
|
-
throw new Error(`Chain ID mismatch: expected ${this.chainId}, got ${signDoc.chainId}`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const accounts = await this.getAccounts();
|
|
59
|
-
if (accounts.every(a => a.address !== signerAddress)) {
|
|
60
|
-
throw new Error(`Signer address ${signerAddress} not found in wallet`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const signer = new ParaProtoSigner(this.para, this.prefix, (await this.wallet()).id);
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
const result = await signer.signDirect(signerAddress, signDoc);
|
|
67
|
-
return {
|
|
68
|
-
signed: {
|
|
69
|
-
bodyBytes: result.signed.bodyBytes,
|
|
70
|
-
authInfoBytes: result.signed.authInfoBytes,
|
|
71
|
-
chainId: result.signed.chainId,
|
|
72
|
-
accountNumber: result.signed.accountNumber,
|
|
73
|
-
},
|
|
74
|
-
signature: result.signature,
|
|
75
|
-
};
|
|
76
|
-
} catch (err) {
|
|
77
|
-
throw new Error(`Direct signing failed: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export class ParaGrazConnector implements Omit<Wallet, 'experimentalSuggestChain'> {
|
|
83
|
-
protected paraWebClient: ParaWeb;
|
|
84
|
-
protected enabledChainIds = new Set<string>();
|
|
85
|
-
protected readonly events?: ParaGrazConnectorEvents;
|
|
86
|
-
protected noModal?: boolean;
|
|
87
|
-
|
|
88
|
-
constructor(
|
|
89
|
-
protected readonly config: ParaGrazConfig,
|
|
90
|
-
protected readonly chains: ChainInfo[] | null = null,
|
|
91
|
-
) {
|
|
92
|
-
if (!config?.paraWeb) {
|
|
93
|
-
throw new Error('ParaWeb instance required in config');
|
|
94
|
-
}
|
|
95
|
-
this.events = config.events;
|
|
96
|
-
this.paraWebClient = config.paraWeb;
|
|
97
|
-
this.noModal = config.noModal;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
protected async ensureChainEnabled(chainId: string): Promise<void> {
|
|
101
|
-
if (!this.enabledChainIds.has(chainId)) {
|
|
102
|
-
throw new Error(`Chain ${chainId} not enabled. Call enable() first`);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (!(await this.paraWebClient.isFullyLoggedIn())) {
|
|
106
|
-
throw new Error('Para wallet not authenticated');
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
protected async waitForLogin(timeoutMs = 60_000): Promise<void> {
|
|
111
|
-
const deadline = Date.now() + timeoutMs;
|
|
112
|
-
let delay = 500;
|
|
113
|
-
const MAX_DELAY = 5_000;
|
|
114
|
-
|
|
115
|
-
while (true) {
|
|
116
|
-
if (await this.paraWebClient.isFullyLoggedIn()) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (Date.now() >= deadline) {
|
|
121
|
-
throw new Error(`Login timeout after ${timeoutMs / 1000}s`);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
await new Promise(r => setTimeout(r, delay));
|
|
125
|
-
delay = Math.min(delay * 1.5, MAX_DELAY);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
protected async waitForAccounts(timeoutMs = 5_000): Promise<ParaWallet[]> {
|
|
130
|
-
const deadline = Date.now() + timeoutMs;
|
|
131
|
-
let delay = 250;
|
|
132
|
-
const MAX_DELAY = 1_000;
|
|
133
|
-
|
|
134
|
-
while (true) {
|
|
135
|
-
const wallets = this.paraWebClient.getWalletsByType('COSMOS');
|
|
136
|
-
if (wallets.length) {
|
|
137
|
-
return wallets;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (Date.now() >= deadline) {
|
|
141
|
-
throw new Error('No Cosmos wallets found');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
await new Promise(r => setTimeout(r, delay));
|
|
145
|
-
delay = Math.min(delay * 1.5, MAX_DELAY);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
protected async hasCosmosWallet(): Promise<boolean> {
|
|
150
|
-
const isLoggedIn = await this.paraWebClient.isFullyLoggedIn();
|
|
151
|
-
const wallets = this.paraWebClient.getWalletsByType('COSMOS');
|
|
152
|
-
return isLoggedIn && wallets.length > 0;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
async enable(chainIdsInput: string | string[]): Promise<void> {
|
|
156
|
-
const chainIds = toArray(chainIdsInput);
|
|
157
|
-
const previousEnabled = new Set(this.enabledChainIds);
|
|
158
|
-
|
|
159
|
-
try {
|
|
160
|
-
chainIds.forEach(id => this.enabledChainIds.add(id));
|
|
161
|
-
|
|
162
|
-
if (await this.hasCosmosWallet()) {
|
|
163
|
-
this.events?.onEnabled?.(chainIds, this);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (!this.noModal) {
|
|
168
|
-
throw new Error('Modal not supported. Use @getpara/graz-integration or set noModal: true');
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
await this.waitForLogin();
|
|
172
|
-
await this.waitForAccounts();
|
|
173
|
-
this.events?.onEnabled?.(chainIds, this);
|
|
174
|
-
} catch (err) {
|
|
175
|
-
this.enabledChainIds = previousEnabled;
|
|
176
|
-
|
|
177
|
-
if (err instanceof Error) {
|
|
178
|
-
throw err;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
throw new Error('Failed to enable Para wallet');
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
async disconnect(): Promise<void> {
|
|
186
|
-
try {
|
|
187
|
-
await this.paraWebClient.logout();
|
|
188
|
-
} catch (err) {
|
|
189
|
-
throw new Error('Disconnect failed');
|
|
190
|
-
} finally {
|
|
191
|
-
this.enabledChainIds.clear();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
async getFirstWallet(): Promise<ParaWallet> {
|
|
196
|
-
try {
|
|
197
|
-
const [wallet] = await this.waitForAccounts();
|
|
198
|
-
return wallet;
|
|
199
|
-
} catch (err) {
|
|
200
|
-
throw new Error('No Para wallet available');
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
getBech32Prefix(chainId: string): string {
|
|
205
|
-
const prefix = this.chains?.find(c => c.chainId === chainId)?.bech32Config?.bech32PrefixAccAddr || 'cosmos';
|
|
206
|
-
return prefix;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
getParaWebClient(): ParaWeb {
|
|
210
|
-
return this.paraWebClient;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
getConfig(): ParaGrazConfig {
|
|
214
|
-
return this.config;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
protected buildHybridSigner(chainId: string): OfflineAminoSigner & OfflineDirectSigner {
|
|
218
|
-
const aminoSigner = this.getOfflineSignerOnlyAmino(chainId);
|
|
219
|
-
const directSigner = new ParaOfflineSigner(chainId, this);
|
|
220
|
-
return {
|
|
221
|
-
getAccounts: () => directSigner.getAccounts(),
|
|
222
|
-
signAmino: (signer: string, signDoc: StdSignDoc) => aminoSigner.signAmino(signer, signDoc),
|
|
223
|
-
signDirect: (signer: string, signDoc: SignDoc) => directSigner.signDirect(signer, signDoc),
|
|
224
|
-
} as unknown as OfflineAminoSigner & OfflineDirectSigner;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
async getKey(chainId: string): Promise<Key> {
|
|
228
|
-
try {
|
|
229
|
-
await this.ensureChainEnabled(chainId);
|
|
230
|
-
const wallet = await this.getFirstWallet();
|
|
231
|
-
const signer = new ParaProtoSigner(this.paraWebClient, this.getBech32Prefix(chainId), wallet.id);
|
|
232
|
-
const [account] = await signer.getAccounts();
|
|
233
|
-
|
|
234
|
-
if (!account) {
|
|
235
|
-
throw new Error(`No Cosmos accounts for chain ${chainId}`);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
return {
|
|
239
|
-
name: 'Para Wallet',
|
|
240
|
-
algo: account.algo,
|
|
241
|
-
pubKey: account.pubkey,
|
|
242
|
-
address: fromBech32(account.address).data,
|
|
243
|
-
bech32Address: account.address,
|
|
244
|
-
isKeystone: false,
|
|
245
|
-
isNanoLedger: false,
|
|
246
|
-
};
|
|
247
|
-
} catch (err) {
|
|
248
|
-
if (err instanceof Error) {
|
|
249
|
-
throw err;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
throw new Error(`Failed to get key for chain ${chainId}`);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner {
|
|
257
|
-
void this.ensureChainEnabled(chainId);
|
|
258
|
-
const wallet = this.paraWebClient.getWalletsByType('COSMOS')[0];
|
|
259
|
-
|
|
260
|
-
if (!wallet) {
|
|
261
|
-
throw new Error('No Cosmos wallet for Amino signing');
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
return new ParaAminoSigner(this.paraWebClient, this.getBech32Prefix(chainId), wallet.id);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
getOfflineSigner(chainId: string): OfflineAminoSigner & OfflineDirectSigner {
|
|
268
|
-
void this.ensureChainEnabled(chainId);
|
|
269
|
-
return this.buildHybridSigner(chainId);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
async getOfflineSignerAuto(chainId: string): Promise<OfflineAminoSigner | OfflineDirectSigner> {
|
|
273
|
-
void this.ensureChainEnabled(chainId);
|
|
274
|
-
return this.buildHybridSigner(chainId);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
async signAmino(
|
|
278
|
-
chainId: string,
|
|
279
|
-
signer: string,
|
|
280
|
-
signDoc: StdSignDoc,
|
|
281
|
-
_signOptions?: KeplrSignOptions,
|
|
282
|
-
): Promise<AminoSignResponse> {
|
|
283
|
-
await this.ensureChainEnabled(chainId);
|
|
284
|
-
|
|
285
|
-
try {
|
|
286
|
-
const wallet = await this.getFirstWallet();
|
|
287
|
-
const signerImpl = new ParaAminoSigner(this.paraWebClient, this.getBech32Prefix(chainId), wallet.id);
|
|
288
|
-
const response = await signerImpl.signAmino(signer, signDoc);
|
|
289
|
-
return response;
|
|
290
|
-
} catch (err) {
|
|
291
|
-
throw new Error(`Amino signing failed: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
async signDirect(
|
|
296
|
-
chainId: string,
|
|
297
|
-
signer: string,
|
|
298
|
-
signDoc: GrazSignDoc,
|
|
299
|
-
_signOptions?: KeplrSignOptions,
|
|
300
|
-
): Promise<DirectSignResponse> {
|
|
301
|
-
await this.ensureChainEnabled(chainId);
|
|
302
|
-
|
|
303
|
-
try {
|
|
304
|
-
const wallet = await this.getFirstWallet();
|
|
305
|
-
const signerImpl = new ParaProtoSigner(this.paraWebClient, this.getBech32Prefix(chainId), wallet.id);
|
|
306
|
-
const convertedSignDoc: SignDoc = {
|
|
307
|
-
bodyBytes: signDoc.bodyBytes ?? new Uint8Array(),
|
|
308
|
-
authInfoBytes: signDoc.authInfoBytes ?? new Uint8Array(),
|
|
309
|
-
chainId: signDoc.chainId,
|
|
310
|
-
accountNumber: typeof signDoc.accountNumber === 'bigint' ? signDoc.accountNumber : BigInt(signDoc.accountNumber),
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
const result = await signerImpl.signDirect(signer, convertedSignDoc);
|
|
314
|
-
return {
|
|
315
|
-
signed: {
|
|
316
|
-
bodyBytes: result.signed.bodyBytes,
|
|
317
|
-
authInfoBytes: result.signed.authInfoBytes,
|
|
318
|
-
chainId: result.signed.chainId,
|
|
319
|
-
accountNumber: result.signed.accountNumber,
|
|
320
|
-
},
|
|
321
|
-
signature: result.signature,
|
|
322
|
-
};
|
|
323
|
-
} catch (err) {
|
|
324
|
-
throw new Error(`Direct signing failed: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
async signArbitrary(chainId: string, signer: string, data: string | Uint8Array): Promise<StdSignature> {
|
|
329
|
-
await this.ensureChainEnabled(chainId);
|
|
330
|
-
|
|
331
|
-
const encodedData =
|
|
332
|
-
typeof data === 'string' ? Buffer.from(data, 'utf-8').toString('base64') : Buffer.from(data).toString('base64');
|
|
333
|
-
|
|
334
|
-
const signDoc = {
|
|
335
|
-
chain_id: '',
|
|
336
|
-
account_number: '0',
|
|
337
|
-
sequence: '0',
|
|
338
|
-
fee: { gas: '0', amount: [] },
|
|
339
|
-
msgs: [
|
|
340
|
-
{
|
|
341
|
-
type: 'sign/MsgSignData',
|
|
342
|
-
value: { signer, data: encodedData },
|
|
343
|
-
},
|
|
344
|
-
],
|
|
345
|
-
memo: '',
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
try {
|
|
349
|
-
const response = await this.signAmino(chainId, signer, signDoc);
|
|
350
|
-
return response.signature;
|
|
351
|
-
} catch (err) {
|
|
352
|
-
throw new Error(`Arbitrary signing failed: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
package/src/index.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "./dist",
|
|
5
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
6
|
-
"jsx": "react-jsx",
|
|
7
|
-
"module": "ESNext",
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"declarationDir": "./dist"
|
|
10
|
-
},
|
|
11
|
-
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
12
|
-
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx", "__tests__"]
|
|
13
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|