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

Pass (sub)walletId in Mnemonic provider #116

Open
midas-myth opened this issue Jun 16, 2024 · 0 comments
Open

Pass (sub)walletId in Mnemonic provider #116

midas-myth opened this issue Jun 16, 2024 · 0 comments

Comments

@midas-myth
Copy link

midas-myth commented Jun 16, 2024

hello thank you for your library

export class MnemonicProvider implements SendProvider {

WalletContractV3R2 accepts walletId, but there is no way to pass it right now. As only mnemonic and wallet version are being read from environment. We could add another env variable and pass it through.

export class MnemonicProvider implements SendProvider {
    #wallet: OpenedContract<WalletInstance>;
    #secretKey: Buffer;
    #client: TonClient4 | TonClient;
    #ui: UIProvider;

    constructor(params: {
        version: WalletVersion;
        workchain?: number;
        secretKey: Buffer;
        client: TonClient4 | TonClient;
        ui: UIProvider;
        // here sould bw walletId
    }) {
        if (!(params.version in wallets)) {
            throw new Error(`Unknown wallet version ${params.version}`);
        }

        const kp = keyPairFromSecretKey(params.secretKey);
        this.#client = params.client;
        this.#wallet = openContract<WalletInstance>(
            wallets[params.version].create({
                workchain: params.workchain ?? 0,
                publicKey: kp.publicKey,
                // here should be walletId
            }),
            (params) => this.#client.provider(params.address, params.init),
        );
        this.#secretKey = kp.secretKey;
        this.#ui = params.ui;
    }
    // ...
}

If would like i could provide a pr adding env var parsing. seems it might solve

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

1 participant