Skip to content

Commit d212cc2

Browse files
committed
Add spend bundle aggregation
1 parent f226a2e commit d212cc2

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@rigidity/chia",
33
"author": "rigidity",
4-
"version": "1.6.1",
4+
"version": "1.7.0",
55
"description": "Chia RPC client and various helper utilities.",
66
"repository": "https://github.com/Rigidity/chia.git",
77
"main": "dist/index.js",

src/utils/spend.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { AugSchemeMPL, JacobianPoint } from '@rigidity/bls-signatures';
2+
import { SpendBundle } from '../types/SpendBundle';
3+
4+
export function aggregateSpendBundles(
5+
spendBundles: SpendBundle[]
6+
): SpendBundle {
7+
return {
8+
coin_spends: spendBundles
9+
.map((spendBundle) => spendBundle.coin_spends)
10+
.flat(),
11+
aggregated_signature: AugSchemeMPL.aggregate(
12+
spendBundles.map((spendBundle) =>
13+
JacobianPoint.fromHexG2(spendBundle.aggregated_signature)
14+
)
15+
).toHex(),
16+
};
17+
}

0 commit comments

Comments
 (0)