feat(tokens): add Soroban config validation and admin signing flow - #4
feat(tokens): add Soroban config validation and admin signing flow#4Akinyemi04 wants to merge 1 commit into
Conversation
Validate contract IDs and admin secret key formats (fail-fast in production), derive the admin keypair via SorobanSigningService, add a SorobanTxService build/sign/submit primitive, and wire mint/sell to real admin-signed contract invocations.
82816d1 to
bacf28b
Compare
Joaco2603
left a comment
There was a problem hiding this comment.
Review — PR #4
Buen trabajo con la separación de SorobanSigningService y SorobanTxService, la validación de config en startup y el testeo. La migración de simulado a real está bien pensada.
Unos pocos detalles para corregir antes de mergear:
1. Type mismatch: signTransaction espera Transaction, prepareTransaction puede devolver FeeBumpTransaction
La firma de SorobanSigningService.signTransaction es:
signTransaction(transaction: Transaction): voidPero rpc.Server.prepareTransaction puede devolver Transaction | FeeBumpTransaction según la versión del SDK. Aunque en runtime ambas tienen .sign(), el tipo de TypeScript no lo va a aceptar. Cambiá la firma a Transaction | FeeBumpTransaction o usá el tipo común que ambos implementan.
2. xdr import no usado en runtime en soroban-tx.service.ts
import { ..., xdr } from "@stellar/stellar-sdk";xdr se usa solo en el tipo InvokeContractParams.args. Si el linter está configurado para no-unused-vars, esto va a fallar. Mejor importalo como type:
import type { xdr } from "@stellar/stellar-sdk";3. TokensService constructor — tipo más acotado que el config real
El sorobanConfig provee el StellarEnv completo, pero el constructor declara solo contracts:
private readonly config: {
contracts: { tokenMint: string; tokenSale: string };
},Funciona por structural typing, pero es confuso. Mejor usar Pick<StellarEnv, "contracts"> o declarar un interface local.
Nada bloqueante de runtime, pero son detalles que hacen diferencia en mantenibilidad. Arreglalos y mandate merge.
Validate contract IDs and admin secret key formats (fail-fast in production), derive the admin keypair via SorobanSigningService, add a SorobanTxService build/sign/submit primitive, and wire mint/sell to real admin-signed contract invocations.
Closes #3