Skip to content

Commit

Permalink
V2 (#3)
Browse files Browse the repository at this point in the history
* upgrade sui.js to 0.41.0

* update

* update

* update

* update

* update

* add cocos-lib-builder

* update obelisk client

* update

* update obelisk project_name to projectName

* update

* update

---------

Co-authored-by: vladilen11 <[email protected]>
  • Loading branch information
Zombieliu and vladilen11 authored Sep 11, 2023
1 parent 716a4f1 commit 4ecc377
Show file tree
Hide file tree
Showing 42 changed files with 616 additions and 557 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-lock.yaml

# local env files
.env.local
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/obelisk.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types";

export const obeliskConfig = {
project_name: "withinfinity",
projectName: "withinfinity",
systems: [
"fee_system",
"home_system",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xobelisk/cli",
"version": "0.0.5",
"version": "0.1.3",
"description": "Tookit for interacting with move eps framework",
"keywords": [
"sui",
Expand Down Expand Up @@ -39,7 +39,7 @@
"lint": "eslint . --ext .ts"
},
"dependencies": {
"@0xobelisk/common": "0.0.2",
"@0xobelisk/common": "0.1.3",
"@mysten/sui.js": "^0.41.0",
"chalk": "^5.0.1",
"child_process": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/scripts/compgen-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function init() {
var config, output, a;
return __generator(this, function (_a) {
config = {
project_name: "withinfinity",
projectName: "withinfinity",
systems: [
"fee_system",
"home_system",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/scripts/compgen-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type ComponentValueType = string
type ConfigDataType = Record<string, string>

type ObeliskConfig = {
project_name: string,
projectName: string,
systems: string[],
components: Record<string, ComponentMapType | ComponentValueType>
// world 的顶级存储,适合定义world的规则,比如一个admin, 一个fee,并且可以帮你初始化数据
Expand Down Expand Up @@ -43,7 +43,7 @@ type ObeliskConfig = {

async function init() {
let config = {
project_name: "withinfinity",
projectName: "withinfinity",
systems: [
"fee_system",
"home_system",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const commandModule: CommandModule<Options, Options> = {
try {
const obeliskConfig = await loadConfig(configPath) as ObeliskConfig;

await publishHandler(obeliskConfig.project_name, network, savePath);
await publishHandler(obeliskConfig.projectName, network, savePath);
} catch (error: any) {
logError(error);
process.exit(1);
Expand Down
6 changes: 3 additions & 3 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xobelisk/client",
"version": "0.0.7",
"version": "0.1.3",
"description": "Tookit for interacting with move eps framework",
"keywords": [
"sui",
Expand Down Expand Up @@ -58,7 +58,7 @@
},
"dependencies": {
"@mysten/bcs": "^0.7.3",
"@mysten/sui.js": "^0.37.1",
"@mysten/sui.js": "^0.41.0",
"@obelisk/common": "link:../common",
"@scure/bip39": "^1.2.1",
"assert": "^2.0.0",
Expand All @@ -71,7 +71,7 @@
"ts-retry-promise": "^0.7.0"
},
"peerDependencies": {
"@mysten/sui.js": "^0.37.1"
"@mysten/sui.js": "^0.41.0"
},
"devDependencies": {
"@commitlint/cli": "^17.6.6",
Expand Down
35 changes: 0 additions & 35 deletions packages/client/scripts/cli.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/client/scripts/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ async function init() {

const obelisk = new Obelisk({
networkType: network as NetworkType,
packageId: packageId,
metadata: metadata,
// packageId: packageId,
// metadata: metadata,
// secretKey: privkey
});

Expand All @@ -59,7 +59,7 @@ async function init() {
console.log(JSON.stringify(data1))
let content = data1.data!.content as data;
console.log(content.fields.value.fields.value);

await obelisk.requestFaucet("0x1804b821bba181110599b8757008eabe6f89f62774d7fafb5ee666ac742a41f8", "devnet");
// let ownerdObjects = await obelisk.getOwnedEntities("0x1804b821bba181110599b8757008eabe6f89f62774d7fafb5ee666ac742a41f8")
// console.log(ownerdObjects)

Expand Down
4 changes: 3 additions & 1 deletion packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ export {
SUI_CLOCK_OBJECT_ID,
SUI_SYSTEM_STATE_OBJECT_ID,
} from '@mysten/sui.js';
export { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519';
export { fromB64, toB64 } from '@mysten/sui.js';
export * from '@mysten/sui.js/bcs';
export { Obelisk } from './obelisk';
export { SuiAccountManager } from './libs/suiAccountManager';
export { SuiTxBlock } from './libs/suiTxBuilder';
export { SuiRpcProvider } from './libs/suiRpcProvider';
export { SuiContractFactory } from './libs/suiContractFactory';
export { getMetadata } from './metadata';
export type * from './types';
2 changes: 1 addition & 1 deletion packages/client/src/libs/suiAccountManager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Ed25519Keypair } from '@mysten/sui.js';
import { getKeyPair } from './keypair';
import { hexOrBase64ToUint8Array, normalizePrivateKey } from './util';
import { generateMnemonic } from './crypto';
import type { AccountMangerParams, DerivePathParams } from './types';
import type { AccountMangerParams, DerivePathParams } from 'src/types';

export class SuiAccountManager {
private mnemonics: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/libs/suiAccountManager/keypair.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Ed25519Keypair } from '@mysten/sui.js';
import type { DerivePathParams } from './types';
import { Ed25519Keypair, fromB64 } from '@mysten/sui.js';
import type { DerivePathParams } from 'src/types';

/**
* @description Get ed25519 derive path for SUI
Expand Down
10 changes: 0 additions & 10 deletions packages/client/src/libs/suiAccountManager/types.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/client/src/libs/suiContractFactory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export class SuiContractFactory {
}
);
}
async worldCall() {}

// async call(arguments: ({
// kind: "Input";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import {
mainnetConnection,
} from '@mysten/sui.js';
import type { Connection } from '@mysten/sui.js';
import type { NetworkType } from './types';
import type { NetworkType } from 'src/types';
export const defaultGasBudget = 10 ** 8; // 0.1 SUI, should be enough for most of the transactions
export const defaultGasPrice = 1000; // 1000 MIST

/**
* @description Get the default fullnode url and faucet url for the given network type
* @param networkType, 'testnet' | 'mainnet' | 'devnet' | 'localnet', default is 'devnet'
* @returns { fullNode: string, websocket: string, faucet?: string }
*/
export const getDefaultNetworkParams = (
export const getDefaultConnection = (
networkType: NetworkType = 'devnet'
): Connection => {
switch (networkType) {
Expand Down
2 changes: 2 additions & 0 deletions packages/client/src/libs/suiInteractor/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { SuiInteractor } from './suiInteractor';
export { getDefaultConnection } from './defaultConfig';
Loading

0 comments on commit 4ecc377

Please sign in to comment.