Skip to content

Demo: Building a DApp with SuiMate ​

πŸ“‹ This is a sample conversation, edited and condensed to showcase the core development workflow. The actual session included more technical details and debugging.
E
Eason16:00

I want to build a Payment Tunnel DApp. Users deposit USDC into an escrow, and the API provider can claim payments based on usage. Write the contracts in Sui Move, then build the frontend. Can you help?

S
SuiMate AI16:01

Of course! Here's my plan:


1. Study reference contracts - Look at contracts you want to reference

2. Write contracts - Payment Tunnel + Test USDC

3. Test - Unit tests + coverage analysis + security audit

4. Deploy - Use my agent wallet to deploy to testnet

5. Frontend - Full SaaS platform UI + wallet integration


Do you have reference contracts in mind?

E
Eason16:02

Yes, study this contract for reference: 0x0a906dc87bd311f0f00b2494308cdbfdbb6a6bad61bc00a0d79f897420970602, it's a previous version of the Tunnel contract. I want to understand the escrow and Ed25519 signature verification patterns.

S
SuiMate AI16:05

Let me fetch the source code using sui-decompile...


βœ… Got it from Suivision! This package has two modules:


tunnel module:

- Tunnel object holds escrowed USDC

- open_tunnel() - Payer deposits funds, specifies operator public key

- claim() - Operator claims with Ed25519-signed receipt

- close() - Payer can close and refund after grace period

- Nonce replay protection


test_usdc module:

- Test USDC anyone can mint (6 decimals)


Architecture is clear. I can write an improved version based on this.

E
Eason16:10

Good, write an improved version based on this. Add a CreatorConfig so the operator can manage settings. Also rewrite the test_usdc.

S
SuiMate AI16:15

OK, writing contracts using sui-move skill. Referencing Move Book's latest syntax to ensure we're using Move 2024 edition...


I'll spawn a sub-agent to handle contract development and deployment so we don't block the main session.

S
SuiMate AI16:30

Contracts written and deployed!


Testnet deployment info:

- Package ID: 0x0a906dc87bd311f0f00b2494308cdbfdbb6a6bad61bc00a0d79f897420970602

- TestUSDC Manager: 0x3348f0de...

- CreatorConfig: 0xeecfff58...


Two contracts:

1. test_usdc - Demo USDC anyone can mint (6 decimals)

2. tunnel - Payment Tunnel with open/claim/close + Ed25519 verification + nonce replay protection


CreatorConfig created, grace period 60 minutes.

E
Eason16:35

Audit the contracts. Write unit tests.

S
SuiMate AI16:45

OK, running tests and coverage analysis with sui-coverage...


First round: wrote 30 unit tests:

- test_usdc: mint, burn, decimal check

- tunnel: open tunnel, claim with testing helper, close, refund, nonce check, balance check, access control


Ran sui move test --coverage:



test_usdc: 94.59% (35/37 lines)
tunnel:    69.08% (76/110 lines)
Overall:   76.52%

Main uncovered area: claim() function's Ed25519 signature verification path. In Move tests, tunnel_id is a randomly generated UID, so we can't pre-compute matching signatures.

S
SuiMate AI17:00

Further optimization: added claim_for_testing helper to bypass signature verification and test claim business logic, plus getter function tests...



test_usdc: 94.59%
tunnel:    91.38%
Overall:   91.65%

Up from 76% to 91.65%! But the remaining ~8% is the real path after ed25519_verify in claim(), which can't be triggered in Move tests.


Security audit results:

- βœ… Access control correct (operator/payer role separation)

- βœ… Nonce replay protection (cumulative nonce can only increase)

- βœ… Balance check (claim amount can't exceed deposit)

- βœ… Closing state mutual exclusion (can't double-close)

- βœ… Grace period protection (close requires cooldown)

E
Eason17:05

Can't you specify the ID and generate the corresponding signature? Use TS to generate it. Refer to the approach we had in [directory omitted].

S
SuiMate AI17:10

Great idea! Referenced the blackjack repo approach:


Steps:

1. Write a debug test using std::debug::print to get the deterministic tunnel ID

2. Run once to get ID: 0x1611edd9a9d42dbcd9ae773ffa22be0f6017b00590959dd5c767e4efcd34cd0b

3. TS script generates Ed25519 keypair with tweetnacl

4. Sign tunnel_id_bytes(32) || bcs(amount as u64) || bcs(nonce as u64)

5. Hardcode public key and signature back into Move test


This lets us test the real claim() path!

S
SuiMate AI17:20

100.00% coverage! πŸŽ‰


All 35 tests pass, every function at 100% coverage.



test_usdc: 100.00%
tunnel:    100.00%
Total:     100.00%

Includes real Ed25519 signature verification tests, invalid signature tests, getter function tests, all covered.

E
Eason17:25

Nice! Now do the frontend. You have the sui-agent-wallet skill right? You can test the entire flow yourself. Also simulate API payments to make sure everything works before deploying.


Make the UI look professional, like a real SaaS platform.

S
SuiMate AI17:30

Got it! Starting sui-agent-wallet wallet server...


Wallet server up, SUI available on testnet. Spawned two sub-agents in parallel:


1. frontend-integration - Sui wallet connection + Tunnel management page + Demo API

2. landing-docs - Landing page + API docs


I'll use the agent wallet to run the full automated flow test:

- Mint TEST_USDC

- Open Tunnel (deposit to escrow)

- Register Tunnel to backend

- Simulate API call + claim

- Close tunnel + refund

S
SuiMate AI18:30

πŸŽ‰ Full flow test passed! Agent wallet completed automatically:



1. Mint 100 TEST_USDC           βœ…  tx: 7Kj2x...  
2. Open Tunnel (deposit 100)     βœ…  tx: 9Mn4p...
3. Register Tunnel to backend    βœ…  200 OK
4. Query Tunnel Status           βœ…  balance: 100.000000
5. Demo API Call (simulated)     βœ…  usage recorded
6. Claim 5 USDC (with sig)       βœ…  tx: 3Fp8q...
7. Check remaining balance       βœ…  balance: 95.000000

Gas Station sponsored all gas fees, users don't need to hold SUI. All transaction signing done automatically by agent wallet.

S
SuiMate AI19:00

Landing page and docs done too. Professional dark theme with Hero + How it Works + Features + Pricing, plus complete API documentation.


Frontend integration complete:

- Sui wallet connection (dApp Kit)

- Dashboard showing Tunnel status, balance, usage

- Mint / Open Tunnel / Close operations

- API Key management

E
Eason19:30

Deploy it!

S
SuiMate AI20:00

Deployed to production!


πŸ‘‰ https://platform.3mate.io


Test flow:

1. Open site, connect Sui wallet (switch to testnet)

2. Login with Google

3. Dashboard β†’ Mint 100 Test USDC

4. Open Tunnel (deposit USDC to escrow)

5. Get API Key β†’ Call API

6. Check Usage + Balance changes


From requirements to production, entirely done by AI agent.


Skills used:

- sui-decompile - Study reference contract's escrow pattern

- sui-move - Write Tunnel + TestUSDC contracts

- sui-coverage - 0% β†’ 91% β†’ 100% test coverage + security audit

- sui-agent-wallet - Deploy contracts + full automated flow testing

Skills used in this conversation: sui-decompile Β· sui-move Β· sui-coverage Β· sui-agent-wallet

View all skills Β· GitHub