Skip to content

Fix buildApprovals to accept privateKey parameter#688

Open
mk-dhia wants to merge 1 commit into
sorare:masterfrom
mk-dhia:fix-buildapprovals-signature
Open

Fix buildApprovals to accept privateKey parameter#688
mk-dhia wants to merge 1 commit into
sorare:masterfrom
mk-dhia:fix-buildapprovals-signature

Conversation

@mk-dhia

@mk-dhia mk-dhia commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

buildApprovals in examples/authorizations.js was defined with a single authorizations parameter, but every call site (bidAuction.js, createSingleSaleOffer.js, acceptSingleSaleOffer.js) and the README pass buildApprovals(privateKey, authorizations).

The extra privateKey argument was silently dropped, and the privateKey referenced inside the function body was an undeclared free variable. Because these are ES modules (strict mode), running the example throws ReferenceError: privateKey is not defined before any authorization request is signed.

Fixing the example code

The buildApprovals function was defined with a single `authorizations`
parameter, while every call site and the README passed
`buildApprovals(privateKey, authorizations)`. The extra argument was
silently dropped and `privateKey` inside the body was an undeclared free
variable, so the example threw at runtime before signing any request.

Add the missing `privateKey` parameter to match the call sites.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mk-dhia mk-dhia requested a review from piedup July 13, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant