@terra-money/terra.js
Advanced tools
Comparing version 3.0.6 to 3.0.7
@@ -217,3 +217,3 @@ import { BaseAPI } from './BaseAPI'; | ||
* | ||
* Broadcast the transaction using the "sync" mode, returning after DeliverTx() is performed. | ||
* Broadcast the transaction using the "sync" mode, returning after CheckTx() is performed. | ||
* @param tx transaction to broadcast | ||
@@ -223,3 +223,3 @@ */ | ||
/** | ||
* Broadcast the transaction using the "async" mode, returning after CheckTx() is performed. | ||
* Broadcast the transaction using the "async" mode, returns immediately (transaction might fail). | ||
* @param tx transaction to broadcast | ||
@@ -226,0 +226,0 @@ */ |
@@ -340,3 +340,3 @@ "use strict"; | ||
* | ||
* Broadcast the transaction using the "sync" mode, returning after DeliverTx() is performed. | ||
* Broadcast the transaction using the "sync" mode, returning after CheckTx() is performed. | ||
* @param tx transaction to broadcast | ||
@@ -366,3 +366,3 @@ */ | ||
/** | ||
* Broadcast the transaction using the "async" mode, returning after CheckTx() is performed. | ||
* Broadcast the transaction using the "async" mode, returns immediately (transaction might fail). | ||
* @param tx transaction to broadcast | ||
@@ -369,0 +369,0 @@ */ |
@@ -10,4 +10,4 @@ import { JSONSerializable } from '../../../util/json'; | ||
export declare class BasicAllowance extends JSONSerializable<BasicAllowance.Amino, BasicAllowance.Data, BasicAllowance.Proto> { | ||
expiration: Date; | ||
spend_limit: Coins; | ||
expiration?: Date | undefined; | ||
spend_limit?: Coins; | ||
/** | ||
@@ -17,3 +17,3 @@ * @param spend_limit spend_limit allowed to be spent as fee | ||
*/ | ||
constructor(spend_limit: Coins.Input, expiration: Date); | ||
constructor(spend_limit?: Coins.Input, expiration?: Date | undefined); | ||
static fromAmino(data: BasicAllowance.Amino): BasicAllowance; | ||
@@ -32,4 +32,4 @@ toAmino(): BasicAllowance.Amino; | ||
value: { | ||
spend_limit: Coins.Amino; | ||
expiration: string; | ||
spend_limit?: Coins.Amino; | ||
expiration?: string; | ||
}; | ||
@@ -39,6 +39,6 @@ } | ||
'@type': '/cosmos.feegrant.v1beta1.BasicAllowance'; | ||
spend_limit: Coins.Data; | ||
expiration: string; | ||
spend_limit?: Coins.Data; | ||
expiration?: string; | ||
} | ||
type Proto = BasicAllowance_pb; | ||
} |
@@ -36,3 +36,14 @@ "use strict"; | ||
_this.expiration = expiration; | ||
_this.spend_limit = new Coins_1.Coins(spend_limit); | ||
var isZeroCoins = true; | ||
if (spend_limit) { | ||
_this.spend_limit = new Coins_1.Coins(spend_limit); | ||
_this.spend_limit.map(function (c) { | ||
if (!c.amount.isZero()) { | ||
isZeroCoins = false; | ||
} | ||
}); | ||
} | ||
if (isZeroCoins && expiration == undefined) { | ||
throw Error('cannot set both of spend_limit and expiration empty'); | ||
} | ||
return _this; | ||
@@ -42,3 +53,4 @@ } | ||
var _a = data.value, spend_limit = _a.spend_limit, expiration = _a.expiration; | ||
return new BasicAllowance(Coins_1.Coins.fromAmino(spend_limit), new Date(expiration)); | ||
return new BasicAllowance(spend_limit ? Coins_1.Coins.fromAmino(spend_limit) : undefined, expiration ? new Date(expiration) : undefined); | ||
new BasicAllowance(''); | ||
}; | ||
@@ -50,4 +62,4 @@ BasicAllowance.prototype.toAmino = function () { | ||
value: { | ||
spend_limit: spend_limit.toAmino(), | ||
expiration: expiration.toISOString().replace(/\.000Z$/, 'Z'), | ||
spend_limit: (spend_limit === null || spend_limit === void 0 ? void 0 : spend_limit.toAmino()) || undefined, | ||
expiration: (expiration === null || expiration === void 0 ? void 0 : expiration.toISOString().replace(/\.000Z$/, 'Z')) || undefined, | ||
}, | ||
@@ -58,3 +70,3 @@ }; | ||
var spend_limit = proto.spend_limit, expiration = proto.expiration; | ||
return new BasicAllowance(Coins_1.Coins.fromData(spend_limit), new Date(expiration)); | ||
return new BasicAllowance(spend_limit ? Coins_1.Coins.fromData(spend_limit) : undefined, expiration ? new Date(expiration) : undefined); | ||
}; | ||
@@ -65,8 +77,8 @@ BasicAllowance.prototype.toData = function () { | ||
'@type': '/cosmos.feegrant.v1beta1.BasicAllowance', | ||
spend_limit: spend_limit.toData(), | ||
expiration: expiration.toISOString().replace(/\.000Z$/, 'Z'), | ||
spend_limit: (spend_limit === null || spend_limit === void 0 ? void 0 : spend_limit.toData()) || undefined, | ||
expiration: (expiration === null || expiration === void 0 ? void 0 : expiration.toISOString().replace(/\.000Z$/, 'Z')) || undefined, | ||
}; | ||
}; | ||
BasicAllowance.fromProto = function (proto) { | ||
return new BasicAllowance(Coins_1.Coins.fromProto(proto.spendLimit), proto.expiration); | ||
return new BasicAllowance(Coins_1.Coins.fromProto(proto.spendLimit), proto.expiration ? proto.expiration : undefined); | ||
}; | ||
@@ -77,3 +89,3 @@ BasicAllowance.prototype.toProto = function () { | ||
expiration: expiration, | ||
spendLimit: spend_limit.toProto(), | ||
spendLimit: (spend_limit === null || spend_limit === void 0 ? void 0 : spend_limit.toProto()) || undefined, | ||
}); | ||
@@ -80,0 +92,0 @@ }; |
@@ -72,3 +72,3 @@ "use strict"; | ||
sender: sender, | ||
admin: admin || '', | ||
admin: admin, | ||
code_id: code_id.toFixed(), | ||
@@ -75,0 +75,0 @@ init_msg: (0, json_1.removeNull)(init_msg), |
{ | ||
"name": "@terra-money/terra.js", | ||
"version": "3.0.6", | ||
"version": "3.0.7", | ||
"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
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
13353711
35420