mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-04-21 23:37:57 +00:00
fix: add AuthorizeCall signed extension for PezkuwiChain transactions
PezkuwiChain requires AuthorizeCall as the first signed extension in all transactions. Without this extension properly configured, transactions fail with "bad signature" errors. Added signedExtensions configuration to: - ApiPromise.create() in Api.tsx - getApi() in StakingAsync.tsx - Test API creation functions This fix enables proper transaction signing for PezkuwiChain mainnet and teyrchains (Asset Hub, People Chain).
This commit is contained in:
@@ -280,10 +280,19 @@ async function createApi (apiUrl: string, signer: ApiSigner, isLocalFork: boolea
|
||||
provider = new WsProvider(apiUrl);
|
||||
}
|
||||
|
||||
// PezkuwiChain requires AuthorizeCall signed extension for all transactions
|
||||
const pezkuwiSignedExtensions = {
|
||||
AuthorizeCall: {
|
||||
extrinsic: {},
|
||||
payload: {}
|
||||
}
|
||||
};
|
||||
|
||||
statics.api = new ApiPromise({
|
||||
provider,
|
||||
registry: statics.registry,
|
||||
signer,
|
||||
signedExtensions: pezkuwiSignedExtensions,
|
||||
types,
|
||||
typesBundle
|
||||
});
|
||||
|
||||
@@ -12,9 +12,18 @@ import { useApi } from '@pezkuwi/react-hooks';
|
||||
|
||||
const allEndPoints = createWsEndpoints((k, v) => v?.toString() || k);
|
||||
|
||||
// PezkuwiChain requires AuthorizeCall signed extension for all transactions
|
||||
const PEZKUWI_SIGNED_EXTENSIONS = {
|
||||
AuthorizeCall: {
|
||||
extrinsic: {},
|
||||
payload: {}
|
||||
}
|
||||
};
|
||||
|
||||
export const getApi = async (url: string[]|string) => {
|
||||
const api = await ApiPromise.create({
|
||||
provider: new WsProvider(url)
|
||||
provider: new WsProvider(url),
|
||||
signedExtensions: PEZKUWI_SIGNED_EXTENSIONS
|
||||
});
|
||||
|
||||
await api.isReadyOrError;
|
||||
|
||||
@@ -6,12 +6,23 @@ import { WsProvider } from '@pezkuwi/rpc-provider';
|
||||
|
||||
import { BIZINIKIWI_PORT } from '../bizinikiwi/index.js';
|
||||
|
||||
// PezkuwiChain requires AuthorizeCall signed extension for all transactions
|
||||
const PEZKUWI_SIGNED_EXTENSIONS = {
|
||||
AuthorizeCall: {
|
||||
extrinsic: {},
|
||||
payload: {}
|
||||
}
|
||||
};
|
||||
|
||||
export async function createApi (port: number = BIZINIKIWI_PORT): Promise<ApiPromise> {
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
const provider = new WsProvider(`ws://127.0.0.1:${port}`);
|
||||
|
||||
const api = await ApiPromise.create({ provider });
|
||||
const api = await ApiPromise.create({
|
||||
provider,
|
||||
signedExtensions: PEZKUWI_SIGNED_EXTENSIONS
|
||||
});
|
||||
|
||||
const [chain, nodeName, nodeVersion] = await Promise.all([
|
||||
api.rpc.system.chain(),
|
||||
|
||||
@@ -7,6 +7,14 @@ import { ApiPromise, WsProvider } from '@pezkuwi/api';
|
||||
import { Metadata, TypeRegistry } from '@pezkuwi/types';
|
||||
import metaStatic from '@pezkuwi/types-support/metadata/static-bizinikiwi';
|
||||
|
||||
// PezkuwiChain requires AuthorizeCall signed extension for all transactions
|
||||
const PEZKUWI_SIGNED_EXTENSIONS = {
|
||||
AuthorizeCall: {
|
||||
extrinsic: {},
|
||||
payload: {}
|
||||
}
|
||||
};
|
||||
|
||||
export function createAugmentedApi (): ApiPromise {
|
||||
const registry = new TypeRegistry();
|
||||
// FIXME - ref: https://github.com/pezkuwichain/pezkuwi-apps/pull/11051
|
||||
@@ -16,7 +24,11 @@ export function createAugmentedApi (): ApiPromise {
|
||||
|
||||
registry.setMetadata(metadata);
|
||||
|
||||
const api = new ApiPromise({ provider: new WsProvider('ws://', false), registry: registry as unknown as Registry });
|
||||
const api = new ApiPromise({
|
||||
provider: new WsProvider('ws://', false),
|
||||
registry: registry as unknown as Registry,
|
||||
signedExtensions: PEZKUWI_SIGNED_EXTENSIONS
|
||||
});
|
||||
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
api.injectMetadata(metadata, true);
|
||||
|
||||
Reference in New Issue
Block a user