Skip to content

Commit 5565e44

Browse files
committed
Add an optional config parameter to override programAddress when creating an instruction
1 parent 18f8633 commit 5565e44

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+178
-110
lines changed

packages/renderers-js/e2e/anchor/src/generated/instructions/createGuard.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ export async function getCreateGuardInstructionAsync<
234234
TAccountAssociatedTokenProgram,
235235
TAccountTokenProgram,
236236
TAccountSystemProgram
237-
>
237+
>,
238+
config?: { programAddress?: Address }
238239
): Promise<
239240
CreateGuardInstruction<
240241
typeof WEN_TRANSFER_GUARD_PROGRAM_ADDRESS,
@@ -249,7 +250,8 @@ export async function getCreateGuardInstructionAsync<
249250
>
250251
> {
251252
// Program address.
252-
const programAddress = WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
253+
const programAddress =
254+
config?.programAddress ?? WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
253255

254256
// Original accounts.
255257
const originalAccounts = {
@@ -395,7 +397,8 @@ export function getCreateGuardInstruction<
395397
TAccountAssociatedTokenProgram,
396398
TAccountTokenProgram,
397399
TAccountSystemProgram
398-
>
400+
>,
401+
config?: { programAddress?: Address }
399402
): CreateGuardInstruction<
400403
typeof WEN_TRANSFER_GUARD_PROGRAM_ADDRESS,
401404
TAccountGuard,
@@ -408,7 +411,8 @@ export function getCreateGuardInstruction<
408411
TAccountSystemProgram
409412
> {
410413
// Program address.
411-
const programAddress = WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
414+
const programAddress =
415+
config?.programAddress ?? WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
412416

413417
// Original accounts.
414418
const originalAccounts = {

packages/renderers-js/e2e/anchor/src/generated/instructions/execute.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ export async function getExecuteInstructionAsync<
156156
TAccountExtraMetasAccount,
157157
TAccountGuard,
158158
TAccountInstructionSysvarAccount
159-
>
159+
>,
160+
config?: { programAddress?: Address }
160161
): Promise<
161162
ExecuteInstruction<
162163
typeof WEN_TRANSFER_GUARD_PROGRAM_ADDRESS,
@@ -170,7 +171,8 @@ export async function getExecuteInstructionAsync<
170171
>
171172
> {
172173
// Program address.
173-
const programAddress = WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
174+
const programAddress =
175+
config?.programAddress ?? WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
174176

175177
// Original accounts.
176178
const originalAccounts = {
@@ -284,7 +286,8 @@ export function getExecuteInstruction<
284286
TAccountExtraMetasAccount,
285287
TAccountGuard,
286288
TAccountInstructionSysvarAccount
287-
>
289+
>,
290+
config?: { programAddress?: Address }
288291
): ExecuteInstruction<
289292
typeof WEN_TRANSFER_GUARD_PROGRAM_ADDRESS,
290293
TAccountSourceAccount,
@@ -296,7 +299,8 @@ export function getExecuteInstruction<
296299
TAccountInstructionSysvarAccount
297300
> {
298301
// Program address.
299-
const programAddress = WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
302+
const programAddress =
303+
config?.programAddress ?? WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
300304

301305
// Original accounts.
302306
const originalAccounts = {

packages/renderers-js/e2e/anchor/src/generated/instructions/initialize.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ export async function getInitializeInstructionAsync<
144144
TAccountTransferHookAuthority,
145145
TAccountSystemProgram,
146146
TAccountPayer
147-
>
147+
>,
148+
config?: { programAddress?: Address }
148149
): Promise<
149150
InitializeInstruction<
150151
typeof WEN_TRANSFER_GUARD_PROGRAM_ADDRESS,
@@ -157,7 +158,8 @@ export async function getInitializeInstructionAsync<
157158
>
158159
> {
159160
// Program address.
160-
const programAddress = WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
161+
const programAddress =
162+
config?.programAddress ?? WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
161163

162164
// Original accounts.
163165
const originalAccounts = {
@@ -255,7 +257,8 @@ export function getInitializeInstruction<
255257
TAccountTransferHookAuthority,
256258
TAccountSystemProgram,
257259
TAccountPayer
258-
>
260+
>,
261+
config?: { programAddress?: Address }
259262
): InitializeInstruction<
260263
typeof WEN_TRANSFER_GUARD_PROGRAM_ADDRESS,
261264
TAccountExtraMetasAccount,
@@ -266,7 +269,8 @@ export function getInitializeInstruction<
266269
TAccountPayer
267270
> {
268271
// Program address.
269-
const programAddress = WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
272+
const programAddress =
273+
config?.programAddress ?? WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
270274

271275
// Original accounts.
272276
const originalAccounts = {

packages/renderers-js/e2e/anchor/src/generated/instructions/updateGuard.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ export async function getUpdateGuardInstructionAsync<
193193
TAccountGuardAuthority,
194194
TAccountTokenProgram,
195195
TAccountSystemProgram
196-
>
196+
>,
197+
config?: { programAddress?: Address }
197198
): Promise<
198199
UpdateGuardInstruction<
199200
typeof WEN_TRANSFER_GUARD_PROGRAM_ADDRESS,
@@ -206,7 +207,8 @@ export async function getUpdateGuardInstructionAsync<
206207
>
207208
> {
208209
// Program address.
209-
const programAddress = WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
210+
const programAddress =
211+
config?.programAddress ?? WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
210212

211213
// Original accounts.
212214
const originalAccounts = {
@@ -325,7 +327,8 @@ export function getUpdateGuardInstruction<
325327
TAccountGuardAuthority,
326328
TAccountTokenProgram,
327329
TAccountSystemProgram
328-
>
330+
>,
331+
config?: { programAddress?: Address }
329332
): UpdateGuardInstruction<
330333
typeof WEN_TRANSFER_GUARD_PROGRAM_ADDRESS,
331334
TAccountGuard,
@@ -336,7 +339,8 @@ export function getUpdateGuardInstruction<
336339
TAccountSystemProgram
337340
> {
338341
// Program address.
339-
const programAddress = WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
342+
const programAddress =
343+
config?.programAddress ?? WEN_TRANSFER_GUARD_PROGRAM_ADDRESS;
340344

341345
// Original accounts.
342346
const originalAccounts = {

packages/renderers-js/e2e/memo/src/generated/instructions/addMemo.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ export type AddMemoInput = {
6060
};
6161

6262
export function getAddMemoInstruction(
63-
input: AddMemoInput
63+
input: AddMemoInput,
64+
config?: { programAddress?: Address }
6465
): AddMemoInstruction<typeof MEMO_PROGRAM_ADDRESS> {
6566
// Program address.
66-
const programAddress = MEMO_PROGRAM_ADDRESS;
67+
const programAddress = config?.programAddress ?? MEMO_PROGRAM_ADDRESS;
6768

6869
// Original args.
6970
const args = { ...input };

packages/renderers-js/e2e/system/src/generated/instructions/advanceNonceAccount.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,16 @@ export function getAdvanceNonceAccountInstruction<
109109
TAccountNonceAccount,
110110
TAccountRecentBlockhashesSysvar,
111111
TAccountNonceAuthority
112-
>
112+
>,
113+
config?: { programAddress?: Address }
113114
): AdvanceNonceAccountInstruction<
114115
typeof SYSTEM_PROGRAM_ADDRESS,
115116
TAccountNonceAccount,
116117
TAccountRecentBlockhashesSysvar,
117118
TAccountNonceAuthority
118119
> {
119120
// Program address.
120-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
121+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
121122

122123
// Original accounts.
123124
const originalAccounts = {

packages/renderers-js/e2e/system/src/generated/instructions/allocate.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ export type AllocateInput<TAccountNewAccount extends string = string> = {
8989
};
9090

9191
export function getAllocateInstruction<TAccountNewAccount extends string>(
92-
input: AllocateInput<TAccountNewAccount>
92+
input: AllocateInput<TAccountNewAccount>,
93+
config?: { programAddress?: Address }
9394
): AllocateInstruction<typeof SYSTEM_PROGRAM_ADDRESS, TAccountNewAccount> {
9495
// Program address.
95-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
96+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
9697

9798
// Original accounts.
9899
const originalAccounts = {

packages/renderers-js/e2e/system/src/generated/instructions/allocateWithSeed.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,15 @@ export function getAllocateWithSeedInstruction<
127127
TAccountNewAccount extends string,
128128
TAccountBaseAccount extends string,
129129
>(
130-
input: AllocateWithSeedInput<TAccountNewAccount, TAccountBaseAccount>
130+
input: AllocateWithSeedInput<TAccountNewAccount, TAccountBaseAccount>,
131+
config?: { programAddress?: Address }
131132
): AllocateWithSeedInstruction<
132133
typeof SYSTEM_PROGRAM_ADDRESS,
133134
TAccountNewAccount,
134135
TAccountBaseAccount
135136
> {
136137
// Program address.
137-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
138+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
138139

139140
// Original accounts.
140141
const originalAccounts = {

packages/renderers-js/e2e/system/src/generated/instructions/assign.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ export type AssignInput<TAccountAccount extends string = string> = {
9292
};
9393

9494
export function getAssignInstruction<TAccountAccount extends string>(
95-
input: AssignInput<TAccountAccount>
95+
input: AssignInput<TAccountAccount>,
96+
config?: { programAddress?: Address }
9697
): AssignInstruction<typeof SYSTEM_PROGRAM_ADDRESS, TAccountAccount> {
9798
// Program address.
98-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
99+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
99100

100101
// Original accounts.
101102
const originalAccounts = {

packages/renderers-js/e2e/system/src/generated/instructions/assignWithSeed.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,15 @@ export function getAssignWithSeedInstruction<
120120
TAccountAccount extends string,
121121
TAccountBaseAccount extends string,
122122
>(
123-
input: AssignWithSeedInput<TAccountAccount, TAccountBaseAccount>
123+
input: AssignWithSeedInput<TAccountAccount, TAccountBaseAccount>,
124+
config?: { programAddress?: Address }
124125
): AssignWithSeedInstruction<
125126
typeof SYSTEM_PROGRAM_ADDRESS,
126127
TAccountAccount,
127128
TAccountBaseAccount
128129
> {
129130
// Program address.
130-
const programAddress = SYSTEM_PROGRAM_ADDRESS;
131+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
131132

132133
// Original accounts.
133134
const originalAccounts = {

0 commit comments

Comments
 (0)