@gardenfi/swap 0.1.2 → 0.1.3-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/index113.cjs +1 -1
  2. package/dist/index113.js +1 -1
  3. package/dist/index116.cjs +1 -1
  4. package/dist/index116.js +1 -1
  5. package/dist/index117.cjs +1 -1
  6. package/dist/index117.js +1 -1
  7. package/dist/index12.cjs +1 -1
  8. package/dist/index12.js +1 -1
  9. package/dist/index120.cjs +1 -1
  10. package/dist/index120.js +2 -2
  11. package/dist/index121.cjs +1 -1
  12. package/dist/index121.js +7 -7
  13. package/dist/index126.cjs +1 -1
  14. package/dist/index126.js +2 -2
  15. package/dist/index127.cjs +1 -1
  16. package/dist/index127.js +1 -1
  17. package/dist/index128.cjs +1 -1
  18. package/dist/index128.js +1 -1
  19. package/dist/index129.cjs +1 -1
  20. package/dist/index129.js +1 -1
  21. package/dist/index130.cjs +1 -1
  22. package/dist/index130.js +2 -2
  23. package/dist/index138.cjs +1 -1
  24. package/dist/index138.js +1 -1
  25. package/dist/index140.cjs +1 -1
  26. package/dist/index140.js +1 -1
  27. package/dist/index148.cjs +1 -1
  28. package/dist/index148.js +1 -1
  29. package/dist/index149.cjs +1 -1
  30. package/dist/index149.js +1 -1
  31. package/dist/index154.cjs +1 -1
  32. package/dist/index154.js +1 -1
  33. package/dist/index162.cjs +1 -1
  34. package/dist/index162.js +2 -2
  35. package/dist/index173.cjs +1 -1
  36. package/dist/index173.js +2 -2
  37. package/dist/index303.cjs +1 -1
  38. package/dist/index303.js +10 -43
  39. package/dist/index304.cjs +1 -1
  40. package/dist/index304.js +16 -320
  41. package/dist/index305.cjs +1 -1
  42. package/dist/index305.js +21 -604
  43. package/dist/index306.cjs +1 -1
  44. package/dist/index306.js +14 -110
  45. package/dist/index307.cjs +1 -1
  46. package/dist/index307.js +13 -167
  47. package/dist/index308.cjs +1 -1
  48. package/dist/index308.js +13 -300
  49. package/dist/index309.cjs +1 -1
  50. package/dist/index309.js +9 -93
  51. package/dist/index310.cjs +1 -1
  52. package/dist/index310.js +13 -54
  53. package/dist/index311.cjs +1 -1
  54. package/dist/index311.js +23 -51
  55. package/dist/index312.cjs +1 -1
  56. package/dist/index312.js +30 -43
  57. package/dist/index313.cjs +2 -1
  58. package/dist/index313.js +18 -15
  59. package/dist/index314.cjs +1 -1
  60. package/dist/index314.js +14 -317
  61. package/dist/index315.cjs +1 -1
  62. package/dist/index315.js +41 -58
  63. package/dist/index316.cjs +1 -1
  64. package/dist/index316.js +319 -18
  65. package/dist/index317.cjs +1 -1
  66. package/dist/index317.js +602 -26
  67. package/dist/index318.cjs +1 -1
  68. package/dist/index318.js +110 -4
  69. package/dist/index319.cjs +1 -7
  70. package/dist/index319.js +166 -236
  71. package/dist/index320.cjs +1 -1
  72. package/dist/index320.js +302 -48
  73. package/dist/index321.cjs +1 -1
  74. package/dist/index321.js +92 -211
  75. package/dist/index322.cjs +1 -1
  76. package/dist/index322.js +49 -74
  77. package/dist/index323.cjs +1 -1
  78. package/dist/index323.js +51 -27
  79. package/dist/index324.cjs +1 -1
  80. package/dist/index324.js +42 -74
  81. package/dist/index325.cjs +1 -1
  82. package/dist/index325.js +15 -9
  83. package/dist/index326.cjs +1 -1
  84. package/dist/index326.js +317 -16
  85. package/dist/index327.cjs +1 -1
  86. package/dist/index327.js +57 -20
  87. package/dist/index328.cjs +1 -1
  88. package/dist/index328.js +18 -12
  89. package/dist/index329.cjs +1 -1
  90. package/dist/index329.js +29 -13
  91. package/dist/index330.cjs +1 -1
  92. package/dist/index330.js +3 -14
  93. package/dist/index331.cjs +7 -1
  94. package/dist/index331.js +237 -9
  95. package/dist/index332.cjs +1 -1
  96. package/dist/index332.js +48 -16
  97. package/dist/index333.cjs +1 -1
  98. package/dist/index333.js +209 -22
  99. package/dist/index334.cjs +1 -1
  100. package/dist/index334.js +80 -30
  101. package/dist/index335.cjs +1 -2
  102. package/dist/index335.js +29 -18
  103. package/dist/index336.cjs +1 -1
  104. package/dist/index336.js +75 -13
  105. package/dist/index361.cjs +1 -1
  106. package/dist/index361.js +3 -94
  107. package/dist/index362.cjs +1 -1
  108. package/dist/index362.js +137 -25
  109. package/dist/index363.cjs +1 -1
  110. package/dist/index363.js +129 -144
  111. package/dist/index364.cjs +1 -1
  112. package/dist/index364.js +71 -331
  113. package/dist/index365.cjs +1 -1
  114. package/dist/index365.js +27 -72
  115. package/dist/index366.cjs +1 -1
  116. package/dist/index366.js +148 -31
  117. package/dist/index367.cjs +1 -1
  118. package/dist/index367.js +354 -5
  119. package/dist/index368.cjs +1 -1
  120. package/dist/index368.js +275 -3
  121. package/dist/index369.cjs +1 -1
  122. package/dist/index369.js +170 -140
  123. package/dist/index370.cjs +1 -1
  124. package/dist/index370.js +10 -276
  125. package/dist/index371.cjs +1 -1
  126. package/dist/index371.js +107 -170
  127. package/dist/index372.cjs +1 -1
  128. package/dist/index372.js +6 -10
  129. package/dist/index373.cjs +1 -1
  130. package/dist/index373.js +70 -104
  131. package/dist/index374.cjs +1 -1
  132. package/dist/index374.js +2 -2
  133. package/dist/index375.cjs +1 -1
  134. package/dist/index375.js +29 -131
  135. package/dist/index383.cjs +1 -1
  136. package/dist/index383.js +59 -106
  137. package/dist/index384.cjs +1 -1
  138. package/dist/index384.js +110 -3
  139. package/dist/index385.cjs +1 -1
  140. package/dist/index385.js +3 -63
  141. package/dist/index6.cjs +1 -1
  142. package/dist/index6.js +42 -42
  143. package/dist/index77.cjs +1 -1
  144. package/dist/index77.js +13 -13
  145. package/dist/index9.cjs +1 -1
  146. package/dist/index9.js +16 -14
  147. package/dist/src/lib/store/swapStore.d.ts +1 -1
  148. package/package.json +5 -5
