-
Notifications
You must be signed in to change notification settings - Fork 391
feat: refine TON ton_proof and sign data #943
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
|
@Alejandbel is attempting to deploy a commit to the Reown Team on Vercel. A member of the Team first needs to authorize it. |
| } catch (e) { | ||
| throw new TonValidationError('Amount is invalid.') | ||
| } | ||
| // TODO: should include validation for sufficient 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.
Can we remove this? would we need to implement somehting else?
| this.validateSendMessage(params) | ||
|
|
||
| const messages = (params.messages || []).map(m => { | ||
| const amountBigInt = typeof m.amount === 'string' ? BigInt(m.amount) : BigInt(m.amount) | ||
| return internal({ | ||
| to: Address.parse(m.address), | ||
| bounce: Address.parseFriendly(m.address).isBounceable, | ||
| value: amountBigInt, | ||
| body: m.payload ?? 'Test transfer from ton WalletConnect' | ||
| body: m.payload ? Cell.fromBase64(m.payload) : 'Test transfer from ton WalletConnect', | ||
| init: m.stateInit ? loadStateInit(Cell.fromBase64(m.stateInit).beginParse()) : undefined |
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.
Do you think we could do something like
const messages = parseTonMessages(params)
messages.map(.....)
Basically make the validation function return a validated, typed, version of the message so we avoid all of the duplicate parsing.
Wyt?
| }) | ||
|
|
||
| await walletContract.send(transfer) | ||
| await retry(() => walletContract.send(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.
Why do we need to enforce retries?
| const wc = Buffer.alloc(4) | ||
| wc.writeUInt32BE(message.address.workChain) | ||
|
|
||
| const ts = Buffer.alloc(8) | ||
| ts.writeBigUInt64LE(BigInt(message.timestamp)) | ||
|
|
||
| const dl = Buffer.alloc(4) | ||
| dl.writeUInt32LE(message.domain.lengthBytes) | ||
|
|
||
| const m = Buffer.concat([ |
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.
nit: could we include a comment ref to here these fields are defined?
| sessionProperties.ton_getPublicKey = tonWallet.getPublicKey(); | ||
| sessionProperties.ton_getStateInit = tonWallet.getStateInit(); |
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.
@ganchoradkov we should probably push this to the spec if required
No description provided.