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
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,18 @@ function resolveCurrentVisitingIdentityInner(
const assign = async () => {
await delay(5000)
const bio = getBio()
const homepage = getPersonalHomepage()
const nickname = getNickname()
const handle = getTwitterId()
const avatar = getAvatar()
const homepage = await Services.Helper.resolveTCOLink(getPersonalHomepage())

ref.value = {
identifier: ProfileIdentifier.of(twitterBase.networkIdentifier, handle).unwrapOr(undefined),
nickname,
avatar,
bio,
homepage,
homepage: homepage ?? '',
}

Services.Helper.resolveTCOLink(homepage).then((link) => {
if (cancel?.aborted) return
ref.value = {
...ref.value,
homepage: link ?? homepage,
}
})
}
const createWatcher = (selector: LiveSelector<HTMLElement, boolean>) => {
new MutationObserverWatcher(selector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const getBio = () => {

export const getPersonalHomepage = () => {
const node = personalHomepageSelector().evaluate()
return node?.getAttribute('href') || ''
return node?.getAttribute('href') ?? ''
}

export const getAvatar = () => {
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/EVM/src/state/Connection/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class Connection implements EVM_Connection {
...initial,
overrides: {
from: this.account,
chainId: this.chainId,
...initial?.overrides,
...overrides?.overrides,
},
Expand Down
21 changes: 15 additions & 6 deletions packages/web3-shared/evm/utils/contract.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type Web3 from 'web3'
import type { AbiItem } from 'web3-utils'
import { omit } from 'lodash-unified'
import { AbiItem, toHex } from 'web3-utils'
import { pick } from 'lodash-unified'
import type {
BaseContract,
NonPayableTransactionObject,
Expand All @@ -15,15 +15,24 @@ export async function encodeTransaction(
transaction: PayableTransactionObject<unknown> | NonPayableTransactionObject<unknown>,
overrides?: Partial<Transaction>,
) {
const encoded: Transaction = {
from: contract.defaultAccount ?? undefined,
const encoded: PayableTx & {
maxPriorityFeePerGas?: string
maxFeePerGas?: string
} = {
from: (overrides?.from as string) ?? contract.defaultAccount ?? undefined,
to: contract.options.address,
data: transaction.encodeABI(),
...overrides,
value: overrides?.value ? toHex(overrides.value) : undefined,
gas: overrides?.gas ? toHex(overrides.gas) : undefined,
gasPrice: overrides?.gasPrice ? toHex(overrides.gasPrice) : undefined,
maxPriorityFeePerGas: overrides?.maxPriorityFeePerGas ? toHex(overrides.maxPriorityFeePerGas) : undefined,
maxFeePerGas: overrides?.maxFeePerGas ? toHex(overrides.maxFeePerGas) : undefined,
nonce: overrides?.nonce ? toHex(overrides.nonce) : undefined,
chainId: overrides?.chainId ? toHex(overrides.chainId) : undefined,
}

if (!encoded.gas) {
encoded.gas = await transaction.estimateGas(overrides as PayableTx)
encoded.gas = await transaction.estimateGas(pick(encoded, ['from', 'value']))
}

return encoded
Expand Down