Skip to content

Commit 4339c70

Browse files
🔄 created local './lib/' from remote './lib/'
1 parent b960a82 commit 4339c70

File tree

98 files changed

+12304
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+12304
-0
lines changed

‎lib/.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

‎lib/build.gradle.kts‎

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
import org.jetbrains.dokka.DokkaConfiguration.Visibility
2+
import org.jetbrains.dokka.gradle.DokkaTask
3+
import java.io.FileInputStream
4+
import java.net.URI
5+
import java.util.Properties
6+
7+
plugins {
8+
alias(libs.plugins.android.library)
9+
alias(libs.plugins.jetbrains.kotlin.android)
10+
alias(libs.plugins.google.ksp)
11+
alias(libs.plugins.jetbrains.dokka)
12+
id("maven-publish")
13+
id("com.github.ben-manes.versions") version "0.46.0"
14+
}
15+
16+
extra.apply {
17+
set("versionMajor", 0)
18+
set("versionMedium", 0)
19+
set("versionMinorPublished", 204) // should increment after public release
20+
set("libraryId", libraryId())
21+
set("libraryGroupId", libraryId())
22+
set("libraryArtifactId", libraryArtifactId())
23+
set("defaultRepo", "")
24+
}
25+
26+
fun libraryArtifactId(): String {
27+
return if (project.hasProperty("LIB_ART_ID")) {
28+
project.property("LIB_ART_ID") as String
29+
} else {
30+
"core"
31+
}
32+
}
33+
34+
fun libraryId(): String {
35+
return if (project.hasProperty("LIB_ID")) {
36+
project.property("LIB_ID") as String
37+
} else {
38+
"circle.modularwallets"
39+
}
40+
}
41+
42+
fun buildNum(): Int {
43+
return if (project.hasProperty("BUILD_NUM")) {
44+
project.property("BUILD_NUM").toString().toInt()
45+
} else {
46+
0
47+
}
48+
}
49+
50+
fun majorNumber(): Int {
51+
return if (project.hasProperty("MAJOR_NUMBER")) {
52+
project.property("MAJOR_NUMBER").toString().toInt()
53+
} else {
54+
extra["versionMajor"] as Int
55+
}
56+
}
57+
58+
fun isInternalBuild(): Boolean {
59+
return majorNumber() == 0
60+
61+
}
62+
63+
fun apiVersion(): String {
64+
return if (isInternalBuild()) {
65+
"${majorNumber()}.${extra["versionMedium"]}.${extra["versionMinorPublished"]}-${buildNum()}" // internal build's buildNum is action build number
66+
} else {
67+
"${majorNumber()}.${extra["versionMedium"]}.${buildNum()}" // release build's buildNum is extracted from the git tag
68+
}
69+
}
70+
71+
fun libraryVersion(): String {
72+
val ver = apiVersion()
73+
return if (project.hasProperty("SNAPSHOT")) {
74+
"${ver}-SNAPSHOT"
75+
} else {
76+
ver
77+
}
78+
}
79+
80+
fun nexusRepo(): String {
81+
return if (project.hasProperty("NEXUS_REPO")) {
82+
project.property("NEXUS_REPO") as String
83+
} else {
84+
extra["defaultRepo"] as String
85+
}
86+
}
87+
88+
fun nexusUsername(): String {
89+
return if (project.hasProperty("NEXUS_USERNAME")) {
90+
project.property("NEXUS_USERNAME") as String
91+
} else {
92+
""
93+
}
94+
}
95+
96+
fun nexusPassword(): String {
97+
return if (project.hasProperty("NEXUS_PASSWORD")) {
98+
project.property("NEXUS_PASSWORD") as String
99+
} else {
100+
""
101+
}
102+
}
103+
104+
android {
105+
namespace = "com.circle.modularwallets.core"
106+
compileSdk = 34
107+
108+
defaultConfig {
109+
minSdk = 28
110+
version = libraryVersion()
111+
buildConfigField("String", "version", "\"${version}\"")
112+
buildConfigField("boolean", "INTERNAL_BUILD", "${isInternalBuild()}")
113+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
114+
testInstrumentationRunnerArguments += mapOf(
115+
"notPackage" to "com.circle.modularwallets.core.manual"
116+
)
117+
}
118+
119+
buildTypes {
120+
debug {
121+
enableAndroidTestCoverage = true
122+
enableUnitTestCoverage = true
123+
}
124+
release {
125+
isMinifyEnabled = true
126+
proguardFiles(
127+
getDefaultProguardFile("proguard-android-optimize.txt"),
128+
"proguard-rules.pro"
129+
)
130+
}
131+
}
132+
compileOptions {
133+
sourceCompatibility = JavaVersion.VERSION_1_8
134+
targetCompatibility = JavaVersion.VERSION_1_8
135+
}
136+
kotlinOptions {
137+
jvmTarget = "1.8"
138+
}
139+
buildFeatures {
140+
buildConfig = true
141+
}
142+
}
143+
144+
dependencies {
145+
ksp(libs.moshi.ksp)
146+
implementation(libs.androidx.credentials)
147+
implementation(libs.androidx.credentials.auth)
148+
implementation(libs.retrofit2.converter.moshi)
149+
implementation(libs.moshi.kotlin)
150+
implementation(libs.web3j)
151+
implementation(libs.retrofit2.retrofit)
152+
implementation(libs.retrofit2.converter.gson)
153+
implementation(libs.gson)
154+
implementation(libs.okhttp3.logging.interceptor)
155+
implementation(libs.androidx.core.ktx)
156+
implementation(libs.androidx.appcompat)
157+
implementation(libs.material)
158+
testImplementation(libs.junit)
159+
androidTestImplementation(libs.androidx.junit)
160+
androidTestImplementation(libs.androidx.espresso.core)
161+
androidTestImplementation(libs.kotlinx.coroutines.test)
162+
androidTestImplementation(libs.web3j)
163+
164+
testImplementation(libs.junit)
165+
androidTestImplementation(libs.androidx.junit)
166+
androidTestImplementation(libs.androidx.espresso.core)
167+
168+
// Add Mockito dependency
169+
testImplementation(libs.mockito.core)
170+
testImplementation(libs.mockito.android)
171+
androidTestImplementation(libs.mockito.core)
172+
androidTestImplementation(libs.mockito.android)
173+
}
174+
175+
afterEvaluate {
176+
configure<PublishingExtension> {
177+
publications {
178+
create<MavenPublication>("release") {
179+
from(components["release"])
180+
groupId = extra["libraryGroupId"] as String
181+
artifactId = extra["libraryArtifactId"] as String
182+
version = libraryVersion()
183+
}
184+
}
185+
186+
repositories {
187+
maven {
188+
name = "CircleModularwallets"
189+
url = URI(nexusRepo())
190+
isAllowInsecureProtocol = true
191+
credentials {
192+
username = nexusUsername()
193+
password = nexusPassword()
194+
}
195+
}
196+
}
197+
}
198+
}

