@gardenfi/swap 0.1.2 → 0.1.3-beta.10

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 (148) hide show
  1. package/dist/index113.cjs +1 -1
  2. package/dist/index113.js +1 -1
  3. package/dist/index116.cjs +1 -1
  4. package/dist/index116.js +1 -1
  5. package/dist/index117.cjs +1 -1
  6. package/dist/index117.js +1 -1
  7. package/dist/index12.cjs +1 -1
  8. package/dist/index12.js +1 -1
  9. package/dist/index120.cjs +1 -1
  10. package/dist/index120.js +2 -2
  11. package/dist/index121.cjs +1 -1
  12. package/dist/index121.js +7 -7
  13. package/dist/index126.cjs +1 -1
  14. package/dist/index126.js +2 -2
  15. package/dist/index127.cjs +1 -1
  16. package/dist/index127.js +1 -1
  17. package/dist/index128.cjs +1 -1
  18. package/dist/index128.js +1 -1
  19. package/dist/index129.cjs +1 -1
  20. package/dist/index129.js +1 -1
  21. package/dist/index130.cjs +1 -1
  22. package/dist/index130.js +2 -2
  23. package/dist/index138.cjs +1 -1
  24. package/dist/index138.js +1 -1
  25. package/dist/index140.cjs +1 -1
  26. package/dist/index140.js +1 -1
  27. package/dist/index148.cjs +1 -1
  28. package/dist/index148.js +1 -1
  29. package/dist/index149.cjs +1 -1
  30. package/dist/index149.js +1 -1
  31. package/dist/index154.cjs +1 -1
  32. package/dist/index154.js +1 -1
  33. package/dist/index162.cjs +1 -1
  34. package/dist/index162.js +2 -2
  35. package/dist/index173.cjs +1 -1
  36. package/dist/index173.js +2 -2
  37. package/dist/index303.cjs +1 -1
  38. package/dist/index303.js +10 -43
  39. package/dist/index304.cjs +1 -1
  40. package/dist/index304.js +16 -320
  41. package/dist/index305.cjs +1 -1
  42. package/dist/index305.js +21 -604
  43. package/dist/index306.cjs +1 -1
  44. package/dist/index306.js +14 -110
  45. package/dist/index307.cjs +1 -1
  46. package/dist/index307.js +13 -167
  47. package/dist/index308.cjs +1 -1
  48. package/dist/index308.js +13 -300
  49. package/dist/index309.cjs +1 -1
  50. package/dist/index309.js +9 -93
  51. package/dist/index310.cjs +1 -1
  52. package/dist/index310.js +13 -54
  53. package/dist/index311.cjs +1 -1
  54. package/dist/index311.js +23 -51
  55. package/dist/index312.cjs +1 -1
  56. package/dist/index312.js +30 -43
  57. package/dist/index313.cjs +2 -1
  58. package/dist/index313.js +18 -15
  59. package/dist/index314.cjs +1 -1
  60. package/dist/index314.js +14 -317
  61. package/dist/index315.cjs +1 -1
  62. package/dist/index315.js +41 -58
  63. package/dist/index316.cjs +1 -1
  64. package/dist/index316.js +319 -18
  65. package/dist/index317.cjs +1 -1
  66. package/dist/index317.js +602 -26
  67. package/dist/index318.cjs +1 -1
  68. package/dist/index318.js +110 -4
  69. package/dist/index319.cjs +1 -7
  70. package/dist/index319.js +166 -236
  71. package/dist/index320.cjs +1 -1
  72. package/dist/index320.js +302 -48
  73. package/dist/index321.cjs +1 -1
  74. package/dist/index321.js +92 -211
  75. package/dist/index322.cjs +1 -1
  76. package/dist/index322.js +49 -74
  77. package/dist/index323.cjs +1 -1
  78. package/dist/index323.js +51 -27
  79. package/dist/index324.cjs +1 -1
  80. package/dist/index324.js +42 -74
  81. package/dist/index325.cjs +1 -1
  82. package/dist/index325.js +15 -9
  83. package/dist/index326.cjs +1 -1
  84. package/dist/index326.js +317 -16
  85. package/dist/index327.cjs +1 -1
  86. package/dist/index327.js +57 -20
  87. package/dist/index328.cjs +1 -1
  88. package/dist/index328.js +18 -12
  89. package/dist/index329.cjs +1 -1
  90. package/dist/index329.js +29 -13
  91. package/dist/index330.cjs +1 -1
  92. package/dist/index330.js +3 -14
  93. package/dist/index331.cjs +7 -1
  94. package/dist/index331.js +237 -9
  95. package/dist/index332.cjs +1 -1
  96. package/dist/index332.js +48 -16
  97. package/dist/index333.cjs +1 -1
  98. package/dist/index333.js +209 -22
  99. package/dist/index334.cjs +1 -1
  100. package/dist/index334.js +80 -30
  101. package/dist/index335.cjs +1 -2
  102. package/dist/index335.js +29 -18
  103. package/dist/index336.cjs +1 -1
  104. package/dist/index336.js +75 -13
  105. package/dist/index361.cjs +1 -1
  106. package/dist/index361.js +3 -94
  107. package/dist/index362.cjs +1 -1
  108. package/dist/index362.js +137 -25
  109. package/dist/index363.cjs +1 -1
  110. package/dist/index363.js +129 -144
  111. package/dist/index364.cjs +1 -1
  112. package/dist/index364.js +71 -331
  113. package/dist/index365.cjs +1 -1
  114. package/dist/index365.js +27 -72
  115. package/dist/index366.cjs +1 -1
  116. package/dist/index366.js +148 -31
  117. package/dist/index367.cjs +1 -1
  118. package/dist/index367.js +354 -5
  119. package/dist/index368.cjs +1 -1
  120. package/dist/index368.js +275 -3
  121. package/dist/index369.cjs +1 -1
  122. package/dist/index369.js +170 -140
  123. package/dist/index370.cjs +1 -1
  124. package/dist/index370.js +10 -276
  125. package/dist/index371.cjs +1 -1
  126. package/dist/index371.js +107 -170
  127. package/dist/index372.cjs +1 -1
  128. package/dist/index372.js +6 -10
  129. package/dist/index373.cjs +1 -1
  130. package/dist/index373.js +70 -104
  131. package/dist/index374.cjs +1 -1
  132. package/dist/index374.js +2 -2
  133. package/dist/index375.cjs +1 -1
  134. package/dist/index375.js +29 -131
  135. package/dist/index383.cjs +1 -1
  136. package/dist/index383.js +59 -106
  137. package/dist/index384.cjs +1 -1
  138. package/dist/index384.js +110 -3
  139. package/dist/index385.cjs +1 -1
  140. package/dist/index385.js +3 -63
  141. package/dist/index6.cjs +1 -1
  142. package/dist/index6.js +42 -42
  143. package/dist/index77.cjs +1 -1
  144. package/dist/index77.js +13 -13
  145. package/dist/index9.cjs +1 -1
  146. package/dist/index9.js +16 -14
  147. package/dist/src/lib/store/swapStore.d.ts +1 -1
  148. package/package.json +5 -5
