@xyo-network/xl1-protocol-model 1.26.1

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 (347) hide show
  1. package/dist/neutral/BlockNumber/BlockNumber.d.ts +35 -0
  2. package/dist/neutral/BlockNumber/BlockNumber.d.ts.map +1 -0
  3. package/dist/neutral/BlockNumber/EthBlockNumber.d.ts +46 -0
  4. package/dist/neutral/BlockNumber/EthBlockNumber.d.ts.map +1 -0
  5. package/dist/neutral/BlockNumber/Numberish.d.ts +6 -0
  6. package/dist/neutral/BlockNumber/Numberish.d.ts.map +1 -0
  7. package/dist/neutral/BlockNumber/XL1BlockNumber.d.ts +46 -0
  8. package/dist/neutral/BlockNumber/XL1BlockNumber.d.ts.map +1 -0
  9. package/dist/neutral/BlockNumber/index.d.ts +5 -0
  10. package/dist/neutral/BlockNumber/index.d.ts.map +1 -0
  11. package/dist/neutral/Initializable.d.ts +9 -0
  12. package/dist/neutral/Initializable.d.ts.map +1 -0
  13. package/dist/neutral/RecordKeyType.d.ts +4 -0
  14. package/dist/neutral/RecordKeyType.d.ts.map +1 -0
  15. package/dist/neutral/Step/StepHash.d.ts +11 -0
  16. package/dist/neutral/Step/StepHash.d.ts.map +1 -0
  17. package/dist/neutral/Step/StepIdentity.d.ts +19 -0
  18. package/dist/neutral/Step/StepIdentity.d.ts.map +1 -0
  19. package/dist/neutral/Step/StepSizes.d.ts +12 -0
  20. package/dist/neutral/Step/StepSizes.d.ts.map +1 -0
  21. package/dist/neutral/Step/index.d.ts +4 -0
  22. package/dist/neutral/Step/index.d.ts.map +1 -0
  23. package/dist/neutral/TransferPayload.d.ts +79 -0
  24. package/dist/neutral/TransferPayload.d.ts.map +1 -0
  25. package/dist/neutral/amount/ShiftedBigIntConfig.d.ts +9 -0
  26. package/dist/neutral/amount/ShiftedBigIntConfig.d.ts.map +1 -0
  27. package/dist/neutral/amount/XL1AmountInstance.d.ts +16 -0
  28. package/dist/neutral/amount/XL1AmountInstance.d.ts.map +1 -0
  29. package/dist/neutral/amount/index.d.ts +3 -0
  30. package/dist/neutral/amount/index.d.ts.map +1 -0
  31. package/dist/neutral/block/AllowedBlockPayload.d.ts +40 -0
  32. package/dist/neutral/block/AllowedBlockPayload.d.ts.map +1 -0
  33. package/dist/neutral/block/BlockBoundWitness.d.ts +544 -0
  34. package/dist/neutral/block/BlockBoundWitness.d.ts.map +1 -0
  35. package/dist/neutral/block/HydratedBlock.d.ts +1466 -0
  36. package/dist/neutral/block/HydratedBlock.d.ts.map +1 -0
  37. package/dist/neutral/block/index.d.ts +6 -0
  38. package/dist/neutral/block/index.d.ts.map +1 -0
  39. package/dist/neutral/block/signed/SignedBlockBoundWitness.d.ts +168 -0
  40. package/dist/neutral/block/signed/SignedBlockBoundWitness.d.ts.map +1 -0
  41. package/dist/neutral/block/signed/SignedBlockBoundWitnessWithHashMeta.d.ts +286 -0
  42. package/dist/neutral/block/signed/SignedBlockBoundWitnessWithHashMeta.d.ts.map +1 -0
  43. package/dist/neutral/block/signed/SignedBlockBoundWitnessWithStorageMeta.d.ts +343 -0
  44. package/dist/neutral/block/signed/SignedBlockBoundWitnessWithStorageMeta.d.ts.map +1 -0
  45. package/dist/neutral/block/signed/index.d.ts +4 -0
  46. package/dist/neutral/block/signed/index.d.ts.map +1 -0
  47. package/dist/neutral/block/unsigned/UnsignedBlockBoundWitness.d.ts +168 -0
  48. package/dist/neutral/block/unsigned/UnsignedBlockBoundWitness.d.ts.map +1 -0
  49. package/dist/neutral/block/unsigned/index.d.ts +2 -0
  50. package/dist/neutral/block/unsigned/index.d.ts.map +1 -0
  51. package/dist/neutral/chain/Chain.d.ts +4 -0
  52. package/dist/neutral/chain/Chain.d.ts.map +1 -0
  53. package/dist/neutral/chain/ChainAnalyzer.d.ts +10 -0
  54. package/dist/neutral/chain/ChainAnalyzer.d.ts.map +1 -0
  55. package/dist/neutral/chain/ChainId.d.ts +4 -0
  56. package/dist/neutral/chain/ChainId.d.ts.map +1 -0
  57. package/dist/neutral/chain/index.d.ts +4 -0
  58. package/dist/neutral/chain/index.d.ts.map +1 -0
  59. package/dist/neutral/fields/Addressable.d.ts +6 -0
  60. package/dist/neutral/fields/Addressable.d.ts.map +1 -0
  61. package/dist/neutral/fields/BlockDuration.d.ts +25 -0
  62. package/dist/neutral/fields/BlockDuration.d.ts.map +1 -0
  63. package/dist/neutral/fields/BlockNumber.d.ts +32 -0
  64. package/dist/neutral/fields/BlockNumber.d.ts.map +1 -0
  65. package/dist/neutral/fields/ChainReference.d.ts +11 -0
  66. package/dist/neutral/fields/ChainReference.d.ts.map +1 -0
  67. package/dist/neutral/fields/index.d.ts +5 -0
  68. package/dist/neutral/fields/index.d.ts.map +1 -0
  69. package/dist/neutral/index.d.ts +15 -0
  70. package/dist/neutral/index.d.ts.map +1 -0
  71. package/dist/neutral/index.mjs +1699 -0
  72. package/dist/neutral/index.mjs.map +1 -0
  73. package/dist/neutral/map/AsyncMap.d.ts +42 -0
  74. package/dist/neutral/map/AsyncMap.d.ts.map +1 -0
  75. package/dist/neutral/map/MapType.d.ts +17 -0
  76. package/dist/neutral/map/MapType.d.ts.map +1 -0
  77. package/dist/neutral/map/SyncMap.d.ts +41 -0
  78. package/dist/neutral/map/SyncMap.d.ts.map +1 -0
  79. package/dist/neutral/map/index.d.ts +4 -0
  80. package/dist/neutral/map/index.d.ts.map +1 -0
  81. package/dist/neutral/model/AccountBalance.d.ts +133 -0
  82. package/dist/neutral/model/AccountBalance.d.ts.map +1 -0
  83. package/dist/neutral/model/ArrayBuffer.d.ts +6 -0
  84. package/dist/neutral/model/ArrayBuffer.d.ts.map +1 -0
  85. package/dist/neutral/model/BlockRange/BlockRange.d.ts +32 -0
  86. package/dist/neutral/model/BlockRange/BlockRange.d.ts.map +1 -0
  87. package/dist/neutral/model/BlockRange/EthBlockRange.d.ts +32 -0
  88. package/dist/neutral/model/BlockRange/EthBlockRange.d.ts.map +1 -0
  89. package/dist/neutral/model/BlockRange/Numberish.d.ts +4 -0
  90. package/dist/neutral/model/BlockRange/Numberish.d.ts.map +1 -0
  91. package/dist/neutral/model/BlockRange/Range.d.ts +18 -0
  92. package/dist/neutral/model/BlockRange/Range.d.ts.map +1 -0
  93. package/dist/neutral/model/BlockRange/XL1BlockRange.d.ts +32 -0
  94. package/dist/neutral/model/BlockRange/XL1BlockRange.d.ts.map +1 -0
  95. package/dist/neutral/model/BlockRange/index.d.ts +5 -0
  96. package/dist/neutral/model/BlockRange/index.d.ts.map +1 -0
  97. package/dist/neutral/model/BlockRate.d.ts +290 -0
  98. package/dist/neutral/model/BlockRate.d.ts.map +1 -0
  99. package/dist/neutral/model/ChainQualification.d.ts +57 -0
  100. package/dist/neutral/model/ChainQualification.d.ts.map +1 -0
  101. package/dist/neutral/model/Context/BaseContext.d.ts +5 -0
  102. package/dist/neutral/model/Context/BaseContext.d.ts.map +1 -0
  103. package/dist/neutral/model/Context/BaseContext.zod.d.ts +26 -0
  104. package/dist/neutral/model/Context/BaseContext.zod.d.ts.map +1 -0
  105. package/dist/neutral/model/Context/BlockContext.d.ts +9 -0
  106. package/dist/neutral/model/Context/BlockContext.d.ts.map +1 -0
  107. package/dist/neutral/model/Context/BlockContext.zod.d.ts +33 -0
  108. package/dist/neutral/model/Context/BlockContext.zod.d.ts.map +1 -0
  109. package/dist/neutral/model/Context/CachingContext.d.ts +5 -0
  110. package/dist/neutral/model/Context/CachingContext.d.ts.map +1 -0
  111. package/dist/neutral/model/Context/CachingContext.zod.d.ts +10 -0
  112. package/dist/neutral/model/Context/CachingContext.zod.d.ts.map +1 -0
  113. package/dist/neutral/model/Context/ChainContext.d.ts +9 -0
  114. package/dist/neutral/model/Context/ChainContext.d.ts.map +1 -0
  115. package/dist/neutral/model/Context/ChainContext.zod.d.ts +115 -0
  116. package/dist/neutral/model/Context/ChainContext.zod.d.ts.map +1 -0
  117. package/dist/neutral/model/Context/HeadContext.d.ts +5 -0
  118. package/dist/neutral/model/Context/HeadContext.d.ts.map +1 -0
  119. package/dist/neutral/model/Context/HeadContext.zod.d.ts +70 -0
  120. package/dist/neutral/model/Context/HeadContext.zod.d.ts.map +1 -0
  121. package/dist/neutral/model/Context/index.d.ts +11 -0
  122. package/dist/neutral/model/Context/index.d.ts.map +1 -0
  123. package/dist/neutral/model/GatewayName.d.ts +6 -0
  124. package/dist/neutral/model/GatewayName.d.ts.map +1 -0
  125. package/dist/neutral/model/HydratedTransaction.d.ts +2300 -0
  126. package/dist/neutral/model/HydratedTransaction.d.ts.map +1 -0
  127. package/dist/neutral/model/OpCodes.d.ts +3 -0
  128. package/dist/neutral/model/OpCodes.d.ts.map +1 -0
  129. package/dist/neutral/model/PayloadMap.d.ts +10 -0
  130. package/dist/neutral/model/PayloadMap.d.ts.map +1 -0
  131. package/dist/neutral/model/Permission.d.ts +59 -0
  132. package/dist/neutral/model/Permission.d.ts.map +1 -0
  133. package/dist/neutral/model/Position.d.ts +13 -0
  134. package/dist/neutral/model/Position.d.ts.map +1 -0
  135. package/dist/neutral/model/PositionId.d.ts +6 -0
  136. package/dist/neutral/model/PositionId.d.ts.map +1 -0
  137. package/dist/neutral/model/RangeMultipliers.d.ts +10 -0
  138. package/dist/neutral/model/RangeMultipliers.d.ts.map +1 -0
  139. package/dist/neutral/model/RewardShare.d.ts +3 -0
  140. package/dist/neutral/model/RewardShare.d.ts.map +1 -0
  141. package/dist/neutral/model/RewardsRangeOptions.d.ts +16 -0
  142. package/dist/neutral/model/RewardsRangeOptions.d.ts.map +1 -0
  143. package/dist/neutral/model/Sequence.d.ts +15 -0
  144. package/dist/neutral/model/Sequence.d.ts.map +1 -0
  145. package/dist/neutral/model/Stake.d.ts +121 -0
  146. package/dist/neutral/model/Stake.d.ts.map +1 -0
  147. package/dist/neutral/model/StakeShare.d.ts +3 -0
  148. package/dist/neutral/model/StakeShare.d.ts.map +1 -0
  149. package/dist/neutral/model/TimeDomain.d.ts +4 -0
  150. package/dist/neutral/model/TimeDomain.d.ts.map +1 -0
  151. package/dist/neutral/model/TransferPair.d.ts +12 -0
  152. package/dist/neutral/model/TransferPair.d.ts.map +1 -0
  153. package/dist/neutral/model/addresses.d.ts +28 -0
  154. package/dist/neutral/model/addresses.d.ts.map +1 -0
  155. package/dist/neutral/model/defaultRewardRatio.d.ts +3 -0
  156. package/dist/neutral/model/defaultRewardRatio.d.ts.map +1 -0
  157. package/dist/neutral/model/defaultTransactionFees.d.ts +4 -0
  158. package/dist/neutral/model/defaultTransactionFees.d.ts.map +1 -0
  159. package/dist/neutral/model/index.d.ts +28 -0
  160. package/dist/neutral/model/index.d.ts.map +1 -0
  161. package/dist/neutral/model/minTransactionFees.d.ts +4 -0
  162. package/dist/neutral/model/minTransactionFees.d.ts.map +1 -0
  163. package/dist/neutral/model/rewards.d.ts +15 -0
  164. package/dist/neutral/model/rewards.d.ts.map +1 -0
  165. package/dist/neutral/model/version.d.ts +11 -0
  166. package/dist/neutral/model/version.d.ts.map +1 -0
  167. package/dist/neutral/payload/StepIdentityPayload.d.ts +20 -0
  168. package/dist/neutral/payload/StepIdentityPayload.d.ts.map +1 -0
  169. package/dist/neutral/payload/elevatable/Bridge/BridgeCompletion.d.ts +23 -0
  170. package/dist/neutral/payload/elevatable/Bridge/BridgeCompletion.d.ts.map +1 -0
  171. package/dist/neutral/payload/elevatable/Bridge/BridgeDestinationObservation.d.ts +33 -0
  172. package/dist/neutral/payload/elevatable/Bridge/BridgeDestinationObservation.d.ts.map +1 -0
  173. package/dist/neutral/payload/elevatable/Bridge/BridgeDetails.d.ts +45 -0
  174. package/dist/neutral/payload/elevatable/Bridge/BridgeDetails.d.ts.map +1 -0
  175. package/dist/neutral/payload/elevatable/Bridge/BridgeIntent.d.ts +31 -0
  176. package/dist/neutral/payload/elevatable/Bridge/BridgeIntent.d.ts.map +1 -0
  177. package/dist/neutral/payload/elevatable/Bridge/BridgeSourceObservation.d.ts +33 -0
  178. package/dist/neutral/payload/elevatable/Bridge/BridgeSourceObservation.d.ts.map +1 -0
  179. package/dist/neutral/payload/elevatable/Bridge/index.d.ts +6 -0
  180. package/dist/neutral/payload/elevatable/Bridge/index.d.ts.map +1 -0
  181. package/dist/neutral/payload/elevatable/ChainStakeIntent.d.ts +24 -0
  182. package/dist/neutral/payload/elevatable/ChainStakeIntent.d.ts.map +1 -0
  183. package/dist/neutral/payload/elevatable/Executable.d.ts +20 -0
  184. package/dist/neutral/payload/elevatable/Executable.d.ts.map +1 -0
  185. package/dist/neutral/payload/elevatable/Hash.d.ts +21 -0
  186. package/dist/neutral/payload/elevatable/Hash.d.ts.map +1 -0
  187. package/dist/neutral/payload/elevatable/StepComplete.d.ts +22 -0
  188. package/dist/neutral/payload/elevatable/StepComplete.d.ts.map +1 -0
  189. package/dist/neutral/payload/elevatable/Time.d.ts +71 -0
  190. package/dist/neutral/payload/elevatable/Time.d.ts.map +1 -0
  191. package/dist/neutral/payload/elevatable/index.d.ts +7 -0
  192. package/dist/neutral/payload/elevatable/index.d.ts.map +1 -0
  193. package/dist/neutral/payload/index.d.ts +3 -0
  194. package/dist/neutral/payload/index.d.ts.map +1 -0
  195. package/dist/neutral/provider/Provider.d.ts +6 -0
  196. package/dist/neutral/provider/Provider.d.ts.map +1 -0
  197. package/dist/neutral/provider/ProviderMoniker.d.ts +9 -0
  198. package/dist/neutral/provider/ProviderMoniker.d.ts.map +1 -0
  199. package/dist/neutral/provider/index.d.ts +3 -0
  200. package/dist/neutral/provider/index.d.ts.map +1 -0
  201. package/dist/neutral/transaction/TransactionBoundWitness.d.ts +2127 -0
  202. package/dist/neutral/transaction/TransactionBoundWitness.d.ts.map +1 -0
  203. package/dist/neutral/transaction/TransactionFees.d.ts +138 -0
  204. package/dist/neutral/transaction/TransactionFees.d.ts.map +1 -0
  205. package/dist/neutral/transaction/TransactionGasCosts.d.ts +38 -0
  206. package/dist/neutral/transaction/TransactionGasCosts.d.ts.map +1 -0
  207. package/dist/neutral/transaction/index.d.ts +4 -0
  208. package/dist/neutral/transaction/index.d.ts.map +1 -0
  209. package/dist/neutral/xl1/AttoXL1.d.ts +15 -0
  210. package/dist/neutral/xl1/AttoXL1.d.ts.map +1 -0
  211. package/dist/neutral/xl1/FemtoXL1.d.ts +15 -0
  212. package/dist/neutral/xl1/FemtoXL1.d.ts.map +1 -0
  213. package/dist/neutral/xl1/MicroXL1.d.ts +15 -0
  214. package/dist/neutral/xl1/MicroXL1.d.ts.map +1 -0
  215. package/dist/neutral/xl1/MilliXL1.d.ts +15 -0
  216. package/dist/neutral/xl1/MilliXL1.d.ts.map +1 -0
  217. package/dist/neutral/xl1/NanoXL1.d.ts +15 -0
  218. package/dist/neutral/xl1/NanoXL1.d.ts.map +1 -0
  219. package/dist/neutral/xl1/PicoXL1.d.ts +15 -0
  220. package/dist/neutral/xl1/PicoXL1.d.ts.map +1 -0
  221. package/dist/neutral/xl1/XL1.d.ts +15 -0
  222. package/dist/neutral/xl1/XL1.d.ts.map +1 -0
  223. package/dist/neutral/xl1/XL1Units.d.ts +10 -0
  224. package/dist/neutral/xl1/XL1Units.d.ts.map +1 -0
  225. package/dist/neutral/xl1/index.d.ts +9 -0
  226. package/dist/neutral/xl1/index.d.ts.map +1 -0
  227. package/dist/neutral/xl1/isXL1Factory.d.ts +12 -0
  228. package/dist/neutral/xl1/isXL1Factory.d.ts.map +1 -0
  229. package/dist/neutral/xl1/xl1MaxValue.d.ts +3 -0
  230. package/dist/neutral/xl1/xl1MaxValue.d.ts.map +1 -0
  231. package/package.json +65 -0
  232. package/src/BlockNumber/BlockNumber.ts +24 -0
  233. package/src/BlockNumber/EthBlockNumber.ts +25 -0
  234. package/src/BlockNumber/Numberish.ts +9 -0
  235. package/src/BlockNumber/XL1BlockNumber.ts +25 -0
  236. package/src/BlockNumber/index.ts +4 -0
  237. package/src/RecordKeyType.ts +5 -0
  238. package/src/Step/StepHash.ts +10 -0
  239. package/src/Step/StepIdentity.ts +46 -0
  240. package/src/Step/StepSizes.ts +47 -0
  241. package/src/Step/index.ts +3 -0
  242. package/src/TransferPayload.ts +35 -0
  243. package/src/amount/ShiftedBigIntConfig.ts +8 -0
  244. package/src/amount/XL1AmountInstance.ts +19 -0
  245. package/src/amount/index.ts +2 -0
  246. package/src/block/AllowedBlockPayload.ts +73 -0
  247. package/src/block/BlockBoundWitness.ts +72 -0
  248. package/src/block/HydratedBlock.ts +135 -0
  249. package/src/block/index.ts +5 -0
  250. package/src/block/signed/SignedBlockBoundWitness.ts +22 -0
  251. package/src/block/signed/SignedBlockBoundWitnessWithHashMeta.ts +35 -0
  252. package/src/block/signed/SignedBlockBoundWitnessWithStorageMeta.ts +41 -0
  253. package/src/block/signed/index.ts +3 -0
  254. package/src/block/unsigned/UnsignedBlockBoundWitness.ts +22 -0
  255. package/src/block/unsigned/index.ts +1 -0
  256. package/src/chain/Chain.ts +7 -0
  257. package/src/chain/ChainAnalyzer.ts +11 -0
  258. package/src/chain/ChainId.ts +4 -0
  259. package/src/chain/index.ts +3 -0
  260. package/src/fields/Addressable.ts +7 -0
  261. package/src/fields/BlockDuration.ts +25 -0
  262. package/src/fields/BlockNumber.ts +40 -0
  263. package/src/fields/ChainReference.ts +11 -0
  264. package/src/fields/index.ts +4 -0
  265. package/src/index.ts +14 -0
  266. package/src/map/AsyncMap.ts +38 -0
  267. package/src/map/MapType.ts +27 -0
  268. package/src/map/SyncMap.ts +38 -0
  269. package/src/map/index.ts +3 -0
  270. package/src/model/AccountBalance.ts +58 -0
  271. package/src/model/ArrayBuffer.ts +44 -0
  272. package/src/model/BlockRange/BlockRange.ts +43 -0
  273. package/src/model/BlockRange/EthBlockRange.ts +43 -0
  274. package/src/model/BlockRange/Numberish.ts +6 -0
  275. package/src/model/BlockRange/Range.ts +17 -0
  276. package/src/model/BlockRange/XL1BlockRange.ts +43 -0
  277. package/src/model/BlockRange/index.ts +4 -0
  278. package/src/model/BlockRate.ts +108 -0
  279. package/src/model/ChainQualification.ts +48 -0
  280. package/src/model/Context/BaseContext.ts +6 -0
  281. package/src/model/Context/BaseContext.zod.ts +36 -0
  282. package/src/model/Context/BlockContext.ts +12 -0
  283. package/src/model/Context/BlockContext.zod.ts +20 -0
  284. package/src/model/Context/CachingContext.ts +6 -0
  285. package/src/model/Context/CachingContext.zod.ts +4 -0
  286. package/src/model/Context/ChainContext.ts +12 -0
  287. package/src/model/Context/ChainContext.zod.ts +17 -0
  288. package/src/model/Context/HeadContext.ts +6 -0
  289. package/src/model/Context/HeadContext.zod.ts +13 -0
  290. package/src/model/Context/index.ts +10 -0
  291. package/src/model/GatewayName.ts +4 -0
  292. package/src/model/HydratedTransaction.ts +169 -0
  293. package/src/model/OpCodes.ts +2 -0
  294. package/src/model/PayloadMap.ts +13 -0
  295. package/src/model/Permission.ts +29 -0
  296. package/src/model/Position.ts +21 -0
  297. package/src/model/PositionId.ts +4 -0
  298. package/src/model/RangeMultipliers.ts +13 -0
  299. package/src/model/RewardShare.ts +2 -0
  300. package/src/model/RewardsRangeOptions.ts +13 -0
  301. package/src/model/Sequence.ts +21 -0
  302. package/src/model/Stake.ts +47 -0
  303. package/src/model/StakeShare.ts +2 -0
  304. package/src/model/TimeDomain.ts +8 -0
  305. package/src/model/TransferPair.ts +7 -0
  306. package/src/model/addresses.ts +36 -0
  307. package/src/model/defaultRewardRatio.ts +3 -0
  308. package/src/model/defaultTransactionFees.ts +11 -0
  309. package/src/model/index.ts +27 -0
  310. package/src/model/minTransactionFees.ts +10 -0
  311. package/src/model/rewards.ts +18 -0
  312. package/src/model/spec/fixtures/index.ts +2 -0
  313. package/src/model/spec/fixtures/signedHydratedTransaction.ts +58 -0
  314. package/src/model/spec/fixtures/unsignedHydratedTransaction.ts +62 -0
  315. package/src/model/version.ts +10 -0
  316. package/src/payload/StepIdentityPayload.ts +25 -0
  317. package/src/payload/elevatable/Bridge/BridgeCompletion.ts +28 -0
  318. package/src/payload/elevatable/Bridge/BridgeDestinationObservation.ts +38 -0
  319. package/src/payload/elevatable/Bridge/BridgeDetails.ts +69 -0
  320. package/src/payload/elevatable/Bridge/BridgeIntent.ts +36 -0
  321. package/src/payload/elevatable/Bridge/BridgeSourceObservation.ts +37 -0
  322. package/src/payload/elevatable/Bridge/index.ts +5 -0
  323. package/src/payload/elevatable/ChainStakeIntent.ts +45 -0
  324. package/src/payload/elevatable/Executable.ts +35 -0
  325. package/src/payload/elevatable/Hash.ts +25 -0
  326. package/src/payload/elevatable/StepComplete.ts +31 -0
  327. package/src/payload/elevatable/Time.ts +61 -0
  328. package/src/payload/elevatable/index.ts +6 -0
  329. package/src/payload/index.ts +2 -0
  330. package/src/provider/Provider.ts +6 -0
  331. package/src/provider/ProviderMoniker.ts +15 -0
  332. package/src/provider/index.ts +2 -0
  333. package/src/transaction/TransactionBoundWitness.ts +187 -0
  334. package/src/transaction/TransactionFees.ts +73 -0
  335. package/src/transaction/TransactionGasCosts.ts +42 -0
  336. package/src/transaction/index.ts +3 -0
  337. package/src/xl1/AttoXL1.ts +19 -0
  338. package/src/xl1/FemtoXL1.ts +20 -0
  339. package/src/xl1/MicroXL1.ts +20 -0
  340. package/src/xl1/MilliXL1.ts +20 -0
  341. package/src/xl1/NanoXL1.ts +20 -0
  342. package/src/xl1/PicoXL1.ts +20 -0
  343. package/src/xl1/XL1.ts +20 -0
  344. package/src/xl1/XL1Units.ts +26 -0
  345. package/src/xl1/index.ts +8 -0
  346. package/src/xl1/isXL1Factory.ts +56 -0
  347. package/src/xl1/xl1MaxValue.ts +2 -0
