@xyo-network/xl1-protocol-sdk 1.25.15 → 1.25.16
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 +33 -37
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/summary/primitives/balances/balancesStepSummaryFromRange.d.ts +1 -2
- package/dist/neutral/summary/primitives/balances/balancesStepSummaryFromRange.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/balances/balancesSummary.d.ts +1 -2
- package/dist/neutral/summary/primitives/balances/balancesSummary.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/transfers/transfersStepSummaryFromRange.d.ts +1 -2
- package/dist/neutral/summary/primitives/transfers/transfersStepSummaryFromRange.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/transfers/transfersSummary.d.ts +1 -2
- package/dist/neutral/summary/primitives/transfers/transfersSummary.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/summary/primitives/balances/balancesStepSummaryFromRange.ts +8 -9
- package/src/summary/primitives/balances/balancesSummary.ts +1 -2
- package/src/summary/primitives/transfers/transfersStepSummaryFromRange.ts +9 -12
- package/src/summary/primitives/transfers/transfersSummary.ts +1 -2
package/dist/neutral/index.mjs
CHANGED
|
@@ -2941,7 +2941,7 @@ var asTransfersStepSummaryWithStorageMeta = AsObjectFactory7.create(isTransfersS
|
|
|
2941
2941
|
// src/summary/primitives/balances/balancesStepSummaryFromRange.ts
|
|
2942
2942
|
import { spanRootAsync as spanRootAsync2 } from "@xylabs/sdk-js";
|
|
2943
2943
|
import { assertEx as assertEx25 } from "@xylabs/sdk-js";
|
|
2944
|
-
import { isAnyPayload as isAnyPayload2
|
|
2944
|
+
import { isAnyPayload as isAnyPayload2 } from "@xyo-network/sdk-js";
|
|
2945
2945
|
import { asXL1BlockNumber as asXL1BlockNumber6, StepSizes as StepSizes9 } from "@xyo-network/xl1-protocol";
|
|
2946
2946
|
async function balancesStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
|
|
2947
2947
|
const cacheKey = `${range[0]}|${range[1]}`;
|
|
@@ -2956,12 +2956,12 @@ async function balancesStepSummaryFromRange(context, semaphores, blockViewer, su
|
|
|
2956
2956
|
for (const [address, balance] of Object.entries(netBalancesForPayloads(payloads))) {
|
|
2957
2957
|
balances[address] = toSignedBigInt(balance);
|
|
2958
2958
|
}
|
|
2959
|
-
return
|
|
2959
|
+
return {
|
|
2960
2960
|
schema: BalancesStepSummarySchema,
|
|
2961
2961
|
hash: frameHead._hash,
|
|
2962
2962
|
stepSize: -1,
|
|
2963
2963
|
balances
|
|
2964
|
-
}
|
|
2964
|
+
};
|
|
2965
2965
|
}, { ...context, timeBudgetLimit: 500 }) : await spanRootAsync2(`balancesStepSummaryFromRange.frameSize>1[${key}]`, async () => {
|
|
2966
2966
|
const step = StepSizes9.indexOf(asXL1BlockNumber6(frameSize, true));
|
|
2967
2967
|
assertEx25(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes9.join(", ")}`);
|
|
@@ -2990,12 +2990,12 @@ async function balancesStepSummaryFromRange(context, semaphores, blockViewer, su
|
|
|
2990
2990
|
for (const [address, balance] of Object.entries(bigIntBalances)) {
|
|
2991
2991
|
balances[address] = toSignedBigInt(balance);
|
|
2992
2992
|
}
|
|
2993
|
-
const result =
|
|
2993
|
+
const result = {
|
|
2994
2994
|
schema: BalancesStepSummarySchema,
|
|
2995
2995
|
hash: frameHead._hash,
|
|
2996
2996
|
stepSize: frameSize,
|
|
2997
2997
|
balances
|
|
2998
|
-
}
|
|
2998
|
+
};
|
|
2999
2999
|
await summaryMap.set(key, result);
|
|
3000
3000
|
return result;
|
|
3001
3001
|
} finally {
|
|
@@ -3047,7 +3047,7 @@ import {
|
|
|
3047
3047
|
isAnyPayload as isAnyPayload3,
|
|
3048
3048
|
isBoundWitness,
|
|
3049
3049
|
isHashMeta,
|
|
3050
|
-
PayloadBuilder as
|
|
3050
|
+
PayloadBuilder as PayloadBuilder16
|
|
3051
3051
|
} from "@xyo-network/sdk-js";
|
|
3052
3052
|
import { StepSizes as StepSizes10 } from "@xyo-network/xl1-protocol";
|
|
3053
3053
|
async function schemasStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
|
|
@@ -3064,7 +3064,7 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
|
|
|
3064
3064
|
schemas[schema] = (schemas[schema] ?? 0) + 1;
|
|
3065
3065
|
}
|
|
3066
3066
|
}
|
|
3067
|
-
result = await
|
|
3067
|
+
result = await PayloadBuilder16.addHashMeta({
|
|
3068
3068
|
schema: SchemasStepSummarySchema,
|
|
3069
3069
|
hash: frameHead._hash,
|
|
3070
3070
|
stepSize: -1,
|
|
@@ -3095,7 +3095,7 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
|
|
|
3095
3095
|
schemas[typedSchema] = (schemas[typedSchema] ?? 0) + count;
|
|
3096
3096
|
}
|
|
3097
3097
|
}
|
|
3098
|
-
result = await
|
|
3098
|
+
result = await PayloadBuilder16.addHashMeta({
|
|
3099
3099
|
schema: SchemasStepSummarySchema,
|
|
3100
3100
|
hash: frameHead._hash,
|
|
3101
3101
|
stepSize: frameSize,
|
|
@@ -3107,7 +3107,7 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
|
|
|
3107
3107
|
}
|
|
3108
3108
|
}
|
|
3109
3109
|
}
|
|
3110
|
-
return await
|
|
3110
|
+
return await PayloadBuilder16.addHashMeta(result);
|
|
3111
3111
|
}
|
|
3112
3112
|
|
|
3113
3113
|
// src/summary/primitives/schemas/schemasSummary.ts
|
|
@@ -3142,11 +3142,7 @@ async function schemasSummary(context, semaphores, blockViewer, summaryMap, conf
|
|
|
3142
3142
|
|
|
3143
3143
|
// src/summary/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
3144
3144
|
import { assertEx as assertEx29, spanRootAsync as spanRootAsync5 } from "@xylabs/sdk-js";
|
|
3145
|
-
import {
|
|
3146
|
-
asHashMeta,
|
|
3147
|
-
isAnyPayload as isAnyPayload4,
|
|
3148
|
-
PayloadBuilder as PayloadBuilder18
|
|
3149
|
-
} from "@xyo-network/sdk-js";
|
|
3145
|
+
import { isAnyPayload as isAnyPayload4 } from "@xyo-network/sdk-js";
|
|
3150
3146
|
import { asXL1BlockNumber as asXL1BlockNumber7, StepSizes as StepSizes11 } from "@xyo-network/xl1-protocol";
|
|
3151
3147
|
function transfersSummaryKey(frameHeadHash, frameSize) {
|
|
3152
3148
|
return `${frameHeadHash}|${frameSize}`;
|
|
@@ -3165,19 +3161,19 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
|
|
|
3165
3161
|
transfers[from][to] = toSignedBigInt(amount);
|
|
3166
3162
|
}
|
|
3167
3163
|
}
|
|
3168
|
-
result =
|
|
3164
|
+
result = {
|
|
3169
3165
|
schema: TransfersStepSummarySchema,
|
|
3170
3166
|
hash: frameHead._hash,
|
|
3171
3167
|
stepSize: -1,
|
|
3172
3168
|
transfers
|
|
3173
|
-
}
|
|
3169
|
+
};
|
|
3174
3170
|
} else {
|
|
3175
3171
|
const step = StepSizes11.indexOf(asXL1BlockNumber7(frameSize, true));
|
|
3176
3172
|
assertEx29(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes11.join(", ")}`);
|
|
3177
3173
|
const key = transfersSummaryKey(frameHead._hash, frameSize);
|
|
3178
3174
|
const summaryResult = await summaryMap.get(key);
|
|
3179
3175
|
if (isAnyPayload4(summaryResult)) {
|
|
3180
|
-
result =
|
|
3176
|
+
result = asTransfersStepSummary(summaryResult, { required: true });
|
|
3181
3177
|
} else {
|
|
3182
3178
|
await semaphores[step].acquire();
|
|
3183
3179
|
try {
|
|
@@ -3206,12 +3202,12 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
|
|
|
3206
3202
|
transfers[from][to] = toSignedBigInt(transfer);
|
|
3207
3203
|
}
|
|
3208
3204
|
}
|
|
3209
|
-
result =
|
|
3205
|
+
result = {
|
|
3210
3206
|
schema: TransfersStepSummarySchema,
|
|
3211
3207
|
hash: frameHead._hash,
|
|
3212
3208
|
stepSize: frameSize,
|
|
3213
3209
|
transfers
|
|
3214
|
-
}
|
|
3210
|
+
};
|
|
3215
3211
|
await summaryMap.set(key, result);
|
|
3216
3212
|
} finally {
|
|
3217
3213
|
semaphores[step].release();
|
|
@@ -3680,7 +3676,7 @@ SimpleBlockRewardViewer = __decorateClass([
|
|
|
3680
3676
|
|
|
3681
3677
|
// src/simple/blockValidation/SimpleBlockValidationViewer.ts
|
|
3682
3678
|
import { assertEx as assertEx33 } from "@xylabs/sdk-js";
|
|
3683
|
-
import { PayloadBuilder as
|
|
3679
|
+
import { PayloadBuilder as PayloadBuilder17 } from "@xyo-network/sdk-js";
|
|
3684
3680
|
import {
|
|
3685
3681
|
AccountBalanceViewerMoniker as AccountBalanceViewerMoniker2,
|
|
3686
3682
|
asXL1BlockRange as asXL1BlockRange11,
|
|
@@ -3730,7 +3726,7 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
3730
3726
|
state: true,
|
|
3731
3727
|
head: void 0
|
|
3732
3728
|
};
|
|
3733
|
-
const blocksWithMeta = await Promise.all(blocks.map((b) => Promise.all([
|
|
3729
|
+
const blocksWithMeta = await Promise.all(blocks.map((b) => Promise.all([PayloadBuilder17.addHashMeta(b[0]), PayloadBuilder17.addHashMeta(b[1])])));
|
|
3734
3730
|
const head = isChainQualifiedHeadConfig5(config) ? assertEx33(
|
|
3735
3731
|
(await this.blockViewer.blockByHash(config.head))?.[0],
|
|
3736
3732
|
() => `Specified a head that is not in the chain [${config.head}]`
|
|
@@ -3988,7 +3984,7 @@ RestDataLakeViewer = __decorateClass([
|
|
|
3988
3984
|
|
|
3989
3985
|
// src/simple/datalake/SimpleDataLakeRunner.ts
|
|
3990
3986
|
import { exists as exists7 } from "@xylabs/sdk-js";
|
|
3991
|
-
import { isAnyPayload as isAnyPayload8, PayloadBuilder as
|
|
3987
|
+
import { isAnyPayload as isAnyPayload8, PayloadBuilder as PayloadBuilder18 } from "@xyo-network/sdk-js";
|
|
3992
3988
|
import {
|
|
3993
3989
|
DataLakeRunnerMoniker as DataLakeRunnerMoniker2
|
|
3994
3990
|
} from "@xyo-network/xl1-protocol";
|
|
@@ -4043,7 +4039,7 @@ var SimpleDataLakeRunner = class extends AbstractSimpleDataLake {
|
|
|
4043
4039
|
}
|
|
4044
4040
|
async insert(items) {
|
|
4045
4041
|
const payloads = items.filter(isAnyPayload8).filter((i) => this.isAllowed(i));
|
|
4046
|
-
const hashPairs = await
|
|
4042
|
+
const hashPairs = await PayloadBuilder18.hashPairs(payloads);
|
|
4047
4043
|
for (const [payload, hash] of hashPairs) {
|
|
4048
4044
|
await this.map.set(hash, payload);
|
|
4049
4045
|
}
|
|
@@ -4212,7 +4208,7 @@ import {
|
|
|
4212
4208
|
BigIntToJsonZod,
|
|
4213
4209
|
isDefined as isDefined18
|
|
4214
4210
|
} from "@xylabs/sdk-js";
|
|
4215
|
-
import { PayloadBuilder as
|
|
4211
|
+
import { PayloadBuilder as PayloadBuilder19 } from "@xyo-network/sdk-js";
|
|
4216
4212
|
import {
|
|
4217
4213
|
asXL1BlockNumber as asXL1BlockNumber10,
|
|
4218
4214
|
DataLakeRunnerMoniker as DataLakeRunnerMoniker3,
|
|
@@ -4252,7 +4248,7 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
4252
4248
|
const resolvedNbf = asXL1BlockNumber10(isDefined18(nbf) ? nbf : await viewer.currentBlockNumber(), true);
|
|
4253
4249
|
const resolvedExp = asXL1BlockNumber10(isDefined18(exp) ? exp : resolvedNbf + 10, true);
|
|
4254
4250
|
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await this.signer.address(), fees);
|
|
4255
|
-
return await this.addTransactionToChain(tx, await
|
|
4251
|
+
return await this.addTransactionToChain(tx, await PayloadBuilder19.addHashMeta(offChain));
|
|
4256
4252
|
}
|
|
4257
4253
|
async addTransactionToChain(tx, _offChain) {
|
|
4258
4254
|
const connection = this.connection;
|
|
@@ -4261,8 +4257,8 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
4261
4257
|
let signedTx;
|
|
4262
4258
|
if (isSignedHydratedTransaction(tx)) {
|
|
4263
4259
|
const [bw, payloads] = tx;
|
|
4264
|
-
const hashedBw = await
|
|
4265
|
-
const hashedPayloads = await
|
|
4260
|
+
const hashedBw = await PayloadBuilder19.addHashMeta(bw);
|
|
4261
|
+
const hashedPayloads = await PayloadBuilder19.addHashMeta(payloads);
|
|
4266
4262
|
signedTx = [hashedBw, hashedPayloads];
|
|
4267
4263
|
} else {
|
|
4268
4264
|
signedTx = await signer.signTransaction(tx);
|
|
@@ -4294,7 +4290,7 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
4294
4290
|
BigIntToJsonZod.parse(amount)
|
|
4295
4291
|
])
|
|
4296
4292
|
);
|
|
4297
|
-
const transfer = new
|
|
4293
|
+
const transfer = new PayloadBuilder19({ schema: TransferSchema3 }).fields({
|
|
4298
4294
|
from,
|
|
4299
4295
|
transfers: hexTransfers,
|
|
4300
4296
|
epoch: Date.now()
|
|
@@ -4311,7 +4307,7 @@ import {
|
|
|
4311
4307
|
} from "@xylabs/sdk-js";
|
|
4312
4308
|
import {
|
|
4313
4309
|
isPayloadBundle,
|
|
4314
|
-
PayloadBuilder as
|
|
4310
|
+
PayloadBuilder as PayloadBuilder20
|
|
4315
4311
|
} from "@xyo-network/sdk-js";
|
|
4316
4312
|
import {
|
|
4317
4313
|
BlockValidationViewerMoniker as BlockValidationViewerMoniker2,
|
|
@@ -4473,8 +4469,8 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
|
|
|
4473
4469
|
async submitBlocks(blocks) {
|
|
4474
4470
|
const bundles = await Promise.all(blocks.map(async ([bw, payloads]) => {
|
|
4475
4471
|
return hydratedBlockToPayloadBundle([
|
|
4476
|
-
await
|
|
4477
|
-
await
|
|
4472
|
+
await PayloadBuilder20.addHashMeta(bw),
|
|
4473
|
+
await PayloadBuilder20.addHashMeta(payloads)
|
|
4478
4474
|
]);
|
|
4479
4475
|
}));
|
|
4480
4476
|
const inserted = await this.pendingBlocksArchivist.insert(bundles);
|
|
@@ -4483,8 +4479,8 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
|
|
|
4483
4479
|
async submitTransactions(transactions) {
|
|
4484
4480
|
const bundles = await Promise.all(transactions.map(async ([tx, payloads]) => {
|
|
4485
4481
|
return hydratedTransactionToPayloadBundle([
|
|
4486
|
-
await
|
|
4487
|
-
await
|
|
4482
|
+
await PayloadBuilder20.addHashMeta(tx),
|
|
4483
|
+
await PayloadBuilder20.addHashMeta(payloads)
|
|
4488
4484
|
]);
|
|
4489
4485
|
}));
|
|
4490
4486
|
const inserted = await this.pendingTransactionsArchivist.insert(bundles);
|
|
@@ -4844,7 +4840,7 @@ var MemoryPermissionsStore = class {
|
|
|
4844
4840
|
};
|
|
4845
4841
|
|
|
4846
4842
|
// src/simple/runner/SimpleXyoRunner.ts
|
|
4847
|
-
import { PayloadBuilder as
|
|
4843
|
+
import { PayloadBuilder as PayloadBuilder21 } from "@xyo-network/sdk-js";
|
|
4848
4844
|
import {
|
|
4849
4845
|
MempoolRunnerMoniker as MempoolRunnerMoniker2,
|
|
4850
4846
|
XyoRunnerMoniker
|
|
@@ -4857,7 +4853,7 @@ var SimpleXyoRunner = class extends AbstractCreatableProvider {
|
|
|
4857
4853
|
}
|
|
4858
4854
|
async broadcastTransaction(transaction) {
|
|
4859
4855
|
await this.mempool.submitTransactions([transaction]);
|
|
4860
|
-
const hash = await
|
|
4856
|
+
const hash = await PayloadBuilder21.hash(transaction[0]);
|
|
4861
4857
|
this.logger?.info(`Broadcasted transaction with hash ${hash}`);
|
|
4862
4858
|
return hash;
|
|
4863
4859
|
}
|
|
@@ -4874,7 +4870,7 @@ SimpleXyoRunner = __decorateClass([
|
|
|
4874
4870
|
], SimpleXyoRunner);
|
|
4875
4871
|
|
|
4876
4872
|
// src/simple/signer/SimpleXyoSigner.ts
|
|
4877
|
-
import { Account as Account2, PayloadBuilder as
|
|
4873
|
+
import { Account as Account2, PayloadBuilder as PayloadBuilder22 } from "@xyo-network/sdk-js";
|
|
4878
4874
|
import {
|
|
4879
4875
|
SignedHydratedTransactionWithHashMetaZod,
|
|
4880
4876
|
XyoSignerMoniker as XyoSignerMoniker2
|
|
@@ -4917,7 +4913,7 @@ var SimpleXyoSigner = class _SimpleXyoSigner extends AbstractCreatableProvider {
|
|
|
4917
4913
|
}
|
|
4918
4914
|
async signTransaction(tx) {
|
|
4919
4915
|
const txBW = await signTransaction(tx[0], this.params.account);
|
|
4920
|
-
return SignedHydratedTransactionWithHashMetaZod.parse([await
|
|
4916
|
+
return SignedHydratedTransactionWithHashMetaZod.parse([await PayloadBuilder22.addStorageMeta(txBW), await PayloadBuilder22.addStorageMeta(tx[1])]);
|
|
4921
4917
|
}
|
|
4922
4918
|
};
|
|
4923
4919
|
|