#!/usr/bin/env fift -s "TonUtil.fif" include { ."usage: " @' $0 type ." [-B ] []" cr ."Creates a request to simple wallet created by new-wallet.fif, with private key loaded from file .pk " ."and address from .addr, and saves it into .boc ('wallet-query.boc' by default)" cr 1 halt } : usage def? $6 { @' $5 "-B" $= { @' $6 =: body-boc-file [forget] $6 def? $7 { @' $7 =: $5 [forget] $7 } { [forget] $5 } cond @' $# 2- =: $# } if } if $# dup 4 < swap 5 > or ' usage if true constant bounce $1 =: file-base $2 bounce parse-load-address =: bounce 2=: dest_addr $3 parse-int =: seqno $4 $>GR =: amount def? $5 { @' $5 } { "wallet-query" } cond constant savefile 3 constant send-mode // mode for SENDRAWMSG: +1 - sender pays fees, +2 - ignore errors file-base +".addr" load-address 2dup 2constant wallet_addr ."Source wallet address = " 2dup .addr cr 6 .Addr cr file-base +".pk" load-keypair nip constant wallet_pk def? body-boc-file { @' body-boc-file file>B B>boc } { } cond constant body-cell ."Transferring " amount .GR ."to account " dest_addr 2dup bounce 7 + .Addr ." = " .addr ."seqno=0x" seqno x. ."bounce=" bounce . cr ."Body of transfer message is " body-cell dup ."signing message: " dup ."resulting external message: " B dup Bx. cr savefile +".boc" tuck B>file ."(Saved to file " type .")" cr