|
@@ -266,7 +266,7 @@ export type IdlTypeGeneric = {
|
|
export type IdlDiscriminator = number[];
|
|
export type IdlDiscriminator = number[];
|
|
|
|
|
|
export function isCompositeAccounts(
|
|
export function isCompositeAccounts(
|
|
- accountItem: IdlInstructionAccountItem
|
|
|
|
|
|
+ accountItem: IdlInstructionAccountItem,
|
|
): accountItem is IdlInstructionAccounts {
|
|
): accountItem is IdlInstructionAccounts {
|
|
return "accounts" in accountItem;
|
|
return "accounts" in accountItem;
|
|
}
|
|
}
|
|
@@ -321,7 +321,11 @@ export function convertIdlToCamelCase<I extends Idl>(idl: I) {
|
|
|
|
|
|
// `my_account.field` is getting converted to `myAccountField` but we
|
|
// `my_account.field` is getting converted to `myAccountField` but we
|
|
// need `myAccount.field`.
|
|
// need `myAccount.field`.
|
|
- const toCamelCase = (s: any) => s.split(".").map(camelCase).join(".");
|
|
|
|
|
|
+ const toCamelCase = (s: any) =>
|
|
|
|
+ s
|
|
|
|
+ .split(".")
|
|
|
|
+ .map((part: any) => camelCase(part, { locale: false }))
|
|
|
|
+ .join(".");
|
|
|
|
|
|
const recursivelyConvertNamesToCamelCase = (obj: Record<string, any>) => {
|
|
const recursivelyConvertNamesToCamelCase = (obj: Record<string, any>) => {
|
|
for (const key in obj) {
|
|
for (const key in obj) {
|
|
@@ -344,7 +348,7 @@ export function handleDefinedFields<U, N, T>(
|
|
fields: IdlDefinedFields | undefined,
|
|
fields: IdlDefinedFields | undefined,
|
|
unitCb: () => U,
|
|
unitCb: () => U,
|
|
namedCb: (fields: IdlDefinedFieldsNamed) => N,
|
|
namedCb: (fields: IdlDefinedFieldsNamed) => N,
|
|
- tupleCb: (fields: IdlDefinedFieldsTuple) => T
|
|
|
|
|
|
+ tupleCb: (fields: IdlDefinedFieldsTuple) => T,
|
|
) {
|
|
) {
|
|
// Unit
|
|
// Unit
|
|
if (!fields?.length) return unitCb();
|
|
if (!fields?.length) return unitCb();
|