metaplex-foundation / solita

Genrates an SDK API from solana contract IDL.
Apache License 2.0
140 stars 32 forks source link

feat: Expose commitment level when fetching account data #84

Closed ngundotra closed 2 years ago

ngundotra commented 2 years ago

Current generated account method signatures look like

  static async fromAccountAddress(
    connection: web3.Connection,
    address: web3.PublicKey
  ): Promise<Counter> {
    const accountInfo = await connection.getAccountInfo(address);
    ...
  }

But they should have a commitmentConfig parameter to allow max flexibility

  static async fromAccountAddress(
    connection: web3.Connection,
    address: web3.PublicKey,
    commitmentConfig?: GetAccountInfoConfig /* @solana/web3.js type */
  ): Promise<Counter> {
    const accountInfo = await connection.getAccountInfo(address, commitmentConfig);
   ...
  }