Skip to content

Commit

Permalink
fix conflict of web3.js dependencies between core and parent packages
Browse files Browse the repository at this point in the history
  • Loading branch information
sevazhidkov committed Jul 18, 2022
1 parent 020ce05 commit 69f03e1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/core/src/core/simulateRawTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ export async function simulateRawTransaction(
https://github.com/solana-labs/solana/issues/22021
Clone it from the bytes instead, and make sure it's likely to succeed before paying for it.
Within simulateTransaction there is a "transaction instanceof Transaction" check. Since connection is passed
from outside the library, it uses parent application's version of web3.js. "instanceof" won't recognize a match.
Instead, let's explicitly call for simulateTransaction within the dependency of the library.
*/
const simulated = await connection.simulateTransaction(
const simulated = await Connection.prototype.simulateTransaction.call(
connection,
Transaction.from(rawTransaction),
undefined,
includeAccounts
Expand Down
3 changes: 2 additions & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@types/react": "^18.0.15",
"eslint": "^8.4.1",
"prettier": "^2.5.1",
"shx": "^0.3.3"
"shx": "^0.3.3",
"typescript": "^4.7.4"
}
}
5 changes: 5 additions & 0 deletions packages/server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,11 @@ type-is@~1.6.18:
media-typer "0.3.0"
mime-types "~2.1.24"

typescript@^4.7.4:
version "4.7.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==

[email protected], unpipe@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
Expand Down

0 comments on commit 69f03e1

Please sign in to comment.