Update domain references to pezkuwichain.app and rebrand from polkadot

This commit is contained in:
2026-01-06 12:21:11 +03:00
commit c2913a65d9
401 changed files with 23179 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
// Copyright 2019-2025 @pezkuwi/extension-inject authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Injected, InjectedExtension, InjectedWindow, InjectOptions } from './types.js';
import { cyrb53 } from './cyrb53.js';
export { packageInfo } from './packageInfo.js';
// setting for new-style connect (more-secure with no details exposed without
// user acknowledgement, however slightly less-compatible with all dapps, some
// may have not upgraded and don't have access to the latest interfaces)
//
// NOTE: In future versions this will be made the default
const IS_CONNECT_CAPABLE = false;
// It is recommended to always use the function below to shield the extension and dapp from
// any future changes. The exposed interface will manage access between the 2 environments,
// be it via window (current), postMessage (under consideration) or any other mechanism
export function injectExtension (enable: (origin: string) => Promise<Injected>, { name, version }: InjectOptions): void {
// small helper with the typescript types, just cast window
const windowInject = window as Window & InjectedWindow;
// don't clobber the existing object, we will add it (or create as needed)
windowInject.injectedWeb3 = windowInject.injectedWeb3 || {};
if (IS_CONNECT_CAPABLE) {
// expose our extension on the window object, new-style with connect(origin)
windowInject.injectedWeb3[cyrb53(`${name}/${version}`)] = {
connect: (origin: string): Promise<InjectedExtension> =>
enable(origin).then(({ accounts, metadata, provider, signer }) => ({
accounts, metadata, name, provider, signer, version
})),
enable: (): Promise<Injected> =>
Promise.reject(
new Error('This extension does not have support for enable(...), rather is only supports the new connect(...) variant (no extension name/version metadata without specific user-approval)')
)
};
} else {
// expose our extension on the window object, old-style with enable(origin)
windowInject.injectedWeb3[name] = {
enable: (origin: string): Promise<Injected> =>
enable(origin),
version
};
}
}