-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathnftcatalog.js
More file actions
173 lines (124 loc) · 6.12 KB
/
Copy pathnftcatalog.js
File metadata and controls
173 lines (124 loc) · 6.12 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import { mintFlow, deployContractByName, sendTransaction, executeScript } from '@onflow/flow-js-testing'
import { getAdminAddress } from './common'
export const deployNFTCatalog = async () => {
const NFTCatalogAdmin = await getAdminAddress()
await mintFlow(NFTCatalogAdmin, '10.0')
await deployContractByName({ to: NFTCatalogAdmin, name: 'NonFungibleToken' })
await deployContractByName({ to: NFTCatalogAdmin, name: 'MetadataViews' })
await deployContractByName({ to: NFTCatalogAdmin, name: 'NFTCatalog' })
await deployContractByName({ to: NFTCatalogAdmin, name: 'NFTCatalogAdmin' })
}
export const updateSnapshotAdmin = async (catalogAccount, collections) => {
const name = 'update_snapshot_admin';
const args = [collections]
const signers = [catalogAccount];
return sendTransaction({ name, args, signers });
}
export const updateShouldUseSnapshotAdmin = async (catalogAccount, shouldUseSnapshot) => {
const name = 'set_snapshot_enabled_admin';
const args = [shouldUseSnapshot]
const signers = [catalogAccount]
return sendTransaction({ name, args, signers })
}
export const addToCatalogAdmin = async (collectionIdentifier, contractName, contractAddress, nftTypeIdentifier, addressWithNFT, nftID, publicPathIdentifier) => {
const NFTCatalogAdmin = await getAdminAddress();
const name = 'add_to_nft_catalog_admin';
const signers = [NFTCatalogAdmin];
const args = [collectionIdentifier, contractName, contractAddress, nftTypeIdentifier, addressWithNFT, nftID, publicPathIdentifier];
return sendTransaction({ name, args, signers });
}
export const addToCatalog = async (proxyAccount, collectionIdentifier, contractName, contractAddress, nftTypeIdentifier, addressWithNFT, nftID, publicPathIdentifier) => {
const name = 'add_to_nft_catalog';
const signers = [proxyAccount];
const args = [collectionIdentifier, contractName, contractAddress, nftTypeIdentifier, addressWithNFT, nftID, publicPathIdentifier];
return sendTransaction({ name, args, signers });
}
export const removeFromNFTCatalog = async (proxyAccount, collectionIdentifier) => {
const name = 'remove_from_nft_catalog';
const signers = [proxyAccount];
const args = [collectionIdentifier];
return sendTransaction({ name, args, signers });
}
export const updateNFTCatalogEntry = async (proxyAccount, collectionIdentifier, contractName, contractAddress, nftTypeIdentifier, addressWithNFT, publicPathIdentifier) => {
const name = 'update_nft_catalog_entry';
const signers = [proxyAccount];
const args = [collectionIdentifier, contractName, contractAddress, nftTypeIdentifier, addressWithNFT, publicPathIdentifier];
return sendTransaction({ name, args, signers });
}
export const setupNFTCatalogAdminProxy = async (account) => {
const name = 'setup_nft_catalog_admin_proxy';
const signers = [account];
return sendTransaction({ name, signers })
}
export const sendAdminProxyCapability = async (ownerAccount) => {
const NFTCatalogAdmin = await getAdminAddress();
const signers = [NFTCatalogAdmin];
const name = 'send_admin_capability_to_proxy';
const args = [ownerAccount];
return sendTransaction({ name, args, signers });
}
export const proposeNFTToCatalog = async (account, collectionIdentifier, contractName, contractAddress, nftTypeIdentifier, storagePathIdentifier, publicPathIdentifier, publicLinkedTypeIdentifier, collectionName, collectionDescription, externalURL, squareURL, squareMediaType, bannerURL, bannerMediaType, socials, message) => {
const name = 'propose_nft_to_catalog';
const args = [collectionIdentifier, contractName, contractAddress, nftTypeIdentifier, storagePathIdentifier, publicPathIdentifier, publicLinkedTypeIdentifier, collectionName, collectionDescription, externalURL, squareURL, squareMediaType, bannerURL, bannerMediaType, socials, message];
const signers = [account];
return sendTransaction({ name, args, signers });
}
export const withdrawNFTProposalFromCatalog = async (account, proposalID) => {
const name = 'withdraw_nft_proposal_from_catalog';
const args = [proposalID];
const signers = [account];
return sendTransaction({ name, args, signers });
}
export const approveNFTProposal = async (account, proposalID) => {
const name = 'approve_nft_catalog_proposal';
const args = [proposalID];
const signers = [account];
return sendTransaction({ name, args, signers });
}
export const rejectNFTProposal = async (account, proposalID) => {
const name = 'reject_nft_catalog_proposal';
const args = [proposalID];
const signers = [account];
return sendTransaction({ name, args, signers });
}
export const removeNFTProposal = async (account, proposalID) => {
const name = 'remove_nft_catalog_proposal';
const args = [proposalID];
const signers = [account];
return sendTransaction({ name, args, signers });
}
export const hasAdminProxy = async (ownerAccount) => {
const name = 'has_admin_proxy';
const args = [ownerAccount];
return executeScript({ name, args });
}
export const isCatalogAdmin = async (ownerAccount) => {
const name = 'is_catalog_admin';
const args = [ownerAccount];
return executeScript({ name, args });
}
export const getNFTMetadataForCollectionIdentifier = async (collectionIdentifier) => {
const name = 'get_nft_metadata_for_collection_identifier';
const args = [collectionIdentifier];
return executeScript({ name, args });
}
export const getNFTCollectionsForNFTType = async (nftTypeIdentifier) => {
const name = 'get_nft_collections_for_nft_type';
const args = [nftTypeIdentifier];
return executeScript({ name, args });
}
export const getNFTProposalForID = async (proposalID) => {
const name = 'get_nft_proposal_for_id';
const args = [proposalID];
return executeScript({ name, args });
}
export const getInitFunction = async (collectionIdentifier) => {
const name = "get_init_script";
const args = [collectionIdentifier]
return executeScript({ name, args })
}
export const getFullCatalog = async () => {
const name = 'get_full_nft_catalog';
const args = []
return executeScript({ name, args });
}