Skip to content

Commit 7c1900f

Browse files
authored
fix(idl): Disable Locale in camelCase (#3845)
* Disable Locale in camelCase * Formatting
1 parent d94d9c3 commit 7c1900f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ts/packages/anchor/src/idl.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export type IdlTypeGeneric = {
266266
export type IdlDiscriminator = number[];
267267

268268
export function isCompositeAccounts(
269-
accountItem: IdlInstructionAccountItem
269+
accountItem: IdlInstructionAccountItem,
270270
): accountItem is IdlInstructionAccounts {
271271
return "accounts" in accountItem;
272272
}
@@ -321,7 +321,11 @@ export function convertIdlToCamelCase<I extends Idl>(idl: I) {
321321

322322
// `my_account.field` is getting converted to `myAccountField` but we
323323
// need `myAccount.field`.
324-
const toCamelCase = (s: any) => s.split(".").map(camelCase).join(".");
324+
const toCamelCase = (s: any) =>
325+
s
326+
.split(".")
327+
.map((part: any) => camelCase(part, { locale: false }))
328+
.join(".");
325329

326330
const recursivelyConvertNamesToCamelCase = (obj: Record<string, any>) => {
327331
for (const key in obj) {
@@ -344,7 +348,7 @@ export function handleDefinedFields<U, N, T>(
344348
fields: IdlDefinedFields | undefined,
345349
unitCb: () => U,
346350
namedCb: (fields: IdlDefinedFieldsNamed) => N,
347-
tupleCb: (fields: IdlDefinedFieldsTuple) => T
351+
tupleCb: (fields: IdlDefinedFieldsTuple) => T,
348352
) {
349353
// Unit
350354
if (!fields?.length) return unitCb();

0 commit comments

Comments
 (0)