Skip to content

Commit 2b5d6f7

Browse files
author
tilo-14
committed
fix spl reference
1 parent 27c153c commit 2b5d6f7

1 file changed

Lines changed: 74 additions & 74 deletions

File tree

api-reference/solana-to-light-comparison.mdx

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -213,19 +213,6 @@ const ix = createInitializeMint2Instruction(
213213
<Tab title="Rust">
214214
<Columns cols={2}>
215215
<CodeGroup>
216-
```rust Light Action
217-
use light_token_client::actions::CreateMint;
218-
219-
let (sig, mint) = CreateMint {
220-
decimals: 9,
221-
freeze_authority: Some(payer.pubkey()),
222-
token_metadata: None,
223-
seed: None,
224-
}
225-
.execute(&mut rpc, &payer, &mint_authority)
226-
.await?;
227-
```
228-
229216
```rust Light Instruction
230217
use light_token::instruction::CreateMint;
231218

@@ -238,6 +225,19 @@ let ix = CreateMint::new(
238225
)
239226
.instruction()?;
240227
```
228+
229+
```rust Light Action
230+
use light_token_client::actions::CreateMint;
231+
232+
let (sig, mint) = CreateMint {
233+
decimals: 9,
234+
freeze_authority: Some(payer.pubkey()),
235+
token_metadata: None,
236+
seed: None,
237+
}
238+
.execute(&mut rpc, &payer, &mint_authority)
239+
.await?;
240+
```
241241
</CodeGroup>
242242
```rust title="SPL"
243243
use spl_token::instruction::initialize_mint;
@@ -327,6 +327,17 @@ const ix = createAssociatedTokenAccountInstruction(
327327
<Tab title="Rust">
328328
<Columns cols={2}>
329329
<CodeGroup>
330+
```rust Light Instruction
331+
use light_token::instruction::CreateAssociatedTokenAccount;
332+
333+
let ix = CreateAssociatedTokenAccount::new(
334+
payer.pubkey(),
335+
owner.pubkey(),
336+
mint,
337+
)
338+
.instruction()?;
339+
```
340+
330341
```rust Light Action
331342
use light_token_client::actions::CreateAta;
332343

@@ -338,17 +349,6 @@ let (sig, ata) = CreateAta {
338349
.execute(&mut rpc, &payer)
339350
.await?;
340351
```
341-
342-
```rust Light Instruction
343-
use light_token::instruction::CreateAssociatedTokenAccount;
344-
345-
let ix = CreateAssociatedTokenAccount::new(
346-
payer.pubkey(),
347-
owner.pubkey(),
348-
mint,
349-
)
350-
.instruction()?;
351-
```
352352
</CodeGroup>
353353
```rust title="SPL"
354354
use spl_associated_token_account::instruction::create_associated_token_account;
@@ -444,29 +444,29 @@ const ix = createMintToInstruction(
444444
<Tab title="Rust">
445445
<Columns cols={2}>
446446
<CodeGroup>
447-
```rust Light Action
448-
use light_token_client::actions::MintTo;
447+
```rust Light Instruction
448+
use light_token::instruction::MintTo;
449449

450-
let sig = MintTo {
450+
let ix = MintTo {
451451
mint,
452452
destination,
453453
amount,
454+
authority: payer.pubkey(),
455+
fee_payer: payer.pubkey(),
454456
}
455-
.execute(&mut rpc, &payer, &authority)
456-
.await?;
457+
.instruction()?;
457458
```
458459

459-
```rust Light Instruction
460-
use light_token::instruction::MintTo;
460+
```rust Light Action
461+
use light_token_client::actions::MintTo;
461462

462-
let ix = MintTo {
463+
let sig = MintTo {
463464
mint,
464465
destination,
465466
amount,
466-
authority: payer.pubkey(),
467-
fee_payer: payer.pubkey(),
468467
}
469-
.instruction()?;
468+
.execute(&mut rpc, &payer, &authority)
469+
.await?;
470470
```
471471
</CodeGroup>
472472
```rust title="SPL"
@@ -595,22 +595,6 @@ const ix = createTransferInstruction(
595595
<Tab title="Rust">
596596
<Columns cols={2}>
597597
<CodeGroup>
598-
```rust Light Action
599-
use light_token_client::actions::TransferInterface;
600-
601-
let sig = TransferInterface {
602-
source,
603-
mint,
604-
destination,
605-
amount,
606-
decimals,
607-
spl_token_program: None,
608-
restricted: false,
609-
}
610-
.execute(&mut rpc, &payer, &authority)
611-
.await?;
612-
```
613-
614598
```rust Light Instruction
615599
use light_token::instruction::TransferInterface;
616600

@@ -628,6 +612,22 @@ let ix = TransferInterface {
628612
}
629613
.instruction()?;
630614
```
615+
616+
```rust Light Action
617+
use light_token_client::actions::TransferInterface;
618+
619+
let sig = TransferInterface {
620+
source,
621+
mint,
622+
destination,
623+
amount,
624+
decimals,
625+
spl_token_program: None,
626+
restricted: false,
627+
}
628+
.execute(&mut rpc, &payer, &authority)
629+
.await?;
630+
```
631631
</CodeGroup>
632632
```rust title="SPL"
633633
use spl_token::instruction::transfer;
@@ -842,30 +842,30 @@ const tx = await approve(
842842
<Tab title="Rust">
843843
<Columns cols={2}>
844844
<CodeGroup>
845-
```rust Light Action
846-
use light_token_client::actions::Approve;
845+
```rust Light Instruction
846+
use light_token::instruction::Approve;
847847

848-
let sig = Approve {
848+
let ix = Approve {
849849
token_account: ata,
850850
delegate: delegate.pubkey(),
851+
owner: payer.pubkey(),
851852
amount,
852-
owner: None,
853+
fee_payer: payer.pubkey(),
853854
}
854-
.execute(&mut rpc, &payer)
855-
.await?;
855+
.instruction()?;
856856
```
857857

858-
```rust Light Instruction
859-
use light_token::instruction::Approve;
858+
```rust Light Action
859+
use light_token_client::actions::Approve;
860860

861-
let ix = Approve {
861+
let sig = Approve {
862862
token_account: ata,
863863
delegate: delegate.pubkey(),
864-
owner: payer.pubkey(),
865864
amount,
866-
fee_payer: payer.pubkey(),
865+
owner: None,
867866
}
868-
.instruction()?;
867+
.execute(&mut rpc, &payer)
868+
.await?;
869869
```
870870
</CodeGroup>
871871
```rust title="SPL"
@@ -922,17 +922,6 @@ const tx = await revoke(
922922
<Tab title="Rust">
923923
<Columns cols={2}>
924924
<CodeGroup>
925-
```rust Light Action
926-
use light_token_client::actions::Revoke;
927-
928-
let sig = Revoke {
929-
token_account: ata,
930-
owner: None,
931-
}
932-
.execute(&mut rpc, &payer)
933-
.await?;
934-
```
935-
936925
```rust Light Instruction
937926
use light_token::instruction::Revoke;
938927

@@ -943,6 +932,17 @@ let ix = Revoke {
943932
}
944933
.instruction()?;
945934
```
935+
936+
```rust Light Action
937+
use light_token_client::actions::Revoke;
938+
939+
let sig = Revoke {
940+
token_account: ata,
941+
owner: None,
942+
}
943+
.execute(&mut rpc, &payer)
944+
.await?;
945+
```
946946
</CodeGroup>
947947
```rust title="SPL"
948948
use spl_token::instruction::revoke;

0 commit comments

Comments
 (0)