From ae9c1a0bdd3a29925736af2c463ef2d7a599d9bb Mon Sep 17 00:00:00 2001 From: Boldizsar Mezei Date: Fri, 6 Oct 2023 14:58:51 +0200 Subject: [PATCH] iota/sdk Fixes --- .../workflows/functions_emulated-tests.yml | 72 +- .../functions_online-emulated-tests.yml | 68 +- ...ions_tangle-online-unit-tests_emulator.yml | 3996 +++++++++++++++- .../workflows/functions_tangle-unit-tests.yml | 4006 ++++++++++++++++- packages/api/package.json | 5 +- packages/api/src/metadataNft/getNftIds.ts | 30 +- .../src/metadataNft/getNftMutableMetadata.ts | 7 +- .../getNftMutableMetadataHistory.ts | 51 +- packages/api/src/metadataNft/wallet.ts | 22 +- packages/database/package.json | 3 +- packages/functions/package.json | 9 +- .../collection/collection-mint.control.ts | 27 +- .../token-minting/airdrop-minted-token.ts | 8 +- .../token-minting/import-minted-token.ts | 6 +- .../token-minting/token-mint.control.ts | 20 +- .../functions/src/cron/stakeReward.cron.ts | 2 +- .../src/firebase/functions/onRequest.ts | 1 + .../services/payment/award/award-service.ts | 35 +- .../payment/nft/nft-deposit-service.ts | 8 +- .../services/payment/nft/nft-stake-service.ts | 28 +- .../services/payment/space/space-service.ts | 39 +- .../award/award.fund.service.ts | 2 +- .../metadataNft/mint-metadata-nft.service.ts | 59 +- .../proposal/voting/token.voting.ts | 15 +- .../tangle-service/token/stake.service.ts | 15 +- .../token/token-claim.service.ts | 9 +- .../token/token-trade.service.ts | 10 +- .../token/import-minted-token.service.ts | 52 +- .../services/payment/transaction-service.ts | 38 +- .../src/services/wallet/AliasWallet.ts | 120 +- .../src/services/wallet/IotaWalletService.ts | 302 +- .../src/services/wallet/NativeTokenWallet.ts | 69 +- .../src/services/wallet/NftWallet.ts | 506 +-- .../src/services/wallet/wallet.service.ts | 16 +- .../functions/src/services/wallet/wallet.ts | 24 +- .../functions/src/triggers/award.trigger.ts | 2 +- .../MilestoneTransactionAdapter.ts | 63 +- .../milestone-transactions-triggers/common.ts | 15 +- .../token.foundry.ts | 42 +- .../token-trading/match-base-token.ts | 17 +- .../token-trading/match-minted-token.ts | 48 +- .../functions/src/triggers/token.trigger.ts | 2 +- .../transaction-trigger/airdrop.claim.ts | 27 +- .../award.transaction.update.ts | 22 +- .../transaction-trigger/collection-minting.ts | 31 +- .../transaction-trigger/matadatNft-minting.ts | 33 +- .../transaction-trigger/token-minting.ts | 49 +- .../transaction-trigger/wallet-params.ts | 5 +- .../functions/src/utils/basic-output.utils.ts | 212 +- .../src/utils/bech32-address.helper.ts | 132 +- packages/functions/src/utils/block.utils.ts | 87 +- .../collection-minting-utils/nft.utils.ts | 72 +- .../functions/src/utils/nft.output.utils.ts | 46 +- packages/functions/src/utils/smr.utils.ts | 47 - .../utils/token-minting-utils/alias.utils.ts | 66 +- .../token-minting-utils/foundry.utils.ts | 65 +- .../utils/token-minting-utils/member.utils.ts | 13 +- .../functions/src/utils/token-trade.utils.ts | 2 +- packages/functions/src/utils/wallet.utils.ts | 26 +- .../functions/test-tangle/address.spec.ts | 4 +- .../award-tangle/award-tangle_3.spec.ts | 5 +- .../test-tangle/award/award_1.spec.ts | 23 +- .../test-tangle/award/award_10.spec.ts | 5 +- .../test-tangle/award/award_2.spec.ts | 20 +- .../test-tangle/award/award_5.spec.ts | 9 +- .../test-tangle/award/award_6.spec.ts | 4 +- .../test-tangle/award/award_7.spec.ts | 18 +- .../test-tangle/collection-minting/Helper.ts | 11 +- .../collection-minting_4.spec.ts | 9 +- packages/functions/test-tangle/common.ts | 16 +- packages/functions/test-tangle/faucet.ts | 11 +- .../metadata-nft/mint-metadata-nft_1.spec.ts | 11 +- .../metadata-nft/mint-metadata-nft_2.spec.ts | 8 +- .../metadata-nft/mint-metadata-nft_3.spec.ts | 13 +- .../minted-nft-trading_1.spec.ts | 14 +- .../minted-nft-trading_1_b.spec.ts | 17 +- .../minted-nft-trading_2.spec.ts | 15 +- .../minted-nft-trading_4.spec.ts | 6 +- .../minted-nft-trading_6.spec.ts | 6 +- .../minted-nft-trading_7.spec.ts | 6 +- .../minted-token-airdrop_2.spec.ts | 9 +- .../test-tangle/minted-token-trade/Helper.ts | 7 +- .../minted-token-trade_16.spec.ts | 11 +- .../minted-token-trade_17.spec.ts | 11 +- .../minted-token-trade_18.spec.ts | 7 +- .../minted-token-trade_3.spec.ts | 7 +- .../minted-token-trade_9.spec.ts | 7 +- .../test-tangle/nft-bid/nft-bid.otr_1.spec.ts | 15 +- .../test-tangle/nft-staking/Helper.ts | 97 +- .../nft-staking/nft-staking_3.spec.ts | 4 +- .../nft-staking/nft-staking_6.spec.ts | 29 +- .../functions/test-tangle/staking/Helper.ts | 5 +- .../functions/test-tangle/staking/newFile.ts | 99 + .../test-tangle/staking/staking_1.spec.ts | 10 +- .../test-tangle/staking/staking_2.spec.ts | 15 +- .../test-tangle/staking/staking_4.spec.ts | 8 +- .../test-tangle/staking/staking_5.spec.ts | 7 +- .../test-tangle/token.based.voting/Helper.ts | 5 +- .../test-tangle/token.claim.minted.spec.ts | 3 +- .../test-tangle/token.mint/Helper.ts | 118 +- .../token.mint/token.mint_1.spec.ts | 19 +- .../token.mint/token.mint_2.spec.ts | 5 +- .../transaction-trigger_12.spec.ts | 17 +- .../transaction-trigger_2.spec.ts | 4 +- .../transaction-trigger_3.spec.ts | 18 +- .../transaction-trigger_4.spec.ts | 18 +- .../withdraw-deposit-nft/Helper.ts | 81 +- .../deposit-withraw-nft_12_a.spec.ts | 90 +- .../deposit-withraw-nft_12_b.spec.ts | 90 +- .../deposit-withraw-nft_13.spec.ts | 89 +- packages/functions/test/controls/common.ts | 19 +- packages/functions/test/milestone.sync.ts | 7 +- packages/functions/workflow.build.js | 2 +- packages/interfaces/src/models/milestone.ts | 2 +- packages/lib/package.json | 2 - 115 files changed, 9496 insertions(+), 2476 deletions(-) delete mode 100644 packages/functions/src/utils/smr.utils.ts create mode 100644 packages/functions/test-tangle/staking/newFile.ts diff --git a/.github/workflows/functions_emulated-tests.yml b/.github/workflows/functions_emulated-tests.yml index 1d7cbc56c2..58a0e62be1 100644 --- a/.github/workflows/functions_emulated-tests.yml +++ b/.github/workflows/functions_emulated-tests.yml @@ -52,13 +52,13 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test:ci -- --findRelatedTests test/db.roll.spec.ts && - npm run test:ci -- --findRelatedTests test/auth.spec.ts && - npm run test:ci -- --findRelatedTests test/storage/resize.img.spec.ts && - npm run test:ci -- --findRelatedTests test/stake/stake.reward.cron.spec.ts && - npm run test:ci -- --findRelatedTests test/stake/delete.stake.reward.spec.ts && - npm run test:ci -- --findRelatedTests test/dbRoll/total.guardians.roll.spec.ts && - npm run test:ci -- --findRelatedTests test/cron/proposal.cron.spec.ts + npm run test:ci -- --findRelatedTests ./test/auth.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/address.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/collection.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/member.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/nft-bidding.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/nft.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/order.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -93,13 +93,13 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test:ci -- --findRelatedTests test/cron/nft-stake.cron.spec.ts && - npm run test:ci -- --findRelatedTests test/cron/floor-price.cron.only.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/workflow.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/workflow-online.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token.order.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token.expired.sale.cron.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token-trade.trigger.spec.ts + npm run test:ci -- --findRelatedTests ./test/controls/proposal.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/space.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/stake.reward.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token-distribution-auto-trigger.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token-distribution.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token-trade.buy.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token-trade.sell.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -134,13 +134,13 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test:ci -- --findRelatedTests test/controls/token-trade.sell.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token-trade.buy.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token-distribution.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token-distribution-auto-trigger.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/stake.reward.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/space.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/proposal.spec.ts + npm run test:ci -- --findRelatedTests ./test/controls/token-trade.trigger.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token.expired.sale.cron.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token.order.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token/token.airdrop.claim.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token/token.airdrop.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token/token.cancel.pub.sale.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token/token.create.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -175,13 +175,13 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test:ci -- --findRelatedTests test/controls/order.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/nft.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/nft-bidding.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/member.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/collection.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/address.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token/token.vote.spec.ts + npm run test:ci -- --findRelatedTests ./test/controls/token/token.order.and.claim.air.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token/token.rank.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token/token.set.to.sale.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token/token.update.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/token/token.vote.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/workflow-online.spec.ts && + npm run test:ci -- --findRelatedTests ./test/controls/workflow.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -216,13 +216,13 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test:ci -- --findRelatedTests test/controls/token/token.update.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token/token.set.to.sale.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token/token.rank.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token/token.order.and.claim.air.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token/token.create.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token/token.cancel.pub.sale.spec.ts && - npm run test:ci -- --findRelatedTests test/controls/token/token.airdrop.spec.ts + npm run test:ci -- --findRelatedTests ./test/cron/floor-price.cron.only.spec.ts && + npm run test:ci -- --findRelatedTests ./test/cron/nft-stake.cron.spec.ts && + npm run test:ci -- --findRelatedTests ./test/cron/proposal.cron.spec.ts && + npm run test:ci -- --findRelatedTests ./test/db.roll.spec.ts && + npm run test:ci -- --findRelatedTests ./test/dbRoll/total.guardians.roll.spec.ts && + npm run test:ci -- --findRelatedTests ./test/stake/delete.stake.reward.spec.ts && + npm run test:ci -- --findRelatedTests ./test/stake/stake.reward.cron.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -257,7 +257,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test:ci -- --findRelatedTests test/controls/token/token.airdrop.claim.spec.ts + npm run test:ci -- --findRelatedTests ./test/storage/resize.img.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 diff --git a/.github/workflows/functions_online-emulated-tests.yml b/.github/workflows/functions_online-emulated-tests.yml index f2c2b5d54d..ccec0a0e0b 100644 --- a/.github/workflows/functions_online-emulated-tests.yml +++ b/.github/workflows/functions_online-emulated-tests.yml @@ -54,13 +54,13 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-online:ci -- --findRelatedTests test/db.roll.spec.ts && - npm run test-online:ci -- --findRelatedTests test/auth.spec.ts && - npm run test-online:ci -- --findRelatedTests test/storage/resize.img.spec.ts && - npm run test-online:ci -- --findRelatedTests test/stake/stake.reward.cron.spec.ts && - npm run test-online:ci -- --findRelatedTests test/stake/delete.stake.reward.spec.ts && - npm run test-online:ci -- --findRelatedTests test/cron/proposal.cron.spec.ts && - npm run test-online:ci -- --findRelatedTests test/cron/nft-stake.cron.spec.ts + npm run test-online:ci -- --findRelatedTests ./test/auth.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/address.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/collection.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/member.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/nft-bidding.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/nft.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/order.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -95,13 +95,13 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-online:ci -- --findRelatedTests test/controls/workflow.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/workflow-online.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token.order.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token.expired.sale.cron.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token-trade.trigger.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token-trade.sell.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token-trade.buy.spec.ts + npm run test-online:ci -- --findRelatedTests ./test/controls/proposal.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/space.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/stake.reward.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token-distribution-auto-trigger.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token-distribution.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token-trade.buy.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token-trade.sell.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -136,13 +136,13 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-online:ci -- --findRelatedTests test/controls/token-distribution.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token-distribution-auto-trigger.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/stake.reward.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/space.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/proposal.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/order.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/nft.spec.ts + npm run test-online:ci -- --findRelatedTests ./test/controls/token-trade.trigger.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token.expired.sale.cron.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token.order.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token/token.airdrop.claim.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token/token.airdrop.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token/token.cancel.pub.sale.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token/token.create.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -177,13 +177,13 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-online:ci -- --findRelatedTests test/controls/nft-bidding.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/member.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/collection.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/address.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token/token.vote.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token/token.update.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token/token.set.to.sale.spec.ts + npm run test-online:ci -- --findRelatedTests ./test/controls/token/token.order.and.claim.air.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token/token.rank.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token/token.set.to.sale.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token/token.update.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/token/token.vote.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/workflow-online.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/controls/workflow.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -218,12 +218,12 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-online:ci -- --findRelatedTests test/controls/token/token.rank.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token/token.order.and.claim.air.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token/token.create.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token/token.cancel.pub.sale.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token/token.airdrop.spec.ts && - npm run test-online:ci -- --findRelatedTests test/controls/token/token.airdrop.claim.spec.ts + npm run test-online:ci -- --findRelatedTests ./test/cron/nft-stake.cron.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/cron/proposal.cron.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/db.roll.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/stake/delete.stake.reward.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/stake/stake.reward.cron.spec.ts && + npm run test-online:ci -- --findRelatedTests ./test/storage/resize.img.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 diff --git a/.github/workflows/functions_tangle-online-unit-tests_emulator.yml b/.github/workflows/functions_tangle-online-unit-tests_emulator.yml index 17bdbbb887..0d2d2fcc5e 100644 --- a/.github/workflows/functions_tangle-online-unit-tests_emulator.yml +++ b/.github/workflows/functions_tangle-online-unit-tests_emulator.yml @@ -54,9 +54,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/workflow.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/workflow-online.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/tran.match.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/address.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -91,9 +89,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/trade-base-token-order.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.claim.minted.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/address.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -128,9 +124,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_9.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_8.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_7.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -165,9 +159,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_6.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_5.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_4_b.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -202,9 +194,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_4.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_c.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -239,9 +229,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_b.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_a.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_14.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -276,9 +264,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_13.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_b.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_a.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -313,9 +299,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_11.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_3.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_2.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -350,9 +334,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/web3/web3_3.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/web3/web3_2.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award/award_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -387,9 +369,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/web3/web3_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_9.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_8.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award/award_10.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -424,9 +404,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_7.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_6.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_5.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award/award_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -461,9 +439,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_4.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_3.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_2.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award/award_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -498,9 +474,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_13.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_12.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_11.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award/award_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -535,9 +509,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_10.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.mint/token.mint_4.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award/award_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -572,9 +544,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.mint/token.mint_3.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.mint/token.mint_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.mint/token.mint_1.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award/award_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -609,9 +579,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.based.voting/token.based.voting_5.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.based.voting/token.based.voting_4.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.based.voting/token.based.voting_3.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award/award_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -646,9 +614,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.based.voting/token.based.voting_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.based.voting/token.based.voting_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token.based.voting/stake.voting.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award/award_8.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -683,9 +649,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token-import/token.import_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/token-import/token.import_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/tangleRequest/tangle-request.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/award/award_9.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -720,9 +684,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/tangleRequest/simple.token.trade.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/staking/staking_5.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/staking/staking_4.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -757,9 +719,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/staking/staking_3.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/staking/staking_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/staking/staking_1.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_10.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -794,9 +754,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/space-tangle/space.leave.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/space-tangle/space.join.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/space-tangle/space.edit.guardian.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_12.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -831,9 +789,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/space-tangle/space.decline.member.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/space-tangle/space.create.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/space-tangle/space.block.member.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -868,9 +824,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/space-tangle/space.accept.member.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/proposal-tangle/proposal.token.voting.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/proposal-tangle/proposal.stake.voting.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -905,9 +859,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/proposal-tangle/proposal.simple.vote.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/proposal-tangle/proposal.create.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/proposal-tangle/proposal.approval.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -942,9 +894,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_8.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_7.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_6.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -979,9 +929,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_5.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_4.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_3.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1016,9 +964,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-set-for-sale/nft-set-for-sale_3.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1053,9 +999,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-set-for-sale/nft-set-for-sale_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-set-for-sale/nft-set-for-sale_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-bid/nft-bid.otr_4.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1090,9 +1034,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-bid/nft-bid.otr_3.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-bid/nft-bid.otr_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/nft-bid/nft-bid.otr_1.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_10.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1127,9 +1069,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_9.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_8.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_7.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_11.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1164,9 +1104,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_6.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_5.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_4.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_12.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1201,9 +1139,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_3.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_18.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1238,9 +1174,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_17.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_16.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_14.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1275,9 +1209,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_13.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_12.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_11.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1312,9 +1244,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_10.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-airdrop/minted-token-airdrop_4.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1349,9 +1279,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-airdrop/minted-token-airdrop_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-token-airdrop/minted-token-airdrop_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_8.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1386,9 +1314,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_7.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_6.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_5.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1423,9 +1349,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_4.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_3.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_2.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_8.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1460,9 +1384,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_1_b.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_10.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_1.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_9.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1497,9 +1419,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_7.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_6.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_5.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1534,9 +1454,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_4.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_3.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_2.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1571,9 +1489,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_9.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_8.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1608,9 +1524,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_7.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_6.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_5.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1645,9 +1559,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_4.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_3.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_2.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1682,9 +1594,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_12.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_11.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_10.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1719,9 +1629,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_7.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_6.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1756,9 +1664,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_5.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_4.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_3.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_1_b.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1793,9 +1699,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_12.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_10.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1830,9 +1734,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_7.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_6.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_10.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1867,9 +1769,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_5.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_4.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_3.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1904,9 +1804,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_1.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award/award_9.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1941,9 +1839,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award/award_8.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award/award_7.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award/award_6.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1978,9 +1874,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award/award_5.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award/award_4.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award/award_3.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -2015,9 +1909,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award/award_2.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award/award_10.spec.ts && - npm run test-tangle-online:ci -- --findRelatedTests test-tangle/award/award_1.spec.ts + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -2026,3 +1918,3783 @@ jobs: name: firestore-data-test-tangle-online-chunk_53 path: ./packages/functions/firestore-data/ retention-days: 1 + chunk_54: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_7.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_54 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_55: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_8.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_55 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_56: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-airdrop/minted-token-airdrop_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_56 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_57: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-airdrop/minted-token-airdrop_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_57 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_58: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-airdrop/minted-token-airdrop_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_58 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_59: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_59 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_60: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_10.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_60 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_61: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_11.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_61 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_62: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_12.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_62 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_63: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_13.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_63 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_64: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_14.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_64 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_65: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_16.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_65 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_66: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_17.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_66 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_67: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_18.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_67 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_68: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_68 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_69: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_69 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_70: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_70 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_71: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_71 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_72: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_6.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_72 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_73: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_7.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_73 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_74: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_8.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_74 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_75: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_9.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_75 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_76: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-bid/nft-bid.otr_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_76 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_77: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-bid/nft-bid.otr_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_77 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_78: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-bid/nft-bid.otr_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_78 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_79: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-bid/nft-bid.otr_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_79 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_80: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-set-for-sale/nft-set-for-sale_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_80 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_81: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-set-for-sale/nft-set-for-sale_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_81 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_82: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-set-for-sale/nft-set-for-sale_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_82 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_83: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_83 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_84: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_84 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_85: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_85 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_86: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_86 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_87: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_87 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_88: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_6.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_88 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_89: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_7.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_89 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_90: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_8.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_90 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_91: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/proposal-tangle/proposal.approval.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_91 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_92: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/proposal-tangle/proposal.create.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_92 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_93: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/proposal-tangle/proposal.simple.vote.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_93 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_94: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/proposal-tangle/proposal.stake.voting.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_94 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_95: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/proposal-tangle/proposal.token.voting.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_95 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_96: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/space-tangle/space.accept.member.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_96 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_97: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/space-tangle/space.block.member.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_97 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_98: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/space-tangle/space.create.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_98 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_99: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/space-tangle/space.decline.member.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_99 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_100: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/space-tangle/space.edit.guardian.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_100 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_101: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/space-tangle/space.join.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_101 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_102: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/space-tangle/space.leave.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_102 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_103: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/staking/staking_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_103 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_104: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/staking/staking_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_104 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_105: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/staking/staking_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_105 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_106: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/staking/staking_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_106 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_107: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/staking/staking_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_107 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_108: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/tangleRequest/simple.token.trade.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_108 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_109: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/tangleRequest/tangle-request.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_109 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_110: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token-import/token.import_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_110 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_111: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token-import/token.import_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_111 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_112: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.based.voting/stake.voting.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_112 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_113: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.based.voting/token.based.voting_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_113 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_114: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.based.voting/token.based.voting_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_114 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_115: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.based.voting/token.based.voting_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_115 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_116: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.based.voting/token.based.voting_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_116 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_117: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.based.voting/token.based.voting_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_117 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_118: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.claim.minted.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_118 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_119: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.mint/token.mint_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_119 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_120: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.mint/token.mint_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_120 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_121: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.mint/token.mint_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_121 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_122: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/token.mint/token.mint_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_122 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_123: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/trade-base-token-order.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_123 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_124: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/tran.match.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_124 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_125: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_125 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_126: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_10.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_126 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_127: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_11.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_127 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_128: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_12.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_128 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_129: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_13.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_129 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_130: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_130 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_131: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_131 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_132: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_132 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_133: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_133 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_134: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_6.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_134 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_135: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_7.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_135 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_136: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_8.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_136 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_137: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_9.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_137 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_138: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/web3/web3_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_138 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_139: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/web3/web3_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_139 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_140: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/web3/web3_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_140 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_141: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_a.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_141 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_142: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_b.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_142 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_143: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_c.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_143 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_144: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_144 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_145: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_145 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_146: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_146 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_147: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_11.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_147 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_148: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_a.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_148 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_149: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_b.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_149 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_150: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_13.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_150 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_151: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_14.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_151 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_152: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_152 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_153: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_4_b.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_153 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_154: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_154 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_155: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_155 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_156: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_6.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_156 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_157: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_7.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_157 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_158: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_8.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_158 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_159: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_9.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_159 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_160: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/workflow-online.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_160 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_161: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle-online:ci -- --findRelatedTests ./test-tangle/workflow.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-online-chunk_161 + path: ./packages/functions/firestore-data/ + retention-days: 1 diff --git a/.github/workflows/functions_tangle-unit-tests.yml b/.github/workflows/functions_tangle-unit-tests.yml index 46d05a8be4..75cebbb4ee 100644 --- a/.github/workflows/functions_tangle-unit-tests.yml +++ b/.github/workflows/functions_tangle-unit-tests.yml @@ -52,9 +52,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/workflow.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/workflow-online.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/tran.match.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/address.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -89,9 +87,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/trade-base-token-order.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.claim.minted.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/address.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -126,9 +122,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_9.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_8.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_7.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -163,9 +157,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_6.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_5.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_4_b.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -200,9 +192,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_4.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_c.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -237,9 +227,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_b.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_a.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_14.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -274,9 +262,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_13.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_b.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_a.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -311,9 +297,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_11.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_3.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_2.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award-tangle/award-tangle_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -348,9 +332,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/web3/web3_3.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/web3/web3_2.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award/award_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -385,9 +367,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/web3/web3_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_9.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_8.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award/award_10.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -422,9 +402,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_7.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_6.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_5.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award/award_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -459,9 +437,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_4.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_3.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_2.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award/award_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -496,9 +472,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_13.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_12.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_11.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award/award_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -533,9 +507,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_10.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/transaction-trigger/transaction-trigger_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.mint/token.mint_4.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award/award_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -570,9 +542,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.mint/token.mint_3.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.mint/token.mint_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.mint/token.mint_1.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award/award_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -607,9 +577,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.based.voting/token.based.voting_5.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.based.voting/token.based.voting_4.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.based.voting/token.based.voting_3.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award/award_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -644,9 +612,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.based.voting/token.based.voting_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.based.voting/token.based.voting_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/token.based.voting/stake.voting.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award/award_8.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -681,9 +647,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/token-import/token.import_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/token-import/token.import_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/tangleRequest/tangle-request.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/award/award_9.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -718,9 +682,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/tangleRequest/simple.token.trade.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/staking/staking_5.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/staking/staking_4.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -755,9 +717,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/staking/staking_3.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/staking/staking_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/staking/staking_1.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_10.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -792,9 +752,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/space-tangle/space.leave.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/space-tangle/space.join.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/space-tangle/space.edit.guardian.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_12.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -829,9 +787,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/space-tangle/space.decline.member.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/space-tangle/space.create.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/space-tangle/space.block.member.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -866,9 +822,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/space-tangle/space.accept.member.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/proposal-tangle/proposal.token.voting.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/proposal-tangle/proposal.stake.voting.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -903,9 +857,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/proposal-tangle/proposal.simple.vote.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/proposal-tangle/proposal.create.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/proposal-tangle/proposal.approval.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -940,9 +892,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_8.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_7.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_6.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -977,9 +927,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_5.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_4.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_3.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1014,9 +962,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-staking/nft-staking_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-set-for-sale/nft-set-for-sale_3.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1051,9 +997,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-set-for-sale/nft-set-for-sale_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-set-for-sale/nft-set-for-sale_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-bid/nft-bid.otr_4.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1088,9 +1032,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-bid/nft-bid.otr_3.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-bid/nft-bid.otr_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/nft-bid/nft-bid.otr_1.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_10.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1125,9 +1067,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_9.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_8.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_7.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_11.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1162,9 +1102,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_6.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_5.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_4.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_12.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1199,9 +1137,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_3.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_18.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1236,9 +1172,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_17.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_16.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_14.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1273,9 +1207,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_13.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_12.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_11.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1310,9 +1242,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_10.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-airdrop/minted-token-airdrop_4.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1347,9 +1277,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-airdrop/minted-token-airdrop_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-airdrop/minted-token-airdrop_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_8.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1384,9 +1312,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_7.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_6.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_5.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1421,9 +1347,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_4.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_3.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_2.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_8.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1458,9 +1382,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_1_b.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_10.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_1.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/collection-minting/collection-minting_9.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1495,9 +1417,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_7.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_6.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_5.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1532,9 +1452,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_4.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_3.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_2.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1569,9 +1487,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/metadata-nft/mint-metadata-nft_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_9.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_8.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1606,9 +1522,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_7.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_6.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_5.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1643,9 +1557,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_4.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_3.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_2.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1680,9 +1592,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_12.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_11.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_10.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1717,9 +1627,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/collection-minting/collection-minting_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_7.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_6.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/metadata-nft/mint-metadata-nft_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1754,9 +1662,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_5.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_4.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_3.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_1_b.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1791,9 +1697,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_12.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_10.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1828,9 +1732,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_7.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_6.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_10.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1865,9 +1767,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_5.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_4.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_3.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1902,9 +1802,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award-tangle/award-tangle_1.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award/award_9.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_3.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1939,9 +1837,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/award/award_8.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award/award_7.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award/award_6.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -1976,9 +1872,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/award/award_5.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award/award_4.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award/award_3.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_5.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -2013,9 +1907,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/award/award_2.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award/award_10.spec.ts && - npm run test-tangle:ci -- --findRelatedTests test-tangle/award/award_1.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_6.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -2050,7 +1942,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-token-trade/minted-token-trade_15.only.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_7.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -2085,7 +1977,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/minted-nft-trading/minted-nft-trading_11.only.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_8.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -2120,7 +2012,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_9.only.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-airdrop/minted-token-airdrop_1.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -2155,7 +2047,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_8.only.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-airdrop/minted-token-airdrop_2.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -2190,7 +2082,7 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" npm run milestone-sync & firebase emulators:exec " - npm run test-tangle:ci -- --findRelatedTests test-tangle/base-token-trading/base-token-trading_11.only.spec.ts + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-airdrop/minted-token-airdrop_4.spec.ts " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data - name: Archive firestore data uses: actions/upload-artifact@v3 @@ -2199,3 +2091,3783 @@ jobs: name: firestore-data-test-tangle-chunk_58 path: ./packages/functions/firestore-data/ retention-days: 1 + chunk_59: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_59 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_60: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_10.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_60 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_61: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_11.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_61 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_62: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_12.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_62 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_63: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_13.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_63 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_64: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_14.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_64 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_65: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_16.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_65 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_66: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_17.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_66 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_67: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_18.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_67 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_68: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_68 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_69: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_69 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_70: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_70 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_71: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_71 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_72: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_6.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_72 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_73: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_7.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_73 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_74: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_8.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_74 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_75: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_9.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_75 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_76: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-bid/nft-bid.otr_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_76 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_77: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-bid/nft-bid.otr_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_77 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_78: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-bid/nft-bid.otr_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_78 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_79: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-bid/nft-bid.otr_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_79 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_80: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-set-for-sale/nft-set-for-sale_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_80 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_81: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-set-for-sale/nft-set-for-sale_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_81 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_82: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-set-for-sale/nft-set-for-sale_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_82 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_83: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_83 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_84: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_84 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_85: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_85 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_86: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_86 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_87: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_87 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_88: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_6.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_88 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_89: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_7.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_89 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_90: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/nft-staking/nft-staking_8.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_90 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_91: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/proposal-tangle/proposal.approval.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_91 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_92: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/proposal-tangle/proposal.create.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_92 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_93: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/proposal-tangle/proposal.simple.vote.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_93 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_94: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/proposal-tangle/proposal.stake.voting.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_94 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_95: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/proposal-tangle/proposal.token.voting.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_95 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_96: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/space-tangle/space.accept.member.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_96 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_97: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/space-tangle/space.block.member.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_97 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_98: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/space-tangle/space.create.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_98 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_99: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/space-tangle/space.decline.member.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_99 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_100: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/space-tangle/space.edit.guardian.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_100 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_101: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/space-tangle/space.join.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_101 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_102: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/space-tangle/space.leave.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_102 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_103: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/staking/staking_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_103 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_104: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/staking/staking_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_104 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_105: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/staking/staking_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_105 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_106: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/staking/staking_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_106 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_107: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/staking/staking_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_107 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_108: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/tangleRequest/simple.token.trade.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_108 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_109: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/tangleRequest/tangle-request.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_109 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_110: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token-import/token.import_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_110 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_111: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token-import/token.import_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_111 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_112: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.based.voting/stake.voting.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_112 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_113: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.based.voting/token.based.voting_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_113 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_114: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.based.voting/token.based.voting_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_114 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_115: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.based.voting/token.based.voting_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_115 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_116: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.based.voting/token.based.voting_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_116 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_117: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.based.voting/token.based.voting_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_117 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_118: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.claim.minted.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_118 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_119: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.mint/token.mint_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_119 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_120: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.mint/token.mint_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_120 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_121: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.mint/token.mint_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_121 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_122: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/token.mint/token.mint_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_122 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_123: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/trade-base-token-order.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_123 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_124: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/tran.match.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_124 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_125: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_125 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_126: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_10.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_126 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_127: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_11.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_127 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_128: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_12.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_128 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_129: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_13.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_129 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_130: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_130 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_131: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_131 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_132: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_132 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_133: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_133 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_134: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_6.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_134 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_135: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_7.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_135 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_136: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_8.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_136 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_137: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/transaction-trigger/transaction-trigger_9.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_137 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_138: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/web3/web3_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_138 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_139: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/web3/web3_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_139 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_140: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/web3/web3_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_140 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_141: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_a.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_141 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_142: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_b.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_142 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_143: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_1_c.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_143 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_144: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_1.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_144 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_145: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_145 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_146: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_10_3.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_146 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_147: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_11.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_147 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_148: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_a.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_148 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_149: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_b.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_149 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_150: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_13.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_150 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_151: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_14.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_151 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_152: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_2.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_152 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_153: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_4_b.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_153 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_154: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_4.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_154 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_155: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_5.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_155 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_156: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_6.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_156 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_157: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_7.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_157 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_158: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_8.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_158 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_159: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/withdraw-deposit-nft/deposit-withraw-nft_9.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_159 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_160: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/workflow-online.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_160 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_161: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/workflow.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_161 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_162: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_11.only.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_162 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_163: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_8.only.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_163 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_164: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/base-token-trading/base-token-trading_9.only.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_164 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_165: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-nft-trading/minted-nft-trading_11.only.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_165 + path: ./packages/functions/firestore-data/ + retention-days: 1 + chunk_166: + needs: npm-install + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - uses: actions/cache@v3 + with: + path: | + node_modules + packages/functions/node_modules + packages/interfaces/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }} + - name: Init + run: | + npm run build:functions + npm install -g firebase-tools + - name: Test + working-directory: packages/functions + run: | + export GOOGLE_APPLICATION_CREDENTIALS="./test-service-account-key.json" + npm run milestone-sync & + firebase emulators:exec " + npm run test-tangle:ci -- --findRelatedTests ./test-tangle/minted-token-trade/minted-token-trade_15.only.spec.ts + " --project dev --only functions,firestore,storage,ui,auth --export-on-exit=./firestore-data + - name: Archive firestore data + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: firestore-data-test-tangle-chunk_166 + path: ./packages/functions/firestore-data/ + retention-days: 1 diff --git a/packages/api/package.json b/packages/api/package.json index 00f01ed840..a477a141e7 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -22,15 +22,14 @@ "dependencies": { "@build-5/database": "*", "@build-5/interfaces": "*", + "@iota/sdk": "^1.1.0", "cors": "^2.8.5", "dayjs": "^1.11.9", "express": "^4.18.2", "joi": "17.10.2", "lodash": "^4.17.21", "rxjs": "^7.8.1", - "ws": "^8.13.0", - "@iota/iota.js": "npm:@iota/iota.js@2.0.0-rc.4", - "@iota/util.js": "npm:@iota/util.js@2.0.0-rc.2" + "ws": "^8.13.0" }, "devDependencies": { "@types/express": "^4.17.17", diff --git a/packages/api/src/metadataNft/getNftIds.ts b/packages/api/src/metadataNft/getNftIds.ts index 3e88d1e5d2..a10966d8d4 100644 --- a/packages/api/src/metadataNft/getNftIds.ts +++ b/packages/api/src/metadataNft/getNftIds.ts @@ -1,12 +1,5 @@ -import { GetNftIds, Network, WenError } from '@build-5/interfaces'; -import { - Bech32Helper, - INftOutput, - IndexerPluginClient, - NFT_ADDRESS_TYPE, - TransactionHelper, -} from '@iota/iota.js'; -import { Converter, HexHelper } from '@iota/util.js'; +import { GetNftIds, WenError } from '@build-5/interfaces'; +import { NftOutput, Utils } from '@iota/sdk'; import Joi from 'joi'; import { of } from 'rxjs'; import { CommonJoi, getQueryParams } from '../common'; @@ -21,21 +14,20 @@ export const getNftIds = async (url: string) => { const body = getQueryParams(url, getNftIdsSchema); try { const client = await getClient(body.network); - const indexer = new IndexerPluginClient(client); - const collectionOutputId = (await indexer.nft(body.collectionId)).items[0]; - const { nftId: collectionId } = (await client.output(collectionOutputId)).output as INftOutput; - const issuerAddress = Bech32Helper.toBech32( - NFT_ADDRESS_TYPE, - Converter.hexToBytes(HexHelper.stripPrefix(collectionId)), - body.network || Network.SMR, + const collectionOutputId = await client.nftOutputId(body.collectionId); + const { nftId: collectionId } = (await client.getOutput(collectionOutputId)) + .output as NftOutput; + const issuerAddress = Utils.nftIdToBech32( + collectionId, + (await client.getInfo()).nodeInfo.protocol.bech32Hrp, ); - const nftOutputIds = (await indexer.nfts({ issuerBech32: issuerAddress })).items; + const nftOutputIds = (await client.nftOutputIds([{ issuer: issuerAddress }])).items; const promises = nftOutputIds.map(async (outputId) => { - const output = (await client.output(outputId)).output as INftOutput; + const output = (await client.getOutput(outputId)).output as NftOutput; if (output.nftId === EMPTY_NFT_ID) { - return TransactionHelper.resolveIdFromOutputId(outputId); + return Utils.computeNftId(outputId); } return output.nftId; }); diff --git a/packages/api/src/metadataNft/getNftMutableMetadata.ts b/packages/api/src/metadataNft/getNftMutableMetadata.ts index 0df47ece7b..01d6222c06 100644 --- a/packages/api/src/metadataNft/getNftMutableMetadata.ts +++ b/packages/api/src/metadataNft/getNftMutableMetadata.ts @@ -1,5 +1,5 @@ import { GetNftMutableData, WenError } from '@build-5/interfaces'; -import { INftOutput, IndexerPluginClient } from '@iota/iota.js'; +import { NftOutput } from '@iota/sdk'; import Joi from 'joi'; import { of } from 'rxjs'; import { CommonJoi, getQueryParams } from '../common'; @@ -14,9 +14,8 @@ export const getNftMutableMetadata = async (url: string) => { const body = getQueryParams(url, getNftMutableDataSchema); try { const client = await getClient(body.network); - const indexer = new IndexerPluginClient(client); - const outputId = (await indexer.nft(body.nftId)).items[0]; - const output = (await client.output(outputId)).output as INftOutput; + const outputId = await client.nftOutputId(body.nftId); + const output = (await client.getOutput(outputId)).output as NftOutput; return of(getMutableMetadata(output)); } catch { throw { code: 400, message: WenError.invalid_nft_id.key }; diff --git a/packages/api/src/metadataNft/getNftMutableMetadataHistory.ts b/packages/api/src/metadataNft/getNftMutableMetadataHistory.ts index 1daddea9b4..703d4aee3c 100644 --- a/packages/api/src/metadataNft/getNftMutableMetadataHistory.ts +++ b/packages/api/src/metadataNft/getNftMutableMetadataHistory.ts @@ -1,13 +1,14 @@ import { GetNftMutableMetadatHistory, Network, WenError } from '@build-5/interfaces'; import { - INftOutput, - IOutputResponse, - ITransactionPayload, - IndexerPluginClient, - NFT_OUTPUT_TYPE, - SingleNodeClient, - TransactionHelper, -} from '@iota/iota.js'; + Client, + NftOutput, + OutputResponse, + OutputType, + RegularTransactionEssence, + TransactionPayload, + UTXOInput, + Utils, +} from '@iota/sdk'; import Joi from 'joi'; import { isEqual, last } from 'lodash'; import { of } from 'rxjs'; @@ -24,11 +25,10 @@ export const getNftMutableMetadataHistory = async (url: string) => { const history: any[] = []; try { const client = await getClient(body.network); - const indexer = new IndexerPluginClient(client); - const outputId = (await indexer.nft(body.nftId)).items[0]; - let outputResponse: IOutputResponse | undefined = await client.output(outputId); + const outputId = await client.nftOutputId(body.nftId); + let outputResponse: OutputResponse | undefined = await client.getOutput(outputId); do { - const metadata = getMutableMetadata(outputResponse.output as INftOutput); + const metadata = getMutableMetadata(outputResponse.output as NftOutput); if (!isEqual(metadata, last(history))) { history.push(metadata); } @@ -43,23 +43,24 @@ export const getNftMutableMetadataHistory = async (url: string) => { } }; -const getPrevNftOutput = async (client: SingleNodeClient, output: IOutputResponse) => { - if ((output.output as INftOutput).nftId === EMPTY_NFT_ID) { +const getPrevNftOutput = async (client: Client, output: OutputResponse) => { + if ((output.output as NftOutput).nftId === EMPTY_NFT_ID) { return undefined; } - const block = await client.block(output.metadata.blockId); - const inputs = (block.payload as ITransactionPayload).essence.inputs; - const prevOutputIds = inputs.map(({ transactionId, transactionOutputIndex }) => - TransactionHelper.outputIdFromTransactionData(transactionId, transactionOutputIndex), - ); + const block = await client.getBlock(output.metadata.blockId); + const essence = (block.payload as TransactionPayload).essence as RegularTransactionEssence; + const prevOutputIds = essence.inputs.map((i) => { + const { transactionId, transactionOutputIndex } = i as UTXOInput; + return Utils.computeOutputId(transactionId, transactionOutputIndex); + }); for (const prevOutputId of prevOutputIds) { - const prevOutputResponse = await client.output(prevOutputId); + const prevOutputResponse = await client.getOutput(prevOutputId); const prevOutput = prevOutputResponse.output; - if (prevOutput.type !== NFT_OUTPUT_TYPE) { + if (prevOutput.type !== OutputType.Nft) { continue; } - const prevNftId = getNftId(prevOutputId, prevOutput); - if (prevNftId === (output.output as INftOutput).nftId) { + const prevNftId = getNftId(prevOutputId, prevOutput as NftOutput); + if (prevNftId === (output.output as NftOutput).nftId) { return prevOutputResponse; } } @@ -67,9 +68,9 @@ const getPrevNftOutput = async (client: SingleNodeClient, output: IOutputRespons return undefined; }; -const getNftId = (outputId: string, output: INftOutput) => { +const getNftId = (outputId: string, output: NftOutput) => { if (output.nftId === EMPTY_NFT_ID) { - return TransactionHelper.resolveIdFromOutputId(outputId); + return Utils.computeNftId(outputId); } return output.nftId; }; diff --git a/packages/api/src/metadataNft/wallet.ts b/packages/api/src/metadataNft/wallet.ts index 1dc24a5caf..49cdc6205e 100644 --- a/packages/api/src/metadataNft/wallet.ts +++ b/packages/api/src/metadataNft/wallet.ts @@ -3,13 +3,7 @@ import { PROD_AVAILABLE_MINTABLE_NETWORKS, TEST_AVAILABLE_MINTABLE_NETWORKS, } from '@build-5/interfaces'; -import { - IMetadataFeature, - INftOutput, - METADATA_FEATURE_TYPE, - SingleNodeClient, -} from '@iota/iota.js'; -import { Converter } from '@iota/util.js'; +import { Client, FeatureType, MetadataFeature, NftOutput, hexToUtf8 } from '@iota/sdk'; const NODES = { [Network.SMR]: ['https://smr1.svrs.io/', 'https://smr3.svrs.io/'], @@ -28,9 +22,9 @@ export const getClient = async (network = Network.SMR) => { for (let i = 0; i < 5; ++i) { nodeUrl = getRandomElement(NODES[network]); try { - const client = new SingleNodeClient(nodeUrl); - const healty = await client.health(); - if (healty) { + const client = new Client({ nodes: [nodeUrl] }); + const info = await client.getInfo(); + if (info.nodeInfo.status.isHealthy) { return client; } } catch (error) { @@ -46,14 +40,14 @@ const getRandomElement = (array: T[]) => array[Math.floor(Math.random() * arr export const EMPTY_NFT_ID = '0x0000000000000000000000000000000000000000000000000000000000000000'; -export const getMutableMetadata = (output: INftOutput) => { - const hexMetadata = ( - output?.features?.find((f) => f.type === METADATA_FEATURE_TYPE) +export const getMutableMetadata = (output: NftOutput) => { + const hexMetadata = ( + output?.features?.find((f) => f.type === FeatureType.Metadata) ); if (!hexMetadata?.data) { return {}; } - const mutableMetadata = JSON.parse(Converter.hexToUtf8(hexMetadata.data) || '{}'); + const mutableMetadata = JSON.parse(hexToUtf8(hexMetadata.data) || '{}'); return mutableMetadata; }; diff --git a/packages/database/package.json b/packages/database/package.json index f44e418c89..5b759426e8 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -21,10 +21,9 @@ "lodash": "^4.17.21" }, "devDependencies": { - "@types/glob": "^8.1.0", "@types/lodash": "^4.14.197", "dotenv": "^16.3.1", - "glob": "^10.3.7", + "glob": "8.0.3", "typescript": "^5.2.2" } } diff --git a/packages/functions/package.json b/packages/functions/package.json index abc0d662bb..70f91c4997 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -43,8 +43,6 @@ "@types/cors": "2.8.13", "@types/crypto-js": "4.1.1", "@types/download": "8.0.2", - "@types/eventsource": "1.1.11", - "@types/glob": "8.1.0", "@types/jest": "29.5.0", "@types/jsonwebtoken": "9.0.1", "@types/lodash": "4.14.192", @@ -64,7 +62,6 @@ "eslint-plugin-jsdoc": "40.1.1", "eslint-plugin-prefer-arrow": "1.2.3", "eslint-plugin-prettier": "4.2.1", - "eventsource": "2.0.2", "firebase-functions-test": "3.0.0", "jest": "29.5.0", "jest-junit": "15.0.0", @@ -79,9 +76,7 @@ "@build-5/interfaces": "*", "@ffmpeg-installer/ffmpeg": "1.1.0", "@ffprobe-installer/ffprobe": "2.0.0", - "@iota/crypto.js-next": "npm:@iota/crypto.js@2.0.0-rc.2", - "@iota/iota.js-next": "npm:@iota/iota.js@2.0.0-rc.4", - "@iota/util.js-next": "npm:@iota/util.js@2.0.0-rc.2", + "@iota/sdk": "^1.1.0", "@metamask/eth-sig-util": "5.0.2", "algoliasearch": "4.16.0", "axios": "1.3.4", @@ -94,7 +89,7 @@ "ethers": "6.2.3", "firebase-admin": "11.9.0", "firebase-functions": "4.4.1", - "glob": "9.3.4", + "glob": "8.0.3", "interfaces": "^0.0.3", "is-ipfs": "8.0.1", "joi": "17.10.2", diff --git a/packages/functions/src/controls/collection/collection-mint.control.ts b/packages/functions/src/controls/collection/collection-mint.control.ts index 6497b43984..9aaf49c9eb 100644 --- a/packages/functions/src/controls/collection/collection-mint.control.ts +++ b/packages/functions/src/controls/collection/collection-mint.control.ts @@ -16,10 +16,11 @@ import { UnsoldMintingOptions, WenError, } from '@build-5/interfaces'; -import { AddressTypes, ED25519_ADDRESS_TYPE, INodeInfo } from '@iota/iota.js-next'; +import { Ed25519Address } from '@iota/sdk'; import dayjs from 'dayjs'; import { last } from 'lodash'; import { build5Db, getSnapshot } from '../../firebase/firestore/build5Db'; +import { Wallet } from '../../services/wallet/wallet'; import { AddressDetails, WalletService } from '../../services/wallet/wallet.service'; import { assertMemberHasValidAddress, assertSpaceHasValidAddress } from '../../utils/address.utils'; import { @@ -85,20 +86,21 @@ export const mintCollectionOrderControl = async (owner: string, params: Collecti const targetAddress = await wallet.getNewIotaAddressDetails(); const { storageDeposit: nftsStorageDeposit, nftsToMint } = await getNftsTotalStorageDeposit( + wallet, collection, params.unsoldMintingOptions as UnsoldMintingOptions, targetAddress, - wallet.info, ); if (!nftsStorageDeposit) { throw invalidArgument(WenError.no_nfts_to_mint); } const collectionStorageDeposit = await getCollectionStorageDeposit( + wallet, targetAddress, collection, - wallet.info, ); - const aliasStorageDeposit = Number(createAliasOutput(targetAddress, wallet.info).amount); + const aliasOutput = await createAliasOutput(wallet, targetAddress); + const aliasStorageDeposit = Number(aliasOutput.amount); const order: Transaction = { type: TransactionType.ORDER, @@ -130,10 +132,10 @@ export const mintCollectionOrderControl = async (owner: string, params: Collecti }; const getNftsTotalStorageDeposit = async ( + wallet: Wallet, collection: Collection, unsoldMintingOptions: UnsoldMintingOptions, address: AddressDetails, - info: INodeInfo, ) => { let storageDeposit = 0; let nftsToMint = 0; @@ -153,11 +155,11 @@ const getNftsTotalStorageDeposit = async ( if (unsoldMintingOptions === UnsoldMintingOptions.BURN_UNSOLD && !nft.sold) { return 0; } - const ownerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: address.hex }; + const ownerAddress = new Ed25519Address(address.hex); const metadata = JSON.stringify( await nftToMetadata(nft, collection, address.bech32, EMPTY_NFT_ID), ); - const output = createNftOutput(ownerAddress, ownerAddress, metadata, info); + const output = await createNftOutput(wallet, ownerAddress, ownerAddress, metadata); return Number(output.amount); }); const amounts = await Promise.all(promises); @@ -169,12 +171,17 @@ const getNftsTotalStorageDeposit = async ( }; const getCollectionStorageDeposit = async ( + wallet: Wallet, address: AddressDetails, collection: Collection, - info: INodeInfo, ) => { - const ownerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: address.hex }; + const ownerAddress = new Ed25519Address(address.hex); const metadata = await collectionToMetadata(collection, address.bech32); - const output = createNftOutput(ownerAddress, ownerAddress, JSON.stringify(metadata), info); + const output = await createNftOutput( + wallet, + ownerAddress, + ownerAddress, + JSON.stringify(metadata), + ); return Number(output.amount); }; diff --git a/packages/functions/src/controls/token-minting/airdrop-minted-token.ts b/packages/functions/src/controls/token-minting/airdrop-minted-token.ts index fdfd2b9482..9b0106297c 100644 --- a/packages/functions/src/controls/token-minting/airdrop-minted-token.ts +++ b/packages/functions/src/controls/token-minting/airdrop-minted-token.ts @@ -13,8 +13,6 @@ import { TransactionValidationType, WenError, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; import dayjs from 'dayjs'; import { chunk } from 'lodash'; import { build5Db } from '../../firebase/firestore/build5Db'; @@ -46,10 +44,12 @@ export const airdropMintedTokenControl = async (owner: string, params: CreateAir const wallet = await WalletService.newWallet(token.mintingData?.network); const targetAddress = await wallet.getNewIotaAddressDetails(); const nativeToken = { - amount: HexHelper.fromBigInt256(bigInt(totalDropped)), + amount: BigInt(totalDropped), id: token.mintingData?.tokenId!, }; - const output = packBasicOutput(targetAddress.bech32, 0, [nativeToken], wallet.info); + const output = await packBasicOutput(wallet, targetAddress.bech32, 0, { + nativeTokens: [nativeToken], + }); const order: Transaction = { type: TransactionType.ORDER, uid: getRandomEthAddress(), diff --git a/packages/functions/src/controls/token-minting/import-minted-token.ts b/packages/functions/src/controls/token-minting/import-minted-token.ts index 669a862ae0..f6175e98fa 100644 --- a/packages/functions/src/controls/token-minting/import-minted-token.ts +++ b/packages/functions/src/controls/token-minting/import-minted-token.ts @@ -9,7 +9,6 @@ import { TransactionValidationType, WenError, } from '@build-5/interfaces'; -import { IndexerPluginClient } from '@iota/iota.js-next'; import dayjs from 'dayjs'; import { isEmpty } from 'lodash'; import { build5Db } from '../../firebase/firestore/build5Db'; @@ -31,10 +30,9 @@ export const importMintedTokenControl = async (owner: string, params: ImportMint } const wallet = await WalletService.newWallet(params.network as Network); - const indexer = new IndexerPluginClient(wallet.client); - const foundryResponse = await indexer.foundry(params.tokenId); + const foundryOutputId = await wallet.client.foundryOutputId(params.tokenId); - if (isEmpty(foundryResponse.items)) { + if (isEmpty(foundryOutputId)) { throw invalidArgument(WenError.token_does_not_exist); } diff --git a/packages/functions/src/controls/token-minting/token-mint.control.ts b/packages/functions/src/controls/token-minting/token-mint.control.ts index c83dfb47f9..fabf36600e 100644 --- a/packages/functions/src/controls/token-minting/token-mint.control.ts +++ b/packages/functions/src/controls/token-minting/token-mint.control.ts @@ -12,7 +12,7 @@ import { TransactionValidationType, WenError, } from '@build-5/interfaces'; -import { TransactionHelper } from '@iota/iota.js-next'; +import { Utils } from '@iota/sdk'; import dayjs from 'dayjs'; import { build5Db } from '../../firebase/firestore/build5Db'; import { Wallet } from '../../services/wallet/wallet'; @@ -93,38 +93,38 @@ const getStorageDepositForMinting = async ( address: AddressDetails, wallet: Wallet, ) => { - const aliasOutput = createAliasOutput(address, wallet.info); + const aliasOutput = await createAliasOutput(wallet, address); const metadata = await tokenToFoundryMetadata(token); - const foundryOutput = createFoundryOutput( + const foundryOutput = await createFoundryOutput( + wallet, token.totalSupply, aliasOutput, JSON.stringify(metadata), - wallet.info, ); - const tokenId = TransactionHelper.constructTokenId( + const tokenId = Utils.computeFoundryId( aliasOutput.aliasId, foundryOutput.serialNumber, foundryOutput.tokenScheme.type, ); const { vaultOutput, guardianOutput } = await getVaultAndGuardianOutput( + wallet, tokenId, token.totalSupply, totalDistributed, address.bech32, address.bech32, - wallet.info, ); - const aliasStorageDeposit = TransactionHelper.getStorageDeposit( + const aliasStorageDeposit = Utils.computeStorageDeposit( aliasOutput, wallet.info.protocol.rentStructure, ); - const foundryStorageDeposit = TransactionHelper.getStorageDeposit( + const foundryStorageDeposit = Utils.computeStorageDeposit( foundryOutput, wallet.info.protocol.rentStructure, ); return { - aliasStorageDeposit, - foundryStorageDeposit, + aliasStorageDeposit: Number(aliasStorageDeposit), + foundryStorageDeposit: Number(foundryStorageDeposit), vaultStorageDeposit: Number(vaultOutput?.amount || 0), guardianStorageDeposit: Number(guardianOutput?.amount || 0), }; diff --git a/packages/functions/src/cron/stakeReward.cron.ts b/packages/functions/src/cron/stakeReward.cron.ts index b4d3ddcf06..83da26db5b 100644 --- a/packages/functions/src/cron/stakeReward.cron.ts +++ b/packages/functions/src/cron/stakeReward.cron.ts @@ -139,7 +139,7 @@ const createAirdrops = async ( nativeTokens: [ { id: token.mintingData!.tokenId!, - amount: Math.min(distribution.extraStakeRewards, reward.value).toString(), + amount: BigInt(Math.min(distribution.extraStakeRewards, reward.value)), }, ], ownerEntity: Entity.MEMBER, diff --git a/packages/functions/src/firebase/functions/onRequest.ts b/packages/functions/src/firebase/functions/onRequest.ts index c59e6701d0..992de8097f 100644 --- a/packages/functions/src/firebase/functions/onRequest.ts +++ b/packages/functions/src/firebase/functions/onRequest.ts @@ -33,6 +33,7 @@ export const onRequest = const result = await func(owner, params.body, { ip: req.ip }); res.send({ data: result || {} }); } catch (error) { + isEmulatorEnv() && console.log(error); res.status(get(error, 'httpErrorCode.status', 400)); res.send({ data: { diff --git a/packages/functions/src/services/payment/award/award-service.ts b/packages/functions/src/services/payment/award/award-service.ts index a5253bdef6..b8bc19499a 100644 --- a/packages/functions/src/services/payment/award/award-service.ts +++ b/packages/functions/src/services/payment/award/award-service.ts @@ -10,15 +10,7 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { - ALIAS_ADDRESS_TYPE, - AddressTypes, - ED25519_ADDRESS_TYPE, - INftAddress, - NFT_ADDRESS_TYPE, -} from '@iota/iota.js-next'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; +import { AliasAddress, Ed25519Address, NftAddress } from '@iota/sdk'; import dayjs from 'dayjs'; import { set } from 'lodash'; import { build5Db } from '../../../firebase/firestore/build5Db'; @@ -180,22 +172,19 @@ export const awardToIpfsMetadata = (award: Award) => { export const getAwardgStorageDeposits = async (award: Award, token: Token, wallet: Wallet) => { const address = await wallet.getNewIotaAddressDetails(); - const aliasOutput = createAliasOutput(address, wallet.info); + const aliasOutput = await createAliasOutput(wallet, address); - const collectioIssuerAddress: AddressTypes = { - type: ALIAS_ADDRESS_TYPE, - aliasId: aliasOutput.aliasId, - }; + const collectioIssuerAddress = new AliasAddress(aliasOutput.aliasId); const spaceDocRef = build5Db().doc(`${COL.SPACE}/${award.space}`); const space = await spaceDocRef.get(); const collectionMetadata = await awardToCollectionMetadata(award, space); - const collectionOutput = createNftOutput( + const collectionOutput = await createNftOutput( + wallet, collectioIssuerAddress, collectioIssuerAddress, JSON.stringify(collectionMetadata), - wallet.info, ); const nttMetadata = await awardBadgeToNttMetadata( @@ -205,13 +194,13 @@ export const getAwardgStorageDeposits = async (award: Award, token: Token, walle dayjs(), 0, ); - const issuerAddress: INftAddress = { type: NFT_ADDRESS_TYPE, nftId: collectionOutput.nftId }; - const ownerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: address.hex }; - const ntt = createNftOutput( + const issuerAddress = new NftAddress(collectionOutput.nftId); + const ownerAddress = new Ed25519Address(address.hex); + const ntt = await createNftOutput( + wallet, ownerAddress, issuerAddress, JSON.stringify(nttMetadata), - wallet.info, dayjs().add(100, 'y'), ); @@ -226,9 +215,11 @@ export const getAwardgStorageDeposits = async (award: Award, token: Token, walle const nativeTokenAmount = award.badge.total * award.badge.tokenReward; const nativeToken = { id: token?.mintingData?.tokenId!, - amount: HexHelper.fromBigInt256(bigInt(nativeTokenAmount)), + amount: BigInt(nativeTokenAmount), }; - const nativeTokenOutput = packBasicOutput(address.bech32, 0, [nativeToken], wallet.info); + const nativeTokenOutput = await packBasicOutput(wallet, address.bech32, 0, { + nativeTokens: [nativeToken], + }); storageDeposit.nativeTokenStorageDeposit = Number(nativeTokenOutput.amount); } diff --git a/packages/functions/src/services/payment/nft/nft-deposit-service.ts b/packages/functions/src/services/payment/nft/nft-deposit-service.ts index e9279844c6..32b07a8911 100644 --- a/packages/functions/src/services/payment/nft/nft-deposit-service.ts +++ b/packages/functions/src/services/payment/nft/nft-deposit-service.ts @@ -18,7 +18,7 @@ import { Transaction, WenError, } from '@build-5/interfaces'; -import { INftOutput } from '@iota/iota.js-next'; +import { NftOutput } from '@iota/sdk'; import * as functions from 'firebase-functions/v2'; import { head, isEmpty, set } from 'lodash'; import { build5Db } from '../../../firebase/firestore/build5Db'; @@ -87,7 +87,7 @@ export class NftDepositService { private depositNftMintedOnBuild5 = async ( nft: Nft, order: Transaction, - nftOutput: INftOutput, + nftOutput: NftOutput, match: TransactionMatch, ) => { const collectionDocRef = build5Db().doc(`${COL.COLLECTION}/${nft.collection}`); @@ -130,7 +130,7 @@ export class NftDepositService { private depositNftMintedOutsideBuild5 = async ( order: Transaction, blockId: string, - nftOutput: INftOutput, + nftOutput: NftOutput, ) => { const metadata = await this.validateInputAndGetMetadata(order, nftOutput); @@ -269,7 +269,7 @@ export class NftDepositService { return nft; }; - private validateInputAndGetMetadata = async (order: Transaction, nftOutput: INftOutput) => { + private validateInputAndGetMetadata = async (order: Transaction, nftOutput: NftOutput) => { const nftMetadata = getNftOutputMetadata(nftOutput); set(nftMetadata, 'collectionId', getIssuerNftId(nftOutput)); if (!isMetadataIrc27(nftMetadata, nftIrc27Schema)) { diff --git a/packages/functions/src/services/payment/nft/nft-stake-service.ts b/packages/functions/src/services/payment/nft/nft-stake-service.ts index 34923300b1..158dafcce7 100644 --- a/packages/functions/src/services/payment/nft/nft-stake-service.ts +++ b/packages/functions/src/services/payment/nft/nft-stake-service.ts @@ -11,11 +11,13 @@ import { WenError, } from '@build-5/interfaces'; import { - INftOutput, - TAG_FEATURE_TYPE, - TIMELOCK_UNLOCK_CONDITION_TYPE, - TransactionHelper, -} from '@iota/iota.js-next'; + FeatureType, + NftOutput, + NftOutputBuilderParams, + TimelockUnlockCondition, + UnlockConditionType, + Utils, +} from '@iota/sdk'; import dayjs from 'dayjs'; import * as functions from 'firebase-functions/v2'; import { cloneDeep, get } from 'lodash'; @@ -89,16 +91,14 @@ export class NftStakeService { private getNftOutputAmount = async (order: Transaction, tranEntry: MilestoneTransactionEntry) => { const wallet = await WalletService.newWallet(order.network); const weeks = get(order, 'payload.weeks', 0); - const output = cloneDeep(tranEntry.nftOutput as INftOutput); - output.features = output.features?.filter((f) => f.type !== TAG_FEATURE_TYPE); - output.unlockConditions = output.unlockConditions.filter( - (uc) => uc.type !== TIMELOCK_UNLOCK_CONDITION_TYPE, + const params: NftOutputBuilderParams = cloneDeep(tranEntry.nftOutput as NftOutput); + params.features = params.features?.filter((f) => f.type !== FeatureType.Tag); + params.unlockConditions = params.unlockConditions.filter( + (uc) => uc.type !== UnlockConditionType.Timelock, ); - output.unlockConditions.push({ - type: TIMELOCK_UNLOCK_CONDITION_TYPE, - unixTime: dayjs().add(weeks, 'weeks').unix(), - }); - return TransactionHelper.getStorageDeposit(output, wallet.info.protocol.rentStructure!); + params.unlockConditions.push(new TimelockUnlockCondition(dayjs().add(weeks, 'weeks').unix())); + const output = await wallet.client.buildNftOutput(params); + return Utils.computeStorageDeposit(output, wallet.info.protocol.rentStructure!); }; } diff --git a/packages/functions/src/services/payment/space/space-service.ts b/packages/functions/src/services/payment/space/space-service.ts index 67bb185823..2fcaee02ad 100644 --- a/packages/functions/src/services/payment/space/space-service.ts +++ b/packages/functions/src/services/payment/space/space-service.ts @@ -9,14 +9,13 @@ import { TransactionPayloadType, } from '@build-5/interfaces'; import { - GOVERNOR_ADDRESS_UNLOCK_CONDITION_TYPE, - IAliasOutput, - IGovernorAddressUnlockCondition, - IIssuerFeature, - INftOutput, - ISSUER_FEATURE_TYPE, - IndexerPluginClient, -} from '@iota/iota.js-next'; + AliasOutput, + FeatureType, + GovernorAddressUnlockCondition, + IssuerFeature, + NftOutput, + UnlockConditionType, +} from '@iota/sdk'; import { build5Db } from '../../../firebase/firestore/build5Db'; import { Bech32AddressHelper } from '../../../utils/bech32-address.helper'; import { serverTime } from '../../../utils/dateTime.utils'; @@ -91,20 +90,22 @@ const senderIsCollectionIssuer = async ( collection: Collection, ) => { const wallet = await WalletService.newWallet(network); - const indexer = new IndexerPluginClient(wallet.client); const hrp = wallet.info.protocol.bech32Hrp; const aliasId = collection.mintingData?.aliasId; if (aliasId) { - const aliasOutputId = (await indexer.alias(aliasId)).items[0]; - const aliasOutput = (await wallet.client.output(aliasOutputId)).output as IAliasOutput; + const aliasOutputId = await wallet.client.aliasOutputId(aliasId); + const aliasOutput = (await wallet.client.getOutput(aliasOutputId)).output as AliasOutput; const unlockConditions = aliasOutput.unlockConditions - .filter((uc) => uc.type === GOVERNOR_ADDRESS_UNLOCK_CONDITION_TYPE) - .map((uc) => uc); + .filter((uc) => uc.type === UnlockConditionType.GovernorAddress) + .map((uc) => uc); for (const unlockCondition of unlockConditions) { - const bech32 = Bech32AddressHelper.buildAddress(hrp, unlockCondition.address); + const bech32 = Bech32AddressHelper.addressToBech32( + (unlockCondition as GovernorAddressUnlockCondition).address, + hrp, + ); if (bech32 === senderBech32) { return true; } @@ -113,10 +114,10 @@ const senderIsCollectionIssuer = async ( return false; } - const collectionOutputId = (await indexer.nft(collection.mintingData?.nftId!)).items[0]; - const collectionOutput = (await wallet.client.output(collectionOutputId)).output as INftOutput; - const issuer = ( - collectionOutput.immutableFeatures?.find((f) => f.type === ISSUER_FEATURE_TYPE) + const collectionOutputId = await wallet.client.nftOutputId(collection.mintingData?.nftId!); + const collectionOutput = (await wallet.client.getOutput(collectionOutputId)).output as NftOutput; + const issuer = ( + collectionOutput.immutableFeatures?.find((f) => f.type === FeatureType.Issuer) ); - return issuer && Bech32AddressHelper.buildAddress(hrp, issuer.address) === senderBech32; + return issuer && Bech32AddressHelper.addressToBech32(issuer.address, hrp) === senderBech32; }; diff --git a/packages/functions/src/services/payment/tangle-service/award/award.fund.service.ts b/packages/functions/src/services/payment/tangle-service/award/award.fund.service.ts index 936687d5b7..3347e6c5b6 100644 --- a/packages/functions/src/services/payment/tangle-service/award/award.fund.service.ts +++ b/packages/functions/src/services/payment/tangle-service/award/award.fund.service.ts @@ -60,7 +60,7 @@ export const createAwardFundOrder = async (owner: string, award: Award): Promise const wallet = await WalletService.newWallet(award.network); const targetAddress = await wallet.getNewIotaAddressDetails(); - const nativeTokens = [{ id: award.badge.tokenId!, amount: totalReward.toString() }]; + const nativeTokens = [{ id: award.badge.tokenId!, amount: BigInt(totalReward) }]; return { type: TransactionType.ORDER, uid: getRandomEthAddress(), diff --git a/packages/functions/src/services/payment/tangle-service/metadataNft/mint-metadata-nft.service.ts b/packages/functions/src/services/payment/tangle-service/metadataNft/mint-metadata-nft.service.ts index 062bf037f6..1d9bcf0339 100644 --- a/packages/functions/src/services/payment/tangle-service/metadataNft/mint-metadata-nft.service.ts +++ b/packages/functions/src/services/payment/tangle-service/metadataNft/mint-metadata-nft.service.ts @@ -15,14 +15,7 @@ import { TransactionValidationType, WenError, } from '@build-5/interfaces'; -import { - ALIAS_ADDRESS_TYPE, - AddressTypes, - ED25519_ADDRESS_TYPE, - INftOutput, - IndexerPluginClient, - NFT_ADDRESS_TYPE, -} from '@iota/iota.js-next'; +import { AliasAddress, Ed25519Address, NftAddress, NftOutput } from '@iota/sdk'; import dayjs from 'dayjs'; import { isEmpty } from 'lodash'; import { build5Db } from '../../../../firebase/firestore/build5Db'; @@ -73,17 +66,10 @@ export class MintMetadataNftService { const amount = aliasOutputAmount + collectionOutputAmount + nftOutputAmount; const remainingAmount = match.to.amount - amount; - const remainderOutput = packBasicOutput( - targetAddress.bech32, - remainingAmount, - undefined, - wallet.info, - undefined, - undefined, - undefined, - { nftId, collectionId, aliasId }, - match.msgId, - ); + const remainderOutput = await packBasicOutput(wallet, targetAddress.bech32, remainingAmount, { + customMetadata: { nftId, collectionId, aliasId }, + tag: match.msgId, + }); if (remainingAmount !== Number(remainderOutput.amount)) { return { @@ -147,7 +133,7 @@ export class MintMetadataNftService { const getAliasOutputAmount = async (owner: string, space: Space, wallet: Wallet) => { const targetAddress = await wallet.getNewIotaAddressDetails(); if (isEmpty(space.alias)) { - const aliasOutput = createAliasOutput(targetAddress, wallet.info); + const aliasOutput = await createAliasOutput(wallet, targetAddress); return Number(aliasOutput.amount); } @@ -167,8 +153,8 @@ const getAliasOutputAmount = async (owner: string, space: Space, wallet: Wallet) const getCollectionOutputAmount = async (aliasId: string, collectionId: string, wallet: Wallet) => { if (collectionId === EMPTY_NFT_ID) { - const issuerAddress: AddressTypes = { type: ALIAS_ADDRESS_TYPE, aliasId }; - const collectionOutput = createNftOutput(issuerAddress, issuerAddress, '', wallet.info); + const issuerAddress = new AliasAddress(aliasId); + const collectionOutput = await createNftOutput(wallet, issuerAddress, issuerAddress, ''); return Number(collectionOutput.amount); } return 0; @@ -176,13 +162,13 @@ const getCollectionOutputAmount = async (aliasId: string, collectionId: string, const createMetadataNftOutput = async (wallet: Wallet, collectionId: string, metadata: object) => { const targetAddress = await wallet.getNewIotaAddressDetails(); - const issuerAddress: AddressTypes = { type: NFT_ADDRESS_TYPE, nftId: collectionId }; - const ownerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: targetAddress.hex }; + const issuerAddress = new NftAddress(collectionId); + const ownerAddress = new Ed25519Address(targetAddress.hex); return createNftOutput( + wallet, ownerAddress, issuerAddress, '', - wallet.info, undefined, JSON.stringify(metadata), ); @@ -228,18 +214,17 @@ const getNftOutputAmount = async ( }; const getIds = async (request: MintMetadataNftTangleRequest, wallet: Wallet) => { - const indexer = new IndexerPluginClient(wallet.client); const nftId = request.nftId as string; if (nftId) { - const collectionId = await getCollectionId(wallet, indexer, nftId); - const collectionOutput = await getCollectionOutput(wallet, indexer, collectionId); + const collectionId = await getCollectionId(wallet, nftId); + const collectionOutput = await getCollectionOutput(wallet, collectionId); const aliasId = getAliasId(collectionOutput); return { nftId, collectionId: collectionOutput.nftId, aliasId }; } const collectionId = request.collectionId as string; if (collectionId) { - const collectionOutput = await getCollectionOutput(wallet, indexer, collectionId); + const collectionOutput = await getCollectionOutput(wallet, collectionId); const aliasId = getAliasId(collectionOutput); return { nftId: EMPTY_NFT_ID, collectionId, aliasId }; } @@ -248,24 +233,20 @@ const getIds = async (request: MintMetadataNftTangleRequest, wallet: Wallet) => return { nftId: EMPTY_NFT_ID, collectionId: EMPTY_NFT_ID, aliasId }; }; -const getCollectionId = async (wallet: Wallet, indexer: IndexerPluginClient, nftId: string) => { +const getCollectionId = async (wallet: Wallet, nftId: string) => { try { - const nftOutputId = (await indexer.nft(nftId)).items[0]; - const nftOutput = (await wallet.client.output(nftOutputId)).output as INftOutput; + const nftOutputId = await wallet.client.nftOutputId(nftId); + const nftOutput = (await wallet.client.getOutput(nftOutputId)).output as NftOutput; return getIssuerNftId(nftOutput); } catch { throw invalidArgument(WenError.invalid_nft_id); } }; -const getCollectionOutput = async ( - wallet: Wallet, - indexer: IndexerPluginClient, - collectionId: string, -) => { +const getCollectionOutput = async (wallet: Wallet, collectionId: string) => { try { - const collectionOutputId = (await indexer.nft(collectionId)).items[0]; - return (await wallet.client.output(collectionOutputId)).output as INftOutput; + const collectionOutputId = await wallet.client.nftOutputId(collectionId); + return (await wallet.client.getOutput(collectionOutputId)).output as NftOutput; } catch { throw invalidArgument(WenError.invalid_collection_id); } diff --git a/packages/functions/src/services/payment/tangle-service/proposal/voting/token.voting.ts b/packages/functions/src/services/payment/tangle-service/proposal/voting/token.voting.ts index 025586dadf..652113c855 100644 --- a/packages/functions/src/services/payment/tangle-service/proposal/voting/token.voting.ts +++ b/packages/functions/src/services/payment/tangle-service/proposal/voting/token.voting.ts @@ -8,8 +8,6 @@ import { TransactionType, TransactionValidationType, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; import dayjs from 'dayjs'; import { packBasicOutput } from '../../../../../utils/basic-output.utils'; import { isProdEnv } from '../../../../../utils/config.utils'; @@ -29,15 +27,12 @@ export const createVoteTransactionOrder = async ( const nativeToken = { id: token.mintingData?.tokenId!, - amount: HexHelper.fromBigInt256(bigInt(Number.MAX_SAFE_INTEGER)), + amount: BigInt(Number.MAX_SAFE_INTEGER), }; - const output = packBasicOutput( - targetAddress.bech32, - 0, - [nativeToken], - wallet.info, - targetAddress.bech32, - ); + const output = await packBasicOutput(wallet, targetAddress.bech32, 0, { + nativeTokens: [nativeToken], + storageDepositReturnAddress: targetAddress.bech32, + }); return { type: TransactionType.ORDER, diff --git a/packages/functions/src/services/payment/tangle-service/token/stake.service.ts b/packages/functions/src/services/payment/tangle-service/token/stake.service.ts index 06b707df94..3a2a1cf305 100644 --- a/packages/functions/src/services/payment/tangle-service/token/stake.service.ts +++ b/packages/functions/src/services/payment/tangle-service/token/stake.service.ts @@ -10,8 +10,6 @@ import { TransactionValidationType, WenError, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; import dayjs from 'dayjs'; import { set } from 'lodash'; import { build5Db } from '../../../../firebase/firestore/build5Db'; @@ -84,19 +82,14 @@ export const createStakeOrder = async ( const nativeTokens = [ { id: token.mintingData.tokenId, - amount: HexHelper.fromBigInt256(bigInt(Number.MAX_SAFE_INTEGER)), + amount: BigInt(Number.MAX_SAFE_INTEGER), }, ]; - const output = packBasicOutput( - targetAddress.bech32, - 0, + const output = await packBasicOutput(wallet, targetAddress.bech32, 0, { nativeTokens, - wallet.info, - '', - dateToTimestamp(dayjs().add(weeks, 'weeks').toDate()), - undefined, customMetadata, - ); + vestingAt: dateToTimestamp(dayjs().add(weeks, 'weeks').toDate()), + }); return { type: TransactionType.ORDER, uid: getRandomEthAddress(), diff --git a/packages/functions/src/services/payment/tangle-service/token/token-claim.service.ts b/packages/functions/src/services/payment/tangle-service/token/token-claim.service.ts index 0087aa8c57..9026e94783 100644 --- a/packages/functions/src/services/payment/tangle-service/token/token-claim.service.ts +++ b/packages/functions/src/services/payment/tangle-service/token/token-claim.service.ts @@ -69,10 +69,11 @@ export const createMintedTokenAirdropCalimOrder = async ( const wallet = await WalletService.newWallet(token.mintingData?.network!); const targetAddress = await wallet.getNewIotaAddressDetails(); - const storageDeposit = drops.reduce((acc, drop) => { - const output = dropToOutput(token, drop, targetAddress.bech32, wallet.info); - return acc + Number(output.amount); - }, 0); + let storageDeposit = 0; + for (const drop of drops) { + const output = await dropToOutput(wallet, token, drop, targetAddress.bech32); + storageDeposit += Number(output.amount); + } return { type: TransactionType.ORDER, diff --git a/packages/functions/src/services/payment/tangle-service/token/token-trade.service.ts b/packages/functions/src/services/payment/tangle-service/token/token-trade.service.ts index 36dad05fcd..cd168d3772 100644 --- a/packages/functions/src/services/payment/tangle-service/token/token-trade.service.ts +++ b/packages/functions/src/services/payment/tangle-service/token/token-trade.service.ts @@ -20,8 +20,6 @@ import { WenError, getNetworkPair, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; import dayjs from 'dayjs'; import bigDecimal from 'js-big-decimal'; import { set } from 'lodash'; @@ -234,7 +232,7 @@ const createTradeOrderTransaction = async ( type: isSell ? TransactionPayloadType.SELL_TOKEN : TransactionPayloadType.BUY_TOKEN, amount: await getAmount(token, count, price, isSell), nativeTokens: - isMinted && isSell ? [{ id: token.mintingData?.tokenId!, amount: count.toString() }] : [], + isMinted && isSell ? [{ id: token.mintingData?.tokenId!, amount: BigInt(count) }] : [], targetAddress: targetAddress.bech32, expiresOn: dateToTimestamp(dayjs().add(TRANSACTION_MAX_EXPIRY_MS)), validationType: getValidationType(token, isSell), @@ -258,10 +256,8 @@ const getAmount = async (token: Token, count: number, price: number, isSell: boo } const wallet = await WalletService.newWallet(token.mintingData?.network); const tmpAddress = await wallet.getNewIotaAddressDetails(false); - const nativeTokens = [ - { amount: HexHelper.fromBigInt256(bigInt(count)), id: token.mintingData?.tokenId! }, - ]; - const output = packBasicOutput(tmpAddress.bech32, 0, nativeTokens, wallet.info); + const nativeTokens = [{ amount: BigInt(count), id: token.mintingData?.tokenId! }]; + const output = await packBasicOutput(wallet, tmpAddress.bech32, 0, { nativeTokens }); return Number(output.amount); }; diff --git a/packages/functions/src/services/payment/token/import-minted-token.service.ts b/packages/functions/src/services/payment/token/import-minted-token.service.ts index 944fdbf071..2fca86b508 100644 --- a/packages/functions/src/services/payment/token/import-minted-token.service.ts +++ b/packages/functions/src/services/payment/token/import-minted-token.service.ts @@ -9,16 +9,16 @@ import { WenError, } from '@build-5/interfaces'; import { - IAliasAddress, - IAliasOutput, - IFoundryOutput, - IImmutableAliasUnlockCondition, - IMMUTABLE_ALIAS_UNLOCK_CONDITION_TYPE, - IMetadataFeature, - IndexerPluginClient, - METADATA_FEATURE_TYPE, -} from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; + AliasAddress, + AliasOutput, + FeatureType, + FoundryOutput, + ImmutableAliasAddressUnlockCondition, + MetadataFeature, + SimpleTokenScheme, + UnlockConditionType, + hexToUtf8, +} from '@iota/sdk'; import Joi from 'joi'; import { get, isEmpty } from 'lodash'; import { build5Db } from '../../../firebase/firestore/build5Db'; @@ -59,7 +59,8 @@ export class ImportMintedTokenService { : ''; const vaultAddress = await wallet.getNewIotaAddressDetails(); - const totalSupply = Number(foundry.tokenScheme.maximumSupply); + const tokenScheme = foundry.tokenScheme as SimpleTokenScheme; + const totalSupply = Number(tokenScheme.maximumSupply); const token: Token = { createdBy: order.member || '', uid: tokenId, @@ -90,8 +91,8 @@ export class ImportMintedTokenService { network: order.network, networkFormat: order.network, vaultAddress: vaultAddress.bech32, - meltedTokens: Number(foundry.tokenScheme.meltedTokens), - circulatingSupply: totalSupply - Number(foundry.tokenScheme.meltedTokens), + meltedTokens: Number(tokenScheme.meltedTokens), + circulatingSupply: totalSupply - Number(tokenScheme.meltedTokens), }, mediaStatus: icon ? MediaStatus.PENDING_UPLOAD : MediaStatus.UPLOADED, tradingDisabled: true, @@ -128,17 +129,18 @@ export class ImportMintedTokenService { order: Transaction, match: TransactionMatch, ) => { - const indexer = new IndexerPluginClient(wallet.client); - const foundry = await indexer.foundry(order.payload.tokenId!); - const foundryOutput = (await wallet.client.output(foundry.items[0])).output; + const foundry = await wallet.client.foundryOutputId(order.payload.tokenId!); + const foundryOutput = (await wallet.client.getOutput(foundry)).output; - const unlockCondition = ( - foundryOutput.unlockConditions.find((uc) => uc.type === IMMUTABLE_ALIAS_UNLOCK_CONDITION_TYPE) + const unlockCondition = ( + foundryOutput.unlockConditions.find( + (uc) => uc.type === UnlockConditionType.ImmutableAliasAddress, + ) ); - const aliasId = (unlockCondition.address as IAliasAddress).aliasId; + const aliasId = (unlockCondition.address as AliasAddress).aliasId; - const alias = await indexer.alias(aliasId); - const aliasOutput = (await wallet.client.output(alias.items[0])).output; + const alias = await wallet.client.aliasOutputId(aliasId); + const aliasOutput = (await wallet.client.getOutput(alias)).output; if (!isAliasGovernor(aliasOutput, match.from, wallet.info.protocol.bech32Hrp)) { throw WenError.not_alias_governor; @@ -147,11 +149,11 @@ export class ImportMintedTokenService { return { foundry: foundryOutput, alias: aliasOutput }; }; - private getTokenMetadata = (foundry: IFoundryOutput) => { - const metadataFeature = ( - foundry?.immutableFeatures?.find((f) => f.type === METADATA_FEATURE_TYPE) + private getTokenMetadata = (foundry: FoundryOutput) => { + const metadataFeature = ( + foundry?.immutableFeatures?.find((f) => f.type === FeatureType.Metadata) ); - const decoded = Converter.hexToUtf8(metadataFeature?.data || '{}'); + const decoded = hexToUtf8(metadataFeature?.data || '{}'); const metadata = JSON.parse(decoded) || {}; const result = tokenIrc30Schema.validate(metadata, { allowUnknown: true }); if (result.error) { diff --git a/packages/functions/src/services/payment/transaction-service.ts b/packages/functions/src/services/payment/transaction-service.ts index 485d5e423d..2e1a3d668e 100644 --- a/packages/functions/src/services/payment/transaction-service.ts +++ b/packages/functions/src/services/payment/transaction-service.ts @@ -16,14 +16,7 @@ import { TransactionValidationType, getMilestoneCol, } from '@build-5/interfaces'; -import { - ADDRESS_UNLOCK_CONDITION_TYPE, - EXPIRATION_UNLOCK_CONDITION_TYPE, - IExpirationUnlockCondition, - STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE, - TIMELOCK_UNLOCK_CONDITION_TYPE, - UnlockConditionTypes, -} from '@iota/iota.js-next'; +import { ExpirationUnlockCondition, UnlockCondition, UnlockConditionType } from '@iota/sdk'; import dayjs from 'dayjs'; import * as functions from 'firebase-functions/v2'; import { get, isEmpty, set } from 'lodash'; @@ -90,7 +83,7 @@ export class TransactionService { amount: tran.to.amount, nativeTokens: (tran.to.nativeTokens || []).map((nt) => ({ ...nt, - amount: Number(nt.amount).toString(), + amount: BigInt(nt.amount), })), sourceAddress: tran.from, targetAddress: order.payload.targetAddress, @@ -231,7 +224,7 @@ export class TransactionService { amount: payment.payload.amount, nativeTokens: (tran.to.nativeTokens || []).map((nt) => ({ ...nt, - amount: Number(nt.amount).toString(), + amount: BigInt(nt.amount), })), sourceAddress: tran.to.address, targetAddress: tran.from, @@ -287,7 +280,7 @@ export class TransactionService { amount: payment.payload.amount, nativeTokens: (tran.to.nativeTokens || []).map((nt) => ({ ...nt, - amount: Number(nt.amount).toString(), + amount: BigInt(nt.amount), })), sourceAddress: tran.to.address, targetAddress: tran.from, @@ -446,16 +439,14 @@ export class TransactionService { } } - private getIngnoreWalletReason = ( - unlockConditions: UnlockConditionTypes[], - ): IgnoreWalletReason => { + private getIngnoreWalletReason = (unlockConditions: UnlockCondition[]): IgnoreWalletReason => { const hasTimelock = - unlockConditions.find((u) => u.type === TIMELOCK_UNLOCK_CONDITION_TYPE) !== undefined; + unlockConditions.find((u) => u.type === UnlockConditionType.Timelock) !== undefined; if (hasTimelock) { return IgnoreWalletReason.UNREFUNDABLE_DUE_TIMELOCK_CONDITION; } const hasStorageDepositLock = - unlockConditions.find((u) => u.type === STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE) !== + unlockConditions.find((u) => u.type === UnlockConditionType.StorageDepositReturn) !== undefined; if (hasStorageDepositLock) { return IgnoreWalletReason.UNREFUNDABLE_DUE_STORAGE_DEPOSIT_CONDITION; @@ -483,7 +474,7 @@ export class TransactionService { amount: tranOutput.amount, nativeTokens: (tranOutput.nativeTokens || []).map((nt) => ({ ...nt, - amount: Number(nt.amount).toString(), + amount: BigInt(nt.amount), })), sourceAddress: tranOutput.address, targetAddress: [ @@ -509,18 +500,15 @@ export class TransactionService { }); }; - public getExpirationUnlock = (unlockCondiiton: UnlockConditionTypes[] = []) => - unlockCondiiton.find((u) => u.type === EXPIRATION_UNLOCK_CONDITION_TYPE) as - | IExpirationUnlockCondition + public getExpirationUnlock = (unlockCondiiton: UnlockCondition[] = []) => + unlockCondiiton.find((u) => u.type === UnlockConditionType.Expiration) as + | ExpirationUnlockCondition | undefined; private getUnsupportedUnlockCondition = ( - unlockConditions: UnlockConditionTypes[] = [], + unlockConditions: UnlockCondition[] = [], supportedUnlockConditions = SUPPORTED_UNLOCK_CONDITION, ) => unlockConditions.find((u) => !supportedUnlockConditions.includes(u.type)); } -const SUPPORTED_UNLOCK_CONDITION = [ - ADDRESS_UNLOCK_CONDITION_TYPE, - EXPIRATION_UNLOCK_CONDITION_TYPE, -]; +const SUPPORTED_UNLOCK_CONDITION = [UnlockConditionType.Address, UnlockConditionType.Expiration]; diff --git a/packages/functions/src/services/wallet/AliasWallet.ts b/packages/functions/src/services/wallet/AliasWallet.ts index ab7d5c056b..ffa64ab1ac 100644 --- a/packages/functions/src/services/wallet/AliasWallet.ts +++ b/packages/functions/src/services/wallet/AliasWallet.ts @@ -1,23 +1,27 @@ import { Transaction } from '@build-5/interfaces'; import { - Bech32Helper, - GOVERNOR_ADDRESS_UNLOCK_CONDITION_TYPE, - IAliasOutput, - IndexerPluginClient, - STATE_CONTROLLER_ADDRESS_UNLOCK_CONDITION_TYPE, - TransactionHelper, -} from '@iota/iota.js-next'; + AliasOutput, + AliasOutputBuilderParams, + Client, + GovernorAddressUnlockCondition, + Output, + StateControllerAddressUnlockCondition, + UTXOInput, + Utils, +} from '@iota/sdk'; import { cloneDeep, isEmpty } from 'lodash'; import { mergeOutputs, packBasicOutput } from '../../utils/basic-output.utils'; -import { packEssence, packPayload, submitBlock } from '../../utils/block.utils'; -import { createUnlock } from '../../utils/smr.utils'; +import { createUnlock, packEssence, submitBlock } from '../../utils/block.utils'; import { createAliasOutput } from '../../utils/token-minting-utils/alias.utils'; import { MnemonicService } from './mnemonic'; import { Wallet, WalletParams } from './wallet'; import { setConsumedOutputIds } from './wallet.service'; export class AliasWallet { - constructor(private readonly wallet: Wallet) {} + private client: Client; + constructor(private readonly wallet: Wallet) { + this.client = this.wallet.client; + } public mintAlias = async (transaction: Transaction, params: WalletParams) => { const sourceAddress = await this.wallet.getAddressDetails(transaction.payload.sourceAddress!); @@ -28,25 +32,24 @@ export class AliasWallet { sourceMnemonic.consumedOutputIds, false, ); - const remainder = mergeOutputs(Object.values(outputsMap)); - const aliasOutput = createAliasOutput(sourceAddress, this.wallet.info); - remainder.amount = (Number(remainder.amount) - Number(aliasOutput.amount)).toString(); - - const inputs = Object.keys(outputsMap).map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment(Object.values(outputsMap)); - const essence = packEssence( - inputs, - inputsCommitment, - Number(remainder.amount) ? [aliasOutput, remainder] : [aliasOutput], - this.wallet, - params, - ); + const aliasOutput = await createAliasOutput(this.wallet, sourceAddress); + const outputs: Output[] = [aliasOutput]; + + const remainderParams = mergeOutputs(Object.values(outputsMap)); + remainderParams.amount = ( + Number(remainderParams.amount) - Number(aliasOutput.amount) + ).toString(); + if (Number(remainderParams.amount)) { + outputs.push(await this.client.buildBasicOutput(remainderParams)); + } + const inputs = Object.keys(outputsMap).map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment(Object.values(outputsMap)); + const essence = await packEssence(this.wallet, inputs, inputsCommitment, outputs, params); await setConsumedOutputIds(sourceAddress.bech32, Object.keys(outputsMap)); - return await submitBlock( - this.wallet, - packPayload(essence, [createUnlock(essence, sourceAddress.keyPair)]), - ); + + const unlock = await createUnlock(essence, sourceAddress); + return await submitBlock(this.wallet, essence, [unlock]); }; public changeAliasOwner = async (transaction: Transaction, params: WalletParams) => { @@ -59,25 +62,27 @@ export class AliasWallet { ); const [aliasOutputId, aliasOutput] = Object.entries(aliasOutputs)[0]; - const targetAddress = Bech32Helper.addressFromBech32( - transaction.payload.targetAddress!, - this.wallet.info.protocol.bech32Hrp, - ); - const nextAliasOutput = cloneDeep(aliasOutput); + const targetAddress = Utils.parseBech32Address(transaction.payload.targetAddress!); + const nextAliasOutput: AliasOutputBuilderParams = cloneDeep(aliasOutput); nextAliasOutput.unlockConditions = [ - { type: STATE_CONTROLLER_ADDRESS_UNLOCK_CONDITION_TYPE, address: targetAddress }, - { type: GOVERNOR_ADDRESS_UNLOCK_CONDITION_TYPE, address: targetAddress }, + new StateControllerAddressUnlockCondition(targetAddress), + new GovernorAddressUnlockCondition(targetAddress), ]; - const inputs = [aliasOutputId].map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment([aliasOutput]); - const essence = packEssence(inputs, inputsCommitment, [nextAliasOutput], this.wallet, params); - - await setConsumedOutputIds(sourceAddress.bech32, [], [], [aliasOutputId]); - return await submitBlock( + const inputs = [aliasOutputId].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([aliasOutput]); + const essence = await packEssence( this.wallet, - packPayload(essence, [createUnlock(essence, sourceAddress.keyPair)]), + inputs, + inputsCommitment, + [await this.client.buildAliasOutput(nextAliasOutput)], + params, ); + + await setConsumedOutputIds(sourceAddress.bech32, [], [], [aliasOutputId]); + + const unlock = await createUnlock(essence, sourceAddress); + return await submitBlock(this.wallet, essence, [unlock]); }; public burnAlias = async (transaction: Transaction, params: WalletParams) => { @@ -90,37 +95,34 @@ export class AliasWallet { ); const [aliasOutputId, aliasOutput] = Object.entries(aliasOutputs)[0]; - const remainder = packBasicOutput( + const remainder = await packBasicOutput( + this.wallet, transaction.payload.targetAddress!, Number(aliasOutput.amount), - [], - this.wallet.info, + {}, ); - const inputs = [aliasOutputId].map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment([aliasOutput]); - const essence = packEssence(inputs, inputsCommitment, [remainder], this.wallet, params); + const inputs = [aliasOutputId].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([aliasOutput]); + const essence = await packEssence(this.wallet, inputs, inputsCommitment, [remainder], params); await setConsumedOutputIds(sourceAddress.bech32, [], [], [aliasOutputId]); - return await submitBlock( - this.wallet, - packPayload(essence, [createUnlock(essence, sourceAddress.keyPair)]), - ); + + const unlock = await createUnlock(essence, sourceAddress); + return await submitBlock(this.wallet, essence, [unlock]); }; public getAliasOutputs = async ( governorBech32: string, prevConsumedAliasOutputId: string[] = [], ) => { - const indexer = new IndexerPluginClient(this.wallet.client); const outputIds = isEmpty(prevConsumedAliasOutputId) - ? (await indexer.aliases({ governorBech32 })).items + ? (await this.client.aliasOutputIds([{ governor: governorBech32 }])).items : prevConsumedAliasOutputId; - const outputs: { [key: string]: IAliasOutput } = {}; - for (const id of outputIds) { - const output = (await this.wallet.client.output(id)).output; - outputs[id] = output as IAliasOutput; - } - return outputs; + const outputs = await this.client.getOutputs(outputIds); + return outputs.reduce( + (acc, act, i) => ({ ...acc, [outputIds[i]]: act.output as AliasOutput }), + {} as { [key: string]: AliasOutput }, + ); }; } diff --git a/packages/functions/src/services/wallet/IotaWalletService.ts b/packages/functions/src/services/wallet/IotaWalletService.ts index 006c0e77ae..c34c323023 100644 --- a/packages/functions/src/services/wallet/IotaWalletService.ts +++ b/packages/functions/src/services/wallet/IotaWalletService.ts @@ -1,30 +1,27 @@ import { NativeToken, Timestamp, Transaction } from '@build-5/interfaces'; -import { Bip32Path } from '@iota/crypto.js-next'; import { - ADDRESS_UNLOCK_CONDITION_TYPE, - BASIC_OUTPUT_TYPE, - Bech32Helper, - ED25519_ADDRESS_TYPE, - Ed25519Address, - Ed25519Seed, - IAliasOutput, - IBasicOutput, - IFoundryOutput, - INftOutput, - IndexerPluginClient, - REFERENCE_UNLOCK_TYPE, - TransactionHelper, - UnlockTypes, - addressBalance, -} from '@iota/iota.js-next'; -import { Converter, HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; -import { generateMnemonic } from 'bip39'; + AddressUnlockCondition, + AliasOutput, + BasicOutput, + BasicOutputBuilderParams, + CoinType, + CommonOutput, + FoundryOutput, + NftOutput, + NftOutputBuilderParams, + OutputType, + QueryParameter, + ReferenceUnlock, + SecretManager, + UTXOInput, + Unlock, + Utils, +} from '@iota/sdk'; +import { mnemonicToSeedSync } from 'bip39'; import { cloneDeep, head, isEmpty } from 'lodash'; -import { mergeOutputs, packBasicOutput, subtractHex } from '../../utils/basic-output.utils'; +import { mergeOutputs, packBasicOutput } from '../../utils/basic-output.utils'; import { Bech32AddressHelper } from '../../utils/bech32-address.helper'; -import { packEssence, packPayload, submitBlock } from '../../utils/block.utils'; -import { createUnlock } from '../../utils/smr.utils'; +import { createUnlock, packEssence, submitBlock } from '../../utils/block.utils'; import { NftWallet } from './NftWallet'; import { MnemonicService } from './mnemonic'; import { Wallet, WalletParams } from './wallet'; @@ -36,35 +33,48 @@ export interface Expiration { } export class IotaWallet extends Wallet { - public getBalance = async (addressBech32: string | undefined) => { - if (!addressBech32) { - return 0; + public getBalance = async (addressBech32: string) => { + const outputIds = ( + await this.client.basicOutputIds([ + { address: addressBech32 }, + { hasExpiration: false }, + { hasTimelock: false }, + { hasStorageDepositReturn: false }, + ]) + ).items; + const outputs = await this.client.getOutputs(outputIds); + let totalAmount = BigInt(0); + const totalNativeTokens: { [id: string]: bigint } = {}; + for (const outputResponse of outputs) { + const output = outputResponse.output; + if (output instanceof CommonOutput) { + (output as CommonOutput).getNativeTokens()?.forEach((token) => { + totalNativeTokens[token.id] = (totalNativeTokens[token.id] || BigInt(0)) + token.amount; + }); + } + totalAmount += output.getAmount(); } - const balance = await addressBalance(this.client, addressBech32); - return Number(balance.balance); + return { amount: Number(totalAmount), nativeTokens: totalNativeTokens }; }; public getNewIotaAddressDetails = async (saveMnemonic = true) => { - const address = await this.getIotaAddressDetails(generateMnemonic() + ' ' + generateMnemonic()); + const address = await this.getIotaAddressDetails(Utils.generateMnemonic()); saveMnemonic && (await MnemonicService.store(address.bech32, address.mnemonic, this.network)); return address; }; public getIotaAddressDetails = async (mnemonic: string): Promise => { - const walletSeed = Ed25519Seed.fromMnemonic(mnemonic); - const walletPath = new Bip32Path("m/44'/4218'/0'/0'/0'"); - const walletAddressSeed = walletSeed.generateSeedFromPath(walletPath); - const keyPair = walletAddressSeed.keyPair(); - const walletEd25519Address = new Ed25519Address(keyPair.publicKey); - const walletAddress = walletEd25519Address.toAddress(); - const hex = Converter.bytesToHex(walletAddress, true); - const bech32 = Bech32Helper.toBech32( - ED25519_ADDRESS_TYPE, - walletAddress, - this.info.protocol.bech32Hrp, - ); - - return { mnemonic, keyPair, hex, bech32 }; + const seed = mnemonicToSeedSync(mnemonic); + const hexSeed = '0x' + seed.toString('hex'); + // @ts-ignore + const secretManager = new SecretManager({ hexSeed }); + const addresses = await secretManager.generateEd25519Addresses({ + coinType: CoinType.IOTA, + range: { start: 0, end: 1 }, + bech32Hrp: this.info.protocol.bech32Hrp, + }); + const hex = Utils.bech32ToHex(addresses[0]); + return { mnemonic, hex, bech32: addresses[0] }; }; public getAddressDetails = async (bech32: string | undefined) => { @@ -72,20 +82,11 @@ export class IotaWallet extends Wallet { return this.getIotaAddressDetails(mnemonic); }; - public getTransactionOutput = async (transactionId: string, outputIndex: number) => { - const outputId = TransactionHelper.outputIdFromTransactionData(transactionId, outputIndex); - return await this.client.output(outputId); - }; - public bechAddressFromOutput = ( - output: IBasicOutput | IAliasOutput | IFoundryOutput | INftOutput, + output: BasicOutput | AliasOutput | FoundryOutput | NftOutput, ) => { const hrp = this.info.protocol.bech32Hrp!; - return Bech32AddressHelper.addressFromAddressUnlockCondition( - output.unlockConditions, - hrp, - output.type, - ); + return Bech32AddressHelper.bech32FromUnlockConditions(output, hrp); }; public getOutputs = async ( @@ -94,23 +95,21 @@ export class IotaWallet extends Wallet { hasStorageDepositReturn: boolean | undefined, hasTimelock = false, ) => { - const indexer = new IndexerPluginClient(this.client); - const query = { - addressBech32, - hasStorageDepositReturn, - hasTimelock, - }; + const query: QueryParameter[] = [{ address: addressBech32 }, { hasTimelock }]; + if (hasStorageDepositReturn !== undefined) { + query.push({ hasStorageDepositReturn }); + } const outputIds = isEmpty(previouslyConsumedOutputIds) - ? (await indexer.basicOutputs(query)).items + ? (await this.client.basicOutputIds(query)).items : previouslyConsumedOutputIds; - const outputs: { [key: string]: IBasicOutput } = {}; - for (const id of outputIds) { - const output = (await this.client.output(id)).output; - if (output.type === BASIC_OUTPUT_TYPE) { - outputs[id] = output; + + const outputs = await this.client.getOutputs(outputIds); + return outputs.reduce((acc, act, i) => { + if (act.output.type === OutputType.Basic) { + return { ...acc, [outputIds[i]]: act.output as BasicOutput }; } - } - return outputs; + return acc; + }, {} as { [key: string]: BasicOutput }); }; public send = async ( @@ -124,21 +123,12 @@ export class IotaWallet extends Wallet { ? [outputToConsume] : (await MnemonicService.getData(from.bech32)).consumedOutputIds; const outputsMap = await this.getOutputs(from.bech32, prevConsumedOutputIds, false); - const output = packBasicOutput( - toAddress, - amount, - params.nativeTokens, - this.info, - params.storageDepositReturnAddress, - params.vestingAt, - params.expiration, - params.customMetadata, - params.tag, - ); + const consumedOutpus = Object.values(outputsMap); + const output = await packBasicOutput(this, toAddress, amount, params); - const remainders: IBasicOutput[] = []; + const remainders: BasicOutput[] = []; - let storageDepositOutputMap: { [key: string]: IBasicOutput } = {}; + let storageDepositOutputMap: { [key: string]: BasicOutput } = {}; if (params.storageDepositSourceAddress) { const previouslyConsumedOutputIds = (await MnemonicService.getData(params.storageDepositSourceAddress)).consumedOutputIds || []; @@ -150,37 +140,42 @@ export class IotaWallet extends Wallet { const remainder = mergeOutputs(cloneDeep(Object.values(storageDepositOutputMap))); remainder.amount = (Number(remainder.amount) - Number(output.amount)).toString(); if (Number(remainder.amount)) { - remainders.push(remainder); + remainders.push(await this.client.buildBasicOutput(remainder)); } } - const remainder = mergeOutputs(cloneDeep(Object.values(outputsMap))); + const remainder = mergeOutputs(cloneDeep(consumedOutpus)); remainder.nativeTokens = subtractNativeTokens(remainder, params.nativeTokens); if (!params.storageDepositSourceAddress) { remainder.amount = (Number(remainder.amount) - Number(output.amount)).toString(); } if (!isEmpty(remainder.nativeTokens) || Number(remainder.amount) > 0) { - remainders.push(remainder); + remainders.push(await this.client.buildBasicOutput(remainder)); } const inputs = [...Object.keys(outputsMap), ...Object.keys(storageDepositOutputMap)].map( - TransactionHelper.inputFromOutputId, + UTXOInput.fromOutputId, ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ - ...Object.values(outputsMap), + const inputsCommitment = Utils.computeInputsCommitment([ + ...consumedOutpus, ...Object.values(storageDepositOutputMap), ]); - const essence = packEssence(inputs, inputsCommitment, [output, ...remainders], this, params); - const unlocks: UnlockTypes[] = Object.values(outputsMap).map((_, index) => - !index ? createUnlock(essence, from.keyPair) : { type: REFERENCE_UNLOCK_TYPE, reference: 0 }, + const essence = await packEssence( + this, + inputs, + inputsCommitment, + [output, ...remainders], + params, + ); + const fromUnlock = await createUnlock(essence, from); + const unlocks: Unlock[] = consumedOutpus.map((_, i) => + i ? new ReferenceUnlock(0) : fromUnlock, ); if (params.storageDepositSourceAddress) { const address = await this.getAddressDetails(params.storageDepositSourceAddress); - const storageDepUnlocks: UnlockTypes[] = Object.values(storageDepositOutputMap).map( - (_, index) => - !index - ? createUnlock(essence, address.keyPair) - : { type: REFERENCE_UNLOCK_TYPE, reference: unlocks.length }, + const storageDepUnlock = await createUnlock(essence, address); + const storageDepUnlocks: Unlock[] = Object.values(storageDepositOutputMap).map((_, index) => + index ? new ReferenceUnlock(unlocks.length) : storageDepUnlock, ); unlocks.push(...storageDepUnlocks); } @@ -194,7 +189,7 @@ export class IotaWallet extends Wallet { ); } } - return await submitBlock(this, packPayload(essence, unlocks)); + return await submitBlock(this, essence, unlocks); }; public sendToMany = async ( @@ -203,58 +198,51 @@ export class IotaWallet extends Wallet { params: WalletParams, ): Promise => { const outputsMap = await this.getOutputs(from.bech32, [], false); - const mergedConsumedOutput = mergeOutputs(Object.values(cloneDeep(outputsMap))); + const mergedConsumedOutputs = mergeOutputs(Object.values(cloneDeep(outputsMap))); - const outputs = targets.map((target) => - packBasicOutput( - target.toAddress, - target.amount, - target.nativeTokens, - this.info, - undefined, - undefined, - undefined, - target.customMetadata, - ), + const promises = targets.map((target) => + packBasicOutput(this, target.toAddress, target.amount, { + nativeTokens: target.nativeTokens, + customMetadata: target.customMetadata, + }), ); + const outputs = await Promise.all(promises); const mergedOutputs = mergeOutputs(Object.values(cloneDeep(outputs))); - const remainderAmount = Number(mergedConsumedOutput.amount) - Number(mergedOutputs.amount); + const remainderAmount = Number(mergedConsumedOutputs.amount) - Number(mergedOutputs.amount); const remainderNativeTokenAmount = - Number(head(mergedConsumedOutput.nativeTokens)?.amount || 0) - + Number(head(mergedConsumedOutputs.nativeTokens)?.amount || 0) - Number(head(mergedOutputs.nativeTokens)?.amount || 0); const remainderNativeTokens = remainderNativeTokenAmount ? [ { - id: mergedConsumedOutput.nativeTokens![0].id, - amount: HexHelper.fromBigInt256(bigInt(remainderNativeTokenAmount)), + id: mergedConsumedOutputs.nativeTokens![0].id, + amount: BigInt(remainderNativeTokenAmount), }, ] : []; - const remainder = packBasicOutput( - from.bech32, - remainderAmount, - remainderNativeTokens, - this.info, - ); + const remainder = await packBasicOutput(this, from.bech32, remainderAmount, { + nativeTokens: remainderNativeTokens, + }); - const inputs = Object.keys(outputsMap).map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment(Object.values(outputsMap)); + const inputs = Object.keys(outputsMap).map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment(Object.values(outputsMap)); - const essence = packEssence( + const essence = await packEssence( + this, inputs, inputsCommitment, remainderAmount > 0 ? [...outputs, remainder] : outputs, - this, params, ); - const unlocks: UnlockTypes[] = Object.values(outputsMap).map((_, index) => - !index ? createUnlock(essence, from.keyPair) : { type: REFERENCE_UNLOCK_TYPE, reference: 0 }, + const fromUnlock = await createUnlock(essence, from); + const unlocks: Unlock[] = Object.values(outputsMap).map((_, index) => + index ? new ReferenceUnlock(0) : fromUnlock, ); await setConsumedOutputIds(from.bech32, Object.keys(outputsMap)); - return await submitBlock(this, packPayload(essence, unlocks)); + return await submitBlock(this, essence, unlocks); }; public creditLocked = async (credit: Transaction, params: WalletParams): Promise => { @@ -266,9 +254,12 @@ export class IotaWallet extends Wallet { true, ); - const sourceBasicOutputs = Object.values(sourceConsumedOutputs).map((o) => - packBasicOutput(credit.payload.targetAddress!, Number(o.amount), o.nativeTokens, this.info), + const sourceBasicOutputsPromises = Object.values(sourceConsumedOutputs).map((o) => + packBasicOutput(this, credit.payload.targetAddress!, Number(o.amount), { + nativeTokens: o.nativeTokens, + }), ); + const sourceBasicOutputs = await Promise.all(sourceBasicOutputsPromises); const nftWallet = new NftWallet(this); const sourceConsumedNftOutputs = await nftWallet.getNftOutputs( @@ -276,16 +267,13 @@ export class IotaWallet extends Wallet { credit.payload.sourceAddress, mnemonicData.consumedNftOutputIds, ); - const targetAddress = Bech32Helper.addressFromBech32( - credit.payload.targetAddress!, - this.info.protocol.bech32Hrp, - ); - const sourceNftOutputs = Object.values(sourceConsumedNftOutputs).map((nftOutput) => { - const output = cloneDeep(nftOutput); - output.unlockConditions = [{ type: ADDRESS_UNLOCK_CONDITION_TYPE, address: targetAddress }]; - return output; + const targetAddress = Utils.parseBech32Address(credit.payload.targetAddress!); + const sourceNftOutputsPromises = Object.values(sourceConsumedNftOutputs).map((nftOutput) => { + const output: NftOutputBuilderParams = cloneDeep(nftOutput); + output.unlockConditions = [new AddressUnlockCondition(targetAddress)]; + return this.client.buildNftOutput(output); }); - + const sourceNftOutputs = await Promise.all(sourceNftOutputsPromises); const sourceOutputs = [...sourceBasicOutputs, ...sourceNftOutputs]; const prevStorageDepConsumedOutputIds = @@ -296,26 +284,29 @@ export class IotaWallet extends Wallet { prevStorageDepConsumedOutputIds, false, ); - const storageDepOutputs = Object.values(storageDepConsumedOutputs).map((o) => - packBasicOutput(credit.payload.targetAddress!, Number(o.amount), o.nativeTokens, this.info), + const storageDepOutputsPromises = Object.values(storageDepConsumedOutputs).map((o) => + packBasicOutput(this, credit.payload.targetAddress!, Number(o.amount), { + nativeTokens: o.nativeTokens, + }), ); + const storageDepOutputs = await Promise.all(storageDepOutputsPromises); const inputs = [ ...Object.keys(sourceConsumedOutputs), ...Object.keys(sourceConsumedNftOutputs), ...Object.keys(storageDepConsumedOutputs), - ].map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + ].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([ ...Object.values(sourceConsumedOutputs), ...Object.values(sourceConsumedNftOutputs), ...Object.values(storageDepConsumedOutputs), ]); - const essence = packEssence( + const essence = await packEssence( + this, inputs, inputsCommitment, [...sourceOutputs, ...storageDepOutputs], - this, params, ); @@ -324,16 +315,13 @@ export class IotaWallet extends Wallet { credit.payload.storageDepositSourceAddress, ); - const sourceUnlocks: UnlockTypes[] = Object.keys(sourceOutputs).map((_, i) => - i - ? { type: REFERENCE_UNLOCK_TYPE, reference: 0 } - : createUnlock(essence, sourceAddress.keyPair), + const sourceAddressUnlock = await createUnlock(essence, sourceAddress); + const sourceUnlocks: Unlock[] = Object.keys(sourceOutputs).map((_, i) => + i ? new ReferenceUnlock(0) : sourceAddressUnlock, ); - const storageDepositUnlocks: UnlockTypes[] = Object.keys(storageDepConsumedOutputs).map( - (_, i) => - i - ? { type: REFERENCE_UNLOCK_TYPE, reference: sourceUnlocks.length } - : createUnlock(essence, storageDepositAddess.keyPair), + const storageDepositUnlock = await createUnlock(essence, storageDepositAddess); + const storageDepositUnlocks: Unlock[] = Object.keys(storageDepConsumedOutputs).map((_, i) => + i ? new ReferenceUnlock(sourceUnlocks.length) : storageDepositUnlock, ); await setConsumedOutputIds( sourceAddress.bech32, @@ -341,14 +329,14 @@ export class IotaWallet extends Wallet { Object.keys(sourceConsumedNftOutputs), ); await setConsumedOutputIds(storageDepositAddess.bech32, Object.keys(storageDepConsumedOutputs)); - return await submitBlock( - this, - packPayload(essence, [...sourceUnlocks, ...storageDepositUnlocks]), - ); + return await submitBlock(this, essence, [...sourceUnlocks, ...storageDepositUnlocks]); }; } -const subtractNativeTokens = (output: IBasicOutput, tokens: NativeToken[] | undefined) => { +const subtractNativeTokens = ( + output: BasicOutput | BasicOutputBuilderParams, + tokens: NativeToken[] | undefined, +) => { if (!output.nativeTokens || !tokens) { return output.nativeTokens; } @@ -358,7 +346,7 @@ const subtractNativeTokens = (output: IBasicOutput, tokens: NativeToken[] | unde if (!tokenToSubtract) { return token; } - return { id: token.id, amount: subtractHex(token.amount, tokenToSubtract as string) }; + return { id: token.id, amount: BigInt(token.amount) - tokenToSubtract }; }) .filter((nt) => Number(nt.amount) !== 0); }; diff --git a/packages/functions/src/services/wallet/NativeTokenWallet.ts b/packages/functions/src/services/wallet/NativeTokenWallet.ts index 65ab2138ee..7385218591 100644 --- a/packages/functions/src/services/wallet/NativeTokenWallet.ts +++ b/packages/functions/src/services/wallet/NativeTokenWallet.ts @@ -1,17 +1,18 @@ import { COL, Member, Token, Transaction } from '@build-5/interfaces'; import { - IAliasOutput, - OutputTypes, - REFERENCE_UNLOCK_TYPE, - TransactionHelper, - UnlockTypes, -} from '@iota/iota.js-next'; + AliasOutputBuilderParams, + Client, + Output, + ReferenceUnlock, + UTXOInput, + Unlock, + Utils, +} from '@iota/sdk'; import { cloneDeep } from 'lodash'; import { build5Db } from '../../firebase/firestore/build5Db'; import { getAddress } from '../../utils/address.utils'; import { mergeOutputs } from '../../utils/basic-output.utils'; -import { packEssence, packPayload, submitBlock } from '../../utils/block.utils'; -import { createUnlock } from '../../utils/smr.utils'; +import { createUnlock, packEssence, submitBlock } from '../../utils/block.utils'; import { createFoundryOutput, getVaultAndGuardianOutput, @@ -25,7 +26,10 @@ import { Wallet, WalletParams } from './wallet'; import { setConsumedOutputIds } from './wallet.service'; export class NativeTokenWallet { - constructor(private readonly wallet: Wallet) {} + private client: Client; + constructor(private readonly wallet: Wallet) { + this.client = this.wallet.client; + } public mintFoundry = async (transaction: Transaction, params: WalletParams) => { const sourceAddress = await this.wallet.getAddressDetails(transaction.payload.sourceAddress!); @@ -36,7 +40,6 @@ export class NativeTokenWallet { sourceMnemonic.consumedOutputIds, false, ); - const remainder = mergeOutputs(Object.values(outputsMap)); const aliasWallet = new AliasWallet(this.wallet); const aliasOutputs = await aliasWallet.getAliasOutputs( @@ -45,62 +48,62 @@ export class NativeTokenWallet { ); const [aliasOutputId, aliasOutput] = Object.entries(aliasOutputs)[0]; - const nextAliasOutput = cloneDeep(aliasOutput) as IAliasOutput; - nextAliasOutput.aliasId = TransactionHelper.resolveIdFromOutputId(aliasOutputId); - nextAliasOutput.stateIndex++; - nextAliasOutput.foundryCounter++; + const nextAliasOutput: AliasOutputBuilderParams = cloneDeep(aliasOutput); + nextAliasOutput.aliasId = Utils.computeAliasId(aliasOutputId); + nextAliasOutput.stateIndex!++; + nextAliasOutput.foundryCounter!++; const token = await build5Db().doc(`${COL.TOKEN}/${transaction.payload.token}`).get(); const metadata = await tokenToFoundryMetadata(token); - const foundryOutput = createFoundryOutput( + const foundryOutput = await createFoundryOutput( + this.wallet, token.totalSupply, - nextAliasOutput, + await this.client.buildAliasOutput(nextAliasOutput), JSON.stringify(metadata), - this.wallet.info, ); const totalDistributed = (await getOwnedTokenTotal(token.uid)) + (await getUnclaimedAirdropTotalValue(token.uid)); const member = await build5Db().doc(`${COL.MEMBER}/${transaction.member}`).get(); - const tokenId = TransactionHelper.constructTokenId( + const tokenId = Utils.computeFoundryId( nextAliasOutput.aliasId, foundryOutput.serialNumber, foundryOutput.tokenScheme.type, ); const { vaultOutput, guardianOutput } = await getVaultAndGuardianOutput( + this.wallet, tokenId, token.totalSupply, totalDistributed, sourceAddress.bech32, getAddress(member, transaction.network!), - this.wallet.info, ); - const constumedAmount = [foundryOutput, vaultOutput, guardianOutput].reduce( + const consumedAmount = [foundryOutput, vaultOutput, guardianOutput].reduce( (acc, act) => acc + Number(act?.amount || 0), 0, ); - remainder.amount = (Number(remainder.amount) - constumedAmount).toString(); - const inputs = [...Object.keys(outputsMap), aliasOutputId].map( - TransactionHelper.inputFromOutputId, - ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputs = [...Object.keys(outputsMap), aliasOutputId].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([ ...Object.values(outputsMap), aliasOutput, ]); const baseOutputs = [nextAliasOutput, foundryOutput, vaultOutput, guardianOutput].filter( (o) => o !== undefined, - ) as OutputTypes[]; - const outputs = Number(remainder.amount) ? [...baseOutputs, remainder] : baseOutputs; - const essence = packEssence(inputs, inputsCommitment, outputs, this.wallet, params); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, sourceAddress.keyPair), - { type: REFERENCE_UNLOCK_TYPE, reference: 0 }, - ]; + ) as Output[]; + const outputs = [...baseOutputs]; + + const remainderParams = mergeOutputs(Object.values(outputsMap)); + remainderParams.amount = (Number(remainderParams.amount) - consumedAmount).toString(); + if (Number(remainderParams.amount)) { + outputs.push(await this.client.buildBasicOutput(remainderParams)); + } + const essence = await packEssence(this.wallet, inputs, inputsCommitment, outputs, params); + const unlocks: Unlock[] = [await createUnlock(essence, sourceAddress), new ReferenceUnlock(0)]; await setConsumedOutputIds(sourceAddress.bech32, Object.keys(outputsMap), [], [aliasOutputId]); - return submitBlock(this.wallet, packPayload(essence, unlocks)); + return submitBlock(this.wallet, essence, unlocks); }; } diff --git a/packages/functions/src/services/wallet/NftWallet.ts b/packages/functions/src/services/wallet/NftWallet.ts index 203f9de27e..ab811465be 100644 --- a/packages/functions/src/services/wallet/NftWallet.ts +++ b/packages/functions/src/services/wallet/NftWallet.ts @@ -10,36 +10,36 @@ import { Transaction, } from '@build-5/interfaces'; import { - ADDRESS_UNLOCK_CONDITION_TYPE, - ALIAS_ADDRESS_TYPE, - ALIAS_UNLOCK_TYPE, - AddressTypes, - Bech32Helper, - DEFAULT_PROTOCOL_VERSION, - ED25519_ADDRESS_TYPE, - IAliasOutput, - IBasicOutput, - IBlock, - INftAddress, - INftOutput, - IndexerPluginClient, - METADATA_FEATURE_TYPE, - NFT_ADDRESS_TYPE, - OutputTypes, - REFERENCE_UNLOCK_TYPE, - TAG_FEATURE_TYPE, - TIMELOCK_UNLOCK_CONDITION_TYPE, - TransactionHelper, - UnlockTypes, -} from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; + AddressUnlockCondition, + AliasAddress, + AliasOutput, + AliasOutputBuilderParams, + AliasUnlock, + BasicOutput, + BasicOutputBuilderParams, + Client, + Ed25519Address, + FeatureType, + MetadataFeature, + NftAddress, + NftOutput, + NftOutputBuilderParams, + Output, + ReferenceUnlock, + TimelockUnlockCondition, + UTXOInput, + Unlock, + Utils, + utf8ToHex, +} from '@iota/sdk'; import dayjs from 'dayjs'; import * as functions from 'firebase-functions/v2'; import { cloneDeep, get, head, isEmpty } from 'lodash'; import { build5Db } from '../../firebase/firestore/build5Db'; +import { unclockMnemonic } from '../../triggers/milestone-transactions-triggers/common'; import { getAddress } from '../../utils/address.utils'; import { mergeOutputs } from '../../utils/basic-output.utils'; -import { isValidBlockSize, packEssence, packPayload, submitBlock } from '../../utils/block.utils'; +import { createUnlock, packEssence, submitBlock } from '../../utils/block.utils'; import { EMPTY_NFT_ID, ZERO_ADDRESS, @@ -47,8 +47,7 @@ import { createNftOutput, nftToMetadata, } from '../../utils/collection-minting-utils/nft.utils'; -import { createUnlock } from '../../utils/smr.utils'; -import { EMPTY_ALIAS_ID, getAliasBech32Address } from '../../utils/token-minting-utils/alias.utils'; +import { EMPTY_ALIAS_ID } from '../../utils/token-minting-utils/alias.utils'; import { awardBadgeToNttMetadata, awardToCollectionMetadata } from '../payment/award/award-service'; import { AliasWallet } from './AliasWallet'; import { MnemonicService } from './mnemonic'; @@ -57,15 +56,18 @@ import { AddressDetails, setConsumedOutputIds } from './wallet.service'; interface MintNftInputParams { readonly aliasOutputId: string; - readonly aliasOutput: IAliasOutput; + readonly aliasOutput: AliasOutput; readonly collectionOutputId: string; - readonly collectionOutput: INftOutput; + readonly collectionOutput: NftOutput; readonly consumedOutputIds: string[]; - readonly consumedOutputs: IBasicOutput[]; + readonly consumedOutputs: BasicOutput[]; } export class NftWallet { - constructor(private readonly wallet: Wallet) {} + private client: Client; + constructor(private readonly wallet: Wallet) { + this.client = this.wallet.client; + } public mintCollection = async (transaction: Transaction, params: WalletParams) => { const sourceIsGov = @@ -95,46 +97,43 @@ export class NftWallet { aliasGovMnemonic.consumedAliasOutputIds, ); const [aliasOutputId, aliasOutput] = Object.entries(aliasOutputs)[0]; - const nextAliasOutput = cloneDeep(aliasOutput); + const nextAliasOutput: AliasOutputBuilderParams = cloneDeep(aliasOutput); if (nextAliasOutput.aliasId === EMPTY_ALIAS_ID) { - nextAliasOutput.aliasId = TransactionHelper.resolveIdFromOutputId(aliasOutputId); + nextAliasOutput.aliasId = Utils.computeAliasId(aliasOutputId); } - nextAliasOutput.stateIndex++; + nextAliasOutput.stateIndex!++; const collectionDocRef = build5Db().doc(`${COL.COLLECTION}/${transaction.payload.collection}`); const collection = await collectionDocRef.get(); const collectionMetadata = await this.getCollectionMetadata(transaction.network!, collection); - const issuerAddress: AddressTypes = { - type: ALIAS_ADDRESS_TYPE, - aliasId: nextAliasOutput.aliasId, - }; - const collectionOutput = createNftOutput( + const issuerAddress = new AliasAddress(nextAliasOutput.aliasId); + const collectionOutput = await createNftOutput( + this.wallet, issuerAddress, issuerAddress, collectionMetadata.immutableMetadata, - this.wallet.info, undefined, collectionMetadata.mutableMetadata, ); remainder.amount = (Number(remainder.amount) - Number(collectionOutput.amount)).toString(); - const inputs = [aliasOutputId, ...Object.keys(outputsMap)].map( - TransactionHelper.inputFromOutputId, - ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputs = [aliasOutputId, ...Object.keys(outputsMap)].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([ aliasOutput, ...Object.values(outputsMap), ]); - const outputs = Number(remainder.amount) - ? [nextAliasOutput, collectionOutput, remainder] - : [nextAliasOutput, collectionOutput]; - const essence = packEssence(inputs, inputsCommitment, outputs, this.wallet, params); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, aliasGovAddress.keyPair), - sourceIsGov - ? { type: REFERENCE_UNLOCK_TYPE, reference: 0 } - : createUnlock(essence, sourceAddress.keyPair), + const outputs: Output[] = [ + await this.client.buildAliasOutput(nextAliasOutput), + collectionOutput, + ]; + if (Number(remainder.amount)) { + outputs.push(await this.client.buildBasicOutput(remainder)); + } + const essence = await packEssence(this.wallet, inputs, inputsCommitment, outputs, params); + const unlocks: Unlock[] = [ + await createUnlock(essence, aliasGovAddress), + sourceIsGov ? new ReferenceUnlock(0) : await createUnlock(essence, sourceAddress), ]; await setConsumedOutputIds( @@ -146,7 +145,7 @@ export class NftWallet { if (!sourceIsGov) { await setConsumedOutputIds(aliasGovAddress.bech32, [], [], [aliasOutputId]); } - return await submitBlock(this.wallet, packPayload(essence, unlocks)); + return await submitBlock(this.wallet, essence, unlocks); }; private getCollectionMetadata = async (network: Network, collection: Collection) => { @@ -177,45 +176,41 @@ export class NftWallet { sourceMnemonic.consumedAliasOutputIds, ); const [aliasOutputId, aliasOutput] = Object.entries(aliasOutputs)[0]; - const nextAliasOutput = cloneDeep(aliasOutput); - nextAliasOutput.aliasId = TransactionHelper.resolveIdFromOutputId(aliasOutputId); - nextAliasOutput.stateIndex++; + const nextAliasOutput: AliasOutputBuilderParams = cloneDeep(aliasOutput); + nextAliasOutput.aliasId = Utils.computeAliasId(aliasOutputId); + nextAliasOutput.stateIndex!++; const awardDocRef = build5Db().doc(`${COL.AWARD}/${transaction.payload.award}`); const award = await awardDocRef.get(); - const issuerAddress: AddressTypes = { - type: ALIAS_ADDRESS_TYPE, - aliasId: TransactionHelper.resolveIdFromOutputId(aliasOutputId), - }; + const issuerAddress = new AliasAddress(Utils.computeAliasId(aliasOutputId)); const spaceDocRef = build5Db().doc(`${COL.SPACE}/${award.space}`); const space = await spaceDocRef.get(); const metadata = await awardToCollectionMetadata(award, space); - const collectionOutput = createNftOutput( + const collectionOutput = await createNftOutput( + this.wallet, issuerAddress, issuerAddress, JSON.stringify(metadata), - this.wallet.info, ); remainder.amount = (Number(remainder.amount) - Number(collectionOutput.amount)).toString(); - const inputs = [aliasOutputId, ...Object.keys(outputsMap)].map( - TransactionHelper.inputFromOutputId, - ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputs = [aliasOutputId, ...Object.keys(outputsMap)].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([ aliasOutput, ...Object.values(outputsMap), ]); - const outputs = [nextAliasOutput, collectionOutput, remainder]; - const essence = packEssence(inputs, inputsCommitment, outputs, this.wallet, params); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, sourceAddress.keyPair), - { type: REFERENCE_UNLOCK_TYPE, reference: 0 }, + const outputs = [ + await this.client.buildAliasOutput(nextAliasOutput), + collectionOutput, + await this.client.buildBasicOutput(remainder), ]; + const essence = await packEssence(this.wallet, inputs, inputsCommitment, outputs, params); + const unlocks: Unlock[] = [await createUnlock(essence, sourceAddress), new ReferenceUnlock(0)]; await setConsumedOutputIds(sourceAddress.bech32, Object.keys(outputsMap)); - return await submitBlock(this.wallet, packPayload(essence, unlocks)); + return await submitBlock(this.wallet, essence, unlocks); }; public mintNfts = async (transaction: Transaction, params: WalletParams) => { @@ -235,7 +230,10 @@ export class NftWallet { ); const [aliasOutputId, aliasOutput] = Object.entries(aliasOutputs)[0]; - const aliasAddress = getAliasBech32Address(aliasOutput.aliasId, this.wallet.info); + const aliasAddress = Utils.aliasIdToBech32( + aliasOutput.aliasId, + this.wallet.info.protocol.bech32Hrp, + ); const collectionOutputs = await this.getNftOutputs( undefined, aliasAddress, @@ -244,7 +242,7 @@ export class NftWallet { const [collectionOutputId, collectionOutput] = Object.entries(collectionOutputs)[0]; const collectionNftId = collectionOutput.nftId === EMPTY_NFT_ID - ? TransactionHelper.resolveIdFromOutputId(collectionOutputId) + ? Utils.computeNftId(collectionOutputId) : collectionOutput.nftId; const collection = ( @@ -271,51 +269,52 @@ export class NftWallet { }; let nftsToMint = nfts.length; + + await setConsumedOutputIds( + sourceAddress.bech32, + Object.keys(outputsMap), + [collectionOutputId], + [], + ); + let blockId = ''; do { try { - const block = this.packNftMintBlock( + const nftOutputsToMint = nftOutputs.slice(0, nftsToMint); + const { essence, unlocks } = await this.packNftMintBlock( sourceAddress, inputs, - nftOutputs.slice(0, nftsToMint), + nftOutputsToMint, params, ); - if (isValidBlockSize(block)) { - break; - } + blockId = await submitBlock(this.wallet, essence, unlocks); + const batch = build5Db().batch(); + nftOutputsToMint.forEach((output, i) => { + batch.update(build5Db().doc(`${COL.NFT}/${nfts[i].uid}`), { + 'mintingData.address': nftMintAddresses[i].bech32, + 'mintingData.storageDeposit': Number(output.amount), + }); + }); + + const transactionDocRef = build5Db().doc(`${COL.TRANSACTION}/${transaction.uid}`); + batch.update(transactionDocRef, { + 'payload.amount': nftOutputsToMint.reduce((acc, act) => acc + Number(act.amount), 0), + 'payload.nfts': nfts.slice(0, nftsToMint).map((nft) => nft.uid), + }); + + await batch.commit(); + break; + // eslint-disable-next-line no-empty } catch {} nftsToMint--; } while (nftsToMint > 0); if (!nftsToMint) { + await unclockMnemonic(sourceAddress.bech32); functions.logger.error('Nft data to big to mint', head(nfts)); throw Error('Nft data to big to mint'); } - - const nftOutputsToMint = nftOutputs.slice(0, nftsToMint); - const batch = build5Db().batch(); - nftOutputsToMint.forEach((output, i) => { - batch.update(build5Db().doc(`${COL.NFT}/${nfts[i].uid}`), { - 'mintingData.address': nftMintAddresses[i].bech32, - 'mintingData.storageDeposit': Number(output.amount), - }); - }); - await batch.commit(); - await build5Db() - .doc(`${COL.TRANSACTION}/${transaction.uid}`) - .update({ - 'payload.amount': nftOutputsToMint.reduce((acc, act) => acc + Number(act.amount), 0), - 'payload.nfts': nfts.slice(0, nftsToMint).map((nft) => nft.uid), - }); - - await setConsumedOutputIds( - sourceAddress.bech32, - Object.keys(outputsMap), - [collectionOutputId], - [], - ); - const block = this.packNftMintBlock(sourceAddress, inputs, nftOutputsToMint, params); - return await this.wallet.client.blockSubmit(block); + return blockId; }; public mintNtt = async (transaction: Transaction, params: WalletParams) => { @@ -335,7 +334,10 @@ export class NftWallet { ); const [aliasOutputId, aliasOutput] = Object.entries(aliasOutputs)[0]; - const aliasAddress = getAliasBech32Address(aliasOutput.aliasId, this.wallet.info); + const aliasAddress = Utils.aliasIdToBech32( + aliasOutput.aliasId, + this.wallet.info.protocol.bech32Hrp, + ); const collectionOutputs = await this.getNftOutputs( undefined, aliasAddress, @@ -344,17 +346,14 @@ export class NftWallet { const [collectionOutputId, collectionOutput] = Object.entries(collectionOutputs)[0]; const collectionNftId = collectionOutput.nftId === EMPTY_NFT_ID - ? TransactionHelper.resolveIdFromOutputId(collectionOutputId) + ? Utils.computeNftId(collectionOutputId) : collectionOutput.nftId; const awardDocRef = build5Db().doc(`${COL.AWARD}/${transaction.payload.award}`); const award = await awardDocRef.get(); - const issuerAddress: INftAddress = { type: NFT_ADDRESS_TYPE, nftId: collectionNftId }; - const ownerAddress = Bech32Helper.addressFromBech32( - transaction.payload.targetAddress!, - this.wallet.info.protocol.bech32Hrp, - ); + const issuerAddress = new NftAddress(collectionNftId); + const ownerAddress = Utils.parseBech32Address(transaction.payload.targetAddress!); const metadata = await awardBadgeToNttMetadata( award, @@ -363,11 +362,11 @@ export class NftWallet { dayjs(get(transaction, 'payload.participatedOn')!.toDate()), get(transaction, 'payload.edition', 0), ); - const ntt = createNftOutput( + const ntt = await createNftOutput( + this.wallet, ownerAddress, issuerAddress, JSON.stringify(metadata), - this.wallet.info, dayjs().add(award.badge.lockTime), ); @@ -386,8 +385,8 @@ export class NftWallet { [collectionOutputId], [aliasOutputId], ); - const block = this.packNftMintBlock(sourceAddress, inputs, [ntt], params); - return await this.wallet.client.blockSubmit(block); + const { essence, unlocks } = await this.packNftMintBlock(sourceAddress, inputs, [ntt], params); + return await submitBlock(this.wallet, essence, unlocks); }; public mintMetadataNft = async (transaction: Transaction, params: WalletParams) => { @@ -404,8 +403,6 @@ export class NftWallet { false, ); - const indexer = new IndexerPluginClient(this.wallet.client); - const aliasGovAddress = await this.wallet.getAddressDetails( transaction.payload.aliasGovAddress!, ); @@ -419,43 +416,35 @@ export class NftWallet { ); const [aliasOutputId, aliasOutput] = Object.entries(aliasOutputs)[0]; - const collectionResult = await indexer.nft(transaction.payload.collectionId!); - const collectionOutputId = collectionResult.items[0]; - const collectionOutput = (await this.wallet.client.output(collectionOutputId)) - .output as INftOutput; + const collectionOutputId = await this.client.nftOutputId(transaction.payload.collectionId!); + const collectionOutput = (await this.client.getOutput(collectionOutputId)).output as NftOutput; const inputs = [aliasOutputId, collectionOutputId, ...Object.keys(outputsMap)].map( - TransactionHelper.inputFromOutputId, + UTXOInput.fromOutputId, ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputsCommitment = Utils.computeInputsCommitment([ aliasOutput, collectionOutput, ...Object.values(outputsMap), ]); - const nextAliasOutput = cloneDeep(aliasOutput); - nextAliasOutput.stateIndex++; - const nextCollectionOutput = cloneDeep(collectionOutput); + const nextAliasOutput: AliasOutputBuilderParams = cloneDeep(aliasOutput); + nextAliasOutput.stateIndex!++; + const nextCollectionOutput: NftOutputBuilderParams = cloneDeep(collectionOutput); if (nextCollectionOutput.nftId === EMPTY_NFT_ID) { - nextCollectionOutput.nftId = TransactionHelper.resolveIdFromOutputId(collectionOutputId); + nextCollectionOutput.nftId = Utils.computeNftId(collectionOutputId); } const order = await build5Db() .doc(`${COL.TRANSACTION}/${transaction.payload.orderId}`) .get(); - const issuerAddress: INftAddress = { - type: NFT_ADDRESS_TYPE, - nftId: transaction.payload.collectionId!, - }; - const ownerAddress = Bech32Helper.addressFromBech32( - transaction.payload.targetAddress!, - this.wallet.info.protocol.bech32Hrp, - ); + const issuerAddress = new NftAddress(transaction.payload.collectionId!); + const ownerAddress = Utils.parseBech32Address(transaction.payload.targetAddress!); const mutableMetadata = JSON.stringify(get(order, 'payload.metadata', {})); - const nftOutput = createNftOutput( + const nftOutput = await createNftOutput( + this.wallet, ownerAddress, issuerAddress, '', - this.wallet.info, undefined, mutableMetadata, ); @@ -463,18 +452,20 @@ export class NftWallet { const remainder = mergeOutputs(Object.values(outputsMap)); remainder.amount = (Number(remainder.amount) - Number(nftOutput.amount)).toString(); - const outputs: OutputTypes[] = [nextAliasOutput, nextCollectionOutput, nftOutput]; + const outputs: Output[] = [ + await this.client.buildAliasOutput(nextAliasOutput), + await this.client.buildNftOutput(nextCollectionOutput), + nftOutput, + ]; if (Number(remainder.amount)) { - outputs.push(remainder); + outputs.push(await this.client.buildBasicOutput(remainder)); } - const essence = packEssence(inputs, inputsCommitment, outputs, this.wallet, params); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, aliasGovAddress.keyPair), - { type: ALIAS_UNLOCK_TYPE, reference: 0 }, - sourceIsGov - ? { type: REFERENCE_UNLOCK_TYPE, reference: 0 } - : createUnlock(essence, sourceAddress.keyPair), + const essence = await packEssence(this.wallet, inputs, inputsCommitment, outputs, params); + const unlocks: Unlock[] = [ + await createUnlock(essence, aliasGovAddress), + new AliasUnlock(0), + sourceIsGov ? new ReferenceUnlock(0) : await createUnlock(essence, sourceAddress), ]; await setConsumedOutputIds( @@ -486,7 +477,7 @@ export class NftWallet { if (!sourceIsGov) { await setConsumedOutputIds(aliasGovAddress.bech32, [], [collectionOutputId], [aliasOutputId]); } - return await submitBlock(this.wallet, packPayload(essence, unlocks)); + return await submitBlock(this.wallet, essence, unlocks); }; public updateMetadataNft = async (transaction: Transaction, params: WalletParams) => { @@ -504,8 +495,6 @@ export class NftWallet { ); const [consumedOutputId, consumedOutput] = Object.entries(outputsMap)[0]; - const indexer = new IndexerPluginClient(this.wallet.client); - const aliasGovAddress = await this.wallet.getAddressDetails( transaction.payload.aliasGovAddress!, ); @@ -519,72 +508,69 @@ export class NftWallet { ); const [aliasOutputId, aliasOutput] = Object.entries(aliasOutputs)[0]; - const collectionResult = await indexer.nft(transaction.payload.collectionId!); - const collectionOutputId = collectionResult.items[0]; - const collectionOutput = (await this.wallet.client.output(collectionOutputId)) - .output as INftOutput; + const collectionOutputId = await this.client.nftOutputId(transaction.payload.collectionId!); + const collectionOutput = (await this.client.getOutput(collectionOutputId)).output as NftOutput; const nft = await build5Db().doc(`${COL.NFT}/${transaction.payload.nft}`).get(); const nftOwnerAddressBech = nft.mintingData?.address || nft.depositData?.address!; const nftOwnerAddress = await this.wallet.getAddressDetails(nftOwnerAddressBech); - const nftResult = await indexer.nft(nft.mintingData?.nftId!); - const nftOutputId = nftResult.items[0]; - const nftOutput = (await this.wallet.client.output(nftOutputId)).output as INftOutput; + const nftOutputId = await this.client.nftOutputId(nft.mintingData?.nftId!); + const nftOutput = (await this.client.getOutput(nftOutputId)).output as NftOutput; const inputs = [aliasOutputId, collectionOutputId, nftOutputId, consumedOutputId].map( - TransactionHelper.inputFromOutputId, + UTXOInput.fromOutputId, ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputsCommitment = Utils.computeInputsCommitment([ aliasOutput, collectionOutput, nftOutput, consumedOutput, ]); - const nextAliasOutput = cloneDeep(aliasOutput); - nextAliasOutput.stateIndex++; - const nextCollectionOutput = cloneDeep(collectionOutput); + const nextAliasOutput: AliasOutputBuilderParams = cloneDeep(aliasOutput); + nextAliasOutput.stateIndex!++; + const nextCollectionOutput: NftOutputBuilderParams = cloneDeep(collectionOutput); if (nextCollectionOutput.nftId === EMPTY_NFT_ID) { - nextCollectionOutput.nftId = TransactionHelper.resolveIdFromOutputId(collectionOutputId); + nextCollectionOutput.nftId = Utils.computeNftId(collectionOutputId); } const order = await build5Db() .doc(`${COL.TRANSACTION}/${transaction.payload.orderId}`) .get(); const mutableMetadata = JSON.stringify(get(order, 'payload.metadata', {})); - const nextNftOutput = cloneDeep(nftOutput); + const nextNftOutput: NftOutputBuilderParams = cloneDeep(nftOutput); if (nextNftOutput.nftId === EMPTY_NFT_ID) { - nextNftOutput.nftId = TransactionHelper.resolveIdFromOutputId(nftOutputId); + nextNftOutput.nftId = Utils.computeNftId(nftOutputId); } - nextNftOutput.features = [ - { type: METADATA_FEATURE_TYPE, data: Converter.utf8ToHex(mutableMetadata, true) }, - ]; - nextNftOutput.amount = TransactionHelper.getStorageDeposit( - nextNftOutput, + nextNftOutput.features = [new MetadataFeature(utf8ToHex(mutableMetadata))]; + nextNftOutput.amount = Utils.computeStorageDeposit( + await this.client.buildNftOutput(nextNftOutput), this.wallet.info.protocol.rentStructure, - ).toString(); + ); - const remainder = cloneDeep(consumedOutput); + const remainder: BasicOutputBuilderParams = cloneDeep(consumedOutput); remainder.amount = ( Number(remainder.amount) + Number(nftOutput.amount) - Number(nextNftOutput.amount) ).toString(); - const outputs: OutputTypes[] = [nextAliasOutput, nextCollectionOutput, nextNftOutput]; + const outputs: Output[] = [ + await this.client.buildAliasOutput(nextAliasOutput), + await this.client.buildNftOutput(nextCollectionOutput), + await this.client.buildNftOutput(nextNftOutput), + ]; if (Number(remainder.amount)) { - outputs.push(remainder); + outputs.push(await this.client.buildBasicOutput(remainder)); } - const essence = packEssence(inputs, inputsCommitment, outputs, this.wallet, params); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, aliasGovAddress.keyPair), - { type: ALIAS_UNLOCK_TYPE, reference: 0 }, + const essence = await packEssence(this.wallet, inputs, inputsCommitment, outputs, params); + const unlocks: Unlock[] = [ + await createUnlock(essence, aliasGovAddress), + new AliasUnlock(0), aliasGovAddress.bech32 === nftOwnerAddressBech - ? { type: REFERENCE_UNLOCK_TYPE, reference: 0 } - : createUnlock(essence, nftOwnerAddress.keyPair), - sourceIsGov - ? { type: REFERENCE_UNLOCK_TYPE, reference: 0 } - : createUnlock(essence, sourceAddress.keyPair), + ? new ReferenceUnlock(0) + : await createUnlock(essence, nftOwnerAddress), + sourceIsGov ? new ReferenceUnlock(0) : await createUnlock(essence, sourceAddress), ]; await setConsumedOutputIds( @@ -596,57 +582,49 @@ export class NftWallet { if (!sourceIsGov) { await setConsumedOutputIds(aliasGovAddress.bech32, [], [collectionOutputId], [aliasOutputId]); } - return await submitBlock(this.wallet, packPayload(essence, unlocks)); + return await submitBlock(this.wallet, essence, unlocks); }; - public packNftMintBlock = ( + public packNftMintBlock = async ( address: AddressDetails, input: MintNftInputParams, - nftOutputs: INftOutput[], + nftOutputs: NftOutput[], params: WalletParams, ) => { const inputs = [input.aliasOutputId, input.collectionOutputId, ...input.consumedOutputIds].map( - TransactionHelper.inputFromOutputId, + UTXOInput.fromOutputId, ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputsCommitment = Utils.computeInputsCommitment([ input.aliasOutput, input.collectionOutput, ...input.consumedOutputs, ]); - const nextAliasOutput = cloneDeep(input.aliasOutput); - nextAliasOutput.stateIndex++; - const nextCollectionOutput = cloneDeep(input.collectionOutput); + const nextAliasOutput: AliasOutputBuilderParams = cloneDeep(input.aliasOutput); + nextAliasOutput.stateIndex!++; + const nextCollectionOutput: NftOutputBuilderParams = cloneDeep(input.collectionOutput); if (nextCollectionOutput.nftId === EMPTY_NFT_ID) { - nextCollectionOutput.nftId = TransactionHelper.resolveIdFromOutputId( - input.collectionOutputId, - ); + nextCollectionOutput.nftId = Utils.computeNftId(input.collectionOutputId); } const nftTotalStorageDeposit = nftOutputs.reduce((acc, act) => acc + Number(act.amount), 0); - const remainder = mergeOutputs(input.consumedOutputs); - remainder.amount = (Number(remainder.amount) - nftTotalStorageDeposit).toString(); + const remainderParams = mergeOutputs(input.consumedOutputs); + remainderParams.amount = (Number(remainderParams.amount) - nftTotalStorageDeposit).toString(); - const outputs = [nextAliasOutput, nextCollectionOutput, ...nftOutputs]; - const essence = packEssence( - inputs, - inputsCommitment, - Number(remainder.amount) ? [...outputs, remainder] : outputs, - this.wallet, - params, - ); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, address.keyPair), - { type: ALIAS_UNLOCK_TYPE, reference: 0 }, - ...input.consumedOutputIds.map( - () => ({ type: REFERENCE_UNLOCK_TYPE, reference: 0 } as UnlockTypes), - ), + const outputs: Output[] = [ + await this.client.buildAliasOutput(nextAliasOutput), + await this.client.buildNftOutput(nextCollectionOutput), + ...nftOutputs, ]; - return { - protocolVersion: DEFAULT_PROTOCOL_VERSION, - parents: [], - payload: packPayload(essence, unlocks), - nonce: '0', - }; + if (Number(remainderParams.amount)) { + outputs.push(await this.client.buildBasicOutput(remainderParams)); + } + const essence = await packEssence(this.wallet, inputs, inputsCommitment, outputs, params); + const unlocks: Unlock[] = [ + await createUnlock(essence, address), + new AliasUnlock(0), + ...input.consumedOutputIds.map(() => new ReferenceUnlock(0)), + ]; + return { essence, unlocks }; }; public packNft = async ( @@ -656,12 +634,12 @@ export class NftWallet { address: AddressDetails, collectionNftId: string, ) => { - const issuerAddress: INftAddress = { type: NFT_ADDRESS_TYPE, nftId: collectionNftId }; - const ownerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: address.hex }; + const issuerAddress = new NftAddress(collectionNftId); + const ownerAddress = new Ed25519Address(address.hex); const metadata = JSON.stringify( await nftToMetadata(nft, collection, royaltySpaceAddress, collectionNftId), ); - return createNftOutput(ownerAddress, issuerAddress, metadata, this.wallet.info); + return createNftOutput(this.wallet, ownerAddress, issuerAddress, metadata); }; public changeNftOwner = async (transaction: Transaction, params: WalletParams) => { @@ -675,35 +653,32 @@ export class NftWallet { const nftOutput = Object.values(nftOutputs)[0]; const sourceAddress = await this.wallet.getAddressDetails(transaction.payload.sourceAddress!); - const targetAddress = Bech32Helper.addressFromBech32( - transaction.payload.targetAddress!, - this.wallet.info.protocol.bech32Hrp, - ); - const output = cloneDeep(nftOutput); - output.features = output.features?.filter((f) => f.type !== TAG_FEATURE_TYPE); - output.unlockConditions = [{ type: ADDRESS_UNLOCK_CONDITION_TYPE, address: targetAddress }]; + const targetAddress = Utils.parseBech32Address(transaction.payload.targetAddress!); + const output: NftOutputBuilderParams = cloneDeep(nftOutput); + output.features = output.features?.filter((f) => f.type !== FeatureType.Tag); + output.unlockConditions = [new AddressUnlockCondition(targetAddress)]; const vestingAt = dayjs(transaction.payload.vestingAt?.toDate()); if (vestingAt.isAfter(dayjs())) { - output.unlockConditions.push({ - type: TIMELOCK_UNLOCK_CONDITION_TYPE, - unixTime: vestingAt.unix(), - }); + output.unlockConditions.push(new TimelockUnlockCondition(vestingAt.unix())); } if (output.nftId === EMPTY_NFT_ID) { - output.nftId = TransactionHelper.resolveIdFromOutputId(Object.keys(nftOutputs)[0]); + output.nftId = Utils.computeNftId(Object.keys(nftOutputs)[0]); } - const inputs = Object.keys(nftOutputs).map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment(Object.values(nftOutputs)); - const essence = packEssence(inputs, inputsCommitment, [output], this.wallet, params); - - await setConsumedOutputIds(sourceAddress.bech32, [], Object.keys(nftOutputs)); - return await submitBlock( + const inputs = Object.keys(nftOutputs).map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment(Object.values(nftOutputs)); + const essence = await packEssence( this.wallet, - packPayload(essence, [createUnlock(essence, sourceAddress.keyPair)]), + inputs, + inputsCommitment, + [await this.client.buildNftOutput(output)], + params, ); + + await setConsumedOutputIds(sourceAddress.bech32, [], Object.keys(nftOutputs)); + return await submitBlock(this.wallet, essence, [await createUnlock(essence, sourceAddress)]); }; public lockCollection = async (transaction: Transaction, params: WalletParams) => { @@ -717,32 +692,33 @@ export class NftWallet { ); const [aliasOutputId, aliasOutput] = Object.entries(aliasOutputs)[0]; - const nextAliasOutput = cloneDeep(aliasOutput); - nextAliasOutput.stateIndex++; + const nextAliasOutput: AliasOutputBuilderParams = cloneDeep(aliasOutput); + nextAliasOutput.stateIndex!++; - const aliasAddress = getAliasBech32Address(aliasOutput.aliasId, this.wallet.info); + const aliasAddress = Utils.aliasIdToBech32( + aliasOutput.aliasId, + this.wallet.info.protocol.bech32Hrp, + ); const collectionOutputs = await this.getNftOutputs( undefined, aliasAddress, sourceMnemonic.consumedNftOutputIds, ); const [collectionOutputId, collectionOutput] = Object.entries(collectionOutputs)[0]; - const nextCollectionOutput = cloneDeep(collectionOutput); - nextCollectionOutput.unlockConditions = [ - { type: ADDRESS_UNLOCK_CONDITION_TYPE, address: ZERO_ADDRESS }, - ]; - - const inputs = [aliasOutputId, collectionOutputId].map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment([aliasOutput, collectionOutput]); - const outputs = [nextAliasOutput, nextCollectionOutput]; - const essence = packEssence(inputs, inputsCommitment, outputs, this.wallet, params); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, sourceAddress.keyPair), - { type: ALIAS_UNLOCK_TYPE, reference: 0 }, + const nextCollectionOutput: NftOutputBuilderParams = cloneDeep(collectionOutput); + nextCollectionOutput.unlockConditions = [new AddressUnlockCondition(ZERO_ADDRESS)]; + + const inputs = [aliasOutputId, collectionOutputId].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([aliasOutput, collectionOutput]); + const outputs = [ + await this.client.buildAliasOutput(nextAliasOutput), + await this.client.buildNftOutput(nextCollectionOutput), ]; + const essence = await packEssence(this.wallet, inputs, inputsCommitment, outputs, params); + const unlocks: Unlock[] = [await createUnlock(essence, sourceAddress), new AliasUnlock(0)]; await setConsumedOutputIds(sourceAddress.bech32, [], [collectionOutputId], [aliasOutputId]); - return await submitBlock(this.wallet, packPayload(essence, unlocks)); + return await submitBlock(this.wallet, essence, unlocks); }; public getNftOutputs = async ( @@ -751,19 +727,18 @@ export class NftWallet { prevConsumedNftOutputId: string[] = [], ) => { const outputIds = await this.getNftOutputIds(nftId, sourceAddress, prevConsumedNftOutputId); - const outputs: { [key: string]: INftOutput } = {}; - for (const id of outputIds) { - const output = (await this.wallet.client.output(id)).output; - outputs[id] = output as INftOutput; - } - return outputs; + const outputs = await this.client.getOutputs(outputIds); + + return outputs.reduce( + (acc, act, i) => ({ ...acc, [outputIds[i]]: act.output as NftOutput }), + {} as { [key: string]: NftOutput }, + ); }; public getById = async (nftId: string) => { - const indexer = new IndexerPluginClient(this.wallet.client); - const indexerResponse = await indexer.nft(nftId); - const outputResponse = await this.wallet.client.output(indexerResponse.items[0]); - return outputResponse.output as INftOutput; + const nftOutputId = await this.client.nftOutputId(nftId); + const outputResponse = await this.wallet.client.getOutput(nftOutputId); + return outputResponse.output as NftOutput; }; private getNftOutputIds = async ( @@ -771,14 +746,13 @@ export class NftWallet { sourceAddress: string | undefined, prevConsumedNftOutputId: string[] = [], ) => { - const indexer = new IndexerPluginClient(this.wallet.client); if (!isEmpty(prevConsumedNftOutputId)) { return prevConsumedNftOutputId; } if (nftId) { - return (await indexer.nft(nftId)).items; + return [await this.client.nftOutputId(nftId)]; } - const items = (await indexer.nfts({ addressBech32: sourceAddress })).items; + const items = (await this.client.nftOutputIds([{ address: sourceAddress! }])).items; return isEmpty(items) ? [] : [items[0]]; }; } diff --git a/packages/functions/src/services/wallet/wallet.service.ts b/packages/functions/src/services/wallet/wallet.service.ts index 6e564ea25a..e09e36ea19 100644 --- a/packages/functions/src/services/wallet/wallet.service.ts +++ b/packages/functions/src/services/wallet/wallet.service.ts @@ -1,5 +1,5 @@ import { COL, DEFAULT_NETWORK, NativeToken, Network } from '@build-5/interfaces'; -import { SingleNodeClient } from '@iota/iota.js-next'; +import { Client } from '@iota/sdk'; import * as functions from 'firebase-functions/v2'; import { build5Db } from '../../firebase/firestore/build5Db'; import { getRandomElement } from '../../utils/common.utils'; @@ -7,14 +7,8 @@ import { IotaWallet } from './IotaWalletService'; import { SmrWallet } from './SmrWalletService'; import { Wallet } from './wallet'; -export interface IKeyPair { - publicKey: Uint8Array; - privateKey: Uint8Array; -} - export interface AddressDetails { bech32: string; - keyPair: IKeyPair; hex: string; mnemonic: string; } @@ -43,10 +37,10 @@ const getClient = async (network: Network) => { for (let i = 0; i < 5; ++i) { nodeUrl = getRandomElement(NODES[network]); try { - const client = new SingleNodeClient(nodeUrl); - const healty = await client.health(); - if (healty) { - return { client, info: await client.info() }; + const client = new Client({ nodes: [nodeUrl] }); + const info = await client.getInfo(); + if (info.nodeInfo.status.isHealthy) { + return { client, info: info.nodeInfo }; } } catch (error) { functions.logger.warn(`Could not connect to client ${network}`, nodeUrl, error); diff --git a/packages/functions/src/services/wallet/wallet.ts b/packages/functions/src/services/wallet/wallet.ts index 7786b75f88..84cc0f8fda 100644 --- a/packages/functions/src/services/wallet/wallet.ts +++ b/packages/functions/src/services/wallet/wallet.ts @@ -1,13 +1,5 @@ import { NativeToken, Network, Timestamp, Transaction } from '@build-5/interfaces'; -import { - IAliasOutput, - IBasicOutput, - IFoundryOutput, - INftOutput, - INodeInfo, - IOutputResponse, - SingleNodeClient, -} from '@iota/iota.js-next'; +import { AliasOutput, BasicOutput, Client, FoundryOutput, INodeInfo, NftOutput } from '@iota/sdk'; import { Expiration } from './IotaWalletService'; import { AddressDetails, SendToManyTargets } from './wallet.service'; @@ -23,7 +15,9 @@ export interface WalletParams { } export abstract class Wallet { - public abstract getBalance: (addressBech32: string) => Promise; + public abstract getBalance: ( + addressBech32: string, + ) => Promise<{ amount: number; nativeTokens: { [id: string]: bigint } }>; public abstract getNewIotaAddressDetails: (saveMnemonic?: boolean) => Promise; public abstract getIotaAddressDetails: (mnemonic: string) => Promise; public abstract getAddressDetails: (bech32: string) => Promise; @@ -40,7 +34,7 @@ export abstract class Wallet { params: WalletParams, ) => Promise; public abstract bechAddressFromOutput: ( - output: IBasicOutput | IAliasOutput | IFoundryOutput | INftOutput, + output: BasicOutput | AliasOutput | FoundryOutput | NftOutput, ) => string; public abstract getOutputs: ( addressBech32: string, @@ -48,16 +42,12 @@ export abstract class Wallet { hasStorageDepositReturn?: boolean, hasTimelock?: boolean, ) => Promise<{ - [key: string]: IBasicOutput; + [key: string]: BasicOutput; }>; public abstract creditLocked: (credit: Transaction, params: WalletParams) => Promise; - public abstract getTransactionOutput: ( - transactionId: string, - outputIndex: number, - ) => Promise; constructor( - public readonly client: SingleNodeClient, + public readonly client: Client, public readonly info: INodeInfo, public readonly network: Network, ) {} diff --git a/packages/functions/src/triggers/award.trigger.ts b/packages/functions/src/triggers/award.trigger.ts index 5e6d9f6914..b3aa6826e1 100644 --- a/packages/functions/src/triggers/award.trigger.ts +++ b/packages/functions/src/triggers/award.trigger.ts @@ -102,7 +102,7 @@ export const awardUpdateTrigger = functions.firestore.onDocumentUpdated( ? [ { id: curr.badge.tokenId!, - amount: (remainingBadges * curr.badge.tokenReward).toString(), + amount: BigInt(remainingBadges * curr.badge.tokenReward), }, ] : [], diff --git a/packages/functions/src/triggers/milestone-transactions-triggers/MilestoneTransactionAdapter.ts b/packages/functions/src/triggers/milestone-transactions-triggers/MilestoneTransactionAdapter.ts index aabfd550d7..bbe7e2ce1d 100644 --- a/packages/functions/src/triggers/milestone-transactions-triggers/MilestoneTransactionAdapter.ts +++ b/packages/functions/src/triggers/milestone-transactions-triggers/MilestoneTransactionAdapter.ts @@ -5,26 +5,21 @@ import { Timestamp, } from '@build-5/interfaces'; import { - BASIC_OUTPUT_TYPE, - Bech32Helper, - ED25519_ADDRESS_TYPE, - Ed25519Address, - IBasicOutput, - INftOutput, - ISignatureUnlock, - ITransactionPayload, - NFT_OUTPUT_TYPE, - SIGNATURE_UNLOCK_TYPE, - TransactionHelper, -} from '@iota/iota.js-next'; -import { Converter, HexHelper } from '@iota/util.js-next'; + BasicOutput, + NftOutput, + OutputType, + RegularTransactionEssence, + SignatureUnlock, + TransactionPayload, + UTXOInput, + UnlockType, + Utils, +} from '@iota/sdk'; import { WalletService } from '../../services/wallet/wallet.service'; -import { indexToString } from '../../utils/block.utils'; -import { getTransactionPayloadHex } from '../../utils/smr.utils'; import { getMilestoneTransactionId } from './common'; -const VALID_OUTPUTS_TYPES = [BASIC_OUTPUT_TYPE, NFT_OUTPUT_TYPE]; -type VALID_OUTPUT = IBasicOutput | INftOutput; +const VALID_OUTPUTS_TYPES = [OutputType.Basic, OutputType.Nft]; +type VALID_OUTPUT = BasicOutput | NftOutput; export class MilestoneTransactionAdapter { constructor(private readonly network: Network) {} @@ -33,8 +28,9 @@ export class MilestoneTransactionAdapter { data: Record, ): Promise => { const wallet = await WalletService.newWallet(this.network); - const payload = data.payload as ITransactionPayload; - const outputs = payload.essence.outputs + const payload = data.payload as TransactionPayload; + const essence = payload.essence as RegularTransactionEssence; + const outputs = essence.outputs .filter((o) => VALID_OUTPUTS_TYPES.includes(o.type)) .map((o) => o); @@ -50,26 +46,21 @@ export class MilestoneTransactionAdapter { address, nativeTokens: output.nativeTokens || [], unlockConditions: output.unlockConditions, - outputId: getTransactionPayloadHex(payload) + indexToString(i), + outputId: Utils.computeOutputId(Utils.transactionId(payload), i), }; - if (output.type === NFT_OUTPUT_TYPE) { + if (output.type === OutputType.Nft) { entry.nftOutput = output; - } else if (output.type === BASIC_OUTPUT_TYPE) { + } else if (output.type === OutputType.Basic) { entry.output = output; } entries.push(entry); } const fromAddresses: string[] = []; - const unlocks = payload.unlocks.filter((u) => u.type === SIGNATURE_UNLOCK_TYPE); - for (const signatureUnlock of unlocks) { - const senderPublicKey = (signatureUnlock).signature.publicKey; - const pubKeyBytes = Converter.hexToBytes(HexHelper.stripPrefix(senderPublicKey)); - const walletEd25519Address = new Ed25519Address(pubKeyBytes); - const walletAddress = walletEd25519Address.toAddress(); - const senderBech32 = Bech32Helper.toBech32( - ED25519_ADDRESS_TYPE, - walletAddress, + const unlocks = payload.unlocks.filter((u) => u.type === UnlockType.Signature); + for (const unlock of unlocks) { + const senderBech32 = Utils.hexPublicKeyToBech32Address( + (unlock).signature.publicKey, wallet.info.protocol.bech32Hrp, ); fromAddresses.push(senderBech32); @@ -77,12 +68,10 @@ export class MilestoneTransactionAdapter { const build5TransactionId = await getMilestoneTransactionId(data); - const consumedOutputIds = payload.essence.inputs.map((input) => - TransactionHelper.outputIdFromTransactionData( - input.transactionId, - input.transactionOutputIndex, - ), - ); + const consumedOutputIds = essence.inputs.map((i) => { + const { transactionId, transactionOutputIndex } = i as UTXOInput; + return Utils.computeOutputId(transactionId, transactionOutputIndex); + }); return { uid: data.uid as string, diff --git a/packages/functions/src/triggers/milestone-transactions-triggers/common.ts b/packages/functions/src/triggers/milestone-transactions-triggers/common.ts index 52249d7d9a..9b6aaec890 100644 --- a/packages/functions/src/triggers/milestone-transactions-triggers/common.ts +++ b/packages/functions/src/triggers/milestone-transactions-triggers/common.ts @@ -1,6 +1,10 @@ import { COL, Transaction, WEN_FUNC_TRIGGER } from '@build-5/interfaces'; -import { ITransactionPayload } from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; +import { + RegularTransactionEssence, + TaggedDataPayload, + TransactionPayload, + hexToUtf8, +} from '@iota/sdk'; import dayjs from 'dayjs'; import { DocumentOptions } from 'firebase-functions/v2/firestore'; import { isEmpty } from 'lodash'; @@ -52,9 +56,10 @@ export const unclockMnemonic = async (address: string | undefined) => { export const getMilestoneTransactionId = async (milestoneTransaction: Record) => { try { - const payload = milestoneTransaction.payload; - const hexData = payload.essence?.payload?.data || ''; - const metadata = JSON.parse(Converter.hexToUtf8(hexData)); + const payload = milestoneTransaction.payload; + const essence = payload.essence as RegularTransactionEssence; + const hexData = (essence?.payload as TaggedDataPayload)?.data || ''; + const metadata = JSON.parse(hexToUtf8(hexData)); return (metadata.tranId || '') as string; } catch (e) { return ''; diff --git a/packages/functions/src/triggers/milestone-transactions-triggers/token.foundry.ts b/packages/functions/src/triggers/milestone-transactions-triggers/token.foundry.ts index 3f6a80f1e1..8db4454e6c 100644 --- a/packages/functions/src/triggers/milestone-transactions-triggers/token.foundry.ts +++ b/packages/functions/src/triggers/milestone-transactions-triggers/token.foundry.ts @@ -1,23 +1,26 @@ import { COL } from '@build-5/interfaces'; import { - FOUNDRY_OUTPUT_TYPE, - IAddressUnlockCondition, - IAliasAddress, - IFoundryOutput, - IMMUTABLE_ALIAS_UNLOCK_CONDITION_TYPE, - ITransactionPayload, - OutputTypes, - TransactionHelper, -} from '@iota/iota.js-next'; + AddressUnlockCondition, + AliasAddress, + FoundryOutput, + OutputType, + RegularTransactionEssence, + SimpleTokenScheme, + TransactionPayload, + UnlockConditionType, + Utils, +} from '@iota/sdk'; import { build5Db } from '../../firebase/firestore/build5Db'; import { getTokenByMintId } from '../../utils/token.utils'; export const updateTokenSupplyData = async (data: Record) => { - const foundryOutputs = ((data.payload as ITransactionPayload).essence.outputs as OutputTypes[]) - .filter((o) => o.type === FOUNDRY_OUTPUT_TYPE) - .map((o) => o); + const foundryOutputs = ( + (data.payload as TransactionPayload).essence as RegularTransactionEssence + ).outputs + .filter((o) => o.type === OutputType.Foundry) + .map((o) => o); for (const foundryOutput of foundryOutputs) { - const tokenId = TransactionHelper.constructTokenId( + const tokenId = Utils.computeFoundryId( getAliasAddress(foundryOutput), foundryOutput.serialNumber, foundryOutput.tokenScheme.type, @@ -26,8 +29,9 @@ export const updateTokenSupplyData = async (data: Record) => { if (!token) { continue; } - const meltedTokens = Number(foundryOutput.tokenScheme.meltedTokens); - const totalSupply = Number(foundryOutput.tokenScheme.maximumSupply); + const tokenScheme = foundryOutput.tokenScheme as SimpleTokenScheme; + const meltedTokens = Number(tokenScheme.meltedTokens); + const totalSupply = Number(tokenScheme.maximumSupply); const tokendDocRef = build5Db().doc(`${COL.TOKEN}/${token.uid}`); await tokendDocRef.update({ 'mintingData.meltedTokens': meltedTokens, @@ -36,9 +40,9 @@ export const updateTokenSupplyData = async (data: Record) => { } }; -const getAliasAddress = (output: IFoundryOutput) => { - const aliasUnlock = ( - output.unlockConditions.find((uc) => uc.type === IMMUTABLE_ALIAS_UNLOCK_CONDITION_TYPE)! +const getAliasAddress = (output: FoundryOutput) => { + const aliasUnlock = ( + output.unlockConditions.find((uc) => uc.type === UnlockConditionType.ImmutableAliasAddress)! ); - return (aliasUnlock.address).aliasId; + return (aliasUnlock.address).aliasId; }; diff --git a/packages/functions/src/triggers/token-trading/match-base-token.ts b/packages/functions/src/triggers/token-trading/match-base-token.ts index 19493a2d61..1f90e5da3b 100644 --- a/packages/functions/src/triggers/token-trading/match-base-token.ts +++ b/packages/functions/src/triggers/token-trading/match-base-token.ts @@ -1,5 +1,3 @@ -import { INodeInfo } from '@iota/iota.js-next'; - import { COL, Entity, @@ -18,6 +16,7 @@ import bigDecimal from 'js-big-decimal'; import { isEmpty } from 'lodash'; import { build5Db } from '../../firebase/firestore/build5Db'; import { ITransaction } from '../../firebase/firestore/interfaces'; +import { Wallet } from '../../services/wallet/wallet'; import { WalletService } from '../../services/wallet/wallet.service'; import { getAddress } from '../../utils/address.utils'; import { packBasicOutput } from '../../utils/basic-output.utils'; @@ -95,18 +94,20 @@ const createIotaPayments = async ( }; const createRoyaltyPayment = async ( + wallet: Wallet, token: Token, buy: TokenTradeOrder, buyOrder: Transaction, seller: Member, spaceId: string, fee: number, - info: INodeInfo, ) => { const space = (await build5Db().doc(`${COL.SPACE}/${spaceId}`).get())!; const spaceAddress = getAddress(space, buy.sourceNetwork!); const sellerAddress = getAddress(seller, buy.sourceNetwork!); - const output = packBasicOutput(spaceAddress, 0, undefined, info, sellerAddress); + const output = await packBasicOutput(wallet, spaceAddress, 0, { + storageDepositReturnAddress: sellerAddress, + }); return { type: TransactionType.BILL_PAYMENT, uid: getRandomEthAddress(), @@ -159,7 +160,7 @@ const createSmrPayments = async ( } const royaltyFees = await getRoyaltyFees(salePrice, seller.tokenTradingFeePercentage); - const remainder = packBasicOutput(tmpAddress.bech32, balanceLeft, undefined, wallet.info); + const remainder = await packBasicOutput(wallet, tmpAddress.bech32, balanceLeft, {}); if (balanceLeft > 0 && balanceLeft < Number(remainder.amount)) { if (!fulfilled) { return []; @@ -171,15 +172,13 @@ const createSmrPayments = async ( const royaltyPaymentPromises = Object.entries(royaltyFees) .filter((entry) => entry[1] > 0) - .map(([space, fee]) => - createRoyaltyPayment(token, buy, buyOrder!, seller, space, fee, wallet.info), - ); + .map(([space, fee]) => createRoyaltyPayment(wallet, token, buy, buyOrder!, seller, space, fee)); const royaltyPayments = await Promise.all(royaltyPaymentPromises); royaltyPayments.forEach((rp) => { salePrice -= rp.payload.amount!; }); - const billPaymentOutput = packBasicOutput(tmpAddress.bech32, salePrice, undefined, wallet.info); + const billPaymentOutput = await packBasicOutput(wallet, tmpAddress.bech32, salePrice, {}); if (salePrice < Number(billPaymentOutput.amount)) { return []; } diff --git a/packages/functions/src/triggers/token-trading/match-minted-token.ts b/packages/functions/src/triggers/token-trading/match-minted-token.ts index 91ac499caf..40d4147999 100644 --- a/packages/functions/src/triggers/token-trading/match-minted-token.ts +++ b/packages/functions/src/triggers/token-trading/match-minted-token.ts @@ -11,12 +11,11 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { INodeInfo } from '@iota/iota.js-next'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import bigDecimal from 'js-big-decimal'; import { build5Db } from '../../firebase/firestore/build5Db'; import { ITransaction } from '../../firebase/firestore/interfaces'; +import { Wallet } from '../../services/wallet/wallet'; import { WalletService } from '../../services/wallet/wallet.service'; import { getAddress } from '../../utils/address.utils'; import { packBasicOutput } from '../../utils/basic-output.utils'; @@ -26,6 +25,7 @@ import { Match } from './match-token'; import { getMemberTier, getTokenTradingFee } from './token-trade-order.trigger'; const createRoyaltyBillPayments = async ( + wallet: Wallet, token: Token, buy: TokenTradeOrder, seller: Member, @@ -33,7 +33,6 @@ const createRoyaltyBillPayments = async ( buyOrderTran: Transaction, sellPrice: number, dust: number, - info: INodeInfo, ) => { const royaltyFees = await getRoyaltyFees(sellPrice - dust, seller.tokenTradingFeePercentage); royaltyFees[Object.keys(royaltyFees)[0]] += dust; @@ -44,7 +43,9 @@ const createRoyaltyBillPayments = async ( const space = await build5Db().doc(`${COL.SPACE}/${spaceId}`).get(); const spaceAddress = getAddress(space, token.mintingData?.network!); const sellerAddress = getAddress(seller, token.mintingData?.network!); - const output = packBasicOutput(spaceAddress, 0, undefined, info, sellerAddress); + const output = await packBasicOutput(wallet, spaceAddress, 0, { + storageDepositReturnAddress: sellerAddress, + }); return { type: TransactionType.BILL_PAYMENT, uid: getRandomEthAddress(), @@ -76,17 +77,17 @@ const createRoyaltyBillPayments = async ( return await Promise.all(promises); }; -const createBillPaymentToSeller = ( +const createBillPaymentToSeller = async ( + wallet: Wallet, token: Token, buyer: Member, seller: Member, buyOrderTran: Transaction, buy: TokenTradeOrder, salePrice: number, - info: INodeInfo, ) => { const sellerAddress = getAddress(seller, token.mintingData?.network!); - const output = packBasicOutput(sellerAddress, salePrice, undefined, info); + const output = await packBasicOutput(wallet, sellerAddress, salePrice, {}); return { type: TransactionType.BILL_PAYMENT, uid: getRandomEthAddress(), @@ -111,7 +112,8 @@ const createBillPaymentToSeller = ( }; }; -const createBillPaymentWithNativeTokens = ( +const createBillPaymentWithNativeTokens = async ( + wallet: Wallet, token: Token, buyer: Member, seller: Member, @@ -120,17 +122,13 @@ const createBillPaymentWithNativeTokens = ( buy: TokenTradeOrder, sell: TokenTradeOrder, tokensToSell: number, - info: INodeInfo, -): Transaction => { +): Promise => { const sellerAddress = getAddress(seller, token.mintingData?.network!); const buyerAddress = getAddress(buyer, token.mintingData?.network!); - const output = packBasicOutput( - buyerAddress, - 0, - [{ id: token.mintingData?.tokenId!, amount: HexHelper.fromBigInt256(bigInt(tokensToSell)) }], - info, - sellerAddress, - ); + const output = await packBasicOutput(wallet, buyerAddress, 0, { + nativeTokens: [{ id: token.mintingData?.tokenId!, amount: BigInt(tokensToSell) }], + storageDepositReturnAddress: sellerAddress, + }); return { type: TransactionType.BILL_PAYMENT, uid: getRandomEthAddress(), @@ -140,7 +138,7 @@ const createBillPaymentWithNativeTokens = ( payload: { type: TransactionPayloadType.MINTED_TOKEN_TRADE, amount: Number(output.amount), - nativeTokens: [{ id: token.mintingData?.tokenId!, amount: tokensToSell.toString() }], + nativeTokens: [{ id: token.mintingData?.tokenId!, amount: BigInt(tokensToSell) }], sourceAddress: sellOrderTran.payload.targetAddress, storageDepositSourceAddress: buyOrderTran.payload.targetAddress, storageReturn: { @@ -256,7 +254,7 @@ export const matchMintedToken = async ( } const buyerAddress = getAddress(buyer, token.mintingData?.network!); - const remainder = packBasicOutput(buyerAddress, balanceLeft, undefined, wallet.info); + const remainder = await packBasicOutput(wallet, buyerAddress, balanceLeft, {}); let dust = 0; if (balanceLeft > 0 && balanceLeft < Number(remainder.amount)) { if (!buyIsFulfilled) { @@ -268,6 +266,7 @@ export const matchMintedToken = async ( } const royaltyBillPayments = await createRoyaltyBillPayments( + wallet, token, buy, seller, @@ -275,13 +274,13 @@ export const matchMintedToken = async ( buyOrderTran, salePrice, dust, - wallet.info, ); royaltyBillPayments.forEach((o) => { salePrice -= o.payload.amount!; }); - const billPaymentWithNativeTokens = createBillPaymentWithNativeTokens( + const billPaymentWithNativeTokens = await createBillPaymentWithNativeTokens( + wallet, token, buyer, seller, @@ -290,18 +289,17 @@ export const matchMintedToken = async ( buy, sell, tokensToTrade, - wallet.info, ); salePrice -= billPaymentWithNativeTokens.payload.amount!; - const billPaymentToSeller = createBillPaymentToSeller( + const billPaymentToSeller = await createBillPaymentToSeller( + wallet, token, buyer, seller, buyOrderTran, buy, salePrice, - wallet.info, ); salePrice -= billPaymentToSeller.payload.amount!; diff --git a/packages/functions/src/triggers/token.trigger.ts b/packages/functions/src/triggers/token.trigger.ts index d4bb5154ee..a2b6a8d105 100644 --- a/packages/functions/src/triggers/token.trigger.ts +++ b/packages/functions/src/triggers/token.trigger.ts @@ -450,7 +450,7 @@ const onTokenVaultEmptied = async (token: Token) => { payload: { type: TransactionPayloadType.TOKEN_VAULT_EMPTIED, dependsOnBillPayment: true, - amount: vaultBalance, + amount: Number(vaultBalance), sourceAddress: token.mintingData?.vaultAddress!, targetAddress: getAddress(minter, token.mintingData?.network!), sourceTransaction: paymentsSnap.map((p) => p.uid), diff --git a/packages/functions/src/triggers/transaction-trigger/airdrop.claim.ts b/packages/functions/src/triggers/transaction-trigger/airdrop.claim.ts index 4d029f2836..640c3c8f1b 100644 --- a/packages/functions/src/triggers/transaction-trigger/airdrop.claim.ts +++ b/packages/functions/src/triggers/transaction-trigger/airdrop.claim.ts @@ -47,7 +47,7 @@ const onPreMintedAirdropClaim = async (order: Transaction, token: Token) => { order, token, true, - )((transaction, airdrop) => { + )(async (transaction, airdrop) => { const airdropDocRef = build5Db().doc(`${COL.AIRDROP}/${airdrop.uid}`); const billPayment: Transaction = { @@ -112,10 +112,17 @@ const onMintedAirdropClaim = async (order: Transaction, token: Token) => { storageDepositUsed += await runInAirdropLoop( order, token, - )((transaction, airdrop) => { + )(async (transaction, airdrop) => { const airdropDocRef = build5Db().doc(`${COL.AIRDROP}/${airdrop.uid}`); - const billPayment = mintedDropToBillPayment(order, paymentsId, token, airdrop, member, wallet); + const billPayment = await mintedDropToBillPayment( + order, + paymentsId, + token, + airdrop, + member, + wallet, + ); const billPaymentDocRef = build5Db().doc(`${COL.TRANSACTION}/${billPayment.uid}`); transaction.create(billPaymentDocRef, billPayment); @@ -205,7 +212,7 @@ const claimOwnedMintedTokens = ( status: TokenDropStatus.UNCLAIMED, }; - const billPayment = mintedDropToBillPayment( + const billPayment = await mintedDropToBillPayment( order, sourceTransaction, token, @@ -228,17 +235,17 @@ const claimOwnedMintedTokens = ( return billPayment.payload.amount!; }); -const mintedDropToBillPayment = ( +const mintedDropToBillPayment = async ( order: Transaction, sourceTransaction: string[], token: Token, drop: TokenDrop, member: Member, wallet: Wallet, -): Transaction => { +): Promise => { const memberAddress = getAddress(member, token.mintingData?.network!); - const output = dropToOutput(token, drop, memberAddress, wallet.info); - const nativeTokens = [{ id: head(output.nativeTokens)?.id!, amount: drop.count.toString() }]; + const output = await dropToOutput(wallet, token, drop, memberAddress); + const nativeTokens = [{ id: head(output.nativeTokens)?.id!, amount: BigInt(drop.count) }]; return { type: TransactionType.BILL_PAYMENT, uid: getRandomEthAddress(), @@ -314,7 +321,7 @@ const airdropsQuery = ( const runInAirdropLoop = (order: Transaction, token: Token, isPreMintedClaim?: boolean) => - async (func: (transaction: ITransaction, airdrop: TokenDrop) => number) => { + async (func: (transaction: ITransaction, airdrop: TokenDrop) => Promise) => { let storageDeposit = 0; for (let i = 0; i < LOOP_SIZE; ++i) { const snap = await airdropsQuery( @@ -333,7 +340,7 @@ const runInAirdropLoop = (drop) => drop!.status === TokenDropStatus.UNCLAIMED, ); for (const airdrop of airdrops) { - actStorageDeposit += func(transaction, airdrop!); + actStorageDeposit += await func(transaction, airdrop!); } return actStorageDeposit; }); diff --git a/packages/functions/src/triggers/transaction-trigger/award.transaction.update.ts b/packages/functions/src/triggers/transaction-trigger/award.transaction.update.ts index 07ca3bbdf3..19bf843e76 100644 --- a/packages/functions/src/triggers/transaction-trigger/award.transaction.update.ts +++ b/packages/functions/src/triggers/transaction-trigger/award.transaction.update.ts @@ -1,8 +1,6 @@ import { COL, Transaction, TransactionPayloadType, TransactionType } from '@build-5/interfaces'; -import { ITransactionPayload, TransactionHelper } from '@iota/iota.js-next'; +import { TransactionPayload, Utils } from '@iota/sdk'; import { build5Db } from '../../firebase/firestore/build5Db'; -import { indexToString } from '../../utils/block.utils'; -import { getTransactionPayloadHex } from '../../utils/smr.utils'; import { getRandomEthAddress } from '../../utils/wallet.utils'; export const onAwardUpdate = async (transaction: Transaction) => { @@ -25,14 +23,15 @@ export const onAwardUpdate = async (transaction: Transaction) => { const onAliasMinted = async (transaction: Transaction) => { const path = transaction.payload.walletReference?.milestoneTransactionPath!; const milestoneTransaction = (await build5Db().doc(path).get>())!; - const aliasOutputId = - getTransactionPayloadHex(milestoneTransaction.payload as ITransactionPayload) + - indexToString(0); + const aliasOutputId = Utils.computeOutputId( + Utils.transactionId(milestoneTransaction.payload as TransactionPayload), + 0, + ); const awardDocRef = build5Db().doc(`${COL.AWARD}/${transaction.payload.award}`); await awardDocRef.update({ aliasBlockId: milestoneTransaction.blockId, - aliasId: TransactionHelper.resolveIdFromOutputId(aliasOutputId), + aliasId: Utils.computeAliasId(aliasOutputId), }); const order = { @@ -53,15 +52,16 @@ const onAliasMinted = async (transaction: Transaction) => { const onCollectionMinted = async (transaction: Transaction) => { const path = transaction.payload.walletReference?.milestoneTransactionPath!; const milestoneTransaction = (await build5Db().doc(path).get>())!; - const collectionOutputId = - getTransactionPayloadHex(milestoneTransaction.payload as ITransactionPayload) + - indexToString(1); + const collectionOutputId = Utils.computeOutputId( + Utils.transactionId(milestoneTransaction.payload as TransactionPayload), + 1, + ); await build5Db() .doc(`${COL.AWARD}/${transaction.payload.award}`) .update({ collectionBlockId: milestoneTransaction.blockId, - collectionId: TransactionHelper.resolveIdFromOutputId(collectionOutputId), + collectionId: Utils.computeNftId(collectionOutputId), approved: true, rejected: false, }); diff --git a/packages/functions/src/triggers/transaction-trigger/collection-minting.ts b/packages/functions/src/triggers/transaction-trigger/collection-minting.ts index 43bbcb4b28..28d3d7084d 100644 --- a/packages/functions/src/triggers/transaction-trigger/collection-minting.ts +++ b/packages/functions/src/triggers/transaction-trigger/collection-minting.ts @@ -8,14 +8,12 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { ITransactionPayload, TransactionHelper } from '@iota/iota.js-next'; +import { TransactionPayload, Utils } from '@iota/sdk'; import dayjs from 'dayjs'; import * as functions from 'firebase-functions/v2'; import { get } from 'lodash'; import { build5Db } from '../../firebase/firestore/build5Db'; import { getAddress } from '../../utils/address.utils'; -import { indexToString } from '../../utils/block.utils'; -import { getTransactionPayloadHex } from '../../utils/smr.utils'; import { getRandomEthAddress } from '../../utils/wallet.utils'; export const onCollectionMintingUpdate = async (transaction: Transaction) => { @@ -51,14 +49,15 @@ const onCollectionAliasMinted = async (transaction: Transaction) => { const path = transaction.payload.walletReference?.milestoneTransactionPath!; const milestoneTransaction = (await build5Db().doc(path).get>())!; - const aliasOutputId = - getTransactionPayloadHex(milestoneTransaction.payload as ITransactionPayload) + - indexToString(0); + const aliasOutputId = Utils.computeOutputId( + Utils.transactionId(milestoneTransaction.payload as TransactionPayload), + 0, + ); await build5Db() .doc(`${COL.COLLECTION}/${transaction.payload.collection}`) .update({ 'mintingData.aliasBlockId': milestoneTransaction.blockId, - 'mintingData.aliasId': TransactionHelper.resolveIdFromOutputId(aliasOutputId), + 'mintingData.aliasId': Utils.computeAliasId(aliasOutputId), 'mintingData.aliasStorageDeposit': transaction.payload.amount, }); @@ -81,9 +80,10 @@ const onCollectionAliasMinted = async (transaction: Transaction) => { const onCollectionMinted = async (transaction: Transaction) => { const path = transaction.payload.walletReference?.milestoneTransactionPath!; const milestoneTransaction = (await build5Db().doc(path).get>())!; - const collectionOutputId = - getTransactionPayloadHex(milestoneTransaction.payload as ITransactionPayload) + - indexToString(1); + const collectionOutputId = Utils.computeOutputId( + Utils.transactionId(milestoneTransaction.payload as TransactionPayload), + 1, + ); const collectionDocRef = build5Db().doc(`${COL.COLLECTION}/${transaction.payload.collection}`); const collection = (await collectionDocRef.get())!; await saveCollectionMintingData( @@ -106,7 +106,7 @@ const saveCollectionMintingData = ( .doc(`${COL.COLLECTION}/${transaction.payload.collection}`) .update({ 'mintingData.blockId': blockId, - 'mintingData.nftId': TransactionHelper.resolveIdFromOutputId(collectionOutputId), + 'mintingData.nftId': Utils.computeNftId(collectionOutputId), 'mintingData.mintedOn': dayjs().toDate(), }); @@ -122,9 +122,10 @@ const onNftMintSuccess = async (transaction: Transaction) => { .doc(transaction.payload.walletReference?.milestoneTransactionPath!) .get>())!; const promises = (transaction.payload.nfts as string[]).map((nftId, i) => { - const outputId = - getTransactionPayloadHex(milestoneTransaction.payload as ITransactionPayload) + - indexToString(i + 2); + const outputId = Utils.computeOutputId( + Utils.transactionId(milestoneTransaction.payload as TransactionPayload), + i + 2, + ); return build5Db() .doc(`${COL.NFT}/${nftId}`) .update({ @@ -132,7 +133,7 @@ const onNftMintSuccess = async (transaction: Transaction) => { 'mintingData.mintedOn': dayjs().toDate(), 'mintingData.mintedBy': transaction.member, 'mintingData.blockId': milestoneTransaction.blockId, - 'mintingData.nftId': TransactionHelper.resolveIdFromOutputId(outputId), + 'mintingData.nftId': Utils.computeNftId(outputId), status: NftStatus.MINTED, }); }); diff --git a/packages/functions/src/triggers/transaction-trigger/matadatNft-minting.ts b/packages/functions/src/triggers/transaction-trigger/matadatNft-minting.ts index 181b8eb990..7c2bbc553c 100644 --- a/packages/functions/src/triggers/transaction-trigger/matadatNft-minting.ts +++ b/packages/functions/src/triggers/transaction-trigger/matadatNft-minting.ts @@ -10,7 +10,7 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { ITransactionPayload, TransactionHelper } from '@iota/iota.js-next'; +import { TransactionPayload, Utils } from '@iota/sdk'; import dayjs from 'dayjs'; import { get } from 'lodash'; import { build5Db } from '../../firebase/firestore/build5Db'; @@ -22,9 +22,7 @@ import { } from '../../services/payment/metadataNft-service'; import { WalletService } from '../../services/wallet/wallet.service'; import { getAddress } from '../../utils/address.utils'; -import { indexToString } from '../../utils/block.utils'; import { dateToTimestamp } from '../../utils/dateTime.utils'; -import { getTransactionPayloadHex } from '../../utils/smr.utils'; import { getRandomEthAddress } from '../../utils/wallet.utils'; export const onMetadataNftMintUpdate = async (transaction: Transaction) => { @@ -51,10 +49,11 @@ export const onMetadataNftMintUpdate = async (transaction: Transaction) => { const onAliasMinted = async (transaction: Transaction) => { const path = transaction.payload.walletReference?.milestoneTransactionPath!; const milestoneTransaction = (await build5Db().doc(path).get>())!; - const aliasOutputId = - getTransactionPayloadHex(milestoneTransaction.payload as ITransactionPayload) + - indexToString(0); - const aliasId = TransactionHelper.resolveIdFromOutputId(aliasOutputId); + const aliasOutputId = Utils.computeOutputId( + Utils.transactionId(milestoneTransaction.payload as TransactionPayload), + 0, + ); + const aliasId = Utils.computeAliasId(aliasOutputId); const batch = build5Db().batch(); @@ -90,10 +89,11 @@ const onAliasMinted = async (transaction: Transaction) => { const onCollectionMinted = async (transaction: Transaction) => { const path = transaction.payload.walletReference?.milestoneTransactionPath!; const milestoneTransaction = (await build5Db().doc(path).get>())!; - const collectionOutputId = - getTransactionPayloadHex(milestoneTransaction.payload as ITransactionPayload) + - indexToString(1); - const collectionId = TransactionHelper.resolveIdFromOutputId(collectionOutputId); + const collectionOutputId = Utils.computeOutputId( + Utils.transactionId(milestoneTransaction.payload as TransactionPayload), + 1, + ); + const collectionId = Utils.computeNftId(collectionOutputId); const batch = build5Db().batch(); @@ -146,10 +146,11 @@ const onCollectionMinted = async (transaction: Transaction) => { const onNftMinted = async (transaction: Transaction) => { const path = transaction.payload.walletReference?.milestoneTransactionPath!; const milestoneTransaction = (await build5Db().doc(path).get>())!; - const nftOutputId = - getTransactionPayloadHex(milestoneTransaction.payload as ITransactionPayload) + - indexToString(2); - const nftId = TransactionHelper.resolveIdFromOutputId(nftOutputId); + const nftOutputId = Utils.computeOutputId( + Utils.transactionId(milestoneTransaction.payload as TransactionPayload), + 2, + ); + const nftId = Utils.computeNftId(nftOutputId); const batch = build5Db().batch(); @@ -233,7 +234,7 @@ const onNftUpdated = async (transaction: Transaction) => { network: order.network, payload: { type: TransactionPayloadType.MINT_METADATA_NFT, - amount: balance, + amount: Number(balance), sourceAddress: order.payload.targetAddress, targetAddress: getAddress(member, order.network || DEFAULT_NETWORK), reconciled: true, diff --git a/packages/functions/src/triggers/transaction-trigger/token-minting.ts b/packages/functions/src/triggers/transaction-trigger/token-minting.ts index 8eac6319dc..700410e4c3 100644 --- a/packages/functions/src/triggers/transaction-trigger/token-minting.ts +++ b/packages/functions/src/triggers/transaction-trigger/token-minting.ts @@ -8,21 +8,20 @@ import { TransactionType, } from '@build-5/interfaces'; import { - ALIAS_OUTPUT_TYPE, - FOUNDRY_OUTPUT_TYPE, - IAliasOutput, - IFoundryOutput, - ITransactionPayload, - OutputTypes, - TransactionHelper, -} from '@iota/iota.js-next'; + AliasOutput, + FoundryOutput, + OutputType, + RegularTransactionEssence, + SimpleTokenScheme, + TransactionPayload, + Utils, +} from '@iota/sdk'; import dayjs from 'dayjs'; import * as functions from 'firebase-functions/v2'; import { build5Db } from '../../firebase/firestore/build5Db'; import { getAddress } from '../../utils/address.utils'; -import { indexToString } from '../../utils/block.utils'; -import { getTransactionPayloadHex } from '../../utils/smr.utils'; import { getRandomEthAddress } from '../../utils/wallet.utils'; + export const onTokenMintingUpdate = async (transaction: Transaction) => { switch (transaction.payload.type) { case TransactionPayloadType.MINT_ALIAS: { @@ -48,14 +47,15 @@ const onAliasMinted = async (transaction: Transaction) => { const path = transaction.payload.walletReference?.milestoneTransactionPath!; const milestoneTransaction = (await build5Db().doc(path).get>())!; - const aliasOutputId = - getTransactionPayloadHex(milestoneTransaction.payload as ITransactionPayload) + - indexToString(0); + const aliasOutputId = Utils.computeOutputId( + Utils.transactionId(milestoneTransaction.payload as TransactionPayload), + 0, + ); await build5Db() .doc(`${COL.TOKEN}/${transaction.payload.token}`) .update({ 'mintingData.aliasBlockId': milestoneTransaction.blockId, - 'mintingData.aliasId': TransactionHelper.resolveIdFromOutputId(aliasOutputId), + 'mintingData.aliasId': Utils.computeAliasId(aliasOutputId), }); const token = await build5Db().doc(`${COL.TOKEN}/${transaction.payload.token}`).get(); @@ -82,24 +82,19 @@ const onFoundryMinted = async (transaction: Transaction) => { const path = transaction.payload.walletReference?.milestoneTransactionPath!; const milestoneTransaction = (await build5Db().doc(path).get>())!; - const aliasOutput = ( - ((milestoneTransaction.payload as ITransactionPayload).essence.outputs as OutputTypes[]).find( - (o) => o.type === ALIAS_OUTPUT_TYPE, - ) - ); - const foundryOutput = ( - ((milestoneTransaction.payload as ITransactionPayload).essence.outputs as OutputTypes[]).find( - (o) => o.type === FOUNDRY_OUTPUT_TYPE, - ) - ); - const foundryId = TransactionHelper.constructTokenId( + const payload = milestoneTransaction.payload as TransactionPayload; + const essence = payload.essence as RegularTransactionEssence; + const aliasOutput = essence.outputs.find((o) => o.type === OutputType.Alias); + const foundryOutput = essence.outputs.find((o) => o.type === OutputType.Foundry); + const foundryId = Utils.computeFoundryId( aliasOutput.aliasId, foundryOutput.serialNumber, foundryOutput.tokenScheme.type, ); - const meltedTokens = Number(foundryOutput.tokenScheme.meltedTokens); - const totalSupply = Number(foundryOutput.tokenScheme.maximumSupply); + const tokenScheme = foundryOutput.tokenScheme as SimpleTokenScheme; + const meltedTokens = Number(tokenScheme.meltedTokens); + const totalSupply = Number(tokenScheme.maximumSupply); await build5Db() .doc(`${COL.TOKEN}/${transaction.payload.token}`) diff --git a/packages/functions/src/triggers/transaction-trigger/wallet-params.ts b/packages/functions/src/triggers/transaction-trigger/wallet-params.ts index a904d6cf68..8ce514bb0e 100644 --- a/packages/functions/src/triggers/transaction-trigger/wallet-params.ts +++ b/packages/functions/src/triggers/transaction-trigger/wallet-params.ts @@ -6,8 +6,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import { build5Db } from '../../firebase/firestore/build5Db'; import { WalletParams } from '../../services/wallet/wallet'; import { isProdEnv } from '../../utils/config.utils'; @@ -16,7 +15,7 @@ export const getWalletParams = async (transaction: Transaction): Promise ({ id: nt.id, - amount: HexHelper.fromBigInt256(bigInt(Number(nt.amount))), + amount: BigInt(Number(nt.amount)), })), storageDepositSourceAddress: transaction.payload.storageDepositSourceAddress, vestingAt: transaction.payload.vestingAt, diff --git a/packages/functions/src/utils/basic-output.utils.ts b/packages/functions/src/utils/basic-output.utils.ts index 1faeb58ce8..5bf963f201 100644 --- a/packages/functions/src/utils/basic-output.utils.ts +++ b/packages/functions/src/utils/basic-output.utils.ts @@ -1,65 +1,58 @@ -import { Timestamp } from '@build-5/interfaces'; import { - ADDRESS_UNLOCK_CONDITION_TYPE, - BASIC_OUTPUT_TYPE, - Bech32Helper, - EXPIRATION_UNLOCK_CONDITION_TYPE, - FeatureTypes, - IBasicOutput, - ICommonOutput, - IMetadataFeature, - INativeToken, - INodeInfo, - ITagFeature, - ITimelockUnlockCondition, - METADATA_FEATURE_TYPE, - STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE, - TAG_FEATURE_TYPE, - TIMELOCK_UNLOCK_CONDITION_TYPE, - TransactionHelper, - UnlockConditionTypes, -} from '@iota/iota.js-next'; -import { Converter, HexHelper } from '@iota/util.js-next'; + AddressUnlockCondition, + BasicOutput, + BasicOutputBuilderParams, + CommonOutput, + ExpirationUnlockCondition, + Feature, + FeatureType, + MetadataFeature, + StorageDepositReturnUnlockCondition, + TagFeature, + TimelockUnlockCondition, + UnlockCondition, + UnlockConditionType, + Utils, + bigIntToHex, + hexToUtf8, + utf8ToHex, +} from '@iota/sdk'; import bigInt from 'big-integer'; import dayjs from 'dayjs'; import { cloneDeep, isEmpty } from 'lodash'; -import { Expiration } from '../services/wallet/IotaWalletService'; +import { Wallet, WalletParams } from '../services/wallet/wallet'; -export const hasNoTimeLock = (output: IBasicOutput) => { +export const hasNoTimeLock = (output: BasicOutput) => { const locks = output.unlockConditions.filter( - (u) => u.type === TIMELOCK_UNLOCK_CONDITION_TYPE, - ) as ITimelockUnlockCondition[]; + (u) => u.type === UnlockConditionType.Timelock, + ) as TimelockUnlockCondition[]; return locks.reduce((acc, act) => acc && dayjs().isAfter(dayjs.unix(act.unixTime)), true); }; -export const hasNativeToken = (output: IBasicOutput, token: string) => +export const hasNativeToken = (output: BasicOutput, token: string) => !isEmpty(output.nativeTokens?.filter((n) => n.id === token)); -export const hasNoReturnCondition = (output: IBasicOutput) => - output.unlockConditions.find((u) => u.type === STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE) === +export const hasNoReturnCondition = (output: BasicOutput) => + output.unlockConditions.find((u) => u.type === UnlockConditionType.StorageDepositReturn) === undefined; -export const nativeTokenCount = (output: IBasicOutput, token: string) => +export const nativeTokenCount = (output: BasicOutput, token: string) => output.nativeTokens?.reduce( - (acc, act) => (act.id === token ? acc + Number(HexHelper.toBigInt256(act.amount)) : acc), + (acc, act) => (act.id === token ? acc + Number(act.amount) : acc), 0, ) || 0; -export const nativeTokenCountTotal = (outputs: IBasicOutput[], token: string) => +export const nativeTokenCountTotal = (outputs: BasicOutput[], token: string) => outputs.reduce((acc, act) => acc + nativeTokenCount(act, token), 0) || 0; -const addHex = (a: string, b: string) => - HexHelper.fromBigInt256(HexHelper.toBigInt256(a).add(HexHelper.toBigInt256(b))); -export const subtractHex = (a: string, b: string) => - HexHelper.fromBigInt256(HexHelper.toBigInt256(a).subtract(HexHelper.toBigInt256(b))); +export const subtractHex = (a: string, b: string) => bigIntToHex(BigInt(a) - BigInt(b)); -export const mergeOutputs = (outputs: IBasicOutput[]) => { +export const mergeOutputs = (outputs: BasicOutput[]) => { const addressUnlock = outputs[0].unlockConditions.find( - (u) => u.type === ADDRESS_UNLOCK_CONDITION_TYPE, + (u) => u.type === UnlockConditionType.Address, )!; - const merged: IBasicOutput = { - type: BASIC_OUTPUT_TYPE, - amount: '0', + const merged: BasicOutputBuilderParams = { + amount: BigInt(0), unlockConditions: [addressUnlock], }; for (const output of outputs) { @@ -69,125 +62,114 @@ export const mergeOutputs = (outputs: IBasicOutput[]) => { if (index === -1) { nativeTokens.push(nativeToken); } else { - nativeTokens[index].amount = addHex(nativeTokens[index].amount, nativeToken.amount); + nativeTokens[index].amount = nativeTokens[index].amount + nativeToken.amount; } } - merged.amount = (Number(output.amount) + Number(merged.amount)).toString(); + merged.amount = BigInt(output.amount) + BigInt(merged.amount!); merged.nativeTokens = nativeTokens; } return merged; }; -export const packBasicOutput = ( +export const packBasicOutput = async ( + wallet: Wallet, toBech32: string, amount: number, - nativeTokens: INativeToken[] | undefined, - info: INodeInfo, - retrunAddressBech32?: string, - vestingAt?: Timestamp | null, - expiration?: Expiration, - metadata?: Record, - tag?: string, + { + storageDepositReturnAddress, + vestingAt, + expiration, + nativeTokens, + customMetadata, + tag, + }: WalletParams, ) => { - const targetAddress = Bech32Helper.addressFromBech32(toBech32, info.protocol.bech32Hrp); - const unlockConditions: UnlockConditionTypes[] = [ - { type: ADDRESS_UNLOCK_CONDITION_TYPE, address: targetAddress }, - ]; - if (retrunAddressBech32) { - const returnAddress = Bech32Helper.addressFromBech32( - retrunAddressBech32, - info.protocol.bech32Hrp, - ); - unlockConditions.push({ - type: STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE, - amount: '0', - returnAddress, - }); + const targetAddress = Utils.parseBech32Address(toBech32); + const unlockConditions: UnlockCondition[] = [new AddressUnlockCondition(targetAddress)]; + if (storageDepositReturnAddress) { + const returnAddress = Utils.parseBech32Address(storageDepositReturnAddress); + unlockConditions.push(new StorageDepositReturnUnlockCondition(returnAddress, '0')); } if (vestingAt) { - unlockConditions.push({ - type: TIMELOCK_UNLOCK_CONDITION_TYPE, - unixTime: dayjs(vestingAt.toDate()).unix(), - }); + unlockConditions.push(new TimelockUnlockCondition(dayjs(vestingAt.toDate()).unix())); } if (expiration) { - unlockConditions.push({ - type: EXPIRATION_UNLOCK_CONDITION_TYPE, - unixTime: dayjs(expiration.expiresAt.toDate()).unix(), - returnAddress: Bech32Helper.addressFromBech32( - expiration.returnAddressBech32, - info.protocol.bech32Hrp, + unlockConditions.push( + new ExpirationUnlockCondition( + Utils.parseBech32Address(expiration.returnAddressBech32), + dayjs(expiration.expiresAt.toDate()).unix(), ), - }); + ); } - const output: IBasicOutput = { - type: BASIC_OUTPUT_TYPE, - amount: '0', + const params: BasicOutputBuilderParams = { nativeTokens: nativeTokens?.map((nt) => ({ id: nt.id, - amount: HexHelper.fromBigInt256(bigInt(Number(nt.amount))), + amount: BigInt(nt.amount), })), unlockConditions, }; + if (amount) { + params.amount = BigInt(amount); + } - if (!isEmpty(metadata)) { - const data = Converter.utf8ToHex(JSON.stringify(metadata), true); - const metadataFeture = { type: METADATA_FEATURE_TYPE, data } as IMetadataFeature; - output.features = (output.features || []) as FeatureTypes[]; - output.features.push(metadataFeture); + if (!isEmpty(customMetadata)) { + const data = utf8ToHex(JSON.stringify(customMetadata)); + const metadataFeture = new MetadataFeature(data); + params.features = (params.features || []) as Feature[]; + params.features.push(metadataFeture); } if (tag) { - const tagFeature = { type: TAG_FEATURE_TYPE, tag } as ITagFeature; - output.features = (output.features || []) as FeatureTypes[]; - output.features.push(tagFeature); + const tagFeature = new TagFeature(tag); + params.features = (params.features || []) as Feature[]; + params.features.push(tagFeature); } - const storageDeposit = TransactionHelper.getStorageDeposit(output, info.protocol.rentStructure!); - output.amount = bigInt.max(bigInt(amount), storageDeposit).toString(); + const output = await wallet.client.buildBasicOutput(params); + const rent = (await wallet.client.getInfo()).nodeInfo.protocol.rentStructure; + const storageDeposit = Utils.computeStorageDeposit(output, rent); + params.amount = bigInt.max(bigInt(amount), storageDeposit).toString(); - if (retrunAddressBech32) { - output.unlockConditions = output.unlockConditions.map((u) => - u.type === STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE - ? { ...u, amount: storageDeposit.toString() } + if (storageDepositReturnAddress) { + const returnAddress = Utils.parseBech32Address(storageDepositReturnAddress); + params.unlockConditions = params.unlockConditions.map((u) => + u.type === UnlockConditionType.StorageDepositReturn + ? new StorageDepositReturnUnlockCondition(returnAddress, storageDeposit) : u, ); } - return output; + return await wallet.client.buildBasicOutput(params); }; -export const subtractNativeTokens = ( - output: IBasicOutput, +export const subtractNativeTokens = async ( + wallet: Wallet, + basicOutput: BasicOutput, amount: number, token: string, - info: INodeInfo, ) => { - const result = cloneDeep(output); - result.amount = '0'; - const total = nativeTokenCount(output, token); + const params: BasicOutputBuilderParams = cloneDeep(basicOutput); + params.amount = BigInt(0); + const total = nativeTokenCount(basicOutput, token); if (total < amount) { throw new Error(`Not enough native tokens, ${token}, ${total}`); } - result.nativeTokens = (result.nativeTokens || []) - .map((n) => - n.id === token - ? { ...n, amount: subtractHex(n.amount, HexHelper.fromBigInt256(bigInt(amount))) } - : n, - ) + params.nativeTokens = (params.nativeTokens || []) + .map((n) => (n.id === token ? { ...n, amount: n.amount - BigInt(amount) } : n)) .filter((n) => Number(n.amount) > 0); - result.amount = TransactionHelper.getStorageDeposit( - output, - info.protocol.rentStructure, - ).toString(); - return result; + + const output = await wallet.client.buildBasicOutput(params); + const rent = (await wallet.client.getInfo()).nodeInfo.protocol.rentStructure; + params.amount = Utils.computeStorageDeposit(output, rent); + + return params; }; -export const getOutputMetadata = (output: ICommonOutput | undefined) => { +export const getOutputMetadata = (output: CommonOutput | undefined) => { try { - const metadataFeature = ( - output?.features?.find((f) => f.type === METADATA_FEATURE_TYPE) + const metadataFeature = ( + output?.features?.find((f) => f.type === FeatureType.Metadata) ); - const decoded = Converter.hexToUtf8(metadataFeature?.data || '{}'); + const decoded = hexToUtf8(metadataFeature?.data || '{}'); const metadata = JSON.parse(decoded); return metadata || {}; } catch (e) { diff --git a/packages/functions/src/utils/bech32-address.helper.ts b/packages/functions/src/utils/bech32-address.helper.ts index b923eb39d0..55e8a012b5 100644 --- a/packages/functions/src/utils/bech32-address.helper.ts +++ b/packages/functions/src/utils/bech32-address.helper.ts @@ -1,107 +1,59 @@ import { - ADDRESS_UNLOCK_CONDITION_TYPE, - ALIAS_ADDRESS_TYPE, - ALIAS_OUTPUT_TYPE, - AddressTypes, - BASIC_OUTPUT_TYPE, - Bech32Helper, - ED25519_ADDRESS_TYPE, - FOUNDRY_OUTPUT_TYPE, - GOVERNOR_ADDRESS_UNLOCK_CONDITION_TYPE, - IAddressUnlockCondition, - IGovernorAddressUnlockCondition, - IImmutableAliasUnlockCondition, - IMMUTABLE_ALIAS_UNLOCK_CONDITION_TYPE, - IStateControllerAddressUnlockCondition, - NFT_ADDRESS_TYPE, - NFT_OUTPUT_TYPE, - STATE_CONTROLLER_ADDRESS_UNLOCK_CONDITION_TYPE, - UnlockConditionTypes, -} from '@iota/iota.js-next'; -import { Converter, HexHelper } from '@iota/util.js-next'; + Address, + AddressType, + AddressUnlockCondition, + AliasAddress, + BasicOutput, + Ed25519Address, + GovernorAddressUnlockCondition, + ImmutableAliasAddressUnlockCondition, + NftAddress, + OutputType, + StateControllerAddressUnlockCondition, + UnlockConditionType, + Utils, +} from '@iota/sdk'; export class Bech32AddressHelper { - public static addressFromAddressUnlockCondition = ( - unlockConditions: UnlockConditionTypes[], - hrp: string, - outputType: number, - ): string => { - const unlockCondition = Bech32AddressHelper.getUnlockConditionForType( - outputType, - unlockConditions, - ); + public static bech32FromUnlockConditions = (output: BasicOutput, hrp: string): string => { + const unlockCondition = Bech32AddressHelper.getUnlockCondition(output); if (unlockCondition?.address) { - return Bech32AddressHelper.buildAddress(hrp, unlockCondition?.address); + return Bech32AddressHelper.addressToBech32(unlockCondition?.address, hrp); } return ''; }; - public static buildAddress( - hrp: string, - address: string | AddressTypes, - typeHint?: number, - ): string { - return typeof address === 'string' - ? this.buildAddressFromString(hrp, address, typeHint) - : this.buildAddressFromTypes(hrp, address); - } - - private static getUnlockConditionForType = ( - outputType: number, - unlockConditions: UnlockConditionTypes[], - ) => { - if (outputType === BASIC_OUTPUT_TYPE || outputType === NFT_OUTPUT_TYPE) { - return unlockConditions.find( - (c) => c.type === ADDRESS_UNLOCK_CONDITION_TYPE, - ) as IAddressUnlockCondition; + private static getUnlockCondition = (output: BasicOutput) => { + if (output.type === OutputType.Basic || output.type === OutputType.Nft) { + return output.unlockConditions.find( + (c) => c.type === UnlockConditionType.Address, + ) as AddressUnlockCondition; } - if (outputType === ALIAS_OUTPUT_TYPE) { - const condition = unlockConditions.find( - (c) => c.type === STATE_CONTROLLER_ADDRESS_UNLOCK_CONDITION_TYPE, - ) as IStateControllerAddressUnlockCondition; - return ( - condition || - (unlockConditions.find( - (c) => c.type === GOVERNOR_ADDRESS_UNLOCK_CONDITION_TYPE, - ) as IGovernorAddressUnlockCondition) - ); + if (output.type === OutputType.Alias) { + const condition = output.unlockConditions.find( + (c) => c.type === UnlockConditionType.StateControllerAddress, + ) as StateControllerAddressUnlockCondition; + return (condition || + output.unlockConditions.find( + (c) => c.type === UnlockConditionType.GovernorAddress, + )) as GovernorAddressUnlockCondition; } - if (outputType === FOUNDRY_OUTPUT_TYPE) { - return unlockConditions.find( - (c) => c.type === IMMUTABLE_ALIAS_UNLOCK_CONDITION_TYPE, - ) as IImmutableAliasUnlockCondition; + if (output.type === OutputType.Foundry) { + return output.unlockConditions.find( + (c) => c.type === UnlockConditionType.ImmutableAliasAddress, + ) as ImmutableAliasAddressUnlockCondition; } return; }; - private static buildAddressFromString(hrp: string, address: string, typeHint?: number): string { - if (Bech32Helper.matches(address, hrp)) { - try { - const result = Bech32Helper.fromBech32(address, hrp); - if (result) { - return address; - } - // eslint-disable-next-line no-empty - } catch {} + public static addressToBech32(address: Address, hrp: string): string { + switch (address.type) { + case AddressType.Ed25519: + return Utils.hexToBech32((address as Ed25519Address).pubKeyHash, hrp); + case AddressType.Alias: + return Utils.aliasIdToBech32((address as AliasAddress).aliasId, hrp); + case AddressType.Nft: + return Utils.aliasIdToBech32((address as NftAddress).nftId, hrp); } - return Bech32Helper.toBech32( - typeHint ?? ED25519_ADDRESS_TYPE, - Converter.hexToBytes(address), - hrp, - ); - } - - private static buildAddressFromTypes(hrp: string, address: AddressTypes): string { - const getHex = () => { - switch (address.type) { - case ED25519_ADDRESS_TYPE: - return HexHelper.stripPrefix(address.pubKeyHash); - case ALIAS_ADDRESS_TYPE: - return HexHelper.stripPrefix(address.aliasId); - case NFT_ADDRESS_TYPE: - return HexHelper.stripPrefix(address.nftId); - } - }; - return this.buildAddressFromString(hrp, getHex(), address.type); } } diff --git a/packages/functions/src/utils/block.utils.ts b/packages/functions/src/utils/block.utils.ts index 604f4bac84..05a849911c 100644 --- a/packages/functions/src/utils/block.utils.ts +++ b/packages/functions/src/utils/block.utils.ts @@ -1,63 +1,58 @@ import { KEY_NAME_TANGLE } from '@build-5/interfaces'; import { - DEFAULT_PROTOCOL_VERSION, - IBlock, - ITransactionEssence, - ITransactionPayload, - IUTXOInput, - MAX_BLOCK_LENGTH, - OutputTypes, - TAGGED_DATA_PAYLOAD_TYPE, - TRANSACTION_ESSENCE_TYPE, - TRANSACTION_PAYLOAD_TYPE, - TransactionHelper, - UnlockTypes, - serializeBlock, -} from '@iota/iota.js-next'; -import { Converter, WriteStream } from '@iota/util.js-next'; + CoinType, + Output, + RegularTransactionEssence, + SecretManager, + TaggedDataPayload, + TransactionEssence, + TransactionPayload, + UTXOInput, + Unlock, + Utils, + utf8ToHex, +} from '@iota/sdk'; +import { mnemonicToSeedSync } from 'bip39'; import { Wallet, WalletParams } from '../services/wallet/wallet'; +import { AddressDetails } from '../services/wallet/wallet.service'; export const submitBlock = async ( wallet: Wallet, - payload: ITransactionPayload, -): Promise => { - const block: IBlock = { - protocolVersion: DEFAULT_PROTOCOL_VERSION, - parents: [], - payload, - nonce: '0', - }; - return await wallet.client.blockSubmit(block); -}; + essence: TransactionEssence, + unlocks: Unlock[], +): Promise => + (await wallet.client.postBlockPayload(new TransactionPayload(essence, unlocks)))[0]; -export const packEssence = ( - inputs: IUTXOInput[], - inputsCommitment: string, - outputs: OutputTypes[], +export const packEssence = async ( wallet: Wallet, + inputs: UTXOInput[], + inputsCommitment: string, + outputs: Output[], params: WalletParams, ) => - { - type: TRANSACTION_ESSENCE_TYPE, - networkId: TransactionHelper.networkIdFromNetworkName(wallet.info.protocol.networkName), + new RegularTransactionEssence( + await wallet.client.getNetworkId(), + inputsCommitment, inputs, outputs, - inputsCommitment, - payload: { - type: TAGGED_DATA_PAYLOAD_TYPE, - tag: Converter.utf8ToHex(KEY_NAME_TANGLE, true), - data: Converter.utf8ToHex(params.data || '', true), - }, - }; + new TaggedDataPayload(utf8ToHex(KEY_NAME_TANGLE), utf8ToHex(params.data || '')), + ); -export const packPayload = (essence: ITransactionEssence, unlocks: UnlockTypes[]) => - { type: TRANSACTION_PAYLOAD_TYPE, essence, unlocks }; +export const createUnlock = async (essence: TransactionEssence, address: AddressDetails) => { + const essenceHash = Utils.hashTransactionEssence(essence); + const seed = mnemonicToSeedSync(address.mnemonic); + const hexSeed = '0x' + seed.toString('hex'); + // @ts-ignore + const secretManager = new SecretManager({ hexSeed }); + return await secretManager.signatureUnlock(essenceHash, { coinType: CoinType.IOTA }); +}; -export const isValidBlockSize = (block: IBlock) => { - const writeStream = new WriteStream(); - serializeBlock(writeStream, block); - const blockBytes = writeStream.finalBytes(); - return blockBytes.length < MAX_BLOCK_LENGTH - 256; +export const isValidBlockSize = (_block: any) => { + // const writeStream = new WriteStream(); + // serializeBlock(writeStream, block); + // const blockBytes = writeStream.finalBytes(); + // return blockBytes.length < MAX_BLOCK_LENGTH - 256; + return true; }; export const indexToString = (index: number) => { diff --git a/packages/functions/src/utils/collection-minting-utils/nft.utils.ts b/packages/functions/src/utils/collection-minting-utils/nft.utils.ts index 49aeb8568b..6a9af45b06 100644 --- a/packages/functions/src/utils/collection-minting-utils/nft.utils.ts +++ b/packages/functions/src/utils/collection-minting-utils/nft.utils.ts @@ -1,68 +1,56 @@ import { COL, Collection, KEY_NAME_TANGLE, Nft } from '@build-5/interfaces'; import { - ADDRESS_UNLOCK_CONDITION_TYPE, - AddressTypes, - ED25519_ADDRESS_TYPE, - INftOutput, - INodeInfo, - ISSUER_FEATURE_TYPE, - METADATA_FEATURE_TYPE, - NFT_OUTPUT_TYPE, - TIMELOCK_UNLOCK_CONDITION_TYPE, - TransactionHelper, -} from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; + Address, + AddressUnlockCondition, + Ed25519Address, + IssuerFeature, + MetadataFeature, + NftOutput, + NftOutputBuilderParams, + TimelockUnlockCondition, + Utils, + utf8ToHex, +} from '@iota/sdk'; import dayjs from 'dayjs'; import { head } from 'lodash'; import { build5Db } from '../../firebase/firestore/build5Db'; +import { Wallet } from '../../services/wallet/wallet'; import { PLACEHOLDER_CID } from '../car.utils'; import { getContentType } from '../storage.utils'; import { propsToAttributes } from './nft.prop.utils'; export const EMPTY_NFT_ID = '0x0000000000000000000000000000000000000000000000000000000000000000'; -export const ZERO_ADDRESS: AddressTypes = { - type: ED25519_ADDRESS_TYPE, - pubKeyHash: '0x0000000000000000000000000000000000000000000000000000000000000000', -}; +export const ZERO_ADDRESS = new Ed25519Address( + '0x0000000000000000000000000000000000000000000000000000000000000000', +); -export const createNftOutput = ( - ownerAddress: AddressTypes, - issuerAddress: AddressTypes, +export const createNftOutput = async ( + wallet: Wallet, + ownerAddress: Address, + issuerAddress: Address, metadata: string, - info: INodeInfo, vestingAt?: dayjs.Dayjs, mutableMetadata?: string, -): INftOutput => { - const output: INftOutput = { - type: NFT_OUTPUT_TYPE, - amount: '0', +): Promise => { + const params: NftOutputBuilderParams = { nftId: EMPTY_NFT_ID, - immutableFeatures: [{ type: ISSUER_FEATURE_TYPE, address: issuerAddress }], - unlockConditions: [{ type: ADDRESS_UNLOCK_CONDITION_TYPE, address: ownerAddress }], + immutableFeatures: [new IssuerFeature(issuerAddress)], + unlockConditions: [new AddressUnlockCondition(ownerAddress)], }; if (metadata) { - output.immutableFeatures?.push({ - type: METADATA_FEATURE_TYPE, - data: Converter.utf8ToHex(metadata, true), - }); + params.immutableFeatures?.push(new MetadataFeature(utf8ToHex(metadata))); } if (mutableMetadata) { - output.features = [ - { type: METADATA_FEATURE_TYPE, data: Converter.utf8ToHex(mutableMetadata, true) }, - ]; + params.features = [new MetadataFeature(utf8ToHex(mutableMetadata))]; } if (vestingAt && vestingAt.isAfter(dayjs())) { - output.unlockConditions.push({ - type: TIMELOCK_UNLOCK_CONDITION_TYPE, - unixTime: vestingAt.unix(), - }); + params.unlockConditions.push(new TimelockUnlockCondition(vestingAt.unix())); } - output.amount = TransactionHelper.getStorageDeposit( - output, - info.protocol.rentStructure, - ).toString(); - return output; + const output = await wallet.client.buildNftOutput(params); + const rent = wallet.info.protocol.rentStructure; + params.amount = Utils.computeStorageDeposit(output, rent); + return await wallet.client.buildNftOutput(params); }; export const nftToMetadata = async ( diff --git a/packages/functions/src/utils/nft.output.utils.ts b/packages/functions/src/utils/nft.output.utils.ts index 48780be960..e1b3530ae2 100644 --- a/packages/functions/src/utils/nft.output.utils.ts +++ b/packages/functions/src/utils/nft.output.utils.ts @@ -1,21 +1,21 @@ import { - ALIAS_ADDRESS_TYPE, - IIssuerFeature, - IMetadataFeature, - INftOutput, - ISSUER_FEATURE_TYPE, - METADATA_FEATURE_TYPE, - NFT_ADDRESS_TYPE, -} from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; + AddressType, + AliasAddress, + FeatureType, + IssuerFeature, + MetadataFeature, + NftAddress, + NftOutput, + hexToUtf8, +} from '@iota/sdk'; import Joi from 'joi'; -export const getNftOutputMetadata = (output: INftOutput | undefined) => { +export const getNftOutputMetadata = (output: NftOutput | undefined) => { try { - const metadataFeature = ( - output?.immutableFeatures?.find((f) => f.type === METADATA_FEATURE_TYPE) + const metadataFeature = ( + output?.immutableFeatures?.find((f) => f.type === FeatureType.Metadata) ); - const decoded = Converter.hexToUtf8(metadataFeature?.data || '{}'); + const decoded = hexToUtf8(metadataFeature?.data || '{}'); const metadata = JSON.parse(decoded); return metadata || {}; } catch (e) { @@ -51,22 +51,22 @@ export const isMetadataIrc27 = (metadata: Record, schema: Joi.O return result.error === undefined; }; -export const getAliasId = (output: INftOutput) => { - const issuer = ( - output.immutableFeatures?.find((f) => f.type === ISSUER_FEATURE_TYPE) +export const getAliasId = (output: NftOutput) => { + const issuer = ( + output.immutableFeatures?.find((f) => f.type === FeatureType.Issuer) ); - if (!issuer || issuer.address.type !== ALIAS_ADDRESS_TYPE) { + if (!issuer || issuer.address.type !== AddressType.Alias) { return ''; } - return issuer.address.aliasId; + return (issuer.address as AliasAddress).aliasId; }; -export const getIssuerNftId = (output: INftOutput) => { - const issuer = ( - output.immutableFeatures?.find((f) => f.type === ISSUER_FEATURE_TYPE) +export const getIssuerNftId = (output: NftOutput) => { + const issuer = ( + output.immutableFeatures?.find((f) => f.type === FeatureType.Issuer) ); - if (!issuer || issuer.address.type !== NFT_ADDRESS_TYPE) { + if (!issuer || issuer.address.type !== AddressType.Nft) { return ''; } - return issuer.address.nftId; + return (issuer.address as NftAddress).nftId; }; diff --git a/packages/functions/src/utils/smr.utils.ts b/packages/functions/src/utils/smr.utils.ts deleted file mode 100644 index 4c0ee68012..0000000000 --- a/packages/functions/src/utils/smr.utils.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Ed25519 } from '@iota/crypto.js-next'; -import { - ED25519_SIGNATURE_TYPE, - IKeyPair, - ISignatureUnlock, - ITransactionEssence, - ITransactionPayload, - IUTXOInput, - OutputTypes, - SIGNATURE_UNLOCK_TYPE, - TransactionHelper, - TRANSACTION_ESSENCE_TYPE, - TRANSACTION_PAYLOAD_TYPE, -} from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; - -export const createUnlock = (essence: ITransactionEssence, keyPair: IKeyPair): ISignatureUnlock => { - const essenceHash = TransactionHelper.getTransactionEssenceHash(essence); - return { - type: SIGNATURE_UNLOCK_TYPE, - signature: { - type: ED25519_SIGNATURE_TYPE, - publicKey: Converter.bytesToHex(keyPair.publicKey, true), - signature: Converter.bytesToHex(Ed25519.sign(keyPair.privateKey, essenceHash), true), - }, - }; -}; - -export const createPayload = ( - networkId: string, - inputs: IUTXOInput[], - outputs: OutputTypes[], - commitment: string, - keyPair: IKeyPair, -): ITransactionPayload => { - const essence: ITransactionEssence = { - type: TRANSACTION_ESSENCE_TYPE, - networkId, - inputs, - outputs, - inputsCommitment: commitment, - }; - return { type: TRANSACTION_PAYLOAD_TYPE, essence, unlocks: [createUnlock(essence, keyPair)] }; -}; - -export const getTransactionPayloadHex = (payload: ITransactionPayload) => - Converter.bytesToHex(TransactionHelper.getTransactionPayloadHash(payload), true); diff --git a/packages/functions/src/utils/token-minting-utils/alias.utils.ts b/packages/functions/src/utils/token-minting-utils/alias.utils.ts index 7b4ff063f2..c95b81f5eb 100644 --- a/packages/functions/src/utils/token-minting-utils/alias.utils.ts +++ b/packages/functions/src/utils/token-minting-utils/alias.utils.ts @@ -1,63 +1,45 @@ -import * as lib from '@iota/iota.js-next'; import { - ALIAS_ADDRESS_TYPE, - ALIAS_OUTPUT_TYPE, - Bech32Helper, - GOVERNOR_ADDRESS_UNLOCK_CONDITION_TYPE, - IAliasOutput, - INodeInfo, - TransactionHelper, -} from '@iota/iota.js-next'; -import { Converter, HexHelper } from '@iota/util.js-next'; + AliasOutput, + AliasOutputBuilderParams, + Ed25519Address, + GovernorAddressUnlockCondition, + IssuerFeature, + StateControllerAddressUnlockCondition, + UnlockConditionType, + Utils, +} from '@iota/sdk'; +import { Wallet } from '../../services/wallet/wallet'; import { AddressDetails } from '../../services/wallet/wallet.service'; import { Bech32AddressHelper } from '../bech32-address.helper'; export const EMPTY_ALIAS_ID = '0x0000000000000000000000000000000000000000000000000000000000000000'; -export const createAliasOutput = ( - sourceAddress: AddressDetails, - info: INodeInfo, -): lib.IAliasOutput => { - const address: lib.AddressTypes = { - type: lib.ED25519_ADDRESS_TYPE, - pubKeyHash: sourceAddress.hex, - }; - const output: IAliasOutput = { - type: lib.ALIAS_OUTPUT_TYPE, - amount: '0', +export const createAliasOutput = async (wallet: Wallet, sourceAddress: AddressDetails) => { + const address = new Ed25519Address(sourceAddress.hex); + const params: AliasOutputBuilderParams = { aliasId: EMPTY_ALIAS_ID, stateIndex: 0, foundryCounter: 0, - immutableFeatures: [{ type: lib.ISSUER_FEATURE_TYPE, address }], + immutableFeatures: [new IssuerFeature(address)], unlockConditions: [ - { type: lib.STATE_CONTROLLER_ADDRESS_UNLOCK_CONDITION_TYPE, address }, - { type: lib.GOVERNOR_ADDRESS_UNLOCK_CONDITION_TYPE, address }, + new StateControllerAddressUnlockCondition(address), + new GovernorAddressUnlockCondition(address), ], }; - output.amount = TransactionHelper.getStorageDeposit( - output, - info.protocol.rentStructure, - ).toString(); - return output; + const output = await wallet.client.buildAliasOutput(params); + const info = (await wallet.client.getInfo()).nodeInfo; + params.amount = Utils.computeStorageDeposit(output, info.protocol.rentStructure); + return await wallet.client.buildAliasOutput(params); }; -export const getAliasBech32Address = (aliasId: string, info: INodeInfo) => - Bech32Helper.toBech32( - ALIAS_ADDRESS_TYPE, - Converter.hexToBytes(HexHelper.stripPrefix(aliasId)), - info.protocol.bech32Hrp, - ); - -export const isAliasGovernor = (alias: IAliasOutput, address: string, hrp: string) => { +export const isAliasGovernor = (alias: AliasOutput, address: string, hrp: string) => { const governors = - alias.unlockConditions?.filter((uc) => uc.type === GOVERNOR_ADDRESS_UNLOCK_CONDITION_TYPE) || - []; + alias.unlockConditions?.filter((uc) => uc.type === UnlockConditionType.GovernorAddress) || []; for (const governor of governors) { - const governorBech32 = Bech32AddressHelper.addressFromAddressUnlockCondition( - [governor], + const governorBech32 = Bech32AddressHelper.addressToBech32( + (governor as GovernorAddressUnlockCondition).address, hrp, - ALIAS_OUTPUT_TYPE, ); if (governorBech32 === address) { return true; diff --git a/packages/functions/src/utils/token-minting-utils/foundry.utils.ts b/packages/functions/src/utils/token-minting-utils/foundry.utils.ts index 523c1342ed..546990b358 100644 --- a/packages/functions/src/utils/token-minting-utils/foundry.utils.ts +++ b/packages/functions/src/utils/token-minting-utils/foundry.utils.ts @@ -1,64 +1,59 @@ import { KEY_NAME_TANGLE, Token } from '@build-5/interfaces'; -import * as lib from '@iota/iota.js-next'; -import { IFoundryOutput, INodeInfo, TransactionHelper } from '@iota/iota.js-next'; -import { Converter, HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; +import { + AliasAddress, + AliasOutput, + FoundryOutputBuilderParams, + ImmutableAliasAddressUnlockCondition, + MetadataFeature, + SimpleTokenScheme, + Utils, + utf8ToHex, +} from '@iota/sdk'; import { head } from 'lodash'; +import { Wallet } from '../../services/wallet/wallet'; import { packBasicOutput } from '../basic-output.utils'; import { PLACEHOLDER_CID } from '../car.utils'; import { getContentType } from '../storage.utils'; -export const createFoundryOutput = ( +export const createFoundryOutput = async ( + wallet: Wallet, maximumSupply: number, - alias: lib.IAliasOutput, + alias: AliasOutput, metadata: string, - info: INodeInfo, -): lib.IFoundryOutput => { - const output: IFoundryOutput = { - type: lib.FOUNDRY_OUTPUT_TYPE, +) => { + const params: FoundryOutputBuilderParams = { amount: '0', serialNumber: alias.foundryCounter, - tokenScheme: { - type: lib.SIMPLE_TOKEN_SCHEME_TYPE, - mintedTokens: HexHelper.fromBigInt256(bigInt(maximumSupply)), - meltedTokens: HexHelper.fromBigInt256(bigInt(0)), - maximumSupply: HexHelper.fromBigInt256(bigInt(maximumSupply)), - }, - unlockConditions: [ - { - type: lib.IMMUTABLE_ALIAS_UNLOCK_CONDITION_TYPE, - address: { type: lib.ALIAS_ADDRESS_TYPE, aliasId: alias.aliasId }, - }, - ], - immutableFeatures: [ - { type: lib.METADATA_FEATURE_TYPE, data: Converter.utf8ToHex(metadata, true) }, - ], + tokenScheme: new SimpleTokenScheme(BigInt(maximumSupply), BigInt(0), BigInt(maximumSupply)), + unlockConditions: [new ImmutableAliasAddressUnlockCondition(new AliasAddress(alias.aliasId))], + immutableFeatures: [new MetadataFeature(utf8ToHex(metadata))], }; - output.amount = TransactionHelper.getStorageDeposit( - output, - info.protocol.rentStructure, - ).toString(); - return output; + const output = await wallet.client.buildFoundryOutput(params); + const rent = (await wallet.client.getInfo()).nodeInfo.protocol.rentStructure; + params.amount = Utils.computeStorageDeposit(output, rent); + return await wallet.client.buildFoundryOutput(params); }; export const getVaultAndGuardianOutput = async ( + wallet: Wallet, tokenId: string, totalSupply: number, totalDistributed: number, vaultAddress: string, guardianAddress: string, - info: INodeInfo, ) => { const tokensToGuardian = totalSupply - totalDistributed; - const guardianAmount = HexHelper.fromBigInt256(bigInt(tokensToGuardian)); const guardianOutput = tokensToGuardian > 0 - ? packBasicOutput(guardianAddress, 0, [{ amount: guardianAmount, id: tokenId }], info) + ? await packBasicOutput(wallet, guardianAddress, 0, { + nativeTokens: [{ amount: BigInt(tokensToGuardian), id: tokenId }], + }) : undefined; - const vaultAmount = HexHelper.fromBigInt256(bigInt(totalDistributed)); const vaultOutput = totalDistributed - ? packBasicOutput(vaultAddress, 0, [{ amount: vaultAmount, id: tokenId }], info) + ? await packBasicOutput(wallet, vaultAddress, 0, { + nativeTokens: [{ amount: BigInt(totalDistributed), id: tokenId }], + }) : undefined; return { vaultOutput, guardianOutput }; diff --git a/packages/functions/src/utils/token-minting-utils/member.utils.ts b/packages/functions/src/utils/token-minting-utils/member.utils.ts index 7fbe4ab4ff..e84a705b6d 100644 --- a/packages/functions/src/utils/token-minting-utils/member.utils.ts +++ b/packages/functions/src/utils/token-minting-utils/member.utils.ts @@ -1,10 +1,8 @@ import { COL, SUB_COL, Token, TokenDistribution, TokenDrop } from '@build-5/interfaces'; -import { INodeInfo } from '@iota/iota.js-next'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; import dayjs from 'dayjs'; import { last } from 'lodash'; import { build5Db, getSnapshot } from '../../firebase/firestore/build5Db'; +import { Wallet } from '../../services/wallet/wallet'; import { packBasicOutput } from '../basic-output.utils'; export const getOwnedTokenTotal = async (token: string) => { @@ -28,13 +26,14 @@ export const getOwnedTokenTotal = async (token: string) => { }; export const dropToOutput = ( + wallet: Wallet, token: Token, drop: TokenDrop, targetAddress: string, - info: INodeInfo, ) => { - const amount = HexHelper.fromBigInt256(bigInt(drop.count)); - const nativeTokens = drop.isBaseToken ? undefined : [{ amount, id: token.mintingData?.tokenId! }]; + const nativeTokens = drop.isBaseToken + ? undefined + : [{ amount: BigInt(drop.count), id: token.mintingData?.tokenId! }]; const vestingAt = dayjs(drop.vestingAt.toDate()).isAfter(dayjs()) ? drop.vestingAt : undefined; - return packBasicOutput(targetAddress, 0, nativeTokens, info, undefined, vestingAt); + return packBasicOutput(wallet, targetAddress, 0, { nativeTokens, vestingAt }); }; diff --git a/packages/functions/src/utils/token-trade.utils.ts b/packages/functions/src/utils/token-trade.utils.ts index dee60aca74..3d22cac736 100644 --- a/packages/functions/src/utils/token-trade.utils.ts +++ b/packages/functions/src/utils/token-trade.utils.ts @@ -148,7 +148,7 @@ const cancelMintedSell = async (transaction: ITransaction, sell: TokenTradeOrder reason: CreditPaymentReason.TRADE_CANCELLED, type: TransactionPayloadType.TOKEN_BUY, amount: order.payload.amount, - nativeTokens: [{ amount: tokensLeft.toString(), id: token.mintingData?.tokenId! }], + nativeTokens: [{ amount: BigInt(tokensLeft), id: token.mintingData?.tokenId! }], sourceAddress: order.payload.targetAddress, targetAddress: getAddress(seller, network), sourceTransaction: [sell.paymentTransactionId!], diff --git a/packages/functions/src/utils/wallet.utils.ts b/packages/functions/src/utils/wallet.utils.ts index 9726ed8460..b3ff56ab45 100644 --- a/packages/functions/src/utils/wallet.utils.ts +++ b/packages/functions/src/utils/wallet.utils.ts @@ -1,7 +1,5 @@ import { COL, DecodedToken, Member, WEN_FUNC, WenError, WenRequest } from '@build-5/interfaces'; -import { Ed25519 } from '@iota/crypto.js-next'; -import { Bech32Helper, ED25519_ADDRESS_TYPE, Ed25519Address } from '@iota/iota.js-next'; -import { Converter, HexHelper } from '@iota/util.js-next'; +import { Ed25519Signature, INodeInfo, Utils } from '@iota/sdk'; import { recoverPersonalSignature } from '@metamask/eth-sig-util'; import { randomBytes } from 'crypto'; import dayjs from 'dayjs'; @@ -64,7 +62,8 @@ const validateWithSignature = async (req: WenRequest) => { const validateWithPublicKey = async (req: WenRequest) => { const network = req.publicKey!.network; - const { member, address } = await validatePubKey(req); + const wallet = await WalletService.newWallet(network); + const { member, address } = await validatePubKey(wallet.info, req); if (!address) { throw unAuthenticated(WenError.failed_to_decode_token); } @@ -80,21 +79,18 @@ const validateWithPublicKey = async (req: WenRequest) => { return address; }; -const validatePubKey = async (req: WenRequest) => { - const signedData = Converter.hexToBytes(HexHelper.stripPrefix(req.signature!)); - const publicKey = Converter.hexToBytes(HexHelper.stripPrefix(req.publicKey?.hex!)); - - const wallet = await WalletService.newWallet(req.publicKey!.network); - const bech32Address = Bech32Helper.toBech32( - ED25519_ADDRESS_TYPE, - new Ed25519Address(publicKey).toAddress(), - wallet.info.protocol.bech32Hrp, +const validatePubKey = async (info: INodeInfo, req: WenRequest) => { + const bech32Address = Utils.hexPublicKeyToBech32Address( + req.publicKey?.hex!, + info.protocol.bech32Hrp, ); const member = await getMember(bech32Address); - const unsignedData = Converter.utf8ToBytes(`0x${toHex(member.nonce!)}`); - const verify = Ed25519.verify(publicKey, unsignedData, signedData); + const verify = Utils.verifyEd25519Signature( + new Ed25519Signature(req.publicKey?.hex!, req.signature!), + `0x${toHex(member.nonce!)}`, + ); if (!verify) { throw unAuthenticated(WenError.invalid_signature); } diff --git a/packages/functions/test-tangle/address.spec.ts b/packages/functions/test-tangle/address.spec.ts index f1e71117b2..f083e9b089 100644 --- a/packages/functions/test-tangle/address.spec.ts +++ b/packages/functions/test-tangle/address.spec.ts @@ -158,8 +158,8 @@ describe('Address validation', () => { return snap.length === 1 && snap[0].payload?.walletReference?.confirmed; }); - const balanace = await walletService.getBalance(tmpAddress.bech32); - expect(balanace).toBe(order.payload.amount); + const { amount } = await walletService.getBalance(tmpAddress.bech32); + expect(amount).toBe(order.payload.amount); }); it.each([ diff --git a/packages/functions/test-tangle/award-tangle/award-tangle_3.spec.ts b/packages/functions/test-tangle/award-tangle/award-tangle_3.spec.ts index 07ae647e57..7de56e8e97 100644 --- a/packages/functions/test-tangle/award-tangle/award-tangle_3.spec.ts +++ b/packages/functions/test-tangle/award-tangle/award-tangle_3.spec.ts @@ -12,8 +12,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; @@ -97,7 +96,7 @@ describe('Award tangle request', () => { { nativeTokens: (credit.payload.response!.nativeTokens as NativeToken[]).map((nt: any) => ({ ...nt, - amount: HexHelper.fromBigInt256(bigInt(nt.amount)), + amount: BigInt(nt.amount), })), }, ); diff --git a/packages/functions/test-tangle/award/award_1.spec.ts b/packages/functions/test-tangle/award/award_1.spec.ts index bcb539c430..d1ab097c14 100644 --- a/packages/functions/test-tangle/award/award_1.spec.ts +++ b/packages/functions/test-tangle/award/award_1.spec.ts @@ -12,12 +12,7 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { - IndexerPluginClient, - INftOutput, - ITimelockUnlockCondition, - TIMELOCK_UNLOCK_CONDITION_TYPE, -} from '@iota/iota.js-next'; +import { NftOutput, TimelockUnlockCondition, UnlockConditionType } from '@iota/sdk'; import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { @@ -140,22 +135,20 @@ describe('Create award, base', () => { return balance === 2 * MIN_IOTA_AMOUNT + claimOrder.payload.amount; }); - const indexer = new IndexerPluginClient(walletService.client); - await wait(async () => { - const response = await indexer.nfts({ addressBech32: memberBech32 }); + const response = await walletService.client.nftOutputIds([{ address: memberBech32 }]); return response.items.length === 2; }); - const response = await indexer.nfts({ addressBech32: memberBech32 }); + const response = await walletService.client.nftOutputIds([{ address: memberBech32 }]); const promises = response.items.map( - async (outputId) => (await walletService.client.output(outputId)).output as INftOutput, + async (outputId) => (await walletService.client.getOutput(outputId)).output as NftOutput, ); const outputs = await Promise.all(promises); for (const nttOutput of outputs) { const timelock = nttOutput.unlockConditions.find( - (uc) => uc.type === TIMELOCK_UNLOCK_CONDITION_TYPE, - ) as ITimelockUnlockCondition; + (uc) => uc.type === UnlockConditionType.Timelock, + ) as TimelockUnlockCondition; expect(dayjs.unix(timelock.unixTime).isAfter(now.add(31557600000))).toBe(true); } @@ -169,8 +162,8 @@ describe('Create award, base', () => { }); await wait(async () => { - const balance = await walletService.getBalance(guardianAddress.bech32); - return balance === award.aliasStorageDeposit; + const { amount } = await walletService.getBalance(guardianAddress.bech32); + return amount === award.aliasStorageDeposit; }); }, ); diff --git a/packages/functions/test-tangle/award/award_10.spec.ts b/packages/functions/test-tangle/award/award_10.spec.ts index 6a3772ae9a..e3c2570b17 100644 --- a/packages/functions/test-tangle/award/award_10.spec.ts +++ b/packages/functions/test-tangle/award/award_10.spec.ts @@ -1,6 +1,5 @@ import { Award, COL, Member, Network, Space, Token, TokenStatus } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { approveAwardParticipant, createAward, fundAward } from '../../src/runtime/firebase/award'; @@ -70,7 +69,7 @@ describe('Create award, native', () => { 15, ); await walletService.send(guardianAddress, order.payload.targetAddress, order.payload.amount, { - nativeTokens: [{ id: MINTED_TOKEN_ID, amount: HexHelper.fromBigInt256(bigInt(15)) }], + nativeTokens: [{ id: MINTED_TOKEN_ID, amount: BigInt(15) }], }); await MnemonicService.store(guardianAddress.bech32, guardianAddress.mnemonic); diff --git a/packages/functions/test-tangle/award/award_2.spec.ts b/packages/functions/test-tangle/award/award_2.spec.ts index 038216c2de..2caf260869 100644 --- a/packages/functions/test-tangle/award/award_2.spec.ts +++ b/packages/functions/test-tangle/award/award_2.spec.ts @@ -14,12 +14,7 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { - IndexerPluginClient, - INftOutput, - ITimelockUnlockCondition, - TIMELOCK_UNLOCK_CONDITION_TYPE, -} from '@iota/iota.js-next'; +import { NftOutput, TimelockUnlockCondition, UnlockConditionType } from '@iota/sdk'; import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { @@ -100,7 +95,7 @@ describe('Create award, native', () => { 10, ); await walletService.send(guardianAddress, order.payload.targetAddress, order.payload.amount, { - nativeTokens: [{ id: MINTED_TOKEN_ID, amount: '0xA' }], + nativeTokens: [{ id: MINTED_TOKEN_ID, amount: BigInt('0xA') }], }); await MnemonicService.store(guardianAddress.bech32, guardianAddress.mnemonic); @@ -140,21 +135,20 @@ describe('Create award, native', () => { const memberDocRef = build5Db().doc(`${COL.MEMBER}/${member}`); const memberData = await memberDocRef.get(); const memberBech32 = getAddress(memberData, network); - const indexer = new IndexerPluginClient(walletService.client); await wait(async () => { - const response = await indexer.nfts({ addressBech32: memberBech32 }); + const response = await walletService.client.nftOutputIds([{ address: memberBech32 }]); return response.items.length === 2; }); - const response = await indexer.nfts({ addressBech32: memberBech32 }); + const response = await walletService.client.nftOutputIds([{ address: memberBech32 }]); const promises = response.items.map( - async (outputId) => (await walletService.client.output(outputId)).output as INftOutput, + async (outputId) => (await walletService.client.getOutput(outputId)).output as NftOutput, ); const nttOutputs = await Promise.all(promises); for (const nttOutput of nttOutputs) { const timelock = nttOutput.unlockConditions.find( - (uc) => uc.type === TIMELOCK_UNLOCK_CONDITION_TYPE, - ) as ITimelockUnlockCondition; + (uc) => uc.type === UnlockConditionType.Timelock, + ) as TimelockUnlockCondition; expect(dayjs.unix(timelock.unixTime).isAfter(now.add(31557600000))).toBe(true); } diff --git a/packages/functions/test-tangle/award/award_5.spec.ts b/packages/functions/test-tangle/award/award_5.spec.ts index 8d19b057ee..b5c4d61103 100644 --- a/packages/functions/test-tangle/award/award_5.spec.ts +++ b/packages/functions/test-tangle/award/award_5.spec.ts @@ -12,9 +12,7 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { IndexerPluginClient } from '@iota/iota.js-next'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import dayjs from 'dayjs'; import { processExpiredAwards } from '../../src/cron/award.cron'; import { build5Db } from '../../src/firebase/firestore/build5Db'; @@ -95,7 +93,7 @@ describe('Create award, native', () => { 15, ); await walletService.send(guardianAddress, order.payload.targetAddress, order.payload.amount, { - nativeTokens: [{ id: MINTED_TOKEN_ID, amount: HexHelper.fromBigInt256(bigInt(15)) }], + nativeTokens: [{ id: MINTED_TOKEN_ID, amount: BigInt(15) }], }); await MnemonicService.store(guardianAddress.bech32, guardianAddress.mnemonic); @@ -139,9 +137,8 @@ describe('Create award, native', () => { const memberDocRef = build5Db().doc(`${COL.MEMBER}/${member}`); const memberData = await memberDocRef.get(); const memberBech32 = getAddress(memberData, network); - const indexer = new IndexerPluginClient(walletService.client); await wait(async () => { - const response = await indexer.nfts({ addressBech32: memberBech32 }); + const response = await walletService.client.nftOutputIds([{ address: memberBech32 }]); return response.items.length === 1; }); diff --git a/packages/functions/test-tangle/award/award_6.spec.ts b/packages/functions/test-tangle/award/award_6.spec.ts index 54926c6079..6675e725fd 100644 --- a/packages/functions/test-tangle/award/award_6.spec.ts +++ b/packages/functions/test-tangle/award/award_6.spec.ts @@ -11,7 +11,6 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { IndexerPluginClient } from '@iota/iota.js-next'; import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { validateAddress } from '../../src/runtime/firebase/address'; @@ -83,9 +82,8 @@ describe('Award', () => { {}, ); - const indexer = new IndexerPluginClient(walletService.client); await wait(async () => { - const response = await indexer.nfts({ addressBech32: tmpAddress.bech32 }); + const response = await walletService.client.nftOutputIds([{ address: tmpAddress.bech32 }]); return response.items.length === 2; }); diff --git a/packages/functions/test-tangle/award/award_7.spec.ts b/packages/functions/test-tangle/award/award_7.spec.ts index 315b48eeec..3de849170f 100644 --- a/packages/functions/test-tangle/award/award_7.spec.ts +++ b/packages/functions/test-tangle/award/award_7.spec.ts @@ -9,7 +9,7 @@ import { Transaction, TransactionPayloadType, } from '@build-5/interfaces'; -import { INftOutput, IndexerPluginClient } from '@iota/iota.js-next'; +import { NftOutput } from '@iota/sdk'; import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { approveAwardParticipant, createAward, fundAward } from '../../src/runtime/firebase/award'; @@ -76,7 +76,7 @@ describe('Create award, base', () => { 10, ); await walletService.send(guardianAddress, order.payload.targetAddress, order.payload.amount, { - nativeTokens: [{ id: MINTED_TOKEN_ID, amount: '0xA' }], + nativeTokens: [{ id: MINTED_TOKEN_ID, amount: BigInt('0xA') }], }); await MnemonicService.store(guardianAddress.bech32, guardianAddress.mnemonic); @@ -102,10 +102,8 @@ describe('Create award, base', () => { return snap.length === 2; }); - const indexer = new IndexerPluginClient(walletService.client); - await wait(async () => { - const response = await indexer.nfts({ addressBech32: memberBech32 }); + const response = await walletService.client.nftOutputIds([{ address: memberBech32 }]); return response.items.length === 2; }); @@ -113,9 +111,9 @@ describe('Create award, base', () => { space = await spaceDocRef.get(); expect(space.ipfsMedia).toBeDefined(); - const collectionOutputItems = (await indexer.nft(award.collectionId!)).items; - const collectionOutput = (await walletService.client.output(collectionOutputItems[0])).output; - const collectionMetadata = getNftMetadata(collectionOutput as INftOutput); + const collectionOutputId = await walletService.client.nftOutputId(award.collectionId!); + const collectionOutput = (await walletService.client.getOutput(collectionOutputId)).output; + const collectionMetadata = getNftMetadata(collectionOutput as NftOutput); expect(collectionMetadata.standard).toBe('IRC27'); expect(collectionMetadata.version).toBe('v1.0'); expect(collectionMetadata.type).toBe('image/png'); @@ -125,9 +123,9 @@ describe('Create award, base', () => { expect(collectionMetadata.issuerName).toBe('Soonaverse'); expect(collectionMetadata.build5Id).toBe(award.uid); - const nttItems = (await indexer.nfts({ addressBech32: memberBech32 })).items; + const nttItems = (await walletService.client.nftOutputIds([{ address: memberBech32 }])).items; const promises = nttItems.map( - async (outputId) => (await walletService.client.output(outputId)).output as INftOutput, + async (outputId) => (await walletService.client.getOutput(outputId)).output as NftOutput, ); const outputs = await Promise.all(promises); diff --git a/packages/functions/test-tangle/collection-minting/Helper.ts b/packages/functions/test-tangle/collection-minting/Helper.ts index f6b39a70c9..e6f74c224a 100644 --- a/packages/functions/test-tangle/collection-minting/Helper.ts +++ b/packages/functions/test-tangle/collection-minting/Helper.ts @@ -17,8 +17,7 @@ import { TransactionType, UnsoldMintingOptions, } from '@build-5/interfaces'; -import { IMetadataFeature, INftOutput, METADATA_FEATURE_TYPE } from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; +import { FeatureType, MetadataFeature, NftOutput, hexToUtf8 } from '@iota/sdk'; import dayjs from 'dayjs'; import { set } from 'lodash'; import { build5Db } from '../../src/firebase/firestore/build5Db'; @@ -246,15 +245,15 @@ export class CollectionMintHelper { .join(''); } -export const getNftMetadata = (nft: INftOutput | undefined) => { +export const getNftMetadata = (nft: NftOutput | undefined) => { try { - const hexMetadata = ( - nft?.immutableFeatures?.find((f) => f.type === METADATA_FEATURE_TYPE) + const hexMetadata = ( + nft?.immutableFeatures?.find((f) => f.type === FeatureType.Metadata) ); if (!hexMetadata?.data) { return {}; } - return JSON.parse(Converter.hexToUtf8(hexMetadata.data) || '{}'); + return JSON.parse(hexToUtf8(hexMetadata.data) || '{}'); } catch { return {}; } diff --git a/packages/functions/test-tangle/collection-minting/collection-minting_4.spec.ts b/packages/functions/test-tangle/collection-minting/collection-minting_4.spec.ts index cb33a6e36b..2c4cf0f593 100644 --- a/packages/functions/test-tangle/collection-minting/collection-minting_4.spec.ts +++ b/packages/functions/test-tangle/collection-minting/collection-minting_4.spec.ts @@ -12,7 +12,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { IndexerPluginClient, INftOutput } from '@iota/iota.js-next'; +import { NftOutput } from '@iota/sdk'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { getAddress } from '../../src/utils/address.utils'; import { EMPTY_NFT_ID } from '../../src/utils/collection-minting-utils/nft.utils'; @@ -49,12 +49,13 @@ describe('Collection minting', () => { await helper.mintCollection(); if (limited) { await helper.lockCollectionConfirmed(); - const indexer = new IndexerPluginClient(helper.walletService?.client!); const collection = ( await build5Db().doc(`${COL.COLLECTION}/${helper.collection}`).get() ); - const outputId = (await indexer.nft(collection.mintingData?.nftId!)).items[0]; - const output = (await helper.walletService!.client.output(outputId)).output; + const outputId = await helper.walletService!.client.nftOutputId( + collection.mintingData?.nftId!, + ); + const output = (await helper.walletService!.client.getOutput(outputId)).output; expect((output.unlockConditions[0] as any).address.pubKeyHash).toBe(EMPTY_NFT_ID); } diff --git a/packages/functions/test-tangle/common.ts b/packages/functions/test-tangle/common.ts index 825c0143d3..6fd94a0f29 100644 --- a/packages/functions/test-tangle/common.ts +++ b/packages/functions/test-tangle/common.ts @@ -7,8 +7,12 @@ import { TransactionType, TransactionValidationType, } from '@build-5/interfaces'; -import { ITransactionPayload } from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; +import { + RegularTransactionEssence, + TaggedDataPayload, + TransactionPayload, + hexToUtf8, +} from '@iota/sdk'; import dayjs from 'dayjs'; import { isEmpty } from 'lodash'; import { build5Db } from '../src/firebase/firestore/build5Db'; @@ -89,8 +93,10 @@ export const getTangleOrder = async (network: Network) => { export const getRmsSoonTangleResponse = async (doc: Transaction, wallet: Wallet) => { const blockId = doc?.payload?.walletReference?.chainReference!; - const block = await wallet!.client.block(blockId); - const hexData = (block.payload)?.essence?.payload?.data || ''; - const { response } = JSON.parse(Converter.hexToUtf8(hexData)); + const block = await wallet!.client.getBlock(blockId); + const payload = block.payload; + const essence = payload?.essence as RegularTransactionEssence; + const hexData = (essence?.payload as TaggedDataPayload)?.data || ''; + const { response } = JSON.parse(hexToUtf8(hexData)); return response; }; diff --git a/packages/functions/test-tangle/faucet.ts b/packages/functions/test-tangle/faucet.ts index 8d81effbed..5e6f82e8d5 100644 --- a/packages/functions/test-tangle/faucet.ts +++ b/packages/functions/test-tangle/faucet.ts @@ -1,7 +1,6 @@ import { Network, Timestamp } from '@build-5/interfaces'; -import { SingleNodeClient } from '@iota/iota.js-next'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + +import { Client } from '@iota/sdk'; import { MnemonicService } from '../src/services/wallet/mnemonic'; import { Wallet } from '../src/services/wallet/wallet'; import { AddressDetails } from '../src/services/wallet/wallet.service'; @@ -84,7 +83,7 @@ export const requestMintedTokenFromFaucet = async ( await MnemonicService.store(vaultAddress.bech32, vaultAddress.mnemonic, Network.RMS); const blockId = await wallet.send(vaultAddress, targetAddress.bech32, 0, { expiration: expiresAt ? { expiresAt, returnAddressBech32: vaultAddress.bech32 } : undefined, - nativeTokens: [{ id: tokenId, amount: HexHelper.fromBigInt256(bigInt(amount)) }], + nativeTokens: [{ id: tokenId, amount: BigInt(amount) }], storageDepositSourceAddress: targetAddress.bech32, }); const ledgerInclusionState = await awaitLedgerInclusionState(blockId, Network.RMS); @@ -111,7 +110,7 @@ export const awaitLedgerInclusionState = async (blockId: string, network: Networ }; const getLedgerInclusionState = async (blockId: string) => - (await publicRmsClient.blockMetadata(blockId)).ledgerInclusionState; + (await publicRmsClient.getBlockMetadata(blockId)).ledgerInclusionState; export const getFaucetMnemonic = (network: Network) => getRandomElement(network === Network.ATOI ? ATOI_FAUCET_MNEMONIC : RMS_FAUCET_MNEMONIC); @@ -164,4 +163,4 @@ export const ATOI_FAUCET_MNEMONIC = RMS_FAUCET_MNEMONIC; // 'diagram blame cabin battle vacuum goddess weird develop turn symbol sight dance trap loop sample culture purse pupil hobby deal wheel neglect behind tongue', // ]; -const publicRmsClient = new SingleNodeClient('https://api.testnet.shimmer.network'); +const publicRmsClient = new Client({ nodes: ['https://api.testnet.shimmer.network'] }); diff --git a/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_1.spec.ts b/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_1.spec.ts index 8cd2a459e6..2695009cc5 100644 --- a/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_1.spec.ts +++ b/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_1.spec.ts @@ -9,7 +9,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { IBasicOutput, ITransactionPayload, IndexerPluginClient } from '@iota/iota.js-next'; +import { BasicOutput, RegularTransactionEssence, TransactionPayload } from '@iota/sdk'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; import { getOutputMetadata } from '../../src/utils/basic-output.utils'; @@ -59,11 +59,11 @@ describe('Metadata nft', () => { return snap.length === 1 && snap[0]?.payload?.walletReference?.confirmed; }); const credit = (await creditQuery.get())[0]; - const block = await helper.walletService.client.block( + const block = await helper.walletService.client.getBlock( credit.payload.walletReference!.chainReference!, ); - const payload = block.payload! as ITransactionPayload; - const output = payload.essence.outputs[0] as IBasicOutput; + const payload = block.payload! as TransactionPayload; + const output = (payload.essence as RegularTransactionEssence).outputs[0] as BasicOutput; const outputMetadata = getOutputMetadata(output); const nftQuery = build5Db().collection(COL.NFT).where('owner', '==', helper.member); @@ -78,8 +78,7 @@ describe('Metadata nft', () => { aliasId: space!.alias!.aliasId, }); - const indexer = new IndexerPluginClient(helper.walletService.client); - const items = (await indexer.basicOutputs({ tagHex: blockId })).items; + const items = (await helper.walletService.client.basicOutputIds([{ tag: blockId }])).items; expect(items.length).toBe(1); }); }); diff --git a/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_2.spec.ts b/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_2.spec.ts index 49dfbc06b1..1c126cb8b5 100644 --- a/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_2.spec.ts +++ b/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_2.spec.ts @@ -8,7 +8,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { IBasicOutput, ITransactionPayload } from '@iota/iota.js-next'; +import { BasicOutput, RegularTransactionEssence, TransactionPayload } from '@iota/sdk'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; import { Wallet } from '../../src/services/wallet/wallet'; @@ -110,8 +110,8 @@ describe('Metadata nft', () => { }); const getMetadata = async (wallet: Wallet, blockId: string) => { - const block = await wallet.client.block(blockId); - const payload = block.payload! as ITransactionPayload; - const output = payload.essence.outputs[0] as IBasicOutput; + const block = await wallet.client.getBlock(blockId); + const payload = block.payload! as TransactionPayload; + const output = (payload.essence as RegularTransactionEssence).outputs[0] as BasicOutput; return getOutputMetadata(output); }; diff --git a/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_3.spec.ts b/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_3.spec.ts index 8af06e5581..8828895bb0 100644 --- a/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_3.spec.ts +++ b/packages/functions/test-tangle/metadata-nft/mint-metadata-nft_3.spec.ts @@ -7,7 +7,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { INftOutput, IndexerPluginClient } from '@iota/iota.js-next'; +import { NftOutput } from '@iota/sdk'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; import { getOutputMetadata } from '../../src/utils/basic-output.utils'; @@ -90,10 +90,9 @@ describe('Metadata nft', () => { ); }); - const indexer = new IndexerPluginClient(helper.walletService.client); - - let nftOutputId = (await indexer.nft(nft.mintingData?.nftId!)).items[0]; - let nftOutput = (await helper.walletService.client.output(nftOutputId)).output as INftOutput; + let nftOutputId = await helper.walletService.client.nftOutputId(nft.mintingData?.nftId!); + let nftOutput = (await helper.walletService.client.getOutput(nftOutputId)) + .output as NftOutput; let meta = getOutputMetadata(nftOutput); expect(meta).toEqual({ asd: 'hello' }); @@ -125,8 +124,8 @@ describe('Metadata nft', () => { ); }); - nftOutputId = (await indexer.nft(nft.mintingData?.nftId!)).items[0]; - nftOutput = (await helper.walletService.client.output(nftOutputId)).output as INftOutput; + nftOutputId = await helper.walletService.client.nftOutputId(nft.mintingData?.nftId!); + nftOutput = (await helper.walletService.client.getOutput(nftOutputId)).output as NftOutput; meta = getOutputMetadata(nftOutput); expect(meta).toEqual({ asd: 'helloasdasd2' }); }, diff --git a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_1.spec.ts b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_1.spec.ts index dd4dad0da4..d0dfcbbf0e 100644 --- a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_1.spec.ts +++ b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_1.spec.ts @@ -9,7 +9,7 @@ import { TransactionType, WenError, } from '@build-5/interfaces'; -import { IndexerPluginClient, INftOutput, NFT_OUTPUT_TYPE } from '@iota/iota.js-next'; +import { NftOutput } from '@iota/sdk'; import dayjs from 'dayjs'; import { isEmpty } from 'lodash'; import { finalizeAllNftAuctions } from '../../src/cron/nft.cron'; @@ -104,18 +104,14 @@ describe('Minted nft trading', () => { return transaction?.payload?.walletReference?.confirmed; }); - const indexer = new IndexerPluginClient(helper.walletService?.client!); const output = ( - await helper.walletService!.client.output( - ( - await indexer.nft(nft.mintingData?.nftId!) - ).items[0], + await helper.walletService!.client.getOutput( + await helper.walletService!.client.nftOutputId(nft.mintingData?.nftId!), ) ).output; - const ownerAddress = Bech32AddressHelper.addressFromAddressUnlockCondition( - (output as INftOutput).unlockConditions, + const ownerAddress = Bech32AddressHelper.bech32FromUnlockConditions( + output as NftOutput, 'rms', - NFT_OUTPUT_TYPE, ); const member = await build5Db().doc(`${COL.MEMBER}/${helper.member}`).get(); expect(ownerAddress).toBe(getAddress(member, Network.RMS)); diff --git a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_1_b.spec.ts b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_1_b.spec.ts index 44655c2827..fdd08f58db 100644 --- a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_1_b.spec.ts +++ b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_1_b.spec.ts @@ -9,7 +9,7 @@ import { TransactionType, WenError, } from '@build-5/interfaces'; -import { IndexerPluginClient, INftOutput, NFT_OUTPUT_TYPE } from '@iota/iota.js-next'; +import { NftOutput } from '@iota/sdk'; import dayjs from 'dayjs'; import { isEmpty } from 'lodash'; import { finalizeAllNftAuctions } from '../../src/cron/nft.cron'; @@ -104,19 +104,12 @@ describe('Minted nft trading', () => { return transaction?.payload?.walletReference?.confirmed; }); - const indexer = new IndexerPluginClient(helper.walletService?.client!); const output = ( - await helper.walletService!.client.output( - ( - await indexer.nft(nft.mintingData?.nftId!) - ).items[0], + await helper.walletService!.client.getOutput( + await helper.walletService!.client.nftOutputId(nft.mintingData?.nftId!), ) - ).output; - const ownerAddress = Bech32AddressHelper.addressFromAddressUnlockCondition( - (output as INftOutput).unlockConditions, - 'rms', - NFT_OUTPUT_TYPE, - ); + ).output as NftOutput; + const ownerAddress = Bech32AddressHelper.bech32FromUnlockConditions(output, 'rms'); const member = await build5Db().doc(`${COL.MEMBER}/${helper.member}`).get(); expect(ownerAddress).toBe(getAddress(member, Network.ATOI)); }, diff --git a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_2.spec.ts b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_2.spec.ts index dcf72e11a1..682441e801 100644 --- a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_2.spec.ts +++ b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_2.spec.ts @@ -8,7 +8,7 @@ import { TransactionType, WenError, } from '@build-5/interfaces'; -import { INftOutput, IndexerPluginClient, NFT_OUTPUT_TYPE } from '@iota/iota.js-next'; +import { NftOutput } from '@iota/sdk'; import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { orderNft, withdrawNft } from '../../src/runtime/firebase/nft/index'; @@ -69,19 +69,12 @@ describe('Minted nft trading', () => { return transaction?.payload?.walletReference?.confirmed; }); - const indexer = new IndexerPluginClient(helper.walletService?.client!); const output = ( - await helper.walletService!.client.output( - ( - await indexer.nft(nft.mintingData?.nftId!) - ).items[0], + await helper.walletService!.client.getOutput( + await helper.walletService!.client.nftOutputId(nft.mintingData?.nftId!), ) ).output; - const ownerAddress = Bech32AddressHelper.addressFromAddressUnlockCondition( - (output as INftOutput).unlockConditions, - 'rms', - NFT_OUTPUT_TYPE, - ); + const ownerAddress = Bech32AddressHelper.bech32FromUnlockConditions(output as NftOutput, 'rms'); const member = await build5Db().doc(`${COL.MEMBER}/${helper.member}`).get(); expect(ownerAddress).toBe(getAddress(member, Network.RMS)); }); diff --git a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_4.spec.ts b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_4.spec.ts index 76ae5d373f..a662f11cbe 100644 --- a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_4.spec.ts +++ b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_4.spec.ts @@ -10,7 +10,6 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { IndexerPluginClient } from '@iota/iota.js-next'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; import { wait } from '../../test/controls/common'; @@ -90,8 +89,9 @@ describe('Minted nft trading', () => { return snap.length > 0 && snap[0]?.payload?.walletReference?.confirmed; }); - const indexer = new IndexerPluginClient(helper.walletService!.client); - const nftOutputIds = await indexer.nfts({ addressBech32: address.bech32 }); + const nftOutputIds = await helper.walletService!.client.nftOutputIds([ + { address: address.bech32 }, + ]); expect(nftOutputIds.items.length).toBe(1); collection = await collectionDocRef.get(); diff --git a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_6.spec.ts b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_6.spec.ts index 1e3ab8c4ab..32a221bc1e 100644 --- a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_6.spec.ts +++ b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_6.spec.ts @@ -7,7 +7,6 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { IndexerPluginClient } from '@iota/iota.js-next'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; import { wait } from '../../test/controls/common'; @@ -50,8 +49,9 @@ describe('Minted nft trading', () => { .get(); return snap.length > 0 && snap[0]?.payload?.walletReference?.confirmed; }); - const indexer = new IndexerPluginClient(helper.walletService!.client); - const nftOutputIds = await indexer.nfts({ addressBech32: address.bech32 }); + const nftOutputIds = await helper.walletService!.client.nftOutputIds([ + { address: address.bech32 }, + ]); expect(nftOutputIds.items.length).toBe(1); }, ); diff --git a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_7.spec.ts b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_7.spec.ts index df1026029f..57999e40fb 100644 --- a/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_7.spec.ts +++ b/packages/functions/test-tangle/minted-nft-trading/minted-nft-trading_7.spec.ts @@ -11,7 +11,6 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { IndexerPluginClient } from '@iota/iota.js-next'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; import { wait } from '../../test/controls/common'; @@ -80,8 +79,9 @@ describe('Minted nft trading', () => { return snap.length > 0 && snap[0].payload?.walletReference?.confirmed; }); - const indexer = new IndexerPluginClient(helper.walletService!.client); - const nftOutputIds = await indexer.nfts({ addressBech32: address.bech32 }); + const nftOutputIds = await helper.walletService!.client.nftOutputIds([ + { address: address.bech32 }, + ]); expect(nftOutputIds.items.length).toBe(1); const collectionDocRef = build5Db().doc(`${COL.COLLECTION}/${helper.nft?.collection}`); diff --git a/packages/functions/test-tangle/minted-token-airdrop/minted-token-airdrop_2.spec.ts b/packages/functions/test-tangle/minted-token-airdrop/minted-token-airdrop_2.spec.ts index 713372b825..03e7920837 100644 --- a/packages/functions/test-tangle/minted-token-airdrop/minted-token-airdrop_2.spec.ts +++ b/packages/functions/test-tangle/minted-token-airdrop/minted-token-airdrop_2.spec.ts @@ -14,8 +14,7 @@ import { TransactionType, WenError, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { @@ -101,7 +100,7 @@ describe('Minted token airdrop', () => { ); const token = await build5Db().doc(`${COL.TOKEN}/${helper.token!.uid}`).get(); await helper.walletService!.send(guardianAddress, order.payload.targetAddress, 0, { - nativeTokens: [{ id: token.mintingData?.tokenId!, amount: (2).toString(16) }], + nativeTokens: [{ id: token.mintingData?.tokenId!, amount: BigInt(2) }], }); await wait(async () => { @@ -197,9 +196,7 @@ describe('Minted token airdrop', () => { ); await helper.walletService!.send(guardianAddress, order.payload.targetAddress, 0, { - nativeTokens: [ - { id: helper.token?.mintingData?.tokenId!, amount: HexHelper.fromBigInt256(bigInt(600)) }, - ], + nativeTokens: [{ id: helper.token?.mintingData?.tokenId!, amount: BigInt(600) }], }); await wait(async () => { diff --git a/packages/functions/test-tangle/minted-token-trade/Helper.ts b/packages/functions/test-tangle/minted-token-trade/Helper.ts index 09ff284a05..f722a69c27 100644 --- a/packages/functions/test-tangle/minted-token-trade/Helper.ts +++ b/packages/functions/test-tangle/minted-token-trade/Helper.ts @@ -11,8 +11,7 @@ import { TokenTradeOrderType, Transaction, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import { build5Db } from '../../src/firebase/firestore/build5Db'; import { tradeToken } from '../../src/runtime/firebase/token/trading'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; @@ -93,9 +92,7 @@ export class Helper { }); const sellOrder: Transaction = await testEnv.wrap(tradeToken)({}); await this.walletService!.send(this.sellerAddress!, sellOrder.payload.targetAddress!, 0, { - nativeTokens: [ - { amount: HexHelper.fromBigInt256(bigInt(count)), id: this.token!.mintingData?.tokenId! }, - ], + nativeTokens: [{ amount: BigInt(count), id: this.token!.mintingData?.tokenId! }], expiration: expiresAt ? { expiresAt, diff --git a/packages/functions/test-tangle/minted-token-trade/minted-token-trade_16.spec.ts b/packages/functions/test-tangle/minted-token-trade/minted-token-trade_16.spec.ts index 15fa5a18b4..eda1c24ea9 100644 --- a/packages/functions/test-tangle/minted-token-trade/minted-token-trade_16.spec.ts +++ b/packages/functions/test-tangle/minted-token-trade/minted-token-trade_16.spec.ts @@ -8,8 +8,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import { build5Db } from '../../src/firebase/firestore/build5Db'; import { cancelTradeOrder, tradeToken } from '../../src/runtime/firebase/token/trading'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; @@ -42,9 +41,7 @@ describe('Token minting', () => { sellOrder.payload.targetAddress!, 12 * MIN_IOTA_AMOUNT, { - nativeTokens: [ - { amount: HexHelper.fromBigInt256(bigInt(1)), id: helper.token!.mintingData?.tokenId! }, - ], + nativeTokens: [{ amount: BigInt(1), id: helper.token!.mintingData?.tokenId! }], }, ); await wait(async () => { @@ -99,9 +96,7 @@ describe('Token minting', () => { sellOrder.payload.targetAddress!, 12 * MIN_IOTA_AMOUNT, { - nativeTokens: [ - { amount: HexHelper.fromBigInt256(bigInt(1)), id: helper.token!.mintingData?.tokenId! }, - ], + nativeTokens: [{ amount: BigInt(1), id: helper.token!.mintingData?.tokenId! }], }, ); await wait(async () => { diff --git a/packages/functions/test-tangle/minted-token-trade/minted-token-trade_17.spec.ts b/packages/functions/test-tangle/minted-token-trade/minted-token-trade_17.spec.ts index 9297e98859..9f2386ffc2 100644 --- a/packages/functions/test-tangle/minted-token-trade/minted-token-trade_17.spec.ts +++ b/packages/functions/test-tangle/minted-token-trade/minted-token-trade_17.spec.ts @@ -8,8 +8,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import { build5Db } from '../../src/firebase/firestore/build5Db'; import { creditUnrefundable } from '../../src/runtime/firebase/credit/index'; import { tradeToken } from '../../src/runtime/firebase/token/trading'; @@ -38,9 +37,7 @@ describe('Token minting', () => { }); const sellOrder: Transaction = await testEnv.wrap(tradeToken)({}); await helper.walletService!.send(helper.sellerAddress!, sellOrder.payload.targetAddress!, 0, { - nativeTokens: [ - { amount: HexHelper.fromBigInt256(bigInt(10)), id: helper.token!.mintingData?.tokenId! }, - ], + nativeTokens: [{ amount: BigInt(10), id: helper.token!.mintingData?.tokenId! }], storageDepositReturnAddress: helper.sellerAddress?.bech32, }); const query = build5Db() @@ -109,9 +106,7 @@ describe('Token minting', () => { }); const sellOrder: Transaction = await testEnv.wrap(tradeToken)({}); await helper.walletService!.send(helper.sellerAddress!, sellOrder.payload.targetAddress!, 0, { - nativeTokens: [ - { amount: HexHelper.fromBigInt256(bigInt(10)), id: helper.token!.mintingData?.tokenId! }, - ], + nativeTokens: [{ amount: BigInt(10), id: helper.token!.mintingData?.tokenId! }], storageDepositReturnAddress: helper.sellerAddress?.bech32, }); const query = build5Db() diff --git a/packages/functions/test-tangle/minted-token-trade/minted-token-trade_18.spec.ts b/packages/functions/test-tangle/minted-token-trade/minted-token-trade_18.spec.ts index 1203d7a39d..a341e7c6d1 100644 --- a/packages/functions/test-tangle/minted-token-trade/minted-token-trade_18.spec.ts +++ b/packages/functions/test-tangle/minted-token-trade/minted-token-trade_18.spec.ts @@ -8,8 +8,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { dateToTimestamp } from '../../src/utils/dateTime.utils'; @@ -86,9 +85,7 @@ describe('Minted toke trading tangle request', () => { price: MIN_IOTA_AMOUNT, }, }, - nativeTokens: [ - { id: helper.token?.mintingData?.tokenId!, amount: HexHelper.fromBigInt256(bigInt(5)) }, - ], + nativeTokens: [{ id: helper.token?.mintingData?.tokenId!, amount: BigInt(5) }], expiration: expiresAt ? { expiresAt, returnAddressBech32: helper.sellerAddress!.bech32 } : undefined, diff --git a/packages/functions/test-tangle/minted-token-trade/minted-token-trade_3.spec.ts b/packages/functions/test-tangle/minted-token-trade/minted-token-trade_3.spec.ts index e4f7613402..938aa1c6bc 100644 --- a/packages/functions/test-tangle/minted-token-trade/minted-token-trade_3.spec.ts +++ b/packages/functions/test-tangle/minted-token-trade/minted-token-trade_3.spec.ts @@ -10,8 +10,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import dayjs from 'dayjs'; import { cancelExpiredSale } from '../../src/cron/token.cron'; import { build5Db } from '../../src/firebase/firestore/build5Db'; @@ -108,9 +107,7 @@ describe('Token minting', () => { .update({ 'payload.expiresOn': dateToTimestamp(dayjs().subtract(2, 'h').toDate()) }); await helper.walletService!.send(helper.sellerAddress!, sellOrder.payload.targetAddress!, 0, { - nativeTokens: [ - { amount: HexHelper.fromBigInt256(bigInt(10)), id: helper.token!.mintingData?.tokenId! }, - ], + nativeTokens: [{ amount: BigInt(10), id: helper.token!.mintingData?.tokenId! }], expiration: expiresAt ? { expiresAt, diff --git a/packages/functions/test-tangle/minted-token-trade/minted-token-trade_9.spec.ts b/packages/functions/test-tangle/minted-token-trade/minted-token-trade_9.spec.ts index 0c9acc38f6..4198aa4f19 100644 --- a/packages/functions/test-tangle/minted-token-trade/minted-token-trade_9.spec.ts +++ b/packages/functions/test-tangle/minted-token-trade/minted-token-trade_9.spec.ts @@ -7,8 +7,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import { build5Db } from '../../src/firebase/firestore/build5Db'; import { tradeToken } from '../../src/runtime/firebase/token/trading'; import { mockWalletReturnValue, wait } from '../../test/controls/common'; @@ -42,9 +41,7 @@ describe('Token minting', () => { }); const sellOrder = await testEnv.wrap(tradeToken)({}); await helper.walletService!.send(helper.sellerAddress!, sellOrder.payload.targetAddress, 0, { - nativeTokens: [ - { amount: HexHelper.fromBigInt256(bigInt(10)), id: helper.token!.mintingData?.tokenId! }, - ], + nativeTokens: [{ amount: BigInt(10), id: helper.token!.mintingData?.tokenId! }], }); const query = build5Db() diff --git a/packages/functions/test-tangle/nft-bid/nft-bid.otr_1.spec.ts b/packages/functions/test-tangle/nft-bid/nft-bid.otr_1.spec.ts index 4cd4ad9d1e..09d70b159c 100644 --- a/packages/functions/test-tangle/nft-bid/nft-bid.otr_1.spec.ts +++ b/packages/functions/test-tangle/nft-bid/nft-bid.otr_1.spec.ts @@ -8,7 +8,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { INftOutput, IndexerPluginClient, NFT_OUTPUT_TYPE } from '@iota/iota.js-next'; +import { NftOutput } from '@iota/sdk'; import dayjs from 'dayjs'; import { isEmpty } from 'lodash'; import { finalizeAllNftAuctions } from '../../src/cron/nft.cron'; @@ -73,19 +73,12 @@ describe('Nft otr bid', () => { return transaction?.payload?.walletReference?.confirmed; }); - const indexer = new IndexerPluginClient(helper.walletService?.client!); const output = ( - await helper.walletService!.client.output( - ( - await indexer.nft(helper.nft.mintingData?.nftId!) - ).items[0], + await helper.walletService!.client.getOutput( + await helper.walletService!.client.nftOutputId(helper.nft.mintingData?.nftId!), ) ).output; - const ownerAddress = Bech32AddressHelper.addressFromAddressUnlockCondition( - (output as INftOutput).unlockConditions, - 'rms', - NFT_OUTPUT_TYPE, - ); + const ownerAddress = Bech32AddressHelper.bech32FromUnlockConditions(output as NftOutput, 'rms'); expect(ownerAddress).toBe(address.bech32); }); }); diff --git a/packages/functions/test-tangle/nft-staking/Helper.ts b/packages/functions/test-tangle/nft-staking/Helper.ts index f61f851256..60a83ef3d5 100644 --- a/packages/functions/test-tangle/nft-staking/Helper.ts +++ b/packages/functions/test-tangle/nft-staking/Helper.ts @@ -19,16 +19,16 @@ import { UnsoldMintingOptions, } from '@build-5/interfaces'; import { - ADDRESS_UNLOCK_CONDITION_TYPE, - Bech32Helper, - EXPIRATION_UNLOCK_CONDITION_TYPE, - REFERENCE_UNLOCK_TYPE, - STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE, - TAG_FEATURE_TYPE, - TransactionHelper, - UnlockTypes, -} from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; + AddressUnlockCondition, + ExpirationUnlockCondition, + NftOutputBuilderParams, + ReferenceUnlock, + StorageDepositReturnUnlockCondition, + TagFeature, + UTXOInput, + Utils, + utf8ToHex, +} from '@iota/sdk'; import dayjs from 'dayjs'; import { cloneDeep } from 'lodash'; import { build5Db } from '../../src/firebase/firestore/build5Db'; @@ -49,9 +49,8 @@ import { Wallet } from '../../src/services/wallet/wallet'; import { AddressDetails } from '../../src/services/wallet/wallet.service'; import { getAddress } from '../../src/utils/address.utils'; import { mergeOutputs, packBasicOutput } from '../../src/utils/basic-output.utils'; -import { packEssence, packPayload, submitBlock } from '../../src/utils/block.utils'; +import { createUnlock, packEssence, submitBlock } from '../../src/utils/block.utils'; import { EMPTY_NFT_ID } from '../../src/utils/collection-minting-utils/nft.utils'; -import { createUnlock } from '../../src/utils/smr.utils'; import * as wallet from '../../src/utils/wallet.utils'; import { getRandomEthAddress } from '../../src/utils/wallet.utils'; import { @@ -192,73 +191,61 @@ export class Helper { await nftWallet.getNftOutputs(nftId, sourceAddress.bech32), )[0]; - const nftOutput = cloneDeep(consumedNftOutput); - const targetAddress = Bech32Helper.addressFromBech32( - targetAddressBech32, - this.walletService!.info.protocol.bech32Hrp, - ); - nftOutput.unlockConditions = [{ type: ADDRESS_UNLOCK_CONDITION_TYPE, address: targetAddress }]; + const nftOutputParams: NftOutputBuilderParams = cloneDeep(consumedNftOutput); + const targetAddress = Utils.parseBech32Address(targetAddressBech32); + nftOutputParams.unlockConditions = [new AddressUnlockCondition(targetAddress)]; if (tag) { - nftOutput.features = nftOutput.features || []; - nftOutput.features.push({ type: TAG_FEATURE_TYPE, tag: Converter.utf8ToHex(tag, true) }); + nftOutputParams.features = nftOutputParams.features || []; + nftOutputParams.features.push(new TagFeature(utf8ToHex(tag))); } if (expiresOn) { - nftOutput.unlockConditions.push({ - type: EXPIRATION_UNLOCK_CONDITION_TYPE, - returnAddress: Bech32Helper.addressFromBech32( - sourceAddress.bech32, - this.walletService!.info.protocol.bech32Hrp, + nftOutputParams.unlockConditions.push( + new ExpirationUnlockCondition( + Utils.parseBech32Address(sourceAddress.bech32), + dayjs(expiresOn.toDate()).unix(), ), - unixTime: dayjs(expiresOn.toDate()).unix(), - }); + ); } if (storageDeposit) { - nftOutput.unlockConditions.push({ - type: STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE, - returnAddress: Bech32Helper.addressFromBech32( - sourceAddress.bech32, - this.walletService!.info.protocol.bech32Hrp, + nftOutputParams.unlockConditions.push( + new StorageDepositReturnUnlockCondition( + Utils.parseBech32Address(sourceAddress.bech32), + BigInt(nftOutputParams.amount!), ), - amount: nftOutput.amount, - }); + ); } const consumedExtraAmount = extraAmount || expiresOn ? extraAmount || MIN_IOTA_AMOUNT : 0; - nftOutput.amount = (Number(nftOutput.amount) + consumedExtraAmount).toString(); - if (nftOutput.nftId === EMPTY_NFT_ID) { - nftOutput.nftId = TransactionHelper.resolveIdFromOutputId(nftOutputId); + nftOutputParams.amount = (Number(nftOutputParams.amount) + consumedExtraAmount).toString(); + if (nftOutputParams.nftId === EMPTY_NFT_ID) { + nftOutputParams.nftId = Utils.computeNftId(nftOutputId); } const remainderAmount = total - consumedExtraAmount; - const remainder = packBasicOutput( + const remainder = await packBasicOutput( + this.walletService!, sourceAddress.bech32, remainderAmount, - [], - this.walletService!.info, + {}, ); - const inputs = [...Object.keys(outputs), nftOutputId].map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputs = [...Object.keys(outputs), nftOutputId].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([ ...Object.values(outputs), consumedNftOutput, ]); - const essence = packEssence( + const nftOutput = await this.walletService!.client.buildNftOutput(nftOutputParams); + const essence = await packEssence( + this.walletService!, inputs, inputsCommitment, remainderAmount ? [nftOutput, remainder] : [nftOutput], - this.walletService!, {}, ); - const refUnlocks = Object.keys(outputs).map( - () => - ({ - type: REFERENCE_UNLOCK_TYPE, - reference: 0, - } as UnlockTypes), - ); - return await submitBlock( - this.walletService!, - packPayload(essence, [createUnlock(essence, sourceAddress.keyPair), ...refUnlocks]), - ); + const refUnlocks = Object.keys(outputs).map(() => new ReferenceUnlock(0)); + return await submitBlock(this.walletService!, essence, [ + await createUnlock(essence, sourceAddress), + ...refUnlocks, + ]); }; public withdrawNftAndAwait = async (nft: string) => { diff --git a/packages/functions/test-tangle/nft-staking/nft-staking_3.spec.ts b/packages/functions/test-tangle/nft-staking/nft-staking_3.spec.ts index dd0fdb8ce8..d4f726cb2b 100644 --- a/packages/functions/test-tangle/nft-staking/nft-staking_3.spec.ts +++ b/packages/functions/test-tangle/nft-staking/nft-staking_3.spec.ts @@ -7,7 +7,7 @@ import { StakeType, Transaction, } from '@build-5/interfaces'; -import { TIMELOCK_UNLOCK_CONDITION_TYPE } from '@iota/iota.js-next'; +import { UnlockConditionType } from '@iota/sdk'; import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { stakeNft } from '../../src/runtime/firebase/nft'; @@ -77,7 +77,7 @@ describe('Stake nft', () => { expect(Object.keys(nftOutputs).length).toBe(1); const output = Object.values(nftOutputs)[0]; expect( - output.unlockConditions.find((uc) => uc.type === TIMELOCK_UNLOCK_CONDITION_TYPE), + output.unlockConditions.find((uc) => uc.type === UnlockConditionType.Timelock), ).toBeDefined(); const collectionDocRef = build5Db().doc(`${COL.COLLECTION}/${nftStake.collection}`); diff --git a/packages/functions/test-tangle/nft-staking/nft-staking_6.spec.ts b/packages/functions/test-tangle/nft-staking/nft-staking_6.spec.ts index 102db88062..6226f53062 100644 --- a/packages/functions/test-tangle/nft-staking/nft-staking_6.spec.ts +++ b/packages/functions/test-tangle/nft-staking/nft-staking_6.spec.ts @@ -1,11 +1,5 @@ import { COL, KEY_NAME_TANGLE, Network, Nft, StakeType } from '@build-5/interfaces'; -import { - INftOutput, - IndexerPluginClient, - TAG_FEATURE_TYPE, - TransactionHelper, -} from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; +import { NftOutput, NftOutputBuilderParams, TagFeature, Utils, utf8ToHex } from '@iota/sdk'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { stakeNft } from '../../src/runtime/firebase/nft'; import { mockWalletReturnValue, wait } from '../../test/controls/common'; @@ -41,17 +35,18 @@ describe('Stake nft', () => { type: StakeType.DYNAMIC, }); - const indexer = new IndexerPluginClient(helper.walletService!.client); - const items = (await indexer.nft(nft.mintingData?.nftId!)).items; - const nftOutput = (await helper.walletService!.client.output(items[0])).output; + const nftOutputId = await helper.walletService!.client.nftOutputId(nft.mintingData?.nftId!); + const nftOutput = (await helper.walletService!.client.getOutput(nftOutputId)).output; + const nftOutputParams = nftOutput; const tag = KEY_NAME_TANGLE + KEY_NAME_TANGLE + KEY_NAME_TANGLE; - nftOutput.features = nftOutput.features || []; - nftOutput.features.push({ type: TAG_FEATURE_TYPE, tag: Converter.utf8ToHex(tag) }); - const extraAmount = - TransactionHelper.getStorageDeposit( - nftOutput, - helper.walletService!.info.protocol.rentStructure, - ) - Number(nftOutput.amount); + nftOutputParams.features = nftOutput.features || []; + nftOutputParams.features.push(new TagFeature(utf8ToHex(tag))); + const output = await helper.walletService!.client.buildNftOutput(nftOutputParams); + const storageDeposit = Utils.computeStorageDeposit( + output, + helper.walletService!.info.protocol.rentStructure, + ); + const extraAmount = Number(storageDeposit) - Number(nftOutput.amount); const stakeNftOrder = await testEnv.wrap(stakeNft)({}); await helper.sendNftToAddress( helper.guardianAddress!, diff --git a/packages/functions/test-tangle/staking/Helper.ts b/packages/functions/test-tangle/staking/Helper.ts index 5f8d2972d8..c677386886 100644 --- a/packages/functions/test-tangle/staking/Helper.ts +++ b/packages/functions/test-tangle/staking/Helper.ts @@ -17,8 +17,7 @@ import { TransactionPayloadType, calcStakedMultiplier, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import dayjs from 'dayjs'; import { isEmpty } from 'lodash'; import { build5Db } from '../../src/firebase/firestore/build5Db'; @@ -130,7 +129,7 @@ export class Helper { expiration: expiresAt ? { expiresAt, returnAddressBech32: this.memberAddress!.bech32 } : undefined, - nativeTokens: [{ id: this.TOKEN_ID, amount: HexHelper.fromBigInt256(bigInt(amount)) }], + nativeTokens: [{ id: this.TOKEN_ID, amount: BigInt(amount) }], }); await MnemonicService.store(address.bech32, address.mnemonic, Network.RMS); const query = build5Db().collection(COL.STAKE).where('orderId', '==', order.uid); diff --git a/packages/functions/test-tangle/staking/newFile.ts b/packages/functions/test-tangle/staking/newFile.ts new file mode 100644 index 0000000000..619a20c17a --- /dev/null +++ b/packages/functions/test-tangle/staking/newFile.ts @@ -0,0 +1,99 @@ +import { COL, Space, StakeType } from '@build-5/interfaces'; +import { FeatureType, MetadataFeature } from '@iota/sdk'; +import dayjs from 'dayjs'; +import { removeExpiredStakesFromSpace } from '../../src/cron/stake.cron'; +import { build5Db } from '../../src/firebase/firestore/build5Db'; +import { dateToTimestamp } from '../../src/utils/dateTime.utils'; +import { Helper } from './Helper'; + +describe('Staking test', () => { + const helper = new Helper(); + + beforeAll(async () => { + await helper.beforeAll(); + }); + + beforeEach(async () => { + await helper.beforeEach(); + }); + + it('Should stake with metadata', async () => { + const type = StakeType.DYNAMIC; + const customMetadata = { + name: 'random name', + asd: 'true', + }; + await helper.stakeAmount(10, 26, undefined, type, customMetadata); + await helper.validateStatsStakeAmount(10, 10, 14, 14, type, 1); + await helper.validateMemberStakeAmount(10, 10, 14, 14, type); + + const outputs = await helper.walletService!.getOutputs( + helper.memberAddress!.bech32, + [], + false, + true, + ); + expect(Object.keys(outputs).length).toBe(1); + + const hexMetadata = ( + Object.values(outputs)[0].features?.find((t) => t.type === FeatureType.Metadata)! + ); + const decoded = JSON.parse(hexToUtf8(hexMetadata.data)); + expect(decoded.name).toBe(customMetadata.name); + expect(decoded.asd).toBe(customMetadata.asd); + }); + + it.each([StakeType.DYNAMIC, StakeType.STATIC])( + 'Should set stake amount and remove it once expired, 52 weeks', + async (type: StakeType) => { + const spaceDocRef = build5Db().doc(`${COL.SPACE}/${helper.space?.uid}`); + await spaceDocRef.update({ tokenBased: true, minStakedValue: 10 }); + let space = await spaceDocRef.get(); + expect(space.totalMembers).toBe(1); + expect(space.totalGuardians).toBe(1); + + const stake1 = await helper.stakeAmount(10, 52, undefined, type); + await helper.validateStatsStakeAmount(10, 10, 20, 20, type, 1); + await helper.validateMemberStakeAmount(10, 10, 20, 20, type); + + const stake2 = await helper.stakeAmount(20, 52, undefined, type); + await helper.validateStatsStakeAmount(30, 30, 60, 60, type, 1); + await helper.validateMemberStakeAmount(30, 30, 60, 60, type); + + await removeExpiredStakesFromSpace(); + await helper.validateStatsStakeAmount(30, 30, 60, 60, type, 1); + await helper.validateMemberStakeAmount(30, 30, 60, 60, type); + + await build5Db() + .doc(`${COL.STAKE}/${stake2.uid}`) + .update({ expiresAt: dateToTimestamp(dayjs().subtract(1, 'm').toDate()) }); + await removeExpiredStakesFromSpace(); + await helper.validateStatsStakeAmount(10, 30, 20, 60, type, 1); + await helper.validateMemberStakeAmount(10, 30, 20, 60, type); + + await build5Db() + .doc(`${COL.STAKE}/${stake1.uid}`) + .update({ expiresAt: dateToTimestamp(dayjs().subtract(1, 'm').toDate()) }); + await removeExpiredStakesFromSpace(); + await helper.validateStatsStakeAmount(0, 30, 0, 60, type, 0); + await helper.validateMemberStakeAmount(0, 30, 0, 60, type); + + space = await spaceDocRef.get(); + expect(space.totalMembers).toBe(1); + expect(space.totalGuardians).toBe(1); + + const outputs = await helper.walletService!.getOutputs( + helper.memberAddress!.bech32, + [], + false, + true, + ); + expect(Object.keys(outputs).length).toBe(2); + const hasTimelock = Object.values(outputs).filter( + (o) => + o.unlockConditions.find((u) => u.type === TIMELOCK_UNLOCK_CONDITION_TYPE) !== undefined, + ); + expect(hasTimelock.length).toBe(2); + }, + ); +}); diff --git a/packages/functions/test-tangle/staking/staking_1.spec.ts b/packages/functions/test-tangle/staking/staking_1.spec.ts index 013c1b2875..a4f23d438d 100644 --- a/packages/functions/test-tangle/staking/staking_1.spec.ts +++ b/packages/functions/test-tangle/staking/staking_1.spec.ts @@ -9,9 +9,8 @@ import { TransactionType, WenError, } from '@build-5/interfaces'; -import { TIMELOCK_UNLOCK_CONDITION_TYPE } from '@iota/iota.js-next'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + +import { UnlockConditionType } from '@iota/sdk'; import dayjs from 'dayjs'; import { removeExpiredStakesFromSpace } from '../../src/cron/stake.cron'; import { build5Db } from '../../src/firebase/firestore/build5Db'; @@ -148,8 +147,7 @@ describe('Staking test', () => { ); expect(Object.keys(outputs).length).toBe(2); const hasTimelock = Object.values(outputs).filter( - (o) => - o.unlockConditions.find((u) => u.type === TIMELOCK_UNLOCK_CONDITION_TYPE) !== undefined, + (o) => o.unlockConditions.find((u) => u.type === UnlockConditionType.Timelock) !== undefined, ); expect(hasTimelock.length).toBe(2); }); @@ -179,7 +177,7 @@ describe('Staking test', () => { order.payload.amount, { expiration: { expiresAt, returnAddressBech32: helper.memberAddress!.bech32 }, - nativeTokens: [{ id: helper.TOKEN_ID, amount: HexHelper.fromBigInt256(bigInt(10)) }], + nativeTokens: [{ id: helper.TOKEN_ID, amount: BigInt(10) }], }, ); await MnemonicService.store( diff --git a/packages/functions/test-tangle/staking/staking_2.spec.ts b/packages/functions/test-tangle/staking/staking_2.spec.ts index 6a68be292c..a7ca7ffc27 100644 --- a/packages/functions/test-tangle/staking/staking_2.spec.ts +++ b/packages/functions/test-tangle/staking/staking_2.spec.ts @@ -1,10 +1,5 @@ import { COL, Space, StakeType } from '@build-5/interfaces'; -import { - IMetadataFeature, - METADATA_FEATURE_TYPE, - TIMELOCK_UNLOCK_CONDITION_TYPE, -} from '@iota/iota.js-next'; -import { Converter } from '@iota/util.js-next'; +import { FeatureType, MetadataFeature, UnlockConditionType, hexToUtf8 } from '@iota/sdk'; import dayjs from 'dayjs'; import { removeExpiredStakesFromSpace } from '../../src/cron/stake.cron'; import { build5Db } from '../../src/firebase/firestore/build5Db'; @@ -40,10 +35,10 @@ describe('Staking test', () => { ); expect(Object.keys(outputs).length).toBe(1); - const hexMetadata = ( - Object.values(outputs)[0].features?.find((t) => t.type === METADATA_FEATURE_TYPE)! + const hexMetadata = ( + Object.values(outputs)[0].features?.find((t) => t.type === FeatureType.Metadata)! ); - const decoded = JSON.parse(Converter.hexToUtf8(hexMetadata.data)); + const decoded = JSON.parse(hexToUtf8(hexMetadata.data)); expect(decoded.name).toBe(customMetadata.name); expect(decoded.asd).toBe(customMetadata.asd); }); @@ -96,7 +91,7 @@ describe('Staking test', () => { expect(Object.keys(outputs).length).toBe(2); const hasTimelock = Object.values(outputs).filter( (o) => - o.unlockConditions.find((u) => u.type === TIMELOCK_UNLOCK_CONDITION_TYPE) !== undefined, + o.unlockConditions.find((u) => u.type === UnlockConditionType.Timelock) !== undefined, ); expect(hasTimelock.length).toBe(2); }, diff --git a/packages/functions/test-tangle/staking/staking_4.spec.ts b/packages/functions/test-tangle/staking/staking_4.spec.ts index 022542139e..0ea42a477f 100644 --- a/packages/functions/test-tangle/staking/staking_4.spec.ts +++ b/packages/functions/test-tangle/staking/staking_4.spec.ts @@ -13,7 +13,6 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { addressBalance } from '@iota/iota.js-next'; import dayjs from 'dayjs'; import { isEmpty } from 'lodash'; import { stakeRewardCronTask } from '../../src/cron/stakeReward.cron'; @@ -258,11 +257,8 @@ describe('Stake reward test test', () => { ); await wait(async () => { - const balance = await addressBalance( - helper.walletService!.client, - helper.space!.vaultAddress!, - ); - return !isEmpty(balance.nativeTokens); + const { nativeTokens } = await helper.walletService!.getBalance(helper.space!.vaultAddress!); + return !isEmpty(nativeTokens); }); if (failed) { diff --git a/packages/functions/test-tangle/staking/staking_5.spec.ts b/packages/functions/test-tangle/staking/staking_5.spec.ts index 1d728993f2..ef014f7f0c 100644 --- a/packages/functions/test-tangle/staking/staking_5.spec.ts +++ b/packages/functions/test-tangle/staking/staking_5.spec.ts @@ -8,8 +8,7 @@ import { TokenDistribution, Transaction, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import { build5Db } from '../../src/firebase/firestore/build5Db'; import { wait } from '../../test/controls/common'; import { getTangleOrder } from '../common'; @@ -43,9 +42,7 @@ describe('Stake reward test test', () => { ); await helper.walletService!.send(tmp, tangleOrder.payload.targetAddress!, MIN_IOTA_AMOUNT, { - nativeTokens: [ - { id: helper.token?.mintingData?.tokenId!, amount: HexHelper.fromBigInt256(bigInt(100)) }, - ], + nativeTokens: [{ id: helper.token?.mintingData?.tokenId!, amount: BigInt(100) }], customMetadata: { request: { requestType: TangleRequestType.STAKE, diff --git a/packages/functions/test-tangle/token.based.voting/Helper.ts b/packages/functions/test-tangle/token.based.voting/Helper.ts index 0e2b8d7771..618acea1a3 100644 --- a/packages/functions/test-tangle/token.based.voting/Helper.ts +++ b/packages/functions/test-tangle/token.based.voting/Helper.ts @@ -12,8 +12,7 @@ import { Transaction, TransactionType, } from '@build-5/interfaces'; -import { HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + import dayjs from 'dayjs'; import { set } from 'lodash'; import { build5Db } from '../../src/firebase/firestore/build5Db'; @@ -102,7 +101,7 @@ export class Helper { baseTokenAmount = 0, ) => { await this.walletService!.send(sourceAddress, targetAddress, baseTokenAmount, { - nativeTokens: [{ id: MINTED_TOKEN_ID, amount: HexHelper.fromBigInt256(bigInt(tokenAmount)) }], + nativeTokens: [{ id: MINTED_TOKEN_ID, amount: BigInt(tokenAmount) }], }); await MnemonicService.store(sourceAddress.bech32, sourceAddress.mnemonic, Network.RMS); }; diff --git a/packages/functions/test-tangle/token.claim.minted.spec.ts b/packages/functions/test-tangle/token.claim.minted.spec.ts index 4dc6f10179..e55be0244f 100644 --- a/packages/functions/test-tangle/token.claim.minted.spec.ts +++ b/packages/functions/test-tangle/token.claim.minted.spec.ts @@ -15,7 +15,6 @@ import { TransactionType, WenError, } from '@build-5/interfaces'; -import { addressBalance } from '@iota/iota.js-next'; import dayjs from 'dayjs'; import { isEmpty } from 'lodash'; import { retryWallet } from '../src/cron/wallet.cron'; @@ -287,7 +286,7 @@ describe('Token minting', () => { token = await tokenDocRef.get(); await wait(async () => { - const balance = await addressBalance(walletService.client, token.mintingData?.vaultAddress); + const balance = await walletService.getBalance(token.mintingData?.vaultAddress); return Number(Object.values(balance.nativeTokens)[0]) === 1; }); diff --git a/packages/functions/test-tangle/token.mint/Helper.ts b/packages/functions/test-tangle/token.mint/Helper.ts index 49fab4c362..5aa8345626 100644 --- a/packages/functions/test-tangle/token.mint/Helper.ts +++ b/packages/functions/test-tangle/token.mint/Helper.ts @@ -1,30 +1,28 @@ import { COL, Member, Network, SUB_COL, Space, Token, TokenStatus } from '@build-5/interfaces'; + import { - ALIAS_UNLOCK_TYPE, - Bech32Helper, - ED25519_ADDRESS_TYPE, - IAliasOutput, - IEd25519Address, - IFoundryOutput, - IGovernorAddressUnlockCondition, - IMetadataFeature, - IndexerPluginClient, - METADATA_FEATURE_TYPE, - REFERENCE_UNLOCK_TYPE, - TransactionHelper, - UnlockTypes, -} from '@iota/iota.js-next'; -import { Converter, HexHelper } from '@iota/util.js-next'; -import bigInt from 'big-integer'; + AliasOutput, + AliasOutputBuilderParams, + AliasUnlock, + Ed25519Address, + FeatureType, + FoundryOutput, + GovernorAddressUnlockCondition, + MetadataFeature, + ReferenceUnlock, + UTXOInput, + Unlock, + Utils, + hexToUtf8, +} from '@iota/sdk'; import { cloneDeep } from 'lodash'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { Wallet } from '../../src/services/wallet/wallet'; import { AddressDetails } from '../../src/services/wallet/wallet.service'; import { getAddress } from '../../src/utils/address.utils'; import { packBasicOutput } from '../../src/utils/basic-output.utils'; -import { packEssence, packPayload, submitBlock } from '../../src/utils/block.utils'; +import { createUnlock, packEssence, submitBlock } from '../../src/utils/block.utils'; import { serverTime } from '../../src/utils/dateTime.utils'; -import { createUnlock } from '../../src/utils/smr.utils'; import * as wallet from '../../src/utils/wallet.utils'; import { getRandomEthAddress } from '../../src/utils/wallet.utils'; import { createMember, createSpace, getRandomSymbol } from '../../test/controls/common'; @@ -105,83 +103,79 @@ export class Helper { .map((o) => o.nativeTokens![0].amount) .reduce((acc, act) => acc + Number(act), 0); - const indexer = new IndexerPluginClient(wallet.client); - const aliasOutputId = (await indexer.alias(token.mintingData?.aliasId!)).items[0]; - const aliasOutput = (await wallet.client.output(aliasOutputId)).output; + const aliasOutputId = await this.walletService.client.aliasOutputId( + token.mintingData?.aliasId!, + ); + const aliasOutput = (await wallet.client.getOutput(aliasOutputId)).output; - const foundryOutputId = (await indexer.foundry(token.mintingData?.tokenId!)).items[0]; - const foundryOutput = (await wallet.client.output(foundryOutputId)).output; + const foundryOutputId = await this.walletService.client.foundryOutputId( + token.mintingData?.tokenId!, + ); + const foundryOutput = (await wallet.client.getOutput(foundryOutputId)).output; - const nextAliasOutput = cloneDeep(aliasOutput); - nextAliasOutput.stateIndex++; + const nextAliasOutput: AliasOutputBuilderParams = cloneDeep(aliasOutput); + nextAliasOutput.stateIndex!++; - const nextFoundryOutput = cloneDeep(foundryOutput); - nextFoundryOutput.tokenScheme.meltedTokens = HexHelper.fromBigInt256(bigInt(amount)); + const nextFoundryOutput: any = cloneDeep(foundryOutput); + nextFoundryOutput.tokenScheme.meltedTokens = BigInt(amount); - const output = packBasicOutput( - fromAddress, - 0, - [ - { - amount: HexHelper.fromBigInt256(bigInt(nativeTokens - amount)), - id: token.mintingData?.tokenId!, - }, - ], - wallet.info, - ); + const output = await packBasicOutput(this.walletService, fromAddress, 0, { + nativeTokens: [{ amount: BigInt(nativeTokens - amount), id: token.mintingData?.tokenId! }], + }); const inputs = [aliasOutputId, foundryOutputId, ...Object.keys(outputs)].map( - TransactionHelper.inputFromOutputId, + UTXOInput.fromOutputId, ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputsCommitment = Utils.computeInputsCommitment([ aliasOutput, foundryOutput, ...Object.values(outputs), ]); - const essence = packEssence( + const essence = await packEssence( + this.walletService, inputs, inputsCommitment, - [nextAliasOutput, nextFoundryOutput, output], - wallet, + [ + await this.walletService.client.buildAliasOutput(nextAliasOutput), + nextFoundryOutput, + output, + ], {}, ); const address = await wallet.getAddressDetails(fromAddress); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, address.keyPair), - { type: ALIAS_UNLOCK_TYPE, reference: 0 }, - { type: REFERENCE_UNLOCK_TYPE, reference: 0 }, + const unlocks: Unlock[] = [ + await createUnlock(essence, address), + new AliasUnlock(0), + new ReferenceUnlock(0), ]; - return await submitBlock(wallet, packPayload(essence, unlocks)); + return await submitBlock(wallet, essence, unlocks); }; } export const getAliasOutput = async (wallet: Wallet, aliasId: string) => { - const indexer = new IndexerPluginClient(wallet.client); - const response = await indexer.alias(aliasId); - const outputResponse = await wallet.client.output(response.items[0]); - return outputResponse.output as IAliasOutput; + const aliasOutputId = await wallet.client.aliasOutputId(aliasId); + const outputResponse = await wallet.client.getOutput(aliasOutputId); + return outputResponse.output as AliasOutput; }; -export const getStateAndGovernorAddress = async (wallet: Wallet, alias: IAliasOutput) => { +export const getStateAndGovernorAddress = async (wallet: Wallet, alias: AliasOutput) => { const hrp = wallet.info.protocol.bech32Hrp; - return (alias.unlockConditions as IGovernorAddressUnlockCondition[]) - .map((uc) => (uc.address as IEd25519Address).pubKeyHash) - .map((pubHash) => - Bech32Helper.toBech32(ED25519_ADDRESS_TYPE, Converter.hexToBytes(pubHash), hrp), - ); + return (alias.unlockConditions as GovernorAddressUnlockCondition[]) + .map((uc) => (uc.address as Ed25519Address).pubKeyHash) + .map((pubHash) => Utils.hexPublicKeyToBech32Address(pubHash, hrp)); }; -export const getFoundryMetadata = (foundry: IFoundryOutput | undefined) => { +export const getFoundryMetadata = (foundry: FoundryOutput | undefined) => { try { - const hexMetadata = ( - foundry?.immutableFeatures?.find((f) => f.type === METADATA_FEATURE_TYPE) + const hexMetadata = ( + foundry?.immutableFeatures?.find((f) => f.type === FeatureType.Metadata) ); if (!hexMetadata?.data) { return {}; } - return JSON.parse(Converter.hexToUtf8(hexMetadata.data) || '{}'); + return JSON.parse(hexToUtf8(hexMetadata.data) || '{}'); } catch { return {}; } diff --git a/packages/functions/test-tangle/token.mint/token.mint_1.spec.ts b/packages/functions/test-tangle/token.mint/token.mint_1.spec.ts index e6d0965a20..6004cee773 100644 --- a/packages/functions/test-tangle/token.mint/token.mint_1.spec.ts +++ b/packages/functions/test-tangle/token.mint/token.mint_1.spec.ts @@ -10,7 +10,7 @@ import { TransactionPayloadType, TransactionType, } from '@build-5/interfaces'; -import { IFoundryOutput, IndexerPluginClient, addressBalance } from '@iota/iota.js-next'; +import { FoundryOutput } from '@iota/sdk'; import dayjs from 'dayjs'; import { isEqual } from 'lodash'; import { build5Db } from '../../src/firebase/firestore/build5Db'; @@ -70,16 +70,14 @@ describe('Token minting', () => { expect(helper.token.tradingDisabled).toBe(!hasExpiration); await wait(async () => { - const balance = await addressBalance( - helper.walletService.client, + const { nativeTokens } = await helper.walletService!.getBalance( helper.token.mintingData?.vaultAddress!, ); - return Number(Object.values(balance.nativeTokens)[0]) === 1000; + return Number(Object.values(nativeTokens)[0]) === 1000; }); const guardianData = await build5Db().doc(`${COL.MEMBER}/${helper.guardian.uid}`).get(); await wait(async () => { - const balance = await addressBalance( - helper.walletService.client, + const balance = await helper.walletService.getBalance( getAddress(guardianData, helper.network), ); return Number(Object.values(balance.nativeTokens)[0]) === 500; @@ -118,10 +116,11 @@ describe('Token minting', () => { ); expect(aliasTransferTran?.payload?.amount).toBe(helper.token.mintingData?.aliasStorageDeposit); - const indexer = new IndexerPluginClient(helper.walletService.client); - const foundryOutputId = (await indexer.foundry(helper.token.mintingData?.tokenId!)).items[0]; - const foundryOutput = (await helper.walletService.client.output(foundryOutputId)).output; - const metadata = getFoundryMetadata(foundryOutput as IFoundryOutput); + const foundryOutputId = await helper.walletService.client.foundryOutputId( + helper.token.mintingData?.tokenId!, + ); + const foundryOutput = (await helper.walletService.client.getOutput(foundryOutputId)).output; + const metadata = getFoundryMetadata(foundryOutput as FoundryOutput); expect(metadata.standard).toBe('IRC30'); expect(metadata.type).toBe('image/png'); expect(metadata.name).toBe(helper.token.name); diff --git a/packages/functions/test-tangle/token.mint/token.mint_2.spec.ts b/packages/functions/test-tangle/token.mint/token.mint_2.spec.ts index 29b9dc671a..25a7223578 100644 --- a/packages/functions/test-tangle/token.mint/token.mint_2.spec.ts +++ b/packages/functions/test-tangle/token.mint/token.mint_2.spec.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { COL, Member, Token, TokenStatus, TransactionType, WenError } from '@build-5/interfaces'; -import { addressBalance } from '@iota/iota.js-next'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { mintTokenOrder } from '../../src/runtime/firebase/token/minting'; import { getAddress } from '../../src/utils/address.utils'; @@ -37,8 +36,8 @@ describe('Token minting', () => { const guardianData = await build5Db().doc(`${COL.MEMBER}/${helper.guardian.uid}`).get(); const guardianAddress = getAddress(guardianData, helper.network); await wait(async () => { - const balance = await addressBalance(helper.walletService.client, guardianAddress); - return Number(Object.values(balance.nativeTokens)[0]) === 500; + const { nativeTokens } = await helper.walletService.getBalance(guardianAddress); + return Number(Object.values(nativeTokens)[0]) === 500; }); await helper.meltMintedToken(helper.walletService, helper.token, 250, guardianAddress); diff --git a/packages/functions/test-tangle/transaction-trigger/transaction-trigger_12.spec.ts b/packages/functions/test-tangle/transaction-trigger/transaction-trigger_12.spec.ts index 98715ec78a..adaa8a9459 100644 --- a/packages/functions/test-tangle/transaction-trigger/transaction-trigger_12.spec.ts +++ b/packages/functions/test-tangle/transaction-trigger/transaction-trigger_12.spec.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { COL, MIN_IOTA_AMOUNT, Network, Transaction, TransactionType } from '@build-5/interfaces'; -import { ITransactionPayload, TransactionHelper } from '@iota/iota.js-next'; +import { RegularTransactionEssence, TransactionPayload, UTXOInput, Utils } from '@iota/sdk'; import dayjs from 'dayjs'; import { isEmpty } from 'lodash'; import { retryWallet } from '../../src/cron/wallet.cron'; @@ -72,14 +72,15 @@ describe('Transaction trigger spec', () => { consumedOutputIds = []; - const block = await wallet.client.block(billPayment.payload.walletReference!.chainReference!); - const inputs = (block.payload as ITransactionPayload).essence.inputs; - consumedOutputIds = inputs.map((input) => - TransactionHelper.outputIdFromTransactionData( - input.transactionId, - input.transactionOutputIndex, - ), + const block = await wallet.client.getBlock( + billPayment.payload.walletReference!.chainReference!, ); + const payload = block.payload as TransactionPayload; + const inputs = (payload.essence as RegularTransactionEssence).inputs; + consumedOutputIds = inputs.map((i) => { + const { transactionId, transactionOutputIndex } = i as UTXOInput; + return Utils.computeOutputId(transactionId, transactionOutputIndex); + }); expect(outputIds.sort()).toEqual(consumedOutputIds.sort()); }, ); diff --git a/packages/functions/test-tangle/transaction-trigger/transaction-trigger_2.spec.ts b/packages/functions/test-tangle/transaction-trigger/transaction-trigger_2.spec.ts index f6f42be29f..cfefbe97b8 100644 --- a/packages/functions/test-tangle/transaction-trigger/transaction-trigger_2.spec.ts +++ b/packages/functions/test-tangle/transaction-trigger/transaction-trigger_2.spec.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { COL, MIN_IOTA_AMOUNT, Network, Transaction, TransactionType } from '@build-5/interfaces'; -import { STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE } from '@iota/iota.js-next'; +import { UnlockConditionType } from '@iota/sdk'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { AddressDetails } from '../../src/services/wallet/wallet.service'; import { serverTime } from '../../src/utils/dateTime.utils'; @@ -55,7 +55,7 @@ describe('Transaction trigger spec', () => { expect(Object.values(outputs).length).toBe(1); const hasStorageUnlock = Object.values(outputs)[0].unlockConditions.find( - (u) => u.type === STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE, + (u) => u.type === UnlockConditionType.StorageDepositReturn, ) !== undefined; expect(hasStorageUnlock).toBe(true); }); diff --git a/packages/functions/test-tangle/transaction-trigger/transaction-trigger_3.spec.ts b/packages/functions/test-tangle/transaction-trigger/transaction-trigger_3.spec.ts index 4a61b230e7..f1323a4db3 100644 --- a/packages/functions/test-tangle/transaction-trigger/transaction-trigger_3.spec.ts +++ b/packages/functions/test-tangle/transaction-trigger/transaction-trigger_3.spec.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { COL, MIN_IOTA_AMOUNT, Network, Transaction, TransactionType } from '@build-5/interfaces'; -import { addressBalance } from '@iota/iota.js-next'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; import { AddressDetails } from '../../src/services/wallet/wallet.service'; @@ -34,12 +33,9 @@ describe('Transaction trigger spec', () => { const vaultAddress = await wallet.getIotaAddressDetails(VAULT_MNEMONIC); await MnemonicService.store(vaultAddress.bech32, vaultAddress.mnemonic); - const output = packBasicOutput( - targetAddress.bech32, - 0, - [{ amount: '0x1', id: MINTED_TOKEN_ID }], - wallet.info, - ); + const output = await packBasicOutput(wallet, targetAddress.bech32, 0, { + nativeTokens: [{ amount: BigInt('0x1'), id: MINTED_TOKEN_ID }], + }); await requestFundsFromFaucet(network, sourceAddress.bech32, Number(output.amount)); let billPayment: Transaction = { @@ -49,7 +45,7 @@ describe('Transaction trigger spec', () => { network, payload: { amount: Number(output.amount), - nativeTokens: [{ amount: '1', id: MINTED_TOKEN_ID }], + nativeTokens: [{ amount: BigInt(1), id: MINTED_TOKEN_ID }], storageDepositSourceAddress: sourceAddress.bech32, sourceAddress: vaultAddress.bech32, targetAddress: targetAddress.bech32, @@ -59,12 +55,12 @@ describe('Transaction trigger spec', () => { await build5Db().doc(`${COL.TRANSACTION}/${billPayment.uid}`).create(billPayment); await wait(async () => { - const balance = await addressBalance(wallet.client, targetAddress.bech32); + const balance = await wallet.getBalance(targetAddress.bech32); return Number(Object.values(balance.nativeTokens)[0]) === 1; }); await wait(async () => { - const balance = await addressBalance(wallet.client, sourceAddress.bech32); - return Number(balance.balance) === MIN_IOTA_AMOUNT; + const balance = await wallet.getBalance(sourceAddress.bech32); + return Number(balance.amount) === MIN_IOTA_AMOUNT; }); await wait(async () => { diff --git a/packages/functions/test-tangle/transaction-trigger/transaction-trigger_4.spec.ts b/packages/functions/test-tangle/transaction-trigger/transaction-trigger_4.spec.ts index 1887bd9764..c4dc994acc 100644 --- a/packages/functions/test-tangle/transaction-trigger/transaction-trigger_4.spec.ts +++ b/packages/functions/test-tangle/transaction-trigger/transaction-trigger_4.spec.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { COL, MIN_IOTA_AMOUNT, Network, Transaction, TransactionType } from '@build-5/interfaces'; -import { addressBalance } from '@iota/iota.js-next'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { MnemonicService } from '../../src/services/wallet/mnemonic'; import { AddressDetails } from '../../src/services/wallet/wallet.service'; @@ -34,12 +33,9 @@ describe('Transaction trigger spec', () => { const vaultAddress = await wallet.getIotaAddressDetails(VAULT_MNEMONIC); await MnemonicService.store(vaultAddress.bech32, vaultAddress.mnemonic); - const output = packBasicOutput( - targetAddress.bech32, - 0, - [{ amount: '0x1', id: MINTED_TOKEN_ID }], - wallet.info, - ); + const output = await packBasicOutput(wallet, targetAddress.bech32, 0, { + nativeTokens: [{ amount: BigInt(1), id: MINTED_TOKEN_ID }], + }); await requestFundsFromFaucet(network, sourceAddress.bech32, Number(output.amount)); let billPayment: Transaction = { @@ -49,7 +45,7 @@ describe('Transaction trigger spec', () => { network, payload: { amount: Number(output.amount), - nativeTokens: [{ amount: '1', id: MINTED_TOKEN_ID }], + nativeTokens: [{ amount: BigInt(1), id: MINTED_TOKEN_ID }], storageDepositSourceAddress: sourceAddress.bech32, sourceAddress: vaultAddress.bech32, targetAddress: targetAddress.bech32, @@ -58,7 +54,7 @@ describe('Transaction trigger spec', () => { }; await build5Db().doc(`${COL.TRANSACTION}/${billPayment.uid}`).create(billPayment); await wait(async () => { - const balance = await addressBalance(wallet.client, targetAddress.bech32); + const balance = await wallet.getBalance(targetAddress.bech32); return Number(Object.values(balance.nativeTokens)[0]) === 1; }); @@ -69,7 +65,7 @@ describe('Transaction trigger spec', () => { network, payload: { amount: Number(output.amount), - nativeTokens: [{ amount: '1', id: MINTED_TOKEN_ID }], + nativeTokens: [{ amount: BigInt(1), id: MINTED_TOKEN_ID }], sourceAddress: targetAddress.bech32, targetAddress: sourceAddress.bech32, void: false, @@ -77,7 +73,7 @@ describe('Transaction trigger spec', () => { }; await build5Db().doc(`${COL.TRANSACTION}/${credit.uid}`).create(credit); await wait(async () => { - const balance = await addressBalance(wallet.client, sourceAddress.bech32); + const balance = await wallet.getBalance(sourceAddress.bech32); return Number(Object.values(balance.nativeTokens)[0]) === 1; }); diff --git a/packages/functions/test-tangle/withdraw-deposit-nft/Helper.ts b/packages/functions/test-tangle/withdraw-deposit-nft/Helper.ts index 02a83f059b..f483efcfce 100644 --- a/packages/functions/test-tangle/withdraw-deposit-nft/Helper.ts +++ b/packages/functions/test-tangle/withdraw-deposit-nft/Helper.ts @@ -21,13 +21,14 @@ import { UnsoldMintingOptions, } from '@build-5/interfaces'; import { - ADDRESS_UNLOCK_CONDITION_TYPE, - Bech32Helper, - EXPIRATION_UNLOCK_CONDITION_TYPE, - REFERENCE_UNLOCK_TYPE, - STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE, - TransactionHelper, -} from '@iota/iota.js-next'; + AddressUnlockCondition, + ExpirationUnlockCondition, + NftOutputBuilderParams, + ReferenceUnlock, + StorageDepositReturnUnlockCondition, + UTXOInput, + Utils, +} from '@iota/sdk'; import dayjs from 'dayjs'; import { cloneDeep } from 'lodash'; import { build5Db } from '../../src/firebase/firestore/build5Db'; @@ -48,9 +49,8 @@ import { MnemonicService } from '../../src/services/wallet/mnemonic'; import { Wallet } from '../../src/services/wallet/wallet'; import { AddressDetails } from '../../src/services/wallet/wallet.service'; import { getAddress } from '../../src/utils/address.utils'; -import { packEssence, packPayload, submitBlock } from '../../src/utils/block.utils'; +import { createUnlock, packEssence, submitBlock } from '../../src/utils/block.utils'; import { serverTime } from '../../src/utils/dateTime.utils'; -import { createUnlock } from '../../src/utils/smr.utils'; import * as wallet from '../../src/utils/wallet.utils'; import { getRandomEthAddress } from '../../src/utils/wallet.utils'; import { @@ -207,51 +207,46 @@ export class Helper { await nftWallet.getNftOutputs(undefined, sourceAddress.bech32), )[0]; - const nftOutput = cloneDeep(consumedNftOutput); - const targetAddress = Bech32Helper.addressFromBech32( - targetAddressBech32, - this.walletService!.info.protocol.bech32Hrp, - ); - nftOutput.unlockConditions = [{ type: ADDRESS_UNLOCK_CONDITION_TYPE, address: targetAddress }]; + const nftOutput: NftOutputBuilderParams = cloneDeep(consumedNftOutput); + const targetAddress = Utils.parseBech32Address(targetAddressBech32); + nftOutput.unlockConditions = [new AddressUnlockCondition(targetAddress)]; nftOutput.amount = (Number(nftOutput.amount) + total).toString(); + nftOutput.unlockConditions.push( + new ExpirationUnlockCondition( + Utils.parseBech32Address(sourceAddress.bech32), + dayjs(expiresOn.toDate()).unix(), + ), + ); + if (storageReturnAddress) { - nftOutput.unlockConditions.push({ - type: STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE, - amount: TransactionHelper.getStorageDeposit( - nftOutput, - this.walletService!.info.protocol.rentStructure, - ).toString(), - returnAddress: Bech32Helper.addressFromBech32( - storageReturnAddress, - this.walletService!.info.protocol.bech32Hrp, + const storageDeposit = Utils.computeStorageDeposit( + await this.walletService!.client.buildNftOutput(nftOutput), + this.walletService!.info.protocol.rentStructure, + ); + nftOutput.unlockConditions.push( + new StorageDepositReturnUnlockCondition( + Utils.parseBech32Address(storageReturnAddress), + storageDeposit, ), - }); + ); } - nftOutput.unlockConditions.push({ - type: EXPIRATION_UNLOCK_CONDITION_TYPE, - returnAddress: Bech32Helper.addressFromBech32( - sourceAddress.bech32, - this.walletService!.info.protocol.bech32Hrp, - ), - unixTime: dayjs(expiresOn.toDate()).unix(), - }); - - const inputs = [...Object.keys(outputs), nftOutputId].map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputs = [...Object.keys(outputs), nftOutputId].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([ ...Object.values(outputs), consumedNftOutput, ]); - const essence = packEssence(inputs, inputsCommitment, [nftOutput], this.walletService!, {}); - - return await submitBlock( + const essence = await packEssence( this.walletService!, - packPayload(essence, [ - createUnlock(essence, sourceAddress.keyPair), - { type: REFERENCE_UNLOCK_TYPE, reference: 0 }, - ]), + inputs, + inputsCommitment, + [await this.walletService!.client.buildNftOutput(nftOutput)], + {}, ); + + const unlocks = [await createUnlock(essence, sourceAddress), new ReferenceUnlock(0)]; + return await submitBlock(this.walletService!, essence, unlocks); }; public withdrawNftAndAwait = async (nft: string) => { diff --git a/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_a.spec.ts b/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_a.spec.ts index 7e4b426b79..ed43de4327 100644 --- a/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_a.spec.ts +++ b/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_a.spec.ts @@ -8,23 +8,24 @@ import { WenError, } from '@build-5/interfaces'; import { - AddressTypes, - ED25519_ADDRESS_TYPE, - INftAddress, - NFT_ADDRESS_TYPE, - REFERENCE_UNLOCK_TYPE, - TransactionHelper, - UnlockTypes, -} from '@iota/iota.js-next'; + Ed25519Address, + NftAddress, + NftOutputBuilderParams, + Output, + ReferenceUnlock, + TransactionPayload, + UTXOInput, + Unlock, + Utils, +} from '@iota/sdk'; import { cloneDeep } from 'lodash'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { depositNft } from '../../src/runtime/firebase/nft'; import { NftWallet } from '../../src/services/wallet/NftWallet'; import { AddressDetails, WalletService } from '../../src/services/wallet/wallet.service'; import { packBasicOutput } from '../../src/utils/basic-output.utils'; -import { indexToString, packEssence, packPayload, submitBlock } from '../../src/utils/block.utils'; +import { createUnlock, indexToString, packEssence, submitBlock } from '../../src/utils/block.utils'; import { EMPTY_NFT_ID, createNftOutput } from '../../src/utils/collection-minting-utils/nft.utils'; -import { createUnlock, getTransactionPayloadHex } from '../../src/utils/smr.utils'; import { mockWalletReturnValue, wait } from '../../test/controls/common'; import { testEnv } from '../../test/set-up'; import { awaitLedgerInclusionState, requestFundsFromFaucet } from '../faucet'; @@ -104,30 +105,28 @@ const mintCustomCollection = async (address: AddressDetails, metadata: any) => { 0, ); - const issuerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: address.hex }; - const collectionOutput = createNftOutput( + const issuerAddress = new Ed25519Address(address.hex); + const collectionOutput = await createNftOutput( + wallet, issuerAddress, issuerAddress, JSON.stringify(metadata), - wallet.info, ); const remainderAmount = totalAmount - Number(collectionOutput.amount); - const remainder = packBasicOutput(address.bech32, remainderAmount, [], wallet.info); + const remainder = await packBasicOutput(wallet, address.bech32, remainderAmount, {}); - const inputs = Object.keys(consumedOutputs).map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment(Object.values(consumedOutputs)); + const inputs = Object.keys(consumedOutputs).map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment(Object.values(consumedOutputs)); const outputs = remainderAmount ? [collectionOutput, remainder] : [collectionOutput]; - const essence = packEssence(inputs, inputsCommitment, outputs, wallet, {}); - const unlocks: UnlockTypes[] = [createUnlock(essence, address.keyPair)]; + const essence = await packEssence(wallet, inputs, inputsCommitment, outputs, {}); + const unlocks = [await createUnlock(essence, address)]; - const payload = packPayload(essence, unlocks); - const blockId = await submitBlock(wallet, payload); + const blockId = await submitBlock(wallet, essence, unlocks); - const collectionId = TransactionHelper.resolveIdFromOutputId( - getTransactionPayloadHex(payload) + indexToString(0), - ); + const payload = new TransactionPayload(essence, unlocks); + const collectionId = Utils.computeOutputId(Utils.transactionId(payload), 0); return [blockId, collectionId]; }; @@ -145,48 +144,43 @@ const mintNft = async (address: AddressDetails, metadata: any) => { const [collectionOutputId, collectionOutput] = Object.entries(collectionOutputs)[0]; const collectionNftId = collectionOutput.nftId === EMPTY_NFT_ID - ? TransactionHelper.resolveIdFromOutputId(collectionOutputId) + ? Utils.computeNftId(collectionOutputId) : collectionOutput.nftId; - const issuerAddress: INftAddress = { type: NFT_ADDRESS_TYPE, nftId: collectionNftId }; - const ownerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: address.hex }; - const nftOutput = createNftOutput( + const issuerAddress = new NftAddress(collectionNftId); + const ownerAddress = new Ed25519Address(address.hex); + const nftOutput = await createNftOutput( + wallet, ownerAddress, issuerAddress, JSON.stringify(metadata), - wallet.info, ); const remainderAmount = totalAmount - Number(nftOutput.amount); - const remainder = packBasicOutput(address.bech32, remainderAmount, [], wallet.info); + const remainder = await packBasicOutput(wallet, address.bech32, remainderAmount, {}); - const nextCollectionOutput = cloneDeep(collectionOutput); + const nextCollectionOutput: NftOutputBuilderParams = cloneDeep(collectionOutput); if (nextCollectionOutput.nftId === EMPTY_NFT_ID) { - nextCollectionOutput.nftId = TransactionHelper.resolveIdFromOutputId(collectionOutputId); + nextCollectionOutput.nftId = Utils.computeNftId(collectionOutputId); } - const inputs = [collectionOutputId, ...Object.keys(consumedOutputs)].map( - TransactionHelper.inputFromOutputId, - ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputs = [collectionOutputId, ...Object.keys(consumedOutputs)].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([ collectionOutput, ...Object.values(consumedOutputs), ]); - const outputs = remainderAmount - ? [nextCollectionOutput, nftOutput, remainder] - : [nextCollectionOutput, nftOutput]; - const essence = packEssence(inputs, inputsCommitment, outputs, wallet, {}); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, address.keyPair), - { type: REFERENCE_UNLOCK_TYPE, reference: 0 }, - ]; + const outputs: Output[] = [await wallet.client.buildNftOutput(nextCollectionOutput), nftOutput]; + if (remainderAmount) { + outputs.push(remainder); + } - const payload = packPayload(essence, unlocks); - const blockId = await submitBlock(wallet, payload); + const essence = await packEssence(wallet, inputs, inputsCommitment, outputs, {}); + const unlocks: Unlock[] = [await createUnlock(essence, address), new ReferenceUnlock(0)]; - const nftId = TransactionHelper.resolveIdFromOutputId( - getTransactionPayloadHex(payload) + indexToString(1), - ); + const payload = new TransactionPayload(essence, unlocks); + const blockId = await submitBlock(wallet, essence, unlocks); + + const nftId = Utils.computeNftId(Utils.transactionId(payload) + indexToString(1)); return [blockId, nftId]; }; diff --git a/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_b.spec.ts b/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_b.spec.ts index 80f38fd562..d5da50afd1 100644 --- a/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_b.spec.ts +++ b/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_12_b.spec.ts @@ -1,23 +1,24 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { COL, MIN_IOTA_AMOUNT, Network } from '@build-5/interfaces'; import { - AddressTypes, - ED25519_ADDRESS_TYPE, - INftAddress, - NFT_ADDRESS_TYPE, - REFERENCE_UNLOCK_TYPE, - TransactionHelper, - UnlockTypes, -} from '@iota/iota.js-next'; + Ed25519Address, + NftAddress, + NftOutputBuilderParams, + Output, + ReferenceUnlock, + TransactionPayload, + UTXOInput, + Unlock, + Utils, +} from '@iota/sdk'; import { cloneDeep } from 'lodash'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { depositNft } from '../../src/runtime/firebase/nft'; import { NftWallet } from '../../src/services/wallet/NftWallet'; import { AddressDetails, WalletService } from '../../src/services/wallet/wallet.service'; import { packBasicOutput } from '../../src/utils/basic-output.utils'; -import { indexToString, packEssence, packPayload, submitBlock } from '../../src/utils/block.utils'; +import { createUnlock, packEssence, submitBlock } from '../../src/utils/block.utils'; import { EMPTY_NFT_ID, createNftOutput } from '../../src/utils/collection-minting-utils/nft.utils'; -import { createUnlock, getTransactionPayloadHex } from '../../src/utils/smr.utils'; import { mockWalletReturnValue, wait } from '../../test/controls/common'; import { testEnv } from '../../test/set-up'; import { awaitLedgerInclusionState, requestFundsFromFaucet } from '../faucet'; @@ -101,30 +102,28 @@ const mintCustomCollection = async (address: AddressDetails, metadata: any) => { 0, ); - const issuerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: address.hex }; - const collectionOutput = createNftOutput( + const issuerAddress = new Ed25519Address(address.hex); + const collectionOutput = await createNftOutput( + wallet, issuerAddress, issuerAddress, JSON.stringify(metadata), - wallet.info, ); const remainderAmount = totalAmount - Number(collectionOutput.amount); - const remainder = packBasicOutput(address.bech32, remainderAmount, [], wallet.info); + const remainder = await packBasicOutput(wallet, address.bech32, remainderAmount, {}); - const inputs = Object.keys(consumedOutputs).map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment(Object.values(consumedOutputs)); + const inputs = Object.keys(consumedOutputs).map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment(Object.values(consumedOutputs)); const outputs = remainderAmount ? [collectionOutput, remainder] : [collectionOutput]; - const essence = packEssence(inputs, inputsCommitment, outputs, wallet, {}); - const unlocks: UnlockTypes[] = [createUnlock(essence, address.keyPair)]; + const essence = await packEssence(wallet, inputs, inputsCommitment, outputs, {}); + const unlocks: Unlock[] = [await createUnlock(essence, address)]; - const payload = packPayload(essence, unlocks); - const blockId = await submitBlock(wallet, payload); + const payload = new TransactionPayload(essence, unlocks); + const blockId = await submitBlock(wallet, essence, unlocks); - const collectionId = TransactionHelper.resolveIdFromOutputId( - getTransactionPayloadHex(payload) + indexToString(0), - ); + const collectionId = Utils.computeOutputId(Utils.transactionId(payload), 0); return [blockId, collectionId]; }; @@ -142,48 +141,43 @@ const mintNft = async (address: AddressDetails, metadata: any) => { const [collectionOutputId, collectionOutput] = Object.entries(collectionOutputs)[0]; const collectionNftId = collectionOutput.nftId === EMPTY_NFT_ID - ? TransactionHelper.resolveIdFromOutputId(collectionOutputId) + ? Utils.computeNftId(collectionOutputId) : collectionOutput.nftId; - const issuerAddress: INftAddress = { type: NFT_ADDRESS_TYPE, nftId: collectionNftId }; - const ownerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: address.hex }; - const nftOutput = createNftOutput( + const issuerAddress = new NftAddress(collectionNftId); + const ownerAddress = new Ed25519Address(address.hex); + const nftOutput = await createNftOutput( + wallet, ownerAddress, issuerAddress, JSON.stringify(metadata), - wallet.info, ); const remainderAmount = totalAmount - Number(nftOutput.amount); - const remainder = packBasicOutput(address.bech32, remainderAmount, [], wallet.info); + const remainder = await packBasicOutput(wallet, address.bech32, remainderAmount, {}); - const nextCollectionOutput = cloneDeep(collectionOutput); + const nextCollectionOutput: NftOutputBuilderParams = cloneDeep(collectionOutput); if (nextCollectionOutput.nftId === EMPTY_NFT_ID) { - nextCollectionOutput.nftId = TransactionHelper.resolveIdFromOutputId(collectionOutputId); + nextCollectionOutput.nftId = Utils.computeNftId(collectionOutputId); } - const inputs = [collectionOutputId, ...Object.keys(consumedOutputs)].map( - TransactionHelper.inputFromOutputId, - ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputs = [collectionOutputId, ...Object.keys(consumedOutputs)].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([ collectionOutput, ...Object.values(consumedOutputs), ]); - const outputs = remainderAmount - ? [nextCollectionOutput, nftOutput, remainder] - : [nextCollectionOutput, nftOutput]; - const essence = packEssence(inputs, inputsCommitment, outputs, wallet, {}); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, address.keyPair), - { type: REFERENCE_UNLOCK_TYPE, reference: 0 }, - ]; + const outputs: Output[] = [await wallet.client.buildNftOutput(nextCollectionOutput), nftOutput]; + if (remainderAmount) { + outputs.push(remainder); + } - const payload = packPayload(essence, unlocks); - const blockId = await submitBlock(wallet, payload); + const essence = await packEssence(wallet, inputs, inputsCommitment, outputs, {}); + const unlocks: Unlock[] = [await createUnlock(essence, address), new ReferenceUnlock(0)]; - const nftId = TransactionHelper.resolveIdFromOutputId( - getTransactionPayloadHex(payload) + indexToString(1), - ); + const payload = new TransactionPayload(essence, unlocks); + const blockId = await submitBlock(wallet, essence, unlocks); + + const nftId = Utils.computeOutputId(Utils.transactionId(payload), 1); return [blockId, nftId]; }; diff --git a/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_13.spec.ts b/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_13.spec.ts index 4ce3e9bc17..f37a8149bf 100644 --- a/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_13.spec.ts +++ b/packages/functions/test-tangle/withdraw-deposit-nft/deposit-withraw-nft_13.spec.ts @@ -1,23 +1,24 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { COL, MIN_IOTA_AMOUNT, Network, Nft } from '@build-5/interfaces'; import { - AddressTypes, - ED25519_ADDRESS_TYPE, - INftAddress, - NFT_ADDRESS_TYPE, - REFERENCE_UNLOCK_TYPE, - TransactionHelper, - UnlockTypes, -} from '@iota/iota.js-next'; + Ed25519Address, + NftAddress, + NftOutputBuilderParams, + Output, + ReferenceUnlock, + TransactionPayload, + UTXOInput, + Unlock, + Utils, +} from '@iota/sdk'; import { cloneDeep } from 'lodash'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { depositNft } from '../../src/runtime/firebase/nft'; import { NftWallet } from '../../src/services/wallet/NftWallet'; import { AddressDetails, WalletService } from '../../src/services/wallet/wallet.service'; import { packBasicOutput } from '../../src/utils/basic-output.utils'; -import { indexToString, packEssence, packPayload, submitBlock } from '../../src/utils/block.utils'; +import { createUnlock, packEssence, submitBlock } from '../../src/utils/block.utils'; import { EMPTY_NFT_ID, createNftOutput } from '../../src/utils/collection-minting-utils/nft.utils'; -import { createUnlock, getTransactionPayloadHex } from '../../src/utils/smr.utils'; import { mockWalletReturnValue, wait } from '../../test/controls/common'; import { testEnv } from '../../test/set-up'; import { awaitLedgerInclusionState, requestFundsFromFaucet } from '../faucet'; @@ -126,30 +127,28 @@ const mintCustomCollection = async (address: AddressDetails, metadata: any) => { 0, ); - const issuerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: address.hex }; - const collectionOutput = createNftOutput( + const issuerAddress = new Ed25519Address(address.hex); + const collectionOutput = await createNftOutput( + wallet, issuerAddress, issuerAddress, JSON.stringify(metadata), - wallet.info, ); const remainderAmount = totalAmount - Number(collectionOutput.amount); - const remainder = packBasicOutput(address.bech32, remainderAmount, [], wallet.info); + const remainder = await packBasicOutput(wallet, address.bech32, remainderAmount, {}); - const inputs = Object.keys(consumedOutputs).map(TransactionHelper.inputFromOutputId); - const inputsCommitment = TransactionHelper.getInputsCommitment(Object.values(consumedOutputs)); + const inputs = Object.keys(consumedOutputs).map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment(Object.values(consumedOutputs)); const outputs = remainderAmount ? [collectionOutput, remainder] : [collectionOutput]; - const essence = packEssence(inputs, inputsCommitment, outputs, wallet, {}); - const unlocks: UnlockTypes[] = [createUnlock(essence, address.keyPair)]; + const essence = await packEssence(wallet, inputs, inputsCommitment, outputs, {}); + const unlocks = [await createUnlock(essence, address)]; - const payload = packPayload(essence, unlocks); - const blockId = await submitBlock(wallet, payload); + const payload = new TransactionPayload(essence, unlocks); + const blockId = await submitBlock(wallet, essence, unlocks); - const collectionId = TransactionHelper.resolveIdFromOutputId( - getTransactionPayloadHex(payload) + indexToString(0), - ); + const collectionId = Utils.computeOutputId(Utils.transactionId(payload), 0); return [blockId, collectionId]; }; @@ -167,48 +166,42 @@ const mintNft = async (address: AddressDetails, metadata: any) => { const [collectionOutputId, collectionOutput] = Object.entries(collectionOutputs)[0]; const collectionNftId = collectionOutput.nftId === EMPTY_NFT_ID - ? TransactionHelper.resolveIdFromOutputId(collectionOutputId) + ? Utils.computeNftId(collectionOutputId) : collectionOutput.nftId; - const issuerAddress: INftAddress = { type: NFT_ADDRESS_TYPE, nftId: collectionNftId }; - const ownerAddress: AddressTypes = { type: ED25519_ADDRESS_TYPE, pubKeyHash: address.hex }; - const nftOutput = createNftOutput( + const issuerAddress = new NftAddress(collectionNftId); + const ownerAddress = new Ed25519Address(address.hex); + const nftOutput = await createNftOutput( + wallet, ownerAddress, issuerAddress, JSON.stringify(metadata), - wallet.info, ); const remainderAmount = totalAmount - Number(nftOutput.amount); - const remainder = packBasicOutput(address.bech32, remainderAmount, [], wallet.info); + const remainder = await packBasicOutput(wallet, address.bech32, remainderAmount, {}); - const nextCollectionOutput = cloneDeep(collectionOutput); + const nextCollectionOutput: NftOutputBuilderParams = cloneDeep(collectionOutput); if (nextCollectionOutput.nftId === EMPTY_NFT_ID) { - nextCollectionOutput.nftId = TransactionHelper.resolveIdFromOutputId(collectionOutputId); + nextCollectionOutput.nftId = Utils.computeNftId(collectionOutputId); } - const inputs = [collectionOutputId, ...Object.keys(consumedOutputs)].map( - TransactionHelper.inputFromOutputId, - ); - const inputsCommitment = TransactionHelper.getInputsCommitment([ + const inputs = [collectionOutputId, ...Object.keys(consumedOutputs)].map(UTXOInput.fromOutputId); + const inputsCommitment = Utils.computeInputsCommitment([ collectionOutput, ...Object.values(consumedOutputs), ]); - const outputs = remainderAmount - ? [nextCollectionOutput, nftOutput, remainder] - : [nextCollectionOutput, nftOutput]; - const essence = packEssence(inputs, inputsCommitment, outputs, wallet, {}); - const unlocks: UnlockTypes[] = [ - createUnlock(essence, address.keyPair), - { type: REFERENCE_UNLOCK_TYPE, reference: 0 }, - ]; + const outputs: Output[] = [await wallet.client.buildNftOutput(nextCollectionOutput), nftOutput]; + if (remainderAmount) { + outputs.push(remainder); + } + const essence = await packEssence(wallet, inputs, inputsCommitment, outputs, {}); + const unlocks: Unlock[] = [await createUnlock(essence, address), new ReferenceUnlock(0)]; - const payload = packPayload(essence, unlocks); - const blockId = await submitBlock(wallet, payload); + const payload = new TransactionPayload(essence, unlocks); + const blockId = await submitBlock(wallet, essence, unlocks); - const nftId = TransactionHelper.resolveIdFromOutputId( - getTransactionPayloadHex(payload) + indexToString(1), - ); + const nftId = Utils.computeOutputId(Utils.transactionId(payload), 1); return [blockId, nftId]; }; diff --git a/packages/functions/test/controls/common.ts b/packages/functions/test/controls/common.ts index 14f7cf6f9d..8471316ebc 100644 --- a/packages/functions/test/controls/common.ts +++ b/packages/functions/test/controls/common.ts @@ -12,17 +12,16 @@ import { TransactionType, getMilestoneCol, } from '@build-5/interfaces'; -import { TransactionHelper } from '@iota/iota.js-next'; +import { TransactionPayload, UTXOInput, Utils } from '@iota/sdk'; import dayjs from 'dayjs'; import { build5Db } from '../../src/firebase/firestore/build5Db'; import { validateAddress } from '../../src/runtime/firebase/address'; import { createMember as createMemberFunc } from '../../src/runtime/firebase/member'; import { createSpace as createSpaceFunc } from '../../src/runtime/firebase/space/index'; import { packBasicOutput } from '../../src/utils/basic-output.utils'; -import { packEssence, packPayload } from '../../src/utils/block.utils'; +import { createUnlock, packEssence } from '../../src/utils/block.utils'; import * as config from '../../src/utils/config.utils'; import * as ipUtils from '../../src/utils/ip.utils'; -import { createUnlock } from '../../src/utils/smr.utils'; import * as wallet from '../../src/utils/wallet.utils'; import { MEDIA, getWallet, testEnv } from '../set-up'; @@ -70,13 +69,13 @@ export const submitMilestoneFunc = async (order: Transaction, customAmount?: num const from = await walletService.getNewIotaAddressDetails(); const consumedOutputId = '0xbdb062b39e38c3ea0b37c32d564ee839da4e1d66ceb035a56ed1e87caa3fc5950000'; - const consumedOutputs = packBasicOutput(from.bech32, amount, [], walletService.info); - const inputs = [TransactionHelper.inputFromOutputId(consumedOutputId)]; - const inputsCommitment = TransactionHelper.getInputsCommitment([consumedOutputs]); - const outputs = [packBasicOutput(to, amount, [], walletService.info)]; - const essence = packEssence(inputs, inputsCommitment, outputs, walletService, {}); - const unlocks = [createUnlock(essence, from.keyPair)]; - const payload = packPayload(essence, unlocks); + const consumedOutputs = await packBasicOutput(walletService, from.bech32, amount, {}); + const inputs = [UTXOInput.fromOutputId(consumedOutputId)]; + const inputsCommitment = Utils.computeInputsCommitment([consumedOutputs]); + const outputs = [await packBasicOutput(walletService, to, amount, {})]; + const essence = await packEssence(walletService, inputs, inputsCommitment, outputs, {}); + const unlocks = [await createUnlock(essence, from)]; + const payload = new TransactionPayload(essence, unlocks); const milestoneColl = getMilestoneCol(network); const nextMilestone = wallet.getRandomEthAddress(); diff --git a/packages/functions/test/milestone.sync.ts b/packages/functions/test/milestone.sync.ts index c6c0f45042..b8bc2b8ecc 100644 --- a/packages/functions/test/milestone.sync.ts +++ b/packages/functions/test/milestone.sync.ts @@ -1,7 +1,6 @@ -import { OutputTypes, TREASURY_OUTPUT_TYPE } from '@iota/iota.js-next'; - import { COL, Network, SUB_COL } from '@build-5/interfaces'; +import { Output, OutputType } from '@iota/sdk'; import * as adminPackage from 'firebase-admin'; import { last } from 'lodash'; import { build5Db } from '../src/firebase/firestore/build5Db'; @@ -61,8 +60,8 @@ const syncTransactions = async (wallet: Wallet, parentPath: string) => { }; const getAddesses = (doc: any, wallet: Wallet) => - (doc.payload.essence.outputs as OutputTypes[]) - .filter((o) => o.type !== TREASURY_OUTPUT_TYPE) + (doc.payload.essence.outputs as Output[]) + .filter((o) => o.type !== OutputType.Treasury) .map((o) => wallet.bechAddressFromOutput(o as any)); const addressInDb = async (addresses: string[]) => { diff --git a/packages/functions/workflow.build.js b/packages/functions/workflow.build.js index 20469a9445..c9cfcdaa43 100644 --- a/packages/functions/workflow.build.js +++ b/packages/functions/workflow.build.js @@ -153,7 +153,7 @@ function job(outputFile, chunk, files, commandName) { // fs.appendFileSync(outputFile, ` coverage_path: packages/functions/reports/coverage\n\n`); } -const tangleChunkSize = 3; +const tangleChunkSize = 1; const emulatorChunkSize = 7; function createTangleTest() { diff --git a/packages/interfaces/src/models/milestone.ts b/packages/interfaces/src/models/milestone.ts index 5488c2bcd1..91ade5bdbc 100644 --- a/packages/interfaces/src/models/milestone.ts +++ b/packages/interfaces/src/models/milestone.ts @@ -2,7 +2,7 @@ import { Base, Timestamp } from './base'; export interface NativeToken { readonly id: string; - readonly amount: string; + readonly amount: bigint; } export interface MilestoneTransactionEntry { diff --git a/packages/lib/package.json b/packages/lib/package.json index 8dd8138a30..862a13bbb4 100644 --- a/packages/lib/package.json +++ b/packages/lib/package.json @@ -20,14 +20,12 @@ }, "dependencies": { "@build-5/interfaces": "*", - "eventsource": "^2.0.2", "lodash": "4.17.21", "rxjs": "7.8.1", "ws": "^8.13.0" }, "devDependencies": { "@babel/preset-typescript": "7.22.5", - "@types/eventsource": "^1.1.11", "@types/jest": "29.5.2", "@types/lodash": "4.14.195", "@types/ws": "^8.5.5",