@@ -0,0 +1,58 @@
1
+ export const signedHydratedTransactionWithHashMeta = [
2
+ {
3
+ schema: 'network.xyo.boundwitness',
4
+ addresses: [
5
+ 'ae2966ff28d3b82e91dbec3fb1e285152ba2e782',
6
+ ],
7
+ payload_hashes: [
8
+ '7c4deb6830f9c2f45d61691467825dd1ec08c22b1ac178d8b0737af714a4a636',
9
+ 'b0a65744aac6d5a1cc79af5e51d6631618c2b6672f294b1972760019a9b4e174',
10
+ ],
11
+ payload_schemas: [
12
+ 'network.xyo.boundwitness',
13
+ 'network.xyo.stock.market.tzero.snapshot',
14
+ ],
15
+ previous_hashes: [
16
+ null,
17
+ ],
18
+ $signatures: [
19
+ 'fa229bc173704cdbe226f44e15f1f7a7df44fdfe575ffc96ce6f24574b21065f02c3a4d8f84beb01dfd26d70128ca0cb2f69b4f9ec912c2310e4ee5f999619d3',
20
+ ],
21
+ nbf: 250_042,
22
+ exp: 250_052,
23
+ fees: {
24
+ base: 'e8d4a51000',
25
+ gasLimit: '038d7ea4c68000',
26
+ gasPrice: '02540be400',
27
+ priority: '00',
28
+ },
29
+ chain: 'dd381fbb392c85160d8b0453e446757b12384046',
30
+ from: 'ae2966ff28d3b82e91dbec3fb1e285152ba2e782',
31
+ _dataHash: 'c3afe940115d0bc2581567d59586f42e5be3f2fe6b42520834a0ec3920dee98b',
32
+ _hash: 'f8b6222c9361e60ddff5982b4e88d3746c2e072edaf58611368b0ad651ee67c2',
33
+ _sequence: '00000000000000000000000051ee67c2',
34
+ },
35
+ [{
36
+ askPrice: 0.28,
37
+ askPriceRate: null,
38
+ askQtyBookTotal: 140_619,
39
+ askQuantity: 716,
40
+ bidPrice: 0.18,
41
+ bidPriceRate: null,
42
+ bidQtyBookTotal: 7688,
43
+ bidQuantity: 2,
44
+ high: null,
45
+ lastPrice: null,
46
+ lastQuantity: null,
47
+ low: null,
48
+ open: null,
49
+ prevClosePx: 0.28,
50
+ schema: 'network.xyo.stock.market.tzero.snapshot',
51
+ symbol: 'XYLB',
52
+ timestamp: '2026-01-19T17:22:02.108746148-05:00',
53
+ volume: 0,
54
+ _dataHash: 'b0a65744aac6d5a1cc79af5e51d6631618c2b6672f294b1972760019a9b4e174',
55
+ _hash: 'b0a65744aac6d5a1cc79af5e51d6631618c2b6672f294b1972760019a9b4e174',
56
+ _sequence: '0000019bd859cdf500000001a9b4e174',
57
+ }],
58
+ ]
@@ -0,0 +1,62 @@
1
+ export const unsignedHydratedTransactionWithHashMeta = [
2
+ {
3
+ $signatures: [],
4
+ addresses: [],
5
+ chain: '944ac6a2ffc27ab773f34193e43f20ab7542b0ea',
6
+ exp: 11,
7
+ fees: {
8
+ base: 'e8d4a51000',
9
+ gasLimit: '038d7ea4c68000',
10
+ gasPrice: '02540be400',
11
+ priority: '00',
12
+ },
13
+ from: 'c5c9d2a8e8d0b0eba521aec623ffcb9e0982f513',
14
+ nbf: 1,
15
+ payload_hashes: [
16
+ '01bbcd4c58fd88488882ba54e13e92603f13c34695eda64780502acc80c3fcc1',
17
+ 'ff127a824dc672ff5b7a32d2c7deffcdde3cc417ad112510532f24a2e948516a',
18
+ '92693e6fefeed94eb80872ba9e2c86d7861fc84e4bc5b775ebe9966e68c26767',
19
+ '85009387d332dffa781bbf6fa107715f36f9d6b3294c5cc8fd1ce8ada207d2bb',
20
+ ],
21
+ payload_schemas: [
22
+ 'network.xyo.hash',
23
+ 'network.xyo.hash',
24
+ 'network.xyo.id',
25
+ 'network.xyo.id',
26
+ ],
27
+ previous_hashes: [],
28
+ schema: 'network.xyo.boundwitness',
29
+ script: [
30
+ 'elevate|01bbcd4c58fd88488882ba54e13e92603f13c34695eda64780502acc80c3fcc1',
31
+ 'elevate|ff127a824dc672ff5b7a32d2c7deffcdde3cc417ad112510532f24a2e948516a',
32
+ ],
33
+ _dataHash: '214029ca586455e66fea02896c6d69739e400917c08e4e8ec1e9818c4a19bb17',
34
+ _hash: '59aacdd66055a63e6a0686a33f155be5b6afca0630a9abfee7ae9e79f057eec8',
35
+ },
36
+ [
37
+ {
38
+ hash: '92693e6fefeed94eb80872ba9e2c86d7861fc84e4bc5b775ebe9966e68c26767',
39
+ schema: 'network.xyo.hash',
40
+ _dataHash: '01bbcd4c58fd88488882ba54e13e92603f13c34695eda64780502acc80c3fcc1',
41
+ _hash: '01bbcd4c58fd88488882ba54e13e92603f13c34695eda64780502acc80c3fcc1',
42
+ },
43
+ {
44
+ hash: '85009387d332dffa781bbf6fa107715f36f9d6b3294c5cc8fd1ce8ada207d2bb',
45
+ schema: 'network.xyo.hash',
46
+ _dataHash: 'ff127a824dc672ff5b7a32d2c7deffcdde3cc417ad112510532f24a2e948516a',
47
+ _hash: 'ff127a824dc672ff5b7a32d2c7deffcdde3cc417ad112510532f24a2e948516a',
48
+ },
49
+ {
50
+ salt: 'Hello from Sample 0 - 2026-01-15T22:41:36.587Z',
51
+ schema: 'network.xyo.id',
52
+ _dataHash: '92693e6fefeed94eb80872ba9e2c86d7861fc84e4bc5b775ebe9966e68c26767',
53
+ _hash: '92693e6fefeed94eb80872ba9e2c86d7861fc84e4bc5b775ebe9966e68c26767',
54
+ },
55
+ {
56
+ salt: 'Hello from Sample 1 - 2026-01-15T22:41:36.587Z',
57
+ schema: 'network.xyo.id',
58
+ _dataHash: '85009387d332dffa781bbf6fa107715f36f9d6b3294c5cc8fd1ce8ada207d2bb',
59
+ _hash: '85009387d332dffa781bbf6fa107715f36f9d6b3294c5cc8fd1ce8ada207d2bb',
60
+ },
61
+ ],
62
+ ]
@@ -0,0 +1,10 @@
1
+ /** XL1_PROTOCOL_VERSION_MAJOR constant. */
2
+ export const XL1_PROTOCOL_VERSION_MAJOR = 1 as const
3
+ /** XL1_PROTOCOL_VERSION_MINOR constant. */
4
+ export const XL1_PROTOCOL_VERSION_MINOR = 2 as const
5
+ /** XL1_PROTOCOL_VERSION_PATCH constant. */
6
+ export const XL1_PROTOCOL_VERSION_PATCH = 0 as const
7
+ /** XL1_PROTOCOL_VERSION_STRING constant. */
8
+ export const XL1_PROTOCOL_VERSION_STRING = `${XL1_PROTOCOL_VERSION_MAJOR}.${XL1_PROTOCOL_VERSION_MINOR}.${XL1_PROTOCOL_VERSION_PATCH}` as const
9
+ /** XL1_PROTOCOL_VERSION constant. */
10
+ export const XL1_PROTOCOL_VERSION = XL1_PROTOCOL_VERSION_MAJOR * 1_000_000 + XL1_PROTOCOL_VERSION_MINOR * 1000 + XL1_PROTOCOL_VERSION_PATCH
@@ -0,0 +1,25 @@
1
+ import { AsObjectFactory } from '@xylabs/sdk-js'
2
+ import type { Payload } from '@xyo-network/sdk-js'
3
+ import { asSchema, isPayloadOfZodType } from '@xyo-network/sdk-js'
4
+ import type { z } from 'zod'
5
+
6
+ import { StepIdentityZod } from '../Step/index.ts'
7
+
8
+ /** Schema identifier for step identity payloads. */
9
+ export const StepIdentitySchema = asSchema('network.xyo.chain.step.identity', true)
10
+ /** Schema type for StepIdentity payloads. */
11
+ export type StepIdentitySchema = typeof StepIdentitySchema
12
+
13
+ /** Fields for a step identity, inferred from the StepIdentityZod schema. */
14
+ export type StepIdentityFields = z.infer<typeof StepIdentityZod>
15
+
16
+ /**
17
+ * A Step Identity Payload
18
+ */
19
+ export type StepIdentityPayload = Payload<StepIdentityFields, StepIdentitySchema>
20
+
21
+ /** Type guard that checks whether a value is a StepIdentityPayload. */
22
+ export const isStepIdentityPayload = isPayloadOfZodType<StepIdentityPayload>(StepIdentityZod, StepIdentitySchema)
23
+
24
+ /** Casts a value to StepIdentityPayload or returns undefined if it does not match. */
25
+ export const asStepIdentityPayload = AsObjectFactory.create(isStepIdentityPayload)
@@ -0,0 +1,28 @@
1
+ import type { Hash } from '@xylabs/sdk-js'
2
+
3
+ /**
4
+ * Final confirmation tying the intent and the observation together.
5
+ */
6
+ export interface BridgeCompletionFields {
7
+
8
+ /**
9
+ * Block number, event ID, or timestamp when the bridge was completed
10
+ */
11
+ completedAt?: Hash
12
+
13
+ /**
14
+ * Reference to observed destination confirmation hash
15
+ */
16
+ destObservation: Hash
17
+
18
+ /**
19
+ * Reference to source intent hash
20
+ */
21
+ srcIntent?: Hash
22
+
23
+ /**
24
+ * Reference to observed source confirmation hash
25
+ */
26
+ srcObservation: Hash
27
+
28
+ }
@@ -0,0 +1,38 @@
1
+ import { AsObjectFactory, HexZod } from '@xylabs/sdk-js'
2
+ import type { Payload } from '@xyo-network/sdk-js'
3
+ import { asSchema, isPayloadOfZodType } from '@xyo-network/sdk-js'
4
+ import type { z } from 'zod'
5
+
6
+ import { BridgeDetailsFieldsZod } from './BridgeDetails.ts'
7
+
8
+ /** Schema identifier for BridgeDestinationObservation payloads. */
9
+ export const BridgeDestinationObservationSchema = asSchema('network.xyo.chain.bridge.observation.destination', true)
10
+ /** Schema type for BridgeDestinationObservation payloads. */
11
+ export type BridgeDestinationObservationSchema = typeof BridgeDestinationObservationSchema
12
+
13
+ /**
14
+ * Represents an observation that confirms a bridge action occurred on the destination chain.
15
+ */
16
+ export const BridgeDestinationObservationFieldsZod = BridgeDetailsFieldsZod.extend({
17
+ /**
18
+ * Destination chain confirmation
19
+ */
20
+ destConfirmation: HexZod.optional().describe('Destination chain confirmation'),
21
+ })
22
+
23
+ /** BridgeDestinationObservationFields type. */
24
+ export type BridgeDestinationObservationFields = z.infer<typeof BridgeDestinationObservationFieldsZod>
25
+
26
+ /**
27
+ * Represents an observation that confirms a bridge action occurred on the destination chain.
28
+ */
29
+ export type BridgeDestinationObservation = Payload<BridgeDestinationObservationFields, BridgeDestinationObservationSchema>
30
+
31
+ /** Type guard that checks if a value is a valid BridgeDestinationObservation. */
32
+ export const isBridgeDestinationObservation = isPayloadOfZodType<BridgeDestinationObservation>(
33
+ BridgeDestinationObservationFieldsZod,
34
+ BridgeDestinationObservationSchema,
35
+ )
36
+
37
+ /** Converts a value to BridgeDestinationObservation, throwing if invalid. */
38
+ export const asBridgeDestinationObservation = AsObjectFactory.create(isBridgeDestinationObservation)
@@ -0,0 +1,69 @@
1
+ import { HexZod } from '@xylabs/sdk-js'
2
+ import { z } from 'zod'
3
+
4
+ /**
5
+ * Represents a transfer destination
6
+ */
7
+ export const BridgeDetailsDestinationFieldsZod = z.object({
8
+ /**
9
+ * Destination network
10
+ */
11
+ dest: HexZod.describe('The destination network identifier'),
12
+ /**
13
+ * Destination address (EOA or contract)
14
+ */
15
+ destAddress: HexZod.describe('The destination address (EOA or contract)'),
16
+ /**
17
+ * Token amount to bridge to destination
18
+ */
19
+ destAmount: HexZod.describe('The token amount to bridge to destination'),
20
+ /**
21
+ * Token being bridged to
22
+ */
23
+ destToken: HexZod.describe('The token being bridged to'),
24
+ })
25
+
26
+ /**
27
+ * Represents a transfer destination
28
+ */
29
+ export type BridgeDetailsDestinationFields = z.infer<typeof BridgeDetailsDestinationFieldsZod>
30
+
31
+ /**
32
+ * Represents a transfer source
33
+ */
34
+ export const BridgeDetailsSourceFieldsZod = z.object({
35
+ /**
36
+ * Source network
37
+ */
38
+ src: HexZod.describe('The source network identifier'),
39
+
40
+ /**
41
+ * Source address (EOA or contract)
42
+ */
43
+ srcAddress: HexZod.describe('The source address (EOA or contract)'),
44
+ /**
45
+ * Token amount to bridge from source
46
+ */
47
+ srcAmount: HexZod.describe('The token amount to bridge from source'),
48
+ /**
49
+ * Token being bridged from
50
+ */
51
+ srcToken: HexZod.describe('The token being bridged from'),
52
+ })
53
+
54
+ /**
55
+ * Represents a transfer source
56
+ */
57
+ export type BridgeDetailsSourceFields = z.infer<typeof BridgeDetailsSourceFieldsZod>
58
+
59
+ /**
60
+ * Represents a transfer from a source chain/token/address/amount to a destination chain/token/address/amount.
61
+ */
62
+ export const BridgeDetailsFieldsZod = BridgeDetailsSourceFieldsZod.extend(
63
+ BridgeDetailsDestinationFieldsZod.shape,
64
+ )
65
+
66
+ /**
67
+ * Represents a transfer from a source chain/token/address/amount to a destination chain/token/address/amount.
68
+ */
69
+ export type BridgeDetailsFields = z.infer<typeof BridgeDetailsFieldsZod>
@@ -0,0 +1,36 @@
1
+ import { AsObjectFactory } from '@xylabs/sdk-js'
2
+ import type { Payload } from '@xyo-network/sdk-js'
3
+ import { asSchema, isPayloadOfZodType } from '@xyo-network/sdk-js'
4
+ import { z } from 'zod'
5
+
6
+ import { BridgeDetailsFieldsZod } from './BridgeDetails.ts'
7
+
8
+ /** Schema identifier for BridgeIntent payloads. */
9
+ export const BridgeIntentSchema = asSchema('network.xyo.chain.bridge.intent', true)
10
+ /** Schema type for BridgeIntent payloads. */
11
+ export type BridgeIntentSchema = typeof BridgeIntentSchema
12
+
13
+ /**
14
+ * Represents an Address's intent to initiate a token bridge.
15
+ */
16
+ export const BridgeIntentFieldsZod = BridgeDetailsFieldsZod.extend({
17
+ /**
18
+ * Unique identifier for replay protection
19
+ */
20
+ nonce: z.string().describe('Unique identifier for replay protection'),
21
+ })
22
+
23
+ /** BridgeIntentFields type. */
24
+ export type BridgeIntentFields = z.infer<typeof BridgeIntentFieldsZod>
25
+
26
+ /** BridgeIntent type. */
27
+ export type BridgeIntent = Payload<BridgeIntentFields, BridgeIntentSchema>
28
+
29
+ /** Type guard that checks if a value is a valid BridgeIntent. */
30
+ export const isBridgeIntent = isPayloadOfZodType<BridgeIntent>(
31
+ BridgeIntentFieldsZod,
32
+ BridgeIntentSchema,
33
+ )
34
+
35
+ /** Converts a value to BridgeIntent, throwing if invalid. */
36
+ export const asBridgeIntent = AsObjectFactory.create(isBridgeIntent)
@@ -0,0 +1,37 @@
1
+ import { AsObjectFactory, HexZod } from '@xylabs/sdk-js'
2
+ import type { Payload } from '@xyo-network/sdk-js'
3
+ import { asSchema, isPayloadOfZodType } from '@xyo-network/sdk-js'
4
+ import type { z } from 'zod'
5
+
6
+ import { BridgeDetailsFieldsZod } from './BridgeDetails.ts'
7
+
8
+ /** Schema identifier for BridgeSourceObservation payloads. */
9
+ export const BridgeSourceObservationSchema = asSchema('network.xyo.chain.bridge.observation.source', true)
10
+ /** Schema type for BridgeSourceObservation payloads. */
11
+ export type BridgeSourceObservationSchema = typeof BridgeSourceObservationSchema
12
+
13
+ /**
14
+ * Represents an observation that confirms a bridge action occurred on the source chain.
15
+ */
16
+ export const BridgeSourceObservationFieldsZod = BridgeDetailsFieldsZod.extend({
17
+ /**
18
+ * Source chain confirmation
19
+ */
20
+ srcConfirmation: HexZod.optional().describe('Source chain confirmation'),
21
+ })
22
+
23
+ /** BridgeSourceObservationFields type. */
24
+ export type BridgeSourceObservationFields = z.infer<typeof BridgeSourceObservationFieldsZod>
25
+ /**
26
+ * Represents an observation that confirms a bridge action occurred on the source chain.
27
+ */
28
+ export type BridgeSourceObservation = Payload<BridgeSourceObservationFields, BridgeSourceObservationSchema>
29
+
30
+ /** Type guard that checks if a value is a valid BridgeSourceObservation. */
31
+ export const isBridgeSourceObservation = isPayloadOfZodType<BridgeSourceObservation>(
32
+ BridgeSourceObservationFieldsZod,
33
+ BridgeSourceObservationSchema,
34
+ )
35
+
36
+ /** Converts a value to BridgeSourceObservation, throwing if invalid. */
37
+ export const asBridgeSourceObservation = AsObjectFactory.create(isBridgeSourceObservation)
@@ -0,0 +1,5 @@
1
+ export * from './BridgeCompletion.ts'
2
+ export * from './BridgeDestinationObservation.ts'
3
+ export * from './BridgeDetails.ts'
4
+ export * from './BridgeIntent.ts'
5
+ export * from './BridgeSourceObservation.ts'
@@ -0,0 +1,45 @@
1
+ import { AsObjectFactory } from '@xylabs/sdk-js'
2
+ import type { Payload, WithStorageMeta } from '@xyo-network/sdk-js'
3
+ import {
4
+ asSchema, isPayloadOfSchemaType, isStorageMeta,
5
+ } from '@xyo-network/sdk-js'
6
+
7
+ import type { BlockDuration } from '../../fields/index.ts'
8
+ import type { FromFields } from './Executable.ts'
9
+
10
+ /** Schema identifier for chain stake intent payloads. */
11
+ export const ChainStakeIntentSchema = asSchema('network.xyo.chain.stake.intent', true)
12
+ /** Schema type for ChainStakeIntent payloads. */
13
+ export type ChainStakeIntentSchema = typeof ChainStakeIntentSchema
14
+
15
+ /** The type of staking intent, currently limited to 'producer'. */
16
+ export type Intent = 'producer' // | 'bank'
17
+
18
+ /** Fields for a chain stake intent, including the staking intent type and source address. */
19
+ export interface ChainStakeIntentFields extends BlockDuration, FromFields {
20
+ /*
21
+ * The intent of the staking
22
+ */
23
+ intent: Intent
24
+ }
25
+
26
+ /** A payload representing an intent to stake on the chain. */
27
+ export type ChainStakeIntent = Payload<ChainStakeIntentFields, ChainStakeIntentSchema>
28
+
29
+ /** Type guard that checks whether a value is a valid ChainStakeIntent with non-negative nbf and exp. */
30
+ export const isChainStakeIntent = (x?: unknown | null): x is ChainStakeIntent => {
31
+ return isPayloadOfSchemaType<ChainStakeIntent>(ChainStakeIntentSchema)(x)
32
+ && asNonNegativeInteger(x.nbf) !== undefined
33
+ && asNonNegativeInteger(x.exp) !== undefined
34
+ }
35
+ /** Casts a value to ChainStakeIntent or returns undefined if it does not match. */
36
+ export const asChainStakeIntent = AsObjectFactory.create(isChainStakeIntent)
37
+
38
+ /** Type guard that checks whether a value is a ChainStakeIntent with storage metadata. */
39
+ export const isChainStakeIntentWithStorageMeta = (x?: unknown | null): x is WithStorageMeta<ChainStakeIntent> => {
40
+ return isChainStakeIntent(x) && isStorageMeta(x)
41
+ }
42
+
43
+ const asNonNegativeInteger = (num: number) => {
44
+ return (Number.isInteger(num) && num >= 0) ? num : undefined
45
+ }
@@ -0,0 +1,35 @@
1
+ import type { Address, EmptyObject } from '@xylabs/sdk-js'
2
+ import { isAnyPayload } from '@xyo-network/sdk-js'
3
+
4
+ /** FromFields interface. */
5
+ export interface FromFields {
6
+ // the address that is treated as the source of this action
7
+ from: Address
8
+ }
9
+
10
+ /** hasFrom constant. */
11
+ export const hasFrom = (value: unknown): value is FromFields => {
12
+ return (value as FromFields).from !== undefined
13
+ }
14
+
15
+ /** ExecutableFields interface. */
16
+ export interface ExecutableFields {
17
+ script: string[]
18
+ }
19
+
20
+ /** Executable type. */
21
+ export type Executable<T extends EmptyObject = EmptyObject> = T & ExecutableFields
22
+ /** OptionalExecutable type. */
23
+ export type OptionalExecutable<T extends EmptyObject = EmptyObject> = T & Partial<ExecutableFields>
24
+
25
+ /** Type guard that checks if a value is a valid Executable. */
26
+ export const isExecutable = <T extends EmptyObject>(value: T | undefined): value is Executable<T> => {
27
+ return isAnyPayload(value) && Array.isArray((value as unknown as ExecutableFields).script)
28
+ }
29
+
30
+ /** Converts a value to Executable, throwing if invalid. */
31
+ export const asExecutable = <T extends EmptyObject>(value: T | undefined): Executable<T> | undefined => {
32
+ return isExecutable(value)
33
+ ? value as unknown as Executable<T>
34
+ : undefined
35
+ }
@@ -0,0 +1,25 @@
1
+ import type { Hash } from '@xylabs/sdk-js'
2
+ import { AsObjectFactory } from '@xylabs/sdk-js'
3
+ import type { Payload } from '@xyo-network/sdk-js'
4
+ import { asSchema, isPayloadOfSchemaType } from '@xyo-network/sdk-js'
5
+
6
+ /** Schema identifier for hash payloads. */
7
+ export const HashSchema = asSchema('network.xyo.hash', true)
8
+ /** Schema type for Hash payloads. */
9
+ export type HashSchema = typeof HashSchema
10
+
11
+ /** Fields for a hash payload containing a single hash value. */
12
+ export interface HashFields {
13
+ hash: Hash
14
+ }
15
+
16
+ /** A payload containing a hash value. */
17
+ export type HashPayload = Payload<HashFields, HashSchema>
18
+
19
+ /** Type guard that checks whether a value is a HashPayload. */
20
+ export const isHashPayload = isPayloadOfSchemaType<HashPayload>(HashSchema)
21
+
22
+ /** Casts a value to HashPayload or returns undefined if it does not match. */
23
+ export const asHashPayload = AsObjectFactory.create(isHashPayload)
24
+ /** Casts a value to HashPayload with storage metadata or returns undefined. */
25
+ export const asHashPayloadWithStorageMeta = AsObjectFactory.create(isHashPayload)
@@ -0,0 +1,31 @@
1
+ import type { Hash } from '@xylabs/sdk-js'
2
+ import { AsObjectFactory } from '@xylabs/sdk-js'
3
+ import type { Payload } from '@xyo-network/sdk-js'
4
+ import { asSchema, isPayloadOfSchemaType } from '@xyo-network/sdk-js'
5
+
6
+ import type { FromFields } from './Executable.ts'
7
+
8
+ /** Schema identifier for StepComplete payloads. */
9
+ export const StepCompleteSchema = asSchema('network.xyo.chain.step.complete', true)
10
+ /** Schema type for StepComplete payloads. */
11
+ export type StepCompleteSchema = typeof StepCompleteSchema
12
+
13
+ /* This records the completion of a step in the network - needed for network staking rewards */
14
+ /* We will only write these for steps that are eligible for rewards Step 3 (2311) */
15
+
16
+ export interface StepCompleteFields extends FromFields {
17
+ block: number /* The block number on the XL1 network */
18
+ hash: Hash /* The Step Hash */
19
+ size: number /* The size of the step */
20
+ stakeBlock: number /* The block number on ethereum or other staking system */
21
+ }
22
+
23
+ // if this payload is included in a boundwitness, it needs to be available for inspection to be included in block
24
+ /** StepComplete type. */
25
+ export type StepComplete = Payload<StepCompleteFields, StepCompleteSchema>
26
+
27
+ /** Type guard that checks if a value is a valid StepComplete. */
28
+ export const isStepComplete = isPayloadOfSchemaType<StepComplete>(StepCompleteSchema)
29
+
30
+ /** Converts a value to StepComplete, throwing if invalid. */
31
+ export const asStepComplete = AsObjectFactory.create(isStepComplete)
@@ -0,0 +1,61 @@
1
+ import { AsObjectFactory, HashZod } from '@xylabs/sdk-js'
2
+ import {
3
+ asSchema, isPayloadOfSchemaType, PayloadZodOfSchema,
4
+ } from '@xyo-network/sdk-js'
5
+ import { z } from 'zod'
6
+
7
+ // xl1 = xl1 block number, epoch = epoch number, ethereum = ethereum block number
8
+ /** Supported time domains: xl1 block number, epoch timestamp, or ethereum block number. */
9
+ export type TimeDomain = 'xl1' | 'epoch' | 'ethereum'
10
+
11
+ /** Schema identifier for time payloads. */
12
+ export const TimeSchema = asSchema('network.xyo.time', true)
13
+ /** Schema type for Time payloads. */
14
+ export type TimeSchema = typeof TimeSchema
15
+
16
+ /** Zod schema for XL1 time fields including block number and hash. */
17
+ export const XL1TimeFieldsZod = z.object({
18
+ // block number
19
+ xl1: z.number().optional(),
20
+ // block hash
21
+ xl1Hash: HashZod.optional(),
22
+ })
23
+
24
+ /** Zod schema for Ethereum time fields including block number and hash. */
25
+ export const EthereumTimeFieldsZod = z.object({
26
+ // block number
27
+ ethereum: z.number().optional(),
28
+ // block hash
29
+ ethereumHash: HashZod.optional(),
30
+ })
31
+
32
+ /** Zod schema for epoch time fields in milliseconds. */
33
+ export const EpochTimeFieldsZod = z.object({
34
+ // in milliseconds
35
+ epoch: z.number(),
36
+ })
37
+
38
+ /** Combined Zod schema for all time fields across XL1, Ethereum, and epoch domains. */
39
+ export const TimeFieldsZod = XL1TimeFieldsZod.extend(XL1TimeFieldsZod.shape).extend(EthereumTimeFieldsZod.shape).extend(EpochTimeFieldsZod.shape)
40
+
41
+ /** Zod schema for a complete time payload including schema and all time fields. */
42
+ export const TimePayloadZod = PayloadZodOfSchema(TimeSchema).extend(TimeFieldsZod.shape)
43
+
44
+ /** A payload containing time information across multiple domains. */
45
+ export type TimePayload = z.infer<typeof TimePayloadZod>
46
+
47
+ // to prevent scaling problems, we use double the current time as a max safe epoch
48
+ /** Checks whether a value is a safe epoch timestamp (less than double the current time). */
49
+ export const isSafeEpoch = (value: unknown): value is number => {
50
+ return typeof value === 'number' && value < 2 * Date.now()
51
+ }
52
+
53
+ /** Type guard that checks whether a value is a valid TimePayload with a safe epoch. */
54
+ export const isTimePayload = (value: unknown): value is TimePayload => {
55
+ return isPayloadOfSchemaType<TimePayload>(TimeSchema)(value) && isSafeEpoch(value.epoch)
56
+ }
57
+
58
+ /** Casts a value to TimePayload or returns undefined if it does not match. */
59
+ export const asTimePayload = AsObjectFactory.create(isTimePayload)
60
+ /** Casts a value to TimePayload with storage metadata or returns undefined. */
61
+ export const asTimePayloadWithStorageMeta = AsObjectFactory.create(isTimePayload)
@@ -0,0 +1,6 @@
1
+ export * from './Bridge/index.ts'
2
+ export * from './ChainStakeIntent.ts'
3
+ export * from './Executable.ts'
4
+ export * from './Hash.ts'
5
+ export * from './StepComplete.ts'
6
+ export * from './Time.ts'
@@ -0,0 +1,2 @@
1
+ export * from './elevatable/index.ts'
2
+ export * from './StepIdentityPayload.ts'
@@ -0,0 +1,6 @@
1
+ import type { ProviderMoniker } from './ProviderMoniker.ts'
2
+
3
+ /** Provider interface. */
4
+ export interface Provider<T extends ProviderMoniker> {
5
+ moniker: T
6
+ }
@@ -0,0 +1,15 @@
1
+ import { assertEx, isString } from '@xylabs/sdk-js'
2
+
3
+ /** Type literal for the Provider provider moniker. */
4
+ export type ProviderMoniker = string
5
+
6
+ /** Moniker identifier for the asProvider provider. */
7
+ export const asProviderMoniker = <T>(value: T) => {
8
+ const moniker = isString(value) ? (value as unknown as ProviderMoniker) : undefined
9
+ return assertEx(moniker)
10
+ }
11
+
12
+ /** Moniker identifier for the DefaultProvider provider. */
13
+ export const DefaultProviderMoniker = 'Provider' as const
14
+ /** Type literal for the DefaultProvider provider moniker. */
15
+ export type DefaultProviderMoniker = typeof DefaultProviderMoniker
@@ -0,0 +1,2 @@
1
+ export * from './Provider.ts'
2
+ export * from './ProviderMoniker.ts'