Skip to content

Commit

Permalink
refactor: #369 wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lucanicoladebiasi committed Apr 11, 2024
1 parent 8d70c33 commit f3ee688
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
14 changes: 7 additions & 7 deletions apps/sdk-node-integration/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -939,10 +939,10 @@
dependencies:
"@types/yargs-parser" "*"

"@vechain/sdk-core@1.0.0-beta.2":
"@vechain/sdk-core@1.0.0-beta.3":
version "1.0.0-beta.3"
resolved "https://registry.yarnpkg.com/@vechain/sdk-core/-/sdk-core-1.0.0-beta.2.tgz#5b217f2fef47f2507a369f65e149f4aa6ac2fb65"
integrity sha512-eGJjts+/eJdybSnb7Y1q9d53vkeRuJB0kTsdUZDGf8M7JrkCzNEkdzxiXXWnP5hUItFbqJHPSH7Kl7k8DOknjw==
resolved "https://registry.yarnpkg.com/@vechain/sdk-core/-/sdk-core-1.0.0-beta.3.tgz#e095902dced4bd2a4a8c9b65033f6ac4b0226dc1"
integrity sha512-PgKjCPOwb+9rAXp8FTcrG1UwFnAaV0gzfmbCA/pPiEr8jOIrQd5+1S4Q9vDZ5dVDCnJq73y2OH5zPf4ff84IAA==
dependencies:
"@ethereumjs/rlp" "^5.0.2"
"@types/elliptic" "^6.4.18"
Expand All @@ -951,10 +951,10 @@
elliptic "^6.5.5"
ethers "6.11.1"

"@vechain/sdk-errors@1.0.0-beta.2":
"@vechain/sdk-errors@1.0.0-beta.3":
version "1.0.0-beta.3"
resolved "https://registry.yarnpkg.com/@vechain/sdk-errors/-/sdk-errors-1.0.0-beta.2.tgz#29ee4b4b0a4371a83e823b52170af8bb45e1085d"
integrity sha512-O7CVZ15jzrFZmDEvymeRl5mhLug1pGYuOsJzU8a1V3qk5wzyzIZthMT1eK6xczapJsLArx6F82vMR+5mYIDQOA==
resolved "https://registry.yarnpkg.com/@vechain/sdk-errors/-/sdk-errors-1.0.0-beta.3.tgz#44eb37d4ef0d1b050373b2611256667a9ee8f7b4"
integrity sha512-ojuCG/sA4gGQqhpAqLtC3T096TtJEEd+2WhdifZL5IGxQX34Gn/eJF8UDo7DapybAUhWUDTdOO8pI/0zLEetsQ==

acorn-walk@^8.1.1:
version "8.3.2"
Expand Down Expand Up @@ -1588,7 +1588,7 @@ function-bind@^1.1.2:
integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==

gensync@^1.0.0-beta.2:
version "1.0.0-beta.3"
version "1.0.0-beta.2"
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==

Expand Down
21 changes: 21 additions & 0 deletions packages/core/src/address/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ethers } from 'ethers';
import { Hex0x, HEX_ADDRESS_REGEX } from '../utils';
import { ADDRESS, assert } from '@vechain/sdk-errors';
import { secp256k1 } from '../secp256k1';
// import { keccak256 } from '../hash';

/**
* Derives a vechain thor address from a public key.
Expand All @@ -17,6 +18,26 @@ function fromPublicKey(publicKey: Buffer): string {
return ethers.computeAddress(Hex0x.of(publicKey));
}

/*
https://docs.ethers.org/v5/api/utils/address/
https://ethereum.org/en/whitepaper/#ethereum-accounts
*/
// function fromPublicKeyAsUint8Array(publicKey: Uint8Array): Uint8Array {
// return keccak256(publicKey.slice(2)).slice(13);
// }
//
/*
export function computeAddress(key: string | SigningKey): string {
let pubkey: string;
if (typeof(key) === "string") {
pubkey = SigningKey.computePublicKey(key, false);
} else {
pubkey = key.publicKey;
}
return getAddress(keccak256("0x" + pubkey.substring(4)).substring(26));
}
*/

/**
* Derives an Ethereum address from a given private key.
*
Expand Down

0 comments on commit f3ee688

Please sign in to comment.