Cannot import contracts from truffle directory

Created on 10 January 2019, over 5 years ago
Updated 9 February 2023, over 1 year ago

When trying to import contracts using the "import from truffle" option at /admin/config/ethereum/smartcontract/import-select the process fails with the following error

TypeError: Argument 1 passed to Drupal\ethereum_smartcontract\Form\SmartContractImportThree::getSignature() must be an instance of Drupal\ethereum_smartcontract\Form\object, instance of stdClass given, called in /var/www/drupalvm/drupal/web/modules/contrib/ethereum/ethereum_smartcontract/src/Form/SmartContractFormTrait.php on line 242 in Drupal\ethereum_smartcontract\Form\SmartContractImportThree::getSignature() (line 263 of /var/www/drupalvm/drupal/web/modules/contrib/ethereum/ethereum_smartcontract/src/Form/SmartContractFormTrait.php) #0 /var/www/drupalvm/drupal/web/modules/contrib/ethereum/ethereum_smartcontract/src/Form/SmartContractFormTrait.php(242): Drupal\ethereum_smartcontract\Form\SmartContractImportThree::getSignature(Object(stdClass)) #1 /var/www/drupalvm/drupal/web/modules/contrib/ethereum/ethereum_smartcontract/src/Form/SmartContractFormTrait.php(99): Drupal\ethereum_smartcontract\Form\SmartContractImportThree::abiToTable(Array) #2 /var/www/drupalvm/drupal/web/modules/contrib/ethereum/ethereum_smartcontract/src/Form/SmartContractImportThree.php(55): Drupal\ethereum_smartcontract\Form\SmartContractImportThree->formFromEntity(Array, Object(Drupal\ethereum_smartcontract\Entity\SmartContract)) #3 [internal function]: Drupal\ethereum_smartcontract\Form\SmartContractImportThree->buildForm(Array, Object(Drupal\Core\Form\FormState)) #4 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(518): call_user_func_array(Array, Array) #5 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(275): Drupal\Core\Form\FormBuilder->retrieveForm('ethereum_smartc...', Object(Drupal\Core\Form\FormState)) #6 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Controller/FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm('ethereum_smartc...', Object(Drupal\Core\Form\FormState)) #7 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #8 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #9 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #10 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #11 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #12 /var/www/drupalvm/drupal/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #13 /var/www/drupalvm/drupal/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #14 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /var/www/drupalvm/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /var/www/drupalvm/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /var/www/drupalvm/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(669): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /var/www/drupalvm/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #23 {main}.

The only .sol file that didn't throw an error was a solidity library.

I worked around by removing type hinting at

 protected static function getSignature(object $m)
🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom pau1_m

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Closing this issue as outdated.

    For the record, the module is now ported to D9 with the dev branch 2.0.x.

    FYI, this branch won't be maintained as I'm planning a rework of the module.

Production build 0.71.5 2024