-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Kotlin extensions Batch 1 * Kotlin extensions Batch 2 * Create ProfileEntity * Rename passphrase in test
- Loading branch information
1 parent
9d0f058
commit 5ccf175
Showing
78 changed files
with
1,398 additions
and
49 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
17 changes: 17 additions & 0 deletions
17
jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/AuthorisedDapp.kt
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,17 @@ | ||
package com.radixdlt.sargon.extensions | ||
|
||
import com.radixdlt.sargon.AuthorizedDapp | ||
import com.radixdlt.sargon.BagOfBytes | ||
import com.radixdlt.sargon.authorizedDappToJsonBytes | ||
import com.radixdlt.sargon.newAuthorizedDappFromJsonBytes | ||
|
||
@Throws(SargonException::class) | ||
fun AuthorizedDapp.Companion.deserializeFromJsonBytes(jsonBytes: BagOfBytes) = | ||
newAuthorizedDappFromJsonBytes(jsonBytes = jsonBytes) | ||
|
||
@Throws(SargonException::class) | ||
fun AuthorizedDapp.Companion.deserializeFromJsonString(jsonString: String) = | ||
deserializeFromJsonBytes(jsonBytes = bagOfBytes(fromString = jsonString)) | ||
|
||
fun AuthorizedDapp.serializedJsonBytes(): BagOfBytes = authorizedDappToJsonBytes(authorizedDapp = this) | ||
fun AuthorizedDapp.serializedJsonString(): String = serializedJsonBytes().string |
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
12 changes: 12 additions & 0 deletions
12
jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/DepositRule.kt
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,12 @@ | ||
package com.radixdlt.sargon.extensions | ||
|
||
import com.radixdlt.sargon.DepositRule | ||
import com.radixdlt.sargon.depositRuleToJsonString | ||
import com.radixdlt.sargon.newDepositRuleFromJsonString | ||
|
||
@Throws(SargonException::class) | ||
fun DepositRule.Companion.deserializeFromJsonString(jsonString: String): DepositRule = | ||
newDepositRuleFromJsonString(jsonString = jsonString) | ||
|
||
fun DepositRule.serializedJsonString(): String = depositRuleToJsonString(depositRule = this) | ||
|
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
38 changes: 37 additions & 1 deletion
38
jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/FactorSourceId.kt
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 |
---|---|---|
@@ -1,9 +1,45 @@ | ||
package com.radixdlt.sargon.extensions | ||
|
||
import com.radixdlt.sargon.BagOfBytes | ||
import com.radixdlt.sargon.FactorSourceId | ||
import com.radixdlt.sargon.FactorSourceIdFromAddress | ||
import com.radixdlt.sargon.FactorSourceIdFromHash | ||
import com.radixdlt.sargon.factorSourceIDFromAddressToJsonBytes | ||
import com.radixdlt.sargon.factorSourceIDFromHashToJsonBytes | ||
import com.radixdlt.sargon.newFactorSourceIDFromAddressFromJsonBytes | ||
import com.radixdlt.sargon.newFactorSourceIDFromHashFromJsonBytes | ||
|
||
fun FactorSourceIdFromHash.asGeneral() = FactorSourceId.Hash(value = this) | ||
|
||
fun FactorSourceIdFromAddress.asGeneral() = FactorSourceId.Address(value = this) | ||
fun FactorSourceIdFromAddress.asGeneral() = FactorSourceId.Address( | ||
value = this | ||
) | ||
|
||
@Throws(SargonException::class) | ||
fun FactorSourceId.Address.Companion.deserializeFromJsonBytes( | ||
jsonBytes: BagOfBytes | ||
): FactorSourceId.Address = | ||
newFactorSourceIDFromAddressFromJsonBytes(jsonBytes = jsonBytes).asGeneral() | ||
|
||
@Throws(SargonException::class) | ||
fun FactorSourceId.Address.Companion.deserializeFromJsonString(jsonString: String): FactorSourceId.Address = | ||
deserializeFromJsonBytes(jsonBytes = bagOfBytes(fromString = jsonString)) | ||
|
||
fun FactorSourceId.Address.serializedJsonBytes(): BagOfBytes = | ||
factorSourceIDFromAddressToJsonBytes(factorSourceIDFromAddress = value) | ||
|
||
fun FactorSourceId.Address.serializedJsonString(): String = serializedJsonBytes().string | ||
|
||
@Throws(SargonException::class) | ||
fun FactorSourceId.Hash.Companion.deserializeFromJsonBytes( | ||
jsonBytes: BagOfBytes | ||
): FactorSourceId.Hash = newFactorSourceIDFromHashFromJsonBytes(jsonBytes = jsonBytes).asGeneral() | ||
|
||
@Throws(SargonException::class) | ||
fun FactorSourceId.Hash.Companion.deserializeFromJsonString(jsonString: String): FactorSourceId.Hash = | ||
deserializeFromJsonBytes(jsonBytes = bagOfBytes(fromString = jsonString)) | ||
|
||
fun FactorSourceId.Hash.serializedJsonBytes(): BagOfBytes = | ||
factorSourceIDFromHashToJsonBytes(factorSourceIDFromHash = value) | ||
|
||
fun FactorSourceId.Hash.serializedJsonString(): String = serializedJsonBytes().string |
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
27 changes: 26 additions & 1 deletion
27
jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/Gateway.kt
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 |
---|---|---|
@@ -1,11 +1,36 @@ | ||
package com.radixdlt.sargon.extensions | ||
|
||
import com.radixdlt.sargon.Gateway | ||
import com.radixdlt.sargon.NetworkId | ||
import com.radixdlt.sargon.gatewayIsWellknown | ||
import com.radixdlt.sargon.gatewayMainnet | ||
import com.radixdlt.sargon.gatewayStokenet | ||
import com.radixdlt.sargon.gatewayToString | ||
import com.radixdlt.sargon.gatewayWellknownGateways | ||
import com.radixdlt.sargon.newGatewayForNetworkId | ||
import com.radixdlt.sargon.newGatewayWithUrlOnNetwork | ||
|
||
val Gateway.Companion.mainnet: Gateway | ||
get() = gatewayMainnet() | ||
|
||
val Gateway.Companion.stokenet: Gateway | ||
get() = gatewayStokenet() | ||
get() = gatewayStokenet() | ||
|
||
val Gateway.Companion.wellKnown: List<Gateway> | ||
get() = gatewayWellknownGateways() | ||
|
||
@Throws(SargonException::class) | ||
fun Gateway.Companion.init(url: String, networkId: NetworkId): Gateway = | ||
newGatewayWithUrlOnNetwork(url = url, networkId = networkId) | ||
|
||
fun Gateway.Companion.forNetwork(networkId: NetworkId): Gateway = | ||
newGatewayForNetworkId(networkId = networkId) | ||
|
||
/** | ||
* Returns the [Gateway]'s url as [String] | ||
*/ | ||
val Gateway.string: String | ||
get() = gatewayToString(gateway = this) | ||
|
||
val Gateway.isWellKnown: Boolean | ||
get() = gatewayIsWellknown(gateway = this) |
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
1 change: 0 additions & 1 deletion
1
jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/Hash.kt
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
7 changes: 7 additions & 0 deletions
7
jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/HdPathComponent.kt
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,7 @@ | ||
package com.radixdlt.sargon.extensions | ||
|
||
import com.radixdlt.sargon.HdPathComponent | ||
import com.radixdlt.sargon.hdPathComponentGetNonHardenedValue | ||
|
||
val HdPathComponent.nonHardenedValue: HDPathValue | ||
get() = hdPathComponentGetNonHardenedValue(component = this) |
Oops, something went wrong.