@gardenfi/core 0.2.0-beta.70 → 0.2.0-beta.72

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 (173) hide show
  1. package/dist/index.cjs +1 -31
  2. package/dist/index.js +26 -7808
  3. package/dist/index10.cjs +1 -0
  4. package/dist/index10.js +87 -0
  5. package/dist/index11.cjs +20 -0
  6. package/dist/index11.js +380 -0
  7. package/dist/index12.cjs +1 -0
  8. package/dist/index12.js +22 -0
  9. package/dist/index13.cjs +1 -0
  10. package/dist/index13.js +396 -0
  11. package/dist/index14.cjs +1 -0
  12. package/dist/index14.js +23 -0
  13. package/dist/index15.cjs +1 -0
  14. package/dist/index15.js +4 -0
  15. package/dist/index16.cjs +1 -0
  16. package/dist/index16.js +140 -0
  17. package/dist/index17.cjs +1 -0
  18. package/dist/index17.js +4 -0
  19. package/dist/index18.cjs +3 -0
  20. package/dist/index18.js +30 -0
  21. package/dist/index19.cjs +1 -0
  22. package/dist/index19.js +17 -0
  23. package/dist/index2.cjs +1 -0
  24. package/dist/index2.js +412 -0
  25. package/dist/index20.cjs +2 -0
  26. package/dist/index20.js +27 -0
  27. package/dist/index21.cjs +1 -0
  28. package/dist/index21.js +43 -0
  29. package/dist/index22.cjs +1 -0
  30. package/dist/index22.js +201 -0
  31. package/dist/index23.cjs +1 -0
  32. package/dist/index23.js +4 -0
  33. package/dist/index24.cjs +1 -0
  34. package/dist/index24.js +4 -0
  35. package/dist/index25.cjs +1 -0
  36. package/dist/index25.js +4 -0
  37. package/dist/index26.cjs +1 -0
  38. package/dist/index26.js +30 -0
  39. package/dist/index27.cjs +1 -0
  40. package/dist/index27.js +17 -0
  41. package/dist/index28.cjs +1 -0
  42. package/dist/index28.js +177 -0
  43. package/dist/index29.cjs +1 -0
  44. package/dist/index29.js +24 -0
  45. package/dist/index3.cjs +1 -0
  46. package/dist/index3.js +5 -0
  47. package/dist/index30.cjs +1 -0
  48. package/dist/index30.js +4 -0
  49. package/dist/index31.cjs +1 -0
  50. package/dist/index31.js +37 -0
  51. package/dist/index32.cjs +1 -0
  52. package/dist/index32.js +11 -0
  53. package/dist/index33.cjs +1 -0
  54. package/dist/index33.js +4 -0
  55. package/dist/index34.cjs +6 -0
  56. package/dist/index34.js +949 -0
  57. package/dist/index35.cjs +1 -0
  58. package/dist/index35.js +4 -0
  59. package/dist/index36.cjs +1 -0
  60. package/dist/index36.js +22 -0
  61. package/dist/index37.cjs +1 -0
  62. package/dist/index37.js +34 -0
  63. package/dist/index38.cjs +1 -0
  64. package/dist/index38.js +64 -0
  65. package/dist/index39.cjs +1 -0
  66. package/dist/index39.js +35 -0
  67. package/dist/index4.cjs +1 -0
  68. package/dist/index4.js +18 -0
  69. package/dist/index40.cjs +1 -0
  70. package/dist/index40.js +89 -0
  71. package/dist/index41.cjs +1 -0
  72. package/dist/index41.js +51 -0
  73. package/dist/index42.cjs +1 -0
  74. package/dist/index42.js +28 -0
  75. package/dist/index43.cjs +1 -0
  76. package/dist/index43.js +4 -0
  77. package/dist/index44.cjs +1 -0
  78. package/dist/index44.js +4 -0
  79. package/dist/index45.cjs +1 -0
  80. package/dist/index45.js +22 -0
  81. package/dist/index46.cjs +1 -0
  82. package/dist/index46.js +37 -0
  83. package/dist/index47.cjs +1 -0
  84. package/dist/index47.js +369 -0
  85. package/dist/index48.cjs +1 -0
  86. package/dist/index48.js +23 -0
  87. package/dist/index49.cjs +1 -0
  88. package/dist/index49.js +58 -0
  89. package/dist/index5.cjs +1 -0
  90. package/dist/index5.js +110 -0
  91. package/dist/index50.cjs +1 -0
  92. package/dist/index50.js +5 -0
  93. package/dist/index51.cjs +1 -0
  94. package/dist/index51.js +75 -0
  95. package/dist/index52.cjs +1 -0
  96. package/dist/index52.js +4 -0
  97. package/dist/index53.cjs +1 -0
  98. package/dist/index53.js +60 -0
  99. package/dist/index54.cjs +1 -0
  100. package/dist/index54.js +4 -0
  101. package/dist/index55.cjs +1 -0
  102. package/dist/index55.js +42 -0
  103. package/dist/index56.cjs +1 -0
  104. package/dist/index56.js +45 -0
  105. package/dist/index57.cjs +1 -0
  106. package/dist/index57.js +20 -0
  107. package/dist/index58.cjs +1 -0
  108. package/dist/index58.js +111 -0
  109. package/dist/index59.cjs +1 -0
  110. package/dist/index59.js +23 -0
  111. package/dist/index6.cjs +1 -0
  112. package/dist/index6.js +5 -0
  113. package/dist/index60.cjs +1 -0
  114. package/dist/index60.js +228 -0
  115. package/dist/index61.cjs +1 -0
  116. package/dist/index61.js +6 -0
  117. package/dist/index62.cjs +1 -0
  118. package/dist/index62.js +160 -0
  119. package/dist/index63.cjs +1 -0
  120. package/dist/index63.js +4 -0
  121. package/dist/index64.cjs +1 -0
  122. package/dist/index64.js +15 -0
  123. package/dist/index65.cjs +1 -0
  124. package/dist/index65.js +4 -0
  125. package/dist/index66.cjs +1 -0
  126. package/dist/index66.js +35 -0
  127. package/dist/index67.cjs +1 -0
  128. package/dist/index67.js +4 -0
  129. package/dist/index68.cjs +1 -0
  130. package/dist/index68.js +358 -0
  131. package/dist/index69.cjs +1 -0
  132. package/dist/index69.js +241 -0
  133. package/dist/index7.cjs +1 -0
  134. package/dist/index7.js +76 -0
  135. package/dist/index70.cjs +1 -0
  136. package/dist/index70.js +70 -0
  137. package/dist/index71.cjs +1 -0
  138. package/dist/index71.js +64 -0
  139. package/dist/index72.cjs +1 -0
  140. package/dist/index72.js +14 -0
  141. package/dist/index73.cjs +1 -0
  142. package/dist/index73.js +47 -0
  143. package/dist/index74.cjs +1 -0
  144. package/dist/index74.js +65 -0
  145. package/dist/index75.cjs +1 -0
  146. package/dist/index75.js +228 -0
  147. package/dist/index76.cjs +1 -0
  148. package/dist/index76.js +5 -0
  149. package/dist/index77.cjs +1 -0
  150. package/dist/index77.js +171 -0
  151. package/dist/index78.cjs +1 -0
  152. package/dist/index78.js +30 -0
  153. package/dist/index79.cjs +1 -0
  154. package/dist/index79.js +23 -0
  155. package/dist/index8.cjs +1 -0
  156. package/dist/index8.js +62 -0
  157. package/dist/index80.cjs +1 -0
  158. package/dist/index80.js +72 -0
  159. package/dist/index81.cjs +1 -0
  160. package/dist/index81.js +130 -0
  161. package/dist/index82.cjs +1 -0
  162. package/dist/index82.js +9 -0
  163. package/dist/index83.cjs +1 -0
  164. package/dist/index83.js +4 -0
  165. package/dist/index84.cjs +1 -0
  166. package/dist/index84.js +28 -0
  167. package/dist/index85.cjs +1 -0
  168. package/dist/index85.js +4 -0
  169. package/dist/index9.cjs +1 -0
  170. package/dist/index9.js +63 -0
  171. package/dist/src/index.d.ts +1 -1
  172. package/dist/src/lib/utils.d.ts +1 -3
  173. package/package.json +2 -2
