From e1acbf6e0c04696983b303b9c6acc0bf7e1b1d79 Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Wed, 4 Mar 2026 14:40:42 +0100 Subject: [PATCH 1/2] Fix verify DEV deployment check using GitHub context SHA instead of API call (#3349) --- .github/workflows/api-pr.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/api-pr.yaml b/.github/workflows/api-pr.yaml index dbbfcbdc78..48aa5360ca 100644 --- a/.github/workflows/api-pr.yaml +++ b/.github/workflows/api-pr.yaml @@ -23,9 +23,14 @@ jobs: - name: Wait for DEV deployment timeout-minutes: 15 run: | - EXPECTED=$(curl -s https://api.github.com/repos/${{ github.repository }}/commits/develop | jq -r '.sha') + EXPECTED=${{ github.event.pull_request.head.sha }} echo "Expected commit: $EXPECTED" + if [ -z "$EXPECTED" ] || [ "$EXPECTED" == "null" ]; then + echo "::error::Could not determine expected commit SHA" + exit 1 + fi + for i in {1..30}; do if RESPONSE=$(curl -sf ${{ env.DEV_API_URL }}/version 2>&1); then ACTUAL=$(echo "$RESPONSE" | jq -r '.commit') From 29116d4d5812a93d9300a8ec3a478753f03ef7fb Mon Sep 17 00:00:00 2001 From: David May <85513542+davidleomay@users.noreply.github.com> Date: Wed, 4 Mar 2026 17:27:35 +0100 Subject: [PATCH 2/2] fix: spark wallet sync (#3353) --- .../blockchain/spark/spark-client.ts | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/integration/blockchain/spark/spark-client.ts b/src/integration/blockchain/spark/spark-client.ts index 52c34e823b..704a4f4741 100644 --- a/src/integration/blockchain/spark/spark-client.ts +++ b/src/integration/blockchain/spark/spark-client.ts @@ -1,8 +1,6 @@ import { SparkWallet } from '@buildonspark/spark-sdk'; -import { Injectable } from '@nestjs/common'; import { Currency } from '@uniswap/sdk-core'; import { GetConfig } from 'src/config/config'; -import { DfxLogger } from 'src/shared/services/dfx-logger'; import { AsyncField } from 'src/shared/utils/async-field'; import { BlockchainTokenBalance } from '../shared/dto/blockchain-token-balance.dto'; import { BlockchainClient } from '../shared/util/blockchain-client'; @@ -43,10 +41,7 @@ export interface SparkFeeEstimate { blocks: number; } -@Injectable() export class SparkClient extends BlockchainClient { - private readonly logger = new DfxLogger(SparkClient); - private readonly wallet: AsyncField; private readonly cachedAddress: AsyncField; @@ -58,7 +53,7 @@ export class SparkClient extends BlockchainClient { mnemonicOrSeed: GetConfig().blockchain.spark.sparkWalletSeed, accountNumber: 0, options: { network: 'MAINNET' }, - }).then((r) => r.wallet), + }).then(({ wallet }) => this.syncLeaves(wallet)), ); this.cachedAddress = new AsyncField(() => this.wallet.then((w) => w.getSparkAddress()), true); } @@ -72,6 +67,8 @@ export class SparkClient extends BlockchainClient { async sendTransaction(to: string, amount: number): Promise<{ txid: string; fee: number }> { const wallet = await this.wallet; + await this.syncLeaves(wallet); + const amountSats = Math.round(amount * 1e8); const result = await wallet.transfer({ @@ -128,6 +125,19 @@ export class SparkClient extends BlockchainClient { ); } + // --- SYNC METHODS --- // + + private async syncLeaves(wallet: SparkWallet): Promise { + // SDK bug: internal this.leaves cache is not synced on initialization or after deposits + // optimizeLeaves() fetches fresh leaves from network and updates the cache at the start, + // even when no optimization swaps are needed - consume generator to trigger sync + for await (const _ of wallet.optimizeLeaves()) { + /* Consume generator - sync happens at generator start */ + } + + return wallet; + } + // --- FEE METHODS (always 0 for Spark L2) --- // async getNativeFee(): Promise { @@ -154,6 +164,8 @@ export class SparkClient extends BlockchainClient { async getNativeCoinBalance(): Promise { const wallet = await this.wallet; + await this.syncLeaves(wallet); + const { balance } = await wallet.getBalance(); return Number(balance) / 1e8;