Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/modules/accounts/dto/create-account.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ export class CreateAccountDto {

@ApiProperty({
example: 2592000,
description: 'Expiry in seconds (1 hour - 30 days)',
description: 'Expiry in seconds (1 hour - 90 days)',
})
@IsNumber()
@Min(3600) // 1 hour
@Max(2592000) // 30 days
@Max(7776000) // 90 days
expiresIn: number;

@ApiProperty({ example: { userId: 'user_123' }, required: false })
Expand Down
6 changes: 6 additions & 0 deletions src/modules/stellar/stellar.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ export class StellarService {
// Step 2: Initialize the Soroban contract with restrictions
const expiryLedger = await this.toExpiryLedger(params.expiresIn);

this.logger.log(
`Expiry conversion: expiresIn=${params.expiresIn}s → expiryLedger=${expiryLedger} ` +
`(currentLedger=${Math.round(expiryLedger - Math.ceil(params.expiresIn / 5) - EXPIRY_BUFFER_LEDGERS)}, ` +
`offset=${expiryLedger - Math.round(expiryLedger - Math.ceil(params.expiresIn / 5) - EXPIRY_BUFFER_LEDGERS)} ledgers)`,
);

const contract = new StellarSdk.Contract(params.contractId);
const sourceAccount = await this.sorobanServer.getAccount(
fundingKeypair.publicKey(),
Expand Down