hw-app-csc
v2.0.0
Published
Ledger Hardware Wallet Casinocoin Application API
Downloads
4
Maintainers
Readme
Ledger Casinocoin app API
Usage
import Transport from "@ledgerhq/hw-transport-node-hid";
// import Transport from "@ledgerhq/hw-transport-u2f"; // for browser
import Csc from "@ledgerhq/hw-app-csc";
const getCscAppVersion = async () => {
const transport = await Transport.create();
const csc = new Csc(transport);
const result = await csc.getAppConfiguration();
return result.version;
}
getCscAppVersion().then(v => console.log(v));
const getCscPublicKey = async () => {
const transport = await Transport.create();
const csc = new Csc(transport);
const result = await csc.getPublicKey("44'/148'/0'");
return result.publicKey;
};
getCscPublicKey().then(pk => console.log(pk));
const signCscTransaction = async () => {
const transaction = ...;
const transport = await Transport.create();
const csc = new Csc(transport);
const result = await csc.signTransaction("44'/148'/0'", transaction.signatureBase());
// add signature to transaction
const keyPair = CasinocoinSdk.Keypair.fromPublicKey(publicKey);
const hint = keyPair.signatureHint();
const decorated = new CasinocoinSdk.xdr.DecoratedSignature({hint: hint, signature: signature});
transaction.signatures.push(decorated);
return transaction;
}
signCscTransaction().then(s => console.log(s.toString('hex')));