@pezkuwi/extension-inject 0.62.6 → 0.62.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle.js +50 -0
- package/build/chrome.js +4 -0
- package/build/crossenv.js +4 -0
- package/build/cyrb53.js +29 -0
- package/build/index.js +5 -0
- package/build/packageDetect.js +7 -0
- package/build/packageInfo.js +4 -0
- package/{cjs → build}/types.d.ts +5 -5
- package/build/types.js +3 -0
- package/package.json +16 -147
- package/src/bundle.ts +47 -0
- package/src/chrome.ts +6 -0
- package/src/crossenv.ts +6 -0
- package/src/cyrb53.spec.ts +30 -0
- package/src/cyrb53.ts +33 -0
- package/src/index.ts +7 -0
- package/src/packageDetect.ts +11 -0
- package/src/packageInfo.ts +6 -0
- package/src/types.ts +122 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.spec.json +16 -0
- package/tsconfig.spec.tsbuildinfo +1 -0
- package/LICENSE +0 -201
- package/bundle.js +0 -25
- package/chrome.js +0 -2
- package/cjs/bundle.d.ts +0 -3
- package/cjs/bundle.js +0 -30
- package/cjs/chrome.d.ts +0 -1
- package/cjs/chrome.js +0 -5
- package/cjs/crossenv.js +0 -4
- package/cjs/cyrb53.js +0 -16
- package/cjs/index.js +0 -4
- package/cjs/package.json +0 -3
- package/cjs/packageDetect.js +0 -5
- package/cjs/packageInfo.js +0 -4
- package/cjs/types.js +0 -2
- package/crossenv.d.ts +0 -1
- package/crossenv.js +0 -2
- package/cyrb53.d.ts +0 -1
- package/cyrb53.js +0 -13
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/packageDetect.d.ts +0 -1
- package/packageDetect.js +0 -3
- package/packageInfo.d.ts +0 -6
- package/packageInfo.js +0 -1
- package/types.d.ts +0 -93
- package/types.js +0 -1
- /package/{bundle.d.ts → build/bundle.d.ts} +0 -0
- /package/{chrome.d.ts → build/chrome.d.ts} +0 -0
- /package/{cjs → build}/crossenv.d.ts +0 -0
- /package/{cjs → build}/cyrb53.d.ts +0 -0
- /package/{cjs → build}/index.d.ts +0 -0
- /package/{cjs → build}/packageDetect.d.ts +0 -0
- /package/{cjs → build}/packageInfo.d.ts +0 -0
package/bundle.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { cyrb53 } from './cyrb53.js';
|
|
2
|
-
export { packageInfo } from './packageInfo.js';
|
|
3
|
-
const IS_CONNECT_CAPABLE = false;
|
|
4
|
-
export function injectExtension(enable, { name, version }) {
|
|
5
|
-
// small helper with the typescript types, just cast window
|
|
6
|
-
const windowInject = window;
|
|
7
|
-
// don't clobber the existing object, we will add it (or create as needed)
|
|
8
|
-
windowInject.injectedWeb3 = windowInject.injectedWeb3 || {};
|
|
9
|
-
if (IS_CONNECT_CAPABLE) {
|
|
10
|
-
// expose our extension on the window object, new-style with connect(origin)
|
|
11
|
-
windowInject.injectedWeb3[cyrb53(`${name}/${version}`)] = {
|
|
12
|
-
connect: (origin) => enable(origin).then(({ accounts, metadata, provider, signer }) => ({
|
|
13
|
-
accounts, metadata, name, provider, signer, version
|
|
14
|
-
})),
|
|
15
|
-
enable: () => 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)'))
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
// expose our extension on the window object, old-style with enable(origin)
|
|
20
|
-
windowInject.injectedWeb3[name] = {
|
|
21
|
-
enable: (origin) => enable(origin),
|
|
22
|
-
version
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
package/chrome.js
DELETED
package/cjs/bundle.d.ts
DELETED
package/cjs/bundle.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.packageInfo = void 0;
|
|
4
|
-
exports.injectExtension = injectExtension;
|
|
5
|
-
const cyrb53_js_1 = require("./cyrb53.js");
|
|
6
|
-
var packageInfo_js_1 = require("./packageInfo.js");
|
|
7
|
-
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
|
8
|
-
const IS_CONNECT_CAPABLE = false;
|
|
9
|
-
function injectExtension(enable, { name, version }) {
|
|
10
|
-
// small helper with the typescript types, just cast window
|
|
11
|
-
const windowInject = window;
|
|
12
|
-
// don't clobber the existing object, we will add it (or create as needed)
|
|
13
|
-
windowInject.injectedWeb3 = windowInject.injectedWeb3 || {};
|
|
14
|
-
if (IS_CONNECT_CAPABLE) {
|
|
15
|
-
// expose our extension on the window object, new-style with connect(origin)
|
|
16
|
-
windowInject.injectedWeb3[(0, cyrb53_js_1.cyrb53)(`${name}/${version}`)] = {
|
|
17
|
-
connect: (origin) => enable(origin).then(({ accounts, metadata, provider, signer }) => ({
|
|
18
|
-
accounts, metadata, name, provider, signer, version
|
|
19
|
-
})),
|
|
20
|
-
enable: () => 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)'))
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
// expose our extension on the window object, old-style with enable(origin)
|
|
25
|
-
windowInject.injectedWeb3[name] = {
|
|
26
|
-
enable: (origin) => enable(origin),
|
|
27
|
-
version
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
package/cjs/chrome.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const chrome: typeof globalThis.chrome;
|
package/cjs/chrome.js
DELETED
package/cjs/crossenv.js
DELETED
package/cjs/cyrb53.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cyrb53 = cyrb53;
|
|
4
|
-
function cyrb53(input, seed = Date.now()) {
|
|
5
|
-
let h1 = 0xdeadbeef ^ seed;
|
|
6
|
-
let h2 = 0x41c6ce57 ^ seed;
|
|
7
|
-
for (let i = 0, count = input.length; i < count; i++) {
|
|
8
|
-
const ch = input.charCodeAt(i);
|
|
9
|
-
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
10
|
-
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
11
|
-
}
|
|
12
|
-
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
13
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
14
|
-
// https://stackoverflow.com/a/52171480
|
|
15
|
-
return (h2 >>> 0).toString(16).padStart(8, '0') + (h1 >>> 0).toString(16).padStart(8, '0');
|
|
16
|
-
}
|
package/cjs/index.js
DELETED
package/cjs/package.json
DELETED
package/cjs/packageDetect.js
DELETED
package/cjs/packageInfo.js
DELETED
package/cjs/types.js
DELETED
package/crossenv.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/crossenv.js
DELETED
package/cyrb53.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function cyrb53(input: string, seed?: number): string;
|
package/cyrb53.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function cyrb53(input, seed = Date.now()) {
|
|
2
|
-
let h1 = 0xdeadbeef ^ seed;
|
|
3
|
-
let h2 = 0x41c6ce57 ^ seed;
|
|
4
|
-
for (let i = 0, count = input.length; i < count; i++) {
|
|
5
|
-
const ch = input.charCodeAt(i);
|
|
6
|
-
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
7
|
-
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
8
|
-
}
|
|
9
|
-
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
10
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
11
|
-
// https://stackoverflow.com/a/52171480
|
|
12
|
-
return (h2 >>> 0).toString(16).padStart(8, '0') + (h1 >>> 0).toString(16).padStart(8, '0');
|
|
13
|
-
}
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './bundle.js';
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './bundle.js';
|
package/packageDetect.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/packageDetect.js
DELETED
package/packageInfo.d.ts
DELETED
package/packageInfo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const packageInfo = { name: '@polkadot/extension-inject', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '0.62.6' };
|
package/types.d.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { Signer as InjectedSigner } from '@polkadot/api/types';
|
|
2
|
-
import type { ProviderInterface } from '@polkadot/rpc-provider/types';
|
|
3
|
-
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
|
|
4
|
-
import type { HexString } from '@polkadot/util/types';
|
|
5
|
-
import type { KeypairType } from '@polkadot/util-crypto/types';
|
|
6
|
-
type This = typeof globalThis;
|
|
7
|
-
export type Unsubcall = () => void;
|
|
8
|
-
export interface InjectedAccount {
|
|
9
|
-
address: string;
|
|
10
|
-
genesisHash?: string | null;
|
|
11
|
-
name?: string;
|
|
12
|
-
type?: KeypairType;
|
|
13
|
-
}
|
|
14
|
-
export interface InjectedAccountWithMeta {
|
|
15
|
-
address: string;
|
|
16
|
-
meta: {
|
|
17
|
-
genesisHash?: string | null;
|
|
18
|
-
name?: string;
|
|
19
|
-
source: string;
|
|
20
|
-
};
|
|
21
|
-
type?: KeypairType;
|
|
22
|
-
}
|
|
23
|
-
export interface InjectedAccounts {
|
|
24
|
-
get: (anyType?: boolean) => Promise<InjectedAccount[]>;
|
|
25
|
-
subscribe: (cb: (accounts: InjectedAccount[]) => void | Promise<void>) => Unsubcall;
|
|
26
|
-
}
|
|
27
|
-
export interface InjectedExtensionInfo {
|
|
28
|
-
name: string;
|
|
29
|
-
version: string;
|
|
30
|
-
}
|
|
31
|
-
export interface ProviderMeta {
|
|
32
|
-
network: string;
|
|
33
|
-
node: 'full' | 'light';
|
|
34
|
-
source: string;
|
|
35
|
-
transport: string;
|
|
36
|
-
}
|
|
37
|
-
export interface MetadataDefBase {
|
|
38
|
-
chain: string;
|
|
39
|
-
genesisHash: HexString;
|
|
40
|
-
icon: string;
|
|
41
|
-
ss58Format: number;
|
|
42
|
-
chainType?: 'substrate' | 'ethereum';
|
|
43
|
-
}
|
|
44
|
-
export interface MetadataDef extends MetadataDefBase {
|
|
45
|
-
color?: string;
|
|
46
|
-
specVersion: number;
|
|
47
|
-
tokenDecimals: number;
|
|
48
|
-
tokenSymbol: string;
|
|
49
|
-
types: Record<string, Record<string, string> | string>;
|
|
50
|
-
metaCalls?: string;
|
|
51
|
-
rawMetadata?: HexString;
|
|
52
|
-
userExtensions?: ExtDef;
|
|
53
|
-
}
|
|
54
|
-
export interface InjectedMetadataKnown {
|
|
55
|
-
genesisHash: string;
|
|
56
|
-
specVersion: number;
|
|
57
|
-
}
|
|
58
|
-
export interface InjectedMetadata {
|
|
59
|
-
get: () => Promise<InjectedMetadataKnown[]>;
|
|
60
|
-
provide: (definition: MetadataDef) => Promise<boolean>;
|
|
61
|
-
}
|
|
62
|
-
export type ProviderList = Record<string, ProviderMeta>;
|
|
63
|
-
export interface InjectedProvider extends ProviderInterface {
|
|
64
|
-
listProviders: () => Promise<ProviderList>;
|
|
65
|
-
startProvider: (key: string) => Promise<ProviderMeta>;
|
|
66
|
-
}
|
|
67
|
-
export interface InjectedProviderWithMeta {
|
|
68
|
-
provider: InjectedProvider;
|
|
69
|
-
meta: ProviderMeta;
|
|
70
|
-
}
|
|
71
|
-
export interface Injected {
|
|
72
|
-
accounts: InjectedAccounts;
|
|
73
|
-
metadata?: InjectedMetadata;
|
|
74
|
-
provider?: InjectedProvider;
|
|
75
|
-
signer: InjectedSigner;
|
|
76
|
-
}
|
|
77
|
-
export interface InjectedWindowProvider {
|
|
78
|
-
connect?: (origin: string) => Promise<InjectedExtension>;
|
|
79
|
-
enable?: (origin: string) => Promise<Injected>;
|
|
80
|
-
version?: string;
|
|
81
|
-
}
|
|
82
|
-
export interface InjectedWindow extends This {
|
|
83
|
-
injectedWeb3: Record<string, InjectedWindowProvider>;
|
|
84
|
-
}
|
|
85
|
-
export type InjectedExtension = InjectedExtensionInfo & Injected;
|
|
86
|
-
export type InjectOptions = InjectedExtensionInfo;
|
|
87
|
-
export interface Web3AccountsOptions {
|
|
88
|
-
accountType?: KeypairType[];
|
|
89
|
-
extensions?: string[];
|
|
90
|
-
genesisHash?: string | null;
|
|
91
|
-
ss58Format?: number;
|
|
92
|
-
}
|
|
93
|
-
export {};
|
package/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|