‎lib/proguard-rules.pro‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
22+
# https://developer.android.com/identity/sign-in/credential-manager#proguard
23+
-if class androidx.credentials.CredentialManager
24+
-keep class androidx.credentials.playservices.** {
25+
*;
26+
}
27+
-keep public class com.circle.modularwallets.core.** {
28+
public *;
29+
}
30+
-keep class com.circle.modularwallets.core.apis.rp.PublicKeyCredentialCreationOptions { *; }
31+
-keep class com.circle.modularwallets.core.apis.rp.AuthenticatorSelectionCriteria { *; }
32+
-keep class com.circle.modularwallets.core.apis.rp.PublicKeyCredentialRpEntity { *; }
33+
-keep class com.circle.modularwallets.core.apis.rp.PublicKeyCredentialUserEntity { *; }
34+
-keep class com.circle.modularwallets.core.apis.rp.PublicKeyCredentialRequestOptions { *; }
35+
-keep class com.circle.modularwallets.core.apis.rp.PublicKeyCredentialDescriptor { *; }
36+
-keep class com.circle.modularwallets.core.apis.rp.PublicKeyCredentialParameters { *; }
37+
-keep class androidx.credentials.** { *; }
38+
-keep class org.json.** { *; }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<uses-permission android:name="android.permission.INTERNET" />
5+
</manifest>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0.
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.
9+
*
10+
* Http://www.apache.org/licenses/LICENSE-2.0.
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.
17+
*/
18+
19+
package com.circle.modularwallets.core.accounts
20+
21+
import android.content.Context
22+
23+
/**
24+
* Abstract class representing an account.
25+
*
26+
* @param T The type of the signed data.
27+
*/
28+
abstract class Account<T> {
29+
30+
/**
31+
* Retrieves the address of the account.
32+
*
33+
* @return The address of the account.
34+
*/
35+
abstract fun getAddress(): String
36+
37+
/**
38+
* Signs the given hex data.
39+
*
40+
* @param context The context in which the signing operation is performed.
41+
* @param hex The hex data to sign.
42+
* @return The signed data of type T.
43+
*/
44+
abstract suspend fun sign(context: Context, hex: String): T
45+
46+
/**
47+
* Signs the given message.
48+
*
49+
* @param context The context in which the signing operation is performed.
50+
* @param message The message to sign.
51+
* @return The signed message of type T.
52+
*/
53+
abstract suspend fun signMessage(context: Context, message: String): T
54+
55+
/**
56+
* Signs the given typed data.
57+
*
58+
* @param context The context in which the signing operation is performed.
59+
* @param typedData The typed data to sign.
60+
* @return The signed typed data of type T.
61+
*/
62+
abstract suspend fun signTypedData(context: Context, typedData: String): T
63+
}

0 commit comments

Comments
 (0)