@solana-mobile/mobile-wallet-adapter-walletlib 1.0.1 → 1.0.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 (36) hide show
  1. package/README.md +61 -3
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/java/com/solanamobile/mobilewalletadapterwalletlib/reactnative/JsonSerializationUtils.kt +30 -1
  4. package/android/src/main/java/com/solanamobile/mobilewalletadapterwalletlib/reactnative/MobileWalletAdapterWalletLibReactNativePackage.kt +4 -1
  5. package/android/src/main/java/com/solanamobile/mobilewalletadapterwalletlib/reactnative/SolanaMobileDigitalAssetLinksModule.kt +65 -0
  6. package/android/src/main/java/com/solanamobile/mobilewalletadapterwalletlib/reactnative/SolanaMobileWalletAdapterWalletLibModule.kt +22 -20
  7. package/android/src/main/java/com/solanamobile/mobilewalletadapterwalletlib/reactnative/model/MobileWalletAdapterRequest.kt +11 -0
  8. package/android/src/main/java/com/solanamobile/mobilewalletadapterwalletlib/reactnative/model/MobileWalletAdapterResponse.kt +12 -1
  9. package/lib/commonjs/index.js +11 -0
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/resolve.js +2 -0
  12. package/lib/commonjs/resolve.js.map +1 -1
  13. package/lib/commonjs/useDigitalAssetLinks.js +29 -0
  14. package/lib/commonjs/useDigitalAssetLinks.js.map +1 -0
  15. package/lib/commonjs/useMobileWalletAdapterSession.js +6 -2
  16. package/lib/commonjs/useMobileWalletAdapterSession.js.map +1 -1
  17. package/lib/module/index.js +1 -0
  18. package/lib/module/index.js.map +1 -1
  19. package/lib/module/resolve.js +4 -0
  20. package/lib/module/resolve.js.map +1 -1
  21. package/lib/module/useDigitalAssetLinks.js +20 -0
  22. package/lib/module/useDigitalAssetLinks.js.map +1 -0
  23. package/lib/module/useMobileWalletAdapterSession.js +6 -2
  24. package/lib/module/useMobileWalletAdapterSession.js.map +1 -1
  25. package/lib/typescript/index.d.ts +1 -0
  26. package/lib/typescript/index.d.ts.map +1 -1
  27. package/lib/typescript/resolve.d.ts +19 -7
  28. package/lib/typescript/resolve.d.ts.map +1 -1
  29. package/lib/typescript/useDigitalAssetLinks.d.ts +5 -0
  30. package/lib/typescript/useDigitalAssetLinks.d.ts.map +1 -0
  31. package/lib/typescript/useMobileWalletAdapterSession.d.ts.map +1 -1
  32. package/package.json +1 -1
  33. package/src/index.ts +1 -0
  34. package/src/resolve.ts +34 -7
  35. package/src/useDigitalAssetLinks.ts +41 -0
  36. package/src/useMobileWalletAdapterSession.ts +6 -3
package/README.md CHANGED
@@ -26,7 +26,7 @@ AppRegistry.registerComponent(
26
26
  );
27
27
  ```
28
28
 
29
- ### 1. Start listening and handling MWA requests
29
+ ### 2. Start listening and handling MWA requests
30
30
 
31
31
  Use this API to start a session and start handling requests:
32
32
  ```typescript
