Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Airdrop extension release #429

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/extension/src/background/keyring/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type CryptoArgs = {
password: string;
text: string;
type: AccountType;
publicKey?: string;
};

export class Crypto {
Expand All @@ -38,6 +39,7 @@ export class Crypto {
password,
text,
type,
publicKey,
} = args;

const { params, key, iv, salt } = this.encryptionParams(password);
Expand All @@ -54,6 +56,7 @@ export class Crypto {
path,
crypto,
type,
publicKey
};
}

Expand Down
10 changes: 7 additions & 3 deletions apps/extension/src/background/keyring/keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ export class KeyRing {
const account = hdWallet.derive(bip44Path);
const stringPointer = account.private().to_hex();
const sk = readStringPointer(stringPointer, this._cryptoMemory);
const address = new Address(sk).implicit();
const address = new Address(sk);
const implicitAddress = address.implicit();
const publicKey = address.public();

const { chainId } = this;

// Generate unique ID for new parent account:
Expand All @@ -253,13 +256,14 @@ export class KeyRing {
const mnemonicStore = crypto.encrypt({
id,
alias,
address,
owner: address,
address: implicitAddress,
owner: implicitAddress,
chainId,
password,
path,
text: phrase,
type: AccountType.Mnemonic,
publicKey,
});

await this._keyStore.append(mnemonicStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ export const AccountOverview = (): JSX.Element => {
withConnection(
async () => {
const accounts = await integration?.accounts();

if (accounts?.[0]) {
const { publicKey, address } = accounts[0];

console.log(publicKey);
console.log(address);
}

if (accounts) {
dispatch(addAccounts(accounts as Account[]));
dispatch(fetchBalances());
Expand Down