@gardenfi/orderbook 0.2.0-beta.13 → 0.2.0-beta.14

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 (142) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +15 -15
  3. package/dist/index3.cjs +1 -1
  4. package/dist/index3.js +9 -24
  5. package/dist/index4.cjs +1 -1
  6. package/dist/index4.js +1 -1
  7. package/dist/index5.cjs +1 -1
  8. package/dist/index5.js +9 -1
  9. package/dist/index7.cjs +1 -1
  10. package/dist/index7.js +7 -32
  11. package/dist/src/index.d.ts +2 -2
  12. package/dist/src/lib/asset.d.ts +0 -3
  13. package/dist/src/lib/constants.d.ts +1 -0
  14. package/package.json +1 -1
  15. package/dist/index10.cjs +0 -1
  16. package/dist/index10.js +0 -32
  17. package/dist/index11.cjs +0 -1
  18. package/dist/index11.js +0 -55
  19. package/dist/index12.cjs +0 -1
  20. package/dist/index12.js +0 -9
  21. package/dist/index13.cjs +0 -1
  22. package/dist/index13.js +0 -11
  23. package/dist/index14.cjs +0 -1
  24. package/dist/index14.js +0 -11
  25. package/dist/index15.cjs +0 -1
  26. package/dist/index15.js +0 -15
  27. package/dist/index16.cjs +0 -1
  28. package/dist/index16.js +0 -39
  29. package/dist/index17.cjs +0 -1
  30. package/dist/index17.js +0 -44
  31. package/dist/index18.cjs +0 -1
  32. package/dist/index18.js +0 -26
  33. package/dist/index19.cjs +0 -1
  34. package/dist/index19.js +0 -28
  35. package/dist/index20.cjs +0 -1
  36. package/dist/index20.js +0 -57
  37. package/dist/index21.cjs +0 -1
  38. package/dist/index21.js +0 -30
  39. package/dist/index22.cjs +0 -1
  40. package/dist/index22.js +0 -15
  41. package/dist/index23.cjs +0 -1
  42. package/dist/index23.js +0 -14
  43. package/dist/index24.cjs +0 -1
  44. package/dist/index24.js +0 -6
  45. package/dist/index25.cjs +0 -1
  46. package/dist/index25.js +0 -48
  47. package/dist/index26.cjs +0 -1
  48. package/dist/index26.js +0 -45
  49. package/dist/index27.cjs +0 -1
  50. package/dist/index27.js +0 -174
  51. package/dist/index28.cjs +0 -1
  52. package/dist/index28.js +0 -15
  53. package/dist/index29.cjs +0 -1
  54. package/dist/index29.js +0 -7
  55. package/dist/index30.cjs +0 -1
  56. package/dist/index30.js +0 -19
  57. package/dist/index31.cjs +0 -1
  58. package/dist/index31.js +0 -14
  59. package/dist/index32.cjs +0 -2
  60. package/dist/index32.js +0 -62
  61. package/dist/index33.cjs +0 -1
  62. package/dist/index33.js +0 -24
  63. package/dist/index34.cjs +0 -1
  64. package/dist/index34.js +0 -16
  65. package/dist/index35.cjs +0 -1
  66. package/dist/index35.js +0 -37
  67. package/dist/index36.cjs +0 -1
  68. package/dist/index36.js +0 -130
  69. package/dist/index37.cjs +0 -1
  70. package/dist/index37.js +0 -58
  71. package/dist/index38.cjs +0 -2
  72. package/dist/index38.js +0 -45
  73. package/dist/index39.cjs +0 -1
  74. package/dist/index39.js +0 -11
  75. package/dist/index40.cjs +0 -1
  76. package/dist/index40.js +0 -13
  77. package/dist/index41.cjs +0 -1
  78. package/dist/index41.js +0 -14
  79. package/dist/index42.cjs +0 -1
  80. package/dist/index42.js +0 -16
  81. package/dist/index43.cjs +0 -1
  82. package/dist/index43.js +0 -9
  83. package/dist/index44.cjs +0 -1
  84. package/dist/index44.js +0 -20
  85. package/dist/index45.cjs +0 -1
  86. package/dist/index45.js +0 -81
  87. package/dist/index46.cjs +0 -1
  88. package/dist/index46.js +0 -17
  89. package/dist/index47.cjs +0 -1
  90. package/dist/index47.js +0 -21
  91. package/dist/index48.cjs +0 -1
  92. package/dist/index48.js +0 -6
  93. package/dist/index49.cjs +0 -1
  94. package/dist/index49.js +0 -4
  95. package/dist/index50.cjs +0 -1
  96. package/dist/index50.js +0 -4
  97. package/dist/index51.cjs +0 -1
  98. package/dist/index51.js +0 -9
  99. package/dist/index52.cjs +0 -2
  100. package/dist/index52.js +0 -37
  101. package/dist/index53.cjs +0 -1
  102. package/dist/index53.js +0 -8
  103. package/dist/index54.cjs +0 -1
  104. package/dist/index54.js +0 -9
  105. package/dist/index55.cjs +0 -1
  106. package/dist/index55.js +0 -15
  107. package/dist/index56.cjs +0 -1
  108. package/dist/index56.js +0 -9
  109. package/dist/index57.cjs +0 -1
  110. package/dist/index57.js +0 -35
  111. package/dist/index58.cjs +0 -1
  112. package/dist/index58.js +0 -4
  113. package/dist/index59.cjs +0 -1
  114. package/dist/index59.js +0 -40
  115. package/dist/index60.cjs +0 -1
  116. package/dist/index60.js +0 -31
  117. package/dist/index61.cjs +0 -1
  118. package/dist/index61.js +0 -23
  119. package/dist/index62.cjs +0 -1
  120. package/dist/index62.js +0 -9
  121. package/dist/index63.cjs +0 -1
  122. package/dist/index63.js +0 -115
  123. package/dist/index64.cjs +0 -1
  124. package/dist/index64.js +0 -7
  125. package/dist/index65.cjs +0 -1
  126. package/dist/index65.js +0 -13
  127. package/dist/index66.cjs +0 -1
  128. package/dist/index66.js +0 -107
  129. package/dist/index67.cjs +0 -1
  130. package/dist/index67.js +0 -7
  131. package/dist/index68.cjs +0 -1
  132. package/dist/index68.js +0 -64
  133. package/dist/index69.cjs +0 -1
  134. package/dist/index69.js +0 -37
  135. package/dist/index70.cjs +0 -1
  136. package/dist/index70.js +0 -32
  137. package/dist/index71.cjs +0 -1
  138. package/dist/index71.js +0 -21
  139. package/dist/index8.cjs +0 -1
  140. package/dist/index8.js +0 -27
  141. package/dist/index9.cjs +0 -1
  142. package/dist/index9.js +0 -33
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index2.cjs"),e=require("./index3.cjs"),o=require("./index4.cjs"),r=require("./index5.cjs");exports.Orderbook=t.Orderbook;exports.BlockchainType=e.BlockchainType;exports.ChainToID=e.ChainToID;exports.Chains=e.Chains;exports.getBlockchainType=e.getBlockchainType;exports.isBitcoin=e.isBitcoin;exports.isEVM=e.isEVM;exports.isMainnet=e.isMainnet;exports.OrdersProvider=o.OrdersProvider;exports.ArbitrumLocalnet=r.ArbitrumLocalnet;exports.EthereumLocalnet=r.EthereumLocalnet;exports.SupportedAssets=r.SupportedAssets;exports.WBTCArbitrumLocalnetAsset=r.WBTCArbitrumLocalnetAsset;exports.WBTCEthereumLocalnetAsset=r.WBTCEthereumLocalnetAsset;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index2.cjs"),e=require("./index3.cjs"),s=require("./index4.cjs"),t=require("./index5.cjs");exports.Orderbook=r.Orderbook;exports.BlockchainType=e.BlockchainType;exports.Chains=e.Chains;exports.getBlockchainType=e.getBlockchainType;exports.isBitcoin=e.isBitcoin;exports.isEVM=e.isEVM;exports.isMainnet=e.isMainnet;exports.OrdersProvider=s.OrdersProvider;exports.ArbitrumLocalnet=t.ArbitrumLocalnet;exports.EthereumLocalnet=t.EthereumLocalnet;exports.SupportedAssets=t.SupportedAssets;exports.WBTCArbitrumLocalnetAsset=t.WBTCArbitrumLocalnetAsset;exports.WBTCEthereumLocalnetAsset=t.WBTCEthereumLocalnetAsset;exports.bitcoinRegtestAsset=t.bitcoinRegtestAsset;
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import { Orderbook as o } from "./index2.js";
2
- import { BlockchainType as i, ChainToID as s, Chains as n, getBlockchainType as a, isBitcoin as c, isEVM as m, isMainnet as p } from "./index3.js";
1
+ import { Orderbook as r } from "./index2.js";
2
+ import { BlockchainType as s, Chains as i, getBlockchainType as n, isBitcoin as c, isEVM as a, isMainnet as m } from "./index3.js";
3
3
  import { OrdersProvider as l } from "./index4.js";
