Skip to content

Commit

Permalink
Merge branch '98-update-tss-sign-function-interface' into 'dev'
Browse files Browse the repository at this point in the history
Resolve "update tss sign function interface"

Closes #98 and #95

See merge request ergo/rosen-bridge/rosen-chains!107
  • Loading branch information
zargarzadehm committed Apr 5, 2024
2 parents 57c41dd + a20f147 commit ca36479
Show file tree
Hide file tree
Showing 45 changed files with 250 additions and 150 deletions.
2 changes: 0 additions & 2 deletions .changeset/big-pumpkins-grab.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/clean-insects-wink.md

This file was deleted.

10 changes: 0 additions & 10 deletions .changeset/eighty-jokes-warn.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/hot-chairs-march.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/large-ants-double.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/lazy-cameras-perform.md

This file was deleted.

2 changes: 0 additions & 2 deletions .changeset/little-otters-hide.md

This file was deleted.

2 changes: 0 additions & 2 deletions .changeset/red-games-switch.md

This file was deleted.

File renamed without changes.
7 changes: 0 additions & 7 deletions .changeset/soft-mayflies-hug.md

This file was deleted.

2 changes: 0 additions & 2 deletions .changeset/spicy-papayas-argue.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/thirty-maps-swim.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tidy-boats-yawn.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/wild-tips-share.md

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/young-walls-whisper.md

This file was deleted.

52 changes: 26 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions packages/abstract-chain/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @rosen-chains/abstract-chain

## 6.0.0

### Major Changes

- add generateMultipleTransactions to AbstractChain and implement generateTransaction
- implement verifyEvent and add verifyLockTransactionExtraConditions to be implemented in child classes

### Minor Changes

- Introduced new error types for EvmChain

### Patch Changes

- allow undefined extractor
- Updated rosen-extractor version

## 5.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/abstract-chain/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rosen-chains/abstract-chain",
"version": "5.0.0",
"version": "6.0.0",
"description": "this project contains abstract classes to implement any chain for Rosen-bridge",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",
Expand Down
18 changes: 18 additions & 0 deletions packages/chains/bitcoin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# @rosen-chains/bitcoin

## 1.0.0

### Major Changes

- init rosen-extractor in chain and remove it from its network
- add signatureRecovery to return data of required signFunction

### Minor Changes

- change generateTransaction to generateMultipleTransaction due to its update in AbstractChain

### Patch Changes

- Updated rosen-extractor version
- Updated dependencies
- @rosen-chains/abstract-chain@6.0.0
25 changes: 14 additions & 11 deletions packages/chains/bitcoin/lib/BitcoinChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ import {
} from '@rosen-chains/abstract-chain';
import AbstractBitcoinNetwork from './network/AbstractBitcoinNetwork';
import BitcoinTransaction from './BitcoinTransaction';
import { BitcoinConfigs, BitcoinTx, BitcoinUtxo } from './types';
import {
BitcoinConfigs,
BitcoinTx,
BitcoinUtxo,
TssSignFunction,
} from './types';
import Serializer from './Serializer';
import { Psbt, Transaction, address, payments, script } from 'bitcoinjs-lib';
import JsonBigInt from '@rosen-bridge/json-bigint';
Expand All @@ -33,7 +38,7 @@ class BitcoinChain extends AbstractUtxoChain<BitcoinTx, BitcoinUtxo> {
declare configs: BitcoinConfigs;
CHAIN = BITCOIN_CHAIN;
extractor: BitcoinRosenExtractor;
protected signFunction: (txHash: Uint8Array) => Promise<string>;
protected signFunction: TssSignFunction;
protected lockScript: string;
protected signingScript: Buffer;

Expand All @@ -42,7 +47,7 @@ class BitcoinChain extends AbstractUtxoChain<BitcoinTx, BitcoinUtxo> {
configs: BitcoinConfigs,
feeRatioDivisor: bigint,
tokens: RosenTokens,
signFunction: (txHash: Uint8Array) => Promise<string>,
signFunction: TssSignFunction,
logger?: AbstractLogger
) {
super(network, configs, feeRatioDivisor, logger);
Expand Down Expand Up @@ -398,14 +403,12 @@ class BitcoinChain extends AbstractUtxoChain<BitcoinTx, BitcoinUtxo> {
Transaction.SIGHASH_ALL
);

const signatureHex = this.signFunction(signMessage).then(
(signatureHex: string) => {
this.logger.debug(
`Input [${i}] of tx [${bitcoinTx.txId}] is signed. signature: ${signatureHex}`
);
return signatureHex;
}
);
const signatureHex = this.signFunction(signMessage).then((response) => {
this.logger.debug(
`Input [${i}] of tx [${bitcoinTx.txId}] is signed. signature: ${response.signature}`
);
return response.signature;
});
signaturePromises.push(signatureHex);
}

Expand Down
5 changes: 5 additions & 0 deletions packages/chains/bitcoin/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ export interface BitcoinTx {
inputs: BitcoinTxInput[];
outputs: BitcoinTxOutput[];
}

export type TssSignFunction = (txHash: Uint8Array) => Promise<{
signature: string;
signatureRecovery: string;
}>;
4 changes: 2 additions & 2 deletions packages/chains/bitcoin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rosen-chains/bitcoin",
"version": "0.1.0",
"version": "1.0.0",
"description": "this project contains bitcoin chain for Rosen-bridge",
"repository": "https://github.com/rosen-bridge/rosen-chains",
"license": "GPL-3.0",
Expand Down Expand Up @@ -41,6 +41,6 @@
"bitcoinjs-lib": "^6.1.5"
},
"peerDependencies": {
"@rosen-chains/abstract-chain": "^5.0.0"
"@rosen-chains/abstract-chain": "^6.0.0"
}
}
Loading

0 comments on commit ca36479

Please sign in to comment.