dequanto 0.1.15 → 0.1.21
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/lib/cjs/config/Config.js.map +1 -1
- package/lib/cjs/gen/Generator.d.ts +2 -0
- package/lib/cjs/gen/Generator.js +2 -0
- package/lib/cjs/gen/Generator.js.map +1 -1
- package/lib/cjs/gen/GeneratorFromAbi.d.ts +30 -7
- package/lib/cjs/gen/GeneratorFromAbi.js +193 -110
- package/lib/cjs/gen/GeneratorFromAbi.js.map +1 -1
- package/lib/cjs/gen/GeneratorStorageReader.d.ts +1 -0
- package/lib/cjs/gen/GeneratorStorageReader.js +25 -9
- package/lib/cjs/gen/GeneratorStorageReader.js.map +1 -1
- package/lib/cjs/utils/$config.js +4 -0
- package/lib/cjs/utils/$config.js.map +1 -1
- package/lib/esm/config/Config.js.map +1 -1
- package/lib/esm/gen/Generator.d.ts +2 -0
- package/lib/esm/gen/Generator.js.map +1 -1
- package/lib/esm/gen/Generator.mjs +2 -0
- package/lib/esm/gen/GeneratorFromAbi.d.ts +30 -7
- package/lib/esm/gen/GeneratorFromAbi.js.map +1 -1
- package/lib/esm/gen/GeneratorFromAbi.mjs +193 -110
- package/lib/esm/gen/GeneratorStorageReader.d.ts +1 -0
- package/lib/esm/gen/GeneratorStorageReader.js.map +1 -1
- package/lib/esm/gen/GeneratorStorageReader.mjs +25 -9
- package/lib/esm/utils/$config.js.map +1 -1
- package/lib/esm/utils/$config.mjs +4 -0
- package/package.json +1 -1
- package/src/config/Config.ts +2 -1
- package/src/gen/ContractStorageReaderTemplate.js +17 -0
- package/src/gen/ContractTemplate.js +77 -0
- package/src/gen/Generator.ts +6 -0
- package/src/gen/GeneratorFromAbi.ts +204 -121
- package/src/gen/GeneratorStorageReader.ts +29 -11
- package/src/utils/$config.ts +4 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { config } from '../config/Config.mjs';
|
|
2
|
+
import { ConfigDefaults } from '../config/ConfigDefaults.mjs';
|
|
2
3
|
import { obj_getProperty, obj_setProperty } from 'atma-utils';
|
|
3
4
|
const $global = typeof global === 'undefined'
|
|
4
5
|
? window
|
|
@@ -14,6 +15,9 @@ export var $config;
|
|
|
14
15
|
envOptions = reloadEnv();
|
|
15
16
|
return get(path, $default);
|
|
16
17
|
}
|
|
18
|
+
if (value == null) {
|
|
19
|
+
value = obj_getProperty(ConfigDefaults, path);
|
|
20
|
+
}
|
|
17
21
|
return value ?? $default;
|
|
18
22
|
}
|
|
19
23
|
$config.get = get;
|
package/package.json
CHANGED
package/src/config/Config.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { TConfigParamsBrowser, TConfigParamsNode } from './AConfigBase';
|
|
|
4
4
|
import { IConfigData } from './interface/IConfigData';
|
|
5
5
|
import { ConfigProvider } from './ConfigProvider';
|
|
6
6
|
import { $logger } from '../utils/$logger';
|
|
7
|
+
import { ConfigDefaults } from './ConfigDefaults';
|
|
7
8
|
|
|
8
9
|
export class Config {
|
|
9
10
|
|
|
@@ -39,7 +40,7 @@ export class Config {
|
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
export const config = {} as IConfigData;
|
|
43
|
+
export const config = { } as IConfigData;
|
|
43
44
|
|
|
44
45
|
let provider = new ConfigProvider();
|
|
45
46
|
let singleton: class_Dfr<IConfigData> = null;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-Generated Class: $DATE$
|
|
3
|
+
* Implementation: $EXPLORER_URL$
|
|
4
|
+
*/
|
|
5
|
+
import di from 'a-di';
|
|
6
|
+
import { ClientEventsStream } from 'dequanto/clients/ClientEventsStream';
|
|
7
|
+
import { ContractBase } from 'dequanto/contracts/ContractBase';
|
|
8
|
+
import { ContractBaseUtils } from 'dequanto/contracts/utils/ContractBaseUtils';
|
|
9
|
+
import { ContractStorageReaderBase } from 'dequanto/contracts/ContractStorageReaderBase';
|
|
10
|
+
import { TxWriter } from 'dequanto/txs/TxWriter';
|
|
11
|
+
import { Web3Client } from 'dequanto/clients/Web3Client';
|
|
12
|
+
import { SubjectStream } from 'dequanto/class/SubjectStream';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/* IMPORTS */
|
|
17
|
+
|
|
18
|
+
/* ERRORS */
|
|
19
|
+
|
|
20
|
+
export class $NAME$ extends ContractBase {
|
|
21
|
+
constructor(
|
|
22
|
+
address = $ADDRESS$,
|
|
23
|
+
client = di.resolve($EthWeb3Client$, $Web3ClientOptions$),
|
|
24
|
+
explorer = di.resolve($Etherscan$, $EvmScanOptions$),
|
|
25
|
+
) {
|
|
26
|
+
super(address, client, explorer)
|
|
27
|
+
|
|
28
|
+
/* STORAGE_READER_INITIALIZER */
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/* META_PROPERTY */
|
|
33
|
+
|
|
34
|
+
/* METHODS */
|
|
35
|
+
|
|
36
|
+
$call () {
|
|
37
|
+
return super.$call();
|
|
38
|
+
}
|
|
39
|
+
$signed () {
|
|
40
|
+
return super.$signed();
|
|
41
|
+
}
|
|
42
|
+
$data () {
|
|
43
|
+
return super.$data();
|
|
44
|
+
}
|
|
45
|
+
$gas () {
|
|
46
|
+
return super.$gas();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
onTransaction (method, options) {
|
|
50
|
+
options ??= {};
|
|
51
|
+
options.filter ??= {};
|
|
52
|
+
options.filter.method = method;
|
|
53
|
+
return this.$onTransaction(options);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onLog (event, cb) {
|
|
57
|
+
return this.$onLog(event, cb);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async getPastLogs (mix, options) {
|
|
61
|
+
return await super.getPastLogs(mix, options);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* EVENTS */
|
|
65
|
+
|
|
66
|
+
/* EVENTS_EXTRACTORS */
|
|
67
|
+
|
|
68
|
+
/* EVENTS_FETCHERS */
|
|
69
|
+
|
|
70
|
+
abi = $ABI$
|
|
71
|
+
|
|
72
|
+
/* STORAGE_READER_PROPERTY */
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
/* STORAGE_READER_CLASS */
|
package/src/gen/Generator.ts
CHANGED
|
@@ -23,6 +23,8 @@ import { SolidityParser } from '@dequanto/solidity/SolidityParser';
|
|
|
23
23
|
export interface IGenerateOptions {
|
|
24
24
|
platform: TPlatform
|
|
25
25
|
|
|
26
|
+
target?: 'js' | 'ts'
|
|
27
|
+
|
|
26
28
|
// Class name to create
|
|
27
29
|
name: string
|
|
28
30
|
|
|
@@ -43,6 +45,8 @@ export interface IGenerateOptions {
|
|
|
43
45
|
|
|
44
46
|
output?: string
|
|
45
47
|
|
|
48
|
+
outputFileExt?: string
|
|
49
|
+
|
|
46
50
|
location?: string
|
|
47
51
|
|
|
48
52
|
/**
|
|
@@ -208,11 +212,13 @@ export class Generator {
|
|
|
208
212
|
let generator = di.resolve(GeneratorFromAbi);
|
|
209
213
|
let address = this.options.defaultAddress;
|
|
210
214
|
return await generator.generate(abi, {
|
|
215
|
+
target: this.options.target,
|
|
211
216
|
network: network,
|
|
212
217
|
name: name,
|
|
213
218
|
contractName: sources?.contractName,
|
|
214
219
|
address: address,
|
|
215
220
|
output: output,
|
|
221
|
+
outputFileExt: this.options.outputFileExt,
|
|
216
222
|
implementation: implementation,
|
|
217
223
|
sources: sources?.files,
|
|
218
224
|
sourceMain: sourceMain,
|