@coinbase/cdp-hooks 0.0.19 → 0.0.20

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 (59) hide show
  1. package/README.md +13 -5
  2. package/dist/esm/index14.js +1 -1
  3. package/dist/esm/index15.js +1 -1
  4. package/dist/esm/index18.js +3 -3
  5. package/dist/esm/index19.js +2 -2
  6. package/dist/esm/index20.js +3 -3
  7. package/dist/esm/index205.js +36 -7
  8. package/dist/esm/index206.js +15 -6
  9. package/dist/esm/index207.js +8 -36
  10. package/dist/esm/index208.js +12 -15
  11. package/dist/esm/index209.js +9 -8
  12. package/dist/esm/index21.js +2 -2
  13. package/dist/esm/index210.js +16 -12
  14. package/dist/esm/index211.js +7 -9
  15. package/dist/esm/index212.js +21 -15
  16. package/dist/esm/index213.js +30 -22
  17. package/dist/esm/index214.js +2 -31
  18. package/dist/esm/index215.js +14 -2
  19. package/dist/esm/index216.js +12 -13
  20. package/dist/esm/index217.js +45 -10
  21. package/dist/esm/index218.js +5 -46
  22. package/dist/esm/index22.js +3 -3
  23. package/dist/esm/index225.js +1 -1
  24. package/dist/esm/index226.js +1 -1
  25. package/dist/esm/index227.js +1 -1
  26. package/dist/esm/index23.js +5 -5
  27. package/dist/esm/index24.js +2 -2
  28. package/dist/esm/index244.js +125 -144
  29. package/dist/esm/index245.js +155 -9
  30. package/dist/esm/index246.js +7 -134
  31. package/dist/esm/index248.js +1 -1
  32. package/dist/esm/index249.js +1 -1
  33. package/dist/esm/index25.js +1 -1
  34. package/dist/esm/index258.js +1 -1
  35. package/dist/esm/index259.js +1 -1
  36. package/dist/esm/index26.js +1 -1
  37. package/dist/esm/index263.js +1 -1
  38. package/dist/esm/index264.js +1 -1
  39. package/dist/esm/index27.js +1 -1
  40. package/dist/esm/index28.js +1 -1
  41. package/dist/esm/index29.js +1 -1
  42. package/dist/esm/index30.js +1 -1
  43. package/dist/esm/index31.js +2 -2
  44. package/dist/esm/index32.js +1 -1
  45. package/dist/esm/index40.js +1 -1
  46. package/dist/esm/index41.js +1 -1
  47. package/dist/esm/index50.js +1 -1
  48. package/dist/esm/index53.js +1 -1
  49. package/dist/esm/index54.js +1 -1
  50. package/dist/esm/index55.js +2 -2
  51. package/dist/esm/index57.js +1 -1
  52. package/dist/esm/index61.js +3 -3
  53. package/dist/esm/index62.js +3 -3
  54. package/dist/esm/index63.js +3 -3
  55. package/dist/esm/index64.js +3 -3
  56. package/dist/esm/index65.js +3 -3
  57. package/dist/esm/index66.js +3 -3
  58. package/dist/esm/index68.js +1 -1
  59. package/package.json +3 -3
