Skip to content

Commit

Permalink
packages-ts/starknet-gauntlet/provider/index.ts: use v3 transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
cfal committed Mar 6, 2024
1 parent 4ebc7bb commit b6b08c1
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions packages-ts/starknet-gauntlet/src/provider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CompiledContract,
Account,
Call,
constants,
} from 'starknet'
import { IStarknetWallet } from '../wallet'

Expand Down Expand Up @@ -34,7 +35,7 @@ interface IProvider<P> {
signAndSend: (calls: Call[], wait?: boolean) => Promise<TransactionResponse>
}

export interface IStarknetProvider extends IProvider<StarknetProvider> {}
export interface IStarknetProvider extends IProvider<StarknetProvider> { }
export const makeProvider = (
url: string,
wallet?: IStarknetWallet,
Expand Down Expand Up @@ -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 () => {
Expand Down

0 comments on commit b6b08c1

Please sign in to comment.