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,148 @@
|
|
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 NormalJSON {
|
7
|
+
kind: "Normal"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class Normal {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "Normal"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "Normal"
|
15
|
+
|
16
|
+
toJSON(): NormalJSON {
|
17
|
+
return {
|
18
|
+
kind: "Normal",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
Normal: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface NoMarketFeeJSON {
|
30
|
+
kind: "NoMarketFee"
|
31
|
+
}
|
32
|
+
|
33
|
+
export class NoMarketFee {
|
34
|
+
static readonly discriminator = 1
|
35
|
+
static readonly kind = "NoMarketFee"
|
36
|
+
readonly discriminator = 1
|
37
|
+
readonly kind = "NoMarketFee"
|
38
|
+
|
39
|
+
toJSON(): NoMarketFeeJSON {
|
40
|
+
return {
|
41
|
+
kind: "NoMarketFee",
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
toEncodable() {
|
46
|
+
return {
|
47
|
+
NoMarketFee: {},
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
export interface PartnershipJSON {
|
53
|
+
kind: "Partnership"
|
54
|
+
}
|
55
|
+
|
56
|
+
export class Partnership {
|
57
|
+
static readonly discriminator = 2
|
58
|
+
static readonly kind = "Partnership"
|
59
|
+
readonly discriminator = 2
|
60
|
+
readonly kind = "Partnership"
|
61
|
+
|
62
|
+
toJSON(): PartnershipJSON {
|
63
|
+
return {
|
64
|
+
kind: "Partnership",
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
toEncodable() {
|
69
|
+
return {
|
70
|
+
Partnership: {},
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
export interface LocksInVaultJSON {
|
76
|
+
kind: "LocksInVault"
|
77
|
+
}
|
78
|
+
|
79
|
+
export class LocksInVault {
|
80
|
+
static readonly discriminator = 3
|
81
|
+
static readonly kind = "LocksInVault"
|
82
|
+
readonly discriminator = 3
|
83
|
+
readonly kind = "LocksInVault"
|
84
|
+
|
85
|
+
toJSON(): LocksInVaultJSON {
|
86
|
+
return {
|
87
|
+
kind: "LocksInVault",
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
toEncodable() {
|
92
|
+
return {
|
93
|
+
LocksInVault: {},
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
99
|
+
export function fromDecoded(obj: any): types.SaleTypeKind {
|
100
|
+
if (typeof obj !== "object") {
|
101
|
+
throw new Error("Invalid enum object")
|
102
|
+
}
|
103
|
+
|
104
|
+
if ("Normal" in obj) {
|
105
|
+
return new Normal()
|
106
|
+
}
|
107
|
+
if ("NoMarketFee" in obj) {
|
108
|
+
return new NoMarketFee()
|
109
|
+
}
|
110
|
+
if ("Partnership" in obj) {
|
111
|
+
return new Partnership()
|
112
|
+
}
|
113
|
+
if ("LocksInVault" in obj) {
|
114
|
+
return new LocksInVault()
|
115
|
+
}
|
116
|
+
|
117
|
+
throw new Error("Invalid enum object")
|
118
|
+
}
|
119
|
+
|
120
|
+
export function fromJSON(obj: types.SaleTypeJSON): types.SaleTypeKind {
|
121
|
+
switch (obj.kind) {
|
122
|
+
case "Normal": {
|
123
|
+
return new Normal()
|
124
|
+
}
|
125
|
+
case "NoMarketFee": {
|
126
|
+
return new NoMarketFee()
|
127
|
+
}
|
128
|
+
case "Partnership": {
|
129
|
+
return new Partnership()
|
130
|
+
}
|
131
|
+
case "LocksInVault": {
|
132
|
+
return new LocksInVault()
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
export function layout(property?: string) {
|
138
|
+
const ret = borsh.rustEnum([
|
139
|
+
borsh.struct([], "Normal"),
|
140
|
+
borsh.struct([], "NoMarketFee"),
|
141
|
+
borsh.struct([], "Partnership"),
|
142
|
+
borsh.struct([], "LocksInVault"),
|
143
|
+
])
|
144
|
+
if (property !== undefined) {
|
145
|
+
return ret.replicate(property)
|
146
|
+
}
|
147
|
+
return ret
|
148
|
+
}
|
@@ -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 SeedFields {
|
7
|
+
seed: Uint8Array
|
8
|
+
}
|
9
|
+
|
10
|
+
export interface SeedJSON {
|
11
|
+
seed: Array<number>
|
12
|
+
}
|
13
|
+
|
14
|
+
export class Seed {
|
15
|
+
readonly seed: Uint8Array
|
16
|
+
|
17
|
+
constructor(fields: SeedFields) {
|
18
|
+
this.seed = fields.seed
|
19
|
+
}
|
20
|
+
|
21
|
+
static layout(property?: string) {
|
22
|
+
return borsh.struct([borsh.vecU8("seed")], property)
|
23
|
+
}
|
24
|
+
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
26
|
+
static fromDecoded(obj: any) {
|
27
|
+
return new Seed({
|
28
|
+
seed: new Uint8Array(
|
29
|
+
obj.seed.buffer,
|
30
|
+
obj.seed.byteOffset,
|
31
|
+
obj.seed.length
|
32
|
+
),
|
33
|
+
})
|
34
|
+
}
|
35
|
+
|
36
|
+
static toEncodable(fields: SeedFields) {
|
37
|
+
return {
|
38
|
+
seed: Buffer.from(
|
39
|
+
fields.seed.buffer,
|
40
|
+
fields.seed.byteOffset,
|
41
|
+
fields.seed.length
|
42
|
+
),
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
toJSON(): SeedJSON {
|
47
|
+
return {
|
48
|
+
seed: Array.from(this.seed.values()),
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
static fromJSON(obj: SeedJSON): Seed {
|
53
|
+
return new Seed({
|
54
|
+
seed: Uint8Array.from(obj.seed),
|
55
|
+
})
|
56
|
+
}
|
57
|
+
|
58
|
+
toEncodable() {
|
59
|
+
return Seed.toEncodable(this)
|
60
|
+
}
|
61
|
+
}
|
@@ -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 SelectedCardFields {
|
7
|
+
id: number
|
8
|
+
edition: number
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface SelectedCardJSON {
|
12
|
+
id: number
|
13
|
+
edition: number
|
14
|
+
}
|
15
|
+
|
16
|
+
export class SelectedCard {
|
17
|
+
readonly id: number
|
18
|
+
readonly edition: number
|
19
|
+
|
20
|
+
constructor(fields: SelectedCardFields) {
|
21
|
+
this.id = fields.id
|
22
|
+
this.edition = fields.edition
|
23
|
+
}
|
24
|
+
|
25
|
+
static layout(property?: string) {
|
26
|
+
return borsh.struct([borsh.u16("id"), borsh.u32("edition")], property)
|
27
|
+
}
|
28
|
+
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
|
+
static fromDecoded(obj: any) {
|
31
|
+
return new SelectedCard({
|
32
|
+
id: obj.id,
|
33
|
+
edition: obj.edition,
|
34
|
+
})
|
35
|
+
}
|
36
|
+
|
37
|
+
static toEncodable(fields: SelectedCardFields) {
|
38
|
+
return {
|
39
|
+
id: fields.id,
|
40
|
+
edition: fields.edition,
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
toJSON(): SelectedCardJSON {
|
45
|
+
return {
|
46
|
+
id: this.id,
|
47
|
+
edition: this.edition,
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
static fromJSON(obj: SelectedCardJSON): SelectedCard {
|
52
|
+
return new SelectedCard({
|
53
|
+
id: obj.id,
|
54
|
+
edition: obj.edition,
|
55
|
+
})
|
56
|
+
}
|
57
|
+
|
58
|
+
toEncodable() {
|
59
|
+
return SelectedCard.toEncodable(this)
|
60
|
+
}
|
61
|
+
}
|
@@ -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 SelectedZeroCardFields {
|
7
|
+
id: number
|
8
|
+
edition: number
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface SelectedZeroCardJSON {
|
12
|
+
id: number
|
13
|
+
edition: number
|
14
|
+
}
|
15
|
+
|
16
|
+
export class SelectedZeroCard {
|
17
|
+
readonly id: number
|
18
|
+
readonly edition: number
|
19
|
+
|
20
|
+
constructor(fields: SelectedZeroCardFields) {
|
21
|
+
this.id = fields.id
|
22
|
+
this.edition = fields.edition
|
23
|
+
}
|
24
|
+
|
25
|
+
static layout(property?: string) {
|
26
|
+
return borsh.struct([borsh.u32("id"), borsh.u32("edition")], property)
|
27
|
+
}
|
28
|
+
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
|
+
static fromDecoded(obj: any) {
|
31
|
+
return new SelectedZeroCard({
|
32
|
+
id: obj.id,
|
33
|
+
edition: obj.edition,
|
34
|
+
})
|
35
|
+
}
|
36
|
+
|
37
|
+
static toEncodable(fields: SelectedZeroCardFields) {
|
38
|
+
return {
|
39
|
+
id: fields.id,
|
40
|
+
edition: fields.edition,
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
toJSON(): SelectedZeroCardJSON {
|
45
|
+
return {
|
46
|
+
id: this.id,
|
47
|
+
edition: this.edition,
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
static fromJSON(obj: SelectedZeroCardJSON): SelectedZeroCard {
|
52
|
+
return new SelectedZeroCard({
|
53
|
+
id: obj.id,
|
54
|
+
edition: obj.edition,
|
55
|
+
})
|
56
|
+
}
|
57
|
+
|
58
|
+
toEncodable() {
|
59
|
+
return SelectedZeroCard.toEncodable(this)
|
60
|
+
}
|
61
|
+
}
|
@@ -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 SemiFungibleTraitInitFields {
|
7
|
+
hash: BN
|
8
|
+
amount: BN
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface SemiFungibleTraitInitJSON {
|
12
|
+
hash: string
|
13
|
+
amount: string
|
14
|
+
}
|
15
|
+
|
16
|
+
export class SemiFungibleTraitInit {
|
17
|
+
readonly hash: BN
|
18
|
+
readonly amount: BN
|
19
|
+
|
20
|
+
constructor(fields: SemiFungibleTraitInitFields) {
|
21
|
+
this.hash = fields.hash
|
22
|
+
this.amount = fields.amount
|
23
|
+
}
|
24
|
+
|
25
|
+
static layout(property?: string) {
|
26
|
+
return borsh.struct([borsh.u64("hash"), borsh.u64("amount")], property)
|
27
|
+
}
|
28
|
+
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
|
+
static fromDecoded(obj: any) {
|
31
|
+
return new SemiFungibleTraitInit({
|
32
|
+
hash: obj.hash,
|
33
|
+
amount: obj.amount,
|
34
|
+
})
|
35
|
+
}
|
36
|
+
|
37
|
+
static toEncodable(fields: SemiFungibleTraitInitFields) {
|
38
|
+
return {
|
39
|
+
hash: fields.hash,
|
40
|
+
amount: fields.amount,
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
toJSON(): SemiFungibleTraitInitJSON {
|
45
|
+
return {
|
46
|
+
hash: this.hash.toString(),
|
47
|
+
amount: this.amount.toString(),
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
static fromJSON(obj: SemiFungibleTraitInitJSON): SemiFungibleTraitInit {
|
52
|
+
return new SemiFungibleTraitInit({
|
53
|
+
hash: new BN(obj.hash),
|
54
|
+
amount: new BN(obj.amount),
|
55
|
+
})
|
56
|
+
}
|
57
|
+
|
58
|
+
toEncodable() {
|
59
|
+
return SemiFungibleTraitInit.toEncodable(this)
|
60
|
+
}
|
61
|
+
}
|
@@ -0,0 +1,72 @@
|
|
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 SemiFungibleTraitInitMapFields {
|
7
|
+
hash: BN
|
8
|
+
amount: BN
|
9
|
+
index: number
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface SemiFungibleTraitInitMapJSON {
|
13
|
+
hash: string
|
14
|
+
amount: string
|
15
|
+
index: number
|
16
|
+
}
|
17
|
+
|
18
|
+
export class SemiFungibleTraitInitMap {
|
19
|
+
readonly hash: BN
|
20
|
+
readonly amount: BN
|
21
|
+
readonly index: number
|
22
|
+
|
23
|
+
constructor(fields: SemiFungibleTraitInitMapFields) {
|
24
|
+
this.hash = fields.hash
|
25
|
+
this.amount = fields.amount
|
26
|
+
this.index = fields.index
|
27
|
+
}
|
28
|
+
|
29
|
+
static layout(property?: string) {
|
30
|
+
return borsh.struct(
|
31
|
+
[borsh.u64("hash"), borsh.u64("amount"), borsh.u32("index")],
|
32
|
+
property
|
33
|
+
)
|
34
|
+
}
|
35
|
+
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
37
|
+
static fromDecoded(obj: any) {
|
38
|
+
return new SemiFungibleTraitInitMap({
|
39
|
+
hash: obj.hash,
|
40
|
+
amount: obj.amount,
|
41
|
+
index: obj.index,
|
42
|
+
})
|
43
|
+
}
|
44
|
+
|
45
|
+
static toEncodable(fields: SemiFungibleTraitInitMapFields) {
|
46
|
+
return {
|
47
|
+
hash: fields.hash,
|
48
|
+
amount: fields.amount,
|
49
|
+
index: fields.index,
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
toJSON(): SemiFungibleTraitInitMapJSON {
|
54
|
+
return {
|
55
|
+
hash: this.hash.toString(),
|
56
|
+
amount: this.amount.toString(),
|
57
|
+
index: this.index,
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
static fromJSON(obj: SemiFungibleTraitInitMapJSON): SemiFungibleTraitInitMap {
|
62
|
+
return new SemiFungibleTraitInitMap({
|
63
|
+
hash: new BN(obj.hash),
|
64
|
+
amount: new BN(obj.amount),
|
65
|
+
index: obj.index,
|
66
|
+
})
|
67
|
+
}
|
68
|
+
|
69
|
+
toEncodable() {
|
70
|
+
return SemiFungibleTraitInitMap.toEncodable(this)
|
71
|
+
}
|
72
|
+
}
|
@@ -0,0 +1,64 @@
|
|
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 ShortCreatorFields {
|
7
|
+
address: PublicKey
|
8
|
+
share: number
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface ShortCreatorJSON {
|
12
|
+
address: string
|
13
|
+
share: number
|
14
|
+
}
|
15
|
+
|
16
|
+
export class ShortCreator {
|
17
|
+
readonly address: PublicKey
|
18
|
+
readonly share: number
|
19
|
+
|
20
|
+
constructor(fields: ShortCreatorFields) {
|
21
|
+
this.address = fields.address
|
22
|
+
this.share = fields.share
|
23
|
+
}
|
24
|
+
|
25
|
+
static layout(property?: string) {
|
26
|
+
return borsh.struct(
|
27
|
+
[borsh.publicKey("address"), borsh.u8("share")],
|
28
|
+
property
|
29
|
+
)
|
30
|
+
}
|
31
|
+
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
33
|
+
static fromDecoded(obj: any) {
|
34
|
+
return new ShortCreator({
|
35
|
+
address: obj.address,
|
36
|
+
share: obj.share,
|
37
|
+
})
|
38
|
+
}
|
39
|
+
|
40
|
+
static toEncodable(fields: ShortCreatorFields) {
|
41
|
+
return {
|
42
|
+
address: fields.address,
|
43
|
+
share: fields.share,
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
toJSON(): ShortCreatorJSON {
|
48
|
+
return {
|
49
|
+
address: this.address.toString(),
|
50
|
+
share: this.share,
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
static fromJSON(obj: ShortCreatorJSON): ShortCreator {
|
55
|
+
return new ShortCreator({
|
56
|
+
address: new PublicKey(obj.address),
|
57
|
+
share: obj.share,
|
58
|
+
})
|
59
|
+
}
|
60
|
+
|
61
|
+
toEncodable() {
|
62
|
+
return ShortCreator.toEncodable(this)
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,145 @@
|
|
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 ShortMetadataFields {
|
7
|
+
index: number
|
8
|
+
supply: BN | null
|
9
|
+
traitHash: BN
|
10
|
+
name: string
|
11
|
+
arweave: string
|
12
|
+
traitPass: types.TraitPassFields | null
|
13
|
+
royalty: number | null
|
14
|
+
creators: Array<types.ShortCreatorFields> | null
|
15
|
+
}
|
16
|
+
|
17
|
+
export interface ShortMetadataJSON {
|
18
|
+
index: number
|
19
|
+
supply: string | null
|
20
|
+
traitHash: string
|
21
|
+
name: string
|
22
|
+
arweave: string
|
23
|
+
traitPass: types.TraitPassJSON | null
|
24
|
+
royalty: number | null
|
25
|
+
creators: Array<types.ShortCreatorJSON> | null
|
26
|
+
}
|
27
|
+
|
28
|
+
export class ShortMetadata {
|
29
|
+
readonly index: number
|
30
|
+
readonly supply: BN | null
|
31
|
+
readonly traitHash: BN
|
32
|
+
readonly name: string
|
33
|
+
readonly arweave: string
|
34
|
+
readonly traitPass: types.TraitPass | null
|
35
|
+
readonly royalty: number | null
|
36
|
+
readonly creators: Array<types.ShortCreator> | null
|
37
|
+
|
38
|
+
constructor(fields: ShortMetadataFields) {
|
39
|
+
this.index = fields.index
|
40
|
+
this.supply = fields.supply
|
41
|
+
this.traitHash = fields.traitHash
|
42
|
+
this.name = fields.name
|
43
|
+
this.arweave = fields.arweave
|
44
|
+
this.traitPass =
|
45
|
+
(fields.traitPass && new types.TraitPass({ ...fields.traitPass })) || null
|
46
|
+
this.royalty = fields.royalty
|
47
|
+
this.creators =
|
48
|
+
(fields.creators &&
|
49
|
+
fields.creators.map((item) => new types.ShortCreator({ ...item }))) ||
|
50
|
+
null
|
51
|
+
}
|
52
|
+
|
53
|
+
static layout(property?: string) {
|
54
|
+
return borsh.struct(
|
55
|
+
[
|
56
|
+
borsh.u32("index"),
|
57
|
+
borsh.option(borsh.u64(), "supply"),
|
58
|
+
borsh.u64("traitHash"),
|
59
|
+
borsh.str("name"),
|
60
|
+
borsh.str("arweave"),
|
61
|
+
borsh.option(types.TraitPass.layout(), "traitPass"),
|
62
|
+
borsh.option(borsh.u16(), "royalty"),
|
63
|
+
borsh.option(borsh.vec(types.ShortCreator.layout()), "creators"),
|
64
|
+
],
|
65
|
+
property
|
66
|
+
)
|
67
|
+
}
|
68
|
+
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
70
|
+
static fromDecoded(obj: any) {
|
71
|
+
return new ShortMetadata({
|
72
|
+
index: obj.index,
|
73
|
+
supply: obj.supply,
|
74
|
+
traitHash: obj.traitHash,
|
75
|
+
name: obj.name,
|
76
|
+
arweave: obj.arweave,
|
77
|
+
traitPass:
|
78
|
+
(obj.traitPass && types.TraitPass.fromDecoded(obj.traitPass)) || null,
|
79
|
+
royalty: obj.royalty,
|
80
|
+
creators:
|
81
|
+
(obj.creators &&
|
82
|
+
obj.creators.map(
|
83
|
+
(
|
84
|
+
item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
|
85
|
+
) => types.ShortCreator.fromDecoded(item)
|
86
|
+
)) ||
|
87
|
+
null,
|
88
|
+
})
|
89
|
+
}
|
90
|
+
|
91
|
+
static toEncodable(fields: ShortMetadataFields) {
|
92
|
+
return {
|
93
|
+
index: fields.index,
|
94
|
+
supply: fields.supply,
|
95
|
+
traitHash: fields.traitHash,
|
96
|
+
name: fields.name,
|
97
|
+
arweave: fields.arweave,
|
98
|
+
traitPass:
|
99
|
+
(fields.traitPass && types.TraitPass.toEncodable(fields.traitPass)) ||
|
100
|
+
null,
|
101
|
+
royalty: fields.royalty,
|
102
|
+
creators:
|
103
|
+
(fields.creators &&
|
104
|
+
fields.creators.map((item) =>
|
105
|
+
types.ShortCreator.toEncodable(item)
|
106
|
+
)) ||
|
107
|
+
null,
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
toJSON(): ShortMetadataJSON {
|
112
|
+
return {
|
113
|
+
index: this.index,
|
114
|
+
supply: (this.supply && this.supply.toString()) || null,
|
115
|
+
traitHash: this.traitHash.toString(),
|
116
|
+
name: this.name,
|
117
|
+
arweave: this.arweave,
|
118
|
+
traitPass: (this.traitPass && this.traitPass.toJSON()) || null,
|
119
|
+
royalty: this.royalty,
|
120
|
+
creators:
|
121
|
+
(this.creators && this.creators.map((item) => item.toJSON())) || null,
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
static fromJSON(obj: ShortMetadataJSON): ShortMetadata {
|
126
|
+
return new ShortMetadata({
|
127
|
+
index: obj.index,
|
128
|
+
supply: (obj.supply && new BN(obj.supply)) || null,
|
129
|
+
traitHash: new BN(obj.traitHash),
|
130
|
+
name: obj.name,
|
131
|
+
arweave: obj.arweave,
|
132
|
+
traitPass:
|
133
|
+
(obj.traitPass && types.TraitPass.fromJSON(obj.traitPass)) || null,
|
134
|
+
royalty: obj.royalty,
|
135
|
+
creators:
|
136
|
+
(obj.creators &&
|
137
|
+
obj.creators.map((item) => types.ShortCreator.fromJSON(item))) ||
|
138
|
+
null,
|
139
|
+
})
|
140
|
+
}
|
141
|
+
|
142
|
+
toEncodable() {
|
143
|
+
return ShortMetadata.toEncodable(this)
|
144
|
+
}
|
145
|
+
}
|