File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
packages/wallets/src/evm/wallets Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @thirdweb-dev/wallets " : patch
3
+ ---
4
+
5
+ Expose function to estimate SmartWallet transactions, handling pre and post deployment state
6
+
7
+ ``` ts
8
+ const cost = smartWallet .estimate (preparedTx );
9
+ const costBatch = smartWallet .estimateBatch (preparedTxs );
10
+ ```
11
+
12
+ Also works with raw transactions
13
+
14
+ ``` ts
15
+ const cost = smartWallet .estimateRaw (rawTx );
16
+ const costBatch = smartWallet .estimateBatchRaw (rawTxs );
17
+ ```
Original file line number Diff line number Diff line change @@ -181,23 +181,43 @@ export class SmartWallet
181
181
return connector . executeRaw ( transaction ) ;
182
182
}
183
183
184
+ /**
185
+ * Estimate the gas cost of a single transaction
186
+ * @param transaction
187
+ * @returns
188
+ */
184
189
async estimate ( transaction : Transaction < any > ) {
185
190
const connector = await this . getConnector ( ) ;
186
191
return connector . estimate ( transaction ) ;
187
192
}
188
193
194
+ /**
195
+ * Estimate the gas cost of a batch of transactions
196
+ * @param transaction
197
+ * @returns
198
+ */
189
199
async estimateBatch ( transactions : Transaction < any > [ ] ) {
190
200
const connector = await this . getConnector ( ) ;
191
201
return connector . estimateBatch ( transactions ) ;
192
202
}
193
203
204
+ /**
205
+ * Estimate the gas cost of a single raw transaction
206
+ * @param transaction
207
+ * @returns
208
+ */
194
209
async estimateRaw (
195
210
transactions : utils . Deferrable < providers . TransactionRequest > ,
196
211
) {
197
212
const connector = await this . getConnector ( ) ;
198
213
return connector . estimateRaw ( transactions ) ;
199
214
}
200
215
216
+ /**
217
+ * Estimate the gas cost of a batch of raw transactions
218
+ * @param transaction
219
+ * @returns
220
+ */
201
221
async estimateBatchRaw (
202
222
transactions : utils . Deferrable < providers . TransactionRequest > [ ] ,
203
223
) {
You can’t perform that action at this time.
0 commit comments