@campnetwork/origin 1.3.0-alpha.3 → 1.3.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +100 -68
- package/dist/core.d.ts +38 -3
- package/dist/core.esm.d.ts +38 -3
- package/dist/core.esm.js +92 -60
- package/dist/react/index.esm.d.ts +38 -3
- package/dist/react/index.esm.js +155 -8
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -433,11 +433,12 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
|
|
|
433
433
|
|
|
434
434
|
/**
|
|
435
435
|
* Raises a dispute against an IP NFT.
|
|
436
|
-
*
|
|
436
|
+
* Automatically handles token approval for ERC20 bonds or native token value.
|
|
437
|
+
* Includes the protocol dispute fee in the transaction.
|
|
437
438
|
*
|
|
438
439
|
* @param targetIpId The token ID of the IP NFT to dispute.
|
|
439
440
|
* @param evidenceHash The hash of evidence supporting the dispute.
|
|
440
|
-
* @param disputeTag A tag identifying the type of dispute.
|
|
441
|
+
* @param disputeTag A tag identifying the type of dispute (bytes32).
|
|
441
442
|
* @returns A promise that resolves with the transaction result including the dispute ID.
|
|
442
443
|
*
|
|
443
444
|
* @example
|
|
@@ -445,7 +446,7 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
|
|
|
445
446
|
* const result = await origin.raiseDispute(
|
|
446
447
|
* 1n,
|
|
447
448
|
* "0x1234...", // evidence hash
|
|
448
|
-
* "
|
|
449
|
+
* "0x0100000000000000000000000000000000000000000000000000000000000000" // dispute tag (bytes32)
|
|
449
450
|
* );
|
|
450
451
|
* ```
|
|
451
452
|
*/
|
|
@@ -679,6 +680,31 @@ interface DisputeProgress {
|
|
|
679
680
|
*/
|
|
680
681
|
declare function getDisputeProgress(this: Origin, disputeId: bigint): Promise<DisputeProgress>;
|
|
681
682
|
|
|
683
|
+
interface DisputeRequirements {
|
|
684
|
+
bondAmount: bigint;
|
|
685
|
+
protocolFee: bigint;
|
|
686
|
+
totalRequired: bigint;
|
|
687
|
+
tokenAddress: Address;
|
|
688
|
+
isNativeToken: boolean;
|
|
689
|
+
userBalance: bigint;
|
|
690
|
+
hasSufficientBalance: boolean;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Gets the requirements for raising a dispute, including balance check.
|
|
694
|
+
*
|
|
695
|
+
* @param userAddress The address to check balance for.
|
|
696
|
+
* @returns A promise that resolves with the dispute requirements.
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```typescript
|
|
700
|
+
* const requirements = await origin.getDisputeRequirements(walletAddress);
|
|
701
|
+
* if (!requirements.hasSufficientBalance) {
|
|
702
|
+
* console.log(`Need ${requirements.totalRequired} but only have ${requirements.userBalance}`);
|
|
703
|
+
* }
|
|
704
|
+
* ```
|
|
705
|
+
*/
|
|
706
|
+
declare function getDisputeRequirements(this: Origin, userAddress: Address): Promise<DisputeRequirements>;
|
|
707
|
+
|
|
682
708
|
/**
|
|
683
709
|
* Fractionalizes an IP NFT into fungible ERC20 tokens.
|
|
684
710
|
* The NFT is transferred to the fractionalizer contract and a new ERC20 token is created.
|
|
@@ -1057,6 +1083,7 @@ declare class Origin {
|
|
|
1057
1083
|
getDispute: typeof getDispute;
|
|
1058
1084
|
canVoteOnDispute: typeof canVoteOnDispute;
|
|
1059
1085
|
getDisputeProgress: typeof getDisputeProgress;
|
|
1086
|
+
getDisputeRequirements: typeof getDisputeRequirements;
|
|
1060
1087
|
fractionalize: typeof fractionalize;
|
|
1061
1088
|
redeem: typeof redeem;
|
|
1062
1089
|
getTokenForNFT: typeof getTokenForNFT;
|
|
@@ -1073,6 +1100,14 @@ declare class Origin {
|
|
|
1073
1100
|
constructor(environment?: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint, appId?: string);
|
|
1074
1101
|
getJwt(): string | undefined;
|
|
1075
1102
|
setViemClient(client: WalletClient): void;
|
|
1103
|
+
/**
|
|
1104
|
+
* Approves an ERC20 token for spending by a spender address if the current allowance is insufficient.
|
|
1105
|
+
* Waits for the approval transaction to be confirmed before returning.
|
|
1106
|
+
* @param tokenAddress The address of the ERC20 token.
|
|
1107
|
+
* @param spender The address that will be approved to spend the tokens.
|
|
1108
|
+
* @param amount The amount of tokens to approve.
|
|
1109
|
+
*/
|
|
1110
|
+
approveERC20IfNeeded(tokenAddress: Address, spender: Address, amount: bigint): Promise<void>;
|
|
1076
1111
|
/**
|
|
1077
1112
|
* Uploads a JSON object to IPFS and returns the resulting CID.
|
|
1078
1113
|
* @param data The JSON object to upload.
|
package/dist/core.esm.d.ts
CHANGED
|
@@ -433,11 +433,12 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
|
|
|
433
433
|
|
|
434
434
|
/**
|
|
435
435
|
* Raises a dispute against an IP NFT.
|
|
436
|
-
*
|
|
436
|
+
* Automatically handles token approval for ERC20 bonds or native token value.
|
|
437
|
+
* Includes the protocol dispute fee in the transaction.
|
|
437
438
|
*
|
|
438
439
|
* @param targetIpId The token ID of the IP NFT to dispute.
|
|
439
440
|
* @param evidenceHash The hash of evidence supporting the dispute.
|
|
440
|
-
* @param disputeTag A tag identifying the type of dispute.
|
|
441
|
+
* @param disputeTag A tag identifying the type of dispute (bytes32).
|
|
441
442
|
* @returns A promise that resolves with the transaction result including the dispute ID.
|
|
442
443
|
*
|
|
443
444
|
* @example
|
|
@@ -445,7 +446,7 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
|
|
|
445
446
|
* const result = await origin.raiseDispute(
|
|
446
447
|
* 1n,
|
|
447
448
|
* "0x1234...", // evidence hash
|
|
448
|
-
* "
|
|
449
|
+
* "0x0100000000000000000000000000000000000000000000000000000000000000" // dispute tag (bytes32)
|
|
449
450
|
* );
|
|
450
451
|
* ```
|
|
451
452
|
*/
|
|
@@ -679,6 +680,31 @@ interface DisputeProgress {
|
|
|
679
680
|
*/
|
|
680
681
|
declare function getDisputeProgress(this: Origin, disputeId: bigint): Promise<DisputeProgress>;
|
|
681
682
|
|
|
683
|
+
interface DisputeRequirements {
|
|
684
|
+
bondAmount: bigint;
|
|
685
|
+
protocolFee: bigint;
|
|
686
|
+
totalRequired: bigint;
|
|
687
|
+
tokenAddress: Address;
|
|
688
|
+
isNativeToken: boolean;
|
|
689
|
+
userBalance: bigint;
|
|
690
|
+
hasSufficientBalance: boolean;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Gets the requirements for raising a dispute, including balance check.
|
|
694
|
+
*
|
|
695
|
+
* @param userAddress The address to check balance for.
|
|
696
|
+
* @returns A promise that resolves with the dispute requirements.
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```typescript
|
|
700
|
+
* const requirements = await origin.getDisputeRequirements(walletAddress);
|
|
701
|
+
* if (!requirements.hasSufficientBalance) {
|
|
702
|
+
* console.log(`Need ${requirements.totalRequired} but only have ${requirements.userBalance}`);
|
|
703
|
+
* }
|
|
704
|
+
* ```
|
|
705
|
+
*/
|
|
706
|
+
declare function getDisputeRequirements(this: Origin, userAddress: Address): Promise<DisputeRequirements>;
|
|
707
|
+
|
|
682
708
|
/**
|
|
683
709
|
* Fractionalizes an IP NFT into fungible ERC20 tokens.
|
|
684
710
|
* The NFT is transferred to the fractionalizer contract and a new ERC20 token is created.
|
|
@@ -1057,6 +1083,7 @@ declare class Origin {
|
|
|
1057
1083
|
getDispute: typeof getDispute;
|
|
1058
1084
|
canVoteOnDispute: typeof canVoteOnDispute;
|
|
1059
1085
|
getDisputeProgress: typeof getDisputeProgress;
|
|
1086
|
+
getDisputeRequirements: typeof getDisputeRequirements;
|
|
1060
1087
|
fractionalize: typeof fractionalize;
|
|
1061
1088
|
redeem: typeof redeem;
|
|
1062
1089
|
getTokenForNFT: typeof getTokenForNFT;
|
|
@@ -1073,6 +1100,14 @@ declare class Origin {
|
|
|
1073
1100
|
constructor(environment?: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint, appId?: string);
|
|
1074
1101
|
getJwt(): string | undefined;
|
|
1075
1102
|
setViemClient(client: WalletClient): void;
|
|
1103
|
+
/**
|
|
1104
|
+
* Approves an ERC20 token for spending by a spender address if the current allowance is insufficient.
|
|
1105
|
+
* Waits for the approval transaction to be confirmed before returning.
|
|
1106
|
+
* @param tokenAddress The address of the ERC20 token.
|
|
1107
|
+
* @param spender The address that will be approved to spend the tokens.
|
|
1108
|
+
* @param amount The amount of tokens to approve.
|
|
1109
|
+
*/
|
|
1110
|
+
approveERC20IfNeeded(tokenAddress: Address, spender: Address, amount: bigint): Promise<void>;
|
|
1076
1111
|
/**
|
|
1077
1112
|
* Uploads a JSON object to IPFS and returns the resulting CID.
|
|
1078
1113
|
* @param data The JSON object to upload.
|