-
Notifications
You must be signed in to change notification settings - Fork 8
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
added support for txn >5kB #51
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 6de6bca The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
assert( | ||
params.txn.inputs.length === params.txn.rawTxn.length, | ||
'txn.rawTxn should not be same length as txn.inputs', | ||
); |
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.
The assert and the error message is conflicting
added support for txn >5kB | ||
sign txn proto, test cases and flow update |
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.
Changeset should be in a single line
scriptPubKey: hexToUint8Array(input.scriptPubKey), | ||
value: input.value, | ||
sequence: input.sequence ?? signTxnDefaultParams.input.sequence, | ||
chainIndex: input.chainIndex, | ||
changeIndex: input.chainIndex, |
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.
Rename the params to changeIndex
as well
changeIndex: input.chainIndex, | |
changeIndex: input.changeIndex, |
@@ -122,7 +120,7 @@ export const signTxn = async ( | |||
const { signature } = await helper.waitForResult(); | |||
assertOrThrowInvalidResult(signature); | |||
|
|||
signatures.push(uint8ArrayToHex(signature.signature)); | |||
signatures.push(uint8ArrayToHex(signature.unlockingScript)); |
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.
Return the signedTxn as well, check eth sign txn
outputs: ISignTxnOutput[]; | ||
inputs: ISignTxnInputData[]; | ||
outputs: ISignTxnOutputData[]; | ||
rawTxn: string[]; |
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.
We can make this optional and fetch it from server when it's not provided.
|
||
private static splitIntoChunks(txn: Uint8Array): Uint8Array[] { | ||
const chunks: Uint8Array[] = []; | ||
const totalChunks = Math.ceil(txn.length / OperationHelper.CHUNK_SIZE); | ||
|
||
for (let i = 0; i < totalChunks; i += 1) { | ||
const chunk = txn.slice( | ||
i * OperationHelper.CHUNK_SIZE, | ||
i * OperationHelper.CHUNK_SIZE + OperationHelper.CHUNK_SIZE, | ||
); | ||
chunks.push(chunk); | ||
} | ||
|
||
return chunks; | ||
} | ||
|
||
public async sendInChunks< | ||
RK extends keyof Exclude<Result[R], null | undefined>, | ||
QK extends keyof Exclude<Query[Q], null | undefined>, | ||
>(data: Uint8Array, queryKey: QK, resultKey: RK) { | ||
const chunks = OperationHelper.splitIntoChunks(data); | ||
let remainingSize = data.length; | ||
|
||
for (let i = 0; i < chunks.length; i += 1) { | ||
const chunk = chunks[i]; | ||
remainingSize -= chunk.length; |
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 don't think we need to send in chunks in this PR
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.
that was part of latest proto, it's split between 2 commits, this commit 8980e19419f43e7cd64a44edac81cc949cbee032
only contains old proto changes
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.
we can open another pr from just that commit if we need to skip chink changes.
No description provided.