Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ycc-website
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Website
ycc-website
Commits
69d36303
Commit
69d36303
authored
Feb 28, 2022
by
chenqikuai
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add types
parent
faa56cd4
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
173 additions
and
35 deletions
+173
-35
Balance.vue
...mponents/pc/BlockChainBrowser/AddressOverview/Balance.vue
+1
-1
index.vue
...components/pc/BlockChainBrowser/AddressOverview/index.vue
+1
-1
address.ts
src/mixin/address.ts
+10
-8
block.ts
src/mixin/block.ts
+16
-13
blockChainBrowser.ts
src/mixin/blockChainBrowser.ts
+4
-1
blockDetail.ts
src/mixin/blockDetail.ts
+9
-6
AddressOverview.ts
src/mixin/componentsMixin/AddressOverview.ts
+0
-3
trade.ts
src/mixin/trade.ts
+3
-2
address.ts
src/types/address.ts
+22
-0
block.ts
src/types/block.ts
+44
-0
blockDetail.ts
src/types/blockDetail.ts
+33
-0
trade.ts
src/types/trade.ts
+30
-0
No files found.
src/components/pc/BlockChainBrowser/AddressOverview/Balance.vue
View file @
69d36303
...
...
@@ -31,7 +31,7 @@ export default VueTypedMixins().extend({
props
:
{
balance
:
[
Number
,
Object
],
selectedValue
:
String
,
frozen
:
Number
,
frozen
:
[
Number
,
Object
]
,
optionsList
:
Array
,
handleSelectChange
:
Function
,
},
...
...
src/components/pc/BlockChainBrowser/AddressOverview/index.vue
View file @
69d36303
...
...
@@ -88,7 +88,7 @@ export default VueTypedMixins(AddressOverview).extend({
props
:
{
balance
:
[
Number
,
Object
],
selectedValue
:
String
,
frozen
:
Number
,
frozen
:
[
Number
,
Object
]
,
optionsList
:
Array
,
handleSelectChange
:
Function
,
},
...
...
src/mixin/address.ts
View file @
69d36303
...
...
@@ -6,6 +6,8 @@ import {
getVoterAddr
,
getVoterAddrCount
,
}
from
"@/service/api"
;
import
{
iExecAccount
,
iPack
,
iVote
}
from
"@/types/address"
;
import
{
icustomized2Tx
,
iTx
}
from
"@/types/trade"
;
import
Rpc
from
"@/utils/Rpc"
;
import
Vue
from
"vue"
;
...
...
@@ -31,11 +33,11 @@ export default Vue.extend({
},
selectedOption
:
"1"
,
loadingTxRecordTable
:
false
,
txRecordList
:
[]
as
any
[],
voteList
:
[]
as
any
[],
txRecordList
:
[]
as
icustomized2Tx
[],
voteList
:
[]
as
iVote
[],
selectedExecer
:
""
,
execAccount
:
[]
as
any
[],
packList
:
[]
as
any
[],
execAccount
:
[]
as
iExecAccount
[],
packList
:
[]
as
iPack
[],
loadingVote
:
false
,
loadingPack
:
false
,
};
...
...
@@ -69,13 +71,13 @@ export default Vue.extend({
{
name
:
this
.
$t
(
"lang.trade.consensusNode"
),
value
:
"2"
},
];
},
execerOptionsList
():
any
{
execerOptionsList
():
{
name
:
string
;
value
:
string
}[]
{
return
this
.
execAccount
.
map
((
i
:
any
)
=>
({
name
:
i
.
execer
,
value
:
i
.
execer
,
}));
},
balance
():
any
{
balance
():
number
{
return
(
this
.
execAccount
.
find
((
i
:
any
)
=>
i
.
execer
===
this
.
selectedExecer
)
||
{
account
:
{
...
...
@@ -84,7 +86,7 @@ export default Vue.extend({
}
)?.
account
?.
balance
;
},
frozen
():
any
{
frozen
():
number
{
return
(
this
.
execAccount
.
find
((
i
:
any
)
=>
i
.
execer
===
this
.
selectedExecer
)
||
{
account
:
{
...
...
@@ -103,7 +105,7 @@ export default Vue.extend({
}
});
},
checkGroup
(
arr
:
any
[])
{
checkGroup
(
arr
:
icustomized2Tx
[])
{
arr
.
map
((
current
,
index
)
=>
{
if
(
current
.
group_count
>
1
)
{
current
.
tradeG
=
1
;
//0-非交易组,1-交易组,3-交易组末条, 2-交易组首条
...
...
src/mixin/block.ts
View file @
69d36303
...
...
@@ -2,6 +2,8 @@ import Vue from "vue";
import
{
message
}
from
"ant-design-vue"
;
import
{
getRpc
}
from
"ycc-api/dist/cmjs/service/Rpc"
;
const
Rpc
=
getRpc
(
"/yccApi"
);
import
{
iBlockInBlockMixin
,
iGetBlocksRetResultItem
}
from
"@/types/block"
;
export
default
Vue
.
extend
({
data
()
{
return
{
...
...
@@ -16,7 +18,7 @@ export default Vue.extend({
pageSize
:
20
,
total
:
10
,
},
Blocks
:
[]
as
any
[],
Blocks
:
[]
as
iBlockInBlockMixin
[],
};
},
mounted
()
{
...
...
@@ -38,8 +40,6 @@ export default Vue.extend({
}
else
{
this
.
Loading
=
false
;
message
.
warning
({
// title: this.$t('components.tip'),
// message: data.error,
content
:
data
.
error
as
string
,
});
}
...
...
@@ -75,23 +75,26 @@ export default Vue.extend({
Rpc
.
getBlocks
(
this
.
startHeight
,
this
.
endHeight
,
true
).
then
((
data
)
=>
{
if
(
data
.
error
===
null
)
{
const
info
=
data
.
result
.
items
.
reverse
().
map
((
i
:
any
)
=>
({
height
:
i
.
block
.
height
,
blockTime
:
i
.
block
.
blockTime
,
minerHash
:
i
.
block
.
txs
[
0
].
from
,
txCount
:
i
.
block
.
txs
.
length
,
}));
const
info
=
(
data
.
result
.
items
as
iGetBlocksRetResultItem
[])
.
reverse
()
.
map
((
i
)
=>
({
height
:
i
.
block
.
height
,
blockTime
:
i
.
block
.
blockTime
,
minerHash
:
i
.
block
.
txs
[
0
].
from
,
txCount
:
i
.
block
.
txs
.
length
,
}));
if
(
this
.
pages
.
currentPage
===
1
)
{
this
.
Blocks
=
[...
info
,
...
this
.
Blocks
];
this
.
Blocks
.
length
=
this
.
pages
.
pageSize
;
}
else
{
this
.
Blocks
=
info
;
}
info
.
map
((
i
:
any
)
=>
{
info
.
map
((
i
)
=>
{
Rpc
.
getBlockHash
(
i
.
height
).
then
((
ret
)
=>
{
(
this
.
Blocks
.
find
((
block
)
=>
block
.
height
===
i
.
height
)
||
{}
).
hash
=
ret
.
result
.
hash
;
const
the
=
this
.
Blocks
.
find
(
(
block
)
=>
block
.
height
===
i
.
height
);
the
&&
(
the
.
hash
=
ret
.
result
.
hash
);
this
.
Blocks
=
[...
this
.
Blocks
];
});
});
...
...
src/mixin/blockChainBrowser.ts
View file @
69d36303
...
...
@@ -12,6 +12,9 @@ import {
getTxCountBewteenTimes
,
getTxList
,
}
from
"@/service/api"
;
import
{
icustomizedTx
}
from
"@/types/trade"
;
export
default
Vue
.
extend
({
data
()
{
return
{
...
...
@@ -25,7 +28,7 @@ export default Vue.extend({
speed
:
0
,
tps
:
0
,
addressNumber
:
0
,
latestTxs
:
[],
latestTxs
:
[]
as
icustomizedTx
[]
,
ticketCount
:
0
,
timer
:
0
,
};
...
...
src/mixin/blockDetail.ts
View file @
69d36303
...
...
@@ -4,6 +4,10 @@ import { getBlockOverviewAndRelativeHeight } from "ycc-api/dist/cmjs/service/blo
import
{
message
}
from
"ant-design-vue"
;
import
{
tradeAccuracy
}
from
"@/utils/common"
;
import
{
getConsensusList
}
from
"@/utils/consensus"
;
import
{
iConsensusNodeTablListItem
,
iGetTxByHashesRetTxItem
,
}
from
"@/types/blockDetail"
;
const
Rpc
=
getRpc
(
"/yccApi"
);
export
default
Vue
.
extend
({
data
()
{
...
...
@@ -13,7 +17,7 @@ export default Vue.extend({
txRecordFilterValue
:
"allTx"
,
consensusNodeFilterValue
:
"allNode"
,
consensusNodeTableList
:
[]
as
any
[],
consensusNodeTableList
:
[]
as
iConsensusNodeTablListItem
[],
loadingConsensusNodeTable
:
false
,
overview
:
{
txCount
:
0
,
...
...
@@ -27,8 +31,8 @@ export default Vue.extend({
loadingOverview
:
false
,
loadingRelativeNumber
:
false
,
loadingTable
:
false
,
allTrades
:
[]
as
any
[],
txHashes
:
[],
allTrades
:
[]
as
iGetTxByHashesRetTxItem
[],
txHashes
:
[]
as
string
[]
,
pages
:
{
currentPage
:
1
,
pageSize
:
10
,
...
...
@@ -48,15 +52,14 @@ export default Vue.extend({
this
.
consensusNodeTableList
=
getConsensusList
(
data
.
result
.
txs
)
.
map
((
i
)
=>
{
return
{
height
:
this
.
$route
.
query
.
height
,
height
:
Number
(
this
.
$route
.
query
.
height
as
string
)
,
address
:
i
.
addr
,
reward
:
i
.
reward
,
time
:
data
.
result
.
txs
[
0
].
blockTime
,
type
:
i
.
type
,
};
})
.
sort
((
a
,
b
)
=>
(
a
.
type
===
"pack"
?
-
1
:
0
));
// this.searchIcon(data.result.txs);
.
sort
((
a
)
=>
(
a
.
type
===
"pack"
?
-
1
:
0
));
this
.
allTrades
=
this
.
checkGroup
(
data
.
result
.
txs
);
}
else
{
message
.
warning
(
this
.
$t
(
"components.tip"
)
+
data
.
error
);
...
...
src/mixin/componentsMixin/AddressOverview.ts
View file @
69d36303
...
...
@@ -20,9 +20,6 @@ export default Vue.extend({
}
});
},
activated
()
{
this
.
init
();
},
computed
:
{
tradeInTotalList
():
any
{
return
[
...
...
src/mixin/trade.ts
View file @
69d36303
import
{
getTxCount
,
getTxList
}
from
"@/service/api"
;
import
{
icustomized2Tx
}
from
"@/types/trade"
;
import
Vue
from
"vue"
;
export
default
Vue
.
extend
({
data
()
{
...
...
@@ -9,7 +10,7 @@ export default Vue.extend({
pageSize
:
20
,
total
:
10
,
},
txList
:
[]
as
any
[],
txList
:
[]
as
icustomized2Tx
[],
loading
:
false
,
Timer
:
0
,
};
...
...
@@ -18,7 +19,7 @@ export default Vue.extend({
this
.
init
();
},
methods
:
{
checkGroup
(
arr
:
any
[])
{
checkGroup
(
arr
:
icustomized2Tx
[])
{
arr
.
map
((
current
,
index
)
=>
{
if
(
current
.
group_count
>
1
)
{
current
.
tradeG
=
1
;
//0-非交易组,1-交易组,3-交易组末条, 2-交易组首条
...
...
src/types/address.ts
0 → 100644
View file @
69d36303
import
{
iTx
}
from
"./trade"
;
export
interface
iTxRecord
{
tradeG
:
number
;
}
export
interface
iVote
extends
iTx
{
sender
:
string
;
receiver
:
string
;
time
:
number
;
}
export
interface
iPack
extends
iTx
{
sender
:
string
;
receiver
:
string
;
time
:
number
;
}
export
interface
iExecAccount
{
account
:
{
addr
:
string
;
balance
:
number
;
currency
:
number
;
frozen
:
number
};
execer
:
string
;
}
src/types/block.ts
0 → 100644
View file @
69d36303
export
interface
iBlockInBlockMixin
{
height
:
number
;
blockTime
:
number
;
minerHash
:
string
;
txCount
:
number
;
hash
?:
string
;
}
export
interface
iGetBlocksRetResultItemBlockTx
{
chainID
:
number
;
execer
:
string
;
expire
:
number
;
fee
:
number
;
feefmt
:
string
;
from
:
string
;
hash
:
string
;
nonce
:
number
;
payload
:
any
;
rawPayload
:
string
;
signature
:
any
;
to
:
string
;
}
export
interface
iGetBlocksRetResultItemBlock
{
blockTime
:
number
;
difficulty
:
number
;
height
:
number
;
parentHash
:
string
;
stateHash
:
string
;
txHash
:
string
;
txs
:
iGetBlocksRetResultItemBlockTx
[];
version
:
number
;
}
export
interface
iGetBlocksRetResultItemRecipt
{
logs
:
any
[];
ty
:
number
;
tyName
:
string
;
}
export
interface
iGetBlocksRetResultItem
{
block
:
iGetBlocksRetResultItemBlock
;
recipts
:
iGetBlocksRetResultItemRecipt
[];
}
src/types/blockDetail.ts
0 → 100644
View file @
69d36303
import
{
iGetBlocksRetResultItemBlockTx
,
iGetBlocksRetResultItemRecipt
,
}
from
"./block"
;
export
interface
iConsensusNodeTablListItem
{
height
:
number
;
address
:
string
;
reward
:
number
;
time
:
number
;
type
:
"pack"
|
"vote"
;
}
export
interface
iGetTxByHashesRetTxItemTx
extends
iGetBlocksRetResultItemBlockTx
{
amount
:
number
;
amountfmt
:
string
;
}
export
interface
iGetTxByHashesRetTxItem
{
actionName
:
string
;
amount
:
number
;
assets
:
any
[];
blockTime
:
number
;
fromAddr
:
string
;
fullHash
:
string
;
height
:
number
;
index
:
number
;
proofs
:
any
;
receipt
:
iGetBlocksRetResultItemRecipt
;
tx
:
iGetTxByHashesRetTxItemTx
;
txProofs
:
any
;
}
src/types/trade.ts
View file @
69d36303
...
...
@@ -3,3 +3,33 @@ export interface iAsset {
exec
:
string
;
symbol
:
string
;
}
export
interface
iTx
{
action_name
:
string
;
amount
:
number
;
assets
:
any
[];
block_hash
:
string
;
block_time
:
number
;
execer
:
string
;
fee
:
number
;
from
:
string
;
group_count
:
number
;
hash
:
string
;
height
:
number
;
height_index
:
number
;
index
:
number
;
is_para
:
boolean
;
is_withdraw
:
boolean
;
next
:
string
;
options
:
any
;
success
:
boolean
;
to
:
string
;
}
export
interface
icustomizedTx
extends
iTx
{
time_block
:
string
;
}
export
interface
icustomized2Tx
extends
iTx
{
tradeG
:
number
;
}
chenqikuai
@chenqikuai
mentioned in commit
748f7ae1
·
Mar 03, 2022
mentioned in commit
748f7ae1
mentioned in commit 748f7ae18ac2f8eb14ee7c2865eaea786342a520
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment