From dc7b2c55f32dafbae408377ef9a899c24f99166c Mon Sep 17 00:00:00 2001 From: SIDANWhatever Date: Mon, 26 Aug 2024 16:49:49 +0800 Subject: [PATCH 1/2] feat: update contract set network --- .github/workflows/publish.yml | 25 +++++++++++++++++++ package-lock.json | 2 +- packages/mesh-common/package.json | 2 +- packages/mesh-contract/package.json | 2 +- packages/mesh-contract/src/common.ts | 7 +++++- .../mesh-contract/src/giftcard/offchain.ts | 2 -- packages/mesh-contract/src/swap/offchain.ts | 1 - packages/mesh-core-csl/package.json | 2 +- packages/mesh-core-cst/package.json | 2 +- packages/mesh-core/package.json | 2 +- packages/mesh-provider/package.json | 2 +- packages/mesh-react/package.json | 2 +- packages/mesh-transaction/package.json | 2 +- packages/mesh-wallet/package.json | 2 +- scripts/bump-version.sh | 1 + scripts/mesh-cli/package.json | 4 +-- 16 files changed, 44 insertions(+), 16 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 41ca8ec7..b790ed27 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -40,6 +40,7 @@ jobs: react-version-updated: ${{ steps.compare-versions.outputs.react-version-updated }} transaction-version-updated: ${{ steps.compare-versions.outputs.transaction-version-updated }} wallet-version-updated: ${{ steps.compare-versions.outputs.wallet-version-updated }} + cli-version-updated: ${{ steps.compare-versions.outputs.cli-version-updated }} steps: - name: Checkout main branch at commit before merge uses: actions/checkout@v4 @@ -58,6 +59,7 @@ jobs: REACT_PRE_MERGE_VERSION=$(node -p "require('./packages/mesh-react/package.json').version") TRANSACTION_PRE_MERGE_VERSION=$(node -p "require('./packages/mesh-transaction/package.json').version") WALLET_PRE_MERGE_VERSION=$(node -p "require('./packages/mesh-wallet/package.json').version") + CLI_PRE_MERGE_VERSION=$(node -p "require('./scripts/mesh-cli/package.json').version") echo "common_pre_merge_version=$COMMON_PRE_MERGE_VERSION" >> "$GITHUB_OUTPUT" echo "contract_pre_merge_version=$CONTRACT_PRE_MERGE_VERSION" >> "$GITHUB_OUTPUT" echo "core_pre_merge_version=$CORE_PRE_MERGE_VERSION" >> "$GITHUB_OUTPUT" @@ -67,6 +69,7 @@ jobs: echo "react_pre_merge_version=$REACT_PRE_MERGE_VERSION" >> "$GITHUB_OUTPUT" echo "transaction_pre_merge_version=$TRANSACTION_PRE_MERGE_VERSION" >> "$GITHUB_OUTPUT" echo "wallet_pre_merge_version=$WALLET_PRE_MERGE_VERSION" >> "$GITHUB_OUTPUT" + echo "cli_pre_merge_version=$CLI_PRE_MERGE_VERSION" >> "$GITHUB_OUTPUT" - name: Checkout main branch at commit after merge uses: actions/checkout@v4 @@ -85,6 +88,7 @@ jobs: REACT_POST_MERGE_VERSION=$(node -p "require('./packages/mesh-react/package.json').version") TRANSACTION_POST_MERGE_VERSION=$(node -p "require('./packages/mesh-transaction/package.json').version") WALLET_POST_MERGE_VERSION=$(node -p "require('./packages/mesh-wallet/package.json').version") + CLI_POST_MERGE_VERSION=$(node -p "require('./scripts/mesh-cli/package.json').version") echo "common_post_merge_version=$COMMON_POST_MERGE_VERSION" >> "$GITHUB_OUTPUT" echo "contract_post_merge_version=$CONTRACT_POST_MERGE_VERSION" >> "$GITHUB_OUTPUT" echo "core_post_merge_version=$CORE_POST_MERGE_VERSION" >> "$GITHUB_OUTPUT" @@ -94,6 +98,7 @@ jobs: echo "react_post_merge_version=$REACT_POST_MERGE_VERSION" >> "$GITHUB_OUTPUT" echo "transaction_post_merge_version=$TRANSACTION_POST_MERGE_VERSION" >> "$GITHUB_OUTPUT" echo "wallet_post_merge_version=$WALLET_POST_MERGE_VERSION" >> "$GITHUB_OUTPUT" + echo "cli_post_merge_version=$CLI_POST_MERGE_VERSION" >> "$GITHUB_OUTPUT" - name: Compare versions id: compare-versions @@ -143,6 +148,11 @@ jobs: else echo "wallet-version-updated=false" >> "$GITHUB_OUTPUT" fi + if [[ "${{ steps.pre-merge-version.outputs.cli_pre_merge_version }}" != "${{ steps.post-merge-version.outputs.cli_post_merge_version }}" ]]; then + echo "cli-version-updated=true" >> "$GITHUB_OUTPUT" + else + echo "cli-version-updated=false" >> "$GITHUB_OUTPUT" + fi publish-meshsdk-common: needs: [build, check-version] @@ -278,3 +288,18 @@ jobs: - run: cd packages/mesh-wallet && npm publish --access public env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} + + publish-meshsdk-cli: + needs: [build, check-version] + if: needs.check-version.outputs.cli-version-updated == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + - run: npm install && npm run build + - run: cd scripts/mesh-cli && npm publish --access public + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/package-lock.json b/package-lock.json index 249335cb..bc2e6efa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22616,7 +22616,7 @@ }, "scripts/mesh-cli": { "name": "create-mesh-app", - "version": "1.6.10", + "version": "1.5.0", "license": "Apache-2.0", "dependencies": { "chalk": "5.3.0", diff --git a/packages/mesh-common/package.json b/packages/mesh-common/package.json index a686952f..003e13a5 100644 --- a/packages/mesh-common/package.json +++ b/packages/mesh-common/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/common", - "version": "1.6.11", + "version": "1.6.12", "description": "", "main": "./dist/index.cjs", "module": "./dist/index.js", diff --git a/packages/mesh-contract/package.json b/packages/mesh-contract/package.json index 5b029d58..9fa08623 100644 --- a/packages/mesh-contract/package.json +++ b/packages/mesh-contract/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/contract", - "version": "1.6.11", + "version": "1.6.12", "description": "", "main": "./dist/index.cjs", "module": "./dist/index.js", diff --git a/packages/mesh-contract/src/common.ts b/packages/mesh-contract/src/common.ts index 5562367f..bc69808b 100644 --- a/packages/mesh-contract/src/common.ts +++ b/packages/mesh-contract/src/common.ts @@ -38,6 +38,11 @@ export class MeshTxInitiator { } if (networkId) { this.networkId = networkId; + if (networkId === 1) { + this.mesh.setNetwork("mainnet"); + } else { + this.mesh.setNetwork("preprod"); + } } if (stakeCredential) { this.stakeCredential = this.stakeCredential; @@ -181,7 +186,7 @@ export class MeshTxInitiator { utxos.filter((utxo) => utxo.output.address === scriptAddr)[0] || utxos[0]; } - + return scriptUtxo; } diff --git a/packages/mesh-contract/src/giftcard/offchain.ts b/packages/mesh-contract/src/giftcard/offchain.ts index 7c98a3e3..810e8cd1 100644 --- a/packages/mesh-contract/src/giftcard/offchain.ts +++ b/packages/mesh-contract/src/giftcard/offchain.ts @@ -116,7 +116,6 @@ export class MeshGiftCardContract extends MeshTxInitiator { collateral.output.address, ) .selectUtxosFrom(remainingUtxos) - .setNetwork('preprod') .complete(); this.tokenNameHex = tokenNameHex; @@ -168,7 +167,6 @@ export class MeshGiftCardContract extends MeshTxInitiator { collateral.output.address, ) .selectUtxosFrom(utxos) - .setNetwork('preprod') .complete(); return this.mesh.txHex; }; diff --git a/packages/mesh-contract/src/swap/offchain.ts b/packages/mesh-contract/src/swap/offchain.ts index 59179cd8..2544d09f 100644 --- a/packages/mesh-contract/src/swap/offchain.ts +++ b/packages/mesh-contract/src/swap/offchain.ts @@ -132,7 +132,6 @@ export class MeshSwapContract extends MeshTxInitiator { ) .requiredSignerHash(deserializeAddress(initiatorAddress).pubKeyHash) .selectUtxosFrom(utxos) - .setNetwork('preprod') .complete(); return this.mesh.txHex; }; diff --git a/packages/mesh-core-csl/package.json b/packages/mesh-core-csl/package.json index 769f5b75..ebebdbb5 100644 --- a/packages/mesh-core-csl/package.json +++ b/packages/mesh-core-csl/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/core-csl", - "version": "1.6.11", + "version": "1.6.12", "description": "", "main": "./dist/index.cjs", "module": "./dist/index.js", diff --git a/packages/mesh-core-cst/package.json b/packages/mesh-core-cst/package.json index 68de2053..df1e88ba 100644 --- a/packages/mesh-core-cst/package.json +++ b/packages/mesh-core-cst/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/core-cst", - "version": "1.6.11", + "version": "1.6.12", "description": "", "main": "./dist/index.cjs", "module": "./dist/index.js", diff --git a/packages/mesh-core/package.json b/packages/mesh-core/package.json index 2ff136a2..563f5622 100644 --- a/packages/mesh-core/package.json +++ b/packages/mesh-core/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/core", - "version": "1.6.11", + "version": "1.6.12", "description": "", "main": "./dist/index.cjs", "module": "./dist/index.js", diff --git a/packages/mesh-provider/package.json b/packages/mesh-provider/package.json index 6473508f..8a66c573 100644 --- a/packages/mesh-provider/package.json +++ b/packages/mesh-provider/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/provider", - "version": "1.6.11", + "version": "1.6.12", "description": "", "main": "./dist/index.cjs", "module": "./dist/index.js", diff --git a/packages/mesh-react/package.json b/packages/mesh-react/package.json index c917f3c9..24893fb4 100644 --- a/packages/mesh-react/package.json +++ b/packages/mesh-react/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/react", - "version": "1.6.11", + "version": "1.6.12", "description": "", "main": "./dist/index.cjs", "module": "./dist/index.js", diff --git a/packages/mesh-transaction/package.json b/packages/mesh-transaction/package.json index 7a425a95..5d38b8f4 100644 --- a/packages/mesh-transaction/package.json +++ b/packages/mesh-transaction/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/transaction", - "version": "1.6.11", + "version": "1.6.12", "description": "", "main": "./dist/index.cjs", "module": "./dist/index.js", diff --git a/packages/mesh-wallet/package.json b/packages/mesh-wallet/package.json index 3f5d8cda..46df0f10 100644 --- a/packages/mesh-wallet/package.json +++ b/packages/mesh-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/wallet", - "version": "1.6.11", + "version": "1.6.12", "description": "", "main": "./dist/index.cjs", "module": "./dist/index.js", diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh index 9b8a8567..c1ecc3ae 100644 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -19,6 +19,7 @@ FILES=( "packages/mesh-react/package.json" "packages/mesh-transaction/package.json" "packages/mesh-wallet/package.json" + "scripts/mesh-cli/package.json" ) # Iterate over each specified package.json file and update the version field diff --git a/scripts/mesh-cli/package.json b/scripts/mesh-cli/package.json index 51620404..7ecdd992 100644 --- a/scripts/mesh-cli/package.json +++ b/scripts/mesh-cli/package.json @@ -3,7 +3,7 @@ "description": "A quick and easy way to bootstrap your dApps on Cardano using Mesh.", "homepage": "https://meshjs.dev", "author": "MeshJS", - "version": "1.5.0", + "version": "1.6.12", "license": "Apache-2.0", "main": "dist/create-mesh-app.cjs.js", "bin": { @@ -40,4 +40,4 @@ "@types/prompts": "2.4.9", "@types/tar": "6.1.13" } -} +} \ No newline at end of file From 99c73067cf9133e3ea1f434c7b536478eca2bf85 Mon Sep 17 00:00:00 2001 From: SIDANWhatever Date: Mon, 26 Aug 2024 16:53:10 +0800 Subject: [PATCH 2/2] chore: change cli to test version --- scripts/mesh-cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mesh-cli/package.json b/scripts/mesh-cli/package.json index 7ecdd992..e9aa0a09 100644 --- a/scripts/mesh-cli/package.json +++ b/scripts/mesh-cli/package.json @@ -3,7 +3,7 @@ "description": "A quick and easy way to bootstrap your dApps on Cardano using Mesh.", "homepage": "https://meshjs.dev", "author": "MeshJS", - "version": "1.6.12", + "version": "1.5.1", "license": "Apache-2.0", "main": "dist/create-mesh-app.cjs.js", "bin": {