tempo.ts 0.0.6 → 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.
Files changed (195) hide show
  1. package/dist/chains.d.ts +244 -541
  2. package/dist/chains.d.ts.map +1 -1
  3. package/dist/chains.js +10 -23
  4. package/dist/chains.js.map +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/ox/SignatureEnvelope.d.ts +245 -0
  7. package/dist/ox/SignatureEnvelope.d.ts.map +1 -0
  8. package/dist/ox/SignatureEnvelope.js +437 -0
  9. package/dist/ox/SignatureEnvelope.js.map +1 -0
  10. package/dist/ox/Transaction.d.ts +61 -24
  11. package/dist/ox/Transaction.d.ts.map +1 -1
  12. package/dist/ox/Transaction.js +63 -18
  13. package/dist/ox/Transaction.js.map +1 -1
  14. package/dist/ox/TransactionEnvelopeAA.d.ts +461 -0
  15. package/dist/ox/TransactionEnvelopeAA.d.ts.map +1 -0
  16. package/dist/ox/TransactionEnvelopeAA.js +528 -0
  17. package/dist/ox/TransactionEnvelopeAA.js.map +1 -0
  18. package/dist/ox/TransactionRequest.d.ts +7 -5
  19. package/dist/ox/TransactionRequest.d.ts.map +1 -1
  20. package/dist/ox/TransactionRequest.js +21 -12
  21. package/dist/ox/TransactionRequest.js.map +1 -1
  22. package/dist/ox/index.d.ts +5 -4
  23. package/dist/ox/index.d.ts.map +1 -1
  24. package/dist/ox/index.js +5 -4
  25. package/dist/ox/index.js.map +1 -1
  26. package/dist/prool/Instance.d.ts +0 -4
  27. package/dist/prool/Instance.d.ts.map +1 -1
  28. package/dist/prool/Instance.js +7 -7
  29. package/dist/prool/Instance.js.map +1 -1
  30. package/dist/prool/index.d.ts +1 -1
  31. package/dist/prool/index.d.ts.map +1 -1
  32. package/dist/prool/index.js +1 -1
  33. package/dist/prool/index.js.map +1 -1
  34. package/dist/viem/{abis.d.ts → Abis.d.ts} +523 -9
  35. package/dist/viem/Abis.d.ts.map +1 -0
  36. package/dist/viem/{abis.js → Abis.js} +321 -9
  37. package/dist/viem/Abis.js.map +1 -0
  38. package/dist/viem/{actions → Actions}/amm.d.ts +21 -21
  39. package/dist/viem/Actions/amm.d.ts.map +1 -0
  40. package/dist/viem/{actions → Actions}/amm.js +55 -43
  41. package/dist/viem/Actions/amm.js.map +1 -0
  42. package/dist/viem/Actions/dex.d.ts +3263 -0
  43. package/dist/viem/Actions/dex.d.ts.map +1 -0
  44. package/dist/viem/Actions/dex.js +1357 -0
  45. package/dist/viem/Actions/dex.js.map +1 -0
  46. package/dist/viem/{actions → Actions}/fee.d.ts +8 -8
  47. package/dist/viem/Actions/fee.d.ts.map +1 -0
  48. package/dist/viem/{actions → Actions}/fee.js +14 -13
  49. package/dist/viem/Actions/fee.js.map +1 -0
  50. package/dist/viem/Actions/index.d.ts +6 -0
  51. package/dist/viem/Actions/index.d.ts.map +1 -0
  52. package/dist/viem/Actions/index.js +6 -0
  53. package/dist/viem/Actions/index.js.map +1 -0
  54. package/dist/viem/{actions → Actions}/policy.d.ts +19 -19
  55. package/dist/viem/Actions/policy.d.ts.map +1 -0
  56. package/dist/viem/{actions → Actions}/policy.js +59 -46
  57. package/dist/viem/Actions/policy.js.map +1 -0
  58. package/dist/viem/{actions → Actions}/token.d.ts +3250 -700
  59. package/dist/viem/Actions/token.d.ts.map +1 -0
  60. package/dist/viem/{actions → Actions}/token.js +419 -83
  61. package/dist/viem/Actions/token.js.map +1 -0
  62. package/dist/viem/Addresses.d.ts +9 -0
  63. package/dist/viem/Addresses.d.ts.map +1 -0
  64. package/dist/viem/Addresses.js +9 -0
  65. package/dist/viem/Addresses.js.map +1 -0
  66. package/dist/viem/{chain.d.ts → Chain.d.ts} +81 -57
  67. package/dist/viem/Chain.d.ts.map +1 -0
  68. package/dist/viem/{chain.js → Chain.js} +7 -7
  69. package/dist/viem/Chain.js.map +1 -0
  70. package/dist/viem/{client.d.ts → Client.d.ts} +4 -4
  71. package/dist/viem/Client.d.ts.map +1 -0
  72. package/dist/viem/{client.js → Client.js} +3 -3
  73. package/dist/viem/Client.js.map +1 -0
  74. package/dist/viem/{decorator.d.ts → Decorator.d.ts} +507 -5
  75. package/dist/viem/Decorator.d.ts.map +1 -0
  76. package/dist/viem/{decorator.js → Decorator.js} +31 -5
  77. package/dist/viem/Decorator.js.map +1 -0
  78. package/dist/viem/{formatters.d.ts → Formatters.d.ts} +2 -2
  79. package/dist/viem/Formatters.d.ts.map +1 -0
  80. package/dist/viem/{formatters.js → Formatters.js} +24 -17
  81. package/dist/viem/Formatters.js.map +1 -0
  82. package/dist/viem/Tick.d.ts +111 -0
  83. package/dist/viem/Tick.d.ts.map +1 -0
  84. package/dist/viem/Tick.js +127 -0
  85. package/dist/viem/Tick.js.map +1 -0
  86. package/dist/viem/TokenIds.d.ts +3 -0
  87. package/dist/viem/TokenIds.d.ts.map +1 -0
  88. package/dist/viem/TokenIds.js +3 -0
  89. package/dist/viem/TokenIds.js.map +1 -0
  90. package/dist/viem/Transaction.d.ts +57 -0
  91. package/dist/viem/Transaction.d.ts.map +1 -0
  92. package/dist/viem/Transaction.js +137 -0
  93. package/dist/viem/Transaction.js.map +1 -0
  94. package/dist/viem/{transport.d.ts → Transport.d.ts} +3 -3
  95. package/dist/viem/Transport.d.ts.map +1 -0
  96. package/dist/viem/{transport.js → Transport.js} +3 -3
  97. package/dist/viem/Transport.js.map +1 -0
  98. package/dist/viem/index.d.ts +13 -9
  99. package/dist/viem/index.d.ts.map +1 -1
  100. package/dist/viem/index.js +13 -9
  101. package/dist/viem/index.js.map +1 -1
  102. package/dist/viem/{types.d.ts → internal/types.d.ts} +3 -3
  103. package/dist/viem/internal/types.d.ts.map +1 -0
  104. package/dist/viem/{types.js.map → internal/types.js.map} +1 -1
  105. package/dist/viem/internal/utils.d.ts.map +1 -0
  106. package/dist/viem/internal/utils.js.map +1 -0
  107. package/package.json +87 -101
  108. package/src/chains.ts +10 -24
  109. package/src/ox/SignatureEnvelope.test.ts +1252 -0
  110. package/src/ox/SignatureEnvelope.ts +709 -0
  111. package/src/ox/Transaction.test.ts +144 -89
  112. package/src/ox/Transaction.ts +104 -29
  113. package/src/ox/TransactionEnvelopeAA.test.ts +1533 -0
  114. package/src/ox/TransactionEnvelopeAA.ts +858 -0
  115. package/src/ox/TransactionRequest.ts +25 -17
  116. package/src/ox/index.ts +2 -1
  117. package/src/prool/Instance.ts +6 -14
  118. package/src/prool/internal/chain.json +101 -27
  119. package/src/viem/{abis.ts → Abis.ts} +322 -8
  120. package/src/viem/{actions → Actions}/amm.test.ts +65 -68
  121. package/src/viem/{actions → Actions}/amm.ts +72 -60
  122. package/src/viem/Actions/dex.test.ts +1608 -0
  123. package/src/viem/Actions/dex.ts +2026 -0
  124. package/src/viem/{actions → Actions}/fee.test.ts +34 -36
  125. package/src/viem/{actions → Actions}/fee.ts +18 -17
  126. package/src/viem/{actions → Actions}/index.ts +1 -0
  127. package/src/viem/{actions → Actions}/policy.test.ts +2 -2
  128. package/src/viem/{actions → Actions}/policy.ts +77 -64
  129. package/src/viem/{actions → Actions}/token.test.ts +403 -64
  130. package/src/viem/{actions → Actions}/token.ts +672 -133
  131. package/src/viem/Addresses.ts +9 -0
  132. package/src/viem/{chain.ts → Chain.ts} +6 -6
  133. package/src/viem/{client.bench-d.ts → Client.bench-d.ts} +2 -2
  134. package/src/viem/{client.test.ts → Client.test.ts} +31 -6
  135. package/src/viem/{client.ts → Client.ts} +1 -1
  136. package/src/viem/{decorator.bench-d.ts → Decorator.bench-d.ts} +2 -2
  137. package/src/viem/{decorator.test.ts → Decorator.test.ts} +1 -0
  138. package/src/viem/{decorator.ts → Decorator.ts} +586 -4
  139. package/src/viem/{formatters.ts → Formatters.ts} +31 -20
  140. package/src/viem/Tick.test.ts +281 -0
  141. package/src/viem/Tick.ts +176 -0
  142. package/src/viem/TokenIds.ts +2 -0
  143. package/src/viem/Transaction.ts +303 -0
  144. package/src/viem/{transport.ts → Transport.ts} +5 -5
  145. package/src/viem/e2e.test.ts +153 -78
  146. package/src/viem/index.ts +13 -9
  147. package/src/viem/{types.ts → internal/types.ts} +3 -3
  148. package/dist/ox/TransactionEnvelopeFeeToken.d.ts +0 -393
  149. package/dist/ox/TransactionEnvelopeFeeToken.d.ts.map +0 -1
  150. package/dist/ox/TransactionEnvelopeFeeToken.js +0 -452
  151. package/dist/ox/TransactionEnvelopeFeeToken.js.map +0 -1
  152. package/dist/viem/abis.d.ts.map +0 -1
  153. package/dist/viem/abis.js.map +0 -1
  154. package/dist/viem/actions/amm.d.ts.map +0 -1
  155. package/dist/viem/actions/amm.js.map +0 -1
  156. package/dist/viem/actions/fee.d.ts.map +0 -1
  157. package/dist/viem/actions/fee.js.map +0 -1
  158. package/dist/viem/actions/index.d.ts +0 -5
  159. package/dist/viem/actions/index.d.ts.map +0 -1
  160. package/dist/viem/actions/index.js +0 -5
  161. package/dist/viem/actions/index.js.map +0 -1
  162. package/dist/viem/actions/policy.d.ts.map +0 -1
  163. package/dist/viem/actions/policy.js.map +0 -1
  164. package/dist/viem/actions/token.d.ts.map +0 -1
  165. package/dist/viem/actions/token.js.map +0 -1
  166. package/dist/viem/addresses.d.ts +0 -8
  167. package/dist/viem/addresses.d.ts.map +0 -1
  168. package/dist/viem/addresses.js +0 -8
  169. package/dist/viem/addresses.js.map +0 -1
  170. package/dist/viem/chain.d.ts.map +0 -1
  171. package/dist/viem/chain.js.map +0 -1
  172. package/dist/viem/client.d.ts.map +0 -1
  173. package/dist/viem/client.js.map +0 -1
  174. package/dist/viem/decorator.d.ts.map +0 -1
  175. package/dist/viem/decorator.js.map +0 -1
  176. package/dist/viem/formatters.d.ts.map +0 -1
  177. package/dist/viem/formatters.js.map +0 -1
  178. package/dist/viem/transaction.d.ts +0 -54
  179. package/dist/viem/transaction.d.ts.map +0 -1
  180. package/dist/viem/transaction.js +0 -108
  181. package/dist/viem/transaction.js.map +0 -1
  182. package/dist/viem/transport.d.ts.map +0 -1
  183. package/dist/viem/transport.js.map +0 -1
  184. package/dist/viem/types.d.ts.map +0 -1
  185. package/dist/viem/utils.d.ts.map +0 -1
  186. package/dist/viem/utils.js.map +0 -1
  187. package/src/ox/TransactionEnvelopeFeeToken.test.ts +0 -1119
  188. package/src/ox/TransactionEnvelopeFeeToken.ts +0 -717
  189. package/src/prool/internal/consensus.toml +0 -32
  190. package/src/viem/addresses.ts +0 -10
  191. package/src/viem/transaction.ts +0 -253
  192. /package/dist/viem/{types.js → internal/types.js} +0 -0
  193. /package/dist/viem/{utils.d.ts → internal/utils.d.ts} +0 -0
  194. /package/dist/viem/{utils.js → internal/utils.js} +0 -0
  195. /package/src/viem/{utils.ts → internal/utils.ts} +0 -0
