Skip to content

Commit aced1c7

Browse files
committed
Include admins in Wallet.GetAllActiveSigners
1 parent af009f4 commit aced1c7

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed

Assets/Tests/SmartWalletTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,24 @@ public IEnumerator CreateSessionKey_WithValidSignerCheck_Success()
9595
}
9696
}
9797
Assert.IsTrue(exists);
98+
99+
// Also check if admin is in here
100+
exists = false;
101+
var adminTask = ThirdwebManager.Instance.SDK.Wallet.GetSignerAddress();
102+
yield return new WaitUntil(() => adminTask.IsCompleted);
103+
Assert.IsTrue(adminTask.IsCompletedSuccessfully);
104+
Assert.IsNotNull(adminTask.Result);
105+
var admin = adminTask.Result;
106+
foreach (var signer in getAllActiveSignersTask.Result)
107+
{
108+
if (signer.signer == admin)
109+
{
110+
exists = true;
111+
Assert.IsTrue(signer.isAdmin);
112+
break;
113+
}
114+
}
115+
Assert.IsTrue(exists);
98116
}
99117

100118
[UnityTest]

Assets/Thirdweb/Core/Scripts/Wallet.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,12 +816,33 @@ public async Task<List<SignerWithPermissions>> GetAllActiveSigners()
816816
throw new UnityException("This functionality is only available for SmartWallets.");
817817

818818
string address = await GetAddress();
819-
var raw = await TransactionManager.ThirdwebRead<Contracts.Account.ContractDefinition.GetAllActiveSignersFunction, Contracts.Account.ContractDefinition.GetAllActiveSignersOutputDTO>(
819+
820+
var rawSigners = await TransactionManager.ThirdwebRead<
821+
Contracts.Account.ContractDefinition.GetAllActiveSignersFunction,
822+
Contracts.Account.ContractDefinition.GetAllActiveSignersOutputDTO
823+
>(address, new Contracts.Account.ContractDefinition.GetAllActiveSignersFunction());
824+
var allSigners = rawSigners.Signers;
825+
826+
var rawAdmins = await TransactionManager.ThirdwebRead<Contracts.Account.ContractDefinition.GetAllAdminsFunction, Contracts.Account.ContractDefinition.GetAllAdminsOutputDTO>(
820827
address,
821-
new Contracts.Account.ContractDefinition.GetAllActiveSignersFunction()
828+
new Contracts.Account.ContractDefinition.GetAllAdminsFunction()
822829
);
830+
foreach (var admin in rawAdmins.ReturnValue1)
831+
{
832+
allSigners.Add(
833+
new Contracts.Account.ContractDefinition.SignerPermissions()
834+
{
835+
Signer = admin,
836+
ApprovedTargets = new List<string>() { Utils.AddressZero },
837+
NativeTokenLimitPerTransaction = BigInteger.Zero,
838+
StartTimestamp = 0,
839+
EndTimestamp = Utils.GetUnixTimeStampIn10Years()
840+
}
841+
);
842+
}
843+
823844
var signers = new List<SignerWithPermissions>();
824-
foreach (var rawSigner in raw.Signers)
845+
foreach (var rawSigner in allSigners)
825846
{
826847
bool? isAdmin;
827848
try

0 commit comments

Comments
 (0)