mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-02-11 22:45:04 -05:00
Allow users to force-update their linked ETH address
Removed sc_identity_id from Player table because it enforces ETH addresses to be used as the single source of truth for users and prevents conflicts when users update their ETH address in the ledger. sc_identity_id is not needing anywhere in our backend / data model.
This commit is contained in:
committed by
Alec LaLonde
parent
ba0be9fb09
commit
63eeca916f
@@ -17,6 +17,7 @@
|
||||
"bignumber.js": "9.0.1",
|
||||
"ethers": "5.3.0",
|
||||
"js-base64": "3.6.1",
|
||||
"uuid": "8.3.2"
|
||||
"uuid": "8.3.2",
|
||||
"sourcecred": "0.9.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,3 +5,4 @@ export * as DiscordUtil from './discordHelpers';
|
||||
export * as numbers from './numbers';
|
||||
export * from './promiseHelpers';
|
||||
export * from './rankHelpers';
|
||||
export * from './sourceCredHelpers';
|
||||
|
||||
15
packages/utils/src/sourceCredHelpers.ts
Normal file
15
packages/utils/src/sourceCredHelpers.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ethers } from 'ethers';
|
||||
import { SCIdentity, sourcecred as sc } from 'sourcecred';
|
||||
|
||||
export const getLatestEthAddress = (identity: SCIdentity): string | null => {
|
||||
const ethAddress = identity.aliases.find((alias) => {
|
||||
const parts = sc.core.graph.NodeAddress.toParts(alias.address);
|
||||
return parts.indexOf('ethereum') > 0;
|
||||
})?.description;
|
||||
|
||||
if (ethAddress && ethers.utils.isAddress(ethAddress)) {
|
||||
return ethAddress.toLowerCase();
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
Reference in New Issue
Block a user