@campnetwork/origin 1.3.0-alpha.1 → 1.3.0-alpha.10

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.
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import React, { createContext, useState, useContext, useEffect, useLayoutEffect, useRef, useSyncExternalStore } from 'react';
3
- import { custom, createWalletClient, createPublicClient, http, encodeFunctionData, checksumAddress, zeroAddress, keccak256, toBytes, toHex, erc20Abi, getAbiItem, formatEther, formatUnits, parseEther } from 'viem';
3
+ import { custom, createWalletClient, createPublicClient, http, encodeFunctionData, checksumAddress, zeroAddress, keccak256, toBytes, erc20Abi, getAbiItem, formatEther, formatUnits, parseEther } from 'viem';
4
4
  import { toAccount } from 'viem/accounts';
5
5
  import { createSiweMessage } from 'viem/siwe';
6
6
  import axios from 'axios';
@@ -3695,1237 +3695,1237 @@ var batchPurchaseAbi = [
3695
3695
 
3696
3696
  var disputeAbi = [
3697
3697
  {
3698
- type: "constructor",
3699
3698
  inputs: [
3700
3699
  ],
3701
- stateMutability: "nonpayable"
3700
+ stateMutability: "nonpayable",
3701
+ type: "constructor"
3702
3702
  },
3703
3703
  {
3704
- type: "function",
3705
- name: "UPGRADE_INTERFACE_VERSION",
3706
3704
  inputs: [
3707
- ],
3708
- outputs: [
3709
3705
  {
3710
- name: "",
3711
- type: "string",
3712
- internalType: "string"
3706
+ internalType: "address",
3707
+ name: "target",
3708
+ type: "address"
3713
3709
  }
3714
3710
  ],
3715
- stateMutability: "view"
3711
+ name: "AddressEmptyCode",
3712
+ type: "error"
3716
3713
  },
3717
3714
  {
3718
- type: "function",
3719
- name: "cancelDispute",
3720
3715
  inputs: [
3721
- {
3722
- name: "id",
3723
- type: "uint256",
3724
- internalType: "uint256"
3725
- }
3726
3716
  ],
3727
- outputs: [
3717
+ name: "AlreadyVoted",
3718
+ type: "error"
3719
+ },
3720
+ {
3721
+ inputs: [
3728
3722
  ],
3729
- stateMutability: "nonpayable"
3723
+ name: "CoolDownPeriodActive",
3724
+ type: "error"
3725
+ },
3726
+ {
3727
+ inputs: [
3728
+ ],
3729
+ name: "CoolDownPeriodOver",
3730
+ type: "error"
3730
3731
  },
3731
3732
  {
3732
- type: "function",
3733
- name: "disputeAssertion",
3734
3733
  inputs: [
3735
3734
  {
3736
- name: "id",
3737
- type: "uint256",
3738
- internalType: "uint256"
3739
- },
3740
- {
3741
- name: "_counterEvidenceHash",
3742
- type: "bytes32",
3743
- internalType: "bytes32"
3735
+ internalType: "address",
3736
+ name: "implementation",
3737
+ type: "address"
3744
3738
  }
3745
3739
  ],
3746
- outputs: [
3747
- ],
3748
- stateMutability: "nonpayable"
3740
+ name: "ERC1967InvalidImplementation",
3741
+ type: "error"
3749
3742
  },
3750
3743
  {
3751
- type: "function",
3752
- name: "disputeBond",
3753
3744
  inputs: [
3754
3745
  ],
3755
- outputs: [
3756
- {
3757
- name: "",
3758
- type: "uint256",
3759
- internalType: "uint256"
3760
- }
3746
+ name: "ERC1967NonPayable",
3747
+ type: "error"
3748
+ },
3749
+ {
3750
+ inputs: [
3761
3751
  ],
3762
- stateMutability: "view"
3752
+ name: "EvidenceAlreadyUsed",
3753
+ type: "error"
3763
3754
  },
3764
3755
  {
3765
- type: "function",
3766
- name: "disputeCoolDownPeriod",
3767
3756
  inputs: [
3768
3757
  ],
3769
- outputs: [
3770
- {
3771
- name: "",
3772
- type: "uint256",
3773
- internalType: "uint256"
3774
- }
3758
+ name: "FailedCall",
3759
+ type: "error"
3760
+ },
3761
+ {
3762
+ inputs: [
3775
3763
  ],
3776
- stateMutability: "view"
3764
+ name: "InvalidBondFeeBps",
3765
+ type: "error"
3777
3766
  },
3778
3767
  {
3779
- type: "function",
3780
- name: "disputeCounter",
3781
3768
  inputs: [
3782
3769
  ],
3783
- outputs: [
3784
- {
3785
- name: "",
3786
- type: "uint256",
3787
- internalType: "uint256"
3788
- }
3770
+ name: "InvalidChildIpId",
3771
+ type: "error"
3772
+ },
3773
+ {
3774
+ inputs: [
3789
3775
  ],
3790
- stateMutability: "view"
3776
+ name: "InvalidDisputeStatus",
3777
+ type: "error"
3791
3778
  },
3792
3779
  {
3793
- type: "function",
3794
- name: "disputeJudgementPeriod",
3795
3780
  inputs: [
3796
3781
  ],
3797
- outputs: [
3798
- {
3799
- name: "",
3800
- type: "uint256",
3801
- internalType: "uint256"
3802
- }
3782
+ name: "InvalidDisputeTag",
3783
+ type: "error"
3784
+ },
3785
+ {
3786
+ inputs: [
3803
3787
  ],
3804
- stateMutability: "view"
3788
+ name: "InvalidEvidenceHash",
3789
+ type: "error"
3805
3790
  },
3806
3791
  {
3807
- type: "function",
3808
- name: "disputeQuorum",
3809
3792
  inputs: [
3810
3793
  ],
3811
- outputs: [
3812
- {
3813
- name: "",
3814
- type: "uint256",
3815
- internalType: "uint256"
3816
- }
3794
+ name: "InvalidInitialization",
3795
+ type: "error"
3796
+ },
3797
+ {
3798
+ inputs: [
3817
3799
  ],
3818
- stateMutability: "view"
3800
+ name: "InvalidTargetIp",
3801
+ type: "error"
3819
3802
  },
3820
3803
  {
3821
- type: "function",
3822
- name: "disputeToken",
3823
3804
  inputs: [
3824
3805
  ],
3825
- outputs: [
3826
- {
3827
- name: "",
3828
- type: "address",
3829
- internalType: "contract IERC20"
3830
- }
3806
+ name: "NoVotingPower",
3807
+ type: "error"
3808
+ },
3809
+ {
3810
+ inputs: [
3831
3811
  ],
3832
- stateMutability: "view"
3812
+ name: "NotAParentIp",
3813
+ type: "error"
3833
3814
  },
3834
3815
  {
3835
- type: "function",
3836
- name: "disputes",
3837
3816
  inputs: [
3838
- {
3839
- name: "",
3840
- type: "uint256",
3841
- internalType: "uint256"
3842
- }
3843
3817
  ],
3844
- outputs: [
3845
- {
3846
- name: "initiator",
3847
- type: "address",
3848
- internalType: "address"
3849
- },
3850
- {
3851
- name: "targetId",
3852
- type: "uint256",
3853
- internalType: "uint256"
3854
- },
3855
- {
3856
- name: "disputeTag",
3857
- type: "bytes32",
3858
- internalType: "bytes32"
3859
- },
3860
- {
3861
- name: "disputeEvidenceHash",
3862
- type: "bytes32",
3863
- internalType: "bytes32"
3864
- },
3865
- {
3866
- name: "counterEvidenceHash",
3867
- type: "bytes32",
3868
- internalType: "bytes32"
3869
- },
3870
- {
3871
- name: "disputeTimestamp",
3872
- type: "uint256",
3873
- internalType: "uint256"
3874
- },
3875
- {
3876
- name: "assertionTimestamp",
3877
- type: "uint256",
3878
- internalType: "uint256"
3879
- },
3880
- {
3881
- name: "yesVotes",
3882
- type: "uint256",
3883
- internalType: "uint256"
3884
- },
3885
- {
3886
- name: "noVotes",
3887
- type: "uint256",
3888
- internalType: "uint256"
3889
- },
3890
- {
3891
- name: "status",
3892
- type: "uint8",
3893
- internalType: "enum DisputeModule.DisputeStatus"
3894
- },
3895
- {
3896
- name: "bondAmount",
3897
- type: "uint256",
3898
- internalType: "uint256"
3899
- },
3900
- {
3901
- name: "protocolFeeAmount",
3902
- type: "uint256",
3903
- internalType: "uint256"
3904
- }
3818
+ name: "NotInitializing",
3819
+ type: "error"
3820
+ },
3821
+ {
3822
+ inputs: [
3905
3823
  ],
3906
- stateMutability: "view"
3824
+ name: "NotInitiator",
3825
+ type: "error"
3907
3826
  },
3908
3827
  {
3909
- type: "function",
3910
- name: "hasVoted",
3911
3828
  inputs: [
3912
- {
3913
- name: "",
3914
- type: "uint256",
3915
- internalType: "uint256"
3916
- },
3917
- {
3918
- name: "",
3919
- type: "address",
3920
- internalType: "address"
3921
- }
3922
3829
  ],
3923
- outputs: [
3830
+ name: "NotTokenOwner",
3831
+ type: "error"
3832
+ },
3833
+ {
3834
+ inputs: [
3924
3835
  {
3925
- name: "",
3926
- type: "bool",
3927
- internalType: "bool"
3836
+ internalType: "address",
3837
+ name: "owner",
3838
+ type: "address"
3928
3839
  }
3929
3840
  ],
3930
- stateMutability: "view"
3841
+ name: "OwnableInvalidOwner",
3842
+ type: "error"
3931
3843
  },
3932
3844
  {
3933
- type: "function",
3934
- name: "initialize",
3935
3845
  inputs: [
3936
3846
  {
3937
- name: "_ipToken",
3938
- type: "address",
3939
- internalType: "contract IIpNFT"
3940
- },
3941
- {
3942
- name: "_marketplace",
3943
- type: "address",
3944
- internalType: "contract IMarketplace"
3945
- },
3946
- {
3947
- name: "_disputeToken",
3948
- type: "address",
3949
- internalType: "contract IERC20"
3950
- },
3951
- {
3952
- name: "_disputeBond",
3953
- type: "uint256",
3954
- internalType: "uint256"
3955
- },
3956
- {
3957
- name: "_disputeCoolDownPeriod",
3958
- type: "uint256",
3959
- internalType: "uint256"
3960
- },
3961
- {
3962
- name: "_disputeJudgementPeriod",
3963
- type: "uint256",
3964
- internalType: "uint256"
3965
- },
3966
- {
3967
- name: "_bondFeeBPS",
3968
- type: "uint16",
3969
- internalType: "uint16"
3970
- },
3971
- {
3972
- name: "_stakingThreshold",
3973
- type: "uint256",
3974
- internalType: "uint256"
3975
- },
3976
- {
3977
- name: "_stakingVault",
3978
- type: "address",
3979
- internalType: "contract ICampStakingVault"
3847
+ internalType: "address",
3848
+ name: "account",
3849
+ type: "address"
3980
3850
  }
3981
3851
  ],
3982
- outputs: [
3983
- ],
3984
- stateMutability: "nonpayable"
3852
+ name: "OwnableUnauthorizedAccount",
3853
+ type: "error"
3985
3854
  },
3986
3855
  {
3987
- type: "function",
3988
- name: "ipToken",
3989
3856
  inputs: [
3990
3857
  ],
3991
- outputs: [
3992
- {
3993
- name: "",
3994
- type: "address",
3995
- internalType: "contract IIpNFT"
3996
- }
3997
- ],
3998
- stateMutability: "view"
3858
+ name: "ParentNotDisputed",
3859
+ type: "error"
3999
3860
  },
4000
3861
  {
4001
- type: "function",
4002
- name: "isUsedEvidenceHash",
4003
3862
  inputs: [
4004
- {
4005
- name: "",
4006
- type: "bytes32",
4007
- internalType: "bytes32"
4008
- }
4009
- ],
4010
- outputs: [
4011
- {
4012
- name: "",
4013
- type: "bool",
4014
- internalType: "bool"
4015
- }
4016
3863
  ],
4017
- stateMutability: "view"
3864
+ name: "SelfAssertionNotAllowed",
3865
+ type: "error"
4018
3866
  },
4019
3867
  {
4020
- type: "function",
4021
- name: "marketplace",
4022
3868
  inputs: [
4023
3869
  ],
4024
- outputs: [
4025
- {
4026
- name: "",
4027
- type: "address",
4028
- internalType: "contract IMarketplace"
4029
- }
4030
- ],
4031
- stateMutability: "view"
3870
+ name: "StakedAfterDispute",
3871
+ type: "error"
4032
3872
  },
4033
3873
  {
4034
- type: "function",
4035
- name: "owner",
4036
3874
  inputs: [
4037
3875
  ],
4038
- outputs: [
4039
- {
4040
- name: "",
4041
- type: "address",
4042
- internalType: "address"
4043
- }
4044
- ],
4045
- stateMutability: "view"
3876
+ name: "TagNotAllowed",
3877
+ type: "error"
4046
3878
  },
4047
3879
  {
4048
- type: "function",
4049
- name: "protocolDisputeFee",
4050
3880
  inputs: [
4051
3881
  ],
4052
- outputs: [
3882
+ name: "UUPSUnauthorizedCallContext",
3883
+ type: "error"
3884
+ },
3885
+ {
3886
+ inputs: [
4053
3887
  {
4054
- name: "",
4055
- type: "uint256",
4056
- internalType: "uint256"
3888
+ internalType: "bytes32",
3889
+ name: "slot",
3890
+ type: "bytes32"
4057
3891
  }
4058
3892
  ],
4059
- stateMutability: "view"
3893
+ name: "UUPSUnsupportedProxiableUUID",
3894
+ type: "error"
4060
3895
  },
4061
3896
  {
4062
- type: "function",
4063
- name: "proxiableUUID",
4064
3897
  inputs: [
4065
3898
  ],
4066
- outputs: [
4067
- {
4068
- name: "",
4069
- type: "bytes32",
4070
- internalType: "bytes32"
4071
- }
3899
+ name: "VotingPeriodActive",
3900
+ type: "error"
3901
+ },
3902
+ {
3903
+ inputs: [
4072
3904
  ],
4073
- stateMutability: "view"
3905
+ name: "VotingPeriodOver",
3906
+ type: "error"
4074
3907
  },
4075
3908
  {
4076
- type: "function",
4077
- name: "raiseDispute",
3909
+ anonymous: false,
4078
3910
  inputs: [
4079
3911
  {
4080
- name: "_targetIpId",
4081
- type: "uint256",
4082
- internalType: "uint256"
3912
+ indexed: true,
3913
+ internalType: "uint256",
3914
+ name: "tokenId",
3915
+ type: "uint256"
4083
3916
  },
4084
3917
  {
4085
- name: "_disputeEvidenceHash",
4086
- type: "bytes32",
4087
- internalType: "bytes32"
3918
+ indexed: true,
3919
+ internalType: "address",
3920
+ name: "buyer",
3921
+ type: "address"
4088
3922
  },
4089
3923
  {
4090
- name: "_disputeTag",
4091
- type: "bytes32",
4092
- internalType: "bytes32"
4093
- }
4094
- ],
4095
- outputs: [
3924
+ indexed: false,
3925
+ internalType: "uint32",
3926
+ name: "periods",
3927
+ type: "uint32"
3928
+ },
4096
3929
  {
4097
- name: "id",
4098
- type: "uint256",
4099
- internalType: "uint256"
3930
+ indexed: false,
3931
+ internalType: "uint256",
3932
+ name: "newExpiry",
3933
+ type: "uint256"
3934
+ },
3935
+ {
3936
+ indexed: false,
3937
+ internalType: "uint256",
3938
+ name: "amountPaid",
3939
+ type: "uint256"
4100
3940
  }
4101
3941
  ],
4102
- stateMutability: "nonpayable"
4103
- },
4104
- {
4105
- type: "function",
4106
- name: "renounceOwnership",
4107
- inputs: [
4108
- ],
4109
- outputs: [
4110
- ],
4111
- stateMutability: "nonpayable"
3942
+ name: "AccessPurchased",
3943
+ type: "event"
4112
3944
  },
4113
3945
  {
4114
- type: "function",
4115
- name: "resolveDispute",
3946
+ anonymous: false,
4116
3947
  inputs: [
4117
3948
  {
4118
- name: "id",
4119
- type: "uint256",
4120
- internalType: "uint256"
3949
+ indexed: true,
3950
+ internalType: "uint256",
3951
+ name: "agentId",
3952
+ type: "uint256"
3953
+ },
3954
+ {
3955
+ indexed: true,
3956
+ internalType: "uint256",
3957
+ name: "ipNftId",
3958
+ type: "uint256"
3959
+ },
3960
+ {
3961
+ indexed: false,
3962
+ internalType: "address",
3963
+ name: "agentAddress",
3964
+ type: "address"
4121
3965
  }
4122
3966
  ],
4123
- outputs: [
4124
- ],
4125
- stateMutability: "nonpayable"
3967
+ name: "AgentRegistered",
3968
+ type: "event"
4126
3969
  },
4127
3970
  {
4128
- type: "function",
4129
- name: "setDisputeQuorum",
3971
+ anonymous: false,
4130
3972
  inputs: [
4131
3973
  {
4132
- name: "_disputeQuorum",
4133
- type: "uint256",
4134
- internalType: "uint256"
3974
+ indexed: true,
3975
+ internalType: "address",
3976
+ name: "appRegistry",
3977
+ type: "address"
4135
3978
  }
4136
3979
  ],
4137
- outputs: [
4138
- ],
4139
- stateMutability: "nonpayable"
3980
+ name: "AppRegistryUpdated",
3981
+ type: "event"
4140
3982
  },
4141
3983
  {
4142
- type: "function",
4143
- name: "stakingThreshold",
3984
+ anonymous: false,
4144
3985
  inputs: [
4145
- ],
4146
- outputs: [
4147
3986
  {
4148
- name: "",
4149
- type: "uint256",
4150
- internalType: "uint256"
3987
+ indexed: true,
3988
+ internalType: "uint256",
3989
+ name: "id",
3990
+ type: "uint256"
3991
+ },
3992
+ {
3993
+ indexed: true,
3994
+ internalType: "uint256",
3995
+ name: "childIp",
3996
+ type: "uint256"
3997
+ },
3998
+ {
3999
+ indexed: false,
4000
+ internalType: "uint256",
4001
+ name: "parentIp",
4002
+ type: "uint256"
4151
4003
  }
4152
4004
  ],
4153
- stateMutability: "view"
4005
+ name: "ChildIpTagged",
4006
+ type: "event"
4154
4007
  },
4155
4008
  {
4156
- type: "function",
4157
- name: "stakingVault",
4009
+ anonymous: false,
4158
4010
  inputs: [
4159
- ],
4160
- outputs: [
4161
4011
  {
4162
- name: "",
4163
- type: "address",
4164
- internalType: "contract ICampStakingVault"
4012
+ indexed: true,
4013
+ internalType: "uint256",
4014
+ name: "tokenId",
4015
+ type: "uint256"
4016
+ },
4017
+ {
4018
+ indexed: true,
4019
+ internalType: "address",
4020
+ name: "creator",
4021
+ type: "address"
4165
4022
  }
4166
4023
  ],
4167
- stateMutability: "view"
4024
+ name: "DataDeleted",
4025
+ type: "event"
4168
4026
  },
4169
4027
  {
4170
- type: "function",
4171
- name: "tagChildIp",
4028
+ anonymous: false,
4172
4029
  inputs: [
4173
4030
  {
4174
- name: "_childIpId",
4175
- type: "uint256",
4176
- internalType: "uint256"
4031
+ indexed: true,
4032
+ internalType: "uint256",
4033
+ name: "tokenId",
4034
+ type: "uint256"
4177
4035
  },
4178
4036
  {
4179
- name: "_infringerDisputeId",
4180
- type: "uint256",
4181
- internalType: "uint256"
4037
+ indexed: true,
4038
+ internalType: "address",
4039
+ name: "creator",
4040
+ type: "address"
4041
+ },
4042
+ {
4043
+ indexed: false,
4044
+ internalType: "bytes32",
4045
+ name: "contentHash",
4046
+ type: "bytes32"
4047
+ },
4048
+ {
4049
+ indexed: false,
4050
+ internalType: "uint256[]",
4051
+ name: "parents",
4052
+ type: "uint256[]"
4182
4053
  }
4183
4054
  ],
4184
- outputs: [
4185
- ],
4186
- stateMutability: "nonpayable"
4055
+ name: "DataMinted",
4056
+ type: "event"
4187
4057
  },
4188
4058
  {
4189
- type: "function",
4190
- name: "transferOwnership",
4059
+ anonymous: false,
4191
4060
  inputs: [
4192
4061
  {
4193
- name: "newOwner",
4194
- type: "address",
4195
- internalType: "address"
4062
+ indexed: true,
4063
+ internalType: "uint256",
4064
+ name: "id",
4065
+ type: "uint256"
4066
+ },
4067
+ {
4068
+ indexed: false,
4069
+ internalType: "bytes32",
4070
+ name: "counterEvidenceHash",
4071
+ type: "bytes32"
4196
4072
  }
4197
4073
  ],
4198
- outputs: [
4199
- ],
4200
- stateMutability: "nonpayable"
4074
+ name: "DisputeAssertion",
4075
+ type: "event"
4201
4076
  },
4202
4077
  {
4203
- type: "function",
4204
- name: "upgradeToAndCall",
4078
+ anonymous: false,
4205
4079
  inputs: [
4206
4080
  {
4207
- name: "newImplementation",
4208
- type: "address",
4209
- internalType: "address"
4210
- },
4211
- {
4212
- name: "data",
4213
- type: "bytes",
4214
- internalType: "bytes"
4081
+ indexed: true,
4082
+ internalType: "uint256",
4083
+ name: "id",
4084
+ type: "uint256"
4215
4085
  }
4216
4086
  ],
4217
- outputs: [
4218
- ],
4219
- stateMutability: "payable"
4087
+ name: "DisputeCancelled",
4088
+ type: "event"
4220
4089
  },
4221
4090
  {
4222
- type: "function",
4223
- name: "voteOnDispute",
4091
+ anonymous: false,
4224
4092
  inputs: [
4225
4093
  {
4094
+ indexed: true,
4095
+ internalType: "uint256",
4226
4096
  name: "id",
4227
- type: "uint256",
4228
- internalType: "uint256"
4097
+ type: "uint256"
4229
4098
  },
4230
4099
  {
4231
- name: "support",
4232
- type: "bool",
4233
- internalType: "bool"
4100
+ indexed: false,
4101
+ internalType: "bool",
4102
+ name: "judgement",
4103
+ type: "bool"
4234
4104
  }
4235
4105
  ],
4236
- outputs: [
4237
- ],
4238
- stateMutability: "nonpayable"
4106
+ name: "DisputeJudged",
4107
+ type: "event"
4239
4108
  },
4240
4109
  {
4241
- type: "event",
4242
- name: "AccessPurchased",
4110
+ anonymous: false,
4243
4111
  inputs: [
4244
4112
  {
4245
- name: "tokenId",
4246
- type: "uint256",
4247
- indexed: true,
4248
- internalType: "uint256"
4249
- },
4250
- {
4251
- name: "buyer",
4252
- type: "address",
4253
4113
  indexed: true,
4254
- internalType: "address"
4255
- },
4256
- {
4257
- name: "periods",
4258
- type: "uint32",
4259
- indexed: false,
4260
- internalType: "uint32"
4261
- },
4262
- {
4263
- name: "newExpiry",
4264
- type: "uint256",
4265
- indexed: false,
4266
- internalType: "uint256"
4267
- },
4268
- {
4269
- name: "amountPaid",
4270
- type: "uint256",
4271
- indexed: false,
4272
- internalType: "uint256"
4114
+ internalType: "address",
4115
+ name: "disputeModule",
4116
+ type: "address"
4273
4117
  }
4274
4118
  ],
4275
- anonymous: false
4119
+ name: "DisputeModuleUpdated",
4120
+ type: "event"
4276
4121
  },
4277
4122
  {
4278
- type: "event",
4279
- name: "AgentRegistered",
4123
+ anonymous: false,
4280
4124
  inputs: [
4281
4125
  {
4282
- name: "agentId",
4283
- type: "uint256",
4284
4126
  indexed: true,
4285
- internalType: "uint256"
4127
+ internalType: "uint256",
4128
+ name: "id",
4129
+ type: "uint256"
4286
4130
  },
4287
4131
  {
4288
- name: "ipNftId",
4289
- type: "uint256",
4290
4132
  indexed: true,
4291
- internalType: "uint256"
4133
+ internalType: "address",
4134
+ name: "initiator",
4135
+ type: "address"
4136
+ },
4137
+ {
4138
+ indexed: true,
4139
+ internalType: "uint256",
4140
+ name: "targetId",
4141
+ type: "uint256"
4292
4142
  },
4293
4143
  {
4294
- name: "agentAddress",
4295
- type: "address",
4296
4144
  indexed: false,
4297
- internalType: "address"
4145
+ internalType: "bytes32",
4146
+ name: "disputeTag",
4147
+ type: "bytes32"
4298
4148
  }
4299
4149
  ],
4300
- anonymous: false
4150
+ name: "DisputeRaised",
4151
+ type: "event"
4301
4152
  },
4302
4153
  {
4303
- type: "event",
4304
- name: "AppRegistryUpdated",
4154
+ anonymous: false,
4305
4155
  inputs: [
4306
4156
  {
4307
- name: "appRegistry",
4308
- type: "address",
4309
- indexed: true,
4310
- internalType: "address"
4157
+ indexed: false,
4158
+ internalType: "uint64",
4159
+ name: "version",
4160
+ type: "uint64"
4311
4161
  }
4312
4162
  ],
4313
- anonymous: false
4163
+ name: "Initialized",
4164
+ type: "event"
4314
4165
  },
4315
4166
  {
4316
- type: "event",
4317
- name: "ChildIpTagged",
4167
+ anonymous: false,
4318
4168
  inputs: [
4319
4169
  {
4320
- name: "id",
4321
- type: "uint256",
4322
- indexed: true,
4323
- internalType: "uint256"
4324
- },
4325
- {
4326
- name: "childIp",
4327
- type: "uint256",
4328
4170
  indexed: true,
4329
- internalType: "uint256"
4330
- },
4331
- {
4332
- name: "parentIp",
4333
- type: "uint256",
4334
- indexed: false,
4335
- internalType: "uint256"
4171
+ internalType: "address",
4172
+ name: "marketPlace",
4173
+ type: "address"
4336
4174
  }
4337
4175
  ],
4338
- anonymous: false
4176
+ name: "MarketPlaceUpdated",
4177
+ type: "event"
4339
4178
  },
4340
4179
  {
4341
- type: "event",
4342
- name: "DataDeleted",
4180
+ anonymous: false,
4343
4181
  inputs: [
4344
4182
  {
4345
- name: "tokenId",
4346
- type: "uint256",
4347
4183
  indexed: true,
4348
- internalType: "uint256"
4184
+ internalType: "address",
4185
+ name: "previousOwner",
4186
+ type: "address"
4349
4187
  },
4350
4188
  {
4351
- name: "creator",
4352
- type: "address",
4353
4189
  indexed: true,
4354
- internalType: "address"
4190
+ internalType: "address",
4191
+ name: "newOwner",
4192
+ type: "address"
4355
4193
  }
4356
4194
  ],
4357
- anonymous: false
4195
+ name: "OwnershipTransferred",
4196
+ type: "event"
4358
4197
  },
4359
4198
  {
4360
- type: "event",
4361
- name: "DataMinted",
4199
+ anonymous: false,
4362
4200
  inputs: [
4363
4201
  {
4364
- name: "tokenId",
4365
- type: "uint256",
4366
- indexed: true,
4367
- internalType: "uint256"
4368
- },
4369
- {
4370
- name: "creator",
4371
- type: "address",
4372
4202
  indexed: true,
4373
- internalType: "address"
4203
+ internalType: "uint256",
4204
+ name: "childIpId",
4205
+ type: "uint256"
4374
4206
  },
4375
4207
  {
4376
- name: "contentHash",
4377
- type: "bytes32",
4378
4208
  indexed: false,
4379
- internalType: "bytes32"
4209
+ internalType: "uint256[]",
4210
+ name: "parentIds",
4211
+ type: "uint256[]"
4380
4212
  },
4381
4213
  {
4382
- name: "parents",
4383
- type: "uint256[]",
4384
4214
  indexed: false,
4385
- internalType: "uint256[]"
4215
+ internalType: "uint16",
4216
+ name: "totalRoyaltyBps",
4217
+ type: "uint16"
4386
4218
  }
4387
4219
  ],
4388
- anonymous: false
4220
+ name: "ParentIpsSet",
4221
+ type: "event"
4389
4222
  },
4390
4223
  {
4391
- type: "event",
4392
- name: "DisputeAssertion",
4224
+ anonymous: false,
4393
4225
  inputs: [
4394
4226
  {
4395
- name: "id",
4396
- type: "uint256",
4397
- indexed: true,
4398
- internalType: "uint256"
4399
- },
4400
- {
4401
- name: "counterEvidenceHash",
4402
- type: "bytes32",
4403
4227
  indexed: false,
4404
- internalType: "bytes32"
4228
+ internalType: "uint16",
4229
+ name: "newFeeBps",
4230
+ type: "uint16"
4405
4231
  }
4406
4232
  ],
4407
- anonymous: false
4233
+ name: "ProtocolFeeUpdated",
4234
+ type: "event"
4408
4235
  },
4409
4236
  {
4410
- type: "event",
4411
- name: "DisputeCancelled",
4237
+ anonymous: false,
4412
4238
  inputs: [
4413
4239
  {
4414
- name: "id",
4415
- type: "uint256",
4416
4240
  indexed: true,
4417
- internalType: "uint256"
4241
+ internalType: "uint256",
4242
+ name: "tokenId",
4243
+ type: "uint256"
4244
+ },
4245
+ {
4246
+ indexed: false,
4247
+ internalType: "uint256",
4248
+ name: "royaltyAmount",
4249
+ type: "uint256"
4250
+ },
4251
+ {
4252
+ indexed: false,
4253
+ internalType: "address",
4254
+ name: "creator",
4255
+ type: "address"
4256
+ },
4257
+ {
4258
+ indexed: false,
4259
+ internalType: "uint256",
4260
+ name: "protocolAmount",
4261
+ type: "uint256"
4418
4262
  }
4419
4263
  ],
4420
- anonymous: false
4264
+ name: "RoyaltyPaid",
4265
+ type: "event"
4421
4266
  },
4422
4267
  {
4423
- type: "event",
4424
- name: "DisputeJudged",
4268
+ anonymous: false,
4425
4269
  inputs: [
4426
4270
  {
4427
- name: "id",
4428
- type: "uint256",
4429
4271
  indexed: true,
4430
- internalType: "uint256"
4431
- },
4432
- {
4433
- name: "judgement",
4434
- type: "bool",
4435
- indexed: false,
4436
- internalType: "bool"
4272
+ internalType: "address",
4273
+ name: "signer",
4274
+ type: "address"
4437
4275
  }
4438
4276
  ],
4439
- anonymous: false
4277
+ name: "SignerUpdated",
4278
+ type: "event"
4440
4279
  },
4441
4280
  {
4442
- type: "event",
4443
- name: "DisputeModuleUpdated",
4281
+ anonymous: false,
4444
4282
  inputs: [
4445
4283
  {
4446
- name: "disputeModule",
4447
- type: "address",
4448
4284
  indexed: true,
4449
- internalType: "address"
4285
+ internalType: "uint256",
4286
+ name: "tokenId",
4287
+ type: "uint256"
4288
+ },
4289
+ {
4290
+ indexed: false,
4291
+ internalType: "enum IIpNFT.DataStatus",
4292
+ name: "status",
4293
+ type: "uint8"
4450
4294
  }
4451
4295
  ],
4452
- anonymous: false
4296
+ name: "StatusUpdated",
4297
+ type: "event"
4453
4298
  },
4454
4299
  {
4455
- type: "event",
4456
- name: "DisputeRaised",
4300
+ anonymous: false,
4457
4301
  inputs: [
4458
4302
  {
4459
- name: "id",
4460
- type: "uint256",
4461
4303
  indexed: true,
4462
- internalType: "uint256"
4304
+ internalType: "uint256",
4305
+ name: "tokenId",
4306
+ type: "uint256"
4463
4307
  },
4464
4308
  {
4465
- name: "initiator",
4466
- type: "address",
4467
- indexed: true,
4468
- internalType: "address"
4309
+ indexed: false,
4310
+ internalType: "uint128",
4311
+ name: "newPrice",
4312
+ type: "uint128"
4469
4313
  },
4470
4314
  {
4471
- name: "targetId",
4472
- type: "uint256",
4473
- indexed: true,
4474
- internalType: "uint256"
4315
+ indexed: false,
4316
+ internalType: "uint32",
4317
+ name: "newDuration",
4318
+ type: "uint32"
4475
4319
  },
4476
4320
  {
4477
- name: "disputeTag",
4478
- type: "bytes32",
4479
4321
  indexed: false,
4480
- internalType: "bytes32"
4481
- }
4482
- ],
4483
- anonymous: false
4484
- },
4485
- {
4486
- type: "event",
4487
- name: "Initialized",
4488
- inputs: [
4322
+ internalType: "uint16",
4323
+ name: "newRoyaltyBps",
4324
+ type: "uint16"
4325
+ },
4489
4326
  {
4490
- name: "version",
4491
- type: "uint64",
4492
4327
  indexed: false,
4493
- internalType: "uint64"
4328
+ internalType: "address",
4329
+ name: "paymentToken",
4330
+ type: "address"
4494
4331
  }
4495
4332
  ],
4496
- anonymous: false
4333
+ name: "TermsUpdated",
4334
+ type: "event"
4497
4335
  },
4498
4336
  {
4499
- type: "event",
4500
- name: "MarketPlaceUpdated",
4337
+ anonymous: false,
4501
4338
  inputs: [
4502
4339
  {
4503
- name: "marketPlace",
4504
- type: "address",
4505
4340
  indexed: true,
4506
- internalType: "address"
4341
+ internalType: "address",
4342
+ name: "newTreasury",
4343
+ type: "address"
4507
4344
  }
4508
4345
  ],
4509
- anonymous: false
4346
+ name: "TreasuryUpdated",
4347
+ type: "event"
4510
4348
  },
4511
4349
  {
4512
- type: "event",
4513
- name: "OwnershipTransferred",
4350
+ anonymous: false,
4514
4351
  inputs: [
4515
4352
  {
4516
- name: "previousOwner",
4517
- type: "address",
4518
- indexed: true,
4519
- internalType: "address"
4520
- },
4521
- {
4522
- name: "newOwner",
4523
- type: "address",
4524
4353
  indexed: true,
4525
- internalType: "address"
4354
+ internalType: "address",
4355
+ name: "implementation",
4356
+ type: "address"
4526
4357
  }
4527
4358
  ],
4528
- anonymous: false
4359
+ name: "Upgraded",
4360
+ type: "event"
4529
4361
  },
4530
4362
  {
4531
- type: "event",
4532
- name: "ParentIpsSet",
4363
+ anonymous: false,
4533
4364
  inputs: [
4534
4365
  {
4535
- name: "childIpId",
4536
- type: "uint256",
4537
4366
  indexed: true,
4538
- internalType: "uint256"
4367
+ internalType: "uint256",
4368
+ name: "id",
4369
+ type: "uint256"
4370
+ },
4371
+ {
4372
+ indexed: true,
4373
+ internalType: "address",
4374
+ name: "voter",
4375
+ type: "address"
4539
4376
  },
4540
4377
  {
4541
- name: "parentIds",
4542
- type: "uint256[]",
4543
4378
  indexed: false,
4544
- internalType: "uint256[]"
4379
+ internalType: "bool",
4380
+ name: "support",
4381
+ type: "bool"
4545
4382
  },
4546
4383
  {
4547
- name: "totalRoyaltyBps",
4548
- type: "uint16",
4549
4384
  indexed: false,
4550
- internalType: "uint16"
4385
+ internalType: "uint256",
4386
+ name: "weight",
4387
+ type: "uint256"
4551
4388
  }
4552
4389
  ],
4553
- anonymous: false
4390
+ name: "Voted",
4391
+ type: "event"
4554
4392
  },
4555
4393
  {
4556
- type: "event",
4557
- name: "ProtocolFeeUpdated",
4558
4394
  inputs: [
4395
+ ],
4396
+ name: "UPGRADE_INTERFACE_VERSION",
4397
+ outputs: [
4559
4398
  {
4560
- name: "newFeeBps",
4561
- type: "uint16",
4562
- indexed: false,
4563
- internalType: "uint16"
4399
+ internalType: "string",
4400
+ name: "",
4401
+ type: "string"
4564
4402
  }
4565
4403
  ],
4566
- anonymous: false
4404
+ stateMutability: "view",
4405
+ type: "function"
4567
4406
  },
4568
4407
  {
4569
- type: "event",
4570
- name: "RoyaltyPaid",
4571
4408
  inputs: [
4572
4409
  {
4573
- name: "tokenId",
4574
- type: "uint256",
4575
- indexed: true,
4576
- internalType: "uint256"
4577
- },
4578
- {
4579
- name: "royaltyAmount",
4580
- type: "uint256",
4581
- indexed: false,
4582
- internalType: "uint256"
4583
- },
4410
+ internalType: "uint256",
4411
+ name: "id",
4412
+ type: "uint256"
4413
+ }
4414
+ ],
4415
+ name: "cancelDispute",
4416
+ outputs: [
4417
+ ],
4418
+ stateMutability: "nonpayable",
4419
+ type: "function"
4420
+ },
4421
+ {
4422
+ inputs: [
4584
4423
  {
4585
- name: "creator",
4586
- type: "address",
4587
- indexed: false,
4588
- internalType: "address"
4424
+ internalType: "uint256",
4425
+ name: "id",
4426
+ type: "uint256"
4589
4427
  },
4590
4428
  {
4591
- name: "protocolAmount",
4592
- type: "uint256",
4593
- indexed: false,
4594
- internalType: "uint256"
4429
+ internalType: "bytes32",
4430
+ name: "_counterEvidenceHash",
4431
+ type: "bytes32"
4595
4432
  }
4596
4433
  ],
4597
- anonymous: false
4434
+ name: "disputeAssertion",
4435
+ outputs: [
4436
+ ],
4437
+ stateMutability: "nonpayable",
4438
+ type: "function"
4598
4439
  },
4599
4440
  {
4600
- type: "event",
4601
- name: "SignerUpdated",
4602
4441
  inputs: [
4442
+ ],
4443
+ name: "disputeBond",
4444
+ outputs: [
4603
4445
  {
4604
- name: "signer",
4605
- type: "address",
4606
- indexed: true,
4607
- internalType: "address"
4446
+ internalType: "uint256",
4447
+ name: "",
4448
+ type: "uint256"
4608
4449
  }
4609
4450
  ],
4610
- anonymous: false
4451
+ stateMutability: "view",
4452
+ type: "function"
4611
4453
  },
4612
4454
  {
4613
- type: "event",
4614
- name: "StatusUpdated",
4615
4455
  inputs: [
4456
+ ],
4457
+ name: "disputeCoolDownPeriod",
4458
+ outputs: [
4616
4459
  {
4617
- name: "tokenId",
4618
- type: "uint256",
4619
- indexed: true,
4620
- internalType: "uint256"
4621
- },
4622
- {
4623
- name: "status",
4624
- type: "uint8",
4625
- indexed: false,
4626
- internalType: "enum IIpNFT.DataStatus"
4460
+ internalType: "uint256",
4461
+ name: "",
4462
+ type: "uint256"
4627
4463
  }
4628
4464
  ],
4629
- anonymous: false
4465
+ stateMutability: "view",
4466
+ type: "function"
4630
4467
  },
4631
4468
  {
4632
- type: "event",
4633
- name: "TermsUpdated",
4634
4469
  inputs: [
4470
+ ],
4471
+ name: "disputeCounter",
4472
+ outputs: [
4635
4473
  {
4636
- name: "tokenId",
4637
- type: "uint256",
4638
- indexed: true,
4639
- internalType: "uint256"
4640
- },
4641
- {
4642
- name: "newPrice",
4643
- type: "uint128",
4644
- indexed: false,
4645
- internalType: "uint128"
4646
- },
4647
- {
4648
- name: "newDuration",
4649
- type: "uint32",
4650
- indexed: false,
4651
- internalType: "uint32"
4652
- },
4653
- {
4654
- name: "newRoyaltyBps",
4655
- type: "uint16",
4656
- indexed: false,
4657
- internalType: "uint16"
4658
- },
4474
+ internalType: "uint256",
4475
+ name: "",
4476
+ type: "uint256"
4477
+ }
4478
+ ],
4479
+ stateMutability: "view",
4480
+ type: "function"
4481
+ },
4482
+ {
4483
+ inputs: [
4484
+ ],
4485
+ name: "disputeJudgementPeriod",
4486
+ outputs: [
4659
4487
  {
4660
- name: "paymentToken",
4661
- type: "address",
4662
- indexed: false,
4663
- internalType: "address"
4488
+ internalType: "uint256",
4489
+ name: "",
4490
+ type: "uint256"
4664
4491
  }
4665
4492
  ],
4666
- anonymous: false
4493
+ stateMutability: "view",
4494
+ type: "function"
4667
4495
  },
4668
4496
  {
4669
- type: "event",
4670
- name: "TreasuryUpdated",
4671
4497
  inputs: [
4498
+ ],
4499
+ name: "disputeQuorum",
4500
+ outputs: [
4672
4501
  {
4673
- name: "newTreasury",
4674
- type: "address",
4675
- indexed: true,
4676
- internalType: "address"
4502
+ internalType: "uint256",
4503
+ name: "",
4504
+ type: "uint256"
4677
4505
  }
4678
4506
  ],
4679
- anonymous: false
4507
+ stateMutability: "view",
4508
+ type: "function"
4680
4509
  },
4681
4510
  {
4682
- type: "event",
4683
- name: "Upgraded",
4684
4511
  inputs: [
4512
+ ],
4513
+ name: "disputeToken",
4514
+ outputs: [
4685
4515
  {
4686
- name: "implementation",
4687
- type: "address",
4688
- indexed: true,
4689
- internalType: "address"
4516
+ internalType: "contract IERC20",
4517
+ name: "",
4518
+ type: "address"
4690
4519
  }
4691
4520
  ],
4692
- anonymous: false
4521
+ stateMutability: "view",
4522
+ type: "function"
4693
4523
  },
4694
4524
  {
4695
- type: "event",
4696
- name: "Voted",
4697
4525
  inputs: [
4698
4526
  {
4699
- name: "id",
4700
- type: "uint256",
4701
- indexed: true,
4702
- internalType: "uint256"
4527
+ internalType: "uint256",
4528
+ name: "",
4529
+ type: "uint256"
4530
+ }
4531
+ ],
4532
+ name: "disputes",
4533
+ outputs: [
4534
+ {
4535
+ internalType: "address",
4536
+ name: "initiator",
4537
+ type: "address"
4703
4538
  },
4704
4539
  {
4705
- name: "voter",
4706
- type: "address",
4707
- indexed: true,
4708
- internalType: "address"
4540
+ internalType: "uint256",
4541
+ name: "targetId",
4542
+ type: "uint256"
4709
4543
  },
4710
4544
  {
4711
- name: "support",
4712
- type: "bool",
4713
- indexed: false,
4714
- internalType: "bool"
4545
+ internalType: "bytes32",
4546
+ name: "disputeTag",
4547
+ type: "bytes32"
4715
4548
  },
4716
4549
  {
4717
- name: "weight",
4718
- type: "uint256",
4719
- indexed: false,
4720
- internalType: "uint256"
4550
+ internalType: "bytes32",
4551
+ name: "disputeEvidenceHash",
4552
+ type: "bytes32"
4553
+ },
4554
+ {
4555
+ internalType: "bytes32",
4556
+ name: "counterEvidenceHash",
4557
+ type: "bytes32"
4558
+ },
4559
+ {
4560
+ internalType: "uint256",
4561
+ name: "disputeTimestamp",
4562
+ type: "uint256"
4563
+ },
4564
+ {
4565
+ internalType: "uint256",
4566
+ name: "assertionTimestamp",
4567
+ type: "uint256"
4568
+ },
4569
+ {
4570
+ internalType: "uint256",
4571
+ name: "yesVotes",
4572
+ type: "uint256"
4573
+ },
4574
+ {
4575
+ internalType: "uint256",
4576
+ name: "noVotes",
4577
+ type: "uint256"
4578
+ },
4579
+ {
4580
+ internalType: "enum DisputeModule.DisputeStatus",
4581
+ name: "status",
4582
+ type: "uint8"
4583
+ },
4584
+ {
4585
+ internalType: "uint256",
4586
+ name: "bondAmount",
4587
+ type: "uint256"
4588
+ },
4589
+ {
4590
+ internalType: "uint256",
4591
+ name: "protocolFeeAmount",
4592
+ type: "uint256"
4721
4593
  }
4722
4594
  ],
4723
- anonymous: false
4595
+ stateMutability: "view",
4596
+ type: "function"
4724
4597
  },
4725
4598
  {
4726
- type: "error",
4727
- name: "AddressEmptyCode",
4728
4599
  inputs: [
4729
4600
  {
4730
- name: "target",
4731
- type: "address",
4732
- internalType: "address"
4601
+ internalType: "uint256",
4602
+ name: "",
4603
+ type: "uint256"
4604
+ },
4605
+ {
4606
+ internalType: "address",
4607
+ name: "",
4608
+ type: "address"
4733
4609
  }
4734
- ]
4735
- },
4736
- {
4737
- type: "error",
4738
- name: "AlreadyVoted",
4739
- inputs: [
4740
- ]
4741
- },
4742
- {
4743
- type: "error",
4744
- name: "CoolDownPeriodActive",
4745
- inputs: [
4746
- ]
4747
- },
4748
- {
4749
- type: "error",
4750
- name: "CoolDownPeriodOver",
4751
- inputs: [
4752
- ]
4753
- },
4754
- {
4755
- type: "error",
4756
- name: "ERC1967InvalidImplementation",
4757
- inputs: [
4610
+ ],
4611
+ name: "hasVoted",
4612
+ outputs: [
4758
4613
  {
4759
- name: "implementation",
4760
- type: "address",
4761
- internalType: "address"
4614
+ internalType: "bool",
4615
+ name: "",
4616
+ type: "bool"
4762
4617
  }
4763
- ]
4764
- },
4765
- {
4766
- type: "error",
4767
- name: "ERC1967NonPayable",
4768
- inputs: [
4769
- ]
4770
- },
4771
- {
4772
- type: "error",
4773
- name: "EvidenceAlreadyUsed",
4774
- inputs: [
4775
- ]
4776
- },
4777
- {
4778
- type: "error",
4779
- name: "FailedCall",
4780
- inputs: [
4781
- ]
4782
- },
4783
- {
4784
- type: "error",
4785
- name: "InvalidBondFeeBps",
4786
- inputs: [
4787
- ]
4788
- },
4789
- {
4790
- type: "error",
4791
- name: "InvalidChildIpId",
4792
- inputs: [
4793
- ]
4794
- },
4795
- {
4796
- type: "error",
4797
- name: "InvalidDisputeStatus",
4798
- inputs: [
4799
- ]
4618
+ ],
4619
+ stateMutability: "view",
4620
+ type: "function"
4800
4621
  },
4801
4622
  {
4802
- type: "error",
4803
- name: "InvalidDisputeTag",
4804
4623
  inputs: [
4805
- ]
4624
+ {
4625
+ internalType: "contract IIpNFT",
4626
+ name: "_ipToken",
4627
+ type: "address"
4628
+ },
4629
+ {
4630
+ internalType: "contract IMarketplace",
4631
+ name: "_marketplace",
4632
+ type: "address"
4633
+ },
4634
+ {
4635
+ internalType: "contract IERC20",
4636
+ name: "_disputeToken",
4637
+ type: "address"
4638
+ },
4639
+ {
4640
+ internalType: "uint256",
4641
+ name: "_disputeBond",
4642
+ type: "uint256"
4643
+ },
4644
+ {
4645
+ internalType: "uint256",
4646
+ name: "_disputeCoolDownPeriod",
4647
+ type: "uint256"
4648
+ },
4649
+ {
4650
+ internalType: "uint256",
4651
+ name: "_disputeJudgementPeriod",
4652
+ type: "uint256"
4653
+ },
4654
+ {
4655
+ internalType: "uint16",
4656
+ name: "_bondFeeBPS",
4657
+ type: "uint16"
4658
+ },
4659
+ {
4660
+ internalType: "uint256",
4661
+ name: "_stakingThreshold",
4662
+ type: "uint256"
4663
+ },
4664
+ {
4665
+ internalType: "contract ICampStakingVault",
4666
+ name: "_stakingVault",
4667
+ type: "address"
4668
+ }
4669
+ ],
4670
+ name: "initialize",
4671
+ outputs: [
4672
+ ],
4673
+ stateMutability: "nonpayable",
4674
+ type: "function"
4806
4675
  },
4807
4676
  {
4808
- type: "error",
4809
- name: "InvalidEvidenceHash",
4810
4677
  inputs: [
4811
- ]
4678
+ ],
4679
+ name: "ipToken",
4680
+ outputs: [
4681
+ {
4682
+ internalType: "contract IIpNFT",
4683
+ name: "",
4684
+ type: "address"
4685
+ }
4686
+ ],
4687
+ stateMutability: "view",
4688
+ type: "function"
4812
4689
  },
4813
4690
  {
4814
- type: "error",
4815
- name: "InvalidInitialization",
4816
4691
  inputs: [
4817
- ]
4818
- },
4819
- {
4820
- type: "error",
4821
- name: "InvalidTargetIp",
4822
- inputs: [
4823
- ]
4692
+ {
4693
+ internalType: "bytes32",
4694
+ name: "",
4695
+ type: "bytes32"
4696
+ }
4697
+ ],
4698
+ name: "isUsedEvidenceHash",
4699
+ outputs: [
4700
+ {
4701
+ internalType: "bool",
4702
+ name: "",
4703
+ type: "bool"
4704
+ }
4705
+ ],
4706
+ stateMutability: "view",
4707
+ type: "function"
4824
4708
  },
4825
4709
  {
4826
- type: "error",
4827
- name: "NoVotingPower",
4828
4710
  inputs: [
4829
- ]
4711
+ ],
4712
+ name: "marketplace",
4713
+ outputs: [
4714
+ {
4715
+ internalType: "contract IMarketplace",
4716
+ name: "",
4717
+ type: "address"
4718
+ }
4719
+ ],
4720
+ stateMutability: "view",
4721
+ type: "function"
4830
4722
  },
4831
4723
  {
4832
- type: "error",
4833
- name: "NotAParentIp",
4834
4724
  inputs: [
4835
- ]
4725
+ ],
4726
+ name: "owner",
4727
+ outputs: [
4728
+ {
4729
+ internalType: "address",
4730
+ name: "",
4731
+ type: "address"
4732
+ }
4733
+ ],
4734
+ stateMutability: "view",
4735
+ type: "function"
4836
4736
  },
4837
4737
  {
4838
- type: "error",
4839
- name: "NotInitializing",
4840
4738
  inputs: [
4841
- ]
4739
+ ],
4740
+ name: "protocolDisputeFee",
4741
+ outputs: [
4742
+ {
4743
+ internalType: "uint256",
4744
+ name: "",
4745
+ type: "uint256"
4746
+ }
4747
+ ],
4748
+ stateMutability: "view",
4749
+ type: "function"
4842
4750
  },
4843
4751
  {
4844
- type: "error",
4845
- name: "NotInitiator",
4846
4752
  inputs: [
4847
- ]
4753
+ ],
4754
+ name: "proxiableUUID",
4755
+ outputs: [
4756
+ {
4757
+ internalType: "bytes32",
4758
+ name: "",
4759
+ type: "bytes32"
4760
+ }
4761
+ ],
4762
+ stateMutability: "view",
4763
+ type: "function"
4848
4764
  },
4849
4765
  {
4850
- type: "error",
4851
- name: "NotTokenOwner",
4852
4766
  inputs: [
4853
- ]
4767
+ {
4768
+ internalType: "uint256",
4769
+ name: "_targetIpId",
4770
+ type: "uint256"
4771
+ },
4772
+ {
4773
+ internalType: "bytes32",
4774
+ name: "_disputeEvidenceHash",
4775
+ type: "bytes32"
4776
+ },
4777
+ {
4778
+ internalType: "bytes32",
4779
+ name: "_disputeTag",
4780
+ type: "bytes32"
4781
+ }
4782
+ ],
4783
+ name: "raiseDispute",
4784
+ outputs: [
4785
+ {
4786
+ internalType: "uint256",
4787
+ name: "id",
4788
+ type: "uint256"
4789
+ }
4790
+ ],
4791
+ stateMutability: "nonpayable",
4792
+ type: "function"
4854
4793
  },
