Skip to content

Commit 1cb412c

Browse files
committed
feat(mint_governor): add fields to events required for proper indexing
1 parent 3772879 commit 1cb412c

7 files changed

Lines changed: 56 additions & 12 deletions

File tree

programs/mint_governor/src/events.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub struct TokensMintedEvent {
4242
pub destination_ata: Pubkey,
4343
pub amount: u64,
4444
pub post_total_minted: u64,
45+
pub authority_max_total: Option<u64>,
4546
pub post_mint_supply: u64,
4647
}
4748

@@ -52,15 +53,17 @@ pub struct MintAuthorityUpdatedEvent {
5253
pub mint_authority: Pubkey,
5354
pub authorized_minter: Pubkey,
5455
pub max_total: Option<u64>,
56+
pub total_minted: u64,
5557
}
5658

5759
#[event]
5860
pub struct MintAuthorityRemovedEvent {
5961
pub common: CommonFields,
6062
pub mint_governor: Pubkey,
63+
pub mint_authority: Pubkey,
6164
pub authorized_minter: Pubkey,
65+
pub max_total: Option<u64>,
6266
pub total_minted: u64,
63-
pub mint_authority: Pubkey,
6467
}
6568

6669
#[event]

programs/mint_governor/src/instructions/mint_tokens.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ impl MintTokens<'_> {
106106
destination_ata: ctx.accounts.destination_ata.key(),
107107
amount: args.amount,
108108
post_total_minted: mint_authority.total_minted,
109+
authority_max_total: mint_authority.max_total,
109110
post_mint_supply: ctx.accounts.mint.supply,
110111
});
111112

programs/mint_governor/src/instructions/remove_mint_authority.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ impl RemoveMintAuthority<'_> {
4747
mint_governor_seq_num: mint_governor.seq_num,
4848
},
4949
mint_governor: mint_governor.key(),
50+
mint_authority: mint_authority.key(),
5051
authorized_minter: mint_authority.authorized_minter,
52+
max_total: mint_authority.max_total,
5153
total_minted: mint_authority.total_minted,
52-
mint_authority: mint_authority.key(),
5354
});
5455

5556
// Mint authority account gets closed using close constraint

programs/mint_governor/src/instructions/update_mint_authority.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ impl UpdateMintAuthority<'_> {
5353
mint_authority: mint_authority.key(),
5454
authorized_minter: mint_authority.authorized_minter,
5555
max_total: mint_authority.max_total,
56+
total_minted: mint_authority.total_minted,
5657
});
5758

5859
Ok(())

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metadaoproject/programs",
3-
"version": "0.1.0-alpha.6",
3+
"version": "0.1.0-alpha.7",
44
"type": "module",
55
"main": "dist/index.js",
66
"module": "dist/index.js",

sdk/src/mint_governor/v0.7/types/mint_governor.ts

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,13 @@ export type MintGovernor = {
593593
type: "u64";
594594
index: false;
595595
},
596+
{
597+
name: "authorityMaxTotal";
598+
type: {
599+
option: "u64";
600+
};
601+
index: false;
602+
},
596603
{
597604
name: "postMintSupply";
598605
type: "u64";
@@ -632,6 +639,11 @@ export type MintGovernor = {
632639
};
633640
index: false;
634641
},
642+
{
643+
name: "totalMinted";
644+
type: "u64";
645+
index: false;
646+
},
635647
];
636648
},
637649
{
@@ -649,19 +661,26 @@ export type MintGovernor = {
649661
type: "publicKey";
650662
index: false;
651663
},
664+
{
665+
name: "mintAuthority";
666+
type: "publicKey";
667+
index: false;
668+
},
652669
{
653670
name: "authorizedMinter";
654671
type: "publicKey";
655672
index: false;
656673
},
657674
{
658-
name: "totalMinted";
659-
type: "u64";
675+
name: "maxTotal";
676+
type: {
677+
option: "u64";
678+
};
660679
index: false;
661680
},
662681
{
663-
name: "mintAuthority";
664-
type: "publicKey";
682+
name: "totalMinted";
683+
type: "u64";
665684
index: false;
666685
},
667686
];
@@ -1335,6 +1354,13 @@ export const IDL: MintGovernor = {
13351354
type: "u64",
13361355
index: false,
13371356
},
1357+
{
1358+
name: "authorityMaxTotal",
1359+
type: {
1360+
option: "u64",
1361+
},
1362+
index: false,
1363+
},
13381364
{
13391365
name: "postMintSupply",
13401366
type: "u64",
@@ -1374,6 +1400,11 @@ export const IDL: MintGovernor = {
13741400
},
13751401
index: false,
13761402
},
1403+
{
1404+
name: "totalMinted",
1405+
type: "u64",
1406+
index: false,
1407+
},
13771408
],
13781409
},
13791410
{
@@ -1391,19 +1422,26 @@ export const IDL: MintGovernor = {
13911422
type: "publicKey",
13921423
index: false,
13931424
},
1425+
{
1426+
name: "mintAuthority",
1427+
type: "publicKey",
1428+
index: false,
1429+
},
13941430
{
13951431
name: "authorizedMinter",
13961432
type: "publicKey",
13971433
index: false,
13981434
},
13991435
{
1400-
name: "totalMinted",
1401-
type: "u64",
1436+
name: "maxTotal",
1437+
type: {
1438+
option: "u64",
1439+
},
14021440
index: false,
14031441
},
14041442
{
1405-
name: "mintAuthority",
1406-
type: "publicKey",
1443+
name: "totalMinted",
1444+
type: "u64",
14071445
index: false,
14081446
},
14091447
],

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@
865865
"@jridgewell/sourcemap-codec" "^1.4.10"
866866

867867
"@metadaoproject/programs@./sdk":
868-
version "0.1.0-alpha.6"
868+
version "0.1.0-alpha.7"
869869
dependencies:
870870
"@coral-xyz/anchor" "0.29.0"
871871
"@noble/hashes" "1.8.0"

0 commit comments

Comments
 (0)