Skip to content

Commit 4816e54

Browse files
authored
Candy Machine v0.3 - Candy Guards (#76)
* new branch w/refactor * use solanakt master branch snapshot * update with solana kt sockets/remove moshi branch * fix up issues from auction house merge, remove deprecations * switch to solana 2.0 release * create guards with groups working * create guard 0.1.1 update * wrap candy guard * remove duplicate code, replace with builder
1 parent ababae2 commit 4816e54

15 files changed

Lines changed: 1819 additions & 289 deletions

File tree

lib/src/main/java/com/metaplex/lib/experimental/jen/candyguard/Accounts.kt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,30 @@
22
// Accounts
33
// Metaplex
44
//
5-
// This code was generated locally by Funkatronics on 2022-09-28
5+
// This code was generated locally by Funkatronics on 2022-11-01
66
//
77
@file:UseSerializers(PublicKeyAs32ByteSerializer::class)
88

99
package com.metaplex.lib.experimental.jen.candyguard
1010

1111
import com.metaplex.lib.serialization.serializers.solana.PublicKeyAs32ByteSerializer
1212
import com.solana.core.PublicKey
13+
import kotlin.Long
1314
import kotlin.UByte
14-
import kotlin.UShort
15+
import kotlin.ULong
1516
import kotlinx.serialization.Serializable
1617
import kotlinx.serialization.UseSerializers
1718

1819
@Serializable
19-
class MintCounter(val count: UShort)
20+
class FreezeEscrow(
21+
val candyGuard: PublicKey,
22+
val candyMachine: PublicKey,
23+
val frozenCount: ULong,
24+
val firstMintTime: Long?,
25+
val freezePeriod: Long,
26+
val destination: PublicKey,
27+
val authority: PublicKey
28+
)
2029

2130
@Serializable
2231
class CandyGuard(

lib/src/main/java/com/metaplex/lib/experimental/jen/candyguard/Errors.kt

Lines changed: 132 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Errors
33
// Metaplex
44
//
5-
// This code was generated locally by Funkatronics on 2022-09-28
5+
// This code was generated locally by Funkatronics on 2022-11-01
66
//
77
package com.metaplex.lib.experimental.jen.candyguard
88

@@ -36,7 +36,7 @@ class PublicKeyMismatch : CandyGuardError {
3636
class DataIncrementLimitExceeded : CandyGuardError {
3737
override val code: Int = 6003
3838

39-
override val message: String = "Missing expected remaining account"
39+
override val message: String = "Exceeded account increase limit"
4040
}
4141

4242
class IncorrectOwner : CandyGuardError {
@@ -75,94 +75,94 @@ class GroupNotFound : CandyGuardError {
7575
override val message: String = "Group not found"
7676
}
7777

78-
class LabelExceededLength : CandyGuardError {
78+
class ExceededLength : CandyGuardError {
7979
override val code: Int = 6010
8080

81-
override val message: String = "Group not found"
81+
override val message: String = "Value exceeded maximum length"
8282
}
8383

84-
class CollectionKeyMismatch : CandyGuardError {
84+
class CandyMachineEmpty : CandyGuardError {
8585
override val code: Int = 6011
8686

87-
override val message: String = "Collection public key mismatch"
87+
override val message: String = "Candy machine is empty"
8888
}
8989

90-
class MissingCollectionAccounts : CandyGuardError {
90+
class InstructionNotFound : CandyGuardError {
9191
override val code: Int = 6012
9292

93-
override val message: String = "Missing collection accounts"
93+
override val message: String = "No instruction was found"
9494
}
9595

96-
class CollectionUpdateAuthorityKeyMismatch : CandyGuardError {
96+
class CollectionKeyMismatch : CandyGuardError {
9797
override val code: Int = 6013
9898

99-
override val message: String = "Collection update authority public key mismatch"
99+
override val message: String = "Collection public key mismatch"
100100
}
101101

102-
class MintNotLastTransaction : CandyGuardError {
102+
class MissingCollectionAccounts : CandyGuardError {
103103
override val code: Int = 6014
104104

105-
override val message: String = "Mint must be the last instructions of the transaction"
105+
override val message: String = "Missing collection accounts"
106106
}
107107

108-
class MintNotLive : CandyGuardError {
108+
class CollectionUpdateAuthorityKeyMismatch : CandyGuardError {
109109
override val code: Int = 6015
110110

111-
override val message: String = "Mint is not live"
111+
override val message: String = "Collection update authority public key mismatch"
112112
}
113113

114-
class NotEnoughSOL : CandyGuardError {
114+
class MintNotLastTransaction : CandyGuardError {
115115
override val code: Int = 6016
116116

117-
override val message: String = "Not enough SOL to pay for the mint"
117+
override val message: String = "Mint must be the last instructions of the transaction"
118118
}
119119

120-
class TokenTransferFailed : CandyGuardError {
120+
class MintNotLive : CandyGuardError {
121121
override val code: Int = 6017
122122

123-
override val message: String = "Token transfer failed"
123+
override val message: String = "Mint is not live"
124124
}
125125

126-
class NotEnoughTokens : CandyGuardError {
126+
class NotEnoughSOL : CandyGuardError {
127127
override val code: Int = 6018
128128

129-
override val message: String = "Not enough tokens to pay for this minting"
129+
override val message: String = "Not enough SOL to pay for the mint"
130130
}
131131

132-
class MissingRequiredSignature : CandyGuardError {
132+
class TokenBurnFailed : CandyGuardError {
133133
override val code: Int = 6019
134134

135-
override val message: String = "A signature was required but not found"
135+
override val message: String = "Token burn failed"
136136
}
137137

138-
class TokenBurnFailed : CandyGuardError {
138+
class NotEnoughTokens : CandyGuardError {
139139
override val code: Int = 6020
140140

141-
override val message: String = "Token burn failed"
141+
override val message: String = "Not enough tokens on the account"
142142
}
143143

144-
class NoWhitelistToken : CandyGuardError {
144+
class TokenTransferFailed : CandyGuardError {
145145
override val code: Int = 6021
146146

147-
override val message: String = "No whitelist token present"
147+
override val message: String = "Token transfer failed"
148148
}
149149

150-
class GatewayTokenInvalid : CandyGuardError {
150+
class MissingRequiredSignature : CandyGuardError {
151151
override val code: Int = 6022
152152

153-
override val message: String = "Gateway token is not valid"
153+
override val message: String = "A signature was required but not found"
154154
}
155155

156-
class AfterEndSettingsDate : CandyGuardError {
156+
class GatewayTokenInvalid : CandyGuardError {
157157
override val code: Int = 6023
158158

159-
override val message: String = "Current time is after the set end settings date"
159+
override val message: String = "Gateway token is not valid"
160160
}
161161

162-
class AfterEndSettingsMintAmount : CandyGuardError {
162+
class AfterEndDate : CandyGuardError {
163163
override val code: Int = 6024
164164

165-
override val message: String = "Current items minted is at the set end settings amount"
165+
override val message: String = "Current time is after the set end date"
166166
}
167167

168168
class InvalidMintTime : CandyGuardError {
@@ -183,14 +183,110 @@ class MissingAllowedListProof : CandyGuardError {
183183
override val message: String = "Missing allowed list proof"
184184
}
185185

186-
class AllowedMintLimitReached : CandyGuardError {
186+
class AllowedListNotEnabled : CandyGuardError {
187187
override val code: Int = 6028
188188

189-
override val message: String = "The maximum number of allowed mints was reached"
189+
override val message: String = "Allow list guard is not enabled"
190190
}
191191

192-
class InvalidNFTCollectionPayment : CandyGuardError {
192+
class AllowedMintLimitReached : CandyGuardError {
193193
override val code: Int = 6029
194194

195-
override val message: String = "Invalid NFT Collection Payment"
195+
override val message: String = "The maximum number of allowed mints was reached"
196+
}
197+
198+
class InvalidNftCollection : CandyGuardError {
199+
override val code: Int = 6030
200+
201+
override val message: String = "Invalid NFT collection"
202+
}
203+
204+
class MissingNft : CandyGuardError {
205+
override val code: Int = 6031
206+
207+
override val message: String = "Missing NFT on the account"
208+
}
209+
210+
class MaximumRedeemedAmount : CandyGuardError {
211+
override val code: Int = 6032
212+
213+
override val message: String = "Current redemeed items is at the set maximum amount"
214+
}
215+
216+
class AddressNotAuthorized : CandyGuardError {
217+
override val code: Int = 6033
218+
219+
override val message: String = "Address not authorized"
220+
}
221+
222+
class MissingFreezeInstruction : CandyGuardError {
223+
override val code: Int = 6034
224+
225+
override val message: String = "Missing freeze instruction data"
226+
}
227+
228+
class FreezeGuardNotEnabled : CandyGuardError {
229+
override val code: Int = 6035
230+
231+
override val message: String = "Freeze guard must be enabled"
232+
}
233+
234+
class FreezeNotInitialized : CandyGuardError {
235+
override val code: Int = 6036
236+
237+
override val message: String = "Freeze must be initialized"
238+
}
239+
240+
class MissingFreezePeriod : CandyGuardError {
241+
override val code: Int = 6037
242+
243+
override val message: String = "Missing freeze period"
244+
}
245+
246+
class FreezeEscrowAlreadyExists : CandyGuardError {
247+
override val code: Int = 6038
248+
249+
override val message: String = "The freeze escrow account already exists"
250+
}
251+
252+
class ExceededMaximumFreezePeriod : CandyGuardError {
253+
override val code: Int = 6039
254+
255+
override val message: String = "Maximum freeze period exceeded"
256+
}
257+
258+
class ThawNotEnabled : CandyGuardError {
259+
override val code: Int = 6040
260+
261+
override val message: String = "Thaw is not enabled"
262+
}
263+
264+
class UnlockNotEnabled : CandyGuardError {
265+
override val code: Int = 6041
266+
267+
override val message: String = "Unlock is not enabled (not all NFTs are thawed)"
268+
}
269+
270+
class DuplicatedGroupLabel : CandyGuardError {
271+
override val code: Int = 6042
272+
273+
override val message: String = "Duplicated group label"
274+
}
275+
276+
class DuplicatedMintLimitId : CandyGuardError {
277+
override val code: Int = 6043
278+
279+
override val message: String = "Duplicated mint limit id"
280+
}
281+
282+
class UnauthorizedProgramFound : CandyGuardError {
283+
override val code: Int = 6044
284+
285+
override val message: String = "An unauthorized program was found in the transaction"
286+
}
287+
288+
class ExceededProgramListSize : CandyGuardError {
289+
override val code: Int = 6045
290+
291+
override val message: String = "Exceeded the maximum number of programs in the additional list"
196292
}

0 commit comments

Comments
 (0)