Browse Source

adjust cpiBuilder for create

tonyboylehub 8 months ago
parent
commit
914af88420
1 changed files with 13 additions and 13 deletions
  1. 13 13
      src/pages/core/create-asset.md

+ 13 - 13
src/pages/core/create-asset.md

@@ -334,19 +334,19 @@ pub async fn create_asset_with_collection() {
 {% dialect title="Rust (CPI)" id="rust-cpi" %}
 
 ```rust
-let create_ix = CreateV1CpiBuilder::new()
-        .asset(input.asset.pubkey())
-        .collection(input.collection)
-        .authority(input.authority)
-        .payer(payer)
-        .owner(input.owner)
-        .update_authority(input.update_authority)
-        .system_program(system_program::ID)
-        .data_state(input.data_state.unwrap_or(DataState::AccountState))
-        .name(input.name.unwrap_or(DEFAULT_ASSET_NAME.to_owned()))
-        .uri(input.uri.unwrap_or(DEFAULT_ASSET_URI.to_owned()))
-        .plugins(input.plugins)
-        .invoke();
+let create_ix = CreateV1CpiBuilder::new(input.program)
+    .asset(input.asset.pubkey())
+    .collection(Some(input.collection))
+    .authority(Some(input.authority))
+    .payer(input.payer)
+    .owner(Some(input.owner))
+    .update_authority(Some(input.update_authority))
+    .system_program(system_program::ID)
+    .data_state(input.data_state.unwrap_or(DataState::AccountState))
+    .name(input.name)
+    .uri(input.uri)
+    .plugins(input.plugins)
+    .invoke();
 ```
 
 {% /dialect %}