@xyo-network/xl1-rpc 1.16.21 → 1.16.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/engine/rpcMethodHandlersFromViewer.d.ts.map +1 -1
- package/dist/neutral/index.mjs +616 -920
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts +9 -1
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts +136 -8
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/DataLakeViewerRpcSchema.d.ts.map +1 -1
- package/dist/neutral/types/schema/RewardsByPositionViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/RewardsByStakerViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/RewardsByStepViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/RewardsTotalViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/StepViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/TimeSyncViewerRpcSchema.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoPermissionsRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoRunnerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoSignerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts +136 -8
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/index.d.ts +0 -1
- package/dist/neutral/types/schema/index.d.ts.map +1 -1
- package/dist/node/engine/rpcMethodHandlersFromViewer.d.ts.map +1 -1
- package/dist/node/index-node.mjs +616 -920
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts +9 -1
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/node/types/schema/AllRpcSchemas.d.ts +136 -8
- package/dist/node/types/schema/AllRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/DataLakeViewerRpcSchema.d.ts.map +1 -1
- package/dist/node/types/schema/RewardsByPositionViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/RewardsByStakerViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/RewardsByStepViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/RewardsTotalViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/StepViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/TimeSyncViewerRpcSchema.d.ts.map +1 -1
- package/dist/node/types/schema/XyoPermissionsRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoRunnerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoSignerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts +136 -8
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/index.d.ts +0 -1
- package/dist/node/types/schema/index.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/engine/rpcMethodHandlersFromViewer.ts +2 -0
- package/src/provider/viewer/JsonRpcXyoViewer.ts +27 -6
- package/src/types/schema/DataLakeViewerRpcSchema.ts +1 -1
- package/src/types/schema/RewardsByPositionViewerRpcSchemas.ts +1 -1
- package/src/types/schema/RewardsByStakerViewerRpcSchemas.ts +1 -1
- package/src/types/schema/RewardsByStepViewerRpcSchemas.ts +1 -1
- package/src/types/schema/RewardsTotalViewerRpcSchemas.ts +1 -1
- package/src/types/schema/StepViewerRpcSchemas.ts +1 -1
- package/src/types/schema/TimeSyncViewerRpcSchema.ts +1 -1
- package/src/types/schema/XyoPermissionsRpcSchemas.ts +3 -3
- package/src/types/schema/XyoRunnerRpcSchemas.ts +1 -1
- package/src/types/schema/XyoSignerRpcSchemas.ts +1 -4
- package/src/types/schema/XyoViewerRpcSchemas.ts +32 -19
- package/src/types/schema/index.ts +0 -1
- package/dist/neutral/types/schema/common/ArrayBuffer.d.ts +0 -4
- package/dist/neutral/types/schema/common/ArrayBuffer.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/BlockBoundWitness.d.ts +0 -44
- package/dist/neutral/types/schema/common/BlockBoundWitness.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/BoundWitness.d.ts +0 -123
- package/dist/neutral/types/schema/common/BoundWitness.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/Chain.d.ts +0 -4
- package/dist/neutral/types/schema/common/Chain.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/HydratedBlock.d.ts +0 -133
- package/dist/neutral/types/schema/common/HydratedBlock.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/HydratedTransaction.d.ts +0 -210
- package/dist/neutral/types/schema/common/HydratedTransaction.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/Json.d.ts +0 -7
- package/dist/neutral/types/schema/common/Json.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/Permission.d.ts +0 -53
- package/dist/neutral/types/schema/common/Permission.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/RewardsRangeOptions.d.ts +0 -11
- package/dist/neutral/types/schema/common/RewardsRangeOptions.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/Sequence.d.ts +0 -9
- package/dist/neutral/types/schema/common/Sequence.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/Stake.d.ts +0 -62
- package/dist/neutral/types/schema/common/Stake.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/TimeDomain.d.ts +0 -3
- package/dist/neutral/types/schema/common/TimeDomain.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/TransactionBoundWitness.d.ts +0 -75
- package/dist/neutral/types/schema/common/TransactionBoundWitness.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/TransactionFees.d.ts +0 -53
- package/dist/neutral/types/schema/common/TransactionFees.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/TransferPair.d.ts +0 -3
- package/dist/neutral/types/schema/common/TransferPair.d.ts.map +0 -1
- package/dist/neutral/types/schema/common/index.d.ts +0 -16
- package/dist/neutral/types/schema/common/index.d.ts.map +0 -1
- package/dist/node/types/schema/common/ArrayBuffer.d.ts +0 -4
- package/dist/node/types/schema/common/ArrayBuffer.d.ts.map +0 -1
- package/dist/node/types/schema/common/BlockBoundWitness.d.ts +0 -44
- package/dist/node/types/schema/common/BlockBoundWitness.d.ts.map +0 -1
- package/dist/node/types/schema/common/BoundWitness.d.ts +0 -123
- package/dist/node/types/schema/common/BoundWitness.d.ts.map +0 -1
- package/dist/node/types/schema/common/Chain.d.ts +0 -4
- package/dist/node/types/schema/common/Chain.d.ts.map +0 -1
- package/dist/node/types/schema/common/HydratedBlock.d.ts +0 -133
- package/dist/node/types/schema/common/HydratedBlock.d.ts.map +0 -1
- package/dist/node/types/schema/common/HydratedTransaction.d.ts +0 -210
- package/dist/node/types/schema/common/HydratedTransaction.d.ts.map +0 -1
- package/dist/node/types/schema/common/Json.d.ts +0 -7
- package/dist/node/types/schema/common/Json.d.ts.map +0 -1
- package/dist/node/types/schema/common/Permission.d.ts +0 -53
- package/dist/node/types/schema/common/Permission.d.ts.map +0 -1
- package/dist/node/types/schema/common/RewardsRangeOptions.d.ts +0 -11
- package/dist/node/types/schema/common/RewardsRangeOptions.d.ts.map +0 -1
- package/dist/node/types/schema/common/Sequence.d.ts +0 -9
- package/dist/node/types/schema/common/Sequence.d.ts.map +0 -1
- package/dist/node/types/schema/common/Stake.d.ts +0 -62
- package/dist/node/types/schema/common/Stake.d.ts.map +0 -1
- package/dist/node/types/schema/common/TimeDomain.d.ts +0 -3
- package/dist/node/types/schema/common/TimeDomain.d.ts.map +0 -1
- package/dist/node/types/schema/common/TransactionBoundWitness.d.ts +0 -75
- package/dist/node/types/schema/common/TransactionBoundWitness.d.ts.map +0 -1
- package/dist/node/types/schema/common/TransactionFees.d.ts +0 -53
- package/dist/node/types/schema/common/TransactionFees.d.ts.map +0 -1
- package/dist/node/types/schema/common/TransferPair.d.ts +0 -3
- package/dist/node/types/schema/common/TransferPair.d.ts.map +0 -1
- package/dist/node/types/schema/common/index.d.ts +0 -16
- package/dist/node/types/schema/common/index.d.ts.map +0 -1
- package/src/types/schema/common/ArrayBuffer.ts +0 -42
- package/src/types/schema/common/BlockBoundWitness.ts +0 -36
- package/src/types/schema/common/BoundWitness.ts +0 -56
- package/src/types/schema/common/Chain.ts +0 -5
- package/src/types/schema/common/HydratedBlock.ts +0 -32
- package/src/types/schema/common/HydratedTransaction.ts +0 -37
- package/src/types/schema/common/Json.ts +0 -19
- package/src/types/schema/common/Permission.ts +0 -23
- package/src/types/schema/common/RewardsRangeOptions.ts +0 -10
- package/src/types/schema/common/Sequence.ts +0 -15
- package/src/types/schema/common/Stake.ts +0 -43
- package/src/types/schema/common/TimeDomain.ts +0 -7
- package/src/types/schema/common/TransactionBoundWitness.ts +0 -42
- package/src/types/schema/common/TransactionFees.ts +0 -45
- package/src/types/schema/common/TransferPair.ts +0 -6
- package/src/types/schema/common/index.ts +0 -15
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { HashZod } from '@xylabs/sdk-js'
|
|
2
|
-
import { StorageMetaZod } from '@xyo-network/payload-model'
|
|
3
|
-
import { XL1BlockNumberZod } from '@xyo-network/xl1-protocol'
|
|
4
|
-
import * as z from 'zod'
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
SignedBoundWitnessZod,
|
|
8
|
-
UnsignedBoundWitnessZod,
|
|
9
|
-
} from './BoundWitness.ts'
|
|
10
|
-
import { ChainZod } from './Chain.ts'
|
|
11
|
-
|
|
12
|
-
const BlockBoundWitnessFieldsZod = z.object({
|
|
13
|
-
block: XL1BlockNumberZod,
|
|
14
|
-
chain: ChainZod,
|
|
15
|
-
previous: HashZod.nullable(),
|
|
16
|
-
protocol: z.number(),
|
|
17
|
-
step_hashes: z.array(HashZod).optional(),
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const BlockBoundWitnessMetaZod = z.object({ $epoch: z.number() })
|
|
21
|
-
|
|
22
|
-
export const BlockBoundWitnessZod = UnsignedBoundWitnessZod
|
|
23
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
24
|
-
.merge(StorageMetaZod.partial())
|
|
25
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
26
|
-
.merge(BlockBoundWitnessFieldsZod)
|
|
27
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
28
|
-
.merge(BlockBoundWitnessMetaZod)
|
|
29
|
-
|
|
30
|
-
export const SignedBlockBoundWitnessZod = SignedBoundWitnessZod
|
|
31
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
32
|
-
.merge(StorageMetaZod.partial())
|
|
33
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
34
|
-
.merge(BlockBoundWitnessFieldsZod)
|
|
35
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
36
|
-
.merge(BlockBoundWitnessMetaZod)
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AddressZod, HashZod, HexZod,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
5
|
-
import {
|
|
6
|
-
PayloadZod, SchemaZod, StorageMetaZod,
|
|
7
|
-
} from '@xyo-network/payload-model'
|
|
8
|
-
import * as z from 'zod'
|
|
9
|
-
|
|
10
|
-
const BoundWitnessRequiredFieldsZod = z.object({
|
|
11
|
-
addresses: z.array(AddressZod),
|
|
12
|
-
payload_hashes: z.array(HashZod),
|
|
13
|
-
payload_schemas: z.array(SchemaZod),
|
|
14
|
-
previous_hashes: z.array(HashZod.nullable()),
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
const BoundWitnessMetaZod = z.object({
|
|
18
|
-
$destination: AddressZod.optional(),
|
|
19
|
-
$sourceQuery: HashZod.optional(),
|
|
20
|
-
$signatures: z.array(z.union([HexZod, z.null()])),
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export const BoundWitnessZod = PayloadZod
|
|
24
|
-
.extend({ schema: z.literal(BoundWitnessSchema) })
|
|
25
|
-
.extend(BoundWitnessRequiredFieldsZod.shape)
|
|
26
|
-
.extend(BoundWitnessMetaZod.shape)
|
|
27
|
-
.refine(data => data.$signatures.length === data.addresses.length, { message: '$signatures length must equal addresses length' })
|
|
28
|
-
|
|
29
|
-
export type BoundWitness = z.infer<typeof BoundWitnessZod>
|
|
30
|
-
|
|
31
|
-
export const AnyBoundWitnessZod = BoundWitnessZod
|
|
32
|
-
.catchall(z.any())
|
|
33
|
-
|
|
34
|
-
export type AnyBoundWitness = z.infer<typeof AnyBoundWitnessZod>
|
|
35
|
-
|
|
36
|
-
export const UnsignedBoundWitnessZod = BoundWitnessZod.refine(data => data.$signatures.includes(null), { message: 'all $signatures must be null' })
|
|
37
|
-
|
|
38
|
-
export type UnsignedBoundWitness = z.infer<typeof UnsignedBoundWitnessZod>
|
|
39
|
-
|
|
40
|
-
export const AnyUnsignedBoundWitnessZod = UnsignedBoundWitnessZod
|
|
41
|
-
.catchall(z.any())
|
|
42
|
-
|
|
43
|
-
export type AnyUnsignedBoundWitness = z.infer<typeof AnyUnsignedBoundWitnessZod>
|
|
44
|
-
|
|
45
|
-
export const UnsignedBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessZod
|
|
46
|
-
.safeExtend(BoundWitnessRequiredFieldsZod.shape)
|
|
47
|
-
.safeExtend(BoundWitnessMetaZod.shape)
|
|
48
|
-
.safeExtend(StorageMetaZod.shape)
|
|
49
|
-
|
|
50
|
-
export const SignedBoundWitnessZod = BoundWitnessZod.refine(data => !data.$signatures.includes(null), { message: 'all $signatures must not be null' })
|
|
51
|
-
|
|
52
|
-
export const SignedBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessWithStorageMetaZod
|
|
53
|
-
|
|
54
|
-
export const AnySignedBoundWitnessZod = UnsignedBoundWitnessZod.catchall(z.any())
|
|
55
|
-
|
|
56
|
-
export const AnySignedBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessWithStorageMetaZod.catchall(z.any())
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { PayloadZodLoose, WithStorageMetaZod } from '@xyo-network/payload-model'
|
|
2
|
-
import * as z from 'zod'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
BlockBoundWitnessZod,
|
|
6
|
-
SignedBlockBoundWitnessZod,
|
|
7
|
-
} from './BlockBoundWitness.ts'
|
|
8
|
-
|
|
9
|
-
export const HydratedBlockZod = z.tuple([
|
|
10
|
-
BlockBoundWitnessZod,
|
|
11
|
-
z.array(PayloadZodLoose),
|
|
12
|
-
])
|
|
13
|
-
|
|
14
|
-
export const HydratedBlockWithStorageMetaZod = z.tuple([
|
|
15
|
-
WithStorageMetaZod(BlockBoundWitnessZod),
|
|
16
|
-
z.array(WithStorageMetaZod(PayloadZodLoose)),
|
|
17
|
-
])
|
|
18
|
-
|
|
19
|
-
export const SignedHydratedBlockZod = z.tuple([
|
|
20
|
-
SignedBlockBoundWitnessZod,
|
|
21
|
-
z.array(PayloadZodLoose),
|
|
22
|
-
])
|
|
23
|
-
|
|
24
|
-
export const SignedHydratedBlockToJsonZod = z.tuple([
|
|
25
|
-
SignedBlockBoundWitnessZod,
|
|
26
|
-
z.array(PayloadZodLoose),
|
|
27
|
-
])
|
|
28
|
-
|
|
29
|
-
export const SignedHydratedBlockWithStorageMetaZod = z.tuple([
|
|
30
|
-
WithStorageMetaZod(SignedBlockBoundWitnessZod),
|
|
31
|
-
z.array(WithStorageMetaZod(PayloadZodLoose)),
|
|
32
|
-
])
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { JsonObject } from '@xylabs/sdk-js'
|
|
2
|
-
import { asAnyPayload, PayloadZodLoose } from '@xyo-network/payload-model'
|
|
3
|
-
import { asSignedHydratedTransaction } from '@xyo-network/xl1-protocol'
|
|
4
|
-
import * as z from 'zod'
|
|
5
|
-
|
|
6
|
-
import { SignedTransactionBoundWitnessZod, TransactionBoundWitnessZod } from './TransactionBoundWitness.ts'
|
|
7
|
-
|
|
8
|
-
export const HydratedTransactionZod = z.tuple([
|
|
9
|
-
TransactionBoundWitnessZod,
|
|
10
|
-
z.array(PayloadZodLoose),
|
|
11
|
-
])
|
|
12
|
-
|
|
13
|
-
export const UnsignedHydratedTransactionZod = z.tuple([
|
|
14
|
-
TransactionBoundWitnessZod,
|
|
15
|
-
z.array(PayloadZodLoose),
|
|
16
|
-
])
|
|
17
|
-
|
|
18
|
-
export const SignedHydratedTransactionZod = z.tuple([
|
|
19
|
-
SignedTransactionBoundWitnessZod,
|
|
20
|
-
z.array(PayloadZodLoose),
|
|
21
|
-
])
|
|
22
|
-
|
|
23
|
-
export const SignedHydratedTransactionToJsonZod = SignedHydratedTransactionZod.transform(([
|
|
24
|
-
tx,
|
|
25
|
-
payloads,
|
|
26
|
-
]) => asSignedHydratedTransaction([
|
|
27
|
-
tx as JsonObject,
|
|
28
|
-
payloads.map(payload => payload as JsonObject),
|
|
29
|
-
]))
|
|
30
|
-
|
|
31
|
-
export const JsonToSignedHydratedTransactionZod = SignedHydratedTransactionZod.transform(([
|
|
32
|
-
tx,
|
|
33
|
-
payloads,
|
|
34
|
-
]) => ([
|
|
35
|
-
asSignedHydratedTransaction(tx),
|
|
36
|
-
payloads.map(p => asAnyPayload(p)),
|
|
37
|
-
]))
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod'
|
|
2
|
-
|
|
3
|
-
// Define recursive JSON value schema
|
|
4
|
-
const JsonValueZod: z.ZodType<unknown> = z.lazy(() =>
|
|
5
|
-
z.union([
|
|
6
|
-
z.string(),
|
|
7
|
-
z.number(),
|
|
8
|
-
z.boolean(),
|
|
9
|
-
z.null(),
|
|
10
|
-
z.array(JsonValueZod),
|
|
11
|
-
z.record(z.string(), JsonValueZod), // object with string keys and JSON values
|
|
12
|
-
]))
|
|
13
|
-
|
|
14
|
-
// JSON object schema — top-level must be an object
|
|
15
|
-
export const JsonObjectZod = z.record(z.string(), JsonValueZod)
|
|
16
|
-
|
|
17
|
-
// TypeScript type for reference
|
|
18
|
-
export type JsonValue = z.infer<typeof JsonValueZod>
|
|
19
|
-
export type JsonObject = z.infer<typeof JsonObjectZod>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
export const CaveatTypesZod = z.enum(['chain', 'expiration', 'filteredResponse', 'rateLimit', 'restrictReturnedAccounts'])
|
|
4
|
-
|
|
5
|
-
export const CaveatsZod = z.object({
|
|
6
|
-
type: CaveatTypesZod,
|
|
7
|
-
value: z.json(),
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
export const PermissionZod = z.object({
|
|
11
|
-
parentCapability: z.string(),
|
|
12
|
-
caveats: CaveatsZod.array().optional(),
|
|
13
|
-
invoker: z.string(),
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
export const InvokerPermissionZod = PermissionZod.extend({ date: z.number().optional() })
|
|
17
|
-
|
|
18
|
-
export const PermissionRequestZod = z.record(z.string(), z.record(z.string(), z.any()))
|
|
19
|
-
|
|
20
|
-
export const RequestedPermissionZod = z.object({
|
|
21
|
-
parentCapability: z.string(),
|
|
22
|
-
date: z.number().optional(),
|
|
23
|
-
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AddressZod } from '@xylabs/sdk-js'
|
|
2
|
-
import { BlockRangeZod, StepIdentityZod } from '@xyo-network/xl1-protocol'
|
|
3
|
-
import { z } from 'zod'
|
|
4
|
-
|
|
5
|
-
export const RewardsRangeOptionsZod = z.object({
|
|
6
|
-
positions: z.array(z.number()).optional(),
|
|
7
|
-
range: BlockRangeZod.optional(),
|
|
8
|
-
steps: z.array(StepIdentityZod).optional(),
|
|
9
|
-
stakers: z.array(AddressZod).optional(),
|
|
10
|
-
})
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { HexRegExMinMax, toHex } from '@xylabs/sdk-js'
|
|
2
|
-
import type { LocalSequence, QualifiedSequence } from '@xyo-network/payload-model'
|
|
3
|
-
import { SequenceConstants } from '@xyo-network/payload-model'
|
|
4
|
-
import * as z from 'zod'
|
|
5
|
-
|
|
6
|
-
const LocalSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.localSequenceBytes, SequenceConstants.localSequenceBytes))
|
|
7
|
-
export const LocalSequenceToStringZod = z.string().regex(LocalSequenceRegex)
|
|
8
|
-
export const LocalSequenceFromStringZod = z.string().regex(LocalSequenceRegex).transform<LocalSequence>(v => toHex(v) as LocalSequence)
|
|
9
|
-
|
|
10
|
-
const QualifiedSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.qualifiedSequenceBytes, SequenceConstants.qualifiedSequenceBytes))
|
|
11
|
-
export const QualifiedSequenceToStringZod = z.string().regex(QualifiedSequenceRegex)
|
|
12
|
-
export const QualifiedSequenceFromStringZod = z.string().regex(QualifiedSequenceRegex).transform<QualifiedSequence>(v => toHex(v) as QualifiedSequence)
|
|
13
|
-
|
|
14
|
-
export const SequenceToStringZod = z.union([LocalSequenceToStringZod, QualifiedSequenceToStringZod])
|
|
15
|
-
export const SequenceFromStringZod = z.union([LocalSequenceFromStringZod, QualifiedSequenceFromStringZod])
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { AddressZod, HexZod } from '@xylabs/sdk-js'
|
|
2
|
-
import type { PositionId } from '@xyo-network/xl1-protocol'
|
|
3
|
-
import * as z from 'zod'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
AttoToJsonZod, AttoZod, JsonToAttoZod,
|
|
7
|
-
} from './TransactionFees.ts'
|
|
8
|
-
|
|
9
|
-
export const StakeZod = z.object({
|
|
10
|
-
amount: AttoZod,
|
|
11
|
-
// the block number when the stake was added
|
|
12
|
-
addBlock: z.number(),
|
|
13
|
-
// the unique id for the stake item
|
|
14
|
-
id: z.number(),
|
|
15
|
-
// the block number when the stake was removed (set to 0 if not removed)
|
|
16
|
-
removeBlock: z.number(),
|
|
17
|
-
// the address that is being staked
|
|
18
|
-
staked: AddressZod,
|
|
19
|
-
// the address that owns the stake
|
|
20
|
-
staker: AddressZod,
|
|
21
|
-
// the block number when the stake was withdrawn (set to 0 if not withdrawn)
|
|
22
|
-
withdrawBlock: z.number(),
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
export const StakeToJsonZod = StakeZod.transform(val => ({
|
|
26
|
-
addBlock: val.addBlock,
|
|
27
|
-
amount: AttoToJsonZod.parse(val.amount),
|
|
28
|
-
id: val.id,
|
|
29
|
-
removeBlock: val.removeBlock,
|
|
30
|
-
staked: AddressZod.parse(val.staked),
|
|
31
|
-
staker: AddressZod.parse(val.staker),
|
|
32
|
-
withdrawBlock: val.withdrawBlock,
|
|
33
|
-
}))
|
|
34
|
-
|
|
35
|
-
export const JsonToStakeZod = StakeZod.extend({ amount: HexZod }).transform(val => ({
|
|
36
|
-
addBlock: val.addBlock,
|
|
37
|
-
amount: JsonToAttoZod.parse(val.amount),
|
|
38
|
-
id: val.id as PositionId,
|
|
39
|
-
removeBlock: val.removeBlock,
|
|
40
|
-
staked: val.staked,
|
|
41
|
-
staker: val.staker,
|
|
42
|
-
withdrawBlock: val.withdrawBlock,
|
|
43
|
-
}))
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { StorageMetaZod } from '@xyo-network/payload-model'
|
|
2
|
-
import { BlockNumberZod } from '@xyo-network/xl1-protocol'
|
|
3
|
-
import * as z from 'zod'
|
|
4
|
-
|
|
5
|
-
import { SignedBoundWitnessZod, UnsignedBoundWitnessZod } from './BoundWitness.ts'
|
|
6
|
-
import { ChainZod } from './Chain.ts'
|
|
7
|
-
import { TransactionFeesHexZod } from './TransactionFees.ts'
|
|
8
|
-
|
|
9
|
-
export const BlockStartZod = z.object({ nbf: BlockNumberZod })
|
|
10
|
-
export const BlockEndZod = z.object({ exp: BlockNumberZod })
|
|
11
|
-
export const BlockDurationZod = z.object({ nbf: BlockNumberZod, exp: BlockNumberZod })
|
|
12
|
-
export const BlockScriptsZod = z.object({ script: z.array(z.string()).optional() })
|
|
13
|
-
|
|
14
|
-
export const WithTransactionFeesZod = z.object({ fees: TransactionFeesHexZod })
|
|
15
|
-
|
|
16
|
-
const TransactionBoundWitnessFields = z.object({ chain: ChainZod, from: ChainZod })
|
|
17
|
-
|
|
18
|
-
// It seems like zod marked all of merge as deprecated even though just multiple merges should have been deprecated
|
|
19
|
-
|
|
20
|
-
export const TransactionBoundWitnessZod = UnsignedBoundWitnessZod
|
|
21
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
22
|
-
.merge(StorageMetaZod.partial())
|
|
23
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
24
|
-
.merge(BlockDurationZod)
|
|
25
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
26
|
-
.merge(WithTransactionFeesZod)
|
|
27
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
28
|
-
.merge(TransactionBoundWitnessFields)
|
|
29
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
30
|
-
.merge(BlockScriptsZod)
|
|
31
|
-
|
|
32
|
-
export const SignedTransactionBoundWitnessZod = SignedBoundWitnessZod
|
|
33
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
34
|
-
.merge(StorageMetaZod.partial())
|
|
35
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
36
|
-
.merge(BlockDurationZod)
|
|
37
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
38
|
-
.merge(WithTransactionFeesZod)
|
|
39
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
40
|
-
.merge(TransactionBoundWitnessFields)
|
|
41
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
42
|
-
.merge(BlockScriptsZod.partial())
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BigIntToJsonZod, HexZod, JsonToBigIntZod,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
import { asAttoXL1 } from '@xyo-network/xl1-protocol'
|
|
5
|
-
import * as z from 'zod'
|
|
6
|
-
|
|
7
|
-
export const AttoZod = z.bigint()
|
|
8
|
-
export const JsonToAttoZod = JsonToBigIntZod.transform(v => asAttoXL1(v))
|
|
9
|
-
// eslint-disable-next-line unicorn/prefer-export-from
|
|
10
|
-
export const AttoToJsonZod = BigIntToJsonZod
|
|
11
|
-
|
|
12
|
-
export const TransactionFeesHexZod = z.object({
|
|
13
|
-
base: HexZod,
|
|
14
|
-
gasLimit: HexZod,
|
|
15
|
-
gasPrice: HexZod,
|
|
16
|
-
priority: HexZod,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
export type TransactionFeesHexZodType = z.infer<typeof TransactionFeesHexZod>
|
|
20
|
-
|
|
21
|
-
export const TransactionFeesBigIntZod = z.object({
|
|
22
|
-
base: AttoZod,
|
|
23
|
-
gasLimit: AttoZod,
|
|
24
|
-
gasPrice: AttoZod,
|
|
25
|
-
priority: AttoZod,
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
export type TransactionFeesBigIntZodType = z.infer<typeof TransactionFeesBigIntZod>
|
|
29
|
-
|
|
30
|
-
export const TransactionFeesJsonToBigIntZod = TransactionFeesHexZod.transform(val => ({
|
|
31
|
-
base: JsonToBigIntZod.parse(val.base),
|
|
32
|
-
gasLimit: JsonToBigIntZod.parse(val.gasLimit),
|
|
33
|
-
gasPrice: JsonToBigIntZod.parse(val.gasPrice),
|
|
34
|
-
priority: JsonToBigIntZod.parse(val.priority),
|
|
35
|
-
}))
|
|
36
|
-
|
|
37
|
-
export const TransactionFeesBigIntToJsonZod = TransactionFeesBigIntZod.transform(val => ({
|
|
38
|
-
base: BigIntToJsonZod.parse(val.base),
|
|
39
|
-
gasLimit: BigIntToJsonZod.parse(val.gasLimit),
|
|
40
|
-
gasPrice: BigIntToJsonZod.parse(val.gasPrice),
|
|
41
|
-
priority: BigIntToJsonZod.parse(val.priority),
|
|
42
|
-
}))
|
|
43
|
-
|
|
44
|
-
export type TransactionFeesJsonToBigIntZodType = z.infer<typeof TransactionFeesJsonToBigIntZod>
|
|
45
|
-
export type TransactionFeesBigIntToJsonZodType = z.infer<typeof TransactionFeesBigIntToJsonZod>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from './ArrayBuffer.ts'
|
|
2
|
-
export * from './BlockBoundWitness.ts'
|
|
3
|
-
export * from './BoundWitness.ts'
|
|
4
|
-
export * from './Chain.ts'
|
|
5
|
-
export * from './HydratedBlock.ts'
|
|
6
|
-
export * from './HydratedTransaction.ts'
|
|
7
|
-
export * from './Json.ts'
|
|
8
|
-
export * from './Permission.ts'
|
|
9
|
-
export * from './RewardsRangeOptions.ts'
|
|
10
|
-
export * from './Sequence.ts'
|
|
11
|
-
export * from './Stake.ts'
|
|
12
|
-
export * from './TimeDomain.ts'
|
|
13
|
-
export * from './TransactionBoundWitness.ts'
|
|
14
|
-
export * from './TransactionFees.ts'
|
|
15
|
-
export * from './TransferPair.ts'
|