-
Notifications
You must be signed in to change notification settings - Fork 2
/
mint.js
47 lines (34 loc) · 1.22 KB
/
mint.js
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
38
39
40
41
42
43
44
45
46
47
import {General} from './config.js';
import {abi} from './data/abi.js';
import fs from 'fs';
import { Account, Provider, CallData, cairo } from "starknet";
const privateKeyAX = fs.readFileSync('data/wallet.txt', 'utf8');
const AXcontractAddress = fs.readFileSync('data/address.txt', 'utf8');
try{
const provider = new Provider({ rpc: { nodeUrl: General.nodeUrl } });
const account = new Account(provider, AXcontractAddress, privateKeyAX, "1");
const { transaction_hash: mintTxHash } = await account.execute(
[
// Calling the first contract
{
contractAddress: General.contractAddressETH,
entrypoint: "approve",
// approve 1 wei for bridge
calldata: CallData.compile({
spender: General.contractAddress,
amount: cairo.uint256(50000000000000),
})
},
// Calling the second contract
{
contractAddress: General.contractAddress,
entrypoint: "mint",
// transfer 1 wei to the contract address
calldata: CallData.compile({
})
}
]
)
console.log("TR Hash: " + "https://starkscan.co/tx/" + mintTxHash)
} catch(e) {
console.log(e)}