thirdweb-dev / js

Best in class web3 SDKs for Browser, Node and Mobile apps
https://thirdweb.com
Apache License 2.0
430 stars 328 forks source link

[typescript] deployBuiltInContract error #1427

Closed sejoon4274 closed 11 months ago

sejoon4274 commented 1 year ago

changed error message

hi.I tried deploying the builtin contract 'edition' and i got the following error. According to the error, the wallet had insufficient MATIC. The critical issue is that the express server is down with the error

[environment] windows 10. npx thirdweb create app

EVM Express Typescript

node version - 18.16.0, 16.15.0 (both are same result. using nvm)

[dependencies] "@thirdweb-dev/sdk": "^3", "dotenv": "^16.0.3", "express": "^4.18.2", "ethers": "^5"

also tried, "@thirdweb-dev/sdk": "3.10.42", "@thirdweb-dev/storage": "1.2.0", "ethers": "^5.7.2"

[source code]

import { ThirdwebSDK } from "@thirdweb-dev/sdk";
import { Request, Response } from "express";

const generateSignature = async (req: Request, res: Response) => {
  // Get the address from the request body
  const { address } = req.body;

  // Initialize the SDK with your private key
  const sdk = ThirdwebSDK.fromPrivateKey(
    '16a98dbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
    "mumbai",
    {
      secretKey: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
    }
  );

  const txResult = await sdk.deployer.deployBuiltInContract('edition', {
    name: 'My Contract',
    primary_sale_recipient: '0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    voting_token_address: '0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', // Only used for Vote
  });

[errors]

Failed to get Contract Metadata from IPFS, defaulting to onchain registry Could not resolve metadata for contract at 0x5DBC7B840baa9daBcBe9D2492E45D7244
B54A2A0
D:\workspace\boilerplate_workspace\samples\test-thirdweb\node_modules\@thirdweb-dev\sdk\dist\contract-publisher-1cd5757a.cjs.dev.js:6091
    return new TransactionError({
           ^
TransactionError:
╔═══════════════════╗
║ TRANSACTION ERROR ║
╚═══════════════════╝
Reason: insufficient funds for intrinsic transaction cost
╔═════════════════════════╗
║ TRANSACTION INFORMATION ║
╚═════════════════════════╝
from:      0xB4e9317b0130b2e467d6c18EB8181708cE530b2A
to:        0x5DBC7B840baa9daBcBe9D2492E45D7244B54A2A0 (TWFactory)
chain:     maticmum (80001)
rpc:       mumbai.rpc.thirdweb.com
tx hash:   0xb21391ef5891e5e41b6b4e89c416fe64139fbe8d0f1bb141ff2cda87cc501303
data:      0x11b804ab0000000000000000000000004fa15bae96f5816c268f3b473cf67e223644d5360000000000000000000000000000000000000000000000000000000000000060333
83534343932380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000264e15916340000000000000000000
00000b4e9317b0130b2e467d6c18eb8181708ce530b2a00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000
00000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000200000
000000000000000000000b4e9317b0130b2e467d6c18eb8181708ce530b2a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000b4d7920436f6e747261637400000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037697066733a2f2f516d576e31644d35666a6
7387551413644427a7272395131776f34505976584a4845686f557151787075684655672f3000000000000000000000000000000000000000000000000000000000000000000000000000000
00002000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a810000000000000000000000009399bb24dbb5c4b782c70c2969f58716ebbd6a3b0000000000000000000
0000000000000000000000000000000000000
method:
  deployProxyByImplementation(
    "0x4fa15bAe96F5816c268f3B473Cf67E223644D536",
"0xe1591634000000000000000000000000b4e9317b0130b2e467d6c18eb8181708ce530b2a0000000000000000000000000000000000000000000000000000000000000140000000000
    "0x3338353434393238000000000000000000000000000000000000000000000000"
  )
╔═════════════════════╗
║ DEBUGGING RESOURCES ║
╚═════════════════════╝
    at Transaction.transactionError (D:\workspace\boilerplate_workspace\samples\test-thirdweb\node_modules\@thirdweb-dev\sdk\dist\contract-publisher-1cd5757a.cjs.dev.js:6091:12)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Transaction.send (D:\workspace\boilerplate_workspace\samples\test-thirdweb\node_modules\@thirdweb-dev\sdk\dist\contract-publisher-1cd5757a.cjs.dev.js:5939:13)
    at async Transaction.execute (D:\workspace\boilerplate_workspace\samples\test-thirdweb\node_modules\@thirdweb-dev\sdk\dist\contract-publisher-1cd5757a.cjs.dev.js:5947:16)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
MananTank commented 1 year ago

@sejoon4274 You can wrap the code that may throw in try-catch to avoid crashing

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.