package/dist/index334.js CHANGED
@@ -1,34 +1,84 @@
1
- import { from as g, fromAbi as b, NotFoundError as l, getSelector as p } from "./index375.js";
2
- import { encode as A } from "./index350.js";
3
- import { concat as y } from "./index277.js";
4
- function w(...o) {
5
- const [t, n = []] = (() => {
6
- if (Array.isArray(o[0])) {
7
- const [m, d, f] = o;
8
- return [u(m, d, { args: f }), f];
1
+ import { TypeTagSerializer as o } from "./index373.js";
2
+ import { deriveDynamicFieldID as m } from "./index374.js";
3
+ import { parseStructTag as l, normalizeStructTag as n, SUI_ADDRESS_LENGTH as p } from "./index117.js";
4
+ import { Experimental_BaseClient as y } from "./index116.js";
5
+ import { MvrClient as b } from "./index120.js";
6
+ const d = {
7
+ mainnet: "https://mainnet.mvr.mystenlabs.com",
8
+ testnet: "https://testnet.mvr.mystenlabs.com"
9
+ };
10
+ class S extends y {
11
+ constructor(e) {
12
+ var a, r, t;
13
+ super(e), this.core = this, this.mvr = new b({
14
+ cache: this.cache.scope("core.mvr"),
15
+ url: ((a = e.mvr) == null ? void 0 : a.url) ?? d[this.network],
16
+ pageSize: (r = e.mvr) == null ? void 0 : r.pageSize,
17
+ overrides: (t = e.mvr) == null ? void 0 : t.overrides
18
+ });
19
+ }
20
+ async getObject(e) {
21
+ const { objectId: a } = e, {
22
+ objects: [r]
23
+ } = await this.getObjects({ objectIds: [a], signal: e.signal });
24
+ if (r instanceof Error)
25
+ throw r;
26
+ return { object: r };
27
+ }
28
+ async getDynamicField(e) {
29
+ const a = o.parseFromStr(
30
+ (await this.core.mvr.resolveType({
31
+ type: e.name.type
32
+ })).type
33
+ ), r = m(e.parentId, a, e.name.bcs), {
34
+ objects: [t]
35
+ } = await this.getObjects({
36
+ objectIds: [r],
37
+ signal: e.signal
38
+ });
39
+ if (t instanceof Error)
40
+ throw t;
41
+ const s = l(t.type), i = await t.content;
42
+ return {
43
+ dynamicField: {
44
+ id: t.id,
45
+ digest: t.digest,
46
+ version: t.version,
47
+ type: t.type,
48
+ previousTransaction: t.previousTransaction,
49
+ name: {
50
+ type: typeof s.typeParams[0] == "string" ? s.typeParams[0] : n(s.typeParams[0]),
51
+ bcs: e.name.bcs
52
+ },
53
+ value: {
54
+ type: typeof s.typeParams[1] == "string" ? s.typeParams[1] : n(s.typeParams[1]),
55
+ bcs: i.slice(p + e.name.bcs.length)
56
+ }
57
+ }
58
+ };
59
+ }
60
+ async waitForTransaction({
61
+ signal: e,
62
+ timeout: a = 60 * 1e3,
63
+ ...r
64
+ }) {
65
+ const t = e ? AbortSignal.any([AbortSignal.timeout(a), e]) : AbortSignal.timeout(a), s = new Promise((i, c) => {
66
+ t.addEventListener("abort", () => c(t.reason));
67
+ });
68
+ for (s.catch(() => {
69
+ }); ; ) {
70
+ t.throwIfAborted();
71
+ try {
72
+ return await this.getTransaction({
73
+ ...r,
74
+ signal: t
75
+ });
76
+ } catch {
77
+ await Promise.race([new Promise((i) => setTimeout(i, 2e3)), s]);
78
+ }
9
79
  }
10
- const [s, a] = o;
11
- return [s, a];
12
- })(), { overloads: r } = t, e = r ? u([t, ...r], t.name, {
13
- args: n
14
- }) : t, c = F(e), i = n.length > 0 ? A(e.inputs, n) : void 0;
15
- return i ? y(c, i) : c;
16
- }
17
- function v(o, t = {}) {
18
- return g(o, t);
19
- }
20
- function u(o, t, n) {
21
- const r = b(o, t, n);
22
- if (r.type !== "function")
23
- throw new l({ name: t, type: "function" });
24
- return r;
25
- }
26
- function F(o) {
27
- return p(o);
80
+ }
28
81
  }
29
82
  export {
30
- w as encodeData,
31
- v as from,
32
- u as fromAbi,
33
- F as getSelector
83
+ S as Experimental_CoreClient
34
84
  };
package/dist/index335.cjs CHANGED
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function x(e){var c,d,f;const{scheme:n,statement:t,...p}=((c=e.match(h))==null?void 0:c.groups)??{},{chainId:s,expirationTime:i,issuedAt:o,notBefore:r,requestId:a,...m}=((d=e.match(A))==null?void 0:d.groups)??{},u=(f=e.split("Resources:")[1])==null?void 0:f.split(`
2
- - `).slice(1);return{...p,...m,...s?{chainId:Number(s)}:{},...i?{expirationTime:new Date(i)}:{},...o?{issuedAt:new Date(o)}:{},...r?{notBefore:new Date(r)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...n?{scheme:n}:{},...t?{statement:t}:{}}}const h=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,A=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;exports.parseSiweMessage=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class c extends Error{}class t extends c{constructor(e,d){super(d),this.code=e}static fromResponse(e,d){switch(e.code){case"notExists":return new t(e.code,`Object ${e.object_id} does not exist`);case"dynamicFieldNotFound":return new t(e.code,`Dynamic field not found for object ${e.parent_object_id}`);case"deleted":return new t(e.code,`Object ${e.object_id} has been deleted`);case"displayError":return new t(e.code,`Display error: ${e.error}`);case"unknown":default:return new t(e.code,`Unknown error while loading object${d?` ${d}`:""}`)}}}exports.ObjectError=t;exports.SuiClientError=c;
package/dist/index335.js CHANGED
@@ -1,21 +1,32 @@
1
- function A(e) {
2
- var c, d, f;
3
- const { scheme: n, statement: t, ...p } = ((c = e.match(m)) == null ? void 0 : c.groups) ?? {}, { chainId: s, expirationTime: i, issuedAt: o, notBefore: r, requestId: a, ...x } = ((d = e.match(h)) == null ? void 0 : d.groups) ?? {}, u = (f = e.split("Resources:")[1]) == null ? void 0 : f.split(`
4
- - `).slice(1);
5
- return {
6
- ...p,
7
- ...x,
8
- ...s ? { chainId: Number(s) } : {},
9
- ...i ? { expirationTime: new Date(i) } : {},
10
- ...o ? { issuedAt: new Date(o) } : {},
11
- ...r ? { notBefore: new Date(r) } : {},
12
- ...a ? { requestId: a } : {},
13
- ...u ? { resources: u } : {},
14
- ...n ? { scheme: n } : {},
15
- ...t ? { statement: t } : {}
16
- };
1
+ class c extends Error {
2
+ }
3
+ class t extends c {
4
+ constructor(e, d) {
5
+ super(d), this.code = e;
6
+ }
7
+ static fromResponse(e, d) {
8
+ switch (e.code) {
9
+ case "notExists":
10
+ return new t(e.code, `Object ${e.object_id} does not exist`);
11
+ case "dynamicFieldNotFound":
12
+ return new t(
13
+ e.code,
14
+ `Dynamic field not found for object ${e.parent_object_id}`
15
+ );
16
+ case "deleted":
17
+ return new t(e.code, `Object ${e.object_id} has been deleted`);
18
+ case "displayError":
19
+ return new t(e.code, `Display error: ${e.error}`);
20
+ case "unknown":
21
+ default:
22
+ return new t(
23
+ e.code,
24
+ `Unknown error while loading object${d ? ` ${d}` : ""}`
25
+ );
26
+ }
27
+ }
17
28
  }
18
- const m = /^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/, h = /(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;
19
29
  export {
20
- A as parseSiweMessage
30
+ t as ObjectError,
31
+ c as SuiClientError
21
32
  };
package/dist/index336.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index79.cjs"),f=require("./index98.cjs");function u(n){const{address:s,domain:r,message:e,nonce:t,scheme:i,time:a=new Date}=n;if(r&&e.domain!==r||t&&e.nonce!==t||i&&e.scheme!==i||e.expirationTime&&a>=e.expirationTime||e.notBefore&&a<e.notBefore)return!1;try{if(!e.address||!d.isAddress(e.address,{strict:!1})||s&&!f.isAddressEqual(e.address,s))return!1}catch{return!1}return!0}exports.validateSiweMessage=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index332.cjs"),c=require("./index326.cjs");function k(n){return{...c.TransactionDataBuilder.fromBytes(n).snapshot(),bcs:n}}function S(n){const e=l.bcs.TransactionEffects.parse(n);switch(e.$kind){case"V1":return O({effects:e.V1});case"V2":return D({bytes:n,effects:e.V2});default:throw new Error(`Unknown transaction effects version: ${e.$kind}`)}}function O(n){throw new Error("V1 effects are not supported yet")}function D({bytes:n,effects:e}){const a=e.changedObjects.map(([s,t])=>{var i,r,u,o,d,p;return{id:s,inputState:t.inputState.$kind==="Exist"?"Exists":"DoesNotExist",inputVersion:((i=t.inputState.Exist)==null?void 0:i[0][0])??null,inputDigest:((r=t.inputState.Exist)==null?void 0:r[0][1])??null,inputOwner:((u=t.inputState.Exist)==null?void 0:u[1])??null,outputState:t.outputState.$kind==="NotExist"?"DoesNotExist":t.outputState.$kind,outputVersion:t.outputState.$kind==="PackageWrite"?(o=t.outputState.PackageWrite)==null?void 0:o[0]:t.outputState.ObjectWrite?e.lamportVersion:null,outputDigest:t.outputState.$kind==="PackageWrite"?(d=t.outputState.PackageWrite)==null?void 0:d[1]:((p=t.outputState.ObjectWrite)==null?void 0:p[0])??null,outputOwner:t.outputState.ObjectWrite?t.outputState.ObjectWrite[1]:null,idOperation:t.idOperation.$kind}});return{bcs:n,digest:e.transactionDigest,version:2,status:e.status.$kind==="Success"?{success:!0,error:null}:{success:!1,error:e.status.Failed.error.$kind},gasUsed:e.gasUsed,transactionDigest:e.transactionDigest,gasObject:e.gasObjectIndex===null?null:a[e.gasObjectIndex]??null,eventsDigest:e.eventsDigest,dependencies:e.dependencies,lamportVersion:e.lamportVersion,changedObjects:a,unchangedConsensusObjects:e.unchangedSharedObjects.map(([s,t])=>({kind:t.$kind==="MutateDeleted"?"MutateConsensusStreamEnded":t.$kind==="ReadDeleted"?"ReadConsensusStreamEnded":t.$kind,objectId:s,version:t.$kind==="ReadOnlyRoot"?t.ReadOnlyRoot[0]:t[t.$kind],digest:t.$kind==="ReadOnlyRoot"?t.ReadOnlyRoot[1]:null})),auxiliaryDataDigest:e.auxDataDigest}}exports.parseTransactionBcs=k;exports.parseTransactionEffectsBcs=S;
package/dist/index336.js CHANGED
@@ -1,17 +1,79 @@
1
- import { isAddress as f } from "./index79.js";
2
- import { isAddressEqual as o } from "./index98.js";
3
- function l(n) {
4
- const { address: r, domain: s, message: e, nonce: t, scheme: a, time: i = /* @__PURE__ */ new Date() } = n;
5
- if (s && e.domain !== s || t && e.nonce !== t || a && e.scheme !== a || e.expirationTime && i >= e.expirationTime || e.notBefore && i < e.notBefore)
6
- return !1;
7
- try {
8
- if (!e.address || !f(e.address, { strict: !1 }) || r && !o(e.address, r))
9
- return !1;
10
- } catch {
11
- return !1;
1
+ import { bcs as l } from "./index332.js";
2
+ import { TransactionDataBuilder as c } from "./index326.js";
3
+ function D(e) {
4
+ return {
5
+ ...c.fromBytes(e).snapshot(),
6
+ bcs: e
7
+ };
8
+ }
9
+ function E(e) {
10
+ const n = l.TransactionEffects.parse(e);
11
+ switch (n.$kind) {
12
+ case "V1":
13
+ return k({ effects: n.V1 });
14
+ case "V2":
15
+ return S({ bytes: e, effects: n.V2 });
16
+ default:
17
+ throw new Error(
18
+ `Unknown transaction effects version: ${n.$kind}`
19
+ );
12
20
  }
13
- return !0;
21
+ }
22
+ function k(e) {
23
+ throw new Error("V1 effects are not supported yet");
24
+ }
25
+ function S({
26
+ bytes: e,
27
+ effects: n
28
+ }) {
29
+ const i = n.changedObjects.map(
30
+ ([s, t]) => {
31
+ var a, r, u, o, d, p;
32
+ return {
33
+ id: s,
34
+ inputState: t.inputState.$kind === "Exist" ? "Exists" : "DoesNotExist",
35
+ inputVersion: ((a = t.inputState.Exist) == null ? void 0 : a[0][0]) ?? null,
36
+ inputDigest: ((r = t.inputState.Exist) == null ? void 0 : r[0][1]) ?? null,
37
+ inputOwner: ((u = t.inputState.Exist) == null ? void 0 : u[1]) ?? null,
38
+ outputState: t.outputState.$kind === "NotExist" ? "DoesNotExist" : t.outputState.$kind,
39
+ outputVersion: t.outputState.$kind === "PackageWrite" ? (o = t.outputState.PackageWrite) == null ? void 0 : o[0] : t.outputState.ObjectWrite ? n.lamportVersion : null,
40
+ outputDigest: t.outputState.$kind === "PackageWrite" ? (d = t.outputState.PackageWrite) == null ? void 0 : d[1] : ((p = t.outputState.ObjectWrite) == null ? void 0 : p[0]) ?? null,
41
+ outputOwner: t.outputState.ObjectWrite ? t.outputState.ObjectWrite[1] : null,
42
+ idOperation: t.idOperation.$kind
43
+ };
44
+ }
45
+ );
46
+ return {
47
+ bcs: e,
48
+ digest: n.transactionDigest,
49
+ version: 2,
50
+ status: n.status.$kind === "Success" ? {
51
+ success: !0,
52
+ error: null
53
+ } : {
54
+ success: !1,
55
+ // TODO: add command
56
+ error: n.status.Failed.error.$kind
57
+ },
58
+ gasUsed: n.gasUsed,
59
+ transactionDigest: n.transactionDigest,
60
+ gasObject: n.gasObjectIndex === null ? null : i[n.gasObjectIndex] ?? null,
61
+ eventsDigest: n.eventsDigest,
62
+ dependencies: n.dependencies,
63
+ lamportVersion: n.lamportVersion,
64
+ changedObjects: i,
65
+ unchangedConsensusObjects: n.unchangedSharedObjects.map(
66
+ ([s, t]) => ({
67
+ kind: t.$kind === "MutateDeleted" ? "MutateConsensusStreamEnded" : t.$kind === "ReadDeleted" ? "ReadConsensusStreamEnded" : t.$kind,
68
+ objectId: s,
69
+ version: t.$kind === "ReadOnlyRoot" ? t.ReadOnlyRoot[0] : t[t.$kind],
70
+ digest: t.$kind === "ReadOnlyRoot" ? t.ReadOnlyRoot[1] : null
71
+ })
72
+ ),
73
+ auxiliaryDataDigest: n.auxDataDigest
74
+ };
14
75
  }
15
76
  export {
16
- l as validateSiweMessage
77
+ D as parseTransactionBcs,
78
+ E as parseTransactionEffectsBcs
17
79
  };
package/dist/index361.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index362.cjs");class n{constructor(t){this.bytePosition=0,this.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength)}shift(t){return this.bytePosition+=t,this}read8(){const t=this.dataView.getUint8(this.bytePosition);return this.shift(1),t}read16(){const t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),t}read32(){const t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),t}read64(){const t=this.read32(),e=this.read32().toString(16)+t.toString(16).padStart(8,"0");return BigInt("0x"+e).toString(10)}read128(){const t=BigInt(this.read64()),e=BigInt(this.read64()).toString(16)+t.toString(16).padStart(16,"0");return BigInt("0x"+e).toString(10)}read256(){const t=BigInt(this.read128()),e=BigInt(this.read128()).toString(16)+t.toString(16).padStart(32,"0");return BigInt("0x"+e).toString(10)}readBytes(t){const i=this.bytePosition+this.dataView.byteOffset,e=new Uint8Array(this.dataView.buffer,i,t);return this.shift(t),e}readULEB(){const t=this.bytePosition+this.dataView.byteOffset,i=new Uint8Array(this.dataView.buffer,t),{value:e,length:s}=r.ulebDecode(i);return this.shift(s),e}readVec(t){const i=this.readULEB(),e=[];for(let s=0;s<i;s++)e.push(t(this,s,i));return e}}exports.BcsReader=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(e){return`[${e.slice(2)}]`}exports.encodeLabelhash=t;
package/dist/index361.js CHANGED
@@ -1,97 +1,6 @@
1
- import { ulebDecode as r } from "./index362.js";
2
- class o {
3
- /**
4
- * @param {Uint8Array} data Data to use as a buffer.
5
- */
6
- constructor(t) {
7
- this.bytePosition = 0, this.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength);
8
- }
9
- /**
10
- * Shift current cursor position by `bytes`.
11
- *
12
- * @param {Number} bytes Number of bytes to
13
- * @returns {this} Self for possible chaining.
14
- */
15
- shift(t) {
16
- return this.bytePosition += t, this;
17
- }
18
- /**
19
- * Read U8 value from the buffer and shift cursor by 1.
20
- * @returns
21
- */
22
- read8() {
23
- const t = this.dataView.getUint8(this.bytePosition);
24
- return this.shift(1), t;
25
- }
26
- /**
27
- * Read U16 value from the buffer and shift cursor by 2.
28
- * @returns
29
- */
30
- read16() {
31
- const t = this.dataView.getUint16(this.bytePosition, !0);
32
- return this.shift(2), t;
33
- }
34
- /**
35
- * Read U32 value from the buffer and shift cursor by 4.
36
- * @returns
37
- */
38
- read32() {
39
- const t = this.dataView.getUint32(this.bytePosition, !0);
40
- return this.shift(4), t;
41
- }
42
- /**
43
- * Read U64 value from the buffer and shift cursor by 8.
44
- * @returns
45
- */
46
- read64() {
47
- const t = this.read32(), e = this.read32().toString(16) + t.toString(16).padStart(8, "0");
48
- return BigInt("0x" + e).toString(10);
49
- }
50
- /**
51
- * Read U128 value from the buffer and shift cursor by 16.
52
- */
53
- read128() {
54
- const t = BigInt(this.read64()), e = BigInt(this.read64()).toString(16) + t.toString(16).padStart(16, "0");
55
- return BigInt("0x" + e).toString(10);
56
- }
57
- /**
58
- * Read U128 value from the buffer and shift cursor by 32.
59
- * @returns
60
- */
61
- read256() {
62
- const t = BigInt(this.read128()), e = BigInt(this.read128()).toString(16) + t.toString(16).padStart(32, "0");
63
- return BigInt("0x" + e).toString(10);
64
- }
65
- /**
66
- * Read `num` number of bytes from the buffer and shift cursor by `num`.
67
- * @param num Number of bytes to read.
68
- */
69
- readBytes(t) {
70
- const i = this.bytePosition + this.dataView.byteOffset, e = new Uint8Array(this.dataView.buffer, i, t);
71
- return this.shift(t), e;
72
- }
73
- /**
74
- * Read ULEB value - an integer of varying size. Used for enum indexes and
75
- * vector lengths.
76
- * @returns {Number} The ULEB value.
77
- */
78
- readULEB() {
79
- const t = this.bytePosition + this.dataView.byteOffset, i = new Uint8Array(this.dataView.buffer, t), { value: e, length: s } = r(i);
80
- return this.shift(s), e;
81
- }
82
- /**
83
- * Read a BCS vector: read a length and then apply function `cb` X times
84
- * where X is the length of the vector, defined as ULEB in BCS bytes.
85
- * @param cb Callback to process elements of vector.
86
- * @returns {Array<Any>} Array of the resulting values, returned by callback.
87
- */
88
- readVec(t) {
89
- const i = this.readULEB(), e = [];
90
- for (let s = 0; s < i; s++)
91
- e.push(t(this, s, i));
92
- return e;
93
- }
1
+ function n(e) {
2
+ return `[${e.slice(2)}]`;
94
3
  }
95
4
  export {
96
- o as BcsReader
5
+ n as encodeLabelhash
97
6
  };
package/dist/index362.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(n){let e=BigInt(n);const t=[];let r=0;if(e===0n)return[0];for(;e>0;)t[r]=Number(e&0x7fn),e>>=7n,e>0n&&(t[r]|=128),r+=1;return t}function u(n){let e=0n,t=0n,r=0;for(;;){if(r>=n.length)throw new Error("ULEB decode error: buffer overflow");const o=n[r];if(r+=1,e+=BigInt(o&127)<<t,!(o&128))break;t+=7n}if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("ULEB decode error: value exceeds MAX_SAFE_INTEGER");return{value:Number(e),length:r}}exports.ulebDecode=u;exports.ulebEncode=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index105.cjs"),a=require("./index202.cjs"),w=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,b=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,N=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,C=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function I(t){try{const e=await fetch(t,{method:"HEAD"});if(e.status===200){const n=e.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(e){return typeof e=="object"&&typeof e.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=t})}}function d(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function A({uri:t,gatewayUrls:e}){const n=N.test(t);if(n)return{uri:t,isOnChain:!0,isEncoded:n};const r=d(e==null?void 0:e.ipfs,"https://ipfs.io"),s=d(e==null?void 0:e.arweave,"https://arweave.net"),o=t.match(w),{protocol:c,subpath:p,target:i,subtarget:h=""}=(o==null?void 0:o.groups)||{},u=c==="ipns:/"||p==="ipns/",m=c==="ipfs:/"||p==="ipfs/"||b.test(t);if(t.startsWith("http")&&!u&&!m){let v=t;return e!=null&&e.arweave&&(v=t.replace(/https:\/\/arweave.net/g,e==null?void 0:e.arweave)),{uri:v,isOnChain:!1,isEncoded:!1}}if((u||m)&&i)return{uri:`${r}/${u?"ipns":"ipfs"}/${i}${h}`,isOnChain:!1,isEncoded:!1};if(c==="ar:/"&&i)return{uri:`${s}/${i}${h||""}`,isOnChain:!1,isEncoded:!1};let f=t.replace(C,"");if(f.startsWith("<svg")&&(f=`data:image/svg+xml;base64,${btoa(f)}`),f.startsWith("data:")||f.startsWith("{"))return{uri:f,isOnChain:!0,isEncoded:!1};throw new a.EnsAvatarUriResolutionError({uri:t})}function l(t){if(typeof t!="object"||!("image"in t)&&!("image_url"in t)&&!("image_data"in t))throw new a.EnsAvatarInvalidMetadataError({data:t});return t.image||t.image_url||t.image_data}async function k({gatewayUrls:t,uri:e}){try{const n=await fetch(e).then(s=>s.json());return await E({gatewayUrls:t,uri:l(n)})}catch{throw new a.EnsAvatarUriResolutionError({uri:e})}}async function E({gatewayUrls:t,uri:e}){const{uri:n,isOnChain:r}=A({uri:e,gatewayUrls:t});if(r||await I(n))return n;throw new a.EnsAvatarUriResolutionError({uri:e})}function R(t){let e=t;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=e.split("/"),[o,c]=n.split(":"),[p,i]=r.split(":");if(!o||o.toLowerCase()!=="eip155")throw new a.EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!c)throw new a.EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!i)throw new a.EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!s)throw new a.EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!p)throw new a.EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(c,10),namespace:p.toLowerCase(),contractAddress:i,tokenID:s}}async function O(t,{nft:e}){if(e.namespace==="erc721")return g.readContract(t,{address:e.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(e.tokenID)]});if(e.namespace==="erc1155")return g.readContract(t,{address:e.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(e.tokenID)]});throw new a.EnsAvatarUnsupportedNamespaceError({namespace:e.namespace})}exports.getGateway=d;exports.getJsonImage=l;exports.getMetadataAvatarUri=k;exports.getNftTokenUri=O;exports.isImageUri=I;exports.parseAvatarUri=E;exports.parseNftUri=R;exports.resolveAvatarUri=A;
package/dist/index362.js CHANGED
@@ -1,31 +1,143 @@
1
- function l(t) {
2
- let e = BigInt(t);
3
- const n = [];
4
- let r = 0;
5
- if (e === 0n)
6
- return [0];
7
- for (; e > 0; )
8
- n[r] = Number(e & 0x7fn), e >>= 7n, e > 0n && (n[r] |= 128), r += 1;
9
- return n;
10
- }
11
- function u(t) {
12
- let e = 0n, n = 0n, r = 0;
13
- for (; ; ) {
14
- if (r >= t.length)
15
- throw new Error("ULEB decode error: buffer overflow");
16
- const o = t[r];
17
- if (r += 1, e += BigInt(o & 127) << n, !(o & 128))
18
- break;
19
- n += 7n;
1
+ import { readContract as g } from "./index105.js";
2
+ import { EnsAvatarUriResolutionError as d, EnsAvatarInvalidNftUriError as f, EnsAvatarUnsupportedNamespaceError as v, EnsAvatarInvalidMetadataError as A } from "./index202.js";
3
+ const b = /(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/, l = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/, E = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/, C = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
4
+ async function k(t) {
5
+ try {
6
+ const e = await fetch(t, { method: "HEAD" });
7
+ if (e.status === 200) {
8
+ const n = e.headers.get("content-type");
9
+ return n == null ? void 0 : n.startsWith("image/");
10
+ }
11
+ return !1;
12
+ } catch (e) {
13
+ return typeof e == "object" && typeof e.response < "u" || !Object.hasOwn(globalThis, "Image") ? !1 : new Promise((n) => {
14
+ const r = new Image();
15
+ r.onload = () => {
16
+ n(!0);
17
+ }, r.onerror = () => {
18
+ n(!1);
19
+ }, r.src = t;
20
+ });
20
21
  }
21
- if (e > BigInt(Number.MAX_SAFE_INTEGER))
22
- throw new Error("ULEB decode error: value exceeds MAX_SAFE_INTEGER");
22
+ }
23
+ function w(t, e) {
24
+ return t ? t.endsWith("/") ? t.slice(0, -1) : t : e;
25
+ }
26
+ function N({ uri: t, gatewayUrls: e }) {
27
+ const n = E.test(t);
28
+ if (n)
29
+ return { uri: t, isOnChain: !0, isEncoded: n };
30
+ const r = w(e == null ? void 0 : e.ipfs, "https://ipfs.io"), a = w(e == null ? void 0 : e.arweave, "https://arweave.net"), i = t.match(b), { protocol: o, subpath: p, target: s, subtarget: m = "" } = (i == null ? void 0 : i.groups) || {}, u = o === "ipns:/" || p === "ipns/", h = o === "ipfs:/" || p === "ipfs/" || l.test(t);
31
+ if (t.startsWith("http") && !u && !h) {
32
+ let I = t;
33
+ return e != null && e.arweave && (I = t.replace(/https:\/\/arweave.net/g, e == null ? void 0 : e.arweave)), { uri: I, isOnChain: !1, isEncoded: !1 };
34
+ }
35
+ if ((u || h) && s)
36
+ return {
37
+ uri: `${r}/${u ? "ipns" : "ipfs"}/${s}${m}`,
38
+ isOnChain: !1,
39
+ isEncoded: !1
40
+ };
41
+ if (o === "ar:/" && s)
42
+ return {
43
+ uri: `${a}/${s}${m || ""}`,
44
+ isOnChain: !1,
45
+ isEncoded: !1
46
+ };
47
+ let c = t.replace(C, "");
48
+ if (c.startsWith("<svg") && (c = `data:image/svg+xml;base64,${btoa(c)}`), c.startsWith("data:") || c.startsWith("{"))
49
+ return {
50
+ uri: c,
51
+ isOnChain: !0,
52
+ isEncoded: !1
53
+ };
54
+ throw new d({ uri: t });
55
+ }
56
+ function O(t) {
57
+ if (typeof t != "object" || !("image" in t) && !("image_url" in t) && !("image_data" in t))
58
+ throw new A({ data: t });
59
+ return t.image || t.image_url || t.image_data;
60
+ }
61
+ async function D({ gatewayUrls: t, uri: e }) {
62
+ try {
63
+ const n = await fetch(e).then((a) => a.json());
64
+ return await R({
65
+ gatewayUrls: t,
66
+ uri: O(n)
67
+ });
68
+ } catch {
69
+ throw new d({ uri: e });
70
+ }
71
+ }
72
+ async function R({ gatewayUrls: t, uri: e }) {
73
+ const { uri: n, isOnChain: r } = N({ uri: e, gatewayUrls: t });
74
+ if (r || await k(n))
75
+ return n;
76
+ throw new d({ uri: e });
77
+ }
78
+ function z(t) {
79
+ let e = t;
80
+ e.startsWith("did:nft:") && (e = e.replace("did:nft:", "").replace(/_/g, "/"));
81
+ const [n, r, a] = e.split("/"), [i, o] = n.split(":"), [p, s] = r.split(":");
82
+ if (!i || i.toLowerCase() !== "eip155")
83
+ throw new f({ reason: "Only EIP-155 supported" });
84
+ if (!o)
85
+ throw new f({ reason: "Chain ID not found" });
86
+ if (!s)
87
+ throw new f({
88
+ reason: "Contract address not found"
89
+ });
90
+ if (!a)
91
+ throw new f({ reason: "Token ID not found" });
92
+ if (!p)
93
+ throw new f({ reason: "ERC namespace not found" });
23
94
  return {
24
- value: Number(e),
25
- length: r
95
+ chainID: Number.parseInt(o, 10),
96
+ namespace: p.toLowerCase(),
97
+ contractAddress: s,
98
+ tokenID: a
26
99
  };
27
100
  }
101
+ async function W(t, { nft: e }) {
102
+ if (e.namespace === "erc721")
103
+ return g(t, {
104
+ address: e.contractAddress,
105
+ abi: [
106
+ {
107
+ name: "tokenURI",
108
+ type: "function",
109
+ stateMutability: "view",
110
+ inputs: [{ name: "tokenId", type: "uint256" }],
111
+ outputs: [{ name: "", type: "string" }]
112
+ }
113
+ ],
114
+ functionName: "tokenURI",
115
+ args: [BigInt(e.tokenID)]
116
+ });
117
+ if (e.namespace === "erc1155")
118
+ return g(t, {
119
+ address: e.contractAddress,
120
+ abi: [
121
+ {
122
+ name: "uri",
123
+ type: "function",
124
+ stateMutability: "view",
125
+ inputs: [{ name: "_id", type: "uint256" }],
126
+ outputs: [{ name: "", type: "string" }]
127
+ }
128
+ ],
129
+ functionName: "uri",
130
+ args: [BigInt(e.tokenID)]
131
+ });
132
+ throw new v({ namespace: e.namespace });
133
+ }
28
134
  export {
29
- u as ulebDecode,
30
- l as ulebEncode
135
+ w as getGateway,
136
+ O as getJsonImage,
137
+ D as getMetadataAvatarUri,
138
+ W as getNftTokenUri,
139
+ k as isImageUri,
140
+ R as parseAvatarUri,
141
+ z as parseNftUri,
142
+ N as resolveAvatarUri
31
143
  };
package/dist/index363.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index362.cjs"),o=require("./index317.cjs");class a{constructor({initialSize:t=1024,maxSize:i=1/0,allocateSize:e=1024}={}){this.bytePosition=0,this.size=t,this.maxSize=i,this.allocateSize=e,this.dataView=new DataView(new ArrayBuffer(t))}ensureSizeOrGrow(t){const i=this.bytePosition+t;if(i>this.size){const e=Math.min(this.maxSize,Math.max(this.size+i,this.size+this.allocateSize));if(i>e)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${i}`);this.size=e;const s=new ArrayBuffer(this.size);new Uint8Array(s).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(s)}}shift(t){return this.bytePosition+=t,this}write8(t){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(t)),this.shift(1)}writeBytes(t){this.ensureSizeOrGrow(t.length);for(let i=0;i<t.length;i++)this.dataView.setUint8(this.bytePosition+i,t[i]);return this.shift(t.length)}write16(t){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(t),!0),this.shift(2)}write32(t){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(t),!0),this.shift(4)}write64(t){return n(BigInt(t),8).forEach(i=>this.write8(i)),this}write128(t){return n(BigInt(t),16).forEach(i=>this.write8(i)),this}write256(t){return n(BigInt(t),32).forEach(i=>this.write8(i)),this}writeULEB(t){return h.ulebEncode(t).forEach(i=>this.write8(i)),this}writeVec(t,i){return this.writeULEB(t.length),Array.from(t).forEach((e,s)=>i(this,e,s,t.length)),this}*[Symbol.iterator](){for(let t=0;t<this.bytePosition;t++)yield this.dataView.getUint8(t);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(t){return o.encodeStr(this.toBytes(),t)}}function n(r,t){const i=new Uint8Array(t);let e=0;for(;r>0;)i[e]=Number(r%BigInt(256)),r=r/BigInt(256),e+=1;return i}exports.BcsWriter=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index278.cjs"),E=require("./index347.cjs"),m=require("./index277.cjs"),f=require("./index383.cjs"),A=require("./index292.cjs"),l=require("./index285.cjs");function q(r,e={}){const{prepare:i=!0}=e,n=Array.isArray(r)||typeof r=="string"?A.parseAbiItem(r):r;return{...n,...i?{hash:s(n)}:{}}}function g(r,e,i){const{args:n=[],prepare:o=!0}=i??{},w=m.validate(e,{strict:!1}),a=r.filter(t=>w?t.type==="function"||t.type==="error"?I(t)===m.slice(e,0,4):t.type==="event"?s(t)===e:!1:"name"in t&&t.name===e);if(a.length===0)throw new b({name:e});if(a.length===1)return{...a[0],...o?{hash:s(a[0])}:{}};let u;for(const t of a){if(!("inputs"in t))continue;if(!n||n.length===0){if(!t.inputs||t.inputs.length===0)return{...t,...o?{hash:s(t)}:{}};continue}if(!t.inputs||t.inputs.length===0||t.inputs.length!==n.length)continue;if(n.every((c,v)=>{const y="inputs"in t&&t.inputs[v];return y?f.isArgOfType(c,y):!1})){if(u&&"inputs"in u&&u.inputs){const c=f.getAmbiguousTypes(t.inputs,u.inputs,n);if(c)throw new $({abiItem:t,type:c[0]},{abiItem:u,type:c[1]})}u=t}}const h=(()=>{if(u)return u;const[t,...p]=a;return{...t,overloads:p}})();if(!h)throw new b({name:e});return{...h,...o?{hash:s(h)}:{}}}function I(...r){const e=(()=>{if(Array.isArray(r[0])){const[i,n]=r;return g(i,n)}return r[0]})();return m.slice(s(e),0,4)}function S(...r){const e=(()=>{if(Array.isArray(r[0])){const[n,o]=r;return g(n,o)}return r[0]})(),i=typeof e=="string"?e:l.formatAbiItem(e);return f.normalizeSignature(i)}function s(...r){const e=(()=>{if(Array.isArray(r[0])){const[i,n]=r;return g(i,n)}return r[0]})();return typeof e!="string"&&"hash"in e&&e.hash?e.hash:E.keccak256(m.fromString(S(e)))}class $ extends d.BaseError{constructor(e,i){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${e.type}\` in \`${f.normalizeSignature(l.formatAbiItem(e.abiItem))}\`, and`,`\`${i.type}\` in \`${f.normalizeSignature(l.formatAbiItem(i.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class b extends d.BaseError{constructor({name:e,data:i,type:n="item"}){const o=e?` with name "${e}"`:i?` with data "${i}"`:"";super(`ABI ${n}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}exports.AmbiguityError=$;exports.NotFoundError=b;exports.from=q;exports.fromAbi=g;exports.getSelector=I;exports.getSignature=S;exports.getSignatureHash=s;