@easysui/sdk 1.0.1 → 1.1.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 +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +24 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,7 @@ interface BaseConfigVars {
|
|
|
19
19
|
PACKAGE_PATH: string;
|
|
20
20
|
PACKAGE_ID: string;
|
|
21
21
|
UPGRADE_CAP_ID: string;
|
|
22
|
+
PUBFILE_PATH?: string;
|
|
22
23
|
USDC_PACKAGE_ID?: string;
|
|
23
24
|
USDC_TREASURY_CAP?: string;
|
|
24
25
|
}
|
|
@@ -52,7 +53,7 @@ declare class USDC extends Coin {
|
|
|
52
53
|
|
|
53
54
|
declare function analyze_cost(ptb: Transaction, resp: SuiTransactionBlockResponse): void;
|
|
54
55
|
|
|
55
|
-
declare function deploy<TConfig extends typeof Config = typeof Config, TConfigVars extends BaseConfigVars = BaseConfigVars>(ConfigClass?: TConfig, packagePath?: string): Promise<string>;
|
|
56
|
+
declare function deploy<TConfig extends typeof Config = typeof Config, TConfigVars extends BaseConfigVars = BaseConfigVars>(ConfigClass?: TConfig, packagePath?: string, pubFilePath?: string): Promise<string>;
|
|
56
57
|
declare function getDeployBytes(): Promise<string>;
|
|
57
58
|
|
|
58
59
|
declare function getKeypair(privkey: string): Keypair;
|
|
@@ -224,7 +225,8 @@ declare class PublishSingleton {
|
|
|
224
225
|
private static instance;
|
|
225
226
|
private constructor();
|
|
226
227
|
private static getPackagePath;
|
|
227
|
-
static
|
|
228
|
+
private static getPubFilePath;
|
|
229
|
+
static publish(signer?: Keypair, packagePath?: string, pubFilePath?: string): Promise<void>;
|
|
228
230
|
private static getInstance;
|
|
229
231
|
static publishResponse(): SuiPublishResponse;
|
|
230
232
|
static get packageId(): string;
|
|
@@ -232,8 +234,8 @@ declare class PublishSingleton {
|
|
|
232
234
|
static get upgradeCapId(): string;
|
|
233
235
|
static get usdcTreasuryCap(): string;
|
|
234
236
|
private static getPublishCmd;
|
|
235
|
-
static getPublishBytes(signer?: string, packagePath?: string): Promise<string>;
|
|
236
|
-
static publishPackage(signer: Keypair, packagePath: string): Promise<SuiPublishResponse>;
|
|
237
|
+
static getPublishBytes(signer?: string, packagePath?: string, pubFilePath?: string): Promise<string>;
|
|
238
|
+
static publishPackage(signer: Keypair, packagePath: string, pubFilePath: string): Promise<SuiPublishResponse>;
|
|
237
239
|
static findPublishedPackage(resp: SuiPublishResponse): ChangedObjectFlat | undefined;
|
|
238
240
|
static findObjectChangeCreatedByType(resp: SuiPublishResponse, type: string): ChangedObjectFlat | undefined;
|
|
239
241
|
static get pubFile(): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ interface BaseConfigVars {
|
|
|
19
19
|
PACKAGE_PATH: string;
|
|
20
20
|
PACKAGE_ID: string;
|
|
21
21
|
UPGRADE_CAP_ID: string;
|
|
22
|
+
PUBFILE_PATH?: string;
|
|
22
23
|
USDC_PACKAGE_ID?: string;
|
|
23
24
|
USDC_TREASURY_CAP?: string;
|
|
24
25
|
}
|
|
@@ -52,7 +53,7 @@ declare class USDC extends Coin {
|
|
|
52
53
|
|
|
53
54
|
declare function analyze_cost(ptb: Transaction, resp: SuiTransactionBlockResponse): void;
|
|
54
55
|
|
|
55
|
-
declare function deploy<TConfig extends typeof Config = typeof Config, TConfigVars extends BaseConfigVars = BaseConfigVars>(ConfigClass?: TConfig, packagePath?: string): Promise<string>;
|
|
56
|
+
declare function deploy<TConfig extends typeof Config = typeof Config, TConfigVars extends BaseConfigVars = BaseConfigVars>(ConfigClass?: TConfig, packagePath?: string, pubFilePath?: string): Promise<string>;
|
|
56
57
|
declare function getDeployBytes(): Promise<string>;
|
|
57
58
|
|
|
58
59
|
declare function getKeypair(privkey: string): Keypair;
|
|
@@ -224,7 +225,8 @@ declare class PublishSingleton {
|
|
|
224
225
|
private static instance;
|
|
225
226
|
private constructor();
|
|
226
227
|
private static getPackagePath;
|
|
227
|
-
static
|
|
228
|
+
private static getPubFilePath;
|
|
229
|
+
static publish(signer?: Keypair, packagePath?: string, pubFilePath?: string): Promise<void>;
|
|
228
230
|
private static getInstance;
|
|
229
231
|
static publishResponse(): SuiPublishResponse;
|
|
230
232
|
static get packageId(): string;
|
|
@@ -232,8 +234,8 @@ declare class PublishSingleton {
|
|
|
232
234
|
static get upgradeCapId(): string;
|
|
233
235
|
static get usdcTreasuryCap(): string;
|
|
234
236
|
private static getPublishCmd;
|
|
235
|
-
static getPublishBytes(signer?: string, packagePath?: string): Promise<string>;
|
|
236
|
-
static publishPackage(signer: Keypair, packagePath: string): Promise<SuiPublishResponse>;
|
|
237
|
+
static getPublishBytes(signer?: string, packagePath?: string, pubFilePath?: string): Promise<string>;
|
|
238
|
+
static publishPackage(signer: Keypair, packagePath: string, pubFilePath: string): Promise<SuiPublishResponse>;
|
|
237
239
|
static findPublishedPackage(resp: SuiPublishResponse): ChangedObjectFlat | undefined;
|
|
238
240
|
static findObjectChangeCreatedByType(resp: SuiPublishResponse, type: string): ChangedObjectFlat | undefined;
|
|
239
241
|
static get pubFile(): string;
|
package/dist/index.js
CHANGED
|
@@ -1565,6 +1565,7 @@ var Config = class _Config {
|
|
|
1565
1565
|
NETWORK,
|
|
1566
1566
|
RPC: jsonRpc.getJsonRpcFullnodeUrl(NETWORK),
|
|
1567
1567
|
PACKAGE_PATH: process.env.PACKAGE_PATH || "",
|
|
1568
|
+
PUBFILE_PATH: process.env.PUBFILE_PATH || "",
|
|
1568
1569
|
PACKAGE_ID: process.env.PACKAGE_ID || "",
|
|
1569
1570
|
UPGRADE_CAP_ID: process.env.UPGRADE_CAP_ID || "",
|
|
1570
1571
|
USDC_TREASURY_CAP: process.env.USDC_TREASURY_CAP,
|
|
@@ -16405,11 +16406,21 @@ var PublishSingleton = class _PublishSingleton {
|
|
|
16405
16406
|
}
|
|
16406
16407
|
return packagePath;
|
|
16407
16408
|
}
|
|
16408
|
-
static
|
|
16409
|
+
static getPubFilePath(pubFilePath) {
|
|
16410
|
+
pubFilePath ??= Config.vars.PUBFILE_PATH;
|
|
16411
|
+
if (!pubFilePath) {
|
|
16412
|
+
throw new Error(
|
|
16413
|
+
`You must set the \`PUBFILE_PATH\` environment variable to your Pub.${Config.vars.NETWORK}.toml path.`
|
|
16414
|
+
);
|
|
16415
|
+
}
|
|
16416
|
+
return pubFilePath;
|
|
16417
|
+
}
|
|
16418
|
+
static async publish(signer, packagePath, pubFilePath) {
|
|
16409
16419
|
signer ??= ADMIN_KEYPAIR;
|
|
16410
16420
|
const _packagePath = this.getPackagePath(packagePath);
|
|
16421
|
+
const _pubFilePath = this.getPubFilePath(pubFilePath);
|
|
16411
16422
|
if (!_PublishSingleton.instance) {
|
|
16412
|
-
const publishResp = await _PublishSingleton.publishPackage(signer, _packagePath);
|
|
16423
|
+
const publishResp = await _PublishSingleton.publishPackage(signer, _packagePath, _pubFilePath);
|
|
16413
16424
|
_PublishSingleton.instance = new _PublishSingleton(publishResp);
|
|
16414
16425
|
}
|
|
16415
16426
|
}
|
|
@@ -16445,7 +16456,7 @@ var PublishSingleton = class _PublishSingleton {
|
|
|
16445
16456
|
false
|
|
16446
16457
|
);
|
|
16447
16458
|
}
|
|
16448
|
-
static getPublishCmd(packagePath, sender, inBytes = false) {
|
|
16459
|
+
static getPublishCmd(packagePath, sender, pubFilePath, inBytes = false) {
|
|
16449
16460
|
const network = Config.vars.NETWORK;
|
|
16450
16461
|
if (!fs3__namespace.default.existsSync(packagePath)) {
|
|
16451
16462
|
throw new Error(`Package doesn't exist under: ${packagePath}`);
|
|
@@ -16460,17 +16471,21 @@ var PublishSingleton = class _PublishSingleton {
|
|
|
16460
16471
|
if (isEphemeralChain) {
|
|
16461
16472
|
buildCommand += " --publish-unpublished-deps";
|
|
16462
16473
|
}
|
|
16474
|
+
if (pubFilePath) {
|
|
16475
|
+
buildCommand += ` --pubfile-path ${pubFilePath}`;
|
|
16476
|
+
}
|
|
16463
16477
|
buildCommand += inBytes ? ` --serialize-unsigned-transaction --sender ${sender}` : " --json";
|
|
16464
16478
|
return buildCommand;
|
|
16465
16479
|
}
|
|
16466
|
-
static async getPublishBytes(signer, packagePath) {
|
|
16480
|
+
static async getPublishBytes(signer, packagePath, pubFilePath) {
|
|
16467
16481
|
signer ??= ADMIN_KEYPAIR.toSuiAddress();
|
|
16468
16482
|
const _packagePath = this.getPackagePath(packagePath);
|
|
16469
|
-
const
|
|
16483
|
+
const _pubFilePath = this.getPubFilePath(pubFilePath);
|
|
16484
|
+
const cmd = this.getPublishCmd(_packagePath, signer, _pubFilePath, true);
|
|
16470
16485
|
return execCmd(cmd);
|
|
16471
16486
|
}
|
|
16472
|
-
static async publishPackage(signer, packagePath) {
|
|
16473
|
-
const cmd = this.getPublishCmd(packagePath, signer.toSuiAddress());
|
|
16487
|
+
static async publishPackage(signer, packagePath, pubFilePath) {
|
|
16488
|
+
const cmd = this.getPublishCmd(packagePath, signer.toSuiAddress(), pubFilePath);
|
|
16474
16489
|
const res = await execCmd(cmd);
|
|
16475
16490
|
const match = res.match(/\{[\s\S]*\}/);
|
|
16476
16491
|
if (!match) {
|
|
@@ -16498,9 +16513,9 @@ var PublishSingleton = class _PublishSingleton {
|
|
|
16498
16513
|
};
|
|
16499
16514
|
|
|
16500
16515
|
// src/utils/deploy.ts
|
|
16501
|
-
async function deploy(ConfigClass = Config, packagePath) {
|
|
16516
|
+
async function deploy(ConfigClass = Config, packagePath, pubFilePath) {
|
|
16502
16517
|
const vars = ConfigClass.vars;
|
|
16503
|
-
await PublishSingleton.publish(ADMIN_KEYPAIR, packagePath);
|
|
16518
|
+
await PublishSingleton.publish(ADMIN_KEYPAIR, packagePath, pubFilePath);
|
|
16504
16519
|
const newConfig = {
|
|
16505
16520
|
...vars,
|
|
16506
16521
|
PACKAGE_ID: PublishSingleton.packageId,
|