Skip to content

Commit

Permalink
Bump Kinobi to 0.21.5 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva authored Oct 3, 2024
1 parent 5fa6f8c commit a061f30
Show file tree
Hide file tree
Showing 15 changed files with 294 additions and 177 deletions.
21 changes: 16 additions & 5 deletions clients/js/src/generated/instructions/advanceNonceAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ import {
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR = 4;

export function getAdvanceNonceAccountDiscriminatorBytes() {
return getU32Encoder().encode(ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR);
}

export type AdvanceNonceAccountInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountNonceAccount extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -63,7 +69,10 @@ export type AdvanceNonceAccountInstructionDataArgs = {};
export function getAdvanceNonceAccountInstructionDataEncoder(): Encoder<AdvanceNonceAccountInstructionDataArgs> {
return transformEncoder(
getStructEncoder([['discriminator', getU32Encoder()]]),
(value) => ({ ...value, discriminator: 4 })
(value) => ({
...value,
discriminator: ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR,
})
);
}

Expand Down Expand Up @@ -95,20 +104,22 @@ export function getAdvanceNonceAccountInstruction<
TAccountNonceAccount extends string,
TAccountRecentBlockhashesSysvar extends string,
TAccountNonceAuthority extends string,
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
>(
input: AdvanceNonceAccountInput<
TAccountNonceAccount,
TAccountRecentBlockhashesSysvar,
TAccountNonceAuthority
>
>,
config?: { programAddress?: TProgramAddress }
): AdvanceNonceAccountInstruction<
typeof SYSTEM_PROGRAM_ADDRESS,
TProgramAddress,
TAccountNonceAccount,
TAccountRecentBlockhashesSysvar,
TAccountNonceAuthority
> {
// Program address.
const programAddress = SYSTEM_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand Down Expand Up @@ -140,7 +151,7 @@ export function getAdvanceNonceAccountInstruction<
programAddress,
data: getAdvanceNonceAccountInstructionDataEncoder().encode({}),
} as AdvanceNonceAccountInstruction<
typeof SYSTEM_PROGRAM_ADDRESS,
TProgramAddress,
TAccountNonceAccount,
TAccountRecentBlockhashesSysvar,
TAccountNonceAuthority
Expand Down
22 changes: 16 additions & 6 deletions clients/js/src/generated/instructions/allocate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ import {
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const ALLOCATE_DISCRIMINATOR = 8;

export function getAllocateDiscriminatorBytes() {
return getU32Encoder().encode(ALLOCATE_DISCRIMINATOR);
}

export type AllocateInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountNewAccount extends string | IAccountMeta<string> = string,
Expand All @@ -56,7 +62,7 @@ export function getAllocateInstructionDataEncoder(): Encoder<AllocateInstruction
['discriminator', getU32Encoder()],
['space', getU64Encoder()],
]),
(value) => ({ ...value, discriminator: 8 })
(value) => ({ ...value, discriminator: ALLOCATE_DISCRIMINATOR })
);
}

Expand All @@ -82,11 +88,15 @@ export type AllocateInput<TAccountNewAccount extends string = string> = {
space: AllocateInstructionDataArgs['space'];
};

export function getAllocateInstruction<TAccountNewAccount extends string>(
input: AllocateInput<TAccountNewAccount>
): AllocateInstruction<typeof SYSTEM_PROGRAM_ADDRESS, TAccountNewAccount> {
export function getAllocateInstruction<
TAccountNewAccount extends string,
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
>(
input: AllocateInput<TAccountNewAccount>,
config?: { programAddress?: TProgramAddress }
): AllocateInstruction<TProgramAddress, TAccountNewAccount> {
// Program address.
const programAddress = SYSTEM_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand All @@ -107,7 +117,7 @@ export function getAllocateInstruction<TAccountNewAccount extends string>(
data: getAllocateInstructionDataEncoder().encode(
args as AllocateInstructionDataArgs
),
} as AllocateInstruction<typeof SYSTEM_PROGRAM_ADDRESS, TAccountNewAccount>;
} as AllocateInstruction<TProgramAddress, TAccountNewAccount>;

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

export const ALLOCATE_WITH_SEED_DISCRIMINATOR = 9;

export function getAllocateWithSeedDiscriminatorBytes() {
return getU32Encoder().encode(ALLOCATE_WITH_SEED_DISCRIMINATOR);
}

export type AllocateWithSeedInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountNewAccount extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -81,7 +87,7 @@ export function getAllocateWithSeedInstructionDataEncoder(): Encoder<AllocateWit
['space', getU64Encoder()],
['programAddress', getAddressEncoder()],
]),
(value) => ({ ...value, discriminator: 9 })
(value) => ({ ...value, discriminator: ALLOCATE_WITH_SEED_DISCRIMINATOR })
);
}

