OpenJ
OpenJ is a library for interaction with Open Platform.
Content
Installing
Using gradle:
compile("io.openfuture:sdk:1.0.0") 
Using maven:
<dependency>
    <groupId>io.openfuture</groupId>
    <artifactId>sdk</artifactId>
    <version>1.0.0</version>
</dependency> 
Get started
token - your open key
Kotlin:
val open = OpenJ(token) 
Java:
OpenJ open = new OpenJ(token) 
Entity
Base
Page request attributes
| Attribute | Type | Description | 
|---|---|---|
| offset | Long | Page offset | 
| limit | Int | Page limit | 
Page response attributes
| Attribute | Type | Description | 
|---|---|---|
| totalCount | Long | Total count of entities in a database | 
| list | T[] | List of entities with type T (T is generic) | 
Scaffold
Ethereum scaffold attributes
| Attribute | Type | Description | 
|---|---|---|
| address | String | Scaffold address | 
| abi | String | Scaffold json interface | 
| description | String | Scaffold description | 
| fiatAmount | String | Scaffold fiat amount | 
| currency | String | Fiat amount currency | 
| conversionAmount | String | Fiat amount converted to ethereum | 
| developerAddress | String | Scaffold developer address | 
| webHook | String | Scaffold webhook for events | 
| properties | EthereumScaffoldProperty[] | Ethereum scaffold properties | 
Ethereum scaffold properties attributes
| Attribute | Type | Description | 
|---|---|---|
| name | String | Property name | 
| type | PropertyType | Property type | 
| defaultValue | String | Property default value | 
Ethereum scaffold summary attributes
| Attribute | Type | Description | 
|---|---|---|
| scaffold | EthereumScaffold | Ethereum scaffold | 
| transactionIndex | BigInteger | Transaction index | 
| tokenBalance | BigInteger | Scaffold token balance | 
| enabled | Boolean | Scaffold enabled | 
| currency | String | Fiat amount currency | 
| shareHolders | EthereumShareHolder | Ethereum scaffold share holders | 
Ethereum scaffold quota attributes
| Attribute | Type | Description | 
|---|---|---|
| currentCount | Int | Current deactivated scaffolds count | 
| limitCount | Int | Limit of deactivated scaffolds count | 
Deploy ethereum scaffold request
| Attribute | Type | Description | 
|---|---|---|
| openKey | String | User open key | 
| description | String | Scaffold description | 
| fiatAmount | String | Scaffold fiat amount | 
| currency | String | Fiat amount currency | 
| conversionAmount | String | Fiat amount converted to ethereum | 
| developerAddress | String | Scaffold developer address | 
| webHook | String | Scaffold webhook for events | 
| properties | EthereumScaffoldProperty[] | Ethereum scaffold properties | 
Set web hook request
| Attribute | Type | Description | 
|---|---|---|
| address | String | Ethereum scaffold address | 
| webHook | String | Ethereum scaffold webhook for events | 
Open scaffold attributes
| Attribute | Type | Description | 
|---|---|---|
| description | String | Scaffold description | 
| developerAddress | String | Scaffold developer address | 
| webHook | String | Scaffold webhook | 
Save open scaffold request
| Attribute | Type | Description | 
|---|---|---|
| openKey | String | User open key | 
| developerAddress | String | Scaffold developer address | 
| description | String | Scaffold description | 
| webHook | String | Scaffold webhook | 
Shareholder
Ethereum shareholder attributes
| Attribute | Type | Description | 
|---|---|---|
| address | String | Ethereum shareholder address | 
| percent | Int | Ethereum shareholder percent | 
Add ethereum shareholder request
| Attribute | Type | Description | 
|---|---|---|
| address | String | Ethereum shareholder address | 
| percent | Int | Ethereum shareholder percent | 
Update ethereum shareholder request
| Attribute | Type | Description | 
|---|---|---|
| address | String | Ethereum shareholder address | 
| percent | Int | Ethereum shareholder percent | 
Remove ethereum shareholder request
| Attribute | Type | Description | 
|---|---|---|
| address | String | Ethereum shareholder address | 
Transaction
Ethereum transaction attributes
| Attribute | Type | Description | 
|---|---|---|
| scaffold | EthereumScaffold | Ethereum scaffold | 
| event | Event | Event | 
Event
Each event has field type which define an event type
Activate ethereum scaffold event
| Attribute | Type | Description | 
|---|---|---|
| activated | Boolean | Ethereum scaffold state | 
| type | String | "ACTIVATED_SCAFFOLD" | 
Added ethereum share holder event
| Attribute | Type | Description | 
|---|---|---|
| userAddress | String | Share holder address | 
| partnerShare | BigInteger | Share holder share | 
| type | String | "ADDED_SHARE_HOLDER" | 
Delete ethereum share holder event
| Attribute | Type | Description | 
|---|---|---|
| userAddress | String | Share holder address | 
| type | String | "DELETED_SHARE_HOLDER" | 
Edit ethereum share holder event
| Attribute | Type | Description | 
|---|---|---|
| userAddress | String | Shareholder address | 
| partnerShare | BigInteger | Shareholder share | 
| type | String | "EDITED_SHARE_HOLDER" | 
Ethereum funds deposited event
| Attribute | Type | Description | 
|---|---|---|
| amount | BigInteger | Funds amount | 
| toAddress | String | To address | 
| type | String | "FUNDS_DEPOSITED" | 
Paid for ethereum shareholder event
| Attribute | Type | Description | 
|---|---|---|
| userAddress | String | Shareholder address | 
| amount | BigInteger | Paid amount | 
| type | String | "PAID_FOR_SHARE_HOLDER" | 
Payment completed event
| Attribute | Type | Description | 
|---|---|---|
| customerAddress | String | Customer address | 
| transactionAmount | BigInteger | Paid amount | 
| scaffoldTransactionIndex | BigInteger | Transaction index | 
| properties | Map<String, Any> | Transaction properties | 
| type | String | "PAYMENT_COMPLETED" | 
API
sender - an object that produces requests for each entity type
Ethereum scaffold
Scaffold
Kotlin:
val sender = open.ethereumScaffold() 
Java:
EthereumScaffoldSender sender = open.ethereumScaffold() 
Get All
Can be used with page request
Kotlin:
val scaffolds = sender.getAll() 
Java:
PageResponse<EthereumScaffold> scaffolds = sender.getAll() 
Response entity is PageResponse with param EthereumScaffold
Get one
Kotlin:
val scaffold = sender.get(address) 
Java:
EthereumScaffold scaffold = sender.get(address) 
address - Ethereum scaffold address
Response entity is EthereumScaffold
Deploy
Kotlin:
val scaffold = sender.deploy(DeployEthereumScaffoldRequest(openKey, developerAddress, description, fiatAmount, currency, 
                                                   conversionAmount, properties, webHook)) 
Java:
EthereumScaffold scaffold = sender.deploy(new DeployEthereumScaffoldRequest(openKey, developerAddress, description, fiatAmount, currency, 
                                                   conversionAmount, properties, webHook)) 
Request entity is DeployEthereumScaffoldRequest
Response entity is EthereumScaffold
Set webhook
Kotlin:
val scaffold = sender.setWebHook(SetWebHookRequest(address, webHook)) 
Java:
EthereumScaffold scaffold = sender.setWebHook(new SetWebHookRequest(address, webHook)) 
Request entity is SetWebHookRequest
Response entity is EthereumScaffold
Get summary
Kotlin:
val summary = sender.summary(address) 
Java:
EthereumScaffoldSummary summary = sender.summary(address) 
address - Ethereum scaffold address
Response entity is EthereumScaffoldSummary
Deactivate
Kotlin:
val summary = sender.deactivate(address) 
Java:
EthereumScaffoldSummary summary = sender.deactivate(address) 
address - Ethereum scaffold address
Response entity is EthereumScaffoldSummary
Get quota
Kotlin:
val quota = sender.quota() 
Java:
EthereumScaffoldQuota quota = sender.quota() 
Response entity is EthereumScaffoldQuota
Shareholder
Kotlin:
val sender = open.EthereumShareHolderSender(address) 
Java:
EthereumShareHolderSender sender = open.EthereumShareHolderSender(address) 
address - Ethereum scaffold address
Add
Kotlin:
val summary = sender.add(AddEthereumShareHolderRequest(address, percent)) 
Java:
EthereumScaffoldSummary summary = sender.add(new AddEthereumShareHolderRequest(address, percent)) 
Request entity is AddEthereumShareHolderRequest
Response entity is EthereumScaffoldSummary
Update
Kotlin:
val summary = sender.add(UpdateEthereumShareHolderRequest(address, percent)) 
Java:
EthereumScaffoldSummary summary = sender.add(new UpdateEthereumShareHolderRequest(address, percent)) 
Request entity is UpdateEthereumShareHolderRequest
Response entity is EthereumScaffoldSummary
Remove
Kotlin:
val summary = sender.add(RemoveEthereumShareHolderRequest(address)) 
Java:
EthereumScaffoldSummary summary = sender.add(new RemoveEthereumShareHolderRequest(address)) 
Request entity is RemoveEthereumShareHolderRequest
Response entity is EthereumScaffoldSummary
Ethereum transaction
Kotlin:
val sender = open.ethereumTransaction(address) 
Java:
EthereumTransactionSender sender = open.ethereumTransaction(address) 
address - Scaffold address
Get All
Can be used with page request
Kotlin:
val transactions = sender.getAll() 
Java:
PageResponse<EhereumTransaction> transactions = sender.getAll() 
Response entity is PageResponse with param EthereumTransaction
Open scaffold
Scaffold
Kotlin:
val sender = open.openScaffold() 
Java:
OpenScaffoldSender sender = open.openScaffold() 
Get all
Can be used with page request
Kotlin:
val scaffolds = sender.getAll() 
Java:
PageResponse<OpenScaffold> scaffolds = sender.getAll() 
Response entity is PageResponse with param OpenScaffold
Create
Kotlin:
val scaffold = sender.create(SaveOpenScaffoldRequest(openKey, developerAddress, description, webHook)) 
Java:
OpenScaffold scaffold = sender.create(new SaveOpenScaffoldRequest(openKey, developerAddress, description, webHook)) 
Request entity is SaveOpenScaffoldRequest
Response entity is OpenScaffold
 JarCasting
 JarCasting