@subwallet/extension-base 0.3.6-0 → 0.3.6-3

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 (164) hide show
  1. package/{build/background → background}/KoniTypes.d.ts +0 -0
  2. package/{build/background → background}/KoniTypes.js +0 -0
  3. package/{build/background → background}/RequestBytesSign.d.ts +0 -0
  4. package/{build/background → background}/RequestBytesSign.js +0 -0
  5. package/{build/background → background}/RequestExtrinsicSign.d.ts +0 -0
  6. package/{build/background → background}/RequestExtrinsicSign.js +0 -0
  7. package/{build/background → background}/handlers/Extension.d.ts +1 -1
  8. package/{build/background → background}/handlers/Extension.js +2 -2
  9. package/{build/background → background}/handlers/State.d.ts +0 -0
  10. package/{build/background → background}/handlers/State.js +0 -0
  11. package/{build/background → background}/handlers/Tabs.d.ts +0 -0
  12. package/{build/background → background}/handlers/Tabs.js +0 -0
  13. package/{build/background → background}/handlers/helpers.d.ts +0 -0
  14. package/{build/background → background}/handlers/helpers.js +0 -0
  15. package/{build/background → background}/handlers/index.d.ts +0 -0
  16. package/{build/background → background}/handlers/index.js +0 -0
  17. package/{build/background → background}/handlers/subscriptions.d.ts +0 -0
  18. package/{build/background → background}/handlers/subscriptions.js +0 -0
  19. package/{build/background → background}/types.d.ts +0 -0
  20. package/{build/background → background}/types.js +0 -0
  21. package/{build/bundle.d.ts → bundle.d.ts} +0 -0
  22. package/{build/bundle.js → bundle.js} +0 -0
  23. package/{build-cjs → cjs}/background/KoniTypes.js +0 -0
  24. package/{build-cjs → cjs}/background/RequestBytesSign.js +0 -0
  25. package/{build-cjs → cjs}/background/RequestExtrinsicSign.js +0 -0
  26. package/{build/cjs → cjs}/background/handlers/Extension.js +4 -4
  27. package/{build-cjs → cjs}/background/handlers/State.js +0 -0
  28. package/{build-cjs → cjs}/background/handlers/Tabs.js +0 -0
  29. package/{build-cjs → cjs}/background/handlers/helpers.js +0 -0
  30. package/{build-cjs → cjs}/background/handlers/index.js +0 -0
  31. package/{build-cjs → cjs}/background/handlers/subscriptions.js +0 -0
  32. package/{build-cjs → cjs}/background/types.js +0 -0
  33. package/{build-cjs → cjs}/bundle.js +0 -0
  34. package/{build-cjs → cjs}/defaults.js +0 -0
  35. package/{build-cjs → cjs}/detectOther.js +0 -0
  36. package/{build-cjs → cjs}/detectPackage.js +0 -0
  37. package/{build-cjs → cjs}/index.js +0 -0
  38. package/{build/cjs → cjs}/package.json +0 -0
  39. package/{build-cjs → cjs}/packageInfo.js +1 -1
  40. package/{build-cjs → cjs}/page/Accounts.js +0 -0
  41. package/{build-cjs → cjs}/page/Injected.js +0 -0
  42. package/{build-cjs → cjs}/page/Metadata.js +0 -0
  43. package/{build-cjs → cjs}/page/PostMessageProvider.js +0 -0
  44. package/{build-cjs → cjs}/page/Signer.js +0 -0
  45. package/{build-cjs → cjs}/page/index.js +0 -0
  46. package/{build-cjs → cjs}/page/types.js +0 -0
  47. package/{build-cjs → cjs}/stores/Accounts.js +0 -0
  48. package/{build-cjs → cjs}/stores/Base.js +0 -0
  49. package/{build-cjs → cjs}/stores/Metadata.js +0 -0
  50. package/{build-cjs → cjs}/stores/index.js +0 -0
  51. package/{build-cjs → cjs}/types.js +0 -0
  52. package/{build-cjs → cjs}/utils/canDerive.js +0 -0
  53. package/{build-cjs → cjs}/utils/getId.js +0 -0
  54. package/{build-cjs → cjs}/utils/index.js +0 -0
  55. package/{build/defaults.d.ts → defaults.d.ts} +0 -0
  56. package/{build/defaults.js → defaults.js} +0 -0
  57. package/{build/detectOther.d.ts → detectOther.d.ts} +0 -0
  58. package/{build/detectOther.js → detectOther.js} +0 -0
  59. package/{build/detectPackage.d.ts → detectPackage.d.ts} +0 -0
  60. package/{build/detectPackage.js → detectPackage.js} +0 -0
  61. package/{build/index.d.ts → index.d.ts} +0 -0
  62. package/{build/index.js → index.js} +0 -0
  63. package/package.json +174 -10
  64. package/{build/packageInfo.d.ts → packageInfo.d.ts} +0 -0
  65. package/{build/packageInfo.js → packageInfo.js} +1 -1
  66. package/{build/page → page}/Accounts.d.ts +0 -0
  67. package/{build/page → page}/Accounts.js +0 -0
  68. package/{build/page → page}/Injected.d.ts +0 -0
  69. package/{build/page → page}/Injected.js +0 -0
  70. package/{build/page → page}/Metadata.d.ts +0 -0
  71. package/{build/page → page}/Metadata.js +0 -0
  72. package/{build/page → page}/PostMessageProvider.d.ts +0 -0
  73. package/{build/page → page}/PostMessageProvider.js +0 -0
  74. package/{build/page → page}/Signer.d.ts +0 -0
  75. package/{build/page → page}/Signer.js +0 -0
  76. package/{build/page → page}/index.d.ts +1 -1
  77. package/{build/page → page}/index.js +0 -0
  78. package/{build/page → page}/types.d.ts +0 -0
  79. package/{build/page → page}/types.js +0 -0
  80. package/{build/stores → stores}/Accounts.d.ts +0 -0
  81. package/{build/stores → stores}/Accounts.js +0 -0
  82. package/{build/stores → stores}/Base.d.ts +0 -0
  83. package/{build/stores → stores}/Base.js +0 -0
  84. package/{build/stores → stores}/Metadata.d.ts +0 -0
  85. package/{build/stores → stores}/Metadata.js +0 -0
  86. package/{build/stores → stores}/index.d.ts +0 -0
  87. package/{build/stores → stores}/index.js +0 -0
  88. package/{build/types.d.ts → types.d.ts} +0 -0
  89. package/{build/types.js → types.js} +0 -0
  90. package/{build/utils → utils}/canDerive.d.ts +0 -0
  91. package/{build/utils → utils}/canDerive.js +0 -0
  92. package/{build/utils → utils}/getId.d.ts +0 -0
  93. package/{build/utils → utils}/getId.js +0 -0
  94. package/{build/utils → utils}/index.d.ts +0 -0
  95. package/{build/utils → utils}/index.js +0 -0
  96. package/build/LICENSE +0 -201
  97. package/build/README.md +0 -10
  98. package/build/cjs/background/KoniTypes.js +0 -69
  99. package/build/cjs/background/RequestBytesSign.js +0 -27
  100. package/build/cjs/background/RequestExtrinsicSign.js +0 -23
  101. package/build/cjs/background/handlers/State.js +0 -472
  102. package/build/cjs/background/handlers/Tabs.js +0 -273
  103. package/build/cjs/background/handlers/helpers.js +0 -20
  104. package/build/cjs/background/handlers/index.js +0 -60
  105. package/build/cjs/background/handlers/subscriptions.js +0 -32
  106. package/build/cjs/background/types.js +0 -1
  107. package/build/cjs/bundle.js +0 -13
  108. package/build/cjs/defaults.js +0 -26
  109. package/build/cjs/detectOther.js +0 -17
  110. package/build/cjs/detectPackage.js +0 -14
  111. package/build/cjs/index.js +0 -18
  112. package/build/cjs/packageInfo.js +0 -16
  113. package/build/cjs/page/Accounts.js +0 -31
  114. package/build/cjs/page/Injected.js +0 -30
  115. package/build/cjs/page/Metadata.js +0 -27
  116. package/build/cjs/page/PostMessageProvider.js +0 -184
  117. package/build/cjs/page/Signer.js +0 -44
  118. package/build/cjs/page/index.js +0 -76
  119. package/build/cjs/page/types.js +0 -1
  120. package/build/cjs/stores/Accounts.js +0 -33
  121. package/build/cjs/stores/Base.js +0 -84
  122. package/build/cjs/stores/Metadata.js +0 -23
  123. package/build/cjs/stores/index.js +0 -23
  124. package/build/cjs/types.js +0 -1
  125. package/build/cjs/utils/canDerive.js +0 -12
  126. package/build/cjs/utils/getId.js +0 -16
  127. package/build/cjs/utils/index.js +0 -13
  128. package/build/package.json +0 -210
  129. package/build-cjs/background/handlers/Extension.js +0 -764
  130. package/src/background/KoniTypes.ts +0 -537
  131. package/src/background/RequestBytesSign.ts +0 -30
  132. package/src/background/RequestExtrinsicSign.ts +0 -23
  133. package/src/background/handlers/Extension.spec.ts +0 -456
  134. package/src/background/handlers/Extension.ts +0 -627
  135. package/src/background/handlers/State.ts +0 -513
  136. package/src/background/handlers/Tabs.ts +0 -223
  137. package/src/background/handlers/helpers.ts +0 -14
  138. package/src/background/handlers/index.ts +0 -49
  139. package/src/background/handlers/subscriptions.ts +0 -30
  140. package/src/background/types.ts +0 -437
  141. package/src/bundle.ts +0 -4
  142. package/src/defaults.ts +0 -24
  143. package/src/detectOther.ts +0 -8
  144. package/src/detectPackage.ts +0 -11
  145. package/src/index.ts +0 -7
  146. package/src/packageInfo.ts +0 -6
  147. package/src/page/Accounts.ts +0 -27
  148. package/src/page/Injected.ts +0 -27
  149. package/src/page/Metadata.ts +0 -22
  150. package/src/page/PostMessageProvider.ts +0 -178
  151. package/src/page/Signer.ts +0 -45
  152. package/src/page/index.ts +0 -87
  153. package/src/page/types.ts +0 -10
  154. package/src/stores/Accounts.ts +0 -24
  155. package/src/stores/Base.ts +0 -81
  156. package/src/stores/Metadata.ts +0 -13
  157. package/src/stores/index.ts +0 -5
  158. package/src/types.ts +0 -12
  159. package/src/utils/canDerive.ts +0 -8
  160. package/src/utils/getId.ts +0 -10
  161. package/src/utils/index.ts +0 -4
  162. package/tsconfig.build.json +0 -18
  163. package/tsconfig.build.tsbuildinfo +0 -1
  164. package/tsconfig.json +0 -14