@@ -7,7 +7,9 @@ import * as Secp256k1 from 'ox/Secp256k1'
7
7
  import * as Signature from 'ox/Signature'
8
8
  import * as ox_Transaction from 'ox/Transaction'
9
9
  import type { Compute, OneOf, UnionCompute } from '../internal/types.js'
10
- import * as TransactionEnvelopeFeeToken from './TransactionEnvelopeFeeToken.js'
10
+ import * as SignatureEnvelope from './SignatureEnvelope.js'
11
+ import type { Call } from './TransactionEnvelopeAA.js'
12
+ import * as TransactionEnvelopeAA from './TransactionEnvelopeAA.js'
11
13
 
12
14
  /**
13
15
  * A Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml).
@@ -18,7 +20,7 @@ export type Transaction<
18
20
  numberType = number,
19
21
  > = UnionCompute<
20
22
  OneOf<
21
- | FeeToken<pending, bigintType, numberType>
23
+ | AA<pending, bigintType, numberType>
22
24
  | ox_Transaction.Transaction<pending, bigintType, numberType>
23
25
  >
24
26
  >
@@ -27,25 +29,31 @@ export type Transaction<
27
29
  * An RPC Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml).
28
30
  */
29
31
  export type Rpc<pending extends boolean = false> = UnionCompute<
