@aa-sdk/core 4.0.0-alpha.0 → 4.0.0-alpha.1

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 (169) hide show
  1. package/dist/cjs/account/simple.js.map +1 -1
  2. package/dist/cjs/account/smartContractAccount.js +2 -1
  3. package/dist/cjs/account/smartContractAccount.js.map +1 -1
  4. package/dist/cjs/actions/smartAccount/buildUserOperation.js.map +1 -1
  5. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
  6. package/dist/cjs/actions/smartAccount/sendTransaction.js.map +1 -1
  7. package/dist/cjs/actions/smartAccount/sendTransactions.js.map +1 -1
  8. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
  9. package/dist/cjs/client/bundlerClient.js.map +1 -1
  10. package/dist/cjs/client/decorators/bundlerClient.js.map +1 -1
  11. package/dist/cjs/client/decorators/smartAccountClient.js.map +1 -1
  12. package/dist/cjs/client/smartAccountClient.js.map +1 -1
  13. package/dist/cjs/ens/utils.js.map +1 -1
  14. package/dist/cjs/entrypoint/index.js.map +1 -1
  15. package/dist/cjs/errors/account.js.map +1 -1
  16. package/dist/cjs/errors/base.js.map +1 -1
  17. package/dist/cjs/errors/client.js.map +1 -1
  18. package/dist/cjs/errors/entrypoint.js.map +1 -1
  19. package/dist/cjs/errors/signer.js.map +1 -1
  20. package/dist/cjs/errors/transaction.js.map +1 -1
  21. package/dist/cjs/index.d.ts +2 -2
  22. package/dist/cjs/index.js +2 -4
  23. package/dist/cjs/index.js.map +1 -1
  24. package/dist/cjs/logger.js.map +1 -1
  25. package/dist/cjs/middleware/defaults/feeEstimator.d.ts +1 -1
  26. package/dist/cjs/middleware/defaults/feeEstimator.js +17 -15
  27. package/dist/cjs/middleware/defaults/feeEstimator.js.map +1 -1
  28. package/dist/cjs/middleware/defaults/paymasterAndData.js.map +1 -1
  29. package/dist/cjs/middleware/defaults/userOpSigner.js.map +1 -1
  30. package/dist/cjs/signer/local-account.js.map +1 -1
  31. package/dist/cjs/signer/schema.js.map +1 -1
  32. package/dist/cjs/signer/utils.d.ts +1 -9
  33. package/dist/cjs/signer/utils.js +1 -16
  34. package/dist/cjs/signer/utils.js.map +1 -1
  35. package/dist/cjs/signer/wallet-client.js.map +1 -1
  36. package/dist/cjs/utils/index.d.ts +0 -1
  37. package/dist/cjs/utils/index.js +1 -9
  38. package/dist/cjs/utils/index.js.map +1 -1
  39. package/dist/cjs/version.d.ts +1 -1
  40. package/dist/cjs/version.js +1 -1
  41. package/dist/cjs/version.js.map +1 -1
  42. package/dist/esm/account/simple.js.map +1 -1
  43. package/dist/esm/account/smartContractAccount.js +2 -1
  44. package/dist/esm/account/smartContractAccount.js.map +1 -1
  45. package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -1
  46. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
  47. package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -1
  48. package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -1
  49. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
  50. package/dist/esm/client/bundlerClient.js.map +1 -1
  51. package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
  52. package/dist/esm/client/decorators/smartAccountClient.js.map +1 -1
  53. package/dist/esm/client/smartAccountClient.js.map +1 -1
  54. package/dist/esm/ens/utils.js.map +1 -1
  55. package/dist/esm/entrypoint/index.js.map +1 -1
  56. package/dist/esm/errors/account.js.map +1 -1
  57. package/dist/esm/errors/base.js.map +1 -1
  58. package/dist/esm/errors/client.js.map +1 -1
  59. package/dist/esm/errors/entrypoint.js.map +1 -1
  60. package/dist/esm/errors/signer.js.map +1 -1
  61. package/dist/esm/errors/transaction.js.map +1 -1
  62. package/dist/esm/index.d.ts +2 -2
  63. package/dist/esm/index.js +2 -2
  64. package/dist/esm/index.js.map +1 -1
  65. package/dist/esm/logger.js.map +1 -1
  66. package/dist/esm/middleware/defaults/feeEstimator.d.ts +1 -1
  67. package/dist/esm/middleware/defaults/feeEstimator.js +17 -15
  68. package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
  69. package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
  70. package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
  71. package/dist/esm/signer/local-account.js.map +1 -1
  72. package/dist/esm/signer/schema.js.map +1 -1
  73. package/dist/esm/signer/utils.d.ts +1 -9
  74. package/dist/esm/signer/utils.js +0 -14
  75. package/dist/esm/signer/utils.js.map +1 -1
  76. package/dist/esm/signer/wallet-client.js.map +1 -1
  77. package/dist/esm/utils/index.d.ts +0 -1
  78. package/dist/esm/utils/index.js +0 -7
  79. package/dist/esm/utils/index.js.map +1 -1
  80. package/dist/esm/version.d.ts +1 -1
  81. package/dist/esm/version.js +1 -1
  82. package/dist/esm/version.js.map +1 -1
  83. package/dist/types/account/smartContractAccount.d.ts +49 -0
  84. package/dist/types/account/smartContractAccount.d.ts.map +1 -1
  85. package/dist/types/actions/smartAccount/buildUserOperation.d.ts +23 -0
  86. package/dist/types/actions/smartAccount/buildUserOperation.d.ts.map +1 -1
  87. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts +22 -0
  88. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
  89. package/dist/types/actions/smartAccount/sendTransaction.d.ts +24 -0
  90. package/dist/types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
  91. package/dist/types/actions/smartAccount/sendTransactions.d.ts +23 -0
  92. package/dist/types/actions/smartAccount/sendTransactions.d.ts.map +1 -1
  93. package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts +24 -0
  94. package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts.map +1 -1
  95. package/dist/types/client/bundlerClient.d.ts +15 -0
  96. package/dist/types/client/bundlerClient.d.ts.map +1 -1
  97. package/dist/types/client/decorators/bundlerClient.d.ts +9 -0
  98. package/dist/types/client/decorators/bundlerClient.d.ts.map +1 -1
  99. package/dist/types/client/decorators/smartAccountClient.d.ts +8 -0
  100. package/dist/types/client/decorators/smartAccountClient.d.ts.map +1 -1
  101. package/dist/types/client/smartAccountClient.d.ts.map +1 -1
  102. package/dist/types/ens/utils.d.ts +45 -0
  103. package/dist/types/ens/utils.d.ts.map +1 -1
  104. package/dist/types/entrypoint/index.d.ts +14 -0
  105. package/dist/types/entrypoint/index.d.ts.map +1 -1
  106. package/dist/types/errors/account.d.ts +34 -0
  107. package/dist/types/errors/account.d.ts.map +1 -1
  108. package/dist/types/errors/base.d.ts +5 -0
  109. package/dist/types/errors/base.d.ts.map +1 -1
  110. package/dist/types/errors/client.d.ts +9 -0
  111. package/dist/types/errors/client.d.ts.map +1 -1
  112. package/dist/types/errors/entrypoint.d.ts +6 -0
  113. package/dist/types/errors/entrypoint.d.ts.map +1 -1
  114. package/dist/types/errors/signer.d.ts +3 -0
  115. package/dist/types/errors/signer.d.ts.map +1 -1
  116. package/dist/types/errors/transaction.d.ts +6 -0
  117. package/dist/types/errors/transaction.d.ts.map +1 -1
  118. package/dist/types/index.d.ts +2 -2
  119. package/dist/types/index.d.ts.map +1 -1
  120. package/dist/types/logger.d.ts +3 -0
  121. package/dist/types/logger.d.ts.map +1 -1
  122. package/dist/types/middleware/defaults/feeEstimator.d.ts +21 -1
  123. package/dist/types/middleware/defaults/feeEstimator.d.ts.map +1 -1
  124. package/dist/types/middleware/defaults/paymasterAndData.d.ts +8 -0
  125. package/dist/types/middleware/defaults/paymasterAndData.d.ts.map +1 -1
  126. package/dist/types/middleware/defaults/userOpSigner.d.ts +10 -0
  127. package/dist/types/middleware/defaults/userOpSigner.d.ts.map +1 -1
  128. package/dist/types/signer/local-account.d.ts +3 -0
  129. package/dist/types/signer/local-account.d.ts.map +1 -1
  130. package/dist/types/signer/schema.d.ts +14 -0
  131. package/dist/types/signer/schema.d.ts.map +1 -1
  132. package/dist/types/signer/utils.d.ts +21 -9
  133. package/dist/types/signer/utils.d.ts.map +1 -1
  134. package/dist/types/signer/wallet-client.d.ts +3 -0
  135. package/dist/types/signer/wallet-client.d.ts.map +1 -1
  136. package/dist/types/utils/index.d.ts +54 -1
  137. package/dist/types/utils/index.d.ts.map +1 -1
  138. package/dist/types/version.d.ts +1 -1
  139. package/package.json +2 -2
  140. package/src/account/simple.ts +6 -0
  141. package/src/account/smartContractAccount.ts +120 -15
  142. package/src/actions/smartAccount/buildUserOperation.ts +23 -0
  143. package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +22 -0
  144. package/src/actions/smartAccount/sendTransaction.ts +24 -0
  145. package/src/actions/smartAccount/sendTransactions.ts +23 -0
  146. package/src/actions/smartAccount/waitForUserOperationTransacation.ts +24 -0
  147. package/src/client/bundlerClient.ts +32 -0
  148. package/src/client/decorators/bundlerClient.ts +9 -0
  149. package/src/client/decorators/smartAccountClient.ts +8 -0
  150. package/src/client/smartAccountClient.ts +41 -0
  151. package/src/ens/utils.ts +45 -0
  152. package/src/entrypoint/index.ts +30 -62
  153. package/src/errors/account.ts +34 -0
  154. package/src/errors/base.ts +5 -2
  155. package/src/errors/client.ts +9 -0
  156. package/src/errors/entrypoint.ts +6 -0
  157. package/src/errors/signer.ts +3 -0
  158. package/src/errors/transaction.ts +6 -0
  159. package/src/index.ts +1 -5
  160. package/src/logger.ts +3 -0
  161. package/src/middleware/defaults/feeEstimator.ts +24 -4
  162. package/src/middleware/defaults/paymasterAndData.ts +8 -0
  163. package/src/middleware/defaults/userOpSigner.ts +10 -0
  164. package/src/signer/local-account.ts +3 -0
  165. package/src/signer/schema.ts +14 -0
  166. package/src/signer/utils.ts +20 -32
  167. package/src/signer/wallet-client.ts +3 -0
  168. package/src/utils/index.ts +54 -13
  169. package/src/version.ts +1 -1
