@@ -3,31 +3,25 @@ import { bytesToStr } from '@massalabs/massa-web3'
33
44import { getFileFromAddress } from '../lib/website/read'
55
6- import {
7- makeProviderFromNodeURLAndSecret ,
8- validateWebsiteAddress ,
9- } from './utils'
6+ import { initPublicProvider } from './utils'
107import { loadConfig } from './config'
118
129export const showFileCommand = new Command ( 'show' )
1310 . description ( 'Show a file from the given website on Massa blockchain' )
1411 . argument ( '<file_path>' , 'Path of the file to show' )
1512 . option ( '-a, --address <address>' , 'Address of the website to edit' )
1613 . action ( async ( filePath , options , command ) => {
17- const globalOptions = loadConfig ( command . optsWithGlobals ( ) )
14+ const globalOptions = loadConfig ( {
15+ ...command . optsWithGlobals ( ) ,
16+ address : options . address ,
17+ } )
1818
19- const provider = await makeProviderFromNodeURLAndSecret ( globalOptions )
20-
21- if ( globalOptions . address ) {
22- validateWebsiteAddress ( globalOptions . address )
23- } else {
24- console . log (
25- "No address provided, targeting user's address isn't supported yet"
26- )
27- console . log ( 'User address is' , provider . address )
28- process . exit ( 1 )
19+ if ( ! globalOptions . address ) {
20+ throw new Error ( 'No address provided' )
2921 }
3022
23+ const provider = await initPublicProvider ( globalOptions )
24+
3125 console . log ( 'Targeting website at address' , globalOptions . address )
3226
3327 const fileContent = await getFileFromAddress (
0 commit comments