@gardenfi/swap 0.0.2-beta.2 → 0.0.2-beta.4

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 (230) hide show
  1. package/dist/index104.cjs +1 -1
  2. package/dist/index104.js +4 -4
  3. package/dist/index106.cjs +1 -1
  4. package/dist/index106.js +3 -3
  5. package/dist/index107.cjs +1 -1
  6. package/dist/index107.js +3 -3
  7. package/dist/index116.cjs +1 -1
  8. package/dist/index116.js +1 -1
  9. package/dist/index117.cjs +1 -1
  10. package/dist/index117.js +1 -1
  11. package/dist/index12.cjs +1 -1
  12. package/dist/index12.js +12 -12
  13. package/dist/index120.cjs +1 -1
  14. package/dist/index120.js +2 -2
  15. package/dist/index121.cjs +1 -1
  16. package/dist/index121.js +7 -7
  17. package/dist/index132.cjs +1 -1
  18. package/dist/index132.js +1 -1
  19. package/dist/index133.cjs +1 -1
  20. package/dist/index133.js +1 -1
  21. package/dist/index134.cjs +1 -1
  22. package/dist/index134.js +1 -1
  23. package/dist/index135.cjs +1 -1
  24. package/dist/index135.js +1 -1
  25. package/dist/index138.cjs +1 -1
  26. package/dist/index138.js +2 -2
  27. package/dist/index161.cjs +1 -1
  28. package/dist/index161.js +2 -2
  29. package/dist/index167.cjs +1 -1
  30. package/dist/index167.js +1 -1
  31. package/dist/index168.cjs +1 -1
  32. package/dist/index168.js +2 -2
  33. package/dist/index169.cjs +1 -1
  34. package/dist/index169.js +2 -2
  35. package/dist/index170.cjs +1 -1
  36. package/dist/index170.js +2 -2
  37. package/dist/index171.cjs +1 -1
  38. package/dist/index171.js +2 -2
  39. package/dist/index172.cjs +1 -1
  40. package/dist/index172.js +2 -2
  41. package/dist/index272.cjs +1 -1
  42. package/dist/index272.js +9 -174
  43. package/dist/index273.cjs +1 -2
  44. package/dist/index273.js +30 -91
  45. package/dist/index274.cjs +1 -1
  46. package/dist/index274.js +2 -41
  47. package/dist/index275.cjs +1 -1
  48. package/dist/index275.js +47 -4
  49. package/dist/index276.cjs +1 -1
  50. package/dist/index276.js +11 -9
  51. package/dist/index277.cjs +1 -1
  52. package/dist/index277.js +174 -30
  53. package/dist/index278.cjs +2 -1
  54. package/dist/index278.js +92 -2
  55. package/dist/index279.cjs +1 -1
  56. package/dist/index279.js +38 -45
  57. package/dist/index280.cjs +1 -1
  58. package/dist/index280.js +4 -11
  59. package/dist/index281.cjs +1 -1
  60. package/dist/index281.js +3 -3
  61. package/dist/index283.cjs +1 -2
  62. package/dist/index283.js +42 -41
  63. package/dist/index284.cjs +1 -1
  64. package/dist/index284.js +321 -2
  65. package/dist/index285.cjs +1 -1
  66. package/dist/index285.js +605 -5
  67. package/dist/index286.cjs +1 -1
  68. package/dist/index286.js +109 -10
  69. package/dist/index287.cjs +1 -1
  70. package/dist/index287.js +167 -19
  71. package/dist/index288.cjs +1 -1
  72. package/dist/index288.js +301 -8
  73. package/dist/index289.cjs +1 -1
  74. package/dist/index289.js +93 -72
  75. package/dist/index290.cjs +1 -1
  76. package/dist/index290.js +54 -63
  77. package/dist/index291.cjs +1 -1
  78. package/dist/index291.js +51 -186
  79. package/dist/index292.cjs +1 -1
  80. package/dist/index292.js +42 -20
  81. package/dist/index293.cjs +1 -1
  82. package/dist/index293.js +14 -41
  83. package/dist/index294.cjs +1 -1
  84. package/dist/index294.js +315 -23
  85. package/dist/index295.cjs +1 -1
  86. package/dist/index295.js +57 -88
  87. package/dist/index296.cjs +1 -1
  88. package/dist/index296.js +19 -40
  89. package/dist/index297.cjs +1 -1
  90. package/dist/index297.js +28 -15
  91. package/dist/index298.cjs +1 -1
  92. package/dist/index298.js +3 -13
  93. package/dist/index299.cjs +7 -1
  94. package/dist/index299.js +237 -7
  95. package/dist/index300.cjs +1 -1
  96. package/dist/index300.js +48 -38
  97. package/dist/index301.cjs +1 -1
  98. package/dist/index301.js +211 -14
  99. package/dist/index302.cjs +1 -1
  100. package/dist/index302.js +77 -38
  101. package/dist/index303.cjs +1 -1
  102. package/dist/index303.js +25 -316
  103. package/dist/index304.cjs +1 -1
  104. package/dist/index304.js +73 -602
  105. package/dist/index305.cjs +2 -1
  106. package/dist/index305.js +41 -109
  107. package/dist/index306.cjs +1 -1
  108. package/dist/index306.js +2 -168
  109. package/dist/index307.cjs +1 -1
  110. package/dist/index307.js +5 -301
  111. package/dist/index308.cjs +1 -1
  112. package/dist/index308.js +10 -93
  113. package/dist/index309.cjs +1 -1
  114. package/dist/index309.js +18 -55
  115. package/dist/index310.cjs +1 -1
  116. package/dist/index310.js +8 -53
  117. package/dist/index311.cjs +1 -1
  118. package/dist/index311.js +72 -44
  119. package/dist/index312.cjs +1 -1
  120. package/dist/index312.js +64 -14
  121. package/dist/index313.cjs +1 -1
  122. package/dist/index313.js +184 -313
  123. package/dist/index314.cjs +1 -1
  124. package/dist/index314.js +19 -56
  125. package/dist/index315.cjs +1 -1
  126. package/dist/index315.js +42 -19
  127. package/dist/index316.cjs +1 -1
  128. package/dist/index316.js +23 -27
  129. package/dist/index317.cjs +1 -1
  130. package/dist/index317.js +90 -3
  131. package/dist/index318.cjs +1 -7
  132. package/dist/index318.js +33 -230
  133. package/dist/index319.cjs +1 -1
  134. package/dist/index319.js +17 -48
  135. package/dist/index320.cjs +1 -1
  136. package/dist/index320.js +11 -210
  137. package/dist/index321.cjs +1 -1
  138. package/dist/index321.js +7 -81
  139. package/dist/index322.cjs +1 -1
  140. package/dist/index322.js +36 -28
  141. package/dist/index323.cjs +1 -1
  142. package/dist/index323.js +15 -76
  143. package/dist/index326.cjs +1 -1
  144. package/dist/index326.js +1 -1
  145. package/dist/index327.cjs +1 -1
  146. package/dist/index327.js +1 -1
  147. package/dist/index333.cjs +1 -1
  148. package/dist/index333.js +2 -2
  149. package/dist/index334.cjs +1 -1
  150. package/dist/index334.js +2 -2
  151. package/dist/index340.cjs +1 -1
  152. package/dist/index340.js +1 -1
  153. package/dist/index341.cjs +1 -1
  154. package/dist/index341.js +1 -1
  155. package/dist/index343.cjs +1 -1
  156. package/dist/index343.js +1 -1
  157. package/dist/index346.cjs +1 -1
  158. package/dist/index346.js +1 -1
  159. package/dist/index347.cjs +1 -1
  160. package/dist/index347.js +1 -1
  161. package/dist/index348.cjs +1 -1
  162. package/dist/index348.js +3 -3
  163. package/dist/index349.cjs +1 -2
  164. package/dist/index349.js +4 -193
  165. package/dist/index350.cjs +2 -1
  166. package/dist/index350.js +168 -52
  167. package/dist/index351.cjs +1 -1
  168. package/dist/index351.js +65 -331
  169. package/dist/index352.cjs +1 -1
  170. package/dist/index352.js +332 -149
  171. package/dist/index353.cjs +1 -1
  172. package/dist/index353.js +161 -5
  173. package/dist/index354.cjs +1 -1
  174. package/dist/index354.js +5 -5
  175. package/dist/index357.cjs +1 -1
  176. package/dist/index357.js +8 -205
  177. package/dist/index359.cjs +1 -1
  178. package/dist/index359.js +205 -8
  179. package/dist/index360.cjs +1 -1
  180. package/dist/index360.js +94 -68
  181. package/dist/index361.cjs +1 -1
  182. package/dist/index361.js +28 -94
  183. package/dist/index362.cjs +1 -1
  184. package/dist/index362.js +147 -27
  185. package/dist/index363.cjs +1 -1
  186. package/dist/index363.js +324 -118
  187. package/dist/index364.cjs +1 -1
  188. package/dist/index364.js +72 -353
  189. package/dist/index365.cjs +1 -1
  190. package/dist/index365.js +29 -71
  191. package/dist/index366.cjs +1 -1
  192. package/dist/index366.js +5 -31
  193. package/dist/index367.cjs +1 -1
  194. package/dist/index367.js +275 -5
  195. package/dist/index368.cjs +1 -1
  196. package/dist/index368.js +171 -4
  197. package/dist/index369.cjs +1 -1
  198. package/dist/index369.js +10 -141
  199. package/dist/index370.cjs +1 -1
  200. package/dist/index370.js +105 -273
  201. package/dist/index371.cjs +1 -1
  202. package/dist/index371.js +10 -171
  203. package/dist/index372.cjs +1 -1
  204. package/dist/index372.js +69 -10
  205. package/dist/index373.cjs +1 -1
  206. package/dist/index373.js +3 -107
  207. package/dist/index374.cjs +1 -1
  208. package/dist/index374.js +140 -9
  209. package/dist/index375.cjs +1 -1
  210. package/dist/index375.js +4 -4
  211. package/dist/index376.cjs +1 -1
  212. package/dist/index376.js +2 -79
  213. package/dist/index377.cjs +1 -1
  214. package/dist/index377.js +79 -2
  215. package/dist/index379.cjs +1 -1
  216. package/dist/index379.js +1 -1
  217. package/dist/index380.cjs +1 -1
  218. package/dist/index380.js +1 -1
  219. package/dist/index381.cjs +1 -1
  220. package/dist/index381.js +2 -22
  221. package/dist/index382.cjs +1 -1
  222. package/dist/index382.js +22 -2
  223. package/dist/index385.cjs +1 -1
  224. package/dist/index385.js +2 -2
  225. package/dist/index77.cjs +1 -1
  226. package/dist/index77.js +13 -13
  227. package/dist/index99.cjs +1 -1
  228. package/dist/index99.js +1 -1
  229. package/dist/src/lib/store/swapStore.d.ts +1 -1
  230. package/package.json +5 -5
