@thruputchain/client 0.27.0 → 0.29.0

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 (181) hide show
  1. package/README.md +120 -22
  2. package/dist/{actions-DK_XBeVy.cjs → actions-B2gV8Vzr.cjs} +297 -73
  3. package/dist/actions-B2gV8Vzr.cjs.map +1 -0
  4. package/dist/actions-UEYKD22C.js +653 -0
  5. package/dist/actions-UEYKD22C.js.map +1 -0
  6. package/dist/actions.cjs +4 -8
  7. package/dist/actions.d.cts +4 -4
  8. package/dist/actions.d.ts +4 -4
  9. package/dist/actions.js +3 -3
  10. package/dist/{artifact-BM_MVzhL.d.ts → artifact-RIAPVmVX.d.cts} +4 -3
  11. package/dist/artifact-RIAPVmVX.d.cts.map +1 -0
  12. package/dist/{artifact-BM_MVzhL.d.cts → artifact-RIAPVmVX.d.ts} +4 -3
  13. package/dist/artifact-RIAPVmVX.d.ts.map +1 -0
  14. package/dist/{contract-Cu8Qv94_.js → contract-BOlNskwd.js} +235 -87
  15. package/dist/contract-BOlNskwd.js.map +1 -0
  16. package/dist/{contract-DPm2BJTu.cjs → contract-D_vxUudr.cjs} +281 -109
  17. package/dist/contract-D_vxUudr.cjs.map +1 -0
  18. package/dist/contract.cjs +1 -5
  19. package/dist/contract.d.cts +4 -4
  20. package/dist/contract.d.ts +4 -4
  21. package/dist/contract.js +2 -2
  22. package/dist/contracts.cjs +5 -5
  23. package/dist/contracts.d.cts +19 -4
  24. package/dist/contracts.d.cts.map +1 -1
  25. package/dist/contracts.d.ts +19 -4
  26. package/dist/contracts.d.ts.map +1 -1
  27. package/dist/contracts.js +4 -4
  28. package/dist/decimal-BX7abv5J.cjs +171 -0
  29. package/dist/decimal-BX7abv5J.cjs.map +1 -0
  30. package/dist/decimal-CoHOISys.js +124 -0
  31. package/dist/decimal-CoHOISys.js.map +1 -0
  32. package/dist/{dev_wallet-BcvX_xT4.cjs → dev_wallet-BVChhV6j.cjs} +85 -6
  33. package/dist/dev_wallet-BVChhV6j.cjs.map +1 -0
  34. package/dist/{dev_wallet-B5R5JJaw.js → dev_wallet-D9LuPZ-h.js} +84 -5
  35. package/dist/dev_wallet-D9LuPZ-h.js.map +1 -0
  36. package/dist/{execution-C8oQgpO3.d.cts → execution-pSt6k620.d.cts} +23 -50
  37. package/dist/execution-pSt6k620.d.cts.map +1 -0
  38. package/dist/{execution-DsZzqv_C.d.ts → execution-uiuFPV0d.d.ts} +23 -50
  39. package/dist/execution-uiuFPV0d.d.ts.map +1 -0
  40. package/dist/{hex-DIcaALXL.js → hex-B8D-jBgz.js} +2 -2
  41. package/dist/{hex-DIcaALXL.js.map → hex-B8D-jBgz.js.map} +1 -1
  42. package/dist/{hex-DkGpiZ5e.cjs → hex-CSDZ9d6z.cjs} +2 -2
  43. package/dist/{hex-DkGpiZ5e.cjs.map → hex-CSDZ9d6z.cjs.map} +1 -1
  44. package/dist/{index-rrP1HJ2Z.d.cts → index-B1efA-Y_.d.ts} +24 -21
  45. package/dist/index-B1efA-Y_.d.ts.map +1 -0
  46. package/dist/{index-Zaz-e8Sy.d.ts → index-BGmH_Sm7.d.cts} +12 -62
  47. package/dist/index-BGmH_Sm7.d.cts.map +1 -0
  48. package/dist/{index-CHnfHuQo.d.ts → index-BZ5j5P5d.d.ts} +11 -9
  49. package/dist/index-BZ5j5P5d.d.ts.map +1 -0
  50. package/dist/{index-BmQN3jAS.d.cts → index-BfYEEVHm.d.cts} +3 -13
  51. package/dist/index-BfYEEVHm.d.cts.map +1 -0
  52. package/dist/{index-CuzB95QT.d.cts → index-BhOeIyrZ.d.cts} +11 -9
  53. package/dist/index-BhOeIyrZ.d.cts.map +1 -0
  54. package/dist/{index-B5KqSHeL.d.cts → index-BsvYcU_Y.d.cts} +2 -2
  55. package/dist/{index-B5KqSHeL.d.cts.map → index-BsvYcU_Y.d.cts.map} +1 -1
  56. package/dist/{index-hqEnT64w.d.ts → index-Btl_jMCT.d.ts} +3 -13
  57. package/dist/index-Btl_jMCT.d.ts.map +1 -0
  58. package/dist/{index-C3qDR1J5.d.cts → index-CG-q0j9w.d.ts} +12 -62
  59. package/dist/index-CG-q0j9w.d.ts.map +1 -0
  60. package/dist/index-CPtBvHE8.d.ts +145 -0
  61. package/dist/index-CPtBvHE8.d.ts.map +1 -0
  62. package/dist/{index-CKqC9N4o.d.ts → index-DBKsOzCN.d.cts} +24 -21
  63. package/dist/index-DBKsOzCN.d.cts.map +1 -0
  64. package/dist/index-Xre-0Jka.d.cts +145 -0
  65. package/dist/index-Xre-0Jka.d.cts.map +1 -0
  66. package/dist/index.cjs +39 -68
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.d.cts +12 -17
  69. package/dist/index.d.cts.map +1 -1
  70. package/dist/index.d.ts +12 -17
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +27 -38
  73. package/dist/index.js.map +1 -1
  74. package/dist/provider.cjs +3 -3
  75. package/dist/provider.cjs.map +1 -1
  76. package/dist/provider.d.cts +2 -1
  77. package/dist/provider.d.ts +2 -1
  78. package/dist/provider.js +3 -3
  79. package/dist/provider.js.map +1 -1
  80. package/dist/{codec-BOjoJjC5.js → readError-B3Rz7rgs.js} +673 -56
  81. package/dist/readError-B3Rz7rgs.js.map +1 -0
  82. package/dist/{codec-C4LJ0g8v.cjs → readError-COcEDNoZ.cjs} +677 -96
  83. package/dist/readError-COcEDNoZ.cjs.map +1 -0
  84. package/dist/requestAirdrop-DBCOST2B.d.ts +1818 -0
  85. package/dist/requestAirdrop-DBCOST2B.d.ts.map +1 -0
  86. package/dist/requestAirdrop-T1eVn3l5.d.cts +1818 -0
  87. package/dist/requestAirdrop-T1eVn3l5.d.cts.map +1 -0
  88. package/dist/sendInvocation-185ZJrta.cjs +583 -0
  89. package/dist/sendInvocation-185ZJrta.cjs.map +1 -0
  90. package/dist/sendInvocation-DBaNWhr3.js +439 -0
  91. package/dist/sendInvocation-DBaNWhr3.js.map +1 -0
  92. package/dist/signed-op.cjs +2 -2
  93. package/dist/signed-op.d.cts +2 -2
  94. package/dist/signed-op.d.ts +1 -1
  95. package/dist/signed-op.js +2 -2
  96. package/dist/{signedOp-BDUZhfJn.cjs → signedOp-CVyeJ5ig.cjs} +3 -3
  97. package/dist/{signedOp-BDUZhfJn.cjs.map → signedOp-CVyeJ5ig.cjs.map} +1 -1
  98. package/dist/{signedOp-Kx8u8_3I.js → signedOp-D6WYZG9j.js} +3 -3
  99. package/dist/{signedOp-Kx8u8_3I.js.map → signedOp-D6WYZG9j.js.map} +1 -1
  100. package/dist/{signed_op-CAcYYRm6.cjs → signed_op-BBsDKOlD.cjs} +4 -4
  101. package/dist/{signed_op-CAcYYRm6.cjs.map → signed_op-BBsDKOlD.cjs.map} +1 -1
  102. package/dist/{signed_op-BrLxDrDb.d.cts → signed_op-BvbOHWKK.d.ts} +3 -3
  103. package/dist/{signed_op-DbRq3_Hb.d.ts.map → signed_op-BvbOHWKK.d.ts.map} +1 -1
  104. package/dist/{signed_op-DbRq3_Hb.d.ts → signed_op-DoHFpSH4.d.cts} +3 -3
  105. package/dist/{signed_op-BrLxDrDb.d.cts.map → signed_op-DoHFpSH4.d.cts.map} +1 -1
  106. package/dist/{signed_op-Dxn7-lRu.js → signed_op-h9X9-vBL.js} +3 -3
  107. package/dist/{signed_op-Dxn7-lRu.js.map → signed_op-h9X9-vBL.js.map} +1 -1
  108. package/dist/transport-BhWZxHcz.cjs +528 -0
  109. package/dist/transport-BhWZxHcz.cjs.map +1 -0
  110. package/dist/transport-EyDYuibb.js +504 -0
  111. package/dist/transport-EyDYuibb.js.map +1 -0
  112. package/dist/transport.cjs +6 -13
  113. package/dist/transport.d.cts +3 -3
  114. package/dist/transport.d.ts +3 -3
  115. package/dist/transport.js +4 -4
  116. package/dist/types-VYjJcTip.d.cts +161 -0
  117. package/dist/types-VYjJcTip.d.cts.map +1 -0
  118. package/dist/types-VYjJcTip.d.ts +161 -0
  119. package/dist/types-VYjJcTip.d.ts.map +1 -0
  120. package/dist/{validation-eXATmgO0.js → validation-BLQ64Dfh.js} +3 -3
  121. package/dist/validation-BLQ64Dfh.js.map +1 -0
  122. package/dist/{validation-4w-vDGAi.cjs → validation-CZqtmMLJ.cjs} +3 -3
  123. package/dist/validation-CZqtmMLJ.cjs.map +1 -0
  124. package/dist/{wallet-5wt9wLG3.js → wallet-NlZiI4-3.js} +161 -77
  125. package/dist/wallet-NlZiI4-3.js.map +1 -0
  126. package/dist/{wallet-Blh7oas7.cjs → wallet-UvyXtxh5.cjs} +161 -77
  127. package/dist/wallet-UvyXtxh5.cjs.map +1 -0
  128. package/dist/wallet.cjs +2 -8
  129. package/dist/wallet.d.cts +4 -3
  130. package/dist/wallet.d.ts +4 -3
  131. package/dist/wallet.js +3 -3
  132. package/package.json +2 -2
  133. package/dist/actions-1LmkZcfS.js +0 -430
  134. package/dist/actions-1LmkZcfS.js.map +0 -1
  135. package/dist/actions-DK_XBeVy.cjs.map +0 -1
  136. package/dist/artifact-BM_MVzhL.d.cts.map +0 -1
  137. package/dist/artifact-BM_MVzhL.d.ts.map +0 -1
  138. package/dist/client-DocSdzOL.d.cts +0 -790
  139. package/dist/client-DocSdzOL.d.cts.map +0 -1
  140. package/dist/client-DocSdzOL.d.ts +0 -790
  141. package/dist/client-DocSdzOL.d.ts.map +0 -1
  142. package/dist/codec-BOjoJjC5.js.map +0 -1
  143. package/dist/codec-C4LJ0g8v.cjs.map +0 -1
  144. package/dist/contract-Cu8Qv94_.js.map +0 -1
  145. package/dist/contract-DPm2BJTu.cjs.map +0 -1
  146. package/dist/dev_wallet-B5R5JJaw.js.map +0 -1
  147. package/dist/dev_wallet-BcvX_xT4.cjs.map +0 -1
  148. package/dist/execution-C8oQgpO3.d.cts.map +0 -1
  149. package/dist/execution-DsZzqv_C.d.ts.map +0 -1
  150. package/dist/index-BmQN3jAS.d.cts.map +0 -1
  151. package/dist/index-C3qDR1J5.d.cts.map +0 -1
  152. package/dist/index-CHnfHuQo.d.ts.map +0 -1
  153. package/dist/index-CIHK7Ew9.d.cts +0 -303
  154. package/dist/index-CIHK7Ew9.d.cts.map +0 -1
  155. package/dist/index-CIHK7Ew9.d.ts +0 -303
  156. package/dist/index-CIHK7Ew9.d.ts.map +0 -1
  157. package/dist/index-CKqC9N4o.d.ts.map +0 -1
  158. package/dist/index-CuzB95QT.d.cts.map +0 -1
  159. package/dist/index-Zaz-e8Sy.d.ts.map +0 -1
  160. package/dist/index-hqEnT64w.d.ts.map +0 -1
  161. package/dist/index-rrP1HJ2Z.d.cts.map +0 -1
  162. package/dist/readError-Cz3bveZa.cjs +0 -622
  163. package/dist/readError-Cz3bveZa.cjs.map +0 -1
  164. package/dist/readError-Z5zuylri.js +0 -569
  165. package/dist/readError-Z5zuylri.js.map +0 -1
  166. package/dist/readViews-BvMHbiaF.d.ts +0 -609
  167. package/dist/readViews-BvMHbiaF.d.ts.map +0 -1
  168. package/dist/readViews-CQOY5v4o.d.cts +0 -609
  169. package/dist/readViews-CQOY5v4o.d.cts.map +0 -1
  170. package/dist/sendInvocation-8TEMrJ_M.cjs +0 -661
  171. package/dist/sendInvocation-8TEMrJ_M.cjs.map +0 -1
  172. package/dist/sendInvocation-CkeMyLk1.js +0 -505
  173. package/dist/sendInvocation-CkeMyLk1.js.map +0 -1
  174. package/dist/transport-DqlfAsuH.cjs +0 -279
  175. package/dist/transport-DqlfAsuH.cjs.map +0 -1
  176. package/dist/transport-PstrCcBv.js +0 -261
  177. package/dist/transport-PstrCcBv.js.map +0 -1
  178. package/dist/validation-4w-vDGAi.cjs.map +0 -1
  179. package/dist/validation-eXATmgO0.js.map +0 -1
  180. package/dist/wallet-5wt9wLG3.js.map +0 -1
  181. package/dist/wallet-Blh7oas7.cjs.map +0 -1
