View Unit1.pas
This file contains 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( | |
web3.Ethereum, | |
web3.eth.infura.endpoint(web3.Ethereum, INFURA_PROJECT_ID) | |
); | |
const task = web3.eth.balancer.v2.listen( | |
client, | |
procedure( | |
blockNo : BigInteger; | |
poolId : TBytes32; |
View Unit1.pas
This file contains 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( | |
web3.Ethereum, | |
web3.eth.infura.endpoint(web3.Ethereum, INFURA_PROJECT_ID) | |
); | |
web3.eth.balancer.v2.swap( | |
client, | |
owner, | |
TSwapKind.GivenIn, | |
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC |
View ETH-XXX-2.sh
This file contains 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
# Trade on all the ETH-XXX market pairs. | |
# Written by Stefan van As <svanas AT runbox DOT com> | |
# Example: ./ETH-XXX-2.sh --exchange=Bittrex --price=0.05 --pushover-app-key=X --pushover-user-key=X | |
for i in "$@" | |
do | |
case $i in | |
--exchange=*) | |
EXCHANGE="${i#*=}" | |
shift # past argument=value |
View Unit1.pas
This file contains 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 | |
Mempool: IMempool; | |
procedure TForm1.Button1Click(Sender: TObject); | |
begin | |
Mempool := TSgcMempool.Subscribe( | |
Mainnet, // ethereum main net | |
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', // your blocknative API key | |
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // address to watch | |
procedure(event: TJsonObject; err: IError) // continuous events (or a blocknative error) |
View Unit1.pas
This file contains 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
begin | |
var 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); |
View Unit1.pas
This file contains 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, | |
'b5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7', // from private key | |
'0x94863b36b2d245cdeb3686837fb81ebd78a18086', // to smart contract | |
'setNumber(uint256)', [143], | |
procedure(rcpt: ITxReceipt; err: IError) begin end); |
View Unit1.pas
This file contains 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, | |
'b5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7', // from private key | |
'0x94863b36b2d245cdeb3686837fb81ebd78a18086', // to smart contract | |
'incrementNumber()', [], | |
procedure(rcpt: ITxReceipt; err: IError) begin end); |
View Unit1.pas
This file contains 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(Ropsten, 'https://ropsten.infura.io/v3/your-project-id'); | |
end; |
View Unit1.pas
This file contains 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, | |
'0x94863b36b2d245cdeb3686837fb81ebd78a18086', | |
'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); |
NewerOlder