@easysui/sdk 0.1.1 → 0.2.1

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/README.md CHANGED
@@ -94,10 +94,9 @@ This package uses [Changesets](https://github.com/changesets/changesets) for ver
94
94
 
95
95
  ```bash
96
96
  # Add a changeset
97
- pnpm changeset
97
+ pnpm changeset && pnpm bump
98
98
 
99
- # Version packages
100
- pnpm version
99
+ // commit the bump and git push
101
100
 
102
101
  # Build and publish to npm
103
102
  pnpm release
package/dist/index.d.mts CHANGED
@@ -2,11 +2,18 @@ import { Keypair } from '@mysten/sui/cryptography';
2
2
  import { Transaction } from '@mysten/sui/transactions';
3
3
  import * as _mysten_sui_client from '@mysten/sui/client';
4
4
  import { SuiTransactionBlockResponse, SuiObjectChangePublished, SuiObjectChangeCreated, SuiClient as SuiClient$1 } from '@mysten/sui/client';
5
+ import { SuiTransactionBlockResponse as SuiTransactionBlockResponse$1 } from '@mysten/sui/jsonRpc';
5
6
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
6
7
 
7
- declare const DENY_LIST_ID = "0x403";
8
- declare const CLOCK_ID = "0x6";
9
8
  type Network = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
9
+ interface StaticConfig {
10
+ CHAIN_ID: string;
11
+ USDC_PACKAGE_ID?: string;
12
+ }
13
+ declare const STATIC_CONFIGS: Record<Network, StaticConfig>;
14
+
15
+ declare const DENY_LIST_ID = "0x403";
16
+ declare const CLOCK_ID: string;
10
17
  interface BaseConfigVars {
11
18
  NETWORK: Network;
12
19
  RPC: string;
@@ -17,7 +24,7 @@ interface BaseConfigVars {
17
24
  USDC_TREASURY_CAP?: string;
18
25
  }
19
26
  type ConfigVars = BaseConfigVars;
20
- declare const ADMIN_KEYPAIR: Keypair;
27
+ declare const ADMIN_KEYPAIR: Keypair | undefined;
21
28
  type ExtraVarsMap = Record<string, string>;
22
29
  declare class Config<TConfigVars extends BaseConfigVars = ConfigVars> {
23
30
  private static instance;
@@ -28,8 +35,6 @@ declare class Config<TConfigVars extends BaseConfigVars = ConfigVars> {
28
35
  static write<T extends BaseConfigVars>(config: T): string;
29
36
  }
30
37
 
31
- declare const STATIC_CONFIGS: any;
32
-
33
38
  declare class Coin {
34
39
  static get coinType(): string;
35
40
  static getBalance(owner: string): Promise<bigint>;
@@ -48,7 +53,7 @@ declare class USDC extends Coin {
48
53
 
49
54
  declare function analyze_cost(ptb: Transaction, resp: SuiTransactionBlockResponse): void;
50
55
 
51
- declare function deploy<TConfig extends typeof Config = typeof Config, TConfigVars extends BaseConfigVars = BaseConfigVars>(ConfigClass?: TConfig): Promise<string>;
56
+ declare function deploy<TConfig extends typeof Config = typeof Config, TConfigVars extends BaseConfigVars = BaseConfigVars>(ConfigClass?: TConfig, packagePath?: string): Promise<string>;
52
57
  declare function getDeployBytes(): Promise<string>;
53
58
 
54
59
  declare function getKeypair(privkey: string): Keypair;
@@ -65,13 +70,18 @@ declare class PublishSingleton {
65
70
  static findObjectIdByType(type: string, fail?: boolean): string;
66
71
  static get upgradeCapId(): string;
67
72
  static get usdcTreasuryCap(): string;
68
- static getPublishTx(packagePath: string, sender: string): Transaction;
73
+ private static getPublishCmd;
69
74
  static getPublishBytes(signer?: string, packagePath?: string): Promise<string>;
70
75
  static publishPackage(signer: Keypair, packagePath: string): Promise<SuiTransactionBlockResponse>;
71
76
  static findPublishedPackage(resp: SuiTransactionBlockResponse): SuiObjectChangePublished | undefined;
72
77
  static findObjectChangeCreatedByType(resp: SuiTransactionBlockResponse, type: string): SuiObjectChangeCreated | undefined;
73
78
  }
74
79
 
80
+ declare enum FORMAT_TYPES {
81
+ hex = 1,
82
+ base64 = 2
83
+ }
84
+
75
85
  declare enum MoveType {
76
86
  u8 = 1,
77
87
  u16 = 2,
@@ -81,10 +91,12 @@ declare enum MoveType {
81
91
  u256 = 6,
82
92
  bool = 7,
83
93
  string = 8,
84
- object = 9,
85
- address = 10,
86
- address_opt = 11,
87
- vec_address = 12
94
+ string_opt = 9,
95
+ object = 10,
96
+ address = 11,
97
+ address_opt = 12,
98
+ vec_address = 13,
99
+ vec_u64 = 14
88
100
  }
89
101
  declare class SuiClient {
90
102
  private static instance;
@@ -92,24 +104,41 @@ declare class SuiClient {
92
104
  private constructor();
93
105
  private static getInstance;
94
106
  static get client(): SuiClient$1;
95
- static signAndExecute(ptb: Transaction, signer: Keypair, errorHandler?: (e: any) => string): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
107
+ private static waitForTransaction;
108
+ static signAndExecute(ptb: Transaction, signer: Keypair): Promise<SuiTransactionBlockResponse$1>;
96
109
  static toMoveArg(ptb: Transaction, value: any, type?: MoveType): any;
97
- static moveCall({ signer, target, typeArgs, args, argTypes, errorHandler, ptb, withTransfer, }: {
110
+ static moveCall({ signer, target, typeArgs, args, argTypes, ptb, withTransfer, }: {
98
111
  signer: Keypair;
99
112
  target: string;
100
113
  typeArgs?: string[];
101
114
  args?: any[];
102
115
  argTypes?: MoveType[];
103
- errorHandler?: (e: any) => string;
104
116
  ptb?: Transaction;
105
117
  withTransfer?: boolean;
106
- }): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
107
- static public_transfer(objects: string[], from: Keypair, to: string): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
118
+ }): Promise<SuiTransactionBlockResponse$1>;
119
+ static getMoveCallBytes({ signer, target, typeArgs, args, argTypes, ptb, withTransfer, gasOwner, format }: {
120
+ signer: string;
121
+ target: string;
122
+ typeArgs?: string[];
123
+ args?: any[];
124
+ argTypes?: MoveType[];
125
+ ptb?: Transaction;
126
+ withTransfer?: boolean;
127
+ gasOwner?: string;
128
+ format?: FORMAT_TYPES;
129
+ }): Promise<string>;
130
+ static getMoveCallBytesFromPTB(ptb: Transaction, signer: string, gasOwner?: string, format?: FORMAT_TYPES): Promise<string>;
131
+ static toBytes(bytes: Uint8Array | string): Uint8Array<ArrayBufferLike>;
132
+ static getSignature(signatureOrKeypair: string | Keypair, bytes: Uint8Array): Promise<string>;
133
+ static executeMoveCallBytes(bytes: Uint8Array | string, senderSignature: string | Keypair, gasOwnerSignature?: string | Keypair): Promise<SuiTransactionBlockResponse$1>;
134
+ static getPTB(target: string, typeArgs?: string[], args?: any[], argTypes?: MoveType[], signer?: string, withTransfer?: boolean, ptb?: Transaction): Transaction;
135
+ static public_transfer(objects: string[], from: Keypair, to: string): Promise<SuiTransactionBlockResponse$1>;
108
136
  static devInspect(ptb: Transaction, sender: string): Promise<_mysten_sui_client.DevInspectResults>;
109
137
  static devInspectRaw(ptb: Transaction, sender: string): Promise<number[] | undefined>;
110
138
  static devInspectBool(ptb: Transaction, sender: string): Promise<boolean | undefined>;
111
139
  static devInspectU64(ptb: Transaction, sender: string): Promise<bigint>;
112
140
  static devInspectAddress(ptb: Transaction, sender: string): Promise<string | undefined>;
141
+ static devInspectString(ptb: Transaction, sender: string): Promise<string>;
113
142
  static getObject(id: string): Promise<_mysten_sui_client.SuiObjectResponse>;
114
143
  static getObjectsByType(owner: string, type: string): Promise<(string | undefined)[]>;
115
144
  }
@@ -119,4 +148,6 @@ declare function createFundedWallet(usdcAmount?: bigint): Promise<Ed25519Keypair
119
148
  declare function sleep(ms: number): Promise<void>;
120
149
  declare function waitForNextEpoch(timeoutMs?: number, pollIntervalMs?: number): Promise<string>;
121
150
 
122
- export { ADMIN_KEYPAIR, type BaseConfigVars, CLOCK_ID, Coin, Config, type ConfigVars, DENY_LIST_ID, type ExtraVarsMap, MoveType, type Network, PublishSingleton, STATIC_CONFIGS, SuiClient, USDC, analyze_cost, createFundedWallet, createWallet, deploy, getDeployBytes, getKeypair, sleep, waitForNextEpoch };
151
+ declare function deriveObjectId(parentId: string, module: string, key: string, packageId: string, type?: string, serializedBcs?: any): string;
152
+
153
+ export { ADMIN_KEYPAIR, type BaseConfigVars, CLOCK_ID, Coin, Config, type ConfigVars, DENY_LIST_ID, type ExtraVarsMap, MoveType, type Network, PublishSingleton, STATIC_CONFIGS, SuiClient, USDC, analyze_cost, createFundedWallet, createWallet, deploy, deriveObjectId, getDeployBytes, getKeypair, sleep, waitForNextEpoch };
package/dist/index.d.ts CHANGED
@@ -2,11 +2,18 @@ import { Keypair } from '@mysten/sui/cryptography';
2
2
  import { Transaction } from '@mysten/sui/transactions';
3
3
  import * as _mysten_sui_client from '@mysten/sui/client';
4
4
  import { SuiTransactionBlockResponse, SuiObjectChangePublished, SuiObjectChangeCreated, SuiClient as SuiClient$1 } from '@mysten/sui/client';
5
+ import { SuiTransactionBlockResponse as SuiTransactionBlockResponse$1 } from '@mysten/sui/jsonRpc';
5
6
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
6
7
 
7
- declare const DENY_LIST_ID = "0x403";
8
- declare const CLOCK_ID = "0x6";
9
8
  type Network = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
9
+ interface StaticConfig {
10
+ CHAIN_ID: string;
11
+ USDC_PACKAGE_ID?: string;
12
+ }
13
+ declare const STATIC_CONFIGS: Record<Network, StaticConfig>;
14
+
15
+ declare const DENY_LIST_ID = "0x403";
16
+ declare const CLOCK_ID: string;
10
17
  interface BaseConfigVars {
11
18
  NETWORK: Network;
12
19
  RPC: string;
@@ -17,7 +24,7 @@ interface BaseConfigVars {
17
24
  USDC_TREASURY_CAP?: string;
18
25
  }
19
26
  type ConfigVars = BaseConfigVars;
20
- declare const ADMIN_KEYPAIR: Keypair;
27
+ declare const ADMIN_KEYPAIR: Keypair | undefined;
21
28
  type ExtraVarsMap = Record<string, string>;
22
29
  declare class Config<TConfigVars extends BaseConfigVars = ConfigVars> {
23
30
  private static instance;
@@ -28,8 +35,6 @@ declare class Config<TConfigVars extends BaseConfigVars = ConfigVars> {
28
35
  static write<T extends BaseConfigVars>(config: T): string;
29
36
  }
30
37
 
31
- declare const STATIC_CONFIGS: any;
32
-
33
38
  declare class Coin {
34
39
  static get coinType(): string;
35
40
  static getBalance(owner: string): Promise<bigint>;
@@ -48,7 +53,7 @@ declare class USDC extends Coin {
48
53
 
49
54
  declare function analyze_cost(ptb: Transaction, resp: SuiTransactionBlockResponse): void;
50
55
 
51
- declare function deploy<TConfig extends typeof Config = typeof Config, TConfigVars extends BaseConfigVars = BaseConfigVars>(ConfigClass?: TConfig): Promise<string>;
56
+ declare function deploy<TConfig extends typeof Config = typeof Config, TConfigVars extends BaseConfigVars = BaseConfigVars>(ConfigClass?: TConfig, packagePath?: string): Promise<string>;
52
57
  declare function getDeployBytes(): Promise<string>;
53
58
 
54
59
  declare function getKeypair(privkey: string): Keypair;
@@ -65,13 +70,18 @@ declare class PublishSingleton {
65
70
  static findObjectIdByType(type: string, fail?: boolean): string;
66
71
  static get upgradeCapId(): string;
67
72
  static get usdcTreasuryCap(): string;
68
- static getPublishTx(packagePath: string, sender: string): Transaction;
73
+ private static getPublishCmd;
69
74
  static getPublishBytes(signer?: string, packagePath?: string): Promise<string>;
70
75
  static publishPackage(signer: Keypair, packagePath: string): Promise<SuiTransactionBlockResponse>;
71
76
  static findPublishedPackage(resp: SuiTransactionBlockResponse): SuiObjectChangePublished | undefined;
72
77
  static findObjectChangeCreatedByType(resp: SuiTransactionBlockResponse, type: string): SuiObjectChangeCreated | undefined;
73
78
  }
74
79
 
80
+ declare enum FORMAT_TYPES {
81
+ hex = 1,
82
+ base64 = 2
83
+ }
84
+
75
85
  declare enum MoveType {
76
86
  u8 = 1,
77
87
  u16 = 2,
@@ -81,10 +91,12 @@ declare enum MoveType {
81
91
  u256 = 6,
82
92
  bool = 7,
83
93
  string = 8,
84
- object = 9,
85
- address = 10,
86
- address_opt = 11,
87
- vec_address = 12
94
+ string_opt = 9,
95
+ object = 10,
96
+ address = 11,
97
+ address_opt = 12,
98
+ vec_address = 13,
99
+ vec_u64 = 14
88
100
  }
89
101
  declare class SuiClient {
90
102
  private static instance;
@@ -92,24 +104,41 @@ declare class SuiClient {
92
104
  private constructor();
93
105
  private static getInstance;
94
106
  static get client(): SuiClient$1;
95
- static signAndExecute(ptb: Transaction, signer: Keypair, errorHandler?: (e: any) => string): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
107
+ private static waitForTransaction;
108
+ static signAndExecute(ptb: Transaction, signer: Keypair): Promise<SuiTransactionBlockResponse$1>;
96
109
  static toMoveArg(ptb: Transaction, value: any, type?: MoveType): any;
97
- static moveCall({ signer, target, typeArgs, args, argTypes, errorHandler, ptb, withTransfer, }: {
110
+ static moveCall({ signer, target, typeArgs, args, argTypes, ptb, withTransfer, }: {
98
111
  signer: Keypair;
99
112
  target: string;
100
113
  typeArgs?: string[];
101
114
  args?: any[];
102
115
  argTypes?: MoveType[];
103
- errorHandler?: (e: any) => string;
104
116
  ptb?: Transaction;
105
117
  withTransfer?: boolean;
106
- }): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
107
- static public_transfer(objects: string[], from: Keypair, to: string): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
118
+ }): Promise<SuiTransactionBlockResponse$1>;
119
+ static getMoveCallBytes({ signer, target, typeArgs, args, argTypes, ptb, withTransfer, gasOwner, format }: {
120
+ signer: string;
121
+ target: string;
122
+ typeArgs?: string[];
123
+ args?: any[];
124
+ argTypes?: MoveType[];
125
+ ptb?: Transaction;
126
+ withTransfer?: boolean;
127
+ gasOwner?: string;
128
+ format?: FORMAT_TYPES;
129
+ }): Promise<string>;
130
+ static getMoveCallBytesFromPTB(ptb: Transaction, signer: string, gasOwner?: string, format?: FORMAT_TYPES): Promise<string>;
131
+ static toBytes(bytes: Uint8Array | string): Uint8Array<ArrayBufferLike>;
132
+ static getSignature(signatureOrKeypair: string | Keypair, bytes: Uint8Array): Promise<string>;
133
+ static executeMoveCallBytes(bytes: Uint8Array | string, senderSignature: string | Keypair, gasOwnerSignature?: string | Keypair): Promise<SuiTransactionBlockResponse$1>;
134
+ static getPTB(target: string, typeArgs?: string[], args?: any[], argTypes?: MoveType[], signer?: string, withTransfer?: boolean, ptb?: Transaction): Transaction;
135
+ static public_transfer(objects: string[], from: Keypair, to: string): Promise<SuiTransactionBlockResponse$1>;
108
136
  static devInspect(ptb: Transaction, sender: string): Promise<_mysten_sui_client.DevInspectResults>;
109
137
  static devInspectRaw(ptb: Transaction, sender: string): Promise<number[] | undefined>;
110
138
  static devInspectBool(ptb: Transaction, sender: string): Promise<boolean | undefined>;
111
139
  static devInspectU64(ptb: Transaction, sender: string): Promise<bigint>;
112
140
  static devInspectAddress(ptb: Transaction, sender: string): Promise<string | undefined>;
141
+ static devInspectString(ptb: Transaction, sender: string): Promise<string>;
113
142
  static getObject(id: string): Promise<_mysten_sui_client.SuiObjectResponse>;
114
143
  static getObjectsByType(owner: string, type: string): Promise<(string | undefined)[]>;
115
144
  }
@@ -119,4 +148,6 @@ declare function createFundedWallet(usdcAmount?: bigint): Promise<Ed25519Keypair
119
148
  declare function sleep(ms: number): Promise<void>;
120
149
  declare function waitForNextEpoch(timeoutMs?: number, pollIntervalMs?: number): Promise<string>;
121
150
 
122
- export { ADMIN_KEYPAIR, type BaseConfigVars, CLOCK_ID, Coin, Config, type ConfigVars, DENY_LIST_ID, type ExtraVarsMap, MoveType, type Network, PublishSingleton, STATIC_CONFIGS, SuiClient, USDC, analyze_cost, createFundedWallet, createWallet, deploy, getDeployBytes, getKeypair, sleep, waitForNextEpoch };
151
+ declare function deriveObjectId(parentId: string, module: string, key: string, packageId: string, type?: string, serializedBcs?: any): string;
152
+
153
+ export { ADMIN_KEYPAIR, type BaseConfigVars, CLOCK_ID, Coin, Config, type ConfigVars, DENY_LIST_ID, type ExtraVarsMap, MoveType, type Network, PublishSingleton, STATIC_CONFIGS, SuiClient, USDC, analyze_cost, createFundedWallet, createWallet, deploy, deriveObjectId, getDeployBytes, getKeypair, sleep, waitForNextEpoch };