@pezkuwi/extension-base 0.62.8 → 0.62.10

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.
Files changed (99) hide show
  1. package/package.json +2 -2
  2. package/src/background/RequestBytesSign.ts +0 -28
  3. package/src/background/RequestExtrinsicSign.ts +0 -22
  4. package/src/background/handlers/Extension.spec.ts +0 -478
  5. package/src/background/handlers/Extension.ts +0 -690
  6. package/src/background/handlers/State.ts +0 -664
  7. package/src/background/handlers/Tabs.ts +0 -289
  8. package/src/background/handlers/helpers.ts +0 -14
  9. package/src/background/handlers/index.ts +0 -60
  10. package/src/background/handlers/subscriptions.ts +0 -32
  11. package/src/background/index.ts +0 -4
  12. package/src/background/types.ts +0 -432
  13. package/src/bundle.ts +0 -4
  14. package/src/defaults.ts +0 -26
  15. package/src/index.ts +0 -7
  16. package/src/packageDetect.ts +0 -14
  17. package/src/packageInfo.ts +0 -6
  18. package/src/page/Accounts.ts +0 -33
  19. package/src/page/Injected.ts +0 -33
  20. package/src/page/Metadata.ts +0 -22
  21. package/src/page/PostMessageProvider.ts +0 -182
  22. package/src/page/Signer.ts +0 -45
  23. package/src/page/index.ts +0 -89
  24. package/src/page/types.ts +0 -10
  25. package/src/stores/Accounts.ts +0 -28
  26. package/src/stores/Base.ts +0 -93
  27. package/src/stores/Metadata.ts +0 -17
  28. package/src/stores/index.ts +0 -5
  29. package/src/types.ts +0 -12
  30. package/src/utils/canDerive.ts +0 -8
  31. package/src/utils/getId.ts +0 -10
  32. package/src/utils/index.ts +0 -4
  33. package/src/utils/portUtils.ts +0 -65
  34. package/tsconfig.build.json +0 -16
  35. package/tsconfig.build.tsbuildinfo +0 -1
  36. package/tsconfig.spec.json +0 -18
  37. package/tsconfig.spec.tsbuildinfo +0 -1
  38. /package/{build/background → background}/RequestBytesSign.d.ts +0 -0
  39. /package/{build/background → background}/RequestBytesSign.js +0 -0
  40. /package/{build/background → background}/RequestExtrinsicSign.d.ts +0 -0
  41. /package/{build/background → background}/RequestExtrinsicSign.js +0 -0
  42. /package/{build/background → background}/handlers/Extension.d.ts +0 -0
  43. /package/{build/background → background}/handlers/Extension.js +0 -0
  44. /package/{build/background → background}/handlers/State.d.ts +0 -0
  45. /package/{build/background → background}/handlers/State.js +0 -0
  46. /package/{build/background → background}/handlers/Tabs.d.ts +0 -0
  47. /package/{build/background → background}/handlers/Tabs.js +0 -0
  48. /package/{build/background → background}/handlers/helpers.d.ts +0 -0
  49. /package/{build/background → background}/handlers/helpers.js +0 -0
  50. /package/{build/background → background}/handlers/index.d.ts +0 -0
  51. /package/{build/background → background}/handlers/index.js +0 -0
  52. /package/{build/background → background}/handlers/subscriptions.d.ts +0 -0
  53. /package/{build/background → background}/handlers/subscriptions.js +0 -0
  54. /package/{build/background → background}/index.d.ts +0 -0
  55. /package/{build/background → background}/index.js +0 -0
  56. /package/{build/background → background}/types.d.ts +0 -0
  57. /package/{build/background → background}/types.js +0 -0
  58. /package/{build/bundle.d.ts → bundle.d.ts} +0 -0
  59. /package/{build/bundle.js → bundle.js} +0 -0
  60. /package/{build/defaults.d.ts → defaults.d.ts} +0 -0
  61. /package/{build/defaults.js → defaults.js} +0 -0
  62. /package/{build/index.d.ts → index.d.ts} +0 -0
  63. /package/{build/index.js → index.js} +0 -0
  64. /package/{build/packageDetect.d.ts → packageDetect.d.ts} +0 -0
  65. /package/{build/packageDetect.js → packageDetect.js} +0 -0
  66. /package/{build/packageInfo.d.ts → packageInfo.d.ts} +0 -0
  67. /package/{build/packageInfo.js → packageInfo.js} +0 -0
  68. /package/{build/page → page}/Accounts.d.ts +0 -0
  69. /package/{build/page → page}/Accounts.js +0 -0
  70. /package/{build/page → page}/Injected.d.ts +0 -0
  71. /package/{build/page → page}/Injected.js +0 -0
  72. /package/{build/page → page}/Metadata.d.ts +0 -0
  73. /package/{build/page → page}/Metadata.js +0 -0
  74. /package/{build/page → page}/PostMessageProvider.d.ts +0 -0
  75. /package/{build/page → page}/PostMessageProvider.js +0 -0
  76. /package/{build/page → page}/Signer.d.ts +0 -0
  77. /package/{build/page → page}/Signer.js +0 -0
  78. /package/{build/page → page}/index.d.ts +0 -0
  79. /package/{build/page → page}/index.js +0 -0
  80. /package/{build/page → page}/types.d.ts +0 -0
  81. /package/{build/page → page}/types.js +0 -0
  82. /package/{build/stores → stores}/Accounts.d.ts +0 -0
  83. /package/{build/stores → stores}/Accounts.js +0 -0
  84. /package/{build/stores → stores}/Base.d.ts +0 -0
  85. /package/{build/stores → stores}/Base.js +0 -0
  86. /package/{build/stores → stores}/Metadata.d.ts +0 -0
  87. /package/{build/stores → stores}/Metadata.js +0 -0
  88. /package/{build/stores → stores}/index.d.ts +0 -0
  89. /package/{build/stores → stores}/index.js +0 -0
  90. /package/{build/types.d.ts → types.d.ts} +0 -0
  91. /package/{build/types.js → types.js} +0 -0
  92. /package/{build/utils → utils}/canDerive.d.ts +0 -0
  93. /package/{build/utils → utils}/canDerive.js +0 -0
  94. /package/{build/utils → utils}/getId.d.ts +0 -0
  95. /package/{build/utils → utils}/getId.js +0 -0
  96. /package/{build/utils → utils}/index.d.ts +0 -0
  97. /package/{build/utils → utils}/index.js +0 -0
  98. /package/{build/utils → utils}/portUtils.d.ts +0 -0
  99. /package/{build/utils → utils}/portUtils.js +0 -0
