postchain-client 2.0.1 → 2.0.3
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/built/cjs/index.js +99 -25
- package/built/cjs/index.js.map +1 -1
- package/built/esm/index.js +99 -25
- package/built/esm/index.js.map +1 -1
- package/built/src/ICCF/IccfProofTxMaterialBuilder.js +1 -1
- package/built/src/ICCF/IccfProofTxMaterialBuilder.js.map +1 -1
- package/built/src/ICCF/utils.js.map +1 -1
- package/built/src/blockchainClient/blockchainClient.js +61 -3
- package/built/src/blockchainClient/blockchainClient.js.map +1 -1
- package/built/src/blockchainClient/clientStub.js +5 -1
- package/built/src/blockchainClient/clientStub.js.map +1 -1
- package/built/src/blockchainClient/enums.d.ts +2 -1
- package/built/src/blockchainClient/enums.js +1 -0
- package/built/src/blockchainClient/enums.js.map +1 -1
- package/built/src/blockchainClient/failoverStrategies.js +3 -1
- package/built/src/blockchainClient/failoverStrategies.js.map +1 -1
- package/built/src/blockchainClient/interface.d.ts +1 -0
- package/built/src/blockchainClient/types.d.ts +3 -1
- package/built/src/blockchainClient/utils.d.ts +2 -1
- package/built/src/blockchainClient/utils.js +15 -13
- package/built/src/blockchainClient/utils.js.map +1 -1
- package/built/src/gtv/index.js +7 -0
- package/built/src/gtv/index.js.map +1 -1
- package/built/src/gtx/gtx.d.ts +1 -1
- package/built/src/gtx/gtx.js +3 -3
- package/built/src/gtx/gtx.js.map +1 -1
- package/built/src/utils/constants.d.ts +1 -0
- package/built/src/utils/constants.js +1 -0
- package/built/src/utils/constants.js.map +1 -1
- package/built/test/common/mocks.d.ts +17 -0
- package/built/test/common/mocks.js +21 -1
- package/built/test/common/mocks.js.map +1 -1
- package/built/test/integration/clientGetTransactionStatus.test.js +2 -2
- package/built/test/integration/clientGetTransactionStatus.test.js.map +1 -1
- package/built/test/integration/clientQuery.test.js +2 -2
- package/built/test/integration/clientQuery.test.js.map +1 -1
- package/built/test/integration/clientSendTransaction.test.js +1 -1
- package/built/test/integration/clientSendTransaction.test.js.map +1 -1
- package/built/test/integration/clientSignAndSendUniqueTransaction.test.js +1 -1
- package/built/test/integration/clientSignAndSendUniqueTransaction.test.js.map +1 -1
- package/built/test/integration/createClientIntegration.test.js +3 -0
- package/built/test/integration/createClientIntegration.test.js.map +1 -1
- package/built/test/integration/signAndSendUniqueTransaction.test.js +7 -6
- package/built/test/integration/signAndSendUniqueTransaction.test.js.map +1 -1
- package/built/test/integrationChromiaNetwork/getTransactionConfirmationLevel.test.js +1 -0
- package/built/test/integrationChromiaNetwork/getTransactionConfirmationLevel.test.js.map +1 -1
- package/built/test/integrationChromiaNetwork/requestWithFailoverStrategy.test.js +4 -3
- package/built/test/integrationChromiaNetwork/requestWithFailoverStrategy.test.js.map +1 -1
- package/built/test/integrationChromiaNetwork/signAndSendUniqueTransaction.test.js +10 -7
- package/built/test/integrationChromiaNetwork/signAndSendUniqueTransaction.test.js.map +1 -1
- package/built/test/pcctf/getSuites.test.js +1 -1
- package/built/test/pcctf/getSuites.test.js.map +1 -1
- package/built/test/pcctf/helpers.js +1 -1
- package/built/test/pcctf/helpers.js.map +1 -1
- package/built/test/unit/blockchainClient/client.test.js +2 -1
- package/built/test/unit/blockchainClient/client.test.js.map +1 -1
- package/built/test/unit/blockchainClient/getTransactionConfirmationLevel.test.js +2 -2
- package/built/test/unit/blockchainClient/getTransactionConfirmationLevel.test.js.map +1 -1
- package/built/test/unit/blockchainClient/sendTransaction.test.js +14 -8
- package/built/test/unit/blockchainClient/sendTransaction.test.js.map +1 -1
- package/built/test/unit/blockchainClient/statusPollIntervals.test.js +35 -28
- package/built/test/unit/blockchainClient/statusPollIntervals.test.js.map +1 -1
- package/built/test/unit/failoverStrategies.test.js +15 -14
- package/built/test/unit/failoverStrategies.test.js.map +1 -1
- package/built/test/unit/gtv/gtvHash.test.js +44 -0
- package/built/test/unit/gtv/gtvHash.test.js.map +1 -1
- package/built/test/unit/gtx/newSignatureProvider.test.js +4 -4
- package/built/test/unit/gtx/newSignatureProvider.test.js.map +1 -1
- package/built/test/unit/httpUtil.test.js +4 -0
- package/built/test/unit/httpUtil.test.js.map +1 -1
- package/built/umd/index.js +99 -25
- package/built/umd/index.js.map +1 -1
- package/changelog.md +671 -0
- package/package.json +1 -1
package/built/umd/index.js
CHANGED
|
@@ -33201,7 +33201,19 @@
|
|
|
33201
33201
|
return sortedDict;
|
|
33202
33202
|
}
|
|
33203
33203
|
|
|
33204
|
+
const MERKLE_HASH_VERSIONS = {
|
|
33205
|
+
ONE: 1,
|
|
33206
|
+
TWO: 2,
|
|
33207
|
+
UNSET: NaN,
|
|
33208
|
+
};
|
|
33209
|
+
|
|
33204
33210
|
const gtvHash2 = (obj, merkleHashVersion) => {
|
|
33211
|
+
if (!Object.values(MERKLE_HASH_VERSIONS).includes(merkleHashVersion)) {
|
|
33212
|
+
throw new Error("Merkle hash version is not valid");
|
|
33213
|
+
}
|
|
33214
|
+
if (isNaN(merkleHashVersion)) {
|
|
33215
|
+
throw new Error("Merkle hash version is not set");
|
|
33216
|
+
}
|
|
33205
33217
|
return gtvHash_1(obj, merkleHashVersion);
|
|
33206
33218
|
};
|
|
33207
33219
|
const encode$1 = encodeValue;
|
|
@@ -34174,7 +34186,7 @@
|
|
|
34174
34186
|
else {
|
|
34175
34187
|
// Removes signatures and extract the rawgtxBody
|
|
34176
34188
|
const rawGtxBody = gtxToRawGtxBody(gtx);
|
|
34177
|
-
const signature = yield privOrSigProv.sign(rawGtxBody);
|
|
34189
|
+
const signature = yield privOrSigProv.sign(rawGtxBody, merkleHashVersion);
|
|
34178
34190
|
return addSignature(privOrSigProv.pubKey, signature, gtx);
|
|
34179
34191
|
}
|
|
34180
34192
|
});
|
|
@@ -34244,7 +34256,7 @@
|
|
|
34244
34256
|
}
|
|
34245
34257
|
return true;
|
|
34246
34258
|
}
|
|
34247
|
-
function newSignatureProvider(
|
|
34259
|
+
function newSignatureProvider(keyPair) {
|
|
34248
34260
|
let pub, priv;
|
|
34249
34261
|
if (keyPair) {
|
|
34250
34262
|
priv = ensureBuffer(keyPair.privKey);
|
|
@@ -34255,7 +34267,7 @@
|
|
|
34255
34267
|
}
|
|
34256
34268
|
return {
|
|
34257
34269
|
pubKey: pub,
|
|
34258
|
-
sign: (gtx) => __awaiter$9(this, void 0, void 0, function* () {
|
|
34270
|
+
sign: (gtx, merkleHashVersion) => __awaiter$9(this, void 0, void 0, function* () {
|
|
34259
34271
|
const signature = getDigestToSignFromRawGtxBody(gtx, merkleHashVersion);
|
|
34260
34272
|
return signDigest(signature, priv);
|
|
34261
34273
|
}),
|
|
@@ -37348,6 +37360,7 @@
|
|
|
37348
37360
|
TransactionEvent["DappConfirmed"] = "dappConfirmed";
|
|
37349
37361
|
TransactionEvent["DappReceived"] = "dappReceived";
|
|
37350
37362
|
TransactionEvent["Signed"] = "signed";
|
|
37363
|
+
TransactionEvent["Rejected"] = "rejected";
|
|
37351
37364
|
})(exports.TransactionEvent || (exports.TransactionEvent = {}));
|
|
37352
37365
|
exports.AnchoringStatus = void 0;
|
|
37353
37366
|
(function (AnchoringStatus) {
|
|
@@ -37656,11 +37669,6 @@
|
|
|
37656
37669
|
return serialize(gtx);
|
|
37657
37670
|
}
|
|
37658
37671
|
|
|
37659
|
-
const MERKLE_HASH_VERSIONS = {
|
|
37660
|
-
ONE: 1,
|
|
37661
|
-
TWO: 2,
|
|
37662
|
-
};
|
|
37663
|
-
|
|
37664
37672
|
const MerkleHashSchema = z.object({
|
|
37665
37673
|
merkle_hash_version: z.number().int().positive(),
|
|
37666
37674
|
});
|
|
@@ -37943,7 +37951,8 @@
|
|
|
37943
37951
|
let error = null;
|
|
37944
37952
|
let transactionTimestamp = undefined;
|
|
37945
37953
|
const { nodeManager } = config;
|
|
37946
|
-
|
|
37954
|
+
const availableNodes = nodeManager.getAvailableNodes();
|
|
37955
|
+
for (const endpoint of availableNodes) {
|
|
37947
37956
|
for (let attempt = 0; attempt < config.attemptsPerEndpoint; attempt++) {
|
|
37948
37957
|
const response = yield handleRequest(method, path, endpoint.url, postObject);
|
|
37949
37958
|
error = (_a = response === null || response === void 0 ? void 0 : response.error) !== null && _a !== void 0 ? _a : null;
|
|
@@ -37954,6 +37963,7 @@
|
|
|
37954
37963
|
const isServerError = statusCode ? hasServerError(statusCode) : false;
|
|
37955
37964
|
if (isStatusCodeValid && !error) {
|
|
37956
37965
|
// Find a way to have this handled more elegantly in the node manager.
|
|
37966
|
+
nodeManager.lastUsedNode = endpoint;
|
|
37957
37967
|
if (nodeManager.stickedNode !== endpoint) {
|
|
37958
37968
|
nodeManager.setStickyNode(endpoint);
|
|
37959
37969
|
}
|
|
@@ -38104,7 +38114,7 @@
|
|
|
38104
38114
|
nodeManager,
|
|
38105
38115
|
endpointPool,
|
|
38106
38116
|
chainId: settings.blockchainIid,
|
|
38107
|
-
merkleHashVersion: (_k = settings.merkleHashVersion) !== null && _k !== void 0 ? _k :
|
|
38117
|
+
merkleHashVersion: (_k = settings.merkleHashVersion) !== null && _k !== void 0 ? _k : MERKLE_HASH_VERSIONS.UNSET,
|
|
38108
38118
|
});
|
|
38109
38119
|
}
|
|
38110
38120
|
throw new MissingBlockchainIdentifierError();
|
|
@@ -38119,17 +38129,18 @@
|
|
|
38119
38129
|
nodeManager,
|
|
38120
38130
|
endpointPool,
|
|
38121
38131
|
chainId: directoryChainIid,
|
|
38122
|
-
merkleHashVersion: (_l = settings.merkleHashVersion) !== null && _l !== void 0 ? _l :
|
|
38132
|
+
merkleHashVersion: (_l = settings.merkleHashVersion) !== null && _l !== void 0 ? _l : MERKLE_HASH_VERSIONS.UNSET,
|
|
38123
38133
|
});
|
|
38124
38134
|
}))();
|
|
38125
38135
|
return {
|
|
38126
38136
|
endpointPool,
|
|
38127
38137
|
nodeManager: nodeManager,
|
|
38128
38138
|
blockchainRid: blockchainRidToUse,
|
|
38129
|
-
merkleHashVersion: (_e = settings.merkleHashVersion) !== null && _e !== void 0 ? _e :
|
|
38139
|
+
merkleHashVersion: (_e = settings.merkleHashVersion) !== null && _e !== void 0 ? _e : MERKLE_HASH_VERSIONS.UNSET,
|
|
38130
38140
|
dappStatusPolling: setStatusPolling(settings.dappStatusPolling),
|
|
38131
38141
|
clusterAnchoringStatusPolling: setStatusPolling(settings.clusterAnchoringStatusPolling),
|
|
38132
38142
|
systemAnchoringStatusPolling: setStatusPolling(settings.systemAnchoringStatusPolling),
|
|
38143
|
+
retryTransactionPolling: setRetryTransactionPolling(settings.retryTransactionPolling),
|
|
38133
38144
|
failoverStrategy: ((_f = settings.failOverConfig) === null || _f === void 0 ? void 0 : _f.strategy) || defaultFailoverConfig.strategy,
|
|
38134
38145
|
attemptsPerEndpoint: ((_g = settings.failOverConfig) === null || _g === void 0 ? void 0 : _g.attemptsPerEndpoint) || defaultFailoverConfig.attemptsPerEndpoint,
|
|
38135
38146
|
attemptInterval: ((_h = settings.failOverConfig) === null || _h === void 0 ? void 0 : _h.attemptInterval) || defaultFailoverConfig.attemptInterval,
|
|
@@ -38165,7 +38176,6 @@
|
|
|
38165
38176
|
endpointPool: directoryEndpointPool,
|
|
38166
38177
|
chainId: directoryIid,
|
|
38167
38178
|
failOverConfig,
|
|
38168
|
-
merkleHashVersion: 0,
|
|
38169
38179
|
});
|
|
38170
38180
|
const blockchainRidToUse = yield (() => __awaiter$5(this, void 0, void 0, function* () {
|
|
38171
38181
|
if (blockchainRid) {
|
|
@@ -38177,7 +38187,6 @@
|
|
|
38177
38187
|
endpointPool: directoryEndpointPool,
|
|
38178
38188
|
chainId: blockchainIid,
|
|
38179
38189
|
failOverConfig,
|
|
38180
|
-
merkleHashVersion: 0,
|
|
38181
38190
|
});
|
|
38182
38191
|
}
|
|
38183
38192
|
throw new MissingBlockchainIdentifierError();
|
|
@@ -38185,7 +38194,6 @@
|
|
|
38185
38194
|
const D1Client = yield createClient({
|
|
38186
38195
|
nodeUrlPool: getUrlsFromEndpoints(directoryEndpointPool),
|
|
38187
38196
|
blockchainRid: directoryBRID,
|
|
38188
|
-
merkleHashVersion: 0,
|
|
38189
38197
|
});
|
|
38190
38198
|
return yield getBlockchainApiUrls(D1Client, ensureBuffer(blockchainRidToUse));
|
|
38191
38199
|
});
|
|
@@ -38358,7 +38366,6 @@
|
|
|
38358
38366
|
return yield createClient({
|
|
38359
38367
|
directoryNodeUrlPool,
|
|
38360
38368
|
blockchainRid: directoryChainRid,
|
|
38361
|
-
merkleHashVersion: 0,
|
|
38362
38369
|
});
|
|
38363
38370
|
});
|
|
38364
38371
|
}
|
|
@@ -38397,7 +38404,7 @@
|
|
|
38397
38404
|
function awaitDappConfirmation(txRID, dappStatusPolling, getTransactionStatus) {
|
|
38398
38405
|
var _a;
|
|
38399
38406
|
return __awaiter$5(this, void 0, void 0, function* () {
|
|
38400
|
-
let lastKnownResult;
|
|
38407
|
+
let lastKnownResult = null;
|
|
38401
38408
|
for (let i = 0; i < dappStatusPolling.count; i++) {
|
|
38402
38409
|
lastKnownResult = yield getTransactionStatus(txRID);
|
|
38403
38410
|
if (lastKnownResult.status === exports.ResponseStatus.Confirmed) {
|
|
@@ -38408,10 +38415,7 @@
|
|
|
38408
38415
|
}
|
|
38409
38416
|
yield sleep(dappStatusPolling.interval);
|
|
38410
38417
|
}
|
|
38411
|
-
|
|
38412
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
38413
|
-
//@ts-expect-error
|
|
38414
|
-
return lastKnownResult;
|
|
38418
|
+
throw new Error(`Retry count exceeded. Confirmation not received. Last transaction status: ${lastKnownResult === null || lastKnownResult === void 0 ? void 0 : lastKnownResult.status}`);
|
|
38415
38419
|
});
|
|
38416
38420
|
}
|
|
38417
38421
|
function awaitClusterAnchoringChainConfirmation(txRID, clusterAnchoringStatusPolling, getClusterAnchoringTransactionConfirmation) {
|
|
@@ -38525,6 +38529,13 @@
|
|
|
38525
38529
|
count: (_b = statusPolling === null || statusPolling === void 0 ? void 0 : statusPolling.count) !== null && _b !== void 0 ? _b : 20,
|
|
38526
38530
|
};
|
|
38527
38531
|
}
|
|
38532
|
+
function setRetryTransactionPolling(statusPolling) {
|
|
38533
|
+
var _a, _b;
|
|
38534
|
+
return {
|
|
38535
|
+
interval: (_a = statusPolling === null || statusPolling === void 0 ? void 0 : statusPolling.interval) !== null && _a !== void 0 ? _a : 500,
|
|
38536
|
+
count: (_b = statusPolling === null || statusPolling === void 0 ? void 0 : statusPolling.count) !== null && _b !== void 0 ? _b : 3,
|
|
38537
|
+
};
|
|
38538
|
+
}
|
|
38528
38539
|
function linkPromiEvents(event1, event2) {
|
|
38529
38540
|
const transactionEvents = Object.values(exports.TransactionEvent).filter((event) => typeof event === "string");
|
|
38530
38541
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -38596,11 +38607,12 @@
|
|
|
38596
38607
|
dappStatusPolling: setStatusPolling(),
|
|
38597
38608
|
clusterAnchoringStatusPolling: setStatusPolling(),
|
|
38598
38609
|
systemAnchoringStatusPolling: setStatusPolling(),
|
|
38610
|
+
retryTransactionPolling: setRetryTransactionPolling(),
|
|
38599
38611
|
failoverStrategy: mergedFailOverConfig.strategy,
|
|
38600
38612
|
attemptsPerEndpoint: mergedFailOverConfig.attemptsPerEndpoint,
|
|
38601
38613
|
attemptInterval: mergedFailOverConfig.attemptInterval,
|
|
38602
38614
|
unreachableDuration: mergedFailOverConfig.unreachableDuration,
|
|
38603
|
-
merkleHashVersion:
|
|
38615
|
+
merkleHashVersion: MERKLE_HASH_VERSIONS.UNSET,
|
|
38604
38616
|
};
|
|
38605
38617
|
const { error, statusCode, rspBody } = yield requestWithFailoverStrategy(Method.GET, `/brid/iid_${chainId}`, config);
|
|
38606
38618
|
const blockchainRid = isString(rspBody);
|
|
@@ -38908,7 +38920,7 @@
|
|
|
38908
38920
|
if (!sourceClusterInfo || !sourceClusterInfo.anchoring_chain) {
|
|
38909
38921
|
throw Error("Cluster info could not be found");
|
|
38910
38922
|
}
|
|
38911
|
-
const networkSettings = Object.assign(Object.assign({}, client.config), { directoryNodeUrlPool: getUrlsFromEndpoints(client.config.endpointPool), blockchainRid: toString(sourceClusterInfo.anchoring_chain)
|
|
38923
|
+
const networkSettings = Object.assign(Object.assign({}, client.config), { directoryNodeUrlPool: getUrlsFromEndpoints(client.config.endpointPool), blockchainRid: toString(sourceClusterInfo.anchoring_chain) });
|
|
38912
38924
|
const clientConfiguredToAnchoringchain = yield createClient(networkSettings);
|
|
38913
38925
|
return clientConfiguredToAnchoringchain;
|
|
38914
38926
|
});
|
|
@@ -39266,6 +39278,48 @@
|
|
|
39266
39278
|
}
|
|
39267
39279
|
});
|
|
39268
39280
|
},
|
|
39281
|
+
sendTransactionWithRetries(transaction, callback, confirmationLevel = exports.ChainConfirmationLevel.Dapp) {
|
|
39282
|
+
const client = this;
|
|
39283
|
+
function sendOnce() {
|
|
39284
|
+
return client.sendTransaction(transaction, true, callback, confirmationLevel);
|
|
39285
|
+
}
|
|
39286
|
+
const promiEvent = new Web3PromiEvent((resolve, reject) => __awaiter$1(this, void 0, void 0, function* () {
|
|
39287
|
+
let error = null;
|
|
39288
|
+
// await sleep(1000);
|
|
39289
|
+
for (let i = 0; i < config.retryTransactionPolling.count; i++) {
|
|
39290
|
+
info(`sendTransactionWithRetries attempt ${i + 1} of ${config.retryTransactionPolling.count}`);
|
|
39291
|
+
const tmpPromiEvent = sendOnce()
|
|
39292
|
+
.on(exports.TransactionEvent.ClusterAnchoringConfirmation, receipt => {
|
|
39293
|
+
promiEvent.emit(exports.TransactionEvent.ClusterAnchoringConfirmation, receipt);
|
|
39294
|
+
})
|
|
39295
|
+
.on(exports.TransactionEvent.SystemAnchoringConfirmation, receipt => {
|
|
39296
|
+
promiEvent.emit(exports.TransactionEvent.SystemAnchoringConfirmation, receipt);
|
|
39297
|
+
})
|
|
39298
|
+
.on(exports.TransactionEvent.DappReceived, receipt => {
|
|
39299
|
+
promiEvent.emit(exports.TransactionEvent.DappReceived, receipt);
|
|
39300
|
+
})
|
|
39301
|
+
.on(exports.TransactionEvent.Signed, receipt => {
|
|
39302
|
+
promiEvent.emit(exports.TransactionEvent.Signed, receipt);
|
|
39303
|
+
})
|
|
39304
|
+
.on(exports.TransactionEvent.DappConfirmed, receipt => {
|
|
39305
|
+
promiEvent.emit(exports.TransactionEvent.DappConfirmed, receipt);
|
|
39306
|
+
})
|
|
39307
|
+
.catch(tmpError => {
|
|
39308
|
+
warning(`sendTransactionWithRetries error on attempt ${i + 1} of ${config.retryTransactionPolling.count}: ${tmpError}`);
|
|
39309
|
+
promiEvent.emit(exports.TransactionEvent.Rejected, tmpError);
|
|
39310
|
+
error = tmpError;
|
|
39311
|
+
});
|
|
39312
|
+
const tmpReceipt = yield tmpPromiEvent;
|
|
39313
|
+
if (tmpReceipt) {
|
|
39314
|
+
resolve(tmpReceipt);
|
|
39315
|
+
return;
|
|
39316
|
+
}
|
|
39317
|
+
yield sleep(config.retryTransactionPolling.interval);
|
|
39318
|
+
}
|
|
39319
|
+
reject(error);
|
|
39320
|
+
}));
|
|
39321
|
+
return promiEvent;
|
|
39322
|
+
},
|
|
39269
39323
|
sendTransaction(transaction, doStatusPolling = true, callback, confirmationLevel = exports.ChainConfirmationLevel.Dapp) {
|
|
39270
39324
|
const promiEvent = new Web3PromiEvent((resolve, reject) => __awaiter$1(this, void 0, void 0, function* () {
|
|
39271
39325
|
var _a, _b;
|
|
@@ -39300,14 +39354,15 @@
|
|
|
39300
39354
|
clusterAnchoringStatusPolling: client.config.clusterAnchoringStatusPolling,
|
|
39301
39355
|
systemAnchoringStatusPolling: client.config.systemAnchoringStatusPolling,
|
|
39302
39356
|
};
|
|
39303
|
-
|
|
39357
|
+
const stickyNodeClient = yield createStickyNodeClient(client); //to avoid false rejections by oblivious nodes
|
|
39358
|
+
let transactionReceipt = yield handleDappConfirmations(transactionRid, doStatusPolling, confirmationLevel, promiEvent, statusPollingConfig.dappStatusPolling, () => stickyNodeClient.getTransactionStatus(transactionRid, callback), stickyNodeClient);
|
|
39304
39359
|
if (confirmationLevel === exports.ChainConfirmationLevel.None ||
|
|
39305
39360
|
confirmationLevel === exports.ChainConfirmationLevel.Dapp) {
|
|
39306
39361
|
resolve(transactionReceipt);
|
|
39307
39362
|
return;
|
|
39308
39363
|
}
|
|
39309
39364
|
const { anchoringClient, systemAnchoringChainBridString } = yield getAnchoringClientAndSystemChainRid(client);
|
|
39310
|
-
transactionReceipt = yield handleSystemConfirmations(transactionReceipt, confirmationLevel, promiEvent, statusPollingConfig, anchoringClient, systemAnchoringChainBridString, () =>
|
|
39365
|
+
transactionReceipt = yield handleSystemConfirmations(transactionReceipt, confirmationLevel, promiEvent, statusPollingConfig, anchoringClient, systemAnchoringChainBridString, () => stickyNodeClient.getClusterAnchoringTransactionConfirmation(transactionRid, anchoringClient, callback), anchoredTxRid => stickyNodeClient.getSystemAnchoringTransactionConfirmation(anchoredTxRid, anchoringClient, systemAnchoringChainBridString, callback));
|
|
39311
39366
|
resolve(transactionReceipt);
|
|
39312
39367
|
}
|
|
39313
39368
|
catch (error) {
|
|
@@ -39727,6 +39782,21 @@
|
|
|
39727
39782
|
return merkleHashVersion;
|
|
39728
39783
|
});
|
|
39729
39784
|
}
|
|
39785
|
+
function createStickyNodeClient(client) {
|
|
39786
|
+
var _a;
|
|
39787
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
39788
|
+
if (!client.config.nodeManager.lastUsedNode) {
|
|
39789
|
+
throw new Error("No last used node found; cannot create sticky node client");
|
|
39790
|
+
}
|
|
39791
|
+
const stickyNodeClient = yield createClient({
|
|
39792
|
+
nodeUrlPool: (_a = client.config.nodeManager.lastUsedNode) === null || _a === void 0 ? void 0 : _a.url,
|
|
39793
|
+
blockchainRid: client.config.blockchainRid,
|
|
39794
|
+
merkleHashVersion: client.config.merkleHashVersion,
|
|
39795
|
+
useStickyNode: true,
|
|
39796
|
+
});
|
|
39797
|
+
return stickyNodeClient;
|
|
39798
|
+
});
|
|
39799
|
+
}
|
|
39730
39800
|
});
|
|
39731
39801
|
}
|
|
39732
39802
|
|
|
@@ -39752,6 +39822,7 @@
|
|
|
39752
39822
|
dappStatusPolling: setStatusPolling({ interval: 5000, count: 5 }),
|
|
39753
39823
|
clusterAnchoringStatusPolling: setStatusPolling(),
|
|
39754
39824
|
systemAnchoringStatusPolling: setStatusPolling(),
|
|
39825
|
+
retryTransactionPolling: setRetryTransactionPolling(),
|
|
39755
39826
|
failoverStrategy: exports.FailoverStrategy.AbortOnError,
|
|
39756
39827
|
attemptsPerEndpoint: 3,
|
|
39757
39828
|
attemptInterval: 5000,
|
|
@@ -39771,6 +39842,9 @@
|
|
|
39771
39842
|
sendTransaction() {
|
|
39772
39843
|
return new Web3PromiEvent((_resolve, reject) => reject("sendTransaction rejected"));
|
|
39773
39844
|
},
|
|
39845
|
+
sendTransactionWithRetries() {
|
|
39846
|
+
return new Web3PromiEvent((_resolve, reject) => reject("sendTransactionWithRetries rejected"));
|
|
39847
|
+
},
|
|
39774
39848
|
signAndSendUniqueTransaction() {
|
|
39775
39849
|
return new Web3PromiEvent((_resolve, reject) => reject("signAndSendUniqueTransaction rejected"));
|
|
39776
39850
|
},
|