-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.ts
32 lines (27 loc) · 1.08 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as Linking from "expo-linking";
import {AppToken} from "./RentLendTokensView";
export const dappName = "Nftzi";
export const loginRequestId = "loginRequestId"
export const mintRequestId = "mintRequestId"
export const approveRequestId = "approveRequestId"
export const redeemRequestId = "redeemRequestId"
export const callback = Linking.createURL("/valora");
export const getCurrecyContract = async (currency, kit) => {
switch (currency.toUpperCase()) {
case 'CELO':
return kit.contracts.getGoldToken();
case 'CUSD':
return kit.contracts.getStableToken();
default:
throw new Error('Currency must be specified');
}
};
export const isOwner = (token: AppToken, address:string): boolean => {
return token.creator.toLowerCase() === address.toLowerCase()
}
export const showRentedDetails = (token: AppToken, address:string): boolean => {
return !isOwner(token, address) && parseInt(token.rentedAt, 10) > 0
}
export const showWithdrawDetails = (token: AppToken, address:string): boolean => {
return isOwner(token, address) && parseInt(token.rentedAt, 10) > 0
}