@@ -39,7 +39,7 @@ const DEFAULT_NETWORK_ID = `ae_mainnet`
3939 * @return {String } Signed transaction
4040 */
4141async function signTransaction ( tx ) {
42- const networkId = this . networkId || this . nodeNetworkId || DEFAULT_NETWORK_ID
42+ const networkId = this . getNetworkId ( )
4343 const rlpBinaryTx = Crypto . decodeBase64Check ( Crypto . assertedType ( tx , 'tx' ) )
4444 // Prepend `NETWORK_ID` to begin of data binary
4545 const txWithNetworkId = Buffer . concat ( [ Buffer . from ( networkId ) , rlpBinaryTx ] )
@@ -48,6 +48,17 @@ async function signTransaction (tx) {
4848 return buildTx ( { encodedTx : rlpBinaryTx , signatures } , TX_TYPE . signed ) . tx
4949}
5050
51+ /**
52+ * Obtain networkId for signing
53+ * @instance
54+ * @category async
55+ * @rtype () => networkId: String
56+ * @return {String } NetworkId
57+ */
58+ function getNetworkId ( ) {
59+ return this . networkId || this . nodeNetworkId || DEFAULT_NETWORK_ID
60+ }
61+
5162/**
5263 * Basic Account Stamp
5364 *
@@ -70,10 +81,10 @@ const Account = stampit({
7081 this . networkId = networkId
7182 }
7283 } ,
73- methods : { signTransaction } ,
84+ methods : { signTransaction, getNetworkId } ,
7485 deepConf : {
7586 Ae : {
76- methods : [ 'sign' , 'address' , 'signTransaction' ]
87+ methods : [ 'sign' , 'address' , 'signTransaction' , 'getNetworkId' ]
7788 }
7889 }
7990} , required ( { methods : {
0 commit comments