-
Notifications
You must be signed in to change notification settings - Fork 27
feat: support to WalletV5R1 #131
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
base: main
Are you sure you want to change the base?
Conversation
val storeWalletId = cellSlice.loadInt(32) | ||
val publicKey = PublicKeyEd25519(ByteString(*cellSlice.loadBits(256).toByteArray())) | ||
|
||
// TODO wallet ID parsing |
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 we introduce a new entity, then we should not have a "todo" for it.
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.
cellBuilder.storeUInt(value.seqno, 32) | ||
cellBuilder.storeInt(value.walletId.serialize(), 32) | ||
cellBuilder.storeBytes(value.publicKey.key.toByteArray()) | ||
cellBuilder.storeBoolean(false) |
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.
why we dont parse it in loadTlb?
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 was because of concerns about workchain, walletVersion, and subwalletNumber of WalletID.
We cannot use the xor operation in serialize and load the corresponding values. For now, I applied them as default values. But I'm not sure if this is a good way to do it.
56506f2
*transfers | ||
) | ||
|
||
val body = Either.of<Cell, CellRef<Cell>>(null, CellRef(value = transferBody, AnyTlbConstructor)) |
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.
Permanently set to cell? There should be a way to change this, there is a MessageLayout class for this
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 have referenced the above two codes.
https://github.com/ton-blockchain/ton-kotlin/blob/main/contract/src/wallet/WalletV3Contract.kt
https://github.com/ton-blockchain/ton-kotlin/blob/main/contract/src/wallet/WalletV4R2Contract.kt
Do you wanna like this? cc40397
): Cell { | ||
val packed = packV5Actions(*gifts) | ||
val unsignedBody = CellBuilder.createCell { | ||
storeUInt(0x7369676E, 32) // MessageType.ext |
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.
magic constant
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.
} | ||
} | ||
} | ||
} |
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.
end of file without space
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.
Take a look at this implementation as a reference: |
Features
PS
It's need to a solution for loadTlb in WalletData, but it is not a necessary value if WalletContract has a Wallet ID.
Currently, It works fine.
Closed #123