2019-10-09 16:00:54 +00:00
|
|
|
#!/usr/bin/fift -s
|
2019-09-07 10:03:22 +00:00
|
|
|
"TonUtil.fif" include
|
|
|
|
|
2019-11-28 14:44:14 +00:00
|
|
|
{ ."usage: " $0 type ." <filename-base>" cr
|
2019-09-07 10:03:22 +00:00
|
|
|
."Shows the address of a simple wallet created by new-wallet.fif, with address in <filename-base>.addr "
|
|
|
|
."and private key in file <filename-base>.pk" cr 1 halt
|
|
|
|
} : usage
|
2019-11-28 14:44:14 +00:00
|
|
|
$# 1 > ' usage if
|
|
|
|
1 :$1..n
|
2019-12-05 12:51:51 +00:00
|
|
|
$1 "new-wallet" replace-if-null =: file-base
|
2019-09-07 10:03:22 +00:00
|
|
|
|
|
|
|
file-base +".addr" dup ."Loading wallet address from " type cr file>B 32 B|
|
|
|
|
dup Blen { 32 B>i@ } { drop Basechain } cond constant wallet_wc
|
|
|
|
256 B>u@ dup constant wallet_addr
|
2020-02-06 17:56:46 +00:00
|
|
|
."Source wallet address = " wallet_wc swap 2dup .addr cr
|
|
|
|
."Non-bounceable address (for init only): " 2dup 7 .Addr cr
|
|
|
|
."Bounceable address (for later access): " 6 .Addr cr
|
2019-09-07 10:03:22 +00:00
|
|
|
|
|
|
|
file-base +".pk" dup file-exists? {
|
|
|
|
dup file>B dup Blen 32 <> abort"Private key must be exactly 32 bytes long"
|
2020-04-27 12:01:46 +00:00
|
|
|
tuck =: wallet_pk ."Private key available in file " type cr
|
|
|
|
priv>pub 256 B>u@
|
|
|
|
dup ."Corresponding public key is " .pubkey ." = " 64X. cr
|
2019-09-07 10:03:22 +00:00
|
|
|
} { ."Private key file " type ." not found" cr } cond
|