This repository was archived by the owner on Jun 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
framework-plugins/lisk-framework-chain-connector-plugin/src Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ import {
73
73
chainAccountDataJSONToObj ,
74
74
channelDataJSONToObj ,
75
75
getMainchainID ,
76
+ getTokenIDLSK ,
76
77
proveResponseJSONToObj ,
77
78
} from './utils' ;
78
79
@@ -171,8 +172,11 @@ export class ChainConnectorPlugin extends BasePlugin<ChainConnectorPluginConfig>
171
172
const userBalance = await this . _receivingChainClient . invoke < { exists : boolean } > (
172
173
'token_hasUserAccount' ,
173
174
{
174
- address : address . getLisk32AddressFromAddress ( tx . senderPublicKey as Buffer ) ,
175
- tokenID : `${ this . _receivingChainID . toString ( 'hex' ) } 00000000` ,
175
+ address : address . getLisk32AddressFromAddress (
176
+ address . getAddressFromPublicKey ( tx . senderPublicKey as Buffer ) ,
177
+ ) ,
178
+ // It is always LSK token
179
+ tokenID : `${ getTokenIDLSK ( this . _receivingChainID ) . toString ( 'hex' ) } ` ,
176
180
} ,
177
181
) ;
178
182
Original file line number Diff line number Diff line change @@ -50,6 +50,12 @@ export const getMainchainID = (chainID: Buffer): Buffer => {
50
50
return Buffer . concat ( [ networkID , Buffer . alloc ( CHAIN_ID_LENGTH - 1 , 0 ) ] ) ;
51
51
} ;
52
52
53
+ export const getTokenIDLSK = ( chainID : Buffer ) : Buffer => {
54
+ const networkID = chainID . slice ( 0 , 1 ) ;
55
+ // 3 bytes for remaining chainID bytes
56
+ return Buffer . concat ( [ networkID , Buffer . alloc ( 7 , 0 ) ] ) ;
57
+ } ;
58
+
53
59
export const aggregateCommitToJSON = ( aggregateCommit : AggregateCommit ) => ( {
54
60
height : aggregateCommit . height ,
55
61
aggregationBits : aggregateCommit . aggregationBits . toString ( 'hex' ) ,
You can’t perform that action at this time.
0 commit comments