Skip to content

Commit

Permalink
Bump kinobi versions, with renderers-js to 0.21.9 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcintyre94 authored Oct 2, 2024
1 parent 3d22e8b commit b4c00b4
Show file tree
Hide file tree
Showing 30 changed files with 519 additions and 285 deletions.
22 changes: 16 additions & 6 deletions clients/js/src/generated/instructions/amountToUiAmount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ import {
import { TOKEN_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const AMOUNT_TO_UI_AMOUNT_DISCRIMINATOR = 23;

export function getAmountToUiAmountDiscriminatorBytes() {
return getU8Encoder().encode(AMOUNT_TO_UI_AMOUNT_DISCRIMINATOR);
}

export type AmountToUiAmountInstruction<
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
TAccountMint extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -60,7 +66,7 @@ export function getAmountToUiAmountInstructionDataEncoder(): Encoder<AmountToUiA
['discriminator', getU8Encoder()],
['amount', getU64Encoder()],
]),
(value) => ({ ...value, discriminator: 23 })
(value) => ({ ...value, discriminator: AMOUNT_TO_UI_AMOUNT_DISCRIMINATOR })
);
}

Expand All @@ -87,11 +93,15 @@ export type AmountToUiAmountInput<TAccountMint extends string = string> = {
amount: AmountToUiAmountInstructionDataArgs['amount'];
};

export function getAmountToUiAmountInstruction<TAccountMint extends string>(
input: AmountToUiAmountInput<TAccountMint>
): AmountToUiAmountInstruction<typeof TOKEN_PROGRAM_ADDRESS, TAccountMint> {
export function getAmountToUiAmountInstruction<
TAccountMint extends string,
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
>(
input: AmountToUiAmountInput<TAccountMint>,
config?: { programAddress?: TProgramAddress }
): AmountToUiAmountInstruction<TProgramAddress, TAccountMint> {
// Program address.
const programAddress = TOKEN_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand All @@ -112,7 +122,7 @@ export function getAmountToUiAmountInstruction<TAccountMint extends string>(
data: getAmountToUiAmountInstructionDataEncoder().encode(
args as AmountToUiAmountInstructionDataArgs
),
} as AmountToUiAmountInstruction<typeof TOKEN_PROGRAM_ADDRESS, TAccountMint>;
} as AmountToUiAmountInstruction<TProgramAddress, TAccountMint>;

return instruction;
}
Expand Down
18 changes: 13 additions & 5 deletions clients/js/src/generated/instructions/approve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ import {
import { TOKEN_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const APPROVE_DISCRIMINATOR = 4;

export function getApproveDiscriminatorBytes() {
return getU8Encoder().encode(APPROVE_DISCRIMINATOR);
}

export type ApproveInstruction<
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
TAccountSource extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -73,7 +79,7 @@ export function getApproveInstructionDataEncoder(): Encoder<ApproveInstructionDa
['discriminator', getU8Encoder()],
['amount', getU64Encoder()],
]),
(value) => ({ ...value, discriminator: 4 })
(value) => ({ ...value, discriminator: APPROVE_DISCRIMINATOR })
);
}

Expand Down Expand Up @@ -113,18 +119,20 @@ export function getApproveInstruction<
TAccountSource extends string,
TAccountDelegate extends string,
TAccountOwner extends string,
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
>(
input: ApproveInput<TAccountSource, TAccountDelegate, TAccountOwner>
input: ApproveInput<TAccountSource, TAccountDelegate, TAccountOwner>,
config?: { programAddress?: TProgramAddress }
): ApproveInstruction<
typeof TOKEN_PROGRAM_ADDRESS,
TProgramAddress,
TAccountSource,
TAccountDelegate,
(typeof input)['owner'] extends TransactionSigner<TAccountOwner>
? ReadonlySignerAccount<TAccountOwner> & IAccountSignerMeta<TAccountOwner>
: TAccountOwner
> {
// Program address.
const programAddress = TOKEN_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand Down Expand Up @@ -162,7 +170,7 @@ export function getApproveInstruction<
args as ApproveInstructionDataArgs
),
} as ApproveInstruction<
typeof TOKEN_PROGRAM_ADDRESS,
TProgramAddress,
TAccountSource,
TAccountDelegate,
(typeof input)['owner'] extends TransactionSigner<TAccountOwner>
Expand Down
18 changes: 13 additions & 5 deletions clients/js/src/generated/instructions/approveChecked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ import {
import { TOKEN_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const APPROVE_CHECKED_DISCRIMINATOR = 13;

export function getApproveCheckedDiscriminatorBytes() {
return getU8Encoder().encode(APPROVE_CHECKED_DISCRIMINATOR);
}

export type ApproveCheckedInstruction<
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
TAccountSource extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -82,7 +88,7 @@ export function getApproveCheckedInstructionDataEncoder(): Encoder<ApproveChecke
['amount', getU64Encoder()],
['decimals', getU8Encoder()],
]),
(value) => ({ ...value, discriminator: 13 })
(value) => ({ ...value, discriminator: APPROVE_CHECKED_DISCRIMINATOR })
);
}

Expand Down Expand Up @@ -128,15 +134,17 @@ export function getApproveCheckedInstruction<
TAccountMint extends string,
TAccountDelegate extends string,
TAccountOwner extends string,
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
>(
input: ApproveCheckedInput<
TAccountSource,
TAccountMint,
TAccountDelegate,
TAccountOwner
>
>,
config?: { programAddress?: TProgramAddress }
): ApproveCheckedInstruction<
typeof TOKEN_PROGRAM_ADDRESS,
TProgramAddress,
TAccountSource,
TAccountMint,
TAccountDelegate,
Expand All @@ -145,7 +153,7 @@ export function getApproveCheckedInstruction<
: TAccountOwner
> {
// Program address.
const programAddress = TOKEN_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand Down Expand Up @@ -185,7 +193,7 @@ export function getApproveCheckedInstruction<
args as ApproveCheckedInstructionDataArgs
),
} as ApproveCheckedInstruction<
typeof TOKEN_PROGRAM_ADDRESS,
TProgramAddress,
TAccountSource,
TAccountMint,
TAccountDelegate,
Expand Down
18 changes: 13 additions & 5 deletions clients/js/src/generated/instructions/burn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ import {
import { TOKEN_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const BURN_DISCRIMINATOR = 8;

export function getBurnDiscriminatorBytes() {
return getU8Encoder().encode(BURN_DISCRIMINATOR);
}

export type BurnInstruction<
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
TAccountAccount extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -70,7 +76,7 @@ export function getBurnInstructionDataEncoder(): Encoder<BurnInstructionDataArgs
['discriminator', getU8Encoder()],
['amount', getU64Encoder()],
]),
(value) => ({ ...value, discriminator: 8 })
(value) => ({ ...value, discriminator: BURN_DISCRIMINATOR })
);
}

Expand Down Expand Up @@ -110,10 +116,12 @@ export function getBurnInstruction<
TAccountAccount extends string,
TAccountMint extends string,
TAccountAuthority extends string,
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
>(
input: BurnInput<TAccountAccount, TAccountMint, TAccountAuthority>
input: BurnInput<TAccountAccount, TAccountMint, TAccountAuthority>,
config?: { programAddress?: TProgramAddress }
): BurnInstruction<
typeof TOKEN_PROGRAM_ADDRESS,
TProgramAddress,
TAccountAccount,
TAccountMint,
(typeof input)['authority'] extends TransactionSigner<TAccountAuthority>
Expand All @@ -122,7 +130,7 @@ export function getBurnInstruction<
: TAccountAuthority
> {
// Program address.
const programAddress = TOKEN_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand Down Expand Up @@ -160,7 +168,7 @@ export function getBurnInstruction<
args as BurnInstructionDataArgs
),
} as BurnInstruction<
typeof TOKEN_PROGRAM_ADDRESS,
TProgramAddress,
TAccountAccount,
TAccountMint,
(typeof input)['authority'] extends TransactionSigner<TAccountAuthority>
Expand Down
18 changes: 13 additions & 5 deletions clients/js/src/generated/instructions/burnChecked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ import {
import { TOKEN_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const BURN_CHECKED_DISCRIMINATOR = 15;

export function getBurnCheckedDiscriminatorBytes() {
return getU8Encoder().encode(BURN_CHECKED_DISCRIMINATOR);
}

export type BurnCheckedInstruction<
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
TAccountAccount extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -78,7 +84,7 @@ export function getBurnCheckedInstructionDataEncoder(): Encoder<BurnCheckedInstr
['amount', getU64Encoder()],
['decimals', getU8Encoder()],
]),
(value) => ({ ...value, discriminator: 15 })
(value) => ({ ...value, discriminator: BURN_CHECKED_DISCRIMINATOR })
);
}

Expand Down Expand Up @@ -120,10 +126,12 @@ export function getBurnCheckedInstruction<
TAccountAccount extends string,
TAccountMint extends string,
TAccountAuthority extends string,
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
>(
input: BurnCheckedInput<TAccountAccount, TAccountMint, TAccountAuthority>
input: BurnCheckedInput<TAccountAccount, TAccountMint, TAccountAuthority>,
config?: { programAddress?: TProgramAddress }
): BurnCheckedInstruction<
typeof TOKEN_PROGRAM_ADDRESS,
TProgramAddress,
TAccountAccount,
TAccountMint,
(typeof input)['authority'] extends TransactionSigner<TAccountAuthority>
Expand All @@ -132,7 +140,7 @@ export function getBurnCheckedInstruction<
: TAccountAuthority
> {
// Program address.
const programAddress = TOKEN_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand Down Expand Up @@ -170,7 +178,7 @@ export function getBurnCheckedInstruction<
args as BurnCheckedInstructionDataArgs
),
} as BurnCheckedInstruction<
typeof TOKEN_PROGRAM_ADDRESS,
TProgramAddress,
TAccountAccount,
TAccountMint,
(typeof input)['authority'] extends TransactionSigner<TAccountAuthority>
Expand Down
18 changes: 13 additions & 5 deletions clients/js/src/generated/instructions/closeAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ import {
import { TOKEN_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const CLOSE_ACCOUNT_DISCRIMINATOR = 9;

export function getCloseAccountDiscriminatorBytes() {
return getU8Encoder().encode(CLOSE_ACCOUNT_DISCRIMINATOR);
}

export type CloseAccountInstruction<
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
TAccountAccount extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -61,7 +67,7 @@ export type CloseAccountInstructionDataArgs = {};
export function getCloseAccountInstructionDataEncoder(): Encoder<CloseAccountInstructionDataArgs> {
return transformEncoder(
getStructEncoder([['discriminator', getU8Encoder()]]),
(value) => ({ ...value, discriminator: 9 })
(value) => ({ ...value, discriminator: CLOSE_ACCOUNT_DISCRIMINATOR })
);
}

Expand Down Expand Up @@ -97,18 +103,20 @@ export function getCloseAccountInstruction<
TAccountAccount extends string,
TAccountDestination extends string,
TAccountOwner extends string,
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
>(
input: CloseAccountInput<TAccountAccount, TAccountDestination, TAccountOwner>
input: CloseAccountInput<TAccountAccount, TAccountDestination, TAccountOwner>,
config?: { programAddress?: TProgramAddress }
): CloseAccountInstruction<
typeof TOKEN_PROGRAM_ADDRESS,
TProgramAddress,
TAccountAccount,
TAccountDestination,
(typeof input)['owner'] extends TransactionSigner<TAccountOwner>
? ReadonlySignerAccount<TAccountOwner> & IAccountSignerMeta<TAccountOwner>
: TAccountOwner
> {
// Program address.
const programAddress = TOKEN_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand Down Expand Up @@ -144,7 +152,7 @@ export function getCloseAccountInstruction<
programAddress,
data: getCloseAccountInstructionDataEncoder().encode({}),
} as CloseAccountInstruction<
typeof TOKEN_PROGRAM_ADDRESS,
TProgramAddress,
TAccountAccount,
TAccountDestination,
(typeof input)['owner'] extends TransactionSigner<TAccountOwner>
Expand Down
Loading

0 comments on commit b4c00b4

Please sign in to comment.