Skip to content

Commit c1ee18c

Browse files
authored
Add state-init option to wallet-v3.fif script (#1282)
1 parent 96ddbcd commit c1ee18c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

crypto/smartcont/wallet-v3.fif

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ variable extra-currencies
1313
{ extra-currencies @ cc+ extra-currencies ! } : extra-cc+!
1414

1515
begin-options
16-
" <filename-base> <dest-addr> <subwallet-id> <seqno> <amount> [-x <extra-amount>*<extra-currency-id>] [-n|-b] [-t<timeout>] [-B <body-boc>] [-C <comment>] [<savefile>]" +cr +tab
16+
" <filename-base> <dest-addr> <subwallet-id> <seqno> <amount> [-x <extra-amount>*<extra-currency-id>] [-n|-b] [-t<timeout>] [-B <body-boc>] [-C <comment>] [-I <init-boc>] [<savefile>]" +cr +tab
1717
+"Creates a request to advanced wallet created by new-wallet-v3.fif, with private key loaded from file <filename-base>.pk "
1818
+"and address from <filename-base>.addr, and saves it into <savefile>.boc ('wallet-query.boc' by default)"
1919
disable-digit-options generic-help-setopt
@@ -29,6 +29,8 @@ begin-options
2929
"Sets the payload of the transfer message" option-help
3030
"C" "--comment" { =: comment } short-long-option-arg
3131
"Sets the comment to be sent in the transfer message" option-help
32+
"I" "--with-init" { =: init-file } short-long-option-arg
33+
"Indicates filename with BoC containing StateInit for internal message" option-help
3234
"m" "--mode" { parse-int =: send-mode } short-long-option-arg
3335
"Sets transfer mode (0..255) for SENDRAWMSG (" send-mode (.) $+ +" by default)"
3436
option-help
@@ -57,14 +59,18 @@ file-base +".pk" load-keypair nip constant wallet_pk
5759
def? body-boc-file { @' body-boc-file file>B B>boc } { comment simple-transfer-body } cond
5860
constant body-cell
5961

62+
def? init-file { @' init-file file>B B>boc <s b{11} swap |_ } { b{0} } cond
63+
=: state-init
64+
6065
."Transferring " amount .GR+cc ."to account "
6166
dest_addr 2dup bounce 7 + .Addr ." = " .addr
6267
."subwallet_id=0x" subwallet_id x.
6368
."seqno=0x" seqno x. ."bounce=" bounce . cr
6469
."Body of transfer message is " body-cell <s csr. cr
70+
."StateInit is " state-init csr. cr
6571

6672
// create a message
67-
<b b{01} s, bounce 1 i, b{000} s, dest_addr Addr, amount Gram+cc, 0 9 64 32 + + u,
73+
<b b{01} s, bounce 1 i, b{000} s, dest_addr Addr, amount Gram+cc, 0 8 64 32 + + u, state-init s,
6874
body-cell <s 2dup 1 s-fits-with? not rot over 1 i, -rot { drop body-cell ref, } { s, } cond
6975
b>
7076
<b subwallet_id 32 u, now timeout + 32 u, seqno 32 u, send-mode 8 u, swap ref, b>

0 commit comments

Comments
 (0)