Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Wallet Adapter #189

Merged
merged 8 commits into from
Oct 28, 2022

Conversation

jordaaash
Copy link
Contributor

This PR updates Wallet Adapter to the latest RC which includes Wallet Standard and MWA support.

I ran prettier before and after and added the docs dir to ignore.

@vercel
Copy link

vercel bot commented Oct 28, 2022

@jordansexton is attempting to deploy a commit to the Cardinal Labs Team on Vercel.

A member of the Team first needs to authorize it.

package.json Show resolved Hide resolved
@vercel
Copy link

vercel bot commented Oct 28, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
cardinal-rental-ui ✅ Ready (Inspect) Visit Preview Oct 28, 2022 at 6:37AM (UTC)

sentry.client.config.js Outdated Show resolved Hide resolved
sentry.server.config.js Outdated Show resolved Hide resolved
@jordaaash
Copy link
Contributor Author

I can see https://github.com/cardinal-labs/cardinal-staking-ui has the exact same issue right now. Once this is merged I'll send a PR.

@gchatz22
Copy link
Member

have dealt with this issue before, related to a specific version of web3js dependency, https://vercel.com/cardinal-labs/cardinal-rental-ui/3bHQmQd3JvjM4CgCgk346fYfqaUL

@jordaaash
Copy link
Contributor Author

Runs for me locally, Backpack is detected using the Wallet Standard, Solflare is detected with the adapter.

Screen Shot 2022-10-27 at 11 18 54 PM

I see the deployment failed on Vercel, any info on what happened?

@jordaaash
Copy link
Contributor Author

From the yarn.lock file I can see five (!!!!!) versions of web3.js are getting included as dependencies.

Expand for web3.js versions

"@solana/web3.js@=1.32.0":
  version "1.32.0"
  resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.32.0.tgz#b9821de52d0e773c363516c3dcef9be701295d82"
  integrity sha512-jquZ/VBvM3zXAaTJvdWd9mlP0WiZaZqjji0vw5UAsb5IKIossrLhHtyUqMfo41Qkdwu1aVwf7YWG748i4XIJnw==
  dependencies:
    "@babel/runtime" "^7.12.5"
    "@ethersproject/sha2" "^5.5.0"
    "@solana/buffer-layout" "^3.0.0"
    bn.js "^5.0.0"
    borsh "^0.4.0"
    bs58 "^4.0.1"
    buffer "6.0.1"
    cross-fetch "^3.1.4"
    jayson "^3.4.4"
    js-sha3 "^0.8.0"
    rpc-websockets "^7.4.2"
    secp256k1 "^4.0.2"
    superstruct "^0.14.2"
    tweetnacl "^1.0.0"

"@solana/web3.js@^1.21.0", "@solana/web3.js@^1.30.2", "@solana/web3.js@^1.31.0":
  version "1.32.1"
  resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.32.1.tgz#1dae947272c4e7158ae69ad0a59c7a209ec9ef23"
  integrity sha512-2V3P3sY867ru852V1yybFvdgchcGoRGIB5cT/xG9N4oHHazWTsUs8C9PCOlnxlYNh3e8p6R3MZMkT2/5dMgcvQ==
  dependencies:
    "@babel/runtime" "^7.12.5"
    "@ethersproject/sha2" "^5.5.0"
    "@solana/buffer-layout" "^3.0.0"
    bn.js "^5.0.0"
    borsh "^0.4.0"
    bs58 "^4.0.1"
    buffer "6.0.1"
    cross-fetch "^3.1.4"
    jayson "^3.4.4"
    js-sha3 "^0.8.0"
    rpc-websockets "^7.4.2"
    secp256k1 "^4.0.2"
    superstruct "^0.14.2"
    tweetnacl "^1.0.0"

"@solana/web3.js@^1.32.0":
  version "1.63.1"
  resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.63.1.tgz#88a19a17f5f4aada73ad70a94044c1067cab2b4d"
  integrity sha512-wgEdGVK5FTS2zENxbcGSvKpGZ0jDS6BUdGu8Gn6ns0CzgJkK83u4ip3THSnBPEQ5i/jrqukg998BwV1H67+qiQ==
  dependencies:
    "@babel/runtime" "^7.12.5"
    "@noble/ed25519" "^1.7.0"
    "@noble/hashes" "^1.1.2"
    "@noble/secp256k1" "^1.6.3"
    "@solana/buffer-layout" "^4.0.0"
    bigint-buffer "^1.1.5"
    bn.js "^5.0.0"
    borsh "^0.7.0"
    bs58 "^4.0.1"
    buffer "6.0.1"
    fast-stable-stringify "^1.0.0"
    jayson "^3.4.4"
    node-fetch "2"
    rpc-websockets "^7.5.0"
    superstruct "^0.14.2"

"@solana/web3.js@^1.36.0":
  version "1.39.1"
  resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.39.1.tgz#858ecd42ff2a5bcba3a4bb642a50194d77e2a578"
  integrity sha512-Q7XnWTAiU7n7GcoINDAAMLO7CJHpm5kPK46HKwJi2x0cusHQ3WFa7QEp6aPzH7tuf7yl/Kw1lYitcwTVOvqARA==
  dependencies:
    "@babel/runtime" "^7.12.5"
    "@ethersproject/sha2" "^5.5.0"
    "@solana/buffer-layout" "^4.0.0"
    bn.js "^5.0.0"
    borsh "^0.7.0"
    bs58 "^4.0.1"
    buffer "6.0.1"
    cross-fetch "^3.1.4"
    jayson "^3.4.4"
    js-sha3 "^0.8.0"
    rpc-websockets "^7.4.2"
    secp256k1 "^4.0.2"
    superstruct "^0.14.2"
    tweetnacl "^1.0.0"

