Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
vladilen11 committed Sep 24, 2023
1 parent 84d95b7 commit 07a7040
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 73 deletions.
2 changes: 1 addition & 1 deletion packages/cli/obelisk.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types";
import { ObeliskConfig } from "@0xobelisk/common";

export const obeliskConfig = {
name: "examples",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xobelisk/cli",
"version": "0.1.3",
"version": "0.2.3",
"description": "Tookit for interacting with move eps framework",
"keywords": [
"sui",
Expand Down
103 changes: 51 additions & 52 deletions packages/cli/scripts/compgen-test.ts
Original file line number Diff line number Diff line change
@@ -1,67 +1,62 @@
import { formatAndWriteMove } from "@0xobelisk/common/codegen";
import { formatAndWriteMove } from "@0xobelisk/common";

type ComponentMapType = Record<string, string>
type ComponentValueType = string
type ComponentMapType = Record<string, string>;
type ComponentValueType = string;

type ConfigDataType = Record<string, string>
type ConfigDataType = Record<string, string>;

type ObeliskConfig = {
name: string,
systems: string[],
components: Record<string, ComponentMapType | ComponentValueType>
// world 的顶级存储,适合定义world的规则,比如一个admin, 一个fee,并且可以帮你初始化数据
// genesis_config: {
// admin: {
// type: "address",
// value: "0x1"
// },
// world_info: {
// type: {
// name: "String",
// description: "String",
// birth_time: "u64",
// },
// value: {
// name: "Crypto Pet",
// description: "Crypto Pet",
// birth_time: "auto",
// }
// },
// fee: {
// type: "Table<vector<u8>,u64>",
// value: [
// {
// clean: "1000000"
// },
// {
// paly: "1000000"
// },
// ]
// },
// }
}
name: string;
systems: string[];
components: Record<string, ComponentMapType | ComponentValueType>;
// world 的顶级存储,适合定义world的规则,比如一个admin, 一个fee,并且可以帮你初始化数据
// genesis_config: {
// admin: {
// type: "address",
// value: "0x1"
// },
// world_info: {
// type: {
// name: "String",
// description: "String",
// birth_time: "u64",
// },
// value: {
// name: "Crypto Pet",
// description: "Crypto Pet",
// birth_time: "auto",
// }
// },
// fee: {
// type: "Table<vector<u8>,u64>",
// value: [
// {
// clean: "1000000"
// },
// {
// paly: "1000000"
// },
// ]
// },
// }
};

async function init() {
let config = {
name: "withinfinity",
systems: [
"fee_system",
"home_system",
"pet_system",
"state_system",
],
systems: ["fee_system", "home_system", "pet_system", "state_system"],
components: {
// Key - Struct value
level: {
hunger: "u64",
cleanliness: "u64",
mood: "u64",
level: "u64",
hunger: "u64",
cleanliness: "u64",
mood: "u64",
level: "u64",
},
// Key - Struct value
state: {
state: "vector<u8>" ,
last_update_time: "u64" ,
state: "vector<u8>",
last_update_time: "u64",
},
// Key - Single value
suifren: "bool",
Expand Down Expand Up @@ -110,8 +105,12 @@ async function init() {
public fun components_length(entity: &mut Entity) : u64 {
bag::length(get_mut_comps(entity))
}
}`
let a = formatAndWriteMove(output, "/Users/feng/Desktop/obelisk/obelisk-engine/packages/cli", "formatAndWriteMove");
}`;
let a = formatAndWriteMove(
output,
"/Users/feng/Desktop/obelisk/obelisk-engine/packages/cli",
"formatAndWriteMove"
);
// console.log(output)
}

Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/commands/compgen.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { CommandModule } from "yargs";
import { worldgen, loadConfig } from "@0xobelisk/common/codegen";
import { ObeliskConfig } from "@0xobelisk/common/src/codegen";
import { worldgen, loadConfig, ObeliskConfig } from "@0xobelisk/common";

type Options = {
configPath?: string;
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/commands/publish.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { CommandModule } from "yargs";
import { logError } from "../utils/errors";
import { publishHandler } from "../utils";
import { loadConfig } from "@0xobelisk/common/src/codegen";
import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types";
import { loadConfig, ObeliskConfig } from "@0xobelisk/common";

type Options = {
configPath: string;
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/commands/upgrade.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { CommandModule } from "yargs";
import { logError } from "../utils/errors";
import { upgradeHandler } from "../utils";
import { loadConfig } from "@0xobelisk/common/src/codegen";
import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types";
import { loadConfig, ObeliskConfig } from "@0xobelisk/common";

type Options = {
configPath: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/publishHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
generateIdConfig,
saveContractData,
generateEps,
} from "@0xobelisk/common/src/codegen";
} from "@0xobelisk/common";
import fs from "fs";

export async function publishHandler(
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/upgradeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
generateIdConfig,
generateEps,
saveContractData,
} from "@0xobelisk/common/src/codegen";
} from "@0xobelisk/common";

type ObjectContent = {
type: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xobelisk/client",
"version": "0.2.0",
"version": "0.2.3",
"description": "Tookit for interacting with move eps framework",
"keywords": [
"sui",
Expand Down
12 changes: 2 additions & 10 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xobelisk/common",
"version": "0.2.1",
"version": "0.2.3",
"description": "Common low level logic shared between packages",
"keywords": [
"sui",
Expand All @@ -23,20 +23,12 @@
"node": ">=18"
},
"exports": {
".": "./dist/index.js",
"./codegen": "./dist/codegen.js",
"./utils": "./dist/utils.js"
".": "./dist/index.js"
},
"typesVersions": {
"*": {
"index": [
"./src/index.ts"
],
"codegen": [
"./src/codegen/index.ts"
],
"utils": [
"./src/utils/index.ts"
]
}
},
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./codegen";

0 comments on commit 07a7040

Please sign in to comment.