Skip to content

Commit

Permalink
Merge pull request #127 from art-by-city/125-set-dataitem-raw-id-when…
Browse files Browse the repository at this point in the history
…-signing-in-browser

Manually set data item rawId when signing in browser
  • Loading branch information
jim-toth authored Feb 23, 2024
2 parents 3e2d477 + 2c44882 commit 210d7eb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/common/data-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ export default class DataItemFactory {
): Promise<DataItem> {
if (this.signer instanceof InjectedArweaveSigner) {
const signed = await window.arweaveWallet.signDataItem({ data, tags })
const dataItem = new DataItem(Buffer.from(signed))

// NB: ArConnect requires the above method of signing DataItem, but they
// fail arbundle's .isSigned() check when re-instantiated because
// ._id isn't set. So we set it by assigning .rawId to itself.
// eslint-disable-next-line no-self-assign
dataItem.rawId = dataItem.rawId

return new DataItem(Buffer.from(signed))
return dataItem
}

const dataItem = createData(data, this.signer, { tags })
Expand Down

0 comments on commit 210d7eb

Please sign in to comment.