@easysui/sdk 1.0.0 → 1.0.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/dist/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { Secp256r1Keypair } from '@mysten/sui/keypairs/secp256r1';
|
|
|
10
10
|
import { SUI_CLOCK_OBJECT_ID, fromHex, fromBase64, toBase64, normalizeStructTag, deriveObjectID, toHex } from '@mysten/sui/utils';
|
|
11
11
|
import { Transaction, coinWithBalance } from '@mysten/sui/transactions';
|
|
12
12
|
import { bcs } from '@mysten/sui/bcs';
|
|
13
|
-
import {
|
|
13
|
+
import { spawn } from 'child_process';
|
|
14
14
|
import { requestSuiFromFaucetV2, getFaucetHost } from '@mysten/sui/faucet';
|
|
15
15
|
|
|
16
16
|
var __create = Object.create;
|
|
@@ -16341,6 +16341,31 @@ var USDC = class extends Coin {
|
|
|
16341
16341
|
});
|
|
16342
16342
|
}
|
|
16343
16343
|
};
|
|
16344
|
+
function execCmd(cmd) {
|
|
16345
|
+
return new Promise((resolve3, reject) => {
|
|
16346
|
+
const child = spawn(cmd, { shell: true });
|
|
16347
|
+
let stdout = "";
|
|
16348
|
+
let stderr = "";
|
|
16349
|
+
child.stdout.on("data", (data) => {
|
|
16350
|
+
stdout += data.toString();
|
|
16351
|
+
});
|
|
16352
|
+
child.stderr.on("data", (data) => {
|
|
16353
|
+
stderr += data.toString();
|
|
16354
|
+
});
|
|
16355
|
+
child.on("error", (err) => reject(err));
|
|
16356
|
+
child.on("close", (code) => {
|
|
16357
|
+
if (code === 0) {
|
|
16358
|
+
resolve3(stdout.trim());
|
|
16359
|
+
} else {
|
|
16360
|
+
const output = [stderr.trim(), stdout.trim()].filter(Boolean).join("\n") || `Process exited with code ${code}`;
|
|
16361
|
+
reject(new Error(`Publish bytes command failed:
|
|
16362
|
+
${output}`));
|
|
16363
|
+
}
|
|
16364
|
+
});
|
|
16365
|
+
});
|
|
16366
|
+
}
|
|
16367
|
+
|
|
16368
|
+
// src/utils/publish.ts
|
|
16344
16369
|
var PublishSingleton = class _PublishSingleton {
|
|
16345
16370
|
constructor(publishResp) {
|
|
16346
16371
|
this.publishResp = publishResp;
|
|
@@ -16417,11 +16442,11 @@ var PublishSingleton = class _PublishSingleton {
|
|
|
16417
16442
|
signer ??= ADMIN_KEYPAIR.toSuiAddress();
|
|
16418
16443
|
const _packagePath = this.getPackagePath(packagePath);
|
|
16419
16444
|
const cmd = this.getPublishCmd(_packagePath, signer, true);
|
|
16420
|
-
return
|
|
16445
|
+
return execCmd(cmd);
|
|
16421
16446
|
}
|
|
16422
16447
|
static async publishPackage(signer, packagePath) {
|
|
16423
16448
|
const cmd = this.getPublishCmd(packagePath, signer.toSuiAddress());
|
|
16424
|
-
const res =
|
|
16449
|
+
const res = await execCmd(cmd);
|
|
16425
16450
|
const match = res.match(/\{[\s\S]*\}/);
|
|
16426
16451
|
if (!match) {
|
|
16427
16452
|
throw new Error(`No JSON found in the publish command output: ${res}`);
|