@xyo-network/xl1-protocol-sdk 1.25.18 → 1.25.20
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/neutral/index.mjs +17 -4
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts.map +1 -1
- package/dist/neutral/simple/mempool/SimpleMempoolRunner.d.ts +2 -0
- package/dist/neutral/simple/mempool/SimpleMempoolRunner.d.ts.map +1 -1
- package/package.json +8 -11
- package/src/simple/gateway/SimpleXyoGatewayRunner.ts +2 -2
- package/src/simple/mempool/SimpleMempoolRunner.ts +21 -2
- package/dist/neutral/eip-712/spec/fixtures.d.ts +0 -4
- package/dist/neutral/eip-712/spec/fixtures.d.ts.map +0 -1
package/dist/neutral/index.mjs
CHANGED
|
@@ -4254,7 +4254,7 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
4254
4254
|
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await this.signer.address(), fees);
|
|
4255
4255
|
return await this.addTransactionToChain(tx, await PayloadBuilder19.addHashMeta(offChain));
|
|
4256
4256
|
}
|
|
4257
|
-
async addTransactionToChain(tx,
|
|
4257
|
+
async addTransactionToChain(tx, offChain = []) {
|
|
4258
4258
|
const connection = this.connection;
|
|
4259
4259
|
const signer = this.signer;
|
|
4260
4260
|
const runner = assertEx37(connection.runner, () => "No runner available on connection");
|
|
@@ -4267,7 +4267,7 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
4267
4267
|
} else {
|
|
4268
4268
|
signedTx = await signer.signTransaction(tx);
|
|
4269
4269
|
}
|
|
4270
|
-
await this._dataLakeRunner?.insert(flattenHydratedTransaction(signedTx));
|
|
4270
|
+
await this._dataLakeRunner?.insert([...flattenHydratedTransaction(signedTx), ...offChain]);
|
|
4271
4271
|
return [await runner.broadcastTransaction([signedTx[0], signedTx[1]]), signedTx];
|
|
4272
4272
|
}
|
|
4273
4273
|
async confirmSubmittedTransaction(txHash, options) {
|
|
@@ -4316,6 +4316,7 @@ import {
|
|
|
4316
4316
|
import {
|
|
4317
4317
|
BlockValidationViewerMoniker as BlockValidationViewerMoniker2,
|
|
4318
4318
|
ChainContractViewerMoniker as ChainContractViewerMoniker4,
|
|
4319
|
+
DEFAULT_MAX_EXP_AHEAD,
|
|
4319
4320
|
FinalizationViewerMoniker as FinalizationViewerMoniker4,
|
|
4320
4321
|
isHydratedBlockWithHashMeta,
|
|
4321
4322
|
isHydratedTransactionWithHashMeta,
|
|
@@ -4337,6 +4338,9 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
|
|
|
4337
4338
|
get finalizationViewer() {
|
|
4338
4339
|
return this._finalizationViewer;
|
|
4339
4340
|
}
|
|
4341
|
+
get maxExpAhead() {
|
|
4342
|
+
return this.params.maxExpAhead ?? DEFAULT_MAX_EXP_AHEAD;
|
|
4343
|
+
}
|
|
4340
4344
|
get pendingBlocksArchivist() {
|
|
4341
4345
|
return this.params.pendingBlocksArchivist;
|
|
4342
4346
|
}
|
|
@@ -4481,7 +4485,16 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
|
|
|
4481
4485
|
return inserted.map((p) => p._hash);
|
|
4482
4486
|
}
|
|
4483
4487
|
async submitTransactions(transactions) {
|
|
4484
|
-
const
|
|
4488
|
+
const headNumber = await this.finalizationViewer.headNumber();
|
|
4489
|
+
const maxExp = headNumber + this.maxExpAhead;
|
|
4490
|
+
const validTransactions = transactions.filter(([tx]) => {
|
|
4491
|
+
if (tx.exp > maxExp) {
|
|
4492
|
+
this.logger?.info(`Rejecting transaction with exp ${tx.exp} exceeding max allowed ${maxExp}`);
|
|
4493
|
+
return false;
|
|
4494
|
+
}
|
|
4495
|
+
return true;
|
|
4496
|
+
});
|
|
4497
|
+
const bundles = await Promise.all(validTransactions.map(async ([tx, payloads]) => {
|
|
4485
4498
|
return hydratedTransactionToPayloadBundle([
|
|
4486
4499
|
await PayloadBuilder20.addHashMeta(tx),
|
|
4487
4500
|
await PayloadBuilder20.addHashMeta(payloads)
|
|
@@ -4522,7 +4535,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
|
|
|
4522
4535
|
return await Promise.all(transactionBundles.map(async ([transaction, bundle3]) => {
|
|
4523
4536
|
const transactionCheckPassed = !!transaction;
|
|
4524
4537
|
const chainIdPassed = transactionCheckPassed ? transaction[0].chain === chainId : false;
|
|
4525
|
-
const expPassed = transactionCheckPassed ? transaction[0].exp > headNumber : false;
|
|
4538
|
+
const expPassed = transactionCheckPassed ? transaction[0].exp > headNumber && transaction[0].exp <= headNumber + this.maxExpAhead : false;
|
|
4526
4539
|
const typeCheckPassed = transactionCheckPassed ? isSignedHydratedTransactionWithHashMeta(transaction) : false;
|
|
4527
4540
|
let opcodeCheckPassed = false;
|
|
4528
4541
|
try {
|