contracts: add edut id stage aliases in smoke scripts
Some checks are pending
check / contracts (push) Waiting to run

This commit is contained in:
Edut LLC 2026-02-20 16:07:24 -08:00
parent d4bd0c480a
commit 54eaadb7c7
2 changed files with 31 additions and 15 deletions

View File

@ -136,6 +136,7 @@ async function main() {
undefined,
null
);
result.stages.edut_id_status_before = statusBefore;
result.stages.membership_status_before = statusBefore;
const intent = await expectOK("POST", "/secret/wallet/intent", {
@ -188,18 +189,18 @@ async function main() {
chain_id: CHAIN_ID,
});
let membershipTxHash;
let edutIDTxHash;
try {
membershipTxHash = await submitTransaction(signer, quote.tx || {});
edutIDTxHash = await submitTransaction(signer, quote.tx || {});
} catch (err) {
if (isInsufficientFundsError(err)) {
result.stages.membership_activation = summarizeSkip(
result.stages.edut_id_activation = summarizeSkip(
"insufficient_funds",
0,
String(err?.message || err)
);
} else if (isTxRevertError(err)) {
result.stages.membership_activation = summarizeSkip(
result.stages.edut_id_activation = summarizeSkip(
"tx_reverted",
0,
String(err?.message || err)
@ -208,7 +209,8 @@ async function main() {
throw err;
}
}
if (!membershipTxHash) {
result.stages.membership_activation = result.stages.edut_id_activation;
if (!edutIDTxHash) {
console.log(JSON.stringify(result, null, 2));
return;
}
@ -216,7 +218,7 @@ async function main() {
const confirmPayload = {
designation_code: intent.designation_code,
quote_id: quote.quote_id,
tx_hash: membershipTxHash,
tx_hash: edutIDTxHash,
address: wallet,
chain_id: CHAIN_ID,
};
@ -233,7 +235,7 @@ async function main() {
const confirmRes = await requestJSON("POST", "/secret/id/confirm", confirmPayload);
if (!confirmRes.ok) {
if (isTxPendingResponse(confirmRes)) {
result.stages.membership_activation = summarizeSkip(
result.stages.edut_id_activation = summarizeSkip(
"tx_pending",
confirmRes.status,
confirmRes.data?.error || JSON.stringify(confirmRes.data || {})
@ -244,16 +246,18 @@ async function main() {
);
}
} else {
result.stages.membership_activation = {
result.stages.edut_id_activation = {
status: confirmRes.data.status,
tx_hash: membershipTxHash,
tx_hash: edutIDTxHash,
identity_assurance_level: confirmRes.data.identity_assurance_level || null,
};
}
result.stages.membership_activation = result.stages.edut_id_activation;
} else {
result.stages.membership_activation = {
result.stages.edut_id_activation = {
status: "skipped_already_active",
};
result.stages.membership_activation = result.stages.edut_id_activation;
}
const statusAfter = await expectOK(
@ -262,6 +266,7 @@ async function main() {
undefined,
null
);
result.stages.edut_id_status_after = statusAfter;
result.stages.membership_status_after = statusAfter;
const offers = await expectOK("GET", "/marketplace/offers", undefined, sessionToken);
@ -280,6 +285,7 @@ async function main() {
principal_id: PRINCIPAL_ID,
principal_role: PRINCIPAL_ROLE,
workspace_id: WORKSPACE_ID,
include_edut_id_if_missing: false,
include_membership_if_missing: false,
},
sessionToken

View File

@ -1,7 +1,10 @@
const { ethers } = require("ethers");
const RPC_URL = (process.env.BASE_SEPOLIA_RPC_URL || "").trim();
const MEMBERSHIP_GAS = Number.parseInt((process.env.SMOKE_MEMBERSHIP_GAS || "160000").trim(), 10);
const EDUT_ID_GAS = Number.parseInt(
(process.env.SMOKE_EDUT_ID_GAS || process.env.SMOKE_MEMBERSHIP_GAS || "160000").trim(),
10
);
const CHECKOUT_GAS = Number.parseInt((process.env.SMOKE_CHECKOUT_GAS || "220000").trim(), 10);
const SAFETY_BPS = Number.parseInt((process.env.SMOKE_SAFETY_BPS || "15000").trim(), 10); // 1.5x
const MIN_GAS_PRICE_WEI = (process.env.SMOKE_MIN_GAS_PRICE_WEI || "1000000000").trim(); // 1 gwei floor
@ -36,7 +39,7 @@ function applySafety(valueWei) {
async function main() {
required("BASE_SEPOLIA_RPC_URL", RPC_URL);
validatePositiveInt("SMOKE_MEMBERSHIP_GAS", MEMBERSHIP_GAS);
validatePositiveInt("SMOKE_EDUT_ID_GAS", EDUT_ID_GAS);
validatePositiveInt("SMOKE_CHECKOUT_GAS", CHECKOUT_GAS);
validatePositiveInt("SMOKE_SAFETY_BPS", SAFETY_BPS);
const minGasPrice = ethers.BigNumber.from(required("SMOKE_MIN_GAS_PRICE_WEI", MIN_GAS_PRICE_WEI));
@ -52,9 +55,9 @@ async function main() {
}
const gasPrice = maxBigInt(feeCandidates);
const membershipWei = gasPrice.mul(MEMBERSHIP_GAS);
const edutIDWei = gasPrice.mul(EDUT_ID_GAS);
const checkoutWei = gasPrice.mul(CHECKOUT_GAS);
const freshWalletBaseWei = membershipWei.add(checkoutWei);
const freshWalletBaseWei = edutIDWei.add(checkoutWei);
const activeWalletBaseWei = checkoutWei;
const freshWalletRecommendedWei = applySafety(freshWalletBaseWei);
const activeWalletRecommendedWei = applySafety(activeWalletBaseWei);
@ -69,11 +72,18 @@ async function main() {
gas_price_wei: gasPrice.toString(),
gas_price_gwei: ethers.utils.formatUnits(gasPrice, "gwei"),
gas_budgets: {
membership: MEMBERSHIP_GAS,
edut_id: EDUT_ID_GAS,
membership: EDUT_ID_GAS,
checkout: CHECKOUT_GAS,
},
safety_multiplier: `${(SAFETY_BPS / 10000).toFixed(2)}x`,
thresholds: {
fresh_wallet_edut_id_plus_checkout: {
base_wei: freshWalletBaseWei.toString(),
base_eth: ethers.utils.formatEther(freshWalletBaseWei),
recommended_wei: freshWalletRecommendedWei.toString(),
recommended_eth: ethers.utils.formatEther(freshWalletRecommendedWei),
},
fresh_wallet_membership_plus_checkout: {
base_wei: freshWalletBaseWei.toString(),
base_eth: ethers.utils.formatEther(freshWalletBaseWei),