Skip to content

Replace Mock XDR Transaction Building with Real Stellar XDR #1

Description

@Nanle-code

Overview

src/utils/soroban.rs has build_transaction_xdr, build_and_sign_transaction, and build_deploy_transaction_xdr all returning mock strings like "mock_transaction_xdr_...". The contract invocation (invoke_contract) and deployment simulation literally cannot work against a real Soroban node. ledger_key_to_xdr_base64 also has a comment saying 'in production use proper stellar-xdr encoding.'

Resolution

Use the already-imported stellar-xdr crate properly. Build a Transaction with a OperationBody::InvokeHostFunction wrapping a HostFunction::InvokeContract(InvokeContractArgs). Populate source_account from the wallet's public key decoded via stellar_strkey. Set fee, seq_num (fetched from Horizon's /accounts/{id} endpoint), and time_bounds. Serialize to XDR base64 with WriteXdr::to_xdr_base64. For signing: derive a SigningKey from the decoded secret key (already used in wallet.rs), sign the TransactionSignaturePayload (network passphrase hash + transaction hash), and attach the decorated signature to a TransactionEnvelope. Replace the mock build_deploy_transaction_xdr similarly using HostFunction::UploadContractWasm(wasm_bytes). Remove the upload_wasm subprocess call to stellar CLI and do it natively. This is the single most critical gap — without it, starforge contract invoke, starforge deploy --execute, and starforge deploy --simulate all silently produce garbage.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions