0

I am doing trying to initialize a new Protocol Kit as explained in this Safe tutorial: https://docs.safe.global/sdk/protocol-kit#confirm-the-transaction-second-confirmation

I have this piece of code

import Safe, {SafeConfig, SafeFactory} from "@safe-global/protocol-kit";

const protocolKit = await Safe.init({
        provider: RPC_URL,
        signer: OWNER_1_PRIVATE_KEY,
        safeAddress: SAFE_ADDRESS
    })

And when I run the code, it is returning this error:

const protocolKit = await Safe.init({
                               ^
TypeError: Safe.init is not a function

I don't understand why... since I see that the init function is defined here:

https://github.com/safe-global/safe-core-sdk/blob/main/packages/protocol-kit/src/Safe.ts#L100

1 Answer 1

0

Have you made sure to import this package using either yarn add @safe-global/protocol-kit or pnpm add @safe-global/protocol-kit?

Thank you in advance 🙏

EDIT: Depending on your project ES configuration (e.g. { "type": "module" } in package.json or typescript target configuration) you might also need to do Safe.default.init() instead of Safe.init().

Please let me know if this worked.

Best, Louis

0

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.