i found the library delphereum and I'm trying to implement it, I'd like to swap directly in bscscan with SwapExactETHForTokens, but I didn't find documentation or examples, I'm doing the following, but I get error "Acess violation"
const
URL = 'https://bsc-dataseed.binance.org';
var
pvk: TPrivatekey;
valor, min : BigInteger;
TokenAdd : TAddress;
unxTimeMin : Int64;
rt2 : TRouter02;
begin
pvk := '6c87eae6cad6c9f160878f99660ee17fb6d48b867defa67cdf733a496d4ebfaf';
valor := web3.eth.utils.toWei('0.0003', ether);
min := web3.eth.utils.toWei('0', ether);
unxTimeMin := 10;
TokenAdd := '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c, 0x7AE5709c585cCFB3e61fF312EC632C21A5F03F70';
rt2 := web3.eth.uniswap.v2.TRouter02.Create(TWeb3.Create(URL));
rt2.SwapExactETHForTokens(pvk, valor, min, TokenAdd, unxTimeMin,
procedure(rcpt : ITxReceipt; err : IError)
begin
TThread.Synchronize(nil, procedure
begin
if Assigned(err) then
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0)
else
mJson.Lines.Add(rcpt.txHash);
ShowMessage('Hash: ' + rcpt.txHash);
end);
end);
end;
I'm confused about the parameters I have to pass, I would like to do the same as demonstrated in this example in python