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

Commit cb4de48

Browse files
committed
token 2022: add GroupMemberPointer extension
1 parent 2b1c225 commit cb4de48

File tree

9 files changed

+771
-7
lines changed

9 files changed

+771
-7
lines changed

token/client/src/token.rs

+40-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ use {
4242
self, account_info::WithheldTokensInfo, ConfidentialTransferFeeAmount,
4343
ConfidentialTransferFeeConfig,
4444
},
45-
cpi_guard, default_account_state, group_pointer, interest_bearing_mint, memo_transfer,
46-
metadata_pointer, transfer_fee, transfer_hook, BaseStateWithExtensions, Extension,
47-
ExtensionType, StateWithExtensionsOwned,
45+
cpi_guard, default_account_state, group_member_pointer, group_pointer,
46+
interest_bearing_mint, memo_transfer, metadata_pointer, transfer_fee, transfer_hook,
47+
BaseStateWithExtensions, Extension, ExtensionType, StateWithExtensionsOwned,
4848
},
4949
instruction, offchain,
5050
proof::ProofLocation,
@@ -176,6 +176,10 @@ pub enum ExtensionInitializationParams {
176176
authority: Option<Pubkey>,
177177
group_address: Option<Pubkey>,
178178
},
179+
GroupMemberPointer {
180+
authority: Option<Pubkey>,
181+
member_address: Option<Pubkey>,
182+
},
179183
}
180184
impl ExtensionInitializationParams {
181185
/// Get the extension type associated with the init params
@@ -194,6 +198,7 @@ impl ExtensionInitializationParams {
194198
ExtensionType::ConfidentialTransferFeeConfig
195199
}
196200
Self::GroupPointer { .. } => ExtensionType::GroupPointer,
201+
Self::GroupMemberPointer { .. } => ExtensionType::GroupMemberPointer,
197202
}
198203
}
199204
/// Generate an appropriate initialization instruction for the given mint
@@ -294,6 +299,15 @@ impl ExtensionInitializationParams {
294299
authority,
295300
group_address,
296301
),
302+
Self::GroupMemberPointer {
303+
authority,
304+
member_address,
305+
} => group_member_pointer::instruction::initialize(
306+
token_program_id,
307+
mint,
308+
authority,
309+
member_address,
310+
),
297311
}
298312
}
299313
}
@@ -1700,6 +1714,29 @@ where
17001714
.await
17011715
}
17021716

1717+
/// Update group member pointer address
1718+
pub async fn update_group_member_address<S: Signers>(
1719+
&self,
1720+
authority: &Pubkey,
1721+
new_member_address: Option<Pubkey>,
1722+
signing_keypairs: &S,
1723+
) -> TokenResult<T::Output> {
1724+
let signing_pubkeys = signing_keypairs.pubkeys();
1725+
let multisig_signers = self.get_multisig_signers(authority, &signing_pubkeys);
1726+
1727+
self.process_ixs(
1728+
&[group_member_pointer::instruction::update(
1729+
&self.program_id,
1730+
self.get_address(),
1731+
authority,
1732+
&multisig_signers,
1733+
new_member_address,
1734+
)?],
1735+
signing_keypairs,
1736+
)
1737+
.await
1738+
}
1739+
17031740
/// Update confidential transfer mint
17041741
pub async fn confidential_transfer_update_mint<S: Signers>(
17051742
&self,

0 commit comments

Comments
 (0)