Skip to content

Commit d77cb75

Browse files
committed
Handle Hedera + AA txInput.value decimals
1 parent 108020e commit d77cb75

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,13 +648,15 @@ private async Task<object> SignUserOp(ThirdwebTransactionInput transactionInput,
648648

649649
if (entryPointVersion == 6)
650650
{
651+
#pragma warning disable IDE0078 // Use pattern matching
651652
var executeFn = new ExecuteFunction
652653
{
653654
Target = transactionInput.To,
654-
Value = transactionInput.Value.Value,
655+
Value = transactionInput.ChainId.Value == 295 || transactionInput.ChainId.Value == 296 ? transactionInput.Value.Value / BigInteger.Pow(10, 10) : transactionInput.Value.Value,
655656
Calldata = transactionInput.Data.HexToBytes(),
656657
FromAddress = await this.GetAddress().ConfigureAwait(false),
657658
};
659+
#pragma warning restore IDE0078 // Use pattern matching
658660
var executeInput = executeFn.CreateTransactionInput(await this.GetAddress().ConfigureAwait(false));
659661

660662
var partialUserOp = new UserOperationV6()
@@ -702,13 +704,15 @@ private async Task<object> SignUserOp(ThirdwebTransactionInput transactionInput,
702704
}
703705
else
704706
{
707+
#pragma warning disable IDE0078 // Use pattern matching
705708
var executeFn = new ExecuteFunction
706709
{
707710
Target = transactionInput.To,
708-
Value = transactionInput.Value.Value,
711+
Value = transactionInput.ChainId.Value == 295 || transactionInput.ChainId.Value == 296 ? transactionInput.Value.Value / BigInteger.Pow(10, 10) : transactionInput.Value.Value,
709712
Calldata = transactionInput.Data.HexToBytes(),
710713
FromAddress = await this.GetAddress().ConfigureAwait(false),
711714
};
715+
#pragma warning restore IDE0078 // Use pattern matching
712716
var executeInput = executeFn.CreateTransactionInput(await this.GetAddress().ConfigureAwait(false));
713717

714718
var partialUserOp = new UserOperationV7()

0 commit comments

Comments
 (0)