Skip to content

Commit

Permalink
fix: ts types fixes and block_id
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Sep 21, 2022
1 parent a7b579b commit bad0b85
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/provider/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ export class RpcProvider implements ProviderInterface {
public async getNonce(
contractAddress: string,
blockIdentifier: BlockIdentifier = 'pending'
): Promise<BigNumberish> {
const blockIdentifierGetter = new Block(blockIdentifier);
return this.fetchEndpoint('starknet_getNonce', [
contractAddress,
blockIdentifierGetter.identifier(),
]);
): Promise<RPC.Nonce> {
const block_id = new Block(blockIdentifier).identifier;
return this.fetchEndpoint('starknet_getNonce', {
contract_address: contractAddress,
block_id,
});
}

public async getPendingTransactions(): Promise<RPC.PendingTransactions> {
Expand Down
9 changes: 5 additions & 4 deletions src/types/api/openrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ type COMMON_TXN_PROPERTIES = {
type?: TXN_TYPE;
};
type FUNCTION_CALL = {
contract_address: ADDRESS;
entry_point_selector: FELT;
calldata: Array<FELT>;
contract_address?: ADDRESS;
entry_point_selector?: FELT;
calldata?: Array<FELT>;
};
type INVOKE_TXN = COMMON_TXN_PROPERTIES & FUNCTION_CALL;
type DECLARE_TXN = COMMON_TXN_PROPERTIES & {
Expand Down Expand Up @@ -364,8 +364,9 @@ export namespace OPENRPC {
result: Events;
errors: Errors.PAGE_SIZE_TOO_BIG;
};
// FROM RPC 0.2.0 Pathfinder exception
starknet_getNonce: {
params: { contract_address: ADDRESS };
params: { contract_address: ADDRESS; block_id: BLOCK_ID };
result: FELT;
errors: Errors.CONTRACT_NOT_FOUND;
};
Expand Down

0 comments on commit bad0b85

Please sign in to comment.