Skip to content

Commit b4c00b4

Browse files
authored
Bump kinobi versions, with renderers-js to 0.21.9 (#7)
1 parent 3d22e8b commit b4c00b4

30 files changed

+519
-285
lines changed

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

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

31+
export const AMOUNT_TO_UI_AMOUNT_DISCRIMINATOR = 23;
32+
33+
export function getAmountToUiAmountDiscriminatorBytes() {
34+
return getU8Encoder().encode(AMOUNT_TO_UI_AMOUNT_DISCRIMINATOR);
35+
}
36+
3137
export type AmountToUiAmountInstruction<
3238
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
3339
TAccountMint extends string | IAccountMeta<string> = string,
@@ -60,7 +66,7 @@ export function getAmountToUiAmountInstructionDataEncoder(): Encoder<AmountToUiA
6066
['discriminator', getU8Encoder()],
6167
['amount', getU64Encoder()],
6268
]),
63-
(value) => ({ ...value, discriminator: 23 })
69+
(value) => ({ ...value, discriminator: AMOUNT_TO_UI_AMOUNT_DISCRIMINATOR })
6470
);
6571
}
6672

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

90-
export function getAmountToUiAmountInstruction<TAccountMint extends string>(
91-
input: AmountToUiAmountInput<TAccountMint>
92-
): AmountToUiAmountInstruction<typeof TOKEN_PROGRAM_ADDRESS, TAccountMint> {
96+
export function getAmountToUiAmountInstruction<
97+
TAccountMint extends string,
98+
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
99+
>(
100+
input: AmountToUiAmountInput<TAccountMint>,
101+
config?: { programAddress?: TProgramAddress }
102+
): AmountToUiAmountInstruction<TProgramAddress, TAccountMint> {
93103
// Program address.
94-
const programAddress = TOKEN_PROGRAM_ADDRESS;
104+
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;
95105

96106
// Original accounts.
97107
const originalAccounts = {
@@ -112,7 +122,7 @@ export function getAmountToUiAmountInstruction<TAccountMint extends string>(
112122
data: getAmountToUiAmountInstructionDataEncoder().encode(
113123
args as AmountToUiAmountInstructionDataArgs
114124
),
115-
} as AmountToUiAmountInstruction<typeof TOKEN_PROGRAM_ADDRESS, TAccountMint>;
125+
} as AmountToUiAmountInstruction<TProgramAddress, TAccountMint>;
116126

117127
return instruction;
118128
}

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ import {
3333
import { TOKEN_PROGRAM_ADDRESS } from '../programs';
3434
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3535

36+
export const APPROVE_DISCRIMINATOR = 4;
37+
38+
export function getApproveDiscriminatorBytes() {
39+
return getU8Encoder().encode(APPROVE_DISCRIMINATOR);
40+
}
41+
3642
export type ApproveInstruction<
3743
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
3844
TAccountSource extends string | IAccountMeta<string> = string,
@@ -73,7 +79,7 @@ export function getApproveInstructionDataEncoder(): Encoder<ApproveInstructionDa
7379
['discriminator', getU8Encoder()],
7480
['amount', getU64Encoder()],
7581
]),
76-
(value) => ({ ...value, discriminator: 4 })
82+
(value) => ({ ...value, discriminator: APPROVE_DISCRIMINATOR })
7783
);
7884
}
7985

@@ -113,18 +119,20 @@ export function getApproveInstruction<
113119
TAccountSource extends string,
114120
TAccountDelegate extends string,
115121
TAccountOwner extends string,
122+
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
116123
>(
117-
input: ApproveInput<TAccountSource, TAccountDelegate, TAccountOwner>
124+
input: ApproveInput<TAccountSource, TAccountDelegate, TAccountOwner>,
125+
config?: { programAddress?: TProgramAddress }
118126
): ApproveInstruction<
119-
typeof TOKEN_PROGRAM_ADDRESS,
127+
TProgramAddress,
120128
TAccountSource,
121129
TAccountDelegate,
122130
(typeof input)['owner'] extends TransactionSigner<TAccountOwner>
123131
? ReadonlySignerAccount<TAccountOwner> & IAccountSignerMeta<TAccountOwner>
124132
: TAccountOwner
125133
> {
126134
// Program address.
127-
const programAddress = TOKEN_PROGRAM_ADDRESS;
135+
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;
128136

129137
// Original accounts.
130138
const originalAccounts = {
@@ -162,7 +170,7 @@ export function getApproveInstruction<
162170
args as ApproveInstructionDataArgs
163171
),
164172
} as ApproveInstruction<
165-
typeof TOKEN_PROGRAM_ADDRESS,
173+
TProgramAddress,
166174
TAccountSource,
167175
TAccountDelegate,
168176
(typeof input)['owner'] extends TransactionSigner<TAccountOwner>

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ import {
3333
import { TOKEN_PROGRAM_ADDRESS } from '../programs';
3434
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3535

36+
export const APPROVE_CHECKED_DISCRIMINATOR = 13;
37+
38+
export function getApproveCheckedDiscriminatorBytes() {
39+
return getU8Encoder().encode(APPROVE_CHECKED_DISCRIMINATOR);
40+
}
41+
3642
export type ApproveCheckedInstruction<
3743
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
3844
TAccountSource extends string | IAccountMeta<string> = string,
@@ -82,7 +88,7 @@ export function getApproveCheckedInstructionDataEncoder(): Encoder<ApproveChecke
8288
['amount', getU64Encoder()],
8389
['decimals', getU8Encoder()],
8490
]),
85-
(value) => ({ ...value, discriminator: 13 })
91+
(value) => ({ ...value, discriminator: APPROVE_CHECKED_DISCRIMINATOR })
8692
);
8793
}
8894