@@ -83,7 +83,7 @@ const response = {
83
83
  resolve(authorizationRequest, response)
84
84
  ```
85
85
 
86
- There are a a selection of "fail" responses that you can return to the dApp. These are for cases where the user
86
+ There are a a selection of "fail" responses that you can return to the dApp. These are for cases where the user declines, or an error occurs during signing, etc.
87
87
  ```typescript
88
88
  import {
89
89
  UserDeclinedResponse
@@ -96,5 +96,63 @@ const response = {
96
96
  // Tells the dApp user has declined the authorization request
97
97
  resolve(authorizationRequest, response)
98
98
  ```
99
-
99
+
100
+ ## Properties of an MWA Request
101
+ Each MWA Request is defined in [`resolve.ts`](https://github.com/solana-mobile/mobile-wallet-adapter/blob/main/js/packages/mobile-wallet-adapter-walletlib/src/resolve.ts#L38).
102
+ Each come with their own properties and completion response structures.
103
+
104
+ If you want to understand the dApp perspective and how a dApp would send these requests, see [MWA API Documentation](https://docs.solanamobile.com/reference/) for dAppstypescript/mobile-wallet-adapter.
105
+
106
+ ## MWARequest Interfaces
107
+
108
+ ### `IMWARequest`
109
+ This is the base interface that all MWARequsts inherit from. The fields defined here are used in the package's internal implementation and the package consumer will generally not use them.
110
+
111
+ Fields:
112
+ - `__type`: An enum defining the type of MWA Request it is.
113
+ - `requestId`: A unique identifier of this specific MWA Request
114
+ - `sessionId`: A unique identifier of the MWA Session this request belongs to.
115
+
116
+ ### `IVerifiableIdentityRequest`
117
+ This an interface that describes MWA Requests that come with a verifiable identity and the following 3 fields.
118
+
119
+ Fields:
120
+ - `authorizationScope`: A byte representation of the authorization token granted to the dApp.
121
+ - `cluster`: The Solana RPC cluster that the dApp intends to use.
122
+ - `appIdentity`: An object containing 3 optional identity fields about the dApp:
123
+ - Note: The `iconRelativeUri` is a relative path, relative to `identityUri`.
124
+ ```
125
+ {
126
+ identityName: 'dApp Name',
127
+ identityUri: 'https://yourdapp.com'
128
+ iconRelativeUri: "favicon.ico", // Full path resolves to https://yourdapp.com/favicon.ico
129
+ }
130
+ ```
131
+
132
+ ### MWARequest Types
133
+
134
+ - `AuthorizeDappRequest`
135
+ - [Spec](https://solana-mobile.github.io/mobile-wallet-adapter/spec/spec.html#authorize)
136
+ - Interfaces: `IMWARequest`
137
+
138
+ - `ReauthorizeDappRequest`
139
+ - [Spec](https://solana-mobile.github.io/mobile-wallet-adapter/spec/spec.html#reauthorize)
140
+ - Interfaces: `IMWARequest`, `IVerifiableIdentityRequest`
141
+
142
+ - `DeauthorizeDappRequest`
143
+ - [Spec](https://solana-mobile.github.io/mobile-wallet-adapter/spec/spec.html#deauthorize)
144
+ - Interfaces: `IMWARequest`, `IVerifiableIdentityRequest`
145
+
146
+ - `SignMessagesRequest`
147
+ - [Spec](https://solana-mobile.github.io/mobile-wallet-adapter/spec/spec.html#sign_messages)
148
+ - Interfaces: `IMWARequest`, `IVerifiableIdentityRequest`
149
+
150
+ - `SignTransactionsRequest`
151
+ - [Spec](https://solana-mobile.github.io/mobile-wallet-adapter/spec/spec.html#sign_transactions)
152
+ - Interfaces: `IMWARequest`, `IVerifiableIdentityRequest`
153
+
154
+ - `SignAndSendTransactionsRequest`
155
+ - [Spec](https://solana-mobile.github.io/mobile-wallet-adapter/spec/spec.html#sign_and_send_transactions)
156
+ - Interfaces: `IMWARequest`, `IVerifiableIdentityRequest`
157
+
100
158
 
@@ -135,6 +135,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
135
135
  dependencies {
136
136
  //noinspection GradleDynamicVersion
137
137
  implementation "com.facebook.react:react-native:+" // From node_modules
138
+ implementation 'com.solanamobile:digital-asset-links-android:1.0.2'
138
139
  implementation "com.solanamobile:mobile-wallet-adapter-walletlib:1.1.0"
139
140
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
140
141
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
@@ -1,9 +1,11 @@
1
1
  package com.solanamobile.mobilewalletadapterwalletlib.reactnative
2
2
 
3
3
  import com.solanamobile.mobilewalletadapterwalletlib.reactnative.model.AuthorizeDappResponse
4
+ import com.solanamobile.mobilewalletadapterwalletlib.reactnative.model.DeauthorizeDappResponse
4
5
  import com.solanamobile.mobilewalletadapterwalletlib.reactnative.model.MobileWalletAdapterFailureResponse
5
6
  import com.solanamobile.mobilewalletadapterwalletlib.reactnative.model.MobileWalletAdapterRequest
6
7
  import com.solanamobile.mobilewalletadapterwalletlib.reactnative.model.MobileWalletAdapterResponse
8
+ import com.solanamobile.mobilewalletadapterwalletlib.reactnative.model.ReauthorizeDappResponse
7
9
  import com.solanamobile.mobilewalletadapterwalletlib.reactnative.model.SignedAndSentTransactions
8
10
  import com.solanamobile.mobilewalletadapterwalletlib.reactnative.model.SignedPayloads
9
11
  import kotlinx.serialization.DeserializationStrategy
@@ -17,8 +19,10 @@ import kotlinx.serialization.encoding.Decoder
17
19
  import kotlinx.serialization.encoding.Encoder
18
20
  import kotlinx.serialization.json.JsonContentPolymorphicSerializer
19
21
  import kotlinx.serialization.json.JsonElement
22
+ import kotlinx.serialization.json.JsonNull
20
23
  import kotlinx.serialization.json.JsonObject
21
24
  import kotlinx.serialization.json.JsonTransformingSerializer
25
+ import kotlinx.serialization.json.buildJsonObject
22
26
 
23
27
  internal open class TypeTransformingSerializer<T: Any>(serializer: KSerializer<T>) : JsonTransformingSerializer<T>(serializer) {
24
28
  override fun transformSerialize(element: JsonElement): JsonElement =
@@ -36,6 +40,29 @@ internal open class TypeTransformingSerializer<T: Any>(serializer: KSerializer<T
36
40
  else element
37
41
  }
38
42
 
43
+ internal object AppIdentityTransformingSerializer : JsonTransformingSerializer<MobileWalletAdapterRequest>(MobileWalletAdapterRequest.serializer()) {
44
+ override fun transformSerialize(element: JsonElement): JsonElement =
45
+ if ((element as? JsonObject)?.containsKey("identityUri") == true)
46
+ JsonObject(element.toMutableMap().apply {
47
+ this["appIdentity"] = buildJsonObject {
48
+ put("identityName", this@apply.remove("identityName") ?: JsonNull)
49
+ put("identityUri", this@apply.remove("identityUri") ?: JsonNull)
50
+ put("iconRelativeUri", this@apply.remove("iconRelativeUri") ?: JsonNull)
51
+ }
52
+ })
53
+ else element
54
+
55
+ override fun transformDeserialize(element: JsonElement): JsonElement =
56
+ if ((element as? JsonObject)?.containsKey("appIdentity") == true)
57
+ JsonObject(element.toMutableMap().apply {
58
+ val appIdentity = this.remove("appIdentity")!! as JsonObject
59
+ put("identityName", appIdentity["identityName"] ?: JsonNull)
60
+ put("identityUri", appIdentity["identityUri"] ?: JsonNull)
61
+ put("iconRelativeUri", appIdentity["iconRelativeUri"] ?: JsonNull)
62
+ })
63
+ else element
64
+ }
65
+
39
66
  internal object FailReasonTransformingSerializer
40
67
  : JsonTransformingSerializer<MobileWalletAdapterFailureResponse>(MobileWalletAdapterFailureResponse.serializer()) {
41
68
  override fun transformDeserialize(element: JsonElement): JsonElement =
@@ -50,12 +77,14 @@ internal object MobileWalletAdapterResponseSerializer : JsonContentPolymorphicSe
50
77
  override fun selectDeserializer(element: JsonElement): DeserializationStrategy<out MobileWalletAdapterResponse> =
51
78
  if ((element as? JsonObject)?.containsKey("failReason") == true) FailReasonTransformingSerializer
52
79
  else if ((element as? JsonObject)?.containsKey("publicKey") == true) AuthorizeDappResponse.serializer()
80
+ else if ((element as? JsonObject)?.containsKey("authorizationScope") == true) ReauthorizeDappResponse.serializer()
53
81
  else if ((element as? JsonObject)?.containsKey("signedPayloads") == true) SignedPayloads.serializer()
54
82
  else if ((element as? JsonObject)?.containsKey("signedTransactions") == true) SignedAndSentTransactions.serializer()
83
+ else if ((element as? JsonObject)?.isEmpty() == true) DeauthorizeDappResponse.serializer()
55
84
  else MobileWalletAdapterResponse.serializer()
56
85
  }
57
86
 
58
- internal object MobileWalletAdapterRequestSerializer : TypeTransformingSerializer<MobileWalletAdapterRequest>(MobileWalletAdapterRequest.serializer())
87
+ internal object MobileWalletAdapterRequestSerializer : TypeTransformingSerializer<MobileWalletAdapterRequest>(AppIdentityTransformingSerializer)
59
88
 
60
89
  internal object ByteArrayAsMapSerializer : KSerializer<ByteArray> {
61
90
  override val descriptor: SerialDescriptor = ByteArraySerializer().descriptor
@@ -7,7 +7,10 @@ import com.facebook.react.uimanager.ViewManager
7
7
 
8
8
  class MobileWalletAdapterWalletLibReactNativePackage : ReactPackage {
9
9
  override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
10
- return listOf(SolanaMobileWalletAdapterWalletLibModule(reactContext))
10
+ return listOf(
11
+ SolanaMobileWalletAdapterWalletLibModule(reactContext),
12
+ SolanaMobileDigitalAssetLinksModule(reactContext)
13
+ )
11
14
  }
12
15
 
13
16
  override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
@@ -0,0 +1,65 @@
1
+ package com.solanamobile.mobilewalletadapterwalletlib.reactnative
2
+
3
+ import android.util.Log
4
+ import android.os.Build
5
+ import com.facebook.react.bridge.*
6
+ import com.solana.digitalassetlinks.AndroidAppPackageVerifier
7
+ import java.net.URI
8
+
9
+ class SolanaMobileDigitalAssetLinksModule(val reactContext: ReactApplicationContext) :
10
+ ReactContextBaseJavaModule(reactContext){
11
+
12
+ // Sets the name of the module in React, accessible at ReactNative.NativeModules.SolanaMobileDigitalAssetLinks
13
+ override fun getName() = "SolanaMobileDigitalAssetLinks"
14
+
15
+ @ReactMethod
16
+ fun getCallingPackage(promise: Promise) {
17
+ promise.resolve(currentActivity?.callingPackage)
18
+ }
19
+
20
+ @ReactMethod
21
+ fun verifyCallingPackage(clientIdentityUri: String, promise: Promise) {
22
+ currentActivity?.callingPackage?.let { callingPackage ->
23
+ verifyPackage(callingPackage, clientIdentityUri, promise)
24
+ } ?: run {
25
+ promise.resolve(false)
26
+ }
27
+ }
28
+
29
+ @ReactMethod
30
+ fun verifyPackage(packageName: String, clientIdentityUri: String, promise: Promise) {
31
+ val packageManager = reactContext.getPackageManager()
32
+ val verifier = AndroidAppPackageVerifier(packageManager)
33
+ val verified = try {
34
+ verifier.verify(packageName, URI.create(clientIdentityUri))
35
+ } catch (e: AndroidAppPackageVerifier.CouldNotVerifyPackageException) {
36
+ Log.w(TAG, "Package verification failed for package=$packageName, clientIdentityUri=$clientIdentityUri")
37
+ false
38
+ }
39
+ promise.resolve(verified)
40
+ }
41
+
42
+ @ReactMethod
43
+ fun getCallingPackageUid(promise: Promise) {
44
+ currentActivity?.callingPackage?.let { callingPackage ->
45
+ getUidForPackage(callingPackage, promise)
46
+ } ?: run {
47
+ promise.reject(Error("Cannot get UID for calling package: No calling package found"))
48
+ }
49
+ }
50
+
51
+ @ReactMethod
52
+ fun getUidForPackage(packageName: String, promise: Promise) {
53
+ val packageManager = reactContext.getPackageManager()
54
+ val uid = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
55
+ packageManager.getPackageUid(packageName, 0)
56
+ } else {
57
+ packageManager.getApplicationInfo(packageName, 0).uid
58
+ }
59
+ promise.resolve(uid)
60
+ }
61
+
62
+ companion object {
63
+ private val TAG = SolanaMobileDigitalAssetLinksModule::class.simpleName
64
+ }
65
+ }
@@ -69,6 +69,7 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
69
69
  val id: String = UUID.randomUUID().toString()) {
70
70
  data class AuthorizeDapp(override val request: AuthorizeRequest) : MobileWalletAdapterRemoteRequest(request)
71
71
  data class ReauthorizeDapp(override val request: ReauthorizeRequest) : MobileWalletAdapterRemoteRequest(request)
72
+ data class DeauthorizeDapp(override val request: DeauthorizedEvent) : MobileWalletAdapterRemoteRequest(request)
72
73
 
73
74
  sealed class SignPayloads(override val request: SignPayloadsRequest) : MobileWalletAdapterRemoteRequest(request)
74
75
  data class SignTransactions(override val request: SignTransactionsRequest) : SignPayloads(request)
@@ -151,18 +152,12 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
151
152
  /* Generic Request functions */
152
153
  @ReactMethod
153
154
  fun cancelRequest(sessionId: String, requestId: String) {
154
- Log.d(TAG, "Cancelled request $requestId");
155
+ Log.d(TAG, "Cancelled request $requestId")
155
156
  (pendingRequests.remove(requestId) as? ScenarioRequest)?.let { scenarioRequest ->
156
- scenarioRequest.cancel();
157
+ scenarioRequest.cancel()
157
158
  }
158
159
  }
159
160
 
160
- // Apparently we cant have overlaod methods like this becuase React is completly idiotic
161
- // @ReactMethod
162
- // fun resolve(request: ReadableMap, response: ReadableMap) {
163
- // resolve(request.toJson().toString(), response.toJson().toString())
164
- // }
165
-
166
161
  @ReactMethod
167
162
  fun resolve(requestJson: String, responseJson: String) = launch {
168
163
  val completedRequest = json.decodeFromString(MobileWalletAdapterRequestSerializer, requestJson)
@@ -195,22 +190,27 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
195
190
  response.publicKey,
196
191
  response.accountLabel,
197
192
  null, //Uri.parse(response.walletUriBase),
198
- null //response.authorizationScope
193
+ response.authorizationScope
199
194
  )
200
195
  else -> completeWithInvalidResponse()
201
196
  }
202
197
  is ReauthorizeDapp -> when (response) {
203
198
  is MobileWalletAdapterFailureResponse -> {
204
199
  when (response) {
205
- is UserDeclinedResponse ->
200
+ is AuthorizationNotValidResponse ->
206
201
  (pendingRequest as? MobileWalletAdapterRemoteRequest.ReauthorizeDapp)?.request?.completeWithDecline()
207
202
  else -> completeWithInvalidResponse()
208
203
  }
209
204
  }
210
- is AuthorizeDappResponse ->
205
+ is ReauthorizeDappResponse ->
211
206
  (pendingRequest as? MobileWalletAdapterRemoteRequest.ReauthorizeDapp)?.request?.completeWithReauthorize()
212
207
  else -> completeWithInvalidResponse()
213
208
  }
209
+ is DeauthorizeDapp -> when (response) {
210
+ is DeauthorizeDappResponse ->
211
+ (pendingRequest as? MobileWalletAdapterRemoteRequest.DeauthorizeDapp)?.request?.complete()
212
+ else -> completeWithInvalidResponse()
213
+ }
214
214
  is SignAndSendTransactions -> when (response) {
215
215
  is MobileWalletAdapterFailureResponse -> {
216
216
  when (response) {
@@ -283,6 +283,11 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
283
283
  request.request.identityUri.toString(), request.request.iconRelativeUri.toString(),
284
284
  request.request.authorizationScope
285
285
  )
286
+ is MobileWalletAdapterRemoteRequest.DeauthorizeDapp -> DeauthorizeDapp(
287
+ scenarioId!!, request.request.cluster, request.request.identityName,
288
+ request.request.identityUri.toString(), request.request.iconRelativeUri.toString(),
289
+ request.request.authorizationScope
290
+ )
286
291
  is MobileWalletAdapterRemoteRequest.SignMessages -> SignMessages(
287
292
  scenarioId!!, request.request.cluster, request.request.identityName,
288
293
  request.request.identityUri.toString(), request.request.iconRelativeUri.toString(),
@@ -359,9 +364,9 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
359
364
  }
360
365
 
361
366
  override fun onReauthorizeRequest(request: ReauthorizeRequest) {
362
- Log.i(TAG, "Reauthorization request: auto completing, DO NOT DO THIS IN PRODUCTION")
363
- // TODO: Implement client trust use case
364
- request.completeWithReauthorize()
367
+ val request = MobileWalletAdapterRemoteRequest.ReauthorizeDapp(request)
368
+ pendingRequests.put(request.id, request)
369
+ sendWalletServiceRequestToReact(request)
365
370
  }
366
371
 
367
372
  override fun onSignTransactionsRequest(request: SignTransactionsRequest) {
@@ -383,13 +388,10 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
383
388
  sendWalletServiceRequestToReact(request)
384
389
  }
385
390
 
386
- private fun verifyPrivilegedMethodSource(request: VerifiableIdentityRequest): Boolean {
387
- // TODO: Implement client trust use case
388
- return true
389
- }
390
-
391
391
  override fun onDeauthorizedEvent(event: DeauthorizedEvent) {
392
- event.complete()
392
+ val request = MobileWalletAdapterRemoteRequest.DeauthorizeDapp(event)
393
+ pendingRequests.put(request.id, request)
394
+ sendWalletServiceRequestToReact(request)
393
395
  }
394
396
  }
395
397
 
@@ -41,6 +41,17 @@ data class ReauthorizeDapp(
41
41
  override val authorizationScope: ByteArray
42
42
  ) : VerifiableIdentityRequestSurrogate()
43
43
 
44
+ @Serializable
45
+ @SerialName("DEAUTHORIZE_DAPP")
46
+ data class DeauthorizeDapp(
47
+ override val sessionId: String,
48
+ override val cluster: String,
49
+ override val identityName: String?,
50
+ override val identityUri: String?,
51
+ override val iconRelativeUri: String?,
52
+ override val authorizationScope: ByteArray
53
+ ) : VerifiableIdentityRequestSurrogate()
54
+
44
55
  @Serializable
45
56
  sealed class SignPayloads : VerifiableIdentityRequestSurrogate() {
46
57
  abstract val payloads: List<ByteArray>
@@ -32,9 +32,20 @@ data class AuthorizeDappResponse(
32
32
  @Serializable(with = ByteArrayAsMapSerializer::class) val publicKey: ByteArray,
33
33
  val accountLabel: String? = String(publicKey),
34
34
  val walletUriBase: String? = null,
35
- @Serializable(with = ByteArrayAsMapSerializer::class) val authorizationScope: ByteArray? = null
35
+ @Serializable(with = ByteArrayAsMapSerializer::class) val authorizationScope: ByteArray
36
36
  ) : MobileWalletAdapterResponse()
37
37
 
38
+ @Serializable
39
+ data class ReauthorizeDappResponse(
40
+ @Serializable(with = ByteArrayAsMapSerializer::class) val publicKey: ByteArray? = null,
41
+ val accountLabel: String? = publicKey?.let { String(publicKey) },
42
+ val walletUriBase: String? = null,
43
+ @Serializable(with = ByteArrayAsMapSerializer::class) val authorizationScope: ByteArray
44
+ ) : MobileWalletAdapterResponse()
45
+
46
+ @Serializable
47
+ object DeauthorizeDappResponse : MobileWalletAdapterResponse()
48
+
38
49
  @Serializable
39
50
  data class SignedPayloads(
40
51
  @Serializable(with = ByteArrayCollectionAsMapCollectionSerializer::class) val signedPayloads: List<ByteArray>
@@ -36,4 +36,15 @@ Object.keys(_useMobileWalletAdapterSession).forEach(function (key) {
36
36
  }
37
37
  });
38
38
  });
39
+ var _useDigitalAssetLinks = require("./useDigitalAssetLinks.js");
40
+ Object.keys(_useDigitalAssetLinks).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _useDigitalAssetLinks[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _useDigitalAssetLinks[key];
47
+ }
48
+ });
49
+ });
39
50
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_mwaSessionEvents","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_resolve","_useMobileWalletAdapterSession"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,iBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,iBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,iBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,QAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,QAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,QAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,QAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,8BAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,8BAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,8BAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,8BAAA,CAAAN,GAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":["_mwaSessionEvents","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_resolve","_useMobileWalletAdapterSession","_useDigitalAssetLinks"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,iBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,iBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,iBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,QAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,QAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,QAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,QAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,8BAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,8BAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,8BAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,8BAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,qBAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,qBAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,qBAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,qBAAA,CAAAP,GAAA;IAAA;EAAA;AAAA"}
@@ -39,6 +39,8 @@ let MWARequestFailReason = /*#__PURE__*/function (MWARequestFailReason) {
39
39
  return MWARequestFailReason;
40
40
  }({});
41
41
  /* Authorize Dapp */
42
+ /* Reauthorize Dapp */
43
+ /* Deauthorize Dapp */
42
44
  /* Sign Transactions/Messages */
43
45
  /* Sign and Send Transaction */
44
46
  exports.MWARequestFailReason = MWARequestFailReason;
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","Platform","OS","NativeModules","Proxy","get","Error","MWARequestType","exports","MWARequestFailReason","resolve","request","response","JSON","stringify"],"sourceRoot":"../../src","sources":["resolve.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACd,iGAAgG,GACjG,sDAAsD,GACtD,uCAAuC,GACvC,sGAAsG,GACtG,qHAAqH,GACrH,6CAA6C;AAEjD,MAAMC,kCAAkC,GACpCC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAIC,0BAAa,CAACH,kCAAkC,GACvEG,0BAAa,CAACH,kCAAkC,GAChD,IAAII,KAAK,CACL,CAAC,CAAC,EACF;EACIC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CACXL,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACnB,mGAAmG,GACnGH,aACV,CAAC;EACL;AACJ,CACJ,CAAC;;AAQX;AACA;AACA;AACA;AAHA,IAWYQ,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAmD1B;AACA;AACA;AAFAC,OAAA,CAAAD,cAAA,GAAAA,cAAA;AAUA;AAAA,IACYE,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAwBhC;AASA;AAWA;AAAAD,OAAA,CAAAC,oBAAA,GAAAA,oBAAA;AAaO,SAASC,OAAOA,CAACC,OAAmB,EAAEC,QAAiB,EAAQ;EAClEZ,kCAAkC,CAACU,OAAO,CAACG,IAAI,CAACC,SAAS,CAACH,OAAO,CAAC,EAAEE,IAAI,CAACC,SAAS,CAACF,QAAQ,CAAC,CAAC;AACjG"}
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","Platform","OS","NativeModules","Proxy","get","Error","MWARequestType","exports","MWARequestFailReason","resolve","request","response","JSON","stringify"],"sourceRoot":"../../src","sources":["resolve.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACd,iGAAgG,GACjG,sDAAsD,GACtD,uCAAuC,GACvC,sGAAsG,GACtG,qHAAqH,GACrH,6CAA6C;AAEjD,MAAMC,kCAAkC,GACpCC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAIC,0BAAa,CAACH,kCAAkC,GACvEG,0BAAa,CAACH,kCAAkC,GAChD,IAAII,KAAK,CACL,CAAC,CAAC,EACF;EACIC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CACXL,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACnB,mGAAmG,GACnGH,aACV,CAAC;EACL;AACJ,CACJ,CAAC;;AAQX;AACA;AACA;AACA;AAHA,IAaYQ,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AA8D1B;AACA;AACA;AAFAC,OAAA,CAAAD,cAAA,GAAAA,cAAA;AAYA;AAAA,IACYE,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAwBhC;AASA;AAMA;AAIA;AAWA;AAAAD,OAAA,CAAAC,oBAAA,GAAAA,oBAAA;AAeO,SAASC,OAAOA,CAACC,OAAmB,EAAEC,QAAqB,EAAQ;EACtEZ,kCAAkC,CAACU,OAAO,CAACG,IAAI,CAACC,SAAS,CAACH,OAAO,CAAC,EAAEE,IAAI,CAACC,SAAS,CAACF,QAAQ,CAAC,CAAC;AACjG"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCallingPackage = getCallingPackage;
7
+ exports.getCallingPackageUid = getCallingPackageUid;
8
+ exports.getUidForPackage = getUidForPackage;
9
+ exports.verifyCallingPackage = verifyCallingPackage;
10
+ var _reactNative = require("react-native");
11
+ const LINKING_ERROR = `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` + '- You rebuilt the app after installing the package\n' + '- If you are using Lerna workspaces\n' + ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n' + ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n' + '- You are not using Expo managed workflow\n';
12
+ const SolanaMobileDigitalAssetLinks = _reactNative.Platform.OS === 'android' && _reactNative.NativeModules.SolanaMobileDigitalAssetLinks ? _reactNative.NativeModules.SolanaMobileDigitalAssetLinks : new Proxy({}, {
13
+ get() {
14
+ throw new Error(_reactNative.Platform.OS !== 'android' ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android' : LINKING_ERROR);
15
+ }
16
+ });
17
+ async function getCallingPackage() {
18
+ return await SolanaMobileDigitalAssetLinks.getCallingPackage();
19
+ }
20
+ async function verifyCallingPackage(clientIdentityUri) {
21
+ return await SolanaMobileDigitalAssetLinks.verifyCallingPackage(clientIdentityUri);
22
+ }
23
+ async function getCallingPackageUid() {
24
+ return await SolanaMobileDigitalAssetLinks.getCallingPackageUid();
25
+ }
26
+ async function getUidForPackage(packageName) {
27
+ return await SolanaMobileDigitalAssetLinks.getUidForPackage(packageName);
28
+ }
29
+ //# sourceMappingURL=useDigitalAssetLinks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","SolanaMobileDigitalAssetLinks","Platform","OS","NativeModules","Proxy","get","Error","getCallingPackage","verifyCallingPackage","clientIdentityUri","getCallingPackageUid","getUidForPackage","packageName"],"sourceRoot":"../../src","sources":["useDigitalAssetLinks.ts"],"mappings":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACd,iGAAgG,GACjG,sDAAsD,GACtD,uCAAuC,GACvC,sGAAsG,GACtG,qHAAqH,GACrH,6CAA6C;AAEjD,MAAMC,6BAA6B,GAC/BC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAIC,0BAAa,CAACH,6BAA6B,GAClEG,0BAAa,CAACH,6BAA6B,GAC3C,IAAII,KAAK,CACL,CAAC,CAAC,EACF;EACIC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CACXL,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACnB,mGAAmG,GACnGH,aACV,CAAC;EACL;AACJ,CACJ,CAAC;AAEJ,eAAeQ,iBAAiBA,CAAA,EAAgC;EACnE,OAAO,MAAMP,6BAA6B,CAACO,iBAAiB,CAAC,CAAC;AAClE;AAEO,eAAeC,oBAAoBA,CAACC,iBAAyB,EAAE;EAClE,OAAO,MAAMT,6BAA6B,CAACQ,oBAAoB,CAACC,iBAAiB,CAAC;AACtF;AAEO,eAAeC,oBAAoBA,CAAA,EAAG;EACzC,OAAO,MAAMV,6BAA6B,CAACU,oBAAoB,CAAC,CAAC;AACrE;AAEO,eAAeC,gBAAgBA,CAACC,WAAmB,EAAE;EACxD,OAAO,MAAMZ,6BAA6B,CAACW,gBAAgB,CAACC,WAAW,CAAC;AAC5E"}
@@ -28,18 +28,22 @@ function useMobileWalletAdapterSession(walletName, config, handleRequest, handle
28
28
  console.warn('Unexpected native event type');
29
29
  }
30
30
  });
31
+ initializeScenario(walletName, config);
31
32
  return () => {
32
33
  listener.remove();
33
34
  };
34
35
  }, []);
35
- initializeScenario(walletName, config);
36
36
  }
37
37
  async function initializeScenario(walletName, walletConfig) {
38
38
  // Get initial URL
39
39
  const initialUrl = await _reactNative.Linking.getInitialURL();
40
40
 
41
41
  // Create Scenario and establish session with dapp
42
- SolanaMobileWalletAdapterWalletLib.createScenario(walletName, initialUrl, JSON.stringify(walletConfig));
42
+ if (initialUrl) {
43
+ SolanaMobileWalletAdapterWalletLib.createScenario(walletName, initialUrl, JSON.stringify(walletConfig));
44
+ } else {
45
+ console.warn('Initial URL is unexpectedly uninitialized');
46
+ }
43
47
  }
44
48
  function isMWARequest(nativeEvent) {
45
49
  return Object.values(_resolve.MWARequestType).includes(nativeEvent.__type);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","_mwaSessionEvents","_resolve","LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","Platform","OS","NativeModules","Proxy","get","Error","MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME","useMobileWalletAdapterSession","walletName","config","handleRequest","handleSessionEvent","useEffect","mwaEventEmitter","NativeEventEmitter","listener","addListener","nativeEvent","isMWARequest","isMWASessionEvent","console","warn","remove","initializeScenario","walletConfig","initialUrl","Linking","getInitialURL","createScenario","JSON","stringify","Object","values","MWARequestType","includes","__type","MWASessionEventType"],"sourceRoot":"../../src","sources":["useMobileWalletAdapterSession.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,MAAMI,aAAa,GACd,iGAAgG,GACjG,sDAAsD,GACtD,uCAAuC,GACvC,sGAAsG,GACtG,qHAAqH,GACrH,6CAA6C;AAEjD,MAAMC,kCAAkC,GACpCC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAIC,0BAAa,CAACH,kCAAkC,GACvEG,0BAAa,CAACH,kCAAkC,GAChD,IAAII,KAAK,CACL,CAAC,CAAC,EACF;EACIC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CACXL,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACnB,mGAAmG,GACnGH,aACV,CAAC;EACL;AACJ,CACJ,CAAC;AAEX,MAAMQ,uCAAuC,GAAG,yCAAyC;AAUlF,SAASC,6BAA6BA,CACzCC,UAAkB,EAClBC,MAAiC,EACjCC,aAA4C,EAC5CC,kBAA2D,EAC7D;EACE;EACA,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,eAAe,GAAG,IAAIC,+BAAkB,CAAC,CAAC;IAChD,MAAMC,QAAQ,GAAGF,eAAe,CAACG,WAAW,CAACV,uCAAuC,EAAGW,WAAW,IAAK;MACnG,IAAIC,YAAY,CAACD,WAAW,CAAC,EAAE;QAC3BP,aAAa,CAACO,WAAyB,CAAC;MAC5C,CAAC,MAAM,IAAIE,iBAAiB,CAACF,WAAW,CAAC,EAAE;QACvCN,kBAAkB,CAACM,WAA8B,CAAC;MACtD,CAAC,MAAM;QACHG,OAAO,CAACC,IAAI,CAAC,8BAA8B,CAAC;MAChD;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTN,QAAQ,CAACO,MAAM,CAAC,CAAC;IACrB,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAENC,kBAAkB,CAACf,UAAU,EAAEC,MAAM,CAAC;AAC1C;AAEA,eAAec,kBAAkBA,CAACf,UAAkB,EAAEgB,YAAuC,EAAE;EAC3F;EACA,MAAMC,UAAU,GAAG,MAAMC,oBAAO,CAACC,aAAa,CAAC,CAAC;;EAEhD;EACA5B,kCAAkC,CAAC6B,cAAc,CAACpB,UAAU,EAAEiB,UAAU,EAAEI,IAAI,CAACC,SAAS,CAACN,YAAY,CAAC,CAAC;AAC3G;AAEA,SAASN,YAAYA,CAACD,WAAgB,EAAW;EAC7C,OAAOc,MAAM,CAACC,MAAM,CAACC,uBAAc,CAAC,CAACC,QAAQ,CAACjB,WAAW,CAACkB,MAAM,CAAC;AACrE;AAEA,SAAShB,iBAAiBA,CAACF,WAAgB,EAAE;EACzC,OAAOc,MAAM,CAACC,MAAM,CAACI,qCAAmB,CAAC,CAACF,QAAQ,CAACjB,WAAW,CAACkB,MAAM,CAAC;AAC1E"}
1
+ {"version":3,"names":["_react","require","_reactNative","_mwaSessionEvents","_resolve","LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","Platform","OS","NativeModules","Proxy","get","Error","MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME","useMobileWalletAdapterSession","walletName","config","handleRequest","handleSessionEvent","useEffect","mwaEventEmitter","NativeEventEmitter","listener","addListener","nativeEvent","isMWARequest","isMWASessionEvent","console","warn","initializeScenario","remove","walletConfig","initialUrl","Linking","getInitialURL","createScenario","JSON","stringify","Object","values","MWARequestType","includes","__type","MWASessionEventType"],"sourceRoot":"../../src","sources":["useMobileWalletAdapterSession.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,MAAMI,aAAa,GACd,iGAAgG,GACjG,sDAAsD,GACtD,uCAAuC,GACvC,sGAAsG,GACtG,qHAAqH,GACrH,6CAA6C;AAEjD,MAAMC,kCAAkC,GACpCC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAIC,0BAAa,CAACH,kCAAkC,GACvEG,0BAAa,CAACH,kCAAkC,GAChD,IAAII,KAAK,CACL,CAAC,CAAC,EACF;EACIC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CACXL,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACnB,mGAAmG,GACnGH,aACV,CAAC;EACL;AACJ,CACJ,CAAC;AAEX,MAAMQ,uCAAuC,GAAG,yCAAyC;AAUlF,SAASC,6BAA6BA,CACzCC,UAAkB,EAClBC,MAAiC,EACjCC,aAA4C,EAC5CC,kBAA2D,EAC7D;EACE;EACA,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,eAAe,GAAG,IAAIC,+BAAkB,CAAC,CAAC;IAChD,MAAMC,QAAQ,GAAGF,eAAe,CAACG,WAAW,CAACV,uCAAuC,EAAGW,WAAW,IAAK;MACnG,IAAIC,YAAY,CAACD,WAAW,CAAC,EAAE;QAC3BP,aAAa,CAACO,WAAyB,CAAC;MAC5C,CAAC,MAAM,IAAIE,iBAAiB,CAACF,WAAW,CAAC,EAAE;QACvCN,kBAAkB,CAACM,WAA8B,CAAC;MACtD,CAAC,MAAM;QACHG,OAAO,CAACC,IAAI,CAAC,8BAA8B,CAAC;MAChD;IACJ,CAAC,CAAC;IACFC,kBAAkB,CAACd,UAAU,EAAEC,MAAM,CAAC;IAEtC,OAAO,MAAM;MACTM,QAAQ,CAACQ,MAAM,CAAC,CAAC;IACrB,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;AACV;AAEA,eAAeD,kBAAkBA,CAACd,UAAkB,EAAEgB,YAAuC,EAAE;EAC3F;EACA,MAAMC,UAAU,GAAG,MAAMC,oBAAO,CAACC,aAAa,CAAC,CAAC;;EAEhD;EACA,IAAIF,UAAU,EAAE;IACZ1B,kCAAkC,CAAC6B,cAAc,CAACpB,UAAU,EAAEiB,UAAU,EAAEI,IAAI,CAACC,SAAS,CAACN,YAAY,CAAC,CAAC;EAC3G,CAAC,MAAM;IACHJ,OAAO,CAACC,IAAI,CAAC,2CAA2C,CAAC;EAC7D;AACJ;AAEA,SAASH,YAAYA,CAACD,WAAgB,EAAW;EAC7C,OAAOc,MAAM,CAACC,MAAM,CAACC,uBAAc,CAAC,CAACC,QAAQ,CAACjB,WAAW,CAACkB,MAAM,CAAC;AACrE;AAEA,SAAShB,iBAAiBA,CAACF,WAAgB,EAAE;EACzC,OAAOc,MAAM,CAACC,MAAM,CAACI,qCAAmB,CAAC,CAACF,QAAQ,CAACjB,WAAW,CAACkB,MAAM,CAAC;AAC1E"}
@@ -1,4 +1,5 @@
1
1
  export * from './mwaSessionEvents.js';
2
2
  export * from './resolve.js';
3
3
  export * from './useMobileWalletAdapterSession.js';
4
+ export * from './useDigitalAssetLinks.js';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,cAAc,uBAAuB;AACrC,cAAc,cAAc;AAC5B,cAAc,oCAAoC"}
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,cAAc,uBAAuB;AACrC,cAAc,cAAc;AAC5B,cAAc,oCAAoC;AAClD,cAAc,2BAA2B"}
@@ -36,6 +36,10 @@ export let MWARequestFailReason = /*#__PURE__*/function (MWARequestFailReason) {
36
36
 
37
37
  /* Authorize Dapp */
38
38
 
39
+ /* Reauthorize Dapp */
40
+
41
+ /* Deauthorize Dapp */
42
+
39
43
  /* Sign Transactions/Messages */
40
44
 
41
45
  /* Sign and Send Transaction */
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","OS","Proxy","get","Error","MWARequestType","MWARequestFailReason","resolve","request","response","JSON","stringify"],"sourceRoot":"../../src","sources":["resolve.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACd,iGAAgG,GACjG,sDAAsD,GACtD,uCAAuC,GACvC,sGAAsG,GACtG,qHAAqH,GACrH,6CAA6C;AAEjD,MAAMC,kCAAkC,GACpCF,QAAQ,CAACG,EAAE,KAAK,SAAS,IAAIJ,aAAa,CAACG,kCAAkC,GACvEH,aAAa,CAACG,kCAAkC,GAChD,IAAIE,KAAK,CACL,CAAC,CAAC,EACF;EACIC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CACXN,QAAQ,CAACG,EAAE,KAAK,SAAS,GACnB,mGAAmG,GACnGF,aACV,CAAC;EACL;AACJ,CACJ,CAAC;;AAQX;AACA;AACA;AACA;;AAQA,WAAYM,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;;AAmD1B;AACA;AACA;;AAQA;AACA,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;;AAwBhC;;AASA;;AAWA;;AAaA,OAAO,SAASC,OAAOA,CAACC,OAAmB,EAAEC,QAAiB,EAAQ;EAClET,kCAAkC,CAACO,OAAO,CAACG,IAAI,CAACC,SAAS,CAACH,OAAO,CAAC,EAAEE,IAAI,CAACC,SAAS,CAACF,QAAQ,CAAC,CAAC;AACjG"}
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","OS","Proxy","get","Error","MWARequestType","MWARequestFailReason","resolve","request","response","JSON","stringify"],"sourceRoot":"../../src","sources":["resolve.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACd,iGAAgG,GACjG,sDAAsD,GACtD,uCAAuC,GACvC,sGAAsG,GACtG,qHAAqH,GACrH,6CAA6C;AAEjD,MAAMC,kCAAkC,GACpCF,QAAQ,CAACG,EAAE,KAAK,SAAS,IAAIJ,aAAa,CAACG,kCAAkC,GACvEH,aAAa,CAACG,kCAAkC,GAChD,IAAIE,KAAK,CACL,CAAC,CAAC,EACF;EACIC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CACXN,QAAQ,CAACG,EAAE,KAAK,SAAS,GACnB,mGAAmG,GACnGF,aACV,CAAC;EACL;AACJ,CACJ,CAAC;;AAQX;AACA;AACA;AACA;;AAUA,WAAYM,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;;AA8D1B;AACA;AACA;;AAUA;AACA,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;;AAwBhC;;AASA;;AAMA;;AAIA;;AAWA;;AAeA,OAAO,SAASC,OAAOA,CAACC,OAAmB,EAAEC,QAAqB,EAAQ;EACtET,kCAAkC,CAACO,OAAO,CAACG,IAAI,CAACC,SAAS,CAACH,OAAO,CAAC,EAAEE,IAAI,CAACC,SAAS,CAACF,QAAQ,CAAC,CAAC;AACjG"}
@@ -0,0 +1,20 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ const LINKING_ERROR = `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` + '- You rebuilt the app after installing the package\n' + '- If you are using Lerna workspaces\n' + ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n' + ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n' + '- You are not using Expo managed workflow\n';
3
+ const SolanaMobileDigitalAssetLinks = Platform.OS === 'android' && NativeModules.SolanaMobileDigitalAssetLinks ? NativeModules.SolanaMobileDigitalAssetLinks : new Proxy({}, {
4
+ get() {
5
+ throw new Error(Platform.OS !== 'android' ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android' : LINKING_ERROR);
6
+ }
7
+ });
8
+ export async function getCallingPackage() {
9
+ return await SolanaMobileDigitalAssetLinks.getCallingPackage();
10
+ }
11
+ export async function verifyCallingPackage(clientIdentityUri) {
12
+ return await SolanaMobileDigitalAssetLinks.verifyCallingPackage(clientIdentityUri);
13
+ }
14
+ export async function getCallingPackageUid() {
15
+ return await SolanaMobileDigitalAssetLinks.getCallingPackageUid();
16
+ }
17
+ export async function getUidForPackage(packageName) {
18
+ return await SolanaMobileDigitalAssetLinks.getUidForPackage(packageName);
19
+ }
20
+ //# sourceMappingURL=useDigitalAssetLinks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","SolanaMobileDigitalAssetLinks","OS","Proxy","get","Error","getCallingPackage","verifyCallingPackage","clientIdentityUri","getCallingPackageUid","getUidForPackage","packageName"],"sourceRoot":"../../src","sources":["useDigitalAssetLinks.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACd,iGAAgG,GACjG,sDAAsD,GACtD,uCAAuC,GACvC,sGAAsG,GACtG,qHAAqH,GACrH,6CAA6C;AAEjD,MAAMC,6BAA6B,GAC/BF,QAAQ,CAACG,EAAE,KAAK,SAAS,IAAIJ,aAAa,CAACG,6BAA6B,GAClEH,aAAa,CAACG,6BAA6B,GAC3C,IAAIE,KAAK,CACL,CAAC,CAAC,EACF;EACIC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CACXN,QAAQ,CAACG,EAAE,KAAK,SAAS,GACnB,mGAAmG,GACnGF,aACV,CAAC;EACL;AACJ,CACJ,CAAC;AAEX,OAAO,eAAeM,iBAAiBA,CAAA,EAAgC;EACnE,OAAO,MAAML,6BAA6B,CAACK,iBAAiB,CAAC,CAAC;AAClE;AAEA,OAAO,eAAeC,oBAAoBA,CAACC,iBAAyB,EAAE;EAClE,OAAO,MAAMP,6BAA6B,CAACM,oBAAoB,CAACC,iBAAiB,CAAC;AACtF;AAEA,OAAO,eAAeC,oBAAoBA,CAAA,EAAG;EACzC,OAAO,MAAMR,6BAA6B,CAACQ,oBAAoB,CAAC,CAAC;AACrE;AAEA,OAAO,eAAeC,gBAAgBA,CAACC,WAAmB,EAAE;EACxD,OAAO,MAAMV,6BAA6B,CAACS,gBAAgB,CAACC,WAAW,CAAC;AAC5E"}
@@ -22,18 +22,22 @@ export function useMobileWalletAdapterSession(walletName, config, handleRequest,
22
22
  console.warn('Unexpected native event type');
23
23
  }
24
24
  });
25
+ initializeScenario(walletName, config);
25
26
  return () => {
26
27
  listener.remove();
27
28
  };
28
29
  }, []);
29
- initializeScenario(walletName, config);
30
30
  }
31
31
  async function initializeScenario(walletName, walletConfig) {
32
32
  // Get initial URL
33
33
  const initialUrl = await Linking.getInitialURL();
34
34
 
35
35
  // Create Scenario and establish session with dapp
36
- SolanaMobileWalletAdapterWalletLib.createScenario(walletName, initialUrl, JSON.stringify(walletConfig));
36
+ if (initialUrl) {
37
+ SolanaMobileWalletAdapterWalletLib.createScenario(walletName, initialUrl, JSON.stringify(walletConfig));
38
+ } else {
39
+ console.warn('Initial URL is unexpectedly uninitialized');
40
+ }
37
41
  }
38
42
  function isMWARequest(nativeEvent) {
39
43
  return Object.values(MWARequestType).includes(nativeEvent.__type);
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","Linking","NativeEventEmitter","NativeModules","Platform","MWASessionEventType","MWARequestType","LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","OS","Proxy","get","Error","MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME","useMobileWalletAdapterSession","walletName","config","handleRequest","handleSessionEvent","mwaEventEmitter","listener","addListener","nativeEvent","isMWARequest","isMWASessionEvent","console","warn","remove","initializeScenario","walletConfig","initialUrl","getInitialURL","createScenario","JSON","stringify","Object","values","includes","__type"],"sourceRoot":"../../src","sources":["useMobileWalletAdapterSession.ts"],"mappings":"AACA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,OAAO,EAAEC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEnF,SAA0BC,mBAAmB,QAAQ,uBAAuB;AAC5E,SAAqBC,cAAc,QAAQ,cAAc;AAEzD,MAAMC,aAAa,GACd,iGAAgG,GACjG,sDAAsD,GACtD,uCAAuC,GACvC,sGAAsG,GACtG,qHAAqH,GACrH,6CAA6C;AAEjD,MAAMC,kCAAkC,GACpCJ,QAAQ,CAACK,EAAE,KAAK,SAAS,IAAIN,aAAa,CAACK,kCAAkC,GACvEL,aAAa,CAACK,kCAAkC,GAChD,IAAIE,KAAK,CACL,CAAC,CAAC,EACF;EACIC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CACXR,QAAQ,CAACK,EAAE,KAAK,SAAS,GACnB,mGAAmG,GACnGF,aACV,CAAC;EACL;AACJ,C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CAACgB,MAAM,CAAC;AAC1E"}
1
+ {"version":3,"names":["useEffect","Linking","NativeEventEmitter","NativeModules","Platform","MWASessionEventType","MWARequestType","LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","OS","Proxy","get","Error","MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME","useMobileWalletAdapterSession","walletName","config","handleRequest","handleSessionEvent","mwaEventEmitter","listener","addListener","nativeEvent","isMWARequest","isMWASessionEvent","console","warn","initializeScenario","remove","walletConfig","initialUrl","getInitialURL","createScenario","JSON","stringify","Object","values","includes","__type"],"sourceRoot":"../../src","sources":["useMobileWalletAdapterSession.ts"],"mappings":"AACA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,OAAO,EAAEC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEnF,SAA0BC,mBAAmB,QAAQ,uBAAuB;AAC5E,SAAqBC,cAAc,QAAQ,cAAc;AAEzD,MAAMC,aAAa,GACd,iGAAgG,GACjG,sDAAsD,GACtD,uCAAuC,GACvC,sGAAsG,GACtG,qHAAqH,GACrH,6CAA6C;AAEjD,MAAMC,kCAAkC,GACpCJ,QAAQ,CAACK,EAAE,KAAK,SAAS,IAAIN,aAAa,CAACK,kCAAkC,GACvEL,aAAa,CAACK,kCAAkC,GAChD,IAAIE,KAAK,CACL,CAAC,CAAC,EACF;EACIC,GAAGA,CAAA,EAAG;IACF,MAAM,IAAIC,KAAK,CACXR,QAAQ,CAACK,EAAE,KAAK,SAAS,GACnB,mGAAmG,GACnGF,aACV,CAAC;EACL;AACJ,CACJ,CAAC;AAEX,MAAMM,uCAAuC,GAAG,yCAAyC;AAUzF,OAAO,SAASC,6BAA6BA,CACzCC,UAAkB,EAClBC,MAAiC,EACjCC,aAA4C,EAC5CC,kBAA2D,EAC7D;EACE;EACAlB,SAAS,CAAC,MAAM;IACZ,MAAMmB,eAAe,GAAG,IAAIjB,kBAAkB,CAAC,CAAC;IAChD,MAAMkB,QAAQ,GAAGD,eAAe,CAACE,WAAW,CAACR,uCAAuC,EAAGS,WAAW,IAAK;MACnG,IAAIC,YAAY,CAACD,WAAW,CAAC,EAAE;QAC3BL,aAAa,CAACK,WAAyB,CAAC;MAC5C,CAAC,MAAM,IAAIE,iBAAiB,CAACF,WAAW,CAAC,EAAE;QACvCJ,kBAAkB,CAACI,WAA8B,CAAC;MACtD,CAAC,MAAM;QACHG,OAAO,CAACC,IAAI,CAAC,8BAA8B,CAAC;MAChD;IACJ,CAAC,CAAC;IACFC,kBAAkB,CAACZ,UAAU,EAAEC,MAAM,CAAC;IAEtC,OAAO,MAAM;MACTI,QAAQ,CAACQ,MAAM,CAAC,CAAC;IACrB,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;AACV;AAEA,eAAeD,kBAAkBA,CAACZ,UAAkB,EAAEc,YAAuC,EAAE;EAC3F;EACA,MAAMC,UAAU,GAAG,MAAM7B,OAAO,CAAC8B,aAAa,CAAC,CAAC;;EAEhD;EACA,IAAID,UAAU,EAAE;IACZtB,kCAAkC,CAACwB,cAAc,CAACjB,UAAU,EAAEe,UAAU,EAAEG,IAAI,CAACC,SAAS,CAACL,YAAY,CAAC,CAAC;EAC3G,CAAC,MAAM;IACHJ,OAAO,CAACC,IAAI,CAAC,2CAA2C,CAAC;EAC7D;AACJ;AAEA,SAASH,YAAYA,CAACD,WAAgB,EAAW;EAC7C,OAAOa,MAAM,CAACC,MAAM,CAAC9B,cAAc,CAAC,CAAC+B,QAAQ,CAACf,WAAW,CAACgB,MAAM,CAAC;AACrE;AAEA,SAASd,iBAAiBA,CAACF,WAAgB,EAAE;EACzC,OAAOa,MAAM,CAACC,MAAM,CAAC/B,mBAAmB,CAAC,CAACgC,QAAQ,CAACf,WAAW,CAACgB,MAAM,CAAC;AAC1E"}
@@ -1,4 +1,5 @@
1
1
  export * from './mwaSessionEvents.js';
2
2
  export * from './resolve.js';
3
3
  export * from './useMobileWalletAdapterSession.js';
4
+ export * from './useDigitalAssetLinks.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC"}
@@ -7,7 +7,7 @@ declare type AppIdentity = Readonly<{
7
7
  * Mobile Wallet Adapter Requests are remote requests coming from
8
8
  * the dApp for authorization, signing, and sending services.
9
9
  */
10
- export declare type MWARequest = SignMessagesRequest | SignTransactionsRequest | SignAndSendTransactionsRequest | AuthorizeDappRequest;
10
+ export declare type MWARequest = SignMessagesRequest | SignTransactionsRequest | SignAndSendTransactionsRequest | AuthorizeDappRequest | ReauthorizeDappRequest | DeauthorizeDappRequest;
11
11
  export declare enum MWARequestType {
12
12
  AuthorizeDappRequest = "AUTHORIZE_DAPP",
13
13
  ReauthorizeDappRequest = "REAUTHORIZE_DAPP",
@@ -20,36 +20,40 @@ interface IMWARequest {
20
20
  __type: MWARequestType;
21
21
  requestId: string;
22
22
  sessionId: string;
23
+ }
24
+ interface IVerifiableIdentityRequest {
23
25
  cluster: string;
24
26
  authorizationScope: Uint8Array;
25
27
  appIdentity?: AppIdentity;
26
28
  }
27
29
  export declare type AuthorizeDappRequest = Readonly<{
28
30
  __type: MWARequestType.AuthorizeDappRequest;
31
+ cluster: string;
32
+ appIdentity?: AppIdentity;
29
33
  }> & IMWARequest;
30
34
  export declare type ReauthorizeDappRequest = Readonly<{
31
35
  __type: MWARequestType.ReauthorizeDappRequest;
32
- }> & IMWARequest;
36
+ }> & IMWARequest & IVerifiableIdentityRequest;
33
37
  export declare type DeauthorizeDappRequest = Readonly<{
34
38
  __type: MWARequestType.DeauthorizeDappRequest;
35
- }> & IMWARequest;
39
+ }> & IMWARequest & IVerifiableIdentityRequest;
36
40
  export declare type SignMessagesRequest = Readonly<{
37
41
  __type: MWARequestType.SignMessagesRequest;
38
42
  payloads: Uint8Array[];
39
- }> & IMWARequest;
43
+ }> & IMWARequest & IVerifiableIdentityRequest;
40
44
  export declare type SignTransactionsRequest = Readonly<{
41
45
  __type: MWARequestType.SignTransactionsRequest;
42
46
  payloads: Uint8Array[];
43
- }> & IMWARequest;
47
+ }> & IMWARequest & IVerifiableIdentityRequest;
44
48
  export declare type SignAndSendTransactionsRequest = Readonly<{
45
49
  __type: MWARequestType.SignAndSendTransactionsRequest;
46
50
  payloads: Uint8Array[];
47
51
  minContextSlot?: number;
48
- }> & IMWARequest;
52
+ }> & IMWARequest & IVerifiableIdentityRequest;
49
53
  /**
50
54
  * MWA Request Responses
51
55
  */
52
- export declare type MWAResponse = AuthorizeDappResponse | SignMessagesResponse | SignTransactionsResponse | SignAndSendTransactionsResponse;
56
+ export declare type MWAResponse = AuthorizeDappResponse | ReauthorizeDappResponse | DeauthorizeDappResponse | SignMessagesResponse | SignTransactionsResponse | SignAndSendTransactionsResponse;
53
57
  export declare enum MWARequestFailReason {
54
58
  UserDeclined = "USER_DECLINED",
55
59
  TooManyPayloads = "TOO_MANY_PAYLOADS",
@@ -76,6 +80,12 @@ export declare type AuthorizeDappCompleteResponse = Readonly<{
76
80
  authorizationScope?: Uint8Array;
77
81
  }>;
78
82
  export declare type AuthorizeDappResponse = AuthorizeDappCompleteResponse | UserDeclinedResponse;
83
+ export declare type ReauthorizeDappCompleteResponse = Readonly<{
84
+ authorizationScope?: Uint8Array;
85
+ }>;
86
+ export declare type ReauthorizeDappResponse = ReauthorizeDappCompleteResponse | AuthorizationNotValidResponse;
87
+ export declare type DeauthorizeDappCompleteResponse = Readonly<{}>;
88
+ export declare type DeauthorizeDappResponse = DeauthorizeDappCompleteResponse | AuthorizationNotValidResponse;
79
89
  export declare type SignPayloadsCompleteResponse = Readonly<{
80
90
  signedPayloads: Uint8Array[];
81
91
  }>;
@@ -87,6 +97,8 @@ export declare type SignAndSendTransactionsCompleteResponse = Readonly<{
87
97
  }>;
88
98
  export declare type SignAndSendTransactionsResponse = SignAndSendTransactionsCompleteResponse | UserDeclinedResponse | TooManyPayloadsResponse | AuthorizationNotValidResponse | InvalidSignaturesResponse;
89
99
  export declare function resolve(request: AuthorizeDappRequest, response: AuthorizeDappResponse): void;
100
+ export declare function resolve(request: ReauthorizeDappRequest, response: ReauthorizeDappResponse): void;
101
+ export declare function resolve(request: DeauthorizeDappRequest, response: DeauthorizeDappResponse): void;
90
102
  export declare function resolve(request: SignMessagesRequest, response: SignMessagesResponse): void;
91
103
  export declare function resolve(request: SignTransactionsRequest, response: SignTransactionsResponse): void;
92
104
  export declare function resolve(request: SignAndSendTransactionsRequest, response: SignAndSendTransactionsResponse): void;
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/resolve.ts"],"names":[],"mappings":"AA0BA,aAAK,WAAW,GAAG,QAAQ,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC,CAAC;AAEH;;;GAGG;AAEH,oBAAY,UAAU,GAChB,mBAAmB,GACnB,uBAAuB,GACvB,8BAA8B,GAC9B,oBAAoB,CAAC;AAE3B,oBAAY,cAAc;IACtB,oBAAoB,mBAAmB;IACvC,sBAAsB,qBAAqB;IAC3C,sBAAsB,qBAAqB;IAC3C,mBAAmB,kBAAkB;IACrC,uBAAuB,sBAAsB;IAC7C,8BAA8B,+BAA+B;CAChE;AACD,UAAU,WAAW;IACjB,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,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6BAA6B,GAC7B,yBAAyB,CAAC;AAEhC,wBAAgB,OAAO,CAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAAC;AAC9F,wBAAgB,OAAO,CAAC,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAAC;AAClG,wBAAgB,OAAO,CAAC,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAAC;AAClG,wBAAgB,OAAO,CAAC,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;AAC5F,wBAAgB,OAAO,CAAC,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,wBAAwB,GAAG,IAAI,CAAC;AACpG,wBAAgB,OAAO,CAAC,OAAO,EAAE,8BAA8B,EAAE,QAAQ,EAAE,+BAA+B,GAAG,IAAI,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function getCallingPackage(): Promise<string | undefined>;
2
+ export declare function verifyCallingPackage(clientIdentityUri: string): Promise<any>;
3
+ export declare function getCallingPackageUid(): Promise<any>;
4
+ export declare function getUidForPackage(packageName: string): Promise<any>;
5
+ //# sourceMappingURL=useDigitalAssetLinks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDigitalAssetLinks.d.ts","sourceRoot":"","sources":["../../src/useDigitalAssetLinks.ts"],"names":[],"mappings":"AA0BA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAErE;AAED,wBAAsB,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,gBAEnE;AAED,wBAAsB,oBAAoB,iBAEzC;AAED,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,MAAM,gBAEzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"useMobileWalletAdapterSession.d.ts","sourceRoot":"","sources":["../../src/useMobileWalletAdapterSession.ts"],"names":[],"mappings":"A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,QAoB9D"}
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.0.1",
4
+ "version": "1.0.3",
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",
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './mwaSessionEvents.js';
2
2
  export * from './resolve.js';
3
3
  export * from './useMobileWalletAdapterSession.js';
4
+ export * from './useDigitalAssetLinks.js';
package/src/resolve.ts CHANGED
@@ -39,7 +39,9 @@ export type MWARequest =
39
39
  | SignMessagesRequest
40
40
  | SignTransactionsRequest
41
41
  | SignAndSendTransactionsRequest
42
- | AuthorizeDappRequest;
42
+ | AuthorizeDappRequest
43
+ | ReauthorizeDappRequest
44
+ | DeauthorizeDappRequest;
43
45
 
44
46
  export enum MWARequestType {
45
47
  AuthorizeDappRequest = 'AUTHORIZE_DAPP',
@@ -49,10 +51,14 @@ export enum MWARequestType {
49
51
  SignTransactionsRequest = 'SIGN_TRANSACTIONS',
50
52
  SignAndSendTransactionsRequest = 'SIGN_AND_SEND_TRANSACTIONS',
51
53
  }
54
+
52
55
  interface IMWARequest {
53
56
  __type: MWARequestType;
54
57
  requestId: string;
55
58
  sessionId: string;
59
+ }
60
+
61
+ interface IVerifiableIdentityRequest {
56
62
  cluster: string;
57
63
  authorizationScope: Uint8Array;
58
64
  appIdentity?: AppIdentity;
@@ -60,37 +66,44 @@ interface IMWARequest {
60
66
 
61
67
  export type AuthorizeDappRequest = Readonly<{
62
68
  __type: MWARequestType.AuthorizeDappRequest;
69
+ cluster: string;
70
+ appIdentity?: AppIdentity;
63
71
  }> &
64
72
  IMWARequest;
65
73
 
66
74
  export type ReauthorizeDappRequest = Readonly<{
67
75
  __type: MWARequestType.ReauthorizeDappRequest;
68
76
  }> &
69
- IMWARequest;
77
+ IMWARequest &
78
+ IVerifiableIdentityRequest;
70
79
 
71
80
  export type DeauthorizeDappRequest = Readonly<{
72
81
  __type: MWARequestType.DeauthorizeDappRequest;
73
82
  }> &
74
- IMWARequest;
83
+ IMWARequest &
84
+ IVerifiableIdentityRequest;
75
85
 
76
86
  export type SignMessagesRequest = Readonly<{
77
87
  __type: MWARequestType.SignMessagesRequest;
78
88
  payloads: Uint8Array[];
79
89
  }> &
80
- IMWARequest;
90
+ IMWARequest &
91
+ IVerifiableIdentityRequest;
81
92
 
82
93
  export type SignTransactionsRequest = Readonly<{
83
94
  __type: MWARequestType.SignTransactionsRequest;
84
95
  payloads: Uint8Array[];
85
96
  }> &
86
- IMWARequest;
97
+ IMWARequest &
98
+ IVerifiableIdentityRequest;
87
99
 
88
100
  export type SignAndSendTransactionsRequest = Readonly<{
89
101
  __type: MWARequestType.SignAndSendTransactionsRequest;
90
102
  payloads: Uint8Array[];
91
103
  minContextSlot?: number;
92
104
  }> &
93
- IMWARequest;
105
+ IMWARequest &
106
+ IVerifiableIdentityRequest;
94
107
 
95
108
  /**
96
109
  * MWA Request Responses
@@ -98,6 +111,8 @@ export type SignAndSendTransactionsRequest = Readonly<{
98
111
 
99
112
  export type MWAResponse =
100
113
  | AuthorizeDappResponse
114
+ | ReauthorizeDappResponse
115
+ | DeauthorizeDappResponse
101
116
  | SignMessagesResponse
102
117
  | SignTransactionsResponse
103
118
  | SignAndSendTransactionsResponse;
@@ -136,6 +151,16 @@ export type AuthorizeDappCompleteResponse = Readonly<{
136
151
  }>;
137
152
  export type AuthorizeDappResponse = AuthorizeDappCompleteResponse | UserDeclinedResponse;
138
153
 
154
+ /* Reauthorize Dapp */
155
+ export type ReauthorizeDappCompleteResponse = Readonly<{
156
+ authorizationScope?: Uint8Array;
157
+ }>;
158
+ export type ReauthorizeDappResponse = ReauthorizeDappCompleteResponse | AuthorizationNotValidResponse;
159
+
160
+ /* Deauthorize Dapp */
161
+ export type DeauthorizeDappCompleteResponse = Readonly<{}>;
162
+ export type DeauthorizeDappResponse = DeauthorizeDappCompleteResponse | AuthorizationNotValidResponse;
163
+
139
164
  /* Sign Transactions/Messages */
140
165
  export type SignPayloadsCompleteResponse = Readonly<{ signedPayloads: Uint8Array[] }>;
141
166
  export type SignPayloadsFailResponse =
@@ -157,9 +182,11 @@ export type SignAndSendTransactionsResponse =
157
182
  | InvalidSignaturesResponse;
158
183
 
159
184
  export function resolve(request: AuthorizeDappRequest, response: AuthorizeDappResponse): void;
185
+ export function resolve(request: ReauthorizeDappRequest, response: ReauthorizeDappResponse): void;
186
+ export function resolve(request: DeauthorizeDappRequest, response: DeauthorizeDappResponse): void;
160
187
  export function resolve(request: SignMessagesRequest, response: SignMessagesResponse): void;
161
188
  export function resolve(request: SignTransactionsRequest, response: SignTransactionsResponse): void;
162
189
  export function resolve(request: SignAndSendTransactionsRequest, response: SignAndSendTransactionsResponse): void;
163
- export function resolve(request: MWARequest, response: unknown): void {
190
+ export function resolve(request: MWARequest, response: MWAResponse): void {
164
191
  SolanaMobileWalletAdapterWalletLib.resolve(JSON.stringify(request), JSON.stringify(response));
165
192
  }
@@ -0,0 +1,41 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+
3
+ const LINKING_ERROR =
4
+ `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
5
+ '- You rebuilt the app after installing the package\n' +
6
+ '- If you are using Lerna workspaces\n' +
7
+ ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n' +
8
+ ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n' +
9
+ '- You are not using Expo managed workflow\n';
10
+
11
+ const SolanaMobileDigitalAssetLinks =
12
+ Platform.OS === 'android' && NativeModules.SolanaMobileDigitalAssetLinks
13
+ ? NativeModules.SolanaMobileDigitalAssetLinks
14
+ : new Proxy(
15
+ {},
16
+ {
17
+ get() {
18
+ throw new Error(
19
+ Platform.OS !== 'android'
20
+ ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'
21
+ : LINKING_ERROR,
22
+ );
23
+ },
24
+ },
25
+ );
26
+
27
+ export async function getCallingPackage(): Promise<string | undefined> {
28
+ return await SolanaMobileDigitalAssetLinks.getCallingPackage()
29
+ }
30
+
31
+ export async function verifyCallingPackage(clientIdentityUri: string) {
32
+ return await SolanaMobileDigitalAssetLinks.verifyCallingPackage(clientIdentityUri)
33
+ }
34
+
35
+ export async function getCallingPackageUid() {
36
+ return await SolanaMobileDigitalAssetLinks.getCallingPackageUid()
37
+ }
38
+
39
+ export async function getUidForPackage(packageName: string) {
40
+ return await SolanaMobileDigitalAssetLinks.getUidForPackage(packageName)
41
+ }
@@ -57,13 +57,12 @@ export function useMobileWalletAdapterSession(
57
57
  console.warn('Unexpected native event type');
58
58
  }
59
59
  });
60
+ initializeScenario(walletName, config);
60
61
 
61
62
  return () => {
62
63
  listener.remove();
63
64
  };
64
65
  }, []);
65
-
66
- initializeScenario(walletName, config);
67
66
  }
68
67
 
69
68
  async function initializeScenario(walletName: string, walletConfig: MobileWalletAdapterConfig) {
@@ -71,7 +70,11 @@ async function initializeScenario(walletName: string, walletConfig: MobileWallet
71
70
  const initialUrl = await Linking.getInitialURL();
72
71
 
73
72
  // Create Scenario and establish session with dapp
74
- SolanaMobileWalletAdapterWalletLib.createScenario(walletName, initialUrl, JSON.stringify(walletConfig));
73
+ if (initialUrl) {
74
+ SolanaMobileWalletAdapterWalletLib.createScenario(walletName, initialUrl, JSON.stringify(walletConfig));
75
+ } else {
76
+ console.warn('Initial URL is unexpectedly uninitialized');
77
+ }
75
78
  }
76
79
 
77
80
  function isMWARequest(nativeEvent: any): boolean {