viem 0.0.0-portable-types-20230518183529 → 0.0.0-portable-types-20230523145621
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/README.md +1 -1
- package/abi/package.json +5 -0
- package/accounts/package.json +5 -0
- package/chains/package.json +5 -0
- package/contract/package.json +5 -0
- package/dist/cjs/actions/ens/getEnsAddress.js +1 -1
- package/dist/cjs/actions/ens/getEnsAddress.js.map +1 -1
- package/dist/cjs/actions/public/estimateGas.js +3 -2
- package/dist/cjs/actions/public/estimateGas.js.map +1 -1
- package/dist/cjs/actions/public/waitForTransactionReceipt.js +23 -12
- package/dist/cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/dist/cjs/actions/public/watchBlockNumber.js +2 -1
- package/dist/cjs/actions/public/watchBlockNumber.js.map +1 -1
- package/dist/cjs/actions/public/watchBlocks.js +2 -1
- package/dist/cjs/actions/public/watchBlocks.js.map +1 -1
- package/dist/cjs/actions/public/watchContractEvent.js +2 -1
- package/dist/cjs/actions/public/watchContractEvent.js.map +1 -1
- package/dist/cjs/actions/public/watchEvent.js +2 -1
- package/dist/cjs/actions/public/watchEvent.js.map +1 -1
- package/dist/cjs/actions/public/watchPendingTransactions.js +2 -1
- package/dist/cjs/actions/public/watchPendingTransactions.js.map +1 -1
- package/dist/cjs/errors/abi.js +0 -2
- package/dist/cjs/errors/abi.js.map +1 -1
- package/dist/cjs/errors/ccip.js +2 -1
- package/dist/cjs/errors/ccip.js.map +1 -1
- package/dist/cjs/errors/data.js +2 -2
- package/dist/cjs/errors/data.js.map +1 -1
- package/dist/cjs/errors/rpc.js +8 -2
- package/dist/cjs/errors/rpc.js.map +1 -1
- package/dist/cjs/errors/version.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/eip1193.js +3 -3
- package/dist/cjs/types/eip1193.js.map +1 -1
- package/dist/cjs/utils/abi/decodeAbiParameters.js +22 -14
- package/dist/cjs/utils/abi/decodeAbiParameters.js.map +1 -1
- package/dist/cjs/utils/abi/decodeEventLog.js +5 -5
- package/dist/cjs/utils/abi/decodeEventLog.js.map +1 -1
- package/dist/cjs/utils/buildRequest.js.map +1 -1
- package/dist/cjs/utils/data/isHex.js +2 -2
- package/dist/cjs/utils/data/isHex.js.map +1 -1
- package/dist/cjs/utils/data/size.js +1 -1
- package/dist/cjs/utils/data/size.js.map +1 -1
- package/dist/cjs/utils/data/slice.js +36 -12
- package/dist/cjs/utils/data/slice.js.map +1 -1
- package/dist/cjs/utils/data/trim.js +1 -1
- package/dist/cjs/utils/data/trim.js.map +1 -1
- package/dist/cjs/utils/encoding/fromHex.js +2 -2
- package/dist/cjs/utils/encoding/fromHex.js.map +1 -1
- package/dist/cjs/utils/hash/keccak256.js +1 -1
- package/dist/cjs/utils/hash/keccak256.js.map +1 -1
- package/dist/cjs/utils/promise/createBatchScheduler.js.map +1 -1
- package/dist/cjs/utils/rpc.js +49 -40
- package/dist/cjs/utils/rpc.js.map +1 -1
- package/dist/cjs/utils/signature/recoverPublicKey.js +3 -1
- package/dist/cjs/utils/signature/recoverPublicKey.js.map +1 -1
- package/dist/cjs/utils/transaction/prepareRequest.js +1 -2
- package/dist/cjs/utils/transaction/prepareRequest.js.map +1 -1
- package/dist/cjs/utils/transaction/serializeTransaction.js +2 -1
- package/dist/cjs/utils/transaction/serializeTransaction.js.map +1 -1
- package/dist/esm/actions/ens/getEnsAddress.js +1 -1
- package/dist/esm/actions/ens/getEnsAddress.js.map +1 -1
- package/dist/esm/actions/public/estimateGas.js +3 -2
- package/dist/esm/actions/public/estimateGas.js.map +1 -1
- package/dist/esm/actions/public/waitForTransactionReceipt.js +23 -12
- package/dist/esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/public/watchBlockNumber.js +2 -1
- package/dist/esm/actions/public/watchBlockNumber.js.map +1 -1
- package/dist/esm/actions/public/watchBlocks.js +2 -1
- package/dist/esm/actions/public/watchBlocks.js.map +1 -1
- package/dist/esm/actions/public/watchContractEvent.js +2 -1
- package/dist/esm/actions/public/watchContractEvent.js.map +1 -1
- package/dist/esm/actions/public/watchEvent.js +2 -1
- package/dist/esm/actions/public/watchEvent.js.map +1 -1
- package/dist/esm/actions/public/watchPendingTransactions.js +2 -1
- package/dist/esm/actions/public/watchPendingTransactions.js.map +1 -1
- package/dist/esm/errors/abi.js +0 -2
- package/dist/esm/errors/abi.js.map +1 -1
- package/dist/esm/errors/ccip.js +2 -1
- package/dist/esm/errors/ccip.js.map +1 -1
- package/dist/esm/errors/data.js +2 -2
- package/dist/esm/errors/data.js.map +1 -1
- package/dist/esm/errors/rpc.js +8 -2
- package/dist/esm/errors/rpc.js.map +1 -1
- package/dist/esm/errors/version.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/eip1193.js +1 -1
- package/dist/esm/types/eip1193.js.map +1 -1
- package/dist/esm/utils/abi/decodeAbiParameters.js +23 -15
- package/dist/esm/utils/abi/decodeAbiParameters.js.map +1 -1
- package/dist/esm/utils/abi/decodeEventLog.js +5 -5
- package/dist/esm/utils/abi/decodeEventLog.js.map +1 -1
- package/dist/esm/utils/buildRequest.js.map +1 -1
- package/dist/esm/utils/data/isHex.js +2 -2
- package/dist/esm/utils/data/isHex.js.map +1 -1
- package/dist/esm/utils/data/size.js +1 -1
- package/dist/esm/utils/data/size.js.map +1 -1
- package/dist/esm/utils/data/slice.js +36 -12
- package/dist/esm/utils/data/slice.js.map +1 -1
- package/dist/esm/utils/data/trim.js +1 -1
- package/dist/esm/utils/data/trim.js.map +1 -1
- package/dist/esm/utils/encoding/fromHex.js +2 -2
- package/dist/esm/utils/encoding/fromHex.js.map +1 -1
- package/dist/esm/utils/hash/keccak256.js +1 -1
- package/dist/esm/utils/hash/keccak256.js.map +1 -1
- package/dist/esm/utils/promise/createBatchScheduler.js.map +1 -1
- package/dist/esm/utils/rpc.js +49 -40
- package/dist/esm/utils/rpc.js.map +1 -1
- package/dist/esm/utils/signature/recoverPublicKey.js +3 -1
- package/dist/esm/utils/signature/recoverPublicKey.js.map +1 -1
- package/dist/esm/utils/transaction/prepareRequest.js +1 -2
- package/dist/esm/utils/transaction/prepareRequest.js.map +1 -1
- package/dist/esm/utils/transaction/serializeTransaction.js +2 -1
- package/dist/esm/utils/transaction/serializeTransaction.js.map +1 -1
- package/dist/types/actions/public/createBlockFilter.d.ts +1 -1
- package/dist/types/actions/public/createContractEventFilter.d.ts +1 -1
- package/dist/types/actions/public/createEventFilter.d.ts +1 -1
- package/dist/types/actions/public/createPendingTransactionFilter.d.ts +1 -1
- package/dist/types/actions/public/estimateContractGas.d.ts +1 -1
- package/dist/types/actions/public/estimateGas.d.ts.map +1 -1
- package/dist/types/actions/public/getFilterChanges.d.ts +4 -4
- package/dist/types/actions/public/getTransaction.d.ts +1 -1
- package/dist/types/actions/public/getTransactionCount.d.ts +1 -1
- package/dist/types/actions/public/getTransactionReceipt.d.ts +2 -2
- package/dist/types/actions/public/multicall.d.ts +1 -1
- package/dist/types/actions/public/readContract.d.ts +2 -2
- package/dist/types/actions/public/readContract.d.ts.map +1 -1
- package/dist/types/actions/public/simulateContract.d.ts +2 -2
- package/dist/types/actions/public/uninstallFilter.d.ts +3 -3
- package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/actions/public/watchBlockNumber.d.ts.map +1 -1
- package/dist/types/actions/public/watchBlocks.d.ts.map +1 -1
- package/dist/types/actions/public/watchContractEvent.d.ts +1 -1
- package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/dist/types/actions/public/watchEvent.d.ts +2 -2
- package/dist/types/actions/public/watchEvent.d.ts.map +1 -1
- package/dist/types/actions/public/watchPendingTransactions.d.ts.map +1 -1
- package/dist/types/actions/test/setBlockTimestampInterval.d.ts +1 -1
- package/dist/types/actions/test/stopImpersonatingAccount.d.ts +1 -1
- package/dist/types/actions/wallet/deployContract.d.ts +1 -1
- package/dist/types/actions/wallet/signMessage.d.ts +2 -2
- package/dist/types/actions/wallet/writeContract.d.ts +3 -3
- package/dist/types/clients/createPublicClient.d.ts +1 -1
- package/dist/types/clients/createTestClient.d.ts +4 -4
- package/dist/types/clients/createTestClient.d.ts.map +1 -1
- package/dist/types/clients/createWalletClient.d.ts +2 -2
- package/dist/types/clients/decorators/public.d.ts +22 -22
- package/dist/types/clients/decorators/test.d.ts +2 -2
- package/dist/types/clients/decorators/wallet.d.ts +6 -6
- package/dist/types/errors/abi.d.ts.map +1 -1
- package/dist/types/errors/ccip.d.ts.map +1 -1
- package/dist/types/errors/data.d.ts +2 -1
- package/dist/types/errors/data.d.ts.map +1 -1
- package/dist/types/errors/rpc.d.ts +12 -8
- package/dist/types/errors/rpc.d.ts.map +1 -1
- package/dist/types/errors/version.d.ts +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/contract.d.ts +7 -33
- package/dist/types/types/contract.d.ts.map +1 -1
- package/dist/types/types/eip1193.d.ts +7 -8
- package/dist/types/types/eip1193.d.ts.map +1 -1
- package/dist/types/types/log.d.ts +0 -2
- package/dist/types/types/log.d.ts.map +1 -1
- package/dist/types/utils/abi/decodeAbiParameters.d.ts.map +1 -1
- package/dist/types/utils/buildRequest.d.ts.map +1 -1
- package/dist/types/utils/data/isHex.d.ts +3 -1
- package/dist/types/utils/data/isHex.d.ts.map +1 -1
- package/dist/types/utils/data/slice.d.ts +9 -3
- package/dist/types/utils/data/slice.d.ts.map +1 -1
- package/dist/types/utils/data/trim.d.ts.map +1 -1
- package/dist/types/utils/encoding/fromHex.d.ts +1 -1
- package/dist/types/utils/hash/keccak256.d.ts.map +1 -1
- package/dist/types/utils/promise/createBatchScheduler.d.ts +6 -4
- package/dist/types/utils/promise/createBatchScheduler.d.ts.map +1 -1
- package/dist/types/utils/rpc.d.ts.map +1 -1
- package/dist/types/utils/signature/recoverPublicKey.d.ts.map +1 -1
- package/dist/types/utils/transaction/prepareRequest.d.ts +1 -1
- package/dist/types/utils/transaction/prepareRequest.d.ts.map +1 -1
- package/dist/types/utils/transaction/serializeTransaction.d.ts.map +1 -1
- package/ens/package.json +5 -0
- package/ethers/package.json +5 -0
- package/package.json +13 -2
- package/public/package.json +5 -0
- package/src/actions/ens/getEnsAddress.ts +1 -1
- package/src/actions/public/createBlockFilter.ts +1 -1
- package/src/actions/public/createContractEventFilter.ts +1 -1
- package/src/actions/public/createEventFilter.ts +1 -1
- package/src/actions/public/createPendingTransactionFilter.ts +1 -1
- package/src/actions/public/estimateContractGas.ts +1 -1
- package/src/actions/public/estimateGas.ts +3 -2
- package/src/actions/public/getFilterChanges.ts +4 -4
- package/src/actions/public/getTransaction.ts +1 -1
- package/src/actions/public/getTransactionCount.ts +1 -1
- package/src/actions/public/getTransactionReceipt.ts +2 -2
- package/src/actions/public/multicall.ts +1 -1
- package/src/actions/public/readContract.ts +2 -2
- package/src/actions/public/simulateContract.ts +2 -2
- package/src/actions/public/uninstallFilter.ts +3 -3
- package/src/actions/public/waitForTransactionReceipt.ts +33 -11
- package/src/actions/public/watchBlockNumber.ts +2 -1
- package/src/actions/public/watchBlocks.ts +2 -1
- package/src/actions/public/watchContractEvent.ts +3 -2
- package/src/actions/public/watchEvent.ts +4 -3
- package/src/actions/public/watchPendingTransactions.ts +2 -1
- package/src/actions/test/setBlockTimestampInterval.ts +1 -1
- package/src/actions/test/stopImpersonatingAccount.ts +1 -1
- package/src/actions/wallet/deployContract.ts +1 -1
- package/src/actions/wallet/signMessage.ts +2 -2
- package/src/actions/wallet/writeContract.ts +3 -3
- package/src/clients/createPublicClient.ts +1 -1
- package/src/clients/createTestClient.ts +4 -4
- package/src/clients/createWalletClient.ts +2 -2
- package/src/clients/decorators/public.ts +22 -22
- package/src/clients/decorators/test.ts +2 -2
- package/src/clients/decorators/wallet.ts +6 -6
- package/src/errors/abi.ts +0 -2
- package/src/errors/ccip.ts +2 -1
- package/src/errors/data.ts +8 -2
- package/src/errors/rpc.ts +42 -15
- package/src/errors/version.ts +1 -1
- package/src/index.ts +8 -3
- package/src/types/contract.ts +11 -87
- package/src/types/eip1193.ts +10 -13
- package/src/types/log.ts +2 -2
- package/src/utils/abi/decodeAbiParameters.ts +36 -15
- package/src/utils/abi/decodeEventLog.ts +5 -5
- package/src/utils/buildRequest.ts +5 -1
- package/src/utils/data/isHex.ts +5 -2
- package/src/utils/data/size.ts +1 -1
- package/src/utils/data/slice.ts +43 -11
- package/src/utils/data/trim.ts +3 -1
- package/src/utils/encoding/fromHex.ts +3 -3
- package/src/utils/hash/keccak256.ts +3 -1
- package/src/utils/promise/createBatchScheduler.ts +24 -7
- package/src/utils/rpc.ts +59 -49
- package/src/utils/signature/recoverPublicKey.ts +2 -1
- package/src/utils/transaction/prepareRequest.ts +1 -2
- package/src/utils/transaction/serializeTransaction.ts +3 -2
- package/test/package.json +5 -0
- package/utils/package.json +5 -0
- package/wallet/package.json +5 -0
- package/window/package.json +5 -0
@@ -10,6 +10,25 @@ type PendingPromise<TReturnType extends readonly unknown[] = any> = {
|
|
10
10
|
|
11
11
|
type SchedulerItem = { args: unknown; pendingPromise: PendingPromise }
|
12
12
|
|
13
|
+
export type CreateBatchSchedulerArguments<
|
14
|
+
TParameters = unknown,
|
15
|
+
TReturnType extends readonly unknown[] = readonly unknown[],
|
16
|
+
> = {
|
17
|
+
fn: (args: TParameters[]) => Promise<TReturnType>
|
18
|
+
id: number | string
|
19
|
+
shouldSplitBatch?: (args: TParameters[]) => boolean
|
20
|
+
wait?: number
|
21
|
+
}
|
22
|
+
export type CreateBatchSchedulerReturnType<
|
23
|
+
TParameters = unknown,
|
24
|
+
TReturnType extends readonly unknown[] = readonly unknown[],
|
25
|
+
> = {
|
26
|
+
flush: () => void
|
27
|
+
schedule: TParameters extends undefined
|
28
|
+
? (args?: TParameters) => Promise<Resolved<TReturnType>>
|
29
|
+
: (args: TParameters) => Promise<Resolved<TReturnType>>
|
30
|
+
}
|
31
|
+
|
13
32
|
const schedulerCache = new Map<number | string, SchedulerItem[]>()
|
14
33
|
|
15
34
|
export function createBatchScheduler<
|
@@ -20,12 +39,10 @@ export function createBatchScheduler<
|
|
20
39
|
id,
|
21
40
|
shouldSplitBatch,
|
22
41
|
wait = 0,
|
23
|
-
}:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
wait?: number
|
28
|
-
}) {
|
42
|
+
}: CreateBatchSchedulerArguments<
|
43
|
+
TParameters,
|
44
|
+
TReturnType
|
45
|
+
>): CreateBatchSchedulerReturnType<TParameters, TReturnType> {
|
29
46
|
const exec = async () => {
|
30
47
|
const scheduler = getScheduler()
|
31
48
|
flush()
|
@@ -78,5 +95,5 @@ export function createBatchScheduler<
|
|
78
95
|
setTimeout(exec, wait)
|
79
96
|
return promise
|
80
97
|
},
|
81
|
-
}
|
98
|
+
} as unknown as CreateBatchSchedulerReturnType<TParameters, TReturnType>
|
82
99
|
}
|
package/src/utils/rpc.ts
CHANGED
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
WebSocketRequestError,
|
8
8
|
} from '../errors/request.js'
|
9
9
|
|
10
|
+
import { createBatchScheduler } from './promise/createBatchScheduler.js'
|
10
11
|
import { withTimeout } from './promise/withTimeout.js'
|
11
12
|
import { stringify } from './stringify.js'
|
12
13
|
|
@@ -146,61 +147,70 @@ export async function getSocket(url_: string) {
|
|
146
147
|
// If the socket already exists, return it.
|
147
148
|
if (socket) return socket
|
148
149
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
150
|
+
const { schedule } = createBatchScheduler<undefined, [Socket]>({
|
151
|
+
id: urlKey,
|
152
|
+
fn: async () => {
|
153
|
+
let WebSocket = await import('isomorphic-ws')
|
154
|
+
// Workaround for Vite.
|
155
|
+
// https://github.com/vitejs/vite/issues/9703
|
156
|
+
// TODO: Remove when issue is resolved.
|
157
|
+
if (
|
158
|
+
(WebSocket as unknown as { default?: typeof WebSocket }).default
|
159
|
+
?.constructor
|
160
|
+
)
|
161
|
+
WebSocket = (WebSocket as unknown as { default: typeof WebSocket })
|
162
|
+
.default
|
163
|
+
else WebSocket = WebSocket.WebSocket
|
164
|
+
|
165
|
+
const webSocket = new WebSocket(url)
|
166
|
+
|
167
|
+
// Set up a cache for incoming "synchronous" requests.
|
168
|
+
const requests = new Map<Id, CallbackFn>()
|
169
|
+
|
170
|
+
// Set up a cache for subscriptions (eth_subscribe).
|
171
|
+
const subscriptions = new Map<Id, CallbackFn>()
|
172
|
+
|
173
|
+
const onMessage: (event: MessageEvent) => void = ({ data }) => {
|
174
|
+
const message: RpcResponse = JSON.parse(data as string)
|
175
|
+
const isSubscription = message.method === 'eth_subscription'
|
176
|
+
const id = isSubscription ? message.params.subscription : message.id
|
177
|
+
const cache = isSubscription ? subscriptions : requests
|
178
|
+
const callback = cache.get(id)
|
179
|
+
if (callback) callback({ data })
|
180
|
+
if (!isSubscription) cache.delete(id)
|
181
|
+
}
|
182
|
+
const onClose = () => {
|
183
|
+
sockets.delete(urlKey)
|
184
|
+
webSocket.removeEventListener('close', onClose)
|
185
|
+
webSocket.removeEventListener('message', onMessage)
|
186
|
+
}
|
164
187
|
|
165
|
-
|
166
|
-
|
188
|
+
// Setup event listeners for RPC & subscription responses.
|
189
|
+
webSocket.addEventListener('close', onClose)
|
190
|
+
webSocket.addEventListener('message', onMessage)
|
167
191
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
}
|
177
|
-
const onClose = () => {
|
178
|
-
sockets.delete(urlKey)
|
179
|
-
webSocket.removeEventListener('close', onClose)
|
180
|
-
webSocket.removeEventListener('message', onMessage)
|
181
|
-
}
|
182
|
-
|
183
|
-
// Setup event listeners for RPC & subscription responses.
|
184
|
-
webSocket.addEventListener('close', onClose)
|
185
|
-
webSocket.addEventListener('message', onMessage)
|
192
|
+
// Wait for the socket to open.
|
193
|
+
if (webSocket.readyState === WebSocket.CONNECTING) {
|
194
|
+
await new Promise((resolve, reject) => {
|
195
|
+
if (!webSocket) return
|
196
|
+
webSocket.onopen = resolve
|
197
|
+
webSocket.onerror = reject
|
198
|
+
})
|
199
|
+
}
|
186
200
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
})
|
194
|
-
}
|
201
|
+
// Create a new socket instance.
|
202
|
+
socket = Object.assign(webSocket, {
|
203
|
+
requests,
|
204
|
+
subscriptions,
|
205
|
+
})
|
206
|
+
sockets.set(urlKey, socket)
|
195
207
|
|
196
|
-
|
197
|
-
|
198
|
-
requests,
|
199
|
-
subscriptions,
|
208
|
+
return [socket]
|
209
|
+
},
|
200
210
|
})
|
201
|
-
sockets.set(urlKey, socket)
|
202
211
|
|
203
|
-
|
212
|
+
const [_, [socket_]] = await schedule()
|
213
|
+
return socket_
|
204
214
|
}
|
205
215
|
|
206
216
|
function webSocket(
|
@@ -18,7 +18,8 @@ export async function recoverPublicKey({
|
|
18
18
|
|
19
19
|
// Derive v = recoveryId + 27 from end of the signature (27 is added when signing the message)
|
20
20
|
// The recoveryId represents the y-coordinate on the secp256k1 elliptic curve and can have a value [0, 1].
|
21
|
-
|
21
|
+
let v = hexToNumber(`0x${signatureHex.slice(130)}`)
|
22
|
+
if (v === 0 || v === 1) v += 27
|
22
23
|
|
23
24
|
const { secp256k1 } = await import('@noble/curves/secp256k1')
|
24
25
|
const publicKey = secp256k1.Signature.fromCompact(
|
@@ -17,7 +17,6 @@ import { AccountNotFoundError } from '../../errors/account.js'
|
|
17
17
|
import { BaseError } from '../../errors/base.js'
|
18
18
|
import type { GetAccountParameter } from '../../types/account.js'
|
19
19
|
import type { Chain } from '../../types/chain.js'
|
20
|
-
import { parseGwei } from '../unit/parseGwei.js'
|
21
20
|
|
22
21
|
import { assertRequest } from './assertRequest.js'
|
23
22
|
|
@@ -43,7 +42,7 @@ export type PrepareRequestReturnType<
|
|
43
42
|
nonce: SendTransactionParameters['nonce']
|
44
43
|
}
|
45
44
|
|
46
|
-
export const defaultTip =
|
45
|
+
export const defaultTip = 1_500_000_000n // 1.5 gwei
|
47
46
|
|
48
47
|
export async function prepareRequest<
|
49
48
|
TChain extends Chain | undefined,
|
@@ -18,6 +18,7 @@ import type {
|
|
18
18
|
} from '../../types/transaction.js'
|
19
19
|
import { isAddress } from '../address/isAddress.js'
|
20
20
|
import { concatHex } from '../data/concat.js'
|
21
|
+
import { trim } from '../data/trim.js'
|
21
22
|
import { toHex } from '../encoding/toHex.js'
|
22
23
|
import { type RecursiveArray, toRlp } from '../encoding/toRlp.js'
|
23
24
|
|
@@ -97,8 +98,8 @@ function serializeTransactionEIP1559(
|
|
97
98
|
if (signature)
|
98
99
|
serializedTransaction.push(
|
99
100
|
signature.v === 27n ? '0x' : toHex(1), // yParity
|
100
|
-
signature.r,
|
101
|
-
signature.s,
|
101
|
+
trim(signature.r),
|
102
|
+
trim(signature.s),
|
102
103
|
)
|
103
104
|
|
104
105
|
return concatHex([
|