mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-07-27 18:05:41 +00:00
c71ddb6e0d
- Clone Polkadot.js Apps repository - Update package.json with Pezkuwi branding - Add Pezkuwi endpoint to production chains (wss://pezkuwichain.app:9944) - Create comprehensive README for SDK UI - Set up project structure with all packages Next steps: - Apply Kurdistan colors (Kesk, Sor, Zer, Spi + Black) to UI theme - Replace logos with Pezkuwi branding - Test build and deployment
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
// Copyright 2017-2025 @polkadot/test-support authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { SubmittableExtrinsic } from '@polkadot/api/types';
|
|
import type { KeyringPair } from '@polkadot/keyring/types';
|
|
import type { EventRecord, ExtrinsicStatus } from '@polkadot/types/interfaces';
|
|
|
|
import { waitFor } from '../utils/waitFor.js';
|
|
|
|
export async function execute (extrinsic: SubmittableExtrinsic<'promise'>, signer: KeyringPair, logger = { info: console.log }): Promise<void> {
|
|
let currentTxDone = false;
|
|
|
|
function sendStatusCb ({ events = [], status }: { events?: EventRecord[], status: ExtrinsicStatus; }) {
|
|
if (status.isInvalid) {
|
|
logger.info('Transaction invalid');
|
|
currentTxDone = true;
|
|
} else if (status.isReady) {
|
|
logger.info('Transaction is ready');
|
|
} else if (status.isBroadcast) {
|
|
logger.info('Transaction has been broadcasted');
|
|
} else if (status.isInBlock) {
|
|
logger.info('Transaction is in block');
|
|
} else if (status.isFinalized) {
|
|
logger.info(`Transaction has been included in blockHash ${status.asFinalized.toHex()}`);
|
|
events.forEach(
|
|
({ event }) => {
|
|
if (event.method === 'ExtrinsicSuccess') {
|
|
logger.info('Transaction succeeded');
|
|
} else if (event.method === 'ExtrinsicFailed') {
|
|
logger.info('Transaction failed');
|
|
}
|
|
}
|
|
);
|
|
currentTxDone = true;
|
|
}
|
|
}
|
|
|
|
await extrinsic.signAndSend(signer, sendStatusCb);
|
|
await waitFor(() => currentTxDone, { timeout: 20000 });
|
|
}
|