Skip to content

Commit

Permalink
Add tokenId from mintAndRegisterIpAndMakeDerivative
Browse files Browse the repository at this point in the history
  • Loading branch information
bonnie57 committed Oct 31, 2024
1 parent bf4bb1d commit 6b4c821
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/core-sdk/src/resources/ipAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ export class IPAssetClient {
* @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
* @param request.recipient [Optional] The address of the recipient of the minted NFT,default value is your wallet address.
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
* @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, and if waitForTransaction is true, includes child ip id and token id.
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
*/
public async mintAndRegisterIpAndMakeDerivative(
Expand Down Expand Up @@ -873,7 +873,7 @@ export class IPAssetClient {
hash: txHash,
});
const log = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt)[0];
return { txHash, childIpId: log.ipId };
return { txHash, childIpId: log.ipId, tokenId: log.tokenId };
}
return { txHash };
}
Expand Down
1 change: 1 addition & 0 deletions packages/core-sdk/src/types/resources/ipAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type RegisterDerivativeResponse = {
txHash?: string;
encodedTxData?: EncodedTxData;
childIpId?: Address;
tokenId?: bigint;
};

export type CreateIpAssetWithPilTermsRequest = {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-sdk/src/types/resources/license.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export type SetLicensingConfigRequest = {
hookData: Hex;
};
licenseTemplate: Address;
txOptions?: TxOptions;
txOptions?: TxOptions;
};

export type SetLicensingConfigResponse = {
Expand Down
1 change: 1 addition & 0 deletions packages/core-sdk/test/integration/ipAsset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ describe("IP Asset Functions ", () => {
});
expect(result.txHash).to.be.a("string").and.not.empty;
expect(result.childIpId).to.be.a("string").and.not.empty;
expect(result.tokenId).to.be.a("bigint");
});

it("should not throw error when mint and register ip", async () => {
Expand Down

0 comments on commit 6b4c821

Please sign in to comment.