1

I have a problem with creating an ethers adapter with @safe-global/protocol-kit library.
Here is my code:

import { ethers } from 'ethers';
import { EthersAdapter } from '@safe-global/protocol-kit';

const RPC_URL = 'https://api.avax-test.network/ext/C/rpc';
const provider = new ethers.providers.JsonRpcProvider(RPC_URL);

// Initialize signers
export const owner1Signer = new ethers.Wallet('XXXXXXXXXX', provider);
// const owner2Signer = new ethers.Wallet('YYYYYYYYYY', provider);

export const ethAdapterOwner1 = new EthersAdapter({
    ethers,
    signerOrProvider: owner1Signer
});

And when i try to run this code with ts-node initialize.ts, i get an error:

Error: Cannot find module '@safe-global/protocol-kit/contracts/config'
Require stack:
- /home/msolovyev/www/crypto/safe-test-second/node_modules/@safe-global/protocol-kit/dist/src/managers/contractManager.js
- /home/msolovyev/www/crypto/safe-test-second/node_modules/@safe-global/protocol-kit/dist/src/index.js
- /home/msolovyev/www/crypto/safe-test-second/initialize.ts
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/msolovyev/.nvm/versions/node/v16.13.0/lib/node_modules/ts-node/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/msolovyev/www/crypto/safe-test-second/node_modules/@safe-global/protocol-kit/src/managers/contractManager.ts:6:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .js] (/home/msolovyev/.nvm/versions/node/v16.13.0/lib/node_modules/ts-node/src/index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/msolovyev/www/crypto/safe-test-second/node_modules/@safe-global/protocol-kit/dist/src/managers/contractManager.js',
    '/home/msolovyev/www/crypto/safe-test-second/node_modules/@safe-global/protocol-kit/dist/src/index.js',
    '/home/msolovyev/www/crypto/safe-test-second/initialize.ts'
  ]
}

But! At the same time, all modules are installed. Here is my package.json file:

{
  "name": "safe-test-second",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@safe-global/api-kit": "^1.0.0",
    "@safe-global/protocol-kit": "^0.1.0",
    "@safe-global/safe-core-sdk-types": "^1.10.0",
    "dotenv": "^16.0.3",
    "ethers": "5.7.2"
  }
}

Also, if click on import { EthersAdapter } from '@safe-global/protocol-kit';
and then on import { getCompatibilityFallbackHandlerContract, getCreateCallContract, getMultiSendCallOnlyContract, getMultiSendContract, getProxyFactoryContract, getSafeContract, getSignMessageLibContract } from './contracts/safeDeploymentContracts';
i see this: enter image description here

1 Answer 1

1

Could you test using:

  • protocol-kit v0.1.1
  • api-kit 1.0.1
  • safe-core-sdk-types v1.10.1
1
  • Wow o_0. Looks like its working now!!! Great job! Apr 13, 2023 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.