Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update contract set network #275

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/mesh-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/common",
"version": "1.6.11",
"version": "1.6.12",
"description": "",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/mesh-contract/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/contract",
"version": "1.6.11",
"version": "1.6.12",
"description": "",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand Down
7 changes: 6 additions & 1 deletion packages/mesh-contract/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -181,7 +186,7 @@ export class MeshTxInitiator {
utxos.filter((utxo) => utxo.output.address === scriptAddr)[0] ||
utxos[0];
}

return scriptUtxo;
}

Expand Down
2 changes: 0 additions & 2 deletions packages/mesh-contract/src/giftcard/offchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export class MeshGiftCardContract extends MeshTxInitiator {
collateral.output.address,
)
.selectUtxosFrom(remainingUtxos)
.setNetwork('preprod')
.complete();

this.tokenNameHex = tokenNameHex;
Expand Down Expand Up @@ -168,7 +167,6 @@ export class MeshGiftCardContract extends MeshTxInitiator {
collateral.output.address,
)
.selectUtxosFrom(utxos)
.setNetwork('preprod')
.complete();
return this.mesh.txHex;
};
Expand Down
1 change: 0 additions & 1 deletion packages/mesh-contract/src/swap/offchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export class MeshSwapContract extends MeshTxInitiator {
)
.requiredSignerHash(deserializeAddress(initiatorAddress).pubKeyHash)
.selectUtxosFrom(utxos)
.setNetwork('preprod')
.complete();
return this.mesh.txHex;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/mesh-core-csl/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/mesh-core-cst/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/mesh-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/core",
"version": "1.6.11",
"version": "1.6.12",
"description": "",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/mesh-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/provider",
"version": "1.6.11",
"version": "1.6.12",
"description": "",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/mesh-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/react",
"version": "1.6.11",
"version": "1.6.12",
"description": "",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/mesh-transaction/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/transaction",
"version": "1.6.11",
"version": "1.6.12",
"description": "",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/mesh-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/wallet",
"version": "1.6.11",
"version": "1.6.12",
"description": "",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand Down
1 change: 1 addition & 0 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions scripts/mesh-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.1",
"license": "Apache-2.0",
"main": "dist/create-mesh-app.cjs.js",
"bin": {
Expand Down Expand Up @@ -40,4 +40,4 @@
"@types/prompts": "2.4.9",
"@types/tar": "6.1.13"
}
}
}
Loading