@circle-fin/w3s-pw-react-native-sdk 1.1.7 → 2.0.1

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 (114) hide show
  1. package/BARE_REACT_NATIVE_GUIDE.md +397 -0
  2. package/LICENSE +1 -1
  3. package/README.md +203 -90
  4. package/android/build.gradle +43 -126
  5. package/android/src/main/AndroidManifest.xml +12 -16
  6. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/ProgrammablewalletRnSdkModule.kt +414 -244
  7. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseCallback.kt +76 -74
  8. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/RecordsHelper.kt +602 -0
  9. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/models/Records.kt +43 -0
  10. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/pwcustom/RnImageSetter.kt +55 -33
  11. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/pwcustom/RnLayoutProvider.kt +81 -79
  12. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/pwcustom/RnViewSetterProvider.kt +93 -63
  13. package/app.json +8 -0
  14. package/build/ProgrammablewalletRnSdkModule.d.ts +44 -0
  15. package/build/ProgrammablewalletRnSdkModule.d.ts.map +1 -0
  16. package/build/ProgrammablewalletRnSdkModule.js +21 -0
  17. package/build/ProgrammablewalletRnSdkModule.js.map +1 -0
  18. package/build/WalletSdk.d.ts +20 -0
  19. package/build/WalletSdk.d.ts.map +1 -0
  20. package/build/WalletSdk.js +303 -0
  21. package/build/WalletSdk.js.map +1 -0
  22. package/build/bridgeSafe.d.ts +50 -0
  23. package/build/bridgeSafe.d.ts.map +1 -0
  24. package/build/bridgeSafe.js +136 -0
  25. package/build/bridgeSafe.js.map +1 -0
  26. package/build/index.d.ts +21 -0
  27. package/build/index.d.ts.map +1 -0
  28. package/build/index.js +21 -0
  29. package/build/index.js.map +1 -0
  30. package/{lib/typescript/src → build}/types.d.ts +72 -43
  31. package/build/types.d.ts.map +1 -0
  32. package/build/types.js +331 -0
  33. package/build/types.js.map +1 -0
  34. package/build/utils/securityQuestionUtils.d.ts +43 -0
  35. package/build/utils/securityQuestionUtils.d.ts.map +1 -0
  36. package/build/utils/securityQuestionUtils.js +109 -0
  37. package/build/utils/securityQuestionUtils.js.map +1 -0
  38. package/expo-module.config.json +11 -0
  39. package/ios/Array+Extension.swift +17 -15
  40. package/ios/BridgeHelper.swift +71 -92
  41. package/ios/{RnWalletSdk+CustomizeAdapter.swift → CustomizeAdapter.swift} +19 -29
  42. package/ios/ProgrammablewalletRnSdk.podspec +30 -0
  43. package/ios/ProgrammablewalletRnSdkModule.swift +384 -0
  44. package/ios/TextConfig.swift +17 -15
  45. package/ios/TextKey.swift +17 -15
  46. package/ios/UIApplication+Extension.swift +26 -17
  47. package/ios/UIColor+Extension.swift +34 -28
  48. package/ios/UITextField+Extension.swift +31 -0
  49. package/ios/UIView+Extension.swift +24 -17
  50. package/package.json +71 -116
  51. package/plugins/apple-signin-entitlements.js +16 -0
  52. package/plugins/infoplist-config.js +77 -0
  53. package/plugins/infoplist-config.md +72 -0
  54. package/plugins/podfile-modifier.js +84 -0
  55. package/plugins/podfile-modifier.md +33 -0
  56. package/plugins/withCopyFiles.js +148 -0
  57. package/plugins/withCopyFiles.md +81 -0
  58. package/src/ProgrammablewalletRnSdkModule.ts +68 -38
  59. package/src/WalletSdk.ts +297 -159
  60. package/src/bridgeSafe.ts +156 -0
  61. package/src/index.ts +21 -0
  62. package/src/types.ts +133 -110
  63. package/src/utils/securityQuestionUtils.ts +121 -0
  64. package/COPYRIGHT +0 -10
  65. package/android/gradle.properties +0 -21
  66. package/android/src/main/AndroidManifestNew.xml +0 -22
  67. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/BridgeHelper.kt +0 -399
  68. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/ProgrammablewalletRnSdkPackage.kt +0 -49
  69. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseCallback2.kt +0 -65
  70. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseLogoutCallback.kt +0 -47
  71. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseSocialCallback.kt +0 -53
  72. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/TestHelper.kt +0 -37
  73. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/annotation/ExcludeFromGeneratedCCReport.kt +0 -33
  74. package/android/src/newarch/ProgrammablewalletRnSdkSpec.kt +0 -29
  75. package/android/src/oldarch/ProgrammablewalletRnSdkSpec.kt +0 -76
  76. package/circlefin-w3s-pw-react-native-sdk.podspec +0 -41
  77. package/ios/EventEmitter.swift +0 -49
  78. package/ios/ProgrammablewalletRnSdk.h +0 -29
  79. package/ios/ProgrammablewalletRnSdk.mm +0 -162
  80. package/ios/ReactNativeEventEmitter.m +0 -27
  81. package/ios/ReactNativeEventEmitter.swift +0 -37
  82. package/ios/RnWalletSdk.swift +0 -390
  83. package/ios/programmablewallet-rn-sdk-Bridging-Header.h +0 -22
  84. package/lib/commonjs/NativeProgrammablewalletRnSdk.js +0 -24
  85. package/lib/commonjs/NativeProgrammablewalletRnSdk.js.map +0 -1
  86. package/lib/commonjs/ProgrammablewalletRnSdkModule.js +0 -38
  87. package/lib/commonjs/ProgrammablewalletRnSdkModule.js.map +0 -1
  88. package/lib/commonjs/WalletSdk.js +0 -211
  89. package/lib/commonjs/WalletSdk.js.map +0 -1
  90. package/lib/commonjs/index.js +0 -74
  91. package/lib/commonjs/index.js.map +0 -1
  92. package/lib/commonjs/types.js +0 -342
  93. package/lib/commonjs/types.js.map +0 -1
  94. package/lib/module/NativeProgrammablewalletRnSdk.js +0 -19
  95. package/lib/module/NativeProgrammablewalletRnSdk.js.map +0 -1
  96. package/lib/module/ProgrammablewalletRnSdkModule.js +0 -31
  97. package/lib/module/ProgrammablewalletRnSdkModule.js.map +0 -1
  98. package/lib/module/WalletSdk.js +0 -203
  99. package/lib/module/WalletSdk.js.map +0 -1
  100. package/lib/module/index.js +0 -18
  101. package/lib/module/index.js.map +0 -1
  102. package/lib/module/types.js +0 -334
  103. package/lib/module/types.js.map +0 -1
  104. package/lib/typescript/src/NativeProgrammablewalletRnSdk.d.ts +0 -28
  105. package/lib/typescript/src/NativeProgrammablewalletRnSdk.d.ts.map +0 -1
  106. package/lib/typescript/src/ProgrammablewalletRnSdkModule.d.ts +0 -3
  107. package/lib/typescript/src/ProgrammablewalletRnSdkModule.d.ts.map +0 -1
  108. package/lib/typescript/src/WalletSdk.d.ts +0 -3
  109. package/lib/typescript/src/WalletSdk.d.ts.map +0 -1
  110. package/lib/typescript/src/index.d.ts +0 -4
  111. package/lib/typescript/src/index.d.ts.map +0 -1
  112. package/lib/typescript/src/types.d.ts.map +0 -1
  113. package/src/NativeProgrammablewalletRnSdk.ts +0 -77
  114. package/src/index.tsx +0 -29
