@0xobelisk/sui-common 1.0.2 → 1.0.4

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.
@@ -35,24 +35,17 @@ export async function generateDeployHook(
35
35
  use std::ascii::string;
36
36
  use sui::clock::Clock;
37
37
  use ${config.name}::dapp_system;
38
- ${importSchemas}
39
38
  public entry fun run(clock: &Clock, ctx: &mut TxContext) {
40
39
  // Create a dapp.
41
40
  let mut dapp = dapp_system::create(string(b"${config.name}"),string(b"${config.description}"), clock , ctx);
42
41
 
43
42
  // Create schemas
44
- ${Object.keys(config.schemas).map(schemaName => {
45
- return `let mut ${schemaName} = ${config.name}::${schemaName}_schema::create(ctx);`;
46
- }).join('\n')}
43
+ let mut schema = ${config.name}::schema::create(ctx);
47
44
  // Logic that needs to be automated once the contract is deployed
48
45
  {
49
46
  };
50
47
  // Authorize schemas and public share objects
51
- ${Object.keys(config.schemas).map(schemaName => {
52
- return `
53
- dapp.add_schema<${capitalizeAndRemoveUnderscores(schemaName)}>(${schemaName}, ctx);
54
- `;
55
- }).join('\n')}
48
+ dapp.add_schema(schema);
56
49
  sui::transfer::public_share_object(dapp);
57
50
  }
58
51
  }` } else {
@@ -61,15 +54,12 @@ export async function generateDeployHook(
61
54
  use std::ascii::string;
62
55
  use sui::clock::Clock;
63
56
  use ${config.name}::dapp_system;
64
- ${importSchemas}
65
57
  public entry fun run(clock: &Clock, ctx: &mut TxContext) {
66
58
  // Create a dapp.
67
59
  let mut dapp = dapp_system::create(string(b"${config.name}"),string(b"${config.description}"), clock , ctx);
68
60
 
69
61
  // Create schemas
70
- ${Object.keys(config.schemas).map(schemaName => {
71
- return `let mut ${schemaName} = ${config.name}::${schemaName}_schema::create(ctx);`;
72
- }).join('\n')}
62
+ let mut schema = ${config.name}::schema::create(ctx);
73
63
  // Logic that needs to be automated once the contract is deployed
74
64
 
75
65
  {
@@ -77,11 +67,7 @@ export async function generateDeployHook(
77
67
  };
78
68
 
79
69
  // Authorize schemas and public share objects
80
- ${Object.keys(config.schemas).map(schemaName => {
81
- return `
82
- dapp.add_schema<${capitalizeAndRemoveUnderscores(schemaName)}>(${schemaName}, ctx);
83
- `;
84
- }).join('\n')}
70
+ dapp.add_schema(schema);
85
71
  sui::transfer::public_share_object(dapp);
86
72
  }
87
73
  }`