Skip to content
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

fix: add link to receipt #351

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading