From 9f01c7620023df41a8eb61cdc0bf9080fdb6c654 Mon Sep 17 00:00:00 2001 From: hazelnutcloud Date: Thu, 6 Apr 2023 08:38:10 +0800 Subject: [PATCH] deprecate instead of break --- CHANGELOG.md | 8 +++----- src/arkiver/manifest-builder.ts | 29 +++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4c22aa..9fe3d23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,14 @@ -# v0.4.0 - -## This update introduces some breaking changes to the Manifest API +# v0.3.5 - feat: The name passed to the `Manifest` constructor now typechecks - feat: Added `arkiver upgrade` command to automatically update to the latest version - feat: Various improvements to the Manifest Builder API. More typesafety and clearer intention: - - Removed `addSource` and `addEventHandler`. Use `addSources` and + - Deprecating `addSource` and `addEventHandler`. Use `addSources` and `addEventHandlers` instead. This enables more checks at the type-level that weren't possible before. - - Renamed `addChain` and `addContract` to `chain` and `contract`, + - Deprecating `addChain` and `addContract`, renamed to `chain` and `contract`, respectively. This is to better communicate the fact that those two methods instantiate a new chain and contract builder, instead of building upon the manifest builder itself, reducing the possibility of confusion when trying diff --git a/src/arkiver/manifest-builder.ts b/src/arkiver/manifest-builder.ts index 30133a5..5594a66 100644 --- a/src/arkiver/manifest-builder.ts +++ b/src/arkiver/manifest-builder.ts @@ -38,6 +38,16 @@ export class Manifest { }; } + /** + * @deprecated Use `chain` instead. + */ + public addChain( + chain: keyof typeof supportedChains, + options?: Partial, + ) { + return new DataSourceBuilder(this, chain, options); + } + public chain( chain: keyof typeof supportedChains, options?: Partial, @@ -84,6 +94,15 @@ export class DataSourceBuilder { this.builder.manifest.dataSources[chain] = this.dataSource = dataSource; } + /** + * @deprecated Use `contract` instead. + */ + public addContract( + abi: TAbi, + ) { + return this.contract(abi); + } + public contract( abi: TAbi, ) { @@ -141,7 +160,10 @@ export class ContractBuilder< } } - private addSource( + /** + * @deprecated Use `addSources` instead. + */ + public addSource( address: HexString | "*", startBlockHeight: bigint, ) { @@ -174,7 +196,10 @@ export class ContractBuilder< return this; } - private addEventHandler< + /** + * @deprecated Use `addEventHandlers` instead. + */ + public addEventHandler< TEventName extends ExtractAbiEventNames, TEventHandler extends EventHandler< ExtractAbiEvent,