MCPcopy Create free account
hub / github.com/cardstack/cardstack / viewSafes

Function viewSafes

packages/cardpay-cli/safe.ts:24–38  ·  view source on GitHub ↗
(network: string, address: string | undefined, mnemonic?: string)

Source from the content-addressed store, hash-verified

22}
23
24export 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
40function displaySafe(address: string, safe: Safe): void {
41 let { type, tokens, owners } = safe;

Callers 1

index.tsFile · 0.85

Calls 5

getWeb3Function · 0.90
getSDKFunction · 0.90
displaySafeFunction · 0.85
viewMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected