Sound SDK
Creating editions

Sound Edition Creation

createEdition

Requires signer to be specified

Create an edition based on the given configurations

export type EditionConfig = {
  name: string
  symbol: string
  metadataModule: string
  baseURI: string
  contractURI: string
  fundingRecipient: string
  royaltyBPS: number
  editionMaxMintableLower: number
  editionMaxMintableUpper: number
  editionCutoffTime: number
  shouldFreezeMetadata: boolean
  shouldEnableMintRandomness: boolean
  enableOperatorFiltering: boolean // Opensea OperatorFilter for royalties https://github.com/ProjectOpenSea/operator-filter-registry
 
  setSAM: SamConfig | null
}
 
export interface SamConfig {
  contractAddress: string
  basePrice: BigNumberish
  linearPriceSlope: BigNumberish
  inflectionPrice: BigNumberish
  inflectionPoint: BigNumberish
  artistFeeBPS: BigNumberish
  goldenEggFeeBPS: BigNumberish
  affiliateFeeBPS: BigNumberish
}
export type MintConfigBase = {
  minterAddress: string
  price: BigNumberish
  startTime: number
  endTime: number
  affiliateFeeBPS: number
}
 
export type MerkleDropConfig = MintConfigBase & {
  mintType: 'MerkleDrop'
  merkleRoot: string
  maxMintable: number
  maxMintablePerAccount: number
}
 
export type RangeEditionConfig = MintConfigBase & {
  mintType: 'RangeEdition'
  cutoffTime: number
  maxMintableLower: number
  maxMintableUpper: number
  maxMintablePerAccount: number
}
 
export type MintConfig = MerkleDropConfig | RangeEditionConfig
import { EditionConfig, MintConfig, SoundClient } from '@soundxyz/sdk'
import { contractAddresses } from '@soundxyz/sound-protocol'
 
// ...
 
const editionCreation = SoundClient({
  signer,
}).creation({
  // Mint creator address
  creatorAddress: contractAddresses.mainnet.soundCreatorAddress,
})
 
const salt = '...'
 
const editionConfig: EditionConfig = {
  name: '[Edition title] ...',
  // ...
}
 
const mintConfigs: MintConfig[] = []
 
// ...
 
mintConfigs.push({
  mintType: 'RangeEdition',
  minterAddress: contractAddresses.mainnet.rangeEditionMinter,
  // ...
})
 
// ...
 
mintConfigs.push({
  mintType: 'MerkleDrop',
  minterAddress: contractAddresses.mainnet.merkleDropMinter,
  price: 0,
  // ...
})
 
// ...
 
// Transaction
const transaction = await client.createEdition({
  editionConfig,
  mintConfigs,
  salt,
})
interface Transaction {
  hash: string
 
  // Only if a transaction has been mined
  blockNumber?: number
  blockHash?: string
  timestamp?: number
 
  confirmations: number
 
  // Not optional (as it is in Transaction)
  from: string
 
  // The raw transaction
  raw?: string
 
  // This function waits until the transaction has been mined
  wait: (confirmations?: number) => Promise<TransactionReceipt>
}

expectedEditionAddress

Requires either signer or provider

Get the expected edition address to be set for a to-be-created edition contract based on the deployer address and given salt.

import { EditionConfig, MintConfig, SoundClient } from '@soundxyz/sdk'
import { contractAddresses } from '@soundxyz/sound-protocol'
 
// ...
 
const client = SoundClient({
  signer,
}).creation({
  creatorAddress: contractAddresses.mainnet.soundCreatorAddress,
})
 
// ..
 
const salt = crypto.randomUUID()
 
const {
  // Expected edition contract address
  editionAddress,
  // Does the edition contract already exists
  exists,
} = await client.expectedEditionAddress({
  deployer: '0x...',
  salt,
})