-
Notifications
You must be signed in to change notification settings - Fork 39
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
FCL Feature: Calculate the transaction hash #24
Comments
Hello folks! I'm Greg 👋🏼 😎 A Senior Javascript Developer on the DevEx Team. |
@gregsantos Hi. I'm interested in this issue and also want this feature myself. Is there a specification written somewhere that calculates the txId from the voucher or the information contained therein? I would like to know if there is any reference to it. Either in code or documentation. Also, I would like to know how to receive the voucher in fcl middleware. Can I receive it from the results of fcl.authorizations? |
That's great to hear @avcdsld ! You can find the
await fcl.serialize([
fcl.transaction`
transaction {
prepare(acct: AuthAccount) {
log("Hello from prepare")
}
execute {
log("Hello from execute")
}
}
`,
fcl.proposer(fcl.authz),
fcl.authorizations([fcl.authz]),
fcl.payer(fcl.authz)
]).then(console.log) returns {
"cadence": "transaction {\n prepare(acct: AuthAccount) {\n log(\"Hello from prepare\")\n }\n execute {\n log(\"Hello from execute\")\n }\n }",
"refBlock": "81ca13efb92b568d7751bc9d19ced5823ccd78c22fb3102445bae8cf3ce1236d",
"computeLimit": 10,
"arguments": [],
"proposalKey": {
"address": "0x6a27b81975f0ee46",
"keyId": 1,
"sequenceNum": 34
},
"payer": "0xf062a545ce3c552d",
"authorizers": [
"0x6a14b81975f0ee46"
],
"payloadSigs": [
{
"address": "0x6a27b81975f0ee46",
"keyId": 1,
"sig": "12345678"
}
],
"envelopeSigs": [
{
"address": "0xf062a545ce3c552d",
"keyId": 50,
"sig": "87654321"
}
]
} |
@gregsantos Thanks for the info! I'm checking the code now and trying to figure out where to change it. (And if this is implementable for me) I found that the middleware can be implemented by adding the following files, is this the right approach?
If I write the code like below, I can receive import {createSignableVoucher} from "../resolve/voucher.js"
export function preSendCheck(fn) {
return ix => {
// const voucher = createSignableVoucher(ix)
// fn(voucher)
return ix
}
} However, when I run
It would be great if you could tell me why this is. Also, I would like to know the proper way to create a |
As I looked at the code, I realized that the information needed to calculate the txId, such as signature, is not revealed after
After the I am working on this approach. Any comments would be appreciated. |
|
Looking forward to it @avcdsld! |
@gregsantos However, the result is different from the result of flow-go-sdk. Why is this? I am wondering if I should reuse this existing code or add another code that is similar. |
You're on the right track now @avcdsld and correct that the data needed to calculate the transaction hash is not available until after the resolve process. Updating: In addition the new utility function, something like Hope this helps! |
Thank you. Very useful advice! 😆 |
Good day @avcdsld! Thanks so much for all your hardwork & participation. In order to finalize winners & prepare for prize payout, we'll need the following actions from your end. Please provide the following information by Nov 17, 2021, (in this GH Issue is fine): 1. Team Information
🎖IMPORTANT: We will only proceed with prize payouts once all members have confirmed with 👍 on the post. 2. Video Demo (optional)
We will be hosting Closing Ceremonies on November 23rd, 8AM PT where we'll having closing remarks from Dete & will be announcing the winners! I'll share the details here before Nov 17. |
Hey folks, We've received and reviewed over 82 submissions! What an amazing community on Flow! To commemorate all the hard work done, we have finalized winners and will be announcing them during our Closing Ceremony on Nov 23rd, 8AM PT. Be sure to join us - there may be some attendance prizes & a keynote from our CTO, Dete 😉! RSVP here so you don't miss out! See you then! |
Description (Problem Statement)
Right now, there's no way to get the transaction hash before it's sent to the blockchain. Pre-calculating the transaction hash will allow for error recovery if there are any network connection issues during the submission of the transaction.
Experience Required (Team Required)
Minimum Feature Set (Acceptance Criteria)
**voucher => voucherToTxId(voucher)**
Milestone Requirements
Software Requirements
Other Requirements
Judging Criteria
Resources
The text was updated successfully, but these errors were encountered: