Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b966c66
Merge pull request #202 from lightsparkdev/release/lightspark-sdk-v0.…
github-actions[bot] Sep 3, 2024
192326f
Add the uma-configuration file to the demo VASP
jklein24 Sep 10, 2024
0ddf5e8
Merge pull request #207 from lightsparkdev/feat/configfile
jklein24 Sep 10, 2024
a7488b2
adding sending / receiving vasp methods for demo
matthappens Sep 4, 2024
9817cd7
change path for requesting invoice
matthappens Sep 9, 2024
ccb0550
adding sending / receiving vasp methods for demo (#204)
matthappens Sep 11, 2024
adbbca9
adding basic receiver vasp methods
matthappens Sep 9, 2024
e6e92e8
remove duplicate code for create invoices
matthappens Sep 9, 2024
4ba4298
change to fetching well known configuration from sending vasp
matthappens Sep 17, 2024
55251cf
revert to previous endpoint
matthappens Sep 17, 2024
e17598e
adding basic receiver vasp methods (#205)
matthappens Sep 17, 2024
f56e771
adding sender vasp demo endpoints
matthappens Sep 9, 2024
c8f8a48
nits and such
matthappens Sep 10, 2024
a93d657
moving parameter to json body
matthappens Sep 10, 2024
119a9e7
Update SendingVasp.kt
matthappens Sep 18, 2024
7acf4da
ms -> s
matthappens Sep 18, 2024
1fffb04
adding sender vasp demo endpoints (#206)
matthappens Sep 18, 2024
0427a3f
Add explicit timeouts to the Requester
jklein24 Sep 23, 2024
8ad4c0b
Merge pull request #208 from lightsparkdev/fix/explicittimeout
jklein24 Sep 23, 2024
a6d5582
Create SECURITY.md
joelweinberger Sep 30, 2024
af198d9
Merge pull request #209 from lightsparkdev/joelweinberger-patch-2
joelweinberger Sep 30, 2024
86e830e
Regenerating SDKs following introspection of schemas.
JasonCWang Oct 10, 2024
4197b84
Merge pull request #210 from lightsparkdev/sdk-regen/6Gzn0g
JasonCWang Oct 10, 2024
6a463b3
Bump ci runners to macos-13. (#214)
jklein24 Feb 12, 2025
8134d17
Expose idempotency keys for operations which allow them. (#212)
jklein24 Feb 12, 2025
993f94d
Add the outgoing_payment_for_idempotency_key query. (#213)
jklein24 Feb 12, 2025
e0e32f7
Merge release/lightspark-sdk-v0.19.0 into develop (#215)
github-actions[bot] Feb 12, 2025
bc4d70c
Remove an extra param for outgoing_payment_for_idempotency_key (#219)
jklein24 Feb 13, 2025
2a67dec
Bump lightspark-sdk to version 0.19.1
Feb 13, 2025
f62e59e
Merge branch 'main' into release/lightspark-sdk-v0.19.1
jklein24 Feb 13, 2025
cf38342
Merge pull request #221 from lightsparkdev/release/lightspark-sdk-v0.…
github-actions[bot] Feb 13, 2025
aca333f
Fix non uma lnurl path (#224)
shreyav Mar 18, 2025
98a9dd8
Bump sdk version, use standard errors in UMA demo vasp (#226)
shreyav Mar 21, 2025
6009d01
Added paymentHash and preimageNonce params to createInvoice, createLn…
AaryamanBhute Mar 25, 2025
242a9ba
Merge pull request #227 from lightsparkdev/aaryaman/lpt-262-add-payme…
AaryamanBhute Mar 25, 2025
01cf641
Added releasePaymentPreimage functions to all 3 kotlin clients
AaryamanBhute Mar 26, 2025
934e765
Merge branch 'develop' into aaryaman/lpt-263-create-releasepaymentpre…
AaryamanBhute Mar 26, 2025
d8157b5
Merge pull request #229 from lightsparkdev/aaryaman/lpt-263-create-re…
AaryamanBhute Mar 26, 2025
b0c0715
Update Gradle version
alexjweil May 6, 2025
cd3dfd1
Merge pull request #232 from lightsparkdev/push-ktuxsvwrrswt
alexjweil Jun 9, 2025
0020f47
Fix misnamed buckets ldev.web-dev -> lsdev.web-dev
joelweinberger Jun 17, 2025
a467a3c
Rename to lightspark-dev-web.web-dev
joelweinberger Jun 17, 2025
f929b42
Merge pull request #234 from lightsparkdev/fix-misnamed-buckets
joelweinberger Jun 17, 2025
d25b3b4
Switch to CENTRAL_PORTAL for maven publishing (#235)
jklein24 Jun 21, 2025
b81bf8d
Bump core to version 0.6.1
Jun 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions androidwalletdemo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import java.io.FileInputStream
import java.util.*

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id(libs.plugins.androidApplication.get().pluginId)
kotlin("android")
Expand All @@ -20,7 +19,7 @@ try {

val isCI: Boolean = System.getenv("CI") == "true"
val jwtServerUrl: String = if (isCI) "" else
gradleLocalProperties(rootDir).getProperty("jwtServerUrl")
gradleLocalProperties(rootDir, providers).getProperty("jwtServerUrl")
?: throw Error("You must set the jwtServerUrl property in a local.properties file")

android {
Expand Down
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ subprojects {

plugins.withId("com.vanniktech.maven.publish.base") {
configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.S01, automaticRelease = true)
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
signAllPublications()
pom {
name.set(project.name)
Expand Down Expand Up @@ -147,6 +147,7 @@ subprojects {

if (project.name !in DEMO_APPS) {
apply(plugin = "org.jetbrains.kotlin.multiplatform")
apply(plugin = "com.android.library")
configure<KotlinMultiplatformExtension> {
jvmToolchain(11)
androidTarget {
Expand Down
5 changes: 2 additions & 3 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING
import com.mgd.core.gradle.S3Upload

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
kotlin("multiplatform")
alias(libs.plugins.kotlinSerialization)
Expand Down Expand Up @@ -127,14 +126,14 @@ tasks.register<Copy>("generateSdkDocs") {
}

s3 {
bucket = "lsdev.web-dev"
bucket = "lightspark-dev-web"
region = "us-west-2"
}

tasks.register<S3Upload>("uploadDocsToS3") {
group = "documentation"
dependsOn("generateSdkDocs")
bucket = "ldev.web-dev"
bucket = "lightspark-dev-web"
keyPrefix = "docs/kotlin"
sourceDir = "docs/html"
}
2 changes: 1 addition & 1 deletion core/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GROUP=com.lightspark
POM_ARTIFACT_ID=lightspark-core
# Don't bump this manually. Run `scripts/versions.main.kt <new_version>` to bump the version instead.
VERSION_NAME=0.6.0
VERSION_NAME=0.6.1

POM_DESCRIPTION=The Lightspark shared utilities library for Kotlin and Java.
POM_INCEPTION_YEAR=2023
1 change: 0 additions & 1 deletion crypto/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING
import de.undercouch.gradle.tasks.download.Download

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
kotlin("multiplatform")
id(libs.plugins.androidLibrary.get().pluginId)
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
# Core SDK deps (or common):
acinqSecp256k1 = "0.10.1"
androidGradlePlugin = "8.1.2"
androidGradlePlugin = "8.10.0"
appAuth = "0.11.1"
buildKonfig = "0.13.3"
dataStore = "1.0.0"
Expand All @@ -12,17 +12,17 @@ gradleS3 = "1.2.1"
jna = "5.13.0"
kase64 = "1.0.6"
kotest = "5.5.4"
kotlin = "1.9.0"
kotlin = "1.9.20"
kotlinCompilerExtension = "1.4.0"
kotlinCoroutines = "1.7.2"
kotlinxDateTime = "0.4.0"
kotlinSerializationJson = "1.4.1"
ktlint = "11.3.1"
ktor = "2.3.7"
lightsparkCore = "0.6.0"
lightsparkCore = "0.6.1"
lightsparkCrypto = "0.6.0"
uma = "1.3.0"
mavenPublish = "0.25.2"
uma = "1.5.0"
mavenPublish = "0.32.0"
mockitoCore = "5.5.0"
taskTree = "2.1.1"

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Feb 02 10:27:20 PST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
4 changes: 2 additions & 2 deletions lightspark-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Start by installing the SDK from maven:
**build.gradle:**
```groovy
dependencies {
implementation "com.lightspark:lightspark-sdk:0.19.0"
implementation "com.lightspark:lightspark-sdk:0.19.1"
}
```

or with **build.gradle.kts:**
```kotlin
dependencies {
implementation("com.lightspark:lightspark-sdk:0.19.0")
implementation("com.lightspark:lightspark-sdk:0.19.1")
}
```

Expand Down
5 changes: 2 additions & 3 deletions lightspark-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING
import com.mgd.core.gradle.S3Upload

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
kotlin("multiplatform")
alias(libs.plugins.kotlinSerialization)
Expand Down Expand Up @@ -137,14 +136,14 @@ tasks.register<Copy>("generateSdkDocs") {
}

s3 {
bucket = "lsdev.web-dev"
bucket = "lightspark-dev-web"
region = "us-west-2"
}

tasks.register<S3Upload>("uploadDocsToS3") {
group = "documentation"
dependsOn("generateSdkDocs")
bucket = "ldev.web-dev"
bucket = "lightspark-dev-web"
keyPrefix = "docs/kotlin"
sourceDir = "docs/html"
}
2 changes: 1 addition & 1 deletion lightspark-sdk/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GROUP=com.lightspark
POM_ARTIFACT_ID=lightspark-sdk
# Don't bump this manually. Run `scripts/versions.main.kt <new_version>` to bump the version instead.
VERSION_NAME=0.19.0
VERSION_NAME=0.19.1

POM_DESCRIPTION=The Lightspark API SDK for Kotlin and Java.
POM_INCEPTION_YEAR=2023
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.lightspark.sdk.model.InvoiceType
import com.lightspark.sdk.model.OutgoingPayment
import com.lightspark.sdk.model.PaymentDirection
import com.lightspark.sdk.model.RegionCode
import com.lightspark.sdk.model.ReleasePaymentPreimageOutput
import com.lightspark.sdk.model.RiskRating
import com.lightspark.sdk.model.TransactionStatus
import com.lightspark.sdk.model.UmaInvitation
Expand Down Expand Up @@ -116,6 +117,23 @@ class LightsparkFuturesClient(config: ClientConfig) {
): CompletableFuture<WalletDashboard?> =
coroutineScope.future { coroutinesClient.getSingleNodeDashboard(nodeId, numTransactions, bitcoinNetwork) }

/**
* Marks a payment preimage as released. To be used when the recipient has received the payment.
*
* @param invoiceId The invoice the preimage belongs to.
* @param paymentPreimage The preimage to release.
*/
fun releasePaymentPreimage(
invoiceId: String,
paymentPreimage: String
): CompletableFuture<ReleasePaymentPreimageOutput?> =
coroutineScope.future {
coroutinesClient.releasePaymentPreimage(
invoiceId,
paymentPreimage
)
}

/**
* Creates a lightning invoice for the given node.
*
Expand All @@ -126,6 +144,8 @@ class LightsparkFuturesClient(config: ClientConfig) {
* @param memo Optional memo to include in the invoice.
* @param type The type of invoice to create. Defaults to [InvoiceType.STANDARD].
* @param expirySecs The number of seconds until the invoice expires. Defaults to 1 day.
* @param paymentHash Optional payment hash to include in the invoice.
* @param preimageNonce Optional preimage nonce to include in the invoice.
*/
@JvmOverloads
fun createInvoice(
Expand All @@ -134,8 +154,20 @@ class LightsparkFuturesClient(config: ClientConfig) {
memo: String? = null,
type: InvoiceType = InvoiceType.STANDARD,
expirySecs: Int? = null,
paymentHash: String? = null,
preimageNonce: String? = null,
): CompletableFuture<Invoice> =
coroutineScope.future { coroutinesClient.createInvoice(nodeId, amountMsats, memo, type, expirySecs) }
coroutineScope.future {
coroutinesClient.createInvoice(
nodeId,
amountMsats,
memo,
type,
expirySecs,
paymentHash,
preimageNonce,
)
}

/**
* Creates a Lightning invoice for the given node. This should only be used for generating invoices for LNURLs, with
Expand All @@ -146,20 +178,26 @@ class LightsparkFuturesClient(config: ClientConfig) {
* @param metadata The LNURL metadata payload field from the initial payreq response. This will be hashed and
* present in the h-tag (SHA256 purpose of payment) of the resulting Bolt 11 invoice.
* @param expirySecs The number of seconds until the invoice expires. Defaults to 1 day.
* @param paymentHash Optional payment hash to include in the invoice.
* @param preimageNonce Optional preimage nonce to include in the invoice.
*/
@JvmOverloads
fun createLnurlInvoice(
nodeId: String,
amountMsats: Long,
metadata: String,
expirySecs: Int? = null,
paymentHash: String? = null,
preimageNonce: String? = null,
): CompletableFuture<Invoice> =
coroutineScope.future {
coroutinesClient.createLnurlInvoice(
nodeId,
amountMsats,
metadata,
expirySecs,
paymentHash,
preimageNonce,
)
}

Expand All @@ -175,6 +213,8 @@ class LightsparkFuturesClient(config: ClientConfig) {
* @param signingPrivateKey The receiver's signing private key. Used to hash the receiver identifier.
* @param receiverIdentifier Optional identifier of the receiver. If provided, this will be hashed using a
* monthly-rotated seed and used for anonymized analysis.
* @param paymentHash Optional payment hash to include in the invoice.
* @param preimageNonce Optional preimage nonce to include in the invoice.
*/
@JvmOverloads
@Throws(IllegalArgumentException::class)
Expand All @@ -185,6 +225,8 @@ class LightsparkFuturesClient(config: ClientConfig) {
expirySecs: Int? = null,
signingPrivateKey: ByteArray? = null,
receiverIdentifier: String? = null,
paymentHash: String? = null,
preimageNonce: String? = null,
): CompletableFuture<Invoice> =
coroutineScope.future {
coroutinesClient.createUmaInvoice(
Expand All @@ -194,6 +236,8 @@ class LightsparkFuturesClient(config: ClientConfig) {
expirySecs,
signingPrivateKey,
receiverIdentifier,
paymentHash,
preimageNonce,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,30 @@ class LightsparkCoroutinesClient private constructor(
)
}

/**
* Marks a payment preimage as released. To be used when the recipient has received the payment.
*
* @param invoiceId The invoice the preimage belongs to.
* @param paymentPreimage The preimage to release.
*/
suspend fun releasePaymentPreimage(invoiceId: String, paymentPreimage: String): ReleasePaymentPreimageOutput {
requireValidAuth()

return executeQuery(
Query(
ReleasePaymentPreimageMutation,
{
add("invoice_id", invoiceId)
add("payment_preimage", paymentPreimage)
},
) {
val releasePaymentPreimageJson =
requireNotNull(it["release_payment_preimage"]) { "Invalid response for payment preimage release" }
serializerFormat.decodeFromJsonElement<ReleasePaymentPreimageOutput>(releasePaymentPreimageJson)
},
)
}

/**
* Creates a lightning invoice for the given node.
*
Expand All @@ -182,13 +206,17 @@ class LightsparkCoroutinesClient private constructor(
* @param memo Optional memo to include in the invoice.
* @param type The type of invoice to create. Defaults to [InvoiceType.STANDARD].
* @param expirySecs The number of seconds until the invoice expires. Defaults to 1 day.
* @param paymentHash Optional payment hash to include in the invoice.
* @param preimageNonce Optional preimage nonce to include in the invoice.
*/
suspend fun createInvoice(
nodeId: String,
amountMsats: Long,
memo: String? = null,
type: InvoiceType = InvoiceType.STANDARD,
expirySecs: Int? = null,
paymentHash: String? = null,
preimageNonce: String? = null,
): Invoice {
requireValidAuth()
return executeQuery(
Expand All @@ -200,6 +228,8 @@ class LightsparkCoroutinesClient private constructor(
memo?.let { add("memo", memo) }
add("type", serializerFormat.encodeToJsonElement(type))
expirySecs?.let { add("expirySecs", expirySecs) }
paymentHash?.let { add("paymentHash", paymentHash) }
preimageNonce?.let { add("preimageNonce", preimageNonce) }
},
) {
val invoiceJson =
Expand All @@ -220,12 +250,16 @@ class LightsparkCoroutinesClient private constructor(
* @param metadata The LNURL metadata payload field from the initial payreq response. This will be hashed and
* present in the h-tag (SHA256 purpose of payment) of the resulting Bolt 11 invoice.
* @param expirySecs The number of seconds until the invoice expires. Defaults to 1 day.
* @param paymentHash Optional payment hash to include in the invoice.
* @param preimageNonce Optional preimage nonce to include in the invoice.
*/
suspend fun createLnurlInvoice(
nodeId: String,
amountMsats: Long,
metadata: String,
expirySecs: Int? = null,
paymentHash: String? = null,
preimageNonce: String? = null,
): Invoice {
requireValidAuth()

Expand All @@ -241,6 +275,8 @@ class LightsparkCoroutinesClient private constructor(
add("amountMsats", amountMsats)
add("metadataHash", metadataHash)
expirySecs?.let { add("expirySecs", expirySecs) }
paymentHash?.let { add("paymentHash", paymentHash) }
preimageNonce?.let { add("preimageNonce", preimageNonce) }
},
) {
val invoiceJson =
Expand All @@ -264,6 +300,8 @@ class LightsparkCoroutinesClient private constructor(
* @param signingPrivateKey The receiver's signing private key. Used to hash the receiver identifier.
* @param receiverIdentifier Optional identifier of the receiver. If provided, this will be hashed using a
* monthly-rotated seed and used for anonymized analysis.
* @param paymentHash Optional payment hash to include in the invoice.
* @param preimageNonce Optional preimage nonce to include in the invoice.
*/
@Throws(IllegalArgumentException::class)
suspend fun createUmaInvoice(
Expand All @@ -273,6 +311,8 @@ class LightsparkCoroutinesClient private constructor(
expirySecs: Int? = null,
signingPrivateKey: ByteArray? = null,
receiverIdentifier: String? = null,
paymentHash: String? = null,
preimageNonce: String? = null,
): Invoice {
requireValidAuth()

Expand All @@ -296,6 +336,8 @@ class LightsparkCoroutinesClient private constructor(
add("metadataHash", metadataHash)
expirySecs?.let { add("expirySecs", expirySecs) }
receiverHash?.let { add("receiverHash", receiverHash) }
paymentHash?.let { add("paymentHash", paymentHash) }
preimageNonce?.let { add("preimageNonce", preimageNonce) }
},
) {
val invoiceJson =
Expand Down
Loading