Skip to content

Commit b029a86

Browse files
committed
Refactor hooks folder structure
1 parent 5e89859 commit b029a86

File tree

5 files changed

+228
-228
lines changed

5 files changed

+228
-228
lines changed

packages/hooks/src/constants.ts

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,226 @@ export const CHAIN_ID_TO_NETWORK = {
4545
19: 'songbird',
4646
1287: 'moonbaseAlpha',
4747
};
48+
49+
export const ERC20ABI = [
50+
{
51+
constant: true,
52+
inputs: [],
53+
name: 'name',
54+
outputs: [
55+
{
56+
name: '',
57+
type: 'string',
58+
},
59+
],
60+
payable: false,
61+
stateMutability: 'view',
62+
type: 'function',
63+
},
64+
{
65+
constant: false,
66+
inputs: [
67+
{
68+
name: '_spender',
69+
type: 'address',
70+
},
71+
{
72+
name: '_value',
73+
type: 'uint256',
74+
},
75+
],
76+
name: 'approve',
77+
outputs: [
78+
{
79+
name: '',
80+
type: 'bool',
81+
},
82+
],
83+
payable: false,
84+
stateMutability: 'nonpayable',
85+
type: 'function',
86+
},
87+
{
88+
constant: true,
89+
inputs: [],
90+
name: 'totalSupply',
91+
outputs: [
92+
{
93+
name: '',
94+
type: 'uint256',
95+
},
96+
],
97+
payable: false,
98+
stateMutability: 'view',
99+
type: 'function',
100+
},
101+
{
102+
constant: false,
103+
inputs: [
104+
{
105+
name: '_from',
106+
type: 'address',
107+
},
108+
{
109+
name: '_to',
110+
type: 'address',
111+
},
112+
{
113+
name: '_value',
114+
type: 'uint256',
115+
},
116+
],
117+
name: 'transferFrom',
118+
outputs: [
119+
{
120+
name: '',
121+
type: 'bool',
122+
},
123+
],
124+
payable: false,
125+
stateMutability: 'nonpayable',
126+
type: 'function',
127+
},
128+
{
129+
constant: true,
130+
inputs: [],
131+
name: 'decimals',
132+
outputs: [
133+
{
134+
name: '',
135+
type: 'uint8',
136+
},
137+
],
138+
payable: false,
139+
stateMutability: 'view',
140+
type: 'function',
141+
},
142+
{
143+
constant: true,
144+
inputs: [
145+
{
146+
name: '_owner',
147+
type: 'address',
148+
},
149+
],
150+
name: 'balanceOf',
151+
outputs: [
152+
{
153+
name: 'balance',
154+
type: 'uint256',
155+
},
156+
],
157+
payable: false,
158+
stateMutability: 'view',
159+
type: 'function',
160+
},
161+
{
162+
constant: true,
163+
inputs: [],
164+
name: 'symbol',
165+
outputs: [
166+
{
167+
name: '',
168+
type: 'string',
169+
},
170+
],
171+
payable: false,
172+
stateMutability: 'view',
173+
type: 'function',
174+
},
175+
{
176+
constant: false,
177+
inputs: [
178+
{
179+
name: '_to',
180+
type: 'address',
181+
},
182+
{
183+
name: '_value',
184+
type: 'uint256',
185+
},
186+
],
187+
name: 'transfer',
188+
outputs: [
189+
{
190+
name: '',
191+
type: 'bool',
192+
},
193+
],
194+
payable: false,
195+
stateMutability: 'nonpayable',
196+
type: 'function',
197+
},
198+
{
199+
constant: true,
200+
inputs: [
201+
{
202+
name: '_owner',
203+
type: 'address',
204+
},
205+
{
206+
name: '_spender',
207+
type: 'address',
208+
},
209+
],
210+
name: 'allowance',
211+
outputs: [
212+
{
213+
name: '',
214+
type: 'uint256',
215+
},
216+
],
217+
payable: false,
218+
stateMutability: 'view',
219+
type: 'function',
220+
},
221+
{
222+
payable: true,
223+
stateMutability: 'payable',
224+
type: 'fallback',
225+
},
226+
{
227+
anonymous: false,
228+
inputs: [
229+
{
230+
indexed: true,
231+
name: 'owner',
232+
type: 'address',
233+
},
234+
{
235+
indexed: true,
236+
name: 'spender',
237+
type: 'address',
238+
},
239+
{
240+
indexed: false,
241+
name: 'value',
242+
type: 'uint256',
243+
},
244+
],
245+
name: 'Approval',
246+
type: 'event',
247+
},
248+
{
249+
anonymous: false,
250+
inputs: [
251+
{
252+
indexed: true,
253+
name: 'from',
254+
type: 'address',
255+
},
256+
{
257+
indexed: true,
258+
name: 'to',
259+
type: 'address',
260+
},
261+
{
262+
indexed: false,
263+
name: 'value',
264+
type: 'uint256',
265+
},
266+
],
267+
name: 'Transfer',
268+
type: 'event',
269+
},
270+
];

packages/hooks/src/hooks/useTokenBalance/useTokenBalance.ts renamed to packages/hooks/src/hooks/useTokenBalance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ethers } from 'ethers';
22
import { useContext, useEffect, useState } from 'react';
3-
import { Web3Context } from '../..';
4-
import ERC20ABI from './ERC20ABI.json';
3+
import { Web3Context } from '..';
4+
import { ERC20ABI } from '../constants';
55
import { BigNumber } from '@ethersproject/bignumber';
66

77
interface Props {

0 commit comments

Comments
 (0)