Skip to content

Commit 449863f

Browse files
filmakarovFilipp Makarov
andauthored
feat: mee 3.0.0, stx validator support (#184)
* chore: add new data packing for permit mode * chore: add unit tests for stxValidator * chore: add tests for no-stx mode * chore: refactor iterations * chore: fix tests * chore: fix test * chore: fix failing tests - all should pass * chore: simple mode tests pass * chore: add unit tests for the permit mode * chore: stx mode integration tests * chore: lint * chore: safe mode integration tests pass * chore: clean sign safe quote test * chore: clean sign safe quote test = * feat: p256 signer poc * chore: add correct prefixes for p256 * test: signQuote with p256 * chore: test Nexus.signMessage for all versions * chore: tests for p256 validator pass * chore: add test case for p256 simple mode * chore: add helpers * chore: add tests for helpers * chore: refactor integrationt ests * chore: refactor tests to not use mocks * chore: ownershiop management tests * chore: fix format warning * chore: add unit tests for 1271 signing logic in toNexusAccount * chore: unit tests for 1271 sigs * chore: polish 1271 unit tests * chore: add 6492 wrapping for signMessage1271 * chore: test verify 6492 signatures * chore: fix size limit * chore: fix a couple of tests * chore: fix test case when fallback to onchain happens * chore: fix test cases * chore: use helpers * chore: inline comments * chore: concurrent async operations * chore: improve code re-usage, fix typo * chore: refactor test case * chore: switch deoloyment addresses for mee 3.0.0 * chore: refactor signPermitQuote not to use _account (#187) Co-authored-by: Filipp Makarov <fmc@Filipps-MacBook-Pro.local> * chore: fix tests to use proper quote type (#188) * chore: fix tests to use proper quote type * chore: fix import --------- Co-authored-by: Filipp Makarov <fmc@Filipps-MacBook-Pro.local> --------- Co-authored-by: Filipp Makarov <fmc@Filipps-MacBook-Pro.local>
1 parent d32c5ff commit 449863f

46 files changed

Lines changed: 4849 additions & 522 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.size-limit.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"name": "core (esm)",
44
"path": "./dist/_esm/index.js",
5-
"limit": "70 kB",
5+
"limit": "85 kB",
66
"import": "*",
77
"ignore": ["node:fs", "fs", "path", "os", "crypto"]
88
},

bun.lock

Lines changed: 15 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"@ethersproject/providers": "^5.8.0",
1717
"@ethersproject/wallet": "^5.8.0",
1818
"@metamask/delegation-toolkit": "^0.11.0",
19+
"@noble/curves": "^2.0.1",
1920
"@pimlico/alto": "^0.0.4",
2021
"@rhinestone/module-sdk": "0.4.0",
2122
"@safe-global/protocol-kit": "6.1.2",

src/sdk/account/decorators/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ export * from "./deployGasTank"
1313
export * from "./getGasTankAddress"
1414
export * from "./getNonceWithKey"
1515
export * from "./withdrawFromGasTank"
16+
export * from "./ownership"

src/sdk/account/decorators/instructions/buildComposable.test.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ describe.runIf(runLifecycleTests)("mee.buildComposable", () => {
14271427
chainId: chain.id,
14281428
address: tokenAddress
14291429
},
1430-
upperBoundTimestamp: Math.floor(Date.now() / 1000) + 60
1430+
upperBoundTimestamp: Math.floor(Date.now() / 1000) + 75
14311431
})
14321432
}
14331433

@@ -1519,6 +1519,13 @@ describe.runIf(runLifecycleTests)("mee.buildComposable", () => {
15191519
const minBalanceRequired = await getMinRequiredBalance(testMcNexus)
15201520
const triggerAmount = 1n // not enough
15211521

1522+
const nexusUSDCBalanceBefore = await publicClient.readContract({
1523+
address: tokenAddress,
1524+
abi: erc20Abi,
1525+
functionName: "balanceOf",
1526+
args: [testMcNexus.addressOn(chain.id, true)]
1527+
})
1528+
15221529
const { getFusionQuote } = await setupConditionalTest(
15231530
testMcNexus,
15241531
testMeeClient,
@@ -1533,22 +1540,24 @@ describe.runIf(runLifecycleTests)("mee.buildComposable", () => {
15331540
const { hash } = await testMeeClient.executeFusionQuote({ fusionQuote })
15341541

15351542
console.log("waiting for supertransaction receipt")
1536-
await new Promise((resolve) => setTimeout(resolve, 65_000)) // 60s timeout
1543+
await new Promise((resolve) => setTimeout(resolve, 75_000)) // 75s timeout
15371544
// should fail since condition not met
15381545
const stxStatus = await getStxStatus(testMeeClient, hash)
15391546
expect(stxStatus).to.be.eq("FAILED")
15401547
console.log("transaction reverted as expected:", hash)
15411548

1542-
const nexusUSDCBalance = await publicClient.readContract({
1549+
const nexusUSDCBalanceAfter = await publicClient.readContract({
15431550
address: tokenAddress,
15441551
abi: erc20Abi,
15451552
functionName: "balanceOf",
15461553
args: [testMcNexus.addressOn(chain.id, true)]
15471554
})
15481555

1549-
console.log({ nexusUSDCBalance })
1556+
const nexusUSDCBalanceDelta =
1557+
nexusUSDCBalanceAfter - nexusUSDCBalanceBefore
1558+
console.log({ nexusUSDCBalanceDelta })
15501559
// nothing ever get executed
1551-
expect(nexusUSDCBalance).to.be.eq(0n)
1560+
expect(nexusUSDCBalanceDelta).to.be.eq(0n)
15521561
}
15531562
})
15541563

0 commit comments

Comments
 (0)