@@ -3039,15 +3039,21 @@ class Wallet extends EventEmitter {
3039
3039
/**
3040
3040
* Make a revoke MTX.
3041
3041
* @param {String } name
3042
+ * @param {String|Number } acct
3042
3043
* @returns {MTX }
3043
3044
*/
3044
3045
3045
- async makeRevoke ( name ) {
3046
+ async makeRevoke ( name , acct ) {
3046
3047
assert ( typeof name === 'string' ) ;
3047
3048
3048
3049
if ( ! rules . verifyName ( name ) )
3049
3050
throw new Error ( 'Invalid name.' ) ;
3050
3051
3052
+ if ( acct != null ) {
3053
+ assert ( ( acct >>> 0 ) === acct || typeof acct === 'string' ) ;
3054
+ acct = await this . getAccountIndex ( acct ) ;
3055
+ }
3056
+
3051
3057
const rawName = Buffer . from ( name , 'ascii' ) ;
3052
3058
const nameHash = rules . hashName ( rawName ) ;
3053
3059
const ns = await this . getNameState ( nameHash ) ;
@@ -3063,6 +3069,9 @@ class Wallet extends EventEmitter {
3063
3069
if ( ! coin )
3064
3070
throw new Error ( `Wallet does not own: "${ name } ".` ) ;
3065
3071
3072
+ if ( acct != null && ! await this . txdb . hasCoinByAccount ( acct , hash , index ) )
3073
+ throw new Error ( `Account does not own: "${ name } ".` ) ;
3074
+
3066
3075
// Is local?
3067
3076
if ( coin . height < ns . height )
3068
3077
throw new Error ( `Wallet does not own: "${ name } ".` ) ;
@@ -3106,7 +3115,8 @@ class Wallet extends EventEmitter {
3106
3115
*/
3107
3116
3108
3117
async _createRevoke ( name , options ) {
3109
- const mtx = await this . makeRevoke ( name ) ;
3118
+ const acct = options ? options . account : null ;
3119
+ const mtx = await this . makeRevoke ( name , acct ) ;
3110
3120
await this . fill ( mtx , options ) ;
3111
3121
return this . finalize ( mtx , options ) ;
3112
3122
}
@@ -3137,7 +3147,7 @@ class Wallet extends EventEmitter {
3137
3147
3138
3148
async _sendRevoke ( name , options ) {
3139
3149
const passphrase = options ? options . passphrase : null ;
3140
- const mtx = await this . _createRevoke ( name ) ;
3150
+ const mtx = await this . _createRevoke ( name , options ) ;
3141
3151
return this . sendMTX ( mtx , passphrase ) ;
3142
3152
}
3143
3153
0 commit comments