@@ -1,537 +0,0 @@
1
- // Copyright 2019-2022 @subwallet/extension-koni authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { AuthUrls, Resolver } from '@subwallet/extension-base/background/handlers/State';
5
- import { AccountJson, AuthorizeRequest, RequestAccountList, RequestAccountSubscribe, RequestAuthorizeReject, RequestAuthorizeSubscribe, RequestAuthorizeTab, RequestBatchRestore, RequestCurrentAccountAddress, RequestDeriveCreate, RequestJsonRestore, ResponseAuthorizeList, SeedLengths } from '@subwallet/extension-base/background/types';
6
- import { InjectedAccount, MetadataDefBase } from '@subwallet/extension-inject/types';
7
-
8
- import { ApiPromise } from '@polkadot/api';
9
- import { SubmittableExtrinsicFunction } from '@polkadot/api/promise/types';
10
- import { Registry } from '@polkadot/types/types';
11
- import { Keyring } from '@polkadot/ui-keyring';
12
- import { BN } from '@polkadot/util';
13
- import { KeypairType } from '@polkadot/util-crypto/types';
14
-
15
- export enum ApiInitStatus {
16
- SUCCESS,
17
- ALREADY_EXIST,
18
- NOT_SUPPORT
19
- }
20
-
21
- export interface AuthRequestV2 extends Resolver<ResultResolver> {
22
- id: string;
23
- idStr: string;
24
- request: RequestAuthorizeTab;
25
- url: string;
26
- }
27
-
28
- export interface RequestAuthorizeApproveV2 {
29
- id: string;
30
- accounts: string[];
31
- }
32
-
33
- export interface RequestAuthorizationAll {
34
- connectValue: boolean;
35
- }
36
-
37
- export interface RequestAuthorization extends RequestAuthorizationAll {
38
- url: string;
39
- }
40
-
41
- export interface RequestAuthorizationPerAccount extends RequestAuthorization {
42
- address: string;
43
- }
44
-
45
- export interface ResultResolver {
46
- result: boolean;
47
- accounts: string[];
48
- }
49
-
50
- export interface RejectResolver {
51
- error: Error;
52
- accounts: string[];
53
- }
54
-
55
- export interface RequestForgetSite {
56
- url: string;
57
- }
58
-
59
- export interface StakingRewardItem {
60
- state: APIItemState
61
- name: string,
62
- chainId: string,
63
- latestReward?: string,
64
- totalReward?: string,
65
- totalSlash?: string,
66
- smartContract?: string
67
- }
68
-
69
- export interface StakingRewardJson {
70
- details: Array<StakingRewardItem>
71
- }
72
-
73
- export interface StakingItem {
74
- name: string,
75
- chainId: string,
76
- balance?: string,
77
- nativeToken: string,
78
- unit?: string,
79
- state: APIItemState
80
- }
81
-
82
- export interface StakingJson {
83
- ready?: boolean,
84
- details: Record<string, StakingItem>
85
- }
86
-
87
- export interface PriceJson {
88
- ready?: boolean,
89
- currency: string,
90
- priceMap: Record<string, number>,
91
- tokenPriceMap: Record<string, number>
92
- }
93
-
94
- export enum APIItemState {
95
- PENDING = 'pending',
96
- READY = 'ready',
97
- CACHED = 'cached',
98
- ERROR = 'error',
99
- NOT_SUPPORT = 'not_support'
100
- }
101
-
102
- export enum RMRK_VER {
103
- VER_1 = '1.0.0',
104
- VER_2 = '2.0.0'
105
- }
106
-
107
- export enum CrowdloanParaState {
108
- ONGOING = 'ongoing',
109
- COMPLETED = 'completed',
110
- FAILED = 'failed'
111
- }
112
-
113
- export interface NftTransferExtra {
114
- cronUpdate: boolean;
115
- forceUpdate: boolean;
116
- selectedNftCollection?: NftCollection; // for rendering
117
- nftItems?: NftItem[]; // for rendering, remaining nfts
118
- }
119
-
120
- export interface NftItem {
121
- id?: string;
122
- name?: string;
123
- image?: string;
124
- external_url?: string;
125
- rarity?: string;
126
- collectionId?: string;
127
- description?: string;
128
- properties?: Record<any, any> | null;
129
- chain?: string;
130
- rmrk_ver?: RMRK_VER;
131
- }
132
-
133
- export interface NftCollection {
134
- collectionId: string;
135
- collectionName?: string;
136
- image?: string;
137
- chain?: string;
138
- itemCount?: number;
139
- }
140
-
141
- export interface NftJson {
142
- total: number;
143
- nftList: Array<NftItem>;
144
- }
145
-
146
- export interface NftCollectionJson {
147
- ready: boolean;
148
- nftCollectionList: Array<NftCollection>;
149
- }
150
-
151
- export interface TokenBalanceRaw {
152
- reserved: BN,
153
- frozen: BN,
154
- free: BN
155
- }
156
-
157
- export interface BalanceChildItem {
158
- reserved: string,
159
- frozen: string,
160
- free: string,
161
- decimals: number
162
- }
163
-
164
- export interface BalanceItem {
165
- state: APIItemState,
166
- free: string,
167
- reserved: string,
168
- miscFrozen: string,
169
- feeFrozen: string,
170
- children?: Record<string, BalanceChildItem>
171
- }
172
-
173
- export interface BalanceJson {
174
- details: Record<string, BalanceItem>
175
- }
176
-
177
- export interface CrowdloanItem {
178
- state: APIItemState,
179
- paraState?: CrowdloanParaState,
180
- contribute: string
181
- }
182
-
183
- export interface CrowdloanJson {
184
- details: Record<string, CrowdloanItem>
185
- }
186
-
187
- export interface ChainRegistry {
188
- chainDecimals: number[];
189
- chainTokens: string[];
190
- tokenMap: Record<string, TokenInfo>
191
- }
192
-
193
- export interface DefaultFormatBalance {
194
- decimals?: number[] | number;
195
- unit?: string[] | string;
196
- }
197
-
198
- export interface ApiState {
199
- apiDefaultTx: SubmittableExtrinsicFunction;
200
- apiDefaultTxSudo: SubmittableExtrinsicFunction;
201
- isApiReady: boolean;
202
- isApiReadyOnce: boolean;
203
- isDevelopment?: boolean;
204
- isEthereum?: boolean;
205
- specName: string;
206
- specVersion: string;
207
- systemChain: string;
208
- systemName: string;
209
- systemVersion: string;
210
- registry: Registry;
211
- defaultFormatBalance: DefaultFormatBalance;
212
- }
213
-
214
- export interface ApiProps extends ApiState {
215
- api: ApiPromise;
216
- apiError?: string;
217
- apiUrl: string;
218
- isNotSupport?: boolean;
219
- isApiReadyOnce: boolean;
220
- isApiConnected: boolean;
221
- isEthereum: boolean;
222
- isApiInitialized: boolean;
223
- isReady: Promise<ApiProps>;
224
- apiRetry?: number;
225
- recoverConnect?: () => void;
226
- useEvmAddress?: boolean
227
- }
228
-
229
- export type NetWorkGroup = 'RELAY_CHAIN' | 'POLKADOT_PARACHAIN' | 'KUSAMA_PARACHAIN' | 'MAIN_NET' | 'TEST_NET' | 'UNKNOWN';
230
-
231
- export interface NetWorkInfo {
232
- chain: string;
233
- genesisHash: string;
234
- icon?: string;
235
- ss58Format: number;
236
- chainType?: 'substrate' | 'ethereum';
237
- provider: string;
238
- groups: NetWorkGroup[];
239
- paraId?: number;
240
- isEthereum?: boolean;
241
- nativeToken?: string;
242
- crowdloanUrl?: string;
243
- decimals?: number;
244
- }
245
-
246
- export interface DonateInfo {
247
- key: string;
248
- name: string;
249
- value: string;
250
- icon: string;
251
- link: string;
252
- }
253
-
254
- export interface NetWorkMetadataDef extends MetadataDefBase {
255
- networkKey: string;
256
- groups: NetWorkGroup[];
257
- isEthereum: boolean;
258
- paraId?: number;
259
- isAvailable: boolean;
260
- }
261
-
262
- export type CurrentNetworkInfo = {
263
- networkKey: string;
264
- networkPrefix: number;
265
- icon: string;
266
- genesisHash: string;
267
- isEthereum: boolean;
268
- }
269
-
270
- export type TokenInfo = {
271
- isMainToken: boolean,
272
- symbol: string,
273
- erc20Address?: string,
274
- assetIndex?: number,
275
- decimals: number,
276
- name: string,
277
- coinGeckoKey?: string,
278
- specialOption?: object
279
- }
280
-
281
- // all Accounts and the address of the current Account
282
- export interface AccountsWithCurrentAddress {
283
- accounts: AccountJson[];
284
- currentAddress?: string;
285
- isShowBalance?: boolean;
286
- allAccountLogo?: string;
287
- }
288
-
289
- export interface CurrentAccountInfo {
290
- address: string;
291
- }
292
-
293
- export interface RequestSettingsType {
294
- isShowBalance: boolean;
295
- accountAllLogo: string;
296
- }
297
-
298
- export interface ResponseSettingsType {
299
- isShowBalance: boolean;
300
- accountAllLogo: string;
301
- }
302
-
303
- export interface RandomTestRequest {
304
- start: number;
305
- end: number;
306
- }
307
-
308
- export type PdotApi = {
309
- keyring: Keyring;
310
- apisMap: Record<string, ApiProps>;
311
- }
312
-
313
- export interface BackgroundWindow extends Window {
314
- pdotApi: PdotApi;
315
- }
316
-
317
- export interface TransactionHistoryItemType {
318
- time: number;
319
- networkKey: string;
320
- change: string;
321
- fee?: string;
322
- isSuccess: boolean;
323
- action: 'send' | 'received';
324
- extrinsicHash: string
325
- }
326
-
327
- export interface RequestTransactionHistoryGet {
328
- address: string;
329
- networkKey: string;
330
- }
331
-
332
- export interface RequestTransactionHistoryGetByMultiNetworks {
333
- address: string;
334
- networkKeys: string[];
335
- }
336
-
337
- export interface RequestTransactionHistoryAdd {
338
- address: string;
339
- networkKey: string;
340
- item: TransactionHistoryItemType;
341
- }
342
-
343
- export interface RequestApi {
344
- networkKey: string;
345
- }
346
-
347
- export interface RequestAccountExportPrivateKey {
348
- address: string;
349
- password: string;
350
- }
351
-
352
- export interface ResponseAccountExportPrivateKey {
353
- privateKey: string;
354
- }
355
-
356
- export interface RequestSeedCreateV2 {
357
- length?: SeedLengths;
358
- seed?: string;
359
- types?: Array<KeypairType>;
360
- }
361
-
362
- export interface RequestSeedValidateV2 {
363
- suri: string;
364
- types?: Array<KeypairType>;
365
- }
366
-
367
- export interface RequestAccountCreateSuriV2 {
368
- name: string;
369
- genesisHash?: string | null;
370
- password: string;
371
- suri: string;
372
- types?: Array<KeypairType>
373
- }
374
-
375
- export interface ResponseSeedCreateV2 {
376
- seed: string,
377
- addressMap: Record<KeypairType, string>
378
- }
379
-
380
- export interface RequestCheckTransfer {
381
- networkKey: string,
382
- from: string,
383
- to: string,
384
- value?: string,
385
- transferAll?: boolean
386
- token?: string
387
- }
388
-
389
- export interface RequestTransfer extends RequestCheckTransfer {
390
- password: string;
391
- }
392
-
393
- export type ResponseSeedValidateV2 = ResponseSeedCreateV2
394
- export type ResponseAccountCreateSuriV2 = Record<KeypairType, string>
395
- export type AccountRef = Array<string>
396
- export type AccountRefMap = Record<string, AccountRef>
397
-
398
- export type RequestPrice = null
399
- export type RequestSubscribePrice = null
400
- export type RequestBalance = null
401
- export type RequestSubscribeBalance = null
402
- export type RequestSubscribeBalancesVisibility = null
403
- export type RequestCrowdloan = null
404
- export type RequestSubscribeCrowdloan = null
405
- export type RequestSubscribeNft = null
406
- export type RequestSubscribeStaking = null
407
- export type RequestSubscribeStakingReward = null
408
- export type RequestNftForceUpdate = {
409
- collectionId: string,
410
- nft: NftItem,
411
- isSendingSelf: boolean,
412
- chain: string
413
- }
414
-
415
- export enum TransferErrorCode {
416
- INVALID_FROM_ADDRESS = 'invalidFromAccount',
417
- INVALID_TO_ADDRESS = 'invalidToAccount',
418
- NOT_ENOUGH_VALUE = 'notEnoughValue',
419
- INVALID_VALUE = 'invalidValue',
420
- INVALID_TOKEN = 'invalidToken',
421
- KEYRING_ERROR = 'keyringError',
422
- TRANSFER_ERROR = 'transferError',
423
- TIMEOUT = 'timeout'
424
- }
425
-
426
- export type TransferError = {
427
- code: TransferErrorCode,
428
- data?: object,
429
- message: string
430
- }
431
-
432
- export interface ResponseCheckTransfer {
433
- errors?: Array<TransferError>,
434
- fromAccountFree: string,
435
- toAccountFree: string,
436
- estimateFee?: string
437
- }
438
-
439
- export enum TransferStep {
440
- READY = 'ready',
441
- START = 'start',
442
- PROCESSING = 'processing',
443
- SUCCESS = 'success',
444
- ERROR = 'error'
445
- }
446
-
447
- export interface ResponseTransfer {
448
- step: TransferStep,
449
- errors?: Array<TransferError>,
450
- extrinsicHash?: string,
451
- extrinsicStatus?: string,
452
- data?: object
453
- }
454
-
455
- export interface EvmNftTransactionRequest {
456
- networkKey: string,
457
- senderAddress: string,
458
- recipientAddress: string,
459
- params: Record<string, any>
460
- }
461
-
462
- export interface EvmNftTransaction {
463
- tx: Record<string, any> | null,
464
- estimatedFee: string | null
465
- }
466
-
467
- export interface EvmNftSubmitTransaction {
468
- senderAddress: string,
469
- password: string,
470
- recipientAddress: string,
471
- networkKey: string,
472
- rawTransaction: Record<string, any>
473
- }
474
-
475
- export interface EvmNftTransactionResponse {
476
- passwordError?: string | null,
477
- callHash?: string,
478
- status?: boolean,
479
- transactionHash?: string,
480
- txError?: boolean,
481
- isSendingSelf: boolean
482
- }
483
-
484
- export interface KoniRequestSignatures {
485
- 'pri(evmNft.submitTransaction)': [EvmNftSubmitTransaction, EvmNftTransactionResponse, EvmNftTransactionResponse];
486
- 'pri(evmNft.getTransaction)': [EvmNftTransactionRequest, EvmNftTransaction];
487
- 'pri(nftTransfer.setNftTransfer)': [NftTransferExtra, boolean];
488
- 'pri(nftTransfer.getNftTransfer)': [null, NftTransferExtra];
489
- 'pri(nftTransfer.getSubscription)': [null, NftTransferExtra, NftTransferExtra];
490
- 'pri(nft.forceUpdate)': [RequestNftForceUpdate, boolean];
491
- 'pri(api.init)': [RequestApi, ApiInitStatus];
492
- 'pri(staking.getStaking)': [null, StakingJson];
493
- 'pri(staking.getSubscription)': [RequestSubscribeStaking, StakingJson, StakingJson];
494
- 'pri(stakingReward.getStakingReward)': [null, StakingRewardJson];
495
- 'pri(stakingReward.getSubscription)': [RequestSubscribeStakingReward, StakingRewardJson, StakingRewardJson];
496
- 'pri(nft.getNft)': [null, NftJson];
497
- 'pri(nft.getSubscription)': [RequestSubscribeNft, NftJson, NftJson];
498
- 'pri(nftCollection.getNftCollection)': [null, NftCollectionJson];
499
- 'pri(nftCollection.getSubscription)': [null, NftCollectionJson, NftCollectionJson];
500
- 'pri(price.getPrice)': [RequestPrice, PriceJson];
501
- 'pri(price.getSubscription)': [RequestSubscribePrice, PriceJson, PriceJson];
502
- 'pri(balance.getBalance)': [RequestBalance, BalanceJson];
503
- 'pri(balance.getSubscription)': [RequestSubscribeBalance, BalanceJson, BalanceJson];
504
- 'pri(crowdloan.getCrowdloan)': [RequestCrowdloan, CrowdloanJson];
505
- 'pri(crowdloan.getSubscription)': [RequestSubscribeCrowdloan, CrowdloanJson, CrowdloanJson];
506
- 'pri(authorize.listV2)': [null, ResponseAuthorizeList];
507
- 'pri(authorize.requestsV2)': [RequestAuthorizeSubscribe, boolean, AuthorizeRequest[]];
508
- 'pri(authorize.approveV2)': [RequestAuthorizeApproveV2, boolean];
509
- 'pri(authorize.changeSiteAll)': [RequestAuthorizationAll, boolean, AuthUrls];
510
- 'pri(authorize.changeSite)': [RequestAuthorization, boolean, AuthUrls];
511
- 'pri(authorize.changeSitePerAccount)': [RequestAuthorizationPerAccount, boolean, AuthUrls];
512
- 'pri(authorize.forgetSite)': [RequestForgetSite, boolean, AuthUrls];
513
- 'pri(authorize.forgetAllSite)': [null, boolean, AuthUrls];
514
- 'pri(authorize.rejectV2)': [RequestAuthorizeReject, boolean];
515
- 'pri(seed.createV2)': [RequestSeedCreateV2, ResponseSeedCreateV2];
516
- 'pri(seed.validateV2)': [RequestSeedValidateV2, ResponseSeedValidateV2];
517
- 'pri(accounts.create.suriV2)': [RequestAccountCreateSuriV2, ResponseAccountCreateSuriV2];
518
- 'pri(accounts.checkTransfer)': [RequestCheckTransfer, ResponseCheckTransfer];
519
- 'pri(accounts.transfer)': [RequestTransfer, Array<TransferError>, ResponseTransfer];
520
- 'pri(derivation.createV2)': [RequestDeriveCreate, boolean];
521
- 'pri(json.restoreV2)': [RequestJsonRestore, void];
522
- 'pri(json.batchRestoreV2)': [RequestBatchRestore, void];
523
- 'pri(accounts.exportPrivateKey)': [RequestAccountExportPrivateKey, ResponseAccountExportPrivateKey];
524
- 'pri(accounts.subscribeWithCurrentAddress)': [RequestAccountSubscribe, boolean, AccountsWithCurrentAddress];
525
- 'pri(accounts.triggerSubscription)': [null, boolean];
526
- 'pri(currentAccount.saveAddress)': [RequestCurrentAccountAddress, boolean, CurrentAccountInfo];
527
- 'pri(currentAccount.changeBalancesVisibility)': [null, boolean, ResponseSettingsType];
528
- 'pri(currentAccount.subscribeSettings)': [null, ResponseSettingsType, ResponseSettingsType];
529
- 'pri(currentAccount.saveAccountAllLogo)': [string, boolean, ResponseSettingsType];
530
- 'pri(networkMetadata.list)': [null, NetWorkMetadataDef[]];
531
- 'pri(chainRegistry.getSubscription)': [null, Record<string, ChainRegistry>, Record<string, ChainRegistry>];
532
- 'pri(transaction.history.getSubscription)': [null, Record<string, TransactionHistoryItemType[]>, Record<string, TransactionHistoryItemType[]>];
533
- 'pri(transaction.history.add)': [RequestTransactionHistoryAdd, boolean, TransactionHistoryItemType[]];
534
- 'pub(utils.getRandom)': [RandomTestRequest, number];
535
- 'pub(accounts.listV2)': [RequestAccountList, InjectedAccount[]];
536
- 'pub(accounts.subscribeV2)': [RequestAccountSubscribe, boolean, InjectedAccount[]];
537
- }
@@ -1,30 +0,0 @@
1
- // Copyright 2019-2022 @subwallet/extension authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { KeyringPair } from '@polkadot/keyring/types';
5
- import type { SignerPayloadRaw } from '@polkadot/types/types';
6
- import type { HexString } from '@polkadot/util/types';
7
- import type { RequestSign } from './types';
8
-
9
- import { wrapBytes } from '@subwallet/extension-dapp/wrapBytes';
10
-
11
- import { TypeRegistry } from '@polkadot/types';
12
- import { u8aToHex } from '@polkadot/util';
13
-
14
- export default class RequestBytesSign implements RequestSign {
15
- public readonly payload: SignerPayloadRaw;
16
-
17
- constructor (payload: SignerPayloadRaw) {
18
- this.payload = payload;
19
- }
20
-
21
- sign (_registry: TypeRegistry, pair: KeyringPair): { signature: HexString } {
22
- return {
23
- signature: u8aToHex(
24
- pair.sign(
25
- wrapBytes(this.payload.data)
26
- )
27
- )
28
- };
29
- }
30
- }
@@ -1,23 +0,0 @@
1
- // Copyright 2019-2022 @subwallet/extension authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { KeyringPair } from '@polkadot/keyring/types';
5
- import type { SignerPayloadJSON } from '@polkadot/types/types';
6
- import type { HexString } from '@polkadot/util/types';
7
- import type { RequestSign } from './types';
8
-
9
- import { TypeRegistry } from '@polkadot/types';
10
-
11
- export default class RequestExtrinsicSign implements RequestSign {
12
- public readonly payload: SignerPayloadJSON;
13
-
14
- constructor (payload: SignerPayloadJSON) {
15
- this.payload = payload;
16
- }
17
-
18
- sign (registry: TypeRegistry, pair: KeyringPair): { signature: HexString } {
19
- return registry
20
- .createType('ExtrinsicPayload', this.payload, { version: this.payload.version })
21
- .sign(pair);
22
- }
23
- }