You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HcsDid throws Error: Couldn't find constructor when called from an instance of HcsIdentityNetwork through generateDid() method. This happens ONLY when HcsIdentityNetwork object is created via fromAddressBookFile or fromAddressBook static methods, both create AddressBook object without private property fileId set accordingly.
The workaround which returns AddressBook from HcsIdentityNetwork instance through getAddressBoook() to set manually fileId on AddressBook with setFileId API does not solve the issue either, as HcsDid constructor still fails on args[2] instanceof sdk_1.FileId condition. This is weird, as args[2] resolves to FileId {shard: Long, realm: Long, num: Long, _checksum: null}, which is precisely what sdk_1.FileId type.
NOTE: If HcsIdentityNetwork object is bootstrapped through HcsIdentityNetworkBuilder() API everything works fine.
NOTE 2: Call to HcsIdentityNetwork.fromAddressBookFile() API with fileId already submitted to HFS fetches properly AddressBook file (just not instantiates the fileId property on AddressBook Object).
Steps to reproduce
Submit AddressBook to Hedera File Service (out-of-bound), keep the fileId reference number as FID.
Create new IDENTITY_NETWORK object though HcsIdentityNetwork.fromAddressBookFile(CLIENT, 'testnet', new FileId(FID))
Confirm that IDENTITY_NETWORK.getAddressBook() return object without fileId set to FID.
Try to generate DID by calling IDENTITY_NETWORK.generateDid(PUBKEY, true)
Operation should thrown an error from HcsDid constructor
Retry step 4, but first manually set fileId property on IDENTITY_NETWORK address book.
Operation still thrown the same error as in step 5.
Additional context
ENV:
node: v14.17.6
ts-node: v10.2.1
npm: 6.14.15
macOS: Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
Hey, the problem here is the dependency tree. Project duplicates @hashgraph/sdk package. @hashgraph/did-sdk-js has it's own nested dependency that is only used inside the scope of the package.
When instance is created by using one copy of the package and later used in conditions like:
Description
HcsDid
throwsError: Couldn't find constructor
when called from an instance ofHcsIdentityNetwork
throughgenerateDid()
method. This happens ONLY whenHcsIdentityNetwork
object is created viafromAddressBookFile
orfromAddressBook
static methods, both createAddressBook
object without private propertyfileId
set accordingly.The workaround which returns
AddressBook
fromHcsIdentityNetwork
instance throughgetAddressBoook()
to set manuallyfileId
on AddressBook withsetFileId
API does not solve the issue either, asHcsDid
constructor still fails onargs[2] instanceof sdk_1.FileId
condition. This is weird, asargs[2]
resolves toFileId {shard: Long, realm: Long, num: Long, _checksum: null}
, which is precisely what sdk_1.FileId type.NOTE: If
HcsIdentityNetwork
object is bootstrapped throughHcsIdentityNetworkBuilder()
API everything works fine.NOTE 2: Call to
HcsIdentityNetwork.fromAddressBookFile()
API withfileId
already submitted to HFS fetches properly AddressBook file (just not instantiates thefileId
property on AddressBook Object).Steps to reproduce
Submit AddressBook to Hedera File Service (out-of-bound), keep the fileId reference number as FID.
Create new IDENTITY_NETWORK object though
HcsIdentityNetwork.fromAddressBookFile(CLIENT, 'testnet', new FileId(FID))
Confirm that
IDENTITY_NETWORK.getAddressBook()
return object withoutfileId
set to FID.Try to generate DID by calling
IDENTITY_NETWORK.generateDid(PUBKEY, true)
Operation should thrown an error from HcsDid constructor
Retry step
4
, but first manually setfileId
property on IDENTITY_NETWORK address book.Operation still thrown the same error as in step
5
.Additional context
ENV:
node: v14.17.6
ts-node: v10.2.1
npm: 6.14.15
macOS: Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
tsconfig.json:
package-lock.json:
Hedera network
testnet
Version
v0.1.1
Operating system
macOS
The text was updated successfully, but these errors were encountered: