@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.
- package/dist/cjs/account/simple.js.map +1 -1
- package/dist/cjs/account/smartContractAccount.js +2 -1
- package/dist/cjs/account/smartContractAccount.js.map +1 -1
- package/dist/cjs/actions/smartAccount/buildUserOperation.js.map +1 -1
- package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
- package/dist/cjs/actions/smartAccount/sendTransaction.js.map +1 -1
- package/dist/cjs/actions/smartAccount/sendTransactions.js.map +1 -1
- package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
- package/dist/cjs/client/bundlerClient.js.map +1 -1
- package/dist/cjs/client/decorators/bundlerClient.js.map +1 -1
- package/dist/cjs/client/decorators/smartAccountClient.js.map +1 -1
- package/dist/cjs/client/smartAccountClient.js.map +1 -1
- package/dist/cjs/ens/utils.js.map +1 -1
- package/dist/cjs/entrypoint/index.js.map +1 -1
- package/dist/cjs/errors/account.js.map +1 -1
- package/dist/cjs/errors/base.js.map +1 -1
- package/dist/cjs/errors/client.js.map +1 -1
- package/dist/cjs/errors/entrypoint.js.map +1 -1
- package/dist/cjs/errors/signer.js.map +1 -1
- package/dist/cjs/errors/transaction.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +2 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logger.js.map +1 -1
- package/dist/cjs/middleware/defaults/feeEstimator.d.ts +1 -1
- package/dist/cjs/middleware/defaults/feeEstimator.js +17 -15
- package/dist/cjs/middleware/defaults/feeEstimator.js.map +1 -1
- package/dist/cjs/middleware/defaults/paymasterAndData.js.map +1 -1
- package/dist/cjs/middleware/defaults/userOpSigner.js.map +1 -1
- package/dist/cjs/signer/local-account.js.map +1 -1
- package/dist/cjs/signer/schema.js.map +1 -1
- package/dist/cjs/signer/utils.d.ts +1 -9
- package/dist/cjs/signer/utils.js +1 -16
- package/dist/cjs/signer/utils.js.map +1 -1
- package/dist/cjs/signer/wallet-client.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +0 -1
- package/dist/cjs/utils/index.js +1 -9
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/account/simple.js.map +1 -1
- package/dist/esm/account/smartContractAccount.js +2 -1
- package/dist/esm/account/smartContractAccount.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -1
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
- package/dist/esm/client/bundlerClient.js.map +1 -1
- package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
- package/dist/esm/client/decorators/smartAccountClient.js.map +1 -1
- package/dist/esm/client/smartAccountClient.js.map +1 -1
- package/dist/esm/ens/utils.js.map +1 -1
- package/dist/esm/entrypoint/index.js.map +1 -1
- package/dist/esm/errors/account.js.map +1 -1
- package/dist/esm/errors/base.js.map +1 -1
- package/dist/esm/errors/client.js.map +1 -1
- package/dist/esm/errors/entrypoint.js.map +1 -1
- package/dist/esm/errors/signer.js.map +1 -1
- package/dist/esm/errors/transaction.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/middleware/defaults/feeEstimator.d.ts +1 -1
- package/dist/esm/middleware/defaults/feeEstimator.js +17 -15
- package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
- package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
- package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
- package/dist/esm/signer/local-account.js.map +1 -1
- package/dist/esm/signer/schema.js.map +1 -1
- package/dist/esm/signer/utils.d.ts +1 -9
- package/dist/esm/signer/utils.js +0 -14
- package/dist/esm/signer/utils.js.map +1 -1
- package/dist/esm/signer/wallet-client.js.map +1 -1
- package/dist/esm/utils/index.d.ts +0 -1
- package/dist/esm/utils/index.js +0 -7
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/account/smartContractAccount.d.ts +49 -0
- package/dist/types/account/smartContractAccount.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/buildUserOperation.d.ts +23 -0
- package/dist/types/actions/smartAccount/buildUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts +22 -0
- package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/sendTransaction.d.ts +24 -0
- package/dist/types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/sendTransactions.d.ts +23 -0
- package/dist/types/actions/smartAccount/sendTransactions.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts +24 -0
- package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts.map +1 -1
- package/dist/types/client/bundlerClient.d.ts +15 -0
- package/dist/types/client/bundlerClient.d.ts.map +1 -1
- package/dist/types/client/decorators/bundlerClient.d.ts +9 -0
- package/dist/types/client/decorators/bundlerClient.d.ts.map +1 -1
- package/dist/types/client/decorators/smartAccountClient.d.ts +8 -0
- package/dist/types/client/decorators/smartAccountClient.d.ts.map +1 -1
- package/dist/types/client/smartAccountClient.d.ts.map +1 -1
- package/dist/types/ens/utils.d.ts +45 -0
- package/dist/types/ens/utils.d.ts.map +1 -1
- package/dist/types/entrypoint/index.d.ts +14 -0
- package/dist/types/entrypoint/index.d.ts.map +1 -1
- package/dist/types/errors/account.d.ts +34 -0
- package/dist/types/errors/account.d.ts.map +1 -1
- package/dist/types/errors/base.d.ts +5 -0
- package/dist/types/errors/base.d.ts.map +1 -1
- package/dist/types/errors/client.d.ts +9 -0
- package/dist/types/errors/client.d.ts.map +1 -1
- package/dist/types/errors/entrypoint.d.ts +6 -0
- package/dist/types/errors/entrypoint.d.ts.map +1 -1
- package/dist/types/errors/signer.d.ts +3 -0
- package/dist/types/errors/signer.d.ts.map +1 -1
- package/dist/types/errors/transaction.d.ts +6 -0
- package/dist/types/errors/transaction.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logger.d.ts +3 -0
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/middleware/defaults/feeEstimator.d.ts +21 -1
- package/dist/types/middleware/defaults/feeEstimator.d.ts.map +1 -1
- package/dist/types/middleware/defaults/paymasterAndData.d.ts +8 -0
- package/dist/types/middleware/defaults/paymasterAndData.d.ts.map +1 -1
- package/dist/types/middleware/defaults/userOpSigner.d.ts +10 -0
- package/dist/types/middleware/defaults/userOpSigner.d.ts.map +1 -1
- package/dist/types/signer/local-account.d.ts +3 -0
- package/dist/types/signer/local-account.d.ts.map +1 -1
- package/dist/types/signer/schema.d.ts +14 -0
- package/dist/types/signer/schema.d.ts.map +1 -1
- package/dist/types/signer/utils.d.ts +21 -9
- package/dist/types/signer/utils.d.ts.map +1 -1
- package/dist/types/signer/wallet-client.d.ts +3 -0
- package/dist/types/signer/wallet-client.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +54 -1
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/account/simple.ts +6 -0
- package/src/account/smartContractAccount.ts +120 -15
- package/src/actions/smartAccount/buildUserOperation.ts +23 -0
- package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +22 -0
- package/src/actions/smartAccount/sendTransaction.ts +24 -0
- package/src/actions/smartAccount/sendTransactions.ts +23 -0
- package/src/actions/smartAccount/waitForUserOperationTransacation.ts +24 -0
- package/src/client/bundlerClient.ts +32 -0
- package/src/client/decorators/bundlerClient.ts +9 -0
- package/src/client/decorators/smartAccountClient.ts +8 -0
- package/src/client/smartAccountClient.ts +41 -0
- package/src/ens/utils.ts +45 -0
- package/src/entrypoint/index.ts +30 -62
- package/src/errors/account.ts +34 -0
- package/src/errors/base.ts +5 -2
- package/src/errors/client.ts +9 -0
- package/src/errors/entrypoint.ts +6 -0
- package/src/errors/signer.ts +3 -0
- package/src/errors/transaction.ts +6 -0
- package/src/index.ts +1 -5
- package/src/logger.ts +3 -0
- package/src/middleware/defaults/feeEstimator.ts +24 -4
- package/src/middleware/defaults/paymasterAndData.ts +8 -0
- package/src/middleware/defaults/userOpSigner.ts +10 -0
- package/src/signer/local-account.ts +3 -0
- package/src/signer/schema.ts +14 -0
- package/src/signer/utils.ts +20 -32
- package/src/signer/wallet-client.ts +3 -0
- package/src/utils/index.ts +54 -13
- package/src/version.ts +1 -1
package/src/utils/index.ts
CHANGED
|
@@ -97,19 +97,23 @@ export function deepHexlify(obj: any): any {
|
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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