diff --git a/package.json b/package.json index 93b907db..de92e8ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@irys/sdk", - "version": "0.1.6-a2", + "version": "0.1.6", "description": "JS client for Irys", "repository": "https://github.com/Bundlr-Network/js-client.git", "author": "Irys", diff --git a/src/web/shims/viemv2.ts b/src/web/shims/viemv2.ts index ed53fa71..d84154ec 100644 --- a/src/web/shims/viemv2.ts +++ b/src/web/shims/viemv2.ts @@ -12,10 +12,11 @@ import { InjectedTypedEthereumSigner } from "arbundles/web"; export function augmentViemV2(tokenConfig: EthereumConfig, opts: any): void { const walletClient = opts.provider as WalletClient; const publicClient = opts.publicClient as PublicClient, typeof mainnet>; + const accountIndex = opts.accountIndex ?? 0; tokenConfig.ready = async function () { await this.getSigner().ready(); - this._address = await walletClient.getAddresses().then((r) => r[0].toString().toLowerCase()); + this._address = await walletClient.getAddresses().then((r) => r[accountIndex].toString().toLowerCase()); this.providerInstance = this.wallet; }.bind(tokenConfig); @@ -25,7 +26,7 @@ export function augmentViemV2(tokenConfig: EthereumConfig, opts: any): void { if (!this.signer) { this.signer = new InjectedTypedEthereumSigner({ getSigner: () => ({ - getAddress: async () => walletClient.getAddresses().then((r) => r[0]), + getAddress: async () => walletClient.getAddresses().then((r) => r[accountIndex]), _signTypedData: async (domain, types, message): Promise => { message["Transaction hash"] = "0x" + Buffer.from(message["Transaction hash"]).toString("hex"); // @ts-expect-error types