argentlabs / argent-x

ArgentX browser extension for StarkNet - made with ❤️ by Argent
https://github.com/argentlabs/argent-x
Other
625 stars 276 forks source link

compute different address from private key #2000

Closed klgd closed 1 year ago

klgd commented 1 year ago
const argentXproxyClassHash = "0x25ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918";
const argentXaccountClassHash = "0x033434ad846cdd5f23eb73ff09fe6fddd568284a0fb7d1be20ee482f044dabe2";

// Generate public and private key pair.
const privateKeyAX = ''; // this is from argent x private key
console.log('AX_ACCOUNT_PRIVATE_KEY=', privateKeyAX);
const starkKeyPairAX = ec.getKeyPair(privateKeyAX);
const starkKeyPubAX = ec.getStarkKey(starkKeyPairAX);
console.log('AX_ACCOUNT_PUBLIC_KEY=', starkKeyPubAX);

// Calculate future address of the ArgentX account
const AXproxyConstructorCallData = stark.compileCalldata({
    implementation: argentXaccountClassHash,
    selector: hash.getSelectorFromName("initialize"),
    calldata: stark.compileCalldata({ signer: starkKeyPubAX, guardian: "0" }),
});
const AXcontractAddress = hash.calculateContractAddressFromHash(
    starkKeyPubAX,
    argentXproxyClassHash,
    AXproxyConstructorCallData,
    0
);
console.log('Precalculated account address=', AXcontractAddress);

compute my new account is same address, but old account is different so, what's wrong?

aleks4ever commented 11 months ago

i have same problem. I get a different wallet address