@@ -128,15 +134,17 @@ export function getApproveCheckedInstruction<
128134
TAccountMint extends string,
129135
TAccountDelegate extends string,
130136
TAccountOwner extends string,
137+
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
131138
>(
132139
input: ApproveCheckedInput<
133140
TAccountSource,
134141
TAccountMint,
135142
TAccountDelegate,
136143
TAccountOwner
137-
>
144+
>,
145+
config?: { programAddress?: TProgramAddress }
138146
): ApproveCheckedInstruction<
139-
typeof TOKEN_PROGRAM_ADDRESS,
147+
TProgramAddress,
140148
TAccountSource,
141149
TAccountMint,
142150
TAccountDelegate,
@@ -145,7 +153,7 @@ export function getApproveCheckedInstruction<
145153
: TAccountOwner
146154
> {
147155
// Program address.
148-
const programAddress = TOKEN_PROGRAM_ADDRESS;
156+
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;
149157

150158
// Original accounts.
151159
const originalAccounts = {
@@ -185,7 +193,7 @@ export function getApproveCheckedInstruction<
185193
args as ApproveCheckedInstructionDataArgs
186194
),
187195
} as ApproveCheckedInstruction<
188-
typeof TOKEN_PROGRAM_ADDRESS,
196+
TProgramAddress,
189197
TAccountSource,
190198
TAccountMint,
191199
TAccountDelegate,

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ import {
3333
import { TOKEN_PROGRAM_ADDRESS } from '../programs';
3434
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3535

36+
export const BURN_DISCRIMINATOR = 8;
37+
38+
export function getBurnDiscriminatorBytes() {
39+
return getU8Encoder().encode(BURN_DISCRIMINATOR);
40+
}
41+
3642
export type BurnInstruction<
3743
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
3844
TAccountAccount extends string | IAccountMeta<string> = string,
@@ -70,7 +76,7 @@ export function getBurnInstructionDataEncoder(): Encoder<BurnInstructionDataArgs
7076
['discriminator', getU8Encoder()],
7177
['amount', getU64Encoder()],
7278
]),
73-
(value) => ({ ...value, discriminator: 8 })
79+
(value) => ({ ...value, discriminator: BURN_DISCRIMINATOR })
7480
);
7581
}
7682

@@ -110,10 +116,12 @@ export function getBurnInstruction<
110116
TAccountAccount extends string,
111117
TAccountMint extends string,
112118
TAccountAuthority extends string,
119+
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
113120
>(
114-
input: BurnInput<TAccountAccount, TAccountMint, TAccountAuthority>
121+
input: BurnInput<TAccountAccount, TAccountMint, TAccountAuthority>,
122+
config?: { programAddress?: TProgramAddress }
115123
): BurnInstruction<
116-
typeof TOKEN_PROGRAM_ADDRESS,
124+
TProgramAddress,
117125
TAccountAccount,
118126
TAccountMint,
119127
(typeof input)['authority'] extends TransactionSigner<TAccountAuthority>
@@ -122,7 +130,7 @@ export function getBurnInstruction<
122130
: TAccountAuthority
123131
> {
124132
// Program address.
125-
const programAddress = TOKEN_PROGRAM_ADDRESS;
133+
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;
126134

127135
// Original accounts.
128136
const originalAccounts = {
@@ -160,7 +168,7 @@ export function getBurnInstruction<
160168
args as BurnInstructionDataArgs
161169
),
162170
} as BurnInstruction<
163-
typeof TOKEN_PROGRAM_ADDRESS,
171+
TProgramAddress,
164172
TAccountAccount,
165173
TAccountMint,
166174
(typeof input)['authority'] extends TransactionSigner<TAccountAuthority>

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ import {
3333
import { TOKEN_PROGRAM_ADDRESS } from '../programs';
3434
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3535

36+
export const BURN_CHECKED_DISCRIMINATOR = 15;
37+
38+
export function getBurnCheckedDiscriminatorBytes() {
39+
return getU8Encoder().encode(BURN_CHECKED_DISCRIMINATOR);
40+
}
41+
3642
export type BurnCheckedInstruction<
3743
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
3844
TAccountAccount extends string | IAccountMeta<string> = string,
@@ -78,7 +84,7 @@ export function getBurnCheckedInstructionDataEncoder(): Encoder<BurnCheckedInstr
7884
['amount', getU64Encoder()],
7985
['decimals', getU8Encoder()],
8086
]),
81-
(value) => ({ ...value, discriminator: 15 })
87+
(value) => ({ ...value, discriminator: BURN_CHECKED_DISCRIMINATOR })
8288
);
8389
}
8490

