@@ -62,10 +62,10 @@ export function callContract(invokeTx: Call, blockId?: number): Promise<CallCont
6262 * @param blockId
6363 * @returns the block object { block_id, previous_block_id, state_root, status, timestamp, transaction_receipts, transactions }
6464 */
65- export function getBlock ( blockId : number ) : Promise < GetBlockResponse > {
65+ export function getBlock ( blockId ? : number ) : Promise < GetBlockResponse > {
6666 return new Promise ( ( resolve , reject ) => {
6767 axios
68- . get < GetBlockResponse > ( `${ FEEDER_GATEWAY_URL } /get_block?blockId=${ blockId } ` )
68+ . get < GetBlockResponse > ( `${ FEEDER_GATEWAY_URL } /get_block?blockId=${ blockId ?? 'null' } ` )
6969 . then ( ( resp : any ) => {
7070 resolve ( resp . data ) ;
7171 } )
@@ -82,11 +82,13 @@ export function getBlock(blockId: number): Promise<GetBlockResponse> {
8282 * @param blockId
8383 * @returns Bytecode and ABI of compiled contract
8484 */
85- export function getCode ( contractAddress : string , blockId : number ) : Promise < GetCodeResponse > {
85+ export function getCode ( contractAddress : string , blockId ? : number ) : Promise < GetCodeResponse > {
8686 return new Promise ( ( resolve , reject ) => {
8787 axios
8888 . get < GetCodeResponse > (
89- `${ FEEDER_GATEWAY_URL } /get_code?contractAddress=${ contractAddress } &blockId=${ blockId } `
89+ `${ FEEDER_GATEWAY_URL } /get_code?contractAddress=${ contractAddress } &blockId=${
90+ blockId ?? 'null'
91+ } `
9092 )
9193 . then ( ( resp ) => {
9294 resolve ( resp . data ) ;
@@ -109,12 +111,14 @@ export function getCode(contractAddress: string, blockId: number): Promise<GetCo
109111export function getStorageAt (
110112 contractAddress : string ,
111113 key : number ,
112- blockId : number
114+ blockId ? : number
113115) : Promise < object > {
114116 return new Promise ( ( resolve , reject ) => {
115117 axios
116118 . get (
117- `${ FEEDER_GATEWAY_URL } /get_storage_at?contractAddress=${ contractAddress } &key=${ key } &blockId=${ blockId } `
119+ `${ FEEDER_GATEWAY_URL } /get_storage_at?contractAddress=${ contractAddress } &key=${ key } &blockId=${
120+ blockId ?? 'null'
121+ } `
118122 )
119123 . then ( ( resp : any ) => {
120124 resolve ( resp . data ) ;
0 commit comments