@easysui/sdk 0.1.0 → 0.2.0
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.mts +55 -24
- package/dist/index.d.ts +55 -24
- package/dist/index.js +175 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +175 -73
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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;
|
|
@@ -72,19 +77,26 @@ declare class PublishSingleton {
|
|
|
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
|
-
u8 =
|
|
77
|
-
u16 =
|
|
78
|
-
u32 =
|
|
79
|
-
u64 =
|
|
80
|
-
u128 =
|
|
81
|
-
u256 =
|
|
82
|
-
bool =
|
|
83
|
-
string =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
u8 = 1,
|
|
87
|
+
u16 = 2,
|
|
88
|
+
u32 = 3,
|
|
89
|
+
u64 = 4,
|
|
90
|
+
u128 = 5,
|
|
91
|
+
u256 = 6,
|
|
92
|
+
bool = 7,
|
|
93
|
+
string = 8,
|
|
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
|
|
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,
|
|
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<
|
|
107
|
-
static
|
|
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
|
-
|
|
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;
|
|
@@ -72,19 +77,26 @@ declare class PublishSingleton {
|
|
|
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
|
-
u8 =
|
|
77
|
-
u16 =
|
|
78
|
-
u32 =
|
|
79
|
-
u64 =
|
|
80
|
-
u128 =
|
|
81
|
-
u256 =
|
|
82
|
-
bool =
|
|
83
|
-
string =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
u8 = 1,
|
|
87
|
+
u16 = 2,
|
|
88
|
+
u32 = 3,
|
|
89
|
+
u64 = 4,
|
|
90
|
+
u128 = 5,
|
|
91
|
+
u256 = 6,
|
|
92
|
+
bool = 7,
|
|
93
|
+
string = 8,
|
|
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
|
|
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,
|
|
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<
|
|
107
|
-
static
|
|
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
|
-
|
|
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 };
|