Skip to content

Commit

Permalink
chore: prepend 0x to public keys
Browse files Browse the repository at this point in the history
  • Loading branch information
vrockz747 committed Dec 10, 2024
1 parent d3fc72a commit 2d2e90a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 74 deletions.
2 changes: 1 addition & 1 deletion apps/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"tronweb": "^5.3.2",
"winston": "^3.11.0",
"xrpl": "^4.0.0",
"starknet": "^5.24.3"
"starknet": "^6.11.0"
}
}
14 changes: 7 additions & 7 deletions apps/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import { ISignTxnUnsignedTxn, setStarknetApiJs, StarknetApp } from '@cypherock/s
// import { ethers } from 'ethers';
import { createServiceLogger } from './logger';

Check failure on line 18 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

`./logger` import should occur after import of `dotenv-flow`
import { hexToUint8Array } from '@cypherock/sdk-utils';
// import dotEnv from 'dotenv-flow';
import dotEnv from 'dotenv-flow';

// dotEnv.config();
dotEnv.config();
const getEnvVariable = (key: string, defaultValue?: string): string => {

Check failure on line 23 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

'getEnvVariable' is assigned a value but never used
let value: string | undefined;

Expand Down Expand Up @@ -176,15 +176,15 @@ async function fetchAccount(connection: IDeviceConnection) {
// ================ Starknet App -- Fund Transfer ========== //
async function transfer(connection: IDeviceConnection, wallet: IWalletItem) {
const starkApp = await StarknetApp.create(connection);
const starkKeyPubAX = (await starkApp.getPublicKeys({
const starkKeyPubAX = (await starkApp.getUserVerifiedPublicKey({
walletId: wallet.id,
derivationPaths: [{ path: [0x80000000 + 0xA55,
derivationPath: [0x80000000 + 0xA55,
0x80000000 + 0x4741E9C9,
0x80000000 + 0x447A6028,
0x80000000,
0x80000000,
0xC] }]
})).publicKeys[0];
0xC]
}));
console.log("Public key: ", starkKeyPubAX)
const constructorAXCallData = starknetApiJs.CallData.compile([0,starkKeyPubAX,1]);
const accountAXAddress = "0x7b419b63869cd1e23f0354aed454b8fe2908afbe6386f2a29a508f9d34da4d9";//starknetApiJs.hash.calculateContractAddressFromHash(starkKeyPubAX, contractAXclassHash, constructorAXCallData, 0);
Expand Down Expand Up @@ -273,7 +273,7 @@ const run = async () => {
// setEthersLib(ethers);
// setNearApiJs(nearApiJs);
// setSolanaWeb3(solanaWeb3);
// setStarknetApiJs(starknetApiJs);
setStarknetApiJs(starknetApiJs);

let connection: IDeviceConnection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,8 @@ export const getUserVerifiedPublicKey = async (
},
forceStatusUpdate,
);
// const starkAPI = getStarknetApiJs();
// const starkPubKey = starkAPI.ec.starkCurve.getStarkKey(
// result.publicKeys[0].slice(0, 64),
// );

return {
publicKey: result.publicKeys[0],
publicKey: '0x' + result.publicKeys[0],
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ export const runGetPublicKeysOnDevice = async (
forceStatusUpdate(GetPublicKeysEvent.VERIFY);

return {
publicKeys: publicKeys.map(e => uint8ArrayToHex(e)),
publicKeys: publicKeys.map(e => '0x' + uint8ArrayToHex(e)),
};
};
62 changes: 2 additions & 60 deletions pnpm-lock.yaml

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

0 comments on commit 2d2e90a

Please sign in to comment.