4855
4794
  {
4856
- type: "error",
4857
- name: "OwnableInvalidOwner",
4858
4795
  inputs: [
4859
- {
4860
- name: "owner",
4861
- type: "address",
4862
- internalType: "address"
4863
- }
4864
- ]
4796
+ ],
4797
+ name: "renounceOwnership",
4798
+ outputs: [
4799
+ ],
4800
+ stateMutability: "nonpayable",
4801
+ type: "function"
4865
4802
  },
4866
4803
  {
4867
- type: "error",
4868
- name: "OwnableUnauthorizedAccount",
4869
4804
  inputs: [
4870
4805
  {
4871
- name: "account",
4872
- type: "address",
4873
- internalType: "address"
4806
+ internalType: "uint256",
4807
+ name: "id",
4808
+ type: "uint256"
4874
4809
  }
4875
- ]
4876
- },
4877
- {
4878
- type: "error",
4879
- name: "ParentNotDisputed",
4880
- inputs: [
4881
- ]
4810
+ ],
4811
+ name: "resolveDispute",
4812
+ outputs: [
4813
+ ],
4814
+ stateMutability: "nonpayable",
4815
+ type: "function"
4882
4816
  },
4883
4817
  {
4884
- type: "error",
4885
- name: "SelfAssertionNotAllowed",
4886
4818
  inputs: [
4887
- ]
4819
+ {
4820
+ internalType: "uint256",
4821
+ name: "_disputeQuorum",
4822
+ type: "uint256"
4823
+ }
4824
+ ],
4825
+ name: "setDisputeQuorum",
4826
+ outputs: [
4827
+ ],
4828
+ stateMutability: "nonpayable",
4829
+ type: "function"
4888
4830
  },
4889
4831
  {
4890
- type: "error",
4891
- name: "StakedAfterDispute",
4892
4832
  inputs: [
4893
- ]
4833
+ ],
4834
+ name: "stakingThreshold",
4835
+ outputs: [
4836
+ {
4837
+ internalType: "uint256",
4838
+ name: "",
4839
+ type: "uint256"
4840
+ }
4841
+ ],
4842
+ stateMutability: "view",
4843
+ type: "function"
4894
4844
  },
4895
4845
  {
4896
- type: "error",
4897
- name: "TagNotAllowed",
4898
4846
  inputs: [
4899
- ]
4847
+ ],
4848
+ name: "stakingVault",
4849
+ outputs: [
4850
+ {
4851
+ internalType: "contract ICampStakingVault",
4852
+ name: "",
4853
+ type: "address"
4854
+ }
4855
+ ],
4856
+ stateMutability: "view",
4857
+ type: "function"
4900
4858
  },
4901
4859
  {
4902
- type: "error",
4903
- name: "UUPSUnauthorizedCallContext",
4904
4860
  inputs: [
4905
- ]
4861
+ {
4862
+ internalType: "uint256",
4863
+ name: "_childIpId",
4864
+ type: "uint256"
4865
+ },
4866
+ {
4867
+ internalType: "uint256",
4868
+ name: "_infringerDisputeId",
4869
+ type: "uint256"
4870
+ }
4871
+ ],
4872
+ name: "tagChildIp",
4873
+ outputs: [
4874
+ ],
4875
+ stateMutability: "nonpayable",
4876
+ type: "function"
4906
4877
  },
