Skip to content

Commit

Permalink
fix: add link to receipt (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored Apr 8, 2024
1 parent 97df5c4 commit efa3506
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/core/src/receipt.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class Receipt {
return proofs
}
}
link() {
return this.root.cid
}
get meta() {
return this.root.data.ocm.meta
}
Expand Down
2 changes: 2 additions & 0 deletions packages/core/test/receipt.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ test('basic receipt', async () => {
await assertRoundtrip(receipt)

assert.equal(receipt.buildIPLDView().buildIPLDView(), receipt)

assert.ok(receipt.link())
})

test('receipt with ran as link', async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/interface/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ export interface Receipt<

readonly signature: SignatureView<OutcomeModel<Ok, Error, Ran>, Alg>

link(): Link<ReceiptModel<Ok, Error, Ran>, number, number, 1>
verifySignature(signer: Crypto.Verifier): Await<Result<{}, SignatureError>>

buildIPLDView(): Receipt<Ok, Error, Ran, Alg>
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit efa3506

Please sign in to comment.