30
- OneOf<FeeTokenRpc<pending> | ox_Transaction.Rpc<pending>>
32
+ OneOf<AARpc<pending> | ox_Transaction.Rpc<pending>>
31
33
  >
32
34
 
33
35
  /**
34
- * Fee token transaction.
36
+ * Native account abstraction transaction.
35
37
  */
36
- export type FeeToken<
38
+ export type AA<
37
39
  pending extends boolean = false,
38
40
  bigintType = bigint,
39
41
  numberType = number,
40
- type extends string = 'feeToken',
42
+ type extends string = 'aa',
41
43
  > = Compute<
42
- ox_Transaction.Base<type, pending, bigintType, numberType> & {
44
+ Omit<
45
+ ox_Transaction.Base<type, pending, bigintType, numberType>,
46
+ // AA transactions don't have these properties.
47
+ 'input' | 'to' | 'value' | 'v' | 'r' | 's' | 'yParity'
48
+ > & {
43
49
  /** EIP-2930 Access List. */
44
50
  accessList: AccessList.AccessList
45
51
  /** EIP-7702 Authorization list for the transaction. */
46
- authorizationList: Authorization.ListSigned<bigintType, numberType>
47
- /** Fee token preference. */
48
- feeToken: Address.Address
52
+ authorizationList?:
53
+ | Authorization.ListSigned<bigintType, numberType>
54
+ | undefined
55
+ /** Array of calls to execute. */
56
+ calls: readonly Call<bigintType>[]
49
57
  /** Fee payer address. */
50
58
  feePayer?: Address.Address | undefined
51
59
  /** Fee payer signature. */
@@ -61,26 +69,48 @@ export type FeeToken<
61
69
  v?: numberType | undefined
62
70
  }
63
71
  | undefined
72
+ /** Fee token preference. */
73
+ feeToken: Address.Address
64
74
  /** Effective gas price paid by the sender in wei. */
65
75
  gasPrice?: bigintType | undefined
66
76
  /** Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas). */
67
77
  maxFeePerGas: bigintType
68
78
  /** Max priority fee per gas (in wei). */
69
79
  maxPriorityFeePerGas: bigintType
80
+ /** Nonce key for 2D nonce system (192 bits). */
81
+ nonceKey?: bigintType | undefined
82
+ /** Sender signature. */
83
+ signature: SignatureEnvelope.SignatureEnvelope<bigintType, numberType>
84
+ /** Transaction can only be included in a block before this timestamp. */
85
+ validBefore?: numberType | undefined
86
+ /** Transaction can only be included in a block after this timestamp. */
87
+ validAfter?: numberType | undefined
70
88
  }
71
89
  >
72
90
 
73
91
  /**
74
- * Fee token transaction in RPC format.
92
+ * Native account abstraction transaction in RPC format.
75
93
  */
76
- export type FeeTokenRpc<pending extends boolean = false> = Compute<
77
- FeeToken<pending, Hex.Hex, Hex.Hex, ToRpcType['feeToken']>
94
+ export type AARpc<pending extends boolean = false> = Compute<
95
+ Omit<
96
+ AA<pending, Hex.Hex, Hex.Hex, ToRpcType['aa']>,
97
+ 'calls' | 'signature'
98
+ > & {
99
+ calls:
100
+ | readonly {
101
+ input?: Hex.Hex | undefined
102
+ to?: Hex.Hex | undefined
103
+ value?: Hex.Hex | undefined
104
+ }[]
105
+ | undefined
106
+ signature: SignatureEnvelope.SignatureEnvelopeRpc
107
+ }
78
108
  >
79
109
 
80
110
  /** Type to RPC Type mapping. */
81
111
  export const toRpcType = {
82
112
  ...ox_Transaction.toRpcType,
83
- feeToken: '0x77',
113
+ aa: '0x76',
84
114
  } as const
85
115
 
86
116
  /** Type to RPC Type mapping. */
@@ -91,7 +121,7 @@ export type ToRpcType = typeof toRpcType & {
91
121
  /** RPC Type to Type mapping. */
92
122
  export const fromRpcType = {
93
123
  ...ox_Transaction.fromRpcType,
94
- '0x77': 'feeToken',
124
+ '0x76': 'aa',
95
125
  } as const
96
126
 
97
127
  /** RPC Type to Type mapping. */
@@ -113,22 +143,31 @@ export type FromRpcType = typeof fromRpcType & {
113
143
  * blockHash:
114
144
  * '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
115
145
  * blockNumber: '0x12f296f',
146
+ * calls: [
147
+ * {
148
+ * input: '0xdeadbeef',
149
+ * to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
150
+ * value: '0x9b6e64a8ec60000',
151
+ * },
152
+ * ],
116
153
  * feeToken: '0x20c0000000000000000000000000000000000000',
117
154
  * transactionIndex: '0x2',
118
155
  * from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
119
- * to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
120
156
  * value: '0x9b6e64a8ec60000',
121
157
  * gas: '0x43f5d',
122
158
  * maxFeePerGas: '0x2ca6ae494',
123
159
  * maxPriorityFeePerGas: '0x41cc3c0',
124
160
  * input:
125
161
  * '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006643504700000000000000000000000000000000000000000000000000000000000000040b080604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec60000000000000000000000000000000000000000000000000000019124bb5ae978c000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000190240001b9872b',
126
- * r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
127
- * s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
128
- * yParity: '0x0',
162
+ * signature: {
163
+ * r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
164
+ * s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
165
+ * type: 'secp256k1',
166
+ * yParity: '0x0',
167
+ * },
129
168
  * chainId: '0x1',
130
169
  * accessList: [],
131
- * type: '0x77',
170
+ * type: '0x76',
132
171
  * })
133
172
  * ```
134
173
  *
@@ -149,6 +188,21 @@ export function fromRpc<
149
188
  ) as Transaction<pending>
150
189
 
151
190
  transaction_.type = fromRpcType[transaction.type as keyof typeof fromRpcType]
191
+
192
+ if (transaction.calls)
193
+ transaction_.calls = transaction.calls.map((call) => ({
194
+ to: call.to,
195
+ value: call.value ? BigInt(call.value) : undefined,
196
+ data: call.input,
197
+ }))
198
+ if (transaction.feeToken) transaction_.feeToken = transaction.feeToken
199
+ if (transaction.nonceKey) transaction_.nonceKey = BigInt(transaction.nonceKey)
200
+ if (transaction.signature)
201
+ transaction_.signature = SignatureEnvelope.fromRpc(transaction.signature)
202
+ if (transaction.validAfter)
203
+ transaction_.validAfter = Number(transaction.validAfter)
204
+ if (transaction.validBefore)
205
+ transaction_.validBefore = Number(transaction.validBefore)
152
206
  if (transaction.feePayerSignature) {
153
207
  transaction_.feePayerSignature = Signature.fromRpc(
154
208
  transaction.feePayerSignature,
@@ -159,14 +213,13 @@ export function fromRpc<
159
213
 
160
214
  // TODO: remove once `feePayer` returned on `eth_getTxBy*`.
161
215
  transaction_.feePayer = Secp256k1.recoverAddress({
162
- payload: TransactionEnvelopeFeeToken.getFeePayerSignPayload(
216
+ payload: TransactionEnvelopeAA.getFeePayerSignPayload(
163
217
  transaction_ as never,
164
218
  { sender: transaction.from },
165
219
  ),
166
220
  signature: transaction_.feePayerSignature,
167
221
  })
168
222
  }
169
- if (transaction.feeToken) transaction_.feeToken = transaction.feeToken
170
223
 
171
224
  return transaction_ as never
172
225
  }
@@ -191,6 +244,13 @@ export declare namespace fromRpc {
191
244
  * blockHash:
192
245
  * '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
193
246
  * blockNumber: 19868015n,
247
+ * calls: [
248
+ * {
249
+ * data: '0xdeadbeef',
250
+ * to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
251
+ * value: 700000000000000000n,
252
+ * },
253
+ * ],
194
254
  * chainId: 1,
195
255
  * feeToken: '0x20c0000000000000000000000000000000000000',
196
256
  * from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
@@ -201,14 +261,16 @@ export declare namespace fromRpc {
201
261
  * maxFeePerGas: 11985937556n,
202
262
  * maxPriorityFeePerGas: 68993984n,
203
263
  * nonce: 855n,
204
- * r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
205
- * s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
206
- * to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
264
+ * signature: {
265
+ * signature: {
266
+ * r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
267
+ * s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
268
+ * yParity: 0,
269
+ * },
270
+ * type: 'secp256k1',
271
+ * },
207
272
  * transactionIndex: 2,
208
- * type: 'feeToken',
209
- * v: 27,
210
- * value: 700000000000000000n,
211
- * yParity: 0,
273
+ * type: 'aa',
212
274
  * })
213
275
  * ```
