@getomnichain/omnichain 0.2.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 (296) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +66 -0
  3. package/dist/abstract_gas_pricing.d.ts +31 -0
  4. package/dist/abstract_gas_pricing.d.ts.map +1 -0
  5. package/dist/abstract_gas_pricing.js +22 -0
  6. package/dist/abstract_gas_pricing.js.map +1 -0
  7. package/dist/address.d.ts +10 -0
  8. package/dist/address.d.ts.map +1 -0
  9. package/dist/address.factory.d.ts +26 -0
  10. package/dist/address.factory.d.ts.map +1 -0
  11. package/dist/address.factory.js +75 -0
  12. package/dist/address.factory.js.map +1 -0
  13. package/dist/address.js +13 -0
  14. package/dist/address.js.map +1 -0
  15. package/dist/address_field.decorator.d.ts +17 -0
  16. package/dist/address_field.decorator.d.ts.map +1 -0
  17. package/dist/address_field.decorator.js +34 -0
  18. package/dist/address_field.decorator.js.map +1 -0
  19. package/dist/chain.base.d.ts +79 -0
  20. package/dist/chain.base.d.ts.map +1 -0
  21. package/dist/chain.base.js +113 -0
  22. package/dist/chain.base.js.map +1 -0
  23. package/dist/chain_ids.d.ts +122 -0
  24. package/dist/chain_ids.d.ts.map +1 -0
  25. package/dist/chain_ids.js +193 -0
  26. package/dist/chain_ids.js.map +1 -0
  27. package/dist/errors.d.ts +42 -0
  28. package/dist/errors.d.ts.map +1 -0
  29. package/dist/errors.js +62 -0
  30. package/dist/errors.js.map +1 -0
  31. package/dist/evm/evm_address.d.ts +11 -0
  32. package/dist/evm/evm_address.d.ts.map +1 -0
  33. package/dist/evm/evm_address.js +56 -0
  34. package/dist/evm/evm_address.js.map +1 -0
  35. package/dist/evm/evm_chain.d.ts +123 -0
  36. package/dist/evm/evm_chain.d.ts.map +1 -0
  37. package/dist/evm/evm_chain.js +685 -0
  38. package/dist/evm/evm_chain.js.map +1 -0
  39. package/dist/evm/evm_chains.d.ts +83 -0
  40. package/dist/evm/evm_chains.d.ts.map +1 -0
  41. package/dist/evm/evm_chains.js +493 -0
  42. package/dist/evm/evm_chains.js.map +1 -0
  43. package/dist/evm/evm_gas_estimate.d.ts +45 -0
  44. package/dist/evm/evm_gas_estimate.d.ts.map +1 -0
  45. package/dist/evm/evm_gas_estimate.js +70 -0
  46. package/dist/evm/evm_gas_estimate.js.map +1 -0
  47. package/dist/evm/evm_gas_pricing.d.ts +40 -0
  48. package/dist/evm/evm_gas_pricing.d.ts.map +1 -0
  49. package/dist/evm/evm_gas_pricing.js +56 -0
  50. package/dist/evm/evm_gas_pricing.js.map +1 -0
  51. package/dist/evm/evm_token.d.ts +7 -0
  52. package/dist/evm/evm_token.d.ts.map +1 -0
  53. package/dist/evm/evm_token.js +22 -0
  54. package/dist/evm/evm_token.js.map +1 -0
  55. package/dist/evm/evm_tokens.d.ts +81 -0
  56. package/dist/evm/evm_tokens.d.ts.map +1 -0
  57. package/dist/evm/evm_tokens.js +104 -0
  58. package/dist/evm/evm_tokens.js.map +1 -0
  59. package/dist/evm/evm_transaction_status.d.ts +108 -0
  60. package/dist/evm/evm_transaction_status.d.ts.map +1 -0
  61. package/dist/evm/evm_transaction_status.js +177 -0
  62. package/dist/evm/evm_transaction_status.js.map +1 -0
  63. package/dist/evm/index.d.ts +10 -0
  64. package/dist/evm/index.d.ts.map +1 -0
  65. package/dist/evm/index.js +10 -0
  66. package/dist/evm/index.js.map +1 -0
  67. package/dist/evm/unsigned_evm_transaction.d.ts +19 -0
  68. package/dist/evm/unsigned_evm_transaction.d.ts.map +1 -0
  69. package/dist/evm/unsigned_evm_transaction.js +18 -0
  70. package/dist/evm/unsigned_evm_transaction.js.map +1 -0
  71. package/dist/index.d.ts +18 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +18 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/is_address.decorator.d.ts +3 -0
  76. package/dist/is_address.decorator.d.ts.map +1 -0
  77. package/dist/is_address.decorator.js +51 -0
  78. package/dist/is_address.decorator.js.map +1 -0
  79. package/dist/network_type.d.ts +73 -0
  80. package/dist/network_type.d.ts.map +1 -0
  81. package/dist/network_type.js +144 -0
  82. package/dist/network_type.js.map +1 -0
  83. package/dist/priority.d.ts +23 -0
  84. package/dist/priority.d.ts.map +1 -0
  85. package/dist/priority.js +23 -0
  86. package/dist/priority.js.map +1 -0
  87. package/dist/solana/index.d.ts +9 -0
  88. package/dist/solana/index.d.ts.map +1 -0
  89. package/dist/solana/index.js +9 -0
  90. package/dist/solana/index.js.map +1 -0
  91. package/dist/solana/solana_address.d.ts +20 -0
  92. package/dist/solana/solana_address.d.ts.map +1 -0
  93. package/dist/solana/solana_address.js +45 -0
  94. package/dist/solana/solana_address.js.map +1 -0
  95. package/dist/solana/solana_chain.d.ts +213 -0
  96. package/dist/solana/solana_chain.d.ts.map +1 -0
  97. package/dist/solana/solana_chain.js +704 -0
  98. package/dist/solana/solana_chain.js.map +1 -0
  99. package/dist/solana/solana_chains.d.ts +24 -0
  100. package/dist/solana/solana_chains.d.ts.map +1 -0
  101. package/dist/solana/solana_chains.js +84 -0
  102. package/dist/solana/solana_chains.js.map +1 -0
  103. package/dist/solana/solana_gas_pricing.d.ts +30 -0
  104. package/dist/solana/solana_gas_pricing.d.ts.map +1 -0
  105. package/dist/solana/solana_gas_pricing.js +26 -0
  106. package/dist/solana/solana_gas_pricing.js.map +1 -0
  107. package/dist/solana/solana_token.d.ts +19 -0
  108. package/dist/solana/solana_token.d.ts.map +1 -0
  109. package/dist/solana/solana_token.js +34 -0
  110. package/dist/solana/solana_token.js.map +1 -0
  111. package/dist/solana/solana_tokens.d.ts +22 -0
  112. package/dist/solana/solana_tokens.d.ts.map +1 -0
  113. package/dist/solana/solana_tokens.js +26 -0
  114. package/dist/solana/solana_tokens.js.map +1 -0
  115. package/dist/solana/solana_transaction_status.d.ts +59 -0
  116. package/dist/solana/solana_transaction_status.d.ts.map +1 -0
  117. package/dist/solana/solana_transaction_status.js +144 -0
  118. package/dist/solana/solana_transaction_status.js.map +1 -0
  119. package/dist/solana/unsigned_solana_transaction.d.ts +31 -0
  120. package/dist/solana/unsigned_solana_transaction.d.ts.map +1 -0
  121. package/dist/solana/unsigned_solana_transaction.js +26 -0
  122. package/dist/solana/unsigned_solana_transaction.js.map +1 -0
  123. package/dist/token.d.ts +35 -0
  124. package/dist/token.d.ts.map +1 -0
  125. package/dist/token.js +62 -0
  126. package/dist/token.js.map +1 -0
  127. package/dist/ton/index.d.ts +2 -0
  128. package/dist/ton/index.d.ts.map +1 -0
  129. package/dist/ton/index.js +2 -0
  130. package/dist/ton/index.js.map +1 -0
  131. package/dist/ton/ton_address.d.ts +10 -0
  132. package/dist/ton/ton_address.d.ts.map +1 -0
  133. package/dist/ton/ton_address.js +53 -0
  134. package/dist/ton/ton_address.js.map +1 -0
  135. package/dist/transaction_status.d.ts +140 -0
  136. package/dist/transaction_status.d.ts.map +1 -0
  137. package/dist/transaction_status.js +271 -0
  138. package/dist/transaction_status.js.map +1 -0
  139. package/dist/unsigned_transaction.d.ts +7 -0
  140. package/dist/unsigned_transaction.d.ts.map +1 -0
  141. package/dist/unsigned_transaction.js +9 -0
  142. package/dist/unsigned_transaction.js.map +1 -0
  143. package/dist/utxo/btc/btc_address.d.ts +15 -0
  144. package/dist/utxo/btc/btc_address.d.ts.map +1 -0
  145. package/dist/utxo/btc/btc_address.js +39 -0
  146. package/dist/utxo/btc/btc_address.js.map +1 -0
  147. package/dist/utxo/btc/btc_chain.d.ts +34 -0
  148. package/dist/utxo/btc/btc_chain.d.ts.map +1 -0
  149. package/dist/utxo/btc/btc_chain.js +62 -0
  150. package/dist/utxo/btc/btc_chain.js.map +1 -0
  151. package/dist/utxo/btc/btc_chains.d.ts +25 -0
  152. package/dist/utxo/btc/btc_chains.d.ts.map +1 -0
  153. package/dist/utxo/btc/btc_chains.js +43 -0
  154. package/dist/utxo/btc/btc_chains.js.map +1 -0
  155. package/dist/utxo/btc/btc_token.d.ts +6 -0
  156. package/dist/utxo/btc/btc_token.d.ts.map +1 -0
  157. package/dist/utxo/btc/btc_token.js +11 -0
  158. package/dist/utxo/btc/btc_token.js.map +1 -0
  159. package/dist/utxo/btc/index.d.ts +14 -0
  160. package/dist/utxo/btc/index.d.ts.map +1 -0
  161. package/dist/utxo/btc/index.js +14 -0
  162. package/dist/utxo/btc/index.js.map +1 -0
  163. package/dist/utxo/btc/network_params.d.ts +50 -0
  164. package/dist/utxo/btc/network_params.d.ts.map +1 -0
  165. package/dist/utxo/btc/network_params.js +188 -0
  166. package/dist/utxo/btc/network_params.js.map +1 -0
  167. package/dist/utxo/btc/tools/asset_outpoint.d.ts +7 -0
  168. package/dist/utxo/btc/tools/asset_outpoint.d.ts.map +1 -0
  169. package/dist/utxo/btc/tools/asset_outpoint.js +12 -0
  170. package/dist/utxo/btc/tools/asset_outpoint.js.map +1 -0
  171. package/dist/utxo/btc/tools/bitcoin_core.tool.d.ts +41 -0
  172. package/dist/utxo/btc/tools/bitcoin_core.tool.d.ts.map +1 -0
  173. package/dist/utxo/btc/tools/bitcoin_core.tool.js +172 -0
  174. package/dist/utxo/btc/tools/bitcoin_core.tool.js.map +1 -0
  175. package/dist/utxo/btc/tools/esplora.tool.d.ts +27 -0
  176. package/dist/utxo/btc/tools/esplora.tool.d.ts.map +1 -0
  177. package/dist/utxo/btc/tools/esplora.tool.js +113 -0
  178. package/dist/utxo/btc/tools/esplora.tool.js.map +1 -0
  179. package/dist/utxo/btc/tools/inscription_index.d.ts +6 -0
  180. package/dist/utxo/btc/tools/inscription_index.d.ts.map +1 -0
  181. package/dist/utxo/btc/tools/inscription_index.js +2 -0
  182. package/dist/utxo/btc/tools/inscription_index.js.map +1 -0
  183. package/dist/utxo/btc/tools/ordiscan.tool.d.ts +19 -0
  184. package/dist/utxo/btc/tools/ordiscan.tool.d.ts.map +1 -0
  185. package/dist/utxo/btc/tools/ordiscan.tool.js +53 -0
  186. package/dist/utxo/btc/tools/ordiscan.tool.js.map +1 -0
  187. package/dist/utxo/btc/tools/rare_sat_index.d.ts +6 -0
  188. package/dist/utxo/btc/tools/rare_sat_index.d.ts.map +1 -0
  189. package/dist/utxo/btc/tools/rare_sat_index.js +2 -0
  190. package/dist/utxo/btc/tools/rare_sat_index.js.map +1 -0
  191. package/dist/utxo/btc/tools/rune_index.d.ts +6 -0
  192. package/dist/utxo/btc/tools/rune_index.d.ts.map +1 -0
  193. package/dist/utxo/btc/tools/rune_index.js +2 -0
  194. package/dist/utxo/btc/tools/rune_index.js.map +1 -0
  195. package/dist/utxo/btc/tools/unisat.tool.d.ts +18 -0
  196. package/dist/utxo/btc/tools/unisat.tool.d.ts.map +1 -0
  197. package/dist/utxo/btc/tools/unisat.tool.js +49 -0
  198. package/dist/utxo/btc/tools/unisat.tool.js.map +1 -0
  199. package/dist/utxo/coin_selection.d.ts +29 -0
  200. package/dist/utxo/coin_selection.d.ts.map +1 -0
  201. package/dist/utxo/coin_selection.js +156 -0
  202. package/dist/utxo/coin_selection.js.map +1 -0
  203. package/dist/utxo/doge/doge_chains.d.ts +17 -0
  204. package/dist/utxo/doge/doge_chains.d.ts.map +1 -0
  205. package/dist/utxo/doge/doge_chains.js +28 -0
  206. package/dist/utxo/doge/doge_chains.js.map +1 -0
  207. package/dist/utxo/doge/index.d.ts +3 -0
  208. package/dist/utxo/doge/index.d.ts.map +1 -0
  209. package/dist/utxo/doge/index.js +3 -0
  210. package/dist/utxo/doge/index.js.map +1 -0
  211. package/dist/utxo/doge/network_params.d.ts +4 -0
  212. package/dist/utxo/doge/network_params.d.ts.map +1 -0
  213. package/dist/utxo/doge/network_params.js +24 -0
  214. package/dist/utxo/doge/network_params.js.map +1 -0
  215. package/dist/utxo/ecc.d.ts +2 -0
  216. package/dist/utxo/ecc.d.ts.map +1 -0
  217. package/dist/utxo/ecc.js +11 -0
  218. package/dist/utxo/ecc.js.map +1 -0
  219. package/dist/utxo/fee.d.ts +12 -0
  220. package/dist/utxo/fee.d.ts.map +1 -0
  221. package/dist/utxo/fee.js +51 -0
  222. package/dist/utxo/fee.js.map +1 -0
  223. package/dist/utxo/index.d.ts +20 -0
  224. package/dist/utxo/index.d.ts.map +1 -0
  225. package/dist/utxo/index.js +20 -0
  226. package/dist/utxo/index.js.map +1 -0
  227. package/dist/utxo/ltc/index.d.ts +3 -0
  228. package/dist/utxo/ltc/index.d.ts.map +1 -0
  229. package/dist/utxo/ltc/index.js +3 -0
  230. package/dist/utxo/ltc/index.js.map +1 -0
  231. package/dist/utxo/ltc/ltc_chains.d.ts +17 -0
  232. package/dist/utxo/ltc/ltc_chains.d.ts.map +1 -0
  233. package/dist/utxo/ltc/ltc_chains.js +28 -0
  234. package/dist/utxo/ltc/ltc_chains.js.map +1 -0
  235. package/dist/utxo/ltc/network_params.d.ts +4 -0
  236. package/dist/utxo/ltc/network_params.d.ts.map +1 -0
  237. package/dist/utxo/ltc/network_params.js +27 -0
  238. package/dist/utxo/ltc/network_params.js.map +1 -0
  239. package/dist/utxo/script.d.ts +16 -0
  240. package/dist/utxo/script.d.ts.map +1 -0
  241. package/dist/utxo/script.js +52 -0
  242. package/dist/utxo/script.js.map +1 -0
  243. package/dist/utxo/tools/broadcaster.d.ts +6 -0
  244. package/dist/utxo/tools/broadcaster.d.ts.map +1 -0
  245. package/dist/utxo/tools/broadcaster.js +2 -0
  246. package/dist/utxo/tools/broadcaster.js.map +1 -0
  247. package/dist/utxo/tools/chain_tip_provider.d.ts +5 -0
  248. package/dist/utxo/tools/chain_tip_provider.d.ts.map +1 -0
  249. package/dist/utxo/tools/chain_tip_provider.js +2 -0
  250. package/dist/utxo/tools/chain_tip_provider.js.map +1 -0
  251. package/dist/utxo/tools/fee_estimator.d.ts +6 -0
  252. package/dist/utxo/tools/fee_estimator.d.ts.map +1 -0
  253. package/dist/utxo/tools/fee_estimator.js +2 -0
  254. package/dist/utxo/tools/fee_estimator.js.map +1 -0
  255. package/dist/utxo/tools/raw_transaction_provider.d.ts +8 -0
  256. package/dist/utxo/tools/raw_transaction_provider.d.ts.map +1 -0
  257. package/dist/utxo/tools/raw_transaction_provider.js +2 -0
  258. package/dist/utxo/tools/raw_transaction_provider.js.map +1 -0
  259. package/dist/utxo/tools/utxo_provider.d.ts +7 -0
  260. package/dist/utxo/tools/utxo_provider.d.ts.map +1 -0
  261. package/dist/utxo/tools/utxo_provider.js +2 -0
  262. package/dist/utxo/tools/utxo_provider.js.map +1 -0
  263. package/dist/utxo/unsigned_utxo_transaction.d.ts +32 -0
  264. package/dist/utxo/unsigned_utxo_transaction.d.ts.map +1 -0
  265. package/dist/utxo/unsigned_utxo_transaction.js +32 -0
  266. package/dist/utxo/unsigned_utxo_transaction.js.map +1 -0
  267. package/dist/utxo/utxo.d.ts +43 -0
  268. package/dist/utxo/utxo.d.ts.map +1 -0
  269. package/dist/utxo/utxo.js +2 -0
  270. package/dist/utxo/utxo.js.map +1 -0
  271. package/dist/utxo/utxo_chain.d.ts +102 -0
  272. package/dist/utxo/utxo_chain.d.ts.map +1 -0
  273. package/dist/utxo/utxo_chain.js +524 -0
  274. package/dist/utxo/utxo_chain.js.map +1 -0
  275. package/dist/utxo/utxo_chains.d.ts +29 -0
  276. package/dist/utxo/utxo_chains.d.ts.map +1 -0
  277. package/dist/utxo/utxo_chains.js +63 -0
  278. package/dist/utxo/utxo_chains.js.map +1 -0
  279. package/dist/utxo/utxo_gas_pricing.d.ts +22 -0
  280. package/dist/utxo/utxo_gas_pricing.d.ts.map +1 -0
  281. package/dist/utxo/utxo_gas_pricing.js +20 -0
  282. package/dist/utxo/utxo_gas_pricing.js.map +1 -0
  283. package/dist/utxo/utxo_network_params.d.ts +25 -0
  284. package/dist/utxo/utxo_network_params.d.ts.map +1 -0
  285. package/dist/utxo/utxo_network_params.js +15 -0
  286. package/dist/utxo/utxo_network_params.js.map +1 -0
  287. package/dist/utxo/utxo_transaction_status.d.ts +73 -0
  288. package/dist/utxo/utxo_transaction_status.d.ts.map +1 -0
  289. package/dist/utxo/utxo_transaction_status.js +89 -0
  290. package/dist/utxo/utxo_transaction_status.js.map +1 -0
  291. package/docs/PUBLISHING.md +119 -0
  292. package/docs/README.md +273 -0
  293. package/docs/evm.md +205 -0
  294. package/docs/solana.md +220 -0
  295. package/docs/utxo.md +364 -0
  296. package/package.json +94 -0
