Skip to content

Commit 3fc4a98

Browse files
committed
update abi
1 parent b49507a commit 3fc4a98

File tree

4 files changed

+29
-1070
lines changed

4 files changed

+29
-1070
lines changed

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"update_royalty_address": "node utils/nftport/updateContract.js -u royalty_address",
3535
"update_base_uri": "node utils/nftport/updateContract.js -u base_uri",
3636
"update_prereveal_token_uri": "node utils/nftport/updateContract.js -u prereveal_token_uri",
37-
"⏬⏬⏬": "FOR MAC USERS: Replace %npm_config_xyz% with $npm_config_start ⏬⏬⏬",
37+
"⏬⏬⏬": "FOR MAC USERS: Replace %npm_config_xyz% with $npm_config_xyz ⏬⏬⏬",
3838
"refresh_os": "node utils/functions/refreshOpensea %npm_config_start% %npm_config_end%"
3939
},
4040
"author": "Jesse Hall (codeSTACKr)",

backend/src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ try {
8383
`${basePath}/build/contract/_contract.json`
8484
);
8585
const contractData = JSON.parse(rawContractData);
86-
if (contractData.response === "OK" && contractData.error === null) {
86+
if (contractData.response === "OK") {
8787
CONTRACT_ADDRESS = contractData.contract_address;
8888
}
8989
} catch (error) {

backend/utils/nftport/retrieveContract.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const retrieveContract = async () => {
2929
);
3030
if (response.response === "OK") {
3131
console.log(`Contract ${CONTRACT_NAME} deployed successfully`);
32+
retrieveABI(response.contract_address);
3233
} else {
3334
console.log(`Contract ${CONTRACT_NAME} deployment failed`);
3435
}
@@ -40,4 +41,29 @@ const retrieveContract = async () => {
4041
}
4142
};
4243

44+
const retrieveABI = async (contract_address) => {
45+
try {
46+
const chain = CHAIN.toLowerCase();
47+
const url = `https://api.nftport.xyz/v0/me/contracts/abis/${contract_address}?chain=${chain}`;
48+
const options = {
49+
method: "GET",
50+
headers: {
51+
"Content-Type": "application/json",
52+
},
53+
};
54+
const response = await fetchNoRetry(url, options);
55+
fs.writeFileSync(
56+
`${basePath}/build/contract/_contract_abi.json`,
57+
JSON.stringify(response.abi, null, 2)
58+
);
59+
if (response.response === "OK") {
60+
console.log(`Contract ${CONTRACT_NAME} ABI successful`);
61+
} else {
62+
console.log(`Contract ${CONTRACT_NAME} ABI failed`);
63+
}
64+
} catch (error) {
65+
console.log(`CATCH: Contract ${CONTRACT_NAME} ABI failed`, `ERROR: ${error}`);
66+
}
67+
};
68+
4369
retrieveContract();

0 commit comments

Comments
 (0)