viem 0.0.0-portable-types-20230518183529 → 0.0.0-portable-types-20230522163654

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 (159) hide show
  1. package/README.md +1 -1
  2. package/abi/package.json +5 -0
  3. package/accounts/package.json +5 -0
  4. package/chains/package.json +5 -0
  5. package/contract/package.json +5 -0
  6. package/dist/cjs/actions/ens/getEnsAddress.js +1 -1
  7. package/dist/cjs/actions/ens/getEnsAddress.js.map +1 -1
  8. package/dist/cjs/actions/public/waitForTransactionReceipt.js +23 -12
  9. package/dist/cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  10. package/dist/cjs/actions/public/watchBlockNumber.js +2 -1
  11. package/dist/cjs/actions/public/watchBlockNumber.js.map +1 -1
  12. package/dist/cjs/actions/public/watchBlocks.js +2 -1
  13. package/dist/cjs/actions/public/watchBlocks.js.map +1 -1
  14. package/dist/cjs/actions/public/watchContractEvent.js +2 -1
  15. package/dist/cjs/actions/public/watchContractEvent.js.map +1 -1
  16. package/dist/cjs/actions/public/watchEvent.js +2 -1
  17. package/dist/cjs/actions/public/watchEvent.js.map +1 -1
  18. package/dist/cjs/actions/public/watchPendingTransactions.js +2 -1
  19. package/dist/cjs/actions/public/watchPendingTransactions.js.map +1 -1
  20. package/dist/cjs/errors/abi.js +0 -2
  21. package/dist/cjs/errors/abi.js.map +1 -1
  22. package/dist/cjs/errors/ccip.js +2 -1
  23. package/dist/cjs/errors/ccip.js.map +1 -1
  24. package/dist/cjs/errors/data.js +2 -2
  25. package/dist/cjs/errors/data.js.map +1 -1
  26. package/dist/cjs/errors/version.js +1 -1
  27. package/dist/cjs/utils/abi/decodeAbiParameters.js +22 -14
  28. package/dist/cjs/utils/abi/decodeAbiParameters.js.map +1 -1
  29. package/dist/cjs/utils/abi/decodeEventLog.js +5 -5
  30. package/dist/cjs/utils/abi/decodeEventLog.js.map +1 -1
  31. package/dist/cjs/utils/data/isHex.js +2 -2
  32. package/dist/cjs/utils/data/isHex.js.map +1 -1
  33. package/dist/cjs/utils/data/size.js +1 -1
  34. package/dist/cjs/utils/data/size.js.map +1 -1
  35. package/dist/cjs/utils/data/slice.js +36 -12
  36. package/dist/cjs/utils/data/slice.js.map +1 -1
  37. package/dist/cjs/utils/data/trim.js +1 -1
  38. package/dist/cjs/utils/data/trim.js.map +1 -1
  39. package/dist/cjs/utils/encoding/fromHex.js +2 -2
  40. package/dist/cjs/utils/encoding/fromHex.js.map +1 -1
  41. package/dist/cjs/utils/hash/keccak256.js +1 -1
  42. package/dist/cjs/utils/hash/keccak256.js.map +1 -1
  43. package/dist/cjs/utils/promise/createBatchScheduler.js.map +1 -1
  44. package/dist/cjs/utils/rpc.js +49 -40
  45. package/dist/cjs/utils/rpc.js.map +1 -1
  46. package/dist/cjs/utils/signature/recoverPublicKey.js +3 -1
  47. package/dist/cjs/utils/signature/recoverPublicKey.js.map +1 -1
  48. package/dist/cjs/utils/transaction/serializeTransaction.js +2 -1
  49. package/dist/cjs/utils/transaction/serializeTransaction.js.map +1 -1
  50. package/dist/esm/actions/ens/getEnsAddress.js +1 -1
  51. package/dist/esm/actions/ens/getEnsAddress.js.map +1 -1
  52. package/dist/esm/actions/public/waitForTransactionReceipt.js +23 -12
  53. package/dist/esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  54. package/dist/esm/actions/public/watchBlockNumber.js +2 -1
  55. package/dist/esm/actions/public/watchBlockNumber.js.map +1 -1
  56. package/dist/esm/actions/public/watchBlocks.js +2 -1
  57. package/dist/esm/actions/public/watchBlocks.js.map +1 -1
  58. package/dist/esm/actions/public/watchContractEvent.js +2 -1
  59. package/dist/esm/actions/public/watchContractEvent.js.map +1 -1
  60. package/dist/esm/actions/public/watchEvent.js +2 -1
  61. package/dist/esm/actions/public/watchEvent.js.map +1 -1
  62. package/dist/esm/actions/public/watchPendingTransactions.js +2 -1
  63. package/dist/esm/actions/public/watchPendingTransactions.js.map +1 -1
  64. package/dist/esm/errors/abi.js +0 -2
  65. package/dist/esm/errors/abi.js.map +1 -1
  66. package/dist/esm/errors/ccip.js +2 -1
  67. package/dist/esm/errors/ccip.js.map +1 -1
  68. package/dist/esm/errors/data.js +2 -2
  69. package/dist/esm/errors/data.js.map +1 -1
  70. package/dist/esm/errors/version.js +1 -1
  71. package/dist/esm/utils/abi/decodeAbiParameters.js +23 -15
  72. package/dist/esm/utils/abi/decodeAbiParameters.js.map +1 -1
  73. package/dist/esm/utils/abi/decodeEventLog.js +5 -5
  74. package/dist/esm/utils/abi/decodeEventLog.js.map +1 -1
  75. package/dist/esm/utils/data/isHex.js +2 -2
  76. package/dist/esm/utils/data/isHex.js.map +1 -1
  77. package/dist/esm/utils/data/size.js +1 -1
  78. package/dist/esm/utils/data/size.js.map +1 -1
  79. package/dist/esm/utils/data/slice.js +36 -12
  80. package/dist/esm/utils/data/slice.js.map +1 -1
  81. package/dist/esm/utils/data/trim.js +1 -1
  82. package/dist/esm/utils/data/trim.js.map +1 -1
  83. package/dist/esm/utils/encoding/fromHex.js +2 -2
  84. package/dist/esm/utils/encoding/fromHex.js.map +1 -1
  85. package/dist/esm/utils/hash/keccak256.js +1 -1
  86. package/dist/esm/utils/hash/keccak256.js.map +1 -1
  87. package/dist/esm/utils/promise/createBatchScheduler.js.map +1 -1
  88. package/dist/esm/utils/rpc.js +49 -40
  89. package/dist/esm/utils/rpc.js.map +1 -1
  90. package/dist/esm/utils/signature/recoverPublicKey.js +3 -1
  91. package/dist/esm/utils/signature/recoverPublicKey.js.map +1 -1
  92. package/dist/esm/utils/transaction/serializeTransaction.js +2 -1
  93. package/dist/esm/utils/transaction/serializeTransaction.js.map +1 -1
  94. package/dist/types/actions/public/getTransactionReceipt.d.ts +1 -1
  95. package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  96. package/dist/types/actions/public/watchBlockNumber.d.ts.map +1 -1
  97. package/dist/types/actions/public/watchBlocks.d.ts.map +1 -1
  98. package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -1
  99. package/dist/types/actions/public/watchEvent.d.ts.map +1 -1
  100. package/dist/types/actions/public/watchPendingTransactions.d.ts.map +1 -1
  101. package/dist/types/clients/createTestClient.d.ts +2 -2
  102. package/dist/types/clients/createTestClient.d.ts.map +1 -1
  103. package/dist/types/errors/abi.d.ts.map +1 -1
  104. package/dist/types/errors/ccip.d.ts.map +1 -1
  105. package/dist/types/errors/data.d.ts +2 -1
  106. package/dist/types/errors/data.d.ts.map +1 -1
  107. package/dist/types/errors/version.d.ts +1 -1
  108. package/dist/types/types/contract.d.ts +7 -33
  109. package/dist/types/types/contract.d.ts.map +1 -1
  110. package/dist/types/types/log.d.ts +0 -2
  111. package/dist/types/types/log.d.ts.map +1 -1
  112. package/dist/types/utils/abi/decodeAbiParameters.d.ts.map +1 -1
  113. package/dist/types/utils/data/isHex.d.ts +3 -1
  114. package/dist/types/utils/data/isHex.d.ts.map +1 -1
  115. package/dist/types/utils/data/slice.d.ts +9 -3
  116. package/dist/types/utils/data/slice.d.ts.map +1 -1
  117. package/dist/types/utils/data/trim.d.ts.map +1 -1
  118. package/dist/types/utils/encoding/fromHex.d.ts +1 -1
  119. package/dist/types/utils/hash/keccak256.d.ts.map +1 -1
  120. package/dist/types/utils/promise/createBatchScheduler.d.ts +6 -4
  121. package/dist/types/utils/promise/createBatchScheduler.d.ts.map +1 -1
  122. package/dist/types/utils/rpc.d.ts.map +1 -1
  123. package/dist/types/utils/signature/recoverPublicKey.d.ts.map +1 -1
  124. package/dist/types/utils/transaction/serializeTransaction.d.ts.map +1 -1
  125. package/ens/package.json +5 -0
  126. package/ethers/package.json +5 -0
  127. package/package.json +13 -2
  128. package/public/package.json +5 -0
  129. package/src/actions/ens/getEnsAddress.ts +1 -1
  130. package/src/actions/public/getTransactionReceipt.ts +1 -1
  131. package/src/actions/public/waitForTransactionReceipt.ts +33 -11
  132. package/src/actions/public/watchBlockNumber.ts +2 -1
  133. package/src/actions/public/watchBlocks.ts +2 -1
  134. package/src/actions/public/watchContractEvent.ts +2 -1
  135. package/src/actions/public/watchEvent.ts +2 -1
  136. package/src/actions/public/watchPendingTransactions.ts +2 -1
  137. package/src/clients/createTestClient.ts +2 -2
  138. package/src/errors/abi.ts +0 -2
  139. package/src/errors/ccip.ts +2 -1
  140. package/src/errors/data.ts +8 -2
  141. package/src/errors/version.ts +1 -1
  142. package/src/types/contract.ts +11 -87
  143. package/src/types/log.ts +2 -2
  144. package/src/utils/abi/decodeAbiParameters.ts +36 -15
  145. package/src/utils/abi/decodeEventLog.ts +5 -5
  146. package/src/utils/data/isHex.ts +5 -2
  147. package/src/utils/data/size.ts +1 -1
  148. package/src/utils/data/slice.ts +43 -11
  149. package/src/utils/data/trim.ts +3 -1
  150. package/src/utils/encoding/fromHex.ts +3 -3
  151. package/src/utils/hash/keccak256.ts +3 -1
  152. package/src/utils/promise/createBatchScheduler.ts +24 -7
  153. package/src/utils/rpc.ts +59 -49
  154. package/src/utils/signature/recoverPublicKey.ts +2 -1
  155. package/src/utils/transaction/serializeTransaction.ts +3 -2
  156. package/test/package.json +5 -0
  157. package/utils/package.json +5 -0
  158. package/wallet/package.json +5 -0
  159. package/window/package.json +5 -0
