generated from metaplex-foundation/solana-project-template
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renaming to plugins and minor tweaks.
- Loading branch information
1 parent
adbb43b
commit 4040e7e
Showing
25 changed files
with
371 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* This code was AUTOGENERATED using the kinobi library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun kinobi to update it. | ||
* | ||
* @see https://github.com/metaplex-foundation/kinobi | ||
*/ | ||
|
||
import { PublicKey } from '@metaplex-foundation/umi'; | ||
import { | ||
GetDataEnumKind, | ||
GetDataEnumKindContent, | ||
Serializer, | ||
dataEnum, | ||
publicKey as publicKeySerializer, | ||
struct, | ||
unit, | ||
} from '@metaplex-foundation/umi/serializers'; | ||
import { Plugin, PluginArgs, getPluginSerializer } from '.'; | ||
|
||
export type Authority = | ||
| { __kind: 'Owner' } | ||
| { __kind: 'Permanent'; address: PublicKey } | ||
| { __kind: 'SameAs'; plugin: Plugin }; | ||
|
||
export type AuthorityArgs = | ||
| { __kind: 'Owner' } | ||
| { __kind: 'Permanent'; address: PublicKey } | ||
| { __kind: 'SameAs'; plugin: PluginArgs }; | ||
|
||
export function getAuthoritySerializer(): Serializer<AuthorityArgs, Authority> { | ||
return dataEnum<Authority>( | ||
[ | ||
['Owner', unit()], | ||
[ | ||
'Permanent', | ||
struct<GetDataEnumKindContent<Authority, 'Permanent'>>([ | ||
['address', publicKeySerializer()], | ||
]), | ||
], | ||
[ | ||
'SameAs', | ||
struct<GetDataEnumKindContent<Authority, 'SameAs'>>([ | ||
['plugin', getPluginSerializer()], | ||
]), | ||
], | ||
], | ||
{ description: 'Authority' } | ||
) as Serializer<AuthorityArgs, Authority>; | ||
} | ||
|
||
// Data Enum Helpers. | ||
export function authority( | ||
kind: 'Owner' | ||
): GetDataEnumKind<AuthorityArgs, 'Owner'>; | ||
export function authority( | ||
kind: 'Permanent', | ||
data: GetDataEnumKindContent<AuthorityArgs, 'Permanent'> | ||
): GetDataEnumKind<AuthorityArgs, 'Permanent'>; | ||
export function authority( | ||
kind: 'SameAs', | ||
data: GetDataEnumKindContent<AuthorityArgs, 'SameAs'> | ||
): GetDataEnumKind<AuthorityArgs, 'SameAs'>; | ||
export function authority<K extends AuthorityArgs['__kind']>( | ||
kind: K, | ||
data?: any | ||
): Extract<AuthorityArgs, { __kind: K }> { | ||
return Array.isArray(data) | ||
? { __kind: kind, fields: data } | ||
: { __kind: kind, ...(data ?? {}) }; | ||
} | ||
export function isAuthority<K extends Authority['__kind']>( | ||
kind: K, | ||
value: Authority | ||
): value is Authority & { __kind: K } { | ||
return value.__kind === kind; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* This code was AUTOGENERATED using the kinobi library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun kinobi to update it. | ||
* | ||
* @see https://github.com/metaplex-foundation/kinobi | ||
*/ | ||
|
||
import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers'; | ||
|
||
export enum Key { | ||
Uninitialized, | ||
Asset, | ||
HashedAsset, | ||
Collection, | ||
HashedCollection, | ||
} | ||
|
||
export type KeyArgs = Key; | ||
|
||
export function getKeySerializer(): Serializer<KeyArgs, Key> { | ||
return scalarEnum<Key>(Key, { description: 'Key' }) as Serializer< | ||
KeyArgs, | ||
Key | ||
>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! This code was AUTOGENERATED using the kinobi library. | ||
//! Please DO NOT EDIT THIS FILE, instead use visitors | ||
//! to add features, then rerun kinobi to update it. | ||
//! | ||
//! [https://github.com/metaplex-foundation/kinobi] | ||
//! | ||
use crate::generated::types::Plugin; | ||
use borsh::BorshDeserialize; | ||
use borsh::BorshSerialize; | ||
use solana_program::pubkey::Pubkey; | ||
|
||
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] | ||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
pub enum Authority { | ||
Owner, | ||
Permanent { | ||
#[cfg_attr( | ||
feature = "serde", | ||
serde(with = "serde_with::As::<serde_with::DisplayFromStr>") | ||
)] | ||
address: Pubkey, | ||
}, | ||
SameAs { | ||
plugin: Plugin, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//! This code was AUTOGENERATED using the kinobi library. | ||
//! Please DO NOT EDIT THIS FILE, instead use visitors | ||
//! to add features, then rerun kinobi to update it. | ||
//! | ||
//! [https://github.com/metaplex-foundation/kinobi] | ||
//! | ||
use borsh::BorshDeserialize; | ||
use borsh::BorshSerialize; | ||
|
||
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] | ||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
pub enum Key { | ||
Uninitialized, | ||
Asset, | ||
HashedAsset, | ||
Collection, | ||
HashedCollection, | ||
} |
Oops, something went wrong.