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

publish contract to object instead of account #120

Merged
merged 3 commits into from
Jun 24, 2024
Merged

Conversation

0xaptosj
Copy link
Contributor

@0xaptosj 0xaptosj commented Jun 24, 2024

some context aptos-labs/aptos-developer-discussions#279

New publishing UX becomes

  1. when user first get started with the template, run npm run move:publish to publish contract to an object.
  2. if user makes compatible change to the contract, run npm run move:upgrade to upgrade and keep the same contract address
  3. if user makes non-compatible change to the contract, run npm run move:publish to publish contract to a new object.

@0xaptosj 0xaptosj requested review from 0xmaayan and kaw2k and removed request for 0xmaayan June 24, 2024 18:46
Copy link
Contributor

@kaw2k kaw2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, but I have less context. What do you think @0xmaayan

const move = new cli.Move();

move
.upgradeObjectPackage({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is duplicated with the publish script. can we somehow merge it? maybe for the publish command, call the upgrade command an then run a script to update the .env file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which part is duplicate? you mean the function parameter of createObjectAndPublishPackage and upgradeObjectPackage is the same?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the use of upgradeObjectPackage in both publish and upgrade scripts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upgradeObjectPackage is only used in upgrade script, not in publish script

},
profile: process.env.VITE_APP_NETWORK,
})
.then(console.log);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need to console log here?

Copy link
Contributor Author

@0xaptosj 0xaptosj Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to display the result of running cli, it will show

Code was successfully upgraded at object address 0x37ae9c36ac620f7cdaa4e835926a3a21ea1bb0ff7d407e87a06fc29b46d82693.
{
  "Result": "Success"
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont think we need it? it outputs any cli response to the console already

Copy link
Contributor Author

@0xaptosj 0xaptosj Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@@ -4,32 +4,55 @@ const yaml = require("js-yaml");
const cli = require("@aptos-labs/ts-sdk/dist/common/cli/index.js");

const config = yaml.load(fs.readFileSync("./.aptos/config.yaml", "utf8"));
const accountAddress =
config["profiles"][process.env.VITE_APP_NETWORK]["account"];
const accountAddress = config["profiles"][process.env.VITE_APP_NETWORK]["account"];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be changed, look at #122

@0xaptosj 0xaptosj force-pushed the j/publish-to-object branch from d3b878d to 298411a Compare June 24, 2024 21:12
@0xaptosj 0xaptosj force-pushed the j/publish-to-object branch from af9f92a to c39d11a Compare June 24, 2024 21:29
@0xaptosj 0xaptosj merged commit 8c2e9dc into main Jun 24, 2024
4 checks passed
@0xaptosj 0xaptosj deleted the j/publish-to-object branch June 24, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants