diff --git a/apps/api/src/app/controllers/qr-codes/qr-codes.test.ts b/apps/api/src/app/controllers/qr-codes/qr-codes.test.ts index d4d5bf15c..0ab8ffa76 100644 --- a/apps/api/src/app/controllers/qr-codes/qr-codes.test.ts +++ b/apps/api/src/app/controllers/qr-codes/qr-codes.test.ts @@ -136,6 +136,7 @@ describe('QR Codes', () => { .query({ walletId: String(wallet._id) }) .set({ Authorization: widgetAccessToken }) .expect(({ body }: request.Response) => { + console.log(body); expect(body.erc721).toBeDefined(); expect(body.entry).toBeDefined(); expect(body.payment).toBeDefined(); diff --git a/apps/api/src/app/middlewares/errorOutput.ts b/apps/api/src/app/middlewares/errorOutput.ts index 34a22d88d..72ad710d9 100644 --- a/apps/api/src/app/middlewares/errorOutput.ts +++ b/apps/api/src/app/middlewares/errorOutput.ts @@ -15,9 +15,7 @@ interface ErrorResponse { // eslint-disable-next-line @typescript-eslint/no-unused-vars export const errorOutput = (error: any, req: Request, res: Response, next: NextFunction) => { let status = 500; - console.log(error); const response: ErrorResponse = { error: { message: 'Unable to fulfill request' } }; - console.log(error instanceof THXHttpError); if (error instanceof THXHttpError || error.status) { status = error.status; response.error.message = error.message; @@ -26,6 +24,5 @@ export const errorOutput = (error: any, req: Request, res: Response, next: NextF response.error.stack = error.stack; } - console.log(status, response); res.status(status).json(response); }; diff --git a/apps/api/src/app/models/ERC721.ts b/apps/api/src/app/models/ERC721.ts index e3a79bb8b..91945cff0 100644 --- a/apps/api/src/app/models/ERC721.ts +++ b/apps/api/src/app/models/ERC721.ts @@ -23,9 +23,9 @@ const schema = new mongoose.Schema( schema.virtual('contract').get(function () { if (!this.address) return; - const { web3, defaultAccount } = getProvider(this.chainId); + const { web3 } = getProvider(this.chainId); const { abi } = getArtifact('THXERC721'); - return new web3.eth.Contract(abi, this.address, { from: defaultAccount }); + return new web3.eth.Contract(abi, this.address); }); export const ERC721 = mongoose.model('ERC721', schema, 'erc721'); diff --git a/apps/api/src/app/services/ERC1155Service.ts b/apps/api/src/app/services/ERC1155Service.ts index 3b53952a8..3d9be0081 100644 --- a/apps/api/src/app/services/ERC1155Service.ts +++ b/apps/api/src/app/services/ERC1155Service.ts @@ -45,8 +45,8 @@ async function deploy(data: TERC1155, forceSync = true): Promise, forceSync = true) => { export async function deployCallback({ erc20Id }: TERC20DeployCallbackArgs, receipt: TransactionReceipt) { const erc20 = await ERC20.findById(erc20Id); - const { chainId } = erc20; - const { web3 } = getProvider(chainId); const { abi } = getArtifact(erc20.contractName); - const contract = new web3.eth.Contract(abi); - const events = parseLogs(contract.options.jsonInterface, receipt.logs); + const events = parseLogs(abi, receipt.logs); // Limited and unlimited tokes emit different events. Check if one of the two is emitted. if (!findEvent('OwnershipTransferred', events) && !findEvent('Transfer', events)) { diff --git a/apps/api/src/app/services/ERC721Service.ts b/apps/api/src/app/services/ERC721Service.ts index 934496444..21a529a29 100644 --- a/apps/api/src/app/services/ERC721Service.ts +++ b/apps/api/src/app/services/ERC721Service.ts @@ -32,12 +32,12 @@ async function deploy(data: TERC721, forceSync = true): Promise args: { erc721Id: String(erc721._id) }, }); - return ERC721.findByIdAndUpdate(erc721._id, { transactions: [txId] }, { new: true }); + return await ERC721.findByIdAndUpdate(erc721._id, { transactions: [txId] }, { new: true }); } async function deployCallback({ erc721Id }: TERC721DeployCallbackArgs, receipt: TransactionReceipt) { - const erc721 = await ERC721.findById(erc721Id); - const events = parseLogs(erc721.contract.options.jsonInterface, receipt.logs); + const { abi } = getArtifact(contractName); + const events = parseLogs(abi, receipt.logs); if (!findEvent('OwnershipTransferred', events) && !findEvent('Transfer', events)) { throw new ExpectedEventNotFound('Transfer or OwnershipTransferred'); diff --git a/apps/api/src/app/services/RewardNFTService.ts b/apps/api/src/app/services/RewardNFTService.ts index 8b6ac1838..d6c64139a 100644 --- a/apps/api/src/app/services/RewardNFTService.ts +++ b/apps/api/src/app/services/RewardNFTService.ts @@ -154,7 +154,6 @@ export default class RewardNFTService implements IRewardService { } findTokenById(nft: TERC721 | TERC1155, tokenId: string) { - console.log(nft.variant, tokenId); return this.services[nft.variant].findTokenById(tokenId); } diff --git a/apps/api/src/app/services/RewardService.ts b/apps/api/src/app/services/RewardService.ts index cdafab5d2..aa6560118 100644 --- a/apps/api/src/app/services/RewardService.ts +++ b/apps/api/src/app/services/RewardService.ts @@ -195,7 +195,7 @@ export default class RewardService { } } - static async create(variant: RewardVariant, poolId: string, data: Partial, file?: Express.Multer.File) { + static async create(variant: RewardVariant, poolId: string, data: Partial, file: Express.Multer.File) { if (file) { data.image = await ImageService.upload(file); } diff --git a/apps/api/src/app/services/TransactionService.ts b/apps/api/src/app/services/TransactionService.ts index 3e30b7ace..701df1db5 100644 --- a/apps/api/src/app/services/TransactionService.ts +++ b/apps/api/src/app/services/TransactionService.ts @@ -129,7 +129,7 @@ async function sendAsync( from: defaultAccount, to, data, - gas: gas + 100000, + gas: gas + 100000, // This was originally added for relayed transactions, not sure if still needed }); await transactionMined(tx, receipt); diff --git a/apps/api/tsconfig.spec.json b/apps/api/tsconfig.spec.json index e7639d7c4..ac89d4783 100644 --- a/apps/api/tsconfig.spec.json +++ b/apps/api/tsconfig.spec.json @@ -7,11 +7,6 @@ // Custom "allowJs": true }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "**/*.d.ts", - "../../libs/common/src/lib/types/**/*" - ] + "exclude": ["jest.config.ts", "src/**/*.test.ts", "../../libs/common/src/lib/scss/**/*"], + "include": ["src/**/*.ts", "../../libs/common/src/**/*", "../../libs/sdk/src/**/*", "src/app/hardhat/export/*.json"] }