-
Notifications
You must be signed in to change notification settings - Fork 169
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
Conversation
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 | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
Constants.HTTP_CLIENT.newBuilder() | ||
.addInterceptor(HttpLoggingInterceptor { log.info(it) }.setLevel(HttpLoggingInterceptor.Level.BODY)) | ||
.build() |
There was a problem hiding this comment.
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
Issue being fixed or feature implemented
Related PR's and Dependencies
Screenshots / Videos
How Has This Been Tested?
Checklist: