reaster / cardano_wallet_sdk

Targeting Flutter apps, the Cardano Wallet SDK is a high-level Dart library for managing cryptocurrency accounts & executing transactions on the blockchain.
Apache License 2.0
39 stars 17 forks source link

blockfrost not working with prepod https://cardano-preprod.blockfrost.io/api/v0/ #16

Open Imdavyking opened 2 years ago

Imdavyking commented 2 years ago

Good morning please how do i use prepod as testnet with the api.

Imdavyking commented 2 years ago

also i want to use a default address for all transaction both receive and change

reaster commented 2 years ago

My apologies. I've had limited time to work on this recently. I did manage to update the blockfrost API (a prerequisite for future work). Currently wallet balances are working, but transaction submittal is not.

As for your specific question. To obtain the default address, just call unusedReceiveAddresses() without arguments and grab the first address in the list:

    test('Get the default (first) address from wallet', () {
      final wallet = (WalletBuilder()
            ..network = Networks.testnet
            ..testnetAdapterKey = blockfrostKey
            ..mnemonic = mnemonic)
          .build()
          .unwrap();
      final ShelleyReceiveKit addr0 =
          wallet.account.unusedReceiveAddresses()[0];
      logger.info("${addr0.chain}: ${addr0.address}");
      //m/1852'/1815'/0'/0/0: addr_test1qputeu63ld6c0cd526w90ry2r9upc5ac8y3zetcg85xs5l924fm4c4hnud6cw53zj8v48kdwmeykn0knf74ag68tmf9sutu8kq
    });