newFromPrivateKey static method

Future<FuelWallet> newFromPrivateKey({
  1. required String networkUrl,
  2. required String privateKey,
})

Imports the wallet from the provided private key. Mnemonic phrase would be absent, cause it's impossible to infer from private key

Implementation

static Future<FuelWallet> newFromPrivateKey({
  required String networkUrl,
  required String privateKey,
}) async {
  final ISdkWallet sdkWallet;
  if (_isBeta3Url(networkUrl)) {
    final beta3Wallet = await fuels_beta3.FuelWallet.newFromPrivateKey(
      networkUrl: networkUrl,
      privateKey: privateKey,
    );
    sdkWallet = FuelsBeta3SdkWallet(beta3Wallet);
  } else {
    final fuelsWallet = await fuels.FuelWallet.newFromPrivateKey(
      networkUrl: networkUrl,
      privateKey: privateKey,
    );
    sdkWallet = FuelsSdkWallet(fuelsWallet);
  }
  return FuelWallet(sdkWallet);
}