starknet 3.12.2 → 3.12.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [3.12.3](https://github.com/0xs34n/starknet.js/compare/v3.12.2...v3.12.3) (2022-05-30)
2
+
3
+ ### Bug Fixes
4
+
5
+ - remove superstruct ([6f13cf0](https://github.com/0xs34n/starknet.js/commit/6f13cf0ec740e715fcbdacf846cd9bcd653c1399))
6
+
1
7
  ## [3.12.2](https://github.com/0xs34n/starknet.js/compare/v3.12.1...v3.12.2) (2022-05-30)
2
8
 
3
9
  ### Bug Fixes
@@ -35,24 +35,7 @@ export declare const getTypeHash: (typedData: TypedData, type: string) => string
35
35
  * @param {string} type
36
36
  * @param {Record<string, any>} data
37
37
  */
38
- export declare const encodeData: <T extends {
39
- types: {
40
- StarkNetDomain: {
41
- type: string;
42
- name: string;
43
- }[];
44
- } & Record<string, {
45
- type: string;
46
- name: string;
47
- }[]>;
48
- primaryType: string;
49
- domain: {
50
- version?: string | undefined;
51
- chainId?: string | number | undefined;
52
- name?: string | undefined;
53
- };
54
- message: Record<string, unknown>;
55
- }>(typedData: T, type: string, data: T["message"]) => string[][];
38
+ export declare const encodeData: <T extends TypedData>(typedData: T, type: string, data: T["message"]) => string[][];
56
39
  /**
57
40
  * Get encoded data as a hash. The data should be a key -> value object with all the required values. All dependant
58
41
  * types are automatically encoded.
@@ -62,24 +45,7 @@ export declare const encodeData: <T extends {
62
45
  * @param {Record<string, any>} data
63
46
  * @return {Buffer}
64
47
  */
65
- export declare const getStructHash: <T extends {
66
- types: {
67
- StarkNetDomain: {
68
- type: string;
69
- name: string;
70
- }[];
71
- } & Record<string, {
72
- type: string;
73
- name: string;
74
- }[]>;
75
- primaryType: string;
76
- domain: {
77
- version?: string | undefined;
78
- chainId?: string | number | undefined;
79
- name?: string | undefined;
80
- };
81
- message: Record<string, unknown>;
82
- }>(typedData: T, type: string, data: T["message"]) => string;
48
+ export declare const getStructHash: <T extends TypedData>(typedData: T, type: string, data: T["message"]) => string;
83
49
  /**
84
50
  * Get the EIP-191 encoded message to sign, from the typedData object. If `hash` is enabled, the message will be hashed
85
51
  * with Keccak256.
@@ -1,82 +1,27 @@
1
- import { Infer } from 'superstruct';
2
- export declare const ATOMIC_TYPES: string[];
3
- /**
4
- * Checks if a type is valid with the given `typedData`. The following types are valid:
5
- * - Atomic types: felt, felt*
6
- * - Reference types: struct type (e.g. SomeStruct)
7
- *
8
- * @param {Record<string, unknown>} types
9
- * @param {string} type
10
- * @return {boolean}
11
- */
12
- export declare const isValidType: (types: Record<string, unknown>, type: string) => boolean;
13
- export declare const STARKNET_TYPE: import("superstruct").Struct<{
14
- type: string;
15
- name: string;
16
- }, {
17
- name: import("superstruct").Struct<string, null>;
18
- type: import("superstruct").Struct<string, null>;
19
- }>;
20
1
  /**
21
2
  * A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types.
22
3
  *
23
4
  * Note that the `uint` and `int` aliases like in Solidity, and fixed point numbers are not supported by the EIP-712
24
5
  * standard.
25
6
  */
26
- export declare type StarkNetType = Infer<typeof STARKNET_TYPE>;
27
- export declare const STARKNET_DOMAIN_TYPE: import("superstruct").Struct<{
28
- version?: string | undefined;
29
- chainId?: string | number | undefined;
30
- name?: string | undefined;
31
- }, {
32
- name: import("superstruct").Struct<string | undefined, null>;
33
- version: import("superstruct").Struct<string | undefined, null>;
34
- chainId: import("superstruct").Struct<string | number | undefined, null>;
35
- }>;
7
+ export interface StarkNetType {
8
+ name: string;
9
+ type: 'felt' | 'felt*' | string;
10
+ }
36
11
  /**
37
12
  * The EIP712 domain struct. Any of these fields are optional, but it must contain at least one field.
38
13
  */
39
- export declare type StarkNetDomain = Infer<typeof STARKNET_DOMAIN_TYPE>;
40
- export declare const STARKNET_TYPED_DATA_TYPE: import("superstruct").Struct<{
41
- types: {
42
- StarkNetDomain: {
43
- type: string;
44
- name: string;
45
- }[];
46
- } & Record<string, {
47
- type: string;
48
- name: string;
49
- }[]>;
50
- primaryType: string;
51
- domain: {
52
- version?: string | undefined;
53
- chainId?: string | number | undefined;
54
- name?: string | undefined;
55
- };
56
- message: Record<string, unknown>;
57
- }, {
58
- types: import("superstruct").Struct<{
59
- StarkNetDomain: {
60
- type: string;
61
- name: string;
62
- }[];
63
- } & Record<string, {
64
- type: string;
65
- name: string;
66
- }[]>, null>;
67
- primaryType: import("superstruct").Struct<string, null>;
68
- domain: import("superstruct").Struct<{
69
- version?: string | undefined;
70
- chainId?: string | number | undefined;
71
- name?: string | undefined;
72
- }, {
73
- name: import("superstruct").Struct<string | undefined, null>;
74
- version: import("superstruct").Struct<string | undefined, null>;
75
- chainId: import("superstruct").Struct<string | number | undefined, null>;
76
- }>;
77
- message: import("superstruct").Struct<Record<string, unknown>, null>;
78
- }>;
14
+ export interface StarkNetDomain extends Record<string, unknown> {
15
+ name?: string;
16
+ version?: string;
17
+ chainId?: string | number;
18
+ }
79
19
  /**
80
20
  * The complete typed data, with all the structs, domain data, primary type of the message, and the message itself.
81
21
  */
82
- export declare type TypedData = Infer<typeof STARKNET_TYPED_DATA_TYPE>;
22
+ export interface TypedData {
23
+ types: Record<string, StarkNetType[]>;
24
+ primaryType: string;
25
+ domain: StarkNetDomain;
26
+ message: Record<string, unknown>;
27
+ }
@@ -1,47 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STARKNET_TYPED_DATA_TYPE = exports.STARKNET_DOMAIN_TYPE = exports.STARKNET_TYPE = exports.isValidType = exports.ATOMIC_TYPES = void 0;
4
- var superstruct_1 = require("superstruct");
5
- exports.ATOMIC_TYPES = ['felt', 'felt*'];
6
- // Source: https://github.com/Mrtenz/eip-712/blob/master/src/eip-712.ts
7
- // and modified to support starknet types
8
- /**
9
- * Checks if a type is valid with the given `typedData`. The following types are valid:
10
- * - Atomic types: felt, felt*
11
- * - Reference types: struct type (e.g. SomeStruct)
12
- *
13
- * @param {Record<string, unknown>} types
14
- * @param {string} type
15
- * @return {boolean}
16
- */
17
- var isValidType = function (types, type) {
18
- if (exports.ATOMIC_TYPES.includes(type)) {
19
- return true;
20
- }
21
- if (types[type]) {
22
- return true;
23
- }
24
- return false;
25
- };
26
- exports.isValidType = isValidType;
27
- var TYPE = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'Type', function (type, context) {
28
- return (0, exports.isValidType)(context.branch[0].types, type);
29
- });
30
- exports.STARKNET_TYPE = (0, superstruct_1.object)({
31
- name: (0, superstruct_1.string)(),
32
- type: TYPE,
33
- });
34
- exports.STARKNET_DOMAIN_TYPE = (0, superstruct_1.object)({
35
- name: (0, superstruct_1.optional)((0, superstruct_1.string)()),
36
- version: (0, superstruct_1.optional)((0, superstruct_1.string)()),
37
- chainId: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
38
- });
39
- exports.STARKNET_TYPED_DATA_TYPE = (0, superstruct_1.object)({
40
- types: (0, superstruct_1.intersection)([
41
- (0, superstruct_1.type)({ StarkNetDomain: (0, superstruct_1.array)(exports.STARKNET_TYPE) }),
42
- (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.array)(exports.STARKNET_TYPE)),
43
- ]),
44
- primaryType: (0, superstruct_1.string)(),
45
- domain: exports.STARKNET_DOMAIN_TYPE,
46
- message: (0, superstruct_1.object)(),
47
- });
@@ -1,24 +1,8 @@
1
+ import { TypedData } from './types';
1
2
  /**
2
3
  * Validates that `data` matches the EIP-712 JSON schema.
3
4
  *
4
5
  * @param {any} data
5
6
  * @return {boolean}
6
7
  */
7
- export declare const validateTypedData: (data: unknown) => data is {
8
- types: {
9
- StarkNetDomain: {
10
- type: string;
11
- name: string;
12
- }[];
13
- } & Record<string, {
14
- type: string;
15
- name: string;
16
- }[]>;
17
- primaryType: string;
18
- domain: {
19
- version?: string | undefined;
20
- chainId?: string | number | undefined;
21
- name?: string | undefined;
22
- };
23
- message: Record<string, unknown>;
24
- };
8
+ export declare const validateTypedData: (data: unknown) => data is TypedData;
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateTypedData = void 0;
4
- var superstruct_1 = require("superstruct");
5
- var types_1 = require("./types");
6
4
  /**
7
5
  * Validates that `data` matches the EIP-712 JSON schema.
8
6
  *
@@ -10,6 +8,9 @@ var types_1 = require("./types");
10
8
  * @return {boolean}
11
9
  */
12
10
  var validateTypedData = function (data) {
13
- return (0, superstruct_1.is)(data, types_1.STARKNET_TYPED_DATA_TYPE);
11
+ var typedData = data;
12
+ // Validate that the data matches the EIP-712 JSON schema
13
+ var valid = Boolean(typedData.types && typedData.primaryType && typedData.message);
14
+ return valid;
14
15
  };
15
16
  exports.validateTypedData = validateTypedData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starknet",
3
- "version": "3.12.2",
3
+ "version": "3.12.3",
4
4
  "description": "JavaScript library for StarkNet",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -71,7 +71,6 @@
71
71
  "json-bigint": "^1.0.0",
72
72
  "minimalistic-assert": "^1.0.1",
73
73
  "pako": "^2.0.4",
74
- "superstruct": "^0.15.3",
75
74
  "url-join": "^4.0.1"
76
75
  },
