viem 0.0.1-alpha.23 → 0.0.1-alpha.25

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 (155) hide show
  1. package/contract/package.json +4 -0
  2. package/dist/call-ac509982.d.ts +23 -0
  3. package/dist/{chain-aa4898d0.d.ts → chain-c4ccb458.d.ts} +1 -1
  4. package/dist/{chain-4b39613a.d.ts → chain-f16512e8.d.ts} +20 -1
  5. package/dist/chains.d.ts +20 -8
  6. package/dist/chains.js +46 -46
  7. package/dist/chains.mjs +1 -1
  8. package/dist/{chunk-RJLUZTJS.mjs → chunk-2Y3UZMSP.mjs} +203 -84
  9. package/dist/chunk-2Y3UZMSP.mjs.map +1 -0
  10. package/dist/{chunk-ZKYGWITF.js → chunk-CD2XJOBJ.js} +261 -142
  11. package/dist/chunk-CD2XJOBJ.js.map +1 -0
  12. package/dist/{chunk-XBUH66KN.mjs → chunk-KSAO4Y4Q.mjs} +133 -54
  13. package/dist/chunk-KSAO4Y4Q.mjs.map +1 -0
  14. package/dist/{chunk-TXHOG6KU.mjs → chunk-LEPQJNVO.mjs} +18 -2
  15. package/dist/chunk-LEPQJNVO.mjs.map +1 -0
  16. package/dist/{chunk-7Y5QVLX7.js → chunk-NUXMGPMK.js} +30 -14
  17. package/dist/chunk-NUXMGPMK.js.map +1 -0
  18. package/dist/{chunk-SSPRUPGN.js → chunk-THMRUG4D.js} +148 -69
  19. package/dist/chunk-THMRUG4D.js.map +1 -0
  20. package/dist/{contract-4c3a37b3.d.ts → contract-9e76e561.d.ts} +44 -31
  21. package/dist/contract.d.ts +123 -0
  22. package/dist/contract.js +53 -0
  23. package/dist/{clients/index.js.map → contract.js.map} +0 -0
  24. package/dist/contract.mjs +53 -0
  25. package/dist/{clients/index.mjs.map → contract.mjs.map} +0 -0
  26. package/dist/{createClient-55a04188.d.ts → createClient-68ee4bb4.d.ts} +3 -3
  27. package/dist/{createPublicClient-3b27b282.d.ts → createPublicClient-b732194e.d.ts} +3 -3
  28. package/dist/{createTestClient-93f9eac6.d.ts → createTestClient-dedf321e.d.ts} +3 -3
  29. package/dist/{createWalletClient-c10df94d.d.ts → createWalletClient-75813d83.d.ts} +3 -3
  30. package/dist/decodeErrorResult-0b934d23.d.ts +16 -0
  31. package/dist/{eip1193-4c24765a.d.ts → eip1193-6f9ba163.d.ts} +1 -1
  32. package/dist/ens.d.ts +82 -1
  33. package/dist/ens.js +208 -3
  34. package/dist/ens.js.map +1 -1
  35. package/dist/ens.mjs +209 -4
  36. package/dist/ens.mjs.map +1 -1
  37. package/dist/getAbiItem-c8e6e7d4.d.ts +97 -0
  38. package/dist/index.d.ts +85 -133
  39. package/dist/index.js +237 -275
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +245 -283
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/public.d.ts +352 -10
  44. package/dist/public.js +3 -4
  45. package/dist/public.mjs +6 -7
  46. package/dist/readContract-4f6e2692.d.ts +10 -0
  47. package/dist/rpc-a5a7f376.d.ts +121 -0
  48. package/dist/{sendTransaction-f17a2389.d.ts → sendTransaction-e713f90c.d.ts} +3 -3
  49. package/dist/test.d.ts +160 -5
  50. package/dist/test.js +222 -18
  51. package/dist/test.js.map +1 -1
  52. package/dist/test.mjs +233 -29
  53. package/dist/test.mjs.map +1 -1
  54. package/dist/transactionReceipt-2a86c7c7.d.ts +26 -0
  55. package/dist/{transactionRequest-93e9f001.d.ts → transactionRequest-c7794f5e.d.ts} +1 -1
  56. package/dist/utils/index.d.ts +224 -20
  57. package/dist/utils/index.js +2 -6
  58. package/dist/utils/index.mjs +3 -7
  59. package/dist/wallet.d.ts +41 -7
  60. package/dist/wallet.js +3 -3
  61. package/dist/wallet.mjs +2 -2
  62. package/dist/watchEvent-c346c12d.d.ts +41 -0
  63. package/dist/window.d.ts +2 -2
  64. package/ens/package.json +4 -0
  65. package/package.json +13 -9
  66. package/src/_test/constants.ts +2 -0
  67. package/src/_test/utils.ts +10 -5
  68. package/src/actions/ens/getEnsAddress.bench.ts +26 -0
  69. package/src/actions/ens/getEnsAddress.test.ts +97 -0
  70. package/src/actions/ens/getEnsAddress.ts +122 -0
  71. package/src/actions/ens/getEnsName.bench.ts +30 -0
  72. package/src/actions/ens/getEnsName.test.ts +101 -0
  73. package/src/actions/ens/getEnsName.ts +106 -0
  74. package/src/actions/ens/index.test.ts +12 -0
  75. package/src/actions/ens/index.ts +3 -0
  76. package/src/actions/index.test.ts +2 -0
  77. package/src/actions/index.ts +9 -3
  78. package/src/actions/public/createEventFilter.test.ts +36 -4
  79. package/src/actions/public/createEventFilter.ts +27 -10
  80. package/src/actions/public/getFilterChanges.test.ts +198 -4
  81. package/src/actions/public/getFilterLogs.test.ts +195 -2
  82. package/src/actions/public/getLogs.test.ts +201 -2
  83. package/src/actions/public/index.test.ts +0 -1
  84. package/src/actions/public/index.ts +1 -7
  85. package/src/actions/public/multicall.ts +8 -3
  86. package/src/actions/public/simulateContract.ts +1 -4
  87. package/src/actions/public/watchContractEvent.test.ts +4 -4
  88. package/src/actions/{public → wallet}/deployContract.test.ts +1 -2
  89. package/src/actions/{public → wallet}/deployContract.ts +0 -0
  90. package/src/actions/wallet/index.test.ts +1 -0
  91. package/src/actions/wallet/index.ts +6 -0
  92. package/src/chains.test.ts +44 -1517
  93. package/src/clients/transports/webSocket.test.ts +1 -0
  94. package/src/clients/transports/webSocket.ts +1 -0
  95. package/src/contract.test.ts +31 -0
  96. package/src/contract.ts +68 -0
  97. package/src/ens.test.ts +15 -0
  98. package/src/ens.ts +4 -1
  99. package/src/errors/abi.ts +18 -2
  100. package/src/errors/chain.test.ts +46 -0
  101. package/src/errors/chain.ts +33 -0
  102. package/src/errors/contract.ts +2 -2
  103. package/src/errors/index.ts +3 -0
  104. package/src/index.test.ts +0 -145
  105. package/src/index.ts +0 -251
  106. package/src/public.test.ts +36 -0
  107. package/src/public.ts +2 -6
  108. package/src/test.test.ts +38 -0
  109. package/src/test.ts +1 -0
  110. package/src/types/contract.ts +144 -40
  111. package/src/types/index.ts +2 -1
  112. package/src/types/utils.ts +21 -0
  113. package/src/utils/abi/decodeErrorResult.test.ts +1 -1
  114. package/src/utils/abi/decodeEventLog.test.ts +542 -0
  115. package/src/utils/abi/decodeEventLog.ts +107 -0
  116. package/src/utils/abi/decodeFunctionData.test.ts +1 -2
  117. package/src/utils/abi/decodeFunctionData.ts +5 -2
  118. package/src/utils/abi/encodeFunctionData.ts +1 -4
  119. package/src/utils/abi/index.test.ts +1 -0
  120. package/src/utils/abi/index.ts +6 -0
  121. package/src/utils/ens/index.test.ts +1 -0
  122. package/src/utils/ens/index.ts +2 -0
  123. package/src/utils/ens/packetToBytes.test.ts +11 -0
  124. package/src/utils/ens/packetToBytes.ts +29 -0
  125. package/src/utils/index.test.ts +1 -3
  126. package/src/utils/index.ts +3 -2
  127. package/src/utils/rpc.test.ts +1 -0
  128. package/src/utils/rpc.ts +4 -2
  129. package/src/wallet.test.ts +19 -0
  130. package/wallet/package.json +4 -0
  131. package/clients/package.json +0 -4
  132. package/dist/chunk-7Y5QVLX7.js.map +0 -1
  133. package/dist/chunk-BV5NTHUX.js +0 -260
  134. package/dist/chunk-BV5NTHUX.js.map +0 -1
  135. package/dist/chunk-EGVXCZNJ.mjs +0 -260
  136. package/dist/chunk-EGVXCZNJ.mjs.map +0 -1
  137. package/dist/chunk-GX2KDAM3.mjs +0 -256
  138. package/dist/chunk-GX2KDAM3.mjs.map +0 -1
  139. package/dist/chunk-NW6724MI.js +0 -256
  140. package/dist/chunk-NW6724MI.js.map +0 -1
  141. package/dist/chunk-RJLUZTJS.mjs.map +0 -1
  142. package/dist/chunk-SSPRUPGN.js.map +0 -1
  143. package/dist/chunk-TXHOG6KU.mjs.map +0 -1
  144. package/dist/chunk-XBUH66KN.mjs.map +0 -1
  145. package/dist/chunk-ZKYGWITF.js.map +0 -1
  146. package/dist/clients/index.d.ts +0 -9
  147. package/dist/clients/index.js +0 -24
  148. package/dist/clients/index.mjs +0 -24
  149. package/dist/normalize-ef9240c0.d.ts +0 -33
  150. package/dist/parseGwei-3411cf2d.d.ts +0 -355
  151. package/dist/rpc-26932bae.d.ts +0 -61
  152. package/dist/stopImpersonatingAccount-afb26486.d.ts +0 -156
  153. package/dist/watchAsset-efd3dd05.d.ts +0 -38
  154. package/dist/watchPendingTransactions-57df1a13.d.ts +0 -373
  155. package/dist/webSocket-d2e7bd0e.d.ts +0 -83
