MCPcopy Create free account
hub / github.com/code100x/tiplink / createWallet

Function createWallet

src/services/walletService.ts:12–40  ·  view source on GitHub ↗
(user: User)

Source from the content-addressed store, hash-verified

10 // secretKey: Buffer.from(keypair.secretKey).toString('base64'), string
11 };
12}
13
14// reconstrucitng keypair from secret key as 1:1 mapping is maintained between secret key and keypair
15export function createKeypairFromSecretKey(secretKey: Uint8Array) {
16 const keypair = Keypair.fromSecretKey(secretKey);
17 return {
18 publicKey: keypair.publicKey,
19 secretKey: keypair.secretKey
20 };
21}
22
23
24// creating a function to sign a transaction
25
26export function signTransaction(transaction: Transaction, secretKey: Uint8Array) {
27 // we need to reconstruct the keypair from the secret key to sign the transaction only public key won't work
28 const keypair = Keypair.fromSecretKey(secretKey);
29 transaction.sign(keypair);
30 return transaction;
31}
32

Callers 1

WalletFunction · 0.90

Calls 1

pvtKeyEncryptionManagerFunction · 0.90

Tested by

no test coverage detected