4
- import { ArbitrumLocalnet as A, EthereumLocalnet as B, SupportedAssets as T, WBTCArbitrumLocalnetAsset as d, WBTCEthereumLocalnetAsset as f } from "./index5.js";
4
+ import { ArbitrumLocalnet as h, EthereumLocalnet as u, SupportedAssets as B, WBTCArbitrumLocalnetAsset as b, WBTCEthereumLocalnetAsset as d, bitcoinRegtestAsset as f } from "./index5.js";
5
5
  export {
6
- A as ArbitrumLocalnet,
7
- i as BlockchainType,
8
- s as ChainToID,
9
- n as Chains,
10
- B as EthereumLocalnet,
11
- o as Orderbook,
6
+ h as ArbitrumLocalnet,
7
+ s as BlockchainType,
8
+ i as Chains,
9
+ u as EthereumLocalnet,
10
+ r as Orderbook,
12
11
  l as OrdersProvider,
13
- T as SupportedAssets,
14
- d as WBTCArbitrumLocalnetAsset,
15
- f as WBTCEthereumLocalnetAsset,
16
- a as getBlockchainType,
12
+ B as SupportedAssets,
13
+ b as WBTCArbitrumLocalnetAsset,
14
+ d as WBTCEthereumLocalnetAsset,
15
+ f as bitcoinRegtestAsset,
16
+ n as getBlockchainType,
17
17
  c as isBitcoin,
18
- m as isEVM,
19
- p as isMainnet
18
+ a as isEVM,
19
+ m as isMainnet
20
20
  };
