]> git.ardis.lu - safe-owners/commitdiff
Add support for Ownable smart contracts
authorArdis Lu <ardisglu@gmail.com>
Sun, 8 Dec 2024 03:53:42 +0000 (19:53 -0800)
committerArdis Lu <ardisglu@gmail.com>
Sun, 8 Dec 2024 03:53:42 +0000 (19:53 -0800)
index.html

index 564d94132689e5704c036b1d87f40e2af1f9b66c..c57852d9d7a4a90dd7d3b50804421a8e9c9e2179 100644 (file)
 
     async function getOwners(safe, rpc) {
       const requests = {
+        ownerResult: '0x8da5cb5b', // owner()
         ownersResult: '0xa0e67e2b', // getOwners()
         thresholdResult: '0xe75235b8', // getThreshold()
         requiredResult: '0xdc8452cd' // required()
         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: [],
This page took 0.043417 seconds and 4 git commands to generate.