Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Issues with connecting to Testnet via API #613

Open
SurpriseMF3000 opened this issue Sep 9, 2022 · 2 comments
Open

Issues with connecting to Testnet via API #613

SurpriseMF3000 opened this issue Sep 9, 2022 · 2 comments

Comments

@SurpriseMF3000
Copy link

Hello,
im facing Issues with with connecting to Testnet via Alamofire.

Error:

ERROR : API IN: POST https://btc-testnet.horizontalsystems.xyz/api/tx/address
noResponse(reason: Optional("Session was invalidated without error, so it was likely deinitialized unexpectedly. Be sure to retain a reference to your Session for the duration of your requests."))

Code:

    func checkbalance(){
        
        print("CheckBalance start");
        
        let bitcoinKit: BitcoinKit
    
        let words = [Safety wise]
    
        bitcoinKit = try! BitcoinKit(withWords: words, bip: .bip44, walletId: "bitcoin-wallet-id", syncMode: .api, networkType: .testNet, logger: .none)

    
        bitcoinKit.start()
        
        
        print(bitcoinKit.receiveAddress())
        
        print(bitcoinKit.balance)
        
        print(bitcoinKit.statusInfo)
        
        try? bitcoinKit.send(to: "mrjQyzbX9SiJxRC2mQhT4LvxFEmt9KEeRY", value: 1000, feeRate: 10000, sortType: .none)
        
        
        print("BTC session completed!")
        
        
        bitcoinKit.stop()
    
    }

Thanks for Help!

@ealymbaev
Copy link
Member

You should retain an instance of BitcoinKit in order to survive the sync process. In your case - your BitcoinKit instance is being stopped and destroyed immediately.

@SurpriseMF3000
Copy link
Author

How?
If im deleting bitcoinKit.stop(), im getting the same error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants