@solana-mobile/mobile-wallet-adapter-walletlib 1.2.0 → 1.3.0
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.
- package/lib/esm/index.js +46 -37
- package/lib/esm/index.native.js +46 -37
- package/lib/types/index.d.ts +5 -2
- package/lib/types/index.native.d.ts +5 -2
- package/package.json +1 -1
package/lib/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform, NativeModules, NativeEventEmitter
|
|
1
|
+
import { Platform, NativeModules, NativeEventEmitter } from 'react-native';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -54,31 +54,6 @@ function resolve(request, response) {
|
|
|
54
54
|
SolanaMobileWalletAdapterWalletLib$1.resolve(JSON.stringify(request), JSON.stringify(response));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/******************************************************************************
|
|
58
|
-
Copyright (c) Microsoft Corporation.
|
|
59
|
-
|
|
60
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
61
|
-
purpose with or without fee is hereby granted.
|
|
62
|
-
|
|
63
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
64
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
65
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
66
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
67
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
68
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
69
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
70
|
-
***************************************************************************** */
|
|
71
|
-
|
|
72
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
73
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
74
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
75
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
76
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
77
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
78
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
57
|
const LINKING_ERROR$1 = `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
|
|
83
58
|
'- You rebuilt the app after installing the package\n' +
|
|
84
59
|
'- If you are using Lerna workspaces\n' +
|
|
@@ -95,7 +70,7 @@ const SolanaMobileWalletAdapterWalletLib = Platform.OS === 'android' && NativeMo
|
|
|
95
70
|
},
|
|
96
71
|
});
|
|
97
72
|
const MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = 'MobileWalletAdapterServiceRequestBridge';
|
|
98
|
-
function useMobileWalletAdapterSession(walletName, config, handleRequest, handleSessionEvent) {
|
|
73
|
+
function useMobileWalletAdapterSession(walletName, config, associationUri, handleRequest, handleSessionEvent) {
|
|
99
74
|
// Start native event listeners
|
|
100
75
|
useEffect(() => {
|
|
101
76
|
const mwaEventEmitter = new NativeEventEmitter();
|
|
@@ -110,24 +85,33 @@ function useMobileWalletAdapterSession(walletName, config, handleRequest, handle
|
|
|
110
85
|
console.warn('Unexpected native event type');
|
|
111
86
|
}
|
|
112
87
|
});
|
|
113
|
-
initializeScenario(walletName, config);
|
|
88
|
+
initializeScenario(walletName, config, associationUri);
|
|
114
89
|
return () => {
|
|
115
90
|
listener.remove();
|
|
116
91
|
};
|
|
117
92
|
}, []);
|
|
118
93
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
94
|
+
function initializeMWAEventListener(handleRequest, handleSessionEvent) {
|
|
95
|
+
const mwaEventEmitter = new NativeEventEmitter();
|
|
96
|
+
const listener = mwaEventEmitter.addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {
|
|
97
|
+
if (isMWARequest(nativeEvent)) {
|
|
98
|
+
handleRequest(nativeEvent);
|
|
99
|
+
}
|
|
100
|
+
else if (isMWASessionEvent(nativeEvent)) {
|
|
101
|
+
handleSessionEvent(nativeEvent);
|
|
126
102
|
}
|
|
127
103
|
else {
|
|
128
|
-
console.warn('
|
|
104
|
+
console.warn('Unexpected native event type');
|
|
129
105
|
}
|
|
130
106
|
});
|
|
107
|
+
return listener;
|
|
108
|
+
}
|
|
109
|
+
function initializeMobileWalletAdapterSession(walletName, config, associationUri) {
|
|
110
|
+
initializeScenario(walletName, config, associationUri);
|
|
111
|
+
}
|
|
112
|
+
// Create Scenario and establish session with dapp
|
|
113
|
+
function initializeScenario(walletName, walletConfig, associationUri) {
|
|
114
|
+
SolanaMobileWalletAdapterWalletLib.createScenario(walletName, associationUri, JSON.stringify(walletConfig));
|
|
131
115
|
}
|
|
132
116
|
function isMWARequest(nativeEvent) {
|
|
133
117
|
return Object.values(MWARequestType).includes(nativeEvent.__type);
|
|
@@ -136,6 +120,31 @@ function isMWASessionEvent(nativeEvent) {
|
|
|
136
120
|
return Object.values(MWASessionEventType).includes(nativeEvent.__type);
|
|
137
121
|
}
|
|
138
122
|
|
|
123
|
+
/******************************************************************************
|
|
124
|
+
Copyright (c) Microsoft Corporation.
|
|
125
|
+
|
|
126
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
127
|
+
purpose with or without fee is hereby granted.
|
|
128
|
+
|
|
129
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
130
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
131
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
132
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
133
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
134
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
135
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
136
|
+
***************************************************************************** */
|
|
137
|
+
|
|
138
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
139
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
140
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
141
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
142
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
143
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
144
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
139
148
|
const LINKING_ERROR = `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
|
|
140
149
|
'- You rebuilt the app after installing the package\n' +
|
|
141
150
|
'- If you are using Lerna workspaces\n' +
|
|
@@ -172,4 +181,4 @@ function getUidForPackage(packageName) {
|
|
|
172
181
|
});
|
|
173
182
|
}
|
|
174
183
|
|
|
175
|
-
export { MWARequestFailReason, MWARequestType, MWASessionEventType, getCallingPackage, getCallingPackageUid, getUidForPackage, resolve, useMobileWalletAdapterSession, verifyCallingPackage };
|
|
184
|
+
export { MWARequestFailReason, MWARequestType, MWASessionEventType, getCallingPackage, getCallingPackageUid, getUidForPackage, initializeMWAEventListener, initializeMobileWalletAdapterSession, resolve, useMobileWalletAdapterSession, verifyCallingPackage };
|
package/lib/esm/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform, NativeModules, NativeEventEmitter
|
|
1
|
+
import { Platform, NativeModules, NativeEventEmitter } from 'react-native';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -54,31 +54,6 @@ function resolve(request, response) {
|
|
|
54
54
|
SolanaMobileWalletAdapterWalletLib$1.resolve(JSON.stringify(request), JSON.stringify(response));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/******************************************************************************
|
|
58
|
-
Copyright (c) Microsoft Corporation.
|
|
59
|
-
|
|
60
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
61
|
-
purpose with or without fee is hereby granted.
|
|
62
|
-
|
|
63
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
64
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
65
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
66
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
67
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
68
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
69
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
70
|
-
***************************************************************************** */
|
|
71
|
-
|
|
72
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
73
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
74
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
75
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
76
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
77
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
78
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
57
|
const LINKING_ERROR$1 = `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
|
|
83
58
|
'- You rebuilt the app after installing the package\n' +
|
|
84
59
|
'- If you are using Lerna workspaces\n' +
|
|
@@ -95,7 +70,7 @@ const SolanaMobileWalletAdapterWalletLib = Platform.OS === 'android' && NativeMo
|
|
|
95
70
|
},
|
|
96
71
|
});
|
|
97
72
|
const MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = 'MobileWalletAdapterServiceRequestBridge';
|
|
98
|
-
function useMobileWalletAdapterSession(walletName, config, handleRequest, handleSessionEvent) {
|
|
73
|
+
function useMobileWalletAdapterSession(walletName, config, associationUri, handleRequest, handleSessionEvent) {
|
|
99
74
|
// Start native event listeners
|
|
100
75
|
useEffect(() => {
|
|
101
76
|
const mwaEventEmitter = new NativeEventEmitter();
|
|
@@ -110,24 +85,33 @@ function useMobileWalletAdapterSession(walletName, config, handleRequest, handle
|
|
|
110
85
|
console.warn('Unexpected native event type');
|
|
111
86
|
}
|
|
112
87
|
});
|
|
113
|
-
initializeScenario(walletName, config);
|
|
88
|
+
initializeScenario(walletName, config, associationUri);
|
|
114
89
|
return () => {
|
|
115
90
|
listener.remove();
|
|
116
91
|
};
|
|
117
92
|
}, []);
|
|
118
93
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
94
|
+
function initializeMWAEventListener(handleRequest, handleSessionEvent) {
|
|
95
|
+
const mwaEventEmitter = new NativeEventEmitter();
|
|
96
|
+
const listener = mwaEventEmitter.addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {
|
|
97
|
+
if (isMWARequest(nativeEvent)) {
|
|
98
|
+
handleRequest(nativeEvent);
|
|
99
|
+
}
|
|
100
|
+
else if (isMWASessionEvent(nativeEvent)) {
|
|
101
|
+
handleSessionEvent(nativeEvent);
|
|
126
102
|
}
|
|
127
103
|
else {
|
|
128
|
-
console.warn('
|
|
104
|
+
console.warn('Unexpected native event type');
|
|
129
105
|
}
|
|
130
106
|
});
|
|
107
|
+
return listener;
|
|
108
|
+
}
|
|
109
|
+
function initializeMobileWalletAdapterSession(walletName, config, associationUri) {
|
|
110
|
+
initializeScenario(walletName, config, associationUri);
|
|
111
|
+
}
|
|
112
|
+
// Create Scenario and establish session with dapp
|
|
113
|
+
function initializeScenario(walletName, walletConfig, associationUri) {
|
|
114
|
+
SolanaMobileWalletAdapterWalletLib.createScenario(walletName, associationUri, JSON.stringify(walletConfig));
|
|
131
115
|
}
|
|
132
116
|
function isMWARequest(nativeEvent) {
|
|
133
117
|
return Object.values(MWARequestType).includes(nativeEvent.__type);
|
|
@@ -136,6 +120,31 @@ function isMWASessionEvent(nativeEvent) {
|
|
|
136
120
|
return Object.values(MWASessionEventType).includes(nativeEvent.__type);
|
|
137
121
|
}
|
|
138
122
|
|
|
123
|
+
/******************************************************************************
|
|
124
|
+
Copyright (c) Microsoft Corporation.
|
|
125
|
+
|
|
126
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
127
|
+
purpose with or without fee is hereby granted.
|
|
128
|
+
|
|
129
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
130
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
131
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
132
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
133
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
134
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
135
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
136
|
+
***************************************************************************** */
|
|
137
|
+
|
|
138
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
139
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
140
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
141
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
142
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
143
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
144
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
139
148
|
const LINKING_ERROR = `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
|
|
140
149
|
'- You rebuilt the app after installing the package\n' +
|
|
141
150
|
'- If you are using Lerna workspaces\n' +
|
|
@@ -172,4 +181,4 @@ function getUidForPackage(packageName) {
|
|
|
172
181
|
});
|
|
173
182
|
}
|
|
174
183
|
|
|
175
|
-
export { MWARequestFailReason, MWARequestType, MWASessionEventType, getCallingPackage, getCallingPackageUid, getUidForPackage, resolve, useMobileWalletAdapterSession, verifyCallingPackage };
|
|
184
|
+
export { MWARequestFailReason, MWARequestType, MWASessionEventType, getCallingPackage, getCallingPackageUid, getUidForPackage, initializeMWAEventListener, initializeMobileWalletAdapterSession, resolve, useMobileWalletAdapterSession, verifyCallingPackage };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IdentifierArray } from "@wallet-standard/core";
|
|
2
2
|
import { TransactionVersion } from "@solana/web3.js";
|
|
3
|
+
import { EmitterSubscription } from "react-native";
|
|
3
4
|
/**
|
|
4
5
|
* Mobile Wallet Adapter Session Events are notifications and events
|
|
5
6
|
* about the underlying session between the wallet and the dApp.
|
|
@@ -202,10 +203,12 @@ interface MobileWalletAdapterConfig {
|
|
|
202
203
|
noConnectionWarningTimeoutMs: number;
|
|
203
204
|
optionalFeatures: IdentifierArray;
|
|
204
205
|
}
|
|
205
|
-
declare function useMobileWalletAdapterSession(walletName: string, config: MobileWalletAdapterConfig, handleRequest: (request: MWARequest) => void, handleSessionEvent: (sessionEvent: MWASessionEvent) => void): void;
|
|
206
|
+
declare function useMobileWalletAdapterSession(walletName: string, config: MobileWalletAdapterConfig, associationUri: string, handleRequest: (request: MWARequest) => void, handleSessionEvent: (sessionEvent: MWASessionEvent) => void): void;
|
|
207
|
+
declare function initializeMWAEventListener(handleRequest: (request: MWARequest) => void, handleSessionEvent: (sessionEvent: MWASessionEvent) => void): EmitterSubscription;
|
|
208
|
+
declare function initializeMobileWalletAdapterSession(walletName: string, config: MobileWalletAdapterConfig, associationUri: string): void;
|
|
206
209
|
declare function getCallingPackage(): Promise<string | undefined>;
|
|
207
210
|
declare function verifyCallingPackage(clientIdentityUri: string): Promise<any>;
|
|
208
211
|
declare function getCallingPackageUid(): Promise<any>;
|
|
209
212
|
declare function getUidForPackage(packageName: string): Promise<any>;
|
|
210
|
-
export { MWASessionEventType, IMWASessionEvent, SessionStartEvent, SessionReadyEvent, SessionTerminatedEvent, SessionServingClientsEvent, SessionServingCompleteEvent, SessionCompleteEvent, SessionErrorEvent, SessionTeardownCompleteEvent, LowPowerNoConnectionEvent, MWASessionEvent, SignInPayload, Base64EncodedAddress, MWARequest, MWARequestType, AuthorizeDappRequest, ReauthorizeDappRequest, DeauthorizeDappRequest, SignMessagesRequest, SignTransactionsRequest, SignAndSendTransactionsRequest, MWAResponse, MWARequestFailReason, UserDeclinedResponse, TooManyPayloadsResponse, AuthorizationNotValidResponse, InvalidSignaturesResponse, AuthorizedAccount, SignInResult, AuthorizeDappCompleteResponse, AuthorizeDappResponse, ReauthorizeDappCompleteResponse, ReauthorizeDappResponse, DeauthorizeDappCompleteResponse, DeauthorizeDappResponse, SignPayloadsCompleteResponse, SignPayloadsFailResponse, SignTransactionsResponse, SignMessagesResponse, SignAndSendTransactionsCompleteResponse, SignAndSendTransactionsResponse, resolve, MobileWalletAdapterConfig, useMobileWalletAdapterSession, getCallingPackage, verifyCallingPackage, getCallingPackageUid, getUidForPackage };
|
|
213
|
+
export { MWASessionEventType, IMWASessionEvent, SessionStartEvent, SessionReadyEvent, SessionTerminatedEvent, SessionServingClientsEvent, SessionServingCompleteEvent, SessionCompleteEvent, SessionErrorEvent, SessionTeardownCompleteEvent, LowPowerNoConnectionEvent, MWASessionEvent, SignInPayload, Base64EncodedAddress, MWARequest, MWARequestType, AuthorizeDappRequest, ReauthorizeDappRequest, DeauthorizeDappRequest, SignMessagesRequest, SignTransactionsRequest, SignAndSendTransactionsRequest, MWAResponse, MWARequestFailReason, UserDeclinedResponse, TooManyPayloadsResponse, AuthorizationNotValidResponse, InvalidSignaturesResponse, AuthorizedAccount, SignInResult, AuthorizeDappCompleteResponse, AuthorizeDappResponse, ReauthorizeDappCompleteResponse, ReauthorizeDappResponse, DeauthorizeDappCompleteResponse, DeauthorizeDappResponse, SignPayloadsCompleteResponse, SignPayloadsFailResponse, SignTransactionsResponse, SignMessagesResponse, SignAndSendTransactionsCompleteResponse, SignAndSendTransactionsResponse, resolve, MobileWalletAdapterConfig, useMobileWalletAdapterSession, initializeMWAEventListener, initializeMobileWalletAdapterSession, getCallingPackage, verifyCallingPackage, getCallingPackageUid, getUidForPackage };
|
|
211
214
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IdentifierArray } from "@wallet-standard/core";
|
|
2
2
|
import { TransactionVersion } from "@solana/web3.js";
|
|
3
|
+
import { EmitterSubscription } from "react-native";
|
|
3
4
|
/**
|
|
4
5
|
* Mobile Wallet Adapter Session Events are notifications and events
|
|
5
6
|
* about the underlying session between the wallet and the dApp.
|
|
@@ -202,10 +203,12 @@ interface MobileWalletAdapterConfig {
|
|
|
202
203
|
noConnectionWarningTimeoutMs: number;
|
|
203
204
|
optionalFeatures: IdentifierArray;
|
|
204
205
|
}
|
|
205
|
-
declare function useMobileWalletAdapterSession(walletName: string, config: MobileWalletAdapterConfig, handleRequest: (request: MWARequest) => void, handleSessionEvent: (sessionEvent: MWASessionEvent) => void): void;
|
|
206
|
+
declare function useMobileWalletAdapterSession(walletName: string, config: MobileWalletAdapterConfig, associationUri: string, handleRequest: (request: MWARequest) => void, handleSessionEvent: (sessionEvent: MWASessionEvent) => void): void;
|
|
207
|
+
declare function initializeMWAEventListener(handleRequest: (request: MWARequest) => void, handleSessionEvent: (sessionEvent: MWASessionEvent) => void): EmitterSubscription;
|
|
208
|
+
declare function initializeMobileWalletAdapterSession(walletName: string, config: MobileWalletAdapterConfig, associationUri: string): void;
|
|
206
209
|
declare function getCallingPackage(): Promise<string | undefined>;
|
|
207
210
|
declare function verifyCallingPackage(clientIdentityUri: string): Promise<any>;
|
|
208
211
|
declare function getCallingPackageUid(): Promise<any>;
|
|
209
212
|
declare function getUidForPackage(packageName: string): Promise<any>;
|
|
210
|
-
export { MWASessionEventType, IMWASessionEvent, SessionStartEvent, SessionReadyEvent, SessionTerminatedEvent, SessionServingClientsEvent, SessionServingCompleteEvent, SessionCompleteEvent, SessionErrorEvent, SessionTeardownCompleteEvent, LowPowerNoConnectionEvent, MWASessionEvent, SignInPayload, Base64EncodedAddress, MWARequest, MWARequestType, AuthorizeDappRequest, ReauthorizeDappRequest, DeauthorizeDappRequest, SignMessagesRequest, SignTransactionsRequest, SignAndSendTransactionsRequest, MWAResponse, MWARequestFailReason, UserDeclinedResponse, TooManyPayloadsResponse, AuthorizationNotValidResponse, InvalidSignaturesResponse, AuthorizedAccount, SignInResult, AuthorizeDappCompleteResponse, AuthorizeDappResponse, ReauthorizeDappCompleteResponse, ReauthorizeDappResponse, DeauthorizeDappCompleteResponse, DeauthorizeDappResponse, SignPayloadsCompleteResponse, SignPayloadsFailResponse, SignTransactionsResponse, SignMessagesResponse, SignAndSendTransactionsCompleteResponse, SignAndSendTransactionsResponse, resolve, MobileWalletAdapterConfig, useMobileWalletAdapterSession, getCallingPackage, verifyCallingPackage, getCallingPackageUid, getUidForPackage };
|
|
213
|
+
export { MWASessionEventType, IMWASessionEvent, SessionStartEvent, SessionReadyEvent, SessionTerminatedEvent, SessionServingClientsEvent, SessionServingCompleteEvent, SessionCompleteEvent, SessionErrorEvent, SessionTeardownCompleteEvent, LowPowerNoConnectionEvent, MWASessionEvent, SignInPayload, Base64EncodedAddress, MWARequest, MWARequestType, AuthorizeDappRequest, ReauthorizeDappRequest, DeauthorizeDappRequest, SignMessagesRequest, SignTransactionsRequest, SignAndSendTransactionsRequest, MWAResponse, MWARequestFailReason, UserDeclinedResponse, TooManyPayloadsResponse, AuthorizationNotValidResponse, InvalidSignaturesResponse, AuthorizedAccount, SignInResult, AuthorizeDappCompleteResponse, AuthorizeDappResponse, ReauthorizeDappCompleteResponse, ReauthorizeDappResponse, DeauthorizeDappCompleteResponse, DeauthorizeDappResponse, SignPayloadsCompleteResponse, SignPayloadsFailResponse, SignTransactionsResponse, SignMessagesResponse, SignAndSendTransactionsCompleteResponse, SignAndSendTransactionsResponse, resolve, MobileWalletAdapterConfig, useMobileWalletAdapterSession, initializeMWAEventListener, initializeMobileWalletAdapterSession, getCallingPackage, verifyCallingPackage, getCallingPackageUid, getUidForPackage };
|
|
211
214
|
//# sourceMappingURL=index.native.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana-mobile/mobile-wallet-adapter-walletlib",
|
|
3
3
|
"description": "A React Native wrapper of the Solana Mobile, Mobile Wallet Adapter Wallet Library. Wallet apps can use this to handle dapp requests for signing and sending.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"author": "Michael Sulistio <mike.sulistio@solanamobile.com>",
|
|
6
6
|
"repository": "https://github.com/solana-mobile/mobile-wallet-adapter",
|
|
7
7
|
"license": "Apache-2.0",
|