Skip to content

Commit bad0b85

Browse files
committed
fix: ts types fixes and block_id
1 parent a7b579b commit bad0b85

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/provider/rpc.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ export class RpcProvider implements ProviderInterface {
130130
public async getNonce(
131131
contractAddress: string,
132132
blockIdentifier: BlockIdentifier = 'pending'
133-
): Promise<BigNumberish> {
134-
const blockIdentifierGetter = new Block(blockIdentifier);
135-
return this.fetchEndpoint('starknet_getNonce', [
136-
contractAddress,
137-
blockIdentifierGetter.identifier(),
138-
]);
133+
): Promise<RPC.Nonce> {
134+
const block_id = new Block(blockIdentifier).identifier;
135+
return this.fetchEndpoint('starknet_getNonce', {
136+
contract_address: contractAddress,
137+
block_id,
138+
});
139139
}
140140

141141
public async getPendingTransactions(): Promise<RPC.PendingTransactions> {

src/types/api/openrpc.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ type COMMON_TXN_PROPERTIES = {
9595
type?: TXN_TYPE;
9696
};
9797
type FUNCTION_CALL = {
98-
contract_address: ADDRESS;
99-
entry_point_selector: FELT;
100-
calldata: Array<FELT>;
98+
contract_address?: ADDRESS;
99+
entry_point_selector?: FELT;
100+
calldata?: Array<FELT>;
101101
};
102102
type INVOKE_TXN = COMMON_TXN_PROPERTIES & FUNCTION_CALL;
103103
type DECLARE_TXN = COMMON_TXN_PROPERTIES & {
@@ -364,8 +364,9 @@ export namespace OPENRPC {
364364
result: Events;
365365
errors: Errors.PAGE_SIZE_TOO_BIG;
366366
};
367+
// FROM RPC 0.2.0 Pathfinder exception
367368
starknet_getNonce: {
368-
params: { contract_address: ADDRESS };
369+
params: { contract_address: ADDRESS; block_id: BLOCK_ID };
369370
result: FELT;
370371
errors: Errors.CONTRACT_NOT_FOUND;
371372
};

0 commit comments

Comments
 (0)