This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const client: IWeb3 = TWeb3.Create('https://<your-node-name>.quiknode.pro/<your-token>/'); | |
web3.eth.blockNumber(client, procedure(num: BigInteger; err: IError) | |
begin | |
TThread.Synchronize(nil, procedure | |
begin | |
if Assigned(err) then | |
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0) | |
else | |
MessageDlg(num.ToString, TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOK], 0); | |
end); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web3.eth.call(TWeb3.Create( | |
Sepolia.SetRPC( // Sepolia test net | |
'https://sepolia.infura.io/v3/your-project-id')), // RPC access to Sepolia | |
'0x643C9Db08aBE4D95e4F2Afc733F78b601b84007A', // smart contract address | |
'myFirstHelloWorld()', [], procedure(tup: TTuple; err: IError) | |
begin | |
TThread.Synchronize(nil, procedure | |
begin | |
if Assigned(err) then | |
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ERC20: IERC20 = TERC20.Create(TWeb3.Create( | |
Sepolia.SetRPC('https://sepolia.infura.io/v3/your-project-id')), // Sepolia testnet | |
'0xe28a3A4BFbf285676405cF55354f8b504D844f3c'); // TST smart contract address | |
ERC20.Transfer( | |
TPrivateKey('24622d680bb9d6d80c4d3fb4b4818e738de64b521948b1b1c85616eeeda54ee1'), // from private key | |
'0xaDDcedc01C1070bCE0aF7eb853845e7811EB649C', // to public key | |
1000000000000000, // 0.001 TST | |
procedure(hash: TTxHash; err: IError) | |
begin | |
TThread.Synchronize(nil, procedure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uses | |
web3.eth.crypto, web3.eth.types; | |
procedure TForm1.Button1Click(Sender: TObject); | |
begin | |
ShowMessage( | |
web3.eth.crypto.sign( | |
TPrivateKey('b5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7'), | |
'Hello, World!' | |
).ToHex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Client: IWeb3 = TWeb3.Create('https://mainnet.infura.io/v3/your-project-id'); | |
web3.eth.call(Client, '0xB8c77482e45F1F44dE1745F52C74426C631bDD52', 'symbol()', [], procedure(tup: TTuple; err: IError) | |
begin | |
if Assigned(err) then | |
begin | |
TThread.Synchronize(nil, procedure | |
begin | |
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0) | |
end); | |
EXIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uses | |
// Delphi | |
System.Classes, | |
System.JSON, | |
System.UITypes, | |
// FireMonkey | |
FMX.Controls, | |
FMX.Controls.Presentation, | |
FMX.Dialogs, | |
FMX.Forms, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web3.eth.write(Client, | |
TPrivateKey('b5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7'), // from private key | |
'0x1a306890df22c0965b0b1515a8082f8301d3d18e', // to smart contract | |
'setNumber(uint256)', [143], | |
procedure(rcpt: ITxReceipt; err: IError) begin end); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web3.eth.write(Client, | |
TPrivateKey('b5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7'), // from private key | |
'0x1a306890df22c0965b0b1515a8082f8301d3d18e', // to smart contract | |
'incrementNumber()', [], | |
procedure(rcpt: ITxReceipt; err: IError) begin end); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web3.eth.call(Client, | |
'0x1a306890df22c0965b0b1515a8082f8301d3d18e', | |
'getNumber()', [], procedure(qty: BigInteger; err: IError) | |
begin | |
TThread.Synchronize(nil, procedure | |
begin | |
if Assigned(err) then | |
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0) | |
else | |
ShowMessage(qty.ToString); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var | |
Client: IWeb3; | |
procedure TForm1.FormCreate(Sender: TObject); | |
begin | |
Client := TWeb3.Create(Sepolia.SetRPC('https://sepolia.infura.io/v3/your-project-id')); | |
end; |
NewerOlder