@@ -97,19 +97,23 @@ export function deepHexlify(obj: any): any {
97
97
  );
98
98
  }
99
99
 
100
- // borrowed from ethers.js
101
- export function defineReadOnly<T, K extends keyof T>(
102
- object: T,
103
- key: K,
104
- value: T[K]
105
- ): void {
106
- Object.defineProperty(object, key, {
107
- enumerable: true,
108
- value: value,
109
- writable: false,
110
- });
111
- }
112
-
100
+ /**
101
+ * Filters out properties with undefined or null values from the provided object.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * import { filterUndefined } from "@aa-sdk/core";
106
+ *
107
+ * const result = filterUndefined({
108
+ * foo: undefined,
109
+ * bar: null,
110
+ * baz: "baz",
111
+ * }); // { baz: "baz" }
112
+ * ```
113
+ *
114
+ * @param {T} obj the object from which to remove properties with undefined or null values
115
+ * @returns {T} the object with undefined or null properties removed
116
+ */
113
117
  export function filterUndefined<T>(obj: T): T {
114
118
  for (const key in obj) {
115
119
  if (obj[key] == null) {
@@ -119,6 +123,23 @@ export function filterUndefined<T>(obj: T): T {
119
123
  return obj as T;
120
124
  }
121
125
 
126
+ /**
127
+ * Picks the specified keys from an object and returns a new object containing only those key-value pairs.
128
+ *
129
+ * @example
130
+ * ```ts
131
+ * import { pick } from "@aa-sdk/core";
132
+ *
133
+ * const picked = pick({
134
+ * foo: "foo",
135
+ * bar: "bar",
136
+ * }, ["foo"]); // { foo: "foo" }
137
+ * ```
138
+ *
139
+ * @param {Record<string, unknown>} obj The object from which to pick keys
140
+ * @param {string|string[]} keys A single key or an array of keys to pick from the object
141
+ * @returns {Record<string, unknown>} A new object containing only the picked key-value pairs
142
+ */
122
143
  export function pick(obj: Record<string, unknown>, keys: string | string[]) {
123
144
  return Object.keys(obj)
124
145
  .filter((k) => keys.includes(k))
@@ -151,6 +172,26 @@ export const conditionalReturn = <T>(
151
172
  value: () => Promise<T>
152
173
  ): Promise<T | undefined> => condition.then((t) => (t ? value() : undefined));
153
174
 
175
+ /**
176
+ * Converts an array of objects into a record (object) where each key is determined by the specified selector and the value is determined by the provided function.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * import { toRecord } from "@aa-sdk/core";
181
+ * import { sepolia, mainnet } from "viem/chains";
182
+ *
183
+ * const addressesByChain = toRecord(
184
+ * [sepolia, mainnet],
185
+ * "id",
186
+ * () => "0x..."
187
+ * ); // { [sepolia.id]: "0x...", [mainnet.id]: "0x..." }
188
+ * ```
189
+ *
190
+ * @param {T[]} array The array of objects to convert to a record
191
+ * @param {K} selector The key used to select the property that will become the record's key
192
+ * @param {(item: T) => V} fn The function that transforms each item in the array into the record's value
193
+ * @returns {Record<T[K], V>} The resulting record object
194
+ */
154
195
  export const toRecord = <
155
196
  T extends { [K in RecordableKeys<T>]: string | number | symbol },
156
197
  K extends RecordableKeys<T>,
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.0.0-alpha.0";
3
+ export const VERSION = "4.0.0-alpha.1";