@@ -0,0 +1,4 @@
1
+ {
2
+ "module": "../dist/contract.mjs",
3
+ "main": "../dist/contract.js"
4
+ }
@@ -0,0 +1,23 @@
1
+ import { C as Chain, A as Address, b as BlockTag, H as Hex, O as Formatter, S as MergeIntersectionProperties, V as Formatted, s as TransactionRequest } from './chain-f16512e8.js';
2
+ import { P as PublicClient } from './createPublicClient-b732194e.js';
3
+ import { T as TransactionRequestFormatter } from './transactionRequest-c7794f5e.js';
4
+
5
+ type FormattedCall<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Formatted<TFormatter, TransactionRequest, true>, TransactionRequest>;
6
+ type CallArgs<TChain extends Chain = Chain> = FormattedCall<TransactionRequestFormatter<TChain>> & {
7
+ chain?: TChain;
8
+ from?: Address;
9
+ } & ({
10
+ /** The balance of the account at a block number. */
11
+ blockNumber?: bigint;
12
+ blockTag?: never;
13
+ } | {
14
+ blockNumber?: never;
15
+ /** The balance of the account at a block tag. */
16
+ blockTag?: BlockTag;
17
+ });
18
+ type CallResponse = {
19
+ data: Hex | undefined;
20
+ };
21
+ declare function call<TChain extends Chain>(client: PublicClient, { blockNumber, blockTag, chain, from, accessList, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, ...rest }: CallArgs<TChain>): Promise<CallResponse>;
22
+
23
+ export { CallArgs as C, CallResponse as a, call as c };
@@ -1,4 +1,4 @@
1
- import { V as Formatters, C as Chain } from './chain-4b39613a.js';
1
+ import { M as Formatters, C as Chain } from './chain-f16512e8.js';
2
2
 
