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

Added methods for dynamic nfts #466

Merged
merged 2 commits into from
Aug 8, 2024
Merged

Added methods for dynamic nfts #466

merged 2 commits into from
Aug 8, 2024

Conversation

popenta
Copy link
Contributor

@popenta popenta commented Jul 18, 2024

No description provided.

@popenta popenta self-assigned this Jul 18, 2024

it("should create 'Transaction' for modifying creator", () => {
const transaction = tokenManagementFactory.createTransactionForModifyingCreator({
sender: grace.address,
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to double check, only the current creator can do this? If so, who would be the new creator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

from the PR on docs:

The creator of a token can be changed. For this, the token has to be moved to the new creator account. The new creator
account requires `ESDTRoleModifyCreator` role. Also, the token has to be of dynamic type.

sender: grace.address,
tokenIdentifier: "TEST-123456",
tokenNonce: 1n,
royalties: 1234n,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should rename this to newRoyalties?

});

it("should create 'Transaction' for setting new uris", () => {
const transaction = tokenManagementFactory.createTransactionForSettingNewUris({
Copy link
Contributor

Choose a reason for hiding this comment

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

...URIs

sender: grace.address,
tokenIdentifier: "TEST-123456",
tokenNonce: 1n,
uris: ["firstURI", "secondURI"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe newURIs?

Comment on lines 274 to 279
tokenNonce: 1n,
tokenName: "Test",
royalties: 1234n,
hash: "abba",
attributes: Buffer.from("test"),
uris: ["firstURI", "secondURI"],
Copy link
Contributor

Choose a reason for hiding this comment

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

So that there is no ambiguity regarding what gets changed, we can prefix all the changed fields with "new". E.g. we'll have tokenNonce, but we'll have newTokenName.

Additionally, maybe receive a Token class directly instead of tokenIdentifier & tokenNonce? Or maybe not, to keep consistency with existing methods of this factory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

prefixed the fields with new... according to the specs. Still using tokenIdentifier and tokenNonce to be consistent.

@@ -402,6 +418,10 @@ export class TokenManagementTransactionsFactory {
attributes: Uint8Array;
uris: string[];
}): Transaction {
if (!options.uris.length) {
throw new ErrBadUsage("");
Copy link
Contributor

Choose a reason for hiding this comment

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

Breaking change? Or fixing change? Message is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is now deleted.

uris: string[];
}): Transaction {
if (!options.uris.length) {
throw new ErrBadUsage("");
Copy link
Contributor

Choose a reason for hiding this comment

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

Message is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

}).build();
}

createTransactionForModifyingCreator(options: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Who is the new creator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the one who now owns the token and has the ESDTRoleModifyCreator role.

royalties: bigint;
hash: string;
attributes: Uint8Array;
uris: string[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Above we have a check on non-empty URIs. Should we have it here, as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd say no.

royalties: bigint;
hash: string;
attributes: Uint8Array;
uris: string[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Above we have a check on non-empty URIs. Should we have it here, as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd say no.

Comment on lines +387 to +388
addRoleESDTSetNewURI?: boolean;
addRoleESDTModifyRoyalties?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, optional, to avoid a breaking change 👍

@popenta popenta merged commit 91ed3c9 into feat/next Aug 8, 2024
1 check passed
@popenta popenta deleted the dynamic-nfts branch August 8, 2024 12:30
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