Skip to content

Commit 267d634

Browse files
committed
remove decoding logic, fetch from contract-api
1 parent fbe5954 commit 267d634

File tree

5 files changed

+3
-96
lines changed

5 files changed

+3
-96
lines changed

packages/thirdweb/src/contract/actions/compiler-metadata.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export function formatCompilerMetadata(
4040
if ("source_metadata" in metadata) {
4141
meta = metadata.source_metadata;
4242
}
43-
4443
const compilationTarget = meta.settings.compilationTarget;
4544
const targets = Object.keys(compilationTarget);
4645
const name = compilationTarget[targets[0] as keyof typeof compilationTarget];

packages/thirdweb/src/contract/actions/extract-uri-from-calldata.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

packages/thirdweb/src/contract/actions/get-compiler-metadata.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { ThirdwebContract } from "../contract.js";
22
import { formatCompilerMetadata } from "./compiler-metadata.js";
3-
import { extractUriFromCalldata } from "./extract-uri-from-calldata.js";
43

54
/**
65
* Down the compiled metadata from thirdweb contract api and format it
@@ -22,7 +21,6 @@ import { extractUriFromCalldata } from "./extract-uri-from-calldata.js";
2221
*/
2322
export async function getCompilerMetadata(contract: ThirdwebContract) {
2423
const { address, chain } = contract;
25-
2624
const response = await fetch(
2725
`https://contract.thirdweb.com/metadata/${chain.id}/${address}`,
2826
{
@@ -33,17 +31,6 @@ export async function getCompilerMetadata(contract: ThirdwebContract) {
3331
},
3432
);
3533
if (!response.ok) {
36-
// try to get it from creation calldata
37-
try {
38-
const metadata = await extractUriFromCalldata({
39-
client: contract.client,
40-
chain: contract.chain,
41-
contractAddress: contract.address,
42-
});
43-
44-
return formatCompilerMetadata(metadata);
45-
} catch {}
46-
4734
const errorMsg = await response.json();
4835
throw new Error(
4936
errorMsg.message || errorMsg.error || "Failed to get compiler metadata",

packages/thirdweb/src/contract/actions/resolve-abi.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { download } from "../../storage/download.js";
33
import { getClientFetch } from "../../utils/fetch.js";
44
import { withCache } from "../../utils/promise/withCache.js";
55
import { type ThirdwebContract, getContract } from "../contract.js";
6-
import { extractUriFromCalldata } from "./extract-uri-from-calldata.js";
76

87
/**
98
* Resolves the ABI (Application Binary Interface) for a given contract.
@@ -44,28 +43,15 @@ export function resolveContractAbi<abi extends Abi>(
4443
return (await resolveCompositeAbi(contract as ThirdwebContract)) as abi;
4544
}
4645

46+
// try to get it from the api
4747
try {
48-
// try to get it from the api
4948
return (await resolveAbiFromContractApi(
5049
contract,
5150
contractApiBaseUrl,
5251
)) as abi;
5352
} catch {
54-
try {
55-
// try to get it from creation calldata
56-
const metadata = await extractUriFromCalldata({
57-
client: contract.client,
58-
chain: contract.chain,
59-
contractAddress: contract.address,
60-
});
61-
62-
return metadata.output.abi as abi;
63-
} catch {
64-
// if that fails, try to resolve it from the bytecode
65-
return (await resolveCompositeAbi(
66-
contract as ThirdwebContract,
67-
)) as abi;
68-
}
53+
// if that fails, try to resolve it from the bytecode
54+
return (await resolveCompositeAbi(contract as ThirdwebContract)) as abi;
6955
}
7056
},
7157
{

packages/thirdweb/src/utils/any-evm/decode-uri-from-calldata.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)