4907
4878
  {
4908
- type: "error",
4909
- name: "UUPSUnsupportedProxiableUUID",
4910
4879
  inputs: [
4911
4880
  {
4912
- name: "slot",
4913
- type: "bytes32",
4914
- internalType: "bytes32"
4881
+ internalType: "address",
4882
+ name: "newOwner",
4883
+ type: "address"
4915
4884
  }
4916
- ]
4885
+ ],
4886
+ name: "transferOwnership",
4887
+ outputs: [
4888
+ ],
4889
+ stateMutability: "nonpayable",
4890
+ type: "function"
4917
4891
  },
4918
4892
  {
4919
- type: "error",
4920
- name: "VotingPeriodActive",
4921
4893
  inputs: [
4922
- ]
4894
+ {
4895
+ internalType: "address",
4896
+ name: "newImplementation",
4897
+ type: "address"
4898
+ },
4899
+ {
4900
+ internalType: "bytes",
4901
+ name: "data",
4902
+ type: "bytes"
4903
+ }
4904
+ ],
4905
+ name: "upgradeToAndCall",
4906
+ outputs: [
4907
+ ],
4908
+ stateMutability: "payable",
4909
+ type: "function"
4923
4910
  },
4924
4911
  {
4925
- type: "error",
4926
- name: "VotingPeriodOver",
4927
4912
  inputs: [
4928
- ]
4913
+ {
4914
+ internalType: "uint256",
4915
+ name: "id",
4916
+ type: "uint256"
4917
+ },
4918
+ {
4919
+ internalType: "bool",
4920
+ name: "support",
4921
+ type: "bool"
4922
+ }
4923
+ ],
4924
+ name: "voteOnDispute",
4925
+ outputs: [
4926
+ ],
4927
+ stateMutability: "nonpayable",
4928
+ type: "function"
4929
4929
  }