@@ -1,432 +0,0 @@
1
- // Copyright 2019-2025 @pezkuwi/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- /* eslint-disable no-use-before-define */
5
-
6
- import type { InjectedAccount, InjectedMetadataKnown, MetadataDef, ProviderList, ProviderMeta } from '@pezkuwi/extension-inject/types';
7
- import type { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '@pezkuwi/keyring/types';
8
- import type { JsonRpcResponse } from '@pezkuwi/rpc-provider/types';
9
- import type { Registry, SignerPayloadJSON, SignerPayloadRaw } from '@pezkuwi/types/types';
10
- import type { KeyringPairs$Json } from '@pezkuwi/ui-keyring/types';
11
- import type { HexString } from '@pezkuwi/util/types';
12
- import type { KeypairType } from '@pezkuwi/util-crypto/types';
13
- import type { ALLOWED_PATH } from '../defaults.js';
14
- import type { AuthResponse } from './handlers/State.js';
15
-
16
- type KeysWithDefinedValues<T> = {
17
- [K in keyof T]: T[K] extends undefined ? never : K
18
- }[keyof T];
19
-
20
- type NoUndefinedValues<T> = {
21
- [K in KeysWithDefinedValues<T>]: T[K]
22
- };
23
-
24
- type IsNull<T, K extends keyof T> = { [K1 in Exclude<keyof T, K>]: T[K1] } & T[K] extends null ? K : never;
25
-
26
- type NullKeys<T> = { [K in keyof T]: IsNull<T, K> }[keyof T];
27
-
28
- export type AuthUrls = Record<string, AuthUrlInfo>;
29
-
30
- export interface AuthUrlInfo {
31
- count: number;
32
- id: string;
33
- // this is from pre-0.44.1
34
- isAllowed?: boolean;
35
- origin: string;
36
- url: string;
37
- authorizedAccounts: string[];
38
- }
39
-
40
- export type SeedLengths = 12 | 24;
41
-
42
- export interface AccountJson extends KeyringPair$Meta {
43
- address: string;
44
- }
45
-
46
- export type AccountWithChildren = AccountJson & {
47
- children?: AccountWithChildren[];
48
- }
49
-
50
- export interface AccountsContext {
51
- accounts: AccountJson[];
52
- hierarchy: AccountWithChildren[];
53
- master?: AccountJson;
54
- selectedAccounts?: AccountJson['address'][];
55
- setSelectedAccounts?: (address: AccountJson['address'][]) => void;
56
- }
57
-
58
- export interface AuthorizeRequest {
59
- id: string;
60
- request: RequestAuthorizeTab;
61
- url: string;
62
- }
63
-
64
- export interface MetadataRequest {
65
- id: string;
66
- request: MetadataDef;
67
- url: string;
68
- }
69
-
70
- export interface SigningRequest {
71
- account: AccountJson;
72
- id: string;
73
- request: RequestSign;
74
- url: string;
75
- }
76
-
77
- export type ConnectedTabsUrlResponse = string[]
78
-
79
- // [MessageType]: [RequestType, ResponseType, SubscriptionMessageType?]
80
- export interface RequestSignatures {
81
- // private/internal requests, i.e. from a popup
82
- 'pri(accounts.create.external)': [RequestAccountCreateExternal, boolean];
83
- 'pri(accounts.create.hardware)': [RequestAccountCreateHardware, boolean];
84
- 'pri(accounts.create.suri)': [RequestAccountCreateSuri, boolean];
85
- 'pri(accounts.edit)': [RequestAccountEdit, boolean];
86
- 'pri(accounts.export)': [RequestAccountExport, ResponseAccountExport];
87
- 'pri(accounts.batchExport)': [RequestAccountBatchExport, ResponseAccountsExport]
88
- 'pri(accounts.forget)': [RequestAccountForget, boolean];
89
- 'pri(accounts.list)': [RequestAccountList, InjectedAccount[]];
90
- 'pri(accounts.show)': [RequestAccountShow, boolean];
91
- 'pri(accounts.tie)': [RequestAccountTie, boolean];
92
- 'pri(accounts.subscribe)': [RequestAccountSubscribe, boolean, AccountJson[]];
93
- 'pri(accounts.validate)': [RequestAccountValidate, boolean];
94
- 'pri(accounts.changePassword)': [RequestAccountChangePassword, boolean];
95
- 'pri(authorize.approve)': [RequestAuthorizeApprove, boolean];
96
- 'pri(authorize.list)': [null, ResponseAuthorizeList];
97
- 'pri(authorize.requests)': [RequestAuthorizeSubscribe, boolean, AuthorizeRequest[]];
98
- 'pri(authorize.remove)': [string, ResponseAuthorizeList];
99
- 'pri(authorize.reject)': [string, void];
100
- 'pri(authorize.cancel)': [string, void];
101
- 'pri(authorize.update)': [RequestUpdateAuthorizedAccounts, void];
102
- 'pri(activeTabsUrl.update)': [RequestActiveTabsUrlUpdate, void];
103
- 'pri(connectedTabsUrl.get)': [null, ConnectedTabsUrlResponse];
104
- 'pri(derivation.create)': [RequestDeriveCreate, boolean];
105
- 'pri(derivation.validate)': [RequestDeriveValidate, ResponseDeriveValidate];
106
- 'pri(json.restore)': [RequestJsonRestore, void];
107
- 'pri(json.batchRestore)': [RequestBatchRestore, void];
108
- 'pri(json.account.info)': [KeyringPair$Json, ResponseJsonGetAccountInfo];
109
- 'pri(metadata.approve)': [RequestMetadataApprove, boolean];
110
- 'pri(metadata.get)': [string | null, MetadataDef | null];
111
- 'pri(metadata.reject)': [RequestMetadataReject, boolean];
112
- 'pri(metadata.requests)': [RequestMetadataSubscribe, boolean, MetadataRequest[]];
113
- 'pri(metadata.list)': [null, MetadataDef[]];
114
- 'pri(ping)': [null, boolean];
115
- 'pri(seed.create)': [RequestSeedCreate, ResponseSeedCreate];
116
- 'pri(seed.validate)': [RequestSeedValidate, ResponseSeedValidate];
117
- 'pri(settings.notification)': [string, boolean];
118
- 'pri(signing.approve.password)': [RequestSigningApprovePassword, boolean];
119
- 'pri(signing.approve.signature)': [RequestSigningApproveSignature, boolean];
120
- 'pri(signing.cancel)': [RequestSigningCancel, boolean];
121
- 'pri(signing.isLocked)': [RequestSigningIsLocked, ResponseSigningIsLocked];
122
- 'pri(signing.requests)': [RequestSigningSubscribe, boolean, SigningRequest[]];
123
- 'pri(window.open)': [AllowedPath, boolean];
124
- // public/external requests, i.e. from a page
125
- 'pub(accounts.list)': [RequestAccountList, InjectedAccount[]];
126
- 'pub(accounts.subscribe)': [RequestAccountSubscribe, string, InjectedAccount[]];
127
- 'pub(accounts.unsubscribe)': [RequestAccountUnsubscribe, boolean];
128
- 'pub(authorize.tab)': [RequestAuthorizeTab, Promise<AuthResponse>];
129
- 'pub(bytes.sign)': [SignerPayloadRaw, ResponseSigning];
130
- 'pub(extrinsic.sign)': [SignerPayloadJSON, ResponseSigning];
131
- 'pub(metadata.list)': [null, InjectedMetadataKnown[]];
132
- 'pub(metadata.provide)': [MetadataDef, boolean];
133
- 'pub(phishing.redirectIfDenied)': [null, boolean];
134
- 'pub(ping)': [null, boolean];
135
- 'pub(rpc.listProviders)': [void, ResponseRpcListProviders];
136
- 'pub(rpc.send)': [RequestRpcSend, JsonRpcResponse<unknown>];
137
- 'pub(rpc.startProvider)': [string, ProviderMeta];
138
- 'pub(rpc.subscribe)': [RequestRpcSubscribe, number, JsonRpcResponse<unknown>];
139
- 'pub(rpc.subscribeConnected)': [null, boolean, boolean];
140
- 'pub(rpc.unsubscribe)': [RequestRpcUnsubscribe, boolean];
141
- }
142
-
143
- export type MessageTypes = keyof RequestSignatures;
144
-
145
- // Requests
146
-
147
- export type RequestTypes = {
148
- [MessageType in keyof RequestSignatures]: RequestSignatures[MessageType][0]
149
- };
150
-
151
- export type MessageTypesWithNullRequest = NullKeys<RequestTypes>
152
-
153
- export interface TransportRequestMessage<TMessageType extends MessageTypes> {
154
- id: string;
155
- message: TMessageType;
156
- origin: string;
157
- request: RequestTypes[TMessageType];
158
- }
159
-
160
- export interface RequestAuthorizeTab {
161
- origin: string;
162
- }
163
-
164
- export interface RequestAuthorizeApprove {
165
- id: string;
166
- authorizedAccounts: string[]
167
- }
168
-
169
- export interface RequestUpdateAuthorizedAccounts {
170
- url: string;
171
- authorizedAccounts: string[]
172
- }
173
-
174
- export type RequestAuthorizeSubscribe = null;
175
-
176
- export interface RequestMetadataApprove {
177
- id: string;
178
- }
179
-
180
- export interface RequestMetadataReject {
181
- id: string;
182
- }
183
-
184
- export type RequestMetadataSubscribe = null;
185
-
186
- export interface RequestAccountCreateExternal {
187
- address: string;
188
- genesisHash?: HexString | null;
189
- name: string;
190
- }
191
-
192
- export interface RequestAccountCreateSuri {
193
- name: string;
194
- genesisHash?: HexString | null;
195
- password: string;
196
- suri: string;
197
- type?: KeypairType;
198
- }
199
-
200
- export interface RequestAccountCreateHardware {
201
- accountIndex: number;
202
- address: string;
203
- addressOffset: number;
204
- genesisHash: HexString;
205
- hardwareType: string;
206
- name: string;
207
- type: KeypairType;
208
- }
209
-
210
- export interface RequestAccountChangePassword {
211
- address: string;
212
- oldPass: string;
213
- newPass: string;
214
- }
215
-
216
- export interface RequestAccountEdit {
217
- address: string;
218
- genesisHash?: HexString | null;
219
- name: string;
220
- }
221
-
222
- export interface RequestAccountForget {
223
- address: string;
224
- }
225
-
226
- export interface RequestAccountShow {
227
- address: string;
228
- isShowing: boolean;
229
- }
230
-
231
- export interface RequestAccountTie {
232
- address: string;
233
- genesisHash: HexString | null;
234
- }
235
-
236
- export interface RequestAccountValidate {
237
- address: string;
238
- password: string;
239
- }
240
-
241
- export interface RequestDeriveCreate {
242
- name: string;
243
- genesisHash?: HexString | null;
244
- suri: string;
245
- parentAddress: string;
246
- parentPassword: string;
247
- password: string;
248
- }
249
-
250
- export interface RequestDeriveValidate {
251
- suri: string;
252
- parentAddress: string;
253
- parentPassword: string;
254
- }
255
-
256
- export interface RequestAccountExport {
257
- address: string;
258
- password: string;
259
- }
260
-
261
- export interface RequestAccountBatchExport {
262
- addresses: string[];
263
- password: string;
264
- }
265
-
266
- export interface RequestAccountList {
267
- anyType?: boolean;
268
- }
269
-
270
- export type RequestAccountSubscribe = null;
271
-
272
- export interface RequestActiveTabsUrlUpdate {
273
- urls: string[];
274
- }
275
-
276
- export interface RequestAccountUnsubscribe {
277
- id: string;
278
- }
279
-
280
- export interface RequestRpcSend {
281
- method: string;
282
- params: unknown[];
283
- }
284
-
285
- export interface RequestRpcSubscribe extends RequestRpcSend {
286
- type: string;
287
- }
288
-
289
- export interface RequestRpcUnsubscribe {
290
- method: string;
291
- subscriptionId: number | string;
292
- type: string;
293
- }
294
-
295
- export interface RequestSigningApprovePassword {
296
- id: string;
297
- password?: string;
298
- savePass: boolean;
299
- }
300
-
301
- export interface RequestSigningApproveSignature {
302
- id: string;
303
- signature: HexString;
304
- signedTransaction?: HexString;
305
- }
306
-
307
- export interface RequestSigningCancel {
308
- id: string;
309
- }
310
-
311
- export interface RequestSigningIsLocked {
312
- id: string;
313
- }
314
-
315
- export interface ResponseSigningIsLocked {
316
- isLocked: boolean;
317
- remainingTime: number;
318
- }
319
-
320
- export type RequestSigningSubscribe = null;
321
-
322
- export interface RequestSeedCreate {
323
- length?: SeedLengths;
324
- seed?: string;
325
- type?: KeypairType;
326
- }
327
-
328
- export interface RequestSeedValidate {
329
- suri: string;
330
- type?: KeypairType;
331
- }
332
-
333
- // Responses
334
-
335
- export type ResponseTypes = {
336
- [MessageType in keyof RequestSignatures]: RequestSignatures[MessageType][1]
337
- };
338
-
339
- export type ResponseType<TMessageType extends keyof RequestSignatures> = RequestSignatures[TMessageType][1];
340
-
341
- interface TransportResponseMessageSub<TMessageType extends MessageTypesWithSubscriptions> {
342
- error?: string;
343
- id: string;
344
- response?: ResponseTypes[TMessageType];
345
- subscription?: SubscriptionMessageTypes[TMessageType];
346
- }
347
-
348
- interface TransportResponseMessageNoSub<TMessageType extends MessageTypesWithNoSubscriptions> {
349
- error?: string;
350
- id: string;
351
- response?: ResponseTypes[TMessageType];
352
- }
353
-
354
- export type TransportResponseMessage<TMessageType extends MessageTypes> =
355
- TMessageType extends MessageTypesWithNoSubscriptions
356
- ? TransportResponseMessageNoSub<TMessageType>
357
- : TMessageType extends MessageTypesWithSubscriptions
358
- ? TransportResponseMessageSub<TMessageType>
359
- : never;
360
-
361
- export interface ResponseSigning {
362
- id: string;
363
- signature: HexString;
364
- signedTransaction?: HexString;
365
- }
366
-
367
- export interface ResponseDeriveValidate {
368
- address: string;
369
- suri: string;
370
- }
371
-
372
- export interface ResponseSeedCreate {
373
- address: string;
374
- seed: string;
375
- }
376
-
377
- export interface ResponseSeedValidate {
378
- address: string;
379
- suri: string;
380
- }
381
-
382
- export interface ResponseAccountExport {
383
- exportedJson: KeyringPair$Json;
384
- }
385
-
386
- export interface ResponseAccountsExport {
387
- exportedJson: KeyringPairs$Json;
388
- }
389
-
390
- export type ResponseRpcListProviders = ProviderList;
391
-
392
- // Subscriptions
393
-
394
- export type SubscriptionMessageTypes = NoUndefinedValues<{
395
- [MessageType in keyof RequestSignatures]: RequestSignatures[MessageType][2]
396
- }>;
397
-
398
- export type MessageTypesWithSubscriptions = keyof SubscriptionMessageTypes;
399
- export type MessageTypesWithNoSubscriptions = Exclude<MessageTypes, keyof SubscriptionMessageTypes>
400
-
401
- export interface RequestSign {
402
- readonly payload: SignerPayloadJSON | SignerPayloadRaw;
403
-
404
- sign (registry: Registry, pair: KeyringPair): { signature: HexString };
405
- }
406
-
407
- export interface RequestJsonRestore {
408
- file: KeyringPair$Json;
409
- password: string;
410
- }
411
-
412
- export interface RequestBatchRestore {
413
- file: KeyringPairs$Json;
414
- password: string;
415
- }
416
-
417
- export interface ResponseJsonRestore {
418
- error: string | null;
419
- }
420
-
421
- export type AllowedPath = typeof ALLOWED_PATH[number];
422
-
423
- export interface ResponseJsonGetAccountInfo {
424
- address: string;
425
- name: string;
426
- genesisHash: HexString;
427
- type: KeypairType;
428
- }
429
-
430
- export interface ResponseAuthorizeList {
431
- list: AuthUrls;
432
- }
package/src/bundle.ts DELETED
@@ -1,4 +0,0 @@
1
- // Copyright 2019-2025 @pezkuwi/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export { packageInfo } from './packageInfo.js';
package/src/defaults.ts DELETED
@@ -1,26 +0,0 @@
1
- // Copyright 2019-2025 @pezkuwi/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // this _must_ be changed for each extension
5
- export const EXTENSION_PREFIX = process.env['EXTENSION_PREFIX'] || '';
6
-
7
- if (!EXTENSION_PREFIX && !process.env['PORT_PREFIX']) {
8
- throw new Error('CRITICAL: The extension does not define an own EXTENSION_PREFIX environment variable as part of the build, this is required to ensure that messages are not shared between extensions. Failure to do so will yield messages sent to multiple extensions.');
9
- }
10
-
11
- const PORT_PREFIX = `${EXTENSION_PREFIX || 'unknown'}-${process.env['PORT_PREFIX'] || 'unknown'}`;
12
-
13
- export const PORT_CONTENT = `${PORT_PREFIX}-content`;
14
- export const PORT_EXTENSION = `${PORT_PREFIX}-extension`;
15
-
16
- export const MESSAGE_ORIGIN_PAGE = `${PORT_PREFIX}-page`;
17
- export const MESSAGE_ORIGIN_CONTENT = `${PORT_PREFIX}-content`;
18
-
19
- export const ALLOWED_PATH = ['/', '/account/import-ledger', '/account/restore-json'] as const;
20
-
21
- export const PASSWORD_EXPIRY_MIN = 15;
22
- export const PASSWORD_EXPIRY_MS = PASSWORD_EXPIRY_MIN * 60 * 1000;
23
-
24
- export const PHISHING_PAGE_REDIRECT = '/phishing-page-detected';
25
-
26
- // console.log(`Extension is sending and receiving messages on ${PORT_PREFIX}-*`);
package/src/index.ts DELETED
@@ -1,7 +0,0 @@
1
- // Copyright 2019-2025 @pezkuwi/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // Since we inject into pages, we skip this
5
- // import './detectPackage';
6
-
7
- export * from './bundle.js';
@@ -1,14 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // Do not edit, auto-generated by @pezkuwi/dev
5
- // (packageInfo imports will be kept as-is, user-editable)
6
-
7
- import { packageInfo as chainsInfo } from '@pezkuwi/extension-chains/packageInfo';
8
- import { packageInfo as dappInfo } from '@pezkuwi/extension-dapp/packageInfo';
9
- import { packageInfo as injectInfo } from '@pezkuwi/extension-inject/packageInfo';
10
- import { detectPackage } from '@pezkuwi/util';
11
-
12
- import { packageInfo } from './packageInfo.js';
13
-
14
- detectPackage(packageInfo, null, [chainsInfo, dappInfo, injectInfo]);
@@ -1,6 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // Do not edit, auto-generated by @pezkuwi/dev
5
-
6
- export const packageInfo = { name: '@pezkuwi/extension-base', path: 'auto', type: 'auto', version: '0.62.6' };
@@ -1,33 +0,0 @@
1
- // Copyright 2019-2025 @pezkuwi/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { InjectedAccount, InjectedAccounts, Unsubcall } from '@pezkuwi/extension-inject/types';
5
- import type { SendRequest } from './types.js';
6
-
7
- // External to class, this.# is not private enough (yet)
8
- let sendRequest: SendRequest;
9
-
10
- export default class Accounts implements InjectedAccounts {
11
- constructor (_sendRequest: SendRequest) {
12
- sendRequest = _sendRequest;
13
- }
14
-
15
- public get (anyType?: boolean): Promise<InjectedAccount[]> {
16
- return sendRequest('pub(accounts.list)', { anyType });
17
- }
18
-
19
- public subscribe (cb: (accounts: InjectedAccount[]) => unknown): Unsubcall {
20
- let id: string | null = null;
21
-
22
- sendRequest('pub(accounts.subscribe)', null, cb)
23
- .then((subId): void => {
24
- id = subId;
25
- })
26
- .catch(console.error);
27
-
28
- return (): void => {
29
- id && sendRequest('pub(accounts.unsubscribe)', { id })
30
- .catch(console.error);
31
- };
32
- }
33
- }
@@ -1,33 +0,0 @@
1
- // Copyright 2019-2025 @pezkuwi/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { Injected } from '@pezkuwi/extension-inject/types';
5
- import type { SendRequest } from './types.js';
6
-
7
- import Accounts from './Accounts.js';
8
- import Metadata from './Metadata.js';
9
- import PostMessageProvider from './PostMessageProvider.js';
10
- import Signer from './Signer.js';
11
-
12
- export default class implements Injected {
13
- public readonly accounts: Accounts;
14
-
15
- public readonly metadata: Metadata;
16
-
17
- public readonly provider: PostMessageProvider;
18
-
19
- public readonly signer: Signer;
20
-
21
- constructor (sendRequest: SendRequest) {
22
- this.accounts = new Accounts(sendRequest);
23
- this.metadata = new Metadata(sendRequest);
24
- this.provider = new PostMessageProvider(sendRequest);
25
- this.signer = new Signer(sendRequest);
26
-
27
- setInterval((): void => {
28
- sendRequest('pub(ping)', null).catch((): void => {
29
- console.error('Extension unavailable, ping failed');
30
- });
31
- }, 5_000 + Math.floor(Math.random() * 5_000));
32
- }
33
- }
@@ -1,22 +0,0 @@
1
- // Copyright 2019-2025 @pezkuwi/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { InjectedMetadata, InjectedMetadataKnown, MetadataDef } from '@pezkuwi/extension-inject/types';
5
- import type { SendRequest } from './types.js';
6
-
7
- // External to class, this.# is not private enough (yet)
8
- let sendRequest: SendRequest;
9
-
10
- export default class Metadata implements InjectedMetadata {
11
- constructor (_sendRequest: SendRequest) {
12
- sendRequest = _sendRequest;
13
- }
14
-
15
- public get (): Promise<InjectedMetadataKnown[]> {
16
- return sendRequest('pub(metadata.list)');
17
- }
18
-
19
- public provide (definition: MetadataDef): Promise<boolean> {
20
- return sendRequest('pub(metadata.provide)', definition);
21
- }
22
- }