The membership contract is an opportunity to store data in a way that is not as traceable as NFT ownership. Unlike NFTS, the ownership of a membership contract is controlled by the contract owner and therefore cannot be transferred. In addition, relevant non-PII metadata can be stored in the entry for quick retrieval.
public func addMembership(_ contractAddress: String, _ userAddress: String, _ metadata: String) async This asynchronous function adds a membership to the given contract address for the given user Ethereum address and metadata. It gets the contract ABI (Application Binary Interface) using the 'getContractABI' function, constructs a contract instance, and then creates a transaction to call the 'addMembership' function with the given user address and metadata. It signs the transaction with the private key and then sends the transaction to the network to be mined.
Parameters:
contractAddress: The contract address to which to add the membership.
userAddress: The Ethereum address of the user to add as a member.
metadata: The metadata to associate with the membership.
removeMembership
public func removeMembership(_ contractAddress: String, _ userAddress: String) async For an existing member, this will revoke their membership, expunging the entry for future requests in the entry associated with the calling address.
Parameters:
contractAddress: The Ethereum address of the contract.
userAddress: The Ethereum address of the user whose membership needs to be removed.
Returns: Void.
checkMembership
public func checkMembership(_ contractAddress: String, _ ownerAddress: String, _ userAddress: String) async -> Bool Checks if a user is a confirmed member of a contract on the Ethereum blockchain.
Parameters:
contractAddress: The Ethereum address of the contract.
ownerAddress: The Ethereum address of the owner of the contract.
userAddress: The Ethereum address of the user to be checked.
Returns: A boolean value indicating whether the user is a confirmed member of the contract.
[available from version 1.1]
getMembershipMetadata
public func getMembershipMetadata(address publisherAddress,address customerAddress)For members, this method will retrieve the metadata that was stored by customerAddress associated with a member with the public key customerAddress. Like confirmMembership, this is accessible to all authorized callers as defined by the contract owner.
Parameters:
publisherAddress: The address of the contract owner
address: The Ethereum address of the contract.
customerAddress: The Ethereum address of the owner of the contract.