@0xobelisk/sui-common 1.1.6 → 1.1.8

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.
@@ -1,7 +1,7 @@
1
- import fs from "node:fs/promises";
2
- import path from "node:path";
3
- import { formatMove, formatTypescript } from "./format";
4
- import { debug } from "../debug";
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { formatMove, formatTypescript } from './format';
4
+ import { debug } from '../debug';
5
5
 
6
6
  export async function formatAndWriteMove(
7
7
  output: string,
@@ -9,27 +9,30 @@ export async function formatAndWriteMove(
9
9
  logPrefix?: string
10
10
  ): Promise<void> {
11
11
  const formattedOutput = await formatMove(output);
12
- let schemaPrefix =
13
- ` // Copyright (c) Obelisk Labs, Inc.
12
+ let schemaPrefix = ` // Copyright (c) Obelisk Labs, Inc.
14
13
  // SPDX-License-Identifier: Apache-2.0
15
14
  #[allow(unused_use)]
16
15
 
17
16
  /* Autogenerated file. Do not edit manually. */
18
17
 
19
- `
18
+ `;
20
19
 
21
- let initPrefix = `#[test_only]`
20
+ let initPrefix = `#[test_only]`;
22
21
 
23
- let code = schemaPrefix + formattedOutput
22
+ let code = schemaPrefix + formattedOutput;
24
23
 
25
- let deployHookPrefix = `#[allow(lint(share_owned))]`
24
+ let deployHookPrefix = `#[allow(lint(share_owned))]`;
26
25
 
27
- if (fullOutputPath.includes(".toml") || fullOutputPath.includes("system") || fullOutputPath.includes("migrate")) {
28
- code = formattedOutput
29
- } else if (fullOutputPath.includes("init")) {
30
- code = initPrefix + formattedOutput
31
- } else if (fullOutputPath.includes("genesis")) {
32
- code = deployHookPrefix + formattedOutput
26
+ if (
27
+ fullOutputPath.includes('.toml') ||
28
+ fullOutputPath.includes('system') ||
29
+ fullOutputPath.includes('migrate')
30
+ ) {
31
+ code = formattedOutput;
32
+ } else if (fullOutputPath.includes('init')) {
33
+ code = initPrefix + formattedOutput;
34
+ } else if (fullOutputPath.includes('genesis')) {
35
+ code = deployHookPrefix + formattedOutput;
33
36
  }
34
37
 
35
38
  await fs.mkdir(path.dirname(fullOutputPath), { recursive: true });
@@ -44,9 +47,9 @@ export async function formatAndWriteMove(
44
47
  * @param logPrefix prefix for debug logs
45
48
  */
46
49
  export async function formatAndWriteTypescript(
47
- output: string,
48
- fullOutputPath: string,
49
- logPrefix: string,
50
+ output: string,
51
+ fullOutputPath: string,
52
+ logPrefix: string
50
53
  ): Promise<void> {
51
54
  const formattedOutput = await formatTypescript(output);
52
55
 
@@ -4,5 +4,5 @@
4
4
  * because solc expects `/` as path separator, but path.join produces `\` if the user is on windows.
5
5
  */
6
6
  export function posixPath(path: string): string {
7
- return path.replace(/\\/g, "/");
7
+ return path.replace(/\\/g, '/');
8
8
  }
@@ -2,21 +2,21 @@ import { MoveType } from '../../types';
2
2
  import fs from 'fs';
3
3
 
4
4
  export function deleteFolderRecursive(path: string) {
5
- if (fs.existsSync(path)) {
6
- fs.readdirSync(path).forEach(file => {
7
- const curPath = `${path}/${file}`;
8
- if (fs.lstatSync(curPath).isDirectory()) {
9
- deleteFolderRecursive(curPath);
10
- } else {
11
- fs.unlinkSync(curPath);
12
- }
13
- });
14
- fs.rmdirSync(path);
15
- }
5
+ if (fs.existsSync(path)) {
6
+ fs.readdirSync(path).forEach((file) => {
7
+ const curPath = `${path}/${file}`;
8
+ if (fs.lstatSync(curPath).isDirectory()) {
9
+ deleteFolderRecursive(curPath);
10
+ } else {
11
+ fs.unlinkSync(curPath);
12
+ }
13
+ });
14
+ fs.rmdirSync(path);
15
+ }
16
16
  }
17
17
 
18
18
  export function capitalizeFirstLetter(input: string): string {
19
- return input.charAt(0).toUpperCase() + input.slice(1);
19
+ return input.charAt(0).toUpperCase() + input.slice(1);
20
20
  }
21
21
 
22
22
  /**
@@ -25,17 +25,15 @@ export function capitalizeFirstLetter(input: string): string {
25
25
  * @param prefixArgs
26
26
  * @return [ name, age, birth_time ]
27
27
  */
28
- export function getStructAttrs(
29
- values: Record<string, string> | string
30
- ): string {
31
- return Object.entries(values)
32
- .map(([key, _]) => `${key}`)
33
- .join(',');
28
+ export function getStructAttrs(values: Record<string, string> | string): string {
29
+ return Object.entries(values)
30
+ .map(([key, _]) => `${key}`)
31
+ .join(',');
34
32
  }
35
33
 
36
34
  function isAddress(str: string): boolean {
37
- const regex = /^0x[a-fA-F0-9]+$/;
38
- return regex.test(str);
35
+ const regex = /^0x[a-fA-F0-9]+$/;
36
+ return regex.test(str);
39
37
  }
40
38
 
41
39
  /**
@@ -44,10 +42,8 @@ function isAddress(str: string): boolean {
44
42
  * @return ( bool , u64 , u64)
45
43
  */
46
44
  // export function getStructTypes(values: SchemaType): string {
47
- export function getStructTypes(
48
- values: Record<string, string>
49
- ): string {
50
- return `(${Object.entries(values).map(([_, type]) => `${type}`)})`;
45
+ export function getStructTypes(values: Record<string, string>): string {
46
+ return `(${Object.entries(values).map(([_, type]) => `${type}`)})`;
51
47
  }
52
48
 
53
49
  /**
@@ -55,30 +51,29 @@ export function getStructTypes(
55
51
  * @param values
56
52
  * @return Attributes and types of the struct. [ name: string, age: u64 ]
57
53
  */
58
- export function getStructAttrsWithType(
59
- values: Record<string, string>
60
- ): string[] {
61
- return Object.entries(values).map(([key, type]) => `${key}: ${type}`);
54
+ export function getStructAttrsWithType(values: Record<string, string>): string[] {
55
+ return Object.entries(values).map(([key, type]) => `${key}: ${type}`);
62
56
  }
63
57
 
64
58
  /**
65
59
  * @param values
66
60
  * @return [ data.name, data.age ]
67
61
  */
68
- export function getStructAttrsQuery(
69
- values: Record<string, string>,
70
- ): string[] {
71
- return Object.entries(values).map(([key, _]) => `self.${key}`);
62
+ export function getStructAttrsQuery(values: Record<string, string>): string[] {
63
+ return Object.entries(values).map(([key, _]) => `self.${key}`);
72
64
  }
73
65
 
74
66
  export function containsString(obj: Record<string, any>, searchString: string): boolean {
75
- for (const key in obj) {
76
- if (obj.hasOwnProperty(key)) {
77
- const value = obj[key];
78
- if (typeof value === 'string' && value === searchString) {
79
- return true;
80
- }
81
- }
82
- }
83
- return false;
67
+ for (const key in obj) {
68
+ if (obj.hasOwnProperty(key)) {
69
+ const value = obj[key];
70
+ if (
71
+ (typeof value === 'string' && value === searchString) ||
72
+ (typeof value === 'string' && value.includes(searchString) && value.includes('>'))
73
+ ) {
74
+ return true;
75
+ }
76
+ }
77
+ }
78
+ return false;
84
79
  }
@@ -1,16 +1,13 @@
1
1
  import { DubheConfig } from '../../types';
2
2
  import { formatAndWriteMove } from '../formatAndWrite';
3
3
 
4
- export async function generateDappKey(
5
- config: DubheConfig,
6
- srcPrefix: string
7
- ) {
8
- console.log('\nšŸ”‘ Starting DappKey Generation...');
9
- console.log(
10
- ` └─ Output path: ${srcPrefix}/contracts/${config.name}/sources/codegen/dapp_key.move`
11
- );
4
+ export async function generateDappKey(config: DubheConfig, srcPrefix: string) {
5
+ console.log('\nšŸ”‘ Starting DappKey Generation...');
6
+ console.log(
7
+ ` └─ Output path: ${srcPrefix}/contracts/${config.name}/sources/codegen/dapp_key.move`
8
+ );
12
9
 
13
- let code = `module ${config.name}::${config.name}_dapp_key {
10
+ let code = `module ${config.name}::${config.name}_dapp_key {
14
11
  \t/// Authorization token for the app.
15
12
  \tpublic struct DappKey has drop {}
16
13
 
@@ -19,10 +16,10 @@ export async function generateDappKey(
19
16
  \t}
20
17
  }
21
18
  `;
22
- await formatAndWriteMove(
23
- code,
24
- `${srcPrefix}/contracts/${config.name}/sources/codegen/dapp_key.move`,
25
- 'formatAndWriteMove'
26
- );
27
- console.log('āœ… DappKey Generation Complete\n');
19
+ await formatAndWriteMove(
20
+ code,
21
+ `${srcPrefix}/contracts/${config.name}/sources/codegen/dapp_key.move`,
22
+ 'formatAndWriteMove'
23
+ );
24
+ console.log('āœ… DappKey Generation Complete\n');
28
25
  }
@@ -3,19 +3,16 @@ import { formatAndWriteMove } from '../formatAndWrite';
3
3
  import { existsSync } from 'fs';
4
4
  import { capitalizeAndRemoveUnderscores } from './generateSchema';
5
5
 
6
- export async function generateDefaultSchema(
7
- config: DubheConfig,
8
- srcPrefix: string
9
- ) {
10
- await generateDappSchemaMetadata(config, srcPrefix);
11
- await generateDappSchema(config, srcPrefix);
12
- await generateDappSystem(config, srcPrefix);
6
+ export async function generateDefaultSchema(config: DubheConfig, srcPrefix: string) {
7
+ await generateDappSchemaMetadata(config, srcPrefix);
8
+ await generateDappSchema(config, srcPrefix);
9
+ await generateDappSystem(config, srcPrefix);
13
10
  }
14
11
 
15
12
  async function generateDappSchemaMetadata(config: DubheConfig, srcPrefix: string) {
16
- const path = `${srcPrefix}/contracts/${config.name}/sources/codegen/dapp/metadata.move`
17
- if (!existsSync(path)) {
18
- let code = `module ${config.name}::${config.name}_dapp_metadata {
13
+ const path = `${srcPrefix}/contracts/${config.name}/sources/codegen/dapp/metadata.move`;
14
+ if (!existsSync(path)) {
15
+ let code = `module ${config.name}::${config.name}_dapp_metadata {
19
16
  use std::ascii::String;
20
17
 
21
18
  public struct DappMetadata has drop, copy, store {
@@ -112,19 +109,14 @@ async function generateDappSchemaMetadata(config: DubheConfig, srcPrefix: string
112
109
 
113
110
  }
114
111
  `;
115
- await formatAndWriteMove(
116
- code,
117
- path,
118
- 'formatAndWriteMove'
119
- );
120
- }
112
+ await formatAndWriteMove(code, path, 'formatAndWriteMove');
113
+ }
121
114
  }
122
115
 
123
-
124
116
  async function generateDappSchema(config: DubheConfig, srcPrefix: string) {
125
- const path = `${srcPrefix}/contracts/${config.name}/sources/codegen/dapp/schema.move`
126
- if (!existsSync(path)) {
127
- let code = `module ${config.name}::${config.name}_dapp_schema {
117
+ const path = `${srcPrefix}/contracts/${config.name}/sources/codegen/dapp/schema.move`;
118
+ if (!existsSync(path)) {
119
+ let code = `module ${config.name}::${config.name}_dapp_schema {
128
120
  use ${config.name}::${config.name}_dapp_metadata::DappMetadata;
129
121
  use dubhe::storage_value;
130
122
  use dubhe::storage_value::StorageValue;
@@ -226,18 +218,14 @@ async function generateDappSchema(config: DubheConfig, srcPrefix: string) {
226
218
  }
227
219
  }
228
220
  `;
229
- await formatAndWriteMove(
230
- code,
231
- path,
232
- 'formatAndWriteMove'
233
- );
234
- }
221
+ await formatAndWriteMove(code, path, 'formatAndWriteMove');
222
+ }
235
223
  }
236
224
 
237
225
  async function generateDappSystem(config: DubheConfig, srcPrefix: string) {
238
- const path = `${srcPrefix}/contracts/${config.name}/sources/codegen/dapp/system.move`
239
- if (!existsSync(path)) {
240
- let code = `module ${config.name}::${config.name}_dapp_system {
226
+ const path = `${srcPrefix}/contracts/${config.name}/sources/codegen/dapp/system.move`;
227
+ if (!existsSync(path)) {
228
+ let code = `module ${config.name}::${config.name}_dapp_system {
241
229
  use std::ascii::String;
242
230
  use std::ascii;
243
231
  use dubhe::type_info;
@@ -325,10 +313,6 @@ async function generateDappSystem(config: DubheConfig, srcPrefix: string) {
325
313
 
326
314
 
327
315
  `;
328
- await formatAndWriteMove(
329
- code,
330
- path,
331
- 'formatAndWriteMove'
332
- );
333
- }
334
- }
316
+ await formatAndWriteMove(code, path, 'formatAndWriteMove');
317
+ }
318
+ }
@@ -1,42 +1,37 @@
1
- import {BaseType, ErrorData, SchemaType} from '../../types';
1
+ import { BaseType, ErrorData, SchemaType } from '../../types';
2
2
  import { formatAndWriteMove } from '../formatAndWrite';
3
3
  import {
4
- getStructAttrsWithType,
5
- getStructAttrs,
6
- getStructTypes,
7
- getStructAttrsQuery,
4
+ getStructAttrsWithType,
5
+ getStructAttrs,
6
+ getStructTypes,
7
+ getStructAttrsQuery
8
8
  } from './common';
9
9
 
10
10
  function convertToSnakeCase(input: string): string {
11
- return input
12
- .replace(/([A-Z])/g, '_$1')
13
- .toLowerCase()
14
- .replace(/^_/, '');
11
+ return input
12
+ .replace(/([A-Z])/g, '_$1')
13
+ .toLowerCase()
14
+ .replace(/^_/, '');
15
15
  }
16
16
 
17
- export async function generateSchemaError(
18
- projectName: string,
19
- errors: ErrorData,
20
- path: string
21
- ) {
22
- console.log('\nšŸ“¦ Starting Schema Error Generation...');
17
+ export async function generateSchemaError(projectName: string, errors: ErrorData, path: string) {
18
+ console.log('\nšŸ“¦ Starting Schema Error Generation...');
23
19
 
24
- let code = `module ${projectName}::${projectName}_errors {
25
- ${Object.entries(errors).map(([name, message]) => {
26
- console.log(` ā”œā”€ Generating Error: ${name}`);
27
- console.log(` │ └─ Message: ${message}`);
28
- return `#[error]
29
- const ${name}: vector<u8> = b"${message}";
30
- public fun ${convertToSnakeCase(name)}_error(condition: bool) { assert!(condition, ${name}) }
31
- `
32
- }).join('\n')}
33
- }`
20
+ let code = `module ${projectName}::${projectName}_errors {
21
+ ${Object.entries(errors)
22
+ .map(([name, message]) => {
23
+ console.log(` └─ ${name}: ${message}`);
24
+ return `#[error]
25
+ const ${name.toUpperCase()}: vector<u8> = b"${message}";
26
+ public fun ${name}_error(condition: bool) { assert!(condition, ${name.toUpperCase()}) }
27
+ `;
28
+ })
29
+ .join('\n')}
30
+ }`;
34
31
 
35
-
36
- await formatAndWriteMove(
37
- code,
38
- `${path}/contracts/${projectName}/sources/codegen/errors.move`,
39
- 'formatAndWriteMove'
40
- );
41
- console.log('āœ… Schema Error Generation Complete\n');
42
- }
32
+ await formatAndWriteMove(
33
+ code,
34
+ `${path}/contracts/${projectName}/sources/codegen/errors.move`,
35
+ 'formatAndWriteMove'
36
+ );
37
+ }
@@ -1,110 +1,98 @@
1
- import {BaseType, EventData, SchemaData, SchemaType} from '../../types';
1
+ import { BaseType, EventData, SchemaData, SchemaType } from '../../types';
2
2
  import { formatAndWriteMove } from '../formatAndWrite';
3
3
  import {
4
- getStructAttrsWithType,
5
- getStructAttrs,
6
- getStructTypes,
7
- getStructAttrsQuery,
4
+ getStructAttrsWithType,
5
+ getStructAttrs,
6
+ getStructTypes,
7
+ getStructAttrsQuery
8
8
  } from './common';
9
9
 
10
- function capitalizeAndRemoveUnderscores(input: string): string {
11
- return input
12
- .split('_')
13
- .map((word, index) => {
14
- return index === 0
15
- ? word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
16
- : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
17
- })
18
- .join('');
10
+ // account_not_found => AccountNotFound,
11
+ function toPascalCase(str: string): string {
12
+ return str
13
+ .split('_')
14
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
15
+ .join('');
19
16
  }
20
17
 
21
18
  function convertToSnakeCase(input: string): string {
22
- return input
23
- .replace(/([A-Z])/g, '_$1')
24
- .toLowerCase()
25
- .replace(/^_/, '');
19
+ return input
20
+ .replace(/([A-Z])/g, '_$1')
21
+ .toLowerCase()
22
+ .replace(/^_/, '');
26
23
  }
27
24
 
28
- function generateImport(
29
- projectName: string,
30
- data: Record<string, SchemaData> | null,
31
- ) {
32
- if (data != null) {
33
- const names = Object.keys(data);
34
- return names
35
- .map(name => {
36
- return `use ${projectName}::${projectName}_${convertToSnakeCase(
37
- name,
38
- )}::${name};`;
39
- })
40
- .join('\n');
41
- } else {
42
- return '';
43
- }
25
+ function generateImport(projectName: string, data: Record<string, SchemaData> | null) {
26
+ if (data != null) {
27
+ const names = Object.keys(data);
28
+ return names
29
+ .map((name) => {
30
+ return `use ${projectName}::${projectName}_${convertToSnakeCase(name)}::${name};`;
31
+ })
32
+ .join('\n');
33
+ } else {
34
+ return '';
35
+ }
44
36
  }
45
37
 
46
38
  export async function generateSchemaEvent(
47
- projectName: string,
48
- data: Record<string, SchemaData> | null,
49
- events: Record<string, EventData>,
50
- path: string
39
+ projectName: string,
40
+ data: Record<string, SchemaData> | null,
41
+ events: Record<string, EventData>,
42
+ path: string
51
43
  ) {
52
- console.log('\nšŸ“¦ Starting Schema Event Generation...');
53
- for (const key of Object.keys(events)) {
54
- const name = key;
55
- const fields = events[key];
56
- console.log(
57
- ` └─ Generating ${name} event: ${fields}`
58
- );
44
+ console.log('\nšŸ“¦ Starting Schema Event Generation...');
45
+ for (const key of Object.keys(events)) {
46
+ const name = key;
47
+ const fields = events[key];
48
+ console.log(` └─ ${name} event: ${JSON.stringify(fields)}`);
59
49
 
60
- let code = `module ${projectName}::${projectName}_${convertToSnakeCase(name)}_event {
50
+ let code = `module ${projectName}::${projectName}_${name}_event {
61
51
  use sui::event;
62
52
  use std::ascii::String;
63
53
  ${generateImport(projectName, data)}
64
54
 
65
- public struct ${name}Event has copy, drop {
55
+ public struct ${toPascalCase(name)}Event has copy, drop {
66
56
  ${getStructAttrsWithType(fields as Record<string, string>)}
67
57
  }
68
58
 
69
- public fun new(${getStructAttrsWithType(fields as Record<string, string>)}): ${name}Event {
70
- ${name}Event {
59
+ public fun new(${getStructAttrsWithType(fields as Record<string, string>)}): ${toPascalCase(name)}Event {
60
+ ${toPascalCase(name)}Event {
71
61
  ${getStructAttrs(fields as Record<string, string>)}
72
62
  }
73
63
  }
74
64
  }`;
75
- await formatAndWriteMove(
76
- code,
77
- `${path}/contracts/${projectName}/sources/codegen/data/${convertToSnakeCase(
78
- name
79
- )}_event.move`,
80
- 'formatAndWriteMove'
81
- );
82
- }
65
+ await formatAndWriteMove(
66
+ code,
67
+ `${path}/contracts/${projectName}/sources/codegen/data/${name}_event.move`,
68
+ 'formatAndWriteMove'
69
+ );
70
+ }
83
71
 
84
- let code = `module ${projectName}::${projectName}_events {
72
+ let code = `module ${projectName}::${projectName}_events {
85
73
  use std::ascii::{String, string};
86
74
  ${generateImport(projectName, data)}
87
- ${Object.entries(events).map(([name, fields]) => {
88
- return `
89
- use ${projectName}::${projectName}_${convertToSnakeCase(name)}_event::${name}Event;
90
- use ${projectName}::${projectName}_${convertToSnakeCase(name)}_event;
91
- public fun ${convertToSnakeCase(name)}_event(${getStructAttrsWithType(fields as Record<string, string>)}) {
92
- dubhe::storage_event::emit_set_record<${name}Event, ${name}Event, ${name}Event>(
93
- string(b"${convertToSnakeCase(name)}_event"),
75
+ ${Object.entries(events)
76
+ .map(([name, fields]) => {
77
+ return `
78
+ use ${projectName}::${projectName}_${name}_event::${toPascalCase(name)}Event;
79
+ use ${projectName}::${projectName}_${name}_event;
80
+ public fun ${name}_event(${getStructAttrsWithType(fields as Record<string, string>)}) {
81
+ dubhe::storage_event::emit_set_record<${toPascalCase(name)}Event, ${toPascalCase(name)}Event, ${toPascalCase(name)}Event>(
82
+ string(b"${name}_event"),
94
83
  option::none(),
95
84
  option::none(),
96
- option::some(${projectName}_${convertToSnakeCase(name)}_event::new(${getStructAttrs(fields as Record<string, string>)}))
85
+ option::some(${projectName}_${name}_event::new(${getStructAttrs(fields as Record<string, string>)}))
97
86
  )
98
87
  }
99
- `
100
- }).join('\n')}
101
- }`
88
+ `;
89
+ })
90
+ .join('\n')}
91
+ }`;
102
92
 
103
-
104
- await formatAndWriteMove(
105
- code,
106
- `${path}/contracts/${projectName}/sources/codegen/events.move`,
107
- 'formatAndWriteMove'
108
- );
109
- console.log('āœ… Schema Event Generation Complete\n');
110
- }
93
+ await formatAndWriteMove(
94
+ code,
95
+ `${path}/contracts/${projectName}/sources/codegen/events.move`,
96
+ 'formatAndWriteMove'
97
+ );
98
+ }
@@ -3,16 +3,8 @@ import { formatAndWriteMove } from '../formatAndWrite';
3
3
  import { existsSync } from 'fs';
4
4
  import { capitalizeAndRemoveUnderscores } from './generateSchema';
5
5
 
6
- export async function generateInit(
7
- config: DubheConfig,
8
- srcPrefix: string
9
- ) {
10
- console.log('\nšŸ“ Starting Init Generation...');
11
- console.log(
12
- ` └─ Output path: ${srcPrefix}/contracts/${config.name}/sources/tests/init.move`
13
- );
14
-
15
- let init_test_code = `module ${config.name}::${config.name}_init_test {
6
+ export async function generateInit(config: DubheConfig, srcPrefix: string) {
7
+ let init_test_code = `module ${config.name}::${config.name}_init_test {
16
8
  use ${config.name}::${config.name}_dapp_schema::Dapp;
17
9
  use sui::clock;
18
10
  use sui::test_scenario;
@@ -30,13 +22,13 @@ export async function generateInit(
30
22
  }
31
23
  }
32
24
  `;
33
- await formatAndWriteMove(
34
- init_test_code,
35
- `${srcPrefix}/contracts/${config.name}/sources/tests/init.move`,
36
- 'formatAndWriteMove'
37
- );
25
+ await formatAndWriteMove(
26
+ init_test_code,
27
+ `${srcPrefix}/contracts/${config.name}/sources/tests/init.move`,
28
+ 'formatAndWriteMove'
29
+ );
38
30
 
39
- let init_code = `module ${config.name}::${config.name}_genesis {
31
+ let init_code = `module ${config.name}::${config.name}_genesis {
40
32
  use std::ascii::string;
41
33
 
42
34
  use sui::clock::Clock;
@@ -56,11 +48,9 @@ export async function generateInit(
56
48
  }
57
49
  }
58
50
  `;
59
- await formatAndWriteMove(
60
- init_code,
61
- `${srcPrefix}/contracts/${config.name}/sources/codegen/genesis.move`,
62
- 'formatAndWriteMove'
63
- );
64
-
65
- console.log('āœ… Init Generation Complete\n');
66
- }
51
+ await formatAndWriteMove(
52
+ init_code,
53
+ `${srcPrefix}/contracts/${config.name}/sources/codegen/genesis.move`,
54
+ 'formatAndWriteMove'
55
+ );
56
+ }