@@ -181,14 +181,15 @@ export function prepareExecute(args: {
181
181
if ( execute ) {
182
182
return execute ( accountContract , transaction ) ;
183
183
}
184
+ let value = transaction . value || 0n ;
185
+ // special handling of hedera chains, decimals for native value is 8 instead of 18 when passed as contract params
186
+ if ( transaction . chainId === 295 || transaction . chainId === 296 ) {
187
+ value = value / BigInt ( 10 ** 10 ) ;
188
+ }
184
189
return prepareContractCall ( {
185
190
contract : accountContract ,
186
191
method : "function execute(address, uint256, bytes)" ,
187
- params : [
188
- transaction . to || "" ,
189
- transaction . value || 0n ,
190
- transaction . data || "0x" ,
191
- ] ,
192
+ params : [ transaction . to || "" , value , transaction . data || "0x" ] ,
192
193
// if gas is specified for the inner tx, use that and add 21k for the execute call on the account contract
193
194
// this avoids another estimateGas call when bundling the userOp
194
195
// and also allows for passing custom gas limits for the inner tx
@@ -215,12 +216,18 @@ export function prepareBatchExecute(args: {
215
216
if ( executeBatch ) {
216
217
return executeBatch ( accountContract , transactions ) ;
217
218
}
219
+ let values = transactions . map ( ( tx ) => tx . value || 0n ) ;
220
+ const chainId = transactions [ 0 ] ?. chainId ;
221
+ // special handling of hedera chains, decimals for native value is 8 instead of 18 when passed as contract params
222
+ if ( chainId === 295 || chainId === 296 ) {
223
+ values = values . map ( ( value ) => value / BigInt ( 10 ** 10 ) ) ;
224
+ }
218
225
return prepareContractCall ( {
219
226
contract : accountContract ,
220
227
method : "function executeBatch(address[], uint256[], bytes[])" ,
221
228
params : [
222
229
transactions . map ( ( tx ) => tx . to || "" ) ,
223
- transactions . map ( ( tx ) => tx . value || 0n ) ,
230
+ values ,
224
231
transactions . map ( ( tx ) => tx . data || "0x" ) ,
225
232
] ,
226
233
} ) ;
0 commit comments