Skip to content

Commit 0bf93d4

Browse files
chore: rename abi-wan-kanabi to abi-wan-kanabi-v1 (#933)
This avoid `npx abi-wan-kanabi` to use the installed version and forces it to get the latest version from npm
1 parent b4e9cbe commit 0bf93d4

File tree

7 files changed

+57
-15
lines changed

7 files changed

+57
-15
lines changed

__tests__/cairo1_typed.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
RawArgsArray,
1111
RawArgsObject,
1212
SequencerProvider,
13-
TypedContract,
13+
TypedContractV1,
1414
cairo,
1515
num,
1616
selector,
@@ -35,7 +35,7 @@ describe('TS validation for API & Contract interactions - tests skipped', () =>
3535
const provider = getTestProvider();
3636
const account = getTestAccount(provider);
3737
let dd: DeclareDeployUDCResponse;
38-
let cairo1Contract: TypedContract<typeof tAbi>;
38+
let cairo1Contract: TypedContractV1<typeof tAbi>;
3939
initializeMatcher(expect);
4040

4141
beforeAll(async () => {
@@ -48,7 +48,7 @@ describe('TS validation for API & Contract interactions - tests skipped', () =>
4848
compiledHelloSierra.abi,
4949
dd.deploy.contract_address,
5050
account
51-
).typed(tAbi);
51+
).typedv1(tAbi);
5252
});
5353

5454
test('Declare & deploy v2 - Hello Cairo 1 contract', async () => {
@@ -511,7 +511,7 @@ describeIfSequencerGoerli('Cairo1 Testnet', () => {
511511
const classHash: any = '0x028b6f2ee9ae00d55a32072d939a55a6eb522974a283880f3c73a64c2f9fd6d6';
512512
const contractAddress: any =
513513
'0x771bbe2ba64fa5ab52f0c142b4296fc67460a3a2372b4cdce752c620e3e8194';
514-
let cairo1Contract: TypedContract<typeof tAbi>;
514+
let cairo1Contract: TypedContractV1<typeof tAbi>;
515515
initializeMatcher(expect);
516516

517517
test('getCompiledClassByClassHash', async () => {

package-lock.json

Lines changed: 42 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"lossless-json": "^2.0.8",
9797
"pako": "^2.0.4",
9898
"url-join": "^4.0.1",
99-
"abi-wan-kanabi": "^1.0.3",
99+
"abi-wan-kanabi-v1": "npm:abi-wan-kanabi@^1.0.3",
100100
"abi-wan-kanabi-v2": "npm:abi-wan-kanabi@^2.1.1"
101101
},
102102
"lint-staged": {

src/contract/default.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Abi as AbiKanabi } from 'abi-wan-kanabi';
1+
import type { Abi as AbiKanabiV1 } from 'abi-wan-kanabi-v1';
22
import type { Abi as AbiKanabiV2, TypedContract as AbiWanTypedContractV2 } from 'abi-wan-kanabi-v2';
33

44
import { AccountInterface } from '../account';
@@ -31,7 +31,7 @@ import { CallData, cairo } from '../utils/calldata';
3131
import { createAbiParser } from '../utils/calldata/parser';
3232
import { getAbiEvents, parseEvents as parseRawEvents } from '../utils/events/index';
3333
import { cleanHex } from '../utils/num';
34-
import { ContractInterface, TypedContract } from './interface';
34+
import { ContractInterface, TypedContractV1 } from './interface';
3535

3636
export type TypedContractV2<TAbi extends AbiKanabiV2> = AbiWanTypedContractV2<TAbi> & Contract;
3737

@@ -349,8 +349,8 @@ export class Contract implements ContractInterface {
349349
return this.providerOrAccount.getContractVersion(this.address);
350350
}
351351

352-
public typed<TAbi extends AbiKanabi>(tAbi: TAbi): TypedContract<TAbi> {
353-
return this as TypedContract<typeof tAbi>;
352+
public typedv1<TAbi extends AbiKanabiV1>(tAbi: TAbi): TypedContractV1<TAbi> {
353+
return this as TypedContractV1<typeof tAbi>;
354354
}
355355

356356
public typedv2<TAbi extends AbiKanabiV2>(tAbi: TAbi): TypedContractV2<TAbi> {

src/contract/interface.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Abi as AbiKanabi, TypedContract as AbiWanTypedContract } from 'abi-wan-kanabi';
1+
import type { Abi as AbiKanabiV1, TypedContract as AbiWanTypedContractV1 } from 'abi-wan-kanabi-v1';
22
import type { Abi as AbiKanabiV2, TypedContract as AbiWanTypedContractV2 } from 'abi-wan-kanabi-v2';
33

44
import { AccountInterface } from '../account';
@@ -42,7 +42,8 @@ declare module 'abi-wan-kanabi-v2' {
4242
}
4343
}
4444

45-
export type TypedContract<TAbi extends AbiKanabi> = AbiWanTypedContract<TAbi> & ContractInterface;
45+
export type TypedContractV1<TAbi extends AbiKanabiV1> = AbiWanTypedContractV1<TAbi> &
46+
ContractInterface;
4647
type TypedContractV2<TAbi extends AbiKanabiV2> = AbiWanTypedContractV2<TAbi> & ContractInterface;
4748

4849
export abstract class ContractInterface {
@@ -162,6 +163,6 @@ export abstract class ContractInterface {
162163
*/
163164
public abstract getVersion(): Promise<ContractVersion>;
164165

165-
public abstract typed<TAbi extends AbiKanabi>(tAbi: TAbi): TypedContract<TAbi>;
166+
public abstract typedv1<TAbi extends AbiKanabiV1>(tAbi: TAbi): TypedContractV1<TAbi>;
166167
public abstract typedv2<TAbi extends AbiKanabiV2>(tAbi: TAbi): TypedContractV2<TAbi>;
167168
}

www/versioned_docs/version-5.19.5/guides/automatic_cairo_ABI_parsing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import { tAbi } from '../__mocks__/hello';
6363

6464
let cairo1Contract = new Contract(compiledHelloSierra.abi, dd.deploy.contract_address, account);
6565

66-
let cairo1ContractTyped = cairo1Contract.typed(tAbi);
66+
let cairo1ContractTyped = cairo1Contract.typedv1(tAbi); // or typedv2(tAbi) if you're using Cairo Compiler v2
6767

6868
cairo1ContractTyped.test_bool();
6969
```

www/versioned_docs/version-5.24.3/guides/automatic_cairo_ABI_parsing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import { tAbi } from '../__mocks__/hello';
6363

6464
let cairo1Contract = new Contract(compiledHelloSierra.abi, dd.deploy.contract_address, account);
6565

66-
let cairo1ContractTyped = cairo1Contract.typed(tAbi);
66+
let cairo1ContractTyped = cairo1Contract.typedv1(tAbi); // or typedv2(tAbi) if you are using Cairo compiler v2
6767

6868
cairo1ContractTyped.test_bool();
6969
```

0 commit comments

Comments
 (0)