diff --git a/packages/functions/src/triggers/token.trigger.ts b/packages/functions/src/triggers/token.trigger.ts index 492eca541c..02dbd9d4c7 100644 --- a/packages/functions/src/triggers/token.trigger.ts +++ b/packages/functions/src/triggers/token.trigger.ts @@ -427,9 +427,7 @@ const setIpfsData = async (token: Token) => { const onTokenVaultEmptied = async (token: Token) => { const wallet = await WalletService.newWallet(token.mintingData?.network); const { amount: vaultBalance } = await wallet.getBalance(token.mintingData?.vaultAddress!); - const minter = await build5Db() - .doc(`${COL.MEMBER}/${token.mintingData?.mintedBy}`) - .get(); + const minter = await build5Db().doc(`${COL.MEMBER}/${token.mintingData?.mintedBy}`).get(); const paymentsSnap = await build5Db() .collection(COL.TRANSACTION) .where('type', '==', TransactionType.PAYMENT) diff --git a/packages/functions/src/triggers/transaction-trigger/matadatNft-minting.ts b/packages/functions/src/triggers/transaction-trigger/matadatNft-minting.ts index 530e51003d..663e81cc18 100644 --- a/packages/functions/src/triggers/transaction-trigger/matadatNft-minting.ts +++ b/packages/functions/src/triggers/transaction-trigger/matadatNft-minting.ts @@ -177,12 +177,8 @@ const onNftMinted = async (transaction: Transaction) => { get(order, 'payload.nftOutputAmount', 0); const member = await build5Db().doc(`${COL.MEMBER}/${transaction.member}`).get(); - const collection = await build5Db() - .doc(`${COL.COLLECTION}/${nft?.collection}`) - .get(); - const space = await build5Db() - .doc(`${COL.SPACE}/${collection?.space}`) - .get(); + const collection = await build5Db().doc(`${COL.COLLECTION}/${nft?.collection}`).get(); + const space = await build5Db().doc(`${COL.SPACE}/${collection?.space}`).get(); const remainder = order.payload.amount! - storageDepositTotal; @@ -232,12 +228,8 @@ const onNftUpdated = async (transaction: Transaction) => { const { amount: balance } = await wallet.getBalance(order.payload.targetAddress!); const member = await build5Db().doc(`${COL.MEMBER}/${transaction.member}`).get(); - const collection = await build5Db() - .doc(`${COL.COLLECTION}/${nft?.collection}`) - .get(); - const space = await build5Db() - .doc(`${COL.SPACE}/${collection?.space}`) - .get(); + const collection = await build5Db().doc(`${COL.COLLECTION}/${nft?.collection}`).get(); + const space = await build5Db().doc(`${COL.SPACE}/${collection?.space}`).get(); if (Number(balance)) { const creditTransaction: Transaction = { diff --git a/packages/functions/src/triggers/transaction-trigger/token-minting.ts b/packages/functions/src/triggers/transaction-trigger/token-minting.ts index 13aaca03e5..247f06ce53 100644 --- a/packages/functions/src/triggers/transaction-trigger/token-minting.ts +++ b/packages/functions/src/triggers/transaction-trigger/token-minting.ts @@ -107,9 +107,7 @@ const onFoundryMinted = async (transaction: Transaction) => { }); const token = await build5Db().doc(`${COL.TOKEN}/${transaction.payload.token}`).get(); - const member = await build5Db() - .doc(`${COL.MEMBER}/${token.mintingData?.mintedBy}`) - .get(); + const member = await build5Db().doc(`${COL.MEMBER}/${token.mintingData?.mintedBy}`).get(); const order: Transaction = { project: getProject(transaction), type: TransactionType.MINT_TOKEN, diff --git a/packages/functions/test-tangle/base-token-trading/base-token-trading_18.spec.ts b/packages/functions/test-tangle/base-token-trading/base-token-trading_18.spec.ts index e2251d16e4..2bbe3a1ff6 100644 --- a/packages/functions/test-tangle/base-token-trading/base-token-trading_18.spec.ts +++ b/packages/functions/test-tangle/base-token-trading/base-token-trading_18.spec.ts @@ -29,9 +29,7 @@ describe('Base token trading', () => { customMetadata: { request: { requestType: TangleRequestType.SELL_TOKEN } }, }); - const query = build5Db() - .collection(COL.TOKEN_MARKET) - .where('owner', '==', h.seller?.uid); + const query = build5Db().collection(COL.TOKEN_MARKET).where('owner', '==', h.seller?.uid); await wait(async () => { const snap = await query.get(); return snap.length === 1; diff --git a/packages/functions/test-tangle/base-token-trading/base-token-trading_19.spec.ts b/packages/functions/test-tangle/base-token-trading/base-token-trading_19.spec.ts index 2e5edcbd0d..d672b37e96 100644 --- a/packages/functions/test-tangle/base-token-trading/base-token-trading_19.spec.ts +++ b/packages/functions/test-tangle/base-token-trading/base-token-trading_19.spec.ts @@ -31,9 +31,7 @@ describe('Base token trading', () => { }, }); - const query = build5Db() - .collection(COL.TOKEN_MARKET) - .where('owner', '==', h.buyer?.uid); + const query = build5Db().collection(COL.TOKEN_MARKET).where('owner', '==', h.buyer?.uid); await wait(async () => { const snap = await query.get(); return snap.length === 1; diff --git a/packages/functions/test-tangle/collection-minting/collection-minting_6.spec.ts b/packages/functions/test-tangle/collection-minting/collection-minting_6.spec.ts index 14a0a190bb..84417c6ff1 100644 --- a/packages/functions/test-tangle/collection-minting/collection-minting_6.spec.ts +++ b/packages/functions/test-tangle/collection-minting/collection-minting_6.spec.ts @@ -31,9 +31,7 @@ describe('Collection minting', () => { expect(collectionData.total).toBe( unsoldMintingOptions === UnsoldMintingOptions.BURN_UNSOLD ? 1 : 2, ); - nft = await build5Db() - .doc(`${COL.NFT}/${nft?.uid}`) - .get(); + nft = await build5Db().doc(`${COL.NFT}/${nft?.uid}`).get(); expect(nft === undefined).toBe(unsoldMintingOptions === UnsoldMintingOptions.BURN_UNSOLD); }, ); diff --git a/packages/functions/test-tangle/collection-minting/collection-minting_7.spec.ts b/packages/functions/test-tangle/collection-minting/collection-minting_7.spec.ts index bdbe8273ef..c298bd3811 100644 --- a/packages/functions/test-tangle/collection-minting/collection-minting_7.spec.ts +++ b/packages/functions/test-tangle/collection-minting/collection-minting_7.spec.ts @@ -50,9 +50,7 @@ describe('Collection minting', () => { await build5Db().doc(`${COL.COLLECTION}/${helper.collection}`).get() ); expect(collectionData.total).toBe(1); - nft = await build5Db() - .doc(`${COL.NFT}/${nft?.uid}`) - .get(); + nft = await build5Db().doc(`${COL.NFT}/${nft?.uid}`).get(); expect(nft.availablePrice).toBe(2 * MIN_IOTA_AMOUNT); expect(nft.price).toBe(2 * MIN_IOTA_AMOUNT); }, diff --git a/packages/functions/test-tangle/collection-minting/collection-minting_8.spec.ts b/packages/functions/test-tangle/collection-minting/collection-minting_8.spec.ts index 422f452855..b24e8b422f 100644 --- a/packages/functions/test-tangle/collection-minting/collection-minting_8.spec.ts +++ b/packages/functions/test-tangle/collection-minting/collection-minting_8.spec.ts @@ -49,9 +49,7 @@ describe('Collection minting', () => { await build5Db().doc(`${COL.COLLECTION}/${helper.collection}`).get() ); expect(collectionData.total).toBe(1); - nft = await build5Db() - .doc(`${COL.NFT}/${nft?.uid}`) - .get(); + nft = await build5Db().doc(`${COL.NFT}/${nft?.uid}`).get(); expect(nft.isOwned).toBe(true); expect(nft.owner).toBe(helper.guardian); expect(nft.sold).toBe(true); diff --git a/packages/functions/test-tangle/nft-bulk/Helper.ts b/packages/functions/test-tangle/nft-bulk/Helper.ts index 5be0c6ed3a..4f19929b9f 100644 --- a/packages/functions/test-tangle/nft-bulk/Helper.ts +++ b/packages/functions/test-tangle/nft-bulk/Helper.ts @@ -57,9 +57,7 @@ export class Helper { const cCollection = await testEnv.wrap(createCollection)({}); expect(cCollection?.uid).toBeDefined(); - await build5Db() - .doc(`${COL.COLLECTION}/${cCollection?.uid}`) - .update({ approved: true }); + await build5Db().doc(`${COL.COLLECTION}/${cCollection?.uid}`).update({ approved: true }); const collection = cCollection; const nft = await this.createNft(address, collection); diff --git a/packages/functions/test-tangle/nft-staking/nft-staking_5.spec.ts b/packages/functions/test-tangle/nft-staking/nft-staking_5.spec.ts index e023137d2e..ed10c8bffa 100644 --- a/packages/functions/test-tangle/nft-staking/nft-staking_5.spec.ts +++ b/packages/functions/test-tangle/nft-staking/nft-staking_5.spec.ts @@ -83,9 +83,7 @@ describe('Stake nft', () => { return snap.length === 1; }); - const nftQuery = build5Db() - .collection(COL.NFT) - .where('space', '==', helper.space?.uid); + const nftQuery = build5Db().collection(COL.NFT).where('space', '==', helper.space?.uid); const nftSnap = await nftQuery.get(); expect(nftSnap.length).toBe(1); expect(nftSnap[0]?.space).toBe(award.space); diff --git a/packages/functions/test-tangle/staking/Helper.ts b/packages/functions/test-tangle/staking/Helper.ts index ec0032af0d..647e505a17 100644 --- a/packages/functions/test-tangle/staking/Helper.ts +++ b/packages/functions/test-tangle/staking/Helper.ts @@ -148,9 +148,11 @@ export class Helper { expect(stake.token).toBe(this.token?.uid!); await wait(async () => { - const currTokenStats = await build5Db() - .doc(`${COL.TOKEN}/${this.token?.uid}/${SUB_COL.STATS}/${this.token?.uid}`) - .get(); + const currTokenStats = ( + await build5Db() + .doc(`${COL.TOKEN}/${this.token?.uid}/${SUB_COL.STATS}/${this.token?.uid}`) + .get() + ); return ( (currTokenStats?.stakes || {})[type || StakeType.DYNAMIC]?.totalAmount !== (this.tokenStats?.stakes || {})[type || StakeType.DYNAMIC]?.totalAmount @@ -180,9 +182,11 @@ export class Helper { type: StakeType, membersCount: number, ) => { - this.tokenStats = await build5Db() - .doc(`${COL.TOKEN}/${this.token!.uid}/${SUB_COL.STATS}/${this.token?.uid}`) - .get(); + this.tokenStats = ( + await build5Db() + .doc(`${COL.TOKEN}/${this.token!.uid}/${SUB_COL.STATS}/${this.token?.uid}`) + .get() + ); expect(this.tokenStats.stakes![type].amount).toBe(stakeAmount); expect(this.tokenStats.stakes![type].totalAmount).toBe(stakeTotalAmount); expect(this.tokenStats.stakes![type].value).toBe(stakeValue); diff --git a/packages/functions/test-tangle/staking/staking_3.spec.ts b/packages/functions/test-tangle/staking/staking_3.spec.ts index 8020c0c513..a765b49bfc 100644 --- a/packages/functions/test-tangle/staking/staking_3.spec.ts +++ b/packages/functions/test-tangle/staking/staking_3.spec.ts @@ -21,9 +21,7 @@ describe('Staking test', () => { const validateMemberTradingFee = async (expected: number) => { await wait(async () => { - helper.member = await build5Db() - .doc(`${COL.MEMBER}/${helper.member?.uid}`) - .get(); + helper.member = await build5Db().doc(`${COL.MEMBER}/${helper.member?.uid}`).get(); return helper.member.tokenTradingFeePercentage === expected; }); }; diff --git a/packages/functions/test-tangle/staking/staking_4.spec.ts b/packages/functions/test-tangle/staking/staking_4.spec.ts index 5a0ca6464d..8493be328b 100644 --- a/packages/functions/test-tangle/staking/staking_4.spec.ts +++ b/packages/functions/test-tangle/staking/staking_4.spec.ts @@ -189,9 +189,7 @@ describe('Stake reward test test', () => { await awaitTransactionConfirmationsForToken(helper.token?.uid!); - const member = await build5Db() - .doc(`${COL.MEMBER}/${helper.member?.uid}`) - .get(); + const member = await build5Db().doc(`${COL.MEMBER}/${helper.member?.uid}`).get(); for (const address of [helper.memberAddress?.bech32!, getAddress(member, Network.RMS)]) { const outputs = await helper.walletService!.getOutputs(address, [], false, true); const nativeTokens = Object.values(outputs).reduce( @@ -279,9 +277,7 @@ describe('Stake reward test test', () => { await awaitTransactionConfirmationsForToken(helper.token?.uid!); - const member = await build5Db() - .doc(`${COL.MEMBER}/${helper.member?.uid}`) - .get(); + const member = await build5Db().doc(`${COL.MEMBER}/${helper.member?.uid}`).get(); for (const address of [helper.memberAddress?.bech32!, getAddress(member, Network.RMS)]) { const outputs = await helper.walletService!.getOutputs(address, [], false, true); const nativeTokens = Object.values(outputs).reduce( diff --git a/packages/functions/test/controls/collection.spec.ts b/packages/functions/test/controls/collection.spec.ts index 4e5141e9df..1ff165575c 100644 --- a/packages/functions/test/controls/collection.spec.ts +++ b/packages/functions/test/controls/collection.spec.ts @@ -421,9 +421,7 @@ describe('CollectionController: ' + WEN_FUNC.createCollection, () => { WenError.you_must_be_the_creator_of_this_collection.key, ); - await build5Db() - .doc(`${COL.COLLECTION}/${cCollection?.uid}`) - .update({ approved: true }); + await build5Db().doc(`${COL.COLLECTION}/${cCollection?.uid}`).update({ approved: true }); mockWalletReturnValue(walletSpy, secondGuardian, updateData); const uCollection = await testEnv.wrap(updateCollection)({}); diff --git a/packages/functions/test/controls/order.spec.ts b/packages/functions/test/controls/order.spec.ts index a9110d2b81..1f62c25964 100644 --- a/packages/functions/test/controls/order.spec.ts +++ b/packages/functions/test/controls/order.spec.ts @@ -76,9 +76,7 @@ const createCollectionFunc = async (address: NetworkAddress, params: T) => { const cCollection = await testEnv.wrap(createCollection)({}); expect(cCollection?.uid).toBeDefined(); - await build5Db() - .doc(`${COL.COLLECTION}/${cCollection?.uid}`) - .update({ approved: true }); + await build5Db().doc(`${COL.COLLECTION}/${cCollection?.uid}`).update({ approved: true }); return cCollection; };