@@ -101,34 +101,34 @@ export class Payment {
101101 * @param options.feePayer Either `sender` or `receiver`. Specifies who pays network fees.
102102 * @param options.extraData Extra data that will appear in the Transfer event when successful.
103103 * @param options.paymentRequestId Payment request identifier that gets encoded to the extra data.
104- * @param options.addMessageId Whether a message id should be added to the payment, default to true.
104+ * @param options.addTransferId Whether a transfer id should be added to the payment, default to true.
105105 */
106106 public async prepare (
107107 networkAddress : string ,
108108 receiverAddress : string ,
109109 value : number | string ,
110- options : PaymentOptions = { addMessageId : true }
110+ options : PaymentOptions = { addTransferId : true }
111111 ) : Promise < PaymentTxObject > {
112112 const {
113113 gasPrice,
114114 gasLimit,
115115 networkDecimals,
116116 extraData,
117117 paymentRequestId,
118- addMessageId
118+ addTransferId
119119 } = options
120120 const decimals = await this . currencyNetwork . getDecimals ( networkAddress , {
121121 networkDecimals
122122 } )
123- let messageId : string
124- if ( addMessageId ) {
123+ let transferId : string
124+ if ( addTransferId ) {
125125 // 19 decimals fit in 64 bits
126- messageId = utils . convertToHexString ( utils . generateRandomNumber ( 19 ) )
126+ transferId = utils . convertToHexString ( utils . generateRandomNumber ( 19 ) )
127127 }
128128 const encodedExtraData : string = encode ( {
129129 extraData,
130130 paymentRequestId,
131- messageId
131+ transferId
132132 } )
133133
134134 const { path, maxFees, feePayer } = await this . getTransferPathInfo (
@@ -174,7 +174,7 @@ export class Payment {
174174 path,
175175 receiverAddress,
176176 rawTx,
177- messageId : messageId || null
177+ transferId : transferId || null
178178 }
179179 } else {
180180 throw new Error ( 'Could not find a path with enough capacity.' )
@@ -293,28 +293,28 @@ export class Payment {
293293
294294 /**
295295 * Signs the rawTx provided as returned by `prepare`
296- * and sends the signed transaction as well as the message with messageId
296+ * and sends the signed transaction as well as the message with transferId
297297 * Can be directly given a `PaymentTxObject` object as returned by `prepare`
298298 * @param rawTx Raw transaction object.
299299 * @param receiverAddress Address of the receiver of the message for the payment.
300- * @param messageId The messageId returned when preparing a payment with message.
300+ * @param transferId The transfer id returned when preparing a payment with message.
301301 * @param message The message to be sent.
302302 */
303303 public async confirmPayment (
304304 {
305305 rawTx,
306306 receiverAddress,
307- messageId
308- } : { rawTx : RawTxObject ; receiverAddress : string ; messageId ?: string } ,
307+ transferId
308+ } : { rawTx : RawTxObject ; receiverAddress : string ; transferId ?: string } ,
309309 message ?: string
310310 ) {
311311 if ( message ) {
312- if ( ! messageId ) {
312+ if ( ! transferId ) {
313313 throw new Error (
314- 'Cannot use `message` if payment was prepared without `messageId `.'
314+ 'Cannot use `message` if payment was prepared without `transferId `.'
315315 )
316316 }
317- await this . messaging . paymentMessage ( receiverAddress , messageId , message )
317+ await this . messaging . paymentMessage ( receiverAddress , transferId , message )
318318 }
319319 return this . transaction . confirm ( rawTx )
320320 }
@@ -513,21 +513,21 @@ export class Payment {
513513function encode ( {
514514 extraData,
515515 paymentRequestId,
516- messageId
516+ transferId
517517} : {
518518 extraData : string
519519 paymentRequestId : string
520- messageId ?: string
520+ transferId ?: string
521521} ) {
522- if ( extraData && ( paymentRequestId || messageId ) ) {
522+ if ( extraData && ( paymentRequestId || transferId ) ) {
523523 throw Error (
524- 'Can not encode extraData and paymentRequestId or messageId at the same time currently'
524+ 'Can not encode extraData and paymentRequestId or transferId at the same time currently'
525525 )
526526 }
527527 if ( extraData ) {
528528 return extraData
529- } else if ( paymentRequestId || messageId ) {
530- return encodeExtraData ( { paymentRequestId, messageId } )
529+ } else if ( paymentRequestId || transferId ) {
530+ return encodeExtraData ( { paymentRequestId, transferId } )
531531 } else {
532532 return '0x'
533533 }
0 commit comments