@@ -3,6 +3,7 @@ import urljoin from 'url-join';
33
44import {
55 AddTransactionResponse ,
6+ BlockNumber ,
67 CallContractResponse ,
78 CallContractTransaction ,
89 CompiledContract ,
@@ -85,15 +86,15 @@ export class Provider implements ProviderInterface {
8586 * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L17-L25)
8687 *
8788 * @param invokeTransaction - transaction to be invoked
88- * @param blockId
89+ * @param blockNumber
8990 * @returns the result of the function on the smart contract.
9091 */
9192 public async callContract (
9293 invokeTransaction : CallContractTransaction ,
93- blockId ?: number
94+ blockNumber : BlockNumber = null
9495 ) : Promise < CallContractResponse > {
9596 const { data } = await axios . post < CallContractResponse > (
96- urljoin ( this . feederGatewayUrl , 'call_contract' , `?blockId =${ blockId ?? 'null' } ` ) ,
97+ urljoin ( this . feederGatewayUrl , 'call_contract' , `?blockNumber =${ blockNumber } ` ) ,
9798 {
9899 signature : [ ] ,
99100 calldata : [ ] ,
@@ -108,12 +109,12 @@ export class Provider implements ProviderInterface {
108109 *
109110 * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L27-L31)
110111 *
111- * @param blockId
112+ * @param blockNumber
112113 * @returns the block object { block_id, previous_block_id, state_root, status, timestamp, transaction_receipts, transactions }
113114 */
114- public async getBlock ( blockId ?: number ) : Promise < GetBlockResponse > {
115+ public async getBlock ( blockNumber : BlockNumber = null ) : Promise < GetBlockResponse > {
115116 const { data } = await axios . get < GetBlockResponse > (
116- urljoin ( this . feederGatewayUrl , 'get_block' , `?blockId =${ blockId ?? 'null' } ` )
117+ urljoin ( this . feederGatewayUrl , 'get_block' , `?blockNumber =${ blockNumber } ` )
117118 ) ;
118119 return data ;
119120 }
@@ -124,15 +125,18 @@ export class Provider implements ProviderInterface {
124125 * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L33-L36)
125126 *
126127 * @param contractAddress
127- * @param blockId
128+ * @param blockNumber
128129 * @returns Bytecode and ABI of compiled contract
129130 */
130- public async getCode ( contractAddress : string , blockId ?: number ) : Promise < GetCodeResponse > {
131+ public async getCode (
132+ contractAddress : string ,
133+ blockNumber : BlockNumber = null
134+ ) : Promise < GetCodeResponse > {
131135 const { data } = await axios . get < GetCodeResponse > (
132136 urljoin (
133137 this . feederGatewayUrl ,
134138 'get_code' ,
135- `?contractAddress=${ contractAddress } &blockId =${ blockId ?? 'null' } `
139+ `?contractAddress=${ contractAddress } &blockNumber =${ blockNumber } `
136140 )
137141 ) ;
138142 return data ;
@@ -146,19 +150,19 @@ export class Provider implements ProviderInterface {
146150 *
147151 * @param contractAddress
148152 * @param key - from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)
149- * @param blockId
153+ * @param blockNumber
150154 * @returns the value of the storage variable
151155 */
152156 public async getStorageAt (
153157 contractAddress : string ,
154158 key : number ,
155- blockId ?: number
159+ blockNumber : BlockNumber = null
156160 ) : Promise < object > {
157161 const { data } = await axios . get < object > (
158162 urljoin (
159163 this . feederGatewayUrl ,
160164 'get_storage_at' ,
161- `?contractAddress=${ contractAddress } &key=${ key } &blockId =${ blockId ?? 'null' } `
165+ `?contractAddress=${ contractAddress } &key=${ key } &blockNumber =${ blockNumber } `
162166 )
163167 ) ;
164168 return data ;
0 commit comments