@subwallet/extension-base 1.0.2-1b → 1.0.2-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 (78) hide show
  1. package/background/KoniTypes.d.ts +31 -5
  2. package/background/KoniTypes.js +2 -1
  3. package/background/errors/TransactionError.js +4 -0
  4. package/background/types.d.ts +10 -5
  5. package/cjs/background/KoniTypes.js +2 -1
  6. package/cjs/background/errors/TransactionError.js +4 -0
  7. package/cjs/koni/api/dotsama/transfer.js +6 -12
  8. package/cjs/koni/api/nft/acala_nft/index.js +7 -10
  9. package/cjs/koni/api/nft/bit.country/index.js +7 -9
  10. package/cjs/koni/api/nft/evm_nft/index.js +2 -1
  11. package/cjs/koni/api/nft/karura_nft/index.js +7 -9
  12. package/cjs/koni/api/nft/rmrk_nft/index.js +4 -1
  13. package/cjs/koni/api/nft/statemine_nft/index.js +7 -9
  14. package/cjs/koni/api/nft/unique_nft/index.js +5 -6
  15. package/cjs/koni/api/nft/wasm_nft/index.js +2 -1
  16. package/cjs/koni/api/staking/bonding/relayChain.js +3 -0
  17. package/cjs/koni/background/cron.js +53 -46
  18. package/cjs/koni/background/handlers/Extension.js +292 -159
  19. package/cjs/koni/background/handlers/State.js +24 -14
  20. package/cjs/koni/background/handlers/Tabs.js +42 -16
  21. package/cjs/packageInfo.js +1 -1
  22. package/cjs/services/chain-service/handler/light-client/index.js +0 -2
  23. package/cjs/services/chain-service/index.js +53 -38
  24. package/cjs/services/history-service/index.js +3 -3
  25. package/cjs/services/history-service/subsquid-multi-chain-history.js +1 -1
  26. package/cjs/services/keyring-service/index.js +11 -13
  27. package/cjs/services/request-service/handler/AuthRequestHandler.js +7 -5
  28. package/cjs/services/request-service/handler/EvmRequestHandler.js +8 -12
  29. package/cjs/services/request-service/index.js +14 -5
  30. package/cjs/services/storage-service/DatabaseService.js +8 -5
  31. package/cjs/services/storage-service/db-stores/Nft.js +9 -4
  32. package/cjs/services/transaction-service/index.js +3 -1
  33. package/cjs/utils/address.js +10 -1
  34. package/cjs/utils/index.js +2 -1
  35. package/koni/api/dotsama/transfer.js +6 -12
  36. package/koni/api/nft/acala_nft/index.js +7 -9
  37. package/koni/api/nft/bit.country/index.js +7 -8
  38. package/koni/api/nft/evm_nft/index.js +2 -1
  39. package/koni/api/nft/index.d.ts +1 -1
  40. package/koni/api/nft/karura_nft/index.js +7 -8
  41. package/koni/api/nft/nft.d.ts +1 -1
  42. package/koni/api/nft/rmrk_nft/index.js +4 -1
  43. package/koni/api/nft/statemine_nft/index.js +7 -8
  44. package/koni/api/nft/unique_nft/index.js +5 -5
  45. package/koni/api/nft/wasm_nft/index.js +2 -1
  46. package/koni/api/staking/bonding/relayChain.js +3 -0
  47. package/koni/background/cron.js +53 -46
  48. package/koni/background/handlers/Extension.d.ts +6 -1
  49. package/koni/background/handlers/Extension.js +203 -73
  50. package/koni/background/handlers/State.d.ts +1 -1
  51. package/koni/background/handlers/State.js +26 -14
  52. package/koni/background/handlers/Tabs.js +42 -16
  53. package/package.json +13 -13
  54. package/packageInfo.js +1 -1
  55. package/services/chain-service/handler/light-client/index.d.ts +1 -17
  56. package/services/chain-service/handler/light-client/index.js +1 -1
  57. package/services/chain-service/index.d.ts +3 -2
  58. package/services/chain-service/index.js +47 -33
  59. package/services/chain-service/types.d.ts +1 -0
  60. package/services/history-service/index.d.ts +3 -1
  61. package/services/history-service/index.js +3 -3
  62. package/services/history-service/subsquid-multi-chain-history.js +1 -1
  63. package/services/keyring-service/index.d.ts +4 -2
  64. package/services/keyring-service/index.js +11 -13
  65. package/services/request-service/handler/AuthRequestHandler.d.ts +3 -1
  66. package/services/request-service/handler/AuthRequestHandler.js +7 -5
  67. package/services/request-service/handler/EvmRequestHandler.js +8 -12
  68. package/services/request-service/index.d.ts +3 -1
  69. package/services/request-service/index.js +14 -5
  70. package/services/storage-service/DatabaseService.d.ts +1 -1
  71. package/services/storage-service/DatabaseService.js +8 -5
  72. package/services/storage-service/db-stores/Nft.d.ts +2 -1
  73. package/services/storage-service/db-stores/Nft.js +9 -4
  74. package/services/transaction-service/index.js +3 -1
  75. package/utils/address.d.ts +3 -0
  76. package/utils/address.js +8 -1
  77. package/utils/index.d.ts +1 -1
  78. package/utils/index.js +1 -1
