3land_sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +352 -0
- package/assets/3land_rebrand.gif +0 -0
- package/assets/battle_sol.gif +0 -0
- package/assets/ds.jpeg +0 -0
- package/assets/future.webp +0 -0
- package/assets/music.mp3 +0 -0
- package/assets/niicl.gif +0 -0
- package/assets/og.png +0 -0
- package/assets/phone.glb +0 -0
- package/assets/testvid.mp4 +0 -0
- package/idl.json +7652 -0
- package/package.json +35 -0
- package/src/index.ts +89 -0
- package/src/library/Irys/irys.ts +412 -0
- package/src/library/Store.ts +613 -0
- package/src/library/implementation/storeImplementation.ts +385 -0
- package/src/library/instructions/store/buySingleEdition.ts +227 -0
- package/src/library/instructions/store/createSingleEdition.ts +49 -0
- package/src/library/instructions/store/createStore.ts +19 -0
- package/src/library/instructions/store/idl.ts +7622 -0
- package/src/library/instructions/store/uploadFilesIryis.ts +133 -0
- package/src/types/accounts/ArchiveDeposit.ts +207 -0
- package/src/types/accounts/Authority.ts +73 -0
- package/src/types/accounts/BurnDeposit.ts +111 -0
- package/src/types/accounts/BurnProgress.ts +97 -0
- package/src/types/accounts/BuyHistory.ts +121 -0
- package/src/types/accounts/BuyTrack.ts +94 -0
- package/src/types/accounts/Card.ts +185 -0
- package/src/types/accounts/CollectionRegistry.ts +145 -0
- package/src/types/accounts/CollectorRegistry.ts +145 -0
- package/src/types/accounts/CreatorRegistry.ts +153 -0
- package/src/types/accounts/CurrencyArtistProof.ts +113 -0
- package/src/types/accounts/GenericUser.ts +185 -0
- package/src/types/accounts/ItemArchive.ts +223 -0
- package/src/types/accounts/ItemReserveList.ts +87 -0
- package/src/types/accounts/ItemReserveList2.ts +73 -0
- package/src/types/accounts/LutVault.ts +97 -0
- package/src/types/accounts/Pack.ts +367 -0
- package/src/types/accounts/PackContent.ts +97 -0
- package/src/types/accounts/PackOpenHolder.ts +141 -0
- package/src/types/accounts/PackReceipt.ts +145 -0
- package/src/types/accounts/PackTraits.ts +101 -0
- package/src/types/accounts/Payment.ts +97 -0
- package/src/types/accounts/PoolVault.ts +177 -0
- package/src/types/accounts/RevealForMe.ts +139 -0
- package/src/types/accounts/SecureHolder.ts +97 -0
- package/src/types/accounts/Single.ts +301 -0
- package/src/types/accounts/Store.ts +180 -0
- package/src/types/accounts/StoresHolder.ts +131 -0
- package/src/types/accounts/ThreeId.ts +189 -0
- package/src/types/accounts/TokenManager.ts +217 -0
- package/src/types/accounts/ZeroCard.ts +73 -0
- package/src/types/accounts/ZeroContent.ts +89 -0
- package/src/types/accounts/ZeroOpenHolder.ts +183 -0
- package/src/types/accounts/index.ts +84 -0
- package/src/types/errors/anchor.ts +773 -0
- package/src/types/errors/index.ts +59 -0
- package/src/types/implementation/implementationTypes.ts +27 -0
- package/src/types/instructions/addBurn.ts +56 -0
- package/src/types/instructions/adjustDepositBurn.ts +33 -0
- package/src/types/instructions/archiveItem.ts +60 -0
- package/src/types/instructions/assignPackDelegate.ts +30 -0
- package/src/types/instructions/burnPay.ts +55 -0
- package/src/types/instructions/buyPack.ts +69 -0
- package/src/types/instructions/buyPay.ts +71 -0
- package/src/types/instructions/buyToken.ts +64 -0
- package/src/types/instructions/claimZeroCard.ts +106 -0
- package/src/types/instructions/closeDepositBurn.ts +47 -0
- package/src/types/instructions/closeRegisterTraits.ts +28 -0
- package/src/types/instructions/createCard.ts +56 -0
- package/src/types/instructions/createCollection.ts +68 -0
- package/src/types/instructions/createPack.ts +71 -0
- package/src/types/instructions/createSingle.ts +71 -0
- package/src/types/instructions/createStore.ts +50 -0
- package/src/types/instructions/createTokenLauncher.ts +82 -0
- package/src/types/instructions/createZeroCard.ts +76 -0
- package/src/types/instructions/deleteCard.ts +32 -0
- package/src/types/instructions/deletePack.ts +40 -0
- package/src/types/instructions/deleteSingle.ts +36 -0
- package/src/types/instructions/deleteTokenLauncher.ts +38 -0
- package/src/types/instructions/depositBurn.ts +55 -0
- package/src/types/instructions/donateUser.ts +84 -0
- package/src/types/instructions/feedPool.ts +61 -0
- package/src/types/instructions/feedTraits.ts +44 -0
- package/src/types/instructions/feedTree.ts +63 -0
- package/src/types/instructions/flagPack.ts +50 -0
- package/src/types/instructions/flagSingle.ts +47 -0
- package/src/types/instructions/gatePay.ts +59 -0
- package/src/types/instructions/index.ts +140 -0
- package/src/types/instructions/initialize.ts +46 -0
- package/src/types/instructions/openPack.ts +79 -0
- package/src/types/instructions/prepareCreator.ts +30 -0
- package/src/types/instructions/preparePack.ts +51 -0
- package/src/types/instructions/prepareTraits.ts +28 -0
- package/src/types/instructions/printPack.ts +95 -0
- package/src/types/instructions/printSingle.ts +108 -0
- package/src/types/instructions/recoverDepositBurn.ts +80 -0
- package/src/types/instructions/registerActivity.ts +43 -0
- package/src/types/instructions/registerCollector.ts +63 -0
- package/src/types/instructions/registerCreator.ts +48 -0
- package/src/types/instructions/registerGenericUser.ts +94 -0
- package/src/types/instructions/registerPackUploads.ts +44 -0
- package/src/types/instructions/registerTraits.ts +42 -0
- package/src/types/instructions/registerUser.ts +50 -0
- package/src/types/instructions/storeLutFor.ts +44 -0
- package/src/types/instructions/unwrapAndDestroy.ts +56 -0
- package/src/types/instructions/updateCard.ts +54 -0
- package/src/types/instructions/updatePack.ts +71 -0
- package/src/types/instructions/updateSingle.ts +64 -0
- package/src/types/instructions/updateStore.ts +47 -0
- package/src/types/instructions/withdrawFromStore.ts +26 -0
- package/src/types/programId.ts +42 -0
- package/src/types/types/AccountClass.ts +868 -0
- package/src/types/types/AccountHasher.ts +89 -0
- package/src/types/types/ActionAfter.ts +202 -0
- package/src/types/types/AllowedCurrencyArgs.ts +53 -0
- package/src/types/types/AuthorityGateTypes.ts +90 -0
- package/src/types/types/BurnCount.ts +60 -0
- package/src/types/types/BurnState.ts +88 -0
- package/src/types/types/BurnTrack.ts +64 -0
- package/src/types/types/BurnType.ts +118 -0
- package/src/types/types/BurnTypeBurn.ts +56 -0
- package/src/types/types/BuyHistoryClass.ts +90 -0
- package/src/types/types/CardClass.ts +56 -0
- package/src/types/types/CardState.ts +238 -0
- package/src/types/types/CardTrack.ts +76 -0
- package/src/types/types/Category.ts +72 -0
- package/src/types/types/CnftData.ts +85 -0
- package/src/types/types/CollectTrack.ts +61 -0
- package/src/types/types/Collection.ts +64 -0
- package/src/types/types/CompactCnftData.ts +76 -0
- package/src/types/types/CoolTimePerAmountArgs.ts +72 -0
- package/src/types/types/Creator.ts +72 -0
- package/src/types/types/CreatorGateArgs.ts +53 -0
- package/src/types/types/CurrencyArtistProof.ts +85 -0
- package/src/types/types/CurrencyType.ts +259 -0
- package/src/types/types/DateTraitInit.ts +61 -0
- package/src/types/types/DateTraitInitMap.ts +72 -0
- package/src/types/types/Deposit.ts +85 -0
- package/src/types/types/DepositFormat.ts +90 -0
- package/src/types/types/DepositState.ts +88 -0
- package/src/types/types/DepositSubtype.ts +90 -0
- package/src/types/types/DepositTrack.ts +69 -0
- package/src/types/types/DepositTrackType.ts +120 -0
- package/src/types/types/DepositType.ts +245 -0
- package/src/types/types/Earnings.ts +37 -0
- package/src/types/types/EditionStoreType.ts +120 -0
- package/src/types/types/EncryptedPayload.ts +61 -0
- package/src/types/types/ExtraParameter.ts +117 -0
- package/src/types/types/FakeBurnCount.ts +64 -0
- package/src/types/types/FakeDeposit.ts +64 -0
- package/src/types/types/FakeTraitPair.ts +61 -0
- package/src/types/types/FakeTraitValue.ts +61 -0
- package/src/types/types/FakeVolumeTrack.ts +64 -0
- package/src/types/types/FeeType.ts +118 -0
- package/src/types/types/FeedingTraits.ts +57 -0
- package/src/types/types/Filter.ts +64 -0
- package/src/types/types/FilterType.ts +56 -0
- package/src/types/types/GeneralStore.ts +56 -0
- package/src/types/types/GenericStore.ts +64 -0
- package/src/types/types/GenericValue.ts +172 -0
- package/src/types/types/GlobalFee.ts +85 -0
- package/src/types/types/GlobalState.ts +148 -0
- package/src/types/types/IndexDate.ts +94 -0
- package/src/types/types/IndexDates.ts +64 -0
- package/src/types/types/Item.ts +53 -0
- package/src/types/types/ItemClass.ts +88 -0
- package/src/types/types/ItemState.ts +298 -0
- package/src/types/types/ItemTrack.ts +76 -0
- package/src/types/types/ListingPerWalletArgs.ts +53 -0
- package/src/types/types/MemeVaultProof.ts +64 -0
- package/src/types/types/MetadataArgs.ts +207 -0
- package/src/types/types/NonFungibleTraitInit.ts +64 -0
- package/src/types/types/NonFungibleTraitInitMap.ts +84 -0
- package/src/types/types/OnlyBetweenTimesArgs.ts +76 -0
- package/src/types/types/OnlyTheseDOWArgs.ts +53 -0
- package/src/types/types/PackConfig.ts +98 -0
- package/src/types/types/PackOpenHolderState.ts +120 -0
- package/src/types/types/PackRule.ts +85 -0
- package/src/types/types/PackState.ts +118 -0
- package/src/types/types/PackType.ts +118 -0
- package/src/types/types/PaymentClass.ts +118 -0
- package/src/types/types/PoolAccess.ts +88 -0
- package/src/types/types/PoolState.ts +88 -0
- package/src/types/types/PoolType.ts +88 -0
- package/src/types/types/Popularity.ts +76 -0
- package/src/types/types/PopularityState.ts +630 -0
- package/src/types/types/PreviousDonationRecord.ts +76 -0
- package/src/types/types/Price.ts +64 -0
- package/src/types/types/PriceRule.ts +216 -0
- package/src/types/types/RecoverDeposit.ts +56 -0
- package/src/types/types/Rule.ts +199 -0
- package/src/types/types/SaleConfig.ts +102 -0
- package/src/types/types/SaleTrack.ts +85 -0
- package/src/types/types/SaleType.ts +148 -0
- package/src/types/types/Seed.ts +61 -0
- package/src/types/types/SelectedCard.ts +61 -0
- package/src/types/types/SelectedZeroCard.ts +61 -0
- package/src/types/types/SemiFungibleTraitInit.ts +61 -0
- package/src/types/types/SemiFungibleTraitInitMap.ts +72 -0
- package/src/types/types/ShortCreator.ts +64 -0
- package/src/types/types/ShortMetadata.ts +145 -0
- package/src/types/types/ShortMetadataArgs.ts +111 -0
- package/src/types/types/StoreConfig.ts +98 -0
- package/src/types/types/StoreRule.ts +145 -0
- package/src/types/types/SuperCategory.ts +61 -0
- package/src/types/types/TightCardMetadata.ts +120 -0
- package/src/types/types/TimeRangeType.ts +120 -0
- package/src/types/types/TimedPerWalletArgs.ts +53 -0
- package/src/types/types/TokenMetadata.ts +72 -0
- package/src/types/types/TokenProgramVersion.ts +90 -0
- package/src/types/types/TokenStandard.ts +150 -0
- package/src/types/types/TokenState.ts +88 -0
- package/src/types/types/TokenType.ts +88 -0
- package/src/types/types/TotalPerTimeArgs.ts +85 -0
- package/src/types/types/TotalPerTimeWalletArgs.ts +61 -0
- package/src/types/types/TrackRegistry.ts +90 -0
- package/src/types/types/TraitInit.ts +210 -0
- package/src/types/types/TraitPass.ts +60 -0
- package/src/types/types/TraitPassType.ts +225 -0
- package/src/types/types/TraitType.ts +267 -0
- package/src/types/types/TraitValue.ts +72 -0
- package/src/types/types/UnlocksAfter.ts +172 -0
- package/src/types/types/UnwrapMetadata.ts +156 -0
- package/src/types/types/UseMethod.ts +118 -0
- package/src/types/types/Uses.ts +76 -0
- package/src/types/types/VerifyCollectionMetadata.ts +109 -0
- package/src/types/types/VolumeTrack.ts +61 -0
- package/src/types/types/WrappedSource.ts +85 -0
- package/src/types/types/ZeroConfig.ts +85 -0
- package/src/types/types/index.ts +798 -0
- package/src/utility/Connection.ts +9 -0
- package/src/utility/Holders.ts +8 -0
- package/src/utility/PdaManager.ts +230 -0
- package/src/utility/config.ts +32 -0
- package/src/utility/utils.ts +191 -0
- package/src/utility/validation.ts +229 -0
- package/tsconfig.json +12 -0
@@ -0,0 +1,118 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface BurnJSON {
|
7
|
+
kind: "Burn"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class Burn {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "Burn"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "Burn"
|
15
|
+
|
16
|
+
toJSON(): BurnJSON {
|
17
|
+
return {
|
18
|
+
kind: "Burn",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
Burn: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface MultipleJSON {
|
30
|
+
kind: "Multiple"
|
31
|
+
}
|
32
|
+
|
33
|
+
export class Multiple {
|
34
|
+
static readonly discriminator = 1
|
35
|
+
static readonly kind = "Multiple"
|
36
|
+
readonly discriminator = 1
|
37
|
+
readonly kind = "Multiple"
|
38
|
+
|
39
|
+
toJSON(): MultipleJSON {
|
40
|
+
return {
|
41
|
+
kind: "Multiple",
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
toEncodable() {
|
46
|
+
return {
|
47
|
+
Multiple: {},
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
export interface SingleJSON {
|
53
|
+
kind: "Single"
|
54
|
+
}
|
55
|
+
|
56
|
+
export class Single {
|
57
|
+
static readonly discriminator = 2
|
58
|
+
static readonly kind = "Single"
|
59
|
+
readonly discriminator = 2
|
60
|
+
readonly kind = "Single"
|
61
|
+
|
62
|
+
toJSON(): SingleJSON {
|
63
|
+
return {
|
64
|
+
kind: "Single",
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
toEncodable() {
|
69
|
+
return {
|
70
|
+
Single: {},
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
76
|
+
export function fromDecoded(obj: any): types.UseMethodKind {
|
77
|
+
if (typeof obj !== "object") {
|
78
|
+
throw new Error("Invalid enum object")
|
79
|
+
}
|
80
|
+
|
81
|
+
if ("Burn" in obj) {
|
82
|
+
return new Burn()
|
83
|
+
}
|
84
|
+
if ("Multiple" in obj) {
|
85
|
+
return new Multiple()
|
86
|
+
}
|
87
|
+
if ("Single" in obj) {
|
88
|
+
return new Single()
|
89
|
+
}
|
90
|
+
|
91
|
+
throw new Error("Invalid enum object")
|
92
|
+
}
|
93
|
+
|
94
|
+
export function fromJSON(obj: types.UseMethodJSON): types.UseMethodKind {
|
95
|
+
switch (obj.kind) {
|
96
|
+
case "Burn": {
|
97
|
+
return new Burn()
|
98
|
+
}
|
99
|
+
case "Multiple": {
|
100
|
+
return new Multiple()
|
101
|
+
}
|
102
|
+
case "Single": {
|
103
|
+
return new Single()
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
export function layout(property?: string) {
|
109
|
+
const ret = borsh.rustEnum([
|
110
|
+
borsh.struct([], "Burn"),
|
111
|
+
borsh.struct([], "Multiple"),
|
112
|
+
borsh.struct([], "Single"),
|
113
|
+
])
|
114
|
+
if (property !== undefined) {
|
115
|
+
return ret.replicate(property)
|
116
|
+
}
|
117
|
+
return ret
|
118
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface UsesFields {
|
7
|
+
useMethod: types.UseMethodKind
|
8
|
+
remaining: BN
|
9
|
+
total: BN
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface UsesJSON {
|
13
|
+
useMethod: types.UseMethodJSON
|
14
|
+
remaining: string
|
15
|
+
total: string
|
16
|
+
}
|
17
|
+
|
18
|
+
export class Uses {
|
19
|
+
readonly useMethod: types.UseMethodKind
|
20
|
+
readonly remaining: BN
|
21
|
+
readonly total: BN
|
22
|
+
|
23
|
+
constructor(fields: UsesFields) {
|
24
|
+
this.useMethod = fields.useMethod
|
25
|
+
this.remaining = fields.remaining
|
26
|
+
this.total = fields.total
|
27
|
+
}
|
28
|
+
|
29
|
+
static layout(property?: string) {
|
30
|
+
return borsh.struct(
|
31
|
+
[
|
32
|
+
types.UseMethod.layout("useMethod"),
|
33
|
+
borsh.u64("remaining"),
|
34
|
+
borsh.u64("total"),
|
35
|
+
],
|
36
|
+
property
|
37
|
+
)
|
38
|
+
}
|
39
|
+
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
41
|
+
static fromDecoded(obj: any) {
|
42
|
+
return new Uses({
|
43
|
+
useMethod: types.UseMethod.fromDecoded(obj.useMethod),
|
44
|
+
remaining: obj.remaining,
|
45
|
+
total: obj.total,
|
46
|
+
})
|
47
|
+
}
|
48
|
+
|
49
|
+
static toEncodable(fields: UsesFields) {
|
50
|
+
return {
|
51
|
+
useMethod: fields.useMethod.toEncodable(),
|
52
|
+
remaining: fields.remaining,
|
53
|
+
total: fields.total,
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
toJSON(): UsesJSON {
|
58
|
+
return {
|
59
|
+
useMethod: this.useMethod.toJSON(),
|
60
|
+
remaining: this.remaining.toString(),
|
61
|
+
total: this.total.toString(),
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
static fromJSON(obj: UsesJSON): Uses {
|
66
|
+
return new Uses({
|
67
|
+
useMethod: types.UseMethod.fromJSON(obj.useMethod),
|
68
|
+
remaining: new BN(obj.remaining),
|
69
|
+
total: new BN(obj.total),
|
70
|
+
})
|
71
|
+
}
|
72
|
+
|
73
|
+
toEncodable() {
|
74
|
+
return Uses.toEncodable(this)
|
75
|
+
}
|
76
|
+
}
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface VerifyCollectionMetadataFields {
|
7
|
+
name: string
|
8
|
+
symbol: string
|
9
|
+
uri: string
|
10
|
+
royalty: number
|
11
|
+
collection: number
|
12
|
+
creators: Array<types.CreatorFields>
|
13
|
+
}
|
14
|
+
|
15
|
+
export interface VerifyCollectionMetadataJSON {
|
16
|
+
name: string
|
17
|
+
symbol: string
|
18
|
+
uri: string
|
19
|
+
royalty: number
|
20
|
+
collection: number
|
21
|
+
creators: Array<types.CreatorJSON>
|
22
|
+
}
|
23
|
+
|
24
|
+
export class VerifyCollectionMetadata {
|
25
|
+
readonly name: string
|
26
|
+
readonly symbol: string
|
27
|
+
readonly uri: string
|
28
|
+
readonly royalty: number
|
29
|
+
readonly collection: number
|
30
|
+
readonly creators: Array<types.Creator>
|
31
|
+
|
32
|
+
constructor(fields: VerifyCollectionMetadataFields) {
|
33
|
+
this.name = fields.name
|
34
|
+
this.symbol = fields.symbol
|
35
|
+
this.uri = fields.uri
|
36
|
+
this.royalty = fields.royalty
|
37
|
+
this.collection = fields.collection
|
38
|
+
this.creators = fields.creators.map(
|
39
|
+
(item) => new types.Creator({ ...item })
|
40
|
+
)
|
41
|
+
}
|
42
|
+
|
43
|
+
static layout(property?: string) {
|
44
|
+
return borsh.struct(
|
45
|
+
[
|
46
|
+
borsh.str("name"),
|
47
|
+
borsh.str("symbol"),
|
48
|
+
borsh.str("uri"),
|
49
|
+
borsh.u16("royalty"),
|
50
|
+
borsh.u8("collection"),
|
51
|
+
borsh.vec(types.Creator.layout(), "creators"),
|
52
|
+
],
|
53
|
+
property
|
54
|
+
)
|
55
|
+
}
|
56
|
+
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
58
|
+
static fromDecoded(obj: any) {
|
59
|
+
return new VerifyCollectionMetadata({
|
60
|
+
name: obj.name,
|
61
|
+
symbol: obj.symbol,
|
62
|
+
uri: obj.uri,
|
63
|
+
royalty: obj.royalty,
|
64
|
+
collection: obj.collection,
|
65
|
+
creators: obj.creators.map(
|
66
|
+
(
|
67
|
+
item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
|
68
|
+
) => types.Creator.fromDecoded(item)
|
69
|
+
),
|
70
|
+
})
|
71
|
+
}
|
72
|
+
|
73
|
+
static toEncodable(fields: VerifyCollectionMetadataFields) {
|
74
|
+
return {
|
75
|
+
name: fields.name,
|
76
|
+
symbol: fields.symbol,
|
77
|
+
uri: fields.uri,
|
78
|
+
royalty: fields.royalty,
|
79
|
+
collection: fields.collection,
|
80
|
+
creators: fields.creators.map((item) => types.Creator.toEncodable(item)),
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
toJSON(): VerifyCollectionMetadataJSON {
|
85
|
+
return {
|
86
|
+
name: this.name,
|
87
|
+
symbol: this.symbol,
|
88
|
+
uri: this.uri,
|
89
|
+
royalty: this.royalty,
|
90
|
+
collection: this.collection,
|
91
|
+
creators: this.creators.map((item) => item.toJSON()),
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
static fromJSON(obj: VerifyCollectionMetadataJSON): VerifyCollectionMetadata {
|
96
|
+
return new VerifyCollectionMetadata({
|
97
|
+
name: obj.name,
|
98
|
+
symbol: obj.symbol,
|
99
|
+
uri: obj.uri,
|
100
|
+
royalty: obj.royalty,
|
101
|
+
collection: obj.collection,
|
102
|
+
creators: obj.creators.map((item) => types.Creator.fromJSON(item)),
|
103
|
+
})
|
104
|
+
}
|
105
|
+
|
106
|
+
toEncodable() {
|
107
|
+
return VerifyCollectionMetadata.toEncodable(this)
|
108
|
+
}
|
109
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface VolumeTrackFields {
|
7
|
+
amount: BN
|
8
|
+
pieces: BN
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface VolumeTrackJSON {
|
12
|
+
amount: string
|
13
|
+
pieces: string
|
14
|
+
}
|
15
|
+
|
16
|
+
export class VolumeTrack {
|
17
|
+
readonly amount: BN
|
18
|
+
readonly pieces: BN
|
19
|
+
|
20
|
+
constructor(fields: VolumeTrackFields) {
|
21
|
+
this.amount = fields.amount
|
22
|
+
this.pieces = fields.pieces
|
23
|
+
}
|
24
|
+
|
25
|
+
static layout(property?: string) {
|
26
|
+
return borsh.struct([borsh.u64("amount"), borsh.u64("pieces")], property)
|
27
|
+
}
|
28
|
+
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
|
+
static fromDecoded(obj: any) {
|
31
|
+
return new VolumeTrack({
|
32
|
+
amount: obj.amount,
|
33
|
+
pieces: obj.pieces,
|
34
|
+
})
|
35
|
+
}
|
36
|
+
|
37
|
+
static toEncodable(fields: VolumeTrackFields) {
|
38
|
+
return {
|
39
|
+
amount: fields.amount,
|
40
|
+
pieces: fields.pieces,
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
toJSON(): VolumeTrackJSON {
|
45
|
+
return {
|
46
|
+
amount: this.amount.toString(),
|
47
|
+
pieces: this.pieces.toString(),
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
static fromJSON(obj: VolumeTrackJSON): VolumeTrack {
|
52
|
+
return new VolumeTrack({
|
53
|
+
amount: new BN(obj.amount),
|
54
|
+
pieces: new BN(obj.pieces),
|
55
|
+
})
|
56
|
+
}
|
57
|
+
|
58
|
+
toEncodable() {
|
59
|
+
return VolumeTrack.toEncodable(this)
|
60
|
+
}
|
61
|
+
}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface WrappedSourceFields {
|
7
|
+
pool: PublicKey
|
8
|
+
amount: BN
|
9
|
+
distribution: number
|
10
|
+
track: number
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface WrappedSourceJSON {
|
14
|
+
pool: string
|
15
|
+
amount: string
|
16
|
+
distribution: number
|
17
|
+
track: number
|
18
|
+
}
|
19
|
+
|
20
|
+
export class WrappedSource {
|
21
|
+
readonly pool: PublicKey
|
22
|
+
readonly amount: BN
|
23
|
+
readonly distribution: number
|
24
|
+
readonly track: number
|
25
|
+
|
26
|
+
constructor(fields: WrappedSourceFields) {
|
27
|
+
this.pool = fields.pool
|
28
|
+
this.amount = fields.amount
|
29
|
+
this.distribution = fields.distribution
|
30
|
+
this.track = fields.track
|
31
|
+
}
|
32
|
+
|
33
|
+
static layout(property?: string) {
|
34
|
+
return borsh.struct(
|
35
|
+
[
|
36
|
+
borsh.publicKey("pool"),
|
37
|
+
borsh.u64("amount"),
|
38
|
+
borsh.u16("distribution"),
|
39
|
+
borsh.u8("track"),
|
40
|
+
],
|
41
|
+
property
|
42
|
+
)
|
43
|
+
}
|
44
|
+
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
|
+
static fromDecoded(obj: any) {
|
47
|
+
return new WrappedSource({
|
48
|
+
pool: obj.pool,
|
49
|
+
amount: obj.amount,
|
50
|
+
distribution: obj.distribution,
|
51
|
+
track: obj.track,
|
52
|
+
})
|
53
|
+
}
|
54
|
+
|
55
|
+
static toEncodable(fields: WrappedSourceFields) {
|
56
|
+
return {
|
57
|
+
pool: fields.pool,
|
58
|
+
amount: fields.amount,
|
59
|
+
distribution: fields.distribution,
|
60
|
+
track: fields.track,
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
toJSON(): WrappedSourceJSON {
|
65
|
+
return {
|
66
|
+
pool: this.pool.toString(),
|
67
|
+
amount: this.amount.toString(),
|
68
|
+
distribution: this.distribution,
|
69
|
+
track: this.track,
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
static fromJSON(obj: WrappedSourceJSON): WrappedSource {
|
74
|
+
return new WrappedSource({
|
75
|
+
pool: new PublicKey(obj.pool),
|
76
|
+
amount: new BN(obj.amount),
|
77
|
+
distribution: obj.distribution,
|
78
|
+
track: obj.track,
|
79
|
+
})
|
80
|
+
}
|
81
|
+
|
82
|
+
toEncodable() {
|
83
|
+
return WrappedSource.toEncodable(this)
|
84
|
+
}
|
85
|
+
}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface ZeroConfigFields {
|
7
|
+
bytes: number
|
8
|
+
chunks: Array<number>
|
9
|
+
chunkSize: number
|
10
|
+
supplyChunkBytes: number
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface ZeroConfigJSON {
|
14
|
+
bytes: number
|
15
|
+
chunks: Array<number>
|
16
|
+
chunkSize: number
|
17
|
+
supplyChunkBytes: number
|
18
|
+
}
|
19
|
+
|
20
|
+
export class ZeroConfig {
|
21
|
+
readonly bytes: number
|
22
|
+
readonly chunks: Array<number>
|
23
|
+
readonly chunkSize: number
|
24
|
+
readonly supplyChunkBytes: number
|
25
|
+
|
26
|
+
constructor(fields: ZeroConfigFields) {
|
27
|
+
this.bytes = fields.bytes
|
28
|
+
this.chunks = fields.chunks
|
29
|
+
this.chunkSize = fields.chunkSize
|
30
|
+
this.supplyChunkBytes = fields.supplyChunkBytes
|
31
|
+
}
|
32
|
+
|
33
|
+
static layout(property?: string) {
|
34
|
+
return borsh.struct(
|
35
|
+
[
|
36
|
+
borsh.u8("bytes"),
|
37
|
+
borsh.array(borsh.u8(), 2, "chunks"),
|
38
|
+
borsh.u8("chunkSize"),
|
39
|
+
borsh.u8("supplyChunkBytes"),
|
40
|
+
],
|
41
|
+
property
|
42
|
+
)
|
43
|
+
}
|
44
|
+
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
|
+
static fromDecoded(obj: any) {
|
47
|
+
return new ZeroConfig({
|
48
|
+
bytes: obj.bytes,
|
49
|
+
chunks: obj.chunks,
|
50
|
+
chunkSize: obj.chunkSize,
|
51
|
+
supplyChunkBytes: obj.supplyChunkBytes,
|
52
|
+
})
|
53
|
+
}
|
54
|
+
|
55
|
+
static toEncodable(fields: ZeroConfigFields) {
|
56
|
+
return {
|
57
|
+
bytes: fields.bytes,
|
58
|
+
chunks: fields.chunks,
|
59
|
+
chunkSize: fields.chunkSize,
|
60
|
+
supplyChunkBytes: fields.supplyChunkBytes,
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
toJSON(): ZeroConfigJSON {
|
65
|
+
return {
|
66
|
+
bytes: this.bytes,
|
67
|
+
chunks: this.chunks,
|
68
|
+
chunkSize: this.chunkSize,
|
69
|
+
supplyChunkBytes: this.supplyChunkBytes,
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
static fromJSON(obj: ZeroConfigJSON): ZeroConfig {
|
74
|
+
return new ZeroConfig({
|
75
|
+
bytes: obj.bytes,
|
76
|
+
chunks: obj.chunks,
|
77
|
+
chunkSize: obj.chunkSize,
|
78
|
+
supplyChunkBytes: obj.supplyChunkBytes,
|
79
|
+
})
|
80
|
+
}
|
81
|
+
|
82
|
+
toEncodable() {
|
83
|
+
return ZeroConfig.toEncodable(this)
|
84
|
+
}
|
85
|
+
}
|