-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to
@solana/web3.js
v2.0.0 (#65)
* Bump anchor 0.28.0 -> 0.29.0 Bump `@solana/web3.js` 1.77.3 -> 2.0.0 * Migrate codegen to `@solana/web3.js:2.0.0`
- Loading branch information
1 parent
2942a0f
commit e41f6cf
Showing
47 changed files
with
2,910 additions
and
1,373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ node_modules/ | |
**/*.rs.bk | ||
.test-ledger | ||
dist/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 19 additions & 8 deletions
27
examples/basic-2/generated-client/instructions/increment.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars | ||
import { | ||
Address, | ||
IAccountMeta, | ||
IAccountSignerMeta, | ||
IInstruction, | ||
TransactionSigner, | ||
} from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars | ||
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars | ||
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars | ||
import { borshAddress } from "../utils" // eslint-disable-line @typescript-eslint/no-unused-vars | ||
import { PROGRAM_ID } from "../programId" | ||
|
||
export interface IncrementAccounts { | ||
counter: PublicKey | ||
authority: PublicKey | ||
counter: Address | ||
authority: TransactionSigner | ||
} | ||
|
||
export function increment( | ||
accounts: IncrementAccounts, | ||
programId: PublicKey = PROGRAM_ID | ||
programAddress: Address = PROGRAM_ID | ||
) { | ||
const keys: Array<AccountMeta> = [ | ||
{ pubkey: accounts.counter, isSigner: false, isWritable: true }, | ||
{ pubkey: accounts.authority, isSigner: true, isWritable: false }, | ||
const keys: Array<IAccountMeta | IAccountSignerMeta> = [ | ||
{ address: accounts.counter, role: 1 }, | ||
{ | ||
address: accounts.authority.address, | ||
role: 2, | ||
signer: accounts.authority, | ||
}, | ||
] | ||
const identifier = Buffer.from([11, 18, 104, 9, 104, 174, 59, 33]) | ||
const data = identifier | ||
const ix = new TransactionInstruction({ keys, programId, data }) | ||
const ix: IInstruction = { accounts: keys, programAddress, data } | ||
return ix | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { PublicKey } from "@solana/web3.js" | ||
import { address, Address } from "@solana/web3.js" | ||
|
||
// Program ID passed with the cli --program-id flag when running the code generator. Do not edit, it will get overwritten. | ||
export const PROGRAM_ID_CLI = new PublicKey( | ||
export const PROGRAM_ID_CLI = address( | ||
"Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" | ||
) | ||
|
||
// This constant will not get overwritten on subsequent code generations and it's safe to modify it's value. | ||
export const PROGRAM_ID: PublicKey = PROGRAM_ID_CLI | ||
export const PROGRAM_ID: Address = PROGRAM_ID_CLI |
Oops, something went wrong.