@solana-mobile/mobile-wallet-adapter-protocol 2.1.4 → 2.1.5
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/android/build.gradle +158 -146
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -5
- package/android/gradle.properties +5 -5
- package/android/src/main/java/com/solanamobile/mobilewalletadapter/reactnative/JSONSerializationUtils.kt +11 -9
- package/android/src/main/java/com/solanamobile/mobilewalletadapter/reactnative/SolanaMobileWalletAdapterModule.kt +201 -178
- package/android/src/main/java/com/solanamobile/mobilewalletadapter/reactnative/SolanaMobileWalletAdapterPackage.kt +26 -7
- package/android/src/newarch/SolanaMobileWalletAdapter.kt +7 -0
- package/android/src/oldarch/SolanaMobileWalletAdapter.kt +16 -0
- package/lib/cjs/index.browser.js +8 -4
- package/lib/cjs/index.js +8 -4
- package/lib/cjs/index.native.js +4 -2
- package/lib/esm/index.browser.js +8 -4
- package/lib/esm/index.js +8 -4
- package/lib/types/index.native.d.ts.map +1 -1
- package/package.json +70 -58
package/android/build.gradle
CHANGED
|
@@ -1,146 +1,158 @@
|
|
|
1
|
-
buildscript {
|
|
2
|
-
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
-
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['SolanaMobileWalletAdapterModule_kotlinVersion']
|
|
4
|
-
|
|
5
|
-
repositories {
|
|
6
|
-
google()
|
|
7
|
-
mavenCentral()
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
dependencies {
|
|
11
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
12
|
-
// noinspection DifferentKotlinGradleVersion
|
|
13
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
def isNewArchitectureEnabled() {
|
|
18
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
apply plugin: 'com.android.library'
|
|
22
|
-
apply plugin: 'kotlin-android'
|
|
23
|
-
|
|
24
|
-
if (isNewArchitectureEnabled()) {
|
|
25
|
-
apply plugin: 'com.facebook.react'
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
def getExtOrDefault(name) {
|
|
29
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['SolanaMobileWalletAdapterModule_' + name]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
def getExtOrIntegerDefault(name) {
|
|
33
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['SolanaMobileWalletAdapterModule_' + name]).toInteger()
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
android {
|
|
37
|
-
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
38
|
-
|
|
39
|
-
defaultConfig {
|
|
40
|
-
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
41
|
-
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
42
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
43
|
-
}
|
|
44
|
-
buildTypes {
|
|
45
|
-
release {
|
|
46
|
-
minifyEnabled false
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
lintOptions {
|
|
51
|
-
disable 'GradleCompatible'
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
compileOptions {
|
|
55
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
56
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
1
|
+
buildscript {
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['SolanaMobileWalletAdapterModule_kotlinVersion']
|
|
4
|
+
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath 'com.android.tools.build:gradle:8.8.0'
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def isNewArchitectureEnabled() {
|
|
18
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
apply plugin: 'com.android.library'
|
|
22
|
+
apply plugin: 'kotlin-android'
|
|
23
|
+
|
|
24
|
+
if (isNewArchitectureEnabled()) {
|
|
25
|
+
apply plugin: 'com.facebook.react'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
def getExtOrDefault(name) {
|
|
29
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['SolanaMobileWalletAdapterModule_' + name]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def getExtOrIntegerDefault(name) {
|
|
33
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['SolanaMobileWalletAdapterModule_' + name]).toInteger()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
android {
|
|
37
|
+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
38
|
+
|
|
39
|
+
defaultConfig {
|
|
40
|
+
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
41
|
+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
42
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
43
|
+
}
|
|
44
|
+
buildTypes {
|
|
45
|
+
release {
|
|
46
|
+
minifyEnabled false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
lintOptions {
|
|
51
|
+
disable 'GradleCompatible'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
compileOptions {
|
|
55
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
56
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
sourceSets {
|
|
60
|
+
main {
|
|
61
|
+
if (isNewArchitectureEnabled()) {
|
|
62
|
+
java.srcDirs += [
|
|
63
|
+
"src/newarch"
|
|
64
|
+
]
|
|
65
|
+
} else {
|
|
66
|
+
java.srcDirs += ["src/oldarch"]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
repositories {
|
|
73
|
+
mavenCentral()
|
|
74
|
+
google()
|
|
75
|
+
|
|
76
|
+
def found = false
|
|
77
|
+
def defaultDir = null
|
|
78
|
+
def androidSourcesName = 'React Native sources'
|
|
79
|
+
|
|
80
|
+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
81
|
+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
82
|
+
} else {
|
|
83
|
+
defaultDir = new File(
|
|
84
|
+
projectDir,
|
|
85
|
+
'/../../../node_modules/react-native/android'
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (defaultDir.exists()) {
|
|
90
|
+
maven {
|
|
91
|
+
url defaultDir.toString()
|
|
92
|
+
name androidSourcesName
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
96
|
+
found = true
|
|
97
|
+
} else {
|
|
98
|
+
def parentDir = rootProject.projectDir
|
|
99
|
+
|
|
100
|
+
1.upto(5, {
|
|
101
|
+
if (found) return true
|
|
102
|
+
parentDir = parentDir.parentFile
|
|
103
|
+
|
|
104
|
+
def androidSourcesDir = new File(
|
|
105
|
+
parentDir,
|
|
106
|
+
'node_modules/react-native'
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def androidPrebuiltBinaryDir = new File(
|
|
110
|
+
parentDir,
|
|
111
|
+
'node_modules/react-native/android'
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
if (androidPrebuiltBinaryDir.exists()) {
|
|
115
|
+
maven {
|
|
116
|
+
url androidPrebuiltBinaryDir.toString()
|
|
117
|
+
name androidSourcesName
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
121
|
+
found = true
|
|
122
|
+
} else if (androidSourcesDir.exists()) {
|
|
123
|
+
maven {
|
|
124
|
+
url androidSourcesDir.toString()
|
|
125
|
+
name androidSourcesName
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
129
|
+
found = true
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (!found) {
|
|
135
|
+
throw new GradleException(
|
|
136
|
+
"${project.name}: unable to locate React Native android sources. " +
|
|
137
|
+
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
143
|
+
|
|
144
|
+
dependencies {
|
|
145
|
+
//noinspection GradleDynamicVersion
|
|
146
|
+
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
147
|
+
implementation "com.solanamobile:mobile-wallet-adapter-clientlib:2.0.5"
|
|
148
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
149
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0"
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (isNewArchitectureEnabled()) {
|
|
153
|
+
react {
|
|
154
|
+
jsRootDir = file("../src/")
|
|
155
|
+
libraryName = "SolanaMobileWalletAdapterModule"
|
|
156
|
+
codegenJavaPackageName = "com.solanamobile.mobilewalletadapter.reactnative"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
distributionBase=GRADLE_USER_HOME
|
|
2
|
-
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
|
4
|
-
zipStoreBase=GRADLE_USER_HOME
|
|
5
|
-
zipStorePath=wrapper/dists
|
|
1
|
+
distributionBase=GRADLE_USER_HOME
|
|
2
|
+
distributionPath=wrapper/dists
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
|
4
|
+
zipStoreBase=GRADLE_USER_HOME
|
|
5
|
+
zipStorePath=wrapper/dists
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
SolanaMobileWalletAdapterModule_kotlinVersion=1.9.0
|
|
2
|
-
SolanaMobileWalletAdapterModule_minSdkVersion=21
|
|
3
|
-
SolanaMobileWalletAdapterModule_targetSdkVersion=33
|
|
4
|
-
SolanaMobileWalletAdapterModule_compileSdkVersion=33
|
|
5
|
-
SolanaMobileWalletAdapterModule_ndkversion=21.4.7075529
|
|
1
|
+
SolanaMobileWalletAdapterModule_kotlinVersion=1.9.0
|
|
2
|
+
SolanaMobileWalletAdapterModule_minSdkVersion=21
|
|
3
|
+
SolanaMobileWalletAdapterModule_targetSdkVersion=33
|
|
4
|
+
SolanaMobileWalletAdapterModule_compileSdkVersion=33
|
|
5
|
+
SolanaMobileWalletAdapterModule_ndkversion=21.4.7075529
|
|
@@ -29,16 +29,18 @@ object JSONSerializationUtils {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
@Throws(JSONException::class)
|
|
32
|
-
private fun convertArrayToJson(readableArray: ReadableArray): JSONArray {
|
|
32
|
+
private fun convertArrayToJson(readableArray: ReadableArray?): JSONArray {
|
|
33
33
|
val array = JSONArray()
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
readableArray?.let {
|
|
35
|
+
for (i in 0 until readableArray.size()) {
|
|
36
|
+
when (readableArray.getType(i)) {
|
|
37
|
+
ReadableType.Array -> array.put(convertArrayToJson(readableArray.getArray(i)))
|
|
38
|
+
ReadableType.Boolean -> array.put(readableArray.getBoolean(i))
|
|
39
|
+
ReadableType.Map -> array.put(convertMapToJson(readableArray.getMap(i)))
|
|
40
|
+
ReadableType.Null -> {}
|
|
41
|
+
ReadableType.Number -> array.put(readableArray.getDouble(i))
|
|
42
|
+
ReadableType.String -> array.put(readableArray.getString(i))
|
|
43
|
+
}
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
return array
|
|
@@ -1,178 +1,201 @@
|
|
|
1
|
-
package com.solanamobile.mobilewalletadapter.reactnative
|
|
2
|
-
|
|
3
|
-
import android.app.Activity
|
|
4
|
-
import android.content.ActivityNotFoundException
|
|
5
|
-
import android.content.Intent
|
|
6
|
-
import android.net.Uri
|
|
7
|
-
import android.util.Log
|
|
8
|
-
import com.facebook.react.bridge.*
|
|
9
|
-
import com.solana.mobilewalletadapter.clientlib.protocol.JsonRpc20Client
|
|
10
|
-
import com.solana.mobilewalletadapter.clientlib.protocol.MobileWalletAdapterClient
|
|
11
|
-
import com.solana.mobilewalletadapter.clientlib.scenario.LocalAssociationIntentCreator
|
|
12
|
-
import com.solana.mobilewalletadapter.clientlib.scenario.LocalAssociationScenario
|
|
13
|
-
import com.solana.mobilewalletadapter.common.protocol.SessionProperties.ProtocolVersion
|
|
14
|
-
import com.solanamobile.mobilewalletadapter.reactnative.JSONSerializationUtils.convertJsonToMap
|
|
15
|
-
import com.solanamobile.mobilewalletadapter.reactnative.JSONSerializationUtils.convertMapToJson
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
class SolanaMobileWalletAdapterModule(reactContext: ReactApplicationContext) :
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
data class SessionState(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
override val coroutineContext =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
companion object {
|
|
35
|
-
|
|
36
|
-
private const val
|
|
37
|
-
private const val
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
private
|
|
42
|
-
private var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
1
|
+
package com.solanamobile.mobilewalletadapter.reactnative
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.ActivityNotFoundException
|
|
5
|
+
import android.content.Intent
|
|
6
|
+
import android.net.Uri
|
|
7
|
+
import android.util.Log
|
|
8
|
+
import com.facebook.react.bridge.*
|
|
9
|
+
import com.solana.mobilewalletadapter.clientlib.protocol.JsonRpc20Client
|
|
10
|
+
import com.solana.mobilewalletadapter.clientlib.protocol.MobileWalletAdapterClient
|
|
11
|
+
import com.solana.mobilewalletadapter.clientlib.scenario.LocalAssociationIntentCreator
|
|
12
|
+
import com.solana.mobilewalletadapter.clientlib.scenario.LocalAssociationScenario
|
|
13
|
+
import com.solana.mobilewalletadapter.common.protocol.SessionProperties.ProtocolVersion
|
|
14
|
+
import com.solanamobile.mobilewalletadapter.reactnative.JSONSerializationUtils.convertJsonToMap
|
|
15
|
+
import com.solanamobile.mobilewalletadapter.reactnative.JSONSerializationUtils.convertMapToJson
|
|
16
|
+
import java.util.concurrent.ExecutionException
|
|
17
|
+
import java.util.concurrent.TimeUnit
|
|
18
|
+
import java.util.concurrent.TimeoutException
|
|
19
|
+
import kotlinx.coroutines.*
|
|
20
|
+
import kotlinx.coroutines.sync.Mutex
|
|
21
|
+
import org.json.JSONObject
|
|
22
|
+
|
|
23
|
+
class SolanaMobileWalletAdapterModule(reactContext: ReactApplicationContext) :
|
|
24
|
+
SolanaMobileWalletAdapterSpec(reactContext), CoroutineScope {
|
|
25
|
+
|
|
26
|
+
data class SessionState(
|
|
27
|
+
val client: MobileWalletAdapterClient,
|
|
28
|
+
val localAssociation: LocalAssociationScenario,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
override val coroutineContext =
|
|
32
|
+
Dispatchers.IO + CoroutineName("SolanaMobileWalletAdapterModuleScope") + SupervisorJob()
|
|
33
|
+
|
|
34
|
+
companion object {
|
|
35
|
+
const val NAME = "SolanaMobileWalletAdapter"
|
|
36
|
+
private const val ASSOCIATION_TIMEOUT_MS = 10000
|
|
37
|
+
private const val CLIENT_TIMEOUT_MS = 90000
|
|
38
|
+
private const val REQUEST_LOCAL_ASSOCIATION = 0
|
|
39
|
+
|
|
40
|
+
// Used to ensure that you can't start more than one session at a time.
|
|
41
|
+
private val mutex: Mutex = Mutex()
|
|
42
|
+
private var sessionState: SessionState? = null
|
|
43
|
+
private var associationResultCallback: ((Int) -> Unit)? = null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private val mActivityEventListener: ActivityEventListener =
|
|
47
|
+
object : BaseActivityEventListener() {
|
|
48
|
+
override fun onActivityResult(
|
|
49
|
+
activity: Activity?,
|
|
50
|
+
requestCode: Int,
|
|
51
|
+
resultCode: Int,
|
|
52
|
+
data: Intent?
|
|
53
|
+
) {
|
|
54
|
+
if (requestCode == REQUEST_LOCAL_ASSOCIATION)
|
|
55
|
+
associationResultCallback?.invoke(resultCode)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
init {
|
|
60
|
+
reactContext.addActivityEventListener(mActivityEventListener)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
override fun getName(): String {
|
|
64
|
+
return NAME
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@ReactMethod
|
|
68
|
+
override fun startSession(config: ReadableMap?, promise: Promise): Unit {
|
|
69
|
+
launch {
|
|
70
|
+
mutex.lock()
|
|
71
|
+
Log.d(name, "startSession with config $config")
|
|
72
|
+
try {
|
|
73
|
+
val uriPrefix = config?.getString("baseUri")?.let { Uri.parse(it) }
|
|
74
|
+
val localAssociation =
|
|
75
|
+
LocalAssociationScenario(
|
|
76
|
+
CLIENT_TIMEOUT_MS,
|
|
77
|
+
)
|
|
78
|
+
val intent =
|
|
79
|
+
LocalAssociationIntentCreator.createAssociationIntent(
|
|
80
|
+
uriPrefix,
|
|
81
|
+
localAssociation.port,
|
|
82
|
+
localAssociation.session
|
|
83
|
+
)
|
|
84
|
+
associationResultCallback = { resultCode ->
|
|
85
|
+
if (resultCode == Activity.RESULT_CANCELED) {
|
|
86
|
+
Log.d(name, "Local association cancelled by user, ending session")
|
|
87
|
+
promise.reject(
|
|
88
|
+
"Session not established: Local association cancelled by user",
|
|
89
|
+
LocalAssociationScenario.ConnectionFailedException(
|
|
90
|
+
"Local association cancelled by user"
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
localAssociation.close()
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
currentActivity?.startActivityForResult(intent, REQUEST_LOCAL_ASSOCIATION)
|
|
97
|
+
?: throw NullPointerException(
|
|
98
|
+
"Could not find a current activity from which to launch a local association"
|
|
99
|
+
)
|
|
100
|
+
val client =
|
|
101
|
+
localAssociation
|
|
102
|
+
.start()
|
|
103
|
+
.get(ASSOCIATION_TIMEOUT_MS.toLong(), TimeUnit.MILLISECONDS)
|
|
104
|
+
sessionState = SessionState(client, localAssociation)
|
|
105
|
+
val sessionPropertiesMap: WritableMap = WritableNativeMap()
|
|
106
|
+
sessionPropertiesMap.putString(
|
|
107
|
+
"protocol_version",
|
|
108
|
+
when (localAssociation.session.sessionProperties.protocolVersion) {
|
|
109
|
+
ProtocolVersion.LEGACY -> "legacy"
|
|
110
|
+
ProtocolVersion.V1 -> "v1"
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
promise.resolve(sessionPropertiesMap)
|
|
114
|
+
} catch (e: ActivityNotFoundException) {
|
|
115
|
+
Log.e(name, "Found no installed wallet that supports the mobile wallet protocol", e)
|
|
116
|
+
cleanup()
|
|
117
|
+
promise.reject("ERROR_WALLET_NOT_FOUND", e)
|
|
118
|
+
} catch (e: TimeoutException) {
|
|
119
|
+
Log.e(name, "Timed out waiting for local association to be ready", e)
|
|
120
|
+
cleanup()
|
|
121
|
+
promise.reject("Timed out waiting for local association to be ready", e)
|
|
122
|
+
} catch (e: InterruptedException) {
|
|
123
|
+
Log.w(name, "Interrupted while waiting for local association to be ready", e)
|
|
124
|
+
cleanup()
|
|
125
|
+
promise.reject(e)
|
|
126
|
+
} catch (e: ExecutionException) {
|
|
127
|
+
Log.e(name, "Failed establishing local association with wallet", e.cause)
|
|
128
|
+
cleanup()
|
|
129
|
+
promise.reject(e)
|
|
130
|
+
} catch (e: Throwable) {
|
|
131
|
+
Log.e(name, "Failed to start session", e)
|
|
132
|
+
cleanup()
|
|
133
|
+
promise.reject(e)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@ReactMethod
|
|
139
|
+
override fun invoke(method: String, params: ReadableMap?, promise: Promise): Unit =
|
|
140
|
+
sessionState?.let {
|
|
141
|
+
Log.d(name, "invoke `$method` with params $params")
|
|
142
|
+
try {
|
|
143
|
+
val result =
|
|
144
|
+
it.client
|
|
145
|
+
.methodCall(method, convertMapToJson(params), CLIENT_TIMEOUT_MS)
|
|
146
|
+
.get() as
|
|
147
|
+
JSONObject
|
|
148
|
+
promise.resolve(convertJsonToMap(result))
|
|
149
|
+
} catch (e: ExecutionException) {
|
|
150
|
+
val cause = e.cause
|
|
151
|
+
if (cause is JsonRpc20Client.JsonRpc20RemoteException) {
|
|
152
|
+
val userInfo = Arguments.createMap()
|
|
153
|
+
userInfo.putInt("jsonRpcErrorCode", cause.code)
|
|
154
|
+
promise.reject("JSON_RPC_ERROR", cause, userInfo)
|
|
155
|
+
} else if (cause is TimeoutException) {
|
|
156
|
+
promise.reject("Timed out waiting for response", e)
|
|
157
|
+
} else {
|
|
158
|
+
throw e
|
|
159
|
+
}
|
|
160
|
+
} catch (e: Throwable) {
|
|
161
|
+
Log.e(name, "Failed to invoke `$method` with params $params", e)
|
|
162
|
+
promise.reject(e)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
?: throw NullPointerException(
|
|
166
|
+
"Tried to invoke `$method` without an active session"
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
@ReactMethod
|
|
170
|
+
override fun endSession(promise: Promise): Unit {
|
|
171
|
+
sessionState?.let {
|
|
172
|
+
launch {
|
|
173
|
+
Log.d(name, "endSession")
|
|
174
|
+
try {
|
|
175
|
+
it.localAssociation
|
|
176
|
+
.close()
|
|
177
|
+
.get(ASSOCIATION_TIMEOUT_MS.toLong(), TimeUnit.MILLISECONDS)
|
|
178
|
+
cleanup()
|
|
179
|
+
promise.resolve(true)
|
|
180
|
+
} catch (e: TimeoutException) {
|
|
181
|
+
Log.e(name, "Timed out waiting for local association to close", e)
|
|
182
|
+
cleanup()
|
|
183
|
+
promise.reject("Failed to end session", e)
|
|
184
|
+
} catch (e: Throwable) {
|
|
185
|
+
Log.e(name, "Failed to end session", e)
|
|
186
|
+
cleanup()
|
|
187
|
+
promise.reject("Failed to end session", e)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
?: throw NullPointerException("Tried to end a session without an active session")
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
private fun cleanup() {
|
|
195
|
+
sessionState = null
|
|
196
|
+
associationResultCallback = null
|
|
197
|
+
if (mutex.isLocked) {
|
|
198
|
+
mutex.unlock()
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
package com.solanamobile.mobilewalletadapter.reactnative
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
3
|
+
import com.facebook.react.TurboReactPackage
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.facebook.react.
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
import java.util.HashMap
|
|
7
9
|
|
|
8
|
-
class
|
|
9
|
-
override fun
|
|
10
|
-
return
|
|
10
|
+
class SolanaMobileWalletAdapterModulePackage : TurboReactPackage() {
|
|
11
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
12
|
+
return if (name == SolanaMobileWalletAdapterModule.NAME) {
|
|
13
|
+
SolanaMobileWalletAdapterModule(reactContext)
|
|
14
|
+
} else {
|
|
15
|
+
null
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
18
|
|
|
13
|
-
override fun
|
|
14
|
-
return
|
|
19
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
20
|
+
return ReactModuleInfoProvider {
|
|
21
|
+
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
22
|
+
moduleInfos[SolanaMobileWalletAdapterModule.NAME] =
|
|
23
|
+
ReactModuleInfo(
|
|
24
|
+
SolanaMobileWalletAdapterModule.NAME,
|
|
25
|
+
SolanaMobileWalletAdapterModule.NAME,
|
|
26
|
+
false, // canOverrideExistingModule
|
|
27
|
+
false, // needsEagerInit
|
|
28
|
+
true, // hasConstants
|
|
29
|
+
false, // isCxxModule
|
|
30
|
+
true // isTurboModule
|
|
31
|
+
)
|
|
32
|
+
moduleInfos
|
|
33
|
+
}
|
|
15
34
|
}
|
|
16
35
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
package com.solanamobile.mobilewalletadapter.reactnative
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
+
|
|
5
|
+
abstract class SolanaMobileWalletAdapterSpec
|
|
6
|
+
internal constructor(context: ReactApplicationContext) :
|
|
7
|
+
NativeSolanaMobileWalletAdapterSpec(context) {}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package com.solanamobile.mobilewalletadapter.reactnative
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
|
+
import com.facebook.react.bridge.ReadableMap
|
|
7
|
+
|
|
8
|
+
abstract class SolanaMobileWalletAdapterSpec
|
|
9
|
+
internal constructor(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
|
|
10
|
+
|
|
11
|
+
abstract fun startSession(config: ReadableMap?, promise: Promise)
|
|
12
|
+
|
|
13
|
+
abstract fun invoke(method: String, params: ReadableMap?, promise: Promise)
|
|
14
|
+
|
|
15
|
+
abstract fun endSession(promise: Promise)
|
|
16
|
+
}
|
package/lib/cjs/index.browser.js
CHANGED
|
@@ -950,10 +950,14 @@ function transactRemote(callback, config) {
|
|
|
950
950
|
try {
|
|
951
951
|
resolve(yield callback(new Proxy(wallet, {
|
|
952
952
|
get(target, p) {
|
|
953
|
-
if (p
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
953
|
+
if (p == 'terminateSession') {
|
|
954
|
+
return function () {
|
|
955
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
956
|
+
disposeSocket();
|
|
957
|
+
socket.close();
|
|
958
|
+
return;
|
|
959
|
+
});
|
|
960
|
+
};
|
|
957
961
|
}
|
|
958
962
|
else
|
|
959
963
|
return target[p];
|
package/lib/cjs/index.js
CHANGED
|
@@ -950,10 +950,14 @@ function transactRemote(callback, config) {
|
|
|
950
950
|
try {
|
|
951
951
|
resolve(yield callback(new Proxy(wallet, {
|
|
952
952
|
get(target, p) {
|
|
953
|
-
if (p
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
953
|
+
if (p == 'terminateSession') {
|
|
954
|
+
return function () {
|
|
955
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
956
|
+
disposeSocket();
|
|
957
|
+
socket.close();
|
|
958
|
+
return;
|
|
959
|
+
});
|
|
960
|
+
};
|
|
957
961
|
}
|
|
958
962
|
else
|
|
959
963
|
return target[p];
|
package/lib/cjs/index.native.js
CHANGED
|
@@ -72,6 +72,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
var NativeSolanaMobileWalletAdapter = reactNative.TurboModuleRegistry.getEnforcing('SolanaMobileWalletAdapter');
|
|
76
|
+
|
|
75
77
|
function createSIWSMessage(payload) {
|
|
76
78
|
return walletStandardUtil.createSignInMessageText(payload);
|
|
77
79
|
}
|
|
@@ -243,8 +245,8 @@ const LINKING_ERROR = `The package 'solana-mobile-wallet-adapter-protocol' doesn
|
|
|
243
245
|
' - You have added `@solana-mobile/mobile-wallet-adapter-protocol` as an explicit dependency, and\n' +
|
|
244
246
|
' - You have added `@solana-mobile/mobile-wallet-adapter-protocol` to the `nohoist` section of your package.json\n' +
|
|
245
247
|
'- You are not using Expo managed workflow\n';
|
|
246
|
-
const SolanaMobileWalletAdapter = reactNative.Platform.OS === 'android' &&
|
|
247
|
-
?
|
|
248
|
+
const SolanaMobileWalletAdapter = reactNative.Platform.OS === 'android' && NativeSolanaMobileWalletAdapter
|
|
249
|
+
? NativeSolanaMobileWalletAdapter
|
|
248
250
|
: new Proxy({}, {
|
|
249
251
|
get() {
|
|
250
252
|
throw new Error(reactNative.Platform.OS !== 'android'
|
package/lib/esm/index.browser.js
CHANGED
|
@@ -946,10 +946,14 @@ function transactRemote(callback, config) {
|
|
|
946
946
|
try {
|
|
947
947
|
resolve(yield callback(new Proxy(wallet, {
|
|
948
948
|
get(target, p) {
|
|
949
|
-
if (p
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
949
|
+
if (p == 'terminateSession') {
|
|
950
|
+
return function () {
|
|
951
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
952
|
+
disposeSocket();
|
|
953
|
+
socket.close();
|
|
954
|
+
return;
|
|
955
|
+
});
|
|
956
|
+
};
|
|
953
957
|
}
|
|
954
958
|
else
|
|
955
959
|
return target[p];
|
package/lib/esm/index.js
CHANGED
|
@@ -946,10 +946,14 @@ function transactRemote(callback, config) {
|
|
|
946
946
|
try {
|
|
947
947
|
resolve(yield callback(new Proxy(wallet, {
|
|
948
948
|
get(target, p) {
|
|
949
|
-
if (p
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
949
|
+
if (p == 'terminateSession') {
|
|
950
|
+
return function () {
|
|
951
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
952
|
+
disposeSocket();
|
|
953
|
+
socket.close();
|
|
954
|
+
return;
|
|
955
|
+
});
|
|
956
|
+
};
|
|
953
957
|
}
|
|
954
958
|
else
|
|
955
959
|
return target[p];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/errors.ts","../../src/createHelloReq.ts","../../src/types.ts","../../src/base64Utils.ts","../../src/createSIWSMessage.ts","../../src/createMobileWalletProxy.ts","../../src/createSequenceNumberVector.ts","../../src/parseHelloRsp.ts","../../src/encryptedMessage.ts","../../src/generateAssociationKeypair.ts","../../src/generateECDHKeypair.ts","../../src/jsonRpcMessage.ts","../../src/parseSessionProps.ts","../../src/associationPort.ts","../../src/arrayBufferToBase64String.ts","../../src/getStringWithURLUnsafeBase64CharactersReplaced.ts","../../src/reflectorId.ts","../../src/getAssociateAndroidIntentURL.ts","../../src/startSession.ts","../../src/transact.ts","../../src/__forks__/react-native/transact.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/errors.ts","../../src/createHelloReq.ts","../../src/types.ts","../../src/base64Utils.ts","../../src/createSIWSMessage.ts","../../src/createMobileWalletProxy.ts","../../src/createSequenceNumberVector.ts","../../src/parseHelloRsp.ts","../../src/encryptedMessage.ts","../../src/generateAssociationKeypair.ts","../../src/generateECDHKeypair.ts","../../src/jsonRpcMessage.ts","../../src/parseSessionProps.ts","../../src/associationPort.ts","../../src/arrayBufferToBase64String.ts","../../src/getStringWithURLUnsafeBase64CharactersReplaced.ts","../../src/reflectorId.ts","../../src/getAssociateAndroidIntentURL.ts","../../src/startSession.ts","../../src/transact.ts","../../src/codegenSpec/NativeSolanaMobileWalletAdapter.ts","../../src/__forks__/react-native/transact.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,58 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@solana-mobile/mobile-wallet-adapter-protocol",
|
|
3
|
-
"description": "An implementation of the Solana Mobile Mobile Wallet Adapter protocol. Use this to open a session with a mobile wallet app, and to issue API calls to it.",
|
|
4
|
-
"version": "2.1.
|
|
5
|
-
"author": "Steven Luscher <steven.luscher@solanamobile.com>",
|
|
6
|
-
"repository":
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"./
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
}
|
|
58
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@solana-mobile/mobile-wallet-adapter-protocol",
|
|
3
|
+
"description": "An implementation of the Solana Mobile Mobile Wallet Adapter protocol. Use this to open a session with a mobile wallet app, and to issue API calls to it.",
|
|
4
|
+
"version": "2.1.5",
|
|
5
|
+
"author": "Steven Luscher <steven.luscher@solanamobile.com>",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/solana-mobile/mobile-wallet-adapter.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"main": "lib/cjs/index.js",
|
|
14
|
+
"react-native": "lib/cjs/index.native.js",
|
|
15
|
+
"module": "lib/esm/index.js",
|
|
16
|
+
"types": "lib/types/index.d.ts",
|
|
17
|
+
"browser": {
|
|
18
|
+
"./lib/cjs/index.js": "./lib/cjs/index.browser.js",
|
|
19
|
+
"./lib/esm/index.js": "./lib/esm/index.browser.js"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
"./package.json": "./package.json",
|
|
23
|
+
".": {
|
|
24
|
+
"import": "./lib/esm/index.js",
|
|
25
|
+
"require": "./lib/cjs/index.js",
|
|
26
|
+
"types": "./lib/types/index.d.ts"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"android",
|
|
31
|
+
"!android/build",
|
|
32
|
+
"lib",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"clean": "shx rm -rf lib/*",
|
|
40
|
+
"build": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts",
|
|
41
|
+
"build:watch": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts --watch",
|
|
42
|
+
"postbuild": "cross-env echo {\\\"type\\\":\\\"commonjs\\\"} | npx json > lib/cjs/package.json && echo {\\\"type\\\":\\\"module\\\"} | npx json > lib/esm/package.json",
|
|
43
|
+
"prepublishOnly": "agadoo"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@solana/wallet-standard": "^1.1.2",
|
|
47
|
+
"@solana/wallet-standard-util": "^1.1.1",
|
|
48
|
+
"@wallet-standard/core": "^1.0.3",
|
|
49
|
+
"js-base64": "^3.7.5"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@solana/web3.js": "^1.91.7",
|
|
53
|
+
"@types/react-native": "^0.69.3",
|
|
54
|
+
"agadoo": "^3.0.0",
|
|
55
|
+
"cross-env": "^7.0.3",
|
|
56
|
+
"shx": "^0.3.4"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"@solana/web3.js": "^1.58.0",
|
|
60
|
+
"react-native": ">0.69"
|
|
61
|
+
},
|
|
62
|
+
"codegenConfig": {
|
|
63
|
+
"name": "SolanaMobileWalletAdapter",
|
|
64
|
+
"type": "all",
|
|
65
|
+
"jsSrcsDir": "./src/codegenSpec",
|
|
66
|
+
"android": {
|
|
67
|
+
"javaPackageName": "com.solanamobile.mobilewalletadapter.reactnative"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|