generated from metaplex-foundation/solana-project-template
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changing UA scheme to be an enum of None, Address, or Collection.
- Loading branch information
1 parent
401743a
commit f938968
Showing
44 changed files
with
462 additions
and
410 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -14,7 +14,6 @@ export enum PluginType { | |
Freeze, | ||
Burn, | ||
Transfer, | ||
Collection, | ||
UpdateDelegate, | ||
} | ||
|
||
|
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, | ||
tuple, | ||
unit, | ||
} from '@metaplex-foundation/umi/serializers'; | ||
|
||
export type UpdateAuthority = | ||
| { __kind: 'None' } | ||
| { __kind: 'Address'; fields: [PublicKey] } | ||
| { __kind: 'Collection'; fields: [PublicKey] }; | ||
|
||
export type UpdateAuthorityArgs = UpdateAuthority; | ||
|
||
export function getUpdateAuthoritySerializer(): Serializer< | ||
UpdateAuthorityArgs, | ||
UpdateAuthority | ||
> { | ||
return dataEnum<UpdateAuthority>( | ||
[ | ||
['None', unit()], | ||
[ | ||
'Address', | ||
struct<GetDataEnumKindContent<UpdateAuthority, 'Address'>>([ | ||
['fields', tuple([publicKeySerializer()])], | ||
]), | ||
], | ||
[ | ||
'Collection', | ||
struct<GetDataEnumKindContent<UpdateAuthority, 'Collection'>>([ | ||
['fields', tuple([publicKeySerializer()])], | ||
]), | ||
], | ||
], | ||
{ description: 'UpdateAuthority' } | ||
) as Serializer<UpdateAuthorityArgs, UpdateAuthority>; | ||
} | ||
|
||
// Data Enum Helpers. | ||
export function updateAuthority( | ||
kind: 'None' | ||
): GetDataEnumKind<UpdateAuthorityArgs, 'None'>; | ||
export function updateAuthority( | ||
kind: 'Address', | ||
data: GetDataEnumKindContent<UpdateAuthorityArgs, 'Address'>['fields'] | ||
): GetDataEnumKind<UpdateAuthorityArgs, 'Address'>; | ||
export function updateAuthority( | ||
kind: 'Collection', | ||
data: GetDataEnumKindContent<UpdateAuthorityArgs, 'Collection'>['fields'] | ||
): GetDataEnumKind<UpdateAuthorityArgs, 'Collection'>; | ||
export function updateAuthority<K extends UpdateAuthorityArgs['__kind']>( | ||
kind: K, | ||
data?: any | ||
): Extract<UpdateAuthorityArgs, { __kind: K }> { | ||
return Array.isArray(data) | ||
? { __kind: kind, fields: data } | ||
: { __kind: kind, ...(data ?? {}) }; | ||
} | ||
export function isUpdateAuthority<K extends UpdateAuthority['__kind']>( | ||
kind: K, | ||
value: UpdateAuthority | ||
): value is UpdateAuthority & { __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
Oops, something went wrong.