@0xobelisk/sui-common 0.5.23 ā 0.5.25
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/dist/index.d.ts +2 -3
- package/dist/index.js +413 -198
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/codegen/types/index.ts +1 -2
- package/src/codegen/utils/formatAndWrite.ts +6 -4
- package/src/codegen/utils/renderMove/generateDefaultSchema.ts +327 -0
- package/src/codegen/utils/renderMove/generateError.ts +5 -4
- package/src/codegen/utils/renderMove/generateInit.ts +40 -0
- package/src/codegen/utils/renderMove/generateSchema.ts +18 -14
- package/src/codegen/utils/renderMove/generateScript.ts +78 -82
- package/src/codegen/utils/renderMove/generateToml.ts +1 -2
- package/src/codegen/utils/renderMove/schemaGen.ts +7 -25
|
@@ -9,25 +9,13 @@ import { generateSchemaEvent } from './generateEvent';
|
|
|
9
9
|
import { generateSystem } from './generateSystem';
|
|
10
10
|
import { generateSchemaHub } from './generateSchemaHub';
|
|
11
11
|
import { generateSchemaError } from './generateError';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
network: 'mainnet' | 'testnet' | 'devnet' | 'localnet',
|
|
15
|
-
): string {
|
|
16
|
-
switch (network) {
|
|
17
|
-
case 'testnet':
|
|
18
|
-
return '0x417ad1864a56a29ad0b5aaddd2e11bac1eeab6a68883ef53184a4cc5c293fec6';
|
|
19
|
-
case 'localnet':
|
|
20
|
-
return '0x417ad1864a56a29ad0b5aaddd2e11bac1eeab6a68883ef53184a4cc5c293fec6';
|
|
21
|
-
default:
|
|
22
|
-
return '0x417ad1864a56a29ad0b5aaddd2e11bac1eeab6a68883ef53184a4cc5c293fec6';
|
|
23
|
-
}
|
|
24
|
-
}
|
|
12
|
+
import {generateDefaultSchema} from "./generateDefaultSchema";
|
|
13
|
+
import {generateInit} from "./generateInit";
|
|
25
14
|
|
|
26
15
|
export async function schemaGen(
|
|
27
16
|
config: DubheConfig,
|
|
28
17
|
srcPrefix?: string,
|
|
29
|
-
network?: 'mainnet' | 'testnet' | 'devnet' | 'localnet'
|
|
30
|
-
frameworkId?: string,
|
|
18
|
+
network?: 'mainnet' | 'testnet' | 'devnet' | 'localnet'
|
|
31
19
|
) {
|
|
32
20
|
console.log('\nš Starting Schema Generation Process...');
|
|
33
21
|
console.log('š Project Configuration:');
|
|
@@ -36,16 +24,9 @@ export async function schemaGen(
|
|
|
36
24
|
` āā Description: ${config.description || 'No description provided'}`,
|
|
37
25
|
);
|
|
38
26
|
console.log(` āā Network: ${network || 'testnet'}`);
|
|
39
|
-
console.log(
|
|
40
|
-
` āā Framework ID: ${
|
|
41
|
-
frameworkId || matchFrameworkId(network ?? 'testnet')
|
|
42
|
-
}\n`,
|
|
43
|
-
);
|
|
44
27
|
|
|
45
28
|
const path = srcPrefix ?? process.cwd();
|
|
46
29
|
|
|
47
|
-
frameworkId = frameworkId || matchFrameworkId(network ?? 'testnet');
|
|
48
|
-
|
|
49
30
|
if (existsSync(`${path}/contracts/${config.name}`)) {
|
|
50
31
|
deleteFolderRecursive(
|
|
51
32
|
`${path}/contracts/${config.name}/sources/codegen`,
|
|
@@ -53,7 +34,7 @@ export async function schemaGen(
|
|
|
53
34
|
}
|
|
54
35
|
|
|
55
36
|
if (!existsSync(`${path}/contracts/${config.name}/Move.toml`)) {
|
|
56
|
-
await generateToml(config, path
|
|
37
|
+
await generateToml(config, path);
|
|
57
38
|
}
|
|
58
39
|
|
|
59
40
|
if (
|
|
@@ -68,8 +49,9 @@ export async function schemaGen(
|
|
|
68
49
|
await generateSchemaStructure(config.name, config.schemas, path);
|
|
69
50
|
await generateSchemaEvent(config.name, config.schemas, path);
|
|
70
51
|
await generateSchemaError(config.name, config.schemas, path);
|
|
71
|
-
|
|
72
|
-
await
|
|
52
|
+
|
|
53
|
+
await generateDefaultSchema(config, path);
|
|
54
|
+
await generateInit(config, path);
|
|
73
55
|
await generateSystem(config, path);
|
|
74
56
|
await generateMigrate(config, path);
|
|
75
57
|
|