From 28f004d457cbe1e78f84e8917069f7a3c6c6b9ee Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Fri, 7 Nov 2025 17:14:31 +0700 Subject: [PATCH] Make CreateSessionKey parameters optional with defaults Updated the CreateSessionKey method to provide default values for its parameters, allowing them to be optional. This improves usability by enabling callers to omit parameters, which will then be set to sensible defaults within the method. --- .../SmartWallet/SmartWallet.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs b/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs index c31934d7..7b2d60c0 100644 --- a/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs +++ b/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs @@ -402,12 +402,12 @@ public async Task> GetAllActiveSigners() /// The timestamp when the request validity ends. Make use of our Utils to get UNIX timestamps. public async Task CreateSessionKey( string signerAddress, - List approvedTargets, - string nativeTokenLimitPerTransactionInWei, - string permissionStartTimestamp, - string permissionEndTimestamp, - string reqValidityStartTimestamp, - string reqValidityEndTimestamp + List approvedTargets = null, + string nativeTokenLimitPerTransactionInWei = null, + string permissionStartTimestamp = null, + string permissionEndTimestamp = null, + string reqValidityStartTimestamp = null, + string reqValidityEndTimestamp = null ) { if (await Utils.IsZkSync(this.Client, this.ActiveChainId).ConfigureAwait(false)) @@ -419,12 +419,12 @@ string reqValidityEndTimestamp { Signer = signerAddress, IsAdmin = 0, - ApprovedTargets = approvedTargets, - NativeTokenLimitPerTransaction = BigInteger.Parse(nativeTokenLimitPerTransactionInWei), - PermissionStartTimestamp = BigInteger.Parse(permissionStartTimestamp), - PermissionEndTimestamp = BigInteger.Parse(permissionEndTimestamp), - ReqValidityStartTimestamp = BigInteger.Parse(reqValidityStartTimestamp), - ReqValidityEndTimestamp = BigInteger.Parse(reqValidityEndTimestamp), + ApprovedTargets = approvedTargets ?? new List { Constants.ADDRESS_ZERO }, + NativeTokenLimitPerTransaction = BigInteger.Parse(nativeTokenLimitPerTransactionInWei ?? "0"), + PermissionStartTimestamp = BigInteger.Parse(permissionStartTimestamp ?? "0"), + PermissionEndTimestamp = BigInteger.Parse(permissionEndTimestamp ?? Utils.GetUnixTimeStampIn10Years().ToString()), + ReqValidityStartTimestamp = BigInteger.Parse(reqValidityStartTimestamp ?? "0"), + ReqValidityEndTimestamp = BigInteger.Parse(reqValidityEndTimestamp ?? Utils.GetUnixTimeStampIn10Years().ToString()), Uid = Guid.NewGuid().ToByteArray(), };