This repository has been archived by the owner on Oct 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
531 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import DS from 'ember-data'; | ||
|
||
const { attr, hasMany, belongsTo } = DS; | ||
|
||
export default DS.Model.extend({ | ||
wallet: DS.belongsTo('wallet'), | ||
blocks: DS.hasMany('block', { inverse: 'source' }), | ||
wallet: belongsTo('wallet'), | ||
blocks: hasMany('block', { async: true, inverse: 'source' }), | ||
history: hasMany('history', { async: true, inverse: 'parentAccount' }), | ||
|
||
balance: DS.attr('big-number'), | ||
pending: DS.attr('big-number'), | ||
balance: attr('big-number'), | ||
pending: attr('big-number'), | ||
}); |
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,11 @@ | ||
import DS from 'ember-data'; | ||
|
||
const { attr, belongsTo } = DS; | ||
|
||
export default DS.Model.extend({ | ||
wallet: DS.belongsTo('wallet', { inverse: null }), | ||
source: DS.belongsTo('account', { inverse: 'blocks' }), | ||
wallet: belongsTo('wallet', { inverse: null }), | ||
source: belongsTo('account', { inverse: 'blocks' }), | ||
|
||
destination: DS.attr('string'), | ||
amount: DS.attr('big-number'), | ||
destination: attr('string'), | ||
amount: attr('big-number'), | ||
}); |
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 @@ | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
wallet: null, | ||
account: null, | ||
history: null, | ||
}); |
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,27 @@ | ||
<table class="table table-striped table-responsive"> | ||
<caption class="sr-only">History for account {{account.id}}</caption> | ||
<thead> | ||
<tr> | ||
<th scope="col">Type</th> | ||
<th scope="col">Account</th> | ||
<th scope="col">Amount</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each history as |entry|}} | ||
<tr scope="row"> | ||
<td> | ||
{{entry.type}} | ||
</td> | ||
<td> | ||
{{#link-to 'wallets.accounts.index' wallet account disabledWhen=(not (contains account wallet.accounts))}} | ||
{{truncate entry.account 30}} | ||
{{/link-to}} | ||
</td> | ||
<td> | ||
{{format-amount entry.amount}} | ||
</td> | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
</table> |
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,24 @@ | ||
import DS from 'ember-data'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
import { resolve } from 'rsvp'; | ||
|
||
export default DS.Adapter.extend({ | ||
rpc: service(), | ||
|
||
// async findRecord(store, type, id, snapshot) { | ||
// const info = await this.get('rpc').accountInfo(id); | ||
// const data = this.serialize(snapshot, { includeId: true }); | ||
// return assign(data, info); | ||
// }, | ||
|
||
// async createRecord(store, type, snapshot) { | ||
// const { wallet } = this.serialize(snapshot, { includeId: true }); | ||
// const { account } = await this.get('rpc').accountCreate(wallet); | ||
// return this.get('rpc').accountInfo(account); | ||
// }, | ||
|
||
query(store, type, { account, count = 10 }) { | ||
return this.get('rpc').accountHistory(account, count); | ||
}, | ||
}); |
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 @@ | ||
import DS from 'ember-data'; | ||
|
||
const { attr, belongsTo } = DS; | ||
|
||
export default DS.Model.extend({ | ||
parentAccount: belongsTo('account'), | ||
|
||
// hash: attr('string'), | ||
type: attr('string'), | ||
account: attr('string'), | ||
amount: attr('big-number'), | ||
}); |
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,5 @@ | ||
import DS from 'ember-data'; | ||
|
||
export default DS.JSONSerializer.extend({ | ||
primaryKey: 'hash', | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ Storage.reopenClass({ | |
initialState() { | ||
return { | ||
wallet: null, | ||
account: null, | ||
}; | ||
} | ||
}); | ||
|
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,7 +1,9 @@ | ||
import DS from 'ember-data'; | ||
|
||
const { attr, hasMany } = DS; | ||
|
||
export default DS.Model.extend({ | ||
accounts: DS.hasMany('account', { async: true }), | ||
accounts: hasMany('account', { async: true }), | ||
|
||
balance: DS.attr('big-number'), | ||
balance: attr('big-number'), | ||
}); |
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,16 @@ | ||
import Route from '@ember/routing/route'; | ||
import { get, set } from '@ember/object'; | ||
|
||
export default Route.extend({ | ||
async model() { | ||
const account = this.modelFor('wallets.accounts'); | ||
const history = await this.store.query('history', { | ||
account: get(account, 'id'), | ||
count: 10, | ||
}); | ||
|
||
set(account, 'history', history); | ||
|
||
return account; | ||
} | ||
}); |
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 @@ | ||
<h1>History</h1> | ||
|
||
<p class="lead"> | ||
Account: {{model.id}} | ||
</p> | ||
|
||
{{account-history wallet=model.wallet account=model history=model.history}} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,4 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({ | ||
// redirect() { | ||
// this.transitionTo('wallets.overview'); | ||
// }, | ||
|
||
// actions: { | ||
// createAccount() { | ||
// this.store.createRecord('account', { | ||
// wallet: '5884EFFA051F8363A4CCFAB1CBECCA4E0CD13DC4D125722ED75E8CD37FC55662' | ||
// }); | ||
// } | ||
// } | ||
}); |
Oops, something went wrong.