Skip to content

Commit

Permalink
wait for txs
Browse files Browse the repository at this point in the history
  • Loading branch information
manolisliolios committed Oct 16, 2024
1 parent 92a4812 commit 7f92a6b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion scripts/init/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { existsSync, unlinkSync, writeFileSync } from 'fs';
import path from 'path';
import { Transaction } from '@mysten/sui/transactions';

import { publishPackage, signAndExecute } from '../utils/utils';
import { getClient, publishPackage, signAndExecute } from '../utils/utils';
import { Network, Packages } from './packages';
import { PackageInfo } from './types';

Expand Down Expand Up @@ -39,6 +39,10 @@ export const publishPackages = async (network: Network, isCiJob = false, configP
publishPackage(txb, packageFolder, configPath);
const res = await signAndExecute(txb, network);

await getClient(network).waitForTransaction({
digest: res.digest,
});

// @ts-ignore-next-line
const data = pkg.processPublish(res);
results[key] = data;
Expand Down
9 changes: 6 additions & 3 deletions scripts/init/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ export const setup = async (packageInfo: PackageInfo, network: Network) => {
});

try {
// TODO: Use "waitForTransaction" when we migrate to latest SDK.
await sleep(2000);
await signAndExecute(txb, network);
const res = await signAndExecute(txb, network);

await getClient(network).waitForTransaction({
digest: res.digest,
});

console.log('******* Packages set up successfully *******');

try {
Expand Down

0 comments on commit 7f92a6b

Please sign in to comment.