@xchainjs/xchain-thorchain 0.28.11 → 0.28.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.d.ts +5 -1
- package/lib/index.esm.js +241 -256
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +241 -256
- package/lib/index.js.map +1 -1
- package/package.json +6 -6
package/lib/client.d.ts
CHANGED
|
@@ -127,6 +127,10 @@ declare class Client extends BaseXChainClient implements ThorchainClient, XChain
|
|
|
127
127
|
* Throws an error if phrase has not been set before
|
|
128
128
|
**/
|
|
129
129
|
getPubKey(index?: number): cosmosclient.PubKey;
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated this function eventually will be removed use getAddressAsync instead
|
|
132
|
+
*/
|
|
133
|
+
getAddress(index?: number): string;
|
|
130
134
|
/**
|
|
131
135
|
* Get the current address.
|
|
132
136
|
*
|
|
@@ -134,7 +138,7 @@ declare class Client extends BaseXChainClient implements ThorchainClient, XChain
|
|
|
134
138
|
*
|
|
135
139
|
* @throws {Error} Thrown if phrase has not been set before. A phrase is needed to create a wallet and to derive an address from it.
|
|
136
140
|
*/
|
|
137
|
-
|
|
141
|
+
getAddressAsync(walletIndex?: number): Promise<Address>;
|
|
138
142
|
/**
|
|
139
143
|
* Validate the given address.
|
|
140
144
|
*
|
package/lib/index.esm.js
CHANGED
|
@@ -4354,215 +4354,200 @@ var indexMinimal = {};
|
|
|
4354
4354
|
|
|
4355
4355
|
var minimal$1 = {};
|
|
4356
4356
|
|
|
4357
|
-
var aspromise;
|
|
4358
|
-
var hasRequiredAspromise;
|
|
4359
|
-
|
|
4360
|
-
function requireAspromise () {
|
|
4361
|
-
if (hasRequiredAspromise) return aspromise;
|
|
4362
|
-
hasRequiredAspromise = 1;
|
|
4363
|
-
aspromise = asPromise;
|
|
4357
|
+
var aspromise = asPromise;
|
|
4364
4358
|
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4359
|
+
/**
|
|
4360
|
+
* Callback as used by {@link util.asPromise}.
|
|
4361
|
+
* @typedef asPromiseCallback
|
|
4362
|
+
* @type {function}
|
|
4363
|
+
* @param {Error|null} error Error, if any
|
|
4364
|
+
* @param {...*} params Additional arguments
|
|
4365
|
+
* @returns {undefined}
|
|
4366
|
+
*/
|
|
4373
4367
|
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
}
|
|
4414
|
-
return aspromise;
|
|
4368
|
+
/**
|
|
4369
|
+
* Returns a promise from a node-style callback function.
|
|
4370
|
+
* @memberof util
|
|
4371
|
+
* @param {asPromiseCallback} fn Function to call
|
|
4372
|
+
* @param {*} ctx Function context
|
|
4373
|
+
* @param {...*} params Function arguments
|
|
4374
|
+
* @returns {Promise<*>} Promisified function
|
|
4375
|
+
*/
|
|
4376
|
+
function asPromise(fn, ctx/*, varargs */) {
|
|
4377
|
+
var params = new Array(arguments.length - 1),
|
|
4378
|
+
offset = 0,
|
|
4379
|
+
index = 2,
|
|
4380
|
+
pending = true;
|
|
4381
|
+
while (index < arguments.length)
|
|
4382
|
+
params[offset++] = arguments[index++];
|
|
4383
|
+
return new Promise(function executor(resolve, reject) {
|
|
4384
|
+
params[offset] = function callback(err/*, varargs */) {
|
|
4385
|
+
if (pending) {
|
|
4386
|
+
pending = false;
|
|
4387
|
+
if (err)
|
|
4388
|
+
reject(err);
|
|
4389
|
+
else {
|
|
4390
|
+
var params = new Array(arguments.length - 1),
|
|
4391
|
+
offset = 0;
|
|
4392
|
+
while (offset < params.length)
|
|
4393
|
+
params[offset++] = arguments[offset];
|
|
4394
|
+
resolve.apply(null, params);
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
};
|
|
4398
|
+
try {
|
|
4399
|
+
fn.apply(ctx || null, params);
|
|
4400
|
+
} catch (err) {
|
|
4401
|
+
if (pending) {
|
|
4402
|
+
pending = false;
|
|
4403
|
+
reject(err);
|
|
4404
|
+
}
|
|
4405
|
+
}
|
|
4406
|
+
});
|
|
4415
4407
|
}
|
|
4416
4408
|
|
|
4417
4409
|
var base64$1 = {};
|
|
4418
4410
|
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
function requireBase64 () {
|
|
4422
|
-
if (hasRequiredBase64) return base64$1;
|
|
4423
|
-
hasRequiredBase64 = 1;
|
|
4424
|
-
(function (exports) {
|
|
4411
|
+
(function (exports) {
|
|
4425
4412
|
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4413
|
+
/**
|
|
4414
|
+
* A minimal base64 implementation for number arrays.
|
|
4415
|
+
* @memberof util
|
|
4416
|
+
* @namespace
|
|
4417
|
+
*/
|
|
4418
|
+
var base64 = exports;
|
|
4432
4419
|
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4420
|
+
/**
|
|
4421
|
+
* Calculates the byte length of a base64 encoded string.
|
|
4422
|
+
* @param {string} string Base64 encoded string
|
|
4423
|
+
* @returns {number} Byte length
|
|
4424
|
+
*/
|
|
4425
|
+
base64.length = function length(string) {
|
|
4426
|
+
var p = string.length;
|
|
4427
|
+
if (!p)
|
|
4428
|
+
return 0;
|
|
4429
|
+
var n = 0;
|
|
4430
|
+
while (--p % 4 > 1 && string.charAt(p) === "=")
|
|
4431
|
+
++n;
|
|
4432
|
+
return Math.ceil(string.length * 3) / 4 - n;
|
|
4433
|
+
};
|
|
4447
4434
|
|
|
4448
|
-
|
|
4449
|
-
|
|
4435
|
+
// Base64 encoding table
|
|
4436
|
+
var b64 = new Array(64);
|
|
4450
4437
|
|
|
4451
|
-
|
|
4452
|
-
|
|
4438
|
+
// Base64 decoding table
|
|
4439
|
+
var s64 = new Array(123);
|
|
4453
4440
|
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4441
|
+
// 65..90, 97..122, 48..57, 43, 47
|
|
4442
|
+
for (var i = 0; i < 64;)
|
|
4443
|
+
s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
|
|
4457
4444
|
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4445
|
+
/**
|
|
4446
|
+
* Encodes a buffer to a base64 encoded string.
|
|
4447
|
+
* @param {Uint8Array} buffer Source buffer
|
|
4448
|
+
* @param {number} start Source start
|
|
4449
|
+
* @param {number} end Source end
|
|
4450
|
+
* @returns {string} Base64 encoded string
|
|
4451
|
+
*/
|
|
4452
|
+
base64.encode = function encode(buffer, start, end) {
|
|
4453
|
+
var parts = null,
|
|
4454
|
+
chunk = [];
|
|
4455
|
+
var i = 0, // output index
|
|
4456
|
+
j = 0, // goto index
|
|
4457
|
+
t; // temporary
|
|
4458
|
+
while (start < end) {
|
|
4459
|
+
var b = buffer[start++];
|
|
4460
|
+
switch (j) {
|
|
4461
|
+
case 0:
|
|
4462
|
+
chunk[i++] = b64[b >> 2];
|
|
4463
|
+
t = (b & 3) << 4;
|
|
4464
|
+
j = 1;
|
|
4465
|
+
break;
|
|
4466
|
+
case 1:
|
|
4467
|
+
chunk[i++] = b64[t | b >> 4];
|
|
4468
|
+
t = (b & 15) << 2;
|
|
4469
|
+
j = 2;
|
|
4470
|
+
break;
|
|
4471
|
+
case 2:
|
|
4472
|
+
chunk[i++] = b64[t | b >> 6];
|
|
4473
|
+
chunk[i++] = b64[b & 63];
|
|
4474
|
+
j = 0;
|
|
4475
|
+
break;
|
|
4476
|
+
}
|
|
4477
|
+
if (i > 8191) {
|
|
4478
|
+
(parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
|
|
4479
|
+
i = 0;
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
4482
|
+
if (j) {
|
|
4483
|
+
chunk[i++] = b64[t];
|
|
4484
|
+
chunk[i++] = 61;
|
|
4485
|
+
if (j === 1)
|
|
4486
|
+
chunk[i++] = 61;
|
|
4487
|
+
}
|
|
4488
|
+
if (parts) {
|
|
4489
|
+
if (i)
|
|
4490
|
+
parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
|
|
4491
|
+
return parts.join("");
|
|
4492
|
+
}
|
|
4493
|
+
return String.fromCharCode.apply(String, chunk.slice(0, i));
|
|
4494
|
+
};
|
|
4508
4495
|
|
|
4509
|
-
|
|
4496
|
+
var invalidEncoding = "invalid encoding";
|
|
4510
4497
|
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4498
|
+
/**
|
|
4499
|
+
* Decodes a base64 encoded string to a buffer.
|
|
4500
|
+
* @param {string} string Source string
|
|
4501
|
+
* @param {Uint8Array} buffer Destination buffer
|
|
4502
|
+
* @param {number} offset Destination offset
|
|
4503
|
+
* @returns {number} Number of bytes written
|
|
4504
|
+
* @throws {Error} If encoding is invalid
|
|
4505
|
+
*/
|
|
4506
|
+
base64.decode = function decode(string, buffer, offset) {
|
|
4507
|
+
var start = offset;
|
|
4508
|
+
var j = 0, // goto index
|
|
4509
|
+
t; // temporary
|
|
4510
|
+
for (var i = 0; i < string.length;) {
|
|
4511
|
+
var c = string.charCodeAt(i++);
|
|
4512
|
+
if (c === 61 && j > 1)
|
|
4513
|
+
break;
|
|
4514
|
+
if ((c = s64[c]) === undefined)
|
|
4515
|
+
throw Error(invalidEncoding);
|
|
4516
|
+
switch (j) {
|
|
4517
|
+
case 0:
|
|
4518
|
+
t = c;
|
|
4519
|
+
j = 1;
|
|
4520
|
+
break;
|
|
4521
|
+
case 1:
|
|
4522
|
+
buffer[offset++] = t << 2 | (c & 48) >> 4;
|
|
4523
|
+
t = c;
|
|
4524
|
+
j = 2;
|
|
4525
|
+
break;
|
|
4526
|
+
case 2:
|
|
4527
|
+
buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
|
|
4528
|
+
t = c;
|
|
4529
|
+
j = 3;
|
|
4530
|
+
break;
|
|
4531
|
+
case 3:
|
|
4532
|
+
buffer[offset++] = (t & 3) << 6 | c;
|
|
4533
|
+
j = 0;
|
|
4534
|
+
break;
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
if (j === 1)
|
|
4538
|
+
throw Error(invalidEncoding);
|
|
4539
|
+
return offset - start;
|
|
4540
|
+
};
|
|
4554
4541
|
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
return base64$1;
|
|
4565
|
-
}
|
|
4542
|
+
/**
|
|
4543
|
+
* Tests if the specified string appears to be base64 encoded.
|
|
4544
|
+
* @param {string} string String to test
|
|
4545
|
+
* @returns {boolean} `true` if probably base64 encoded, otherwise false
|
|
4546
|
+
*/
|
|
4547
|
+
base64.test = function test(string) {
|
|
4548
|
+
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
|
|
4549
|
+
};
|
|
4550
|
+
} (base64$1));
|
|
4566
4551
|
|
|
4567
4552
|
var eventemitter;
|
|
4568
4553
|
var hasRequiredEventemitter;
|
|
@@ -5132,60 +5117,52 @@ function requireUtf8 () {
|
|
|
5132
5117
|
return utf8$2;
|
|
5133
5118
|
}
|
|
5134
5119
|
|
|
5135
|
-
var pool_1;
|
|
5136
|
-
var hasRequiredPool;
|
|
5137
|
-
|
|
5138
|
-
function requirePool () {
|
|
5139
|
-
if (hasRequiredPool) return pool_1;
|
|
5140
|
-
hasRequiredPool = 1;
|
|
5141
|
-
pool_1 = pool;
|
|
5120
|
+
var pool_1 = pool;
|
|
5142
5121
|
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5122
|
+
/**
|
|
5123
|
+
* An allocator as used by {@link util.pool}.
|
|
5124
|
+
* @typedef PoolAllocator
|
|
5125
|
+
* @type {function}
|
|
5126
|
+
* @param {number} size Buffer size
|
|
5127
|
+
* @returns {Uint8Array} Buffer
|
|
5128
|
+
*/
|
|
5150
5129
|
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5130
|
+
/**
|
|
5131
|
+
* A slicer as used by {@link util.pool}.
|
|
5132
|
+
* @typedef PoolSlicer
|
|
5133
|
+
* @type {function}
|
|
5134
|
+
* @param {number} start Start offset
|
|
5135
|
+
* @param {number} end End offset
|
|
5136
|
+
* @returns {Uint8Array} Buffer slice
|
|
5137
|
+
* @this {Uint8Array}
|
|
5138
|
+
*/
|
|
5160
5139
|
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
}
|
|
5188
|
-
return pool_1;
|
|
5140
|
+
/**
|
|
5141
|
+
* A general purpose buffer pool.
|
|
5142
|
+
* @memberof util
|
|
5143
|
+
* @function
|
|
5144
|
+
* @param {PoolAllocator} alloc Allocator
|
|
5145
|
+
* @param {PoolSlicer} slice Slicer
|
|
5146
|
+
* @param {number} [size=8192] Slab size
|
|
5147
|
+
* @returns {PoolAllocator} Pooled allocator
|
|
5148
|
+
*/
|
|
5149
|
+
function pool(alloc, slice, size) {
|
|
5150
|
+
var SIZE = size || 8192;
|
|
5151
|
+
var MAX = SIZE >>> 1;
|
|
5152
|
+
var slab = null;
|
|
5153
|
+
var offset = SIZE;
|
|
5154
|
+
return function pool_alloc(size) {
|
|
5155
|
+
if (size < 1 || size > MAX)
|
|
5156
|
+
return alloc(size);
|
|
5157
|
+
if (offset + size > SIZE) {
|
|
5158
|
+
slab = alloc(SIZE);
|
|
5159
|
+
offset = 0;
|
|
5160
|
+
}
|
|
5161
|
+
var buf = slice.call(slab, offset, offset += size);
|
|
5162
|
+
if (offset & 7) // align to 32 bit
|
|
5163
|
+
offset = (offset | 7) + 1;
|
|
5164
|
+
return buf;
|
|
5165
|
+
};
|
|
5189
5166
|
}
|
|
5190
5167
|
|
|
5191
5168
|
var longbits;
|
|
@@ -5405,10 +5382,10 @@ function requireMinimal () {
|
|
|
5405
5382
|
var util = exports;
|
|
5406
5383
|
|
|
5407
5384
|
// used to return a Promise where callback is omitted
|
|
5408
|
-
util.asPromise =
|
|
5385
|
+
util.asPromise = aspromise;
|
|
5409
5386
|
|
|
5410
5387
|
// converts to / from base64 encoded strings
|
|
5411
|
-
util.base64 =
|
|
5388
|
+
util.base64 = base64$1;
|
|
5412
5389
|
|
|
5413
5390
|
// base class of rpc.Service
|
|
5414
5391
|
util.EventEmitter = requireEventemitter();
|
|
@@ -5423,7 +5400,7 @@ function requireMinimal () {
|
|
|
5423
5400
|
util.utf8 = requireUtf8();
|
|
5424
5401
|
|
|
5425
5402
|
// provides a node-like buffer pool in the browser
|
|
5426
|
-
util.pool =
|
|
5403
|
+
util.pool = pool_1;
|
|
5427
5404
|
|
|
5428
5405
|
// utility to work with the low and high bits of a 64 bit value
|
|
5429
5406
|
util.LongBits = requireLongbits();
|
|
@@ -10156,7 +10133,7 @@ class Client extends BaseXChainClient {
|
|
|
10156
10133
|
const messageAction = undefined;
|
|
10157
10134
|
const offset = (params === null || params === void 0 ? void 0 : params.offset) || 0;
|
|
10158
10135
|
const limit = (params === null || params === void 0 ? void 0 : params.limit) || 10;
|
|
10159
|
-
const address = (params === null || params === void 0 ? void 0 : params.address) || this.
|
|
10136
|
+
const address = (params === null || params === void 0 ? void 0 : params.address) || (yield this.getAddressAsync());
|
|
10160
10137
|
const txMinHeight = undefined;
|
|
10161
10138
|
const txMaxHeight = undefined;
|
|
10162
10139
|
if (limit + offset > MAX_PAGES_PER_FUNCTION_CALL * MAX_TX_COUNT_PER_PAGE) {
|
|
@@ -10362,11 +10339,7 @@ class Client extends BaseXChainClient {
|
|
|
10362
10339
|
return privKey.pubKey();
|
|
10363
10340
|
}
|
|
10364
10341
|
/**
|
|
10365
|
-
*
|
|
10366
|
-
*
|
|
10367
|
-
* @returns {Address} The current address.
|
|
10368
|
-
*
|
|
10369
|
-
* @throws {Error} Thrown if phrase has not been set before. A phrase is needed to create a wallet and to derive an address from it.
|
|
10342
|
+
* @deprecated this function eventually will be removed use getAddressAsync instead
|
|
10370
10343
|
*/
|
|
10371
10344
|
getAddress(index = 0) {
|
|
10372
10345
|
const address = this.cosmosClient.getAddressFromMnemonic(this.phrase, this.getFullDerivationPath(index));
|
|
@@ -10375,6 +10348,18 @@ class Client extends BaseXChainClient {
|
|
|
10375
10348
|
}
|
|
10376
10349
|
return address;
|
|
10377
10350
|
}
|
|
10351
|
+
/**
|
|
10352
|
+
* Get the current address.
|
|
10353
|
+
*
|
|
10354
|
+
* @returns {Address} The current address.
|
|
10355
|
+
*
|
|
10356
|
+
* @throws {Error} Thrown if phrase has not been set before. A phrase is needed to create a wallet and to derive an address from it.
|
|
10357
|
+
*/
|
|
10358
|
+
getAddressAsync(walletIndex = 0) {
|
|
10359
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10360
|
+
return this.getAddress(walletIndex);
|
|
10361
|
+
});
|
|
10362
|
+
}
|
|
10378
10363
|
/**
|
|
10379
10364
|
* Validate the given address.
|
|
10380
10365
|
*
|
|
@@ -10658,7 +10643,7 @@ class Client extends BaseXChainClient {
|
|
|
10658
10643
|
}
|
|
10659
10644
|
const privKey = this.getPrivateKey(walletIndex);
|
|
10660
10645
|
const signerPubkey = privKey.pubKey();
|
|
10661
|
-
const fromAddress = this.
|
|
10646
|
+
const fromAddress = yield this.getAddressAsync(walletIndex);
|
|
10662
10647
|
const fromAddressAcc = cosmosclient.AccAddress.fromString(fromAddress);
|
|
10663
10648
|
const depositTxBody = yield buildDepositTx({
|
|
10664
10649
|
msgNativeTx: {
|
|
@@ -10773,7 +10758,7 @@ class Client extends BaseXChainClient {
|
|
|
10773
10758
|
}
|
|
10774
10759
|
}
|
|
10775
10760
|
const txBody = yield buildTransferTx({
|
|
10776
|
-
fromAddress: this.
|
|
10761
|
+
fromAddress: yield this.getAddressAsync(walletIndex),
|
|
10777
10762
|
toAddress: recipient,
|
|
10778
10763
|
memo,
|
|
10779
10764
|
assetAmount: amount,
|