diff --git a/ts/src/coder/borsh/state.ts b/ts/src/coder/borsh/state.ts index 19309409..e385804d 100644 --- a/ts/src/coder/borsh/state.ts +++ b/ts/src/coder/borsh/state.ts @@ -35,12 +35,12 @@ export class BorshStateCoder { return this.layout.decode(data); } - // Calculates unique 8 byte discriminator prepended to all anchor state accounts. - async discriminator(name: string): Promise { - let ns = features.isSet("anchor-deprecated-state") ? "account" : "state"; - return Buffer.from(sha256.digest(`${ns}:${name}`)).slice( - 0, - this.header.discriminatorSize() - ); - } + // Calculates unique 8 byte discriminator prepended to all anchor state accounts. + async discriminator(name: string): Promise { + let ns = features.isSet("anchor-deprecated-state") ? "account" : "state"; + return Buffer.from(sha256.digest(`${ns}:${name}`)).slice( + 0, + this.header.discriminatorSize() + ); + } } diff --git a/ts/src/program/namespace/state.ts b/ts/src/program/namespace/state.ts index 8dd2f327..e40100ed 100644 --- a/ts/src/program/namespace/state.ts +++ b/ts/src/program/namespace/state.ts @@ -85,7 +85,7 @@ export class StateClient { public readonly provider: Provider = getProvider(), /** * Returns the coder. Note that we use BorshCoder and not `Coder` because - * the deprecated state abstraction only applies to Anchor programs. + * the deprecated state abstraction only applies to Anchor programs. */ public readonly coder: BorshCoder = new BorshCoder(idl) ) { @@ -173,7 +173,9 @@ export class StateClient { throw new Error("State is not specified in IDL."); } - const expectedDiscriminator = await this.coder.state.discriminator(state.struct.name); + const expectedDiscriminator = await this.coder.state.discriminator( + state.struct.name + ); const discriminator = this.coder.state.header.parseDiscriminator( accountInfo.data );