@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/index296.js CHANGED
@@ -1,43 +1,22 @@
1
- import { BaseError as r } from "./index283.js";
2
- class u extends r {
3
- constructor({ signature: e, type: n }) {
4
- super(`Invalid ${n} signature.`, {
5
- details: e
6
- }), Object.defineProperty(this, "name", {
7
- enumerable: !0,
8
- configurable: !0,
9
- writable: !0,
10
- value: "InvalidSignatureError"
11
- });
12
- }
13
- }
14
- class i extends r {
15
- constructor({ signature: e }) {
16
- super("Unknown signature.", {
17
- details: e
18
- }), Object.defineProperty(this, "name", {
19
- enumerable: !0,
20
- configurable: !0,
21
- writable: !0,
22
- value: "UnknownSignatureError"
23
- });
24
- }
25
- }
26
- class s extends r {
27
- constructor({ signature: e }) {
28
- super("Invalid struct signature.", {
29
- details: e,
30
- metaMessages: ["No properties exist."]
31
- }), Object.defineProperty(this, "name", {
32
- enumerable: !0,
33
- configurable: !0,
34
- writable: !0,
35
- value: "InvalidStructSignatureError"
36
- });
37
- }
1
+ import { findNamesInTransaction as r, replaceNames as o } from "./index120.js";
2
+ const p = (t) => async (n, s, a) => {
3
+ const e = r(n);
4
+ if (e.types.length === 0 && e.packages.length === 0)
5
+ return a();
6
+ const i = await c(s).core.mvr.resolve({
7
+ types: e.types,
8
+ packages: e.packages
9
+ });
10
+ o(n, i), await a();
11
+ };
12
+ function c(t) {
13
+ if (!t.client)
14
+ throw new Error(
15
+ "No sui client passed to Transaction#build, but transaction data was not sufficient to build offline."
16
+ );
17
+ return t.client;
38
18
  }
39
19
  export {
40
- u as InvalidSignatureError,
41
- s as InvalidStructSignatureError,
42
- i as UnknownSignatureError
20
+ c as getClient,
21
+ p as namedPackagesPlugin
43
22
  };
package/dist/index297.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index283.cjs");class t extends s.BaseError{constructor({current:r,depth:e}){super("Unbalanced parentheses.",{metaMessages:[`"${r.trim()}" has too many ${e>0?"opening":"closing"} parentheses.`],details:`Depth "${e}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}exports.InvalidParenthesisError=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index113.cjs"),l=require("./index114.cjs"),h=require("./index115.cjs");function f(e,n){switch(n){case"base58":return a.toBase58(e);case"base64":return l.toBase64(e);case"hex":return h.toHex(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function p(e,n=["<",">"]){const[i,u]=n,s=[];let t="",o=0;for(let c=0;c<e.length;c++){const r=e[c];if(r===i&&o++,r===u&&o--,o===0&&r===","){s.push(t.trim()),t="";continue}t+=r}return s.push(t.trim()),s}exports.encodeStr=f;exports.splitGenericParameters=p;
package/dist/index297.js CHANGED
@@ -1,19 +1,32 @@
1
- import { BaseError as s } from "./index283.js";
2
- class n extends s {
3
- constructor({ current: r, depth: e }) {
4
- super("Unbalanced parentheses.", {
5
- metaMessages: [
6
- `"${r.trim()}" has too many ${e > 0 ? "opening" : "closing"} parentheses.`
7
- ],
8
- details: `Depth "${e}"`
9
- }), Object.defineProperty(this, "name", {
10
- enumerable: !0,
11
- configurable: !0,
12
- writable: !0,
13
- value: "InvalidParenthesisError"
14
- });
1
+ import { toBase58 as a } from "./index113.js";
2
+ import { toBase64 as f } from "./index114.js";
3
+ import { toHex as p } from "./index115.js";
4
+ function d(e, o) {
5
+ switch (o) {
6
+ case "base58":
7
+ return a(e);
8
+ case "base64":
9
+ return f(e);
10
+ case "hex":
11
+ return p(e);
12
+ default:
13
+ throw new Error("Unsupported encoding, supported values are: base64, hex");
15
14
  }
16
15
  }
16
+ function g(e, o = ["<", ">"]) {
17
+ const [c, u] = o, n = [];
18
+ let t = "", s = 0;
19
+ for (let i = 0; i < e.length; i++) {
20
+ const r = e[i];
21
+ if (r === c && s++, r === u && s--, s === 0 && r === ",") {
22
+ n.push(t.trim()), t = "";
23
+ continue;
24
+ }
25
+ t += r;
26
+ }
27
+ return n.push(t.trim()), n;
28
+ }
17
29
  export {
18
- n as InvalidParenthesisError
30
+ d as encodeStr,
31
+ g as splitGenericParameters
19
32
  };
package/dist/index298.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index283.cjs");class t extends r.BaseError{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}exports.CircularReferenceError=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e,t){return Array.from({length:Math.ceil(e.length/t)},(u,n)=>e.slice(n*t,(n+1)*t))}exports.chunk=r;
package/dist/index298.js CHANGED
@@ -1,16 +1,6 @@
1
- import { BaseError as r } from "./index283.js";
2
- class a extends r {
3
- constructor({ type: e }) {
4
- super("Circular reference detected.", {
5
- metaMessages: [`Struct "${e}" is a circular reference.`]
6
- }), Object.defineProperty(this, "name", {
7
- enumerable: !0,
8
- configurable: !0,
9
- writable: !0,
10
- value: "CircularReferenceError"
11
- });
12
- }
1
+ function c(t, n) {
2
+ return Array.from({ length: Math.ceil(t.length / n) }, (e, r) => t.slice(r * n, (r + 1) * n));
13
3
  }
14
4
  export {
15
- a as CircularReferenceError
5
+ c as chunk
16
6
  };
package/dist/index299.cjs CHANGED
@@ -1 +1,7 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class y{constructor(e,r){if(typeof e!="function")throw new TypeError(`DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but got: ${e}.`);this._batchLoadFn=e,this._maxBatchSize=g(r),this._batchScheduleFn=w(r),this._cacheKeyFn=b(r),this._cacheMap=P(r),this._batch=null,this.name=S(r)}load(e){if(e==null)throw new TypeError(`The loader.load() function must be called with a value, but got: ${String(e)}.`);const r=m(this),c=this._cacheMap;let n;if(c){n=this._cacheKeyFn(e);const i=c.get(n);if(i){const s=r.cacheHits||(r.cacheHits=[]);return new Promise(f=>{s.push(()=>{f(i)})})}}r.keys.push(e);const a=new Promise((i,s)=>{r.callbacks.push({resolve:i,reject:s})});return c&&c.set(n,a),a}loadMany(e){if(!l(e))throw new TypeError(`The loader.loadMany() function must be called with Array<key>, but got: ${e}.`);const r=[];for(let c=0;c<e.length;c++)r.push(this.load(e[c]).catch(n=>n));return Promise.all(r)}clear(e){const r=this._cacheMap;if(r){const c=this._cacheKeyFn(e);r.delete(c)}return this}clearAll(){const e=this._cacheMap;return e&&e.clear(),this}prime(e,r){const c=this._cacheMap;if(c){const n=this._cacheKeyFn(e);if(c.get(n)===void 0){let a;r instanceof Error?(a=Promise.reject(r),a.catch(()=>{})):a=Promise.resolve(r),c.set(n,a)}}return this}}const d=typeof process=="object"&&typeof process.nextTick=="function"?function(t){o||(o=Promise.resolve()),o.then(()=>{process.nextTick(t)})}:typeof setImmediate=="function"?function(t){setImmediate(t)}:function(t){setTimeout(t)};let o;function m(t){const e=t._batch;if(e!==null&&!e.hasDispatched&&e.keys.length<t._maxBatchSize)return e;const r={hasDispatched:!1,keys:[],callbacks:[]};return t._batch=r,t._batchScheduleFn(()=>{p(t,r)}),r}function p(t,e){if(e.hasDispatched=!0,e.keys.length===0){u(e);return}let r;try{r=t._batchLoadFn(e.keys)}catch(c){return h(t,e,new TypeError(`DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function errored synchronously: ${String(c)}.`))}if(!r||typeof r.then!="function")return h(t,e,new TypeError(`DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise: ${String(r)}.`));Promise.resolve(r).then(c=>{if(!l(c))throw new TypeError(`DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array: ${String(c)}.`);if(c.length!==e.keys.length)throw new TypeError(`DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array of the same length as the Array of keys.
2
+
3
+ Keys:
4
+ ${String(e.keys)}
5
+
6
+ Values:
7
+ ${String(c)}`);u(e);for(let n=0;n<e.callbacks.length;n++){const a=c[n];a instanceof Error?e.callbacks[n].reject(a):e.callbacks[n].resolve(a)}}).catch(c=>{h(t,e,c)})}function h(t,e,r){u(e);for(let c=0;c<e.keys.length;c++)t.clear(e.keys[c]),e.callbacks[c].reject(r)}function u(t){if(t.cacheHits)for(let e=0;e<t.cacheHits.length;e++)t.cacheHits[e]()}function g(t){if(!(!t||t.batch!==!1))return 1;const r=t&&t.maxBatchSize;if(r===void 0)return 1/0;if(typeof r!="number"||r<1)throw new TypeError(`maxBatchSize must be a positive number: ${r}`);return r}function w(t){const e=t&&t.batchScheduleFn;if(e===void 0)return d;if(typeof e!="function")throw new TypeError(`batchScheduleFn must be a function: ${e}`);return e}function b(t){const e=t&&t.cacheKeyFn;if(e===void 0)return r=>r;if(typeof e!="function")throw new TypeError(`cacheKeyFn must be a function: ${e}`);return e}function P(t){if(!(!t||t.cache!==!1))return null;const r=t&&t.cacheMap;if(r===void 0)return new Map;if(r!==null){const n=["get","set","delete","clear"].filter(a=>r&&typeof r[a]!="function");if(n.length!==0)throw new TypeError("Custom cacheMap missing methods: "+n.join(", "))}return r}function S(t){return t&&t.name?t.name:null}function l(t){return typeof t=="object"&&t!==null&&"length"in t&&typeof t.length=="number"&&(t.length===0||t.length>0&&Object.prototype.hasOwnProperty.call(t,t.length-1))}exports.DataLoader=y;
package/dist/index299.js CHANGED
@@ -1,10 +1,240 @@
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;
1
+ class k {
2
+ constructor(e, c) {
3
+ if (typeof e != "function")
4
+ throw new TypeError(
5
+ `DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but got: ${e}.`
6
+ );
7
+ this._batchLoadFn = e, this._maxBatchSize = p(c), this._batchScheduleFn = w(c), this._cacheKeyFn = g(c), this._cacheMap = b(c), this._batch = null, this.name = P(c);
8
+ }
9
+ /**
10
+ * Loads a key, returning a `Promise` for the value represented by that key.
11
+ */
12
+ load(e) {
13
+ if (e == null)
14
+ throw new TypeError(
15
+ `The loader.load() function must be called with a value, but got: ${String(e)}.`
16
+ );
17
+ const c = d(this), r = this._cacheMap;
18
+ let n;
19
+ if (r) {
20
+ n = this._cacheKeyFn(e);
21
+ const i = r.get(n);
22
+ if (i) {
23
+ const s = c.cacheHits || (c.cacheHits = []);
24
+ return new Promise((f) => {
25
+ s.push(() => {
26
+ f(i);
27
+ });
28
+ });
29
+ }
30
+ }
31
+ c.keys.push(e);
32
+ const a = new Promise((i, s) => {
33
+ c.callbacks.push({ resolve: i, reject: s });
34
+ });
35
+ return r && r.set(n, a), a;
36
+ }
37
+ /**
38
+ * Loads multiple keys, promising an array of values:
39
+ *
40
+ * var [ a, b ] = await myLoader.loadMany([ 'a', 'b' ]);
41
+ *
42
+ * This is similar to the more verbose:
43
+ *
44
+ * var [ a, b ] = await Promise.all([
45
+ * myLoader.load('a'),
46
+ * myLoader.load('b')
47
+ * ]);
48
+ *
49
+ * However it is different in the case where any load fails. Where
50
+ * Promise.all() would reject, loadMany() always resolves, however each result
51
+ * is either a value or an Error instance.
52
+ *
53
+ * var [ a, b, c ] = await myLoader.loadMany([ 'a', 'b', 'badkey' ]);
54
+ * // c instanceof Error
55
+ *
56
+ */
57
+ loadMany(e) {
58
+ if (!l(e))
59
+ throw new TypeError(
60
+ `The loader.loadMany() function must be called with Array<key>, but got: ${e}.`
61
+ );
62
+ const c = [];
63
+ for (let r = 0; r < e.length; r++)
64
+ c.push(this.load(e[r]).catch((n) => n));
65
+ return Promise.all(c);
66
+ }
67
+ /**
68
+ * Clears the value at `key` from the cache, if it exists. Returns itself for
69
+ * method chaining.
70
+ */
71
+ clear(e) {
72
+ const c = this._cacheMap;
73
+ if (c) {
74
+ const r = this._cacheKeyFn(e);
75
+ c.delete(r);
76
+ }
77
+ return this;
78
+ }
79
+ /**
80
+ * Clears the entire cache. To be used when some event results in unknown
81
+ * invalidations across this particular `DataLoader`. Returns itself for
82
+ * method chaining.
83
+ */
84
+ clearAll() {
85
+ const e = this._cacheMap;
86
+ return e && e.clear(), this;
87
+ }
88
+ /**
89
+ * Adds the provided key and value to the cache. If the key already
90
+ * exists, no change is made. Returns itself for method chaining.
91
+ *
92
+ * To prime the cache with an error at a key, provide an Error instance.
93
+ */
94
+ prime(e, c) {
95
+ const r = this._cacheMap;
96
+ if (r) {
97
+ const n = this._cacheKeyFn(e);
98
+ if (r.get(n) === void 0) {
99
+ let a;
100
+ c instanceof Error ? (a = Promise.reject(c), a.catch(() => {
101
+ })) : a = Promise.resolve(c), r.set(n, a);
102
+ }
103
+ }
104
+ return this;
105
+ }
106
+ }
107
+ const y = (
108
+ /** @ts-ignore */
109
+ typeof process == "object" && typeof process.nextTick == "function" ? function(t) {
110
+ o || (o = Promise.resolve()), o.then(() => {
111
+ process.nextTick(t);
112
+ });
113
+ } : (
114
+ // @ts-ignore
115
+ typeof setImmediate == "function" ? function(t) {
116
+ setImmediate(t);
117
+ } : function(t) {
118
+ setTimeout(t);
119
+ }
120
+ )
121
+ );
122
+ let o;
123
+ function d(t) {
124
+ const e = t._batch;
125
+ if (e !== null && !e.hasDispatched && e.keys.length < t._maxBatchSize)
126
+ return e;
127
+ const c = { hasDispatched: !1, keys: [], callbacks: [] };
128
+ return t._batch = c, t._batchScheduleFn(() => {
129
+ m(t, c);
130
+ }), c;
131
+ }
132
+ function m(t, e) {
133
+ if (e.hasDispatched = !0, e.keys.length === 0) {
134
+ u(e);
135
+ return;
136
+ }
137
+ let c;
138
+ try {
139
+ c = t._batchLoadFn(e.keys);
140
+ } catch (r) {
141
+ return h(
142
+ t,
143
+ e,
144
+ new TypeError(
145
+ `DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function errored synchronously: ${String(r)}.`
146
+ )
147
+ );
148
+ }
149
+ if (!c || typeof c.then != "function")
150
+ return h(
151
+ t,
152
+ e,
153
+ new TypeError(
154
+ `DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise: ${String(c)}.`
155
+ )
156
+ );
157
+ Promise.resolve(c).then((r) => {
158
+ if (!l(r))
159
+ throw new TypeError(
160
+ `DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array: ${String(r)}.`
161
+ );
162
+ if (r.length !== e.keys.length)
163
+ throw new TypeError(
164
+ `DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array of the same length as the Array of keys.
165
+
166
+ Keys:
167
+ ${String(e.keys)}
168
+
169
+ Values:
170
+ ${String(r)}`
171
+ );
172
+ u(e);
173
+ for (let n = 0; n < e.callbacks.length; n++) {
174
+ const a = r[n];
175
+ a instanceof Error ? e.callbacks[n].reject(a) : e.callbacks[n].resolve(a);
176
+ }
177
+ }).catch((r) => {
178
+ h(t, e, r);
179
+ });
180
+ }
181
+ function h(t, e, c) {
182
+ u(e);
183
+ for (let r = 0; r < e.keys.length; r++)
184
+ t.clear(e.keys[r]), e.callbacks[r].reject(c);
185
+ }
186
+ function u(t) {
187
+ if (t.cacheHits)
188
+ for (let e = 0; e < t.cacheHits.length; e++)
189
+ t.cacheHits[e]();
190
+ }
191
+ function p(t) {
192
+ if (!(!t || t.batch !== !1))
193
+ return 1;
194
+ const c = t && t.maxBatchSize;
195
+ if (c === void 0)
196
+ return 1 / 0;
197
+ if (typeof c != "number" || c < 1)
198
+ throw new TypeError(`maxBatchSize must be a positive number: ${c}`);
199
+ return c;
200
+ }
201
+ function w(t) {
202
+ const e = t && t.batchScheduleFn;
203
+ if (e === void 0)
204
+ return y;
205
+ if (typeof e != "function")
206
+ throw new TypeError(`batchScheduleFn must be a function: ${e}`);
207
+ return e;
208
+ }
209
+ function g(t) {
210
+ const e = t && t.cacheKeyFn;
211
+ if (e === void 0)
212
+ return (c) => c;
213
+ if (typeof e != "function")
214
+ throw new TypeError(`cacheKeyFn must be a function: ${e}`);
215
+ return e;
216
+ }
217
+ function b(t) {
218
+ if (!(!t || t.cache !== !1))
219
+ return null;
220
+ const c = t && t.cacheMap;
221
+ if (c === void 0)
222
+ return /* @__PURE__ */ new Map();
223
+ if (c !== null) {
224
+ const n = ["get", "set", "delete", "clear"].filter(
225
+ (a) => c && typeof c[a] != "function"
226
+ );
227
+ if (n.length !== 0)
228
+ throw new TypeError("Custom cacheMap missing methods: " + n.join(", "));
229
+ }
230
+ return c;
231
+ }
232
+ function P(t) {
233
+ return t && t.name ? t.name : null;
234
+ }
235
+ function l(t) {
236
+ return typeof t == "object" && t !== null && "length" in t && typeof t.length == "number" && (t.length === 0 || t.length > 0 && Object.prototype.hasOwnProperty.call(t, t.length - 1));
7
237
  }
8
238
  export {
9
- c as createFilterRequestScope
239
+ k as DataLoader
10
240
  };
package/dist/index300.cjs CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index363.cjs"),e=require("./index367.cjs"),a=require("./index368.cjs"),n={...t.bcs,U8:t.bcs.u8(),U16:t.bcs.u16(),U32:t.bcs.u32(),U64:t.bcs.u64(),U128:t.bcs.u128(),U256:t.bcs.u256(),ULEB128:t.bcs.uleb128(),Bool:t.bcs.bool(),String:t.bcs.string(),Address:e.Address,AppId:e.AppId,Argument:e.Argument,CallArg:e.CallArg,Command:e.Command,CompressedSignature:e.CompressedSignature,GasData:e.GasData,Intent:e.Intent,IntentMessage:e.IntentMessage,IntentScope:e.IntentScope,IntentVersion:e.IntentVersion,MultiSig:e.MultiSig,MultiSigPkMap:e.MultiSigPkMap,MultiSigPublicKey:e.MultiSigPublicKey,ObjectArg:e.ObjectArg,ObjectDigest:e.ObjectDigest,Owner:e.Owner,PasskeyAuthenticator:e.PasskeyAuthenticator,ProgrammableMoveCall:e.ProgrammableMoveCall,ProgrammableTransaction:e.ProgrammableTransaction,PublicKey:e.PublicKey,SenderSignedData:e.SenderSignedData,SenderSignedTransaction:e.SenderSignedTransaction,SharedObjectRef:e.SharedObjectRef,StructTag:e.StructTag,SuiObjectRef:e.SuiObjectRef,TransactionData:e.TransactionData,TransactionDataV1:e.TransactionDataV1,TransactionEffects:a.TransactionEffects,TransactionExpiration:e.TransactionExpiration,TransactionKind:e.TransactionKind,TypeTag:e.TypeTag};exports.bcs=n;
package/dist/index300.js CHANGED
@@ -1,40 +1,50 @@
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;
35
- }
1
+ import { bcs as t } from "./index363.js";
2
+ import { TransactionKind as a, TransactionData as e, TypeTag as n, TransactionExpiration as r, TransactionDataV1 as i, SuiObjectRef as o, StructTag as s, SharedObjectRef as c, SenderSignedTransaction as u, SenderSignedData as g, PublicKey as l, ProgrammableTransaction as m, ProgrammableMoveCall as S, PasskeyAuthenticator as b, Owner as d, ObjectDigest as p, ObjectArg as T, MultiSigPublicKey as f, MultiSigPkMap as U, MultiSig as A, IntentVersion as M, IntentScope as P, IntentMessage as D, Intent as I, GasData as O, CompressedSignature as j, Command as y, CallArg as C, Argument as B, AppId as E, Address as K } from "./index367.js";
3
+ import { TransactionEffects as h } from "./index368.js";
4
+ const V = {
5
+ ...t,
6
+ U8: t.u8(),
7
+ U16: t.u16(),
8
+ U32: t.u32(),
9
+ U64: t.u64(),
10
+ U128: t.u128(),
11
+ U256: t.u256(),
12
+ ULEB128: t.uleb128(),
13
+ Bool: t.bool(),
14
+ String: t.string(),
15
+ Address: K,
16
+ AppId: E,
17
+ Argument: B,
18
+ CallArg: C,
19
+ Command: y,
20
+ CompressedSignature: j,
21
+ GasData: O,
22
+ Intent: I,
23
+ IntentMessage: D,
24
+ IntentScope: P,
25
+ IntentVersion: M,
26
+ MultiSig: A,
27
+ MultiSigPkMap: U,
28
+ MultiSigPublicKey: f,
29
+ ObjectArg: T,
30
+ ObjectDigest: p,
31
+ Owner: d,
32
+ PasskeyAuthenticator: b,
33
+ ProgrammableMoveCall: S,
34
+ ProgrammableTransaction: m,
35
+ PublicKey: l,
36
+ SenderSignedData: g,
37
+ SenderSignedTransaction: u,
38
+ SharedObjectRef: c,
39
+ StructTag: s,
40
+ SuiObjectRef: o,
41
+ TransactionData: e,
42
+ TransactionDataV1: i,
43
+ TransactionEffects: h,
44
+ TransactionExpiration: r,
45
+ TransactionKind: a,
46
+ TypeTag: n
47
+ };
36
48
  export {
37
- g as cleanupCache,
38
- f as listenersCache,
39
- y as observe
49
+ V as bcs
40
50
  };
package/dist/index301.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index252.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index285.cjs"),I=require("./index117.cjs"),w=require("./index369.cjs"),M=require("./index287.cjs"),b=require("./index290.cjs"),m=require("./index370.cjs"),U=require("./index298.cjs"),S=50,T=1000n,R=5e10;function $(n){return async function(r,a,s){return await A(r,n),await E(r,n),a.onlyTransactionKind||(await _(r,n),await k(r,n),await P(r,n)),await s()}}async function _(n,c){n.gasConfig.price||(n.gasConfig.price=String(await c.getReferenceGasPrice()))}async function k(n,c){if(n.gasConfig.budget)return;const r=await c.dryRunTransactionBlock({transactionBlock:n.build({overrides:{gasData:{budget:String(R),payment:[]}}})});if(r.effects.status.status!=="success")throw new Error(`Dry run failed, could not automatically determine a budget: ${r.effects.status.error}`,{cause:r});const a=T*BigInt(n.gasConfig.price||1n),s=BigInt(r.effects.gasUsed.computationCost)+a,d=s+BigInt(r.effects.gasUsed.storageCost)-BigInt(r.effects.gasUsed.storageRebate);n.gasConfig.budget=String(d>s?d:s)}async function P(n,c){if(!n.gasConfig.payment){const a=(await c.getCoins({owner:n.gasConfig.owner||n.sender,coinType:w.SUI_TYPE_ARG})).data.filter(s=>!n.inputs.find(g=>{var i;return(i=g.Object)!=null&&i.ImmOrOwnedObject?s.coinObjectId===g.Object.ImmOrOwnedObject.objectId:!1})).map(s=>({objectId:s.coinObjectId,digest:s.digest,version:s.version}));if(!a.length)throw new Error("No valid gas coins found for the transaction.");n.gasConfig.payment=a.map(s=>j.parse(M.ObjectRefSchema,s))}}async function E(n,c){const r=n.inputs.filter(e=>{var t;return e.UnresolvedObject&&!(e.UnresolvedObject.version||(t=e.UnresolvedObject)!=null&&t.initialSharedVersion)}),a=[...new Set(r.map(e=>I.normalizeSuiObjectId(e.UnresolvedObject.objectId)))],s=a.length?U.chunk(a,S):[],d=(await Promise.all(s.map(e=>c.multiGetObjects({ids:e,options:{showOwner:!0}})))).flat(),g=new Map(a.map((e,t)=>[e,d[t]])),i=Array.from(g).filter(([e,t])=>t.error).map(([e,t])=>JSON.stringify(t.error));if(i.length)throw new Error(`The following input objects are invalid: ${i.join(", ")}`);const l=d.map(e=>{if(e.error||!e.data)throw new Error(`Failed to fetch object: ${e.error}`);const t=e.data.owner,f=t&&typeof t=="object"?"Shared"in t?t.Shared.initial_shared_version:"ConsensusAddressOwner"in t?t.ConsensusAddressOwner.start_version:null:null;return{objectId:e.data.objectId,digest:e.data.digest,version:e.data.version,initialSharedVersion:f}}),v=new Map(a.map((e,t)=>[e,l[t]]));for(const[e,t]of n.inputs.entries()){if(!t.UnresolvedObject)continue;let f;const u=I.normalizeSuiAddress(t.UnresolvedObject.objectId),o=v.get(u);t.UnresolvedObject.initialSharedVersion??(o==null?void 0:o.initialSharedVersion)?f=b.Inputs.SharedObjectRef({objectId:u,initialSharedVersion:t.UnresolvedObject.initialSharedVersion||(o==null?void 0:o.initialSharedVersion),mutable:t.UnresolvedObject.mutable||B(n,e)}):V(n,e)&&(f=b.Inputs.ReceivingRef({objectId:u,digest:t.UnresolvedObject.digest??(o==null?void 0:o.digest),version:t.UnresolvedObject.version??(o==null?void 0:o.version)})),n.inputs[n.inputs.indexOf(t)]=f??b.Inputs.ObjectRef({objectId:u,digest:t.UnresolvedObject.digest??(o==null?void 0:o.digest),version:t.UnresolvedObject.version??(o==null?void 0:o.version)})}}async function A(n,c){const{inputs:r,commands:a}=n,s=[],d=new Set;a.forEach(i=>{if(i.MoveCall){if(i.MoveCall._argumentTypes)return;if(i.MoveCall.arguments.map(e=>e.$kind==="Input"?n.inputs[e.Input]:null).some(e=>(e==null?void 0:e.UnresolvedPure)||(e==null?void 0:e.UnresolvedObject)&&typeof(e==null?void 0:e.UnresolvedObject.mutable)!="boolean")){const e=`${i.MoveCall.package}::${i.MoveCall.module}::${i.MoveCall.function}`;d.add(e),s.push(i.MoveCall)}}});const g=new Map;d.size>0&&await Promise.all([...d].map(async i=>{const[l,v,e]=i.split("::"),t=await c.getNormalizedMoveFunction({package:l,module:v,function:e});g.set(i,t.parameters.map(f=>m.normalizedTypeToMoveTypeSignature(f)))})),s.length&&await Promise.all(s.map(async i=>{const l=g.get(`${i.package}::${i.module}::${i.function}`);if(!l)return;const e=l.length>0&&m.isTxContext(l.at(-1))?l.slice(0,l.length-1):l;i._argumentTypes=e})),a.forEach(i=>{if(!i.MoveCall)return;const l=i.MoveCall,v=`${l.package}::${l.module}::${l.function}`,e=l._argumentTypes;if(e){if(e.length!==i.MoveCall.arguments.length)throw new Error(`Incorrect number of arguments for ${v}`);e.forEach((t,f)=>{var y,h;const u=l.arguments[f];if(u.$kind!=="Input")return;const o=r[u.Input];if(!o.UnresolvedPure&&!o.UnresolvedObject)return;const p=((y=o.UnresolvedPure)==null?void 0:y.value)??((h=o.UnresolvedObject)==null?void 0:h.objectId),O=m.getPureBcsSchema(t.body);if(O){u.type="pure",r[r.indexOf(o)]=b.Inputs.Pure(O.serialize(p));return}if(typeof p!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(p,null,2)}`);u.type="object";const C=o.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:p}}:o;r[u.Input]=C})}})}function B(n,c){let r=!1;return n.getInputUses(c,(a,s)=>{if(s.MoveCall&&s.MoveCall._argumentTypes){const d=s.MoveCall.arguments.indexOf(a);r=s.MoveCall._argumentTypes[d].ref!=="&"||r}(s.$kind==="MakeMoveVec"||s.$kind==="MergeCoins"||s.$kind==="SplitCoins"||s.$kind==="TransferObjects")&&(r=!0)}),r}function V(n,c){let r=!1;return n.getInputUses(c,(a,s)=>{if(s.MoveCall&&s.MoveCall._argumentTypes){const d=s.MoveCall.arguments.indexOf(a);r=z(s.MoveCall._argumentTypes[d])||r}}),r}function z(n){return typeof n.body!="object"||!("datatype"in n.body)?!1:n.body.datatype.package==="0x2"&&n.body.datatype.module==="transfer"&&n.body.datatype.type==="Receiving"}exports.jsonRpcClientResolveTransactionPlugin=$;