@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/index.esm.js
CHANGED
|
@@ -32871,9 +32871,9 @@ var formatProviders = function formatProviders(providers) {
|
|
|
32871
32871
|
};
|
|
32872
32872
|
|
|
32873
32873
|
var name = "@audius/sdk";
|
|
32874
|
-
var version = "0.0.
|
|
32874
|
+
var version = "0.0.34";
|
|
32875
32875
|
var audius = {
|
|
32876
|
-
releaseSHA: "
|
|
32876
|
+
releaseSHA: "c38a6a8f425386cc254501ac0b0d01235b44d36f"
|
|
32877
32877
|
};
|
|
32878
32878
|
var description = "";
|
|
32879
32879
|
var main = "dist/index.cjs.js";
|
|
@@ -32915,7 +32915,7 @@ var dependencies = {
|
|
|
32915
32915
|
"@ethersproject/solidity": "5.0.5",
|
|
32916
32916
|
"@improbable-eng/grpc-web-node-http-transport": "0.15.0",
|
|
32917
32917
|
"@project-serum/anchor": "0.24.1",
|
|
32918
|
-
"@solana/spl-token": "0.1.
|
|
32918
|
+
"@solana/spl-token": "0.1.8",
|
|
32919
32919
|
"@solana/web3.js": "1.37.1",
|
|
32920
32920
|
"abi-decoder": "2.4.0",
|
|
32921
32921
|
ajv: "6.12.2",
|
|
@@ -36549,7 +36549,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36549
36549
|
key: "submitAndEvaluate",
|
|
36550
36550
|
value: function () {
|
|
36551
36551
|
var _submitAndEvaluate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
|
|
36552
|
-
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;
|
|
36552
|
+
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;
|
|
36553
36553
|
|
|
36554
36554
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36555
36555
|
while (1) {
|
|
@@ -36557,21 +36557,22 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36557
36557
|
case 0:
|
|
36558
36558
|
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;
|
|
36559
36559
|
nodesToReselect = null;
|
|
36560
|
-
|
|
36560
|
+
aaoErrorCode = null;
|
|
36561
|
+
_context.prev = 3;
|
|
36561
36562
|
phase = AttestationPhases.SANITY_CHECKS; // fail if amount is a decimal
|
|
36562
36563
|
|
|
36563
36564
|
if (!(Number(amount) !== amount || amount % 1 !== 0)) {
|
|
36564
|
-
_context.next =
|
|
36565
|
+
_context.next = 7;
|
|
36565
36566
|
break;
|
|
36566
36567
|
}
|
|
36567
36568
|
|
|
36568
36569
|
throw new Error('Invalid amount');
|
|
36569
36570
|
|
|
36570
|
-
case
|
|
36571
|
+
case 7:
|
|
36571
36572
|
// Aggregate
|
|
36572
36573
|
logger.info("submitAndEvaluate: aggregating attestations for userId [".concat(decodeHashId$1(encodedUserId), "], challengeId [").concat(challengeId, "]"));
|
|
36573
36574
|
phase = AttestationPhases.AGGREGATE_ATTESTATIONS;
|
|
36574
|
-
_context.next =
|
|
36575
|
+
_context.next = 11;
|
|
36575
36576
|
return this.aggregateAttestations({
|
|
36576
36577
|
challengeId: challengeId,
|
|
36577
36578
|
encodedUserId: encodedUserId,
|
|
@@ -36586,28 +36587,30 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36586
36587
|
maxAttempts: maxAggregationAttempts
|
|
36587
36588
|
});
|
|
36588
36589
|
|
|
36589
|
-
case
|
|
36590
|
+
case 11:
|
|
36590
36591
|
_yield$this$aggregate = _context.sent;
|
|
36591
36592
|
discoveryNodeAttestations = _yield$this$aggregate.discoveryNodeAttestations;
|
|
36592
36593
|
aaoAttestation = _yield$this$aggregate.aaoAttestation;
|
|
36593
36594
|
aggregateError = _yield$this$aggregate.error;
|
|
36595
|
+
errorCode = _yield$this$aggregate.aaoErrorCode;
|
|
36594
36596
|
erroringNodes = _yield$this$aggregate.erroringNodes;
|
|
36595
36597
|
|
|
36596
36598
|
if (!aggregateError) {
|
|
36597
|
-
_context.next =
|
|
36599
|
+
_context.next = 21;
|
|
36598
36600
|
break;
|
|
36599
36601
|
}
|
|
36600
36602
|
|
|
36601
36603
|
nodesToReselect = erroringNodes;
|
|
36604
|
+
aaoErrorCode = errorCode;
|
|
36602
36605
|
throw new Error(aggregateError);
|
|
36603
36606
|
|
|
36604
|
-
case
|
|
36607
|
+
case 21:
|
|
36605
36608
|
// Submit
|
|
36606
36609
|
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."));
|
|
36607
36610
|
fullTokenAmount = new BN(amount * WRAPPED_AUDIO_PRECISION);
|
|
36608
36611
|
phase = AttestationPhases.SUBMIT_ATTESTATIONS; // @ts-expect-error the return types are a bit strange here
|
|
36609
36612
|
|
|
36610
|
-
_context.next =
|
|
36613
|
+
_context.next = 26;
|
|
36611
36614
|
return this.solanaWeb3Manager.submitChallengeAttestations({
|
|
36612
36615
|
attestations: discoveryNodeAttestations,
|
|
36613
36616
|
oracleAttestation: aaoAttestation,
|
|
@@ -36620,13 +36623,13 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36620
36623
|
feePayerOverride: feePayerOverride
|
|
36621
36624
|
});
|
|
36622
36625
|
|
|
36623
|
-
case
|
|
36626
|
+
case 26:
|
|
36624
36627
|
_yield$this$solanaWeb = _context.sent;
|
|
36625
36628
|
submitErrorCode = _yield$this$solanaWeb.errorCode;
|
|
36626
36629
|
submitError = _yield$this$solanaWeb.error;
|
|
36627
36630
|
|
|
36628
36631
|
if (!(submitErrorCode || submitError)) {
|
|
36629
|
-
_context.next =
|
|
36632
|
+
_context.next = 38;
|
|
36630
36633
|
break;
|
|
36631
36634
|
}
|
|
36632
36635
|
|
|
@@ -36637,12 +36640,12 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36637
36640
|
// to evaluate phase and will error there (not ideal)
|
|
36638
36641
|
|
|
36639
36642
|
if (!shouldRetryInSeperateTransactions) {
|
|
36640
|
-
_context.next =
|
|
36643
|
+
_context.next = 37;
|
|
36641
36644
|
break;
|
|
36642
36645
|
}
|
|
36643
36646
|
|
|
36644
36647
|
logger.warn("submitAndEvaluate: saw repeat senders for userId [".concat(decodeHashId$1(encodedUserId), "] challengeId: [").concat(challengeId, "] with err: ").concat(submitErrorCode, ", breaking up into individual transactions"));
|
|
36645
|
-
_context.next =
|
|
36648
|
+
_context.next = 35;
|
|
36646
36649
|
return this.solanaWeb3Manager.submitChallengeAttestations({
|
|
36647
36650
|
attestations: discoveryNodeAttestations,
|
|
36648
36651
|
oracleAttestation: aaoAttestation,
|
|
@@ -36655,18 +36658,18 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36655
36658
|
feePayerOverride: feePayerOverride
|
|
36656
36659
|
});
|
|
36657
36660
|
|
|
36658
|
-
case
|
|
36659
|
-
_context.next =
|
|
36661
|
+
case 35:
|
|
36662
|
+
_context.next = 38;
|
|
36660
36663
|
break;
|
|
36661
36664
|
|
|
36662
|
-
case
|
|
36665
|
+
case 37:
|
|
36663
36666
|
throw new Error(submitErrorCode || submitError);
|
|
36664
36667
|
|
|
36665
|
-
case
|
|
36668
|
+
case 38:
|
|
36666
36669
|
// Evaluate
|
|
36667
36670
|
logger.info("submitAndEvaluate: evaluating for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$1(encodedUserId), "]"));
|
|
36668
36671
|
phase = AttestationPhases.EVALUATE_ATTESTATIONS;
|
|
36669
|
-
_context.next =
|
|
36672
|
+
_context.next = 42;
|
|
36670
36673
|
return this.solanaWeb3Manager.evaluateChallengeAttestations({
|
|
36671
36674
|
challengeId: challengeId,
|
|
36672
36675
|
specifier: specifier,
|
|
@@ -36677,45 +36680,47 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36677
36680
|
feePayerOverride: feePayerOverride
|
|
36678
36681
|
});
|
|
36679
36682
|
|
|
36680
|
-
case
|
|
36683
|
+
case 42:
|
|
36681
36684
|
_yield$this$solanaWeb2 = _context.sent;
|
|
36682
36685
|
evaluateErrorCode = _yield$this$solanaWeb2.errorCode;
|
|
36683
36686
|
evaluateError = _yield$this$solanaWeb2.error;
|
|
36684
36687
|
|
|
36685
36688
|
if (!(evaluateErrorCode !== null && evaluateErrorCode !== void 0 ? evaluateErrorCode : evaluateError)) {
|
|
36686
|
-
_context.next =
|
|
36689
|
+
_context.next = 47;
|
|
36687
36690
|
break;
|
|
36688
36691
|
}
|
|
36689
36692
|
|
|
36690
36693
|
throw new Error(evaluateErrorCode !== null && evaluateErrorCode !== void 0 ? evaluateErrorCode : evaluateError);
|
|
36691
36694
|
|
|
36692
|
-
case
|
|
36695
|
+
case 47:
|
|
36693
36696
|
return _context.abrupt("return", {
|
|
36694
36697
|
success: true,
|
|
36695
36698
|
error: null,
|
|
36699
|
+
aaoErrorCode: aaoErrorCode,
|
|
36696
36700
|
phase: null,
|
|
36697
36701
|
nodesToReselect: null
|
|
36698
36702
|
});
|
|
36699
36703
|
|
|
36700
|
-
case
|
|
36701
|
-
_context.prev =
|
|
36702
|
-
_context.t0 = _context["catch"](
|
|
36704
|
+
case 50:
|
|
36705
|
+
_context.prev = 50;
|
|
36706
|
+
_context.t0 = _context["catch"](3);
|
|
36703
36707
|
err = _context.t0.message;
|
|
36704
36708
|
log = err === GetAttestationError.COGNITO_FLOW || err === GetAttestationError.HCAPTCHA ? logger.info : logger.error;
|
|
36705
36709
|
log("submitAndEvaluate: failed for userId: [".concat(decodeHashId$1(encodedUserId), "] challenge-id [").concat(challengeId, "] at phase [").concat(phase, "] with err: ").concat(err));
|
|
36706
36710
|
return _context.abrupt("return", {
|
|
36707
36711
|
success: false,
|
|
36708
36712
|
error: err,
|
|
36713
|
+
aaoErrorCode: aaoErrorCode,
|
|
36709
36714
|
phase: phase,
|
|
36710
36715
|
nodesToReselect: nodesToReselect
|
|
36711
36716
|
});
|
|
36712
36717
|
|
|
36713
|
-
case
|
|
36718
|
+
case 56:
|
|
36714
36719
|
case "end":
|
|
36715
36720
|
return _context.stop();
|
|
36716
36721
|
}
|
|
36717
36722
|
}
|
|
36718
|
-
}, _callee, this, [[
|
|
36723
|
+
}, _callee, this, [[3, 50]]);
|
|
36719
36724
|
}));
|
|
36720
36725
|
|
|
36721
36726
|
function submitAndEvaluate(_x) {
|
|
@@ -36732,7 +36737,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36732
36737
|
key: "aggregateAttestations",
|
|
36733
36738
|
value: function () {
|
|
36734
36739
|
var _aggregateAttestations = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
36735
|
-
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;
|
|
36740
|
+
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;
|
|
36736
36741
|
|
|
36737
36742
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
36738
36743
|
while (1) {
|
|
@@ -36770,6 +36775,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36770
36775
|
discoveryNodeAttestations: null,
|
|
36771
36776
|
aaoAttestation: null,
|
|
36772
36777
|
error: AggregateAttestationError.INSUFFICIENT_DISCOVERY_NODE_COUNT,
|
|
36778
|
+
aaoErrorCode: null,
|
|
36773
36779
|
erroringNodes: null
|
|
36774
36780
|
});
|
|
36775
36781
|
|
|
@@ -36790,10 +36796,11 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36790
36796
|
case 16:
|
|
36791
36797
|
_yield$this$getAAOAtt = _context2.sent;
|
|
36792
36798
|
success = _yield$this$getAAOAtt.success;
|
|
36799
|
+
aaoErrorCode = _yield$this$getAAOAtt.aaoErrorCode;
|
|
36793
36800
|
aaoAttestationError = _yield$this$getAAOAtt.error;
|
|
36794
36801
|
|
|
36795
36802
|
if (!aaoAttestationError) {
|
|
36796
|
-
_context2.next =
|
|
36803
|
+
_context2.next = 22;
|
|
36797
36804
|
break;
|
|
36798
36805
|
}
|
|
36799
36806
|
|
|
@@ -36801,16 +36808,17 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36801
36808
|
discoveryNodeAttestations: null,
|
|
36802
36809
|
aaoAttestation: null,
|
|
36803
36810
|
error: aaoAttestationError,
|
|
36811
|
+
aaoErrorCode: aaoErrorCode,
|
|
36804
36812
|
erroringNodes: null
|
|
36805
36813
|
});
|
|
36806
36814
|
|
|
36807
|
-
case
|
|
36815
|
+
case 22:
|
|
36808
36816
|
aaoAttestation = success;
|
|
36809
|
-
_context2.next =
|
|
36817
|
+
_context2.next = 30;
|
|
36810
36818
|
break;
|
|
36811
36819
|
|
|
36812
|
-
case
|
|
36813
|
-
_context2.prev =
|
|
36820
|
+
case 25:
|
|
36821
|
+
_context2.prev = 25;
|
|
36814
36822
|
_context2.t0 = _context2["catch"](13);
|
|
36815
36823
|
err = _context2.t0.message;
|
|
36816
36824
|
logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$1(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(err));
|
|
@@ -36818,12 +36826,13 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36818
36826
|
discoveryNodeAttestations: null,
|
|
36819
36827
|
aaoAttestation: null,
|
|
36820
36828
|
error: GetAttestationError.AAO_ATTESTATION_ERROR,
|
|
36829
|
+
aaoErrorCode: null,
|
|
36821
36830
|
erroringNodes: null
|
|
36822
36831
|
});
|
|
36823
36832
|
|
|
36824
|
-
case
|
|
36825
|
-
_context2.prev =
|
|
36826
|
-
_context2.next =
|
|
36833
|
+
case 30:
|
|
36834
|
+
_context2.prev = 30;
|
|
36835
|
+
_context2.next = 33;
|
|
36827
36836
|
return this._getDiscoveryAttestationsWithRetries({
|
|
36828
36837
|
endpoints: endpoints,
|
|
36829
36838
|
challengeId: challengeId,
|
|
@@ -36834,7 +36843,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36834
36843
|
maxAttempts: maxAttempts
|
|
36835
36844
|
});
|
|
36836
36845
|
|
|
36837
|
-
case
|
|
36846
|
+
case 33:
|
|
36838
36847
|
discoveryNodeAttestationResults = _context2.sent;
|
|
36839
36848
|
discoveryNodeSuccesses = discoveryNodeAttestationResults.map(function (r) {
|
|
36840
36849
|
return r.success;
|
|
@@ -36845,7 +36854,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36845
36854
|
error = discoveryNodeErrors.find(Boolean);
|
|
36846
36855
|
|
|
36847
36856
|
if (!error) {
|
|
36848
|
-
_context2.next =
|
|
36857
|
+
_context2.next = 40;
|
|
36849
36858
|
break;
|
|
36850
36859
|
}
|
|
36851
36860
|
|
|
@@ -36862,32 +36871,34 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
36862
36871
|
erroringNodes: erroringNodes
|
|
36863
36872
|
});
|
|
36864
36873
|
|
|
36865
|
-
case
|
|
36874
|
+
case 40:
|
|
36866
36875
|
return _context2.abrupt("return", {
|
|
36867
36876
|
discoveryNodeAttestations: discoveryNodeSuccesses,
|
|
36868
36877
|
aaoAttestation: aaoAttestation,
|
|
36869
36878
|
error: null,
|
|
36879
|
+
aaoErrorCode: null,
|
|
36870
36880
|
erroringNodes: null
|
|
36871
36881
|
});
|
|
36872
36882
|
|
|
36873
|
-
case
|
|
36874
|
-
_context2.prev =
|
|
36875
|
-
_context2.t1 = _context2["catch"](
|
|
36883
|
+
case 43:
|
|
36884
|
+
_context2.prev = 43;
|
|
36885
|
+
_context2.t1 = _context2["catch"](30);
|
|
36876
36886
|
_err = _context2.t1.message;
|
|
36877
36887
|
logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$1(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(_err));
|
|
36878
36888
|
return _context2.abrupt("return", {
|
|
36879
36889
|
discoveryNodeAttestations: null,
|
|
36880
36890
|
aaoAttestation: null,
|
|
36881
36891
|
error: GetAttestationError.DISCOVERY_NODE_ATTESTATION_ERROR,
|
|
36892
|
+
aaoErrorCode: null,
|
|
36882
36893
|
erroringNodes: null
|
|
36883
36894
|
});
|
|
36884
36895
|
|
|
36885
|
-
case
|
|
36896
|
+
case 48:
|
|
36886
36897
|
case "end":
|
|
36887
36898
|
return _context2.stop();
|
|
36888
36899
|
}
|
|
36889
36900
|
}
|
|
36890
|
-
}, _callee2, this, [[13,
|
|
36901
|
+
}, _callee2, this, [[13, 25], [30, 43]]);
|
|
36891
36902
|
}));
|
|
36892
36903
|
|
|
36893
36904
|
function aggregateAttestations(_x2) {
|
|
@@ -37018,7 +37029,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
37018
37029
|
key: "getAAOAttestation",
|
|
37019
37030
|
value: function () {
|
|
37020
37031
|
var _getAAOAttestation = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(_ref5) {
|
|
37021
|
-
var challengeId, specifier, handle, amount, AAOEndpoint, oracleEthAddress, _ref5$logger, logger, data, request, response, _response$data, result, needs, mappedErr, err;
|
|
37032
|
+
var challengeId, specifier, handle, amount, AAOEndpoint, oracleEthAddress, _ref5$logger, logger, data, request, response, _response$data, result, errorCode, needs, mappedErr, err;
|
|
37022
37033
|
|
|
37023
37034
|
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
37024
37035
|
while (1) {
|
|
@@ -37049,7 +37060,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
37049
37060
|
// otherwise, 'result' is false
|
|
37050
37061
|
// - there may or may not be a value for `needs` if the attestation fails
|
|
37051
37062
|
// - depending on whether the user can take an action to attempt remediation
|
|
37052
|
-
_response$data = response.data, result = _response$data.result, needs = _response$data.needs;
|
|
37063
|
+
_response$data = response.data, result = _response$data.result, errorCode = _response$data.errorCode, needs = _response$data.needs;
|
|
37053
37064
|
|
|
37054
37065
|
if (result) {
|
|
37055
37066
|
_context5.next = 12;
|
|
@@ -37060,6 +37071,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
37060
37071
|
mappedErr = needs ? GetAttestationError[needs] || GetAttestationError.AAO_ATTESTATION_UNKNOWN_RESPONSE : GetAttestationError.AAO_ATTESTATION_REJECTION;
|
|
37061
37072
|
return _context5.abrupt("return", {
|
|
37062
37073
|
success: null,
|
|
37074
|
+
aaoErrorCode: errorCode,
|
|
37063
37075
|
error: mappedErr
|
|
37064
37076
|
});
|
|
37065
37077
|
|
|
@@ -37069,6 +37081,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
37069
37081
|
signature: result,
|
|
37070
37082
|
ethAddress: oracleEthAddress
|
|
37071
37083
|
},
|
|
37084
|
+
aaoErrorCode: null,
|
|
37072
37085
|
error: null
|
|
37073
37086
|
});
|
|
37074
37087
|
|
|
@@ -37079,6 +37092,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
|
|
|
37079
37092
|
logger.error("Failed to get AAO attestation: ".concat(err));
|
|
37080
37093
|
return _context5.abrupt("return", {
|
|
37081
37094
|
success: null,
|
|
37095
|
+
aaoErrorCode: null,
|
|
37082
37096
|
error: GetAttestationError.AAO_ATTESTATION_ERROR
|
|
37083
37097
|
});
|
|
37084
37098
|
|
|
@@ -38425,7 +38439,7 @@ var RewardsAttester = /*#__PURE__*/function () {
|
|
|
38425
38439
|
key: "_performSingleAttestation",
|
|
38426
38440
|
value: function () {
|
|
38427
38441
|
var _performSingleAttestation2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(_ref9) {
|
|
38428
|
-
var challengeId, userId, specifier, amount, handle, wallet, completedBlocknumber, _yield$this$libs$Rewa, success, error, phase, nodesToReselect;
|
|
38442
|
+
var challengeId, userId, specifier, amount, handle, wallet, completedBlocknumber, _yield$this$libs$Rewa, success, error, aaoErrorCode, phase, nodesToReselect;
|
|
38429
38443
|
|
|
38430
38444
|
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
38431
38445
|
while (1) {
|
|
@@ -38454,11 +38468,12 @@ var RewardsAttester = /*#__PURE__*/function () {
|
|
|
38454
38468
|
_yield$this$libs$Rewa = _context17.sent;
|
|
38455
38469
|
success = _yield$this$libs$Rewa.success;
|
|
38456
38470
|
error = _yield$this$libs$Rewa.error;
|
|
38471
|
+
aaoErrorCode = _yield$this$libs$Rewa.aaoErrorCode;
|
|
38457
38472
|
phase = _yield$this$libs$Rewa.phase;
|
|
38458
38473
|
nodesToReselect = _yield$this$libs$Rewa.nodesToReselect;
|
|
38459
38474
|
|
|
38460
38475
|
if (!success) {
|
|
38461
|
-
_context17.next =
|
|
38476
|
+
_context17.next = 13;
|
|
38462
38477
|
break;
|
|
38463
38478
|
}
|
|
38464
38479
|
|
|
@@ -38474,7 +38489,7 @@ var RewardsAttester = /*#__PURE__*/function () {
|
|
|
38474
38489
|
nodesToReselect: null
|
|
38475
38490
|
});
|
|
38476
38491
|
|
|
38477
|
-
case
|
|
38492
|
+
case 13:
|
|
38478
38493
|
// Handle error path
|
|
38479
38494
|
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, "]"));
|
|
38480
38495
|
return _context17.abrupt("return", {
|
|
@@ -38486,11 +38501,12 @@ var RewardsAttester = /*#__PURE__*/function () {
|
|
|
38486
38501
|
wallet: wallet,
|
|
38487
38502
|
completedBlocknumber: completedBlocknumber,
|
|
38488
38503
|
error: error,
|
|
38504
|
+
aaoErrorCode: aaoErrorCode,
|
|
38489
38505
|
phase: phase,
|
|
38490
38506
|
nodesToReselect: nodesToReselect
|
|
38491
38507
|
});
|
|
38492
38508
|
|
|
38493
|
-
case
|
|
38509
|
+
case 15:
|
|
38494
38510
|
case "end":
|
|
38495
38511
|
return _context17.stop();
|
|
38496
38512
|
}
|