Repository navigation
Add migrate sol command - #87
Conversation
7f3341e to
d1adc6b
Compare
d1adc6b to
a2e7295
Compare
a2e7295 to
578fa55
Compare
578fa55 to
97f92ce
Compare
cd584fe to
c73ac04
Compare
9f05bf4 to
acfad14
Compare
acfad14 to
7eed13d
Compare
joncinque
left a comment
There was a problem hiding this comment.
Just some terminology bits to say "wallet" instead of "owner" in most places, but that can be done in a follow-up -- looks great!
| /// If transferring the full balance, it must not also pay the | ||
| /// relay transaction's fee, since that comes out of the same balance. |
There was a problem hiding this comment.
We have some (overly complicated) logic in the CLI to estimate fees so that transferring everything out of a system account is actually possible, which could be a useful feature. We can add that in a follow-up though
There was a problem hiding this comment.
Thinking about it, this should actually be straightforward if we keep priority fees at 0 here (which I think in practice is what happens with durable nonces?). We'd know the fee that will eventually be paid. Only tricky thing is we don't know who the relay fee payer will be because that's a separate later CLI command. So I'm not sure if we should try to be clever here, or leave it to them to adjust by 5000 lamports if they plan to use the sender as the fee payer.
There was a problem hiding this comment.
Ah right, that's a good point. Let's just leave it to them then. Maybe we can put a comment saying to reduce the amount by 5000 lamports if the migrated account is also the fee payer
2ef4670 to
f8ea080
Compare
f8ea080 to
3920062
Compare
This command is for sending SOL to a programmatic signer. The new authority signing pubkey defaults to the current owner. This is similar to `migrate token`, bt for native SOL. By default this will create an execution message that sends the full current balance, closing the account. An optional `--amount` will customise this. We check that both the source and destination accounts are rent-exempt (if the source is not closed). This requires a bit of caution because if the account pays fees for another transaction then these balances can become invalid. We also assume that if transferring an amount at/near the full balance, the relay fee payer will be another account, as we don't account for that. Again the recipient is not required as a signer on the transfer instruction, so we add a memo instruction to enforce it.
3920062 to
d8f5d26
Compare
This command is for sending SOL to a programmatic signer
This is similar to
migrate token, bt for native SOL. By default this will create an execution message that sends the full current balance, closing the account. An optional--amountwill customise this. We check that both the source and destination accounts are rent-exempt (if the source is not closed).This requires a bit of caution because if the account pays fees for another transaction then these balances can become invalid. We also assume that if transferring an amount at/near the full balance, the relay fee payer will be another account, as we don't account for that.
Again the recipient is not required as a signer on the transfer instruction, so we add a memo instruction to enforce it.