unwallet-client-sdk 0.16.0 → 0.17.0
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/index.d.mts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +123 -33
- package/dist/index.mjs +111 -31
- package/package.json +6 -4
package/dist/index.d.mts
CHANGED
|
@@ -9,6 +9,24 @@ interface UnWalletXAPIConfig {
|
|
|
9
9
|
connectionTimeout: number;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
interface EIP712TypedData {
|
|
13
|
+
types: Record<string, Array<EIP712TypedDataField>>;
|
|
14
|
+
primaryType: string;
|
|
15
|
+
domain: EIP712TypedDataDomain;
|
|
16
|
+
message: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
interface EIP712TypedDataDomain {
|
|
19
|
+
name?: string;
|
|
20
|
+
version?: string;
|
|
21
|
+
chainId?: number;
|
|
22
|
+
verifyingContract?: string;
|
|
23
|
+
salt?: string;
|
|
24
|
+
}
|
|
25
|
+
interface EIP712TypedDataField {
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
12
30
|
declare const VALID_UW_ERROR_CODES: readonly ["CONNECTION_TIMEOUT", "CONNECTION_FAILED", "CONNECTION_NOT_OPENED", "CONNECTION_CLOSED", "INVALID_REQUEST", "REQUEST_IN_PROGRESS", "REQUEST_REJECTED", "INVALID_RESPONSE"];
|
|
13
31
|
type UWErrorCode = (typeof VALID_UW_ERROR_CODES)[number];
|
|
14
32
|
declare class UWError extends Error {
|
|
@@ -72,6 +90,10 @@ declare class UnWallet {
|
|
|
72
90
|
message: string;
|
|
73
91
|
ticketToken: string;
|
|
74
92
|
}): Promise<SignResult>;
|
|
93
|
+
signEIP712TypedData(args: {
|
|
94
|
+
typedData: EIP712TypedData;
|
|
95
|
+
ticketToken: string;
|
|
96
|
+
}): Promise<SignResult>;
|
|
75
97
|
sendTransaction(args: {
|
|
76
98
|
chainID: number;
|
|
77
99
|
toAddress: string;
|
|
@@ -81,4 +103,4 @@ declare class UnWallet {
|
|
|
81
103
|
}): Promise<SendTransactionResult>;
|
|
82
104
|
}
|
|
83
105
|
|
|
84
|
-
export { type AuthorizationResponseMode, type Config, type Env, type SendTransactionResult, type SignResult, UWError, type UWErrorCode, UnWallet };
|
|
106
|
+
export { type AuthorizationResponseMode, type Config, type EIP712TypedData, type EIP712TypedDataDomain, type EIP712TypedDataField, type Env, type SendTransactionResult, type SignResult, UWError, type UWErrorCode, UnWallet };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,24 @@ interface UnWalletXAPIConfig {
|
|
|
9
9
|
connectionTimeout: number;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
interface EIP712TypedData {
|
|
13
|
+
types: Record<string, Array<EIP712TypedDataField>>;
|
|
14
|
+
primaryType: string;
|
|
15
|
+
domain: EIP712TypedDataDomain;
|
|
16
|
+
message: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
interface EIP712TypedDataDomain {
|
|
19
|
+
name?: string;
|
|
20
|
+
version?: string;
|
|
21
|
+
chainId?: number;
|
|
22
|
+
verifyingContract?: string;
|
|
23
|
+
salt?: string;
|
|
24
|
+
}
|
|
25
|
+
interface EIP712TypedDataField {
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
12
30
|
declare const VALID_UW_ERROR_CODES: readonly ["CONNECTION_TIMEOUT", "CONNECTION_FAILED", "CONNECTION_NOT_OPENED", "CONNECTION_CLOSED", "INVALID_REQUEST", "REQUEST_IN_PROGRESS", "REQUEST_REJECTED", "INVALID_RESPONSE"];
|
|
13
31
|
type UWErrorCode = (typeof VALID_UW_ERROR_CODES)[number];
|
|
14
32
|
declare class UWError extends Error {
|
|
@@ -72,6 +90,10 @@ declare class UnWallet {
|
|
|
72
90
|
message: string;
|
|
73
91
|
ticketToken: string;
|
|
74
92
|
}): Promise<SignResult>;
|
|
93
|
+
signEIP712TypedData(args: {
|
|
94
|
+
typedData: EIP712TypedData;
|
|
95
|
+
ticketToken: string;
|
|
96
|
+
}): Promise<SignResult>;
|
|
75
97
|
sendTransaction(args: {
|
|
76
98
|
chainID: number;
|
|
77
99
|
toAddress: string;
|
|
@@ -81,4 +103,4 @@ declare class UnWallet {
|
|
|
81
103
|
}): Promise<SendTransactionResult>;
|
|
82
104
|
}
|
|
83
105
|
|
|
84
|
-
export { type AuthorizationResponseMode, type Config, type Env, type SendTransactionResult, type SignResult, UWError, type UWErrorCode, UnWallet };
|
|
106
|
+
export { type AuthorizationResponseMode, type Config, type EIP712TypedData, type EIP712TypedDataDomain, type EIP712TypedDataField, type Env, type SendTransactionResult, type SignResult, UWError, type UWErrorCode, UnWallet };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -37,6 +47,7 @@ var UWError = _UWError;
|
|
|
37
47
|
|
|
38
48
|
// src/unwallet.ts
|
|
39
49
|
var import_ethers = require("ethers");
|
|
50
|
+
var import_omit = __toESM(require("lodash/omit"));
|
|
40
51
|
|
|
41
52
|
// src/config.ts
|
|
42
53
|
var UNWALLET_CONFIG_PROD = {
|
|
@@ -67,7 +78,7 @@ function getUnWalletConfigByEnv(env) {
|
|
|
67
78
|
}
|
|
68
79
|
|
|
69
80
|
// src/x.ts
|
|
70
|
-
var
|
|
81
|
+
var import_v4 = require("zod/v4");
|
|
71
82
|
var VALID_X_RESPONSE_TYPES = [
|
|
72
83
|
"connectionID",
|
|
73
84
|
"signature",
|
|
@@ -170,47 +181,37 @@ var XConnection = class _XConnection {
|
|
|
170
181
|
}
|
|
171
182
|
};
|
|
172
183
|
function safeParseMessageEventDataToXResponse(data) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const result = import_zod.z.string().refine((val) => {
|
|
184
|
+
const result = import_v4.z.string().refine(
|
|
185
|
+
(val) => {
|
|
176
186
|
try {
|
|
177
187
|
JSON.parse(val);
|
|
178
188
|
} catch (e) {
|
|
179
189
|
return false;
|
|
180
190
|
}
|
|
181
191
|
return true;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
error: new UWError(
|
|
187
|
-
"INVALID_RESPONSE",
|
|
188
|
-
"message event data must be a json string"
|
|
189
|
-
)
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
s = result.data;
|
|
193
|
-
}
|
|
194
|
-
let parsed;
|
|
195
|
-
{
|
|
196
|
-
const result = import_zod.z.object({
|
|
197
|
-
type: import_zod.z.enum(VALID_X_RESPONSE_TYPES),
|
|
198
|
-
value: import_zod.z.string()
|
|
199
|
-
}).safeParse(JSON.parse(s));
|
|
200
|
-
if (!result.success) {
|
|
201
|
-
return {
|
|
202
|
-
success: false,
|
|
203
|
-
error: new UWError(
|
|
204
|
-
"INVALID_RESPONSE",
|
|
205
|
-
`invalid message event data: ${result.error.message}`
|
|
206
|
-
)
|
|
207
|
-
};
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
abort: true,
|
|
195
|
+
message: "Invalid JSON string"
|
|
208
196
|
}
|
|
209
|
-
|
|
197
|
+
).transform((val) => JSON.parse(val)).pipe(
|
|
198
|
+
import_v4.z.object({
|
|
199
|
+
type: import_v4.z.enum(VALID_X_RESPONSE_TYPES),
|
|
200
|
+
value: import_v4.z.string()
|
|
201
|
+
})
|
|
202
|
+
).safeParse(data);
|
|
203
|
+
if (!result.success) {
|
|
204
|
+
return {
|
|
205
|
+
success: false,
|
|
206
|
+
error: new UWError(
|
|
207
|
+
"INVALID_RESPONSE",
|
|
208
|
+
`invalid message event data: ${result.error.message}`
|
|
209
|
+
)
|
|
210
|
+
};
|
|
210
211
|
}
|
|
211
212
|
return {
|
|
212
213
|
success: true,
|
|
213
|
-
data:
|
|
214
|
+
data: result.data
|
|
214
215
|
};
|
|
215
216
|
}
|
|
216
217
|
|
|
@@ -264,6 +265,7 @@ var UnWallet = class _UnWallet {
|
|
|
264
265
|
reject(new UWError("REQUEST_IN_PROGRESS"));
|
|
265
266
|
return;
|
|
266
267
|
}
|
|
268
|
+
const digest = import_ethers.ethers.sha256(import_ethers.ethers.toUtf8Bytes(args.message));
|
|
267
269
|
this.xConnection.setResponseHandler({
|
|
268
270
|
resolve: (resp) => {
|
|
269
271
|
this.xConnection.setResponseHandler(null);
|
|
@@ -277,7 +279,7 @@ var UnWallet = class _UnWallet {
|
|
|
277
279
|
return;
|
|
278
280
|
}
|
|
279
281
|
resolve({
|
|
280
|
-
digest
|
|
282
|
+
digest,
|
|
281
283
|
signature: resp.value
|
|
282
284
|
});
|
|
283
285
|
},
|
|
@@ -296,6 +298,94 @@ var UnWallet = class _UnWallet {
|
|
|
296
298
|
openWindow(url);
|
|
297
299
|
});
|
|
298
300
|
}
|
|
301
|
+
signEIP712TypedData(args) {
|
|
302
|
+
return new Promise((resolve, reject) => {
|
|
303
|
+
if (this.xConnection.readyState !== WebSocket.OPEN) {
|
|
304
|
+
reject(new UWError("CONNECTION_NOT_OPENED"));
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (this.xConnection.hasResponseHandler) {
|
|
308
|
+
reject(new UWError("REQUEST_IN_PROGRESS"));
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const types = (0, import_omit.default)(args.typedData.types, "EIP712Domain");
|
|
312
|
+
let primaryType;
|
|
313
|
+
{
|
|
314
|
+
try {
|
|
315
|
+
primaryType = import_ethers.ethers.TypedDataEncoder.getPrimaryType(types);
|
|
316
|
+
} catch (e) {
|
|
317
|
+
if (import_ethers.ethers.isError(e, "INVALID_ARGUMENT")) {
|
|
318
|
+
reject(
|
|
319
|
+
new UWError("INVALID_REQUEST", `invalid typed data: ${e.message}`)
|
|
320
|
+
);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
reject(e);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (primaryType !== args.typedData.primaryType) {
|
|
328
|
+
reject(
|
|
329
|
+
new UWError(
|
|
330
|
+
"INVALID_REQUEST",
|
|
331
|
+
`invalid typed data: primary type must be ${primaryType}`
|
|
332
|
+
)
|
|
333
|
+
);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
let digest;
|
|
337
|
+
{
|
|
338
|
+
try {
|
|
339
|
+
digest = import_ethers.ethers.TypedDataEncoder.hash(
|
|
340
|
+
args.typedData.domain,
|
|
341
|
+
types,
|
|
342
|
+
args.typedData.message
|
|
343
|
+
);
|
|
344
|
+
} catch (e) {
|
|
345
|
+
if (import_ethers.ethers.isError(e, "INVALID_ARGUMENT")) {
|
|
346
|
+
reject(
|
|
347
|
+
new UWError("INVALID_REQUEST", `invalid typed data: ${e.message}`)
|
|
348
|
+
);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
reject(e);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
this.xConnection.setResponseHandler({
|
|
356
|
+
resolve: (resp) => {
|
|
357
|
+
this.xConnection.setResponseHandler(null);
|
|
358
|
+
if (resp.type !== "signature") {
|
|
359
|
+
reject(
|
|
360
|
+
new UWError(
|
|
361
|
+
"INVALID_RESPONSE",
|
|
362
|
+
`unexpected response type: ${resp.type}`
|
|
363
|
+
)
|
|
364
|
+
);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
resolve({
|
|
368
|
+
digest,
|
|
369
|
+
signature: resp.value
|
|
370
|
+
});
|
|
371
|
+
},
|
|
372
|
+
reject: (err) => {
|
|
373
|
+
this.xConnection.setResponseHandler(null);
|
|
374
|
+
reject(err);
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
const url = new URL(
|
|
378
|
+
`${this.unWalletConfig.frontend.baseURL}/x/signEIP712TypedData`
|
|
379
|
+
);
|
|
380
|
+
{
|
|
381
|
+
url.searchParams.set("connectionID", this.xConnection.id);
|
|
382
|
+
url.searchParams.set("clientID", this.clientID);
|
|
383
|
+
url.searchParams.set("typedData", JSON.stringify(args.typedData));
|
|
384
|
+
url.searchParams.set("ticketToken", args.ticketToken);
|
|
385
|
+
}
|
|
386
|
+
openWindow(url);
|
|
387
|
+
});
|
|
388
|
+
}
|
|
299
389
|
sendTransaction(args) {
|
|
300
390
|
return new Promise((resolve, reject) => {
|
|
301
391
|
if (this.xConnection.readyState !== WebSocket.OPEN) {
|
package/dist/index.mjs
CHANGED
|
@@ -10,6 +10,7 @@ var UWError = _UWError;
|
|
|
10
10
|
|
|
11
11
|
// src/unwallet.ts
|
|
12
12
|
import { ethers } from "ethers";
|
|
13
|
+
import omit from "lodash/omit";
|
|
13
14
|
|
|
14
15
|
// src/config.ts
|
|
15
16
|
var UNWALLET_CONFIG_PROD = {
|
|
@@ -40,7 +41,7 @@ function getUnWalletConfigByEnv(env) {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
// src/x.ts
|
|
43
|
-
import { z } from "zod";
|
|
44
|
+
import { z } from "zod/v4";
|
|
44
45
|
var VALID_X_RESPONSE_TYPES = [
|
|
45
46
|
"connectionID",
|
|
46
47
|
"signature",
|
|
@@ -143,47 +144,37 @@ var XConnection = class _XConnection {
|
|
|
143
144
|
}
|
|
144
145
|
};
|
|
145
146
|
function safeParseMessageEventDataToXResponse(data) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const result = z.string().refine((val) => {
|
|
147
|
+
const result = z.string().refine(
|
|
148
|
+
(val) => {
|
|
149
149
|
try {
|
|
150
150
|
JSON.parse(val);
|
|
151
151
|
} catch (e) {
|
|
152
152
|
return false;
|
|
153
153
|
}
|
|
154
154
|
return true;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
error: new UWError(
|
|
160
|
-
"INVALID_RESPONSE",
|
|
161
|
-
"message event data must be a json string"
|
|
162
|
-
)
|
|
163
|
-
};
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
abort: true,
|
|
158
|
+
message: "Invalid JSON string"
|
|
164
159
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
let parsed;
|
|
168
|
-
{
|
|
169
|
-
const result = z.object({
|
|
160
|
+
).transform((val) => JSON.parse(val)).pipe(
|
|
161
|
+
z.object({
|
|
170
162
|
type: z.enum(VALID_X_RESPONSE_TYPES),
|
|
171
163
|
value: z.string()
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
parsed = result.data;
|
|
164
|
+
})
|
|
165
|
+
).safeParse(data);
|
|
166
|
+
if (!result.success) {
|
|
167
|
+
return {
|
|
168
|
+
success: false,
|
|
169
|
+
error: new UWError(
|
|
170
|
+
"INVALID_RESPONSE",
|
|
171
|
+
`invalid message event data: ${result.error.message}`
|
|
172
|
+
)
|
|
173
|
+
};
|
|
183
174
|
}
|
|
184
175
|
return {
|
|
185
176
|
success: true,
|
|
186
|
-
data:
|
|
177
|
+
data: result.data
|
|
187
178
|
};
|
|
188
179
|
}
|
|
189
180
|
|
|
@@ -237,6 +228,7 @@ var UnWallet = class _UnWallet {
|
|
|
237
228
|
reject(new UWError("REQUEST_IN_PROGRESS"));
|
|
238
229
|
return;
|
|
239
230
|
}
|
|
231
|
+
const digest = ethers.sha256(ethers.toUtf8Bytes(args.message));
|
|
240
232
|
this.xConnection.setResponseHandler({
|
|
241
233
|
resolve: (resp) => {
|
|
242
234
|
this.xConnection.setResponseHandler(null);
|
|
@@ -250,7 +242,7 @@ var UnWallet = class _UnWallet {
|
|
|
250
242
|
return;
|
|
251
243
|
}
|
|
252
244
|
resolve({
|
|
253
|
-
digest
|
|
245
|
+
digest,
|
|
254
246
|
signature: resp.value
|
|
255
247
|
});
|
|
256
248
|
},
|
|
@@ -269,6 +261,94 @@ var UnWallet = class _UnWallet {
|
|
|
269
261
|
openWindow(url);
|
|
270
262
|
});
|
|
271
263
|
}
|
|
264
|
+
signEIP712TypedData(args) {
|
|
265
|
+
return new Promise((resolve, reject) => {
|
|
266
|
+
if (this.xConnection.readyState !== WebSocket.OPEN) {
|
|
267
|
+
reject(new UWError("CONNECTION_NOT_OPENED"));
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (this.xConnection.hasResponseHandler) {
|
|
271
|
+
reject(new UWError("REQUEST_IN_PROGRESS"));
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const types = omit(args.typedData.types, "EIP712Domain");
|
|
275
|
+
let primaryType;
|
|
276
|
+
{
|
|
277
|
+
try {
|
|
278
|
+
primaryType = ethers.TypedDataEncoder.getPrimaryType(types);
|
|
279
|
+
} catch (e) {
|
|
280
|
+
if (ethers.isError(e, "INVALID_ARGUMENT")) {
|
|
281
|
+
reject(
|
|
282
|
+
new UWError("INVALID_REQUEST", `invalid typed data: ${e.message}`)
|
|
283
|
+
);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
reject(e);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (primaryType !== args.typedData.primaryType) {
|
|
291
|
+
reject(
|
|
292
|
+
new UWError(
|
|
293
|
+
"INVALID_REQUEST",
|
|
294
|
+
`invalid typed data: primary type must be ${primaryType}`
|
|
295
|
+
)
|
|
296
|
+
);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
let digest;
|
|
300
|
+
{
|
|
301
|
+
try {
|
|
302
|
+
digest = ethers.TypedDataEncoder.hash(
|
|
303
|
+
args.typedData.domain,
|
|
304
|
+
types,
|
|
305
|
+
args.typedData.message
|
|
306
|
+
);
|
|
307
|
+
} catch (e) {
|
|
308
|
+
if (ethers.isError(e, "INVALID_ARGUMENT")) {
|
|
309
|
+
reject(
|
|
310
|
+
new UWError("INVALID_REQUEST", `invalid typed data: ${e.message}`)
|
|
311
|
+
);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
reject(e);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
this.xConnection.setResponseHandler({
|
|
319
|
+
resolve: (resp) => {
|
|
320
|
+
this.xConnection.setResponseHandler(null);
|
|
321
|
+
if (resp.type !== "signature") {
|
|
322
|
+
reject(
|
|
323
|
+
new UWError(
|
|
324
|
+
"INVALID_RESPONSE",
|
|
325
|
+
`unexpected response type: ${resp.type}`
|
|
326
|
+
)
|
|
327
|
+
);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
resolve({
|
|
331
|
+
digest,
|
|
332
|
+
signature: resp.value
|
|
333
|
+
});
|
|
334
|
+
},
|
|
335
|
+
reject: (err) => {
|
|
336
|
+
this.xConnection.setResponseHandler(null);
|
|
337
|
+
reject(err);
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
const url = new URL(
|
|
341
|
+
`${this.unWalletConfig.frontend.baseURL}/x/signEIP712TypedData`
|
|
342
|
+
);
|
|
343
|
+
{
|
|
344
|
+
url.searchParams.set("connectionID", this.xConnection.id);
|
|
345
|
+
url.searchParams.set("clientID", this.clientID);
|
|
346
|
+
url.searchParams.set("typedData", JSON.stringify(args.typedData));
|
|
347
|
+
url.searchParams.set("ticketToken", args.ticketToken);
|
|
348
|
+
}
|
|
349
|
+
openWindow(url);
|
|
350
|
+
});
|
|
351
|
+
}
|
|
272
352
|
sendTransaction(args) {
|
|
273
353
|
return new Promise((resolve, reject) => {
|
|
274
354
|
if (this.xConnection.readyState !== WebSocket.OPEN) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unwallet-client-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "unWallet client-side SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SIVIRA",
|
|
@@ -29,18 +29,20 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"ethers": "6.14.
|
|
33
|
-
"
|
|
32
|
+
"ethers": "6.14.1",
|
|
33
|
+
"lodash": "4.17.21",
|
|
34
|
+
"zod": "3.25.13"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@commitlint/cli": "19.8.1",
|
|
37
38
|
"@commitlint/config-conventional": "19.8.1",
|
|
38
39
|
"@commitlint/types": "19.8.1",
|
|
39
40
|
"@tsconfig/strictest": "2.0.5",
|
|
41
|
+
"@types/lodash": "4.17.17",
|
|
40
42
|
"commitizen": "4.3.1",
|
|
41
43
|
"cz-conventional-changelog": "3.3.0",
|
|
42
44
|
"husky": "9.1.7",
|
|
43
|
-
"tsup": "8.
|
|
45
|
+
"tsup": "8.5.0"
|
|
44
46
|
},
|
|
45
47
|
"scripts": {
|
|
46
48
|
"build": "tsup",
|