@@ -0,0 +1,130 @@
1
+ import { e as k } from "./index73.js";
2
+ var S, h;
3
+ function I() {
4
+ if (h) return S;
5
+ h = 1;
6
+ var m;
7
+ function i(t, e, n) {
8
+ return e = _(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
9
+ }
10
+ function _(t) {
11
+ var e = R(t, "string");
12
+ return typeof e == "symbol" ? e : String(e);
13
+ }
14
+ function R(t, e) {
15
+ if (typeof t != "object" || t === null) return t;
16
+ var n = t[Symbol.toPrimitive];
17
+ if (n !== void 0) {
18
+ var r = n.call(t, e || "default");
19
+ if (typeof r != "object") return r;
20
+ throw new TypeError("@@toPrimitive must return a primitive value.");
21
+ }
22
+ return (e === "string" ? String : Number)(t);
23
+ }
24
+ var p = k, u = Symbol("lastResolve"), s = Symbol("lastReject"), d = Symbol("error"), b = Symbol("ended"), f = Symbol("lastPromise"), P = Symbol("handlePromise"), c = Symbol("stream");
25
+ function a(t, e) {
26
+ return {
27
+ value: t,
28
+ done: e
29
+ };
30
+ }
31
+ function w(t) {
32
+ var e = t[u];
33
+ if (e !== null) {
34
+ var n = t[c].read();
35
+ n !== null && (t[f] = null, t[u] = null, t[s] = null, e(a(n, !1)));
36
+ }
37
+ }
38
+ function O(t) {
39
+ process.nextTick(w, t);
40
+ }
41
+ function A(t, e) {
42
+ return function(n, r) {
43
+ t.then(function() {
44
+ if (e[b]) {
45
+ n(a(void 0, !0));
46
+ return;
47
+ }
48
+ e[P](n, r);
49
+ }, r);
50
+ };
51
+ }
52
+ var E = Object.getPrototypeOf(function() {
53
+ }), g = Object.setPrototypeOf((m = {
54
+ get stream() {
55
+ return this[c];
56
+ },
57
+ next: function() {
58
+ var e = this, n = this[d];
59
+ if (n !== null)
60
+ return Promise.reject(n);
61
+ if (this[b])
62
+ return Promise.resolve(a(void 0, !0));
63
+ if (this[c].destroyed)
64
+ return new Promise(function(v, y) {
65
+ process.nextTick(function() {
66
+ e[d] ? y(e[d]) : v(a(void 0, !0));
67
+ });
68
+ });
69
+ var r = this[f], l;
70
+ if (r)
71
+ l = new Promise(A(r, this));
72
+ else {
73
+ var o = this[c].read();
74
+ if (o !== null)
75
+ return Promise.resolve(a(o, !1));
76
+ l = new Promise(this[P]);
77
+ }
78
+ return this[f] = l, l;
79
+ }
80
+ }, i(m, Symbol.asyncIterator, function() {
81
+ return this;
82
+ }), i(m, "return", function() {
83
+ var e = this;
84
+ return new Promise(function(n, r) {
85
+ e[c].destroy(null, function(l) {
86
+ if (l) {
87
+ r(l);
88
+ return;
89
+ }
90
+ n(a(void 0, !0));
91
+ });
92
+ });
93
+ }), m), E), j = function(e) {
94
+ var n, r = Object.create(g, (n = {}, i(n, c, {
95
+ value: e,
96
+ writable: !0
97
+ }), i(n, u, {
98
+ value: null,
99
+ writable: !0
100
+ }), i(n, s, {
101
+ value: null,
102
+ writable: !0
103
+ }), i(n, d, {
104
+ value: null,
105
+ writable: !0
106
+ }), i(n, b, {
107
+ value: e._readableState.endEmitted,
108
+ writable: !0
109
+ }), i(n, P, {
110
+ value: function(o, v) {
111
+ var y = r[c].read();
112
+ y ? (r[f] = null, r[u] = null, r[s] = null, o(a(y, !1))) : (r[u] = o, r[s] = v);
113
+ },
114
+ writable: !0
115
+ }), n));
116
+ return r[f] = null, p(e, function(l) {
117
+ if (l && l.code !== "ERR_STREAM_PREMATURE_CLOSE") {
118
+ var o = r[s];
119
+ o !== null && (r[f] = null, r[u] = null, r[s] = null, o(l)), r[d] = l;
120
+ return;
121
+ }
122
+ var v = r[u];
123
+ v !== null && (r[f] = null, r[u] = null, r[s] = null, v(a(void 0, !0))), r[b] = !0;
124
+ }), e.on("readable", O.bind(null, r)), r;
125
+ };
126
+ return S = j, S;
127
+ }
128
+ export {
129
+ I as __require
130
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var r,e;function o(){return e||(e=1,r=function(){throw new Error("Readable.from is not available in the browser")}),r}exports.__require=o;
@@ -0,0 +1,9 @@
1
+ var r, e;
2
+ function o() {
3
+ return e || (e = 1, r = function() {
4
+ throw new Error("Readable.from is not available in the browser");
5
+ }), r;
6
+ }
7
+ export {
8
+ o as __require
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var r={};exports.__exports=r;
@@ -0,0 +1,4 @@
1
+ var r = {};
2
+ export {
3
+ r as __exports
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index29.cjs");var l=c;function c(r,e){if(t("noDeprecation"))return r;var o=!1;function a(){if(!o){if(t("throwDeprecation"))throw new Error(e);t("traceDeprecation")?console.trace(e):console.warn(e),o=!0}return r.apply(this,arguments)}return a}function t(r){try{if(!n.commonjsGlobal.localStorage)return!1}catch{return!1}var e=n.commonjsGlobal.localStorage[r];return e==null?!1:String(e).toLowerCase()==="true"}exports.browser=l;
@@ -0,0 +1,28 @@
1
+ import { commonjsGlobal as a } from "./index29.js";
2
+ var i = c;
3
+ function c(e, r) {
4
+ if (o("noDeprecation"))
5
+ return e;
6
+ var t = !1;
7
+ function n() {
8
+ if (!t) {
9
+ if (o("throwDeprecation"))
10
+ throw new Error(r);
11
+ o("traceDeprecation") ? console.trace(r) : console.warn(r), t = !0;
12
+ }
13
+ return e.apply(this, arguments);
14
+ }
15
+ return n;
16
+ }
17
+ function o(e) {
18
+ try {
19
+ if (!a.localStorage) return !1;
20
+ } catch {
21
+ return !1;
22
+ }
23
+ var r = a.localStorage[e];
24
+ return r == null ? !1 : String(r).toLowerCase() === "true";
25
+ }
26
+ export {
27
+ i as b
28
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
@@ -0,0 +1,4 @@
1
+ var e = { exports: {} };
2
+ export {
3
+ e as __module
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@catalogfi/utils"),u=require("@gardenfi/utils"),i=require("./index10.cjs");class a{constructor(t){this.quoteUrl=new u.Url("/quote",t)}async getQuote(t,e,s=!1){try{const o=this.quoteUrl.addSearchParams({order_pair:t,amount:e.toString(),exact_out:s.toString()}),n=await r.Fetcher.get(o);return n.error?r.Err(n.error):n.result?r.Ok(n.result):r.Err("GetQuote: Unexpected error, result is undefined")}catch(o){return r.Err("GetQuote:",String(o))}}async getAttestedQuote(t){try{const e=await r.Fetcher.post(this.quoteUrl.endpoint("/attested").toString(),{body:JSON.stringify(t),headers:{"Content-Type":"application/json"}});return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetAttestedQuote: Unexpected error, result is undefined")}catch(e){return console.log("error :",e),r.Err("GetAttestedQuote:",String(e))}}async getStrategies(){try{const t=await r.Fetcher.get(this.quoteUrl.endpoint("/strategies"));if(t.error)return r.Err(t.error);if(!t.result)return r.Err("GetStrategies: Unexpected error, result is undefined");const e={};for(const s of Object.values(t.result)){const o=i.constructOrderPair(s.source_chain,s.source_asset.asset,s.dest_chain,s.dest_asset.asset);e[o]={id:s.id,minAmount:s.min_amount,maxAmount:s.max_amount}}return r.Ok(e)}catch(t){return r.Err("GetStrategies:",String(t))}}}exports.Quote=a;
package/dist/index9.js ADDED
@@ -0,0 +1,63 @@
1
+ import { Fetcher as u, Err as o, Ok as i } from "@catalogfi/utils";
2
+ import { Url as a } from "@gardenfi/utils";
3
+ import { constructOrderPair as c } from "./index10.js";
4
+ class m {
5
+ constructor(t) {
6
+ this.quoteUrl = new a("/quote", t);
7
+ }
8
+ async getQuote(t, r, e = !1) {
9
+ try {
10
+ const s = this.quoteUrl.addSearchParams({
11
+ order_pair: t,
12
+ amount: r.toString(),
13
+ exact_out: e.toString()
14
+ }), n = await u.get(s);
15
+ return n.error ? o(n.error) : n.result ? i(n.result) : o("GetQuote: Unexpected error, result is undefined");
16
+ } catch (s) {
17
+ return o("GetQuote:", String(s));
18
+ }
19
+ }
20
+ async getAttestedQuote(t) {
21
+ try {
22
+ const r = await u.post(this.quoteUrl.endpoint("/attested").toString(), {
23
+ body: JSON.stringify(t),
24
+ headers: {
25
+ "Content-Type": "application/json"
26
+ }
27
+ });
28
+ return r.error ? o(r.error) : r.result ? i(r.result) : o("GetAttestedQuote: Unexpected error, result is undefined");
29
+ } catch (r) {
30
+ return console.log("error :", r), o("GetAttestedQuote:", String(r));
31
+ }
32
+ }
33
+ async getStrategies() {
34
+ try {
35
+ const t = await u.get(
36
+ this.quoteUrl.endpoint("/strategies")
37
+ );
38
+ if (t.error) return o(t.error);
39
+ if (!t.result)
40
+ return o("GetStrategies: Unexpected error, result is undefined");
41
+ const r = {};
42
+ for (const e of Object.values(t.result)) {
43
+ const s = c(
44
+ e.source_chain,
45
+ e.source_asset.asset,
46
+ e.dest_chain,
47
+ e.dest_asset.asset
48
+ );
49
+ r[s] = {
50
+ id: e.id,
51
+ minAmount: e.min_amount,
52
+ maxAmount: e.max_amount
53
+ };
54
+ }
55
+ return i(r);
56
+ } catch (t) {
57
+ return o("GetStrategies:", String(t));
58
+ }
59
+ }
60
+ }
61
+ export {
62
+ m as Quote
63
+ };
@@ -11,4 +11,4 @@ export { SecretManager } from './lib/secretManager/secretManager';
11
11
  export type { ISecretManager, Secret, } from './lib/secretManager/secretManager.types';
12
12
  export { Quote } from './lib/quote/quote';
13
13
  export type { IQuote, QuoteResponse, Strategies, } from './lib/quote/quote.types';
14
- export { switchOrAddNetwork, constructOrderPair, evmToViemChainMap, } from './lib/utils';
14
+ export { switchOrAddNetwork, constructOrderPair } from './lib/utils';
@@ -1,6 +1,5 @@
1
- import { Chain as viemChain } from 'viem/chains';
2
1
  import { IBaseWallet } from '@catalogfi/wallets';
3
- import { Chain, EvmChain } from '@gardenfi/orderbook';
2
+ import { Chain } from '@gardenfi/orderbook';
4
3
  import { WalletClient } from 'viem';
5
4
  import { AsyncResult } from '@catalogfi/utils';
6
5
 
@@ -22,7 +21,6 @@ export declare function prefixScriptLength(s: Buffer): Buffer;
22
21
  export declare function sortLeaves(leaf1: Buffer, leaf2: Buffer): Buffer[];
23
22
  export declare const toXOnly: (pubKey: string) => string;
24
23
  export declare const isValidBitcoinPubKey: (pubKey: string) => boolean;
25
- export declare const evmToViemChainMap: Record<EvmChain, viemChain>;
26
24
  /**
27
25
  * Switches or adds a network to the wallet
28
26
  * @param chain Garden supported chain
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/core",
3
- "version": "0.2.0-beta.70",
3
+ "version": "0.2.0-beta.72",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@catalogfi/utils": "^0.1.6",
30
30
  "@catalogfi/wallets": "^0.2.51",
31
- "@gardenfi/orderbook": "^0.2.0-beta.16",
31
+ "@gardenfi/orderbook": "^0.2.0-beta.18",
32
32
  "@gardenfi/utils": "^0.0.1-beta.18",
33
33
  "bignumber.js": "^9.1.2",
34
34
  "bitcoinjs-lib": "^6.1.6",