Skip to content

Commit a061f30

Browse files
authored
Bump Kinobi to 0.21.5 (#14)
1 parent 5fa6f8c commit a061f30

15 files changed

+294
-177
lines changed

clients/js/src/generated/instructions/advanceNonceAccount.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ import {
3030
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
3131
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3232

33+
export const ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR = 4;
34+
35+
export function getAdvanceNonceAccountDiscriminatorBytes() {
36+
return getU32Encoder().encode(ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR);
37+
}
38+
3339
export type AdvanceNonceAccountInstruction<
3440
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
3541
TAccountNonceAccount extends string | IAccountMeta<string> = string,
@@ -63,7 +69,10 @@ export type AdvanceNonceAccountInstructionDataArgs = {};
6369
export function getAdvanceNonceAccountInstructionDataEncoder(): Encoder<AdvanceNonceAccountInstructionDataArgs> {
6470
return transformEncoder(
6571
getStructEncoder([['discriminator', getU32Encoder()]]),
66-
(value) => ({ ...value, discriminator: 4 })
72+
(value) => ({
73+
...value,
74+
discriminator: ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR,
75+
})
6776
);
6877
}
6978

@@ -95,20 +104,22 @@ export function getAdvanceNonceAccountInstruction<
95104
TAccountNonceAccount extends string,
96105
TAccountRecentBlockhashesSysvar extends string,
97106
TAccountNonceAuthority extends string,
107+
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
98108
>(
99109
input: AdvanceNonceAccountInput<
100110
TAccountNonceAccount,
101111
TAccountRecentBlockhashesSysvar,
102112
TAccountNonceAuthority
103-
>
113+
>,
114+
config?: { programAddress?: TProgramAddress }
104115
): AdvanceNonceAccountInstruction<
105-
typeof SYSTEM_PROGRAM_ADDRESS,
116+
TProgramAddress,
106117
TAccountNonceAccount,
107118
TAccountRecentBlockhashesSysvar,
108119
TAccountNonceAuthority
109120
> {
110121
// Program address.
111-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
122+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
112123

113124
// Original accounts.
114125
const originalAccounts = {
@@ -140,7 +151,7 @@ export function getAdvanceNonceAccountInstruction<
140151
programAddress,
141152
data: getAdvanceNonceAccountInstructionDataEncoder().encode({}),
142153
} as AdvanceNonceAccountInstruction<
143-
typeof SYSTEM_PROGRAM_ADDRESS,
154+
TProgramAddress,
144155
TAccountNonceAccount,
145156
TAccountRecentBlockhashesSysvar,
146157
TAccountNonceAuthority

clients/js/src/generated/instructions/allocate.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ import {
3030
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
3131
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3232

33+
export const ALLOCATE_DISCRIMINATOR = 8;
34+
35+
export function getAllocateDiscriminatorBytes() {
36+
return getU32Encoder().encode(ALLOCATE_DISCRIMINATOR);
37+
}
38+
3339
export type AllocateInstruction<
3440
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
3541
TAccountNewAccount extends string | IAccountMeta<string> = string,
@@ -56,7 +62,7 @@ export function getAllocateInstructionDataEncoder(): Encoder<AllocateInstruction
5662
['discriminator', getU32Encoder()],
5763
['space', getU64Encoder()],
5864
]),
59-
(value) => ({ ...value, discriminator: 8 })
65+
(value) => ({ ...value, discriminator: ALLOCATE_DISCRIMINATOR })
6066
);
6167
}
6268

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

85-
export function getAllocateInstruction<TAccountNewAccount extends string>(
86-
input: AllocateInput<TAccountNewAccount>
87-
): AllocateInstruction<typeof SYSTEM_PROGRAM_ADDRESS, TAccountNewAccount> {
91+
export function getAllocateInstruction<
92+
TAccountNewAccount extends string,
93+
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
94+
>(
95+
input: AllocateInput<TAccountNewAccount>,
96+
config?: { programAddress?: TProgramAddress }
97+
): AllocateInstruction<TProgramAddress, TAccountNewAccount> {
8898
// Program address.
89-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
99+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
90100

91101
// Original accounts.
92102
const originalAccounts = {
@@ -107,7 +117,7 @@ export function getAllocateInstruction<TAccountNewAccount extends string>(
107117
data: getAllocateInstructionDataEncoder().encode(
108118
args as AllocateInstructionDataArgs
109119
),
110-
} as AllocateInstruction<typeof SYSTEM_PROGRAM_ADDRESS, TAccountNewAccount>;
120+
} as AllocateInstruction<TProgramAddress, TAccountNewAccount>;
111121

112122
return instruction;
113123
}

clients/js/src/generated/instructions/allocateWithSeed.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ import {
3737
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
3838
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3939

40+
export const ALLOCATE_WITH_SEED_DISCRIMINATOR = 9;
41+
42+
export function getAllocateWithSeedDiscriminatorBytes() {
43+
return getU32Encoder().encode(ALLOCATE_WITH_SEED_DISCRIMINATOR);
44+
}
45+
4046
export type AllocateWithSeedInstruction<
4147
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
4248
TAccountNewAccount extends string | IAccountMeta<string> = string,
@@ -81,7 +87,7 @@ export function getAllocateWithSeedInstructionDataEncoder(): Encoder<AllocateWit
8187
['space', getU64Encoder()],
8288
['programAddress', getAddressEncoder()],
8389
]),
84-
(value) => ({ ...value, discriminator: 9 })
90+
(value) => ({ ...value, discriminator: ALLOCATE_WITH_SEED_DISCRIMINATOR })
8591
);
8692
}
8793

@@ -120,15 +126,17 @@ export type AllocateWithSeedInput<
120126
export function getAllocateWithSeedInstruction<
121127
TAccountNewAccount extends string,
122128
TAccountBaseAccount extends string,
129+
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
123130
>(
124-
input: AllocateWithSeedInput<TAccountNewAccount, TAccountBaseAccount>
131+
input: AllocateWithSeedInput<TAccountNewAccount, TAccountBaseAccount>,
132+
config?: { programAddress?: TProgramAddress }
125133
): AllocateWithSeedInstruction<
126-
typeof SYSTEM_PROGRAM_ADDRESS,
134+
TProgramAddress,
127135
TAccountNewAccount,
128136
TAccountBaseAccount
129137
> {
130138
// Program address.
131-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
139+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
132140

133141
// Original accounts.
134142
const originalAccounts = {
@@ -154,7 +162,7 @@ export function getAllocateWithSeedInstruction<
154162
args as AllocateWithSeedInstructionDataArgs
155163
),
156164
} as AllocateWithSeedInstruction<
157-
typeof SYSTEM_PROGRAM_ADDRESS,
165+
TProgramAddress,
158166
TAccountNewAccount,
159167
TAccountBaseAccount
160168
>;

clients/js/src/generated/instructions/assign.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ import {
3030
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
3131
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3232

33+
export const ASSIGN_DISCRIMINATOR = 1;
34+
35+
export function getAssignDiscriminatorBytes() {
36+
return getU32Encoder().encode(ASSIGN_DISCRIMINATOR);
37+
}
38+
3339
export type AssignInstruction<
3440
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
3541
TAccountAccount extends string | IAccountMeta<string> = string,
@@ -59,7 +65,7 @@ export function getAssignInstructionDataEncoder(): Encoder<AssignInstructionData
5965
['discriminator', getU32Encoder()],
6066
['programAddress', getAddressEncoder()],
6167
]),
62-
(value) => ({ ...value, discriminator: 1 })
68+
(value) => ({ ...value, discriminator: ASSIGN_DISCRIMINATOR })
6369
);
6470
}
6571

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

88-
export function getAssignInstruction<TAccountAccount extends string>(
89-
input: AssignInput<TAccountAccount>
90-
): AssignInstruction<typeof SYSTEM_PROGRAM_ADDRESS, TAccountAccount> {
94+
export function getAssignInstruction<
95+
TAccountAccount extends string,
96+
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
97+
>(
98+
input: AssignInput<TAccountAccount>,
99+
config?: { programAddress?: TProgramAddress }
100+
): AssignInstruction<TProgramAddress, TAccountAccount> {
91101
// Program address.
92-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
102+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
93103

94104
// Original accounts.
95105
const originalAccounts = {
@@ -110,7 +120,7 @@ export function getAssignInstruction<TAccountAccount extends string>(
110120
data: getAssignInstructionDataEncoder().encode(
111121
args as AssignInstructionDataArgs
112122
),
113-
} as AssignInstruction<typeof SYSTEM_PROGRAM_ADDRESS, TAccountAccount>;
123+
} as AssignInstruction<TProgramAddress, TAccountAccount>;
114124

115125
return instruction;
116126
}

clients/js/src/generated/instructions/assignWithSeed.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ import {
3737
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
3838
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3939

40+
export const ASSIGN_WITH_SEED_DISCRIMINATOR = 10;
41+
42+
export function getAssignWithSeedDiscriminatorBytes() {
43+
return getU32Encoder().encode(ASSIGN_WITH_SEED_DISCRIMINATOR);
44+
}
45+
4046
export type AssignWithSeedInstruction<
4147
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
4248
TAccountAccount extends string | IAccountMeta<string> = string,
@@ -78,7 +84,7 @@ export function getAssignWithSeedInstructionDataEncoder(): Encoder<AssignWithSee
7884
['seed', addEncoderSizePrefix(getUtf8Encoder(), getU64Encoder())],
7985
['programAddress', getAddressEncoder()],
8086
]),
81-
(value) => ({ ...value, discriminator: 10 })
87+
(value) => ({ ...value, discriminator: ASSIGN_WITH_SEED_DISCRIMINATOR })
8288
);
8389
}
8490

