From 1c47de872fc79ec6f4b4095a67ae569a00995586 Mon Sep 17 00:00:00 2001 From: acheron Date: Mon, 19 Aug 2024 15:29:48 +0200 Subject: [PATCH 1/3] ts: Change the `Program` constructor's `idl` parameter type to `any` --- ts/packages/anchor/src/program/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/packages/anchor/src/program/index.ts b/ts/packages/anchor/src/program/index.ts index f073de9c2f..b0dfe46e0a 100644 --- a/ts/packages/anchor/src/program/index.ts +++ b/ts/packages/anchor/src/program/index.ts @@ -279,7 +279,7 @@ export class Program { * public keys of missing accounts when building instructions */ public constructor( - idl: IDL, + idl: any, provider: Provider = getProvider(), coder?: Coder, getCustomResolver?: ( From 66bcce80232598c5bcefe22fc7896b503249d2a4 Mon Sep 17 00:00:00 2001 From: acheron Date: Mon, 19 Aug 2024 15:30:44 +0200 Subject: [PATCH 2/3] ts: Refactor to use the existing `_idl` field --- ts/packages/anchor/src/program/index.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ts/packages/anchor/src/program/index.ts b/ts/packages/anchor/src/program/index.ts index b0dfe46e0a..ca9536636e 100644 --- a/ts/packages/anchor/src/program/index.ts +++ b/ts/packages/anchor/src/program/index.ts @@ -286,20 +286,18 @@ export class Program { instruction: IdlInstruction ) => CustomAccountResolver | undefined ) { - const camelCasedIdl = convertIdlToCamelCase(idl); - // Fields. - this._idl = camelCasedIdl; + this._idl = convertIdlToCamelCase(idl); this._rawIdl = idl; this._provider = provider; this._programId = translateAddress(idl.address); - this._coder = coder ?? new BorshCoder(camelCasedIdl); + this._coder = coder ?? new BorshCoder(this._idl); this._events = new EventManager(this._programId, provider, this._coder); // Dynamic namespaces. const [rpc, instruction, transaction, account, simulate, methods, views] = NamespaceFactory.build( - camelCasedIdl, + this._idl, this._coder, this._programId, provider, From 442abe855aad7899a00041dcb232ad243b2e02cc Mon Sep 17 00:00:00 2001 From: acheron Date: Mon, 19 Aug 2024 23:53:44 +0200 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bfb95c3e0..f85591a0e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ The minor version will be incremented upon a breaking change and the patch versi - lang, ts: Remove "8 byte" requirement from discriminator error messages ([#3161](https://github.com/coral-xyz/anchor/pull/3161)). - lang: Remove `discriminator` method from `Discriminator` trait ([#3163](https://github.com/coral-xyz/anchor/pull/3163)). - docker: Upgrade `node` to 20.16.0 LTS ([#3179](https://github.com/coral-xyz/anchor/pull/3179)). +- ts: Change the `Program` constructor's `idl` parameter type to `any` ([#3181](https://github.com/coral-xyz/anchor/pull/3181)). ## [0.30.1] - 2024-06-20