Rebrand: polkadot → pezkuwi, substrate → bizinikiwi, kusama → dicle

This commit is contained in:
Kurdistan Tech Ministry committed 2026-01-07 02:29:40 +03:00
commit d5f038faea
1383 files changed
+1088018

No files matched your search

@@ -0,0 +1,53 @@
// Copyright 2017-2025 @pezkuwi/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KeyringPair } from '@pezkuwi/keyring/types';
import type { Registry, SignerPayloadJSON, SignerPayloadRaw } from '@pezkuwi/types/types';
import type { Signer, SignerResult } from '../types/index.js';
import { hexToU8a, objectSpread, u8aToHex } from '@pezkuwi/util';
let id = 0;
export class SingleAccountSigner implements Signer {
readonly #keyringPair: KeyringPair;
readonly #registry: Registry;
readonly #signDelay: number;
constructor (registry: Registry, keyringPair: KeyringPair, signDelay = 0) {
this.#keyringPair = keyringPair;
this.#registry = registry;
this.#signDelay = signDelay;
}
public async signPayload (payload: SignerPayloadJSON): Promise<SignerResult> {
if (payload.address !== this.#keyringPair.address) {
throw new Error('Signer does not have the keyringPair');
}
return new Promise((resolve): void => {
setTimeout((): void => {
const signed = this.#registry.createType('ExtrinsicPayload', payload, { version: payload.version }).sign(this.#keyringPair);
resolve(objectSpread({ id: ++id }, signed));
}, this.#signDelay);
});
}
public async signRaw ({ address, data }: SignerPayloadRaw): Promise<SignerResult> {
if (address !== this.#keyringPair.address) {
throw new Error('Signer does not have the keyringPair');
}
return new Promise((resolve): void => {
setTimeout((): void => {
const signature = u8aToHex(this.#keyringPair.sign(hexToU8a(data)));
resolve({
id: ++id,
signature
});
}, this.#signDelay);
});
}
}
+5
View File
@@ -0,0 +1,5 @@
// Copyright 2017-2025 @pezkuwi/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './logEvents.js';
export * from './SingleAccountSigner.js';
+24
View File
@@ -0,0 +1,24 @@
// Copyright 2017-2025 @pezkuwi/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { EventRecord } from '@pezkuwi/types/interfaces';
import type { SubmittableResult } from '../index.js';
// log all events for the transfers, calling done() when finalized
export const logEvents = (done: () => Record<string, unknown>): (r: SubmittableResult) => void =>
({ events, status }: SubmittableResult): void => {
console.log('Transaction status:', status.type);
if (status.isInBlock) {
console.log('Completed at block hash', status.value.toHex());
console.log('Events:');
events.forEach(({ event: { data, method, section }, phase }: EventRecord): void => {
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
});
if (events.length) {
done();
}
}
};