4930
4930
  ];
4931
4931
 
@@ -6789,11 +6789,12 @@ function getCurrentAccount() {
6789
6789
 
6790
6790
  /**
6791
6791
  * Raises a dispute against an IP NFT.
6792
- * Requires the caller to have the dispute bond amount in dispute tokens.
6792
+ * Automatically handles token approval for ERC20 bonds or native token value.
6793
+ * Includes the protocol dispute fee in the transaction.
6793
6794
  *
6794
6795
  * @param targetIpId The token ID of the IP NFT to dispute.
6795
6796
  * @param evidenceHash The hash of evidence supporting the dispute.
6796
- * @param disputeTag A tag identifying the type of dispute.
6797
+ * @param disputeTag A tag identifying the type of dispute (bytes32).
6797
6798
  * @returns A promise that resolves with the transaction result including the dispute ID.
6798
6799
  *
6799
6800
  * @example
@@ -6801,21 +6802,246 @@ function getCurrentAccount() {
6801
6802
  * const result = await origin.raiseDispute(
6802
6803
  * 1n,
6803
6804
  * "0x1234...", // evidence hash
6804
- * "0x5678..." // dispute tag (e.g., "infringement", "fraud")
6805
+ * "0x0100000000000000000000000000000000000000000000000000000000000000" // dispute tag (bytes32)
6805
6806
  * );
6806
6807
  * ```
6807
6808
  */
6808
6809
  function raiseDispute(targetIpId, evidenceHash, disputeTag) {
6809
6810
  return __awaiter(this, void 0, void 0, function* () {
6810
- return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS, this.environment.DISPUTE_ABI, "raiseDispute", [targetIpId, evidenceHash, disputeTag], { waitForReceipt: true });
6811
+ const publicClient = getPublicClient();
6812
+ const disputeContractAddress = this.environment
6813
+ .DISPUTE_CONTRACT_ADDRESS;
6814
+ const disputeAbi = this.environment.DISPUTE_ABI;
6815
+ // Get dispute bond amount, protocol fee, and token address from the contract
6816
+ const [disputeBond, protocolFee, disputeToken] = yield Promise.all([
6817
+ publicClient.readContract({
6818
+ address: disputeContractAddress,
6819
+ abi: disputeAbi,
6820
+ functionName: "disputeBond",
6821
+ }),
6822
+ publicClient.readContract({
6823
+ address: disputeContractAddress,
6824
+ abi: disputeAbi,
6825
+ functionName: "protocolDisputeFee",
6826
+ }),
6827
+ publicClient.readContract({
6828
+ address: disputeContractAddress,
6829
+ abi: disputeAbi,
6830
+ functionName: "disputeToken",
6831
+ }),
6832
+ ]);
6833
+ const isNativeToken = disputeToken === zeroAddress;
6834
+ const totalAmount = disputeBond + protocolFee;
6835
+ if (!isNativeToken) {
6836
+ // ERC20 token: approve the dispute contract to spend the total amount
6837
+ yield this.approveERC20IfNeeded(disputeToken, disputeContractAddress, totalAmount);
6838
+ }
6839
+ // Call the raiseDispute contract method
6840
+ // Pass the total (bond + protocol fee) as msg.value if using native token
6841
+ return this.callContractMethod(disputeContractAddress, disputeAbi, "raiseDispute", [targetIpId, evidenceHash, disputeTag], {
6842
+ waitForReceipt: true,
6843
+ value: isNativeToken ? totalAmount : undefined,
6844
+ });
6811
6845
  });
6812
6846
  }
6813
6847
 
6848
+ // base-x encoding / decoding
6849
+ // Copyright (c) 2018 base-x contributors
6850
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
6851
+ // Distributed under the MIT software license, see the accompanying
6852
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
6853
+ function base (ALPHABET) {
6854
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
6855
+ const BASE_MAP = new Uint8Array(256);
6856
+ for (let j = 0; j < BASE_MAP.length; j++) {
6857
+ BASE_MAP[j] = 255;
6858
+ }
6859
+ for (let i = 0; i < ALPHABET.length; i++) {
6860
+ const x = ALPHABET.charAt(i);
6861
+ const xc = x.charCodeAt(0);
6862
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
6863
+ BASE_MAP[xc] = i;
6864
+ }
6865
+ const BASE = ALPHABET.length;
6866
+ const LEADER = ALPHABET.charAt(0);
6867
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
6868
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
6869
+ function encode (source) {
6870
+ // eslint-disable-next-line no-empty
6871
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
6872
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
6873
+ } else if (Array.isArray(source)) {
6874
+ source = Uint8Array.from(source);
6875
+ }
6876
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
6877
+ if (source.length === 0) { return '' }
6878
+ // Skip & count leading zeroes.
6879
+ let zeroes = 0;
6880
+ let length = 0;
6881
+ let pbegin = 0;
6882
+ const pend = source.length;
6883
+ while (pbegin !== pend && source[pbegin] === 0) {
6884
+ pbegin++;
6885
+ zeroes++;
6886
+ }
6887
+ // Allocate enough space in big-endian base58 representation.
6888
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
6889
+ const b58 = new Uint8Array(size);
6890
+ // Process the bytes.
6891
+ while (pbegin !== pend) {
6892
+ let carry = source[pbegin];
6893
+ // Apply "b58 = b58 * 256 + ch".
6894
+ let i = 0;
6895
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
6896
+ carry += (256 * b58[it1]) >>> 0;
6897
+ b58[it1] = (carry % BASE) >>> 0;
6898
+ carry = (carry / BASE) >>> 0;
6899
+ }
6900
+ if (carry !== 0) { throw new Error('Non-zero carry') }
6901
+ length = i;
6902
+ pbegin++;
6903
+ }
6904
+ // Skip leading zeroes in base58 result.
6905
+ let it2 = size - length;
6906
+ while (it2 !== size && b58[it2] === 0) {
6907
+ it2++;
6908
+ }
6909
+ // Translate the result into a string.
6910
+ let str = LEADER.repeat(zeroes);
6911
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
6912
+ return str
6913
+ }
6914
+ function decodeUnsafe (source) {
6915
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
6916
+ if (source.length === 0) { return new Uint8Array() }
6917
+ let psz = 0;
6918
+ // Skip and count leading '1's.
6919
+ let zeroes = 0;
6920
+ let length = 0;
6921
+ while (source[psz] === LEADER) {
6922
+ zeroes++;
6923
+ psz++;
6924
+ }
6925
+ // Allocate enough space in big-endian base256 representation.
6926
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
6927
+ const b256 = new Uint8Array(size);
6928
+ // Process the characters.
6929
+ while (psz < source.length) {
6930
+ // Find code of next character
6931
+ const charCode = source.charCodeAt(psz);
6932
+ // Base map can not be indexed using char code
6933
+ if (charCode > 255) { return }
6934
+ // Decode character
6935
+ let carry = BASE_MAP[charCode];
6936
+ // Invalid character
6937
+ if (carry === 255) { return }
6938
+ let i = 0;
6939
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
6940
+ carry += (BASE * b256[it3]) >>> 0;
6941
+ b256[it3] = (carry % 256) >>> 0;
6942
+ carry = (carry / 256) >>> 0;
6943
+ }
6944
+ if (carry !== 0) { throw new Error('Non-zero carry') }
6945
+ length = i;
6946
+ psz++;
6947
+ }
6948
+ // Skip leading zeroes in b256.
6949
+ let it4 = size - length;
6950
+ while (it4 !== size && b256[it4] === 0) {
6951
+ it4++;
6952
+ }
6953
+ const vch = new Uint8Array(zeroes + (size - it4));
6954
+ let j = zeroes;
6955
+ while (it4 !== size) {
6956
+ vch[j++] = b256[it4++];
6957
+ }
6958
+ return vch
6959
+ }
6960
+ function decode (string) {
6961
+ const buffer = decodeUnsafe(string);
6962
+ if (buffer) { return buffer }
6963
+ throw new Error('Non-base' + BASE + ' character')
6964
+ }
6965
+ return {
6966
+ encode,
6967
+ decodeUnsafe,
6968
+ decode
6969
+ }
6970
+ }
6971
+
6972
+ var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
6973
+ var bs58 = base(ALPHABET);
6974
+
6975
+ // RFC 4648 base32 alphabet (lowercase)
6976
+ const BASE32_ALPHABET = "abcdefghijklmnopqrstuvwxyz234567";
6977
+ function base32Decode(str) {
6978
+ const lookup = {};
6979
+ for (let i = 0; i < BASE32_ALPHABET.length; i++) {
6980
+ lookup[BASE32_ALPHABET[i]] = i;
6981
+ }
6982
+ let bits = 0;
6983
+ let value = 0;
6984
+ const result = [];
6985
+ for (const char of str.toLowerCase()) {
6986
+ if (!(char in lookup)) {
6987
+ throw new Error(`Invalid base32 character: ${char}`);
6988
+ }
6989
+ value = (value << 5) | lookup[char];
6990
+ bits += 5;
6991
+ if (bits >= 8) {
6992
+ bits -= 8;
6993
+ result.push((value >> bits) & 0xff);
6994
+ }
6995
+ }
6996
+ return new Uint8Array(result);
6997
+ }
6998
+ /**
6999
+ * Encode a CID to bytes32 by extracting the 32-byte SHA-256 digest.
7000
+ * Supports both CIDv0 (starts with "Qm") and CIDv1 (starts with "bafy").
7001
+ */
7002
+ function encodeCidToBytes32(cid) {
7003
+ let digest;
7004
+ if (cid.startsWith("Qm")) {
7005
+ // CIDv0: base58-encoded multihash (0x1220 + 32-byte digest)
7006
+ const decoded = bs58.decode(cid);
7007
+ if (decoded[0] !== 0x12 || decoded[1] !== 0x20 || decoded.length !== 34) {
7008
+ throw new Error("Invalid CIDv0: expected SHA-256 multihash");
7009
+ }
7010
+ digest = decoded.slice(2);
7011
+ }
7012
+ else if (cid.startsWith("b")) {
7013
+ // CIDv1: multibase 'b' prefix + base32-encoded (version + codec + multihash)
7014
+ const decoded = base32Decode(cid.slice(1));
7015
+ // CIDv1 structure: version (1 byte) + codec (varint) + multihash
7016
+ // For raw codec with sha2-256: 0x01 + 0x55 + 0x12 + 0x20 + 32-byte digest
7017
+ // For dag-pb with sha2-256: 0x01 + 0x70 + 0x12 + 0x20 + 32-byte digest
7018
+ if (decoded[0] !== 0x01 || decoded.length !== 36) {
7019
+ throw new Error("Invalid CIDv1: expected version 1 with 36 bytes");
7020
+ }
7021
+ const codec = decoded[1];
7022
+ if (codec !== 0x55 && codec !== 0x70) {
7023
+ throw new Error(`Invalid CIDv1: unsupported codec 0x${codec.toString(16)}`);
7024
+ }
7025
+ if (decoded[2] !== 0x12 || decoded[3] !== 0x20) {
7026
+ throw new Error("Invalid CIDv1: expected SHA-256 hash");
7027
+ }
7028
+ digest = decoded.slice(4);
7029
+ }
7030
+ else {
7031
+ throw new Error("Unsupported CID format: must start with 'Qm' or 'b'");
7032
+ }
7033
+ return `0x${Buffer.from(digest).toString("hex")}`;
7034
+ }
7035
+
6814
7036
  /**
6815
7037
  * Raises a dispute with automatic evidence upload to IPFS.
6816
- * Uploads evidence JSON to IPFS, hashes the CID to bytes32 for on-chain storage,
7038
+ * Uploads evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
6817
7039
  * and calls raiseDispute.
6818
7040
  *
7041
+ * The CID is encoded by stripping the 0x1220 multihash prefix from CIDv0,
7042
+ * leaving only the 32-byte SHA-256 digest. This encoding is reversible,
7043
+ * allowing the original CID to be reconstructed from the on-chain data.
7044
+ *
6819
7045
  * @param targetIpId The token ID of the IP NFT to dispute.
6820
7046
  * @param evidence The evidence JSON object to upload to IPFS.
6821
7047
  * @param disputeTag A tag identifying the type of dispute.
@@ -6829,19 +7055,17 @@ function raiseDispute(targetIpId, evidenceHash, disputeTag) {
6829
7055
  * "0x696e6672696e67656d656e74..." // dispute tag
6830
7056
  * );
6831
7057
  *
6832
- * // Store the CID for evidence retrieval
7058
+ * // The CID can be recovered from evidenceHash using decodeCidFromBytes32
6833
7059
  * console.log("Evidence CID:", result.evidenceCid);
6834
7060
  *
6835
- * // Fetch evidence later via IPFS gateway
7061
+ * // Fetch evidence via IPFS gateway
6836
7062
  * // https://ipfs.io/ipfs/{result.evidenceCid}
6837
- *
6838
- * // Verify evidence hash matches on-chain: keccak256(toHex(evidenceCid)) === evidenceHash
6839
7063
  * ```
6840
7064
  */
