@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,40 @@
1
+ import { AsObjectFactory } from '@xylabs/sdk-js'
2
+ import type { Payload, WithSources } from '@xyo-network/sdk-js'
3
+ import {
4
+ asSchema,
5
+ isPayloadOfSchemaType,
6
+ isPayloadOfSchemaTypeWithSources,
7
+ } from '@xyo-network/sdk-js'
8
+
9
+ import type { XL1BlockNumber } from '../BlockNumber/index.ts'
10
+
11
+ /** Schema identifier for BlockNumber payloads. */
12
+ export const BlockNumberSchema = asSchema('network.xyo.chain.block.number', true)
13
+ /** Schema type for BlockNumber payloads. */
14
+ export type BlockNumberSchema = typeof BlockNumberSchema
15
+
16
+ /** BlockNumberFields interface. */
17
+ export interface BlockNumberFields {
18
+ /**
19
+ * The block number
20
+ */
21
+ block: XL1BlockNumber
22
+ }
23
+ /**
24
+ * The number of a block
25
+ */
26
+ export type BlockNumberPayload = Payload<BlockNumberFields, BlockNumberSchema>
27
+
28
+ /**
29
+ * Identity function for determining if an object is a BlockNumber
30
+ */
31
+ export const isBlockNumberPayload = isPayloadOfSchemaType<BlockNumberPayload>(BlockNumberSchema)
32
+ /** Converts a value to BlockNumberPayload, throwing if invalid. */
33
+ export const asBlockNumberPayload = AsObjectFactory.create<BlockNumberPayload>(isBlockNumberPayload)
34
+
35
+ /**
36
+ * Identity function for determining if an object is a BlockNumber with sources
37
+ */
38
+ export const isBlockNumberPayloadWithSources = isPayloadOfSchemaTypeWithSources<BlockNumberPayload>(BlockNumberSchema)
39
+ /** Converts a value to BlockNumberPayloadWithSources, throwing if invalid. */
40
+ export const asBlockNumberPayloadWithSources = AsObjectFactory.create<WithSources<BlockNumberPayload>>(isBlockNumberPayloadWithSources)
@@ -0,0 +1,11 @@
1
+ import type { ChainId } from '../chain/index.ts'
2
+
3
+ /**
4
+ * Required info for a chain reference
5
+ */
6
+ export interface ChainReference {
7
+ /**
8
+ * The contract address referenced by the chain
9
+ */
10
+ chain: ChainId
11
+ }
@@ -0,0 +1,4 @@
1
+ export * from './Addressable.ts'
2
+ export * from './BlockDuration.ts'
3
+ export * from './BlockNumber.ts'
4
+ export * from './ChainReference.ts'
package/src/index.ts ADDED
@@ -0,0 +1,14 @@
1
+ export * from './amount/index.ts'
2
+ export * from './block/index.ts'
3
+ export * from './BlockNumber/index.ts'
4
+ export * from './chain/index.ts'
5
+ export * from './fields/index.ts'
6
+ export * from './map/index.ts'
7
+ export * from './model/index.ts'
8
+ export * from './payload/index.ts'
9
+ export * from './provider/index.ts'
10
+ export * from './RecordKeyType.ts'
11
+ export * from './Step/index.ts'
12
+ export * from './transaction/index.ts'
13
+ export * from './TransferPayload.ts'
14
+ export * from './xl1/index.ts'
@@ -0,0 +1,38 @@
1
+ import type { Promisable } from '@xylabs/sdk-js'
2
+
3
+ /** AsyncMapRead interface. */
4
+ export interface AsyncMapRead<K, V> {
5
+ get(id: K): Promisable<V | undefined>
6
+ getMany(id: K[]): Promisable<V[]>
7
+ has(id: K): Promisable<boolean>
8
+ }
9
+ /**
10
+ * @deprecated Use AsyncMapRead instead
11
+ */
12
+ export interface AsynchronousMapRead<K, V> extends AsyncMapRead<K, V> {}
13
+
14
+ /** AsyncMapWrite interface. */
15
+ export interface AsyncMapWrite<K, V> {
16
+ clear(): Promisable<void>
17
+ delete(id: K): Promisable<boolean>
18
+ set(id: K, data: V): Promisable<K | undefined | void>
19
+ setMany(entries: [K, V][]): Promisable<K[] | void>
20
+ }
21
+ /**
22
+ * @deprecated Use AsyncMapWrite instead
23
+ */
24
+ export interface AsynchronousMapWrite<K, V> extends AsyncMapWrite<K, V> {}
25
+
26
+ /** AsyncMap interface. */
27
+ export interface AsyncMap<K, V> extends AsyncMapRead<K, V>, AsyncMapWrite<K, V> {}
28
+ /**
29
+ * @deprecated Use AsyncMap instead
30
+ */
31
+ export interface AsynchronousMap<K, V> extends AsyncMap<K, V> {}
32
+
33
+ /** AsyncIterableMapRead interface. */
34
+ export interface AsyncIterableMapRead<K, V>extends AsyncMapRead<K, V>, AsyncIterable<[K, V]> {}
35
+ /** AsyncIterableMapWrite interface. */
36
+ export interface AsyncIterableMapWrite<K, V>extends AsyncMapWrite<K, V>, AsyncIterable<[K, V]> {}
37
+ /** AsyncIterableMap interface. */
38
+ export interface AsyncIterableMap<K, V>extends AsyncMap<K, V>, AsyncIterable<[K, V]> {}
@@ -0,0 +1,27 @@
1
+ import type {
2
+ AsyncIterableMap, AsyncIterableMapRead, AsyncIterableMapWrite, AsyncMap, AsyncMapRead, AsyncMapWrite,
3
+ } from './AsyncMap.ts'
4
+ import type {
5
+ SyncIterableMap, SyncIterableMapRead, SyncIterableMapWrite, SyncMap, SyncMapRead, SyncMapWrite,
6
+ } from './SyncMap.ts'
7
+
8
+ /** MapType type. */
9
+ export type MapType<TId, TData> = SyncMap<TId, TData> | AsyncMap<TId, TData>
10
+
11
+ /** MapTypeRead type. */
12
+ export type MapTypeRead<TId, TData> = SyncMapRead<TId, TData> | AsyncMapRead<TId, TData>
13
+
14
+ /** MapTypeWrite type. */
15
+ export type MapTypeWrite<TId, TData> = SyncMapWrite<TId, TData> | AsyncMapWrite<TId, TData>
16
+
17
+ /** AsynchronousMapType type. */
18
+ export type AsynchronousMapType<TId, TData> = AsyncMapRead<TId, TData> & AsyncMapWrite<TId, TData>
19
+
20
+ /** IterableMapRead type. */
21
+ export type IterableMapRead<TId, TData> = SyncIterableMapRead<TId, TData> | AsyncIterableMapRead<TId, TData>
22
+
23
+ /** IterableMapWrite type. */
24
+ export type IterableMapWrite<TId, TData> = SyncIterableMapWrite<TId, TData> | AsyncIterableMapWrite<TId, TData>
25
+
26
+ /** IterableMap type. */
27
+ export type IterableMap<TId, TData> = SyncIterableMap<TId, TData> | AsyncIterableMap<TId, TData>
@@ -0,0 +1,38 @@
1
+ /** SyncMapRead interface. */
2
+ export interface SyncMapRead<K, V> {
3
+ get(id: K): V | undefined
4
+ getMany(id: K[]): V[]
5
+ has(id: K): boolean
6
+ }
7
+
8
+ /**
9
+ * @deprecated Use SyncMapRead instead
10
+ */
11
+ export interface SynchronousMapRead<K, V> extends SyncMapRead<K, V> {}
12
+
13
+ /** SyncMapWrite interface. */
14
+ export interface SyncMapWrite<K, V> {
15
+ clear(): void
16
+ delete(id: K): boolean
17
+ set(id: K, data: V): K | undefined | void
18
+ setMany(entries: [K, V][]): K[] | void
19
+ }
20
+
21
+ /**
22
+ * @deprecated Use SyncMapWrite instead
23
+ */
24
+ export interface SynchronousMapWrite<K, V> extends SyncMapWrite<K, V> {}
25
+
26
+ /** SyncMap interface. */
27
+ export interface SyncMap<K, V> extends SyncMapRead<K, V>, SyncMapWrite<K, V> {}
28
+ /**
29
+ * @deprecated Use SyncMap instead
30
+ */
31
+ export interface SynchronousMap<K, V> extends SyncMap<K, V> {}
32
+
33
+ /** SyncIterableMapRead interface. */
34
+ export interface SyncIterableMapRead<K, V> extends SyncMapRead<K, V>, Iterable<[K, V]> {}
35
+ /** SyncIterableMapWrite interface. */
36
+ export interface SyncIterableMapWrite<K, V> extends SyncMapWrite<K, V>, Iterable<[K, V]> {}
37
+ /** SyncIterableMap interface. */
38
+ export interface SyncIterableMap<K, V> extends SyncMap<K, V>, Iterable<[K, V]> {}
@@ -0,0 +1,3 @@
1
+ export * from './AsyncMap.ts'
2
+ export * from './MapType.ts'
3
+ export * from './SyncMap.ts'
@@ -0,0 +1,58 @@
1
+ import { type Address, type Promisable } from '@xylabs/sdk-js'
2
+ import { zodIsFactory } from '@xylabs/sdk-js'
3
+ import { WithHashMetaZod } from '@xyo-network/sdk-js'
4
+ import { z } from 'zod'
5
+
6
+ import { BlockBoundWitnessZod } from '../block/index.ts'
7
+ import type { Provider } from '../provider/index.ts'
8
+ import { TransactionBoundWitnessZod } from '../transaction/index.ts'
9
+ import { TransferZod } from '../TransferPayload.ts'
10
+ import type { AttoXL1 } from '../xl1/index.ts'
11
+ import type { ChainQualified } from './ChainQualification.ts'
12
+ import { ChainQualificationZod, ChainQualifiedConfigZod } from './ChainQualification.ts'
13
+
14
+ /** AccountBalanceHistoryItemZod constant. */
15
+ export const AccountBalanceHistoryItemZod = z.tuple([
16
+ WithHashMetaZod(BlockBoundWitnessZod),
17
+ WithHashMetaZod(TransactionBoundWitnessZod).nullable(),
18
+ WithHashMetaZod(TransferZod),
19
+ ])
20
+
21
+ /** AccountBalanceHistoryItem type. */
22
+ export type AccountBalanceHistoryItem = z.infer<typeof AccountBalanceHistoryItemZod>
23
+
24
+ /** AccountBalanceQualificationZod constant. */
25
+ export const AccountBalanceQualificationZod = ChainQualificationZod
26
+ /** AccountBalanceQualification type. */
27
+ export type AccountBalanceQualification = z.infer<typeof AccountBalanceQualificationZod>
28
+ /** Type guard that checks if a value is a valid AccountBalanceQualification. */
29
+ export const isAccountBalanceQualification = zodIsFactory(AccountBalanceQualificationZod)
30
+
31
+ /** AccountBalanceConfigZod constant. */
32
+ export const AccountBalanceConfigZod = ChainQualifiedConfigZod
33
+ /** AccountBalanceConfig type. */
34
+ export type AccountBalanceConfig = z.infer<typeof AccountBalanceConfigZod>
35
+ /** Type guard that checks if a value is a valid AccountBalanceConfig. */
36
+ export const isAccountBalanceConfig = zodIsFactory(AccountBalanceConfigZod)
37
+
38
+ /** AccountBalanceViewerMethods interface. */
39
+ export interface AccountBalanceViewerMethods {
40
+ qualifiedAccountBalanceHistories(
41
+ address: Address[],
42
+ config: AccountBalanceConfig
43
+ ): Promisable<ChainQualified<Record<Address, AccountBalanceHistoryItem[]>>>
44
+ qualifiedAccountBalances(address: Address[], config: AccountBalanceConfig): Promisable<ChainQualified<Record<Address, AttoXL1>>>
45
+ }
46
+
47
+ /** Viewer interface for reading AccountBalance data. */
48
+ export interface AccountBalanceViewer extends AccountBalanceViewerMethods, Provider<AccountBalanceViewerMoniker> {
49
+ accountBalance(address: Address, config?: AccountBalanceConfig): Promisable<AttoXL1>
50
+ accountBalanceHistories(address: Address[], config?: AccountBalanceConfig): Promisable<Record<Address, AccountBalanceHistoryItem[]>>
51
+ accountBalanceHistory(address: Address, config?: AccountBalanceConfig): Promisable<AccountBalanceHistoryItem[]>
52
+ accountBalances(address: Address[], config?: AccountBalanceConfig): Promisable<Record<Address, AttoXL1>>
53
+ }
54
+
55
+ /** Moniker identifier for the AccountBalanceViewer provider. */
56
+ export const AccountBalanceViewerMoniker = 'AccountBalanceViewer' as const
57
+ /** Type literal for the AccountBalanceViewer provider moniker. */
58
+ export type AccountBalanceViewerMoniker = typeof AccountBalanceViewerMoniker
@@ -0,0 +1,44 @@
1
+ import { z } from 'zod'
2
+
3
+ function base64Encode(u8: Uint8Array): string {
4
+ // Node
5
+ if (typeof Buffer !== 'undefined' && typeof Buffer.from === 'function') {
6
+ return Buffer.from(u8).toString('base64')
7
+ }
8
+
9
+ // Browser
10
+ let binary = ''
11
+ const chunk = 0x80_00
12
+ for (let i = 0; i < u8.length; i += chunk) {
13
+ // eslint-disable-next-line unicorn/prefer-code-point
14
+ binary += String.fromCharCode(...u8.subarray(i, i + chunk))
15
+ }
16
+ return btoa(binary)
17
+ }
18
+
19
+ /** Base64 decode that works in Node and browsers -> Uint8Array */
20
+ function base64Decode(b64: string): Uint8Array {
21
+ // Node
22
+ if (typeof Buffer !== 'undefined' && typeof Buffer.from === 'function') {
23
+ return new Uint8Array(Buffer.from(b64, 'base64'))
24
+ }
25
+
26
+ // Browser
27
+ const binary = atob(b64)
28
+ const u8 = new Uint8Array(binary.length)
29
+ // eslint-disable-next-line unicorn/prefer-code-point
30
+ for (let i = 0; i < binary.length; i++) u8[i] = binary.charCodeAt(i)
31
+ return u8
32
+ }
33
+
34
+ /** ArrayBufferToJsonZod constant. */
35
+ export const ArrayBufferToJsonZod = z.instanceof(ArrayBuffer).transform((x) => {
36
+ const u8 = new Uint8Array(x)
37
+ return base64Encode(u8)
38
+ })
39
+
40
+ /** JsonToArrayBufferZod constant. */
41
+ export const JsonToArrayBufferZod = z.string().transform((x) => {
42
+ const u8 = base64Decode(x)
43
+ return u8.buffer
44
+ })
@@ -0,0 +1,43 @@
1
+ import type { AssertConfig, Brand } from '@xylabs/sdk-js'
2
+ import {
3
+ assertError,
4
+ isDefined, zodAsFactory, zodToFactory,
5
+ } from '@xylabs/sdk-js'
6
+ import { z } from 'zod'
7
+
8
+ import {
9
+ asBlockNumber,
10
+ type BlockNumber, BlockNumberishZod, BlockNumberZod,
11
+ } from '../../BlockNumber/index.ts'
12
+
13
+ /** BlockRange type. */
14
+ export type BlockRange = [BlockNumber, BlockNumber]
15
+
16
+ /** BlockRangeZod constant. */
17
+ export const BlockRangeZod = z.tuple([BlockNumberZod, BlockNumberZod])
18
+ /** BlockRangeishZod constant. */
19
+ export const BlockRangeishZod = z.tuple([BlockNumberishZod, BlockNumberishZod])
20
+
21
+ /** BlockRangeish type. */
22
+ export type BlockRangeish = z.input<typeof BlockRangeishZod>
23
+
24
+ /** Converts a value to BlockRange, throwing if invalid. */
25
+ export const asBlockRange = zodAsFactory<BlockRange>(BlockRangeZod, 'BlockRange')
26
+ /** toBlockRange constant. */
27
+ export const toBlockRange = zodToFactory<BlockRange>(BlockRangeishZod, 'BlockRange')
28
+
29
+ /** BlockRangeKey type. */
30
+ export type BlockRangeKey = Brand<string, { readonly __blockRangeKey: true }>
31
+ /** toBlockNumberKey constant. */
32
+ export const toBlockNumberKey = (range: BlockRange) => `${range[0]}|${range[1]}` as BlockRangeKey
33
+
34
+ /** Creates a value from BlockNumberKey input. */
35
+ export function fromBlockNumberKey(key: BlockRangeKey): BlockRange | undefined
36
+ /** Creates a value from BlockNumberKey input. */
37
+ export function fromBlockNumberKey(key: BlockRangeKey, assert: AssertConfig): BlockRange
38
+ /** Creates a value from BlockNumberKey input. */
39
+ export function fromBlockNumberKey(key: BlockRangeKey, assert?: AssertConfig): BlockRange | undefined {
40
+ const [start, end] = key.split('|').map(v => asBlockNumber(Number(v)))
41
+ const result = (isDefined(start) && isDefined(end)) ? [start, end] : undefined
42
+ return assertError(result, assert, `Invalid BlockRangeKey: ${key}`)
43
+ }
@@ -0,0 +1,43 @@
1
+ import type { AssertConfig, Brand } from '@xylabs/sdk-js'
2
+ import {
3
+ assertError,
4
+ isDefined, zodAsFactory, zodToFactory,
5
+ } from '@xylabs/sdk-js'
6
+ import { z } from 'zod'
7
+
8
+ import {
9
+ asEthBlockNumber,
10
+ type EthBlockNumber, EthBlockNumberishZod, EthBlockNumberZod,
11
+ } from '../../BlockNumber/index.ts'
12
+
13
+ /** EthBlockRange type. */
14
+ export type EthBlockRange = [EthBlockNumber, EthBlockNumber]
15
+
16
+ /** EthBlockRangeZod constant. */
17
+ export const EthBlockRangeZod = z.tuple([EthBlockNumberZod, EthBlockNumberZod])
18
+ /** EthBlockRangeishZod constant. */
19
+ export const EthBlockRangeishZod = z.tuple([EthBlockNumberishZod, EthBlockNumberishZod])
20
+
21
+ /** EthBlockRangeish type. */
22
+ export type EthBlockRangeish = z.input<typeof EthBlockRangeishZod>
23
+
24
+ /** Converts a value to EthBlockRange, throwing if invalid. */
25
+ export const asEthBlockRange = zodAsFactory<EthBlockRange>(EthBlockRangeZod, 'EthBlockRange')
26
+ /** toEthBlockRange constant. */
27
+ export const toEthBlockRange = zodToFactory<EthBlockRange>(EthBlockRangeishZod, 'EthBlockRange')
28
+
29
+ /** EthBlockRangeKey type. */
30
+ export type EthBlockRangeKey = Brand<string, { readonly __ethBlockRangeKey: true }>
31
+ /** toEthBlockNumberKey constant. */
32
+ export const toEthBlockNumberKey = (range: EthBlockRange) => `${range[0]}|${range[1]}` as EthBlockRangeKey
33
+
34
+ /** Creates a value from EthBlockNumberKey input. */
35
+ export function fromEthBlockNumberKey(key: EthBlockRangeKey): EthBlockRange | undefined
36
+ /** Creates a value from EthBlockNumberKey input. */
37
+ export function fromEthBlockNumberKey(key: EthBlockRangeKey, assert: AssertConfig): EthBlockRange
38
+ /** Creates a value from EthBlockNumberKey input. */
39
+ export function fromEthBlockNumberKey(key: EthBlockRangeKey, assert?: AssertConfig): EthBlockRange | undefined {
40
+ const [start, end] = key.split('|').map(v => asEthBlockNumber(Number(v)))
41
+ const result = (isDefined(start) && isDefined(end)) ? [start, end] : undefined
42
+ return assertError(result, assert, `Invalid EthBlockRangeKey: ${key}`)
43
+ }
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod'
2
+
3
+ import { NumberishZod } from '../../BlockNumber/index.ts'
4
+
5
+ /** NumberishRangeZod constant. */
6
+ export const NumberishRangeZod = z.tuple([NumberishZod, NumberishZod])
@@ -0,0 +1,17 @@
1
+ import {
2
+ zodAsFactory, zodIsFactory, zodToFactory,
3
+ } from '@xylabs/sdk-js'
4
+ import { z } from 'zod'
5
+
6
+ /** RangeZod constant. */
7
+ export const RangeZod = z.tuple([z.number(), z.number()])
8
+
9
+ /** Range type. */
10
+ export type Range = z.infer<typeof RangeZod>
11
+
12
+ /** Type guard that checks if a value is a valid Range. */
13
+ export const isRange = zodIsFactory<Range>(RangeZod)
14
+ /** Converts a value to Range, throwing if invalid. */
15
+ export const asRange = zodAsFactory<Range>(RangeZod, 'Range')
16
+ /** toRange constant. */
17
+ export const toRange = zodToFactory<Range>(RangeZod, 'Range')
@@ -0,0 +1,43 @@
1
+ import type { AssertConfig, Brand } from '@xylabs/sdk-js'
2
+ import {
3
+ assertError,
4
+ isDefined, zodAsFactory, zodToFactory,
5
+ } from '@xylabs/sdk-js'
6
+ import { z } from 'zod'
7
+
8
+ import {
9
+ asXL1BlockNumber,
10
+ type XL1BlockNumber, XL1BlockNumberishZod, XL1BlockNumberZod,
11
+ } from '../../BlockNumber/index.ts'
12
+
13
+ /** XL1BlockRange type. */
14
+ export type XL1BlockRange = [XL1BlockNumber, XL1BlockNumber]
15
+
16
+ /** XL1BlockRangeZod constant. */
17
+ export const XL1BlockRangeZod = z.tuple([XL1BlockNumberZod, XL1BlockNumberZod])
18
+ /** XL1BlockRangeishZod constant. */
19
+ export const XL1BlockRangeishZod = z.tuple([XL1BlockNumberishZod, XL1BlockNumberishZod])
20
+
21
+ /** XL1BlockRangeish type. */
22
+ export type XL1BlockRangeish = z.input<typeof XL1BlockRangeishZod>
23
+
24
+ /** Converts a value to XL1BlockRange, throwing if invalid. */
25
+ export const asXL1BlockRange = zodAsFactory<XL1BlockRange>(XL1BlockRangeZod, 'XL1BlockRange')
26
+ /** toXL1BlockRange constant. */
27
+ export const toXL1BlockRange = zodToFactory<XL1BlockRange>(XL1BlockRangeishZod, 'XL1BlockRange')
28
+
29
+ /** XL1BlockRangeKey type. */
30
+ export type XL1BlockRangeKey = Brand<string, { readonly __xl1BlockRangeKey: true }>
31
+ /** toXL1BlockNumberKey constant. */
32
+ export const toXL1BlockNumberKey = (range: XL1BlockRange) => `${range[0]}|${range[1]}` as XL1BlockRangeKey
33
+
34
+ /** Creates a value from XL1BlockNumberKey input. */
35
+ export function fromXL1BlockNumberKey(key: XL1BlockRangeKey): XL1BlockRange | undefined
36
+ /** Creates a value from XL1BlockNumberKey input. */
37
+ export function fromXL1BlockNumberKey(key: XL1BlockRangeKey, assert: AssertConfig): XL1BlockRange
38
+ /** Creates a value from XL1BlockNumberKey input. */
39
+ export function fromXL1BlockNumberKey(key: XL1BlockRangeKey, assert?: AssertConfig): XL1BlockRange | undefined {
40
+ const [start, end] = key.split('|').map(v => asXL1BlockNumber(Number(v)))
41
+ const result = (isDefined(start) && isDefined(end)) ? [start, end] : undefined
42
+ return assertError(result, assert, `Invalid XL1BlockRangeKey: ${key}`)
43
+ }
@@ -0,0 +1,4 @@
1
+ export * from './BlockRange.ts'
2
+ export * from './EthBlockRange.ts'
3
+ export * from './Range.ts'
4
+ export * from './XL1BlockRange.ts'
@@ -0,0 +1,108 @@
1
+ import { zodAsFactory, zodIsFactory } from '@xylabs/sdk-js'
2
+ import { z } from 'zod'
3
+
4
+ import type { EthBlockNumber, XL1BlockNumber } from '../BlockNumber/index.ts'
5
+ import { StepSizes } from '../Step/index.ts'
6
+ import { XL1BlockRangeZod } from './BlockRange/index.ts'
7
+
8
+ /** TimeDurationsZod constant. */
9
+ export const TimeDurationsZod = z.object({
10
+ millis: z.number().nonnegative(),
11
+ seconds: z.number().nonnegative(),
12
+ minutes: z.number().nonnegative(),
13
+ hours: z.number().nonnegative(),
14
+ days: z.number().nonnegative(),
15
+ weeks: z.number().nonnegative(),
16
+ })
17
+
18
+ /** Type guard that checks if a value is a valid TimeDurations. */
19
+ export const isTimeDurations = zodIsFactory(TimeDurationsZod)
20
+ /** Converts a value to TimeDurations, throwing if invalid. */
21
+ export const asTimeDurations = zodAsFactory(TimeDurationsZod, 'asTimeDurations')
22
+ /** toTimeDurations constant. */
23
+ export const toTimeDurations = zodAsFactory(TimeDurationsZod, 'toTimeDurations')
24
+
25
+ /** TimeDurations type. */
26
+ export type TimeDurations = z.infer<typeof TimeDurationsZod>
27
+
28
+ /** BlockRateZod constant. */
29
+ export const BlockRateZod = z.object({
30
+ range: XL1BlockRangeZod.describe('the block range the rate was calculated over'),
31
+ rate: z.number().nonnegative().describe('rate of blocks per specified time unit'),
32
+ timeUnit: TimeDurationsZod.keyof().describe('the unit of time for the rate and timePerBlock'),
33
+ span: z.int().nonnegative().describe('number of blocks the rate was calculated over'),
34
+ timeDifference: z.number().nonnegative().describe('time difference from start and end block'),
35
+ timePerBlock: z.number().nonnegative().describe('average time per block for the given range'),
36
+ })
37
+
38
+ /** BlockRate type. */
39
+ export type BlockRate = z.infer<typeof BlockRateZod>
40
+
41
+ /** GenericBlockRate type. */
42
+ export type GenericBlockRate<TBlockNumber extends number> = Omit<BlockRate, 'range'> & {
43
+ range: [TBlockNumber, TBlockNumber]
44
+ }
45
+
46
+ /** XL1BlockRate interface. */
47
+ export interface XL1BlockRate extends GenericBlockRate<XL1BlockNumber> {}
48
+ /** EthBlockRate interface. */
49
+ export interface EthBlockRate extends GenericBlockRate<EthBlockNumber> {}
50
+
51
+ /** Type guard that checks if a value is a valid BlockRate. */
52
+ export const isBlockRate = zodIsFactory(BlockRateZod)
53
+ /** Converts a value to BlockRate, throwing if invalid. */
54
+ export const asBlockRate = zodAsFactory(BlockRateZod, 'asBlockRate')
55
+ /** toBlockRate constant. */
56
+ export const toBlockRate = zodAsFactory(BlockRateZod, 'toBlockRate')
57
+
58
+ /** CountZod constant. */
59
+ export const CountZod = z.int().nonnegative().describe('A non-negative integer count')
60
+ /** Count type. */
61
+ export type Count = z.infer<typeof CountZod>
62
+
63
+ /** StepIndexZod constant. */
64
+ export const StepIndexZod = z.int().min(0).max(StepSizes.length).describe('A non-negative integer step index')
65
+ /** StepIndex type. */
66
+ export type StepIndex = z.infer<typeof StepIndexZod>
67
+
68
+ const timeUnitSchema = z.number().positive()
69
+
70
+ /** TimeConfigZod constant. */
71
+ export const TimeConfigZod = z.object({
72
+ minutes: timeUnitSchema.optional(),
73
+ hours: timeUnitSchema.optional(),
74
+ days: timeUnitSchema.optional(),
75
+ weeks: timeUnitSchema.optional(),
76
+ months: timeUnitSchema.optional(),
77
+ years: timeUnitSchema.optional(),
78
+ }).describe('Time configuration with optional time units')
79
+
80
+ /** TimeConfig type. */
81
+ export type TimeConfig = z.infer<typeof TimeConfigZod>
82
+
83
+ /** Type guard that checks if a value is a valid TimeConfig. */
84
+ export const isTimeConfig = zodIsFactory(TimeConfigZod)
85
+ /** Converts a value to TimeConfig, throwing if invalid. */
86
+ export const asTimeConfig = zodAsFactory(TimeConfigZod, 'asTimeConfig')
87
+ /** toTimeConfig constant. */
88
+ export const toTimeConfig = zodAsFactory(TimeConfigZod, 'toTimeConfig')
89
+
90
+ /** SingleTimeConfigZod constant. */
91
+ export const SingleTimeConfigZod = z.union([
92
+ z.object({ minutes: timeUnitSchema }),
93
+ z.object({ hours: timeUnitSchema }),
94
+ z.object({ days: timeUnitSchema }),
95
+ z.object({ weeks: timeUnitSchema }),
96
+ z.object({ months: timeUnitSchema }),
97
+ z.object({ years: timeUnitSchema }),
98
+ ]).describe('Time configuration with exactly one time unit')
99
+
100
+ /** SingleTimeConfig type. */
101
+ export type SingleTimeConfig = z.infer<typeof SingleTimeConfigZod>
102
+
103
+ /** Type guard that checks if a value is a valid SingleTimeConfig. */
104
+ export const isSingleTimeConfig = zodIsFactory(SingleTimeConfigZod)
105
+ /** Converts a value to SingleTimeConfig, throwing if invalid. */
106
+ export const asSingleTimeConfig = zodAsFactory(SingleTimeConfigZod, 'asSingleTimeConfig')
107
+ /** toSingleTimeConfig constant. */
108
+ export const toSingleTimeConfig = zodAsFactory(SingleTimeConfigZod, 'toSingleTimeConfig')
@@ -0,0 +1,48 @@
1
+ import { HashZod, zodIsFactory } from '@xylabs/sdk-js'
2
+ import { z } from 'zod'
3
+
4
+ import { XL1BlockRangeZod } from './BlockRange/index.ts'
5
+
6
+ /** ChainQualificationZod constant. */
7
+ export const ChainQualificationZod = z.object({ head: HashZod, range: XL1BlockRangeZod })
8
+ /** ChainQualification type. */
9
+ export type ChainQualification = z.infer<typeof ChainQualificationZod>
10
+ /** Type guard that checks if a value is a valid ChainQualification. */
11
+ export const isChainQualification = zodIsFactory(ChainQualificationZod)
12
+
13
+ /** ChainQualifiedRangeConfigZod constant. */
14
+ export const ChainQualifiedRangeConfigZod = z.object({ range: XL1BlockRangeZod })
15
+ /** ChainQualifiedRangeConfig type. */
16
+ export type ChainQualifiedRangeConfig = z.infer<typeof ChainQualifiedRangeConfigZod>
17
+ /** Type guard that checks if a value is a valid ChainQualifiedRangeConfig. */
18
+ export const isChainQualifiedRangeConfig = zodIsFactory(ChainQualifiedRangeConfigZod)
19
+
20
+ /** ChainQualifiedHeadConfigZod constant. */
21
+ export const ChainQualifiedHeadConfigZod = z.object({ head: HashZod })
22
+ /** ChainQualifiedHeadConfig type. */
23
+ export type ChainQualifiedHeadConfig = z.infer<typeof ChainQualifiedHeadConfigZod>
24
+ /** Type guard that checks if a value is a valid ChainQualifiedHeadConfig. */
25
+ export const isChainQualifiedHeadConfig = zodIsFactory(ChainQualifiedHeadConfigZod)
26
+
27
+ /** ChainQualifiedConfigZod constant. */
28
+ export const ChainQualifiedConfigZod = z.union([ChainQualifiedRangeConfigZod, ChainQualifiedHeadConfigZod, z.object({})])
29
+ /** ChainQualifiedConfig type. */
30
+ export type ChainQualifiedConfig = z.infer<typeof ChainQualifiedConfigZod>
31
+ /** Type guard that checks if a value is a valid ChainQualifiedConfig. */
32
+ export const isChainQualifiedConfig = zodIsFactory(ChainQualifiedConfigZod)
33
+
34
+ /** ExtendChainQualifiedConfigZod constant. */
35
+ export const ExtendChainQualifiedConfigZod = (<T>(zodType: z.ZodType<T>) => {
36
+ return z.union([
37
+ ChainQualifiedRangeConfigZod.extend(zodType),
38
+ ChainQualifiedHeadConfigZod.extend(zodType),
39
+ zodType,
40
+ ])
41
+ }) as <T>(zodType: z.ZodType<T>) => z.ZodType<T & ChainQualifiedConfig>
42
+
43
+ /** ChainQualified type. */
44
+ export type ChainQualified<T> = [T, ChainQualification]
45
+ /** ChainQualifiedZod constant. */
46
+ export const ChainQualifiedZod = <T>(zodType: z.ZodType<T>) => {
47
+ return z.tuple([zodType, ChainQualificationZod])
48
+ }
@@ -0,0 +1,6 @@
1
+ import type z from 'zod'
2
+
3
+ import type { BaseContextZod } from './BaseContext.zod.ts'
4
+
5
+ /** BaseContext type. */
6
+ export type BaseContext = z.infer<typeof BaseContextZod>
@@ -0,0 +1,36 @@
1
+ import type { MeterProvider, TracerProvider } from '@opentelemetry/api'
2
+ import type { Logger } from '@xylabs/sdk-js'
3
+ import { z } from 'zod'
4
+
5
+ import type { MapType } from '../../map/index.ts'
6
+
7
+ /** CachesZod constant. */
8
+ export const CachesZod = z.record(
9
+ z.string(),
10
+ z.custom<MapType<string, unknown>>(val => val && typeof val === 'object' && ('get' in val || 'set' in val)),
11
+ )
12
+
13
+ /** SingletonsZod constant. */
14
+ export const SingletonsZod = z.record(z.union([z.string(), z.symbol()]), z.unknown())
15
+
16
+ /** LoggerZod constant. */
17
+ export const LoggerZod = z.custom<Logger>(val => val && typeof val === 'object' && 'info' in val && 'error' in val)
18
+
19
+ /** MeterProviderZod constant. */
20
+ export const MeterProviderZod = z.custom<MeterProvider>(val => val && typeof val === 'object' && 'getMeter' in val)
21
+
22
+ /** TracerProviderZod constant. */
23
+ export const TracerProviderZod = z.custom<TracerProvider>(val => val && typeof val === 'object' && 'getTracer' in val)
24
+
25
+ /** TimeBudgetLimitZod constant. */
26
+ export const TimeBudgetLimitZod = z.number()
27
+
28
+ /** BaseContextZod constant. */
29
+ export const BaseContextZod = z.object({
30
+ caches: CachesZod.optional(),
31
+ logger: LoggerZod.optional(),
32
+ meterProvider: MeterProviderZod.optional(),
33
+ singletons: SingletonsZod,
34
+ timeBudgetLimit: TimeBudgetLimitZod.optional(),
35
+ traceProvider: TracerProviderZod.optional(),
36
+ })