@@ -1,4 +1,7 @@
1
- const require_hex = require("./hex-DkGpiZ5e.cjs");
1
+ const require_decimal = require("./decimal-BX7abv5J.cjs");
2
+ const require_hex = require("./hex-CSDZ9d6z.cjs");
3
+ const require_transactionHash = require("./transactionHash-D5yf4KoL.cjs");
4
+ let _thruputchain_protocol = require("@thruputchain/protocol");
2
5
  let _thruputchain_protocol_utils = require("@thruputchain/protocol/utils");
3
6
  //#region src/rpc/schema.json
4
7
  var schema_default = {
@@ -358,6 +361,14 @@ var schema_default = {
358
361
  "required": ["order"],
359
362
  "type": "object"
360
363
  },
364
+ "BlockTimeStep": {
365
+ "properties": {
366
+ "nextBlockTimepoint": { "$ref": "#/components/schemas/DecimalTimePoint" },
367
+ "stepNanoseconds": { "$ref": "#/components/schemas/DecimalU64" }
368
+ },
369
+ "required": ["nextBlockTimepoint"],
370
+ "type": "object"
371
+ },
361
372
  "ChainConfig": {
362
373
  "properties": {
363
374
  "execution": { "$ref": "#/components/schemas/ExecutionConfig" },
@@ -2104,6 +2115,22 @@ var schema_default = {
2104
2115
  "result": { "$ref": "#/components/schemas/BlockClock" },
2105
2116
  "paged": false
2106
2117
  },
2118
+ "dev_setBlockTimeStep": {
2119
+ "params": {
2120
+ "type": "object",
2121
+ "additionalProperties": false,
2122
+ "properties": { "stepNanoseconds": {
2123
+ "maxLength": 20,
2124
+ "pattern": "^(0|[1-9][0-9]*)(?![\\s\\S])",
2125
+ "type": "string",
2126
+ "x-integer-maximum": "18446744073709551615",
2127
+ "x-integer-minimum": "0"
2128
+ } },
2129
+ "required": []
2130
+ },
2131
+ "result": { "$ref": "#/components/schemas/BlockTimeStep" },
2132
+ "paged": false
2133
+ },
2107
2134
  "dev_setBlockDriver": {
2108
2135
  "params": {
2109
2136
  "type": "object",
@@ -10632,6 +10659,296 @@ var schema_default = {
10632
10659
  }
10633
10660
  }
10634
10661
  ],
10662
+ "dev_setBlockTimeStep": [
10663
+ {
10664
+ "code": -32602,
10665
+ "schema": {
10666
+ "oneOf": [{
10667
+ "properties": {
10668
+ "kind": {
10669
+ "const": "invalidParams",
10670
+ "type": "string"
10671
+ },
10672
+ "path": {
10673
+ "pattern": "^(?:/(?:[^~/]|~[01])*)*(?![\\s\\S])",
10674
+ "type": "string"
10675
+ },
10676
+ "reason": { "type": "string" }
10677
+ },
10678
+ "required": ["kind"],
10679
+ "type": "object",
10680
+ "x-forbidden": [
10681
+ "admission",
10682
+ "transactionHash",
10683
+ "signedTransaction",
10684
+ "observation",
10685
+ "receipt",
10686
+ "cause",
10687
+ "serviceCode",
10688
+ "error"
10689
+ ]
10690
+ }],
10691
+ "x-tag": "kind"
10692
+ }
10693
+ },
10694
+ {
10695
+ "code": -32050,
10696
+ "schema": {
10697
+ "oneOf": [{
10698
+ "properties": {
10699
+ "admission": {
10700
+ "enum": [
10701
+ "notAttempted",
10702
+ "rejected",
10703
+ "unknown"
10704
+ ],
10705
+ "type": "string"
10706
+ },
10707
+ "error": {
10708
+ "properties": {
10709
+ "code": {
10710
+ "maximum": 2147483647,
10711
+ "minimum": -2147483648,
10712
+ "type": "integer"
10713
+ },
10714
+ "source": {
10715
+ "anyOf": [{
10716
+ "enum": [
10717
+ "auth",
10718
+ "scheduler",
10719
+ "executor",
10720
+ "other"
10721
+ ],
10722
+ "type": "string"
10723
+ }],
10724
+ "x-extensible": true
10725
+ }
10726
+ },
10727
+ "required": ["source", "code"],
10728
+ "type": "object"
10729
+ },
10730
+ "kind": {
10731
+ "const": "backendUnavailable",
10732
+ "type": "string"
10733
+ },
10734
+ "retryAfterMs": {
10735
+ "maxLength": 20,
10736
+ "pattern": "^(0|[1-9][0-9]*)(?![\\s\\S])",
10737
+ "type": "string",
10738
+ "x-integer-maximum": "18446744073709551615",
10739
+ "x-integer-minimum": "0"
10740
+ },
10741
+ "serviceCode": {
10742
+ "maxLength": 128,
10743
+ "minLength": 1,
10744
+ "type": "string"
10745
+ },
10746
+ "transactionHash": {
10747
+ "maxLength": 45,
10748
+ "minLength": 32,
10749
+ "pattern": "^[1-9A-HJ-NP-Za-km-z]+$",
10750
+ "type": "string",
10751
+ "x-base58-bytes": 32
10752
+ }
10753
+ },
10754
+ "required": ["kind"],
10755
+ "type": "object",
10756
+ "x-forbidden": [
10757
+ "admission",
10758
+ "transactionHash",
10759
+ "signedTransaction",
10760
+ "observation",
10761
+ "receipt",
10762
+ "cause",
10763
+ "serviceCode",
10764
+ "error"
10765
+ ]
10766
+ }],
10767
+ "x-tag": "kind"
10768
+ }
10769
+ },
10770
+ {
10771
+ "code": -32051,
10772
+ "schema": {
10773
+ "oneOf": [{
10774
+ "properties": {
10775
+ "admission": {
10776
+ "enum": [
10777
+ "notAttempted",
10778
+ "rejected",
10779
+ "unknown"
10780
+ ],
10781
+ "type": "string"
10782
+ },
10783
+ "kind": {
10784
+ "const": "backendTimeout",
10785
+ "type": "string"
10786
+ },
10787
+ "retryAfterMs": {
10788
+ "maxLength": 20,
10789
+ "pattern": "^(0|[1-9][0-9]*)(?![\\s\\S])",
10790
+ "type": "string",
10791
+ "x-integer-maximum": "18446744073709551615",
10792
+ "x-integer-minimum": "0"
10793
+ },
10794
+ "transactionHash": {
10795
+ "maxLength": 45,
10796
+ "minLength": 32,
10797
+ "pattern": "^[1-9A-HJ-NP-Za-km-z]+$",
10798
+ "type": "string",
10799
+ "x-base58-bytes": 32
10800
+ }
10801
+ },
10802
+ "required": ["kind"],
10803
+ "type": "object",
10804
+ "x-forbidden": [
10805
+ "admission",
10806
+ "transactionHash",
10807
+ "signedTransaction",
10808
+ "observation",
10809
+ "receipt",
10810
+ "cause",
10811
+ "serviceCode",
10812
+ "error"
10813
+ ]
10814
+ }],
10815
+ "x-tag": "kind"
10816
+ }
10817
+ },
10818
+ {
10819
+ "code": -32053,
10820
+ "schema": {
10821
+ "oneOf": [{
10822
+ "properties": {
10823
+ "admission": {
10824
+ "enum": [
10825
+ "notAttempted",
10826
+ "rejected",
10827
+ "unknown"
10828
+ ],
10829
+ "type": "string"
10830
+ },
10831
+ "error": {
10832
+ "properties": {
10833
+ "code": {
10834
+ "maximum": 2147483647,
10835
+ "minimum": -2147483648,
10836
+ "type": "integer"
10837
+ },
10838
+ "source": {
10839
+ "anyOf": [{
10840
+ "enum": [
10841
+ "auth",
10842
+ "scheduler",
10843
+ "executor",
10844
+ "other"
10845
+ ],
10846
+ "type": "string"
10847
+ }],
10848
+ "x-extensible": true
10849
+ }
10850
+ },
10851
+ "required": ["source", "code"],
10852
+ "type": "object"
10853
+ },
10854
+ "kind": {
10855
+ "const": "overloaded",
10856
+ "type": "string"
10857
+ },
10858
+ "retryAfterMs": {
10859
+ "maxLength": 20,
10860
+ "pattern": "^(0|[1-9][0-9]*)(?![\\s\\S])",
10861
+ "type": "string",
10862
+ "x-integer-maximum": "18446744073709551615",
10863
+ "x-integer-minimum": "0"
10864
+ },
10865
+ "transactionHash": {
10866
+ "maxLength": 45,
10867
+ "minLength": 32,
10868
+ "pattern": "^[1-9A-HJ-NP-Za-km-z]+$",
10869
+ "type": "string",
10870
+ "x-base58-bytes": 32
10871
+ }
10872
+ },
10873
+ "required": ["kind"],
10874
+ "type": "object",
10875
+ "x-forbidden": [
10876
+ "admission",
10877
+ "transactionHash",
10878
+ "signedTransaction",
10879
+ "observation",
10880
+ "receipt",
10881
+ "cause",
10882
+ "serviceCode",
10883
+ "error"
10884
+ ]
10885
+ }],
10886
+ "x-tag": "kind"
10887
+ }
10888
+ },
10889
+ {
10890
+ "code": -32054,
10891
+ "schema": {
10892
+ "oneOf": [{
10893
+ "properties": {
10894
+ "admission": {
10895
+ "enum": [
10896
+ "notAttempted",
10897
+ "rejected",
10898
+ "unknown"
10899
+ ],
10900
+ "type": "string"
10901
+ },
10902
+ "kind": {
10903
+ "const": "backendDataInvalid",
10904
+ "type": "string"
10905
+ },
10906
+ "observation": {
10907
+ "properties": {
10908
+ "blockHeight": {
10909
+ "maxLength": 19,
10910
+ "pattern": "^(0|[1-9][0-9]*)(?![\\s\\S])",
10911
+ "type": "string",
10912
+ "x-integer-maximum": "9223372036854775807",
10913
+ "x-integer-minimum": "0"
10914
+ },
10915
+ "transactionHash": {
10916
+ "maxLength": 45,
10917
+ "minLength": 32,
10918
+ "pattern": "^[1-9A-HJ-NP-Za-km-z]+$",
10919
+ "type": "string",
10920
+ "x-base58-bytes": 32
10921
+ }
10922
+ },
10923
+ "required": ["transactionHash", "blockHeight"],
10924
+ "type": "object"
10925
+ },
10926
+ "reason": { "type": "string" },
10927
+ "transactionHash": {
10928
+ "maxLength": 45,
10929
+ "minLength": 32,
10930
+ "pattern": "^[1-9A-HJ-NP-Za-km-z]+$",
10931
+ "type": "string",
10932
+ "x-base58-bytes": 32
10933
+ }
10934
+ },
10935
+ "required": ["kind"],
10936
+ "type": "object",
10937
+ "x-forbidden": [
10938
+ "admission",
10939
+ "transactionHash",
10940
+ "signedTransaction",
10941
+ "observation",
10942
+ "receipt",
10943
+ "cause",
10944
+ "serviceCode",
10945
+ "error"
10946
+ ]
10947
+ }],
10948
+ "x-tag": "kind"
10949
+ }
10950
+ }
10951
+ ],
10635
10952
  "dev_setBlockDriver": [
10636
10953
  {
10637
10954
  "code": -32602,
@@ -10792,55 +11109,30 @@ var schema_default = {
10792
11109
  }
10793
11110
  };
10794
11111
  //#endregion
10795
- //#region src/actions/decimal.ts
10796
- const I64_MAX = (1n << 63n) - 1n;
10797
- const U64_MAX = (1n << 64n) - 1n;
10798
- /** Parse a canonical, range-checked decimal string. Numeric JSON is never accepted. */
10799
- function parseDecimal(value, field, minimum, maximum) {
10800
- if (typeof value !== "string" || value.length > Math.max(minimum.toString().length, maximum.toString().length) || !/^(0|-?[1-9][0-9]*)(?![\s\S])/.test(value)) throw new Error(`Invalid ${field}: expected a canonical decimal string`);
10801
- const parsed = BigInt(value);
10802
- if (parsed < minimum || parsed > maximum) throw new RangeError(`Invalid ${field}: expected an integer from ${minimum} to ${maximum}`);
10803
- return parsed;
10804
- }
10805
- /** Serialize a caller-owned bigint without passing through a JavaScript number. */
10806
- function serializeHeight(value) {
10807
- if (typeof value !== "bigint" || value < 0n || value > I64_MAX) throw new RangeError("height must be a non-negative int64 bigint");
10808
- return value.toString();
11112
+ //#region src/rpc/localError.ts
11113
+ const localErrors = /* @__PURE__ */ new WeakSet();
11114
+ /** Record an error that the client raised before dispatch. */
11115
+ function markLocalError(error) {
11116
+ localErrors.add(error);
11117
+ return error;
10809
11118
  }
10810
- function serializeU64(value, field) {
10811
- if (typeof value !== "bigint" || value < 0n || value > U64_MAX) throw new RangeError(`${field} must be a uint64 bigint`);
10812
- return value.toString();
11119
+ /** True only for an error recorded by {@link markLocalError}. */
11120
+ function isLocalError(error) {
11121
+ return typeof error === "object" && error !== null && localErrors.has(error);
10813
11122
  }
10814
11123
  //#endregion
10815
11124
  //#region src/rpc/codec.ts
10816
- /** An unfamiliar variant is data, never success, absence, or retry permission. */
10817
- var UnsupportedRpcValue = class {
10818
- raw;
10819
- unsupported = true;
10820
- constructor(raw) {
10821
- this.raw = raw;
10822
- }
10823
- };
10824
11125
  /** Malformed known result data, with the complete original result retained. */
10825
- var RpcDecodingError = class extends Error {
10826
- path;
10827
- raw;
10828
- constructor(path, raw) {
10829
- super(`Invalid native RPC value at ${path}`);
10830
- this.path = path;
10831
- this.raw = raw;
10832
- this.name = "RpcDecodingError";
10833
- }
10834
- };
11126
+ function rpcValueInvalid(path, raw) {
11127
+ return new require_decimal.ThruputError("rpcValueInvalid", `Invalid native RPC value at ${path}`, { context: {
11128
+ path,
11129
+ raw
11130
+ } });
11131
+ }
10835
11132
  /** Invalid local input. The transport was not called; this is not retry permission. */
10836
- var RpcRequestValidationError = class extends Error {
10837
- path;
10838
- constructor(path, message = "Invalid native RPC request") {
10839
- super(`${message} at ${path}`);
10840
- this.path = path;
10841
- this.name = "RpcRequestValidationError";
10842
- }
10843
- };
11133
+ function rpcRequestInvalid(path, message = "Invalid native RPC request") {
11134
+ return markLocalError(new require_decimal.ThruputError("rpcRequestInvalid", `${message} at ${path}`, { context: { path } }));
11135
+ }
10844
11136
  const catalog = schema_default;
10845
11137
  const rpcPageMethods = new Set(Object.entries(catalog.methods).filter(([, m]) => m.paged).map(([name]) => name));
10846
11138
  const patterns = /* @__PURE__ */ new Map();
@@ -10853,13 +11145,20 @@ function matches(pattern, text) {
10853
11145
  return regex.test(text);
10854
11146
  }
10855
11147
  const rpcMethodNames = Object.freeze(Object.keys(catalog.methods));
10856
- function record(value) {
11148
+ function record$1(value) {
10857
11149
  return value !== null && typeof value === "object" && !Array.isArray(value);
10858
11150
  }
11151
+ /** Cheap internal decode failure; each boundary converts it to a `ThruputError` once. */
11152
+ var SchemaMismatch = class {
11153
+ path;
11154
+ constructor(path) {
11155
+ this.path = path;
11156
+ }
11157
+ };
10859
11158
  /** The codec implements only the schema forms emitted by the pinned Rust owner. */
10860
11159
  function convert(s, value, encode, path) {
10861
11160
  const fail = () => {
10862
- throw new RpcDecodingError(path, value);
11161
+ throw new SchemaMismatch(path);
10863
11162
  };
10864
11163
  if (s.$ref) {
10865
11164
  const name = s.$ref.split("/").at(-1);
@@ -10890,18 +11189,18 @@ function convert(s, value, encode, path) {
10890
11189
  if (variants) {
10891
11190
  const tag = s["x-tag"];
10892
11191
  if (tag) {
10893
- if (!record(value) || typeof value[tag] !== "string") return fail();
11192
+ if (!record$1(value) || typeof value[tag] !== "string") return fail();
10894
11193
  const variant = variants.find((v) => v.properties[tag].const === value[tag]);
10895
11194
  if (variant) return convert(variant, value, encode, path);
10896
- if (!encode && s["x-extensible"]) return new UnsupportedRpcValue(value);
11195
+ if (!encode && s["x-extensible"]) return new require_decimal.UnsupportedRpcValue(value);
10897
11196
  return fail();
10898
11197
  }
10899
11198
  for (const variant of variants) try {
10900
11199
  return convert(variant, value, encode, path);
10901
11200
  } catch (error) {
10902
- if (!(error instanceof RpcDecodingError)) throw error;
11201
+ if (!(error instanceof SchemaMismatch)) throw error;
10903
11202
  }
10904
- if (!encode && s["x-extensible"] && typeof value === "string") return new UnsupportedRpcValue(value);
11203
+ if (!encode && s["x-extensible"] && typeof value === "string") return new require_decimal.UnsupportedRpcValue(value);
10905
11204
  return fail();
10906
11205
  }
10907
11206
  if (s["x-integer-minimum"] !== void 0) {
@@ -10914,14 +11213,14 @@ function convert(s, value, encode, path) {
10914
11213
  }
10915
11214
  if (typeof value === "string" && !allowed(value)) return fail();
10916
11215
  try {
10917
- return parseDecimal(value, path, minimum, maximum);
11216
+ return require_decimal.parseDecimal(value, path, minimum, maximum);
10918
11217
  } catch {
10919
11218
  return fail();
10920
11219
  }
10921
11220
  }
10922
11221
  if (s.type === "null") return value === null ? null : fail();
10923
11222
  if (s.type === "object") {
10924
- if (!record(value) || value instanceof Uint8Array) return fail();
11223
+ if (!record$1(value) || value instanceof Uint8Array) return fail();
10925
11224
  const properties = s.properties ?? {};
10926
11225
  if (s["x-forbidden"]?.some((k) => Object.hasOwn(value, k))) return fail();
10927
11226
  for (const [field, required] of Object.entries(s.dependencies ?? {})) if (Object.hasOwn(value, field) && required.some((k) => !Object.hasOwn(value, k))) return fail();
@@ -10960,10 +11259,10 @@ function encodeRequest(method, value) {
10960
11259
  if (!entry) throw new Error(`Unknown native RPC method ${method}`);
10961
11260
  try {
10962
11261
  const encoded = convert(entry.params, value, true, "/params");
10963
- if (entry.paged && Object.hasOwn(encoded, "start") === Object.hasOwn(encoded, "cursor")) throw new RpcDecodingError("/params", value);
11262
+ if (entry.paged && Object.hasOwn(encoded, "start") === Object.hasOwn(encoded, "cursor")) throw new SchemaMismatch("/params");
10964
11263
  return encoded;
10965
11264
  } catch (error) {
10966
- if (error instanceof RpcDecodingError) throw new RpcRequestValidationError(error.path);
11265
+ if (error instanceof SchemaMismatch) throw rpcRequestInvalid(error.path);
10967
11266
  throw error;
10968
11267
  }
10969
11268
  }
@@ -10973,76 +11272,358 @@ function decodeResult(method, value) {
10973
11272
  try {
10974
11273
  return convert(entry.result, value, false, "/result");
10975
11274
  } catch (error) {
10976
- if (error instanceof RpcDecodingError) throw new RpcDecodingError(error.path, value);
11275
+ if (error instanceof SchemaMismatch) throw rpcValueInvalid(error.path, value);
10977
11276
  throw error;
10978
11277
  }
10979
11278
  }
10980
11279
  /** Method/code membership and structural evidence; relational identity checks live in the reader. */
10981
11280
  function decodeErrorData(method, code, value) {
10982
11281
  const entry = catalog.errors[method]?.find((entry) => entry.code === code);
10983
- if (!entry) throw new RpcDecodingError("/error", value);
10984
- return convert(entry.schema, value, false, "/error/data");
11282
+ if (!entry) throw rpcValueInvalid("/error", value);
11283
+ try {
11284
+ return convert(entry.schema, value, false, "/error/data");
11285
+ } catch (error) {
11286
+ if (error instanceof SchemaMismatch) throw rpcValueInvalid(error.path, value);
11287
+ throw error;
11288
+ }
10985
11289
  }
10986
11290
  //#endregion
10987
- Object.defineProperty(exports, "RpcDecodingError", {
10988
- enumerable: true,
10989
- get: function() {
10990
- return RpcDecodingError;
11291
+ //#region src/rpc/errorReader.ts
11292
+ const record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
11293
+ const equal$1 = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
11294
+ /**
11295
+ * Classifies method-specific causes without granting retries. Unknown, malformed,
11296
+ * or contradictory evidence stays unclassified with the complete raw error.
11297
+ * Supply the locally computed/requested hash to bind admission or observation evidence.
11298
+ */
11299
+ function decodeRpcError(method, raw, expectedTransactionHash) {
11300
+ const unclassified = () => ({
11301
+ classification: "unclassified",
11302
+ raw
11303
+ });
11304
+ if (!record(raw) || typeof raw.code !== "number" || !Number.isInteger(raw.code) || raw.code < -2147483648 || raw.code > 2147483647 || typeof raw.message !== "string") return unclassified();
11305
+ try {
11306
+ const data = decodeErrorData(method, raw.code, raw.data);
11307
+ if (!validFunding(data)) return unclassified();
11308
+ if (expectedTransactionHash) {
11309
+ if (method === "sendTransaction" && "transactionHash" in data && data.transactionHash && !equal$1(data.transactionHash, expectedTransactionHash)) return unclassified();
11310
+ if (method === "getTransactionReceipt" && "observation" in data && data.observation && !equal$1(data.observation.transactionHash, expectedTransactionHash)) return unclassified();
11311
+ }
11312
+ return {
11313
+ classification: "known",
11314
+ data,
11315
+ raw
11316
+ };
11317
+ } catch (error) {
11318
+ if (require_decimal.isThruputError(error, "rpcValueInvalid")) return unclassified();
11319
+ throw error;
10991
11320
  }
10992
- });
10993
- Object.defineProperty(exports, "RpcRequestValidationError", {
10994
- enumerable: true,
10995
- get: function() {
10996
- return RpcRequestValidationError;
11321
+ }
11322
+ function validFunding(data) {
11323
+ if (data.kind !== "fundingAttemptStopped" && data.kind !== "localFundingUnresolved") return true;
11324
+ if (data.signedTransaction) try {
11325
+ if (!data.transactionHash || !equal$1(require_transactionHash.hashSignedTransaction((0, _thruputchain_protocol.deserialize)(data.signedTransaction, _thruputchain_protocol.codec.SignedTransaction)), data.transactionHash)) return false;
11326
+ } catch {
11327
+ return false;
10997
11328
  }
10998
- });
10999
- Object.defineProperty(exports, "UnsupportedRpcValue", {
11000
- enumerable: true,
11001
- get: function() {
11002
- return UnsupportedRpcValue;
11329
+ if (data.kind === "fundingAttemptStopped") return !data.receipt || !!data.transactionHash && equal$1(data.receipt.transactionHash, data.transactionHash);
11330
+ if (data.cause) {
11331
+ if (!validFunding(data.cause)) return false;
11332
+ if (data.cause.transactionHash && !equal$1(data.cause.transactionHash, data.transactionHash)) return false;
11333
+ if (data.cause.signedTransaction && !equal$1(data.cause.signedTransaction, data.signedTransaction)) return false;
11003
11334
  }
11004
- });
11005
- Object.defineProperty(exports, "decodeErrorData", {
11006
- enumerable: true,
11007
- get: function() {
11008
- return decodeErrorData;
11335
+ return true;
11336
+ }
11337
+ /**
11338
+ * Wrap a JSON-RPC error from a native method. Keep the complete raw error and a
11339
+ * conservative typed reading; unknown or contradictory evidence is `unrecognized`.
11340
+ */
11341
+ function nativeRpcError(error, method, expectedTransactionHash) {
11342
+ const raw = record(error.raw) ? error.raw : {
11343
+ ...typeof error.code === "number" ? { code: error.code } : {},
11344
+ ...typeof error.rpcMessage === "string" ? { message: error.rpcMessage } : {},
11345
+ ...error.data === void 0 ? {} : { data: error.data }
11346
+ };
11347
+ const decoded = decodeRpcError(method, raw, expectedTransactionHash);
11348
+ return new require_decimal.ThruputError("nativeRpcError", `${method}: ${error.rpcMessage} (RPC ${error.code})`, { context: {
11349
+ code: error.code,
11350
+ rpcMessage: error.rpcMessage,
11351
+ method,
11352
+ raw,
11353
+ ...decoded.classification === "known" ? {
11354
+ kind: decoded.data.kind,
11355
+ data: decoded.data
11356
+ } : { kind: "unrecognized" }
11357
+ } });
11358
+ }
11359
+ //#endregion
11360
+ //#region src/rpc/client.ts
11361
+ /**
11362
+ * The endpoint, network, or method set does not match what the client requires.
11363
+ * Raised by a local check, so it proves that the request was not dispatched.
11364
+ */
11365
+ function rpcIncompatible(kind, message) {
11366
+ return markLocalError(new require_decimal.ThruputError("rpcIncompatible", message, { context: { kind } }));
11367
+ }
11368
+ const equal = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
11369
+ /**
11370
+ * Connect a native wire-14 client. This layer reads once or sends once; it does
11371
+ * not sign, poll, retry, refresh discovery on failure, or switch wire formats.
11372
+ * Unknown response variants are UnsupportedRpcValue objects retaining raw data.
11373
+ */
11374
+ async function createRpcClient(options) {
11375
+ const transport = options.transport;
11376
+ const expected = options.expectedNetworkHash ? new Uint8Array(options.expectedNetworkHash) : void 0;
11377
+ if (expected && expected.length !== 32) throw new RangeError("expectedNetworkHash must have 32 bytes");
11378
+ const required = [...options.requiredMethods ?? []];
11379
+ let discovery;
11380
+ let configured = /* @__PURE__ */ new Set();
11381
+ const requireMethods = (methods) => {
11382
+ for (const method of methods) if (!configured.has(method)) throw rpcIncompatible("method", `Endpoint does not advertise ${method}`);
11383
+ };
11384
+ const requestOnce = async (method, params, control, hash) => {
11385
+ try {
11386
+ return await transport.request(method, params, control);
11387
+ } catch (error) {
11388
+ if (require_decimal.isThruputError(error, "rpcError")) throw nativeRpcError(error.context, method, hash);
11389
+ throw error;
11390
+ }
11391
+ };
11392
+ const read = async (method, control) => decodeResult(method, await requestOnce(method, {}, control));
11393
+ const refreshDiscovery = async (control) => {
11394
+ const version = await read("getVersionInfo", control);
11395
+ if (!/^14\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.test(version.wireFormat)) throw rpcIncompatible("wireVersion", `Unsupported RPC wire format ${version.wireFormat}`);
11396
+ const methods = new Set(version.supportedMethods);
11397
+ for (const method of [
11398
+ "getVersionInfo",
11399
+ "getNetworkInfo",
11400
+ ...required
11401
+ ]) if (!methods.has(method)) throw rpcIncompatible("method", `Endpoint does not advertise ${method}`);
11402
+ const network = await read("getNetworkInfo", control);
11403
+ const wanted = expected ?? discovery?.network.networkHash;
11404
+ if (wanted && !equal(wanted, network.networkHash)) throw rpcIncompatible("network", "RPC network identity does not match");
11405
+ const limits = methods.has("getServerLimits") ? await read("getServerLimits", control) : void 0;
11406
+ discovery = {
11407
+ version,
11408
+ network,
11409
+ ...limits ? { limits } : {}
11410
+ };
11411
+ configured = methods;
11412
+ return structuredClone(discovery);
11413
+ };
11414
+ await refreshDiscovery({ signal: options.signal });
11415
+ const methods = Object.fromEntries(rpcMethodNames.map((name) => [name, async (request = {}, control) => {
11416
+ const method = name;
11417
+ control?.signal?.throwIfAborted();
11418
+ requireMethods([method]);
11419
+ const params = encodeRequest(method, request);
11420
+ const input = structuredClone(request);
11421
+ const limits = discovery.limits;
11422
+ checkLimits(method, input, limits);
11423
+ let submittedHash;
11424
+ if (method === "sendTransaction") try {
11425
+ submittedHash = require_transactionHash.hashSignedTransaction((0, _thruputchain_protocol.deserialize)(input.signedTransaction, _thruputchain_protocol.codec.SignedTransaction));
11426
+ } catch {
11427
+ throw rpcRequestInvalid("/params/signedTransaction", "Invalid signed transaction XDR");
11428
+ }
11429
+ const raw = await requestOnce(method, params, control, submittedHash ?? (method === "getTransactionReceipt" ? input.transactionHash : void 0));
11430
+ const result = decodeResult(method, raw);
11431
+ checkResult(method, input, result, raw, submittedHash, limits, discovery.network.networkHash);
11432
+ return result;
11433
+ }]));
11434
+ return Object.defineProperty(Object.assign(methods, {
11435
+ refreshDiscovery,
11436
+ requireMethods
11437
+ }), "discovery", {
11438
+ get: () => structuredClone(discovery),
11439
+ enumerable: true
11440
+ });
11441
+ }
11442
+ function checkLimits(method, input, limits) {
11443
+ if (rpcPageMethods.has(method)) {
11444
+ if (!limits) throw rpcIncompatible("limits", "History calls require advertised server limits");
11445
+ const cap = method === "getEvents" ? limits.maxEventsPerPage : limits.maxTransactionsPerPage;
11446
+ if (input.limit !== void 0 && input.limit > cap) throw rpcRequestInvalid("/params/limit", `limit exceeds endpoint cap ${cap}`);
11447
+ if (typeof input.cursor === "string" && BigInt((input.cursor.length - 2) / 2) > limits.maxCursorBytes) throw rpcRequestInvalid("/params/cursor", "cursor exceeds endpoint cap");
11009
11448
  }
11010
- });
11011
- Object.defineProperty(exports, "decodeResult", {
11012
- enumerable: true,
11013
- get: function() {
11014
- return decodeResult;
11449
+ if (method === "simulateInvocation" || method === "simulateInvocations") {
11450
+ if (!limits) throw rpcIncompatible("limits", "Simulation calls require advertised server limits");
11451
+ const calls = method === "simulateInvocation" ? [input] : input.invocations;
11452
+ let gas = 0n, bytes = 0;
11453
+ for (const call of calls) {
11454
+ const callGas = call.gasLimit;
11455
+ if (callGas !== void 0 && callGas > limits.maxSimulationGas) throw rpcRequestInvalid("/params/gasLimit", "gasLimit exceeds endpoint cap");
11456
+ const size = call.calldata.length;
11457
+ if (BigInt(size) > limits.maxSimulationCalldataBytes) throw rpcRequestInvalid("/params/calldata", "calldata exceeds endpoint cap");
11458
+ gas += callGas ?? limits.maxSimulationGas;
11459
+ bytes += size;
11460
+ }
11461
+ if (method === "simulateInvocations") {
11462
+ const batch = limits.simulationBatch;
11463
+ if (!batch) throw rpcIncompatible("limits", "Batch simulation limits are unavailable");
11464
+ if (calls.length > batch.maxInvocations || bytes > batch.maxCalldataBytes || gas > batch.maxGas) throw rpcRequestInvalid("/params/invocations", "simulation batch exceeds endpoint cap");
11465
+ }
11015
11466
  }
11016
- });
11017
- Object.defineProperty(exports, "encodeRequest", {
11018
- enumerable: true,
11019
- get: function() {
11020
- return encodeRequest;
11467
+ }
11468
+ /**
11469
+ * Local block and time results must match their own request: a pinned
11470
+ * timepoint comes back exactly, a multi-block request returns `count`
11471
+ * blocks, a step change reports the requested step (none when cleared), and a
11472
+ * mode change reports the requested mode and interval.
11473
+ */
11474
+ function checkBlockControlResult(method, input, value, invalid) {
11475
+ if (method === "dev_produceBlock") {
11476
+ const block = value;
11477
+ if (block.blockHeight <= 0n || input.blockTimepoint !== void 0 && block.blockTimepoint !== input.blockTimepoint) invalid();
11021
11478
  }
11022
- });
11023
- Object.defineProperty(exports, "rpcMethodNames", {
11479
+ if (method === "dev_produceBlocks" && value.blocks.length !== input.count) invalid();
11480
+ if (method === "dev_setNextBlockTimepoint" && value.nextBlockTimepoint !== input.blockTimepoint) invalid();
11481
+ if (method === "dev_setBlockTimeStep" && value.stepNanoseconds !== input.stepNanoseconds) invalid();
11482
+ if (method === "dev_setBlockDriver") {
11483
+ const status = value;
11484
+ if (typeof status.mode === "string" && status.mode !== input.mode || input.intervalMilliseconds !== void 0 && status.intervalMilliseconds !== input.intervalMilliseconds) invalid();
11485
+ }
11486
+ }
11487
+ function checkResult(method, input, value, raw, submittedHash, limits, networkHash) {
11488
+ const invalid = () => {
11489
+ throw rpcValueInvalid("/result", raw);
11490
+ };
11491
+ if (value === null) return;
11492
+ const result = value;
11493
+ if (method === "getTransactionReceipt" && !equal(result.transactionHash, input.transactionHash) || submittedHash && !equal(result.transactionHash, submittedHash)) invalid();
11494
+ if (method === "getBlockByHeight" && (result.blockHeight <= 0n || result.blockHeight !== input.blockHeight || !equal(result.networkHash, networkHash))) invalid();
11495
+ if ((method === "getBalance" || method === "getRegisteredAuth") && !equal(result.address, input.address)) invalid();
11496
+ if (method === "simulateInvocations" && result.results.length !== input.invocations.length) invalid();
11497
+ if ((method === "simulateInvocation" || method === "simulateInvocations") && input.minStateBlockHeight !== void 0 && result.stateBlockHeight < input.minStateBlockHeight) invalid();
11498
+ if (method === "dev_fundAccount") {
11499
+ const funding = value;
11500
+ try {
11501
+ if (!equal(funding.recipient, input.recipient) || funding.rawAmount !== input.rawAmount || !equal(funding.transactionHash, require_transactionHash.hashSignedTransaction((0, _thruputchain_protocol.deserialize)(funding.signedTransaction, _thruputchain_protocol.codec.SignedTransaction)))) invalid();
11502
+ } catch {
11503
+ invalid();
11504
+ }
11505
+ }
11506
+ checkBlockControlResult(method, input, value, invalid);
11507
+ if (method === "faucet_requestAirdrop" && "recipient" in result && !equal(result.recipient, input.recipient)) invalid();
11508
+ if (!rpcPageMethods.has(method)) return;
11509
+ const page = value;
11510
+ const entries = method === "getEvents" ? page.events : page.transactions;
11511
+ const cap = method === "getEvents" ? limits.maxEventsPerPage : limits.maxTransactionsPerPage;
11512
+ if (page.oldestIndexedBlockHeight > page.latestIndexedBlockHeight || entries.length > (input.limit ?? Math.min(50, cap)) || page.nextCursor !== null && (page.nextCursor === input.cursor || BigInt((page.nextCursor.length - 2) / 2) > limits.maxCursorBytes)) invalid();
11513
+ if (entries.some((entry) => entry.blockHeight < page.oldestIndexedBlockHeight || entry.blockHeight > page.latestIndexedBlockHeight)) invalid();
11514
+ const start = input.start;
11515
+ if (method === "getTransactionsByBlock") {
11516
+ if (page.oldestIndexedBlockHeight < 1n || !entries.length && page.nextCursor !== null || input.cursor !== void 0 && (input.blockHeight < page.oldestIndexedBlockHeight || input.blockHeight > page.latestIndexedBlockHeight) || entries.some((entry) => entry.blockHeight !== input.blockHeight)) invalid();
11517
+ } else if (start?.anchor.kind === "atHeight") {
11518
+ const anchor = start.anchor.blockHeight;
11519
+ if (anchor < page.oldestIndexedBlockHeight || entries.some((entry) => start.order === "ascending" ? entry.blockHeight < anchor : entry.blockHeight > anchor)) invalid();
11520
+ }
11521
+ const identities = /* @__PURE__ */ new Set();
11522
+ const keys = [];
11523
+ for (const [index, entry] of entries.entries()) {
11524
+ const event = method === "getEvents" ? page.events[index] : void 0;
11525
+ const hash = require_hex.toHex0x(entry.transactionHash);
11526
+ const sequence = event?.sequenceNumber ?? 0;
11527
+ const identity = method === "getEvents" ? `${hash}/${sequence}` : hash;
11528
+ if (identities.has(identity)) invalid();
11529
+ identities.add(identity);
11530
+ keys.push([
11531
+ entry.blockHeight,
11532
+ hash,
11533
+ sequence
11534
+ ]);
11535
+ if (event && !input.filters.some((filter) => filter.addresses.some((address) => equal(address, event.event.address)) && [
11536
+ "topic0",
11537
+ "topic1",
11538
+ "topic2"
11539
+ ].every((key, i) => {
11540
+ const values = filter.topics?.[key];
11541
+ return !values?.length || !!event.event.topics[i] && values.some((topic) => equal(topic, event.event.topics[i]));
11542
+ }))) invalid();
11543
+ }
11544
+ const compare = (left, right) => {
11545
+ for (let i = 0; i < 3; i++) {
11546
+ if (left[i] < right[i]) return -1;
11547
+ if (left[i] > right[i]) return 1;
11548
+ }
11549
+ return 0;
11550
+ };
11551
+ const asc = keys.every((key, i) => i === 0 || compare(keys[i - 1], key) < 0);
11552
+ const desc = keys.every((key, i) => i === 0 || compare(keys[i - 1], key) > 0);
11553
+ if (!(start ? start.order === "ascending" ? asc : desc : asc || desc)) invalid();
11554
+ }
11555
+ //#endregion
11556
+ //#region src/transport/readError.ts
11557
+ /**
11558
+ * Classify an infrastructure read failure without replacing the original error.
11559
+ *
11560
+ * Pass the caller's signal to distinguish explicit cancellation from a transport
11561
+ * timeout. Plain Error wrappers are inspected through their causes; other
11562
+ * `ThruputError` codes and unrecognized failures remain unknown. A bare TypeError
11563
+ * is not evidence of a network failure. Custom transports should throw code
11564
+ * `httpRequestFailed` for that case. Transaction-not-found remains
11565
+ * operation-specific rather than a general retry. This classification never
11566
+ * authorizes transaction resubmission.
11567
+ */
11568
+ function classifyReadError(error, options = {}) {
11569
+ if (options.signal?.aborted) return "cancelled";
11570
+ const seen = /* @__PURE__ */ new Set();
11571
+ while (error !== null && typeof error === "object" && !seen.has(error)) {
11572
+ seen.add(error);
11573
+ if (require_decimal.isThruputError(error, "httpRequestFailed")) return "transient";
11574
+ if (require_decimal.isThruputError(error, "httpResponseError")) return [
11575
+ 408,
11576
+ 429,
11577
+ 500,
11578
+ 502,
11579
+ 503,
11580
+ 504
11581
+ ].includes(error.context.status) ? "transient" : "permanent";
11582
+ if (require_decimal.isThruputError(error, "nativeRpcError")) switch (error.context.kind) {
11583
+ case "backendUnavailable":
11584
+ case "stateHeightUnavailable":
11585
+ case "backendTimeout":
11586
+ case "overloaded": return "transient";
11587
+ case "invalidParams":
11588
+ case "invalidCursor":
11589
+ case "transactionInvalid":
11590
+ case "transactionRejected":
11591
+ case "historyUnavailable": return "permanent";
11592
+ default: return "unknown";
11593
+ }
11594
+ if ("name" in error) {
11595
+ if (error.name === "TimeoutError") return "transient";
11596
+ if (error.name === "AbortError") return "cancelled";
11597
+ }
11598
+ if (!(error instanceof Error) || error.constructor !== Error) return "unknown";
11599
+ error = error.cause;
11600
+ }
11601
+ return "unknown";
11602
+ }
11603
+ //#endregion
11604
+ Object.defineProperty(exports, "classifyReadError", {
11024
11605
  enumerable: true,
11025
11606
  get: function() {
11026
- return rpcMethodNames;
11607
+ return classifyReadError;
11027
11608
  }
11028
11609
  });
11029
- Object.defineProperty(exports, "rpcPageMethods", {
11610
+ Object.defineProperty(exports, "createRpcClient", {
11030
11611
  enumerable: true,
11031
11612
  get: function() {
11032
- return rpcPageMethods;
11613
+ return createRpcClient;
11033
11614
  }
11034
11615
  });
11035
- Object.defineProperty(exports, "serializeHeight", {
11616
+ Object.defineProperty(exports, "isLocalError", {
11036
11617
  enumerable: true,
11037
11618
  get: function() {
11038
- return serializeHeight;
11619
+ return isLocalError;
11039
11620
  }
11040
11621
  });
11041
- Object.defineProperty(exports, "serializeU64", {
11622
+ Object.defineProperty(exports, "rpcIncompatible", {
11042
11623
  enumerable: true,
11043
11624
  get: function() {
11044
- return serializeU64;
11625
+ return rpcIncompatible;
11045
11626
  }
11046
11627
  });
11047
11628
 
11048
- //# sourceMappingURL=codec-C4LJ0g8v.cjs.map
11629
+ //# sourceMappingURL=readError-COcEDNoZ.cjs.map