Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

Commit 8c2dcb0

Browse files
committed
fix: update program id of counter program
1 parent d57dd62 commit 8c2dcb0

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

anchor/Anchor.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ resolution = true
66
skip-lint = false
77

88
[programs.localnet]
9-
counter = "DLw5fJNrrBCWoy75aukoDApBZm4MEvaWCvPJoqtLSg1p"
9+
counter = "coUnmi3oBUtwtd9fjeAvSsJssXh5A5xyPbhpewyzRVF"
1010

1111
[registry]
1212
url = "https://api.apr.dev"

anchor/programs/counter/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use anchor_lang::prelude::*;
44

5-
declare_id!("DLw5fJNrrBCWoy75aukoDApBZm4MEvaWCvPJoqtLSg1p");
5+
declare_id!("coUnmi3oBUtwtd9fjeAvSsJssXh5A5xyPbhpewyzRVF");
66

77
#[program]
88
pub mod counter {

anchor/src/counter-exports.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export { Counter, CounterIDL }
1111
export const COUNTER_PROGRAM_ID = new PublicKey(CounterIDL.address)
1212

1313
// This is a helper function to get the Counter Anchor program.
14-
export function getCounterProgram(provider: AnchorProvider) {
15-
return new Program(CounterIDL as Counter, provider)
14+
export function getCounterProgram(provider: AnchorProvider, address?: PublicKey) {
15+
return new Program({ ...CounterIDL, address: address ? address.toBase58() : CounterIDL.address } as Counter, provider)
1616
}
1717

1818
// This is a helper function to get the program ID for the Counter program depending on the cluster.
@@ -21,7 +21,7 @@ export function getCounterProgramId(cluster: Cluster) {
2121
case 'devnet':
2222
case 'testnet':
2323
// This is the program ID for the Counter program on devnet and testnet.
24-
return new PublicKey('CounNZdmsQmWh7uVngV9FXW2dZ6zAgbJyYsvBpqbykg')
24+
return new PublicKey('coUnmi3oBUtwtd9fjeAvSsJssXh5A5xyPbhpewyzRVF')
2525
case 'mainnet-beta':
2626
default:
2727
return COUNTER_PROGRAM_ID

anchor/target/idl/counter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"address": "DLw5fJNrrBCWoy75aukoDApBZm4MEvaWCvPJoqtLSg1p",
2+
"address": "coUnmi3oBUtwtd9fjeAvSsJssXh5A5xyPbhpewyzRVF",
33
"metadata": {
44
"name": "counter",
55
"version": "0.1.0",

anchor/target/types/counter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* IDL can be found at `target/idl/counter.json`.
66
*/
77
export type Counter = {
8-
"address": "DLw5fJNrrBCWoy75aukoDApBZm4MEvaWCvPJoqtLSg1p",
8+
"address": "coUnmi3oBUtwtd9fjeAvSsJssXh5A5xyPbhpewyzRVF",
99
"metadata": {
1010
"name": "counter",
1111
"version": "0.1.0",

src/components/counter/counter-data-access.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function useCounterProgram() {
1515
const transactionToast = useTransactionToast()
1616
const provider = useAnchorProvider()
1717
const programId = useMemo(() => getCounterProgramId(cluster.network as Cluster), [cluster])
18-
const program = getCounterProgram(provider)
18+
const program = useMemo(() => getCounterProgram(provider, programId), [provider, programId])
1919

2020
const accounts = useQuery({
2121
queryKey: ['counter', 'all', { cluster }],

0 commit comments

Comments
 (0)