Open nemoRevers opened 1 year ago
Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); final String mnemonic = generateMnemonic(); final DescriptorSecretKey secretKey = await (await DescriptorSecretKey.create( network: Network.Regtest, mnemonic: await Mnemonic.fromString(mnemonic), )) .derive(await DerivationPath.create(path: "m/49'/0'/0'")); final Descriptor descriptorExternal = await Descriptor.newBip49( secretKey: secretKey, network: Network.Regtest, keychain: KeychainKind.External, ); final Descriptor descriptorInternal = await Descriptor.newBip49( secretKey: secretKey, network: Network.Regtest, keychain: KeychainKind.Internal, ); final Wallet wallet = await Wallet.create( descriptor: descriptorExternal, changeDescriptor: descriptorInternal, network: Network.Regtest, databaseConfig: const DatabaseConfig.memory(), ); final AddressInfo address = await wallet.getAddress(addressIndex: const AddressIndex.reset(index: 0)); print(address.address); final Blockchain blockchain = await Blockchain.create( config: const BlockchainConfig.rpc( config: RpcConfig( url: 'http://127.0.0.1:18443', network: Network.Regtest, authUserPass: UserPass( username: "your_username", password: "your_password", ), walletName: 'bdk_flutter', ), ), ); await wallet.sync(blockchain); await wallet.getBalance(); }
I catch error below on wallet.sync(...)
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Rpc(Transport(SocketError(Os { code: 35, kind: WouldBlock, message: "Resource temporarily unavailable" }))))
I catch error below on wallet.sync(...)
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Rpc(Transport(SocketError(Os { code: 35, kind: WouldBlock, message: "Resource temporarily unavailable" }))))
0 Wallet.sync (package:bdk_flutter/src/root.dart:1200:7)