@@ -180,7 +180,6 @@ export default class TransactionService {
180
180
  this.transactionSubject.next({
181
181
  ...transactions
182
182
  });
183
- console.log(transaction);
184
183
 
185
184
  // Send transaction
186
185
  return await this.sendTransaction(transaction);
@@ -585,6 +584,9 @@ export default class TransactionService {
585
584
  payload.isToContract = isToContract;
586
585
  payload.parseData = isToContract ? payload.data ? (await parseContractInput(payload.data || '', payload.to || '', chainInfo)).result : '' : payload.data || '';
587
586
  }
587
+ if ('data' in payload && payload.data === undefined) {
588
+ delete payload.data;
589
+ }
588
590
 
589
591
  // Set unique nonce to avoid transaction errors
590
592
  if (!payload.nonce) {
@@ -1,2 +1,5 @@
1
+ import { AddressJson } from '@subwallet/extension-base/background/types';
2
+ import { SubjectInfo } from '@subwallet/ui-keyring/observable/types';
1
3
  export declare const simpleAddress: (address: string) => string;
2
4
  export declare function quickFormatAddressToCompare(address?: string): string | undefined;
5
+ export declare const convertSubjectInfoToAddresses: (subjectInfo: SubjectInfo) => AddressJson[];
package/utils/address.js CHANGED
@@ -14,4 +14,11 @@ export function quickFormatAddressToCompare(address) {
14
14
  return address;
15
15
  }
16
16
  return reformatAddress(address, 42).toLowerCase();
17
- }
17
+ }
18
+ export const convertSubjectInfoToAddresses = subjectInfo => {
19
+ return Object.values(subjectInfo).map(info => ({
20
+ address: info.json.address,
21
+ type: info.type,
22
+ ...info.json.meta
23
+ }));
24
+ };
package/utils/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare const isDef: (x: any) => boolean;
8
8
  export declare const nonEmptyArr: (x: any) => boolean;
9
9
  export declare const isEmptyArray: (x: any) => boolean;
10
10
  export declare function isAccountAll(address?: string): boolean;
11
- export declare function reformatAddress(address: string, networkPrefix: number, isEthereum?: boolean): string;
11
+ export declare function reformatAddress(address: string, networkPrefix?: number, isEthereum?: boolean): string;
12
12
  export declare function filterAddressByNetworkKey(addresses: string[], networkKey: string, isEthereum?: boolean): string[];
13
13
  export declare function categoryAddresses(addresses: string[]): string[][];
14
14
  export declare function categoryNetworks(networks: NetworkJson[]): string[][];
package/utils/index.js CHANGED
@@ -13,7 +13,7 @@ export const isEmptyArray = x => !Array.isArray(x) || Array.isArray(x) && x.leng
13
13
  export function isAccountAll(address) {
14
14
  return address === ALL_ACCOUNT_KEY;
15
15
  }
16
- export function reformatAddress(address, networkPrefix, isEthereum = false) {
16
+ export function reformatAddress(address, networkPrefix = 42, isEthereum = false) {
17
17
  try {
18
18
  if (isEthereumAddress(address)) {
19
19
  return address;