@multiversx/sdk-web-wallet-cross-window-provider 0.0.17 → 0.0.18

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.
@@ -1,4 +1,4 @@
1
- import { CrossWindowProviderRequestEnums, CrossWindowProviderResponseEnums, PostMessageParamsType, PostMessageReturnType, ReplyWithPostMessageType } from '../types';
1
+ import { CrossWindowProviderRequestEnums, CrossWindowProviderResponseEnums, PostMessageParamsType, PostMessageReturnType, ReplyWithPostMessagePayloadType } from '../types';
2
2
  export declare class WindowManager {
3
3
  private walletUrl;
4
4
  private initialized;
@@ -12,7 +12,7 @@ export declare class WindowManager {
12
12
  private addHandshakeChangeListener;
13
13
  listenOnce<T extends CrossWindowProviderResponseEnums>(action: T): Promise<{
14
14
  type: T;
15
- payload: ReplyWithPostMessageType<T>['payload'];
15
+ payload: ReplyWithPostMessagePayloadType<T>;
16
16
  }>;
17
17
  closeConnection(): Promise<boolean>;
18
18
  isInitialized(): boolean;
package/out/types.d.ts CHANGED
@@ -44,14 +44,16 @@ export type ReplyWithPostMessageObjectType = {
44
44
  };
45
45
  [CrossWindowProviderResponseEnums.noneResponse]: null;
46
46
  };
47
- type ReplyWithPostMessagePayloadType<T extends ReplyWithPostMessageObjectType[keyof ReplyWithPostMessageObjectType]> = {
48
- data?: T;
47
+ export type ReplyWithPostMessagePayloadType<K extends keyof ReplyWithPostMessageObjectType> = {
48
+ data?: ReplyWithPostMessageObjectType[K];
49
49
  error?: string;
50
50
  };
51
- export type ReplyWithPostMessageType<T extends CrossWindowProviderResponseEnums> = {
52
- type: T;
53
- payload: ReplyWithPostMessagePayloadType<ReplyWithPostMessageObjectType[T]>;
54
- };
51
+ export type ReplyWithPostMessageType = {
52
+ [K in keyof ReplyWithPostMessageObjectType]: {
53
+ type: K;
54
+ payload: ReplyWithPostMessagePayloadType<K>;
55
+ };
56
+ }[keyof ReplyWithPostMessageObjectType];
55
57
  export type ResponseTypeMap = {
56
58
  [CrossWindowProviderRequestEnums.signTransactionsRequest]: CrossWindowProviderResponseEnums.signTransactionsResponse;
57
59
  [CrossWindowProviderRequestEnums.signMessageRequest]: CrossWindowProviderResponseEnums.signMessageResponse;
@@ -92,6 +94,5 @@ export interface PostMessageParamsType<T extends CrossWindowProviderRequestEnums
92
94
  }
93
95
  export interface PostMessageReturnType<T extends CrossWindowProviderRequestEnums> {
94
96
  type: ResponseTypeMap[T] | CrossWindowProviderResponseEnums.cancelResponse;
95
- payload: ReplyWithPostMessageType<ResponseTypeMap[T]>['payload'];
97
+ payload: ReplyWithPostMessagePayloadType<ResponseTypeMap[T]>;
96
98
  }
97
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiversx/sdk-web-wallet-cross-window-provider",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Signing provider for dApps: Cross Window",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.js",