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
Support anyone-can-pay script #69
Conversation
public readonly fromScript: Script; | ||
|
||
constructor( | ||
fromAddress: Address, |
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.
Can we use FromInfo
here?
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.
OK.
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.
Updated.
constructor( | ||
fromAddress: Address, | ||
cellProvider: CellProvider, | ||
{ |
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.
Can we skip QueryOptions here? Is there any chance that we have to let users customize the query used here?
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.
It's for anyone-can-pay
with sudt
https://github.com/nervosnetwork/lumos/pull/69/files#diff-2cf727f7322effda3e47a60c2bbcc253R199
If we skipped QueryOptions
, we should provide a sudtToken
param, for search anyone-can-pay
lock script with sudt
type script.
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.
Okay in that sense let's keep QueryOptions here.
return txSkeleton; | ||
} | ||
|
||
export async function transfer( |
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.
I feel like maybe we should not provide transfer here. I do want to distinguish transfer from withdraw in lumos:
- transfer is an action that you exact CKBs from a bunch of cells that are alike, it does not matter which cell is in fact used.
- withdraw is an action that you exact CKBs from exactly one cell, and you can only use that single cell.
I feel like in ACP, it's more likely we are dealing with withdrawing operation, not transfer operation.
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.
It's this means we can withdraw a cell with withdraw capacity range [0,cell.capcaity-minimalCellCapcity] ∪ cell.capcaity
, and withdraw amount (from data) range [0, cell.amount]
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.
Yeah I think that's the plan.
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.
ok
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.
Updated.
return txSkeleton; | ||
} | ||
|
||
export async function destroyAnyoneCanPayInput( |
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.
One we change transfer to withdraw, I feel like we can merge this function with withdraw: the cell will be destroyed once one withdraw all the amount in the cell.
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.
Updated.
Now anyone-can-pay script only support to transfer anyone-can-pay addresses to anyone-can-pay address.
And transfer to anyone-can-pay address from any lock script will integrate to
common
later.