2021-02-19 13:08:51 -08:00
|
|
|
package cash.z.ecc.android.sdk.sample
|
|
|
|
|
2022-06-21 16:34:42 -07:00
|
|
|
import cash.z.ecc.android.sdk.model.Zatoshi
|
2022-08-02 06:29:09 -07:00
|
|
|
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
2021-04-26 14:37:30 -07:00
|
|
|
import cash.z.ecc.android.sdk.util.TestWallet
|
2021-02-19 13:08:51 -08:00
|
|
|
import kotlinx.coroutines.runBlocking
|
|
|
|
import org.junit.Assert
|
2021-09-11 07:20:27 -07:00
|
|
|
import org.junit.Ignore
|
2021-02-19 13:08:51 -08:00
|
|
|
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 {
|
2021-04-26 14:37:30 -07:00
|
|
|
val wallet = TestWallet(TestWallet.Backups.DEV_WALLET, ZcashNetwork.Mainnet)
|
|
|
|
|
2022-08-04 10:09:19 -07:00
|
|
|
Assert.assertEquals("foo", "${wallet.unifiedAddress} ${wallet.transparentAddress}")
|
2021-04-26 14:37:30 -07:00
|
|
|
// wallet.shieldFunds()
|
2021-02-19 13:08:51 -08:00
|
|
|
|
2022-06-21 16:34:42 -07:00
|
|
|
Assert.assertEquals(Zatoshi(5), wallet.synchronizer.saplingBalances.value?.available)
|
2021-02-19 13:08:51 -08:00
|
|
|
}
|
|
|
|
}
|