-
Notifications
You must be signed in to change notification settings - Fork 109
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 create vesting account msg #126
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
endTime: timestampFromDatetimeLocal(endTime), | ||
delayed, | ||
}, | ||
}; |
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.
This msg
looks alright here. You can add type-dafety if you store the value: MsgCreateVestingAccount
in an extra line.
But how does the object look like when it was written to Fauna and read from Fauna as part of the signing process? I'd assume this breaks the Long.
const {
data: { transactionID },
} = await axios.post("/api/transaction", {
dataJSON: JSON.stringify(tx),
});
writed the whole tx including the messages to JSON. There it looks like this:
> const Long = require("long")
undefined
> Long.fromNumber(123)
Long { low: 123, high: 0, unsigned: false }
> let a = { endTime: Long.fromNumber(123) }
undefined
> JSON.stringify(a)
'{"endTime":{"low":123,"high":0,"unsigned":false}}'
Then in const txInfo: DbTransaction = transactionJSON ? JSON.parse(transactionJSON) : null;
this becomes something like
JSON.parse('{"endTime":{"low":123,"high":0,"unsigned":false}}')
{ endTime: { low: 123, high: 0, unsigned: false } }.
I'm a bit surprised the proto encoding does not fail entirely.
How does props.tx.msgs
look like in this code block?
const { bodyBytes, signatures } = await signingClient.sign(
signerAddress,
props.tx.msgs,
props.tx.fee,
props.tx.memo,
signerData,
);
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.
fromAddress, | ||
toAddress, | ||
amount: [{ amount: amountInAtomics, denom: state.chain.denom }], | ||
endTime: timestampFromDatetimeLocal(endTime), | ||
delayed, |
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.
Could you pull this out into a const createMsgValue: MsgCreateVestingAccount = { ...
to ensure we have type-safety for that part?
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.
oh, you have that in TxMsgCreateVestingAccount. Never mind then.
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.
Very nice!! Glad it works now :)
Part of #99.
Closes #49.
Closes #54.