-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from metaplex-foundation/fix/v2-reroll
Path refactor for v2
- Loading branch information
Showing
18 changed files
with
1,117 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
* @see https://github.com/metaplex-foundation/kinobi | ||
*/ | ||
|
||
export * from './path'; | ||
export * from './internalPath'; |
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,24 @@ | ||
/** | ||
* 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 InternalPath { | ||
NoRerollMetadata, | ||
} | ||
|
||
export type InternalPathArgs = InternalPath; | ||
|
||
export function getInternalPathSerializer(): Serializer< | ||
InternalPathArgs, | ||
InternalPath | ||
> { | ||
return scalarEnum<InternalPath>(InternalPath, { | ||
description: 'InternalPath', | ||
}) as Serializer<InternalPathArgs, InternalPath>; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './generated'; | ||
export * from './plugin'; | ||
export * from './path'; |
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 @@ | ||
import { InternalPath } from './generated'; | ||
|
||
enum CustomPath { | ||
RerollMetadata = 16, | ||
} | ||
|
||
export const Path = { | ||
...InternalPath, | ||
...CustomPath, | ||
} as const; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-redeclare | ||
export type Path = InternalPath | CustomPath; | ||
|
||
export function buildPath(features: Path[]) { | ||
let path = 0; | ||
|
||
// eslint-disable-next-line no-restricted-syntax | ||
for (const feature of features) { | ||
if (feature !== Path.RerollMetadata) { | ||
// eslint-disable-next-line no-bitwise | ||
path |= 1 << feature; | ||
} | ||
} | ||
|
||
return path; | ||
} |
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.