@farcaster/create-mini-app 0.0.7 → 0.1.0
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.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +17 -0
- package/README.md +2 -2
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +20 -2
- package/dist/init.js.map +1 -1
- package/init.ts +22 -2
- package/package.json +7 -2
- package/templates/default/README.md +23 -1
- package/templates/default/package.json +1 -1
- package/asd/README.md +0 -1
- package/asd/biome.json +0 -13
- package/asd/index.html +0 -12
- package/asd/package.json +0 -30
- package/asd/public/.well-known/farcaster.json +0 -1
- package/asd/src/App.tsx +0 -67
- package/asd/src/index.css +0 -21
- package/asd/src/main.tsx +0 -21
- package/asd/src/vite-env.d.ts +0 -1
- package/asd/src/wagmi.ts +0 -18
- package/asd/tsconfig.json +0 -25
- package/asd/tsconfig.node.json +0 -10
- package/asd/vite.config.ts +0 -10
- package/templates/default/node_modules/.bin/biome +0 -17
- package/templates/default/node_modules/.bin/browserslist +0 -17
- package/templates/default/node_modules/.bin/esbuild +0 -17
- package/templates/default/node_modules/.bin/terser +0 -17
- package/templates/default/node_modules/.bin/tsc +0 -17
- package/templates/default/node_modules/.bin/tsserver +0 -17
- package/templates/default/node_modules/.bin/vite +0 -17
- package/templates/default/node_modules/.bin/wagmi +0 -17
- package/templates/default/node_modules/.vite/deps/@farcaster_frame-sdk.js +0 -84
- package/templates/default/node_modules/.vite/deps/@farcaster_frame-sdk.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/@farcaster_frame-wagmi-connector.js +0 -1936
- package/templates/default/node_modules/.vite/deps/@farcaster_frame-wagmi-connector.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/@tanstack_react-query.js +0 -96
- package/templates/default/node_modules/.vite/deps/@tanstack_react-query.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/_metadata.json +0 -139
- package/templates/default/node_modules/.vite/deps/ccip-JTEXJDV5.js +0 -17
- package/templates/default/node_modules/.vite/deps/ccip-JTEXJDV5.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/ccip-LLOJAQYN.js +0 -14
- package/templates/default/node_modules/.vite/deps/ccip-LLOJAQYN.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-2KW72IQL.js +0 -2601
- package/templates/default/node_modules/.vite/deps/chunk-2KW72IQL.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-2ULAEEW3.js +0 -286
- package/templates/default/node_modules/.vite/deps/chunk-2ULAEEW3.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-3MMZATWV.js +0 -1906
- package/templates/default/node_modules/.vite/deps/chunk-3MMZATWV.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-6WYSWNQJ.js +0 -3183
- package/templates/default/node_modules/.vite/deps/chunk-6WYSWNQJ.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-AJPHOYQK.js +0 -21628
- package/templates/default/node_modules/.vite/deps/chunk-AJPHOYQK.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-HP7M7ER3.js +0 -2221
- package/templates/default/node_modules/.vite/deps/chunk-HP7M7ER3.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-JDAHWTZP.js +0 -928
- package/templates/default/node_modules/.vite/deps/chunk-JDAHWTZP.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-OOB7NECH.js +0 -58
- package/templates/default/node_modules/.vite/deps/chunk-OOB7NECH.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-OYL52S4H.js +0 -190
- package/templates/default/node_modules/.vite/deps/chunk-OYL52S4H.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-P2SCV6N5.js +0 -1085
- package/templates/default/node_modules/.vite/deps/chunk-P2SCV6N5.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-P727YSDY.js +0 -3246
- package/templates/default/node_modules/.vite/deps/chunk-P727YSDY.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-PH77EFIP.js +0 -278
- package/templates/default/node_modules/.vite/deps/chunk-PH77EFIP.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-PK65EOOR.js +0 -4416
- package/templates/default/node_modules/.vite/deps/chunk-PK65EOOR.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-PPRY4ZGR.js +0 -36187
- package/templates/default/node_modules/.vite/deps/chunk-PPRY4ZGR.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-Q3UTC4SW.js +0 -832
- package/templates/default/node_modules/.vite/deps/chunk-Q3UTC4SW.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-R2PSY44V.js +0 -815
- package/templates/default/node_modules/.vite/deps/chunk-R2PSY44V.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-WOOG5QLI.js +0 -60
- package/templates/default/node_modules/.vite/deps/chunk-WOOG5QLI.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/native-J7PVLWWX.js +0 -21
- package/templates/default/node_modules/.vite/deps/native-J7PVLWWX.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/native-UTGEKOTD.js +0 -21
- package/templates/default/node_modules/.vite/deps/native-UTGEKOTD.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/package.json +0 -3
- package/templates/default/node_modules/.vite/deps/react-dom.js +0 -7
- package/templates/default/node_modules/.vite/deps/react-dom.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/react-dom_client.js +0 -39
- package/templates/default/node_modules/.vite/deps/react-dom_client.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/react.js +0 -6
- package/templates/default/node_modules/.vite/deps/react.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/react_jsx-dev-runtime.js +0 -913
- package/templates/default/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/react_jsx-runtime.js +0 -7
- package/templates/default/node_modules/.vite/deps/react_jsx-runtime.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/secp256k1-HB6OVCEM.js +0 -14
- package/templates/default/node_modules/.vite/deps/secp256k1-HB6OVCEM.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/secp256k1-YI5SRKAE.js +0 -16
- package/templates/default/node_modules/.vite/deps/secp256k1-YI5SRKAE.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/wagmi.js +0 -12147
- package/templates/default/node_modules/.vite/deps/wagmi.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/wagmi_chains.js +0 -16355
- package/templates/default/node_modules/.vite/deps/wagmi_chains.js.map +0 -7
|
@@ -1,815 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseError,
|
|
3
|
-
ChainMismatchError,
|
|
4
|
-
ChainNotFoundError,
|
|
5
|
-
FeeCapTooHighError,
|
|
6
|
-
InvalidAddressError,
|
|
7
|
-
InvalidChainIdError,
|
|
8
|
-
InvalidLegacyVError,
|
|
9
|
-
InvalidSerializableTransactionError,
|
|
10
|
-
InvalidStorageKeySizeError,
|
|
11
|
-
TipAboveFeeCapError,
|
|
12
|
-
bytesToHex,
|
|
13
|
-
concatHex,
|
|
14
|
-
createCursor,
|
|
15
|
-
defineFormatter,
|
|
16
|
-
hexToBytes,
|
|
17
|
-
hexToNumber,
|
|
18
|
-
isAddress,
|
|
19
|
-
isHex,
|
|
20
|
-
maxUint256,
|
|
21
|
-
numberToHex,
|
|
22
|
-
size,
|
|
23
|
-
slice,
|
|
24
|
-
toBytes,
|
|
25
|
-
toHex,
|
|
26
|
-
trim
|
|
27
|
-
} from "./chunk-P727YSDY.js";
|
|
28
|
-
import {
|
|
29
|
-
sha256
|
|
30
|
-
} from "./chunk-2ULAEEW3.js";
|
|
31
|
-
|
|
32
|
-
// ../../../../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/encoding/toRlp.js
|
|
33
|
-
function toRlp(bytes, to = "hex") {
|
|
34
|
-
const encodable = getEncodable(bytes);
|
|
35
|
-
const cursor = createCursor(new Uint8Array(encodable.length));
|
|
36
|
-
encodable.encode(cursor);
|
|
37
|
-
if (to === "hex")
|
|
38
|
-
return bytesToHex(cursor.bytes);
|
|
39
|
-
return cursor.bytes;
|
|
40
|
-
}
|
|
41
|
-
function getEncodable(bytes) {
|
|
42
|
-
if (Array.isArray(bytes))
|
|
43
|
-
return getEncodableList(bytes.map((x) => getEncodable(x)));
|
|
44
|
-
return getEncodableBytes(bytes);
|
|
45
|
-
}
|
|
46
|
-
function getEncodableList(list) {
|
|
47
|
-
const bodyLength = list.reduce((acc, x) => acc + x.length, 0);
|
|
48
|
-
const sizeOfBodyLength = getSizeOfLength(bodyLength);
|
|
49
|
-
const length = (() => {
|
|
50
|
-
if (bodyLength <= 55)
|
|
51
|
-
return 1 + bodyLength;
|
|
52
|
-
return 1 + sizeOfBodyLength + bodyLength;
|
|
53
|
-
})();
|
|
54
|
-
return {
|
|
55
|
-
length,
|
|
56
|
-
encode(cursor) {
|
|
57
|
-
if (bodyLength <= 55) {
|
|
58
|
-
cursor.pushByte(192 + bodyLength);
|
|
59
|
-
} else {
|
|
60
|
-
cursor.pushByte(192 + 55 + sizeOfBodyLength);
|
|
61
|
-
if (sizeOfBodyLength === 1)
|
|
62
|
-
cursor.pushUint8(bodyLength);
|
|
63
|
-
else if (sizeOfBodyLength === 2)
|
|
64
|
-
cursor.pushUint16(bodyLength);
|
|
65
|
-
else if (sizeOfBodyLength === 3)
|
|
66
|
-
cursor.pushUint24(bodyLength);
|
|
67
|
-
else
|
|
68
|
-
cursor.pushUint32(bodyLength);
|
|
69
|
-
}
|
|
70
|
-
for (const { encode } of list) {
|
|
71
|
-
encode(cursor);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function getEncodableBytes(bytesOrHex) {
|
|
77
|
-
const bytes = typeof bytesOrHex === "string" ? hexToBytes(bytesOrHex) : bytesOrHex;
|
|
78
|
-
const sizeOfBytesLength = getSizeOfLength(bytes.length);
|
|
79
|
-
const length = (() => {
|
|
80
|
-
if (bytes.length === 1 && bytes[0] < 128)
|
|
81
|
-
return 1;
|
|
82
|
-
if (bytes.length <= 55)
|
|
83
|
-
return 1 + bytes.length;
|
|
84
|
-
return 1 + sizeOfBytesLength + bytes.length;
|
|
85
|
-
})();
|
|
86
|
-
return {
|
|
87
|
-
length,
|
|
88
|
-
encode(cursor) {
|
|
89
|
-
if (bytes.length === 1 && bytes[0] < 128) {
|
|
90
|
-
cursor.pushBytes(bytes);
|
|
91
|
-
} else if (bytes.length <= 55) {
|
|
92
|
-
cursor.pushByte(128 + bytes.length);
|
|
93
|
-
cursor.pushBytes(bytes);
|
|
94
|
-
} else {
|
|
95
|
-
cursor.pushByte(128 + 55 + sizeOfBytesLength);
|
|
96
|
-
if (sizeOfBytesLength === 1)
|
|
97
|
-
cursor.pushUint8(bytes.length);
|
|
98
|
-
else if (sizeOfBytesLength === 2)
|
|
99
|
-
cursor.pushUint16(bytes.length);
|
|
100
|
-
else if (sizeOfBytesLength === 3)
|
|
101
|
-
cursor.pushUint24(bytes.length);
|
|
102
|
-
else
|
|
103
|
-
cursor.pushUint32(bytes.length);
|
|
104
|
-
cursor.pushBytes(bytes);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function getSizeOfLength(length) {
|
|
110
|
-
if (length < 2 ** 8)
|
|
111
|
-
return 1;
|
|
112
|
-
if (length < 2 ** 16)
|
|
113
|
-
return 2;
|
|
114
|
-
if (length < 2 ** 24)
|
|
115
|
-
return 3;
|
|
116
|
-
if (length < 2 ** 32)
|
|
117
|
-
return 4;
|
|
118
|
-
throw new BaseError("Length is too large.");
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// ../../../../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/chain/assertCurrentChain.js
|
|
122
|
-
function assertCurrentChain({ chain, currentChainId }) {
|
|
123
|
-
if (!chain)
|
|
124
|
-
throw new ChainNotFoundError();
|
|
125
|
-
if (currentChainId !== chain.id)
|
|
126
|
-
throw new ChainMismatchError({ chain, currentChainId });
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// ../../../../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/formatters/transaction.js
|
|
130
|
-
var transactionType = {
|
|
131
|
-
"0x0": "legacy",
|
|
132
|
-
"0x1": "eip2930",
|
|
133
|
-
"0x2": "eip1559",
|
|
134
|
-
"0x3": "eip4844",
|
|
135
|
-
"0x4": "eip7702"
|
|
136
|
-
};
|
|
137
|
-
function formatTransaction(transaction) {
|
|
138
|
-
const transaction_ = {
|
|
139
|
-
...transaction,
|
|
140
|
-
blockHash: transaction.blockHash ? transaction.blockHash : null,
|
|
141
|
-
blockNumber: transaction.blockNumber ? BigInt(transaction.blockNumber) : null,
|
|
142
|
-
chainId: transaction.chainId ? hexToNumber(transaction.chainId) : void 0,
|
|
143
|
-
gas: transaction.gas ? BigInt(transaction.gas) : void 0,
|
|
144
|
-
gasPrice: transaction.gasPrice ? BigInt(transaction.gasPrice) : void 0,
|
|
145
|
-
maxFeePerBlobGas: transaction.maxFeePerBlobGas ? BigInt(transaction.maxFeePerBlobGas) : void 0,
|
|
146
|
-
maxFeePerGas: transaction.maxFeePerGas ? BigInt(transaction.maxFeePerGas) : void 0,
|
|
147
|
-
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas ? BigInt(transaction.maxPriorityFeePerGas) : void 0,
|
|
148
|
-
nonce: transaction.nonce ? hexToNumber(transaction.nonce) : void 0,
|
|
149
|
-
to: transaction.to ? transaction.to : null,
|
|
150
|
-
transactionIndex: transaction.transactionIndex ? Number(transaction.transactionIndex) : null,
|
|
151
|
-
type: transaction.type ? transactionType[transaction.type] : void 0,
|
|
152
|
-
typeHex: transaction.type ? transaction.type : void 0,
|
|
153
|
-
value: transaction.value ? BigInt(transaction.value) : void 0,
|
|
154
|
-
v: transaction.v ? BigInt(transaction.v) : void 0
|
|
155
|
-
};
|
|
156
|
-
if (transaction.authorizationList)
|
|
157
|
-
transaction_.authorizationList = formatAuthorizationList(transaction.authorizationList);
|
|
158
|
-
transaction_.yParity = (() => {
|
|
159
|
-
if (transaction.yParity)
|
|
160
|
-
return Number(transaction.yParity);
|
|
161
|
-
if (typeof transaction_.v === "bigint") {
|
|
162
|
-
if (transaction_.v === 0n || transaction_.v === 27n)
|
|
163
|
-
return 0;
|
|
164
|
-
if (transaction_.v === 1n || transaction_.v === 28n)
|
|
165
|
-
return 1;
|
|
166
|
-
if (transaction_.v >= 35n)
|
|
167
|
-
return transaction_.v % 2n === 0n ? 1 : 0;
|
|
168
|
-
}
|
|
169
|
-
return void 0;
|
|
170
|
-
})();
|
|
171
|
-
if (transaction_.type === "legacy") {
|
|
172
|
-
delete transaction_.accessList;
|
|
173
|
-
delete transaction_.maxFeePerBlobGas;
|
|
174
|
-
delete transaction_.maxFeePerGas;
|
|
175
|
-
delete transaction_.maxPriorityFeePerGas;
|
|
176
|
-
delete transaction_.yParity;
|
|
177
|
-
}
|
|
178
|
-
if (transaction_.type === "eip2930") {
|
|
179
|
-
delete transaction_.maxFeePerBlobGas;
|
|
180
|
-
delete transaction_.maxFeePerGas;
|
|
181
|
-
delete transaction_.maxPriorityFeePerGas;
|
|
182
|
-
}
|
|
183
|
-
if (transaction_.type === "eip1559") {
|
|
184
|
-
delete transaction_.maxFeePerBlobGas;
|
|
185
|
-
}
|
|
186
|
-
return transaction_;
|
|
187
|
-
}
|
|
188
|
-
var defineTransaction = defineFormatter("transaction", formatTransaction);
|
|
189
|
-
function formatAuthorizationList(authorizationList) {
|
|
190
|
-
return authorizationList.map((authorization) => ({
|
|
191
|
-
contractAddress: authorization.address,
|
|
192
|
-
chainId: Number(authorization.chainId),
|
|
193
|
-
nonce: Number(authorization.nonce),
|
|
194
|
-
r: authorization.r,
|
|
195
|
-
s: authorization.s,
|
|
196
|
-
yParity: Number(authorization.yParity)
|
|
197
|
-
}));
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// ../../../../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/formatters/block.js
|
|
201
|
-
function formatBlock(block) {
|
|
202
|
-
const transactions = (block.transactions ?? []).map((transaction) => {
|
|
203
|
-
if (typeof transaction === "string")
|
|
204
|
-
return transaction;
|
|
205
|
-
return formatTransaction(transaction);
|
|
206
|
-
});
|
|
207
|
-
return {
|
|
208
|
-
...block,
|
|
209
|
-
baseFeePerGas: block.baseFeePerGas ? BigInt(block.baseFeePerGas) : null,
|
|
210
|
-
blobGasUsed: block.blobGasUsed ? BigInt(block.blobGasUsed) : void 0,
|
|
211
|
-
difficulty: block.difficulty ? BigInt(block.difficulty) : void 0,
|
|
212
|
-
excessBlobGas: block.excessBlobGas ? BigInt(block.excessBlobGas) : void 0,
|
|
213
|
-
gasLimit: block.gasLimit ? BigInt(block.gasLimit) : void 0,
|
|
214
|
-
gasUsed: block.gasUsed ? BigInt(block.gasUsed) : void 0,
|
|
215
|
-
hash: block.hash ? block.hash : null,
|
|
216
|
-
logsBloom: block.logsBloom ? block.logsBloom : null,
|
|
217
|
-
nonce: block.nonce ? block.nonce : null,
|
|
218
|
-
number: block.number ? BigInt(block.number) : null,
|
|
219
|
-
size: block.size ? BigInt(block.size) : void 0,
|
|
220
|
-
timestamp: block.timestamp ? BigInt(block.timestamp) : void 0,
|
|
221
|
-
transactions,
|
|
222
|
-
totalDifficulty: block.totalDifficulty ? BigInt(block.totalDifficulty) : null
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
var defineBlock = defineFormatter("block", formatBlock);
|
|
226
|
-
|
|
227
|
-
// ../../../../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/blob/blobsToCommitments.js
|
|
228
|
-
function blobsToCommitments(parameters) {
|
|
229
|
-
const { kzg } = parameters;
|
|
230
|
-
const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
|
|
231
|
-
const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
|
|
232
|
-
const commitments = [];
|
|
233
|
-
for (const blob of blobs)
|
|
234
|
-
commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob)));
|
|
235
|
-
return to === "bytes" ? commitments : commitments.map((x) => bytesToHex(x));
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// ../../../../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/blob/blobsToProofs.js
|
|
239
|
-
function blobsToProofs(parameters) {
|
|
240
|
-
const { kzg } = parameters;
|
|
241
|
-
const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
|
|
242
|
-
const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
|
|
243
|
-
const commitments = typeof parameters.commitments[0] === "string" ? parameters.commitments.map((x) => hexToBytes(x)) : parameters.commitments;
|
|
244
|
-
const proofs = [];
|
|
245
|
-
for (let i = 0; i < blobs.length; i++) {
|
|
246
|
-
const blob = blobs[i];
|
|
247
|
-
const commitment = commitments[i];
|
|
248
|
-
proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment)));
|
|
249
|
-
}
|
|
250
|
-
return to === "bytes" ? proofs : proofs.map((x) => bytesToHex(x));
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// ../../../../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/hash/sha256.js
|
|
254
|
-
function sha2562(value, to_) {
|
|
255
|
-
const to = to_ || "hex";
|
|
256
|
-
const bytes = sha256(isHex(value, { strict: false }) ? toBytes(value) : value);
|
|
257
|
-
if (to === "bytes")
|
|
258
|
-
return bytes;
|
|
259
|
-
return toHex(bytes);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// ../../../../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/blob/commitmentToVersionedHash.js
|
|
263
|
-
function commitmentToVersionedHash(parameters) {
|
|
264
|
-
const { commitment, version = 1 } = parameters;
|
|
265
|
-
const to = parameters.to ?? (typeof commitment === "string" ? "hex" : "bytes");
|
|
266
|
-
const versionedHash = sha2562(commitment, "bytes");
|
|
267
|
-
versionedHash.set([version], 0);
|
|
268
|
-
return to === "bytes" ? versionedHash : bytesToHex(versionedHash);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// ../../../../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/blob/commitmentsToVersionedHashes.js
|
|
272
|
-
function commitmentsToVersionedHashes(parameters) {
|
|
273
|
-
const { commitments, version } = parameters;
|
|
274
|
-
const to = parameters.to ?? (typeof commitments[0] === "string" ? "hex" : "bytes");
|
|
275
|
-
const hashes = [];
|
|
276
|
-
for (const commitment of commitments) {
|
|
277
|
-
hashes.push(commitmentToVersionedHash({
|
|
278
|
-
commitment,
|
|
279
|
-
to,
|
|
280
|
-
version
|
|
281
|
-
}));
|
|
282
|
-
}
|
|
283
|
-
return hashes;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// ../../../../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/blob.js
|
|
287
|
-
var blobsPerTransaction = 6;
|
|
288
|
-
var bytesPerFieldElement = 32;
|
|
289
|
-
var fieldElementsPerBlob = 4096;
|
|
290
|
-
var bytesPerBlob = bytesPerFieldElement * fieldElementsPerBlob;
|
|
291
|
-
var maxBytesPerTransaction = bytesPerBlob * blobsPerTransaction - // terminator byte (0x80).
|
|
292
|
-
1 - // zero byte (0x00) appended to each field element.
|
|
293
|
-
1 * fieldElementsPerBlob * blobsPerTransaction;
|
|
294
|
-
|
|
295
|
-
// ../../../../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/kzg.js
|
|
296
|
-
var versionedHashVersionKzg = 1;
|
|
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/errors/blob.js
|
|
299
|
-
var BlobSizeTooLargeError = class extends BaseError {
|
|
300
|
-
constructor({ maxSize, size: size2 }) {
|
|
301
|
-
super("Blob size is too large.", {
|
|
302
|
-
metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size2} bytes`],
|
|
303
|
-
name: "BlobSizeTooLargeError"
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
var EmptyBlobError = class extends BaseError {
|
|
308
|
-
constructor() {
|
|
309
|
-
super("Blob data must not be empty.", { name: "EmptyBlobError" });
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
var InvalidVersionedHashSizeError = class extends BaseError {
|
|
313
|
-
constructor({ hash, size: size2 }) {
|
|
314
|
-
super(`Versioned hash "${hash}" size is invalid.`, {
|
|
315
|
-
metaMessages: ["Expected: 32", `Received: ${size2}`],
|
|
316
|
-
name: "InvalidVersionedHashSizeError"
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
var InvalidVersionedHashVersionError = class extends BaseError {
|
|
321
|
-
constructor({ hash, version }) {
|
|
322
|
-
super(`Versioned hash "${hash}" version is invalid.`, {
|
|
323
|
-
metaMessages: [
|
|
324
|
-
`Expected: ${versionedHashVersionKzg}`,
|
|
325
|
-
`Received: ${version}`
|
|
326
|
-
],
|
|
327
|
-
name: "InvalidVersionedHashVersionError"
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
// ../../../../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/blob/toBlobs.js
|
|
333
|
-
function toBlobs(parameters) {
|
|
334
|
-
const to = parameters.to ?? (typeof parameters.data === "string" ? "hex" : "bytes");
|
|
335
|
-
const data = typeof parameters.data === "string" ? hexToBytes(parameters.data) : parameters.data;
|
|
336
|
-
const size_ = size(data);
|
|
337
|
-
if (!size_)
|
|
338
|
-
throw new EmptyBlobError();
|
|
339
|
-
if (size_ > maxBytesPerTransaction)
|
|
340
|
-
throw new BlobSizeTooLargeError({
|
|
341
|
-
maxSize: maxBytesPerTransaction,
|
|
342
|
-
size: size_
|
|
343
|
-
});
|
|
344
|
-
const blobs = [];
|
|
345
|
-
let active = true;
|
|
346
|
-
let position = 0;
|
|
347
|
-
while (active) {
|
|
348
|
-
const blob = createCursor(new Uint8Array(bytesPerBlob));
|
|
349
|
-
let size2 = 0;
|
|
350
|
-
while (size2 < fieldElementsPerBlob) {
|
|
351
|
-
const bytes = data.slice(position, position + (bytesPerFieldElement - 1));
|
|
352
|
-
blob.pushByte(0);
|
|
353
|
-
blob.pushBytes(bytes);
|
|
354
|
-
if (bytes.length < 31) {
|
|
355
|
-
blob.pushByte(128);
|
|
356
|
-
active = false;
|
|
357
|
-
break;
|
|
358
|
-
}
|
|
359
|
-
size2++;
|
|
360
|
-
position += 31;
|
|
361
|
-
}
|
|
362
|
-
blobs.push(blob);
|
|
363
|
-
}
|
|
364
|
-
return to === "bytes" ? blobs.map((x) => x.bytes) : blobs.map((x) => bytesToHex(x.bytes));
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// ../../../../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/blob/toBlobSidecars.js
|
|
368
|
-
function toBlobSidecars(parameters) {
|
|
369
|
-
const { data, kzg, to } = parameters;
|
|
370
|
-
const blobs = parameters.blobs ?? toBlobs({ data, to });
|
|
371
|
-
const commitments = parameters.commitments ?? blobsToCommitments({ blobs, kzg, to });
|
|
372
|
-
const proofs = parameters.proofs ?? blobsToProofs({ blobs, commitments, kzg, to });
|
|
373
|
-
const sidecars = [];
|
|
374
|
-
for (let i = 0; i < blobs.length; i++)
|
|
375
|
-
sidecars.push({
|
|
376
|
-
blob: blobs[i],
|
|
377
|
-
commitment: commitments[i],
|
|
378
|
-
proof: proofs[i]
|
|
379
|
-
});
|
|
380
|
-
return sidecars;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// ../../../../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/transaction/getTransactionType.js
|
|
384
|
-
function getTransactionType(transaction) {
|
|
385
|
-
if (transaction.type)
|
|
386
|
-
return transaction.type;
|
|
387
|
-
if (typeof transaction.authorizationList !== "undefined")
|
|
388
|
-
return "eip7702";
|
|
389
|
-
if (typeof transaction.blobs !== "undefined" || typeof transaction.blobVersionedHashes !== "undefined" || typeof transaction.maxFeePerBlobGas !== "undefined" || typeof transaction.sidecars !== "undefined")
|
|
390
|
-
return "eip4844";
|
|
391
|
-
if (typeof transaction.maxFeePerGas !== "undefined" || typeof transaction.maxPriorityFeePerGas !== "undefined") {
|
|
392
|
-
return "eip1559";
|
|
393
|
-
}
|
|
394
|
-
if (typeof transaction.gasPrice !== "undefined") {
|
|
395
|
-
if (typeof transaction.accessList !== "undefined")
|
|
396
|
-
return "eip2930";
|
|
397
|
-
return "legacy";
|
|
398
|
-
}
|
|
399
|
-
throw new InvalidSerializableTransactionError({ transaction });
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
// ../../../../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/formatters/log.js
|
|
403
|
-
function formatLog(log, { args, eventName } = {}) {
|
|
404
|
-
return {
|
|
405
|
-
...log,
|
|
406
|
-
blockHash: log.blockHash ? log.blockHash : null,
|
|
407
|
-
blockNumber: log.blockNumber ? BigInt(log.blockNumber) : null,
|
|
408
|
-
logIndex: log.logIndex ? Number(log.logIndex) : null,
|
|
409
|
-
transactionHash: log.transactionHash ? log.transactionHash : null,
|
|
410
|
-
transactionIndex: log.transactionIndex ? Number(log.transactionIndex) : null,
|
|
411
|
-
...eventName ? { args, eventName } : {}
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// ../../../../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/formatters/transactionReceipt.js
|
|
416
|
-
var receiptStatuses = {
|
|
417
|
-
"0x0": "reverted",
|
|
418
|
-
"0x1": "success"
|
|
419
|
-
};
|
|
420
|
-
function formatTransactionReceipt(transactionReceipt) {
|
|
421
|
-
const receipt = {
|
|
422
|
-
...transactionReceipt,
|
|
423
|
-
blockNumber: transactionReceipt.blockNumber ? BigInt(transactionReceipt.blockNumber) : null,
|
|
424
|
-
contractAddress: transactionReceipt.contractAddress ? transactionReceipt.contractAddress : null,
|
|
425
|
-
cumulativeGasUsed: transactionReceipt.cumulativeGasUsed ? BigInt(transactionReceipt.cumulativeGasUsed) : null,
|
|
426
|
-
effectiveGasPrice: transactionReceipt.effectiveGasPrice ? BigInt(transactionReceipt.effectiveGasPrice) : null,
|
|
427
|
-
gasUsed: transactionReceipt.gasUsed ? BigInt(transactionReceipt.gasUsed) : null,
|
|
428
|
-
logs: transactionReceipt.logs ? transactionReceipt.logs.map((log) => formatLog(log)) : null,
|
|
429
|
-
to: transactionReceipt.to ? transactionReceipt.to : null,
|
|
430
|
-
transactionIndex: transactionReceipt.transactionIndex ? hexToNumber(transactionReceipt.transactionIndex) : null,
|
|
431
|
-
status: transactionReceipt.status ? receiptStatuses[transactionReceipt.status] : null,
|
|
432
|
-
type: transactionReceipt.type ? transactionType[transactionReceipt.type] || transactionReceipt.type : null
|
|
433
|
-
};
|
|
434
|
-
if (transactionReceipt.blobGasPrice)
|
|
435
|
-
receipt.blobGasPrice = BigInt(transactionReceipt.blobGasPrice);
|
|
436
|
-
if (transactionReceipt.blobGasUsed)
|
|
437
|
-
receipt.blobGasUsed = BigInt(transactionReceipt.blobGasUsed);
|
|
438
|
-
return receipt;
|
|
439
|
-
}
|
|
440
|
-
var defineTransactionReceipt = defineFormatter("transactionReceipt", formatTransactionReceipt);
|
|
441
|
-
|
|
442
|
-
// ../../../../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/chain/defineChain.js
|
|
443
|
-
function defineChain(chain) {
|
|
444
|
-
return {
|
|
445
|
-
formatters: void 0,
|
|
446
|
-
fees: void 0,
|
|
447
|
-
serializers: void 0,
|
|
448
|
-
...chain
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// ../../../../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/transaction/assertTransaction.js
|
|
453
|
-
function assertTransactionEIP7702(transaction) {
|
|
454
|
-
const { authorizationList } = transaction;
|
|
455
|
-
if (authorizationList) {
|
|
456
|
-
for (const authorization of authorizationList) {
|
|
457
|
-
const { contractAddress, chainId } = authorization;
|
|
458
|
-
if (!isAddress(contractAddress))
|
|
459
|
-
throw new InvalidAddressError({ address: contractAddress });
|
|
460
|
-
if (chainId < 0)
|
|
461
|
-
throw new InvalidChainIdError({ chainId });
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
assertTransactionEIP1559(transaction);
|
|
465
|
-
}
|
|
466
|
-
function assertTransactionEIP4844(transaction) {
|
|
467
|
-
const { blobVersionedHashes } = transaction;
|
|
468
|
-
if (blobVersionedHashes) {
|
|
469
|
-
if (blobVersionedHashes.length === 0)
|
|
470
|
-
throw new EmptyBlobError();
|
|
471
|
-
for (const hash of blobVersionedHashes) {
|
|
472
|
-
const size_ = size(hash);
|
|
473
|
-
const version = hexToNumber(slice(hash, 0, 1));
|
|
474
|
-
if (size_ !== 32)
|
|
475
|
-
throw new InvalidVersionedHashSizeError({ hash, size: size_ });
|
|
476
|
-
if (version !== versionedHashVersionKzg)
|
|
477
|
-
throw new InvalidVersionedHashVersionError({
|
|
478
|
-
hash,
|
|
479
|
-
version
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
assertTransactionEIP1559(transaction);
|
|
484
|
-
}
|
|
485
|
-
function assertTransactionEIP1559(transaction) {
|
|
486
|
-
const { chainId, maxPriorityFeePerGas, maxFeePerGas, to } = transaction;
|
|
487
|
-
if (chainId <= 0)
|
|
488
|
-
throw new InvalidChainIdError({ chainId });
|
|
489
|
-
if (to && !isAddress(to))
|
|
490
|
-
throw new InvalidAddressError({ address: to });
|
|
491
|
-
if (maxFeePerGas && maxFeePerGas > maxUint256)
|
|
492
|
-
throw new FeeCapTooHighError({ maxFeePerGas });
|
|
493
|
-
if (maxPriorityFeePerGas && maxFeePerGas && maxPriorityFeePerGas > maxFeePerGas)
|
|
494
|
-
throw new TipAboveFeeCapError({ maxFeePerGas, maxPriorityFeePerGas });
|
|
495
|
-
}
|
|
496
|
-
function assertTransactionEIP2930(transaction) {
|
|
497
|
-
const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;
|
|
498
|
-
if (chainId <= 0)
|
|
499
|
-
throw new InvalidChainIdError({ chainId });
|
|
500
|
-
if (to && !isAddress(to))
|
|
501
|
-
throw new InvalidAddressError({ address: to });
|
|
502
|
-
if (maxPriorityFeePerGas || maxFeePerGas)
|
|
503
|
-
throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
|
|
504
|
-
if (gasPrice && gasPrice > maxUint256)
|
|
505
|
-
throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
|
|
506
|
-
}
|
|
507
|
-
function assertTransactionLegacy(transaction) {
|
|
508
|
-
const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;
|
|
509
|
-
if (to && !isAddress(to))
|
|
510
|
-
throw new InvalidAddressError({ address: to });
|
|
511
|
-
if (typeof chainId !== "undefined" && chainId <= 0)
|
|
512
|
-
throw new InvalidChainIdError({ chainId });
|
|
513
|
-
if (maxPriorityFeePerGas || maxFeePerGas)
|
|
514
|
-
throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
|
|
515
|
-
if (gasPrice && gasPrice > maxUint256)
|
|
516
|
-
throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
// ../../../../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/transaction/serializeAccessList.js
|
|
520
|
-
function serializeAccessList(accessList) {
|
|
521
|
-
if (!accessList || accessList.length === 0)
|
|
522
|
-
return [];
|
|
523
|
-
const serializedAccessList = [];
|
|
524
|
-
for (let i = 0; i < accessList.length; i++) {
|
|
525
|
-
const { address, storageKeys } = accessList[i];
|
|
526
|
-
for (let j = 0; j < storageKeys.length; j++) {
|
|
527
|
-
if (storageKeys[j].length - 2 !== 64) {
|
|
528
|
-
throw new InvalidStorageKeySizeError({ storageKey: storageKeys[j] });
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
if (!isAddress(address, { strict: false })) {
|
|
532
|
-
throw new InvalidAddressError({ address });
|
|
533
|
-
}
|
|
534
|
-
serializedAccessList.push([address, storageKeys]);
|
|
535
|
-
}
|
|
536
|
-
return serializedAccessList;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
// ../../../../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/experimental/eip7702/utils/serializeAuthorizationList.js
|
|
540
|
-
function serializeAuthorizationList(authorizationList) {
|
|
541
|
-
if (!authorizationList || authorizationList.length === 0)
|
|
542
|
-
return [];
|
|
543
|
-
const serializedAuthorizationList = [];
|
|
544
|
-
for (const authorization of authorizationList) {
|
|
545
|
-
const { contractAddress, chainId, nonce, ...signature } = authorization;
|
|
546
|
-
serializedAuthorizationList.push([
|
|
547
|
-
chainId ? toHex(chainId) : "0x",
|
|
548
|
-
contractAddress,
|
|
549
|
-
nonce ? toHex(nonce) : "0x",
|
|
550
|
-
...toYParitySignatureArray({}, signature)
|
|
551
|
-
]);
|
|
552
|
-
}
|
|
553
|
-
return serializedAuthorizationList;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
// ../../../../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/transaction/serializeTransaction.js
|
|
557
|
-
function serializeTransaction(transaction, signature) {
|
|
558
|
-
const type = getTransactionType(transaction);
|
|
559
|
-
if (type === "eip1559")
|
|
560
|
-
return serializeTransactionEIP1559(transaction, signature);
|
|
561
|
-
if (type === "eip2930")
|
|
562
|
-
return serializeTransactionEIP2930(transaction, signature);
|
|
563
|
-
if (type === "eip4844")
|
|
564
|
-
return serializeTransactionEIP4844(transaction, signature);
|
|
565
|
-
if (type === "eip7702")
|
|
566
|
-
return serializeTransactionEIP7702(transaction, signature);
|
|
567
|
-
return serializeTransactionLegacy(transaction, signature);
|
|
568
|
-
}
|
|
569
|
-
function serializeTransactionEIP7702(transaction, signature) {
|
|
570
|
-
const { authorizationList, chainId, gas, nonce, to, value, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
|
|
571
|
-
assertTransactionEIP7702(transaction);
|
|
572
|
-
const serializedAccessList = serializeAccessList(accessList);
|
|
573
|
-
const serializedAuthorizationList = serializeAuthorizationList(authorizationList);
|
|
574
|
-
return concatHex([
|
|
575
|
-
"0x04",
|
|
576
|
-
toRlp([
|
|
577
|
-
toHex(chainId),
|
|
578
|
-
nonce ? toHex(nonce) : "0x",
|
|
579
|
-
maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
|
|
580
|
-
maxFeePerGas ? toHex(maxFeePerGas) : "0x",
|
|
581
|
-
gas ? toHex(gas) : "0x",
|
|
582
|
-
to ?? "0x",
|
|
583
|
-
value ? toHex(value) : "0x",
|
|
584
|
-
data ?? "0x",
|
|
585
|
-
serializedAccessList,
|
|
586
|
-
serializedAuthorizationList,
|
|
587
|
-
...toYParitySignatureArray(transaction, signature)
|
|
588
|
-
])
|
|
589
|
-
]);
|
|
590
|
-
}
|
|
591
|
-
function serializeTransactionEIP4844(transaction, signature) {
|
|
592
|
-
const { chainId, gas, nonce, to, value, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
|
|
593
|
-
assertTransactionEIP4844(transaction);
|
|
594
|
-
let blobVersionedHashes = transaction.blobVersionedHashes;
|
|
595
|
-
let sidecars = transaction.sidecars;
|
|
596
|
-
if (transaction.blobs && (typeof blobVersionedHashes === "undefined" || typeof sidecars === "undefined")) {
|
|
597
|
-
const blobs2 = typeof transaction.blobs[0] === "string" ? transaction.blobs : transaction.blobs.map((x) => bytesToHex(x));
|
|
598
|
-
const kzg = transaction.kzg;
|
|
599
|
-
const commitments2 = blobsToCommitments({
|
|
600
|
-
blobs: blobs2,
|
|
601
|
-
kzg
|
|
602
|
-
});
|
|
603
|
-
if (typeof blobVersionedHashes === "undefined")
|
|
604
|
-
blobVersionedHashes = commitmentsToVersionedHashes({
|
|
605
|
-
commitments: commitments2
|
|
606
|
-
});
|
|
607
|
-
if (typeof sidecars === "undefined") {
|
|
608
|
-
const proofs2 = blobsToProofs({ blobs: blobs2, commitments: commitments2, kzg });
|
|
609
|
-
sidecars = toBlobSidecars({ blobs: blobs2, commitments: commitments2, proofs: proofs2 });
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
const serializedAccessList = serializeAccessList(accessList);
|
|
613
|
-
const serializedTransaction = [
|
|
614
|
-
toHex(chainId),
|
|
615
|
-
nonce ? toHex(nonce) : "0x",
|
|
616
|
-
maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
|
|
617
|
-
maxFeePerGas ? toHex(maxFeePerGas) : "0x",
|
|
618
|
-
gas ? toHex(gas) : "0x",
|
|
619
|
-
to ?? "0x",
|
|
620
|
-
value ? toHex(value) : "0x",
|
|
621
|
-
data ?? "0x",
|
|
622
|
-
serializedAccessList,
|
|
623
|
-
maxFeePerBlobGas ? toHex(maxFeePerBlobGas) : "0x",
|
|
624
|
-
blobVersionedHashes ?? [],
|
|
625
|
-
...toYParitySignatureArray(transaction, signature)
|
|
626
|
-
];
|
|
627
|
-
const blobs = [];
|
|
628
|
-
const commitments = [];
|
|
629
|
-
const proofs = [];
|
|
630
|
-
if (sidecars)
|
|
631
|
-
for (let i = 0; i < sidecars.length; i++) {
|
|
632
|
-
const { blob, commitment, proof } = sidecars[i];
|
|
633
|
-
blobs.push(blob);
|
|
634
|
-
commitments.push(commitment);
|
|
635
|
-
proofs.push(proof);
|
|
636
|
-
}
|
|
637
|
-
return concatHex([
|
|
638
|
-
"0x03",
|
|
639
|
-
sidecars ? (
|
|
640
|
-
// If sidecars are enabled, envelope turns into a "wrapper":
|
|
641
|
-
toRlp([serializedTransaction, blobs, commitments, proofs])
|
|
642
|
-
) : (
|
|
643
|
-
// If sidecars are disabled, standard envelope is used:
|
|
644
|
-
toRlp(serializedTransaction)
|
|
645
|
-
)
|
|
646
|
-
]);
|
|
647
|
-
}
|
|
648
|
-
function serializeTransactionEIP1559(transaction, signature) {
|
|
649
|
-
const { chainId, gas, nonce, to, value, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
|
|
650
|
-
assertTransactionEIP1559(transaction);
|
|
651
|
-
const serializedAccessList = serializeAccessList(accessList);
|
|
652
|
-
const serializedTransaction = [
|
|
653
|
-
toHex(chainId),
|
|
654
|
-
nonce ? toHex(nonce) : "0x",
|
|
655
|
-
maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
|
|
656
|
-
maxFeePerGas ? toHex(maxFeePerGas) : "0x",
|
|
657
|
-
gas ? toHex(gas) : "0x",
|
|
658
|
-
to ?? "0x",
|
|
659
|
-
value ? toHex(value) : "0x",
|
|
660
|
-
data ?? "0x",
|
|
661
|
-
serializedAccessList,
|
|
662
|
-
...toYParitySignatureArray(transaction, signature)
|
|
663
|
-
];
|
|
664
|
-
return concatHex([
|
|
665
|
-
"0x02",
|
|
666
|
-
toRlp(serializedTransaction)
|
|
667
|
-
]);
|
|
668
|
-
}
|
|
669
|
-
function serializeTransactionEIP2930(transaction, signature) {
|
|
670
|
-
const { chainId, gas, data, nonce, to, value, accessList, gasPrice } = transaction;
|
|
671
|
-
assertTransactionEIP2930(transaction);
|
|
672
|
-
const serializedAccessList = serializeAccessList(accessList);
|
|
673
|
-
const serializedTransaction = [
|
|
674
|
-
toHex(chainId),
|
|
675
|
-
nonce ? toHex(nonce) : "0x",
|
|
676
|
-
gasPrice ? toHex(gasPrice) : "0x",
|
|
677
|
-
gas ? toHex(gas) : "0x",
|
|
678
|
-
to ?? "0x",
|
|
679
|
-
value ? toHex(value) : "0x",
|
|
680
|
-
data ?? "0x",
|
|
681
|
-
serializedAccessList,
|
|
682
|
-
...toYParitySignatureArray(transaction, signature)
|
|
683
|
-
];
|
|
684
|
-
return concatHex([
|
|
685
|
-
"0x01",
|
|
686
|
-
toRlp(serializedTransaction)
|
|
687
|
-
]);
|
|
688
|
-
}
|
|
689
|
-
function serializeTransactionLegacy(transaction, signature) {
|
|
690
|
-
const { chainId = 0, gas, data, nonce, to, value, gasPrice } = transaction;
|
|
691
|
-
assertTransactionLegacy(transaction);
|
|
692
|
-
let serializedTransaction = [
|
|
693
|
-
nonce ? toHex(nonce) : "0x",
|
|
694
|
-
gasPrice ? toHex(gasPrice) : "0x",
|
|
695
|
-
gas ? toHex(gas) : "0x",
|
|
696
|
-
to ?? "0x",
|
|
697
|
-
value ? toHex(value) : "0x",
|
|
698
|
-
data ?? "0x"
|
|
699
|
-
];
|
|
700
|
-
if (signature) {
|
|
701
|
-
const v = (() => {
|
|
702
|
-
if (signature.v >= 35n) {
|
|
703
|
-
const inferredChainId = (signature.v - 35n) / 2n;
|
|
704
|
-
if (inferredChainId > 0)
|
|
705
|
-
return signature.v;
|
|
706
|
-
return 27n + (signature.v === 35n ? 0n : 1n);
|
|
707
|
-
}
|
|
708
|
-
if (chainId > 0)
|
|
709
|
-
return BigInt(chainId * 2) + BigInt(35n + signature.v - 27n);
|
|
710
|
-
const v2 = 27n + (signature.v === 27n ? 0n : 1n);
|
|
711
|
-
if (signature.v !== v2)
|
|
712
|
-
throw new InvalidLegacyVError({ v: signature.v });
|
|
713
|
-
return v2;
|
|
714
|
-
})();
|
|
715
|
-
const r = trim(signature.r);
|
|
716
|
-
const s = trim(signature.s);
|
|
717
|
-
serializedTransaction = [
|
|
718
|
-
...serializedTransaction,
|
|
719
|
-
toHex(v),
|
|
720
|
-
r === "0x00" ? "0x" : r,
|
|
721
|
-
s === "0x00" ? "0x" : s
|
|
722
|
-
];
|
|
723
|
-
} else if (chainId > 0) {
|
|
724
|
-
serializedTransaction = [
|
|
725
|
-
...serializedTransaction,
|
|
726
|
-
toHex(chainId),
|
|
727
|
-
"0x",
|
|
728
|
-
"0x"
|
|
729
|
-
];
|
|
730
|
-
}
|
|
731
|
-
return toRlp(serializedTransaction);
|
|
732
|
-
}
|
|
733
|
-
function toYParitySignatureArray(transaction, signature_) {
|
|
734
|
-
const signature = signature_ ?? transaction;
|
|
735
|
-
const { v, yParity } = signature;
|
|
736
|
-
if (typeof signature.r === "undefined")
|
|
737
|
-
return [];
|
|
738
|
-
if (typeof signature.s === "undefined")
|
|
739
|
-
return [];
|
|
740
|
-
if (typeof v === "undefined" && typeof yParity === "undefined")
|
|
741
|
-
return [];
|
|
742
|
-
const r = trim(signature.r);
|
|
743
|
-
const s = trim(signature.s);
|
|
744
|
-
const yParity_ = (() => {
|
|
745
|
-
if (typeof yParity === "number")
|
|
746
|
-
return yParity ? toHex(1) : "0x";
|
|
747
|
-
if (v === 0n)
|
|
748
|
-
return "0x";
|
|
749
|
-
if (v === 1n)
|
|
750
|
-
return toHex(1);
|
|
751
|
-
return v === 27n ? "0x" : toHex(1);
|
|
752
|
-
})();
|
|
753
|
-
return [yParity_, r === "0x00" ? "0x" : r, s === "0x00" ? "0x" : s];
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
// ../../../../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/getCode.js
|
|
757
|
-
async function getCode(client, { address, blockNumber, blockTag = "latest" }) {
|
|
758
|
-
const blockNumberHex = blockNumber !== void 0 ? numberToHex(blockNumber) : void 0;
|
|
759
|
-
const hex = await client.request({
|
|
760
|
-
method: "eth_getCode",
|
|
761
|
-
params: [address, blockNumberHex || blockTag]
|
|
762
|
-
}, { dedupe: Boolean(blockNumberHex) });
|
|
763
|
-
if (hex === "0x")
|
|
764
|
-
return void 0;
|
|
765
|
-
return hex;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
// ../../../../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/account.js
|
|
769
|
-
var AccountNotFoundError = class extends BaseError {
|
|
770
|
-
constructor({ docsPath } = {}) {
|
|
771
|
-
super([
|
|
772
|
-
"Could not find an Account to execute with this Action.",
|
|
773
|
-
"Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."
|
|
774
|
-
].join("\n"), {
|
|
775
|
-
docsPath,
|
|
776
|
-
docsSlug: "account",
|
|
777
|
-
name: "AccountNotFoundError"
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
};
|
|
781
|
-
var AccountTypeNotSupportedError = class extends BaseError {
|
|
782
|
-
constructor({ docsPath, metaMessages, type }) {
|
|
783
|
-
super(`Account type "${type}" is not supported.`, {
|
|
784
|
-
docsPath,
|
|
785
|
-
metaMessages,
|
|
786
|
-
name: "AccountTypeNotSupportedError"
|
|
787
|
-
});
|
|
788
|
-
}
|
|
789
|
-
};
|
|
790
|
-
|
|
791
|
-
export {
|
|
792
|
-
AccountNotFoundError,
|
|
793
|
-
AccountTypeNotSupportedError,
|
|
794
|
-
toRlp,
|
|
795
|
-
assertCurrentChain,
|
|
796
|
-
formatTransaction,
|
|
797
|
-
defineTransaction,
|
|
798
|
-
formatBlock,
|
|
799
|
-
defineBlock,
|
|
800
|
-
blobsToCommitments,
|
|
801
|
-
blobsToProofs,
|
|
802
|
-
sha2562 as sha256,
|
|
803
|
-
commitmentsToVersionedHashes,
|
|
804
|
-
toBlobSidecars,
|
|
805
|
-
getTransactionType,
|
|
806
|
-
getCode,
|
|
807
|
-
formatLog,
|
|
808
|
-
formatTransactionReceipt,
|
|
809
|
-
defineTransactionReceipt,
|
|
810
|
-
defineChain,
|
|
811
|
-
serializeAccessList,
|
|
812
|
-
serializeTransaction,
|
|
813
|
-
toYParitySignatureArray
|
|
814
|
-
};
|
|
815
|
-
//# sourceMappingURL=chunk-R2PSY44V.js.map
|