Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions examples/nodejs/package-lock.json

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

4 changes: 2 additions & 2 deletions examples/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "signer-bot",
"version": "1.0.0",
"version": "1.0.1",
"description": "A NodeJs Cardano transaction validator and signer bot using Unimatrix Sync. Works with transactions from p2p multisigs, dapps, other bots, or a mix of all. ",
"main": "src/index.js",
"scripts": {
Expand Down Expand Up @@ -28,7 +28,7 @@
"author": "zxpectre",
"license": "ISC",
"dependencies": {
"@emurgo/cardano-serialization-lib-nodejs": "^11.5.0",
"@emurgo/cardano-serialization-lib-nodejs": "^13.2.1",
"@gamechanger-finance/unimatrix": "file:../..",
"bip39": "^3.1.0",
"dotenv": "^16.4.5",
Expand Down
10 changes: 5 additions & 5 deletions examples/nodejs/src/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const getWalletData = ({ mnemonic, networkTag, dltTag }) => {
.to_raw_key()
const baseAddressObj = CSL.BaseAddress.new(
networkIdByTag(networkTag),//parseInt(networkId),
CSL.StakeCredential.from_keyhash(pubSpendKey.hash()),
CSL.StakeCredential.from_keyhash(pubStakeKey.hash())
CSL.Credential.from_keyhash(pubSpendKey.hash()),
CSL.Credential.from_keyhash(pubStakeKey.hash())
);
return {
address: baseAddressObj.to_address().to_bech32(),
Expand Down Expand Up @@ -99,8 +99,8 @@ const signTxIfValid = async ({
networkTag,
validator,
}) => {
const txObj = CSL.Transaction.from_hex(txHex);
const txHashObj = CSL.hash_transaction(txObj.body());
const txObj = CSL.FixedTransaction.from_hex(txHex);
const txHashObj = txObj.transaction_hash();
const _txHash = txHashObj.to_hex();
if (txHash !== _txHash)
throw new Error(`Transaction hash mismatch`);
Expand All @@ -109,7 +109,7 @@ const signTxIfValid = async ({
if (vkHash !== _vkHash) {
throw new Error(`Key hash mismatch`);
}
const txJson = JSON.parse(txObj.to_json());
const txJson=JSON.parse(CSL.Transaction.from_hex(txHex).to_json());
const validation = await validator({
txJson,
txHex,
Expand Down
16 changes: 10 additions & 6 deletions examples/react/package-lock.json

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

6 changes: 3 additions & 3 deletions examples/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react",
"name": "react-signer-bot",
"private": true,
"version": "0.0.0",
"version": "1.0.1",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -11,7 +11,7 @@
"link-unimatrix": "npm link @gamechanger-finance/unimatrix"
},
"dependencies": {
"@emurgo/cardano-serialization-lib-browser": "^11.5.0",
"@emurgo/cardano-serialization-lib-browser": "^13.2.1",
"@gamechanger-finance/gc": "^0.1.0",
"@gamechanger-finance/unimatrix": "file:../..",
"@mdi/font": "^7.4.47",
Expand Down
17 changes: 11 additions & 6 deletions examples/react/src/app/services/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export const getWalletData=(mnemonic:string,networkTag:string)=>{
.to_raw_key()
const baseAddressObj= CardanoWasm().BaseAddress.new(
networkIdByTag(networkTag),//parseInt(networkId),
CardanoWasm().StakeCredential.from_keyhash(pubSpendKey.hash()),
CardanoWasm().StakeCredential.from_keyhash(pubStakeKey.hash())
CardanoWasm().Credential.from_keyhash(pubSpendKey.hash()),
CardanoWasm().Credential.from_keyhash(pubStakeKey.hash())
);
return {
address:baseAddressObj.to_address().to_bech32(),
Expand Down Expand Up @@ -129,13 +129,18 @@ export const signTxIf=async(args:{
}|undefined>=>{
try{
const CSL=CardanoWasm();
const txObj=CSL.Transaction.from_hex(args.txHex);
const txHashObj=CSL.hash_transaction(txObj.body());
const txObj=CSL.FixedTransaction.from_hex(args.txHex);
const txHashObj=txObj.transaction_hash();
const txHash=txHashObj.to_hex();
const txJson=JSON.parse(txObj.to_json());
const txJson=JSON.parse(CSL.Transaction.from_hex(args.txHex).to_json());
const {doSign:signWithSpend,error:spendError}=await args.conditions.spend({txJson,txHash,vkHash:args?.wallet?.pubSpendKeyHash});
const {doSign:signWithStake,error:stakeError}=await args.conditions.stake({txJson,txHash,vkHash:args?.wallet?.pubStakeKeyHash});
const res={
const res:{
spend:string|undefined,
stake:string|undefined,
spendError:string|undefined,
stakeError:string|undefined,
}={
spend:undefined,
stake:undefined,
spendError,
Expand Down
15 changes: 8 additions & 7 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gamechanger-finance/unimatrix",
"version": "1.0.2",
"version": "1.0.3",
"description": "Unimatrix Sync is a decentralized, privacy preserving, transaction witness sharing and pairing solution for multisignatures or deferred signatures. It was originally created for GameChanger Wallet to improve it's multisignature user experience and boost the multisig dapp and service ecosystem",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -65,7 +65,7 @@
"devDependencies": {
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@emurgo/cardano-serialization-lib-nodejs": "^11.5.0",
"@emurgo/cardano-serialization-lib-nodejs": "^13.2.1",
"@jest/globals": "^29.7.0",
"@types/crypto-js": "^4.2.2",
"@types/jest": "^27.5.2",
Expand Down
4 changes: 2 additions & 2 deletions src/sync/cardano.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export const cardanoValidatorsFactory=(CSL:any):UnimatrixValidatorMap=>({
try{
const txHex:string=args?.store.file?.data||"";
const [dltTag,networkTag,txHash] = args.path||[];
const txObj = CSL.Transaction.from_hex(txHex) //.from_bytes(fromHex(txHex))
const txObj = CSL.FixedTransaction.from_hex(txHex) //.from_bytes(fromHex(txHex))
const txBodyObj = txObj.body() //args.CSL.TransactionBody.from_bytes(fromHex(txHex))
const networkId = txBodyObj.network_id()?.kind();
if(networkId!==undefined){
Expand All @@ -241,7 +241,7 @@ export const cardanoValidatorsFactory=(CSL:any):UnimatrixValidatorMap=>({
if(realNetworkTag!==networkTag)
return `This is a '${realNetworkTag||"unknown network"}' transaction. Wrong network`
}
const txHashObj = CSL.hash_transaction(txBodyObj);
const txHashObj = txObj.transaction_hash()//CSL.hash_transaction(txBodyObj);
const realTxHash = txHashObj.to_hex();
if(realTxHash!==txHash)
return "Transaction hash mismatch"
Expand Down
Loading