From 8e2836fa7899f0926d1f4bf8f88b71ac1c949c38 Mon Sep 17 00:00:00 2001 From: dawidgil Date: Mon, 13 Sep 2021 21:47:07 +0200 Subject: [PATCH] refactor(asset): drop support for DID format when offering asset. Use address instead BREAKING CHANGE: transferring asset do not allow anymore to use DID format. Allowed is address. --- src/iam.ts | 3 +-- test/assets.testsuite.ts | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/iam.ts b/src/iam.ts index ff20fa19..b4722ab3 100644 --- a/src/iam.ts +++ b/src/iam.ts @@ -1809,9 +1809,8 @@ export class IAM extends IAMBase { if (!this._address) { throw new Error(ERROR_MESSAGES.USER_NOT_LOGGED_IN); } - const [, , offerToAddress] = offerTo.split(":"); const [, , assetContractAddress] = assetDID.split(":"); - const tx = this.offerAssetTx({ assetContractAddress, offerTo: offerToAddress }); + const tx = this.offerAssetTx({ assetContractAddress, offerTo }); await this.send({ calls: [tx], from: this._address, diff --git a/test/assets.testsuite.ts b/test/assets.testsuite.ts index 7a4ca65a..97ea56d8 100644 --- a/test/assets.testsuite.ts +++ b/test/assets.testsuite.ts @@ -26,7 +26,7 @@ export const assetsTests = () => { const newOwner = new Keys(); await rootOwnerIam.offerAsset({ assetDID: `did:ethr:${assetAddress}`, - offerTo: `did:ethr:${newOwner.getAddress()}`, + offerTo: `${newOwner.getAddress()}`, }); const assetContract = OfferableIdentity__factory.connect(assetAddress, provider); const offered = await assetContract.offeredTo(); @@ -38,7 +38,7 @@ export const assetsTests = () => { const assetDID = `did:ethr:${assetAddress}`; await rootOwnerIam.offerAsset({ assetDID, - offerTo: `did:ethr:${newOwner.getAddress()}`, + offerTo: `${newOwner.getAddress()}`, }); const assetContract = OfferableIdentity__factory.connect(assetAddress, provider); const offered = await assetContract.offeredTo(); @@ -52,7 +52,7 @@ export const assetsTests = () => { const newOwner = new Keys(); await replenish(newOwner.getAddress()); const assetDID = `did:ethr:${assetAddress}`; - await rootOwnerIam.offerAsset({ assetDID, offerTo: `did:ethr:${newOwner.getAddress()}` }); + await rootOwnerIam.offerAsset({ assetDID, offerTo: `${newOwner.getAddress()}` }); const newOwnerIAM = new IAM({ privateKey: newOwner.privateKey, rpcUrl, @@ -73,7 +73,7 @@ export const assetsTests = () => { const newOwner = new Keys(); await replenish(newOwner.getAddress()); const assetDID = `did:ethr:${assetAddress}`; - await rootOwnerIam.offerAsset({ assetDID, offerTo: `did:ethr:${newOwner.getAddress()}` }); + await rootOwnerIam.offerAsset({ assetDID, offerTo: `${newOwner.getAddress()}` }); const newOwnerIAM = new IAM({ privateKey: newOwner.privateKey, rpcUrl,