Skip to content

Commit bf246bd

Browse files
authored
Update rpc-provider.ts
1 parent 94426b1 commit bf246bd

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/core/rpc-provider.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class RpcProvider {
3939
};
4040
this.retries = options.retries || 3;
4141
this.timeout = options.timeout || 30000;
42-
this.specVersion = options.specVersion || '0.7'; // Default to 0.7
42+
this.specVersion = options.specVersion || '0.8.1'; // Updated to 0.8.1
4343
this.chainId = options.chainId || ''; // Store chainId for compatibility
4444
}
4545

@@ -144,7 +144,13 @@ export class RpcProvider {
144144
}
145145

146146
async callContract(request: Call, blockId: string | number = 'latest'): Promise<any> {
147-
return this.makeRequest('starknet_call', [request, blockId]);
147+
// Convert camelCase to snake_case for RPC call
148+
const rpcRequest = {
149+
contract_address: request.contractAddress,
150+
entry_point_selector: request.entrypoint,
151+
calldata: request.calldata
152+
};
153+
return this.makeRequest('starknet_call', [rpcRequest, blockId]);
148154
}
149155

150156
async getEstimateFee(
@@ -190,7 +196,7 @@ export class RpcProvider {
190196
contractAddress: string,
191197
blockId: string | number = 'latest'
192198
): Promise<string> {
193-
return this.makeRequest('starknet_getNonce', [contractAddress, blockId]);
199+
return this.makeRequest('starknet_getNonce', [blockId, contractAddress]);
194200
}
195201

196202
async getL1GasPrice(blockId: string | number = 'latest'): Promise<any> {

0 commit comments

Comments
 (0)