Skip to content

Commit 2a5ff8f

Browse files
committed
chore: add target and payment chains
1 parent 9fc7fbb commit 2a5ff8f

25 files changed

+295
-333
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ const meeClient = createMeeClient({ account: mcNexus })
4545

4646
const quote = await meeClient.getQuote({
4747
instructions: [{
48-
calls: [{ to: "0x...", value: 1n }],
48+
calls: [{ to: "0x...", value: 1n, gasLimit: 100000n }],
4949
chainId: base.id
5050
}],
51-
feeToken: {
52-
address: mcUSDC.addressOn(base.id), // Token used to pay for the transaction
53-
chainId: base.id // Chain where the payment will be processed
54-
}
51+
feeToken: toFeeToken({
52+
mcToken: mcUSDC,
53+
chainId: base.id
54+
})
5555
})
5656

5757
// Execute the quote and get back a transaction hash

src/sdk/account/decorators/build.test.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import type { Address, Chain, LocalAccount } from "viem"
2-
import { base } from "viem/chains"
1+
import type { Chain, LocalAccount } from "viem"
32
import { beforeAll, describe, expect, it } from "vitest"
4-
import { toNetwork } from "../../../test/testSetup"
3+
import { getTestChains, toNetwork } from "../../../test/testSetup"
54
import type { NetworkConfig } from "../../../test/testUtils"
65
import { type MeeClient, createMeeClient } from "../../clients/createMeeClient"
76
import { mcUSDC } from "../../constants/tokens"
@@ -14,20 +13,21 @@ import { build } from "./build"
1413
describe("mee:build", () => {
1514
let network: NetworkConfig
1615
let eoaAccount: LocalAccount
17-
let paymentChain: Chain
18-
let paymentToken: Address
16+
1917
let mcNexus: MultichainSmartAccount
2018
let meeClient: MeeClient
2119

20+
let targetChain: Chain
21+
let paymentChain: Chain
22+
2223
beforeAll(async () => {
2324
network = await toNetwork("MAINNET_FROM_ENV_VARS")
25+
;[paymentChain, targetChain] = getTestChains(network)
2426

25-
paymentChain = network.chain
26-
paymentToken = network.paymentToken!
2727
eoaAccount = network.account!
2828

2929
mcNexus = await toMultichainNexusAccount({
30-
chains: [base, paymentChain],
30+
chains: [paymentChain, targetChain],
3131
signer: eoaAccount
3232
})
3333

@@ -49,7 +49,7 @@ describe("mee:build", () => {
4949
value: 0n
5050
}
5151
],
52-
chainId: 8453
52+
chainId: targetChain.id
5353
}
5454
]
5555
}
@@ -66,7 +66,7 @@ describe("mee:build", () => {
6666
"value": 0n,
6767
},
6868
],
69-
"chainId": 8453,
69+
"chainId": ${targetChain.id},
7070
},
7171
]
7272
`)
@@ -81,7 +81,7 @@ describe("mee:build", () => {
8181
data: {
8282
amount: BigInt(1000),
8383
mcToken: mcUSDC,
84-
chain: base
84+
chain: targetChain
8585
}
8686
}
8787
)
@@ -100,7 +100,7 @@ describe("mee:build", () => {
100100
value: 0n
101101
}
102102
],
103-
chainId: 8453
103+
chainId: targetChain.id
104104
}
105105
]
106106
}

src/sdk/account/decorators/buildBridgeInstructions.test.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import type { Address, Chain, LocalAccount } from "viem"
2-
import { base } from "viem/chains"
1+
import type { Chain, LocalAccount } from "viem"
32
import { beforeAll, describe, expect, it } from "vitest"
4-
import { toNetwork } from "../../../test/testSetup"
3+
import { getTestChains, toNetwork } from "../../../test/testSetup"
54
import type { NetworkConfig } from "../../../test/testUtils"
65
import { type MeeClient, createMeeClient } from "../../clients/createMeeClient"
76
import { mcUSDC } from "../../constants/tokens"
@@ -11,25 +10,25 @@ import {
1110
} from "../toMultiChainNexusAccount"
1211
import { toAcrossPlugin } from "../utils/toAcrossPlugin"
1312
import buildBridgeInstructions from "./buildBridgeInstructions"
14-
import { getUnifiedERC20Balance } from "./getUnifiedERC20Balance"
1513

1614
describe("mee:buildBridgeInstructions", () => {
1715
let network: NetworkConfig
1816
let eoaAccount: LocalAccount
19-
let paymentChain: Chain
20-
let paymentToken: Address
17+
2118
let mcNexus: MultichainSmartAccount
2219
let meeClient: MeeClient
2320

21+
let targetChain: Chain
22+
let paymentChain: Chain
23+
2424
beforeAll(async () => {
2525
network = await toNetwork("MAINNET_FROM_ENV_VARS")
26+
;[paymentChain, targetChain] = getTestChains(network)
2627

27-
paymentChain = network.chain
28-
paymentToken = network.paymentToken!
2928
eoaAccount = network.account!
3029

3130
mcNexus = await toMultichainNexusAccount({
32-
chains: [base, paymentChain],
31+
chains: [paymentChain, targetChain],
3332
signer: eoaAccount
3433
})
3534

@@ -42,7 +41,7 @@ describe("mee:buildBridgeInstructions", () => {
4241
account: mcNexus,
4342
amount: 1n,
4443
bridgingPlugins: [toAcrossPlugin()],
45-
toChain: base,
44+
toChain: targetChain,
4645
unifiedBalance
4746
})
4847

src/sdk/account/decorators/getFactoryData.test.ts

+6-17
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,15 @@
1-
import {
2-
http,
3-
type Address,
4-
type Chain,
5-
type LocalAccount,
6-
type PublicClient,
7-
type WalletClient,
8-
createWalletClient
9-
} from "viem"
1+
import type { Chain, LocalAccount, PublicClient, WalletClient } from "viem"
102
import { afterAll, beforeAll, describe, expect, test } from "vitest"
11-
import { toNetwork } from "../../../test/testSetup"
3+
import { getTestChains, toNetwork } from "../../../test/testSetup"
124
import {
135
getTestAccount,
146
killNetwork,
157
toTestClient
168
} from "../../../test/testUtils"
179
import type { MasterClient, NetworkConfig } from "../../../test/testUtils"
18-
import {
19-
type NexusClient,
20-
createSmartAccountClient
21-
} from "../../clients/createSmartAccountClient"
2210
import {
2311
MEE_VALIDATOR_ADDRESS,
24-
RHINESTONE_ATTESTER_ADDRESS,
25-
TEST_ADDRESS_K1_VALIDATOR_ADDRESS,
26-
TEST_ADDRESS_K1_VALIDATOR_FACTORY_ADDRESS
12+
RHINESTONE_ATTESTER_ADDRESS
2713
} from "../../constants"
2814
import type { NexusAccount } from "../toNexusAccount"
2915
import { getK1FactoryData, getMeeFactoryData } from "./getFactoryData"
@@ -38,9 +24,12 @@ describe("nexus.account.getFactoryData", async () => {
3824
let eoaAccount: LocalAccount
3925
let nexusAccount: NexusAccount
4026
let walletClient: WalletClient
27+
let targetChain: Chain
28+
let paymentChain: Chain
4129

4230
beforeAll(async () => {
4331
network = await toNetwork("MAINNET_FROM_ENV_VARS")
32+
;[paymentChain, targetChain] = getTestChains(network)
4433

4534
chain = network.chain
4635
bundlerUrl = network.bundlerUrl

src/sdk/account/decorators/getUnifiedERC20Balance.test.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import type { Address, Chain, LocalAccount } from "viem"
2-
import { base } from "viem/chains"
1+
import type { Chain, LocalAccount } from "viem"
32
import { beforeAll, describe, expect, it } from "vitest"
4-
import { toNetwork } from "../../../test/testSetup"
3+
import { getTestChains, toNetwork } from "../../../test/testSetup"
54
import type { NetworkConfig } from "../../../test/testUtils"
65
import {
76
type MultichainSmartAccount,
@@ -14,20 +13,21 @@ import { getUnifiedERC20Balance } from "./getUnifiedERC20Balance"
1413
describe("mee:getUnifiedERC20Balance", () => {
1514
let network: NetworkConfig
1615
let eoaAccount: LocalAccount
17-
let paymentChain: Chain
18-
let paymentToken: Address
16+
1917
let mcNexus: MultichainSmartAccount
2018
let meeClient: MeeClient
2119

20+
let targetChain: Chain
21+
let paymentChain: Chain
22+
2223
beforeAll(async () => {
2324
network = await toNetwork("MAINNET_FROM_ENV_VARS")
25+
;[paymentChain, targetChain] = getTestChains(network)
2426

25-
paymentChain = network.chain
26-
paymentToken = network.paymentToken!
2727
eoaAccount = network.account!
2828

2929
mcNexus = await toMultichainNexusAccount({
30-
chains: [base, paymentChain],
30+
chains: [paymentChain, targetChain],
3131
signer: eoaAccount
3232
})
3333

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import type { Address, Chain, LocalAccount } from "viem"
2-
import { base } from "viem/chains"
1+
import type { Chain, LocalAccount } from "viem"
32
import { beforeAll, describe, expect, it } from "vitest"
4-
import { toNetwork } from "../../../../test/testSetup"
3+
import { getTestChains, toNetwork } from "../../../../test/testSetup"
54
import type { NetworkConfig } from "../../../../test/testUtils"
65
import {
76
type MeeClient,
@@ -16,20 +15,21 @@ import buildDefaultInstructions from "./buildDefaultInstructions"
1615
describe("mee:buildDefaultInstructions", () => {
1716
let network: NetworkConfig
1817
let eoaAccount: LocalAccount
19-
let paymentChain: Chain
20-
let paymentToken: Address
18+
2119
let mcNexus: MultichainSmartAccount
2220
let meeClient: MeeClient
2321

22+
let targetChain: Chain
23+
let paymentChain: Chain
24+
2425
beforeAll(async () => {
2526
network = await toNetwork("MAINNET_FROM_ENV_VARS")
27+
;[paymentChain, targetChain] = getTestChains(network)
2628

27-
paymentChain = network.chain
28-
paymentToken = network.paymentToken!
2929
eoaAccount = network.account!
3030

3131
mcNexus = await toMultichainNexusAccount({
32-
chains: [base, paymentChain],
32+
chains: [paymentChain, targetChain],
3333
signer: eoaAccount
3434
})
3535

@@ -44,7 +44,7 @@ describe("mee:buildDefaultInstructions", () => {
4444
{
4545
instructions: [
4646
{
47-
chainId: base.id,
47+
chainId: targetChain.id,
4848
calls: [
4949
{
5050
to: "0x0000000000000000000000000000000000000000",

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import type { Address, Chain, LocalAccount } from "viem"
2-
import { base } from "viem/chains"
1+
import type { Chain, LocalAccount } from "viem"
32
import { beforeAll, describe, expect, it } from "vitest"
4-
import { toNetwork } from "../../../../test/testSetup"
3+
import { getTestChains, toNetwork } from "../../../../test/testSetup"
54
import type { NetworkConfig } from "../../../../test/testUtils"
65
import {
76
type MeeClient,
@@ -18,20 +17,21 @@ import buildIntent from "./buildIntent"
1817
describe("mee:buildIntent", () => {
1918
let network: NetworkConfig
2019
let eoaAccount: LocalAccount
21-
let paymentChain: Chain
22-
let paymentToken: Address
20+
2321
let mcNexus: MultichainSmartAccount
2422
let meeClient: MeeClient
2523

24+
let targetChain: Chain
25+
let paymentChain: Chain
26+
2627
beforeAll(async () => {
2728
network = await toNetwork("MAINNET_FROM_ENV_VARS")
29+
;[paymentChain, targetChain] = getTestChains(network)
2830

29-
paymentChain = network.chain
30-
paymentToken = network.paymentToken!
3131
eoaAccount = network.account!
3232

3333
mcNexus = await toMultichainNexusAccount({
34-
chains: [base, paymentChain],
34+
chains: [paymentChain, targetChain],
3535
signer: eoaAccount
3636
})
3737

@@ -44,7 +44,7 @@ describe("mee:buildIntent", () => {
4444
{
4545
amount: 100n,
4646
mcToken: mcUSDC,
47-
chain: base
47+
chain: targetChain
4848
}
4949
)
5050

src/sdk/account/decorators/queryBridge.test.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
1-
import type { Address, Chain, LocalAccount } from "viem"
2-
import { base } from "viem/chains"
1+
import type { Chain, LocalAccount } from "viem"
32
import { beforeAll, describe, expect, it } from "vitest"
4-
import { toNetwork } from "../../../test/testSetup"
3+
import { getTestChains, toNetwork } from "../../../test/testSetup"
54
import type { NetworkConfig } from "../../../test/testUtils"
65
import { type MeeClient, createMeeClient } from "../../clients/createMeeClient"
76
import { mcUSDC } from "../../constants/tokens"
87
import {
98
type MultichainSmartAccount,
109
toMultichainNexusAccount
1110
} from "../toMultiChainNexusAccount"
12-
import { toAcrossPlugin } from "../utils/toAcrossPlugin"
1311
import type { MultichainAddressMapping } from "./buildBridgeInstructions"
1412
import { queryBridge } from "./queryBridge"
1513

1614
describe("mee:queryBridge", () => {
1715
let network: NetworkConfig
1816
let eoaAccount: LocalAccount
19-
let paymentChain: Chain
20-
let paymentToken: Address
17+
2118
let mcNexus: MultichainSmartAccount
2219
let meeClient: MeeClient
2320

21+
let targetChain: Chain
22+
let paymentChain: Chain
23+
2424
beforeAll(async () => {
2525
network = await toNetwork("MAINNET_FROM_ENV_VARS")
26+
;[paymentChain, targetChain] = getTestChains(network)
2627

27-
paymentChain = network.chain
28-
paymentToken = network.paymentToken!
2928
eoaAccount = network.account!
3029

3130
mcNexus = await toMultichainNexusAccount({
32-
chains: [base, paymentChain],
31+
chains: [paymentChain, targetChain],
3332
signer: eoaAccount
3433
})
3534

@@ -51,7 +50,7 @@ describe("mee:queryBridge", () => {
5150
const payload = await queryBridge({
5251
account: mcNexus,
5352
amount: 18600927n,
54-
toChain: base,
53+
toChain: targetChain,
5554
fromChain: paymentChain,
5655
tokenMapping
5756
})

src/sdk/account/decorators/queryBridge.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export type BridgeQueryResult = {
7979
* tokenMapping: {
8080
* deployments: [
8181
* { chainId: 10, address: "0x123..." },
82-
* { chainId: 8453, address: "0x456..." }
82+
* { chainId: targetChain.id, address: "0x456..." }
8383
* ],
8484
* on: (chainId) => deployments.find(d => d.chainId === chainId).address
8585
* }

0 commit comments

Comments
 (0)