mirror of
https://github.com/corda/corda.git
synced 2025-06-22 00:57:21 +00:00
Minor: auto-format of module: samples
This commit is contained in:
@ -10,16 +10,16 @@ import net.corda.core.div
|
|||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
|
import net.corda.core.sizedInputStreamAndHash
|
||||||
import net.corda.core.utilities.Emoji
|
import net.corda.core.utilities.Emoji
|
||||||
import net.corda.flows.FinalityFlow
|
import net.corda.flows.FinalityFlow
|
||||||
import net.corda.nodeapi.config.SSLConfiguration
|
import net.corda.nodeapi.config.SSLConfiguration
|
||||||
import net.corda.testing.ALICE_KEY
|
import net.corda.testing.ALICE_KEY
|
||||||
|
import java.io.InputStream
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import java.io.*
|
|
||||||
import net.corda.core.sizedInputStreamAndHash
|
|
||||||
|
|
||||||
internal enum class Role {
|
internal enum class Role {
|
||||||
SENDER,
|
SENDER,
|
||||||
|
@ -4,11 +4,11 @@ import com.google.common.net.HostAndPort
|
|||||||
import joptsimple.OptionParser
|
import joptsimple.OptionParser
|
||||||
import net.corda.bank.api.BankOfCordaClientApi
|
import net.corda.bank.api.BankOfCordaClientApi
|
||||||
import net.corda.bank.api.BankOfCordaWebApi.IssueRequestParams
|
import net.corda.bank.api.BankOfCordaWebApi.IssueRequestParams
|
||||||
import net.corda.flows.IssuerFlow
|
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.core.node.services.ServiceType
|
import net.corda.core.node.services.ServiceType
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
import net.corda.flows.CashPaymentFlow
|
import net.corda.flows.CashPaymentFlow
|
||||||
|
import net.corda.flows.IssuerFlow
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
@ -59,8 +59,7 @@ private class BankOfCordaDriver {
|
|||||||
startWebserver(bankOfCorda.get())
|
startWebserver(bankOfCorda.get())
|
||||||
waitForAllNodesToFinish()
|
waitForAllNodesToFinish()
|
||||||
}, isDebug = true)
|
}, isDebug = true)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
val requestParams = IssueRequestParams(options.valueOf(quantity), options.valueOf(currency), "BigCorporation", "1", "BankOfCorda")
|
val requestParams = IssueRequestParams(options.valueOf(quantity), options.valueOf(currency), "BigCorporation", "1", "BankOfCorda")
|
||||||
when (role) {
|
when (role) {
|
||||||
@ -76,10 +75,10 @@ private class BankOfCordaDriver {
|
|||||||
if (result)
|
if (result)
|
||||||
println("Successfully processed Cash Issue request")
|
println("Successfully processed Cash Issue request")
|
||||||
}
|
}
|
||||||
Role.ISSUER -> {}
|
Role.ISSUER -> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
println("Exception occurred: $e \n ${e.printStackTrace()}")
|
println("Exception occurred: $e \n ${e.printStackTrace()}")
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,18 @@ class BankOfCordaWebApi(val rpc: CordaRPCOps) {
|
|||||||
data class IssueRequestParams(val amount: Long, val currency: String,
|
data class IssueRequestParams(val amount: Long, val currency: String,
|
||||||
val issueToPartyName: String, val issueToPartyRefAsString: String,
|
val issueToPartyName: String, val issueToPartyRefAsString: String,
|
||||||
val issuerBankName: String)
|
val issuerBankName: String)
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
val logger = loggerFor<BankOfCordaWebApi>()
|
val logger = loggerFor<BankOfCordaWebApi>()
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("date")
|
@Path("date")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
fun getCurrentDate(): Any {
|
fun getCurrentDate(): Any {
|
||||||
return mapOf("date" to LocalDateTime.now().toLocalDate())
|
return mapOf("date" to LocalDateTime.now().toLocalDate())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request asset issuance
|
* Request asset issuance
|
||||||
*/
|
*/
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package net.corda.bank.plugin
|
package net.corda.bank.plugin
|
||||||
|
|
||||||
import net.corda.bank.api.BankOfCordaWebApi
|
import net.corda.bank.api.BankOfCordaWebApi
|
||||||
import net.corda.flows.IssuerFlow
|
|
||||||
import net.corda.core.contracts.Amount
|
import net.corda.core.contracts.Amount
|
||||||
import net.corda.core.crypto.Party
|
import net.corda.core.crypto.Party
|
||||||
import net.corda.core.node.CordaPluginRegistry
|
import net.corda.core.node.CordaPluginRegistry
|
||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
|
import net.corda.flows.IssuerFlow
|
||||||
import java.util.function.Function
|
import java.util.function.Function
|
||||||
|
|
||||||
class BankOfCordaPlugin : CordaPluginRegistry() {
|
class BankOfCordaPlugin : CordaPluginRegistry() {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.corda.irs.api
|
package net.corda.irs.api
|
||||||
|
|
||||||
import net.corda.core.contracts.filterStatesOfType
|
import net.corda.core.contracts.filterStatesOfType
|
||||||
import net.corda.core.crypto.AnonymousParty
|
|
||||||
import net.corda.core.crypto.Party
|
import net.corda.core.crypto.Party
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
|
@ -213,6 +213,7 @@ object NodeInterestRates {
|
|||||||
else -> throw IllegalArgumentException("Oracle received data of different type than expected.")
|
else -> throw IllegalArgumentException("Oracle received data of different type than expected.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val leaves = ftx.filteredLeaves
|
val leaves = ftx.filteredLeaves
|
||||||
if (!leaves.checkWithFun(::check))
|
if (!leaves.checkWithFun(::check))
|
||||||
throw IllegalArgumentException()
|
throw IllegalArgumentException()
|
||||||
|
@ -362,6 +362,7 @@ class InterestRateSwap : Contract {
|
|||||||
fixedRatePayer, notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate,
|
fixedRatePayer, notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate,
|
||||||
terminationDateAdjustment, dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay,
|
terminationDateAdjustment, dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay,
|
||||||
paymentCalendar, interestPeriodAdjustment, fixedRate, rollConvention)
|
paymentCalendar, interestPeriodAdjustment, fixedRate, rollConvention)
|
||||||
|
|
||||||
fun toAnonymous(): FixedLeg<AnonymousParty> {
|
fun toAnonymous(): FixedLeg<AnonymousParty> {
|
||||||
return FixedLeg(fixedRatePayer.toAnonymous(), notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate, terminationDateAdjustment,
|
return FixedLeg(fixedRatePayer.toAnonymous(), notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate, terminationDateAdjustment,
|
||||||
dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment,
|
dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment,
|
||||||
@ -458,6 +459,7 @@ class InterestRateSwap : Contract {
|
|||||||
paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment, rollConvention,
|
paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment, rollConvention,
|
||||||
fixingRollConvention, resetDayInMonth, fixingPeriod, resetRule, fixingsPerPayment,
|
fixingRollConvention, resetDayInMonth, fixingPeriod, resetRule, fixingsPerPayment,
|
||||||
fixingCalendar, index, indexSource, indexTenor)
|
fixingCalendar, index, indexSource, indexTenor)
|
||||||
|
|
||||||
fun toAnonymous(): FloatingLeg<AnonymousParty> {
|
fun toAnonymous(): FloatingLeg<AnonymousParty> {
|
||||||
return FloatingLeg(floatingRatePayer.toAnonymous(), notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate, terminationDateAdjustment,
|
return FloatingLeg(floatingRatePayer.toAnonymous(), notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate, terminationDateAdjustment,
|
||||||
dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment,
|
dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment,
|
||||||
|
@ -136,6 +136,7 @@ class NodeInterestRatesTest {
|
|||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val ftx1 = wtx1.buildFilteredTransaction(::filterAllOutputs)
|
val ftx1 = wtx1.buildFilteredTransaction(::filterAllOutputs)
|
||||||
assertFailsWith<IllegalArgumentException> { oracle.sign(ftx1) }
|
assertFailsWith<IllegalArgumentException> { oracle.sign(ftx1) }
|
||||||
tx.addCommand(Cash.Commands.Move(), ALICE_PUBKEY)
|
tx.addCommand(Cash.Commands.Move(), ALICE_PUBKEY)
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package net.corda.traderdemo
|
package net.corda.traderdemo
|
||||||
|
|
||||||
import net.corda.flows.IssuerFlow
|
import net.corda.core.div
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
|
import net.corda.flows.IssuerFlow
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
|
import net.corda.nodeapi.User
|
||||||
import net.corda.testing.BOC
|
import net.corda.testing.BOC
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import net.corda.core.div
|
|
||||||
import net.corda.nodeapi.User
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes)
|
* This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes)
|
||||||
|
@ -4,7 +4,6 @@ import com.google.common.util.concurrent.Futures
|
|||||||
import net.corda.contracts.testing.calculateRandomlySizedAmounts
|
import net.corda.contracts.testing.calculateRandomlySizedAmounts
|
||||||
import net.corda.core.contracts.Amount
|
import net.corda.core.contracts.Amount
|
||||||
import net.corda.core.contracts.DOLLARS
|
import net.corda.core.contracts.DOLLARS
|
||||||
import net.corda.core.contracts.Issued
|
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
|
Reference in New Issue
Block a user