Skip to content

feat: implement Soroban contract call helpers and wallet signing (#8) - #62

Merged
soomtochukwu merged 3 commits into
DXmakers:mainfrom
aadviksinghdebug:feat/soroban-contract-helpers-8
Mar 29, 2026
Merged

feat: implement Soroban contract call helpers and wallet signing (#8)#62
soomtochukwu merged 3 commits into
DXmakers:mainfrom
aadviksinghdebug:feat/soroban-contract-helpers-8

Conversation

@aadviksinghdebug

Copy link
Copy Markdown

apps/web/lib/stellar.ts

  • connectWallet: opens StellarWalletsKit modal, waits for wallet selection, returns the connected public key
  • signTransaction: passes XDR to the connected wallet (Freighter) with the correct networkPassphrase; returns the signed XDR string

apps/web/lib/contracts.ts

  • Add @stellar/stellar-sdk imports (Contract, TransactionBuilder, nativeToScVal, Address, SorobanServer)
  • invokeEscrow: shared pipeline — load account, build tx, rpc.prepareTransaction (simulate + assemble footprint), sign via signTransaction(), submit signed XDR, poll until SUCCESS/FAILED, return confirmed tx hash
  • depositEscrow: validates params (zero amount, missing addresses, milestones < 1) before building XDR; calls escrow.deposit with job_id u64, client/freelancer/token Address, amount i128, milestones u32
  • releaseMilestone: derives caller from connected wallet; calls escrow.release_milestone(job_id, caller)
  • openDispute: derives caller from connected wallet; calls escrow.open_dispute(job_id, caller)

apps/web/package.json

  • Add @stellar/stellar-sdk ^13.0.0

Required env vars:
NEXT_PUBLIC_ESCROW_CONTRACT_ID — deployed escrow contract address
NEXT_PUBLIC_USDC_CONTRACT_ID — USDC token contract address
NEXT_PUBLIC_SOROBAN_RPC_URL — Soroban RPC endpoint (defaults to testnet)
NEXT_PUBLIC_STELLAR_NETWORK — network passphrase (defaults to TESTNET)

Closes #8

…akers#8)

apps/web/lib/stellar.ts
- connectWallet: opens StellarWalletsKit modal, waits for wallet
  selection, returns the connected public key
- signTransaction: passes XDR to the connected wallet (Freighter) with
  the correct networkPassphrase; returns the signed XDR string

apps/web/lib/contracts.ts
- Add @stellar/stellar-sdk imports (Contract, TransactionBuilder,
  nativeToScVal, Address, SorobanServer)
- invokeEscrow: shared pipeline — load account, build tx,
  rpc.prepareTransaction (simulate + assemble footprint), sign via
  signTransaction(), submit signed XDR, poll until SUCCESS/FAILED,
  return confirmed tx hash
- depositEscrow: validates params (zero amount, missing addresses,
  milestones < 1) before building XDR; calls escrow.deposit with
  job_id u64, client/freelancer/token Address, amount i128, milestones u32
- releaseMilestone: derives caller from connected wallet; calls
  escrow.release_milestone(job_id, caller)
- openDispute: derives caller from connected wallet; calls
  escrow.open_dispute(job_id, caller)

apps/web/package.json
- Add @stellar/stellar-sdk ^13.0.0

Required env vars:
  NEXT_PUBLIC_ESCROW_CONTRACT_ID  — deployed escrow contract address
  NEXT_PUBLIC_USDC_CONTRACT_ID    — USDC token contract address
  NEXT_PUBLIC_SOROBAN_RPC_URL     — Soroban RPC endpoint (defaults to testnet)
  NEXT_PUBLIC_STELLAR_NETWORK     — network passphrase (defaults to TESTNET)

Closes DXmakers#8
@drips-wave

drips-wave Bot commented Mar 29, 2026

Copy link
Copy Markdown

@aadviksinghdebug Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@soomtochukwu

soomtochukwu commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

@aadviksinghdebug, could you look into the CI errors

ritik4ever and others added 2 commits March 29, 2026 12:48
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ES2020

- Regenerate package-lock.json (was missing transitive deps causing npm ci to fail)
- Restore getWalletsKit import that was incorrectly removed (used in getCallerAddress)
- Change tsconfig target ES2017→ES2020 to allow BigInt literals

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aadviksinghdebug

Copy link
Copy Markdown
Author

@soomtochukwu please review CI is fixed

@soomtochukwu
soomtochukwu merged commit ca70d2f into DXmakers:main Mar 29, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Soroban Contract Call Helpers (Frontend)

3 participants