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 anchor to 0.20 #91

Merged
merged 3 commits into from
Jan 11, 2022
Merged

Update anchor to 0.20 #91

merged 3 commits into from
Jan 11, 2022

Conversation

archseer
Copy link
Collaborator

@archseer archseer commented Jan 9, 2022

No description provided.

@archseer archseer force-pushed the anchor-0.20 branch 2 times, most recently from 966a030 to 9bd3341 Compare January 9, 2022 04:01
@@ -26,7 +26,7 @@
},
"dependencies": {
"@chainlink/gauntlet-core": "0.0.7",
"@project-serum/anchor": "^0.18.0",
"@project-serum/anchor": "^0.20.0",
Copy link
Member

Choose a reason for hiding this comment

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

This probably has some breaking changes. Can you open an story just to update this on gauntlet?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I've opened a GH Issue:

Please just append the Gauntlet changes to this PR...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's mostly coral-xyz/anchor#1108 where the wallet is now only conditionally included

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The browser detection is flawed too coral-xyz/anchor#1233

Copy link
Collaborator

@aalu1418 aalu1418 Jan 10, 2022

Choose a reason for hiding this comment

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

Seems like this is what is happening, but i'm not sure how to solve it as the proposed solution doesn't quite work 🤔
https://stackoverflow.com/a/63639280

Update:
Seems like it's importing it as a existing object not a class...so there's no access to set the key

Fix: import using node syntax rather than TS import syntax

Copy link
Collaborator

@aalu1418 aalu1418 left a comment

Choose a reason for hiding this comment

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

These fixes seem to get it to work. Tested it with a deploy:token command. Tested with local env ✅

@@ -5,7 +5,7 @@ import { TransactionResponse } from '../types'
import { Idl, Program, Provider, Wallet } from '@project-serum/anchor'

export default abstract class SolanaCommand extends WriteCommand<TransactionResponse> {
wallet: Wallet
wallet: typeof Wallet
Copy link
Collaborator

@aalu1418 aalu1418 Jan 10, 2022

Choose a reason for hiding this comment

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

Fix:

packages/gauntlet-solana/src/commands/internal/solana.ts:8:11 - error TS2749: 'Wallet' refers to a value, but is being used as a type here. Did you mean 'typeof Wallet'?

8   wallet: Wallet
            ~~~~~~

Comment on lines +3 to +6
import { Provider } from '@project-serum/anchor'
import { Connection, Keypair } from '@solana/web3.js'
import SolanaCommand from './internal/solana'
const { Wallet } = require('@project-serum/anchor') // module exported dynamically from anchor
Copy link
Collaborator

@aalu1418 aalu1418 Jan 10, 2022

Choose a reason for hiding this comment

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

Fix:

packages/gauntlet-solana/src/commands/middlewares.ts:28:18 - error TS2351: This expression is not constructable.
  Type 'NodeWallet' has no construct signatures.

28   c.wallet = new Wallet(Keypair.fromSecretKey(Uint8Array.from(JSON.parse(rawPK))))
                    ~~~~~~

@aalu1418 aalu1418 linked an issue Jan 10, 2022 that may be closed by this pull request
Copy link
Collaborator

@krebernisak krebernisak left a comment

Choose a reason for hiding this comment

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

LGTM!

@krebernisak krebernisak merged commit 04850d8 into develop Jan 11, 2022
@krebernisak krebernisak deleted the anchor-0.20 branch January 11, 2022 10:24
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.

Update Gauntlet to support Anchor v0.20
5 participants