diff --git a/locksmith/src/controllers/v2/claimController.ts b/locksmith/src/controllers/v2/claimController.ts index 9958a56260a..13614708d2a 100644 --- a/locksmith/src/controllers/v2/claimController.ts +++ b/locksmith/src/controllers/v2/claimController.ts @@ -12,6 +12,7 @@ import { getTotalPurchasePriceInCrypto } from '../../utils/claim' const ClaimBody = z.object({ data: z.string().optional(), recipient: z.string().optional(), + referrer: z.string().optional(), email: z .string() .email() @@ -31,7 +32,9 @@ export const LOCKS_WITH_DISABLED_CLAIMS = [ * @returns */ export const claim: RequestHandler = async (request, response: Response) => { - const { data, recipient, email } = await ClaimBody.parseAsync(request.body) + const { data, recipient, email, referrer } = await ClaimBody.parseAsync( + request.body + ) const network = Number(request.params.network) const lockAddress = normalizer.ethereumAddress(request.params.lockAddress) @@ -160,6 +163,7 @@ export const claim: RequestHandler = async (request, response: Response) => { owner, network, data, + referrer, keyManager: email ? keyManagerAddress : owner, }, async (_, transactionHash) => { diff --git a/locksmith/src/fulfillment/dispatcher.ts b/locksmith/src/fulfillment/dispatcher.ts index 2e1e60c8d1d..67a81f48921 100644 --- a/locksmith/src/fulfillment/dispatcher.ts +++ b/locksmith/src/fulfillment/dispatcher.ts @@ -374,10 +374,11 @@ export default class Dispatcher { network: number data?: string keyManager?: string + referrer?: string }, cb?: (error: any, hash: string | null) => Promise ) { - const { network, lockAddress, owner, data, keyManager } = options + const { network, lockAddress, owner, data, keyManager, referrer } = options const walletService = new WalletService(networks) // get any purchaser, as the address is not required here. @@ -396,6 +397,7 @@ export default class Dispatcher { owner, data, keyManager, + referrer, }, { maxFeePerGas, maxPriorityFeePerGas }, cb diff --git a/packages/unlock-js/CHANGELOG.md b/packages/unlock-js/CHANGELOG.md index 9ecbb6bbdb1..b5df541b23c 100644 --- a/packages/unlock-js/CHANGELOG.md +++ b/packages/unlock-js/CHANGELOG.md @@ -1,5 +1,9 @@ # Changes +# 0.40.2 + +- claim now supports a `referrer` param + # 0.40.1 - adding missing ABI for locksmiths diff --git a/packages/unlock-js/openapi.yml b/packages/unlock-js/openapi.yml index 47f5bdc1e94..122adeb217a 100644 --- a/packages/unlock-js/openapi.yml +++ b/packages/unlock-js/openapi.yml @@ -1665,6 +1665,9 @@ paths: recipient: type: string description: Recipient address for key + referrer: + type: string + description: Referrer address used to mint. This may get overwritten. responses: 200: diff --git a/packages/unlock-js/package.json b/packages/unlock-js/package.json index 0591c1b5b15..922265fa793 100644 --- a/packages/unlock-js/package.json +++ b/packages/unlock-js/package.json @@ -1,6 +1,6 @@ { "name": "@unlock-protocol/unlock-js", - "version": "0.40.1", + "version": "0.40.2", "description": "This module provides libraries to include Unlock APIs inside a Javascript application.", "main": "dist/index.js", "module": "dist/index.mjs",