Skip to content

Commit

Permalink
Merge pull request #254 from energywebfoundation/transfer_assets_use_…
Browse files Browse the repository at this point in the history
…address

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.
  • Loading branch information
dawidgil committed Sep 14, 2021
2 parents ffe4357 + 8e2836f commit 624e37c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/iam.ts
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions test/assets.testsuite.ts
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 624e37c

Please sign in to comment.