-
-
Notifications
You must be signed in to change notification settings - Fork 168
/
ERC1155Standard.test.ts
52 lines (46 loc) · 1.46 KB
/
ERC1155Standard.test.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
import Web3 from 'web3';
import HttpProvider from 'ethjs-provider-http';
import nock from 'nock';
import { ERC1155Standard } from './ERC1155Standard';
const MAINNET_PROVIDER = new HttpProvider(
'https://mainnet.infura.io/v3/341eacb578dd44a1a049cbc5f6fd4035',
);
const ERC1155_ADDRESS = '0xfaaFDc07907ff5120a76b34b731b278c38d6043C';
describe('ERC1155Standard', () => {
let erc1155Standard: ERC1155Standard;
let web3: any;
nock.disableNetConnect();
beforeAll(() => {
web3 = new Web3(MAINNET_PROVIDER);
erc1155Standard = new ERC1155Standard(web3);
});
afterAll(() => {
nock.restore();
});
it('should determine if contract supports URI metadata interface correctly', async () => {
nock('https://mainnet.infura.io:443', { encodedQueryParams: true })
.post('/v3/341eacb578dd44a1a049cbc5f6fd4035', {
jsonrpc: '2.0',
id: 1,
method: 'eth_call',
params: [
{
to: '0xfaaFDc07907ff5120a76b34b731b278c38d6043C',
data: '0x01ffc9a70e89341c00000000000000000000000000000000000000000000000000000000',
},
'latest',
],
})
.reply(200, {
jsonrpc: '2.0',
id: 1,
result:
'0x0000000000000000000000000000000000000000000000000000000000000001',
});
const contractSupportsUri =
await erc1155Standard.contractSupportsURIMetadataInterface(
ERC1155_ADDRESS,
);
expect(contractSupportsUri).toBe(true);
});
});