From b6b08c1551f438da59450a902dc01bd72d40f293 Mon Sep 17 00:00:00 2001 From: cfal Date: Mon, 4 Mar 2024 20:37:30 -0500 Subject: [PATCH] packages-ts/starknet-gauntlet/provider/index.ts: use v3 transactions --- .../starknet-gauntlet/src/provider/index.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages-ts/starknet-gauntlet/src/provider/index.ts b/packages-ts/starknet-gauntlet/src/provider/index.ts index 20c29843b..26083398b 100644 --- a/packages-ts/starknet-gauntlet/src/provider/index.ts +++ b/packages-ts/starknet-gauntlet/src/provider/index.ts @@ -6,6 +6,7 @@ import { CompiledContract, Account, Call, + constants, } from 'starknet' import { IStarknetWallet } from '../wallet' @@ -34,7 +35,7 @@ interface IProvider

{ signAndSend: (calls: Call[], wait?: boolean) => Promise } -export interface IStarknetProvider extends IProvider {} +export interface IStarknetProvider extends IProvider { } export const makeProvider = ( url: string, wallet?: IStarknetWallet, @@ -80,12 +81,24 @@ class Provider implements IStarknetProvider { constructor(nodeUrl: string, wallet?: IStarknetWallet) { this.provider = new StarknetProvider({ nodeUrl }) if (wallet) { - this.account = new Account(this.provider, wallet.getAccountAddress(), wallet.signer) + this.account = new Account( + this.provider, + wallet.getAccountAddress(), + wallet.signer, + /* cairoVersion= */ null, // don't set cairo version so that it's automatically detected from the contract + /* transactionVersion= */ constants.TRANSACTION_VERSION.V3, + ) } } setAccount(wallet: IStarknetWallet) { - this.account = new Account(this.provider, wallet.getAccountAddress(), wallet.signer) + this.account = new Account( + this.provider, + wallet.getAccountAddress(), + wallet.signer, + /* cairoVersion= */ null, + /* transactionVersion= */ constants.TRANSACTION_VERSION.V3, + ) } send = async () => {