| 9 | |
| 10 | // Function to convert f410 address to Ethereum hex address |
| 11 | function f410ToEthAddress(f410Addr) { |
| 12 | // Remove the 't410' prefix (or 'f410' for mainnet) |
| 13 | const withoutPrefix = f410Addr.replace(/^[tf]410/, ''); |
| 14 | |
| 15 | // The remaining part is base32-encoded, we need to decode it |
| 16 | // For simplicity, we'll use a more direct approach since f410 addresses |
| 17 | // are essentially Ethereum addresses with a specific encoding |
| 18 | |
| 19 | // Base32 decode the address (simplified version) |
| 20 | // In a real implementation, you'd use a proper base32 decoder |
| 21 | try { |
| 22 | // For f410 addresses, the payload is typically 20 bytes (Ethereum address) |
| 23 | // This is a simplified conversion - in practice you'd need proper base32 decoding |
| 24 | console.log('F410 address (without prefix):', withoutPrefix); |
| 25 | |
| 26 | // For demonstration, let's show the manual steps: |
| 27 | console.log('\nTo convert this properly, you need to:'); |
| 28 | console.log('1. Decode the base32 part:', withoutPrefix); |
| 29 | console.log('2. Extract the 20-byte Ethereum address'); |
| 30 | console.log('3. Format as 0x-prefixed hex'); |
| 31 | |
| 32 | // For your specific address, you'll need to use a proper base32 decoder |
| 33 | // or the Filecoin address utilities |
| 34 | return null; // Placeholder |
| 35 | } catch (error) { |
| 36 | console.error('Conversion error:', error); |
| 37 | return null; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | // ABI for the permissionMode function |
| 42 | const subnetActorABI = [ |