Skip to content

Commit d499c9a

Browse files
committed
Lint
1 parent f35c5de commit d499c9a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/anchor/coder/idl.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Borrowed from coral-xyz/anchor
2+
//
3+
// https://github.com/coral-xyz/anchor/blob/master/ts/packages/anchor/src/coder/borsh/idl.ts
4+
5+
16
import camelCase from 'camelcase'
27
import { Layout } from 'buffer-layout'
38
import * as borsh from '@coral-xyz/borsh'
@@ -123,9 +128,9 @@ export class IdlCoder {
123128
return borsh.struct(fieldLayouts, name)
124129
} else if (typeDef.type.kind === 'enum') {
125130
const variants = typeDef.type.variants.map((variant: IdlEnumVariant) => {
126-
const name = camelCase(variant.name)
131+
const variantName = camelCase(variant.name)
127132
if (variant.fields === undefined) {
128-
return borsh.struct([], name)
133+
return borsh.struct([], variantName)
129134
}
130135
const fieldLayouts = variant.fields.map((f: IdlField | IdlType, i: number) => {
131136
if (!f.hasOwnProperty('name')) {
@@ -137,7 +142,7 @@ export class IdlCoder {
137142
// the check before would've errored
138143
return IdlCoder.fieldLayout(f as IdlField, types)
139144
})
140-
return borsh.struct(fieldLayouts, name)
145+
return borsh.struct(fieldLayouts, variantName)
141146
})
142147

143148
if (name !== undefined) {

src/anchor/coder/instructions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Borrowed from coral-xyz/anchor
2+
//
3+
// https://github.com/coral-xyz/anchor/blob/master/ts/packages/anchor/src/coder/borsh/instruction.ts
4+
5+
16
import bs58 from 'bs58'
27
import { Buffer } from 'buffer'
38
import { Layout } from 'buffer-layout'

0 commit comments

Comments
 (0)