unwallet-client-sdk 0.18.0 → 0.18.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # unWallet client-side SDK
2
2
 
3
- [![npm version](https://badgen.net/npm/v/unwallet-client-sdk)](https://npm.im/unwallet-client-sdk)
3
+ [![npm version](https://img.shields.io/npm/v/unwallet-client-sdk.svg?logo=npm)](https://npm.im/unwallet-client-sdk)
4
4
 
5
5
  :warning: This SDK works correctly only on web browsers.
6
6
 
@@ -1,3 +1,30 @@
1
+ "use strict";
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
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ UWError: () => UWError,
24
+ UnWallet: () => UnWallet
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+
1
28
  // src/error.ts
2
29
  var _UWError = class _UWError extends Error {
3
30
  constructor(code, message) {
@@ -9,12 +36,7 @@ _UWError.prototype.name = "UWError";
9
36
  var UWError = _UWError;
10
37
 
11
38
  // src/unwallet.ts
12
- import {
13
- hashTypedData,
14
- toBytes,
15
- sha256,
16
- validateTypedData
17
- } from "viem";
39
+ var import_viem = require("viem");
18
40
 
19
41
  // src/config.ts
20
42
  var UNWALLET_CONFIG_PROD = {
@@ -45,7 +67,7 @@ function getUnWalletConfigByEnv(env) {
45
67
  }
46
68
 
47
69
  // src/x.ts
48
- import { z } from "zod";
70
+ var import_zod = require("zod");
49
71
  var VALID_X_RESPONSE_TYPES = [
50
72
  "connectionID",
51
73
  "signature",
@@ -148,7 +170,7 @@ var XConnection = class _XConnection {
148
170
  }
149
171
  };
150
172
  function safeParseMessageEventDataToXResponse(data) {
151
- const result = z.string().refine(
173
+ const result = import_zod.z.string().refine(
152
174
  (val) => {
153
175
  try {
154
176
  JSON.parse(val);
@@ -162,9 +184,9 @@ function safeParseMessageEventDataToXResponse(data) {
162
184
  message: "Invalid JSON string"
163
185
  }
164
186
  ).transform((val) => JSON.parse(val)).pipe(
165
- z.object({
166
- type: z.enum(VALID_X_RESPONSE_TYPES),
167
- value: z.string()
187
+ import_zod.z.object({
188
+ type: import_zod.z.enum(VALID_X_RESPONSE_TYPES),
189
+ value: import_zod.z.string()
168
190
  })
169
191
  ).safeParse(data);
170
192
  if (!result.success) {
@@ -232,7 +254,7 @@ var UnWallet = class _UnWallet {
232
254
  reject(new UWError("REQUEST_IN_PROGRESS"));
233
255
  return;
234
256
  }
235
- const digest = sha256(toBytes(args.message));
257
+ const digest = (0, import_viem.sha256)((0, import_viem.toBytes)(args.message));
236
258
  this.xConnection.setResponseHandler({
237
259
  resolve: (resp) => {
238
260
  this.xConnection.setResponseHandler(null);
@@ -281,7 +303,7 @@ var UnWallet = class _UnWallet {
281
303
  types: typedDataTypes
282
304
  };
283
305
  try {
284
- validateTypedData(typedData);
306
+ (0, import_viem.validateTypedData)(typedData);
285
307
  } catch (e) {
286
308
  reject(
287
309
  new UWError(
@@ -291,7 +313,7 @@ var UnWallet = class _UnWallet {
291
313
  );
292
314
  return;
293
315
  }
294
- const digest = hashTypedData(typedData);
316
+ const digest = (0, import_viem.hashTypedData)(typedData);
295
317
  this.xConnection.setResponseHandler({
296
318
  resolve: (resp) => {
297
319
  this.xConnection.setResponseHandler(null);
@@ -394,7 +416,8 @@ function openWindow(url) {
394
416
  `width=${width},height=${height},left=${left},top=${top}`
395
417
  );
396
418
  }
397
- export {
419
+ // Annotate the CommonJS export names for ESM import in node:
420
+ 0 && (module.exports = {
398
421
  UWError,
399
422
  UnWallet
400
- };
423
+ });
package/dist/index.js CHANGED
@@ -1,30 +1,3 @@
1
- "use strict";
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
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- UWError: () => UWError,
24
- UnWallet: () => UnWallet
25
- });
26
- module.exports = __toCommonJS(index_exports);
27
-
28
1
  // src/error.ts
29
2
  var _UWError = class _UWError extends Error {
30
3
  constructor(code, message) {
@@ -36,7 +9,12 @@ _UWError.prototype.name = "UWError";
36
9
  var UWError = _UWError;
37
10
 
38
11
  // src/unwallet.ts
39
- var import_viem = require("viem");
12
+ import {
13
+ hashTypedData,
14
+ toBytes,
15
+ sha256,
16
+ validateTypedData
17
+ } from "viem";
40
18
 
41
19
  // src/config.ts
42
20
  var UNWALLET_CONFIG_PROD = {
@@ -67,7 +45,7 @@ function getUnWalletConfigByEnv(env) {
67
45
  }
68
46
 
69
47
  // src/x.ts
70
- var import_zod = require("zod");
48
+ import { z } from "zod";
71
49
  var VALID_X_RESPONSE_TYPES = [
72
50
  "connectionID",
73
51
  "signature",
@@ -170,7 +148,7 @@ var XConnection = class _XConnection {
170
148
  }
171
149
  };
172
150
  function safeParseMessageEventDataToXResponse(data) {
173
- const result = import_zod.z.string().refine(
151
+ const result = z.string().refine(
174
152
  (val) => {
175
153
  try {
176
154
  JSON.parse(val);
@@ -184,9 +162,9 @@ function safeParseMessageEventDataToXResponse(data) {
184
162
  message: "Invalid JSON string"
185
163
  }
186
164
  ).transform((val) => JSON.parse(val)).pipe(
187
- import_zod.z.object({
188
- type: import_zod.z.enum(VALID_X_RESPONSE_TYPES),
189
- value: import_zod.z.string()
165
+ z.object({
166
+ type: z.enum(VALID_X_RESPONSE_TYPES),
167
+ value: z.string()
190
168
  })
191
169
  ).safeParse(data);
192
170
  if (!result.success) {
@@ -254,7 +232,7 @@ var UnWallet = class _UnWallet {
254
232
  reject(new UWError("REQUEST_IN_PROGRESS"));
255
233
  return;
256
234
  }
257
- const digest = (0, import_viem.sha256)((0, import_viem.toBytes)(args.message));
235
+ const digest = sha256(toBytes(args.message));
258
236
  this.xConnection.setResponseHandler({
259
237
  resolve: (resp) => {
260
238
  this.xConnection.setResponseHandler(null);
@@ -303,7 +281,7 @@ var UnWallet = class _UnWallet {
303
281
  types: typedDataTypes
304
282
  };
305
283
  try {
306
- (0, import_viem.validateTypedData)(typedData);
284
+ validateTypedData(typedData);
307
285
  } catch (e) {
308
286
  reject(
309
287
  new UWError(
@@ -313,7 +291,7 @@ var UnWallet = class _UnWallet {
313
291
  );
314
292
  return;
315
293
  }
316
- const digest = (0, import_viem.hashTypedData)(typedData);
294
+ const digest = hashTypedData(typedData);
317
295
  this.xConnection.setResponseHandler({
318
296
  resolve: (resp) => {
319
297
  this.xConnection.setResponseHandler(null);
@@ -416,8 +394,7 @@ function openWindow(url) {
416
394
  `width=${width},height=${height},left=${left},top=${top}`
417
395
  );
418
396
  }
419
- // Annotate the CommonJS export names for ESM import in node:
420
- 0 && (module.exports = {
397
+ export {
421
398
  UWError,
422
399
  UnWallet
423
- });
400
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unwallet-client-sdk",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "description": "unWallet client-side SDK",
5
5
  "license": "MIT",
6
6
  "author": "SIVIRA",
@@ -10,35 +10,30 @@
10
10
  "exports": {
11
11
  ".": {
12
12
  "require": {
13
- "types": "./dist/index.d.ts",
14
- "default": "./dist/index.js"
13
+ "types": "./dist/index.d.cts",
14
+ "default": "./dist/index.cjs"
15
15
  },
16
16
  "import": {
17
- "types": "./dist/index.d.mts",
18
- "default": "./dist/index.mjs"
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
19
  }
20
20
  }
21
21
  },
22
- "main": "dist/index.js",
23
- "module": "dist/index.mjs",
22
+ "main": "dist/index.cjs",
23
+ "module": "dist/index.js",
24
24
  "types": "dist/index.d.ts",
25
+ "type": "module",
25
26
  "repository": "github:SIVIRA/unwallet-client-sdk-js",
26
- "config": {
27
- "commitizen": {
28
- "path": "./node_modules/cz-conventional-changelog"
29
- }
30
- },
31
27
  "dependencies": {
32
- "viem": "2.45.0",
28
+ "viem": "2.46.3",
33
29
  "zod": "4.3.6"
34
30
  },
35
31
  "devDependencies": {
36
- "@commitlint/cli": "20.3.1",
37
- "@commitlint/config-conventional": "20.3.1",
38
- "@commitlint/types": "20.3.1",
32
+ "@commitlint/cli": "20.4.3",
33
+ "@commitlint/config-conventional": "20.4.3",
34
+ "@commitlint/types": "20.4.3",
39
35
  "@tsconfig/strictest": "2.0.8",
40
- "commitizen": "4.3.1",
41
- "cz-conventional-changelog": "3.3.0",
36
+ "czg": "1.12.0",
42
37
  "husky": "9.1.7",
43
38
  "tsup": "8.5.1"
44
39
  },
File without changes