@polkadot/extension-base 0.53.1 → 0.55.1

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.
@@ -0,0 +1,12 @@
1
+ import type { KeyringPair } from '@polkadot/keyring/types';
2
+ import type { TypeRegistry } from '@polkadot/types';
3
+ import type { SignerPayloadRaw } from '@polkadot/types/types';
4
+ import type { HexString } from '@polkadot/util/types';
5
+ import type { RequestSign } from './types.js';
6
+ export default class RequestBytesSign implements RequestSign {
7
+ readonly payload: SignerPayloadRaw;
8
+ constructor(payload: SignerPayloadRaw);
9
+ sign(_registry: TypeRegistry, pair: KeyringPair): {
10
+ signature: HexString;
11
+ };
12
+ }
@@ -0,0 +1,12 @@
1
+ import type { KeyringPair } from '@polkadot/keyring/types';
2
+ import type { TypeRegistry } from '@polkadot/types';
3
+ import type { SignerPayloadJSON } from '@polkadot/types/types';
4
+ import type { HexString } from '@polkadot/util/types';
5
+ import type { RequestSign } from './types.js';
6
+ export default class RequestExtrinsicSign implements RequestSign {
7
+ readonly payload: SignerPayloadJSON;
8
+ constructor(payload: SignerPayloadJSON);
9
+ sign(registry: TypeRegistry, pair: KeyringPair): {
10
+ signature: HexString;
11
+ };
12
+ }
@@ -0,0 +1,49 @@
1
+ /// <reference types="chrome" />
2
+ import type { MessageTypes, RequestTypes, ResponseType } from '../types.js';
3
+ import type State from './State.js';
4
+ export default class Extension {
5
+ #private;
6
+ constructor(state: State);
7
+ private transformAccounts;
8
+ private accountsCreateExternal;
9
+ private accountsCreateHardware;
10
+ private accountsCreateSuri;
11
+ private accountsChangePassword;
12
+ private accountsEdit;
13
+ private accountsExport;
14
+ private accountsBatchExport;
15
+ private accountsForget;
16
+ private refreshAccountPasswordCache;
17
+ private accountsShow;
18
+ private accountsTie;
19
+ private accountsValidate;
20
+ private accountsSubscribe;
21
+ private authorizeApprove;
22
+ private authorizeUpdate;
23
+ private getAuthList;
24
+ private authorizeSubscribe;
25
+ private metadataApprove;
26
+ private metadataGet;
27
+ private metadataList;
28
+ private metadataReject;
29
+ private metadataSubscribe;
30
+ private jsonRestore;
31
+ private batchRestore;
32
+ private jsonGetAccountInfo;
33
+ private seedCreate;
34
+ private seedValidate;
35
+ private signingApprovePassword;
36
+ private signingApproveSignature;
37
+ private signingCancel;
38
+ private signingIsLocked;
39
+ private signingSubscribe;
40
+ private windowOpen;
41
+ private derive;
42
+ private derivationValidate;
43
+ private derivationCreate;
44
+ private removeAuthorization;
45
+ private rejectAuthRequest;
46
+ private updateCurrentTabs;
47
+ private getConnectedTabsUrl;
48
+ handle<TMessageType extends MessageTypes>(id: string, type: TMessageType, request: RequestTypes[TMessageType], port?: chrome.runtime.Port): Promise<ResponseType<TMessageType>>;
49
+ }
@@ -0,0 +1,96 @@
1
+ /// <reference types="chrome" />
2
+ import type { MetadataDef, ProviderMeta } from '@polkadot/extension-inject/types';
3
+ import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback } from '@polkadot/rpc-provider/types';
4
+ import type { AccountJson, AuthorizeRequest, AuthUrlInfo, AuthUrls, MetadataRequest, RequestAuthorizeTab, RequestRpcSend, RequestRpcSubscribe, RequestRpcUnsubscribe, RequestSign, ResponseRpcListProviders, ResponseSigning, SigningRequest } from '../types.js';
5
+ import { BehaviorSubject } from 'rxjs';
6
+ interface Resolver<T> {
7
+ reject: (error: Error) => void;
8
+ resolve: (result: T) => void;
9
+ }
10
+ interface AuthRequest extends Resolver<AuthResponse> {
11
+ id: string;
12
+ idStr: string;
13
+ request: RequestAuthorizeTab;
14
+ url: string;
15
+ }
16
+ export type AuthorizedAccountsDiff = [url: string, authorizedAccounts: AuthUrlInfo['authorizedAccounts']][];
17
+ interface MetaRequest extends Resolver<boolean> {
18
+ id: string;
19
+ request: MetadataDef;
20
+ url: string;
21
+ }
22
+ export interface AuthResponse {
23
+ result: boolean;
24
+ authorizedAccounts: string[];
25
+ }
26
+ type Providers = Record<string, {
27
+ meta: ProviderMeta;
28
+ start: () => ProviderInterface;
29
+ }>;
30
+ interface SignRequest extends Resolver<ResponseSigning> {
31
+ account: AccountJson;
32
+ id: string;
33
+ request: RequestSign;
34
+ url: string;
35
+ }
36
+ export declare enum NotificationOptions {
37
+ None = 0,
38
+ Normal = 1,
39
+ PopUp = 2
40
+ }
41
+ export default class State {
42
+ #private;
43
+ readonly authSubject: BehaviorSubject<AuthorizeRequest[]>;
44
+ readonly metaSubject: BehaviorSubject<MetadataRequest[]>;
45
+ readonly signSubject: BehaviorSubject<SigningRequest[]>;
46
+ readonly authUrlSubjects: Record<string, BehaviorSubject<AuthUrlInfo>>;
47
+ defaultAuthAccountSelection: string[];
48
+ constructor(providers?: Providers);
49
+ init(): Promise<void>;
50
+ get knownMetadata(): MetadataDef[];
51
+ get numAuthRequests(): number;
52
+ get numMetaRequests(): number;
53
+ get numSignRequests(): number;
54
+ get allAuthRequests(): AuthorizeRequest[];
55
+ get allMetaRequests(): MetadataRequest[];
56
+ get allSignRequests(): SigningRequest[];
57
+ get authUrls(): AuthUrls;
58
+ private popupClose;
59
+ private popupOpen;
60
+ private authComplete;
61
+ /**
62
+ * @deprecated This method is deprecated in favor of {@link updateCurrentTabs} and will be removed in a future release.
63
+ */
64
+ udateCurrentTabsUrl(urls: string[]): void;
65
+ updateCurrentTabsUrl(urls: string[]): void;
66
+ getConnectedTabsUrl(): string[];
67
+ deleteAuthRequest(requestId: string): void;
68
+ private saveCurrentAuthList;
69
+ private saveDefaultAuthAccounts;
70
+ updateDefaultAuthAccounts(newList: string[]): Promise<void>;
71
+ private metaComplete;
72
+ private signComplete;
73
+ stripUrl(url: string): string;
74
+ private updateIcon;
75
+ removeAuthorization(url: string): Promise<AuthUrls>;
76
+ private updateIconAuth;
77
+ private updateIconMeta;
78
+ private updateIconSign;
79
+ updateAuthorizedAccounts(authorizedAccountsDiff: AuthorizedAccountsDiff): Promise<void>;
80
+ authorizeUrl(url: string, request: RequestAuthorizeTab): Promise<AuthResponse>;
81
+ ensureUrlAuthorized(url: string): boolean;
82
+ injectMetadata(url: string, request: MetadataDef): Promise<boolean>;
83
+ getAuthRequest(id: string): AuthRequest;
84
+ getMetaRequest(id: string): MetaRequest;
85
+ getSignRequest(id: string): SignRequest;
86
+ rpcListProviders(): Promise<ResponseRpcListProviders>;
87
+ rpcSend(request: RequestRpcSend, port: chrome.runtime.Port): Promise<JsonRpcResponse<unknown>>;
88
+ rpcStartProvider(key: string, port: chrome.runtime.Port): Promise<ProviderMeta>;
89
+ rpcSubscribe({ method, params, type }: RequestRpcSubscribe, cb: ProviderInterfaceCallback, port: chrome.runtime.Port): Promise<number | string>;
90
+ rpcSubscribeConnected(_request: null, cb: ProviderInterfaceCallback, port: chrome.runtime.Port): void;
91
+ rpcUnsubscribe(request: RequestRpcUnsubscribe, port: chrome.runtime.Port): Promise<boolean>;
92
+ saveMetadata(meta: MetadataDef): Promise<void>;
93
+ setNotification(notification: string): boolean;
94
+ sign(url: string, request: RequestSign, account: AccountJson): Promise<ResponseSigning>;
95
+ }
96
+ export {};
@@ -0,0 +1,26 @@
1
+ /// <reference types="chrome" />
2
+ import type { MessageTypes, RequestTypes, ResponseTypes } from '../types.js';
3
+ import type State from './State.js';
4
+ export default class Tabs {
5
+ #private;
6
+ constructor(state: State);
7
+ private filterForAuthorizedAccounts;
8
+ private authorize;
9
+ private accountsListAuthorized;
10
+ private accountsSubscribeAuthorized;
11
+ private accountsUnsubscribe;
12
+ private getSigningPair;
13
+ private bytesSign;
14
+ private extrinsicSign;
15
+ private metadataProvide;
16
+ private metadataList;
17
+ private rpcListProviders;
18
+ private rpcSend;
19
+ private rpcStartProvider;
20
+ private rpcSubscribe;
21
+ private rpcSubscribeConnected;
22
+ private rpcUnsubscribe;
23
+ private redirectPhishingLanding;
24
+ private redirectIfPhishing;
25
+ handle<TMessageType extends MessageTypes>(id: string, type: TMessageType, request: RequestTypes[TMessageType], url: string, port?: chrome.runtime.Port): Promise<ResponseTypes[keyof ResponseTypes]>;
26
+ }
@@ -0,0 +1 @@
1
+ export declare function withErrorLog(fn: () => unknown): void;
@@ -0,0 +1,4 @@
1
+ /// <reference types="chrome" />
2
+ import type { MessageTypes, TransportRequestMessage } from '../types.js';
3
+ export { withErrorLog } from './helpers.js';
4
+ export default function handler<TMessageType extends MessageTypes>({ id, message, request }: TransportRequestMessage<TMessageType>, port?: chrome.runtime.Port, extensionPortName?: string): void;
@@ -0,0 +1,4 @@
1
+ /// <reference types="chrome" />
2
+ import type { MessageTypesWithSubscriptions, SubscriptionMessageTypes } from '../types.js';
3
+ export declare function createSubscription<TMessageType extends MessageTypesWithSubscriptions>(id: string, port: chrome.runtime.Port): (data: SubscriptionMessageTypes[TMessageType]) => void;
4
+ export declare function unsubscribe(id: string): void;
@@ -0,0 +1 @@
1
+ export { default as handlers, withErrorLog } from './handlers/index.js';
@@ -0,0 +1,341 @@
1
+ import type { InjectedAccount, InjectedMetadataKnown, MetadataDef, ProviderList, ProviderMeta } from '@polkadot/extension-inject/types';
2
+ import type { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '@polkadot/keyring/types';
3
+ import type { JsonRpcResponse } from '@polkadot/rpc-provider/types';
4
+ import type { Registry, SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types';
5
+ import type { KeyringPairs$Json } from '@polkadot/ui-keyring/types';
6
+ import type { HexString } from '@polkadot/util/types';
7
+ import type { KeypairType } from '@polkadot/util-crypto/types';
8
+ import type { ALLOWED_PATH } from '../defaults.js';
9
+ import type { AuthResponse } from './handlers/State.js';
10
+ type KeysWithDefinedValues<T> = {
11
+ [K in keyof T]: T[K] extends undefined ? never : K;
12
+ }[keyof T];
13
+ type NoUndefinedValues<T> = {
14
+ [K in KeysWithDefinedValues<T>]: T[K];
15
+ };
16
+ type IsNull<T, K extends keyof T> = {
17
+ [K1 in Exclude<keyof T, K>]: T[K1];
18
+ } & T[K] extends null ? K : never;
19
+ type NullKeys<T> = {
20
+ [K in keyof T]: IsNull<T, K>;
21
+ }[keyof T];
22
+ export type AuthUrls = Record<string, AuthUrlInfo>;
23
+ export interface AuthUrlInfo {
24
+ count: number;
25
+ id: string;
26
+ isAllowed?: boolean;
27
+ origin: string;
28
+ url: string;
29
+ authorizedAccounts: string[];
30
+ }
31
+ export type SeedLengths = 12 | 24;
32
+ export interface AccountJson extends KeyringPair$Meta {
33
+ address: string;
34
+ }
35
+ export type AccountWithChildren = AccountJson & {
36
+ children?: AccountWithChildren[];
37
+ };
38
+ export interface AccountsContext {
39
+ accounts: AccountJson[];
40
+ hierarchy: AccountWithChildren[];
41
+ master?: AccountJson;
42
+ selectedAccounts?: AccountJson['address'][];
43
+ setSelectedAccounts?: (address: AccountJson['address'][]) => void;
44
+ }
45
+ export interface AuthorizeRequest {
46
+ id: string;
47
+ request: RequestAuthorizeTab;
48
+ url: string;
49
+ }
50
+ export interface MetadataRequest {
51
+ id: string;
52
+ request: MetadataDef;
53
+ url: string;
54
+ }
55
+ export interface SigningRequest {
56
+ account: AccountJson;
57
+ id: string;
58
+ request: RequestSign;
59
+ url: string;
60
+ }
61
+ export type ConnectedTabsUrlResponse = string[];
62
+ export interface RequestSignatures {
63
+ 'pri(accounts.create.external)': [RequestAccountCreateExternal, boolean];
64
+ 'pri(accounts.create.hardware)': [RequestAccountCreateHardware, boolean];
65
+ 'pri(accounts.create.suri)': [RequestAccountCreateSuri, boolean];
66
+ 'pri(accounts.edit)': [RequestAccountEdit, boolean];
67
+ 'pri(accounts.export)': [RequestAccountExport, ResponseAccountExport];
68
+ 'pri(accounts.batchExport)': [RequestAccountBatchExport, ResponseAccountsExport];
69
+ 'pri(accounts.forget)': [RequestAccountForget, boolean];
70
+ 'pri(accounts.list)': [RequestAccountList, InjectedAccount[]];
71
+ 'pri(accounts.show)': [RequestAccountShow, boolean];
72
+ 'pri(accounts.tie)': [RequestAccountTie, boolean];
73
+ 'pri(accounts.subscribe)': [RequestAccountSubscribe, boolean, AccountJson[]];
74
+ 'pri(accounts.validate)': [RequestAccountValidate, boolean];
75
+ 'pri(accounts.changePassword)': [RequestAccountChangePassword, boolean];
76
+ 'pri(authorize.approve)': [RequestAuthorizeApprove, boolean];
77
+ 'pri(authorize.list)': [null, ResponseAuthorizeList];
78
+ 'pri(authorize.requests)': [RequestAuthorizeSubscribe, boolean, AuthorizeRequest[]];
79
+ 'pri(authorize.remove)': [string, ResponseAuthorizeList];
80
+ 'pri(authorize.reject)': [string, void];
81
+ 'pri(authorize.update)': [RequestUpdateAuthorizedAccounts, void];
82
+ 'pri(activeTabsUrl.update)': [RequestActiveTabsUrlUpdate, void];
83
+ 'pri(connectedTabsUrl.get)': [null, ConnectedTabsUrlResponse];
84
+ 'pri(derivation.create)': [RequestDeriveCreate, boolean];
85
+ 'pri(derivation.validate)': [RequestDeriveValidate, ResponseDeriveValidate];
86
+ 'pri(json.restore)': [RequestJsonRestore, void];
87
+ 'pri(json.batchRestore)': [RequestBatchRestore, void];
88
+ 'pri(json.account.info)': [KeyringPair$Json, ResponseJsonGetAccountInfo];
89
+ 'pri(metadata.approve)': [RequestMetadataApprove, boolean];
90
+ 'pri(metadata.get)': [string | null, MetadataDef | null];
91
+ 'pri(metadata.reject)': [RequestMetadataReject, boolean];
92
+ 'pri(metadata.requests)': [RequestMetadataSubscribe, boolean, MetadataRequest[]];
93
+ 'pri(metadata.list)': [null, MetadataDef[]];
94
+ 'pri(ping)': [null, boolean];
95
+ 'pri(seed.create)': [RequestSeedCreate, ResponseSeedCreate];
96
+ 'pri(seed.validate)': [RequestSeedValidate, ResponseSeedValidate];
97
+ 'pri(settings.notification)': [string, boolean];
98
+ 'pri(signing.approve.password)': [RequestSigningApprovePassword, boolean];
99
+ 'pri(signing.approve.signature)': [RequestSigningApproveSignature, boolean];
100
+ 'pri(signing.cancel)': [RequestSigningCancel, boolean];
101
+ 'pri(signing.isLocked)': [RequestSigningIsLocked, ResponseSigningIsLocked];
102
+ 'pri(signing.requests)': [RequestSigningSubscribe, boolean, SigningRequest[]];
103
+ 'pri(window.open)': [AllowedPath, boolean];
104
+ 'pub(accounts.list)': [RequestAccountList, InjectedAccount[]];
105
+ 'pub(accounts.subscribe)': [RequestAccountSubscribe, string, InjectedAccount[]];
106
+ 'pub(accounts.unsubscribe)': [RequestAccountUnsubscribe, boolean];
107
+ 'pub(authorize.tab)': [RequestAuthorizeTab, Promise<AuthResponse>];
108
+ 'pub(bytes.sign)': [SignerPayloadRaw, ResponseSigning];
109
+ 'pub(extrinsic.sign)': [SignerPayloadJSON, ResponseSigning];
110
+ 'pub(metadata.list)': [null, InjectedMetadataKnown[]];
111
+ 'pub(metadata.provide)': [MetadataDef, boolean];
112
+ 'pub(phishing.redirectIfDenied)': [null, boolean];
113
+ 'pub(ping)': [null, boolean];
114
+ 'pub(rpc.listProviders)': [void, ResponseRpcListProviders];
115
+ 'pub(rpc.send)': [RequestRpcSend, JsonRpcResponse<unknown>];
116
+ 'pub(rpc.startProvider)': [string, ProviderMeta];
117
+ 'pub(rpc.subscribe)': [RequestRpcSubscribe, number, JsonRpcResponse<unknown>];
118
+ 'pub(rpc.subscribeConnected)': [null, boolean, boolean];
119
+ 'pub(rpc.unsubscribe)': [RequestRpcUnsubscribe, boolean];
120
+ }
121
+ export type MessageTypes = keyof RequestSignatures;
122
+ export type RequestTypes = {
123
+ [MessageType in keyof RequestSignatures]: RequestSignatures[MessageType][0];
124
+ };
125
+ export type MessageTypesWithNullRequest = NullKeys<RequestTypes>;
126
+ export interface TransportRequestMessage<TMessageType extends MessageTypes> {
127
+ id: string;
128
+ message: TMessageType;
129
+ origin: string;
130
+ request: RequestTypes[TMessageType];
131
+ }
132
+ export interface RequestAuthorizeTab {
133
+ origin: string;
134
+ }
135
+ export interface RequestAuthorizeApprove {
136
+ id: string;
137
+ authorizedAccounts: string[];
138
+ }
139
+ export interface RequestUpdateAuthorizedAccounts {
140
+ url: string;
141
+ authorizedAccounts: string[];
142
+ }
143
+ export type RequestAuthorizeSubscribe = null;
144
+ export interface RequestMetadataApprove {
145
+ id: string;
146
+ }
147
+ export interface RequestMetadataReject {
148
+ id: string;
149
+ }
150
+ export type RequestMetadataSubscribe = null;
151
+ export interface RequestAccountCreateExternal {
152
+ address: string;
153
+ genesisHash?: HexString | null;
154
+ name: string;
155
+ }
156
+ export interface RequestAccountCreateSuri {
157
+ name: string;
158
+ genesisHash?: HexString | null;
159
+ password: string;
160
+ suri: string;
161
+ type?: KeypairType;
162
+ }
163
+ export interface RequestAccountCreateHardware {
164
+ accountIndex: number;
165
+ address: string;
166
+ addressOffset: number;
167
+ genesisHash: HexString;
168
+ hardwareType: string;
169
+ name: string;
170
+ }
171
+ export interface RequestAccountChangePassword {
172
+ address: string;
173
+ oldPass: string;
174
+ newPass: string;
175
+ }
176
+ export interface RequestAccountEdit {
177
+ address: string;
178
+ genesisHash?: HexString | null;
179
+ name: string;
180
+ }
181
+ export interface RequestAccountForget {
182
+ address: string;
183
+ }
184
+ export interface RequestAccountShow {
185
+ address: string;
186
+ isShowing: boolean;
187
+ }
188
+ export interface RequestAccountTie {
189
+ address: string;
190
+ genesisHash: HexString | null;
191
+ }
192
+ export interface RequestAccountValidate {
193
+ address: string;
194
+ password: string;
195
+ }
196
+ export interface RequestDeriveCreate {
197
+ name: string;
198
+ genesisHash?: HexString | null;
199
+ suri: string;
200
+ parentAddress: string;
201
+ parentPassword: string;
202
+ password: string;
203
+ }
204
+ export interface RequestDeriveValidate {
205
+ suri: string;
206
+ parentAddress: string;
207
+ parentPassword: string;
208
+ }
209
+ export interface RequestAccountExport {
210
+ address: string;
211
+ password: string;
212
+ }
213
+ export interface RequestAccountBatchExport {
214
+ addresses: string[];
215
+ password: string;
216
+ }
217
+ export interface RequestAccountList {
218
+ anyType?: boolean;
219
+ }
220
+ export type RequestAccountSubscribe = null;
221
+ export interface RequestActiveTabsUrlUpdate {
222
+ urls: string[];
223
+ }
224
+ export interface RequestAccountUnsubscribe {
225
+ id: string;
226
+ }
227
+ export interface RequestRpcSend {
228
+ method: string;
229
+ params: unknown[];
230
+ }
231
+ export interface RequestRpcSubscribe extends RequestRpcSend {
232
+ type: string;
233
+ }
234
+ export interface RequestRpcUnsubscribe {
235
+ method: string;
236
+ subscriptionId: number | string;
237
+ type: string;
238
+ }
239
+ export interface RequestSigningApprovePassword {
240
+ id: string;
241
+ password?: string;
242
+ savePass: boolean;
243
+ }
244
+ export interface RequestSigningApproveSignature {
245
+ id: string;
246
+ signature: HexString;
247
+ signedTransaction?: HexString;
248
+ }
249
+ export interface RequestSigningCancel {
250
+ id: string;
251
+ }
252
+ export interface RequestSigningIsLocked {
253
+ id: string;
254
+ }
255
+ export interface ResponseSigningIsLocked {
256
+ isLocked: boolean;
257
+ remainingTime: number;
258
+ }
259
+ export type RequestSigningSubscribe = null;
260
+ export interface RequestSeedCreate {
261
+ length?: SeedLengths;
262
+ seed?: string;
263
+ type?: KeypairType;
264
+ }
265
+ export interface RequestSeedValidate {
266
+ suri: string;
267
+ type?: KeypairType;
268
+ }
269
+ export type ResponseTypes = {
270
+ [MessageType in keyof RequestSignatures]: RequestSignatures[MessageType][1];
271
+ };
272
+ export type ResponseType<TMessageType extends keyof RequestSignatures> = RequestSignatures[TMessageType][1];
273
+ interface TransportResponseMessageSub<TMessageType extends MessageTypesWithSubscriptions> {
274
+ error?: string;
275
+ id: string;
276
+ response?: ResponseTypes[TMessageType];
277
+ subscription?: SubscriptionMessageTypes[TMessageType];
278
+ }
279
+ interface TransportResponseMessageNoSub<TMessageType extends MessageTypesWithNoSubscriptions> {
280
+ error?: string;
281
+ id: string;
282
+ response?: ResponseTypes[TMessageType];
283
+ }
284
+ export type TransportResponseMessage<TMessageType extends MessageTypes> = TMessageType extends MessageTypesWithNoSubscriptions ? TransportResponseMessageNoSub<TMessageType> : TMessageType extends MessageTypesWithSubscriptions ? TransportResponseMessageSub<TMessageType> : never;
285
+ export interface ResponseSigning {
286
+ id: string;
287
+ signature: HexString;
288
+ signedTransaction?: HexString;
289
+ }
290
+ export interface ResponseDeriveValidate {
291
+ address: string;
292
+ suri: string;
293
+ }
294
+ export interface ResponseSeedCreate {
295
+ address: string;
296
+ seed: string;
297
+ }
298
+ export interface ResponseSeedValidate {
299
+ address: string;
300
+ suri: string;
301
+ }
302
+ export interface ResponseAccountExport {
303
+ exportedJson: KeyringPair$Json;
304
+ }
305
+ export interface ResponseAccountsExport {
306
+ exportedJson: KeyringPairs$Json;
307
+ }
308
+ export type ResponseRpcListProviders = ProviderList;
309
+ export type SubscriptionMessageTypes = NoUndefinedValues<{
310
+ [MessageType in keyof RequestSignatures]: RequestSignatures[MessageType][2];
311
+ }>;
312
+ export type MessageTypesWithSubscriptions = keyof SubscriptionMessageTypes;
313
+ export type MessageTypesWithNoSubscriptions = Exclude<MessageTypes, keyof SubscriptionMessageTypes>;
314
+ export interface RequestSign {
315
+ readonly payload: SignerPayloadJSON | SignerPayloadRaw;
316
+ sign(registry: Registry, pair: KeyringPair): {
317
+ signature: HexString;
318
+ };
319
+ }
320
+ export interface RequestJsonRestore {
321
+ file: KeyringPair$Json;
322
+ password: string;
323
+ }
324
+ export interface RequestBatchRestore {
325
+ file: KeyringPairs$Json;
326
+ password: string;
327
+ }
328
+ export interface ResponseJsonRestore {
329
+ error: string | null;
330
+ }
331
+ export type AllowedPath = typeof ALLOWED_PATH[number];
332
+ export interface ResponseJsonGetAccountInfo {
333
+ address: string;
334
+ name: string;
335
+ genesisHash: HexString;
336
+ type: KeypairType;
337
+ }
338
+ export interface ResponseAuthorizeList {
339
+ list: AuthUrls;
340
+ }
341
+ export {};
@@ -0,0 +1 @@
1
+ export { packageInfo } from './packageInfo.js';
@@ -0,0 +1,9 @@
1
+ export declare const EXTENSION_PREFIX: string;
2
+ export declare const PORT_CONTENT: string;
3
+ export declare const PORT_EXTENSION: string;
4
+ export declare const MESSAGE_ORIGIN_PAGE: string;
5
+ export declare const MESSAGE_ORIGIN_CONTENT: string;
6
+ export declare const ALLOWED_PATH: readonly ["/", "/account/import-ledger", "/account/restore-json"];
7
+ export declare const PASSWORD_EXPIRY_MIN = 15;
8
+ export declare const PASSWORD_EXPIRY_MS: number;
9
+ export declare const PHISHING_PAGE_REDIRECT = "/phishing-page-detected";
package/cjs/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './bundle.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const packageInfo: {
2
+ name: string;
3
+ path: string;
4
+ type: string;
5
+ version: string;
6
+ };
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.packageInfo = void 0;
4
- exports.packageInfo = { name: '@polkadot/extension-base', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '0.53.1' };
4
+ exports.packageInfo = { name: '@polkadot/extension-base', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '0.55.1' };
@@ -0,0 +1,7 @@
1
+ import type { InjectedAccount, InjectedAccounts, Unsubcall } from '@polkadot/extension-inject/types';
2
+ import type { SendRequest } from './types.js';
3
+ export default class Accounts implements InjectedAccounts {
4
+ constructor(_sendRequest: SendRequest);
5
+ get(anyType?: boolean): Promise<InjectedAccount[]>;
6
+ subscribe(cb: (accounts: InjectedAccount[]) => unknown): Unsubcall;
7
+ }
@@ -0,0 +1,13 @@
1
+ import type { Injected } from '@polkadot/extension-inject/types';
2
+ import type { SendRequest } from './types.js';
3
+ import Accounts from './Accounts.js';
4
+ import Metadata from './Metadata.js';
5
+ import PostMessageProvider from './PostMessageProvider.js';
6
+ import Signer from './Signer.js';
7
+ export default class implements Injected {
8
+ readonly accounts: Accounts;
9
+ readonly metadata: Metadata;
10
+ readonly provider: PostMessageProvider;
11
+ readonly signer: Signer;
12
+ constructor(sendRequest: SendRequest);
13
+ }
@@ -0,0 +1,7 @@
1
+ import type { InjectedMetadata, InjectedMetadataKnown, MetadataDef } from '@polkadot/extension-inject/types';
2
+ import type { SendRequest } from './types.js';
3
+ export default class Metadata implements InjectedMetadata {
4
+ constructor(_sendRequest: SendRequest);
5
+ get(): Promise<InjectedMetadataKnown[]>;
6
+ provide(definition: MetadataDef): Promise<boolean>;
7
+ }