From 069a602cff3ad6700605c97347b7c127c43c5120 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sat, 7 Dec 2024 19:53:42 -0800 Subject: [PATCH] Add support for Ownable smart contracts --- index.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 564d941..c57852d 100644 --- a/index.html +++ b/index.html @@ -181,6 +181,7 @@ async function getOwners(safe, rpc) { const requests = { + ownerResult: '0x8da5cb5b', // owner() ownersResult: '0xa0e67e2b', // getOwners() thresholdResult: '0xe75235b8', // getThreshold() requiredResult: '0xdc8452cd' // required() @@ -199,8 +200,15 @@ headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }).then(r => r.json()); - const { ownersResult, thresholdResult, requiredResult } = response.reduce((a, c) => ({ ...a, [c.id]: c.result }), {}); + const { ownerResult, ownersResult, thresholdResult, requiredResult } = response.reduce((a, c) => ({ ...a, [c.id]: c.result }), {}); + if (ownerResult !== undefined && ownerResult !== '0x') { // Not a Safe, but Ownable which is equal to a 1-of-1 multisig + return { + owners: [`0x${ownerResult.replace('0x', '').substring(24)}`], + threshold: 1, + type: 'Ownable' + } + } if (ownersResult === undefined) { // Smart contract reverted return { owners: [], -- 2.47.3