@dedot/contracts 1.0.0-next.a0f8d41e.25 → 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/package.json +6 -6
- package/types/index.d.ts +20 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/contracts",
|
|
3
|
-
"version": "1.0.0
|
|
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,10 +18,10 @@
|
|
|
18
18
|
"test": "npx vitest --watch=false"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dedot/api": "1.0.0
|
|
22
|
-
"@dedot/codecs": "1.0.0
|
|
23
|
-
"@dedot/types": "1.0.0
|
|
24
|
-
"@dedot/utils": "1.0.0
|
|
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
25
|
"viem": "^2.40.3"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"node": ">=18"
|
|
33
33
|
},
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "7767062a2188b4ac90561c5ad3cc3f06ac608a24",
|
|
36
36
|
"module": "./index.js",
|
|
37
37
|
"types": "./index.d.ts",
|
|
38
38
|
"exports": {
|
package/types/index.d.ts
CHANGED
|
@@ -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
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
45
|
-
[method: string]: GenericContractQueryCall<
|
|
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<
|
|
48
|
-
[method: string]: GenericContractTxCall<
|
|
46
|
+
export interface GenericContractTx<Type extends MetadataType = MetadataType> {
|
|
47
|
+
[method: string]: GenericContractTxCall<(...args: any[]) => ContractSubmittableExtrinsic, Type>;
|
|
49
48
|
}
|
|
50
|
-
export interface GenericConstructorQuery<
|
|
51
|
-
[method: string]: GenericConstructorQueryCall<
|
|
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<
|
|
54
|
-
[method: string]: GenericConstructorTxCall<
|
|
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<
|
|
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;
|
|
@@ -76,11 +75,11 @@ export type MetadataType = 'ink' | 'sol';
|
|
|
76
75
|
export type AB<Type extends MetadataType, A, B> = Type extends 'ink' ? A : B;
|
|
77
76
|
export interface GenericContractApi<ChainApi extends GenericSubstrateApi = SubstrateApi, Type extends MetadataType = MetadataType> {
|
|
78
77
|
metadataType: Type;
|
|
79
|
-
query: GenericContractQuery<
|
|
80
|
-
tx: GenericContractTx<
|
|
81
|
-
constructorQuery: GenericConstructorQuery<
|
|
82
|
-
constructorTx: GenericConstructorTx<
|
|
83
|
-
events: GenericContractEvents<
|
|
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;
|