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

error when using addDelegate() function call as explained in the "Getting Started" documentation #58

Closed
yogh333 opened this issue Jan 11, 2021 · 1 comment · Fixed by #61

Comments

@yogh333
Copy link

yogh333 commented Jan 11, 2021

Describe the bug
I follow the "Getting Started" guide here: https://github.com/uport-project/ethr-did/blob/master/docs/guides/index.md, and try adding a Delegate Signer.

I am using Ganache for my own test private blockchain and deployed ERC1056 on it.

Here is my node.js code:

const EthrDID = require('ethr-did');              
const Web3 = require('web3');              
const Registry = require('./build/contracts/Registry.json');

const init = async () => {
	const current_provider = new Web3.providers.HttpProvider('http://localhost:8545');
	const web3 = new Web3(current_provider);
	const id = await web3.eth.net.getId();
	
	const deployedNetwork = Registry.networks[id];
	const contract = new web3.eth.Contract(
		Registry.abi,
		deployedNetwork.address
	);
	const addresses = await web3.eth.getAccounts();

	const ethrDid = new EthrDID({
		address: addresses[0], 
		registry: deployedNetwork.address, 
		privateKey: '0x2f93aa4f85edafb71f472bbd1be5046270aed1c6f6fcdd8fa0705c5ccb59ab12',
		rpcUrl: 'http://localhost:8545'
	});

	console.log("DiD = " + ethrDid.did);
	const owner = await ethrDid.lookupOwner();
	console.log("Owner = " + owner);

	console.log("Set Delegate = " + addresses[1]);
	await ethrDid.addDelegate(addresses[1]);
}

init();

Call to ethrDid.addDelegate() throws the following error:

(node:54879) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'delegateType' of undefined
at e.o.addDelegate (/Users/jcaporossi/Documents/ethr-did-test/node_modules/ethr-did/lib/index.js:1:1849)
at init (/Users/jcaporossi/Documents/ethr-did-test/index.js:36:16)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:54879) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:54879) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Any help would be welcome ;)
Thx,
Kind regards,
Jerome

mirceanis added a commit that referenced this issue Apr 14, 2021
BREAKING CHANGE: new did core spec uses different format for DID documents and resolution.
BREAKING CHANGE: Now using ethers.js which means that providers and signers may have a different API
BREAKING CHANGE: default export was removed

closes #50
closes #59
closes #21
closes #49
closes #51
closes #52
closes #57
closes #58
mirceanis added a commit that referenced this issue Apr 15, 2021
* chore(deps): update deps
* feat: adapt to latest did core spec

BREAKING CHANGE: new did core spec uses different format for DID documents and resolution.
BREAKING CHANGE: Now using ethers.js which means that providers and signers may have a different API
BREAKING CHANGE: default export was removed

closes #50
closes #59
closes #21
closes #49
closes #51
closes #52
closes #57
closes #58
uport-automation-bot pushed a commit that referenced this issue Apr 15, 2021
# [2.0.0](1.3.0...2.0.0) (2021-04-15)

### Features

