mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated fift + bugfixes
This commit is contained in:
parent
090e0c16eb
commit
ceaed40ac4
28 changed files with 530 additions and 108 deletions
|
@ -1,30 +1,52 @@
|
|||
#!/usr/bin/fift -s
|
||||
"TonUtil.fif" include
|
||||
"GetOpt.fif" include
|
||||
|
||||
{ show-options-help 1 halt } : usage
|
||||
|
||||
"" =: comment // comment for simple transfers
|
||||
true =: allow-bounce
|
||||
false =: force-bounce
|
||||
3 =: send-mode // mode for SENDRAWMSG: +1 - sender pays fees, +2 - ignore errors
|
||||
60 =: timeout // external message expires in 60 seconds
|
||||
|
||||
begin-options
|
||||
" <filename-base> <dest-addr> <seqno> <amount> [-n|-b] [-t<timeout>] [-B <body-boc>] [-C <comment>] [<savefile>]" +cr +tab
|
||||
+"Creates a request to advanced wallet created by new-wallet-v2.fif, with private key loaded from file <filename-base>.pk "
|
||||
+"and address from <filename-base>.addr, and saves it into <savefile>.boc ('wallet-query.boc' by default)"
|
||||
generic-help
|
||||
"n" "--no-bounce" { false =: allow-bounce } short-long-option
|
||||
"Clears bounce flag" option-help
|
||||
"b" "--force-bounce" { true =: force-bounce } short-long-option
|
||||
"Forces bounce flag" option-help
|
||||
"t" "--timeout" { parse-int =: timeout } short-long-option-arg
|
||||
"Sets expiration timeout in seconds (" timeout (.) $+ +" by default)" option-help
|
||||
"B" "--body" { =: body-boc-file } short-long-option-arg
|
||||
"Sets the payload of the transfer message" option-help
|
||||
"C" "--comment" { =: comment } short-long-option-arg
|
||||
"Sets the comment to be sent in the transfer message" option-help
|
||||
"m" "--mode" { parse-int =: send-mode } short-long-option-arg
|
||||
"Sets transfer mode (0..255) for SENDRAWMSG (" send-mode (.) $+ +" by default)"
|
||||
option-help
|
||||
"h" "--help" { usage } short-long-option
|
||||
"Shows a help message" option-help
|
||||
parse-options
|
||||
|
||||
{ ."usage: " @' $0 type ." <filename-base> <dest-addr> <seqno> <amount> [-B <body-boc>] [<savefile>]" cr
|
||||
."Creates a request to advanced wallet created by new-wallet-v2.fif, with private key loaded from file <filename-base>.pk "
|
||||
."and address from <filename-base>.addr, and saves it into <savefile>.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
|
||||
|
||||
5 :$1..n
|
||||
true constant bounce
|
||||
|
||||
$1 =: file-base
|
||||
$2 bounce parse-load-address =: bounce 2=: dest_addr
|
||||
$2 bounce parse-load-address force-bounce or allow-bounce and =: 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
|
||||
60 constant timeout // external message expires in 60 seconds
|
||||
$5 "wallet-query" replace-if-null =: savefile
|
||||
|
||||
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 } { <b 0 32 u, "TESTv2" $, b> } cond
|
||||
def? body-boc-file { @' body-boc-file file>B B>boc } { comment simple-transfer-body } cond
|
||||
constant body-cell
|
||||
|
||||
."Transferring " amount .GR ."to account "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue