Skip to content

Commit

Permalink
Fix prettier issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Boldizsar Mezei committed Feb 21, 2024
1 parent 1803e81 commit e2d4e85
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 60 deletions.
4 changes: 1 addition & 3 deletions packages/functions/src/triggers/token.trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Member>();
const minter = await build5Db().doc(`${COL.MEMBER}/${token.mintingData?.mintedBy}`).get<Member>();
const paymentsSnap = await build5Db()
.collection(COL.TRANSACTION)
.where('type', '==', TransactionType.PAYMENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,8 @@ const onNftMinted = async (transaction: Transaction) => {
get(order, 'payload.nftOutputAmount', 0);

const member = await build5Db().doc(`${COL.MEMBER}/${transaction.member}`).get<Member>();
const collection = await build5Db()
.doc(`${COL.COLLECTION}/${nft?.collection}`)
.get<Collection>();
const space = await build5Db()
.doc(`${COL.SPACE}/${collection?.space}`)
.get<Space>();
const collection = await build5Db().doc(`${COL.COLLECTION}/${nft?.collection}`).get<Collection>();
const space = await build5Db().doc(`${COL.SPACE}/${collection?.space}`).get<Space>();

const remainder = order.payload.amount! - storageDepositTotal;

Expand Down Expand Up @@ -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<Member>();
const collection = await build5Db()
.doc(`${COL.COLLECTION}/${nft?.collection}`)
.get<Collection>();
const space = await build5Db()
.doc(`${COL.SPACE}/${collection?.space}`)
.get<Space>();
const collection = await build5Db().doc(`${COL.COLLECTION}/${nft?.collection}`).get<Collection>();
const space = await build5Db().doc(`${COL.SPACE}/${collection?.space}`).get<Space>();

if (Number(balance)) {
const creditTransaction: Transaction = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ const onFoundryMinted = async (transaction: Transaction) => {
});

const token = <Token>await build5Db().doc(`${COL.TOKEN}/${transaction.payload.token}`).get();
const member = <Member>await build5Db()
.doc(`${COL.MEMBER}/${token.mintingData?.mintedBy}`)
.get();
const member = <Member>await build5Db().doc(`${COL.MEMBER}/${token.mintingData?.mintedBy}`).get();
const order: Transaction = {
project: getProject(transaction),
type: TransactionType.MINT_TOKEN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ describe('Collection minting', () => {
expect(collectionData.total).toBe(
unsoldMintingOptions === UnsoldMintingOptions.BURN_UNSOLD ? 1 : 2,
);
nft = <Nft | undefined>await build5Db()
.doc(`${COL.NFT}/${nft?.uid}`)
.get();
nft = <Nft | undefined>await build5Db().doc(`${COL.NFT}/${nft?.uid}`).get();
expect(nft === undefined).toBe(unsoldMintingOptions === UnsoldMintingOptions.BURN_UNSOLD);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ describe('Collection minting', () => {
await build5Db().doc(`${COL.COLLECTION}/${helper.collection}`).get()
);
expect(collectionData.total).toBe(1);
nft = <Nft>await build5Db()
.doc(`${COL.NFT}/${nft?.uid}`)
.get();
nft = <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);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ describe('Collection minting', () => {
await build5Db().doc(`${COL.COLLECTION}/${helper.collection}`).get()
);
expect(collectionData.total).toBe(1);
nft = <Nft>await build5Db()
.doc(`${COL.NFT}/${nft?.uid}`)
.get();
nft = <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);
Expand Down
4 changes: 1 addition & 3 deletions packages/functions/test-tangle/nft-bulk/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <Collection>cCollection;

const nft = await this.createNft(address, collection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Nft>();
expect(nftSnap.length).toBe(1);
expect(nftSnap[0]?.space).toBe(award.space);
Expand Down
16 changes: 10 additions & 6 deletions packages/functions/test-tangle/staking/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ export class Helper {
expect(stake.token).toBe(this.token?.uid!);

await wait(async () => {
const currTokenStats = <TokenStats | undefined>await build5Db()
.doc(`${COL.TOKEN}/${this.token?.uid}/${SUB_COL.STATS}/${this.token?.uid}`)
.get();
const currTokenStats = <TokenStats | undefined>(
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
Expand Down Expand Up @@ -180,9 +182,11 @@ export class Helper {
type: StakeType,
membersCount: number,
) => {
this.tokenStats = <TokenStats>await build5Db()
.doc(`${COL.TOKEN}/${this.token!.uid}/${SUB_COL.STATS}/${this.token?.uid}`)
.get();
this.tokenStats = <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);
Expand Down
4 changes: 1 addition & 3 deletions packages/functions/test-tangle/staking/staking_3.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ describe('Staking test', () => {

const validateMemberTradingFee = async (expected: number) => {
await wait(async () => {
helper.member = <Member>await build5Db()
.doc(`${COL.MEMBER}/${helper.member?.uid}`)
.get();
helper.member = <Member>await build5Db().doc(`${COL.MEMBER}/${helper.member?.uid}`).get();
return helper.member.tokenTradingFeePercentage === expected;
});
};
Expand Down
8 changes: 2 additions & 6 deletions packages/functions/test-tangle/staking/staking_4.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ describe('Stake reward test test', () => {

await awaitTransactionConfirmationsForToken(helper.token?.uid!);

const member = <Member>await build5Db()
.doc(`${COL.MEMBER}/${helper.member?.uid}`)
.get();
const member = <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(
Expand Down Expand Up @@ -279,9 +277,7 @@ describe('Stake reward test test', () => {

await awaitTransactionConfirmationsForToken(helper.token?.uid!);

const member = <Member>await build5Db()
.doc(`${COL.MEMBER}/${helper.member?.uid}`)
.get();
const member = <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(
Expand Down
4 changes: 1 addition & 3 deletions packages/functions/test/controls/collection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)({});
Expand Down
4 changes: 1 addition & 3 deletions packages/functions/test/controls/order.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ const createCollectionFunc = async <T>(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 <Collection>cCollection;
};

Expand Down

0 comments on commit e2d4e85

Please sign in to comment.