6841
7065
  function raiseDisputeSmart(targetIpId, evidence, disputeTag) {
6842
7066
  return __awaiter(this, void 0, void 0, function* () {
6843
7067
  const cid = yield this.uploadJSONToIPFS(evidence);
6844
- const evidenceHash = keccak256(toHex(cid));
7068
+ const evidenceHash = encodeCidToBytes32(cid);
6845
7069
  const transactionResult = yield this.raiseDispute(targetIpId, evidenceHash, disputeTag);
6846
7070
  return {
6847
7071
  transactionResult,
@@ -6870,6 +7094,48 @@ function disputeAssertion(disputeId, counterEvidenceHash) {
6870
7094
  });
6871
7095
  }
6872
7096
 
7097
+ /**
7098
+ * Asserts a dispute with automatic counter-evidence upload to IPFS.
7099
+ * Uploads counter-evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
7100
+ * and calls disputeAssertion.
7101
+ *
7102
+ * The CID is encoded by stripping the 0x1220 multihash prefix from CIDv0,
7103
+ * leaving only the 32-byte SHA-256 digest. This encoding is reversible,
7104
+ * allowing the original CID to be reconstructed from the on-chain data.
7105
+ *
7106
+ * Must be called by the owner of the disputed IP within the cooldown period.
7107
+ *
7108
+ * @param disputeId The ID of the dispute to assert.
7109
+ * @param counterEvidence The counter-evidence JSON object to upload to IPFS.
7110
+ * @returns A promise that resolves with the transaction result, IPFS CID, and counter-evidence hash.
7111
+ *
7112
+ * @example
7113
+ * ```typescript
7114
+ * const result = await origin.disputeAssertionSmart(
7115
+ * 1n,
7116
+ * { description: "This is my original work", proofUrl: "https://..." }
7117
+ * );
7118
+ *
7119
+ * // The CID can be recovered from counterEvidenceHash using decodeCidFromBytes32
7120
+ * console.log("Counter-evidence CID:", result.counterEvidenceCid);
7121
+ *
7122
+ * // Fetch counter-evidence via IPFS gateway
7123
+ * // https://ipfs.io/ipfs/{result.counterEvidenceCid}
7124
+ * ```
7125
+ */
7126
+ function disputeAssertionSmart(disputeId, counterEvidence) {
7127
+ return __awaiter(this, void 0, void 0, function* () {
7128
+ const cid = yield this.uploadJSONToIPFS(counterEvidence);
7129
+ const counterEvidenceHash = encodeCidToBytes32(cid);
7130
+ const transactionResult = yield this.disputeAssertion(disputeId, counterEvidenceHash);
7131
+ return {
7132
+ transactionResult,
7133
+ counterEvidenceCid: cid,
7134
+ counterEvidenceHash,
7135
+ };
7136
+ });
7137
+ }
7138
+
6873
7139
  /**
6874
7140
  * Votes on a dispute as a CAMP token staker.
6875
7141
  * Only users who staked before the dispute was raised can vote.
@@ -6969,7 +7235,23 @@ function tagChildIp(childIpId, infringerDisputeId) {
6969
7235
  */
6970
7236
  function getDispute(disputeId) {
6971
7237
  return __awaiter(this, void 0, void 0, function* () {
6972
- return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS, this.environment.DISPUTE_ABI, "disputes", [disputeId]);
7238
+ const result = yield this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS, this.environment.DISPUTE_ABI, "disputes", [disputeId]);
7239
+ // Contract returns a tuple, map it to the Dispute interface
7240
+ const [initiator, targetId, disputeTag, disputeEvidenceHash, counterEvidenceHash, disputeTimestamp, assertionTimestamp, yesVotes, noVotes, status, bondAmount, protocolFeeAmount,] = result;
7241
+ return {
7242
+ initiator,
7243
+ targetId,
7244
+ disputeTag,
7245
+ disputeEvidenceHash,
7246
+ counterEvidenceHash,
7247
+ disputeTimestamp,
7248
+ assertionTimestamp,
7249
+ yesVotes,
7250
+ noVotes,
7251
+ status: status,
7252
+ bondAmount,
7253
+ protocolFeeAmount,
7254
+ };
6973
7255
  });
6974
7256
  }