214
276
  *
@@ -224,6 +286,13 @@ export function toRpc<pending extends boolean = false>(
224
286
  ) as Rpc<pending>
225
287
 
226
288
  rpc.type = toRpcType[transaction.type as keyof typeof toRpcType]
289
+
290
+ if (transaction.calls)
291
+ rpc.calls = transaction.calls.map((call) => ({
292
+ to: call.to,
293
+ value: call.value ? Hex.fromNumber(call.value) : undefined,
294
+ data: call.data,
295
+ }))
227
296
  if (transaction.feeToken) rpc.feeToken = transaction.feeToken
228
297
  if (transaction.feePayerSignature) {
229
298
  rpc.feePayerSignature = Signature.toRpc(
@@ -234,6 +303,12 @@ export function toRpc<pending extends boolean = false>(
234
303
  )
235
304
  rpc.feePayer = transaction.feePayer
236
305
  }
306
+ if (transaction.signature)
307
+ rpc.signature = SignatureEnvelope.toRpc(transaction.signature)
308
+ if (typeof transaction.validAfter === 'number')
309
+ rpc.validAfter = Hex.fromNumber(transaction.validAfter)
310
+ if (typeof transaction.validBefore === 'number')
311
+ rpc.validBefore = Hex.fromNumber(transaction.validBefore)
237
312
 
238
313
  return rpc as Rpc<pending>
239
314
  }