Skip to content

Commit 4a7202d

Browse files
Put collection offchain url at collections.json
1 parent a715e45 commit 4a7202d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

programs/libreplex_editions/src/instructions/initialise.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use anchor_lang::{prelude::*, system_program};
2+
use dyn_fmt::AsStrFormatExt;
23
use libreplex_shared::{create_token_2022_and_metadata, MintAccounts2022, TokenGroupInput};
34
use spl_pod::optional_keys::OptionalNonZeroPubkey;
45
use spl_token_metadata_interface::state::TokenMetadata;
@@ -99,6 +100,16 @@ pub fn initialise(ctx: Context<InitialiseCtx>, input: InitialiseInput) -> Result
99100
panic!("Only one set of curlies ({{}}) can be specified. name had multiple");
100101
}
101102
};
103+
104+
let name = match name_is_template {
105+
true => input.name.format(&["collection"]),
106+
false => input.name.clone()
107+
};
108+
109+
let url: String = match url_is_template {
110+
true => input.offchain_url.format(&["collection"]),
111+
false => input.offchain_url.clone()
112+
};
102113

103114

104115
ctx.accounts.editions_deployment.set_inner(EditionsDeployment {
@@ -148,9 +159,10 @@ pub fn initialise(ctx: Context<InitialiseCtx>, input: InitialiseInput) -> Result
148159
},
149160
0,
150161
Some(TokenMetadata {
151-
name: editions_deployment.name.clone(),
162+
name,
152163
symbol: editions_deployment.symbol.clone(),
153-
uri: editions_deployment.offchain_url.clone(),
164+
// please let's just call it url ok.... please
165+
uri: url,
154166
update_authority,
155167
mint: group_mint.key(),
156168
additional_metadata: vec![],

0 commit comments

Comments
 (0)