package/README.md CHANGED
@@ -129,7 +129,15 @@ function UserInformation() {
129
129
 
130
130
  ### Send a Transaction
131
131
 
132
- We support signing and sending a Blockchain transaction in a single action on Base or Base Sepolia:
132
+ We support signing and sending a Blockchain transaction in a single action on the following networks:
133
+ - Base
134
+ - Base Sepolia
135
+ - Ethereum
136
+ - Ethereum Sepolia
137
+ - Avalanche
138
+ - Arbitrum
139
+ - Optimism
140
+ - Polygon
133
141
 
134
142
  ```tsx
135
143
  import { useSendEvmTransaction, useEvmAddress } from "@coinbase/cdp-hooks";
@@ -166,13 +174,13 @@ function SendTransaction() {
166
174
  }
167
175
  ```
168
176
 
169
- For networks other than Base or Base Sepolia, your end user must sign the transaction, and then
177
+ For networks other than those supported by the CDP APIs, your end user must sign the transaction, and then
170
178
  you must broadcast the transaction yourself. This example uses the public client from `viem` to broadcast the transaction.
171
179
 
172
180
  ```tsx
173
181
  import { useSignEvmTransaction, useEvmAddress } from "@coinbase/cdp-hooks";
174
182
  import { http, createPublicClient } from "viem";
175
- import { sepolia } from "viem/chains";
183
+ import { tron } from "viem/chains";
176
184
 
177
185
  function CrossChainTransaction() {
178
186
  const { signEvmTransaction: signTransaction } = useSignEvmTransaction();
@@ -192,14 +200,14 @@ function CrossChainTransaction() {
192
200
  gas: 21000n,
193
201
  maxFeePerGas: 30000000000n,
194
202
  maxPriorityFeePerGas: 1000000000n,
195
- chainId: 11155111, // Sepolia
203
+ chainId: 728126428, // Tron
196
204
  type: "eip1559",
197
205
  }
198
206
  });
199
207
 
200
208
  // Broadcast using a different client
201
209
  const client = createPublicClient({
202
- chain: sepolia,
210
+ chain: tron,
203
211
  transport: http()
204
212
  });
205
213
 
@@ -1,4 +1,4 @@
1
- import { withResolvers as d } from "./index209.js";
1
+ import { withResolvers as d } from "./index207.js";
2
2
  const h = /* @__PURE__ */ new Map();
3
3
  function S({ fn: p, id: o, shouldSplitBatch: a, wait: g = 0, sort: l }) {
4
4
  const u = async () => {
@@ -1,7 +1,7 @@
1
1
  import { TimeoutError as m, HttpRequestError as i } from "./index12.js";
2
2
  import { withTimeout as j } from "./index176.js";
3
3
  import { stringify as c } from "./index102.js";
4
- import { idCache as y } from "./index210.js";
4
+ import { idCache as y } from "./index208.js";
5
5
  function E(s, o = {}) {
6
6
  return {
7
7
  async request(p) {
@@ -4,11 +4,11 @@ import { encodeFunctionData as R } from "./index136.js";
4
4
  import { getChainContractAddress as b } from "./index172.js";
5
5
  import { trim as w } from "./index121.js";
6
6
  import { toHex as C } from "./index108.js";
7
- import { isNullUniversalResolverError as y } from "./index211.js";
7
+ import { isNullUniversalResolverError as y } from "./index209.js";
8
8
  import { localBatchGatewayUrl as x } from "./index162.js";
9
9
  import { namehash as i } from "./index111.js";
10
- import { packetToBytes as N } from "./index212.js";
11
- import { getAction as B } from "./index205.js";
10
+ import { packetToBytes as N } from "./index210.js";
11
+ import { getAction as B } from "./index211.js";
12
12
  import { readContract as T } from "./index54.js";
13
13
  async function J(a, o) {
14
14
  const { blockNumber: l, blockTag: m, coinType: t, name: e, gatewayUrls: f, strict: v } = o, { chain: n } = a, p = (() => {
@@ -1,5 +1,5 @@
1
- import { parseAvatarRecord as m } from "./index213.js";
2
- import { getAction as u } from "./index205.js";
1
+ import { parseAvatarRecord as m } from "./index212.js";
2
+ import { getAction as u } from "./index211.js";
3
3
  import { getEnsText as f } from "./index22.js";
4
4
  async function y(t, { blockNumber: a, blockTag: e, assetGatewayUrls: n, name: o, gatewayUrls: c, strict: i, universalResolverAddress: s }) {
5
5
  const r = await u(t, f, "getEnsText")({
@@ -1,9 +1,9 @@
1
1
  import { universalResolverReverseAbi as f } from "./index71.js";
2
2
  import { getChainContractAddress as u } from "./index172.js";
3
3
  import { toHex as h } from "./index108.js";
4
- import { isNullUniversalResolverError as p } from "./index211.js";
5
- import { packetToBytes as C } from "./index212.js";
6
- import { getAction as w } from "./index205.js";
4
+ import { isNullUniversalResolverError as p } from "./index209.js";
5
+ import { packetToBytes as C } from "./index210.js";
6
+ import { getAction as w } from "./index211.js";
7
7
  import { readContract as A } from "./index54.js";
8
8
  async function b(e, { address: t, blockNumber: s, blockTag: i, gatewayUrls: a, strict: c, universalResolverAddress: d }) {
9
9
  let o = d;
@@ -1,10 +1,39 @@
1
- function f(t, n, c) {
2
- const i = t[n.name];
3
- if (typeof i == "function")
4
- return i;
5
- const o = t[c];
6
- return typeof o == "function" ? o : (e) => n(t, e);
1
+ const f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
2
+ let w = 0;
3
+ function C(s, l, h) {
4
+ const i = ++w, c = () => f.get(s) || [], g = () => {
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 = p.get(s);
12
+ if (n.length === 1 && e) {
13
+ const t = e();
14
+ t instanceof Promise && t.catch(() => {
15
+ });
16
+ }
17
+ g();
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
+ const t = c();
28
+ if (t.length !== 0)
29
+ for (const m of t)
30
+ m.fns[n]?.(...e);
31
+ };
32
+ const a = h(u);
33
+ return typeof a == "function" && p.set(s, a), r;
7
34
  }
8
35
  export {
9
- f as getAction
36
+ p as cleanupCache,
37
+ f as listenersCache,
38
+ C as observe
10
39
  };
@@ -1,9 +1,18 @@
1
- function u(e, { method: r }) {
2
- const t = {};
3
- return e.transport.type === "fallback" && e.transport.onResponse?.(({ method: s, response: o, status: p, transport: n }) => {
4
- p === "success" && r === s && (t[o] = n.request);
5
- }), (s) => t[s] || e.request;
1
+ import { wait as l } from "./index175.js";
2
+ function p(a, { emitOnBegin: e, initialWaitTime: w, interval: i }) {
3
+ let n = !0;
4
+ const t = () => n = !1;
5
+ return (async () => {
6
+ let o;
7
+ e && (o = await a({ unpoll: t }));
8
+ const u = await w?.(o) ?? i;
9
+ await l(u);
10
+ const c = async () => {
11
+ n && (await a({ unpoll: t }), await l(i), c());
12
+ };
13
+ c();
14
+ })(), t;
6
15
  }
7
16
  export {
8
- u as createFilterRequestScope
17
+ p as poll
9
18
  };
@@ -1,39 +1,11 @@
1
- const f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
2
- let w = 0;
3
- function C(s, l, h) {
4
- const i = ++w, c = () => f.get(s) || [], g = () => {
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 = p.get(s);
12
- if (n.length === 1 && e) {
13
- const t = e();
14
- t instanceof Promise && t.catch(() => {
15
- });
16
- }
17
- g();
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
- const t = c();
28
- if (t.length !== 0)
29
- for (const m of t)
30
- m.fns[n]?.(...e);
31
- };
32
- const a = h(u);
33
- return typeof a == "function" && p.set(s, a), r;
1
+ function i() {
2
+ let e = () => {
3
+ }, n = () => {
4
+ };
5
+ return { promise: new Promise((r, o) => {
6
+ e = r, n = o;
7
+ }), resolve: e, reject: n };
34
8
  }
35
9
  export {
36
- p as cleanupCache,
37
- f as listenersCache,
38
- C as observe
10
+ i as withResolvers
39
11
  };
@@ -1,18 +1,15 @@
1
- import { wait as l } from "./index175.js";
2
- function p(a, { emitOnBegin: e, initialWaitTime: w, interval: i }) {
3
- let n = !0;
4
- const t = () => n = !1;
5
- return (async () => {
6
- let o;
7
- e && (o = await a({ unpoll: t }));
8
- const u = await w?.(o) ?? i;
9
- await l(u);
10
- const c = async () => {
11
- n && (await a({ unpoll: t }), await l(i), c());
12
- };
13
- c();
14
- })(), t;
1
+ function r() {
2
+ return {
3
+ current: 0,
4
+ take() {
5
+ return this.current++;
6
+ },
7
+ reset() {
8
+ this.current = 0;
9
+ }
10
+ };
15
11
  }
12
+ const t = /* @__PURE__ */ r();
16
13
  export {
17
- p as poll
14
+ t as idCache
18
15
  };
@@ -1,11 +1,12 @@
1
- function i() {
2
- let e = () => {
3
- }, n = () => {
4
- };
5
- return { promise: new Promise((r, o) => {
6
- e = r, n = o;
7
- }), resolve: e, reject: n };
1
+ import { panicReasons as a } from "./index85.js";
2
+ import { BaseError as s } from "./index81.js";
3
+ import { ContractFunctionRevertedError as t } from "./index84.js";
4
+ function d(e, o) {
5
+ if (!(e instanceof s))
6
+ return !1;
7
+ const r = e.walk((n) => n instanceof t);
8
+ return r instanceof t ? !!(r.data?.errorName === "ResolverNotFound" || r.data?.errorName === "ResolverWildcardNotSupported" || r.data?.errorName === "ResolverNotContract" || r.data?.errorName === "ResolverError" || r.data?.errorName === "HttpError" || r.reason?.includes("Wildcard on non-extended resolvers is not supported") || o === "reverse" && r.reason === a[50]) : !1;
8
9
  }
9
10
  export {
10
- i as withResolvers
11
+ d as isNullUniversalResolverError
11
12
  };
@@ -1,7 +1,7 @@
1
1
  import { getChainContractAddress as l } from "./index172.js";
2
2
  import { toHex as u } from "./index108.js";
3
- import { packetToBytes as v } from "./index212.js";
4
- import { getAction as f } from "./index205.js";
3
+ import { packetToBytes as v } from "./index210.js";
4
+ import { getAction as f } from "./index211.js";
5
5
  import { readContract as m } from "./index54.js";
6
6
  async function A(o, r) {
7
7
  const { blockNumber: n, blockTag: i, name: s } = r, { chain: e } = o, a = (() => {
@@ -1,15 +1,19 @@
1
- function r() {
2
- return {
3
- current: 0,
4
- take() {
5
- return this.current++;
6
- },
7
- reset() {
8
- this.current = 0;
9
- }
10
- };
1
+ import { stringToBytes as i } from "./index107.js";
2
+ import { encodeLabelhash as h } from "./index243.js";
3
+ import { labelhash as f } from "./index106.js";
4
+ function y(s) {
5
+ const o = s.replace(/^\.|\.$/gm, "");
6
+ if (o.length === 0)
7
+ return new Uint8Array(1);
8
+ const e = new Uint8Array(i(o).byteLength + 2);
9
+ let t = 0;
10
+ const l = o.split(".");
11
+ for (let r = 0; r < l.length; r++) {
12
+ let n = i(l[r]);
13
+ n.byteLength > 255 && (n = i(h(f(l[r])))), e[t] = n.length, e.set(n, t + 1), t += n.length + 1;
14
+ }
15
+ return e.byteLength !== t + 1 ? e.slice(0, t + 1) : e;
11
16
  }
12
- const t = /* @__PURE__ */ r();
13
17
  export {
14
- t as idCache
18
+ y as packetToBytes
15
19
  };
@@ -1,12 +1,10 @@
1
- import { panicReasons as a } from "./index85.js";
2
- import { BaseError as s } from "./index81.js";
3
- import { ContractFunctionRevertedError as t } from "./index84.js";
4
- function d(e, o) {
5
- if (!(e instanceof s))
6
- return !1;
7
- const r = e.walk((n) => n instanceof t);
8
- return r instanceof t ? !!(r.data?.errorName === "ResolverNotFound" || r.data?.errorName === "ResolverWildcardNotSupported" || r.data?.errorName === "ResolverNotContract" || r.data?.errorName === "ResolverError" || r.data?.errorName === "HttpError" || r.reason?.includes("Wildcard on non-extended resolvers is not supported") || o === "reverse" && r.reason === a[50]) : !1;
1
+ function f(t, n, c) {
2
+ const i = t[n.name];
3
+ if (typeof i == "function")
4
+ return i;
5
+ const o = t[c];
6
+ return typeof o == "function" ? o : (e) => n(t, e);
9
7
  }
10
8
  export {
11
- d as isNullUniversalResolverError
9
+ f as getAction
12
10
  };
@@ -1,19 +1,25 @@
1
- import { stringToBytes as i } from "./index107.js";
2
- import { encodeLabelhash as h } from "./index243.js";
3
- import { labelhash as f } from "./index106.js";
4
- function y(s) {
5
- const o = s.replace(/^\.|\.$/gm, "");
6
- if (o.length === 0)
7
- return new Uint8Array(1);
8
- const e = new Uint8Array(i(o).byteLength + 2);
9
- let t = 0;
10
- const l = o.split(".");
11
- for (let r = 0; r < l.length; r++) {
12
- let n = i(l[r]);
13
- n.byteLength > 255 && (n = i(h(f(l[r])))), e[t] = n.length, e.set(n, t + 1), t += n.length + 1;
1
+ import { parseAvatarUri as o, parseNftUri as f, getNftTokenUri as v, resolveAvatarUri as l, getJsonImage as A, getMetadataAvatarUri as N } from "./index244.js";
2
+ async function b(r, { gatewayUrls: t, record: e }) {
3
+ return /eip155:/i.test(e) ? U(r, { gatewayUrls: t, record: e }) : o({ uri: e, gatewayUrls: t });
4
+ }
5
+ async function U(r, { gatewayUrls: t, record: e }) {
6
+ const i = f(e), s = await v(r, { nft: i }), { uri: a, isOnChain: c, isEncoded: p } = l({ uri: s, gatewayUrls: t });
7
+ if (c && (a.includes("data:application/json;base64,") || a.startsWith("{"))) {
8
+ const d = p ? (
9
+ // if it is encoded, decode it
10
+ atob(a.replace("data:application/json;base64,", ""))
11
+ ) : (
12
+ // if it isn't encoded assume it is a JSON string, but it could be anything (it will error if it is)
13
+ a
14
+ ), u = JSON.parse(d);
15
+ return o({ uri: A(u), gatewayUrls: t });
14
16
  }
15
- return e.byteLength !== t + 1 ? e.slice(0, t + 1) : e;
17
+ let n = i.tokenID;
18
+ return i.namespace === "erc1155" && (n = n.replace("0x", "").padStart(64, "0")), N({
19
+ gatewayUrls: t,
20
+ uri: a.replace(/(?:0x)?{id}/, n)
21
+ });
16
22
  }
17
23
  export {
18
- y as packetToBytes
24
+ b as parseAvatarRecord
19
25
  };
@@ -1,25 +1,33 @@
1
- import { parseAvatarUri as o, parseNftUri as f, getNftTokenUri as v, resolveAvatarUri as l, getJsonImage as A, getMetadataAvatarUri as N } from "./index246.js";
2
- async function b(r, { gatewayUrls: t, record: e }) {
3
- return /eip155:/i.test(e) ? U(r, { gatewayUrls: t, record: e }) : o({ uri: e, gatewayUrls: t });
4
- }
5
- async function U(r, { gatewayUrls: t, record: e }) {
6
- const i = f(e), s = await v(r, { nft: i }), { uri: a, isOnChain: c, isEncoded: p } = l({ uri: s, gatewayUrls: t });
7
- if (c && (a.includes("data:application/json;base64,") || a.startsWith("{"))) {
8
- const d = p ? (
9
- // if it is encoded, decode it
10
- atob(a.replace("data:application/json;base64,", ""))
11
- ) : (
12
- // if it isn't encoded assume it is a JSON string, but it could be anything (it will error if it is)
13
- a
14
- ), u = JSON.parse(d);
15
- return o({ uri: A(u), gatewayUrls: t });
16
- }
17
- let n = i.tokenID;
18
- return i.namespace === "erc1155" && (n = n.replace("0x", "").padStart(64, "0")), N({
19
- gatewayUrls: t,
20
- uri: a.replace(/(?:0x)?{id}/, n)
21
- });
1
+ import { fromNumber as a } from "./index245.js";
2
+ import { toRpc as e } from "./index246.js";
3
+ function n(t) {
4
+ return {
5
+ ...typeof t.baseFeePerGas == "bigint" && {
6
+ baseFeePerGas: a(t.baseFeePerGas)
7
+ },
8
+ ...typeof t.blobBaseFee == "bigint" && {
9
+ blobBaseFee: a(t.blobBaseFee)
10
+ },
11
+ ...typeof t.feeRecipient == "string" && {
12
+ feeRecipient: t.feeRecipient
13
+ },
14
+ ...typeof t.gasLimit == "bigint" && {
15
+ gasLimit: a(t.gasLimit)
16
+ },
17
+ ...typeof t.number == "bigint" && {
18
+ number: a(t.number)
19
+ },
20
+ ...typeof t.prevRandao == "bigint" && {
21
+ prevRandao: a(t.prevRandao)
22
+ },
23
+ ...typeof t.time == "bigint" && {
24
+ time: a(t.time)
25
+ },
26
+ ...t.withdrawals && {
27
+ withdrawals: t.withdrawals.map(e)
28
+ }
29
+ };
22
30
  }
23
31
  export {
24
- b as parseAvatarRecord
32
+ n as toRpc
25
33
  };
@@ -1,33 +1,4 @@
1
- import { fromNumber as a } from "./index244.js";
2
- import { toRpc as e } from "./index245.js";
3
- function n(t) {
4
- return {
5
- ...typeof t.baseFeePerGas == "bigint" && {
6
- baseFeePerGas: a(t.baseFeePerGas)
7
- },
8
- ...typeof t.blobBaseFee == "bigint" && {
9
- blobBaseFee: a(t.blobBaseFee)
10
- },
11
- ...typeof t.feeRecipient == "string" && {
12
- feeRecipient: t.feeRecipient
13
- },
14
- ...typeof t.gasLimit == "bigint" && {
15
- gasLimit: a(t.gasLimit)
16
- },
17
- ...typeof t.number == "bigint" && {
18
- number: a(t.number)
19
- },
20
- ...typeof t.prevRandao == "bigint" && {
21
- prevRandao: a(t.prevRandao)
22
- },
23
- ...typeof t.time == "bigint" && {
24
- time: a(t.time)
25
- },
26
- ...t.withdrawals && {
27
- withdrawals: t.withdrawals.map(e)
28
- }
29
- };
30
- }
1
+ const a = "0x82ad56cb";
31
2
  export {
32
- n as toRpc
3
+ a as aggregate3Signature
33
4
  };
@@ -1,4 +1,16 @@
1
- const a = "0x82ad56cb";
1
+ import { CallExecutionError as c } from "./index84.js";
2
+ import { UnknownNodeError as i } from "./index100.js";
3
+ import { getNodeError as u } from "./index224.js";
4
+ function a(r, { docsPath: t, ...o }) {
5
+ const e = (() => {
6
+ const n = u(r, o);
7
+ return n instanceof i ? r : n;
8
+ })();
9
+ return new c(e, {
10
+ docsPath: t,
11
+ ...o
12
+ });
13
+ }
2
14
  export {
3
- a as aggregate3Signature
15
+ a as getCallError
4
16
  };
@@ -1,16 +1,15 @@
1
- import { CallExecutionError as c } from "./index84.js";
2
- import { UnknownNodeError as i } from "./index100.js";
3
- import { getNodeError as u } from "./index224.js";
4
- function a(r, { docsPath: t, ...o }) {
5
- const e = (() => {
6
- const n = u(r, o);
7
- return n instanceof i ? r : n;
8
- })();
9
- return new c(e, {
10
- docsPath: t,
11
- ...o
12
- });
1
+ function y(t, { format: r }) {
2
+ if (!r)
3
+ return {};
4
+ const e = {};
5
+ function i(c) {
6
+ const s = Object.keys(c);
7
+ for (const n of s)
8
+ n in t && (e[n] = t[n]), c[n] && typeof c[n] == "object" && !Array.isArray(c[n]) && i(c[n]);
9
+ }
10
+ const o = r(t || {});
11
+ return i(o), e;
13
12
  }
14
13
  export {
15
- a as getCallError
14
+ y as extract
16
15
  };
@@ -1,15 +1,50 @@
1
- function y(t, { format: r }) {
1
+ import { InvalidAddressError as a } from "./index103.js";
2
+ import { InvalidBytesLengthError as d } from "./index104.js";
3
+ import { AccountStateConflictError as u, StateAssignmentConflictError as h } from "./index91.js";
4
+ import { isAddress as l } from "./index130.js";
5
+ import { numberToHex as c } from "./index108.js";
6
+ function s(r) {
7
+ if (!(!r || r.length === 0))
8
+ return r.reduce((t, { slot: e, value: n }) => {
9
+ if (e.length !== 66)
10
+ throw new d({
11
+ size: e.length,
12
+ targetSize: 66,
13
+ type: "hex"
14
+ });
15
+ if (n.length !== 66)
16
+ throw new d({
17
+ size: n.length,
18
+ targetSize: 66,
19
+ type: "hex"
20
+ });
21
+ return t[e] = n, t;
22
+ }, {});
23
+ }
24
+ function m(r) {
25
+ const { balance: t, nonce: e, state: n, stateDiff: o, code: f } = r, i = {};
26
+ if (f !== void 0 && (i.code = f), t !== void 0 && (i.balance = c(t)), e !== void 0 && (i.nonce = c(e)), n !== void 0 && (i.state = s(n)), o !== void 0) {
27
+ if (i.state)
28
+ throw new h();
29
+ i.stateDiff = s(o);
30
+ }
31
+ return i;
32
+ }
33
+ function A(r) {
2
34
  if (!r)
3
- return {};
4
- const e = {};
5
- function i(c) {
6
- const s = Object.keys(c);
7
- for (const n of s)
8
- n in t && (e[n] = t[n]), c[n] && typeof c[n] == "object" && !Array.isArray(c[n]) && i(c[n]);
35
+ return;
36
+ const t = {};
37
+ for (const { address: e, ...n } of r) {
38
+ if (!l(e, { strict: !1 }))
39
+ throw new a({ address: e });
40
+ if (t[e])
41
+ throw new u({ address: e });
42
+ t[e] = m(n);
9
43
  }
10
- const o = r(t || {});
11
- return i(o), e;
44
+ return t;
12
45
  }
13
46
  export {
14
- y as extract
47
+ m as serializeAccountStateOverride,
48
+ s as serializeStateMapping,
49
+ A as serializeStateOverride
15
50
  };
@@ -1,50 +1,9 @@
1
- import { InvalidAddressError as a } from "./index103.js";
2
- import { InvalidBytesLengthError as d } from "./index104.js";
3
- import { AccountStateConflictError as u, StateAssignmentConflictError as h } from "./index91.js";
4
- import { isAddress as l } from "./index130.js";
5
- import { numberToHex as c } from "./index108.js";
6
- function s(r) {
7
- if (!(!r || r.length === 0))
8
- return r.reduce((t, { slot: e, value: n }) => {
9
- if (e.length !== 66)
10
- throw new d({
11
- size: e.length,
12
- targetSize: 66,
13
- type: "hex"
14
- });
15
- if (n.length !== 66)
16
- throw new d({
17
- size: n.length,
18
- targetSize: 66,
19
- type: "hex"
20
- });
21
- return t[e] = n, t;
22
- }, {});
23
- }
24
- function m(r) {
25
- const { balance: t, nonce: e, state: n, stateDiff: o, code: f } = r, i = {};
26
- if (f !== void 0 && (i.code = f), t !== void 0 && (i.balance = c(t)), e !== void 0 && (i.nonce = c(e)), n !== void 0 && (i.state = s(n)), o !== void 0) {
27
- if (i.state)
28
- throw new h();
29
- i.stateDiff = s(o);
30
- }
31
- return i;
32
- }
33
- function A(r) {
34
- if (!r)
35
- return;
1
+ function u(e, { method: r }) {
36
2
  const t = {};
37
- for (const { address: e, ...n } of r) {
38
- if (!l(e, { strict: !1 }))
39
- throw new a({ address: e });
40
- if (t[e])
41
- throw new u({ address: e });
42
- t[e] = m(n);
43
- }
44
- return t;
3
+ return e.transport.type === "fallback" && e.transport.onResponse?.(({ method: s, response: o, status: p, transport: n }) => {
4
+ p === "success" && r === s && (t[o] = n.request);
5
+ }), (s) => t[s] || e.request;
45
6
  }
46
7
  export {
47
- m as serializeAccountStateOverride,
48
- s as serializeStateMapping,
49
- A as serializeStateOverride
8
+ u as createFilterRequestScope
50
9
  };