"@solana/web3.js@^1.44.3", "@solana/web3.js@^1.58.0":
  version "1.66.2"
  resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.66.2.tgz#80b43c5868b846124fe3ebac7d3943930c3fa60c"
  integrity sha512-RyaHMR2jGmaesnYP045VLeBGfR/gAW3cvZHzMFGg7bkO+WOYOYp1nEllf0/la4U4qsYGKCsO9eEevR5fhHiVHg==
  dependencies:
    "@babel/runtime" "^7.12.5"
    "@noble/ed25519" "^1.7.0"
    "@noble/hashes" "^1.1.2"
    "@noble/secp256k1" "^1.6.3"
    "@solana/buffer-layout" "^4.0.0"
    bigint-buffer "^1.1.5"
    bn.js "^5.0.0"
    borsh "^0.7.0"
    bs58 "^4.0.1"
    buffer "6.0.1"
    fast-stable-stringify "^1.0.0"
    jayson "^3.4.4"
    node-fetch "2"
    rpc-websockets "^7.5.0"
    superstruct "^0.14.2"

@jpbogle
Copy link
Member

jpbogle commented Oct 28, 2022

ya looking...its the version mismatch in web3.js where some versions allow
connection.getMultipleAccountsInfo to take a Commitment | GetMultipleAccountsConfig and others

@jpbogle
Copy link
Member

jpbogle commented Oct 28, 2022

we will sort this but it sounds like the wallet adapter doesnt disconnect if we use the list of wallets in useMemo

@jordaaash
Copy link
Contributor Author

I've pushed another commit that forces one version of web3.js.

@jordaaash
Copy link
Contributor Author

wallet adapter doesnt disconnect

Looking into this!

@jordaaash
Copy link
Contributor Author

Disconnecting works for me, at least with Backpack? What behavior are you seeing?

https://watch.screencastify.com/v/DUKufPREzU3RD372EJ7A

@jordaaash
Copy link
Contributor Author

jordaaash commented Oct 28, 2022

I've pushed another commit that removes an invalid { encoding: 'jsonParsed' } object passed as GetMultipleAccountsConfig. This causes the production build to get further locally, so it may work on Vercel. This argument doesn't seem to work, and is later being cast to a Commitment string like this:

connection.getMultipleAccountsInfo(b, config as web3.Commitment)

@jordaaash
Copy link
Contributor Author

I can't run a full production build locally because of this:

cardinal-labs/cardinal-rental-ui/node_modules/@sentry/cli/sentry-cli releases new MbYmay5vx9EvRc7SHKxz2
error: API request failed
  caused by: sentry reported an error: Authentication credentials were not provided. (http status: 401)

@jpbogle
Copy link
Member

jpbogle commented Oct 28, 2022

yes - the versions for web3.js are all fucked up because of those breaking changes in web3.js to getMultipleAccounts config -- The main branch now allows u to build locally without sentry API key, thanks for this, we will take out the changes - mainly it sounds like wallet adapters in useMemo so they stay as a memoized constant and rebase and see if that allows wallet-adapter upgrade without the wallet constantly disconnecting

@jpbogle
Copy link
Member

jpbogle commented Oct 28, 2022

rebased and fixed the deps stuff...and voila its actually working 😂
https://cardinal-rental-dxy5vmv41-cardinal-labs.vercel.app/

I think the main thing we didnt have was just the useMemo around the wallet list <3

@jordaaash
Copy link
Contributor Author

Sweet! Yeah, useMemo missing, and the versions of the wallet adapter deps were a bit out of wack.

@@ -182,6 +183,74 @@ export const deserializeAccountInfos = (
...(accountInfo as AccountInfo<Buffer>),
parsed: accountData.parsed?.info as ParsedTokenAccountData,
}
// taken from account deserialization in splToken getMintInfo
} else if (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @gchatz22 for 👀 had to add this absolutely heinous account deserialization code to handle the non "parsed" encoding of getMultipleAccounts that no longer is allowed in newer web3.js - this is some code i was trying to avoid adding for awhile until we just went to new token client

this issue has plagued us for so long, next PR ill just upgrade it to the newer spl-token client, but I believe well have to update everywhere we read from mint / tokenaccounts to use that new type since its slightly different so covering that in separate PR

Thanks for the add @jordansexton 👍

@jpbogle jpbogle merged commit e7fdd11 into solana-nft-programs:main Oct 28, 2022
@gchatz22
Copy link
Member

big ups @jordansexton 🤝

@jordaaash jordaaash deleted the update-wallet-adapter branch October 28, 2022 17:01
@jordaaash
Copy link
Contributor Author

Awesome, glad it's working!

@Johnnycus
Copy link

Hello, does it work for any of you guys? For me selecting Mobile Wallet Adapter does nothing on rent.cardinal.so

@billythedummy
Copy link

Hello, does it work for any of you guys? For me selecting Mobile Wallet Adapter does nothing on rent.cardinal.so

Same here, am using chrome v100.0.4896.127 on a Huawei P30 Pro (Android 10; VOG-AL 10 Build/HUAWEIVOG-AL10), have both fakewallet and phantom mobile v22.11.14 installed.

cardinal-mwa-fukt.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants