From 4c7888e17805ffc1ae0d5ed0899a112fc8ec97ee Mon Sep 17 00:00:00 2001 From: lutty Date: Tue, 23 Jul 2024 15:48:24 +0800 Subject: [PATCH 1/5] add onlyEncodeTransactions support --- packages/core-sdk/src/abi/generated.ts | 1053 ++++++++++++++++- packages/core-sdk/src/resources/dispute.ts | 61 +- packages/core-sdk/src/resources/ipAccount.ts | 32 +- packages/core-sdk/src/resources/ipAsset.ts | 143 ++- packages/core-sdk/src/resources/license.ts | 109 +- packages/core-sdk/src/resources/nftClient.ts | 26 +- packages/core-sdk/src/resources/permission.ts | 90 +- packages/core-sdk/src/resources/royalty.ts | 74 +- packages/core-sdk/src/types/options.ts | 4 + .../core-sdk/src/types/resources/dispute.ts | 9 +- .../core-sdk/src/types/resources/ipAccount.ts | 6 +- .../core-sdk/src/types/resources/ipAsset.ts | 14 +- .../core-sdk/src/types/resources/license.ts | 5 +- .../core-sdk/src/types/resources/nftClient.ts | 6 +- .../src/types/resources/permission.ts | 3 +- .../core-sdk/src/types/resources/royalty.ts | 12 +- packages/wagmi-generator/sdk.ts | 41 + 17 files changed, 1482 insertions(+), 206 deletions(-) diff --git a/packages/core-sdk/src/abi/generated.ts b/packages/core-sdk/src/abi/generated.ts index 502cfbc4..d6055de8 100644 --- a/packages/core-sdk/src/abi/generated.ts +++ b/packages/core-sdk/src/abi/generated.ts @@ -12,6 +12,7 @@ import { decodeEventLog, WatchContractEventReturnType, TransactionReceipt, + encodeFunctionData, } from "viem"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -7574,6 +7575,20 @@ export class AccessControllerClient extends AccessControllerEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setAllPermissions for contract AccessController with only encode + * + * @param request AccessControllerSetAllPermissionsRequest + * @return Promise + */ + public setAllPermissionsEncode(request: AccessControllerSetAllPermissionsRequest): Hex { + return encodeFunctionData({ + abi: accessControllerAbi, + functionName: "setAllPermissions", + args: [request.ipAccount, request.signer, request.permission], + }); + } + /** * method setBatchPermissions for contract AccessController * @@ -7593,6 +7608,20 @@ export class AccessControllerClient extends AccessControllerEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setBatchPermissions for contract AccessController with only encode + * + * @param request AccessControllerSetBatchPermissionsRequest + * @return Promise + */ + public setBatchPermissionsEncode(request: AccessControllerSetBatchPermissionsRequest): Hex { + return encodeFunctionData({ + abi: accessControllerAbi, + functionName: "setBatchPermissions", + args: [request.permissions], + }); + } + /** * method setPermission for contract AccessController * @@ -7611,6 +7640,20 @@ export class AccessControllerClient extends AccessControllerEventClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method setPermission for contract AccessController with only encode + * + * @param request AccessControllerSetPermissionRequest + * @return Promise + */ + public setPermissionEncode(request: AccessControllerSetPermissionRequest): Hex { + return encodeFunctionData({ + abi: accessControllerAbi, + functionName: "setPermission", + args: [request.ipAccount, request.signer, request.to, request.func, request.permission], + }); + } } // Contract CoreMetadataModule ============================================================= @@ -7977,6 +8020,20 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method freezeMetadata for contract CoreMetadataModule with only encode + * + * @param request CoreMetadataModuleFreezeMetadataRequest + * @return Promise + */ + public freezeMetadataEncode(request: CoreMetadataModuleFreezeMetadataRequest): Hex { + return encodeFunctionData({ + abi: coreMetadataModuleAbi, + functionName: "freezeMetadata", + args: [request.ipId], + }); + } + /** * method setAll for contract CoreMetadataModule * @@ -7994,6 +8051,20 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setAll for contract CoreMetadataModule with only encode + * + * @param request CoreMetadataModuleSetAllRequest + * @return Promise + */ + public setAllEncode(request: CoreMetadataModuleSetAllRequest): Hex { + return encodeFunctionData({ + abi: coreMetadataModuleAbi, + functionName: "setAll", + args: [request.ipId, request.metadataURI, request.metadataHash, request.nftMetadataHash], + }); + } + /** * method setMetadataURI for contract CoreMetadataModule * @@ -8013,6 +8084,20 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setMetadataURI for contract CoreMetadataModule with only encode + * + * @param request CoreMetadataModuleSetMetadataUriRequest + * @return Promise + */ + public setMetadataUriEncode(request: CoreMetadataModuleSetMetadataUriRequest): Hex { + return encodeFunctionData({ + abi: coreMetadataModuleAbi, + functionName: "setMetadataURI", + args: [request.ipId, request.metadataURI, request.metadataHash], + }); + } + /** * method updateNftTokenURI for contract CoreMetadataModule * @@ -8031,6 +8116,20 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method updateNftTokenURI for contract CoreMetadataModule with only encode + * + * @param request CoreMetadataModuleUpdateNftTokenUriRequest + * @return Promise + */ + public updateNftTokenUriEncode(request: CoreMetadataModuleUpdateNftTokenUriRequest): Hex { + return encodeFunctionData({ + abi: coreMetadataModuleAbi, + functionName: "updateNftTokenURI", + args: [request.ipId, request.nftMetadataHash], + }); + } } // Contract DisputeModule ============================================================= @@ -8279,6 +8378,20 @@ export class DisputeModuleClient extends DisputeModuleEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method cancelDispute for contract DisputeModule with only encode + * + * @param request DisputeModuleCancelDisputeRequest + * @return Promise + */ + public cancelDisputeEncode(request: DisputeModuleCancelDisputeRequest): Hex { + return encodeFunctionData({ + abi: disputeModuleAbi, + functionName: "cancelDispute", + args: [request.disputeId, request.data], + }); + } + /** * method raiseDispute for contract DisputeModule * @@ -8298,6 +8411,20 @@ export class DisputeModuleClient extends DisputeModuleEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method raiseDispute for contract DisputeModule with only encode + * + * @param request DisputeModuleRaiseDisputeRequest + * @return Promise + */ + public raiseDisputeEncode(request: DisputeModuleRaiseDisputeRequest): Hex { + return encodeFunctionData({ + abi: disputeModuleAbi, + functionName: "raiseDispute", + args: [request.targetIpId, request.linkToDisputeEvidence, request.targetTag, request.data], + }); + } + /** * method resolveDispute for contract DisputeModule * @@ -8316,6 +8443,20 @@ export class DisputeModuleClient extends DisputeModuleEventClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method resolveDispute for contract DisputeModule with only encode + * + * @param request DisputeModuleResolveDisputeRequest + * @return Promise + */ + public resolveDisputeEncode(request: DisputeModuleResolveDisputeRequest): Hex { + return encodeFunctionData({ + abi: disputeModuleAbi, + functionName: "resolveDispute", + args: [request.disputeId, request.data], + }); + } } // Contract IPAccountImpl ============================================================= @@ -8409,6 +8550,20 @@ export class IpAccountImplClient extends IpAccountImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method execute for contract IPAccountImpl with only encode + * + * @param request IpAccountImplExecuteRequest + * @return Promise + */ + public executeEncode(request: IpAccountImplExecuteRequest): Hex { + return encodeFunctionData({ + abi: ipAccountImplAbi, + functionName: "execute", + args: [request.to, request.value, request.data], + }); + } + /** * method executeWithSig for contract IPAccountImpl * @@ -8434,6 +8589,27 @@ export class IpAccountImplClient extends IpAccountImplReadOnlyClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method executeWithSig for contract IPAccountImpl with only encode + * + * @param request IpAccountImplExecuteWithSigRequest + * @return Promise + */ + public executeWithSigEncode(request: IpAccountImplExecuteWithSigRequest): Hex { + return encodeFunctionData({ + abi: ipAccountImplAbi, + functionName: "executeWithSig", + args: [ + request.to, + request.value, + request.data, + request.signer, + request.deadline, + request.signature, + ], + }); + } } // Contract IPAssetRegistry ============================================================= @@ -8678,6 +8854,20 @@ export class IpAssetRegistryClient extends IpAssetRegistryReadOnlyClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method register for contract IPAssetRegistry with only encode + * + * @param request IpAssetRegistryRegisterRequest + * @return Promise + */ + public registerEncode(request: IpAssetRegistryRegisterRequest): Hex { + return encodeFunctionData({ + abi: ipAssetRegistryAbi, + functionName: "register", + args: [request.chainid, request.tokenContract, request.tokenId], + }); + } } // Contract IpRoyaltyVaultImpl ============================================================= @@ -8973,6 +9163,22 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method claimRevenueBySnapshotBatch for contract IpRoyaltyVaultImpl with only encode + * + * @param request IpRoyaltyVaultImplClaimRevenueBySnapshotBatchRequest + * @return Promise + */ + public claimRevenueBySnapshotBatchEncode( + request: IpRoyaltyVaultImplClaimRevenueBySnapshotBatchRequest, + ): Hex { + return encodeFunctionData({ + abi: ipRoyaltyVaultImplAbi, + functionName: "claimRevenueBySnapshotBatch", + args: [request.snapshotIds, request.token], + }); + } + /** * method claimRevenueByTokenBatch for contract IpRoyaltyVaultImpl * @@ -8992,6 +9198,22 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method claimRevenueByTokenBatch for contract IpRoyaltyVaultImpl with only encode + * + * @param request IpRoyaltyVaultImplClaimRevenueByTokenBatchRequest + * @return Promise + */ + public claimRevenueByTokenBatchEncode( + request: IpRoyaltyVaultImplClaimRevenueByTokenBatchRequest, + ): Hex { + return encodeFunctionData({ + abi: ipRoyaltyVaultImplAbi, + functionName: "claimRevenueByTokenBatch", + args: [request.snapshotId, request.tokenList], + }); + } + /** * method collectRoyaltyTokens for contract IpRoyaltyVaultImpl * @@ -9011,6 +9233,20 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method collectRoyaltyTokens for contract IpRoyaltyVaultImpl with only encode + * + * @param request IpRoyaltyVaultImplCollectRoyaltyTokensRequest + * @return Promise + */ + public collectRoyaltyTokensEncode(request: IpRoyaltyVaultImplCollectRoyaltyTokensRequest): Hex { + return encodeFunctionData({ + abi: ipRoyaltyVaultImplAbi, + functionName: "collectRoyaltyTokens", + args: [request.ancestorIpId], + }); + } + /** * method snapshot for contract IpRoyaltyVaultImpl * @@ -9026,6 +9262,19 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method snapshot for contract IpRoyaltyVaultImpl with only encode + * + * @param request IpRoyaltyVaultImplSnapshotRequest + * @return Promise + */ + public snapshotEncode(): Hex { + return encodeFunctionData({ + abi: ipRoyaltyVaultImplAbi, + functionName: "snapshot", + }); + } } // Contract LicenseRegistry ============================================================= @@ -10228,6 +10477,20 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method attachLicenseTermsToIp for contract LicenseRegistry with only encode + * + * @param request LicenseRegistryAttachLicenseTermsToIpRequest + * @return Promise + */ + public attachLicenseTermsToIpEncode(request: LicenseRegistryAttachLicenseTermsToIpRequest): Hex { + return encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "attachLicenseTermsToIp", + args: [request.ipId, request.licenseTemplate, request.licenseTermsId], + }); + } + /** * method initialize for contract LicenseRegistry * @@ -10247,6 +10510,20 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method initialize for contract LicenseRegistry with only encode + * + * @param request LicenseRegistryInitializeRequest + * @return Promise + */ + public initializeEncode(request: LicenseRegistryInitializeRequest): Hex { + return encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "initialize", + args: [request.accessManager], + }); + } + /** * method registerDerivativeIp for contract LicenseRegistry * @@ -10271,6 +10548,25 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method registerDerivativeIp for contract LicenseRegistry with only encode + * + * @param request LicenseRegistryRegisterDerivativeIpRequest + * @return Promise + */ + public registerDerivativeIpEncode(request: LicenseRegistryRegisterDerivativeIpRequest): Hex { + return encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "registerDerivativeIp", + args: [ + request.childIpId, + request.parentIpIds, + request.licenseTemplate, + request.licenseTermsIds, + ], + }); + } + /** * method registerLicenseTemplate for contract LicenseRegistry * @@ -10290,6 +10586,22 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method registerLicenseTemplate for contract LicenseRegistry with only encode + * + * @param request LicenseRegistryRegisterLicenseTemplateRequest + * @return Promise + */ + public registerLicenseTemplateEncode( + request: LicenseRegistryRegisterLicenseTemplateRequest, + ): Hex { + return encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "registerLicenseTemplate", + args: [request.licenseTemplate], + }); + } + /** * method setAuthority for contract LicenseRegistry * @@ -10309,6 +10621,20 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setAuthority for contract LicenseRegistry with only encode + * + * @param request LicenseRegistrySetAuthorityRequest + * @return Promise + */ + public setAuthorityEncode(request: LicenseRegistrySetAuthorityRequest): Hex { + return encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "setAuthority", + args: [request.newAuthority], + }); + } + /** * method setDefaultLicenseTerms for contract LicenseRegistry * @@ -10328,6 +10654,20 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setDefaultLicenseTerms for contract LicenseRegistry with only encode + * + * @param request LicenseRegistrySetDefaultLicenseTermsRequest + * @return Promise + */ + public setDefaultLicenseTermsEncode(request: LicenseRegistrySetDefaultLicenseTermsRequest): Hex { + return encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "setDefaultLicenseTerms", + args: [request.newLicenseTemplate, request.newLicenseTermsId], + }); + } + /** * method setExpireTime for contract LicenseRegistry * @@ -10347,6 +10687,20 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setExpireTime for contract LicenseRegistry with only encode + * + * @param request LicenseRegistrySetExpireTimeRequest + * @return Promise + */ + public setExpireTimeEncode(request: LicenseRegistrySetExpireTimeRequest): Hex { + return encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "setExpireTime", + args: [request.ipId, request.expireTime], + }); + } + /** * method setLicensingConfigForIp for contract LicenseRegistry * @@ -10367,9 +10721,25 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { } /** - * method setLicensingConfigForLicense for contract LicenseRegistry + * method setLicensingConfigForIp for contract LicenseRegistry with only encode * - * @param request LicenseRegistrySetLicensingConfigForLicenseRequest + * @param request LicenseRegistrySetLicensingConfigForIpRequest + * @return Promise + */ + public setLicensingConfigForIpEncode( + request: LicenseRegistrySetLicensingConfigForIpRequest, + ): Hex { + return encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "setLicensingConfigForIp", + args: [request.ipId, request.licensingConfig], + }); + } + + /** + * method setLicensingConfigForLicense for contract LicenseRegistry + * + * @param request LicenseRegistrySetLicensingConfigForLicenseRequest * @return Promise */ public async setLicensingConfigForLicense( @@ -10390,6 +10760,27 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setLicensingConfigForLicense for contract LicenseRegistry with only encode + * + * @param request LicenseRegistrySetLicensingConfigForLicenseRequest + * @return Promise + */ + public setLicensingConfigForLicenseEncode( + request: LicenseRegistrySetLicensingConfigForLicenseRequest, + ): Hex { + return encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "setLicensingConfigForLicense", + args: [ + request.ipId, + request.licenseTemplate, + request.licenseTermsId, + request.licensingConfig, + ], + }); + } + /** * method upgradeToAndCall for contract LicenseRegistry * @@ -10408,6 +10799,20 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method upgradeToAndCall for contract LicenseRegistry with only encode + * + * @param request LicenseRegistryUpgradeToAndCallRequest + * @return Promise + */ + public upgradeToAndCallEncode(request: LicenseRegistryUpgradeToAndCallRequest): Hex { + return encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "upgradeToAndCall", + args: [request.newImplementation, request.data], + }); + } } // Contract LicenseToken ============================================================= @@ -10676,6 +11081,20 @@ export class LicensingModuleClient extends LicensingModuleEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method attachLicenseTerms for contract LicensingModule with only encode + * + * @param request LicensingModuleAttachLicenseTermsRequest + * @return Promise + */ + public attachLicenseTermsEncode(request: LicensingModuleAttachLicenseTermsRequest): Hex { + return encodeFunctionData({ + abi: licensingModuleAbi, + functionName: "attachLicenseTerms", + args: [request.ipId, request.licenseTemplate, request.licenseTermsId], + }); + } + /** * method mintLicenseTokens for contract LicensingModule * @@ -10702,6 +11121,27 @@ export class LicensingModuleClient extends LicensingModuleEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method mintLicenseTokens for contract LicensingModule with only encode + * + * @param request LicensingModuleMintLicenseTokensRequest + * @return Promise + */ + public mintLicenseTokensEncode(request: LicensingModuleMintLicenseTokensRequest): Hex { + return encodeFunctionData({ + abi: licensingModuleAbi, + functionName: "mintLicenseTokens", + args: [ + request.licensorIpId, + request.licenseTemplate, + request.licenseTermsId, + request.amount, + request.receiver, + request.royaltyContext, + ], + }); + } + /** * method registerDerivative for contract LicensingModule * @@ -10727,6 +11167,26 @@ export class LicensingModuleClient extends LicensingModuleEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method registerDerivative for contract LicensingModule with only encode + * + * @param request LicensingModuleRegisterDerivativeRequest + * @return Promise + */ + public registerDerivativeEncode(request: LicensingModuleRegisterDerivativeRequest): Hex { + return encodeFunctionData({ + abi: licensingModuleAbi, + functionName: "registerDerivative", + args: [ + request.childIpId, + request.parentIpIds, + request.licenseTermsIds, + request.licenseTemplate, + request.royaltyContext, + ], + }); + } + /** * method registerDerivativeWithLicenseTokens for contract LicensingModule * @@ -10745,6 +11205,22 @@ export class LicensingModuleClient extends LicensingModuleEventClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method registerDerivativeWithLicenseTokens for contract LicensingModule with only encode + * + * @param request LicensingModuleRegisterDerivativeWithLicenseTokensRequest + * @return Promise + */ + public registerDerivativeWithLicenseTokensEncode( + request: LicensingModuleRegisterDerivativeWithLicenseTokensRequest, + ): Hex { + return encodeFunctionData({ + abi: licensingModuleAbi, + functionName: "registerDerivativeWithLicenseTokens", + args: [request.childIpId, request.licenseTokenIds, request.royaltyContext], + }); + } } // Contract ModuleRegistry ============================================================= @@ -11819,6 +12295,20 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method initialize for contract PILicenseTemplate with only encode + * + * @param request PiLicenseTemplateInitializeRequest + * @return Promise + */ + public initializeEncode(request: PiLicenseTemplateInitializeRequest): Hex { + return encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "initialize", + args: [request.accessManager, request.name, request.metadataURI], + }); + } + /** * method registerLicenseTerms for contract PILicenseTemplate * @@ -11838,6 +12328,20 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method registerLicenseTerms for contract PILicenseTemplate with only encode + * + * @param request PiLicenseTemplateRegisterLicenseTermsRequest + * @return Promise + */ + public registerLicenseTermsEncode(request: PiLicenseTemplateRegisterLicenseTermsRequest): Hex { + return encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "registerLicenseTerms", + args: [request.terms], + }); + } + /** * method setApproval for contract PILicenseTemplate * @@ -11857,6 +12361,20 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setApproval for contract PILicenseTemplate with only encode + * + * @param request PiLicenseTemplateSetApprovalRequest + * @return Promise + */ + public setApprovalEncode(request: PiLicenseTemplateSetApprovalRequest): Hex { + return encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "setApproval", + args: [request.parentIpId, request.licenseTermsId, request.childIpId, request.approved], + }); + } + /** * method setAuthority for contract PILicenseTemplate * @@ -11876,6 +12394,20 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setAuthority for contract PILicenseTemplate with only encode + * + * @param request PiLicenseTemplateSetAuthorityRequest + * @return Promise + */ + public setAuthorityEncode(request: PiLicenseTemplateSetAuthorityRequest): Hex { + return encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "setAuthority", + args: [request.newAuthority], + }); + } + /** * method upgradeToAndCall for contract PILicenseTemplate * @@ -11895,6 +12427,20 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method upgradeToAndCall for contract PILicenseTemplate with only encode + * + * @param request PiLicenseTemplateUpgradeToAndCallRequest + * @return Promise + */ + public upgradeToAndCallEncode(request: PiLicenseTemplateUpgradeToAndCallRequest): Hex { + return encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "upgradeToAndCall", + args: [request.newImplementation, request.data], + }); + } + /** * method verifyMintLicenseToken for contract PILicenseTemplate * @@ -11914,6 +12460,22 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method verifyMintLicenseToken for contract PILicenseTemplate with only encode + * + * @param request PiLicenseTemplateVerifyMintLicenseTokenRequest + * @return Promise + */ + public verifyMintLicenseTokenEncode( + request: PiLicenseTemplateVerifyMintLicenseTokenRequest, + ): Hex { + return encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "verifyMintLicenseToken", + args: [request[0], request[1], request[2], request[3]], + }); + } + /** * method verifyRegisterDerivative for contract PILicenseTemplate * @@ -11933,6 +12495,22 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method verifyRegisterDerivative for contract PILicenseTemplate with only encode + * + * @param request PiLicenseTemplateVerifyRegisterDerivativeRequest + * @return Promise + */ + public verifyRegisterDerivativeEncode( + request: PiLicenseTemplateVerifyRegisterDerivativeRequest, + ): Hex { + return encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "verifyRegisterDerivative", + args: [request.childIpId, request.parentIpId, request.licenseTermsId, request.licensee], + }); + } + /** * method verifyRegisterDerivativeForAllParents for contract PILicenseTemplate * @@ -11951,6 +12529,22 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method verifyRegisterDerivativeForAllParents for contract PILicenseTemplate with only encode + * + * @param request PiLicenseTemplateVerifyRegisterDerivativeForAllParentsRequest + * @return Promise + */ + public verifyRegisterDerivativeForAllParentsEncode( + request: PiLicenseTemplateVerifyRegisterDerivativeForAllParentsRequest, + ): Hex { + return encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "verifyRegisterDerivativeForAllParents", + args: [request.childIpId, request.parentIpIds, request.licenseTermsIds, request.childIpOwner], + }); + } } // Contract RoyaltyModule ============================================================= @@ -12002,6 +12596,20 @@ export class RoyaltyModuleClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method payRoyaltyOnBehalf for contract RoyaltyModule with only encode + * + * @param request RoyaltyModulePayRoyaltyOnBehalfRequest + * @return Promise + */ + public payRoyaltyOnBehalfEncode(request: RoyaltyModulePayRoyaltyOnBehalfRequest): Hex { + return encodeFunctionData({ + abi: royaltyModuleAbi, + functionName: "payRoyaltyOnBehalf", + args: [request.receiverIpId, request.payerIpId, request.token, request.amount], + }); + } } // Contract RoyaltyPolicyLAP ============================================================= @@ -12106,6 +12714,20 @@ export class RoyaltyPolicyLapClient extends RoyaltyPolicyLapReadOnlyClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method onRoyaltyPayment for contract RoyaltyPolicyLAP with only encode + * + * @param request RoyaltyPolicyLapOnRoyaltyPaymentRequest + * @return Promise + */ + public onRoyaltyPaymentEncode(request: RoyaltyPolicyLapOnRoyaltyPaymentRequest): Hex { + return encodeFunctionData({ + abi: royaltyPolicyLapAbi, + functionName: "onRoyaltyPayment", + args: [request.caller, request.ipId, request.token, request.amount], + }); + } } // Contract SPG ============================================================= @@ -12498,6 +13120,27 @@ export class SpgClient extends SpgEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method createCollection for contract SPG with only encode + * + * @param request SpgCreateCollectionRequest + * @return Promise + */ + public createCollectionEncode(request: SpgCreateCollectionRequest): Hex { + return encodeFunctionData({ + abi: spgAbi, + functionName: "createCollection", + args: [ + request.name, + request.symbol, + request.maxSupply, + request.mintFee, + request.mintFeeToken, + request.owner, + ], + }); + } + /** * method mintAndRegisterIp for contract SPG * @@ -12517,6 +13160,20 @@ export class SpgClient extends SpgEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method mintAndRegisterIp for contract SPG with only encode + * + * @param request SpgMintAndRegisterIpRequest + * @return Promise + */ + public mintAndRegisterIpEncode(request: SpgMintAndRegisterIpRequest): Hex { + return encodeFunctionData({ + abi: spgAbi, + functionName: "mintAndRegisterIp", + args: [request.nftContract, request.recipient, request.metadata], + }); + } + /** * method mintAndRegisterIpAndAttachPILTerms for contract SPG * @@ -12536,6 +13193,22 @@ export class SpgClient extends SpgEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method mintAndRegisterIpAndAttachPILTerms for contract SPG with only encode + * + * @param request SpgMintAndRegisterIpAndAttachPilTermsRequest + * @return Promise + */ + public mintAndRegisterIpAndAttachPilTermsEncode( + request: SpgMintAndRegisterIpAndAttachPilTermsRequest, + ): Hex { + return encodeFunctionData({ + abi: spgAbi, + functionName: "mintAndRegisterIpAndAttachPILTerms", + args: [request.nftContract, request.recipient, request.metadata, request.terms], + }); + } + /** * method mintAndRegisterIpAndMakeDerivative for contract SPG * @@ -12555,6 +13228,22 @@ export class SpgClient extends SpgEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method mintAndRegisterIpAndMakeDerivative for contract SPG with only encode + * + * @param request SpgMintAndRegisterIpAndMakeDerivativeRequest + * @return Promise + */ + public mintAndRegisterIpAndMakeDerivativeEncode( + request: SpgMintAndRegisterIpAndMakeDerivativeRequest, + ): Hex { + return encodeFunctionData({ + abi: spgAbi, + functionName: "mintAndRegisterIpAndMakeDerivative", + args: [request.nftContract, request.derivData, request.metadata, request.recipient], + }); + } + /** * method mintAndRegisterIpAndMakeDerivativeWithLicenseTokens for contract SPG * @@ -12580,6 +13269,28 @@ export class SpgClient extends SpgEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method mintAndRegisterIpAndMakeDerivativeWithLicenseTokens for contract SPG with only encode + * + * @param request SpgMintAndRegisterIpAndMakeDerivativeWithLicenseTokensRequest + * @return Promise + */ + public mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode( + request: SpgMintAndRegisterIpAndMakeDerivativeWithLicenseTokensRequest, + ): Hex { + return encodeFunctionData({ + abi: spgAbi, + functionName: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens", + args: [ + request.nftContract, + request.licenseTokenIds, + request.royaltyContext, + request.metadata, + request.recipient, + ], + }); + } + /** * method registerIp for contract SPG * @@ -12597,6 +13308,20 @@ export class SpgClient extends SpgEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method registerIp for contract SPG with only encode + * + * @param request SpgRegisterIpRequest + * @return Promise + */ + public registerIpEncode(request: SpgRegisterIpRequest): Hex { + return encodeFunctionData({ + abi: spgAbi, + functionName: "registerIp", + args: [request.nftContract, request.tokenId, request.metadata, request.sigMetadata], + }); + } + /** * method registerIpAndAttachPILTerms for contract SPG * @@ -12623,6 +13348,27 @@ export class SpgClient extends SpgEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method registerIpAndAttachPILTerms for contract SPG with only encode + * + * @param request SpgRegisterIpAndAttachPilTermsRequest + * @return Promise + */ + public registerIpAndAttachPilTermsEncode(request: SpgRegisterIpAndAttachPilTermsRequest): Hex { + return encodeFunctionData({ + abi: spgAbi, + functionName: "registerIpAndAttachPILTerms", + args: [ + request.nftContract, + request.tokenId, + request.metadata, + request.terms, + request.sigMetadata, + request.sigAttach, + ], + }); + } + /** * method registerIpAndMakeDerivative for contract SPG * @@ -12649,6 +13395,27 @@ export class SpgClient extends SpgEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method registerIpAndMakeDerivative for contract SPG with only encode + * + * @param request SpgRegisterIpAndMakeDerivativeRequest + * @return Promise + */ + public registerIpAndMakeDerivativeEncode(request: SpgRegisterIpAndMakeDerivativeRequest): Hex { + return encodeFunctionData({ + abi: spgAbi, + functionName: "registerIpAndMakeDerivative", + args: [ + request.nftContract, + request.tokenId, + request.derivData, + request.metadata, + request.sigMetadata, + request.sigRegister, + ], + }); + } + /** * method registerIpAndMakeDerivativeWithLicenseTokens for contract SPG * @@ -12676,6 +13443,30 @@ export class SpgClient extends SpgEventClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method registerIpAndMakeDerivativeWithLicenseTokens for contract SPG with only encode + * + * @param request SpgRegisterIpAndMakeDerivativeWithLicenseTokensRequest + * @return Promise + */ + public registerIpAndMakeDerivativeWithLicenseTokensEncode( + request: SpgRegisterIpAndMakeDerivativeWithLicenseTokensRequest, + ): Hex { + return encodeFunctionData({ + abi: spgAbi, + functionName: "registerIpAndMakeDerivativeWithLicenseTokens", + args: [ + request.nftContract, + request.tokenId, + request.licenseTokenIds, + request.royaltyContext, + request.metadata, + request.sigMetadata, + request.sigRegister, + ], + }); + } + /** * method registerPILTermsAndAttach for contract SPG * @@ -12694,6 +13485,20 @@ export class SpgClient extends SpgEventClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method registerPILTermsAndAttach for contract SPG with only encode + * + * @param request SpgRegisterPilTermsAndAttachRequest + * @return Promise + */ + public registerPilTermsAndAttachEncode(request: SpgRegisterPilTermsAndAttachRequest): Hex { + return encodeFunctionData({ + abi: spgAbi, + functionName: "registerPILTermsAndAttach", + args: [request.ipId, request.terms], + }); + } } // Contract SPGNFTBeacon ============================================================= @@ -12897,6 +13702,19 @@ export class SpgnftBeaconClient extends SpgnftBeaconReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method renounceOwnership for contract SPGNFTBeacon with only encode + * + * @param request SpgnftBeaconRenounceOwnershipRequest + * @return Promise + */ + public renounceOwnershipEncode(): Hex { + return encodeFunctionData({ + abi: spgnftBeaconAbi, + functionName: "renounceOwnership", + }); + } + /** * method transferOwnership for contract SPGNFTBeacon * @@ -12916,6 +13734,20 @@ export class SpgnftBeaconClient extends SpgnftBeaconReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method transferOwnership for contract SPGNFTBeacon with only encode + * + * @param request SpgnftBeaconTransferOwnershipRequest + * @return Promise + */ + public transferOwnershipEncode(request: SpgnftBeaconTransferOwnershipRequest): Hex { + return encodeFunctionData({ + abi: spgnftBeaconAbi, + functionName: "transferOwnership", + args: [request.newOwner], + }); + } + /** * method upgradeTo for contract SPGNFTBeacon * @@ -12932,6 +13764,20 @@ export class SpgnftBeaconClient extends SpgnftBeaconReadOnlyClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method upgradeTo for contract SPGNFTBeacon with only encode + * + * @param request SpgnftBeaconUpgradeToRequest + * @return Promise + */ + public upgradeToEncode(request: SpgnftBeaconUpgradeToRequest): Hex { + return encodeFunctionData({ + abi: spgnftBeaconAbi, + functionName: "upgradeTo", + args: [request.newImplementation], + }); + } } // Contract SPGNFTImpl ============================================================= @@ -13848,6 +14694,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method approve for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplApproveRequest + * @return Promise + */ + public approveEncode(request: SpgnftImplApproveRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "approve", + args: [request.to, request.tokenId], + }); + } + /** * method grantRole for contract SPGNFTImpl * @@ -13865,6 +14725,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method grantRole for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplGrantRoleRequest + * @return Promise + */ + public grantRoleEncode(request: SpgnftImplGrantRoleRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "grantRole", + args: [request.role, request.account], + }); + } + /** * method initialize for contract SPGNFTImpl * @@ -13889,6 +14763,27 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method initialize for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplInitializeRequest + * @return Promise + */ + public initializeEncode(request: SpgnftImplInitializeRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "initialize", + args: [ + request.name, + request.symbol, + request.maxSupply, + request.mintCost, + request.mintToken, + request.owner, + ], + }); + } + /** * method mint for contract SPGNFTImpl * @@ -13906,6 +14801,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method mint for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplMintRequest + * @return Promise + */ + public mintEncode(request: SpgnftImplMintRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "mint", + args: [request.to], + }); + } + /** * method mintBySPG for contract SPGNFTImpl * @@ -13923,6 +14832,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method mintBySPG for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplMintBySpgRequest + * @return Promise + */ + public mintBySpgEncode(request: SpgnftImplMintBySpgRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "mintBySPG", + args: [request.to, request.payer], + }); + } + /** * method renounceRole for contract SPGNFTImpl * @@ -13942,6 +14865,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method renounceRole for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplRenounceRoleRequest + * @return Promise + */ + public renounceRoleEncode(request: SpgnftImplRenounceRoleRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "renounceRole", + args: [request.role, request.callerConfirmation], + }); + } + /** * method revokeRole for contract SPGNFTImpl * @@ -13959,6 +14896,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method revokeRole for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplRevokeRoleRequest + * @return Promise + */ + public revokeRoleEncode(request: SpgnftImplRevokeRoleRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "revokeRole", + args: [request.role, request.account], + }); + } + /** * method safeTransferFrom for contract SPGNFTImpl * @@ -13978,6 +14929,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method safeTransferFrom for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplSafeTransferFromRequest + * @return Promise + */ + public safeTransferFromEncode(request: SpgnftImplSafeTransferFromRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "safeTransferFrom", + args: [request.from, request.to, request.tokenId], + }); + } + /** * method safeTransferFrom for contract SPGNFTImpl * @@ -13997,6 +14962,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method safeTransferFrom for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplSafeTransferFrom2Request + * @return Promise + */ + public safeTransferFrom2Encode(request: SpgnftImplSafeTransferFrom2Request): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "safeTransferFrom", + args: [request.from, request.to, request.tokenId, request.data], + }); + } + /** * method setApprovalForAll for contract SPGNFTImpl * @@ -14016,6 +14995,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setApprovalForAll for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplSetApprovalForAllRequest + * @return Promise + */ + public setApprovalForAllEncode(request: SpgnftImplSetApprovalForAllRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "setApprovalForAll", + args: [request.operator, request.approved], + }); + } + /** * method setMintCost for contract SPGNFTImpl * @@ -14035,6 +15028,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setMintCost for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplSetMintCostRequest + * @return Promise + */ + public setMintCostEncode(request: SpgnftImplSetMintCostRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "setMintCost", + args: [request.cost], + }); + } + /** * method setMintToken for contract SPGNFTImpl * @@ -14054,6 +15061,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method setMintToken for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplSetMintTokenRequest + * @return Promise + */ + public setMintTokenEncode(request: SpgnftImplSetMintTokenRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "setMintToken", + args: [request.token], + }); + } + /** * method transferFrom for contract SPGNFTImpl * @@ -14073,6 +15094,20 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { return await this.wallet.writeContract(call as WriteContractParameters); } + /** + * method transferFrom for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplTransferFromRequest + * @return Promise + */ + public transferFromEncode(request: SpgnftImplTransferFromRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "transferFrom", + args: [request.from, request.to, request.tokenId], + }); + } + /** * method withdrawToken for contract SPGNFTImpl * @@ -14091,4 +15126,18 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { }); return await this.wallet.writeContract(call as WriteContractParameters); } + + /** + * method withdrawToken for contract SPGNFTImpl with only encode + * + * @param request SpgnftImplWithdrawTokenRequest + * @return Promise + */ + public withdrawTokenEncode(request: SpgnftImplWithdrawTokenRequest): Hex { + return encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "withdrawToken", + args: [request.token, request.recipient], + }); + } } diff --git a/packages/core-sdk/src/resources/dispute.ts b/packages/core-sdk/src/resources/dispute.ts index 4ff41e9d..24a24e06 100644 --- a/packages/core-sdk/src/resources/dispute.ts +++ b/packages/core-sdk/src/resources/dispute.ts @@ -39,22 +39,28 @@ export class DisputeClient { */ public async raiseDispute(request: RaiseDisputeRequest): Promise { try { - const txHash = await this.disputeModuleClient.raiseDispute({ + const req = { targetIpId: getAddress(request.targetIpId, "request.targetIpId"), linkToDisputeEvidence: request.linkToDisputeEvidence, targetTag: stringToHex(request.targetTag, { size: 32 }), data: request.calldata || "0x", - }); + }; - if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const targetLogs = this.disputeModuleClient.parseTxDisputeRaisedEvent(txReceipt); - return { - txHash: txHash, - disputeId: targetLogs[0].disputeId, - }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.disputeModuleClient.raiseDisputeEncode(req) }; + } else { + const txHash = await this.disputeModuleClient.raiseDispute(req); + + if (request.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const targetLogs = this.disputeModuleClient.parseTxDisputeRaisedEvent(txReceipt); + return { + txHash: txHash, + disputeId: targetLogs[0].disputeId, + }; + } + return { txHash: txHash }; } - return { txHash: txHash }; } catch (error) { handleError(error, "Failed to raise dispute"); } @@ -74,16 +80,21 @@ export class DisputeClient { */ public async cancelDispute(request: CancelDisputeRequest): Promise { try { - const txHash = await this.disputeModuleClient.cancelDispute({ + const req = { disputeId: BigInt(request.disputeId), data: request.calldata ? request.calldata : "0x", - }); + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.disputeModuleClient.cancelDisputeEncode(req) }; + } else { + const txHash = await this.disputeModuleClient.cancelDispute(req); - if (request.txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - } + if (request.txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + } - return { txHash: txHash }; + return { txHash: txHash }; + } } catch (error) { handleError(error, "Failed to cancel dispute"); } @@ -101,15 +112,21 @@ export class DisputeClient { */ public async resolveDispute(request: ResolveDisputeRequest): Promise { try { - const txHash = await this.disputeModuleClient.resolveDispute({ + const req = { disputeId: BigInt(request.disputeId), data: request.data, - }); - if (request.txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - } + }; + + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.disputeModuleClient.resolveDisputeEncode(req) }; + } else { + const txHash = await this.disputeModuleClient.resolveDispute(req); + if (request.txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + } - return { txHash: txHash }; + return { txHash: txHash }; + } } catch (error) { handleError(error, "Failed to resolve dispute"); } diff --git a/packages/core-sdk/src/resources/ipAccount.ts b/packages/core-sdk/src/resources/ipAccount.ts index 5822e775..f5327e37 100644 --- a/packages/core-sdk/src/resources/ipAccount.ts +++ b/packages/core-sdk/src/resources/ipAccount.ts @@ -40,16 +40,22 @@ export class IPAccountClient { getAddress(request.ipId, "request.ipId"), ); - const txHash = await ipAccountClient.execute({ + const req = { to: request.to, value: BigInt(0), data: request.data, - }); + }; - if (request.txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: ipAccountClient.executeEncode(req) }; + } else { + const txHash = await ipAccountClient.execute(req); + + if (request.txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + } + return { txHash: txHash }; } - return { txHash: txHash }; } catch (error) { handleError(error, "Failed to execute the IP Account transaction"); } @@ -76,19 +82,25 @@ export class IPAccountClient { getAddress(request.ipId, "request.ipId"), ); - const txHash = await ipAccountClient.executeWithSig({ + const req = { to: getAddress(request.to, "request.to"), value: BigInt(0), data: request.data, signer: getAddress(request.signer, "request.signer"), deadline: BigInt(request.deadline), signature: request.signature, - }); + }; + + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: ipAccountClient.executeWithSigEncode(req) }; + } else { + const txHash = await ipAccountClient.executeWithSig(req); - if (request.txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + if (request.txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + } + return { txHash: txHash }; } - return { txHash: txHash }; } catch (error) { handleError(error, "Failed to execute with signature for the IP Account transaction"); } diff --git a/packages/core-sdk/src/resources/ipAsset.ts b/packages/core-sdk/src/resources/ipAsset.ts index 12eff524..b22425bc 100644 --- a/packages/core-sdk/src/resources/ipAsset.ts +++ b/packages/core-sdk/src/resources/ipAsset.ts @@ -136,22 +136,36 @@ export class IPAssetClient { deadline: calculatedDeadline, signature, }; - let txHash: Hex; - if (request.metadata) { - txHash = await this.spgClient.registerIp(object); - } else { - txHash = await this.ipAssetRegistryClient.register({ - tokenContract: object.nftContract, - tokenId: object.tokenId, - chainid: chain[this.chainId], - }); - } - if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const targetLogs = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt); - return { txHash: txHash, ipId: targetLogs[0].ipId }; + if (request.txOptions?.onlyEncodeTransactions) { + if (request.metadata) { + return { encodedTx: this.spgClient.registerIpEncode(object) }; + } else { + return { + encodedTx: this.ipAssetRegistryClient.registerEncode({ + tokenContract: object.nftContract, + tokenId: object.tokenId, + chainid: chain[this.chainId], + }), + }; + } } else { - return { txHash: txHash }; + let txHash: Hex; + if (request.metadata) { + txHash = await this.spgClient.registerIp(object); + } else { + txHash = await this.ipAssetRegistryClient.register({ + tokenContract: object.nftContract, + tokenId: object.tokenId, + chainid: chain[this.chainId], + }); + } + if (request.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const targetLogs = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt); + return { txHash: txHash, ipId: targetLogs[0].ipId }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to register IP"); @@ -207,18 +221,23 @@ export class IPAssetClient { } } - const txHash = await this.licensingModuleClient.registerDerivative({ + const req = { childIpId: request.childIpId, parentIpIds: request.parentIpIds, licenseTermsIds: request.licenseTermsIds.map((id) => BigInt(id)), licenseTemplate: request.licenseTemplate || this.licenseTemplateClient.address, royaltyContext: zeroAddress, - }); - if (request.txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - return { txHash }; + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.licensingModuleClient.registerDerivativeEncode(req) }; } else { - return { txHash }; + const txHash = await this.licensingModuleClient.registerDerivative(req); + if (request.txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + return { txHash }; + } else { + return { txHash }; + } } } catch (error) { handleError(error, "Failed to register derivative"); @@ -253,16 +272,23 @@ export class IPAssetClient { throw new Error(`License token id ${licenseTokenId} must be owned by the caller.`); } } - const txHash = await this.licensingModuleClient.registerDerivativeWithLicenseTokens({ + const req = { childIpId: getAddress(request.childIpId, "request.childIpId"), licenseTokenIds: request.licenseTokenIds, royaltyContext: zeroAddress, - }); - if (request.txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - return { txHash: txHash }; + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { + encodedTx: this.licensingModuleClient.registerDerivativeWithLicenseTokensEncode(req), + }; } else { - return { txHash: txHash }; + const txHash = await this.licensingModuleClient.registerDerivativeWithLicenseTokens(req); + if (request.txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + return { txHash: txHash }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to register derivative with license tokens"); @@ -325,20 +351,25 @@ export class IPAssetClient { nftMetadataHash: request.metadata.nftMetadataHash || object.metadata.nftMetadataHash, }; } - const txHash = await this.spgClient.mintAndRegisterIpAndAttachPilTerms(object); - if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt)[0]; - const licenseTermsId = - this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0].licenseTermsId; - return { - txHash: txHash, - ipId: iPRegisteredLog.ipId, - licenseTermsId, - tokenId: iPRegisteredLog.tokenId, - }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.spgClient.mintAndRegisterIpAndAttachPilTermsEncode(object) }; + } else { + const txHash = await this.spgClient.mintAndRegisterIpAndAttachPilTerms(object); + if (request.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt)[0]; + const licenseTermsId = + this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0] + .licenseTermsId; + return { + txHash: txHash, + ipId: iPRegisteredLog.ipId, + licenseTermsId, + tokenId: iPRegisteredLog.tokenId, + }; + } + return { txHash }; } - return { txHash }; } catch (error) { handleError(error, "Failed to mint and register IP and attach PIL terms"); } @@ -451,13 +482,17 @@ export class IPAssetClient { deadline: calculatedDeadline, signature, }; - const txHash = await this.spgClient.registerIpAndAttachPilTerms(object); - if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const log = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0]; - return { txHash, licenseTermsId: log.licenseTermsId, ipId: log.ipId }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.spgClient.registerIpAndAttachPilTermsEncode(object) }; + } else { + const txHash = await this.spgClient.registerIpAndAttachPilTerms(object); + if (request.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const log = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0]; + return { txHash, licenseTermsId: log.licenseTermsId, ipId: log.ipId }; + } + return { txHash }; } - return { txHash }; } catch (error) { handleError(error, "Failed to register IP and attach PIL terms"); } @@ -593,13 +628,17 @@ export class IPAssetClient { deadline: calculatedDeadline, signature, }; - const txHash = await this.spgClient.registerIpAndMakeDerivative(object); - if (request.txOptions?.waitForTransaction) { - const receipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const log = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt)[0]; - return { txHash, ipId: log.ipId }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.spgClient.registerIpAndMakeDerivativeEncode(object) }; + } else { + const txHash = await this.spgClient.registerIpAndMakeDerivative(object); + if (request.txOptions?.waitForTransaction) { + const receipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const log = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt)[0]; + return { txHash, ipId: log.ipId }; + } + return { txHash }; } - return { txHash }; } catch (error) { handleError(error, "Failed to register derivative IP"); } diff --git a/packages/core-sdk/src/resources/license.ts b/packages/core-sdk/src/resources/license.ts index ae88194b..c13732c1 100644 --- a/packages/core-sdk/src/resources/license.ts +++ b/packages/core-sdk/src/resources/license.ts @@ -67,13 +67,22 @@ export class LicenseClient { if (licenseTermsId !== 0n) { return { licenseTermsId: licenseTermsId }; } - const txHash = await this.licenseTemplateClient.registerLicenseTerms({ terms: licenseTerms }); - if (request?.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const targetLogs = this.licenseTemplateClient.parseTxLicenseTermsRegisteredEvent(txReceipt); - return { txHash: txHash, licenseTermsId: targetLogs[0].licenseTermsId }; + if (request?.txOptions?.onlyEncodeTransactions) { + return { + encodedTx: this.licenseTemplateClient.registerLicenseTermsEncode({ terms: licenseTerms }), + }; } else { - return { txHash: txHash }; + const txHash = await this.licenseTemplateClient.registerLicenseTerms({ + terms: licenseTerms, + }); + if (request?.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const targetLogs = + this.licenseTemplateClient.parseTxLicenseTermsRegisteredEvent(txReceipt); + return { txHash: txHash, licenseTermsId: targetLogs[0].licenseTermsId }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to register non commercial social remixing PIL"); @@ -101,13 +110,22 @@ export class LicenseClient { if (licenseTermsId !== 0n) { return { licenseTermsId: licenseTermsId }; } - const txHash = await this.licenseTemplateClient.registerLicenseTerms({ terms: licenseTerms }); - if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const targetLogs = this.licenseTemplateClient.parseTxLicenseTermsRegisteredEvent(txReceipt); - return { txHash: txHash, licenseTermsId: targetLogs[0].licenseTermsId }; + if (request.txOptions?.onlyEncodeTransactions) { + return { + encodedTx: this.licenseTemplateClient.registerLicenseTermsEncode({ terms: licenseTerms }), + }; } else { - return { txHash: txHash }; + const txHash = await this.licenseTemplateClient.registerLicenseTerms({ + terms: licenseTerms, + }); + if (request.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const targetLogs = + this.licenseTemplateClient.parseTxLicenseTermsRegisteredEvent(txReceipt); + return { txHash: txHash, licenseTermsId: targetLogs[0].licenseTermsId }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to register commercial use PIL"); @@ -137,13 +155,22 @@ export class LicenseClient { if (licenseTermsId !== 0n) { return { licenseTermsId: licenseTermsId }; } - const txHash = await this.licenseTemplateClient.registerLicenseTerms({ terms: licenseTerms }); - if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const targetLogs = this.licenseTemplateClient.parseTxLicenseTermsRegisteredEvent(txReceipt); - return { txHash: txHash, licenseTermsId: targetLogs[0].licenseTermsId }; + if (request.txOptions?.onlyEncodeTransactions) { + return { + encodedTx: this.licenseTemplateClient.registerLicenseTermsEncode({ terms: licenseTerms }), + }; } else { - return { txHash: txHash }; + const txHash = await this.licenseTemplateClient.registerLicenseTerms({ + terms: licenseTerms, + }); + if (request.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const targetLogs = + this.licenseTemplateClient.parseTxLicenseTermsRegisteredEvent(txReceipt); + return { txHash: txHash, licenseTermsId: targetLogs[0].licenseTermsId }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to register commercial remix PIL"); @@ -188,16 +215,21 @@ export class LicenseClient { if (isAttachedLicenseTerms) { return { txHash: "", success: false }; } - const txHash = await this.licensingModuleClient.attachLicenseTerms({ + const req = { ipId: request.ipId, licenseTemplate: request.licenseTemplate || this.licenseTemplateClient.address, licenseTermsId: request.licenseTermsId, - }); - if (request.txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - return { txHash: txHash, success: true }; + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.licensingModuleClient.attachLicenseTermsEncode(req) }; } else { - return { txHash: txHash }; + const txHash = await this.licensingModuleClient.attachLicenseTerms(req); + if (request.txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + return { txHash: txHash, success: true }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to attach license terms"); @@ -258,7 +290,7 @@ export class LicenseClient { ); } const amount = BigInt(request.amount || 1); - const txHash = await this.licensingModuleClient.mintLicenseTokens({ + const req = { licensorIpId: request.licensorIpId, licenseTemplate: request.licenseTemplate || this.licenseTemplateClient.address, licenseTermsId: request.licenseTermsId, @@ -267,18 +299,23 @@ export class LicenseClient { (request.receiver && getAddress(request.receiver, "request.receiver")) || this.wallet.account!.address, royaltyContext: zeroAddress, - }); - if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const targetLogs = this.licensingModuleClient.parseTxLicenseTokensMintedEvent(txReceipt); - const startLicenseTokenId = targetLogs[0].startLicenseTokenId; - const licenseTokenIds = []; - for (let i = 0; i < amount; i++) { - licenseTokenIds.push(startLicenseTokenId + BigInt(i)); - } - return { txHash: txHash, licenseTokenIds: licenseTokenIds }; + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.licensingModuleClient.mintLicenseTokensEncode(req) }; } else { - return { txHash: txHash }; + const txHash = await this.licensingModuleClient.mintLicenseTokens(req); + if (request.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const targetLogs = this.licensingModuleClient.parseTxLicenseTokensMintedEvent(txReceipt); + const startLicenseTokenId = targetLogs[0].startLicenseTokenId; + const licenseTokenIds = []; + for (let i = 0; i < amount; i++) { + licenseTokenIds.push(startLicenseTokenId + BigInt(i)); + } + return { txHash: txHash, licenseTokenIds: licenseTokenIds }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to mint license tokens"); diff --git a/packages/core-sdk/src/resources/nftClient.ts b/packages/core-sdk/src/resources/nftClient.ts index 8e39e083..cd488937 100644 --- a/packages/core-sdk/src/resources/nftClient.ts +++ b/packages/core-sdk/src/resources/nftClient.ts @@ -43,7 +43,7 @@ export class NftClient { throw new Error("Invalid mint fee token address, mint fee is greater than 0."); } - const txHash = await this.spgClient.createCollection({ + const req = { name: request.name, symbol: request.symbol, maxSupply: request.maxSupply ?? Number(maxUint32), @@ -52,17 +52,23 @@ export class NftClient { owner: (request.owner && getAddress(request.owner, "request.owner")) || this.wallet.account!.address, - }); + }; - if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const targetLogs = this.spgClient.parseTxCollectionCreatedEvent(txReceipt); - return { - txHash: txHash, - nftContract: targetLogs[0].nftContract, - }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.spgClient.createCollectionEncode(req) }; + } else { + const txHash = await this.spgClient.createCollection(req); + + if (request.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const targetLogs = this.spgClient.parseTxCollectionCreatedEvent(txReceipt); + return { + txHash: txHash, + nftContract: targetLogs[0].nftContract, + }; + } + return { txHash: txHash }; } - return { txHash: txHash }; } catch (error) { handleError(error, "Failed to create a SPG NFT collection"); } diff --git a/packages/core-sdk/src/resources/permission.ts b/packages/core-sdk/src/resources/permission.ts index 011e2c62..8e0e24d0 100644 --- a/packages/core-sdk/src/resources/permission.ts +++ b/packages/core-sdk/src/resources/permission.ts @@ -65,18 +65,25 @@ export class PermissionClient { public async setPermission(request: SetPermissionsRequest): Promise { try { await this.checkIsRegistered(request.ipId); - const txHash = await this.accessControllerClient.setPermission({ + + const req = { ipAccount: request.ipId, signer: request.signer, to: request.to, func: request.func ? toFunctionSelector(request.func) : defaultFunctionSelector, permission: request.permission, - }); - if (request.txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - return { txHash: txHash, success: true }; + }; + + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.accessControllerClient.setPermissionEncode(req) }; } else { - return { txHash: txHash }; + const txHash = await this.accessControllerClient.setPermission(req); + if (request.txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + return { txHash: txHash, success: true }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to set permissions"); @@ -131,20 +138,25 @@ export class PermissionClient { chainId: chain[this.chainId], wallet: this.wallet as WalletClient, }); - const txHash = await ipAccountClient.executeWithSig({ + const req = { to: getAddress(this.accessControllerClient.address, "accessControllerClientAddress"), value: BigInt(0), data, signer: signer, deadline: calculatedDeadline, signature, - }); - - if (txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - return { txHash: txHash, success: true }; + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: ipAccountClient.executeWithSigEncode(req) }; } else { - return { txHash: txHash }; + const txHash = await ipAccountClient.executeWithSig(req); + + if (txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + return { txHash: txHash, success: true }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to create set permission signature"); @@ -165,16 +177,21 @@ export class PermissionClient { ): Promise { try { await this.checkIsRegistered(request.ipId); - const txHash = await this.accessControllerClient.setAllPermissions({ + const req = { ipAccount: request.ipId, signer: request.signer, permission: request.permission, - }); - if (request.txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - return { txHash: txHash, success: true }; + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.accessControllerClient.setAllPermissionsEncode(req) }; } else { - return { txHash: txHash }; + const txHash = await this.accessControllerClient.setAllPermissions(req); + if (request.txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + return { txHash: txHash, success: true }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to set all permissions"); @@ -202,7 +219,7 @@ export class PermissionClient { for (const permission of permissions) { await this.checkIsRegistered(permission.ipId); } - const txHash = await this.accessControllerClient.setBatchPermissions({ + const req = { permissions: permissions.map((permission) => ({ ipAccount: permission.ipId, signer: permission.signer, @@ -210,12 +227,17 @@ export class PermissionClient { func: permission.func ? toFunctionSelector(permission.func) : defaultFunctionSelector, permission: permission.permission, })), - }); - if (txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - return { txHash: txHash, success: true }; + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.accessControllerClient.setBatchPermissionsEncode(req) }; } else { - return { txHash: txHash }; + const txHash = await this.accessControllerClient.setBatchPermissions(req); + if (txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + return { txHash: txHash, success: true }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to set batch permissions"); @@ -268,24 +290,30 @@ export class PermissionClient { wallet: this.wallet as WalletClient, permissionFunc: "setBatchPermissions", }); - const txHash = await ipAccountClient.executeWithSig({ + const req = { to: getAddress(this.accessControllerClient.address, "accessControllerAddress"), value: BigInt(0), data, signer: getAddress(this.wallet.account!.address, "walletAccountAddress"), deadline: calculatedDeadline, signature, - }); - if (txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - return { txHash: txHash, success: true }; + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: ipAccountClient.executeWithSigEncode(req) }; } else { - return { txHash: txHash }; + const txHash = await ipAccountClient.executeWithSig(req); + if (txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + return { txHash: txHash, success: true }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to create batch permission signature"); } } + private async checkIsRegistered(ipId: Address): Promise { const isRegistered = await this.ipAssetRegistryClient.isRegistered({ id: getAddress(ipId, "ipId"), diff --git a/packages/core-sdk/src/resources/royalty.ts b/packages/core-sdk/src/resources/royalty.ts index 52cbb66c..4082482d 100644 --- a/packages/core-sdk/src/resources/royalty.ts +++ b/packages/core-sdk/src/resources/royalty.ts @@ -68,18 +68,23 @@ export class RoyaltyClient { this.wallet, proxyAddress, ); - const txHash = await ipRoyaltyVault.collectRoyaltyTokens({ + const req = { ancestorIpId: request.parentIpId, - }); - if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const targetLogs = ipRoyaltyVault.parseTxRoyaltyTokensCollectedEvent(txReceipt); - return { - txHash: txHash, - royaltyTokensCollected: targetLogs[0].royaltyTokensCollected, - }; + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: ipRoyaltyVault.collectRoyaltyTokensEncode(req) }; } else { - return { txHash: txHash }; + const txHash = await ipRoyaltyVault.collectRoyaltyTokens(req); + if (request.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const targetLogs = ipRoyaltyVault.parseTxRoyaltyTokensCollectedEvent(txReceipt); + return { + txHash: txHash, + royaltyTokensCollected: targetLogs[0].royaltyTokensCollected, + }; + } else { + return { txHash: txHash }; + } } } catch (error) { handleError(error, "Failed to collect royalty tokens"); @@ -112,17 +117,22 @@ export class RoyaltyClient { if (!isPayerRegistered) { throw new Error(`The payer IP with id ${request.payerIpId} is not registered.`); } - const txHash = await this.royaltyModuleClient.payRoyaltyOnBehalf({ + const req = { receiverIpId: request.receiverIpId, payerIpId: request.payerIpId, token: getAddress(request.token, "request.token"), amount: BigInt(request.amount), - }); - if (request.txOptions?.waitForTransaction) { - await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - return { txHash }; + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: this.royaltyModuleClient.payRoyaltyOnBehalfEncode(req) }; } else { - return { txHash }; + const txHash = await this.royaltyModuleClient.payRoyaltyOnBehalf(req); + if (request.txOptions?.waitForTransaction) { + await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + return { txHash }; + } else { + return { txHash }; + } } } catch (error) { handleError(error, "Failed to pay royalty on behalf"); @@ -189,21 +199,27 @@ export class RoyaltyClient { to: proxyAddress, value: 0, ipId: getAddress(request.account, "request.account"), - txOptions: { - waitForTransaction: true, - }, + txOptions: request.txOptions, data: encodeFunctionData({ abi: ipRoyaltyVaultImplAbi, functionName: "claimRevenueBySnapshotBatch", args: [request.snapshotIds, request.token], }), }); + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: iPAccountExecuteResponse.encodedTx }; + } txHash = iPAccountExecuteResponse.txHash as Hex; } else { - txHash = await ipRoyaltyVault.claimRevenueBySnapshotBatch({ + const req = { snapshotIds: request.snapshotIds, token: getAddress(request.token, "request.token"), - }); + }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: ipRoyaltyVault.claimRevenueBySnapshotBatchEncode(req) }; + } else { + txHash = await ipRoyaltyVault.claimRevenueBySnapshotBatch(req); + } } if (request.txOptions?.waitForTransaction) { const txReceipt = await this.rpcClient.waitForTransactionReceipt({ @@ -236,13 +252,17 @@ export class RoyaltyClient { this.wallet, proxyAddress, ); - const txHash = await ipRoyaltyVault.snapshot(); - if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); - const targetLogs = ipRoyaltyVault.parseTxSnapshotCompletedEvent(txReceipt); - return { txHash, snapshotId: targetLogs[0].snapshotId }; + if (request.txOptions?.onlyEncodeTransactions) { + return { encodedTx: ipRoyaltyVault.snapshotEncode() }; } else { - return { txHash }; + const txHash = await ipRoyaltyVault.snapshot(); + if (request.txOptions?.waitForTransaction) { + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const targetLogs = ipRoyaltyVault.parseTxSnapshotCompletedEvent(txReceipt); + return { txHash, snapshotId: targetLogs[0].snapshotId }; + } else { + return { txHash }; + } } } catch (error) { handleError(error, "Failed to snapshot"); diff --git a/packages/core-sdk/src/types/options.ts b/packages/core-sdk/src/types/options.ts index 6a373cc1..bffdee49 100644 --- a/packages/core-sdk/src/types/options.ts +++ b/packages/core-sdk/src/types/options.ts @@ -3,6 +3,10 @@ export type TxOptions = { // can receive a transaction receipt in return (which // contains data about the transaction and return values). waitForTransaction?: boolean; + // When the time of setting this option, the transaction will + // not submit and execute, it will only encode the abi and + // function data and return. + onlyEncodeTransactions?: boolean; // The price (in wei) to pay per gas. gasPrice?: bigint; // Total fee per gas (in wei). diff --git a/packages/core-sdk/src/types/resources/dispute.ts b/packages/core-sdk/src/types/resources/dispute.ts index c2000bc3..4758eed7 100644 --- a/packages/core-sdk/src/types/resources/dispute.ts +++ b/packages/core-sdk/src/types/resources/dispute.ts @@ -12,7 +12,8 @@ export type RaiseDisputeRequest = { }; export type RaiseDisputeResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; disputeId?: bigint; }; @@ -23,7 +24,8 @@ export type CancelDisputeRequest = { }; export type CancelDisputeResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; }; export type ResolveDisputeRequest = { @@ -33,5 +35,6 @@ export type ResolveDisputeRequest = { }; export type ResolveDisputeResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; }; diff --git a/packages/core-sdk/src/types/resources/ipAccount.ts b/packages/core-sdk/src/types/resources/ipAccount.ts index d4ac3809..922f9fa7 100644 --- a/packages/core-sdk/src/types/resources/ipAccount.ts +++ b/packages/core-sdk/src/types/resources/ipAccount.ts @@ -11,7 +11,8 @@ export type IPAccountExecuteRequest = { }; export type IPAccountExecuteResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; }; export type IPAccountExecuteWithSigRequest = { @@ -26,5 +27,6 @@ export type IPAccountExecuteWithSigRequest = { }; export type IPAccountExecuteWithSigResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; }; diff --git a/packages/core-sdk/src/types/resources/ipAsset.ts b/packages/core-sdk/src/types/resources/ipAsset.ts index 4e1a04c6..ce007cda 100644 --- a/packages/core-sdk/src/types/resources/ipAsset.ts +++ b/packages/core-sdk/src/types/resources/ipAsset.ts @@ -13,6 +13,7 @@ type Metadata = { export type RegisterIpResponse = { txHash?: string; + encodedTx?: string; ipId?: Address; }; @@ -30,7 +31,8 @@ export type RegisterDerivativeWithLicenseTokensRequest = { }; export type RegisterDerivativeWithLicenseTokensResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; }; export type RegisterDerivativeRequest = { @@ -43,6 +45,7 @@ export type RegisterDerivativeRequest = { export type RegisterDerivativeResponse = { txHash?: string; + encodedTx?: string; childIpId?: Address; }; @@ -57,7 +60,8 @@ export type CreateIpAssetWithPilTermsRequest = { } & Metadata; export type CreateIpAssetWithPilTermsResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; ipId?: Address; tokenId?: bigint; licenseTermsId?: bigint; @@ -76,7 +80,8 @@ export type RegisterIpAndMakeDerivativeRequest = { } & Metadata; export type RegisterIpAndMakeDerivativeResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; ipId?: Address; }; @@ -92,7 +97,8 @@ export type RegisterIpAndAttachPilTermsRequest = { } & Metadata; export type RegisterIpAndAttachPilTermsResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; ipId?: Address; licenseTermsId?: bigint; }; diff --git a/packages/core-sdk/src/types/resources/license.ts b/packages/core-sdk/src/types/resources/license.ts index 9d8a2f0c..6a27c40f 100644 --- a/packages/core-sdk/src/types/resources/license.ts +++ b/packages/core-sdk/src/types/resources/license.ts @@ -40,6 +40,7 @@ export type LicenseTermsIdResponse = bigint; export type RegisterPILResponse = { licenseTermsId?: bigint; txHash?: string; + encodedTx?: string; }; export type RegisterCommercialUsePILRequest = { @@ -63,7 +64,8 @@ export type AttachLicenseTermsRequest = { }; export type AttachLicenseTermsResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; success?: boolean; }; @@ -79,6 +81,7 @@ export type MintLicenseTokensRequest = { export type MintLicenseTokensResponse = { licenseTokenIds?: bigint[]; txHash?: string; + encodedTx?: string; }; export enum PIL_TYPE { diff --git a/packages/core-sdk/src/types/resources/nftClient.ts b/packages/core-sdk/src/types/resources/nftClient.ts index 3d536498..376da58b 100644 --- a/packages/core-sdk/src/types/resources/nftClient.ts +++ b/packages/core-sdk/src/types/resources/nftClient.ts @@ -12,4 +12,8 @@ export type CreateNFTCollectionRequest = { txOptions?: TxOptions; }; -export type CreateNFTCollectionResponse = { txHash: string; nftContract?: Hex }; +export type CreateNFTCollectionResponse = { + txHash?: string; + encodedTx?: string; + nftContract?: Hex; +}; diff --git a/packages/core-sdk/src/types/resources/permission.ts b/packages/core-sdk/src/types/resources/permission.ts index 6db05caf..964ca54b 100644 --- a/packages/core-sdk/src/types/resources/permission.ts +++ b/packages/core-sdk/src/types/resources/permission.ts @@ -12,7 +12,8 @@ export type SetPermissionsRequest = { }; export type SetPermissionsResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; success?: boolean; }; diff --git a/packages/core-sdk/src/types/resources/royalty.ts b/packages/core-sdk/src/types/resources/royalty.ts index fa7ce7f6..c0bb1c66 100644 --- a/packages/core-sdk/src/types/resources/royalty.ts +++ b/packages/core-sdk/src/types/resources/royalty.ts @@ -28,7 +28,8 @@ export type CollectRoyaltyTokensRequest = { }; export type CollectRoyaltyTokensResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; royaltyTokensCollected?: bigint; }; @@ -58,7 +59,8 @@ export type PayRoyaltyOnBehalfRequest = { }; export type PayRoyaltyOnBehalfResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; }; export type SnapshotRequest = { @@ -75,11 +77,13 @@ export type ClaimRevenueRequest = { }; export type ClaimRevenueResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; claimableToken?: bigint; }; export type SnapshotResponse = { - txHash: string; + txHash?: string; + encodedTx?: string; snapshotId?: bigint; }; diff --git a/packages/wagmi-generator/sdk.ts b/packages/wagmi-generator/sdk.ts index 2a85da7a..b6dcd1f0 100644 --- a/packages/wagmi-generator/sdk.ts +++ b/packages/wagmi-generator/sdk.ts @@ -239,6 +239,43 @@ function generateContractFunction(contractName: string, func: AbiFunction) { return {func: funcLine.join("\n"), types: types.join("\n")} } +function generateContractDataFunction(contractName: string, func: AbiFunction) { + const abiName = `${camelCase(contractName)}Abi` + const indexFuncName = ('index' in func) ? `${func.name}${func.index}` : func.name + const inName = `${pascalCase(contractName)}${pascalCase(indexFuncName)}Request` + const inType = generateContractTypes(inName, func.inputs) + const inParams = inType.valid ? `request: ${inName}` : `` + let method = 'readContract' + + let funcLine: Array = []; + let types: Array = []; + + if (inType.valid) types.push(`${inType.comment}\n${inType.type}`) + + addImport('viem', 'encodeFunctionData', 'Hex') + + funcLine.push(``) + funcLine.push(`/**`) + funcLine.push(` * method ${func.name} for contract ${contractName} with only encode`) + funcLine.push(` *`) + funcLine.push(` * @param request ${inName}`) + funcLine.push(` * @return Promise`) + funcLine.push(`*/`) + funcLine.push(` public ${camelCase(indexFuncName)}Encode(${inParams}): Hex {`) + funcLine.push(` return encodeFunctionData({`) + funcLine.push(` abi: ${abiName},`) + funcLine.push(` functionName: "${func.name}",`) + if (inType.valid) { + funcLine.push(` args: [`) + funcLine.push(inType.args) + funcLine.push(` ],`) + } + funcLine.push(` });`) + funcLine.push(` }`) + + return {func: funcLine.join("\n"), types: ""} +} + function generateEventFunction(contractName: any, event: AbiEvent) { const abiName = `${camelCase(contractName)}Abi` const typeName = `${pascalCase(contractName)}${pascalCase(event.name)}Event` @@ -414,6 +451,10 @@ function generateContract(config: SDKConfig, contract: Contract): string { const data = generateContractFunction(contract.name, it) file.push(data.func) types.push(data.types) + + const dataFunc = generateContractDataFunction(contract.name, it) + file.push(dataFunc.func) + types.push(dataFunc.types) }) file.push(`}`) } From 9db92e585bf08f9c28ef33bf73ebfea42947c279 Mon Sep 17 00:00:00 2001 From: lutty Date: Wed, 31 Jul 2024 10:26:30 +0800 Subject: [PATCH 2/5] opti --- packages/core-sdk/src/abi/generated.ts | 1325 ++++++++++------- .../core-sdk/src/types/resources/dispute.ts | 7 +- .../core-sdk/src/types/resources/ipAccount.ts | 5 +- .../core-sdk/src/types/resources/ipAsset.ts | 13 +- .../core-sdk/src/types/resources/license.ts | 7 +- .../core-sdk/src/types/resources/nftClient.ts | 3 +- .../src/types/resources/permission.ts | 3 +- .../core-sdk/src/types/resources/royalty.ts | 9 +- packages/wagmi-generator/sdk.ts | 25 +- 9 files changed, 820 insertions(+), 577 deletions(-) diff --git a/packages/core-sdk/src/abi/generated.ts b/packages/core-sdk/src/abi/generated.ts index d6055de8..d140de29 100644 --- a/packages/core-sdk/src/abi/generated.ts +++ b/packages/core-sdk/src/abi/generated.ts @@ -1,5 +1,6 @@ import { Address, + Hex, Abi, Account, Chain, @@ -8,7 +9,6 @@ import { WriteContractParameters, WriteContractReturnType, PublicClient, - Hex, decodeEventLog, WatchContractEventReturnType, TransactionReceipt, @@ -7410,6 +7410,8 @@ function getAddress(address: Record, chainId?: number): Address return address[chainId || 0] || "0x"; } +export type MethodEncode = { to: Address; data: Hex }; + export type SimpleWalletClient< TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, @@ -7579,14 +7581,17 @@ export class AccessControllerClient extends AccessControllerEventClient { * method setAllPermissions for contract AccessController with only encode * * @param request AccessControllerSetAllPermissionsRequest - * @return Promise + * @return MethodEncode */ - public setAllPermissionsEncode(request: AccessControllerSetAllPermissionsRequest): Hex { - return encodeFunctionData({ - abi: accessControllerAbi, - functionName: "setAllPermissions", - args: [request.ipAccount, request.signer, request.permission], - }); + public setAllPermissionsEncode(request: AccessControllerSetAllPermissionsRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: accessControllerAbi, + functionName: "setAllPermissions", + args: [request.ipAccount, request.signer, request.permission], + }), + }; } /** @@ -7612,14 +7617,19 @@ export class AccessControllerClient extends AccessControllerEventClient { * method setBatchPermissions for contract AccessController with only encode * * @param request AccessControllerSetBatchPermissionsRequest - * @return Promise + * @return MethodEncode */ - public setBatchPermissionsEncode(request: AccessControllerSetBatchPermissionsRequest): Hex { - return encodeFunctionData({ - abi: accessControllerAbi, - functionName: "setBatchPermissions", - args: [request.permissions], - }); + public setBatchPermissionsEncode( + request: AccessControllerSetBatchPermissionsRequest, + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: accessControllerAbi, + functionName: "setBatchPermissions", + args: [request.permissions], + }), + }; } /** @@ -7645,14 +7655,17 @@ export class AccessControllerClient extends AccessControllerEventClient { * method setPermission for contract AccessController with only encode * * @param request AccessControllerSetPermissionRequest - * @return Promise + * @return MethodEncode */ - public setPermissionEncode(request: AccessControllerSetPermissionRequest): Hex { - return encodeFunctionData({ - abi: accessControllerAbi, - functionName: "setPermission", - args: [request.ipAccount, request.signer, request.to, request.func, request.permission], - }); + public setPermissionEncode(request: AccessControllerSetPermissionRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: accessControllerAbi, + functionName: "setPermission", + args: [request.ipAccount, request.signer, request.to, request.func, request.permission], + }), + }; } } @@ -8024,14 +8037,17 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { * method freezeMetadata for contract CoreMetadataModule with only encode * * @param request CoreMetadataModuleFreezeMetadataRequest - * @return Promise + * @return MethodEncode */ - public freezeMetadataEncode(request: CoreMetadataModuleFreezeMetadataRequest): Hex { - return encodeFunctionData({ - abi: coreMetadataModuleAbi, - functionName: "freezeMetadata", - args: [request.ipId], - }); + public freezeMetadataEncode(request: CoreMetadataModuleFreezeMetadataRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: coreMetadataModuleAbi, + functionName: "freezeMetadata", + args: [request.ipId], + }), + }; } /** @@ -8055,14 +8071,17 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { * method setAll for contract CoreMetadataModule with only encode * * @param request CoreMetadataModuleSetAllRequest - * @return Promise + * @return MethodEncode */ - public setAllEncode(request: CoreMetadataModuleSetAllRequest): Hex { - return encodeFunctionData({ - abi: coreMetadataModuleAbi, - functionName: "setAll", - args: [request.ipId, request.metadataURI, request.metadataHash, request.nftMetadataHash], - }); + public setAllEncode(request: CoreMetadataModuleSetAllRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: coreMetadataModuleAbi, + functionName: "setAll", + args: [request.ipId, request.metadataURI, request.metadataHash, request.nftMetadataHash], + }), + }; } /** @@ -8088,14 +8107,17 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { * method setMetadataURI for contract CoreMetadataModule with only encode * * @param request CoreMetadataModuleSetMetadataUriRequest - * @return Promise + * @return MethodEncode */ - public setMetadataUriEncode(request: CoreMetadataModuleSetMetadataUriRequest): Hex { - return encodeFunctionData({ - abi: coreMetadataModuleAbi, - functionName: "setMetadataURI", - args: [request.ipId, request.metadataURI, request.metadataHash], - }); + public setMetadataUriEncode(request: CoreMetadataModuleSetMetadataUriRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: coreMetadataModuleAbi, + functionName: "setMetadataURI", + args: [request.ipId, request.metadataURI, request.metadataHash], + }), + }; } /** @@ -8121,14 +8143,19 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { * method updateNftTokenURI for contract CoreMetadataModule with only encode * * @param request CoreMetadataModuleUpdateNftTokenUriRequest - * @return Promise + * @return MethodEncode */ - public updateNftTokenUriEncode(request: CoreMetadataModuleUpdateNftTokenUriRequest): Hex { - return encodeFunctionData({ - abi: coreMetadataModuleAbi, - functionName: "updateNftTokenURI", - args: [request.ipId, request.nftMetadataHash], - }); + public updateNftTokenUriEncode( + request: CoreMetadataModuleUpdateNftTokenUriRequest, + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: coreMetadataModuleAbi, + functionName: "updateNftTokenURI", + args: [request.ipId, request.nftMetadataHash], + }), + }; } } @@ -8382,14 +8409,17 @@ export class DisputeModuleClient extends DisputeModuleEventClient { * method cancelDispute for contract DisputeModule with only encode * * @param request DisputeModuleCancelDisputeRequest - * @return Promise + * @return MethodEncode */ - public cancelDisputeEncode(request: DisputeModuleCancelDisputeRequest): Hex { - return encodeFunctionData({ - abi: disputeModuleAbi, - functionName: "cancelDispute", - args: [request.disputeId, request.data], - }); + public cancelDisputeEncode(request: DisputeModuleCancelDisputeRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: disputeModuleAbi, + functionName: "cancelDispute", + args: [request.disputeId, request.data], + }), + }; } /** @@ -8415,14 +8445,17 @@ export class DisputeModuleClient extends DisputeModuleEventClient { * method raiseDispute for contract DisputeModule with only encode * * @param request DisputeModuleRaiseDisputeRequest - * @return Promise + * @return MethodEncode */ - public raiseDisputeEncode(request: DisputeModuleRaiseDisputeRequest): Hex { - return encodeFunctionData({ - abi: disputeModuleAbi, - functionName: "raiseDispute", - args: [request.targetIpId, request.linkToDisputeEvidence, request.targetTag, request.data], - }); + public raiseDisputeEncode(request: DisputeModuleRaiseDisputeRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: disputeModuleAbi, + functionName: "raiseDispute", + args: [request.targetIpId, request.linkToDisputeEvidence, request.targetTag, request.data], + }), + }; } /** @@ -8448,14 +8481,17 @@ export class DisputeModuleClient extends DisputeModuleEventClient { * method resolveDispute for contract DisputeModule with only encode * * @param request DisputeModuleResolveDisputeRequest - * @return Promise + * @return MethodEncode */ - public resolveDisputeEncode(request: DisputeModuleResolveDisputeRequest): Hex { - return encodeFunctionData({ - abi: disputeModuleAbi, - functionName: "resolveDispute", - args: [request.disputeId, request.data], - }); + public resolveDisputeEncode(request: DisputeModuleResolveDisputeRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: disputeModuleAbi, + functionName: "resolveDispute", + args: [request.disputeId, request.data], + }), + }; } } @@ -8554,14 +8590,17 @@ export class IpAccountImplClient extends IpAccountImplReadOnlyClient { * method execute for contract IPAccountImpl with only encode * * @param request IpAccountImplExecuteRequest - * @return Promise + * @return MethodEncode */ - public executeEncode(request: IpAccountImplExecuteRequest): Hex { - return encodeFunctionData({ - abi: ipAccountImplAbi, - functionName: "execute", - args: [request.to, request.value, request.data], - }); + public executeEncode(request: IpAccountImplExecuteRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: ipAccountImplAbi, + functionName: "execute", + args: [request.to, request.value, request.data], + }), + }; } /** @@ -8594,21 +8633,24 @@ export class IpAccountImplClient extends IpAccountImplReadOnlyClient { * method executeWithSig for contract IPAccountImpl with only encode * * @param request IpAccountImplExecuteWithSigRequest - * @return Promise + * @return MethodEncode */ - public executeWithSigEncode(request: IpAccountImplExecuteWithSigRequest): Hex { - return encodeFunctionData({ - abi: ipAccountImplAbi, - functionName: "executeWithSig", - args: [ - request.to, - request.value, - request.data, - request.signer, - request.deadline, - request.signature, - ], - }); + public executeWithSigEncode(request: IpAccountImplExecuteWithSigRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: ipAccountImplAbi, + functionName: "executeWithSig", + args: [ + request.to, + request.value, + request.data, + request.signer, + request.deadline, + request.signature, + ], + }), + }; } } @@ -8859,14 +8901,17 @@ export class IpAssetRegistryClient extends IpAssetRegistryReadOnlyClient { * method register for contract IPAssetRegistry with only encode * * @param request IpAssetRegistryRegisterRequest - * @return Promise + * @return MethodEncode */ - public registerEncode(request: IpAssetRegistryRegisterRequest): Hex { - return encodeFunctionData({ - abi: ipAssetRegistryAbi, - functionName: "register", - args: [request.chainid, request.tokenContract, request.tokenId], - }); + public registerEncode(request: IpAssetRegistryRegisterRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: ipAssetRegistryAbi, + functionName: "register", + args: [request.chainid, request.tokenContract, request.tokenId], + }), + }; } } @@ -9167,16 +9212,19 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { * method claimRevenueBySnapshotBatch for contract IpRoyaltyVaultImpl with only encode * * @param request IpRoyaltyVaultImplClaimRevenueBySnapshotBatchRequest - * @return Promise + * @return MethodEncode */ public claimRevenueBySnapshotBatchEncode( request: IpRoyaltyVaultImplClaimRevenueBySnapshotBatchRequest, - ): Hex { - return encodeFunctionData({ - abi: ipRoyaltyVaultImplAbi, - functionName: "claimRevenueBySnapshotBatch", - args: [request.snapshotIds, request.token], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: ipRoyaltyVaultImplAbi, + functionName: "claimRevenueBySnapshotBatch", + args: [request.snapshotIds, request.token], + }), + }; } /** @@ -9202,16 +9250,19 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { * method claimRevenueByTokenBatch for contract IpRoyaltyVaultImpl with only encode * * @param request IpRoyaltyVaultImplClaimRevenueByTokenBatchRequest - * @return Promise + * @return MethodEncode */ public claimRevenueByTokenBatchEncode( request: IpRoyaltyVaultImplClaimRevenueByTokenBatchRequest, - ): Hex { - return encodeFunctionData({ - abi: ipRoyaltyVaultImplAbi, - functionName: "claimRevenueByTokenBatch", - args: [request.snapshotId, request.tokenList], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: ipRoyaltyVaultImplAbi, + functionName: "claimRevenueByTokenBatch", + args: [request.snapshotId, request.tokenList], + }), + }; } /** @@ -9237,14 +9288,19 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { * method collectRoyaltyTokens for contract IpRoyaltyVaultImpl with only encode * * @param request IpRoyaltyVaultImplCollectRoyaltyTokensRequest - * @return Promise + * @return MethodEncode */ - public collectRoyaltyTokensEncode(request: IpRoyaltyVaultImplCollectRoyaltyTokensRequest): Hex { - return encodeFunctionData({ - abi: ipRoyaltyVaultImplAbi, - functionName: "collectRoyaltyTokens", - args: [request.ancestorIpId], - }); + public collectRoyaltyTokensEncode( + request: IpRoyaltyVaultImplCollectRoyaltyTokensRequest, + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: ipRoyaltyVaultImplAbi, + functionName: "collectRoyaltyTokens", + args: [request.ancestorIpId], + }), + }; } /** @@ -9267,13 +9323,16 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { * method snapshot for contract IpRoyaltyVaultImpl with only encode * * @param request IpRoyaltyVaultImplSnapshotRequest - * @return Promise + * @return MethodEncode */ - public snapshotEncode(): Hex { - return encodeFunctionData({ - abi: ipRoyaltyVaultImplAbi, - functionName: "snapshot", - }); + public snapshotEncode(): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: ipRoyaltyVaultImplAbi, + functionName: "snapshot", + }), + }; } } @@ -10481,14 +10540,19 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method attachLicenseTermsToIp for contract LicenseRegistry with only encode * * @param request LicenseRegistryAttachLicenseTermsToIpRequest - * @return Promise + * @return MethodEncode */ - public attachLicenseTermsToIpEncode(request: LicenseRegistryAttachLicenseTermsToIpRequest): Hex { - return encodeFunctionData({ - abi: licenseRegistryAbi, - functionName: "attachLicenseTermsToIp", - args: [request.ipId, request.licenseTemplate, request.licenseTermsId], - }); + public attachLicenseTermsToIpEncode( + request: LicenseRegistryAttachLicenseTermsToIpRequest, + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "attachLicenseTermsToIp", + args: [request.ipId, request.licenseTemplate, request.licenseTermsId], + }), + }; } /** @@ -10514,14 +10578,17 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method initialize for contract LicenseRegistry with only encode * * @param request LicenseRegistryInitializeRequest - * @return Promise + * @return MethodEncode */ - public initializeEncode(request: LicenseRegistryInitializeRequest): Hex { - return encodeFunctionData({ - abi: licenseRegistryAbi, - functionName: "initialize", - args: [request.accessManager], - }); + public initializeEncode(request: LicenseRegistryInitializeRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "initialize", + args: [request.accessManager], + }), + }; } /** @@ -10552,19 +10619,24 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method registerDerivativeIp for contract LicenseRegistry with only encode * * @param request LicenseRegistryRegisterDerivativeIpRequest - * @return Promise + * @return MethodEncode */ - public registerDerivativeIpEncode(request: LicenseRegistryRegisterDerivativeIpRequest): Hex { - return encodeFunctionData({ - abi: licenseRegistryAbi, - functionName: "registerDerivativeIp", - args: [ - request.childIpId, - request.parentIpIds, - request.licenseTemplate, - request.licenseTermsIds, - ], - }); + public registerDerivativeIpEncode( + request: LicenseRegistryRegisterDerivativeIpRequest, + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "registerDerivativeIp", + args: [ + request.childIpId, + request.parentIpIds, + request.licenseTemplate, + request.licenseTermsIds, + ], + }), + }; } /** @@ -10590,16 +10662,19 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method registerLicenseTemplate for contract LicenseRegistry with only encode * * @param request LicenseRegistryRegisterLicenseTemplateRequest - * @return Promise + * @return MethodEncode */ public registerLicenseTemplateEncode( request: LicenseRegistryRegisterLicenseTemplateRequest, - ): Hex { - return encodeFunctionData({ - abi: licenseRegistryAbi, - functionName: "registerLicenseTemplate", - args: [request.licenseTemplate], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "registerLicenseTemplate", + args: [request.licenseTemplate], + }), + }; } /** @@ -10625,14 +10700,17 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method setAuthority for contract LicenseRegistry with only encode * * @param request LicenseRegistrySetAuthorityRequest - * @return Promise + * @return MethodEncode */ - public setAuthorityEncode(request: LicenseRegistrySetAuthorityRequest): Hex { - return encodeFunctionData({ - abi: licenseRegistryAbi, - functionName: "setAuthority", - args: [request.newAuthority], - }); + public setAuthorityEncode(request: LicenseRegistrySetAuthorityRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "setAuthority", + args: [request.newAuthority], + }), + }; } /** @@ -10658,14 +10736,19 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method setDefaultLicenseTerms for contract LicenseRegistry with only encode * * @param request LicenseRegistrySetDefaultLicenseTermsRequest - * @return Promise + * @return MethodEncode */ - public setDefaultLicenseTermsEncode(request: LicenseRegistrySetDefaultLicenseTermsRequest): Hex { - return encodeFunctionData({ - abi: licenseRegistryAbi, - functionName: "setDefaultLicenseTerms", - args: [request.newLicenseTemplate, request.newLicenseTermsId], - }); + public setDefaultLicenseTermsEncode( + request: LicenseRegistrySetDefaultLicenseTermsRequest, + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "setDefaultLicenseTerms", + args: [request.newLicenseTemplate, request.newLicenseTermsId], + }), + }; } /** @@ -10691,14 +10774,17 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method setExpireTime for contract LicenseRegistry with only encode * * @param request LicenseRegistrySetExpireTimeRequest - * @return Promise + * @return MethodEncode */ - public setExpireTimeEncode(request: LicenseRegistrySetExpireTimeRequest): Hex { - return encodeFunctionData({ - abi: licenseRegistryAbi, - functionName: "setExpireTime", - args: [request.ipId, request.expireTime], - }); + public setExpireTimeEncode(request: LicenseRegistrySetExpireTimeRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "setExpireTime", + args: [request.ipId, request.expireTime], + }), + }; } /** @@ -10724,16 +10810,19 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method setLicensingConfigForIp for contract LicenseRegistry with only encode * * @param request LicenseRegistrySetLicensingConfigForIpRequest - * @return Promise + * @return MethodEncode */ public setLicensingConfigForIpEncode( request: LicenseRegistrySetLicensingConfigForIpRequest, - ): Hex { - return encodeFunctionData({ - abi: licenseRegistryAbi, - functionName: "setLicensingConfigForIp", - args: [request.ipId, request.licensingConfig], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "setLicensingConfigForIp", + args: [request.ipId, request.licensingConfig], + }), + }; } /** @@ -10764,21 +10853,24 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method setLicensingConfigForLicense for contract LicenseRegistry with only encode * * @param request LicenseRegistrySetLicensingConfigForLicenseRequest - * @return Promise + * @return MethodEncode */ public setLicensingConfigForLicenseEncode( request: LicenseRegistrySetLicensingConfigForLicenseRequest, - ): Hex { - return encodeFunctionData({ - abi: licenseRegistryAbi, - functionName: "setLicensingConfigForLicense", - args: [ - request.ipId, - request.licenseTemplate, - request.licenseTermsId, - request.licensingConfig, - ], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "setLicensingConfigForLicense", + args: [ + request.ipId, + request.licenseTemplate, + request.licenseTermsId, + request.licensingConfig, + ], + }), + }; } /** @@ -10804,14 +10896,17 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method upgradeToAndCall for contract LicenseRegistry with only encode * * @param request LicenseRegistryUpgradeToAndCallRequest - * @return Promise + * @return MethodEncode */ - public upgradeToAndCallEncode(request: LicenseRegistryUpgradeToAndCallRequest): Hex { - return encodeFunctionData({ - abi: licenseRegistryAbi, - functionName: "upgradeToAndCall", - args: [request.newImplementation, request.data], - }); + public upgradeToAndCallEncode(request: LicenseRegistryUpgradeToAndCallRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licenseRegistryAbi, + functionName: "upgradeToAndCall", + args: [request.newImplementation, request.data], + }), + }; } } @@ -11085,14 +11180,17 @@ export class LicensingModuleClient extends LicensingModuleEventClient { * method attachLicenseTerms for contract LicensingModule with only encode * * @param request LicensingModuleAttachLicenseTermsRequest - * @return Promise + * @return MethodEncode */ - public attachLicenseTermsEncode(request: LicensingModuleAttachLicenseTermsRequest): Hex { - return encodeFunctionData({ - abi: licensingModuleAbi, - functionName: "attachLicenseTerms", - args: [request.ipId, request.licenseTemplate, request.licenseTermsId], - }); + public attachLicenseTermsEncode(request: LicensingModuleAttachLicenseTermsRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licensingModuleAbi, + functionName: "attachLicenseTerms", + args: [request.ipId, request.licenseTemplate, request.licenseTermsId], + }), + }; } /** @@ -11125,21 +11223,24 @@ export class LicensingModuleClient extends LicensingModuleEventClient { * method mintLicenseTokens for contract LicensingModule with only encode * * @param request LicensingModuleMintLicenseTokensRequest - * @return Promise + * @return MethodEncode */ - public mintLicenseTokensEncode(request: LicensingModuleMintLicenseTokensRequest): Hex { - return encodeFunctionData({ - abi: licensingModuleAbi, - functionName: "mintLicenseTokens", - args: [ - request.licensorIpId, - request.licenseTemplate, - request.licenseTermsId, - request.amount, - request.receiver, - request.royaltyContext, - ], - }); + public mintLicenseTokensEncode(request: LicensingModuleMintLicenseTokensRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licensingModuleAbi, + functionName: "mintLicenseTokens", + args: [ + request.licensorIpId, + request.licenseTemplate, + request.licenseTermsId, + request.amount, + request.receiver, + request.royaltyContext, + ], + }), + }; } /** @@ -11171,20 +11272,23 @@ export class LicensingModuleClient extends LicensingModuleEventClient { * method registerDerivative for contract LicensingModule with only encode * * @param request LicensingModuleRegisterDerivativeRequest - * @return Promise + * @return MethodEncode */ - public registerDerivativeEncode(request: LicensingModuleRegisterDerivativeRequest): Hex { - return encodeFunctionData({ - abi: licensingModuleAbi, - functionName: "registerDerivative", - args: [ - request.childIpId, - request.parentIpIds, - request.licenseTermsIds, - request.licenseTemplate, - request.royaltyContext, - ], - }); + public registerDerivativeEncode(request: LicensingModuleRegisterDerivativeRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licensingModuleAbi, + functionName: "registerDerivative", + args: [ + request.childIpId, + request.parentIpIds, + request.licenseTermsIds, + request.licenseTemplate, + request.royaltyContext, + ], + }), + }; } /** @@ -11210,16 +11314,19 @@ export class LicensingModuleClient extends LicensingModuleEventClient { * method registerDerivativeWithLicenseTokens for contract LicensingModule with only encode * * @param request LicensingModuleRegisterDerivativeWithLicenseTokensRequest - * @return Promise + * @return MethodEncode */ public registerDerivativeWithLicenseTokensEncode( request: LicensingModuleRegisterDerivativeWithLicenseTokensRequest, - ): Hex { - return encodeFunctionData({ - abi: licensingModuleAbi, - functionName: "registerDerivativeWithLicenseTokens", - args: [request.childIpId, request.licenseTokenIds, request.royaltyContext], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: licensingModuleAbi, + functionName: "registerDerivativeWithLicenseTokens", + args: [request.childIpId, request.licenseTokenIds, request.royaltyContext], + }), + }; } } @@ -12299,14 +12406,17 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method initialize for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateInitializeRequest - * @return Promise + * @return MethodEncode */ - public initializeEncode(request: PiLicenseTemplateInitializeRequest): Hex { - return encodeFunctionData({ - abi: piLicenseTemplateAbi, - functionName: "initialize", - args: [request.accessManager, request.name, request.metadataURI], - }); + public initializeEncode(request: PiLicenseTemplateInitializeRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "initialize", + args: [request.accessManager, request.name, request.metadataURI], + }), + }; } /** @@ -12332,14 +12442,19 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method registerLicenseTerms for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateRegisterLicenseTermsRequest - * @return Promise + * @return MethodEncode */ - public registerLicenseTermsEncode(request: PiLicenseTemplateRegisterLicenseTermsRequest): Hex { - return encodeFunctionData({ - abi: piLicenseTemplateAbi, - functionName: "registerLicenseTerms", - args: [request.terms], - }); + public registerLicenseTermsEncode( + request: PiLicenseTemplateRegisterLicenseTermsRequest, + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "registerLicenseTerms", + args: [request.terms], + }), + }; } /** @@ -12365,14 +12480,17 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method setApproval for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateSetApprovalRequest - * @return Promise + * @return MethodEncode */ - public setApprovalEncode(request: PiLicenseTemplateSetApprovalRequest): Hex { - return encodeFunctionData({ - abi: piLicenseTemplateAbi, - functionName: "setApproval", - args: [request.parentIpId, request.licenseTermsId, request.childIpId, request.approved], - }); + public setApprovalEncode(request: PiLicenseTemplateSetApprovalRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "setApproval", + args: [request.parentIpId, request.licenseTermsId, request.childIpId, request.approved], + }), + }; } /** @@ -12398,14 +12516,17 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method setAuthority for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateSetAuthorityRequest - * @return Promise + * @return MethodEncode */ - public setAuthorityEncode(request: PiLicenseTemplateSetAuthorityRequest): Hex { - return encodeFunctionData({ - abi: piLicenseTemplateAbi, - functionName: "setAuthority", - args: [request.newAuthority], - }); + public setAuthorityEncode(request: PiLicenseTemplateSetAuthorityRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "setAuthority", + args: [request.newAuthority], + }), + }; } /** @@ -12431,14 +12552,17 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method upgradeToAndCall for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateUpgradeToAndCallRequest - * @return Promise + * @return MethodEncode */ - public upgradeToAndCallEncode(request: PiLicenseTemplateUpgradeToAndCallRequest): Hex { - return encodeFunctionData({ - abi: piLicenseTemplateAbi, - functionName: "upgradeToAndCall", - args: [request.newImplementation, request.data], - }); + public upgradeToAndCallEncode(request: PiLicenseTemplateUpgradeToAndCallRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "upgradeToAndCall", + args: [request.newImplementation, request.data], + }), + }; } /** @@ -12464,16 +12588,19 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method verifyMintLicenseToken for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateVerifyMintLicenseTokenRequest - * @return Promise + * @return MethodEncode */ public verifyMintLicenseTokenEncode( request: PiLicenseTemplateVerifyMintLicenseTokenRequest, - ): Hex { - return encodeFunctionData({ - abi: piLicenseTemplateAbi, - functionName: "verifyMintLicenseToken", - args: [request[0], request[1], request[2], request[3]], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "verifyMintLicenseToken", + args: [request[0], request[1], request[2], request[3]], + }), + }; } /** @@ -12499,16 +12626,19 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method verifyRegisterDerivative for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateVerifyRegisterDerivativeRequest - * @return Promise + * @return MethodEncode */ public verifyRegisterDerivativeEncode( request: PiLicenseTemplateVerifyRegisterDerivativeRequest, - ): Hex { - return encodeFunctionData({ - abi: piLicenseTemplateAbi, - functionName: "verifyRegisterDerivative", - args: [request.childIpId, request.parentIpId, request.licenseTermsId, request.licensee], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "verifyRegisterDerivative", + args: [request.childIpId, request.parentIpId, request.licenseTermsId, request.licensee], + }), + }; } /** @@ -12534,16 +12664,24 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method verifyRegisterDerivativeForAllParents for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateVerifyRegisterDerivativeForAllParentsRequest - * @return Promise + * @return MethodEncode */ public verifyRegisterDerivativeForAllParentsEncode( request: PiLicenseTemplateVerifyRegisterDerivativeForAllParentsRequest, - ): Hex { - return encodeFunctionData({ - abi: piLicenseTemplateAbi, - functionName: "verifyRegisterDerivativeForAllParents", - args: [request.childIpId, request.parentIpIds, request.licenseTermsIds, request.childIpOwner], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: piLicenseTemplateAbi, + functionName: "verifyRegisterDerivativeForAllParents", + args: [ + request.childIpId, + request.parentIpIds, + request.licenseTermsIds, + request.childIpOwner, + ], + }), + }; } } @@ -12601,14 +12739,17 @@ export class RoyaltyModuleClient { * method payRoyaltyOnBehalf for contract RoyaltyModule with only encode * * @param request RoyaltyModulePayRoyaltyOnBehalfRequest - * @return Promise + * @return MethodEncode */ - public payRoyaltyOnBehalfEncode(request: RoyaltyModulePayRoyaltyOnBehalfRequest): Hex { - return encodeFunctionData({ - abi: royaltyModuleAbi, - functionName: "payRoyaltyOnBehalf", - args: [request.receiverIpId, request.payerIpId, request.token, request.amount], - }); + public payRoyaltyOnBehalfEncode(request: RoyaltyModulePayRoyaltyOnBehalfRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: royaltyModuleAbi, + functionName: "payRoyaltyOnBehalf", + args: [request.receiverIpId, request.payerIpId, request.token, request.amount], + }), + }; } } @@ -12719,14 +12860,17 @@ export class RoyaltyPolicyLapClient extends RoyaltyPolicyLapReadOnlyClient { * method onRoyaltyPayment for contract RoyaltyPolicyLAP with only encode * * @param request RoyaltyPolicyLapOnRoyaltyPaymentRequest - * @return Promise + * @return MethodEncode */ - public onRoyaltyPaymentEncode(request: RoyaltyPolicyLapOnRoyaltyPaymentRequest): Hex { - return encodeFunctionData({ - abi: royaltyPolicyLapAbi, - functionName: "onRoyaltyPayment", - args: [request.caller, request.ipId, request.token, request.amount], - }); + public onRoyaltyPaymentEncode(request: RoyaltyPolicyLapOnRoyaltyPaymentRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: royaltyPolicyLapAbi, + functionName: "onRoyaltyPayment", + args: [request.caller, request.ipId, request.token, request.amount], + }), + }; } } @@ -13124,21 +13268,24 @@ export class SpgClient extends SpgEventClient { * method createCollection for contract SPG with only encode * * @param request SpgCreateCollectionRequest - * @return Promise + * @return MethodEncode */ - public createCollectionEncode(request: SpgCreateCollectionRequest): Hex { - return encodeFunctionData({ - abi: spgAbi, - functionName: "createCollection", - args: [ - request.name, - request.symbol, - request.maxSupply, - request.mintFee, - request.mintFeeToken, - request.owner, - ], - }); + public createCollectionEncode(request: SpgCreateCollectionRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgAbi, + functionName: "createCollection", + args: [ + request.name, + request.symbol, + request.maxSupply, + request.mintFee, + request.mintFeeToken, + request.owner, + ], + }), + }; } /** @@ -13164,14 +13311,17 @@ export class SpgClient extends SpgEventClient { * method mintAndRegisterIp for contract SPG with only encode * * @param request SpgMintAndRegisterIpRequest - * @return Promise + * @return MethodEncode */ - public mintAndRegisterIpEncode(request: SpgMintAndRegisterIpRequest): Hex { - return encodeFunctionData({ - abi: spgAbi, - functionName: "mintAndRegisterIp", - args: [request.nftContract, request.recipient, request.metadata], - }); + public mintAndRegisterIpEncode(request: SpgMintAndRegisterIpRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgAbi, + functionName: "mintAndRegisterIp", + args: [request.nftContract, request.recipient, request.metadata], + }), + }; } /** @@ -13197,16 +13347,19 @@ export class SpgClient extends SpgEventClient { * method mintAndRegisterIpAndAttachPILTerms for contract SPG with only encode * * @param request SpgMintAndRegisterIpAndAttachPilTermsRequest - * @return Promise + * @return MethodEncode */ public mintAndRegisterIpAndAttachPilTermsEncode( request: SpgMintAndRegisterIpAndAttachPilTermsRequest, - ): Hex { - return encodeFunctionData({ - abi: spgAbi, - functionName: "mintAndRegisterIpAndAttachPILTerms", - args: [request.nftContract, request.recipient, request.metadata, request.terms], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgAbi, + functionName: "mintAndRegisterIpAndAttachPILTerms", + args: [request.nftContract, request.recipient, request.metadata, request.terms], + }), + }; } /** @@ -13232,16 +13385,19 @@ export class SpgClient extends SpgEventClient { * method mintAndRegisterIpAndMakeDerivative for contract SPG with only encode * * @param request SpgMintAndRegisterIpAndMakeDerivativeRequest - * @return Promise + * @return MethodEncode */ public mintAndRegisterIpAndMakeDerivativeEncode( request: SpgMintAndRegisterIpAndMakeDerivativeRequest, - ): Hex { - return encodeFunctionData({ - abi: spgAbi, - functionName: "mintAndRegisterIpAndMakeDerivative", - args: [request.nftContract, request.derivData, request.metadata, request.recipient], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgAbi, + functionName: "mintAndRegisterIpAndMakeDerivative", + args: [request.nftContract, request.derivData, request.metadata, request.recipient], + }), + }; } /** @@ -13273,22 +13429,25 @@ export class SpgClient extends SpgEventClient { * method mintAndRegisterIpAndMakeDerivativeWithLicenseTokens for contract SPG with only encode * * @param request SpgMintAndRegisterIpAndMakeDerivativeWithLicenseTokensRequest - * @return Promise + * @return MethodEncode */ public mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode( request: SpgMintAndRegisterIpAndMakeDerivativeWithLicenseTokensRequest, - ): Hex { - return encodeFunctionData({ - abi: spgAbi, - functionName: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens", - args: [ - request.nftContract, - request.licenseTokenIds, - request.royaltyContext, - request.metadata, - request.recipient, - ], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgAbi, + functionName: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens", + args: [ + request.nftContract, + request.licenseTokenIds, + request.royaltyContext, + request.metadata, + request.recipient, + ], + }), + }; } /** @@ -13312,14 +13471,17 @@ export class SpgClient extends SpgEventClient { * method registerIp for contract SPG with only encode * * @param request SpgRegisterIpRequest - * @return Promise + * @return MethodEncode */ - public registerIpEncode(request: SpgRegisterIpRequest): Hex { - return encodeFunctionData({ - abi: spgAbi, - functionName: "registerIp", - args: [request.nftContract, request.tokenId, request.metadata, request.sigMetadata], - }); + public registerIpEncode(request: SpgRegisterIpRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgAbi, + functionName: "registerIp", + args: [request.nftContract, request.tokenId, request.metadata, request.sigMetadata], + }), + }; } /** @@ -13352,21 +13514,26 @@ export class SpgClient extends SpgEventClient { * method registerIpAndAttachPILTerms for contract SPG with only encode * * @param request SpgRegisterIpAndAttachPilTermsRequest - * @return Promise + * @return MethodEncode */ - public registerIpAndAttachPilTermsEncode(request: SpgRegisterIpAndAttachPilTermsRequest): Hex { - return encodeFunctionData({ - abi: spgAbi, - functionName: "registerIpAndAttachPILTerms", - args: [ - request.nftContract, - request.tokenId, - request.metadata, - request.terms, - request.sigMetadata, - request.sigAttach, - ], - }); + public registerIpAndAttachPilTermsEncode( + request: SpgRegisterIpAndAttachPilTermsRequest, + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgAbi, + functionName: "registerIpAndAttachPILTerms", + args: [ + request.nftContract, + request.tokenId, + request.metadata, + request.terms, + request.sigMetadata, + request.sigAttach, + ], + }), + }; } /** @@ -13399,21 +13566,26 @@ export class SpgClient extends SpgEventClient { * method registerIpAndMakeDerivative for contract SPG with only encode * * @param request SpgRegisterIpAndMakeDerivativeRequest - * @return Promise + * @return MethodEncode */ - public registerIpAndMakeDerivativeEncode(request: SpgRegisterIpAndMakeDerivativeRequest): Hex { - return encodeFunctionData({ - abi: spgAbi, - functionName: "registerIpAndMakeDerivative", - args: [ - request.nftContract, - request.tokenId, - request.derivData, - request.metadata, - request.sigMetadata, - request.sigRegister, - ], - }); + public registerIpAndMakeDerivativeEncode( + request: SpgRegisterIpAndMakeDerivativeRequest, + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgAbi, + functionName: "registerIpAndMakeDerivative", + args: [ + request.nftContract, + request.tokenId, + request.derivData, + request.metadata, + request.sigMetadata, + request.sigRegister, + ], + }), + }; } /** @@ -13447,24 +13619,27 @@ export class SpgClient extends SpgEventClient { * method registerIpAndMakeDerivativeWithLicenseTokens for contract SPG with only encode * * @param request SpgRegisterIpAndMakeDerivativeWithLicenseTokensRequest - * @return Promise + * @return MethodEncode */ public registerIpAndMakeDerivativeWithLicenseTokensEncode( request: SpgRegisterIpAndMakeDerivativeWithLicenseTokensRequest, - ): Hex { - return encodeFunctionData({ - abi: spgAbi, - functionName: "registerIpAndMakeDerivativeWithLicenseTokens", - args: [ - request.nftContract, - request.tokenId, - request.licenseTokenIds, - request.royaltyContext, - request.metadata, - request.sigMetadata, - request.sigRegister, - ], - }); + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgAbi, + functionName: "registerIpAndMakeDerivativeWithLicenseTokens", + args: [ + request.nftContract, + request.tokenId, + request.licenseTokenIds, + request.royaltyContext, + request.metadata, + request.sigMetadata, + request.sigRegister, + ], + }), + }; } /** @@ -13490,14 +13665,19 @@ export class SpgClient extends SpgEventClient { * method registerPILTermsAndAttach for contract SPG with only encode * * @param request SpgRegisterPilTermsAndAttachRequest - * @return Promise + * @return MethodEncode */ - public registerPilTermsAndAttachEncode(request: SpgRegisterPilTermsAndAttachRequest): Hex { - return encodeFunctionData({ - abi: spgAbi, - functionName: "registerPILTermsAndAttach", - args: [request.ipId, request.terms], - }); + public registerPilTermsAndAttachEncode( + request: SpgRegisterPilTermsAndAttachRequest, + ): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgAbi, + functionName: "registerPILTermsAndAttach", + args: [request.ipId, request.terms], + }), + }; } } @@ -13706,13 +13886,16 @@ export class SpgnftBeaconClient extends SpgnftBeaconReadOnlyClient { * method renounceOwnership for contract SPGNFTBeacon with only encode * * @param request SpgnftBeaconRenounceOwnershipRequest - * @return Promise + * @return MethodEncode */ - public renounceOwnershipEncode(): Hex { - return encodeFunctionData({ - abi: spgnftBeaconAbi, - functionName: "renounceOwnership", - }); + public renounceOwnershipEncode(): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftBeaconAbi, + functionName: "renounceOwnership", + }), + }; } /** @@ -13738,14 +13921,17 @@ export class SpgnftBeaconClient extends SpgnftBeaconReadOnlyClient { * method transferOwnership for contract SPGNFTBeacon with only encode * * @param request SpgnftBeaconTransferOwnershipRequest - * @return Promise + * @return MethodEncode */ - public transferOwnershipEncode(request: SpgnftBeaconTransferOwnershipRequest): Hex { - return encodeFunctionData({ - abi: spgnftBeaconAbi, - functionName: "transferOwnership", - args: [request.newOwner], - }); + public transferOwnershipEncode(request: SpgnftBeaconTransferOwnershipRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftBeaconAbi, + functionName: "transferOwnership", + args: [request.newOwner], + }), + }; } /** @@ -13769,14 +13955,17 @@ export class SpgnftBeaconClient extends SpgnftBeaconReadOnlyClient { * method upgradeTo for contract SPGNFTBeacon with only encode * * @param request SpgnftBeaconUpgradeToRequest - * @return Promise + * @return MethodEncode */ - public upgradeToEncode(request: SpgnftBeaconUpgradeToRequest): Hex { - return encodeFunctionData({ - abi: spgnftBeaconAbi, - functionName: "upgradeTo", - args: [request.newImplementation], - }); + public upgradeToEncode(request: SpgnftBeaconUpgradeToRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftBeaconAbi, + functionName: "upgradeTo", + args: [request.newImplementation], + }), + }; } } @@ -14698,14 +14887,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method approve for contract SPGNFTImpl with only encode * * @param request SpgnftImplApproveRequest - * @return Promise + * @return MethodEncode */ - public approveEncode(request: SpgnftImplApproveRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "approve", - args: [request.to, request.tokenId], - }); + public approveEncode(request: SpgnftImplApproveRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "approve", + args: [request.to, request.tokenId], + }), + }; } /** @@ -14729,14 +14921,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method grantRole for contract SPGNFTImpl with only encode * * @param request SpgnftImplGrantRoleRequest - * @return Promise + * @return MethodEncode */ - public grantRoleEncode(request: SpgnftImplGrantRoleRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "grantRole", - args: [request.role, request.account], - }); + public grantRoleEncode(request: SpgnftImplGrantRoleRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "grantRole", + args: [request.role, request.account], + }), + }; } /** @@ -14767,21 +14962,24 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method initialize for contract SPGNFTImpl with only encode * * @param request SpgnftImplInitializeRequest - * @return Promise + * @return MethodEncode */ - public initializeEncode(request: SpgnftImplInitializeRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "initialize", - args: [ - request.name, - request.symbol, - request.maxSupply, - request.mintCost, - request.mintToken, - request.owner, - ], - }); + public initializeEncode(request: SpgnftImplInitializeRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "initialize", + args: [ + request.name, + request.symbol, + request.maxSupply, + request.mintCost, + request.mintToken, + request.owner, + ], + }), + }; } /** @@ -14805,14 +15003,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method mint for contract SPGNFTImpl with only encode * * @param request SpgnftImplMintRequest - * @return Promise + * @return MethodEncode */ - public mintEncode(request: SpgnftImplMintRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "mint", - args: [request.to], - }); + public mintEncode(request: SpgnftImplMintRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "mint", + args: [request.to], + }), + }; } /** @@ -14836,14 +15037,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method mintBySPG for contract SPGNFTImpl with only encode * * @param request SpgnftImplMintBySpgRequest - * @return Promise + * @return MethodEncode */ - public mintBySpgEncode(request: SpgnftImplMintBySpgRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "mintBySPG", - args: [request.to, request.payer], - }); + public mintBySpgEncode(request: SpgnftImplMintBySpgRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "mintBySPG", + args: [request.to, request.payer], + }), + }; } /** @@ -14869,14 +15073,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method renounceRole for contract SPGNFTImpl with only encode * * @param request SpgnftImplRenounceRoleRequest - * @return Promise + * @return MethodEncode */ - public renounceRoleEncode(request: SpgnftImplRenounceRoleRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "renounceRole", - args: [request.role, request.callerConfirmation], - }); + public renounceRoleEncode(request: SpgnftImplRenounceRoleRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "renounceRole", + args: [request.role, request.callerConfirmation], + }), + }; } /** @@ -14900,14 +15107,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method revokeRole for contract SPGNFTImpl with only encode * * @param request SpgnftImplRevokeRoleRequest - * @return Promise + * @return MethodEncode */ - public revokeRoleEncode(request: SpgnftImplRevokeRoleRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "revokeRole", - args: [request.role, request.account], - }); + public revokeRoleEncode(request: SpgnftImplRevokeRoleRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "revokeRole", + args: [request.role, request.account], + }), + }; } /** @@ -14933,14 +15143,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method safeTransferFrom for contract SPGNFTImpl with only encode * * @param request SpgnftImplSafeTransferFromRequest - * @return Promise + * @return MethodEncode */ - public safeTransferFromEncode(request: SpgnftImplSafeTransferFromRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "safeTransferFrom", - args: [request.from, request.to, request.tokenId], - }); + public safeTransferFromEncode(request: SpgnftImplSafeTransferFromRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "safeTransferFrom", + args: [request.from, request.to, request.tokenId], + }), + }; } /** @@ -14966,14 +15179,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method safeTransferFrom for contract SPGNFTImpl with only encode * * @param request SpgnftImplSafeTransferFrom2Request - * @return Promise + * @return MethodEncode */ - public safeTransferFrom2Encode(request: SpgnftImplSafeTransferFrom2Request): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "safeTransferFrom", - args: [request.from, request.to, request.tokenId, request.data], - }); + public safeTransferFrom2Encode(request: SpgnftImplSafeTransferFrom2Request): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "safeTransferFrom", + args: [request.from, request.to, request.tokenId, request.data], + }), + }; } /** @@ -14999,14 +15215,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method setApprovalForAll for contract SPGNFTImpl with only encode * * @param request SpgnftImplSetApprovalForAllRequest - * @return Promise + * @return MethodEncode */ - public setApprovalForAllEncode(request: SpgnftImplSetApprovalForAllRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "setApprovalForAll", - args: [request.operator, request.approved], - }); + public setApprovalForAllEncode(request: SpgnftImplSetApprovalForAllRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "setApprovalForAll", + args: [request.operator, request.approved], + }), + }; } /** @@ -15032,14 +15251,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method setMintCost for contract SPGNFTImpl with only encode * * @param request SpgnftImplSetMintCostRequest - * @return Promise + * @return MethodEncode */ - public setMintCostEncode(request: SpgnftImplSetMintCostRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "setMintCost", - args: [request.cost], - }); + public setMintCostEncode(request: SpgnftImplSetMintCostRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "setMintCost", + args: [request.cost], + }), + }; } /** @@ -15065,14 +15287,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method setMintToken for contract SPGNFTImpl with only encode * * @param request SpgnftImplSetMintTokenRequest - * @return Promise + * @return MethodEncode */ - public setMintTokenEncode(request: SpgnftImplSetMintTokenRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "setMintToken", - args: [request.token], - }); + public setMintTokenEncode(request: SpgnftImplSetMintTokenRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "setMintToken", + args: [request.token], + }), + }; } /** @@ -15098,14 +15323,17 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method transferFrom for contract SPGNFTImpl with only encode * * @param request SpgnftImplTransferFromRequest - * @return Promise + * @return MethodEncode */ - public transferFromEncode(request: SpgnftImplTransferFromRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "transferFrom", - args: [request.from, request.to, request.tokenId], - }); + public transferFromEncode(request: SpgnftImplTransferFromRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "transferFrom", + args: [request.from, request.to, request.tokenId], + }), + }; } /** @@ -15131,13 +15359,16 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method withdrawToken for contract SPGNFTImpl with only encode * * @param request SpgnftImplWithdrawTokenRequest - * @return Promise + * @return MethodEncode */ - public withdrawTokenEncode(request: SpgnftImplWithdrawTokenRequest): Hex { - return encodeFunctionData({ - abi: spgnftImplAbi, - functionName: "withdrawToken", - args: [request.token, request.recipient], - }); + public withdrawTokenEncode(request: SpgnftImplWithdrawTokenRequest): MethodEncode { + return { + to: this.address, + data: encodeFunctionData({ + abi: spgnftImplAbi, + functionName: "withdrawToken", + args: [request.token, request.recipient], + }), + }; } } diff --git a/packages/core-sdk/src/types/resources/dispute.ts b/packages/core-sdk/src/types/resources/dispute.ts index 4758eed7..cba53ef2 100644 --- a/packages/core-sdk/src/types/resources/dispute.ts +++ b/packages/core-sdk/src/types/resources/dispute.ts @@ -1,6 +1,7 @@ import { Address } from "viem"; import { TxOptions } from "../options"; +import { MethodEncode } from "../../abi/generated"; export type RaiseDisputeRequest = { targetIpId: Address; @@ -13,7 +14,7 @@ export type RaiseDisputeRequest = { export type RaiseDisputeResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; disputeId?: bigint; }; @@ -25,7 +26,7 @@ export type CancelDisputeRequest = { export type CancelDisputeResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; }; export type ResolveDisputeRequest = { @@ -36,5 +37,5 @@ export type ResolveDisputeRequest = { export type ResolveDisputeResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; }; diff --git a/packages/core-sdk/src/types/resources/ipAccount.ts b/packages/core-sdk/src/types/resources/ipAccount.ts index 922f9fa7..98461660 100644 --- a/packages/core-sdk/src/types/resources/ipAccount.ts +++ b/packages/core-sdk/src/types/resources/ipAccount.ts @@ -1,6 +1,7 @@ import { Address } from "viem"; import { TxOptions } from "../options"; +import { MethodEncode } from "../../abi/generated"; export type IPAccountExecuteRequest = { ipId: Address; @@ -12,7 +13,7 @@ export type IPAccountExecuteRequest = { export type IPAccountExecuteResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; }; export type IPAccountExecuteWithSigRequest = { @@ -28,5 +29,5 @@ export type IPAccountExecuteWithSigRequest = { export type IPAccountExecuteWithSigResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; }; diff --git a/packages/core-sdk/src/types/resources/ipAsset.ts b/packages/core-sdk/src/types/resources/ipAsset.ts index ce007cda..3fcef1e9 100644 --- a/packages/core-sdk/src/types/resources/ipAsset.ts +++ b/packages/core-sdk/src/types/resources/ipAsset.ts @@ -2,6 +2,7 @@ import { Address, Hex } from "viem"; import { TxOptions } from "../options"; import { PIL_TYPE } from "./license"; +import { MethodEncode } from "../../abi/generated"; type Metadata = { metadata?: { @@ -13,7 +14,7 @@ type Metadata = { export type RegisterIpResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; ipId?: Address; }; @@ -32,7 +33,7 @@ export type RegisterDerivativeWithLicenseTokensRequest = { export type RegisterDerivativeWithLicenseTokensResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; }; export type RegisterDerivativeRequest = { @@ -45,7 +46,7 @@ export type RegisterDerivativeRequest = { export type RegisterDerivativeResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; childIpId?: Address; }; @@ -61,7 +62,7 @@ export type CreateIpAssetWithPilTermsRequest = { export type CreateIpAssetWithPilTermsResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; ipId?: Address; tokenId?: bigint; licenseTermsId?: bigint; @@ -81,7 +82,7 @@ export type RegisterIpAndMakeDerivativeRequest = { export type RegisterIpAndMakeDerivativeResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; ipId?: Address; }; @@ -98,7 +99,7 @@ export type RegisterIpAndAttachPilTermsRequest = { export type RegisterIpAndAttachPilTermsResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; ipId?: Address; licenseTermsId?: bigint; }; diff --git a/packages/core-sdk/src/types/resources/license.ts b/packages/core-sdk/src/types/resources/license.ts index 6a27c40f..957217f5 100644 --- a/packages/core-sdk/src/types/resources/license.ts +++ b/packages/core-sdk/src/types/resources/license.ts @@ -1,6 +1,7 @@ import { Address } from "viem"; import { TxOptions } from "../options"; +import { MethodEncode } from "../../abi/generated"; export type LicenseApiResponse = { data: License; @@ -40,7 +41,7 @@ export type LicenseTermsIdResponse = bigint; export type RegisterPILResponse = { licenseTermsId?: bigint; txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; }; export type RegisterCommercialUsePILRequest = { @@ -65,7 +66,7 @@ export type AttachLicenseTermsRequest = { export type AttachLicenseTermsResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; success?: boolean; }; @@ -81,7 +82,7 @@ export type MintLicenseTokensRequest = { export type MintLicenseTokensResponse = { licenseTokenIds?: bigint[]; txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; }; export enum PIL_TYPE { diff --git a/packages/core-sdk/src/types/resources/nftClient.ts b/packages/core-sdk/src/types/resources/nftClient.ts index 376da58b..0c8c56db 100644 --- a/packages/core-sdk/src/types/resources/nftClient.ts +++ b/packages/core-sdk/src/types/resources/nftClient.ts @@ -1,6 +1,7 @@ import { Hex } from "viem"; import { TxOptions } from "../options"; +import { MethodEncode } from "../../abi/generated"; export type CreateNFTCollectionRequest = { name: string; @@ -14,6 +15,6 @@ export type CreateNFTCollectionRequest = { export type CreateNFTCollectionResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; nftContract?: Hex; }; diff --git a/packages/core-sdk/src/types/resources/permission.ts b/packages/core-sdk/src/types/resources/permission.ts index 964ca54b..ebee62a9 100644 --- a/packages/core-sdk/src/types/resources/permission.ts +++ b/packages/core-sdk/src/types/resources/permission.ts @@ -1,6 +1,7 @@ import { Address } from "viem"; import { TxOptions } from "../options"; +import { MethodEncode } from "../../abi/generated"; export type SetPermissionsRequest = { ipId: Address; @@ -13,7 +14,7 @@ export type SetPermissionsRequest = { export type SetPermissionsResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; success?: boolean; }; diff --git a/packages/core-sdk/src/types/resources/royalty.ts b/packages/core-sdk/src/types/resources/royalty.ts index c0bb1c66..2cb380de 100644 --- a/packages/core-sdk/src/types/resources/royalty.ts +++ b/packages/core-sdk/src/types/resources/royalty.ts @@ -1,6 +1,7 @@ import { Address } from "viem"; import { TxOptions } from "../options"; +import { MethodEncode } from "../../abi/generated"; export type RoyaltyPolicyApiResponse = { data: RoyaltyPolicy; @@ -29,7 +30,7 @@ export type CollectRoyaltyTokensRequest = { export type CollectRoyaltyTokensResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; royaltyTokensCollected?: bigint; }; @@ -60,7 +61,7 @@ export type PayRoyaltyOnBehalfRequest = { export type PayRoyaltyOnBehalfResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; }; export type SnapshotRequest = { @@ -78,12 +79,12 @@ export type ClaimRevenueRequest = { export type ClaimRevenueResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; claimableToken?: bigint; }; export type SnapshotResponse = { txHash?: string; - encodedTx?: string; + encodedTx?: MethodEncode; snapshotId?: bigint; }; diff --git a/packages/wagmi-generator/sdk.ts b/packages/wagmi-generator/sdk.ts index b6dcd1f0..1a0287a3 100644 --- a/packages/wagmi-generator/sdk.ts +++ b/packages/wagmi-generator/sdk.ts @@ -252,25 +252,28 @@ function generateContractDataFunction(contractName: string, func: AbiFunction) { if (inType.valid) types.push(`${inType.comment}\n${inType.type}`) - addImport('viem', 'encodeFunctionData', 'Hex') + addImport('viem', 'encodeFunctionData') funcLine.push(``) funcLine.push(`/**`) funcLine.push(` * method ${func.name} for contract ${contractName} with only encode`) funcLine.push(` *`) funcLine.push(` * @param request ${inName}`) - funcLine.push(` * @return Promise`) + funcLine.push(` * @return MethodEncode`) funcLine.push(`*/`) - funcLine.push(` public ${camelCase(indexFuncName)}Encode(${inParams}): Hex {`) - funcLine.push(` return encodeFunctionData({`) - funcLine.push(` abi: ${abiName},`) - funcLine.push(` functionName: "${func.name}",`) + funcLine.push(` public ${camelCase(indexFuncName)}Encode(${inParams}): MethodEncode {`) + funcLine.push(` return {`) + funcLine.push(` to: this.address,`) + funcLine.push(` data:encodeFunctionData({`) + funcLine.push(` abi: ${abiName},`) + funcLine.push(` functionName: "${func.name}",`) if (inType.valid) { - funcLine.push(` args: [`) + funcLine.push(` args: [`) funcLine.push(inType.args) - funcLine.push(` ],`) + funcLine.push(` ],`) } - funcLine.push(` });`) + funcLine.push(` }),`) + funcLine.push(` };`) funcLine.push(` }`) return {func: funcLine.join("\n"), types: ""} @@ -473,7 +476,9 @@ function generateCommon(config: SDKConfig) { file.push(` return address[chainId || 0] || '0x'`) file.push(`}`) file.push(``) - addImport('viem', 'Address') + file.push(`export type MethodEncode = {to: Address, data: Hex}`) + file.push(``) + addImport('viem', 'Address', 'Hex') if (config.permissionLessSDK) { file.push(``) From b15978252d6aebc2740e4b00c7744518e45a7ed4 Mon Sep 17 00:00:00 2001 From: lutty Date: Thu, 1 Aug 2024 10:12:02 +0800 Subject: [PATCH 3/5] opti --- packages/core-sdk/src/index.ts | 1 + packages/core-sdk/src/resources/dispute.ts | 12 ++++----- packages/core-sdk/src/resources/ipAccount.ts | 8 +++--- packages/core-sdk/src/resources/ipAsset.ts | 26 +++++++++---------- packages/core-sdk/src/resources/license.ts | 26 ++++++++++++------- packages/core-sdk/src/resources/nftClient.ts | 4 +-- packages/core-sdk/src/resources/permission.ts | 20 +++++++------- packages/core-sdk/src/resources/royalty.ts | 20 +++++++------- packages/core-sdk/src/types/options.ts | 2 +- .../core-sdk/src/types/resources/dispute.ts | 6 ++--- .../core-sdk/src/types/resources/ipAccount.ts | 4 +-- .../core-sdk/src/types/resources/ipAsset.ts | 12 ++++----- .../core-sdk/src/types/resources/license.ts | 6 ++--- .../core-sdk/src/types/resources/nftClient.ts | 2 +- .../src/types/resources/permission.ts | 2 +- .../core-sdk/src/types/resources/royalty.ts | 8 +++--- 16 files changed, 83 insertions(+), 76 deletions(-) diff --git a/packages/core-sdk/src/index.ts b/packages/core-sdk/src/index.ts index e32f9257..fec411a2 100644 --- a/packages/core-sdk/src/index.ts +++ b/packages/core-sdk/src/index.ts @@ -85,6 +85,7 @@ export type { export type { PiLicenseTemplateGetLicenseTermsResponse, IpAccountImplStateResponse, + MethodEncode, } from "./abi/generated"; export { getPermissionSignature } from "./utils/sign"; diff --git a/packages/core-sdk/src/resources/dispute.ts b/packages/core-sdk/src/resources/dispute.ts index 24a24e06..8eddf5d2 100644 --- a/packages/core-sdk/src/resources/dispute.ts +++ b/packages/core-sdk/src/resources/dispute.ts @@ -46,8 +46,8 @@ export class DisputeClient { data: request.calldata || "0x", }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.disputeModuleClient.raiseDisputeEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.disputeModuleClient.raiseDisputeEncode(req) }; } else { const txHash = await this.disputeModuleClient.raiseDispute(req); @@ -84,8 +84,8 @@ export class DisputeClient { disputeId: BigInt(request.disputeId), data: request.calldata ? request.calldata : "0x", }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.disputeModuleClient.cancelDisputeEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.disputeModuleClient.cancelDisputeEncode(req) }; } else { const txHash = await this.disputeModuleClient.cancelDispute(req); @@ -117,8 +117,8 @@ export class DisputeClient { data: request.data, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.disputeModuleClient.resolveDisputeEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.disputeModuleClient.resolveDisputeEncode(req) }; } else { const txHash = await this.disputeModuleClient.resolveDispute(req); if (request.txOptions?.waitForTransaction) { diff --git a/packages/core-sdk/src/resources/ipAccount.ts b/packages/core-sdk/src/resources/ipAccount.ts index f5327e37..ff82d115 100644 --- a/packages/core-sdk/src/resources/ipAccount.ts +++ b/packages/core-sdk/src/resources/ipAccount.ts @@ -46,8 +46,8 @@ export class IPAccountClient { data: request.data, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: ipAccountClient.executeEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: ipAccountClient.executeEncode(req) }; } else { const txHash = await ipAccountClient.execute(req); @@ -91,8 +91,8 @@ export class IPAccountClient { signature: request.signature, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: ipAccountClient.executeWithSigEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: ipAccountClient.executeWithSigEncode(req) }; } else { const txHash = await ipAccountClient.executeWithSig(req); diff --git a/packages/core-sdk/src/resources/ipAsset.ts b/packages/core-sdk/src/resources/ipAsset.ts index b22425bc..e353e646 100644 --- a/packages/core-sdk/src/resources/ipAsset.ts +++ b/packages/core-sdk/src/resources/ipAsset.ts @@ -136,12 +136,12 @@ export class IPAssetClient { deadline: calculatedDeadline, signature, }; - if (request.txOptions?.onlyEncodeTransactions) { + if (request.txOptions?.encodedTxDataOnly) { if (request.metadata) { - return { encodedTx: this.spgClient.registerIpEncode(object) }; + return { encodedTxData: this.spgClient.registerIpEncode(object) }; } else { return { - encodedTx: this.ipAssetRegistryClient.registerEncode({ + encodedTxData: this.ipAssetRegistryClient.registerEncode({ tokenContract: object.nftContract, tokenId: object.tokenId, chainid: chain[this.chainId], @@ -228,8 +228,8 @@ export class IPAssetClient { licenseTemplate: request.licenseTemplate || this.licenseTemplateClient.address, royaltyContext: zeroAddress, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.licensingModuleClient.registerDerivativeEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.licensingModuleClient.registerDerivativeEncode(req) }; } else { const txHash = await this.licensingModuleClient.registerDerivative(req); if (request.txOptions?.waitForTransaction) { @@ -277,9 +277,9 @@ export class IPAssetClient { licenseTokenIds: request.licenseTokenIds, royaltyContext: zeroAddress, }; - if (request.txOptions?.onlyEncodeTransactions) { + if (request.txOptions?.encodedTxDataOnly) { return { - encodedTx: this.licensingModuleClient.registerDerivativeWithLicenseTokensEncode(req), + encodedTxData: this.licensingModuleClient.registerDerivativeWithLicenseTokensEncode(req), }; } else { const txHash = await this.licensingModuleClient.registerDerivativeWithLicenseTokens(req); @@ -351,8 +351,8 @@ export class IPAssetClient { nftMetadataHash: request.metadata.nftMetadataHash || object.metadata.nftMetadataHash, }; } - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.spgClient.mintAndRegisterIpAndAttachPilTermsEncode(object) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.spgClient.mintAndRegisterIpAndAttachPilTermsEncode(object) }; } else { const txHash = await this.spgClient.mintAndRegisterIpAndAttachPilTerms(object); if (request.txOptions?.waitForTransaction) { @@ -482,8 +482,8 @@ export class IPAssetClient { deadline: calculatedDeadline, signature, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.spgClient.registerIpAndAttachPilTermsEncode(object) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.spgClient.registerIpAndAttachPilTermsEncode(object) }; } else { const txHash = await this.spgClient.registerIpAndAttachPilTerms(object); if (request.txOptions?.waitForTransaction) { @@ -628,8 +628,8 @@ export class IPAssetClient { deadline: calculatedDeadline, signature, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.spgClient.registerIpAndMakeDerivativeEncode(object) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.spgClient.registerIpAndMakeDerivativeEncode(object) }; } else { const txHash = await this.spgClient.registerIpAndMakeDerivative(object); if (request.txOptions?.waitForTransaction) { diff --git a/packages/core-sdk/src/resources/license.ts b/packages/core-sdk/src/resources/license.ts index c13732c1..45b70cea 100644 --- a/packages/core-sdk/src/resources/license.ts +++ b/packages/core-sdk/src/resources/license.ts @@ -67,9 +67,11 @@ export class LicenseClient { if (licenseTermsId !== 0n) { return { licenseTermsId: licenseTermsId }; } - if (request?.txOptions?.onlyEncodeTransactions) { + if (request?.txOptions?.encodedTxDataOnly) { return { - encodedTx: this.licenseTemplateClient.registerLicenseTermsEncode({ terms: licenseTerms }), + encodedTxData: this.licenseTemplateClient.registerLicenseTermsEncode({ + terms: licenseTerms, + }), }; } else { const txHash = await this.licenseTemplateClient.registerLicenseTerms({ @@ -110,9 +112,11 @@ export class LicenseClient { if (licenseTermsId !== 0n) { return { licenseTermsId: licenseTermsId }; } - if (request.txOptions?.onlyEncodeTransactions) { + if (request.txOptions?.encodedTxDataOnly) { return { - encodedTx: this.licenseTemplateClient.registerLicenseTermsEncode({ terms: licenseTerms }), + encodedTxData: this.licenseTemplateClient.registerLicenseTermsEncode({ + terms: licenseTerms, + }), }; } else { const txHash = await this.licenseTemplateClient.registerLicenseTerms({ @@ -155,9 +159,11 @@ export class LicenseClient { if (licenseTermsId !== 0n) { return { licenseTermsId: licenseTermsId }; } - if (request.txOptions?.onlyEncodeTransactions) { + if (request.txOptions?.encodedTxDataOnly) { return { - encodedTx: this.licenseTemplateClient.registerLicenseTermsEncode({ terms: licenseTerms }), + encodedTxData: this.licenseTemplateClient.registerLicenseTermsEncode({ + terms: licenseTerms, + }), }; } else { const txHash = await this.licenseTemplateClient.registerLicenseTerms({ @@ -220,8 +226,8 @@ export class LicenseClient { licenseTemplate: request.licenseTemplate || this.licenseTemplateClient.address, licenseTermsId: request.licenseTermsId, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.licensingModuleClient.attachLicenseTermsEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.licensingModuleClient.attachLicenseTermsEncode(req) }; } else { const txHash = await this.licensingModuleClient.attachLicenseTerms(req); if (request.txOptions?.waitForTransaction) { @@ -300,8 +306,8 @@ export class LicenseClient { this.wallet.account!.address, royaltyContext: zeroAddress, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.licensingModuleClient.mintLicenseTokensEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.licensingModuleClient.mintLicenseTokensEncode(req) }; } else { const txHash = await this.licensingModuleClient.mintLicenseTokens(req); if (request.txOptions?.waitForTransaction) { diff --git a/packages/core-sdk/src/resources/nftClient.ts b/packages/core-sdk/src/resources/nftClient.ts index cd488937..df006885 100644 --- a/packages/core-sdk/src/resources/nftClient.ts +++ b/packages/core-sdk/src/resources/nftClient.ts @@ -54,8 +54,8 @@ export class NftClient { this.wallet.account!.address, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.spgClient.createCollectionEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.spgClient.createCollectionEncode(req) }; } else { const txHash = await this.spgClient.createCollection(req); diff --git a/packages/core-sdk/src/resources/permission.ts b/packages/core-sdk/src/resources/permission.ts index 8e0e24d0..4fe60d1c 100644 --- a/packages/core-sdk/src/resources/permission.ts +++ b/packages/core-sdk/src/resources/permission.ts @@ -74,8 +74,8 @@ export class PermissionClient { permission: request.permission, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.accessControllerClient.setPermissionEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.accessControllerClient.setPermissionEncode(req) }; } else { const txHash = await this.accessControllerClient.setPermission(req); if (request.txOptions?.waitForTransaction) { @@ -146,8 +146,8 @@ export class PermissionClient { deadline: calculatedDeadline, signature, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: ipAccountClient.executeWithSigEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: ipAccountClient.executeWithSigEncode(req) }; } else { const txHash = await ipAccountClient.executeWithSig(req); @@ -182,8 +182,8 @@ export class PermissionClient { signer: request.signer, permission: request.permission, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.accessControllerClient.setAllPermissionsEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.accessControllerClient.setAllPermissionsEncode(req) }; } else { const txHash = await this.accessControllerClient.setAllPermissions(req); if (request.txOptions?.waitForTransaction) { @@ -228,8 +228,8 @@ export class PermissionClient { permission: permission.permission, })), }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.accessControllerClient.setBatchPermissionsEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.accessControllerClient.setBatchPermissionsEncode(req) }; } else { const txHash = await this.accessControllerClient.setBatchPermissions(req); if (txOptions?.waitForTransaction) { @@ -298,8 +298,8 @@ export class PermissionClient { deadline: calculatedDeadline, signature, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: ipAccountClient.executeWithSigEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: ipAccountClient.executeWithSigEncode(req) }; } else { const txHash = await ipAccountClient.executeWithSig(req); if (txOptions?.waitForTransaction) { diff --git a/packages/core-sdk/src/resources/royalty.ts b/packages/core-sdk/src/resources/royalty.ts index 4082482d..475a85f4 100644 --- a/packages/core-sdk/src/resources/royalty.ts +++ b/packages/core-sdk/src/resources/royalty.ts @@ -71,8 +71,8 @@ export class RoyaltyClient { const req = { ancestorIpId: request.parentIpId, }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: ipRoyaltyVault.collectRoyaltyTokensEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: ipRoyaltyVault.collectRoyaltyTokensEncode(req) }; } else { const txHash = await ipRoyaltyVault.collectRoyaltyTokens(req); if (request.txOptions?.waitForTransaction) { @@ -123,8 +123,8 @@ export class RoyaltyClient { token: getAddress(request.token, "request.token"), amount: BigInt(request.amount), }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: this.royaltyModuleClient.payRoyaltyOnBehalfEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: this.royaltyModuleClient.payRoyaltyOnBehalfEncode(req) }; } else { const txHash = await this.royaltyModuleClient.payRoyaltyOnBehalf(req); if (request.txOptions?.waitForTransaction) { @@ -206,8 +206,8 @@ export class RoyaltyClient { args: [request.snapshotIds, request.token], }), }); - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: iPAccountExecuteResponse.encodedTx }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: iPAccountExecuteResponse.encodedTxData }; } txHash = iPAccountExecuteResponse.txHash as Hex; } else { @@ -215,8 +215,8 @@ export class RoyaltyClient { snapshotIds: request.snapshotIds, token: getAddress(request.token, "request.token"), }; - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: ipRoyaltyVault.claimRevenueBySnapshotBatchEncode(req) }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: ipRoyaltyVault.claimRevenueBySnapshotBatchEncode(req) }; } else { txHash = await ipRoyaltyVault.claimRevenueBySnapshotBatch(req); } @@ -252,8 +252,8 @@ export class RoyaltyClient { this.wallet, proxyAddress, ); - if (request.txOptions?.onlyEncodeTransactions) { - return { encodedTx: ipRoyaltyVault.snapshotEncode() }; + if (request.txOptions?.encodedTxDataOnly) { + return { encodedTxData: ipRoyaltyVault.snapshotEncode() }; } else { const txHash = await ipRoyaltyVault.snapshot(); if (request.txOptions?.waitForTransaction) { diff --git a/packages/core-sdk/src/types/options.ts b/packages/core-sdk/src/types/options.ts index bffdee49..0ad22103 100644 --- a/packages/core-sdk/src/types/options.ts +++ b/packages/core-sdk/src/types/options.ts @@ -6,7 +6,7 @@ export type TxOptions = { // When the time of setting this option, the transaction will // not submit and execute, it will only encode the abi and // function data and return. - onlyEncodeTransactions?: boolean; + encodedTxDataOnly?: boolean; // The price (in wei) to pay per gas. gasPrice?: bigint; // Total fee per gas (in wei). diff --git a/packages/core-sdk/src/types/resources/dispute.ts b/packages/core-sdk/src/types/resources/dispute.ts index cba53ef2..7469891f 100644 --- a/packages/core-sdk/src/types/resources/dispute.ts +++ b/packages/core-sdk/src/types/resources/dispute.ts @@ -14,7 +14,7 @@ export type RaiseDisputeRequest = { export type RaiseDisputeResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; disputeId?: bigint; }; @@ -26,7 +26,7 @@ export type CancelDisputeRequest = { export type CancelDisputeResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; }; export type ResolveDisputeRequest = { @@ -37,5 +37,5 @@ export type ResolveDisputeRequest = { export type ResolveDisputeResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; }; diff --git a/packages/core-sdk/src/types/resources/ipAccount.ts b/packages/core-sdk/src/types/resources/ipAccount.ts index 98461660..1542a954 100644 --- a/packages/core-sdk/src/types/resources/ipAccount.ts +++ b/packages/core-sdk/src/types/resources/ipAccount.ts @@ -13,7 +13,7 @@ export type IPAccountExecuteRequest = { export type IPAccountExecuteResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; }; export type IPAccountExecuteWithSigRequest = { @@ -29,5 +29,5 @@ export type IPAccountExecuteWithSigRequest = { export type IPAccountExecuteWithSigResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; }; diff --git a/packages/core-sdk/src/types/resources/ipAsset.ts b/packages/core-sdk/src/types/resources/ipAsset.ts index 3fcef1e9..51fa7476 100644 --- a/packages/core-sdk/src/types/resources/ipAsset.ts +++ b/packages/core-sdk/src/types/resources/ipAsset.ts @@ -14,7 +14,7 @@ type Metadata = { export type RegisterIpResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; ipId?: Address; }; @@ -33,7 +33,7 @@ export type RegisterDerivativeWithLicenseTokensRequest = { export type RegisterDerivativeWithLicenseTokensResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; }; export type RegisterDerivativeRequest = { @@ -46,7 +46,7 @@ export type RegisterDerivativeRequest = { export type RegisterDerivativeResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; childIpId?: Address; }; @@ -62,7 +62,7 @@ export type CreateIpAssetWithPilTermsRequest = { export type CreateIpAssetWithPilTermsResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; ipId?: Address; tokenId?: bigint; licenseTermsId?: bigint; @@ -82,7 +82,7 @@ export type RegisterIpAndMakeDerivativeRequest = { export type RegisterIpAndMakeDerivativeResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; ipId?: Address; }; @@ -99,7 +99,7 @@ export type RegisterIpAndAttachPilTermsRequest = { export type RegisterIpAndAttachPilTermsResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; ipId?: Address; licenseTermsId?: bigint; }; diff --git a/packages/core-sdk/src/types/resources/license.ts b/packages/core-sdk/src/types/resources/license.ts index 957217f5..431c4b71 100644 --- a/packages/core-sdk/src/types/resources/license.ts +++ b/packages/core-sdk/src/types/resources/license.ts @@ -41,7 +41,7 @@ export type LicenseTermsIdResponse = bigint; export type RegisterPILResponse = { licenseTermsId?: bigint; txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; }; export type RegisterCommercialUsePILRequest = { @@ -66,7 +66,7 @@ export type AttachLicenseTermsRequest = { export type AttachLicenseTermsResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; success?: boolean; }; @@ -82,7 +82,7 @@ export type MintLicenseTokensRequest = { export type MintLicenseTokensResponse = { licenseTokenIds?: bigint[]; txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; }; export enum PIL_TYPE { diff --git a/packages/core-sdk/src/types/resources/nftClient.ts b/packages/core-sdk/src/types/resources/nftClient.ts index 0c8c56db..d29c4549 100644 --- a/packages/core-sdk/src/types/resources/nftClient.ts +++ b/packages/core-sdk/src/types/resources/nftClient.ts @@ -15,6 +15,6 @@ export type CreateNFTCollectionRequest = { export type CreateNFTCollectionResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; nftContract?: Hex; }; diff --git a/packages/core-sdk/src/types/resources/permission.ts b/packages/core-sdk/src/types/resources/permission.ts index ebee62a9..14b657af 100644 --- a/packages/core-sdk/src/types/resources/permission.ts +++ b/packages/core-sdk/src/types/resources/permission.ts @@ -14,7 +14,7 @@ export type SetPermissionsRequest = { export type SetPermissionsResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; success?: boolean; }; diff --git a/packages/core-sdk/src/types/resources/royalty.ts b/packages/core-sdk/src/types/resources/royalty.ts index 2cb380de..57257789 100644 --- a/packages/core-sdk/src/types/resources/royalty.ts +++ b/packages/core-sdk/src/types/resources/royalty.ts @@ -30,7 +30,7 @@ export type CollectRoyaltyTokensRequest = { export type CollectRoyaltyTokensResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; royaltyTokensCollected?: bigint; }; @@ -61,7 +61,7 @@ export type PayRoyaltyOnBehalfRequest = { export type PayRoyaltyOnBehalfResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; }; export type SnapshotRequest = { @@ -79,12 +79,12 @@ export type ClaimRevenueRequest = { export type ClaimRevenueResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; claimableToken?: bigint; }; export type SnapshotResponse = { txHash?: string; - encodedTx?: MethodEncode; + encodedTxData?: MethodEncode; snapshotId?: bigint; }; From 307e331020935d59c49f6a2f62f3240d39c7e933 Mon Sep 17 00:00:00 2001 From: lutty Date: Thu, 1 Aug 2024 14:00:00 +0800 Subject: [PATCH 4/5] opti --- package.json | 2 +- packages/core-sdk/src/abi/generated.ts | 278 +++++++++--------- packages/core-sdk/src/index.ts | 2 +- .../core-sdk/src/types/resources/dispute.ts | 8 +- .../core-sdk/src/types/resources/ipAccount.ts | 6 +- .../core-sdk/src/types/resources/ipAsset.ts | 14 +- .../core-sdk/src/types/resources/license.ts | 8 +- .../core-sdk/src/types/resources/nftClient.ts | 4 +- .../src/types/resources/permission.ts | 4 +- .../core-sdk/src/types/resources/royalty.ts | 10 +- packages/wagmi-generator/sdk.ts | 6 +- 11 files changed, 173 insertions(+), 169 deletions(-) diff --git a/package.json b/package.json index f27634e6..803256c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typescript-sdk", - "version": "0.0.3", + "version": "0.0.4", "private": true, "repository": "https://github.com/storyprotocol/typescript-sdk", "author": "storyprotocol engineering ", diff --git a/packages/core-sdk/src/abi/generated.ts b/packages/core-sdk/src/abi/generated.ts index d140de29..bfce62a0 100644 --- a/packages/core-sdk/src/abi/generated.ts +++ b/packages/core-sdk/src/abi/generated.ts @@ -7410,7 +7410,7 @@ function getAddress(address: Record, chainId?: number): Address return address[chainId || 0] || "0x"; } -export type MethodEncode = { to: Address; data: Hex }; +export type EncodedTxData = { to: Address; data: Hex }; export type SimpleWalletClient< TChain extends Chain | undefined = Chain | undefined, @@ -7581,9 +7581,9 @@ export class AccessControllerClient extends AccessControllerEventClient { * method setAllPermissions for contract AccessController with only encode * * @param request AccessControllerSetAllPermissionsRequest - * @return MethodEncode + * @return EncodedTxData */ - public setAllPermissionsEncode(request: AccessControllerSetAllPermissionsRequest): MethodEncode { + public setAllPermissionsEncode(request: AccessControllerSetAllPermissionsRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -7617,11 +7617,11 @@ export class AccessControllerClient extends AccessControllerEventClient { * method setBatchPermissions for contract AccessController with only encode * * @param request AccessControllerSetBatchPermissionsRequest - * @return MethodEncode + * @return EncodedTxData */ public setBatchPermissionsEncode( request: AccessControllerSetBatchPermissionsRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -7655,9 +7655,9 @@ export class AccessControllerClient extends AccessControllerEventClient { * method setPermission for contract AccessController with only encode * * @param request AccessControllerSetPermissionRequest - * @return MethodEncode + * @return EncodedTxData */ - public setPermissionEncode(request: AccessControllerSetPermissionRequest): MethodEncode { + public setPermissionEncode(request: AccessControllerSetPermissionRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -8037,9 +8037,9 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { * method freezeMetadata for contract CoreMetadataModule with only encode * * @param request CoreMetadataModuleFreezeMetadataRequest - * @return MethodEncode + * @return EncodedTxData */ - public freezeMetadataEncode(request: CoreMetadataModuleFreezeMetadataRequest): MethodEncode { + public freezeMetadataEncode(request: CoreMetadataModuleFreezeMetadataRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -8071,9 +8071,9 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { * method setAll for contract CoreMetadataModule with only encode * * @param request CoreMetadataModuleSetAllRequest - * @return MethodEncode + * @return EncodedTxData */ - public setAllEncode(request: CoreMetadataModuleSetAllRequest): MethodEncode { + public setAllEncode(request: CoreMetadataModuleSetAllRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -8107,9 +8107,9 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { * method setMetadataURI for contract CoreMetadataModule with only encode * * @param request CoreMetadataModuleSetMetadataUriRequest - * @return MethodEncode + * @return EncodedTxData */ - public setMetadataUriEncode(request: CoreMetadataModuleSetMetadataUriRequest): MethodEncode { + public setMetadataUriEncode(request: CoreMetadataModuleSetMetadataUriRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -8143,11 +8143,11 @@ export class CoreMetadataModuleClient extends CoreMetadataModuleReadOnlyClient { * method updateNftTokenURI for contract CoreMetadataModule with only encode * * @param request CoreMetadataModuleUpdateNftTokenUriRequest - * @return MethodEncode + * @return EncodedTxData */ public updateNftTokenUriEncode( request: CoreMetadataModuleUpdateNftTokenUriRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -8409,9 +8409,9 @@ export class DisputeModuleClient extends DisputeModuleEventClient { * method cancelDispute for contract DisputeModule with only encode * * @param request DisputeModuleCancelDisputeRequest - * @return MethodEncode + * @return EncodedTxData */ - public cancelDisputeEncode(request: DisputeModuleCancelDisputeRequest): MethodEncode { + public cancelDisputeEncode(request: DisputeModuleCancelDisputeRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -8445,9 +8445,9 @@ export class DisputeModuleClient extends DisputeModuleEventClient { * method raiseDispute for contract DisputeModule with only encode * * @param request DisputeModuleRaiseDisputeRequest - * @return MethodEncode + * @return EncodedTxData */ - public raiseDisputeEncode(request: DisputeModuleRaiseDisputeRequest): MethodEncode { + public raiseDisputeEncode(request: DisputeModuleRaiseDisputeRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -8481,9 +8481,9 @@ export class DisputeModuleClient extends DisputeModuleEventClient { * method resolveDispute for contract DisputeModule with only encode * * @param request DisputeModuleResolveDisputeRequest - * @return MethodEncode + * @return EncodedTxData */ - public resolveDisputeEncode(request: DisputeModuleResolveDisputeRequest): MethodEncode { + public resolveDisputeEncode(request: DisputeModuleResolveDisputeRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -8590,9 +8590,9 @@ export class IpAccountImplClient extends IpAccountImplReadOnlyClient { * method execute for contract IPAccountImpl with only encode * * @param request IpAccountImplExecuteRequest - * @return MethodEncode + * @return EncodedTxData */ - public executeEncode(request: IpAccountImplExecuteRequest): MethodEncode { + public executeEncode(request: IpAccountImplExecuteRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -8633,9 +8633,9 @@ export class IpAccountImplClient extends IpAccountImplReadOnlyClient { * method executeWithSig for contract IPAccountImpl with only encode * * @param request IpAccountImplExecuteWithSigRequest - * @return MethodEncode + * @return EncodedTxData */ - public executeWithSigEncode(request: IpAccountImplExecuteWithSigRequest): MethodEncode { + public executeWithSigEncode(request: IpAccountImplExecuteWithSigRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -8901,9 +8901,9 @@ export class IpAssetRegistryClient extends IpAssetRegistryReadOnlyClient { * method register for contract IPAssetRegistry with only encode * * @param request IpAssetRegistryRegisterRequest - * @return MethodEncode + * @return EncodedTxData */ - public registerEncode(request: IpAssetRegistryRegisterRequest): MethodEncode { + public registerEncode(request: IpAssetRegistryRegisterRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -9212,11 +9212,11 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { * method claimRevenueBySnapshotBatch for contract IpRoyaltyVaultImpl with only encode * * @param request IpRoyaltyVaultImplClaimRevenueBySnapshotBatchRequest - * @return MethodEncode + * @return EncodedTxData */ public claimRevenueBySnapshotBatchEncode( request: IpRoyaltyVaultImplClaimRevenueBySnapshotBatchRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -9250,11 +9250,11 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { * method claimRevenueByTokenBatch for contract IpRoyaltyVaultImpl with only encode * * @param request IpRoyaltyVaultImplClaimRevenueByTokenBatchRequest - * @return MethodEncode + * @return EncodedTxData */ public claimRevenueByTokenBatchEncode( request: IpRoyaltyVaultImplClaimRevenueByTokenBatchRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -9288,11 +9288,11 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { * method collectRoyaltyTokens for contract IpRoyaltyVaultImpl with only encode * * @param request IpRoyaltyVaultImplCollectRoyaltyTokensRequest - * @return MethodEncode + * @return EncodedTxData */ public collectRoyaltyTokensEncode( request: IpRoyaltyVaultImplCollectRoyaltyTokensRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -9323,9 +9323,9 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { * method snapshot for contract IpRoyaltyVaultImpl with only encode * * @param request IpRoyaltyVaultImplSnapshotRequest - * @return MethodEncode + * @return EncodedTxData */ - public snapshotEncode(): MethodEncode { + public snapshotEncode(): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -10540,11 +10540,11 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method attachLicenseTermsToIp for contract LicenseRegistry with only encode * * @param request LicenseRegistryAttachLicenseTermsToIpRequest - * @return MethodEncode + * @return EncodedTxData */ public attachLicenseTermsToIpEncode( request: LicenseRegistryAttachLicenseTermsToIpRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -10578,9 +10578,9 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method initialize for contract LicenseRegistry with only encode * * @param request LicenseRegistryInitializeRequest - * @return MethodEncode + * @return EncodedTxData */ - public initializeEncode(request: LicenseRegistryInitializeRequest): MethodEncode { + public initializeEncode(request: LicenseRegistryInitializeRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -10619,11 +10619,11 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method registerDerivativeIp for contract LicenseRegistry with only encode * * @param request LicenseRegistryRegisterDerivativeIpRequest - * @return MethodEncode + * @return EncodedTxData */ public registerDerivativeIpEncode( request: LicenseRegistryRegisterDerivativeIpRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -10662,11 +10662,11 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method registerLicenseTemplate for contract LicenseRegistry with only encode * * @param request LicenseRegistryRegisterLicenseTemplateRequest - * @return MethodEncode + * @return EncodedTxData */ public registerLicenseTemplateEncode( request: LicenseRegistryRegisterLicenseTemplateRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -10700,9 +10700,9 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method setAuthority for contract LicenseRegistry with only encode * * @param request LicenseRegistrySetAuthorityRequest - * @return MethodEncode + * @return EncodedTxData */ - public setAuthorityEncode(request: LicenseRegistrySetAuthorityRequest): MethodEncode { + public setAuthorityEncode(request: LicenseRegistrySetAuthorityRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -10736,11 +10736,11 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method setDefaultLicenseTerms for contract LicenseRegistry with only encode * * @param request LicenseRegistrySetDefaultLicenseTermsRequest - * @return MethodEncode + * @return EncodedTxData */ public setDefaultLicenseTermsEncode( request: LicenseRegistrySetDefaultLicenseTermsRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -10774,9 +10774,9 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method setExpireTime for contract LicenseRegistry with only encode * * @param request LicenseRegistrySetExpireTimeRequest - * @return MethodEncode + * @return EncodedTxData */ - public setExpireTimeEncode(request: LicenseRegistrySetExpireTimeRequest): MethodEncode { + public setExpireTimeEncode(request: LicenseRegistrySetExpireTimeRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -10810,11 +10810,11 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method setLicensingConfigForIp for contract LicenseRegistry with only encode * * @param request LicenseRegistrySetLicensingConfigForIpRequest - * @return MethodEncode + * @return EncodedTxData */ public setLicensingConfigForIpEncode( request: LicenseRegistrySetLicensingConfigForIpRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -10853,11 +10853,11 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method setLicensingConfigForLicense for contract LicenseRegistry with only encode * * @param request LicenseRegistrySetLicensingConfigForLicenseRequest - * @return MethodEncode + * @return EncodedTxData */ public setLicensingConfigForLicenseEncode( request: LicenseRegistrySetLicensingConfigForLicenseRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -10896,9 +10896,9 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { * method upgradeToAndCall for contract LicenseRegistry with only encode * * @param request LicenseRegistryUpgradeToAndCallRequest - * @return MethodEncode + * @return EncodedTxData */ - public upgradeToAndCallEncode(request: LicenseRegistryUpgradeToAndCallRequest): MethodEncode { + public upgradeToAndCallEncode(request: LicenseRegistryUpgradeToAndCallRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -11180,9 +11180,11 @@ export class LicensingModuleClient extends LicensingModuleEventClient { * method attachLicenseTerms for contract LicensingModule with only encode * * @param request LicensingModuleAttachLicenseTermsRequest - * @return MethodEncode + * @return EncodedTxData */ - public attachLicenseTermsEncode(request: LicensingModuleAttachLicenseTermsRequest): MethodEncode { + public attachLicenseTermsEncode( + request: LicensingModuleAttachLicenseTermsRequest, + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -11223,9 +11225,9 @@ export class LicensingModuleClient extends LicensingModuleEventClient { * method mintLicenseTokens for contract LicensingModule with only encode * * @param request LicensingModuleMintLicenseTokensRequest - * @return MethodEncode + * @return EncodedTxData */ - public mintLicenseTokensEncode(request: LicensingModuleMintLicenseTokensRequest): MethodEncode { + public mintLicenseTokensEncode(request: LicensingModuleMintLicenseTokensRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -11272,9 +11274,11 @@ export class LicensingModuleClient extends LicensingModuleEventClient { * method registerDerivative for contract LicensingModule with only encode * * @param request LicensingModuleRegisterDerivativeRequest - * @return MethodEncode + * @return EncodedTxData */ - public registerDerivativeEncode(request: LicensingModuleRegisterDerivativeRequest): MethodEncode { + public registerDerivativeEncode( + request: LicensingModuleRegisterDerivativeRequest, + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -11314,11 +11318,11 @@ export class LicensingModuleClient extends LicensingModuleEventClient { * method registerDerivativeWithLicenseTokens for contract LicensingModule with only encode * * @param request LicensingModuleRegisterDerivativeWithLicenseTokensRequest - * @return MethodEncode + * @return EncodedTxData */ public registerDerivativeWithLicenseTokensEncode( request: LicensingModuleRegisterDerivativeWithLicenseTokensRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -12406,9 +12410,9 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method initialize for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateInitializeRequest - * @return MethodEncode + * @return EncodedTxData */ - public initializeEncode(request: PiLicenseTemplateInitializeRequest): MethodEncode { + public initializeEncode(request: PiLicenseTemplateInitializeRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -12442,11 +12446,11 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method registerLicenseTerms for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateRegisterLicenseTermsRequest - * @return MethodEncode + * @return EncodedTxData */ public registerLicenseTermsEncode( request: PiLicenseTemplateRegisterLicenseTermsRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -12480,9 +12484,9 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method setApproval for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateSetApprovalRequest - * @return MethodEncode + * @return EncodedTxData */ - public setApprovalEncode(request: PiLicenseTemplateSetApprovalRequest): MethodEncode { + public setApprovalEncode(request: PiLicenseTemplateSetApprovalRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -12516,9 +12520,9 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method setAuthority for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateSetAuthorityRequest - * @return MethodEncode + * @return EncodedTxData */ - public setAuthorityEncode(request: PiLicenseTemplateSetAuthorityRequest): MethodEncode { + public setAuthorityEncode(request: PiLicenseTemplateSetAuthorityRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -12552,9 +12556,9 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method upgradeToAndCall for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateUpgradeToAndCallRequest - * @return MethodEncode + * @return EncodedTxData */ - public upgradeToAndCallEncode(request: PiLicenseTemplateUpgradeToAndCallRequest): MethodEncode { + public upgradeToAndCallEncode(request: PiLicenseTemplateUpgradeToAndCallRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -12588,11 +12592,11 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method verifyMintLicenseToken for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateVerifyMintLicenseTokenRequest - * @return MethodEncode + * @return EncodedTxData */ public verifyMintLicenseTokenEncode( request: PiLicenseTemplateVerifyMintLicenseTokenRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -12626,11 +12630,11 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method verifyRegisterDerivative for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateVerifyRegisterDerivativeRequest - * @return MethodEncode + * @return EncodedTxData */ public verifyRegisterDerivativeEncode( request: PiLicenseTemplateVerifyRegisterDerivativeRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -12664,11 +12668,11 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { * method verifyRegisterDerivativeForAllParents for contract PILicenseTemplate with only encode * * @param request PiLicenseTemplateVerifyRegisterDerivativeForAllParentsRequest - * @return MethodEncode + * @return EncodedTxData */ public verifyRegisterDerivativeForAllParentsEncode( request: PiLicenseTemplateVerifyRegisterDerivativeForAllParentsRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -12739,9 +12743,9 @@ export class RoyaltyModuleClient { * method payRoyaltyOnBehalf for contract RoyaltyModule with only encode * * @param request RoyaltyModulePayRoyaltyOnBehalfRequest - * @return MethodEncode + * @return EncodedTxData */ - public payRoyaltyOnBehalfEncode(request: RoyaltyModulePayRoyaltyOnBehalfRequest): MethodEncode { + public payRoyaltyOnBehalfEncode(request: RoyaltyModulePayRoyaltyOnBehalfRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -12860,9 +12864,9 @@ export class RoyaltyPolicyLapClient extends RoyaltyPolicyLapReadOnlyClient { * method onRoyaltyPayment for contract RoyaltyPolicyLAP with only encode * * @param request RoyaltyPolicyLapOnRoyaltyPaymentRequest - * @return MethodEncode + * @return EncodedTxData */ - public onRoyaltyPaymentEncode(request: RoyaltyPolicyLapOnRoyaltyPaymentRequest): MethodEncode { + public onRoyaltyPaymentEncode(request: RoyaltyPolicyLapOnRoyaltyPaymentRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13268,9 +13272,9 @@ export class SpgClient extends SpgEventClient { * method createCollection for contract SPG with only encode * * @param request SpgCreateCollectionRequest - * @return MethodEncode + * @return EncodedTxData */ - public createCollectionEncode(request: SpgCreateCollectionRequest): MethodEncode { + public createCollectionEncode(request: SpgCreateCollectionRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13311,9 +13315,9 @@ export class SpgClient extends SpgEventClient { * method mintAndRegisterIp for contract SPG with only encode * * @param request SpgMintAndRegisterIpRequest - * @return MethodEncode + * @return EncodedTxData */ - public mintAndRegisterIpEncode(request: SpgMintAndRegisterIpRequest): MethodEncode { + public mintAndRegisterIpEncode(request: SpgMintAndRegisterIpRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13347,11 +13351,11 @@ export class SpgClient extends SpgEventClient { * method mintAndRegisterIpAndAttachPILTerms for contract SPG with only encode * * @param request SpgMintAndRegisterIpAndAttachPilTermsRequest - * @return MethodEncode + * @return EncodedTxData */ public mintAndRegisterIpAndAttachPilTermsEncode( request: SpgMintAndRegisterIpAndAttachPilTermsRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13385,11 +13389,11 @@ export class SpgClient extends SpgEventClient { * method mintAndRegisterIpAndMakeDerivative for contract SPG with only encode * * @param request SpgMintAndRegisterIpAndMakeDerivativeRequest - * @return MethodEncode + * @return EncodedTxData */ public mintAndRegisterIpAndMakeDerivativeEncode( request: SpgMintAndRegisterIpAndMakeDerivativeRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13429,11 +13433,11 @@ export class SpgClient extends SpgEventClient { * method mintAndRegisterIpAndMakeDerivativeWithLicenseTokens for contract SPG with only encode * * @param request SpgMintAndRegisterIpAndMakeDerivativeWithLicenseTokensRequest - * @return MethodEncode + * @return EncodedTxData */ public mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode( request: SpgMintAndRegisterIpAndMakeDerivativeWithLicenseTokensRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13471,9 +13475,9 @@ export class SpgClient extends SpgEventClient { * method registerIp for contract SPG with only encode * * @param request SpgRegisterIpRequest - * @return MethodEncode + * @return EncodedTxData */ - public registerIpEncode(request: SpgRegisterIpRequest): MethodEncode { + public registerIpEncode(request: SpgRegisterIpRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13514,11 +13518,11 @@ export class SpgClient extends SpgEventClient { * method registerIpAndAttachPILTerms for contract SPG with only encode * * @param request SpgRegisterIpAndAttachPilTermsRequest - * @return MethodEncode + * @return EncodedTxData */ public registerIpAndAttachPilTermsEncode( request: SpgRegisterIpAndAttachPilTermsRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13566,11 +13570,11 @@ export class SpgClient extends SpgEventClient { * method registerIpAndMakeDerivative for contract SPG with only encode * * @param request SpgRegisterIpAndMakeDerivativeRequest - * @return MethodEncode + * @return EncodedTxData */ public registerIpAndMakeDerivativeEncode( request: SpgRegisterIpAndMakeDerivativeRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13619,11 +13623,11 @@ export class SpgClient extends SpgEventClient { * method registerIpAndMakeDerivativeWithLicenseTokens for contract SPG with only encode * * @param request SpgRegisterIpAndMakeDerivativeWithLicenseTokensRequest - * @return MethodEncode + * @return EncodedTxData */ public registerIpAndMakeDerivativeWithLicenseTokensEncode( request: SpgRegisterIpAndMakeDerivativeWithLicenseTokensRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13665,11 +13669,11 @@ export class SpgClient extends SpgEventClient { * method registerPILTermsAndAttach for contract SPG with only encode * * @param request SpgRegisterPilTermsAndAttachRequest - * @return MethodEncode + * @return EncodedTxData */ public registerPilTermsAndAttachEncode( request: SpgRegisterPilTermsAndAttachRequest, - ): MethodEncode { + ): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13886,9 +13890,9 @@ export class SpgnftBeaconClient extends SpgnftBeaconReadOnlyClient { * method renounceOwnership for contract SPGNFTBeacon with only encode * * @param request SpgnftBeaconRenounceOwnershipRequest - * @return MethodEncode + * @return EncodedTxData */ - public renounceOwnershipEncode(): MethodEncode { + public renounceOwnershipEncode(): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13921,9 +13925,9 @@ export class SpgnftBeaconClient extends SpgnftBeaconReadOnlyClient { * method transferOwnership for contract SPGNFTBeacon with only encode * * @param request SpgnftBeaconTransferOwnershipRequest - * @return MethodEncode + * @return EncodedTxData */ - public transferOwnershipEncode(request: SpgnftBeaconTransferOwnershipRequest): MethodEncode { + public transferOwnershipEncode(request: SpgnftBeaconTransferOwnershipRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -13955,9 +13959,9 @@ export class SpgnftBeaconClient extends SpgnftBeaconReadOnlyClient { * method upgradeTo for contract SPGNFTBeacon with only encode * * @param request SpgnftBeaconUpgradeToRequest - * @return MethodEncode + * @return EncodedTxData */ - public upgradeToEncode(request: SpgnftBeaconUpgradeToRequest): MethodEncode { + public upgradeToEncode(request: SpgnftBeaconUpgradeToRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -14887,9 +14891,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method approve for contract SPGNFTImpl with only encode * * @param request SpgnftImplApproveRequest - * @return MethodEncode + * @return EncodedTxData */ - public approveEncode(request: SpgnftImplApproveRequest): MethodEncode { + public approveEncode(request: SpgnftImplApproveRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -14921,9 +14925,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method grantRole for contract SPGNFTImpl with only encode * * @param request SpgnftImplGrantRoleRequest - * @return MethodEncode + * @return EncodedTxData */ - public grantRoleEncode(request: SpgnftImplGrantRoleRequest): MethodEncode { + public grantRoleEncode(request: SpgnftImplGrantRoleRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -14962,9 +14966,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method initialize for contract SPGNFTImpl with only encode * * @param request SpgnftImplInitializeRequest - * @return MethodEncode + * @return EncodedTxData */ - public initializeEncode(request: SpgnftImplInitializeRequest): MethodEncode { + public initializeEncode(request: SpgnftImplInitializeRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15003,9 +15007,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method mint for contract SPGNFTImpl with only encode * * @param request SpgnftImplMintRequest - * @return MethodEncode + * @return EncodedTxData */ - public mintEncode(request: SpgnftImplMintRequest): MethodEncode { + public mintEncode(request: SpgnftImplMintRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15037,9 +15041,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method mintBySPG for contract SPGNFTImpl with only encode * * @param request SpgnftImplMintBySpgRequest - * @return MethodEncode + * @return EncodedTxData */ - public mintBySpgEncode(request: SpgnftImplMintBySpgRequest): MethodEncode { + public mintBySpgEncode(request: SpgnftImplMintBySpgRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15073,9 +15077,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method renounceRole for contract SPGNFTImpl with only encode * * @param request SpgnftImplRenounceRoleRequest - * @return MethodEncode + * @return EncodedTxData */ - public renounceRoleEncode(request: SpgnftImplRenounceRoleRequest): MethodEncode { + public renounceRoleEncode(request: SpgnftImplRenounceRoleRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15107,9 +15111,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method revokeRole for contract SPGNFTImpl with only encode * * @param request SpgnftImplRevokeRoleRequest - * @return MethodEncode + * @return EncodedTxData */ - public revokeRoleEncode(request: SpgnftImplRevokeRoleRequest): MethodEncode { + public revokeRoleEncode(request: SpgnftImplRevokeRoleRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15143,9 +15147,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method safeTransferFrom for contract SPGNFTImpl with only encode * * @param request SpgnftImplSafeTransferFromRequest - * @return MethodEncode + * @return EncodedTxData */ - public safeTransferFromEncode(request: SpgnftImplSafeTransferFromRequest): MethodEncode { + public safeTransferFromEncode(request: SpgnftImplSafeTransferFromRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15179,9 +15183,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method safeTransferFrom for contract SPGNFTImpl with only encode * * @param request SpgnftImplSafeTransferFrom2Request - * @return MethodEncode + * @return EncodedTxData */ - public safeTransferFrom2Encode(request: SpgnftImplSafeTransferFrom2Request): MethodEncode { + public safeTransferFrom2Encode(request: SpgnftImplSafeTransferFrom2Request): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15215,9 +15219,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method setApprovalForAll for contract SPGNFTImpl with only encode * * @param request SpgnftImplSetApprovalForAllRequest - * @return MethodEncode + * @return EncodedTxData */ - public setApprovalForAllEncode(request: SpgnftImplSetApprovalForAllRequest): MethodEncode { + public setApprovalForAllEncode(request: SpgnftImplSetApprovalForAllRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15251,9 +15255,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method setMintCost for contract SPGNFTImpl with only encode * * @param request SpgnftImplSetMintCostRequest - * @return MethodEncode + * @return EncodedTxData */ - public setMintCostEncode(request: SpgnftImplSetMintCostRequest): MethodEncode { + public setMintCostEncode(request: SpgnftImplSetMintCostRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15287,9 +15291,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method setMintToken for contract SPGNFTImpl with only encode * * @param request SpgnftImplSetMintTokenRequest - * @return MethodEncode + * @return EncodedTxData */ - public setMintTokenEncode(request: SpgnftImplSetMintTokenRequest): MethodEncode { + public setMintTokenEncode(request: SpgnftImplSetMintTokenRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15323,9 +15327,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method transferFrom for contract SPGNFTImpl with only encode * * @param request SpgnftImplTransferFromRequest - * @return MethodEncode + * @return EncodedTxData */ - public transferFromEncode(request: SpgnftImplTransferFromRequest): MethodEncode { + public transferFromEncode(request: SpgnftImplTransferFromRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ @@ -15359,9 +15363,9 @@ export class SpgnftImplClient extends SpgnftImplReadOnlyClient { * method withdrawToken for contract SPGNFTImpl with only encode * * @param request SpgnftImplWithdrawTokenRequest - * @return MethodEncode + * @return EncodedTxData */ - public withdrawTokenEncode(request: SpgnftImplWithdrawTokenRequest): MethodEncode { + public withdrawTokenEncode(request: SpgnftImplWithdrawTokenRequest): EncodedTxData { return { to: this.address, data: encodeFunctionData({ diff --git a/packages/core-sdk/src/index.ts b/packages/core-sdk/src/index.ts index fec411a2..c6c8e845 100644 --- a/packages/core-sdk/src/index.ts +++ b/packages/core-sdk/src/index.ts @@ -85,7 +85,7 @@ export type { export type { PiLicenseTemplateGetLicenseTermsResponse, IpAccountImplStateResponse, - MethodEncode, + EncodedTxData, } from "./abi/generated"; export { getPermissionSignature } from "./utils/sign"; diff --git a/packages/core-sdk/src/types/resources/dispute.ts b/packages/core-sdk/src/types/resources/dispute.ts index 7469891f..f779d5fc 100644 --- a/packages/core-sdk/src/types/resources/dispute.ts +++ b/packages/core-sdk/src/types/resources/dispute.ts @@ -1,7 +1,7 @@ import { Address } from "viem"; import { TxOptions } from "../options"; -import { MethodEncode } from "../../abi/generated"; +import { EncodedTxData } from "../../abi/generated"; export type RaiseDisputeRequest = { targetIpId: Address; @@ -14,7 +14,7 @@ export type RaiseDisputeRequest = { export type RaiseDisputeResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; disputeId?: bigint; }; @@ -26,7 +26,7 @@ export type CancelDisputeRequest = { export type CancelDisputeResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; }; export type ResolveDisputeRequest = { @@ -37,5 +37,5 @@ export type ResolveDisputeRequest = { export type ResolveDisputeResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; }; diff --git a/packages/core-sdk/src/types/resources/ipAccount.ts b/packages/core-sdk/src/types/resources/ipAccount.ts index 1542a954..f91f9367 100644 --- a/packages/core-sdk/src/types/resources/ipAccount.ts +++ b/packages/core-sdk/src/types/resources/ipAccount.ts @@ -1,7 +1,7 @@ import { Address } from "viem"; import { TxOptions } from "../options"; -import { MethodEncode } from "../../abi/generated"; +import { EncodedTxData } from "../../abi/generated"; export type IPAccountExecuteRequest = { ipId: Address; @@ -13,7 +13,7 @@ export type IPAccountExecuteRequest = { export type IPAccountExecuteResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; }; export type IPAccountExecuteWithSigRequest = { @@ -29,5 +29,5 @@ export type IPAccountExecuteWithSigRequest = { export type IPAccountExecuteWithSigResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; }; diff --git a/packages/core-sdk/src/types/resources/ipAsset.ts b/packages/core-sdk/src/types/resources/ipAsset.ts index 51fa7476..8ebdb40d 100644 --- a/packages/core-sdk/src/types/resources/ipAsset.ts +++ b/packages/core-sdk/src/types/resources/ipAsset.ts @@ -2,7 +2,7 @@ import { Address, Hex } from "viem"; import { TxOptions } from "../options"; import { PIL_TYPE } from "./license"; -import { MethodEncode } from "../../abi/generated"; +import { EncodedTxData } from "../../abi/generated"; type Metadata = { metadata?: { @@ -14,7 +14,7 @@ type Metadata = { export type RegisterIpResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; ipId?: Address; }; @@ -33,7 +33,7 @@ export type RegisterDerivativeWithLicenseTokensRequest = { export type RegisterDerivativeWithLicenseTokensResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; }; export type RegisterDerivativeRequest = { @@ -46,7 +46,7 @@ export type RegisterDerivativeRequest = { export type RegisterDerivativeResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; childIpId?: Address; }; @@ -62,7 +62,7 @@ export type CreateIpAssetWithPilTermsRequest = { export type CreateIpAssetWithPilTermsResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; ipId?: Address; tokenId?: bigint; licenseTermsId?: bigint; @@ -82,7 +82,7 @@ export type RegisterIpAndMakeDerivativeRequest = { export type RegisterIpAndMakeDerivativeResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; ipId?: Address; }; @@ -99,7 +99,7 @@ export type RegisterIpAndAttachPilTermsRequest = { export type RegisterIpAndAttachPilTermsResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; ipId?: Address; licenseTermsId?: bigint; }; diff --git a/packages/core-sdk/src/types/resources/license.ts b/packages/core-sdk/src/types/resources/license.ts index 431c4b71..abeafd32 100644 --- a/packages/core-sdk/src/types/resources/license.ts +++ b/packages/core-sdk/src/types/resources/license.ts @@ -1,7 +1,7 @@ import { Address } from "viem"; import { TxOptions } from "../options"; -import { MethodEncode } from "../../abi/generated"; +import { EncodedTxData } from "../../abi/generated"; export type LicenseApiResponse = { data: License; @@ -41,7 +41,7 @@ export type LicenseTermsIdResponse = bigint; export type RegisterPILResponse = { licenseTermsId?: bigint; txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; }; export type RegisterCommercialUsePILRequest = { @@ -66,7 +66,7 @@ export type AttachLicenseTermsRequest = { export type AttachLicenseTermsResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; success?: boolean; }; @@ -82,7 +82,7 @@ export type MintLicenseTokensRequest = { export type MintLicenseTokensResponse = { licenseTokenIds?: bigint[]; txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; }; export enum PIL_TYPE { diff --git a/packages/core-sdk/src/types/resources/nftClient.ts b/packages/core-sdk/src/types/resources/nftClient.ts index d29c4549..880295d0 100644 --- a/packages/core-sdk/src/types/resources/nftClient.ts +++ b/packages/core-sdk/src/types/resources/nftClient.ts @@ -1,7 +1,7 @@ import { Hex } from "viem"; import { TxOptions } from "../options"; -import { MethodEncode } from "../../abi/generated"; +import { EncodedTxData } from "../../abi/generated"; export type CreateNFTCollectionRequest = { name: string; @@ -15,6 +15,6 @@ export type CreateNFTCollectionRequest = { export type CreateNFTCollectionResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; nftContract?: Hex; }; diff --git a/packages/core-sdk/src/types/resources/permission.ts b/packages/core-sdk/src/types/resources/permission.ts index 14b657af..2767c6f6 100644 --- a/packages/core-sdk/src/types/resources/permission.ts +++ b/packages/core-sdk/src/types/resources/permission.ts @@ -1,7 +1,7 @@ import { Address } from "viem"; import { TxOptions } from "../options"; -import { MethodEncode } from "../../abi/generated"; +import { EncodedTxData } from "../../abi/generated"; export type SetPermissionsRequest = { ipId: Address; @@ -14,7 +14,7 @@ export type SetPermissionsRequest = { export type SetPermissionsResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; success?: boolean; }; diff --git a/packages/core-sdk/src/types/resources/royalty.ts b/packages/core-sdk/src/types/resources/royalty.ts index 57257789..ae03166b 100644 --- a/packages/core-sdk/src/types/resources/royalty.ts +++ b/packages/core-sdk/src/types/resources/royalty.ts @@ -1,7 +1,7 @@ import { Address } from "viem"; import { TxOptions } from "../options"; -import { MethodEncode } from "../../abi/generated"; +import { EncodedTxData } from "../../abi/generated"; export type RoyaltyPolicyApiResponse = { data: RoyaltyPolicy; @@ -30,7 +30,7 @@ export type CollectRoyaltyTokensRequest = { export type CollectRoyaltyTokensResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; royaltyTokensCollected?: bigint; }; @@ -61,7 +61,7 @@ export type PayRoyaltyOnBehalfRequest = { export type PayRoyaltyOnBehalfResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; }; export type SnapshotRequest = { @@ -79,12 +79,12 @@ export type ClaimRevenueRequest = { export type ClaimRevenueResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; claimableToken?: bigint; }; export type SnapshotResponse = { txHash?: string; - encodedTxData?: MethodEncode; + encodedTxData?: EncodedTxData; snapshotId?: bigint; }; diff --git a/packages/wagmi-generator/sdk.ts b/packages/wagmi-generator/sdk.ts index 1a0287a3..cd260d92 100644 --- a/packages/wagmi-generator/sdk.ts +++ b/packages/wagmi-generator/sdk.ts @@ -259,9 +259,9 @@ function generateContractDataFunction(contractName: string, func: AbiFunction) { funcLine.push(` * method ${func.name} for contract ${contractName} with only encode`) funcLine.push(` *`) funcLine.push(` * @param request ${inName}`) - funcLine.push(` * @return MethodEncode`) + funcLine.push(` * @return EncodedTxData`) funcLine.push(`*/`) - funcLine.push(` public ${camelCase(indexFuncName)}Encode(${inParams}): MethodEncode {`) + funcLine.push(` public ${camelCase(indexFuncName)}Encode(${inParams}): EncodedTxData {`) funcLine.push(` return {`) funcLine.push(` to: this.address,`) funcLine.push(` data:encodeFunctionData({`) @@ -476,7 +476,7 @@ function generateCommon(config: SDKConfig) { file.push(` return address[chainId || 0] || '0x'`) file.push(`}`) file.push(``) - file.push(`export type MethodEncode = {to: Address, data: Hex}`) + file.push(`export type EncodedTxData = {to: Address, data: Hex}`) file.push(``) addImport('viem', 'Address', 'Hex') From 6c516c24a0877e63bd2b01a855b03d77cea929c9 Mon Sep 17 00:00:00 2001 From: haodi <82733821@qq.com> Date: Thu, 1 Aug 2024 16:24:19 +0800 Subject: [PATCH 5/5] add ipasset unit test case --- .../test/unit/resources/ipAsset.test.ts | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) diff --git a/packages/core-sdk/test/unit/resources/ipAsset.test.ts b/packages/core-sdk/test/unit/resources/ipAsset.test.ts index 50985403..abd16e0f 100644 --- a/packages/core-sdk/test/unit/resources/ipAsset.test.ts +++ b/packages/core-sdk/test/unit/resources/ipAsset.test.ts @@ -191,6 +191,41 @@ describe("Test IpAssetClient", () => { expect(response.ipId).equals("0xd142822Dc1674154EaF4DDF38bbF7EF8f0D8ECe4"); }); + it("should return encoded tx data when register a IP given correct args, encodedTxDataOnly is true and metadata", async () => { + sinon + .stub(ipAssetClient.ipAssetRegistryClient, "ipId") + .resolves("0xd142822Dc1674154EaF4DDF38bbF7EF8f0D8ECe4"); + sinon.stub(ipAssetClient.ipAssetRegistryClient, "isRegistered").resolves(false); + sinon + .stub(ipAssetClient.spgClient, "registerIp") + .resolves("0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997"); + sinon.stub(ipAssetClient.ipAssetRegistryClient, "parseTxIpRegisteredEvent").returns([ + { + ipId: "0xd142822Dc1674154EaF4DDF38bbF7EF8f0D8ECe4", + chainId: 0n, + tokenContract: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + tokenId: 0n, + name: "", + uri: "", + registrationDate: 0n, + }, + ]); + const response = await ipAssetClient.register({ + nftContract: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + tokenId: "3", + metadata: { + metadataURI: "", + metadataHash: zeroHash, + nftMetadataHash: zeroHash, + }, + txOptions: { + encodedTxDataOnly: true, + }, + }); + + expect(response.encodedTxData!.data).to.be.a("string").and.not.empty; + }); + it("should throw error when request fails", async () => { sinon .stub(ipAssetClient.ipAssetRegistryClient, "ipId") @@ -347,6 +382,34 @@ describe("Test IpAssetClient", () => { "0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997", ); }); + + it("should return encoded tx data when registerDerivative given correct childIpId, parentIpId, licenseTermsIds and encodedTxDataOnly of true ", async () => { + sinon + .stub(ipAssetClient.ipAssetRegistryClient, "isRegistered") + .onCall(0) + .resolves(true) + .onCall(1) + .resolves(true); + sinon + .stub(ipAssetClient.licenseRegistryReadOnlyClient, "hasIpAttachedLicenseTerms") + .resolves(true); + sinon + .stub(ipAssetClient.licensingModuleClient, "registerDerivative") + .resolves("0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997"); + + const res = await ipAssetClient.registerDerivative({ + childIpId: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + parentIpIds: ["0xd142822Dc1674154EaF4DDF38bbF7EF8f0D8ECe4"], + licenseTermsIds: ["1"], + licenseTemplate: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + txOptions: { + encodedTxDataOnly: true, + }, + }); + + expect(res.encodedTxData!.data).to.be.a("string").and.not.empty; + }); + }); describe("Test ipAssetClient.registerDerivativeWithLicenseTokens", async () => { @@ -436,6 +499,32 @@ describe("Test IpAssetClient", () => { "0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997", ); }); + + it("should return encoded tx data when registerDerivativeWithLicenseTokens given correct args and encodedTxDataOnly of true", async () => { + sinon + .stub(ipAssetClient.ipAssetRegistryClient, "isRegistered") + .onCall(0) + .resolves(true) + .onCall(1) + .resolves(true); + sinon + .stub(ipAssetClient.licenseTokenReadOnlyClient, "ownerOf") + .resolves("0x73fcb515cee99e4991465ef586cfe2b072ebb512"); + sinon + .stub(ipAssetClient.licensingModuleClient, "registerDerivativeWithLicenseTokens") + .resolves("0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997"); + + const res = await ipAssetClient.registerDerivativeWithLicenseTokens({ + childIpId: "0xd142822Dc1674154EaF4DDF38bbF7EF8f0D8ECe4", + licenseTokenIds: ["1"], + txOptions: { + encodedTxDataOnly: true, + }, + }); + + expect(res.encodedTxData!.data).to.be.a("string").and.not.empty; + }); + }); describe("Test ipAssetClient.createIpAssetWithPilTerms", async () => { @@ -481,6 +570,7 @@ describe("Test IpAssetClient", () => { expect(result.txHash).to.equal(hash); }); + it("should return ipId, tokenId, licenseTermsId,txHash when createIpAssetWithPilTerms given correct args and waitForTransaction of true", async () => { const hash = "0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997"; sinon.stub(ipAssetClient.spgClient, "mintAndRegisterIpAndAttachPilTerms").resolves(hash); @@ -519,6 +609,26 @@ describe("Test IpAssetClient", () => { expect(result.licenseTermsId).to.equal(0n); expect(result.tokenId).to.equal(1n); }); + + it("should return encoded tx data when createIpAssetWithPilTerms given correct args and encodedTxDataOnly is true", async () => { + const hash = "0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997"; + sinon.stub(ipAssetClient.spgClient, "mintAndRegisterIpAndAttachPilTerms").resolves(hash); + const result = await ipAssetClient.mintAndRegisterIpAssetWithPilTerms({ + nftContract: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + pilType: 0, + recipient: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + metadata: { + metadataURI: "", + metadataHash: toHex(0, { size: 32 }), + }, + txOptions: { + encodedTxDataOnly: true + } + }); + + expect(result.encodedTxData!.data).to.be.a("string").and.not.empty; + }); + }); describe("Test ipAssetClient.registerDerivativeIp", async () => { @@ -695,6 +805,49 @@ describe("Test IpAssetClient", () => { ); expect(res.ipId).equal("0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c"); }); + + it("should return encoded tx data when registerDerivativeIp given correct args and encodedTxDataOnly of true", async () => { + sinon + .stub(ipAssetClient.ipAssetRegistryClient, "ipId") + .resolves("0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c"); + sinon.stub(ipAssetClient.ipAssetRegistryClient, "isRegistered").resolves(false); + sinon + .stub(ipAssetClient.licenseRegistryReadOnlyClient, "hasIpAttachedLicenseTerms") + .resolves(true); + sinon + .stub(ipAssetClient.spgClient, "registerIpAndMakeDerivative") + .resolves("0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997"); + sinon.stub(ipAssetClient.ipAssetRegistryClient, "parseTxIpRegisteredEvent").returns([ + { + ipId: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + chainId: 0n, + tokenContract: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + tokenId: 1n, + name: "", + uri: "", + registrationDate: 0n, + }, + ]); + + const res = await ipAssetClient.registerDerivativeIp({ + nftContract: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + tokenId: "3", + derivData: { + parentIpIds: ["0xd142822Dc1674154EaF4DDF38bbF7EF8f0D8ECe4"], + licenseTermsIds: ["1"], + licenseTemplate: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + }, + metadata: { + metadataURI: "https://", + nftMetadataHash: toHex("nftMetadata", { size: 32 }), + }, + txOptions: { + encodedTxDataOnly: true, + }, + }); + + expect(res.encodedTxData!.data).to.be.a("string").and.not.empty; + }); }); describe("Test ipAssetClient.registerIpAndAttachPilTerms", async () => { @@ -807,5 +960,36 @@ describe("Test IpAssetClient", () => { expect(result.txHash).to.equal(hash); expect(result.ipId).to.equal("0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c"); }); + + it("should return encoded tx data when registerIpAndAttachPilTerms given correct args and encodedTxDataOnly of true", async () => { + const hash = "0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997"; + sinon + .stub(ipAssetClient.ipAssetRegistryClient, "ipId") + .resolves("0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c"); + sinon.stub(ipAssetClient.ipAssetRegistryClient, "isRegistered").resolves(false); + + sinon.stub(ipAssetClient.spgClient, "registerIpAndAttachPilTerms").resolves(hash); + sinon.stub(ipAssetClient.licensingModuleClient, "parseTxLicenseTermsAttachedEvent").returns([ + { + ipId: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + caller: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + licenseTemplate: "0x1daAE3197Bc469Cb97B917aa460a12dD95c6627c", + licenseTermsId: 0n, + }, + ]); + const result = await ipAssetClient.registerIpAndAttachPilTerms({ + nftContract: "0x1daAE3197Bc469Cb97B917aa460a12dD95c662ac", + tokenId: "3", + metadata: { + metadataURI: "https://", + }, + pilType: 0, + txOptions: { + encodedTxDataOnly: true, + }, + }); + + expect(result.encodedTxData!.data).to.be.a("string").and.not.empty; + }); }); });