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,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 FilterFields {
|
7
|
+
filter1: types.FilterTypeKind
|
8
|
+
filter2: types.FilterTypeKind
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface FilterJSON {
|
12
|
+
filter1: types.FilterTypeJSON
|
13
|
+
filter2: types.FilterTypeJSON
|
14
|
+
}
|
15
|
+
|
16
|
+
export class Filter {
|
17
|
+
readonly filter1: types.FilterTypeKind
|
18
|
+
readonly filter2: types.FilterTypeKind
|
19
|
+
|
20
|
+
constructor(fields: FilterFields) {
|
21
|
+
this.filter1 = fields.filter1
|
22
|
+
this.filter2 = fields.filter2
|
23
|
+
}
|
24
|
+
|
25
|
+
static layout(property?: string) {
|
26
|
+
return borsh.struct(
|
27
|
+
[types.FilterType.layout("filter1"), types.FilterType.layout("filter2")],
|
28
|
+
property
|
29
|
+
)
|
30
|
+
}
|
31
|
+
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
33
|
+
static fromDecoded(obj: any) {
|
34
|
+
return new Filter({
|
35
|
+
filter1: types.FilterType.fromDecoded(obj.filter1),
|
36
|
+
filter2: types.FilterType.fromDecoded(obj.filter2),
|
37
|
+
})
|
38
|
+
}
|
39
|
+
|
40
|
+
static toEncodable(fields: FilterFields) {
|
41
|
+
return {
|
42
|
+
filter1: fields.filter1.toEncodable(),
|
43
|
+
filter2: fields.filter2.toEncodable(),
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
toJSON(): FilterJSON {
|
48
|
+
return {
|
49
|
+
filter1: this.filter1.toJSON(),
|
50
|
+
filter2: this.filter2.toJSON(),
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
static fromJSON(obj: FilterJSON): Filter {
|
55
|
+
return new Filter({
|
56
|
+
filter1: types.FilterType.fromJSON(obj.filter1),
|
57
|
+
filter2: types.FilterType.fromJSON(obj.filter2),
|
58
|
+
})
|
59
|
+
}
|
60
|
+
|
61
|
+
toEncodable() {
|
62
|
+
return Filter.toEncodable(this)
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,56 @@
|
|
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 NoneJSON {
|
7
|
+
kind: "None"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class None {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "None"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "None"
|
15
|
+
|
16
|
+
toJSON(): NoneJSON {
|
17
|
+
return {
|
18
|
+
kind: "None",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
None: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
|
+
export function fromDecoded(obj: any): types.FilterTypeKind {
|
31
|
+
if (typeof obj !== "object") {
|
32
|
+
throw new Error("Invalid enum object")
|
33
|
+
}
|
34
|
+
|
35
|
+
if ("None" in obj) {
|
36
|
+
return new None()
|
37
|
+
}
|
38
|
+
|
39
|
+
throw new Error("Invalid enum object")
|
40
|
+
}
|
41
|
+
|
42
|
+
export function fromJSON(obj: types.FilterTypeJSON): types.FilterTypeKind {
|
43
|
+
switch (obj.kind) {
|
44
|
+
case "None": {
|
45
|
+
return new None()
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
export function layout(property?: string) {
|
51
|
+
const ret = borsh.rustEnum([borsh.struct([], "None")])
|
52
|
+
if (property !== undefined) {
|
53
|
+
return ret.replicate(property)
|
54
|
+
}
|
55
|
+
return ret
|
56
|
+
}
|
@@ -0,0 +1,56 @@
|
|
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 NoneJSON {
|
7
|
+
kind: "None"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class None {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "None"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "None"
|
15
|
+
|
16
|
+
toJSON(): NoneJSON {
|
17
|
+
return {
|
18
|
+
kind: "None",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
None: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
|
+
export function fromDecoded(obj: any): types.GeneralStoreKind {
|
31
|
+
if (typeof obj !== "object") {
|
32
|
+
throw new Error("Invalid enum object")
|
33
|
+
}
|
34
|
+
|
35
|
+
if ("None" in obj) {
|
36
|
+
return new None()
|
37
|
+
}
|
38
|
+
|
39
|
+
throw new Error("Invalid enum object")
|
40
|
+
}
|
41
|
+
|
42
|
+
export function fromJSON(obj: types.GeneralStoreJSON): types.GeneralStoreKind {
|
43
|
+
switch (obj.kind) {
|
44
|
+
case "None": {
|
45
|
+
return new None()
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
export function layout(property?: string) {
|
51
|
+
const ret = borsh.rustEnum([borsh.struct([], "None")])
|
52
|
+
if (property !== undefined) {
|
53
|
+
return ret.replicate(property)
|
54
|
+
}
|
55
|
+
return ret
|
56
|
+
}
|
@@ -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 GenericStoreFields {
|
7
|
+
storeType: number
|
8
|
+
data: types.GenericValueKind
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface GenericStoreJSON {
|
12
|
+
storeType: number
|
13
|
+
data: types.GenericValueJSON
|
14
|
+
}
|
15
|
+
|
16
|
+
export class GenericStore {
|
17
|
+
readonly storeType: number
|
18
|
+
readonly data: types.GenericValueKind
|
19
|
+
|
20
|
+
constructor(fields: GenericStoreFields) {
|
21
|
+
this.storeType = fields.storeType
|
22
|
+
this.data = fields.data
|
23
|
+
}
|
24
|
+
|
25
|
+
static layout(property?: string) {
|
26
|
+
return borsh.struct(
|
27
|
+
[borsh.u16("storeType"), types.GenericValue.layout("data")],
|
28
|
+
property
|
29
|
+
)
|
30
|
+
}
|
31
|
+
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
33
|
+
static fromDecoded(obj: any) {
|
34
|
+
return new GenericStore({
|
35
|
+
storeType: obj.storeType,
|
36
|
+
data: types.GenericValue.fromDecoded(obj.data),
|
37
|
+
})
|
38
|
+
}
|
39
|
+
|
40
|
+
static toEncodable(fields: GenericStoreFields) {
|
41
|
+
return {
|
42
|
+
storeType: fields.storeType,
|
43
|
+
data: fields.data.toEncodable(),
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
toJSON(): GenericStoreJSON {
|
48
|
+
return {
|
49
|
+
storeType: this.storeType,
|
50
|
+
data: this.data.toJSON(),
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
static fromJSON(obj: GenericStoreJSON): GenericStore {
|
55
|
+
return new GenericStore({
|
56
|
+
storeType: obj.storeType,
|
57
|
+
data: types.GenericValue.fromJSON(obj.data),
|
58
|
+
})
|
59
|
+
}
|
60
|
+
|
61
|
+
toEncodable() {
|
62
|
+
return GenericStore.toEncodable(this)
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,172 @@
|
|
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 NoneJSON {
|
7
|
+
kind: "None"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class None {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "None"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "None"
|
15
|
+
|
16
|
+
toJSON(): NoneJSON {
|
17
|
+
return {
|
18
|
+
kind: "None",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
None: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export type KeyFields = {
|
30
|
+
value: PublicKey
|
31
|
+
}
|
32
|
+
export type KeyValue = {
|
33
|
+
value: PublicKey
|
34
|
+
}
|
35
|
+
|
36
|
+
export interface KeyJSON {
|
37
|
+
kind: "Key"
|
38
|
+
value: {
|
39
|
+
value: string
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
export class Key {
|
44
|
+
static readonly discriminator = 1
|
45
|
+
static readonly kind = "Key"
|
46
|
+
readonly discriminator = 1
|
47
|
+
readonly kind = "Key"
|
48
|
+
readonly value: KeyValue
|
49
|
+
|
50
|
+
constructor(value: KeyFields) {
|
51
|
+
this.value = {
|
52
|
+
value: value.value,
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
toJSON(): KeyJSON {
|
57
|
+
return {
|
58
|
+
kind: "Key",
|
59
|
+
value: {
|
60
|
+
value: this.value.value.toString(),
|
61
|
+
},
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
toEncodable() {
|
66
|
+
return {
|
67
|
+
Key: {
|
68
|
+
value: this.value.value,
|
69
|
+
},
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
export type EightBytesFields = {
|
75
|
+
value: BN
|
76
|
+
}
|
77
|
+
export type EightBytesValue = {
|
78
|
+
value: BN
|
79
|
+
}
|
80
|
+
|
81
|
+
export interface EightBytesJSON {
|
82
|
+
kind: "EightBytes"
|
83
|
+
value: {
|
84
|
+
value: string
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
export class EightBytes {
|
89
|
+
static readonly discriminator = 2
|
90
|
+
static readonly kind = "EightBytes"
|
91
|
+
readonly discriminator = 2
|
92
|
+
readonly kind = "EightBytes"
|
93
|
+
readonly value: EightBytesValue
|
94
|
+
|
95
|
+
constructor(value: EightBytesFields) {
|
96
|
+
this.value = {
|
97
|
+
value: value.value,
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
toJSON(): EightBytesJSON {
|
102
|
+
return {
|
103
|
+
kind: "EightBytes",
|
104
|
+
value: {
|
105
|
+
value: this.value.value.toString(),
|
106
|
+
},
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
toEncodable() {
|
111
|
+
return {
|
112
|
+
EightBytes: {
|
113
|
+
value: this.value.value,
|
114
|
+
},
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
120
|
+
export function fromDecoded(obj: any): types.GenericValueKind {
|
121
|
+
if (typeof obj !== "object") {
|
122
|
+
throw new Error("Invalid enum object")
|
123
|
+
}
|
124
|
+
|
125
|
+
if ("None" in obj) {
|
126
|
+
return new None()
|
127
|
+
}
|
128
|
+
if ("Key" in obj) {
|
129
|
+
const val = obj["Key"]
|
130
|
+
return new Key({
|
131
|
+
value: val["value"],
|
132
|
+
})
|
133
|
+
}
|
134
|
+
if ("EightBytes" in obj) {
|
135
|
+
const val = obj["EightBytes"]
|
136
|
+
return new EightBytes({
|
137
|
+
value: val["value"],
|
138
|
+
})
|
139
|
+
}
|
140
|
+
|
141
|
+
throw new Error("Invalid enum object")
|
142
|
+
}
|
143
|
+
|
144
|
+
export function fromJSON(obj: types.GenericValueJSON): types.GenericValueKind {
|
145
|
+
switch (obj.kind) {
|
146
|
+
case "None": {
|
147
|
+
return new None()
|
148
|
+
}
|
149
|
+
case "Key": {
|
150
|
+
return new Key({
|
151
|
+
value: new PublicKey(obj.value.value),
|
152
|
+
})
|
153
|
+
}
|
154
|
+
case "EightBytes": {
|
155
|
+
return new EightBytes({
|
156
|
+
value: new BN(obj.value.value),
|
157
|
+
})
|
158
|
+
}
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
export function layout(property?: string) {
|
163
|
+
const ret = borsh.rustEnum([
|
164
|
+
borsh.struct([], "None"),
|
165
|
+
borsh.struct([borsh.publicKey("value")], "Key"),
|
166
|
+
borsh.struct([borsh.u64("value")], "EightBytes"),
|
167
|
+
])
|
168
|
+
if (property !== undefined) {
|
169
|
+
return ret.replicate(property)
|
170
|
+
}
|
171
|
+
return ret
|
172
|
+
}
|
@@ -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 GlobalFeeFields {
|
7
|
+
delegate: PublicKey
|
8
|
+
fee: BN
|
9
|
+
feePercentage: number
|
10
|
+
feeType: types.FeeTypeKind
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface GlobalFeeJSON {
|
14
|
+
delegate: string
|
15
|
+
fee: string
|
16
|
+
feePercentage: number
|
17
|
+
feeType: types.FeeTypeJSON
|
18
|
+
}
|
19
|
+
|
20
|
+
export class GlobalFee {
|
21
|
+
readonly delegate: PublicKey
|
22
|
+
readonly fee: BN
|
23
|
+
readonly feePercentage: number
|
24
|
+
readonly feeType: types.FeeTypeKind
|
25
|
+
|
26
|
+
constructor(fields: GlobalFeeFields) {
|
27
|
+
this.delegate = fields.delegate
|
28
|
+
this.fee = fields.fee
|
29
|
+
this.feePercentage = fields.feePercentage
|
30
|
+
this.feeType = fields.feeType
|
31
|
+
}
|
32
|
+
|
33
|
+
static layout(property?: string) {
|
34
|
+
return borsh.struct(
|
35
|
+
[
|
36
|
+
borsh.publicKey("delegate"),
|
37
|
+
borsh.u64("fee"),
|
38
|
+
borsh.u16("feePercentage"),
|
39
|
+
types.FeeType.layout("feeType"),
|
40
|
+
],
|
41
|
+
property
|
42
|
+
)
|
43
|
+
}
|
44
|
+
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
|
+
static fromDecoded(obj: any) {
|
47
|
+
return new GlobalFee({
|
48
|
+
delegate: obj.delegate,
|
49
|
+
fee: obj.fee,
|
50
|
+
feePercentage: obj.feePercentage,
|
51
|
+
feeType: types.FeeType.fromDecoded(obj.feeType),
|
52
|
+
})
|
53
|
+
}
|
54
|
+
|
55
|
+
static toEncodable(fields: GlobalFeeFields) {
|
56
|
+
return {
|
57
|
+
delegate: fields.delegate,
|
58
|
+
fee: fields.fee,
|
59
|
+
feePercentage: fields.feePercentage,
|
60
|
+
feeType: fields.feeType.toEncodable(),
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
toJSON(): GlobalFeeJSON {
|
65
|
+
return {
|
66
|
+
delegate: this.delegate.toString(),
|
67
|
+
fee: this.fee.toString(),
|
68
|
+
feePercentage: this.feePercentage,
|
69
|
+
feeType: this.feeType.toJSON(),
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
static fromJSON(obj: GlobalFeeJSON): GlobalFee {
|
74
|
+
return new GlobalFee({
|
75
|
+
delegate: new PublicKey(obj.delegate),
|
76
|
+
fee: new BN(obj.fee),
|
77
|
+
feePercentage: obj.feePercentage,
|
78
|
+
feeType: types.FeeType.fromJSON(obj.feeType),
|
79
|
+
})
|
80
|
+
}
|
81
|
+
|
82
|
+
toEncodable() {
|
83
|
+
return GlobalFee.toEncodable(this)
|
84
|
+
}
|
85
|
+
}
|
@@ -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 HiddenBySystemJSON {
|
7
|
+
kind: "HiddenBySystem"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class HiddenBySystem {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "HiddenBySystem"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "HiddenBySystem"
|
15
|
+
|
16
|
+
toJSON(): HiddenBySystemJSON {
|
17
|
+
return {
|
18
|
+
kind: "HiddenBySystem",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
HiddenBySystem: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface PublicJSON {
|
30
|
+
kind: "Public"
|
31
|
+
}
|
32
|
+
|
33
|
+
export class Public {
|
34
|
+
static readonly discriminator = 1
|
35
|
+
static readonly kind = "Public"
|
36
|
+
readonly discriminator = 1
|
37
|
+
readonly kind = "Public"
|
38
|
+
|
39
|
+
toJSON(): PublicJSON {
|
40
|
+
return {
|
41
|
+
kind: "Public",
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
toEncodable() {
|
46
|
+
return {
|
47
|
+
Public: {},
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
export interface HiddenByUserJSON {
|
53
|
+
kind: "HiddenByUser"
|
54
|
+
}
|
55
|
+
|
56
|
+
export class HiddenByUser {
|
57
|
+
static readonly discriminator = 2
|
58
|
+
static readonly kind = "HiddenByUser"
|
59
|
+
readonly discriminator = 2
|
60
|
+
readonly kind = "HiddenByUser"
|
61
|
+
|
62
|
+
toJSON(): HiddenByUserJSON {
|
63
|
+
return {
|
64
|
+
kind: "HiddenByUser",
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
toEncodable() {
|
69
|
+
return {
|
70
|
+
HiddenByUser: {},
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
export interface FlaggedPirateJSON {
|
76
|
+
kind: "FlaggedPirate"
|
77
|
+
}
|
78
|
+
|
79
|
+
export class FlaggedPirate {
|
80
|
+
static readonly discriminator = 3
|
81
|
+
static readonly kind = "FlaggedPirate"
|
82
|
+
readonly discriminator = 3
|
83
|
+
readonly kind = "FlaggedPirate"
|
84
|
+
|
85
|
+
toJSON(): FlaggedPirateJSON {
|
86
|
+
return {
|
87
|
+
kind: "FlaggedPirate",
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
toEncodable() {
|
92
|
+
return {
|
93
|
+
FlaggedPirate: {},
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
99
|
+
export function fromDecoded(obj: any): types.GlobalStateKind {
|
100
|
+
if (typeof obj !== "object") {
|
101
|
+
throw new Error("Invalid enum object")
|
102
|
+
}
|
103
|
+
|
104
|
+
if ("HiddenBySystem" in obj) {
|
105
|
+
return new HiddenBySystem()
|
106
|
+
}
|
107
|
+
if ("Public" in obj) {
|
108
|
+
return new Public()
|
109
|
+
}
|
110
|
+
if ("HiddenByUser" in obj) {
|
111
|
+
return new HiddenByUser()
|
112
|
+
}
|
113
|
+
if ("FlaggedPirate" in obj) {
|
114
|
+
return new FlaggedPirate()
|
115
|
+
}
|
116
|
+
|
117
|
+
throw new Error("Invalid enum object")
|
118
|
+
}
|
119
|
+
|
120
|
+
export function fromJSON(obj: types.GlobalStateJSON): types.GlobalStateKind {
|
121
|
+
switch (obj.kind) {
|
122
|
+
case "HiddenBySystem": {
|
123
|
+
return new HiddenBySystem()
|
124
|
+
}
|
125
|
+
case "Public": {
|
126
|
+
return new Public()
|
127
|
+
}
|
128
|
+
case "HiddenByUser": {
|
129
|
+
return new HiddenByUser()
|
130
|
+
}
|
131
|
+
case "FlaggedPirate": {
|
132
|
+
return new FlaggedPirate()
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
export function layout(property?: string) {
|
138
|
+
const ret = borsh.rustEnum([
|
139
|
+
borsh.struct([], "HiddenBySystem"),
|
140
|
+
borsh.struct([], "Public"),
|
141
|
+
borsh.struct([], "HiddenByUser"),
|
142
|
+
borsh.struct([], "FlaggedPirate"),
|
143
|
+
])
|
144
|
+
if (property !== undefined) {
|
145
|
+
return ret.replicate(property)
|
146
|
+
}
|
147
|
+
return ret
|
148
|
+
}
|