package/dist/index289.js CHANGED
@@ -1,75 +1,96 @@
1
- import { execTyped as t } from "./index288.js";
2
- const n = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
3
- function g(e) {
4
- return n.test(e);
1
+ import { object as e, optional as i, array as n, nullish as g, literal as b, nullable as o, string as s, union as O, boolean as v, unknown as S, record as j, tuple as I, pipe as l, integer as u, number as d } from "./index285.js";
2
+ import { SuiAddress as h, ObjectRefSchema as m, JsonU64 as r, ObjectID as a, BCSBytes as p } from "./index287.js";
3
+ function c(C) {
4
+ return O(
5
+ Object.entries(C).map(([f, y]) => e({ [f]: y }))
6
+ );
5
7
  }
6
- function S(e) {
7
- return t(n, e);
8
- }
9
- const r = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
10
- function l(e) {
11
- return r.test(e);
12
- }
13
- function f(e) {
14
- return t(r, e);
15
- }
16
- const a = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;
17
- function x(e) {
18
- return a.test(e);
19
- }
20
- function p(e) {
21
- return t(a, e);
22
- }
23
- const i = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
24
- function m(e) {
25
- return i.test(e);
26
- }
27
- function $(e) {
28
- return t(i, e);
29
- }
30
- const u = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;
31
- function b(e) {
32
- return u.test(e);
33
- }
34
- function y(e) {
35
- return t(u, e);
36
- }
37
- const c = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
38
- function d(e) {
39
- return c.test(e);
40
- }
41
- function v(e) {
42
- return t(c, e);
43
- }
44
- const o = /^receive\(\) external payable$/;
45
- function z(e) {
46
- return o.test(e);
47
- }
48
- const A = /* @__PURE__ */ new Set([
49
- "memory",
50
- "indexed",
51
- "storage",
52
- "calldata"
53
- ]), R = /* @__PURE__ */ new Set(["indexed"]), Z = /* @__PURE__ */ new Set([
54
- "calldata",
55
- "memory",
56
- "storage"
57
- ]);
8
+ const t = c({
9
+ GasCoin: b(!0),
10
+ Input: l(d(), u()),
11
+ Result: l(d(), u()),
12
+ NestedResult: I([l(d(), u()), l(d(), u())])
13
+ }), k = e({
14
+ budget: o(r),
15
+ price: o(r),
16
+ owner: o(h),
17
+ payment: o(n(m))
18
+ }), A = e({
19
+ package: a,
20
+ module: s(),
21
+ function: s(),
22
+ // snake case in rust
23
+ typeArguments: n(s()),
24
+ arguments: n(t)
25
+ }), M = e({
26
+ name: s(),
27
+ inputs: j(s(), O([t, n(t)])),
28
+ data: j(s(), S())
29
+ }), U = c({
30
+ MoveCall: A,
31
+ TransferObjects: e({
32
+ objects: n(t),
33
+ address: t
34
+ }),
35
+ SplitCoins: e({
36
+ coin: t,
37
+ amounts: n(t)
38
+ }),
39
+ MergeCoins: e({
40
+ destination: t,
41
+ sources: n(t)
42
+ }),
43
+ Publish: e({
44
+ modules: n(p),
45
+ dependencies: n(a)
46
+ }),
47
+ MakeMoveVec: e({
48
+ type: o(s()),
49
+ elements: n(t)
50
+ }),
51
+ Upgrade: e({
52
+ modules: n(p),
53
+ dependencies: n(a),
54
+ package: a,
55
+ ticket: t
56
+ }),
57
+ $Intent: M
58
+ }), D = c({
59
+ ImmOrOwnedObject: m,
60
+ SharedObject: e({
61
+ objectId: a,
62
+ // snake case in rust
63
+ initialSharedVersion: r,
64
+ mutable: v()
65
+ }),
66
+ Receiving: m
67
+ }), P = c({
68
+ Object: D,
69
+ Pure: e({
70
+ bytes: p
71
+ }),
72
+ UnresolvedPure: e({
73
+ value: S()
74
+ }),
75
+ UnresolvedObject: e({
76
+ objectId: a,
77
+ version: i(o(r)),
78
+ digest: i(o(s())),
79
+ initialSharedVersion: i(o(r)),
80
+ mutable: i(o(v()))
81
+ })
82
+ }), R = c({
83
+ None: b(!0),
84
+ Epoch: r
85
+ }), x = e({
86
+ version: b(2),
87
+ sender: g(h),
88
+ expiration: g(R),
89
+ gasData: k,
90
+ inputs: n(P),
91
+ commands: n(U),
92
+ digest: i(o(s()))
93
+ });
58
94
  export {
59
- R as eventModifiers,
60
- y as execConstructorSignature,
61
- S as execErrorSignature,
62
- f as execEventSignature,
63
- v as execFallbackSignature,
64
- p as execFunctionSignature,
65
- $ as execStructSignature,
66
- Z as functionModifiers,
67
- b as isConstructorSignature,
68
- g as isErrorSignature,
69
- l as isEventSignature,
70
- d as isFallbackSignature,
71
- x as isFunctionSignature,
72
- z as isReceiveSignature,
73
- m as isStructSignature,
74
- A as modifiers
95
+ x as SerializedTransactionDataV2Schema
75
96
  };
package/dist/index290.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index288.cjs"),b=require("./index293.cjs"),T=require("./index295.cjs"),y=require("./index296.cjs"),q=require("./index298.cjs"),f=require("./index289.cjs"),S=require("./index291.cjs");function v(i){const n={},u=i.length;for(let e=0;e<u;e++){const o=i[e];if(!f.isStructSignature(o))continue;const r=f.execStructSignature(o);if(!r)throw new y.InvalidSignatureError({signature:o,type:"struct"});const p=r.properties.split(";"),t=[],w=p.length;for(let l=0;l<w;l++){const g=p[l].trim();if(!g)continue;const d=S.parseAbiParameter(g,{type:"struct"});t.push(d)}if(!t.length)throw new y.InvalidStructSignatureError({signature:o});n[r.name]=t}const s={},a=Object.entries(n),c=a.length;for(let e=0;e<c;e++){const[o,r]=a[e];s[o]=m(r,n)}return s}const P=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function m(i=[],n={},u=new Set){const s=[],a=i.length;for(let c=0;c<a;c++){const e=i[c];if(h.isTupleRegex.test(e.type))s.push(e);else{const r=h.execTyped(P,e.type);if(!(r!=null&&r.type))throw new T.InvalidAbiTypeParameterError({abiParameter:e});const{array:p,type:t}=r;if(t in n){if(u.has(t))throw new q.CircularReferenceError({type:t});s.push({...e,type:`tuple${p??""}`,components:m(n[t],n,new Set([...u,t]))})}else if(S.isSolidityType(t))s.push(e);else throw new b.UnknownTypeError({type:t})}}return s}exports.parseStructs=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index114.cjs"),n=require("./index117.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/index290.js CHANGED
@@ -1,68 +1,59 @@
1
- import { isTupleRegex as g, execTyped as w } from "./index288.js";
2
- import { UnknownTypeError as S } from "./index293.js";
3
- import { InvalidAbiTypeParameterError as d } from "./index295.js";
4
- import { InvalidSignatureError as T, InvalidStructSignatureError as v } from "./index296.js";
5
- import { CircularReferenceError as x } from "./index298.js";
6
- import { isStructSignature as E, execStructSignature as b } from "./index289.js";
7
- import { parseAbiParameter as A, isSolidityType as $ } from "./index291.js";
8
- function C(s) {
9
- const n = {}, c = s.length;
10
- for (let t = 0; t < c; t++) {
11
- const i = s[t];
12
- if (!E(i))
13
- continue;
14
- const r = b(i);
15
- if (!r)
16
- throw new T({ signature: i, type: "struct" });
17
- const u = r.properties.split(";"), e = [], h = u.length;
18
- for (let l = 0; l < h; l++) {
19
- const m = u[l].trim();
20
- if (!m)
21
- continue;
22
- const y = A(m, {
23
- type: "struct"
24
- });
25
- e.push(y);
1
+ import { toBase64 as c } from "./index114.js";
2
+ import { normalizeSuiAddress as n } from "./index117.js";
3
+ function i(e) {
4
+ return {
5
+ $kind: "Pure",
6
+ Pure: {
7
+ bytes: e instanceof Uint8Array ? c(e) : e.toBase64()
26
8
  }
27
- if (!e.length)
28
- throw new v({ signature: i });
29
- n[r.name] = e;
30
- }
31
- const o = {}, a = Object.entries(n), p = a.length;
32
- for (let t = 0; t < p; t++) {
33
- const [i, r] = a[t];
34
- o[i] = f(r, n);
35
- }
36
- return o;
9
+ };
37
10
  }
38
- const I = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
39
- function f(s = [], n = {}, c = /* @__PURE__ */ new Set()) {
40
- const o = [], a = s.length;
41
- for (let p = 0; p < a; p++) {
42
- const t = s[p];
43
- if (g.test(t.type))
44
- o.push(t);
45
- else {
46
- const r = w(I, t.type);
47
- if (!(r != null && r.type))
48
- throw new d({ abiParameter: t });
49
- const { array: u, type: e } = r;
50
- if (e in n) {
51
- if (c.has(e))
52
- throw new x({ type: e });
53
- o.push({
54
- ...t,
55
- type: `tuple${u ?? ""}`,
56
- components: f(n[e], n, /* @__PURE__ */ new Set([...c, e]))
57
- });
58
- } else if ($(e))
59
- o.push(t);
60
- else
61
- throw new S({ type: e });
62
- }
11
+ const d = {
12
+ Pure: i,
13
+ ObjectRef({ objectId: e, digest: t, version: r }) {
14
+ return {
15
+ $kind: "Object",
16
+ Object: {
17
+ $kind: "ImmOrOwnedObject",
18
+ ImmOrOwnedObject: {
19
+ digest: t,
20
+ version: r,
21
+ objectId: n(e)
22
+ }
23
+ }
24
+ };
25
+ },
26
+ SharedObjectRef({
27
+ objectId: e,
28
+ mutable: t,
29
+ initialSharedVersion: r
30
+ }) {
31
+ return {
32
+ $kind: "Object",
33
+ Object: {
34
+ $kind: "SharedObject",
35
+ SharedObject: {
36
+ mutable: t,
37
+ initialSharedVersion: r,
38
+ objectId: n(e)
39
+ }
40
+ }
41
+ };
42
+ },
43
+ ReceivingRef({ objectId: e, digest: t, version: r }) {
44
+ return {
45
+ $kind: "Object",
46
+ Object: {
47
+ $kind: "Receiving",
48
+ Receiving: {
49
+ digest: t,
50
+ version: r,
51
+ objectId: n(e)
52
+ }
53
+ }
54
+ };
63
55
  }
64
- return o;
65
- }
56
+ };
66
57
  export {
67
- C as parseStructs
58
+ d as Inputs
68
59
  };
package/dist/index291.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index288.cjs"),A=require("./index293.cjs"),g=require("./index295.cjs"),d=require("./index296.cjs"),q=require("./index297.cjs"),h=require("./index360.cjs"),o=require("./index289.cjs");function z(e,t={}){if(o.isFunctionSignature(e))return E(e,t);if(o.isEventSignature(e))return P(e,t);if(o.isErrorSignature(e))return M(e,t);if(o.isConstructorSignature(e))return I(e,t);if(o.isFallbackSignature(e))return R(e);if(o.isReceiveSignature(e))return{type:"receive",stateMutability:"payable"};throw new d.UnknownSignatureError({signature:e})}function E(e,t={}){const a=o.execFunctionSignature(e);if(!a)throw new d.InvalidSignatureError({signature:e,type:"function"});const n=u(a.parameters),r=[],c=n.length;for(let s=0;s<c;s++)r.push(y(n[s],{modifiers:o.functionModifiers,structs:t,type:"function"}));const i=[];if(a.returns){const s=u(a.returns),l=s.length;for(let f=0;f<l;f++)i.push(y(s[f],{modifiers:o.functionModifiers,structs:t,type:"function"}))}return{name:a.name,type:"function",stateMutability:a.stateMutability??"nonpayable",inputs:r,outputs:i}}function P(e,t={}){const a=o.execEventSignature(e);if(!a)throw new d.InvalidSignatureError({signature:e,type:"event"});const n=u(a.parameters),r=[],c=n.length;for(let i=0;i<c;i++)r.push(y(n[i],{modifiers:o.eventModifiers,structs:t,type:"event"}));return{name:a.name,type:"event",inputs:r}}function M(e,t={}){const a=o.execErrorSignature(e);if(!a)throw new d.InvalidSignatureError({signature:e,type:"error"});const n=u(a.parameters),r=[],c=n.length;for(let i=0;i<c;i++)r.push(y(n[i],{structs:t,type:"error"}));return{name:a.name,type:"error",inputs:r}}function I(e,t={}){const a=o.execConstructorSignature(e);if(!a)throw new d.InvalidSignatureError({signature:e,type:"constructor"});const n=u(a.parameters),r=[],c=n.length;for(let i=0;i<c;i++)r.push(y(n[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:a.stateMutability??"nonpayable",inputs:r}}function R(e){const t=o.execFallbackSignature(e);if(!t)throw new d.InvalidSignatureError({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const _=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,$=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,K=/^u?int$/;function y(e,t){var p,w;const a=h.getParameterCacheKey(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(h.parameterCache.has(a))return h.parameterCache.get(a);const n=m.isTupleRegex.test(e),r=m.execTyped(n?$:_,e);if(!r)throw new g.InvalidParameterError({param:e});if(r.name&&F(r.name))throw new g.SolidityProtectedKeywordError({param:e,name:r.name});const c=r.name?{name:r.name}:{},i=r.modifier==="indexed"?{indexed:!0}:{},s=(t==null?void 0:t.structs)??{};let l,f={};if(n){l="tuple";const v=u(r.type),x=[],k=v.length;for(let b=0;b<k;b++)x.push(y(v[b],{structs:s}));f={components:x}}else if(r.type in s)l="tuple",f={components:s[r.type]};else if(K.test(r.type))l=`${r.type}256`;else if(r.type==="address payable")l="address";else if(l=r.type,(t==null?void 0:t.type)!=="struct"&&!C(l))throw new A.UnknownSolidityTypeError({type:l});if(r.modifier){if(!((w=(p=t==null?void 0:t.modifiers)==null?void 0:p.has)!=null&&w.call(p,r.modifier)))throw new g.InvalidModifierError({param:e,type:t==null?void 0:t.type,modifier:r.modifier});if(o.functionModifiers.has(r.modifier)&&!T(l,!!r.array))throw new g.InvalidFunctionModifierError({param:e,type:t==null?void 0:t.type,modifier:r.modifier})}const S={type:`${l}${r.array??""}`,...c,...i,...f};return h.parameterCache.set(a,S),S}function u(e,t=[],a="",n=0){const r=e.trim().length;for(let c=0;c<r;c++){const i=e[c],s=e.slice(c+1);switch(i){case",":return n===0?u(s,[...t,a.trim()]):u(s,t,`${a}${i}`,n);case"(":return u(s,t,`${a}${i}`,n+1);case")":return u(s,t,`${a}${i}`,n-1);default:return u(s,t,`${a}${i}`,n)}}if(a==="")return t;if(n!==0)throw new q.InvalidParenthesisError({current:a,depth:n});return t.push(a.trim()),t}function C(e){return e==="address"||e==="bool"||e==="function"||e==="string"||m.bytesRegex.test(e)||m.integerRegex.test(e)}const Z=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function F(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||m.bytesRegex.test(e)||m.integerRegex.test(e)||Z.test(e)}function T(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}exports.isSolidityKeyword=F;exports.isSolidityType=C;exports.isValidDataLocation=T;exports.parseAbiParameter=y;exports.parseConstructorSignature=I;exports.parseErrorSignature=M;exports.parseEventSignature=P;exports.parseFallbackSignature=R;exports.parseFunctionSignature=E;exports.parseSignature=z;exports.splitParameters=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index290.cjs"),t=require("./index300.cjs"),d=require("./index301.cjs");function c(e,n){return!!(e.inputs.some(r=>r.UnresolvedObject||r.UnresolvedPure)||!n.onlyTransactionKind&&(!e.gasConfig.price||!e.gasConfig.budget||!e.gasConfig.payment))}async function a(e,n,r){var s;if(g(e),!c(e,n))return await o(e),r();const i=l(n);return(((s=i.core)==null?void 0:s.resolveTransactionPlugin())??d.jsonRpcClientResolveTransactionPlugin(i))(e,n,async()=>{await o(e),await r()})}function o(e){e.inputs.forEach((n,r)=>{if(n.$kind!=="Object"&&n.$kind!=="Pure")throw new Error(`Input at index ${r} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(n)}`)})}function l(e){if(!e.client)throw new Error("No sui client passed to Transaction#build, but transaction data was not sufficient to build offline.");return e.client}function g(e){for(const n of e.commands)switch(n.$kind){case"SplitCoins":n.SplitCoins.amounts.forEach(r=>{u(r,t.bcs.U64,e)});break;case"TransferObjects":u(n.TransferObjects.address,t.bcs.Address,e);break}}function u(e,n,r){if(e.$kind!=="Input")return;const i=r.inputs[e.Input];i.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=f.Inputs.Pure(n.serialize(i.UnresolvedPure.value)))}exports.getClient=l;exports.needsTransactionResolution=c;exports.resolveTransactionPlugin=a;
package/dist/index291.js CHANGED
@@ -1,191 +1,56 @@
1
- import { execTyped as E, bytesRegex as x, integerRegex as $, isTupleRegex as P } from "./index288.js";
2
- import { UnknownSolidityTypeError as M } from "./index293.js";
3
- import { InvalidParameterError as R, SolidityProtectedKeywordError as k, InvalidModifierError as z, InvalidFunctionModifierError as A } from "./index295.js";
4
- import { UnknownSignatureError as F, InvalidSignatureError as m } from "./index296.js";
5
- import { InvalidParenthesisError as T } from "./index297.js";
6
- import { getParameterCacheKey as _, parameterCache as p } from "./index360.js";
7
- import { isFunctionSignature as C, isEventSignature as I, isErrorSignature as Z, isConstructorSignature as K, isFallbackSignature as L, isReceiveSignature as U, functionModifiers as h, execFunctionSignature as W, execEventSignature as D, eventModifiers as V, execErrorSignature as j, execConstructorSignature as q, execFallbackSignature as B } from "./index289.js";
8
- function le(e, t = {}) {
9
- if (C(e))
10
- return G(e, t);
11
- if (I(e))
12
- return H(e, t);
13
- if (Z(e))
14
- return J(e, t);
15
- if (K(e))
16
- return N(e, t);
17
- if (L(e))
18
- return O(e);
19
- if (U(e))
20
- return {
21
- type: "receive",
22
- stateMutability: "payable"
23
- };
24
- throw new F({ signature: e });
25
- }
26
- function G(e, t = {}) {
27
- const n = W(e);
28
- if (!n)
29
- throw new m({ signature: e, type: "function" });
30
- const a = u(n.parameters), r = [], c = a.length;
31
- for (let o = 0; o < c; o++)
32
- r.push(l(a[o], {
33
- modifiers: h,
34
- structs: t,
35
- type: "function"
36
- }));
37
- const i = [];
38
- if (n.returns) {
39
- const o = u(n.returns), s = o.length;
40
- for (let f = 0; f < s; f++)
41
- i.push(l(o[f], {
42
- modifiers: h,
43
- structs: t,
44
- type: "function"
45
- }));
46
- }
47
- return {
48
- name: n.name,
49
- type: "function",
50
- stateMutability: n.stateMutability ?? "nonpayable",
51
- inputs: r,
52
- outputs: i
53
- };
54
- }
55
- function H(e, t = {}) {
56
- const n = D(e);
57
- if (!n)
58
- throw new m({ signature: e, type: "event" });
59
- const a = u(n.parameters), r = [], c = a.length;
60
- for (let i = 0; i < c; i++)
61
- r.push(l(a[i], {
62
- modifiers: V,
63
- structs: t,
64
- type: "event"
65
- }));
66
- return { name: n.name, type: "event", inputs: r };
67
- }
68
- function J(e, t = {}) {
69
- const n = j(e);
70
- if (!n)
71
- throw new m({ signature: e, type: "error" });
72
- const a = u(n.parameters), r = [], c = a.length;
73
- for (let i = 0; i < c; i++)
74
- r.push(l(a[i], { structs: t, type: "error" }));
75
- return { name: n.name, type: "error", inputs: r };
76
- }
77
- function N(e, t = {}) {
78
- const n = q(e);
79
- if (!n)
80
- throw new m({ signature: e, type: "constructor" });
81
- const a = u(n.parameters), r = [], c = a.length;
82
- for (let i = 0; i < c; i++)
83
- r.push(l(a[i], { structs: t, type: "constructor" }));
84
- return {
85
- type: "constructor",
86
- stateMutability: n.stateMutability ?? "nonpayable",
87
- inputs: r
88
- };
89
- }
90
- function O(e) {
91
- const t = B(e);
92
- if (!t)
93
- throw new m({ signature: e, type: "fallback" });
94
- return {
95
- type: "fallback",
96
- stateMutability: t.stateMutability ?? "nonpayable"
97
- };
98
- }
99
- const Q = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, X = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, Y = /^u?int$/;
100
- function l(e, t) {
101
- var y, b;
102
- const n = _(e, t == null ? void 0 : t.type, t == null ? void 0 : t.structs);
103
- if (p.has(n))
104
- return p.get(n);
105
- const a = P.test(e), r = E(a ? X : Q, e);
106
- if (!r)
107
- throw new R({ param: e });
108
- if (r.name && re(r.name))
109
- throw new k({ param: e, name: r.name });
110
- const c = r.name ? { name: r.name } : {}, i = r.modifier === "indexed" ? { indexed: !0 } : {}, o = (t == null ? void 0 : t.structs) ?? {};
111
- let s, f = {};
112
- if (a) {
113
- s = "tuple";
114
- const w = u(r.type), S = [], v = w.length;
115
- for (let d = 0; d < v; d++)
116
- S.push(l(w[d], { structs: o }));
117
- f = { components: S };
118
- } else if (r.type in o)
119
- s = "tuple", f = { components: o[r.type] };
120
- else if (Y.test(r.type))
121
- s = `${r.type}256`;
122
- else if (r.type === "address payable")
123
- s = "address";
124
- else if (s = r.type, (t == null ? void 0 : t.type) !== "struct" && !ee(s))
125
- throw new M({ type: s });
126
- if (r.modifier) {
127
- if (!((b = (y = t == null ? void 0 : t.modifiers) == null ? void 0 : y.has) != null && b.call(y, r.modifier)))
128
- throw new z({
129
- param: e,
130
- type: t == null ? void 0 : t.type,
131
- modifier: r.modifier
132
- });
133
- if (h.has(r.modifier) && !ne(s, !!r.array))
134
- throw new A({
135
- param: e,
136
- type: t == null ? void 0 : t.type,
137
- modifier: r.modifier
138
- });
139
- }
140
- const g = {
141
- type: `${s}${r.array ?? ""}`,
142
- ...c,
143
- ...i,
144
- ...f
145
- };
146
- return p.set(n, g), g;
147
- }
148
- function u(e, t = [], n = "", a = 0) {
149
- const r = e.trim().length;
150
- for (let c = 0; c < r; c++) {
151
- const i = e[c], o = e.slice(c + 1);
152
- switch (i) {
153
- case ",":
154
- return a === 0 ? u(o, [...t, n.trim()]) : u(o, t, `${n}${i}`, a);
155
- case "(":
156
- return u(o, t, `${n}${i}`, a + 1);
157
- case ")":
158
- return u(o, t, `${n}${i}`, a - 1);
159
- default:
160
- return u(o, t, `${n}${i}`, a);
1
+ import { Inputs as c } from "./index290.js";
2
+ import { bcs as o } from "./index300.js";
3
+ import { jsonRpcClientResolveTransactionPlugin as f } from "./index301.js";
4
+ function l(n, e) {
5
+ return !!(n.inputs.some((r) => r.UnresolvedObject || r.UnresolvedPure) || !e.onlyTransactionKind && (!n.gasConfig.price || !n.gasConfig.budget || !n.gasConfig.payment));
6
+ }
7
+ async function w(n, e, r) {
8
+ var s;
9
+ if (a(n), !l(n, e))
10
+ return await t(n), r();
11
+ const i = d(e);
12
+ return (((s = i.core) == null ? void 0 : s.resolveTransactionPlugin()) ?? f(i))(n, e, async () => {
13
+ await t(n), await r();
14
+ });
15
+ }
16
+ function t(n) {
17
+ n.inputs.forEach((e, r) => {
18
+ if (e.$kind !== "Object" && e.$kind !== "Pure")
19
+ throw new Error(
20
+ `Input at index ${r} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(
21
+ e
22
+ )}`
23
+ );
24
+ });
25
+ }
26
+ function d(n) {
27
+ if (!n.client)
28
+ throw new Error(
29
+ "No sui client passed to Transaction#build, but transaction data was not sufficient to build offline."
30
+ );
31
+ return n.client;
32
+ }
33
+ function a(n) {
34
+ for (const e of n.commands)
35
+ switch (e.$kind) {
36
+ case "SplitCoins":
37
+ e.SplitCoins.amounts.forEach((r) => {
38
+ u(r, o.U64, n);
39
+ });
40
+ break;
41
+ case "TransferObjects":
42
+ u(e.TransferObjects.address, o.Address, n);
43
+ break;
161
44
  }
162
- }
163
- if (n === "")
164
- return t;
165
- if (a !== 0)
166
- throw new T({ current: n, depth: a });
167
- return t.push(n.trim()), t;
168
- }
169
- function ee(e) {
170
- return e === "address" || e === "bool" || e === "function" || e === "string" || x.test(e) || $.test(e);
171
- }
172
- const te = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;
173
- function re(e) {
174
- return e === "address" || e === "bool" || e === "function" || e === "string" || e === "tuple" || x.test(e) || $.test(e) || te.test(e);
175
45
  }
176
- function ne(e, t) {
177
- return t || e === "bytes" || e === "string" || e === "tuple";
46
+ function u(n, e, r) {
47
+ if (n.$kind !== "Input")
48
+ return;
49
+ const i = r.inputs[n.Input];
50
+ i.$kind === "UnresolvedPure" && (r.inputs[n.Input] = c.Pure(e.serialize(i.UnresolvedPure.value)));
178
51
  }
179
52
  export {
180
- re as isSolidityKeyword,
181
- ee as isSolidityType,
182
- ne as isValidDataLocation,
183
- l as parseAbiParameter,
184
- N as parseConstructorSignature,
185
- J as parseErrorSignature,
186
- H as parseEventSignature,
187
- O as parseFallbackSignature,
188
- G as parseFunctionSignature,
189
- le as parseSignature,
190
- u as splitParameters
53
+ d as getClient,
54
+ l as needsTransactionResolution,
55
+ w as resolveTransactionPlugin
191
56
  };
package/dist/index292.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index293.cjs"),u=require("./index289.cjs"),a=require("./index290.cjs"),s=require("./index291.cjs");function l(t){let e;if(typeof t=="string")e=s.parseSignature(t);else{const n=a.parseStructs(t),o=t.length;for(let r=0;r<o;r++){const i=t[r];if(!u.isStructSignature(i)){e=s.parseSignature(i,n);break}}}if(!e)throw new c.InvalidAbiItemError({signature:t});return e}exports.parseAbiItem=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index290.cjs");function b(d){function e(t){return d(t)}return e.system=t=>{const r=t==null?void 0:t.mutable;return e(r!==void 0?c.Inputs.SharedObjectRef({objectId:"0x5",initialSharedVersion:1,mutable:r}):{$kind:"UnresolvedObject",UnresolvedObject:{objectId:"0x5",initialSharedVersion:1}})},e.clock=()=>e(c.Inputs.SharedObjectRef({objectId:"0x6",initialSharedVersion:1,mutable:!1})),e.random=()=>e({$kind:"UnresolvedObject",UnresolvedObject:{objectId:"0x8",mutable:!1}}),e.denyList=t=>e({$kind:"UnresolvedObject",UnresolvedObject:{objectId:"0x403",mutable:t==null?void 0:t.mutable}}),e.option=({type:t,value:r})=>n=>n.moveCall({typeArguments:[t],target:`0x1::option::${r===null?"none":"some"}`,arguments:r===null?[]:[n.object(r)]}),e}exports.createObjectMethods=b;
package/dist/index292.js CHANGED
@@ -1,25 +1,47 @@
1
- import { InvalidAbiItemError as f } from "./index293.js";
2
- import { isStructSignature as p } from "./index289.js";
3
- import { parseStructs as c } from "./index290.js";
4
- import { parseSignature as i } from "./index291.js";
5
- function u(t) {
6
- let r;
7
- if (typeof t == "string")
8
- r = i(t);
9
- else {
10
- const m = c(t), n = t.length;
11
- for (let o = 0; o < n; o++) {
12
- const e = t[o];
13
- if (!p(e)) {
14
- r = i(e, m);
15
- break;
1
+ import { Inputs as d } from "./index290.js";
2
+ function l(b) {
3
+ function e(t) {
4
+ return b(t);
5
+ }
6
+ return e.system = (t) => {
7
+ const r = t == null ? void 0 : t.mutable;
8
+ return e(
9
+ r !== void 0 ? d.SharedObjectRef({
10
+ objectId: "0x5",
11
+ initialSharedVersion: 1,
12
+ mutable: r
13
+ }) : {
14
+ $kind: "UnresolvedObject",
15
+ UnresolvedObject: {
16
+ objectId: "0x5",
17
+ initialSharedVersion: 1
18
+ }
16
19
  }
20
+ );
21
+ }, e.clock = () => e(
22
+ d.SharedObjectRef({
23
+ objectId: "0x6",
24
+ initialSharedVersion: 1,
25
+ mutable: !1
26
+ })
27
+ ), e.random = () => e({
28
+ $kind: "UnresolvedObject",
29
+ UnresolvedObject: {
30
+ objectId: "0x8",
31
+ mutable: !1
17
32
  }
18
- }
19
- if (!r)
20
- throw new f({ signature: t });
21
- return r;
33
+ }), e.denyList = (t) => e({
34
+ $kind: "UnresolvedObject",
35
+ UnresolvedObject: {
36
+ objectId: "0x403",
37
+ mutable: t == null ? void 0 : t.mutable
38
+ }
39
+ }), e.option = ({ type: t, value: r }) => (n) => n.moveCall({
40
+ typeArguments: [t],
41
+ target: `0x1::option::${r === null ? "none" : "some"}`,
42
+ arguments: r === null ? [] : [n.object(r)]
43
+ }), e;
22
44
  }
23
45
  export {
24
- u as parseAbiItem
46
+ l as createObjectMethods
25
47
  };