-
Notifications
You must be signed in to change notification settings - Fork 70
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
Two-Part Payment Support #341
Two-Part Payment Support #341
Conversation
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
- create_transaction_envelope now takes the claimable flag which indicates whether or not the transaction should be built as a claimableBalance Signed-off-by: Lawrence <[email protected]>
- based on the SDK's exammple (py-stellar-base/examples/claimable_balances.py) - Currently the claimableBalance created has is an `UNCONDITIONAL` predicate - This means that there is no stated condition for the reciever to claim the balance https://developers.stellar.org/docs/glossary/claimable-balance/#relevant-operations Signed-off-by: Lawrence <[email protected]>
- Now that we dont fail if no trustline is availible we reflect successful responses like test_deposit_stellar_success Signed-off-by: Lawrence <[email protected]>
- We have no need for this code due to the ability to create claimableBalances for those recipiants (to claim at a later date) without a trustline established. Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
- create_transaction_envelope now takes the claimable flag which indicates whether or not the transaction should be built as a claimableBalance Signed-off-by: Lawrence <[email protected]>
- based on the SDK's exammple (py-stellar-base/examples/claimable_balances.py) - Currently the claimableBalance created has is an `UNCONDITIONAL` predicate - This means that there is no stated condition for the reciever to claim the balance https://developers.stellar.org/docs/glossary/claimable-balance/#relevant-operations Signed-off-by: Lawrence <[email protected]>
- Now that we dont fail if no trustline is availible we reflect successful responses like test_deposit_stellar_success Signed-off-by: Lawrence <[email protected]>
- We have no need for this code due to the ability to create claimableBalances for those recipiants (to claim at a later date) without a trustline established. Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
… into 316-2pt-payments
Signed-off-by: Lawrence <[email protected]>
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.
Good start, at a high level everything looks good here.
The key feature I'd like to see is a Transaction.claimable_balance_id
column that gets populated on successful TX submission.
Other than that, there are some small adjustments to make, and I also think we could add to the documentation to explain when Claimable Balances are used in Polaris.
- stellar#341 (comment) Signed-off-by: Lawrence <[email protected]>
builder logic -stellar#341 (comment) Signed-off-by: Lawrence <[email protected]>
- Because the pending_trust transactions are the objects we want to create a claimableBalance from we can simply check the transaction status Signed-off-by: Lawrence <[email protected]>
whoops Signed-off-by: Lawrence <[email protected]>
- set transaction.claimable_balance_id with get_balanceid only if the transaction is pending trust at the time it was built Signed-off-by: Lawrence <[email protected]>
- I generated a result_xdr for get_balanceid to decode when this test runs Signed-off-by: Lawrence <[email protected]>
- This is the default value Signed-off-by: Lawrence <[email protected]>
- there is more than one operation we want to ensure we dont fail if createClaimableBalanceResult is the 1st..nth tr in the xdr - This will return too early in the case where there are multiple createClaimableBalanceResult operations on a singe transaction - TODO: change the model attr to be an array of strings? Signed-off-by: Lawrence <[email protected]>
Signed-off-by: Lawrence <[email protected]>
- With the ability to create claimable balances we dont need to specify if the destination exists. We simply always call get_or_create_transaction_destination_account with this new flow. Signed-off-by: Lawrence <[email protected]>
- test_deposit_stellar_no_account no longer tests a blocked payment flow Signed-off-by: Lawrence <[email protected]>
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.
Nice, looks good pending my comments.
Also: Did you add black to your git commit hook?
Signed-off-by: Lawrence <[email protected]>
- stellar#341 (comment) Signed-off-by: Lawrence <[email protected]>
- result_xdr value isnt representative of the other deposits made however this will not block or confuse other tests Signed-off-by: Lawrence Lawson <[email protected]>
Signed-off-by: Lawrence Lawson <[email protected]>
Signed-off-by: Lawrence Lawson <[email protected]>
Signed-off-by: Lawrence Lawson <[email protected]>
Signed-off-by: Lawrence Lawson <[email protected]>
I did now haha |
@Zagan202 thanks, can you format the code in a commit and push? I think you just need to change whitespace and black will format the code prior to commit. |
Thats strange everything seemed to check out on my end |
Also ran
|
All I ever do is
|
Signed-off-by: Lawrence Lawson <[email protected]>
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.
LGTM!
We can merge this and simply hold off on including it in a release until anchors are expected to use claimable balances. |
Description
Adds two part payments (aka claimableBalances) to the deposit flow.
In the past when accounts attempt a deposit
Old Flow
or the user's account won't have a trustline to the asset's issuer account.
poll_pending_deposits
DepositIntegration.create_channel_account()
for the transaction record (which creates a temporary, per-deposit-transaction-object Stellar account)for their own account or the one that was created for them
check_trustlines
(a command line tool that periodically checks if thetransactions with this status now have a trustline to the relevant asset).
after_deposit
integration function once its completed.Desired Flow
or the user's account won't have a trustline to the asset's issuer account.
poll_pending_deposits
DepositIntegration.create_channel_account()
for the transaction record (which creates a temporary, per-deposit-transaction-object Stellar account)poll_pending_deposits
create_stellar_deposit
) create_transaction_envelope where it will build the transaction as a claimableBalanceAddresses issue: #316
resolves stellar/stellar-protocol#747
Type of change
How Has This Been Tested?
tests/processes/test_create_stellar_deposit.py