@dedot/contracts 0.18.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/errors.d.ts CHANGED
@@ -14,13 +14,13 @@ export declare class ContractInstantiateError<ContractApi extends GenericContrac
14
14
  /**
15
15
  * The raw result of the contract instantiation.
16
16
  */
17
- raw: ContractInstantiateResult<ContractApi['types']['ChainApi']>;
17
+ raw: ContractInstantiateResult;
18
18
  /**
19
19
  * Constructs a new `ContractInstantiateError` instance.
20
20
  *
21
21
  * @param raw - The raw result of the contract instantiation.
22
22
  */
23
- constructor(raw: ContractInstantiateResult<ContractApi['types']['ChainApi']>);
23
+ constructor(raw: ContractInstantiateResult);
24
24
  }
25
25
  /**
26
26
  * Represents an error that occurred during the dispatch phase of contract instantiation.
@@ -47,7 +47,7 @@ export declare class ContractInstantiateDispatchError<ContractApi extends Generi
47
47
  * @param raw - The raw result of the contract instantiation.
48
48
  * @param moduleError - The decoded module error, if any.
49
49
  */
50
- constructor(err: DispatchError, raw: ContractInstantiateResult<ContractApi['types']['ChainApi']>, moduleError?: PalletErrorMetadataLatest);
50
+ constructor(err: DispatchError, raw: ContractInstantiateResult, moduleError?: PalletErrorMetadataLatest);
51
51
  }
52
52
  /**
53
53
  * Represents an error that occurred during the instantiation of a smart contract due to a language-specific error.
@@ -75,7 +75,7 @@ export declare class ContractInstantiateLangError<ContractApi extends InkGeneric
75
75
  * @param err - The `LangError` that occurred during the instantiation phase.
76
76
  * @param raw - The raw result of the contract instantiation.
77
77
  */
78
- constructor(err: ContractApi['types']['LangError'], raw: ContractInstantiateResult<ContractApi['types']['ChainApi']>);
78
+ constructor(err: ContractApi['types']['LangError'], raw: ContractInstantiateResult);
79
79
  }
80
80
  /**
81
81
  * Represents an error that occurred during the execution of a smart contract call.
@@ -90,13 +90,13 @@ export declare class ContractExecutionError<ContractApi extends GenericContractA
90
90
  /**
91
91
  * The raw result of the contract call.
92
92
  */
93
- raw: ContractCallResult<ContractApi['types']['ChainApi']>;
93
+ raw: ContractCallResult;
94
94
  /**
95
95
  * Constructs a new `ContractExecutionError` instance.
96
96
  *
97
97
  * @param raw - The raw result of the contract call.
98
98
  */
99
- constructor(raw: ContractCallResult<ContractApi['types']['ChainApi']>);
99
+ constructor(raw: ContractCallResult);
100
100
  }
101
101
  /**
102
102
  * Represents an error that occurred during the execution of a smart contract call due to a dispatch error.
@@ -123,7 +123,7 @@ export declare class ContractDispatchError<ContractApi extends GenericContractAp
123
123
  * @param raw - The raw result of the contract call.
124
124
  * @param moduleError - The decoded module error, if any.
125
125
  */
126
- constructor(err: DispatchError, raw: ContractCallResult<ContractApi['types']['ChainApi']>, moduleError?: PalletErrorMetadataLatest);
126
+ constructor(err: DispatchError, raw: ContractCallResult, moduleError?: PalletErrorMetadataLatest);
127
127
  }
128
128
  /**
129
129
  * Represents an error that occurred during the execution of a smart contract call due to a language-specific error.
@@ -151,7 +151,7 @@ export declare class ContractLangError<ContractApi extends InkGenericContractApi
151
151
  * @param err - The `LangError` that occurred during the execution phase.
152
152
  * @param raw - The raw result of the contract call.
153
153
  */
154
- constructor(err: ContractApi['types']['LangError'], raw: ContractCallResult<ContractApi['types']['ChainApi']>);
154
+ constructor(err: ContractApi['types']['LangError'], raw: ContractCallResult);
155
155
  }
156
156
  export type SolErrorResult = {
157
157
  abiItem: SolAbiError;
@@ -169,7 +169,7 @@ export type SolErrorResult = {
169
169
  export declare class SolContractInstantiateError<ContractApi extends SolGenericContractApi = SolGenericContractApi> extends ContractInstantiateError {
170
170
  name: string;
171
171
  details?: SolErrorResult;
172
- constructor(raw: ContractInstantiateResult<ContractApi['types']['ChainApi']>, { details, message }: {
172
+ constructor(raw: ContractInstantiateResult, { details, message }: {
173
173
  details?: SolErrorResult;
174
174
  message?: string;
175
175
  });
@@ -185,7 +185,7 @@ export declare class SolContractInstantiateError<ContractApi extends SolGenericC
185
185
  export declare class SolContractExecutionError<ContractApi extends SolGenericContractApi = SolGenericContractApi> extends ContractExecutionError {
186
186
  name: string;
187
187
  details?: SolErrorResult;
188
- constructor(raw: ContractCallResult<ContractApi['types']['ChainApi']>, { details, message }: {
188
+ constructor(raw: ContractCallResult, { details, message }: {
189
189
  details?: SolErrorResult;
190
190
  message?: string;
191
191
  });
@@ -1,5 +1,4 @@
1
- import { GenericSubstrateApi } from '@dedot/types';
2
1
  import { DeployerExecutor } from './abstract/index.js';
3
- export declare class ConstructorQueryExecutor<ChainApi extends GenericSubstrateApi> extends DeployerExecutor<ChainApi> {
2
+ export declare class ConstructorQueryExecutor extends DeployerExecutor {
4
3
  doExecute(constructor: string): any;
5
4
  }
@@ -1,5 +1,4 @@
1
- import { GenericSubstrateApi } from '@dedot/types';
2
1
  import { DeployerExecutor } from './abstract/index.js';
3
- export declare class ConstructorTxExecutor<ChainApi extends GenericSubstrateApi> extends DeployerExecutor<ChainApi> {
2
+ export declare class ConstructorTxExecutor extends DeployerExecutor {
4
3
  doExecute(constructor: string): any;
5
4
  }
@@ -1,7 +1,6 @@
1
- import { GenericSubstrateApi } from '@dedot/types';
2
1
  import { GenericContractEvent } from '../../types/index.js';
3
2
  import { ContractExecutor } from './abstract/index.js';
4
- export declare class EventExecutor<ChainApi extends GenericSubstrateApi> extends ContractExecutor<ChainApi> {
3
+ export declare class EventExecutor extends ContractExecutor {
5
4
  #private;
6
5
  doExecute(eventName: string): GenericContractEvent<string, any, 'ink'>;
7
6
  }
@@ -1,5 +1,4 @@
1
- import { GenericSubstrateApi } from '@dedot/types';
2
1
  import { ContractExecutor } from './abstract/index.js';
3
- export declare class QueryExecutor<ChainApi extends GenericSubstrateApi> extends ContractExecutor<ChainApi> {
2
+ export declare class QueryExecutor extends ContractExecutor {
4
3
  doExecute(message: string): any;
5
4
  }
@@ -1,5 +1,4 @@
1
- import { GenericSubstrateApi } from '@dedot/types';
2
1
  import { ContractExecutor } from './abstract/index.js';
3
- export declare class TxExecutor<ChainApi extends GenericSubstrateApi> extends ContractExecutor<ChainApi> {
2
+ export declare class TxExecutor extends ContractExecutor {
4
3
  doExecute(message: string): any;
5
4
  }
@@ -1,11 +1,10 @@
1
1
  import { ISubstrateClient } from '@dedot/api';
2
- import { GenericSubstrateApi } from '@dedot/types';
3
2
  import { TypinkRegistry } from '../../../TypinkRegistry.js';
4
3
  import { ContractAddress, ContractCallMessage, ExecutionOptions } from '../../../types/index.js';
5
4
  import { Executor } from './Executor.js';
6
- export declare abstract class ContractExecutor<ChainApi extends GenericSubstrateApi> extends Executor<ChainApi> {
5
+ export declare abstract class ContractExecutor extends Executor {
7
6
  readonly address: ContractAddress;
8
- constructor(client: ISubstrateClient<ChainApi>, registry: TypinkRegistry, address: ContractAddress, options?: ExecutionOptions);
7
+ constructor(client: ISubstrateClient, registry: TypinkRegistry, address: ContractAddress, options?: ExecutionOptions);
9
8
  protected findMessage(message: string): ContractCallMessage | undefined;
10
9
  protected findTxMessage(message: string): ContractCallMessage | undefined;
11
10
  }
@@ -1,12 +1,11 @@
1
1
  import { ISubstrateClient } from '@dedot/api';
2
2
  import { Hash } from '@dedot/codecs';
3
- import { GenericSubstrateApi } from '@dedot/types';
4
3
  import { HexString } from '@dedot/utils';
5
4
  import { TypinkRegistry } from '../../../TypinkRegistry.js';
6
5
  import { ContractConstructorMessage, ExecutionOptions } from '../../../types/index.js';
7
6
  import { Executor } from './Executor.js';
8
- export declare abstract class DeployerExecutor<ChainApi extends GenericSubstrateApi> extends Executor<ChainApi> {
7
+ export declare abstract class DeployerExecutor extends Executor {
9
8
  readonly code: Hash | Uint8Array | HexString | string;
10
- constructor(client: ISubstrateClient<ChainApi>, registry: TypinkRegistry, code: Hash | Uint8Array | HexString | string, options?: ExecutionOptions);
9
+ constructor(client: ISubstrateClient, registry: TypinkRegistry, code: Hash | Uint8Array | HexString | string, options?: ExecutionOptions);
11
10
  protected findConstructorMeta(constructor: string): ContractConstructorMessage | undefined;
12
11
  }
@@ -1,13 +1,11 @@
1
1
  import { ISubstrateClient } from '@dedot/api';
2
- import { SubstrateApi } from '@dedot/api/chaintypes';
3
- import { GenericSubstrateApi, RpcVersion } from '@dedot/types';
4
2
  import { TypinkRegistry } from '../../../TypinkRegistry.js';
5
- import { ContractMessageArg, ContractMessage, ExecutionOptions, ContractMetadata } from '../../../types/index.js';
6
- export declare abstract class Executor<ChainApi extends GenericSubstrateApi = SubstrateApi[RpcVersion]> {
7
- readonly client: ISubstrateClient<ChainApi>;
3
+ import { ContractMessage, ContractMessageArg, ContractMetadata, ExecutionOptions } from '../../../types/index.js';
4
+ export declare abstract class Executor {
5
+ readonly client: ISubstrateClient;
8
6
  readonly registry: TypinkRegistry;
9
7
  readonly options: ExecutionOptions;
10
- constructor(client: ISubstrateClient<ChainApi>, registry: TypinkRegistry, options?: ExecutionOptions);
8
+ constructor(client: ISubstrateClient, registry: TypinkRegistry, options?: ExecutionOptions);
11
9
  get metadata(): ContractMetadata;
12
10
  abstract doExecute(...paths: string[]): unknown;
13
11
  tryEncode(param: ContractMessageArg, value: any): Uint8Array;
@@ -1,5 +1,4 @@
1
- import { GenericSubstrateApi } from '@dedot/types';
2
1
  import { SolDeployerExecutor } from './abstract/index.js';
3
- export declare class SolConstructorQueryExecutor<ChainApi extends GenericSubstrateApi> extends SolDeployerExecutor<ChainApi> {
2
+ export declare class SolConstructorQueryExecutor extends SolDeployerExecutor {
4
3
  doExecute(_: string): any;
5
4
  }
@@ -1,5 +1,4 @@
1
- import { GenericSubstrateApi } from '@dedot/types';
2
1
  import { SolDeployerExecutor } from './abstract/index.js';
3
- export declare class SolConstructorTxExecutor<ChainApi extends GenericSubstrateApi> extends SolDeployerExecutor<ChainApi> {
2
+ export declare class SolConstructorTxExecutor extends SolDeployerExecutor {
4
3
  doExecute(_: string): any;
5
4
  }
@@ -1,6 +1,5 @@
1
- import { GenericSubstrateApi } from '@dedot/types';
2
1
  import { GenericContractEvent } from '../../types/index.js';
3
2
  import { SolContractExecutor } from './abstract/index.js';
4
- export declare class SolEventExecutor<ChainApi extends GenericSubstrateApi> extends SolContractExecutor<ChainApi> {
3
+ export declare class SolEventExecutor extends SolContractExecutor {
5
4
  doExecute(eventName: string): GenericContractEvent<string, any, 'sol'>;
6
5
  }
@@ -1,5 +1,4 @@
1
- import { GenericSubstrateApi } from '@dedot/types';
2
1
  import { SolContractExecutor } from './abstract/SolContractExecutor.js';
3
- export declare class SolQueryExecutor<ChainApi extends GenericSubstrateApi> extends SolContractExecutor<ChainApi> {
2
+ export declare class SolQueryExecutor extends SolContractExecutor {
4
3
  doExecute(name: string): any;
5
4
  }
@@ -1,5 +1,4 @@
1
- import { GenericSubstrateApi } from '@dedot/types';
2
1
  import { SolContractExecutor } from './abstract/SolContractExecutor.js';
3
- export declare class SolTxExecutor<ChainApi extends GenericSubstrateApi> extends SolContractExecutor<ChainApi> {
2
+ export declare class SolTxExecutor extends SolContractExecutor {
4
3
  doExecute(name: string): any;
5
4
  }
@@ -1,9 +1,8 @@
1
1
  import { ISubstrateClient } from '@dedot/api';
2
- import { GenericSubstrateApi } from '@dedot/types';
3
2
  import { SolRegistry } from '../../../SolRegistry.js';
4
3
  import { ContractAddress, ExecutionOptions } from '../../../types/index.js';
5
4
  import { SolExecutor } from './SolExecutor.js';
6
- export declare abstract class SolContractExecutor<ChainApi extends GenericSubstrateApi> extends SolExecutor<ChainApi> {
5
+ export declare abstract class SolContractExecutor extends SolExecutor {
7
6
  readonly address: ContractAddress;
8
- constructor(client: ISubstrateClient<ChainApi>, registry: SolRegistry, address: ContractAddress, options?: ExecutionOptions);
7
+ constructor(client: ISubstrateClient, registry: SolRegistry, address: ContractAddress, options?: ExecutionOptions);
9
8
  }
@@ -1,11 +1,10 @@
1
1
  import { ISubstrateClient } from '@dedot/api';
2
2
  import { Hash } from '@dedot/codecs';
3
- import { GenericSubstrateApi } from '@dedot/types';
4
3
  import { HexString } from '@dedot/utils';
5
4
  import { SolRegistry } from '../../../SolRegistry.js';
6
5
  import { ExecutionOptions } from '../../../types/index.js';
7
6
  import { SolExecutor } from './SolExecutor.js';
8
- export declare abstract class SolDeployerExecutor<ChainApi extends GenericSubstrateApi> extends SolExecutor<ChainApi> {
7
+ export declare abstract class SolDeployerExecutor extends SolExecutor {
9
8
  readonly code: Hash | Uint8Array | HexString | string;
10
- constructor(client: ISubstrateClient<ChainApi>, registry: SolRegistry, code: Hash | Uint8Array | HexString | string, options?: ExecutionOptions);
9
+ constructor(client: ISubstrateClient, registry: SolRegistry, code: Hash | Uint8Array | HexString | string, options?: ExecutionOptions);
11
10
  }
@@ -1,13 +1,11 @@
1
1
  import { ISubstrateClient } from '@dedot/api';
2
- import { SubstrateApi } from '@dedot/api/chaintypes';
3
- import { GenericSubstrateApi, RpcVersion } from '@dedot/types';
4
2
  import { SolRegistry } from '../../../SolRegistry.js';
5
3
  import { ExecutionOptions, SolAbi } from '../../../types/index.js';
6
- export declare abstract class SolExecutor<ChainApi extends GenericSubstrateApi = SubstrateApi[RpcVersion]> {
7
- readonly client: ISubstrateClient<ChainApi>;
4
+ export declare abstract class SolExecutor {
5
+ readonly client: ISubstrateClient;
8
6
  readonly registry: SolRegistry;
9
7
  readonly options: ExecutionOptions;
10
- protected constructor(client: ISubstrateClient<ChainApi>, registry: SolRegistry, options?: ExecutionOptions);
8
+ protected constructor(client: ISubstrateClient, registry: SolRegistry, options?: ExecutionOptions);
11
9
  get abi(): SolAbi;
12
10
  abstract doExecute(...paths: string[]): unknown;
13
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dedot/contracts",
3
- "version": "0.18.8",
3
+ "version": "1.0.0",
4
4
  "description": "Delightful ink! Contract APIs",
5
5
  "author": "Tung Vu <tung@dedot.dev>",
6
6
  "homepage": "https://dedot.dev",
@@ -18,11 +18,11 @@
18
18
  "test": "npx vitest --watch=false"
19
19
  },
20
20
  "dependencies": {
21
- "@dedot/api": "0.18.8",
22
- "@dedot/codecs": "0.18.8",
23
- "@dedot/types": "0.18.8",
24
- "@dedot/utils": "0.18.8",
25
- "viem": "^2.37.7"
21
+ "@dedot/api": "1.0.0",
22
+ "@dedot/codecs": "1.0.0",
23
+ "@dedot/types": "1.0.0",
24
+ "@dedot/utils": "1.0.0",
25
+ "viem": "^2.40.3"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public",
@@ -32,7 +32,7 @@
32
32
  "node": ">=18"
33
33
  },
34
34
  "license": "Apache-2.0",
35
- "gitHead": "5f87f515d4ce4183038681dd02b20bb682a5fdce",
35
+ "gitHead": "7767062a2188b4ac90561c5ad3cc3f06ac608a24",
36
36
  "module": "./index.js",
37
37
  "types": "./index.d.ts",
38
38
  "exports": {
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SubstrateApi } from '@dedot/api/chaintypes';
2
2
  import { Extrinsic } from '@dedot/codecs';
3
- import { AnyFunc, AsyncMethod, GenericSubstrateApi, IEventRecord, ISubmittableExtrinsic, ISubmittableResult, RpcVersion, Unsub, VersionedGenericSubstrateApi } from '@dedot/types';
3
+ import { AnyFunc, AsyncMethod, GenericSubstrateApi, IEventRecord, ISubmittableExtrinsic, ISubmittableResult, Unsub } from '@dedot/types';
4
4
  import { Contract } from '../Contract.js';
5
5
  import { ContractCallMessage, ContractConstructorMessage, ContractEventMeta } from './ink/index.js';
6
6
  import { ContractCallResult, ContractInstantiateResult, ExecutionOptions, GenericConstructorCallResult, GenericContractCallResult, ContractAddress } from './shared.js';
@@ -8,8 +8,7 @@ import { SolAbiConstructor, SolAbiEvent, SolAbiFunction } from './sol/index.js';
8
8
  export * from './ink/index.js';
9
9
  export * from './sol/index.js';
10
10
  export * from './shared.js';
11
- type SubmittableExtrinsic<R extends ISubmittableResult> = ISubmittableExtrinsic<R> & Extrinsic;
12
- export type ContractSubmittableExtrinsic<_ extends GenericSubstrateApi> = SubmittableExtrinsic<ISubmittableResult>;
11
+ export type ContractSubmittableExtrinsic<R extends ISubmittableResult = ISubmittableResult> = ISubmittableExtrinsic<R> & Extrinsic;
13
12
  export interface IContractInstantiateSubmittableResult<ContractApi extends GenericContractApi = GenericContractApi> extends ISubmittableResult {
14
13
  /**
15
14
  * Get deployed contract address
@@ -20,7 +19,7 @@ export interface IContractInstantiateSubmittableResult<ContractApi extends Gener
20
19
  */
21
20
  contract(options?: ExecutionOptions): Promise<Contract<ContractApi>>;
22
21
  }
23
- export type GenericInstantiateSubmittableExtrinsic<_ extends GenericSubstrateApi, ContractApi extends GenericContractApi = GenericContractApi> = SubmittableExtrinsic<IContractInstantiateSubmittableResult<ContractApi>>;
22
+ export type GenericInstantiateSubmittableExtrinsic<ContractApi extends GenericContractApi = GenericContractApi> = ContractSubmittableExtrinsic<IContractInstantiateSubmittableResult<ContractApi>>;
24
23
  export interface LooseContractMetadata {
25
24
  version: number | string;
26
25
  [prop: string]: any;
@@ -29,29 +28,29 @@ export type LooseSolAbi = Array<{
29
28
  type: string;
30
29
  [prop: string]: any;
31
30
  }>;
32
- export type GenericContractQueryCall<ChainApi extends GenericSubstrateApi, F extends AsyncMethod = (...args: any[]) => Promise<GenericContractCallResult<any, ContractCallResult<ChainApi>>>, Type extends MetadataType = MetadataType> = F & {
31
+ export type GenericContractQueryCall<F extends AsyncMethod = (...args: any[]) => Promise<GenericContractCallResult<any, ContractCallResult>>, Type extends MetadataType = MetadataType> = F & {
33
32
  meta: Type extends 'ink' ? ContractCallMessage : SolAbiFunction;
34
33
  };
35
- export type GenericContractTxCall<ChainApi extends GenericSubstrateApi, F extends AnyFunc = (...args: any[]) => ContractSubmittableExtrinsic<ChainApi>, Type extends MetadataType = MetadataType> = F & {
34
+ export type GenericContractTxCall<F extends AnyFunc = (...args: any[]) => ContractSubmittableExtrinsic, Type extends MetadataType = MetadataType> = F & {
36
35
  meta: Type extends 'ink' ? ContractCallMessage : SolAbiFunction;
37
36
  };
38
- export type GenericConstructorQueryCall<ChainApi extends GenericSubstrateApi, F extends AsyncMethod = (...args: any[]) => Promise<GenericConstructorCallResult<any, ContractInstantiateResult<ChainApi>>>, Type extends MetadataType = MetadataType> = F & {
37
+ export type GenericConstructorQueryCall<F extends AsyncMethod = (...args: any[]) => Promise<GenericConstructorCallResult<any, ContractInstantiateResult>>, Type extends MetadataType = MetadataType> = F & {
39
38
  meta: Type extends 'ink' ? ContractConstructorMessage : SolAbiConstructor;
40
39
  };
41
- export type GenericConstructorTxCall<ChainApi extends GenericSubstrateApi, F extends AnyFunc = (...args: any[]) => GenericInstantiateSubmittableExtrinsic<ChainApi>, Type extends MetadataType = MetadataType> = F & {
40
+ export type GenericConstructorTxCall<F extends AnyFunc = (...args: any[]) => GenericInstantiateSubmittableExtrinsic, Type extends MetadataType = MetadataType> = F & {
42
41
  meta: Type extends 'ink' ? ContractConstructorMessage : SolAbiConstructor;
43
42
  };
44
- export interface GenericContractQuery<ChainApi extends GenericSubstrateApi, Type extends MetadataType = MetadataType> {
45
- [method: string]: GenericContractQueryCall<ChainApi, (...args: any[]) => Promise<GenericContractCallResult<any, ContractCallResult<ChainApi>>>, Type>;
43
+ export interface GenericContractQuery<Type extends MetadataType = MetadataType> {
44
+ [method: string]: GenericContractQueryCall<(...args: any[]) => Promise<GenericContractCallResult<any, ContractCallResult>>, Type>;
46
45
  }
47
- export interface GenericContractTx<ChainApi extends GenericSubstrateApi, Type extends MetadataType = MetadataType> {
48
- [method: string]: GenericContractTxCall<ChainApi, (...args: any[]) => ContractSubmittableExtrinsic<ChainApi>, Type>;
46
+ export interface GenericContractTx<Type extends MetadataType = MetadataType> {
47
+ [method: string]: GenericContractTxCall<(...args: any[]) => ContractSubmittableExtrinsic, Type>;
49
48
  }
50
- export interface GenericConstructorQuery<ChainApi extends GenericSubstrateApi, Type extends MetadataType = MetadataType> {
51
- [method: string]: GenericConstructorQueryCall<ChainApi, (...args: any[]) => Promise<GenericConstructorCallResult<any, ContractInstantiateResult<ChainApi>>>, Type>;
49
+ export interface GenericConstructorQuery<Type extends MetadataType = MetadataType> {
50
+ [method: string]: GenericConstructorQueryCall<(...args: any[]) => Promise<GenericConstructorCallResult<any, ContractInstantiateResult>>, Type>;
52
51
  }
53
- export interface GenericConstructorTx<ChainApi extends GenericSubstrateApi, Type extends MetadataType = MetadataType> {
54
- [method: string]: GenericConstructorTxCall<ChainApi, (...args: any[]) => GenericInstantiateSubmittableExtrinsic<ChainApi>, Type>;
52
+ export interface GenericConstructorTx<Type extends MetadataType = MetadataType> {
53
+ [method: string]: GenericConstructorTxCall<(...args: any[]) => GenericInstantiateSubmittableExtrinsic, Type>;
55
54
  }
56
55
  export type ContractEvent<EventName extends string = string, Data extends any = any> = Data extends undefined ? {
57
56
  name: EventName;
@@ -66,7 +65,7 @@ export interface GenericContractEvent<EventName extends string = string, Data ex
66
65
  watch: (callback: (events: ContractEvent<EventName, Data>[]) => void) => Promise<Unsub>;
67
66
  meta: Type extends 'ink' ? ContractEventMeta : SolAbiEvent;
68
67
  }
69
- export interface GenericContractEvents<_ extends GenericSubstrateApi, Type extends MetadataType = MetadataType> {
68
+ export interface GenericContractEvents<Type extends MetadataType = MetadataType> {
70
69
  [event: string]: GenericContractEvent<string, any, Type>;
71
70
  }
72
71
  export type GenericInkLangError = 'CouldNotReadInput' | any;
@@ -74,19 +73,19 @@ export type GenericRootStorage = any;
74
73
  export type GenericLazyStorage = any;
75
74
  export type MetadataType = 'ink' | 'sol';
76
75
  export type AB<Type extends MetadataType, A, B> = Type extends 'ink' ? A : B;
77
- export interface GenericContractApi<Rv extends RpcVersion = RpcVersion, ChainApi extends VersionedGenericSubstrateApi = SubstrateApi, Type extends MetadataType = MetadataType> {
76
+ export interface GenericContractApi<ChainApi extends GenericSubstrateApi = SubstrateApi, Type extends MetadataType = MetadataType> {
78
77
  metadataType: Type;
79
- query: GenericContractQuery<ChainApi[Rv], Type>;
80
- tx: GenericContractTx<ChainApi[Rv], Type>;
81
- constructorQuery: GenericConstructorQuery<ChainApi[Rv], Type>;
82
- constructorTx: GenericConstructorTx<ChainApi[Rv], Type>;
83
- events: GenericContractEvents<ChainApi[Rv], Type>;
78
+ query: GenericContractQuery<Type>;
79
+ tx: GenericContractTx<Type>;
80
+ constructorQuery: GenericConstructorQuery<Type>;
81
+ constructorTx: GenericConstructorTx<Type>;
82
+ events: GenericContractEvents<Type>;
84
83
  storage: AB<Type, {
85
84
  root(): Promise<GenericRootStorage>;
86
85
  lazy(): GenericLazyStorage;
87
86
  }, undefined>;
88
87
  types: {
89
- ChainApi: ChainApi[Rv];
88
+ ChainApi: ChainApi;
90
89
  [TypeName: string]: any;
91
90
  };
92
91
  }
@@ -96,7 +95,7 @@ type HasGetter<T> = T extends {
96
95
  export type WithLazyStorage<T> = {
97
96
  [K in keyof T as HasGetter<T[K]> extends true ? K : T[K] extends object ? keyof WithLazyStorage<T[K]> extends never ? never : K : never]: T[K] extends object ? HasGetter<T[K]> extends true ? T[K] : WithLazyStorage<T[K]> : never;
98
97
  };
99
- export interface InkGenericContractApi<Rv extends RpcVersion = RpcVersion, ChainApi extends VersionedGenericSubstrateApi = SubstrateApi> extends GenericContractApi<Rv, ChainApi, 'ink'> {
98
+ export interface InkGenericContractApi<ChainApi extends GenericSubstrateApi = SubstrateApi> extends GenericContractApi<ChainApi, 'ink'> {
100
99
  }
101
- export interface SolGenericContractApi<Rv extends RpcVersion = RpcVersion, ChainApi extends VersionedGenericSubstrateApi = SubstrateApi> extends GenericContractApi<Rv, ChainApi, 'sol'> {
100
+ export interface SolGenericContractApi<ChainApi extends GenericSubstrateApi = SubstrateApi> extends GenericContractApi<ChainApi, 'sol'> {
102
101
  }
package/types/shared.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { AccountId32Like, Bytes, BytesLike, DispatchError, H256, Weight } from '@dedot/codecs';
2
2
  import { Result } from '@dedot/shape';
3
- import { GenericSubstrateApi } from '@dedot/types';
4
3
  export type ContractAddress = string;
5
4
  /**
6
5
  * Flags used by a contract to customize exit behaviour.
@@ -47,14 +46,14 @@ export type InstantiateReturnValue = {
47
46
  result: ExecReturnValue;
48
47
  address: ContractAddress;
49
48
  };
50
- export type ContractCallResult<_ extends GenericSubstrateApi> = {
49
+ export type ContractCallResult = {
51
50
  gasConsumed: WeightV2;
52
51
  gasRequired: WeightV2;
53
52
  storageDeposit: StorageDeposit;
54
53
  debugMessage?: Bytes;
55
54
  result: Result<ExecReturnValue, DispatchError>;
56
55
  };
57
- export type ContractInstantiateResult<_ extends GenericSubstrateApi> = {
56
+ export type ContractInstantiateResult = {
58
57
  gasConsumed: WeightV2;
59
58
  gasRequired: WeightV2;
60
59
  storageDeposit: StorageDeposit;
package/utils/ensure.d.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import { ISubstrateClient } from '@dedot/api';
2
- import { SubstrateApi } from '@dedot/api/chaintypes';
3
2
  import { AccountId32Like, Hash } from '@dedot/codecs';
4
- import { RpcVersion } from '@dedot/types';
5
3
  import { LRUCache } from '@dedot/utils';
6
4
  import { ContractAddress, LooseContractMetadata } from '../types/index.js';
7
5
  export declare const ensureStorageApiSupports: (version: string | number) => void;
8
- export declare function ensurePalletPresence(client: ISubstrateClient<SubstrateApi[RpcVersion]>, isRevive: boolean): void;
9
- export declare function ensureContractPresence(client: ISubstrateClient<SubstrateApi[RpcVersion]>, isRevive: boolean, address: ContractAddress, cache?: LRUCache): Promise<void>;
6
+ export declare function ensurePalletPresence(client: ISubstrateClient, isRevive: boolean): void;
7
+ export declare function ensureContractPresence(client: ISubstrateClient, isRevive: boolean, address: ContractAddress, cache?: LRUCache): Promise<void>;
10
8
  export declare function ensureValidContractAddress(address: ContractAddress, isRevive: boolean): void;
11
9
  export declare function ensureValidAccountId32Address(address: AccountId32Like, customErrorMessage?: string): void;
12
10
  export declare function ensureValidCodeHashOrCode(codeHashOrCode: Hash | Uint8Array | string, isRevive: boolean): void;
package/utils/proxy.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { GenericSubstrateApi } from '@dedot/types';
2
2
  import { Executor } from 'src/executor';
3
- export declare function newProxyChain<ChainApi extends GenericSubstrateApi>(carrier: Executor<ChainApi>): unknown;
3
+ export declare function newProxyChain<ChainApi extends GenericSubstrateApi>(carrier: Executor): unknown;