3
3
  declare function defineChain<TFormatters extends Formatters = Formatters, TChain extends Chain<TFormatters> = Chain<TFormatters>>(chain: TChain): TChain;
4
4
 
@@ -141,6 +141,25 @@ type OptionalNullable<T> = {
141
141
  } & {
142
142
  [K in keyof T as T[K] extends NonNullable<unknown> ? never : K]?: T[K];
143
143
  };
144
+ /**
145
+ * @description Constructs a type by excluding `undefined` from `T`.
146
+ *
147
+ * @example
148
+ * NoUndefined<string | undefined>
149
+ * => string
150
+ */
151
+ type NoUndefined<T> = T extends undefined ? never : T;
152
+ /**
153
+ * @description Combines members of an intersection into a readable type.
154
+ *
155
+ * @link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg
156
+ * @example
157
+ * Prettify<{ a: string } | { b: string } | { c: number, d: bigint }>
158
+ * => { a: string, b: string, c: number, d: bigint }
159
+ */
160
+ type Prettify<T> = {
161
+ [K in keyof T]: T[K];
162
+ } & {};
144
163
  type TrimLeft<T, Chars extends string = ' '> = T extends `${Chars}${infer R}` ? TrimLeft<R> : T;
145
164
  type TrimRight<T, Chars extends string = ' '> = T extends `${infer R}${Chars}` ? TrimRight<R> : T;
