Skip to content

Commit

Permalink
fix mint (#3956)
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Buslaev <[email protected]>
  • Loading branch information
artembuslaev authored Jul 31, 2024
1 parent 7780865 commit 92832d8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
31 changes: 20 additions & 11 deletions policy-service/src/policy-engine/mint/types/mint-ft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class MintFT extends TypedMint {

if (!this._ref?.dryRun) {
try {
const startTransactions = await workers.addRetryableTask(
workers.addRetryableTask(
{
type: WorkerTaskType.GET_TRANSACTIONS,
data: {
Expand All @@ -183,11 +183,15 @@ export class MintFT extends TypedMint {
1,
10,
userId
);

this._mintRequest.startTransaction =
startTransactions[0]?.consensus_timestamp;
await this._db.saveMintRequest(this._mintRequest);
).then(async startTransactions => {
try {
this._mintRequest.startTransaction =
startTransactions[0]?.consensus_timestamp;
await this._db.saveMintRequest(this._mintRequest);
} catch (error) {
this.error(error);
}
}).catch(error => this.error(error));
} catch (error) {
this.error(error);
}
Expand Down Expand Up @@ -243,7 +247,7 @@ export class MintFT extends TypedMint {

if (!this._ref?.dryRun) {
try {
const startTransactions = await workers.addRetryableTask(
workers.addRetryableTask(
{
type: WorkerTaskType.GET_TRANSACTIONS,
data: {
Expand All @@ -256,10 +260,15 @@ export class MintFT extends TypedMint {
1,
10,
userId
);
this._mintRequest.startTransaction =
startTransactions[0]?.consensus_timestamp;
await this._db.saveMintRequest(this._mintRequest);
).then(async startTransactions => {
try {
this._mintRequest.startTransaction =
startTransactions[0]?.consensus_timestamp;
await this._db.saveMintRequest(this._mintRequest);
} catch (error) {
this.error(error);
}
}).catch(error => this.error(error));
} catch (error) {
this.error(error);
}
Expand Down
13 changes: 9 additions & 4 deletions policy-service/src/policy-engine/mint/types/mint-nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class MintNFT extends TypedMint {
!Number.isInteger(this._mintRequest.startSerial)
) {
try {
const startSerial = await new Workers().addRetryableTask(
new Workers().addRetryableTask(
{
type: WorkerTaskType.GET_TOKEN_NFTS,
data: {
Expand All @@ -143,9 +143,14 @@ export class MintNFT extends TypedMint {
1,
10,
userId
);
this._mintRequest.startSerial = startSerial[0] || 0;
await this._db.saveMintRequest(this._mintRequest);
).then(async (startSerial) => {
try {
this._mintRequest.startSerial = startSerial[0] || 0;
await this._db.saveMintRequest(this._mintRequest);
} catch (error) {
this.error(error);
}
}).catch((error) => this.error(error));
} catch (error) {
this.error(error);
}
Expand Down

0 comments on commit 92832d8

Please sign in to comment.