@xyo-network/xl1-protocol-sdk 1.5.29 → 1.5.31
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 +261 -14
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/types/block/hydrateBlock.d.ts +12 -0
- package/dist/types/block/hydrateBlock.d.ts.map +1 -0
- package/dist/types/block/index.d.ts +3 -0
- package/dist/types/block/index.d.ts.map +1 -0
- package/dist/types/block/primitives/frames/BlockNumberRange.d.ts +2 -0
- package/dist/types/block/primitives/frames/BlockNumberRange.d.ts.map +1 -0
- package/dist/types/block/primitives/frames/calculateFramesFromRange.d.ts +6 -0
- package/dist/types/block/primitives/frames/calculateFramesFromRange.d.ts.map +1 -0
- package/dist/types/block/primitives/frames/deepCalculateFramesFromRange.d.ts +3 -0
- package/dist/types/block/primitives/frames/deepCalculateFramesFromRange.d.ts.map +1 -0
- package/dist/types/block/primitives/frames/index.d.ts +3 -0
- package/dist/types/block/primitives/frames/index.d.ts.map +1 -0
- package/dist/types/block/primitives/frames/loadFrameSummaries.d.ts +5 -0
- package/dist/types/block/primitives/frames/loadFrameSummaries.d.ts.map +1 -0
- package/dist/types/block/primitives/frames/stepHashFramesFromBlock.d.ts +5 -0
- package/dist/types/block/primitives/frames/stepHashFramesFromBlock.d.ts.map +1 -0
- package/dist/types/block/primitives/index.d.ts +2 -0
- package/dist/types/block/primitives/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/instances/block/BlockFields.d.ts +4 -2
- package/dist/types/instances/block/BlockFields.d.ts.map +1 -1
- package/dist/types/instances/block/HydratedBlock.d.ts +2 -2
- package/dist/types/instances/block/HydratedBlock.d.ts.map +1 -1
- package/dist/types/instances/block/index.d.ts +0 -1
- package/dist/types/instances/block/index.d.ts.map +1 -1
- package/dist/types/instances/transaction/HydratedTransaction.d.ts +2 -1
- package/dist/types/instances/transaction/HydratedTransaction.d.ts.map +1 -1
- package/dist/types/instances/transaction/TransactionFields.d.ts +6 -1
- package/dist/types/instances/transaction/TransactionFields.d.ts.map +1 -1
- package/dist/types/instances/transaction/index.d.ts +0 -1
- package/dist/types/instances/transaction/index.d.ts.map +1 -1
- package/dist/types/transaction/buildTransaction.d.ts +2 -2
- package/dist/types/transaction/buildTransaction.d.ts.map +1 -1
- package/dist/types/transaction/hydrateTransaction.d.ts +3 -3
- package/dist/types/transaction/hydrateTransaction.d.ts.map +1 -1
- package/dist/types/transaction/index.d.ts +1 -1
- package/dist/types/transaction/index.d.ts.map +1 -1
- package/dist/types/transaction/primitives/index.d.ts +5 -0
- package/dist/types/transaction/primitives/index.d.ts.map +1 -0
- package/dist/types/transaction/primitives/transactionBlockByteCount.d.ts +4 -0
- package/dist/types/transaction/primitives/transactionBlockByteCount.d.ts.map +1 -0
- package/dist/types/transaction/primitives/transactionElevatedPayloads.d.ts +6 -0
- package/dist/types/transaction/primitives/transactionElevatedPayloads.d.ts.map +1 -0
- package/dist/types/transaction/primitives/transactionOperations.d.ts +3 -0
- package/dist/types/transaction/primitives/transactionOperations.d.ts.map +1 -0
- package/dist/types/transaction/primitives/transactionRequiredGas.d.ts +6 -0
- package/dist/types/transaction/primitives/transactionRequiredGas.d.ts.map +1 -0
- package/package.json +18 -15
- package/src/block/hydrateBlock.ts +83 -0
- package/src/block/index.ts +2 -0
- package/src/block/primitives/frames/BlockNumberRange.ts +1 -0
- package/src/block/primitives/frames/calculateFramesFromRange.ts +29 -0
- package/src/block/primitives/frames/deepCalculateFramesFromRange.ts +27 -0
- package/src/block/primitives/frames/index.ts +2 -0
- package/src/block/primitives/frames/loadFrameSummaries.ts +12 -0
- package/src/block/primitives/frames/stepHashFramesFromBlock.ts +72 -0
- package/src/block/primitives/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/instances/block/BlockFields.ts +7 -3
- package/src/instances/block/HydratedBlock.ts +2 -3
- package/src/instances/block/index.ts +0 -1
- package/src/instances/transaction/HydratedTransaction.ts +2 -1
- package/src/instances/transaction/TransactionFields.ts +9 -1
- package/src/instances/transaction/index.ts +0 -1
- package/src/transaction/buildTransaction.ts +2 -2
- package/src/transaction/hydrateTransaction.ts +7 -7
- package/src/transaction/index.ts +1 -1
- package/src/transaction/primitives/index.ts +4 -0
- package/src/transaction/primitives/transactionBlockByteCount.ts +10 -0
- package/src/transaction/primitives/transactionElevatedPayloads.ts +16 -0
- package/src/transaction/primitives/transactionOperations.ts +11 -0
- package/src/transaction/primitives/transactionRequiredGas.ts +21 -0
- package/dist/types/instances/block/SignedHydratedBlock.d.ts +0 -6
- package/dist/types/instances/block/SignedHydratedBlock.d.ts.map +0 -1
- package/dist/types/instances/transaction/SignedHydratedTransaction.d.ts +0 -6
- package/dist/types/instances/transaction/SignedHydratedTransaction.d.ts.map +0 -1
- package/dist/types/transaction/transactionRequiredGas.d.ts +0 -4
- package/dist/types/transaction/transactionRequiredGas.d.ts.map +0 -1
- package/knip.config.ts +0 -15
- package/src/instances/block/SignedHydratedBlock.ts +0 -6
- package/src/instances/transaction/SignedHydratedTransaction.ts +0 -8
- package/src/transaction/transactionRequiredGas.ts +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/transaction/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/transaction/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/hex';
|
|
2
2
|
import type { AccountInstance } from '@xyo-network/account-model';
|
|
3
3
|
import type { Payload } from '@xyo-network/payload-model';
|
|
4
|
-
import { type AllowedBlockPayload, type
|
|
5
|
-
export declare function buildTransaction(chain: Address, elevatedPayloads: AllowedBlockPayload[], additionalPayloads: Payload[], signer: AccountInstance | AccountInstance[], nbf: number, exp: number, from?: Address, fees?: TransactionFeesBigInt): Promise<
|
|
4
|
+
import { type AllowedBlockPayload, type HydratedTransaction, type TransactionFeesBigInt } from '@xyo-network/xl1-protocol';
|
|
5
|
+
export declare function buildTransaction(chain: Address, elevatedPayloads: AllowedBlockPayload[], additionalPayloads: Payload[], signer: AccountInstance | AccountInstance[], nbf: number, exp: number, from?: Address, fees?: TransactionFeesBigInt): Promise<HydratedTransaction>;
|
|
6
6
|
//# sourceMappingURL=buildTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTransaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/buildTransaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,
|
|
1
|
+
{"version":3,"file":"buildTransaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/buildTransaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,mBAAmB,EAAoE,KAAK,qBAAqB,EACvH,MAAM,2BAA2B,CAAA;AAElC,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,OAAO,EACd,gBAAgB,EAAE,mBAAmB,EAAE,EACvC,kBAAkB,EAAE,OAAO,EAAE,EAC7B,MAAM,EAAE,eAAe,GAAG,eAAe,EAAE,EAC3C,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,OAAO,EACd,IAAI,GAAE,qBAA8C,GACnD,OAAO,CAAC,mBAAmB,CAAC,CAmC9B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Hash } from '@xylabs/hex';
|
|
2
2
|
import type { ReadArchivist } from '@xyo-network/archivist-model';
|
|
3
3
|
import type { Payload } from '@xyo-network/payload-model';
|
|
4
|
-
import type { HydratedTransaction
|
|
5
|
-
export declare const tryHydrateTransaction: (archivist: ReadArchivist, hash: Hash) => Promise<
|
|
6
|
-
export declare const hydrateTransaction: (archivist: ReadArchivist, hash: Hash) => Promise<
|
|
4
|
+
import type { HydratedTransaction } from '@xyo-network/xl1-protocol';
|
|
5
|
+
export declare const tryHydrateTransaction: (archivist: ReadArchivist, hash: Hash) => Promise<HydratedTransaction | undefined>;
|
|
6
|
+
export declare const hydrateTransaction: (archivist: ReadArchivist, hash: Hash) => Promise<HydratedTransaction>;
|
|
7
7
|
export declare const flattenHydratedTransaction: (hydratedTransaction: HydratedTransaction) => Payload[];
|
|
8
8
|
export declare const flattenHydratedTransactions: (hydratedTransactions: HydratedTransaction[]) => Payload[];
|
|
9
9
|
export declare const tryHydrateElevatedTransaction: (archivist: ReadArchivist, hash: Hash) => Promise<HydratedTransaction | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrateTransaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/hydrateTransaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAEjE,OAAO,KAAK,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"hydrateTransaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/hydrateTransaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAEjE,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,2BAA2B,CAAA;AAGlC,eAAO,MAAM,qBAAqB,GAChC,WAAW,aAAa,EACxB,MAAM,IAAI,KACT,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAMzC,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,WAAW,aAAa,EACxB,MAAM,IAAI,KACT,OAAO,CAAC,mBAAmB,CAM7B,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAI,qBAAqB,mBAAmB,KAAG,OAAO,EAG5F,CAAA;AAED,eAAO,MAAM,2BAA2B,GAAI,sBAAsB,mBAAmB,EAAE,KAAG,OAAO,EAC7B,CAAA;AAEpE,eAAO,MAAM,6BAA6B,GACxC,WAAW,aAAa,EACxB,MAAM,IAAI,KACT,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAqBzC,CAAA;AAED,eAAO,MAAM,0BAA0B,GACrC,WAAW,aAAa,EACxB,MAAM,IAAI,KACT,OAAO,CAAC,mBAAmB,CAE7B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transaction/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kCAAkC,CAAA;AAChD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HydratedTransaction } from '@xyo-network/xl1-protocol';
|
|
2
|
+
/** The number of bytes that a transaction and its payloads will take up in a block */
|
|
3
|
+
export declare function transactionBlockByteCount([transaction, payloads]: HydratedTransaction): number;
|
|
4
|
+
//# sourceMappingURL=transactionBlockByteCount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionBlockByteCount.d.ts","sourceRoot":"","sources":["../../../../src/transaction/primitives/transactionBlockByteCount.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAEpE,sFAAsF;AACtF,wBAAgB,yBAAyB,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAK9F"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Hash } from '@xylabs/hex';
|
|
2
|
+
import type { Payload, WithHashStorageMeta } from '@xyo-network/payload-model';
|
|
3
|
+
import type { HydratedTransaction, TransactionBoundWitness } from '@xyo-network/xl1-protocol';
|
|
4
|
+
export declare function transactionElevatedPayloadHashes(transaction: TransactionBoundWitness): Hash[];
|
|
5
|
+
export declare function transactionElevatedPayloads([transaction, payloads]: HydratedTransaction): WithHashStorageMeta<Payload>[];
|
|
6
|
+
//# sourceMappingURL=transactionElevatedPayloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionElevatedPayloads.d.ts","sourceRoot":"","sources":["../../../../src/transaction/primitives/transactionElevatedPayloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,IAAI,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAI7F,wBAAgB,gCAAgC,CAAC,WAAW,EAAE,uBAAuB,GAAG,IAAI,EAAE,CAG7F;AAED,wBAAgB,2BAA2B,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAIxH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionOperations.d.ts","sourceRoot":"","sources":["../../../../src/transaction/primitives/transactionOperations.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAMpE;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAE1E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HydratedTransaction } from '@xyo-network/xl1-protocol';
|
|
2
|
+
import { AttoXL1 } from '@xyo-network/xl1-protocol';
|
|
3
|
+
/** The required gas for the byte storage on the block chain for a transaction */
|
|
4
|
+
export declare function transactionBytesRequiredGas([transaction, payloads]: HydratedTransaction): AttoXL1;
|
|
5
|
+
export declare function transactionRequiredGas(hydratedTransaction: HydratedTransaction): AttoXL1;
|
|
6
|
+
//# sourceMappingURL=transactionRequiredGas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionRequiredGas.d.ts","sourceRoot":"","sources":["../../../../src/transaction/primitives/transactionRequiredGas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AACpE,OAAO,EAAE,OAAO,EAAuB,MAAM,2BAA2B,CAAA;AAKxE,iFAAiF;AACjF,wBAAgB,2BAA2B,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAGjG;AAED,wBAAgB,sBAAsB,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,OAAO,CAQxF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/xl1-protocol-sdk",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.31",
|
|
5
5
|
"description": "XYO Layer One SDK Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -34,24 +34,27 @@
|
|
|
34
34
|
"deploy3": "echo Deploy3 not allowed!"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xylabs/
|
|
38
|
-
"@xylabs/
|
|
39
|
-
"@xylabs/
|
|
40
|
-
"@xylabs/
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@xyo-network/
|
|
44
|
-
"@xyo-network/
|
|
45
|
-
"@xyo-network/
|
|
46
|
-
"@xyo-network/
|
|
47
|
-
"@xyo-network/
|
|
37
|
+
"@xylabs/array": "^4.11.20",
|
|
38
|
+
"@xylabs/assert": "^4.11.20",
|
|
39
|
+
"@xylabs/hex": "^4.11.20",
|
|
40
|
+
"@xylabs/object": "^4.11.20",
|
|
41
|
+
"@xylabs/promise": "^4.11.20",
|
|
42
|
+
"@xylabs/typeof": "^4.11.20",
|
|
43
|
+
"@xyo-network/account-model": "^3.18.8",
|
|
44
|
+
"@xyo-network/archivist-model": "^3.18.8",
|
|
45
|
+
"@xyo-network/boundwitness-builder": "^3.18.8",
|
|
46
|
+
"@xyo-network/boundwitness-model": "^3.18.8",
|
|
47
|
+
"@xyo-network/payload-builder": "^3.18.8",
|
|
48
|
+
"@xyo-network/payload-model": "^3.18.8",
|
|
49
|
+
"@xyo-network/xl1-protocol": "^1.4.33"
|
|
48
50
|
},
|
|
49
51
|
"devDependencies": {
|
|
50
|
-
"@types/node": "^
|
|
52
|
+
"@types/node": "^24.0.1",
|
|
51
53
|
"@xylabs/ts-scripts-yarn3": "^6.5.8",
|
|
52
54
|
"@xylabs/tsconfig": "^6.5.8",
|
|
53
|
-
"knip": "^5.
|
|
54
|
-
"typescript": "^5.8.3"
|
|
55
|
+
"knip": "^5.61.0",
|
|
56
|
+
"typescript": "^5.8.3",
|
|
57
|
+
"vitest": "^3.2.3"
|
|
55
58
|
},
|
|
56
59
|
"engines": {
|
|
57
60
|
"node": ">=22.3 <23"
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { filterAs } from '@xylabs/array'
|
|
2
|
+
import { assertEx } from '@xylabs/assert'
|
|
3
|
+
import type { Hash } from '@xylabs/hex'
|
|
4
|
+
import type { ReadArchivist } from '@xyo-network/archivist-model'
|
|
5
|
+
import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
|
|
6
|
+
import type { HydratedBlock, TransactionBoundWitness } from '@xyo-network/xl1-protocol'
|
|
7
|
+
import {
|
|
8
|
+
asBlockBoundWitnessWithStorageMeta, asTransactionBoundWitnessWithStorageMeta, isTransactionBoundWitnessWithStorageMeta,
|
|
9
|
+
} from '@xyo-network/xl1-protocol'
|
|
10
|
+
|
|
11
|
+
export function allHashesPresent(hashes: Hash[], payloads: WithStorageMeta<Payload>[]): boolean {
|
|
12
|
+
const payloadHashes = new Set(payloads.map(p => p._hash))
|
|
13
|
+
return hashes.every(hash => payloadHashes.has(hash))
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const tryHydrateBlock = async (
|
|
17
|
+
archivist: ReadArchivist,
|
|
18
|
+
hash: Hash,
|
|
19
|
+
maxDepth: number = 1,
|
|
20
|
+
minDepth?: number,
|
|
21
|
+
): Promise<HydratedBlock | undefined> => {
|
|
22
|
+
try {
|
|
23
|
+
return await hydrateBlock(archivist, hash, maxDepth, minDepth)
|
|
24
|
+
} catch (e) {
|
|
25
|
+
if (e instanceof Error) {
|
|
26
|
+
console.warn(`Failed to hydrate block ${hash}: ${e.message}`)
|
|
27
|
+
} else {
|
|
28
|
+
console.warn(`Failed to hydrate block ${hash}: ${e}`)
|
|
29
|
+
}
|
|
30
|
+
return undefined
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const hydrateBlock = async (
|
|
35
|
+
archivist: ReadArchivist,
|
|
36
|
+
hash: Hash,
|
|
37
|
+
maxDepth: number = 1,
|
|
38
|
+
minDepth?: number,
|
|
39
|
+
): Promise<HydratedBlock> => {
|
|
40
|
+
if (minDepth === undefined) minDepth = maxDepth
|
|
41
|
+
assertEx(maxDepth >= 0, () => 'maxDepth must be greater than or equal to 0')
|
|
42
|
+
assertEx(minDepth >= 0, () => 'minDepth must be greater than or equal to 0')
|
|
43
|
+
assertEx(maxDepth >= minDepth, () => 'maxDepth must be greater than or equal to minDepth')
|
|
44
|
+
const bw = assertEx(
|
|
45
|
+
filterAs(await archivist.get([hash]), asBlockBoundWitnessWithStorageMeta).at(0),
|
|
46
|
+
() => `block ${hash} not found`,
|
|
47
|
+
)
|
|
48
|
+
if (maxDepth === 0) return [bw, []]
|
|
49
|
+
const blkPayloads = await archivist.get(bw.payload_hashes)
|
|
50
|
+
if (minDepth === 1) assertEx(allHashesPresent(bw.payload_hashes, blkPayloads), () => `Unable to find all payloads for block ${hash}`)
|
|
51
|
+
if (maxDepth === 1) return [bw, blkPayloads]
|
|
52
|
+
const transactions = filterAs(blkPayloads, asTransactionBoundWitnessWithStorageMeta)
|
|
53
|
+
const transactionsPayloadHashes = transactions.flatMap(tx => tx.payload_hashes)
|
|
54
|
+
const transactionsPayloads = await archivist.get(transactionsPayloadHashes)
|
|
55
|
+
assertEx(allHashesPresent(transactionsPayloadHashes, transactionsPayloads), () => `Unable to find all payloads for transactions in block ${hash}`)
|
|
56
|
+
const allPayloadsHashes = new Set([...blkPayloads, ...transactionsPayloads].flatMap(p => p._hash))
|
|
57
|
+
const allPayloads = await archivist.get([...allPayloadsHashes])
|
|
58
|
+
const allPayloadsFiltered = allPayloads.filter(p => allPayloadsHashes.has(p._hash))
|
|
59
|
+
if (maxDepth === 2) assertEx(allHashesPresent(
|
|
60
|
+
[...allPayloadsHashes],
|
|
61
|
+
allPayloadsFiltered,
|
|
62
|
+
), () => `Unable to find all payloads for transactions in block ${hash}`)
|
|
63
|
+
return [bw, allPayloadsFiltered]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const flattenHydratedBlock = (hydratedBlock: HydratedBlock): WithStorageMeta<Payload>[] => {
|
|
67
|
+
const [blk, blkPayloads] = hydratedBlock
|
|
68
|
+
return [...blkPayloads, blk]
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const flattenHydratedBlocks = (hydratedBlocks: HydratedBlock[]): WithStorageMeta<Payload>[] =>
|
|
72
|
+
hydratedBlocks.flatMap(blk => flattenHydratedBlock(blk))
|
|
73
|
+
|
|
74
|
+
export const transactionsFromHydratedBlock = (block: HydratedBlock): WithStorageMeta<TransactionBoundWitness>[] => {
|
|
75
|
+
return filterAs(block[1], asTransactionBoundWitnessWithStorageMeta)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const blockPayloadsFromHydratedBlock = (block: HydratedBlock): WithStorageMeta<Payload>[] => {
|
|
79
|
+
return block[0].payload_hashes.map(hash => assertEx(
|
|
80
|
+
block[1].find(p => p._hash === hash),
|
|
81
|
+
() => `missing payload ${hash}`,
|
|
82
|
+
)).filter(x => !isTransactionBoundWitnessWithStorageMeta(x))
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type BlockNumberRange = [number, number]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { stepSizeV2 } from '@xyo-network/xl1-protocol'
|
|
2
|
+
|
|
3
|
+
import type { BlockNumberRange } from './BlockNumberRange.ts'
|
|
4
|
+
|
|
5
|
+
export function calculateFramesFromRange(range: BlockNumberRange, step: number): [
|
|
6
|
+
// ranges of fitted frames
|
|
7
|
+
BlockNumberRange[],
|
|
8
|
+
// ranges of remaining blocks
|
|
9
|
+
BlockNumberRange[]] {
|
|
10
|
+
const size = stepSizeV2(step)
|
|
11
|
+
let start = (Math.trunc(range[0] / size)) * size
|
|
12
|
+
const fitted: BlockNumberRange[] = []
|
|
13
|
+
const remaining: BlockNumberRange[] = []
|
|
14
|
+
|
|
15
|
+
// if the start is not aligned with the range, add a remaining block
|
|
16
|
+
if (start !== range[0]) {
|
|
17
|
+
start += size
|
|
18
|
+
remaining.push([range[0], Math.min(start - 1, range[1])])
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
for (let i = start; i <= range[1]; i += size) {
|
|
22
|
+
if ((i + size - 1) <= range[1]) {
|
|
23
|
+
fitted.push([i, Math.min(i + size - 1, range[1])])
|
|
24
|
+
} else {
|
|
25
|
+
remaining.push([i, range[1]])
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return [fitted, remaining]
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { StepSizesV2 } from '@xyo-network/xl1-protocol'
|
|
2
|
+
|
|
3
|
+
import type { BlockNumberRange } from './BlockNumberRange.ts'
|
|
4
|
+
import { calculateFramesFromRange } from './calculateFramesFromRange.ts'
|
|
5
|
+
|
|
6
|
+
export function deepCalculateFramesFromRange(range: BlockNumberRange, startingStep = StepSizesV2.length - 1): BlockNumberRange[] {
|
|
7
|
+
const fitted: BlockNumberRange[] = []
|
|
8
|
+
let remaining: BlockNumberRange[] = [range]
|
|
9
|
+
|
|
10
|
+
for (let step = startingStep; step >= 0; step--) {
|
|
11
|
+
const newRemaining: BlockNumberRange[] = []
|
|
12
|
+
for (const range of remaining) {
|
|
13
|
+
const [newFittedFrames, newRemainingFrames] = calculateFramesFromRange(range, step)
|
|
14
|
+
fitted.push(...newFittedFrames)
|
|
15
|
+
newRemaining.push(...newRemainingFrames)
|
|
16
|
+
}
|
|
17
|
+
remaining = newRemaining
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
for (const range of remaining) {
|
|
21
|
+
for (let i = range[0]; i <= range[1]; i++) {
|
|
22
|
+
fitted.push([i, i]) // Add individual frames for remaining ranges
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return fitted.toSorted((a, b) => a[0] - b[0]) // Sort by start of range
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
2
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
3
|
+
|
|
4
|
+
import type { BlockNumberRange } from './BlockNumberRange.ts'
|
|
5
|
+
|
|
6
|
+
export async function loadFrameSummaries(
|
|
7
|
+
ranges: BlockNumberRange[],
|
|
8
|
+
finalizedArchivist: ArchivistInstance,
|
|
9
|
+
summaryArchivist: ArchivistInstance,
|
|
10
|
+
): Promise<Payload[]> {
|
|
11
|
+
return await Promise.resolve([])
|
|
12
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { assertEx } from '@xylabs/assert'
|
|
2
|
+
import { type Hash, isHash } from '@xylabs/hex'
|
|
3
|
+
import { isDefined } from '@xylabs/typeof'
|
|
4
|
+
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
5
|
+
import { isBlockBoundWitness, StepSizes } from '@xyo-network/xl1-protocol'
|
|
6
|
+
|
|
7
|
+
// get the list of step frames for a block at a specific step size index
|
|
8
|
+
export async function stepHashFramesFromBlockAtSize(archivist: ArchivistInstance, head: Hash, sizeIndex: number) {
|
|
9
|
+
if (!Number.isInteger(sizeIndex) || sizeIndex < 0 || sizeIndex >= StepSizes.length) {
|
|
10
|
+
throw new Error(`Invalid sizeIndex: ${sizeIndex}`)
|
|
11
|
+
}
|
|
12
|
+
let currentHead = head
|
|
13
|
+
const steps: [Hash, number, number][] = []
|
|
14
|
+
while (isHash(currentHead)) {
|
|
15
|
+
const [block] = await archivist.get([currentHead])
|
|
16
|
+
if (!isBlockBoundWitness(block)) {
|
|
17
|
+
throw new Error(`Block with hash ${currentHead} not found`)
|
|
18
|
+
}
|
|
19
|
+
let stepHash = block.step_hashes.at(sizeIndex)
|
|
20
|
+
while (isDefined(stepHash)) {
|
|
21
|
+
const [stepHashBlock] = await archivist.get([stepHash])
|
|
22
|
+
if (!isBlockBoundWitness(stepHashBlock)) {
|
|
23
|
+
throw new Error(`StepHashBlock with hash ${currentHead} not found`)
|
|
24
|
+
}
|
|
25
|
+
const [lastBlockInStep] = await archivist.get([assertEx(stepHashBlock.previous, () => 'StepHashBlock must have a previous block')])
|
|
26
|
+
if (!isBlockBoundWitness(lastBlockInStep)) {
|
|
27
|
+
throw new Error(`StepHashBlock with hash ${currentHead} not found`)
|
|
28
|
+
}
|
|
29
|
+
steps.push([stepHash, stepHashBlock.block - StepSizes[sizeIndex], stepHashBlock.block - 1])
|
|
30
|
+
stepHash = lastBlockInStep.step_hashes.at(sizeIndex)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return steps
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// TODO: Figure out how to get ranges of smaller blocks for each available range
|
|
37
|
+
export async function stepHashFramesFromBlock(archivist: ArchivistInstance, head: Hash) {
|
|
38
|
+
const [block] = await archivist.get([head])
|
|
39
|
+
if (!isBlockBoundWitness(block)) {
|
|
40
|
+
throw new Error(`Block with hash ${head} not found`)
|
|
41
|
+
}
|
|
42
|
+
let availableRanges: [number, number][] = [[0, block.block]]
|
|
43
|
+
const foundRanges: [Hash, number, number][] = []
|
|
44
|
+
// fit biggest to smallest
|
|
45
|
+
for (let i = StepSizes.length - 1; i >= 0; i--) {
|
|
46
|
+
const steps = await stepHashFramesFromBlockAtSize(archivist, head, i)
|
|
47
|
+
for (let step of steps) {
|
|
48
|
+
const [, start, end] = step
|
|
49
|
+
if (availableRanges.some(range => range[0] <= start && range[1] >= end)) {
|
|
50
|
+
foundRanges.push(step)
|
|
51
|
+
availableRanges = availableRanges.flatMap((range) => {
|
|
52
|
+
if (range[0] >= start && range[1] <= end) {
|
|
53
|
+
// remove the range
|
|
54
|
+
return [[range[0], start - 1]]
|
|
55
|
+
} else if (range[0] < start && range[1] >= end) {
|
|
56
|
+
// split the range
|
|
57
|
+
return [[range[0], start - 1], [end + 1, range[1]]]
|
|
58
|
+
} else if (range[0] < start && range[1] < end) {
|
|
59
|
+
// adjust the end of the range
|
|
60
|
+
return [[range[0], start - 1]]
|
|
61
|
+
} else if (range[0] > start && range[1] > end) {
|
|
62
|
+
// adjust the start of the range
|
|
63
|
+
return [[end + 1, range[1]]]
|
|
64
|
+
}
|
|
65
|
+
// otherwise, return the range as is
|
|
66
|
+
return [range]
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return foundRanges
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './frames/index.ts'
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import type { SignatureInstance } from '../Signature.ts'
|
|
2
|
+
|
|
1
3
|
export interface BlockFieldsInstance<TTransactionResult> {
|
|
2
|
-
|
|
4
|
+
reward: bigint
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
signatureCount: number
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
signatures: SignatureInstance[]
|
|
7
9
|
|
|
8
10
|
transactionCount: number
|
|
9
11
|
|
|
10
12
|
transactions: TTransactionResult[]
|
|
11
13
|
|
|
14
|
+
signature(index: number): SignatureInstance | undefined
|
|
15
|
+
|
|
12
16
|
transaction(index: number): TTransactionResult | undefined
|
|
13
17
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { HydratedBlock } from '@xyo-network/xl1-protocol'
|
|
2
2
|
|
|
3
3
|
import type { HydratedBoundWitnessInstance } from '../HydratedBoundWitness.ts'
|
|
4
|
+
import type { SignedInstance } from '../modifiers/Signed.ts'
|
|
4
5
|
import type { HydratedTransactionInstance } from '../transaction/index.ts'
|
|
5
6
|
import type { BlockFieldsInstance } from './BlockFields.ts'
|
|
6
7
|
|
|
7
8
|
export interface HydratedBlockInstance<T extends HydratedBlock = HydratedBlock> extends
|
|
8
|
-
BlockFieldsInstance<HydratedTransactionInstance>, HydratedBoundWitnessInstance<T
|
|
9
|
-
publicPayloads: T[1][number][]
|
|
10
|
-
}
|
|
9
|
+
BlockFieldsInstance<HydratedTransactionInstance>, HydratedBoundWitnessInstance<T>, SignedInstance {}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AllowedBlockPayload, HydratedTransaction } from '@xyo-network/xl1-protocol'
|
|
2
2
|
|
|
3
3
|
import type { HydratedBoundWitnessInstance } from '../HydratedBoundWitness.ts'
|
|
4
|
+
import type { SignedInstance } from '../modifiers/Signed.ts'
|
|
4
5
|
import type { TransactionFieldsInstance } from './TransactionFields.ts'
|
|
5
6
|
|
|
6
7
|
export interface HydratedTransactionInstance<T extends HydratedTransaction = HydratedTransaction,
|
|
7
8
|
TElevatedPayload extends AllowedBlockPayload = AllowedBlockPayload>
|
|
8
|
-
extends TransactionFieldsInstance<T[1][number] & TElevatedPayload>, HydratedBoundWitnessInstance<T
|
|
9
|
+
extends TransactionFieldsInstance<T[1][number] & TElevatedPayload>, HydratedBoundWitnessInstance<T>, SignedInstance {
|
|
9
10
|
}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
import type {
|
|
3
|
+
Payload, Schema, WithStorageMeta,
|
|
4
|
+
} from '@xyo-network/payload-model'
|
|
1
5
|
import type { AllowedBlockPayload } from '@xyo-network/xl1-protocol'
|
|
2
6
|
|
|
3
7
|
import type { TransactionFeesInstance } from '../Fees.ts'
|
|
4
8
|
|
|
5
9
|
export interface TransactionFieldsInstance<TBlockPayload extends AllowedBlockPayload = AllowedBlockPayload> {
|
|
6
10
|
elevatedPayloadCount: number
|
|
7
|
-
elevatedPayloads: TBlockPayload[]
|
|
11
|
+
elevatedPayloads: WithStorageMeta<TBlockPayload>[]
|
|
12
|
+
externalPayloads: Record<Hash, Schema | Payload>
|
|
8
13
|
|
|
9
14
|
fees: TransactionFeesInstance
|
|
10
15
|
|
|
16
|
+
privateExternalPayloads: Record<Hash, Schema>
|
|
17
|
+
publicExternalPayloads: Payload[]
|
|
18
|
+
|
|
11
19
|
elevatedPayload(index: number): TBlockPayload | undefined
|
|
12
20
|
reward(): bigint
|
|
13
21
|
}
|
|
@@ -8,7 +8,7 @@ import type { Payload } from '@xyo-network/payload-model'
|
|
|
8
8
|
import {
|
|
9
9
|
type AllowedBlockPayload,
|
|
10
10
|
defaultTransactionFees,
|
|
11
|
-
type
|
|
11
|
+
type HydratedTransaction, type TransactionBoundWitness, type TransactionBoundWitnessFields, type TransactionFeesBigInt,
|
|
12
12
|
} from '@xyo-network/xl1-protocol'
|
|
13
13
|
|
|
14
14
|
export async function buildTransaction(
|
|
@@ -20,7 +20,7 @@ export async function buildTransaction(
|
|
|
20
20
|
exp: number,
|
|
21
21
|
from?: Address,
|
|
22
22
|
fees: TransactionFeesBigInt = defaultTransactionFees,
|
|
23
|
-
): Promise<
|
|
23
|
+
): Promise<HydratedTransaction> {
|
|
24
24
|
if (from === undefined && Array.isArray(signer)) {
|
|
25
25
|
throw new Error('from is required when signer is an array')
|
|
26
26
|
}
|
|
@@ -2,33 +2,33 @@ import { assertEx } from '@xylabs/assert'
|
|
|
2
2
|
import type { Hash } from '@xylabs/hex'
|
|
3
3
|
import type { ReadArchivist } from '@xyo-network/archivist-model'
|
|
4
4
|
import { hydrateTypedBoundWitness, tryHydrateTypedBoundWitness } from '@xyo-network/archivist-model'
|
|
5
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
+
import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
|
|
6
6
|
import type {
|
|
7
7
|
AllowedBlockPayload,
|
|
8
|
-
HydratedTransaction,
|
|
8
|
+
HydratedTransaction, TransactionBoundWitness,
|
|
9
9
|
} from '@xyo-network/xl1-protocol'
|
|
10
10
|
import { isAllowedBlockPayload, isTransactionBoundWitnessWithStorageMeta } from '@xyo-network/xl1-protocol'
|
|
11
11
|
|
|
12
12
|
export const tryHydrateTransaction = async (
|
|
13
13
|
archivist: ReadArchivist,
|
|
14
14
|
hash: Hash,
|
|
15
|
-
): Promise<
|
|
15
|
+
): Promise<HydratedTransaction | undefined> => {
|
|
16
16
|
return (await tryHydrateTypedBoundWitness<TransactionBoundWitness>(
|
|
17
17
|
archivist,
|
|
18
18
|
hash,
|
|
19
19
|
isTransactionBoundWitnessWithStorageMeta,
|
|
20
|
-
)) as
|
|
20
|
+
)) as HydratedTransaction | undefined
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export const hydrateTransaction = async (
|
|
24
24
|
archivist: ReadArchivist,
|
|
25
25
|
hash: Hash,
|
|
26
|
-
): Promise<
|
|
26
|
+
): Promise<HydratedTransaction> => {
|
|
27
27
|
return await hydrateTypedBoundWitness<TransactionBoundWitness>(
|
|
28
28
|
archivist,
|
|
29
29
|
hash,
|
|
30
30
|
isTransactionBoundWitnessWithStorageMeta,
|
|
31
|
-
) as
|
|
31
|
+
) as HydratedTransaction
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export const flattenHydratedTransaction = (hydratedTransaction: HydratedTransaction): Payload[] => {
|
|
@@ -49,7 +49,7 @@ export const tryHydrateElevatedTransaction = async (
|
|
|
49
49
|
}
|
|
50
50
|
const [transaction, payloads] = hydratedTransaction
|
|
51
51
|
const opCodes = (transaction.script ?? []).filter(operation => operation.startsWith('elevate|'))
|
|
52
|
-
const elevatedPayloads: AllowedBlockPayload[] = []
|
|
52
|
+
const elevatedPayloads: WithStorageMeta<AllowedBlockPayload>[] = []
|
|
53
53
|
for (const opCode of opCodes) {
|
|
54
54
|
const [code, hash] = opCode.split('|')
|
|
55
55
|
if (code === 'elevated') {
|
package/src/transaction/index.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
2
|
+
import type { HydratedTransaction } from '@xyo-network/xl1-protocol'
|
|
3
|
+
|
|
4
|
+
/** The number of bytes that a transaction and its payloads will take up in a block */
|
|
5
|
+
export function transactionBlockByteCount([transaction, payloads]: HydratedTransaction): number {
|
|
6
|
+
const cleanTransaction = PayloadBuilder.omitStorageMeta(transaction)
|
|
7
|
+
const transactionBytes = JSON.stringify(cleanTransaction).length
|
|
8
|
+
const cleanPayloads = PayloadBuilder.omitStorageMeta(payloads)
|
|
9
|
+
return cleanPayloads.reduce((acc: number, payload) => acc + JSON.stringify(payload).length, 0) + transactionBytes
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { asHash, type Hash } from '@xylabs/hex'
|
|
2
|
+
import type { Payload, WithHashStorageMeta } from '@xyo-network/payload-model'
|
|
3
|
+
import type { HydratedTransaction, TransactionBoundWitness } from '@xyo-network/xl1-protocol'
|
|
4
|
+
|
|
5
|
+
import { crackOperations } from './transactionOperations.ts'
|
|
6
|
+
|
|
7
|
+
export function transactionElevatedPayloadHashes(transaction: TransactionBoundWitness): Hash[] {
|
|
8
|
+
const elevateOperations = crackOperations(transaction.script ?? []).filter(op => op[0] === 'elevate')
|
|
9
|
+
return elevateOperations.map(op => asHash(op[1][0], true))
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function transactionElevatedPayloads([transaction, payloads]: HydratedTransaction): WithHashStorageMeta<Payload>[] {
|
|
13
|
+
const hashes = transactionElevatedPayloadHashes(transaction)
|
|
14
|
+
const elevatedPayloads = payloads.filter(payload => hashes.includes(payload._hash))
|
|
15
|
+
return elevatedPayloads
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function crackOperation(operation: string): [string, string[]] {
|
|
2
|
+
const parts = operation.split('|')
|
|
3
|
+
if (parts.length < 2) {
|
|
4
|
+
throw new Error(`Invalid operation format: ${operation}`)
|
|
5
|
+
}
|
|
6
|
+
return [parts[0], parts.slice(1)]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function crackOperations(operations: string[]): [string, string[]][] {
|
|
10
|
+
return operations.map(op => crackOperation(op))
|
|
11
|
+
}
|