| 22 | } |
| 23 | |
| 24 | export async function viewSafes(network: string, address: string | undefined, mnemonic?: string): Promise<void> { |
| 25 | let web3 = await getWeb3(network, mnemonic); |
| 26 | |
| 27 | let safesApi = await getSDK('Safes', web3); |
| 28 | console.log('Getting safes...'); |
| 29 | console.log(); |
| 30 | let safes = (await safesApi.view(address)).filter((safe) => safe.type !== 'external'); |
| 31 | if (safes.length === 0) { |
| 32 | console.log('You have no safes (not counting safes external to the cardpay protocol)'); |
| 33 | } |
| 34 | safes.forEach((safe) => { |
| 35 | displaySafe(safe.address, safe); |
| 36 | console.log(); |
| 37 | }); |
| 38 | } |
| 39 | |
| 40 | function displaySafe(address: string, safe: Safe): void { |
| 41 | let { type, tokens, owners } = safe; |