-
Notifications
You must be signed in to change notification settings - Fork 109
/
index.ts
97 lines (90 loc) Β· 3.72 KB
/
index.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
96
97
import {get} from '../connector/tatum';
import {
CeloBurnErc721,
CeloDeployErc721,
CeloMintErc721,
CeloMintMultipleErc721,
CeloTransferErc721,
Currency,
EthBurnErc721,
EthDeployErc721,
EthMintErc721,
EthMintMultipleErc721,
EthTransferErc721,
Rate
} from '../model';
import {
sendBep721Transaction,
sendBurnBep721Transaction,
sendBurnErc721Transaction,
sendCeloBurnErc721Transaction,
sendCeloDeployErc721Transaction,
sendCeloMinErc721Transaction,
sendCeloMintMultipleErc721Transaction,
sendCeloTransferErc721Transaction,
sendDeployBep721Transaction,
sendDeployErc721Transaction,
sendErc721Transaction,
sendMintBep721Transaction,
sendMintErc721Transaction,
sendMintMultipleBep721Transaction,
sendMintMultipleErc721Transaction
} from '../transaction';
/**
* For more details, see <a href="https://tatum.io/apidoc#operation/NftGetByAddress" target="_blank">Tatum API documentation</a>
*/
export const getNFTsByAddress = async (chain: Currency, contractAddress: string, address: string): Promise<Rate> => get(`/v3/nft/balance/${chain}/${contractAddress}/${address}`);
/**
* For more details, see <a href="https://tatum.io/apidoc#operation/NftGetURI" target="_blank">Tatum API documentation</a>
*/
export const getNFTMetadataURI = async (chain: Currency, contractAddress: string, tokenId: string): Promise<Rate> => get(`/v3/nft/metadata/${chain}/${contractAddress}/${tokenId}`);
export const deployNFT = async (testnet: boolean, body: CeloDeployErc721 | EthDeployErc721, provider?: string) => {
switch (body.chain) {
case Currency.CELO:
return sendCeloDeployErc721Transaction(testnet, body as CeloDeployErc721, provider);
case Currency.ETH:
return sendDeployErc721Transaction(body, provider);
case Currency.BSC:
return sendDeployBep721Transaction(body, provider);
}
};
export const mintNFTWithUri = async (testnet: boolean, body: CeloMintErc721 | EthMintErc721, provider?: string) => {
switch (body.chain) {
case Currency.CELO:
return sendCeloMinErc721Transaction(testnet, body as CeloMintErc721, provider);
case Currency.ETH:
return sendMintErc721Transaction(body, provider);
case Currency.BSC:
return sendMintBep721Transaction(body, provider);
}
};
export const mintMultipleNFTWithUri = async (testnet: boolean, body: CeloMintMultipleErc721 | EthMintMultipleErc721, provider?: string) => {
switch (body.chain) {
case Currency.CELO:
return sendCeloMintMultipleErc721Transaction(testnet, body as CeloMintMultipleErc721, provider);
case Currency.ETH:
return sendMintMultipleErc721Transaction(body, provider);
case Currency.BSC:
return sendMintMultipleBep721Transaction(body, provider);
}
};
export const burnNFT = async (testnet: boolean, body: CeloBurnErc721 | EthBurnErc721, provider?: string) => {
switch (body.chain) {
case Currency.CELO:
return sendCeloBurnErc721Transaction(testnet, body as CeloBurnErc721, provider);
case Currency.ETH:
return sendBurnErc721Transaction(body, provider);
case Currency.BSC:
return sendBurnBep721Transaction(body, provider);
}
};
export const transferNFT = async (testnet: boolean, body: CeloTransferErc721 | EthTransferErc721, provider?: string) => {
switch (body.chain) {
case Currency.CELO:
return sendCeloTransferErc721Transaction(testnet, body as CeloTransferErc721, provider);
case Currency.ETH:
return sendErc721Transaction(body, provider);
case Currency.BSC:
return sendBep721Transaction(body, provider);
}
};