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

fix close vaults mango distrubtion #1895

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions components/instructions/tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,16 @@ export const ACCOUNT_NAMES = {
'8XU6iRnVGp1DSWsbXWQVG3BofKncULJPEcU6YV6VRXDv': 'AllDomains Council Mint',
Hq1ffpMA4368gerKRAdVy7KFrUUMo2NwGwVwcXoFy1Th: 'AllDomains Community Rewards',
rP3eHs6uEDhQLqJHPLAwaNVENRezAgSnZK6opUtjhhT: 'AllDomains Grants',
'27Ma5zSVb8Sv9fuSZcXH2ZghTzdDXuWtzST4NJjXKKVo': 'AllDomains Rewards Governance',
'82s94bsTpcXfYbP7vTSwFfoi4cJEkoeQTfMif1h9s1AU': 'AllDomains Community Governance',
'CnixsSAVZqvaJEdkFHXXRQmot7RCSJFRHYMJvupbPoiE': 'AllDomains Foundation Governance 1',
'95vv4h7GWeBG7DbnzMwB15ZinFKBUiPeg6ea7ZqdGjZx': 'AllDomains Foundation Governance 2',
'6gwjRFcW1Y9iuJwXPdz1zZUa3Hcu855dH6APA5LjD8qK': 'AllDomains Treasury Governance',
'27Ma5zSVb8Sv9fuSZcXH2ZghTzdDXuWtzST4NJjXKKVo':
'AllDomains Rewards Governance',
'82s94bsTpcXfYbP7vTSwFfoi4cJEkoeQTfMif1h9s1AU':
'AllDomains Community Governance',
CnixsSAVZqvaJEdkFHXXRQmot7RCSJFRHYMJvupbPoiE:
'AllDomains Foundation Governance 1',
'95vv4h7GWeBG7DbnzMwB15ZinFKBUiPeg6ea7ZqdGjZx':
'AllDomains Foundation Governance 2',
'6gwjRFcW1Y9iuJwXPdz1zZUa3Hcu855dH6APA5LjD8qK':
'AllDomains Treasury Governance',
AWVUWfRnHCTgo123mRXB9BRWaxt6JdZXXKhFMQ5mryKJ: 'AllDomains DAO Governance',
}

Expand Down Expand Up @@ -344,6 +349,7 @@ export const HIDDEN_PROPOSALS = new Map<string, string>([
['7P3dtUTSvcQcjtJpZHZKEzrGvvHQdQGJrtKFLNAYHvpv', ''],
['H5TnbSBNFKJJwKea8tUj7ETcmhRHXQ1N9XCXBSD6Q9P1', ''],
['GeMQWvFTasBoui11RqRzMtDPQ9b2BkMK8NzepWzvuXw3', ''],
['CRmUPr8CbfPQ4MAoo2yxSf5qL2nPsddL69kowMfp1JYP', ''],
])

export const DEFAULT_NATIVE_SOL_MINT =
Expand Down Expand Up @@ -458,11 +464,11 @@ export async function getInstructionDescriptor(
const descriptor = !instruction.data.length
? descriptors
: descriptors && descriptors[instruction.data[0]]
? descriptors[instruction.data[0]]
: //backup if first number is same for couple of instructions inside same idl
descriptors && descriptors[`${instruction.data[0]}${instruction.data[1]}`]
? descriptors[`${instruction.data[0]}${instruction.data[1]}`]
: descriptors
? descriptors[instruction.data[0]]
: //backup if first number is same for couple of instructions inside same idl
descriptors && descriptors[`${instruction.data[0]}${instruction.data[1]}`]
? descriptors[`${instruction.data[0]}${instruction.data[1]}`]
: descriptors

const dataUI = (descriptor?.getDataUI &&
(await descriptor?.getDataUI(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Vault = {
amount: bigint
mintIndex: number
mint: PublicKey
type: string
}

const CloseVaults = ({
Expand Down Expand Up @@ -159,6 +160,7 @@ const CloseVaults = ({
const v: any = {}
for (let i = 0; i < distribution.metadata!.mints.length; i++) {
const mint = distribution.metadata!.mints[i]
const type = mint.properties.type
const vaultAddress = distribution.findVaultAddress(
new PublicKey(mint.address)
)
Expand All @@ -173,6 +175,7 @@ const CloseVaults = ({
amount: tokenAccount?.account.amount,
mint: tokenAccount?.account.mint,
mintIndex: i,
type: type,
}
} catch {
v[vaultAddress.toString()] = { amount: -1, mintIndex: i }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ const FillVaults = ({
const v: any = {}
for (let i = 0; i < distribution.metadata!.mints.length; i++) {
const mint = distribution.metadata!.mints[i]
const type = distribution.metadata!.mints[i].properties.type

const type = mint.properties.type
const vaultAddress = distribution.findVaultAddress(
new PublicKey(mint.address)
)
Expand Down
Loading