@@ -120,10 +126,12 @@ export function getBurnCheckedInstruction<
120126
TAccountAccount extends string,
121127
TAccountMint extends string,
122128
TAccountAuthority extends string,
129+
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
123130
>(
124-
input: BurnCheckedInput<TAccountAccount, TAccountMint, TAccountAuthority>
131+
input: BurnCheckedInput<TAccountAccount, TAccountMint, TAccountAuthority>,
132+
config?: { programAddress?: TProgramAddress }
125133
): BurnCheckedInstruction<
126-
typeof TOKEN_PROGRAM_ADDRESS,
134+
TProgramAddress,
127135
TAccountAccount,
128136
TAccountMint,
129137
(typeof input)['authority'] extends TransactionSigner<TAccountAuthority>
@@ -132,7 +140,7 @@ export function getBurnCheckedInstruction<
132140
: TAccountAuthority
133141
> {
134142
// Program address.
135-
const programAddress = TOKEN_PROGRAM_ADDRESS;
143+
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;
136144

137145
// Original accounts.
138146
const originalAccounts = {
@@ -170,7 +178,7 @@ export function getBurnCheckedInstruction<
170178
args as BurnCheckedInstructionDataArgs
171179
),
172180
} as BurnCheckedInstruction<
173-
typeof TOKEN_PROGRAM_ADDRESS,
181+
TProgramAddress,
174182
TAccountAccount,
175183
TAccountMint,
176184
(typeof input)['authority'] extends TransactionSigner<TAccountAuthority>

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

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

34+
export const CLOSE_ACCOUNT_DISCRIMINATOR = 9;
35+
36+
export function getCloseAccountDiscriminatorBytes() {
37+
return getU8Encoder().encode(CLOSE_ACCOUNT_DISCRIMINATOR);
38+
}
39+
3440
export type CloseAccountInstruction<
3541
TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS,
3642
TAccountAccount extends string | IAccountMeta<string> = string,
@@ -61,7 +67,7 @@ export type CloseAccountInstructionDataArgs = {};
6167
export function getCloseAccountInstructionDataEncoder(): Encoder<CloseAccountInstructionDataArgs> {
6268
return transformEncoder(
6369
getStructEncoder([['discriminator', getU8Encoder()]]),
64-
(value) => ({ ...value, discriminator: 9 })
70+
(value) => ({ ...value, discriminator: CLOSE_ACCOUNT_DISCRIMINATOR })
6571
);
6672
}
6773

@@ -97,18 +103,20 @@ export function getCloseAccountInstruction<
97103
TAccountAccount extends string,
98104
TAccountDestination extends string,
99105
TAccountOwner extends string,
106+
TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS,
100107
>(
101-
input: CloseAccountInput<TAccountAccount, TAccountDestination, TAccountOwner>
108+
input: CloseAccountInput<TAccountAccount, TAccountDestination, TAccountOwner>,
109+
config?: { programAddress?: TProgramAddress }
102110
): CloseAccountInstruction<
103-
typeof TOKEN_PROGRAM_ADDRESS,
111+
TProgramAddress,
104112
TAccountAccount,
105113
TAccountDestination,
106114
(typeof input)['owner'] extends TransactionSigner<TAccountOwner>
107115
? ReadonlySignerAccount<TAccountOwner> & IAccountSignerMeta<TAccountOwner>
108116
: TAccountOwner
109117
> {
110118
// Program address.
111-
const programAddress = TOKEN_PROGRAM_ADDRESS;
119+
const programAddress = config?.programAddress ?? TOKEN_PROGRAM_ADDRESS;
112120

113121
// Original accounts.
114122
const originalAccounts = {
@@ -144,7 +152,7 @@ export function getCloseAccountInstruction<
144152
programAddress,
145153
data: getCloseAccountInstructionDataEncoder().encode({}),
146154
} as CloseAccountInstruction<
147-
typeof TOKEN_PROGRAM_ADDRESS,
155+
TProgramAddress,
148156
TAccountAccount,
149157
TAccountDestination,
150158
(typeof input)['owner'] extends TransactionSigner<TAccountOwner>

0 commit comments

Comments
 (0)