@@ -115,15 +121,17 @@ export type AssignWithSeedInput<
115121
export function getAssignWithSeedInstruction<
116122
TAccountAccount extends string,
117123
TAccountBaseAccount extends string,
124+
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
118125
>(
119-
input: AssignWithSeedInput<TAccountAccount, TAccountBaseAccount>
126+
input: AssignWithSeedInput<TAccountAccount, TAccountBaseAccount>,
127+
config?: { programAddress?: TProgramAddress }
120128
): AssignWithSeedInstruction<
121-
typeof SYSTEM_PROGRAM_ADDRESS,
129+
TProgramAddress,
122130
TAccountAccount,
123131
TAccountBaseAccount
124132
> {
125133
// Program address.
126-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
134+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
127135

128136
// Original accounts.
129137
const originalAccounts = {
@@ -149,7 +157,7 @@ export function getAssignWithSeedInstruction<
149157
args as AssignWithSeedInstructionDataArgs
150158
),
151159
} as AssignWithSeedInstruction<
152-
typeof SYSTEM_PROGRAM_ADDRESS,
160+
TProgramAddress,
153161
TAccountAccount,
154162
TAccountBaseAccount
155163
>;

clients/js/src/generated/instructions/authorizeNonceAccount.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ import {
3131
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
3232
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3333

34+
export const AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR = 7;
35+
36+
export function getAuthorizeNonceAccountDiscriminatorBytes() {
37+
return getU32Encoder().encode(AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR);
38+
}
39+
3440
export type AuthorizeNonceAccountInstruction<
3541
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
3642
TAccountNonceAccount extends string | IAccountMeta<string> = string,
@@ -66,7 +72,10 @@ export function getAuthorizeNonceAccountInstructionDataEncoder(): Encoder<Author
6672
['discriminator', getU32Encoder()],
6773
['newNonceAuthority', getAddressEncoder()],
6874
]),
69-
(value) => ({ ...value, discriminator: 7 })
75+
(value) => ({
76+
...value,
77+
discriminator: AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR,
78+
})
7079
);
7180
}
7281

@@ -99,18 +108,20 @@ export type AuthorizeNonceAccountInput<
99108
export function getAuthorizeNonceAccountInstruction<
100109
TAccountNonceAccount extends string,
101110
TAccountNonceAuthority extends string,
111+
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
102112
>(
103113
input: AuthorizeNonceAccountInput<
104114
TAccountNonceAccount,
105115
TAccountNonceAuthority
106-
>
116+
>,
117+
config?: { programAddress?: TProgramAddress }
107118
): AuthorizeNonceAccountInstruction<
108-
typeof SYSTEM_PROGRAM_ADDRESS,
119+
TProgramAddress,
109120
TAccountNonceAccount,
110121
TAccountNonceAuthority
111122
> {
112123
// Program address.
113-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
124+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
114125

115126
// Original accounts.
116127
const originalAccounts = {
@@ -136,7 +147,7 @@ export function getAuthorizeNonceAccountInstruction<
136147
args as AuthorizeNonceAccountInstructionDataArgs
137148
),
138149
} as AuthorizeNonceAccountInstruction<
139-
typeof SYSTEM_PROGRAM_ADDRESS,
150+
TProgramAddress,
140151
TAccountNonceAccount,
141152
TAccountNonceAuthority
142153
>;

clients/js/src/generated/instructions/createAccount.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ import {
3737
type ResolvedAccount,
3838
} from '../shared';
3939

40+
export const CREATE_ACCOUNT_DISCRIMINATOR = 0;
41+
42+
export function getCreateAccountDiscriminatorBytes() {
43+
return getU32Encoder().encode(CREATE_ACCOUNT_DISCRIMINATOR);
44+
}
45+
4046
export type CreateAccountInstruction<
4147
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
4248
TAccountPayer extends string | IAccountMeta<string> = string,
@@ -79,7 +85,7 @@ export function getCreateAccountInstructionDataEncoder(): Encoder<CreateAccountI
7985
['space', getU64Encoder()],
8086
['programAddress', getAddressEncoder()],
8187
]),
82-
(value) => ({ ...value, discriminator: 0 })
88+
(value) => ({ ...value, discriminator: CREATE_ACCOUNT_DISCRIMINATOR })
8389
);
8490
}
8591

@@ -116,16 +122,18 @@ export type CreateAccountInput<
116122
export function getCreateAccountInstruction<
117123
TAccountPayer extends string,
118124
TAccountNewAccount extends string,
125+
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
119126
>(
120-
input: CreateAccountInput<TAccountPayer, TAccountNewAccount>
127+
input: CreateAccountInput<TAccountPayer, TAccountNewAccount>,
128+
config?: { programAddress?: TProgramAddress }
121129
): CreateAccountInstruction<
122-
typeof SYSTEM_PROGRAM_ADDRESS,
130+
TProgramAddress,
123131
TAccountPayer,
124132
TAccountNewAccount
125133
> &
126134
IInstructionWithByteDelta {
127135
// Program address.
128-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
136+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
129137

130138
// Original accounts.
131139
const originalAccounts = {
@@ -157,7 +165,7 @@ export function getCreateAccountInstruction<
157165
args as CreateAccountInstructionDataArgs
158166
),
159167
} as CreateAccountInstruction<
160-
typeof SYSTEM_PROGRAM_ADDRESS,
168+
TProgramAddress,
161169
TAccountPayer,
162170
TAccountNewAccount
163171
>;

0 commit comments

Comments
 (0)