77
76
  "lint-staged": {
@@ -1,82 +1,29 @@
1
- import {
2
- Infer,
3
- array,
4
- intersection,
5
- number,
6
- object,
7
- optional,
8
- record,
9
- refine,
10
- string,
11
- type as t,
12
- union,
13
- } from 'superstruct';
14
-
15
- export const ATOMIC_TYPES = ['felt', 'felt*'];
16
-
17
- // Source: https://github.com/Mrtenz/eip-712/blob/master/src/eip-712.ts
18
- // and modified to support starknet types
19
-
20
- /**
21
- * Checks if a type is valid with the given `typedData`. The following types are valid:
22
- * - Atomic types: felt, felt*
23
- * - Reference types: struct type (e.g. SomeStruct)
24
- *
25
- * @param {Record<string, unknown>} types
26
- * @param {string} type
27
- * @return {boolean}
28
- */
29
- export const isValidType = (types: Record<string, unknown>, type: string): boolean => {
30
- if (ATOMIC_TYPES.includes(type as string)) {
31
- return true;
32
- }
33
-
34
- if (types[type]) {
35
- return true;
36
- }
37
-
38
- return false;
39
- };
40
-
41
- const TYPE = refine(string(), 'Type', (type, context) => {
42
- return isValidType(context.branch[0].types, type);
43
- });
44
-
45
- export const STARKNET_TYPE = object({
46
- name: string(),
47
- type: TYPE,
48
- });
49
-
50
1
  /**
51
2
  * A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types.
52
3
  *
53
4
  * Note that the `uint` and `int` aliases like in Solidity, and fixed point numbers are not supported by the EIP-712
54
5
  * standard.
55
6
  */
56
- export type StarkNetType = Infer<typeof STARKNET_TYPE>;
57
-
58
- export const STARKNET_DOMAIN_TYPE = object({
59
- name: optional(string()),
60
- version: optional(string()),
61
- chainId: optional(union([string(), number()])),
62
- });
7
+ export interface StarkNetType {
8
+ name: string;
9
+ type: 'felt' | 'felt*' | string;
10
+ }
63
11
 
64
12
  /**
65
13
  * The EIP712 domain struct. Any of these fields are optional, but it must contain at least one field.
66
14
  */
67
- export type StarkNetDomain = Infer<typeof STARKNET_DOMAIN_TYPE>;
68
-
69
- export const STARKNET_TYPED_DATA_TYPE = object({
70
- types: intersection([
71
- t({ StarkNetDomain: array(STARKNET_TYPE) }),
72
- record(string(), array(STARKNET_TYPE)),
73
- ]),
74
- primaryType: string(),
75
- domain: STARKNET_DOMAIN_TYPE,
76
- message: object(),
77
- });
15
+ export interface StarkNetDomain extends Record<string, unknown> {
16
+ name?: string;
17
+ version?: string;
18
+ chainId?: string | number;
19
+ }
78
20
 
79
21
  /**
80
22
  * The complete typed data, with all the structs, domain data, primary type of the message, and the message itself.
81
23
  */
82
- export type TypedData = Infer<typeof STARKNET_TYPED_DATA_TYPE>;
24
+ export interface TypedData {
25
+ types: Record<string, StarkNetType[]>;
26
+ primaryType: string;
27
+ domain: StarkNetDomain;
28
+ message: Record<string, unknown>;
29
+ }
@@ -1,6 +1,4 @@
1
- import { is } from 'superstruct';
2
-
3
- import { STARKNET_TYPED_DATA_TYPE, TypedData } from './types';
1
+ import { TypedData } from './types';
4
2
 
5
3
  /**
6
4
  * Validates that `data` matches the EIP-712 JSON schema.
@@ -9,5 +7,10 @@ import { STARKNET_TYPED_DATA_TYPE, TypedData } from './types';
9
7
  * @return {boolean}
10
8
  */
11
9
  export const validateTypedData = (data: unknown): data is TypedData => {
12
- return is(data, STARKNET_TYPED_DATA_TYPE);
10
+ const typedData = data as TypedData;
11
+
12
+ // Validate that the data matches the EIP-712 JSON schema
13
+ const valid = Boolean(typedData.types && typedData.primaryType && typedData.message);
14
+
15
+ return valid;
13
16
  };
@@ -39,29 +39,7 @@ export declare const getTypeHash: (typedData: TypedData, type: string) => string
39
39
  * @param {string} type
40
40
  * @param {Record<string, any>} data
41
41
  */
42
- export declare const encodeData: <
43
- T extends {
44
- types: {
45
- StarkNetDomain: {
46
- type: string;
47
- name: string;
48
- }[];
49
- } & Record<
50
- string,
51
- {
52
- type: string;
53
- name: string;
54
- }[]
55
- >;
56
- primaryType: string;
57
- domain: {
58
- version?: string | undefined;
59
- chainId?: string | number | undefined;
60
- name?: string | undefined;
61
- };
62
- message: Record<string, unknown>;
63
- }
64
- >(
42
+ export declare const encodeData: <T extends TypedData>(
65
43
  typedData: T,
66
44
  type: string,
67
45
  data: T['message']
@@ -75,29 +53,7 @@ export declare const encodeData: <
75
53
  * @param {Record<string, any>} data
76
54
  * @return {Buffer}
77
55
  */
78
- export declare const getStructHash: <
79
- T extends {
80
- types: {
81
- StarkNetDomain: {
82
- type: string;
83
- name: string;
84
- }[];
85
- } & Record<
86
- string,
87
- {
88
- type: string;
89
- name: string;
90
- }[]
91
- >;
92
- primaryType: string;
93
- domain: {
94
- version?: string | undefined;
95
- chainId?: string | number | undefined;
96
- name?: string | undefined;
97
- };
98
- message: Record<string, unknown>;
99
- }
100
- >(
56
+ export declare const getStructHash: <T extends TypedData>(
101
57
  typedData: T,
102
58
  type: string,
103
59
  data: T['message']
@@ -1,103 +1,27 @@
1
- import { Infer } from 'superstruct';
2
- export declare const ATOMIC_TYPES: string[];
3
- /**
4
- * Checks if a type is valid with the given `typedData`. The following types are valid:
5
- * - Atomic types: felt, felt*
6
- * - Reference types: struct type (e.g. SomeStruct)
7
- *
8
- * @param {Record<string, unknown>} types
9
- * @param {string} type
10
- * @return {boolean}
11
- */
12
- export declare const isValidType: (types: Record<string, unknown>, type: string) => boolean;
13
- export declare const STARKNET_TYPE: import('superstruct').Struct<
14
- {
15
- type: string;
16
- name: string;
17
- },
18
- {
19
- name: import('superstruct').Struct<string, null>;
20
- type: import('superstruct').Struct<string, null>;
21
- }
22
- >;
23
1
  /**
24
2
  * A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types.
25
3
  *
26
4
  * Note that the `uint` and `int` aliases like in Solidity, and fixed point numbers are not supported by the EIP-712
27
5
  * standard.
28
6
  */
29
- export declare type StarkNetType = Infer<typeof STARKNET_TYPE>;
30
- export declare const STARKNET_DOMAIN_TYPE: import('superstruct').Struct<
31
- {
32
- version?: string | undefined;
33
- chainId?: string | number | undefined;
34
- name?: string | undefined;
35
- },
36
- {
37
- name: import('superstruct').Struct<string | undefined, null>;
38
- version: import('superstruct').Struct<string | undefined, null>;
39
- chainId: import('superstruct').Struct<string | number | undefined, null>;
40
- }
41
- >;
7
+ export interface StarkNetType {
8
+ name: string;
9
+ type: 'felt' | 'felt*' | string;
10
+ }
42
11
  /**
43
12
  * The EIP712 domain struct. Any of these fields are optional, but it must contain at least one field.
44
13
  */
45
- export declare type StarkNetDomain = Infer<typeof STARKNET_DOMAIN_TYPE>;
46
- export declare const STARKNET_TYPED_DATA_TYPE: import('superstruct').Struct<
47
- {
48
- types: {
49
- StarkNetDomain: {
50
- type: string;
51
- name: string;
52
- }[];
53
- } & Record<
54
- string,
55
- {
56
- type: string;
57
- name: string;
58
- }[]
59
- >;
60
- primaryType: string;
61
- domain: {
62
- version?: string | undefined;
63
- chainId?: string | number | undefined;
64
- name?: string | undefined;
65
- };
66
- message: Record<string, unknown>;
67
- },
68
- {
69
- types: import('superstruct').Struct<
70
- {
71
- StarkNetDomain: {
72
- type: string;
73
- name: string;
74
- }[];
75
- } & Record<
76
- string,
77
- {
78
- type: string;
79
- name: string;
80
- }[]
81
- >,
82
- null
83
- >;
84
- primaryType: import('superstruct').Struct<string, null>;
85
- domain: import('superstruct').Struct<
86
- {
87
- version?: string | undefined;
88
- chainId?: string | number | undefined;
89
- name?: string | undefined;
90
- },
91
- {
92
- name: import('superstruct').Struct<string | undefined, null>;
93
- version: import('superstruct').Struct<string | undefined, null>;
94
- chainId: import('superstruct').Struct<string | number | undefined, null>;
95
- }
96
- >;
97
- message: import('superstruct').Struct<Record<string, unknown>, null>;
98
- }
99
- >;
14
+ export interface StarkNetDomain extends Record<string, unknown> {
15
+ name?: string;
16
+ version?: string;
17
+ chainId?: string | number;
18
+ }
100
19
  /**
101
20
  * The complete typed data, with all the structs, domain data, primary type of the message, and the message itself.
102
21
  */
103
- export declare type TypedData = Infer<typeof STARKNET_TYPED_DATA_TYPE>;
22
+ export interface TypedData {
23
+ types: Record<string, StarkNetType[]>;
24
+ primaryType: string;
25
+ domain: StarkNetDomain;
26
+ message: Record<string, unknown>;
27
+ }
@@ -1,57 +1,2 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, '__esModule', { value: true });
3
- exports.STARKNET_TYPED_DATA_TYPE =
4
- exports.STARKNET_DOMAIN_TYPE =
5
- exports.STARKNET_TYPE =
6
- exports.isValidType =
7
- exports.ATOMIC_TYPES =
8
- void 0;
9
- var superstruct_1 = require('superstruct');
10
- exports.ATOMIC_TYPES = ['felt', 'felt*'];
11
- // Source: https://github.com/Mrtenz/eip-712/blob/master/src/eip-712.ts
12
- // and modified to support starknet types
13
- /**
14
- * Checks if a type is valid with the given `typedData`. The following types are valid:
15
- * - Atomic types: felt, felt*
16
- * - Reference types: struct type (e.g. SomeStruct)
17
- *
18
- * @param {Record<string, unknown>} types
19
- * @param {string} type
20
- * @return {boolean}
21
- */
22
- var isValidType = function (types, type) {
23
- if (exports.ATOMIC_TYPES.includes(type)) {
24
- return true;
25
- }
26
- if (types[type]) {
27
- return true;
28
- }
29
- return false;
30
- };
31
- exports.isValidType = isValidType;
32
- var TYPE = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'Type', function (type, context) {
33
- return (0, exports.isValidType)(context.branch[0].types, type);
34
- });
35
- exports.STARKNET_TYPE = (0, superstruct_1.object)({
36
- name: (0, superstruct_1.string)(),
37
- type: TYPE,
38
- });
39
- exports.STARKNET_DOMAIN_TYPE = (0, superstruct_1.object)({
40
- name: (0, superstruct_1.optional)((0, superstruct_1.string)()),
41
- version: (0, superstruct_1.optional)((0, superstruct_1.string)()),
42
- chainId: (0, superstruct_1.optional)(
43
- (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])
44
- ),
45
- });
46
- exports.STARKNET_TYPED_DATA_TYPE = (0, superstruct_1.object)({
47
- types: (0, superstruct_1.intersection)([
48
- (0, superstruct_1.type)({ StarkNetDomain: (0, superstruct_1.array)(exports.STARKNET_TYPE) }),
49
- (0, superstruct_1.record)(
50
- (0, superstruct_1.string)(),
51
- (0, superstruct_1.array)(exports.STARKNET_TYPE)
52
- ),
53
- ]),
54
- primaryType: (0, superstruct_1.string)(),
55
- domain: exports.STARKNET_DOMAIN_TYPE,
56
- message: (0, superstruct_1.object)(),
57
- });
@@ -1,27 +1,8 @@
1
+ import { TypedData } from './types';
1
2
  /**
2
3
  * Validates that `data` matches the EIP-712 JSON schema.
3
4
  *
4
5
  * @param {any} data
5
6
  * @return {boolean}
6
7
  */
7
- export declare const validateTypedData: (data: unknown) => data is {
8
- types: {
9
- StarkNetDomain: {
10
- type: string;
11
- name: string;
12
- }[];
13
- } & Record<
14
- string,
15
- {
16
- type: string;
17
- name: string;
18
- }[]
19
- >;
20
- primaryType: string;
21
- domain: {
22
- version?: string | undefined;
23
- chainId?: string | number | undefined;
24
- name?: string | undefined;
25
- };
26
- message: Record<string, unknown>;
27
- };
8
+ export declare const validateTypedData: (data: unknown) => data is TypedData;
@@ -1,8 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.validateTypedData = void 0;
4
- var superstruct_1 = require('superstruct');
5
- var types_1 = require('./types');
6
4
  /**
7
5
  * Validates that `data` matches the EIP-712 JSON schema.
8
6
  *
@@ -10,6 +8,9 @@ var types_1 = require('./types');
10
8
  * @return {boolean}
11
9
  */
12
10
  var validateTypedData = function (data) {
13
- return (0, superstruct_1.is)(data, types_1.STARKNET_TYPED_DATA_TYPE);
11
+ var typedData = data;
12
+ // Validate that the data matches the EIP-712 JSON schema
13
+ var valid = Boolean(typedData.types && typedData.primaryType && typedData.message);
14
+ return valid;
14
15
  };
15
16
  exports.validateTypedData = validateTypedData;