@compound-finance/compound-js
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -227,3 +227,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var userAddress, comptrollerAddress, trxOptions, parameters, method, errorPrefix; | ||
var userAddress, comptrollerAddress, trxOptions, parameters, method, e_1, errorPrefix; | ||
return __generator(this, function (_a) { | ||
@@ -234,16 +234,23 @@ switch (_a.label) { | ||
_a.sent(); | ||
try { | ||
userAddress = this._provider.address; | ||
comptrollerAddress = constants_1.address[this._network.name].Comptroller; | ||
trxOptions = __assign(__assign({}, options), { _compoundProvider: this._provider, abi: constants_1.abi.Comptroller }); | ||
parameters = [userAddress]; | ||
method = 'claimComp(address)'; | ||
return [2 /*return*/, eth.trx(comptrollerAddress, method, parameters, trxOptions)]; | ||
} | ||
catch (e) { | ||
errorPrefix = 'Compound [claimComp] | '; | ||
e.message = errorPrefix + e.message; | ||
return [2 /*return*/, e]; | ||
} | ||
return [2 /*return*/]; | ||
_a.label = 2; | ||
case 2: | ||
_a.trys.push([2, 5, , 6]); | ||
userAddress = this._provider.address; | ||
if (!(!userAddress && this._provider.getAddress)) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, this._provider.getAddress()]; | ||
case 3: | ||
userAddress = _a.sent(); | ||
_a.label = 4; | ||
case 4: | ||
comptrollerAddress = constants_1.address[this._network.name].Comptroller; | ||
trxOptions = __assign(__assign({}, options), { _compoundProvider: this._provider, abi: constants_1.abi.Comptroller }); | ||
parameters = [userAddress]; | ||
method = 'claimComp(address)'; | ||
return [2 /*return*/, eth.trx(comptrollerAddress, method, parameters, trxOptions)]; | ||
case 5: | ||
e_1 = _a.sent(); | ||
errorPrefix = 'Compound [claimComp] | '; | ||
e_1.message = errorPrefix + e_1.message; | ||
return [2 /*return*/, e_1]; | ||
case 6: return [2 /*return*/]; | ||
} | ||
@@ -250,0 +257,0 @@ }); |
@@ -214,6 +214,3 @@ "use strict"; | ||
amount = ethers_1.ethers.BigNumber.from(amount.toString()); | ||
trxOptions = { | ||
_compoundProvider: this._provider, | ||
abi: cTokenName === constants_1.constants.cETH ? constants_1.abi.cEther : constants_1.abi.cErc20 | ||
}; | ||
trxOptions = __assign(__assign({}, options), { _compoundProvider: this._provider, abi: cTokenName === constants_1.constants.cETH ? constants_1.abi.cEther : constants_1.abi.cErc20 }); | ||
parameters = [amount]; | ||
@@ -220,0 +217,0 @@ method = assetIsCToken ? 'redeem' : 'redeemUnderlying'; |
{ | ||
"name": "@compound-finance/compound-js", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"author": "Compound Labs, Inc.", | ||
@@ -5,0 +5,0 @@ "description": "A JavaScript SDK for Ethereum and the Compound Protocol.", |
@@ -182,3 +182,8 @@ /** | ||
try { | ||
const userAddress = this._provider.address; | ||
let userAddress = this._provider.address; | ||
if (!userAddress && this._provider.getAddress) { | ||
userAddress = await this._provider.getAddress(); | ||
} | ||
const comptrollerAddress = address[this._network.name].Comptroller; | ||
@@ -185,0 +190,0 @@ const trxOptions: CallOptions = { |
@@ -192,2 +192,3 @@ /** | ||
const trxOptions: CallOptions = { | ||
...options, | ||
_compoundProvider: this._provider, | ||
@@ -194,0 +195,0 @@ abi: cTokenName === constants.cETH ? abi.cEther : abi.cErc20, |
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
1601393
13003