-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: relocate shared * refactor: vendor in memo * chore: changeset
- Loading branch information
1 parent
e18fc1b
commit 64d138a
Showing
14 changed files
with
178 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"gill": patch | ||
--- | ||
|
||
vendor in spl memo |
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,10 @@ | ||
/** | ||
* This code was AUTOGENERATED using the codama library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun codama to update it. | ||
* | ||
* @see https://github.com/codama-idl/codama | ||
*/ | ||
|
||
export * from './instructions'; | ||
export * from './programs'; |
101 changes: 101 additions & 0 deletions
101
packages/gill/src/programs/memo/generated/instructions/addMemo.ts
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,101 @@ | ||
/** | ||
* This code was AUTOGENERATED using the codama library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun codama to update it. | ||
* | ||
* @see https://github.com/codama-idl/codama | ||
*/ | ||
|
||
import { | ||
combineCodec, | ||
getStructDecoder, | ||
getStructEncoder, | ||
getUtf8Decoder, | ||
getUtf8Encoder, | ||
type Codec, | ||
type Decoder, | ||
type Encoder, | ||
} from "@solana/codecs"; | ||
import { type Address } from "@solana/addresses"; | ||
import { | ||
type IInstruction, | ||
type IInstructionWithAccounts, | ||
type IInstructionWithData, | ||
type IAccountMeta, | ||
AccountRole, | ||
} from "@solana/instructions"; | ||
import { type TransactionSigner } from "@solana/signers"; | ||
import { MEMO_PROGRAM_ADDRESS } from "../programs"; | ||
|
||
export type AddMemoInstruction< | ||
TProgram extends string = typeof MEMO_PROGRAM_ADDRESS, | ||
TRemainingAccounts extends readonly IAccountMeta<string>[] = [], | ||
> = IInstruction<TProgram> & | ||
IInstructionWithData<Uint8Array> & | ||
IInstructionWithAccounts<TRemainingAccounts>; | ||
|
||
export type AddMemoInstructionData = { memo: string }; | ||
|
||
export type AddMemoInstructionDataArgs = AddMemoInstructionData; | ||
|
||
export function getAddMemoInstructionDataEncoder(): Encoder<AddMemoInstructionDataArgs> { | ||
return getStructEncoder([["memo", getUtf8Encoder()]]); | ||
} | ||
|
||
export function getAddMemoInstructionDataDecoder(): Decoder<AddMemoInstructionData> { | ||
return getStructDecoder([["memo", getUtf8Decoder()]]); | ||
} | ||
|
||
export function getAddMemoInstructionDataCodec(): Codec< | ||
AddMemoInstructionDataArgs, | ||
AddMemoInstructionData | ||
> { | ||
return combineCodec(getAddMemoInstructionDataEncoder(), getAddMemoInstructionDataDecoder()); | ||
} | ||
|
||
export type AddMemoInput = { | ||
memo: AddMemoInstructionDataArgs["memo"]; | ||
signers?: Array<TransactionSigner>; | ||
}; | ||
|
||
export function getAddMemoInstruction< | ||
TProgramAddress extends Address = typeof MEMO_PROGRAM_ADDRESS, | ||
>( | ||
input: AddMemoInput, | ||
config?: { programAddress?: TProgramAddress }, | ||
): AddMemoInstruction<TProgramAddress> { | ||
// Program address. | ||
const programAddress = config?.programAddress ?? MEMO_PROGRAM_ADDRESS; | ||
|
||
// Original args. | ||
const args = { ...input }; | ||
|
||
// Remaining accounts. | ||
const remainingAccounts: IAccountMeta[] = (args.signers ?? []).map((signer) => ({ | ||
address: signer.address, | ||
role: AccountRole.READONLY_SIGNER, | ||
signer, | ||
})); | ||
|
||
const instruction = { | ||
accounts: remainingAccounts, | ||
programAddress, | ||
data: getAddMemoInstructionDataEncoder().encode(args as AddMemoInstructionDataArgs), | ||
} as AddMemoInstruction<TProgramAddress>; | ||
|
||
return instruction; | ||
} | ||
|
||
export type ParsedAddMemoInstruction<TProgram extends string = typeof MEMO_PROGRAM_ADDRESS> = { | ||
programAddress: Address<TProgram>; | ||
data: AddMemoInstructionData; | ||
}; | ||
|
||
export function parseAddMemoInstruction<TProgram extends string>( | ||
instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>, | ||
): ParsedAddMemoInstruction<TProgram> { | ||
return { | ||
programAddress: instruction.programAddress, | ||
data: getAddMemoInstructionDataDecoder().decode(instruction.data), | ||
}; | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/gill/src/programs/memo/generated/instructions/index.ts
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,9 @@ | ||
/** | ||
* This code was AUTOGENERATED using the codama library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun codama to update it. | ||
* | ||
* @see https://github.com/codama-idl/codama | ||
*/ | ||
|
||
export * from './addMemo'; |
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,9 @@ | ||
/** | ||
* This code was AUTOGENERATED using the codama library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun codama to update it. | ||
* | ||
* @see https://github.com/codama-idl/codama | ||
*/ | ||
|
||
export * from './memo'; |
23 changes: 23 additions & 0 deletions
23
packages/gill/src/programs/memo/generated/programs/memo.ts
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,23 @@ | ||
/** | ||
* This code was AUTOGENERATED using the codama library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun codama to update it. | ||
* | ||
* @see https://github.com/codama-idl/codama | ||
*/ | ||
|
||
import { type Address } from "@solana/addresses"; | ||
import { type ParsedAddMemoInstruction } from "../instructions"; | ||
|
||
export const MEMO_PROGRAM_ADDRESS = | ||
"MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr" as Address<"MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr">; | ||
|
||
export enum MemoInstruction { | ||
AddMemo, | ||
} | ||
|
||
export type ParsedMemoInstruction< | ||
TProgram extends string = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr", | ||
> = { | ||
instructionType: MemoInstruction.AddMemo; | ||
} & ParsedAddMemoInstruction<TProgram>; |
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 @@ | ||
export * from "./generated"; |
4 changes: 2 additions & 2 deletions
4
.../token-metadata/generated/shared/index.ts → packages/gill/src/programs/shared/index.ts
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.