import { chainIds as e, currentSolanaChainId as t } from "../../constants/chains.constants.mjs";
import { preProcessing as n } from "../../crypto/preProcessing.mjs";
import { createJsonRpcProvider as r } from "./create-provider.mjs";
import i from "../../providers/EthersProviderAdapter.mjs";
import { SolanaProviderAdapter as a } from "../../providers/SolanaProviderAdapter.mjs";
import { ethers as o } from "ethers";
import { PublicKey as s } from "@solana/web3.js";
//#region libs/shared/common/src/functions/utils/prepareHinkal.ts
var c = (t) => {
	let n = r(e.ethMainnet);
	return new o.Wallet(t, n);
}, l = (t) => {
	let n = r(e.ethMainnet);
	return new o.VoidSigner(t, n);
}, u = async (e, t) => {
	await n();
	let r = i();
	r.initSigner?.(t), await e.initProviderAdapter(void 0, r), await e.initUserKeys();
}, d = async (e, t) => {
	let n = i(), r = l(t);
	n.initSigner?.(r), await e.initProviderAdapter(void 0, n);
}, f = (e) => ({
	publicKey: new s(e.userKeys.getDerivedSolanaPublicKey()),
	signTransaction: () => {
		throw Error("Void wallet cannot sign transactions");
	},
	signAllTransactions: () => {
		throw Error("Void wallet cannot sign transactions");
	},
	signMessage: () => {
		throw Error("Void wallet cannot sign messages");
	}
}), p = async (e, n) => {
	let r = new a(t, n), i = f(e);
	await e.initProviderAdapter(i, r);
}, m = async (e, t, r) => {
	await n(), e.initUserKeysWithSignature(r), await p(e, e.userKeys.getDerivedSolanaPublicKey()), await d(e, t);
}, h = async (e, t) => {
	await n(), await e.initUserKeysFromSeedPhrases(t), await p(e, e.userKeys.getDerivedSolanaPublicKey()), await d(e, e.userKeys.getDerivedEthereumAddress());
};
//#endregion
export { c as createSigner, l as createVoidSigner, f as createVoidSolanaWallet, d as prepareEthersProviderAdapter, u as prepareHinkal, h as prepareHinkalFromSeedPhrases, m as prepareHinkalWithSignature, p as prepareSolanaProviderAdapter };
