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

Orchard testnet prep #436

Merged
merged 5 commits into from
Jan 27, 2025
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
26 changes: 13 additions & 13 deletions background/constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getExtendedZoneForAddress } from "../services/chain/utils"
import { NetworkInterface } from "./networks/networkTypes"

export const QUAI_SCAN_URL = "https://quaiscan.io"
export const ORCHARD_QUAI_SCAN_URL = "https://sandbox.quaiscan.io"
export const ORCHARD_QUAI_SCAN_URL = "https://orchard.quaiscan.io"

export const HTTPS_RPC_URL = "https://rpc.quai.network"
export const WSS_RPC_URL = "wss://rpc.quai.network"
Expand Down Expand Up @@ -84,63 +84,63 @@ export const DEFAULT_QUAI_LOCAL = {
{
name: "Cyprus One",
shard: "cyprus-1",
rpc: "http://localhost:8610",
rpc: "http://localhost",
blockExplorerUrl: QUAI_SCAN_URL,
multicall: "0x15b6351eDEcd7142ac4c6fE54948b603D4566862",
},
{
name: "Cyprus Two",
shard: "cyprus-2",
rpc: "http://localhost:8542",
rpc: "http://localhost",
blockExplorerUrl: QUAI_SCAN_URL,
multicall: "0x2F3e12280232410e9454254E6152814ce677475B",
},
{
name: "Cyprus Three",
shard: "cyprus-3",
rpc: "http://localhost:8674",
rpc: "http://localhost",
blockExplorerUrl: QUAI_SCAN_URL,
multicall: "0x3E4CE31D864BD3CC05E57F6f2a8967e6EF53039b",
},
{
name: "Paxos One",
shard: "paxos-1",
rpc: "http://localhost:8512",
rpc: "http://localhost",
blockExplorerUrl: QUAI_SCAN_URL,
multicall: "0x729f4724eA02904086b8ce2889959d4aC96127ef",
},
{
name: "Paxos Two",
shard: "paxos-2",
rpc: "http://localhost:8544",
rpc: "http://localhost",
blockExplorerUrl: QUAI_SCAN_URL,
multicall: "0x84FA6Abf2E7a743719f59E6EF82248cD1C53e621",
},
{
name: "Paxos Three",
shard: "paxos-3",
rpc: "http://localhost:8576",
rpc: "http://localhost",
blockExplorerUrl: QUAI_SCAN_URL,
multicall: "0x9b05beAA009A7418EC6825452269E7Dfc82777Ce",
},
{
name: "Hydra One",
shard: "hydra-1",
rpc: "http://localhost:8614",
rpc: "http://localhost",
blockExplorerUrl: QUAI_SCAN_URL,
multicall: "0xc256fc8DA480034E0339A6AC9c38913cC018A505",
},
{
name: "Hydra Two",
shard: "hydra-2",
rpc: "http://localhost:8646",
rpc: "http://localhost",
blockExplorerUrl: QUAI_SCAN_URL,
multicall: "0xCb9fe98f7c8739B7272d27259747320096610569",
},
{
name: "Hydra Three",
shard: "hydra-3",
rpc: "http://localhost:8678",
rpc: "http://localhost",
blockExplorerUrl: QUAI_SCAN_URL,
multicall: "0xFB17d5ea1a7e1132E2b12FA7B03cABcb144CDb9d",
},
Expand All @@ -153,7 +153,7 @@ export const QUAI_NETWORK: EVMNetwork = {
chainID: "9000",
family: "EVM",
chains: DEFAULT_QUAI_TESTNET.chains,
derivationPath: "m/44'/1'/0'/0",
derivationPath: "m/44'/994'/0'/0",
isQuai: true,
}

Expand All @@ -163,7 +163,7 @@ export const QUAI_NETWORK_ORCHARD: EVMNetwork = {
chainID: "15000",
family: "EVM",
chains: DEFAULT_QUAI_ORCHARD.chains,
derivationPath: "m/44'/1'/0'/0",
derivationPath: "m/44'/994'/0'/0",
isQuai: true,
}

Expand All @@ -173,7 +173,7 @@ export const QUAI_NETWORK_LOCAL: EVMNetwork = {
chainID: "17000",
family: "EVM",
chains: DEFAULT_QUAI_LOCAL.chains,
derivationPath: "m/44'/1'/0'/0",
derivationPath: "m/44'/994'/0'/0",
isQuai: true,
}

Expand Down
2 changes: 1 addition & 1 deletion background/contracts/erc-20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const ERC20_FUNCTIONS = {
"transferFrom(address from, address to, uint256 amount) returns (bool)"
),
crossChainTransfer: FunctionFragment.from(
"crossChainTransfer(address to, uint256 amount, uint256 gasLimit, uint256 minerTip, uint256 baseFee)"
"crossChainTransfer(address to, uint256 amount, uint256 gasLimit, uint256 baseFee)"
),
}

Expand Down
2 changes: 1 addition & 1 deletion background/contracts/qrc-20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const QRC20_FUNCTIONS = {
"transferFrom(address from, address to, uint amount) returns (bool)"
),
crossChainTransfer: FunctionFragment.from(
"crossChainTransfer(address to, uint256 amount, uint256 gasLimit, uint256 minerTip, uint256 baseFee)"
"crossChainTransfer(address to, uint256 amount, uint256 gasLimit, uint256 baseFee)"
),
}

Expand Down
4 changes: 0 additions & 4 deletions background/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ export type BlockEstimate = {
* The gas price that results in the above likelihood of inclusion.
*/
gasPrice?: bigint
/**
* The miner tip that results in the above likelihood of inclusion.
*/
minerTip?: bigint
}

/**
Expand Down
2 changes: 1 addition & 1 deletion background/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"emittery": "^0.9.2",
"ethers": "^6.13.4",
"lodash": "^4.17.21",
"quais": "^1.0.0-alpha.33",
"quais": "^1.0.0-alpha.34",
"sinon": "^14.0.0",
"siwe": "^1.1.0",
"util": "^0.12.4",
Expand Down
15 changes: 1 addition & 14 deletions background/redux-slices/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { convertFixedPoint } from "../lib/fixed-point"
import { removeAssetReferences, updateAssetReferences } from "./accounts"
import type { RootState } from "."
import { AccountSigner } from "../services/signing"
import { setSnackbarConfig } from "./ui"
import { NetworkInterface } from "../constants/networks/networkTypes"
import logger from "../lib/logger"

Expand Down Expand Up @@ -182,34 +181,28 @@ export const removeAssetData = createBackgroundAsyncThunk(
}
)

export const getMaxFeeAndMinerTip = createBackgroundAsyncThunk(
export const getGasPrice = createBackgroundAsyncThunk(
"assets/getAccountGasPrice",
async (): Promise<{
gasPrice: bigint
minerTip: bigint
}> => {
const { jsonRpcProvider } = globalThis.main.chainService

try {
const feeData = await jsonRpcProvider.getFeeData(Zone.Cyprus1)
const baseFeeSettings = {
gasPrice: toBigInt(6000000000),
minerTip: toBigInt(2000000000),
}
if (feeData?.gasPrice) {
baseFeeSettings.gasPrice = feeData.gasPrice
}
if (feeData?.minerTip) {
baseFeeSettings.minerTip = feeData.minerTip
}

return baseFeeSettings
} catch (e) {
logger.error(e)

return {
gasPrice: toBigInt(6000000000),
minerTip: toBigInt(2000000000),
}
}
}
Expand All @@ -230,7 +223,6 @@ export const sendAsset = createBackgroundAsyncThunk(
toAddressNetwork: AddressOnNetwork
assetAmount: AnyAssetAmount
gasLimit?: bigint
minerTip?: bigint
gasPrice?: bigint
accountSigner: AccountSigner
},
Expand All @@ -241,7 +233,6 @@ export const sendAsset = createBackgroundAsyncThunk(
toAddressNetwork: { address: toAddress, network: toNetwork },
assetAmount,
gasLimit,
minerTip,
gasPrice,
} = transferDetails

Expand Down Expand Up @@ -290,10 +281,6 @@ export const sendAsset = createBackgroundAsyncThunk(
request.gasLimit = gasLimit * 10n
}

if (minerTip) {
request.minerTip = minerTip * 10n
}

if (gasPrice) {
request.gasPrice = gasPrice * 10n
}
Expand Down
20 changes: 3 additions & 17 deletions background/redux-slices/qiSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export type QiSendState = {
senderQuaiAccount: AccountTotal | null
receiverPaymentCode: string
amount: string
minerTip: string
channelExists: boolean
}

Expand All @@ -19,7 +18,6 @@ const initialState: QiSendState = {
receiverPaymentCode: "",
amount: "",
senderQuaiAccount: null,
minerTip: "",
channelExists: false,
}

Expand All @@ -30,9 +28,6 @@ const qiSendSlice = createSlice({
setQiSendAmount: (immerState, { payload }: { payload: string }) => {
immerState.amount = payload
},
setQiSendMinerTip: (immerState, { payload }: { payload: string }) => {
immerState.minerTip = payload
},
setQiSendReceiverPaymentCode: (
immerState,
{ payload }: { payload: string }
Expand All @@ -59,7 +54,6 @@ const qiSendSlice = createSlice({
immerState.senderQuaiAccount = null
immerState.amount = ""
immerState.receiverPaymentCode = ""
immerState.minerTip = ""
immerState.channelExists = false
},
},
Expand All @@ -70,7 +64,6 @@ export const {
setQiSendAcc,
setQiSendAmount,
setQiSendReceiverPaymentCode,
setQiSendMinerTip,
setQiChannelExists,
resetQiSendSlice,
} = qiSendSlice.actions
Expand All @@ -82,27 +75,20 @@ export const sendQiTransaction = createBackgroundAsyncThunk(
async (_, { getState, dispatch }) => {
const { qiSend } = getState() as RootState

const {
amount,
senderQuaiAccount,
senderQiAccount,
receiverPaymentCode,
minerTip,
} = qiSend
const { amount, senderQuaiAccount, senderQiAccount, receiverPaymentCode } =
qiSend

const { address: quaiAddress = "" } = senderQuaiAccount || {}
const { paymentCode: senderPaymentCode } =
senderQiAccount as UtxoAccountData

const parsedAmount = parseQi(amount)
const minerTipBigInt = minerTip !== "" ? BigInt(minerTip) : null

await main.transactionService.sendQiTransaction(
parsedAmount,
quaiAddress,
senderPaymentCode,
receiverPaymentCode,
minerTipBigInt
receiverPaymentCode
)

dispatch(resetQiSendSlice())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const selectDefaultNetworkFeeSettings = createSelector(
transactionConstruction.transactionRequest?.gasLimit ?? 0
),
values: {
minerTip: selectedFeesPerGas?.minerTip ?? 0n,
gasPrice: selectedFeesPerGas?.gasPrice ?? 1000000000n,
baseFeePerGas:
networks.blockInfo[currentNetwork.chainID]?.baseFeePerGas ??
Expand Down
16 changes: 1 addition & 15 deletions background/redux-slices/transaction-construction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export type NetworkFeeSettings = {
gasLimit: bigint | undefined
suggestedGasLimit: bigint | undefined
values: {
minerTip: bigint
gasPrice: bigint
baseFeePerGas?: bigint
}
Expand Down Expand Up @@ -49,7 +48,6 @@ export type TransactionConstruction = {
export type EstimatedFeesPerGas = {
baseFeePerGas?: bigint
gasPrice?: bigint
minerTip?: bigint
auto?: BlockEstimate
instant?: BlockEstimate
express?: BlockEstimate
Expand All @@ -59,7 +57,6 @@ export type EstimatedFeesPerGas = {

const defaultCustomGas = {
gasPrice: 0n,
minerTip: 0n,
confidence: 0,
}

Expand All @@ -83,11 +80,9 @@ export type GasOption = {
estimatedSpeed: string
type: NetworkFeeTypeChosen
estimatedGwei: string
minerTipGwei: string
gasPriceGwei: string
dollarValue: string
gasPrice?: string
minerTip?: string
estimatedFeePerGas: bigint // wei
}

Expand All @@ -106,14 +101,8 @@ const makeBlockEstimate = (
gasPrice = estimatedFeesPerGas.baseFeePerGas
}

// Exaggerate differences between options
const minerTip =
estimatedFeesPerGas.estimatedPrices.find((el) => el.confidence === type)
?.minerTip ?? 0n

return {
gasPrice,
minerTip,
confidence: type,
}
}
Expand Down Expand Up @@ -154,7 +143,6 @@ export const sendTransaction = createBackgroundAsyncThunk(
to,
from,
gasLimit,
minerTip: selectedFeesPerGas?.minerTip,
gasPrice: selectedFeesPerGas?.gasPrice,
data,
value,
Expand Down Expand Up @@ -265,16 +253,14 @@ const transactionSlice = createSlice({
setCustomGas: (
immerState,
{
payload: { minerTip, gasPrice },
payload: { gasPrice },
}: {
payload: {
minerTip: bigint
gasPrice: bigint
}
}
) => {
immerState.customFeesPerGas = {
minerTip,
gasPrice,
confidence: 0,
}
Expand Down
10 changes: 1 addition & 9 deletions background/redux-slices/utils/activities-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,13 @@ export async function getActivityDetails(
})
.filter(isDefined)

const {
minerTip = null,
gasPrice = null,
nonce = null,
hash,
gasUsed,
blockNumber,
} = tx
const { gasPrice = null, nonce = null, hash, gasUsed, blockNumber } = tx
return [
{
label: "Block Height",
value: blockNumber ? blockNumber.toString() : "(Unknown)",
},
{ label: "Amount", value: getAmount(tx) ?? "" },
{ label: "Miner Tip", value: getGweiPrice(minerTip) },
{ label: "Gas Price", value: getGweiPrice(gasPrice) },
{ label: "Gas", value: gasUsed ? gasUsed.toString() : "" },
{ label: "Nonce", value: String(nonce) },
Expand Down
Loading