ContractIdUtils

public enum ContractIdUtils

Contract id derivation.

  • Derives the contract id a deployment by the given deployer with the given salt creates on the given network.

    The id depends only on the deployer address, the salt and the network; the executable the contract is created with (wasm hash, CAP-85 external reference or Stellar asset) does not enter the derivation. Use it to know a contract’s address before deploying, for example when the address is needed in constructor arguments of another contract.

    Throws

    StellarSDKError.invalidArgument if the salt is not exactly 32 bytes

    Declaration

    Swift

    public static func deriveContractId(deployer: SCAddressXDR, salt: Data, network: Network) throws -> String

    Parameters

    deployer

    the address the deployment is issued from (account or contract)

    salt

    the 32 byte salt the deployment uses

    network

    the network the contract is deployed to

    Return Value

    the derived contract id (“C…”)