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

Unable to Create an Account with the Managed Account Factory smart contract using AWS KMS wallet #2340

Closed dynamitesushi closed 5 months ago

dynamitesushi commented 7 months ago

Creating an account works fine with a personal wallet but as soon as I swap out the wallet with an AWS KMS wallet, it returns method not found error. I was told to use @thirdweb-dev/wallets@0.0.0-dev-279d4b9-20240108185806 but it still does not work.

Code:

import { ThirdwebSDK } from "@thirdweb-dev/sdk";
import { AwsKmsWallet } from "@thirdweb-dev/wallets/evm/wallets/aws-kms";

try {
    const keyId = 'xxx';

    const accessKeyId = 'xxx';
    const secretAccessKey = 'xxx';
    const sessionToken = 'xxx';

    const wallet = new AwsKmsWallet({
        region: "us-east-1",
        accessKeyId,
        secretAccessKey,
        sessionToken,
        keyId,
    });

    const sdk = await ThirdwebSDK.fromWallet(wallet, "mumbai", {
        secretKey: "xxx",
        gasless: {
             openzeppelin: {
                 relayerUrl: "xxx",
             },
        },
    });

    const contract = await sdk.getContract("__CONTRACT_ADDRESS__");
    const address = await sdk.getSigner().getAddress();

    const call = await contract.call('createAccount', [address, "0x00"]);

    console.log('success', call);
} catch (error) {
    console.log(error);
    console.log('error', error.__type);
}

Error I receive:

Error: method not found
    at /Users/xxxx/Desktop/t/node_modules/@thirdweb-dev/sdk/dist/index-9e246d77.cjs.dev.js:252:27
    at Array.forEach (<anonymous>)
    at ethers.utils.fetchJson.then.emit.action (/Users/xxxx/Desktop/t/node_modules/@thirdweb-dev/sdk/dist/index-9e246d77.cjs.dev.js:245:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: -32601,
  dat

Tagging: @warengonzaga

warengonzaga commented 7 months ago

Hey @dynamitesushi thanks for reaching out let me add @MananTank and @jnsdls here.

joaquim-verges commented 7 months ago

@dynamitesushi this should have been fixed in the latest version I believe.

Can you try with latest stable?

Also, have you considered using Engine for your use case? It's much more robust that using KMS wallet + relayer and easy to manage from the dashboard.

https://portal.thirdweb.com/engine

stale[bot] commented 5 months 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.