Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(zenledger): add entry point and export functionality to tools menu #1276

Merged
merged 6 commits into from
Apr 5, 2024

Conversation

HashEngineering
Copy link
Collaborator

Issue being fixed or feature implemented

  • Entry Point in Tools Menu
  • Export Function

Related PR's and Dependencies

Screenshots / Videos

How Has This Been Tested?

  • QA (Mobile Team)

Checklist:

  • I have performed a self-review of my own code and added comments where necessary
  • I have added or updated relevant unit/integration/functional/e2e tests

@HashEngineering HashEngineering self-assigned this Apr 3, 2024
Comment on lines +51 to +87
val addresses = if (transactions.isEmpty()) {
listOf(
ZenLedgerAddress(
DASH_CURRENCY,
DASH_CURRENCY,
wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS).toBase58(),
"Dash Wallet"
)
)
} else {
val addresses = arrayListOf<ZenLedgerAddress>()
transactions.forEach { tx ->
tx.outputs.forEach { output ->
if (output.isMine(wallet)) {
log.info(
output.value.toFriendlyString(),
Address.fromPubKeyHash(
Constants.NETWORK_PARAMETERS,
ScriptPattern.extractHashFromP2PKH(output.scriptPubKey)
).toBase58()
)
addresses.add(
ZenLedgerAddress(
DASH_CURRENCY,
DASH_CURRENCY,
Address.fromPubKeyHash(
Constants.NETWORK_PARAMETERS,
ScriptPattern.extractHashFromP2PKH(output.scriptPubKey)
).toBase58(),
"Dash Wallet"
)
)
}
}
}
addresses
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are no transactions, then we will send the current receive address. This way the flow can proceed to the end with ZenLedger. If no addresses are submitted, then ZenLedger returns an error with their create portfolio API.

If there are transactions, then we will scan all transaction outputs and add the addresses of the outputs that the wallet owns.

Copy link
Member

@Syn-McJ Syn-McJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great

Comment on lines 62 to 64
Constants.HTTP_CLIENT.newBuilder()
.addInterceptor(HttpLoggingInterceptor { log.info(it) }.setLevel(HttpLoggingInterceptor.Level.BODY))
.build()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before merging, I would like to remove this logging -- or disable it in release, enable in debug

@HashEngineering HashEngineering merged commit 03c6f5c into master Apr 5, 2024
2 checks passed
@HashEngineering HashEngineering deleted the feature-zenledger-entry branch April 30, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants