unwallet-client-sdk 0.22.0 → 0.23.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.cjs +42 -19
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
2
24
|
let viem = require("viem");
|
|
3
25
|
let zod = require("zod");
|
|
26
|
+
zod = __toESM(zod, 1);
|
|
4
27
|
//#region src/error.ts
|
|
5
28
|
var UWError = class extends Error {
|
|
6
29
|
static {
|
|
@@ -29,8 +52,8 @@ const envToUnWalletConfig = {
|
|
|
29
52
|
}
|
|
30
53
|
}
|
|
31
54
|
};
|
|
32
|
-
const xRequestSchema = zod.
|
|
33
|
-
zod.
|
|
55
|
+
const xRequestSchema = zod.object({ action: zod.enum(["getConnectionID"]) }).readonly();
|
|
56
|
+
zod.string().transform((val, ctx) => {
|
|
34
57
|
try {
|
|
35
58
|
return JSON.parse(val);
|
|
36
59
|
} catch {
|
|
@@ -38,28 +61,28 @@ zod.z.string().transform((val, ctx) => {
|
|
|
38
61
|
code: "custom",
|
|
39
62
|
message: "Invalid JSON string"
|
|
40
63
|
});
|
|
41
|
-
return zod.
|
|
64
|
+
return zod.NEVER;
|
|
42
65
|
}
|
|
43
66
|
}).pipe(xRequestSchema);
|
|
44
|
-
const xResponseSchema = zod.
|
|
45
|
-
zod.
|
|
46
|
-
type: zod.
|
|
47
|
-
value: zod.
|
|
67
|
+
const xResponseSchema = zod.union([
|
|
68
|
+
zod.object({
|
|
69
|
+
type: zod.literal("connectionID"),
|
|
70
|
+
value: zod.string().nonempty()
|
|
48
71
|
}),
|
|
49
|
-
zod.
|
|
50
|
-
type: zod.
|
|
51
|
-
value: zod.
|
|
72
|
+
zod.object({
|
|
73
|
+
type: zod.literal("signature"),
|
|
74
|
+
value: zod.string().refine(viem.isHex, { error: "Invalid hex" })
|
|
52
75
|
}),
|
|
53
|
-
zod.
|
|
54
|
-
type: zod.
|
|
55
|
-
value: zod.
|
|
76
|
+
zod.object({
|
|
77
|
+
type: zod.literal("transactionID"),
|
|
78
|
+
value: zod.string().nonempty()
|
|
56
79
|
}),
|
|
57
|
-
zod.
|
|
58
|
-
type: zod.
|
|
59
|
-
value: zod.
|
|
80
|
+
zod.object({
|
|
81
|
+
type: zod.literal("error"),
|
|
82
|
+
value: zod.string().nonempty()
|
|
60
83
|
})
|
|
61
84
|
]).readonly();
|
|
62
|
-
const xResponsePayloadSchema = zod.
|
|
85
|
+
const xResponsePayloadSchema = zod.string().transform((val, ctx) => {
|
|
63
86
|
try {
|
|
64
87
|
return JSON.parse(val);
|
|
65
88
|
} catch {
|
|
@@ -67,7 +90,7 @@ const xResponsePayloadSchema = zod.z.string().transform((val, ctx) => {
|
|
|
67
90
|
code: "custom",
|
|
68
91
|
message: "Invalid JSON string"
|
|
69
92
|
});
|
|
70
|
-
return zod.
|
|
93
|
+
return zod.NEVER;
|
|
71
94
|
}
|
|
72
95
|
}).pipe(xResponseSchema);
|
|
73
96
|
var XConnection = class XConnection {
|
|
@@ -179,7 +202,7 @@ function safeParseXResponsePayload(data) {
|
|
|
179
202
|
const result = xResponsePayloadSchema.safeParse(data);
|
|
180
203
|
if (!result.success) return {
|
|
181
204
|
success: false,
|
|
182
|
-
error: new UWError("INVALID_RESPONSE", `invalid payload: ${zod.
|
|
205
|
+
error: new UWError("INVALID_RESPONSE", `invalid payload: ${zod.prettifyError(result.error)}`)
|
|
183
206
|
};
|
|
184
207
|
return {
|
|
185
208
|
success: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hash, Hex } from "viem";
|
|
2
|
-
import
|
|
2
|
+
import * as z from "zod";
|
|
3
3
|
//#region src/config.d.ts
|
|
4
4
|
type Env = "prod" | "dev";
|
|
5
5
|
interface Config {
|
|
@@ -32,7 +32,7 @@ interface EIP712TypedDataField {
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/error.d.ts
|
|
34
34
|
type UWErrorCode = "CONNECTION_TIMEOUT" | "CONNECTION_FAILED" | "CONNECTION_NOT_OPENED" | "CONNECTION_CLOSED" | "INVALID_REQUEST" | "REQUEST_IN_PROGRESS" | "REQUEST_REJECTED" | "INVALID_RESPONSE";
|
|
35
|
-
declare class UWError extends Error {
|
|
35
|
+
export declare class UWError extends Error {
|
|
36
36
|
readonly code: UWErrorCode;
|
|
37
37
|
constructor(code: UWErrorCode, msg?: string);
|
|
38
38
|
}
|
|
@@ -92,7 +92,7 @@ interface SignResult {
|
|
|
92
92
|
interface SendTransactionResult {
|
|
93
93
|
transactionID: string;
|
|
94
94
|
}
|
|
95
|
-
declare class UnWallet {
|
|
95
|
+
export declare class UnWallet {
|
|
96
96
|
private readonly env;
|
|
97
97
|
private readonly clientID;
|
|
98
98
|
private readonly xConnection;
|
|
@@ -129,4 +129,4 @@ declare class UnWallet {
|
|
|
129
129
|
close(): void;
|
|
130
130
|
}
|
|
131
131
|
//#endregion
|
|
132
|
-
export {
|
|
132
|
+
export type { AuthorizationResponseMode, Config, EIP712TypedData, EIP712TypedDataDomain, EIP712TypedDataField, Env, SendTransactionResult, SignResult, UWErrorCode };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hash, Hex } from "viem";
|
|
2
|
-
import
|
|
2
|
+
import * as z from "zod";
|
|
3
3
|
//#region src/config.d.ts
|
|
4
4
|
type Env = "prod" | "dev";
|
|
5
5
|
interface Config {
|
|
@@ -32,7 +32,7 @@ interface EIP712TypedDataField {
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/error.d.ts
|
|
34
34
|
type UWErrorCode = "CONNECTION_TIMEOUT" | "CONNECTION_FAILED" | "CONNECTION_NOT_OPENED" | "CONNECTION_CLOSED" | "INVALID_REQUEST" | "REQUEST_IN_PROGRESS" | "REQUEST_REJECTED" | "INVALID_RESPONSE";
|
|
35
|
-
declare class UWError extends Error {
|
|
35
|
+
export declare class UWError extends Error {
|
|
36
36
|
readonly code: UWErrorCode;
|
|
37
37
|
constructor(code: UWErrorCode, msg?: string);
|
|
38
38
|
}
|
|
@@ -92,7 +92,7 @@ interface SignResult {
|
|
|
92
92
|
interface SendTransactionResult {
|
|
93
93
|
transactionID: string;
|
|
94
94
|
}
|
|
95
|
-
declare class UnWallet {
|
|
95
|
+
export declare class UnWallet {
|
|
96
96
|
private readonly env;
|
|
97
97
|
private readonly clientID;
|
|
98
98
|
private readonly xConnection;
|
|
@@ -129,4 +129,4 @@ declare class UnWallet {
|
|
|
129
129
|
close(): void;
|
|
130
130
|
}
|
|
131
131
|
//#endregion
|
|
132
|
-
export {
|
|
132
|
+
export type { AuthorizationResponseMode, Config, EIP712TypedData, EIP712TypedDataDomain, EIP712TypedDataField, Env, SendTransactionResult, SignResult, UWErrorCode };
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unwallet-client-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "unWallet client-side SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SIVIRA",
|
|
@@ -29,22 +29,22 @@
|
|
|
29
29
|
"url": "git+https://github.com/SIVIRA/unwallet-client-sdk-js.git"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"viem": "2.
|
|
33
|
-
"zod": "4.
|
|
32
|
+
"viem": "2.56.5",
|
|
33
|
+
"zod": "4.6.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@commitlint/cli": "21.2.
|
|
37
|
-
"@commitlint/config-conventional": "21.2.
|
|
36
|
+
"@commitlint/cli": "21.2.2",
|
|
37
|
+
"@commitlint/config-conventional": "21.2.2",
|
|
38
38
|
"@commitlint/types": "21.2.0",
|
|
39
39
|
"@tsconfig/strictest": "2.0.8",
|
|
40
|
-
"@vitest/coverage-v8": "
|
|
41
|
-
"czg": "1.
|
|
40
|
+
"@vitest/coverage-v8": "5.0.0",
|
|
41
|
+
"czg": "1.14.0",
|
|
42
42
|
"husky": "9.1.7",
|
|
43
43
|
"msw": "2.15.0",
|
|
44
|
-
"publint": "0.3.
|
|
45
|
-
"tsdown": "0.
|
|
44
|
+
"publint": "0.3.24",
|
|
45
|
+
"tsdown": "0.23.0",
|
|
46
46
|
"typescript": "7.0.2",
|
|
47
|
-
"vitest": "
|
|
47
|
+
"vitest": "5.0.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {}
|
|
50
50
|
}
|