Skip to content
Merged
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
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"bluebar",
"boba",
"bolivarian",
"bonfida",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jack-Works can ignore package.json file?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah please

"bouvet",
"builtins",
"burkina",
Expand Down
3 changes: 3 additions & 0 deletions packages/plugins/Solana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
"@bonfida/name-offers": "^0.0.1",
"@bonfida/spl-name-service": "^0.1.27",
Comment thread
lelenei marked this conversation as resolved.
"@masknet/icons": "workspace:*",
"@masknet/injected-script": "workspace:*",
"@masknet/plugin-infra": "workspace:*",
Expand All @@ -15,6 +17,7 @@
"@masknet/web3-shared-solana": "workspace:*",
"@metaplex-foundation/mpl-token-metadata": "^1.1.0",
"@metaplex/js": "^4.11.7",
"@solana/spl-name-service": "^0.1.3",
"@solana/spl-token": "^0.1.8",
"@solana/spl-token-registry": "^0.2.1301",
"@solana/web3.js": "^1.30.2",
Expand Down
6 changes: 5 additions & 1 deletion packages/plugins/Solana/src/UI/Web3State/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
resolveBlockLinkOnExplorer,
resolveTransactionLinkOnExplorer,
} from '@masknet/web3-shared-solana'
import { getFungibleAssets, getNonFungibleAssets } from '../../apis'
import { getFungibleAssets, getNonFungibleAssets, lookup, reverse } from '../../apis'
import { formatAddress, formatCurrency } from '../../helpers'
import { getStorage, StorageDefaultValue } from '../../storage'

Expand Down Expand Up @@ -58,5 +58,9 @@ export function createWeb3State(signal: AbortSignal): Web3Plugin.ObjectCapabilit
resolveAddressLink: resolveAddressLinkOnExplorer,
resolveBlockLink: resolveBlockLinkOnExplorer,
},
NameService: {
lookup: (domain: string) => lookup(domain, chainId),
reverse: (address: string) => reverse(address, chainId),
},
}
}
27 changes: 27 additions & 0 deletions packages/plugins/Solana/src/apis/getDomainName.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { performReverseLookup } from '@bonfida/spl-name-service'
import type { ChainId } from '@masknet/web3-shared-solana'
import { getHashedName, getNameAccountKey, NameRegistryState } from '@solana/spl-name-service'

import { Connection, PublicKey } from '@solana/web3.js'
import { NETWORK_ENDPOINTS, SOL_TLD_AUTHORITY } from '../constants'

const getKey = async (name: string) => {
const hashedName = await getHashedName(name)
const domainKey = await getNameAccountKey(hashedName, undefined, SOL_TLD_AUTHORITY)
return { domainKey, hashedName }
}

const connection = (chainId: ChainId) => {
return new Connection(NETWORK_ENDPOINTS[chainId])
}

export async function lookup(name: string, chainId: ChainId) {
const { domainKey } = await getKey(name)
const registry = await NameRegistryState.retrieve(connection(chainId), domainKey)
return registry.owner.toBase58()
}

export async function reverse(owner: string, chainId: ChainId) {
const accountKey = new PublicKey(owner)
return performReverseLookup(connection(chainId), accountKey)
}
1 change: 1 addition & 0 deletions packages/plugins/Solana/src/apis/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './getFungibleAssets'
export * from './getNonFungibleAssets'
export * from './getDomainName'
2 changes: 2 additions & 0 deletions packages/plugins/Solana/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Web3Plugin } from '@masknet/plugin-infra'
import { ChainId, NetworkType, ProviderType } from '@masknet/web3-shared-solana'
import { PublicKey } from '@solana/web3.js'

export const PLUGIN_META_KEY = 'com.mask.solana'
export const PLUGIN_ID = 'com.mask.solana'
Expand Down Expand Up @@ -44,3 +45,4 @@ export const NETWORK_ENDPOINTS: Record<ChainId, string> = {
[ChainId.Devnet]: 'https://api.devnet.solana.com',
}
export const ENDPOINT_KEY = 'mainnet-beta'
export const SOL_TLD_AUTHORITY = new PublicKey('58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx')
1 change: 1 addition & 0 deletions packages/plugins/Solana/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { registerPlugin } from '@masknet/plugin-infra'

import { base } from './base'

registerPlugin({
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-constants/evm/coingecko.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
"Fantom": "fantom",
"Aurora": "ethereum",
"Aurora_Testnet": "",
"Conflux": "conflux-token"
"Conflux": ""
}
}
2 changes: 1 addition & 1 deletion packages/web3-constants/evm/ethereum.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"Fantom": "0x913975af2Bb8a6Be4100D7dc5e9765B77F6A5d6c",
"Aurora": "0x6cc1b1058F9153358278C35E0b2D382f1585854B",
"Aurora_Testnet": "",
"Conflux": "0x19f179d7e0d7d9f9d5386afff64271d98a91615b"
"Conflux": ""
},
"ENS_REGISTRAR_ADDRESS": {
"Mainnet": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
Expand Down
6 changes: 3 additions & 3 deletions packages/web3-constants/evm/ito.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"Fantom": "0x981be454a930479d92C91a0092D204b64845A5D6",
"Aurora": "0x2cf91AD8C175305EBe6970Bd8f81231585EFbd77",
"Aurora_Testnet": "0xdcA6F476EebCDE8FE8b072e3fC80dBC28dC209b3",
"Conflux": "0x066804d9123bf2609ed4a4a40b1177a9c5a9ed51"
"Conflux": ""
},
"ITO2_CONTRACT_CREATION_BLOCK_HEIGHT": {
"Mainnet": 12766513,
Expand All @@ -81,7 +81,7 @@
"Fantom": 25071597,
"Aurora": 57350598,
"Aurora_Testnet": 77919102,
"Conflux": 37722805
"Conflux": 0
},
"DEFAULT_QUALIFICATION_ADDRESS": {
"Mainnet": "0x81b6ae377e360dcad63611846a2516f4ba8c88ac",
Expand Down Expand Up @@ -123,7 +123,7 @@
"Fantom": "0x83D6b366f21e413f214EB077D5378478e71a5eD2",
"Aurora": "0x578a7Fee5f0D8CEc7d00578Bf37374C5b95C4b98",
"Aurora_Testnet": "",
"Conflux": "0x05ee315e407c21a594f807d61d6cc11306d1f149"
"Conflux": ""
},
"SUBGRAPH_URL": {
"Mainnet": "https://api.thegraph.com/subgraphs/name/dimensiondev/mask-ito-mainnet",
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-constants/evm/nft-red-packet.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"Fantom": "",
"Aurora": "0x05ee315E407C21a594f807D61d6CC11306D1F149",
"Aurora_Testnet": "0x97369fEE7db34E0BfE47861f2ec44b4378d13eB4",
"Conflux": "0x5b966f3a32db9c180843bcb40267a66b73e4f022"
"Conflux": ""
},
"SUBGRAPH_URL": {
"Mainnet": "https://api.thegraph.com/subgraphs/name/dimensiondev/mask-nft-red-packet-mainnet",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-constants/evm/red-packet.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"Fantom": "0x578a7Fee5f0D8CEc7d00578Bf37374C5b95C4b98",
"Aurora": "0x19f179D7e0D7d9F9d5386afFF64271D98A91615B",
"Aurora_Testnet": "0xdB93cCd481012bB5D1E2c8d0aF7C5f2940c00fdC",
"Conflux": "0x96c7d011cdfd467f551605f0f5fce279f86f4186"
"Conflux": ""
},
"HAPPY_RED_PACKET_ADDRESS_V4_BLOCK_HEIGHT": {
"Mainnet": 12939427,
Expand All @@ -102,7 +102,7 @@
"Fantom": 25112473,
"Aurora": 57552338,
"Aurora_Testnet": 77918765,
"Conflux": 37670572
"Conflux": 0
},
"SUBGRAPH_URL": {
"Mainnet": "https://api.thegraph.com/subgraphs/name/dimensiondev/mask-red-packet-mainnet",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-constants/evm/rpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"Fantom": ["https://rpc.ftm.tools/"],
"Aurora": ["https://mainnet.aurora.dev"],
"Aurora_Testnet": ["https://testnet.aurora.dev"],
"Conflux": ["https://evm.confluxrpc.com"]
"Conflux": []
},
"RPC_WEIGHTS": {
"Mainnet": [0, 1, 2, 3, 4],
Expand All @@ -81,6 +81,6 @@
"Fantom": [0, 0, 0, 0, 0],
"Aurora": [0, 0, 0, 0, 0],
"Aurora_Testnet": [0, 0, 0, 0, 0],
"Conflux": [0, 0, 0, 0, 0]
"Conflux": []
}
}
2 changes: 1 addition & 1 deletion packages/web3-constants/evm/token-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"Fantom": ["https://tokens.r2d2.to/latest/250/tokens.json"],
"Aurora": ["https://tokens.r2d2.to/latest/1313161554/tokens.json"],
"Aurora_Testnet": [],
"Conflux": ["https://tokens.r2d2.to/latest/1030/tokens.json"]
"Conflux": []
}
}
Loading