Skip to content

Commit

Permalink
feat: configure starknet provider url (#36)
Browse files Browse the repository at this point in the history
This updates the checkpoint configuration options to include a base url
as opposed to just specifying the network name. This will allow more
flexibility and options for StarkNet data providers.
  • Loading branch information
perfectmak authored Jun 6, 2022
1 parent a151239 commit e5413ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/checkpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ export default class Checkpoint {
this.writer = writer;
this.schema = schema;
this.entityController = new GqlEntityController(schema);
this.provider = new Provider({ network: this.config.network as SupportedNetworkName });

const providerConfig = this.config.networkBaseUrl
? { baseUrl: this.config.networkBaseUrl }
: { network: this.config.network as SupportedNetworkName };
this.provider = new Provider(providerConfig);

this.sourceContracts = getContractsFromConfig(config);
this.cpBlocksCache = [];

Expand Down
6 changes: 5 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ export interface ContractSourceConfig {

// Configuration used to initialize Checkpoint
export interface CheckpointConfig {
network: SupportedNetworkName | string;
// mainnet-alpha or goerli-alpha network. If not interested
// in using the default starknet provider urls, then
// leave this undefined and use the networkBaseUrl
network?: SupportedNetworkName | string;
networkBaseUrl?: string;
sources: ContractSourceConfig[];
}

Expand Down

0 comments on commit e5413ca

Please sign in to comment.