-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- upated tonlib - fixed bug in message routing
- Loading branch information
ton
committed
Sep 28, 2019
1 parent
ac3eb1a
commit fd7a8de
Showing
33 changed files
with
1,003 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env fift -s | ||
"TonUtil.fif" include | ||
"Asm.fif" include | ||
|
||
{ ."usage: " @' $0 type ." <workchain-id> [<filename-base>]" cr | ||
."Creates a new advanced wallet in specified workchain, with private key saved to or loaded from <filename-base>.pk" cr | ||
."('new-wallet.pk' by default)" cr 1 halt | ||
} : usage | ||
$# 1- -2 and ' usage if | ||
|
||
$1 parse-workchain-id =: wc // set workchain id from command line argument | ||
def? $2 { @' $2 } { "new-wallet" } cond constant file-base | ||
|
||
."Creating new advanced wallet in workchain " wc . cr | ||
|
||
// Create new advanced wallet; code adapted from `wallet-code.fif` | ||
<{ SETCP0 DUP IFNOTRET // return if recv_internal | ||
DUP 85143 INT EQUAL IFJMP:<{ // "seqno" get-method | ||
DROP c4 PUSHCTR CTOS 32 PLDU // cnt | ||
}> | ||
INC 32 THROWIF // fail unless recv_external | ||
9 PUSHPOW2 LDSLICEX DUP 32 LDU 32 LDU // signature in_msg msg_seqno valid_until cs | ||
SWAP NOW LEQ 35 THROWIF // signature in_msg msg_seqno cs | ||
c4 PUSH CTOS 32 LDU 256 LDU ENDS // signature in_msg msg_seqno cs stored_seqno public_key | ||
s3 s1 XCPU // signature in_msg public_key cs stored_seqno msg_seqno stored_seqno | ||
EQUAL 33 THROWIFNOT // signature in_msg public_key cs stored_seqno | ||
s0 s3 XCHG HASHSU // signature stored_seqno public_key cs hash | ||
s0 s4 s2 XC2PU CHKSIGNU 34 THROWIFNOT // cs stored_seqno public_key | ||
ACCEPT | ||
s0 s2 XCHG // public_key stored_seqno cs | ||
WHILE:<{ | ||
DUP SREFS // public_key stored_seqno cs _40 | ||
}>DO<{ // public_key stored_seqno cs | ||
// 3 INT 35 LSHIFT# 3 INT RAWRESERVE // reserve all but 103 Grams from the balance | ||
8 LDU LDREF s0 s2 XCHG // public_key stored_seqno cs _45 mode | ||
SENDRAWMSG // public_key stored_seqno cs | ||
}> | ||
ENDS INC // public_key seqno' | ||
NEWC 32 STU 256 STU ENDC c4 POP | ||
}>c // >libref | ||
// code | ||
<b 0 32 u, | ||
file-base +".pk" load-generate-keypair | ||
constant wallet_pk | ||
B, | ||
b> // data | ||
null // no libraries | ||
<b b{0011} s, 3 roll ref, rot ref, swap dict, b> // create StateInit | ||
dup ."StateInit: " <s csr. cr | ||
dup hash wc swap 2dup 2constant wallet_addr | ||
."new wallet address = " 2dup .addr cr | ||
2dup file-base +".addr" save-address-verbose | ||
."Non-bounceable address (for init): " 2dup 7 .Addr cr | ||
."Bounceable address (for later access): " 6 .Addr cr | ||
<b 0 32 u, -1 32 i, b> | ||
dup ."signing message: " <s csr. cr | ||
dup hash wallet_pk ed25519_sign_uint rot | ||
<b b{1000100} s, wallet_addr addr, b{000010} s, swap <s s, b{0} s, swap B, swap <s s, b> | ||
dup ."External message for initialization is " <s csr. cr | ||
2 boc+>B dup Bx. cr | ||
file-base +"-query.boc" tuck B>file | ||
."(Saved wallet creating query to file " type .")" cr |
Oops, something went wrong.