Skip to content

Commit

Permalink
anchor: new program id (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurushao authored Jan 29, 2025
1 parent 7ff0fdb commit a94e26f
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr_validate_anchor_idl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
- name: Validate anchor IDL
shell: bash
run: |
if [ $(cat anchor/target/idl/glam.json | jq -r .address) == "GLAMpLuXu78TA4ao3DPZvT1zQ7woxoQ8ahdYbhnqY9mP" ]; then
if [ $(cat anchor/target/idl/glam.json | jq -r .address) == "GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc" ]; then
echo "Anchor IDL program address is correct."
else
echo "Anchor IDL program address is incorrect."
echo "Program address in the main branch IDL should be GLAMpLuXu78TA4ao3DPZvT1zQ7woxoQ8ahdYbhnqY9mP (mainnet deploy)."
echo "Program address in the main branch IDL should be GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc (mainnet deploy)."
echo "Make sure you run \"anchor build\" or \"pnpm run anchor-build\" before pushing changes to your PR."
exit 1
fi
2 changes: 1 addition & 1 deletion anchor/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ seeds = false
skip-lint = false

[programs.mainnet]
glam = "GLAMpLuXu78TA4ao3DPZvT1zQ7woxoQ8ahdYbhnqY9mP"
glam = "GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc"

[programs.devnet]
glam = "Gco1pcjxCMYjKJjSNJ7mKV7qezeUTE7arXJgy7PAPNRc"
Expand Down
2 changes: 1 addition & 1 deletion anchor/programs/glam/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub use state::model::*;
use ::drift::{MarketType, OrderParams, PositionDirection};

#[cfg(feature = "mainnet")]
declare_id!("GLAMpLuXu78TA4ao3DPZvT1zQ7woxoQ8ahdYbhnqY9mP");
declare_id!("GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc");

#[cfg(not(feature = "mainnet"))]
declare_id!("Gco1pcjxCMYjKJjSNJ7mKV7qezeUTE7arXJgy7PAPNRc");
Expand Down
4 changes: 1 addition & 3 deletions anchor/src/client/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import {
ShareClassOpenfundsModel,
CreatedModel,
Metadata,
StateIdlModel,
StateModelType,
} from "../models";
import { WSOL } from "../constants";

Expand Down Expand Up @@ -99,7 +97,7 @@ export class StateClient {

// FIXME: setting rawOpenfunds to null is a workarond for
// Access violation in stack frame 5 at address 0x200005ff8 of size 8
// shareClass.rawOpenfunds = null;
shareClass.rawOpenfunds = null;
return await this.base.program.methods
.addShareClass(shareClass)
.accounts({
Expand Down
2 changes: 1 addition & 1 deletion anchor/src/glamExports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const GLAM_PROGRAM_ID_DEV = new PublicKey(
"Gco1pcjxCMYjKJjSNJ7mKV7qezeUTE7arXJgy7PAPNRc",
);
export const GLAM_PROGRAM_ID_MAINNET = new PublicKey(
"GLAMpLuXu78TA4ao3DPZvT1zQ7woxoQ8ahdYbhnqY9mP",
"GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc",
);

export function getGlamProgramId(cluster: ClusterNetwork) {
Expand Down
4 changes: 1 addition & 3 deletions anchor/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ import { BN } from "@coral-xyz/anchor";

export const GlamIntegrations =
GlamIDLJson?.types
?.find((t) => t.name === "IntegrationName")
?.find((t) => t.name === "Integration")
?.type?.variants?.map((v) => v.name) ?? [];

export const GlamPermissions =
GlamIDLJson?.types
?.find((t) => t.name === "Permission")
?.type?.variants?.map((v) => v.name) ?? [];

export const VaultIntegrations = GlamIntegrations.filter((i) => i !== "Mint");

const GLAM_PROGRAM_ID_DEFAULT = new PublicKey(GlamIDLJson.address);

export type StateAccountType = IdlTypes<Glam>["accountType"];
Expand Down
2 changes: 1 addition & 1 deletion anchor/target/idl/glam.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "GLAMpLuXu78TA4ao3DPZvT1zQ7woxoQ8ahdYbhnqY9mP",
"address": "GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc",
"metadata": {
"name": "glam",
"version": "0.4.0",
Expand Down
2 changes: 1 addition & 1 deletion anchor/target/types/glam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* IDL can be found at `target/idl/glam.json`.
*/
export type Glam = {
"address": "GLAMpLuXu78TA4ao3DPZvT1zQ7woxoQ8ahdYbhnqY9mP",
"address": "GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc",
"metadata": {
"name": "glam",
"version": "0.4.0",
Expand Down
5 changes: 2 additions & 3 deletions cli/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as anchor from "@coral-xyz/anchor";
import {
StateModel,
Integration,
WSOL,
getPriorityFeeEstimate,
GlamClient,
VaultIntegrations,
GlamIntegrations,
GlamPermissions,
} from "@glam/anchor";
import { LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";
Expand Down Expand Up @@ -413,7 +412,7 @@ integration
}
});

const allowIntegrations = VaultIntegrations.map(
const allowIntegrations = GlamIntegrations.map(
(i) => i.slice(0, 1).toLowerCase() + i.slice(1),
);
const integrationValidation = (input) => {
Expand Down
4 changes: 2 additions & 2 deletions playground/src/components/integrations/data.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VaultIntegrations } from "@glam/anchor";
import { GlamIntegrations } from "@glam/anchor";

const metadata = {
Drift: {
Expand Down Expand Up @@ -37,7 +37,7 @@ const metadata = {
},
} as { [key: string]: { description: string; labels: string[] } };

export const allIntegrations = VaultIntegrations.sort().map((integ, index) => ({
export const allIntegrations = GlamIntegrations.sort().map((integ, index) => ({
id: index,
name: integ,
enabled: false,
Expand Down

0 comments on commit a94e26f

Please sign in to comment.