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

Add protocol sdk and minting features #322

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

iainnash
Copy link
Collaborator

@iainnash iainnash commented Nov 2, 2023

Add new functions to the premint-sdk and rename it to protocol-sdk.

Mint token (not premint):

(Ideally this can also handle premints but the data paths are too different for now).

const { send } = await minter.mintToken({
  address: targetContract,
  tokenId: targetTokenId,
  publicClient,
  sender: creatorAccount,
  mintArguments: {
    mintToAddress: creatorAccount,
    quantityToMint: 1,
  },
});

Create token/contract:

const new1155TokenRequest = await createNew1155Token({
  publicClient,
  contract: {
    name: "testContract",
    uri: demoContractMetadataURI,
  },
  tokenMetadataURI: demoTokenMetadataURI,
  account: creatorAccount,
  mintToCreatorCount: 1,
});

packages/protocol-sdk/.env.anvil Outdated Show resolved Hide resolved
packages/protocol-sdk/README.md Outdated Show resolved Hide resolved
packages/protocol-sdk/src/1155-create-helper.ts Outdated Show resolved Hide resolved
royaltyRecipient: Address;
};

export function create1155TokenSetupArgs({
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 more around creating an 1155 using the fixed priced minter. do we want to have it's name to reflect that? cause this naming implies that this is the only way to create an 1155 token

packages/protocol-sdk/src/1155-create-helper.ts Outdated Show resolved Hide resolved
abi: zoraCreator1155FactoryImplABI,
// Since this address is deterministic we can hardcode a chain id safely here.
address: zoraCreator1155FactoryImplAddress[999],
functionName: "deterministicContractAddress",
Copy link
Collaborator

Choose a reason for hiding this comment

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

this function only works for contracts created via determinstic contract addresses, i.e. premint.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We're only using this for when people don't pass in a contract address. I'll document it.

}
};

async function getContractExists(
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think it may be cleaner to just break this into two functions:

const getDeterminsticContractExists({contractConfig})

const getContractExists({address})

packages/protocol-sdk/src/1155-create-helper.ts Outdated Show resolved Hide resolved
packages/protocol-sdk/src/1155-create-helper.ts Outdated Show resolved Hide resolved
packages/protocol-sdk/src/constants.ts Outdated Show resolved Hide resolved
packages/protocol-sdk/src/client-base.ts Outdated Show resolved Hide resolved
},
};

export abstract class ClientBase {
Copy link
Collaborator

Choose a reason for hiding this comment

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

id avoid having this base class just for holding the chain and network config. how about just having the subclasses contain these objects and have utility functions to extract whats needed from both objects?

inheritance can be kind of hard to follow, and id be concerned that more stuff gets thrown in here than is needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

fine resolving this in a future PR (to get this out)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The main reason I have things setup this way is the ease to override a network client without adding a ton of parameters.

packages/protocol-sdk/src/mint-client.ts Outdated Show resolved Hide resolved
@oveddan oveddan changed the base branch from main to move-premint-to-protokol-sdk November 10, 2023 15:51
@oveddan oveddan changed the base branch from move-premint-to-protokol-sdk to add-back-build-js November 10, 2023 15:53
oveddan added a commit that referenced this pull request Nov 13, 2023
* Moved premint sdk to protocol sdk

* add protocol sdk and minting features

---------

Co-authored-by: Dan Oved <[email protected]>
oveddan added a commit that referenced this pull request Nov 13, 2023
* added back build-js task

* Add protocol sdk and minting features (#322)

* Moved premint sdk to protocol sdk

* add protocol sdk and minting features

---------

Co-authored-by: Dan Oved <[email protected]>

---------

Co-authored-by: Iain Nash <[email protected]>
iainnash added a commit that referenced this pull request Jan 5, 2024
* added back build-js task

* Add protocol sdk and minting features (#322)

* Moved premint sdk to protocol sdk

* add protocol sdk and minting features

---------

Co-authored-by: Dan Oved <[email protected]>

---------

Co-authored-by: Iain Nash <[email protected]>
iainnash added a commit that referenced this pull request Jan 11, 2024
* added back build-js task

* Add protocol sdk and minting features (#322)

* Moved premint sdk to protocol sdk

* add protocol sdk and minting features

---------

Co-authored-by: Dan Oved <[email protected]>

---------

Co-authored-by: Iain Nash <[email protected]>
iainnash added a commit that referenced this pull request Jan 11, 2024
* added back build-js task

* Add protocol sdk and minting features (#322)

* Moved premint sdk to protocol sdk

* add protocol sdk and minting features

---------

Co-authored-by: Dan Oved <[email protected]>

---------

Co-authored-by: Iain Nash <[email protected]>
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.

2 participants