* adapt to latest did core spec and libs ([#61](#61)) ([839079d](839079d)), closes [#50](#50) [#59](#59) [#21](#21) [#49](#49) [#51](#51) [#52](#52) [#57](#57) [#58](#58)

### BREAKING CHANGES

* new did core spec uses different format for DID documents and resolution.
* Now using ethers.js which means that providers and signers may have a different API
* default export was removed
@uport-automation-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Mozartted pushed a commit to coincord/ezrah-did that referenced this issue Nov 14, 2024
# 1.0.0 (2024-11-14)

### Bug Fixes

* **build:** export types for esm ([uport-project#106](https://github.com/coincord/ezrah-did/issues/106)) ([3b146f7](3b146f7))
* bump ethr-did-resolver to 4.3.2 ([uport-project#65](https://github.com/coincord/ezrah-did/issues/65)) ([dcd21ce](dcd21ce)), closes [uport-project#64](https://github.com/coincord/ezrah-did/issues/64)
* bump release ([cc5109e](cc5109e))
* **ci:** add build step before test and release ([uport-project#90](https://github.com/coincord/ezrah-did/issues/90)) ([e4b9834](e4b9834)), closes [uport-project#89](https://github.com/coincord/ezrah-did/issues/89)
* **ci:** groom the build scripts and dependencies ([uport-project#97](https://github.com/coincord/ezrah-did/issues/97)) ([0a29790](0a29790))
* **deps:** bump all dependencies to latest and fix upgrade issues ([bfd6381](bfd6381))
* **deps:** bump dependencies to more recent versions ([5e7cf20](5e7cf20))
* **deps:** bump did- dependencies to latest ([60f1e63](60f1e63))
* **deps:** bump did-jwt to v6 ([55cbf43](55cbf43))
* **deps:** bump did-jwt, did-resolver, and ethr-did-resolver packages ([uport-project#101](https://github.com/coincord/ezrah-did/issues/101)) ([a0946b3](a0946b3))
* **deps:** bump [email protected] ([60ea36c](60ea36c))
* **deps:** bump ethr-did-resolver ([uport-project#103](https://github.com/coincord/ezrah-did/issues/103)) ([180c65c](180c65c))
* **deps:** bump ethr-did-resolver to ^5.0.2 ([338839f](338839f))
* **deps:** bump ethr-did-resolver to 4.2.0 ([9b4e1b2](9b4e1b2))
* **deps:** bump ethr-did-resolver to 4.3.3 ([19064f7](19064f7))
* **deps:** bump ethr-did-resolver to 6.2.3 ([c26833a](c26833a))
* **deps:** bump ethr-did-resolver to 7.0.2 ([48c0e43](48c0e43))
* **deps:** update dependency @ethersproject/providers to v5.7.2 ([2ddb987](2ddb987))
* **deps:** Update dependency did-jwt to v7 ([4b65fce](4b65fce))
* **deps:** Update dependency did-jwt to v7.1.0 ([3860076](3860076))
* **deps:** Update dependency did-jwt to v7.2.0 ([726adc9](726adc9))
* **deps:** Update dependency did-jwt to v7.2.1 ([402b454](402b454))
* **deps:** Update dependency did-jwt to v7.2.2 ([2d33145](2d33145))
* **deps:** Update dependency did-jwt to v7.2.4 ([7c8caf1](7c8caf1))
* **deps:** Update dependency did-jwt to v7.2.5 ([daba9ff](daba9ff))
* **deps:** Update dependency did-jwt to v7.2.6 ([057a455](057a455))
* **deps:** Update dependency did-jwt to v7.2.7 ([80feeb5](80feeb5))
* **deps:** Update dependency did-jwt to v7.2.8 ([fc627b8](fc627b8))
* **deps:** Update dependency did-jwt to v7.3.0 ([9abe149](9abe149))
* **deps:** Update dependency did-jwt to v7.4.1 ([8f90c16](8f90c16))
* **deps:** Update dependency did-jwt to v7.4.2 ([e8bab95](e8bab95))
* **deps:** Update dependency did-jwt to v7.4.3 ([7a57591](7a57591))
* **deps:** Update dependency did-jwt to v7.4.4 ([09413a4](09413a4))
* **deps:** Update dependency did-jwt to v7.4.5 ([53f6cec](53f6cec))
* **deps:** Update dependency did-jwt to v7.4.6 ([37e96bc](37e96bc))
* **deps:** Update dependency did-jwt to v7.4.7 ([7b56d7a](7b56d7a))
* **deps:** Update dependency did-jwt to v8 ([d5f54da](d5f54da))
* **deps:** Update dependency did-jwt to v8.0.1 ([ffe635d](ffe635d))
* **deps:** Update dependency did-jwt to v8.0.2 ([01242e8](01242e8))
* **deps:** Update dependency did-jwt to v8.0.3 ([dfa4d0f](dfa4d0f))
* **deps:** Update dependency did-jwt to v8.0.4 ([a607c9e](a607c9e))
* **deps:** update dependency ethers to v6.10.0 ([44a26e8](44a26e8))
* **deps:** update dependency ethers to v6.11.0 ([29355d9](29355d9))
* **deps:** update dependency ethers to v6.11.1 ([da35514](da35514))
* **deps:** update dependency ethers to v6.9.1 ([4f0973a](4f0973a))
* **deps:** update dependency ethers to v6.9.2 ([dc360ab](dc360ab))
* **deps:** Update dependency ethr-did-resolver to v10.1.1 ([5391f8d](5391f8d))
* **deps:** Update dependency ethr-did-resolver to v10.1.2 ([9598d6e](9598d6e))
* **deps:** Update dependency ethr-did-resolver to v10.1.3 ([2b25174](2b25174))
* **deps:** Update dependency ethr-did-resolver to v10.1.4 ([bbe5a16](bbe5a16))
* **deps:** Update dependency ethr-did-resolver to v10.1.5 ([3f4848f](3f4848f))
* **deps:** Update dependency ethr-did-resolver to v7 ([24b23ac](24b23ac))
* **deps:** Update dependency ethr-did-resolver to v8 ([e0805e8](e0805e8))
* **deps:** Update dependency ethr-did-resolver to v8.1.1 ([fa369cd](fa369cd))
* **deps:** Update dependency ethr-did-resolver to v8.1.2 ([b3e61dc](b3e61dc))
* **deps:** Update did-dependencies ([5976e17](5976e17))
* **docs:** remove references to rinkeby ([40e0dde](40e0dde))
* stricter types, better tests ([69aee19](69aee19))

### chorr

* **deps:** update ethers ([uport-project#117](https://github.com/coincord/ezrah-did/issues/117)) ([74031f6](74031f6))

### Features

* adapt to latest did core spec and libs ([uport-project#61](https://github.com/coincord/ezrah-did/issues/61)) ([839079d](839079d)), closes [uport-project#50](https://github.com/coincord/ezrah-did/issues/50) [uport-project#59](https://github.com/coincord/ezrah-did/issues/59) [uport-project#21](https://github.com/coincord/ezrah-did/issues/21) [uport-project#49](https://github.com/coincord/ezrah-did/issues/49) [uport-project#51](https://github.com/coincord/ezrah-did/issues/51) [uport-project#52](https://github.com/coincord/ezrah-did/issues/52) [uport-project#57](https://github.com/coincord/ezrah-did/issues/57) [uport-project#58](https://github.com/coincord/ezrah-did/issues/58)
* add option to specify JWT signing algorithm ([8ad8bbd](8ad8bbd))
* add support for base58 key encoding ([uport-project#62](https://github.com/coincord/ezrah-did/issues/62)) ([d0b26af](d0b26af)), closes [uport-project#60](https://github.com/coincord/ezrah-did/issues/60)
* add support for meta transactions ([uport-project#102](https://github.com/coincord/ezrah-did/issues/102)) ([0ee5d98](0ee5d98)), closes [uport-project#98](https://github.com/coincord/ezrah-did/issues/98)
* Typescript ([85dc7db](85dc7db))
* **updates:** Changes switching usecase from ethr to ezrah ([728e034](728e034))
* **updates:** test updates ([f8b2d9d](f8b2d9d))
* upgrade did-jwt to v3 ([uport-project#41](https://github.com/coincord/ezrah-did/issues/41)) ([7904fcf](7904fcf))

### BREAKING CHANGES

* **deps:** now using ethers v6 which may cause dependency conflicts when upgrading
* new did core spec uses different format for DID documents and resolution.
* Now using ethers.js which means that providers and signers may have a different API
* default export was removed
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 a pull request may close this issue.

3 participants