Skip to content

Commit 44ea208

Browse files
nooxxloicttn
authored andcommitted
wip
1 parent 86359ec commit 44ea208

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

examples/ada.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const f = async () => {
2525
);
2626

2727
const txSigned = await k.ada.sign('vault1', tx);
28-
// const hash = await k.ada.broadcast(txSigned);
29-
// console.log(hash);
28+
const hash = await k.ada.broadcast(txSigned);
29+
console.log(hash);
3030
} catch (err){
3131
console.log(err);
3232
}

src/services/ada.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
BlockfrostServerError,
99
} from "@blockfrost/blockfrost-js";
1010
import { InvalidIntegration } from "../errors/integrations";
11-
import { PeerType, TransactionOperation } from "fireblocks-sdk";
1211

1312
const CARDANO_PARAMS = {
1413
COINS_PER_UTXO_WORD: '34482',
@@ -102,24 +101,17 @@ export class AdaService extends Service {
102101
}
103102
};
104103

105-
const tx = await this.fbSigner.signWithFB(payload, 'ADA_TEST');
106-
const sigBuffer = Buffer.from(tx.signedMessages![0].signature.fullSig, 'hex');
107-
console.log(tx.signedMessages);
108-
// // transaction.set_is_valid(true);
109-
//
110-
// const txHash = CardanoWasm.hash_transaction(transaction.body());
111-
// const witnesses = CardanoWasm.TransactionWitnessSet.new();
112-
// const vkeyWitnesses = CardanoWasm.Vkeywitnesses.new();
113-
// const MNEMONIC = 'word 1 word 2';
114-
// const bip32PrvKey = this.mnemonicToPrivateKey(MNEMONIC);
115-
// const { signKey } = this.deriveAddressPrvKey(bip32PrvKey, this.testnet);
116-
// vkeyWitnesses.add(CardanoWasm.make_vkey_witness(txHash, signKey));
117-
// witnesses.set_vkeys(vkeyWitnesses);
118-
// console.log(witnesses);
119-
// const tx = CardanoWasm.Transaction.new(transaction.body(), witnesses);
120-
121-
return transaction;
122-
104+
const fbTx = await this.fbSigner.signWithFB(payload, 'ADA_TEST');
105+
106+
const pubKey = CardanoWasm.PublicKey.from_hex(fbTx.signedMessages![0].publicKey);
107+
const vKey = CardanoWasm.Vkey.new(pubKey);
108+
const signature = CardanoWasm.Ed25519Signature.from_hex(fbTx.signedMessages![0].signature.fullSig);
109+
const witnesses = CardanoWasm.TransactionWitnessSet.new();
110+
const vkeyWitnesses = CardanoWasm.Vkeywitnesses.new();
111+
const vkeyWitness = CardanoWasm.Vkeywitness.new(vKey, signature);
112+
vkeyWitnesses.add(vkeyWitness);
113+
witnesses.set_vkeys(vkeyWitnesses);
114+
return CardanoWasm.Transaction.new(transaction.body(), witnesses);
123115
}
124116

125117
/**

0 commit comments

Comments
 (0)