@terra-money/terra.js
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -70,2 +70,3 @@ import { BaseAPI } from './BaseAPI'; | ||
sequence?: number; | ||
timeout_height?: number; | ||
} | ||
@@ -72,0 +73,0 @@ export declare namespace AsyncTxBroadcastResult { |
@@ -106,3 +106,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var fee, memo, msgs, accountNumber, sequence, account; | ||
var fee, memo, msgs, account; | ||
return __generator(this, function (_a) { | ||
@@ -114,22 +114,20 @@ switch (_a.label) { | ||
memo = memo || ''; | ||
if (!(fee === undefined)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.lcd.tx.estimateFee(sourceAddress, msgs, options)]; | ||
if (!(!options.account_number || !options.sequence)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.lcd.auth.accountInfo(sourceAddress)]; | ||
case 1: | ||
fee = _a.sent(); | ||
account = _a.sent(); | ||
if (!options.account_number) { | ||
options.account_number = account.account_number; | ||
} | ||
if (!options.sequence) { | ||
options.sequence = account.sequence; | ||
} | ||
_a.label = 2; | ||
case 2: | ||
accountNumber = options.account_number; | ||
sequence = options.sequence; | ||
if (!(!accountNumber || !sequence)) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, this.lcd.auth.accountInfo(sourceAddress)]; | ||
if (!(fee === undefined)) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, this.lcd.tx.estimateFee(sourceAddress, msgs, options)]; | ||
case 3: | ||
account = _a.sent(); | ||
if (!accountNumber) { | ||
accountNumber = account.account_number; | ||
} | ||
if (!sequence) { | ||
sequence = account.sequence; | ||
} | ||
fee = _a.sent(); | ||
_a.label = 4; | ||
case 4: return [2 /*return*/, new core_1.StdSignMsg(this.lcd.config.chainID, accountNumber, sequence, fee, msgs, memo)]; | ||
case 4: return [2 /*return*/, new core_1.StdSignMsg(this.lcd.config.chainID, options.account_number, options.sequence, fee, msgs, memo, options.timeout_height)]; | ||
} | ||
@@ -136,0 +134,0 @@ }); |
@@ -41,3 +41,3 @@ "use strict"; | ||
var proposal_id = data.proposal_id, voter = data.voter, options = data.options, option = data.option; | ||
return new Vote(parseInt(proposal_id), voter, options.map(function (_a) { | ||
return new Vote(Number.parseInt(proposal_id), voter, options.map(function (_a) { | ||
var option = _a.option, weight = _a.weight; | ||
@@ -44,0 +44,0 @@ return ({ |
@@ -18,2 +18,3 @@ import { StdFee } from './StdFee'; | ||
memo: string; | ||
timeout_height: number; | ||
/** | ||
@@ -29,3 +30,3 @@ * | ||
*/ | ||
constructor(chain_id: string, account_number: number, sequence: number, fee: StdFee, msgs: Msg[], memo?: string); | ||
constructor(chain_id: string, account_number: number, sequence: number, fee: StdFee, msgs: Msg[], memo?: string, timeout_height?: number); | ||
toData(): StdSignMsg.Data; | ||
@@ -46,3 +47,4 @@ static fromData(data: StdSignMsg.Data): StdSignMsg; | ||
memo: string; | ||
timeout_height?: string; | ||
} | ||
} |
@@ -41,4 +41,5 @@ "use strict"; | ||
*/ | ||
function StdSignMsg(chain_id, account_number, sequence, fee, msgs, memo) { | ||
function StdSignMsg(chain_id, account_number, sequence, fee, msgs, memo, timeout_height) { | ||
if (memo === void 0) { memo = ''; } | ||
if (timeout_height === void 0) { timeout_height = 0; } | ||
var _this = _super.call(this) || this; | ||
@@ -51,6 +52,7 @@ _this.chain_id = chain_id; | ||
_this.memo = memo; | ||
_this.timeout_height = timeout_height; | ||
return _this; | ||
} | ||
StdSignMsg.prototype.toData = function () { | ||
var _a = this, chain_id = _a.chain_id, account_number = _a.account_number, sequence = _a.sequence, fee = _a.fee, msgs = _a.msgs, memo = _a.memo; | ||
var _a = this, chain_id = _a.chain_id, account_number = _a.account_number, sequence = _a.sequence, fee = _a.fee, msgs = _a.msgs, memo = _a.memo, timeout_height = _a.timeout_height; | ||
return { | ||
@@ -63,7 +65,8 @@ chain_id: chain_id, | ||
memo: memo, | ||
timeout_height: timeout_height !== 0 ? timeout_height.toFixed() : undefined, | ||
}; | ||
}; | ||
StdSignMsg.fromData = function (data) { | ||
var chain_id = data.chain_id, account_number = data.account_number, sequence = data.sequence, fee = data.fee, msgs = data.msgs, memo = data.memo; | ||
return new StdSignMsg(chain_id, Number.parseInt(account_number) || 0, Number.parseInt(sequence) || 0, StdFee_1.StdFee.fromData(fee), msgs.map(function (m) { return Msg_1.Msg.fromData(m); }), memo); | ||
var chain_id = data.chain_id, account_number = data.account_number, sequence = data.sequence, fee = data.fee, msgs = data.msgs, memo = data.memo, timeout_height = data.timeout_height; | ||
return new StdSignMsg(chain_id, Number.parseInt(account_number) || 0, Number.parseInt(sequence) || 0, StdFee_1.StdFee.fromData(fee), msgs.map(function (m) { return Msg_1.Msg.fromData(m); }), memo, Number.parseInt(timeout_height !== null && timeout_height !== void 0 ? timeout_height : '0')); | ||
}; | ||
@@ -74,4 +77,4 @@ /** | ||
StdSignMsg.prototype.toStdTx = function () { | ||
var _a = this, fee = _a.fee, msgs = _a.msgs, memo = _a.memo; | ||
return new StdTx_1.StdTx(msgs, fee, [], memo); | ||
var _a = this, fee = _a.fee, msgs = _a.msgs, memo = _a.memo, timeout_height = _a.timeout_height; | ||
return new StdTx_1.StdTx(msgs, fee, [], memo, timeout_height); | ||
}; | ||
@@ -78,0 +81,0 @@ return StdSignMsg; |
@@ -14,2 +14,3 @@ import { StdSignature } from './StdSignature'; | ||
memo: string; | ||
timeout_height: number; | ||
/** | ||
@@ -20,4 +21,5 @@ * @param msg list of messages to include (not a typo) | ||
* @param memo optional note | ||
* @param timeout_height optional tx timeout | ||
*/ | ||
constructor(msg: Msg[], fee: StdFee, signatures: StdSignature[], memo?: string); | ||
constructor(msg: Msg[], fee: StdFee, signatures: StdSignature[], memo?: string, timeout_height?: number); | ||
static fromData(data: StdTx.Data): StdTx; | ||
@@ -34,4 +36,5 @@ toData(): StdTx.Data; | ||
memo: string; | ||
timeout_height: string; | ||
}; | ||
} | ||
} |
@@ -34,5 +34,7 @@ "use strict"; | ||
* @param memo optional note | ||
* @param timeout_height optional tx timeout | ||
*/ | ||
function StdTx(msg, fee, signatures, memo) { | ||
function StdTx(msg, fee, signatures, memo, timeout_height) { | ||
if (memo === void 0) { memo = ''; } | ||
if (timeout_height === void 0) { timeout_height = 0; } | ||
var _this = _super.call(this) || this; | ||
@@ -43,10 +45,11 @@ _this.msg = msg; | ||
_this.memo = memo; | ||
_this.timeout_height = timeout_height; | ||
return _this; | ||
} | ||
StdTx.fromData = function (data) { | ||
var _a = data.value, msg = _a.msg, fee = _a.fee, signatures = _a.signatures, memo = _a.memo; | ||
return new StdTx(msg.map(function (m) { return Msg_1.Msg.fromData(m); }), StdFee_1.StdFee.fromData(fee), signatures.map(function (s) { return StdSignature_1.StdSignature.fromData(s); }), memo); | ||
var _a = data.value, msg = _a.msg, fee = _a.fee, signatures = _a.signatures, memo = _a.memo, timeout_height = _a.timeout_height; | ||
return new StdTx(msg.map(function (m) { return Msg_1.Msg.fromData(m); }), StdFee_1.StdFee.fromData(fee), signatures.map(function (s) { return StdSignature_1.StdSignature.fromData(s); }), memo, Number.parseInt(timeout_height)); | ||
}; | ||
StdTx.prototype.toData = function () { | ||
var _a = this, msg = _a.msg, fee = _a.fee, signatures = _a.signatures, memo = _a.memo; | ||
var _a = this, msg = _a.msg, fee = _a.fee, signatures = _a.signatures, memo = _a.memo, timeout_height = _a.timeout_height; | ||
return { | ||
@@ -59,2 +62,3 @@ type: 'core/StdTx', | ||
memo: memo, | ||
timeout_height: timeout_height.toFixed(), | ||
}, | ||
@@ -61,0 +65,0 @@ }; |
@@ -185,3 +185,3 @@ "use strict"; | ||
sig = _a.sent(); | ||
return [2 /*return*/, new StdTx_1.StdTx(tx.msgs, tx.fee, [sig], tx.memo)]; | ||
return [2 /*return*/, new StdTx_1.StdTx(tx.msgs, tx.fee, [sig], tx.memo, tx.timeout_height)]; | ||
} | ||
@@ -188,0 +188,0 @@ }); |
{ | ||
"name": "@terra-money/terra.js", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "The JavaScript SDK for Terra", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5538765
23285