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

[nextra] Object transfer instructions #703

Merged
merged 2 commits into from
Nov 14, 2024
Merged
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
23 changes: 22 additions & 1 deletion apps/nextra/pages/en/build/smart-contracts/deployment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,27 @@ Do you want to publish this package at object address 0x8d6eb306bcf6c61dbaa0dbf8

Take note of the object address as you will need it later for upgrades.

### Upgrade code in an existing package
### Transfer and upgrade code in an existing package

First, you may want to transfer the object from the deployer account to an admin account. The admin account will have rights to upgrade the code.

Here's how you can do it via CLI, here your `deployer_account` should be the current owner of the object.
```bash
aptos move run —-function-id 0x1::object::transfer -—args address:<object_address> address:<new_owner_address> —-profile <deployer_account_profile>
Copy link

Choose a reason for hiding this comment

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

The command uses em-dashes () instead of regular hyphens (-), which will cause the command to fail when copied and pasted. The correct command should use regular hyphens:

aptos move run --function-id 0x1::object::transfer --args address:<object_address> address:<new_owner_address> --profile <deployer_account_profile>

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

```

Here's how you can do it via the typescript SDK:
```typescript
const transaction = await aptos.transaction.build.simple({
sender: deployerAccount.accountAddress,
data: {
function: "0x1::object::transfer",
typeArguments: [`0x1::object::ObjectCore`],
functionArguments: [object_address, new_owner_address],
},
});
```
Now you can upgrade the code with the designated admin account, as shown below.

If you wish to upgrade the code in the object deployed, run the following:
- Replace `<named_address>` with the existing named address.
Expand Down Expand Up @@ -95,4 +115,5 @@ Do you want to upgrade the package 'MyPackage' at object address 0x8d6eb306bcf6c

**Congrats, you have upgraded your code in the existing object!**


</Steps>
Loading