Skip to content

Commit

Permalink
fix(unlock-js): using OZ to grantRole for addLockManager (#15539)
Browse files Browse the repository at this point in the history
* using OZ to grantRole for addLockManager

* changelog
  • Loading branch information
julien51 authored Feb 18, 2025
1 parent 2bdbe01 commit 3abd6b8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/unlock-js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

# 0.51.1

- Using `grantRole` for `addLockManager`

# 0.51.0

- Changed GraphService constructor to accept params
Expand Down
2 changes: 1 addition & 1 deletion packages/unlock-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unlock-protocol/unlock-js",
"version": "0.51.0",
"version": "0.51.1",
"description": "This module provides libraries to include Unlock APIs inside a Javascript application.",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
6 changes: 4 additions & 2 deletions packages/unlock-js/src/PublicLock/v9/addLockManager.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { ethers } from 'ethers'

/**
* Add lock manager to Contract
* @param {string} lockAddress address of the lock
* @param {string} userAddress address of the user
*/

export default async function (
{ lockAddress, userAddress },
transactionOptions = {},
callback
) {
const lockContract = await this.getLockContract(lockAddress)
const transactionPromise = lockContract.addLockManager(userAddress)
const role = ethers.keccak256(ethers.toUtf8Bytes('LOCK_MANAGER'))
const transactionPromise = lockContract.grantRole(role, userAddress)

const hash = await this._handleMethodCall(transactionPromise)

Expand Down

0 comments on commit 3abd6b8

Please sign in to comment.