package/dist/index3.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index5.cjs"),n=require("./index7.cjs"),s=require("./index8.cjs"),u=require("./index9.cjs"),l=require("./index10.cjs"),m=require("./index11.cjs");var i=(e=>(e.Bitcoin="Bitcoin",e.EVM="EVM",e))(i||{});const t={bitcoin:"bitcoin",bitcoin_testnet:"bitcoin_testnet",bitcoin_regtest:"bitcoin_regtest",ethereum:"ethereum",ethereum_arbitrum:"ethereum_arbitrum",ethereum_sepolia:"ethereum_sepolia",arbitrum_localnet:"arbitrum_localnet",arbitrum_sepolia:"arbitrum_sepolia",ethereum_localnet:"ethereum_localnet",base_sepolia:"base_sepolia"},b=e=>!(e===t.ethereum_sepolia||e===t.bitcoin_testnet||e===t.bitcoin_regtest||e===t.arbitrum_localnet||e===t.ethereum_localnet||e===t.arbitrum_sepolia||e===t.base_sepolia),o=e=>e===t.bitcoin||e===t.bitcoin_testnet||e===t.bitcoin_regtest,a=e=>e===t.ethereum||e===t.ethereum_arbitrum||e===t.ethereum_sepolia||e===t.ethereum_localnet||e===t.arbitrum_localnet||e===t.arbitrum_sepolia||e===t.base_sepolia,_={ethereum:n.mainnet,ethereum_arbitrum:s.arbitrum,ethereum_sepolia:u.sepolia,arbitrum_sepolia:l.arbitrumSepolia,ethereum_localnet:r.EthereumLocalnet,arbitrum_localnet:r.ArbitrumLocalnet,base_sepolia:m.baseSepolia},c=e=>{if(o(e))return"Bitcoin";if(a(e))return"EVM";throw new Error("Invalid or unsupported chain")};exports.BlockchainType=i;exports.ChainToID=_;exports.Chains=t;exports.getBlockchainType=c;exports.isBitcoin=o;exports.isEVM=a;exports.isMainnet=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var r=(e=>(e.Bitcoin="Bitcoin",e.EVM="EVM",e))(r||{});const t={bitcoin:"bitcoin",bitcoin_testnet:"bitcoin_testnet",bitcoin_regtest:"bitcoin_regtest",ethereum:"ethereum",ethereum_arbitrum:"ethereum_arbitrum",ethereum_sepolia:"ethereum_sepolia",arbitrum_localnet:"arbitrum_localnet",arbitrum_sepolia:"arbitrum_sepolia",ethereum_localnet:"ethereum_localnet",base_sepolia:"base_sepolia"},s=e=>!(e===t.ethereum_sepolia||e===t.bitcoin_testnet||e===t.bitcoin_regtest||e===t.arbitrum_localnet||e===t.ethereum_localnet||e===t.arbitrum_sepolia||e===t.base_sepolia),i=e=>e===t.bitcoin||e===t.bitcoin_testnet||e===t.bitcoin_regtest,o=e=>e===t.ethereum||e===t.ethereum_arbitrum||e===t.ethereum_sepolia||e===t.ethereum_localnet||e===t.arbitrum_localnet||e===t.arbitrum_sepolia||e===t.base_sepolia,n=e=>{if(i(e))return"Bitcoin";if(o(e))return"EVM";throw new Error("Invalid or unsupported chain")};exports.BlockchainType=r;exports.Chains=t;exports.getBlockchainType=n;exports.isBitcoin=i;exports.isEVM=o;exports.isMainnet=s;
package/dist/index3.js CHANGED
@@ -1,10 +1,4 @@
1
- import { EthereumLocalnet as r, ArbitrumLocalnet as o } from "./index5.js";
2
- import { mainnet as i } from "./index7.js";
3
- import { arbitrum as m } from "./index8.js";
4
- import { sepolia as a } from "./index9.js";
5
- import { arbitrumSepolia as u } from "./index10.js";
6
- import { baseSepolia as l } from "./index11.js";
7
- var s = /* @__PURE__ */ ((e) => (e.Bitcoin = "Bitcoin", e.EVM = "EVM", e))(s || {});
1
+ var r = /* @__PURE__ */ ((e) => (e.Bitcoin = "Bitcoin", e.EVM = "EVM", e))(r || {});
8
2
  const t = {
9
3
  bitcoin: "bitcoin",
10
4
  bitcoin_testnet: "bitcoin_testnet",
@@ -16,25 +10,16 @@ const t = {
16
10
  arbitrum_sepolia: "arbitrum_sepolia",
17
11
  ethereum_localnet: "ethereum_localnet",
18
12
  base_sepolia: "base_sepolia"
19
- }, g = (e) => !(e === t.ethereum_sepolia || e === t.bitcoin_testnet || e === t.bitcoin_regtest || e === t.arbitrum_localnet || e === t.ethereum_localnet || e === t.arbitrum_sepolia || e === t.base_sepolia), n = (e) => e === t.bitcoin || e === t.bitcoin_testnet || e === t.bitcoin_regtest, _ = (e) => e === t.ethereum || e === t.ethereum_arbitrum || e === t.ethereum_sepolia || e === t.ethereum_localnet || e === t.arbitrum_localnet || e === t.arbitrum_sepolia || e === t.base_sepolia, M = {
20
- ethereum: i,
21
- ethereum_arbitrum: m,
22
- ethereum_sepolia: a,
23
- arbitrum_sepolia: u,
24
- ethereum_localnet: r,
25
- arbitrum_localnet: o,
26
- base_sepolia: l
27
- }, B = (e) => {
28
- if (n(e)) return "Bitcoin";
29
- if (_(e)) return "EVM";
13
+ }, s = (e) => !(e === t.ethereum_sepolia || e === t.bitcoin_testnet || e === t.bitcoin_regtest || e === t.arbitrum_localnet || e === t.ethereum_localnet || e === t.arbitrum_sepolia || e === t.base_sepolia), i = (e) => e === t.bitcoin || e === t.bitcoin_testnet || e === t.bitcoin_regtest, o = (e) => e === t.ethereum || e === t.ethereum_arbitrum || e === t.ethereum_sepolia || e === t.ethereum_localnet || e === t.arbitrum_localnet || e === t.arbitrum_sepolia || e === t.base_sepolia, u = (e) => {
14
+ if (i(e)) return "Bitcoin";
15
+ if (o(e)) return "EVM";
30
16
  throw new Error("Invalid or unsupported chain");
31
17
  };
32
18
  export {
33
- s as BlockchainType,
34
- M as ChainToID,
19
+ r as BlockchainType,
35
20
  t as Chains,
36
- B as getBlockchainType,
37
- n as isBitcoin,
38
- _ as isEVM,
39
- g as isMainnet
21
+ u as getBlockchainType,
22
+ i as isBitcoin,
23
+ o as isEVM,
24
+ s as isMainnet
40
25
  };
package/dist/index4.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@catalogfi/utils"),l=require("@gardenfi/utils"),d=require("./index12.cjs");class O{constructor(s){this.url=new l.Url("/orders",s)}async getOrder(s,c){const t=c?`/id/matched/${s}`:`/id/unmatched/${s}`,n=this.url.endpoint(t);try{const e=await r.Fetcher.get(n);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetOrder: Unexpected error, result is undefined")}catch(e){return r.Err("GetOrder:",String(e))}}async getMatchedOrders(s,c,t){const n=d.ConstructUrl(this.url,`/user/matched/${s}`,{...t,pending:c});try{const e=await r.Fetcher.get(n);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetMatchedOrders: Unexpected error, result is undefined")}catch(e){return r.Err("GetMatchedOrders:",String(e))}}async getUnMatchedOrders(s,c){const t=d.ConstructUrl(this.url,`/user/unmatched/${s}`,c);try{const n=await r.Fetcher.get(t);return n.error?r.Err(n.error):n.result?r.Ok(n.result):r.Err("GetUnMatchedOrders: Unexpected error, result is undefined")}catch(n){return r.Err("GetUnMatchedOrders:",String(n))}}async getOrders(s,c){const t=s?"/matched":"/unmatched",n=d.ConstructUrl(this.url,t,c);try{const e=await r.Fetcher.get(n);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetAllOrders: Unexpected error, result is undefined")}catch(e){return r.Err("GetAllOrders:",String(e))}}async subscribeOrders(s,c,t,n,e=!1,i){let o=!1;const a=async()=>{if(!o){o=!0;try{const u=c?await this.getMatchedOrders(s,e,i):await this.getUnMatchedOrders(s,i);u.ok?await n(u.val):console.error("Error fetching orders:",u.error)}catch(u){console.error("Error fetching orders:",u)}finally{o=!1}}};await a();const h=setInterval(a,t);return()=>{clearInterval(h)}}async getOrdersCount(s){const c=this.url.endpoint(`/user/count/${s}`);try{const t=await r.Fetcher.get(c);return t.error?r.Err(t.error):t.status===l.ApiStatus.Ok&&t.result!==void 0?r.Ok(t.result):r.Err("GetOrdersCount: Unexpected error, result is undefined")}catch(t){return r.Err("GetOrdersCount:",String(t))}}}exports.OrdersProvider=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@catalogfi/utils"),l=require("@gardenfi/utils"),d=require("./index7.cjs");class O{constructor(s){this.url=new l.Url("/orders",s)}async getOrder(s,c){const t=c?`/id/matched/${s}`:`/id/unmatched/${s}`,n=this.url.endpoint(t);try{const e=await r.Fetcher.get(n);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetOrder: Unexpected error, result is undefined")}catch(e){return r.Err("GetOrder:",String(e))}}async getMatchedOrders(s,c,t){const n=d.ConstructUrl(this.url,`/user/matched/${s}`,{...t,pending:c});try{const e=await r.Fetcher.get(n);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetMatchedOrders: Unexpected error, result is undefined")}catch(e){return r.Err("GetMatchedOrders:",String(e))}}async getUnMatchedOrders(s,c){const t=d.ConstructUrl(this.url,`/user/unmatched/${s}`,c);try{const n=await r.Fetcher.get(t);return n.error?r.Err(n.error):n.result?r.Ok(n.result):r.Err("GetUnMatchedOrders: Unexpected error, result is undefined")}catch(n){return r.Err("GetUnMatchedOrders:",String(n))}}async getOrders(s,c){const t=s?"/matched":"/unmatched",n=d.ConstructUrl(this.url,t,c);try{const e=await r.Fetcher.get(n);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetAllOrders: Unexpected error, result is undefined")}catch(e){return r.Err("GetAllOrders:",String(e))}}async subscribeOrders(s,c,t,n,e=!1,i){let o=!1;const a=async()=>{if(!o){o=!0;try{const u=c?await this.getMatchedOrders(s,e,i):await this.getUnMatchedOrders(s,i);u.ok?await n(u.val):console.error("Error fetching orders:",u.error)}catch(u){console.error("Error fetching orders:",u)}finally{o=!1}}};await a();const h=setInterval(a,t);return()=>{clearInterval(h)}}async getOrdersCount(s){const c=this.url.endpoint(`/user/count/${s}`);try{const t=await r.Fetcher.get(c);return t.error?r.Err(t.error):t.status===l.ApiStatus.Ok&&t.result!==void 0?r.Ok(t.result):r.Err("GetOrdersCount: Unexpected error, result is undefined")}catch(t){return r.Err("GetOrdersCount:",String(t))}}}exports.OrdersProvider=O;
package/dist/index4.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Fetcher as u, Err as s, Ok as d } from "@catalogfi/utils";
2
2
  import { Url as f, ApiStatus as g } from "@gardenfi/utils";
3
- import { ConstructUrl as i } from "./index12.js";
3
+ import { ConstructUrl as i } from "./index7.js";
4
4
  class w {
5
5
  constructor(t) {
6
6
  this.url = new f("/orders", t);
package/dist/index5.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index3.cjs"),s={id:31338,name:"Arbitrum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8546/"]}},testnet:!0},n={id:31337,name:"Ethereum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8545/"]}},testnet:!0},t={name:"WBTC Arbitrum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.arbitrum_localnet,atomicSwapAddress:"0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",tokenAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"},a={name:"WBTC Ethereum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_localnet,atomicSwapAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",tokenAddress:"0x5FbDB2315678afecb367f032d93F642f64180aa3"},r={localnet:{[e.Chains.arbitrum_localnet]:t,[e.Chains.ethereum_localnet]:a},testnet:{[e.Chains.bitcoin_testnet]:{name:"BTC",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin_testnet,tokenAddress:"primary",atomicSwapAddress:"primary"},[e.Chains.ethereum_sepolia]:{name:"WBTC",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_sepolia,tokenAddress:"0x00ab86f54F436CfE15253845F139955ae0C00bAf",atomicSwapAddress:"0x1cd0bBd55fD66B4C5F7dfE434eFD009C09e628d1"},[e.Chains.arbitrum_sepolia]:{name:"WBTC",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_sepolia,tokenAddress:"0x4D68da063577F98C55166c7AF6955cF58a97b20A",atomicSwapAddress:"0x3C6a17b8cD92976D1D91E491c93c98cd81998265"}},mainnet:{}};exports.ArbitrumLocalnet=s;exports.EthereumLocalnet=n;exports.SupportedAssets=r;exports.WBTCArbitrumLocalnetAsset=t;exports.WBTCEthereumLocalnetAsset=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index3.cjs"),a={id:31338,name:"Arbitrum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8546/"]}},testnet:!0},n={id:31337,name:"Ethereum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8545/"]}},testnet:!0},r={name:"Bitcoin Regtest",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin_regtest,atomicSwapAddress:"primary",tokenAddress:"primary"},t={name:"WBTC Arbitrum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.arbitrum_localnet,atomicSwapAddress:"0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",tokenAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"},s={name:"WBTC Ethereum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_localnet,atomicSwapAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",tokenAddress:"0x5FbDB2315678afecb367f032d93F642f64180aa3"},c={localnet:{[e.Chains.arbitrum_localnet]:t,[e.Chains.ethereum_localnet]:s},testnet:{[e.Chains.bitcoin_testnet]:{name:"BTC",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin_testnet,tokenAddress:"primary",atomicSwapAddress:"primary"},[e.Chains.ethereum_sepolia]:{name:"WBTC",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_sepolia,tokenAddress:"0x00ab86f54F436CfE15253845F139955ae0C00bAf",atomicSwapAddress:"0x1cd0bBd55fD66B4C5F7dfE434eFD009C09e628d1"},[e.Chains.arbitrum_sepolia]:{name:"WBTC",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_sepolia,tokenAddress:"0x4D68da063577F98C55166c7AF6955cF58a97b20A",atomicSwapAddress:"0x3C6a17b8cD92976D1D91E491c93c98cd81998265"}},mainnet:{}};exports.ArbitrumLocalnet=a;exports.EthereumLocalnet=n;exports.SupportedAssets=c;exports.WBTCArbitrumLocalnetAsset=t;exports.WBTCEthereumLocalnetAsset=s;exports.bitcoinRegtestAsset=r;
package/dist/index5.js CHANGED
@@ -27,6 +27,13 @@ const c = {
27
27
  }
28
28
  },
29
29
  testnet: !0
30
+ }, n = {
31
+ name: "Bitcoin Regtest",
32
+ decimals: 8,
33
+ symbol: "BTC",
34
+ chain: e.bitcoin_regtest,
35
+ atomicSwapAddress: "primary",
36
+ tokenAddress: "primary"
30
37
  }, t = {
31
38
  name: "WBTC Arbitrum Localnet",
32
39
  decimals: 8,
@@ -79,5 +86,6 @@ export {
79
86
  r as EthereumLocalnet,
80
87
  m as SupportedAssets,
81
88
  t as WBTCArbitrumLocalnetAsset,
82
- a as WBTCEthereumLocalnetAsset
89
+ a as WBTCEthereumLocalnetAsset,
90
+ n as bitcoinRegtestAsset
83
91
  };
package/dist/index7.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index13.cjs"),a=e.defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});exports.mainnet=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=(n,o,t)=>{const r=n.endpoint(o);return t&&Object.entries(t).forEach(([c,e])=>{e!==void 0&&r.searchParams.append(c,e.toString())}),r};exports.ConstructUrl=i;
package/dist/index7.js CHANGED
@@ -1,34 +1,9 @@
1
- import { defineChain as e } from "./index13.js";
2
- const t = /* @__PURE__ */ e({
3
- id: 1,
4
- name: "Ethereum",
5
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
6
- rpcUrls: {
7
- default: {
8
- http: ["https://cloudflare-eth.com"]
9
- }
10
- },
11
- blockExplorers: {
12
- default: {
13
- name: "Etherscan",
14
- url: "https://etherscan.io",
15
- apiUrl: "https://api.etherscan.io/api"
16
- }
17
- },
18
- contracts: {
19
- ensRegistry: {
20
- address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
21
- },
22
- ensUniversalResolver: {
23
- address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67",
24
- blockCreated: 19258213
25
- },
26
- multicall3: {
27
- address: "0xca11bde05977b3631167028862be2a173976ca11",
28
- blockCreated: 14353601
29
- }
30
- }
31
- });
1
+ const i = (o, e, t) => {
2
+ const r = o.endpoint(e);
3
+ return t && Object.entries(t).forEach(([c, n]) => {
4
+ n !== void 0 && r.searchParams.append(c, n.toString());
5
+ }), r;
6
+ };
32
7
  export {
33
- t as mainnet
8
+ i as ConstructUrl
34
9
  };
@@ -1,7 +1,7 @@
1
1
  export { Orderbook } from './lib/orderbook/orderbook';
2
2
  export type * from './lib/orderbook/orderbook.types';
3
3
  export type { Chain, EvmChain, Asset } from './lib/asset';
4
- export { Chains, BlockchainType, isMainnet, isBitcoin, isEVM, getBlockchainType, ChainToID, } from './lib/asset';
4
+ export { Chains, BlockchainType, isMainnet, isBitcoin, isEVM, getBlockchainType, } from './lib/asset';
5
5
  export { OrdersProvider } from './lib/orders/ordersProvider';
6
6
  export type { IOrderProvider } from './lib/orders/orders.types';
7
- export { WBTCArbitrumLocalnetAsset, WBTCEthereumLocalnetAsset, ArbitrumLocalnet, EthereumLocalnet, SupportedAssets, } from './lib/constants';
7
+ export { WBTCArbitrumLocalnetAsset, WBTCEthereumLocalnetAsset, ArbitrumLocalnet, EthereumLocalnet, bitcoinRegtestAsset, SupportedAssets, } from './lib/constants';
@@ -1,5 +1,3 @@
1
- import { Chain as viemChain } from 'viem/chains';
2
-
3
1
  export type AssetCommon = {
4
2
  name: string;
5
3
  decimals: number;
@@ -48,5 +46,4 @@ export type EvmChain = keyof Omit<typeof Chains, 'bitcoin' | 'bitcoin_testnet' |
48
46
  export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "ethereum_arbitrum";
49
47
  export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_testnet" | "bitcoin_regtest";
50
48
  export declare const isEVM: (chain: Chain) => chain is "ethereum" | "ethereum_arbitrum" | "ethereum_sepolia" | "arbitrum_localnet" | "arbitrum_sepolia" | "ethereum_localnet" | "base_sepolia";
51
- export declare const ChainToID: Record<EvmChain, viemChain>;
52
49
  export declare const getBlockchainType: (chain: Chain) => BlockchainType;
@@ -3,6 +3,7 @@ import { Asset } from './asset';
3
3
 
4
4
  export declare const ArbitrumLocalnet: Chain;
5
5
  export declare const EthereumLocalnet: Chain;
6
+ export declare const bitcoinRegtestAsset: Asset;
6
7
  export declare const WBTCArbitrumLocalnetAsset: Asset;
7
8
  export declare const WBTCEthereumLocalnetAsset: Asset;
8
9
  type SupportedAssets = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/orderbook",
3
- "version": "0.2.0-beta.13",
3
+ "version": "0.2.0-beta.14",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
package/dist/index10.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index13.cjs"),a=e.defineChain({id:421614,name:"Arbitrum Sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://sepolia.arbiscan.io",apiUrl:"https://api-sepolia.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:81930}},testnet:!0});exports.arbitrumSepolia=a;
package/dist/index10.js DELETED
@@ -1,32 +0,0 @@
1
- import { defineChain as a } from "./index13.js";
2
- const e = /* @__PURE__ */ a({
3
- id: 421614,
4
- name: "Arbitrum Sepolia",
5
- nativeCurrency: {
6
- name: "Arbitrum Sepolia Ether",
7
- symbol: "ETH",
8
- decimals: 18
9
- },
10
- rpcUrls: {
11
- default: {
12
- http: ["https://sepolia-rollup.arbitrum.io/rpc"]
13
- }
14
- },
15
- blockExplorers: {
16
- default: {
17
- name: "Arbiscan",
18
- url: "https://sepolia.arbiscan.io",
19
- apiUrl: "https://api-sepolia.arbiscan.io/api"
20
- }
21
- },
22
- contracts: {
23
- multicall3: {
24
- address: "0xca11bde05977b3631167028862be2a173976ca11",
25
- blockCreated: 81930
26
- }
27
- },
28
- testnet: !0
29
- });
30
- export {
31
- e as arbitrumSepolia
32
- };
package/dist/index11.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index14.cjs"),s=require("./index13.cjs"),e=11155111,t=s.defineChain({...a.chainConfig,id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://sepolia.basescan.org",apiUrl:"https://api-sepolia.basescan.org/api"}},contracts:{...a.chainConfig.contracts,disputeGameFactory:{[e]:{address:"0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"}},l2OutputOracle:{[e]:{address:"0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"}},portal:{[e]:{address:"0x49f53e41452c74589e85ca1677426ba426459e85",blockCreated:4446677}},l1StandardBridge:{[e]:{address:"0xfd0Bf71F60660E2f608ed56e1659C450eB113120",blockCreated:4446677}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1059647}},testnet:!0,sourceId:e});exports.baseSepolia=t;
package/dist/index11.js DELETED
@@ -1,55 +0,0 @@
1
- import { chainConfig as a } from "./index14.js";
2
- import { defineChain as s } from "./index13.js";
3
- const e = 11155111, o = /* @__PURE__ */ s({
4
- ...a,
5
- id: 84532,
6
- network: "base-sepolia",
7
- name: "Base Sepolia",
8
- nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
9
- rpcUrls: {
10
- default: {
11
- http: ["https://sepolia.base.org"]
12
- }
13
- },
14
- blockExplorers: {
15
- default: {
16
- name: "Basescan",
17
- url: "https://sepolia.basescan.org",
18
- apiUrl: "https://api-sepolia.basescan.org/api"
19
- }
20
- },
21
- contracts: {
22
- ...a.contracts,
23
- disputeGameFactory: {
24
- [e]: {
25
- address: "0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"
26
- }
27
- },
28
- l2OutputOracle: {
29
- [e]: {
30
- address: "0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"
31
- }
32
- },
33
- portal: {
34
- [e]: {
35
- address: "0x49f53e41452c74589e85ca1677426ba426459e85",
36
- blockCreated: 4446677
37
- }
38
- },
39
- l1StandardBridge: {
40
- [e]: {
41
- address: "0xfd0Bf71F60660E2f608ed56e1659C450eB113120",
42
- blockCreated: 4446677
43
- }
44
- },
45
- multicall3: {
46
- address: "0xca11bde05977b3631167028862be2a173976ca11",
47
- blockCreated: 1059647
48
- }
49
- },
50
- testnet: !0,
51
- sourceId: e
52
- });
53
- export {
54
- o as baseSepolia
55
- };
package/dist/index12.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=(n,o,t)=>{const r=n.endpoint(o);return t&&Object.entries(t).forEach(([c,e])=>{e!==void 0&&r.searchParams.append(c,e.toString())}),r};exports.ConstructUrl=i;
package/dist/index12.js DELETED
@@ -1,9 +0,0 @@
1
- const i = (o, e, t) => {
2
- const r = o.endpoint(e);
3
- return t && Object.entries(t).forEach(([c, n]) => {
4
- n !== void 0 && r.searchParams.append(c, n.toString());
5
- }), r;
6
- };
7
- export {
8
- i as ConstructUrl
9
- };
package/dist/index13.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}exports.defineChain=n;
package/dist/index13.js DELETED
@@ -1,11 +0,0 @@
1
- function n(e) {
2
- return {
3
- formatters: void 0,
4
- fees: void 0,
5
- serializers: void 0,
6
- ...e
7
- };
8
- }
9
- export {
10
- n as defineChain
11
- };
package/dist/index14.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index15.cjs"),e=require("./index16.cjs"),t=require("./index17.cjs"),s={contracts:r.contracts,formatters:e.formatters,serializers:t.serializers};exports.chainConfig=s;
package/dist/index14.js DELETED
@@ -1,11 +0,0 @@
1
- import { contracts as r } from "./index15.js";
2
- import { formatters as o } from "./index16.js";
3
- import { serializers as t } from "./index17.js";
4
- const s = {
5
- contracts: r,
6
- formatters: o,
7
- serializers: t
8
- };
9
- export {
10
- s as chainConfig
11
- };
package/dist/index15.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}};exports.contracts=s;
package/dist/index15.js DELETED
@@ -1,15 +0,0 @@
1
- const s = {
2
- gasPriceOracle: { address: "0x420000000000000000000000000000000000000F" },
3
- l1Block: { address: "0x4200000000000000000000000000000000000015" },
4
- l2CrossDomainMessenger: {
5
- address: "0x4200000000000000000000000000000000000007"
6
- },
7
- l2Erc721Bridge: { address: "0x4200000000000000000000000000000000000014" },
8
- l2StandardBridge: { address: "0x4200000000000000000000000000000000000010" },
9
- l2ToL1MessagePasser: {
10
- address: "0x4200000000000000000000000000000000000016"
11
- }
12
- };
13
- export {
14
- s as contracts
15
- };
package/dist/index16.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index18.cjs"),c=require("./index19.cjs"),r=require("./index20.cjs"),l=require("./index21.cjs"),a={block:c.defineBlock({format(e){var s;return{transactions:(s=e.transactions)==null?void 0:s.map(t=>{if(typeof t=="string")return t;const i=r.formatTransaction(t);return i.typeHex==="0x7e"&&(i.isSystemTx=t.isSystemTx,i.mint=t.mint?o.hexToBigInt(t.mint):void 0,i.sourceHash=t.sourceHash,i.type="deposit"),i}),stateRoot:e.stateRoot}}}),transaction:r.defineTransaction({format(e){const n={};return e.type==="0x7e"&&(n.isSystemTx=e.isSystemTx,n.mint=e.mint?o.hexToBigInt(e.mint):void 0,n.sourceHash=e.sourceHash,n.type="deposit"),n}}),transactionReceipt:l.defineTransactionReceipt({format(e){return{l1GasPrice:e.l1GasPrice?o.hexToBigInt(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?o.hexToBigInt(e.l1GasUsed):null,l1Fee:e.l1Fee?o.hexToBigInt(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null}}})};exports.formatters=a;
package/dist/index16.js DELETED
@@ -1,39 +0,0 @@
1
- import { hexToBigInt as n } from "./index18.js";
2
- import { defineBlock as s } from "./index19.js";
3
- import { formatTransaction as m, defineTransaction as l } from "./index20.js";
4
- import { defineTransactionReceipt as c } from "./index21.js";
5
- const d = {
6
- block: /* @__PURE__ */ s({
7
- format(e) {
8
- var r;
9
- return {
10
- transactions: (r = e.transactions) == null ? void 0 : r.map((t) => {
11
- if (typeof t == "string")
12
- return t;
13
- const i = m(t);
14
- return i.typeHex === "0x7e" && (i.isSystemTx = t.isSystemTx, i.mint = t.mint ? n(t.mint) : void 0, i.sourceHash = t.sourceHash, i.type = "deposit"), i;
15
- }),
16
- stateRoot: e.stateRoot
17
- };
18
- }
19
- }),
20
- transaction: /* @__PURE__ */ l({
21
- format(e) {
22
- const o = {};
23
- return e.type === "0x7e" && (o.isSystemTx = e.isSystemTx, o.mint = e.mint ? n(e.mint) : void 0, o.sourceHash = e.sourceHash, o.type = "deposit"), o;
24
- }
25
- }),
26
- transactionReceipt: /* @__PURE__ */ c({
27
- format(e) {
28
- return {
29
- l1GasPrice: e.l1GasPrice ? n(e.l1GasPrice) : null,
30
- l1GasUsed: e.l1GasUsed ? n(e.l1GasUsed) : null,
31
- l1Fee: e.l1Fee ? n(e.l1Fee) : null,
32
- l1FeeScalar: e.l1FeeScalar ? Number(e.l1FeeScalar) : null
33
- };
34
- }
35
- })
36
- };
37
- export {
38
- d as formatters
39
- };
package/dist/index17.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index22.cjs"),c=require("./index23.cjs"),T=require("./index24.cjs"),t=require("./index25.cjs"),z=require("./index26.cjs"),H=require("./index27.cjs");function d(e,r){return y(e)?m(e):H.serializeTransaction(e,r)}const q={transaction:d};function m(e){u(e);const{sourceHash:r,data:s,from:l,gas:i,isSystemTx:f,mint:o,to:x,value:n}=e,p=[r,l,x??"0x",o?t.toHex(o):"0x",n?t.toHex(n):"0x",i?t.toHex(i):"0x",f?"0x1":"0x",s??"0x"];return T.concatHex(["0x7e",z.toRlp(p)])}function y(e){return e.type==="deposit"||typeof e.sourceHash<"u"}function u(e){const{from:r,to:s}=e;if(r&&!c.isAddress(r))throw new a.InvalidAddressError({address:r});if(s&&!c.isAddress(s))throw new a.InvalidAddressError({address:s})}exports.assertTransactionDeposit=u;exports.serializeTransaction=d;exports.serializers=q;
package/dist/index17.js DELETED
@@ -1,44 +0,0 @@
1
- import { InvalidAddressError as a } from "./index22.js";
2
- import { isAddress as f } from "./index23.js";
3
- import { concatHex as p } from "./index24.js";
4
- import { toHex as i } from "./index25.js";
5
- import { toRlp as x } from "./index26.js";
6
- import { serializeTransaction as l } from "./index27.js";
7
- function T(r, e) {
8
- return h(r) ? z(r) : l(r, e);
9
- }
10
- const E = {
11
- transaction: T
12
- };
13
- function z(r) {
14
- w(r);
15
- const { sourceHash: e, data: o, from: m, gas: t, isSystemTx: u, mint: s, to: c, value: n } = r, d = [
16
- e,
17
- m,
18
- c ?? "0x",
19
- s ? i(s) : "0x",
20
- n ? i(n) : "0x",
21
- t ? i(t) : "0x",
22
- u ? "0x1" : "0x",
23
- o ?? "0x"
24
- ];
25
- return p([
26
- "0x7e",
27
- x(d)
28
- ]);
29
- }
30
- function h(r) {
31
- return r.type === "deposit" || typeof r.sourceHash < "u";
32
- }
33
- function w(r) {
34
- const { from: e, to: o } = r;
35
- if (e && !f(e))
36
- throw new a({ address: e });
37
- if (o && !f(o))
38
- throw new a({ address: o });
39
- }
40
- export {
41
- w as assertTransactionDeposit,
42
- T as serializeTransaction,
43
- E as serializers
44
- };
package/dist/index18.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("./index28.cjs"),r=require("./index29.cjs");function o(e,{size:n}){if(r.size(e)>n)throw new z.SizeOverflowError({givenSize:r.size(e),maxSize:n})}function s(e,n={}){const{signed:u}=n;n.size&&o(e,{size:n.size});const i=BigInt(e);if(!u)return i;const t=(e.length-2)/2,c=(1n<<BigInt(t)*8n-1n)-1n;return i<=c?i:i-BigInt(`0x${"f".padStart(t*2,"f")}`)-1n}function f(e,n={}){return Number(s(e,n))}exports.assertSize=o;exports.hexToBigInt=s;exports.hexToNumber=f;
package/dist/index18.js DELETED
@@ -1,26 +0,0 @@
1
- import { SizeOverflowError as u } from "./index28.js";
2
- import { size as t } from "./index29.js";
3
- function s(n, { size: i }) {
4
- if (t(n) > i)
5
- throw new u({
6
- givenSize: t(n),
7
- maxSize: i
8
- });
9
- }
10
- function z(n, i = {}) {
11
- const { signed: o } = i;
12
- i.size && s(n, { size: i.size });
13
- const e = BigInt(n);
14
- if (!o)
15
- return e;
16
- const r = (n.length - 2) / 2, f = (1n << BigInt(r) * 8n - 1n) - 1n;
17
- return e <= f ? e : e - BigInt(`0x${"f".padStart(r * 2, "f")}`) - 1n;
18
- }
19
- function g(n, i = {}) {
20
- return Number(z(n, i));
21
- }
22
- export {
23
- s as assertSize,
24
- z as hexToBigInt,
25
- g as hexToNumber
26
- };
package/dist/index19.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index30.cjs"),u=require("./index20.cjs");function i(e){var t;const s=(t=e.transactions)==null?void 0:t.map(n=>typeof n=="string"?n:u.formatTransaction(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:s,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const f=a.defineFormatter("block",i);exports.defineBlock=f;exports.formatBlock=i;
package/dist/index19.js DELETED
@@ -1,28 +0,0 @@
1
- import { defineFormatter as t } from "./index30.js";
2
- import { formatTransaction as a } from "./index20.js";
3
- function f(e) {
4
- var i;
5
- const s = (i = e.transactions) == null ? void 0 : i.map((n) => typeof n == "string" ? n : a(n));
6
- return {
7
- ...e,
8
- baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
9
- blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
10
- difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
11
- excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
12
- gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
13
- gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
14
- hash: e.hash ? e.hash : null,
15
- logsBloom: e.logsBloom ? e.logsBloom : null,
16
- nonce: e.nonce ? e.nonce : null,
17
- number: e.number ? BigInt(e.number) : null,
18
- size: e.size ? BigInt(e.size) : void 0,
19
- timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
20
- transactions: s,
21
- totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
22
- };
23
- }
24
- const m = /* @__PURE__ */ t("block", f);
25
- export {
26
- m as defineBlock,
27
- f as formatBlock
28
- };
package/dist/index20.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index18.cjs"),l=require("./index30.cjs"),d={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function u(e){const r={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?i.hexToNumber(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?i.hexToNumber(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?d[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(r.authorizationList=m(e.authorizationList)),r.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof r.v=="bigint"){if(r.v===0n||r.v===27n)return 0;if(r.v===1n||r.v===28n)return 1;if(r.v>=35n)return r.v%2n===0n?1:0}})(),r.type==="legacy"&&(delete r.accessList,delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.yParity),r.type==="eip2930"&&(delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas),r.type==="eip1559"&&delete r.maxFeePerBlobGas,r}const n=l.defineFormatter("transaction",u);function m(e){return e.map(r=>({contractAddress:r.address,chainId:Number(r.chainId),nonce:Number(r.nonce),r:r.r,s:r.s,yParity:Number(r.yParity)}))}exports.defineTransaction=n;exports.formatTransaction=u;exports.transactionType=d;
package/dist/index20.js DELETED
@@ -1,57 +0,0 @@
1
- import { hexToNumber as r } from "./index18.js";
2
- import { defineFormatter as i } from "./index30.js";
3
- const u = {
4
- "0x0": "legacy",
5
- "0x1": "eip2930",
6
- "0x2": "eip1559",
7
- "0x3": "eip4844",
8
- "0x4": "eip7702"
9
- };
10
- function l(e) {
11
- const d = {
12
- ...e,
13
- blockHash: e.blockHash ? e.blockHash : null,
14
- blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
15
- chainId: e.chainId ? r(e.chainId) : void 0,
16
- gas: e.gas ? BigInt(e.gas) : void 0,
17
- gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
18
- maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
19
- maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
20
- maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
21
- nonce: e.nonce ? r(e.nonce) : void 0,
22
- to: e.to ? e.to : null,
23
- transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
24
- type: e.type ? u[e.type] : void 0,
25
- typeHex: e.type ? e.type : void 0,
26
- value: e.value ? BigInt(e.value) : void 0,
27
- v: e.v ? BigInt(e.v) : void 0
28
- };
29
- return e.authorizationList && (d.authorizationList = m(e.authorizationList)), d.yParity = (() => {
30
- if (e.yParity)
31
- return Number(e.yParity);
32
- if (typeof d.v == "bigint") {
33
- if (d.v === 0n || d.v === 27n)
34
- return 0;
35
- if (d.v === 1n || d.v === 28n)
36
- return 1;
37
- if (d.v >= 35n)
38
- return d.v % 2n === 0n ? 1 : 0;
39
- }
40
- })(), d.type === "legacy" && (delete d.accessList, delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas, delete d.yParity), d.type === "eip2930" && (delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas), d.type === "eip1559" && delete d.maxFeePerBlobGas, d;
41
- }
42
- const P = /* @__PURE__ */ i("transaction", l);
43
- function m(e) {
44
- return e.map((d) => ({
45
- contractAddress: d.address,
46
- chainId: Number(d.chainId),
47
- nonce: Number(d.nonce),
48
- r: d.r,
49
- s: d.s,
50
- yParity: Number(d.yParity)
51
- }));
52
- }
53
- export {
54
- P as defineTransaction,
55
- l as formatTransaction,
56
- u as transactionType
57
- };