@gardenfi/swap 0.1.0 → 0.1.1
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.
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +2 -2
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +2 -2
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +6 -6
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +2 -2
- package/dist/index109.cjs +1 -1
- package/dist/index109.js +41 -34
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +33 -3
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +3 -9
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +9 -116
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +116 -61
- package/dist/index114.cjs +1 -1
- package/dist/index114.js +57 -20
- package/dist/index115.cjs +1 -1
- package/dist/index115.js +22 -34
- package/dist/index116.cjs +1 -1
- package/dist/index116.js +33 -38
- package/dist/index117.cjs +1 -1
- package/dist/index117.js +38 -55
- package/dist/index118.cjs +1 -1
- package/dist/index118.js +55 -37
- package/dist/index119.cjs +1 -1
- package/dist/index119.js +40 -9
- package/dist/index120.cjs +1 -1
- package/dist/index120.js +8 -30
- package/dist/index121.cjs +1 -1
- package/dist/index121.js +21 -26
- package/dist/index122.cjs +1 -1
- package/dist/index122.js +35 -8
- package/dist/index123.cjs +1 -1
- package/dist/index123.js +8 -28
- package/dist/index124.cjs +1 -1
- package/dist/index124.js +27 -48
- package/dist/index125.cjs +1 -1
- package/dist/index125.js +47 -67
- package/dist/index126.cjs +1 -1
- package/dist/index126.js +67 -38
- package/dist/index127.cjs +1 -1
- package/dist/index127.js +38 -74
- package/dist/index128.cjs +1 -1
- package/dist/index128.js +77 -8
- package/dist/index129.cjs +1 -1
- package/dist/index129.js +7 -5
- package/dist/index130.cjs +1 -1
- package/dist/index130.js +6 -17
- package/dist/index131.cjs +1 -1
- package/dist/index131.js +17 -8
- package/dist/index132.cjs +1 -1
- package/dist/index132.js +8 -13
- package/dist/index133.cjs +1 -1
- package/dist/index133.js +13 -7
- package/dist/index134.cjs +1 -1
- package/dist/index134.js +7 -16
- package/dist/index135.cjs +1 -1
- package/dist/index135.js +16 -46
- package/dist/index136.cjs +1 -1
- package/dist/index136.js +46 -13
- package/dist/index137.cjs +1 -1
- package/dist/index137.js +13 -16
- package/dist/index138.cjs +1 -1
- package/dist/index138.js +14 -11
- package/dist/index139.cjs +1 -1
- package/dist/index139.js +13 -6
- package/dist/index140.cjs +1 -1
- package/dist/index140.js +5 -34
- package/dist/index141.cjs +1 -1
- package/dist/index141.js +34 -8
- package/dist/index142.cjs +1 -1
- package/dist/index142.js +8 -7
- package/dist/index143.cjs +1 -1
- package/dist/index143.js +8 -29
- package/dist/index144.cjs +1 -1
- package/dist/index144.js +29 -10
- package/dist/index145.cjs +1 -1
- package/dist/index145.js +10 -14
- package/dist/index146.cjs +1 -1
- package/dist/index146.js +14 -12
- package/dist/index147.cjs +1 -1
- package/dist/index147.js +12 -121
- package/dist/index148.cjs +1 -1
- package/dist/index148.js +118 -79
- package/dist/index149.cjs +1 -1
- package/dist/index149.js +81 -176
- package/dist/index150.cjs +1 -1
- package/dist/index150.js +174 -41
- package/dist/index151.cjs +1 -1
- package/dist/index151.js +44 -6
- package/dist/index152.cjs +1 -1
- package/dist/index152.js +5 -13
- package/dist/index153.cjs +1 -1
- package/dist/index153.js +12 -12
- package/dist/index154.cjs +1 -1
- package/dist/index154.js +14 -103
- package/dist/index155.cjs +1 -1
- package/dist/index155.js +100 -72
- package/dist/index156.cjs +1 -1
- package/dist/index156.js +64 -78
- package/dist/index157.cjs +1 -1
- package/dist/index157.js +76 -138
- package/dist/index158.cjs +1 -1
- package/dist/index158.js +115 -102
- package/dist/index159.cjs +1 -1
- package/dist/index159.js +116 -47
- package/dist/index160.cjs +1 -1
- package/dist/index160.js +69 -23
- package/dist/index161.cjs +1 -1
- package/dist/index161.js +23 -164
- package/dist/index162.cjs +1 -1
- package/dist/index162.js +164 -6
- package/dist/index163.cjs +1 -1
- package/dist/index163.js +6 -13
- package/dist/index164.cjs +1 -1
- package/dist/index164.js +13 -19
- package/dist/index165.cjs +1 -1
- package/dist/index165.js +18 -105
- package/dist/index166.cjs +1 -1
- package/dist/index166.js +105 -77
- package/dist/index167.cjs +1 -1
- package/dist/index167.js +77 -8
- package/dist/index168.cjs +1 -1
- package/dist/index168.js +8 -27
- package/dist/index169.cjs +1 -1
- package/dist/index169.js +25 -87
- package/dist/index170.cjs +1 -1
- package/dist/index170.js +91 -3
- package/dist/index171.cjs +1 -1
- package/dist/index171.js +3 -2
- package/dist/index172.cjs +1 -2
- package/dist/index172.js +2 -3
- package/dist/index173.cjs +2 -1
- package/dist/index173.js +3 -9
- package/dist/index174.cjs +1 -20
- package/dist/index174.js +9 -327
- package/dist/index175.cjs +20 -1
- package/dist/index175.js +324 -11
- package/dist/index176.cjs +1 -2
- package/dist/index176.js +12 -58
- package/dist/index177.cjs +2 -1
- package/dist/index177.js +60 -2
- package/dist/index178.cjs +1 -1
- package/dist/index178.js +2 -8
- package/dist/index179.cjs +1 -1
- package/dist/index179.js +8 -32
- package/dist/index180.cjs +1 -1
- package/dist/index180.js +32 -22
- package/dist/index181.cjs +1 -1
- package/dist/index181.js +21 -5
- package/dist/index182.cjs +1 -1
- package/dist/index182.js +5 -73
- package/dist/index183.cjs +1 -1
- package/dist/index183.js +73 -5
- package/dist/index184.cjs +1 -1
- package/dist/index184.js +4 -4
- package/dist/index185.cjs +1 -9
- package/dist/index185.js +5 -35
- package/dist/index186.cjs +9 -2
- package/dist/index186.js +28 -113
- package/dist/index187.cjs +2 -1
- package/dist/index187.js +121 -3
- package/dist/index188.cjs +1 -1
- package/dist/index188.js +3 -19
- package/dist/index189.cjs +1 -1
- package/dist/index189.js +13 -28
- package/dist/index190.cjs +1 -1
- package/dist/index190.js +31 -33
- package/dist/index191.cjs +1 -1
- package/dist/index191.js +33 -21
- package/dist/index192.cjs +1 -1
- package/dist/index192.js +20 -5
- package/dist/index193.cjs +1 -4
- package/dist/index193.js +6 -192
- package/dist/index194.cjs +4 -1
- package/dist/index194.js +195 -2
- package/dist/index195.cjs +1 -3
- package/dist/index195.js +2 -452
- package/dist/index196.cjs +3 -1
- package/dist/index196.js +443 -19
- package/dist/index197.cjs +1 -1
- package/dist/index197.js +19 -153
- package/dist/index198.cjs +1 -1
- package/dist/index198.js +158 -124
- package/dist/index199.cjs +1 -1
- package/dist/index199.js +127 -38
- package/dist/index200.cjs +1 -1
- package/dist/index200.js +35 -24
- package/dist/index201.cjs +1 -1
- package/dist/index201.js +24 -52
- package/dist/index202.cjs +1 -1
- package/dist/index202.js +55 -191
- package/dist/index203.cjs +1 -1
- package/dist/index203.js +192 -4
- package/dist/index204.cjs +1 -1
- package/dist/index204.js +4 -74
- package/dist/index205.cjs +1 -1
- package/dist/index205.js +69 -16
- package/dist/index206.cjs +1 -1
- package/dist/index206.js +21 -3
- package/dist/index207.cjs +1 -1
- package/dist/index207.js +3 -17
- package/dist/index208.cjs +1 -1
- package/dist/index208.js +16 -23
- package/dist/index209.cjs +1 -1
- package/dist/index209.js +22 -33
- package/dist/index210.cjs +1 -1
- package/dist/index210.js +35 -3
- package/dist/index211.cjs +1 -1
- package/dist/index211.js +3 -28
- package/dist/index212.cjs +1 -1
- package/dist/index212.js +25 -34
- package/dist/index213.cjs +1 -1
- package/dist/index213.js +36 -8
- package/dist/index214.cjs +1 -1
- package/dist/index214.js +8 -25
- package/dist/index215.cjs +1 -1
- package/dist/index215.js +20 -23
- package/dist/index216.cjs +1 -1
- package/dist/index216.js +27 -74
- package/dist/index217.cjs +1 -1
- package/dist/index217.js +73 -19
- package/dist/index218.cjs +1 -1
- package/dist/index218.js +21 -8
- package/dist/index219.cjs +1 -1
- package/dist/index219.js +8 -10
- package/dist/index220.cjs +1 -1
- package/dist/index220.js +10 -11
- package/dist/index221.cjs +1 -1
- package/dist/index221.js +11 -6
- package/dist/index222.cjs +1 -1
- package/dist/index222.js +6 -6
- package/dist/index223.cjs +1 -1
- package/dist/index223.js +6 -13
- package/dist/index224.cjs +1 -1
- package/dist/index224.js +12 -31
- package/dist/index225.cjs +1 -1
- package/dist/index225.js +33 -5
- package/dist/index226.cjs +1 -1
- package/dist/index226.js +5 -38
- package/dist/index227.cjs +1 -1
- package/dist/index227.js +32 -106
- package/dist/index228.cjs +1 -1
- package/dist/index228.js +106 -44
- package/dist/index229.cjs +1 -1
- package/dist/index229.js +48 -31
- package/dist/index230.cjs +1 -1
- package/dist/index230.js +32 -8
- package/dist/index231.cjs +1 -1
- package/dist/index231.js +8 -7
- package/dist/index232.cjs +1 -1
- package/dist/index232.js +7 -16
- package/dist/index233.cjs +1 -1
- package/dist/index233.js +16 -22
- package/dist/index234.cjs +1 -1
- package/dist/index234.js +22 -104
- package/dist/index235.cjs +1 -1
- package/dist/index235.js +105 -3
- package/dist/index236.cjs +1 -1
- package/dist/index236.js +3 -6
- package/dist/index237.cjs +1 -1
- package/dist/index237.js +5 -31
- package/dist/index238.cjs +1 -1
- package/dist/index238.js +31 -20
- package/dist/index239.cjs +1 -1
- package/dist/index239.js +20 -3
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +2 -2
- package/dist/index240.cjs +1 -1
- package/dist/index240.js +3 -17
- package/dist/index241.cjs +1 -1
- package/dist/index241.js +17 -5
- package/dist/index242.cjs +1 -1
- package/dist/index242.js +5 -8
- package/dist/index243.cjs +1 -1
- package/dist/index243.js +8 -103
- package/dist/index244.cjs +1 -1
- package/dist/index244.js +99 -60
- package/dist/index245.cjs +1 -1
- package/dist/index245.js +64 -6
- package/dist/index246.cjs +1 -1
- package/dist/index246.js +6 -27
- package/dist/index247.cjs +1 -1
- package/dist/index247.js +27 -34
- package/dist/index248.cjs +1 -1
- package/dist/index248.js +34 -16
- package/dist/index249.cjs +1 -1
- package/dist/index249.js +14 -76
- package/dist/index250.cjs +1 -1
- package/dist/index250.js +79 -2
- package/dist/index251.cjs +1 -1
- package/dist/index251.js +2 -15
- package/dist/index252.cjs +1 -1
- package/dist/index252.js +14 -18
- package/dist/index253.cjs +1 -1
- package/dist/index253.js +15 -14
- package/dist/index254.cjs +1 -1
- package/dist/index254.js +17 -10
- package/dist/index255.cjs +1 -1
- package/dist/index255.js +10 -79
- package/dist/index256.cjs +1 -1
- package/dist/index256.js +80 -3
- package/dist/index257.cjs +1 -1
- package/dist/index257.js +3 -33
- package/dist/index258.cjs +1 -1
- package/dist/index258.js +28 -111
- package/dist/index259.cjs +1 -1
- package/dist/index259.js +116 -4
- package/dist/index260.cjs +1 -1
- package/dist/index260.js +4 -16
- package/dist/index261.cjs +1 -1
- package/dist/index261.js +14 -10
- package/dist/index262.cjs +1 -1
- package/dist/index262.js +11 -18
- package/dist/index263.cjs +1 -1
- package/dist/index263.js +17 -57
- package/dist/index264.cjs +1 -1
- package/dist/index264.js +57 -19
- package/dist/index265.cjs +1 -1
- package/dist/index265.js +21 -14
- package/dist/index266.cjs +1 -1
- package/dist/index266.js +13 -284
- package/dist/index267.cjs +1 -1
- package/dist/index267.js +256 -545
- package/dist/index268.cjs +1 -1
- package/dist/index268.js +570 -37
- package/dist/index269.cjs +1 -1
- package/dist/index269.js +1 -1
- package/dist/index270.cjs +1 -1
- package/dist/index270.js +2 -2
- package/dist/index275.cjs +1 -1
- package/dist/index275.js +2 -2
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +1 -1
- package/dist/index299.cjs +1 -1
- package/dist/index299.js +37 -7
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +2 -2
- package/dist/index300.cjs +1 -1
- package/dist/index300.js +14 -36
- package/dist/index301.cjs +1 -1
- package/dist/index301.js +8 -15
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +7 -8
- package/dist/index303.cjs +1 -1
- package/dist/index303.js +1 -1
- package/dist/index304.cjs +1 -1
- package/dist/index304.js +2 -2
- package/dist/index306.cjs +1 -1
- package/dist/index306.js +2 -2
- package/dist/index307.cjs +1 -1
- package/dist/index307.js +2 -2
- package/dist/index308.cjs +1 -1
- package/dist/index308.js +1 -1
- package/dist/index315.cjs +1 -1
- package/dist/index315.js +1 -1
- package/dist/index320.cjs +1 -1
- package/dist/index320.js +2 -2
- package/dist/index322.cjs +1 -1
- package/dist/index322.js +1 -1
- package/dist/index326.cjs +1 -1
- package/dist/index326.js +3 -3
- package/dist/index328.cjs +1 -1
- package/dist/index328.js +2 -2
- package/dist/index329.cjs +1 -1
- package/dist/index329.js +1 -1
- package/dist/index330.cjs +1 -1
- package/dist/index330.js +1 -1
- package/dist/index332.cjs +1 -1
- package/dist/index332.js +2 -2
- package/dist/index336.cjs +1 -1
- package/dist/index336.js +2 -2
- package/dist/index337.cjs +1 -1
- package/dist/index337.js +1 -1
- package/dist/index338.cjs +1 -1
- package/dist/index338.js +1 -1
- package/dist/index339.cjs +1 -1
- package/dist/index339.js +3 -3
- package/dist/index343.cjs +1 -1
- package/dist/index343.js +1 -1
- package/dist/index344.cjs +1 -1
- package/dist/index344.js +3 -3
- package/dist/index347.cjs +1 -1
- package/dist/index347.js +1 -1
- package/dist/index356.cjs +1 -1
- package/dist/index356.js +2 -2
- package/dist/index362.cjs +1 -1
- package/dist/index362.js +1 -1
- package/dist/index373.cjs +1 -1
- package/dist/index373.js +1 -1
- package/dist/index376.cjs +1 -1
- package/dist/index376.js +4 -4
- package/dist/index378.cjs +1 -1
- package/dist/index378.js +1 -1
- package/dist/index379.cjs +1 -1
- package/dist/index379.js +1 -1
- package/dist/index380.cjs +1 -1
- package/dist/index380.js +1 -1
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +83 -24
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +11 -15
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +24 -103
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +16 -86
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +105 -11
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +2 -2
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +5 -5
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +1 -1
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +10 -10
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +2 -2
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +1 -1
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +1 -1
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +1 -1
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +3 -3
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +9 -9
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +1 -1
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +1 -1
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +14 -12
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +13 -13
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +2 -2
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +2 -2
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +3 -3
- package/dist/src/lib/store/swapStore.d.ts +1 -1
- package/package.json +5 -5
package/dist/index275.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InvalidAddressError as a } from "./index78.js";
|
|
2
|
-
import { InvalidBytesLengthError as d } from "./
|
|
3
|
-
import { AccountStateConflictError as u, StateAssignmentConflictError as h } from "./
|
|
2
|
+
import { InvalidBytesLengthError as d } from "./index189.js";
|
|
3
|
+
import { AccountStateConflictError as u, StateAssignmentConflictError as h } from "./index186.js";
|
|
4
4
|
import { isAddress as l } from "./index79.js";
|
|
5
5
|
import { numberToHex as c } from "./index81.js";
|
|
6
6
|
function s(r) {
|
package/dist/index29.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),n=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),n=require("./index41.cjs"),s=({open:e,onClose:t,children:o})=>r.createElement(n.BottomSheet,{open:e,onClose:t},o);exports.ResponsiveModal=s;
|
package/dist/index29.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import r from "react";
|
|
2
|
-
import { BottomSheet as m } from "./
|
|
2
|
+
import { BottomSheet as m } from "./index41.js";
|
|
3
3
|
const a = ({ open: e, onClose: t, children: o }) => /* @__PURE__ */ r.createElement(m, { open: e, onClose: t }, o);
|
|
4
4
|
export {
|
|
5
5
|
a as ResponsiveModal
|
package/dist/index299.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=new Map,r=new Map;let b=0;function w(s,a,C){const o=++b,c=()=>i.get(s)||[],m=()=>{const t=c();i.set(s,t.filter(n=>n.id!==o))},f=()=>{const t=c();if(!t.some(e=>e.id===o))return;const n=r.get(s);if(t.length===1&&n){const e=n();e instanceof Promise&&e.catch(()=>{})}m()},l=c();if(i.set(s,[...l,{id:o,fns:a}]),l&&l.length>0)return f;const u={};for(const t in a)u[t]=(...n)=>{var p,g;const e=c();if(e.length!==0)for(const y of e)(g=(p=y.fns)[t])==null||g.call(p,...n)};const h=C(u);return typeof h=="function"&&r.set(s,h),f}exports.cleanupCache=r;exports.listenersCache=i;exports.observe=w;
|
package/dist/index299.js
CHANGED
|
@@ -1,10 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const f = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
|
2
|
+
let k = 0;
|
|
3
|
+
function y(s, l, m) {
|
|
4
|
+
const i = ++k, c = () => f.get(s) || [], w = () => {
|
|
5
|
+
const n = c();
|
|
6
|
+
f.set(s, n.filter((e) => e.id !== i));
|
|
7
|
+
}, r = () => {
|
|
8
|
+
const n = c();
|
|
9
|
+
if (!n.some((t) => t.id === i))
|
|
10
|
+
return;
|
|
11
|
+
const e = g.get(s);
|
|
12
|
+
if (n.length === 1 && e) {
|
|
13
|
+
const t = e();
|
|
14
|
+
t instanceof Promise && t.catch(() => {
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
w();
|
|
18
|
+
}, o = c();
|
|
19
|
+
if (f.set(s, [
|
|
20
|
+
...o,
|
|
21
|
+
{ id: i, fns: l }
|
|
22
|
+
]), o && o.length > 0)
|
|
23
|
+
return r;
|
|
24
|
+
const u = {};
|
|
25
|
+
for (const n in l)
|
|
26
|
+
u[n] = (...e) => {
|
|
27
|
+
var p, h;
|
|
28
|
+
const t = c();
|
|
29
|
+
if (t.length !== 0)
|
|
30
|
+
for (const C of t)
|
|
31
|
+
(h = (p = C.fns)[n]) == null || h.call(p, ...e);
|
|
32
|
+
};
|
|
33
|
+
const a = m(u);
|
|
34
|
+
return typeof a == "function" && g.set(s, a), r;
|
|
7
35
|
}
|
|
8
36
|
export {
|
|
9
|
-
|
|
37
|
+
g as cleanupCache,
|
|
38
|
+
f as listenersCache,
|
|
39
|
+
y as observe
|
|
10
40
|
};
|
package/dist/index30.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react"),se=require("./index6.cjs"),ae=require("./index7.cjs"),re=require("./
|
|
1
|
+
"use strict";const e=require("react"),se=require("./index6.cjs"),ae=require("./index7.cjs"),re=require("./index42.cjs"),o=require("@gardenfi/garden-book"),L=require("framer-motion"),ie=require("./index43.cjs"),oe=require("@gardenfi/utils"),le=require("./index34.cjs"),d=require("./index12.cjs"),ce=require("@gardenfi/orderbook"),ue=require("./index25.cjs"),me=({onSelect:O})=>{const{inputAsset:S,outputAsset:T,currentNetwork:R,showFeesAndRateDetails:j,showBtcAddress:G}=se.swapStore(),{allAssets:b,chains:r,modalOpenFor:f,isAssetModalOpen:w,closeAssetModal:N,balances:v}=ae.assetInfoStore(),{evmAddress:U,bitcoinAddress:W,starknetAddress:D,suiAddress:K,solanaAddress:P}=ue.useAddresses(),[s,p]=e.useState(),[k,I]=e.useState(""),[A,q]=e.useState(),[B,$]=e.useState(),[V,H]=e.useState(""),[h]=e.useState(5),M=e.useRef(null),[y,g]=e.useState(!1),z=typeof window<"u"?window.innerWidth<768:!1,_=(j?G?d.HEIGHTS.large:d.HEIGHTS.medium:d.HEIGHTS.small)-d.BUFFER_HEIGHT.large,l=e.useMemo(()=>{const t=["bitcoin","ethereum","solana","base","arbitrum","starknet"];return r?[...r].sort((a,c)=>{const i=t.findIndex(m=>a.chainName.toLowerCase().includes(m)),u=t.findIndex(m=>c.chainName.toLowerCase().includes(m));return i===-1?1:u===-1?-1:i-u}):[]},[r]),J=e.useMemo(()=>f===d.IOType.input?T:S,[f,S,T]),C=e.useMemo(()=>{const t=k?B:A;return!t&&l.length===0?[]:t&&t.sort((n,a)=>{const c=r==null?void 0:r.find(u=>u.chain===n.chain),i=r==null?void 0:r.find(u=>u.chain===a.chain);if(c&&i){const u=l.findIndex(E=>E.chain===c.chain),m=l.findIndex(E=>E.chain===i.chain);return u-m}return 0}).filter(n=>!s||n.chain===s.chain).map(n=>{const a=r==null?void 0:r.find(ne=>ne.chain===n.chain),c=ce.ChainAsset.from(n).toString(),i=v==null?void 0:v[c],u=n.price??0,m=i&&n&&i.toString()==="0"?"":i?le.formatAmount(i.toString(),n.decimals,Math.min(n.decimals,8)):void 0,E=m&&(Number(m)*Number(u)).toFixed(5);return{asset:n,network:a,formattedBalance:m,fiatBalance:E}})},[B,A,l,r,s,v,k]),F=!!U||!!W||!!D||!!P||!!K,x=e.useMemo(()=>F?C&&[...C].sort((t,n)=>{const a=t.fiatBalance?Number(t.fiatBalance):0;return(n.fiatBalance?Number(n.fiatBalance):0)-a}):C,[C,F]),Q=e.useMemo(()=>{const t=l.slice(0,h);return s&&!t.find(n=>n.chain===s.chain)?[s,...t.slice(0,h-1)]:t},[l,h,s]),X=t=>{if(!A)return;const n=t.target.value.toLowerCase();if(I(n),!n){$(void 0);return}$(A.filter(a=>{var c,i;return((c=a.name)==null?void 0:c.toLowerCase().includes(n))||((i=a.symbol)==null?void 0:i.toLowerCase().includes(n))}))},Y=()=>g(!1),Z=t=>{(s==null?void 0:s.chain)===t.chain?p(void 0):p(t),g(!1)},ee=t=>{O(t),N(),setTimeout(()=>{p(void 0),I("")},700),g(!1)},te=()=>{N(),setTimeout(()=>{p(void 0),I("")},700),g(!1)};return e.useEffect(()=>{if(!b)return;const t=f===d.IOType.input?T:S;if(!t||f===d.IOType.input)q([...b]);else{const n=b.filter(a=>`${a.chain}-${a.symbol}`!=`${t.chain}-${t.symbol}`);q([...n,t])}},[b,J,f]),e.useEffect(()=>{w||(g(!1),N())},[N,w]),e.useEffect(()=>{w&&M.current&&setTimeout(()=>{var t;return(t=M.current)==null?void 0:t.focus()},100)},[w]),e.createElement(e.Fragment,null,y&&e.createElement(ie.AvailableChainsSidebar,{show:y,chains:[...l],hide:Y,onClick:Z}),e.createElement(L.AnimatePresence,{mode:"wait"},e.createElement(L.motion.div,{key:"assetModal",initial:{opacity:1},animate:{opacity:y?0:1},transition:{duration:y?.32:.45,delay:y?0:.25,ease:"easeOut"},className:"left-auto top-60 z-30 flex flex-col gap-3 rounded-[20px] w-full"},e.createElement("div",{className:"flex items-center justify-between p-1"},e.createElement(o.Typography,{size:"h4",weight:"medium"},`Select token to ${f===d.IOType.input?"send":"receive"}`),e.createElement(o.CloseIcon,{className:"hidden cursor-pointer sm:visible sm:block",onClick:te})),e.createElement("div",{className:"flex w-full flex-wrap gap-3"},e.createElement("div",{className:`flex w-full ${z?"gap-2":"gap-3"}`},Q.map((t,n)=>e.createElement("button",{key:t.chainId,className:`relative flex h-12 flex-1 items-center justify-center gap-2 overflow-visible rounded-xl outline-none duration-300 ease-in-out ${!s||t.chain!==s.chain?"!bg-white/50":"!bg-white"}`,onMouseEnter:()=>H(t.chainName),onMouseLeave:()=>H(""),onClick:()=>s&&t.chain===s.chain?p(void 0):p(t)},e.createElement("img",{src:t.iconUrl,alt:t.chainName,className:"h-5 w-5 rounded-full"}),V===t.chainName&&e.createElement(re.ChainsTooltip,{chain:t.chainName,className:`${R===oe.Network.TESTNET?n===0?"translate-x-7":l.length-h===0&&n===h-1&&z?"-translate-x-4":"":""}`}))),l.length>h&&e.createElement("button",{className:"h-12 w-12 cursor-pointer flex items-center justify-center rounded-xl !bg-white/50 p-4 duration-300 ease-in-out",onClick:()=>g(!0)},e.createElement(o.Typography,{size:"h4",weight:"regular",className:"!flex !cursor-pointer !items-center !text-mid-grey !text-center"},"+",l.length-h)))),e.createElement("div",{className:"flex w-full items-center justify-between rounded-2xl bg-white/50 px-4 py-[10px]"},e.createElement("div",{className:"flex flex-grow items-center"},e.createElement(o.Typography,{size:"h4",weight:"regular",className:"gf-w-full"},e.createElement("input",{ref:M,className:"w-full bg-transparent outline-none placeholder:text-mid-grey focus:outline-none",type:"text",value:k,placeholder:"Search assets",onChange:X}))),e.createElement(o.SearchIcon,null)),e.createElement("div",{className:"flex h-full flex-col overflow-auto rounded-2xl !bg-white"},e.createElement("div",{className:"px-4 pb-2 pt-2"},e.createElement(o.Typography,{size:"h5",weight:"medium"},s?`Assets on ${s.chainName}`:"Assets")),e.createElement(o.GradientScroll,{height:_,gradientHeight:42,onClose:!w},x&&x.length>0?x==null?void 0:x.map(({asset:t,network:n,formattedBalance:a})=>e.createElement("div",{key:`${t.chain}-${t.symbol}`,className:"flex w-full cursor-pointer items-center justify-between gap-2 px-4 py-1.5 hover:bg-[#f4f0fc]",onClick:()=>ee(t)},e.createElement("div",{className:"flex w-full items-center gap-2"},e.createElement("div",{className:"w-10"},e.createElement(o.TokenNetworkLogos,{tokenLogo:t.icon,chainLogo:n==null?void 0:n.iconUrl})),e.createElement(o.Typography,{className:"w-2/3",size:"h5",breakpoints:{sm:"h4"},weight:"regular"},t.name)),e.createElement("div",{className:"flex items-center gap-1"},a&&e.createElement(o.Typography,{size:"h5",breakpoints:{sm:"h4"},weight:"regular",className:"!text-mid-grey"},a),e.createElement(o.Typography,{size:"h5",breakpoints:{sm:"h4"},weight:"regular",className:"!text-mid-grey"},t.symbol)))):e.createElement("div",{className:"flex min-h-[274px] w-full items-center justify-center"},e.createElement(o.Typography,{size:"h4",weight:"regular"},"No assets found.")))))))};module.exports=me;
|
package/dist/index30.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import t, { useState as f, useRef as ie, useMemo as N, useEffect as F } from "react";
|
|
2
2
|
import { swapStore as oe } from "./index6.js";
|
|
3
3
|
import { assetInfoStore as le } from "./index7.js";
|
|
4
|
-
import { ChainsTooltip as ce } from "./
|
|
4
|
+
import { ChainsTooltip as ce } from "./index42.js";
|
|
5
5
|
import { Typography as u, CloseIcon as me, SearchIcon as ue, GradientScroll as de, TokenNetworkLogos as fe } from "@gardenfi/garden-book";
|
|
6
6
|
import { AnimatePresence as he, motion as pe } from "framer-motion";
|
|
7
|
-
import { AvailableChainsSidebar as ge } from "./
|
|
7
|
+
import { AvailableChainsSidebar as ge } from "./index43.js";
|
|
8
8
|
import { Network as we } from "@gardenfi/utils";
|
|
9
9
|
import { formatAmount as xe } from "./index34.js";
|
|
10
10
|
import { IOType as k, HEIGHTS as L, BUFFER_HEIGHT as be } from "./index12.js";
|
package/dist/index300.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index240.cjs");function s(o,{emitOnBegin:w,initialWaitTime:t,interval:c}){let l=!0;const a=()=>l=!1;return(async()=>{let e;w&&(e=await o({unpoll:a}));const r=await(t==null?void 0:t(e))??c;await u.wait(r);const n=async()=>{l&&(await o({unpoll:a}),await u.wait(c),n())};n()})(),a}exports.poll=s;
|
package/dist/index300.js
CHANGED
|
@@ -1,40 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (n.length === 1 && e) {
|
|
13
|
-
const t = e();
|
|
14
|
-
t instanceof Promise && t.catch(() => {
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
w();
|
|
18
|
-
}, o = c();
|
|
19
|
-
if (f.set(s, [
|
|
20
|
-
...o,
|
|
21
|
-
{ id: i, fns: l }
|
|
22
|
-
]), o && o.length > 0)
|
|
23
|
-
return r;
|
|
24
|
-
const u = {};
|
|
25
|
-
for (const n in l)
|
|
26
|
-
u[n] = (...e) => {
|
|
27
|
-
var p, h;
|
|
28
|
-
const t = c();
|
|
29
|
-
if (t.length !== 0)
|
|
30
|
-
for (const C of t)
|
|
31
|
-
(h = (p = C.fns)[n]) == null || h.call(p, ...e);
|
|
1
|
+
import { wait as r } from "./index240.js";
|
|
2
|
+
function e(o, { emitOnBegin: s, initialWaitTime: t, interval: c }) {
|
|
3
|
+
let w = !0;
|
|
4
|
+
const a = () => w = !1;
|
|
5
|
+
return (async () => {
|
|
6
|
+
let n;
|
|
7
|
+
s && (n = await o({ unpoll: a }));
|
|
8
|
+
const u = await (t == null ? void 0 : t(n)) ?? c;
|
|
9
|
+
await r(u);
|
|
10
|
+
const l = async () => {
|
|
11
|
+
w && (await o({ unpoll: a }), await r(c), l());
|
|
32
12
|
};
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
l();
|
|
14
|
+
})(), a;
|
|
35
15
|
}
|
|
36
16
|
export {
|
|
37
|
-
|
|
38
|
-
f as listenersCache,
|
|
39
|
-
y as observe
|
|
17
|
+
e as poll
|
|
40
18
|
};
|
package/dist/index301.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}exports.withResolvers=i;
|
package/dist/index301.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const u = await (t == null ? void 0 : t(n)) ?? c;
|
|
9
|
-
await r(u);
|
|
10
|
-
const l = async () => {
|
|
11
|
-
w && (await o({ unpoll: a }), await r(c), l());
|
|
12
|
-
};
|
|
13
|
-
l();
|
|
14
|
-
})(), a;
|
|
1
|
+
function i() {
|
|
2
|
+
let e = () => {
|
|
3
|
+
}, n = () => {
|
|
4
|
+
};
|
|
5
|
+
return { promise: new Promise((r, o) => {
|
|
6
|
+
e = r, n = o;
|
|
7
|
+
}), resolve: e, reject: n };
|
|
15
8
|
}
|
|
16
9
|
export {
|
|
17
|
-
|
|
10
|
+
i as withResolvers
|
|
18
11
|
};
|
package/dist/index302.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(e,{method:u}){var s,o;const r={};return e.transport.type==="fallback"&&((o=(s=e.transport).onResponse)==null||o.call(s,({method:t,response:a,status:c,transport:n})=>{c==="success"&&u===t&&(r[a]=n.request)})),t=>r[t]||e.request}exports.createFilterRequestScope=p;
|
package/dist/index302.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}), resolve: e, reject: n };
|
|
1
|
+
function c(e, { method: p }) {
|
|
2
|
+
var r, o;
|
|
3
|
+
const t = {};
|
|
4
|
+
return e.transport.type === "fallback" && ((o = (r = e.transport).onResponse) == null || o.call(r, ({ method: s, response: n, status: u, transport: a }) => {
|
|
5
|
+
u === "success" && p === s && (t[n] = a.request);
|
|
6
|
+
})), (s) => t[s] || e.request;
|
|
8
7
|
}
|
|
9
8
|
export {
|
|
10
|
-
|
|
9
|
+
c as createFilterRequestScope
|
|
11
10
|
};
|
package/dist/index303.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index177.cjs"),i=require("./index94.cjs");function f(e){var t,o,a,n,s,u;if(!(e instanceof c.BaseError))return!1;const r=e.walk(l=>l instanceof i.ContractFunctionRevertedError);return r instanceof i.ContractFunctionRevertedError?((t=r.data)==null?void 0:t.errorName)==="HttpError"||((o=r.data)==null?void 0:o.errorName)==="ResolverError"||((a=r.data)==null?void 0:a.errorName)==="ResolverNotContract"||((n=r.data)==null?void 0:n.errorName)==="ResolverNotFound"||((s=r.data)==null?void 0:s.errorName)==="ReverseAddressMismatch"||((u=r.data)==null?void 0:u.errorName)==="UnsupportedResolverProfile":!1}exports.isNullUniversalResolverError=f;
|
package/dist/index303.js
CHANGED
package/dist/index304.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index202.cjs"),a=require("./index361.cjs"),c=require("./index231.cjs");function h(i){const r=i.replace(/^\.|\.$/gm,"");if(r.length===0)return new Uint8Array(1);const e=new Uint8Array(l.stringToBytes(r).byteLength+2);let t=0;const o=r.split(".");for(let s=0;s<o.length;s++){let n=l.stringToBytes(o[s]);n.byteLength>255&&(n=l.stringToBytes(a.encodeLabelhash(c.labelhash(o[s])))),e[t]=n.length,e.set(n,t+1),t+=n.length+1}return e.byteLength!==t+1?e.slice(0,t+1):e}exports.packetToBytes=h;
|
package/dist/index304.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { stringToBytes as i } from "./
|
|
1
|
+
import { stringToBytes as i } from "./index202.js";
|
|
2
2
|
import { encodeLabelhash as h } from "./index361.js";
|
|
3
|
-
import { labelhash as f } from "./
|
|
3
|
+
import { labelhash as f } from "./index231.js";
|
|
4
4
|
function y(s) {
|
|
5
5
|
const o = s.replace(/^\.|\.$/gm, "");
|
|
6
6
|
if (o.length === 0)
|
package/dist/index306.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index191.cjs"),i=require("./index194.cjs"),u=require("./index270.cjs");function a(e,{docsPath:o,...r}){const n=(()=>{const t=u.getNodeError(e,r);return t instanceof i.UnknownNodeError?e:t})();return new s.EstimateGasExecutionError(n,{docsPath:o,...r})}exports.getEstimateGasError=a;
|
package/dist/index306.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EstimateGasExecutionError as i } from "./
|
|
2
|
-
import { UnknownNodeError as m } from "./
|
|
1
|
+
import { EstimateGasExecutionError as i } from "./index191.js";
|
|
2
|
+
import { UnknownNodeError as m } from "./index194.js";
|
|
3
3
|
import { getNodeError as s } from "./index270.js";
|
|
4
4
|
function a(r, { docsPath: e, ...o }) {
|
|
5
5
|
const n = (() => {
|
package/dist/index307.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index194.cjs"),i=require("./index187.cjs"),s=require("./index270.cjs");function u(r,{docsPath:o,...e}){const t=(()=>{const n=s.getNodeError(r,e);return n instanceof c.UnknownNodeError?r:n})();return new i.TransactionExecutionError(t,{docsPath:o,...e})}exports.getTransactionError=u;
|
package/dist/index307.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UnknownNodeError as c } from "./
|
|
2
|
-
import { TransactionExecutionError as i } from "./
|
|
1
|
+
import { UnknownNodeError as c } from "./index194.js";
|
|
2
|
+
import { TransactionExecutionError as i } from "./index187.js";
|
|
3
3
|
import { getNodeError as u } from "./index270.js";
|
|
4
4
|
function s(r, { docsPath: t, ...o }) {
|
|
5
5
|
const e = (() => {
|
package/dist/index308.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index177.cjs");class e extends t.BaseError{constructor({address:o}){super(`No EIP-712 domain found on contract "${o}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${o}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}exports.Eip712DomainNotFoundError=e;
|
package/dist/index308.js
CHANGED
package/dist/index315.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index218.cjs"),t=new o.LruMap(8192);function i(r,{enabled:n=!0,id:e}){if(!n||!e)return r();if(t.get(e))return t.get(e);const u=r().finally(()=>t.delete(e));return t.set(e,u),u}exports.promiseCache=t;exports.withDedupe=i;
|
package/dist/index315.js
CHANGED
package/dist/index320.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index202.cjs"),r=require("./index214.cjs"),c=e=>r.keccak256(t.toBytes(e));function n(e){return c(e)}exports.hashSignature=n;
|
package/dist/index320.js
CHANGED
package/dist/index322.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index177.cjs");function a(r){let l=!0,i="",o=0,t="",u=!1;for(let n=0;n<r.length;n++){const e=r[n];if(["(",")",","].includes(e)&&(l=!0),e==="("&&o++,e===")"&&o--,!!l){if(o===0){if(e===" "&&["event","function",""].includes(t))t="";else if(t+=e,e===")"){u=!0;break}continue}if(e===" "){r[n-1]!==","&&i!==","&&i!==",("&&(i="",l=!1);continue}t+=e,i+=e}}if(!u)throw new f.BaseError("Unable to normalize signature.");return t}exports.normalizeSignature=a;
|
package/dist/index322.js
CHANGED
package/dist/index326.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./index260.cjs"),E=require("./index261.cjs"),S=require("./index262.cjs"),k=require("./index369.cjs"),O=require("./index370.cjs"),I=require("./index371.cjs");var x=s=>{throw TypeError(s)},$=(s,r,e)=>r.has(s)||x("Cannot "+e),d=(s,r,e)=>($(s,r,"read from private field"),e?e.call(s):r.get(s)),B=(s,r,e)=>r.has(s)?x("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(s):r.set(s,e),m=(s,r,e,i)=>($(s,r,"write to private field"),r.set(s,e),e),u,f,z,h;const j=class b{constructor(r){B(this,u),B(this,f),this.name=r.name,this.read=r.read,this.serializedSize=r.serializedSize??(()=>null),m(this,u,r.write),m(this,f,r.serialize??((e,i)=>{const t=new I.BcsWriter({initialSize:this.serializedSize(e)??void 0,...i});return d(this,u).call(this,e,t),t.toBytes()})),this.validate=r.validate??(()=>{})}write(r,e){this.validate(r),d(this,u).call(this,r,e)}serialize(r,e){return this.validate(r),new _(this,d(this,f).call(this,r,e))}parse(r){const e=new k.BcsReader(r);return this.read(e)}fromHex(r){return this.parse(S.fromHex(r))}fromBase58(r){return this.parse(T.fromBase58(r))}fromBase64(r){return this.parse(E.fromBase64(r))}transform({name:r,input:e,output:i,validate:t}){return new b({name:r??this.name,read:a=>i?i(this.read(a)):this.read(a),write:(a,n)=>d(this,u).call(this,e?e(a):a,n),serializedSize:a=>this.serializedSize(e?e(a):a),serialize:(a,n)=>d(this,f).call(this,e?e(a):a,n),validate:a=>{t==null||t(a),this.validate(e?e(a):a)}})}};u=new WeakMap;f=new WeakMap;let y=j;const v=Symbol.for("@mysten/serialized-bcs");function p(s){return!!s&&typeof s=="object"&&s[v]===!0}class _{constructor(r,e){B(this,z),B(this,h),m(this,z,r),m(this,h,e)}get[v](){return!0}toBytes(){return d(this,h)}toHex(){return S.toHex(d(this,h))}toBase64(){return E.toBase64(d(this,h))}toBase58(){return T.toBase58(d(this,h))}parse(){return d(this,z).parse(d(this,h))}}z=new WeakMap;h=new WeakMap;function o({size:s,...r}){return new y({...r,serializedSize:()=>s})}function U({readMethod:s,writeMethod:r,...e}){return o({...e,read:i=>i[s](),write:(i,t)=>t[r](i),validate:i=>{var t;if(i<0||i>e.maxValue)throw new TypeError(`Invalid ${e.name} value: ${i}. Expected value in range 0-${e.maxValue}`);(t=e.validate)==null||t.call(e,i)}})}function L({readMethod:s,writeMethod:r,...e}){return o({...e,read:i=>i[s](),write:(i,t)=>t[r](BigInt(i)),validate:i=>{var a;const t=BigInt(i);if(t<0||t>e.maxValue)throw new TypeError(`Invalid ${e.name} value: ${t}. Expected value in range 0-${e.maxValue}`);(a=e.validate)==null||a.call(e,t)}})}function q({serialize:s,...r}){const e=new y({...r,serialize:s,write:(i,t)=>{for(const a of e.serialize(i).toBytes())t.write8(a)}});return e}function A({toBytes:s,fromBytes:r,...e}){return new y({...e,read:i=>{const t=i.readULEB(),a=i.readBytes(t);return r(a)},write:(i,t)=>{const a=s(i);t.writeULEB(a.length);for(let n=0;n<a.length;n++)t.write8(a[n])},serialize:i=>{const t=s(i),a=O.ulebEncode(t.length),n=new Uint8Array(a.length+t.length);return n.set(a,0),n.set(t,a.length),n},validate:i=>{var t;if(typeof i!="string")throw new TypeError(`Invalid ${e.name} value: ${i}. Expected string`);(t=e.validate)==null||t.call(e,i)}})}function W(s){let r=null;function e(){return r||(r=s()),r}return new y({name:"lazy",read:i=>e().read(i),serializedSize:i=>e().serializedSize(i),write:(i,t)=>e().write(i,t),serialize:(i,t)=>e().serialize(i,t).toBytes()})}class M extends y{constructor({name:r,fields:e,...i}){const t=Object.entries(e);super({name:r,serializedSize:a=>{let n=0;for(const[l,c]of t){const w=c.serializedSize(a[l]);if(w==null)return null;n+=w}return n},read:a=>{const n={};for(const[l,c]of t)n[l]=c.read(a);return n},write:(a,n)=>{for(const[l,c]of t)c.write(a[l],n)},...i,validate:a=>{var n;if((n=i==null?void 0:i.validate)==null||n.call(i,a),typeof a!="object"||a==null)throw new TypeError(`Expected object, found ${typeof a}`)}})}}class C extends y{constructor({fields:r,...e}){const i=Object.entries(r);super({read:t=>{const a=t.readULEB(),n=i[a];if(!n)throw new TypeError(`Unknown value ${a} for enum ${e.name}`);const[l,c]=n;return{[l]:(c==null?void 0:c.read(t))??!0,$kind:l}},write:(t,a)=>{const[n,l]=Object.entries(t).filter(([c])=>Object.hasOwn(r,c))[0];for(let c=0;c<i.length;c++){const[w,g]=i[c];if(w===n){a.writeULEB(c),g==null||g.write(l,a);return}}},...e,validate:t=>{var l;if((l=e==null?void 0:e.validate)==null||l.call(e,t),typeof t!="object"||t==null)throw new TypeError(`Expected object, found ${typeof t}`);const a=Object.keys(t).filter(c=>t[c]!==void 0&&Object.hasOwn(r,c));if(a.length!==1)throw new TypeError(`Expected object with one key, but found ${a.length} for type ${e.name}}`);const[n]=a;if(!Object.hasOwn(r,n))throw new TypeError(`Invalid enum variant ${n}`)}})}}class H extends y{constructor({fields:r,name:e,...i}){super({name:e??`(${r.map(t=>t.name).join(", ")})`,serializedSize:t=>{let a=0;for(let n=0;n<r.length;n++){const l=r[n].serializedSize(t[n]);if(l==null)return null;a+=l}return a},read:t=>{const a=[];for(const n of r)a.push(n.read(t));return a},write:(t,a)=>{for(let n=0;n<r.length;n++)r[n].write(t[n],a)},...i,validate:t=>{var a;if((a=i==null?void 0:i.validate)==null||a.call(i,t),!Array.isArray(t))throw new TypeError(`Expected array, found ${typeof t}`);if(t.length!==r.length)throw new TypeError(`Expected array of length ${r.length}, found ${t.length}`)}})}}exports.BcsEnum=C;exports.BcsStruct=M;exports.BcsTuple=H;exports.BcsType=y;exports.SerializedBcs=_;exports.bigUIntBcsType=L;exports.dynamicSizeBcsType=q;exports.fixedSizeBcsType=o;exports.isSerializedBcs=p;exports.lazyBcsType=W;exports.stringLikeBcsType=A;exports.uIntBcsType=U;
|
package/dist/index326.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fromBase58 as $, toBase58 as _ } from "./
|
|
2
|
-
import { fromBase64 as v, toBase64 as b } from "./
|
|
3
|
-
import { fromHex as k, toHex as O } from "./
|
|
1
|
+
import { fromBase58 as $, toBase58 as _ } from "./index260.js";
|
|
2
|
+
import { fromBase64 as v, toBase64 as b } from "./index261.js";
|
|
3
|
+
import { fromHex as k, toHex as O } from "./index262.js";
|
|
4
4
|
import { BcsReader as I } from "./index369.js";
|
|
5
5
|
import { ulebEncode as j } from "./index370.js";
|
|
6
6
|
import { BcsWriter as U } from "./index371.js";
|
package/dist/index328.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index261.cjs"),t=require("./index327.cjs"),c=require("./index264.cjs"),a=require("./index329.cjs"),p={MoveCall(e){const[n,r="",i=""]="target"in e?e.target.split("::"):[e.package,e.module,e.function];return{$kind:"MoveCall",MoveCall:{package:n,module:r,function:i,typeArguments:e.typeArguments??[],arguments:e.arguments??[]}}},TransferObjects(e,n){return{$kind:"TransferObjects",TransferObjects:{objects:e.map(r=>t.parse(a.ArgumentSchema,r)),address:t.parse(a.ArgumentSchema,n)}}},SplitCoins(e,n){return{$kind:"SplitCoins",SplitCoins:{coin:t.parse(a.ArgumentSchema,e),amounts:n.map(r=>t.parse(a.ArgumentSchema,r))}}},MergeCoins(e,n){return{$kind:"MergeCoins",MergeCoins:{destination:t.parse(a.ArgumentSchema,e),sources:n.map(r=>t.parse(a.ArgumentSchema,r))}}},Publish({modules:e,dependencies:n}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:m.toBase64(new Uint8Array(r))),dependencies:n.map(r=>c.normalizeSuiObjectId(r))}}},Upgrade({modules:e,dependencies:n,package:r,ticket:i}){return{$kind:"Upgrade",Upgrade:{modules:e.map(s=>typeof s=="string"?s:m.toBase64(new Uint8Array(s))),dependencies:n.map(s=>c.normalizeSuiObjectId(s)),package:r,ticket:t.parse(a.ArgumentSchema,i)}}},MakeMoveVec({type:e,elements:n}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:n.map(r=>t.parse(a.ArgumentSchema,r))}}},Intent({name:e,inputs:n={},data:r={}}){return{$kind:"$Intent",$Intent:{name:e,inputs:Object.fromEntries(Object.entries(n).map(([i,s])=>[i,Array.isArray(s)?s.map(o=>t.parse(a.ArgumentSchema,o)):t.parse(a.ArgumentSchema,s)])),data:r}}}};exports.Commands=p;
|
package/dist/index328.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { toBase64 as o } from "./
|
|
1
|
+
import { toBase64 as o } from "./index261.js";
|
|
2
2
|
import { parse as t } from "./index327.js";
|
|
3
|
-
import { normalizeSuiObjectId as m } from "./
|
|
3
|
+
import { normalizeSuiObjectId as m } from "./index264.js";
|
|
4
4
|
import { ArgumentSchema as a } from "./index329.js";
|
|
5
5
|
const l = {
|
|
6
6
|
MoveCall(e) {
|
package/dist/index329.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index327.cjs"),p=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index327.cjs"),p=require("./index264.cjs");function o(n){const S=Object.entries(n).map(([s,h])=>e.object({[s]:h}));return e.pipe(e.union(S),e.transform(s=>({...s,$kind:Object.keys(s)[0]})))}const c=e.pipe(e.string(),e.transform(n=>p.normalizeSuiAddress(n)),e.check(p.isValidSuiAddress)),r=c,i=e.string(),a=e.pipe(e.union([e.string(),e.pipe(e.number(),e.integer())]),e.check(n=>{try{return BigInt(n),BigInt(n)>=0&&BigInt(n)<=18446744073709551615n}catch{return!1}},"Invalid u64")),l=e.object({objectId:c,version:a,digest:e.string()}),t=e.pipe(e.union([e.object({GasCoin:e.literal(!0)}),e.object({Input:e.pipe(e.number(),e.integer()),type:e.optional(e.literal("pure"))}),e.object({Input:e.pipe(e.number(),e.integer()),type:e.optional(e.literal("object"))}),e.object({Result:e.pipe(e.number(),e.integer())}),e.object({NestedResult:e.tuple([e.pipe(e.number(),e.integer()),e.pipe(e.number(),e.integer())])})]),e.transform(n=>({...n,$kind:Object.keys(n)[0]}))),m=e.object({budget:e.nullable(a),price:e.nullable(a),owner:e.nullable(c),payment:e.nullable(e.array(l))}),u=e.union([e.literal("address"),e.literal("bool"),e.literal("u8"),e.literal("u16"),e.literal("u32"),e.literal("u64"),e.literal("u128"),e.literal("u256"),e.object({vector:e.lazy(()=>u)}),e.object({datatype:e.object({package:e.string(),module:e.string(),type:e.string(),typeParameters:e.array(e.lazy(()=>u))})}),e.object({typeParameter:e.pipe(e.number(),e.integer())})]),d=e.object({ref:e.nullable(e.union([e.literal("&"),e.literal("&mut")])),body:u}),O=e.object({package:r,module:e.string(),function:e.string(),typeArguments:e.array(e.string()),arguments:e.array(t),_argumentTypes:e.optional(e.nullable(e.array(d)))}),g=e.object({name:e.string(),inputs:e.record(e.string(),e.union([t,e.array(t)])),data:e.record(e.string(),e.unknown())}),j=o({MoveCall:O,TransferObjects:e.object({objects:e.array(t),address:t}),SplitCoins:e.object({coin:t,amounts:e.array(t)}),MergeCoins:e.object({destination:t,sources:e.array(t)}),Publish:e.object({modules:e.array(i),dependencies:e.array(r)}),MakeMoveVec:e.object({type:e.nullable(e.string()),elements:e.array(t)}),Upgrade:e.object({modules:e.array(i),dependencies:e.array(r),package:r,ticket:t}),$Intent:g}),b=o({ImmOrOwnedObject:l,SharedObject:e.object({objectId:r,initialSharedVersion:a,mutable:e.boolean()}),Receiving:l}),I=o({Object:b,Pure:e.object({bytes:i}),UnresolvedPure:e.object({value:e.unknown()}),UnresolvedObject:e.object({objectId:r,version:e.optional(e.nullable(a)),digest:e.optional(e.nullable(e.string())),initialSharedVersion:e.optional(e.nullable(a)),mutable:e.optional(e.nullable(e.boolean()))})}),f=o({Object:b,Pure:e.object({bytes:i})}),y=o({None:e.literal(!0),Epoch:a}),k=e.object({version:e.literal(2),sender:e.nullish(c),expiration:e.nullish(y),gasData:m,inputs:e.array(I),commands:e.array(j)});exports.$Intent=g;exports.ArgumentSchema=t;exports.BCSBytes=i;exports.CommandSchema=j;exports.GasDataSchema=m;exports.JsonU64=a;exports.NormalizedCallArg=f;exports.ObjectArgSchema=b;exports.ObjectID=r;exports.ObjectRefSchema=l;exports.OpenMoveTypeSignatureBodySchema=u;exports.OpenMoveTypeSignatureSchema=d;exports.SuiAddress=c;exports.TransactionDataSchema=k;exports.TransactionExpiration=y;exports.safeEnum=o;
|
package/dist/index329.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pipe as a, object as e, transform as O, union as l, string as o, check as v, number as i, integer as u, literal as n, optional as d, tuple as T, array as t, nullable as r, boolean as C, unknown as A, nullish as I, record as k, lazy as f } from "./index327.js";
|
|
2
|
-
import { normalizeSuiAddress as D, isValidSuiAddress as R } from "./
|
|
2
|
+
import { normalizeSuiAddress as D, isValidSuiAddress as R } from "./index264.js";
|
|
3
3
|
function b(c) {
|
|
4
4
|
const P = Object.entries(c).map(([g, B]) => e({ [g]: B }));
|
|
5
5
|
return a(
|
package/dist/index330.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index261.cjs"),i=require("./index327.cjs");require("./index342.cjs");const l=require("./index329.cjs"),p=require("./index373.cjs"),a=i.object({digest:i.string(),objectId:i.string(),version:i.union([i.pipe(i.number(),i.integer()),i.string(),i.bigint()])}),v=l.safeEnum({ImmOrOwned:a,Shared:i.object({objectId:l.ObjectID,initialSharedVersion:l.JsonU64,mutable:i.boolean()}),Receiving:a}),b=l.safeEnum({Object:v,Pure:i.array(i.pipe(i.number(),i.integer()))});function f(t){var d;const s=t.inputs.map((r,e)=>{if(r.Object)return{kind:"Input",index:e,value:{Object:r.Object.ImmOrOwnedObject?{ImmOrOwned:r.Object.ImmOrOwnedObject}:r.Object.Receiving?{Receiving:{digest:r.Object.Receiving.digest,version:r.Object.Receiving.version,objectId:r.Object.Receiving.objectId}}:{Shared:{mutable:r.Object.SharedObject.mutable,initialSharedVersion:r.Object.SharedObject.initialSharedVersion,objectId:r.Object.SharedObject.objectId}}},type:"object"};if(r.Pure)return{kind:"Input",index:e,value:{Pure:Array.from(c.fromBase64(r.Pure.bytes))},type:"pure"};if(r.UnresolvedPure)return{kind:"Input",type:"pure",index:e,value:r.UnresolvedPure.value};if(r.UnresolvedObject)return{kind:"Input",type:"object",index:e,value:r.UnresolvedObject.objectId};throw new Error("Invalid input")});return{version:1,sender:t.sender??void 0,expiration:((d=t.expiration)==null?void 0:d.$kind)==="Epoch"?{Epoch:Number(t.expiration.Epoch)}:t.expiration?{None:!0}:null,gasConfig:{owner:t.gasData.owner??void 0,budget:t.gasData.budget??void 0,price:t.gasData.price??void 0,payment:t.gasData.payment??void 0},inputs:s,transactions:t.commands.map(r=>{if(r.MakeMoveVec)return{kind:"MakeMoveVec",type:r.MakeMoveVec.type===null?{None:!0}:{Some:p.TypeTagSerializer.parseFromStr(r.MakeMoveVec.type)},objects:r.MakeMoveVec.elements.map(e=>o(e,s))};if(r.MergeCoins)return{kind:"MergeCoins",destination:o(r.MergeCoins.destination,s),sources:r.MergeCoins.sources.map(e=>o(e,s))};if(r.MoveCall)return{kind:"MoveCall",target:`${r.MoveCall.package}::${r.MoveCall.module}::${r.MoveCall.function}`,typeArguments:r.MoveCall.typeArguments,arguments:r.MoveCall.arguments.map(e=>o(e,s))};if(r.Publish)return{kind:"Publish",modules:r.Publish.modules.map(e=>Array.from(c.fromBase64(e))),dependencies:r.Publish.dependencies};if(r.SplitCoins)return{kind:"SplitCoins",coin:o(r.SplitCoins.coin,s),amounts:r.SplitCoins.amounts.map(e=>o(e,s))};if(r.TransferObjects)return{kind:"TransferObjects",objects:r.TransferObjects.objects.map(e=>o(e,s)),address:o(r.TransferObjects.address,s)};if(r.Upgrade)return{kind:"Upgrade",modules:r.Upgrade.modules.map(e=>Array.from(c.fromBase64(e))),dependencies:r.Upgrade.dependencies,packageId:r.Upgrade.package,ticket:o(r.Upgrade.ticket,s)};throw new Error(`Unknown transaction ${Object.keys(r)}`)})}}function o(t,s){if(t.$kind==="GasCoin")return{kind:"GasCoin"};if(t.$kind==="Result")return{kind:"Result",index:t.Result};if(t.$kind==="NestedResult")return{kind:"NestedResult",index:t.NestedResult[0],resultIndex:t.NestedResult[1]};if(t.$kind==="Input")return s[t.Input];throw new Error(`Invalid argument ${Object.keys(t)}`)}function m(t){var s,d,r;return i.parse(l.TransactionDataSchema,{version:2,sender:t.sender??null,expiration:t.expiration?"Epoch"in t.expiration?{Epoch:t.expiration.Epoch}:{None:!0}:null,gasData:{owner:t.gasConfig.owner??null,budget:((s=t.gasConfig.budget)==null?void 0:s.toString())??null,price:((d=t.gasConfig.price)==null?void 0:d.toString())??null,payment:((r=t.gasConfig.payment)==null?void 0:r.map(e=>({digest:e.digest,objectId:e.objectId,version:e.version.toString()})))??null},inputs:t.inputs.map(e=>{if(e.kind==="Input"){if(i.is(b,e.value)){const n=i.parse(b,e.value);if(n.Object){if(n.Object.ImmOrOwned)return{Object:{ImmOrOwnedObject:{objectId:n.Object.ImmOrOwned.objectId,version:String(n.Object.ImmOrOwned.version),digest:n.Object.ImmOrOwned.digest}}};if(n.Object.Shared)return{Object:{SharedObject:{mutable:n.Object.Shared.mutable??null,initialSharedVersion:n.Object.Shared.initialSharedVersion,objectId:n.Object.Shared.objectId}}};if(n.Object.Receiving)return{Object:{Receiving:{digest:n.Object.Receiving.digest,version:String(n.Object.Receiving.version),objectId:n.Object.Receiving.objectId}}};throw new Error("Invalid object input")}return{Pure:{bytes:c.toBase64(new Uint8Array(n.Pure))}}}return e.type==="object"?{UnresolvedObject:{objectId:e.value}}:{UnresolvedPure:{value:e.value}}}throw new Error("Invalid input")}),commands:t.transactions.map(e=>{switch(e.kind){case"MakeMoveVec":return{MakeMoveVec:{type:"Some"in e.type?p.TypeTagSerializer.tagToString(e.type.Some):null,elements:e.objects.map(n=>u(n))}};case"MergeCoins":return{MergeCoins:{destination:u(e.destination),sources:e.sources.map(n=>u(n))}};case"MoveCall":{const[n,g,j]=e.target.split("::");return{MoveCall:{package:n,module:g,function:j,typeArguments:e.typeArguments,arguments:e.arguments.map(O=>u(O))}}}case"Publish":return{Publish:{modules:e.modules.map(n=>c.toBase64(Uint8Array.from(n))),dependencies:e.dependencies}};case"SplitCoins":return{SplitCoins:{coin:u(e.coin),amounts:e.amounts.map(n=>u(n))}};case"TransferObjects":return{TransferObjects:{objects:e.objects.map(n=>u(n)),address:u(e.address)}};case"Upgrade":return{Upgrade:{modules:e.modules.map(n=>c.toBase64(Uint8Array.from(n))),dependencies:e.dependencies,package:e.packageId,ticket:u(e.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(e)}`)})})}function u(t){switch(t.kind){case"GasCoin":return{GasCoin:!0};case"Result":return{Result:t.index};case"NestedResult":return{NestedResult:[t.index,t.resultIndex]};case"Input":return{Input:t.index}}}exports.NormalizedCallArg=b;exports.ObjectRef=a;exports.serializeV1TransactionData=f;exports.transactionDataFromV1=m;
|
package/dist/index330.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fromBase64 as d, toBase64 as c } from "./
|
|
1
|
+
import { fromBase64 as d, toBase64 as c } from "./index261.js";
|
|
2
2
|
import { parse as b, is as S, object as j, boolean as y, array as C, pipe as g, integer as O, number as v, union as w, string as l, bigint as M } from "./index327.js";
|
|
3
3
|
import "./index342.js";
|
|
4
4
|
import { safeEnum as f, TransactionDataSchema as R, JsonU64 as U, ObjectID as P } from "./index329.js";
|
package/dist/index332.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index261.cjs"),n=require("./index264.cjs");function c(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?i.toBase64(e):e.toBase64()}}}const d={Pure:c,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:n.normalizeSuiAddress(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:n.normalizeSuiAddress(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:n.normalizeSuiAddress(e)}}}}};exports.Inputs=d;
|
package/dist/index332.js
CHANGED
package/dist/index336.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index260.cjs"),h=require("./index327.cjs"),b=require("./index342.cjs"),d=require("./index264.cjs"),g=require("./index329.cjs"),y=require("./index330.cjs"),R=require("./index375.cjs"),w=require("./index337.cjs");function k(O){return d.normalizeSuiAddress(O).replace("0x","")}class c{constructor(t){this.version=2,this.sender=(t==null?void 0:t.sender)??null,this.expiration=(t==null?void 0:t.expiration)??null,this.inputs=(t==null?void 0:t.inputs)??[],this.commands=(t==null?void 0:t.commands)??[],this.gasData=(t==null?void 0:t.gasData)??{budget:null,price:null,owner:null,payment:null}}static fromKindBytes(t){const e=b.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!e)throw new Error("Unable to deserialize from bytes.");return c.restore({version:2,sender:null,expiration:null,gasData:{budget:null,owner:null,payment:null,price:null},inputs:e.inputs,commands:e.commands})}static fromBytes(t){const s=b.bcs.TransactionData.parse(t),e=s==null?void 0:s.V1,i=e.kind.ProgrammableTransaction;if(!e||!i)throw new Error("Unable to deserialize from bytes.");return c.restore({version:2,sender:e.sender,expiration:e.expiration,gasData:e.gasData,inputs:i.inputs,commands:i.commands})}static restore(t){return t.version===2?new c(h.parse(g.TransactionDataSchema,t)):new c(h.parse(g.TransactionDataSchema,y.transactionDataFromV1(t)))}static getDigestFromBytes(t){const s=R.hashTypedData("TransactionData",t);return j.toBase58(s)}get gasConfig(){return this.gasData}set gasConfig(t){this.gasData=t}build({maxSizeBytes:t=1/0,overrides:s,onlyTransactionKind:e}={}){const i=this.inputs,n=this.commands,r={ProgrammableTransaction:{inputs:i,commands:n}};if(e)return b.bcs.TransactionKind.serialize(r,{maxSize:t}).toBytes();const u=(s==null?void 0:s.expiration)??this.expiration,m=(s==null?void 0:s.sender)??this.sender,a={...this.gasData,...s==null?void 0:s.gasConfig,...s==null?void 0:s.gasData};if(!m)throw new Error("Missing transaction sender");if(!a.budget)throw new Error("Missing gas budget");if(!a.payment)throw new Error("Missing gas payment");if(!a.price)throw new Error("Missing gas price");const o={sender:k(m),expiration:u||{None:!0},gasData:{payment:a.payment,owner:k(this.gasData.owner??m),price:BigInt(a.price),budget:BigInt(a.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:n}}};return b.bcs.TransactionData.serialize({V1:o},{maxSize:t}).toBytes()}addInput(t,s){const e=this.inputs.length;return this.inputs.push(s),{Input:e,type:t,$kind:"Input"}}getInputUses(t,s){this.mapArguments((e,i)=>(e.$kind==="Input"&&e.Input===t&&s(e,i),e))}mapCommandArguments(t,s){const e=this.commands[t];switch(e.$kind){case"MoveCall":e.MoveCall.arguments=e.MoveCall.arguments.map(n=>s(n,e,t));break;case"TransferObjects":e.TransferObjects.objects=e.TransferObjects.objects.map(n=>s(n,e,t)),e.TransferObjects.address=s(e.TransferObjects.address,e,t);break;case"SplitCoins":e.SplitCoins.coin=s(e.SplitCoins.coin,e,t),e.SplitCoins.amounts=e.SplitCoins.amounts.map(n=>s(n,e,t));break;case"MergeCoins":e.MergeCoins.destination=s(e.MergeCoins.destination,e,t),e.MergeCoins.sources=e.MergeCoins.sources.map(n=>s(n,e,t));break;case"MakeMoveVec":e.MakeMoveVec.elements=e.MakeMoveVec.elements.map(n=>s(n,e,t));break;case"Upgrade":e.Upgrade.ticket=s(e.Upgrade.ticket,e,t);break;case"$Intent":const i=e.$Intent.inputs;e.$Intent.inputs={};for(const[n,r]of Object.entries(i))e.$Intent.inputs[n]=Array.isArray(r)?r.map(u=>s(u,e,t)):s(r,e,t);break;case"Publish":break;default:throw new Error(`Unexpected transaction kind: ${e.$kind}`)}}mapArguments(t){for(const s of this.commands.keys())this.mapCommandArguments(s,t)}replaceCommand(t,s,e=t){if(!Array.isArray(s)){this.commands[t]=s;return}const i=s.length-1;this.commands.splice(t,1,...structuredClone(s)),this.mapArguments((n,r,u)=>{if(u<t+s.length)return n;if(typeof e!="number"&&(n.$kind==="Result"&&n.Result===t||n.$kind==="NestedResult"&&n.NestedResult[0]===t)){if(!("NestedResult"in n)||n.NestedResult[1]===0)return h.parse(g.ArgumentSchema,structuredClone(e));throw new Error(`Cannot replace command ${t} with a specific result type: NestedResult[${t}, ${n.NestedResult[1]}] references a nested element that cannot be mapped to the replacement result`)}switch(n.$kind){case"Result":n.Result===t&&typeof e=="number"&&(n.Result=e),n.Result>t&&(n.Result+=i);break;case"NestedResult":if(n.NestedResult[0]===t&&typeof e=="number")return{$kind:"NestedResult",NestedResult:[e,n.NestedResult[1]]};n.NestedResult[0]>t&&(n.NestedResult[0]+=i);break}return n})}replaceCommandWithTransaction(t,s,e){if(e.$kind!=="Result"&&e.$kind!=="NestedResult")throw new Error("Result must be of kind Result or NestedResult");this.insertTransaction(t,s),this.replaceCommand(t+s.commands.length,[],"Result"in e?{NestedResult:[e.Result+t,0]}:{NestedResult:[e.NestedResult[0]+t,e.NestedResult[1]]})}insertTransaction(t,s){var u,m;const e=new Map,i=new Map;for(let a=0;a<s.inputs.length;a++){const o=s.inputs[a],p=w.getIdFromCallArg(o);let l=-1;if(p!==void 0&&(l=this.inputs.findIndex(f=>w.getIdFromCallArg(f)===p),l!==-1&&((u=this.inputs[l].Object)!=null&&u.SharedObject)&&((m=o.Object)!=null&&m.SharedObject)&&(this.inputs[l].Object.SharedObject.mutable=this.inputs[l].Object.SharedObject.mutable||o.Object.SharedObject.mutable)),l!==-1)e.set(a,l);else{const f=this.inputs.length;this.inputs.push(o),e.set(a,f)}}for(let a=0;a<s.commands.length;a++)i.set(a,t+a);const n=[];for(let a=0;a<s.commands.length;a++){const o=structuredClone(s.commands[a]);w.remapCommandArguments(o,e,i),n.push(o)}this.commands.splice(t,0,...n);const r=n.length;r>0&&this.mapArguments((a,o,p)=>{if(p>=t&&p<t+n.length)return a;switch(a.$kind){case"Result":a.Result>=t&&(a.Result+=r);break;case"NestedResult":a.NestedResult[0]>=t&&(a.NestedResult[0]+=r);break}return a})}getDigest(){const t=this.build({onlyTransactionKind:!1});return c.getDigestFromBytes(t)}snapshot(){return h.parse(g.TransactionDataSchema,this)}shallowClone(){return new c({version:this.version,sender:this.sender,expiration:this.expiration,gasData:{...this.gasData},inputs:[...this.inputs],commands:[...this.commands]})}applyResolvedData(t){this.sender||(this.sender=t.sender??null),this.expiration||(this.expiration=t.expiration??null),this.gasData.budget||(this.gasData.budget=t.gasData.budget),this.gasData.owner||(this.gasData.owner=t.gasData.owner??null),this.gasData.payment||(this.gasData.payment=t.gasData.payment),this.gasData.price||(this.gasData.price=t.gasData.price);for(let s=0;s<this.inputs.length;s++){const e=this.inputs[s],i=t.inputs[s];switch(e.$kind){case"UnresolvedPure":if(i.$kind!=="Pure")throw new Error(`Expected input at index ${s} to resolve to a Pure argument, but got ${JSON.stringify(i)}`);this.inputs[s]=i;break;case"UnresolvedObject":if(i.$kind!=="Object")throw new Error(`Expected input at index ${s} to resolve to an Object argument, but got ${JSON.stringify(i)}`);if(i.Object.$kind==="ImmOrOwnedObject"||i.Object.$kind==="Receiving"){const n=e.UnresolvedObject,r=i.Object.ImmOrOwnedObject??i.Object.Receiving;if(d.normalizeSuiAddress(n.objectId)!==d.normalizeSuiAddress(r.objectId)||n.version!=null&&n.version!==r.version||n.digest!=null&&n.digest!==r.digest||n.mutable!=null||n.initialSharedVersion!=null)throw new Error(`Input at index ${s} did not match unresolved object. ${JSON.stringify(n)} is not compatible with ${JSON.stringify(r)}`)}else if(i.Object.$kind==="SharedObject"){const n=e.UnresolvedObject,r=i.Object.SharedObject;if(d.normalizeSuiAddress(n.objectId)!==d.normalizeSuiAddress(r.objectId)||n.initialSharedVersion!=null&&n.initialSharedVersion!==r.initialSharedVersion||n.mutable!=null&&n.mutable!==r.mutable||n.version!=null||n.digest!=null)throw new Error(`Input at index ${s} did not match unresolved object. ${JSON.stringify(n)} is not compatible with ${JSON.stringify(r)}`)}else throw new Error(`Input at index ${s} resolved to an unexpected Object kind: ${JSON.stringify(i.Object)}`);this.inputs[s]=i;break}}}}exports.TransactionDataBuilder=c;
|
package/dist/index336.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { toBase58 as j } from "./
|
|
1
|
+
import { toBase58 as j } from "./index260.js";
|
|
2
2
|
import { parse as h } from "./index327.js";
|
|
3
3
|
import { bcs as b } from "./index342.js";
|
|
4
|
-
import { normalizeSuiAddress as d } from "./
|
|
4
|
+
import { normalizeSuiAddress as d } from "./index264.js";
|
|
5
5
|
import { TransactionDataSchema as f, ArgumentSchema as R } from "./index329.js";
|
|
6
6
|
import { transactionDataFromV1 as y } from "./index330.js";
|
|
7
7
|
import { hashTypedData as $ } from "./index375.js";
|
package/dist/index337.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index264.cjs");function l(e){if(typeof e=="string")return r.normalizeSuiAddress(e);if(e.Object)return e.Object.ImmOrOwnedObject?r.normalizeSuiAddress(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?r.normalizeSuiAddress(e.Object.Receiving.objectId):r.normalizeSuiAddress(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return r.normalizeSuiAddress(e.UnresolvedObject.objectId)}function c(e,o,u){const s=t=>{switch(t.$kind){case"Input":{const n=o.get(t.Input);if(n===void 0)throw new Error(`Input ${t.Input} not found in input mapping`);return{...t,Input:n}}case"Result":{const n=u.get(t.Result);return n!==void 0?{...t,Result:n}:t}case"NestedResult":{const n=u.get(t.NestedResult[0]);return n!==void 0?{...t,NestedResult:[n,t.NestedResult[1]]}:t}default:return t}};switch(e.$kind){case"MoveCall":e.MoveCall.arguments=e.MoveCall.arguments.map(s);break;case"TransferObjects":e.TransferObjects.objects=e.TransferObjects.objects.map(s),e.TransferObjects.address=s(e.TransferObjects.address);break;case"SplitCoins":e.SplitCoins.coin=s(e.SplitCoins.coin),e.SplitCoins.amounts=e.SplitCoins.amounts.map(s);break;case"MergeCoins":e.MergeCoins.destination=s(e.MergeCoins.destination),e.MergeCoins.sources=e.MergeCoins.sources.map(s);break;case"MakeMoveVec":e.MakeMoveVec.elements=e.MakeMoveVec.elements.map(s);break;case"Upgrade":e.Upgrade.ticket=s(e.Upgrade.ticket);break;case"$Intent":{const t=e.$Intent.inputs;e.$Intent.inputs={};for(const[n,i]of Object.entries(t))e.$Intent.inputs[n]=Array.isArray(i)?i.map(s):s(i);break}}}exports.getIdFromCallArg=l;exports.remapCommandArguments=c;
|