@farcaster/create-mini-app 0.0.4 → 0.0.6

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 (95) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/CHANGELOG.md +12 -0
  3. package/bin.ts +2 -0
  4. package/dist/bin.js +6 -6
  5. package/dist/bin.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -5
  9. package/dist/index.js.map +1 -1
  10. package/dist/init.js +21 -27
  11. package/dist/init.js.map +1 -1
  12. package/index.ts +1 -1
  13. package/init.ts +1 -1
  14. package/package.json +2 -2
  15. package/templates/default/_env.local +1 -0
  16. package/templates/default/_gitignore +24 -0
  17. package/templates/default/_npmrc +1 -0
  18. package/templates/default/node_modules/.bin/biome +17 -0
  19. package/templates/default/node_modules/.bin/browserslist +17 -0
  20. package/templates/default/node_modules/.bin/esbuild +17 -0
  21. package/templates/default/node_modules/.bin/terser +17 -0
  22. package/templates/default/node_modules/.bin/tsc +17 -0
  23. package/templates/default/node_modules/.bin/tsserver +17 -0
  24. package/templates/default/node_modules/.bin/vite +17 -0
  25. package/templates/default/node_modules/.bin/wagmi +17 -0
  26. package/templates/default/node_modules/.vite/deps/@farcaster_frame-sdk.js +84 -0
  27. package/templates/default/node_modules/.vite/deps/@farcaster_frame-sdk.js.map +7 -0
  28. package/templates/default/node_modules/.vite/deps/@farcaster_frame-wagmi-connector.js +1936 -0
  29. package/templates/default/node_modules/.vite/deps/@farcaster_frame-wagmi-connector.js.map +7 -0
  30. package/templates/default/node_modules/.vite/deps/@tanstack_react-query.js +96 -0
  31. package/templates/default/node_modules/.vite/deps/@tanstack_react-query.js.map +7 -0
  32. package/templates/default/node_modules/.vite/deps/_metadata.json +139 -0
  33. package/templates/default/node_modules/.vite/deps/ccip-JTEXJDV5.js +17 -0
  34. package/templates/default/node_modules/.vite/deps/ccip-JTEXJDV5.js.map +7 -0
  35. package/templates/default/node_modules/.vite/deps/ccip-LLOJAQYN.js +14 -0
  36. package/templates/default/node_modules/.vite/deps/ccip-LLOJAQYN.js.map +7 -0
  37. package/templates/default/node_modules/.vite/deps/chunk-2KW72IQL.js +2601 -0
  38. package/templates/default/node_modules/.vite/deps/chunk-2KW72IQL.js.map +7 -0
  39. package/templates/default/node_modules/.vite/deps/chunk-2ULAEEW3.js +286 -0
  40. package/templates/default/node_modules/.vite/deps/chunk-2ULAEEW3.js.map +7 -0
  41. package/templates/default/node_modules/.vite/deps/chunk-3MMZATWV.js +1906 -0
  42. package/templates/default/node_modules/.vite/deps/chunk-3MMZATWV.js.map +7 -0
  43. package/templates/default/node_modules/.vite/deps/chunk-6WYSWNQJ.js +3183 -0
  44. package/templates/default/node_modules/.vite/deps/chunk-6WYSWNQJ.js.map +7 -0
  45. package/templates/default/node_modules/.vite/deps/chunk-AJPHOYQK.js +21628 -0
  46. package/templates/default/node_modules/.vite/deps/chunk-AJPHOYQK.js.map +7 -0
  47. package/templates/default/node_modules/.vite/deps/chunk-HP7M7ER3.js +2221 -0
  48. package/templates/default/node_modules/.vite/deps/chunk-HP7M7ER3.js.map +7 -0
  49. package/templates/default/node_modules/.vite/deps/chunk-JDAHWTZP.js +928 -0
  50. package/templates/default/node_modules/.vite/deps/chunk-JDAHWTZP.js.map +7 -0
  51. package/templates/default/node_modules/.vite/deps/chunk-OOB7NECH.js +58 -0
  52. package/templates/default/node_modules/.vite/deps/chunk-OOB7NECH.js.map +7 -0
  53. package/templates/default/node_modules/.vite/deps/chunk-OYL52S4H.js +190 -0
  54. package/templates/default/node_modules/.vite/deps/chunk-OYL52S4H.js.map +7 -0
  55. package/templates/default/node_modules/.vite/deps/chunk-P2SCV6N5.js +1085 -0
  56. package/templates/default/node_modules/.vite/deps/chunk-P2SCV6N5.js.map +7 -0
  57. package/templates/default/node_modules/.vite/deps/chunk-P727YSDY.js +3246 -0
  58. package/templates/default/node_modules/.vite/deps/chunk-P727YSDY.js.map +7 -0
  59. package/templates/default/node_modules/.vite/deps/chunk-PH77EFIP.js +278 -0
  60. package/templates/default/node_modules/.vite/deps/chunk-PH77EFIP.js.map +7 -0
  61. package/templates/default/node_modules/.vite/deps/chunk-PK65EOOR.js +4416 -0
  62. package/templates/default/node_modules/.vite/deps/chunk-PK65EOOR.js.map +7 -0
  63. package/templates/default/node_modules/.vite/deps/chunk-PPRY4ZGR.js +36187 -0
  64. package/templates/default/node_modules/.vite/deps/chunk-PPRY4ZGR.js.map +7 -0
  65. package/templates/default/node_modules/.vite/deps/chunk-Q3UTC4SW.js +832 -0
  66. package/templates/default/node_modules/.vite/deps/chunk-Q3UTC4SW.js.map +7 -0
  67. package/templates/default/node_modules/.vite/deps/chunk-R2PSY44V.js +815 -0
  68. package/templates/default/node_modules/.vite/deps/chunk-R2PSY44V.js.map +7 -0
  69. package/templates/default/node_modules/.vite/deps/chunk-WOOG5QLI.js +60 -0
  70. package/templates/default/node_modules/.vite/deps/chunk-WOOG5QLI.js.map +7 -0
  71. package/templates/default/node_modules/.vite/deps/native-J7PVLWWX.js +21 -0
  72. package/templates/default/node_modules/.vite/deps/native-J7PVLWWX.js.map +7 -0
  73. package/templates/default/node_modules/.vite/deps/native-UTGEKOTD.js +21 -0
  74. package/templates/default/node_modules/.vite/deps/native-UTGEKOTD.js.map +7 -0
  75. package/templates/default/node_modules/.vite/deps/package.json +3 -0
  76. package/templates/default/node_modules/.vite/deps/react-dom.js +7 -0
  77. package/templates/default/node_modules/.vite/deps/react-dom.js.map +7 -0
  78. package/templates/default/node_modules/.vite/deps/react-dom_client.js +39 -0
  79. package/templates/default/node_modules/.vite/deps/react-dom_client.js.map +7 -0
  80. package/templates/default/node_modules/.vite/deps/react.js +6 -0
  81. package/templates/default/node_modules/.vite/deps/react.js.map +7 -0
  82. package/templates/default/node_modules/.vite/deps/react_jsx-dev-runtime.js +913 -0
  83. package/templates/default/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +7 -0
  84. package/templates/default/node_modules/.vite/deps/react_jsx-runtime.js +7 -0
  85. package/templates/default/node_modules/.vite/deps/react_jsx-runtime.js.map +7 -0
  86. package/templates/default/node_modules/.vite/deps/secp256k1-HB6OVCEM.js +14 -0
  87. package/templates/default/node_modules/.vite/deps/secp256k1-HB6OVCEM.js.map +7 -0
  88. package/templates/default/node_modules/.vite/deps/secp256k1-YI5SRKAE.js +16 -0
  89. package/templates/default/node_modules/.vite/deps/secp256k1-YI5SRKAE.js.map +7 -0
  90. package/templates/default/node_modules/.vite/deps/wagmi.js +12147 -0
  91. package/templates/default/node_modules/.vite/deps/wagmi.js.map +7 -0
  92. package/templates/default/node_modules/.vite/deps/wagmi_chains.js +16355 -0
  93. package/templates/default/node_modules/.vite/deps/wagmi_chains.js.map +7 -0
  94. package/templates/default/package.json +1 -1
  95. package/templates/default/src/main.tsx +1 -1
@@ -0,0 +1,832 @@
1
+ import {
2
+ AbiConstructorNotFoundError,
3
+ AbiConstructorParamsNotFoundError,
4
+ AbiFunctionNotFoundError,
5
+ AbiFunctionOutputsNotFoundError,
6
+ AccountStateConflictError,
7
+ BaseError,
8
+ ChainDoesNotSupportContract,
9
+ ClientChainNotConfiguredError,
10
+ CounterfactualDeploymentFailedError,
11
+ HttpRequestError,
12
+ InvalidAddressError,
13
+ InvalidBytesLengthError,
14
+ RawContractError,
15
+ StateAssignmentConflictError,
16
+ assertRequest,
17
+ concat,
18
+ concatHex,
19
+ decodeAbiParameters,
20
+ decodeErrorResult,
21
+ encodeAbiParameters,
22
+ extract,
23
+ formatAbiItem,
24
+ formatTransactionRequest,
25
+ getAbiItem,
26
+ getCallError,
27
+ getChainContractAddress,
28
+ getUrl,
29
+ isAddress,
30
+ isHex,
31
+ numberToHex,
32
+ parseAccount,
33
+ stringify,
34
+ toFunctionSelector
35
+ } from "./chunk-P727YSDY.js";
36
+ import {
37
+ parseAbi
38
+ } from "./chunk-P2SCV6N5.js";
39
+
40
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/constants/abis.js
41
+ var multicall3Abi = [
42
+ {
43
+ inputs: [
44
+ {
45
+ components: [
46
+ {
47
+ name: "target",
48
+ type: "address"
49
+ },
50
+ {
51
+ name: "allowFailure",
52
+ type: "bool"
53
+ },
54
+ {
55
+ name: "callData",
56
+ type: "bytes"
57
+ }
58
+ ],
59
+ name: "calls",
60
+ type: "tuple[]"
61
+ }
62
+ ],
63
+ name: "aggregate3",
64
+ outputs: [
65
+ {
66
+ components: [
67
+ {
68
+ name: "success",
69
+ type: "bool"
70
+ },
71
+ {
72
+ name: "returnData",
73
+ type: "bytes"
74
+ }
75
+ ],
76
+ name: "returnData",
77
+ type: "tuple[]"
78
+ }
79
+ ],
80
+ stateMutability: "view",
81
+ type: "function"
82
+ }
83
+ ];
84
+ var universalResolverErrors = [
85
+ {
86
+ inputs: [],
87
+ name: "ResolverNotFound",
88
+ type: "error"
89
+ },
90
+ {
91
+ inputs: [],
92
+ name: "ResolverWildcardNotSupported",
93
+ type: "error"
94
+ },
95
+ {
96
+ inputs: [],
97
+ name: "ResolverNotContract",
98
+ type: "error"
99
+ },
100
+ {
101
+ inputs: [
102
+ {
103
+ name: "returnData",
104
+ type: "bytes"
105
+ }
106
+ ],
107
+ name: "ResolverError",
108
+ type: "error"
109
+ },
110
+ {
111
+ inputs: [
112
+ {
113
+ components: [
114
+ {
115
+ name: "status",
116
+ type: "uint16"
117
+ },
118
+ {
119
+ name: "message",
120
+ type: "string"
121
+ }
122
+ ],
123
+ name: "errors",
124
+ type: "tuple[]"
125
+ }
126
+ ],
127
+ name: "HttpError",
128
+ type: "error"
129
+ }
130
+ ];
131
+ var universalResolverResolveAbi = [
132
+ ...universalResolverErrors,
133
+ {
134
+ name: "resolve",
135
+ type: "function",
136
+ stateMutability: "view",
137
+ inputs: [
138
+ { name: "name", type: "bytes" },
139
+ { name: "data", type: "bytes" }
140
+ ],
141
+ outputs: [
142
+ { name: "", type: "bytes" },
143
+ { name: "address", type: "address" }
144
+ ]
145
+ },
146
+ {
147
+ name: "resolve",
148
+ type: "function",
149
+ stateMutability: "view",
150
+ inputs: [
151
+ { name: "name", type: "bytes" },
152
+ { name: "data", type: "bytes" },
153
+ { name: "gateways", type: "string[]" }
154
+ ],
155
+ outputs: [
156
+ { name: "", type: "bytes" },
157
+ { name: "address", type: "address" }
158
+ ]
159
+ }
160
+ ];
161
+ var universalResolverReverseAbi = [
162
+ ...universalResolverErrors,
163
+ {
164
+ name: "reverse",
165
+ type: "function",
166
+ stateMutability: "view",
167
+ inputs: [{ type: "bytes", name: "reverseName" }],
168
+ outputs: [
169
+ { type: "string", name: "resolvedName" },
170
+ { type: "address", name: "resolvedAddress" },
171
+ { type: "address", name: "reverseResolver" },
172
+ { type: "address", name: "resolver" }
173
+ ]
174
+ },
175
+ {
176
+ name: "reverse",
177
+ type: "function",
178
+ stateMutability: "view",
179
+ inputs: [
180
+ { type: "bytes", name: "reverseName" },
181
+ { type: "string[]", name: "gateways" }
182
+ ],
183
+ outputs: [
184
+ { type: "string", name: "resolvedName" },
185
+ { type: "address", name: "resolvedAddress" },
186
+ { type: "address", name: "reverseResolver" },
187
+ { type: "address", name: "resolver" }
188
+ ]
189
+ }
190
+ ];
191
+ var textResolverAbi = [
192
+ {
193
+ name: "text",
194
+ type: "function",
195
+ stateMutability: "view",
196
+ inputs: [
197
+ { name: "name", type: "bytes32" },
198
+ { name: "key", type: "string" }
199
+ ],
200
+ outputs: [{ name: "", type: "string" }]
201
+ }
202
+ ];
203
+ var addressResolverAbi = [
204
+ {
205
+ name: "addr",
206
+ type: "function",
207
+ stateMutability: "view",
208
+ inputs: [{ name: "name", type: "bytes32" }],
209
+ outputs: [{ name: "", type: "address" }]
210
+ },
211
+ {
212
+ name: "addr",
213
+ type: "function",
214
+ stateMutability: "view",
215
+ inputs: [
216
+ { name: "name", type: "bytes32" },
217
+ { name: "coinType", type: "uint256" }
218
+ ],
219
+ outputs: [{ name: "", type: "bytes" }]
220
+ }
221
+ ];
222
+ var universalSignatureValidatorAbi = [
223
+ {
224
+ inputs: [
225
+ {
226
+ name: "_signer",
227
+ type: "address"
228
+ },
229
+ {
230
+ name: "_hash",
231
+ type: "bytes32"
232
+ },
233
+ {
234
+ name: "_signature",
235
+ type: "bytes"
236
+ }
237
+ ],
238
+ stateMutability: "nonpayable",
239
+ type: "constructor"
240
+ },
241
+ {
242
+ inputs: [
243
+ {
244
+ name: "_signer",
245
+ type: "address"
246
+ },
247
+ {
248
+ name: "_hash",
249
+ type: "bytes32"
250
+ },
251
+ {
252
+ name: "_signature",
253
+ type: "bytes"
254
+ }
255
+ ],
256
+ outputs: [
257
+ {
258
+ type: "bool"
259
+ }
260
+ ],
261
+ stateMutability: "nonpayable",
262
+ type: "function",
263
+ name: "isValidSig"
264
+ }
265
+ ];
266
+
267
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/constants/contract.js
268
+ var aggregate3Signature = "0x82ad56cb";
269
+
270
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/constants/contracts.js
271
+ var deploylessCallViaBytecodeBytecode = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe";
272
+ var deploylessCallViaFactoryBytecode = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";
273
+ var universalSignatureValidatorByteCode = "0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";
274
+
275
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/abi/decodeFunctionResult.js
276
+ var docsPath = "/docs/contract/decodeFunctionResult";
277
+ function decodeFunctionResult(parameters) {
278
+ const { abi, args, functionName, data } = parameters;
279
+ let abiItem = abi[0];
280
+ if (functionName) {
281
+ const item = getAbiItem({ abi, args, name: functionName });
282
+ if (!item)
283
+ throw new AbiFunctionNotFoundError(functionName, { docsPath });
284
+ abiItem = item;
285
+ }
286
+ if (abiItem.type !== "function")
287
+ throw new AbiFunctionNotFoundError(void 0, { docsPath });
288
+ if (!abiItem.outputs)
289
+ throw new AbiFunctionOutputsNotFoundError(abiItem.name, { docsPath });
290
+ const values = decodeAbiParameters(abiItem.outputs, data);
291
+ if (values && values.length > 1)
292
+ return values;
293
+ if (values && values.length === 1)
294
+ return values[0];
295
+ return void 0;
296
+ }
297
+
298
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/abi/encodeDeployData.js
299
+ var docsPath2 = "/docs/contract/encodeDeployData";
300
+ function encodeDeployData(parameters) {
301
+ const { abi, args, bytecode } = parameters;
302
+ if (!args || args.length === 0)
303
+ return bytecode;
304
+ const description = abi.find((x) => "type" in x && x.type === "constructor");
305
+ if (!description)
306
+ throw new AbiConstructorNotFoundError({ docsPath: docsPath2 });
307
+ if (!("inputs" in description))
308
+ throw new AbiConstructorParamsNotFoundError({ docsPath: docsPath2 });
309
+ if (!description.inputs || description.inputs.length === 0)
310
+ throw new AbiConstructorParamsNotFoundError({ docsPath: docsPath2 });
311
+ const data = encodeAbiParameters(description.inputs, args);
312
+ return concatHex([bytecode, data]);
313
+ }
314
+
315
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js
316
+ var docsPath3 = "/docs/contract/encodeFunctionData";
317
+ function prepareEncodeFunctionData(parameters) {
318
+ const { abi, args, functionName } = parameters;
319
+ let abiItem = abi[0];
320
+ if (functionName) {
321
+ const item = getAbiItem({
322
+ abi,
323
+ args,
324
+ name: functionName
325
+ });
326
+ if (!item)
327
+ throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath3 });
328
+ abiItem = item;
329
+ }
330
+ if (abiItem.type !== "function")
331
+ throw new AbiFunctionNotFoundError(void 0, { docsPath: docsPath3 });
332
+ return {
333
+ abi: [abiItem],
334
+ functionName: toFunctionSelector(formatAbiItem(abiItem))
335
+ };
336
+ }
337
+
338
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/abi/encodeFunctionData.js
339
+ function encodeFunctionData(parameters) {
340
+ const { args } = parameters;
341
+ const { abi, functionName } = (() => {
342
+ var _a;
343
+ if (parameters.abi.length === 1 && ((_a = parameters.functionName) == null ? void 0 : _a.startsWith("0x")))
344
+ return parameters;
345
+ return prepareEncodeFunctionData(parameters);
346
+ })();
347
+ const abiItem = abi[0];
348
+ const signature = functionName;
349
+ const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : void 0;
350
+ return concatHex([signature, data ?? "0x"]);
351
+ }
352
+
353
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/promise/withResolvers.js
354
+ function withResolvers() {
355
+ let resolve = () => void 0;
356
+ let reject = () => void 0;
357
+ const promise = new Promise((resolve_, reject_) => {
358
+ resolve = resolve_;
359
+ reject = reject_;
360
+ });
361
+ return { promise, resolve, reject };
362
+ }
363
+
364
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/promise/createBatchScheduler.js
365
+ var schedulerCache = /* @__PURE__ */ new Map();
366
+ function createBatchScheduler({ fn, id, shouldSplitBatch, wait = 0, sort }) {
367
+ const exec = async () => {
368
+ const scheduler = getScheduler();
369
+ flush();
370
+ const args = scheduler.map(({ args: args2 }) => args2);
371
+ if (args.length === 0)
372
+ return;
373
+ fn(args).then((data) => {
374
+ if (sort && Array.isArray(data))
375
+ data.sort(sort);
376
+ for (let i = 0; i < scheduler.length; i++) {
377
+ const { resolve } = scheduler[i];
378
+ resolve == null ? void 0 : resolve([data[i], data]);
379
+ }
380
+ }).catch((err) => {
381
+ for (let i = 0; i < scheduler.length; i++) {
382
+ const { reject } = scheduler[i];
383
+ reject == null ? void 0 : reject(err);
384
+ }
385
+ });
386
+ };
387
+ const flush = () => schedulerCache.delete(id);
388
+ const getBatchedArgs = () => getScheduler().map(({ args }) => args);
389
+ const getScheduler = () => schedulerCache.get(id) || [];
390
+ const setScheduler = (item) => schedulerCache.set(id, [...getScheduler(), item]);
391
+ return {
392
+ flush,
393
+ async schedule(args) {
394
+ const { promise, resolve, reject } = withResolvers();
395
+ const split = shouldSplitBatch == null ? void 0 : shouldSplitBatch([...getBatchedArgs(), args]);
396
+ if (split)
397
+ exec();
398
+ const hasActiveScheduler = getScheduler().length > 0;
399
+ if (hasActiveScheduler) {
400
+ setScheduler({ args, resolve, reject });
401
+ return promise;
402
+ }
403
+ setScheduler({ args, resolve, reject });
404
+ setTimeout(exec, wait);
405
+ return promise;
406
+ }
407
+ };
408
+ }
409
+
410
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/stateOverride.js
411
+ function serializeStateMapping(stateMapping) {
412
+ if (!stateMapping || stateMapping.length === 0)
413
+ return void 0;
414
+ return stateMapping.reduce((acc, { slot, value }) => {
415
+ if (slot.length !== 66)
416
+ throw new InvalidBytesLengthError({
417
+ size: slot.length,
418
+ targetSize: 66,
419
+ type: "hex"
420
+ });
421
+ if (value.length !== 66)
422
+ throw new InvalidBytesLengthError({
423
+ size: value.length,
424
+ targetSize: 66,
425
+ type: "hex"
426
+ });
427
+ acc[slot] = value;
428
+ return acc;
429
+ }, {});
430
+ }
431
+ function serializeAccountStateOverride(parameters) {
432
+ const { balance, nonce, state, stateDiff, code } = parameters;
433
+ const rpcAccountStateOverride = {};
434
+ if (code !== void 0)
435
+ rpcAccountStateOverride.code = code;
436
+ if (balance !== void 0)
437
+ rpcAccountStateOverride.balance = numberToHex(balance);
438
+ if (nonce !== void 0)
439
+ rpcAccountStateOverride.nonce = numberToHex(nonce);
440
+ if (state !== void 0)
441
+ rpcAccountStateOverride.state = serializeStateMapping(state);
442
+ if (stateDiff !== void 0) {
443
+ if (rpcAccountStateOverride.state)
444
+ throw new StateAssignmentConflictError();
445
+ rpcAccountStateOverride.stateDiff = serializeStateMapping(stateDiff);
446
+ }
447
+ return rpcAccountStateOverride;
448
+ }
449
+ function serializeStateOverride(parameters) {
450
+ if (!parameters)
451
+ return void 0;
452
+ const rpcStateOverride = {};
453
+ for (const { address, ...accountState } of parameters) {
454
+ if (!isAddress(address, { strict: false }))
455
+ throw new InvalidAddressError({ address });
456
+ if (rpcStateOverride[address])
457
+ throw new AccountStateConflictError({ address });
458
+ rpcStateOverride[address] = serializeAccountStateOverride(accountState);
459
+ }
460
+ return rpcStateOverride;
461
+ }
462
+
463
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/actions/public/call.js
464
+ async function call(client, args) {
465
+ var _a, _b, _c, _d;
466
+ const { account: account_ = client.account, batch = Boolean((_a = client.batch) == null ? void 0 : _a.multicall), blockNumber, blockTag = "latest", accessList, blobs, code, data: data_, factory, factoryData, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, stateOverride, ...rest } = args;
467
+ const account = account_ ? parseAccount(account_) : void 0;
468
+ if (code && (factory || factoryData))
469
+ throw new BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
470
+ if (code && to)
471
+ throw new BaseError("Cannot provide both `code` & `to` as parameters.");
472
+ const deploylessCallViaBytecode = code && data_;
473
+ const deploylessCallViaFactory = factory && factoryData && to && data_;
474
+ const deploylessCall = deploylessCallViaBytecode || deploylessCallViaFactory;
475
+ const data = (() => {
476
+ if (deploylessCallViaBytecode)
477
+ return toDeploylessCallViaBytecodeData({
478
+ code,
479
+ data: data_
480
+ });
481
+ if (deploylessCallViaFactory)
482
+ return toDeploylessCallViaFactoryData({
483
+ data: data_,
484
+ factory,
485
+ factoryData,
486
+ to
487
+ });
488
+ return data_;
489
+ })();
490
+ try {
491
+ assertRequest(args);
492
+ const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
493
+ const block = blockNumberHex || blockTag;
494
+ const rpcStateOverride = serializeStateOverride(stateOverride);
495
+ const chainFormat = (_d = (_c = (_b = client.chain) == null ? void 0 : _b.formatters) == null ? void 0 : _c.transactionRequest) == null ? void 0 : _d.format;
496
+ const format = chainFormat || formatTransactionRequest;
497
+ const request = format({
498
+ // Pick out extra data that might exist on the chain's transaction request type.
499
+ ...extract(rest, { format: chainFormat }),
500
+ from: account == null ? void 0 : account.address,
501
+ accessList,
502
+ blobs,
503
+ data,
504
+ gas,
505
+ gasPrice,
506
+ maxFeePerBlobGas,
507
+ maxFeePerGas,
508
+ maxPriorityFeePerGas,
509
+ nonce,
510
+ to: deploylessCall ? void 0 : to,
511
+ value
512
+ });
513
+ if (batch && shouldPerformMulticall({ request }) && !rpcStateOverride) {
514
+ try {
515
+ return await scheduleMulticall(client, {
516
+ ...request,
517
+ blockNumber,
518
+ blockTag
519
+ });
520
+ } catch (err) {
521
+ if (!(err instanceof ClientChainNotConfiguredError) && !(err instanceof ChainDoesNotSupportContract))
522
+ throw err;
523
+ }
524
+ }
525
+ const response = await client.request({
526
+ method: "eth_call",
527
+ params: rpcStateOverride ? [
528
+ request,
529
+ block,
530
+ rpcStateOverride
531
+ ] : [request, block]
532
+ });
533
+ if (response === "0x")
534
+ return { data: void 0 };
535
+ return { data: response };
536
+ } catch (err) {
537
+ const data2 = getRevertErrorData(err);
538
+ const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-JTEXJDV5.js");
539
+ if (client.ccipRead !== false && (data2 == null ? void 0 : data2.slice(0, 10)) === offchainLookupSignature2 && to)
540
+ return { data: await offchainLookup2(client, { data: data2, to }) };
541
+ if (deploylessCall && (data2 == null ? void 0 : data2.slice(0, 10)) === "0x101bb98d")
542
+ throw new CounterfactualDeploymentFailedError({ factory });
543
+ throw getCallError(err, {
544
+ ...args,
545
+ account,
546
+ chain: client.chain
547
+ });
548
+ }
549
+ }
550
+ function shouldPerformMulticall({ request }) {
551
+ const { data, to, ...request_ } = request;
552
+ if (!data)
553
+ return false;
554
+ if (data.startsWith(aggregate3Signature))
555
+ return false;
556
+ if (!to)
557
+ return false;
558
+ if (Object.values(request_).filter((x) => typeof x !== "undefined").length > 0)
559
+ return false;
560
+ return true;
561
+ }
562
+ async function scheduleMulticall(client, args) {
563
+ var _a;
564
+ const { batchSize = 1024, wait = 0 } = typeof ((_a = client.batch) == null ? void 0 : _a.multicall) === "object" ? client.batch.multicall : {};
565
+ const { blockNumber, blockTag = "latest", data, multicallAddress: multicallAddress_, to } = args;
566
+ let multicallAddress = multicallAddress_;
567
+ if (!multicallAddress) {
568
+ if (!client.chain)
569
+ throw new ClientChainNotConfiguredError();
570
+ multicallAddress = getChainContractAddress({
571
+ blockNumber,
572
+ chain: client.chain,
573
+ contract: "multicall3"
574
+ });
575
+ }
576
+ const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
577
+ const block = blockNumberHex || blockTag;
578
+ const { schedule } = createBatchScheduler({
579
+ id: `${client.uid}.${block}`,
580
+ wait,
581
+ shouldSplitBatch(args2) {
582
+ const size = args2.reduce((size2, { data: data2 }) => size2 + (data2.length - 2), 0);
583
+ return size > batchSize * 2;
584
+ },
585
+ fn: async (requests) => {
586
+ const calls = requests.map((request) => ({
587
+ allowFailure: true,
588
+ callData: request.data,
589
+ target: request.to
590
+ }));
591
+ const calldata = encodeFunctionData({
592
+ abi: multicall3Abi,
593
+ args: [calls],
594
+ functionName: "aggregate3"
595
+ });
596
+ const data2 = await client.request({
597
+ method: "eth_call",
598
+ params: [
599
+ {
600
+ data: calldata,
601
+ to: multicallAddress
602
+ },
603
+ block
604
+ ]
605
+ });
606
+ return decodeFunctionResult({
607
+ abi: multicall3Abi,
608
+ args: [calls],
609
+ functionName: "aggregate3",
610
+ data: data2 || "0x"
611
+ });
612
+ }
613
+ });
614
+ const [{ returnData, success }] = await schedule({ data, to });
615
+ if (!success)
616
+ throw new RawContractError({ data: returnData });
617
+ if (returnData === "0x")
618
+ return { data: void 0 };
619
+ return { data: returnData };
620
+ }
621
+ function toDeploylessCallViaBytecodeData(parameters) {
622
+ const { code, data } = parameters;
623
+ return encodeDeployData({
624
+ abi: parseAbi(["constructor(bytes, bytes)"]),
625
+ bytecode: deploylessCallViaBytecodeBytecode,
626
+ args: [code, data]
627
+ });
628
+ }
629
+ function toDeploylessCallViaFactoryData(parameters) {
630
+ const { data, factory, factoryData, to } = parameters;
631
+ return encodeDeployData({
632
+ abi: parseAbi(["constructor(address, bytes, address, bytes)"]),
633
+ bytecode: deploylessCallViaFactoryBytecode,
634
+ args: [to, data, factory, factoryData]
635
+ });
636
+ }
637
+ function getRevertErrorData(err) {
638
+ var _a;
639
+ if (!(err instanceof BaseError))
640
+ return void 0;
641
+ const error = err.walk();
642
+ return typeof (error == null ? void 0 : error.data) === "object" ? (_a = error.data) == null ? void 0 : _a.data : error.data;
643
+ }
644
+
645
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/errors/ccip.js
646
+ var OffchainLookupError = class extends BaseError {
647
+ constructor({ callbackSelector, cause, data, extraData, sender, urls }) {
648
+ var _a;
649
+ super(cause.shortMessage || "An error occurred while fetching for an offchain result.", {
650
+ cause,
651
+ metaMessages: [
652
+ ...cause.metaMessages || [],
653
+ ((_a = cause.metaMessages) == null ? void 0 : _a.length) ? "" : [],
654
+ "Offchain Gateway Call:",
655
+ urls && [
656
+ " Gateway URL(s):",
657
+ ...urls.map((url) => ` ${getUrl(url)}`)
658
+ ],
659
+ ` Sender: ${sender}`,
660
+ ` Data: ${data}`,
661
+ ` Callback selector: ${callbackSelector}`,
662
+ ` Extra data: ${extraData}`
663
+ ].flat(),
664
+ name: "OffchainLookupError"
665
+ });
666
+ }
667
+ };
668
+ var OffchainLookupResponseMalformedError = class extends BaseError {
669
+ constructor({ result, url }) {
670
+ super("Offchain gateway response is malformed. Response data must be a hex value.", {
671
+ metaMessages: [
672
+ `Gateway URL: ${getUrl(url)}`,
673
+ `Response: ${stringify(result)}`
674
+ ],
675
+ name: "OffchainLookupResponseMalformedError"
676
+ });
677
+ }
678
+ };
679
+ var OffchainLookupSenderMismatchError = class extends BaseError {
680
+ constructor({ sender, to }) {
681
+ super("Reverted sender address does not match target contract address (`to`).", {
682
+ metaMessages: [
683
+ `Contract address: ${to}`,
684
+ `OffchainLookup sender address: ${sender}`
685
+ ],
686
+ name: "OffchainLookupSenderMismatchError"
687
+ });
688
+ }
689
+ };
690
+
691
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/address/isAddressEqual.js
692
+ function isAddressEqual(a, b) {
693
+ if (!isAddress(a, { strict: false }))
694
+ throw new InvalidAddressError({ address: a });
695
+ if (!isAddress(b, { strict: false }))
696
+ throw new InvalidAddressError({ address: b });
697
+ return a.toLowerCase() === b.toLowerCase();
698
+ }
699
+
700
+ // ../../../../node_modules/.pnpm/viem@2.23.15_bufferutil@4.0.9_typescript@5.8.2_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/ccip.js
701
+ var offchainLookupSignature = "0x556f1830";
702
+ var offchainLookupAbiItem = {
703
+ name: "OffchainLookup",
704
+ type: "error",
705
+ inputs: [
706
+ {
707
+ name: "sender",
708
+ type: "address"
709
+ },
710
+ {
711
+ name: "urls",
712
+ type: "string[]"
713
+ },
714
+ {
715
+ name: "callData",
716
+ type: "bytes"
717
+ },
718
+ {
719
+ name: "callbackFunction",
720
+ type: "bytes4"
721
+ },
722
+ {
723
+ name: "extraData",
724
+ type: "bytes"
725
+ }
726
+ ]
727
+ };
728
+ async function offchainLookup(client, { blockNumber, blockTag, data, to }) {
729
+ const { args } = decodeErrorResult({
730
+ data,
731
+ abi: [offchainLookupAbiItem]
732
+ });
733
+ const [sender, urls, callData, callbackSelector, extraData] = args;
734
+ const { ccipRead } = client;
735
+ const ccipRequest_ = ccipRead && typeof (ccipRead == null ? void 0 : ccipRead.request) === "function" ? ccipRead.request : ccipRequest;
736
+ try {
737
+ if (!isAddressEqual(to, sender))
738
+ throw new OffchainLookupSenderMismatchError({ sender, to });
739
+ const result = await ccipRequest_({ data: callData, sender, urls });
740
+ const { data: data_ } = await call(client, {
741
+ blockNumber,
742
+ blockTag,
743
+ data: concat([
744
+ callbackSelector,
745
+ encodeAbiParameters([{ type: "bytes" }, { type: "bytes" }], [result, extraData])
746
+ ]),
747
+ to
748
+ });
749
+ return data_;
750
+ } catch (err) {
751
+ throw new OffchainLookupError({
752
+ callbackSelector,
753
+ cause: err,
754
+ data,
755
+ extraData,
756
+ sender,
757
+ urls
758
+ });
759
+ }
760
+ }
761
+ async function ccipRequest({ data, sender, urls }) {
762
+ var _a;
763
+ let error = new Error("An unknown error occurred.");
764
+ for (let i = 0; i < urls.length; i++) {
765
+ const url = urls[i];
766
+ const method = url.includes("{data}") ? "GET" : "POST";
767
+ const body = method === "POST" ? { data, sender } : void 0;
768
+ const headers = method === "POST" ? { "Content-Type": "application/json" } : {};
769
+ try {
770
+ const response = await fetch(url.replace("{sender}", sender.toLowerCase()).replace("{data}", data), {
771
+ body: JSON.stringify(body),
772
+ headers,
773
+ method
774
+ });
775
+ let result;
776
+ if ((_a = response.headers.get("Content-Type")) == null ? void 0 : _a.startsWith("application/json")) {
777
+ result = (await response.json()).data;
778
+ } else {
779
+ result = await response.text();
780
+ }
781
+ if (!response.ok) {
782
+ error = new HttpRequestError({
783
+ body,
784
+ details: (result == null ? void 0 : result.error) ? stringify(result.error) : response.statusText,
785
+ headers: response.headers,
786
+ status: response.status,
787
+ url
788
+ });
789
+ continue;
790
+ }
791
+ if (!isHex(result)) {
792
+ error = new OffchainLookupResponseMalformedError({
793
+ result,
794
+ url
795
+ });
796
+ continue;
797
+ }
798
+ return result;
799
+ } catch (err) {
800
+ error = new HttpRequestError({
801
+ body,
802
+ details: err.message,
803
+ url
804
+ });
805
+ }
806
+ }
807
+ throw error;
808
+ }
809
+
810
+ export {
811
+ encodeDeployData,
812
+ serializeStateOverride,
813
+ multicall3Abi,
814
+ universalResolverResolveAbi,
815
+ universalResolverReverseAbi,
816
+ textResolverAbi,
817
+ addressResolverAbi,
818
+ universalSignatureValidatorAbi,
819
+ decodeFunctionResult,
820
+ encodeFunctionData,
821
+ deploylessCallViaBytecodeBytecode,
822
+ universalSignatureValidatorByteCode,
823
+ withResolvers,
824
+ createBatchScheduler,
825
+ isAddressEqual,
826
+ offchainLookupSignature,
827
+ offchainLookupAbiItem,
828
+ offchainLookup,
829
+ ccipRequest,
830
+ call
831
+ };
832
+ //# sourceMappingURL=chunk-Q3UTC4SW.js.map