Expand Down Expand Up @@ -120,15 +126,17 @@ export type AllocateWithSeedInput<
export function getAllocateWithSeedInstruction<
TAccountNewAccount extends string,
TAccountBaseAccount extends string,
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
>(
input: AllocateWithSeedInput<TAccountNewAccount, TAccountBaseAccount>
input: AllocateWithSeedInput<TAccountNewAccount, TAccountBaseAccount>,
config?: { programAddress?: TProgramAddress }
): AllocateWithSeedInstruction<
typeof SYSTEM_PROGRAM_ADDRESS,
TProgramAddress,
TAccountNewAccount,
TAccountBaseAccount
> {
// Program address.
const programAddress = SYSTEM_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand All @@ -154,7 +162,7 @@ export function getAllocateWithSeedInstruction<
args as AllocateWithSeedInstructionDataArgs
),
} as AllocateWithSeedInstruction<
typeof SYSTEM_PROGRAM_ADDRESS,
TProgramAddress,
TAccountNewAccount,
TAccountBaseAccount
>;
Expand Down
22 changes: 16 additions & 6 deletions clients/js/src/generated/instructions/assign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ import {
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const ASSIGN_DISCRIMINATOR = 1;

export function getAssignDiscriminatorBytes() {
return getU32Encoder().encode(ASSIGN_DISCRIMINATOR);
}

export type AssignInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountAccount extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -59,7 +65,7 @@ export function getAssignInstructionDataEncoder(): Encoder<AssignInstructionData
['discriminator', getU32Encoder()],
['programAddress', getAddressEncoder()],
]),
(value) => ({ ...value, discriminator: 1 })
(value) => ({ ...value, discriminator: ASSIGN_DISCRIMINATOR })
);
}

Expand All @@ -85,11 +91,15 @@ export type AssignInput<TAccountAccount extends string = string> = {
programAddress: AssignInstructionDataArgs['programAddress'];
};

export function getAssignInstruction<TAccountAccount extends string>(
input: AssignInput<TAccountAccount>
): AssignInstruction<typeof SYSTEM_PROGRAM_ADDRESS, TAccountAccount> {
export function getAssignInstruction<
TAccountAccount extends string,
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
>(
input: AssignInput<TAccountAccount>,
config?: { programAddress?: TProgramAddress }
): AssignInstruction<TProgramAddress, TAccountAccount> {
// Program address.
const programAddress = SYSTEM_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand All @@ -110,7 +120,7 @@ export function getAssignInstruction<TAccountAccount extends string>(
data: getAssignInstructionDataEncoder().encode(
args as AssignInstructionDataArgs
),
} as AssignInstruction<typeof SYSTEM_PROGRAM_ADDRESS, TAccountAccount>;
} as AssignInstruction<TProgramAddress, TAccountAccount>;

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

export const ASSIGN_WITH_SEED_DISCRIMINATOR = 10;

export function getAssignWithSeedDiscriminatorBytes() {
return getU32Encoder().encode(ASSIGN_WITH_SEED_DISCRIMINATOR);
}

export type AssignWithSeedInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountAccount extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -78,7 +84,7 @@ export function getAssignWithSeedInstructionDataEncoder(): Encoder<AssignWithSee
['seed', addEncoderSizePrefix(getUtf8Encoder(), getU64Encoder())],
['programAddress', getAddressEncoder()],
]),
(value) => ({ ...value, discriminator: 10 })
(value) => ({ ...value, discriminator: ASSIGN_WITH_SEED_DISCRIMINATOR })
);
}

Expand Down Expand Up @@ -115,15 +121,17 @@ export type AssignWithSeedInput<
export function getAssignWithSeedInstruction<
TAccountAccount extends string,
TAccountBaseAccount extends string,
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
>(
input: AssignWithSeedInput<TAccountAccount, TAccountBaseAccount>
input: AssignWithSeedInput<TAccountAccount, TAccountBaseAccount>,
config?: { programAddress?: TProgramAddress }
): AssignWithSeedInstruction<
typeof SYSTEM_PROGRAM_ADDRESS,
TProgramAddress,
TAccountAccount,
TAccountBaseAccount
> {
// Program address.
const programAddress = SYSTEM_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand All @@ -149,7 +157,7 @@ export function getAssignWithSeedInstruction<
args as AssignWithSeedInstructionDataArgs
),
} as AssignWithSeedInstruction<
typeof SYSTEM_PROGRAM_ADDRESS,
TProgramAddress,
TAccountAccount,
TAccountBaseAccount
>;
Expand Down
21 changes: 16 additions & 5 deletions clients/js/src/generated/instructions/authorizeNonceAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ import {
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR = 7;

export function getAuthorizeNonceAccountDiscriminatorBytes() {
return getU32Encoder().encode(AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR);
}

export type AuthorizeNonceAccountInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountNonceAccount extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -66,7 +72,10 @@ export function getAuthorizeNonceAccountInstructionDataEncoder(): Encoder<Author
['discriminator', getU32Encoder()],
['newNonceAuthority', getAddressEncoder()],
]),
(value) => ({ ...value, discriminator: 7 })
(value) => ({
...value,
discriminator: AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR,
})
);
}

Expand Down Expand Up @@ -99,18 +108,20 @@ export type AuthorizeNonceAccountInput<
export function getAuthorizeNonceAccountInstruction<
TAccountNonceAccount extends string,
TAccountNonceAuthority extends string,
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
>(
input: AuthorizeNonceAccountInput<
TAccountNonceAccount,
TAccountNonceAuthority
>
>,
config?: { programAddress?: TProgramAddress }
): AuthorizeNonceAccountInstruction<
typeof SYSTEM_PROGRAM_ADDRESS,
TProgramAddress,
TAccountNonceAccount,
TAccountNonceAuthority
> {
// Program address.
const programAddress = SYSTEM_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand All @@ -136,7 +147,7 @@ export function getAuthorizeNonceAccountInstruction<
args as AuthorizeNonceAccountInstructionDataArgs
),
} as AuthorizeNonceAccountInstruction<
typeof SYSTEM_PROGRAM_ADDRESS,
TProgramAddress,
TAccountNonceAccount,
TAccountNonceAuthority
>;
Expand Down
18 changes: 13 additions & 5 deletions clients/js/src/generated/instructions/createAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ import {
type ResolvedAccount,
} from '../shared';

export const CREATE_ACCOUNT_DISCRIMINATOR = 0;

export function getCreateAccountDiscriminatorBytes() {
return getU32Encoder().encode(CREATE_ACCOUNT_DISCRIMINATOR);
}

export type CreateAccountInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountPayer extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -79,7 +85,7 @@ export function getCreateAccountInstructionDataEncoder(): Encoder<CreateAccountI
['space', getU64Encoder()],
['programAddress', getAddressEncoder()],
]),
(value) => ({ ...value, discriminator: 0 })
(value) => ({ ...value, discriminator: CREATE_ACCOUNT_DISCRIMINATOR })
);
}

Expand Down Expand Up @@ -116,16 +122,18 @@ export type CreateAccountInput<
export function getCreateAccountInstruction<
TAccountPayer extends string,
TAccountNewAccount extends string,
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
>(
input: CreateAccountInput<TAccountPayer, TAccountNewAccount>
input: CreateAccountInput<TAccountPayer, TAccountNewAccount>,
config?: { programAddress?: TProgramAddress }
): CreateAccountInstruction<
typeof SYSTEM_PROGRAM_ADDRESS,
TProgramAddress,
TAccountPayer,
TAccountNewAccount
> &
IInstructionWithByteDelta {
// Program address.
const programAddress = SYSTEM_PROGRAM_ADDRESS;
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand Down Expand Up @@ -157,7 +165,7 @@ export function getCreateAccountInstruction<
args as CreateAccountInstructionDataArgs
),
} as CreateAccountInstruction<
typeof SYSTEM_PROGRAM_ADDRESS,
TProgramAddress,
TAccountPayer,
TAccountNewAccount
>;
Expand Down
Loading

0 comments on commit a061f30

Please sign in to comment.