2021-02-19 13:08:51 -08:00
|
|
|
package cash.z.ecc.android.sdk.sample
|
|
|
|
|
|
|
|
import cash.z.ecc.android.sdk.ext.Twig
|
2021-04-26 14:37:30 -07:00
|
|
|
import cash.z.ecc.android.sdk.type.ZcashNetwork
|
|
|
|
import cash.z.ecc.android.sdk.util.TestWallet
|
2021-02-19 13:08:51 -08:00
|
|
|
import kotlinx.coroutines.runBlocking
|
|
|
|
import org.junit.Assert
|
|
|
|
import org.junit.Test
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Samples related to shielding funds.
|
|
|
|
*/
|
|
|
|
class ShieldFundsSample {
|
|
|
|
|
2021-04-26 14:37:30 -07:00
|
|
|
val SEED_PHRASE = "still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread" // \"//\"deputy visa gentle among clean scout farm drive comfort patch skin salt ranch cool ramp warrior drink narrow normal lunch behind salt deal person"//"deputy visa gentle among clean scout farm drive comfort patch skin salt ranch cool ramp warrior drink narrow normal lunch behind salt deal person"
|
2021-02-19 13:08:51 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This test will construct a t2z transaction. It is safe to run this repeatedly, because
|
|
|
|
* nothing is submitted to the network (because the keys don't match the address so the encoding
|
|
|
|
* fails). Originally, it's intent is just to exercise the code and troubleshoot any issues but
|
|
|
|
* then it became clear that this would be a cool Sample Test and PoC for writing a SimpleWallet
|
|
|
|
* class.
|
|
|
|
*/
|
|
|
|
@Test
|
2021-08-30 05:53:12 -07:00
|
|
|
@Ignore("This test is broken")
|
2021-02-19 13:08:51 -08:00
|
|
|
fun constructT2Z() = runBlocking {
|
|
|
|
Twig.sprout("ShieldFundsSample")
|
|
|
|
|
2021-04-26 14:37:30 -07:00
|
|
|
val wallet = TestWallet(TestWallet.Backups.DEV_WALLET, ZcashNetwork.Mainnet)
|
|
|
|
|
|
|
|
Assert.assertEquals("foo", "${wallet.shieldedAddress} ${wallet.transparentAddress}")
|
|
|
|
// wallet.shieldFunds()
|
2021-02-19 13:08:51 -08:00
|
|
|
|
|
|
|
Twig.clip("ShieldFundsSample")
|
2021-06-18 21:24:21 -07:00
|
|
|
Assert.assertEquals(5, wallet.synchronizer.saplingBalances.value.availableZatoshi)
|
2021-02-19 13:08:51 -08:00
|
|
|
}
|
|
|
|
}
|