@@ -19,15 +19,38 @@ export function slice<TValue extends ByteArray | Hex>(
19
19
  value: TValue,
20
20
  start?: number,
21
21
  end?: number,
22
+ { strict }: { strict?: boolean } = {},
22
23
  ): SliceReturnType<TValue> {
23
- if (isHex(value))
24
- return sliceHex(value as Hex, start, end) as SliceReturnType<TValue>
25
- return sliceBytes(value as ByteArray, start, end) as SliceReturnType<TValue>
24
+ if (isHex(value, { strict: false }))
25
+ return sliceHex(value as Hex, start, end, {
26
+ strict,
27
+ }) as SliceReturnType<TValue>
28
+ return sliceBytes(value as ByteArray, start, end, {
29
+ strict,
30
+ }) as SliceReturnType<TValue>
26
31
  }
27
32
 
28
33
  function assertStartOffset(value: Hex | ByteArray, start?: number) {
29
34
  if (typeof start === 'number' && start > 0 && start > size(value) - 1)
30
- throw new SliceOffsetOutOfBoundsError({ offset: start, size: size(value) })
35
+ throw new SliceOffsetOutOfBoundsError({
36
+ offset: start,
37
+ position: 'start',
38
+ size: size(value),
39
+ })
40
+ }
41
+
42
+ function assertEndOffset(value: Hex | ByteArray, start?: number, end?: number) {
43
+ if (
44
+ typeof start === 'number' &&
45
+ typeof end === 'number' &&
46
+ size(value) !== end - start
47
+ ) {
48
+ throw new SliceOffsetOutOfBoundsError({
49
+ offset: end,
50
+ position: 'end',
51
+ size: size(value),
52
+ })
53
+ }
31
54
  }
