@solana-mobile/mobile-wallet-adapter-protocol 2.1.3 → 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.
Files changed (47) hide show
  1. package/android/build.gradle +158 -146
  2. package/android/gradle/wrapper/gradle-wrapper.properties +5 -5
  3. package/android/gradle.properties +5 -5
  4. package/android/src/main/java/com/solanamobile/mobilewalletadapter/reactnative/JSONSerializationUtils.kt +11 -9
  5. package/android/src/main/java/com/solanamobile/mobilewalletadapter/reactnative/SolanaMobileWalletAdapterModule.kt +201 -178
  6. package/android/src/main/java/com/solanamobile/mobilewalletadapter/reactnative/SolanaMobileWalletAdapterPackage.kt +26 -7
  7. package/android/src/newarch/SolanaMobileWalletAdapter.kt +7 -0
  8. package/android/src/oldarch/SolanaMobileWalletAdapter.kt +16 -0
  9. package/lib/cjs/index.browser.js +266 -5
  10. package/lib/cjs/index.js +266 -5
  11. package/lib/cjs/index.native.js +5 -2
  12. package/lib/esm/index.browser.js +266 -6
  13. package/lib/esm/index.js +266 -6
  14. package/lib/types/index.browser.d.ts +17 -1
  15. package/lib/types/index.browser.d.ts.map +1 -1
  16. package/lib/types/index.d.ts +17 -1
  17. package/lib/types/index.d.ts.map +1 -1
  18. package/lib/types/index.native.d.ts +17 -1
  19. package/lib/types/index.native.d.ts.map +1 -1
  20. package/package.json +70 -58
  21. package/.gitignore +0 -2
  22. package/android/.gitignore +0 -14
  23. package/src/__forks__/react-native/base64Utils.ts +0 -1
  24. package/src/__forks__/react-native/transact.ts +0 -92
  25. package/src/arrayBufferToBase64String.ts +0 -10
  26. package/src/associationPort.ts +0 -19
  27. package/src/base64Utils.ts +0 -3
  28. package/src/createHelloReq.ts +0 -12
  29. package/src/createMobileWalletProxy.ts +0 -175
  30. package/src/createSIWSMessage.ts +0 -14
  31. package/src/createSequenceNumberVector.ts +0 -11
  32. package/src/encryptedMessage.ts +0 -60
  33. package/src/errors.ts +0 -95
  34. package/src/generateAssociationKeypair.ts +0 -10
  35. package/src/generateECDHKeypair.ts +0 -10
  36. package/src/getAssociateAndroidIntentURL.ts +0 -57
  37. package/src/getJWS.ts +0 -19
  38. package/src/getStringWithURLUnsafeBase64CharactersReplaced.ts +0 -11
  39. package/src/index.ts +0 -3
  40. package/src/jsonRpcMessage.ts +0 -38
  41. package/src/parseHelloRsp.ts +0 -46
  42. package/src/parseSessionProps.ts +0 -33
  43. package/src/startSession.ts +0 -94
  44. package/src/transact.ts +0 -266
  45. package/src/types.ts +0 -181
  46. package/tsconfig.cjs.json +0 -7
  47. package/tsconfig.json +0 -8
@@ -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.3.2'
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
- repositories {
61
- mavenCentral()
62
- google()
63
-
64
- def found = false
65
- def defaultDir = null
66
- def androidSourcesName = 'React Native sources'
67
-
68
- if (rootProject.ext.has('reactNativeAndroidRoot')) {
69
- defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
70
- } else {
71
- defaultDir = new File(
72
- projectDir,
73
- '/../../../node_modules/react-native/android'
74
- )
75
- }
76
-
77
- if (defaultDir.exists()) {
78
- maven {
79
- url defaultDir.toString()
80
- name androidSourcesName
81
- }
82
-
83
- logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
84
- found = true
85
- } else {
86
- def parentDir = rootProject.projectDir
87
-
88
- 1.upto(5, {
89
- if (found) return true
90
- parentDir = parentDir.parentFile
91
-
92
- def androidSourcesDir = new File(
93
- parentDir,
94
- 'node_modules/react-native'
95
- )
96
-
97
- def androidPrebuiltBinaryDir = new File(
98
- parentDir,
99
- 'node_modules/react-native/android'
100
- )
101
-
102
- if (androidPrebuiltBinaryDir.exists()) {
103
- maven {
104
- url androidPrebuiltBinaryDir.toString()
105
- name androidSourcesName
106
- }
107
-
108
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
109
- found = true
110
- } else if (androidSourcesDir.exists()) {
111
- maven {
112
- url androidSourcesDir.toString()
113
- name androidSourcesName
114
- }
115
-
116
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
117
- found = true
118
- }
119
- })
120
- }
121
-
122
- if (!found) {
123
- throw new GradleException(
124
- "${project.name}: unable to locate React Native android sources. " +
125
- "Ensure you have you installed React Native as a dependency in your project and try again."
126
- )
127
- }
128
- }
129
-
130
- def kotlin_version = getExtOrDefault('kotlinVersion')
131
-
132
- dependencies {
133
- //noinspection GradleDynamicVersion
134
- implementation "com.facebook.react:react-native:+" // From node_modules
135
- implementation "com.solanamobile:mobile-wallet-adapter-clientlib:2.0.3"
136
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
137
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0"
138
- }
139
-
140
- if (isNewArchitectureEnabled()) {
141
- react {
142
- jsRootDir = file("../src/")
143
- libraryName = "SolanaMobileWalletAdapterModule"
144
- codegenJavaPackageName = "com.solanamobile.mobilewalletadapter.reactnative"
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.4-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
- for (i in 0 until readableArray.size()) {
35
- when (readableArray.getType(i)) {
36
- ReadableType.Array -> array.put(convertArrayToJson(readableArray.getArray(i)))
37
- ReadableType.Boolean -> array.put(readableArray.getBoolean(i))
38
- ReadableType.Map -> array.put(convertMapToJson(readableArray.getMap(i)))
39
- ReadableType.Null -> {}
40
- ReadableType.Number -> array.put(readableArray.getDouble(i))
41
- ReadableType.String -> array.put(readableArray.getString(i))
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