146
165
  /**
@@ -350,4 +369,4 @@ type Chain<TFormatters extends Formatters = Formatters> = Chain$1 & {
350
369
  formatters?: TFormatters;
351
370
  };
352
371
 
353
- export { defineTransaction as $, Address as A, ByteArray as B, Chain as C, TransactionEIP2930 as D, TransactionLegacy as E, FeeHistory as F, FormattedTransaction as G, Hex as H, formatTransaction as I, transactionType as J, Formatter as K, Log as L, MergeIntersectionProperties as M, Formatted as N, EstimateGasParameters as O, TransactionFormatter as P, ExtractFormatter as Q, RpcBlock as R, TransactionType$1 as S, TransactionReceipt as T, Uncle as U, Formatters as V, Trim as W, Quantity as X, RpcEstimateGasParameters as Y, LogTopic as Z, defineFormatter as _, Hash as a, format as a0, BlockTag as b, BlockNumber as c, AccessList as d, Block as e, BlockIdentifier as f, FeeValues as g, FeeValuesEIP1559 as h, FeeValuesLegacy as i, RpcBlockIdentifier as j, RpcBlockNumber as k, RpcFeeHistory as l, RpcFeeValues as m, RpcLog as n, RpcTransaction as o, RpcTransactionReceipt as p, RpcTransactionRequest as q, RpcUncle as r, TransactionRequest as s, TransactionRequestBase as t, TransactionRequestEIP1559 as u, TransactionRequestEIP2930 as v, TransactionRequestLegacy as w, Transaction as x, TransactionBase as y, TransactionEIP1559 as z };
372
+ export { defineTransaction as $, Address as A, ByteArray as B, Chain as C, TransactionEIP2930 as D, TransactionLegacy as E, FeeHistory as F, LogTopic as G, Hex as H, Trim as I, RpcEstimateGasParameters as J, TransactionType$1 as K, Log as L, Formatters as M, NoUndefined as N, Formatter as O, Prettify as P, Quantity as Q, RpcBlock as R, MergeIntersectionProperties as S, TransactionReceipt as T, Uncle as U, Formatted as V, ExtractFormatter as W, EstimateGasParameters as X, FormattedTransaction as Y, TransactionFormatter as Z, defineFormatter as _, Hash as a, format as a0, formatTransaction as a1, transactionType as a2, BlockTag as b, AccessList as c, Block as d, BlockIdentifier as e, BlockNumber as f, FeeValues as g, FeeValuesEIP1559 as h, FeeValuesLegacy as i, RpcBlockIdentifier as j, RpcBlockNumber as k, RpcFeeHistory as l, RpcFeeValues as m, RpcLog as n, RpcTransaction as o, RpcTransactionReceipt as p, RpcTransactionRequest as q, RpcUncle as r, TransactionRequest as s, TransactionRequestBase as t, TransactionRequestEIP1559 as u, TransactionRequestEIP2930 as v, TransactionRequestLegacy as w, Transaction as x, TransactionBase as y, TransactionEIP1559 as z };
package/dist/chains.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { R as RpcBlock, e as Block, x as Transaction, H as Hex, o as RpcTransaction, p as RpcTransactionReceipt, T as TransactionReceipt, S as TransactionType, s as TransactionRequest, q as RpcTransactionRequest } from './chain-4b39613a.js';
2
- export { C as Chain } from './chain-4b39613a.js';
3
- export { d as defineChain } from './chain-aa4898d0.js';
1
+ import { R as RpcBlock, d as Block, x as Transaction, H as Hex, o as RpcTransaction, p as RpcTransactionReceipt, T as TransactionReceipt, K as TransactionType, s as TransactionRequest, q as RpcTransactionRequest } from './chain-f16512e8.js';
2
+ export { C as Chain } from './chain-f16512e8.js';
3
+ export { d as defineChain } from './chain-c4ccb458.js';
4
4
  import '@wagmi/chains';
5
5
 
6
6
  declare const arbitrum: {
@@ -669,10 +669,10 @@ declare const filecoin: {
669
669
  };
670
670
  readonly rpcUrls: {
671
671
  readonly default: {
672
- readonly http: readonly ["https://api.node.glif.io"];
672
+ readonly http: readonly ["https://api.node.glif.io/rpc/v1"];
673
673
  };
674
674
  readonly public: {
675
- readonly http: readonly ["https://api.node.glif.io"];
675
+ readonly http: readonly ["https://api.node.glif.io/rpc/v1"];
676
676
  };
677
677
  };
678
678
  readonly blockExplorers: {
@@ -688,6 +688,10 @@ declare const filecoin: {
688
688
  readonly name: "Filscout";
689
689
  readonly url: "https://filscout.io/en";
690
690
  };
691
+ readonly glif: {
692
+ readonly name: "Glif";
693
+ readonly url: "https://explorer.glif.io";
694
+ };
691
695
  };
692
696
  };
693
697
  declare const filecoinTestnet: {
@@ -712,9 +716,9 @@ declare const filecoinTestnet: {
712
716
  readonly name: "Filfox";
713
717
  readonly url: "https://hyperspace.filfox.info/en";
714
718
  };
715
- readonly gilf: {
716
- readonly name: "Glif";
717
- readonly url: "https://explorer.glif.io/?network=hyperspace";
719
+ readonly filscan: {
720
+ readonly name: "Filscan";
721
+ readonly url: "https://hyperspace.filscan.io";
718
722
  };
719
723
  };
720
724
  };
@@ -775,6 +779,10 @@ declare const goerli: {
775
779
  readonly ensRegistry: {
776
780
  readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
777
781
  };
782
+ readonly ensUniversalResolver: {
783
+ readonly address: "0x687c30Cc44bFA39A1449e86E172BF002E7b3f0b0";
784
+ readonly blockCreated: 7725078;
785
+ };
778
786
  readonly multicall3: {
779
787
  readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
780
788
  readonly blockCreated: 6507670;
@@ -961,6 +969,10 @@ declare const mainnet: {
961
969
  readonly ensRegistry: {
962
970
  readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
963
971
  };
972
+ readonly ensUniversalResolver: {
973
+ readonly address: "0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376";
974
+ readonly blockCreated: 16172161;
975
+ };
964
976
  readonly multicall3: {
965
977
  readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
966
978
  readonly blockCreated: 14353601;
package/dist/chains.js CHANGED
@@ -4,32 +4,32 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkSSPRUPGNjs = require('./chunk-SSPRUPGN.js');
7
+ var _chunkTHMRUG4Djs = require('./chunk-THMRUG4D.js');
8
8
 
9
9
  // src/chains.ts
10
10
  var _chains = require('@wagmi/chains'); var chains = _interopRequireWildcard(_chains);
11
11
  var celoFormatters = {
12
- block: _chunkSSPRUPGNjs.defineBlock.call(void 0, {
12
+ block: _chunkTHMRUG4Djs.defineBlock.call(void 0, {
13
13
  exclude: ["difficulty", "gasLimit", "mixHash", "nonce", "uncles"],
14
14
  format: (block) => ({
15
15
  randomness: block.randomness
16
16
  })
17
17
  }),
18
- transaction: _chunkSSPRUPGNjs.defineTransaction.call(void 0, {
18
+ transaction: _chunkTHMRUG4Djs.defineTransaction.call(void 0, {
19
19
  format: (transaction) => ({
20
20
  feeCurrency: transaction.feeCurrency,
21
21
  gatewayFee: transaction.gatewayFee ? BigInt(transaction.gatewayFee) : null,
22
22
  gatewayFeeRecipient: transaction.gatewayFeeRecipient
23
23
  })
24
24
  }),
25
- transactionReceipt: _chunkSSPRUPGNjs.defineTransactionReceipt.call(void 0, {
25
+ transactionReceipt: _chunkTHMRUG4Djs.defineTransactionReceipt.call(void 0, {
26
26
  format: (transaction) => ({
27
27
  feeCurrency: transaction.feeCurrency,
28
28
  gatewayFee: transaction.gatewayFee ? BigInt(transaction.gatewayFee) : null,
29
29
  gatewayFeeRecipient: transaction.gatewayFeeRecipient
30
30
  })
31
31
  }),
32
- transactionRequest: _chunkSSPRUPGNjs.defineTransactionRequest.call(void 0, {
32
+ transactionRequest: _chunkTHMRUG4Djs.defineTransactionRequest.call(void 0, {
33
33
  format: (transactionRequest) => ({
34
34
  feeCurrency: transactionRequest.feeCurrency,
35
35
  gatewayFee: transactionRequest.gatewayFee,
@@ -37,52 +37,52 @@ var celoFormatters = {
37
37
  })
38
38
  })
39
39
  };
40
- var arbitrum2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.arbitrum);
41
- var arbitrumGoerli2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.arbitrumGoerli);
42
- var aurora2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.aurora);
43
- var auroraGoerli = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.auroraTestnet);
44
- var avalanche2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.avalanche);
45
- var avalancheFuji2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.avalancheFuji);
46
- var bronos2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.bronos);
47
- var bronosTestnet2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.bronosTestnet);
48
- var bsc2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.bsc);
49
- var bscTestnet2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.bscTestnet);
50
- var canto2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.canto);
51
- var celo2 = _chunkSSPRUPGNjs.defineChain.call(void 0, {
40
+ var arbitrum2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.arbitrum);
41
+ var arbitrumGoerli2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.arbitrumGoerli);
42
+ var aurora2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.aurora);
43
+ var auroraGoerli = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.auroraTestnet);
44
+ var avalanche2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.avalanche);
45
+ var avalancheFuji2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.avalancheFuji);
46
+ var bronos2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.bronos);
47
+ var bronosTestnet2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.bronosTestnet);
48
+ var bsc2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.bsc);
49
+ var bscTestnet2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.bscTestnet);
50
+ var canto2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.canto);
51
+ var celo2 = _chunkTHMRUG4Djs.defineChain.call(void 0, {
52
52
  ...chains.celo,
53
53
  formatters: celoFormatters
54
54
  });
55
- var celoAlfajores2 = _chunkSSPRUPGNjs.defineChain.call(void 0, {
55
+ var celoAlfajores2 = _chunkTHMRUG4Djs.defineChain.call(void 0, {
56
56
  ...chains.celoAlfajores,
57
57
  formatters: celoFormatters
58
58
  });
59
- var crossbell2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.crossbell);
60
- var evmos2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.evmos);
61
- var evmosTestnet2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.evmosTestnet);
62
- var fantom2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.fantom);
63
- var fantomTestnet2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.fantomTestnet);
64
- var filecoin2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.filecoin);
65
- var filecoinTestnet = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.filecoinHyperspace);
66
- var foundry2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.foundry);
67
- var goerli2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.goerli);
68
- var gnosis2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.gnosis);
69
- var gnosisChiado2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.gnosisChiado);
70
- var hardhat2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.hardhat);
71
- var iotex2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.iotex);
72
- var iotexTestnet2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.iotexTestnet);
73
- var localhost2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.localhost);
74
- var mainnet2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.mainnet);
75
- var metis2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.metis);
76
- var metisGoerli2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.metisGoerli);
77
- var optimism2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.optimism);
78
- var optimismGoerli2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.optimismGoerli);
79
- var polygon2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.polygon);
80
- var polygonMumbai2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.polygonMumbai);
81
- var sepolia2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.sepolia);
82
- var taraxa2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.taraxa);
83
- var taraxaTestnet2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.taraxaTestnet);
84
- var zkSync2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.zkSync);
85
- var zkSyncTestnet2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.zkSyncTestnet);
59
+ var crossbell2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.crossbell);
60
+ var evmos2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.evmos);
61
+ var evmosTestnet2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.evmosTestnet);
62
+ var fantom2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.fantom);
63
+ var fantomTestnet2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.fantomTestnet);
64
+ var filecoin2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.filecoin);
65
+ var filecoinTestnet = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.filecoinHyperspace);
66
+ var foundry2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.foundry);
67
+ var goerli2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.goerli);
68
+ var gnosis2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.gnosis);
69
+ var gnosisChiado2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.gnosisChiado);
70
+ var hardhat2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.hardhat);
71
+ var iotex2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.iotex);
72
+ var iotexTestnet2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.iotexTestnet);
73
+ var localhost2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.localhost);
74
+ var mainnet2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.mainnet);
75
+ var metis2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.metis);
76
+ var metisGoerli2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.metisGoerli);
77
+ var optimism2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.optimism);
78
+ var optimismGoerli2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.optimismGoerli);
79
+ var polygon2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.polygon);
80
+ var polygonMumbai2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.polygonMumbai);
81
+ var sepolia2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.sepolia);
82
+ var taraxa2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.taraxa);
83
+ var taraxaTestnet2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.taraxaTestnet);
84
+ var zkSync2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.zkSync);
85
+ var zkSyncTestnet2 = _chunkTHMRUG4Djs.defineChain.call(void 0, chains.zkSyncTestnet);
86
86
 
87
87
 
88
88
 
@@ -125,5 +125,5 @@ var zkSyncTestnet2 = _chunkSSPRUPGNjs.defineChain.call(void 0, chains.zkSyncTest
125
125
 
126
126
 
127
127
 
128
- exports.arbitrum = arbitrum2; exports.arbitrumGoerli = arbitrumGoerli2; exports.aurora = aurora2; exports.auroraGoerli = auroraGoerli; exports.avalanche = avalanche2; exports.avalancheFuji = avalancheFuji2; exports.bronos = bronos2; exports.bronosTestnet = bronosTestnet2; exports.bsc = bsc2; exports.bscTestnet = bscTestnet2; exports.canto = canto2; exports.celo = celo2; exports.celoAlfajores = celoAlfajores2; exports.crossbell = crossbell2; exports.defineChain = _chunkSSPRUPGNjs.defineChain; exports.evmos = evmos2; exports.evmosTestnet = evmosTestnet2; exports.fantom = fantom2; exports.fantomTestnet = fantomTestnet2; exports.filecoin = filecoin2; exports.filecoinTestnet = filecoinTestnet; exports.foundry = foundry2; exports.gnosis = gnosis2; exports.gnosisChiado = gnosisChiado2; exports.goerli = goerli2; exports.hardhat = hardhat2; exports.iotex = iotex2; exports.iotexTestnet = iotexTestnet2; exports.localhost = localhost2; exports.mainnet = mainnet2; exports.metis = metis2; exports.metisGoerli = metisGoerli2; exports.optimism = optimism2; exports.optimismGoerli = optimismGoerli2; exports.polygon = polygon2; exports.polygonMumbai = polygonMumbai2; exports.sepolia = sepolia2; exports.taraxa = taraxa2; exports.taraxaTestnet = taraxaTestnet2; exports.zkSync = zkSync2; exports.zkSyncTestnet = zkSyncTestnet2;
128
+ exports.arbitrum = arbitrum2; exports.arbitrumGoerli = arbitrumGoerli2; exports.aurora = aurora2; exports.auroraGoerli = auroraGoerli; exports.avalanche = avalanche2; exports.avalancheFuji = avalancheFuji2; exports.bronos = bronos2; exports.bronosTestnet = bronosTestnet2; exports.bsc = bsc2; exports.bscTestnet = bscTestnet2; exports.canto = canto2; exports.celo = celo2; exports.celoAlfajores = celoAlfajores2; exports.crossbell = crossbell2; exports.defineChain = _chunkTHMRUG4Djs.defineChain; exports.evmos = evmos2; exports.evmosTestnet = evmosTestnet2; exports.fantom = fantom2; exports.fantomTestnet = fantomTestnet2; exports.filecoin = filecoin2; exports.filecoinTestnet = filecoinTestnet; exports.foundry = foundry2; exports.gnosis = gnosis2; exports.gnosisChiado = gnosisChiado2; exports.goerli = goerli2; exports.hardhat = hardhat2; exports.iotex = iotex2; exports.iotexTestnet = iotexTestnet2; exports.localhost = localhost2; exports.mainnet = mainnet2; exports.metis = metis2; exports.metisGoerli = metisGoerli2; exports.optimism = optimism2; exports.optimismGoerli = optimismGoerli2; exports.polygon = polygon2; exports.polygonMumbai = polygonMumbai2; exports.sepolia = sepolia2; exports.taraxa = taraxa2; exports.taraxaTestnet = taraxaTestnet2; exports.zkSync = zkSync2; exports.zkSyncTestnet = zkSyncTestnet2;
129
129
  //# sourceMappingURL=chains.js.map
package/dist/chains.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  defineTransaction,
5
5
  defineTransactionReceipt,
6
6
  defineTransactionRequest
7
- } from "./chunk-XBUH66KN.mjs";
7
+ } from "./chunk-KSAO4Y4Q.mjs";
8
8
 
9
9
  // src/chains.ts
10
10
  import * as chains from "@wagmi/chains";
@@ -1,6 +1,3 @@
1
- import {
2
- sendTransaction
3
- } from "./chunk-TXHOG6KU.mjs";
4
1
  import {
5
2
  AbiDecodingZeroDataError,
6
3
  BlockNotFoundError,
@@ -10,10 +7,11 @@ import {
10
7
  TransactionReceiptNotFoundError,
11
8
  WaitForTransactionReceiptTimeoutError,
12
9
  decodeFunctionResult,
13
- encodeDeployData,
14
10
  encodeEventTopics,
15
11
  encodeFunctionData,
16
12
  extract,
13
+ extractFunctionName,
14
+ extractFunctionParams,
17
15
  format,
18
16
  formatBlock,
19
17
  formatFeeHistory,
@@ -23,13 +21,12 @@ import {
23
21
  formatTransactionRequest,
24
22
  getCache,
25
23
  getContractError,
26
- getEventSignature,
27
24
  hexToNumber,
28
25
  multicall3Abi,
29
26
  numberToHex,
30
27
  wait,
31
28
  withCache
32
- } from "./chunk-XBUH66KN.mjs";
29
+ } from "./chunk-KSAO4Y4Q.mjs";
33
30
 
34
31
  // src/actions/public/call.ts
35
32
  async function call(client, {
@@ -64,6 +61,7 @@ async function call(client, {
64
61
  nonce,
65
62
  to,
66
63
  value,
64
+ // Pick out extra data that might exist on the chain's transaction request type.
67
65
  ...extract(rest, { formatter })
68
66
  },
69
67
  {
@@ -142,80 +140,6 @@ async function createBlockFilter(client) {
142
140
  return { id, type: "block" };
143
141
  }
144
142
 
145
- // src/actions/public/createEventFilter.ts
146
- async function createEventFilter(client, {
147
- address,
148
- event,
149
- args,
150
- fromBlock,
151
- toBlock
152
- } = {}) {
153
- let topics = [];
154
- if (event) {
155
- topics = buildFilterTopics({ event, args });
156
- }
157
- const id = await client.request({
158
- method: "eth_newFilter",
159
- params: [
160
- {
161
- address,
162
- fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock,
163
- toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock,
164
- ...topics.length ? { topics } : {}
165
- }
166
- ]
167
- });
168
- return { id, type: "event" };
169
- }
170
- function buildFilterTopics({
171
- event,
172
- args: _args
173
- }) {
174
- const signature = getEventSignature(event);
175
- return [signature];
176
- }
177
-
178
- // src/actions/public/createContractEventFilter.ts
179
- async function createContractEventFilter(client, {
180
- address,
181
- abi,
182
- args,
183
- eventName,
184
- fromBlock,
185
- toBlock
186
- }) {
187
- const topics = eventName ? encodeEventTopics({
188
- abi,
189
- args,
190
- eventName
191
- }) : void 0;
192
- const id = await client.request({
193
- method: "eth_newFilter",
194
- params: [
195
- {
196
- address,
197
- fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock,
198
- toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock,
199
- topics
200
- }
201
- ]
202
- });
203
- return { id, type: "event" };
204
- }
205
-
206
- // src/actions/public/deployContract.ts
207
- function deployContract(walletClient, { abi, args, bytecode, ...request }) {
208
- const calldata = encodeDeployData({
209
- abi,
210
- args,
211
- bytecode
212
- });
213
- return sendTransaction(walletClient, {
214
- ...request,
215
- data: calldata
216
- });
217
- }
218
-
219
143
  // src/actions/public/estimateGas.ts
220
144
  async function estimateGas(client, {
221
145
  blockNumber,
@@ -386,6 +310,50 @@ async function getGasPrice(client) {
386
310
  return BigInt(gasPrice);
387
311
  }
388
312
 
313
+ // src/actions/public/createEventFilter.ts
314
+ async function createEventFilter(client, {
315
+ address,
316
+ event,
317
+ args,
318
+ fromBlock,
319
+ toBlock
320
+ } = {}) {
321
+ let topics = [];
322
+ if (event)
323
+ topics = buildFilterTopics({ event, args });
324
+ const id = await client.request({
325
+ method: "eth_newFilter",
326
+ params: [
327
+ {
328
+ address,
329
+ fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock,
330
+ toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock,
331
+ ...topics.length ? { topics } : {}
332
+ }
333
+ ]
334
+ });
335
+ return { id, type: "event" };
336
+ }
337
+ function buildFilterTopics({
338
+ event,
339
+ args
340
+ }) {
341
+ const eventName = extractFunctionName(event);
342
+ const abi = unstable_parseAbi(event);
343
+ return encodeEventTopics({ abi, eventName, args });
344
+ }
345
+ function unstable_parseAbi(definition) {
346
+ const name = extractFunctionName(definition);
347
+ const params = extractFunctionParams(definition);
348
+ return [
349
+ {
350
+ type: "event",
351
+ name,
352
+ inputs: params || []
353
+ }
354
+ ];
355
+ }
356
+
389
357
  // src/actions/public/getLogs.ts
390
358
  async function getLogs(client, {
391
359
  address,
@@ -665,6 +633,34 @@ function observe(observerId, callbacks, fn) {
665
633
  return unwatch;
666
634
  }
667
635
 
636
+ // src/actions/public/createContractEventFilter.ts
637
+ async function createContractEventFilter(client, {
638
+ address,
639
+ abi,
640
+ args,
641
+ eventName,
642
+ fromBlock,
643
+ toBlock
644
+ }) {
645
+ const topics = eventName ? encodeEventTopics({
646
+ abi,
647
+ args,
648
+ eventName
649
+ }) : void 0;
650
+ const id = await client.request({
651
+ method: "eth_newFilter",
652
+ params: [
653
+ {
654
+ address,
655
+ fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock,
656
+ toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock,
657
+ topics
658
+ }
659
+ ]
660
+ });
661
+ return { id, type: "event" };
662
+ }
663
+
668
664
  // src/utils/poll.ts
669
665
  function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
670
666
  let active = true;
@@ -792,6 +788,130 @@ function watchBlocks(client, {
792
788
  );
793
789
  }
794
790
 
791
+ // src/actions/public/watchContractEvent.ts
792
+ function watchContractEvent(client, {
793
+ abi,
794
+ address,
795
+ args,
796
+ batch = true,
797
+ eventName,
798
+ onError,
799
+ onLogs,
800
+ pollingInterval = client.pollingInterval
801
+ }) {
802
+ const observerId = JSON.stringify([
803
+ "watchContractEvent",
804
+ address,
805
+ args,
806
+ batch,
807
+ client.uid,
808
+ eventName,
809
+ pollingInterval
810
+ ]);
811
+ return observe(observerId, { onLogs, onError }, (emit) => {
812
+ let filter;
813
+ const unwatch = poll(
814
+ async () => {
815
+ try {
816
+ if (!filter) {
817
+ try {
818
+ filter = await createContractEventFilter(client, {
819
+ abi,
820
+ address,
821
+ args,
822
+ eventName
823
+ });
824
+ return;
825
+ } catch (err) {
826
+ unwatch();
827
+ throw err;
828
+ }
829
+ }
830
+ const logs = await getFilterChanges(client, { filter });
831
+ if (logs.length === 0)
832
+ return;
833
+ if (batch)
834
+ emit.onLogs(logs);
835
+ else
836
+ logs.forEach((log) => emit.onLogs([log]));
837
+ } catch (err) {
838
+ emit.onError?.(err);
839
+ }
840
+ },
841
+ {
842
+ emitOnBegin: true,
843
+ interval: pollingInterval
844
+ }
845
+ );
846
+ return async () => {
847
+ if (filter)
848
+ await uninstallFilter(client, { filter });
849
+ unwatch();
850
+ };
851
+ });
852
+ }
853
+
854
+ // src/actions/public/watchEvent.ts
855
+ function watchEvent(client, {
856
+ address,
857
+ args,
858
+ batch = true,
859
+ event,
860
+ onError,
861
+ onLogs,
862
+ pollingInterval = client.pollingInterval
863
+ }) {
864
+ const observerId = JSON.stringify([
865
+ "watchEvent",
866
+ address,
867
+ args,
868
+ batch,
869
+ client.uid,
870
+ event,
871
+ pollingInterval
872
+ ]);
873
+ return observe(observerId, { onLogs, onError }, (emit) => {
874
+ let filter;
875
+ const unwatch = poll(
876
+ async () => {
877
+ try {
878
+ if (!filter) {
879
+ try {
880
+ filter = await createEventFilter(client, {
881
+ address,
882
+ args,
883
+ event
884
+ });
885
+ return;
886
+ } catch (err) {
887
+ unwatch();
888
+ throw err;
889
+ }
890
+ }
891
+ const logs = await getFilterChanges(client, { filter });
892
+ if (logs.length === 0)
893
+ return;
894
+ if (batch)
895
+ emit.onLogs(logs);
896
+ else
897
+ logs.forEach((log) => emit.onLogs([log]));
898
+ } catch (err) {
899
+ emit.onError?.(err);
900
+ }
901
+ },
902
+ {
903
+ emitOnBegin: true,
904
+ interval: pollingInterval
905
+ }
906
+ );
907
+ return async () => {
908
+ if (filter)
909
+ await uninstallFilter(client, { filter });
910
+ unwatch();
911
+ };
912
+ });
913
+ }
914
+
795
915
  // src/actions/public/watchPendingTransactions.ts
796
916
  function watchPendingTransactions(client, {
797
917
  batch = true,
@@ -940,9 +1060,6 @@ export {
940
1060
  simulateContract,
941
1061
  createPendingTransactionFilter,
942
1062
  createBlockFilter,
943
- createEventFilter,
944
- createContractEventFilter,
945
- deployContract,
946
1063
  estimateGas,
947
1064
  getBalance,
948
1065
  getBlock,
@@ -967,6 +1084,8 @@ export {
967
1084
  waitForTransactionReceipt,
968
1085
  watchBlockNumber,
969
1086
  watchBlocks,
1087
+ watchContractEvent,
1088
+ watchEvent,
970
1089
  watchPendingTransactions
971
1090
  };
972
- //# sourceMappingURL=chunk-RJLUZTJS.mjs.map
1091
+ //# sourceMappingURL=chunk-2Y3UZMSP.mjs.map