@xyo-network/xl1-protocol-sdk 1.15.21 → 1.15.23
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/neutral/eip-712/Payloads/EIP712Data.d.ts +39 -0
- package/dist/neutral/eip-712/Payloads/EIP712Data.d.ts.map +1 -0
- package/dist/neutral/eip-712/Payloads/EIP712Signature.d.ts +22 -0
- package/dist/neutral/eip-712/Payloads/EIP712Signature.d.ts.map +1 -0
- package/dist/neutral/eip-712/Payloads/index.d.ts +3 -0
- package/dist/neutral/eip-712/Payloads/index.d.ts.map +1 -0
- package/dist/neutral/eip-712/Types.d.ts +21 -4
- package/dist/neutral/eip-712/Types.d.ts.map +1 -1
- package/dist/neutral/eip-712/index.d.ts +1 -1
- package/dist/neutral/eip-712/index.d.ts.map +1 -1
- package/dist/neutral/eip-712/sign.d.ts +2 -2
- package/dist/neutral/eip-712/sign.d.ts.map +1 -1
- package/dist/neutral/eip-712/spec/fixtures.d.ts +2 -2
- package/dist/neutral/eip-712/spec/fixtures.d.ts.map +1 -1
- package/dist/neutral/eip-712/verify.d.ts +2 -3
- package/dist/neutral/eip-712/verify.d.ts.map +1 -1
- package/dist/neutral/index.mjs +105 -39
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/block/primitives/blockFromBlockNumber.ts +2 -2
- package/src/config/storage/driver/Mongo.ts +5 -5
- package/src/eip-712/Payloads/EIP712Data.ts +45 -0
- package/src/eip-712/Payloads/EIP712Signature.ts +24 -0
- package/src/eip-712/Payloads/index.ts +2 -0
- package/src/eip-712/Types.ts +26 -4
- package/src/eip-712/index.ts +1 -1
- package/src/eip-712/sign.ts +9 -6
- package/src/eip-712/spec/fixtures.ts +5 -5
- package/src/eip-712/spec/signAndVerify.spec.ts +1 -1
- package/src/eip-712/verify.ts +13 -5
- package/dist/neutral/eip-712/Payload.d.ts +0 -24
- package/dist/neutral/eip-712/Payload.d.ts.map +0 -1
- package/src/eip-712/Payload.ts +0 -31
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/xl1-protocol-sdk",
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.23",
|
|
5
5
|
"description": "XYO Layer One SDK Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -36,35 +36,35 @@
|
|
|
36
36
|
"src"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@xylabs/array": "~5.0.
|
|
40
|
-
"@xylabs/arraybuffer": "~5.0.
|
|
41
|
-
"@xylabs/assert": "~5.0.
|
|
42
|
-
"@xylabs/delay": "~5.0.
|
|
43
|
-
"@xylabs/hex": "~5.0.
|
|
44
|
-
"@xylabs/logger": "~5.0.
|
|
45
|
-
"@xylabs/object": "~5.0.
|
|
46
|
-
"@xylabs/promise": "~5.0.
|
|
47
|
-
"@xylabs/telemetry": "~5.0.
|
|
48
|
-
"@xylabs/typeof": "~5.0.
|
|
49
|
-
"@xyo-network/account-model": "~5.1.
|
|
50
|
-
"@xyo-network/archivist-model": "~5.1.
|
|
51
|
-
"@xyo-network/boundwitness-builder": "~5.1.
|
|
52
|
-
"@xyo-network/boundwitness-model": "~5.1.
|
|
53
|
-
"@xyo-network/payload-builder": "~5.1.
|
|
54
|
-
"@xyo-network/payload-model": "~5.1.
|
|
55
|
-
"@xyo-network/wallet": "~5.1.
|
|
56
|
-
"@xyo-network/wallet-model": "~5.1.
|
|
57
|
-
"@xyo-network/xl1-protocol": "~1.12.
|
|
39
|
+
"@xylabs/array": "~5.0.17",
|
|
40
|
+
"@xylabs/arraybuffer": "~5.0.17",
|
|
41
|
+
"@xylabs/assert": "~5.0.17",
|
|
42
|
+
"@xylabs/delay": "~5.0.17",
|
|
43
|
+
"@xylabs/hex": "~5.0.17",
|
|
44
|
+
"@xylabs/logger": "~5.0.17",
|
|
45
|
+
"@xylabs/object": "~5.0.17",
|
|
46
|
+
"@xylabs/promise": "~5.0.17",
|
|
47
|
+
"@xylabs/telemetry": "~5.0.17",
|
|
48
|
+
"@xylabs/typeof": "~5.0.17",
|
|
49
|
+
"@xyo-network/account-model": "~5.1.15",
|
|
50
|
+
"@xyo-network/archivist-model": "~5.1.15",
|
|
51
|
+
"@xyo-network/boundwitness-builder": "~5.1.15",
|
|
52
|
+
"@xyo-network/boundwitness-model": "~5.1.15",
|
|
53
|
+
"@xyo-network/payload-builder": "~5.1.15",
|
|
54
|
+
"@xyo-network/payload-model": "~5.1.15",
|
|
55
|
+
"@xyo-network/wallet": "~5.1.15",
|
|
56
|
+
"@xyo-network/wallet-model": "~5.1.15",
|
|
57
|
+
"@xyo-network/xl1-protocol": "~1.12.89",
|
|
58
58
|
"async-mutex": "~0.5.0",
|
|
59
59
|
"ethers": "~6.15.0",
|
|
60
60
|
"zod": "~4.1.12"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@types/node": "~24.9.
|
|
63
|
+
"@types/node": "~24.9.2",
|
|
64
64
|
"@xylabs/ts-scripts-yarn3": "~7.1.8",
|
|
65
65
|
"@xylabs/tsconfig": "~7.1.8",
|
|
66
|
-
"@xyo-network/account": "~5.1.
|
|
67
|
-
"@xyo-network/boundwitness-validator": "~5.1.
|
|
66
|
+
"@xyo-network/account": "~5.1.15",
|
|
67
|
+
"@xyo-network/boundwitness-validator": "~5.1.15",
|
|
68
68
|
"eslint": "^9.38.0",
|
|
69
69
|
"typescript": "~5.9.3",
|
|
70
70
|
"vitest": "~3.2.4"
|
|
@@ -17,7 +17,7 @@ export async function blockFromBlockNumber(context: ChainContextRead, blockNumbe
|
|
|
17
17
|
let jumpHash: Hash | null = currentBlock.previous
|
|
18
18
|
let jumpBlockNumber = currentBlock.block - 1
|
|
19
19
|
for (const [step, stepSize] of StepSizes.entries()) {
|
|
20
|
-
const possibleJumpBlockNumber = currentBlock.block - stepSize
|
|
20
|
+
const possibleJumpBlockNumber = currentBlock.block - (currentBlock.block % stepSize) - 1
|
|
21
21
|
if (possibleJumpBlockNumber >= blockNumber && possibleJumpBlockNumber <= jumpBlockNumber) {
|
|
22
22
|
jumpBlockNumber = possibleJumpBlockNumber
|
|
23
23
|
jumpHash = asHash(currentBlock.step_hashes.at(step), () => `Step hash not found for step ${step} in block ${currentBlock.block}`)
|
|
@@ -31,7 +31,7 @@ export async function blockFromBlockNumber(context: ChainContextRead, blockNumbe
|
|
|
31
31
|
break
|
|
32
32
|
}
|
|
33
33
|
if (currentBlock.block < blockNumber) {
|
|
34
|
-
throw new Error(`Block number ${blockNumber} is not a valid step block number for block ${
|
|
34
|
+
throw new Error(`Block number ${blockNumber} is not a valid step block number for block ${head}.`)
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
return currentBlock
|
|
@@ -22,27 +22,27 @@ export const hasMongoConfig = (config?: MongoConfig): config is Required<MongoCo
|
|
|
22
22
|
|
|
23
23
|
export const MongoConfigZod = z.object({
|
|
24
24
|
// TODO: Create from other arguments
|
|
25
|
-
connectionString: z.string().
|
|
25
|
+
connectionString: z.string().nonempty().optional().register(globalRegistry, {
|
|
26
26
|
description: 'MongoDB connection string',
|
|
27
27
|
title: 'storage.mongo.connectionString',
|
|
28
28
|
type: 'string',
|
|
29
29
|
}),
|
|
30
|
-
database: z.string().
|
|
30
|
+
database: z.string().nonempty().optional().register(globalRegistry, {
|
|
31
31
|
description: 'MongoDB database name',
|
|
32
32
|
title: 'storage.mongo.database',
|
|
33
33
|
type: 'string',
|
|
34
34
|
}),
|
|
35
|
-
domain: z.string().
|
|
35
|
+
domain: z.string().nonempty().optional().register(globalRegistry, {
|
|
36
36
|
description: 'MongoDB domain',
|
|
37
37
|
title: 'storage.mongo.domain',
|
|
38
38
|
type: 'string',
|
|
39
39
|
}),
|
|
40
|
-
password: z.string().
|
|
40
|
+
password: z.string().nonempty().optional().register(globalRegistry, {
|
|
41
41
|
description: 'MongoDB password',
|
|
42
42
|
title: 'storage.mongo.password',
|
|
43
43
|
type: 'string',
|
|
44
44
|
}),
|
|
45
|
-
username: z.string().
|
|
45
|
+
username: z.string().nonempty().optional().register(globalRegistry, {
|
|
46
46
|
description: 'MongoDB username',
|
|
47
47
|
title: 'storage.mongo.username',
|
|
48
48
|
type: 'string',
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AsObjectFactory } from '@xylabs/object'
|
|
2
|
+
import { isPayloadOfZodType, type Payload } from '@xyo-network/payload-model'
|
|
3
|
+
import z from 'zod'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
TypedDataDomainZod, TypedDataTypesZod, TypedDataValueZod,
|
|
7
|
+
} from '../Types.ts'
|
|
8
|
+
|
|
9
|
+
export const EIP712DataPayloadFieldsZod = z.object({
|
|
10
|
+
domain: TypedDataDomainZod,
|
|
11
|
+
types: TypedDataTypesZod,
|
|
12
|
+
values: TypedDataValueZod,
|
|
13
|
+
})
|
|
14
|
+
export type EIP712DataPayloadFields = z.infer<typeof EIP712DataPayloadFieldsZod>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use EIP712DataPayloadFields instead
|
|
18
|
+
*/
|
|
19
|
+
export type EIP712PayloadFields = EIP712DataPayloadFields
|
|
20
|
+
|
|
21
|
+
export const EIP712DataPayloadSchema = 'network.xyo.chains.ethereum.eip712.data' as const
|
|
22
|
+
export type EIP712DataPayloadSchema = typeof EIP712DataPayloadSchema
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use EIP712DataPayloadSchema instead
|
|
26
|
+
*/
|
|
27
|
+
export const EIP712PayloadSchema = EIP712DataPayloadSchema
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use EIP712DataPayloadSchema instead
|
|
30
|
+
*/
|
|
31
|
+
export type EIP712PayloadSchema = typeof EIP712DataPayloadSchema
|
|
32
|
+
|
|
33
|
+
export type EIP712DataPayload = Payload<EIP712DataPayloadFields, EIP712DataPayloadSchema>
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use EIP712DataPayload instead
|
|
37
|
+
*/
|
|
38
|
+
export type EIP712Payload = EIP712DataPayload
|
|
39
|
+
|
|
40
|
+
export const isEIP712DataPayload = isPayloadOfZodType<EIP712DataPayload>(
|
|
41
|
+
EIP712DataPayloadFieldsZod,
|
|
42
|
+
EIP712DataPayloadSchema,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
export const asEIP712DataPayload = AsObjectFactory.create(isEIP712DataPayload)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HashZod } from '@xylabs/hex'
|
|
2
|
+
import { AsObjectFactory } from '@xylabs/object'
|
|
3
|
+
import { isPayloadOfZodType, type Payload } from '@xyo-network/payload-model'
|
|
4
|
+
import z from 'zod'
|
|
5
|
+
|
|
6
|
+
export const EIP712SignaturePayloadFieldsZod = z.object({
|
|
7
|
+
address: z.string(),
|
|
8
|
+
hash: HashZod,
|
|
9
|
+
signature: z.string(),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export type EIP712SignaturePayloadFields = z.infer<typeof EIP712SignaturePayloadFieldsZod>
|
|
13
|
+
|
|
14
|
+
export const EIP712SignaturePayloadSchema = 'network.xyo.chains.ethereum.eip712.signature' as const
|
|
15
|
+
export type EIP712SignaturePayloadSchema = typeof EIP712SignaturePayloadSchema
|
|
16
|
+
|
|
17
|
+
export type EIP712SignaturePayload = Payload<EIP712SignaturePayloadFields, EIP712SignaturePayloadSchema>
|
|
18
|
+
|
|
19
|
+
export const isEIP712SignaturePayload = isPayloadOfZodType<EIP712SignaturePayload>(
|
|
20
|
+
EIP712SignaturePayloadFieldsZod,
|
|
21
|
+
EIP712SignaturePayloadSchema,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
export const asEIP712SignaturePayload = AsObjectFactory.create(isEIP712SignaturePayload)
|
package/src/eip-712/Types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Signer } from 'ethers/providers'
|
|
1
|
+
// import type { Signer } from 'ethers/providers'
|
|
2
|
+
import z from 'zod'
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Typed Data Types
|
|
@@ -6,6 +7,27 @@ import type { Signer } from 'ethers/providers'
|
|
|
6
7
|
* we can fix in one place if they change
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
|
-
export type TypedDataDomain = Parameters<Signer['signTypedData']>[0]
|
|
10
|
-
export type TypedDataTypes = Parameters<Signer['signTypedData']>[1]
|
|
11
|
-
export type TypedDataValues = Parameters<Signer['signTypedData']>[2]
|
|
10
|
+
// export type TypedDataDomain = Parameters<Signer['signTypedData']>[0]
|
|
11
|
+
// export type TypedDataTypes = Parameters<Signer['signTypedData']>[1]
|
|
12
|
+
// export type TypedDataValues = Parameters<Signer['signTypedData']>[2]
|
|
13
|
+
|
|
14
|
+
export const TypedDataDomainZod = z.object({
|
|
15
|
+
name: z.string().nullable().optional(),
|
|
16
|
+
version: z.string().nullable().optional(),
|
|
17
|
+
chainId: z.union([z.string(), z.number(), z.bigint()]).nullable().optional(),
|
|
18
|
+
verifyingContract: z.string().nullable().optional(),
|
|
19
|
+
salt: z.union([z.string(), z.instanceof(Uint8Array)]).nullable().optional(),
|
|
20
|
+
})
|
|
21
|
+
export type TypedDataDomain = z.infer<typeof TypedDataDomainZod>
|
|
22
|
+
|
|
23
|
+
export const TypedDataFieldZod = z.object({
|
|
24
|
+
name: z.string(),
|
|
25
|
+
type: z.string(),
|
|
26
|
+
})
|
|
27
|
+
export type TypedDataField = z.infer<typeof TypedDataFieldZod>
|
|
28
|
+
|
|
29
|
+
export const TypedDataTypesZod = z.record(z.string(), z.array(TypedDataFieldZod))
|
|
30
|
+
export type TypedDataTypes = z.infer<typeof TypedDataTypesZod>
|
|
31
|
+
|
|
32
|
+
export const TypedDataValueZod = z.record(z.string(), z.any())
|
|
33
|
+
export type TypedDataValues = z.infer<typeof TypedDataValueZod>
|
package/src/eip-712/index.ts
CHANGED
package/src/eip-712/sign.ts
CHANGED
|
@@ -2,14 +2,17 @@ import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
|
2
2
|
import type { Signer } from 'ethers/providers'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
type
|
|
6
|
-
} from './
|
|
5
|
+
type EIP712DataPayload, type EIP712SignaturePayload, EIP712SignaturePayloadSchema,
|
|
6
|
+
} from './Payloads/index.ts'
|
|
7
7
|
|
|
8
|
-
export const signEIP712Message = async (signer: Signer, data:
|
|
9
|
-
const {
|
|
10
|
-
|
|
8
|
+
export const signEIP712Message = async (signer: Signer, data: EIP712DataPayload): Promise<EIP712SignaturePayload> => {
|
|
9
|
+
const {
|
|
10
|
+
domain, types, values,
|
|
11
|
+
} = data
|
|
12
|
+
const signature = await signer.signTypedData(domain, types, values)
|
|
11
13
|
const hash = await PayloadBuilder.hash(data)
|
|
14
|
+
const address = await signer.getAddress()
|
|
12
15
|
return {
|
|
13
|
-
address
|
|
16
|
+
address, hash, schema: EIP712SignaturePayloadSchema, signature,
|
|
14
17
|
}
|
|
15
18
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Wallet } from 'ethers/wallet'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
3
|
+
import type { EIP712DataPayload } from '../Payloads/index.ts'
|
|
4
|
+
import { EIP712DataPayloadSchema } from '../Payloads/index.ts'
|
|
5
5
|
|
|
6
6
|
const mnemonic = 'test test test test test test test test test test test junk'
|
|
7
7
|
|
|
8
8
|
export const wallet = Wallet.fromPhrase(mnemonic)
|
|
9
9
|
|
|
10
|
-
export const samplePayload:
|
|
11
|
-
schema:
|
|
10
|
+
export const samplePayload: EIP712DataPayload = {
|
|
11
|
+
schema: EIP712DataPayloadSchema,
|
|
12
12
|
domain: {
|
|
13
13
|
name: 'MyDApp',
|
|
14
14
|
version: '1',
|
|
@@ -22,6 +22,6 @@ export const samplePayload: EIP712Payload = {
|
|
|
22
22
|
},
|
|
23
23
|
values: {
|
|
24
24
|
hash: '0x1234567890abcdef',
|
|
25
|
-
schema:
|
|
25
|
+
schema: EIP712DataPayloadSchema,
|
|
26
26
|
},
|
|
27
27
|
}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
describe, expect, it,
|
|
3
3
|
} from 'vitest'
|
|
4
4
|
|
|
5
|
-
import { EIP712SignaturePayloadSchema } from '../
|
|
5
|
+
import { EIP712SignaturePayloadSchema } from '../Payloads/index.ts'
|
|
6
6
|
import { signEIP712Message } from '../sign.ts'
|
|
7
7
|
import { verifyEIP712Message } from '../verify.ts'
|
|
8
8
|
import { samplePayload, wallet } from './fixtures.ts'
|
package/src/eip-712/verify.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { asHash } from '@xylabs/hex'
|
|
2
|
+
import { isUndefined } from '@xylabs/typeof'
|
|
3
|
+
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
2
4
|
import { verifyTypedData } from 'ethers/hash'
|
|
3
5
|
|
|
4
|
-
import type {
|
|
6
|
+
import type { EIP712DataPayload, EIP712SignaturePayload } from './Payloads/index.ts'
|
|
5
7
|
|
|
6
|
-
export const verifyEIP712Message = (data:
|
|
7
|
-
const {
|
|
8
|
+
export const verifyEIP712Message = async (data: EIP712DataPayload, sig: EIP712SignaturePayload): Promise<boolean> => {
|
|
9
|
+
const {
|
|
10
|
+
address, signature, hash,
|
|
11
|
+
} = sig
|
|
8
12
|
const { schema, ...fields } = data
|
|
9
|
-
|
|
13
|
+
const signedHash = asHash(hash)
|
|
14
|
+
// If there is no valid hash in the signature, or it doesn't match the calculated hash, return false
|
|
15
|
+
if (isUndefined(signedHash) || signedHash !== await PayloadBuilder.hash(data)) return false
|
|
16
|
+
// Recover the address from the signature
|
|
10
17
|
const recoveredAddress = verifyTypedData(fields.domain, fields.types, fields.values, signature)
|
|
18
|
+
// Verify it matches the expected address
|
|
11
19
|
return recoveredAddress.toLowerCase() === address.toLowerCase()
|
|
12
20
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Hash } from '@xylabs/hex';
|
|
2
|
-
import type { TypedDataDomain } from 'ethers/hash';
|
|
3
|
-
import type { TypedDataTypes, TypedDataValues } from './Types.ts';
|
|
4
|
-
export interface EIP712PayloadFields<T extends TypedDataTypes = TypedDataTypes, V extends TypedDataValues = TypedDataValues> {
|
|
5
|
-
domain: TypedDataDomain;
|
|
6
|
-
types: T;
|
|
7
|
-
values: V;
|
|
8
|
-
}
|
|
9
|
-
export declare const EIP712PayloadSchema: "network.xyo.chains.ethereum.eip712.payload";
|
|
10
|
-
export type EIP712PayloadSchema = typeof EIP712PayloadSchema;
|
|
11
|
-
export type EIP712Payload = EIP712PayloadFields & {
|
|
12
|
-
schema: EIP712PayloadSchema;
|
|
13
|
-
};
|
|
14
|
-
export interface EIP712SignaturePayloadFields {
|
|
15
|
-
address: string;
|
|
16
|
-
hash: Hash;
|
|
17
|
-
signature: string;
|
|
18
|
-
}
|
|
19
|
-
export declare const EIP712SignaturePayloadSchema: "network.xyo.chains.ethereum.eip712.signaturePayload";
|
|
20
|
-
export type EIP712SignaturePayloadSchema = typeof EIP712SignaturePayloadSchema;
|
|
21
|
-
export type EIP712SignaturePayload = EIP712SignaturePayloadFields & {
|
|
22
|
-
schema: EIP712SignaturePayloadSchema;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=Payload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../../src/eip-712/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjE,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EAAE,CAAC,SAAS,eAAe,GAAG,eAAe;IACzH,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,CAAC,CAAA;IACR,MAAM,EAAE,CAAC,CAAA;CACV;AAED,eAAO,MAAM,mBAAmB,EAAG,4CAAqD,CAAA;AACxF,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA;AAE5D,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG;IAChD,MAAM,EAAE,mBAAmB,CAAA;CAC5B,CAAA;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAA;IAEf,IAAI,EAAE,IAAI,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,eAAO,MAAM,4BAA4B,EAAG,qDAA8D,CAAA;AAC1G,MAAM,MAAM,4BAA4B,GAAG,OAAO,4BAA4B,CAAA;AAE9E,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,GAAG;IAClE,MAAM,EAAE,4BAA4B,CAAA;CACrC,CAAA"}
|
package/src/eip-712/Payload.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Hash } from '@xylabs/hex'
|
|
2
|
-
import type { TypedDataDomain } from 'ethers/hash'
|
|
3
|
-
|
|
4
|
-
import type { TypedDataTypes, TypedDataValues } from './Types.ts'
|
|
5
|
-
|
|
6
|
-
export interface EIP712PayloadFields<T extends TypedDataTypes = TypedDataTypes, V extends TypedDataValues = TypedDataValues> {
|
|
7
|
-
domain: TypedDataDomain
|
|
8
|
-
types: T
|
|
9
|
-
values: V
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const EIP712PayloadSchema = 'network.xyo.chains.ethereum.eip712.payload' as const
|
|
13
|
-
export type EIP712PayloadSchema = typeof EIP712PayloadSchema
|
|
14
|
-
|
|
15
|
-
export type EIP712Payload = EIP712PayloadFields & {
|
|
16
|
-
schema: EIP712PayloadSchema
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface EIP712SignaturePayloadFields {
|
|
20
|
-
address: string
|
|
21
|
-
// the hash of the EIP712Payload
|
|
22
|
-
hash: Hash
|
|
23
|
-
signature: string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const EIP712SignaturePayloadSchema = 'network.xyo.chains.ethereum.eip712.signaturePayload' as const
|
|
27
|
-
export type EIP712SignaturePayloadSchema = typeof EIP712SignaturePayloadSchema
|
|
28
|
-
|
|
29
|
-
export type EIP712SignaturePayload = EIP712SignaturePayloadFields & {
|
|
30
|
-
schema: EIP712SignaturePayloadSchema
|
|
31
|
-
}
|