olifanton / ton

PHP SDK library for The Open Network blockchain
MIT License
39 stars 4 forks source link

Cannot use examples with an uninitialized (but funded) wallet #1

Closed krigga closed 1 year ago

krigga commented 1 year ago

When trying to run examples (i.e. examples/wallets/send-transaction.php) with a freshly created wallet that has funds but is not yet initialized, the examples fail with something like:

Fatal error: Uncaught Olifanton\Ton\Contracts\Wallets\Exceptions\WalletException: Seqno is required in /ton/src/Olifanton/Ton/Contracts/Wallets/AbstractWallet.php:85
Stack trace:
#0 /ton/examples/wallets/send-transaction.php(40): Olifanton\Ton\Contracts\Wallets\AbstractWallet->createTransferMessage(Array, Object(Olifanton\Ton\Contracts\Wallets\TransferOptions))
#1 {main}
  thrown in /ton/src/Olifanton/Ton/Contracts/Wallets/AbstractWallet.php on line 85

because get methods cannot be run on uninitialized accounts.

romanzaycev commented 1 year ago

Ty for report!

romanzaycev commented 1 year ago

Fixed in 0.1.2

krigga commented 1 year ago

It seems that the Deployer class still has that same bug, affecting examples/deployer/deploy-wallet.php

(debug) External message construction for deploy Olifanton\Ton\Contracts\Wallets\V4\WalletV4R2

Fatal error: Uncaught TypeError: Olifanton\Ton\Deployer::createExternal(): Argument #3 ($seqno) must be of type int, null given, called in /ton/src/Olifanton/Ton/Deployer.php on line 53 and defined in /ton/src/Olifanton/Ton/Deployer.php:155
Stack trace:
#0 /ton/src/Olifanton/Ton/Deployer.php(53): Olifanton\Ton\Deployer->createExternal(Object(Olifanton\Ton\DeployOptions), Object(Olifanton\Ton\Contracts\Wallets\V4\WalletV4R2), NULL)
#1 /ton/examples/deployer/deploy-wallet.php(43): Olifanton\Ton\Deployer->deploy(Object(Olifanton\Ton\DeployOptions), Object(Olifanton\Ton\Contracts\Wallets\V4\WalletV4R2))
#2 {main}
  thrown in /ton/src/Olifanton/Ton/Deployer.php on line 155
romanzaycev commented 1 year ago

It seems that the Deployer class still has that same bug, affecting examples/deployer/deploy-wallet.php

I did not suggest such a case when an uninitialized wallet will be used in deployer