1
1
import { AccountContext } from "./context" ;
2
- declare type State = {
3
- [ key : string ] : string ;
4
- } ;
2
+ import { State , StandaloneOutput , ResultsObject } from './types' ;
3
+ /**
4
+ * Account object of client and contracts.
5
+ */
5
6
export declare class Account {
6
7
account_id : string ;
7
8
wasmFile : string | null ;
@@ -10,28 +11,65 @@ export declare class Account {
10
11
balance : number ;
11
12
lockedBalance : number ;
12
13
signerAccountPk : string ;
14
+ /**
15
+ * Sholud only be constructed by a runtime instance.
16
+ * @param account_id
17
+ * @param wasmFile
18
+ * @param runtime
19
+ */
13
20
constructor ( account_id : string , wasmFile : string | null , runtime : Runtime ) ;
14
- createAccountContext ( input ?: any , prepaid_gas ?: number ) : Partial < AccountContext > ;
15
- call_step_other ( account_id : string , method_name : string , input ?: any , prepaid_gas ?: number ) : any ;
16
- call_step ( method_name : string , input ?: any , prepaid_gas ?: number ) : any ;
21
+ private createAccountContext ;
22
+ /**
23
+ * Single execution of contract method.
24
+ * @param account_id contractId to call
25
+ * @param method_name method to call
26
+ * @param input object of arguments of method
27
+ * @param prepaid_gas How much gas to use.
28
+ */
29
+ call_step_other ( account_id : string , method_name : string , input ?: any , prepaid_gas ?: number ) : StandaloneOutput ;
30
+ /**
31
+ * Single execution of contract method to the same contract.
32
+ * @param method_name method to call
33
+ * @param input object of arguments of method
34
+ * @param prepaid_gas How much gas to use.
35
+ */
36
+ call_step ( method_name : string , input ?: any , prepaid_gas ?: number ) : StandaloneOutput ;
37
+ /**
38
+ * Execute contract and any promises generated until no more promises are generated or gas runs out.
39
+ * @param account_id Initial Contract to call.
40
+ * @param method_name Method to call.
41
+ * @param input object of input to method.
42
+ * @param prepaid_gas How much gas to use.
43
+ */
17
44
call_other ( account_id : string , method_name : string , input ?: any , prepaid_gas ?: number ) : {
18
45
return_data : any ;
19
46
err : any ;
20
- result : any ;
47
+ result : StandaloneOutput ;
21
48
calls : any ;
22
- results : any ;
49
+ results : ResultsObject ;
23
50
} ;
51
+ /**
52
+ * Execute this contract and any promises generated until no more promises are generated or gas runs out.
53
+ * @param method_name Method to call.
54
+ * @param input object of input to method.
55
+ * @param prepaid_gas How much gas to use.
56
+ */
24
57
call ( method_name : string , input ?: any , prepaid_gas ?: number ) : {
25
58
return_data : any ;
26
59
err : any ;
27
- result : any ;
60
+ result : StandaloneOutput ;
28
61
calls : any ;
29
- results : any ;
62
+ results : ResultsObject ;
30
63
} ;
64
+ /**
65
+ * View contract call to this contract.
66
+ * @param method_name view method.
67
+ * @param input object of input to method.
68
+ */
31
69
view ( method_name : string , input ?: any ) : {
32
- return_data : any ;
70
+ return_value : string ;
33
71
err : any ;
34
- result : any ;
72
+ result : StandaloneOutput ;
35
73
} ;
36
74
/**
37
75
* Current state of contract.
@@ -41,18 +79,17 @@ export declare class Account {
41
79
export declare class Runtime {
42
80
accounts : Map < string , Account > ;
43
81
constructor ( ) ;
44
- log ( input : any ) : void ;
82
+ private log ;
45
83
newAccount ( accoundId : string , wasmFile ?: string | null ) : Account ;
46
84
getOrCreateAccount ( account_id : string ) : Account ;
47
85
getAccount ( account_id : string ) : Account ;
48
- call_step ( account_id : string , method_name : string , input ?: string , accountContext ?: Partial < AccountContext > ) : any ;
86
+ call_step ( account_id : string , method_name : string , input ?: string , accountContext ?: Partial < AccountContext > ) : StandaloneOutput ;
49
87
call ( account_id : string , method_name : string , input : string | undefined , accountContext : Partial < AccountContext > ) : {
50
88
return_data : any ;
51
89
err : any ;
52
- result : any ;
90
+ result : StandaloneOutput ;
53
91
calls : any ;
54
- results : any ;
92
+ results : ResultsObject ;
55
93
} ;
56
94
private spawn ;
57
95
}
58
- export { } ;
0 commit comments