32
55
 
33
56
  /**
@@ -38,12 +61,15 @@ function assertStartOffset(value: Hex | ByteArray, start?: number) {
38
61
  * @param end The end offset (in bytes).
39
62
  */
40
63
  export function sliceBytes(
41
- value: ByteArray,
64
+ value_: ByteArray,
42
65
  start?: number,
43
66
  end?: number,
67
+ { strict }: { strict?: boolean } = {},
44
68
  ): ByteArray {
45
- assertStartOffset(value, start)
46
- return value.slice(start, end)
69
+ assertStartOffset(value_, start)
70
+ const value = value_.slice(start, end)
71
+ if (strict) assertEndOffset(value, start, end)
72
+ return value
47
73
  }
48
74
 
49
75
  /**
@@ -53,10 +79,16 @@ export function sliceBytes(
53
79
  * @param start The start offset (in bytes).
54
80
  * @param end The end offset (in bytes).
55
81
  */
56
- export function sliceHex(value_: Hex, start?: number, end?: number): Hex {
82
+ export function sliceHex(
83
+ value_: Hex,
84
+ start?: number,
85
+ end?: number,
86
+ { strict }: { strict?: boolean } = {},
87
+ ): Hex {
57
88
  assertStartOffset(value_, start)
58
- const value = value_
89
+ const value = `0x${value_
59
90
  .replace('0x', '')
60
- .slice((start ?? 0) * 2, (end ?? value_.length) * 2)
61
- return `0x${value}`
91
+ .slice((start ?? 0) * 2, (end ?? value_.length) * 2)}` as const
92
+ if (strict) assertEndOffset(value, start, end)
93
+ return value
62
94
  }
@@ -27,7 +27,9 @@ export function trim<TValue extends ByteArray | Hex>(
27
27
 
28
28
  if (typeof hexOrBytes === 'string') {
29
29
  if (data.length === 1 && dir === 'right') data = `${data}0`
30
- return `0x${data}` as TrimReturnType<TValue>
30
+ return `0x${
31
+ data.length % 2 === 1 ? `0${data}` : data
32
+ }` as TrimReturnType<TValue>
31
33
  }
32
34
  return data as TrimReturnType<TValue>
33
35
  }
@@ -140,7 +140,7 @@ export type HexToBoolOpts = {
140
140
  *
141
141
  * @example
142
142
  * import { hexToBool } from 'viem'
143
- * const data = hexToBool('0x1')
143
+ * const data = hexToBool('0x01')
144
144
  * // true
145
145
  *
146
146
  * @example
@@ -154,8 +154,8 @@ export function hexToBool(hex_: Hex, opts: HexToBoolOpts = {}): boolean {
154
154
  assertSize(hex, { size: opts.size })
155
155
  hex = trim(hex)
156
156
  }
157
- if (trim(hex) === '0x0') return false
158
- if (trim(hex) === '0x1') return true
157
+ if (trim(hex) === '0x00') return false
158
+ if (trim(hex) === '0x01') return true
159
159
  throw new InvalidHexBooleanError(hex)
160
160
  }
161
161
 
@@ -16,7 +16,9 @@ export function keccak256<TTo extends To = 'hex'>(
16
16
  to_?: TTo,
17
17
  ): Keccak256Hash<TTo> {
18
18
  const to = to_ || 'hex'
19
- const bytes = keccak_256(isHex(value) ? toBytes(value) : value)
19
+ const bytes = keccak_256(
20
+ isHex(value, { strict: false }) ? toBytes(value) : value,
21
+ )
20
22
  if (to === 'bytes') return bytes as Keccak256Hash<TTo>
21
23
  return toHex(bytes) as Keccak256Hash<TTo>
22
24
  }
@@ -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
- fn: (args: TParameters[]) => Promise<TReturnType>
25
- id: number | string
26
- shouldSplitBatch?: (args: TParameters[]) => boolean
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
- let WebSocket = await import('isomorphic-ws')
150
- // Workaround for Vite.
151
- // https://github.com/vitejs/vite/issues/9703
152
- // TODO: Remove when issue is resolved.
153
- if (
154
- (WebSocket as unknown as { default?: typeof WebSocket }).default
155
- ?.constructor
156
- )
157
- WebSocket = (WebSocket as unknown as { default: typeof WebSocket }).default
158
- else WebSocket = WebSocket.WebSocket
159
-
160
- const webSocket = new WebSocket(url)
161
-
162
- // Set up a cache for incoming "synchronous" requests.
163
- const requests = new Map<Id, CallbackFn>()
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
- // Set up a cache for subscriptions (eth_subscribe).
166
- const subscriptions = new Map<Id, CallbackFn>()
188
+ // Setup event listeners for RPC & subscription responses.
189
+ webSocket.addEventListener('close', onClose)
190
+ webSocket.addEventListener('message', onMessage)
167
191
 
168
- const onMessage: (event: MessageEvent) => void = ({ data }) => {
169
- const message: RpcResponse = JSON.parse(data as string)
170
- const isSubscription = message.method === 'eth_subscription'
171
- const id = isSubscription ? message.params.subscription : message.id
172
- const cache = isSubscription ? subscriptions : requests
173
- const callback = cache.get(id)
174
- if (callback) callback({ data })
175
- if (!isSubscription) cache.delete(id)
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
- // Wait for the socket to open.
188
- if (webSocket.readyState === WebSocket.CONNECTING) {
189
- await new Promise((resolve, reject) => {
190
- if (!webSocket) return
191
- webSocket.onopen = resolve
192
- webSocket.onerror = reject
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
- // Create a new socket instance.
197
- socket = Object.assign(webSocket, {
198
- requests,
199
- subscriptions,
208
+ return [socket]
209
+ },
200
210
  })
201
- sockets.set(urlKey, socket)
202
211
 
203
- return socket
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
- const v = hexToNumber(`0x${signatureHex.slice(130)}`)
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(
@@ -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([
@@ -0,0 +1,5 @@
1
+ {
2
+ "types": "../dist/types/test.d.ts",
3
+ "module": "../dist/esm/test.js",
4
+ "main": "../dist/cjs/test.js"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "types": "../dist/types/utils/index.d.ts",
3
+ "module": "../dist/esm/utils/index.js",
4
+ "main": "../dist/cjs/utils/index.js"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "types": "../dist/types/wallet.d.ts",
3
+ "module": "../dist/esm/wallet.js",
4
+ "main": "../dist/cjs/wallet.js"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "types": "../dist/types/window.d.ts",
3
+ "module": "../dist/esm/window.js",
4
+ "main": "../dist/cjs/window.js"
5
+ }