@@ -0,0 +1,45 @@
1
+ export type EvmGasEstimateKind = 'legacy' | 'eip1559';
2
+ export interface EvmLegacyGasEstimateInit {
3
+ kind: 'legacy';
4
+ units?: bigint;
5
+ gasPrice: bigint;
6
+ }
7
+ export interface EvmEip1559GasEstimateInit {
8
+ kind: 'eip1559';
9
+ units?: bigint;
10
+ maxFeePerGas: bigint;
11
+ maxPriorityFeePerGas: bigint;
12
+ }
13
+ export type EvmGasEstimateInit = EvmLegacyGasEstimateInit | EvmEip1559GasEstimateInit;
14
+ /**
15
+ * Discriminated `EvmGasEstimate` — the `kind` field tells consumers which fee
16
+ * fields are populated. Iter-15 medium #4 fix: without the discriminant the
17
+ * legacy path returned `{gasPrice}` only and 1559 returned
18
+ * `{maxFeePerGas, maxPriorityFeePerGas}` only, but the type made both
19
+ * shapes look interchangeable. Consumers touching an undefined field on
20
+ * the wrong branch got runtime `undefined` with a non-null assertion
21
+ * silencing the type system.
22
+ *
23
+ * Type-guards: `isLegacyGasEstimate(g)` and `isEip1559GasEstimate(g)`
24
+ * narrow the estimate to its concrete shape at the call site.
25
+ */
26
+ export declare class EvmGasEstimate {
27
+ readonly kind: EvmGasEstimateKind;
28
+ readonly units: bigint | undefined;
29
+ readonly gasPrice: bigint | undefined;
30
+ readonly maxFeePerGas: bigint | undefined;
31
+ readonly maxPriorityFeePerGas: bigint | undefined;
32
+ constructor(init: EvmGasEstimateInit);
33
+ effectiveGasPrice(): bigint;
34
+ nativeCost(): bigint | undefined;
35
+ }
36
+ export declare function isLegacyGasEstimate(g: EvmGasEstimate): g is EvmGasEstimate & {
37
+ kind: 'legacy';
38
+ gasPrice: bigint;
39
+ };
40
+ export declare function isEip1559GasEstimate(g: EvmGasEstimate): g is EvmGasEstimate & {
41
+ kind: 'eip1559';
42
+ maxFeePerGas: bigint;
43
+ maxPriorityFeePerGas: bigint;
44
+ };
45
+ //# sourceMappingURL=evm_gas_estimate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm_gas_estimate.d.ts","sourceRoot":"","sources":["../../evm/evm_gas_estimate.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,yBAAyB,CAAC;AAEtF;;;;;;;;;;;GAWG;AACH,qBAAa,cAAc;IACzB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEtC,IAAI,EAAE,kBAAkB;IAqCpC,iBAAiB,IAAI,MAAM;IAY3B,UAAU,IAAI,MAAM,GAAG,SAAS;CAIjC;AAED,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,cAAc,GAChB,CAAC,IAAI,cAAc,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAE5D;AAED,wBAAgB,oBAAoB,CAClC,CAAC,EAAE,cAAc,GAChB,CAAC,IAAI,cAAc,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,oBAAoB,EAAE,MAAM,CAAA;CAAE,CAE/F"}
@@ -0,0 +1,70 @@
1
+ import { ChainError, ChainErrorKinds } from "../errors.js";
2
+ /**
3
+ * Discriminated `EvmGasEstimate` — the `kind` field tells consumers which fee
4
+ * fields are populated. Iter-15 medium #4 fix: without the discriminant the
5
+ * legacy path returned `{gasPrice}` only and 1559 returned
6
+ * `{maxFeePerGas, maxPriorityFeePerGas}` only, but the type made both
7
+ * shapes look interchangeable. Consumers touching an undefined field on
8
+ * the wrong branch got runtime `undefined` with a non-null assertion
9
+ * silencing the type system.
10
+ *
11
+ * Type-guards: `isLegacyGasEstimate(g)` and `isEip1559GasEstimate(g)`
12
+ * narrow the estimate to its concrete shape at the call site.
13
+ */
14
+ export class EvmGasEstimate {
15
+ kind;
16
+ units;
17
+ gasPrice;
18
+ maxFeePerGas;
19
+ maxPriorityFeePerGas;
20
+ constructor(init) {
21
+ this.kind = init.kind;
22
+ this.units = init.units;
23
+ if (init.kind === 'legacy') {
24
+ // Accept 0 for subsidised chains / devnets that report a zero
25
+ // gas price. EvmChain.suggestGas feeds node-reported values in
26
+ // directly; throwing here would turn a read-only estimate into
27
+ // an exception on any zero-fee network. Symmetric with
28
+ // EvmTransactionGasFees, which accepts 0 for the same fields.
29
+ if (init.gasPrice < 0n) {
30
+ throw new ChainError(ChainErrorKinds.InvalidArgument, `EvmGasEstimate(legacy).gasPrice must be >= 0, got ${init.gasPrice}`);
31
+ }
32
+ this.gasPrice = init.gasPrice;
33
+ this.maxFeePerGas = undefined;
34
+ this.maxPriorityFeePerGas = undefined;
35
+ }
36
+ else {
37
+ if (init.maxFeePerGas < 0n) {
38
+ throw new ChainError(ChainErrorKinds.InvalidArgument, `EvmGasEstimate(eip1559).maxFeePerGas must be >= 0, got ${init.maxFeePerGas}`);
39
+ }
40
+ if (init.maxPriorityFeePerGas < 0n) {
41
+ throw new ChainError(ChainErrorKinds.InvalidArgument, `EvmGasEstimate(eip1559).maxPriorityFeePerGas must be >= 0, got ${init.maxPriorityFeePerGas}`);
42
+ }
43
+ this.gasPrice = undefined;
44
+ this.maxFeePerGas = init.maxFeePerGas;
45
+ this.maxPriorityFeePerGas = init.maxPriorityFeePerGas;
46
+ }
47
+ }
48
+ effectiveGasPrice() {
49
+ // Discriminant narrowing — no cast needed. The constructor sets exactly
50
+ // one side of the shape based on `kind`, and the >= 0 validators
51
+ // guarantee both are bigints (never undefined) within their branch.
52
+ if (isLegacyGasEstimate(this))
53
+ return this.gasPrice;
54
+ if (isEip1559GasEstimate(this))
55
+ return this.maxFeePerGas;
56
+ throw new ChainError(ChainErrorKinds.InvalidArgument, `EvmGasEstimate: unknown kind '${String(this.kind)}'`);
57
+ }
58
+ nativeCost() {
59
+ if (this.units === undefined)
60
+ return undefined;
61
+ return this.units * this.effectiveGasPrice();
62
+ }
63
+ }
64
+ export function isLegacyGasEstimate(g) {
65
+ return g.kind === 'legacy';
66
+ }
67
+ export function isEip1559GasEstimate(g) {
68
+ return g.kind === 'eip1559';
69
+ }
70
+ //# sourceMappingURL=evm_gas_estimate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm_gas_estimate.js","sourceRoot":"","sources":["../../evm/evm_gas_estimate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAmB3D;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,cAAc;IAChB,IAAI,CAAqB;IACzB,KAAK,CAAqB;IAC1B,QAAQ,CAAqB;IAC7B,YAAY,CAAqB;IACjC,oBAAoB,CAAqB;IAElD,YAAY,IAAwB;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EA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B,CAAC,IAAI,CAAC,GAAG,CAC5E,CAAC;IACJ,CAAC;IAED,UAAU;QACR,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC/C,OAAO,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC/C,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CACjC,CAAiB;IAEjB,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,CAAiB;IAEjB,OAAO,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { AbstractGasPricing } from '../abstract_gas_pricing.ts';
2
+ import { NetworkType } from '../network_type.ts';
3
+ export interface EvmLegacyGasPricingInit {
4
+ kind: 'legacy';
5
+ gasPrice: bigint;
6
+ }
7
+ export interface EvmEip1559GasPricingInit {
8
+ kind: 'eip1559';
9
+ maxFeePerGas: bigint;
10
+ maxPriorityFeePerGas: bigint;
11
+ }
12
+ export type EvmGasPricingInit = EvmLegacyGasPricingInit | EvmEip1559GasPricingInit;
13
+ /**
14
+ * EVM explicit-fee override — mirrors Python's `EvmGasPricing` at
15
+ * `impl/evm/base.py`. Discriminated by `kind` for the same reason
16
+ * `EvmGasEstimate` is: consumers reading `.gasPrice` on a 1559 pricing
17
+ * would otherwise silently get `undefined`.
18
+ *
19
+ * Legacy pricing populates `gasPrice`; EIP-1559 pricing populates
20
+ * `maxFeePerGas` + `maxPriorityFeePerGas`. Cross-branch reads are
21
+ * `undefined`.
22
+ */
23
+ export declare class EvmGasPricing extends AbstractGasPricing {
24
+ readonly networkType = NetworkType.EVM;
25
+ readonly kind: 'legacy' | 'eip1559';
26
+ readonly gasPrice: bigint | undefined;
27
+ readonly maxFeePerGas: bigint | undefined;
28
+ readonly maxPriorityFeePerGas: bigint | undefined;
29
+ constructor(init: EvmGasPricingInit);
30
+ }
31
+ export declare function isLegacyGasPricing(p: EvmGasPricing): p is EvmGasPricing & {
32
+ kind: 'legacy';
33
+ gasPrice: bigint;
34
+ };
35
+ export declare function isEip1559GasPricing(p: EvmGasPricing): p is EvmGasPricing & {
36
+ kind: 'eip1559';
37
+ maxFeePerGas: bigint;
38
+ maxPriorityFeePerGas: bigint;
39
+ };
40
+ //# sourceMappingURL=evm_gas_pricing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm_gas_pricing.d.ts","sourceRoot":"","sources":["../../evm/evm_gas_pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,wBAAwB,CAAC;AAEnF;;;;;;;;;GASG;AACH,qBAAa,aAAc,SAAQ,kBAAkB;IACnD,QAAQ,CAAC,WAAW,mBAAmB;IACvC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEtC,IAAI,EAAE,iBAAiB;CAwCpC;AAED,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,aAAa,GACf,CAAC,IAAI,aAAa,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAE3D;AAED,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,aAAa,GACf,CAAC,IAAI,aAAa,GAAG;IACtB,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAEA"}
@@ -0,0 +1,56 @@
1
+ import { AbstractGasPricing } from "../abstract_gas_pricing.js";
2
+ import { ChainError, ChainErrorKinds } from "../errors.js";
3
+ import { NetworkType } from "../network_type.js";
4
+ /**
5
+ * EVM explicit-fee override — mirrors Python's `EvmGasPricing` at
6
+ * `impl/evm/base.py`. Discriminated by `kind` for the same reason
7
+ * `EvmGasEstimate` is: consumers reading `.gasPrice` on a 1559 pricing
8
+ * would otherwise silently get `undefined`.
9
+ *
10
+ * Legacy pricing populates `gasPrice`; EIP-1559 pricing populates
11
+ * `maxFeePerGas` + `maxPriorityFeePerGas`. Cross-branch reads are
12
+ * `undefined`.
13
+ */
14
+ export class EvmGasPricing extends AbstractGasPricing {
15
+ networkType = NetworkType.EVM;
16
+ kind;
17
+ gasPrice;
18
+ maxFeePerGas;
19
+ maxPriorityFeePerGas;
20
+ constructor(init) {
21
+ super();
22
+ this.kind = init.kind;
23
+ if (init.kind === 'legacy') {
24
+ if (init.gasPrice < 0n) {
25
+ throw new ChainError(ChainErrorKinds.InvalidArgument, `EvmGasPricing(legacy).gasPrice must be >= 0, got ${init.gasPrice}`);
26
+ }
27
+ this.gasPrice = init.gasPrice;
28
+ this.maxFeePerGas = undefined;
29
+ this.maxPriorityFeePerGas = undefined;
30
+ }
31
+ else {
32
+ if (init.maxFeePerGas < 0n) {
33
+ throw new ChainError(ChainErrorKinds.InvalidArgument, `EvmGasPricing(eip1559).maxFeePerGas must be >= 0, got ${init.maxFeePerGas}`);
34
+ }
35
+ if (init.maxPriorityFeePerGas < 0n) {
36
+ throw new ChainError(ChainErrorKinds.InvalidArgument, `EvmGasPricing(eip1559).maxPriorityFeePerGas must be >= 0, got ${init.maxPriorityFeePerGas}`);
37
+ }
38
+ // EIP-1559 invariant: maxPriorityFeePerGas must be <= maxFeePerGas.
39
+ // Every execution client enforces this at admission (a tx that
40
+ // violates it can never be mined). Fail loud at construction.
41
+ if (init.maxPriorityFeePerGas > init.maxFeePerGas) {
42
+ throw new ChainError(ChainErrorKinds.InvalidArgument, `EvmGasPricing(eip1559): maxPriorityFeePerGas (${init.maxPriorityFeePerGas}) must be <= maxFeePerGas (${init.maxFeePerGas}) per EIP-1559`);
43
+ }
44
+ this.gasPrice = undefined;
45
+ this.maxFeePerGas = init.maxFeePerGas;
46
+ this.maxPriorityFeePerGas = init.maxPriorityFeePerGas;
47
+ }
48
+ }
49
+ }
50
+ export function isLegacyGasPricing(p) {
51
+ return p.kind === 'legacy';
52
+ }
53
+ export function isEip1559GasPricing(p) {
54
+ return p.kind === 'eip1559';
55
+ }
56
+ //# sourceMappingURL=evm_gas_pricing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm_gas_pricing.js","sourceRoot":"","sources":["../../evm/evm_gas_pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAejD;;;;;;;;;GASG;AACH,MAAM,OAAO,aAAc,SAAQ,kBAAkB;IAC1C,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC;IAC9B,IAAI,CAAuB;IAC3B,QAAQ,CAAqB;IAC7B,YAAY,CAAqB;IACjC,oBAAoB,CAAqB;IAElD,YAAY,IAAuB;QACjC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,IAAI,IAAI,CAAC,QAAQ,GAAG,EAA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O,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Token } from '../token.ts';
2
+ export declare class EvmToken extends Token {
3
+ constructor(chainId: number, symbol: string, identifier: string | undefined, decimals: number);
4
+ static native(chainId: number, symbol: string, decimals?: number): EvmToken;
5
+ static erc20(chainId: number, symbol: string, contractAddress: string, decimals: number): EvmToken;
6
+ }
7
+ //# sourceMappingURL=evm_token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm_token.d.ts","sourceRoot":"","sources":["../../evm/evm_token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,qBAAa,QAAS,SAAQ,KAAK;gBAE/B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM;IAalB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAK,GAAG,QAAQ;IAIvE,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ;CAGnG"}
@@ -0,0 +1,22 @@
1
+ import { Token } from "../token.js";
2
+ import { EvmAddress } from "./evm_address.js";
3
+ export class EvmToken extends Token {
4
+ constructor(chainId, symbol, identifier, decimals) {
5
+ // Normalize identifier to EIP-55 checksum form so `sameAsset` /
6
+ // `strictEquals` / any Map<Token>-keyed logic sees the same key
7
+ // regardless of whether the consumer passed lowercase, uppercase,
8
+ // or mixed-case. Without this, a consumer building
9
+ // `new EvmToken(1, 'USDT', '0xdac1…' lowercase, 6)` would not compare
10
+ // equal to `ETHEREUM_USDT` and `requiresZeroResetApproval` would
11
+ // return false — silently reverting a USDT approve.
12
+ const normalized = identifier !== undefined ? new EvmAddress(identifier).toChecksum() : undefined;
13
+ super(chainId, symbol, normalized, decimals);
14
+ }
15
+ static native(chainId, symbol, decimals = 18) {
16
+ return new EvmToken(chainId, symbol, undefined, decimals);
17
+ }
18
+ static erc20(chainId, symbol, contractAddress, decimals) {
19
+ return new EvmToken(chainId, symbol, contractAddress, decimals);
20
+ }
21
+ }
22
+ //# sourceMappingURL=evm_token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm_token.js","sourceRoot":"","sources":["../../evm/evm_token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,YACE,OAAe,EACf,MAAc,EACd,UAA8B,EAC9B,QAAgB;QAEhB,gEAAgE;QAChE,gEAAgE;QAChE,kEAAkE;QAClE,mDAAmD;QACnD,sEAAsE;QACtE,iEAAiE;QACjE,oDAAoD;QACpD,MAAM,UAAU,GAAG,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAClG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,OAAe,EAAE,MAAc,EAAE,QAAQ,GAAG,EAAE;QAC1D,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAe,EAAE,MAAc,EAAE,eAAuB,EAAE,QAAgB;QACrF,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;CACF"}
@@ -0,0 +1,81 @@
1
+ import { EvmToken } from './evm_token.ts';
2
+ /**
3
+ * Pre-baked EvmToken instances. Mirrors
4
+ * omnichain-py/src/omnichain/impl/evm/assets.py — token-for-token.
5
+ * Each entry cites the Sinan source line.
6
+ */
7
+ export declare const ETHEREUM_ETH: EvmToken;
8
+ export declare const ETHEREUM_USDC: EvmToken;
9
+ export declare const ETHEREUM_USDT: EvmToken;
10
+ export declare const ETHEREUM_WETH: EvmToken;
11
+ export declare const ETHEREUM_EURC: EvmToken;
12
+ export declare const ETHEREUM_WBTC: EvmToken;
13
+ export declare const SEPOLIA_TESTNET_ETH: EvmToken;
14
+ export declare const SEPOLIA_TESTNET_USDC: EvmToken;
15
+ export declare const SEPOLIA_TESTNET_EURC: EvmToken;
16
+ export declare const OPTIMISM_ETH: EvmToken;
17
+ export declare const OPTIMISM_USDC: EvmToken;
18
+ export declare const ARBITRUM_ETH: EvmToken;
19
+ export declare const ARBITRUM_USDC: EvmToken;
20
+ export declare const ARBITRUM_USDT: EvmToken;
21
+ export declare const ARBITRUM_WBTC: EvmToken;
22
+ export declare const BNB_BNB: EvmToken;
23
+ export declare const BNB_USDC: EvmToken;
24
+ export declare const BNB_USDT: EvmToken;
25
+ export declare const BASE_ETH: EvmToken;
26
+ export declare const BASE_USDC: EvmToken;
27
+ export declare const BASE_EURC: EvmToken;
28
+ export declare const POLYGON_POL: EvmToken;
29
+ export declare const POLYGON_USDC: EvmToken;
30
+ export declare const AVALANCHE_AVAX: EvmToken;
31
+ export declare const AVALANCHE_USDC: EvmToken;
32
+ export declare const AVALANCHE_EURC: EvmToken;
33
+ export declare const SONIC_S: EvmToken;
34
+ export declare const SONIC_USDC: EvmToken;
35
+ export declare const LINEA_ETH: EvmToken;
36
+ export declare const LINEA_USDC: EvmToken;
37
+ export declare const BLAST_ETH: EvmToken;
38
+ export declare const BOBA_ETH: EvmToken;
39
+ export declare const ZKSYNC_ETH: EvmToken;
40
+ export declare const WORLDCHAIN_ETH: EvmToken;
41
+ export declare const WORLDCHAIN_USDC: EvmToken;
42
+ export declare const WORLDCHAIN_EURC: EvmToken;
43
+ export declare const WANCHAIN_WAN: EvmToken;
44
+ export declare const STABLE_USDT0: EvmToken;
45
+ export declare const HYPEREVM_HYPER: EvmToken;
46
+ export declare const HYPEREVM_USDC: EvmToken;
47
+ export declare const CELO_CELO: EvmToken;
48
+ export declare const CELO_USDC: EvmToken;
49
+ export declare const SCROLL_ETH: EvmToken;
50
+ export declare const CRONOS_CRO: EvmToken;
51
+ export declare const ZORA_ETH: EvmToken;
52
+ export declare const METIS_METIS: EvmToken;
53
+ export declare const MODE_ETH: EvmToken;
54
+ export declare const TAIKO_ETH: EvmToken;
55
+ export declare const MONAD_MON: EvmToken;
56
+ export declare const MONAD_USDC: EvmToken;
57
+ export declare const MEGAETH_ETH: EvmToken;
58
+ export declare const SEI_SEI: EvmToken;
59
+ export declare const SEI_USDC: EvmToken;
60
+ export declare const CELO_SEPOLIA_CELO: EvmToken;
61
+ export declare const MOONBEAM_GLMR: EvmToken;
62
+ /**
63
+ * ERC-20 assets that require zero-then-approve for a fresh allowance
64
+ * (USDT-on-Ethereum being the canonical example).
65
+ *
66
+ * Mirrors omnichain-py/impl/evm/assets.py:139
67
+ * (`EVM_ASSETS_REQUIRING_ZERO_RESET_APPROVAL`).
68
+ *
69
+ * Declarative list only — the SDK does not enforce an approval layer
70
+ * (Wallet/approvals architecture deferred to a follow-up). Consumer
71
+ * approval logic uses the `requiresZeroResetApproval(token)` predicate
72
+ * below.
73
+ */
74
+ export declare const EVM_ASSETS_REQUIRING_ZERO_RESET_APPROVAL: ReadonlyArray<EvmToken>;
75
+ /**
76
+ * Membership check using identifier-based equality (`Token.sameAsset`) rather
77
+ * than reference identity — so a caller who constructs their own USDT-Ethereum
78
+ * `EvmToken` instance still gets `true`.
79
+ */
80
+ export declare function requiresZeroResetApproval(token: EvmToken): boolean;
81
+ //# sourceMappingURL=evm_tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm_tokens.d.ts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ba, Celo, CeloSepoliaTestnet, Cronos, Ethereum, EthereumSepoliaTestnet, HyperEVM, Linea, MegaETH, Metis, Mode, Monad, MoonBeam, Optimism, Polygon, Scroll, Sei, Sonic, Stable, Taiko, WanChain, WorldChain, ZKSync, Zora, } from "./evm_chains.js";
2
+ /**
3
+ * Pre-baked EvmToken instances. Mirrors
4
+ * omnichain-py/src/omnichain/impl/evm/assets.py — token-for-token.
5
+ * Each entry cites the Sinan source line.
6
+ */
7
+ // assets.py:6-21 — Ethereum
8
+ export const ETHEREUM_ETH = Ethereum.nativeToken;
9
+ export const ETHEREUM_USDC = Ethereum.getErc20Token('USDC', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', 6);
10
+ export const ETHEREUM_USDT = Ethereum.getErc20Token('USDT', '0xdac17f958d2ee523a2206206994597c13d831ec7', 6);
11
+ export const ETHEREUM_WETH = Ethereum.getErc20Token('WETH', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', 18);
12
+ export const ETHEREUM_EURC = Ethereum.getErc20Token('EURC', '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c', 6);
13
+ export const ETHEREUM_WBTC = Ethereum.getErc20Token('WBTC', '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', 8);
14
+ // assets.py:23-29 — Sepolia testnet
15
+ export const SEPOLIA_TESTNET_ETH = EthereumSepoliaTestnet.nativeToken;
16
+ export const SEPOLIA_TESTNET_USDC = EthereumSepoliaTestnet.getErc20Token('USDC', '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238', 6);
17
+ export const SEPOLIA_TESTNET_EURC = EthereumSepoliaTestnet.getErc20Token('EURC', '0x08210f9170f89ab7658f0b5e3ff39b0e03c594d4', 6);
18
+ // assets.py:31-34 — Optimism
19
+ export const OPTIMISM_ETH = Optimism.nativeToken;
20
+ export const OPTIMISM_USDC = Optimism.getErc20Token('USDC', '0x0b2c639c533813f4aa9d7837caf62653d097ff85', 6);
21
+ // assets.py:36-45 — Arbitrum. Symbol "USD₮0" mirrors Python's on-chain symbol.
22
+ export const ARBITRUM_ETH = Arbitrum.nativeToken;
23
+ export const ARBITRUM_USDC = Arbitrum.getErc20Token('USDC', '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', 6);
24
+ export const ARBITRUM_USDT = Arbitrum.getErc20Token('USD₮0', '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9', 6);
25
+ export const ARBITRUM_WBTC = Arbitrum.getErc20Token('WBTC', '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f', 8);
26
+ // assets.py:47-53 — BNB
27
+ export const BNB_BNB = BnbChain.nativeToken;
28
+ export const BNB_USDC = BnbChain.getErc20Token('USDC', '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', 18);
29
+ export const BNB_USDT = BnbChain.getErc20Token('USDT', '0x55d398326f99059fF775485246999027B3197955', 18);
30
+ // assets.py:55-61 — Base
31
+ export const BASE_ETH = Base.nativeToken;
32
+ export const BASE_USDC = Base.getErc20Token('USDC', '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', 6);
33
+ export const BASE_EURC = Base.getErc20Token('EURC', '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42', 6);
34
+ // assets.py:63-66 — Polygon
35
+ export const POLYGON_POL = Polygon.nativeToken;
36
+ export const POLYGON_USDC = Polygon.getErc20Token('USDC', '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359', 6);
37
+ // assets.py:68-74 — Avalanche
38
+ export const AVALANCHE_AVAX = Avalanche.nativeToken;
39
+ export const AVALANCHE_USDC = Avalanche.getErc20Token('USDC', '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', 6);
40
+ export const AVALANCHE_EURC = Avalanche.getErc20Token('EURC', '0xc891eb4cbdeff6e073e859e987815ed1505c2acd', 6);
41
+ // assets.py:76-79 — Sonic
42
+ export const SONIC_S = Sonic.nativeToken;
43
+ export const SONIC_USDC = Sonic.getErc20Token('USDC', '0x29219dd400f2bf60e5a23d13be72b486d4038894', 6);
44
+ // assets.py:81-84 — Linea
45
+ export const LINEA_ETH = Linea.nativeToken;
46
+ export const LINEA_USDC = Linea.getErc20Token('USDC', '0x176211869cA2b568f2A7D4EE941E073a821EE1ff', 6);
47
+ // assets.py:86-96 — Blast / Boba / ZKSync / WorldChain
48
+ export const BLAST_ETH = Blast.nativeToken;
49
+ export const BOBA_ETH = Boba.nativeToken;
50
+ export const ZKSYNC_ETH = ZKSync.nativeToken;
51
+ export const WORLDCHAIN_ETH = WorldChain.nativeToken;
52
+ // USDC uses lowercase to bypass EIP-55 mixed-case validation — Python
53
+ // assets.py:94 mis-cases this literal; TS EvmAddress rejects mis-checksummed
54
+ // mixed-case at import time. EURC's Python literal is already valid EIP-55.
55
+ export const WORLDCHAIN_USDC = WorldChain.getErc20Token('USDC', '0x79a02482a880bce3f13e09da970dc34db4cd24d1', 6);
56
+ export const WORLDCHAIN_EURC = WorldChain.getErc20Token('EURC', '0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B', 6);
57
+ // assets.py:100-107 — Wan / Stable / HyperEVM
58
+ export const WANCHAIN_WAN = WanChain.nativeToken;
59
+ export const STABLE_USDT0 = Stable.nativeToken;
60
+ export const HYPEREVM_HYPER = HyperEVM.nativeToken;
61
+ export const HYPEREVM_USDC = HyperEVM.getErc20Token('USDC', '0xb88339CB7199b77E23DB6E890353E22632Ba630f', 6);
62
+ // assets.py:109-112 — Celo
63
+ export const CELO_CELO = Celo.nativeToken;
64
+ export const CELO_USDC = Celo.getErc20Token('USDC', '0xcebA9300f2b948710d2653dD7B07f33A8B32118C', 6);
65
+ // assets.py:114-125 — Scroll / Cronos / Zora / Metis / Mode / Taiko
66
+ export const SCROLL_ETH = Scroll.nativeToken;
67
+ export const CRONOS_CRO = Cronos.nativeToken;
68
+ export const ZORA_ETH = Zora.nativeToken;
69
+ export const METIS_METIS = Metis.nativeToken;
70
+ export const MODE_ETH = Mode.nativeToken;
71
+ export const TAIKO_ETH = Taiko.nativeToken;
72
+ // assets.py:126-129 — Monad
73
+ export const MONAD_MON = Monad.nativeToken;
74
+ export const MONAD_USDC = Monad.getErc20Token('USDC', '0x754704Bc059F8C67012fEd69BC8A327a5aafb603', 6);
75
+ // assets.py:131 — MegaETH
76
+ export const MEGAETH_ETH = MegaETH.nativeToken;
77
+ // assets.py:133-136 — Sei
78
+ export const SEI_SEI = Sei.nativeToken;
79
+ export const SEI_USDC = Sei.getErc20Token('USDC', '0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392', 6);
80
+ // Not in Python assets.py — native-only convenience for consumers.
81
+ export const CELO_SEPOLIA_CELO = CeloSepoliaTestnet.nativeToken;
82
+ export const MOONBEAM_GLMR = MoonBeam.nativeToken;
83
+ /**
84
+ * ERC-20 assets that require zero-then-approve for a fresh allowance
85
+ * (USDT-on-Ethereum being the canonical example).
86
+ *
87
+ * Mirrors omnichain-py/impl/evm/assets.py:139
88
+ * (`EVM_ASSETS_REQUIRING_ZERO_RESET_APPROVAL`).
89
+ *
90
+ * Declarative list only — the SDK does not enforce an approval layer
91
+ * (Wallet/approvals architecture deferred to a follow-up). Consumer
92
+ * approval logic uses the `requiresZeroResetApproval(token)` predicate
93
+ * below.
94
+ */
95
+ export const EVM_ASSETS_REQUIRING_ZERO_RESET_APPROVAL = [ETHEREUM_USDT];
96
+ /**
97
+ * Membership check using identifier-based equality (`Token.sameAsset`) rather
98
+ * than reference identity — so a caller who constructs their own USDT-Ethereum
99
+ * `EvmToken` instance still gets `true`.
100
+ */
101
+ export function requiresZeroResetApproval(token) {
102
+ return EVM_ASSETS_REQUIRING_ZERO_RESET_APPROVAL.some((a) => a.sameAsset(token));
103
+ }
104
+ //# sourceMappingURL=evm_tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm_tokens.js","sourceRoot":"","sources":["../../evm/evm_tokens.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,KAAK,EACL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G,GAAG,CAAC,WAAW,CAAC;AACvC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE,4CAA4C,EAAE,CAAC,CAAC,CAAC;AAEnG,mEAAmE;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,WAAW,CAAC;AAChE,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,WAAW,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAA4B,CAAC,aAAa,CAAC,CAAC;AAEjG;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAe;IACvD,OAAO,wCAAwC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AAClF,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { NestedBalanceChanges, TransactionErrorInfo, TransactionStatus, TransactionStatusType } from '../transaction_status.ts';
2
+ export interface EvmTransactionGasFeesInit {
3
+ /**
4
+ * The sender-set gas limit (`tx.gasLimit`). Nullable because the tx body
5
+ * may be unavailable (pruned node, receipt-only fetch); passing
6
+ * `gasLimitUsed` here as a fallback would fabricate a "100% utilization"
7
+ * that consumers can't distinguish from a real observation.
8
+ */
9
+ gasLimit: bigint | null;
10
+ gasLimitUsed: bigint;
11
+ effectiveGasPrice: bigint;
12
+ gasPrice?: bigint;
13
+ maxFeePerGas?: bigint;
14
+ maxPriorityFeePerGas?: bigint;
15
+ /**
16
+ * OP-stack L1 data fee (wei) — present on Optimism / Base / Unichain /
17
+ * WorldChain / Boba / Sonic and other L2s that publish tx data to L1.
18
+ * Omitted on L1 chains. Included in the sender's native debit computed
19
+ * by `decodeBalanceChanges` when populated.
20
+ */
21
+ l1FeeWei?: bigint;
22
+ }
23
+ export declare class EvmTransactionGasFees {
24
+ readonly gasLimit: bigint | null;
25
+ readonly gasLimitUsed: bigint;
26
+ readonly effectiveGasPrice: bigint;
27
+ readonly gasPrice: bigint | undefined;
28
+ readonly maxFeePerGas: bigint | undefined;
29
+ readonly maxPriorityFeePerGas: bigint | undefined;
30
+ readonly l1FeeWei: bigint | undefined;
31
+ constructor(init: EvmTransactionGasFeesInit);
32
+ /** L2 execution gas only. Does NOT include OP-stack `l1FeeWei`. */
33
+ get totalGasInWei(): bigint;
34
+ /** Full sender native debit: L2 gas + OP-stack L1 data fee (when present). */
35
+ get totalNativeDebitWei(): bigint;
36
+ }
37
+ /**
38
+ * Canonical ERC-20 `Transfer(address indexed from, address indexed to,
39
+ * uint256 value)` topic0 — keccak256("Transfer(address,address,uint256)").
40
+ */
41
+ export declare const ERC20_TRANSFER_TOPIC = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef";
42
+ export interface EvmErc20TransferLog {
43
+ tokenContract: string;
44
+ fromAddress: string;
45
+ toAddress: string;
46
+ value: bigint;
47
+ }
48
+ /**
49
+ * Event log entry surfaced on a receipt. `isTransferLog()` / `asTransferLog()`
50
+ * mirror Python's `EvmParsedTransactionLog` API (`impl/evm/base.py:1551+`).
51
+ *
52
+ * The `evm_chain.ts` receipt-decoder shares the `ERC20_TRANSFER_TOPIC`
53
+ * topic0 constant with this class but runs its own **lenient** parse
54
+ * (skips non-standard logs) for the `NestedBalanceChanges` construction.
55
+ * This class's `asTransferLog()` is **strict** (throws on wrong length /
56
+ * bad hex). Rewiring the decoder to consume the strict accessor requires
57
+ * a policy decision on whether non-standard logs should silently drop
58
+ * or surface as `TransactionDecodeFailed`, and is deferred to a
59
+ * follow-up card. Consumers doing their own log extraction should
60
+ * either use the guard/accessor pair with a `try/catch` per log or
61
+ * wait for a `tryAsTransferLog()` variant to land.
62
+ */
63
+ export declare class EvmParsedTransactionLog {
64
+ readonly address: string;
65
+ readonly topics: readonly string[];
66
+ readonly data: string;
67
+ constructor(address: string, topics: readonly string[], data: string);
68
+ isTransferLog(): boolean;
69
+ /**
70
+ * Decode this log as an ERC-20 Transfer. Throws
71
+ * `ChainError(InvalidArgument)` if the log doesn't match the topic0
72
+ * / topic-count shape, or `ChainError(TransactionDecodeFailed)` if
73
+ * `data` isn't parseable as a `uint256`. Addresses are returned
74
+ * lowercased (matches the `balanceChanges` wallet-key convention;
75
+ * consumers who need EIP-55 should checksum via `EvmAddress`).
76
+ */
77
+ asTransferLog(): EvmErc20TransferLog;
78
+ }
79
+ export interface EvmTransactionStatusInit {
80
+ chainId: number;
81
+ status: TransactionStatusType;
82
+ inclusionAt?: Date | null;
83
+ error?: TransactionErrorInfo | null;
84
+ balanceChanges?: NestedBalanceChanges | null;
85
+ logs?: readonly EvmParsedTransactionLog[] | null;
86
+ fees?: EvmTransactionGasFees | null;
87
+ }
88
+ export declare class EvmTransactionStatus extends TransactionStatus {
89
+ readonly logs: readonly EvmParsedTransactionLog[] | null;
90
+ readonly fees: EvmTransactionGasFees | null;
91
+ constructor(init: EvmTransactionStatusInit);
92
+ static successful(args: {
93
+ chainId: number;
94
+ inclusionAt: Date | null;
95
+ balanceChanges: NestedBalanceChanges;
96
+ logs: readonly EvmParsedTransactionLog[];
97
+ fees: EvmTransactionGasFees;
98
+ }): EvmTransactionStatus;
99
+ static failed(args: {
100
+ chainId: number;
101
+ inclusionAt: Date | null;
102
+ error: TransactionErrorInfo;
103
+ fees: EvmTransactionGasFees;
104
+ }): EvmTransactionStatus;
105
+ static pending(chainId: number): EvmTransactionStatus;
106
+ static notFound(chainId: number, error: TransactionErrorInfo | null): EvmTransactionStatus;
107
+ }
108
+ //# sourceMappingURL=evm_transaction_status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm_transaction_status.d.ts","sourceRoot":"","sources":["../../evm/evm_transaction_status.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG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