@solana-mobile/mobile-wallet-adapter-protocol 2.1.4 → 2.1.6
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/.DS_Store +0 -0
- package/.gitignore +2 -0
- package/README.md +69 -69
- package/android/.gitignore +14 -0
- 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 +249 -180
- package/lib/cjs/index.js +249 -180
- package/lib/cjs/index.native.js +12 -2
- package/lib/esm/index.browser.js +249 -180
- package/lib/esm/index.js +249 -180
- package/lib/types/index.browser.d.ts +10 -4
- package/lib/types/index.browser.d.ts.map +1 -1
- package/lib/types/index.d.ts +10 -4
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.native.d.ts +10 -4
- package/lib/types/index.native.d.ts.map +1 -1
- package/package.json +71 -58
- package/src/__forks__/react-native/base64Utils.ts +1 -0
- package/src/__forks__/react-native/transact.ts +91 -0
- package/src/arrayBufferToBase64String.ts +10 -0
- package/src/associationPort.ts +19 -0
- package/src/base64Utils.ts +22 -0
- package/src/codegenSpec/NativeSolanaMobileWalletAdapter.ts +13 -0
- package/src/createHelloReq.ts +12 -0
- package/src/createMobileWalletProxy.ts +182 -0
- package/src/createSIWSMessage.ts +14 -0
- package/src/createSequenceNumberVector.ts +11 -0
- package/src/encryptedMessage.ts +60 -0
- package/src/errors.ts +101 -0
- package/src/generateAssociationKeypair.ts +10 -0
- package/src/generateECDHKeypair.ts +10 -0
- package/src/getAssociateAndroidIntentURL.ts +77 -0
- package/src/getJWS.ts +19 -0
- package/src/getStringWithURLUnsafeBase64CharactersReplaced.ts +11 -0
- package/src/index.ts +3 -0
- package/src/jsonRpcMessage.ts +38 -0
- package/src/parseHelloRsp.ts +46 -0
- package/src/parseSessionProps.ts +33 -0
- package/src/reflectorId.ts +31 -0
- package/src/startSession.ts +98 -0
- package/src/transact.ts +593 -0
- package/src/types.ts +201 -0
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +8 -0
package/.DS_Store
ADDED
|
Binary file
|
package/.gitignore
ADDED
package/README.md
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
# `@solana-mobile/mobile-wallet-adapter-protocol`
|
|
2
|
-
|
|
3
|
-
This is a reference implementation of the [Mobile Wallet Adapter specification](https://github.com/solana-mobile/mobile-wallet-adapter/blob/main/spec/spec.md) in JavaScript. Use this to start a session with a mobile wallet in which you can issue API calls to it (eg. `sign_messages`) as per the spec.
|
|
4
|
-
|
|
5
|
-
If you are simply looking to integrate a JavaScript application with mobile wallets, see [`@solana-mobile/wallet-adapter-mobile`](https://www.npmjs.com/package/@solana-mobile/wallet-adapter-mobile) instead.
|
|
6
|
-
|
|
7
|
-
## Learn how to use this API on our [documentation website](https://docs.solanamobile.com/):
|
|
8
|
-
- React Native
|
|
9
|
-
- [Quickstart Setup](https://docs.solanamobile.com/react-native/quickstart)
|
|
10
|
-
- [dApp Integration Guide](https://docs.solanamobile.com/react-native/mwa_integration_rn)
|
|
11
|
-
- [Hello World Tutorial](https://docs.solanamobile.com/getting-started/hello_world_tutorial)
|
|
12
|
-
- [Sample App Reference](https://docs.solanamobile.com/sample-apps/sample_app_overview)
|
|
13
|
-
|
|
14
|
-
## Quick start
|
|
15
|
-
|
|
16
|
-
Use this API to start a session:
|
|
17
|
-
|
|
18
|
-
```typescript
|
|
19
|
-
import {transact} from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
20
|
-
|
|
21
|
-
await transact(async (wallet) => {
|
|
22
|
-
/* ... */
|
|
23
|
-
});
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
The callback you provide will be called once a session has been established with a wallet. It will recieve the `MobileWallet` API as an argument. You can call protocol-specified methods using this function. Whatever you return from this callback will be returned by `transact`.
|
|
27
|
-
|
|
28
|
-
```typescript
|
|
29
|
-
const signedPayloads = await transact(async (wallet) => {
|
|
30
|
-
const {signed_payloads} = await wallet.signMessages({
|
|
31
|
-
auth_token,
|
|
32
|
-
payloads: [/* ... */],
|
|
33
|
-
});
|
|
34
|
-
return signed_payloads;
|
|
35
|
-
});
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
The wallet session will stay active until your callback returns. Typically, wallets will redirect back to your app once the session ends.
|
|
39
|
-
|
|
40
|
-
## Exception handling
|
|
41
|
-
|
|
42
|
-
You can catch exceptions at any level. See `errors.ts` for a list of exceptions that might be thrown.
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
try {
|
|
46
|
-
await transact(async (wallet) => {
|
|
47
|
-
try {
|
|
48
|
-
await wallet.signTransactions(/* ... */);
|
|
49
|
-
} catch (e) {
|
|
50
|
-
if (
|
|
51
|
-
e instanceof SolanaMobileWalletAdapterProtocolError &&
|
|
52
|
-
e.code === SolanaMobileWalletAdapterProtocolErrorCode.ERROR_REAUTHORIZE
|
|
53
|
-
) {
|
|
54
|
-
console.error('The auth token has gone stale');
|
|
55
|
-
await wallet.reauthorize({auth_token, identity});
|
|
56
|
-
// Retry...
|
|
57
|
-
}
|
|
58
|
-
throw e;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
} catch(e) {
|
|
62
|
-
if (
|
|
63
|
-
e instanceof SolanaMobileWalletAdapterError &&
|
|
64
|
-
e.code === SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND
|
|
65
|
-
) {
|
|
66
|
-
/* ... */
|
|
67
|
-
}
|
|
68
|
-
throw e;
|
|
69
|
-
}
|
|
1
|
+
# `@solana-mobile/mobile-wallet-adapter-protocol`
|
|
2
|
+
|
|
3
|
+
This is a reference implementation of the [Mobile Wallet Adapter specification](https://github.com/solana-mobile/mobile-wallet-adapter/blob/main/spec/spec.md) in JavaScript. Use this to start a session with a mobile wallet in which you can issue API calls to it (eg. `sign_messages`) as per the spec.
|
|
4
|
+
|
|
5
|
+
If you are simply looking to integrate a JavaScript application with mobile wallets, see [`@solana-mobile/wallet-adapter-mobile`](https://www.npmjs.com/package/@solana-mobile/wallet-adapter-mobile) instead.
|
|
6
|
+
|
|
7
|
+
## Learn how to use this API on our [documentation website](https://docs.solanamobile.com/):
|
|
8
|
+
- React Native
|
|
9
|
+
- [Quickstart Setup](https://docs.solanamobile.com/react-native/quickstart)
|
|
10
|
+
- [dApp Integration Guide](https://docs.solanamobile.com/react-native/mwa_integration_rn)
|
|
11
|
+
- [Hello World Tutorial](https://docs.solanamobile.com/getting-started/hello_world_tutorial)
|
|
12
|
+
- [Sample App Reference](https://docs.solanamobile.com/sample-apps/sample_app_overview)
|
|
13
|
+
|
|
14
|
+
## Quick start
|
|
15
|
+
|
|
16
|
+
Use this API to start a session:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import {transact} from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
20
|
+
|
|
21
|
+
await transact(async (wallet) => {
|
|
22
|
+
/* ... */
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The callback you provide will be called once a session has been established with a wallet. It will recieve the `MobileWallet` API as an argument. You can call protocol-specified methods using this function. Whatever you return from this callback will be returned by `transact`.
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
const signedPayloads = await transact(async (wallet) => {
|
|
30
|
+
const {signed_payloads} = await wallet.signMessages({
|
|
31
|
+
auth_token,
|
|
32
|
+
payloads: [/* ... */],
|
|
33
|
+
});
|
|
34
|
+
return signed_payloads;
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The wallet session will stay active until your callback returns. Typically, wallets will redirect back to your app once the session ends.
|
|
39
|
+
|
|
40
|
+
## Exception handling
|
|
41
|
+
|
|
42
|
+
You can catch exceptions at any level. See `errors.ts` for a list of exceptions that might be thrown.
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
try {
|
|
46
|
+
await transact(async (wallet) => {
|
|
47
|
+
try {
|
|
48
|
+
await wallet.signTransactions(/* ... */);
|
|
49
|
+
} catch (e) {
|
|
50
|
+
if (
|
|
51
|
+
e instanceof SolanaMobileWalletAdapterProtocolError &&
|
|
52
|
+
e.code === SolanaMobileWalletAdapterProtocolErrorCode.ERROR_REAUTHORIZE
|
|
53
|
+
) {
|
|
54
|
+
console.error('The auth token has gone stale');
|
|
55
|
+
await wallet.reauthorize({auth_token, identity});
|
|
56
|
+
// Retry...
|
|
57
|
+
}
|
|
58
|
+
throw e;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
} catch(e) {
|
|
62
|
+
if (
|
|
63
|
+
e instanceof SolanaMobileWalletAdapterError &&
|
|
64
|
+
e.code === SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND
|
|
65
|
+
) {
|
|
66
|
+
/* ... */
|
|
67
|
+
}
|
|
68
|
+
throw e;
|
|
69
|
+
}
|
|
70
70
|
```
|
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.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
|
+
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.7"
|
|
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
|