As I understand it, if you transfer APT to an account that doesn't exist on-chain yet, doing so will create the account on-chain. I've been trying to use 0x1::coin::transfer
, but that doesn't seem to work.
Move abort in 0x1::coin: ECOIN_STORE_NOT_PUBLISHED(0x60005): Account hasn't registered `CoinStore` for `CoinType`
What should I do instead?
This is a bit confusing but there are two different functions.
0x1::coin::transfer
. Code.0x1::aptos_account::transfer
. Code.You can see in the second code link that it first checks if the account exists and creates it if it doesn't, and then calls 0x1::coin::transfer
.