Skip to main content
You are here: iOS SDK

Ledger Contract Access

loyaltyCheck


public func loyaltyCheck(_ contractAddress: String, _ userAddress: String) async -> BigUInt

Calculates the loyalty points of a given user for the specified loyalty contract.

Parameters:

  • contractAddress: The Ethereum address of the loyalty contract.

  • userAddress: The Ethereum address of the user to check loyalty points.

  • Returns: A BigUInt representing the user's loyalty points.

loyaltyLifetimeCheck

public func loyaltyLifetimeCheck(_ contractAddress: String, _ userAddress: String) async -> BigUInt

Returns the balance of current points owned by the recipient, which does NOT take all redemptions and forfeitures into account. This amount can only grow.

Parameters:

  • contractAddress: The Ethereum address of the loyalty contract.

  • userAddress: The address of the user's account to add points to.

  • points: A BigUInt representing the user's loyalty points.

loyaltyAdd

public func loyaltyAdd(_ contractAddress: String, _ userAddress: String, _ points: UInt) async

Adds loyalty points to the user's account.

Parameters:

  • contractAddress: The address of the loyalty contract.

  • userAddress: The address of the user's account to add points to.

  • points: The number of points to add to the user's account.

loyaltyRedeem

public func loyaltyRedeem(_ contractAddress: String, _ recipientAddress: String, _ points: UInt, _ eventId: UInt) async 

If points are to be converted into stored value or rewards, this can be called to reduce the current points balance for the recipient by pointsAmt, associated with a redemption event eventId.

Parameters:

  • contractAddress: The address of the loyalty contract.

  • userAddress: The address of the user's account to remove points from.

  • points: The number of points to remove from the user's account.

loyaltyForfeit

public func loyaltyForfeit(_ contractAddress: String, _ recipientAddress: String, _ points: UInt) async  

Separated from redemption, this is called if points expire or other activities cause a balance to be reduced by amount without any benefit going to the member recipient.

Parameters:

  • contractAddress: The address of the loyalty contract.

  • userAddress: The address of the user's account to remove points from.

  • points: The number of points to remove from the user's account.

convertPointsToCoins

public func convertPointsToCoins(_ contractAddress: String, _ recipientAddress: String, _ points: UInt) async  

Separated from redemption, this is called if points expire or other activities cause a balance to be reduced by amount without any benefit going to the member recipient.

Parameters:

  • contractAddress: The address of the loyalty contract.

  • userAddress: The address of the user's account to convert points.

  • points: The number of points to convert.