Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate custodial wallet. #4186

Closed
PreetamEnverx opened this issue Jan 6, 2024 · 3 comments
Closed

Unable to generate custodial wallet. #4186

PreetamEnverx opened this issue Jan 6, 2024 · 3 comments
Assignees

Comments

@PreetamEnverx
Copy link

import { BitGoAPI } from "@bitgo/sdk-api";
import { Gteth } from "@bitgo/sdk-coin-eth";

const bitgo = new BitGoAPI({
  env: "test",
  accessToken: process.env.BITGO_ACCESS_TOKEN,
});
const BITGO_ENTERPRISE = process.env.BITGO_ENTERPRISE;
const printObj = (o) => console.log(JSON.stringify(o));

bitgo.register("gteth", Gteth.createInstance);

async function generateCustodialMultiSigWallet() {
  const newWallet = await bitgo.coin("gteth").wallets().generateWallet({
    type: "custodial",
    label: "psr-cold-ms-gteth-1",
    enterprise: BITGO_ENTERPRISE,
    walletVersion: 2,
    /* passphrase: "secret", */
    multisigType: "onchain",
  });
  printObj(newWallet);
}

generateCustodialMultiSigWallet().then(() =>
  console.log("Generated custodial wallet."),
);

Above code throws Error: cannot generate user keypair without passphrase when I do not pass passphrase.
And it throws ApiResponseError: There is no need to pass any keys or keySignatures nor is it required to pass m or n. when I uncomment and do pass passphrase.

Call stack for when I don't pass passphrase:

    at userKeychainPromise (/home/preetam/my_stuff/nodejs/playground/node_modules/@bitgo/sdk-core/dist/src/bitgo/wallet/wallets.js:344:27)
    at Wallets.generateWallet (/home/preetam/my_stuff/nodejs/playground/node_modules/@bitgo/sdk-core/dist/src/bitgo/wallet/wallets.js:388:27)
@PreetamEnverx
Copy link
Author

Using bitgo-express throws the same error, even though from UI I'm able to create the wallet. In the Network tab of Browser Dev tools, I can see same payload being sent to server. Can't seem to understand why isn't it working through SDK or Bitgo-Express.

@alebusse
Copy link
Contributor

alebusse commented Jan 9, 2024

Custodial wallet generation is currently missing in the SDK/Express for onchain multisig type since we recently added the possibility for MPC wallets, i will put a fix soon but in the meantime you can try to create custodial wallets using BitGO API directly with:

POST /api/v2/{coin}/wallet

Request Body
{
  "label": "Wallet label",
  "enterprise": "62c...df7",
  "multisigType": "onchain",
  "type": "custodial",
  "version":"2",
}

https://developers.bitgo.com/guides/wallets/create/wallets

@alebusse alebusse self-assigned this Jan 9, 2024
@alexhu-bitgo
Copy link
Contributor

alexhu-bitgo commented Jun 5, 2024

I'm closing this issue since we've fixed the bug. You should be able to generate this type of wallet now.
PR that fixed the issue: #4543

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants