forked from xJonathanLEI/starknet-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mint_tokens.rs
37 lines (33 loc) · 1.21 KB
/
mint_tokens.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use starknet::{
accounts::{Account, Call, SingleOwnerAccount},
core::{chain_id, types::FieldElement, utils::get_selector_from_name},
providers::SequencerGatewayProvider,
signers::{LocalWallet, SigningKey},
};
#[tokio::main]
async fn main() {
let provider = SequencerGatewayProvider::starknet_alpha_goerli();
let signer = LocalWallet::from(SigningKey::from_secret_scalar(
FieldElement::from_hex_be("YOUR_PRIVATE_KEY_IN_HEX_HERE").unwrap(),
));
let address = FieldElement::from_hex_be("YOUR_ACCOUNT_CONTRACT_ADDRESS_IN_HEX_HERE").unwrap();
let tst_token_address = FieldElement::from_hex_be(
"07394cbe418daa16e42b87ba67372d4ab4a5df0b05c6e554d158458ce245bc10",
)
.unwrap();
let account = SingleOwnerAccount::new(provider, signer, address, chain_id::TESTNET);
let result = account
.execute(vec![Call {
to: tst_token_address,
selector: get_selector_from_name("mint").unwrap(),
calldata: vec![
address,
FieldElement::from_dec_str("1000000000000000000000").unwrap(),
FieldElement::ZERO,
],
}])
.send()
.await
.unwrap();
dbg!(result);
}