@0xobelisk/sui-common 1.2.0-pre.118 → 1.2.0-pre.119
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 +54 -4
- package/dist/index.js +956 -158
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/codegen/types/index.ts +37 -3
- package/src/codegen/utils/formatAndWrite.ts +2 -3
- package/src/codegen/utils/generateLock.ts +119 -0
- package/src/codegen/utils/index.ts +4 -1
- package/src/codegen/utils/renderMove/{schemaGen.ts → codegen.ts} +29 -8
- package/src/codegen/utils/renderMove/dapp.ts +2 -0
- package/src/codegen/utils/renderMove/generateDappKey.ts +3 -3
- package/src/codegen/utils/renderMove/generateError.ts +2 -2
- package/src/codegen/utils/renderMove/generateGenesis.ts +2 -2
- package/src/codegen/utils/renderMove/generateObjects.ts +373 -0
- package/src/codegen/utils/renderMove/generatePermits.ts +148 -0
- package/src/codegen/utils/renderMove/generateResources.ts +588 -54
- package/src/codegen/utils/renderMove/generateScenes.ts +454 -0
- package/src/codegen/utils/renderMove/generateScript.ts +15 -2
- package/src/codegen/utils/validateConfig.ts +206 -0
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,38 @@ type Component = {
|
|
|
9
9
|
global?: boolean;
|
|
10
10
|
fields: Record<string, MoveType>;
|
|
11
11
|
keys?: string[];
|
|
12
|
+
reactive?: boolean;
|
|
13
|
+
fungible?: boolean;
|
|
14
|
+
transferable?: boolean;
|
|
15
|
+
listable?: boolean;
|
|
16
|
+
};
|
|
17
|
+
/** Config for a DApp-owned named shared object (e.g. guild, boss). */
|
|
18
|
+
type ObjectConfig = {
|
|
19
|
+
fields: Record<string, MoveType>;
|
|
20
|
+
/** Resources (from the `resources` section) this object accepts for transfers. */
|
|
21
|
+
accepts?: string[];
|
|
22
|
+
/** Other objects/scenes whose data can be transferred into this object. */
|
|
23
|
+
acceptsFrom?: string[];
|
|
24
|
+
/** If true, only the DApp admin can call create_<key>. */
|
|
25
|
+
adminOnly?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/** Config for a standalone ScenePermit (participant management only). */
|
|
28
|
+
type PermitConfig = {};
|
|
29
|
+
type SceneAuthorization = {
|
|
30
|
+
kind: 'permit';
|
|
31
|
+
permit: string;
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'system';
|
|
34
|
+
};
|
|
35
|
+
/** Config for a SceneStorage object (pure data storage, symmetric to ObjectConfig). */
|
|
36
|
+
type SceneConfig = {
|
|
37
|
+
fields: Record<string, MoveType>;
|
|
38
|
+
/** Resources this scene accepts for transfers. */
|
|
39
|
+
accepts?: string[];
|
|
40
|
+
/** Other objects/scenes whose data can be transferred into this scene. */
|
|
41
|
+
acceptsFrom?: string[];
|
|
42
|
+
/** Explicit write authorization model for this SceneStorage. */
|
|
43
|
+
authorization: SceneAuthorization;
|
|
12
44
|
};
|
|
13
45
|
type ErrorDefinition = {
|
|
14
46
|
message: string;
|
|
@@ -19,6 +51,9 @@ type DubheConfig = {
|
|
|
19
51
|
description: string;
|
|
20
52
|
enums?: Record<string, string[]>;
|
|
21
53
|
resources?: Record<string, Component | MoveType>;
|
|
54
|
+
objects?: Record<string, ObjectConfig>;
|
|
55
|
+
permits?: Record<string, PermitConfig>;
|
|
56
|
+
scenes?: Record<string, SceneConfig>;
|
|
22
57
|
errors?: Record<string, ErrorEntry>;
|
|
23
58
|
};
|
|
24
59
|
type DubheMetadata = {
|
|
@@ -28,15 +63,30 @@ type DubheMetadata = {
|
|
|
28
63
|
type BaseType = any;
|
|
29
64
|
type ErrorData = Record<string, ErrorEntry>;
|
|
30
65
|
type EventData = any;
|
|
31
|
-
type SchemaData = any;
|
|
32
|
-
type SchemaType = any;
|
|
33
66
|
|
|
34
|
-
declare function
|
|
67
|
+
declare function codegen(rootDir: string, config: DubheConfig, network?: 'mainnet' | 'testnet' | 'devnet' | 'localnet', initialMode?: 0 | 1): Promise<void>;
|
|
68
|
+
/** @deprecated Use `codegen` instead. */
|
|
69
|
+
declare const schemaGen: typeof codegen;
|
|
35
70
|
|
|
36
71
|
declare const defineConfig: (config: DubheConfig) => DubheConfig;
|
|
37
72
|
|
|
73
|
+
declare function generateObjects(config: DubheConfig, outputDir: string): Promise<void>;
|
|
74
|
+
|
|
75
|
+
declare function generateScenes(config: DubheConfig, outputDir: string): Promise<void>;
|
|
76
|
+
|
|
38
77
|
declare function loadConfig(configPath?: string): Promise<unknown>;
|
|
39
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Read the existing lock file (if any), check for breaking changes against the
|
|
81
|
+
* current config, then write an updated lock file.
|
|
82
|
+
*
|
|
83
|
+
* Call this at the start of `codegen()` before any file generation begins.
|
|
84
|
+
*
|
|
85
|
+
* @param rootDir The project root directory (same dir passed to `codegen()`).
|
|
86
|
+
* @param config The parsed DubheConfig.
|
|
87
|
+
*/
|
|
88
|
+
declare function checkAndUpdateLock(rootDir: string, config: DubheConfig): void;
|
|
89
|
+
|
|
40
90
|
declare enum SubscriptionKind {
|
|
41
91
|
Event = "event",
|
|
42
92
|
Schema = "schema"
|
|
@@ -50,4 +100,4 @@ type SubscribableType = {
|
|
|
50
100
|
name?: string;
|
|
51
101
|
};
|
|
52
102
|
|
|
53
|
-
export { BaseType, Component, ComponentType, DubheConfig, DubheMetadata, ErrorData, ErrorDefinition, ErrorEntry, EventData, MoveType,
|
|
103
|
+
export { BaseType, Component, ComponentType, DubheConfig, DubheMetadata, ErrorData, ErrorDefinition, ErrorEntry, EventData, MoveType, ObjectConfig, PermitConfig, SceneAuthorization, SceneConfig, SubscribableType, SubscriptionKind, checkAndUpdateLock, codegen, defineConfig, formatAndWriteMove, formatMove, generateObjects, generateScenes, loadConfig, schemaGen };
|