6975
7257
 
@@ -7251,6 +7533,71 @@ function getDisputeProgress(disputeId) {
7251
7533
  });
7252
7534
  }
7253
7535
 
7536
+ /**
7537
+ * Gets the requirements for raising a dispute, including balance check.
7538
+ *
7539
+ * @param userAddress The address to check balance for.
7540
+ * @returns A promise that resolves with the dispute requirements.
7541
+ *
7542
+ * @example
7543
+ * ```typescript
7544
+ * const requirements = await origin.getDisputeRequirements(walletAddress);
7545
+ * if (!requirements.hasSufficientBalance) {
7546
+ * console.log(`Need ${requirements.totalRequired} but only have ${requirements.userBalance}`);
7547
+ * }
7548
+ * ```
7549
+ */
7550
+ function getDisputeRequirements(userAddress) {
7551
+ return __awaiter(this, void 0, void 0, function* () {
7552
+ const publicClient = getPublicClient();
7553
+ const disputeContractAddress = this.environment
7554
+ .DISPUTE_CONTRACT_ADDRESS;
7555
+ const disputeAbi = this.environment.DISPUTE_ABI;
7556
+ // Get dispute parameters from the contract
7557
+ const [bondAmount, protocolFee, tokenAddress] = yield Promise.all([
7558
+ publicClient.readContract({
7559
+ address: disputeContractAddress,
7560
+ abi: disputeAbi,
7561
+ functionName: "disputeBond",
7562
+ }),
7563
+ publicClient.readContract({
7564
+ address: disputeContractAddress,
7565
+ abi: disputeAbi,
7566
+ functionName: "protocolDisputeFee",
7567
+ }),
7568
+ publicClient.readContract({
7569
+ address: disputeContractAddress,
7570
+ abi: disputeAbi,
7571
+ functionName: "disputeToken",
7572
+ }),
7573
+ ]);
7574
+ const isNativeToken = tokenAddress === zeroAddress;
7575
+ const totalRequired = bondAmount + protocolFee;
7576
+ // Get user's balance
7577
+ let userBalance;
7578
+ if (isNativeToken) {
7579
+ userBalance = yield publicClient.getBalance({ address: userAddress });
7580
+ }
7581
+ else {
7582
+ userBalance = (yield publicClient.readContract({
7583
+ address: tokenAddress,
7584
+ abi: erc20Abi,
7585
+ functionName: "balanceOf",
7586
+ args: [userAddress],
7587
+ }));
7588
+ }
7589
+ return {
7590
+ bondAmount,
7591
+ protocolFee,
7592
+ totalRequired,
7593
+ tokenAddress,
7594
+ isNativeToken,
7595
+ userBalance,
7596
+ hasSufficientBalance: userBalance >= totalRequired,
7597
+ };
7598
+ });
7599
+ }
7600
+
7254
7601
  /**
7255
7602
  * Fractionalizes an IP NFT into fungible ERC20 tokens.
7256
7603
  * The NFT is transferred to the fractionalizer contract and a new ERC20 token is created.
@@ -7622,10 +7969,11 @@ function getAppInfo(appId) {
7622
7969
  /**
7623
7970
  * Approves a spender to spend a specified amount of tokens on behalf of the owner.
7624
7971
  * If the current allowance is less than the specified amount, it will perform the approval.
7972
+ * Waits for the approval transaction to be confirmed before returning.
7625
7973
  * @param {ApproveParams} params - The parameters for the approval.
7626
7974
  */
7627
7975
  function approveIfNeeded(_a) {
7628
- return __awaiter(this, arguments, void 0, function* ({ walletClient, publicClient, tokenAddress, owner, spender, amount, }) {
7976
+ return __awaiter(this, arguments, void 0, function* ({ walletClient, publicClient, tokenAddress, owner, spender, amount, chain, }) {
7629
7977
  const allowance = yield publicClient.readContract({
7630
7978
  address: tokenAddress,
7631
7979
  abi: erc20Abi,
@@ -7633,14 +7981,21 @@ function approveIfNeeded(_a) {
7633
7981
  args: [owner, spender],
7634
7982
  });
7635
7983
  if (allowance < amount) {
7636
- yield walletClient.writeContract({
7984
+ const txHash = yield walletClient.writeContract({
7637
7985
  address: tokenAddress,
7638
7986
  account: owner,
7639
7987
  abi: erc20Abi,
7640
7988
  functionName: "approve",
7641
7989
  args: [spender, amount],
7642
- chain: testnet,
7990
+ chain,
7643
7991
  });
7992
+ // Wait for the approval transaction to be confirmed with extra confirmations
7993
+ yield publicClient.waitForTransactionReceipt({
7994
+ hash: txHash,
7995
+ confirmations: 2,
7996
+ });
7997
+ // Small delay to ensure RPC nodes have synced the new state
7998
+ yield new Promise((resolve) => setTimeout(resolve, 1000));
7644
7999
  }
7645
8000
  });
7646
8001
  }
@@ -7809,6 +8164,7 @@ function bulkBuyAccessSmart(tokenIds, options) {
7809
8164
  owner: buyer,
7810
8165
  spender: this.environment.BATCH_PURCHASE_CONTRACT_ADDRESS,
7811
8166
  amount: erc20.amount,
8167
+ chain: this.environment.CHAIN,
7812
8168
  });
7813
8169
  }
7814
8170
  // Execute the purchase
@@ -7877,6 +8233,7 @@ class Origin {
7877
8233
  this.raiseDispute = raiseDispute.bind(this);
7878
8234
  this.raiseDisputeSmart = raiseDisputeSmart.bind(this);
7879
8235
  this.disputeAssertion = disputeAssertion.bind(this);
8236
+ this.disputeAssertionSmart = disputeAssertionSmart.bind(this);
7880
8237
  this.voteOnDispute = voteOnDispute.bind(this);
7881
8238
  this.resolveDispute = resolveDispute.bind(this);
7882
8239
  this.cancelDispute = cancelDispute.bind(this);
@@ -7884,6 +8241,7 @@ class Origin {
7884
8241
  this.getDispute = getDispute.bind(this);
7885
8242
  this.canVoteOnDispute = canVoteOnDispute.bind(this);
7886
8243
  this.getDisputeProgress = getDisputeProgress.bind(this);
8244
+ this.getDisputeRequirements = getDisputeRequirements.bind(this);
7887
8245
  // Fractionalizer module methods
7888
8246
  this.fractionalize = fractionalize.bind(this);
7889
8247
  this.redeem = redeem.bind(this);
@@ -7901,6 +8259,27 @@ class Origin {
7901
8259
  setViemClient(client) {
7902
8260
  this.viemClient = client;
7903
8261
  }
8262
+ /**
8263
+ * Approves an ERC20 token for spending by a spender address if the current allowance is insufficient.
8264
+ * Waits for the approval transaction to be confirmed before returning.
8265
+ * @param tokenAddress The address of the ERC20 token.
8266
+ * @param spender The address that will be approved to spend the tokens.
8267
+ * @param amount The amount of tokens to approve.
8268
+ */
8269
+ approveERC20IfNeeded(tokenAddress, spender, amount) {
8270
+ return __awaiter(this, void 0, void 0, function* () {
8271
+ const account = yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_resolveWalletAddress).call(this);
8272
+ yield approveIfNeeded({
8273
+ walletClient: this.viemClient,
8274
+ publicClient: getPublicClient(),
8275
+ tokenAddress,
8276
+ owner: account,
8277
+ spender,
8278
+ amount,
8279
+ chain: this.environment.CHAIN,
8280
+ });
8281
+ });
8282
+ }
7904
8283
  /**
7905
8284
  * Uploads a JSON object to IPFS and returns the resulting CID.
7906
8285
  * @param data The JSON object to upload.
@@ -8257,6 +8636,7 @@ class Origin {
8257
8636
  owner: account,
8258
8637
  spender: this.environment.MARKETPLACE_CONTRACT_ADDRESS,
8259
8638
  amount: totalCost,
8639
+ chain: this.environment.CHAIN,
8260
8640
  });
8261
8641
  return this.buyAccess(account, tokenId, totalCost, duration, paymentToken, protocolFeeBps, appFeeBps);
8262
8642
  });
@@ -10338,7 +10718,7 @@ const FancyInput = ({ value, onChange, step, placeholder, type = "text", icon, l
10338
10718
  */
10339
10719
  const FileUpload = ({ onFileUpload, accept, maxFileSize, }) => {
10340
10720
  const auth = useAuth();
10341
- const { environment } = useContext(CampContext);
10721
+ useContext(CampContext);
10342
10722
  const { isAllowListed } = useUser();
10343
10723
  const effectiveMaxFileSize = isAllowListed ? undefined : maxFileSize;
10344
10724
  const [isDragging, setIsDragging] = useState(false);
@@ -10389,11 +10769,7 @@ const FileUpload = ({ onFileUpload, accept, maxFileSize, }) => {
10389
10769
  : 0; // Duration must be 0 for SINGLE_PAYMENT/X402
10390
10770
  const priceInWei = parseEther(price || "0");
10391
10771
  const computedRoyaltyBps = Math.floor(parseFloat(royaltyBps) * 100); // percentage to basis points
10392
- // Use USDC for X402, native token (zeroAddress) for other license types
10393
- const paymentToken = licenseType === LicenseType.X402
10394
- ? environment.USDC_CONTRACT_ADDRESS
10395
- : zeroAddress;
10396
- const license = createLicenseTerms(priceInWei, durationInSeconds, computedRoyaltyBps, paymentToken, licenseType);
10772
+ const license = createLicenseTerms(priceInWei, durationInSeconds, computedRoyaltyBps, zeroAddress, licenseType);
10397
10773
  const metadata = {
10398
10774
  name: selectedFile.name,
10399
10775
  description: `File uploaded by ${auth === null || auth === void 0 ? void 0 : auth.walletAddress} via the Origin SDK`,