#!/usr/bin/fift -s "TonUtil.fif" include "Asm.fif" include { ."usage: " $0 type ." []" cr ."Creates a new advanced wallet with unique 32-bit identifier in specified workchain, with private key saved to or loaded from .pk" cr ."('new-wallet.pk' by default)" cr 1 halt } : usage $# 2- -2 and ' usage if 3 :$1..n $1 parse-workchain-id =: wc // set workchain id from command line argument $2 parse-int =: subwallet-id $3 "new-wallet" replace-if-null =: file-base ."Creating new advanced v3 wallet in workchain " wc . cr ."with unique wallet id " subwallet-id . cr // Create new advanced wallet; code adapted from `auto/wallet3-code.fif` "wallet-v3-code.fif" include // >libref // code // data null // no libraries // create StateInit dup ."StateInit: " dup ."signing message: " dup ."External message for initialization is " B dup Bx. cr file-base +"-query.boc" tuck B>file ."(Saved wallet creating query to file " type .")" cr