package/README.md CHANGED
@@ -1,112 +1,225 @@
1
- # @circle-fin/w3s-pw-react-native-sdk
2
- React Native SDK for Circle Programmable Wallet
3
- ## Install NVM
1
+ # Circle User-Controlled Wallets React Native SDK
4
2
 
5
- Install Node Version Manager to use different versions of node and npm easily.
3
+ > SDK for integrating Circle's user-controlled wallet into React Native applications
6
4
 
7
- ```bash
8
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
9
- ```
5
+ > [!IMPORTANT]
6
+ > This SDK supports both Expo and bare React Native projects. Select the appropriate guide based on your project type.
7
+ >
8
+ > - **Bare React Native** (manages native code manually) → Go to [Bare React Native Integration Guide](./BARE_REACT_NATIVE_GUIDE.md)
9
+ > - **Expo project** (uses `expo prebuild` and has `app.json`/`app.config.js`) ↓ Continue below
10
10
 
11
- > **Note:** See [nvm repo](https://github.com/nvm-sh/nvm) for the most updated instruction.
11
+ ---
12
12
 
13
- ## Authenticate the npm registry
13
+ ## Migrating from SDK v1 (Bare React Native)
14
14
 
15
- Create a Personal Access Token in your [GitHub setting](https://github.com/settings/tokens). Use `Configure SSO` button next to your created token to authorize `circlefin` organization. More instruction can be found [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). Then, log in to `npm` on your terminal.
15
+ If you have an existing bare React Native project using SDK v1 and want to upgrade to SDK v2, see the [SDK v1 Migration Guide](https://github.com/circlefin/w3s-react-native-sample-app-wallets/blob/master/MIGRATION_GUIDE.md).
16
16
 
17
- ```bash
18
- npm login --scope=@OWNER --registry=https://registry.npmjs.org
17
+ You can also find the SDK v1 sample app in the sample app repository's [sdk-v1 branch](https://github.com/circlefin/w3s-react-native-sample-app-wallets/tree/sdk-v1).
18
+
19
+ ## System Requirements
20
+
21
+ | Platform | Minimum Version | Recommended Version |
22
+ | ------------ | --------------- | ------------------- |
23
+ | React Native | 0.60+ | 0.76-0.81 |
24
+ | iOS | 15.1+ | iOS 17+ |
25
+ | Android | API 21+ | API 33+ |
26
+ | Expo SDK | 49+ | 53+ |
27
+
28
+ ## Installation
29
+
30
+ > [!IMPORTANT]
31
+ > **Prerequisites**: This SDK uses native modules and requires a [development build](https://docs.expo.dev/develop/development-builds/introduction). Expo Go is not supported.
32
+
33
+ Follow these steps in order. The SDK will be fully configured after running `expo prebuild`.
34
+
35
+ #### Step 1: Generate Native Projects (Skip if `android`/`ios` Already Exist)
36
+
37
+ If you don't have `android/` and `ios/` directories yet, generate them:
38
+
39
+ ```shell
40
+ npx expo prebuild
19
41
  ```
20
- This will ask you to submit your GitHub personal access token as below.
21
- Check below links for creating GitHub PAT:
22
- - [Creating a fine-grained personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token)
23
- - [Creating a personal access token (classic)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic)
24
-
25
- ```properties
26
- npm notice Log in on https://registry.npmjs.org/
27
- Username: <insert your GitHub username here>
28
- Password: <insert your GitHub personal access token here>
42
+
43
+ #### Step 2: Install the SDK Package
44
+
45
+ ```shell
46
+ npx expo install @circle-fin/w3s-pw-react-native-sdk
29
47
  ```
30
- ## [Enable the New Architecture]((https://reactnative.dev/docs/new-architecture-app-intro#android---enable-the-new-architecture) )
31
- The SDK is supporting both React Native old and [new architectures](https://reactnative.dev/docs/the-new-architecture/landing-page).
32
- You can enable the new architecture by changing the project setting.
33
- ### Android
34
- Update the `android/gradle.properties` file as follows:
35
- ```properties
36
- newArchEnabled=true
48
+
49
+ #### Step 3: Configure app.json
50
+
51
+ Add both required plugins to `app.json`:
52
+
53
+ ```json
54
+ {
55
+ "expo": {
56
+ "plugins": [
57
+ [
58
+ "@circle-fin/w3s-pw-react-native-sdk/plugins/withCopyFiles",
59
+ {
60
+ "sourceDir": "prebuild-sync-src",
61
+ "targetDir": ".",
62
+ "overwrite": true
63
+ }
64
+ ],
65
+ "@circle-fin/w3s-pw-react-native-sdk/plugins/podfile-modifier"
66
+ ]
67
+ }
68
+ }
37
69
  ```
38
- ### iOS
39
- Reinstall your pods by running pod install with the right flag:
40
- ```shell
41
- RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
70
+
71
+ **What these plugins do:**
72
+
73
+ - `withCopyFiles`: Preserves your Android/iOS configurations across rebuilds
74
+ - `podfile-modifier`: Automatically configures iOS Podfile for Circle SDK
75
+
76
+ > [!TIP]
77
+ > Prefer manual setup? Skip `podfile-modifier` and follow the [iOS configuration](./BARE_REACT_NATIVE_GUIDE.md#step-3-configure-ios) in the **Bare React Native Integration Guide** after prebuild.
78
+
79
+ <details>
80
+ <summary><strong>Learn more about withCopyFiles plugin</strong></summary>
81
+
82
+ The `withCopyFiles` plugin copies files from a source directory to your native project during prebuild, ensuring custom configurations are preserved.
83
+
84
+ **Directory structure example:**
85
+
42
86
  ```
43
- ## Installation
44
- ### Using yarn
45
- ```shell
46
- yarn add @circle-fin/w3s-pw-react-native-sdk
87
+ prebuild-sync-src/
88
+ ├── android/
89
+ │ └── build.gradle
90
+ └── ios/
91
+ └── YourApp/Resources/
92
+ ├── CirclePWLocalizable.strings
93
+ └── CirclePWTheme.json
47
94
  ```
48
- ### Using npm
49
- ```shell
50
- npm install @circle-fin/w3s-pw-react-native-sdk
95
+
96
+ During `expo prebuild`, files from `prebuild-sync-src/android` → `android/` and `prebuild-sync-src/ios` → `ios/`.
97
+
98
+ **Options:**
99
+
100
+ | Option | Default | Description |
101
+ | ----------- | ------------------- | --------------------------------------------- |
102
+ | `sourceDir` | `prebuild-sync-src` | Root directory with android/ and ios/ folders |
103
+ | `overwrite` | `true` | Whether to overwrite existing files |
104
+
105
+ **Note:** This solves the problem of `expo prebuild --clean` erasing manual changes.
106
+
107
+ </details>
108
+
109
+ #### Step 4: Configure Android Repository
110
+
111
+ > [!NOTE]
112
+ > The SDK depends on `w3s-android-sdk` hosted on GitHub Gradle registry, which requires authentication.
113
+
114
+ **4.1** Create `.env` in project root with your GitHub credentials:
115
+
116
+ ```bash
117
+ PWSDK_MAVEN_URL=https://maven.pkg.github.com/circlefin/w3s-android-sdk
118
+ PWSDK_MAVEN_USERNAME=<YOUR_GITHUB_USERNAME>
119
+ PWSDK_MAVEN_PASSWORD=<YOUR_GITHUB_PAT>
51
120
  ```
52
- ## Link Native Dependencies
53
- ### Android
54
- Add the maven repository to your `android/build.gradle`. It's suggested that load settings from `local.properties`:
55
- ```properties
121
+
122
+ Get a [Personal Access Token](https://github.com/settings/tokens) with `read:packages` permission.
123
+
124
+ **4.2** Add to `android/build.gradle` (project-level) in the `repositories` block:
125
+
126
+ ```gradle
56
127
  repositories {
57
- ...
58
- maven {
59
- Properties properties = new Properties()
60
- // Load local.properties.
61
- properties.load(new File(rootDir.absolutePath + "/local.properties").newDataInputStream())
62
-
63
- url properties.getProperty('pwsdk.maven.url')
64
- credentials {
65
- username properties.getProperty('pwsdk.maven.username')
66
- password properties.getProperty('pwsdk.maven.password')
67
- }
68
- }
128
+ // Keep your other repositories here
129
+ // google()
130
+ // mavenCentral()
131
+
132
+ maven {
133
+ url System.getenv('PWSDK_MAVEN_URL')
134
+ credentials {
135
+ username System.getenv('PWSDK_MAVEN_USERNAME')
136
+ password System.getenv('PWSDK_MAVEN_PASSWORD')
137
+ }
138
+ }
69
139
  }
70
140
  ```
71
- Add the maven setting values in `local.properties` file.
72
- ```properties
73
- pwsdk.maven.url=https://maven.pkg.github.com/circlefin/w3s-android-sdk
74
- pwsdk.maven.username=<GITHUB_USERNAME>
75
- # Fine-grained personal access tokens or classic with package write permission.
76
- pwsdk.maven.password=<GITHUB_PAT>
141
+
142
+ #### Step 5: Create Sync Directory Structure
143
+
144
+ Create `prebuild-sync-src/` folder and copy your modified Android files:
145
+
146
+ ```shell
147
+ mkdir -p prebuild-sync-src/android
148
+ cp android/build.gradle prebuild-sync-src/android/
77
149
  ```
78
- ### iOS
79
- Add below links at tne top of `ios/Podfile`:
80
- ```ruby
81
- source 'https://github.com/circlefin/w3s-ios-sdk.git'
82
- source 'https://github.com/CocoaPods/Specs.git'
83
150
 
84
- platform :ios, '13.4'
151
+ > [!IMPORTANT]
152
+ > Place all manual Android/iOS changes in `prebuild-sync-src/` to preserve them across rebuilds.
153
+
154
+ #### Step 6: Generate Native Code
155
+
156
+ ```shell
157
+ npx expo prebuild --clean
85
158
  ```
86
- Declare dynamic link as below:
87
- ```ruby
88
- target 'W3sSampleWallet' do
89
- use_frameworks!
90
- end
159
+
160
+ This command generates native directories and applies all configurations automatically.
161
+
162
+ > [!TIP]
163
+ > **Verify iOS Configuration:** Check if the Circle SDK repository was added correctly:
164
+ >
165
+ > ```shell
166
+ > cat ios/Podfile | grep "circlefin"
167
+ > ```
168
+ >
169
+ > Expected output: `source 'https://github.com/circlefin/w3s-ios-sdk.git'`
170
+
171
+ #### Step 7: Install iOS Dependencies
172
+
173
+ ```shell
174
+ cd ios && pod install && cd ..
91
175
  ```
92
- And add the following `post_install` hook:
93
- ```ruby
94
- post_install do |installer|
95
- installer.pods_project.targets.each do |target|
96
- target.build_configurations.each do |config|
97
- config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
98
- config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
99
- config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
100
- end
101
- end
102
- end
176
+
177
+ #### Step 8: Build and Run
178
+
179
+ **Local development:**
180
+
181
+ For iOS:
182
+
183
+ ```shell
184
+ npx expo run:ios
103
185
  ```
104
- ## Run the Example
105
- ### Android
106
- ```bash
107
- yarn example android
186
+
187
+ For Android:
188
+
189
+ ```shell
190
+ npx expo run:android
108
191
  ```
109
- ### iOS
110
- ```bash
111
- yarn example ios
192
+
193
+ **EAS Build:**
194
+
195
+ First, install EAS CLI globally (one-time setup):
196
+
197
+ ```shell
198
+ npm install -g eas-cli
199
+ ```
200
+
201
+ Then build your app:
202
+
203
+ ```shell
204
+ eas build --profile development --platform all
112
205
  ```
206
+
207
+ > [!TIP]
208
+ > **EAS Setup**: Add secrets `PWSDK_MAVEN_USERNAME` and `PWSDK_MAVEN_PASSWORD` to your EAS project. [Learn more](https://docs.expo.dev/build-reference/variables/)
209
+
210
+ ---
211
+
212
+ ## Additional Resources
213
+
214
+ **Circle Resources:**
215
+
216
+ - [User-Controlled Wallets Documentation](https://developers.circle.com/wallets/user-controlled) - Product overview and architecture
217
+ - [React Native SDK Documentation](https://developers.circle.com/wallets/user-controlled/react-native-sdk) - Complete API reference
218
+ - [UI Customization API](https://developers.circle.com/wallets/user-controlled/react-native-sdk-ui-customization-api) - Theming and localization options
219
+ - [React Native Sample App](https://github.com/circlefin/w3s-react-native-sample-app-wallets) - Working Expo sample app with integration guide
220
+ - [SDK v1 Migration Guide](https://github.com/circlefin/w3s-react-native-sample-app-wallets/blob/master/MIGRATION_GUIDE.md) - Complete guide for upgrading from bare React Native + SDK v1 to Expo Modules + SDK v2
221
+
222
+ **Expo Resources:**
223
+
224
+ - [Expo Development Build](https://docs.expo.dev/development/build/)
225
+ - [EAS Build](https://docs.expo.dev/build/introduction/)
@@ -1,139 +1,56 @@
1
- // Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
2
- //
3
- // SPDX-License-Identifier: Apache-2.0
4
- //
5
- // Licensed under the Apache License, Version 2.0 (the "License");
6
- // you may not use this file except in compliance with the License.
7
- // You may obtain a copy of the License at
8
- //
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // Unless required by applicable law or agreed to in writing, software
12
- // distributed under the License is distributed on an "AS IS" BASIS,
13
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- // See the License for the specific language governing permissions and
15
- // limitations under the License.
16
-
17
- buildscript {
18
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
19
- def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["ProgrammablewalletRnSdk_kotlinVersion"]
20
-
21
- repositories {
22
- google()
23
- mavenCentral()
1
+ apply plugin: 'com.android.library'
2
+
3
+ import groovy.json.JsonSlurper
4
+
5
+ def getPackageJsonVersion() {
6
+ def packageJsonFile = file("${projectDir}/../package.json")
7
+ def packageJson = new JsonSlurper().parseText(packageJsonFile.text)
8
+ return packageJson.version
9
+ }
10
+
11
+ group = 'com.circlefin.programmablewalletrnsdk'
12
+ version = getPackageJsonVersion()
13
+
14
+ def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
15
+ apply from: expoModulesCorePlugin
16
+ applyKotlinExpoModulesCorePlugin()
17
+ useCoreDependencies()
18
+ useExpoPublishing()
19
+
20
+ // If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
21
+ // The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
22
+ // Most of the time, you may like to manage the Android SDK versions yourself.
23
+ def useManagedAndroidSdkVersions = false
24
+ if (useManagedAndroidSdkVersions) {
25
+ useDefaultAndroidSdkVersions()
26
+ } else {
27
+ buildscript {
28
+ // Simple helper that allows the root project to override versions declared by this library.
29
+ ext.safeExtGet = { prop, fallback ->
30
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
31
+ }
24
32
  }
25
-
26
- dependencies {
27
- classpath "com.android.tools.build:gradle:8.5.0"
28
- // noinspection DifferentKotlinGradleVersion
29
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
33
+ project.android {
34
+ compileSdkVersion safeExtGet("compileSdkVersion", 34)
35
+ defaultConfig {
36
+ minSdkVersion safeExtGet("minSdkVersion", 21)
37
+ targetSdkVersion safeExtGet("targetSdkVersion", 34)
38
+ }
30
39
  }
31
40
  }
32
41
 
33
- def isNewArchitectureEnabled() {
34
- return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
35
- }
36
-
37
- apply plugin: "com.android.library"
38
- apply plugin: "kotlin-android"
39
-
40
- if (isNewArchitectureEnabled()) {
41
- apply plugin: "com.facebook.react"
42
- }
43
-
44
- def getExtOrDefault(name) {
45
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["ProgrammablewalletRnSdk_" + name]
46
- }
47
-
48
- def getExtOrIntegerDefault(name) {
49
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["ProgrammablewalletRnSdk_" + name]).toInteger()
50
- }
51
-
52
- def supportsNamespace() {
53
- def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
54
- def major = parsed[0].toInteger()
55
- def minor = parsed[1].toInteger()
56
-
57
- // Namespace support was added in 7.3.0
58
- return (major == 7 && minor >= 3) || major >= 8
59
- }
60
-
61
42
  android {
62
- if (supportsNamespace()) {
63
- namespace "com.circlefin.programmablewalletrnsdk"
64
-
65
- sourceSets {
66
- main {
67
- manifest.srcFile "src/main/AndroidManifestNew.xml"
68
- }
69
- }
70
- }
71
-
72
- compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
73
-
43
+ namespace "com.circlefin.programmablewalletrnsdk"
74
44
  defaultConfig {
75
- minSdkVersion getExtOrIntegerDefault("minSdkVersion")
76
- targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
77
- buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
78
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
79
- }
80
-
81
- buildFeatures {
82
- buildConfig true
45
+ versionCode 1
46
+ versionName getPackageJsonVersion()
83
47
  }
84
-
85
- buildTypes {
86
- release {
87
- minifyEnabled false
88
- }
89
- debug {
90
- testCoverageEnabled false
91
- }
92
- }
93
-
94
48
  lintOptions {
95
- disable "GradleCompatible"
49
+ abortOnError false
96
50
  }
97
-
98
- compileOptions {
99
- sourceCompatibility JavaVersion.VERSION_11
100
- targetCompatibility JavaVersion.VERSION_11
101
- }
102
- sourceSets {
103
- main {
104
- if (isNewArchitectureEnabled()) {
105
- java.srcDirs += [
106
- "src/newarch",
107
- // This is needed to build Kotlin project with NewArch enabled
108
- "${project.buildDir}/generated/source/codegen/java"
109
- ]
110
- } else {
111
- java.srcDirs += ["src/oldarch"]
112
- }
113
- }
114
- }
115
- }
116
- repositories {
117
- mavenCentral()
118
- google()
119
51
  }
120
52
 
121
- def kotlin_version = getExtOrDefault("kotlinVersion")
122
-
123
53
  dependencies {
124
- // For < 0.71, this will be from the local maven repo
125
- // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
126
- //noinspection GradleDynamicVersion
127
- implementation "com.facebook.react:react-native:+"
128
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
129
- implementation "circle.programmablewallet:sdk:1.0.1102"
130
- implementation 'com.github.bumptech.glide:glide:4.14.2'
131
- }
132
-
133
- if (isNewArchitectureEnabled()) {
134
- react {
135
- jsRootDir = file("../src/")
136
- libraryName = "ProgrammablewalletRnSdk"
137
- codegenJavaPackageName = "com.circlefin.programmablewalletrnsdk"
138
- }
54
+ implementation("circle.programmablewallet:sdk:1.0.1102")
55
+ implementation("com.github.bumptech.glide:glide:4.16.0")
139
56
  }
@@ -1,23 +1,19 @@
1
1
  <!--
2
- Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
2
+ Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
3
 
4
- SPDX-License-Identifier: Apache-2.0
4
+ SPDX-License-Identifier: Apache-2.0
5
5
 
6
- Licensed under the Apache License, Version 2.0 (the "License");
7
- you may not use this file except in compliance with the License.
8
- You may obtain a copy of the License at
6
+ Licensed under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License.
8
+ You may obtain a copy of the License at
9
9
 
10
- http://www.apache.org/licenses/LICENSE-2.0
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
11
 
12
- Unless required by applicable law or agreed to in writing, software
13
- distributed under the License is distributed on an "AS IS" BASIS,
14
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- See the License for the specific language governing permissions and
16
- limitations under the License.
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
17
  -->
18
-
19
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
20
- package="com.circlefin.programmablewalletrnsdk">
21
-
22
- <uses-permission android:name="android.permission.REORDER_TASKS" />
18
+ <manifest>
23
19
  </manifest>