-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.ts
95 lines (86 loc) · 2.07 KB
/
utils.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
import { getAddress } from "viem"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export const TOKEN_NAME = "HIGHER"
export const MIDDLE_WALLET = "0xf4167D9B9341bf7eD0De757897F73A014a670eb8"
export const HIGHER_CONTRACT_ADDRESS= "0x0578d8a44db98b23bf096a382e016e29a5ce0ffe"
export const SEPOLIA_CONTRACT_ADDRESS = "0xc2d646D2e9b737fC0563E289c1403326E937ca44"
export const TRANSFER_ABI = [
{
inputs: [
{
internalType: "address",
name: "to",
type: "address",
},
{
internalType: "uint256",
name: "value",
type: "uint256",
},
],
name: "transfer",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
stateMutability: "nonpayable",
type: "function",
},
]
export const abi = [
{
"type": "function",
"name": "addTip",
"inputs": [
{
"name": "recipient",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "invalidateTip",
"inputs": [
{
"name": "recipient",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "withdrawTip",
"inputs": [
{
"name": "account",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
}
]
export function shortenAddress(address: string, chars = 0, endingChars = 0): string {
const parsed = getAddress(address)
console.log("PARSED ", parsed)
if (!parsed) {
throw Error(`Invalid 'address' parameter '${address}'.`)
}
return `${parsed.substring(0, chars + 5)}...${endingChars ? `${parsed.substring(42 - endingChars)}` : ``}`
}
export const sleep = async(ms: number) => new Promise((resolve) => setTimeout(resolve, ms));