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

kmdClient defaults not retrieved properly #174

Open
ShoGinn opened this issue Nov 24, 2023 · 0 comments
Open

kmdClient defaults not retrieved properly #174

ShoGinn opened this issue Nov 24, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@ShoGinn
Copy link

ShoGinn commented Nov 24, 2023

Correct me if I'm not utilizing this correctly but if you are getting an account mnemonic from the environment without passing kmdClient

if (await isLocalNet(algod)) {
return await getOrCreateKmdWalletAccount({ name, fundWith }, algod, kmdClient)
}

export async function getOrCreateKmdWalletAccount(
walletAccount: { name: string; fundWith?: AlgoAmount },
algod: Algodv2,
kmdClient?: Kmd,
): Promise<Account> {
const kmd = kmdClient ?? getAlgoKmdClient()

Instead of getting from the environment...

export function getAlgoKmdClient(config?: AlgoClientConfig): Kmd {
const { token, server } = config ?? getAlgodConfigFromEnvironment()
// We can only use Kmd on the LocalNet otherwise it's not exposed so this makes some assumptions
// (e.g. same token and server as algod and port 4002 by default)
return new Kmd(token as string, server, process?.env?.KMD_PORT ?? '4002')
}

Would it be better served to use:

  getConfigFromEnvOrDefaults()

I think this provides a more logical solution if the localnet is found... or is this too circular?

@robdmoore robdmoore added the enhancement New feature or request label Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants