@xyo-network/xl1-protocol-sdk 1.23.21 → 1.24.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.
Files changed (49) hide show
  1. package/dist/neutral/CreatableProvider/AbstractCreatableProvider.d.ts +0 -364
  2. package/dist/neutral/CreatableProvider/AbstractCreatableProvider.d.ts.map +1 -1
  3. package/dist/neutral/CreatableProvider/CreatableProviderContext.zod.d.ts +508 -2
  4. package/dist/neutral/CreatableProvider/CreatableProviderContext.zod.d.ts.map +1 -1
  5. package/dist/neutral/actor/ActorV3.d.ts +2 -0
  6. package/dist/neutral/actor/ActorV3.d.ts.map +1 -1
  7. package/dist/neutral/actor/index.d.ts +0 -3
  8. package/dist/neutral/actor/index.d.ts.map +1 -1
  9. package/dist/neutral/config/Config.d.ts +200 -1160
  10. package/dist/neutral/config/Config.d.ts.map +1 -1
  11. package/dist/neutral/config/index.d.ts +1 -1
  12. package/dist/neutral/config/index.d.ts.map +1 -1
  13. package/dist/neutral/index.mjs +1667 -2260
  14. package/dist/neutral/index.mjs.map +1 -1
  15. package/dist/neutral/test/index.mjs +60 -370
  16. package/dist/neutral/test/index.mjs.map +1 -1
  17. package/package.json +4 -3
  18. package/src/CreatableProvider/CreatableProviderContext.zod.ts +18 -5
  19. package/src/actor/ActorV3.ts +2 -0
  20. package/src/actor/index.ts +0 -3
  21. package/src/config/Config.ts +9 -40
  22. package/src/config/index.ts +1 -1
  23. package/dist/neutral/actor/Actor.d.ts +0 -477
  24. package/dist/neutral/actor/Actor.d.ts.map +0 -1
  25. package/dist/neutral/actor/ActorContext.d.ts +0 -8
  26. package/dist/neutral/actor/ActorContext.d.ts.map +0 -1
  27. package/dist/neutral/actor/ActorV2.d.ts +0 -470
  28. package/dist/neutral/actor/ActorV2.d.ts.map +0 -1
  29. package/dist/neutral/config/actors/Api.d.ts +0 -76
  30. package/dist/neutral/config/actors/Api.d.ts.map +0 -1
  31. package/dist/neutral/config/actors/Bridge.d.ts +0 -124
  32. package/dist/neutral/config/actors/Bridge.d.ts.map +0 -1
  33. package/dist/neutral/config/actors/Mempool.d.ts +0 -76
  34. package/dist/neutral/config/actors/Mempool.d.ts.map +0 -1
  35. package/dist/neutral/config/actors/Producer.d.ts +0 -84
  36. package/dist/neutral/config/actors/Producer.d.ts.map +0 -1
  37. package/dist/neutral/config/actors/RewardRedemption.d.ts +0 -75
  38. package/dist/neutral/config/actors/RewardRedemption.d.ts.map +0 -1
  39. package/dist/neutral/config/actors/index.d.ts +0 -7
  40. package/dist/neutral/config/actors/index.d.ts.map +0 -1
  41. package/src/actor/Actor.ts +0 -216
  42. package/src/actor/ActorContext.ts +0 -9
  43. package/src/actor/ActorV2.ts +0 -171
  44. package/src/config/actors/Api.ts +0 -33
  45. package/src/config/actors/Bridge.ts +0 -136
  46. package/src/config/actors/Mempool.ts +0 -43
  47. package/src/config/actors/Producer.ts +0 -61
  48. package/src/config/actors/RewardRedemption.ts +0 -26
  49. package/src/config/actors/index.ts +0 -6
@@ -1,33 +0,0 @@
1
- import { globalRegistry, z } from 'zod'
2
-
3
- import { MnemonicStringZod } from '../../validation/index.ts'
4
- import { BaseConfigZod } from '../Base.ts'
5
-
6
- export const ApiConfigZod = BaseConfigZod.extend(z.object({
7
- host: z.string().default('localhost').register(globalRegistry, {
8
- default: 'localhost',
9
- description: 'Host for the API',
10
- title: 'api.host',
11
- type: 'string',
12
- }),
13
- initRewardsCache: z.union([z.number(), z.string(), z.boolean()]).transform(
14
- v => v !== '0' && v !== 'false' && v !== false && v != 0,
15
- ).default(true).register(globalRegistry, {
16
- description: 'Whether to initialize the rewards cache on startup',
17
- title: 'api.initRewardsCache',
18
- type: 'boolean',
19
- }),
20
- mnemonic: MnemonicStringZod.optional().register(globalRegistry, {
21
- description: 'Mnemonic for the API wallet',
22
- title: 'api.mnemonic',
23
- type: 'string',
24
- }),
25
- port: z.coerce.number().default(8080).register(globalRegistry, {
26
- default: 8080,
27
- description: 'Port for the API',
28
- title: 'api.port',
29
- type: 'number',
30
- }),
31
- }).shape)
32
-
33
- export type ApiConfig = z.infer<typeof ApiConfigZod>
@@ -1,136 +0,0 @@
1
- import {
2
- AddressZod, HexZod, toAddress, toHex,
3
- } from '@xylabs/sdk-js'
4
- import type { ChainId } from '@xyo-network/xl1-protocol'
5
- import { AttoXL1ConvertFactor, XL1 } from '@xyo-network/xl1-protocol'
6
- import { globalRegistry, z } from 'zod'
7
-
8
- import { MnemonicStringZod } from '../../validation/index.ts'
9
- import { BaseConfigZod } from '../Base.ts'
10
-
11
- const DEFAULT_FIXED_FEE = toHex(XL1(1n) * AttoXL1ConvertFactor.xl1)
12
- const DEFAULT_HARDHAT_BRIDGE_CONTRACT = toAddress('2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6')
13
- const DEFAULT_HARDHAT_CHAIN_ID: ChainId = toHex('7A69')
14
- const DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY = toHex('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80')
15
- const DEFAULT_HARDHAT_TOKEN_CONTRACT = toAddress('5FbDB2315678afecb367f032d93F642f64180aa3')
16
- const DEFAULT_MAX_BRIDGE_AMOUNT = toHex(XL1(100_000n) * AttoXL1ConvertFactor.xl1)
17
- const DEFAULT_MIN_BRIDGE_AMOUNT = toHex(XL1(10n) * AttoXL1ConvertFactor.xl1)
18
-
19
- export const BasisPointsZod = z.coerce.number().int().nonnegative().max(10_000)
20
- export type BasisPoints = z.infer<typeof BasisPointsZod>
21
-
22
- export const BridgeConfigZod = BaseConfigZod.extend(z.object({
23
- escrowAddress: AddressZod.optional().register(globalRegistry, {
24
- description: 'Address to which bridge escrow will be sent',
25
- title: 'bridge.escrowAddress',
26
- type: 'string',
27
- }),
28
- feesAddress: AddressZod.optional().register(globalRegistry, {
29
- description: 'Address to which bridge fees will be sent',
30
- title: 'bridge.feesAddress',
31
- type: 'string',
32
- }),
33
- feeFixed: HexZod.default(DEFAULT_FIXED_FEE).register(globalRegistry, {
34
- default: DEFAULT_FIXED_FEE,
35
- description: 'Fixed fee (in AttoXL1) applied to bridge transfers',
36
- title: 'bridge.feeFixed',
37
- type: 'bigint',
38
- }),
39
- feeRateBasisPoints: BasisPointsZod.default(500).register(globalRegistry, {
40
- default: 500,
41
- description: 'Variable rate fee (in basis points where 1 bps = 0.01%) applied to bridge transfers',
42
- title: 'bridge.feeRateBasisPoints',
43
- type: 'number',
44
- }),
45
- host: z.string().default('localhost').register(globalRegistry, {
46
- default: 'localhost',
47
- description: 'Host for the Bridge',
48
- title: 'bridge.host',
49
- type: 'string',
50
- }),
51
- maxBridgeAmount: HexZod.default(DEFAULT_MAX_BRIDGE_AMOUNT).register(globalRegistry, {
52
- default: DEFAULT_MAX_BRIDGE_AMOUNT,
53
- description: 'Maximum amount allowed for a bridge transfer',
54
- title: 'bridge.maxBridgeAmount',
55
- type: 'string',
56
- }),
57
- minBridgeAmount: HexZod.default(DEFAULT_MIN_BRIDGE_AMOUNT).register(globalRegistry, {
58
- default: DEFAULT_MIN_BRIDGE_AMOUNT,
59
- description: 'Minimum amount required for a bridge transfer',
60
- title: 'bridge.minBridgeAmount',
61
- type: 'string',
62
- }),
63
- mnemonic: MnemonicStringZod.optional().register(globalRegistry, {
64
- description: 'Mnemonic for the Bridge wallet',
65
- title: 'bridge.mnemonic',
66
- type: 'string',
67
- }),
68
- port: z.coerce.number().int().positive().default(8081).register(globalRegistry, {
69
- default: 8081,
70
- description: 'Port for the Bridge',
71
- title: 'bridge.port',
72
- type: 'number',
73
- }),
74
- redisHost: z.string().default('localhost').register(globalRegistry, {
75
- default: 'localhost',
76
- description: 'Host for the Bridge Redis instance',
77
- title: 'bridge.redisHost',
78
- type: 'string',
79
- }),
80
- redisPort: z.coerce.number().int().positive().default(6379).register(globalRegistry, {
81
- default: 6379,
82
- description: 'Port for the Bridge Redis instance',
83
- title: 'bridge.redisPort',
84
- type: 'number',
85
- }),
86
- remoteBridgeContractAddress: AddressZod.default(DEFAULT_HARDHAT_BRIDGE_CONTRACT).register(globalRegistry, {
87
- default: DEFAULT_HARDHAT_BRIDGE_CONTRACT,
88
- description: 'Hex representation of remote token address used for bridging',
89
- title: 'bridge.remoteBridgeContractAddress',
90
- type: 'string',
91
- }),
92
- remoteChainId: HexZod.default(DEFAULT_HARDHAT_CHAIN_ID).register(globalRegistry, {
93
- default: DEFAULT_HARDHAT_CHAIN_ID,
94
- description: 'Remote chain ID',
95
- title: 'bridge.remoteChainId',
96
- type: 'string',
97
- }),
98
- remoteTokenAddress: HexZod.default(DEFAULT_HARDHAT_TOKEN_CONTRACT).register(globalRegistry, {
99
- default: DEFAULT_HARDHAT_TOKEN_CONTRACT,
100
- description: 'Hex representation of remote token address used for bridging',
101
- title: 'bridge.remoteTokenAddress',
102
- type: 'string',
103
- }),
104
- remoteChainWalletPrivateKey: HexZod.default(DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY).register(globalRegistry, {
105
- description: 'Private key for the wallet to use for the remote chain wallet',
106
- title: 'bridge.remoteChainWalletPrivateKey',
107
- type: 'string',
108
- }),
109
- xl1ChainId: HexZod.optional().register(globalRegistry, {
110
- description: 'XL1 chain id used for bridging',
111
- title: 'bridge.xl1ChainId',
112
- type: 'string',
113
- }),
114
- xl1TokenAddress: HexZod.optional().register(globalRegistry, {
115
- description: 'XL1 token address used for bridging',
116
- title: 'bridge.xl1TokenAddress',
117
- type: 'string',
118
- }),
119
- }).shape)
120
-
121
- export type BridgeConfig = z.infer<typeof BridgeConfigZod>
122
-
123
- export const BridgeSettingsZod = BridgeConfigZod.pick({
124
- feeFixed: true,
125
- feeRateBasisPoints: true,
126
- feesAddress: true,
127
- escrowAddress: true,
128
- maxBridgeAmount: true,
129
- minBridgeAmount: true,
130
- remoteChainId: true,
131
- remoteTokenAddress: true,
132
- xl1TokenAddress: true,
133
- xl1ChainId: true,
134
- }).required()
135
-
136
- export type BridgeSettings = z.infer<typeof BridgeSettingsZod>
@@ -1,43 +0,0 @@
1
- import { globalRegistry, z } from 'zod'
2
-
3
- import { MnemonicStringZod } from '../../validation/index.ts'
4
- import { BaseConfigZod } from '../Base.ts'
5
-
6
- export const MempoolConfigZod = BaseConfigZod.extend(z.object({
7
- enabled: z.union([z.string(), z.boolean()]).default('false').transform((val, ctx) => {
8
- if (typeof val === 'boolean') return val
9
- const normalized = val.toLowerCase().trim()
10
- if (['true', '1', 'yes', 'on'].includes(normalized)) return true
11
- if (['false', '0', 'no', 'off'].includes(normalized)) return false
12
- ctx.addIssue({
13
- code: 'invalid_type',
14
- expected: 'boolean',
15
- message: `Invalid boolean value: "${val}". Use true/false, 1/0, yes/no.`,
16
- })
17
- return z.NEVER
18
- }).register(globalRegistry, {
19
- default: 'false',
20
- description: 'Enable the Mempool',
21
- title: 'mempool.enabled',
22
- type: 'boolean',
23
- }),
24
- host: z.string().default('localhost').register(globalRegistry, {
25
- default: 'localhost',
26
- description: 'Host for the Mempool',
27
- title: 'mempool.host',
28
- type: 'string',
29
- }),
30
- mnemonic: MnemonicStringZod.optional().register(globalRegistry, {
31
- description: 'Mnemonic for the Mempool wallet',
32
- title: 'mempool.mnemonic',
33
- type: 'string',
34
- }),
35
- port: z.coerce.number().default(8083).register(globalRegistry, {
36
- default: 8083,
37
- description: 'Port for the Mempool',
38
- title: 'mempool.port',
39
- type: 'number',
40
- }),
41
- }).shape)
42
-
43
- export type MempoolConfig = z.infer<typeof MempoolConfigZod>
@@ -1,61 +0,0 @@
1
- import { AddressZod, asAddress } from '@xylabs/sdk-js'
2
- import { globalRegistry, z } from 'zod'
3
-
4
- import { MnemonicStringZod } from '../../validation/index.ts'
5
- import { BaseConfigZod } from '../Base.ts'
6
-
7
- export const ProducerConfigZod = BaseConfigZod.extend(z.object({
8
- allowlist: z.preprocess((val) => {
9
- if (typeof val === 'string') {
10
- return val.split(',').map(s => asAddress(s.trim()))
11
- }
12
- return val
13
- }, z.array(AddressZod).optional().register(globalRegistry, {
14
- description: 'List of allowed producer addresses, if undefined anyone can participate',
15
- title: 'allowlist',
16
- type: 'array',
17
- })),
18
-
19
- disableIntentRedeclaration: z.boolean().optional().register(globalRegistry, {
20
- description: 'Should the producer skip redeclaring their intent to continue producing blocks',
21
- title: 'producer.disableIntentRedeclaration',
22
- type: 'boolean',
23
- }),
24
- // TODO: Port schema
25
- healthCheckPort: z.coerce.number().optional().register(globalRegistry, {
26
- description: 'Port for the Producer health checks',
27
- title: 'producer.healthCheckPort',
28
- type: 'number',
29
- }),
30
- heartbeatInterval: z.coerce.number().default(3_600_000).register(globalRegistry, {
31
- description: 'The number of milliseconds between heartbeats if no blocks are produced',
32
- title: 'producer.heartbeatInterval',
33
- type: 'number',
34
- }),
35
- // TODO: BigInt schema
36
- minStake: z.coerce.number().default(1).register(globalRegistry, {
37
- description: 'Minimum stake required to be a Producer',
38
- title: 'producer.minStake',
39
- type: 'number',
40
- }),
41
- mnemonic: MnemonicStringZod.optional().register(globalRegistry, {
42
- description: 'Mnemonic for the Producer wallet',
43
- title: 'producer.mnemonic',
44
- type: 'string',
45
- }),
46
- // TODO: Port schema
47
- port: z.coerce.number().default(8081).register(globalRegistry, {
48
- default: 8081,
49
- description: 'Port for the Producer',
50
- title: 'producer.port',
51
- type: 'number',
52
- }),
53
- // TODO: Address schema
54
- rewardAddress: z.string().optional().register(globalRegistry, {
55
- description: 'Address to receive block rewards',
56
- title: 'producer.rewardAddress',
57
- type: 'string',
58
- }),
59
- }).shape)
60
-
61
- export type ProducerConfig = z.infer<typeof ProducerConfigZod>
@@ -1,26 +0,0 @@
1
- import { globalRegistry, z } from 'zod'
2
-
3
- import { MnemonicStringZod } from '../../validation/index.ts'
4
- import { BaseConfigZod } from '../Base.ts'
5
-
6
- export const RewardRedemptionConfigZod = BaseConfigZod.extend(z.object({
7
- host: z.string().default('localhost').register(globalRegistry, {
8
- default: 'localhost',
9
- description: 'Host for the Redemption API',
10
- title: 'rewardRedemptionApi.host',
11
- type: 'string',
12
- }),
13
- mnemonic: MnemonicStringZod.optional().register(globalRegistry, {
14
- description: 'Mnemonic for the Redemption API wallet',
15
- title: 'rewardRedemptionApi.mnemonic',
16
- type: 'string',
17
- }),
18
- port: z.coerce.number().default(8082).register(globalRegistry, {
19
- default: 8082,
20
- description: 'Port for the Redemption API',
21
- title: 'rewardRedemptionApi.port',
22
- type: 'number',
23
- }),
24
- }).shape)
25
-
26
- export type RewardRedemptionConfig = z.infer<typeof RewardRedemptionConfigZod>
@@ -1,6 +0,0 @@
1
- export * from './Api.ts'
2
- export * from './Api.ts'
3
- export * from './Bridge.ts'
4
- export * from './Mempool.ts'
5
- export * from './Producer.ts'
6
- export * from './RewardRedemption.ts'