package/dist/index384.js CHANGED
@@ -1,5 +1,112 @@
1
- import { blake2b as b } from "./index386.js";
2
- const e = b;
1
+ /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
+ function x(e) {
3
+ return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
4
+ }
5
+ function g(e, r) {
6
+ return Array.isArray(r) ? r.length === 0 ? !0 : e ? r.every((t) => typeof t == "string") : r.every((t) => Number.isSafeInteger(t)) : !1;
7
+ }
8
+ function w(e, r) {
9
+ if (typeof r != "string")
10
+ throw new Error(`${e}: string expected`);
11
+ return !0;
12
+ }
13
+ function b(e) {
14
+ if (!Number.isSafeInteger(e))
15
+ throw new Error(`invalid integer: ${e}`);
16
+ }
17
+ function h(e) {
18
+ if (!Array.isArray(e))
19
+ throw new Error("array expected");
20
+ }
21
+ function A(e, r) {
22
+ if (!g(!0, r))
23
+ throw new Error(`${e}: array of strings expected`);
24
+ }
25
+ function E(e, r) {
26
+ if (!g(!1, r))
27
+ throw new Error(`${e}: array of numbers expected`);
28
+ }
29
+ // @__NO_SIDE_EFFECTS__
30
+ function m(...e) {
31
+ const r = (n) => n, t = (n, a) => (o) => n(a(o)), c = e.map((n) => n.encode).reduceRight(t, r), i = e.map((n) => n.decode).reduce(t, r);
32
+ return { encode: c, decode: i };
33
+ }
34
+ // @__NO_SIDE_EFFECTS__
35
+ function $(e) {
36
+ const r = typeof e == "string" ? e.split("") : e, t = r.length;
37
+ A("alphabet", r);
38
+ const c = new Map(r.map((i, n) => [i, n]));
39
+ return {
40
+ encode: (i) => (h(i), i.map((n) => {
41
+ if (!Number.isSafeInteger(n) || n < 0 || n >= t)
42
+ throw new Error(`alphabet.encode: digit index outside alphabet "${n}". Allowed: ${e}`);
43
+ return r[n];
44
+ })),
45
+ decode: (i) => (h(i), i.map((n) => {
46
+ w("alphabet.decode", n);
47
+ const a = c.get(n);
48
+ if (a === void 0)
49
+ throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);
50
+ return a;
51
+ }))
52
+ };
53
+ }
54
+ // @__NO_SIDE_EFFECTS__
55
+ function R(e = "") {
56
+ return w("join", e), {
57
+ encode: (r) => (A("join.decode", r), r.join(e)),
58
+ decode: (r) => (w("join.decode", r), r.split(e))
59
+ };
60
+ }
61
+ function p(e, r, t) {
62
+ if (r < 2)
63
+ throw new Error(`convertRadix: invalid from=${r}, base cannot be less than 2`);
64
+ if (t < 2)
65
+ throw new Error(`convertRadix: invalid to=${t}, base cannot be less than 2`);
66
+ if (h(e), !e.length)
67
+ return [];
68
+ let c = 0;
69
+ const i = [], n = Array.from(e, (o) => {
70
+ if (b(o), o < 0 || o >= r)
71
+ throw new Error(`invalid integer: ${o}`);
72
+ return o;
73
+ }), a = n.length;
74
+ for (; ; ) {
75
+ let o = 0, d = !0;
76
+ for (let s = c; s < a; s++) {
77
+ const y = n[s], l = r * o, f = l + y;
78
+ if (!Number.isSafeInteger(f) || l / r !== o || f - y !== l)
79
+ throw new Error("convertRadix: carry overflow");
80
+ const v = f / t;
81
+ o = f % t;
82
+ const u = Math.floor(v);
83
+ if (n[s] = u, !Number.isSafeInteger(u) || u * t + o !== f)
84
+ throw new Error("convertRadix: carry overflow");
85
+ if (d)
86
+ u ? d = !1 : c = s;
87
+ else continue;
88
+ }
89
+ if (i.push(o), d)
90
+ break;
91
+ }
92
+ for (let o = 0; o < e.length - 1 && e[o] === 0; o++)
93
+ i.push(0);
94
+ return i.reverse();
95
+ }
96
+ // @__NO_SIDE_EFFECTS__
97
+ function j(e) {
98
+ b(e);
99
+ const r = 2 ** 8;
100
+ return {
101
+ encode: (t) => {
102
+ if (!x(t))
103
+ throw new Error("radix.encode input should be Uint8Array");
104
+ return p(Array.from(t), r, e);
105
+ },
106
+ decode: (t) => (E("radix.decode", t), Uint8Array.from(p(t, e, r)))
107
+ };
108
+ }
109
+ const N = /* @__NO_SIDE_EFFECTS__ */ (e) => /* @__PURE__ */ m(/* @__PURE__ */ j(58), /* @__PURE__ */ $(e), /* @__PURE__ */ R("")), S = /* @__PURE__ */ N("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
3
110
  export {
4
- e as blake2b
111
+ S as base58
5
112
  };
package/dist/index385.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index351.cjs"),a=require("./index278.cjs");function d(r){let i=!0,t="",e=0,n="",o=!1;for(let s=0;s<r.length;s++){const u=r[s];if(["(",")",","].includes(u)&&(i=!0),u==="("&&e++,u===")"&&e--,!!i){if(e===0){if(u===" "&&["event","function","error",""].includes(n))n="";else if(n+=u,u===")"){o=!0;break}continue}if(u===" "){r[s-1]!==","&&t!==","&&t!==",("&&(t="",i=!1);continue}n+=u,t+=u}}if(!o)throw new a.BaseError("Unable to normalize signature.");return n}function l(r,i){const t=typeof r,e=i.type;switch(e){case"address":return c.validate(r,{strict:!1});case"bool":return t==="boolean";case"function":return t==="string";case"string":return t==="string";default:return e==="tuple"&&"components"in i?Object.values(i.components).every((n,o)=>l(Object.values(r)[o],n)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(e)?t==="number"||t==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(e)?t==="string"||r instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(e)?Array.isArray(r)&&r.every(n=>l(n,{...i,type:e.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function f(r,i,t){for(const e in r){const n=r[e],o=i[e];if(n.type==="tuple"&&o.type==="tuple"&&"components"in n&&"components"in o)return f(n.components,o.components,t[e]);const s=[n.type,o.type];if(s.includes("address")&&s.includes("bytes20")?!0:s.includes("address")&&s.includes("string")?c.validate(t[e],{strict:!1}):s.includes("address")&&s.includes("bytes")?c.validate(t[e],{strict:!1}):!1)return s}}exports.getAmbiguousTypes=f;exports.isArgOfType=l;exports.normalizeSignature=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index386.cjs"),b=e.blake2b;exports.blake2b=b;
package/dist/index385.js CHANGED
@@ -1,65 +1,5 @@
1
- import { validate as c } from "./index351.js";
2
- import { BaseError as f } from "./index278.js";
3
- function y(r) {
4
- let i = !0, t = "", e = 0, n = "", o = !1;
5
- for (let s = 0; s < r.length; s++) {
6
- const u = r[s];
7
- if (["(", ")", ","].includes(u) && (i = !0), u === "(" && e++, u === ")" && e--, !!i) {
8
- if (e === 0) {
9
- if (u === " " && ["event", "function", "error", ""].includes(n))
10
- n = "";
11
- else if (n += u, u === ")") {
12
- o = !0;
13
- break;
14
- }
15
- continue;
16
- }
17
- if (u === " ") {
18
- r[s - 1] !== "," && t !== "," && t !== ",(" && (t = "", i = !1);
19
- continue;
20
- }
21
- n += u, t += u;
22
- }
23
- }
24
- if (!o)
25
- throw new f("Unable to normalize signature.");
26
- return n;
27
- }
28
- function l(r, i) {
29
- const t = typeof r, e = i.type;
30
- switch (e) {
31
- case "address":
32
- return c(r, { strict: !1 });
33
- case "bool":
34
- return t === "boolean";
35
- case "function":
36
- return t === "string";
37
- case "string":
38
- return t === "string";
39
- default:
40
- return e === "tuple" && "components" in i ? Object.values(i.components).every((n, o) => l(Object.values(r)[o], n)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(e) ? t === "number" || t === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(e) ? t === "string" || r instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(e) ? Array.isArray(r) && r.every((n) => l(n, {
41
- ...i,
42
- // Pop off `[]` or `[M]` from end of type
43
- type: e.replace(/(\[[0-9]{0,}\])$/, "")
44
- })) : !1;
45
- }
46
- }
47
- function a(r, i, t) {
48
- for (const e in r) {
49
- const n = r[e], o = i[e];
50
- if (n.type === "tuple" && o.type === "tuple" && "components" in n && "components" in o)
51
- return a(n.components, o.components, t[e]);
52
- const s = [n.type, o.type];
53
- if (s.includes("address") && s.includes("bytes20") ? !0 : s.includes("address") && s.includes("string") ? c(t[e], {
54
- strict: !1
55
- }) : s.includes("address") && s.includes("bytes") ? c(t[e], {
56
- strict: !1
57
- }) : !1)
58
- return s;
59
- }
60
- }
1
+ import { blake2b as b } from "./index386.js";
2
+ const e = b;
61
3
  export {
62
- a as getAmbiguousTypes,
63
- l as isArgOfType,
64
- y as normalizeSignature
4
+ e as blake2b
65
5
  };
package/dist/index6.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("zustand"),s=require("./index12.cjs"),i=require("@gardenfi/orderbook"),p=require("@gardenfi/utils"),u={id:i.ChainAsset.from(`${s.DEFAULT_NETWORK===p.Network.TESTNET?i.Chains.bitcoin_testnet:i.Chains.bitcoin}:btc`),name:"Bitcoin",decimals:8,symbol:"BTC",logo:"https://garden.imgix.net/token-images/bitcoin.svg",token:{address:"primary",schema:"primary"},htlc:{address:"primary",schema:"primary"},chain:s.DEFAULT_NETWORK===p.Network.TESTNET?i.Chains.bitcoin_testnet:i.Chains.bitcoin,price:115767.9,min_amount:"50000",max_amount:"10000000000"},w=f.create(t=>({inputAsset:u,inputAmount:"",outputAmount:"",solverId:"",rate:0,networkFees:0,btcAddress:"",isApproving:!1,isNetworkFeesLoading:!1,swapInProgress:{isOpen:!1,order:null},showBtcAddress:!1,showInputAddress:!1,showFeesAndRateDetails:!1,isSwapping:!1,tokenPrices:{input:"0",output:"0"},error:{inputError:s.Errors.none,outputError:s.Errors.none,liquidityError:s.Errors.none,insufficientBalanceError:s.Errors.none},isFetchingQuote:{input:!1,output:!1},isEditBTCAddress:!1,isComparisonVisible:!1,isValidBitcoinAddress:!1,showComparison:{isTime:!1,isFees:!1},maxTimeSaved:0,maxCostSaved:0,currentNetwork:s.DEFAULT_NETWORK,activeTab:s.tabs.swap,setSolverId:r=>{t({solverId:r})},setCurrentNetwork:r=>t({currentNetwork:r,inputAsset:{...u,chain:r===p.Network.MAINNET?i.Chains.bitcoin:i.Chains.bitcoin_testnet}}),setActiveTab:r=>{t({activeTab:r.id===s.tabs.swap.id?s.tabs.swap:s.tabs.history})},setAsset:(r,e)=>{t(n=>{const d=r===s.IOType.input,A=d?"inputAsset":"outputAsset",c=d?"outputAsset":"inputAsset",l=o=>{var m;return o!=null&&o.id&&typeof o.id.toString=="function"?o.id.toString():`${(o==null?void 0:o.chain)??""}:${((o==null?void 0:o.symbol)??"").toLowerCase()}:${(((m=o==null?void 0:o.token)==null?void 0:m.address)??"").toLowerCase()}`},a=n[c],E=!!e&&!!a&&l(e)===l(a);return{...n,[A]:e,[c]:E?void 0:a}})},setAmount:(r,e)=>{t(n=>({...n,[r===s.IOType.input?"inputAmount":"outputAmount"]:e}))},setRate:r=>{t(e=>({...e,rate:r}))},setShowBtcAddress:r=>t({showBtcAddress:r}),setShowInputAddress:r=>t({showInputAddress:r}),setShowFeesAndRateDetails:r=>t({showFeesAndRateDetails:r}),setNetworkFees:r=>{t(e=>({...e,networkFees:r}))},setIsNetworkFeesLoading:r=>{t({isNetworkFeesLoading:r})},setBtcAddress:r=>{t(e=>({...e,btcAddress:r}))},swapAssets:()=>{t(r=>{const e=!r.outputAmount||r.outputAmount==="0"?"":r.outputAmount,n=!r.inputAmount||r.inputAmount==="0"?"":r.outputAmount;return{...r,inputAsset:r.outputAsset,outputAsset:r.inputAsset,inputAmount:e,outputAmount:n,error:{...r.error,inputError:s.Errors.none,outputError:s.Errors.none,liquidityError:s.Errors.none,insufficientBalanceError:s.Errors.none}}})},setIsSwapping:r=>{t({isSwapping:r})},setIsEditBTCAddress:r=>{t({isEditBTCAddress:r})},setTokenPrices:r=>{t({tokenPrices:r})},setError:r=>{t(e=>({error:{...e.error,...r}}))},setIsFetchingQuote:r=>{t({isFetchingQuote:r})},setIsApproving:r=>{t({isApproving:r})},setIsComparisonVisible:r=>{t({isComparisonVisible:r})},setIsValidBitcoinAddress:r=>{t({isValidBitcoinAddress:r})},showComparisonHandler:r=>{t({isComparisonVisible:!0,showComparison:{isTime:r==="time",isFees:r==="fees"}})},hideComparison:()=>{t({isComparisonVisible:!1,showComparison:{isTime:!1,isFees:!1}})},updateComparisonSavings:(r,e)=>{t({maxTimeSaved:r,maxCostSaved:e})},clearSwapState:()=>{t({inputAmount:"",outputAmount:"",rate:0,btcAddress:"",outputAsset:void 0,inputAsset:u,isApproving:!1,isSwapping:!1,tokenPrices:{input:"0",output:"0"},error:{inputError:s.Errors.none,outputError:s.Errors.none,liquidityError:s.Errors.none,insufficientBalanceError:s.Errors.none},isFetchingQuote:{input:!1,output:!1},isEditBTCAddress:!1,isValidBitcoinAddress:!1,showComparison:{isTime:!1,isFees:!1},maxTimeSaved:0,maxCostSaved:0})},clear:()=>{t({inputAmount:"",outputAmount:"",btcAddress:"",rate:0,outputAsset:void 0,inputAsset:u,isSwapping:!1,isApproving:!1,tokenPrices:{input:"0",output:"0"},error:{inputError:s.Errors.none,outputError:s.Errors.none,liquidityError:s.Errors.none,insufficientBalanceError:s.Errors.none},isFetchingQuote:{input:!1,output:!1},isEditBTCAddress:!1,isValidBitcoinAddress:!1,showComparison:{isTime:!1,isFees:!1},maxTimeSaved:0,maxCostSaved:0})},clearSwapInputState:()=>{t({inputAmount:"",outputAmount:"",rate:0,tokenPrices:{input:"0",output:"0"},error:{inputError:s.Errors.none,outputError:s.Errors.none,liquidityError:s.Errors.none,insufficientBalanceError:s.Errors.none}})}}));exports.BTC=u;exports.swapStore=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("zustand"),t=require("./index12.cjs"),i=require("@gardenfi/orderbook"),n=require("@gardenfi/utils"),a={id:i.ChainAsset.from(`${t.DEFAULT_NETWORK===n.Network.TESTNET?i.Chains.bitcoin_testnet:t.DEFAULT_NETWORK===n.Network.LOCALNET?i.Chains.bitcoin_regtest:i.Chains.bitcoin}:btc`),name:"Bitcoin",decimals:8,symbol:"BTC",logo:"https://garden.imgix.net/token-images/bitcoin.svg",token:{address:"primary",schema:"primary"},htlc:{address:"primary",schema:"primary"},chain:t.DEFAULT_NETWORK===n.Network.TESTNET?i.Chains.bitcoin_testnet:t.DEFAULT_NETWORK===n.Network.LOCALNET?i.Chains.bitcoin_regtest:i.Chains.bitcoin,price:115767.9,min_amount:"50000",max_amount:"10000000000"},f=T.create(s=>({inputAsset:a,inputAmount:"",outputAmount:"",solverId:"",rate:0,networkFees:0,btcAddress:"",isApproving:!1,isNetworkFeesLoading:!1,swapInProgress:{isOpen:!1,order:null},showBtcAddress:!1,showInputAddress:!1,showFeesAndRateDetails:!1,isSwapping:!1,tokenPrices:{input:"0",output:"0"},error:{inputError:t.Errors.none,outputError:t.Errors.none,liquidityError:t.Errors.none,insufficientBalanceError:t.Errors.none},isFetchingQuote:{input:!1,output:!1},isEditBTCAddress:!1,isComparisonVisible:!1,isValidBitcoinAddress:!1,showComparison:{isTime:!1,isFees:!1},maxTimeSaved:0,maxCostSaved:0,currentNetwork:t.DEFAULT_NETWORK,activeTab:t.tabs.swap,setSolverId:r=>{s({solverId:r})},setCurrentNetwork:r=>s({currentNetwork:r,inputAsset:{...a,chain:r===n.Network.MAINNET?i.Chains.bitcoin:t.DEFAULT_NETWORK===n.Network.TESTNET?i.Chains.bitcoin_testnet:t.DEFAULT_NETWORK===n.Network.LOCALNET?i.Chains.bitcoin_regtest:i.Chains.bitcoin}}),setActiveTab:r=>{s({activeTab:r.id===t.tabs.swap.id?t.tabs.swap:t.tabs.history})},setAsset:(r,e)=>{s(u=>{const d=r===t.IOType.input,m=d?"inputAsset":"outputAsset",c=d?"outputAsset":"inputAsset",A=o=>{var l;return o!=null&&o.id&&typeof o.id.toString=="function"?o.id.toString():`${(o==null?void 0:o.chain)??""}:${((o==null?void 0:o.symbol)??"").toLowerCase()}:${(((l=o==null?void 0:o.token)==null?void 0:l.address)??"").toLowerCase()}`},p=u[c],E=!!e&&!!p&&A(e)===A(p);return{...u,[m]:e,[c]:E?void 0:p}})},setAmount:(r,e)=>{s(u=>({...u,[r===t.IOType.input?"inputAmount":"outputAmount"]:e}))},setRate:r=>{s(e=>({...e,rate:r}))},setShowBtcAddress:r=>s({showBtcAddress:r}),setShowInputAddress:r=>s({showInputAddress:r}),setShowFeesAndRateDetails:r=>s({showFeesAndRateDetails:r}),setNetworkFees:r=>{s(e=>({...e,networkFees:r}))},setIsNetworkFeesLoading:r=>{s({isNetworkFeesLoading:r})},setBtcAddress:r=>{s(e=>({...e,btcAddress:r}))},swapAssets:()=>{s(r=>{const e=!r.outputAmount||r.outputAmount==="0"?"":r.outputAmount,u=!r.inputAmount||r.inputAmount==="0"?"":r.outputAmount;return{...r,inputAsset:r.outputAsset,outputAsset:r.inputAsset,inputAmount:e,outputAmount:u,error:{...r.error,inputError:t.Errors.none,outputError:t.Errors.none,liquidityError:t.Errors.none,insufficientBalanceError:t.Errors.none}}})},setIsSwapping:r=>{s({isSwapping:r})},setIsEditBTCAddress:r=>{s({isEditBTCAddress:r})},setTokenPrices:r=>{s({tokenPrices:r})},setError:r=>{s(e=>({error:{...e.error,...r}}))},setIsFetchingQuote:r=>{s({isFetchingQuote:r})},setIsApproving:r=>{s({isApproving:r})},setIsComparisonVisible:r=>{s({isComparisonVisible:r})},setIsValidBitcoinAddress:r=>{s({isValidBitcoinAddress:r})},showComparisonHandler:r=>{s({isComparisonVisible:!0,showComparison:{isTime:r==="time",isFees:r==="fees"}})},hideComparison:()=>{s({isComparisonVisible:!1,showComparison:{isTime:!1,isFees:!1}})},updateComparisonSavings:(r,e)=>{s({maxTimeSaved:r,maxCostSaved:e})},clearSwapState:()=>{s({inputAmount:"",outputAmount:"",rate:0,btcAddress:"",outputAsset:void 0,inputAsset:a,isApproving:!1,isSwapping:!1,tokenPrices:{input:"0",output:"0"},error:{inputError:t.Errors.none,outputError:t.Errors.none,liquidityError:t.Errors.none,insufficientBalanceError:t.Errors.none},isFetchingQuote:{input:!1,output:!1},isEditBTCAddress:!1,isValidBitcoinAddress:!1,showComparison:{isTime:!1,isFees:!1},maxTimeSaved:0,maxCostSaved:0})},clear:()=>{s({inputAmount:"",outputAmount:"",btcAddress:"",rate:0,outputAsset:void 0,inputAsset:a,isSwapping:!1,isApproving:!1,tokenPrices:{input:"0",output:"0"},error:{inputError:t.Errors.none,outputError:t.Errors.none,liquidityError:t.Errors.none,insufficientBalanceError:t.Errors.none},isFetchingQuote:{input:!1,output:!1},isEditBTCAddress:!1,isValidBitcoinAddress:!1,showComparison:{isTime:!1,isFees:!1},maxTimeSaved:0,maxCostSaved:0})},clearSwapInputState:()=>{s({inputAmount:"",outputAmount:"",rate:0,tokenPrices:{input:"0",output:"0"},error:{inputError:t.Errors.none,outputError:t.Errors.none,liquidityError:t.Errors.none,insufficientBalanceError:t.Errors.none}})}}));exports.BTC=a;exports.swapStore=f;
package/dist/index6.js CHANGED
@@ -1,10 +1,10 @@
1
- import { create as T } from "zustand";
2
- import { tabs as u, DEFAULT_NETWORK as d, Errors as o, IOType as w } from "./index12.js";
3
- import { Chains as r, ChainAsset as S } from "@gardenfi/orderbook";
4
- import { Network as m } from "@gardenfi/utils";
5
- const p = {
6
- id: S.from(
7
- `${d === m.TESTNET ? r.bitcoin_testnet : r.bitcoin}:btc`
1
+ import { create as C } from "zustand";
2
+ import { tabs as a, DEFAULT_NETWORK as r, Errors as o, IOType as E } from "./index12.js";
3
+ import { Chains as n, ChainAsset as h } from "@gardenfi/orderbook";
4
+ import { Network as u } from "@gardenfi/utils";
5
+ const d = {
6
+ id: h.from(
7
+ `${r === u.TESTNET ? n.bitcoin_testnet : r === u.LOCALNET ? n.bitcoin_regtest : n.bitcoin}:btc`
8
8
  ),
9
9
  name: "Bitcoin",
10
10
  decimals: 8,
@@ -18,12 +18,12 @@ const p = {
18
18
  address: "primary",
19
19
  schema: "primary"
20
20
  },
21
- chain: d === m.TESTNET ? r.bitcoin_testnet : r.bitcoin,
21
+ chain: r === u.TESTNET ? n.bitcoin_testnet : r === u.LOCALNET ? n.bitcoin_regtest : n.bitcoin,
22
22
  price: 115767.9,
23
23
  min_amount: "50000",
24
24
  max_amount: "10000000000"
25
- }, B = T((e) => ({
26
- inputAsset: p,
25
+ }, B = C((e) => ({
26
+ inputAsset: d,
27
27
  inputAmount: "",
28
28
  outputAmount: "",
29
29
  solverId: "",
@@ -63,43 +63,43 @@ const p = {
63
63
  },
64
64
  maxTimeSaved: 0,
65
65
  maxCostSaved: 0,
66
- currentNetwork: d,
67
- activeTab: u.swap,
66
+ currentNetwork: r,
67
+ activeTab: a.swap,
68
68
  setSolverId: (t) => {
69
69
  e({ solverId: t });
70
70
  },
71
71
  setCurrentNetwork: (t) => e({
72
72
  currentNetwork: t,
73
73
  inputAsset: {
74
- ...p,
75
- chain: t === m.MAINNET ? r.bitcoin : r.bitcoin_testnet
74
+ ...d,
75
+ chain: t === u.MAINNET ? n.bitcoin : r === u.TESTNET ? n.bitcoin_testnet : r === u.LOCALNET ? n.bitcoin_regtest : n.bitcoin
76
76
  }
77
77
  }),
78
78
  setActiveTab: (t) => {
79
- e({ activeTab: t.id === u.swap.id ? u.swap : u.history });
79
+ e({ activeTab: t.id === a.swap.id ? a.swap : a.history });
80
80
  },
81
- setAsset: (t, s) => {
82
- e((n) => {
83
- const c = t === w.input, E = c ? "inputAsset" : "outputAsset", l = c ? "outputAsset" : "inputAsset", A = (i) => {
81
+ setAsset: (t, i) => {
82
+ e((p) => {
83
+ const c = t === E.input, w = c ? "inputAsset" : "outputAsset", A = c ? "outputAsset" : "inputAsset", l = (s) => {
84
84
  var f;
85
- return i != null && i.id && typeof i.id.toString == "function" ? i.id.toString() : `${(i == null ? void 0 : i.chain) ?? ""}:${((i == null ? void 0 : i.symbol) ?? "").toLowerCase()}:${(((f = i == null ? void 0 : i.token) == null ? void 0 : f.address) ?? "").toLowerCase()}`;
86
- }, a = n[l], h = !!s && !!a && A(s) === A(a);
85
+ return s != null && s.id && typeof s.id.toString == "function" ? s.id.toString() : `${(s == null ? void 0 : s.chain) ?? ""}:${((s == null ? void 0 : s.symbol) ?? "").toLowerCase()}:${(((f = s == null ? void 0 : s.token) == null ? void 0 : f.address) ?? "").toLowerCase()}`;
86
+ }, m = p[A], T = !!i && !!m && l(i) === l(m);
87
87
  return {
88
- ...n,
89
- [E]: s,
90
- [l]: h ? void 0 : a
88
+ ...p,
89
+ [w]: i,
90
+ [A]: T ? void 0 : m
91
91
  };
92
92
  });
93
93
  },
94
- setAmount: (t, s) => {
95
- e((n) => ({
96
- ...n,
97
- [t === w.input ? "inputAmount" : "outputAmount"]: s
94
+ setAmount: (t, i) => {
95
+ e((p) => ({
96
+ ...p,
97
+ [t === E.input ? "inputAmount" : "outputAmount"]: i
98
98
  }));
99
99
  },
100
100
  setRate: (t) => {
101
- e((s) => ({
102
- ...s,
101
+ e((i) => ({
102
+ ...i,
103
103
  rate: t
104
104
  }));
105
105
  },
@@ -107,8 +107,8 @@ const p = {
107
107
  setShowInputAddress: (t) => e({ showInputAddress: t }),
108
108
  setShowFeesAndRateDetails: (t) => e({ showFeesAndRateDetails: t }),
109
109
  setNetworkFees: (t) => {
110
- e((s) => ({
111
- ...s,
110
+ e((i) => ({
111
+ ...i,
112
112
  networkFees: t
113
113
  }));
114
114
  },
@@ -116,20 +116,20 @@ const p = {
116
116
  e({ isNetworkFeesLoading: t });
117
117
  },
118
118
  setBtcAddress: (t) => {
119
- e((s) => ({
120
- ...s,
119
+ e((i) => ({
120
+ ...i,
121
121
  btcAddress: t
122
122
  }));
123
123
  },
124
124
  swapAssets: () => {
125
125
  e((t) => {
126
- const s = !t.outputAmount || t.outputAmount === "0" ? "" : t.outputAmount, n = !t.inputAmount || t.inputAmount === "0" ? "" : t.outputAmount;
126
+ const i = !t.outputAmount || t.outputAmount === "0" ? "" : t.outputAmount, p = !t.inputAmount || t.inputAmount === "0" ? "" : t.outputAmount;
127
127
  return {
128
128
  ...t,
129
129
  inputAsset: t.outputAsset,
130
130
  outputAsset: t.inputAsset,
131
- inputAmount: s,
132
- outputAmount: n,
131
+ inputAmount: i,
132
+ outputAmount: p,
133
133
  error: {
134
134
  ...t.error,
135
135
  inputError: o.none,
@@ -150,7 +150,7 @@ const p = {
150
150
  e({ tokenPrices: t });
151
151
  },
152
152
  setError: (t) => {
153
- e((s) => ({ error: { ...s.error, ...t } }));
153
+ e((i) => ({ error: { ...i.error, ...t } }));
154
154
  },
155
155
  setIsFetchingQuote: (t) => {
156
156
  e({ isFetchingQuote: t });
@@ -182,10 +182,10 @@ const p = {
182
182
  }
183
183
  });
184
184
  },
185
- updateComparisonSavings: (t, s) => {
185
+ updateComparisonSavings: (t, i) => {
186
186
  e({
187
187
  maxTimeSaved: t,
188
- maxCostSaved: s
188
+ maxCostSaved: i
189
189
  });
190
190
  },
191
191
  clearSwapState: () => {
@@ -195,7 +195,7 @@ const p = {
195
195
  rate: 0,
196
196
  btcAddress: "",
197
197
  outputAsset: void 0,
198
- inputAsset: p,
198
+ inputAsset: d,
199
199
  isApproving: !1,
200
200
  isSwapping: !1,
201
201
  tokenPrices: {
@@ -229,7 +229,7 @@ const p = {
229
229
  btcAddress: "",
230
230
  rate: 0,
231
231
  outputAsset: void 0,
232
- inputAsset: p,
232
+ inputAsset: d,
233
233
  isSwapping: !1,
234
234
  isApproving: !1,
235
235
  tokenPrices: {
@@ -275,6 +275,6 @@ const p = {
275
275
  }
276
276
  }));
277
277
  export {
278
- p as BTC,
278
+ d as BTC,
279
279
  B as swapStore
280
280
  };
package/dist/index77.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("./index114.cjs"),V=require("./index304.cjs"),S=require("./index305.cjs"),et=require("./index117.cjs"),R=require("./index306.cjs"),T=require("./index307.cjs"),F=require("./index308.cjs"),nt=require("./index309.cjs"),$=require("./index310.cjs"),J=require("./index311.cjs"),st=require("./index312.cjs"),it=require("./index313.cjs"),_=require("./index314.cjs"),U=require("./index315.cjs"),rt=require("./index316.cjs");var Y=s=>{throw TypeError(s)},E=(s,t,e)=>t.has(s)||Y("Cannot "+e),n=(s,t,e)=>(E(s,t,"read from private field"),e?e.call(s):t.get(s)),w=(s,t,e)=>t.has(s)?Y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),l=(s,t,e,r)=>(E(s,t,"write to private field"),t.set(s,e),e),d=(s,t,e)=>(E(s,t,"access private method"),e),P,k,y,b,p,m,g,I,i,h,H,j,O,N,v,z,B,L,Q;function A(s,t=1/0){const e={$kind:"Result",get Result(){return typeof s=="function"?s():s}},r=[],a=o=>r[o]??(r[o]={$kind:"NestedResult",get NestedResult(){return[typeof s=="function"?s():s,o]}});return new Proxy(e,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(o,f){if(f in o)return Reflect.get(o,f);if(f===Symbol.iterator)return function*(){let c=0;for(;c<t;)yield a(c),c++};if(typeof f=="symbol")return;const u=parseInt(f,10);if(!(Number.isNaN(u)||u<0))return a(u)}})}const X=Symbol.for("@mysten/transaction");function Z(s){return!!s&&typeof s=="object"&&s[X]===!0}const K={buildPlugins:new Map,serializationPlugins:new Map},M=Symbol.for("@mysten/transaction/registry");function C(){try{const s=globalThis;return s[M]||(s[M]=K),s[M]}catch{return K}}const tt=class x{constructor(){w(this,h),w(this,P),w(this,k),w(this,y,new Map),w(this,b,[]),w(this,p,[]),w(this,m,new Set),w(this,g,new Set),w(this,I,new Map),w(this,i),this.object=st.createObjectMethods(e=>{var o,f;if(typeof e=="function")return this.object(this.add(e));if(typeof e=="object"&&S.is(T.ArgumentSchema,e))return e;const r=U.getIdFromCallArg(e),a=n(this,i).inputs.find(u=>r===U.getIdFromCallArg(u));return(o=a==null?void 0:a.Object)!=null&&o.SharedObject&&typeof e=="object"&&((f=e.Object)!=null&&f.SharedObject)&&(a.Object.SharedObject.mutable=a.Object.SharedObject.mutable||e.Object.SharedObject.mutable),a?{$kind:"Input",Input:n(this,i).inputs.indexOf(a),type:"object"}:d(this,h,O).call(this,"object",typeof e=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:et.normalizeSuiAddress(e)}}:e)});const t=C();l(this,i,new _.TransactionDataBuilder),l(this,k,[...t.buildPlugins.values()]),l(this,P,[...t.serializationPlugins.values()])}static fromKind(t){const e=new x;return l(e,i,_.TransactionDataBuilder.fromKindBytes(typeof t=="string"?W.fromBase64(t):t)),l(e,b,n(e,i).inputs.slice()),l(e,p,n(e,i).commands.slice()),l(e,m,new Set(n(e,p).map((r,a)=>a))),e}static from(t){const e=new x;return Z(t)?l(e,i,_.TransactionDataBuilder.restore(t.getData())):typeof t!="string"||!t.startsWith("{")?l(e,i,_.TransactionDataBuilder.fromBytes(typeof t=="string"?W.fromBase64(t):t)):l(e,i,_.TransactionDataBuilder.restore(JSON.parse(t))),l(e,b,n(e,i).inputs.slice()),l(e,p,n(e,i).commands.slice()),l(e,m,new Set(n(e,p).map((r,a)=>a))),e}static registerGlobalSerializationPlugin(t,e){C().serializationPlugins.set(t,e??t)}static unregisterGlobalSerializationPlugin(t){C().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,e){C().buildPlugins.set(t,e??t)}static unregisterGlobalBuildPlugin(t){C().buildPlugins.delete(t)}addSerializationPlugin(t){n(this,P).push(t)}addBuildPlugin(t){n(this,k).push(t)}addIntentResolver(t,e){if(n(this,y).has(t)&&n(this,y).get(t)!==e)throw new Error(`Intent resolver for ${t} already exists`);n(this,y).set(t,e)}setSender(t){n(this,i).sender=t}setSenderIfNotSet(t){n(this,i).sender||(n(this,i).sender=t)}setExpiration(t){n(this,i).expiration=t?S.parse(T.TransactionExpiration,t):null}setGasPrice(t){n(this,i).gasConfig.price=String(t)}setGasBudget(t){n(this,i).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){n(this,i).gasData.budget==null&&(n(this,i).gasConfig.budget=String(t))}setGasOwner(t){n(this,i).gasConfig.owner=t}setGasPayment(t){n(this,i).gasConfig.payment=t.map(e=>S.parse(T.ObjectRefSchema,e))}get blockData(){return F.serializeV1TransactionData(n(this,i).snapshot())}getData(){return n(this,i).snapshot()}get[X](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:it.createPure(t=>V.isSerializedBcs(t)?d(this,h,O).call(this,"pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):d(this,h,O).call(this,"pure",S.is(T.NormalizedCallArg,t)?S.parse(T.NormalizedCallArg,t):t instanceof Uint8Array?$.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object($.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object($.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object($.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function"){if(n(this,I).has(t))return n(this,I).get(t);const e=d(this,h,H).call(this),r=t(e);if(!(r&&typeof r=="object"&&"then"in r))return l(this,m,n(e,m)),n(this,I).set(t,r),r;const a=d(this,h,j).call(this,{$kind:"$Intent",$Intent:{name:"AsyncTransactionThunk",inputs:{},data:{resultIndex:n(this,i).commands.length,result:null}}});n(this,g).add(Promise.resolve(r).then(f=>{a.$Intent.data.result=f}));const o=A(()=>a.$Intent.data.resultIndex);return n(this,I).set(t,o),o}else d(this,h,j).call(this,t);return A(n(this,i).commands.length-1)}splitCoins(t,e){const r=R.Commands.SplitCoins(typeof t=="string"?this.object(t):d(this,h,v).call(this,t),e.map(a=>typeof a=="number"||typeof a=="bigint"||typeof a=="string"?this.pure.u64(a):d(this,h,N).call(this,a)));return d(this,h,j).call(this,r),A(n(this,i).commands.length-1,e.length)}mergeCoins(t,e){return this.add(R.Commands.MergeCoins(this.object(t),e.map(r=>this.object(r))))}publish({modules:t,dependencies:e}){return this.add(R.Commands.Publish({modules:t,dependencies:e}))}upgrade({modules:t,dependencies:e,package:r,ticket:a}){return this.add(R.Commands.Upgrade({modules:t,dependencies:e,package:r,ticket:this.object(a)}))}moveCall({arguments:t,...e}){return this.add(R.Commands.MoveCall({...e,arguments:t==null?void 0:t.map(r=>d(this,h,N).call(this,r))}))}transferObjects(t,e){return this.add(R.Commands.TransferObjects(t.map(r=>this.object(r)),typeof e=="string"?this.pure.address(e):d(this,h,N).call(this,e)))}makeMoveVec({type:t,elements:e}){return this.add(R.Commands.MakeMoveVec({type:t,elements:e.map(r=>this.object(r))}))}serialize(){return JSON.stringify(F.serializeV1TransactionData(n(this,i).snapshot()))}async toJSON(t={}){await this.prepareForSerialization(t);const e=this.isFullyResolved();return JSON.stringify(S.parse(nt.SerializedTransactionDataV2Schema,e?{...n(this,i).snapshot(),digest:n(this,i).getDigest()}:n(this,i).snapshot()),(r,a)=>typeof a=="bigint"?a.toString():a,2)}async sign(t){const{signer:e,...r}=t,a=await this.build(r);return e.signTransaction(a)}isFullyResolved(){return!(!n(this,i).sender||n(this,g).size>0||n(this,i).commands.some(t=>t.$Intent)||J.needsTransactionResolution(n(this,i),{}))}async build(t={}){return await this.prepareForSerialization(t),await d(this,h,z).call(this,t),n(this,i).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await this.prepareForSerialization(t),await d(this,h,z).call(this,t),n(this,i).getDigest()}async prepareForSerialization(t){var a;await d(this,h,L).call(this),d(this,h,Q).call(this);const e=new Set;for(const o of n(this,i).commands)o.$Intent&&e.add(o.$Intent.name);const r=[...n(this,P)];for(const o of e)if(!((a=t.supportedIntents)!=null&&a.includes(o))){if(!n(this,y).has(o))throw new Error(`Missing intent resolver for ${o}`);r.push(n(this,y).get(o))}r.push(rt.namedPackagesPlugin()),await d(this,h,B).call(this,r,t)}};P=new WeakMap;k=new WeakMap;y=new WeakMap;b=new WeakMap;p=new WeakMap;m=new WeakMap;g=new WeakMap;I=new WeakMap;i=new WeakMap;h=new WeakSet;H=function(){const s=new tt;return l(s,i,n(this,i)),l(s,P,n(this,P)),l(s,k,n(this,k)),l(s,y,n(this,y)),l(s,g,n(this,g)),l(s,m,new Set(n(this,m))),l(s,I,n(this,I)),n(this,b).push(n(s,b)),n(this,p).push(n(s,p)),s};j=function(s){const t=n(this,i).commands.length;return n(this,p).push(s),n(this,m).add(t),n(this,i).commands.push(s),n(this,i).mapCommandArguments(t,e=>{if(e.$kind==="Result"&&!n(this,m).has(e.Result))throw new Error(`Result { Result: ${e.Result} } is not available to use in the current transaction`);if(e.$kind==="NestedResult"&&!n(this,m).has(e.NestedResult[0]))throw new Error(`Result { NestedResult: [${e.NestedResult[0]}, ${e.NestedResult[1]}] } is not available to use in the current transaction`);if(e.$kind==="Input"&&e.Input>=n(this,i).inputs.length)throw new Error(`Input { Input: ${e.Input} } references an input that does not exist in the current transaction`);return e}),s};O=function(s,t){return n(this,b).push(t),n(this,i).addInput(s,t)};N=function(s){return V.isSerializedBcs(s)?this.pure(s):d(this,h,v).call(this,s)};v=function(s){if(typeof s=="function"){const t=this.add(s);return typeof t=="function"?d(this,h,v).call(this,t):S.parse(T.ArgumentSchema,t)}return S.parse(T.ArgumentSchema,s)};z=async function(s){if(!s.onlyTransactionKind&&!n(this,i).sender)throw new Error("Missing transaction sender");await d(this,h,B).call(this,[...n(this,k),J.resolveTransactionPlugin],s)};B=async function(s,t){try{const e=r=>{if(r>=s.length)return()=>{};const a=s[r];return async()=>{const o=e(r+1);let f=!1,u=!1;if(await a(n(this,i),t,async()=>{if(f)throw new Error(`next() was call multiple times in TransactionPlugin ${r}`);f=!0,await o(),u=!0}),!f)throw new Error(`next() was not called in TransactionPlugin ${r}`);if(!u)throw new Error(`next() was not awaited in TransactionPlugin ${r}`)}};await e(0)()}finally{l(this,b,n(this,i).inputs.slice()),l(this,p,n(this,i).commands.slice()),l(this,m,new Set(n(this,p).map((e,r)=>r)))}};L=async function(){for(;n(this,g).size>0;){const s=Promise.all(n(this,g));n(this,g).clear(),n(this,g).add(s),await s,n(this,g).delete(s)}};Q=function(){var f;const s=n(this,i).commands,t=n(this,i).inputs,e=n(this,p).flat(1/0),r=n(this,b).flat(1/0);if(e.length!==s.length)throw new Error("Unexpected number of commands found in transaction data");if(r.length!==t.length)throw new Error("Unexpected number of inputs found in transaction data");const a=e.filter(u=>{var c;return((c=u.$Intent)==null?void 0:c.name)!=="AsyncTransactionThunk"});n(this,i).commands=a,n(this,i).inputs=r,l(this,p,a),l(this,b,r),l(this,m,new Set(a.map((u,c)=>c)));function o(u){var q;const c=s[u];if(((q=c.$Intent)==null?void 0:q.name)==="AsyncTransactionThunk"){const G=c.$Intent.data.result;if(G==null)throw new Error("AsyncTransactionThunk has not been resolved");return o(G.Result)}const D=a.indexOf(c);if(D===-1)throw new Error("Unable to find original index for command");return D}n(this,i).mapArguments(u=>{if(u.$kind==="Input"){const c=r.indexOf(t[u.Input]);if(c===-1)throw new Error("Input has not been resolved");return{...u,Input:c}}else if(u.$kind==="Result"){const c=o(u.Result);return{...u,Result:c}}else if(u.$kind==="NestedResult"){const c=o(u.NestedResult[0]);return{...u,NestedResult:[c,u.NestedResult[1]]}}return u});for(const[u,c]of s.entries())if(((f=c.$Intent)==null?void 0:f.name)==="AsyncTransactionThunk")try{c.$Intent.data.resultIndex=o(u)}catch{}};let at=tt;exports.Transaction=at;exports.isTransaction=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("./index114.cjs"),V=require("./index316.cjs"),S=require("./index317.cjs"),et=require("./index117.cjs"),R=require("./index318.cjs"),T=require("./index319.cjs"),F=require("./index320.cjs"),nt=require("./index321.cjs"),$=require("./index322.cjs"),J=require("./index323.cjs"),st=require("./index324.cjs"),it=require("./index325.cjs"),_=require("./index326.cjs"),U=require("./index327.cjs"),rt=require("./index328.cjs");var Y=s=>{throw TypeError(s)},E=(s,t,e)=>t.has(s)||Y("Cannot "+e),n=(s,t,e)=>(E(s,t,"read from private field"),e?e.call(s):t.get(s)),w=(s,t,e)=>t.has(s)?Y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),l=(s,t,e,r)=>(E(s,t,"write to private field"),t.set(s,e),e),d=(s,t,e)=>(E(s,t,"access private method"),e),P,k,y,b,p,m,g,I,i,h,H,j,O,N,v,z,B,L,Q;function A(s,t=1/0){const e={$kind:"Result",get Result(){return typeof s=="function"?s():s}},r=[],a=o=>r[o]??(r[o]={$kind:"NestedResult",get NestedResult(){return[typeof s=="function"?s():s,o]}});return new Proxy(e,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(o,f){if(f in o)return Reflect.get(o,f);if(f===Symbol.iterator)return function*(){let c=0;for(;c<t;)yield a(c),c++};if(typeof f=="symbol")return;const u=parseInt(f,10);if(!(Number.isNaN(u)||u<0))return a(u)}})}const X=Symbol.for("@mysten/transaction");function Z(s){return!!s&&typeof s=="object"&&s[X]===!0}const K={buildPlugins:new Map,serializationPlugins:new Map},M=Symbol.for("@mysten/transaction/registry");function C(){try{const s=globalThis;return s[M]||(s[M]=K),s[M]}catch{return K}}const tt=class x{constructor(){w(this,h),w(this,P),w(this,k),w(this,y,new Map),w(this,b,[]),w(this,p,[]),w(this,m,new Set),w(this,g,new Set),w(this,I,new Map),w(this,i),this.object=st.createObjectMethods(e=>{var o,f;if(typeof e=="function")return this.object(this.add(e));if(typeof e=="object"&&S.is(T.ArgumentSchema,e))return e;const r=U.getIdFromCallArg(e),a=n(this,i).inputs.find(u=>r===U.getIdFromCallArg(u));return(o=a==null?void 0:a.Object)!=null&&o.SharedObject&&typeof e=="object"&&((f=e.Object)!=null&&f.SharedObject)&&(a.Object.SharedObject.mutable=a.Object.SharedObject.mutable||e.Object.SharedObject.mutable),a?{$kind:"Input",Input:n(this,i).inputs.indexOf(a),type:"object"}:d(this,h,O).call(this,"object",typeof e=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:et.normalizeSuiAddress(e)}}:e)});const t=C();l(this,i,new _.TransactionDataBuilder),l(this,k,[...t.buildPlugins.values()]),l(this,P,[...t.serializationPlugins.values()])}static fromKind(t){const e=new x;return l(e,i,_.TransactionDataBuilder.fromKindBytes(typeof t=="string"?W.fromBase64(t):t)),l(e,b,n(e,i).inputs.slice()),l(e,p,n(e,i).commands.slice()),l(e,m,new Set(n(e,p).map((r,a)=>a))),e}static from(t){const e=new x;return Z(t)?l(e,i,_.TransactionDataBuilder.restore(t.getData())):typeof t!="string"||!t.startsWith("{")?l(e,i,_.TransactionDataBuilder.fromBytes(typeof t=="string"?W.fromBase64(t):t)):l(e,i,_.TransactionDataBuilder.restore(JSON.parse(t))),l(e,b,n(e,i).inputs.slice()),l(e,p,n(e,i).commands.slice()),l(e,m,new Set(n(e,p).map((r,a)=>a))),e}static registerGlobalSerializationPlugin(t,e){C().serializationPlugins.set(t,e??t)}static unregisterGlobalSerializationPlugin(t){C().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,e){C().buildPlugins.set(t,e??t)}static unregisterGlobalBuildPlugin(t){C().buildPlugins.delete(t)}addSerializationPlugin(t){n(this,P).push(t)}addBuildPlugin(t){n(this,k).push(t)}addIntentResolver(t,e){if(n(this,y).has(t)&&n(this,y).get(t)!==e)throw new Error(`Intent resolver for ${t} already exists`);n(this,y).set(t,e)}setSender(t){n(this,i).sender=t}setSenderIfNotSet(t){n(this,i).sender||(n(this,i).sender=t)}setExpiration(t){n(this,i).expiration=t?S.parse(T.TransactionExpiration,t):null}setGasPrice(t){n(this,i).gasConfig.price=String(t)}setGasBudget(t){n(this,i).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){n(this,i).gasData.budget==null&&(n(this,i).gasConfig.budget=String(t))}setGasOwner(t){n(this,i).gasConfig.owner=t}setGasPayment(t){n(this,i).gasConfig.payment=t.map(e=>S.parse(T.ObjectRefSchema,e))}get blockData(){return F.serializeV1TransactionData(n(this,i).snapshot())}getData(){return n(this,i).snapshot()}get[X](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:it.createPure(t=>V.isSerializedBcs(t)?d(this,h,O).call(this,"pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):d(this,h,O).call(this,"pure",S.is(T.NormalizedCallArg,t)?S.parse(T.NormalizedCallArg,t):t instanceof Uint8Array?$.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object($.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object($.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object($.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function"){if(n(this,I).has(t))return n(this,I).get(t);const e=d(this,h,H).call(this),r=t(e);if(!(r&&typeof r=="object"&&"then"in r))return l(this,m,n(e,m)),n(this,I).set(t,r),r;const a=d(this,h,j).call(this,{$kind:"$Intent",$Intent:{name:"AsyncTransactionThunk",inputs:{},data:{resultIndex:n(this,i).commands.length,result:null}}});n(this,g).add(Promise.resolve(r).then(f=>{a.$Intent.data.result=f}));const o=A(()=>a.$Intent.data.resultIndex);return n(this,I).set(t,o),o}else d(this,h,j).call(this,t);return A(n(this,i).commands.length-1)}splitCoins(t,e){const r=R.Commands.SplitCoins(typeof t=="string"?this.object(t):d(this,h,v).call(this,t),e.map(a=>typeof a=="number"||typeof a=="bigint"||typeof a=="string"?this.pure.u64(a):d(this,h,N).call(this,a)));return d(this,h,j).call(this,r),A(n(this,i).commands.length-1,e.length)}mergeCoins(t,e){return this.add(R.Commands.MergeCoins(this.object(t),e.map(r=>this.object(r))))}publish({modules:t,dependencies:e}){return this.add(R.Commands.Publish({modules:t,dependencies:e}))}upgrade({modules:t,dependencies:e,package:r,ticket:a}){return this.add(R.Commands.Upgrade({modules:t,dependencies:e,package:r,ticket:this.object(a)}))}moveCall({arguments:t,...e}){return this.add(R.Commands.MoveCall({...e,arguments:t==null?void 0:t.map(r=>d(this,h,N).call(this,r))}))}transferObjects(t,e){return this.add(R.Commands.TransferObjects(t.map(r=>this.object(r)),typeof e=="string"?this.pure.address(e):d(this,h,N).call(this,e)))}makeMoveVec({type:t,elements:e}){return this.add(R.Commands.MakeMoveVec({type:t,elements:e.map(r=>this.object(r))}))}serialize(){return JSON.stringify(F.serializeV1TransactionData(n(this,i).snapshot()))}async toJSON(t={}){await this.prepareForSerialization(t);const e=this.isFullyResolved();return JSON.stringify(S.parse(nt.SerializedTransactionDataV2Schema,e?{...n(this,i).snapshot(),digest:n(this,i).getDigest()}:n(this,i).snapshot()),(r,a)=>typeof a=="bigint"?a.toString():a,2)}async sign(t){const{signer:e,...r}=t,a=await this.build(r);return e.signTransaction(a)}isFullyResolved(){return!(!n(this,i).sender||n(this,g).size>0||n(this,i).commands.some(t=>t.$Intent)||J.needsTransactionResolution(n(this,i),{}))}async build(t={}){return await this.prepareForSerialization(t),await d(this,h,z).call(this,t),n(this,i).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await this.prepareForSerialization(t),await d(this,h,z).call(this,t),n(this,i).getDigest()}async prepareForSerialization(t){var a;await d(this,h,L).call(this),d(this,h,Q).call(this);const e=new Set;for(const o of n(this,i).commands)o.$Intent&&e.add(o.$Intent.name);const r=[...n(this,P)];for(const o of e)if(!((a=t.supportedIntents)!=null&&a.includes(o))){if(!n(this,y).has(o))throw new Error(`Missing intent resolver for ${o}`);r.push(n(this,y).get(o))}r.push(rt.namedPackagesPlugin()),await d(this,h,B).call(this,r,t)}};P=new WeakMap;k=new WeakMap;y=new WeakMap;b=new WeakMap;p=new WeakMap;m=new WeakMap;g=new WeakMap;I=new WeakMap;i=new WeakMap;h=new WeakSet;H=function(){const s=new tt;return l(s,i,n(this,i)),l(s,P,n(this,P)),l(s,k,n(this,k)),l(s,y,n(this,y)),l(s,g,n(this,g)),l(s,m,new Set(n(this,m))),l(s,I,n(this,I)),n(this,b).push(n(s,b)),n(this,p).push(n(s,p)),s};j=function(s){const t=n(this,i).commands.length;return n(this,p).push(s),n(this,m).add(t),n(this,i).commands.push(s),n(this,i).mapCommandArguments(t,e=>{if(e.$kind==="Result"&&!n(this,m).has(e.Result))throw new Error(`Result { Result: ${e.Result} } is not available to use in the current transaction`);if(e.$kind==="NestedResult"&&!n(this,m).has(e.NestedResult[0]))throw new Error(`Result { NestedResult: [${e.NestedResult[0]}, ${e.NestedResult[1]}] } is not available to use in the current transaction`);if(e.$kind==="Input"&&e.Input>=n(this,i).inputs.length)throw new Error(`Input { Input: ${e.Input} } references an input that does not exist in the current transaction`);return e}),s};O=function(s,t){return n(this,b).push(t),n(this,i).addInput(s,t)};N=function(s){return V.isSerializedBcs(s)?this.pure(s):d(this,h,v).call(this,s)};v=function(s){if(typeof s=="function"){const t=this.add(s);return typeof t=="function"?d(this,h,v).call(this,t):S.parse(T.ArgumentSchema,t)}return S.parse(T.ArgumentSchema,s)};z=async function(s){if(!s.onlyTransactionKind&&!n(this,i).sender)throw new Error("Missing transaction sender");await d(this,h,B).call(this,[...n(this,k),J.resolveTransactionPlugin],s)};B=async function(s,t){try{const e=r=>{if(r>=s.length)return()=>{};const a=s[r];return async()=>{const o=e(r+1);let f=!1,u=!1;if(await a(n(this,i),t,async()=>{if(f)throw new Error(`next() was call multiple times in TransactionPlugin ${r}`);f=!0,await o(),u=!0}),!f)throw new Error(`next() was not called in TransactionPlugin ${r}`);if(!u)throw new Error(`next() was not awaited in TransactionPlugin ${r}`)}};await e(0)()}finally{l(this,b,n(this,i).inputs.slice()),l(this,p,n(this,i).commands.slice()),l(this,m,new Set(n(this,p).map((e,r)=>r)))}};L=async function(){for(;n(this,g).size>0;){const s=Promise.all(n(this,g));n(this,g).clear(),n(this,g).add(s),await s,n(this,g).delete(s)}};Q=function(){var f;const s=n(this,i).commands,t=n(this,i).inputs,e=n(this,p).flat(1/0),r=n(this,b).flat(1/0);if(e.length!==s.length)throw new Error("Unexpected number of commands found in transaction data");if(r.length!==t.length)throw new Error("Unexpected number of inputs found in transaction data");const a=e.filter(u=>{var c;return((c=u.$Intent)==null?void 0:c.name)!=="AsyncTransactionThunk"});n(this,i).commands=a,n(this,i).inputs=r,l(this,p,a),l(this,b,r),l(this,m,new Set(a.map((u,c)=>c)));function o(u){var q;const c=s[u];if(((q=c.$Intent)==null?void 0:q.name)==="AsyncTransactionThunk"){const G=c.$Intent.data.result;if(G==null)throw new Error("AsyncTransactionThunk has not been resolved");return o(G.Result)}const D=a.indexOf(c);if(D===-1)throw new Error("Unable to find original index for command");return D}n(this,i).mapArguments(u=>{if(u.$kind==="Input"){const c=r.indexOf(t[u.Input]);if(c===-1)throw new Error("Input has not been resolved");return{...u,Input:c}}else if(u.$kind==="Result"){const c=o(u.Result);return{...u,Result:c}}else if(u.$kind==="NestedResult"){const c=o(u.NestedResult[0]);return{...u,NestedResult:[c,u.NestedResult[1]]}}return u});for(const[u,c]of s.entries())if(((f=c.$Intent)==null?void 0:f.name)==="AsyncTransactionThunk")try{c.$Intent.data.resultIndex=o(u)}catch{}};let at=tt;exports.Transaction=at;exports.isTransaction=Z;
package/dist/index77.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import { fromBase64 as F } from "./index114.js";
2
- import { isSerializedBcs as q } from "./index304.js";
3
- import { parse as P, is as U } from "./index305.js";
2
+ import { isSerializedBcs as q } from "./index316.js";
3
+ import { parse as P, is as U } from "./index317.js";
4
4
  import { normalizeSuiAddress as et } from "./index117.js";
5
- import { Commands as S } from "./index306.js";
6
- import { ArgumentSchema as x, TransactionExpiration as nt, ObjectRefSchema as st, NormalizedCallArg as K } from "./index307.js";
7
- import { serializeV1TransactionData as J } from "./index308.js";
8
- import { SerializedTransactionDataV2Schema as it } from "./index309.js";
9
- import { Inputs as $ } from "./index310.js";
10
- import { needsTransactionResolution as rt, resolveTransactionPlugin as at } from "./index311.js";
11
- import { createObjectMethods as ot } from "./index312.js";
12
- import { createPure as lt } from "./index313.js";
13
- import { TransactionDataBuilder as T } from "./index314.js";
14
- import { getIdFromCallArg as V } from "./index315.js";
15
- import { namedPackagesPlugin as ut } from "./index316.js";
5
+ import { Commands as S } from "./index318.js";
6
+ import { ArgumentSchema as x, TransactionExpiration as nt, ObjectRefSchema as st, NormalizedCallArg as K } from "./index319.js";
7
+ import { serializeV1TransactionData as J } from "./index320.js";
8
+ import { SerializedTransactionDataV2Schema as it } from "./index321.js";
9
+ import { Inputs as $ } from "./index322.js";
10
+ import { needsTransactionResolution as rt, resolveTransactionPlugin as at } from "./index323.js";
11
+ import { createObjectMethods as ot } from "./index324.js";
12
+ import { createPure as lt } from "./index325.js";
13
+ import { TransactionDataBuilder as T } from "./index326.js";
14
+ import { getIdFromCallArg as V } from "./index327.js";
15
+ import { namedPackagesPlugin as ut } from "./index328.js";
16
16
  var H = (s) => {
17
17
  throw TypeError(s);
18
18
  }, z = (s, t, e) => t.has(s) || H("Cannot " + e), n = (s, t, e) => (z(s, t, "read from private field"), e ? e.call(s) : t.get(s)), w = (s, t, e) => t.has(s) ? H("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), u = (s, t, e, r) => (z(s, t, "write to private field"), t.set(s, e), e), d = (s, t, e) => (z(s, t, "access private method"), e), I, k, y, b, p, m, g, R, i, c, L, j, O, N, C, A, G, Q, X;
package/dist/index9.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),v=require("@gardenfi/garden-book"),T=require("@gardenfi/react-hooks"),b=require("./index23.cjs"),A=require("./index24.cjs"),k=require("./index6.cjs"),q=require("./index25.cjs"),s=require("./index12.cjs"),M=({isOpen:n=!0})=>{const[o,r]=e.useState(!1),{evmAddress:d,bitcoinAddress:u,solanaAddress:f,suiAddress:m,starknetAddress:g}=q.useAddresses(),[H,h]=e.useState({bitcoin:"",evm:"",starknet:"",solana:"",sui:"",tron:"",litecoin:"",alpen_signet:"",xrpl:"",spark:""}),{garden:t}=T.useGarden(),{fetchTransactions:a,totalItems:l,transactions:c,loadMore:w}=b.transactionHistoryStore(),{showFeesAndRateDetails:y,showBtcAddress:x}=k.swapStore(),E=e.useMemo(()=>c.length<l,[c.length,l]),S=async()=>{if(t){r(!0);try{await w(t,H)}finally{r(!1)}}};if(e.useEffect(()=>{if(!t||!n)return;const i={bitcoin:u||"",evm:d||"",starknet:g||"",solana:f||"",sui:m||"",tron:"",litecoin:"",alpen_signet:"",xrpl:"",spark:""};h(i),a(t,i)},[t,n,a]),!n)return null;const p=(y?x?s.HEIGHTS.large:s.HEIGHTS.medium:s.HEIGHTS.small)-s.BUFFER_HEIGHT.small;return e.createElement("div",{className:"flex flex-col h-full w-full gap-3 overflow-y-auto"},e.createElement("div",{className:"scrollbar-hide flex flex-1 flex-col gap-5 overflow-y-auto h-full items-center rounded-2xl pb-6",style:{minHeight:p}},e.createElement("div",{className:"flex flex-col rounded-2xl w-full bg-white/50"},e.createElement(A.Transactions,null)),E&&e.createElement(v.Button,{onClick:S,variant:o?"disabled":"secondary",className:"mx-auto min-h-10 w-1/4"},o?"Loading...":"Load More")))};exports.TransactionHistory=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),v=require("@gardenfi/garden-book"),T=require("@gardenfi/react-hooks"),b=require("./index23.cjs"),A=require("./index24.cjs"),k=require("./index6.cjs"),q=require("./index25.cjs"),s=require("./index12.cjs"),M=({isOpen:n=!0})=>{const[o,r]=e.useState(!1),{evmAddress:d,bitcoinAddress:u,solanaAddress:f,suiAddress:m,starknetAddress:g}=q.useAddresses(),[h,H]=e.useState({bitcoin:"",evm:"",starknet:"",solana:"",sui:"",tron:"",litecoin:"",alpen_signet:"",xrpl:"",spark:"",lightning:""}),{garden:t}=T.useGarden(),{fetchTransactions:a,totalItems:l,transactions:i,loadMore:w}=b.transactionHistoryStore(),{showFeesAndRateDetails:y,showBtcAddress:x}=k.swapStore(),E=e.useMemo(()=>i.length<l,[i.length,l]),S=async()=>{if(t){r(!0);try{await w(t,h)}finally{r(!1)}}};if(e.useEffect(()=>{if(!t||!n)return;const c={bitcoin:u||"",evm:d||"",starknet:g||"",solana:f||"",sui:m||"",tron:"",litecoin:"",alpen_signet:"",xrpl:"",spark:"",lightning:""};H(c),a(t,c)},[t,n,a]),!n)return null;const p=(y?x?s.HEIGHTS.large:s.HEIGHTS.medium:s.HEIGHTS.small)-s.BUFFER_HEIGHT.small;return e.createElement("div",{className:"flex flex-col h-full w-full gap-3 overflow-y-auto"},e.createElement("div",{className:"scrollbar-hide flex flex-1 flex-col gap-5 overflow-y-auto h-full items-center rounded-2xl pb-6",style:{minHeight:p}},e.createElement("div",{className:"flex flex-col rounded-2xl w-full bg-white/50"},e.createElement(A.Transactions,null)),E&&e.createElement(v.Button,{onClick:S,variant:o?"disabled":"secondary",className:"mx-auto min-h-10 w-1/4"},o?"Loading...":"Load More")))};exports.TransactionHistory=M;
package/dist/index9.js CHANGED
@@ -9,12 +9,12 @@ import { HEIGHTS as o, BUFFER_HEIGHT as B } from "./index12.js";
9
9
  const j = ({
10
10
  isOpen: s = !0
11
11
  }) => {
12
- const [r, a] = d(!1), {
12
+ const [n, r] = d(!1), {
13
13
  evmAddress: m,
14
14
  bitcoinAddress: f,
15
15
  solanaAddress: u,
16
- suiAddress: p,
17
- starknetAddress: g
16
+ suiAddress: g,
17
+ starknetAddress: p
18
18
  } = S(), [h, w] = d({
19
19
  bitcoin: "",
20
20
  evm: "",
@@ -25,17 +25,18 @@ const j = ({
25
25
  litecoin: "",
26
26
  alpen_signet: "",
27
27
  xrpl: "",
28
- spark: ""
29
- }), { garden: e } = L(), { fetchTransactions: n, totalItems: l, transactions: i, loadMore: x } = T(), { showFeesAndRateDetails: v, showBtcAddress: y } = N(), E = b(
28
+ spark: "",
29
+ lightning: ""
30
+ }), { garden: e } = L(), { fetchTransactions: a, totalItems: l, transactions: i, loadMore: x } = T(), { showFeesAndRateDetails: v, showBtcAddress: y } = N(), E = b(
30
31
  () => i.length < l,
31
32
  [i.length, l]
32
33
  ), A = async () => {
33
34
  if (e) {
34
- a(!0);
35
+ r(!0);
35
36
  try {
36
37
  await x(e, h);
37
38
  } finally {
38
- a(!1);
39
+ r(!1);
39
40
  }
40
41
  }
41
42
  };
@@ -44,17 +45,18 @@ const j = ({
44
45
  const c = {
45
46
  bitcoin: f || "",
46
47
  evm: m || "",
47
- starknet: g || "",
48
+ starknet: p || "",
48
49
  solana: u || "",
49
- sui: p || "",
50
+ sui: g || "",
50
51
  tron: "",
51
52
  litecoin: "",
52
53
  alpen_signet: "",
53
54
  xrpl: "",
54
- spark: ""
55
+ spark: "",
56
+ lightning: ""
55
57
  };
56
- w(c), n(e, c);
57
- }, [e, s, n]), !s) return null;
58
+ w(c), a(e, c);
59
+ }, [e, s, a]), !s) return null;
58
60
  const H = (v ? y ? o.large : o.medium : o.small) - B.small;
59
61
  return /* @__PURE__ */ t.createElement("div", { className: "flex flex-col h-full w-full gap-3 overflow-y-auto" }, /* @__PURE__ */ t.createElement(
60
62
  "div",
@@ -67,10 +69,10 @@ const j = ({
67
69
  k,
68
70
  {
69
71
  onClick: A,
70
- variant: r ? "disabled" : "secondary",
72
+ variant: n ? "disabled" : "secondary",
71
73
  className: "mx-auto min-h-10 w-1/4"
72
74
  },
73
- r ? "Loading..." : "Load More"
75
+ n ? "Loading..." : "Load More"
74
76
  )
75
77
  ));
76
78
  };
@@ -88,7 +88,7 @@ export declare const BTC: {
88
88
  address: string;
89
89
  schema: string;
90
90
  };
91
- chain: "solana_localnet" | "arbitrum_localnet" | "ethereum_localnet" | "bitcoin_regtest" | "starknet_devnet" | "solana_testnet" | "bitcoin_testnet" | "ethereum_sepolia" | "arbitrum_sepolia" | "base_sepolia" | "bera_testnet" | "citrea" | "citrea_testnet" | "monad_testnet" | "starknet_sepolia" | "sui_testnet" | "hyperliquid_testnet" | "bnbchain_testnet" | "alpen_signet" | "litecoin_testnet" | "alpen_testnet" | "tron_shasta" | "bitcoin" | "base" | "monad" | "arbitrum" | "ethereum" | "solana" | "bera" | "starknet" | "sui" | "hyperevm" | "unichain" | "corn" | "botanix" | "bnbchain" | "core" | "tron" | "spark" | "spark_regtest" | "litecoin" | "megaeth" | "hyperliquid" | "xrpl" | "xrpl_testnet" | "hypercore" | "hypercore_testnet";
91
+ chain: "solana_localnet" | "arbitrum_localnet" | "ethereum_localnet" | "bitcoin_regtest" | "starknet_devnet" | "solana_testnet" | "bitcoin_testnet" | "ethereum_sepolia" | "arbitrum_sepolia" | "base_sepolia" | "bera_testnet" | "citrea" | "citrea_testnet" | "monad_testnet" | "starknet_sepolia" | "sui_testnet" | "hyperliquid_testnet" | "bnbchain_testnet" | "alpen_signet" | "litecoin_testnet" | "alpen_testnet" | "tron_shasta" | "bitcoin" | "base" | "monad" | "arbitrum" | "ethereum" | "solana" | "bera" | "starknet" | "sui" | "hyperevm" | "unichain" | "corn" | "botanix" | "bnbchain" | "core" | "tron" | "spark" | "spark_regtest" | "lightning" | "litecoin" | "megaeth" | "hyperevm_testnet" | "hyperliquid" | "xrpl" | "xrpl_testnet" | "hypercore" | "hypercore_testnet";
92
92
  price: number;
93
93
  min_amount: string;
94
94
  max_amount: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/swap",
3
- "version": "0.1.2",
3
+ "version": "0.1.3-beta.10",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",
@@ -29,11 +29,11 @@
29
29
  "registry": "https://registry.npmjs.org/"
30
30
  },
31
31
  "dependencies": {
32
- "@gardenfi/core": "3.1.2",
32
+ "@gardenfi/core": "3.1.3-beta.10",
33
33
  "@gardenfi/garden-book": "0.2.2",
34
- "@gardenfi/orderbook": "3.1.2",
35
- "@gardenfi/react-hooks": "3.1.2",
36
- "@gardenfi/utils": "3.1.1",
34
+ "@gardenfi/orderbook": "3.1.3-beta.10",
35
+ "@gardenfi/react-hooks": "3.1.3-beta.10",
36
+ "@gardenfi/utils": "3.1.1-beta.8",
37
37
  "@mysten/sui": "^1.37.2",
38
38
  "@number-flow/react": "^0.5.9",
39
39
  "@solana/web3.js": "^1.98.2",