Skip to content

Commit

Permalink
account: pass projectAccessKey and jwtAuth for relayer instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
pkieltyka committed Dec 14, 2024
1 parent cfbad19 commit 0b5a39f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/account/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ export class Account {
if (isRelayer(found.relayer)) return found.relayer
return new RpcRelayer({
...found.relayer,
// If there's an access key, we don't pass the JWT, because browser-side usage of this code mandates an access key
// and passing a JWT causes a CORS error.
...(this.projectAccessKey ? { projectAccessKey: this.projectAccessKey } : { jwtAuth: this.jwt })
// we pass both projectAccessKey and jwtAuth because the projectAccessKey is
// used either for unauthenticated access, or gas sponsorship even if the jwtAuth is provided,
...({ projectAccessKey: this.projectAccessKey, jwtAuth: this.jwt })
})
}

Expand Down

0 comments on commit 0b5a39f

Please sign in to comment.