@audius/sdk 0.0.33 → 0.0.34
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/dist/api/Rewards.d.ts +11 -0
- package/dist/index.cjs.js +68 -52
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +68 -52
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +68 -52
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +62 -48
- package/dist/native-libs.js.map +1 -1
- package/dist/services/solana/rewardsAttester.d.ts +1 -0
- package/package.json +3 -3
- package/src/api/Rewards.ts +39 -12
- package/src/services/solana/rewardsAttester.ts +3 -1
package/dist/legacy.js
CHANGED
|
@@ -32917,9 +32917,9 @@ var formatProviders = function formatProviders(providers) {
|
|
|
32917
32917
|
};
|
|
32918
32918
|
|
|
32919
32919
|
var name = "@audius/sdk";
|
|
32920
|
-
var version = "0.0.
|
|
32920
|
+
var version = "0.0.34";
|
|
32921
32921
|
var audius = {
|
|
32922
|
-
releaseSHA: "
|
|
32922
|
+
releaseSHA: "c38a6a8f425386cc254501ac0b0d01235b44d36f"
|
|
32923
32923
|
};
|
|
32924
32924
|
var description = "";
|
|
32925
32925
|
var main = "dist/index.cjs.js";
|
|
@@ -32961,7 +32961,7 @@ var dependencies = {
|
|
|
32961
32961
|
"@ethersproject/solidity": "5.0.5",
|
|
32962
32962
|
"@improbable-eng/grpc-web-node-http-transport": "0.15.0",
|
|
32963
32963
|
"@project-serum/anchor": "0.24.1",
|
|
32964
|
-
"@solana/spl-token": "0.1.
|
|
32964
|
+
"@solana/spl-token": "0.1.8",
|
|
32965
32965
|
"@solana/web3.js": "1.37.1",
|
|
32966
32966
|
"abi-decoder": "2.4.0",
|
|
32967
32967
|
ajv: "6.12.2",
|
|
@@ -36595,7 +36595,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36595
36595
|
key: "submitAndEvaluate",
|
|
36596
36596
|
value: function () {
|
|
36597
36597
|
var _submitAndEvaluate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
|
|
36598
|
-
var challengeId, encodedUserId, handle, recipientEthAddress, specifier, oracleEthAddress, amount, quorumSize, AAOEndpoint, instructionsPerTransaction, _ref$maxAggregationAt, maxAggregationAttempts, _ref$endpoints, endpoints, _ref$logger, logger, _ref$feePayerOverride, feePayerOverride, phase, nodesToReselect, _yield$this$aggregate, discoveryNodeAttestations, aaoAttestation, aggregateError, erroringNodes, fullTokenAmount, _yield$this$solanaWeb, submitErrorCode, submitError, shouldRetryInSeperateTransactions, _yield$this$solanaWeb2, evaluateErrorCode, evaluateError, err, log;
|
|
36598
|
+
var challengeId, encodedUserId, handle, recipientEthAddress, specifier, oracleEthAddress, amount, quorumSize, AAOEndpoint, instructionsPerTransaction, _ref$maxAggregationAt, maxAggregationAttempts, _ref$endpoints, endpoints, _ref$logger, logger, _ref$feePayerOverride, feePayerOverride, phase, nodesToReselect, aaoErrorCode, _yield$this$aggregate, discoveryNodeAttestations, aaoAttestation, aggregateError, errorCode, erroringNodes, fullTokenAmount, _yield$this$solanaWeb, submitErrorCode, submitError, shouldRetryInSeperateTransactions, _yield$this$solanaWeb2, evaluateErrorCode, evaluateError, err, log;
|
|
36599
36599
|
|
|
36600
36600
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36601
36601
|
while (1) {
|
|
@@ -36603,21 +36603,22 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36603
36603
|
case 0:
|
|
36604
36604
|
challengeId = _ref.challengeId, encodedUserId = _ref.encodedUserId, handle = _ref.handle, recipientEthAddress = _ref.recipientEthAddress, specifier = _ref.specifier, oracleEthAddress = _ref.oracleEthAddress, amount = _ref.amount, quorumSize = _ref.quorumSize, AAOEndpoint = _ref.AAOEndpoint, instructionsPerTransaction = _ref.instructionsPerTransaction, _ref$maxAggregationAt = _ref.maxAggregationAttempts, maxAggregationAttempts = _ref$maxAggregationAt === void 0 ? 20 : _ref$maxAggregationAt, _ref$endpoints = _ref.endpoints, endpoints = _ref$endpoints === void 0 ? null : _ref$endpoints, _ref$logger = _ref.logger, logger = _ref$logger === void 0 ? console : _ref$logger, _ref$feePayerOverride = _ref.feePayerOverride, feePayerOverride = _ref$feePayerOverride === void 0 ? null : _ref$feePayerOverride;
|
|
36605
36605
|
nodesToReselect = null;
|
|
36606
|
-
|
|
36606
|
+
aaoErrorCode = null;
|
|
36607
|
+
_context.prev = 3;
|
|
36607
36608
|
phase = AttestationPhases.SANITY_CHECKS; // fail if amount is a decimal
|
|
36608
36609
|
|
|
36609
36610
|
if (!(Number(amount) !== amount || amount % 1 !== 0)) {
|
|
36610
|
-
_context.next =
|
|
36611
|
+
_context.next = 7;
|
|
36611
36612
|
break;
|
|
36612
36613
|
}
|
|
36613
36614
|
|
|
36614
36615
|
throw new Error('Invalid amount');
|
|
36615
36616
|
|
|
36616
|
-
case
|
|
36617
|
+
case 7:
|
|
36617
36618
|
// Aggregate
|
|
36618
36619
|
logger.info("submitAndEvaluate: aggregating attestations for userId [".concat(decodeHashId$1(encodedUserId), "], challengeId [").concat(challengeId, "]"));
|
|
36619
36620
|
phase = AttestationPhases.AGGREGATE_ATTESTATIONS;
|
|
36620
|
-
_context.next =
|
|
36621
|
+
_context.next = 11;
|
|
36621
36622
|
return this.aggregateAttestations({
|
|
36622
36623
|
challengeId: challengeId,
|
|
36623
36624
|
encodedUserId: encodedUserId,
|
|
@@ -36632,28 +36633,30 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36632
36633
|
maxAttempts: maxAggregationAttempts
|
|
36633
36634
|
});
|
|
36634
36635
|
|
|
36635
|
-
case
|
|
36636
|
+
case 11:
|
|
36636
36637
|
_yield$this$aggregate = _context.sent;
|
|
36637
36638
|
discoveryNodeAttestations = _yield$this$aggregate.discoveryNodeAttestations;
|
|
36638
36639
|
aaoAttestation = _yield$this$aggregate.aaoAttestation;
|
|
36639
36640
|
aggregateError = _yield$this$aggregate.error;
|
|
36641
|
+
errorCode = _yield$this$aggregate.aaoErrorCode;
|
|
36640
36642
|
erroringNodes = _yield$this$aggregate.erroringNodes;
|
|
36641
36643
|
|
|
36642
36644
|
if (!aggregateError) {
|
|
36643
|
-
_context.next =
|
|
36645
|
+
_context.next = 21;
|
|
36644
36646
|
break;
|
|
36645
36647
|
}
|
|
36646
36648
|
|
|
36647
36649
|
nodesToReselect = erroringNodes;
|
|
36650
|
+
aaoErrorCode = errorCode;
|
|
36648
36651
|
throw new Error(aggregateError);
|
|
36649
36652
|
|
|
36650
|
-
case
|
|
36653
|
+
case 21:
|
|
36651
36654
|
// Submit
|
|
36652
36655
|
logger.info("submitAndEvaluate: submitting for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$1(encodedUserId), "] with [").concat(discoveryNodeAttestations === null || discoveryNodeAttestations === void 0 ? void 0 : discoveryNodeAttestations.length, "] DN and [").concat(aaoAttestation ? 1 : 0, "] oracle attestations."));
|
|
36653
36656
|
fullTokenAmount = new BN__default["default"](amount * WRAPPED_AUDIO_PRECISION);
|
|
36654
36657
|
phase = AttestationPhases.SUBMIT_ATTESTATIONS; // @ts-expect-error the return types are a bit strange here
|
|
36655
36658
|
|
|
36656
|
-
_context.next =
|
|
36659
|
+
_context.next = 26;
|
|
36657
36660
|
return this.solanaWeb3Manager.submitChallengeAttestations({
|
|
36658
36661
|
attestations: discoveryNodeAttestations,
|
|
36659
36662
|
oracleAttestation: aaoAttestation,
|
|
@@ -36666,13 +36669,13 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36666
36669
|
feePayerOverride: feePayerOverride
|
|
36667
36670
|
});
|
|
36668
36671
|
|
|
36669
|
-
case
|
|
36672
|
+
case 26:
|
|
36670
36673
|
_yield$this$solanaWeb = _context.sent;
|
|
36671
36674
|
submitErrorCode = _yield$this$solanaWeb.errorCode;
|
|
36672
36675
|
submitError = _yield$this$solanaWeb.error;
|
|
36673
36676
|
|
|
36674
36677
|
if (!(submitErrorCode || submitError)) {
|
|
36675
|
-
_context.next =
|
|
36678
|
+
_context.next = 38;
|
|
36676
36679
|
break;
|
|
36677
36680
|
}
|
|
36678
36681
|
|
|
@@ -36683,12 +36686,12 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36683
36686
|
// to evaluate phase and will error there (not ideal)
|
|
36684
36687
|
|
|
36685
36688
|
if (!shouldRetryInSeperateTransactions) {
|
|
36686
|
-
_context.next =
|
|
36689
|
+
_context.next = 37;
|
|
36687
36690
|
break;
|
|
36688
36691
|
}
|
|
36689
36692
|
|
|
36690
36693
|
logger.warn("submitAndEvaluate: saw repeat senders for userId [".concat(decodeHashId$1(encodedUserId), "] challengeId: [").concat(challengeId, "] with err: ").concat(submitErrorCode, ", breaking up into individual transactions"));
|
|
36691
|
-
_context.next =
|
|
36694
|
+
_context.next = 35;
|
|
36692
36695
|
return this.solanaWeb3Manager.submitChallengeAttestations({
|
|
36693
36696
|
attestations: discoveryNodeAttestations,
|
|
36694
36697
|
oracleAttestation: aaoAttestation,
|
|
@@ -36701,18 +36704,18 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36701
36704
|
feePayerOverride: feePayerOverride
|
|
36702
36705
|
});
|
|
36703
36706
|
|
|
36704
|
-
case
|
|
36705
|
-
_context.next =
|
|
36707
|
+
case 35:
|
|
36708
|
+
_context.next = 38;
|
|
36706
36709
|
break;
|
|
36707
36710
|
|
|
36708
|
-
case
|
|
36711
|
+
case 37:
|
|
36709
36712
|
throw new Error(submitErrorCode || submitError);
|
|
36710
36713
|
|
|
36711
|
-
case
|
|
36714
|
+
case 38:
|
|
36712
36715
|
// Evaluate
|
|
36713
36716
|
logger.info("submitAndEvaluate: evaluating for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$1(encodedUserId), "]"));
|
|
36714
36717
|
phase = AttestationPhases.EVALUATE_ATTESTATIONS;
|
|
36715
|
-
_context.next =
|
|
36718
|
+
_context.next = 42;
|
|
36716
36719
|
return this.solanaWeb3Manager.evaluateChallengeAttestations({
|
|
36717
36720
|
challengeId: challengeId,
|
|
36718
36721
|
specifier: specifier,
|
|
@@ -36723,45 +36726,47 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36723
36726
|
feePayerOverride: feePayerOverride
|
|
36724
36727
|
});
|
|
36725
36728
|
|
|
36726
|
-
case
|
|
36729
|
+
case 42:
|
|
36727
36730
|
_yield$this$solanaWeb2 = _context.sent;
|
|
36728
36731
|
evaluateErrorCode = _yield$this$solanaWeb2.errorCode;
|
|
36729
36732
|
evaluateError = _yield$this$solanaWeb2.error;
|
|
36730
36733
|
|
|
36731
36734
|
if (!(evaluateErrorCode !== null && evaluateErrorCode !== void 0 ? evaluateErrorCode : evaluateError)) {
|
|
36732
|
-
_context.next =
|
|
36735
|
+
_context.next = 47;
|
|
36733
36736
|
break;
|
|
36734
36737
|
}
|
|
36735
36738
|
|
|
36736
36739
|
throw new Error(evaluateErrorCode !== null && evaluateErrorCode !== void 0 ? evaluateErrorCode : evaluateError);
|
|
36737
36740
|
|
|
36738
|
-
case
|
|
36741
|
+
case 47:
|
|
36739
36742
|
return _context.abrupt("return", {
|
|
36740
36743
|
success: true,
|
|
36741
36744
|
error: null,
|
|
36745
|
+
aaoErrorCode: aaoErrorCode,
|
|
36742
36746
|
phase: null,
|
|
36743
36747
|
nodesToReselect: null
|
|
36744
36748
|
});
|
|
36745
36749
|
|
|
36746
|
-
case
|
|
36747
|
-
_context.prev =
|
|
36748
|
-
_context.t0 = _context["catch"](
|
|
36750
|
+
case 50:
|
|
36751
|
+
_context.prev = 50;
|
|
36752
|
+
_context.t0 = _context["catch"](3);
|
|
36749
36753
|
err = _context.t0.message;
|
|
36750
36754
|
log = err === GetAttestationError.COGNITO_FLOW || err === GetAttestationError.HCAPTCHA ? logger.info : logger.error;
|
|
36751
36755
|
log("submitAndEvaluate: failed for userId: [".concat(decodeHashId$1(encodedUserId), "] challenge-id [").concat(challengeId, "] at phase [").concat(phase, "] with err: ").concat(err));
|
|
36752
36756
|
return _context.abrupt("return", {
|
|
36753
36757
|
success: false,
|
|
36754
36758
|
error: err,
|
|
36759
|
+
aaoErrorCode: aaoErrorCode,
|
|
36755
36760
|
phase: phase,
|
|
36756
36761
|
nodesToReselect: nodesToReselect
|
|
36757
36762
|
});
|
|
36758
36763
|
|
|
36759
|
-
case
|
|
36764
|
+
case 56:
|
|
36760
36765
|
case "end":
|
|
36761
36766
|
return _context.stop();
|
|
36762
36767
|
}
|
|
36763
36768
|
}
|
|
36764
|
-
}, _callee, this, [[
|
|
36769
|
+
}, _callee, this, [[3, 50]]);
|
|
36765
36770
|
}));
|
|
36766
36771
|
|
|
36767
36772
|
function submitAndEvaluate(_x) {
|
|
@@ -36778,7 +36783,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36778
36783
|
key: "aggregateAttestations",
|
|
36779
36784
|
value: function () {
|
|
36780
36785
|
var _aggregateAttestations = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
36781
|
-
var challengeId, encodedUserId, handle, specifier, oracleEthAddress, amount, quorumSize, AAOEndpoint, maxAttempts, _ref2$endpoints, endpoints, _ref2$logger, logger, aaoAttestation, _yield$this$getAAOAtt, success, aaoAttestationError, err, discoveryNodeAttestationResults, discoveryNodeSuccesses, discoveryNodeErrors, error, erroringNodes, _err;
|
|
36786
|
+
var challengeId, encodedUserId, handle, specifier, oracleEthAddress, amount, quorumSize, AAOEndpoint, maxAttempts, _ref2$endpoints, endpoints, _ref2$logger, logger, aaoAttestation, _yield$this$getAAOAtt, success, aaoErrorCode, aaoAttestationError, err, discoveryNodeAttestationResults, discoveryNodeSuccesses, discoveryNodeErrors, error, erroringNodes, _err;
|
|
36782
36787
|
|
|
36783
36788
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
36784
36789
|
while (1) {
|
|
@@ -36816,6 +36821,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36816
36821
|
discoveryNodeAttestations: null,
|
|
36817
36822
|
aaoAttestation: null,
|
|
36818
36823
|
error: AggregateAttestationError.INSUFFICIENT_DISCOVERY_NODE_COUNT,
|
|
36824
|
+
aaoErrorCode: null,
|
|
36819
36825
|
erroringNodes: null
|
|
36820
36826
|
});
|
|
36821
36827
|
|
|
@@ -36836,10 +36842,11 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36836
36842
|
case 16:
|
|
36837
36843
|
_yield$this$getAAOAtt = _context2.sent;
|
|
36838
36844
|
success = _yield$this$getAAOAtt.success;
|
|
36845
|
+
aaoErrorCode = _yield$this$getAAOAtt.aaoErrorCode;
|
|
36839
36846
|
aaoAttestationError = _yield$this$getAAOAtt.error;
|
|
36840
36847
|
|
|
36841
36848
|
if (!aaoAttestationError) {
|
|
36842
|
-
_context2.next =
|
|
36849
|
+
_context2.next = 22;
|
|
36843
36850
|
break;
|
|
36844
36851
|
}
|
|
36845
36852
|
|
|
@@ -36847,16 +36854,17 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36847
36854
|
discoveryNodeAttestations: null,
|
|
36848
36855
|
aaoAttestation: null,
|
|
36849
36856
|
error: aaoAttestationError,
|
|
36857
|
+
aaoErrorCode: aaoErrorCode,
|
|
36850
36858
|
erroringNodes: null
|
|
36851
36859
|
});
|
|
36852
36860
|
|
|
36853
|
-
case
|
|
36861
|
+
case 22:
|
|
36854
36862
|
aaoAttestation = success;
|
|
36855
|
-
_context2.next =
|
|
36863
|
+
_context2.next = 30;
|
|
36856
36864
|
break;
|
|
36857
36865
|
|
|
36858
|
-
case
|
|
36859
|
-
_context2.prev =
|
|
36866
|
+
case 25:
|
|
36867
|
+
_context2.prev = 25;
|
|
36860
36868
|
_context2.t0 = _context2["catch"](13);
|
|
36861
36869
|
err = _context2.t0.message;
|
|
36862
36870
|
logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$1(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(err));
|
|
@@ -36864,12 +36872,13 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36864
36872
|
discoveryNodeAttestations: null,
|
|
36865
36873
|
aaoAttestation: null,
|
|
36866
36874
|
error: GetAttestationError.AAO_ATTESTATION_ERROR,
|
|
36875
|
+
aaoErrorCode: null,
|
|
36867
36876
|
erroringNodes: null
|
|
36868
36877
|
});
|
|
36869
36878
|
|
|
36870
|
-
case
|
|
36871
|
-
_context2.prev =
|
|
36872
|
-
_context2.next =
|
|
36879
|
+
case 30:
|
|
36880
|
+
_context2.prev = 30;
|
|
36881
|
+
_context2.next = 33;
|
|
36873
36882
|
return this._getDiscoveryAttestationsWithRetries({
|
|
36874
36883
|
endpoints: endpoints,
|
|
36875
36884
|
challengeId: challengeId,
|
|
@@ -36880,7 +36889,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36880
36889
|
maxAttempts: maxAttempts
|
|
36881
36890
|
});
|
|
36882
36891
|
|
|
36883
|
-
case
|
|
36892
|
+
case 33:
|
|
36884
36893
|
discoveryNodeAttestationResults = _context2.sent;
|
|
36885
36894
|
discoveryNodeSuccesses = discoveryNodeAttestationResults.map(function (r) {
|
|
36886
36895
|
return r.success;
|
|
@@ -36891,7 +36900,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36891
36900
|
error = discoveryNodeErrors.find(Boolean);
|
|
36892
36901
|
|
|
36893
36902
|
if (!error) {
|
|
36894
|
-
_context2.next =
|
|
36903
|
+
_context2.next = 40;
|
|
36895
36904
|
break;
|
|
36896
36905
|
}
|
|
36897
36906
|
|
|
@@ -36908,32 +36917,34 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36908
36917
|
erroringNodes: erroringNodes
|
|
36909
36918
|
});
|
|
36910
36919
|
|
|
36911
|
-
case
|
|
36920
|
+
case 40:
|
|
36912
36921
|
return _context2.abrupt("return", {
|
|
36913
36922
|
discoveryNodeAttestations: discoveryNodeSuccesses,
|
|
36914
36923
|
aaoAttestation: aaoAttestation,
|
|
36915
36924
|
error: null,
|
|
36925
|
+
aaoErrorCode: null,
|
|
36916
36926
|
erroringNodes: null
|
|
36917
36927
|
});
|
|
36918
36928
|
|
|
36919
|
-
case
|
|
36920
|
-
_context2.prev =
|
|
36921
|
-
_context2.t1 = _context2["catch"](
|
|
36929
|
+
case 43:
|
|
36930
|
+
_context2.prev = 43;
|
|
36931
|
+
_context2.t1 = _context2["catch"](30);
|
|
36922
36932
|
_err = _context2.t1.message;
|
|
36923
36933
|
logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$1(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(_err));
|
|
36924
36934
|
return _context2.abrupt("return", {
|
|
36925
36935
|
discoveryNodeAttestations: null,
|
|
36926
36936
|
aaoAttestation: null,
|
|
36927
36937
|
error: GetAttestationError.DISCOVERY_NODE_ATTESTATION_ERROR,
|
|
36938
|
+
aaoErrorCode: null,
|
|
36928
36939
|
erroringNodes: null
|
|
36929
36940
|
});
|
|
36930
36941
|
|
|
36931
|
-
case
|
|
36942
|
+
case 48:
|
|
36932
36943
|
case "end":
|
|
36933
36944
|
return _context2.stop();
|
|
36934
36945
|
}
|
|
36935
36946
|
}
|
|
36936
|
-
}, _callee2, this, [[13,
|
|
36947
|
+
}, _callee2, this, [[13, 25], [30, 43]]);
|
|
36937
36948
|
}));
|
|
36938
36949
|
|
|
36939
36950
|
function aggregateAttestations(_x2) {
|
|
@@ -37064,7 +37075,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
37064
37075
|
key: "getAAOAttestation",
|
|
37065
37076
|
value: function () {
|
|
37066
37077
|
var _getAAOAttestation = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(_ref5) {
|
|
37067
|
-
var challengeId, specifier, handle, amount, AAOEndpoint, oracleEthAddress, _ref5$logger, logger, data, request, response, _response$data, result, needs, mappedErr, err;
|
|
37078
|
+
var challengeId, specifier, handle, amount, AAOEndpoint, oracleEthAddress, _ref5$logger, logger, data, request, response, _response$data, result, errorCode, needs, mappedErr, err;
|
|
37068
37079
|
|
|
37069
37080
|
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
37070
37081
|
while (1) {
|
|
@@ -37095,7 +37106,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
37095
37106
|
// otherwise, 'result' is false
|
|
37096
37107
|
// - there may or may not be a value for `needs` if the attestation fails
|
|
37097
37108
|
// - depending on whether the user can take an action to attempt remediation
|
|
37098
|
-
_response$data = response.data, result = _response$data.result, needs = _response$data.needs;
|
|
37109
|
+
_response$data = response.data, result = _response$data.result, errorCode = _response$data.errorCode, needs = _response$data.needs;
|
|
37099
37110
|
|
|
37100
37111
|
if (result) {
|
|
37101
37112
|
_context5.next = 12;
|
|
@@ -37106,6 +37117,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
37106
37117
|
mappedErr = needs ? GetAttestationError[needs] || GetAttestationError.AAO_ATTESTATION_UNKNOWN_RESPONSE : GetAttestationError.AAO_ATTESTATION_REJECTION;
|
|
37107
37118
|
return _context5.abrupt("return", {
|
|
37108
37119
|
success: null,
|
|
37120
|
+
aaoErrorCode: errorCode,
|
|
37109
37121
|
error: mappedErr
|
|
37110
37122
|
});
|
|
37111
37123
|
|
|
@@ -37115,6 +37127,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
37115
37127
|
signature: result,
|
|
37116
37128
|
ethAddress: oracleEthAddress
|
|
37117
37129
|
},
|
|
37130
|
+
aaoErrorCode: null,
|
|
37118
37131
|
error: null
|
|
37119
37132
|
});
|
|
37120
37133
|
|
|
@@ -37125,6 +37138,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
37125
37138
|
logger.error("Failed to get AAO attestation: ".concat(err));
|
|
37126
37139
|
return _context5.abrupt("return", {
|
|
37127
37140
|
success: null,
|
|
37141
|
+
aaoErrorCode: null,
|
|
37128
37142
|
error: GetAttestationError.AAO_ATTESTATION_ERROR
|
|
37129
37143
|
});
|
|
37130
37144
|
|
|
@@ -38471,7 +38485,7 @@ var RewardsAttester = /*#__PURE__*/function () {
|
|
|
38471
38485
|
key: "_performSingleAttestation",
|
|
38472
38486
|
value: function () {
|
|
38473
38487
|
var _performSingleAttestation2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(_ref9) {
|
|
38474
|
-
var challengeId, userId, specifier, amount, handle, wallet, completedBlocknumber, _yield$this$libs$Rewa, success, error, phase, nodesToReselect;
|
|
38488
|
+
var challengeId, userId, specifier, amount, handle, wallet, completedBlocknumber, _yield$this$libs$Rewa, success, error, aaoErrorCode, phase, nodesToReselect;
|
|
38475
38489
|
|
|
38476
38490
|
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
38477
38491
|
while (1) {
|
|
@@ -38500,11 +38514,12 @@ var RewardsAttester = /*#__PURE__*/function () {
|
|
|
38500
38514
|
_yield$this$libs$Rewa = _context17.sent;
|
|
38501
38515
|
success = _yield$this$libs$Rewa.success;
|
|
38502
38516
|
error = _yield$this$libs$Rewa.error;
|
|
38517
|
+
aaoErrorCode = _yield$this$libs$Rewa.aaoErrorCode;
|
|
38503
38518
|
phase = _yield$this$libs$Rewa.phase;
|
|
38504
38519
|
nodesToReselect = _yield$this$libs$Rewa.nodesToReselect;
|
|
38505
38520
|
|
|
38506
38521
|
if (!success) {
|
|
38507
|
-
_context17.next =
|
|
38522
|
+
_context17.next = 13;
|
|
38508
38523
|
break;
|
|
38509
38524
|
}
|
|
38510
38525
|
|
|
@@ -38520,7 +38535,7 @@ var RewardsAttester = /*#__PURE__*/function () {
|
|
|
38520
38535
|
nodesToReselect: null
|
|
38521
38536
|
});
|
|
38522
38537
|
|
|
38523
|
-
case
|
|
38538
|
+
case 13:
|
|
38524
38539
|
// Handle error path
|
|
38525
38540
|
this.logger.error("Failed to attest for challenge [".concat(challengeId, "] for user [").concat(decodeHashId(userId), "], amount [").concat(amount, "], oracle: [").concat(this.aaoAddress, "] at phase: [").concat(phase, "] with error [").concat(error, "]"));
|
|
38526
38541
|
return _context17.abrupt("return", {
|
|
@@ -38532,11 +38547,12 @@ var RewardsAttester = /*#__PURE__*/function () {
|
|
|
38532
38547
|
wallet: wallet,
|
|
38533
38548
|
completedBlocknumber: completedBlocknumber,
|
|
38534
38549
|
error: error,
|
|
38550
|
+
aaoErrorCode: aaoErrorCode,
|
|
38535
38551
|
phase: phase,
|
|
38536
38552
|
nodesToReselect: nodesToReselect
|
|
38537
38553
|
});
|
|
38538
38554
|
|
|
38539
|
-
case
|
|
38555
|
+
case 15:
|
|
38540
38556
|
case "end":
|
|
38541
38557
|
return _context17.stop();
|
|
38542
38558
|
}
|