Releases: storyprotocol/sdk
@story-protocol/core-sdk@1.3.0-beta.3
Migration
No changes required from v1.3.0.beta.2
Changes
- Support for Mainnet
StoryClient.newClient({
chainId: "mainnet", // or 1514
transport: http(RPC),
});
- Fixed an issue with ipAsset
batchRegister
not supportingipMetadata
- Fixed bug with
mintLicenseToken
not approving the correct spender for WIP usage - Wrapped IP token address is now exported.
WIP_TOKEN_ADDRESS
@story-protocol/core-sdk@1.3.0-beta.2
Migration
All previous SDK versions must be updated to v1.3.0.beta.2
to ensure full compatibility with POC v1.3 on aeneid
.
Migrating from v1.3.0.beta.1
- Update
chainId
fromhomer
toaeneid
when creating a new Story Client:
StoryClient.newClient({
chainId: "aeneid",
transport: http(RPC),
});
- If you are using
ipAsset.mintAndRegisterIpAndMakeDerivative
, note that the response fieldchildIpId
has been renamed toipId
.
Migrating from v1.2.x
Follow our migration guide.
Changes
Support for aeneid
Testnet
The homer
testnet has been renamed to aeneid
. You can find the latest RPC details here.
StoryClient.newClient({
chainId: "aeneid",
transport: http(RPC),
});
New Wrapped IP Client
The wip
client allows conversion between IP and WIP.
// IP -> WIP
const rsp = await client.wipClient.deposit({
amount,
txOptions: { waitForTransaction: true },
});
// WIP -> IP
const rsp = await client.wipClient.withdraw({
amount,
txOptions: { waitForTransaction: true },
});
Also check for WIP balance
await client.wipClient.balanceOf("0x0000000000000000000000000000000000000000");
New Royalty Method: claimAllRevenue
A new method, claimAllRevenue
, has been added to the Royalty module. It allows claiming all revenue from the child IPs of an ancestor IP.
If the wallet owns the IP and the claimer is the IP Account, all claimed tokens will be automatically transferred from the IP Account to the client’s wallet.
If any claimed tokens are WIP, they will be automatically converted back to IP unless disabled via options.
Disable IP Account Claims Transfer
Disable the SDK from trying to automatically transfer the claimed tokens from the IP Account back to your wallet.
await client.royalty.claimAllRevenue({
// ...other params
claimOptions: { autoTransferAllClaimedTokensFromIp:false }
});
Disable IP → WIP Conversion
To prevent automatic conversion of WIP to IP, override the following option.
await client.royalty.claimAllRevenue({
// ...other params
claimOptions: { autoUnwrapIpTokens: false }
});
Auto Wrapping IP
The SDK now supports automatic conversion of IP to WIP when a wallet lacks sufficient WIP to cover minting fees.
If the wallet does not have enough WIP
- The SDK will first convert IP → WIP, then approve the SPG contracts to use the WIP, and finally execute the SPG contract call.
- This process typically involves two or more transactions, but with Multicall, it is bundled into a single transaction for efficiency.
- Multicall is automatically enabled for all supported methods. Methods that do not currently support Multicall are listed under Supported Methods below.
If the wallet has enough WIP
- The SDK will use the available WIP directly.
- If the SPG contracts have not been approved to use the WIP, the SDK will include any necessary approval transactions automatically. Approvals are only needed once per SGP contract.
- Multicall is not yet supported for this flow, but future updates may enable it.
If the wallet lacks both WIP and IP
- An error will be thrown indicating insufficient funds.
Supported Methods
The following SDK methods support automatic IP → WIP conversion when minting fees in WIP is required. This behavior can be customized via wipOptions
:
license.mintLicenseTokens
- Pay license minting fee
ipAsset.mintAndRegisterIpAssetWithPilTerms
- Pay NFT minting fee
ipAsset.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens
- Pay NFT and license minting fee
- Does not support Multicall
ipAsset.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens
- Pay NFT and license minting fee
ipAsset.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens
- Pay NFT minting fee
ipAsset.registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens
- Pay license minting fee
- Does not support Multicall
ipAsset.registerDerivativeIp
- Pay license minting fee
- Does not support Multicall
ipAsset.mintAndRegisterIpAndMakeDerivative
- Pay NFT and license minting fee
ipAsset.payRoyaltyOnBehalf
- Auto convert IP -> WIP when paying royalty in WIP.
Disabling Auto Wrap IP
To disable automatic conversion of IP to WIP, set enableAutoWrapIp
to false
client.ipAsset.registerDerivativeIp({
wipOptions: { enableAutoWrapIp: false },
})
Disable Multicall
By default, the SDK batches transactions into a single Multicall when possible to reduces the number of contract calls (e.g., WIP deposit → WIP approve → SPG contract call). To disable this behavior:
client.ipAsset.registerDerivativeIp({
wipOptions: { useMulticallWhenPossible: false },
})
Disable Auto Approve
When WIP is required for IP registration or minting license tokens, the SDK automatically approves the SPG contracts to use the WIP. By default, the approval is set to max allowance when the current allowance is insufficient. To disable this behavior:
client.ipAsset.registerDerivativeIp({
wipOptions: { enableAutoApprove: false },
})
Other Changes
- Replaced permanent permissions with transient permissions. This this a required change for POC v1.3.
- Renamed
childIpId
toipId
in the response data formintAndRegisterIpAndMakeDerivative
, aligning it with other register functions likeregisterIpAndMakeDerivative
.