-
Notifications
You must be signed in to change notification settings - Fork 2
/
messenger.js
36 lines (24 loc) · 937 Bytes
/
messenger.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
import {General} from './config.js';
import fs from 'fs';
import { Account, ec, json, stark, Provider, hash, constants, CallData, Contract } 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.contractAddress,
entrypoint: "send_message",
// approve 1 wei for bridge
calldata: CallData.compile({
message: "Hi",
})
}
]
)
console.log("TR Hash: " + "https://starkscan.co/tx/" + mintTxHash)
} catch(e) {
console.log(e)}