Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/channel/rpc_0_6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export class RpcChannel {

private chainId?: StarknetChainId;

private speckVersion?: string;
private specVersion?: string;

readonly waitMode: Boolean; // behave like web2 rpc and return when tx is processed

constructor(optionsOrProvider?: RpcProviderOptions) {
const { nodeUrl, retries, headers, blockIdentifier, chainId, waitMode } =
const { nodeUrl, retries, headers, blockIdentifier, chainId, specVersion, waitMode } =
optionsOrProvider || {};
if (Object.values(NetworkName).includes(nodeUrl as NetworkName)) {
this.nodeUrl = getDefaultNodeUrl(nodeUrl as NetworkName, optionsOrProvider?.default);
Expand All @@ -66,6 +66,7 @@ export class RpcChannel {
this.headers = { ...defaultOptions.headers, ...headers };
this.blockIdentifier = blockIdentifier || defaultOptions.blockIdentifier;
this.chainId = chainId;
this.specVersion = specVersion;
this.waitMode = waitMode || false;
this.requestId = 0;
}
Expand Down Expand Up @@ -121,8 +122,8 @@ export class RpcChannel {
}

public async getSpecVersion() {
this.speckVersion ??= (await this.fetchEndpoint('starknet_specVersion')) as StarknetChainId;
return this.speckVersion;
this.specVersion ??= (await this.fetchEndpoint('starknet_specVersion')) as StarknetChainId;
return this.specVersion;
}

public getNonceForAddress(
Expand Down
1 change: 1 addition & 0 deletions src/types/provider/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type RpcProviderOptions = {
headers?: object;
blockIdentifier?: BlockIdentifier;
chainId?: StarknetChainId;
specVersion?: string;
default?: boolean;
waitMode?: boolean;
};