@easysui/sdk 1.1.0 → 1.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 +21 -12
- package/dist/index.d.ts +21 -12
- package/dist/index.js +67 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Keypair } from '@mysten/sui/cryptography';
|
|
2
|
+
import * as _mysten_sui_transactions from '@mysten/sui/transactions';
|
|
2
3
|
import { Transaction } from '@mysten/sui/transactions';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
4
|
+
import { SuiClientTypes } from '@mysten/sui/client';
|
|
5
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
5
6
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
6
7
|
|
|
7
8
|
type Network = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
|
|
@@ -38,6 +39,7 @@ declare class Config<TConfigVars extends BaseConfigVars = ConfigVars> {
|
|
|
38
39
|
declare class Coin {
|
|
39
40
|
static get coinType(): string;
|
|
40
41
|
static getBalance(owner: string): Promise<bigint>;
|
|
42
|
+
static coinWithBalance(balance: bigint): (tx: Transaction) => _mysten_sui_transactions.TransactionResult;
|
|
41
43
|
static getCoin(owner: Keypair, amount?: bigint): Promise<string>;
|
|
42
44
|
static _mint(treasuryId: string, amount: bigint, minter: Keypair): Promise<void>;
|
|
43
45
|
static finalizeRegistration(registrar: Keypair): Promise<void>;
|
|
@@ -51,7 +53,7 @@ declare class USDC extends Coin {
|
|
|
51
53
|
static faucet(amount: bigint, receiver: string, admin: Keypair): Promise<void>;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
declare function analyze_cost(ptb: Transaction, resp:
|
|
56
|
+
declare function analyze_cost(ptb: Transaction, resp: SuiClientTypes.Transaction): void;
|
|
55
57
|
|
|
56
58
|
declare function deploy<TConfig extends typeof Config = typeof Config, TConfigVars extends BaseConfigVars = BaseConfigVars>(ConfigClass?: TConfig, packagePath?: string, pubFilePath?: string): Promise<string>;
|
|
57
59
|
declare function getDeployBytes(): Promise<string>;
|
|
@@ -268,9 +270,9 @@ declare class SuiClient {
|
|
|
268
270
|
private client;
|
|
269
271
|
private constructor();
|
|
270
272
|
private static getInstance;
|
|
271
|
-
static get client():
|
|
273
|
+
static get client(): SuiGrpcClient;
|
|
272
274
|
private static waitForTransaction;
|
|
273
|
-
static signAndExecute(ptb: Transaction, signer: Keypair): Promise<
|
|
275
|
+
static signAndExecute(ptb: Transaction, signer: Keypair): Promise<SuiClientTypes.Transaction<{}>>;
|
|
274
276
|
static toMoveArg(ptb: Transaction, value: any, type?: MoveType): any;
|
|
275
277
|
static moveCall({ signer, target, typeArgs, args, argTypes, ptb, withTransfer, }: {
|
|
276
278
|
signer: Keypair;
|
|
@@ -280,7 +282,7 @@ declare class SuiClient {
|
|
|
280
282
|
argTypes?: MoveType[];
|
|
281
283
|
ptb?: Transaction;
|
|
282
284
|
withTransfer?: boolean;
|
|
283
|
-
}): Promise<
|
|
285
|
+
}): Promise<SuiClientTypes.Transaction<{}>>;
|
|
284
286
|
static getMoveCallBytes({ signer, target, typeArgs, args, argTypes, ptb, withTransfer, gasOwner, format }: {
|
|
285
287
|
signer: string;
|
|
286
288
|
target: string;
|
|
@@ -295,17 +297,24 @@ declare class SuiClient {
|
|
|
295
297
|
static getMoveCallBytesFromPTB(ptb: Transaction, signer: string, gasOwner?: string, format?: FORMAT_TYPES): Promise<string>;
|
|
296
298
|
static toBytes(bytes: Uint8Array | string): Uint8Array<ArrayBufferLike>;
|
|
297
299
|
static getSignature(signatureOrKeypair: string | Keypair, bytes: Uint8Array): Promise<string>;
|
|
298
|
-
static executeMoveCallBytes(bytes: Uint8Array | string, senderSignature: string | Keypair, gasOwnerSignature?: string | Keypair): Promise<
|
|
300
|
+
static executeMoveCallBytes(bytes: Uint8Array | string, senderSignature: string | Keypair, gasOwnerSignature?: string | Keypair): Promise<SuiClientTypes.Transaction<{}>>;
|
|
299
301
|
static getPTB(target: string, typeArgs?: string[], args?: any[], argTypes?: MoveType[], signer?: string, withTransfer?: boolean, ptb?: Transaction): Transaction;
|
|
300
|
-
static public_transfer(objects: string[], from: Keypair, to: string): Promise<
|
|
301
|
-
static devInspect(ptb: Transaction, sender: string): Promise<
|
|
302
|
-
|
|
302
|
+
static public_transfer(objects: string[], from: Keypair, to: string): Promise<SuiClientTypes.Transaction<{}>>;
|
|
303
|
+
static devInspect(ptb: Transaction, sender: string): Promise<SuiClientTypes.SimulateTransactionResult<{
|
|
304
|
+
commandResults: true;
|
|
305
|
+
}>>;
|
|
306
|
+
static devInspectRaw(ptb: Transaction, sender: string): Promise<Uint8Array<ArrayBufferLike> | undefined>;
|
|
303
307
|
static devInspectBool(ptb: Transaction, sender: string): Promise<boolean | undefined>;
|
|
304
308
|
static devInspectU64(ptb: Transaction, sender: string): Promise<bigint>;
|
|
305
309
|
static devInspectAddress(ptb: Transaction, sender: string): Promise<string | undefined>;
|
|
306
310
|
static devInspectString(ptb: Transaction, sender: string): Promise<string>;
|
|
307
|
-
static getObject(id: string): Promise<
|
|
308
|
-
|
|
311
|
+
static getObject(id: string): Promise<SuiClientTypes.GetObjectResponse<{
|
|
312
|
+
content: true;
|
|
313
|
+
type: boolean;
|
|
314
|
+
display: true;
|
|
315
|
+
bcs: boolean;
|
|
316
|
+
}>>;
|
|
317
|
+
static getObjectsByType(owner: string, type: string): Promise<string[]>;
|
|
309
318
|
}
|
|
310
319
|
|
|
311
320
|
declare function createWallet(): Ed25519Keypair;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Keypair } from '@mysten/sui/cryptography';
|
|
2
|
+
import * as _mysten_sui_transactions from '@mysten/sui/transactions';
|
|
2
3
|
import { Transaction } from '@mysten/sui/transactions';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
4
|
+
import { SuiClientTypes } from '@mysten/sui/client';
|
|
5
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
5
6
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
6
7
|
|
|
7
8
|
type Network = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
|
|
@@ -38,6 +39,7 @@ declare class Config<TConfigVars extends BaseConfigVars = ConfigVars> {
|
|
|
38
39
|
declare class Coin {
|
|
39
40
|
static get coinType(): string;
|
|
40
41
|
static getBalance(owner: string): Promise<bigint>;
|
|
42
|
+
static coinWithBalance(balance: bigint): (tx: Transaction) => _mysten_sui_transactions.TransactionResult;
|
|
41
43
|
static getCoin(owner: Keypair, amount?: bigint): Promise<string>;
|
|
42
44
|
static _mint(treasuryId: string, amount: bigint, minter: Keypair): Promise<void>;
|
|
43
45
|
static finalizeRegistration(registrar: Keypair): Promise<void>;
|
|
@@ -51,7 +53,7 @@ declare class USDC extends Coin {
|
|
|
51
53
|
static faucet(amount: bigint, receiver: string, admin: Keypair): Promise<void>;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
declare function analyze_cost(ptb: Transaction, resp:
|
|
56
|
+
declare function analyze_cost(ptb: Transaction, resp: SuiClientTypes.Transaction): void;
|
|
55
57
|
|
|
56
58
|
declare function deploy<TConfig extends typeof Config = typeof Config, TConfigVars extends BaseConfigVars = BaseConfigVars>(ConfigClass?: TConfig, packagePath?: string, pubFilePath?: string): Promise<string>;
|
|
57
59
|
declare function getDeployBytes(): Promise<string>;
|
|
@@ -268,9 +270,9 @@ declare class SuiClient {
|
|
|
268
270
|
private client;
|
|
269
271
|
private constructor();
|
|
270
272
|
private static getInstance;
|
|
271
|
-
static get client():
|
|
273
|
+
static get client(): SuiGrpcClient;
|
|
272
274
|
private static waitForTransaction;
|
|
273
|
-
static signAndExecute(ptb: Transaction, signer: Keypair): Promise<
|
|
275
|
+
static signAndExecute(ptb: Transaction, signer: Keypair): Promise<SuiClientTypes.Transaction<{}>>;
|
|
274
276
|
static toMoveArg(ptb: Transaction, value: any, type?: MoveType): any;
|
|
275
277
|
static moveCall({ signer, target, typeArgs, args, argTypes, ptb, withTransfer, }: {
|
|
276
278
|
signer: Keypair;
|
|
@@ -280,7 +282,7 @@ declare class SuiClient {
|
|
|
280
282
|
argTypes?: MoveType[];
|
|
281
283
|
ptb?: Transaction;
|
|
282
284
|
withTransfer?: boolean;
|
|
283
|
-
}): Promise<
|
|
285
|
+
}): Promise<SuiClientTypes.Transaction<{}>>;
|
|
284
286
|
static getMoveCallBytes({ signer, target, typeArgs, args, argTypes, ptb, withTransfer, gasOwner, format }: {
|
|
285
287
|
signer: string;
|
|
286
288
|
target: string;
|
|
@@ -295,17 +297,24 @@ declare class SuiClient {
|
|
|
295
297
|
static getMoveCallBytesFromPTB(ptb: Transaction, signer: string, gasOwner?: string, format?: FORMAT_TYPES): Promise<string>;
|
|
296
298
|
static toBytes(bytes: Uint8Array | string): Uint8Array<ArrayBufferLike>;
|
|
297
299
|
static getSignature(signatureOrKeypair: string | Keypair, bytes: Uint8Array): Promise<string>;
|
|
298
|
-
static executeMoveCallBytes(bytes: Uint8Array | string, senderSignature: string | Keypair, gasOwnerSignature?: string | Keypair): Promise<
|
|
300
|
+
static executeMoveCallBytes(bytes: Uint8Array | string, senderSignature: string | Keypair, gasOwnerSignature?: string | Keypair): Promise<SuiClientTypes.Transaction<{}>>;
|
|
299
301
|
static getPTB(target: string, typeArgs?: string[], args?: any[], argTypes?: MoveType[], signer?: string, withTransfer?: boolean, ptb?: Transaction): Transaction;
|
|
300
|
-
static public_transfer(objects: string[], from: Keypair, to: string): Promise<
|
|
301
|
-
static devInspect(ptb: Transaction, sender: string): Promise<
|
|
302
|
-
|
|
302
|
+
static public_transfer(objects: string[], from: Keypair, to: string): Promise<SuiClientTypes.Transaction<{}>>;
|
|
303
|
+
static devInspect(ptb: Transaction, sender: string): Promise<SuiClientTypes.SimulateTransactionResult<{
|
|
304
|
+
commandResults: true;
|
|
305
|
+
}>>;
|
|
306
|
+
static devInspectRaw(ptb: Transaction, sender: string): Promise<Uint8Array<ArrayBufferLike> | undefined>;
|
|
303
307
|
static devInspectBool(ptb: Transaction, sender: string): Promise<boolean | undefined>;
|
|
304
308
|
static devInspectU64(ptb: Transaction, sender: string): Promise<bigint>;
|
|
305
309
|
static devInspectAddress(ptb: Transaction, sender: string): Promise<string | undefined>;
|
|
306
310
|
static devInspectString(ptb: Transaction, sender: string): Promise<string>;
|
|
307
|
-
static getObject(id: string): Promise<
|
|
308
|
-
|
|
311
|
+
static getObject(id: string): Promise<SuiClientTypes.GetObjectResponse<{
|
|
312
|
+
content: true;
|
|
313
|
+
type: boolean;
|
|
314
|
+
display: true;
|
|
315
|
+
bcs: boolean;
|
|
316
|
+
}>>;
|
|
317
|
+
static getObjectsByType(owner: string, type: string): Promise<string[]>;
|
|
309
318
|
}
|
|
310
319
|
|
|
311
320
|
declare function createWallet(): Ed25519Keypair;
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var ed25519 = require('@mysten/sui/keypairs/ed25519');
|
|
|
9
9
|
var secp256k1 = require('@mysten/sui/keypairs/secp256k1');
|
|
10
10
|
var secp256r1 = require('@mysten/sui/keypairs/secp256r1');
|
|
11
11
|
var utils = require('@mysten/sui/utils');
|
|
12
|
+
var grpc = require('@mysten/sui/grpc');
|
|
12
13
|
var transactions = require('@mysten/sui/transactions');
|
|
13
14
|
var bcs = require('@mysten/sui/bcs');
|
|
14
15
|
var child_process = require('child_process');
|
|
@@ -1660,16 +1661,11 @@ var MoveType = /* @__PURE__ */ ((MoveType2) => {
|
|
|
1660
1661
|
MoveType2[MoveType2["vec_u64"] = 14] = "vec_u64";
|
|
1661
1662
|
return MoveType2;
|
|
1662
1663
|
})(MoveType || {});
|
|
1663
|
-
var txOptions = {
|
|
1664
|
-
showEffects: true,
|
|
1665
|
-
showObjectChanges: true,
|
|
1666
|
-
showBalanceChanges: true
|
|
1667
|
-
};
|
|
1668
1664
|
var SuiClient = class _SuiClient {
|
|
1669
1665
|
static instance = null;
|
|
1670
1666
|
client;
|
|
1671
1667
|
constructor() {
|
|
1672
|
-
this.client = new
|
|
1668
|
+
this.client = new grpc.SuiGrpcClient({ baseUrl: Config.vars.RPC, network: Config.vars.NETWORK });
|
|
1673
1669
|
}
|
|
1674
1670
|
static getInstance() {
|
|
1675
1671
|
if (!_SuiClient.instance) {
|
|
@@ -1681,20 +1677,31 @@ var SuiClient = class _SuiClient {
|
|
|
1681
1677
|
return this.getInstance().client;
|
|
1682
1678
|
}
|
|
1683
1679
|
static async waitForTransaction(ptb, resp) {
|
|
1684
|
-
await _SuiClient.client.waitForTransaction({ digest: resp.digest });
|
|
1685
|
-
if (resp.
|
|
1680
|
+
await _SuiClient.client.core.waitForTransaction({ digest: resp.digest });
|
|
1681
|
+
if (!resp.status.success) {
|
|
1686
1682
|
throw new Error(JSON.stringify(resp));
|
|
1687
1683
|
}
|
|
1688
1684
|
analyze_cost(ptb, resp);
|
|
1689
1685
|
return resp;
|
|
1690
1686
|
}
|
|
1691
1687
|
static async signAndExecute(ptb, signer) {
|
|
1692
|
-
const
|
|
1688
|
+
const result = await _SuiClient.client.core.signAndExecuteTransaction({
|
|
1693
1689
|
transaction: ptb,
|
|
1694
1690
|
signer,
|
|
1695
|
-
|
|
1691
|
+
include: {
|
|
1692
|
+
effects: true,
|
|
1693
|
+
events: true,
|
|
1694
|
+
balanceChanges: true,
|
|
1695
|
+
objectTypes: true,
|
|
1696
|
+
transaction: true,
|
|
1697
|
+
bcs: true
|
|
1698
|
+
}
|
|
1696
1699
|
});
|
|
1697
|
-
|
|
1700
|
+
const tx = result.Transaction ?? result.FailedTransaction;
|
|
1701
|
+
if (!tx) {
|
|
1702
|
+
throw new Error("Transaction failed with no response");
|
|
1703
|
+
}
|
|
1704
|
+
return _SuiClient.waitForTransaction(ptb, tx);
|
|
1698
1705
|
}
|
|
1699
1706
|
static toMoveArg(ptb, value, type3) {
|
|
1700
1707
|
if (typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -1785,11 +1792,14 @@ var SuiClient = class _SuiClient {
|
|
|
1785
1792
|
gasOwnerSignature = await this.getSignature(gasOwnerSignature, transactionBlock);
|
|
1786
1793
|
signature.push(gasOwnerSignature);
|
|
1787
1794
|
}
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1790
|
-
signature
|
|
1791
|
-
options: txOptions
|
|
1795
|
+
const result = await _SuiClient.client.core.executeTransaction({
|
|
1796
|
+
transaction: transactionBlock,
|
|
1797
|
+
signatures: signature
|
|
1792
1798
|
});
|
|
1799
|
+
const resp = result.Transaction ?? result.FailedTransaction;
|
|
1800
|
+
if (!resp) {
|
|
1801
|
+
throw new Error("Transaction execution failed with no response");
|
|
1802
|
+
}
|
|
1793
1803
|
const ptb = transactions.Transaction.from(utils.toBase64(transactionBlock));
|
|
1794
1804
|
return _SuiClient.waitForTransaction(ptb, resp);
|
|
1795
1805
|
}
|
|
@@ -1811,14 +1821,20 @@ var SuiClient = class _SuiClient {
|
|
|
1811
1821
|
return await _SuiClient.signAndExecute(tx, from);
|
|
1812
1822
|
}
|
|
1813
1823
|
static async devInspect(ptb, sender) {
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1824
|
+
ptb.setSender(sender);
|
|
1825
|
+
return await _SuiClient.client.core.simulateTransaction({
|
|
1826
|
+
transaction: ptb,
|
|
1827
|
+
checksEnabled: false,
|
|
1828
|
+
include: { commandResults: true }
|
|
1817
1829
|
});
|
|
1818
1830
|
}
|
|
1819
1831
|
static async devInspectRaw(ptb, sender) {
|
|
1820
1832
|
const result = await this.devInspect(ptb, sender);
|
|
1821
|
-
|
|
1833
|
+
const commandResult = result.commandResults?.[0];
|
|
1834
|
+
if (!commandResult || !commandResult.returnValues?.[0]) {
|
|
1835
|
+
return void 0;
|
|
1836
|
+
}
|
|
1837
|
+
return commandResult.returnValues[0];
|
|
1822
1838
|
}
|
|
1823
1839
|
static async devInspectBool(ptb, sender) {
|
|
1824
1840
|
const result = await this.devInspectRaw(ptb, sender);
|
|
@@ -1844,24 +1860,25 @@ var SuiClient = class _SuiClient {
|
|
|
1844
1860
|
return bcs.bcs.string().parse(new Uint8Array(value));
|
|
1845
1861
|
}
|
|
1846
1862
|
static async getObject(id) {
|
|
1847
|
-
return _SuiClient.client.getObject({
|
|
1848
|
-
id,
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1863
|
+
return _SuiClient.client.core.getObject({
|
|
1864
|
+
objectId: id,
|
|
1865
|
+
include: {
|
|
1866
|
+
content: true,
|
|
1867
|
+
type: true,
|
|
1868
|
+
display: true,
|
|
1869
|
+
bcs: true
|
|
1854
1870
|
}
|
|
1855
1871
|
});
|
|
1856
1872
|
}
|
|
1857
1873
|
static async getObjectsByType(owner, type3) {
|
|
1858
|
-
const res = await _SuiClient.client.
|
|
1874
|
+
const res = await _SuiClient.client.core.listOwnedObjects({
|
|
1859
1875
|
owner,
|
|
1860
|
-
|
|
1861
|
-
|
|
1876
|
+
type: type3,
|
|
1877
|
+
include: {
|
|
1878
|
+
content: true
|
|
1862
1879
|
}
|
|
1863
1880
|
});
|
|
1864
|
-
return res.
|
|
1881
|
+
return res.objects.map((o) => o.objectId).filter((o) => o);
|
|
1865
1882
|
}
|
|
1866
1883
|
};
|
|
1867
1884
|
|
|
@@ -16261,24 +16278,27 @@ var Coin = class {
|
|
|
16261
16278
|
throw new Error("`coinType` getter must be implemented !");
|
|
16262
16279
|
}
|
|
16263
16280
|
static async getBalance(owner) {
|
|
16264
|
-
const result = await SuiClient.client.
|
|
16265
|
-
owner
|
|
16266
|
-
coinType: this.coinType
|
|
16281
|
+
const result = await SuiClient.client.core.listBalances({
|
|
16282
|
+
owner
|
|
16267
16283
|
});
|
|
16268
|
-
|
|
16284
|
+
const balance = result.balances.find((b) => b.coinType === this.coinType);
|
|
16285
|
+
return BigInt(balance?.balance || 0);
|
|
16269
16286
|
}
|
|
16270
|
-
static
|
|
16271
|
-
|
|
16272
|
-
const tx = new transactions.Transaction();
|
|
16273
|
-
const coinSplit = transactions.coinWithBalance({
|
|
16287
|
+
static coinWithBalance(balance) {
|
|
16288
|
+
return transactions.coinWithBalance({
|
|
16274
16289
|
balance,
|
|
16275
16290
|
useGasCoin: false,
|
|
16276
16291
|
type: this.coinType
|
|
16277
16292
|
});
|
|
16293
|
+
}
|
|
16294
|
+
static async getCoin(owner, amount) {
|
|
16295
|
+
const balance = amount || await this.getBalance(owner.toSuiAddress());
|
|
16296
|
+
const tx = new transactions.Transaction();
|
|
16297
|
+
const coinSplit = this.coinWithBalance(balance);
|
|
16278
16298
|
tx.transferObjects([coinSplit], owner.toSuiAddress());
|
|
16279
16299
|
const result = await SuiClient.signAndExecute(tx, owner);
|
|
16280
|
-
const coin = result.
|
|
16281
|
-
(o) => o.
|
|
16300
|
+
const coin = result.effects?.changedObjects?.find(
|
|
16301
|
+
(o) => o.idOperation === "Created"
|
|
16282
16302
|
);
|
|
16283
16303
|
return coin?.objectId;
|
|
16284
16304
|
}
|
|
@@ -16307,9 +16327,8 @@ var Coin = class {
|
|
|
16307
16327
|
});
|
|
16308
16328
|
}
|
|
16309
16329
|
static async send(amount, from, to) {
|
|
16310
|
-
const coin = await this.getCoin(from, amount);
|
|
16311
16330
|
const ptb = new transactions.Transaction();
|
|
16312
|
-
ptb.transferObjects([
|
|
16331
|
+
ptb.transferObjects([this.coinWithBalance(amount)], to);
|
|
16313
16332
|
await SuiClient.signAndExecute(ptb, from);
|
|
16314
16333
|
}
|
|
16315
16334
|
static async assertBalance(wallet, amount) {
|
|
@@ -16560,12 +16579,14 @@ function sleep(ms) {
|
|
|
16560
16579
|
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
16561
16580
|
}
|
|
16562
16581
|
async function waitForNextEpoch(timeoutMs = 5 * 60 * 1e3, pollIntervalMs = 2e3) {
|
|
16563
|
-
const
|
|
16582
|
+
const startEpochData = await SuiClient.client.core.getCurrentSystemState();
|
|
16583
|
+
const startEpoch = BigInt(startEpochData.systemState.epoch);
|
|
16564
16584
|
const startTime = Date.now();
|
|
16565
16585
|
while (true) {
|
|
16566
|
-
const
|
|
16567
|
-
|
|
16568
|
-
|
|
16586
|
+
const currentEpochData = await SuiClient.client.core.getCurrentSystemState();
|
|
16587
|
+
const currentEpoch = BigInt(currentEpochData.systemState.epoch);
|
|
16588
|
+
if (currentEpoch > startEpoch) {
|
|
16589
|
+
return currentEpoch.toString();
|
|
16569
16590
|
}
|
|
16570
16591
|
if (Date.now() - startTime > timeoutMs) {
|
|
16571
16592
|
throw new Error("Timeout waiting for next epoch.");
|